feat(ui): finalize E-TIB modernization with footer redesign, video optimization, and TS fixes
Former-commit-id: 67ac02c8404cc66893fdf97308574701cca6000c
This commit is contained in:
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {pointEnd, pointStart, position} from './lib/index.js'
|
||||
Generated
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @typedef {import('unist').Node} Node
|
||||
* @typedef {import('unist').Point} Point
|
||||
* @typedef {import('unist').Position} Position
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef NodeLike
|
||||
* @property {string} type
|
||||
* @property {PositionLike | null | undefined} [position]
|
||||
*
|
||||
* @typedef PositionLike
|
||||
* @property {PointLike | null | undefined} [start]
|
||||
* @property {PointLike | null | undefined} [end]
|
||||
*
|
||||
* @typedef PointLike
|
||||
* @property {number | null | undefined} [line]
|
||||
* @property {number | null | undefined} [column]
|
||||
* @property {number | null | undefined} [offset]
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the ending point of `node`.
|
||||
*
|
||||
* @param node
|
||||
* Node.
|
||||
* @returns
|
||||
* Point.
|
||||
*/
|
||||
export const pointEnd = point('end')
|
||||
|
||||
/**
|
||||
* Get the starting point of `node`.
|
||||
*
|
||||
* @param node
|
||||
* Node.
|
||||
* @returns
|
||||
* Point.
|
||||
*/
|
||||
export const pointStart = point('start')
|
||||
|
||||
/**
|
||||
* Get the positional info of `node`.
|
||||
*
|
||||
* @param {'end' | 'start'} type
|
||||
* Side.
|
||||
* @returns
|
||||
* Getter.
|
||||
*/
|
||||
function point(type) {
|
||||
return point
|
||||
|
||||
/**
|
||||
* Get the point info of `node` at a bound side.
|
||||
*
|
||||
* @param {Node | NodeLike | null | undefined} [node]
|
||||
* @returns {Point | undefined}
|
||||
*/
|
||||
function point(node) {
|
||||
const point = (node && node.position && node.position[type]) || {}
|
||||
|
||||
if (
|
||||
typeof point.line === 'number' &&
|
||||
point.line > 0 &&
|
||||
typeof point.column === 'number' &&
|
||||
point.column > 0
|
||||
) {
|
||||
return {
|
||||
line: point.line,
|
||||
column: point.column,
|
||||
offset:
|
||||
typeof point.offset === 'number' && point.offset > -1
|
||||
? point.offset
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the positional info of `node`.
|
||||
*
|
||||
* @param {Node | NodeLike | null | undefined} [node]
|
||||
* Node.
|
||||
* @returns {Position | undefined}
|
||||
* Position.
|
||||
*/
|
||||
export function position(node) {
|
||||
const start = pointStart(node)
|
||||
const end = pointEnd(node)
|
||||
|
||||
if (start && end) {
|
||||
return {start, end}
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "unist-util-position",
|
||||
"version": "5.0.0",
|
||||
"description": "unist utility to get the position of a node",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"node",
|
||||
"position",
|
||||
"point"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-position",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-position/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/unist": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.0.0",
|
||||
"c8": "^8.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^11.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"xo": "^0.54.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build": "tsc --build --clean && tsc --build && type-coverage",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node --conditions development test.js",
|
||||
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "none",
|
||||
"useTabs": false
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"remark-preset-wooorm"
|
||||
]
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"ignoreCatch": true,
|
||||
"strict": true
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user