@markuplint/types 5.0.0-alpha.1 → 5.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/check-multi-types.d.ts +1 -1
- package/lib/css-defs.js +12 -12
- package/lib/match-result.d.ts +1 -1
- package/lib/token/token-collection.d.ts +2 -2
- package/lib/token/token-collection.js +14 -14
- package/lib/token/token.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-alpha.3](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2026-02-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @markuplint/types
|
|
9
|
+
|
|
10
|
+
# [5.0.0-alpha.2](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-02-23)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @markuplint/types
|
|
13
|
+
|
|
6
14
|
# [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @markuplint/types
|
|
@@ -10,4 +10,4 @@ import type { CustomSyntaxCheck, UnmatchedResult } from './types.js';
|
|
|
10
10
|
* @param checks - The array of type check functions to try
|
|
11
11
|
* @returns The matched result or the best unmatched result
|
|
12
12
|
*/
|
|
13
|
-
export declare function checkMultiTypes(value: string, checks: readonly CustomSyntaxCheck[]): import("./types.js").MatchedResult
|
|
13
|
+
export declare function checkMultiTypes(value: string, checks: readonly CustomSyntaxCheck[]): UnmatchedResult | import("./types.js").MatchedResult;
|
package/lib/css-defs.js
CHANGED
|
@@ -29,58 +29,58 @@ export const cssDefs = {
|
|
|
29
29
|
},
|
|
30
30
|
'<svg-font-size>': {
|
|
31
31
|
ref: 'https://drafts.csswg.org/css-fonts-5/#descdef-font-face-font-size',
|
|
32
|
-
//
|
|
32
|
+
// Validation not yet implemented; always passes.
|
|
33
33
|
is: () => matched(),
|
|
34
34
|
},
|
|
35
35
|
'<svg-font-size-adjust>': {
|
|
36
36
|
ref: 'https://drafts.csswg.org/css-fonts-5/#propdef-font-size-adjust',
|
|
37
|
-
//
|
|
37
|
+
// Validation not yet implemented; always passes.
|
|
38
38
|
is: () => matched(),
|
|
39
39
|
},
|
|
40
40
|
"<'color-profile'>": {
|
|
41
41
|
ref: 'https://www.w3.org/TR/SVG11/color.html#ColorProfileProperty',
|
|
42
|
-
//
|
|
42
|
+
// Validation not yet implemented; always passes.
|
|
43
43
|
is: () => matched(),
|
|
44
44
|
},
|
|
45
45
|
"<'color-rendering'>": {
|
|
46
46
|
ref: 'https://www.w3.org/TR/SVG11/painting.html#ColorRenderingProperty',
|
|
47
|
-
//
|
|
47
|
+
// Validation not yet implemented; always passes.
|
|
48
48
|
is: () => matched(),
|
|
49
49
|
},
|
|
50
50
|
"<'enable-background'>": {
|
|
51
51
|
ref: 'https://www.w3.org/TR/SVG11/filters.html#EnableBackgroundProperty',
|
|
52
|
-
//
|
|
52
|
+
// Validation not yet implemented; always passes.
|
|
53
53
|
is: () => matched(),
|
|
54
54
|
},
|
|
55
55
|
'<list-of-svg-feature-string>': {
|
|
56
56
|
ref: 'https://www.w3.org/TR/SVG11/feature.html',
|
|
57
|
-
//
|
|
57
|
+
// Validation not yet implemented; always passes.
|
|
58
58
|
is: () => matched(),
|
|
59
59
|
},
|
|
60
60
|
'<animatable-value>': {
|
|
61
61
|
ref: 'https://svgwg.org/specs/animations/#FromAttribute',
|
|
62
|
-
//
|
|
62
|
+
// Validation not yet implemented; always passes.
|
|
63
63
|
is: () => matched(),
|
|
64
64
|
},
|
|
65
65
|
'<begin-value-list>': {
|
|
66
66
|
ref: 'https://svgwg.org/specs/animations/#BeginValueListSyntax',
|
|
67
|
-
//
|
|
67
|
+
// Validation not yet implemented; always passes.
|
|
68
68
|
is: () => matched(),
|
|
69
69
|
},
|
|
70
70
|
'<end-value-list>': {
|
|
71
71
|
ref: 'https://svgwg.org/specs/animations/#EndValueListSyntax',
|
|
72
|
-
//
|
|
72
|
+
// Validation not yet implemented; always passes.
|
|
73
73
|
is: () => matched(),
|
|
74
74
|
},
|
|
75
75
|
'<list-of-value>': {
|
|
76
76
|
ref: 'https://svgwg.org/specs/animations/#ValuesAttribute',
|
|
77
|
-
//
|
|
77
|
+
// Validation not yet implemented; always passes.
|
|
78
78
|
is: () => matched(),
|
|
79
79
|
},
|
|
80
80
|
'<clock-value>': {
|
|
81
81
|
ref: 'https://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-ClockValueSyntax',
|
|
82
82
|
syntax: {
|
|
83
|
-
//
|
|
83
|
+
// Validation not yet implemented; accepts any value.
|
|
84
84
|
apply: '<clock-value>',
|
|
85
85
|
def: {
|
|
86
86
|
'clock-value': '<any-value>',
|
|
@@ -155,7 +155,7 @@ export const cssDefs = {
|
|
|
155
155
|
ref: 'https://svgwg.org/svg2-draft/paths.html#PathDataBNF',
|
|
156
156
|
syntax: {
|
|
157
157
|
apply: '<svg-path>',
|
|
158
|
-
//
|
|
158
|
+
// Validation not yet implemented; accepts any value.
|
|
159
159
|
def: {
|
|
160
160
|
'svg-path': '<any-value>',
|
|
161
161
|
},
|
package/lib/match-result.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { FormattedPrimitiveTypeCheck, MatchedResult, UnmatchedResult, Unmat
|
|
|
10
10
|
export declare function matches(checker: FormattedPrimitiveTypeCheck, options?: UnmatchedResultOptions & {
|
|
11
11
|
readonly ref?: string;
|
|
12
12
|
readonly reason?: UnmatchedResultReason;
|
|
13
|
-
}): (value: string) =>
|
|
13
|
+
}): (value: string) => UnmatchedResult | MatchedResult;
|
|
14
14
|
/**
|
|
15
15
|
* Creates a successful match result.
|
|
16
16
|
*
|
|
@@ -18,6 +18,7 @@ export type TokenEachCheck = (head: Readonly<Token> | null, tail: TokenCollectio
|
|
|
18
18
|
* constraints, ordering checks, and case sensitivity options.
|
|
19
19
|
*/
|
|
20
20
|
export declare class TokenCollection extends Array<Token> {
|
|
21
|
+
#private;
|
|
21
22
|
/**
|
|
22
23
|
* Creates a TokenCollection by matching a value against a sequence of regex patterns.
|
|
23
24
|
*
|
|
@@ -57,7 +58,7 @@ export declare class TokenCollection extends Array<Token> {
|
|
|
57
58
|
expects?: Expect[];
|
|
58
59
|
ref?: string;
|
|
59
60
|
cache?: boolean;
|
|
60
|
-
}): import("../types.js").MatchedResult
|
|
61
|
+
}): UnmatchedResult | import("../types.js").MatchedResult;
|
|
61
62
|
/**
|
|
62
63
|
* Splits this collection into chunks of the specified size.
|
|
63
64
|
*
|
|
@@ -162,6 +163,5 @@ export declare class TokenCollection extends Array<Token> {
|
|
|
162
163
|
value: string;
|
|
163
164
|
offset: number;
|
|
164
165
|
}[];
|
|
165
|
-
private static _new;
|
|
166
166
|
}
|
|
167
167
|
export {};
|
|
@@ -59,11 +59,18 @@ export class TokenCollection extends Array {
|
|
|
59
59
|
if (strings) {
|
|
60
60
|
addToken(strings);
|
|
61
61
|
}
|
|
62
|
-
return TokenCollection
|
|
62
|
+
return TokenCollection.#new(tokens, new TokenCollection('', typeOptions));
|
|
63
63
|
}
|
|
64
64
|
static get [Symbol.species]() {
|
|
65
65
|
return Array;
|
|
66
66
|
}
|
|
67
|
+
static #new(tokens,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
69
|
+
old) {
|
|
70
|
+
const newCollection = new TokenCollection('', old);
|
|
71
|
+
newCollection.push(...tokens);
|
|
72
|
+
return newCollection;
|
|
73
|
+
}
|
|
67
74
|
allowEmpty;
|
|
68
75
|
caseInsensitive;
|
|
69
76
|
disallowToSurroundBySpaces;
|
|
@@ -233,7 +240,7 @@ export class TokenCollection extends Array {
|
|
|
233
240
|
const tokens = this.slice();
|
|
234
241
|
while (tokens.length > 0) {
|
|
235
242
|
const chunkTokens = tokens.splice(0, split);
|
|
236
|
-
const chunk = TokenCollection
|
|
243
|
+
const chunk = TokenCollection.#new(chunkTokens, this);
|
|
237
244
|
chunks.push(chunk);
|
|
238
245
|
}
|
|
239
246
|
return chunks;
|
|
@@ -269,8 +276,8 @@ export class TokenCollection extends Array {
|
|
|
269
276
|
divide(position) {
|
|
270
277
|
const _a = this.slice(0, position);
|
|
271
278
|
const _b = this.slice(position);
|
|
272
|
-
const a = TokenCollection
|
|
273
|
-
const b = TokenCollection
|
|
279
|
+
const a = TokenCollection.#new(_a, this);
|
|
280
|
+
const b = TokenCollection.#new(_b, this);
|
|
274
281
|
return [a, b];
|
|
275
282
|
}
|
|
276
283
|
/**
|
|
@@ -355,7 +362,7 @@ export class TokenCollection extends Array {
|
|
|
355
362
|
* @returns A new TokenCollection with the filtered tokens
|
|
356
363
|
*/
|
|
357
364
|
filter(callback) {
|
|
358
|
-
return TokenCollection
|
|
365
|
+
return TokenCollection.#new(super.filter(callback), this);
|
|
359
366
|
}
|
|
360
367
|
/**
|
|
361
368
|
* Finds the first occurrence of two consecutive tokens of the same type.
|
|
@@ -425,9 +432,9 @@ export class TokenCollection extends Array {
|
|
|
425
432
|
const copy = this.slice();
|
|
426
433
|
const head = copy.shift();
|
|
427
434
|
if (!head) {
|
|
428
|
-
return { head: head ?? null, tail: TokenCollection
|
|
435
|
+
return { head: head ?? null, tail: TokenCollection.#new([], this) };
|
|
429
436
|
}
|
|
430
|
-
const tail = TokenCollection
|
|
437
|
+
const tail = TokenCollection.#new(copy, this);
|
|
431
438
|
return { head, tail };
|
|
432
439
|
}
|
|
433
440
|
/**
|
|
@@ -484,11 +491,4 @@ export class TokenCollection extends Array {
|
|
|
484
491
|
toJSON() {
|
|
485
492
|
return this.map(t => t.toJSON());
|
|
486
493
|
}
|
|
487
|
-
static _new(tokens,
|
|
488
|
-
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
489
|
-
old) {
|
|
490
|
-
const newCollection = new TokenCollection('', old);
|
|
491
|
-
newCollection.push(...tokens);
|
|
492
|
-
return newCollection;
|
|
493
|
-
}
|
|
494
494
|
}
|
package/lib/token/token.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare class Token {
|
|
|
51
51
|
* @param separators - Optional separator characters to detect
|
|
52
52
|
* @returns The token type number (WhiteSpace, Comma, or Ident)
|
|
53
53
|
*/
|
|
54
|
-
static getType(value: string, separators?: readonly string[]): 1 |
|
|
54
|
+
static getType(value: string, separators?: readonly string[]): 1 | 13 | 18;
|
|
55
55
|
/**
|
|
56
56
|
* Calculates a new position by shifting from a token's offset.
|
|
57
57
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/types",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.3",
|
|
4
4
|
"description": "Type declaration and value checker",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"schema:prettier": "npx prettier --write \"./src/types.schema.ts\" \"./types.schema.json\" --log-level warn"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@markuplint/shared": "5.0.0-alpha.
|
|
35
|
+
"@markuplint/shared": "5.0.0-alpha.3",
|
|
36
36
|
"@types/css-tree": "2.3.11",
|
|
37
37
|
"@types/debug": "4.1.12",
|
|
38
38
|
"bcp-47": "2.1.0",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"type-fest": "5.4.4",
|
|
43
43
|
"whatwg-mimetype": "5.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "2fbdf26daa3d021ac628ccc2f59f0eeae6ddd53d"
|
|
46
46
|
}
|