@gyral/core 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/NOTICE +19 -0
  3. package/README.md +35 -8
  4. package/dist/call.d.ts +32 -0
  5. package/dist/call.js +63 -0
  6. package/dist/call.js.map +1 -0
  7. package/dist/children.d.ts +30 -5
  8. package/dist/children.js +26 -4
  9. package/dist/children.js.map +1 -1
  10. package/dist/cli/gyral-types.d.ts +2 -0
  11. package/dist/cli/gyral-types.js +23 -0
  12. package/dist/cli/gyral-types.js.map +1 -0
  13. package/dist/command.d.ts +54 -12
  14. package/dist/command.js +31 -11
  15. package/dist/command.js.map +1 -1
  16. package/dist/compiler/ast.d.ts +23 -0
  17. package/dist/compiler/ast.js +149 -0
  18. package/dist/compiler/ast.js.map +1 -0
  19. package/dist/compiler/compile.d.ts +41 -0
  20. package/dist/compiler/compile.js +148 -0
  21. package/dist/compiler/compile.js.map +1 -0
  22. package/dist/compiler/component-entries.d.ts +7 -0
  23. package/dist/compiler/component-entries.js +42 -0
  24. package/dist/compiler/component-entries.js.map +1 -0
  25. package/dist/compiler/components.d.ts +4 -0
  26. package/dist/compiler/components.js +182 -0
  27. package/dist/compiler/components.js.map +1 -0
  28. package/dist/compiler/facts.d.ts +31 -0
  29. package/dist/compiler/facts.js +285 -0
  30. package/dist/compiler/facts.js.map +1 -0
  31. package/dist/compiler/features.d.ts +34 -0
  32. package/dist/compiler/features.js +158 -0
  33. package/dist/compiler/features.js.map +1 -0
  34. package/dist/compiler/hooks.d.ts +22 -0
  35. package/dist/compiler/hooks.js +241 -0
  36. package/dist/compiler/hooks.js.map +1 -0
  37. package/dist/compiler/loader-source.d.ts +14 -0
  38. package/dist/compiler/loader-source.js +86 -0
  39. package/dist/compiler/loader-source.js.map +1 -0
  40. package/dist/compiler/locate.d.ts +14 -0
  41. package/dist/compiler/locate.js +78 -0
  42. package/dist/compiler/locate.js.map +1 -0
  43. package/dist/compiler/parse5-check.d.ts +21 -0
  44. package/dist/compiler/parse5-check.js +60 -0
  45. package/dist/compiler/parse5-check.js.map +1 -0
  46. package/dist/compiler/prop-schemas.d.ts +4 -0
  47. package/dist/compiler/prop-schemas.js +108 -0
  48. package/dist/compiler/prop-schemas.js.map +1 -0
  49. package/dist/compiler/scan.d.ts +41 -0
  50. package/dist/compiler/scan.js +160 -0
  51. package/dist/compiler/scan.js.map +1 -0
  52. package/dist/compiler/scope.d.ts +8 -0
  53. package/dist/compiler/scope.js +116 -0
  54. package/dist/compiler/scope.js.map +1 -0
  55. package/dist/compiler/source.d.ts +34 -0
  56. package/dist/compiler/source.js +114 -0
  57. package/dist/compiler/source.js.map +1 -0
  58. package/dist/compiler/tag-map.d.ts +41 -0
  59. package/dist/compiler/tag-map.js +126 -0
  60. package/dist/compiler/tag-map.js.map +1 -0
  61. package/dist/components-ready.d.ts +7 -0
  62. package/dist/components-ready.js +19 -0
  63. package/dist/components-ready.js.map +1 -0
  64. package/dist/define.d.ts +13 -4
  65. package/dist/define.js +35 -331
  66. package/dist/define.js.map +1 -1
  67. package/dist/devtools-events.d.ts +13 -0
  68. package/dist/devtools-events.js.map +1 -1
  69. package/dist/devtools-off.d.ts +2 -0
  70. package/dist/devtools-off.js +2 -0
  71. package/dist/devtools-off.js.map +1 -1
  72. package/dist/devtools.d.ts +4 -0
  73. package/dist/devtools.js +17 -2
  74. package/dist/devtools.js.map +1 -1
  75. package/dist/drivers-scope.d.ts +1 -1
  76. package/dist/drivers-scope.js +1 -8
  77. package/dist/drivers-scope.js.map +1 -1
  78. package/dist/element-internals.d.ts +1 -0
  79. package/dist/element-internals.js +11 -0
  80. package/dist/element-internals.js.map +1 -0
  81. package/dist/element-types.d.ts +11 -5
  82. package/dist/element-types.js.map +1 -1
  83. package/dist/element.d.ts +3 -0
  84. package/dist/element.js +322 -0
  85. package/dist/element.js.map +1 -0
  86. package/dist/error-view.d.ts +10 -0
  87. package/dist/error-view.js +30 -0
  88. package/dist/error-view.js.map +1 -0
  89. package/dist/errors.d.ts +21 -0
  90. package/dist/errors.js +47 -0
  91. package/dist/errors.js.map +1 -0
  92. package/dist/errors.json +289 -0
  93. package/dist/eslint/imports.d.ts +26 -0
  94. package/dist/eslint/imports.js +78 -0
  95. package/dist/eslint/imports.js.map +1 -0
  96. package/dist/eslint/index.d.ts +16 -0
  97. package/dist/eslint/index.js +23 -0
  98. package/dist/eslint/index.js.map +1 -0
  99. package/dist/eslint/locate.d.ts +33 -0
  100. package/dist/eslint/locate.js +132 -0
  101. package/dist/eslint/locate.js.map +1 -0
  102. package/dist/eslint/row-purity-rule.d.ts +2 -0
  103. package/dist/eslint/row-purity-rule.js +103 -0
  104. package/dist/eslint/row-purity-rule.js.map +1 -0
  105. package/dist/eslint/template-rule.d.ts +6 -0
  106. package/dist/eslint/template-rule.js +76 -0
  107. package/dist/eslint/template-rule.js.map +1 -0
  108. package/dist/eslint/unused-intent-rule.d.ts +2 -0
  109. package/dist/eslint/unused-intent-rule.js +186 -0
  110. package/dist/eslint/unused-intent-rule.js.map +1 -0
  111. package/dist/features.d.ts +39 -0
  112. package/dist/features.js +2 -0
  113. package/dist/features.js.map +1 -0
  114. package/dist/focus.d.ts +13 -12
  115. package/dist/focus.js +44 -11
  116. package/dist/focus.js.map +1 -1
  117. package/dist/form-associated.d.ts +46 -0
  118. package/dist/form-associated.js +77 -0
  119. package/dist/form-associated.js.map +1 -0
  120. package/dist/forms.d.ts +42 -30
  121. package/dist/forms.js +85 -41
  122. package/dist/forms.js.map +1 -1
  123. package/dist/frame-lane.d.ts +11 -0
  124. package/dist/frame-lane.js +28 -0
  125. package/dist/frame-lane.js.map +1 -0
  126. package/dist/head.d.ts +61 -0
  127. package/dist/head.js +85 -0
  128. package/dist/head.js.map +1 -0
  129. package/dist/hooks/invalid.d.ts +14 -0
  130. package/dist/hooks/invalid.js +72 -0
  131. package/dist/hooks/invalid.js.map +1 -0
  132. package/dist/host-model.d.ts +77 -0
  133. package/dist/host-model.js +278 -0
  134. package/dist/host-model.js.map +1 -0
  135. package/dist/hydration-client.d.ts +9 -0
  136. package/dist/hydration-client.js +35 -0
  137. package/dist/hydration-client.js.map +1 -0
  138. package/dist/hydration-loader.d.ts +13 -0
  139. package/dist/hydration-loader.js +58 -0
  140. package/dist/hydration-loader.js.map +1 -0
  141. package/dist/hydration-off.d.ts +8 -0
  142. package/dist/hydration-off.js +25 -0
  143. package/dist/hydration-off.js.map +1 -0
  144. package/dist/hydration.d.ts +3 -21
  145. package/dist/hydration.js +14 -63
  146. package/dist/hydration.js.map +1 -1
  147. package/dist/index.d.ts +24 -36
  148. package/dist/index.js +14 -32
  149. package/dist/index.js.map +1 -1
  150. package/dist/indexeddb-types.d.ts +97 -0
  151. package/dist/indexeddb-types.js +2 -0
  152. package/dist/indexeddb-types.js.map +1 -0
  153. package/dist/indexeddb.d.ts +5 -0
  154. package/dist/indexeddb.js +118 -0
  155. package/dist/indexeddb.js.map +1 -0
  156. package/dist/intent.d.ts +62 -17
  157. package/dist/intent.js +193 -100
  158. package/dist/intent.js.map +1 -1
  159. package/dist/internal/indexeddb-open.d.ts +8 -0
  160. package/dist/internal/indexeddb-open.js +96 -0
  161. package/dist/internal/indexeddb-open.js.map +1 -0
  162. package/dist/internal/indexeddb-transaction.d.ts +4 -0
  163. package/dist/internal/indexeddb-transaction.js +134 -0
  164. package/dist/internal/indexeddb-transaction.js.map +1 -0
  165. package/dist/internal/interpreter.d.ts +15 -1
  166. package/dist/internal/interpreter.js +42 -47
  167. package/dist/internal/interpreter.js.map +1 -1
  168. package/dist/internal/token.d.ts +1 -0
  169. package/dist/internal/token.js +7 -0
  170. package/dist/internal/token.js.map +1 -0
  171. package/dist/internal.d.ts +20 -0
  172. package/dist/internal.js +22 -0
  173. package/dist/internal.js.map +1 -0
  174. package/dist/invoker-fallback-used.d.ts +4 -0
  175. package/dist/invoker-fallback-used.js +10 -0
  176. package/dist/invoker-fallback-used.js.map +1 -0
  177. package/dist/invoker-fallback.d.ts +4 -0
  178. package/dist/invoker-fallback.js +15 -0
  179. package/dist/invoker-fallback.js.map +1 -0
  180. package/dist/invokers-shim.d.ts +6 -0
  181. package/dist/invokers-shim.js +32 -0
  182. package/dist/invokers-shim.js.map +1 -0
  183. package/dist/invokers.d.ts +3 -5
  184. package/dist/invokers.js +11 -51
  185. package/dist/invokers.js.map +1 -1
  186. package/dist/islands.d.ts +0 -2
  187. package/dist/islands.js +4 -11
  188. package/dist/islands.js.map +1 -1
  189. package/dist/light-dom.d.ts +4 -53
  190. package/dist/light-dom.js +5 -100
  191. package/dist/light-dom.js.map +1 -1
  192. package/dist/prop.d.ts +89 -0
  193. package/dist/prop.js +41 -0
  194. package/dist/prop.js.map +1 -0
  195. package/dist/props.d.ts +57 -21
  196. package/dist/props.js +157 -34
  197. package/dist/props.js.map +1 -1
  198. package/dist/retry.d.ts +15 -0
  199. package/dist/retry.js +48 -0
  200. package/dist/retry.js.map +1 -0
  201. package/dist/scheduler.d.ts +43 -0
  202. package/dist/scheduler.js +212 -0
  203. package/dist/scheduler.js.map +1 -0
  204. package/dist/script-json.d.ts +2 -0
  205. package/dist/script-json.js +13 -0
  206. package/dist/script-json.js.map +1 -0
  207. package/dist/server-component.d.ts +10 -0
  208. package/dist/server-component.js +133 -0
  209. package/dist/server-component.js.map +1 -0
  210. package/dist/server-specs.d.ts +6 -0
  211. package/dist/server-specs.js +13 -0
  212. package/dist/server-specs.js.map +1 -0
  213. package/dist/server.d.ts +34 -0
  214. package/dist/server.js +59 -0
  215. package/dist/server.js.map +1 -0
  216. package/dist/settled.d.ts +11 -0
  217. package/dist/settled.js +62 -0
  218. package/dist/settled.js.map +1 -0
  219. package/dist/spec-features-used.d.ts +21 -0
  220. package/dist/spec-features-used.js +50 -0
  221. package/dist/spec-features-used.js.map +1 -0
  222. package/dist/spec-features.d.ts +28 -0
  223. package/dist/spec-features.js +42 -0
  224. package/dist/spec-features.js.map +1 -0
  225. package/dist/states.d.ts +3 -5
  226. package/dist/states.js +22 -11
  227. package/dist/states.js.map +1 -1
  228. package/dist/storage.d.ts +69 -0
  229. package/dist/storage.js +158 -0
  230. package/dist/storage.js.map +1 -0
  231. package/dist/store-binding.d.ts +6 -3
  232. package/dist/store-binding.js +7 -8
  233. package/dist/store-binding.js.map +1 -1
  234. package/dist/store-scope.d.ts +8 -11
  235. package/dist/store-scope.js +15 -40
  236. package/dist/store-scope.js.map +1 -1
  237. package/dist/store.d.ts +3 -0
  238. package/dist/store.js +45 -10
  239. package/dist/store.js.map +1 -1
  240. package/dist/stores-provider.d.ts +2 -6
  241. package/dist/stores-provider.js +21 -55
  242. package/dist/stores-provider.js.map +1 -1
  243. package/dist/subscription.d.ts +35 -0
  244. package/dist/subscription.js +74 -0
  245. package/dist/subscription.js.map +1 -0
  246. package/dist/subscriptions.d.ts +26 -0
  247. package/dist/subscriptions.js +98 -0
  248. package/dist/subscriptions.js.map +1 -0
  249. package/dist/transitions.d.ts +5 -7
  250. package/dist/transitions.js +17 -20
  251. package/dist/transitions.js.map +1 -1
  252. package/dist/types.d.ts +142 -49
  253. package/dist/types.js.map +1 -1
  254. package/dist/use-dialogs.d.ts +2 -0
  255. package/dist/use-dialogs.js +9 -0
  256. package/dist/use-dialogs.js.map +1 -0
  257. package/dist/use-disposal.d.ts +2 -0
  258. package/dist/use-disposal.js +9 -0
  259. package/dist/use-disposal.js.map +1 -0
  260. package/dist/use-error-view.d.ts +2 -0
  261. package/dist/use-error-view.js +9 -0
  262. package/dist/use-error-view.js.map +1 -0
  263. package/dist/use-errored.d.ts +2 -0
  264. package/dist/use-errored.js +9 -0
  265. package/dist/use-errored.js.map +1 -0
  266. package/dist/use-form-associated.d.ts +2 -0
  267. package/dist/use-form-associated.js +7 -0
  268. package/dist/use-form-associated.js.map +1 -0
  269. package/dist/use-frame-lane.d.ts +2 -0
  270. package/dist/use-frame-lane.js +10 -0
  271. package/dist/use-frame-lane.js.map +1 -0
  272. package/dist/use-invokers.d.ts +2 -0
  273. package/dist/use-invokers.js +10 -0
  274. package/dist/use-invokers.js.map +1 -0
  275. package/dist/use-states.d.ts +2 -0
  276. package/dist/use-states.js +10 -0
  277. package/dist/use-states.js.map +1 -0
  278. package/dist/use-subscriptions.d.ts +2 -0
  279. package/dist/use-subscriptions.js +10 -0
  280. package/dist/use-subscriptions.js.map +1 -0
  281. package/dist/use-transitions.d.ts +2 -0
  282. package/dist/use-transitions.js +10 -0
  283. package/dist/use-transitions.js.map +1 -0
  284. package/dist/view/attributes.d.ts +11 -0
  285. package/dist/view/attributes.js +15 -0
  286. package/dist/view/attributes.js.map +1 -0
  287. package/dist/view/compiled.d.ts +1 -0
  288. package/dist/view/compiled.js +6 -0
  289. package/dist/view/compiled.js.map +1 -0
  290. package/dist/view/dev-off.d.ts +1 -0
  291. package/dist/view/dev-off.js +4 -0
  292. package/dist/view/dev-off.js.map +1 -0
  293. package/dist/view/dev.d.ts +1 -0
  294. package/dist/view/dev.js +5 -0
  295. package/dist/view/dev.js.map +1 -0
  296. package/dist/view/flags.d.ts +1 -0
  297. package/dist/view/flags.js +4 -0
  298. package/dist/view/flags.js.map +1 -0
  299. package/dist/view/index.d.ts +26 -0
  300. package/dist/view/index.js +27 -0
  301. package/dist/view/index.js.map +1 -0
  302. package/dist/view/loc.d.ts +9 -0
  303. package/dist/view/loc.js +50 -0
  304. package/dist/view/loc.js.map +1 -0
  305. package/dist/view/message.d.ts +17 -0
  306. package/dist/view/message.js +40 -0
  307. package/dist/view/message.js.map +1 -0
  308. package/dist/view/messages.d.ts +43 -0
  309. package/dist/view/messages.js +84 -0
  310. package/dist/view/messages.js.map +1 -0
  311. package/dist/view/normalize/check.d.ts +23 -0
  312. package/dist/view/normalize/check.js +81 -0
  313. package/dist/view/normalize/check.js.map +1 -0
  314. package/dist/view/normalize/emit.d.ts +15 -0
  315. package/dist/view/normalize/emit.js +165 -0
  316. package/dist/view/normalize/emit.js.map +1 -0
  317. package/dist/view/normalize/entities.d.ts +4 -0
  318. package/dist/view/normalize/entities.js +38 -0
  319. package/dist/view/normalize/entities.js.map +1 -0
  320. package/dist/view/normalize/errors.d.ts +9 -0
  321. package/dist/view/normalize/errors.js +19 -0
  322. package/dist/view/normalize/errors.js.map +1 -0
  323. package/dist/view/normalize/id.d.ts +10 -0
  324. package/dist/view/normalize/id.js +55 -0
  325. package/dist/view/normalize/id.js.map +1 -0
  326. package/dist/view/normalize/normalize.d.ts +18 -0
  327. package/dist/view/normalize/normalize.js +42 -0
  328. package/dist/view/normalize/normalize.js.map +1 -0
  329. package/dist/view/normalize/repairs.d.ts +24 -0
  330. package/dist/view/normalize/repairs.js +166 -0
  331. package/dist/view/normalize/repairs.js.map +1 -0
  332. package/dist/view/normalize/rules.d.ts +39 -0
  333. package/dist/view/normalize/rules.js +120 -0
  334. package/dist/view/normalize/rules.js.map +1 -0
  335. package/dist/view/normalize/shape.d.ts +5 -0
  336. package/dist/view/normalize/shape.js +38 -0
  337. package/dist/view/normalize/shape.js.map +1 -0
  338. package/dist/view/normalize/source.d.ts +13 -0
  339. package/dist/view/normalize/source.js +34 -0
  340. package/dist/view/normalize/source.js.map +1 -0
  341. package/dist/view/normalize/svg.d.ts +14 -0
  342. package/dist/view/normalize/svg.js +40 -0
  343. package/dist/view/normalize/svg.js.map +1 -0
  344. package/dist/view/normalize/tag-states.d.ts +23 -0
  345. package/dist/view/normalize/tag-states.js +192 -0
  346. package/dist/view/normalize/tag-states.js.map +1 -0
  347. package/dist/view/normalize/tokenizer.d.ts +5 -0
  348. package/dist/view/normalize/tokenizer.js +233 -0
  349. package/dist/view/normalize/tokenizer.js.map +1 -0
  350. package/dist/view/normalize/tokens.d.ts +55 -0
  351. package/dist/view/normalize/tokens.js +24 -0
  352. package/dist/view/normalize/tokens.js.map +1 -0
  353. package/dist/view/normalize/tree.d.ts +65 -0
  354. package/dist/view/normalize/tree.js +235 -0
  355. package/dist/view/normalize/tree.js.map +1 -0
  356. package/dist/view/normalize/types.d.ts +146 -0
  357. package/dist/view/normalize/types.js +29 -0
  358. package/dist/view/normalize/types.js.map +1 -0
  359. package/dist/view/normalize/whitespace.d.ts +2 -0
  360. package/dist/{template-whitespace.js → view/normalize/whitespace.js} +27 -36
  361. package/dist/view/normalize/whitespace.js.map +1 -0
  362. package/dist/view/prepare-stub.d.ts +3 -0
  363. package/dist/view/prepare-stub.js +7 -0
  364. package/dist/view/prepare-stub.js.map +1 -0
  365. package/dist/view/prepare.d.ts +11 -0
  366. package/dist/view/prepare.js +63 -0
  367. package/dist/view/prepare.js.map +1 -0
  368. package/dist/view/registry.d.ts +78 -0
  369. package/dist/view/registry.js +27 -0
  370. package/dist/view/registry.js.map +1 -0
  371. package/dist/view/render/adopt-attr.d.ts +14 -0
  372. package/dist/view/render/adopt-attr.js +83 -0
  373. package/dist/view/render/adopt-attr.js.map +1 -0
  374. package/dist/view/render/adopt-plan.d.ts +10 -0
  375. package/dist/view/render/adopt-plan.js +26 -0
  376. package/dist/view/render/adopt-plan.js.map +1 -0
  377. package/dist/view/render/adopt.d.ts +3 -0
  378. package/dist/view/render/adopt.js +286 -0
  379. package/dist/view/render/adopt.js.map +1 -0
  380. package/dist/view/render/attr-parts.d.ts +72 -0
  381. package/dist/view/render/attr-parts.js +262 -0
  382. package/dist/view/render/attr-parts.js.map +1 -0
  383. package/dist/view/render/child-part.d.ts +51 -0
  384. package/dist/view/render/child-part.js +173 -0
  385. package/dist/view/render/child-part.js.map +1 -0
  386. package/dist/view/render/dev-check.d.ts +12 -0
  387. package/dist/view/render/dev-check.js +122 -0
  388. package/dist/view/render/dev-check.js.map +1 -0
  389. package/dist/view/render/dispose.d.ts +3 -0
  390. package/dist/view/render/dispose.js +76 -0
  391. package/dist/view/render/dispose.js.map +1 -0
  392. package/dist/view/render/hook-part.d.ts +5 -0
  393. package/dist/view/render/hook-part.js +36 -0
  394. package/dist/view/render/hook-part.js.map +1 -0
  395. package/dist/view/render/hook-run.d.ts +2 -0
  396. package/dist/view/render/hook-run.js +72 -0
  397. package/dist/view/render/hook-run.js.map +1 -0
  398. package/dist/view/render/hooks.d.ts +108 -0
  399. package/dist/view/render/hooks.js +108 -0
  400. package/dist/view/render/hooks.js.map +1 -0
  401. package/dist/view/render/hydrate.d.ts +10 -0
  402. package/dist/view/render/hydrate.js +33 -0
  403. package/dist/view/render/hydrate.js.map +1 -0
  404. package/dist/view/render/instance.d.ts +33 -0
  405. package/dist/view/render/instance.js +107 -0
  406. package/dist/view/render/instance.js.map +1 -0
  407. package/dist/view/render/keyed.d.ts +6 -0
  408. package/dist/view/render/keyed.js +15 -0
  409. package/dist/view/render/keyed.js.map +1 -0
  410. package/dist/view/render/list.d.ts +20 -0
  411. package/dist/view/render/list.js +156 -0
  412. package/dist/view/render/list.js.map +1 -0
  413. package/dist/view/render/mismatch.d.ts +10 -0
  414. package/dist/view/render/mismatch.js +55 -0
  415. package/dist/view/render/mismatch.js.map +1 -0
  416. package/dist/view/render/modal.d.ts +3 -0
  417. package/dist/view/render/modal.js +39 -0
  418. package/dist/view/render/modal.js.map +1 -0
  419. package/dist/view/render/nodes.d.ts +10 -0
  420. package/dist/view/render/nodes.js +37 -0
  421. package/dist/view/render/nodes.js.map +1 -0
  422. package/dist/view/render/place.d.ts +18 -0
  423. package/dist/view/render/place.js +69 -0
  424. package/dist/view/render/place.js.map +1 -0
  425. package/dist/view/render/plan.d.ts +26 -0
  426. package/dist/view/render/plan.js +124 -0
  427. package/dist/view/render/plan.js.map +1 -0
  428. package/dist/view/render/raw.d.ts +21 -0
  429. package/dist/view/render/raw.js +72 -0
  430. package/dist/view/render/raw.js.map +1 -0
  431. package/dist/view/render/render.d.ts +15 -0
  432. package/dist/view/render/render.js +65 -0
  433. package/dist/view/render/render.js.map +1 -0
  434. package/dist/view/render/reorder.d.ts +4 -0
  435. package/dist/view/render/reorder.js +101 -0
  436. package/dist/view/render/reorder.js.map +1 -0
  437. package/dist/view/render/rows.d.ts +23 -0
  438. package/dist/view/render/rows.js +95 -0
  439. package/dist/view/render/rows.js.map +1 -0
  440. package/dist/view/render/seen.d.ts +11 -0
  441. package/dist/view/render/seen.js +17 -0
  442. package/dist/view/render/seen.js.map +1 -0
  443. package/dist/view/render/toggles.d.ts +6 -0
  444. package/dist/view/render/toggles.js +6 -0
  445. package/dist/view/render/toggles.js.map +1 -0
  446. package/dist/view/render/values.d.ts +29 -0
  447. package/dist/view/render/values.js +13 -0
  448. package/dist/view/render/values.js.map +1 -0
  449. package/dist/view/render/warn.d.ts +28 -0
  450. package/dist/view/render/warn.js +114 -0
  451. package/dist/view/render/warn.js.map +1 -0
  452. package/dist/view/server/component.d.ts +12 -0
  453. package/dist/view/server/component.js +64 -0
  454. package/dist/view/server/component.js.map +1 -0
  455. package/dist/view/server/escape.d.ts +10 -0
  456. package/dist/view/server/escape.js +34 -0
  457. package/dist/view/server/escape.js.map +1 -0
  458. package/dist/view/server/index.d.ts +48 -0
  459. package/dist/view/server/index.js +80 -0
  460. package/dist/view/server/index.js.map +1 -0
  461. package/dist/view/server/sha256.d.ts +2 -0
  462. package/dist/view/server/sha256.js +75 -0
  463. package/dist/view/server/sha256.js.map +1 -0
  464. package/dist/view/server/tags.d.ts +68 -0
  465. package/dist/view/server/tags.js +132 -0
  466. package/dist/view/server/tags.js.map +1 -0
  467. package/dist/view/server/values.d.ts +18 -0
  468. package/dist/view/server/values.js +94 -0
  469. package/dist/view/server/values.js.map +1 -0
  470. package/dist/view/server/writer.d.ts +21 -0
  471. package/dist/view/server/writer.js +170 -0
  472. package/dist/view/server/writer.js.map +1 -0
  473. package/dist/view/styles.d.ts +25 -0
  474. package/dist/view/styles.js +58 -0
  475. package/dist/view/styles.js.map +1 -0
  476. package/dist/view/template-element.d.ts +10 -0
  477. package/dist/view/template-element.js +45 -0
  478. package/dist/view/template-element.js.map +1 -0
  479. package/dist/view/template.d.ts +29 -0
  480. package/dist/view/template.js +84 -0
  481. package/dist/view/template.js.map +1 -0
  482. package/dist/view/trusted-html.d.ts +6 -0
  483. package/dist/view/trusted-html.js +34 -0
  484. package/dist/view/trusted-html.js.map +1 -0
  485. package/dist/vite.d.ts +57 -11
  486. package/dist/vite.js +319 -27
  487. package/dist/vite.js.map +1 -1
  488. package/package.json +70 -4
  489. package/dist/accessible-name.d.ts +0 -19
  490. package/dist/accessible-name.js +0 -56
  491. package/dist/accessible-name.js.map +0 -1
  492. package/dist/element-directive.d.ts +0 -20
  493. package/dist/element-directive.js +0 -31
  494. package/dist/element-directive.js.map +0 -1
  495. package/dist/invalid.d.ts +0 -21
  496. package/dist/invalid.js +0 -70
  497. package/dist/invalid.js.map +0 -1
  498. package/dist/lit-html-check.d.ts +0 -6
  499. package/dist/lit-html-check.js +0 -48
  500. package/dist/lit-html-check.js.map +0 -1
  501. package/dist/live-boolean.d.ts +0 -22
  502. package/dist/live-boolean.js +0 -34
  503. package/dist/live-boolean.js.map +0 -1
  504. package/dist/random.d.ts +0 -13
  505. package/dist/random.js +0 -19
  506. package/dist/random.js.map +0 -1
  507. package/dist/styles.d.ts +0 -12
  508. package/dist/styles.js +0 -11
  509. package/dist/styles.js.map +0 -1
  510. package/dist/template-whitespace.d.ts +0 -7
  511. package/dist/template-whitespace.js.map +0 -1
  512. package/dist/templates.d.ts +0 -5
  513. package/dist/templates.js +0 -15
  514. package/dist/templates.js.map +0 -1
  515. package/dist/textarea.d.ts +0 -26
  516. package/dist/textarea.js +0 -85
  517. package/dist/textarea.js.map +0 -1
package/dist/vite.js CHANGED
@@ -1,37 +1,329 @@
1
- // Vite / Vitest settings every Gyral app needs (gyral-a7r, docs/references/consumer-setup.md).
2
- // Plain data, no imports: safe to load from vite.config.ts and vitest.config.ts.
3
- /** Every Lit package: resolve exactly one copy, even when Gyral is linked from elsewhere. */
4
- export const LIT_PACKAGES = [
5
- 'lit',
6
- 'lit-html',
7
- 'lit-element',
8
- '@lit/reactive-element',
9
- '@lit-labs/ssr',
10
- '@lit-labs/ssr-client',
11
- ];
12
- /**
13
- * Lit modules that Gyral imports or re-exports. Pre-bundling them up front stops Vite from
14
- * discovering them mid-run, which reloads the page and fails the first browser test run.
15
- */
16
- export const LIT_PREBUNDLE = [
17
- 'lit',
18
- 'lit/directive.js',
19
- 'lit/static-html.js',
20
- 'lit/directives/class-map.js',
21
- 'lit/directives/keyed.js',
22
- 'lit/directives/live.js',
23
- 'lit/directives/repeat.js',
24
- 'lit/directives/style-map.js',
25
- ];
1
+ // Vite / Vitest settings every Gyral app needs (gyral-a7r, docs/references/consumer-setup.md):
2
+ // the template compiler (view/01-templates.md "Compiled") and, in serve mode, development
3
+ // output from the dev server's SSR (view/06-server.md "Development markers"). Only Node
4
+ // built-ins are imported up front, so it loads from vite.config.ts and vitest.config.ts in any
5
+ // way: bundled with the config, by Node from source (type stripping), or by a Vite module
6
+ // runner. The compiler is a plugin applied in `vite build` only, so dev servers and test runs
7
+ // keep the runtime template path; its implementation (./compiler/) loads on the first build
8
+ // hook, with `require` (Node loads ES modules with it too): a module runner that loaded this
9
+ // file may be closed by then, and would reject a dynamic import(). Public: the preset,
10
+ // gyralTemplateCompiler and gyralClientOnly (docs/references/public-api-0.3.1.md); the other
11
+ // plugins and constants here are internal.
12
+ import { readFileSync } from 'node:fs';
13
+ import { createRequire } from 'node:module';
14
+ import { dirname, join, resolve } from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
16
+ /** Where the view layer's `html` comes from: core's main entry (ADR 0018, Phase 3). */
17
+ const DEFAULT_TEMPLATE_SOURCES = ['@gyral/core'];
18
+ /** The resolve condition that maps core's `#prepare` to its stub (ADR 0017's mechanism). */
19
+ const COMPILED_CONDITION = 'gyral-compiled';
20
+ /** The client's resolve condition in client-only builds (view/07 "Client-only builds"). */
21
+ const CLIENT_ONLY_CONDITION = 'gyral-client-only';
22
+ /** Vite 8's default resolve conditions (`defaultClientConditions`, server ones without browser). */
23
+ const CLIENT_CONDITIONS = ['module', 'browser', 'development|production'];
24
+ const SERVER_CONDITIONS = ['module', 'node', 'development|production'];
25
+ /**
26
+ * Adds `condition` (default `gyral-compiled`) to an environment, on top of the app's
27
+ * conditions or Vite's defaults: Vite replaces the defaults when a config names any condition.
28
+ * `clientOnly`: only to environments that build for the browser.
29
+ */
30
+ function addCondition(name, config, env, condition = COMPILED_CONDITION, clientOnly = false) {
31
+ const consumer = config.consumer ?? (name === 'client' ? 'client' : 'server');
32
+ const client = consumer === 'client' || env.isSsrTargetWebworker === true;
33
+ if (clientOnly && consumer !== 'client')
34
+ return;
35
+ const current = config.resolve?.conditions ?? (client ? CLIENT_CONDITIONS : SERVER_CONDITIONS);
36
+ if (!current.includes(condition)) {
37
+ config.resolve = { ...config.resolve, conditions: [...current, condition] };
38
+ }
39
+ }
40
+ /** The compiled entry of this copy of core, next to this module. */
41
+ const OWN_COMPILED = fileURLToPath(new URL(import.meta.url.endsWith('.ts') ? './view/compiled.ts' : './view/compiled.js', import.meta.url));
42
+ /** The settings both plugins pass to their lazily loaded implementation. */
43
+ function settingsOf(options) {
44
+ return {
45
+ sources: options.sources ?? DEFAULT_TEMPLATE_SOURCES,
46
+ parse5: options.parse5 === false
47
+ ? undefined
48
+ : typeof options.parse5 === 'string'
49
+ ? options.parse5
50
+ : 'parse5',
51
+ };
52
+ }
53
+ /**
54
+ * A module of ./compiler/. From core's TypeScript source (this workspace, `link:` checkouts) it
55
+ * loads through Vite's module runner, as a vite.config.ts would; from the published package,
56
+ * with require.
57
+ */
58
+ async function loadCompiler(name) {
59
+ const require = createRequire(import.meta.url);
60
+ if (!import.meta.url.endsWith('.ts'))
61
+ return require(`./compiler/${name}.js`);
62
+ const { runnerImport } = require('vite');
63
+ const nodeEnv = process.env['NODE_ENV']; // the runner sets it when unset; the build owns it
64
+ const { module } = await runnerImport(fileURLToPath(new URL(`./compiler/${name}.ts`, import.meta.url)), { configFile: false, logLevel: 'silent' });
65
+ if (nodeEnv === undefined)
66
+ delete process.env['NODE_ENV'];
67
+ else
68
+ process.env['NODE_ENV'] = nodeEnv;
69
+ return module;
70
+ }
71
+ /** The compiler's hooks (`vite build`). */
72
+ async function loadHooks(options) {
73
+ const hooks = await loadCompiler('hooks');
74
+ return hooks.createCompiler({ ...settingsOf(options), ownEntry: OWN_COMPILED });
75
+ }
76
+ /** The template compiler alone (`gyralVitePreset()` includes it). */
77
+ function gyralTemplateCompiler(options = {}) {
78
+ let hooks;
79
+ const ready = () => {
80
+ if (hooks === undefined)
81
+ throw new Error('gyral: the template compiler is not loaded yet');
82
+ return hooks;
83
+ };
84
+ return {
85
+ name: 'gyral:template-compiler',
86
+ enforce: 'pre',
87
+ apply: 'build',
88
+ configEnvironment: addCondition,
89
+ async configResolved(config) {
90
+ hooks = await loadHooks(options);
91
+ await hooks.configResolved.call(this, config);
92
+ },
93
+ buildStart(input) {
94
+ return ready().buildStart.call(this, input);
95
+ },
96
+ // The registration modules of spec-field features (./compiler/features.ts).
97
+ resolveId(source, importer, opts) {
98
+ return ready().resolveId.call(this, source, importer, opts);
99
+ },
100
+ load(id, opts) {
101
+ return ready().load.call(this, id, opts);
102
+ },
103
+ transform: {
104
+ // Modules naming a template tag (html or svg; core's template module names both), or a
105
+ // spec field whose machinery the build adds only when named (view/05).
106
+ filter: {
107
+ id: /\.[cm]?[jt]sx?$/,
108
+ code: /html|svg|viewTransition|renderOnFrame|states|formAssociated|subscriptions|\.value\s*\(/,
109
+ },
110
+ handler(code, id, opts) {
111
+ return ready().transform.call(this, code, id, opts);
112
+ },
113
+ },
114
+ generateBundle(output, bundle, isWrite) {
115
+ return ready().generateBundle.call(this, output, bundle, isWrite);
116
+ },
117
+ };
118
+ }
119
+ /**
120
+ * Development source locations (view/01-templates.md "Source locations"): in `vite serve` (the
121
+ * dev server, Vitest) each html`…` and svg`…` call site of the template sources tells the
122
+ * runtime where it was written, so template rule errors and hydration mismatches name
123
+ * `file:line:col` (./compiler/locate.ts, loaded on the first hook). `vite build` compiles
124
+ * templates instead.
125
+ */
126
+ function gyralTemplateLocations(options = {}) {
127
+ let hooks;
128
+ const ready = () => {
129
+ if (hooks === undefined)
130
+ throw new Error('gyral: the template locator is not loaded yet');
131
+ return hooks;
132
+ };
133
+ return {
134
+ name: 'gyral:template-locations',
135
+ enforce: 'pre',
136
+ apply: 'serve',
137
+ async configResolved(config) {
138
+ const locate = await loadCompiler('locate');
139
+ hooks = locate.createLocator(settingsOf(options).sources);
140
+ await hooks.configResolved.call(this, config);
141
+ },
142
+ transform: {
143
+ // Modules naming a template tag (html or svg), as the compiler's filter.
144
+ filter: { id: /\.[cm]?[jt]sx?$/, code: /html|svg/ },
145
+ handler(code, id, opts) {
146
+ return ready().transform.call(this, code, id, opts);
147
+ },
148
+ },
149
+ };
150
+ }
151
+ /**
152
+ * Gyral's packages: the dev server runs them through Vite, never Node (view/06). The feature
153
+ * scan's scope (./compiler/scope.ts) uses the same pattern.
154
+ */
155
+ const GYRAL_PACKAGES = /^@gyral\//;
156
+ function manifest(file) {
157
+ try {
158
+ return JSON.parse(readFileSync(file, 'utf8'));
159
+ }
160
+ catch {
161
+ return undefined;
162
+ }
163
+ }
164
+ /** The installed manifest of `name`, looked up from `root` the way Node does (no exports map). */
165
+ function installed(root, name) {
166
+ for (let dir = root;; dir = dirname(dir)) {
167
+ const found = manifest(join(dir, 'node_modules', name, 'package.json'));
168
+ if (found !== undefined || dirname(dir) === dir)
169
+ return found;
170
+ }
171
+ }
172
+ /**
173
+ * The app's direct dependencies that depend on a Gyral package (a design system, say). They
174
+ * import `@gyral/core`, so they must share the copy the dev server runs.
175
+ */
176
+ function gyralDependents(root) {
177
+ const app = manifest(join(root, 'package.json'));
178
+ const names = Object.keys({ ...app?.dependencies, ...app?.devDependencies });
179
+ return names.filter((name) => {
180
+ if (GYRAL_PACKAGES.test(name))
181
+ return false;
182
+ const dep = installed(root, name);
183
+ return Object.keys({ ...dep?.dependencies, ...dep?.peerDependencies }).some((d) => GYRAL_PACKAGES.test(d));
184
+ });
185
+ }
186
+ /**
187
+ * Development output from the dev server's SSR (`ssrLoadModule`, view/06 "Development
188
+ * markers"). Vite externalizes installed packages there and Node imports them itself, resolving
189
+ * core's `#view-dev` without the `development` condition (Vite's `externalConditions` only pick
190
+ * the entry file, not the package's own imports), so the server rendered production output.
191
+ * In serve mode this plugin keeps Gyral's packages, and the app's dependencies that use them,
192
+ * out of externalization in server environments: Vite resolves them with its conditions
193
+ * (`development` in dev), and they all share one copy of core. `vite build` is unaffected.
194
+ */
195
+ function gyralDevSsr() {
196
+ let root = process.cwd();
197
+ return {
198
+ name: 'gyral:dev-server',
199
+ apply: 'serve',
200
+ config(config) {
201
+ root = resolve(config.root ?? process.cwd());
202
+ },
203
+ configEnvironment(name, config) {
204
+ const consumer = config.consumer ?? (name === 'client' ? 'client' : 'server');
205
+ if (consumer === 'client')
206
+ return undefined;
207
+ return { resolve: { noExternal: [GYRAL_PACKAGES, ...gyralDependents(root)] } };
208
+ },
209
+ };
210
+ }
211
+ /**
212
+ * Client-only builds (view/07-hydration.md "Client-only builds", gyral-c5d.11), for apps no
213
+ * server renders: the browser environment resolves core with the `gyral-client-only`
214
+ * condition, so the bundle carries no hydration code (no seed reading, no hydration chunk and
215
+ * its import()), and in `vite build` the invoker-command fallback only when a module that can
216
+ * affect Gyral components (the app's own, or a package that reaches a Gyral package) may use
217
+ * command intents (./compiler/features.ts). With no other import(), Vite's preload helper goes
218
+ * too. Server-rendered markup met anyway renders fresh (development warns). Dev servers and
219
+ * test runs get the condition too, and always keep the invoker fallback.
220
+ */
221
+ function gyralClientOnly() {
222
+ let hooks;
223
+ let root = process.cwd();
224
+ return {
225
+ name: 'gyral:client-only',
226
+ enforce: 'pre',
227
+ configEnvironment(name, config, env) {
228
+ addCondition(name, config, env, CLIENT_ONLY_CONDITION, true);
229
+ },
230
+ async configResolved(config) {
231
+ root = config.root;
232
+ if (config.command !== 'build')
233
+ return;
234
+ const features = await loadCompiler('features');
235
+ hooks = features.createFeatures(['invokers'], OWN_COMPILED);
236
+ },
237
+ async buildStart() {
238
+ await hooks?.buildStart((source, importer) => this.resolve(source, importer), root);
239
+ },
240
+ resolveId(source) {
241
+ return hooks?.resolveId(source) ?? null;
242
+ },
243
+ load(id) {
244
+ return hooks?.load(id) ?? null;
245
+ },
246
+ transform: {
247
+ // features.ts FEATURE_HINTS.invokers: any import or export may reach `raw`.
248
+ filter: { id: /\.[cm]?[jt]sx?$/, code: /data-intent-on|command|raw|import|export/i },
249
+ async handler(code, id) {
250
+ if (hooks === undefined || this.environment.config.consumer !== 'client')
251
+ return null;
252
+ const imports = await hooks.inject(code, id, {
253
+ parse: (text, lang) => this.parse(text, { lang }),
254
+ resolve: (source, importer) => this.resolve(source, importer),
255
+ });
256
+ // Appended after the last line: no code moves, so the incoming source map holds.
257
+ return imports === '' ? null : { code: code + imports, map: null };
258
+ },
259
+ },
260
+ };
261
+ }
262
+ /**
263
+ * Writes `HTMLElementTagNameMap` entries for every exported `define()` component (a
264
+ * `.gyral/elements.d.ts` to gitignore and include in tsconfig) at the start of a build, dev
265
+ * server or test run, and again when a source file changes. ./compiler/tag-map imports Node
266
+ * built-ins only, so Node's require loads it, from TypeScript source too: no module runner,
267
+ * which may be closed by the time a build starts (see loadCompiler).
268
+ */
269
+ function gyralElementTypes(options) {
270
+ const source = import.meta.url.endsWith('.ts')
271
+ ? './compiler/tag-map.ts'
272
+ : './compiler/tag-map.js';
273
+ const tagMap = createRequire(import.meta.url)(source);
274
+ return tagMap.elementTypesPlugin(options);
275
+ }
26
276
  /**
27
277
  * Spread into a Vite config, or into each Vitest project:
28
278
  *
29
279
  * export default defineConfig({ ...gyralVitePreset(), build: { … } });
280
+ *
281
+ * With plugins of your own, list both: `plugins: [...preset.plugins, mine()]`.
30
282
  */
31
283
  export function gyralVitePreset(options = {}) {
32
284
  return {
33
- resolve: { dedupe: [...LIT_PACKAGES] },
34
- optimizeDeps: { include: [...new Set([...LIT_PREBUNDLE, ...(options.optimize ?? [])])] },
285
+ plugins: [
286
+ // Before the compiler: its feature scan reads the author's templates, not compiled ones.
287
+ ...(options.clientOnly === true ? [gyralClientOnly()] : []),
288
+ gyralTemplateCompiler(options.compiler),
289
+ gyralTemplateLocations(options.compiler),
290
+ gyralDevSsr(),
291
+ ...(options.components === undefined || options.components === false
292
+ ? []
293
+ : [gyralComponents(options.components === true ? {} : options.components)]),
294
+ ...(options.types === false ? [] : [gyralElementTypes(options.types ?? {})]),
295
+ ],
296
+ optimizeDeps: { include: [...new Set(options.optimize ?? [])] },
297
+ };
298
+ }
299
+ /**
300
+ * Automatic component loading (`gyralVitePreset({ components })`): a shell whose hooks run
301
+ * ./compiler/components.ts, loaded on the first hook (`config`) like the compiler.
302
+ */
303
+ function gyralComponents(options) {
304
+ let impl;
305
+ const run = (name) => function (...args) {
306
+ const hook = impl?.[name];
307
+ return hook?.call(this, ...args) ?? null;
308
+ };
309
+ const hook = (name) => run(name);
310
+ return {
311
+ name: 'gyral:components',
312
+ api: {
313
+ tags: () => impl?.api?.tags?.() ??
314
+ new Map(),
315
+ },
316
+ async config(...args) {
317
+ const components = await loadCompiler('components');
318
+ impl = components.createComponents(options);
319
+ return run('config').apply(this, args);
320
+ },
321
+ configResolved: hook('configResolved'),
322
+ buildStart: hook('buildStart'),
323
+ resolveId: hook('resolveId'),
324
+ load: hook('load'),
325
+ configureServer: hook('configureServer'),
326
+ generateBundle: hook('generateBundle'),
35
327
  };
36
328
  }
37
329
  //# sourceMappingURL=vite.js.map
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,iFAAiF;AAEjF,6FAA6F;AAC7F,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,KAAK;IACL,UAAU;IACV,aAAa;IACb,uBAAuB;IACvB,eAAe;IACf,sBAAsB;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,KAAK;IACL,kBAAkB;IAClB,oBAAoB;IACpB,6BAA6B;IAC7B,yBAAyB;IACzB,wBAAwB;IACxB,0BAA0B;IAC1B,6BAA6B;CAC9B,CAAC;AAYF;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,UAA4B,EAAE;IAC5D,OAAO;QACL,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC,EAAE;QACtC,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;KACzF,CAAC;AACJ,CAAC","sourcesContent":["// Vite / Vitest settings every Gyral app needs (gyral-a7r, docs/references/consumer-setup.md).\n// Plain data, no imports: safe to load from vite.config.ts and vitest.config.ts.\n\n/** Every Lit package: resolve exactly one copy, even when Gyral is linked from elsewhere. */\nexport const LIT_PACKAGES: readonly string[] = [\n 'lit',\n 'lit-html',\n 'lit-element',\n '@lit/reactive-element',\n '@lit-labs/ssr',\n '@lit-labs/ssr-client',\n];\n\n/**\n * Lit modules that Gyral imports or re-exports. Pre-bundling them up front stops Vite from\n * discovering them mid-run, which reloads the page and fails the first browser test run.\n */\nexport const LIT_PREBUNDLE: readonly string[] = [\n 'lit',\n 'lit/directive.js',\n 'lit/static-html.js',\n 'lit/directives/class-map.js',\n 'lit/directives/keyed.js',\n 'lit/directives/live.js',\n 'lit/directives/repeat.js',\n 'lit/directives/style-map.js',\n];\n\nexport interface GyralViteOptions {\n /** More modules to pre-bundle (e.g. 'lit/directives/unsafe-html.js'). */\n readonly optimize?: readonly string[];\n}\n\nexport interface GyralViteConfig {\n readonly resolve: { readonly dedupe: string[] };\n readonly optimizeDeps: { readonly include: string[] };\n}\n\n/**\n * Spread into a Vite config, or into each Vitest project:\n *\n * export default defineConfig({ ...gyralVitePreset(), build: { … } });\n */\nexport function gyralVitePreset(options: GyralViteOptions = {}): GyralViteConfig {\n return {\n resolve: { dedupe: [...LIT_PACKAGES] },\n optimizeDeps: { include: [...new Set([...LIT_PREBUNDLE, ...(options.optimize ?? [])])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BAAkB;QACxB,GAAG,EAAE;YACH,IAAI,EAAE,GAAgC,EAAE,CACrC,IAAI,EAAE,GAAgE,EAAE,IAAI,EAAE,EAAE;gBACjF,IAAI,GAAG,EAAE;SACZ;QACD,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;YAClB,MAAM,UAAU,GACd,MAAM,YAAY,CAA4C,YAAY,CAAC,CAAC;YAC9E,IAAI,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC5C,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAc,CAAC;QACtD,CAAC;QACD,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC;QACtC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC;QAC9B,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC;QAC5B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,eAAe,EAAE,IAAI,CAAC,iBAAiB,CAAC;QACxC,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC;KACvC,CAAC;AACJ,CAAC","sourcesContent":["// Vite / Vitest settings every Gyral app needs (gyral-a7r, docs/references/consumer-setup.md):\n// the template compiler (view/01-templates.md \"Compiled\") and, in serve mode, development\n// output from the dev server's SSR (view/06-server.md \"Development markers\"). Only Node\n// built-ins are imported up front, so it loads from vite.config.ts and vitest.config.ts in any\n// way: bundled with the config, by Node from source (type stripping), or by a Vite module\n// runner. The compiler is a plugin applied in `vite build` only, so dev servers and test runs\n// keep the runtime template path; its implementation (./compiler/) loads on the first build\n// hook, with `require` (Node loads ES modules with it too): a module runner that loaded this\n// file may be closed by then, and would reject a dynamic import(). Public: the preset,\n// gyralTemplateCompiler and gyralClientOnly (docs/references/public-api-0.3.1.md); the other\n// plugins and constants here are internal.\nimport { readFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { ConfigEnv, EnvironmentOptions, Plugin } from 'vite';\nimport type { FeatureHooks } from './compiler/features.js';\nimport type { CompilerHooks } from './compiler/hooks.js';\nimport type { LocatorHooks } from './compiler/locate.js';\n\nexport interface TemplateCompilerOptions {\n /**\n * Module specifiers whose `html` (and `svg`) exports are the view layer's tags (default\n * `DEFAULT_TEMPLATE_SOURCES`). An import matches when its specifier is listed, or when it\n * resolves to the same module as a listed one; core's own view modules always match. A\n * source other than '@gyral/core' must also export `compiled` (and `compiledSvg` when it\n * exports `svg`).\n */\n readonly sources?: readonly string[];\n /**\n * Rule 7's extra check with parse5 (an optional peer dependency): `true` (default) uses\n * 'parse5' when it is installed, a string names the module to load, `false` skips it.\n */\n readonly parse5?: boolean | string;\n}\n\n/** Where the view layer's `html` comes from: core's main entry (ADR 0018, Phase 3). */\nconst DEFAULT_TEMPLATE_SOURCES: readonly string[] = ['@gyral/core'];\n\n/** The resolve condition that maps core's `#prepare` to its stub (ADR 0017's mechanism). */\nconst COMPILED_CONDITION = 'gyral-compiled';\n/** The client's resolve condition in client-only builds (view/07 \"Client-only builds\"). */\nconst CLIENT_ONLY_CONDITION = 'gyral-client-only';\n/** Vite 8's default resolve conditions (`defaultClientConditions`, server ones without browser). */\nconst CLIENT_CONDITIONS: readonly string[] = ['module', 'browser', 'development|production'];\nconst SERVER_CONDITIONS: readonly string[] = ['module', 'node', 'development|production'];\n\n/**\n * Adds `condition` (default `gyral-compiled`) to an environment, on top of the app's\n * conditions or Vite's defaults: Vite replaces the defaults when a config names any condition.\n * `clientOnly`: only to environments that build for the browser.\n */\nfunction addCondition(\n name: string,\n config: EnvironmentOptions,\n env: ConfigEnv & { isSsrTargetWebworker?: boolean },\n condition = COMPILED_CONDITION,\n clientOnly = false,\n): void {\n const consumer = config.consumer ?? (name === 'client' ? 'client' : 'server');\n const client = consumer === 'client' || env.isSsrTargetWebworker === true;\n if (clientOnly && consumer !== 'client') return;\n const current = config.resolve?.conditions ?? (client ? CLIENT_CONDITIONS : SERVER_CONDITIONS);\n if (!current.includes(condition)) {\n config.resolve = { ...config.resolve, conditions: [...current, condition] };\n }\n}\n\n/** The compiled entry of this copy of core, next to this module. */\nconst OWN_COMPILED = fileURLToPath(\n new URL(\n import.meta.url.endsWith('.ts') ? './view/compiled.ts' : './view/compiled.js',\n import.meta.url,\n ),\n);\n\n/** The settings both plugins pass to their lazily loaded implementation. */\nfunction settingsOf(options: TemplateCompilerOptions) {\n return {\n sources: options.sources ?? DEFAULT_TEMPLATE_SOURCES,\n parse5:\n options.parse5 === false\n ? undefined\n : typeof options.parse5 === 'string'\n ? options.parse5\n : 'parse5',\n };\n}\n\n/**\n * A module of ./compiler/. From core's TypeScript source (this workspace, `link:` checkouts) it\n * loads through Vite's module runner, as a vite.config.ts would; from the published package,\n * with require.\n */\nasync function loadCompiler<M>(name: string): Promise<M> {\n const require = createRequire(import.meta.url);\n if (!import.meta.url.endsWith('.ts')) return require(`./compiler/${name}.js`) as M;\n const { runnerImport } = require('vite') as typeof import('vite');\n const nodeEnv = process.env['NODE_ENV']; // the runner sets it when unset; the build owns it\n const { module } = await runnerImport<M>(\n fileURLToPath(new URL(`./compiler/${name}.ts`, import.meta.url)),\n { configFile: false, logLevel: 'silent' },\n );\n if (nodeEnv === undefined) delete process.env['NODE_ENV'];\n else process.env['NODE_ENV'] = nodeEnv;\n return module;\n}\n\n/** The compiler's hooks (`vite build`). */\nasync function loadHooks(options: TemplateCompilerOptions): Promise<CompilerHooks> {\n const hooks = await loadCompiler<typeof import('./compiler/hooks.js')>('hooks');\n return hooks.createCompiler({ ...settingsOf(options), ownEntry: OWN_COMPILED });\n}\n\n/** The template compiler alone (`gyralVitePreset()` includes it). */\nfunction gyralTemplateCompiler(options: TemplateCompilerOptions = {}): Plugin {\n let hooks: CompilerHooks | undefined;\n const ready = (): CompilerHooks => {\n if (hooks === undefined) throw new Error('gyral: the template compiler is not loaded yet');\n return hooks;\n };\n return {\n name: 'gyral:template-compiler',\n enforce: 'pre',\n apply: 'build',\n configEnvironment: addCondition,\n async configResolved(config) {\n hooks = await loadHooks(options);\n await hooks.configResolved.call(this, config);\n },\n buildStart(input) {\n return ready().buildStart.call(this, input);\n },\n // The registration modules of spec-field features (./compiler/features.ts).\n resolveId(source, importer, opts) {\n return ready().resolveId.call(this, source, importer, opts);\n },\n load(id, opts) {\n return ready().load.call(this, id, opts);\n },\n transform: {\n // Modules naming a template tag (html or svg; core's template module names both), or a\n // spec field whose machinery the build adds only when named (view/05).\n filter: {\n id: /\\.[cm]?[jt]sx?$/,\n code: /html|svg|viewTransition|renderOnFrame|states|formAssociated|subscriptions|\\.value\\s*\\(/,\n },\n handler(code, id, opts) {\n return ready().transform.call(this, code, id, opts);\n },\n },\n generateBundle(output, bundle, isWrite) {\n return ready().generateBundle.call(this, output, bundle, isWrite);\n },\n };\n}\n\n/**\n * Development source locations (view/01-templates.md \"Source locations\"): in `vite serve` (the\n * dev server, Vitest) each html`…` and svg`…` call site of the template sources tells the\n * runtime where it was written, so template rule errors and hydration mismatches name\n * `file:line:col` (./compiler/locate.ts, loaded on the first hook). `vite build` compiles\n * templates instead.\n */\nfunction gyralTemplateLocations(options: TemplateCompilerOptions = {}): Plugin {\n let hooks: LocatorHooks | undefined;\n const ready = (): LocatorHooks => {\n if (hooks === undefined) throw new Error('gyral: the template locator is not loaded yet');\n return hooks;\n };\n return {\n name: 'gyral:template-locations',\n enforce: 'pre',\n apply: 'serve',\n async configResolved(config) {\n const locate = await loadCompiler<typeof import('./compiler/locate.js')>('locate');\n hooks = locate.createLocator(settingsOf(options).sources);\n await hooks.configResolved.call(this, config);\n },\n transform: {\n // Modules naming a template tag (html or svg), as the compiler's filter.\n filter: { id: /\\.[cm]?[jt]sx?$/, code: /html|svg/ },\n handler(code, id, opts) {\n return ready().transform.call(this, code, id, opts);\n },\n },\n };\n}\n\n/**\n * Gyral's packages: the dev server runs them through Vite, never Node (view/06). The feature\n * scan's scope (./compiler/scope.ts) uses the same pattern.\n */\nconst GYRAL_PACKAGES = /^@gyral\\//;\n\ntype Manifest = Partial<Record<'dependencies' | 'devDependencies' | 'peerDependencies', object>>;\n\nfunction manifest(file: string): Manifest | undefined {\n try {\n return JSON.parse(readFileSync(file, 'utf8')) as Manifest;\n } catch {\n return undefined;\n }\n}\n\n/** The installed manifest of `name`, looked up from `root` the way Node does (no exports map). */\nfunction installed(root: string, name: string): Manifest | undefined {\n for (let dir = root; ; dir = dirname(dir)) {\n const found = manifest(join(dir, 'node_modules', name, 'package.json'));\n if (found !== undefined || dirname(dir) === dir) return found;\n }\n}\n\n/**\n * The app's direct dependencies that depend on a Gyral package (a design system, say). They\n * import `@gyral/core`, so they must share the copy the dev server runs.\n */\nfunction gyralDependents(root: string): string[] {\n const app = manifest(join(root, 'package.json'));\n const names = Object.keys({ ...app?.dependencies, ...app?.devDependencies });\n return names.filter((name) => {\n if (GYRAL_PACKAGES.test(name)) return false;\n const dep = installed(root, name);\n return Object.keys({ ...dep?.dependencies, ...dep?.peerDependencies }).some((d) =>\n GYRAL_PACKAGES.test(d),\n );\n });\n}\n\n/**\n * Development output from the dev server's SSR (`ssrLoadModule`, view/06 \"Development\n * markers\"). Vite externalizes installed packages there and Node imports them itself, resolving\n * core's `#view-dev` without the `development` condition (Vite's `externalConditions` only pick\n * the entry file, not the package's own imports), so the server rendered production output.\n * In serve mode this plugin keeps Gyral's packages, and the app's dependencies that use them,\n * out of externalization in server environments: Vite resolves them with its conditions\n * (`development` in dev), and they all share one copy of core. `vite build` is unaffected.\n */\nfunction gyralDevSsr(): Plugin {\n let root = process.cwd();\n return {\n name: 'gyral:dev-server',\n apply: 'serve',\n config(config) {\n root = resolve(config.root ?? process.cwd());\n },\n configEnvironment(name, config) {\n const consumer = config.consumer ?? (name === 'client' ? 'client' : 'server');\n if (consumer === 'client') return undefined;\n return { resolve: { noExternal: [GYRAL_PACKAGES, ...gyralDependents(root)] } };\n },\n };\n}\n\n/**\n * Client-only builds (view/07-hydration.md \"Client-only builds\", gyral-c5d.11), for apps no\n * server renders: the browser environment resolves core with the `gyral-client-only`\n * condition, so the bundle carries no hydration code (no seed reading, no hydration chunk and\n * its import()), and in `vite build` the invoker-command fallback only when a module that can\n * affect Gyral components (the app's own, or a package that reaches a Gyral package) may use\n * command intents (./compiler/features.ts). With no other import(), Vite's preload helper goes\n * too. Server-rendered markup met anyway renders fresh (development warns). Dev servers and\n * test runs get the condition too, and always keep the invoker fallback.\n */\nfunction gyralClientOnly(): Plugin {\n let hooks: FeatureHooks | undefined;\n let root = process.cwd();\n return {\n name: 'gyral:client-only',\n enforce: 'pre',\n configEnvironment(name, config, env) {\n addCondition(name, config, env, CLIENT_ONLY_CONDITION, true);\n },\n async configResolved(config) {\n root = config.root;\n if (config.command !== 'build') return;\n const features = await loadCompiler<typeof import('./compiler/features.js')>('features');\n hooks = features.createFeatures(['invokers'], OWN_COMPILED);\n },\n async buildStart() {\n await hooks?.buildStart((source, importer) => this.resolve(source, importer), root);\n },\n resolveId(source) {\n return hooks?.resolveId(source) ?? null;\n },\n load(id) {\n return hooks?.load(id) ?? null;\n },\n transform: {\n // features.ts FEATURE_HINTS.invokers: any import or export may reach `raw`.\n filter: { id: /\\.[cm]?[jt]sx?$/, code: /data-intent-on|command|raw|import|export/i },\n async handler(code, id) {\n if (hooks === undefined || this.environment.config.consumer !== 'client') return null;\n const imports = await hooks.inject(code, id, {\n parse: (text, lang) => this.parse(text, { lang }),\n resolve: (source, importer) => this.resolve(source, importer),\n });\n // Appended after the last line: no code moves, so the incoming source map holds.\n return imports === '' ? null : { code: code + imports, map: null };\n },\n },\n };\n}\n\n/** Where the preset looks for components and writes their typings (gyral-1zd.25). */\nexport interface ElementTypesOptions {\n /** Source directories to scan, relative to the Vite root. Default `['src']`. */\n readonly dirs?: readonly string[];\n /** The declaration file to write, relative to the Vite root. Default `.gyral/elements.d.ts`. */\n readonly out?: string;\n}\n\n/**\n * Writes `HTMLElementTagNameMap` entries for every exported `define()` component (a\n * `.gyral/elements.d.ts` to gitignore and include in tsconfig) at the start of a build, dev\n * server or test run, and again when a source file changes. ./compiler/tag-map imports Node\n * built-ins only, so Node's require loads it, from TypeScript source too: no module runner,\n * which may be closed by the time a build starts (see loadCompiler).\n */\nfunction gyralElementTypes(options: ElementTypesOptions): Plugin {\n const source = import.meta.url.endsWith('.ts')\n ? './compiler/tag-map.ts'\n : './compiler/tag-map.js';\n const tagMap = createRequire(import.meta.url)(source) as typeof import('./compiler/tag-map.js');\n return tagMap.elementTypesPlugin(options);\n}\n\nexport interface GyralViteOptions {\n /**\n * Generated element typings (`.gyral/elements.d.ts`, see `ElementTypesOptions`), or `false`\n * to write none. Default: on, scanning `src`.\n */\n readonly types?: ElementTypesOptions | false;\n /** Modules to pre-bundle in dev, so Vite doesn't discover them mid-run and reload. */\n readonly optimize?: readonly string[];\n /** Template compiler options (`vite build` only). */\n readonly compiler?: TemplateCompilerOptions;\n /**\n * The app is never server-rendered: leave the hydration code out of the browser bundle\n * (`gyralClientOnly()`, view/07-hydration.md \"Client-only builds\"). Default false.\n */\n readonly clientOnly?: boolean;\n /**\n * Automatic component loading (ADR 0016 addendum): every component defined under `include`\n * gets a client module the build splits out, and a loader (`virtual:gyral/components`, added\n * to the client build's input) imports a tag's module once that tag is in the page.\n * `renderPage({ components })` then links exactly the components a page rendered, so pages\n * need no client entry of their own and no side-effect imports. Default off.\n */\n readonly components?: boolean | ComponentsOptions;\n}\n\nexport interface ComponentsOptions {\n /** Directories (relative to Vite's root) whose modules' `define()` tags are found. Default `['src']`. */\n readonly include?: readonly string[];\n /**\n * Tag → module (relative to Vite's root) for components the scan can't find: those defined\n * through a wrapper such as `defineMemberForm({ tag: 'member-form' })`, which calls\n * `define()` itself. Listed entries win over scanned ones.\n */\n readonly modules?: Readonly<Record<string, string>>;\n}\n\nexport interface GyralViteConfig {\n readonly plugins: Plugin[];\n readonly optimizeDeps: { readonly include: string[] };\n}\n\n/**\n * Spread into a Vite config, or into each Vitest project:\n *\n * export default defineConfig({ ...gyralVitePreset(), build: { … } });\n *\n * With plugins of your own, list both: `plugins: [...preset.plugins, mine()]`.\n */\nexport function gyralVitePreset(options: GyralViteOptions = {}): GyralViteConfig {\n return {\n plugins: [\n // Before the compiler: its feature scan reads the author's templates, not compiled ones.\n ...(options.clientOnly === true ? [gyralClientOnly()] : []),\n gyralTemplateCompiler(options.compiler),\n gyralTemplateLocations(options.compiler),\n gyralDevSsr(),\n ...(options.components === undefined || options.components === false\n ? []\n : [gyralComponents(options.components === true ? {} : options.components)]),\n ...(options.types === false ? [] : [gyralElementTypes(options.types ?? {})]),\n ],\n optimizeDeps: { include: [...new Set(options.optimize ?? [])] },\n };\n}\n\ntype Hook = (this: unknown, ...args: unknown[]) => unknown;\n\n/**\n * Automatic component loading (`gyralVitePreset({ components })`): a shell whose hooks run\n * ./compiler/components.ts, loaded on the first hook (`config`) like the compiler.\n */\nfunction gyralComponents(options: ComponentsOptions): Plugin {\n let impl: Plugin | undefined;\n const run = (name: keyof Plugin) =>\n function (this: unknown, ...args: unknown[]): unknown {\n const hook = impl?.[name] as Hook | undefined;\n return hook?.call(this, ...args) ?? null;\n };\n const hook = <K extends keyof Plugin>(name: K) => run(name) as NonNullable<Plugin[K]>;\n return {\n name: 'gyral:components',\n api: {\n tags: (): ReadonlyMap<string, string> =>\n (impl?.api as { tags?: () => ReadonlyMap<string, string> } | undefined)?.tags?.() ??\n new Map(),\n },\n async config(...args) {\n const components =\n await loadCompiler<typeof import('./compiler/components.js')>('components');\n impl = components.createComponents(options);\n return run('config').apply(this, args) as undefined;\n },\n configResolved: hook('configResolved'),\n buildStart: hook('buildStart'),\n resolveId: hook('resolveId'),\n load: hook('load'),\n configureServer: hook('configureServer'),\n generateBundle: hook('generateBundle'),\n };\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gyral/core",
3
- "version": "0.2.0",
4
- "description": "Gyral core: Model-View-Intent web components on Lit and the web platform. Inspired by Cycle.js.",
3
+ "version": "0.3.1",
4
+ "description": "Gyral core: Model-View-Intent web components on the web platform, with their own view layer.",
5
5
  "license": "MIT",
6
6
  "author": "Mike Zupper",
7
7
  "homepage": "https://github.com/gyraljs/gyral/tree/main/packages/core#readme",
@@ -14,21 +14,72 @@
14
14
  "url": "https://github.com/gyraljs/gyral/issues"
15
15
  },
16
16
  "type": "module",
17
+ "bin": {
18
+ "gyral-types": "./dist/cli/gyral-types.js"
19
+ },
17
20
  "sideEffects": false,
18
21
  "exports": {
19
22
  ".": {
20
23
  "types": "./dist/index.d.ts",
21
24
  "default": "./dist/index.js"
22
25
  },
26
+ "./internal/server": {
27
+ "types": "./dist/server.d.ts",
28
+ "default": "./dist/server.js"
29
+ },
30
+ "./internal": {
31
+ "types": "./dist/internal.d.ts",
32
+ "default": "./dist/internal.js"
33
+ },
23
34
  "./vite": {
24
35
  "types": "./dist/vite.d.ts",
25
36
  "default": "./dist/vite.js"
37
+ },
38
+ "./compiled": {
39
+ "types": "./dist/view/compiled.d.ts",
40
+ "default": "./dist/view/compiled.js"
41
+ },
42
+ "./eslint": {
43
+ "types": "./dist/eslint/index.d.ts",
44
+ "default": "./dist/eslint/index.js"
45
+ },
46
+ "./errors.json": "./dist/errors.json",
47
+ "./storage": {
48
+ "types": "./dist/storage.d.ts",
49
+ "default": "./dist/storage.js"
50
+ },
51
+ "./indexeddb": {
52
+ "types": "./dist/indexeddb.d.ts",
53
+ "default": "./dist/indexeddb.js"
26
54
  }
27
55
  },
28
56
  "imports": {
29
57
  "#devtools": {
30
58
  "development": "./dist/devtools.js",
31
59
  "default": "./dist/devtools-off.js"
60
+ },
61
+ "#prepare": {
62
+ "gyral-compiled": "./dist/view/prepare-stub.js",
63
+ "default": "./dist/view/prepare.js"
64
+ },
65
+ "#view-dev": {
66
+ "development": "./dist/view/dev.js",
67
+ "default": "./dist/view/dev-off.js"
68
+ },
69
+ "#hydration-loader": {
70
+ "gyral-client-only": "./dist/hydration-off.js",
71
+ "default": "./dist/hydration-loader.js"
72
+ },
73
+ "#invoker-fallback": {
74
+ "gyral-client-only": {
75
+ "development": "./dist/invoker-fallback.js",
76
+ "default": "./dist/invoker-fallback-used.js"
77
+ },
78
+ "default": "./dist/invoker-fallback.js"
79
+ },
80
+ "#spec-features": {
81
+ "gyral-compiled": "./dist/spec-features-used.js",
82
+ "default": "./dist/spec-features.js"
32
83
  }
33
84
  },
34
85
  "files": [
@@ -42,10 +93,25 @@
42
93
  "@standard-schema/spec": "1.1.0"
43
94
  },
44
95
  "peerDependencies": {
45
- "lit": "^3.3.0"
96
+ "eslint": "^9.0.0 || ^10.0.0",
97
+ "parse5": "^7.0.0 || ^8.0.0",
98
+ "vite": "^8.0.0"
99
+ },
100
+ "peerDependenciesMeta": {
101
+ "eslint": {
102
+ "optional": true
103
+ },
104
+ "parse5": {
105
+ "optional": true
106
+ },
107
+ "vite": {
108
+ "optional": true
109
+ }
46
110
  },
47
111
  "devDependencies": {
48
- "lit": "3.3.3"
112
+ "eslint": "10.12.0",
113
+ "parse5": "8.0.1",
114
+ "vite": "8.3.2"
49
115
  },
50
116
  "scripts": {
51
117
  "build": "node ../../scripts/build-package.mjs"
@@ -1,19 +0,0 @@
1
- import { ElementDirective } from './element-directive.js';
2
- /** The element with `id`, searched from `from`'s own root outward to the document. */
3
- export declare function findInScope(from: Element, id: string): Element | null;
4
- /**
5
- * Names the element after the element with `id`, even outside this component's shadow root:
6
- *
7
- * <form aria-label=${props.label} ${labelledBy('page-title')}>
8
- *
9
- * Uses `ariaLabelledByElements` (ARIA element reflection) where the browser has it, so the name
10
- * stays in sync with the heading. Elsewhere it sets `aria-label` from `fallback`, or from the
11
- * target's text. Element directives don't run on the server, so render a plain `aria-label` too
12
- * (from a `label` prop) for the no-JS page: `aria-labelledby` wins over it once set.
13
- */
14
- declare class LabelledBy extends ElementDirective<[id: string, fallback?: string]> {
15
- #private;
16
- apply(el: Element, [id, fallback]: [id: string, fallback?: string]): void;
17
- }
18
- export declare const labelledBy: (id: string, fallback?: string | undefined) => import("lit/directive.js").DirectiveResult<typeof LabelledBy>;
19
- export {};
@@ -1,56 +0,0 @@
1
- // Accessible names across shadow boundaries (gyral-czi.26). `aria-labelledby="page-title"` inside
2
- // a shadow root can't see an id in the page, so a form or landmark in a component would be
3
- // nameless. `labelledBy(id)` resolves the id outward through the shadow-including ancestors.
4
- import { directive } from 'lit/directive.js';
5
- import { ElementDirective } from './element-directive.js';
6
- /** ARIA element reflection: newly available Baseline, so feature-detected (ADR 0003). */
7
- const reflects = (el) => 'ariaLabelledByElements' in el;
8
- /** The element with `id`, searched from `from`'s own root outward to the document. */
9
- export function findInScope(from, id) {
10
- for (let root = from.getRootNode();;) {
11
- const found = 'getElementById' in root ? root.getElementById(id) : null;
12
- if (found !== null && found !== from)
13
- return found;
14
- if (!(root instanceof ShadowRoot))
15
- return null;
16
- root = root.host.getRootNode();
17
- }
18
- }
19
- /**
20
- * Names the element after the element with `id`, even outside this component's shadow root:
21
- *
22
- * <form aria-label=${props.label} ${labelledBy('page-title')}>
23
- *
24
- * Uses `ariaLabelledByElements` (ARIA element reflection) where the browser has it, so the name
25
- * stays in sync with the heading. Elsewhere it sets `aria-label` from `fallback`, or from the
26
- * target's text. Element directives don't run on the server, so render a plain `aria-label` too
27
- * (from a `label` prop) for the no-JS page: `aria-labelledby` wins over it once set.
28
- */
29
- class LabelledBy extends ElementDirective {
30
- #applied = '';
31
- apply(el, [id, fallback]) {
32
- const key = `${id}\u0000${fallback ?? ''}`;
33
- if (key === this.#applied)
34
- return;
35
- this.#applied = key;
36
- // The labelling element may render after this one (a later sibling); try again once.
37
- if (!this.#name(el, id, fallback)) {
38
- queueMicrotask(() => {
39
- this.#name(el, id, fallback);
40
- });
41
- }
42
- }
43
- #name(el, id, fallback) {
44
- const target = findInScope(el, id);
45
- if (target !== null && reflects(el)) {
46
- el.ariaLabelledByElements = [target];
47
- return true;
48
- }
49
- const text = fallback ?? target?.textContent.trim() ?? '';
50
- if (text !== '')
51
- el.setAttribute('aria-label', text);
52
- return target !== null;
53
- }
54
- }
55
- export const labelledBy = directive(LabelledBy);
56
- //# sourceMappingURL=accessible-name.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accessible-name.js","sourceRoot":"","sources":["../src/accessible-name.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,2FAA2F;AAC3F,6FAA6F;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM1D,yFAAyF;AACzF,MAAM,QAAQ,GAAG,CAAC,EAAW,EAAoB,EAAE,CAAC,wBAAwB,IAAI,EAAE,CAAC;AAEnF,sFAAsF;AACtF,MAAM,UAAU,WAAW,CAAC,IAAa,EAAE,EAAU;IACnD,KAAK,IAAI,IAAI,GAAS,IAAI,CAAC,WAAW,EAAE,IAAK,CAAC;QAC5C,MAAM,KAAK,GAAG,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAE,IAAyB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9F,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACnD,IAAI,CAAC,CAAC,IAAI,YAAY,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/C,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;AACH,CAAC;AAID;;;;;;;;;GASG;AACH,MAAM,UAAW,SAAQ,gBAAiD;IACxE,QAAQ,GAAG,EAAE,CAAC;IAEd,KAAK,CAAC,EAAW,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAkC;QAChE,MAAM,GAAG,GAAG,GAAG,EAAE,SAAS,QAAQ,IAAI,EAAE,EAAE,CAAC;QAC3C,IAAI,GAAG,KAAK,IAAI,CAAC,QAAQ;YAAE,OAAO;QAClC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,qFAAqF;QACrF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC;YAClC,cAAc,CAAC,GAAG,EAAE;gBAClB,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,EAAW,EAAE,EAAU,EAAE,QAA4B;QACzD,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,MAAM,KAAK,IAAI,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACpC,EAAE,CAAC,sBAAsB,GAAG,CAAC,MAAM,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,IAAI,GAAG,QAAQ,IAAI,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;QAC1D,IAAI,IAAI,KAAK,EAAE;YAAE,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACrD,OAAO,MAAM,KAAK,IAAI,CAAC;IACzB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC","sourcesContent":["// Accessible names across shadow boundaries (gyral-czi.26). `aria-labelledby=\"page-title\"` inside\n// a shadow root can't see an id in the page, so a form or landmark in a component would be\n// nameless. `labelledBy(id)` resolves the id outward through the shadow-including ancestors.\nimport { directive } from 'lit/directive.js';\nimport { ElementDirective } from './element-directive.js';\n\ninterface Reflecting extends Element {\n ariaLabelledByElements: readonly Element[] | null;\n}\n\n/** ARIA element reflection: newly available Baseline, so feature-detected (ADR 0003). */\nconst reflects = (el: Element): el is Reflecting => 'ariaLabelledByElements' in el;\n\n/** The element with `id`, searched from `from`'s own root outward to the document. */\nexport function findInScope(from: Element, id: string): Element | null {\n for (let root: Node = from.getRootNode(); ;) {\n const found = 'getElementById' in root ? (root as DocumentOrShadow).getElementById(id) : null;\n if (found !== null && found !== from) return found;\n if (!(root instanceof ShadowRoot)) return null;\n root = root.host.getRootNode();\n }\n}\n\ntype DocumentOrShadow = Document | ShadowRoot;\n\n/**\n * Names the element after the element with `id`, even outside this component's shadow root:\n *\n * <form aria-label=${props.label} ${labelledBy('page-title')}>\n *\n * Uses `ariaLabelledByElements` (ARIA element reflection) where the browser has it, so the name\n * stays in sync with the heading. Elsewhere it sets `aria-label` from `fallback`, or from the\n * target's text. Element directives don't run on the server, so render a plain `aria-label` too\n * (from a `label` prop) for the no-JS page: `aria-labelledby` wins over it once set.\n */\nclass LabelledBy extends ElementDirective<[id: string, fallback?: string]> {\n #applied = '';\n\n apply(el: Element, [id, fallback]: [id: string, fallback?: string]): void {\n const key = `${id}\\u0000${fallback ?? ''}`;\n if (key === this.#applied) return;\n this.#applied = key;\n // The labelling element may render after this one (a later sibling); try again once.\n if (!this.#name(el, id, fallback)) {\n queueMicrotask(() => {\n this.#name(el, id, fallback);\n });\n }\n }\n\n #name(el: Element, id: string, fallback: string | undefined): boolean {\n const target = findInScope(el, id);\n if (target !== null && reflects(el)) {\n el.ariaLabelledByElements = [target];\n return true;\n }\n const text = fallback ?? target?.textContent.trim() ?? '';\n if (text !== '') el.setAttribute('aria-label', text);\n return target !== null;\n }\n}\n\nexport const labelledBy = directive(LabelledBy);\n"]}