feat(ui): finalize E-TIB modernization with footer redesign, video optimization, and TS fixes
Former-commit-id: 67ac02c8404cc66893fdf97308574701cca6000c
This commit is contained in:
Generated
Vendored
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../unist-util-is@5.2.1/node_modules/unist-util-is
|
||||
Generated
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @typedef {import('./lib/index.js').Options} Options
|
||||
*/
|
||||
|
||||
// To do: next major: remove.
|
||||
/**
|
||||
* @typedef {Options} RemoveOptions
|
||||
*/
|
||||
|
||||
export {remove} from './lib/index.js'
|
||||
Generated
Vendored
+101
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @typedef {import('unist').Node} Node
|
||||
* @typedef {import('unist').Parent} Parent
|
||||
* @typedef {import('unist-util-is').Test} Test
|
||||
*
|
||||
* @typedef Options
|
||||
* Configuration.
|
||||
* @property {boolean | null | undefined} [cascade=true]
|
||||
* Whether to drop parent nodes if they had children, but all their children
|
||||
* were filtered out.
|
||||
*/
|
||||
|
||||
import {convert} from 'unist-util-is'
|
||||
|
||||
/** @type {Array<unknown>} */
|
||||
const empty = []
|
||||
|
||||
/**
|
||||
* Change the given `tree` by removing all nodes that pass `test`.
|
||||
*
|
||||
* The tree is walked in preorder (NLR), visiting the node itself, then its
|
||||
* head, etc.
|
||||
*
|
||||
* @param tree
|
||||
* Tree to change.
|
||||
* @param options
|
||||
* Configuration (optional).
|
||||
* @param test
|
||||
* `unist-util-is` compatible test.
|
||||
* @returns
|
||||
* The given `tree` without nodes that pass `test`.
|
||||
*
|
||||
* `null` is returned if `tree` itself didn’t pass the test or is cascaded
|
||||
* away.
|
||||
*/
|
||||
// To do: next major: don’t return `tree`.
|
||||
export const remove =
|
||||
/**
|
||||
* @type {(
|
||||
* (<Tree extends Node>(node: Tree, options: Options, test: Test) => Tree | null) &
|
||||
* (<Tree extends Node>(node: Tree, test: Test) => Tree | null)
|
||||
* )}
|
||||
*/
|
||||
(
|
||||
/**
|
||||
* @param {Node} tree
|
||||
* @param {Options | null | undefined} [options]
|
||||
* @param {Test | null | undefined} [test]
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
function (tree, options, test) {
|
||||
const is = convert(test || options)
|
||||
const cascade =
|
||||
!options || options.cascade === undefined || options.cascade === null
|
||||
? true
|
||||
: options.cascade
|
||||
|
||||
return preorder(tree)
|
||||
|
||||
/**
|
||||
* Check and remove nodes recursively in preorder.
|
||||
* For each composite node, modify its children array in-place.
|
||||
*
|
||||
* @param {Node} node
|
||||
* @param {number | null | undefined} [index]
|
||||
* @param {Parent | null | undefined} [parent]
|
||||
* @returns {Node | null}
|
||||
*/
|
||||
function preorder(node, index, parent) {
|
||||
/** @type {Array<Node>} */
|
||||
// @ts-expect-error looks like a parent.
|
||||
const children = node.children || empty
|
||||
let childIndex = -1
|
||||
let position = 0
|
||||
|
||||
if (is(node, index, parent)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (children.length > 0) {
|
||||
// Move all living children to the beginning of the children array.
|
||||
while (++childIndex < children.length) {
|
||||
// @ts-expect-error looks like a parent.
|
||||
if (preorder(children[childIndex], childIndex, node)) {
|
||||
children[position++] = children[childIndex]
|
||||
}
|
||||
}
|
||||
|
||||
// Cascade delete.
|
||||
if (cascade && !position) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Drop other nodes.
|
||||
children.length = position
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
}
|
||||
)
|
||||
Generated
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "unist-util-remove",
|
||||
"version": "3.1.1",
|
||||
"description": "unist utility to remove nodes from a tree",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"ast",
|
||||
"tree",
|
||||
"node",
|
||||
"cascade",
|
||||
"delete",
|
||||
"mutable",
|
||||
"remove",
|
||||
"squeeze",
|
||||
"strip"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-remove",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-remove/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Eugene Sharygin <eush77@gmail.com>",
|
||||
"contributors": [
|
||||
"Eugene Sharygin <eush77@gmail.com>",
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-is": "^5.0.0",
|
||||
"unist-util-visit-parents": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^11.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"unist-builder": "^3.0.0",
|
||||
"xo": "^0.53.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build": "tsc --build --clean && tsc --build && type-coverage",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node --conditions development test.js",
|
||||
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user