@markuplint/types 4.8.2 → 5.0.0-alpha.1
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/ARCHITECTURE.ja.md +4 -0
- package/ARCHITECTURE.md +4 -0
- package/CHANGELOG.md +20 -0
- package/docs/validators.ja.md +18 -8
- package/docs/validators.md +18 -8
- package/lib/check-base.d.ts +10 -1
- package/lib/check-base.js +16 -0
- package/lib/defs.js +18 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +3 -1
- package/lib/pattern.d.ts +12 -0
- package/lib/pattern.js +33 -0
- package/lib/rfc/is-bcp-47.js +2 -2
- package/lib/token/token-collection.d.ts +1 -1
- package/lib/token/token-collection.js +7 -0
- package/lib/token/token.js +23 -19
- package/lib/types.d.ts +1 -1
- package/lib/types.schema.d.ts +4 -1
- package/lib/whatwg/check-autocomplete.d.ts +7 -2
- package/lib/whatwg/check-autocomplete.js +211 -162
- package/lib/whatwg/check-datetime/datetime-tokens.js +1 -1
- package/lib/whatwg/check-link-type.d.ts +103 -0
- package/lib/whatwg/check-link-type.js +12 -6
- package/lib/whatwg/check-mime-type.js +2 -2
- package/lib/whatwg/is-abs-url.js +1 -4
- package/package.json +8 -6
- package/types.schema.json +10 -1
package/ARCHITECTURE.ja.md
CHANGED
|
@@ -224,6 +224,7 @@ flowchart LR
|
|
|
224
224
|
subgraph pkg ["@markuplint/types"]
|
|
225
225
|
defs["defs レジストリ"]
|
|
226
226
|
check["check()"]
|
|
227
|
+
getCandidate["getCandidate()"]
|
|
227
228
|
types["型定義"]
|
|
228
229
|
end
|
|
229
230
|
|
|
@@ -234,6 +235,7 @@ flowchart LR
|
|
|
234
235
|
mlSpec -->|"Defs を提供\n(型定義)"| defs
|
|
235
236
|
mlSpec -->|"Type 共用体を使用\n(属性仕様の記述)"| types
|
|
236
237
|
rules -->|"check() を呼び出し\n属性値を検証"| check
|
|
238
|
+
rules -->|"getCandidate() を呼び出し\nタイプミス候補を提示"| getCandidate
|
|
237
239
|
```
|
|
238
240
|
|
|
239
241
|
### 上流: `@markuplint/ml-spec`
|
|
@@ -244,6 +246,8 @@ flowchart LR
|
|
|
244
246
|
|
|
245
247
|
`@markuplint/rules` は、パース済み HTML ドキュメント中の属性値を検証するために `check(value, type)` を呼び出します。`Result` 型がエラー報告を駆動し、`UnmatchedResult` に含まれるオフセット・行・列・理由・期待値・修正候補の情報を、ルールがリント診断メッセージに変換します。
|
|
246
248
|
|
|
249
|
+
また、`@markuplint/rules` は存在しない属性が検出された際に類似する属性名を提案するため `getCandidate()` も呼び出します。属性値の候補提示と同じレーベンシュタイン距離ベースの類似度閾値(50%以上)が属性名の候補提示にも適用されます。
|
|
250
|
+
|
|
247
251
|
## ドキュメントマップ
|
|
248
252
|
|
|
249
253
|
- [型システム](docs/type-system.ja.md) -- 型共用体、Result型、Defsレジストリ、スキーマ生成
|
package/ARCHITECTURE.md
CHANGED
|
@@ -224,6 +224,7 @@ flowchart LR
|
|
|
224
224
|
subgraph pkg ["@markuplint/types"]
|
|
225
225
|
defs["defs registry"]
|
|
226
226
|
check["check()"]
|
|
227
|
+
getCandidate["getCandidate()"]
|
|
227
228
|
types["Type definitions"]
|
|
228
229
|
end
|
|
229
230
|
|
|
@@ -234,6 +235,7 @@ flowchart LR
|
|
|
234
235
|
mlSpec -->|"provides Defs\n(type definitions)"| defs
|
|
235
236
|
mlSpec -->|"uses Type union\nfor attribute specs"| types
|
|
236
237
|
rules -->|"calls check()\nto validate attribute values"| check
|
|
238
|
+
rules -->|"calls getCandidate()\nfor typo suggestions"| getCandidate
|
|
237
239
|
```
|
|
238
240
|
|
|
239
241
|
### Upstream: `@markuplint/ml-spec`
|
|
@@ -244,6 +246,8 @@ flowchart LR
|
|
|
244
246
|
|
|
245
247
|
`@markuplint/rules` calls `check(value, type)` to validate attribute values found in parsed HTML documents. The `Result` type drives error reporting: an `UnmatchedResult` provides the offset, line, column, reason, expected values, and candidate corrections that rules translate into lint diagnostics.
|
|
246
248
|
|
|
249
|
+
`@markuplint/rules` also calls `getCandidate()` to suggest similar attribute names when a non-existent attribute is detected. The same Levenshtein-based similarity threshold (≥50%) used for attribute value suggestions applies to attribute name suggestions.
|
|
250
|
+
|
|
247
251
|
## Documentation Map
|
|
248
252
|
|
|
249
253
|
- [Type System](docs/type-system.md) -- Type unions, Result types, Defs registry, schema generation
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @markuplint/types
|
|
9
|
+
|
|
10
|
+
# [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **types:** accept BCP 47 private-use tags like x-default ([#718](https://github.com/markuplint/markuplint/issues/718)) ([b335452](https://github.com/markuplint/markuplint/commit/b3354523d0a0686fd029f1e3e81ec3900bc6d4a8))
|
|
15
|
+
- **types:** propagate caseInsensitive param in Token array recursion ([2d72f96](https://github.com/markuplint/markuplint/commit/2d72f96774cf733842392ce69700cd31f7783105))
|
|
16
|
+
- **types:** reject mixed width and density descriptors in Srcset validator ([00a2ad0](https://github.com/markuplint/markuplint/commit/00a2ad0c5e70d35bc1842476ab54ecf381f6ebcc))
|
|
17
|
+
- **types:** use instanceof TypeError for URL validation error handling ([9fd23fa](https://github.com/markuplint/markuplint/commit/9fd23fa4a662bd1394042c89a2c049992fa652c1))
|
|
18
|
+
- use explicit `export type` for type-only re-exports ([7c77c05](https://github.com/markuplint/markuplint/commit/7c77c05619518c8d18a183132040f5b2cd0ab6ec))
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **types:** add Pattern type to Type union for regex validation ([06528bd](https://github.com/markuplint/markuplint/commit/06528bd63a1988ef06f95c17ae63b88f3e699451))
|
|
23
|
+
- **types:** export getCandidate function for attribute name suggestion ([100e467](https://github.com/markuplint/markuplint/commit/100e467bdd8bb5acd6075c2d1e12e3e33f5f9090))
|
|
24
|
+
- **types:** export link type data arrays and types ([b45937d](https://github.com/markuplint/markuplint/commit/b45937da166f4032262bcd3be1b3338fa6abdb14))
|
|
25
|
+
|
|
6
26
|
## [4.8.2](https://github.com/markuplint/markuplint/compare/@markuplint/types@4.8.1...@markuplint/types@4.8.2) (2026-02-10)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @markuplint/types
|
package/docs/validators.ja.md
CHANGED
|
@@ -205,17 +205,27 @@ graph TD
|
|
|
205
205
|
|
|
206
206
|
[WHATWGオートフィル仕様](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete)に基づいて `autocomplete` 属性値を検証します。
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
**後方パース**(右から左)を採用しており、WHATWG仕様のアルゴリズムに忠実に実装されています。属性値はスペース区切りの順序付きトークン集合(ASCII大文字小文字非区別)として解析されます。認識されるトークンは以下のとおりです。
|
|
209
209
|
|
|
210
210
|
- **キーワード:** `on`、`off`(単独使用、他のトークンとの共存不可)
|
|
211
211
|
- **名前付きグループ:** `section-` で始まるトークン(省略可能な接頭辞)
|
|
212
212
|
- **住所区分:** `shipping`、`billing`(省略可能)
|
|
213
|
-
- **連絡手段トークン:** `home`、`work`、`mobile`、`fax`、`pager
|
|
213
|
+
- **連絡手段トークン:** `home`、`work`、`mobile`、`fax`、`pager`(省略可能、連絡先フィールド名の前でのみ有効)
|
|
214
214
|
- **オートフィルフィールド名:** `name`、`given-name`、`postal-code`、`cc-number` など(44種類)
|
|
215
215
|
- **連絡先フィールド名:** `tel`、`tel-country-code`、`email`、`impp` など(10種類)
|
|
216
|
-
- **WebAuthn:** `webauthn
|
|
216
|
+
- **WebAuthn:** `webauthn`(省略可能な末尾トークン、カテゴリ再決定あり)
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
後方パースアルゴリズム:
|
|
219
|
+
|
|
220
|
+
1. **最後の**トークンからフィールド名を決定し、Normal・Contact・Credential のいずれかのカテゴリに分類
|
|
221
|
+
2. `webauthn` クレデンシャルトークンの処理: 存在する場合は消費し、直前のトークンからカテゴリを再決定
|
|
222
|
+
3. 連絡手段トークンの消費(Contact カテゴリのフィールドに対してのみ有効)
|
|
223
|
+
4. Normal カテゴリのフィールドの前に連絡手段トークンがある場合は拒否
|
|
224
|
+
5. `shipping`/`billing` の消費(省略可能)
|
|
225
|
+
6. `section-*` 名前付きグループの消費(省略可能)
|
|
226
|
+
7. 残余トークンがあればエクストラとして報告
|
|
227
|
+
|
|
228
|
+
適用される文法: `[section-*] [shipping|billing] [home|work|...] <フィールド名> [webauthn]`。フィールド名は常に必須であり、接頭辞のみの値(例: `section-foo` や `shipping` 単独)は拒否されます。重複トークン、不正な順序、認識できないトークンは、レーベンシュタイン距離に基づくタイプミス修正候補を含む詳細なエラー結果を生成します。
|
|
219
229
|
|
|
220
230
|
### リンクタイプバリデータ
|
|
221
231
|
|
|
@@ -285,19 +295,19 @@ WHATWGが定義する各種名前フォーマットに対する、シンプル
|
|
|
285
295
|
|
|
286
296
|
[BCP 47](https://tools.ietf.org/rfc/bcp/bcp47.html)(RFC 5646 + RFC 4647)に準拠した言語タグの検証を行います。
|
|
287
297
|
|
|
288
|
-
npmパッケージ `bcp-47` を組み込んでパースし、有効な `language`
|
|
298
|
+
npmパッケージ `bcp-47` を組み込んでパースし、有効な `language` サブタグまたは `privateuse` サブタグ(例: `x-default`)が含まれているかを確認します。
|
|
289
299
|
|
|
290
300
|
```typescript
|
|
291
301
|
// src/rfc/is-bcp-47.ts
|
|
292
302
|
export const isBCP47: FormattedPrimitiveTypeCreator = () => {
|
|
293
303
|
return value => {
|
|
294
|
-
const { language } = parse(value);
|
|
295
|
-
return !!language;
|
|
304
|
+
const { language, privateuse } = parse(value);
|
|
305
|
+
return !!language || (privateuse != null && privateuse.length > 0);
|
|
296
306
|
};
|
|
297
307
|
};
|
|
298
308
|
```
|
|
299
309
|
|
|
300
|
-
`defs.ts` では `BCP47` 型として登録されており、HTML要素の `lang` 属性の検証に使用されます。
|
|
310
|
+
`defs.ts` では `BCP47` 型として登録されており、HTML要素の `lang` 属性や `hreflang` 属性の検証に使用されます。
|
|
301
311
|
|
|
302
312
|
---
|
|
303
313
|
|
package/docs/validators.md
CHANGED
|
@@ -205,17 +205,27 @@ The `datetimeTokenCheck` object also maintains `_year` and `_month` as mutable s
|
|
|
205
205
|
|
|
206
206
|
Validates the `autocomplete` attribute value according to the [WHATWG autofill specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete).
|
|
207
207
|
|
|
208
|
-
The validator uses
|
|
208
|
+
The validator uses **backward parsing** (right-to-left), matching the WHATWG specification algorithm. The attribute value is parsed as an ordered set of space-separated tokens (ASCII case-insensitive). It recognizes:
|
|
209
209
|
|
|
210
210
|
- **Keywords:** `on`, `off` (standalone, no other tokens allowed)
|
|
211
211
|
- **Named groups:** Tokens starting with `section-` (optional prefix)
|
|
212
212
|
- **Address parts:** `shipping`, `billing` (optional)
|
|
213
|
-
- **Contacting tokens:** `home`, `work`, `mobile`, `fax`, `pager` (optional,
|
|
213
|
+
- **Contacting tokens:** `home`, `work`, `mobile`, `fax`, `pager` (optional, only valid before contactable field names)
|
|
214
214
|
- **Autofill field names:** `name`, `given-name`, `postal-code`, `cc-number`, etc. (44 names)
|
|
215
215
|
- **Contactable field names:** `tel`, `tel-country-code`, `email`, `impp`, etc. (10 names)
|
|
216
|
-
- **WebAuthn:** `webauthn` (optional trailing token)
|
|
216
|
+
- **WebAuthn:** `webauthn` (optional trailing token with category re-determination)
|
|
217
217
|
|
|
218
|
-
The
|
|
218
|
+
The backward parsing algorithm:
|
|
219
|
+
|
|
220
|
+
1. Determine the field name from the **last** token and classify into Normal, Contact, or Credential category
|
|
221
|
+
2. Handle `webauthn` credential token: if present, consume it and re-determine the category from the preceding token
|
|
222
|
+
3. Optionally consume a contacting token (only valid for Contact category fields)
|
|
223
|
+
4. Reject contacting tokens preceding Normal category fields
|
|
224
|
+
5. Optionally consume `shipping`/`billing`
|
|
225
|
+
6. Optionally consume `section-*` named group
|
|
226
|
+
7. Report any remaining tokens as extra
|
|
227
|
+
|
|
228
|
+
The grammar enforced is: `[section-*] [shipping|billing] [home|work|...] <field-name> [webauthn]`. A field name is always required -- prefix-only values (e.g., `section-foo` or `shipping` alone) are rejected. Duplicate tokens, incorrect ordering, and unrecognized tokens produce detailed error results with Levenshtein-distance-based typo correction candidates.
|
|
219
229
|
|
|
220
230
|
### Link Type Validator
|
|
221
231
|
|
|
@@ -285,19 +295,19 @@ All of these are `FormattedPrimitiveTypeCreator` factories -- they return `() =>
|
|
|
285
295
|
|
|
286
296
|
Validates language tags according to [BCP 47](https://tools.ietf.org/rfc/bcp/bcp47.html) (RFC 5646 + RFC 4647).
|
|
287
297
|
|
|
288
|
-
The validator integrates the `bcp-47` npm package. It parses the value and checks that a valid `language` subtag is present:
|
|
298
|
+
The validator integrates the `bcp-47` npm package. It parses the value and checks that either a valid `language` subtag or a `privateuse` subtag (e.g., `x-default`) is present:
|
|
289
299
|
|
|
290
300
|
```typescript
|
|
291
301
|
// src/rfc/is-bcp-47.ts
|
|
292
302
|
export const isBCP47: FormattedPrimitiveTypeCreator = () => {
|
|
293
303
|
return value => {
|
|
294
|
-
const { language } = parse(value);
|
|
295
|
-
return !!language;
|
|
304
|
+
const { language, privateuse } = parse(value);
|
|
305
|
+
return !!language || (privateuse != null && privateuse.length > 0);
|
|
296
306
|
};
|
|
297
307
|
};
|
|
298
308
|
```
|
|
299
309
|
|
|
300
|
-
This is registered in `defs.ts` as the `BCP47` type, used for the `lang`
|
|
310
|
+
This is registered in `defs.ts` as the `BCP47` type, used for the `lang` and `hreflang` attributes on HTML elements.
|
|
301
311
|
|
|
302
312
|
---
|
|
303
313
|
|
package/lib/check-base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Type, Result, List, CustomSyntax, CustomCssSyntax, Enum, KeywordDefinedType, Number, Directive, Defs } from './types.js';
|
|
1
|
+
import type { Type, Result, List, CustomSyntax, CustomCssSyntax, Enum, KeywordDefinedType, Number, Directive, Pattern, Defs } from './types.js';
|
|
2
2
|
import type { ReadonlyDeep } from 'type-fest';
|
|
3
3
|
/**
|
|
4
4
|
* Validates a string value against a specified type definition using the provided
|
|
@@ -61,6 +61,15 @@ export declare function isNumber(type: ReadonlyDeep<Type>): type is ReadonlyDeep
|
|
|
61
61
|
* @returns True if the type is a directive definition
|
|
62
62
|
*/
|
|
63
63
|
export declare function isDirective(type: ReadonlyDeep<Type>): type is ReadonlyDeep<Directive>;
|
|
64
|
+
/**
|
|
65
|
+
* Determines whether a type definition represents a pattern type.
|
|
66
|
+
* Pattern types validate attribute values against a regular expression
|
|
67
|
+
* or plain string, and are identified by having a `pattern` property.
|
|
68
|
+
*
|
|
69
|
+
* @param type - The type definition to test
|
|
70
|
+
* @returns True if the type is a pattern definition
|
|
71
|
+
*/
|
|
72
|
+
export declare function isPattern(type: ReadonlyDeep<Type>): type is ReadonlyDeep<Pattern>;
|
|
64
73
|
/**
|
|
65
74
|
* Determines whether a custom type definition uses CSS syntax matching.
|
|
66
75
|
* CSS syntax definitions are either plain strings or objects with a `syntax`
|
package/lib/check-base.js
CHANGED
|
@@ -4,6 +4,7 @@ import { checkEnum } from './enum.js';
|
|
|
4
4
|
import { checkKeywordType } from './keyword-type.js';
|
|
5
5
|
import { checkList } from './list.js';
|
|
6
6
|
import { checkNumber } from './number.js';
|
|
7
|
+
import { checkPattern } from './pattern.js';
|
|
7
8
|
/**
|
|
8
9
|
* Validates a string value against a specified type definition using the provided
|
|
9
10
|
* set of custom type definitions. This is the core type-checking dispatcher that
|
|
@@ -39,6 +40,10 @@ export function checkBase(value, type, defs, ref, cache = true) {
|
|
|
39
40
|
log('Check directive: %O', type);
|
|
40
41
|
return checkDirective(value, type, defs, ref, cache);
|
|
41
42
|
}
|
|
43
|
+
if (isPattern(type)) {
|
|
44
|
+
log('Check pattern: %O', type);
|
|
45
|
+
return checkPattern(value, type);
|
|
46
|
+
}
|
|
42
47
|
throw new Error('Unknown type');
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
@@ -97,6 +102,17 @@ export function isNumber(type) {
|
|
|
97
102
|
export function isDirective(type) {
|
|
98
103
|
return typeof type !== 'string' && 'directive' in type;
|
|
99
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Determines whether a type definition represents a pattern type.
|
|
107
|
+
* Pattern types validate attribute values against a regular expression
|
|
108
|
+
* or plain string, and are identified by having a `pattern` property.
|
|
109
|
+
*
|
|
110
|
+
* @param type - The type definition to test
|
|
111
|
+
* @returns True if the type is a pattern definition
|
|
112
|
+
*/
|
|
113
|
+
export function isPattern(type) {
|
|
114
|
+
return typeof type !== 'string' && 'pattern' in type;
|
|
115
|
+
}
|
|
100
116
|
/**
|
|
101
117
|
* Determines whether a custom type definition uses CSS syntax matching.
|
|
102
118
|
* CSS syntax definitions are either plain strings or objects with a `syntax`
|
package/lib/defs.js
CHANGED
|
@@ -434,6 +434,8 @@ export const defs = {
|
|
|
434
434
|
ref: 'https://html.spec.whatwg.org/multipage/images.html#srcset-attributes',
|
|
435
435
|
is(value) {
|
|
436
436
|
const images = value.split(',');
|
|
437
|
+
let hasWidth = false;
|
|
438
|
+
let hasDensity = false;
|
|
437
439
|
for (const image of images) {
|
|
438
440
|
// image candidate string
|
|
439
441
|
const [url, , descriptor, ...tail] = new TokenCollection(image.trim(), {
|
|
@@ -464,6 +466,7 @@ export const defs = {
|
|
|
464
466
|
],
|
|
465
467
|
});
|
|
466
468
|
}
|
|
469
|
+
hasWidth = true;
|
|
467
470
|
break;
|
|
468
471
|
}
|
|
469
472
|
case 'x': {
|
|
@@ -477,6 +480,7 @@ export const defs = {
|
|
|
477
480
|
],
|
|
478
481
|
});
|
|
479
482
|
}
|
|
483
|
+
hasDensity = true;
|
|
480
484
|
break;
|
|
481
485
|
}
|
|
482
486
|
default: {
|
|
@@ -495,6 +499,10 @@ export const defs = {
|
|
|
495
499
|
}
|
|
496
500
|
}
|
|
497
501
|
}
|
|
502
|
+
else {
|
|
503
|
+
// No descriptor implies 1x (density descriptor)
|
|
504
|
+
hasDensity = true;
|
|
505
|
+
}
|
|
498
506
|
if (tail[0]) {
|
|
499
507
|
return unmatched(value, 'unexpected-token', {
|
|
500
508
|
expects: [
|
|
@@ -506,6 +514,16 @@ export const defs = {
|
|
|
506
514
|
});
|
|
507
515
|
}
|
|
508
516
|
}
|
|
517
|
+
if (hasWidth && hasDensity) {
|
|
518
|
+
return unmatched(value, 'unexpected-token', {
|
|
519
|
+
expects: [
|
|
520
|
+
{
|
|
521
|
+
type: 'format',
|
|
522
|
+
value: 'consistent descriptors (all width or all density, not mixed)',
|
|
523
|
+
},
|
|
524
|
+
],
|
|
525
|
+
});
|
|
526
|
+
}
|
|
509
527
|
return matched();
|
|
510
528
|
},
|
|
511
529
|
},
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* CSS syntax validation, and custom type definitions used by markuplint rules.
|
|
6
6
|
*/
|
|
7
7
|
export * from './whatwg/is-custom-element-name.js';
|
|
8
|
+
export * from './whatwg/check-link-type.js';
|
|
8
9
|
export * from './check.js';
|
|
9
10
|
export * from './check-base.js';
|
|
10
|
-
export
|
|
11
|
+
export { getCandidate } from './get-candidate.js';
|
|
12
|
+
export { checkPattern } from './pattern.js';
|
|
13
|
+
export type * from './types.js';
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* CSS syntax validation, and custom type definitions used by markuplint rules.
|
|
6
6
|
*/
|
|
7
7
|
export * from './whatwg/is-custom-element-name.js';
|
|
8
|
+
export * from './whatwg/check-link-type.js';
|
|
8
9
|
export * from './check.js';
|
|
9
10
|
export * from './check-base.js';
|
|
10
|
-
export
|
|
11
|
+
export { getCandidate } from './get-candidate.js';
|
|
12
|
+
export { checkPattern } from './pattern.js';
|
package/lib/pattern.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Pattern, Result } from './types.js';
|
|
2
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
3
|
+
/**
|
|
4
|
+
* Validates a string value against a pattern type definition.
|
|
5
|
+
* The pattern can be either a regular expression literal in the form
|
|
6
|
+
* `/pattern/flags` or a plain string for exact equality matching.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The string value to validate
|
|
9
|
+
* @param type - The pattern type definition containing the pattern string
|
|
10
|
+
* @returns A result indicating whether the value matches the pattern
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkPattern(value: string, type: ReadonlyDeep<Pattern>): Result;
|
package/lib/pattern.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates a string value against a pattern type definition.
|
|
3
|
+
* The pattern can be either a regular expression literal in the form
|
|
4
|
+
* `/pattern/flags` or a plain string for exact equality matching.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The string value to validate
|
|
7
|
+
* @param type - The pattern type definition containing the pattern string
|
|
8
|
+
* @returns A result indicating whether the value matches the pattern
|
|
9
|
+
*/
|
|
10
|
+
export function checkPattern(value, type) {
|
|
11
|
+
const regexMatch = type.pattern.match(/^\/(.*)\/([gim])*$/);
|
|
12
|
+
if (regexMatch && regexMatch[1]) {
|
|
13
|
+
const re = regexMatch[1];
|
|
14
|
+
const flag = regexMatch[2];
|
|
15
|
+
if (new RegExp(re, flag).test(value)) {
|
|
16
|
+
return { matched: true };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (value === type.pattern) {
|
|
20
|
+
return { matched: true };
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
matched: false,
|
|
24
|
+
ref: null,
|
|
25
|
+
raw: value,
|
|
26
|
+
length: value.length,
|
|
27
|
+
offset: 0,
|
|
28
|
+
line: 1,
|
|
29
|
+
column: 1,
|
|
30
|
+
reason: 'syntax-error',
|
|
31
|
+
expects: [{ type: 'regexp', value: type.pattern }],
|
|
32
|
+
};
|
|
33
|
+
}
|
package/lib/rfc/is-bcp-47.js
CHANGED
|
@@ -6,7 +6,7 @@ import { parse } from 'bcp-47';
|
|
|
6
6
|
*/
|
|
7
7
|
export const isBCP47 = () => {
|
|
8
8
|
return value => {
|
|
9
|
-
const { language } = parse(value);
|
|
10
|
-
return !!language;
|
|
9
|
+
const { language, privateuse } = parse(value);
|
|
10
|
+
return !!language || (privateuse != null && privateuse.length > 0);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
@@ -57,7 +57,7 @@ export declare class TokenCollection extends Array<Token> {
|
|
|
57
57
|
expects?: Expect[];
|
|
58
58
|
ref?: string;
|
|
59
59
|
cache?: boolean;
|
|
60
|
-
}):
|
|
60
|
+
}): import("../types.js").MatchedResult | UnmatchedResult;
|
|
61
61
|
/**
|
|
62
62
|
* Splits this collection into chunks of the specified size.
|
|
63
63
|
*
|
|
@@ -64,6 +64,13 @@ export class TokenCollection extends Array {
|
|
|
64
64
|
static get [Symbol.species]() {
|
|
65
65
|
return Array;
|
|
66
66
|
}
|
|
67
|
+
allowEmpty;
|
|
68
|
+
caseInsensitive;
|
|
69
|
+
disallowToSurroundBySpaces;
|
|
70
|
+
number;
|
|
71
|
+
ordered;
|
|
72
|
+
separator;
|
|
73
|
+
unique;
|
|
67
74
|
constructor(value,
|
|
68
75
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
69
76
|
typeOptions) {
|
package/lib/token/token.js
CHANGED
|
@@ -6,6 +6,23 @@
|
|
|
6
6
|
* for matching and comparison operations.
|
|
7
7
|
*/
|
|
8
8
|
export class Token {
|
|
9
|
+
/**
|
|
10
|
+
* @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js
|
|
11
|
+
*/
|
|
12
|
+
static Comma = 18;
|
|
13
|
+
static Ident = 1;
|
|
14
|
+
static WhiteSpace = 13;
|
|
15
|
+
/**
|
|
16
|
+
* ASCII whitespace is
|
|
17
|
+
* - U+0009 TAB
|
|
18
|
+
* - U+000A LF
|
|
19
|
+
* - U+000C FF
|
|
20
|
+
* - U+000D CR
|
|
21
|
+
* - U+0020 SPACE.
|
|
22
|
+
*
|
|
23
|
+
* @see https://infra.spec.whatwg.org/#ascii-whitespace
|
|
24
|
+
*/
|
|
25
|
+
static whitespace = ['\u0009', '\u000A', '\u000C', '\u000D', '\u0020'];
|
|
9
26
|
/**
|
|
10
27
|
* @deprecated Use {@link getPosition} instead. Will be removed in v5.0.0.
|
|
11
28
|
*/
|
|
@@ -68,6 +85,10 @@ export class Token {
|
|
|
68
85
|
column,
|
|
69
86
|
};
|
|
70
87
|
}
|
|
88
|
+
offset;
|
|
89
|
+
originalValue;
|
|
90
|
+
type;
|
|
91
|
+
value;
|
|
71
92
|
/**
|
|
72
93
|
* @param value - The token string value
|
|
73
94
|
* @param offset - The offset position within the original string
|
|
@@ -103,7 +124,7 @@ export class Token {
|
|
|
103
124
|
*/
|
|
104
125
|
includes(value, caseInsensitive) {
|
|
105
126
|
if (Array.isArray(value)) {
|
|
106
|
-
return value.some(v => this.includes(v));
|
|
127
|
+
return value.some(v => this.includes(v, caseInsensitive));
|
|
107
128
|
}
|
|
108
129
|
if (typeof value === 'string') {
|
|
109
130
|
const a = caseInsensitive ? this.value.toLowerCase() : this.value;
|
|
@@ -125,7 +146,7 @@ export class Token {
|
|
|
125
146
|
*/
|
|
126
147
|
matches(value, caseInsensitive) {
|
|
127
148
|
if (Array.isArray(value)) {
|
|
128
|
-
return value.some(v => this.matches(v));
|
|
149
|
+
return value.some(v => this.matches(v, caseInsensitive));
|
|
129
150
|
}
|
|
130
151
|
if (typeof value === 'string') {
|
|
131
152
|
const a = caseInsensitive ? this.value.toLowerCase() : this.value;
|
|
@@ -180,20 +201,3 @@ export class Token {
|
|
|
180
201
|
};
|
|
181
202
|
}
|
|
182
203
|
}
|
|
183
|
-
/**
|
|
184
|
-
* @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js
|
|
185
|
-
*/
|
|
186
|
-
Token.Comma = 18;
|
|
187
|
-
Token.Ident = 1;
|
|
188
|
-
Token.WhiteSpace = 13;
|
|
189
|
-
/**
|
|
190
|
-
* ASCII whitespace is
|
|
191
|
-
* - U+0009 TAB
|
|
192
|
-
* - U+000A LF
|
|
193
|
-
* - U+000C FF
|
|
194
|
-
* - U+000D CR
|
|
195
|
-
* - U+0020 SPACE.
|
|
196
|
-
*
|
|
197
|
-
* @see https://infra.spec.whatwg.org/#ascii-whitespace
|
|
198
|
-
*/
|
|
199
|
-
Token.whitespace = ['\u0009', '\u000A', '\u000C', '\u000D', '\u0020'];
|
package/lib/types.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { cssSyntaxMatch } from './css-syntax.js';
|
|
|
10
10
|
* - `Number` - Defines numeric validation with optional range constraints
|
|
11
11
|
* - `Directive` - Defines composite attribute values with separators and individual token validation
|
|
12
12
|
*/
|
|
13
|
-
export type { Type, List, Enum, CssSyntax, KeywordDefinedType, Number, Directive } from './types.schema.js';
|
|
13
|
+
export type { Type, List, Enum, CssSyntax, KeywordDefinedType, Number, Directive, Pattern } from './types.schema.js';
|
|
14
14
|
/**
|
|
15
15
|
* The outcome of a type validation check. Either a successful match
|
|
16
16
|
* or a detailed mismatch containing error location and reason.
|
package/lib/types.schema.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
4
|
* and run json-schema-to-typescript to regenerate this file.
|
|
5
5
|
*/
|
|
6
|
-
export type Type = KeywordDefinedType | List | Enum | Number | Directive;
|
|
6
|
+
export type Type = KeywordDefinedType | List | Enum | Number | Directive | Pattern;
|
|
7
7
|
export type KeywordDefinedType = CssSyntax | ExtendedType | HtmlAttrRequirement;
|
|
8
8
|
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'>" | "<'anchor-name'>" | "<'anchor-scope'>" | "<'animation'>" | "<'animation-composition'>" | "<'animation-delay'>" | "<'animation-direction'>" | "<'animation-duration'>" | "<'animation-fill-mode'>" | "<'animation-iteration-count'>" | "<'animation-name'>" | "<'animation-play-state'>" | "<'animation-range'>" | "<'animation-range-end'>" | "<'animation-range-start'>" | "<'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-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-interpolation-filters'>" | "<'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'>" | "<'container'>" | "<'container-name'>" | "<'container-type'>" | "<'content'>" | "<'content-visibility'>" | "<'counter-increment'>" | "<'counter-reset'>" | "<'counter-set'>" | "<'cue'>" | "<'cue-after'>" | "<'cue-before'>" | "<'cursor'>" | "<'cx'>" | "<'cy'>" | "<'d'>" | "<'direction'>" | "<'display'>" | "<'dominant-baseline'>" | "<'empty-cells'>" | "<'field-sizing'>" | "<'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-palette'>" | "<'font-size'>" | "<'font-size-adjust'>" | "<'font-smooth'>" | "<'font-stretch'>" | "<'font-style'>" | "<'font-synthesis'>" | "<'font-synthesis-position'>" | "<'font-synthesis-small-caps'>" | "<'font-synthesis-style'>" | "<'font-synthesis-weight'>" | "<'font-variant'>" | "<'font-variant-alternates'>" | "<'font-variant-caps'>" | "<'font-variant-east-asian'>" | "<'font-variant-emoji'>" | "<'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'>" | "<'hyphenate-limit-chars'>" | "<'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'>" | "<'interpolate-size'>" | "<'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'>" | "<'overlay'>" | "<'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'>" | "<'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'>" | "<'position-anchor'>" | "<'position-area'>" | "<'position-try'>" | "<'position-try-fallbacks'>" | "<'position-try-order'>" | "<'position-visibility'>" | "<'print-color-adjust'>" | "<'quotes'>" | "<'r'>" | "<'resize'>" | "<'rest'>" | "<'rest-after'>" | "<'rest-before'>" | "<'right'>" | "<'rotate'>" | "<'row-gap'>" | "<'ruby-align'>" | "<'ruby-merge'>" | "<'ruby-position'>" | "<'rx'>" | "<'ry'>" | "<'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-spacing-trim'>" | "<'text-transform'>" | "<'text-underline-offset'>" | "<'text-underline-position'>" | "<'text-wrap'>" | "<'text-wrap-mode'>" | "<'text-wrap-style'>" | "<'timeline-scope'>" | "<'top'>" | "<'touch-action'>" | "<'transform'>" | "<'transform-box'>" | "<'transform-origin'>" | "<'transform-style'>" | "<'transition'>" | "<'transition-behavior'>" | "<'transition-delay'>" | "<'transition-duration'>" | "<'transition-property'>" | "<'transition-timing-function'>" | "<'translate'>" | "<'unicode-bidi'>" | "<'unicode-range'>" | "<'user-select'>" | "<'vector-effect'>" | "<'vertical-align'>" | "<'view-timeline'>" | "<'view-timeline-axis'>" | "<'view-timeline-inset'>" | "<'view-timeline-name'>" | "<'view-transition-name'>" | "<'visibility'>" | "<'voice-balance'>" | "<'voice-duration'>" | "<'voice-family'>" | "<'voice-pitch'>" | "<'voice-range'>" | "<'voice-rate'>" | "<'voice-stress'>" | "<'voice-volume'>" | "<'white-space'>" | "<'white-space-collapse'>" | "<'white-space-trim'>" | "<'widows'>" | "<'width'>" | "<'will-change'>" | "<'word-break'>" | "<'word-spacing'>" | "<'word-wrap'>" | "<'writing-mode'>" | "<'x'>" | "<'y'>" | "<'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>' | '<-non-standard-color>' | '<-non-standard-display>' | '<-non-standard-font>' | '<-non-standard-generic-family>' | '<-non-standard-image-rendering>' | '<-non-standard-overflow>' | '<-non-standard-size>' | '<-webkit-gradient()>' | '<-webkit-gradient-color-stop>' | '<-webkit-gradient-point>' | '<-webkit-gradient-radius>' | '<-webkit-gradient-type>' | '<-webkit-mask-box-repeat>' | '<CDC-token>' | '<CDO-token>' | '<[-token>' | '<]-token>' | '<abs()>' | '<absolute-color-base>' | '<absolute-color-function>' | '<absolute-size>' | '<acos()>' | '<age>' | '<alpha-value>' | '<an-plus-b>' | '<anchor()>' | '<anchor-element>' | '<anchor-name>' | '<anchor-side>' | '<anchor-size()>' | '<anchor-size>' | '<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>' | '<cmyk-component>' | '<colon-token>' | '<color()>' | '<color-base>' | '<color-function>' | '<color-interpolation-method>' | '<color-mix()>' | '<color-space>' | '<color-stop-angle>' | '<color-stop-length>' | '<color-stop-list>' | '<color-stop>' | '<color>' | '<colorspace-params>' | '<combinator>' | '<comma-token>' | '<common-lig-values>' | '<compat-auto>' | '<complex-real-selector-list>' | '<complex-real-selector>' | '<complex-selector-list>' | '<complex-selector-unit>' | '<complex-selector>' | '<composite-style>' | '<compositing-operator>' | '<compound-selector-list>' | '<compound-selector>' | '<conic-gradient()>' | '<container-condition>' | '<container-name>' | '<content-distribution>' | '<content-list>' | '<content-position>' | '<content-replacement>' | '<contextual-alt-values>' | '<contrast()>' | '<coord-box>' | '<cos()>' | '<counter()>' | '<counter-name>' | '<counter-style-name>' | '<counter-style>' | '<counter>' | '<counters()>' | '<cross-fade()>' | '<cubic-bezier-timing-function>' | '<custom-color-space>' | '<custom-ident>' | '<custom-property-name>' | '<dashed-ident>' | '<decibel>' | '<declaration-list>' | '<declaration-value>' | '<declaration>' | '<delim-token>' | '<deprecated-system-color>' | '<device-cmyk()>' | '<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-variant-css2>' | '<font-weight-absolute>' | '<font-width-css3>' | '<forgiving-relative-selector-list>' | '<forgiving-selector-list>' | '<frequency-percentage>' | '<frequency>' | '<function-token>' | '<gender>' | '<general-enclosed>' | '<generic-complete>' | '<generic-family>' | '<generic-incomplete>' | '<generic-name>' | '<generic-script-specific>' | '<generic-voice>' | '<geometry-box>' | '<gradient>' | '<grayscale()>' | '<grid-line>' | '<hash-token>' | '<hex-color>' | '<historical-lig-values>' | '<hsl()>' | '<hsla()>' | '<hue-interpolation-method>' | '<hue-rotate()>' | '<hue>' | '<hwb()>' | '<hypot()>' | '<id-selector>' | '<ident-token>' | '<ident>' | '<image()>' | '<image-set()>' | '<image-set-option>' | '<image-src>' | '<image-tags>' | '<image>' | '<inflexible-breadth>' | '<inset()>' | '<inset-area>' | '<integer>' | '<invert()>' | '<keyframe-block-list>' | '<keyframe-block>' | '<keyframe-selector>' | '<keyframes-name>' | '<lab()>' | '<layer()>' | '<layer-name>' | '<lch()>' | '<leader()>' | '<leader-type>' | '<left>' | '<legacy-device-cmyk-syntax>' | '<legacy-pseudo-element-selector>' | '<length-percentage>' | '<length>' | '<light-dark()>' | '<line-name-list>' | '<line-names>' | '<line-style>' | '<line-width>' | '<linear-color-hint>' | '<linear-color-stop>' | '<linear-gradient()>' | '<log()>' | '<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()>' | '<modern-device-cmyk-syntax>' | '<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>' | '<offset-path>' | '<oklab()>' | '<oklch()>' | '<opacity()>' | '<outline-radius>' | '<overflow-position>' | '<page-body>' | '<page-margin-box-type>' | '<page-margin-box>' | '<page-selector-list>' | '<page-selector>' | '<page-size>' | '<paint()>' | '<paint>' | '<palette-identifier>' | '<path()>' | '<percentage-token>' | '<percentage>' | '<perspective()>' | '<polar-color-space>' | '<polygon()>' | '<position-area>' | '<position>' | '<pow()>' | '<predefined-rgb-params>' | '<predefined-rgb>' | '<pseudo-class-selector>' | '<pseudo-compound-selector>' | '<pseudo-element-selector>' | '<pseudo-page>' | '<query-in-parens>' | '<quote>' | '<radial-gradient()>' | '<ratio>' | '<ray()>' | '<ray-size>' | '<rect()>' | '<rectangular-color-space>' | '<relative-real-selector-list>' | '<relative-real-selector>' | '<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()>' | '<scope-end>' | '<scope-start>' | '<scroll()>' | '<scroller>' | '<selector-list>' | '<self-position>' | '<semicolon-token>' | '<semitones>' | '<sepia()>' | '<shadow-t>' | '<shadow>' | '<shape-box>' | '<shape-radius>' | '<shape>' | '<side-or-corner>' | '<sign()>' | '<simple-selector-list>' | '<simple-selector>' | '<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-feature>' | '<size>' | '<skew()>' | '<skewX()>' | '<skewY()>' | '<sqrt()>' | '<step-position>' | '<step-timing-function>' | '<string-token>' | '<string>' | '<style-condition>' | '<style-feature>' | '<style-in-parens>' | '<style-query>' | '<subclass-selector>' | '<supports-condition>' | '<supports-decl>' | '<supports-feature>' | '<supports-in-parens>' | '<supports-selector-fn>' | '<svg-length>' | '<svg-writing-mode>' | '<symbol>' | '<system-color>' | '<system-family-name>' | '<tan()>' | '<target-counter()>' | '<target-counters()>' | '<target-text()>' | '<target>' | '<time-percentage>' | '<time>' | '<timeline-range-name>' | '<top>' | '<track-breadth>' | '<track-list>' | '<track-repeat>' | '<track-size>' | '<transform-function>' | '<transform-list>' | '<transition-behavior-value>' | '<translate()>' | '<translate3d()>' | '<translateX()>' | '<translateY()>' | '<translateZ()>' | '<try-size>' | '<try-tactic>' | '<type-or-unit>' | '<type-selector>' | '<urange>' | '<url-modifier>' | '<url-token>' | '<url>' | '<var()>' | '<view()>' | '<viewport-length>' | '<visual-box>' | '<whitespace-token>' | '<wq-name>' | '<x>' | '<xywh()>' | '<xyz-params>' | '<xyz-space>' | '<y>' | '<zero>' | '<{-token>' | '<}-token>';
|
|
9
9
|
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' | 'BaseURL' | 'BrowsingContextName' | 'BrowsingContextNameOrKeyword' | 'CustomElementName' | 'DOMID' | 'DateTime' | 'FunctionBody' | 'HTTPSchemaURL' | 'HashName' | 'IconSize' | 'Int' | 'ItemProp' | 'JSON' | 'LinkTypeForAnchorAndAreaElement' | 'LinkTypeForFormElement' | 'LinkTypeForLinkElement' | 'LinkTypeForLinkElementInBody' | 'MIMEType' | 'NavigableTargetName' | 'NavigableTargetNameOrKeyword' | 'NoEmptyAny' | 'Number' | 'OneCodePointChar' | 'OneLineAny' | 'Pattern' | 'SerializedPermissionsPolicy' | 'SourceSizeList' | 'Srcset' | 'TabIndex' | 'URL' | 'Uint' | 'ValidCustomCommand' | 'XMLName' | 'Zero';
|
|
@@ -66,3 +66,6 @@ export interface Directive {
|
|
|
66
66
|
token: Type;
|
|
67
67
|
ref?: string;
|
|
68
68
|
}
|
|
69
|
+
export interface Pattern {
|
|
70
|
+
pattern: string;
|
|
71
|
+
}
|