@markuplint/types 5.0.0-rc.2 → 5.0.0-rc.5
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 +38 -0
- package/README.md +83 -75
- package/lib/check-multi-types.d.ts +2 -9
- package/lib/check-multi-types.js +2 -9
- package/lib/css-defs.d.ts +0 -8
- package/lib/css-defs.js +0 -8
- package/lib/css-overrides.d.ts +2 -5
- package/lib/css-overrides.js +2 -5
- package/lib/css-syntax.d.ts +0 -11
- package/lib/css-syntax.js +6 -18
- package/lib/css-tokenizers.d.ts +0 -6
- package/lib/css-tokenizers.js +0 -6
- package/lib/debug.d.ts +0 -3
- package/lib/debug.js +0 -3
- package/lib/defs.d.ts +0 -8
- package/lib/defs.js +308 -37
- package/lib/directive.d.ts +0 -14
- package/lib/directive.js +0 -14
- package/lib/enum.d.ts +0 -11
- package/lib/enum.js +0 -11
- package/lib/keyword-type.d.ts +0 -13
- package/lib/keyword-type.js +0 -13
- package/lib/list.d.ts +0 -13
- package/lib/list.js +0 -13
- package/lib/match-result.d.ts +0 -21
- package/lib/match-result.js +0 -21
- package/lib/number.d.ts +0 -12
- package/lib/number.js +0 -12
- package/lib/primitive/is-float.d.ts +3 -4
- package/lib/primitive/is-float.js +3 -4
- package/lib/primitive/is-int.d.ts +0 -5
- package/lib/primitive/is-int.js +0 -5
- package/lib/primitive/is-non-zero-uint.d.ts +0 -6
- package/lib/primitive/is-non-zero-uint.js +0 -6
- package/lib/primitive/is-quantity.d.ts +0 -8
- package/lib/primitive/is-quantity.js +0 -8
- package/lib/primitive/is-uint.d.ts +0 -6
- package/lib/primitive/is-uint.js +0 -6
- package/lib/primitive/range.d.ts +0 -8
- package/lib/primitive/range.js +0 -8
- package/lib/primitive/split-unit.d.ts +0 -6
- package/lib/primitive/split-unit.js +0 -6
- package/lib/rfc/is-bcp-47.d.ts +24 -1
- package/lib/rfc/is-bcp-47.js +88 -3
- package/lib/token/token-collection.d.ts +1 -111
- package/lib/token/token-collection.js +0 -108
- package/lib/token/token.d.ts +1 -73
- package/lib/token/token.js +0 -72
- package/lib/token/types.d.ts +0 -9
- package/lib/types.schema.d.ts +1 -1
- package/lib/w3c/check-content-security-policy.d.ts +18 -0
- package/lib/w3c/check-content-security-policy.js +363 -0
- package/lib/w3c/check-serialized-permissions-policy.d.ts +0 -2
- package/lib/w3c/check-serialized-permissions-policy.js +0 -2
- package/lib/whatwg/check-autocomplete.d.ts +26 -9
- package/lib/whatwg/check-autocomplete.js +42 -15
- package/lib/whatwg/check-datetime/date-string-with-optional-time.d.ts +11 -0
- package/lib/whatwg/check-datetime/date-string-with-optional-time.js +16 -0
- package/lib/whatwg/check-datetime/date-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/date-string.js +0 -2
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +0 -13
- package/lib/whatwg/check-datetime/datetime-tokens.js +0 -16
- package/lib/whatwg/check-datetime/duration-string.d.ts +0 -4
- package/lib/whatwg/check-datetime/duration-string.js +0 -4
- package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/global-date-and-time-string.js +4 -4
- package/lib/whatwg/check-datetime/index.d.ts +0 -5
- package/lib/whatwg/check-datetime/index.js +0 -5
- package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +0 -4
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +0 -4
- package/lib/whatwg/check-datetime/month-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/month-string.js +0 -2
- package/lib/whatwg/check-datetime/time-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/time-string.js +0 -2
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +0 -8
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +0 -8
- package/lib/whatwg/check-datetime/week-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/week-string.js +0 -2
- package/lib/whatwg/check-datetime/year-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/year-string.js +0 -2
- package/lib/whatwg/check-datetime/yearless-date-string.d.ts +0 -2
- package/lib/whatwg/check-datetime/yearless-date-string.js +0 -2
- package/lib/whatwg/check-email.js +0 -2
- package/lib/whatwg/check-http-equiv-content-type.d.ts +12 -0
- package/lib/whatwg/check-http-equiv-content-type.js +32 -0
- package/lib/whatwg/check-http-equiv-refresh.d.ts +21 -0
- package/lib/whatwg/check-http-equiv-refresh.js +106 -0
- package/lib/whatwg/check-media-query-list.d.ts +61 -0
- package/lib/whatwg/check-media-query-list.js +484 -0
- package/lib/whatwg/check-mime-type.d.ts +0 -4
- package/lib/whatwg/check-mime-type.js +55 -3
- package/lib/whatwg/check-simple-color.d.ts +2 -4
- package/lib/whatwg/check-simple-color.js +2 -4
- package/lib/whatwg/check-url.d.ts +15 -7
- package/lib/whatwg/check-url.js +333 -25
- package/lib/whatwg/is-abs-url.d.ts +0 -2
- package/lib/whatwg/is-abs-url.js +0 -2
- package/lib/whatwg/is-browser-context-name.d.ts +0 -2
- package/lib/whatwg/is-browser-context-name.js +0 -2
- package/lib/whatwg/is-itemprop-name.d.ts +0 -2
- package/lib/whatwg/is-itemprop-name.js +0 -2
- package/lib/whatwg/is-navigable-target-name.d.ts +0 -2
- package/lib/whatwg/is-navigable-target-name.js +0 -2
- package/package.json +6 -5
- package/types.schema.json +9 -0
- package/ARCHITECTURE.ja.md +0 -256
- package/ARCHITECTURE.md +0 -256
- package/SKILL.md +0 -100
- package/docs/check-pipeline.ja.md +0 -494
- package/docs/check-pipeline.md +0 -494
- package/docs/token-system.ja.md +0 -584
- package/docs/token-system.md +0 -584
- package/docs/type-system.ja.md +0 -623
- package/docs/type-system.md +0 -623
- package/docs/validators.ja.md +0 -536
- package/docs/validators.md +0 -536
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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-rc.5](https://github.com/markuplint/markuplint/compare/v5.0.0-rc.4...v5.0.0-rc.5) (2026-08-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **types): strict charset=utf-8; feat(rules:** usemap-references-map ([#3969](https://github.com/markuplint/markuplint/issues/3969)) ([c63070e](https://github.com/markuplint/markuplint/commit/c63070e29ccb283da7468b2fc67db372ebfcf42a)), closes [#3945](https://github.com/markuplint/markuplint/issues/3945) [#3966](https://github.com/markuplint/markuplint/issues/3966) [#3966](https://github.com/markuplint/markuplint/issues/3966) [#3928](https://github.com/markuplint/markuplint/issues/3928)
|
|
11
|
+
- **types:** clarify MediaQueryList Stage A vs Stage B responsibility ([6cbb070](https://github.com/markuplint/markuplint/commit/6cbb070822576b2e56f1de5cdb37dbb675755f23))
|
|
12
|
+
- **types:** detect IPv4-non-decimal-part validation error in checkURL ([#3972](https://github.com/markuplint/markuplint/issues/3972)) ([c052c25](https://github.com/markuplint/markuplint/commit/c052c25b5a1c247dd9bf071db54c096d6033ed3f)), closes [#3966](https://github.com/markuplint/markuplint/issues/3966) [#3966](https://github.com/markuplint/markuplint/issues/3966) [#3966](https://github.com/markuplint/markuplint/issues/3966)
|
|
13
|
+
- **types:** extend URL forbidden code point detection and fix vtab trim bug ([dbc34be](https://github.com/markuplint/markuplint/commit/dbc34be3ac54ce2a713c7de3e34d62b133e857da)), closes [#3629](https://github.com/markuplint/markuplint/issues/3629)
|
|
14
|
+
- **types:** reject duplicate descriptors in Srcset checker ([5ff8641](https://github.com/markuplint/markuplint/commit/5ff8641c915cb0c5d0790c0908371156107ddbc6))
|
|
15
|
+
- **types:** reject standalone "webauthn" in checkAutoComplete ([84c8a3b](https://github.com/markuplint/markuplint/commit/84c8a3b7b71961636e0f0011edef5396b8cf5e2f))
|
|
16
|
+
- **types:** reject unterminated quoted-string in MIME type parameters ([741b41c](https://github.com/markuplint/markuplint/commit/741b41c275cb81eb51f88605f3fa4a297619ff80)), closes [#3851](https://github.com/markuplint/markuplint/issues/3851) [#3851](https://github.com/markuplint/markuplint/issues/3851)
|
|
17
|
+
- **types:** rename HashName test fixture "mymap" to "my-map" for cspell ([08d5796](https://github.com/markuplint/markuplint/commit/08d57965d726bc7d5bb8713da85c235ddcc9f475))
|
|
18
|
+
- **types:** require non-empty name in HashName type ([af494fb](https://github.com/markuplint/markuplint/commit/af494fb2092c4f7a9ebf3279a9239b4fe1bddbd9))
|
|
19
|
+
- **types:** spelling — unparseable → unparsable in AbsoluteURL comment ([7c7a7d7](https://github.com/markuplint/markuplint/commit/7c7a7d7873dbbfe60d8b4d98e0d6af7278fcb0d9))
|
|
20
|
+
- **types:** tighten MediaQueryList negative-value & fatal-error guards ([c185ea6](https://github.com/markuplint/markuplint/commit/c185ea60e7095b28338edca9652d78fe3dc2d33f)), closes [#3866](https://github.com/markuplint/markuplint/issues/3866)
|
|
21
|
+
- **types:** tighten Srcset URL and SourceSizeList numeric bounds ([3b122aa](https://github.com/markuplint/markuplint/commit/3b122aaf6ddbe3a8b797d02978108d842119030e))
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
- **types:** add DateStringWithOptionalTime and tighten global date and time fraction separator ([95cf050](https://github.com/markuplint/markuplint/commit/95cf0504285ba04dbdb8bdf5addd03bac06396f7))
|
|
26
|
+
- **types:** add HTTPEquivRefresh and HTTPEquivContentType validators ([649a259](https://github.com/markuplint/markuplint/commit/649a2591825c87c7993fcd0f5b667cf6d8cafa92)), closes [#3734](https://github.com/markuplint/markuplint/issues/3734) [#3734](https://github.com/markuplint/markuplint/issues/3734)
|
|
27
|
+
- **types:** add MediaQueryList typed checker for media= attribute validation ([b5bc19a](https://github.com/markuplint/markuplint/commit/b5bc19a806d39099e0b62d2eacae882456bd3c3e)), closes [#3850](https://github.com/markuplint/markuplint/issues/3850)
|
|
28
|
+
- **types:** catch URL Living Standard validation errors in URL type checker ([289932d](https://github.com/markuplint/markuplint/commit/289932df8e5f11dc4c60116843e4c31bd8be6e63)), closes [#3848](https://github.com/markuplint/markuplint/issues/3848)
|
|
29
|
+
- **types:** enforce element-context autocomplete constraints (select webauthn, input[type=hidden] on/off) ([#3930](https://github.com/markuplint/markuplint/issues/3930)) ([dc51d46](https://github.com/markuplint/markuplint/commit/dc51d460731541c963c9aa8bdf407c20974dced4))
|
|
30
|
+
- **types:** expand URL Living Standard coverage and add per-attribute URL variants ([b577b2c](https://github.com/markuplint/markuplint/commit/b577b2c4aa8e3ee31a368f62c2108e63aa457628)), closes [#3868](https://github.com/markuplint/markuplint/issues/3868)
|
|
31
|
+
- **types:** reject general-enclosed matches in MediaQueryList and SourceSizeList ([#3934](https://github.com/markuplint/markuplint/issues/3934)) ([2fc8615](https://github.com/markuplint/markuplint/commit/2fc8615c475540d4e5b85661baa1491d791cb661))
|
|
32
|
+
- **types:** validate BCP 47 language tags against the IANA subtag registry ([#3973](https://github.com/markuplint/markuplint/issues/3973)) ([cb8ea69](https://github.com/markuplint/markuplint/commit/cb8ea69bd1b7eb35b4b5507183f8da01edb161c5)), closes [#3829](https://github.com/markuplint/markuplint/issues/3829) [#3829](https://github.com/markuplint/markuplint/issues/3829) [#3829](https://github.com/markuplint/markuplint/issues/3829)
|
|
33
|
+
- **types:** validate CSP3 grammar for meta[content][http-equiv=content-security-policy] ([#3982](https://github.com/markuplint/markuplint/issues/3982)) ([b2d1d84](https://github.com/markuplint/markuplint/commit/b2d1d84ea92c754fe2dbf54950ae8fdb74fe51eb)), closes [#3942](https://github.com/markuplint/markuplint/issues/3942) [#3942](https://github.com/markuplint/markuplint/issues/3942) [#3942](https://github.com/markuplint/markuplint/issues/3942) [#3946](https://github.com/markuplint/markuplint/issues/3946)
|
|
34
|
+
- **types:** validate media feature value types per Media Queries Level 5 §4 ([d231374](https://github.com/markuplint/markuplint/commit/d231374ad6ae2c77dc9dbb5b5b403581f5d3738c))
|
|
35
|
+
|
|
36
|
+
# [5.0.0-rc.4](https://github.com/markuplint/markuplint/compare/v5.0.0-rc.3...v5.0.0-rc.4) (2026-04-19)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package @markuplint/types
|
|
39
|
+
|
|
40
|
+
# [5.0.0-rc.3](https://github.com/markuplint/markuplint/compare/v5.0.0-rc.2...v5.0.0-rc.3) (2026-04-19)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @markuplint/types
|
|
43
|
+
|
|
6
44
|
# [5.0.0-rc.2](https://github.com/markuplint/markuplint/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2026-04-15)
|
|
7
45
|
|
|
8
46
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -68,81 +68,89 @@ The package also exports the following types:
|
|
|
68
68
|
|
|
69
69
|
## Type Identifiers
|
|
70
70
|
|
|
71
|
-
| Identifier | Use on
|
|
72
|
-
| ---------------------------------- |
|
|
73
|
-
| `Any` | Some attributes
|
|
74
|
-
| `NoEmptyAny` | Some attributes
|
|
75
|
-
| `OneLineAny` | Some attributes
|
|
76
|
-
| `Zero` | Some attributes
|
|
77
|
-
| `Number` | Some attributes
|
|
78
|
-
| `Uint` | Some attributes
|
|
79
|
-
| `JSON` | Attributes on some frameworks etc.
|
|
80
|
-
| `XMLName` | `svg\|[attributeName]` and more
|
|
81
|
-
| `DOMID` | The `id` attribute and more
|
|
82
|
-
| `FunctionBody` | Event handler attributes
|
|
83
|
-
| `Pattern` | `input[pattern]`
|
|
84
|
-
| `DateTime` | `time[datetime]` and more
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
| `<
|
|
125
|
-
| `<
|
|
126
|
-
| `<
|
|
127
|
-
| `<
|
|
128
|
-
| `<
|
|
129
|
-
| `<color-
|
|
130
|
-
| `<
|
|
131
|
-
| `<
|
|
132
|
-
| `<
|
|
133
|
-
| `<
|
|
134
|
-
| `<
|
|
135
|
-
| `<
|
|
136
|
-
| `<
|
|
137
|
-
| `<
|
|
138
|
-
| `<
|
|
139
|
-
| `<
|
|
140
|
-
| `<
|
|
141
|
-
| `<
|
|
142
|
-
| `<
|
|
143
|
-
| `<
|
|
144
|
-
| `<
|
|
145
|
-
| `<
|
|
71
|
+
| Identifier | Use on | Spec | Supported |
|
|
72
|
+
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- |
|
|
73
|
+
| `Any` | Some attributes | | ✅ |
|
|
74
|
+
| `NoEmptyAny` | Some attributes | | ✅ |
|
|
75
|
+
| `OneLineAny` | Some attributes | | ✅ |
|
|
76
|
+
| `Zero` | Some attributes | | ✅ |
|
|
77
|
+
| `Number` | Some attributes | | ✅ |
|
|
78
|
+
| `Uint` | Some attributes | | ✅ |
|
|
79
|
+
| `JSON` | Attributes on some frameworks etc. | | ✅ |
|
|
80
|
+
| `XMLName` | `svg\|[attributeName]` and more | [XML](https://www.w3.org/TR/xml/#d0e804) | ✅ |
|
|
81
|
+
| `DOMID` | The `id` attribute and more | [WHATWG](https://html.spec.whatwg.org/multipage/dom.html#global-attributes:concept-id) | ✅ |
|
|
82
|
+
| `FunctionBody` | Event handler attributes | | 🚧 |
|
|
83
|
+
| `Pattern` | `input[pattern]` | [WHATWG](https://html.spec.whatwg.org/multipage/input.html#compiled-pattern-regular-expression) | ✅ |
|
|
84
|
+
| `DateTime` | `time[datetime]` and more | [WHATWG](https://html.spec.whatwg.org/multipage/text-level-semantics.html#datetime-value) | ✅ |
|
|
85
|
+
| `DateStringWithOptionalTime` | `del[datetime]`, `ins[datetime]` | [WHATWG](https://html.spec.whatwg.org/multipage/edits.html#attr-mod-datetime) | ✅ |
|
|
86
|
+
| `DateString` | `input[value]` when `type=date` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#dates) | ✅ |
|
|
87
|
+
| `TimeString` | `input[value]` when `type=time` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#times) | ✅ |
|
|
88
|
+
| `MonthString` | `input[value]` when `type=month` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#months) | ✅ |
|
|
89
|
+
| `WeekString` | `input[value]` when `type=week` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#weeks) | ✅ |
|
|
90
|
+
| `LocalDateTimeString` | `input[value]` when `type=datetime-local` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#local-dates-and-times) | ✅ |
|
|
91
|
+
| `SimpleColor` | `input[value]` when `type=color` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-simple-colour) | ✅ |
|
|
92
|
+
| `Email` | `input[value]` when `type=email` | [WHATWG](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) | ✅ |
|
|
93
|
+
| `TabIndex` | The `tabindex` attribute | [WHATWG](https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex) | ✅ |
|
|
94
|
+
| `BCP47` | The `lang` attribute and more | [RFC](https://tools.ietf.org/rfc/bcp/bcp47.html) | ✅ |
|
|
95
|
+
| `URL` | `a[href]`, `area[href]`, `blockquote[cite]`, `del[cite]`, `ins[cite]`, `q[cite]` and more (every URL-typed attribute that does **not** require a non-empty value) | [WHATWG](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#valid-url-potentially-surrounded-by-spaces) | ✅ |
|
|
96
|
+
| `NonEmptyURL` | `audio[src]`, `button[formaction]`, `embed[src]`, `form[action]`, `iframe[src]`, `img[src]`, `input[formaction]`, `input[type=image][src]`, `link[href]`, `object[data]`, `script[src]`, `source[src]`, `track[src]`, `video[poster]`, `video[src]` | [WHATWG](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#valid-non-empty-url-potentially-surrounded-by-spaces) | ✅ |
|
|
97
|
+
| `BaseURL` | `base[href]` | [WHATWG](https://html.spec.whatwg.org/multipage/semantics.html#set-the-frozen-base-url) | ✅ |
|
|
98
|
+
| `AbsoluteURL` | The `itemtype` attribute (as list) | [WHATWG](https://url.spec.whatwg.org/#syntax-url-absolute) | ✅ |
|
|
99
|
+
| `AbsoluteURLOrEmpty` | `input[type=url][value]` | [WHATWG](<https://html.spec.whatwg.org/multipage/input.html#url-state-(type=url)>) | ✅ |
|
|
100
|
+
| `HashName` | `img[usemap]` | [WHATWG](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-hash-name-reference) | ✅ |
|
|
101
|
+
| `OneCodePointChar` | The `accesskey` attribute (as list) | [WHATWG](https://html.spec.whatwg.org/multipage/interaction.html#the-accesskey-attribute) | ✅ |
|
|
102
|
+
| `CustomElementName` | The `is` attribute | [WHATWG](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name) | ✅ |
|
|
103
|
+
| ~~`BrowsingContextName`~~ | Use `NavigableTargetName` instead. | **Obsoleted** | ✅ |
|
|
104
|
+
| ~~`BrowsingContextNameOrKeyword`~~ | Use `NavigableTargetNameOrKeyword` instead. | **Obsoleted** | ✅ |
|
|
105
|
+
| `NavigableTargetName` | `iframe[name]` and more | [WHATWG](https://html.spec.whatwg.org/multipage/document-sequences.html#valid-navigable-target-name) | ✅ |
|
|
106
|
+
| `NavigableTargetNameOrKeyword` | `a[target]` and more | [WHATWG](https://html.spec.whatwg.org/multipage/document-sequences.html#valid-navigable-target-name-or-keyword) | ✅ |
|
|
107
|
+
| `HTTPSchemaURL` | `a[ping]` (as list) and more | [WHATWG](https://html.spec.whatwg.org/multipage/links.html#ping) | ✅ |
|
|
108
|
+
| `MIMEType` | `embed[type]` and more | [WHATWG](https://mimesniff.spec.whatwg.org/#valid-mime-type) | ✅ |
|
|
109
|
+
| `MediaQueryList` | `link[media]`, `style[media]`, `source[media]`, `svg\|style[media]` | [W3C](https://www.w3.org/TR/mediaqueries-5/#mq-features) | ✅ |
|
|
110
|
+
| `HTTPEquivRefresh` | `meta[content]` when `http-equiv=refresh` | [WHATWG](https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh) | ✅ |
|
|
111
|
+
| `HTTPEquivContentType` | `meta[content]` when `http-equiv=content-type` | [WHATWG](https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-content-type) | ✅ |
|
|
112
|
+
| `ContentSecurityPolicy` | `meta[content]` when `http-equiv=content-security-policy` | [W3C](https://www.w3.org/TR/CSP3/#framework-policy) | ✅ |
|
|
113
|
+
| `ItemProp` | The `itemprop` attribute (as list) | [WHATWG](https://html.spec.whatwg.org/multipage/microdata.html#names:-the-itemprop-attribute) | ✅ |
|
|
114
|
+
| `Srcset` | `img[srcset]` and more | [WHATWG](https://html.spec.whatwg.org/multipage/images.html#srcset-attributes) | ✅ |
|
|
115
|
+
| `SourceSizeList` | `img[sizes]` and more | [WHATWG](https://html.spec.whatwg.org/multipage/images.html#sizes-attributes) | ✅ |
|
|
116
|
+
| `IconSize` | `link[sizes]` (as list) | [WHATWG](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes) | ✅ |
|
|
117
|
+
| `AutoComplete` | `input[autocomplete]` and more | [WHATWG](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-autocomplete) | ✅ |
|
|
118
|
+
| `Accept` | `input[accept]` | [WHATWG](https://html.spec.whatwg.org/multipage/input.html#attr-input-accept) | ✅ |
|
|
119
|
+
| `SerializedPermissionsPolicy` | `iframe[allow]` | [W3C](https://w3c.github.io/webappsec-permissions-policy/#serialized-permissions-policy) | ✅ |
|
|
120
|
+
| `LinkTypeForLinkElement` | `link[rel]` | [WHATWG](https://html.spec.whatwg.org/multipage/links.html#linkTypes) [microformats](https://microformats.org/wiki/existing-rel-values) | ✅ |
|
|
121
|
+
| `LinkTypeForLinkElementInBody` | `link[rel]` in `<body>` | [WHATWG](https://html.spec.whatwg.org/multipage/links.html#body-ok) [microformats](https://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions) | ✅ |
|
|
122
|
+
| `LinkTypeForAnchorAndAreaElement` | `a[rel]`, `area[rel]` | [WHATWG](https://html.spec.whatwg.org/multipage/links.html#linkTypes) [microformats](https://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions) | ✅ |
|
|
123
|
+
| `LinkTypeForFormElement` | `form[rel]` | [WHATWG](https://html.spec.whatwg.org/multipage/links.html#linkTypes) [microformats](https://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions) | ✅ |
|
|
124
|
+
| `<css-declaration-list>` | The `style` attribute | [CSS](https://drafts.csswg.org/css-style-attr/#syntax) | ✅ |
|
|
125
|
+
| `<class-list>` | The `class` attribute | [SVG](https://www.w3.org/TR/SVG/styling.html#ClassAttribute) | ✅ |
|
|
126
|
+
| `<svg-font-size>` | Some attributes for SVG | [CSS](https://drafts.csswg.org/css-fonts-5/#descdef-font-face-font-size) | 🚧 |
|
|
127
|
+
| `<svg-font-size-adjust>` | Some attributes for SVG | [CSS](https://drafts.csswg.org/css-fonts-5/#propdef-font-size-adjust) | 🚧 |
|
|
128
|
+
| `<'color-profile'>` | Some attributes for SVG | [SVG](https://www.w3.org/TR/SVG11/color.html#ColorProfileProperty) | 🚧 |
|
|
129
|
+
| `<'color-rendering'>` | Some attributes for SVG | [SVG](https://www.w3.org/TR/SVG11/painting.html#ColorRenderingProperty) | 🚧 |
|
|
130
|
+
| `<'enable-background'>` | Some attributes for SVG | [SVG](https://www.w3.org/TR/SVG11/filters.html#EnableBackgroundProperty) | 🚧 |
|
|
131
|
+
| `<list-of-svg-feature-string>` | Some attributes for SVG | [SVG](https://www.w3.org/TR/SVG11/feature.html) | 🚧 |
|
|
132
|
+
| `<animatable-value>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#FromAttribute) | 🚧 |
|
|
133
|
+
| `<begin-value-list>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#BeginValueListSyntax) | 🚧 |
|
|
134
|
+
| `<end-value-list>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#EndValueListSyntax) | 🚧 |
|
|
135
|
+
| `<list-of-value>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#ValuesAttribute) | 🚧 |
|
|
136
|
+
| `<clock-value>` | Some attributes for SVG | [SMIL](https://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-ClockValueSyntax) | 🚧 |
|
|
137
|
+
| `<color-matrix>` | Some attributes for SVG | [W3C](https://drafts.fxtf.org/filter-effects/#element-attrdef-fecolormatrix-values) | ✅ |
|
|
138
|
+
| `<dasharray>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/painting.html#StrokeDasharrayProperty) | ✅ |
|
|
139
|
+
| `<key-points>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#KeyPointsAttribute) | ✅ |
|
|
140
|
+
| `<key-splines>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#KeyTimesAttribute) | ✅ |
|
|
141
|
+
| `<key-times>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#KeyTimesAttribute) | ✅ |
|
|
142
|
+
| `<system-language>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/struct.html#SystemLanguageAttribute) | ✅ |
|
|
143
|
+
| `<origin>` | Some attributes for SVG | [SMIL](https://www.w3.org/TR/2001/REC-smil-animation-20010904/#MotionOriginAttribute) | ✅ |
|
|
144
|
+
| `<svg-path>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/paths.html#PathDataBNF) | 🚧 |
|
|
145
|
+
| `<points>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/shapes.html#DataTypePoints) | ✅ |
|
|
146
|
+
| `<preserve-aspect-ratio>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/coords.html#PreserveAspectRatioAttribute) | ✅ |
|
|
147
|
+
| `<view-box>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute) | ✅ |
|
|
148
|
+
| `<rotate>` | Some attributes for SVG | [SVG](https://svgwg.org/specs/animations/#RotateAttribute) | ✅ |
|
|
149
|
+
| `<text-coordinate>` | Some attributes for SVG | [SVG](https://svgwg.org/svg2-draft/text.html#TSpanAttributes) | ✅ |
|
|
150
|
+
| `<list-of-lengths>` | Some attributes for SVG | | ✅ |
|
|
151
|
+
| `<list-of-numbers>` | Some attributes for SVG | | ✅ |
|
|
152
|
+
| `<list-of-percentages>` | Some attributes for SVG | | ✅ |
|
|
153
|
+
| `<number-optional-number>` | Some attributes for SVG | | ✅ |
|
|
146
154
|
|
|
147
155
|
In addition, you can use types **[CSSTree](https://github.com/csstree/csstree)** defined.
|
|
148
156
|
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { CustomSyntaxCheck, UnmatchedResult } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Iterates through the provided checks and returns the first matched result.
|
|
6
|
-
* If none match, returns the unmatched result with the highest pass count
|
|
7
|
-
* or furthest offset, providing the most informative error.
|
|
8
|
-
*
|
|
9
|
-
* @param value - The string value to check
|
|
10
|
-
* @param checks - The array of type check functions to try
|
|
11
|
-
* @returns The matched result or the best unmatched result
|
|
3
|
+
* When no check matches, the unmatched result with the highest pass count (or
|
|
4
|
+
* furthest offset on a tie) is returned so the reported error is the most informative.
|
|
12
5
|
*/
|
|
13
6
|
export declare function checkMultiTypes(value: string, checks: readonly CustomSyntaxCheck[]): import("./types.js").MatchedResult | UnmatchedResult;
|
package/lib/check-multi-types.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { log } from './debug.js';
|
|
2
2
|
import { matched } from './match-result.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Iterates through the provided checks and returns the first matched result.
|
|
7
|
-
* If none match, returns the unmatched result with the highest pass count
|
|
8
|
-
* or furthest offset, providing the most informative error.
|
|
9
|
-
*
|
|
10
|
-
* @param value - The string value to check
|
|
11
|
-
* @param checks - The array of type check functions to try
|
|
12
|
-
* @returns The matched result or the best unmatched result
|
|
4
|
+
* When no check matches, the unmatched result with the highest pass count (or
|
|
5
|
+
* furthest offset on a tie) is returned so the reported error is the most informative.
|
|
13
6
|
*/
|
|
14
7
|
export function checkMultiTypes(value, checks) {
|
|
15
8
|
let unmatched;
|
package/lib/css-defs.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import type { Defs } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* CSS and SVG type definitions for attribute value validation.
|
|
4
|
-
*
|
|
5
|
-
* Contains definitions for CSS declaration lists, SVG-specific types
|
|
6
|
-
* (paths, viewBox, preserveAspectRatio, etc.), and animation-related types.
|
|
7
|
-
* Each definition includes a reference URL and either a CSS syntax or
|
|
8
|
-
* a custom validation function.
|
|
9
|
-
*/
|
|
10
2
|
export declare const cssDefs: Defs;
|
package/lib/css-defs.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { matched } from './match-result.js';
|
|
2
|
-
/**
|
|
3
|
-
* CSS and SVG type definitions for attribute value validation.
|
|
4
|
-
*
|
|
5
|
-
* Contains definitions for CSS declaration lists, SVG-specific types
|
|
6
|
-
* (paths, viewBox, preserveAspectRatio, etc.), and animation-related types.
|
|
7
|
-
* Each definition includes a reference URL and either a CSS syntax or
|
|
8
|
-
* a custom validation function.
|
|
9
|
-
*/
|
|
10
2
|
export const cssDefs = {
|
|
11
3
|
'<css-declaration-list>': {
|
|
12
4
|
ref: 'https://drafts.csswg.org/css-style-attr/#syntax',
|
package/lib/css-overrides.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides alternative syntax definitions for CSS transform functions
|
|
5
|
-
* and legacy value types to support SVG attribute validation where
|
|
6
|
-
* the standard CSS syntax is too strict.
|
|
2
|
+
* Overrides css-tree's built-in transform/legacy-value definitions because the
|
|
3
|
+
* standard CSS syntax is too strict for the variants SVG attributes accept.
|
|
7
4
|
*/
|
|
8
5
|
export declare const cssOverrides: Record<string, string>;
|
package/lib/css-overrides.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides alternative syntax definitions for CSS transform functions
|
|
5
|
-
* and legacy value types to support SVG attribute validation where
|
|
6
|
-
* the standard CSS syntax is too strict.
|
|
2
|
+
* Overrides css-tree's built-in transform/legacy-value definitions because the
|
|
3
|
+
* standard CSS syntax is too strict for the variants SVG attributes accept.
|
|
7
4
|
*/
|
|
8
5
|
export const cssOverrides = {
|
|
9
6
|
// Alias
|
package/lib/css-syntax.d.ts
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
import type { CustomCssSyntax, Result, CssSyntax } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Matches a value against a CSS syntax definition using css-tree.
|
|
4
|
-
*
|
|
5
|
-
* Supports both standard CSS syntax types (e.g., `<color>`) and custom syntax
|
|
6
|
-
* definitions with extended types, properties, and case-sensitive matching.
|
|
7
|
-
* Uses css-tree's lexer for syntax validation.
|
|
8
|
-
*
|
|
9
|
-
* @param value - The string value to match
|
|
10
|
-
* @param type - The CSS syntax identifier or custom syntax definition
|
|
11
|
-
* @returns The validation result
|
|
12
|
-
*/
|
|
13
2
|
export declare function cssSyntaxMatch(value: string, type: CssSyntax | CustomCssSyntax): Result;
|
package/lib/css-syntax.js
CHANGED
|
@@ -3,20 +3,15 @@ import { log } from './debug.js';
|
|
|
3
3
|
import { matched } from './match-result.js';
|
|
4
4
|
import { cssTokenizers } from './css-tokenizers.js';
|
|
5
5
|
import { cssOverrides } from './css-overrides.js';
|
|
6
|
+
// css-tree's lexer matches keywords case-insensitively, but a `Defs` entry
|
|
7
|
+
// may declare a case-sensitive grammar via `caseSensitive: true`. In that
|
|
8
|
+
// mode every uppercase letter in both the syntax definition and the input
|
|
9
|
+
// value is wrapped in these mimic tags so case survives css-tree's
|
|
10
|
+
// normalization; error positions/messages are mapped back via
|
|
11
|
+
// `MIMIC_LENGTH` arithmetic after matching.
|
|
6
12
|
const MIMIC_TAG_L = 'mimiccases---';
|
|
7
13
|
const MIMIC_TAG_R = '---mimiccases';
|
|
8
14
|
const MIMIC_LENGTH = (MIMIC_TAG_L + MIMIC_TAG_R).length;
|
|
9
|
-
/**
|
|
10
|
-
* Matches a value against a CSS syntax definition using css-tree.
|
|
11
|
-
*
|
|
12
|
-
* Supports both standard CSS syntax types (e.g., `<color>`) and custom syntax
|
|
13
|
-
* definitions with extended types, properties, and case-sensitive matching.
|
|
14
|
-
* Uses css-tree's lexer for syntax validation.
|
|
15
|
-
*
|
|
16
|
-
* @param value - The string value to match
|
|
17
|
-
* @param type - The CSS syntax identifier or custom syntax definition
|
|
18
|
-
* @returns The validation result
|
|
19
|
-
*/
|
|
20
15
|
export function cssSyntaxMatch(value, type) {
|
|
21
16
|
log('Search CSS Syntax: "%s"', type);
|
|
22
17
|
const origin = value;
|
|
@@ -145,13 +140,6 @@ function detectName(def) {
|
|
|
145
140
|
name,
|
|
146
141
|
};
|
|
147
142
|
}
|
|
148
|
-
/**
|
|
149
|
-
*
|
|
150
|
-
* @param key
|
|
151
|
-
* @param obj
|
|
152
|
-
* @modifies obj
|
|
153
|
-
* @returns
|
|
154
|
-
*/
|
|
155
143
|
function eachMimicCases(key,
|
|
156
144
|
// Mutable
|
|
157
145
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
package/lib/css-tokenizers.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import type { CssSyntaxTokenizer } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Custom CSS syntax tokenizers for css-tree integration.
|
|
4
|
-
*
|
|
5
|
-
* Provides tokenizer functions for CSS value types that require
|
|
6
|
-
* custom parsing logic beyond what css-tree supports natively.
|
|
7
|
-
*/
|
|
8
2
|
export declare const cssTokenizers: Record<string, CssSyntaxTokenizer>;
|
package/lib/css-tokenizers.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { isBCP47 } from './rfc/is-bcp-47.js';
|
|
2
|
-
/**
|
|
3
|
-
* Custom CSS syntax tokenizers for css-tree integration.
|
|
4
|
-
*
|
|
5
|
-
* Provides tokenizer functions for CSS value types that require
|
|
6
|
-
* custom parsing logic beyond what css-tree supports natively.
|
|
7
|
-
*/
|
|
8
2
|
export const cssTokenizers = {
|
|
9
3
|
// RFC
|
|
10
4
|
// https://tools.ietf.org/rfc/bcp/bcp47.html
|
package/lib/debug.d.ts
CHANGED
package/lib/debug.js
CHANGED
package/lib/defs.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import type { Defs } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Built-in type definitions registry for HTML attribute value validation.
|
|
4
|
-
*
|
|
5
|
-
* Maps type identifiers to their validation logic, reference URLs,
|
|
6
|
-
* and expected value descriptions. Includes definitions for common types
|
|
7
|
-
* (Any, Number, URL, etc.), WHATWG-specified types (DateTime, MIMEType,
|
|
8
|
-
* CustomElementName, etc.), and format-specific validators (BCP47, Pattern, etc.).
|
|
9
|
-
*/
|
|
10
2
|
export declare const defs: Defs;
|