@markuplint/types 4.8.1 → 4.18.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.
Files changed (112) hide show
  1. package/ARCHITECTURE.ja.md +252 -0
  2. package/ARCHITECTURE.md +252 -0
  3. package/CHANGELOG.md +14 -2
  4. package/README.md +37 -2
  5. package/SKILL.md +100 -0
  6. package/docs/check-pipeline.ja.md +494 -0
  7. package/docs/check-pipeline.md +494 -0
  8. package/docs/token-system.ja.md +584 -0
  9. package/docs/token-system.md +584 -0
  10. package/docs/type-system.ja.md +556 -0
  11. package/docs/type-system.md +556 -0
  12. package/docs/validators.ja.md +514 -0
  13. package/docs/validators.md +514 -0
  14. package/lib/check-base.d.ts +71 -0
  15. package/lib/check-base.js +71 -0
  16. package/lib/check-multi-types.d.ts +12 -1
  17. package/lib/check-multi-types.js +11 -0
  18. package/lib/check.d.ts +13 -0
  19. package/lib/check.js +13 -0
  20. package/lib/css-defs.d.ts +8 -0
  21. package/lib/css-defs.js +8 -0
  22. package/lib/css-overrides.d.ts +7 -0
  23. package/lib/css-overrides.js +7 -0
  24. package/lib/css-syntax.d.ts +11 -0
  25. package/lib/css-syntax.js +12 -1
  26. package/lib/css-tokenizers.d.ts +6 -0
  27. package/lib/css-tokenizers.js +6 -0
  28. package/lib/debug.d.ts +3 -0
  29. package/lib/debug.js +3 -0
  30. package/lib/defs.d.ts +8 -0
  31. package/lib/defs.js +8 -0
  32. package/lib/directive.d.ts +14 -0
  33. package/lib/directive.js +14 -0
  34. package/lib/enum.d.ts +11 -0
  35. package/lib/enum.js +11 -0
  36. package/lib/get-candidate.d.ts +11 -0
  37. package/lib/get-candidate.js +11 -0
  38. package/lib/index.d.ts +6 -0
  39. package/lib/index.js +6 -0
  40. package/lib/keyword-type.d.ts +13 -0
  41. package/lib/keyword-type.js +13 -0
  42. package/lib/list.d.ts +13 -0
  43. package/lib/list.js +13 -0
  44. package/lib/match-result.d.ts +22 -1
  45. package/lib/match-result.js +21 -0
  46. package/lib/number.d.ts +12 -0
  47. package/lib/number.js +12 -0
  48. package/lib/primitive/is-float.d.ts +4 -1
  49. package/lib/primitive/is-float.js +4 -1
  50. package/lib/primitive/is-int.d.ts +4 -1
  51. package/lib/primitive/is-int.js +4 -1
  52. package/lib/primitive/is-non-zero-uint.d.ts +3 -2
  53. package/lib/primitive/is-non-zero-uint.js +3 -2
  54. package/lib/primitive/is-quantity.d.ts +5 -3
  55. package/lib/primitive/is-quantity.js +5 -3
  56. package/lib/primitive/is-uint.d.ts +5 -1
  57. package/lib/primitive/is-uint.js +5 -1
  58. package/lib/primitive/range.d.ts +5 -4
  59. package/lib/primitive/range.js +5 -4
  60. package/lib/primitive/split-unit.d.ts +3 -2
  61. package/lib/primitive/split-unit.js +3 -2
  62. package/lib/rfc/is-bcp-47.d.ts +2 -0
  63. package/lib/rfc/is-bcp-47.js +2 -0
  64. package/lib/token/token-collection.d.ts +108 -3
  65. package/lib/token/token-collection.js +103 -3
  66. package/lib/token/token.d.ts +66 -2
  67. package/lib/token/token.js +66 -2
  68. package/lib/token/types.d.ts +9 -0
  69. package/lib/types.d.ts +107 -0
  70. package/lib/w3c/check-serialized-permissions-policy.d.ts +2 -0
  71. package/lib/w3c/check-serialized-permissions-policy.js +2 -0
  72. package/lib/whatwg/check-autocomplete.d.ts +5 -0
  73. package/lib/whatwg/check-autocomplete.js +6 -0
  74. package/lib/whatwg/check-datetime/date-string.d.ts +2 -0
  75. package/lib/whatwg/check-datetime/date-string.js +2 -0
  76. package/lib/whatwg/check-datetime/datetime-tokens.d.ts +13 -0
  77. package/lib/whatwg/check-datetime/datetime-tokens.js +13 -0
  78. package/lib/whatwg/check-datetime/duration-string.d.ts +7 -0
  79. package/lib/whatwg/check-datetime/duration-string.js +7 -0
  80. package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +2 -0
  81. package/lib/whatwg/check-datetime/global-date-and-time-string.js +2 -0
  82. package/lib/whatwg/check-datetime/index.d.ts +5 -0
  83. package/lib/whatwg/check-datetime/index.js +5 -0
  84. package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +4 -0
  85. package/lib/whatwg/check-datetime/local-date-and-time-string.js +4 -0
  86. package/lib/whatwg/check-datetime/month-string.d.ts +2 -0
  87. package/lib/whatwg/check-datetime/month-string.js +2 -0
  88. package/lib/whatwg/check-datetime/time-string.d.ts +2 -0
  89. package/lib/whatwg/check-datetime/time-string.js +2 -0
  90. package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +8 -0
  91. package/lib/whatwg/check-datetime/time-zone-offset-string.js +8 -0
  92. package/lib/whatwg/check-datetime/week-string.d.ts +2 -0
  93. package/lib/whatwg/check-datetime/week-string.js +2 -0
  94. package/lib/whatwg/check-datetime/year-string.d.ts +2 -0
  95. package/lib/whatwg/check-datetime/year-string.js +2 -0
  96. package/lib/whatwg/check-datetime/yearless-date-string.d.ts +2 -0
  97. package/lib/whatwg/check-datetime/yearless-date-string.js +2 -0
  98. package/lib/whatwg/check-link-type.d.ts +5 -1
  99. package/lib/whatwg/check-link-type.js +5 -1
  100. package/lib/whatwg/check-mime-type.d.ts +4 -1
  101. package/lib/whatwg/check-mime-type.js +5 -3
  102. package/lib/whatwg/is-abs-url.d.ts +2 -0
  103. package/lib/whatwg/is-abs-url.js +2 -0
  104. package/lib/whatwg/is-browser-context-name.d.ts +2 -2
  105. package/lib/whatwg/is-browser-context-name.js +2 -2
  106. package/lib/whatwg/is-custom-element-name.d.ts +1 -1
  107. package/lib/whatwg/is-custom-element-name.js +1 -1
  108. package/lib/whatwg/is-itemprop-name.d.ts +1 -0
  109. package/lib/whatwg/is-itemprop-name.js +1 -0
  110. package/lib/whatwg/is-navigable-target-name.d.ts +2 -0
  111. package/lib/whatwg/is-navigable-target-name.js +2 -0
  112. package/package.json +8 -8
@@ -1,5 +1,7 @@
1
1
  import type { CustomSyntaxChecker } from '../../types.js';
2
2
  /**
3
+ * Validates a yearless date string in the format `MM-DD`.
4
+ *
3
5
  * @see https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#yearless-dates
4
6
  */
5
7
  export declare const checkYearlessDateString: CustomSyntaxChecker;
@@ -2,6 +2,8 @@ import { log } from '../../debug.js';
2
2
  import { TokenCollection } from '../../token/index.js';
3
3
  import { datetimeTokenCheck } from './datetime-tokens.js';
4
4
  /**
5
+ * Validates a yearless date string in the format `MM-DD`.
6
+ *
5
7
  * @see https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#yearless-dates
6
8
  */
7
9
  export const checkYearlessDateString = () => function checkYearlessDateString(value) {
@@ -1,6 +1,10 @@
1
1
  import type { CustomSyntaxChecker } from '../types.js';
2
2
  /**
3
- * Link Type
3
+ * Validates a link type attribute value against WHATWG and Microformats registries.
4
+ *
5
+ * Filters allowed keywords based on the element context (link, body link, a/area, or form).
6
+ * Rejects dropped, non-HTML, and rejected link types from the Microformats wiki.
7
+ *
4
8
  * @see https://html.spec.whatwg.org/multipage/links.html#linkTypes
5
9
  */
6
10
  export declare const checkLinkType: CustomSyntaxChecker<{
@@ -461,7 +461,11 @@ const ALLOWED_LINK_TYPE_MICROFORMATS = [
461
461
  ...DEF_LINK_TYPE_MICROFORMATS_DUBLIN_CORE,
462
462
  ].filter(def => !DEF_LINK_TYPE_WHATWG.some(whatwg => whatwg.keyword === def.keyword));
463
463
  /**
464
- * Link Type
464
+ * Validates a link type attribute value against WHATWG and Microformats registries.
465
+ *
466
+ * Filters allowed keywords based on the element context (link, body link, a/area, or form).
467
+ * Rejects dropped, non-HTML, and rejected link types from the Microformats wiki.
468
+ *
465
469
  * @see https://html.spec.whatwg.org/multipage/links.html#linkTypes
466
470
  */
467
471
  export const checkLinkType = options => value => {
@@ -1,6 +1,9 @@
1
1
  import type { CustomSyntaxChecker } from '../types.js';
2
2
  /**
3
- * MIME Type
3
+ * Validates a MIME type string according to the WHATWG MIME Sniffing specification.
4
+ *
5
+ * Optionally restricts to MIME types with no parameters.
6
+ *
4
7
  * @see https://mimesniff.spec.whatwg.org/#valid-mime-type
5
8
  */
6
9
  export declare const checkMIMEType: CustomSyntaxChecker<{
@@ -1,5 +1,4 @@
1
- // @ts-ignore
2
- import MIMEType from 'whatwg-mimetype';
1
+ import { MIMEType } from 'whatwg-mimetype';
3
2
  import { matched, unmatched } from '../match-result.js';
4
3
  import { Token } from '../token/index.js';
5
4
  const expects = (withoutParameters) => [
@@ -9,7 +8,10 @@ const expects = (withoutParameters) => [
9
8
  },
10
9
  ];
11
10
  /**
12
- * MIME Type
11
+ * Validates a MIME type string according to the WHATWG MIME Sniffing specification.
12
+ *
13
+ * Optionally restricts to MIME types with no parameters.
14
+ *
13
15
  * @see https://mimesniff.spec.whatwg.org/#valid-mime-type
14
16
  */
15
17
  export const checkMIMEType = options => value => {
@@ -1,5 +1,7 @@
1
1
  import type { FormattedPrimitiveTypeCreator } from '../types.js';
2
2
  /**
3
+ * Checks whether a string is a valid absolute URL.
4
+ *
3
5
  * @see https://url.spec.whatwg.org/#syntax-url-absolute
4
6
  *
5
7
  * > An absolute-URL string must be one of the following:
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * Checks whether a string is a valid absolute URL.
3
+ *
2
4
  * @see https://url.spec.whatwg.org/#syntax-url-absolute
3
5
  *
4
6
  * > An absolute-URL string must be one of the following:
@@ -1,5 +1,6 @@
1
1
  import type { FormattedPrimitiveTypeCreator } from '../types.js';
2
2
  /**
3
+ * Checks whether a string is a valid browsing context name.
3
4
  *
4
5
  * @see https://html.spec.whatwg.org/multipage/browsers.html#valid-browsing-context-name
5
6
  *
@@ -7,7 +8,6 @@ import type { FormattedPrimitiveTypeCreator } from '../types.js';
7
8
  * > that does not start with a U+005F LOW LINE character.
8
9
  * > (Names starting with an underscore are reserved for special keywords.)
9
10
  *
10
- * @deprecated
11
- *
11
+ * @deprecated Use {@link isNavigableTargetName} instead.
12
12
  */
13
13
  export declare const isBrowserContextName: FormattedPrimitiveTypeCreator;
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * Checks whether a string is a valid browsing context name.
2
3
  *
3
4
  * @see https://html.spec.whatwg.org/multipage/browsers.html#valid-browsing-context-name
4
5
  *
@@ -6,8 +7,7 @@
6
7
  * > that does not start with a U+005F LOW LINE character.
7
8
  * > (Names starting with an underscore are reserved for special keywords.)
8
9
  *
9
- * @deprecated
10
- *
10
+ * @deprecated Use {@link isNavigableTargetName} instead.
11
11
  */
12
12
  export const isBrowserContextName = () => {
13
13
  return value => {
@@ -1,6 +1,6 @@
1
1
  import type { FormattedPrimitiveTypeCreator } from '../types.js';
2
2
  /**
3
- * valid name of custom element
3
+ * Checks whether a string is a valid custom element name.
4
4
  *
5
5
  * > PotentialCustomElementName ::=
6
6
  * > [a-z] (PCENChar)* '-' (PCENChar)*
@@ -11,7 +11,7 @@ const onlyPCENChar =
11
11
  // eslint-disable-next-line no-misleading-character-class
12
12
  /^[-.\d_a-z\u00B7\u00C0-\u00D6[\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*$/u;
13
13
  /**
14
- * valid name of custom element
14
+ * Checks whether a string is a valid custom element name.
15
15
  *
16
16
  * > PotentialCustomElementName ::=
17
17
  * > [a-z] (PCENChar)* '-' (PCENChar)*
@@ -1,5 +1,6 @@
1
1
  import type { FormattedPrimitiveTypeCreator } from '../types.js';
2
2
  /**
3
+ * Checks whether a string is a valid itemprop property name.
3
4
  *
4
5
  * @see https://html.spec.whatwg.org/multipage/microdata.html#defined-property-name
5
6
  *
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * Checks whether a string is a valid itemprop property name.
2
3
  *
3
4
  * @see https://html.spec.whatwg.org/multipage/microdata.html#defined-property-name
4
5
  *
@@ -1,5 +1,7 @@
1
1
  import type { FormattedPrimitiveTypeCreator } from '../types.js';
2
2
  /**
3
+ * Checks whether a string is a valid navigable target name.
4
+ *
3
5
  * @see https://html.spec.whatwg.org/multipage/document-sequences.html#valid-navigable-target-name
4
6
  *
5
7
  * > A valid navigable target name is any string with at least one character
@@ -5,6 +5,8 @@
5
5
  */
6
6
  const TAB_OR_NEWLINE = /[\t\n\r]/;
7
7
  /**
8
+ * Checks whether a string is a valid navigable target name.
9
+ *
8
10
  * @see https://html.spec.whatwg.org/multipage/document-sequences.html#valid-navigable-target-name
9
11
  *
10
12
  * > A valid navigable target name is any string with at least one character
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/types",
3
- "version": "4.8.1",
3
+ "version": "4.18.0",
4
4
  "description": "Type declaration and value checker",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -29,16 +29,16 @@
29
29
  "schema:prettier": "npx prettier --write \"./src/types.schema.ts\" \"./types.schema.json\" --log-level warn"
30
30
  },
31
31
  "dependencies": {
32
- "@markuplint/shared": "4.4.12",
32
+ "@markuplint/shared": "4.18.0",
33
33
  "@types/css-tree": "2.3.11",
34
- "@types/debug": "4.1.12",
35
- "@types/whatwg-mimetype": "3.0.2",
34
+ "@types/debug": "4.1.13",
35
+ "@types/whatwg-mimetype": "5.0.0",
36
36
  "bcp-47": "2.1.0",
37
- "css-tree": "3.1.0",
37
+ "css-tree": "3.2.1",
38
38
  "debug": "4.4.3",
39
39
  "leven": "4.1.0",
40
- "type-fest": "4.41.0",
41
- "whatwg-mimetype": "4.0.0"
40
+ "type-fest": "5.6.0",
41
+ "whatwg-mimetype": "5.0.0"
42
42
  },
43
- "gitHead": "6213ea30269ef404f030e67bbcc7fc7443ec1060"
43
+ "gitHead": "1885af6349def3f19df975b9e9c399dd47361de1"
44
44
  }