Upload folder using huggingface_hub (part 52)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tools/ui/node_modules/unist-util-is/index.d.ts +5 -0
- tools/ui/node_modules/unist-util-is/index.d.ts.map +1 -0
- tools/ui/node_modules/unist-util-is/index.js +7 -0
- tools/ui/node_modules/unist-util-is/lib/index.d.ts +111 -0
- tools/ui/node_modules/unist-util-is/lib/index.d.ts.map +1 -0
- tools/ui/node_modules/unist-util-is/lib/index.js +296 -0
- tools/ui/node_modules/unist-util-is/license +22 -0
- tools/ui/node_modules/unist-util-is/node_modules/@types/unist/LICENSE +21 -0
- tools/ui/node_modules/unist-util-is/node_modules/@types/unist/README.md +15 -0
- tools/ui/node_modules/unist-util-is/node_modules/@types/unist/index.d.ts +119 -0
- tools/ui/node_modules/unist-util-is/node_modules/@types/unist/package.json +60 -0
- tools/ui/node_modules/unist-util-is/package.json +103 -0
- tools/ui/node_modules/unist-util-is/readme.md +351 -0
- tools/ui/node_modules/unist-util-position/index.d.ts +1 -0
- tools/ui/node_modules/unist-util-position/index.js +1 -0
- tools/ui/node_modules/unist-util-position/lib/index.d.ts +45 -0
- tools/ui/node_modules/unist-util-position/lib/index.js +95 -0
- tools/ui/node_modules/unist-util-position/license +22 -0
- tools/ui/node_modules/unist-util-position/node_modules/@types/unist/LICENSE +21 -0
- tools/ui/node_modules/unist-util-position/node_modules/@types/unist/README.md +15 -0
- tools/ui/node_modules/unist-util-position/node_modules/@types/unist/index.d.ts +119 -0
- tools/ui/node_modules/unist-util-position/node_modules/@types/unist/package.json +60 -0
- tools/ui/node_modules/unist-util-position/package.json +76 -0
- tools/ui/node_modules/unist-util-position/readme.md +243 -0
- tools/ui/node_modules/unist-util-remove-position/index.d.ts +2 -0
- tools/ui/node_modules/unist-util-remove-position/index.js +5 -0
- tools/ui/node_modules/unist-util-remove-position/lib/index.d.ts +26 -0
- tools/ui/node_modules/unist-util-remove-position/lib/index.js +42 -0
- tools/ui/node_modules/unist-util-remove-position/license +22 -0
- tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/LICENSE +21 -0
- tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/README.md +15 -0
- tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/index.d.ts +119 -0
- tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/package.json +60 -0
- tools/ui/node_modules/unist-util-remove-position/package.json +84 -0
- tools/ui/node_modules/unist-util-remove-position/readme.md +227 -0
- tools/ui/node_modules/unist-util-stringify-position/index.d.ts +1 -0
- tools/ui/node_modules/unist-util-stringify-position/index.js +1 -0
- tools/ui/node_modules/unist-util-stringify-position/lib/index.d.ts +61 -0
- tools/ui/node_modules/unist-util-stringify-position/lib/index.js +84 -0
- tools/ui/node_modules/unist-util-stringify-position/license +22 -0
- tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/LICENSE +21 -0
- tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/README.md +15 -0
- tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/index.d.ts +119 -0
- tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/package.json +60 -0
- tools/ui/node_modules/unist-util-stringify-position/package.json +80 -0
- tools/ui/node_modules/unist-util-stringify-position/readme.md +206 -0
- tools/ui/node_modules/unist-util-visit-parents/index.d.ts +14 -0
- tools/ui/node_modules/unist-util-visit-parents/index.js +2 -0
- tools/ui/node_modules/unist-util-visit-parents/lib/color.d.ts +6 -0
- tools/ui/node_modules/unist-util-visit-parents/lib/color.d.ts.map +1 -0
tools/ui/node_modules/unist-util-is/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export type Check = import("./lib/index.js").Check;
|
| 2 |
+
export type Test = import("./lib/index.js").Test;
|
| 3 |
+
export type TestFunction = import("./lib/index.js").TestFunction;
|
| 4 |
+
export { is, convert } from "./lib/index.js";
|
| 5 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/unist-util-is/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"oBACa,OAAO,gBAAgB,EAAE,KAAK;mBAC9B,OAAO,gBAAgB,EAAE,IAAI;2BAC7B,OAAO,gBAAgB,EAAE,YAAY"}
|
tools/ui/node_modules/unist-util-is/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('./lib/index.js').Check} Check
|
| 3 |
+
* @typedef {import('./lib/index.js').Test} Test
|
| 4 |
+
* @typedef {import('./lib/index.js').TestFunction} TestFunction
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
export {is, convert} from './lib/index.js'
|
tools/ui/node_modules/unist-util-is/lib/index.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Node, Parent} from 'unist'
|
| 3 |
+
*/
|
| 4 |
+
/**
|
| 5 |
+
* @template Fn
|
| 6 |
+
* @template Fallback
|
| 7 |
+
* @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate
|
| 8 |
+
*/
|
| 9 |
+
/**
|
| 10 |
+
* @callback Check
|
| 11 |
+
* Check that an arbitrary value is a node.
|
| 12 |
+
* @param {unknown} this
|
| 13 |
+
* The given context.
|
| 14 |
+
* @param {unknown} [node]
|
| 15 |
+
* Anything (typically a node).
|
| 16 |
+
* @param {number | null | undefined} [index]
|
| 17 |
+
* The node’s position in its parent.
|
| 18 |
+
* @param {Parent | null | undefined} [parent]
|
| 19 |
+
* The node’s parent.
|
| 20 |
+
* @returns {boolean}
|
| 21 |
+
* Whether this is a node and passes a test.
|
| 22 |
+
*
|
| 23 |
+
* @typedef {Record<string, unknown> | Node} Props
|
| 24 |
+
* Object to check for equivalence.
|
| 25 |
+
*
|
| 26 |
+
* Note: `Node` is included as it is common but is not indexable.
|
| 27 |
+
*
|
| 28 |
+
* @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
|
| 29 |
+
* Check for an arbitrary node.
|
| 30 |
+
*
|
| 31 |
+
* @callback TestFunction
|
| 32 |
+
* Check if a node passes a test.
|
| 33 |
+
* @param {unknown} this
|
| 34 |
+
* The given context.
|
| 35 |
+
* @param {Node} node
|
| 36 |
+
* A node.
|
| 37 |
+
* @param {number | undefined} [index]
|
| 38 |
+
* The node’s position in its parent.
|
| 39 |
+
* @param {Parent | undefined} [parent]
|
| 40 |
+
* The node’s parent.
|
| 41 |
+
* @returns {boolean | undefined | void}
|
| 42 |
+
* Whether this node passes the test.
|
| 43 |
+
*
|
| 44 |
+
* Note: `void` is included until TS sees no return as `undefined`.
|
| 45 |
+
*/
|
| 46 |
+
/**
|
| 47 |
+
* Check if `node` is a `Node` and whether it passes the given test.
|
| 48 |
+
*
|
| 49 |
+
* @param {unknown} node
|
| 50 |
+
* Thing to check, typically `Node`.
|
| 51 |
+
* @param {Test} test
|
| 52 |
+
* A check for a specific node.
|
| 53 |
+
* @param {number | null | undefined} index
|
| 54 |
+
* The node’s position in its parent.
|
| 55 |
+
* @param {Parent | null | undefined} parent
|
| 56 |
+
* The node’s parent.
|
| 57 |
+
* @param {unknown} context
|
| 58 |
+
* Context object (`this`) to pass to `test` functions.
|
| 59 |
+
* @returns {boolean}
|
| 60 |
+
* Whether `node` is a node and passes a test.
|
| 61 |
+
*/
|
| 62 |
+
export const is: ((<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
|
| 63 |
+
type: Condition[number];
|
| 64 |
+
}) & (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
|
| 65 |
+
type: Condition[number];
|
| 66 |
+
}) & (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
|
| 67 |
+
type: Condition;
|
| 68 |
+
}) & (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) & ((node?: null | undefined) => false) & ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean));
|
| 69 |
+
/**
|
| 70 |
+
* Generate an assertion from a test.
|
| 71 |
+
*
|
| 72 |
+
* Useful if you’re going to test many nodes, for example when creating a
|
| 73 |
+
* utility where something else passes a compatible test.
|
| 74 |
+
*
|
| 75 |
+
* The created function is a bit faster because it expects valid input only:
|
| 76 |
+
* a `node`, `index`, and `parent`.
|
| 77 |
+
*
|
| 78 |
+
* @param {Test} test
|
| 79 |
+
* * when nullish, checks if `node` is a `Node`.
|
| 80 |
+
* * when `string`, works like passing `(node) => node.type === test`.
|
| 81 |
+
* * when `function` checks if function passed the node is true.
|
| 82 |
+
* * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
| 83 |
+
* * when `array`, checks if any one of the subtests pass.
|
| 84 |
+
* @returns {Check}
|
| 85 |
+
* An assertion.
|
| 86 |
+
*/
|
| 87 |
+
export const convert: ((<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
|
| 88 |
+
type: Condition;
|
| 89 |
+
}) & (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) & ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & ((test?: Test) => Check));
|
| 90 |
+
export type Predicate<Fn, Fallback> = Fn extends (value: any) => value is infer Thing ? Thing : Fallback;
|
| 91 |
+
/**
|
| 92 |
+
* Check that an arbitrary value is a node.
|
| 93 |
+
*/
|
| 94 |
+
export type Check = (this: unknown, node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined) => boolean;
|
| 95 |
+
/**
|
| 96 |
+
* Object to check for equivalence.
|
| 97 |
+
*
|
| 98 |
+
* Note: `Node` is included as it is common but is not indexable.
|
| 99 |
+
*/
|
| 100 |
+
export type Props = Record<string, unknown> | Node;
|
| 101 |
+
/**
|
| 102 |
+
* Check for an arbitrary node.
|
| 103 |
+
*/
|
| 104 |
+
export type Test = Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined;
|
| 105 |
+
/**
|
| 106 |
+
* Check if a node passes a test.
|
| 107 |
+
*/
|
| 108 |
+
export type TestFunction = (this: unknown, node: Node, index?: number | undefined, parent?: Parent | undefined) => boolean | undefined | void;
|
| 109 |
+
import type { Parent } from 'unist';
|
| 110 |
+
import type { Node } from 'unist';
|
| 111 |
+
//# sourceMappingURL=index.d.ts.map
|
tools/ui/node_modules/unist-util-is/lib/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,iBAGY,CACT,CAAK,CAAC,SAAS,SAAS,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG;IAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,GACrN,CAAK,CAAC,SAAS,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG;IAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,GAC7M,CAAK,CAAC,SAAS,SAAS,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC,GAC9L,CAAK,CAAC,SAAS,SAAS,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC,GACrL,CAAK,CAAC,SAAS,SAAS,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,GAC7M,CAAK,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,KAAK,KAAK,CAAC,GACxC,CAAK,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,GACxJ,CAAK,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,CACpI,CA4CH;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,sBAGY,CACT,CAAK,CAAC,SAAS,SAAS,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC,GAClM,CAAK,CAAC,SAAS,SAAS,KAAK,EAAE,IAAI,EAAE,SAAS,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC,GACzL,CAAK,CAAC,SAAS,SAAS,YAAY,EAAE,IAAI,EAAE,SAAS,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,GACjN,CAAK,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,GAC7J,CAAK,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,KAAK,CAAC,CACzB,CA8BH;sBA9KU,EAAE,EACF,QAAQ,IACR,EAAE,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,IAAI,MAAM,KAAK,GAAG,KAAK,GAAG,QAAQ;;;;2BAMpE,OAAO,SAEP,OAAO,UAEP,MAAM,GAAG,IAAI,GAAG,SAAS,WAEzB,MAAM,GAAG,IAAI,GAAG,SAAS,KAEvB,OAAO;;;;;;oBAGP,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;;;;mBAK9B,KAAK,CAAC,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC,GAAG,aAAa,CAAC,KAAK,GAAG,YAAY,GAAG,MAAM,CAAC,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;kCAKxI,OAAO,QAEP,IAAI,UAEJ,MAAM,GAAG,SAAS,WAElB,MAAM,GAAG,SAAS,KAEhB,OAAO,GAAG,SAAS,GAAG,IAAI;4BAzCR,OAAO;0BAAP,OAAO"}
|
tools/ui/node_modules/unist-util-is/lib/index.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @import {Node, Parent} from 'unist'
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* @template Fn
|
| 7 |
+
* @template Fallback
|
| 8 |
+
* @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* @callback Check
|
| 13 |
+
* Check that an arbitrary value is a node.
|
| 14 |
+
* @param {unknown} this
|
| 15 |
+
* The given context.
|
| 16 |
+
* @param {unknown} [node]
|
| 17 |
+
* Anything (typically a node).
|
| 18 |
+
* @param {number | null | undefined} [index]
|
| 19 |
+
* The node’s position in its parent.
|
| 20 |
+
* @param {Parent | null | undefined} [parent]
|
| 21 |
+
* The node’s parent.
|
| 22 |
+
* @returns {boolean}
|
| 23 |
+
* Whether this is a node and passes a test.
|
| 24 |
+
*
|
| 25 |
+
* @typedef {Record<string, unknown> | Node} Props
|
| 26 |
+
* Object to check for equivalence.
|
| 27 |
+
*
|
| 28 |
+
* Note: `Node` is included as it is common but is not indexable.
|
| 29 |
+
*
|
| 30 |
+
* @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
|
| 31 |
+
* Check for an arbitrary node.
|
| 32 |
+
*
|
| 33 |
+
* @callback TestFunction
|
| 34 |
+
* Check if a node passes a test.
|
| 35 |
+
* @param {unknown} this
|
| 36 |
+
* The given context.
|
| 37 |
+
* @param {Node} node
|
| 38 |
+
* A node.
|
| 39 |
+
* @param {number | undefined} [index]
|
| 40 |
+
* The node’s position in its parent.
|
| 41 |
+
* @param {Parent | undefined} [parent]
|
| 42 |
+
* The node’s parent.
|
| 43 |
+
* @returns {boolean | undefined | void}
|
| 44 |
+
* Whether this node passes the test.
|
| 45 |
+
*
|
| 46 |
+
* Note: `void` is included until TS sees no return as `undefined`.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Check if `node` is a `Node` and whether it passes the given test.
|
| 51 |
+
*
|
| 52 |
+
* @param {unknown} node
|
| 53 |
+
* Thing to check, typically `Node`.
|
| 54 |
+
* @param {Test} test
|
| 55 |
+
* A check for a specific node.
|
| 56 |
+
* @param {number | null | undefined} index
|
| 57 |
+
* The node’s position in its parent.
|
| 58 |
+
* @param {Parent | null | undefined} parent
|
| 59 |
+
* The node’s parent.
|
| 60 |
+
* @param {unknown} context
|
| 61 |
+
* Context object (`this`) to pass to `test` functions.
|
| 62 |
+
* @returns {boolean}
|
| 63 |
+
* Whether `node` is a node and passes a test.
|
| 64 |
+
*/
|
| 65 |
+
export const is =
|
| 66 |
+
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
| 67 |
+
/**
|
| 68 |
+
* @type {(
|
| 69 |
+
* (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
|
| 70 |
+
* (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
|
| 71 |
+
* (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
| 72 |
+
* (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
| 73 |
+
* (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
| 74 |
+
* ((node?: null | undefined) => false) &
|
| 75 |
+
* ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
| 76 |
+
* ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)
|
| 77 |
+
* )}
|
| 78 |
+
*/
|
| 79 |
+
(
|
| 80 |
+
/**
|
| 81 |
+
* @param {unknown} [node]
|
| 82 |
+
* @param {Test} [test]
|
| 83 |
+
* @param {number | null | undefined} [index]
|
| 84 |
+
* @param {Parent | null | undefined} [parent]
|
| 85 |
+
* @param {unknown} [context]
|
| 86 |
+
* @returns {boolean}
|
| 87 |
+
*/
|
| 88 |
+
// eslint-disable-next-line max-params
|
| 89 |
+
function (node, test, index, parent, context) {
|
| 90 |
+
const check = convert(test)
|
| 91 |
+
|
| 92 |
+
if (
|
| 93 |
+
index !== undefined &&
|
| 94 |
+
index !== null &&
|
| 95 |
+
(typeof index !== 'number' ||
|
| 96 |
+
index < 0 ||
|
| 97 |
+
index === Number.POSITIVE_INFINITY)
|
| 98 |
+
) {
|
| 99 |
+
throw new Error('Expected positive finite index')
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
if (
|
| 103 |
+
parent !== undefined &&
|
| 104 |
+
parent !== null &&
|
| 105 |
+
(!is(parent) || !parent.children)
|
| 106 |
+
) {
|
| 107 |
+
throw new Error('Expected parent node')
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
if (
|
| 111 |
+
(parent === undefined || parent === null) !==
|
| 112 |
+
(index === undefined || index === null)
|
| 113 |
+
) {
|
| 114 |
+
throw new Error('Expected both parent and index')
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
return looksLikeANode(node)
|
| 118 |
+
? check.call(context, node, index, parent)
|
| 119 |
+
: false
|
| 120 |
+
}
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
/**
|
| 124 |
+
* Generate an assertion from a test.
|
| 125 |
+
*
|
| 126 |
+
* Useful if you’re going to test many nodes, for example when creating a
|
| 127 |
+
* utility where something else passes a compatible test.
|
| 128 |
+
*
|
| 129 |
+
* The created function is a bit faster because it expects valid input only:
|
| 130 |
+
* a `node`, `index`, and `parent`.
|
| 131 |
+
*
|
| 132 |
+
* @param {Test} test
|
| 133 |
+
* * when nullish, checks if `node` is a `Node`.
|
| 134 |
+
* * when `string`, works like passing `(node) => node.type === test`.
|
| 135 |
+
* * when `function` checks if function passed the node is true.
|
| 136 |
+
* * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
| 137 |
+
* * when `array`, checks if any one of the subtests pass.
|
| 138 |
+
* @returns {Check}
|
| 139 |
+
* An assertion.
|
| 140 |
+
*/
|
| 141 |
+
export const convert =
|
| 142 |
+
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
| 143 |
+
/**
|
| 144 |
+
* @type {(
|
| 145 |
+
* (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
| 146 |
+
* (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
| 147 |
+
* (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
| 148 |
+
* ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
| 149 |
+
* ((test?: Test) => Check)
|
| 150 |
+
* )}
|
| 151 |
+
*/
|
| 152 |
+
(
|
| 153 |
+
/**
|
| 154 |
+
* @param {Test} [test]
|
| 155 |
+
* @returns {Check}
|
| 156 |
+
*/
|
| 157 |
+
function (test) {
|
| 158 |
+
if (test === null || test === undefined) {
|
| 159 |
+
return ok
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
if (typeof test === 'function') {
|
| 163 |
+
return castFactory(test)
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
if (typeof test === 'object') {
|
| 167 |
+
return Array.isArray(test)
|
| 168 |
+
? anyFactory(test)
|
| 169 |
+
: // Cast because `ReadonlyArray` goes into the above but `isArray`
|
| 170 |
+
// narrows to `Array`.
|
| 171 |
+
propertiesFactory(/** @type {Props} */ (test))
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
if (typeof test === 'string') {
|
| 175 |
+
return typeFactory(test)
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
throw new Error('Expected function, string, or object as test')
|
| 179 |
+
}
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* @param {Array<Props | TestFunction | string>} tests
|
| 184 |
+
* @returns {Check}
|
| 185 |
+
*/
|
| 186 |
+
function anyFactory(tests) {
|
| 187 |
+
/** @type {Array<Check>} */
|
| 188 |
+
const checks = []
|
| 189 |
+
let index = -1
|
| 190 |
+
|
| 191 |
+
while (++index < tests.length) {
|
| 192 |
+
checks[index] = convert(tests[index])
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
return castFactory(any)
|
| 196 |
+
|
| 197 |
+
/**
|
| 198 |
+
* @this {unknown}
|
| 199 |
+
* @type {TestFunction}
|
| 200 |
+
*/
|
| 201 |
+
function any(...parameters) {
|
| 202 |
+
let index = -1
|
| 203 |
+
|
| 204 |
+
while (++index < checks.length) {
|
| 205 |
+
if (checks[index].apply(this, parameters)) return true
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
return false
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
/**
|
| 213 |
+
* Turn an object into a test for a node with a certain fields.
|
| 214 |
+
*
|
| 215 |
+
* @param {Props} check
|
| 216 |
+
* @returns {Check}
|
| 217 |
+
*/
|
| 218 |
+
function propertiesFactory(check) {
|
| 219 |
+
const checkAsRecord = /** @type {Record<string, unknown>} */ (check)
|
| 220 |
+
|
| 221 |
+
return castFactory(all)
|
| 222 |
+
|
| 223 |
+
/**
|
| 224 |
+
* @param {Node} node
|
| 225 |
+
* @returns {boolean}
|
| 226 |
+
*/
|
| 227 |
+
function all(node) {
|
| 228 |
+
const nodeAsRecord = /** @type {Record<string, unknown>} */ (
|
| 229 |
+
/** @type {unknown} */ (node)
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
/** @type {string} */
|
| 233 |
+
let key
|
| 234 |
+
|
| 235 |
+
for (key in check) {
|
| 236 |
+
if (nodeAsRecord[key] !== checkAsRecord[key]) return false
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
return true
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
/**
|
| 244 |
+
* Turn a string into a test for a node with a certain type.
|
| 245 |
+
*
|
| 246 |
+
* @param {string} check
|
| 247 |
+
* @returns {Check}
|
| 248 |
+
*/
|
| 249 |
+
function typeFactory(check) {
|
| 250 |
+
return castFactory(type)
|
| 251 |
+
|
| 252 |
+
/**
|
| 253 |
+
* @param {Node} node
|
| 254 |
+
*/
|
| 255 |
+
function type(node) {
|
| 256 |
+
return node && node.type === check
|
| 257 |
+
}
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
/**
|
| 261 |
+
* Turn a custom test into a test for a node that passes that test.
|
| 262 |
+
*
|
| 263 |
+
* @param {TestFunction} testFunction
|
| 264 |
+
* @returns {Check}
|
| 265 |
+
*/
|
| 266 |
+
function castFactory(testFunction) {
|
| 267 |
+
return check
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* @this {unknown}
|
| 271 |
+
* @type {Check}
|
| 272 |
+
*/
|
| 273 |
+
function check(value, index, parent) {
|
| 274 |
+
return Boolean(
|
| 275 |
+
looksLikeANode(value) &&
|
| 276 |
+
testFunction.call(
|
| 277 |
+
this,
|
| 278 |
+
value,
|
| 279 |
+
typeof index === 'number' ? index : undefined,
|
| 280 |
+
parent || undefined
|
| 281 |
+
)
|
| 282 |
+
)
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
function ok() {
|
| 287 |
+
return true
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
/**
|
| 291 |
+
* @param {unknown} value
|
| 292 |
+
* @returns {value is Node}
|
| 293 |
+
*/
|
| 294 |
+
function looksLikeANode(value) {
|
| 295 |
+
return value !== null && typeof value === 'object' && 'type' in value
|
| 296 |
+
}
|
tools/ui/node_modules/unist-util-is/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT license)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
tools/ui/node_modules/unist-util-is/node_modules/@types/unist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
tools/ui/node_modules/unist-util-is/node_modules/@types/unist/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/unist`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for unist (https://github.com/syntax-tree/unist).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Thu, 15 Aug 2024 02:18:53 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), [JounQin](https://github.com/JounQin), and [Remco Haszing](https://github.com/remcohaszing).
|
tools/ui/node_modules/unist-util-is/node_modules/@types/unist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ## Interfaces
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Info associated with nodes by the ecosystem.
|
| 5 |
+
*
|
| 6 |
+
* This space is guaranteed to never be specified by unist or specifications
|
| 7 |
+
* implementing unist.
|
| 8 |
+
* But you can use it in utilities and plugins to store data.
|
| 9 |
+
*
|
| 10 |
+
* This type can be augmented to register custom data.
|
| 11 |
+
* For example:
|
| 12 |
+
*
|
| 13 |
+
* ```ts
|
| 14 |
+
* declare module 'unist' {
|
| 15 |
+
* interface Data {
|
| 16 |
+
* // `someNode.data.myId` is typed as `number | undefined`
|
| 17 |
+
* myId?: number | undefined
|
| 18 |
+
* }
|
| 19 |
+
* }
|
| 20 |
+
* ```
|
| 21 |
+
*/
|
| 22 |
+
export interface Data {}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* One place in a source file.
|
| 26 |
+
*/
|
| 27 |
+
export interface Point {
|
| 28 |
+
/**
|
| 29 |
+
* Line in a source file (1-indexed integer).
|
| 30 |
+
*/
|
| 31 |
+
line: number;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Column in a source file (1-indexed integer).
|
| 35 |
+
*/
|
| 36 |
+
column: number;
|
| 37 |
+
/**
|
| 38 |
+
* Character in a source file (0-indexed integer).
|
| 39 |
+
*/
|
| 40 |
+
offset?: number | undefined;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Position of a node in a source document.
|
| 45 |
+
*
|
| 46 |
+
* A position is a range between two points.
|
| 47 |
+
*/
|
| 48 |
+
export interface Position {
|
| 49 |
+
/**
|
| 50 |
+
* Place of the first character of the parsed source region.
|
| 51 |
+
*/
|
| 52 |
+
start: Point;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Place of the first character after the parsed source region.
|
| 56 |
+
*/
|
| 57 |
+
end: Point;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// ## Abstract nodes
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Abstract unist node that contains the smallest possible value.
|
| 64 |
+
*
|
| 65 |
+
* This interface is supposed to be extended.
|
| 66 |
+
*
|
| 67 |
+
* For example, in HTML, a `text` node is a leaf that contains text.
|
| 68 |
+
*/
|
| 69 |
+
export interface Literal extends Node {
|
| 70 |
+
/**
|
| 71 |
+
* Plain value.
|
| 72 |
+
*/
|
| 73 |
+
value: unknown;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Abstract unist node.
|
| 78 |
+
*
|
| 79 |
+
* The syntactic unit in unist syntax trees are called nodes.
|
| 80 |
+
*
|
| 81 |
+
* This interface is supposed to be extended.
|
| 82 |
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
| 83 |
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
| 84 |
+
* nor parent, but still a node.
|
| 85 |
+
*/
|
| 86 |
+
export interface Node {
|
| 87 |
+
/**
|
| 88 |
+
* Node type.
|
| 89 |
+
*/
|
| 90 |
+
type: string;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Info from the ecosystem.
|
| 94 |
+
*/
|
| 95 |
+
data?: Data | undefined;
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Position of a node in a source document.
|
| 99 |
+
*
|
| 100 |
+
* Nodes that are generated (not in the original source document) must not
|
| 101 |
+
* have a position.
|
| 102 |
+
*/
|
| 103 |
+
position?: Position | undefined;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Abstract unist node that contains other nodes (*children*).
|
| 108 |
+
*
|
| 109 |
+
* This interface is supposed to be extended.
|
| 110 |
+
*
|
| 111 |
+
* For example, in XML, an element is a parent of different things, such as
|
| 112 |
+
* comments, text, and further elements.
|
| 113 |
+
*/
|
| 114 |
+
export interface Parent extends Node {
|
| 115 |
+
/**
|
| 116 |
+
* List of children.
|
| 117 |
+
*/
|
| 118 |
+
children: Node[];
|
| 119 |
+
}
|
tools/ui/node_modules/unist-util-is/node_modules/@types/unist/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/unist",
|
| 3 |
+
"version": "3.0.3",
|
| 4 |
+
"description": "TypeScript definitions for unist",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "bizen241",
|
| 10 |
+
"githubUsername": "bizen241",
|
| 11 |
+
"url": "https://github.com/bizen241"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Jun Lu",
|
| 15 |
+
"githubUsername": "lujun2",
|
| 16 |
+
"url": "https://github.com/lujun2"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Hernan Rajchert",
|
| 20 |
+
"githubUsername": "hrajchert",
|
| 21 |
+
"url": "https://github.com/hrajchert"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Titus Wormer",
|
| 25 |
+
"githubUsername": "wooorm",
|
| 26 |
+
"url": "https://github.com/wooorm"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Junyoung Choi",
|
| 30 |
+
"githubUsername": "rokt33r",
|
| 31 |
+
"url": "https://github.com/rokt33r"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Ben Moon",
|
| 35 |
+
"githubUsername": "GuiltyDolphin",
|
| 36 |
+
"url": "https://github.com/GuiltyDolphin"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "JounQin",
|
| 40 |
+
"githubUsername": "JounQin",
|
| 41 |
+
"url": "https://github.com/JounQin"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Remco Haszing",
|
| 45 |
+
"githubUsername": "remcohaszing",
|
| 46 |
+
"url": "https://github.com/remcohaszing"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"main": "",
|
| 50 |
+
"types": "index.d.ts",
|
| 51 |
+
"repository": {
|
| 52 |
+
"type": "git",
|
| 53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 54 |
+
"directory": "types/unist"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {},
|
| 57 |
+
"dependencies": {},
|
| 58 |
+
"typesPublisherContentHash": "7f3d5ce8d56003f3583a5317f98d444bdc99910c7b486c6b10af4f38694e61fe",
|
| 59 |
+
"typeScriptVersion": "4.8"
|
| 60 |
+
}
|
tools/ui/node_modules/unist-util-is/package.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "unist-util-is",
|
| 3 |
+
"version": "6.0.1",
|
| 4 |
+
"description": "unist utility to check if a node passes a test",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"unist",
|
| 8 |
+
"unist-util",
|
| 9 |
+
"util",
|
| 10 |
+
"utility",
|
| 11 |
+
"tree",
|
| 12 |
+
"node",
|
| 13 |
+
"is",
|
| 14 |
+
"equal",
|
| 15 |
+
"check",
|
| 16 |
+
"test",
|
| 17 |
+
"type"
|
| 18 |
+
],
|
| 19 |
+
"repository": "syntax-tree/unist-util-is",
|
| 20 |
+
"bugs": "https://github.com/syntax-tree/unist-util-is/issues",
|
| 21 |
+
"funding": {
|
| 22 |
+
"type": "opencollective",
|
| 23 |
+
"url": "https://opencollective.com/unified"
|
| 24 |
+
},
|
| 25 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 26 |
+
"contributors": [
|
| 27 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 28 |
+
"Christian Murphy <christian.murphy.42@gmail.com>",
|
| 29 |
+
"Lucas Brandstaetter <lucas@brandstaetter.tech> (https://github.com/Roang-zero1)"
|
| 30 |
+
],
|
| 31 |
+
"sideEffects": false,
|
| 32 |
+
"type": "module",
|
| 33 |
+
"exports": "./index.js",
|
| 34 |
+
"files": [
|
| 35 |
+
"lib/",
|
| 36 |
+
"index.d.ts.map",
|
| 37 |
+
"index.d.ts",
|
| 38 |
+
"index.js"
|
| 39 |
+
],
|
| 40 |
+
"dependencies": {
|
| 41 |
+
"@types/unist": "^3.0.0"
|
| 42 |
+
},
|
| 43 |
+
"devDependencies": {
|
| 44 |
+
"@types/mdast": "^4.0.0",
|
| 45 |
+
"@types/node": "^24.0.0",
|
| 46 |
+
"c8": "^10.0.0",
|
| 47 |
+
"prettier": "^3.0.0",
|
| 48 |
+
"remark-cli": "^12.0.0",
|
| 49 |
+
"remark-preset-wooorm": "^11.0.0",
|
| 50 |
+
"tsd": "^0.33.0",
|
| 51 |
+
"type-coverage": "^2.0.0",
|
| 52 |
+
"typescript": "^5.0.0",
|
| 53 |
+
"xo": "^0.58.0"
|
| 54 |
+
},
|
| 55 |
+
"scripts": {
|
| 56 |
+
"prepack": "npm run build && npm run format",
|
| 57 |
+
"build": "tsc --build --clean && tsc --build && tsd && type-coverage",
|
| 58 |
+
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
|
| 59 |
+
"test-api": "node --conditions development test/index.js",
|
| 60 |
+
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
| 61 |
+
"test": "npm run build && npm run format && npm run test-coverage"
|
| 62 |
+
},
|
| 63 |
+
"prettier": {
|
| 64 |
+
"bracketSpacing": false,
|
| 65 |
+
"semi": false,
|
| 66 |
+
"singleQuote": true,
|
| 67 |
+
"tabWidth": 2,
|
| 68 |
+
"trailingComma": "none",
|
| 69 |
+
"useTabs": false
|
| 70 |
+
},
|
| 71 |
+
"remarkConfig": {
|
| 72 |
+
"plugins": [
|
| 73 |
+
"remark-preset-wooorm"
|
| 74 |
+
]
|
| 75 |
+
},
|
| 76 |
+
"typeCoverage": {
|
| 77 |
+
"atLeast": 100,
|
| 78 |
+
"detail": true,
|
| 79 |
+
"#": "needed `any`s",
|
| 80 |
+
"ignoreFiles": [
|
| 81 |
+
"lib/index.d.ts"
|
| 82 |
+
],
|
| 83 |
+
"ignoreCatch": true,
|
| 84 |
+
"strict": true
|
| 85 |
+
},
|
| 86 |
+
"xo": {
|
| 87 |
+
"overrides": [
|
| 88 |
+
{
|
| 89 |
+
"files": [
|
| 90 |
+
"**/*.ts"
|
| 91 |
+
],
|
| 92 |
+
"rules": {
|
| 93 |
+
"@typescript-eslint/consistent-type-definitions": "off",
|
| 94 |
+
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
| 95 |
+
"@typescript-eslint/no-unsafe-argument": "off",
|
| 96 |
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
| 97 |
+
"import/no-extraneous-dependencies": "off"
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
],
|
| 101 |
+
"prettier": true
|
| 102 |
+
}
|
| 103 |
+
}
|
tools/ui/node_modules/unist-util-is/readme.md
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# unist-util-is
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][collective]
|
| 8 |
+
[![Backers][backers-badge]][collective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[unist][] utility to check if nodes pass a test.
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`is(node[, test[, index, parent[, context]]])`](#isnode-test-index-parent-context)
|
| 21 |
+
* [`convert(test)`](#converttest)
|
| 22 |
+
* [`Check`](#check)
|
| 23 |
+
* [`Test`](#test)
|
| 24 |
+
* [`TestFunction`](#testfunction)
|
| 25 |
+
* [Examples](#examples)
|
| 26 |
+
* [Example of `convert`](#example-of-convert)
|
| 27 |
+
* [Types](#types)
|
| 28 |
+
* [Compatibility](#compatibility)
|
| 29 |
+
* [Related](#related)
|
| 30 |
+
* [Contribute](#contribute)
|
| 31 |
+
* [License](#license)
|
| 32 |
+
|
| 33 |
+
## What is this?
|
| 34 |
+
|
| 35 |
+
This package is a small utility that checks that a node is a certain node.
|
| 36 |
+
|
| 37 |
+
## When should I use this?
|
| 38 |
+
|
| 39 |
+
Use this small utility if you find yourself repeating code for checking what
|
| 40 |
+
nodes are.
|
| 41 |
+
|
| 42 |
+
A similar package, [`hast-util-is-element`][hast-util-is-element], works on hast
|
| 43 |
+
elements.
|
| 44 |
+
|
| 45 |
+
For more advanced tests, [`unist-util-select`][unist-util-select] can be used
|
| 46 |
+
to match against CSS selectors.
|
| 47 |
+
|
| 48 |
+
## Install
|
| 49 |
+
|
| 50 |
+
This package is [ESM only][esm].
|
| 51 |
+
In Node.js (version 16+), install with [npm][]:
|
| 52 |
+
|
| 53 |
+
```sh
|
| 54 |
+
npm install unist-util-is
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 58 |
+
|
| 59 |
+
```js
|
| 60 |
+
import {is} from 'https://esm.sh/unist-util-is@6'
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 64 |
+
|
| 65 |
+
```html
|
| 66 |
+
<script type="module">
|
| 67 |
+
import {is} from 'https://esm.sh/unist-util-is@6?bundle'
|
| 68 |
+
</script>
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Use
|
| 72 |
+
|
| 73 |
+
```js
|
| 74 |
+
import {is} from 'unist-util-is'
|
| 75 |
+
|
| 76 |
+
const node = {type: 'strong'}
|
| 77 |
+
const parent = {type: 'paragraph', children: [node]}
|
| 78 |
+
|
| 79 |
+
is() // => false
|
| 80 |
+
is({children: []}) // => false
|
| 81 |
+
is(node) // => true
|
| 82 |
+
is(node, 'strong') // => true
|
| 83 |
+
is(node, 'emphasis') // => false
|
| 84 |
+
|
| 85 |
+
is(node, node) // => true
|
| 86 |
+
is(parent, {type: 'paragraph'}) // => true
|
| 87 |
+
is(parent, {type: 'strong'}) // => false
|
| 88 |
+
|
| 89 |
+
is(node, test) // => false
|
| 90 |
+
is(node, test, 4, parent) // => false
|
| 91 |
+
is(node, test, 5, parent) // => true
|
| 92 |
+
|
| 93 |
+
function test(node, n) {
|
| 94 |
+
return n === 5
|
| 95 |
+
}
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
## API
|
| 99 |
+
|
| 100 |
+
This package exports the identifiers [`convert`][api-convert] and
|
| 101 |
+
[`is`][api-is].
|
| 102 |
+
There is no default export.
|
| 103 |
+
|
| 104 |
+
### `is(node[, test[, index, parent[, context]]])`
|
| 105 |
+
|
| 106 |
+
Check if `node` is a `Node` and whether it passes the given test.
|
| 107 |
+
|
| 108 |
+
###### Parameters
|
| 109 |
+
|
| 110 |
+
* `node` (`unknown`, optional)
|
| 111 |
+
— thing to check, typically [`Node`][node]
|
| 112 |
+
* `test` ([`Test`][api-test], optional)
|
| 113 |
+
— a test for a specific element
|
| 114 |
+
* `index` (`number`, optional)
|
| 115 |
+
— the node’s position in its parent
|
| 116 |
+
* `parent` ([`Node`][node], optional)
|
| 117 |
+
— the node’s parent
|
| 118 |
+
* `context` (`unknown`, optional)
|
| 119 |
+
— context object (`this`) to call `test` with
|
| 120 |
+
|
| 121 |
+
###### Returns
|
| 122 |
+
|
| 123 |
+
Whether `node` is a [`Node`][node] and passes a test (`boolean`).
|
| 124 |
+
|
| 125 |
+
###### Throws
|
| 126 |
+
|
| 127 |
+
When an incorrect `test`, `index`, or `parent` is given.
|
| 128 |
+
There is no error thrown when `node` is not a node.
|
| 129 |
+
|
| 130 |
+
### `convert(test)`
|
| 131 |
+
|
| 132 |
+
Generate a check from a test.
|
| 133 |
+
|
| 134 |
+
Useful if you’re going to test many nodes, for example when creating a
|
| 135 |
+
utility where something else passes a compatible test.
|
| 136 |
+
|
| 137 |
+
The created function is a bit faster because it expects valid input only:
|
| 138 |
+
a `node`, `index`, and `parent`.
|
| 139 |
+
|
| 140 |
+
###### Parameters
|
| 141 |
+
|
| 142 |
+
* `test` ([`Test`][api-test], optional)
|
| 143 |
+
— a test for a specific node
|
| 144 |
+
|
| 145 |
+
###### Returns
|
| 146 |
+
|
| 147 |
+
A check ([`Check`][api-check]).
|
| 148 |
+
|
| 149 |
+
### `Check`
|
| 150 |
+
|
| 151 |
+
Check that an arbitrary value is a node (TypeScript type).
|
| 152 |
+
|
| 153 |
+
###### Parameters
|
| 154 |
+
|
| 155 |
+
* `this` (`unknown`, optional)
|
| 156 |
+
— context object (`this`) to call `test` with
|
| 157 |
+
* `node` (`unknown`)
|
| 158 |
+
— anything (typically a node)
|
| 159 |
+
* `index` (`number`, optional)
|
| 160 |
+
— the node’s position in its parent
|
| 161 |
+
* `parent` ([`Node`][node], optional)
|
| 162 |
+
— the node’s parent
|
| 163 |
+
|
| 164 |
+
###### Returns
|
| 165 |
+
|
| 166 |
+
Whether this is a node and passes a test (`boolean`).
|
| 167 |
+
|
| 168 |
+
### `Test`
|
| 169 |
+
|
| 170 |
+
Check for an arbitrary node (TypeScript type).
|
| 171 |
+
|
| 172 |
+
###### Type
|
| 173 |
+
|
| 174 |
+
```ts
|
| 175 |
+
type Test =
|
| 176 |
+
| Array<Record<string, unknown> | TestFunction | string>
|
| 177 |
+
| Record<string, unknown>
|
| 178 |
+
| TestFunction
|
| 179 |
+
| string
|
| 180 |
+
| null
|
| 181 |
+
| undefined
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
Checks that the given thing is a node, and then:
|
| 185 |
+
|
| 186 |
+
* when `string`, checks that the node has that tag name
|
| 187 |
+
* when `function`, see [`TestFunction`][api-test-function]
|
| 188 |
+
* when `object`, checks that all keys in test are in node, and that they have
|
| 189 |
+
(strictly) equal values
|
| 190 |
+
* when `Array`, checks if one of the subtests pass
|
| 191 |
+
|
| 192 |
+
### `TestFunction`
|
| 193 |
+
|
| 194 |
+
Check if a node passes a test (TypeScript type).
|
| 195 |
+
|
| 196 |
+
###### Parameters
|
| 197 |
+
|
| 198 |
+
* `node` ([`Node`][node])
|
| 199 |
+
— a node
|
| 200 |
+
* `index` (`number` or `undefined`)
|
| 201 |
+
— the node’s position in its parent
|
| 202 |
+
* `parent` ([`Node`][node] or `undefined`)
|
| 203 |
+
— the node’s parent
|
| 204 |
+
|
| 205 |
+
###### Returns
|
| 206 |
+
|
| 207 |
+
Whether this node passes the test (`boolean`, optional).
|
| 208 |
+
|
| 209 |
+
## Examples
|
| 210 |
+
|
| 211 |
+
### Example of `convert`
|
| 212 |
+
|
| 213 |
+
```js
|
| 214 |
+
import {u} from 'unist-builder'
|
| 215 |
+
import {convert} from 'unist-util-is'
|
| 216 |
+
|
| 217 |
+
const test = convert('leaf')
|
| 218 |
+
|
| 219 |
+
const tree = u('tree', [
|
| 220 |
+
u('node', [u('leaf', '1')]),
|
| 221 |
+
u('leaf', '2'),
|
| 222 |
+
u('node', [u('leaf', '3'), u('leaf', '4')]),
|
| 223 |
+
u('leaf', '5')
|
| 224 |
+
])
|
| 225 |
+
|
| 226 |
+
const leafs = tree.children.filter(function (child, index) {
|
| 227 |
+
return test(child, index, tree)
|
| 228 |
+
})
|
| 229 |
+
|
| 230 |
+
console.log(leafs)
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
Yields:
|
| 234 |
+
|
| 235 |
+
```js
|
| 236 |
+
[{type: 'leaf', value: '2'}, {type: 'leaf', value: '5'}]
|
| 237 |
+
```
|
| 238 |
+
|
| 239 |
+
## Types
|
| 240 |
+
|
| 241 |
+
This package is fully typed with [TypeScript][].
|
| 242 |
+
It exports the additional types [`Check`][api-check],
|
| 243 |
+
[`Test`][api-test],
|
| 244 |
+
[`TestFunction`][api-test-function].
|
| 245 |
+
|
| 246 |
+
## Compatibility
|
| 247 |
+
|
| 248 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 249 |
+
versions of Node.js.
|
| 250 |
+
|
| 251 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 252 |
+
Node.
|
| 253 |
+
This means we try to keep the current release line, `unist-util-is@^6`,
|
| 254 |
+
compatible with Node.js 16.
|
| 255 |
+
|
| 256 |
+
## Related
|
| 257 |
+
|
| 258 |
+
* [`unist-util-find-after`](https://github.com/syntax-tree/unist-util-find-after)
|
| 259 |
+
— find a node after another node
|
| 260 |
+
* [`unist-util-find-before`](https://github.com/syntax-tree/unist-util-find-before)
|
| 261 |
+
— find a node before another node
|
| 262 |
+
* [`unist-util-find-all-after`](https://github.com/syntax-tree/unist-util-find-all-after)
|
| 263 |
+
— find all nodes after another node
|
| 264 |
+
* [`unist-util-find-all-before`](https://github.com/syntax-tree/unist-util-find-all-before)
|
| 265 |
+
— find all nodes before another node
|
| 266 |
+
* [`unist-util-find-all-between`](https://github.com/mrzmmr/unist-util-find-all-between)
|
| 267 |
+
— find all nodes between two nodes
|
| 268 |
+
* [`unist-util-filter`](https://github.com/syntax-tree/unist-util-filter)
|
| 269 |
+
— create a new tree with nodes that pass a check
|
| 270 |
+
* [`unist-util-remove`](https://github.com/syntax-tree/unist-util-remove)
|
| 271 |
+
— remove nodes from tree
|
| 272 |
+
|
| 273 |
+
## Contribute
|
| 274 |
+
|
| 275 |
+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
|
| 276 |
+
ways to get started.
|
| 277 |
+
See [`support.md`][support] for ways to get help.
|
| 278 |
+
|
| 279 |
+
This project has a [code of conduct][coc].
|
| 280 |
+
By interacting with this repository, organization, or community you agree to
|
| 281 |
+
abide by its terms.
|
| 282 |
+
|
| 283 |
+
## License
|
| 284 |
+
|
| 285 |
+
[MIT][license] © [Titus Wormer][author]
|
| 286 |
+
|
| 287 |
+
<!-- Definitions -->
|
| 288 |
+
|
| 289 |
+
[api-check]: #check
|
| 290 |
+
|
| 291 |
+
[api-convert]: #converttest
|
| 292 |
+
|
| 293 |
+
[api-is]: #isnode-test-index-parent-context
|
| 294 |
+
|
| 295 |
+
[api-test]: #test
|
| 296 |
+
|
| 297 |
+
[api-test-function]: #testfunction
|
| 298 |
+
|
| 299 |
+
[author]: https://wooorm.com
|
| 300 |
+
|
| 301 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 302 |
+
|
| 303 |
+
[build]: https://github.com/syntax-tree/unist-util-is/actions
|
| 304 |
+
|
| 305 |
+
[build-badge]: https://github.com/syntax-tree/unist-util-is/workflows/main/badge.svg
|
| 306 |
+
|
| 307 |
+
[chat]: https://github.com/syntax-tree/unist/discussions
|
| 308 |
+
|
| 309 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 310 |
+
|
| 311 |
+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
|
| 312 |
+
|
| 313 |
+
[collective]: https://opencollective.com/unified
|
| 314 |
+
|
| 315 |
+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
|
| 316 |
+
|
| 317 |
+
[coverage]: https://codecov.io/github/syntax-tree/unist-util-is
|
| 318 |
+
|
| 319 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-is.svg
|
| 320 |
+
|
| 321 |
+
[downloads]: https://www.npmjs.com/package/unist-util-is
|
| 322 |
+
|
| 323 |
+
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-is.svg
|
| 324 |
+
|
| 325 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 326 |
+
|
| 327 |
+
[esmsh]: https://esm.sh
|
| 328 |
+
|
| 329 |
+
[hast-util-is-element]: https://github.com/syntax-tree/hast-util-is-element
|
| 330 |
+
|
| 331 |
+
[health]: https://github.com/syntax-tree/.github
|
| 332 |
+
|
| 333 |
+
[license]: license
|
| 334 |
+
|
| 335 |
+
[node]: https://github.com/syntax-tree/unist#node
|
| 336 |
+
|
| 337 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 338 |
+
|
| 339 |
+
[size]: https://bundlejs.com/?q=unist-util-is
|
| 340 |
+
|
| 341 |
+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-is
|
| 342 |
+
|
| 343 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 344 |
+
|
| 345 |
+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
|
| 346 |
+
|
| 347 |
+
[typescript]: https://www.typescriptlang.org
|
| 348 |
+
|
| 349 |
+
[unist]: https://github.com/syntax-tree/unist
|
| 350 |
+
|
| 351 |
+
[unist-util-select]: https://github.com/syntax-tree/unist-util-select
|
tools/ui/node_modules/unist-util-position/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {pointEnd, pointStart, position} from './lib/index.js'
|
tools/ui/node_modules/unist-util-position/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {pointEnd, pointStart, position} from './lib/index.js'
|
tools/ui/node_modules/unist-util-position/lib/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Get the positional info of `node`.
|
| 3 |
+
*
|
| 4 |
+
* @param {Node | NodeLike | null | undefined} [node]
|
| 5 |
+
* Node.
|
| 6 |
+
* @returns {Position | undefined}
|
| 7 |
+
* Position.
|
| 8 |
+
*/
|
| 9 |
+
export function position(
|
| 10 |
+
node?: Node | NodeLike | null | undefined
|
| 11 |
+
): Position | undefined
|
| 12 |
+
/**
|
| 13 |
+
* Get the point info of `node` at a bound side.
|
| 14 |
+
*
|
| 15 |
+
* @param {Node | NodeLike | null | undefined} [node]
|
| 16 |
+
* @returns {Point | undefined}
|
| 17 |
+
*/
|
| 18 |
+
export function pointEnd(
|
| 19 |
+
node?: Node | NodeLike | null | undefined
|
| 20 |
+
): Point | undefined
|
| 21 |
+
/**
|
| 22 |
+
* Get the point info of `node` at a bound side.
|
| 23 |
+
*
|
| 24 |
+
* @param {Node | NodeLike | null | undefined} [node]
|
| 25 |
+
* @returns {Point | undefined}
|
| 26 |
+
*/
|
| 27 |
+
export function pointStart(
|
| 28 |
+
node?: Node | NodeLike | null | undefined
|
| 29 |
+
): Point | undefined
|
| 30 |
+
export type Node = import('unist').Node
|
| 31 |
+
export type Point = import('unist').Point
|
| 32 |
+
export type Position = import('unist').Position
|
| 33 |
+
export type NodeLike = {
|
| 34 |
+
type: string
|
| 35 |
+
position?: PositionLike | null | undefined
|
| 36 |
+
}
|
| 37 |
+
export type PositionLike = {
|
| 38 |
+
start?: PointLike | null | undefined
|
| 39 |
+
end?: PointLike | null | undefined
|
| 40 |
+
}
|
| 41 |
+
export type PointLike = {
|
| 42 |
+
line?: number | null | undefined
|
| 43 |
+
column?: number | null | undefined
|
| 44 |
+
offset?: number | null | undefined
|
| 45 |
+
}
|
tools/ui/node_modules/unist-util-position/lib/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('unist').Node} Node
|
| 3 |
+
* @typedef {import('unist').Point} Point
|
| 4 |
+
* @typedef {import('unist').Position} Position
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* @typedef NodeLike
|
| 9 |
+
* @property {string} type
|
| 10 |
+
* @property {PositionLike | null | undefined} [position]
|
| 11 |
+
*
|
| 12 |
+
* @typedef PositionLike
|
| 13 |
+
* @property {PointLike | null | undefined} [start]
|
| 14 |
+
* @property {PointLike | null | undefined} [end]
|
| 15 |
+
*
|
| 16 |
+
* @typedef PointLike
|
| 17 |
+
* @property {number | null | undefined} [line]
|
| 18 |
+
* @property {number | null | undefined} [column]
|
| 19 |
+
* @property {number | null | undefined} [offset]
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Get the ending point of `node`.
|
| 24 |
+
*
|
| 25 |
+
* @param node
|
| 26 |
+
* Node.
|
| 27 |
+
* @returns
|
| 28 |
+
* Point.
|
| 29 |
+
*/
|
| 30 |
+
export const pointEnd = point('end')
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Get the starting point of `node`.
|
| 34 |
+
*
|
| 35 |
+
* @param node
|
| 36 |
+
* Node.
|
| 37 |
+
* @returns
|
| 38 |
+
* Point.
|
| 39 |
+
*/
|
| 40 |
+
export const pointStart = point('start')
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* Get the positional info of `node`.
|
| 44 |
+
*
|
| 45 |
+
* @param {'end' | 'start'} type
|
| 46 |
+
* Side.
|
| 47 |
+
* @returns
|
| 48 |
+
* Getter.
|
| 49 |
+
*/
|
| 50 |
+
function point(type) {
|
| 51 |
+
return point
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Get the point info of `node` at a bound side.
|
| 55 |
+
*
|
| 56 |
+
* @param {Node | NodeLike | null | undefined} [node]
|
| 57 |
+
* @returns {Point | undefined}
|
| 58 |
+
*/
|
| 59 |
+
function point(node) {
|
| 60 |
+
const point = (node && node.position && node.position[type]) || {}
|
| 61 |
+
|
| 62 |
+
if (
|
| 63 |
+
typeof point.line === 'number' &&
|
| 64 |
+
point.line > 0 &&
|
| 65 |
+
typeof point.column === 'number' &&
|
| 66 |
+
point.column > 0
|
| 67 |
+
) {
|
| 68 |
+
return {
|
| 69 |
+
line: point.line,
|
| 70 |
+
column: point.column,
|
| 71 |
+
offset:
|
| 72 |
+
typeof point.offset === 'number' && point.offset > -1
|
| 73 |
+
? point.offset
|
| 74 |
+
: undefined
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Get the positional info of `node`.
|
| 82 |
+
*
|
| 83 |
+
* @param {Node | NodeLike | null | undefined} [node]
|
| 84 |
+
* Node.
|
| 85 |
+
* @returns {Position | undefined}
|
| 86 |
+
* Position.
|
| 87 |
+
*/
|
| 88 |
+
export function position(node) {
|
| 89 |
+
const start = pointStart(node)
|
| 90 |
+
const end = pointEnd(node)
|
| 91 |
+
|
| 92 |
+
if (start && end) {
|
| 93 |
+
return {start, end}
|
| 94 |
+
}
|
| 95 |
+
}
|
tools/ui/node_modules/unist-util-position/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
tools/ui/node_modules/unist-util-position/node_modules/@types/unist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
tools/ui/node_modules/unist-util-position/node_modules/@types/unist/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/unist`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for unist (https://github.com/syntax-tree/unist).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Thu, 15 Aug 2024 02:18:53 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), [JounQin](https://github.com/JounQin), and [Remco Haszing](https://github.com/remcohaszing).
|
tools/ui/node_modules/unist-util-position/node_modules/@types/unist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ## Interfaces
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Info associated with nodes by the ecosystem.
|
| 5 |
+
*
|
| 6 |
+
* This space is guaranteed to never be specified by unist or specifications
|
| 7 |
+
* implementing unist.
|
| 8 |
+
* But you can use it in utilities and plugins to store data.
|
| 9 |
+
*
|
| 10 |
+
* This type can be augmented to register custom data.
|
| 11 |
+
* For example:
|
| 12 |
+
*
|
| 13 |
+
* ```ts
|
| 14 |
+
* declare module 'unist' {
|
| 15 |
+
* interface Data {
|
| 16 |
+
* // `someNode.data.myId` is typed as `number | undefined`
|
| 17 |
+
* myId?: number | undefined
|
| 18 |
+
* }
|
| 19 |
+
* }
|
| 20 |
+
* ```
|
| 21 |
+
*/
|
| 22 |
+
export interface Data {}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* One place in a source file.
|
| 26 |
+
*/
|
| 27 |
+
export interface Point {
|
| 28 |
+
/**
|
| 29 |
+
* Line in a source file (1-indexed integer).
|
| 30 |
+
*/
|
| 31 |
+
line: number;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Column in a source file (1-indexed integer).
|
| 35 |
+
*/
|
| 36 |
+
column: number;
|
| 37 |
+
/**
|
| 38 |
+
* Character in a source file (0-indexed integer).
|
| 39 |
+
*/
|
| 40 |
+
offset?: number | undefined;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Position of a node in a source document.
|
| 45 |
+
*
|
| 46 |
+
* A position is a range between two points.
|
| 47 |
+
*/
|
| 48 |
+
export interface Position {
|
| 49 |
+
/**
|
| 50 |
+
* Place of the first character of the parsed source region.
|
| 51 |
+
*/
|
| 52 |
+
start: Point;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Place of the first character after the parsed source region.
|
| 56 |
+
*/
|
| 57 |
+
end: Point;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// ## Abstract nodes
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Abstract unist node that contains the smallest possible value.
|
| 64 |
+
*
|
| 65 |
+
* This interface is supposed to be extended.
|
| 66 |
+
*
|
| 67 |
+
* For example, in HTML, a `text` node is a leaf that contains text.
|
| 68 |
+
*/
|
| 69 |
+
export interface Literal extends Node {
|
| 70 |
+
/**
|
| 71 |
+
* Plain value.
|
| 72 |
+
*/
|
| 73 |
+
value: unknown;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Abstract unist node.
|
| 78 |
+
*
|
| 79 |
+
* The syntactic unit in unist syntax trees are called nodes.
|
| 80 |
+
*
|
| 81 |
+
* This interface is supposed to be extended.
|
| 82 |
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
| 83 |
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
| 84 |
+
* nor parent, but still a node.
|
| 85 |
+
*/
|
| 86 |
+
export interface Node {
|
| 87 |
+
/**
|
| 88 |
+
* Node type.
|
| 89 |
+
*/
|
| 90 |
+
type: string;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Info from the ecosystem.
|
| 94 |
+
*/
|
| 95 |
+
data?: Data | undefined;
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Position of a node in a source document.
|
| 99 |
+
*
|
| 100 |
+
* Nodes that are generated (not in the original source document) must not
|
| 101 |
+
* have a position.
|
| 102 |
+
*/
|
| 103 |
+
position?: Position | undefined;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Abstract unist node that contains other nodes (*children*).
|
| 108 |
+
*
|
| 109 |
+
* This interface is supposed to be extended.
|
| 110 |
+
*
|
| 111 |
+
* For example, in XML, an element is a parent of different things, such as
|
| 112 |
+
* comments, text, and further elements.
|
| 113 |
+
*/
|
| 114 |
+
export interface Parent extends Node {
|
| 115 |
+
/**
|
| 116 |
+
* List of children.
|
| 117 |
+
*/
|
| 118 |
+
children: Node[];
|
| 119 |
+
}
|
tools/ui/node_modules/unist-util-position/node_modules/@types/unist/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/unist",
|
| 3 |
+
"version": "3.0.3",
|
| 4 |
+
"description": "TypeScript definitions for unist",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "bizen241",
|
| 10 |
+
"githubUsername": "bizen241",
|
| 11 |
+
"url": "https://github.com/bizen241"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Jun Lu",
|
| 15 |
+
"githubUsername": "lujun2",
|
| 16 |
+
"url": "https://github.com/lujun2"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Hernan Rajchert",
|
| 20 |
+
"githubUsername": "hrajchert",
|
| 21 |
+
"url": "https://github.com/hrajchert"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Titus Wormer",
|
| 25 |
+
"githubUsername": "wooorm",
|
| 26 |
+
"url": "https://github.com/wooorm"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Junyoung Choi",
|
| 30 |
+
"githubUsername": "rokt33r",
|
| 31 |
+
"url": "https://github.com/rokt33r"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Ben Moon",
|
| 35 |
+
"githubUsername": "GuiltyDolphin",
|
| 36 |
+
"url": "https://github.com/GuiltyDolphin"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "JounQin",
|
| 40 |
+
"githubUsername": "JounQin",
|
| 41 |
+
"url": "https://github.com/JounQin"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Remco Haszing",
|
| 45 |
+
"githubUsername": "remcohaszing",
|
| 46 |
+
"url": "https://github.com/remcohaszing"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"main": "",
|
| 50 |
+
"types": "index.d.ts",
|
| 51 |
+
"repository": {
|
| 52 |
+
"type": "git",
|
| 53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 54 |
+
"directory": "types/unist"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {},
|
| 57 |
+
"dependencies": {},
|
| 58 |
+
"typesPublisherContentHash": "7f3d5ce8d56003f3583a5317f98d444bdc99910c7b486c6b10af4f38694e61fe",
|
| 59 |
+
"typeScriptVersion": "4.8"
|
| 60 |
+
}
|
tools/ui/node_modules/unist-util-position/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "unist-util-position",
|
| 3 |
+
"version": "5.0.0",
|
| 4 |
+
"description": "unist utility to get the position of a node",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"unist",
|
| 8 |
+
"unist-util",
|
| 9 |
+
"util",
|
| 10 |
+
"utility",
|
| 11 |
+
"node",
|
| 12 |
+
"position",
|
| 13 |
+
"point"
|
| 14 |
+
],
|
| 15 |
+
"repository": "syntax-tree/unist-util-position",
|
| 16 |
+
"bugs": "https://github.com/syntax-tree/unist-util-position/issues",
|
| 17 |
+
"funding": {
|
| 18 |
+
"type": "opencollective",
|
| 19 |
+
"url": "https://opencollective.com/unified"
|
| 20 |
+
},
|
| 21 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 22 |
+
"contributors": [
|
| 23 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 24 |
+
],
|
| 25 |
+
"sideEffects": false,
|
| 26 |
+
"type": "module",
|
| 27 |
+
"exports": "./index.js",
|
| 28 |
+
"files": [
|
| 29 |
+
"lib/",
|
| 30 |
+
"index.d.ts",
|
| 31 |
+
"index.js"
|
| 32 |
+
],
|
| 33 |
+
"dependencies": {
|
| 34 |
+
"@types/unist": "^3.0.0"
|
| 35 |
+
},
|
| 36 |
+
"devDependencies": {
|
| 37 |
+
"@types/node": "^20.0.0",
|
| 38 |
+
"c8": "^8.0.0",
|
| 39 |
+
"prettier": "^2.0.0",
|
| 40 |
+
"remark-cli": "^11.0.0",
|
| 41 |
+
"remark-preset-wooorm": "^9.0.0",
|
| 42 |
+
"type-coverage": "^2.0.0",
|
| 43 |
+
"typescript": "^5.0.0",
|
| 44 |
+
"xo": "^0.54.0"
|
| 45 |
+
},
|
| 46 |
+
"scripts": {
|
| 47 |
+
"prepack": "npm run build && npm run format",
|
| 48 |
+
"build": "tsc --build --clean && tsc --build && type-coverage",
|
| 49 |
+
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
| 50 |
+
"test-api": "node --conditions development test.js",
|
| 51 |
+
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
| 52 |
+
"test": "npm run build && npm run format && npm run test-coverage"
|
| 53 |
+
},
|
| 54 |
+
"prettier": {
|
| 55 |
+
"bracketSpacing": false,
|
| 56 |
+
"semi": false,
|
| 57 |
+
"singleQuote": true,
|
| 58 |
+
"tabWidth": 2,
|
| 59 |
+
"trailingComma": "none",
|
| 60 |
+
"useTabs": false
|
| 61 |
+
},
|
| 62 |
+
"remarkConfig": {
|
| 63 |
+
"plugins": [
|
| 64 |
+
"remark-preset-wooorm"
|
| 65 |
+
]
|
| 66 |
+
},
|
| 67 |
+
"typeCoverage": {
|
| 68 |
+
"atLeast": 100,
|
| 69 |
+
"detail": true,
|
| 70 |
+
"ignoreCatch": true,
|
| 71 |
+
"strict": true
|
| 72 |
+
},
|
| 73 |
+
"xo": {
|
| 74 |
+
"prettier": true
|
| 75 |
+
}
|
| 76 |
+
}
|
tools/ui/node_modules/unist-util-position/readme.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# unist-util-position
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][collective]
|
| 8 |
+
[![Backers][backers-badge]][collective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[unist][] utility to get positional info of nodes.
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`position(node)`](#positionnode)
|
| 21 |
+
* [`pointEnd(node)`](#pointendnode)
|
| 22 |
+
* [`pointStart(node)`](#pointstartnode)
|
| 23 |
+
* [Types](#types)
|
| 24 |
+
* [Compatibility](#compatibility)
|
| 25 |
+
* [Related](#related)
|
| 26 |
+
* [Contribute](#contribute)
|
| 27 |
+
* [License](#license)
|
| 28 |
+
|
| 29 |
+
## What is this?
|
| 30 |
+
|
| 31 |
+
This utility helps with accessing positional info on a potentially dirty tree.
|
| 32 |
+
|
| 33 |
+
## When should I use this?
|
| 34 |
+
|
| 35 |
+
The positional info is typically consistent and proper in unist trees generated
|
| 36 |
+
by our ecosystem, but, user plugins could mess that up.
|
| 37 |
+
If you’re making a reusable plugin, and accessing the positional info often, you
|
| 38 |
+
might want to guard against that by using this utility.
|
| 39 |
+
|
| 40 |
+
You might also find the utility [`unist-util-generated`][unist-util-generated]
|
| 41 |
+
useful to check whether a node is considered to be generated (not in the
|
| 42 |
+
original input file).
|
| 43 |
+
|
| 44 |
+
You might also enjoy
|
| 45 |
+
[`unist-util-stringify-position`][unist-util-stringify-position] when you want
|
| 46 |
+
to display positional info to users.
|
| 47 |
+
|
| 48 |
+
## Install
|
| 49 |
+
|
| 50 |
+
This package is [ESM only][esm].
|
| 51 |
+
In Node.js (version 16+), install with [npm][]:
|
| 52 |
+
|
| 53 |
+
```sh
|
| 54 |
+
npm install unist-util-position
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 58 |
+
|
| 59 |
+
```js
|
| 60 |
+
import {pointEnd, pointStart, position} from 'https://esm.sh/unist-util-position@5'
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 64 |
+
|
| 65 |
+
```html
|
| 66 |
+
<script type="module">
|
| 67 |
+
import {pointEnd, pointStart, position} from 'https://esm.sh/unist-util-position@5?bundle'
|
| 68 |
+
</script>
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Use
|
| 72 |
+
|
| 73 |
+
```js
|
| 74 |
+
import {fromMarkdown} from 'mdast-util-from-markdown'
|
| 75 |
+
import {pointEnd, pointStart, position} from 'unist-util-position'
|
| 76 |
+
|
| 77 |
+
const tree = fromMarkdown('# foo\n\n* bar\n')
|
| 78 |
+
|
| 79 |
+
console.log(position(tree))
|
| 80 |
+
console.log(pointStart(tree))
|
| 81 |
+
console.log(pointEnd(tree))
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Yields:
|
| 85 |
+
|
| 86 |
+
```js
|
| 87 |
+
{start: {line: 1, column: 1, offset: 0}, end: {line: 4, column: 1, offset: 13}}
|
| 88 |
+
{line: 1, column: 1, offset: 0}
|
| 89 |
+
{line: 4, column: 1, offset: 13}
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## API
|
| 93 |
+
|
| 94 |
+
This package exports the identifiers [`pointEnd`][pointend],
|
| 95 |
+
[`pointStart`][pointstart], and [`position`][position].
|
| 96 |
+
There is no default export.
|
| 97 |
+
|
| 98 |
+
### `position(node)`
|
| 99 |
+
|
| 100 |
+
Get the positional info of `node`.
|
| 101 |
+
|
| 102 |
+
###### Parameters
|
| 103 |
+
|
| 104 |
+
* `node` ([`Node`][node])
|
| 105 |
+
— node
|
| 106 |
+
|
| 107 |
+
###### Returns
|
| 108 |
+
|
| 109 |
+
Position, if valid ([`Position`][unist-position] or `undefined`).
|
| 110 |
+
|
| 111 |
+
### `pointEnd(node)`
|
| 112 |
+
|
| 113 |
+
Get the ending point of `node`.
|
| 114 |
+
|
| 115 |
+
###### Parameters
|
| 116 |
+
|
| 117 |
+
* `node` ([`Node`][node])
|
| 118 |
+
— node
|
| 119 |
+
|
| 120 |
+
###### Returns
|
| 121 |
+
|
| 122 |
+
Point, if valid ([`Point`][unist-point] or `undefined`).
|
| 123 |
+
|
| 124 |
+
### `pointStart(node)`
|
| 125 |
+
|
| 126 |
+
Get the starting point of `node`.
|
| 127 |
+
|
| 128 |
+
###### Parameters
|
| 129 |
+
|
| 130 |
+
* `node` ([`Node`][node])
|
| 131 |
+
— node
|
| 132 |
+
|
| 133 |
+
###### Returns
|
| 134 |
+
|
| 135 |
+
Point, if valid ([`Point`][unist-point] or `undefined`).
|
| 136 |
+
|
| 137 |
+
## Types
|
| 138 |
+
|
| 139 |
+
This package is fully typed with [TypeScript][].
|
| 140 |
+
It exports no additional types.
|
| 141 |
+
|
| 142 |
+
## Compatibility
|
| 143 |
+
|
| 144 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 145 |
+
versions of Node.js.
|
| 146 |
+
|
| 147 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 148 |
+
Node.
|
| 149 |
+
This means we try to keep the current release line, `unist-util-position@^5`,
|
| 150 |
+
compatible with Node.js 16.
|
| 151 |
+
|
| 152 |
+
## Related
|
| 153 |
+
|
| 154 |
+
* [`unist-util-stringify-position`](https://github.com/syntax-tree/unist-util-stringify-position)
|
| 155 |
+
— serialize a node, position, or point as a human readable location
|
| 156 |
+
* [`unist-util-position-from-estree`](https://github.com/syntax-tree/unist-util-position-from-estree)
|
| 157 |
+
— get a position from an estree node
|
| 158 |
+
* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position)
|
| 159 |
+
— remove positions from tree
|
| 160 |
+
* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated)
|
| 161 |
+
— check if a node is generated
|
| 162 |
+
* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source)
|
| 163 |
+
— get the source of a node
|
| 164 |
+
|
| 165 |
+
## Contribute
|
| 166 |
+
|
| 167 |
+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
|
| 168 |
+
ways to get started.
|
| 169 |
+
See [`support.md`][support] for ways to get help.
|
| 170 |
+
|
| 171 |
+
This project has a [code of conduct][coc].
|
| 172 |
+
By interacting with this repository, organization, or community you agree to
|
| 173 |
+
abide by its terms.
|
| 174 |
+
|
| 175 |
+
## License
|
| 176 |
+
|
| 177 |
+
[MIT][license] © [Titus Wormer][author]
|
| 178 |
+
|
| 179 |
+
<!-- Definitions -->
|
| 180 |
+
|
| 181 |
+
[build-badge]: https://github.com/syntax-tree/unist-util-position/workflows/main/badge.svg
|
| 182 |
+
|
| 183 |
+
[build]: https://github.com/syntax-tree/unist-util-position/actions
|
| 184 |
+
|
| 185 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-position.svg
|
| 186 |
+
|
| 187 |
+
[coverage]: https://codecov.io/github/syntax-tree/unist-util-position
|
| 188 |
+
|
| 189 |
+
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-position.svg
|
| 190 |
+
|
| 191 |
+
[downloads]: https://www.npmjs.com/package/unist-util-position
|
| 192 |
+
|
| 193 |
+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-position
|
| 194 |
+
|
| 195 |
+
[size]: https://bundlejs.com/?q=unist-util-position
|
| 196 |
+
|
| 197 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 198 |
+
|
| 199 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 200 |
+
|
| 201 |
+
[collective]: https://opencollective.com/unified
|
| 202 |
+
|
| 203 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 204 |
+
|
| 205 |
+
[chat]: https://github.com/syntax-tree/unist/discussions
|
| 206 |
+
|
| 207 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 208 |
+
|
| 209 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 210 |
+
|
| 211 |
+
[esmsh]: https://esm.sh
|
| 212 |
+
|
| 213 |
+
[typescript]: https://www.typescriptlang.org
|
| 214 |
+
|
| 215 |
+
[license]: license
|
| 216 |
+
|
| 217 |
+
[author]: https://wooorm.com
|
| 218 |
+
|
| 219 |
+
[health]: https://github.com/syntax-tree/.github
|
| 220 |
+
|
| 221 |
+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
|
| 222 |
+
|
| 223 |
+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
|
| 224 |
+
|
| 225 |
+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
|
| 226 |
+
|
| 227 |
+
[unist]: https://github.com/syntax-tree/unist
|
| 228 |
+
|
| 229 |
+
[node]: https://github.com/syntax-tree/unist#node
|
| 230 |
+
|
| 231 |
+
[unist-position]: https://github.com/syntax-tree/unist#position
|
| 232 |
+
|
| 233 |
+
[unist-point]: https://github.com/syntax-tree/unist#point
|
| 234 |
+
|
| 235 |
+
[unist-util-generated]: https://github.com/syntax-tree/unist-util-generated
|
| 236 |
+
|
| 237 |
+
[unist-util-stringify-position]: https://github.com/syntax-tree/unist-util-stringify-position
|
| 238 |
+
|
| 239 |
+
[position]: #positionnode
|
| 240 |
+
|
| 241 |
+
[pointend]: #pointendnode
|
| 242 |
+
|
| 243 |
+
[pointstart]: #pointstartnode
|
tools/ui/node_modules/unist-util-remove-position/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export {removePosition} from './lib/index.js'
|
| 2 |
+
export type Options = import('./lib/index.js').Options
|
tools/ui/node_modules/unist-util-remove-position/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('./lib/index.js').Options} Options
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
export {removePosition} from './lib/index.js'
|
tools/ui/node_modules/unist-util-remove-position/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Remove the `position` field from a tree.
|
| 3 |
+
*
|
| 4 |
+
* @param {Node} tree
|
| 5 |
+
* Tree to clean.
|
| 6 |
+
* @param {Options | null | undefined} [options={force: false}]
|
| 7 |
+
* Configuration (default: `{force: false}`).
|
| 8 |
+
* @returns {undefined}
|
| 9 |
+
* Nothing.
|
| 10 |
+
*/
|
| 11 |
+
export function removePosition(
|
| 12 |
+
tree: Node,
|
| 13 |
+
options?: Options | null | undefined
|
| 14 |
+
): undefined
|
| 15 |
+
export type Node = import('unist').Node
|
| 16 |
+
/**
|
| 17 |
+
* Configuration.
|
| 18 |
+
*/
|
| 19 |
+
export type Options = {
|
| 20 |
+
/**
|
| 21 |
+
* Whether to use `delete` to remove `position` fields.
|
| 22 |
+
*
|
| 23 |
+
* The default is to set them to `undefined`.
|
| 24 |
+
*/
|
| 25 |
+
force?: boolean | null | undefined
|
| 26 |
+
}
|
tools/ui/node_modules/unist-util-remove-position/lib/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('unist').Node} Node
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
/**
|
| 6 |
+
* @typedef Options
|
| 7 |
+
* Configuration.
|
| 8 |
+
* @property {boolean | null | undefined} [force=false]
|
| 9 |
+
* Whether to use `delete` to remove `position` fields.
|
| 10 |
+
*
|
| 11 |
+
* The default is to set them to `undefined`.
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
import {visit} from 'unist-util-visit'
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Remove the `position` field from a tree.
|
| 18 |
+
*
|
| 19 |
+
* @param {Node} tree
|
| 20 |
+
* Tree to clean.
|
| 21 |
+
* @param {Options | null | undefined} [options={force: false}]
|
| 22 |
+
* Configuration (default: `{force: false}`).
|
| 23 |
+
* @returns {undefined}
|
| 24 |
+
* Nothing.
|
| 25 |
+
*/
|
| 26 |
+
export function removePosition(tree, options) {
|
| 27 |
+
const config = options || {}
|
| 28 |
+
const force = config.force || false
|
| 29 |
+
|
| 30 |
+
visit(tree, remove)
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* @param {Node} node
|
| 34 |
+
*/
|
| 35 |
+
function remove(node) {
|
| 36 |
+
if (force) {
|
| 37 |
+
delete node.position
|
| 38 |
+
} else {
|
| 39 |
+
node.position = undefined
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
tools/ui/node_modules/unist-util-remove-position/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/unist`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for unist (https://github.com/syntax-tree/unist).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Thu, 15 Aug 2024 02:18:53 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), [JounQin](https://github.com/JounQin), and [Remco Haszing](https://github.com/remcohaszing).
|
tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ## Interfaces
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Info associated with nodes by the ecosystem.
|
| 5 |
+
*
|
| 6 |
+
* This space is guaranteed to never be specified by unist or specifications
|
| 7 |
+
* implementing unist.
|
| 8 |
+
* But you can use it in utilities and plugins to store data.
|
| 9 |
+
*
|
| 10 |
+
* This type can be augmented to register custom data.
|
| 11 |
+
* For example:
|
| 12 |
+
*
|
| 13 |
+
* ```ts
|
| 14 |
+
* declare module 'unist' {
|
| 15 |
+
* interface Data {
|
| 16 |
+
* // `someNode.data.myId` is typed as `number | undefined`
|
| 17 |
+
* myId?: number | undefined
|
| 18 |
+
* }
|
| 19 |
+
* }
|
| 20 |
+
* ```
|
| 21 |
+
*/
|
| 22 |
+
export interface Data {}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* One place in a source file.
|
| 26 |
+
*/
|
| 27 |
+
export interface Point {
|
| 28 |
+
/**
|
| 29 |
+
* Line in a source file (1-indexed integer).
|
| 30 |
+
*/
|
| 31 |
+
line: number;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Column in a source file (1-indexed integer).
|
| 35 |
+
*/
|
| 36 |
+
column: number;
|
| 37 |
+
/**
|
| 38 |
+
* Character in a source file (0-indexed integer).
|
| 39 |
+
*/
|
| 40 |
+
offset?: number | undefined;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Position of a node in a source document.
|
| 45 |
+
*
|
| 46 |
+
* A position is a range between two points.
|
| 47 |
+
*/
|
| 48 |
+
export interface Position {
|
| 49 |
+
/**
|
| 50 |
+
* Place of the first character of the parsed source region.
|
| 51 |
+
*/
|
| 52 |
+
start: Point;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Place of the first character after the parsed source region.
|
| 56 |
+
*/
|
| 57 |
+
end: Point;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// ## Abstract nodes
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Abstract unist node that contains the smallest possible value.
|
| 64 |
+
*
|
| 65 |
+
* This interface is supposed to be extended.
|
| 66 |
+
*
|
| 67 |
+
* For example, in HTML, a `text` node is a leaf that contains text.
|
| 68 |
+
*/
|
| 69 |
+
export interface Literal extends Node {
|
| 70 |
+
/**
|
| 71 |
+
* Plain value.
|
| 72 |
+
*/
|
| 73 |
+
value: unknown;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Abstract unist node.
|
| 78 |
+
*
|
| 79 |
+
* The syntactic unit in unist syntax trees are called nodes.
|
| 80 |
+
*
|
| 81 |
+
* This interface is supposed to be extended.
|
| 82 |
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
| 83 |
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
| 84 |
+
* nor parent, but still a node.
|
| 85 |
+
*/
|
| 86 |
+
export interface Node {
|
| 87 |
+
/**
|
| 88 |
+
* Node type.
|
| 89 |
+
*/
|
| 90 |
+
type: string;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Info from the ecosystem.
|
| 94 |
+
*/
|
| 95 |
+
data?: Data | undefined;
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Position of a node in a source document.
|
| 99 |
+
*
|
| 100 |
+
* Nodes that are generated (not in the original source document) must not
|
| 101 |
+
* have a position.
|
| 102 |
+
*/
|
| 103 |
+
position?: Position | undefined;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Abstract unist node that contains other nodes (*children*).
|
| 108 |
+
*
|
| 109 |
+
* This interface is supposed to be extended.
|
| 110 |
+
*
|
| 111 |
+
* For example, in XML, an element is a parent of different things, such as
|
| 112 |
+
* comments, text, and further elements.
|
| 113 |
+
*/
|
| 114 |
+
export interface Parent extends Node {
|
| 115 |
+
/**
|
| 116 |
+
* List of children.
|
| 117 |
+
*/
|
| 118 |
+
children: Node[];
|
| 119 |
+
}
|
tools/ui/node_modules/unist-util-remove-position/node_modules/@types/unist/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/unist",
|
| 3 |
+
"version": "3.0.3",
|
| 4 |
+
"description": "TypeScript definitions for unist",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "bizen241",
|
| 10 |
+
"githubUsername": "bizen241",
|
| 11 |
+
"url": "https://github.com/bizen241"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Jun Lu",
|
| 15 |
+
"githubUsername": "lujun2",
|
| 16 |
+
"url": "https://github.com/lujun2"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Hernan Rajchert",
|
| 20 |
+
"githubUsername": "hrajchert",
|
| 21 |
+
"url": "https://github.com/hrajchert"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Titus Wormer",
|
| 25 |
+
"githubUsername": "wooorm",
|
| 26 |
+
"url": "https://github.com/wooorm"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Junyoung Choi",
|
| 30 |
+
"githubUsername": "rokt33r",
|
| 31 |
+
"url": "https://github.com/rokt33r"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Ben Moon",
|
| 35 |
+
"githubUsername": "GuiltyDolphin",
|
| 36 |
+
"url": "https://github.com/GuiltyDolphin"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "JounQin",
|
| 40 |
+
"githubUsername": "JounQin",
|
| 41 |
+
"url": "https://github.com/JounQin"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Remco Haszing",
|
| 45 |
+
"githubUsername": "remcohaszing",
|
| 46 |
+
"url": "https://github.com/remcohaszing"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"main": "",
|
| 50 |
+
"types": "index.d.ts",
|
| 51 |
+
"repository": {
|
| 52 |
+
"type": "git",
|
| 53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 54 |
+
"directory": "types/unist"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {},
|
| 57 |
+
"dependencies": {},
|
| 58 |
+
"typesPublisherContentHash": "7f3d5ce8d56003f3583a5317f98d444bdc99910c7b486c6b10af4f38694e61fe",
|
| 59 |
+
"typeScriptVersion": "4.8"
|
| 60 |
+
}
|
tools/ui/node_modules/unist-util-remove-position/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "unist-util-remove-position",
|
| 3 |
+
"version": "5.0.0",
|
| 4 |
+
"description": "unist utility to remove positions from a tree",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"unist",
|
| 8 |
+
"unist-util",
|
| 9 |
+
"util",
|
| 10 |
+
"utility",
|
| 11 |
+
"remove",
|
| 12 |
+
"position",
|
| 13 |
+
"location",
|
| 14 |
+
"clean",
|
| 15 |
+
"force"
|
| 16 |
+
],
|
| 17 |
+
"repository": "syntax-tree/unist-util-remove-position",
|
| 18 |
+
"bugs": "https://github.com/syntax-tree/unist-util-remove-position/issues",
|
| 19 |
+
"funding": {
|
| 20 |
+
"type": "opencollective",
|
| 21 |
+
"url": "https://opencollective.com/unified"
|
| 22 |
+
},
|
| 23 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 24 |
+
"contributors": [
|
| 25 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 26 |
+
"Merlijn Vos <merlijn@soverin.net>"
|
| 27 |
+
],
|
| 28 |
+
"sideEffects": false,
|
| 29 |
+
"type": "module",
|
| 30 |
+
"exports": "./index.js",
|
| 31 |
+
"files": [
|
| 32 |
+
"lib/",
|
| 33 |
+
"index.d.ts",
|
| 34 |
+
"index.js"
|
| 35 |
+
],
|
| 36 |
+
"dependencies": {
|
| 37 |
+
"@types/unist": "^3.0.0",
|
| 38 |
+
"unist-util-visit": "^5.0.0"
|
| 39 |
+
},
|
| 40 |
+
"devDependencies": {
|
| 41 |
+
"@types/mdast": "^4.0.0",
|
| 42 |
+
"@types/node": "^20.0.0",
|
| 43 |
+
"c8": "^8.0.0",
|
| 44 |
+
"mdast-util-from-markdown": "^1.0.0",
|
| 45 |
+
"prettier": "^2.0.0",
|
| 46 |
+
"remark-cli": "^11.0.0",
|
| 47 |
+
"remark-preset-wooorm": "^9.0.0",
|
| 48 |
+
"tsd": "^0.28.0",
|
| 49 |
+
"type-coverage": "^2.0.0",
|
| 50 |
+
"typescript": "^5.0.0",
|
| 51 |
+
"unist-builder": "^3.0.0",
|
| 52 |
+
"xo": "^0.54.0"
|
| 53 |
+
},
|
| 54 |
+
"scripts": {
|
| 55 |
+
"prepack": "npm run build && npm run format",
|
| 56 |
+
"build": "tsc --build --clean && tsc --build && tsd && type-coverage",
|
| 57 |
+
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
| 58 |
+
"test-api": "node --conditions development test.js",
|
| 59 |
+
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
| 60 |
+
"test": "npm run build && npm run format && npm run test-coverage"
|
| 61 |
+
},
|
| 62 |
+
"prettier": {
|
| 63 |
+
"bracketSpacing": false,
|
| 64 |
+
"semi": false,
|
| 65 |
+
"singleQuote": true,
|
| 66 |
+
"tabWidth": 2,
|
| 67 |
+
"trailingComma": "none",
|
| 68 |
+
"useTabs": false
|
| 69 |
+
},
|
| 70 |
+
"remarkConfig": {
|
| 71 |
+
"plugins": [
|
| 72 |
+
"remark-preset-wooorm"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
"typeCoverage": {
|
| 76 |
+
"atLeast": 100,
|
| 77 |
+
"detail": true,
|
| 78 |
+
"ignoreCatch": true,
|
| 79 |
+
"strict": true
|
| 80 |
+
},
|
| 81 |
+
"xo": {
|
| 82 |
+
"prettier": true
|
| 83 |
+
}
|
| 84 |
+
}
|
tools/ui/node_modules/unist-util-remove-position/readme.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# unist-util-remove-position
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][collective]
|
| 8 |
+
[![Backers][backers-badge]][collective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[unist][] utility to remove positional info from a tree.
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`removePosition(node[, options])`](#removepositionnode-options)
|
| 21 |
+
* [`Options`](#options)
|
| 22 |
+
* [Types](#types)
|
| 23 |
+
* [Compatibility](#compatibility)
|
| 24 |
+
* [Contribute](#contribute)
|
| 25 |
+
* [License](#license)
|
| 26 |
+
|
| 27 |
+
## What is this?
|
| 28 |
+
|
| 29 |
+
This is a small utility that helps you remove the `position` field from nodes in
|
| 30 |
+
a unist tree.
|
| 31 |
+
|
| 32 |
+
## When should I use this?
|
| 33 |
+
|
| 34 |
+
Often, positional info is the whole reason, or an important reason, for using
|
| 35 |
+
ASTs.
|
| 36 |
+
Sometimes, especially when comparing trees, or when inserting one tree into
|
| 37 |
+
another, the positional info is at best useless and at worst harmful.
|
| 38 |
+
In those cases, you can use this utility to remove `position` fields from a
|
| 39 |
+
tree.
|
| 40 |
+
|
| 41 |
+
You might find the utility [`unist-util-position`][unist-util-position]
|
| 42 |
+
useful to instead get clean position info from a tree, or
|
| 43 |
+
[`unist-util-generated`][unist-util-generated] useful to check whether a node is
|
| 44 |
+
considered to be generated (not in the original input file).
|
| 45 |
+
|
| 46 |
+
You might also enjoy
|
| 47 |
+
[`unist-util-stringify-position`][unist-util-stringify-position] when you want
|
| 48 |
+
to display positional info to users.
|
| 49 |
+
|
| 50 |
+
## Install
|
| 51 |
+
|
| 52 |
+
This package is [ESM only][esm].
|
| 53 |
+
In Node.js (version 16+), install with [npm][]:
|
| 54 |
+
|
| 55 |
+
```sh
|
| 56 |
+
npm install unist-util-remove-position
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 60 |
+
|
| 61 |
+
```js
|
| 62 |
+
import {removePosition} from 'https://esm.sh/unist-util-remove-position@5'
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 66 |
+
|
| 67 |
+
```html
|
| 68 |
+
<script type="module">
|
| 69 |
+
import {removePosition} from 'https://esm.sh/unist-util-remove-position@5?bundle'
|
| 70 |
+
</script>
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Use
|
| 74 |
+
|
| 75 |
+
```js
|
| 76 |
+
import {fromMarkdown} from 'mdast-util-from-markdown'
|
| 77 |
+
import {removePosition} from 'unist-util-remove-position'
|
| 78 |
+
|
| 79 |
+
const tree = fromMarkdown('Some _emphasis_, **importance**, and `code`.')
|
| 80 |
+
|
| 81 |
+
removePosition(tree, {force: true})
|
| 82 |
+
|
| 83 |
+
console.dir(tree, {depth: null})
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Yields:
|
| 87 |
+
|
| 88 |
+
```js
|
| 89 |
+
{
|
| 90 |
+
type: 'root',
|
| 91 |
+
children: [
|
| 92 |
+
{
|
| 93 |
+
type: 'paragraph',
|
| 94 |
+
children: [
|
| 95 |
+
{type: 'text', value: 'Some '},
|
| 96 |
+
{type: 'emphasis', children: [{type: 'text', value: 'emphasis'}]},
|
| 97 |
+
{type: 'text', value: ', '},
|
| 98 |
+
{type: 'strong', children: [{type: 'text', value: 'importance'}]},
|
| 99 |
+
{type: 'text', value: ', and '},
|
| 100 |
+
{type: 'inlineCode', value: 'code'},
|
| 101 |
+
{type: 'text', value: '.'}
|
| 102 |
+
]
|
| 103 |
+
}
|
| 104 |
+
]
|
| 105 |
+
}
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
## API
|
| 109 |
+
|
| 110 |
+
This package exports the identifier [`removePosition`][removeposition].
|
| 111 |
+
There is no default export.
|
| 112 |
+
|
| 113 |
+
### `removePosition(node[, options])`
|
| 114 |
+
|
| 115 |
+
Remove the `position` field from a tree.
|
| 116 |
+
|
| 117 |
+
###### Parameters
|
| 118 |
+
|
| 119 |
+
* `node` ([`Node`][node])
|
| 120 |
+
— tree to clean
|
| 121 |
+
* `options` ([`Options`][options], optional)
|
| 122 |
+
— configuration
|
| 123 |
+
|
| 124 |
+
###### Returns
|
| 125 |
+
|
| 126 |
+
Nothing (`undefined`).
|
| 127 |
+
|
| 128 |
+
### `Options`
|
| 129 |
+
|
| 130 |
+
Configuration (TypeScript type).
|
| 131 |
+
|
| 132 |
+
###### Fields
|
| 133 |
+
|
| 134 |
+
* `force` (`boolean`, default: `false`)
|
| 135 |
+
— whether to use `delete` to remove `position` fields, the default is to
|
| 136 |
+
set them to `undefined`
|
| 137 |
+
|
| 138 |
+
## Types
|
| 139 |
+
|
| 140 |
+
This package is fully typed with [TypeScript][].
|
| 141 |
+
It exports the additional type [`Options`][options].
|
| 142 |
+
|
| 143 |
+
## Compatibility
|
| 144 |
+
|
| 145 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 146 |
+
versions of Node.js.
|
| 147 |
+
|
| 148 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 149 |
+
Node.
|
| 150 |
+
This means we try to keep the current release line,
|
| 151 |
+
`unist-util-remove-position@^5`, compatible with Node.js 16.
|
| 152 |
+
|
| 153 |
+
## Contribute
|
| 154 |
+
|
| 155 |
+
See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
|
| 156 |
+
ways to get started.
|
| 157 |
+
See [`support.md`][support] for ways to get help.
|
| 158 |
+
|
| 159 |
+
This project has a [code of conduct][coc].
|
| 160 |
+
By interacting with this repository, organization, or community you agree to
|
| 161 |
+
abide by its terms.
|
| 162 |
+
|
| 163 |
+
## License
|
| 164 |
+
|
| 165 |
+
[MIT][license] © [Titus Wormer][author]
|
| 166 |
+
|
| 167 |
+
<!-- Definitions -->
|
| 168 |
+
|
| 169 |
+
[build-badge]: https://github.com/syntax-tree/unist-util-remove-position/workflows/main/badge.svg
|
| 170 |
+
|
| 171 |
+
[build]: https://github.com/syntax-tree/unist-util-remove-position/actions
|
| 172 |
+
|
| 173 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-remove-position.svg
|
| 174 |
+
|
| 175 |
+
[coverage]: https://codecov.io/github/syntax-tree/unist-util-remove-position
|
| 176 |
+
|
| 177 |
+
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-remove-position.svg
|
| 178 |
+
|
| 179 |
+
[downloads]: https://www.npmjs.com/package/unist-util-remove-position
|
| 180 |
+
|
| 181 |
+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-remove-position
|
| 182 |
+
|
| 183 |
+
[size]: https://bundlejs.com/?q=unist-util-remove-position
|
| 184 |
+
|
| 185 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 186 |
+
|
| 187 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 188 |
+
|
| 189 |
+
[collective]: https://opencollective.com/unified
|
| 190 |
+
|
| 191 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 192 |
+
|
| 193 |
+
[chat]: https://github.com/syntax-tree/unist/discussions
|
| 194 |
+
|
| 195 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 196 |
+
|
| 197 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 198 |
+
|
| 199 |
+
[esmsh]: https://esm.sh
|
| 200 |
+
|
| 201 |
+
[typescript]: https://www.typescriptlang.org
|
| 202 |
+
|
| 203 |
+
[license]: license
|
| 204 |
+
|
| 205 |
+
[author]: https://wooorm.com
|
| 206 |
+
|
| 207 |
+
[health]: https://github.com/syntax-tree/.github
|
| 208 |
+
|
| 209 |
+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
|
| 210 |
+
|
| 211 |
+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
|
| 212 |
+
|
| 213 |
+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
|
| 214 |
+
|
| 215 |
+
[unist]: https://github.com/syntax-tree/unist
|
| 216 |
+
|
| 217 |
+
[node]: https://github.com/syntax-tree/unist#node
|
| 218 |
+
|
| 219 |
+
[unist-util-position]: https://github.com/syntax-tree/unist-util-position
|
| 220 |
+
|
| 221 |
+
[unist-util-generated]: https://github.com/syntax-tree/unist-util-generated
|
| 222 |
+
|
| 223 |
+
[unist-util-stringify-position]: https://github.com/syntax-tree/unist-util-stringify-position
|
| 224 |
+
|
| 225 |
+
[removeposition]: #removepositionnode-options
|
| 226 |
+
|
| 227 |
+
[options]: #options
|
tools/ui/node_modules/unist-util-stringify-position/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {stringifyPosition} from './lib/index.js'
|
tools/ui/node_modules/unist-util-stringify-position/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {stringifyPosition} from './lib/index.js'
|
tools/ui/node_modules/unist-util-stringify-position/lib/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('unist').Node} Node
|
| 3 |
+
* @typedef {import('unist').Point} Point
|
| 4 |
+
* @typedef {import('unist').Position} Position
|
| 5 |
+
*/
|
| 6 |
+
/**
|
| 7 |
+
* @typedef NodeLike
|
| 8 |
+
* @property {string} type
|
| 9 |
+
* @property {PositionLike | null | undefined} [position]
|
| 10 |
+
*
|
| 11 |
+
* @typedef PointLike
|
| 12 |
+
* @property {number | null | undefined} [line]
|
| 13 |
+
* @property {number | null | undefined} [column]
|
| 14 |
+
* @property {number | null | undefined} [offset]
|
| 15 |
+
*
|
| 16 |
+
* @typedef PositionLike
|
| 17 |
+
* @property {PointLike | null | undefined} [start]
|
| 18 |
+
* @property {PointLike | null | undefined} [end]
|
| 19 |
+
*/
|
| 20 |
+
/**
|
| 21 |
+
* Serialize the positional info of a point, position (start and end points),
|
| 22 |
+
* or node.
|
| 23 |
+
*
|
| 24 |
+
* @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]
|
| 25 |
+
* Node, position, or point.
|
| 26 |
+
* @returns {string}
|
| 27 |
+
* Pretty printed positional info of a node (`string`).
|
| 28 |
+
*
|
| 29 |
+
* In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
|
| 30 |
+
* or a point `l:c` (when given `point`), where `l` stands for line, `c` for
|
| 31 |
+
* column, `s` for `start`, and `e` for end.
|
| 32 |
+
* An empty string (`''`) is returned if the given value is neither `node`,
|
| 33 |
+
* `position`, nor `point`.
|
| 34 |
+
*/
|
| 35 |
+
export function stringifyPosition(
|
| 36 |
+
value?:
|
| 37 |
+
| Node
|
| 38 |
+
| NodeLike
|
| 39 |
+
| Point
|
| 40 |
+
| PointLike
|
| 41 |
+
| Position
|
| 42 |
+
| PositionLike
|
| 43 |
+
| null
|
| 44 |
+
| undefined
|
| 45 |
+
): string
|
| 46 |
+
export type Node = import('unist').Node
|
| 47 |
+
export type Point = import('unist').Point
|
| 48 |
+
export type Position = import('unist').Position
|
| 49 |
+
export type NodeLike = {
|
| 50 |
+
type: string
|
| 51 |
+
position?: PositionLike | null | undefined
|
| 52 |
+
}
|
| 53 |
+
export type PointLike = {
|
| 54 |
+
line?: number | null | undefined
|
| 55 |
+
column?: number | null | undefined
|
| 56 |
+
offset?: number | null | undefined
|
| 57 |
+
}
|
| 58 |
+
export type PositionLike = {
|
| 59 |
+
start?: PointLike | null | undefined
|
| 60 |
+
end?: PointLike | null | undefined
|
| 61 |
+
}
|
tools/ui/node_modules/unist-util-stringify-position/lib/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {import('unist').Node} Node
|
| 3 |
+
* @typedef {import('unist').Point} Point
|
| 4 |
+
* @typedef {import('unist').Position} Position
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* @typedef NodeLike
|
| 9 |
+
* @property {string} type
|
| 10 |
+
* @property {PositionLike | null | undefined} [position]
|
| 11 |
+
*
|
| 12 |
+
* @typedef PointLike
|
| 13 |
+
* @property {number | null | undefined} [line]
|
| 14 |
+
* @property {number | null | undefined} [column]
|
| 15 |
+
* @property {number | null | undefined} [offset]
|
| 16 |
+
*
|
| 17 |
+
* @typedef PositionLike
|
| 18 |
+
* @property {PointLike | null | undefined} [start]
|
| 19 |
+
* @property {PointLike | null | undefined} [end]
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Serialize the positional info of a point, position (start and end points),
|
| 24 |
+
* or node.
|
| 25 |
+
*
|
| 26 |
+
* @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]
|
| 27 |
+
* Node, position, or point.
|
| 28 |
+
* @returns {string}
|
| 29 |
+
* Pretty printed positional info of a node (`string`).
|
| 30 |
+
*
|
| 31 |
+
* In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
|
| 32 |
+
* or a point `l:c` (when given `point`), where `l` stands for line, `c` for
|
| 33 |
+
* column, `s` for `start`, and `e` for end.
|
| 34 |
+
* An empty string (`''`) is returned if the given value is neither `node`,
|
| 35 |
+
* `position`, nor `point`.
|
| 36 |
+
*/
|
| 37 |
+
export function stringifyPosition(value) {
|
| 38 |
+
// Nothing.
|
| 39 |
+
if (!value || typeof value !== 'object') {
|
| 40 |
+
return ''
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
// Node.
|
| 44 |
+
if ('position' in value || 'type' in value) {
|
| 45 |
+
return position(value.position)
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
// Position.
|
| 49 |
+
if ('start' in value || 'end' in value) {
|
| 50 |
+
return position(value)
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// Point.
|
| 54 |
+
if ('line' in value || 'column' in value) {
|
| 55 |
+
return point(value)
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// ?
|
| 59 |
+
return ''
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* @param {Point | PointLike | null | undefined} point
|
| 64 |
+
* @returns {string}
|
| 65 |
+
*/
|
| 66 |
+
function point(point) {
|
| 67 |
+
return index(point && point.line) + ':' + index(point && point.column)
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* @param {Position | PositionLike | null | undefined} pos
|
| 72 |
+
* @returns {string}
|
| 73 |
+
*/
|
| 74 |
+
function position(pos) {
|
| 75 |
+
return point(pos && pos.start) + '-' + point(pos && pos.end)
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* @param {number | null | undefined} value
|
| 80 |
+
* @returns {number}
|
| 81 |
+
*/
|
| 82 |
+
function index(value) {
|
| 83 |
+
return value && typeof value === 'number' ? value : 1
|
| 84 |
+
}
|
tools/ui/node_modules/unist-util-stringify-position/license
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE
|
tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/unist`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for unist (https://github.com/syntax-tree/unist).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Thu, 15 Aug 2024 02:18:53 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [bizen241](https://github.com/bizen241), [Jun Lu](https://github.com/lujun2), [Hernan Rajchert](https://github.com/hrajchert), [Titus Wormer](https://github.com/wooorm), [Junyoung Choi](https://github.com/rokt33r), [Ben Moon](https://github.com/GuiltyDolphin), [JounQin](https://github.com/JounQin), and [Remco Haszing](https://github.com/remcohaszing).
|
tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ## Interfaces
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Info associated with nodes by the ecosystem.
|
| 5 |
+
*
|
| 6 |
+
* This space is guaranteed to never be specified by unist or specifications
|
| 7 |
+
* implementing unist.
|
| 8 |
+
* But you can use it in utilities and plugins to store data.
|
| 9 |
+
*
|
| 10 |
+
* This type can be augmented to register custom data.
|
| 11 |
+
* For example:
|
| 12 |
+
*
|
| 13 |
+
* ```ts
|
| 14 |
+
* declare module 'unist' {
|
| 15 |
+
* interface Data {
|
| 16 |
+
* // `someNode.data.myId` is typed as `number | undefined`
|
| 17 |
+
* myId?: number | undefined
|
| 18 |
+
* }
|
| 19 |
+
* }
|
| 20 |
+
* ```
|
| 21 |
+
*/
|
| 22 |
+
export interface Data {}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* One place in a source file.
|
| 26 |
+
*/
|
| 27 |
+
export interface Point {
|
| 28 |
+
/**
|
| 29 |
+
* Line in a source file (1-indexed integer).
|
| 30 |
+
*/
|
| 31 |
+
line: number;
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Column in a source file (1-indexed integer).
|
| 35 |
+
*/
|
| 36 |
+
column: number;
|
| 37 |
+
/**
|
| 38 |
+
* Character in a source file (0-indexed integer).
|
| 39 |
+
*/
|
| 40 |
+
offset?: number | undefined;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Position of a node in a source document.
|
| 45 |
+
*
|
| 46 |
+
* A position is a range between two points.
|
| 47 |
+
*/
|
| 48 |
+
export interface Position {
|
| 49 |
+
/**
|
| 50 |
+
* Place of the first character of the parsed source region.
|
| 51 |
+
*/
|
| 52 |
+
start: Point;
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Place of the first character after the parsed source region.
|
| 56 |
+
*/
|
| 57 |
+
end: Point;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// ## Abstract nodes
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Abstract unist node that contains the smallest possible value.
|
| 64 |
+
*
|
| 65 |
+
* This interface is supposed to be extended.
|
| 66 |
+
*
|
| 67 |
+
* For example, in HTML, a `text` node is a leaf that contains text.
|
| 68 |
+
*/
|
| 69 |
+
export interface Literal extends Node {
|
| 70 |
+
/**
|
| 71 |
+
* Plain value.
|
| 72 |
+
*/
|
| 73 |
+
value: unknown;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Abstract unist node.
|
| 78 |
+
*
|
| 79 |
+
* The syntactic unit in unist syntax trees are called nodes.
|
| 80 |
+
*
|
| 81 |
+
* This interface is supposed to be extended.
|
| 82 |
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
| 83 |
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
| 84 |
+
* nor parent, but still a node.
|
| 85 |
+
*/
|
| 86 |
+
export interface Node {
|
| 87 |
+
/**
|
| 88 |
+
* Node type.
|
| 89 |
+
*/
|
| 90 |
+
type: string;
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Info from the ecosystem.
|
| 94 |
+
*/
|
| 95 |
+
data?: Data | undefined;
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Position of a node in a source document.
|
| 99 |
+
*
|
| 100 |
+
* Nodes that are generated (not in the original source document) must not
|
| 101 |
+
* have a position.
|
| 102 |
+
*/
|
| 103 |
+
position?: Position | undefined;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Abstract unist node that contains other nodes (*children*).
|
| 108 |
+
*
|
| 109 |
+
* This interface is supposed to be extended.
|
| 110 |
+
*
|
| 111 |
+
* For example, in XML, an element is a parent of different things, such as
|
| 112 |
+
* comments, text, and further elements.
|
| 113 |
+
*/
|
| 114 |
+
export interface Parent extends Node {
|
| 115 |
+
/**
|
| 116 |
+
* List of children.
|
| 117 |
+
*/
|
| 118 |
+
children: Node[];
|
| 119 |
+
}
|
tools/ui/node_modules/unist-util-stringify-position/node_modules/@types/unist/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/unist",
|
| 3 |
+
"version": "3.0.3",
|
| 4 |
+
"description": "TypeScript definitions for unist",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/unist",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "bizen241",
|
| 10 |
+
"githubUsername": "bizen241",
|
| 11 |
+
"url": "https://github.com/bizen241"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Jun Lu",
|
| 15 |
+
"githubUsername": "lujun2",
|
| 16 |
+
"url": "https://github.com/lujun2"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "Hernan Rajchert",
|
| 20 |
+
"githubUsername": "hrajchert",
|
| 21 |
+
"url": "https://github.com/hrajchert"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"name": "Titus Wormer",
|
| 25 |
+
"githubUsername": "wooorm",
|
| 26 |
+
"url": "https://github.com/wooorm"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"name": "Junyoung Choi",
|
| 30 |
+
"githubUsername": "rokt33r",
|
| 31 |
+
"url": "https://github.com/rokt33r"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "Ben Moon",
|
| 35 |
+
"githubUsername": "GuiltyDolphin",
|
| 36 |
+
"url": "https://github.com/GuiltyDolphin"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "JounQin",
|
| 40 |
+
"githubUsername": "JounQin",
|
| 41 |
+
"url": "https://github.com/JounQin"
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"name": "Remco Haszing",
|
| 45 |
+
"githubUsername": "remcohaszing",
|
| 46 |
+
"url": "https://github.com/remcohaszing"
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"main": "",
|
| 50 |
+
"types": "index.d.ts",
|
| 51 |
+
"repository": {
|
| 52 |
+
"type": "git",
|
| 53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 54 |
+
"directory": "types/unist"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {},
|
| 57 |
+
"dependencies": {},
|
| 58 |
+
"typesPublisherContentHash": "7f3d5ce8d56003f3583a5317f98d444bdc99910c7b486c6b10af4f38694e61fe",
|
| 59 |
+
"typeScriptVersion": "4.8"
|
| 60 |
+
}
|
tools/ui/node_modules/unist-util-stringify-position/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "unist-util-stringify-position",
|
| 3 |
+
"version": "4.0.0",
|
| 4 |
+
"description": "unist utility to serialize a node, position, or point as a human readable location",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"keywords": [
|
| 7 |
+
"unist",
|
| 8 |
+
"unist-util",
|
| 9 |
+
"util",
|
| 10 |
+
"utility",
|
| 11 |
+
"position",
|
| 12 |
+
"location",
|
| 13 |
+
"point",
|
| 14 |
+
"node",
|
| 15 |
+
"stringify",
|
| 16 |
+
"tostring"
|
| 17 |
+
],
|
| 18 |
+
"repository": "syntax-tree/unist-util-stringify-position",
|
| 19 |
+
"bugs": "https://github.com/syntax-tree/unist-util-stringify-position/issues",
|
| 20 |
+
"funding": {
|
| 21 |
+
"type": "opencollective",
|
| 22 |
+
"url": "https://opencollective.com/unified"
|
| 23 |
+
},
|
| 24 |
+
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
| 25 |
+
"contributors": [
|
| 26 |
+
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
| 27 |
+
],
|
| 28 |
+
"sideEffects": false,
|
| 29 |
+
"type": "module",
|
| 30 |
+
"exports": "./index.js",
|
| 31 |
+
"files": [
|
| 32 |
+
"lib/",
|
| 33 |
+
"index.d.ts",
|
| 34 |
+
"index.js"
|
| 35 |
+
],
|
| 36 |
+
"dependencies": {
|
| 37 |
+
"@types/unist": "^3.0.0"
|
| 38 |
+
},
|
| 39 |
+
"devDependencies": {
|
| 40 |
+
"@types/mdast": "^4.0.0",
|
| 41 |
+
"@types/node": "^20.0.0",
|
| 42 |
+
"c8": "^8.0.0",
|
| 43 |
+
"prettier": "^2.0.0",
|
| 44 |
+
"remark-cli": "^11.0.0",
|
| 45 |
+
"remark-preset-wooorm": "^9.0.0",
|
| 46 |
+
"type-coverage": "^2.0.0",
|
| 47 |
+
"typescript": "^5.0.0",
|
| 48 |
+
"xo": "^0.54.0"
|
| 49 |
+
},
|
| 50 |
+
"scripts": {
|
| 51 |
+
"prepack": "npm run build && npm run format",
|
| 52 |
+
"build": "tsc --build --clean && tsc --build && type-coverage",
|
| 53 |
+
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
| 54 |
+
"test-api": "node --conditions development test.js",
|
| 55 |
+
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
| 56 |
+
"test": "npm run build && npm run format && npm run test-coverage"
|
| 57 |
+
},
|
| 58 |
+
"prettier": {
|
| 59 |
+
"bracketSpacing": false,
|
| 60 |
+
"semi": false,
|
| 61 |
+
"singleQuote": true,
|
| 62 |
+
"tabWidth": 2,
|
| 63 |
+
"trailingComma": "none",
|
| 64 |
+
"useTabs": false
|
| 65 |
+
},
|
| 66 |
+
"remarkConfig": {
|
| 67 |
+
"plugins": [
|
| 68 |
+
"remark-preset-wooorm"
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
"typeCoverage": {
|
| 72 |
+
"atLeast": 100,
|
| 73 |
+
"detail": true,
|
| 74 |
+
"ignoreCatch": true,
|
| 75 |
+
"strict": true
|
| 76 |
+
},
|
| 77 |
+
"xo": {
|
| 78 |
+
"prettier": true
|
| 79 |
+
}
|
| 80 |
+
}
|
tools/ui/node_modules/unist-util-stringify-position/readme.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# unist-util-stringify-position
|
| 2 |
+
|
| 3 |
+
[![Build][build-badge]][build]
|
| 4 |
+
[![Coverage][coverage-badge]][coverage]
|
| 5 |
+
[![Downloads][downloads-badge]][downloads]
|
| 6 |
+
[![Size][size-badge]][size]
|
| 7 |
+
[![Sponsors][sponsors-badge]][collective]
|
| 8 |
+
[![Backers][backers-badge]][collective]
|
| 9 |
+
[![Chat][chat-badge]][chat]
|
| 10 |
+
|
| 11 |
+
[unist][] utility to pretty print the positional info of a node.
|
| 12 |
+
|
| 13 |
+
## Contents
|
| 14 |
+
|
| 15 |
+
* [What is this?](#what-is-this)
|
| 16 |
+
* [When should I use this?](#when-should-i-use-this)
|
| 17 |
+
* [Install](#install)
|
| 18 |
+
* [Use](#use)
|
| 19 |
+
* [API](#api)
|
| 20 |
+
* [`stringifyPosition(node|position|point)`](#stringifypositionnodepositionpoint)
|
| 21 |
+
* [Types](#types)
|
| 22 |
+
* [Compatibility](#compatibility)
|
| 23 |
+
* [Security](#security)
|
| 24 |
+
* [Related](#related)
|
| 25 |
+
* [Contribute](#contribute)
|
| 26 |
+
* [License](#license)
|
| 27 |
+
|
| 28 |
+
## What is this?
|
| 29 |
+
|
| 30 |
+
This package is a utility that takes any [unist][] (whether mdast, hast, etc)
|
| 31 |
+
node, position, or point, and serializes its positional info.
|
| 32 |
+
|
| 33 |
+
## When should I use this?
|
| 34 |
+
|
| 35 |
+
This utility is useful to display where something occurred in the original
|
| 36 |
+
document, in one standard way, for humans.
|
| 37 |
+
For example, when throwing errors or warning messages about something.
|
| 38 |
+
|
| 39 |
+
## Install
|
| 40 |
+
|
| 41 |
+
This package is [ESM only][esm].
|
| 42 |
+
In Node.js (version 16+), install with [npm][]:
|
| 43 |
+
|
| 44 |
+
```sh
|
| 45 |
+
npm install unist-util-stringify-position
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
In Deno with [`esm.sh`][esmsh]:
|
| 49 |
+
|
| 50 |
+
```js
|
| 51 |
+
import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4'
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
In browsers with [`esm.sh`][esmsh]:
|
| 55 |
+
|
| 56 |
+
```html
|
| 57 |
+
<script type="module">
|
| 58 |
+
import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4?bundle'
|
| 59 |
+
</script>
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Use
|
| 63 |
+
|
| 64 |
+
```js
|
| 65 |
+
import {stringifyPosition} from 'unist-util-stringify-position'
|
| 66 |
+
|
| 67 |
+
stringifyPosition({line: 2, column: 3}) // => '2:3' (point)
|
| 68 |
+
stringifyPosition({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' (position)
|
| 69 |
+
stringifyPosition({
|
| 70 |
+
type: 'text',
|
| 71 |
+
value: '!',
|
| 72 |
+
position: {
|
| 73 |
+
start: {line: 5, column: 11},
|
| 74 |
+
end: {line: 5, column: 12}
|
| 75 |
+
}
|
| 76 |
+
}) // => '5:11-5:12' (node)
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## API
|
| 80 |
+
|
| 81 |
+
This package exports the identifier [`stringifyPosition`][stringifyposition].
|
| 82 |
+
There is no default export.
|
| 83 |
+
|
| 84 |
+
### `stringifyPosition(node|position|point)`
|
| 85 |
+
|
| 86 |
+
Serialize the positional info of a point, position (start and end points), or
|
| 87 |
+
node.
|
| 88 |
+
|
| 89 |
+
###### Parameters
|
| 90 |
+
|
| 91 |
+
* `node` ([`Node`][node])
|
| 92 |
+
— node whose `position` fields to serialize
|
| 93 |
+
* `position` ([`Position`][position])
|
| 94 |
+
— position whose `start` and `end` points to serialize
|
| 95 |
+
* `point` ([`Point`][point])
|
| 96 |
+
— point whose `line` and `column` fields to serialize
|
| 97 |
+
|
| 98 |
+
###### Returns
|
| 99 |
+
|
| 100 |
+
Pretty printed positional info of a node (`string`).
|
| 101 |
+
|
| 102 |
+
In the format of a range `ls:cs-le:ce` (when given `node` or `position`) or a
|
| 103 |
+
point `l:c` (when given `point`), where `l` stands for line, `c` for column, `s`
|
| 104 |
+
for `start`, and `e` for end.
|
| 105 |
+
An empty string (`''`) is returned if the given value is neither `node`,
|
| 106 |
+
`position`, nor `point`.
|
| 107 |
+
|
| 108 |
+
## Types
|
| 109 |
+
|
| 110 |
+
This package is fully typed with [TypeScript][].
|
| 111 |
+
It exports no additional types.
|
| 112 |
+
|
| 113 |
+
## Compatibility
|
| 114 |
+
|
| 115 |
+
Projects maintained by the unified collective are compatible with maintained
|
| 116 |
+
versions of Node.js.
|
| 117 |
+
|
| 118 |
+
When we cut a new major release, we drop support for unmaintained versions of
|
| 119 |
+
Node.
|
| 120 |
+
This means we try to keep the current release line,
|
| 121 |
+
`unist-util-stringify-position@^4`, compatible with Node.js 16.
|
| 122 |
+
|
| 123 |
+
## Security
|
| 124 |
+
|
| 125 |
+
This project is safe.
|
| 126 |
+
|
| 127 |
+
## Related
|
| 128 |
+
|
| 129 |
+
* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated)
|
| 130 |
+
— check if a node is generated
|
| 131 |
+
* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position)
|
| 132 |
+
— get positional info of nodes
|
| 133 |
+
* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position)
|
| 134 |
+
— remove positional info from trees
|
| 135 |
+
* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source)
|
| 136 |
+
— get the source of a value (node or position) in a file
|
| 137 |
+
|
| 138 |
+
## Contribute
|
| 139 |
+
|
| 140 |
+
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
|
| 141 |
+
started.
|
| 142 |
+
See [`support.md`][support] for ways to get help.
|
| 143 |
+
|
| 144 |
+
This project has a [code of conduct][coc].
|
| 145 |
+
By interacting with this repository, organization, or community you agree to
|
| 146 |
+
abide by its terms.
|
| 147 |
+
|
| 148 |
+
## License
|
| 149 |
+
|
| 150 |
+
[MIT][license] © [Titus Wormer][author]
|
| 151 |
+
|
| 152 |
+
<!-- Definition -->
|
| 153 |
+
|
| 154 |
+
[build-badge]: https://github.com/syntax-tree/unist-util-stringify-position/workflows/main/badge.svg
|
| 155 |
+
|
| 156 |
+
[build]: https://github.com/syntax-tree/unist-util-stringify-position/actions
|
| 157 |
+
|
| 158 |
+
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg
|
| 159 |
+
|
| 160 |
+
[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position
|
| 161 |
+
|
| 162 |
+
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg
|
| 163 |
+
|
| 164 |
+
[downloads]: https://www.npmjs.com/package/unist-util-stringify-position
|
| 165 |
+
|
| 166 |
+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=unist-util-stringify-position
|
| 167 |
+
|
| 168 |
+
[size]: https://bundlejs.com/?q=unist-util-stringify-position
|
| 169 |
+
|
| 170 |
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
| 171 |
+
|
| 172 |
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
| 173 |
+
|
| 174 |
+
[collective]: https://opencollective.com/unified
|
| 175 |
+
|
| 176 |
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
| 177 |
+
|
| 178 |
+
[chat]: https://github.com/syntax-tree/unist/discussions
|
| 179 |
+
|
| 180 |
+
[npm]: https://docs.npmjs.com/cli/install
|
| 181 |
+
|
| 182 |
+
[license]: license
|
| 183 |
+
|
| 184 |
+
[author]: https://wooorm.com
|
| 185 |
+
|
| 186 |
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
| 187 |
+
|
| 188 |
+
[esmsh]: https://esm.sh
|
| 189 |
+
|
| 190 |
+
[typescript]: https://www.typescriptlang.org
|
| 191 |
+
|
| 192 |
+
[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
|
| 193 |
+
|
| 194 |
+
[support]: https://github.com/syntax-tree/.github/blob/main/support.md
|
| 195 |
+
|
| 196 |
+
[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
|
| 197 |
+
|
| 198 |
+
[unist]: https://github.com/syntax-tree/unist
|
| 199 |
+
|
| 200 |
+
[node]: https://github.com/syntax-tree/unist#node
|
| 201 |
+
|
| 202 |
+
[position]: https://github.com/syntax-tree/unist#position
|
| 203 |
+
|
| 204 |
+
[point]: https://github.com/syntax-tree/unist#point
|
| 205 |
+
|
| 206 |
+
[stringifyposition]: #stringifypositionnodepositionpoint
|
tools/ui/node_modules/unist-util-visit-parents/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export type {Test} from 'unist-util-is'
|
| 2 |
+
export type {
|
| 3 |
+
Action,
|
| 4 |
+
ActionTuple,
|
| 5 |
+
BuildVisitor,
|
| 6 |
+
// Undocumented: used in `unist-util-visit`:
|
| 7 |
+
InclusiveDescendant,
|
| 8 |
+
Index,
|
| 9 |
+
// Undocumented: used in `unist-util-visit`:
|
| 10 |
+
Matches,
|
| 11 |
+
Visitor,
|
| 12 |
+
VisitorResult
|
| 13 |
+
} from './lib/index.js'
|
| 14 |
+
export {CONTINUE, EXIT, SKIP, visitParents} from './lib/index.js'
|
tools/ui/node_modules/unist-util-visit-parents/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Note: types exported from `index.d.ts`
|
| 2 |
+
export {CONTINUE, EXIT, SKIP, visitParents} from './lib/index.js'
|
tools/ui/node_modules/unist-util-visit-parents/lib/color.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @param {string} d
|
| 3 |
+
* @returns {string}
|
| 4 |
+
*/
|
| 5 |
+
export function color(d: string): string;
|
| 6 |
+
//# sourceMappingURL=color.d.ts.map
|
tools/ui/node_modules/unist-util-visit-parents/lib/color.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["color.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,yBAHW,MAAM,GACJ,MAAM,CAIlB"}
|