@markuplint/types 1.0.0-dev.20211213.0
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/LICENSE +21 -0
- package/README.md +117 -0
- package/extends.json +12 -0
- package/gen/specific-schema.json +98 -0
- package/gen/types.ts +66 -0
- package/lib/check-multi-types.d.ts +2 -0
- package/lib/check-multi-types.js +29 -0
- package/lib/check.d.ts +8 -0
- package/lib/check.js +49 -0
- package/lib/check.spec.d.ts +1 -0
- package/lib/check.spec.js +57 -0
- package/lib/css-syntax.d.ts +2 -0
- package/lib/css-syntax.js +141 -0
- package/lib/css-syntax.spec.d.ts +1 -0
- package/lib/css-syntax.spec.js +157 -0
- package/lib/debug.d.ts +2 -0
- package/lib/debug.js +6 -0
- package/lib/defs.d.ts +3 -0
- package/lib/defs.js +752 -0
- package/lib/enum.d.ts +3 -0
- package/lib/enum.js +26 -0
- package/lib/get-candicate.d.ts +3 -0
- package/lib/get-candicate.js +26 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +6 -0
- package/lib/keyword-type.d.ts +3 -0
- package/lib/keyword-type.js +46 -0
- package/lib/list.d.ts +3 -0
- package/lib/list.js +29 -0
- package/lib/list.spec.d.ts +1 -0
- package/lib/list.spec.js +129 -0
- package/lib/match-result.d.ts +9 -0
- package/lib/match-result.js +33 -0
- package/lib/number.d.ts +3 -0
- package/lib/number.js +41 -0
- package/lib/primitive/index.d.ts +7 -0
- package/lib/primitive/index.js +17 -0
- package/lib/primitive/index.spec.d.ts +1 -0
- package/lib/primitive/index.spec.js +62 -0
- package/lib/primitive/is-float.d.ts +6 -0
- package/lib/primitive/is-float.js +12 -0
- package/lib/primitive/is-int.d.ts +6 -0
- package/lib/primitive/is-int.js +12 -0
- package/lib/primitive/is-non-zero-uint.d.ts +6 -0
- package/lib/primitive/is-non-zero-uint.js +12 -0
- package/lib/primitive/is-quantity.d.ts +7 -0
- package/lib/primitive/is-quantity.js +41 -0
- package/lib/primitive/is-uint.d.ts +8 -0
- package/lib/primitive/is-uint.js +19 -0
- package/lib/primitive/range.d.ts +8 -0
- package/lib/primitive/range.js +18 -0
- package/lib/primitive/split-unit.d.ts +9 -0
- package/lib/primitive/split-unit.js +24 -0
- package/lib/rfc/is-bcp-47.d.ts +5 -0
- package/lib/rfc/is-bcp-47.js +14 -0
- package/lib/rfc/is-bcp-47.spec.d.ts +1 -0
- package/lib/rfc/is-bcp-47.spec.js +19 -0
- package/lib/token/index.d.ts +2 -0
- package/lib/token/index.js +7 -0
- package/lib/token/token-collection.d.ts +62 -0
- package/lib/token/token-collection.js +383 -0
- package/lib/token/token-collection.spec.d.ts +1 -0
- package/lib/token/token-collection.spec.js +144 -0
- package/lib/token/token.d.ts +55 -0
- package/lib/token/token.js +128 -0
- package/lib/types.d.ts +78 -0
- package/lib/types.js +2 -0
- package/lib/types.schema.d.ts +54 -0
- package/lib/types.schema.js +8 -0
- package/lib/w3c/check-serialized-permissions-policy.d.ts +15 -0
- package/lib/w3c/check-serialized-permissions-policy.js +251 -0
- package/lib/w3c/check-serialized-permissions-policy.spec.d.ts +1 -0
- package/lib/w3c/check-serialized-permissions-policy.spec.js +26 -0
- package/lib/whatwg/check-autocomplete.d.ts +5 -0
- package/lib/whatwg/check-autocomplete.js +282 -0
- package/lib/whatwg/check-autocomplete.spec.d.ts +1 -0
- package/lib/whatwg/check-autocomplete.spec.js +370 -0
- package/lib/whatwg/check-datetime/date-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/date-string.js +31 -0
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +3 -0
- package/lib/whatwg/check-datetime/datetime-tokens.js +509 -0
- package/lib/whatwg/check-datetime/duration-string.d.ts +6 -0
- package/lib/whatwg/check-datetime/duration-string.js +322 -0
- package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/global-date-and-time-string.js +66 -0
- package/lib/whatwg/check-datetime/index.d.ts +5 -0
- package/lib/whatwg/check-datetime/index.js +35 -0
- package/lib/whatwg/check-datetime/index.spec.d.ts +1 -0
- package/lib/whatwg/check-datetime/index.spec.js +318 -0
- package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +9 -0
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +116 -0
- package/lib/whatwg/check-datetime/month-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/month-string.js +20 -0
- package/lib/whatwg/check-datetime/time-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/time-string.js +35 -0
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +7 -0
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +75 -0
- package/lib/whatwg/check-datetime/week-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/week-string.js +29 -0
- package/lib/whatwg/check-datetime/year-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/year-string.js +20 -0
- package/lib/whatwg/check-datetime/yearless-date-string.d.ts +5 -0
- package/lib/whatwg/check-datetime/yearless-date-string.js +27 -0
- package/lib/whatwg/check-mime-type.d.ts +11 -0
- package/lib/whatwg/check-mime-type.js +42 -0
- package/lib/whatwg/check-mime-type.spec.d.ts +1 -0
- package/lib/whatwg/check-mime-type.spec.js +58 -0
- package/lib/whatwg/is-abs-url.d.ts +15 -0
- package/lib/whatwg/is-abs-url.js +34 -0
- package/lib/whatwg/is-abs-url.spec.d.ts +1 -0
- package/lib/whatwg/is-abs-url.spec.js +8 -0
- package/lib/whatwg/is-browser-context-name.d.ts +11 -0
- package/lib/whatwg/is-browser-context-name.js +18 -0
- package/lib/whatwg/is-custom-element-name.d.ts +22 -0
- package/lib/whatwg/is-custom-element-name.js +77 -0
- package/lib/whatwg/is-itemprop-name.d.ts +12 -0
- package/lib/whatwg/is-itemprop-name.js +19 -0
- package/package.json +33 -0
- package/src/check-multi-types.ts +35 -0
- package/src/check.spec.ts +62 -0
- package/src/check.ts +48 -0
- package/src/css-syntax.spec.ts +167 -0
- package/src/css-syntax.ts +177 -0
- package/src/debug.ts +3 -0
- package/src/defs.ts +810 -0
- package/src/enum.ts +25 -0
- package/src/get-candicate.ts +24 -0
- package/src/index.ts +3 -0
- package/src/keyword-type.ts +52 -0
- package/src/list.spec.ts +133 -0
- package/src/list.ts +34 -0
- package/src/match-result.ts +49 -0
- package/src/number.ts +46 -0
- package/src/primitive/index.spec.ts +65 -0
- package/src/primitive/index.ts +7 -0
- package/src/primitive/is-float.ts +8 -0
- package/src/primitive/is-int.ts +8 -0
- package/src/primitive/is-non-zero-uint.ts +8 -0
- package/src/primitive/is-quantity.ts +38 -0
- package/src/primitive/is-uint.ts +15 -0
- package/src/primitive/range.ts +14 -0
- package/src/primitive/split-unit.ts +20 -0
- package/src/rfc/is-bcp-47.spec.ts +23 -0
- package/src/rfc/is-bcp-47.ts +13 -0
- package/src/token/index.ts +2 -0
- package/src/token/token-collection.spec.ts +147 -0
- package/src/token/token-collection.ts +444 -0
- package/src/token/token.ts +144 -0
- package/src/types.schema.ts +1059 -0
- package/src/types.ts +118 -0
- package/src/w3c/check-serialized-permissions-policy.spec.ts +27 -0
- package/src/w3c/check-serialized-permissions-policy.ts +287 -0
- package/src/whatwg/check-autocomplete.spec.ts +378 -0
- package/src/whatwg/check-autocomplete.ts +324 -0
- package/src/whatwg/check-datetime/date-string.ts +44 -0
- package/src/whatwg/check-datetime/datetime-tokens.ts +600 -0
- package/src/whatwg/check-datetime/duration-string.ts +399 -0
- package/src/whatwg/check-datetime/global-date-and-time-string.ts +96 -0
- package/src/whatwg/check-datetime/index.spec.ts +333 -0
- package/src/whatwg/check-datetime/index.ts +36 -0
- package/src/whatwg/check-datetime/local-date-and-time-string.ts +163 -0
- package/src/whatwg/check-datetime/month-string.ts +31 -0
- package/src/whatwg/check-datetime/time-string.ts +49 -0
- package/src/whatwg/check-datetime/time-zone-offset-string.ts +93 -0
- package/src/whatwg/check-datetime/week-string.ts +41 -0
- package/src/whatwg/check-datetime/year-string.ts +26 -0
- package/src/whatwg/check-datetime/yearless-date-string.ts +38 -0
- package/src/whatwg/check-mime-type.spec.ts +59 -0
- package/src/whatwg/check-mime-type.ts +46 -0
- package/src/whatwg/is-abs-url.spec.ts +8 -0
- package/src/whatwg/is-abs-url.ts +31 -0
- package/src/whatwg/is-browser-context-name.ts +16 -0
- package/src/whatwg/is-custom-element-name.ts +76 -0
- package/src/whatwg/is-itemprop-name.ts +17 -0
- package/tsconfig.test.json +3 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types.schema.json +1092 -0
package/lib/defs.js
ADDED
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tokenizers = exports.types = void 0;
|
|
4
|
+
const get_candicate_1 = require("./get-candicate");
|
|
5
|
+
const match_result_1 = require("./match-result");
|
|
6
|
+
const primitive_1 = require("./primitive");
|
|
7
|
+
const is_bcp_47_1 = require("./rfc/is-bcp-47");
|
|
8
|
+
const token_1 = require("./token");
|
|
9
|
+
const check_serialized_permissions_policy_1 = require("./w3c/check-serialized-permissions-policy");
|
|
10
|
+
const check_autocomplete_1 = require("./whatwg/check-autocomplete");
|
|
11
|
+
const check_datetime_1 = require("./whatwg/check-datetime");
|
|
12
|
+
const check_mime_type_1 = require("./whatwg/check-mime-type");
|
|
13
|
+
const is_abs_url_1 = require("./whatwg/is-abs-url");
|
|
14
|
+
const is_browser_context_name_1 = require("./whatwg/is-browser-context-name");
|
|
15
|
+
const is_custom_element_name_1 = require("./whatwg/is-custom-element-name");
|
|
16
|
+
const is_itemprop_name_1 = require("./whatwg/is-itemprop-name");
|
|
17
|
+
exports.types = {
|
|
18
|
+
Any: {
|
|
19
|
+
ref: '',
|
|
20
|
+
is: () => (0, match_result_1.matched)(),
|
|
21
|
+
},
|
|
22
|
+
NoEmptyAny: {
|
|
23
|
+
ref: '',
|
|
24
|
+
is: value => (0 < value.length ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'empty-token')),
|
|
25
|
+
},
|
|
26
|
+
OneLineAny: {
|
|
27
|
+
ref: '',
|
|
28
|
+
is: value => {
|
|
29
|
+
const tokens = new token_1.TokenCollection(value);
|
|
30
|
+
/**
|
|
31
|
+
* @see https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
|
32
|
+
*/
|
|
33
|
+
const newline = ['\u000A', '\u000D'];
|
|
34
|
+
const newlineToken = tokens.search(newline);
|
|
35
|
+
if (newlineToken) {
|
|
36
|
+
return newlineToken.unmatched({
|
|
37
|
+
reason: 'unexpected-newline',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return (0, match_result_1.matched)();
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
Zero: {
|
|
44
|
+
ref: '',
|
|
45
|
+
expects: [
|
|
46
|
+
{
|
|
47
|
+
type: 'common',
|
|
48
|
+
value: 'zero',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
is: value => (value === '0' ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'syntax-error')),
|
|
52
|
+
},
|
|
53
|
+
Number: {
|
|
54
|
+
ref: '',
|
|
55
|
+
expects: [
|
|
56
|
+
{
|
|
57
|
+
type: 'common',
|
|
58
|
+
value: 'number',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
is: value => ((0, primitive_1.isFloat)(value) ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'unexpected-token')),
|
|
62
|
+
},
|
|
63
|
+
Int: {
|
|
64
|
+
ref: '',
|
|
65
|
+
expects: [
|
|
66
|
+
{
|
|
67
|
+
type: 'common',
|
|
68
|
+
value: 'integer',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
is: value => ((0, primitive_1.isInt)(value) ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'unexpected-token')),
|
|
72
|
+
},
|
|
73
|
+
Uint: {
|
|
74
|
+
ref: '',
|
|
75
|
+
expects: [
|
|
76
|
+
{
|
|
77
|
+
type: 'common',
|
|
78
|
+
value: 'non-negative integer',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
is: value => ((0, primitive_1.isUint)(value) ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'unexpected-token')),
|
|
82
|
+
},
|
|
83
|
+
XMLName: {
|
|
84
|
+
ref: 'https://www.w3.org/TR/xml/#NT-Name',
|
|
85
|
+
expects: [
|
|
86
|
+
{
|
|
87
|
+
type: 'format',
|
|
88
|
+
value: 'XML name',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
is: value => {
|
|
92
|
+
// NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
|
93
|
+
const nameStartChar = /[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]/u;
|
|
94
|
+
// NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
|
95
|
+
const nameCharTail = /-|[.0-9\u00B7]|[\u0300-\u036F\u203F-\u2040]/;
|
|
96
|
+
// Name ::= NameStartChar (NameChar)*
|
|
97
|
+
const name = RegExp(`(?:${nameStartChar.source})(?:${nameCharTail})*`, 'u');
|
|
98
|
+
return name.test(value) ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'unexpected-token');
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
DOMID: {
|
|
102
|
+
ref: 'https://html.spec.whatwg.org/multipage/dom.html#global-attributes:concept-id',
|
|
103
|
+
expects: [
|
|
104
|
+
{
|
|
105
|
+
type: 'format',
|
|
106
|
+
value: 'ID',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
is: value => {
|
|
110
|
+
const tokens = new token_1.TokenCollection(value);
|
|
111
|
+
const ws = tokens.search(token_1.Token.WhiteSpace);
|
|
112
|
+
if (ws) {
|
|
113
|
+
return ws.unmatched({
|
|
114
|
+
reason: 'unexpected-space',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (!tokens.length) {
|
|
118
|
+
return (0, match_result_1.unmatched)(value, 'empty-token');
|
|
119
|
+
}
|
|
120
|
+
return (0, match_result_1.matched)();
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
FunctionBody: {
|
|
124
|
+
ref: '',
|
|
125
|
+
expects: [
|
|
126
|
+
{
|
|
127
|
+
type: 'syntax',
|
|
128
|
+
value: 'JavaScript',
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
// **NO IMPLEMENT PLAN NOW**
|
|
132
|
+
is: () => (0, match_result_1.matched)(),
|
|
133
|
+
},
|
|
134
|
+
Pattern: {
|
|
135
|
+
ref: 'https://html.spec.whatwg.org/multipage/input.html#compiled-pattern-regular-expression',
|
|
136
|
+
expects: [
|
|
137
|
+
{
|
|
138
|
+
type: 'common',
|
|
139
|
+
value: 'regular expression',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
is: value => {
|
|
143
|
+
try {
|
|
144
|
+
new RegExp(`^(?:${value})$`);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return (0, match_result_1.unmatched)(value);
|
|
148
|
+
}
|
|
149
|
+
return (0, match_result_1.matched)();
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
DateTime: {
|
|
153
|
+
ref: 'https://html.spec.whatwg.org/multipage/text-level-semantics.html#datetime-value',
|
|
154
|
+
expects: [
|
|
155
|
+
{
|
|
156
|
+
type: 'format',
|
|
157
|
+
value: 'date time',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
is: (0, check_datetime_1.checkDateTime)(),
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* It doesn't check the meaningless number less than -1
|
|
164
|
+
* that is the same as -1.
|
|
165
|
+
* It is another rule.
|
|
166
|
+
*/
|
|
167
|
+
TabIndex: {
|
|
168
|
+
expects: [
|
|
169
|
+
{
|
|
170
|
+
type: 'common',
|
|
171
|
+
value: '-1',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'common',
|
|
175
|
+
value: '0',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
type: 'common',
|
|
179
|
+
value: 'non-negative integer',
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
ref: 'https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex',
|
|
183
|
+
is: (0, match_result_1.matches)(value => (0, primitive_1.isInt)(value)),
|
|
184
|
+
},
|
|
185
|
+
BCP47: {
|
|
186
|
+
expects: [
|
|
187
|
+
{
|
|
188
|
+
type: 'format',
|
|
189
|
+
value: 'BCP47',
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
ref: 'https://tools.ietf.org/rfc/bcp/bcp47.html',
|
|
193
|
+
is: (0, match_result_1.matches)((0, is_bcp_47_1.isBCP47)(), { reason: 'unexpected-token' }),
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* **NO IMPLEMENT NEVER**
|
|
197
|
+
*
|
|
198
|
+
* We can evaluate the absolute URL through WHATWG API,
|
|
199
|
+
* but it isn't easy to check the relative URL.
|
|
200
|
+
* And the relative URL expects almost all of the characters.
|
|
201
|
+
* In short, this checking is meaningless.
|
|
202
|
+
*
|
|
203
|
+
* So it always returns the matched object.
|
|
204
|
+
*
|
|
205
|
+
* If you want to expect the URL without multi-byte characters,
|
|
206
|
+
* it should use another rule.
|
|
207
|
+
*/
|
|
208
|
+
URL: {
|
|
209
|
+
ref: 'https://html.spec.whatwg.org/multipage/urls-and-fetching.html#valid-url-potentially-surrounded-by-spaces',
|
|
210
|
+
is: () => (0, match_result_1.matched)(),
|
|
211
|
+
},
|
|
212
|
+
AbsoluteURL: {
|
|
213
|
+
ref: 'https://url.spec.whatwg.org/#syntax-url-absolute',
|
|
214
|
+
is: (0, match_result_1.matches)((0, is_abs_url_1.isAbsURL)()),
|
|
215
|
+
},
|
|
216
|
+
HashName: {
|
|
217
|
+
ref: 'https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-hash-name-reference',
|
|
218
|
+
expects: [
|
|
219
|
+
{
|
|
220
|
+
type: 'format',
|
|
221
|
+
value: 'hash name',
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
is: value => (value[0] === '#' ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'unexpected-token')),
|
|
225
|
+
},
|
|
226
|
+
OneCodePointChar: {
|
|
227
|
+
ref: 'https://html.spec.whatwg.org/multipage/interaction.html#the-accesskey-attribute',
|
|
228
|
+
expects: [
|
|
229
|
+
{
|
|
230
|
+
type: 'common',
|
|
231
|
+
value: 'one code point character',
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
is: value => (value.length === 1 ? (0, match_result_1.matched)() : (0, match_result_1.unmatched)(value, 'unexpected-token')),
|
|
235
|
+
},
|
|
236
|
+
CustomElementName: {
|
|
237
|
+
ref: 'https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name',
|
|
238
|
+
expects: [
|
|
239
|
+
{
|
|
240
|
+
type: 'format',
|
|
241
|
+
value: 'custom element name',
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
is: (0, match_result_1.matches)((0, is_custom_element_name_1.isCustomElementName)()),
|
|
245
|
+
},
|
|
246
|
+
BrowsingContextName: {
|
|
247
|
+
ref: 'https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-names',
|
|
248
|
+
expects: [
|
|
249
|
+
{
|
|
250
|
+
type: 'common',
|
|
251
|
+
value: 'browsing context name',
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
// <iframe name="[HERE]">
|
|
255
|
+
is: (0, match_result_1.matches)((0, is_browser_context_name_1.isBrowserContextName)()),
|
|
256
|
+
},
|
|
257
|
+
BrowsingContextNameOrKeyword: {
|
|
258
|
+
ref: 'https://html.spec.whatwg.org/multipage/browsers.html#valid-browsing-context-name-or-keyword',
|
|
259
|
+
expects: [
|
|
260
|
+
{ type: 'const', value: '_blank' },
|
|
261
|
+
{ type: 'const', value: '_self' },
|
|
262
|
+
{ type: 'const', value: '_parent' },
|
|
263
|
+
{ type: 'const', value: '_top' },
|
|
264
|
+
{
|
|
265
|
+
type: 'common',
|
|
266
|
+
value: 'browsing context name',
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
// <a target="[HERE]">
|
|
270
|
+
is(value) {
|
|
271
|
+
value = value.toLowerCase();
|
|
272
|
+
const keywords = ['_blank', '_self', '_parent', '_top'];
|
|
273
|
+
if (keywords.includes(value)) {
|
|
274
|
+
return (0, match_result_1.matched)();
|
|
275
|
+
}
|
|
276
|
+
if (value[0] === '_') {
|
|
277
|
+
const candicate = (0, get_candicate_1.getCandicate)(value, keywords);
|
|
278
|
+
return (0, match_result_1.unmatched)(value, 'unexpected-token', { candicate });
|
|
279
|
+
}
|
|
280
|
+
return (0, match_result_1.matches)((0, is_browser_context_name_1.isBrowserContextName)())(value);
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
HTTPSchemaURL: {
|
|
284
|
+
ref: 'https://html.spec.whatwg.org/multipage/links.html#ping',
|
|
285
|
+
expects: [
|
|
286
|
+
{
|
|
287
|
+
type: 'format',
|
|
288
|
+
value: 'URL who schema is an HTTP(S) schema',
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
is(value) {
|
|
292
|
+
if ((0, is_abs_url_1.isAbsURL)()(value)) {
|
|
293
|
+
return (0, match_result_1.unmatched)(value, 'unexpected-token');
|
|
294
|
+
}
|
|
295
|
+
if (/^https?/i.test(value)) {
|
|
296
|
+
return (0, match_result_1.matched)();
|
|
297
|
+
}
|
|
298
|
+
return (0, match_result_1.unmatched)(value, 'unexpected-token', {
|
|
299
|
+
expects: [
|
|
300
|
+
{
|
|
301
|
+
type: 'format',
|
|
302
|
+
value: 'HTTP(S) schema',
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
MIMEType: {
|
|
309
|
+
ref: 'https://mimesniff.spec.whatwg.org/#valid-mime-type',
|
|
310
|
+
expects: [
|
|
311
|
+
{
|
|
312
|
+
type: 'format',
|
|
313
|
+
value: 'MIME Type',
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
is: (0, check_mime_type_1.checkMIMEType)(),
|
|
317
|
+
},
|
|
318
|
+
ItemProp: {
|
|
319
|
+
ref: 'https://html.spec.whatwg.org/multipage/microdata.html#names:-the-itemprop-attribute',
|
|
320
|
+
expects: [
|
|
321
|
+
{
|
|
322
|
+
type: 'common',
|
|
323
|
+
value: 'absolute URL',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
type: 'format',
|
|
327
|
+
value: 'property name',
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
is(value) {
|
|
331
|
+
if (!(0, is_abs_url_1.isAbsURL)()(value)) {
|
|
332
|
+
return (0, match_result_1.unmatched)(value, 'unexpected-token');
|
|
333
|
+
}
|
|
334
|
+
if (!(0, is_itemprop_name_1.isItempropName)()(value)) {
|
|
335
|
+
return (0, match_result_1.unmatched)(value, 'unexpected-token');
|
|
336
|
+
}
|
|
337
|
+
return (0, match_result_1.matched)();
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
Srcset: {
|
|
341
|
+
ref: 'https://html.spec.whatwg.org/multipage/images.html#srcset-attributes',
|
|
342
|
+
syntax: {
|
|
343
|
+
apply: '<srcset>',
|
|
344
|
+
def: {
|
|
345
|
+
srcset: '<image-candidate-strings> [, <image-candidate-strings>]*',
|
|
346
|
+
'image-candidate-strings': '<valid-non-empty-url> [ <width-descriptor> | <pixel-density-descriptor> ]?',
|
|
347
|
+
'valid-non-empty-url'(token, getNextToken) {
|
|
348
|
+
if (!token) {
|
|
349
|
+
return 0;
|
|
350
|
+
}
|
|
351
|
+
let willAdoptTokenLength = 0;
|
|
352
|
+
do {
|
|
353
|
+
if (token.type === 13) {
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
willAdoptTokenLength++;
|
|
357
|
+
} while ((token = getNextToken(willAdoptTokenLength)));
|
|
358
|
+
return willAdoptTokenLength;
|
|
359
|
+
},
|
|
360
|
+
'width-descriptor'(token) {
|
|
361
|
+
if (!token) {
|
|
362
|
+
return 0;
|
|
363
|
+
}
|
|
364
|
+
const { num, unit } = (0, primitive_1.splitUnit)(token.value);
|
|
365
|
+
if (unit !== 'w') {
|
|
366
|
+
return 0;
|
|
367
|
+
}
|
|
368
|
+
if (!(0, primitive_1.isUint)(num)) {
|
|
369
|
+
return 0;
|
|
370
|
+
}
|
|
371
|
+
return 1;
|
|
372
|
+
},
|
|
373
|
+
'pixel-density-descriptor'(token) {
|
|
374
|
+
if (!token) {
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
const { num, unit } = (0, primitive_1.splitUnit)(token.value);
|
|
378
|
+
if (unit !== 'x') {
|
|
379
|
+
return 0;
|
|
380
|
+
}
|
|
381
|
+
if (!(0, primitive_1.isFloat)(num)) {
|
|
382
|
+
return 0;
|
|
383
|
+
}
|
|
384
|
+
return 1;
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
SourceSizeList: {
|
|
390
|
+
ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
|
|
391
|
+
expects: [
|
|
392
|
+
{
|
|
393
|
+
type: 'syntax',
|
|
394
|
+
value: '<source-size-list>',
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
syntax: {
|
|
398
|
+
apply: '<source-size-list>',
|
|
399
|
+
def: {
|
|
400
|
+
'source-size-list': '[ <source-size># , ]? <source-size-value>',
|
|
401
|
+
'source-size': '<media-condition> <source-size-value>',
|
|
402
|
+
'source-size-value': '<length>',
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
IconSize: {
|
|
407
|
+
ref: 'https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes',
|
|
408
|
+
expects: [
|
|
409
|
+
{
|
|
410
|
+
type: 'const',
|
|
411
|
+
value: 'any',
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
type: 'syntax',
|
|
415
|
+
value: '[WIDTH]x[HEIGHT]',
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
is(value) {
|
|
419
|
+
value = value.toLowerCase();
|
|
420
|
+
if (value === 'any') {
|
|
421
|
+
return (0, match_result_1.matched)();
|
|
422
|
+
}
|
|
423
|
+
const tokens = new token_1.TokenCollection(value, { speificSeparator: 'x' });
|
|
424
|
+
const [width, sep, height, ...tail] = tokens;
|
|
425
|
+
if (!width) {
|
|
426
|
+
return (0, match_result_1.unmatched)(value, 'unexpected-token');
|
|
427
|
+
}
|
|
428
|
+
if (!sep) {
|
|
429
|
+
return width.unmatched({ reason: 'unexpected-token' });
|
|
430
|
+
}
|
|
431
|
+
if (!height) {
|
|
432
|
+
return sep.unmatched({ reason: 'unexpected-token' });
|
|
433
|
+
}
|
|
434
|
+
if (tail && tail.length) {
|
|
435
|
+
return tail[0].unmatched({ reason: 'extra-token' });
|
|
436
|
+
}
|
|
437
|
+
if (!(0, primitive_1.isUint)(width.value)) {
|
|
438
|
+
return width.unmatched({ reason: 'unexpected-token' });
|
|
439
|
+
}
|
|
440
|
+
if (width.value === '0') {
|
|
441
|
+
return width.unmatched({ reason: 'out-of-range' });
|
|
442
|
+
}
|
|
443
|
+
if (sep.value !== 'x') {
|
|
444
|
+
return sep.unmatched({ reason: 'out-of-range' });
|
|
445
|
+
}
|
|
446
|
+
if (!(0, primitive_1.isUint)(height.value)) {
|
|
447
|
+
return height.unmatched({ reason: 'unexpected-token' });
|
|
448
|
+
}
|
|
449
|
+
if (height.value === '0') {
|
|
450
|
+
return height.unmatched({ reason: 'out-of-range' });
|
|
451
|
+
}
|
|
452
|
+
return (0, match_result_1.matched)();
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
AutoComplete: {
|
|
456
|
+
ref: 'https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete',
|
|
457
|
+
is: (0, check_autocomplete_1.checkAutoComplete)(),
|
|
458
|
+
},
|
|
459
|
+
Accept: {
|
|
460
|
+
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
461
|
+
expects: [
|
|
462
|
+
{
|
|
463
|
+
type: 'const',
|
|
464
|
+
value: 'audio/*',
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
type: 'const',
|
|
468
|
+
value: 'video/*',
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
type: 'const',
|
|
472
|
+
value: 'image/*',
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
type: 'format',
|
|
476
|
+
value: 'MIME Type',
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
type: 'format',
|
|
480
|
+
value: 'Extension',
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
// input[type=file] accept: { type: { token: "Accept", "separator": "comma" } }
|
|
484
|
+
is(value) {
|
|
485
|
+
const extMap = ['audio/*', 'video/*', 'image/*'];
|
|
486
|
+
if (extMap.includes(value))
|
|
487
|
+
return (0, match_result_1.matched)();
|
|
488
|
+
// A valid MIME type string with no parameters
|
|
489
|
+
const mimeMatched = (0, check_mime_type_1.checkMIMEType)({ withoutParameters: true })(value);
|
|
490
|
+
if (mimeMatched.matched)
|
|
491
|
+
return (0, match_result_1.matched)();
|
|
492
|
+
// A string whose first character is a U+002E FULL STOP character (.)
|
|
493
|
+
return value[0] === '.' && value[1] ? (0, match_result_1.matched)() : mimeMatched;
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
SerializedPermissionsPolicy: {
|
|
497
|
+
ref: 'https://w3c.github.io/webappsec-permissions-policy/#serialized-permissions-policy',
|
|
498
|
+
is: (0, check_serialized_permissions_policy_1.checkSerializedPermissionsPolicy)(),
|
|
499
|
+
},
|
|
500
|
+
'<css-declaration-list>': {
|
|
501
|
+
ref: 'https://drafts.csswg.org/css-style-attr/#syntax',
|
|
502
|
+
syntax: {
|
|
503
|
+
apply: '<css-declaration-list>',
|
|
504
|
+
def: {
|
|
505
|
+
'css-declaration-list': '<declaration-list>',
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
'<class-list>': {
|
|
510
|
+
ref: 'https://www.w3.org/TR/SVG/styling.html#ClassAttribute',
|
|
511
|
+
syntax: {
|
|
512
|
+
apply: '<class-list>',
|
|
513
|
+
def: {
|
|
514
|
+
'class-list': '<ident-token>*',
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
'<svg-font-size>': {
|
|
519
|
+
ref: 'https://drafts.csswg.org/css-fonts-5/#descdef-font-face-font-size',
|
|
520
|
+
// TODO:
|
|
521
|
+
is: () => (0, match_result_1.matched)(),
|
|
522
|
+
},
|
|
523
|
+
'<svg-font-size-adjust>': {
|
|
524
|
+
ref: 'https://drafts.csswg.org/css-fonts-5/#propdef-font-size-adjust',
|
|
525
|
+
// TODO:
|
|
526
|
+
is: () => (0, match_result_1.matched)(),
|
|
527
|
+
},
|
|
528
|
+
"<'color-profile'>": {
|
|
529
|
+
ref: 'https://www.w3.org/TR/SVG11/color.html#ColorProfileProperty',
|
|
530
|
+
// TODO:
|
|
531
|
+
is: () => (0, match_result_1.matched)(),
|
|
532
|
+
},
|
|
533
|
+
"<'color-rendering'>": {
|
|
534
|
+
ref: 'https://www.w3.org/TR/SVG11/painting.html#ColorRenderingProperty',
|
|
535
|
+
// TODO:
|
|
536
|
+
is: () => (0, match_result_1.matched)(),
|
|
537
|
+
},
|
|
538
|
+
"<'enable-background'>": {
|
|
539
|
+
ref: 'https://www.w3.org/TR/SVG11/filters.html#EnableBackgroundProperty',
|
|
540
|
+
// TODO:
|
|
541
|
+
is: () => (0, match_result_1.matched)(),
|
|
542
|
+
},
|
|
543
|
+
'<list-of-svg-feature-string>': {
|
|
544
|
+
ref: 'https://www.w3.org/TR/SVG11/feature.html',
|
|
545
|
+
// TODO:
|
|
546
|
+
is: () => (0, match_result_1.matched)(),
|
|
547
|
+
},
|
|
548
|
+
'<animatable-value>': {
|
|
549
|
+
ref: 'https://svgwg.org/specs/animations/#FromAttribute',
|
|
550
|
+
// TODO:
|
|
551
|
+
is: () => (0, match_result_1.matched)(),
|
|
552
|
+
},
|
|
553
|
+
'<begin-value-list>': {
|
|
554
|
+
ref: 'https://svgwg.org/specs/animations/#BeginValueListSyntax',
|
|
555
|
+
// TODO:
|
|
556
|
+
is: () => (0, match_result_1.matched)(),
|
|
557
|
+
},
|
|
558
|
+
'<end-value-list>': {
|
|
559
|
+
ref: 'https://svgwg.org/specs/animations/#EndValueListSyntax',
|
|
560
|
+
// TODO:
|
|
561
|
+
is: () => (0, match_result_1.matched)(),
|
|
562
|
+
},
|
|
563
|
+
'<list-of-value>': {
|
|
564
|
+
ref: 'https://svgwg.org/specs/animations/#ValuesAttribute',
|
|
565
|
+
// TODO:
|
|
566
|
+
is: () => (0, match_result_1.matched)(),
|
|
567
|
+
},
|
|
568
|
+
'<clock-value>': {
|
|
569
|
+
ref: 'https://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-ClockValueSyntax',
|
|
570
|
+
syntax: {
|
|
571
|
+
// TODO:
|
|
572
|
+
apply: '<clock-value>',
|
|
573
|
+
def: {
|
|
574
|
+
'clock-value': '<any-value>',
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
'<color-matrix>': {
|
|
579
|
+
ref: 'https://drafts.fxtf.org/filter-effects/#element-attrdef-fecolormatrix-values',
|
|
580
|
+
syntax: {
|
|
581
|
+
apply: '<color-matrix>',
|
|
582
|
+
def: {
|
|
583
|
+
'color-matrix': '[ <number-zero-one> [,]? ]{19} <number-zero-one>',
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
'<dasharray>': {
|
|
588
|
+
ref: 'https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty',
|
|
589
|
+
syntax: {
|
|
590
|
+
apply: '<dasharray>',
|
|
591
|
+
def: {
|
|
592
|
+
dasharray: '[ [ <svg-length> | <percentage> | <number> ]+ ]#',
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
'<key-points>': {
|
|
597
|
+
ref: 'https://svgwg.org/specs/animations/#KeyPointsAttribute',
|
|
598
|
+
syntax: {
|
|
599
|
+
apply: '<key-points>',
|
|
600
|
+
def: {
|
|
601
|
+
'key-points': '<number> [; <number>]* [;]?',
|
|
602
|
+
},
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
'<key-splines>': {
|
|
606
|
+
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
|
|
607
|
+
syntax: {
|
|
608
|
+
apply: '<key-splines>',
|
|
609
|
+
def: {
|
|
610
|
+
'key-splines': '<control-point> [; <control-point>]* [;]?',
|
|
611
|
+
'control-point': '<number> [,]? <number> [,]? <number> [,]? <number>',
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
},
|
|
615
|
+
'<key-times>': {
|
|
616
|
+
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
|
|
617
|
+
syntax: {
|
|
618
|
+
apply: '<key-times>',
|
|
619
|
+
def: {
|
|
620
|
+
'key-times': '<number> [; <number>]* [;]?',
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
'<system-language>': {
|
|
625
|
+
ref: 'https://svgwg.org/svg2-draft/struct.html#SystemLanguageAttribute',
|
|
626
|
+
syntax: {
|
|
627
|
+
apply: '<system-language>',
|
|
628
|
+
def: {
|
|
629
|
+
'system-language': '<bcp-47>#',
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
'<origin>': {
|
|
634
|
+
ref: 'https://www.w3.org/TR/2001/REC-smil-animation-20010904/#MotionOriginAttribute',
|
|
635
|
+
syntax: {
|
|
636
|
+
apply: '<origin>',
|
|
637
|
+
def: {
|
|
638
|
+
origin: 'default',
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
'<svg-path>': {
|
|
643
|
+
ref: 'https://svgwg.org/svg2-draft/paths.html#PathDataBNF',
|
|
644
|
+
syntax: {
|
|
645
|
+
apply: '<svg-path>',
|
|
646
|
+
// TODO:
|
|
647
|
+
def: {
|
|
648
|
+
'svg-path': '<any-value>',
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
'<points>': {
|
|
653
|
+
ref: 'https://svgwg.org/svg2-draft/shapes.html#DataTypePoints',
|
|
654
|
+
syntax: {
|
|
655
|
+
apply: '<points>',
|
|
656
|
+
def: {
|
|
657
|
+
points: '[ <number>+ ]#',
|
|
658
|
+
},
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
'<preserve-aspect-ratio>': {
|
|
662
|
+
ref: 'https://svgwg.org/svg2-draft/coords.html#PreserveAspectRatioAttribute',
|
|
663
|
+
syntax: {
|
|
664
|
+
apply: '<preserve-aspect-ratio>',
|
|
665
|
+
def: {
|
|
666
|
+
'preserve-aspect-ratio': '<align> <meet-or-slice>?',
|
|
667
|
+
align: 'none | xMinYMin | xMidYMin | xMaxYMin | xMinYMid | xMidYMid | xMaxYMid| xMinYMax | xMidYMax | xMaxYMax',
|
|
668
|
+
'meet-or-slice': 'meet | slice',
|
|
669
|
+
},
|
|
670
|
+
// A new spec
|
|
671
|
+
// @see https://drafts.fxtf.org/filter-effects/#element-attrdef-feimage-preserveaspectratio
|
|
672
|
+
// > preserveAspectRatio = "[defer] <align> [<meetOrSlice>]"
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
'<view-box>': {
|
|
676
|
+
ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
|
|
677
|
+
syntax: {
|
|
678
|
+
apply: '<view-box>',
|
|
679
|
+
def: {
|
|
680
|
+
'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>',
|
|
681
|
+
'min-x': '<number>',
|
|
682
|
+
'min-y': '<number>',
|
|
683
|
+
width: '<number>',
|
|
684
|
+
height: '<number>',
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
'<rotate>': {
|
|
689
|
+
ref: 'https://svgwg.org/specs/animations/#RotateAttribute',
|
|
690
|
+
syntax: {
|
|
691
|
+
apply: '<rotate>',
|
|
692
|
+
def: {
|
|
693
|
+
rotate: '<number> | auto | auto-reverse',
|
|
694
|
+
},
|
|
695
|
+
},
|
|
696
|
+
},
|
|
697
|
+
'<text-coordinate>': {
|
|
698
|
+
ref: 'https://svgwg.org/svg2-draft/text.html#TSpanAttributes',
|
|
699
|
+
syntax: {
|
|
700
|
+
apply: '<text-coordinate>',
|
|
701
|
+
def: {
|
|
702
|
+
'text-coordinate': '[ [ <svg-length> | <percentage> | <number> ]+ ]#',
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
},
|
|
706
|
+
'<list-of-lengths>': {
|
|
707
|
+
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts',
|
|
708
|
+
syntax: {
|
|
709
|
+
apply: '<list-of-lengths>',
|
|
710
|
+
def: {
|
|
711
|
+
'list-of-lengths': '[ <svg-length> [,]? ]* <svg-length>',
|
|
712
|
+
},
|
|
713
|
+
},
|
|
714
|
+
},
|
|
715
|
+
'<list-of-numbers>': {
|
|
716
|
+
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts',
|
|
717
|
+
syntax: {
|
|
718
|
+
apply: '<list-of-numbers>',
|
|
719
|
+
def: {
|
|
720
|
+
'list-of-numbers': '[ <number> [,]? ]* <number>',
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
'<list-of-percentages>': {
|
|
725
|
+
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
|
|
726
|
+
syntax: {
|
|
727
|
+
apply: '<list-of-percentages>',
|
|
728
|
+
def: {
|
|
729
|
+
'list-of-percentages': '[ <percentage> [,]? ]* <percentage>',
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
},
|
|
733
|
+
'<number-optional-number>': {
|
|
734
|
+
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#number-optional-number',
|
|
735
|
+
syntax: {
|
|
736
|
+
apply: '<number-optional-number>',
|
|
737
|
+
def: {
|
|
738
|
+
'number-optional-number': '<number> | <number> , <number>',
|
|
739
|
+
},
|
|
740
|
+
},
|
|
741
|
+
},
|
|
742
|
+
};
|
|
743
|
+
exports.tokenizers = {
|
|
744
|
+
// RFC
|
|
745
|
+
// https://tools.ietf.org/rfc/bcp/bcp47.html
|
|
746
|
+
'bcp-47'(token) {
|
|
747
|
+
if (!token) {
|
|
748
|
+
return 0;
|
|
749
|
+
}
|
|
750
|
+
return (0, is_bcp_47_1.isBCP47)()(token.value) ? 1 : 0;
|
|
751
|
+
},
|
|
752
|
+
};
|