@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
@@ -1,26 +1,23 @@
1
- // View Transitions for define() components (ADR 0001 addendum). An ADR 0003 enhancement:
2
- // without the API, or with reduced motion requested, updates render normally.
3
- const supportsViewTransitions = (doc) => 'startViewTransition' in doc;
1
+ // View Transitions for the scheduler (view/04-scheduler.md "View transitions", ADR 0001
2
+ // addendum). An ADR 0003 enhancement: without the API, or with reduced motion requested, the
3
+ // flush runs as normal. Reached through core's `#spec-features` (spec-features.ts): compiled
4
+ // builds bundle it only when a module names `viewTransition` (compiler/features.ts,
5
+ // gyral-c5d.12).
4
6
  const ignore = () => undefined;
5
7
  /** True when a view transition may run now (API present, motion not reduced). */
6
- export function canTransition() {
7
- if (typeof document === 'undefined' || !supportsViewTransitions(document))
8
- return false;
9
- return !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
10
- }
8
+ const canTransition = () => 'startViewTransition' in document && !matchMedia('(prefers-reduced-motion: reduce)').matches;
11
9
  /**
12
- * Runs `update` inside `document.startViewTransition` when allowed, otherwise directly.
13
- * `update` must resolve once the DOM reflects the new state. The returned promise settles when
14
- * `update` has run. A transition skipped by a newer one still runs its update (per spec); its
15
- * rejected `ready` is expected and swallowed.
10
+ * Runs `update` (a whole flush) as a view transition's update callback and returns true, or
11
+ * returns false when no transition may run now (the caller then runs it). A transition skipped
12
+ * by a newer one still runs its update (per spec); its rejected promises are expected and
13
+ * swallowed.
16
14
  */
17
- export function withViewTransition(update) {
18
- if (!canTransition() || !supportsViewTransitions(document))
19
- return update();
20
- return new Promise((resolve, reject) => {
21
- const transition = document.startViewTransition(() => update().then(resolve, reject));
22
- transition.ready.catch(ignore);
23
- transition.finished.catch(ignore);
24
- });
15
+ export function startTransition(update) {
16
+ if (!canTransition())
17
+ return false;
18
+ const transition = document.startViewTransition(update);
19
+ transition.ready.catch(ignore);
20
+ transition.finished.catch(ignore);
21
+ return true;
25
22
  }
26
23
  //# sourceMappingURL=transitions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transitions.js","sourceRoot":"","sources":["../src/transitions.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,8EAA8E;AAW9E,MAAM,uBAAuB,GAAG,CAAC,GAAa,EAA4C,EAAE,CAC1F,qBAAqB,IAAI,GAAG,CAAC;AAE/B,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AAErC,iFAAiF;AACjF,MAAM,UAAU,aAAa;IAC3B,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACxF,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA2B;IAC5D,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC;QAAE,OAAO,MAAM,EAAE,CAAC;IAC5E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,UAAU,GAAG,QAAQ,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QACtF,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// View Transitions for define() components (ADR 0001 addendum). An ADR 0003 enhancement:\n// without the API, or with reduced motion requested, updates render normally.\n\ninterface ViewTransitionLike {\n readonly ready: Promise<unknown>;\n readonly finished: Promise<unknown>;\n}\n\ninterface ViewTransitionDocument {\n startViewTransition(update: () => Promise<void>): ViewTransitionLike;\n}\n\nconst supportsViewTransitions = (doc: Document): doc is Document & ViewTransitionDocument =>\n 'startViewTransition' in doc;\n\nconst ignore = (): void => undefined;\n\n/** True when a view transition may run now (API present, motion not reduced). */\nexport function canTransition(): boolean {\n if (typeof document === 'undefined' || !supportsViewTransitions(document)) return false;\n return !window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\n/**\n * Runs `update` inside `document.startViewTransition` when allowed, otherwise directly.\n * `update` must resolve once the DOM reflects the new state. The returned promise settles when\n * `update` has run. A transition skipped by a newer one still runs its update (per spec); its\n * rejected `ready` is expected and swallowed.\n */\nexport function withViewTransition(update: () => Promise<void>): Promise<void> {\n if (!canTransition() || !supportsViewTransitions(document)) return update();\n return new Promise((resolve, reject) => {\n const transition = document.startViewTransition(() => update().then(resolve, reject));\n transition.ready.catch(ignore);\n transition.finished.catch(ignore);\n });\n}\n"]}
1
+ {"version":3,"file":"transitions.js","sourceRoot":"","sources":["../src/transitions.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,6FAA6F;AAC7F,6FAA6F;AAC7F,oFAAoF;AACpF,iBAAiB;AAWjB,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AAErC,iFAAiF;AACjF,MAAM,aAAa,GAAG,GAAY,EAAE,CAClC,qBAAqB,IAAI,QAAQ,IAAI,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AAE/F;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAkB;IAChD,IAAI,CAAC,aAAa,EAAE;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,UAAU,GAAI,QAA8C,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC/F,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// View Transitions for the scheduler (view/04-scheduler.md \"View transitions\", ADR 0001\n// addendum). An ADR 0003 enhancement: without the API, or with reduced motion requested, the\n// flush runs as normal. Reached through core's `#spec-features` (spec-features.ts): compiled\n// builds bundle it only when a module names `viewTransition` (compiler/features.ts,\n// gyral-c5d.12).\n\ninterface ViewTransitionLike {\n readonly ready: Promise<unknown>;\n readonly finished: Promise<unknown>;\n}\n\ninterface ViewTransitionDocument {\n startViewTransition(update: () => void): ViewTransitionLike;\n}\n\nconst ignore = (): void => undefined;\n\n/** True when a view transition may run now (API present, motion not reduced). */\nconst canTransition = (): boolean =>\n 'startViewTransition' in document && !matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n/**\n * Runs `update` (a whole flush) as a view transition's update callback and returns true, or\n * returns false when no transition may run now (the caller then runs it). A transition skipped\n * by a newer one still runs its update (per spec); its rejected promises are expected and\n * swallowed.\n */\nexport function startTransition(update: () => void): boolean {\n if (!canTransition()) return false;\n const transition = (document as Document & ViewTransitionDocument).startViewTransition(update);\n transition.ready.catch(ignore);\n transition.finished.catch(ignore);\n return true;\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -1,19 +1,21 @@
1
- import type { PropertyDeclaration } from 'lit';
2
- import type { Styles } from './styles.js';
1
+ import type { GyralError } from './errors.js';
2
+ import type { Prop } from './prop.js';
3
+ import type { ChildValue, Styles } from './view/index.js';
3
4
  import type { CommandInfo } from './invokers.js';
4
5
  import type { HydrateStrategy } from './islands.js';
5
- import type { DriverOverrides, Next } from './command.js';
6
+ import type { Command, Next } from './command.js';
6
7
  import type { AnyStore, StoreChanged, StoreRef } from './store.js';
8
+ import type { FormAssociation, FormDisabled, FormReset, FormStateRestore } from './form-associated.js';
7
9
  /** Every message is a tagged object; the tag is also the intent name used in markup. */
8
10
  export interface Tagged {
9
11
  readonly _tag: string;
10
12
  }
11
- /** What the intent layer sees when a `data-intent` element fires its trigger event. */
13
+ /** What the intent layer sees when an element's intent fires. */
12
14
  export interface IntentInput {
13
- /** The `data-intent` value (a message tag). */
15
+ /** The intent's name (a message tag): the `data-intent-<event>` or `data-intent` value. */
14
16
  readonly name: string;
15
17
  readonly event: Event;
16
- /** The element carrying `data-intent`. */
18
+ /** The element carrying the intent attribute (`event.currentTarget` is Gyral's root). */
17
19
  readonly target: Element;
18
20
  /** `value` of the input, select, textarea or button that carries the intent. */
19
21
  readonly value: string | undefined;
@@ -21,7 +23,10 @@ export interface IntentInput {
21
23
  readonly checked: boolean | undefined;
22
24
  /** Submitted data (including the submitter button) when the intent is on a `<form>`. */
23
25
  readonly formData: FormData | undefined;
24
- /** The output a child component emitted, when the intent is on a child element. */
26
+ /**
27
+ * `detail` of any `CustomEvent`: a Gyral child's output, or the event of another custom
28
+ * element (a map's `marker-select`). Unknown until the parser checks it (a guard, a schema).
29
+ */
25
30
  readonly detail: unknown;
26
31
  /** `KeyboardEvent.key` for `keydown`/`keyup` intents. */
27
32
  readonly key: string | undefined;
@@ -39,6 +44,15 @@ export interface Ctx<P> {
39
44
  /** Stores from the side: `read(cart).lines`. The store must be in `spec.stores`. */
40
45
  readonly read: StoreReader;
41
46
  }
47
+ /**
48
+ * What an intent parser gets besides the input: the reducers' context plus the component's
49
+ * current state, read-only. Parsers decide synchronously (`preventDefault()`), and where the
50
+ * user is often decides it: Tab leaves a grid only from its last cell.
51
+ */
52
+ export interface ParserCtx<P, S = unknown> extends Ctx<P> {
53
+ /** The state when the event fires. */
54
+ readonly state: Readonly<S>;
55
+ }
42
56
  /** Framework message: declared props changed after the first render (ADR 0007). */
43
57
  export interface PropsChanged<P> {
44
58
  readonly _tag: 'PropsChanged';
@@ -56,6 +70,17 @@ export interface Hydrated {
56
70
  /** `true` when the instance resumed from server-rendered markup (a hydration seed). */
57
71
  readonly serverRendered: boolean;
58
72
  }
73
+ /**
74
+ * Framework message (ADR 0024): an update, an intent parser or a command of this component
75
+ * failed. The failure was reported (`reportError`, or claimed by an ancestor's boundary) and
76
+ * changed nothing; reduce it to show an error state or to reset. A failure while reducing
77
+ * `Errored` is reported and not sent again.
78
+ */
79
+ export interface Errored {
80
+ readonly _tag: 'Errored';
81
+ readonly phase: 'update' | 'parse' | 'command';
82
+ readonly error: GyralError;
83
+ }
59
84
  /** One validation problem. `path` is dot-joined and matches the field's `name`. */
60
85
  export interface FieldIssue {
61
86
  readonly path: string;
@@ -78,15 +103,40 @@ export interface IntentRejected {
78
103
  type ParseResult<M> = M | IntentRejected | undefined;
79
104
  /**
80
105
  * Parses a platform event into one message variant, `IntentRejected`, or `undefined` to
81
- * ignore it. May be async because schema validation may be.
106
+ * decline it: a synchronous `undefined` passes the event to the next intent outward for the
107
+ * same event (view/05-element.md "Declining"). May be async because schema validation may be;
108
+ * an async parser keeps the event. `ctx` is the read-only context reducers get (props as
109
+ * they are when the event fires, `read(store)`) plus `state`, the component's state at that
110
+ * moment; parsers that don't need it take one parameter.
82
111
  */
83
- export type IntentParser<M> = (input: IntentInput) => ParseResult<M> | Promise<ParseResult<M>>;
84
- type Variant<M extends Tagged, K extends M['_tag']> = Extract<M, {
112
+ export type IntentParser<M, P = unknown, S = unknown> = (input: IntentInput, ctx: ParserCtx<P, S>) => ParseResult<M> | Promise<ParseResult<M>>;
113
+ type Variant<M extends Tagged, K> = Extract<M, {
85
114
  readonly _tag: K;
86
115
  }>;
87
- /** Intent parsers keyed by the message tag they produce. Messages from drivers need none. */
88
- export type Intents<M extends Tagged> = {
89
- readonly [K in M['_tag']]?: IntentParser<Variant<M, K>>;
116
+ /**
117
+ * The parser for intent name `K` (ADR 0023): a name that is a message tag parses into that
118
+ * variant; any other name is an intent of its own whose parser may produce any message.
119
+ */
120
+ export type ParserFor<M extends Tagged, P, K, S = unknown> = string extends K ? // The wide form (any intent name), which every specific spec is assignable to.
121
+ IntentParser<M, P, S> | true | TrueOnlyForFieldlessMessage : K extends M['_tag'] ? IntentParser<Variant<M, K>, P, S> | TagOnly<Variant<M, K>> : IntentParser<M, P, S>;
122
+ /**
123
+ * `true` in the intent table: the intent sends its own tag, `{ _tag: K }` (as Elm's `onClick
124
+ * Deal` names the message itself). Only for a variant with no field besides `_tag`; for any
125
+ * other the type names the rule.
126
+ */
127
+ type TagOnly<V> = [Exclude<keyof V, '_tag'>] extends [never] ? true : TrueOnlyForFieldlessMessage;
128
+ interface TrueOnlyForFieldlessMessage {
129
+ readonly 'true only sends a message with no fields besides _tag; write a parser': never;
130
+ }
131
+ /**
132
+ * Intent parsers keyed by intent name (ADR 0001, ADR 0023). The keys are the component's
133
+ * intent names: `define<State, Msg>()(tag, { intent: { Archive: …, Increment: … } })` gives the
134
+ * view `i.Archive` and `i.Increment`. A key that is a message tag must return that variant; any
135
+ * other key may return any message (several controls that change one thing can also share one
136
+ * intent and tell themselves apart by `name`). Messages from drivers need no parser.
137
+ */
138
+ export type Intents<M extends Tagged, P = unknown, N extends string = string, S = unknown> = {
139
+ readonly [K in N]: ParserFor<M, P, K, S>;
90
140
  };
91
141
  type Reducer<S, M, Msg, P> = (state: S, msg: Msg, ctx: Ctx<P>) => Next<S, M>;
92
142
  /**
@@ -100,31 +150,26 @@ export type Update<S, M extends Tagged, P = object> = {
100
150
  readonly IntentRejected?: Reducer<S, M, IntentRejected, P>;
101
151
  readonly StoreChanged?: Reducer<S, M, StoreChanged, P>;
102
152
  readonly Hydrated?: Reducer<S, M, Hydrated, P>;
153
+ readonly Errored?: Reducer<S, M, Errored, P>;
154
+ readonly FormReset?: Reducer<S, M, FormReset, P>;
155
+ readonly FormDisabled?: Reducer<S, M, FormDisabled, P>;
156
+ readonly FormStateRestore?: Reducer<S, M, FormStateRestore, P>;
103
157
  };
104
- /** Typed intent names handed to the view, so `data-intent=${i.Increment}` is checked. */
105
- export type IntentNames<M extends Tagged> = {
106
- readonly [K in M['_tag']]: K;
158
+ /**
159
+ * A component's intent names, the keys of its `intent` object, as the view's `i` and as
160
+ * `intentsOf<typeof C>()`, so `data-intent=${i.Increment}` is checked (ADR 0023).
161
+ */
162
+ export type IntentNames<N extends string> = {
163
+ readonly [K in N]: K;
107
164
  };
108
165
  /**
109
- * One prop's declaration: Lit's `PropertyDeclaration` plus Gyral's honesty rule (ADR 0007
110
- * addendum). A prop is `undefined` until a parent, an attribute or a hydration seed sets it,
111
- * so a prop whose type excludes `undefined` must say how that is guaranteed:
112
- * - `required: true`: a missing value is a bug, reported once per instance at first render;
113
- * - `default: value`: used whenever the element's value is `undefined`.
114
- * A prop whose type includes `undefined` needs neither.
166
+ * The prop builders for props type `P` (view/05-element.md "Props"): one `prop.*` builder per
167
+ * key. A builder's output type must fit the prop's type, so a prop whose type excludes
168
+ * `undefined` needs `required: true` or a `default` (the honesty rule, ADR 0007 addendum).
169
+ * Without explicit type arguments, `define()` infers `P` from the builders.
115
170
  */
116
- export type PropDeclaration<T> = PropertyDeclaration & (undefined extends T ? {
117
- readonly required?: false;
118
- readonly default?: T;
119
- } : {
120
- readonly required: true;
121
- readonly default?: undefined;
122
- } | {
123
- readonly required?: false;
124
- readonly default: T;
125
- });
126
171
  export type PropDeclarations<P> = {
127
- readonly [K in keyof P]-?: PropDeclaration<P[K]>;
172
+ readonly [K in keyof P]-?: Prop<P[K]>;
128
173
  };
129
174
  /** State of a component that keeps none (a pure view of its props). Its `init` is optional. */
130
175
  export type Stateless = Readonly<Record<string, never>>;
@@ -135,37 +180,68 @@ type InitField<S, M extends Tagged, P> = Stateless extends S ? {
135
180
  } : {
136
181
  readonly init: Init<S, M, P>;
137
182
  };
138
- export type ComponentSpec<S, M extends Tagged, P> = SpecBody<S, M, P> & InitField<S, M, P>;
139
- interface SpecBody<S, M extends Tagged, P> {
140
- /** Lit reactive property declarations: the component's inputs. */
141
- readonly props?: PropDeclarations<P>;
142
- /** INTENT: platform events to messages. */
143
- readonly intent: Intents<M>;
144
- /** MODEL: pure state transitions. */
183
+ /**
184
+ * A component spec. `N` is the component's intent names, the keys of `intent` (ADR 0023).
185
+ */
186
+ export type ComponentSpec<S, M extends Tagged, P, N extends string = string> = SpecBody<S, M, P, N> & IntentField<S, M, P, N> & UpdateField<S, M, P> & InitField<S, M, P>;
187
+ interface IntentField<S, M extends Tagged, P, N extends string> {
188
+ /**
189
+ * INTENT: platform events to messages, keyed by intent name (ADR 0023). `Key: true` sends
190
+ * `{ _tag: 'Key' }`. Omit it when the component handles no events.
191
+ */
192
+ readonly intent?: Intents<M, P, N, S>;
193
+ }
194
+ type UpdateField<S, M extends Tagged, P> = [M] extends [never] ? {
195
+ /** MODEL: pure state transitions (only framework messages for a component without any). */
196
+ readonly update?: Update<S, M, P>;
197
+ } : {
198
+ /** MODEL: pure state transitions, one reducer per message tag. */
145
199
  readonly update: Update<S, M, P>;
146
- /** VIEW: pure function of state and props. Name intents in markup; never attach closures. */
147
- readonly view: (state: S, intents: IntentNames<M>, ctx: Ctx<P>) => unknown;
200
+ };
201
+ /**
202
+ * `spec.shadow`: `true` (the default) or an object for a shadow root, `false` for light DOM.
203
+ * `delegatesFocus: true`: focusing the host, or clicking a non-focusable part of it, focuses its
204
+ * first focusable element, and `:focus` matches the host while focus is inside; the server
205
+ * writes `shadowrootdelegatesfocus` on the declarative shadow root (view/05-element.md "Focus").
206
+ */
207
+ export type ShadowOption = boolean | {
208
+ readonly delegatesFocus?: boolean;
209
+ };
210
+ interface SpecBody<S, M extends Tagged, P, N extends string> {
211
+ /** Native form participation with pure value, restoration-state and validity projections. */
212
+ readonly formAssociated?: FormAssociation<S, P>;
213
+ /** The component's inputs, declared with `prop.*` builders. */
214
+ readonly props?: PropDeclarations<P>;
215
+ /**
216
+ * VIEW: pure function of state and props. Name intents in markup; never attach closures.
217
+ * (A method, so a class typed with fewer intent names, e.g. `GyralElementClass<S, M, P, O>`
218
+ * for a recursive component, still accepts it.)
219
+ */
220
+ view(state: S, intents: IntentNames<N>, ctx: Ctx<P>): ChildValue;
221
+ /**
222
+ * What to show when `init` or the view throws (ADR 0024): `state` is `undefined` when `init`
223
+ * threw. Without it, a failed first render leaves the host empty and a failed later render
224
+ * keeps its previous DOM. A fallback that throws too is reported and the previous DOM stays.
225
+ */
226
+ error?(failure: GyralError, state: S | undefined): ChildValue;
148
227
  /**
149
- * Shadow-root styles: `css` templates, plain CSS strings, `CSSStyleSheet`s, or arrays of
150
- * them. Ignored (with a warning) when `shadow: false`.
228
+ * Shadow-root styles: `css` values, plain CSS strings, or arrays of them, nested freely.
229
+ * Each maps to one shared `CSSStyleSheet`. Ignored (with a warning) when `shadow: false`.
151
230
  */
152
231
  readonly styles?: Styles;
153
232
  /**
154
233
  * `false` renders the view as the element's own light-DOM children (ADR 0014): document CSS
155
234
  * applies, and the server writes plain children instead of a `<template shadowrootmode>`.
156
235
  * For page-level components (listings, articles). No `<slot>`s and no `styles`. Default `true`.
236
+ * An object configures the shadow root (`{ delegatesFocus: true }`).
157
237
  */
158
- readonly shadow?: boolean;
238
+ readonly shadow?: ShadowOption;
159
239
  /**
160
240
  * When a server-rendered instance hydrates (gyral-4k7.4): `load` (default), `idle`,
161
241
  * `visible` (scrolled into view) or `interaction` (first pointer/focus). Client-only
162
242
  * renders are unaffected.
163
243
  */
164
244
  readonly hydrate?: HydrateStrategy;
165
- /** Extra event types that may trigger intents via `data-intent-on` (e.g. `pointerdown`). */
166
- readonly events?: readonly string[];
167
- /** Driver substitutions by name, for every instance (ADR 0006). */
168
- readonly drivers?: DriverOverrides;
169
245
  /**
170
246
  * Stores this component reads with `ctx.read(store)` and writes with `send(store, msg)`.
171
247
  * Their changes re-render it (and reach the optional `StoreChanged` reducer). ADR 0013.
@@ -176,11 +252,28 @@ interface SpecBody<S, M extends Tagged, P> {
176
252
  * reorders). Skipped without browser support or when reduced motion is requested.
177
253
  */
178
254
  readonly viewTransition?: (prev: S, next: S, msg: Tagged) => boolean;
255
+ /**
256
+ * Messages from bursty sources (a WebSocket feed, a sensor) whose renders wait for the next
257
+ * animation frame, so many messages in one frame cost one render: `renderOnFrame: ['Ticked']`.
258
+ * Reducers still run at once. Any other change to the component renders in the usual
259
+ * microtask flush, taking pending frame work with it. `'StoreChanged'` covers store changes.
260
+ * Pages that get no frames (hidden) render from a 100 ms timer. view/04-scheduler.md.
261
+ */
262
+ readonly renderOnFrame?: readonly (M['_tag'] | 'StoreChanged')[];
179
263
  /**
180
264
  * Boolean facts about the state, exposed to CSS as custom states:
181
265
  * `states: (s) => ({ loading: s._tag === 'Loading' })` enables `:host(:state(loading))` and
182
266
  * `gy-x:state(loading)`. Applied after each render; feature-detected; not on the server.
183
267
  */
184
268
  readonly states?: (state: S) => Readonly<Record<string, boolean>>;
269
+ /**
270
+ * The long-lived commands that should be running now (ADR 0025): polling, clocks, sockets,
271
+ * store or media-query watches. Evaluated after init, every update and every props change;
272
+ * the runtime starts lanes that appear, aborts lanes that disappear, and restarts a lane whose
273
+ * input changed (compared by JSON text). They stop with the host's other commands on removal
274
+ * and start again from the current state when it is attached again:
275
+ * `subscriptions: (s, p) => (s.live ? [every(30_000, (now) => ({ _tag: 'Tick', now }))] : [])`.
276
+ */
277
+ readonly subscriptions?: (state: S, props: P) => readonly Command<M>[];
185
278
  }
186
279
  export {};
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PropertyDeclaration } from 'lit';\nimport type { Styles } from './styles.js';\nimport type { CommandInfo } from './invokers.js';\nimport type { HydrateStrategy } from './islands.js';\nimport type { DriverOverrides, Next } from './command.js';\nimport type { AnyStore, StoreChanged, StoreRef } from './store.js';\n\n/** Every message is a tagged object; the tag is also the intent name used in markup. */\nexport interface Tagged {\n readonly _tag: string;\n}\n\n/** What the intent layer sees when a `data-intent` element fires its trigger event. */\nexport interface IntentInput {\n /** The `data-intent` value (a message tag). */\n readonly name: string;\n readonly event: Event;\n /** The element carrying `data-intent`. */\n readonly target: Element;\n /** `value` of the input, select, textarea or button that carries the intent. */\n readonly value: string | undefined;\n /** `checked` for checkbox and radio inputs. */\n readonly checked: boolean | undefined;\n /** Submitted data (including the submitter button) when the intent is on a `<form>`. */\n readonly formData: FormData | undefined;\n /** The output a child component emitted, when the intent is on a child element. */\n readonly detail: unknown;\n /** `KeyboardEvent.key` for `keydown`/`keyup` intents. */\n readonly key: string | undefined;\n /** For `toggle` intents (popover, `<details>`): the state it changed to. */\n readonly newState: 'open' | 'closed' | undefined;\n /** For `command` intents: the invoker's command (e.g. `--clear`) and source (gyral-czi.6). */\n readonly command: CommandInfo | undefined;\n}\n\n/** Reads a declared store's current state, typed by the store (ADR 0013). */\nexport type StoreReader = <S>(store: StoreRef<S>) => S;\n\n/** Read-only context handed to every reducer and to the view (ADR 0007, 0013). */\nexport interface Ctx<P> {\n /** Props from above. */\n readonly props: P;\n /** Stores from the side: `read(cart).lines`. The store must be in `spec.stores`. */\n readonly read: StoreReader;\n}\n\n/** Framework message: declared props changed after the first render (ADR 0007). */\nexport interface PropsChanged<P> {\n readonly _tag: 'PropsChanged';\n readonly props: P;\n readonly prev: P;\n}\n\n/**\n * Framework message: the component is live in the browser (ADR 0012 addendum). Sent once,\n * after the first client render has completed, to every client-side instance. Use it for\n * progressive enhancement: render the no-JS form on the server and in the first client render\n * (so hydration matches), then switch to the enhanced UI in the `Hydrated` reducer.\n */\nexport interface Hydrated {\n readonly _tag: 'Hydrated';\n /** `true` when the instance resumed from server-rendered markup (a hydration seed). */\n readonly serverRendered: boolean;\n}\n\n/** One validation problem. `path` is dot-joined and matches the field's `name`. */\nexport interface FieldIssue {\n readonly path: string;\n readonly message: string;\n}\n\n/** Submitted text values of a form (Files are dropped: they can't be re-filled). */\nexport type FormFields = Readonly<Record<string, string | readonly string[]>>;\n\n/** Framework message: an intent's input failed schema validation (ADR 0008). */\nexport interface IntentRejected {\n readonly _tag: 'IntentRejected';\n /** The `data-intent` name whose input was rejected. */\n readonly intent: string;\n readonly issues: readonly FieldIssue[];\n /**\n * For `form()` rejections: what the user submitted, so the view can re-fill the form. On\n * the no-JS path (ADR 0008 server half) the server re-renders the page from this.\n */\n // `| undefined` so schemas with plain optional fields (valibot `optional`) can produce it.\n readonly values?: FormFields | undefined;\n}\n\ntype ParseResult<M> = M | IntentRejected | undefined;\n\n/**\n * Parses a platform event into one message variant, `IntentRejected`, or `undefined` to\n * ignore it. May be async because schema validation may be.\n */\nexport type IntentParser<M> = (input: IntentInput) => ParseResult<M> | Promise<ParseResult<M>>;\n\ntype Variant<M extends Tagged, K extends M['_tag']> = Extract<M, { readonly _tag: K }>;\n\n/** Intent parsers keyed by the message tag they produce. Messages from drivers need none. */\nexport type Intents<M extends Tagged> = {\n readonly [K in M['_tag']]?: IntentParser<Variant<M, K>>;\n};\n\ntype Reducer<S, M, Msg, P> = (state: S, msg: Msg, ctx: Ctx<P>) => Next<S, M>;\n\n/**\n * One pure reducer per message tag (exhaustive by construction), plus optional reducers\n * for framework messages. Reducers may return commands.\n */\nexport type Update<S, M extends Tagged, P = object> = {\n readonly [K in M['_tag']]: Reducer<S, M, Variant<M, K>, P>;\n} & {\n readonly PropsChanged?: Reducer<S, M, PropsChanged<P>, P>;\n readonly IntentRejected?: Reducer<S, M, IntentRejected, P>;\n readonly StoreChanged?: Reducer<S, M, StoreChanged, P>;\n readonly Hydrated?: Reducer<S, M, Hydrated, P>;\n};\n\n/** Typed intent names handed to the view, so `data-intent=${i.Increment}` is checked. */\nexport type IntentNames<M extends Tagged> = { readonly [K in M['_tag']]: K };\n\n/**\n * One prop's declaration: Lit's `PropertyDeclaration` plus Gyral's honesty rule (ADR 0007\n * addendum). A prop is `undefined` until a parent, an attribute or a hydration seed sets it,\n * so a prop whose type excludes `undefined` must say how that is guaranteed:\n * - `required: true`: a missing value is a bug, reported once per instance at first render;\n * - `default: value`: used whenever the element's value is `undefined`.\n * A prop whose type includes `undefined` needs neither.\n */\nexport type PropDeclaration<T> = PropertyDeclaration &\n (undefined extends T\n ? { readonly required?: false; readonly default?: T }\n : | { readonly required: true; readonly default?: undefined }\n | { readonly required?: false; readonly default: T });\n\nexport type PropDeclarations<P> = { readonly [K in keyof P]-?: PropDeclaration<P[K]> };\n\n/** State of a component that keeps none (a pure view of its props). Its `init` is optional. */\nexport type Stateless = Readonly<Record<string, never>>;\n\n/** Initial model state (and optional commands), computed from props on first render. */\ntype Init<S, M, P> = (props: P) => Next<S, M>;\n\n// `init` may be omitted only when an empty object is a valid state (Stateless, all-optional).\ntype InitField<S, M extends Tagged, P> = Stateless extends S\n ? { readonly init?: Init<S, M, P> }\n : { readonly init: Init<S, M, P> };\n\nexport type ComponentSpec<S, M extends Tagged, P> = SpecBody<S, M, P> & InitField<S, M, P>;\n\ninterface SpecBody<S, M extends Tagged, P> {\n /** Lit reactive property declarations: the component's inputs. */\n readonly props?: PropDeclarations<P>;\n /** INTENT: platform events to messages. */\n readonly intent: Intents<M>;\n /** MODEL: pure state transitions. */\n readonly update: Update<S, M, P>;\n /** VIEW: pure function of state and props. Name intents in markup; never attach closures. */\n readonly view: (state: S, intents: IntentNames<M>, ctx: Ctx<P>) => unknown;\n /**\n * Shadow-root styles: `css` templates, plain CSS strings, `CSSStyleSheet`s, or arrays of\n * them. Ignored (with a warning) when `shadow: false`.\n */\n readonly styles?: Styles;\n /**\n * `false` renders the view as the element's own light-DOM children (ADR 0014): document CSS\n * applies, and the server writes plain children instead of a `<template shadowrootmode>`.\n * For page-level components (listings, articles). No `<slot>`s and no `styles`. Default `true`.\n */\n readonly shadow?: boolean;\n /**\n * When a server-rendered instance hydrates (gyral-4k7.4): `load` (default), `idle`,\n * `visible` (scrolled into view) or `interaction` (first pointer/focus). Client-only\n * renders are unaffected.\n */\n readonly hydrate?: HydrateStrategy;\n /** Extra event types that may trigger intents via `data-intent-on` (e.g. `pointerdown`). */\n readonly events?: readonly string[];\n /** Driver substitutions by name, for every instance (ADR 0006). */\n readonly drivers?: DriverOverrides;\n /**\n * Stores this component reads with `ctx.read(store)` and writes with `send(store, msg)`.\n * Their changes re-render it (and reach the optional `StoreChanged` reducer). ADR 0013.\n */\n readonly stores?: readonly AnyStore[];\n /**\n * Return `true` to render this state change inside a View Transition (route changes, list\n * reorders). Skipped without browser support or when reduced motion is requested.\n */\n readonly viewTransition?: (prev: S, next: S, msg: Tagged) => boolean;\n /**\n * Boolean facts about the state, exposed to CSS as custom states:\n * `states: (s) => ({ loading: s._tag === 'Loading' })` enables `:host(:state(loading))` and\n * `gy-x:state(loading)`. Applied after each render; feature-detected; not on the server.\n */\n readonly states?: (state: S) => Readonly<Record<string, boolean>>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { GyralError } from './errors.js';\nimport type { Prop } from './prop.js';\nimport type { ChildValue, Styles } from './view/index.js';\nimport type { CommandInfo } from './invokers.js';\nimport type { HydrateStrategy } from './islands.js';\nimport type { Command, Next } from './command.js';\nimport type { AnyStore, StoreChanged, StoreRef } from './store.js';\nimport type {\n FormAssociation,\n FormDisabled,\n FormReset,\n FormStateRestore,\n} from './form-associated.js';\n\n/** Every message is a tagged object; the tag is also the intent name used in markup. */\nexport interface Tagged {\n readonly _tag: string;\n}\n\n/** What the intent layer sees when an element's intent fires. */\nexport interface IntentInput {\n /** The intent's name (a message tag): the `data-intent-<event>` or `data-intent` value. */\n readonly name: string;\n readonly event: Event;\n /** The element carrying the intent attribute (`event.currentTarget` is Gyral's root). */\n readonly target: Element;\n /** `value` of the input, select, textarea or button that carries the intent. */\n readonly value: string | undefined;\n /** `checked` for checkbox and radio inputs. */\n readonly checked: boolean | undefined;\n /** Submitted data (including the submitter button) when the intent is on a `<form>`. */\n readonly formData: FormData | undefined;\n /**\n * `detail` of any `CustomEvent`: a Gyral child's output, or the event of another custom\n * element (a map's `marker-select`). Unknown until the parser checks it (a guard, a schema).\n */\n readonly detail: unknown;\n /** `KeyboardEvent.key` for `keydown`/`keyup` intents. */\n readonly key: string | undefined;\n /** For `toggle` intents (popover, `<details>`): the state it changed to. */\n readonly newState: 'open' | 'closed' | undefined;\n /** For `command` intents: the invoker's command (e.g. `--clear`) and source (gyral-czi.6). */\n readonly command: CommandInfo | undefined;\n}\n\n/** Reads a declared store's current state, typed by the store (ADR 0013). */\nexport type StoreReader = <S>(store: StoreRef<S>) => S;\n\n/** Read-only context handed to every reducer and to the view (ADR 0007, 0013). */\nexport interface Ctx<P> {\n /** Props from above. */\n readonly props: P;\n /** Stores from the side: `read(cart).lines`. The store must be in `spec.stores`. */\n readonly read: StoreReader;\n}\n\n/**\n * What an intent parser gets besides the input: the reducers' context plus the component's\n * current state, read-only. Parsers decide synchronously (`preventDefault()`), and where the\n * user is often decides it: Tab leaves a grid only from its last cell.\n */\nexport interface ParserCtx<P, S = unknown> extends Ctx<P> {\n /** The state when the event fires. */\n readonly state: Readonly<S>;\n}\n\n/** Framework message: declared props changed after the first render (ADR 0007). */\nexport interface PropsChanged<P> {\n readonly _tag: 'PropsChanged';\n readonly props: P;\n readonly prev: P;\n}\n\n/**\n * Framework message: the component is live in the browser (ADR 0012 addendum). Sent once,\n * after the first client render has completed, to every client-side instance. Use it for\n * progressive enhancement: render the no-JS form on the server and in the first client render\n * (so hydration matches), then switch to the enhanced UI in the `Hydrated` reducer.\n */\nexport interface Hydrated {\n readonly _tag: 'Hydrated';\n /** `true` when the instance resumed from server-rendered markup (a hydration seed). */\n readonly serverRendered: boolean;\n}\n\n/**\n * Framework message (ADR 0024): an update, an intent parser or a command of this component\n * failed. The failure was reported (`reportError`, or claimed by an ancestor's boundary) and\n * changed nothing; reduce it to show an error state or to reset. A failure while reducing\n * `Errored` is reported and not sent again.\n */\nexport interface Errored {\n readonly _tag: 'Errored';\n readonly phase: 'update' | 'parse' | 'command';\n readonly error: GyralError;\n}\n\n/** One validation problem. `path` is dot-joined and matches the field's `name`. */\nexport interface FieldIssue {\n readonly path: string;\n readonly message: string;\n}\n\n/** Submitted text values of a form (Files are dropped: they can't be re-filled). */\nexport type FormFields = Readonly<Record<string, string | readonly string[]>>;\n\n/** Framework message: an intent's input failed schema validation (ADR 0008). */\nexport interface IntentRejected {\n readonly _tag: 'IntentRejected';\n /** The `data-intent` name whose input was rejected. */\n readonly intent: string;\n readonly issues: readonly FieldIssue[];\n /**\n * For `form()` rejections: what the user submitted, so the view can re-fill the form. On\n * the no-JS path (ADR 0008 server half) the server re-renders the page from this.\n */\n // `| undefined` so schemas with plain optional fields (valibot `optional`) can produce it.\n readonly values?: FormFields | undefined;\n}\n\ntype ParseResult<M> = M | IntentRejected | undefined;\n\n/**\n * Parses a platform event into one message variant, `IntentRejected`, or `undefined` to\n * decline it: a synchronous `undefined` passes the event to the next intent outward for the\n * same event (view/05-element.md \"Declining\"). May be async because schema validation may be;\n * an async parser keeps the event. `ctx` is the read-only context reducers get (props as\n * they are when the event fires, `read(store)`) plus `state`, the component's state at that\n * moment; parsers that don't need it take one parameter.\n */\nexport type IntentParser<M, P = unknown, S = unknown> = (\n input: IntentInput,\n ctx: ParserCtx<P, S>,\n) => ParseResult<M> | Promise<ParseResult<M>>;\n\ntype Variant<M extends Tagged, K> = Extract<M, { readonly _tag: K }>;\n\n/**\n * The parser for intent name `K` (ADR 0023): a name that is a message tag parses into that\n * variant; any other name is an intent of its own whose parser may produce any message.\n */\nexport type ParserFor<M extends Tagged, P, K, S = unknown> = string extends K\n ? // The wide form (any intent name), which every specific spec is assignable to.\n IntentParser<M, P, S> | true | TrueOnlyForFieldlessMessage\n : K extends M['_tag']\n ? IntentParser<Variant<M, K>, P, S> | TagOnly<Variant<M, K>>\n : IntentParser<M, P, S>;\n\n/**\n * `true` in the intent table: the intent sends its own tag, `{ _tag: K }` (as Elm's `onClick\n * Deal` names the message itself). Only for a variant with no field besides `_tag`; for any\n * other the type names the rule.\n */\ntype TagOnly<V> = [Exclude<keyof V, '_tag'>] extends [never] ? true : TrueOnlyForFieldlessMessage;\n\ninterface TrueOnlyForFieldlessMessage {\n readonly 'true only sends a message with no fields besides _tag; write a parser': never;\n}\n\n/**\n * Intent parsers keyed by intent name (ADR 0001, ADR 0023). The keys are the component's\n * intent names: `define<State, Msg>()(tag, { intent: { Archive: …, Increment: … } })` gives the\n * view `i.Archive` and `i.Increment`. A key that is a message tag must return that variant; any\n * other key may return any message (several controls that change one thing can also share one\n * intent and tell themselves apart by `name`). Messages from drivers need no parser.\n */\nexport type Intents<M extends Tagged, P = unknown, N extends string = string, S = unknown> = {\n readonly [K in N]: ParserFor<M, P, K, S>;\n};\n\ntype Reducer<S, M, Msg, P> = (state: S, msg: Msg, ctx: Ctx<P>) => Next<S, M>;\n\n/**\n * One pure reducer per message tag (exhaustive by construction), plus optional reducers\n * for framework messages. Reducers may return commands.\n */\nexport type Update<S, M extends Tagged, P = object> = {\n readonly [K in M['_tag']]: Reducer<S, M, Variant<M, K>, P>;\n} & {\n readonly PropsChanged?: Reducer<S, M, PropsChanged<P>, P>;\n readonly IntentRejected?: Reducer<S, M, IntentRejected, P>;\n readonly StoreChanged?: Reducer<S, M, StoreChanged, P>;\n readonly Hydrated?: Reducer<S, M, Hydrated, P>;\n readonly Errored?: Reducer<S, M, Errored, P>;\n readonly FormReset?: Reducer<S, M, FormReset, P>;\n readonly FormDisabled?: Reducer<S, M, FormDisabled, P>;\n readonly FormStateRestore?: Reducer<S, M, FormStateRestore, P>;\n};\n\n/**\n * A component's intent names, the keys of its `intent` object, as the view's `i` and as\n * `intentsOf<typeof C>()`, so `data-intent=${i.Increment}` is checked (ADR 0023).\n */\nexport type IntentNames<N extends string> = { readonly [K in N]: K };\n\n/**\n * The prop builders for props type `P` (view/05-element.md \"Props\"): one `prop.*` builder per\n * key. A builder's output type must fit the prop's type, so a prop whose type excludes\n * `undefined` needs `required: true` or a `default` (the honesty rule, ADR 0007 addendum).\n * Without explicit type arguments, `define()` infers `P` from the builders.\n */\nexport type PropDeclarations<P> = { readonly [K in keyof P]-?: Prop<P[K]> };\n\n/** State of a component that keeps none (a pure view of its props). Its `init` is optional. */\nexport type Stateless = Readonly<Record<string, never>>;\n\n/** Initial model state (and optional commands), computed from props on first render. */\ntype Init<S, M, P> = (props: P) => Next<S, M>;\n\n// `init` may be omitted only when an empty object is a valid state (Stateless, all-optional).\ntype InitField<S, M extends Tagged, P> = Stateless extends S\n ? { readonly init?: Init<S, M, P> }\n : { readonly init: Init<S, M, P> };\n\n/**\n * A component spec. `N` is the component's intent names, the keys of `intent` (ADR 0023).\n */\nexport type ComponentSpec<S, M extends Tagged, P, N extends string = string> = SpecBody<\n S,\n M,\n P,\n N\n> &\n IntentField<S, M, P, N> &\n UpdateField<S, M, P> &\n InitField<S, M, P>;\n\ninterface IntentField<S, M extends Tagged, P, N extends string> {\n /**\n * INTENT: platform events to messages, keyed by intent name (ADR 0023). `Key: true` sends\n * `{ _tag: 'Key' }`. Omit it when the component handles no events.\n */\n readonly intent?: Intents<M, P, N, S>;\n}\n\n// `update` is required (and exhaustive) whenever the component has messages.\ntype UpdateField<S, M extends Tagged, P> = [M] extends [never]\n ? {\n /** MODEL: pure state transitions (only framework messages for a component without any). */\n readonly update?: Update<S, M, P>;\n }\n : {\n /** MODEL: pure state transitions, one reducer per message tag. */\n readonly update: Update<S, M, P>;\n };\n\n/**\n * `spec.shadow`: `true` (the default) or an object for a shadow root, `false` for light DOM.\n * `delegatesFocus: true`: focusing the host, or clicking a non-focusable part of it, focuses its\n * first focusable element, and `:focus` matches the host while focus is inside; the server\n * writes `shadowrootdelegatesfocus` on the declarative shadow root (view/05-element.md \"Focus\").\n */\nexport type ShadowOption = boolean | { readonly delegatesFocus?: boolean };\n\ninterface SpecBody<S, M extends Tagged, P, N extends string> {\n /** Native form participation with pure value, restoration-state and validity projections. */\n readonly formAssociated?: FormAssociation<S, P>;\n /** The component's inputs, declared with `prop.*` builders. */\n readonly props?: PropDeclarations<P>;\n /**\n * VIEW: pure function of state and props. Name intents in markup; never attach closures.\n * (A method, so a class typed with fewer intent names, e.g. `GyralElementClass<S, M, P, O>`\n * for a recursive component, still accepts it.)\n */\n view(state: S, intents: IntentNames<N>, ctx: Ctx<P>): ChildValue;\n /**\n * What to show when `init` or the view throws (ADR 0024): `state` is `undefined` when `init`\n * threw. Without it, a failed first render leaves the host empty and a failed later render\n * keeps its previous DOM. A fallback that throws too is reported and the previous DOM stays.\n */\n error?(failure: GyralError, state: S | undefined): ChildValue;\n /**\n * Shadow-root styles: `css` values, plain CSS strings, or arrays of them, nested freely.\n * Each maps to one shared `CSSStyleSheet`. Ignored (with a warning) when `shadow: false`.\n */\n readonly styles?: Styles;\n /**\n * `false` renders the view as the element's own light-DOM children (ADR 0014): document CSS\n * applies, and the server writes plain children instead of a `<template shadowrootmode>`.\n * For page-level components (listings, articles). No `<slot>`s and no `styles`. Default `true`.\n * An object configures the shadow root (`{ delegatesFocus: true }`).\n */\n readonly shadow?: ShadowOption;\n /**\n * When a server-rendered instance hydrates (gyral-4k7.4): `load` (default), `idle`,\n * `visible` (scrolled into view) or `interaction` (first pointer/focus). Client-only\n * renders are unaffected.\n */\n readonly hydrate?: HydrateStrategy;\n /**\n * Stores this component reads with `ctx.read(store)` and writes with `send(store, msg)`.\n * Their changes re-render it (and reach the optional `StoreChanged` reducer). ADR 0013.\n */\n readonly stores?: readonly AnyStore[];\n /**\n * Return `true` to render this state change inside a View Transition (route changes, list\n * reorders). Skipped without browser support or when reduced motion is requested.\n */\n readonly viewTransition?: (prev: S, next: S, msg: Tagged) => boolean;\n /**\n * Messages from bursty sources (a WebSocket feed, a sensor) whose renders wait for the next\n * animation frame, so many messages in one frame cost one render: `renderOnFrame: ['Ticked']`.\n * Reducers still run at once. Any other change to the component renders in the usual\n * microtask flush, taking pending frame work with it. `'StoreChanged'` covers store changes.\n * Pages that get no frames (hidden) render from a 100 ms timer. view/04-scheduler.md.\n */\n readonly renderOnFrame?: readonly (M['_tag'] | 'StoreChanged')[];\n /**\n * Boolean facts about the state, exposed to CSS as custom states:\n * `states: (s) => ({ loading: s._tag === 'Loading' })` enables `:host(:state(loading))` and\n * `gy-x:state(loading)`. Applied after each render; feature-detected; not on the server.\n */\n readonly states?: (state: S) => Readonly<Record<string, boolean>>;\n /**\n * The long-lived commands that should be running now (ADR 0025): polling, clocks, sockets,\n * store or media-query watches. Evaluated after init, every update and every props change;\n * the runtime starts lanes that appear, aborts lanes that disappear, and restarts a lane whose\n * input changed (compared by JSON text). They stop with the host's other commands on removal\n * and start again from the current state when it is attached again:\n * `subscriptions: (s, p) => (s.live ? [every(30_000, (now) => ({ _tag: 'Tick', now }))] : [])`.\n */\n readonly subscriptions?: (state: S, props: P) => readonly Command<M>[];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that uses the bindings runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,9 @@
1
+ // Registers the dialog and popover bindings in a compiled build (gyral-1zd.27). Only the module
2
+ // the build adds for a module that writes `?modal=` or `?popover-open=` imports it
3
+ // (compiler/features.ts), so other builds leave modal.ts out.
4
+ import { applyToggle, useToggles } from './view/index.js';
5
+ /** Called once by the added module, before any module that uses the bindings runs. */
6
+ export function register() {
7
+ useToggles(applyToggle);
8
+ }
9
+ //# sourceMappingURL=use-dialogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dialogs.js","sourceRoot":"","sources":["../src/use-dialogs.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,mFAAmF;AACnF,8DAA8D;AAC9D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1D,sFAAsF;AACtF,MAAM,UAAU,QAAQ;IACtB,UAAU,CAAC,WAAW,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["// Registers the dialog and popover bindings in a compiled build (gyral-1zd.27). Only the module\n// the build adds for a module that writes `?modal=` or `?popover-open=` imports it\n// (compiler/features.ts), so other builds leave modal.ts out.\nimport { applyToggle, useToggles } from './view/index.js';\n\n/** Called once by the added module, before any module that uses the bindings runs. */\nexport function register(): void {\n useToggles(applyToggle);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that defines such a hook runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,9 @@
1
+ // Registers hook disposal in a compiled build (gyral-1zd.24). Only the module the build adds for
2
+ // a module that names `dispose` imports it (compiler/features.ts), so apps whose hooks have no
3
+ // teardown leave dispose.ts out.
4
+ import { commitTracked, useDisposableHooks } from './view/index.js';
5
+ /** Called once by the added module, before any module that defines such a hook runs. */
6
+ export function register() {
7
+ useDisposableHooks(commitTracked);
8
+ }
9
+ //# sourceMappingURL=use-disposal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-disposal.js","sourceRoot":"","sources":["../src/use-disposal.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,+FAA+F;AAC/F,iCAAiC;AACjC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,wFAAwF;AACxF,MAAM,UAAU,QAAQ;IACtB,kBAAkB,CAAC,aAAa,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Registers hook disposal in a compiled build (gyral-1zd.24). Only the module the build adds for\n// a module that names `dispose` imports it (compiler/features.ts), so apps whose hooks have no\n// teardown leave dispose.ts out.\nimport { commitTracked, useDisposableHooks } from './view/index.js';\n\n/** Called once by the added module, before any module that defines such a hook runs. */\nexport function register(): void {\n useDisposableHooks(commitTracked);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that names the field runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,9 @@
1
+ // Registers the `error` fallback view in a compiled build (ADR 0024, gyral-1zd.17). Only the
2
+ // module the build adds for a module that names `error` imports it (compiler/features.ts).
3
+ import { useErrorView } from '#spec-features';
4
+ import { renderErrorView } from './error-view.js';
5
+ /** Called once by the added module, before any module that names the field runs. */
6
+ export function register() {
7
+ useErrorView(renderErrorView);
8
+ }
9
+ //# sourceMappingURL=use-error-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-error-view.js","sourceRoot":"","sources":["../src/use-error-view.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,2FAA2F;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,oFAAoF;AACpF,MAAM,UAAU,QAAQ;IACtB,YAAY,CAAC,eAAe,CAAC,CAAC;AAChC,CAAC","sourcesContent":["// Registers the `error` fallback view in a compiled build (ADR 0024, gyral-1zd.17). Only the\n// module the build adds for a module that names `error` imports it (compiler/features.ts).\nimport { useErrorView } from '#spec-features';\nimport { renderErrorView } from './error-view.js';\n\n/** Called once by the added module, before any module that names the field runs. */\nexport function register(): void {\n useErrorView(renderErrorView);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that handles the message runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,9 @@
1
+ // Registers the `Errored` message in a compiled build (ADR 0024, gyral-1zd.17). Only the module
2
+ // the build adds for a module that names `Errored` imports it (compiler/features.ts).
3
+ import { useErrored } from '#spec-features';
4
+ import { sendErrored } from './error-view.js';
5
+ /** Called once by the added module, before any module that handles the message runs. */
6
+ export function register() {
7
+ useErrored(sendErrored);
8
+ }
9
+ //# sourceMappingURL=use-errored.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-errored.js","sourceRoot":"","sources":["../src/use-errored.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,sFAAsF;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,wFAAwF;AACxF,MAAM,UAAU,QAAQ;IACtB,UAAU,CAAC,WAAW,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["// Registers the `Errored` message in a compiled build (ADR 0024, gyral-1zd.17). Only the module\n// the build adds for a module that names `Errored` imports it (compiler/features.ts).\nimport { useErrored } from '#spec-features';\nimport { sendErrored } from './error-view.js';\n\n/** Called once by the added module, before any module that handles the message runs. */\nexport function register(): void {\n useErrored(sendErrored);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Installed only for compiled applications whose modules name formAssociated. */
2
+ export declare function register(): void;
@@ -0,0 +1,7 @@
1
+ import { useFormAssociation } from '#spec-features';
2
+ import { formFeature } from './form-associated.js';
3
+ /** Installed only for compiled applications whose modules name formAssociated. */
4
+ export function register() {
5
+ useFormAssociation(formFeature);
6
+ }
7
+ //# sourceMappingURL=use-form-associated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form-associated.js","sourceRoot":"","sources":["../src/use-form-associated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,kFAAkF;AAClF,MAAM,UAAU,QAAQ;IACtB,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { useFormAssociation } from '#spec-features';\nimport { formFeature } from './form-associated.js';\n\n/** Installed only for compiled applications whose modules name formAssociated. */\nexport function register(): void {\n useFormAssociation(formFeature);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that names the field runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,10 @@
1
+ // Registers frameLane in a compiled build (gyral-c5d.12). Only the module the build adds for a
2
+ // module that names the spec field imports it (compiler/features.ts), so other builds leave
3
+ // frame-lane.ts out.
4
+ import { useFrameLane } from '#spec-features';
5
+ import { frameLane } from './frame-lane.js';
6
+ /** Called once by the added module, before any module that names the field runs. */
7
+ export function register() {
8
+ useFrameLane(frameLane);
9
+ }
10
+ //# sourceMappingURL=use-frame-lane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-frame-lane.js","sourceRoot":"","sources":["../src/use-frame-lane.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,4FAA4F;AAC5F,qBAAqB;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,oFAAoF;AACpF,MAAM,UAAU,QAAQ;IACtB,YAAY,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["// Registers frameLane in a compiled build (gyral-c5d.12). Only the module the build adds for a\n// module that names the spec field imports it (compiler/features.ts), so other builds leave\n// frame-lane.ts out.\nimport { useFrameLane } from '#spec-features';\nimport { frameLane } from './frame-lane.js';\n\n/** Called once by the added module, before any module that names the field runs. */\nexport function register(): void {\n useFrameLane(frameLane);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that may need the fallback runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,10 @@
1
+ // Registers the invoker-command fallback in a client-only build (gyral-c5d.11). Only the module
2
+ // the build adds for a module that may use command intents imports it (compiler/features.ts,
3
+ // `virtual:gyral-use/invokers`), so only those builds carry the fallback's import().
4
+ import { useInvokerShim } from '#invoker-fallback';
5
+ import { loadInvokerShim } from './invoker-fallback.js';
6
+ /** Called once by the added module, before any module that may need the fallback runs. */
7
+ export function register() {
8
+ useInvokerShim(loadInvokerShim);
9
+ }
10
+ //# sourceMappingURL=use-invokers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-invokers.js","sourceRoot":"","sources":["../src/use-invokers.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,6FAA6F;AAC7F,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,0FAA0F;AAC1F,MAAM,UAAU,QAAQ;IACtB,cAAc,CAAC,eAAe,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Registers the invoker-command fallback in a client-only build (gyral-c5d.11). Only the module\n// the build adds for a module that may use command intents imports it (compiler/features.ts,\n// `virtual:gyral-use/invokers`), so only those builds carry the fallback's import().\nimport { useInvokerShim } from '#invoker-fallback';\nimport { loadInvokerShim } from './invoker-fallback.js';\n\n/** Called once by the added module, before any module that may need the fallback runs. */\nexport function register(): void {\n useInvokerShim(loadInvokerShim);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that names the field runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,10 @@
1
+ // Registers syncStates in a compiled build (gyral-c5d.12). Only the module the build adds for a
2
+ // module that names the spec field imports it (compiler/features.ts), so other builds leave
3
+ // states.ts out.
4
+ import { useCustomStates } from '#spec-features';
5
+ import { syncStates } from './states.js';
6
+ /** Called once by the added module, before any module that names the field runs. */
7
+ export function register() {
8
+ useCustomStates(syncStates);
9
+ }
10
+ //# sourceMappingURL=use-states.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-states.js","sourceRoot":"","sources":["../src/use-states.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,4FAA4F;AAC5F,iBAAiB;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,oFAAoF;AACpF,MAAM,UAAU,QAAQ;IACtB,eAAe,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["// Registers syncStates in a compiled build (gyral-c5d.12). Only the module the build adds for a\n// module that names the spec field imports it (compiler/features.ts), so other builds leave\n// states.ts out.\nimport { useCustomStates } from '#spec-features';\nimport { syncStates } from './states.js';\n\n/** Called once by the added module, before any module that names the field runs. */\nexport function register(): void {\n useCustomStates(syncStates);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that names the field runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,10 @@
1
+ // Registers subscriptionSet in a compiled build (ADR 0025). Only the module the build adds for a
2
+ // module that names the spec field imports it (compiler/features.ts), so other builds leave
3
+ // subscriptions.ts out.
4
+ import { useSubscriptions } from '#spec-features';
5
+ import { subscriptionSet } from './subscriptions.js';
6
+ /** Called once by the added module, before any module that names the field runs. */
7
+ export function register() {
8
+ useSubscriptions(subscriptionSet);
9
+ }
10
+ //# sourceMappingURL=use-subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-subscriptions.js","sourceRoot":"","sources":["../src/use-subscriptions.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,4FAA4F;AAC5F,wBAAwB;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,oFAAoF;AACpF,MAAM,UAAU,QAAQ;IACtB,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Registers subscriptionSet in a compiled build (ADR 0025). Only the module the build adds for a\n// module that names the spec field imports it (compiler/features.ts), so other builds leave\n// subscriptions.ts out.\nimport { useSubscriptions } from '#spec-features';\nimport { subscriptionSet } from './subscriptions.js';\n\n/** Called once by the added module, before any module that names the field runs. */\nexport function register(): void {\n useSubscriptions(subscriptionSet);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** Called once by the added module, before any module that names the field runs. */
2
+ export declare function register(): void;
@@ -0,0 +1,10 @@
1
+ // Registers startTransition in a compiled build (gyral-c5d.12). Only the module the build adds for a
2
+ // module that names the spec field imports it (compiler/features.ts), so other builds leave
3
+ // transitions.ts out.
4
+ import { useViewTransitions } from '#spec-features';
5
+ import { startTransition } from './transitions.js';
6
+ /** Called once by the added module, before any module that names the field runs. */
7
+ export function register() {
8
+ useViewTransitions(startTransition);
9
+ }
10
+ //# sourceMappingURL=use-transitions.js.map