@gyral/core 0.3.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 (381) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/NOTICE +19 -0
  3. package/README.md +30 -5
  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 +25 -3
  8. package/dist/children.js +18 -1
  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 +25 -11
  15. package/dist/command.js.map +1 -1
  16. package/dist/compiler/ast.d.ts +2 -0
  17. package/dist/compiler/ast.js +5 -1
  18. package/dist/compiler/ast.js.map +1 -1
  19. package/dist/compiler/compile.d.ts +5 -2
  20. package/dist/compiler/compile.js +36 -17
  21. package/dist/compiler/compile.js.map +1 -1
  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 +4 -0
  35. package/dist/compiler/hooks.js +144 -89
  36. package/dist/compiler/hooks.js.map +1 -1
  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 +1 -1
  44. package/dist/compiler/parse5-check.js +8 -3
  45. package/dist/compiler/parse5-check.js.map +1 -1
  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 +13 -3
  50. package/dist/compiler/scan.js +21 -13
  51. package/dist/compiler/scan.js.map +1 -1
  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/tag-map.d.ts +41 -0
  56. package/dist/compiler/tag-map.js +126 -0
  57. package/dist/compiler/tag-map.js.map +1 -0
  58. package/dist/components-ready.d.ts +7 -0
  59. package/dist/components-ready.js +19 -0
  60. package/dist/components-ready.js.map +1 -0
  61. package/dist/define.d.ts +13 -4
  62. package/dist/define.js +8 -12
  63. package/dist/define.js.map +1 -1
  64. package/dist/devtools-events.d.ts +8 -0
  65. package/dist/devtools-events.js.map +1 -1
  66. package/dist/devtools-off.d.ts +1 -0
  67. package/dist/devtools-off.js +1 -0
  68. package/dist/devtools-off.js.map +1 -1
  69. package/dist/devtools.d.ts +3 -0
  70. package/dist/devtools.js +14 -0
  71. package/dist/devtools.js.map +1 -1
  72. package/dist/drivers-scope.js.map +1 -1
  73. package/dist/element-internals.d.ts +1 -0
  74. package/dist/element-internals.js +11 -0
  75. package/dist/element-internals.js.map +1 -0
  76. package/dist/element-types.d.ts +6 -2
  77. package/dist/element-types.js.map +1 -1
  78. package/dist/element.js +80 -27
  79. package/dist/element.js.map +1 -1
  80. package/dist/error-view.d.ts +10 -0
  81. package/dist/error-view.js +30 -0
  82. package/dist/error-view.js.map +1 -0
  83. package/dist/errors.d.ts +21 -0
  84. package/dist/errors.js +47 -0
  85. package/dist/errors.js.map +1 -0
  86. package/dist/errors.json +289 -0
  87. package/dist/eslint/imports.d.ts +2 -0
  88. package/dist/eslint/imports.js +2 -2
  89. package/dist/eslint/imports.js.map +1 -1
  90. package/dist/eslint/index.d.ts +2 -1
  91. package/dist/eslint/index.js +11 -3
  92. package/dist/eslint/index.js.map +1 -1
  93. package/dist/eslint/template-rule.d.ts +1 -0
  94. package/dist/eslint/template-rule.js +15 -5
  95. package/dist/eslint/template-rule.js.map +1 -1
  96. package/dist/eslint/unused-intent-rule.d.ts +2 -0
  97. package/dist/eslint/unused-intent-rule.js +186 -0
  98. package/dist/eslint/unused-intent-rule.js.map +1 -0
  99. package/dist/features.d.ts +2 -2
  100. package/dist/features.js.map +1 -1
  101. package/dist/focus.d.ts +6 -0
  102. package/dist/focus.js +32 -2
  103. package/dist/focus.js.map +1 -1
  104. package/dist/form-associated.d.ts +46 -0
  105. package/dist/form-associated.js +77 -0
  106. package/dist/form-associated.js.map +1 -0
  107. package/dist/forms.d.ts +42 -30
  108. package/dist/forms.js +85 -41
  109. package/dist/forms.js.map +1 -1
  110. package/dist/frame-lane.d.ts +11 -0
  111. package/dist/frame-lane.js +28 -0
  112. package/dist/frame-lane.js.map +1 -0
  113. package/dist/head.d.ts +61 -0
  114. package/dist/head.js +85 -0
  115. package/dist/head.js.map +1 -0
  116. package/dist/host-model.d.ts +34 -5
  117. package/dist/host-model.js +146 -23
  118. package/dist/host-model.js.map +1 -1
  119. package/dist/hydration-client.js +2 -2
  120. package/dist/hydration-client.js.map +1 -1
  121. package/dist/hydration-loader.d.ts +13 -0
  122. package/dist/hydration-loader.js +58 -0
  123. package/dist/hydration-loader.js.map +1 -0
  124. package/dist/hydration-off.d.ts +8 -0
  125. package/dist/hydration-off.js +25 -0
  126. package/dist/hydration-off.js.map +1 -0
  127. package/dist/hydration.d.ts +0 -12
  128. package/dist/hydration.js +3 -52
  129. package/dist/hydration.js.map +1 -1
  130. package/dist/index.d.ts +20 -24
  131. package/dist/index.js +10 -19
  132. package/dist/index.js.map +1 -1
  133. package/dist/indexeddb-types.d.ts +97 -0
  134. package/dist/indexeddb-types.js +2 -0
  135. package/dist/indexeddb-types.js.map +1 -0
  136. package/dist/indexeddb.d.ts +5 -0
  137. package/dist/indexeddb.js +118 -0
  138. package/dist/indexeddb.js.map +1 -0
  139. package/dist/intent.d.ts +41 -19
  140. package/dist/intent.js +144 -106
  141. package/dist/intent.js.map +1 -1
  142. package/dist/internal/indexeddb-open.d.ts +8 -0
  143. package/dist/internal/indexeddb-open.js +96 -0
  144. package/dist/internal/indexeddb-open.js.map +1 -0
  145. package/dist/internal/indexeddb-transaction.d.ts +4 -0
  146. package/dist/internal/indexeddb-transaction.js +134 -0
  147. package/dist/internal/indexeddb-transaction.js.map +1 -0
  148. package/dist/internal/interpreter.d.ts +12 -4
  149. package/dist/internal/interpreter.js +36 -48
  150. package/dist/internal/interpreter.js.map +1 -1
  151. package/dist/internal/token.d.ts +1 -0
  152. package/dist/internal/token.js +7 -0
  153. package/dist/internal/token.js.map +1 -0
  154. package/dist/internal.d.ts +20 -0
  155. package/dist/internal.js +22 -0
  156. package/dist/internal.js.map +1 -0
  157. package/dist/invoker-fallback-used.d.ts +4 -0
  158. package/dist/invoker-fallback-used.js +10 -0
  159. package/dist/invoker-fallback-used.js.map +1 -0
  160. package/dist/invoker-fallback.d.ts +4 -0
  161. package/dist/invoker-fallback.js +15 -0
  162. package/dist/invoker-fallback.js.map +1 -0
  163. package/dist/light-dom.d.ts +1 -1
  164. package/dist/light-dom.js.map +1 -1
  165. package/dist/prop.d.ts +30 -7
  166. package/dist/prop.js +19 -0
  167. package/dist/prop.js.map +1 -1
  168. package/dist/props.d.ts +8 -3
  169. package/dist/props.js +22 -15
  170. package/dist/props.js.map +1 -1
  171. package/dist/retry.d.ts +15 -0
  172. package/dist/retry.js +48 -0
  173. package/dist/retry.js.map +1 -0
  174. package/dist/scheduler.d.ts +7 -3
  175. package/dist/scheduler.js +38 -56
  176. package/dist/scheduler.js.map +1 -1
  177. package/dist/script-json.d.ts +2 -0
  178. package/dist/script-json.js +13 -0
  179. package/dist/script-json.js.map +1 -0
  180. package/dist/server-component.d.ts +1 -1
  181. package/dist/server-component.js +45 -14
  182. package/dist/server-component.js.map +1 -1
  183. package/dist/server.d.ts +8 -2
  184. package/dist/server.js +11 -2
  185. package/dist/server.js.map +1 -1
  186. package/dist/settled.d.ts +4 -3
  187. package/dist/settled.js +48 -26
  188. package/dist/settled.js.map +1 -1
  189. package/dist/spec-features-used.d.ts +21 -0
  190. package/dist/spec-features-used.js +50 -0
  191. package/dist/spec-features-used.js.map +1 -0
  192. package/dist/spec-features.d.ts +28 -0
  193. package/dist/spec-features.js +42 -0
  194. package/dist/spec-features.js.map +1 -0
  195. package/dist/states.d.ts +3 -5
  196. package/dist/states.js +22 -8
  197. package/dist/states.js.map +1 -1
  198. package/dist/storage.d.ts +69 -0
  199. package/dist/storage.js +158 -0
  200. package/dist/storage.js.map +1 -0
  201. package/dist/store-binding.js +2 -2
  202. package/dist/store-binding.js.map +1 -1
  203. package/dist/store-scope.d.ts +2 -4
  204. package/dist/store-scope.js +6 -16
  205. package/dist/store-scope.js.map +1 -1
  206. package/dist/store.js +36 -8
  207. package/dist/store.js.map +1 -1
  208. package/dist/subscription.d.ts +35 -0
  209. package/dist/subscription.js +74 -0
  210. package/dist/subscription.js.map +1 -0
  211. package/dist/subscriptions.d.ts +26 -0
  212. package/dist/subscriptions.js +98 -0
  213. package/dist/subscriptions.js.map +1 -0
  214. package/dist/transitions.d.ts +4 -5
  215. package/dist/transitions.js +10 -4
  216. package/dist/transitions.js.map +1 -1
  217. package/dist/types.d.ts +124 -27
  218. package/dist/types.js.map +1 -1
  219. package/dist/use-dialogs.d.ts +2 -0
  220. package/dist/use-dialogs.js +9 -0
  221. package/dist/use-dialogs.js.map +1 -0
  222. package/dist/use-disposal.d.ts +2 -0
  223. package/dist/use-disposal.js +9 -0
  224. package/dist/use-disposal.js.map +1 -0
  225. package/dist/use-error-view.d.ts +2 -0
  226. package/dist/use-error-view.js +9 -0
  227. package/dist/use-error-view.js.map +1 -0
  228. package/dist/use-errored.d.ts +2 -0
  229. package/dist/use-errored.js +9 -0
  230. package/dist/use-errored.js.map +1 -0
  231. package/dist/use-form-associated.d.ts +2 -0
  232. package/dist/use-form-associated.js +7 -0
  233. package/dist/use-form-associated.js.map +1 -0
  234. package/dist/use-frame-lane.d.ts +2 -0
  235. package/dist/use-frame-lane.js +10 -0
  236. package/dist/use-frame-lane.js.map +1 -0
  237. package/dist/use-invokers.d.ts +2 -0
  238. package/dist/use-invokers.js +10 -0
  239. package/dist/use-invokers.js.map +1 -0
  240. package/dist/use-states.d.ts +2 -0
  241. package/dist/use-states.js +10 -0
  242. package/dist/use-states.js.map +1 -0
  243. package/dist/use-subscriptions.d.ts +2 -0
  244. package/dist/use-subscriptions.js +10 -0
  245. package/dist/use-subscriptions.js.map +1 -0
  246. package/dist/use-transitions.d.ts +2 -0
  247. package/dist/use-transitions.js +10 -0
  248. package/dist/use-transitions.js.map +1 -0
  249. package/dist/view/attributes.d.ts +5 -0
  250. package/dist/view/attributes.js +5 -0
  251. package/dist/view/attributes.js.map +1 -1
  252. package/dist/view/compiled.d.ts +1 -1
  253. package/dist/view/compiled.js +1 -1
  254. package/dist/view/compiled.js.map +1 -1
  255. package/dist/view/index.d.ts +9 -4
  256. package/dist/view/index.js +9 -3
  257. package/dist/view/index.js.map +1 -1
  258. package/dist/view/loc.d.ts +9 -0
  259. package/dist/view/loc.js +50 -0
  260. package/dist/view/loc.js.map +1 -0
  261. package/dist/view/message.d.ts +17 -0
  262. package/dist/view/message.js +40 -0
  263. package/dist/view/message.js.map +1 -0
  264. package/dist/view/messages.d.ts +43 -0
  265. package/dist/view/messages.js +84 -0
  266. package/dist/view/messages.js.map +1 -0
  267. package/dist/view/normalize/check.d.ts +5 -2
  268. package/dist/view/normalize/check.js +6 -3
  269. package/dist/view/normalize/check.js.map +1 -1
  270. package/dist/view/normalize/emit.d.ts +2 -0
  271. package/dist/view/normalize/emit.js +40 -11
  272. package/dist/view/normalize/emit.js.map +1 -1
  273. package/dist/view/normalize/errors.js +1 -1
  274. package/dist/view/normalize/errors.js.map +1 -1
  275. package/dist/view/normalize/id.d.ts +5 -2
  276. package/dist/view/normalize/id.js +9 -2
  277. package/dist/view/normalize/id.js.map +1 -1
  278. package/dist/view/normalize/normalize.d.ts +7 -4
  279. package/dist/view/normalize/normalize.js +15 -9
  280. package/dist/view/normalize/normalize.js.map +1 -1
  281. package/dist/view/normalize/rules.d.ts +9 -0
  282. package/dist/view/normalize/rules.js +35 -5
  283. package/dist/view/normalize/rules.js.map +1 -1
  284. package/dist/view/normalize/svg.d.ts +14 -0
  285. package/dist/view/normalize/svg.js +40 -0
  286. package/dist/view/normalize/svg.js.map +1 -0
  287. package/dist/view/normalize/tokens.d.ts +5 -1
  288. package/dist/view/normalize/tokens.js.map +1 -1
  289. package/dist/view/normalize/tree.d.ts +8 -2
  290. package/dist/view/normalize/tree.js +58 -13
  291. package/dist/view/normalize/tree.js.map +1 -1
  292. package/dist/view/normalize/types.d.ts +24 -4
  293. package/dist/view/normalize/types.js +4 -1
  294. package/dist/view/normalize/types.js.map +1 -1
  295. package/dist/view/normalize/whitespace.js +4 -3
  296. package/dist/view/normalize/whitespace.js.map +1 -1
  297. package/dist/view/prepare-stub.js +2 -2
  298. package/dist/view/prepare-stub.js.map +1 -1
  299. package/dist/view/prepare.d.ts +5 -2
  300. package/dist/view/prepare.js +9 -3
  301. package/dist/view/prepare.js.map +1 -1
  302. package/dist/view/registry.d.ts +15 -0
  303. package/dist/view/registry.js +10 -2
  304. package/dist/view/registry.js.map +1 -1
  305. package/dist/view/render/adopt-attr.js +7 -1
  306. package/dist/view/render/adopt-attr.js.map +1 -1
  307. package/dist/view/render/adopt.js +21 -4
  308. package/dist/view/render/adopt.js.map +1 -1
  309. package/dist/view/render/attr-parts.d.ts +12 -1
  310. package/dist/view/render/attr-parts.js +38 -5
  311. package/dist/view/render/attr-parts.js.map +1 -1
  312. package/dist/view/render/child-part.js +5 -2
  313. package/dist/view/render/child-part.js.map +1 -1
  314. package/dist/view/render/dispose.d.ts +3 -0
  315. package/dist/view/render/dispose.js +76 -0
  316. package/dist/view/render/dispose.js.map +1 -0
  317. package/dist/view/render/hook-part.d.ts +3 -1
  318. package/dist/view/render/hook-part.js +21 -5
  319. package/dist/view/render/hook-part.js.map +1 -1
  320. package/dist/view/render/hook-run.d.ts +2 -0
  321. package/dist/view/render/hook-run.js +72 -0
  322. package/dist/view/render/hook-run.js.map +1 -0
  323. package/dist/view/render/hooks.d.ts +73 -5
  324. package/dist/view/render/hooks.js +79 -17
  325. package/dist/view/render/hooks.js.map +1 -1
  326. package/dist/view/render/hydrate.js +2 -2
  327. package/dist/view/render/hydrate.js.map +1 -1
  328. package/dist/view/render/keyed.d.ts +6 -0
  329. package/dist/view/render/keyed.js +15 -0
  330. package/dist/view/render/keyed.js.map +1 -0
  331. package/dist/view/render/mismatch.js +5 -3
  332. package/dist/view/render/mismatch.js.map +1 -1
  333. package/dist/view/render/modal.d.ts +3 -0
  334. package/dist/view/render/modal.js +39 -0
  335. package/dist/view/render/modal.js.map +1 -0
  336. package/dist/view/render/raw.d.ts +4 -1
  337. package/dist/view/render/raw.js +6 -2
  338. package/dist/view/render/raw.js.map +1 -1
  339. package/dist/view/render/render.d.ts +4 -1
  340. package/dist/view/render/render.js +17 -12
  341. package/dist/view/render/render.js.map +1 -1
  342. package/dist/view/render/toggles.d.ts +6 -0
  343. package/dist/view/render/toggles.js +6 -0
  344. package/dist/view/render/toggles.js.map +1 -0
  345. package/dist/view/render/warn.d.ts +14 -0
  346. package/dist/view/render/warn.js +45 -0
  347. package/dist/view/render/warn.js.map +1 -1
  348. package/dist/view/server/component.d.ts +6 -3
  349. package/dist/view/server/component.js +29 -7
  350. package/dist/view/server/component.js.map +1 -1
  351. package/dist/view/server/index.d.ts +20 -0
  352. package/dist/view/server/index.js +12 -4
  353. package/dist/view/server/index.js.map +1 -1
  354. package/dist/view/server/tags.d.ts +13 -2
  355. package/dist/view/server/tags.js +13 -2
  356. package/dist/view/server/tags.js.map +1 -1
  357. package/dist/view/server/values.d.ts +2 -0
  358. package/dist/view/server/values.js +8 -0
  359. package/dist/view/server/values.js.map +1 -1
  360. package/dist/view/server/writer.d.ts +9 -4
  361. package/dist/view/server/writer.js +33 -18
  362. package/dist/view/server/writer.js.map +1 -1
  363. package/dist/view/template-element.d.ts +7 -0
  364. package/dist/view/template-element.js +25 -5
  365. package/dist/view/template-element.js.map +1 -1
  366. package/dist/view/template.d.ts +10 -2
  367. package/dist/view/template.js +62 -8
  368. package/dist/view/template.js.map +1 -1
  369. package/dist/view/trusted-html.d.ts +6 -0
  370. package/dist/view/trusted-html.js +34 -0
  371. package/dist/view/trusted-html.js.map +1 -0
  372. package/dist/vite.d.ts +38 -31
  373. package/dist/vite.js +198 -31
  374. package/dist/vite.js.map +1 -1
  375. package/package.json +34 -3
  376. package/dist/hooks/labelled-by.d.ts +0 -13
  377. package/dist/hooks/labelled-by.js +0 -51
  378. package/dist/hooks/labelled-by.js.map +0 -1
  379. package/dist/random.d.ts +0 -13
  380. package/dist/random.js +0 -19
  381. package/dist/random.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,19 +1,21 @@
1
+ import type { GyralError } from './errors.js';
1
2
  import type { Prop } from './prop.js';
2
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,10 +150,17 @@ 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
166
  * The prop builders for props type `P` (view/05-element.md "Props"): one `prop.*` builder per
@@ -123,16 +180,50 @@ type InitField<S, M extends Tagged, P> = Stateless extends S ? {
123
180
  } : {
124
181
  readonly init: Init<S, M, P>;
125
182
  };
126
- export type ComponentSpec<S, M extends Tagged, P> = SpecBody<S, M, P> & InitField<S, M, P>;
127
- interface SpecBody<S, M extends Tagged, P> {
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. */
199
+ readonly update: Update<S, M, P>;
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>;
128
213
  /** The component's inputs, declared with `prop.*` builders. */
129
214
  readonly props?: PropDeclarations<P>;
130
- /** INTENT: platform events to messages. */
131
- readonly intent: Intents<M>;
132
- /** MODEL: pure state transitions. */
133
- readonly update: Update<S, M, P>;
134
- /** VIEW: pure function of state and props. Name intents in markup; never attach closures. */
135
- readonly view: (state: S, intents: IntentNames<M>, ctx: Ctx<P>) => ChildValue;
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;
136
227
  /**
137
228
  * Shadow-root styles: `css` values, plain CSS strings, or arrays of them, nested freely.
138
229
  * Each maps to one shared `CSSStyleSheet`. Ignored (with a warning) when `shadow: false`.
@@ -142,18 +233,15 @@ interface SpecBody<S, M extends Tagged, P> {
142
233
  * `false` renders the view as the element's own light-DOM children (ADR 0014): document CSS
143
234
  * applies, and the server writes plain children instead of a `<template shadowrootmode>`.
144
235
  * For page-level components (listings, articles). No `<slot>`s and no `styles`. Default `true`.
236
+ * An object configures the shadow root (`{ delegatesFocus: true }`).
145
237
  */
146
- readonly shadow?: boolean;
238
+ readonly shadow?: ShadowOption;
147
239
  /**
148
240
  * When a server-rendered instance hydrates (gyral-4k7.4): `load` (default), `idle`,
149
241
  * `visible` (scrolled into view) or `interaction` (first pointer/focus). Client-only
150
242
  * renders are unaffected.
151
243
  */
152
244
  readonly hydrate?: HydrateStrategy;
153
- /** Extra event types that may trigger intents via `data-intent-on` (e.g. `pointerdown`). */
154
- readonly events?: readonly string[];
155
- /** Driver substitutions by name, for every instance (ADR 0006). */
156
- readonly drivers?: DriverOverrides;
157
245
  /**
158
246
  * Stores this component reads with `ctx.read(store)` and writes with `send(store, msg)`.
159
247
  * Their changes re-render it (and reach the optional `StoreChanged` reducer). ADR 0013.
@@ -178,5 +266,14 @@ interface SpecBody<S, M extends Tagged, P> {
178
266
  * `gy-x:state(loading)`. Applied after each render; feature-detected; not on the server.
179
267
  */
180
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>[];
181
278
  }
182
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 { 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 { 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 * 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\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 /** The component's inputs, declared with `prop.*` builders. */\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>) => 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 */\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 * 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"]}
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-transitions.js","sourceRoot":"","sources":["../src/use-transitions.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,4FAA4F;AAC5F,sBAAsB;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,oFAAoF;AACpF,MAAM,UAAU,QAAQ;IACtB,kBAAkB,CAAC,eAAe,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Registers startTransition 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// transitions.ts out.\nimport { useViewTransitions } from '#spec-features';\nimport { startTransition } from './transitions.js';\n\n/** Called once by the added module, before any module that names the field runs. */\nexport function register(): void {\n useViewTransitions(startTransition);\n}\n"]}
@@ -4,3 +4,8 @@ export declare const SEED_ATTRIBUTE = "data-gyral-seed";
4
4
  export declare const LIGHT_ATTRIBUTE = "data-gyral-light";
5
5
  /** A deferred island's strategy (07 "Islands"), next to `defer-hydration`. */
6
6
  export declare const ISLAND_ATTRIBUTE = "data-gyral-hydrate";
7
+ /**
8
+ * Marks a host whose `init` or view threw on the server (ADR 0024): it carries its error view
9
+ * (or nothing) and no seed, and the client starts it fresh instead of hydrating.
10
+ */
11
+ export declare const ERROR_ATTRIBUTE = "data-gyral-error";
@@ -7,4 +7,9 @@ export const SEED_ATTRIBUTE = 'data-gyral-seed';
7
7
  export const LIGHT_ATTRIBUTE = 'data-gyral-light';
8
8
  /** A deferred island's strategy (07 "Islands"), next to `defer-hydration`. */
9
9
  export const ISLAND_ATTRIBUTE = 'data-gyral-hydrate';
10
+ /**
11
+ * Marks a host whose `init` or view threw on the server (ADR 0024): it carries its error view
12
+ * (or nothing) and no seed, and the client starts it fresh instead of hydrating.
13
+ */
14
+ export const ERROR_ATTRIBUTE = 'data-gyral-error';
10
15
  //# sourceMappingURL=attributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../src/view/attributes.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8FAA8F;AAC9F,iEAAiE;AACjE,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAChD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC","sourcesContent":["// Host attributes the server renderer writes (view/06-server.md \"Components\") and the client\n// reads (07). Core's hydration.ts, light-dom.ts and islands.ts declare the same names for the\n// client; server-components.node.test.ts checks that they match.\n/** Host attribute holding a component's JSON seed (ADR 0012); the client removes it. */\nexport const SEED_ATTRIBUTE = 'data-gyral-seed';\n/** Marks a server-rendered light-DOM host (ADR 0014), so hydration knows its own content. */\nexport const LIGHT_ATTRIBUTE = 'data-gyral-light';\n/** A deferred island's strategy (07 \"Islands\"), next to `defer-hydration`. */\nexport const ISLAND_ATTRIBUTE = 'data-gyral-hydrate';\n"]}
1
+ {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../src/view/attributes.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,8FAA8F;AAC9F,iEAAiE;AACjE,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAChD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AACrD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC","sourcesContent":["// Host attributes the server renderer writes (view/06-server.md \"Components\") and the client\n// reads (07). Core's hydration.ts, light-dom.ts and islands.ts declare the same names for the\n// client; server-components.node.test.ts checks that they match.\n/** Host attribute holding a component's JSON seed (ADR 0012); the client removes it. */\nexport const SEED_ATTRIBUTE = 'data-gyral-seed';\n/** Marks a server-rendered light-DOM host (ADR 0014), so hydration knows its own content. */\nexport const LIGHT_ATTRIBUTE = 'data-gyral-light';\n/** A deferred island's strategy (07 \"Islands\"), next to `defer-hydration`. */\nexport const ISLAND_ATTRIBUTE = 'data-gyral-hydrate';\n/**\n * Marks a host whose `init` or view threw on the server (ADR 0024): it carries its error view\n * (or nothing) and no seed, and the client starts it fresh instead of hydrating.\n */\nexport const ERROR_ATTRIBUTE = 'data-gyral-error';\n"]}
@@ -1 +1 @@
1
- export { compiled } from './template.js';
1
+ export { compiled, compiledSvg } from './template.js';
@@ -2,5 +2,5 @@
2
2
  // from (view/01-templates.md "Compiled"). Internal: apps never import it themselves, and it is
3
3
  // not documented as API. A subpath of its own, so the main entry's API stays as documented
4
4
  // and compiled code still shares the one template module with `html` (same package copy).
5
- export { compiled } from './template.js';
5
+ export { compiled, compiledSvg } from './template.js';
6
6
  //# sourceMappingURL=compiled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compiled.js","sourceRoot":"","sources":["../../src/view/compiled.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+FAA+F;AAC/F,2FAA2F;AAC3F,0FAA0F;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// `@gyral/core/compiled`: the entry the Vite template compiler's output imports `compiled`\n// from (view/01-templates.md \"Compiled\"). Internal: apps never import it themselves, and it is\n// not documented as API. A subpath of its own, so the main entry's API stays as documented\n// and compiled code still shares the one template module with `html` (same package copy).\nexport { compiled } from './template.js';\n"]}
1
+ {"version":3,"file":"compiled.js","sourceRoot":"","sources":["../../src/view/compiled.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,+FAA+F;AAC/F,2FAA2F;AAC3F,0FAA0F;AAC1F,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// `@gyral/core/compiled`: the entry the Vite template compiler's output imports `compiled`\n// from (view/01-templates.md \"Compiled\"). Internal: apps never import it themselves, and it is\n// not documented as API. A subpath of its own, so the main entry's API stays as documented\n// and compiled code still shares the one template module with `html` (same package copy).\nexport { compiled, compiledSvg } from './template.js';\n"]}
@@ -1,5 +1,6 @@
1
1
  export { DEV } from '#view-dev';
2
- export { html, compiled, isTemplateResult, templateOf, type TemplateResult } from './template.js';
2
+ export { codeName, docsLink, message, type MessageCode } from './message.js';
3
+ export { html, svg, compiled, compiledSvg, isTemplateResult, templateOf, type TemplateResult, } from './template.js';
3
4
  export { templateElement } from './template-element.js';
4
5
  export { normalize, analyze, type Analysis } from './normalize/normalize.js';
5
6
  export { checkTemplate, type TemplateIssue } from './normalize/check.js';
@@ -12,10 +13,14 @@ export { render, renderBatch } from './render/render.js';
12
13
  export type { Markup, SeenMarkup } from './render/seen.js';
13
14
  export { HydrationMismatch } from './render/mismatch.js';
14
15
  export { each } from './render/list.js';
16
+ export { keyed } from './render/keyed.js';
15
17
  export { raw } from './render/raw.js';
16
18
  export { nothing, type ChildValue, type ListResult, type RawResult } from './render/values.js';
17
19
  export { defineHook } from './render/hook-part.js';
18
- export type { HookAttributes, HookResult, HookSpec } from './render/hooks.js';
20
+ export { useToggles } from './render/toggles.js';
21
+ export { applyToggle } from './render/modal.js';
22
+ export { commitTracked } from './render/dispose.js';
23
+ export { flushHooks, onHookFailure, suspendHooks, useDisposableHooks, type HookAttributes, type HookResult, type HookSpec, } from './render/hooks.js';
19
24
  export { css, isStyleSource, sheetsFor, styleTexts, type CssValue, type StyleSource, type Styles, } from './styles.js';
20
- export { ISLAND_ATTRIBUTE, LIGHT_ATTRIBUTE, SEED_ATTRIBUTE } from './attributes.js';
21
- export { registerServerComponent, registerServerProvider, serverComponent, serverComponents, serverProvider, type ServerComponent, type ServerProvider, type ServerRenderInput, type ServerRendering, } from './registry.js';
25
+ export { ERROR_ATTRIBUTE, ISLAND_ATTRIBUTE, LIGHT_ATTRIBUTE, SEED_ATTRIBUTE, } from './attributes.js';
26
+ export { registerServerComponent, registerServerProvider, serverComponent, serverComponents, serverProvider, serverRegistryVersion, type ServerComponent, type ServerProvider, type ServerRenderInput, type ServerRendering, } from './registry.js';
@@ -1,7 +1,8 @@
1
1
  // The view layer's entry point for the rest of core (ADR 0018 "Where it lives"): code outside
2
2
  // view/ imports only this module. @gyral/core's index re-exports the public part of it.
3
3
  export { DEV } from '#view-dev';
4
- export { html, compiled, isTemplateResult, templateOf } from './template.js';
4
+ export { codeName, docsLink, message } from './message.js';
5
+ export { html, svg, compiled, compiledSvg, isTemplateResult, templateOf, } from './template.js';
5
6
  export { templateElement } from './template-element.js';
6
7
  export { normalize, analyze } from './normalize/normalize.js';
7
8
  export { checkTemplate } from './normalize/check.js';
@@ -12,10 +13,15 @@ export { hydrate } from './render/hydrate.js';
12
13
  export { render, renderBatch } from './render/render.js';
13
14
  export { HydrationMismatch } from './render/mismatch.js';
14
15
  export { each } from './render/list.js';
16
+ export { keyed } from './render/keyed.js';
15
17
  export { raw } from './render/raw.js';
16
18
  export { nothing } from './render/values.js';
17
19
  export { defineHook } from './render/hook-part.js';
20
+ export { useToggles } from './render/toggles.js';
21
+ export { applyToggle } from './render/modal.js';
22
+ export { commitTracked } from './render/dispose.js';
23
+ export { flushHooks, onHookFailure, suspendHooks, useDisposableHooks, } from './render/hooks.js';
18
24
  export { css, isStyleSource, sheetsFor, styleTexts, } from './styles.js';
19
- export { ISLAND_ATTRIBUTE, LIGHT_ATTRIBUTE, SEED_ATTRIBUTE } from './attributes.js';
20
- export { registerServerComponent, registerServerProvider, serverComponent, serverComponents, serverProvider, } from './registry.js';
25
+ export { ERROR_ATTRIBUTE, ISLAND_ATTRIBUTE, LIGHT_ATTRIBUTE, SEED_ATTRIBUTE, } from './attributes.js';
26
+ export { registerServerComponent, registerServerProvider, serverComponent, serverComponents, serverProvider, serverRegistryVersion, } from './registry.js';
21
27
  //# sourceMappingURL=index.js.map