prunelle 0.0.0-stage → 0.7.2

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 (222) hide show
  1. package/LICENSE +21 -0
  2. package/llms.txt +245 -0
  3. package/package.json +62 -4
  4. package/src/a11y/declaration.ts +373 -0
  5. package/src/a11y/index.ts +477 -0
  6. package/src/a11y/rgaa-map.ts +230 -0
  7. package/src/ambient.d.ts +6 -0
  8. package/src/attrs.ts +43 -0
  9. package/src/build/bundle.ts +661 -0
  10. package/src/build/byte-size.ts +11 -0
  11. package/src/build/carry.ts +57 -0
  12. package/src/build/client-entries.ts +107 -0
  13. package/src/build/client-plugin.ts +175 -0
  14. package/src/build/client-prune.ts +168 -0
  15. package/src/build/compile.ts +130 -0
  16. package/src/build/ecoindex.ts +238 -0
  17. package/src/build/files.ts +171 -0
  18. package/src/build/first-load.ts +235 -0
  19. package/src/build/graph.ts +237 -0
  20. package/src/build/index.ts +678 -0
  21. package/src/build/is-inside.ts +12 -0
  22. package/src/build/island-promote.ts +311 -0
  23. package/src/build/islands.ts +452 -0
  24. package/src/build/manifest.ts +204 -0
  25. package/src/build/output.ts +81 -0
  26. package/src/build/plugin-host.ts +294 -0
  27. package/src/build/precompress.ts +139 -0
  28. package/src/build/prerender.ts +288 -0
  29. package/src/build/reach.ts +200 -0
  30. package/src/build/render-rules.ts +205 -0
  31. package/src/build/report.ts +290 -0
  32. package/src/build/resolve.ts +52 -0
  33. package/src/build/routes.ts +342 -0
  34. package/src/build/server-entry.ts +38 -0
  35. package/src/build/static-headers.ts +112 -0
  36. package/src/build/static.ts +209 -0
  37. package/src/build/status-pages.ts +127 -0
  38. package/src/build/style-bundles.ts +526 -0
  39. package/src/cli/check-forms.ts +636 -0
  40. package/src/cli/check-imports.ts +31 -0
  41. package/src/cli/check-links.ts +632 -0
  42. package/src/cli/check-security.ts +64 -0
  43. package/src/cli/check.ts +409 -0
  44. package/src/cli/commands.ts +372 -0
  45. package/src/cli/docs.ts +403 -0
  46. package/src/cli/index.ts +70 -0
  47. package/src/cli/inspect.ts +406 -0
  48. package/src/cli/mcp-tools.ts +492 -0
  49. package/src/cli/mcp.ts +205 -0
  50. package/src/cli/new.ts +52 -0
  51. package/src/cli/render.ts +416 -0
  52. package/src/cli/upgrade-names.ts +209 -0
  53. package/src/cli/upgrade.ts +367 -0
  54. package/src/compiler/analyze.ts +651 -0
  55. package/src/compiler/ast.ts +82 -0
  56. package/src/compiler/browser-globals.ts +250 -0
  57. package/src/compiler/cacheability-private.ts +566 -0
  58. package/src/compiler/cacheability.ts +335 -0
  59. package/src/compiler/compliance-eco.ts +71 -0
  60. package/src/compiler/compliance-rgaa.ts +614 -0
  61. package/src/compiler/compliance-urls.ts +148 -0
  62. package/src/compiler/compliance.ts +653 -0
  63. package/src/compiler/data-keys.ts +302 -0
  64. package/src/compiler/dev-source.ts +87 -0
  65. package/src/compiler/dom-attrs.ts +452 -0
  66. package/src/compiler/dom.ts +641 -0
  67. package/src/compiler/emit.ts +131 -0
  68. package/src/compiler/expr-context.ts +587 -0
  69. package/src/compiler/foreign-imports.ts +88 -0
  70. package/src/compiler/index.ts +8 -0
  71. package/src/compiler/interactivity.ts +366 -0
  72. package/src/compiler/mistakes.ts +520 -0
  73. package/src/compiler/node-env.ts +50 -0
  74. package/src/compiler/patch.ts +97 -0
  75. package/src/compiler/props-body.ts +60 -0
  76. package/src/compiler/props.ts +511 -0
  77. package/src/compiler/scope.ts +635 -0
  78. package/src/compiler/server-only.ts +365 -0
  79. package/src/compiler/shared.ts +397 -0
  80. package/src/compiler/signal-reads.ts +246 -0
  81. package/src/compiler/slots.ts +227 -0
  82. package/src/compiler/spread-handlers.ts +295 -0
  83. package/src/compiler/ssr-helpers.ts +555 -0
  84. package/src/compiler/ssr-island.ts +90 -0
  85. package/src/compiler/ssr-prunelle-tags.ts +69 -0
  86. package/src/compiler/ssr.ts +525 -0
  87. package/src/context.ts +199 -0
  88. package/src/dev/child.ts +30 -0
  89. package/src/dev/error-log.ts +177 -0
  90. package/src/dev/host-check.ts +32 -0
  91. package/src/dev/index.ts +268 -0
  92. package/src/dev/modules.ts +68 -0
  93. package/src/dev/open-editor.ts +228 -0
  94. package/src/dev/protocol.ts +24 -0
  95. package/src/dev/queue.ts +79 -0
  96. package/src/dev/reload.ts +159 -0
  97. package/src/dev/supervisor.ts +212 -0
  98. package/src/dev/watchers.ts +276 -0
  99. package/src/dom/action.ts +187 -0
  100. package/src/dom/attrs.ts +84 -0
  101. package/src/dom/claim.ts +120 -0
  102. package/src/dom/extras.ts +579 -0
  103. package/src/dom/index.ts +329 -0
  104. package/src/dom/island.ts +318 -0
  105. package/src/dom/loop.ts +484 -0
  106. package/src/dom/revive.ts +36 -0
  107. package/src/eco/declaration.ts +328 -0
  108. package/src/eco/index.ts +69 -0
  109. package/src/index.ts +22 -0
  110. package/src/jsx-runtime.ts +566 -0
  111. package/src/plugins/config.ts +92 -0
  112. package/src/plugins/context.ts +109 -0
  113. package/src/plugins/index.ts +14 -0
  114. package/src/plugins/load.ts +90 -0
  115. package/src/plugins/order.ts +148 -0
  116. package/src/plugins/public.ts +15 -0
  117. package/src/plugins/requires.ts +47 -0
  118. package/src/plugins/services.ts +119 -0
  119. package/src/plugins/types.ts +278 -0
  120. package/src/reactivity/graph.ts +259 -0
  121. package/src/reactivity/index.ts +541 -0
  122. package/src/reactivity/selector.ts +78 -0
  123. package/src/reactivity/store.ts +252 -0
  124. package/src/server/action-flash.ts +158 -0
  125. package/src/server/action-protect.ts +199 -0
  126. package/src/server/action-registry.ts +78 -0
  127. package/src/server/action.ts +511 -0
  128. package/src/server/app-entry.ts +23 -0
  129. package/src/server/app-secret.ts +63 -0
  130. package/src/server/assets.ts +168 -0
  131. package/src/server/compress.ts +646 -0
  132. package/src/server/consent.ts +290 -0
  133. package/src/server/cookies.ts +153 -0
  134. package/src/server/document.ts +286 -0
  135. package/src/server/env.ts +47 -0
  136. package/src/server/errors.ts +396 -0
  137. package/src/server/form-schema.ts +337 -0
  138. package/src/server/health.ts +275 -0
  139. package/src/server/http.ts +588 -0
  140. package/src/server/index.ts +615 -0
  141. package/src/server/lifecycle.ts +75 -0
  142. package/src/server/loader.ts +131 -0
  143. package/src/server/page.ts +122 -0
  144. package/src/server/param-matchers.ts +112 -0
  145. package/src/server/plugin-host.ts +267 -0
  146. package/src/server/prerendered.ts +71 -0
  147. package/src/server/public.ts +20 -0
  148. package/src/server/rate-limit.ts +199 -0
  149. package/src/server/region.ts +96 -0
  150. package/src/server/request-body.ts +27 -0
  151. package/src/server/request-path.ts +73 -0
  152. package/src/server/request-scope.ts +22 -0
  153. package/src/server/route-cache.ts +541 -0
  154. package/src/server/route-table.ts +424 -0
  155. package/src/server/router.ts +261 -0
  156. package/src/server/routing.ts +388 -0
  157. package/src/server/sanitize-html.ts +309 -0
  158. package/src/server/security.ts +550 -0
  159. package/src/server/serve-handlers.ts +93 -0
  160. package/src/server/served-file.ts +128 -0
  161. package/src/server/standard-schema.ts +104 -0
  162. package/src/server/start.ts +143 -0
  163. package/src/server/static-dir.ts +246 -0
  164. package/src/server/stream.ts +233 -0
  165. package/src/ssr/consent-banner.ts +58 -0
  166. package/src/ssr/context.ts +399 -0
  167. package/src/ssr/index.ts +624 -0
  168. package/src/ssr/navigation.ts +96 -0
  169. package/src/ssr/region.ts +192 -0
  170. package/src/style.ts +96 -0
  171. package/src/test/browser.ts +201 -0
  172. package/src/test/index.ts +262 -0
  173. package/src/ts-plugin/diagnostics.ts +505 -0
  174. package/src/ts-plugin/fixes.ts +364 -0
  175. package/src/ts-plugin/index.ts +194 -0
  176. package/src/unrenderable.ts +35 -0
  177. package/templates/_shared/AGENTS.md +10 -0
  178. package/templates/_shared/CLAUDE.md +1 -0
  179. package/templates/_shared/gitignore +8 -0
  180. package/templates/_shared/mcp.json +11 -0
  181. package/templates/_shared/public/robots.txt +2 -0
  182. package/templates/_shared/src/routes/legal.tsx +22 -0
  183. package/templates/_shared/tsconfig.json +25 -0
  184. package/templates/app/.env.example +8 -0
  185. package/templates/app/package.json +22 -0
  186. package/templates/app/prunelle.config.ts +13 -0
  187. package/templates/app/src/auth.ts +12 -0
  188. package/templates/app/src/mail.ts +4 -0
  189. package/templates/app/src/routes/_layout.tsx +40 -0
  190. package/templates/app/src/routes/dashboard/_middleware.ts +3 -0
  191. package/templates/app/src/routes/dashboard/index.tsx +47 -0
  192. package/templates/app/src/routes/index.tsx +15 -0
  193. package/templates/app/src/routes/login.tsx +53 -0
  194. package/templates/app/src/routes/privacy.tsx +25 -0
  195. package/templates/app/src/styles/app.css +14 -0
  196. package/templates/app/tests/app.test.ts +73 -0
  197. package/templates/blog/content/posts/welcome.md +9 -0
  198. package/templates/blog/package.json +22 -0
  199. package/templates/blog/prunelle.config.ts +23 -0
  200. package/templates/blog/src/posts.ts +26 -0
  201. package/templates/blog/src/routes/_layout.tsx +25 -0
  202. package/templates/blog/src/routes/blog/[slug].tsx +31 -0
  203. package/templates/blog/src/routes/index.tsx +33 -0
  204. package/templates/blog/src/styles/app.css +15 -0
  205. package/templates/fullstack/package.json +19 -0
  206. package/templates/fullstack/prunelle.config.ts +6 -0
  207. package/templates/fullstack/src/actions/greet.ts +19 -0
  208. package/templates/fullstack/src/components/Counter.tsx +10 -0
  209. package/templates/fullstack/src/components/GreetForm.tsx +28 -0
  210. package/templates/fullstack/src/routes/_layout.tsx +18 -0
  211. package/templates/fullstack/src/routes/api/health.ts +5 -0
  212. package/templates/fullstack/src/routes/index.tsx +13 -0
  213. package/templates/fullstack/src/styles/app.css +39 -0
  214. package/templates/fullstack/tests/app.test.ts +37 -0
  215. package/templates/minimal/package.json +19 -0
  216. package/templates/minimal/prunelle.config.ts +6 -0
  217. package/templates/minimal/src/components/Counter.tsx +10 -0
  218. package/templates/minimal/src/routes/_layout.tsx +18 -0
  219. package/templates/minimal/src/routes/index.tsx +11 -0
  220. package/templates/minimal/src/styles/app.css +32 -0
  221. package/ts-plugin.cjs +4277 -0
  222. package/README.md +0 -3
@@ -0,0 +1,230 @@
1
+ // Mapping between axe-core rule identifiers and French RGAA 4.1 criteria.
2
+
3
+ export interface RgaaCriterion {
4
+ /** RGAA 4.1 criterion identifier (e.g. `'1.1'`, `'3.2'`, `'11.1'`). */
5
+ id: string
6
+ /** RGAA 4.1 theme number (1–13). */
7
+ theme: number
8
+ /** Short French RGAA 4.1 criterion title. */
9
+ label: string
10
+ }
11
+
12
+ /** Subset of official French RGAA 4.1 criteria detectable by automated axe-core checks. */
13
+ export const RGAA_CRITERIA: Readonly<Record<string, RgaaCriterion>> = {
14
+ '1.1': { id: '1.1', theme: 1, label: 'Alternative textuelle pour chaque image porteuse d\'information' },
15
+ '1.2': { id: '1.2', theme: 1, label: 'Image de décoration ignorée par les technologies d\'assistance' },
16
+ '1.3': { id: '1.3', theme: 1, label: 'Pertinence de l\'alternative textuelle des images' },
17
+ '2.1': { id: '2.1', theme: 2, label: 'Titre de chaque cadre (iframe)' },
18
+ '2.2': { id: '2.2', theme: 2, label: 'Pertinence du titre de chaque cadre' },
19
+ '3.1': { id: '3.1', theme: 3, label: 'Information non donnée uniquement par la couleur' },
20
+ '3.2': { id: '3.2', theme: 3, label: 'Contraste suffisant entre texte et arrière-plan' },
21
+ '4.1': { id: '4.1', theme: 4, label: 'Transcription textuelle ou audiodescription des médias temporels' },
22
+ '4.3': { id: '4.3', theme: 4, label: 'Sous-titres synchronisés des médias temporels synchronisés' },
23
+ '4.10': { id: '4.10', theme: 4, label: 'Contrôle des sons déclenchés automatiquement' },
24
+ '5.1': { id: '5.1', theme: 5, label: 'Résumé des tableaux de données complexes' },
25
+ '5.2': { id: '5.2', theme: 5, label: 'Pertinence du résumé des tableaux de données complexes' },
26
+ '5.3': { id: '5.3', theme: 5, label: 'Compréhension du contenu linéarisé des tableaux de mise en forme' },
27
+ '5.4': { id: '5.4', theme: 5, label: 'Association du titre au tableau de données' },
28
+ '5.6': { id: '5.6', theme: 5, label: 'Déclaration des en-têtes de colonnes et de lignes des tableaux' },
29
+ '5.7': { id: '5.7', theme: 5, label: 'Association des cellules de données avec leurs en-têtes' },
30
+ '6.1': { id: '6.1', theme: 6, label: 'Intitulé explicite de chaque lien' },
31
+ '6.2': { id: '6.2', theme: 6, label: 'Présence d\'un intitulé pour chaque lien' },
32
+ '7.1': { id: '7.1', theme: 7, label: 'Compatibilité des scripts et composants ARIA avec les technologies d\'assistance' },
33
+ '7.3': { id: '7.3', theme: 7, label: 'Contrôle au clavier et par tout dispositif de pointage' },
34
+ '8.2': { id: '8.2', theme: 8, label: 'Validité du code source généré (identifiants uniques)' },
35
+ '8.3': { id: '8.3', theme: 8, label: 'Présence de la langue par défaut de la page' },
36
+ '8.4': { id: '8.4', theme: 8, label: 'Pertinence du code de langue par défaut' },
37
+ '8.5': { id: '8.5', theme: 8, label: 'Présence d\'un titre de page (<title>)' },
38
+ '8.7': { id: '8.7', theme: 8, label: 'Indication des changements de langue dans le code source' },
39
+ '8.8': { id: '8.8', theme: 8, label: 'Validité et pertinence du code de langue des changements de langue' },
40
+ '9.1': { id: '9.1', theme: 9, label: 'Structuration de l\'information par les titres (h1–h6)' },
41
+ '9.2': { id: '9.2', theme: 9, label: 'Cohérence de la structure et des zones principales (landmarks)' },
42
+ '9.3': { id: '9.3', theme: 9, label: 'Structuration correcte des listes' },
43
+ '10.1': { id: '10.1', theme: 10, label: 'Utilisation des feuilles de styles pour contrôler la présentation' },
44
+ '10.4': { id: '10.4', theme: 10, label: 'Lisibilité du texte lors d\'un agrandissement jusqu\'à 200 %' },
45
+ '10.6': { id: '10.6', theme: 10, label: 'Visibilité des liens dont la nature n\'est pas évidente par rapport au texte environnant' },
46
+ '10.8': { id: '10.8', theme: 10, label: 'Contenus cachés destinés à être ignorés par les technologies d\'assistance' },
47
+ '10.11': { id: '10.11', theme: 10, label: 'Présentation sans perte d\'information ni défilement horizontal (reflow)' },
48
+ '10.13': { id: '10.13', theme: 10, label: 'Contrôle des contenus additionnels au focus ou au survol' },
49
+ '11.1': { id: '11.1', theme: 11, label: 'Étiquette associée à chaque champ de formulaire' },
50
+ '11.2': { id: '11.2', theme: 11, label: 'Pertinence de l\'étiquette associée à chaque champ de formulaire' },
51
+ '11.5': { id: '11.5', theme: 11, label: 'Regroupement des champs de même nature dans les formulaires' },
52
+ '11.9': { id: '11.9', theme: 11, label: 'Pertinence de l\'intitulé de chaque bouton' },
53
+ '11.13': { id: '11.13', theme: 11, label: 'Déduction de la finalité des champs de saisie (autocomplete)' },
54
+ '12.6': { id: '12.6', theme: 12, label: 'Accès et évitement des zones de regroupement de contenus' },
55
+ '12.7': { id: '12.7', theme: 12, label: 'Lien d\'évitement ou d\'accès rapide au contenu principal' },
56
+ '12.8': { id: '12.8', theme: 12, label: 'Cohérence de l\'ordre de tabulation' },
57
+ '13.1': { id: '13.1', theme: 13, label: 'Contrôle par l\'utilisateur de chaque limite de temps' },
58
+ '13.8': { id: '13.8', theme: 13, label: 'Contrôle des contenus en mouvement ou clignotants' },
59
+ '13.9': { id: '13.9', theme: 13, label: 'Consultation du contenu quelle que soit l\'orientation de l\'écran' },
60
+ }
61
+
62
+ /**
63
+ * Direct lookup from axe-core rule ID to one or more RGAA 4.1 criterion IDs.
64
+ * A rule axe-core tags `RGAA-x.y.z` maps to what axe names, and `a11y-audit.test.ts` fails when an axe-core upgrade moves one; the rest are axe best-practice rules mapped here.
65
+ */
66
+ export const AXE_TO_RGAA: Readonly<Record<string, readonly string[]>> = {
67
+ // Theme 1 - Images
68
+ 'area-alt': ['1.1'],
69
+ 'image-alt': ['1.1'],
70
+ 'input-image-alt': ['1.1'],
71
+ 'object-alt': ['1.1'],
72
+ 'role-img-alt': ['1.1'],
73
+ 'server-side-image-map': ['1.1'],
74
+ 'svg-img-alt': ['1.1'],
75
+ 'presentation-role-conflict': ['1.2', '7.1'],
76
+ 'image-redundant-alt': ['1.3'],
77
+
78
+ // Theme 2 - Cadres
79
+ 'frame-title': ['2.1'],
80
+ 'frame-title-unique': ['2.2'],
81
+
82
+ // Theme 3 - Couleurs
83
+ 'color-contrast': ['3.2'],
84
+ 'color-contrast-enhanced': ['3.2'],
85
+
86
+ // Theme 4 - Multimédia
87
+ 'audio-caption': ['4.1'],
88
+ 'video-caption': ['4.3'],
89
+ 'no-autoplay-audio': ['4.10'],
90
+
91
+ // Theme 5 - Tableaux
92
+ 'table-duplicate-name': ['5.2'],
93
+ 'table-fake-caption': ['5.4'],
94
+ 'empty-table-header': ['5.6'],
95
+ 'scope-attr-valid': ['5.7'],
96
+ 'td-has-header': ['5.7'],
97
+ 'td-headers-attr': ['5.7'],
98
+ 'th-has-data-cells': ['5.7'],
99
+
100
+ // Theme 6 - Liens
101
+ 'identical-links-same-purpose': ['6.1'],
102
+ 'label-content-name-mismatch': ['6.1'],
103
+ 'link-name': ['6.2'],
104
+
105
+ // Theme 7 - Scripts & ARIA
106
+ 'aria-allowed-attr': ['7.1'],
107
+ 'aria-conditional-attr': ['7.1'],
108
+ 'aria-deprecated-role': ['7.1'],
109
+ 'aria-prohibited-attr': ['7.1'],
110
+ 'aria-required-attr': ['7.1'],
111
+ 'aria-roles': ['7.1'],
112
+ 'aria-tab-name': ['7.1'],
113
+ 'aria-toggle-field-name': ['7.1'],
114
+ 'aria-valid-attr': ['7.1'],
115
+ 'aria-valid-attr-value': ['7.1'],
116
+ 'nested-interactive': ['7.1'],
117
+ 'summary-name': ['7.1'],
118
+ 'frame-focusable-content': ['7.3'],
119
+ 'scrollable-region-focusable': ['7.3'],
120
+
121
+ // Theme 8 - Éléments obligatoires
122
+ 'duplicate-id': ['8.2'],
123
+ 'duplicate-id-active': ['8.2'],
124
+ 'duplicate-id-aria': ['8.2'],
125
+ 'html-has-lang': ['8.3'],
126
+ 'html-xml-lang-mismatch': ['8.3'],
127
+ 'html-lang-valid': ['8.4'],
128
+ 'document-title': ['8.5'],
129
+ 'valid-lang': ['8.8'],
130
+
131
+ // Theme 9 - Structuration de l'information
132
+ 'empty-heading': ['9.1'],
133
+ 'heading-order': ['9.1'],
134
+ 'p-as-heading': ['9.1'],
135
+ 'page-has-heading-one': ['9.1'],
136
+ 'landmark-banner-is-top-level': ['9.2'],
137
+ 'landmark-complementary-is-top-level': ['9.2'],
138
+ 'landmark-contentinfo-is-top-level': ['9.2'],
139
+ 'landmark-main-is-top-level': ['9.2'],
140
+ 'landmark-no-duplicate-banner': ['9.2'],
141
+ 'landmark-no-duplicate-contentinfo': ['9.2'],
142
+ 'landmark-no-duplicate-main': ['9.2'],
143
+ 'landmark-one-main': ['9.2'],
144
+ 'landmark-unique': ['9.2'],
145
+ 'region': ['9.2'],
146
+ 'aria-required-children': ['9.3'],
147
+ 'aria-required-parent': ['9.3'],
148
+ 'definition-list': ['9.3'],
149
+ 'dlitem': ['9.3'],
150
+ 'list': ['9.3'],
151
+ 'listitem': ['9.3'],
152
+
153
+ // Theme 10 - Présentation de l'information
154
+ 'meta-viewport': ['10.4'],
155
+ 'meta-viewport-large': ['10.4'],
156
+ 'link-in-text-block': ['10.6'],
157
+ 'aria-hidden-body': ['10.8'],
158
+ 'aria-hidden-focus': ['10.8'],
159
+ 'avoid-inline-spacing': ['10.11'],
160
+ 'target-size': ['10.13'],
161
+
162
+ // Theme 11 - Formulaires
163
+ 'aria-input-field-name': ['11.1'],
164
+ 'aria-meter-name': ['11.1'],
165
+ 'aria-progressbar-name': ['11.1'],
166
+ 'label': ['11.1'],
167
+ 'label-title-only': ['11.1'],
168
+ 'select-name': ['11.1'],
169
+ 'form-field-multiple-labels': ['11.2'],
170
+ 'aria-command-name': ['11.9'],
171
+ 'button-name': ['11.9'],
172
+ 'input-button-name': ['11.9'],
173
+ 'autocomplete-valid': ['11.13'],
174
+
175
+ // Theme 12 - Navigation
176
+ 'bypass': ['12.7'],
177
+ 'skip-link': ['12.7'],
178
+ 'accesskeys': ['12.8'],
179
+ 'focus-order-semantics': ['12.8'],
180
+ 'tabindex': ['12.8'],
181
+
182
+ // Theme 13 - Consultation
183
+ 'meta-refresh': ['13.1'],
184
+ 'meta-refresh-no-exceptions': ['13.1'],
185
+ 'blink': ['13.8'],
186
+ 'marquee': ['13.8'],
187
+ 'css-orientation-lock': ['13.9'],
188
+ }
189
+
190
+ function lookupCriteria(ids: readonly string[]): RgaaCriterion[] {
191
+ const out: RgaaCriterion[] = []
192
+ for (const id of ids) {
193
+ const found = RGAA_CRITERIA[id]
194
+ if (found !== undefined)
195
+ out.push(found)
196
+ }
197
+ return out
198
+ }
199
+
200
+ // `RGAA-11.9.1` names test 1 of criterion 11.9.
201
+ function criteriaFromTags(tags: readonly string[]): string[] {
202
+ const ids: string[] = []
203
+ for (const tag of tags) {
204
+ if (!tag.startsWith('RGAA-'))
205
+ continue
206
+ const id = tag.slice(5).split('.').slice(0, 2).join('.')
207
+ if (!ids.includes(id))
208
+ ids.push(id)
209
+ }
210
+ return ids
211
+ }
212
+
213
+ /** Resolves an axe-core rule ID (e.g. `'image-alt'`, `'aria-roles'`) to its RGAA 4.1 criteria, from the result's own `RGAA-x.y.z` tags when it has them. */
214
+ export function rgaaCriteriaForAxeRule(ruleId: string, tags: readonly string[] = []): RgaaCriterion[] {
215
+ const tagged = criteriaFromTags(tags)
216
+ if (tagged.length > 0)
217
+ return lookupCriteria(tagged)
218
+ const exact = AXE_TO_RGAA[ruleId]
219
+ if (exact !== undefined)
220
+ return lookupCriteria(exact)
221
+ if (ruleId.startsWith('aria-'))
222
+ return lookupCriteria(['7.1'])
223
+ if (ruleId.startsWith('table-') || ruleId.startsWith('td-') || ruleId.startsWith('th-'))
224
+ return lookupCriteria(['5.7'])
225
+ if (ruleId.startsWith('landmark-'))
226
+ return lookupCriteria(['9.2'])
227
+ if (ruleId.startsWith('frame-'))
228
+ return lookupCriteria(['2.1'])
229
+ return []
230
+ }
@@ -0,0 +1,6 @@
1
+ declare module '*.module.css' {
2
+ const classes: Readonly<Record<string, string>>
3
+ export default classes
4
+ }
5
+
6
+ declare module '*.css' {}
package/src/attrs.ts ADDED
@@ -0,0 +1,43 @@
1
+ // Shared HTML attribute safety & classification rules used identically by compiler, SSR, and DOM runtimes.
2
+
3
+ export const VALID_ATTR_NAME = /^[A-Za-z_:][-\w:.]*$/
4
+ export const URL_ATTRS = new Set(['href', 'src', 'action', 'formaction', 'xlink:href', 'data'])
5
+ const UNSAFE_URL_RE = /^(?:javascript|vbscript):/i
6
+ const SAFE_RASTER_DATA_URL_RE = /^data:image\/(?:png|jpe?g|gif|webp|avif|bmp|ico|x-icon|vnd\.microsoft\.icon)[;,]/i
7
+ const SAFE_SVG_DATA_URL_RE = /^data:image\/svg\+xml[;,]/i
8
+ const SVG_DATA_SRC_TAGS = new Set(['img', 'source'])
9
+ const STRING_BOOL_ATTRS = new Set(['draggable', 'spellcheck', 'contenteditable'])
10
+
11
+ export const DOM_PROPS = new Set(['value', 'checked', 'selected', 'muted', 'indeterminate'])
12
+
13
+ export function isBlockedAttr(name: string): boolean {
14
+ if (!VALID_ATTR_NAME.test(name))
15
+ return true
16
+ const lower = name.toLowerCase()
17
+ return lower.startsWith('on') || lower === 'innerhtml' || lower === 'srcdoc'
18
+ }
19
+
20
+ export function isStringBoolAttr(name: string): boolean {
21
+ const lower = name.toLowerCase()
22
+ return lower.startsWith('aria-') || STRING_BOOL_ATTRS.has(lower)
23
+ }
24
+
25
+ export function isUnsafeUrlAttr(name: string, value: unknown, tag?: string): boolean {
26
+ const lower = name.toLowerCase()
27
+ if (!URL_ATTRS.has(lower))
28
+ return false
29
+ const cleaned = String(value).replace(/[\u0000-\u0020]+/g, '')
30
+ if (UNSAFE_URL_RE.test(cleaned))
31
+ return true
32
+ if (!/^data:/i.test(cleaned))
33
+ return false
34
+ const lowerTag = tag?.toLowerCase()
35
+ if (lower === 'src') {
36
+ if (SAFE_RASTER_DATA_URL_RE.test(cleaned))
37
+ return false
38
+ return !(lowerTag !== undefined && SVG_DATA_SRC_TAGS.has(lowerTag) && SAFE_SVG_DATA_URL_RE.test(cleaned))
39
+ }
40
+ if (lower === 'href' && lowerTag === 'link')
41
+ return !(SAFE_RASTER_DATA_URL_RE.test(cleaned) || SAFE_SVG_DATA_URL_RE.test(cleaned))
42
+ return true
43
+ }