@markuplint/types
Advanced tools
Comparing version 3.0.0-dev.96 to 3.0.0-dev.176
import type { CustomSyntaxCheck, UnmatchedResult } from './types'; | ||
export declare function checkMultiTypes(value: string, checks: CustomSyntaxCheck[]): import("./types").MatchedResult | UnmatchedResult; | ||
export declare function checkMultiTypes( | ||
value: string, | ||
checks: readonly CustomSyntaxCheck[], | ||
): import('./types').MatchedResult | UnmatchedResult; |
@@ -7,2 +7,3 @@ "use strict"; | ||
function checkMultiTypes(value, checks) { | ||
var _a, _b, _c; | ||
let unmatched; | ||
@@ -18,5 +19,5 @@ for (const check of checks) { | ||
(0, debug_1.log)('%s(%d) vs %s(%d)', unmatched === null || unmatched === void 0 ? void 0 : unmatched._fn, unmatched === null || unmatched === void 0 ? void 0 : unmatched.passCount, res._fn, res.passCount); | ||
const passedA = (unmatched === null || unmatched === void 0 ? void 0 : unmatched.passCount) || 0; | ||
const passedB = res.passCount || 0; | ||
const offsetA = (unmatched === null || unmatched === void 0 ? void 0 : unmatched.offset) || 0; | ||
const passedA = (_a = unmatched === null || unmatched === void 0 ? void 0 : unmatched.passCount) !== null && _a !== void 0 ? _a : 0; | ||
const passedB = (_b = res.passCount) !== null && _b !== void 0 ? _b : 0; | ||
const offsetA = (_c = unmatched === null || unmatched === void 0 ? void 0 : unmatched.offset) !== null && _c !== void 0 ? _c : 0; | ||
const offsetB = res.offset; | ||
@@ -27,3 +28,3 @@ if (passedA < passedB || (passedA === passedB && offsetA <= offsetB)) { | ||
} | ||
const result = unmatched || (0, match_result_1.matched)(); | ||
const result = unmatched !== null && unmatched !== void 0 ? unmatched : (0, match_result_1.matched)(); | ||
(0, debug_1.log)('%d checks result: %O', checks.length, result); | ||
@@ -30,0 +31,0 @@ return result; |
import type { Type, Result, List, CustomSyntax, CustomCssSyntax, Enum, KeywordDefinedType, Number } from './types'; | ||
export declare function check(value: string, type: Type, ref?: string, cache?: boolean): Result; | ||
export declare function isKeyword(type: Type): type is KeywordDefinedType; | ||
export declare function isList(type: Type): type is List; | ||
export declare function isEnum(type: Type): type is Enum; | ||
export declare function isNumber(type: Type): type is Number; | ||
import type { ReadonlyDeep } from 'type-fest'; | ||
export declare function check(value: string, type: ReadonlyDeep<Type>, ref?: string, cache?: boolean): Result; | ||
export declare function isKeyword(type: ReadonlyDeep<Type>): type is ReadonlyDeep<KeywordDefinedType>; | ||
export declare function isList(type: ReadonlyDeep<Type>): type is ReadonlyDeep<List>; | ||
export declare function isEnum(type: ReadonlyDeep<Type>): type is ReadonlyDeep<Enum>; | ||
export declare function isNumber(type: ReadonlyDeep<Type>): type is ReadonlyDeep<Number>; | ||
export declare function isCSSSyntax(type: CustomSyntax | CustomCssSyntax): type is CustomCssSyntax; | ||
export declare function isCustomSyntax(type: CustomSyntax | CustomCssSyntax): type is CustomSyntax; |
@@ -1,76 +0,82 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const check_1 = require("./check"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const check_1 = require('./check'); | ||
test('Any', () => { | ||
expect((0, check_1.check)('', 'Any').matched).toBe(true); | ||
expect((0, check_1.check)(' ', 'Any').matched).toBe(true); | ||
expect((0, check_1.check)('a', 'Any').matched).toBe(true); | ||
expect((0, check_1.check)('', 'Any').matched).toBe(true); | ||
expect((0, check_1.check)(' ', 'Any').matched).toBe(true); | ||
expect((0, check_1.check)('a', 'Any').matched).toBe(true); | ||
}); | ||
test('NoEmptyAny', () => { | ||
expect((0, check_1.check)('', 'NoEmptyAny').matched).toBe(false); | ||
expect((0, check_1.check)(' ', 'NoEmptyAny').matched).toBe(true); | ||
expect((0, check_1.check)('a', 'NoEmptyAny').matched).toBe(true); | ||
expect((0, check_1.check)('', 'NoEmptyAny').matched).toBe(false); | ||
expect((0, check_1.check)(' ', 'NoEmptyAny').matched).toBe(true); | ||
expect((0, check_1.check)('a', 'NoEmptyAny').matched).toBe(true); | ||
}); | ||
test('OneLineAny', () => { | ||
expect((0, check_1.check)('', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)(' ', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a ', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a b', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a\n', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('a\nb', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('a\r\nb', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('a\rb', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)(' ', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a ', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a b', 'OneLineAny').matched).toBe(true); | ||
expect((0, check_1.check)('a\n', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('a\nb', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('a\r\nb', 'OneLineAny').matched).toBe(false); | ||
expect((0, check_1.check)('a\rb', 'OneLineAny').matched).toBe(false); | ||
}); | ||
test('Pattern', () => { | ||
expect((0, check_1.check)('.*', 'Pattern').matched).toBe(true); | ||
expect((0, check_1.check)('[a-z]+', 'Pattern').matched).toBe(true); | ||
expect((0, check_1.check)(']//[()?!+*', 'Pattern').matched).toBe(false); | ||
expect((0, check_1.check)('.*', 'Pattern').matched).toBe(true); | ||
expect((0, check_1.check)('[a-z]+', 'Pattern').matched).toBe(true); | ||
expect((0, check_1.check)(']//[()?!+*', 'Pattern').matched).toBe(false); | ||
}); | ||
test('BCP47', () => { | ||
expect((0, check_1.check)('en', 'BCP47').matched).toBe(true); | ||
expect((0, check_1.check)('en-US', 'BCP47').matched).toBe(true); | ||
expect((0, check_1.check)('ja', 'BCP47').matched).toBe(true); | ||
expect((0, check_1.check)(' ja ', 'BCP47').matched).toBe(false); | ||
expect((0, check_1.check)('', 'BCP47').matched).toBe(false); | ||
expect((0, check_1.check)('zh/cn', 'BCP47').matched).toBe(false); | ||
expect((0, check_1.check)('en', 'BCP47').matched).toBe(true); | ||
expect((0, check_1.check)('en-US', 'BCP47').matched).toBe(true); | ||
expect((0, check_1.check)('ja', 'BCP47').matched).toBe(true); | ||
expect((0, check_1.check)(' ja ', 'BCP47').matched).toBe(false); | ||
expect((0, check_1.check)('', 'BCP47').matched).toBe(false); | ||
expect((0, check_1.check)('zh/cn', 'BCP47').matched).toBe(false); | ||
}); | ||
test('Srcset', () => { | ||
expect((0, check_1.check)('a/bb/ccc/dddd', 'Srcset').matched).toBe(true); | ||
expect((0, check_1.check)('a/bb/ccc/dddd 200w', 'Srcset').matched).toBe(true); | ||
expect((0, check_1.check)('a/bb/ccc/dddd 200w, b/cc/ddd/eeee 1.5x', 'Srcset').matched).toBe(true); | ||
expect((0, check_1.check)('a/bb/ccc/dddd 200w, b/cc/ddd/eeee 1.5a', 'Srcset').matched).toBe(false); | ||
expect((0, check_1.check)('a/bb/ccc/dddd', 'Srcset').matched).toBe(true); | ||
expect((0, check_1.check)('a/bb/ccc/dddd 200w', 'Srcset').matched).toBe(true); | ||
expect((0, check_1.check)('a/bb/ccc/dddd 200w, b/cc/ddd/eeee 1.5x', 'Srcset').matched).toBe(true); | ||
expect((0, check_1.check)('a/bb/ccc/dddd 200w, b/cc/ddd/eeee 1.5a', 'Srcset').matched).toBe(false); | ||
}); | ||
test('IconSize', () => { | ||
expect((0, check_1.check)('any', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('Any', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('10x10', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('1x1', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('1x0', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('0x1', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('0x0', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)(' ', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('1', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('1x', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('x1', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('any', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('Any', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('10x10', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('1x1', 'IconSize').matched).toBe(true); | ||
expect((0, check_1.check)('1x0', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('0x1', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('0x0', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)(' ', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('1', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('1x', 'IconSize').matched).toBe(false); | ||
expect((0, check_1.check)('x1', 'IconSize').matched).toBe(false); | ||
}); | ||
test('Number', () => { | ||
expect((0, check_1.check)('10', { type: 'integer', gt: 0 }).matched).toBe(true); | ||
expect((0, check_1.check)('0', { type: 'integer', gt: 0 }).matched).toBe(false); | ||
expect((0, check_1.check)('0', { type: 'integer', gte: 0 }).matched).toBe(true); | ||
expect((0, check_1.check)('9', { type: 'integer', lt: 10 }).matched).toBe(true); | ||
expect((0, check_1.check)('10', { type: 'integer', lt: 10 }).matched).toBe(false); | ||
expect((0, check_1.check)('10', { type: 'integer', gt: 0 }).matched).toBe(true); | ||
expect((0, check_1.check)('0', { type: 'integer', gt: 0 }).matched).toBe(false); | ||
expect((0, check_1.check)('0', { type: 'integer', gte: 0 }).matched).toBe(true); | ||
expect((0, check_1.check)('9', { type: 'integer', lt: 10 }).matched).toBe(true); | ||
expect((0, check_1.check)('10', { type: 'integer', lt: 10 }).matched).toBe(false); | ||
}); | ||
test('Non-exist types', () => { | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', 'String').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', 'FooBar').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', ' ').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', '\n').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', '').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', 'String').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', 'FooBar').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', ' ').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', '\n').matched).toBe(true); | ||
// @ts-ignore | ||
expect((0, check_1.check)('abc', '').matched).toBe(true); | ||
}); | ||
test('ItemProp', () => { | ||
expect((0, check_1.check)('itemListElement', 'ItemProp').matched).toBe(true); | ||
expect((0, check_1.check)('item', 'ItemProp').matched).toBe(true); | ||
expect((0, check_1.check)('position', 'ItemProp').matched).toBe(true); | ||
}); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cssSyntaxMatch = void 0; | ||
const tslib_1 = require("tslib"); | ||
const css_tree_1 = tslib_1.__importDefault(require("css-tree")); | ||
const css_tree_1 = require("css-tree"); | ||
const debug_1 = require("./debug"); | ||
@@ -13,2 +12,3 @@ const defs_1 = require("./defs"); | ||
function cssSyntaxMatch(value, type) { | ||
var _a; | ||
(0, debug_1.log)('Search CSS Syntax: "%s"', type); | ||
@@ -29,3 +29,3 @@ const origin = value; | ||
defName = type.syntax.apply; | ||
ebnf = type.syntax.ebnf || null; | ||
ebnf = (_a = type.syntax.ebnf) !== null && _a !== void 0 ? _a : null; | ||
if (ebnf) { | ||
@@ -44,3 +44,3 @@ // Work in progress | ||
} | ||
else { | ||
else if (valueOrChecker) { | ||
typesCheckers[key] = valueOrChecker; | ||
@@ -59,3 +59,3 @@ } | ||
// @ts-ignore | ||
const lexer = css_tree_1.default.fork({ | ||
const lexer = (0, css_tree_1.fork)({ | ||
types: typesExtended, | ||
@@ -66,5 +66,7 @@ properties: propsExtended, | ||
const checker = typesCheckers[key]; | ||
lexer.addType_(key, (token, getNextToken) => checker(token, getNextToken, cssSyntaxMatch)); | ||
// @ts-ignore | ||
lexer.addType_(key, (token, getNextToken) => checker === null || checker === void 0 ? void 0 : checker(token, getNextToken, cssSyntaxMatch)); | ||
}); | ||
const { isProp, name } = detectName(defName); | ||
// @ts-ignore | ||
const matcher = isProp ? lexer.properties[name] : lexer.types[name]; | ||
@@ -76,3 +78,3 @@ if (!matcher) { | ||
const refParam = isProp ? 'Property' : 'Type'; | ||
ref = ref || `https://csstree.github.io/docs/syntax/#${refParam}:${name}`; | ||
ref = ref !== null && ref !== void 0 ? ref : `https://csstree.github.io/docs/syntax/#${refParam}:${name}`; | ||
// eslint-disable-next-line no-console | ||
@@ -88,8 +90,8 @@ const _w = console.warn; | ||
console.warn = _w; | ||
if (result.matched) { | ||
if (debug_1.log.enabled) { | ||
(0, debug_1.log)('css-tree/result.matched: %s', JSON.stringify(result.matched, null, 2)); | ||
} | ||
if (!result.error) { | ||
return (0, match_result_1.matched)(); | ||
} | ||
if (!('css' in result.error)) { | ||
throw result.error; | ||
} | ||
const error = result.error; | ||
@@ -135,4 +137,17 @@ if (caseSensitive) { | ||
} | ||
function eachMimicCases(key, obj) { | ||
/** | ||
* | ||
* @param key | ||
* @param obj | ||
* @modifies obj | ||
* @returns | ||
*/ | ||
function eachMimicCases(key, | ||
// Mutable | ||
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types | ||
obj) { | ||
const value = obj[key]; | ||
if (!value) { | ||
return; | ||
} | ||
obj[key] = mimicCases(value); | ||
@@ -139,0 +154,0 @@ } |
@@ -1,157 +0,160 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const css_syntax_1 = require("./css-syntax"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const css_syntax_1 = require('./css-syntax'); | ||
test('CSS Standard', () => { | ||
expect((0, css_syntax_1.cssSyntaxMatch)('10px', '<length>').matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('one-pixel', '<length>').matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(prefers-color-scheme: dark)', '<media-query-list>').matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('10px', '<length>').matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('one-pixel', '<length>').matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(prefers-color-scheme: dark)', '<media-query-list>').matched).toBe(true); | ||
}); | ||
test('Extends', () => { | ||
const sourceSizeList = { | ||
ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes', | ||
syntax: { | ||
apply: '<source-size-list>', | ||
def: { | ||
'source-size-list': '[ <source-size># , ]? <source-size-value>', | ||
'source-size': '<media-condition> <source-size-value>', | ||
'source-size-value': '<length>', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('50vw', sourceSizeList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px, 50vw', sourceSizeList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('print 300vw', sourceSizeList).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', sourceSizeList).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', { | ||
...sourceSizeList, | ||
syntax: { | ||
...sourceSizeList.syntax, | ||
apply: '<source-size>', | ||
}, | ||
}).matched).toBe(true); | ||
const keyTimes = { | ||
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute', | ||
syntax: { | ||
apply: '<key-times>', | ||
def: { | ||
'key-times': '<number> [; <number>]* [;]?', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30', keyTimes).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30;', keyTimes).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; abc;', keyTimes).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; ;', keyTimes).matched).toBe(false); | ||
const SVGViewBox = { | ||
ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute', | ||
syntax: { | ||
apply: '<view-box>', | ||
def: { | ||
'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>', | ||
'min-x': '<number>', | ||
'min-y': '<number>', | ||
width: '<number>', | ||
height: '<number>', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', SVGViewBox).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30, 10', SVGViewBox).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30', SVGViewBox).matched).toBe(false); | ||
const percentageList = { | ||
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage', | ||
syntax: { | ||
apply: '<percentage-list>', | ||
def: { | ||
'percentage-list': '[ <number> [,]? ]* <number>', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', percentageList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0, 0, 30 10', percentageList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0', percentageList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('', percentageList).matched).toBe(false); | ||
const custom = { | ||
ref: 'n/a', | ||
syntax: { | ||
apply: '<custom>', | ||
def: { | ||
custom: '0 | 1 | .', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('.', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('2', custom).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)(':', custom).matched).toBe(false); | ||
const sourceSizeList = { | ||
ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes', | ||
syntax: { | ||
apply: '<source-size-list>', | ||
def: { | ||
'source-size-list': '[ <source-size># , ]? <source-size-value>', | ||
'source-size': '<media-condition> <source-size-value>', | ||
'source-size-value': '<length>', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('50vw', sourceSizeList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px, 50vw', sourceSizeList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('print 300vw', sourceSizeList).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', sourceSizeList).matched).toBe(false); | ||
expect( | ||
(0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', { | ||
...sourceSizeList, | ||
syntax: { | ||
...sourceSizeList.syntax, | ||
apply: '<source-size>', | ||
}, | ||
}).matched, | ||
).toBe(true); | ||
const keyTimes = { | ||
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute', | ||
syntax: { | ||
apply: '<key-times>', | ||
def: { | ||
'key-times': '<number> [; <number>]* [;]?', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30', keyTimes).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30;', keyTimes).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; abc;', keyTimes).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; ;', keyTimes).matched).toBe(false); | ||
const SVGViewBox = { | ||
ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute', | ||
syntax: { | ||
apply: '<view-box>', | ||
def: { | ||
'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>', | ||
'min-x': '<number>', | ||
'min-y': '<number>', | ||
width: '<number>', | ||
height: '<number>', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', SVGViewBox).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30, 10', SVGViewBox).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30', SVGViewBox).matched).toBe(false); | ||
const percentageList = { | ||
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage', | ||
syntax: { | ||
apply: '<percentage-list>', | ||
def: { | ||
'percentage-list': '[ <number> [,]? ]* <number>', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', percentageList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0, 0, 30 10', percentageList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0', percentageList).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('', percentageList).matched).toBe(false); | ||
const custom = { | ||
ref: 'n/a', | ||
syntax: { | ||
apply: '<custom>', | ||
def: { | ||
custom: '0 | 1 | .', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('.', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('2', custom).matched).toBe(false); | ||
expect((0, css_syntax_1.cssSyntaxMatch)(':', custom).matched).toBe(false); | ||
}); | ||
test('custom-type-checking', () => { | ||
const custom = { | ||
ref: 'n/a', | ||
caseSensitive: true, | ||
syntax: { | ||
apply: '<custom>', | ||
def: { | ||
custom: '<custom-type>', | ||
'custom-type': token => { | ||
if (!token) { | ||
return 0; | ||
} | ||
return token.value === '1' ? 1 : 0; | ||
}, | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(false); | ||
const custom = { | ||
ref: 'n/a', | ||
caseSensitive: true, | ||
syntax: { | ||
apply: '<custom>', | ||
def: { | ||
custom: '<custom-type>', | ||
'custom-type': token => { | ||
if (!token) { | ||
return 0; | ||
} | ||
return token.value === '1' ? 1 : 0; | ||
}, | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(false); | ||
}); | ||
test('case-sensitive', () => { | ||
const custom = { | ||
ref: 'n/a', | ||
caseSensitive: true, | ||
syntax: { | ||
apply: '<custom>', | ||
def: { | ||
custom: 'CaSeS [a | B | aBc]', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS a', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS B', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS aBc', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS A', custom)).toStrictEqual({ | ||
column: 7, | ||
line: 1, | ||
matched: false, | ||
length: 1, | ||
offset: 6, | ||
partName: 'value', | ||
raw: 'A', | ||
reason: 'syntax-error', | ||
ref: 'n/a', | ||
expects: [ | ||
{ | ||
type: 'syntax', | ||
value: '<custom>', | ||
}, | ||
], | ||
}); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS abc', custom)).toStrictEqual({ | ||
column: 7, | ||
line: 1, | ||
matched: false, | ||
length: 3, | ||
offset: 6, | ||
partName: 'value', | ||
raw: 'abc', | ||
reason: 'syntax-error', | ||
ref: 'n/a', | ||
expects: [ | ||
{ | ||
type: 'syntax', | ||
value: '<custom>', | ||
}, | ||
], | ||
}); | ||
const custom = { | ||
ref: 'n/a', | ||
caseSensitive: true, | ||
syntax: { | ||
apply: '<custom>', | ||
def: { | ||
custom: 'CaSeS [a | B | aBc]', | ||
}, | ||
}, | ||
}; | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS a', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS B', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS aBc', custom).matched).toBe(true); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS A', custom)).toStrictEqual({ | ||
column: 7, | ||
line: 1, | ||
matched: false, | ||
length: 1, | ||
offset: 6, | ||
partName: 'value', | ||
raw: 'A', | ||
reason: 'syntax-error', | ||
ref: 'n/a', | ||
expects: [ | ||
{ | ||
type: 'syntax', | ||
value: '<custom>', | ||
}, | ||
], | ||
}); | ||
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS abc', custom)).toStrictEqual({ | ||
column: 7, | ||
line: 1, | ||
matched: false, | ||
length: 3, | ||
offset: 6, | ||
partName: 'value', | ||
raw: 'abc', | ||
reason: 'syntax-error', | ||
ref: 'n/a', | ||
expects: [ | ||
{ | ||
type: 'syntax', | ||
value: '<custom>', | ||
}, | ||
], | ||
}); | ||
}); |
@@ -118,3 +118,3 @@ "use strict"; | ||
} | ||
if (!tokens.length) { | ||
if (tokens.length === 0) { | ||
return (0, match_result_1.unmatched)(value, 'empty-token'); | ||
@@ -435,3 +435,3 @@ } | ||
} | ||
if (tail && tail.length) { | ||
if (tail[0]) { | ||
return tail[0].unmatched({ reason: 'extra-token' }); | ||
@@ -438,0 +438,0 @@ } |
import type { Result } from './types'; | ||
import type { Enum } from './types.schema'; | ||
export declare function checkEnum(value: string, type: Enum, ref?: string): Result; | ||
import type { ReadonlyDeep } from 'type-fest'; | ||
export declare function checkEnum(value: string, type: ReadonlyDeep<Enum>, ref?: string): Result; |
@@ -12,3 +12,3 @@ "use strict"; | ||
} | ||
let values = type.enum; | ||
let values = type.enum.slice(); | ||
if (caseInsensitive) { | ||
@@ -15,0 +15,0 @@ value = value.toLowerCase(); |
type NullableString = string | null | undefined; | ||
export declare function getCandidate(value: NullableString, ...candidates: (NullableString | NullableString[])[]): string | undefined; | ||
export declare function getCandidate( | ||
value: NullableString, | ||
...candidates: readonly (NullableString | readonly NullableString[])[] | ||
): string | undefined; | ||
export {}; |
@@ -36,2 +36,3 @@ "use strict"; | ||
function _checkKeywordType(value, type) { | ||
var _a, _b; | ||
const def = defs_1.types[type]; | ||
@@ -55,4 +56,4 @@ if (!def) { | ||
...matches, | ||
ref: matches.ref || def.ref, | ||
expects: matches.expects || def.expects, | ||
ref: (_a = matches.ref) !== null && _a !== void 0 ? _a : def.ref, | ||
expects: (_b = matches.expects) !== null && _b !== void 0 ? _b : def.expects, | ||
}; | ||
@@ -59,0 +60,0 @@ } |
import type { Result } from './types'; | ||
import type { List } from './types.schema'; | ||
export declare function checkList(value: string, type: List, ref?: string, cache?: boolean): Result; | ||
import type { ReadonlyDeep } from 'type-fest'; | ||
export declare function checkList(value: string, type: ReadonlyDeep<List>, ref?: string, cache?: boolean): Result; |
@@ -8,2 +8,3 @@ "use strict"; | ||
function checkList(value, type, ref, cache = true) { | ||
var _a; | ||
const tokens = new token_1.TokenCollection(value, type); | ||
@@ -21,3 +22,3 @@ const matches = tokens.check({ ref }); | ||
...res, | ||
partName: res.partName || 'the content of the list', | ||
partName: (_a = res.partName) !== null && _a !== void 0 ? _a : 'the content of the list', | ||
offset, | ||
@@ -24,0 +25,0 @@ line, |
@@ -1,129 +0,130 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const list_1 = require("./list"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const list_1 = require('./list'); | ||
test('Zero space', () => { | ||
const type = { token: 'Zero', separator: 'space' }; | ||
expect((0, list_1.checkList)('0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('1', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 1 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 1 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 1 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 1 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false); | ||
const type = { token: 'Zero', separator: 'space' }; | ||
expect((0, list_1.checkList)('0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('1', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 1 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 1 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 1 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 1 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false); | ||
}); | ||
test('Zero comma', () => { | ||
const type = { token: 'Zero', separator: 'comma' }; | ||
expect((0, list_1.checkList)('0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false); | ||
const type = { token: 'Zero', separator: 'comma' }; | ||
expect((0, list_1.checkList)('0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false); | ||
}); | ||
test('Zero comma (disallowToSurroundBySpaces)', () => { | ||
const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true }; | ||
expect((0, list_1.checkList)('0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0,0,0,0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false); | ||
const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true }; | ||
expect((0, list_1.checkList)('0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(false); | ||
expect((0, list_1.checkList)('0,0,0,0', type).matched).toBe(true); | ||
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false); | ||
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false); | ||
}); | ||
test('Location of the token', () => { | ||
const type = { token: 'Accept', separator: 'comma' }; | ||
expect((0, list_1.checkList)('x/y;a=b', type)).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 4, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';a=b', | ||
reason: 'extra-token', | ||
partName: 'the content of the list', | ||
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept', | ||
}); | ||
expect((0, list_1.checkList)('x/y,x/y;a=b', type)).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 8, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 4, | ||
line: 1, | ||
matched: false, | ||
offset: 7, | ||
raw: ';a=b', | ||
reason: 'extra-token', | ||
partName: 'the content of the list', | ||
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept', | ||
}); | ||
expect((0, list_1.checkList)('x/y\n,\nx/y;a=b', type)).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 4, | ||
line: 3, | ||
matched: false, | ||
offset: 9, | ||
raw: ';a=b', | ||
reason: 'extra-token', | ||
partName: 'the content of the list', | ||
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept', | ||
}); | ||
const type = { token: 'Accept', separator: 'comma' }; | ||
expect((0, list_1.checkList)('x/y;a=b', type)).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 4, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';a=b', | ||
reason: 'extra-token', | ||
partName: 'the content of the list', | ||
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept', | ||
}); | ||
expect((0, list_1.checkList)('x/y,x/y;a=b', type)).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 8, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 4, | ||
line: 1, | ||
matched: false, | ||
offset: 7, | ||
raw: ';a=b', | ||
reason: 'extra-token', | ||
partName: 'the content of the list', | ||
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept', | ||
}); | ||
expect((0, list_1.checkList)('x/y\n,\nx/y;a=b', type)).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 4, | ||
line: 3, | ||
matched: false, | ||
offset: 9, | ||
raw: ';a=b', | ||
reason: 'extra-token', | ||
partName: 'the content of the list', | ||
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept', | ||
}); | ||
}); | ||
test('Expected comma', () => { | ||
const type = { token: 'Accept', separator: 'comma' }; | ||
expect((0, list_1.checkList)('x/y,', type)).toStrictEqual({ | ||
column: 4, | ||
expects: undefined, | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ',', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect((0, list_1.checkList)('x/y,,x/y', type)).toStrictEqual({ | ||
column: 5, | ||
expects: undefined, | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 4, | ||
raw: ',', | ||
reason: 'unexpected-comma', | ||
ref: null, | ||
}); | ||
const type = { token: 'Accept', separator: 'comma' }; | ||
expect((0, list_1.checkList)('x/y,', type)).toStrictEqual({ | ||
column: 4, | ||
expects: undefined, | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ',', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect((0, list_1.checkList)('x/y,,x/y', type)).toStrictEqual({ | ||
column: 5, | ||
expects: undefined, | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 4, | ||
raw: ',', | ||
reason: 'unexpected-comma', | ||
ref: null, | ||
}); | ||
}); | ||
test('Missing comma', () => { | ||
const type = { token: 'Accept', separator: 'comma' }; | ||
expect((0, list_1.checkList)('a/b,x/y a/z', type)).toStrictEqual({ | ||
column: 9, | ||
candidate: ',a/z', | ||
expects: undefined, | ||
length: 3, | ||
line: 1, | ||
matched: false, | ||
offset: 8, | ||
raw: 'a/z', | ||
reason: 'missing-comma', | ||
ref: null, | ||
}); | ||
const type = { token: 'Accept', separator: 'comma' }; | ||
expect((0, list_1.checkList)('a/b,x/y a/z', type)).toStrictEqual({ | ||
column: 9, | ||
candidate: ',a/z', | ||
expects: undefined, | ||
length: 3, | ||
line: 1, | ||
matched: false, | ||
offset: 8, | ||
raw: 'a/z', | ||
reason: 'missing-comma', | ||
ref: null, | ||
}); | ||
}); |
@@ -1,9 +0,22 @@ | ||
import type { FormattedPrimitiveTypeCheck, MatchedResult, UnmatchedResult, UnmatchedResultOptions, UnmatchedResultReason } from './types'; | ||
export declare function matches(checker: FormattedPrimitiveTypeCheck, options?: UnmatchedResultOptions & { | ||
ref?: string; | ||
reason?: UnmatchedResultReason; | ||
}): (value: string) => MatchedResult | UnmatchedResult; | ||
import type { | ||
FormattedPrimitiveTypeCheck, | ||
MatchedResult, | ||
UnmatchedResult, | ||
UnmatchedResultOptions, | ||
UnmatchedResultReason, | ||
} from './types'; | ||
export declare function matches( | ||
checker: FormattedPrimitiveTypeCheck, | ||
options?: UnmatchedResultOptions & { | ||
readonly ref?: string; | ||
readonly reason?: UnmatchedResultReason; | ||
}, | ||
): (value: string) => MatchedResult | UnmatchedResult; | ||
export declare function matched(): MatchedResult; | ||
export declare function unmatched(value: string, reason?: UnmatchedResultReason, options?: UnmatchedResultOptions & { | ||
ref?: string; | ||
}): UnmatchedResult; | ||
export declare function unmatched( | ||
value: string, | ||
reason?: UnmatchedResultReason, | ||
options?: UnmatchedResultOptions & { | ||
readonly ref?: string; | ||
}, | ||
): UnmatchedResult; |
@@ -21,6 +21,7 @@ "use strict"; | ||
function unmatched(value, reason, options) { | ||
var _a; | ||
return { | ||
...options, | ||
matched: false, | ||
ref: (options === null || options === void 0 ? void 0 : options.ref) || null, | ||
ref: (_a = options === null || options === void 0 ? void 0 : options.ref) !== null && _a !== void 0 ? _a : null, | ||
raw: value, | ||
@@ -27,0 +28,0 @@ offset: 0, |
import type { Result } from './types'; | ||
import type { Number } from './types.schema'; | ||
export declare function checkNumber(value: string, type: Number, ref?: string): Result; | ||
export declare function checkNumber(value: string, type: Readonly<Number>, ref?: string): Result; |
@@ -1,62 +0,63 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const _1 = require("."); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const _1 = require('.'); | ||
test('int', () => { | ||
expect((0, _1.isInt)('0')).toBe(true); | ||
expect((0, _1.isInt)('1')).toBe(true); | ||
expect((0, _1.isInt)('-0')).toBe(true); | ||
expect((0, _1.isInt)('-1')).toBe(true); | ||
expect((0, _1.isInt)('10')).toBe(true); | ||
expect((0, _1.isInt)('100')).toBe(true); | ||
expect((0, _1.isInt)('1.00')).toBe(false); | ||
expect((0, _1.isInt)('.001')).toBe(false); | ||
expect((0, _1.isInt)(' 1 ')).toBe(false); | ||
expect((0, _1.isInt)('- 1')).toBe(false); | ||
expect((0, _1.isInt)('0')).toBe(true); | ||
expect((0, _1.isInt)('1')).toBe(true); | ||
expect((0, _1.isInt)('-0')).toBe(true); | ||
expect((0, _1.isInt)('-1')).toBe(true); | ||
expect((0, _1.isInt)('10')).toBe(true); | ||
expect((0, _1.isInt)('100')).toBe(true); | ||
expect((0, _1.isInt)('1.00')).toBe(false); | ||
expect((0, _1.isInt)('.001')).toBe(false); | ||
expect((0, _1.isInt)(' 1 ')).toBe(false); | ||
expect((0, _1.isInt)('- 1')).toBe(false); | ||
}); | ||
test('uint', () => { | ||
expect((0, _1.isUint)('0')).toBe(true); | ||
expect((0, _1.isUint)('1')).toBe(true); | ||
expect((0, _1.isUint)('10')).toBe(true); | ||
expect((0, _1.isUint)('100')).toBe(true); | ||
expect((0, _1.isUint)('-0')).toBe(false); | ||
expect((0, _1.isUint)('-1')).toBe(false); | ||
expect((0, _1.isUint)('1.00')).toBe(false); | ||
expect((0, _1.isUint)('.001')).toBe(false); | ||
expect((0, _1.isUint)(' 1 ')).toBe(false); | ||
expect((0, _1.isUint)('- 1')).toBe(false); | ||
expect((0, _1.isUint)('0')).toBe(true); | ||
expect((0, _1.isUint)('1')).toBe(true); | ||
expect((0, _1.isUint)('10')).toBe(true); | ||
expect((0, _1.isUint)('100')).toBe(true); | ||
expect((0, _1.isUint)('-0')).toBe(false); | ||
expect((0, _1.isUint)('-1')).toBe(false); | ||
expect((0, _1.isUint)('1.00')).toBe(false); | ||
expect((0, _1.isUint)('.001')).toBe(false); | ||
expect((0, _1.isUint)(' 1 ')).toBe(false); | ||
expect((0, _1.isUint)('- 1')).toBe(false); | ||
}); | ||
test('float', () => { | ||
expect((0, _1.isFloat)('0')).toBe(true); | ||
expect((0, _1.isFloat)('1')).toBe(true); | ||
expect((0, _1.isFloat)('10')).toBe(true); | ||
expect((0, _1.isFloat)('100')).toBe(true); | ||
expect((0, _1.isFloat)('-0')).toBe(true); | ||
expect((0, _1.isFloat)('-1')).toBe(true); | ||
expect((0, _1.isFloat)('1.00')).toBe(true); | ||
expect((0, _1.isFloat)('.001')).toBe(true); | ||
expect((0, _1.isFloat)(' 1 ')).toBe(false); | ||
expect((0, _1.isFloat)('- 1')).toBe(false); | ||
expect((0, _1.isFloat)('0')).toBe(true); | ||
expect((0, _1.isFloat)('1')).toBe(true); | ||
expect((0, _1.isFloat)('10')).toBe(true); | ||
expect((0, _1.isFloat)('100')).toBe(true); | ||
expect((0, _1.isFloat)('-0')).toBe(true); | ||
expect((0, _1.isFloat)('-1')).toBe(true); | ||
expect((0, _1.isFloat)('1.00')).toBe(true); | ||
expect((0, _1.isFloat)('.001')).toBe(true); | ||
expect((0, _1.isFloat)(' 1 ')).toBe(false); | ||
expect((0, _1.isFloat)('- 1')).toBe(false); | ||
}); | ||
test('nonZeroUint', () => { | ||
expect((0, _1.isNonZeroUint)('0')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('1')).toBe(true); | ||
expect((0, _1.isNonZeroUint)('10')).toBe(true); | ||
expect((0, _1.isNonZeroUint)('100')).toBe(true); | ||
expect((0, _1.isNonZeroUint)('-0')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('-1')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('1.00')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('.001')).toBe(false); | ||
expect((0, _1.isNonZeroUint)(' 1 ')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('- 1')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('0')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('1')).toBe(true); | ||
expect((0, _1.isNonZeroUint)('10')).toBe(true); | ||
expect((0, _1.isNonZeroUint)('100')).toBe(true); | ||
expect((0, _1.isNonZeroUint)('-0')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('-1')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('1.00')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('.001')).toBe(false); | ||
expect((0, _1.isNonZeroUint)(' 1 ')).toBe(false); | ||
expect((0, _1.isNonZeroUint)('- 1')).toBe(false); | ||
}); | ||
test('quantity', () => { | ||
expect((0, _1.isQuantity)('0px', ['px', 'em'])).toBe(true); | ||
expect((0, _1.isQuantity)('.5px', ['px', 'em'])).toBe(true); | ||
expect((0, _1.isQuantity)('1.5em', ['px', 'em'])).toBe(true); | ||
expect((0, _1.isQuantity)('1.5cm', ['px', 'em'])).toBe(false); | ||
expect((0, _1.isQuantity)('1.5px', ['px', 'em'], 'int')).toBe(false); | ||
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'int')).toBe(true); | ||
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'uint')).toBe(false); | ||
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'float')).toBe(true); | ||
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'int')).toBe(false); | ||
expect((0, _1.isQuantity)('0px', ['px', 'em'])).toBe(true); | ||
expect((0, _1.isQuantity)('.5px', ['px', 'em'])).toBe(true); | ||
expect((0, _1.isQuantity)('1.5em', ['px', 'em'])).toBe(true); | ||
expect((0, _1.isQuantity)('1.5cm', ['px', 'em'])).toBe(false); | ||
expect((0, _1.isQuantity)('1.5px', ['px', 'em'], 'int')).toBe(false); | ||
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'int')).toBe(true); | ||
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'uint')).toBe(false); | ||
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'float')).toBe(true); | ||
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'int')).toBe(false); | ||
}); |
@@ -7,2 +7,6 @@ /** | ||
*/ | ||
export declare function isQuantity(value: string, units: string[], numberType?: 'int' | 'uint' | 'float'): boolean; | ||
export declare function isQuantity( | ||
value: string, | ||
units: readonly string[], | ||
numberType?: 'int' | 'uint' | 'float', | ||
): boolean; |
@@ -6,4 +6,7 @@ /** | ||
*/ | ||
export declare function isUint(value: string, options?: { | ||
gt?: number; | ||
}): boolean; | ||
export declare function isUint( | ||
value: string, | ||
options?: { | ||
readonly gt?: number; | ||
}, | ||
): boolean; |
@@ -7,4 +7,4 @@ /** | ||
export declare function splitUnit(value: string): { | ||
num: string; | ||
unit: string; | ||
num: string; | ||
unit: string; | ||
}; |
@@ -20,6 +20,6 @@ "use strict"; | ||
return { | ||
num, | ||
unit, | ||
num: num !== null && num !== void 0 ? num : value, | ||
unit: unit !== null && unit !== void 0 ? unit : '', | ||
}; | ||
} | ||
exports.splitUnit = splitUnit; |
@@ -1,19 +0,20 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const is_bcp_47_1 = require("./is-bcp-47"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const is_bcp_47_1 = require('./is-bcp-47'); | ||
const is = (0, is_bcp_47_1.isBCP47)(); | ||
test('en-us', () => { | ||
expect(is('en-us')).toBe(true); | ||
expect(is('en-us')).toBe(true); | ||
}); | ||
test('ja-JP', () => { | ||
expect(is('ja-JP')).toBe(true); | ||
expect(is('ja-JP')).toBe(true); | ||
}); | ||
test('Empty', () => { | ||
expect(is('')).toBe(false); | ||
expect(is('')).toBe(false); | ||
}); | ||
test('Invalid', () => { | ||
expect(is(':::')).toBe(false); | ||
expect(is(':::')).toBe(false); | ||
}); | ||
test('Surrounded by spaces', () => { | ||
expect(is(' en ')).toBe(false); | ||
expect(is(' en ')).toBe(false); | ||
}); |
@@ -0,62 +1,77 @@ | ||
import type { TokenValue } from './types'; | ||
import type { UnmatchedResult } from '..'; | ||
import type { Expect, Result, List } from '../types'; | ||
import type { ReadonlyDeep } from 'type-fest'; | ||
import { Token } from './token'; | ||
type TokenCollectionOptions = Partial<Omit<List, 'token'> & { | ||
specificSeparator: string | string[]; | ||
}>; | ||
export type TokenEachCheck = (head: Token | null, tail: TokenCollection) => Result | void; | ||
type TokenCollectionOptions = Partial< | ||
Omit<List, 'token'> & { | ||
specificSeparator: string | string[]; | ||
} | ||
>; | ||
export type TokenEachCheck = (head: Readonly<Token> | null, tail: ReadonlyDeep<TokenCollection>) => Result | void; | ||
export declare class TokenCollection extends Array<Token> { | ||
static fromPatterns(value: Token | string, patterns: RegExp[], typeOptions?: Omit<TokenCollectionOptions, 'specificSeparator'> & { | ||
repeat?: boolean; | ||
}): TokenCollection; | ||
static get [Symbol.species](): ArrayConstructor; | ||
readonly allowEmpty: NonNullable<List['allowEmpty']>; | ||
readonly caseInsensitive: NonNullable<List['caseInsensitive']>; | ||
readonly disallowToSurroundBySpaces: NonNullable<List['disallowToSurroundBySpaces']>; | ||
readonly number: List['number']; | ||
readonly ordered: NonNullable<List['ordered']>; | ||
readonly separator: NonNullable<List['separator']>; | ||
readonly unique: NonNullable<List['unique']>; | ||
constructor(value?: string, typeOptions?: TokenCollectionOptions); | ||
constructor(value?: number); | ||
get value(): string; | ||
check(options?: { | ||
expects?: Expect[]; | ||
ref?: string; | ||
cache?: boolean; | ||
}): import("..").MatchedResult | UnmatchedResult; | ||
chunk(split: number): TokenCollection[]; | ||
compareTokens(callback: (prev: Token, current: Token) => Token | null | void): Token | null | undefined; | ||
divide(position: number): readonly [TokenCollection, TokenCollection]; | ||
eachCheck(...callbacks: TokenEachCheck[]): Result; | ||
filter(callback: (value: Token, index: number, array: Token[]) => boolean): TokenCollection; | ||
getConsecutiveToken(tokenType: number): Token | null; | ||
getDuplicated(): Token | null; | ||
getIdentTokens(): TokenCollection; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
has(value: string | RegExp | number | (string | RegExp | number)[]): boolean; | ||
headAndTail(): { | ||
head: Token | null; | ||
tail: TokenCollection; | ||
}; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
search(value: string | RegExp | number | (string | RegExp | number)[]): Token | null; | ||
takeTurns(tokenNumbers: ReadonlyArray<number>, lastTokenNumber?: number): { | ||
unexpectedLastToken: boolean; | ||
expectedTokenNumber: number; | ||
token: Token; | ||
} | null; | ||
toJSON(): { | ||
type: number; | ||
value: string; | ||
offset: number; | ||
}[]; | ||
private static _new; | ||
static fromPatterns( | ||
value: Readonly<Token> | string, | ||
patterns: readonly Readonly<RegExp>[], | ||
typeOptions?: ReadonlyDeep< | ||
Omit<TokenCollectionOptions, 'specificSeparator'> & { | ||
repeat?: boolean; | ||
} | ||
>, | ||
): TokenCollection; | ||
static get [Symbol.species](): ArrayConstructor; | ||
readonly allowEmpty: NonNullable<List['allowEmpty']>; | ||
readonly caseInsensitive: NonNullable<List['caseInsensitive']>; | ||
readonly disallowToSurroundBySpaces: NonNullable<List['disallowToSurroundBySpaces']>; | ||
readonly number: List['number']; | ||
readonly ordered: NonNullable<List['ordered']>; | ||
readonly separator: NonNullable<List['separator']>; | ||
readonly unique: NonNullable<List['unique']>; | ||
constructor(value?: string, typeOptions?: ReadonlyDeep<TokenCollectionOptions>); | ||
constructor(value?: number); | ||
get value(): string; | ||
check(options?: { | ||
expects?: Expect[]; | ||
ref?: string; | ||
cache?: boolean; | ||
}): import('..').MatchedResult | UnmatchedResult; | ||
chunk(split: number): TokenCollection[]; | ||
compareTokens( | ||
callback: (prev: Readonly<Token>, current: Readonly<Token>) => Readonly<Token> | null | void, | ||
): Readonly<Token> | null | undefined; | ||
divide(position: number): readonly [TokenCollection, TokenCollection]; | ||
eachCheck(...callbacks: readonly TokenEachCheck[]): Result; | ||
filter(callback: Parameters<Array<Token>['filter']>[0]): TokenCollection; | ||
getConsecutiveToken(tokenType: number): Readonly<Token> | null; | ||
getDuplicated(): Token | null; | ||
getIdentTokens(): TokenCollection; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
has(value: TokenValue): boolean; | ||
headAndTail(): { | ||
head: Token | null; | ||
tail: TokenCollection; | ||
}; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
search(value: TokenValue): Token | null; | ||
takeTurns( | ||
tokenNumbers: ReadonlyArray<number>, | ||
lastTokenNumber?: number, | ||
): { | ||
unexpectedLastToken: boolean; | ||
expectedTokenNumber: number | undefined; | ||
token: Token; | ||
} | null; | ||
toJSON(): { | ||
type: number; | ||
value: string; | ||
offset: number; | ||
}[]; | ||
private static _new; | ||
} | ||
export {}; |
@@ -8,3 +8,4 @@ "use strict"; | ||
static fromPatterns(value, patterns, typeOptions) { | ||
const origin = typeof value === 'string' ? value : value.origin; | ||
var _c; | ||
const originalValue = typeof value === 'string' ? value : value.originalValue; | ||
let strings = typeof value === 'string' ? value : value.value; | ||
@@ -14,3 +15,3 @@ let cumulativeOffset = typeof value === 'string' ? 0 : value.offset; | ||
function addToken(tokenValue) { | ||
const token = new token_1.Token(tokenValue, cumulativeOffset, origin); | ||
const token = new token_1.Token(tokenValue, cumulativeOffset, originalValue); | ||
tokens.push(token); | ||
@@ -36,3 +37,3 @@ strings = strings.slice(tokenValue.length); | ||
else { | ||
value = res[0] || ''; | ||
value = (_c = res[0]) !== null && _c !== void 0 ? _c : ''; | ||
} | ||
@@ -57,10 +58,11 @@ } | ||
constructor(value, typeOptions) { | ||
var _c, _d, _e, _f, _g, _h; | ||
super(); | ||
this.disallowToSurroundBySpaces = (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.disallowToSurroundBySpaces) || false; | ||
this.allowEmpty = (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.allowEmpty) || true; | ||
this.ordered = (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.ordered) || false; | ||
this.unique = (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.unique) || false; | ||
this.caseInsensitive = (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.caseInsensitive) || true; | ||
this.disallowToSurroundBySpaces = (_c = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.disallowToSurroundBySpaces) !== null && _c !== void 0 ? _c : false; | ||
this.allowEmpty = (_d = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.allowEmpty) !== null && _d !== void 0 ? _d : true; | ||
this.ordered = (_e = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.ordered) !== null && _e !== void 0 ? _e : false; | ||
this.unique = (_f = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.unique) !== null && _f !== void 0 ? _f : false; | ||
this.caseInsensitive = (_g = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.caseInsensitive) !== null && _g !== void 0 ? _g : true; | ||
this.number = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.number; | ||
this.separator = (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.separator) || 'space'; | ||
this.separator = (_h = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.separator) !== null && _h !== void 0 ? _h : 'space'; | ||
if (typeof value === 'number') { | ||
@@ -77,8 +79,8 @@ this.length = value; | ||
} | ||
if (typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.specificSeparator) { | ||
if (Array.isArray(typeOptions.specificSeparator)) { | ||
separators.push(...typeOptions.specificSeparator); | ||
if ((typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.specificSeparator) != null) { | ||
if (typeof typeOptions.specificSeparator === 'string') { | ||
separators.push(typeOptions.specificSeparator); | ||
} | ||
else { | ||
separators.push(typeOptions.specificSeparator); | ||
separators.push(...typeOptions.specificSeparator); | ||
} | ||
@@ -96,4 +98,5 @@ } | ||
const lastChar = last[0]; | ||
if (!separators.includes(char) && | ||
!separators.includes(last[0]) && | ||
if (lastChar && | ||
!separators.includes(char) && | ||
!separators.includes(lastChar) && | ||
((token_1.Token.whitespace.includes(lastChar) && token_1.Token.whitespace.includes(char)) || | ||
@@ -199,3 +202,3 @@ (!token_1.Token.whitespace.includes(lastChar) && !token_1.Token.whitespace.includes(char)))) { | ||
const tokens = this.slice(); | ||
while (tokens.length) { | ||
while (tokens.length > 0) { | ||
const chunkTokens = tokens.splice(0, split); | ||
@@ -231,2 +234,3 @@ const chunk = TokenCollection._new(chunkTokens, this); | ||
eachCheck(...callbacks) { | ||
var _c, _d; | ||
let headAndTail = this.headAndTail(); | ||
@@ -244,6 +248,6 @@ let head = headAndTail.head; | ||
if (result && !result.matched) { | ||
passCount += result.passCount || 0; | ||
passCount += (_c = result.passCount) !== null && _c !== void 0 ? _c : 0; | ||
if (prev && result.offset === 0 && result.length === 0) { | ||
const { offset, line, column } = token_1.Token.shiftLocation(prev, cumulativeOffset); | ||
firstUnmatched = firstUnmatched || { | ||
firstUnmatched = firstUnmatched !== null && firstUnmatched !== void 0 ? firstUnmatched : { | ||
...result, | ||
@@ -256,3 +260,3 @@ offset, | ||
if (!prev && this.value.length === 0) { | ||
firstUnmatched = firstUnmatched || { | ||
firstUnmatched = firstUnmatched !== null && firstUnmatched !== void 0 ? firstUnmatched : { | ||
...result, | ||
@@ -274,3 +278,3 @@ reason: 'empty-token', | ||
} | ||
firstUnmatched = firstUnmatched || result; | ||
firstUnmatched = firstUnmatched !== null && firstUnmatched !== void 0 ? firstUnmatched : result; | ||
} | ||
@@ -285,3 +289,3 @@ else if (result && !firstUnmatched && result.matched) { | ||
} | ||
cumulativeOffset = (head === null || head === void 0 ? void 0 : head.length) || 0; | ||
cumulativeOffset = (_d = head === null || head === void 0 ? void 0 : head.length) !== null && _d !== void 0 ? _d : 0; | ||
headAndTail = tail.headAndTail(); | ||
@@ -310,3 +314,3 @@ prev = head; | ||
}); | ||
return resultToken || null; | ||
return resultToken !== null && resultToken !== void 0 ? resultToken : null; | ||
} | ||
@@ -348,3 +352,3 @@ getDuplicated() { | ||
if (!head) { | ||
return { head: head || null, tail: TokenCollection._new([], this) }; | ||
return { head: head !== null && head !== void 0 ? head : null, tail: TokenCollection._new([], this) }; | ||
} | ||
@@ -370,2 +374,5 @@ const tail = TokenCollection._new(copy, this); | ||
const token = tokens[i]; | ||
if (!token) { | ||
continue; | ||
} | ||
const expectedTokenNumber = tokenNumbers[i % tokenNumbers.length]; | ||
@@ -372,0 +379,0 @@ if (token.type !== expectedTokenNumber) { |
@@ -1,144 +0,166 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const token_collection_1 = require("./token-collection"); | ||
const _1 = require("."); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const token_collection_1 = require('./token-collection'); | ||
const _1 = require('.'); | ||
test('parse', () => { | ||
expect(new token_collection_1.TokenCollection(' a b c ').toJSON()).toStrictEqual([ | ||
{ | ||
offset: 0, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 1, | ||
type: 1, | ||
value: 'a', | ||
}, | ||
{ | ||
offset: 2, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 4, | ||
type: 1, | ||
value: 'b', | ||
}, | ||
{ | ||
offset: 5, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 8, | ||
type: 1, | ||
value: 'c', | ||
}, | ||
{ | ||
offset: 9, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
]); | ||
expect(new token_collection_1.TokenCollection(' a b c ').toJSON()).toStrictEqual([ | ||
{ | ||
offset: 0, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 1, | ||
type: 1, | ||
value: 'a', | ||
}, | ||
{ | ||
offset: 2, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 4, | ||
type: 1, | ||
value: 'b', | ||
}, | ||
{ | ||
offset: 5, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 8, | ||
type: 1, | ||
value: 'c', | ||
}, | ||
{ | ||
offset: 9, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
]); | ||
}); | ||
test('parse comma separator', () => { | ||
expect(new token_collection_1.TokenCollection('a,, ,b,cde', { separator: 'comma' }).toJSON()).toStrictEqual([ | ||
{ | ||
offset: 0, | ||
type: 1, | ||
value: 'a', | ||
}, | ||
{ | ||
offset: 1, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 2, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 3, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 4, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 5, | ||
type: 1, | ||
value: 'b', | ||
}, | ||
{ | ||
offset: 6, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 7, | ||
type: 1, | ||
value: 'cde', | ||
}, | ||
]); | ||
expect(new token_collection_1.TokenCollection('a,, ,b,cde', { separator: 'comma' }).toJSON()).toStrictEqual([ | ||
{ | ||
offset: 0, | ||
type: 1, | ||
value: 'a', | ||
}, | ||
{ | ||
offset: 1, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 2, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 3, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 4, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 5, | ||
type: 1, | ||
value: 'b', | ||
}, | ||
{ | ||
offset: 6, | ||
type: 18, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 7, | ||
type: 1, | ||
value: 'cde', | ||
}, | ||
]); | ||
}); | ||
test('A comma is an ident if the comma is not a separator', () => { | ||
expect(new token_collection_1.TokenCollection('a ,cde , f').toJSON()).toStrictEqual([ | ||
{ | ||
offset: 0, | ||
type: 1, | ||
value: 'a', | ||
}, | ||
{ | ||
offset: 1, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 2, | ||
type: 1, | ||
value: ',cde', | ||
}, | ||
{ | ||
offset: 6, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 7, | ||
type: 1, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 8, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 9, | ||
type: 1, | ||
value: 'f', | ||
}, | ||
]); | ||
expect(new token_collection_1.TokenCollection('a ,cde , f').toJSON()).toStrictEqual([ | ||
{ | ||
offset: 0, | ||
type: 1, | ||
value: 'a', | ||
}, | ||
{ | ||
offset: 1, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 2, | ||
type: 1, | ||
value: ',cde', | ||
}, | ||
{ | ||
offset: 6, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 7, | ||
type: 1, | ||
value: ',', | ||
}, | ||
{ | ||
offset: 8, | ||
type: 13, | ||
value: ' ', | ||
}, | ||
{ | ||
offset: 9, | ||
type: 1, | ||
value: 'f', | ||
}, | ||
]); | ||
}); | ||
test('getConsecutiveToken', () => { | ||
var _a; | ||
expect(new token_collection_1.TokenCollection('a,b,c', { separator: 'comma' }).getConsecutiveToken(_1.Token.Comma)).toBeFalsy(); | ||
expect(new token_collection_1.TokenCollection('a,,b', { separator: 'comma' }).getConsecutiveToken(_1.Token.Comma)).toBeTruthy(); | ||
expect((_a = new token_collection_1.TokenCollection('a,,b', { separator: 'comma' }).getConsecutiveToken(_1.Token.Comma)) === null || _a === void 0 ? void 0 : _a.offset).toBe(2); | ||
let _a; | ||
expect( | ||
new token_collection_1.TokenCollection('a,b,c', { separator: 'comma' }).getConsecutiveToken(_1.Token.Comma), | ||
).toBeFalsy(); | ||
expect( | ||
new token_collection_1.TokenCollection('a,,b', { separator: 'comma' }).getConsecutiveToken(_1.Token.Comma), | ||
).toBeTruthy(); | ||
expect( | ||
(_a = new token_collection_1.TokenCollection('a,,b', { separator: 'comma' }).getConsecutiveToken( | ||
_1.Token.Comma, | ||
)) === null || _a === void 0 | ||
? void 0 | ||
: _a.offset, | ||
).toBe(2); | ||
}); | ||
test('fromPatterns', () => { | ||
const patterns = [/\+|-/, /[0-9]{2}/, /:?/, /[0-9]{2}/]; | ||
expect(token_collection_1.TokenCollection.fromPatterns('+00:00', patterns).map(t => t.value)).toStrictEqual(['+', '00', ':', '00']); | ||
expect(token_collection_1.TokenCollection.fromPatterns('+0000', patterns).map(t => t.value)).toStrictEqual(['+', '00', '', '00']); | ||
expect(token_collection_1.TokenCollection.fromPatterns('+00/00', patterns).map(t => t.value)).toStrictEqual([ | ||
'+', | ||
'00', | ||
'', | ||
'', | ||
'/00', | ||
]); | ||
const patterns = [/\+|-/, /[0-9]{2}/, /:?/, /[0-9]{2}/]; | ||
expect(token_collection_1.TokenCollection.fromPatterns('+00:00', patterns).map(t => t.value)).toStrictEqual([ | ||
'+', | ||
'00', | ||
':', | ||
'00', | ||
]); | ||
expect(token_collection_1.TokenCollection.fromPatterns('+0000', patterns).map(t => t.value)).toStrictEqual([ | ||
'+', | ||
'00', | ||
'', | ||
'00', | ||
]); | ||
expect(token_collection_1.TokenCollection.fromPatterns('+00/00', patterns).map(t => t.value)).toStrictEqual([ | ||
'+', | ||
'00', | ||
'', | ||
'', | ||
'/00', | ||
]); | ||
}); |
@@ -0,55 +1,61 @@ | ||
import type { TokenValue } from './types'; | ||
import type { UnmatchedResult, UnmatchedResultOptions, UnmatchedResultReason } from '../types'; | ||
export declare class Token { | ||
#private; | ||
/** | ||
* @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js | ||
*/ | ||
static readonly Comma = 18; | ||
static readonly Ident = 1; | ||
static readonly WhiteSpace = 13; | ||
/** | ||
* ASCII whitespace is | ||
* - U+0009 TAB | ||
* - U+000A LF | ||
* - U+000C FF | ||
* - U+000D CR | ||
* - U+0020 SPACE. | ||
* | ||
* @see https://infra.spec.whatwg.org/#ascii-whitespace | ||
*/ | ||
static readonly whitespace: ReadonlyArray<string>; | ||
static getCol(value: string, offset: number): number; | ||
static getLine(value: string, offset: number): number; | ||
static getType(value: string, separators?: string[]): 1 | 13 | 18; | ||
static shiftLocation(token: Token, offset: number): { | ||
offset: number; | ||
line: number; | ||
column: number; | ||
}; | ||
readonly offset: number; | ||
readonly type: number; | ||
readonly value: string; | ||
constructor(value: string, offset: number, originalValue: string, separators?: string[]); | ||
get length(): number; | ||
get origin(): string; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
includes(value: string | RegExp | number | (string | RegExp | number)[], caseInsensitive?: boolean): boolean; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
match(value: string | RegExp | number | (string | RegExp | number)[], caseInsensitive?: boolean): boolean; | ||
toJSON(): { | ||
type: number; | ||
value: string; | ||
offset: number; | ||
}; | ||
toNumber(): number; | ||
unmatched(options?: UnmatchedResultOptions & { | ||
ref?: string; | ||
reason?: UnmatchedResultReason; | ||
}): UnmatchedResult; | ||
/** | ||
* @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js | ||
*/ | ||
static readonly Comma = 18; | ||
static readonly Ident = 1; | ||
static readonly WhiteSpace = 13; | ||
/** | ||
* ASCII whitespace is | ||
* - U+0009 TAB | ||
* - U+000A LF | ||
* - U+000C FF | ||
* - U+000D CR | ||
* - U+0020 SPACE. | ||
* | ||
* @see https://infra.spec.whatwg.org/#ascii-whitespace | ||
*/ | ||
static readonly whitespace: ReadonlyArray<string>; | ||
static getCol(value: string, offset: number): number; | ||
static getLine(value: string, offset: number): number; | ||
static getType(value: string, separators?: readonly string[]): 1 | 13 | 18; | ||
static shiftLocation( | ||
token: Readonly<Token>, | ||
offset: number, | ||
): { | ||
offset: number; | ||
line: number; | ||
column: number; | ||
}; | ||
readonly offset: number; | ||
readonly originalValue: string; | ||
readonly type: number; | ||
readonly value: string; | ||
constructor(value: string, offset: number, originalValue: string, separators?: readonly string[]); | ||
get length(): number; | ||
clone(): Token; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
includes(value: TokenValue, caseInsensitive?: boolean): boolean; | ||
/** | ||
* | ||
* @param value The token value or the token type or its list | ||
*/ | ||
match(value: TokenValue, caseInsensitive?: boolean): boolean; | ||
toJSON(): { | ||
type: number; | ||
value: string; | ||
offset: number; | ||
}; | ||
toNumber(): number; | ||
unmatched( | ||
options?: UnmatchedResultOptions & { | ||
readonly ref?: string; | ||
readonly reason?: UnmatchedResultReason; | ||
}, | ||
): UnmatchedResult; | ||
} |
"use strict"; | ||
var _Token_originalValue; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Token = void 0; | ||
const tslib_1 = require("tslib"); | ||
class Token { | ||
static getCol(value, offset) { | ||
var _a; | ||
const lines = value.slice(0, offset).split(/\n/g); | ||
return lines[lines.length - 1].length + 1; | ||
return ((_a = lines[lines.length - 1]) !== null && _a !== void 0 ? _a : '').length + 1; | ||
} | ||
@@ -15,6 +14,7 @@ static getLine(value, offset) { | ||
static getType(value, separators) { | ||
if (Token.whitespace.includes(value[0])) { | ||
var _a, _b; | ||
if (Token.whitespace.includes((_a = value[0]) !== null && _a !== void 0 ? _a : '')) { | ||
return Token.WhiteSpace; | ||
} | ||
if (separators === null || separators === void 0 ? void 0 : separators.includes(value[0])) { | ||
if (separators === null || separators === void 0 ? void 0 : separators.includes((_b = value[0]) !== null && _b !== void 0 ? _b : '')) { | ||
switch (value[0]) { | ||
@@ -31,12 +31,11 @@ case ',': | ||
offset: shifted, | ||
line: Token.getLine(tslib_1.__classPrivateFieldGet(token, _Token_originalValue, "f"), shifted), | ||
column: Token.getCol(tslib_1.__classPrivateFieldGet(token, _Token_originalValue, "f"), shifted), | ||
line: Token.getLine(token.originalValue, shifted), | ||
column: Token.getCol(token.originalValue, shifted), | ||
}; | ||
} | ||
constructor(value, offset, originalValue, separators) { | ||
_Token_originalValue.set(this, void 0); | ||
this.type = Token.getType(value, separators); | ||
this.value = value; | ||
this.offset = offset; | ||
tslib_1.__classPrivateFieldSet(this, _Token_originalValue, originalValue, "f"); | ||
this.originalValue = originalValue; | ||
} | ||
@@ -46,4 +45,4 @@ get length() { | ||
} | ||
get origin() { | ||
return tslib_1.__classPrivateFieldGet(this, _Token_originalValue, "f"); | ||
clone() { | ||
return new Token(this.value, this.offset, this.originalValue); | ||
} | ||
@@ -61,3 +60,3 @@ /** | ||
const b = caseInsensitive ? value.toLowerCase() : value; | ||
return a.indexOf(b) !== -1; | ||
return a.includes(b); | ||
} | ||
@@ -97,21 +96,20 @@ if (value instanceof RegExp) { | ||
toNumber() { | ||
return parseFloat(this.value); | ||
const num = parseFloat(this.value); | ||
return isNaN(num) ? 0 : num; | ||
} | ||
unmatched(options) { | ||
var _a; | ||
var _a, _b; | ||
return { | ||
...options, | ||
matched: false, | ||
ref: (options === null || options === void 0 ? void 0 : options.ref) || null, | ||
ref: (_a = options === null || options === void 0 ? void 0 : options.ref) !== null && _a !== void 0 ? _a : null, | ||
raw: this.value, | ||
offset: this.offset, | ||
length: this.value.length, | ||
line: Token.getLine(tslib_1.__classPrivateFieldGet(this, _Token_originalValue, "f"), this.offset), | ||
column: Token.getCol(tslib_1.__classPrivateFieldGet(this, _Token_originalValue, "f"), this.offset), | ||
reason: (_a = options === null || options === void 0 ? void 0 : options.reason) !== null && _a !== void 0 ? _a : 'syntax-error', | ||
line: Token.getLine(this.originalValue, this.offset), | ||
column: Token.getCol(this.originalValue, this.offset), | ||
reason: (_b = options === null || options === void 0 ? void 0 : options.reason) !== null && _b !== void 0 ? _b : 'syntax-error', | ||
}; | ||
} | ||
} | ||
exports.Token = Token; | ||
_Token_originalValue = new WeakMap(); | ||
/** | ||
@@ -134,1 +132,2 @@ * @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js | ||
Token.whitespace = ['\u0009', '\u000A', '\u000C', '\u000D', '\u0020']; | ||
exports.Token = Token; |
@@ -5,39 +5,59 @@ import type { cssSyntaxMatch } from './css-syntax'; | ||
export type UnmatchedResult = { | ||
matched: false; | ||
ref: string | null; | ||
raw: string; | ||
length: number; | ||
offset: number; | ||
line: number; | ||
column: number; | ||
reason: UnmatchedResultReason; | ||
passCount?: number; | ||
readonly matched: false; | ||
readonly ref: string | null; | ||
readonly raw: string; | ||
readonly length: number; | ||
readonly offset: number; | ||
readonly line: number; | ||
readonly column: number; | ||
readonly reason: UnmatchedResultReason; | ||
readonly passCount?: number; | ||
} & UnmatchedResultOptions; | ||
export type UnmatchedResultOptions = { | ||
partName?: string; | ||
expects?: Expect[]; | ||
extra?: Expect; | ||
candidate?: string; | ||
readonly partName?: string; | ||
readonly expects?: readonly Expect[]; | ||
readonly extra?: Expect; | ||
readonly candidate?: string; | ||
}; | ||
export type UnmatchedResultReason = 'syntax-error' | 'typo' | 'missing-token' | 'missing-comma' | 'unexpected-token' | 'unexpected-space' | 'unexpected-newline' | 'unexpected-comma' | 'empty-token' | 'out-of-range' | 'doesnt-exist-in-enum' | 'duplicated' | 'illegal-combination' | 'illegal-order' | 'extra-token' | 'must-be-percent-encoded' | 'must-be-serialized' | { | ||
type: 'out-of-range'; | ||
gt?: number; | ||
gte?: number; | ||
lt?: number; | ||
lte?: number; | ||
} | { | ||
type: 'out-of-range-length-char'; | ||
gte: number; | ||
lte?: number; | ||
} | { | ||
type: 'out-of-range-length-digit'; | ||
gte: number; | ||
lte?: number; | ||
}; | ||
export type UnmatchedResultReason = | ||
| 'syntax-error' | ||
| 'typo' | ||
| 'missing-token' | ||
| 'missing-comma' | ||
| 'unexpected-token' | ||
| 'unexpected-space' | ||
| 'unexpected-newline' | ||
| 'unexpected-comma' | ||
| 'empty-token' | ||
| 'out-of-range' | ||
| 'doesnt-exist-in-enum' | ||
| 'duplicated' | ||
| 'illegal-combination' | ||
| 'illegal-order' | ||
| 'extra-token' | ||
| 'must-be-percent-encoded' | ||
| 'must-be-serialized' | ||
| { | ||
readonly type: 'out-of-range'; | ||
readonly gt?: number; | ||
readonly gte?: number; | ||
readonly lt?: number; | ||
readonly lte?: number; | ||
} | ||
| { | ||
readonly type: 'out-of-range-length-char'; | ||
readonly gte: number; | ||
readonly lte?: number; | ||
} | ||
| { | ||
readonly type: 'out-of-range-length-digit'; | ||
readonly gte: number; | ||
readonly lte?: number; | ||
}; | ||
export type MatchedResult = { | ||
matched: true; | ||
readonly matched: true; | ||
}; | ||
export type Expect = { | ||
type: 'const' | 'format' | 'syntax' | 'regexp' | 'common'; | ||
value: string; | ||
readonly type: 'const' | 'format' | 'syntax' | 'regexp' | 'common'; | ||
readonly value: string; | ||
}; | ||
@@ -48,5 +68,5 @@ export type FormattedPrimitiveTypeCheck = (value: string) => boolean; | ||
export type CustomSyntax = { | ||
ref: string; | ||
expects?: Expect[]; | ||
is: CustomSyntaxCheck; | ||
readonly ref: string; | ||
readonly expects?: readonly Expect[]; | ||
readonly is: CustomSyntaxCheck; | ||
}; | ||
@@ -56,26 +76,30 @@ export type CustomSyntaxCheck = (value: string) => Result; | ||
export type CustomCssSyntax = { | ||
ref: string; | ||
caseSensitive?: boolean; | ||
expects?: Expect[]; | ||
syntax: { | ||
apply: `<${string}>`; | ||
def: Record<string, string | CssSyntaxTokenizer>; | ||
/** | ||
* @deprecated | ||
*/ | ||
ebnf?: Record<string, string | string[]>; | ||
/** | ||
* @deprecated | ||
*/ | ||
properties?: Record<string, string>; | ||
}; | ||
readonly ref: string; | ||
readonly caseSensitive?: boolean; | ||
readonly expects?: readonly Expect[]; | ||
readonly syntax: { | ||
readonly apply: `<${string}>`; | ||
readonly def: Readonly<Record<string, string | CssSyntaxTokenizer>>; | ||
/** | ||
* @deprecated | ||
*/ | ||
readonly ebnf?: Readonly<Record<string, string | readonly string[]>>; | ||
/** | ||
* @deprecated | ||
*/ | ||
readonly properties?: Readonly<Record<string, string>>; | ||
}; | ||
}; | ||
export type CSSSyntaxToken = { | ||
type: number; | ||
value: string; | ||
index: number; | ||
balance: number; | ||
node?: any; | ||
readonly type: number; | ||
readonly value: string; | ||
readonly index: number; | ||
readonly balance: number; | ||
readonly node?: any; | ||
}; | ||
export type CssSyntaxTokenizer = (token: CSSSyntaxToken | null, getNextToken: GetNextToken, match: typeof cssSyntaxMatch) => number; | ||
export type CssSyntaxTokenizer = ( | ||
token: Readonly<CSSSyntaxToken> | null, | ||
getNextToken: GetNextToken, | ||
match: typeof cssSyntaxMatch, | ||
) => number; | ||
export type GetNextToken = (length: number) => CSSSyntaxToken | null; |
@@ -8,7 +8,1058 @@ /** | ||
export type KeywordDefinedType = CssSyntax | ExtendedType | HtmlAttrRequirement; | ||
export type CssSyntax = "<'--*'>" | "<'-moz-appearance'>" | "<'-moz-background-clip'>" | "<'-moz-binding'>" | "<'-moz-border-bottom-colors'>" | "<'-moz-border-left-colors'>" | "<'-moz-border-radius-bottomleft'>" | "<'-moz-border-radius-bottomright'>" | "<'-moz-border-radius-topleft'>" | "<'-moz-border-radius-topright'>" | "<'-moz-border-right-colors'>" | "<'-moz-border-top-colors'>" | "<'-moz-context-properties'>" | "<'-moz-control-character-visibility'>" | "<'-moz-float-edge'>" | "<'-moz-force-broken-image-icon'>" | "<'-moz-image-region'>" | "<'-moz-orient'>" | "<'-moz-osx-font-smoothing'>" | "<'-moz-outline-radius'>" | "<'-moz-outline-radius-bottomleft'>" | "<'-moz-outline-radius-bottomright'>" | "<'-moz-outline-radius-topleft'>" | "<'-moz-outline-radius-topright'>" | "<'-moz-stack-sizing'>" | "<'-moz-text-blink'>" | "<'-moz-user-focus'>" | "<'-moz-user-input'>" | "<'-moz-user-modify'>" | "<'-moz-user-select'>" | "<'-moz-window-dragging'>" | "<'-moz-window-shadow'>" | "<'-ms-accelerator'>" | "<'-ms-block-progression'>" | "<'-ms-content-zoom-chaining'>" | "<'-ms-content-zoom-limit'>" | "<'-ms-content-zoom-limit-max'>" | "<'-ms-content-zoom-limit-min'>" | "<'-ms-content-zoom-snap'>" | "<'-ms-content-zoom-snap-points'>" | "<'-ms-content-zoom-snap-type'>" | "<'-ms-content-zooming'>" | "<'-ms-filter'>" | "<'-ms-flex-align'>" | "<'-ms-flex-item-align'>" | "<'-ms-flex-line-pack'>" | "<'-ms-flex-negative'>" | "<'-ms-flex-order'>" | "<'-ms-flex-pack'>" | "<'-ms-flex-positive'>" | "<'-ms-flex-preferred-size'>" | "<'-ms-flow-from'>" | "<'-ms-flow-into'>" | "<'-ms-grid-column-align'>" | "<'-ms-grid-columns'>" | "<'-ms-grid-row-align'>" | "<'-ms-grid-rows'>" | "<'-ms-high-contrast-adjust'>" | "<'-ms-hyphenate-limit-chars'>" | "<'-ms-hyphenate-limit-last'>" | "<'-ms-hyphenate-limit-lines'>" | "<'-ms-hyphenate-limit-zone'>" | "<'-ms-ime-align'>" | "<'-ms-interpolation-mode'>" | "<'-ms-overflow-style'>" | "<'-ms-scroll-chaining'>" | "<'-ms-scroll-limit'>" | "<'-ms-scroll-limit-x-max'>" | "<'-ms-scroll-limit-x-min'>" | "<'-ms-scroll-limit-y-max'>" | "<'-ms-scroll-limit-y-min'>" | "<'-ms-scroll-rails'>" | "<'-ms-scroll-snap-points-x'>" | "<'-ms-scroll-snap-points-y'>" | "<'-ms-scroll-snap-type'>" | "<'-ms-scroll-snap-x'>" | "<'-ms-scroll-snap-y'>" | "<'-ms-scroll-translation'>" | "<'-ms-scrollbar-3dlight-color'>" | "<'-ms-scrollbar-arrow-color'>" | "<'-ms-scrollbar-base-color'>" | "<'-ms-scrollbar-darkshadow-color'>" | "<'-ms-scrollbar-face-color'>" | "<'-ms-scrollbar-highlight-color'>" | "<'-ms-scrollbar-shadow-color'>" | "<'-ms-scrollbar-track-color'>" | "<'-ms-text-autospace'>" | "<'-ms-touch-select'>" | "<'-ms-user-select'>" | "<'-ms-wrap-flow'>" | "<'-ms-wrap-margin'>" | "<'-ms-wrap-through'>" | "<'-webkit-appearance'>" | "<'-webkit-background-clip'>" | "<'-webkit-border-before'>" | "<'-webkit-border-before-color'>" | "<'-webkit-border-before-style'>" | "<'-webkit-border-before-width'>" | "<'-webkit-box-reflect'>" | "<'-webkit-column-break-after'>" | "<'-webkit-column-break-before'>" | "<'-webkit-column-break-inside'>" | "<'-webkit-font-smoothing'>" | "<'-webkit-line-clamp'>" | "<'-webkit-mask'>" | "<'-webkit-mask-attachment'>" | "<'-webkit-mask-box-image'>" | "<'-webkit-mask-clip'>" | "<'-webkit-mask-composite'>" | "<'-webkit-mask-image'>" | "<'-webkit-mask-origin'>" | "<'-webkit-mask-position'>" | "<'-webkit-mask-position-x'>" | "<'-webkit-mask-position-y'>" | "<'-webkit-mask-repeat'>" | "<'-webkit-mask-repeat-x'>" | "<'-webkit-mask-repeat-y'>" | "<'-webkit-mask-size'>" | "<'-webkit-overflow-scrolling'>" | "<'-webkit-print-color-adjust'>" | "<'-webkit-tap-highlight-color'>" | "<'-webkit-text-fill-color'>" | "<'-webkit-text-security'>" | "<'-webkit-text-stroke'>" | "<'-webkit-text-stroke-color'>" | "<'-webkit-text-stroke-width'>" | "<'-webkit-touch-callout'>" | "<'-webkit-user-drag'>" | "<'-webkit-user-modify'>" | "<'-webkit-user-select'>" | "<'accent-color'>" | "<'align-content'>" | "<'align-items'>" | "<'align-self'>" | "<'align-tracks'>" | "<'alignment-baseline'>" | "<'all'>" | "<'animation'>" | "<'animation-composition'>" | "<'animation-delay'>" | "<'animation-direction'>" | "<'animation-duration'>" | "<'animation-fill-mode'>" | "<'animation-iteration-count'>" | "<'animation-name'>" | "<'animation-play-state'>" | "<'animation-timeline'>" | "<'animation-timing-function'>" | "<'appearance'>" | "<'aspect-ratio'>" | "<'azimuth'>" | "<'backdrop-filter'>" | "<'backface-visibility'>" | "<'background'>" | "<'background-attachment'>" | "<'background-blend-mode'>" | "<'background-clip'>" | "<'background-color'>" | "<'background-image'>" | "<'background-origin'>" | "<'background-position'>" | "<'background-position-x'>" | "<'background-position-y'>" | "<'background-repeat'>" | "<'background-size'>" | "<'baseline-shift'>" | "<'behavior'>" | "<'block-overflow'>" | "<'block-size'>" | "<'border'>" | "<'border-block'>" | "<'border-block-color'>" | "<'border-block-end'>" | "<'border-block-end-color'>" | "<'border-block-end-style'>" | "<'border-block-end-width'>" | "<'border-block-start'>" | "<'border-block-start-color'>" | "<'border-block-start-style'>" | "<'border-block-start-width'>" | "<'border-block-style'>" | "<'border-block-width'>" | "<'border-bottom'>" | "<'border-bottom-color'>" | "<'border-bottom-left-radius'>" | "<'border-bottom-right-radius'>" | "<'border-bottom-style'>" | "<'border-bottom-width'>" | "<'border-collapse'>" | "<'border-color'>" | "<'border-end-end-radius'>" | "<'border-end-start-radius'>" | "<'border-image'>" | "<'border-image-outset'>" | "<'border-image-repeat'>" | "<'border-image-slice'>" | "<'border-image-source'>" | "<'border-image-width'>" | "<'border-inline'>" | "<'border-inline-color'>" | "<'border-inline-end'>" | "<'border-inline-end-color'>" | "<'border-inline-end-style'>" | "<'border-inline-end-width'>" | "<'border-inline-start'>" | "<'border-inline-start-color'>" | "<'border-inline-start-style'>" | "<'border-inline-start-width'>" | "<'border-inline-style'>" | "<'border-inline-width'>" | "<'border-left'>" | "<'border-left-color'>" | "<'border-left-style'>" | "<'border-left-width'>" | "<'border-radius'>" | "<'border-right'>" | "<'border-right-color'>" | "<'border-right-style'>" | "<'border-right-width'>" | "<'border-spacing'>" | "<'border-start-end-radius'>" | "<'border-start-start-radius'>" | "<'border-style'>" | "<'border-top'>" | "<'border-top-color'>" | "<'border-top-left-radius'>" | "<'border-top-right-radius'>" | "<'border-top-style'>" | "<'border-top-width'>" | "<'border-width'>" | "<'bottom'>" | "<'box-align'>" | "<'box-decoration-break'>" | "<'box-direction'>" | "<'box-flex'>" | "<'box-flex-group'>" | "<'box-lines'>" | "<'box-ordinal-group'>" | "<'box-orient'>" | "<'box-pack'>" | "<'box-shadow'>" | "<'box-sizing'>" | "<'break-after'>" | "<'break-before'>" | "<'break-inside'>" | "<'caption-side'>" | "<'caret'>" | "<'caret-color'>" | "<'caret-shape'>" | "<'clear'>" | "<'clip'>" | "<'clip-path'>" | "<'clip-rule'>" | "<'color'>" | "<'color-scheme'>" | "<'column-count'>" | "<'column-fill'>" | "<'column-gap'>" | "<'column-rule'>" | "<'column-rule-color'>" | "<'column-rule-style'>" | "<'column-rule-width'>" | "<'column-span'>" | "<'column-width'>" | "<'columns'>" | "<'contain'>" | "<'contain-intrinsic-block-size'>" | "<'contain-intrinsic-height'>" | "<'contain-intrinsic-inline-size'>" | "<'contain-intrinsic-size'>" | "<'contain-intrinsic-width'>" | "<'content'>" | "<'content-visibility'>" | "<'counter-increment'>" | "<'counter-reset'>" | "<'counter-set'>" | "<'cue'>" | "<'cue-after'>" | "<'cue-before'>" | "<'cursor'>" | "<'direction'>" | "<'display'>" | "<'dominant-baseline'>" | "<'empty-cells'>" | "<'fill'>" | "<'fill-opacity'>" | "<'fill-rule'>" | "<'filter'>" | "<'flex'>" | "<'flex-basis'>" | "<'flex-direction'>" | "<'flex-flow'>" | "<'flex-grow'>" | "<'flex-shrink'>" | "<'flex-wrap'>" | "<'float'>" | "<'font'>" | "<'font-family'>" | "<'font-feature-settings'>" | "<'font-kerning'>" | "<'font-language-override'>" | "<'font-optical-sizing'>" | "<'font-size'>" | "<'font-size-adjust'>" | "<'font-smooth'>" | "<'font-stretch'>" | "<'font-style'>" | "<'font-synthesis'>" | "<'font-variant'>" | "<'font-variant-alternates'>" | "<'font-variant-caps'>" | "<'font-variant-east-asian'>" | "<'font-variant-ligatures'>" | "<'font-variant-numeric'>" | "<'font-variant-position'>" | "<'font-variation-settings'>" | "<'font-weight'>" | "<'forced-color-adjust'>" | "<'gap'>" | "<'glyph-orientation-horizontal'>" | "<'glyph-orientation-vertical'>" | "<'grid'>" | "<'grid-area'>" | "<'grid-auto-columns'>" | "<'grid-auto-flow'>" | "<'grid-auto-rows'>" | "<'grid-column'>" | "<'grid-column-end'>" | "<'grid-column-gap'>" | "<'grid-column-start'>" | "<'grid-gap'>" | "<'grid-row'>" | "<'grid-row-end'>" | "<'grid-row-gap'>" | "<'grid-row-start'>" | "<'grid-template'>" | "<'grid-template-areas'>" | "<'grid-template-columns'>" | "<'grid-template-rows'>" | "<'hanging-punctuation'>" | "<'height'>" | "<'hyphenate-character'>" | "<'hyphens'>" | "<'image-orientation'>" | "<'image-rendering'>" | "<'image-resolution'>" | "<'ime-mode'>" | "<'initial-letter'>" | "<'initial-letter-align'>" | "<'inline-size'>" | "<'input-security'>" | "<'inset'>" | "<'inset-block'>" | "<'inset-block-end'>" | "<'inset-block-start'>" | "<'inset-inline'>" | "<'inset-inline-end'>" | "<'inset-inline-start'>" | "<'isolation'>" | "<'justify-content'>" | "<'justify-items'>" | "<'justify-self'>" | "<'justify-tracks'>" | "<'kerning'>" | "<'left'>" | "<'letter-spacing'>" | "<'line-break'>" | "<'line-clamp'>" | "<'line-height'>" | "<'line-height-step'>" | "<'list-style'>" | "<'list-style-image'>" | "<'list-style-position'>" | "<'list-style-type'>" | "<'margin'>" | "<'margin-block'>" | "<'margin-block-end'>" | "<'margin-block-start'>" | "<'margin-bottom'>" | "<'margin-inline'>" | "<'margin-inline-end'>" | "<'margin-inline-start'>" | "<'margin-left'>" | "<'margin-right'>" | "<'margin-top'>" | "<'margin-trim'>" | "<'marker'>" | "<'marker-end'>" | "<'marker-mid'>" | "<'marker-start'>" | "<'mask'>" | "<'mask-border'>" | "<'mask-border-mode'>" | "<'mask-border-outset'>" | "<'mask-border-repeat'>" | "<'mask-border-slice'>" | "<'mask-border-source'>" | "<'mask-border-width'>" | "<'mask-clip'>" | "<'mask-composite'>" | "<'mask-image'>" | "<'mask-mode'>" | "<'mask-origin'>" | "<'mask-position'>" | "<'mask-repeat'>" | "<'mask-size'>" | "<'mask-type'>" | "<'masonry-auto-flow'>" | "<'math-depth'>" | "<'math-shift'>" | "<'math-style'>" | "<'max-block-size'>" | "<'max-height'>" | "<'max-inline-size'>" | "<'max-lines'>" | "<'max-width'>" | "<'min-block-size'>" | "<'min-height'>" | "<'min-inline-size'>" | "<'min-width'>" | "<'mix-blend-mode'>" | "<'object-fit'>" | "<'object-position'>" | "<'offset'>" | "<'offset-anchor'>" | "<'offset-distance'>" | "<'offset-path'>" | "<'offset-position'>" | "<'offset-rotate'>" | "<'opacity'>" | "<'order'>" | "<'orphans'>" | "<'outline'>" | "<'outline-color'>" | "<'outline-offset'>" | "<'outline-style'>" | "<'outline-width'>" | "<'overflow'>" | "<'overflow-anchor'>" | "<'overflow-block'>" | "<'overflow-clip-box'>" | "<'overflow-clip-margin'>" | "<'overflow-inline'>" | "<'overflow-wrap'>" | "<'overflow-x'>" | "<'overflow-y'>" | "<'overscroll-behavior'>" | "<'overscroll-behavior-block'>" | "<'overscroll-behavior-inline'>" | "<'overscroll-behavior-x'>" | "<'overscroll-behavior-y'>" | "<'padding'>" | "<'padding-block'>" | "<'padding-block-end'>" | "<'padding-block-start'>" | "<'padding-bottom'>" | "<'padding-inline'>" | "<'padding-inline-end'>" | "<'padding-inline-start'>" | "<'padding-left'>" | "<'padding-right'>" | "<'padding-top'>" | "<'page-break-after'>" | "<'page-break-before'>" | "<'page-break-inside'>" | "<'paint-order'>" | "<'pause'>" | "<'pause-after'>" | "<'pause-before'>" | "<'perspective'>" | "<'perspective-origin'>" | "<'place-content'>" | "<'place-items'>" | "<'place-self'>" | "<'pointer-events'>" | "<'position'>" | "<'print-color-adjust'>" | "<'quotes'>" | "<'resize'>" | "<'rest'>" | "<'rest-after'>" | "<'rest-before'>" | "<'right'>" | "<'rotate'>" | "<'row-gap'>" | "<'ruby-align'>" | "<'ruby-merge'>" | "<'ruby-position'>" | "<'scale'>" | "<'scroll-behavior'>" | "<'scroll-margin'>" | "<'scroll-margin-block'>" | "<'scroll-margin-block-end'>" | "<'scroll-margin-block-start'>" | "<'scroll-margin-bottom'>" | "<'scroll-margin-inline'>" | "<'scroll-margin-inline-end'>" | "<'scroll-margin-inline-start'>" | "<'scroll-margin-left'>" | "<'scroll-margin-right'>" | "<'scroll-margin-top'>" | "<'scroll-padding'>" | "<'scroll-padding-block'>" | "<'scroll-padding-block-end'>" | "<'scroll-padding-block-start'>" | "<'scroll-padding-bottom'>" | "<'scroll-padding-inline'>" | "<'scroll-padding-inline-end'>" | "<'scroll-padding-inline-start'>" | "<'scroll-padding-left'>" | "<'scroll-padding-right'>" | "<'scroll-padding-top'>" | "<'scroll-snap-align'>" | "<'scroll-snap-coordinate'>" | "<'scroll-snap-destination'>" | "<'scroll-snap-points-x'>" | "<'scroll-snap-points-y'>" | "<'scroll-snap-stop'>" | "<'scroll-snap-type'>" | "<'scroll-snap-type-x'>" | "<'scroll-snap-type-y'>" | "<'scroll-timeline'>" | "<'scroll-timeline-axis'>" | "<'scroll-timeline-name'>" | "<'scrollbar-color'>" | "<'scrollbar-gutter'>" | "<'scrollbar-width'>" | "<'shape-image-threshold'>" | "<'shape-margin'>" | "<'shape-outside'>" | "<'shape-rendering'>" | "<'speak'>" | "<'speak-as'>" | "<'src'>" | "<'stroke'>" | "<'stroke-dasharray'>" | "<'stroke-dashoffset'>" | "<'stroke-linecap'>" | "<'stroke-linejoin'>" | "<'stroke-miterlimit'>" | "<'stroke-opacity'>" | "<'stroke-width'>" | "<'tab-size'>" | "<'table-layout'>" | "<'text-align'>" | "<'text-align-last'>" | "<'text-anchor'>" | "<'text-combine-upright'>" | "<'text-decoration'>" | "<'text-decoration-color'>" | "<'text-decoration-line'>" | "<'text-decoration-skip'>" | "<'text-decoration-skip-ink'>" | "<'text-decoration-style'>" | "<'text-decoration-thickness'>" | "<'text-emphasis'>" | "<'text-emphasis-color'>" | "<'text-emphasis-position'>" | "<'text-emphasis-style'>" | "<'text-indent'>" | "<'text-justify'>" | "<'text-orientation'>" | "<'text-overflow'>" | "<'text-rendering'>" | "<'text-shadow'>" | "<'text-size-adjust'>" | "<'text-transform'>" | "<'text-underline-offset'>" | "<'text-underline-position'>" | "<'top'>" | "<'touch-action'>" | "<'transform'>" | "<'transform-box'>" | "<'transform-origin'>" | "<'transform-style'>" | "<'transition'>" | "<'transition-delay'>" | "<'transition-duration'>" | "<'transition-property'>" | "<'transition-timing-function'>" | "<'translate'>" | "<'unicode-bidi'>" | "<'unicode-range'>" | "<'user-select'>" | "<'vertical-align'>" | "<'visibility'>" | "<'voice-balance'>" | "<'voice-duration'>" | "<'voice-family'>" | "<'voice-pitch'>" | "<'voice-range'>" | "<'voice-rate'>" | "<'voice-stress'>" | "<'voice-volume'>" | "<'white-space'>" | "<'widows'>" | "<'width'>" | "<'will-change'>" | "<'word-break'>" | "<'word-spacing'>" | "<'word-wrap'>" | "<'writing-mode'>" | "<'z-index'>" | "<'zoom'>" | '<(-token>' | '<)-token>' | '<-legacy-gradient>' | '<-legacy-linear-gradient-arguments>' | '<-legacy-linear-gradient>' | '<-legacy-radial-gradient-arguments>' | '<-legacy-radial-gradient-shape>' | '<-legacy-radial-gradient-size>' | '<-legacy-radial-gradient>' | '<-legacy-repeating-linear-gradient>' | '<-legacy-repeating-radial-gradient>' | '<-ms-filter-function-legacy>' | '<-ms-filter-function-list>' | '<-ms-filter-function-progid>' | '<-ms-filter-function>' | '<-ms-filter>' | '<-non-standard-color>' | '<-non-standard-display>' | '<-non-standard-font>' | '<-non-standard-image-rendering>' | '<-non-standard-overflow>' | '<-non-standard-width>' | '<-webkit-gradient()>' | '<-webkit-gradient-color-stop>' | '<-webkit-gradient-point>' | '<-webkit-gradient-radius>' | '<-webkit-gradient-type>' | '<-webkit-mask-box-repeat>' | '<-webkit-mask-clip-style>' | '<CDC-token>' | '<CDO-token>' | '<[-token>' | '<]-token>' | '<abs()>' | '<absolute-size>' | '<acos()>' | '<age>' | '<alpha-value>' | '<an-plus-b>' | '<angle-percentage>' | '<angle>' | '<angular-color-hint>' | '<angular-color-stop-list>' | '<angular-color-stop>' | '<animateable-feature>' | '<any-value>' | '<asin()>' | '<at-keyword-token>' | '<atan()>' | '<atan2()>' | '<attachment>' | '<attr()>' | '<attr-fallback>' | '<attr-matcher>' | '<attr-modifier>' | '<attr-name>' | '<attribute-selector>' | '<auto-repeat>' | '<auto-track-list>' | '<axis>' | '<bad-string-token>' | '<bad-url-token>' | '<baseline-position>' | '<basic-shape>' | '<bcp-47>' | '<bg-clip>' | '<bg-image>' | '<bg-layer>' | '<bg-position>' | '<bg-size>' | '<blend-mode>' | '<blur()>' | '<bottom>' | '<box>' | '<brightness()>' | '<calc()>' | '<calc-constant>' | '<calc-product>' | '<calc-sum>' | '<calc-value>' | '<cf-final-image>' | '<cf-mixing-image>' | '<circle()>' | '<clamp()>' | '<class-selector>' | '<clip-source>' | '<colon-token>' | '<color-stop-angle>' | '<color-stop-length>' | '<color-stop-list>' | '<color-stop>' | '<color>' | '<combinator>' | '<comma-token>' | '<common-lig-values>' | '<compat-auto>' | '<complex-selector-list>' | '<complex-selector>' | '<composite-style>' | '<compositing-operator>' | '<compound-selector-list>' | '<compound-selector>' | '<conic-gradient()>' | '<content-distribution>' | '<content-list>' | '<content-position>' | '<content-replacement>' | '<contextual-alt-values>' | '<contrast()>' | '<cos()>' | '<counter()>' | '<counter-name>' | '<counter-style-name>' | '<counter-style>' | '<counter>' | '<counters()>' | '<cross-fade()>' | '<cubic-bezier-timing-function>' | '<custom-ident>' | '<custom-property-name>' | '<decibel>' | '<declaration-list>' | '<declaration-value>' | '<declaration>' | '<delim-token>' | '<deprecated-system-color>' | '<dimension-token>' | '<dimension>' | '<discretionary-lig-values>' | '<display-box>' | '<display-inside>' | '<display-internal>' | '<display-legacy>' | '<display-listitem>' | '<display-outside>' | '<drop-shadow()>' | '<easing-function>' | '<east-asian-variant-values>' | '<east-asian-width-values>' | '<element()>' | '<ellipse()>' | '<ending-shape>' | '<env()>' | '<exp()>' | '<explicit-track-list>' | '<family-name>' | '<feature-tag-value>' | '<feature-type>' | '<feature-value-block-list>' | '<feature-value-block>' | '<feature-value-declaration-list>' | '<feature-value-declaration>' | '<feature-value-name>' | '<fill-rule>' | '<filter-function-list>' | '<filter-function>' | '<final-bg-layer>' | '<fixed-breadth>' | '<fixed-repeat>' | '<fixed-size>' | '<flex>' | '<font-stretch-absolute>' | '<font-variant-css21>' | '<font-weight-absolute>' | '<frequency-percentage>' | '<frequency>' | '<function-token>' | '<gender>' | '<general-enclosed>' | '<generic-family>' | '<generic-name>' | '<generic-voice>' | '<geometry-box>' | '<gradient>' | '<grayscale()>' | '<grid-line>' | '<hash-token>' | '<hex-color>' | '<historical-lig-values>' | '<hsl()>' | '<hsla()>' | '<hue-rotate()>' | '<hue>' | '<hwb()>' | '<hypot()>' | '<id-selector>' | '<ident-token>' | '<ident>' | '<image()>' | '<image-set()>' | '<image-set-option>' | '<image-src>' | '<image-tags>' | '<image>' | '<inflexible-breadth>' | '<inset()>' | '<integer>' | '<invert()>' | '<keyframe-block-list>' | '<keyframe-block>' | '<keyframe-selector>' | '<keyframes-name>' | '<lab()>' | '<layer()>' | '<layer-name>' | '<lch()>' | '<leader()>' | '<leader-type>' | '<left>' | '<length-percentage>' | '<length>' | '<line-name-list>' | '<line-names>' | '<line-style>' | '<line-width>' | '<linear-color-hint>' | '<linear-color-stop>' | '<linear-gradient()>' | '<log()>' | '<mask-image>' | '<mask-layer>' | '<mask-position>' | '<mask-reference>' | '<mask-source>' | '<masking-mode>' | '<matrix()>' | '<matrix3d()>' | '<max()>' | '<media-and>' | '<media-condition-without-or>' | '<media-condition>' | '<media-feature>' | '<media-in-parens>' | '<media-not>' | '<media-or>' | '<media-query-list>' | '<media-query>' | '<media-type>' | '<mf-boolean>' | '<mf-name>' | '<mf-plain>' | '<mf-range>' | '<mf-value>' | '<min()>' | '<minmax()>' | '<mod()>' | '<name-repeat>' | '<named-color>' | '<namespace-prefix>' | '<ns-prefix>' | '<nth>' | '<number-one-or-greater>' | '<number-percentage>' | '<number-token>' | '<number-zero-one>' | '<number>' | '<numeric-figure-values>' | '<numeric-fraction-values>' | '<numeric-spacing-values>' | '<opacity()>' | '<outline-radius>' | '<overflow-position>' | '<page-body>' | '<page-margin-box-type>' | '<page-margin-box>' | '<page-selector-list>' | '<page-selector>' | '<page-size>' | '<paint()>' | '<paint>' | '<path()>' | '<percentage-token>' | '<percentage>' | '<perspective()>' | '<polygon()>' | '<position>' | '<pow()>' | '<pseudo-class-selector>' | '<pseudo-element-selector>' | '<pseudo-page>' | '<quote>' | '<radial-gradient()>' | '<ratio>' | '<relative-selector-list>' | '<relative-selector>' | '<relative-size>' | '<rem()>' | '<repeat-style>' | '<repeating-conic-gradient()>' | '<repeating-linear-gradient()>' | '<repeating-radial-gradient()>' | '<resolution>' | '<reversed-counter-name>' | '<rgb()>' | '<rgba()>' | '<right>' | '<rotate()>' | '<rotate3d()>' | '<rotateX()>' | '<rotateY()>' | '<rotateZ()>' | '<round()>' | '<rounding-strategy>' | '<saturate()>' | '<scale()>' | '<scale3d()>' | '<scaleX()>' | '<scaleY()>' | '<scaleZ()>' | '<scroll-timeline-axis>' | '<scroll-timeline-name>' | '<scroller>' | '<self-position>' | '<semicolon-token>' | '<semitones>' | '<sepia()>' | '<shadow-t>' | '<shadow>' | '<shape-box>' | '<shape-radius>' | '<shape>' | '<side-or-corner>' | '<sign()>' | '<sin()>' | '<single-animation-composition>' | '<single-animation-direction>' | '<single-animation-fill-mode>' | '<single-animation-iteration-count>' | '<single-animation-play-state>' | '<single-animation-timeline>' | '<single-animation>' | '<single-transition-property>' | '<single-transition>' | '<size>' | '<skew()>' | '<skewX()>' | '<skewY()>' | '<sqrt()>' | '<step-position>' | '<step-timing-function>' | '<string-token>' | '<string>' | '<subclass-selector>' | '<supports-condition>' | '<supports-decl>' | '<supports-feature>' | '<supports-in-parens>' | '<supports-selector-fn>' | '<svg-length>' | '<svg-writing-mode>' | '<symbol>' | '<tan()>' | '<target-counter()>' | '<target-counters()>' | '<target-text()>' | '<target>' | '<time-percentage>' | '<time>' | '<timeline-name>' | '<top>' | '<track-breadth>' | '<track-list>' | '<track-repeat>' | '<track-size>' | '<transform-function>' | '<transform-list>' | '<translate()>' | '<translate3d()>' | '<translateX()>' | '<translateY()>' | '<translateZ()>' | '<type-or-unit>' | '<type-selector>' | '<urange>' | '<url-modifier>' | '<url-token>' | '<url>' | '<var()>' | '<viewport-length>' | '<visual-box>' | '<whitespace-token>' | '<wq-name>' | '<x>' | '<y>' | '<zero>' | '<{-token>' | '<}-token>'; | ||
export type ExtendedType = "<'color-profile'>" | "<'color-rendering'>" | "<'enable-background'>" | '<animatable-value>' | '<begin-value-list>' | '<class-list>' | '<clock-value>' | '<color-matrix>' | '<css-declaration-list>' | '<dasharray>' | '<end-value-list>' | '<key-points>' | '<key-splines>' | '<key-times>' | '<list-of-lengths>' | '<list-of-numbers>' | '<list-of-percentages>' | '<list-of-svg-feature-string>' | '<list-of-value>' | '<number-optional-number>' | '<origin>' | '<points>' | '<preserve-aspect-ratio>' | '<rotate>' | '<svg-font-size-adjust>' | '<svg-font-size>' | '<svg-path>' | '<system-language>' | '<text-coordinate>' | '<view-box>' | 'AbsoluteURL' | 'Accept' | 'Any' | 'AutoComplete' | 'BCP47' | 'BrowsingContextName' | 'BrowsingContextNameOrKeyword' | 'CustomElementName' | 'DOMID' | 'DateTime' | 'FunctionBody' | 'HTTPSchemaURL' | 'HashName' | 'IconSize' | 'Int' | 'ItemProp' | 'MIMEType' | 'NoEmptyAny' | 'Number' | 'OneCodePointChar' | 'OneLineAny' | 'Pattern' | 'SerializedPermissionsPolicy' | 'SourceSizeList' | 'Srcset' | 'TabIndex' | 'URL' | 'Uint' | 'XMLName' | 'Zero'; | ||
export type CssSyntax = | ||
| "<'--*'>" | ||
| "<'-moz-appearance'>" | ||
| "<'-moz-background-clip'>" | ||
| "<'-moz-binding'>" | ||
| "<'-moz-border-bottom-colors'>" | ||
| "<'-moz-border-left-colors'>" | ||
| "<'-moz-border-radius-bottomleft'>" | ||
| "<'-moz-border-radius-bottomright'>" | ||
| "<'-moz-border-radius-topleft'>" | ||
| "<'-moz-border-radius-topright'>" | ||
| "<'-moz-border-right-colors'>" | ||
| "<'-moz-border-top-colors'>" | ||
| "<'-moz-context-properties'>" | ||
| "<'-moz-control-character-visibility'>" | ||
| "<'-moz-float-edge'>" | ||
| "<'-moz-force-broken-image-icon'>" | ||
| "<'-moz-image-region'>" | ||
| "<'-moz-orient'>" | ||
| "<'-moz-osx-font-smoothing'>" | ||
| "<'-moz-outline-radius'>" | ||
| "<'-moz-outline-radius-bottomleft'>" | ||
| "<'-moz-outline-radius-bottomright'>" | ||
| "<'-moz-outline-radius-topleft'>" | ||
| "<'-moz-outline-radius-topright'>" | ||
| "<'-moz-stack-sizing'>" | ||
| "<'-moz-text-blink'>" | ||
| "<'-moz-user-focus'>" | ||
| "<'-moz-user-input'>" | ||
| "<'-moz-user-modify'>" | ||
| "<'-moz-user-select'>" | ||
| "<'-moz-window-dragging'>" | ||
| "<'-moz-window-shadow'>" | ||
| "<'-ms-accelerator'>" | ||
| "<'-ms-block-progression'>" | ||
| "<'-ms-content-zoom-chaining'>" | ||
| "<'-ms-content-zoom-limit'>" | ||
| "<'-ms-content-zoom-limit-max'>" | ||
| "<'-ms-content-zoom-limit-min'>" | ||
| "<'-ms-content-zoom-snap'>" | ||
| "<'-ms-content-zoom-snap-points'>" | ||
| "<'-ms-content-zoom-snap-type'>" | ||
| "<'-ms-content-zooming'>" | ||
| "<'-ms-filter'>" | ||
| "<'-ms-flex-align'>" | ||
| "<'-ms-flex-item-align'>" | ||
| "<'-ms-flex-line-pack'>" | ||
| "<'-ms-flex-negative'>" | ||
| "<'-ms-flex-order'>" | ||
| "<'-ms-flex-pack'>" | ||
| "<'-ms-flex-positive'>" | ||
| "<'-ms-flex-preferred-size'>" | ||
| "<'-ms-flow-from'>" | ||
| "<'-ms-flow-into'>" | ||
| "<'-ms-grid-column-align'>" | ||
| "<'-ms-grid-columns'>" | ||
| "<'-ms-grid-row-align'>" | ||
| "<'-ms-grid-rows'>" | ||
| "<'-ms-high-contrast-adjust'>" | ||
| "<'-ms-hyphenate-limit-chars'>" | ||
| "<'-ms-hyphenate-limit-last'>" | ||
| "<'-ms-hyphenate-limit-lines'>" | ||
| "<'-ms-hyphenate-limit-zone'>" | ||
| "<'-ms-ime-align'>" | ||
| "<'-ms-interpolation-mode'>" | ||
| "<'-ms-overflow-style'>" | ||
| "<'-ms-scroll-chaining'>" | ||
| "<'-ms-scroll-limit'>" | ||
| "<'-ms-scroll-limit-x-max'>" | ||
| "<'-ms-scroll-limit-x-min'>" | ||
| "<'-ms-scroll-limit-y-max'>" | ||
| "<'-ms-scroll-limit-y-min'>" | ||
| "<'-ms-scroll-rails'>" | ||
| "<'-ms-scroll-snap-points-x'>" | ||
| "<'-ms-scroll-snap-points-y'>" | ||
| "<'-ms-scroll-snap-type'>" | ||
| "<'-ms-scroll-snap-x'>" | ||
| "<'-ms-scroll-snap-y'>" | ||
| "<'-ms-scroll-translation'>" | ||
| "<'-ms-scrollbar-3dlight-color'>" | ||
| "<'-ms-scrollbar-arrow-color'>" | ||
| "<'-ms-scrollbar-base-color'>" | ||
| "<'-ms-scrollbar-darkshadow-color'>" | ||
| "<'-ms-scrollbar-face-color'>" | ||
| "<'-ms-scrollbar-highlight-color'>" | ||
| "<'-ms-scrollbar-shadow-color'>" | ||
| "<'-ms-scrollbar-track-color'>" | ||
| "<'-ms-text-autospace'>" | ||
| "<'-ms-touch-select'>" | ||
| "<'-ms-user-select'>" | ||
| "<'-ms-wrap-flow'>" | ||
| "<'-ms-wrap-margin'>" | ||
| "<'-ms-wrap-through'>" | ||
| "<'-webkit-appearance'>" | ||
| "<'-webkit-background-clip'>" | ||
| "<'-webkit-border-before'>" | ||
| "<'-webkit-border-before-color'>" | ||
| "<'-webkit-border-before-style'>" | ||
| "<'-webkit-border-before-width'>" | ||
| "<'-webkit-box-reflect'>" | ||
| "<'-webkit-column-break-after'>" | ||
| "<'-webkit-column-break-before'>" | ||
| "<'-webkit-column-break-inside'>" | ||
| "<'-webkit-font-smoothing'>" | ||
| "<'-webkit-line-clamp'>" | ||
| "<'-webkit-mask'>" | ||
| "<'-webkit-mask-attachment'>" | ||
| "<'-webkit-mask-box-image'>" | ||
| "<'-webkit-mask-clip'>" | ||
| "<'-webkit-mask-composite'>" | ||
| "<'-webkit-mask-image'>" | ||
| "<'-webkit-mask-origin'>" | ||
| "<'-webkit-mask-position'>" | ||
| "<'-webkit-mask-position-x'>" | ||
| "<'-webkit-mask-position-y'>" | ||
| "<'-webkit-mask-repeat'>" | ||
| "<'-webkit-mask-repeat-x'>" | ||
| "<'-webkit-mask-repeat-y'>" | ||
| "<'-webkit-mask-size'>" | ||
| "<'-webkit-overflow-scrolling'>" | ||
| "<'-webkit-print-color-adjust'>" | ||
| "<'-webkit-tap-highlight-color'>" | ||
| "<'-webkit-text-fill-color'>" | ||
| "<'-webkit-text-security'>" | ||
| "<'-webkit-text-stroke'>" | ||
| "<'-webkit-text-stroke-color'>" | ||
| "<'-webkit-text-stroke-width'>" | ||
| "<'-webkit-touch-callout'>" | ||
| "<'-webkit-user-drag'>" | ||
| "<'-webkit-user-modify'>" | ||
| "<'-webkit-user-select'>" | ||
| "<'accent-color'>" | ||
| "<'align-content'>" | ||
| "<'align-items'>" | ||
| "<'align-self'>" | ||
| "<'align-tracks'>" | ||
| "<'alignment-baseline'>" | ||
| "<'all'>" | ||
| "<'animation'>" | ||
| "<'animation-composition'>" | ||
| "<'animation-delay'>" | ||
| "<'animation-direction'>" | ||
| "<'animation-duration'>" | ||
| "<'animation-fill-mode'>" | ||
| "<'animation-iteration-count'>" | ||
| "<'animation-name'>" | ||
| "<'animation-play-state'>" | ||
| "<'animation-timeline'>" | ||
| "<'animation-timing-function'>" | ||
| "<'appearance'>" | ||
| "<'aspect-ratio'>" | ||
| "<'azimuth'>" | ||
| "<'backdrop-filter'>" | ||
| "<'backface-visibility'>" | ||
| "<'background'>" | ||
| "<'background-attachment'>" | ||
| "<'background-blend-mode'>" | ||
| "<'background-clip'>" | ||
| "<'background-color'>" | ||
| "<'background-image'>" | ||
| "<'background-origin'>" | ||
| "<'background-position'>" | ||
| "<'background-position-x'>" | ||
| "<'background-position-y'>" | ||
| "<'background-repeat'>" | ||
| "<'background-size'>" | ||
| "<'baseline-shift'>" | ||
| "<'behavior'>" | ||
| "<'block-overflow'>" | ||
| "<'block-size'>" | ||
| "<'border'>" | ||
| "<'border-block'>" | ||
| "<'border-block-color'>" | ||
| "<'border-block-end'>" | ||
| "<'border-block-end-color'>" | ||
| "<'border-block-end-style'>" | ||
| "<'border-block-end-width'>" | ||
| "<'border-block-start'>" | ||
| "<'border-block-start-color'>" | ||
| "<'border-block-start-style'>" | ||
| "<'border-block-start-width'>" | ||
| "<'border-block-style'>" | ||
| "<'border-block-width'>" | ||
| "<'border-bottom'>" | ||
| "<'border-bottom-color'>" | ||
| "<'border-bottom-left-radius'>" | ||
| "<'border-bottom-right-radius'>" | ||
| "<'border-bottom-style'>" | ||
| "<'border-bottom-width'>" | ||
| "<'border-collapse'>" | ||
| "<'border-color'>" | ||
| "<'border-end-end-radius'>" | ||
| "<'border-end-start-radius'>" | ||
| "<'border-image'>" | ||
| "<'border-image-outset'>" | ||
| "<'border-image-repeat'>" | ||
| "<'border-image-slice'>" | ||
| "<'border-image-source'>" | ||
| "<'border-image-width'>" | ||
| "<'border-inline'>" | ||
| "<'border-inline-color'>" | ||
| "<'border-inline-end'>" | ||
| "<'border-inline-end-color'>" | ||
| "<'border-inline-end-style'>" | ||
| "<'border-inline-end-width'>" | ||
| "<'border-inline-start'>" | ||
| "<'border-inline-start-color'>" | ||
| "<'border-inline-start-style'>" | ||
| "<'border-inline-start-width'>" | ||
| "<'border-inline-style'>" | ||
| "<'border-inline-width'>" | ||
| "<'border-left'>" | ||
| "<'border-left-color'>" | ||
| "<'border-left-style'>" | ||
| "<'border-left-width'>" | ||
| "<'border-radius'>" | ||
| "<'border-right'>" | ||
| "<'border-right-color'>" | ||
| "<'border-right-style'>" | ||
| "<'border-right-width'>" | ||
| "<'border-spacing'>" | ||
| "<'border-start-end-radius'>" | ||
| "<'border-start-start-radius'>" | ||
| "<'border-style'>" | ||
| "<'border-top'>" | ||
| "<'border-top-color'>" | ||
| "<'border-top-left-radius'>" | ||
| "<'border-top-right-radius'>" | ||
| "<'border-top-style'>" | ||
| "<'border-top-width'>" | ||
| "<'border-width'>" | ||
| "<'bottom'>" | ||
| "<'box-align'>" | ||
| "<'box-decoration-break'>" | ||
| "<'box-direction'>" | ||
| "<'box-flex'>" | ||
| "<'box-flex-group'>" | ||
| "<'box-lines'>" | ||
| "<'box-ordinal-group'>" | ||
| "<'box-orient'>" | ||
| "<'box-pack'>" | ||
| "<'box-shadow'>" | ||
| "<'box-sizing'>" | ||
| "<'break-after'>" | ||
| "<'break-before'>" | ||
| "<'break-inside'>" | ||
| "<'caption-side'>" | ||
| "<'caret'>" | ||
| "<'caret-color'>" | ||
| "<'caret-shape'>" | ||
| "<'clear'>" | ||
| "<'clip'>" | ||
| "<'clip-path'>" | ||
| "<'clip-rule'>" | ||
| "<'color'>" | ||
| "<'color-scheme'>" | ||
| "<'column-count'>" | ||
| "<'column-fill'>" | ||
| "<'column-gap'>" | ||
| "<'column-rule'>" | ||
| "<'column-rule-color'>" | ||
| "<'column-rule-style'>" | ||
| "<'column-rule-width'>" | ||
| "<'column-span'>" | ||
| "<'column-width'>" | ||
| "<'columns'>" | ||
| "<'contain'>" | ||
| "<'contain-intrinsic-block-size'>" | ||
| "<'contain-intrinsic-height'>" | ||
| "<'contain-intrinsic-inline-size'>" | ||
| "<'contain-intrinsic-size'>" | ||
| "<'contain-intrinsic-width'>" | ||
| "<'content'>" | ||
| "<'content-visibility'>" | ||
| "<'counter-increment'>" | ||
| "<'counter-reset'>" | ||
| "<'counter-set'>" | ||
| "<'cue'>" | ||
| "<'cue-after'>" | ||
| "<'cue-before'>" | ||
| "<'cursor'>" | ||
| "<'direction'>" | ||
| "<'display'>" | ||
| "<'dominant-baseline'>" | ||
| "<'empty-cells'>" | ||
| "<'fill'>" | ||
| "<'fill-opacity'>" | ||
| "<'fill-rule'>" | ||
| "<'filter'>" | ||
| "<'flex'>" | ||
| "<'flex-basis'>" | ||
| "<'flex-direction'>" | ||
| "<'flex-flow'>" | ||
| "<'flex-grow'>" | ||
| "<'flex-shrink'>" | ||
| "<'flex-wrap'>" | ||
| "<'float'>" | ||
| "<'font'>" | ||
| "<'font-family'>" | ||
| "<'font-feature-settings'>" | ||
| "<'font-kerning'>" | ||
| "<'font-language-override'>" | ||
| "<'font-optical-sizing'>" | ||
| "<'font-size'>" | ||
| "<'font-size-adjust'>" | ||
| "<'font-smooth'>" | ||
| "<'font-stretch'>" | ||
| "<'font-style'>" | ||
| "<'font-synthesis'>" | ||
| "<'font-variant'>" | ||
| "<'font-variant-alternates'>" | ||
| "<'font-variant-caps'>" | ||
| "<'font-variant-east-asian'>" | ||
| "<'font-variant-ligatures'>" | ||
| "<'font-variant-numeric'>" | ||
| "<'font-variant-position'>" | ||
| "<'font-variation-settings'>" | ||
| "<'font-weight'>" | ||
| "<'forced-color-adjust'>" | ||
| "<'gap'>" | ||
| "<'glyph-orientation-horizontal'>" | ||
| "<'glyph-orientation-vertical'>" | ||
| "<'grid'>" | ||
| "<'grid-area'>" | ||
| "<'grid-auto-columns'>" | ||
| "<'grid-auto-flow'>" | ||
| "<'grid-auto-rows'>" | ||
| "<'grid-column'>" | ||
| "<'grid-column-end'>" | ||
| "<'grid-column-gap'>" | ||
| "<'grid-column-start'>" | ||
| "<'grid-gap'>" | ||
| "<'grid-row'>" | ||
| "<'grid-row-end'>" | ||
| "<'grid-row-gap'>" | ||
| "<'grid-row-start'>" | ||
| "<'grid-template'>" | ||
| "<'grid-template-areas'>" | ||
| "<'grid-template-columns'>" | ||
| "<'grid-template-rows'>" | ||
| "<'hanging-punctuation'>" | ||
| "<'height'>" | ||
| "<'hyphenate-character'>" | ||
| "<'hyphens'>" | ||
| "<'image-orientation'>" | ||
| "<'image-rendering'>" | ||
| "<'image-resolution'>" | ||
| "<'ime-mode'>" | ||
| "<'initial-letter'>" | ||
| "<'initial-letter-align'>" | ||
| "<'inline-size'>" | ||
| "<'input-security'>" | ||
| "<'inset'>" | ||
| "<'inset-block'>" | ||
| "<'inset-block-end'>" | ||
| "<'inset-block-start'>" | ||
| "<'inset-inline'>" | ||
| "<'inset-inline-end'>" | ||
| "<'inset-inline-start'>" | ||
| "<'isolation'>" | ||
| "<'justify-content'>" | ||
| "<'justify-items'>" | ||
| "<'justify-self'>" | ||
| "<'justify-tracks'>" | ||
| "<'kerning'>" | ||
| "<'left'>" | ||
| "<'letter-spacing'>" | ||
| "<'line-break'>" | ||
| "<'line-clamp'>" | ||
| "<'line-height'>" | ||
| "<'line-height-step'>" | ||
| "<'list-style'>" | ||
| "<'list-style-image'>" | ||
| "<'list-style-position'>" | ||
| "<'list-style-type'>" | ||
| "<'margin'>" | ||
| "<'margin-block'>" | ||
| "<'margin-block-end'>" | ||
| "<'margin-block-start'>" | ||
| "<'margin-bottom'>" | ||
| "<'margin-inline'>" | ||
| "<'margin-inline-end'>" | ||
| "<'margin-inline-start'>" | ||
| "<'margin-left'>" | ||
| "<'margin-right'>" | ||
| "<'margin-top'>" | ||
| "<'margin-trim'>" | ||
| "<'marker'>" | ||
| "<'marker-end'>" | ||
| "<'marker-mid'>" | ||
| "<'marker-start'>" | ||
| "<'mask'>" | ||
| "<'mask-border'>" | ||
| "<'mask-border-mode'>" | ||
| "<'mask-border-outset'>" | ||
| "<'mask-border-repeat'>" | ||
| "<'mask-border-slice'>" | ||
| "<'mask-border-source'>" | ||
| "<'mask-border-width'>" | ||
| "<'mask-clip'>" | ||
| "<'mask-composite'>" | ||
| "<'mask-image'>" | ||
| "<'mask-mode'>" | ||
| "<'mask-origin'>" | ||
| "<'mask-position'>" | ||
| "<'mask-repeat'>" | ||
| "<'mask-size'>" | ||
| "<'mask-type'>" | ||
| "<'masonry-auto-flow'>" | ||
| "<'math-depth'>" | ||
| "<'math-shift'>" | ||
| "<'math-style'>" | ||
| "<'max-block-size'>" | ||
| "<'max-height'>" | ||
| "<'max-inline-size'>" | ||
| "<'max-lines'>" | ||
| "<'max-width'>" | ||
| "<'min-block-size'>" | ||
| "<'min-height'>" | ||
| "<'min-inline-size'>" | ||
| "<'min-width'>" | ||
| "<'mix-blend-mode'>" | ||
| "<'object-fit'>" | ||
| "<'object-position'>" | ||
| "<'offset'>" | ||
| "<'offset-anchor'>" | ||
| "<'offset-distance'>" | ||
| "<'offset-path'>" | ||
| "<'offset-position'>" | ||
| "<'offset-rotate'>" | ||
| "<'opacity'>" | ||
| "<'order'>" | ||
| "<'orphans'>" | ||
| "<'outline'>" | ||
| "<'outline-color'>" | ||
| "<'outline-offset'>" | ||
| "<'outline-style'>" | ||
| "<'outline-width'>" | ||
| "<'overflow'>" | ||
| "<'overflow-anchor'>" | ||
| "<'overflow-block'>" | ||
| "<'overflow-clip-box'>" | ||
| "<'overflow-clip-margin'>" | ||
| "<'overflow-inline'>" | ||
| "<'overflow-wrap'>" | ||
| "<'overflow-x'>" | ||
| "<'overflow-y'>" | ||
| "<'overscroll-behavior'>" | ||
| "<'overscroll-behavior-block'>" | ||
| "<'overscroll-behavior-inline'>" | ||
| "<'overscroll-behavior-x'>" | ||
| "<'overscroll-behavior-y'>" | ||
| "<'padding'>" | ||
| "<'padding-block'>" | ||
| "<'padding-block-end'>" | ||
| "<'padding-block-start'>" | ||
| "<'padding-bottom'>" | ||
| "<'padding-inline'>" | ||
| "<'padding-inline-end'>" | ||
| "<'padding-inline-start'>" | ||
| "<'padding-left'>" | ||
| "<'padding-right'>" | ||
| "<'padding-top'>" | ||
| "<'page-break-after'>" | ||
| "<'page-break-before'>" | ||
| "<'page-break-inside'>" | ||
| "<'paint-order'>" | ||
| "<'pause'>" | ||
| "<'pause-after'>" | ||
| "<'pause-before'>" | ||
| "<'perspective'>" | ||
| "<'perspective-origin'>" | ||
| "<'place-content'>" | ||
| "<'place-items'>" | ||
| "<'place-self'>" | ||
| "<'pointer-events'>" | ||
| "<'position'>" | ||
| "<'print-color-adjust'>" | ||
| "<'quotes'>" | ||
| "<'resize'>" | ||
| "<'rest'>" | ||
| "<'rest-after'>" | ||
| "<'rest-before'>" | ||
| "<'right'>" | ||
| "<'rotate'>" | ||
| "<'row-gap'>" | ||
| "<'ruby-align'>" | ||
| "<'ruby-merge'>" | ||
| "<'ruby-position'>" | ||
| "<'scale'>" | ||
| "<'scroll-behavior'>" | ||
| "<'scroll-margin'>" | ||
| "<'scroll-margin-block'>" | ||
| "<'scroll-margin-block-end'>" | ||
| "<'scroll-margin-block-start'>" | ||
| "<'scroll-margin-bottom'>" | ||
| "<'scroll-margin-inline'>" | ||
| "<'scroll-margin-inline-end'>" | ||
| "<'scroll-margin-inline-start'>" | ||
| "<'scroll-margin-left'>" | ||
| "<'scroll-margin-right'>" | ||
| "<'scroll-margin-top'>" | ||
| "<'scroll-padding'>" | ||
| "<'scroll-padding-block'>" | ||
| "<'scroll-padding-block-end'>" | ||
| "<'scroll-padding-block-start'>" | ||
| "<'scroll-padding-bottom'>" | ||
| "<'scroll-padding-inline'>" | ||
| "<'scroll-padding-inline-end'>" | ||
| "<'scroll-padding-inline-start'>" | ||
| "<'scroll-padding-left'>" | ||
| "<'scroll-padding-right'>" | ||
| "<'scroll-padding-top'>" | ||
| "<'scroll-snap-align'>" | ||
| "<'scroll-snap-coordinate'>" | ||
| "<'scroll-snap-destination'>" | ||
| "<'scroll-snap-points-x'>" | ||
| "<'scroll-snap-points-y'>" | ||
| "<'scroll-snap-stop'>" | ||
| "<'scroll-snap-type'>" | ||
| "<'scroll-snap-type-x'>" | ||
| "<'scroll-snap-type-y'>" | ||
| "<'scroll-timeline'>" | ||
| "<'scroll-timeline-axis'>" | ||
| "<'scroll-timeline-name'>" | ||
| "<'scrollbar-color'>" | ||
| "<'scrollbar-gutter'>" | ||
| "<'scrollbar-width'>" | ||
| "<'shape-image-threshold'>" | ||
| "<'shape-margin'>" | ||
| "<'shape-outside'>" | ||
| "<'shape-rendering'>" | ||
| "<'speak'>" | ||
| "<'speak-as'>" | ||
| "<'src'>" | ||
| "<'stroke'>" | ||
| "<'stroke-dasharray'>" | ||
| "<'stroke-dashoffset'>" | ||
| "<'stroke-linecap'>" | ||
| "<'stroke-linejoin'>" | ||
| "<'stroke-miterlimit'>" | ||
| "<'stroke-opacity'>" | ||
| "<'stroke-width'>" | ||
| "<'tab-size'>" | ||
| "<'table-layout'>" | ||
| "<'text-align'>" | ||
| "<'text-align-last'>" | ||
| "<'text-anchor'>" | ||
| "<'text-combine-upright'>" | ||
| "<'text-decoration'>" | ||
| "<'text-decoration-color'>" | ||
| "<'text-decoration-line'>" | ||
| "<'text-decoration-skip'>" | ||
| "<'text-decoration-skip-ink'>" | ||
| "<'text-decoration-style'>" | ||
| "<'text-decoration-thickness'>" | ||
| "<'text-emphasis'>" | ||
| "<'text-emphasis-color'>" | ||
| "<'text-emphasis-position'>" | ||
| "<'text-emphasis-style'>" | ||
| "<'text-indent'>" | ||
| "<'text-justify'>" | ||
| "<'text-orientation'>" | ||
| "<'text-overflow'>" | ||
| "<'text-rendering'>" | ||
| "<'text-shadow'>" | ||
| "<'text-size-adjust'>" | ||
| "<'text-transform'>" | ||
| "<'text-underline-offset'>" | ||
| "<'text-underline-position'>" | ||
| "<'top'>" | ||
| "<'touch-action'>" | ||
| "<'transform'>" | ||
| "<'transform-box'>" | ||
| "<'transform-origin'>" | ||
| "<'transform-style'>" | ||
| "<'transition'>" | ||
| "<'transition-delay'>" | ||
| "<'transition-duration'>" | ||
| "<'transition-property'>" | ||
| "<'transition-timing-function'>" | ||
| "<'translate'>" | ||
| "<'unicode-bidi'>" | ||
| "<'unicode-range'>" | ||
| "<'user-select'>" | ||
| "<'vertical-align'>" | ||
| "<'visibility'>" | ||
| "<'voice-balance'>" | ||
| "<'voice-duration'>" | ||
| "<'voice-family'>" | ||
| "<'voice-pitch'>" | ||
| "<'voice-range'>" | ||
| "<'voice-rate'>" | ||
| "<'voice-stress'>" | ||
| "<'voice-volume'>" | ||
| "<'white-space'>" | ||
| "<'widows'>" | ||
| "<'width'>" | ||
| "<'will-change'>" | ||
| "<'word-break'>" | ||
| "<'word-spacing'>" | ||
| "<'word-wrap'>" | ||
| "<'writing-mode'>" | ||
| "<'z-index'>" | ||
| "<'zoom'>" | ||
| '<(-token>' | ||
| '<)-token>' | ||
| '<-legacy-gradient>' | ||
| '<-legacy-linear-gradient-arguments>' | ||
| '<-legacy-linear-gradient>' | ||
| '<-legacy-radial-gradient-arguments>' | ||
| '<-legacy-radial-gradient-shape>' | ||
| '<-legacy-radial-gradient-size>' | ||
| '<-legacy-radial-gradient>' | ||
| '<-legacy-repeating-linear-gradient>' | ||
| '<-legacy-repeating-radial-gradient>' | ||
| '<-ms-filter-function-legacy>' | ||
| '<-ms-filter-function-list>' | ||
| '<-ms-filter-function-progid>' | ||
| '<-ms-filter-function>' | ||
| '<-ms-filter>' | ||
| '<-non-standard-color>' | ||
| '<-non-standard-display>' | ||
| '<-non-standard-font>' | ||
| '<-non-standard-image-rendering>' | ||
| '<-non-standard-overflow>' | ||
| '<-non-standard-width>' | ||
| '<-webkit-gradient()>' | ||
| '<-webkit-gradient-color-stop>' | ||
| '<-webkit-gradient-point>' | ||
| '<-webkit-gradient-radius>' | ||
| '<-webkit-gradient-type>' | ||
| '<-webkit-mask-box-repeat>' | ||
| '<-webkit-mask-clip-style>' | ||
| '<CDC-token>' | ||
| '<CDO-token>' | ||
| '<[-token>' | ||
| '<]-token>' | ||
| '<abs()>' | ||
| '<absolute-size>' | ||
| '<acos()>' | ||
| '<age>' | ||
| '<alpha-value>' | ||
| '<an-plus-b>' | ||
| '<angle-percentage>' | ||
| '<angle>' | ||
| '<angular-color-hint>' | ||
| '<angular-color-stop-list>' | ||
| '<angular-color-stop>' | ||
| '<animateable-feature>' | ||
| '<any-value>' | ||
| '<asin()>' | ||
| '<at-keyword-token>' | ||
| '<atan()>' | ||
| '<atan2()>' | ||
| '<attachment>' | ||
| '<attr()>' | ||
| '<attr-fallback>' | ||
| '<attr-matcher>' | ||
| '<attr-modifier>' | ||
| '<attr-name>' | ||
| '<attribute-selector>' | ||
| '<auto-repeat>' | ||
| '<auto-track-list>' | ||
| '<axis>' | ||
| '<bad-string-token>' | ||
| '<bad-url-token>' | ||
| '<baseline-position>' | ||
| '<basic-shape>' | ||
| '<bcp-47>' | ||
| '<bg-clip>' | ||
| '<bg-image>' | ||
| '<bg-layer>' | ||
| '<bg-position>' | ||
| '<bg-size>' | ||
| '<blend-mode>' | ||
| '<blur()>' | ||
| '<bottom>' | ||
| '<box>' | ||
| '<brightness()>' | ||
| '<calc()>' | ||
| '<calc-constant>' | ||
| '<calc-product>' | ||
| '<calc-sum>' | ||
| '<calc-value>' | ||
| '<cf-final-image>' | ||
| '<cf-mixing-image>' | ||
| '<circle()>' | ||
| '<clamp()>' | ||
| '<class-selector>' | ||
| '<clip-source>' | ||
| '<colon-token>' | ||
| '<color-stop-angle>' | ||
| '<color-stop-length>' | ||
| '<color-stop-list>' | ||
| '<color-stop>' | ||
| '<color>' | ||
| '<combinator>' | ||
| '<comma-token>' | ||
| '<common-lig-values>' | ||
| '<compat-auto>' | ||
| '<complex-selector-list>' | ||
| '<complex-selector>' | ||
| '<composite-style>' | ||
| '<compositing-operator>' | ||
| '<compound-selector-list>' | ||
| '<compound-selector>' | ||
| '<conic-gradient()>' | ||
| '<content-distribution>' | ||
| '<content-list>' | ||
| '<content-position>' | ||
| '<content-replacement>' | ||
| '<contextual-alt-values>' | ||
| '<contrast()>' | ||
| '<cos()>' | ||
| '<counter()>' | ||
| '<counter-name>' | ||
| '<counter-style-name>' | ||
| '<counter-style>' | ||
| '<counter>' | ||
| '<counters()>' | ||
| '<cross-fade()>' | ||
| '<cubic-bezier-timing-function>' | ||
| '<custom-ident>' | ||
| '<custom-property-name>' | ||
| '<decibel>' | ||
| '<declaration-list>' | ||
| '<declaration-value>' | ||
| '<declaration>' | ||
| '<delim-token>' | ||
| '<deprecated-system-color>' | ||
| '<dimension-token>' | ||
| '<dimension>' | ||
| '<discretionary-lig-values>' | ||
| '<display-box>' | ||
| '<display-inside>' | ||
| '<display-internal>' | ||
| '<display-legacy>' | ||
| '<display-listitem>' | ||
| '<display-outside>' | ||
| '<drop-shadow()>' | ||
| '<easing-function>' | ||
| '<east-asian-variant-values>' | ||
| '<east-asian-width-values>' | ||
| '<element()>' | ||
| '<ellipse()>' | ||
| '<ending-shape>' | ||
| '<env()>' | ||
| '<exp()>' | ||
| '<explicit-track-list>' | ||
| '<family-name>' | ||
| '<feature-tag-value>' | ||
| '<feature-type>' | ||
| '<feature-value-block-list>' | ||
| '<feature-value-block>' | ||
| '<feature-value-declaration-list>' | ||
| '<feature-value-declaration>' | ||
| '<feature-value-name>' | ||
| '<fill-rule>' | ||
| '<filter-function-list>' | ||
| '<filter-function>' | ||
| '<final-bg-layer>' | ||
| '<fixed-breadth>' | ||
| '<fixed-repeat>' | ||
| '<fixed-size>' | ||
| '<flex>' | ||
| '<font-stretch-absolute>' | ||
| '<font-variant-css21>' | ||
| '<font-weight-absolute>' | ||
| '<frequency-percentage>' | ||
| '<frequency>' | ||
| '<function-token>' | ||
| '<gender>' | ||
| '<general-enclosed>' | ||
| '<generic-family>' | ||
| '<generic-name>' | ||
| '<generic-voice>' | ||
| '<geometry-box>' | ||
| '<gradient>' | ||
| '<grayscale()>' | ||
| '<grid-line>' | ||
| '<hash-token>' | ||
| '<hex-color>' | ||
| '<historical-lig-values>' | ||
| '<hsl()>' | ||
| '<hsla()>' | ||
| '<hue-rotate()>' | ||
| '<hue>' | ||
| '<hwb()>' | ||
| '<hypot()>' | ||
| '<id-selector>' | ||
| '<ident-token>' | ||
| '<ident>' | ||
| '<image()>' | ||
| '<image-set()>' | ||
| '<image-set-option>' | ||
| '<image-src>' | ||
| '<image-tags>' | ||
| '<image>' | ||
| '<inflexible-breadth>' | ||
| '<inset()>' | ||
| '<integer>' | ||
| '<invert()>' | ||
| '<keyframe-block-list>' | ||
| '<keyframe-block>' | ||
| '<keyframe-selector>' | ||
| '<keyframes-name>' | ||
| '<lab()>' | ||
| '<layer()>' | ||
| '<layer-name>' | ||
| '<lch()>' | ||
| '<leader()>' | ||
| '<leader-type>' | ||
| '<left>' | ||
| '<length-percentage>' | ||
| '<length>' | ||
| '<line-name-list>' | ||
| '<line-names>' | ||
| '<line-style>' | ||
| '<line-width>' | ||
| '<linear-color-hint>' | ||
| '<linear-color-stop>' | ||
| '<linear-gradient()>' | ||
| '<log()>' | ||
| '<mask-image>' | ||
| '<mask-layer>' | ||
| '<mask-position>' | ||
| '<mask-reference>' | ||
| '<mask-source>' | ||
| '<masking-mode>' | ||
| '<matrix()>' | ||
| '<matrix3d()>' | ||
| '<max()>' | ||
| '<media-and>' | ||
| '<media-condition-without-or>' | ||
| '<media-condition>' | ||
| '<media-feature>' | ||
| '<media-in-parens>' | ||
| '<media-not>' | ||
| '<media-or>' | ||
| '<media-query-list>' | ||
| '<media-query>' | ||
| '<media-type>' | ||
| '<mf-boolean>' | ||
| '<mf-name>' | ||
| '<mf-plain>' | ||
| '<mf-range>' | ||
| '<mf-value>' | ||
| '<min()>' | ||
| '<minmax()>' | ||
| '<mod()>' | ||
| '<name-repeat>' | ||
| '<named-color>' | ||
| '<namespace-prefix>' | ||
| '<ns-prefix>' | ||
| '<nth>' | ||
| '<number-one-or-greater>' | ||
| '<number-percentage>' | ||
| '<number-token>' | ||
| '<number-zero-one>' | ||
| '<number>' | ||
| '<numeric-figure-values>' | ||
| '<numeric-fraction-values>' | ||
| '<numeric-spacing-values>' | ||
| '<opacity()>' | ||
| '<outline-radius>' | ||
| '<overflow-position>' | ||
| '<page-body>' | ||
| '<page-margin-box-type>' | ||
| '<page-margin-box>' | ||
| '<page-selector-list>' | ||
| '<page-selector>' | ||
| '<page-size>' | ||
| '<paint()>' | ||
| '<paint>' | ||
| '<path()>' | ||
| '<percentage-token>' | ||
| '<percentage>' | ||
| '<perspective()>' | ||
| '<polygon()>' | ||
| '<position>' | ||
| '<pow()>' | ||
| '<pseudo-class-selector>' | ||
| '<pseudo-element-selector>' | ||
| '<pseudo-page>' | ||
| '<quote>' | ||
| '<radial-gradient()>' | ||
| '<ratio>' | ||
| '<relative-selector-list>' | ||
| '<relative-selector>' | ||
| '<relative-size>' | ||
| '<rem()>' | ||
| '<repeat-style>' | ||
| '<repeating-conic-gradient()>' | ||
| '<repeating-linear-gradient()>' | ||
| '<repeating-radial-gradient()>' | ||
| '<resolution>' | ||
| '<reversed-counter-name>' | ||
| '<rgb()>' | ||
| '<rgba()>' | ||
| '<right>' | ||
| '<rotate()>' | ||
| '<rotate3d()>' | ||
| '<rotateX()>' | ||
| '<rotateY()>' | ||
| '<rotateZ()>' | ||
| '<round()>' | ||
| '<rounding-strategy>' | ||
| '<saturate()>' | ||
| '<scale()>' | ||
| '<scale3d()>' | ||
| '<scaleX()>' | ||
| '<scaleY()>' | ||
| '<scaleZ()>' | ||
| '<scroll-timeline-axis>' | ||
| '<scroll-timeline-name>' | ||
| '<scroller>' | ||
| '<self-position>' | ||
| '<semicolon-token>' | ||
| '<semitones>' | ||
| '<sepia()>' | ||
| '<shadow-t>' | ||
| '<shadow>' | ||
| '<shape-box>' | ||
| '<shape-radius>' | ||
| '<shape>' | ||
| '<side-or-corner>' | ||
| '<sign()>' | ||
| '<sin()>' | ||
| '<single-animation-composition>' | ||
| '<single-animation-direction>' | ||
| '<single-animation-fill-mode>' | ||
| '<single-animation-iteration-count>' | ||
| '<single-animation-play-state>' | ||
| '<single-animation-timeline>' | ||
| '<single-animation>' | ||
| '<single-transition-property>' | ||
| '<single-transition>' | ||
| '<size>' | ||
| '<skew()>' | ||
| '<skewX()>' | ||
| '<skewY()>' | ||
| '<sqrt()>' | ||
| '<step-position>' | ||
| '<step-timing-function>' | ||
| '<string-token>' | ||
| '<string>' | ||
| '<subclass-selector>' | ||
| '<supports-condition>' | ||
| '<supports-decl>' | ||
| '<supports-feature>' | ||
| '<supports-in-parens>' | ||
| '<supports-selector-fn>' | ||
| '<svg-length>' | ||
| '<svg-writing-mode>' | ||
| '<symbol>' | ||
| '<tan()>' | ||
| '<target-counter()>' | ||
| '<target-counters()>' | ||
| '<target-text()>' | ||
| '<target>' | ||
| '<time-percentage>' | ||
| '<time>' | ||
| '<timeline-name>' | ||
| '<top>' | ||
| '<track-breadth>' | ||
| '<track-list>' | ||
| '<track-repeat>' | ||
| '<track-size>' | ||
| '<transform-function>' | ||
| '<transform-list>' | ||
| '<translate()>' | ||
| '<translate3d()>' | ||
| '<translateX()>' | ||
| '<translateY()>' | ||
| '<translateZ()>' | ||
| '<type-or-unit>' | ||
| '<type-selector>' | ||
| '<urange>' | ||
| '<url-modifier>' | ||
| '<url-token>' | ||
| '<url>' | ||
| '<var()>' | ||
| '<viewport-length>' | ||
| '<visual-box>' | ||
| '<whitespace-token>' | ||
| '<wq-name>' | ||
| '<x>' | ||
| '<y>' | ||
| '<zero>' | ||
| '<{-token>' | ||
| '<}-token>'; | ||
export type ExtendedType = | ||
| "<'color-profile'>" | ||
| "<'color-rendering'>" | ||
| "<'enable-background'>" | ||
| '<animatable-value>' | ||
| '<begin-value-list>' | ||
| '<class-list>' | ||
| '<clock-value>' | ||
| '<color-matrix>' | ||
| '<css-declaration-list>' | ||
| '<dasharray>' | ||
| '<end-value-list>' | ||
| '<key-points>' | ||
| '<key-splines>' | ||
| '<key-times>' | ||
| '<list-of-lengths>' | ||
| '<list-of-numbers>' | ||
| '<list-of-percentages>' | ||
| '<list-of-svg-feature-string>' | ||
| '<list-of-value>' | ||
| '<number-optional-number>' | ||
| '<origin>' | ||
| '<points>' | ||
| '<preserve-aspect-ratio>' | ||
| '<rotate>' | ||
| '<svg-font-size-adjust>' | ||
| '<svg-font-size>' | ||
| '<svg-path>' | ||
| '<system-language>' | ||
| '<text-coordinate>' | ||
| '<view-box>' | ||
| 'AbsoluteURL' | ||
| 'Accept' | ||
| 'Any' | ||
| 'AutoComplete' | ||
| 'BCP47' | ||
| 'BrowsingContextName' | ||
| 'BrowsingContextNameOrKeyword' | ||
| 'CustomElementName' | ||
| 'DOMID' | ||
| 'DateTime' | ||
| 'FunctionBody' | ||
| 'HTTPSchemaURL' | ||
| 'HashName' | ||
| 'IconSize' | ||
| 'Int' | ||
| 'ItemProp' | ||
| 'MIMEType' | ||
| 'NoEmptyAny' | ||
| 'Number' | ||
| 'OneCodePointChar' | ||
| 'OneLineAny' | ||
| 'Pattern' | ||
| 'SerializedPermissionsPolicy' | ||
| 'SourceSizeList' | ||
| 'Srcset' | ||
| 'TabIndex' | ||
| 'URL' | ||
| 'Uint' | ||
| 'XMLName' | ||
| 'Zero'; | ||
export type HtmlAttrRequirement = 'Boolean'; | ||
export interface TypesSchema { | ||
type?: Type; | ||
type?: Type; | ||
} | ||
@@ -20,13 +1071,15 @@ /** | ||
export interface List { | ||
token: ExtendedType | Enum; | ||
disallowToSurroundBySpaces?: boolean; | ||
allowEmpty?: boolean; | ||
ordered?: boolean; | ||
unique?: boolean; | ||
caseInsensitive?: boolean; | ||
number?: ('zeroOrMore' | 'oneOrMore') | { | ||
min: number; | ||
max: number; | ||
}; | ||
separator: 'space' | 'comma'; | ||
token: ExtendedType | Enum; | ||
disallowToSurroundBySpaces?: boolean; | ||
allowEmpty?: boolean; | ||
ordered?: boolean; | ||
unique?: boolean; | ||
caseInsensitive?: boolean; | ||
number?: | ||
| ('zeroOrMore' | 'oneOrMore') | ||
| { | ||
min: number; | ||
max: number; | ||
}; | ||
separator: 'space' | 'comma'; | ||
} | ||
@@ -37,13 +1090,13 @@ /** | ||
export interface Enum { | ||
/** | ||
* @minItems 1 | ||
*/ | ||
enum: [string, ...string[]]; | ||
disallowToSurroundBySpaces?: boolean; | ||
caseInsensitive?: boolean; | ||
invalidValueDefault?: string; | ||
missingValueDefault?: string; | ||
sameStates?: { | ||
[k: string]: unknown; | ||
}; | ||
/** | ||
* @minItems 1 | ||
*/ | ||
enum: [string, ...string[]]; | ||
disallowToSurroundBySpaces?: boolean; | ||
caseInsensitive?: boolean; | ||
invalidValueDefault?: string; | ||
missingValueDefault?: string; | ||
sameStates?: { | ||
[k: string]: unknown; | ||
}; | ||
} | ||
@@ -54,8 +1107,8 @@ /** | ||
export interface Number { | ||
type: 'float' | 'integer'; | ||
gt?: number; | ||
gte?: number; | ||
lt?: number; | ||
lte?: number; | ||
clampable?: boolean; | ||
type: 'float' | 'integer'; | ||
gt?: number; | ||
gte?: number; | ||
lt?: number; | ||
lte?: number; | ||
clampable?: boolean; | ||
} |
@@ -1,34 +0,36 @@ | ||
"use strict"; | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const check_serialized_permissions_policy_1 = require("./check-serialized-permissions-policy"); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const check_serialized_permissions_policy_1 = require('./check-serialized-permissions-policy'); | ||
const check = (0, check_serialized_permissions_policy_1.checkSerializedPermissionsPolicy)(); | ||
test('checkSerializedPermissionsPolicy', () => { | ||
expect(check('').reason).toBe('empty-token'); | ||
expect(check(' ').reason).toBe('unexpected-token'); | ||
// expect(check('a').reason).toBe('missing-token'); | ||
expect(check('a').matched).toBe(true); // Current supported | ||
expect(check('a:').reason).toBe('unexpected-token'); | ||
// expect(check('a ').reason).toBe('missing-token'); // Current supported | ||
expect(check('a ').matched).toBe(true); | ||
expect(check('a a').reason).toBe('unexpected-token'); | ||
expect(check('a *').matched).toBe(true); | ||
expect(check('a *a').reason).toBe('unexpected-token'); | ||
expect(check('a none').reason).toBe('missing-token'); | ||
expect(check("a 'none'").matched).toBe(true); | ||
expect(check('a https://markuplint.dev').matched).toBe(true); | ||
expect(check('a https://markuplint.dev/path/to').reason).toBe('extra-token'); | ||
expect(check('a https://マルチバイト.abc.xyz').reason).toBe('must-be-serialized'); | ||
expect(check('a * https://markuplint.dev').matched).toBe(true); | ||
expect(check("a * https://markuplint.dev 'none'").matched).toBe(true); | ||
// expect(check("a * https://markuplint.dev 'none';b").reason).toBe('missing-token'); | ||
expect(check("a * https://markuplint.dev 'none';b").matched).toBe(true); // Current supported | ||
// expect(check("a * https://markuplint.dev 'none';b ").reason).toBe('missing-token'); | ||
expect(check("a * https://markuplint.dev 'none';b ").matched).toBe(true); // Current supported | ||
expect(check("a * https://markuplint.dev 'none';b *").matched).toBe(true); | ||
expect(check("a * https://markuplint.dev 'none';b *;c 'none'").matched).toBe(true); | ||
expect(check("a * https://markuplint.dev 'none'; b *; c 'none'").matched).toBe(true); | ||
expect(check('').reason).toBe('empty-token'); | ||
expect(check(' ').reason).toBe('unexpected-token'); | ||
// expect(check('a').reason).toBe('missing-token'); | ||
expect(check('a').matched).toBe(true); // Current supported | ||
expect(check('a:').reason).toBe('unexpected-token'); | ||
// expect(check('a ').reason).toBe('missing-token'); // Current supported | ||
expect(check('a ').matched).toBe(true); | ||
expect(check('a a').reason).toBe('unexpected-token'); | ||
expect(check('a *').matched).toBe(true); | ||
expect(check('a *a').reason).toBe('unexpected-token'); | ||
expect(check('a none').reason).toBe('missing-token'); | ||
expect(check("a 'none'").matched).toBe(true); | ||
expect(check('a https://markuplint.dev').matched).toBe(true); | ||
expect(check('a https://markuplint.dev/path/to').reason).toBe('extra-token'); | ||
expect(check('a https://マルチバイト.abc.xyz').reason).toBe('must-be-serialized'); | ||
expect(check('a * https://markuplint.dev').matched).toBe(true); | ||
expect(check("a * https://markuplint.dev 'none'").matched).toBe(true); | ||
// expect(check("a * https://markuplint.dev 'none';b").reason).toBe('missing-token'); | ||
expect(check("a * https://markuplint.dev 'none';b").matched).toBe(true); // Current supported | ||
// expect(check("a * https://markuplint.dev 'none';b ").reason).toBe('missing-token'); | ||
expect(check("a * https://markuplint.dev 'none';b ").matched).toBe(true); // Current supported | ||
expect(check("a * https://markuplint.dev 'none';b *").matched).toBe(true); | ||
expect(check("a * https://markuplint.dev 'none';b *;c 'none'").matched).toBe(true); | ||
expect(check("a * https://markuplint.dev 'none'; b *; c 'none'").matched).toBe(true); | ||
}); | ||
test('YouTube embed', () => { | ||
expect(check('accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture').matched).toBe(true); | ||
expect( | ||
check('accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture').matched, | ||
).toBe(true); | ||
}); |
@@ -135,3 +135,3 @@ "use strict"; | ||
if (head.match(['on', 'off'], true)) { | ||
if (tail.length) { | ||
if (tail[0]) { | ||
acLog('[Unmatched ("%s")] Unexpected pair with "on" or "off": "%s"', value, tail.value); | ||
@@ -213,3 +213,3 @@ return tail[0].unmatched({ | ||
reason: 'unexpected-token', | ||
expects: contactableFieldNames.slice().map(token => ({ | ||
expects: contactableFieldNames.map(token => ({ | ||
type: 'const', | ||
@@ -247,3 +247,3 @@ value: token, | ||
if (head.match([...autofillFieldNames, ...contactableFieldNames], true)) { | ||
if (tail.length) { | ||
if (tail[0]) { | ||
if (tail[0].match(webauthnFieldNames)) { | ||
@@ -291,3 +291,3 @@ return (0, match_result_1.matched)(); | ||
if (candidatePrefix) { | ||
candidate = `${candidatePrefix}-${namedGroupStr || ''}`; | ||
candidate = `${candidatePrefix}-${namedGroupStr !== null && namedGroupStr !== void 0 ? namedGroupStr : ''}`; | ||
} | ||
@@ -306,3 +306,3 @@ } | ||
else if (!hasContactingToken) { | ||
expects.push(...contactingTokens.slice().map(token => ({ | ||
expects.push(...contactingTokens.map(token => ({ | ||
type: 'const', | ||
@@ -313,3 +313,3 @@ value: token, | ||
} | ||
candidate = candidate || (0, get_candidate_1.getCandidate)(head.value, autofillFieldNames); | ||
candidate = candidate !== null && candidate !== void 0 ? candidate : (0, get_candidate_1.getCandidate)(head.value, autofillFieldNames); | ||
if (candidate) { | ||
@@ -316,0 +316,0 @@ acLog('[Unmatched ("%s")] Unexpected token: "%s", Do you mean "%s"? ', value, head.value, candidate); |
@@ -1,379 +0,380 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const check_autocomplete_1 = require("./check-autocomplete"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const check_autocomplete_1 = require('./check-autocomplete'); | ||
const check = (0, check_autocomplete_1.checkAutoComplete)(); | ||
test('basic', () => { | ||
expect(check('on').matched).toBe(true); | ||
expect(check('on webauthn').matched).toBe(false); | ||
expect(check('off').matched).toBe(true); | ||
expect(check('off webauthn').matched).toBe(false); | ||
expect(check('name').matched).toBe(true); | ||
expect(check('given-name').matched).toBe(true); | ||
expect(check('given-name webauthn').matched).toBe(true); | ||
expect(check('given-name webauthun').matched).toBe(false); | ||
expect(check('section-').matched).toBe(true); | ||
expect(check('section-foo').matched).toBe(true); | ||
expect(check('section-foo webauthn').matched).toBe(true); | ||
expect(check('section-foo name').matched).toBe(true); | ||
expect(check('section-foo name webauthn').matched).toBe(true); | ||
expect(check('section-foo shipping name').matched).toBe(true); | ||
expect(check('section-foo billing name').matched).toBe(true); | ||
expect(check('section-foo billing home').matched).toBe(true); | ||
expect(check('section-foo billing work').matched).toBe(true); | ||
expect(check('section-foo billing home tel').matched).toBe(true); | ||
expect(check('section-foo billing work email').matched).toBe(true); | ||
expect(check('section-foo billing work email webauthn').matched).toBe(true); | ||
expect(check('shipping name').matched).toBe(true); | ||
expect(check('billing name').matched).toBe(true); | ||
expect(check('billing home').matched).toBe(true); | ||
expect(check('billing work').matched).toBe(true); | ||
expect(check('billing home tel').matched).toBe(true); | ||
expect(check('billing work email').matched).toBe(true); | ||
expect(check('billing work email webauthn').matched).toBe(true); | ||
expect(check('home tel').matched).toBe(true); | ||
expect(check('work email').matched).toBe(true); | ||
expect(check('work email webauthn').matched).toBe(true); | ||
expect(check('on').matched).toBe(true); | ||
expect(check('on webauthn').matched).toBe(false); | ||
expect(check('off').matched).toBe(true); | ||
expect(check('off webauthn').matched).toBe(false); | ||
expect(check('name').matched).toBe(true); | ||
expect(check('given-name').matched).toBe(true); | ||
expect(check('given-name webauthn').matched).toBe(true); | ||
expect(check('given-name webauthun').matched).toBe(false); | ||
expect(check('section-').matched).toBe(true); | ||
expect(check('section-foo').matched).toBe(true); | ||
expect(check('section-foo webauthn').matched).toBe(true); | ||
expect(check('section-foo name').matched).toBe(true); | ||
expect(check('section-foo name webauthn').matched).toBe(true); | ||
expect(check('section-foo shipping name').matched).toBe(true); | ||
expect(check('section-foo billing name').matched).toBe(true); | ||
expect(check('section-foo billing home').matched).toBe(true); | ||
expect(check('section-foo billing work').matched).toBe(true); | ||
expect(check('section-foo billing home tel').matched).toBe(true); | ||
expect(check('section-foo billing work email').matched).toBe(true); | ||
expect(check('section-foo billing work email webauthn').matched).toBe(true); | ||
expect(check('shipping name').matched).toBe(true); | ||
expect(check('billing name').matched).toBe(true); | ||
expect(check('billing home').matched).toBe(true); | ||
expect(check('billing work').matched).toBe(true); | ||
expect(check('billing home tel').matched).toBe(true); | ||
expect(check('billing work email').matched).toBe(true); | ||
expect(check('billing work email webauthn').matched).toBe(true); | ||
expect(check('home tel').matched).toBe(true); | ||
expect(check('work email').matched).toBe(true); | ||
expect(check('work email webauthn').matched).toBe(true); | ||
}); | ||
test('unexpected-token', () => { | ||
expect(check('section-foo , name')).toStrictEqual({ | ||
matched: false, | ||
raw: ',', | ||
offset: 12, | ||
length: 1, | ||
line: 1, | ||
column: 13, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'billing' }, | ||
{ type: 'const', value: 'shipping' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: undefined, | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo , name')).toStrictEqual({ | ||
matched: false, | ||
raw: ',', | ||
offset: 12, | ||
length: 1, | ||
line: 1, | ||
column: 13, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'billing' }, | ||
{ type: 'const', value: 'shipping' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: undefined, | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
}); | ||
test('unexpected-token', () => { | ||
expect(check('xxx')).toStrictEqual({ | ||
matched: false, | ||
raw: 'xxx', | ||
offset: 0, | ||
length: 3, | ||
line: 1, | ||
column: 1, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'common', value: 'autofill named group' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: undefined, | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('xxx')).toStrictEqual({ | ||
matched: false, | ||
raw: 'xxx', | ||
offset: 0, | ||
length: 3, | ||
line: 1, | ||
column: 1, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'common', value: 'autofill named group' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: undefined, | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
}); | ||
test('unexpected-token', () => { | ||
expect(check('section-foo neme')).toStrictEqual({ | ||
matched: false, | ||
raw: 'neme', | ||
offset: 12, | ||
length: 4, | ||
line: 1, | ||
column: 13, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'billing' }, | ||
{ type: 'const', value: 'shipping' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: 'name', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo shipping neme')).toStrictEqual({ | ||
matched: false, | ||
raw: 'neme', | ||
offset: 21, | ||
length: 4, | ||
line: 1, | ||
column: 22, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'common', value: 'autofill field name' }, | ||
{ type: 'const', value: 'home' }, | ||
{ type: 'const', value: 'work' }, | ||
{ type: 'const', value: 'mobile' }, | ||
{ type: 'const', value: 'fax' }, | ||
{ type: 'const', value: 'pager' }, | ||
], | ||
candidate: 'name', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo shipping home name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'name', | ||
offset: 26, | ||
length: 4, | ||
line: 1, | ||
column: 27, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'tel' }, | ||
{ type: 'const', value: 'tel-country-code' }, | ||
{ type: 'const', value: 'tel-national' }, | ||
{ type: 'const', value: 'tel-area-code' }, | ||
{ type: 'const', value: 'tel-local' }, | ||
{ type: 'const', value: 'tel-local-prefix' }, | ||
{ type: 'const', value: 'tel-local-suffix' }, | ||
{ type: 'const', value: 'tel-extension' }, | ||
{ type: 'const', value: 'email' }, | ||
{ type: 'const', value: 'impp' }, | ||
], | ||
candidate: undefined, | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel', | ||
}); | ||
expect(check('section-foo shipping home emall')).toStrictEqual({ | ||
matched: false, | ||
raw: 'emall', | ||
offset: 26, | ||
length: 5, | ||
line: 1, | ||
column: 27, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'tel' }, | ||
{ type: 'const', value: 'tel-country-code' }, | ||
{ type: 'const', value: 'tel-national' }, | ||
{ type: 'const', value: 'tel-area-code' }, | ||
{ type: 'const', value: 'tel-local' }, | ||
{ type: 'const', value: 'tel-local-prefix' }, | ||
{ type: 'const', value: 'tel-local-suffix' }, | ||
{ type: 'const', value: 'tel-extension' }, | ||
{ type: 'const', value: 'email' }, | ||
{ type: 'const', value: 'impp' }, | ||
], | ||
candidate: 'email', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel', | ||
}); | ||
expect(check('section-foo neme')).toStrictEqual({ | ||
matched: false, | ||
raw: 'neme', | ||
offset: 12, | ||
length: 4, | ||
line: 1, | ||
column: 13, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'billing' }, | ||
{ type: 'const', value: 'shipping' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: 'name', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo shipping neme')).toStrictEqual({ | ||
matched: false, | ||
raw: 'neme', | ||
offset: 21, | ||
length: 4, | ||
line: 1, | ||
column: 22, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'common', value: 'autofill field name' }, | ||
{ type: 'const', value: 'home' }, | ||
{ type: 'const', value: 'work' }, | ||
{ type: 'const', value: 'mobile' }, | ||
{ type: 'const', value: 'fax' }, | ||
{ type: 'const', value: 'pager' }, | ||
], | ||
candidate: 'name', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo shipping home name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'name', | ||
offset: 26, | ||
length: 4, | ||
line: 1, | ||
column: 27, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'tel' }, | ||
{ type: 'const', value: 'tel-country-code' }, | ||
{ type: 'const', value: 'tel-national' }, | ||
{ type: 'const', value: 'tel-area-code' }, | ||
{ type: 'const', value: 'tel-local' }, | ||
{ type: 'const', value: 'tel-local-prefix' }, | ||
{ type: 'const', value: 'tel-local-suffix' }, | ||
{ type: 'const', value: 'tel-extension' }, | ||
{ type: 'const', value: 'email' }, | ||
{ type: 'const', value: 'impp' }, | ||
], | ||
candidate: undefined, | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel', | ||
}); | ||
expect(check('section-foo shipping home emall')).toStrictEqual({ | ||
matched: false, | ||
raw: 'emall', | ||
offset: 26, | ||
length: 5, | ||
line: 1, | ||
column: 27, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'const', value: 'tel' }, | ||
{ type: 'const', value: 'tel-country-code' }, | ||
{ type: 'const', value: 'tel-national' }, | ||
{ type: 'const', value: 'tel-area-code' }, | ||
{ type: 'const', value: 'tel-local' }, | ||
{ type: 'const', value: 'tel-local-prefix' }, | ||
{ type: 'const', value: 'tel-local-suffix' }, | ||
{ type: 'const', value: 'tel-extension' }, | ||
{ type: 'const', value: 'email' }, | ||
{ type: 'const', value: 'impp' }, | ||
], | ||
candidate: 'email', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel', | ||
}); | ||
}); | ||
test('duplicated', () => { | ||
expect(check('name name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'name', | ||
offset: 5, | ||
length: 4, | ||
line: 1, | ||
column: 6, | ||
partName: 'the content of the list', | ||
reason: 'duplicated', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete', | ||
}); | ||
expect(check('on on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 3, | ||
length: 2, | ||
line: 1, | ||
column: 4, | ||
partName: 'the content of the list', | ||
reason: 'duplicated', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete', | ||
}); | ||
expect(check('name name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'name', | ||
offset: 5, | ||
length: 4, | ||
line: 1, | ||
column: 6, | ||
partName: 'the content of the list', | ||
reason: 'duplicated', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete', | ||
}); | ||
expect(check('on on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 3, | ||
length: 2, | ||
line: 1, | ||
column: 4, | ||
partName: 'the content of the list', | ||
reason: 'duplicated', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete', | ||
}); | ||
}); | ||
test('extra-token', () => { | ||
expect(check('on off')).toStrictEqual({ | ||
matched: false, | ||
raw: 'off', | ||
offset: 3, | ||
length: 3, | ||
line: 1, | ||
column: 4, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2', | ||
}); | ||
expect(check('off on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 4, | ||
length: 2, | ||
line: 1, | ||
column: 5, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2', | ||
}); | ||
expect(check('on name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'name', | ||
offset: 3, | ||
length: 4, | ||
line: 1, | ||
column: 4, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2', | ||
}); | ||
expect(check('name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 5, | ||
length: 2, | ||
line: 1, | ||
column: 6, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 17, | ||
length: 2, | ||
line: 1, | ||
column: 18, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo billing name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 25, | ||
length: 2, | ||
line: 1, | ||
column: 26, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('billing name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 13, | ||
length: 2, | ||
line: 1, | ||
column: 14, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 4, | ||
length: 2, | ||
line: 1, | ||
column: 5, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 9, | ||
length: 2, | ||
line: 1, | ||
column: 10, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('billing home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 17, | ||
length: 2, | ||
line: 1, | ||
column: 18, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('billing home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 17, | ||
length: 2, | ||
line: 1, | ||
column: 18, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo billing home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 29, | ||
length: 2, | ||
line: 1, | ||
column: 30, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 21, | ||
length: 2, | ||
line: 1, | ||
column: 22, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 16, | ||
length: 2, | ||
line: 1, | ||
column: 17, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('on off')).toStrictEqual({ | ||
matched: false, | ||
raw: 'off', | ||
offset: 3, | ||
length: 3, | ||
line: 1, | ||
column: 4, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2', | ||
}); | ||
expect(check('off on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 4, | ||
length: 2, | ||
line: 1, | ||
column: 5, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2', | ||
}); | ||
expect(check('on name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'name', | ||
offset: 3, | ||
length: 4, | ||
line: 1, | ||
column: 4, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2', | ||
}); | ||
expect(check('name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 5, | ||
length: 2, | ||
line: 1, | ||
column: 6, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 17, | ||
length: 2, | ||
line: 1, | ||
column: 18, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo billing name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 25, | ||
length: 2, | ||
line: 1, | ||
column: 26, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('billing name on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 13, | ||
length: 2, | ||
line: 1, | ||
column: 14, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 4, | ||
length: 2, | ||
line: 1, | ||
column: 5, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 9, | ||
length: 2, | ||
line: 1, | ||
column: 10, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('billing home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 17, | ||
length: 2, | ||
line: 1, | ||
column: 18, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('billing home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 17, | ||
length: 2, | ||
line: 1, | ||
column: 18, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo billing home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 29, | ||
length: 2, | ||
line: 1, | ||
column: 30, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo home tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 21, | ||
length: 2, | ||
line: 1, | ||
column: 22, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('section-foo tel on')).toStrictEqual({ | ||
matched: false, | ||
raw: 'on', | ||
offset: 16, | ||
length: 2, | ||
line: 1, | ||
column: 17, | ||
reason: 'extra-token', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
}); | ||
test('duplicated section', () => { | ||
expect(check('section-foo section-bar')).toStrictEqual({ | ||
matched: false, | ||
raw: 'section-bar', | ||
offset: 12, | ||
length: 11, | ||
line: 1, | ||
column: 13, | ||
partName: 'autofill named group', | ||
reason: 'duplicated', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-section', | ||
}); | ||
expect(check('section-foo section-bar')).toStrictEqual({ | ||
matched: false, | ||
raw: 'section-bar', | ||
offset: 12, | ||
length: 11, | ||
line: 1, | ||
column: 13, | ||
partName: 'autofill named group', | ||
reason: 'duplicated', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-section', | ||
}); | ||
}); | ||
test('duplicated part', () => { | ||
expect(check('shipping billing')).toStrictEqual({ | ||
matched: false, | ||
raw: 'billing', | ||
offset: 9, | ||
length: 7, | ||
line: 1, | ||
column: 10, | ||
reason: 'duplicated', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-shipping', | ||
}); | ||
expect(check('shipping billing')).toStrictEqual({ | ||
matched: false, | ||
raw: 'billing', | ||
offset: 9, | ||
length: 7, | ||
line: 1, | ||
column: 10, | ||
reason: 'duplicated', | ||
expects: [{ type: 'format', value: 'autocomplete' }], | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete-shipping', | ||
}); | ||
}); | ||
test('typo', () => { | ||
expect(check('secsion-foo name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'secsion-foo', | ||
offset: 0, | ||
length: 11, | ||
line: 1, | ||
column: 1, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'common', value: 'autofill named group' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: 'section-foo', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
expect(check('secsion-foo name')).toStrictEqual({ | ||
matched: false, | ||
raw: 'secsion-foo', | ||
offset: 0, | ||
length: 11, | ||
line: 1, | ||
column: 1, | ||
reason: 'unexpected-token', | ||
expects: [ | ||
{ type: 'common', value: 'autofill named group' }, | ||
{ type: 'common', value: 'autofill field name' }, | ||
], | ||
candidate: 'section-foo', | ||
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-field', | ||
}); | ||
}); |
import type { TokenEachCheck } from '../../token/token-collection'; | ||
export declare const datetimeTokenCheck: Record<'year' | 'month' | 'date' | 'hour' | 'minute' | 'second' | 'secondFractionalPart' | 'week' | 'hyphen' | 'colon' | 'extra' | 'colonOrEnd' | 'decimalPointOrEnd' | 'localDateTimeSeparator' | 'normalizedlocalDateTimeSeparator' | 'plusOrMinusSign' | 'weekSign', TokenEachCheck> & Record<'_year' | '_month', number | null>; | ||
export declare const datetimeTokenCheck: Record< | ||
| 'year' | ||
| 'month' | ||
| 'date' | ||
| 'hour' | ||
| 'minute' | ||
| 'second' | ||
| 'secondFractionalPart' | ||
| 'week' | ||
| 'hyphen' | ||
| 'colon' | ||
| 'extra' | ||
| 'colonOrEnd' | ||
| 'decimalPointOrEnd' | ||
| 'localDateTimeSeparator' | ||
| 'normalizedlocalDateTimeSeparator' | ||
| 'plusOrMinusSign' | ||
| 'weekSign', | ||
TokenEachCheck | ||
> & | ||
Record<'_year' | '_month', number | null>; | ||
export declare function getMaxWeekNum(year: number): number; |
@@ -98,2 +98,3 @@ "use strict"; | ||
date(date) { | ||
var _a, _b, _c; | ||
(0, debug_1.log)('Parsing Datetime Date: "%s"', date === null || date === void 0 ? void 0 : date.value); | ||
@@ -121,6 +122,6 @@ if (!date || !date.value) { | ||
// Set the leap year if _year is null | ||
const year = this._year || 2000; | ||
const year = (_a = this._year) !== null && _a !== void 0 ? _a : 2000; | ||
const isLeap = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; | ||
const month = this._month || 1; | ||
const dayOfMonth = daysOfMonth[month] + (month === 2 && isLeap ? 1 : 0); | ||
const month = (_b = this._month) !== null && _b !== void 0 ? _b : 1; | ||
const dayOfMonth = ((_c = daysOfMonth[month]) !== null && _c !== void 0 ? _c : 0) + (month === 2 && isLeap ? 1 : 0); | ||
const _date = date.toNumber(); | ||
@@ -269,2 +270,3 @@ (0, debug_1.log)('Temporary Year and Month: %s, %s', this._year, this._month); | ||
week(week) { | ||
var _a; | ||
(0, debug_1.log)('Parsing Datetime Week: "%s"', week === null || week === void 0 ? void 0 : week.value); | ||
@@ -291,3 +293,3 @@ if (!week || !week.value) { | ||
} | ||
const maxweek = getMaxWeekNum(this._year || 0); | ||
const maxweek = getMaxWeekNum((_a = this._year) !== null && _a !== void 0 ? _a : 0); | ||
const _week = week.toNumber(); | ||
@@ -501,5 +503,6 @@ if (!(1 <= _week && _week <= maxweek)) { | ||
let date = 31; | ||
while (date) { | ||
while (date > 0) { | ||
const d = new Date(Date.UTC(year, 11, date, 0, 0, 0, 0)); | ||
d.setDate(d.getDate() + 4 - (d.getDay() || 7)); | ||
const day = d.getDay(); | ||
d.setDate(d.getDate() + 4 - (day > 0 ? day : 7)); | ||
const yearStart = new Date(d.getFullYear(), 0, 1); | ||
@@ -506,0 +509,0 @@ const weekNo = Math.ceil(((d.valueOf() - yearStart.valueOf()) / 86400000 + 1) / 7); |
@@ -44,2 +44,5 @@ "use strict"; | ||
const [num, sign, extra] = token_1.TokenCollection.fromPatterns(d, [/[0-9]+/, /./]); | ||
if (!num) { | ||
return; | ||
} | ||
(0, debug_1.log)('Date part: "%s" => %O', d.value, { num, sign }); | ||
@@ -85,2 +88,3 @@ if (!num.match(/^[0-9]+$/)) { | ||
}, time => { | ||
var _a, _b, _c; | ||
if (!time) { | ||
@@ -106,3 +110,3 @@ return (0, match_result_1.unmatched)('', 'missing-token', { | ||
const [h, m, s] = timeTokens; | ||
if (((h === null || h === void 0 ? void 0 : h.value) || '') + ((m === null || m === void 0 ? void 0 : m.value) || '') + ((s === null || s === void 0 ? void 0 : s.value) || '') === '') { | ||
if (((_a = h === null || h === void 0 ? void 0 : h.value) !== null && _a !== void 0 ? _a : '') + ((_b = m === null || m === void 0 ? void 0 : m.value) !== null && _b !== void 0 ? _b : '') + ((_c = s === null || s === void 0 ? void 0 : s.value) !== null && _c !== void 0 ? _c : '') === '') { | ||
return (0, match_result_1.unmatched)('', 'missing-token', { | ||
@@ -118,3 +122,3 @@ expects: [ | ||
for (const t of timeTokens) { | ||
if (!t || !t.value) { | ||
if (!t.value) { | ||
continue; | ||
@@ -128,2 +132,5 @@ } | ||
const [num, dpfp, sign] = token_1.TokenCollection.fromPatterns(t, [/[0-9]+/, /(\.[0-9]*)?/, /[^0-9]+/]); | ||
if (!num) { | ||
continue; | ||
} | ||
(0, debug_1.log)('Time part (h|m|s): "%s" => %O', t.value, { num, dpfp, sign }); | ||
@@ -139,2 +146,5 @@ if (!num.match(/^[0-9]+$/)) { | ||
const [dp, fp] = token_1.TokenCollection.fromPatterns(dpfp, [/\./, /[0-9]+/]); | ||
if (!dp) { | ||
continue; | ||
} | ||
(0, debug_1.log)('Second fractional part (h|m|s): "%s" => %O', dpfp.value, { dp, fp }); | ||
@@ -141,0 +151,0 @@ if (!dp.match('.')) { |
@@ -1,16 +0,17 @@ | ||
"use strict"; | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const date_string_1 = require("./date-string"); | ||
const datetime_tokens_1 = require("./datetime-tokens"); | ||
const duration_string_1 = require("./duration-string"); | ||
const global_date_and_time_string_1 = require("./global-date-and-time-string"); | ||
const local_date_and_time_string_1 = require("./local-date-and-time-string"); | ||
const month_string_1 = require("./month-string"); | ||
const time_string_1 = require("./time-string"); | ||
const time_zone_offset_string_1 = require("./time-zone-offset-string"); | ||
const week_string_1 = require("./week-string"); | ||
const year_string_1 = require("./year-string"); | ||
const yearless_date_string_1 = require("./yearless-date-string"); | ||
const _1 = require("."); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const date_string_1 = require('./date-string'); | ||
const datetime_tokens_1 = require('./datetime-tokens'); | ||
const duration_string_1 = require('./duration-string'); | ||
const global_date_and_time_string_1 = require('./global-date-and-time-string'); | ||
const local_date_and_time_string_1 = require('./local-date-and-time-string'); | ||
const month_string_1 = require('./month-string'); | ||
const time_string_1 = require('./time-string'); | ||
const time_zone_offset_string_1 = require('./time-zone-offset-string'); | ||
const week_string_1 = require('./week-string'); | ||
const year_string_1 = require('./year-string'); | ||
const yearless_date_string_1 = require('./yearless-date-string'); | ||
const _1 = require('.'); | ||
const isMonth = (0, month_string_1.checkMonthString)(); | ||
@@ -30,290 +31,290 @@ const isDate = (0, date_string_1.checkDateString)(); | ||
test('max-week', () => { | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1976)).toBe(53); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1977)).toBe(52); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1978)).toBe(52); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1979)).toBe(52); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1981)).toBe(53); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1976)).toBe(53); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1977)).toBe(52); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1978)).toBe(52); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1979)).toBe(52); | ||
expect((0, datetime_tokens_1.getMaxWeekNum)(1981)).toBe(53); | ||
}); | ||
test('month-string', () => { | ||
expect(isMonth('').reason).toBe('empty-token'); | ||
expect(isMonth(' ').reason).toBe('unexpected-token'); | ||
expect(isMonth('a').reason).toBe('unexpected-token'); | ||
expect(isMonth('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isMonth('0000').reason).toStrictEqual({ type: 'out-of-range', gt: 0 }); | ||
expect(isMonth('0001').reason).toBe('missing-token'); | ||
expect(isMonth('0001:').reason).toBe('unexpected-token'); | ||
expect(isMonth('0001-').reason).toBe('missing-token'); | ||
expect(isMonth('0001-a').reason).toBe('unexpected-token'); | ||
expect(isMonth('0001-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isMonth('0001-001').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isMonth('0001-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isMonth('0001-13').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isMonth('0001-01').matched).toBe(true); | ||
expect(isMonth('0001-12').matched).toBe(true); | ||
expect(isMonth('10001-01').matched).toBe(true); | ||
expect(isMonth('0001-01-').reason).toBe('extra-token'); | ||
expect(isMonth('').reason).toBe('empty-token'); | ||
expect(isMonth(' ').reason).toBe('unexpected-token'); | ||
expect(isMonth('a').reason).toBe('unexpected-token'); | ||
expect(isMonth('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isMonth('0000').reason).toStrictEqual({ type: 'out-of-range', gt: 0 }); | ||
expect(isMonth('0001').reason).toBe('missing-token'); | ||
expect(isMonth('0001:').reason).toBe('unexpected-token'); | ||
expect(isMonth('0001-').reason).toBe('missing-token'); | ||
expect(isMonth('0001-a').reason).toBe('unexpected-token'); | ||
expect(isMonth('0001-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isMonth('0001-001').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isMonth('0001-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isMonth('0001-13').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isMonth('0001-01').matched).toBe(true); | ||
expect(isMonth('0001-12').matched).toBe(true); | ||
expect(isMonth('10001-01').matched).toBe(true); | ||
expect(isMonth('0001-01-').reason).toBe('extra-token'); | ||
}); | ||
test('date-string', () => { | ||
expect(isDate('').reason).toBe('empty-token'); | ||
expect(isDate(' ').reason).toBe('unexpected-token'); | ||
expect(isDate('a').reason).toBe('unexpected-token'); | ||
expect(isDate('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isDate('0000').reason).toStrictEqual({ type: 'out-of-range', gt: 0 }); | ||
expect(isDate('2000').reason).toBe('missing-token'); | ||
expect(isDate('2000:').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-').reason).toBe('missing-token'); | ||
expect(isDate('2000-a').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isDate('2000-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isDate('2000-01').reason).toBe('missing-token'); | ||
expect(isDate('2000-01:').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-01-').reason).toBe('missing-token'); | ||
expect(isDate('2000-01-a').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-01-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isDate('2000-01-001').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isDate('2000-01-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isDate('2000-01-01').matched).toBe(true); | ||
expect(isDate('2000-01-31').matched).toBe(true); | ||
expect(isDate('2000-01-32').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isDate('2000-02-28').matched).toBe(true); | ||
expect(isDate('2000-02-29').matched).toBe(true); | ||
expect(isDate('2000-02-30').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 29 }); | ||
expect(isDate('2001-02-28').matched).toBe(true); | ||
expect(isDate('2001-02-29').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 28 }); | ||
expect(isDate('').reason).toBe('empty-token'); | ||
expect(isDate(' ').reason).toBe('unexpected-token'); | ||
expect(isDate('a').reason).toBe('unexpected-token'); | ||
expect(isDate('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isDate('0000').reason).toStrictEqual({ type: 'out-of-range', gt: 0 }); | ||
expect(isDate('2000').reason).toBe('missing-token'); | ||
expect(isDate('2000:').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-').reason).toBe('missing-token'); | ||
expect(isDate('2000-a').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isDate('2000-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isDate('2000-01').reason).toBe('missing-token'); | ||
expect(isDate('2000-01:').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-01-').reason).toBe('missing-token'); | ||
expect(isDate('2000-01-a').reason).toBe('unexpected-token'); | ||
expect(isDate('2000-01-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isDate('2000-01-001').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isDate('2000-01-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isDate('2000-01-01').matched).toBe(true); | ||
expect(isDate('2000-01-31').matched).toBe(true); | ||
expect(isDate('2000-01-32').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isDate('2000-02-28').matched).toBe(true); | ||
expect(isDate('2000-02-29').matched).toBe(true); | ||
expect(isDate('2000-02-30').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 29 }); | ||
expect(isDate('2001-02-28').matched).toBe(true); | ||
expect(isDate('2001-02-29').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 28 }); | ||
}); | ||
test('yearless-date-string', () => { | ||
expect(isYearlessDate('').reason).toBe('empty-token'); | ||
expect(isYearlessDate(' ').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('a').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isYearlessDate('00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isYearlessDate('01').reason).toBe('missing-token'); | ||
expect(isYearlessDate('01:').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('01-').reason).toBe('missing-token'); | ||
expect(isYearlessDate('01-a').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('01-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isYearlessDate('01-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isYearlessDate('01-01').matched).toBe(true); | ||
expect(isYearlessDate('01-31').matched).toBe(true); | ||
expect(isYearlessDate('01-32').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isYearlessDate('02-28').matched).toBe(true); | ||
expect(isYearlessDate('02-29').matched).toBe(true); | ||
expect(isYearlessDate('02-30').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 29 }); | ||
expect(isYearlessDate('').reason).toBe('empty-token'); | ||
expect(isYearlessDate(' ').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('a').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isYearlessDate('00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 12 }); | ||
expect(isYearlessDate('01').reason).toBe('missing-token'); | ||
expect(isYearlessDate('01:').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('01-').reason).toBe('missing-token'); | ||
expect(isYearlessDate('01-a').reason).toBe('unexpected-token'); | ||
expect(isYearlessDate('01-0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isYearlessDate('01-00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isYearlessDate('01-01').matched).toBe(true); | ||
expect(isYearlessDate('01-31').matched).toBe(true); | ||
expect(isYearlessDate('01-32').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 31 }); | ||
expect(isYearlessDate('02-28').matched).toBe(true); | ||
expect(isYearlessDate('02-29').matched).toBe(true); | ||
expect(isYearlessDate('02-30').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 29 }); | ||
}); | ||
test('time-string', () => { | ||
expect(isTimeString('').reason).toBe('empty-token'); | ||
expect(isTimeString(' ').reason).toBe('unexpected-token'); | ||
expect(isTimeString('a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('24').reason).toStrictEqual({ type: 'out-of-range', gte: 0, lte: 23 }); | ||
expect(isTimeString('00').reason).toBe('missing-token'); | ||
expect(isTimeString('00-').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:').reason).toBe('missing-token'); | ||
expect(isTimeString('00:a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:00').matched).toBe(true); | ||
expect(isTimeString('00:59').matched).toBe(true); | ||
expect(isTimeString('00:60').reason).toStrictEqual({ type: 'out-of-range', gte: 0, lte: 59 }); | ||
expect(isTimeString('00:00-').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:').reason).toBe('missing-token'); | ||
expect(isTimeString('00:00:a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:00:000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:00:00').matched).toBe(true); | ||
expect(isTimeString('00:00:59').matched).toBe(true); | ||
expect(isTimeString('00:00:60').reason).toStrictEqual({ type: 'out-of-range', gte: 0, lte: 59 }); | ||
expect(isTimeString('00:00:00:').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:00.').reason).toBe('missing-token'); | ||
expect(isTimeString('00:00:00.a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:00.0').matched).toBe(true); | ||
expect(isTimeString('00:00:00.9').matched).toBe(true); | ||
expect(isTimeString('00:00:00.00').matched).toBe(true); | ||
expect(isTimeString('00:00:00.99').matched).toBe(true); | ||
expect(isTimeString('00:00:00.000').matched).toBe(true); | ||
expect(isTimeString('00:00:00.999').matched).toBe(true); | ||
expect(isTimeString('00:00:00.0000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 1, lte: 3 }); | ||
expect(isTimeString('00:00:00.1000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 1, lte: 3 }); | ||
expect(isTimeString('').reason).toBe('empty-token'); | ||
expect(isTimeString(' ').reason).toBe('unexpected-token'); | ||
expect(isTimeString('a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('24').reason).toStrictEqual({ type: 'out-of-range', gte: 0, lte: 23 }); | ||
expect(isTimeString('00').reason).toBe('missing-token'); | ||
expect(isTimeString('00-').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:').reason).toBe('missing-token'); | ||
expect(isTimeString('00:a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:00').matched).toBe(true); | ||
expect(isTimeString('00:59').matched).toBe(true); | ||
expect(isTimeString('00:60').reason).toStrictEqual({ type: 'out-of-range', gte: 0, lte: 59 }); | ||
expect(isTimeString('00:00-').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:').reason).toBe('missing-token'); | ||
expect(isTimeString('00:00:a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:00:000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isTimeString('00:00:00').matched).toBe(true); | ||
expect(isTimeString('00:00:59').matched).toBe(true); | ||
expect(isTimeString('00:00:60').reason).toStrictEqual({ type: 'out-of-range', gte: 0, lte: 59 }); | ||
expect(isTimeString('00:00:00:').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:00.').reason).toBe('missing-token'); | ||
expect(isTimeString('00:00:00.a').reason).toBe('unexpected-token'); | ||
expect(isTimeString('00:00:00.0').matched).toBe(true); | ||
expect(isTimeString('00:00:00.9').matched).toBe(true); | ||
expect(isTimeString('00:00:00.00').matched).toBe(true); | ||
expect(isTimeString('00:00:00.99').matched).toBe(true); | ||
expect(isTimeString('00:00:00.000').matched).toBe(true); | ||
expect(isTimeString('00:00:00.999').matched).toBe(true); | ||
expect(isTimeString('00:00:00.0000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 1, lte: 3 }); | ||
expect(isTimeString('00:00:00.1000').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 1, lte: 3 }); | ||
}); | ||
test('local-date-and-time-string', () => { | ||
expect(isLocalDateAndTime('').reason).toBe('empty-token'); | ||
expect(isLocalDateAndTime(' ').reason).toBe('unexpected-token'); | ||
expect(isLocalDateAndTime('2020-12-31').reason).toBe('missing-token'); | ||
expect(isLocalDateAndTime('2020-12-31:').reason).toBe('unexpected-token'); | ||
expect(isLocalDateAndTime('2020-12-31T').reason).toBe('missing-token'); | ||
expect(isLocalDateAndTime('2020-12-31 ').reason).toBe('missing-token'); | ||
expect(isLocalDateAndTime('2020-12-31 ').reason).toBe('unexpected-token'); | ||
expect(isLocalDateAndTime('2020-12-31T00:00:00.000').matched).toBe(true); | ||
expect(isLocalDateAndTime('').reason).toBe('empty-token'); | ||
expect(isLocalDateAndTime(' ').reason).toBe('unexpected-token'); | ||
expect(isLocalDateAndTime('2020-12-31').reason).toBe('missing-token'); | ||
expect(isLocalDateAndTime('2020-12-31:').reason).toBe('unexpected-token'); | ||
expect(isLocalDateAndTime('2020-12-31T').reason).toBe('missing-token'); | ||
expect(isLocalDateAndTime('2020-12-31 ').reason).toBe('missing-token'); | ||
expect(isLocalDateAndTime('2020-12-31 ').reason).toBe('unexpected-token'); | ||
expect(isLocalDateAndTime('2020-12-31T00:00:00.000').matched).toBe(true); | ||
}); | ||
test('normalized-local-date-and-time-string', () => { | ||
expect(isNormalizedLocalDateAndTime('').reason).toBe('empty-token'); | ||
expect(isNormalizedLocalDateAndTime(' ').reason).toBe('unexpected-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31').reason).toBe('missing-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31:').reason).toBe('unexpected-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T').reason).toBe('missing-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31 ').reason).toBe('unexpected-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00').matched).toBe(true); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:01').matched).toBe(true); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.0').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.00').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.000').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.001').matched).toBe(true); | ||
expect(isNormalizedLocalDateAndTime('').reason).toBe('empty-token'); | ||
expect(isNormalizedLocalDateAndTime(' ').reason).toBe('unexpected-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31').reason).toBe('missing-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31:').reason).toBe('unexpected-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T').reason).toBe('missing-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31 ').reason).toBe('unexpected-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00').matched).toBe(true); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:01').matched).toBe(true); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.0').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.00').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.000').reason).toBe('extra-token'); | ||
expect(isNormalizedLocalDateAndTime('2020-12-31T00:00:00.001').matched).toBe(true); | ||
}); | ||
test('time-zone-offset', () => { | ||
expect(isTimeZoneOffset('').reason).toBe('empty-token'); | ||
expect(isTimeZoneOffset(' ').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('a').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('z').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('Z').matched).toBe(true); | ||
expect(isTimeZoneOffset('Z:').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('ZZ').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('+').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('-').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('+-').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('+00').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('+00:').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('+00:00').matched).toBe(true); | ||
expect(isTimeZoneOffset('+24:00').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00:60').matched).toBe(false); | ||
expect(isTimeZoneOffset('+000:00').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00:000').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00:00:').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('+0000').matched).toBe(true); | ||
expect(isTimeZoneOffset('+2400').matched).toBe(false); | ||
expect(isTimeZoneOffset('+0060').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00000').matched).toBe(false); | ||
expect(isTimeZoneOffset('+0000:').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('').reason).toBe('empty-token'); | ||
expect(isTimeZoneOffset(' ').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('a').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('z').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('Z').matched).toBe(true); | ||
expect(isTimeZoneOffset('Z:').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('ZZ').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('+').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('-').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('+-').reason).toBe('unexpected-token'); | ||
expect(isTimeZoneOffset('+00').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('+00:').reason).toBe('missing-token'); | ||
expect(isTimeZoneOffset('+00:00').matched).toBe(true); | ||
expect(isTimeZoneOffset('+24:00').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00:60').matched).toBe(false); | ||
expect(isTimeZoneOffset('+000:00').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00:000').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00:00:').reason).toBe('extra-token'); | ||
expect(isTimeZoneOffset('+0000').matched).toBe(true); | ||
expect(isTimeZoneOffset('+2400').matched).toBe(false); | ||
expect(isTimeZoneOffset('+0060').matched).toBe(false); | ||
expect(isTimeZoneOffset('+00000').matched).toBe(false); | ||
expect(isTimeZoneOffset('+0000:').reason).toBe('extra-token'); | ||
}); | ||
test('global-date-and-time-string', () => { | ||
expect(isGlobalDateAndTime('2000-01-01').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00Z').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+00').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+0000').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+00:00').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00-2359').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00-23:59').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00:00+0000').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00:00.000+0000').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00:00.000+0000a').reason).toBe('extra-token'); | ||
expect(isGlobalDateAndTime('2000-01-01').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00Z').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+00').reason).toBe('missing-token'); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+0000').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00+00:00').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00-2359').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00-23:59').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00:00+0000').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00:00.000+0000').matched).toBe(true); | ||
expect(isGlobalDateAndTime('2000-01-01T00:00:00.000+0000a').reason).toBe('extra-token'); | ||
}); | ||
test('week-string', () => { | ||
expect(isWeek('').reason).toBe('empty-token'); | ||
expect(isWeek(' ').reason).toBe('unexpected-token'); | ||
expect(isWeek('a').reason).toBe('unexpected-token'); | ||
expect(isWeek('2000').reason).toBe('missing-token'); | ||
expect(isWeek('2000-').reason).toBe('missing-token'); | ||
expect(isWeek('2000-a').reason).toBe('unexpected-token'); | ||
expect(isWeek('2000-W').reason).toBe('missing-token'); | ||
expect(isWeek('2000-Wa').reason).toBe('unexpected-token'); | ||
expect(isWeek('2000-W0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isWeek('2000-W00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 52 }); | ||
expect(isWeek('2000-W53').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 52 }); | ||
expect(isWeek('2000-W01').matched).toBe(true); | ||
expect(isWeek('2000-W52').matched).toBe(true); | ||
expect(isWeek('2004-W00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 53 }); | ||
expect(isWeek('2004-W54').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 53 }); | ||
expect(isWeek('2004-W01').matched).toBe(true); | ||
expect(isWeek('2004-W53').matched).toBe(true); | ||
expect(isWeek('2000-W01a').reason).toBe('extra-token'); | ||
expect(isWeek('').reason).toBe('empty-token'); | ||
expect(isWeek(' ').reason).toBe('unexpected-token'); | ||
expect(isWeek('a').reason).toBe('unexpected-token'); | ||
expect(isWeek('2000').reason).toBe('missing-token'); | ||
expect(isWeek('2000-').reason).toBe('missing-token'); | ||
expect(isWeek('2000-a').reason).toBe('unexpected-token'); | ||
expect(isWeek('2000-W').reason).toBe('missing-token'); | ||
expect(isWeek('2000-Wa').reason).toBe('unexpected-token'); | ||
expect(isWeek('2000-W0').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 2, lte: 2 }); | ||
expect(isWeek('2000-W00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 52 }); | ||
expect(isWeek('2000-W53').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 52 }); | ||
expect(isWeek('2000-W01').matched).toBe(true); | ||
expect(isWeek('2000-W52').matched).toBe(true); | ||
expect(isWeek('2004-W00').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 53 }); | ||
expect(isWeek('2004-W54').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 53 }); | ||
expect(isWeek('2004-W01').matched).toBe(true); | ||
expect(isWeek('2004-W53').matched).toBe(true); | ||
expect(isWeek('2000-W01a').reason).toBe('extra-token'); | ||
}); | ||
test('year-string', () => { | ||
expect(isYear('').reason).toBe('empty-token'); | ||
expect(isYear(' ').reason).toBe('unexpected-token'); | ||
expect(isYear('a').reason).toBe('unexpected-token'); | ||
expect(isYear('200').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isYear('2000').matched).toBe(true); | ||
expect(isYear('20000').matched).toBe(true); | ||
expect(isYear('').reason).toBe('empty-token'); | ||
expect(isYear(' ').reason).toBe('unexpected-token'); | ||
expect(isYear('a').reason).toBe('unexpected-token'); | ||
expect(isYear('200').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isYear('2000').matched).toBe(true); | ||
expect(isYear('20000').matched).toBe(true); | ||
}); | ||
test('duration-string (IS08601 like)', () => { | ||
expect(isDurationISO8601Like('').reason).toBe('empty-token'); | ||
expect(isDurationISO8601Like(' ').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('a').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0D').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0H').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0Dt').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0M0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0M0.').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0M').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.0M').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.0000').reason).toStrictEqual({ | ||
gte: 1, | ||
lte: 3, | ||
type: 'out-of-range-length-digit', | ||
}); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000S0').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000S0H').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('P0DT0M').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0.0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0M0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0.0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0M0H').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT0S0M').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('P0DT0.0S0M').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('PT4H18M3S').matched).toBe(true); | ||
expect(isDurationISO8601Like('').reason).toBe('empty-token'); | ||
expect(isDurationISO8601Like(' ').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('a').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0D').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0H').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0Dt').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0M0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0M0.').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0M').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.0').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.0M').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000').reason).toBe('missing-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.0000').reason).toStrictEqual({ | ||
gte: 1, | ||
lte: 3, | ||
type: 'out-of-range-length-digit', | ||
}); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000S0').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('P0DT0H0M0.000S0H').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('P0DT0M').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0.0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0M0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0H0.0S').matched).toBe(true); | ||
expect(isDurationISO8601Like('P0DT0M0H').reason).toBe('unexpected-token'); | ||
expect(isDurationISO8601Like('P0DT0S0M').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('P0DT0.0S0M').reason).toBe('extra-token'); | ||
expect(isDurationISO8601Like('PT4H18M3S').matched).toBe(true); | ||
}); | ||
test('duration-string (duration component list)', () => { | ||
expect(isDurationComponentList('').reason).toBe('empty-token'); | ||
expect(isDurationComponentList(' ').reason).toBe('missing-token'); | ||
expect(isDurationComponentList(' a').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList(' 0').reason).toBe('missing-token'); | ||
expect(isDurationComponentList(' 0a').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList(' 0w').matched).toBe(true); | ||
expect(isDurationComponentList(' 0ww').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0w').matched).toBe(true); | ||
expect(isDurationComponentList('0w ').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0').reason).toBe('missing-token'); | ||
expect(isDurationComponentList('0w 0w').reason).toBe('duplicated'); | ||
expect(isDurationComponentList('0w 0d').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d').matched).toBe(true); | ||
expect(isDurationComponentList(' 0w 0d').matched).toBe(true); | ||
expect(isDurationComponentList(' 0w 0d ').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d ').matched).toBe(true); | ||
expect(isDurationComponentList('\n0w\n0d\n').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.').reason).toBe('missing-token'); | ||
expect(isDurationComponentList('0w 0.0').reason).toBe('missing-token'); | ||
expect(isDurationComponentList('0w 0.0s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.0d').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0s 0.').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0s 0.0').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0s 0.0s').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0w 0.00s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.000s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.0000s').reason).toStrictEqual({ | ||
gte: 1, | ||
lte: 3, | ||
type: 'out-of-range-length-digit', | ||
}); | ||
expect(isDurationComponentList('0s 0.000s').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0.000s 0s').reason).toBe('duplicated'); | ||
expect(isDurationComponentList('0w0d0h0m0.000s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d 0h 0m 0.000s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d0h 0m0.000s').matched).toBe(true); | ||
expect(isDurationComponentList(' 2w 3d6m 3.4s 93xxxxxxx').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('').reason).toBe('empty-token'); | ||
expect(isDurationComponentList(' ').reason).toBe('missing-token'); | ||
expect(isDurationComponentList(' a').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList(' 0').reason).toBe('missing-token'); | ||
expect(isDurationComponentList(' 0a').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList(' 0w').matched).toBe(true); | ||
expect(isDurationComponentList(' 0ww').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0w').matched).toBe(true); | ||
expect(isDurationComponentList('0w ').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0').reason).toBe('missing-token'); | ||
expect(isDurationComponentList('0w 0w').reason).toBe('duplicated'); | ||
expect(isDurationComponentList('0w 0d').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d').matched).toBe(true); | ||
expect(isDurationComponentList(' 0w 0d').matched).toBe(true); | ||
expect(isDurationComponentList(' 0w 0d ').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d ').matched).toBe(true); | ||
expect(isDurationComponentList('\n0w\n0d\n').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.').reason).toBe('missing-token'); | ||
expect(isDurationComponentList('0w 0.0').reason).toBe('missing-token'); | ||
expect(isDurationComponentList('0w 0.0s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.0d').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0s 0.').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0s 0.0').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0s 0.0s').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0w 0.00s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.000s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0.0000s').reason).toStrictEqual({ | ||
gte: 1, | ||
lte: 3, | ||
type: 'out-of-range-length-digit', | ||
}); | ||
expect(isDurationComponentList('0s 0.000s').reason).toBe('unexpected-token'); | ||
expect(isDurationComponentList('0.000s 0s').reason).toBe('duplicated'); | ||
expect(isDurationComponentList('0w0d0h0m0.000s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d 0h 0m 0.000s').matched).toBe(true); | ||
expect(isDurationComponentList('0w 0d0h 0m0.000s').matched).toBe(true); | ||
expect(isDurationComponentList(' 2w 3d6m 3.4s 93xxxxxxx').reason).toBe('unexpected-token'); | ||
}); | ||
test('date-time', () => { | ||
expect(isDateTime('200-1-1').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isDateTime('2001-02-29').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 28 }); | ||
expect(isDateTime('2001-02-28T').reason).toBe('missing-token'); | ||
expect(isDateTime('2001-02-28T00').reason).toBe('missing-token'); | ||
expect(isDateTime('2001-02-28T00:0').reason).toStrictEqual({ gte: 2, lte: 2, type: 'out-of-range-length-digit' }); | ||
expect(isDateTime('2000-01-01T00:00:00.000+0000a').reason).toBe('extra-token'); | ||
expect(isDateTime('P0DT0M0H').reason).toBe('unexpected-token'); | ||
expect(isDateTime('200-1-1').reason).toStrictEqual({ type: 'out-of-range-length-digit', gte: 4 }); | ||
expect(isDateTime('2001-02-29').reason).toStrictEqual({ type: 'out-of-range', gte: 1, lte: 28 }); | ||
expect(isDateTime('2001-02-28T').reason).toBe('missing-token'); | ||
expect(isDateTime('2001-02-28T00').reason).toBe('missing-token'); | ||
expect(isDateTime('2001-02-28T00:0').reason).toStrictEqual({ gte: 2, lte: 2, type: 'out-of-range-length-digit' }); | ||
expect(isDateTime('2000-01-01T00:00:00.000+0000a').reason).toBe('extra-token'); | ||
expect(isDateTime('P0DT0M0H').reason).toBe('unexpected-token'); | ||
}); |
@@ -94,4 +94,8 @@ "use strict"; | ||
const [, , , , , , , , , , second, , fp] = tokens; | ||
const _second = second.toNumber() || 0; | ||
const _fp = fp.toNumber() || 0; | ||
if (!second || !fp) { | ||
(0, debug_1.log)('Failed: %O', res); | ||
return res; | ||
} | ||
const _second = second.toNumber(); | ||
const _fp = fp.toNumber(); | ||
(0, debug_1.log)('Omitting the seconds component: "%s.%s" => %d, %d', second === null || second === void 0 ? void 0 : second.value, fp === null || fp === void 0 ? void 0 : fp.value, _second, _fp); | ||
@@ -98,0 +102,0 @@ if (second.value && _second === 0 && (!fp.value || (fp.value && _fp === 0))) { |
@@ -7,2 +7,2 @@ import type { Token } from '../../token'; | ||
export declare const checkTimeZoneOffsetString: CustomSyntaxChecker; | ||
export declare function parseTimeZone(zone: string | Token): import("../../types").Result; | ||
export declare function parseTimeZone(zone: string | Readonly<Token>): import('../../types').Result; |
@@ -30,2 +30,3 @@ "use strict"; | ||
const res = zoneTokens.eachCheck((sign, tail) => { | ||
var _a, _b; | ||
if (!sign || !sign.value) { | ||
@@ -43,5 +44,5 @@ return (0, match_result_1.unmatched)(value, 'missing-token', { | ||
if (tail.value) { | ||
return tail[0].unmatched({ | ||
return ((_b = (_a = tail[0]) === null || _a === void 0 ? void 0 : _a.unmatched({ | ||
reason: 'extra-token', | ||
}); | ||
})) !== null && _b !== void 0 ? _b : (0, match_result_1.unmatched)(tail.value, 'extra-token')); | ||
} | ||
@@ -48,0 +49,0 @@ return (0, match_result_1.matched)(); |
@@ -7,6 +7,6 @@ import type { CustomSyntaxChecker } from '../types'; | ||
export declare const checkMIMEType: CustomSyntaxChecker<{ | ||
/** | ||
* @see https://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters | ||
*/ | ||
withoutParameters?: boolean; | ||
/** | ||
* @see https://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters | ||
*/ | ||
withoutParameters?: boolean; | ||
}>; |
@@ -30,3 +30,3 @@ "use strict"; | ||
} | ||
if (!withoutParameters && mimeType.parameters.size) { | ||
if (!withoutParameters && mimeType.parameters.size > 0) { | ||
return (0, match_result_1.matched)(); | ||
@@ -33,0 +33,0 @@ } |
@@ -1,58 +0,59 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const check_mime_type_1 = require("./check-mime-type"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const check_mime_type_1 = require('./check-mime-type'); | ||
const check = (0, check_mime_type_1.checkMIMEType)(); | ||
const checkNoParam = (0, check_mime_type_1.checkMIMEType)({ withoutParameters: true }); | ||
test('valid', () => { | ||
expect(check('x/y').matched).toBe(true); | ||
expect(check('x/y;a=b;c=D;E="F"').matched).toBe(true); | ||
expect(check('x/y').matched).toBe(true); | ||
expect(check('x/y;a=b;c=D;E="F"').matched).toBe(true); | ||
}); | ||
test('excrescence-token', () => { | ||
expect(check('xy;')).toStrictEqual({ | ||
column: 1, | ||
expects: [{ type: 'format', value: 'MIME Type' }], | ||
length: 3, | ||
line: 1, | ||
matched: false, | ||
offset: 0, | ||
raw: 'xy;', | ||
reason: 'syntax-error', | ||
ref: null, | ||
}); | ||
expect(check('x/y;')).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type' }], | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect(checkNoParam('x/y;')).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect(checkNoParam('x/y;a=b;c=D;E="F"')).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 14, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';a=b;c=D;E="F"', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect(check('xy;')).toStrictEqual({ | ||
column: 1, | ||
expects: [{ type: 'format', value: 'MIME Type' }], | ||
length: 3, | ||
line: 1, | ||
matched: false, | ||
offset: 0, | ||
raw: 'xy;', | ||
reason: 'syntax-error', | ||
ref: null, | ||
}); | ||
expect(check('x/y;')).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type' }], | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect(checkNoParam('x/y;')).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 1, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
expect(checkNoParam('x/y;a=b;c=D;E="F"')).toStrictEqual({ | ||
candidate: 'x/y', | ||
column: 4, | ||
expects: [{ type: 'format', value: 'MIME Type with no parameters' }], | ||
length: 14, | ||
line: 1, | ||
matched: false, | ||
offset: 3, | ||
raw: ';a=b;c=D;E="F"', | ||
reason: 'extra-token', | ||
ref: null, | ||
}); | ||
}); |
@@ -1,8 +0,9 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const is_abs_url_1 = require("./is-abs-url"); | ||
'use strict'; | ||
// @ts-nocheck | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const is_abs_url_1 = require('./is-abs-url'); | ||
const is = (0, is_abs_url_1.isAbsURL)(); | ||
test('valid', () => { | ||
expect(is('https://markuplint.dev')).toBe(true); | ||
expect(is('markuplint.dev')).toBe(false); | ||
expect(is('https://markuplint.dev')).toBe(true); | ||
expect(is('markuplint.dev')).toBe(false); | ||
}); |
@@ -16,5 +16,5 @@ "use strict"; | ||
return value => { | ||
return value.indexOf(':') === -1 && value.indexOf('.') === -1 && value.indexOf(' ') === -1; | ||
return !value.includes(':') && !value.includes('.') && !value.includes(' '); | ||
}; | ||
}; | ||
exports.isItempropName = isItempropName; |
{ | ||
"name": "@markuplint/types", | ||
"version": "3.0.0-dev.96+3b9f1720", | ||
"version": "3.0.0-dev.176+f6ad62e9", | ||
"description": "Type declaration and value checker", | ||
@@ -23,2 +23,6 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"dependencies": { | ||
"@types/bcp-47": "1", | ||
"@types/css-tree": "^2.0.1", | ||
"@types/debug": "^4.1.7", | ||
"@types/whatwg-mimetype": "3.0.0", | ||
"bcp-47": "1", | ||
@@ -28,11 +32,6 @@ "css-tree": "^2.3.1", | ||
"leven": "3", | ||
"whatwg-mimetype": "2" | ||
"type-fest": "^3.8.0", | ||
"whatwg-mimetype": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/bcp-47": "1", | ||
"@types/css-tree": "^2.0.1", | ||
"@types/debug": "^4.1.7", | ||
"@types/whatwg-mimetype": "2" | ||
}, | ||
"gitHead": "3b9f17205d7754b29edf790bdbbf5e4931ba27a2" | ||
"gitHead": "f6ad62e992e1569be4067f1e90d2d6017a658f57" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
347470
0
130
9644
10
+ Added@types/bcp-47@1
+ Added@types/css-tree@^2.0.1
+ Added@types/debug@^4.1.7
+ Added@types/whatwg-mimetype@3.0.0
+ Addedtype-fest@^3.8.0
+ Added@types/bcp-47@1.0.0(transitive)
+ Added@types/css-tree@2.3.9(transitive)
+ Added@types/debug@4.1.12(transitive)
+ Added@types/ms@0.7.34(transitive)
+ Added@types/whatwg-mimetype@3.0.0(transitive)
+ Addedtype-fest@3.13.1(transitive)
+ Addedwhatwg-mimetype@3.0.0(transitive)
- Removedwhatwg-mimetype@2.3.0(transitive)
Updatedwhatwg-mimetype@^3.0.0