@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,20 +0,0 @@
1
- import { nothing } from 'lit';
2
- import { Directive, type ElementPart, type PartInfo } from 'lit/directive.js';
3
- /**
4
- * Base for element directives (`<input ${invalid(errors)}>`): they act on the element they are
5
- * placed on and render nothing. Subclasses declare their arguments as `Args` and implement
6
- * `apply`. Wrap the class with `directive()` (re-exported from core) to get the template
7
- * function. Element parts are not rendered on the server, so `apply` only runs in the browser.
8
- *
9
- * class Focus extends ElementDirective<[when: boolean]> {
10
- * apply(el: Element, [when]: [boolean]) { if (when && el instanceof HTMLElement) el.focus(); }
11
- * }
12
- * export const focusWhen = directive(Focus);
13
- */
14
- export declare abstract class ElementDirective<Args extends unknown[]> extends Directive {
15
- constructor(info: PartInfo);
16
- /** Called on every render with the directive's current arguments. */
17
- abstract apply(element: Element, args: Args): void;
18
- render(...args: Args): typeof nothing;
19
- update(part: ElementPart, args: Args): typeof nothing;
20
- }
@@ -1,31 +0,0 @@
1
- import { nothing } from 'lit';
2
- import { Directive, PartType } from 'lit/directive.js';
3
- /**
4
- * Base for element directives (`<input ${invalid(errors)}>`): they act on the element they are
5
- * placed on and render nothing. Subclasses declare their arguments as `Args` and implement
6
- * `apply`. Wrap the class with `directive()` (re-exported from core) to get the template
7
- * function. Element parts are not rendered on the server, so `apply` only runs in the browser.
8
- *
9
- * class Focus extends ElementDirective<[when: boolean]> {
10
- * apply(el: Element, [when]: [boolean]) { if (when && el instanceof HTMLElement) el.focus(); }
11
- * }
12
- * export const focusWhen = directive(Focus);
13
- */
14
- export class ElementDirective extends Directive {
15
- constructor(info) {
16
- super(info);
17
- if (info.type !== PartType.ELEMENT) {
18
- throw new Error(`${new.target.name} must be used on an element: <el \${directive(…)}>`);
19
- }
20
- }
21
- // Lit reads the directive's arguments from render(); update() does the work.
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- render(...args) {
24
- return nothing;
25
- }
26
- update(part, args) {
27
- this.apply(part.element, args);
28
- return nothing;
29
- }
30
- }
31
- //# sourceMappingURL=element-directive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"element-directive.js","sourceRoot":"","sources":["../src/element-directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAmC,MAAM,kBAAkB,CAAC;AAExF;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,gBAAyC,SAAQ,SAAS;IAC9E,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,oDAAoD,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;IAKD,6EAA6E;IAC7E,6DAA6D;IACpD,MAAM,CAAC,GAAG,IAAU;QAC3B,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,MAAM,CAAC,IAAiB,EAAE,IAAU;QAC3C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { nothing } from 'lit';\nimport { Directive, PartType, type ElementPart, type PartInfo } from 'lit/directive.js';\n\n/**\n * Base for element directives (`<input ${invalid(errors)}>`): they act on the element they are\n * placed on and render nothing. Subclasses declare their arguments as `Args` and implement\n * `apply`. Wrap the class with `directive()` (re-exported from core) to get the template\n * function. Element parts are not rendered on the server, so `apply` only runs in the browser.\n *\n * class Focus extends ElementDirective<[when: boolean]> {\n * apply(el: Element, [when]: [boolean]) { if (when && el instanceof HTMLElement) el.focus(); }\n * }\n * export const focusWhen = directive(Focus);\n */\nexport abstract class ElementDirective<Args extends unknown[]> extends Directive {\n constructor(info: PartInfo) {\n super(info);\n if (info.type !== PartType.ELEMENT) {\n throw new Error(`${new.target.name} must be used on an element: <el \\${directive(…)}>`);\n }\n }\n\n /** Called on every render with the directive's current arguments. */\n abstract apply(element: Element, args: Args): void;\n\n // Lit reads the directive's arguments from render(); update() does the work.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n override render(...args: Args): typeof nothing {\n return nothing;\n }\n\n override update(part: ElementPart, args: Args): typeof nothing {\n this.apply(part.element, args);\n return nothing;\n }\n}\n"]}
package/dist/invalid.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { ElementDirective } from './element-directive.js';
2
- type Errors = readonly string[] | string | undefined;
3
- /**
4
- * Mirrors model errors to native validity (ADR 0008): sets `setCustomValidity` and
5
- * `aria-invalid`, so `:user-invalid` and native bubbles agree with the model.
6
- *
7
- * The custom error clears when:
8
- * - the control fires `input` or `change` (the user edited it);
9
- * - the bound errors become `undefined` or empty (the model cleared them);
10
- * - a submit finds the error stale: the value changed without an event (set from code, e.g.
11
- * by a test or a script). Then the error is dropped and the form is submitted again once.
12
- *
13
- * An error is applied again only when a new value arrives (keep `fieldErrors()` results in
14
- * state). Element parts don't render on the server, so this only runs in the browser.
15
- */
16
- declare class InvalidDirective extends ElementDirective<[errors?: Errors]> {
17
- #private;
18
- apply(el: Element, [errors]: [errors?: Errors]): void;
19
- }
20
- export declare const invalid: (errors?: Errors) => import("lit/directive.js").DirectiveResult<typeof InvalidDirective>;
21
- export {};
package/dist/invalid.js DELETED
@@ -1,70 +0,0 @@
1
- import { directive } from 'lit/directive.js';
2
- import { ElementDirective } from './element-directive.js';
3
- const isValidatable = (el) => 'setCustomValidity' in el;
4
- const valueOf = (el) => ('value' in el ? el.value : undefined);
5
- const formOf = (el) => {
6
- const form = 'form' in el ? el.form : undefined;
7
- return form instanceof HTMLFormElement ? form : undefined;
8
- };
9
- // Forms with a resubmit already queued: several stale fields in one validation pass resubmit once.
10
- const resubmitting = new WeakSet();
11
- /**
12
- * Mirrors model errors to native validity (ADR 0008): sets `setCustomValidity` and
13
- * `aria-invalid`, so `:user-invalid` and native bubbles agree with the model.
14
- *
15
- * The custom error clears when:
16
- * - the control fires `input` or `change` (the user edited it);
17
- * - the bound errors become `undefined` or empty (the model cleared them);
18
- * - a submit finds the error stale: the value changed without an event (set from code, e.g.
19
- * by a test or a script). Then the error is dropped and the form is submitted again once.
20
- *
21
- * An error is applied again only when a new value arrives (keep `fieldErrors()` results in
22
- * state). Element parts don't render on the server, so this only runs in the browser.
23
- */
24
- class InvalidDirective extends ElementDirective {
25
- #last;
26
- #listening;
27
- apply(el, [errors]) {
28
- if (errors === this.#last)
29
- return;
30
- this.#last = errors;
31
- this.#listening?.abort();
32
- this.#listening = undefined;
33
- const message = typeof errors === 'string' ? errors : (errors ?? []).join(' ');
34
- if (isValidatable(el))
35
- el.setCustomValidity(message);
36
- if (message === '') {
37
- el.removeAttribute('aria-invalid');
38
- return;
39
- }
40
- el.setAttribute('aria-invalid', 'true');
41
- const listening = new AbortController();
42
- this.#listening = listening;
43
- const { signal } = listening;
44
- const rejectedValue = valueOf(el);
45
- const clear = () => {
46
- listening.abort();
47
- if (isValidatable(el))
48
- el.setCustomValidity('');
49
- el.removeAttribute('aria-invalid');
50
- };
51
- el.addEventListener('input', clear, { signal });
52
- el.addEventListener('change', clear, { signal });
53
- el.addEventListener('invalid', (event) => {
54
- if (Object.is(valueOf(el), rejectedValue))
55
- return; // still the rejected value
56
- event.preventDefault(); // no bubble for an error that no longer applies
57
- clear();
58
- const form = formOf(el);
59
- if (form === undefined || resubmitting.has(form))
60
- return;
61
- resubmitting.add(form);
62
- queueMicrotask(() => {
63
- resubmitting.delete(form);
64
- form.requestSubmit();
65
- });
66
- }, { signal });
67
- }
68
- }
69
- export const invalid = directive(InvalidDirective);
70
- //# sourceMappingURL=invalid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invalid.js","sourceRoot":"","sources":["../src/invalid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAQ1D,MAAM,aAAa,GAAG,CAAC,EAAW,EAAqB,EAAE,CAAC,mBAAmB,IAAI,EAAE,CAAC;AAEpF,MAAM,OAAO,GAAG,CAAC,EAAW,EAAW,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAEjF,MAAM,MAAM,GAAG,CAAC,EAAW,EAA+B,EAAE;IAC1D,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,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Aa,CAAC,EAAE,CAAC;gBAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAChD,EAAE,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAChD,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,EAAE,CAAC,gBAAgB,CACjB,SAAS,EACT,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC;gBAAE,OAAO,CAAC,2BAA2B;YAC9E,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,gDAAgD;YACxE,KAAK,EAAE,CAAC;YACR,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;YACxB,IAAI,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,OAAO;YACzD,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACvB,cAAc,CAAC,GAAG,EAAE;gBAClB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC1B,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC,EACD,EAAE,MAAM,EAAE,CACX,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["import { directive } from 'lit/directive.js';\nimport { ElementDirective } from './element-directive.js';\n\ntype Errors = readonly string[] | string | undefined;\n\ninterface Validatable extends Element {\n setCustomValidity(message: string): void;\n}\n\nconst isValidatable = (el: Element): el is Validatable => 'setCustomValidity' in el;\n\nconst valueOf = (el: Element): unknown => ('value' in el ? el.value : undefined);\n\nconst formOf = (el: Element): HTMLFormElement | undefined => {\n const form = 'form' in el ? el.form : undefined;\n return form instanceof HTMLFormElement ? form : undefined;\n};\n\n// Forms with a resubmit already queued: several stale fields in one validation pass resubmit once.\nconst resubmitting = new WeakSet<HTMLFormElement>();\n\n/**\n * Mirrors model errors to native validity (ADR 0008): sets `setCustomValidity` and\n * `aria-invalid`, so `:user-invalid` and native bubbles agree with the model.\n *\n * The custom error clears when:\n * - the control fires `input` or `change` (the user edited it);\n * - the bound errors become `undefined` or empty (the model cleared them);\n * - a submit finds the error stale: the value changed without an event (set from code, e.g.\n * by a test or a script). Then the error is dropped and the form is submitted again once.\n *\n * An error is applied again only when a new value arrives (keep `fieldErrors()` results in\n * state). Element parts don't render on the server, so this only runs in the browser.\n */\nclass InvalidDirective extends ElementDirective<[errors?: Errors]> {\n #last: Errors;\n #listening: AbortController | undefined;\n\n apply(el: Element, [errors]: [errors?: Errors]): void {\n if (errors === this.#last) return;\n this.#last = errors;\n this.#listening?.abort();\n this.#listening = undefined;\n const message = typeof errors === 'string' ? errors : (errors ?? []).join(' ');\n if (isValidatable(el)) el.setCustomValidity(message);\n if (message === '') {\n el.removeAttribute('aria-invalid');\n return;\n }\n el.setAttribute('aria-invalid', 'true');\n\n const listening = new AbortController();\n this.#listening = listening;\n const { signal } = listening;\n const rejectedValue = valueOf(el);\n const clear = (): void => {\n listening.abort();\n if (isValidatable(el)) el.setCustomValidity('');\n el.removeAttribute('aria-invalid');\n };\n el.addEventListener('input', clear, { signal });\n el.addEventListener('change', clear, { signal });\n el.addEventListener(\n 'invalid',\n (event) => {\n if (Object.is(valueOf(el), rejectedValue)) return; // still the rejected value\n event.preventDefault(); // no bubble for an error that no longer applies\n clear();\n const form = formOf(el);\n if (form === undefined || resubmitting.has(form)) return;\n resubmitting.add(form);\n queueMicrotask(() => {\n resubmitting.delete(form);\n form.requestSubmit();\n });\n },\n { signal },\n );\n }\n}\n\nexport const invalid = directive(InvalidDirective);\n"]}
@@ -1,6 +0,0 @@
1
- /** The loaded lit-html versions that have the repeat() leak. */
2
- export declare function leakingLitHtml(versions: readonly string[]): string[];
3
- /** Warns once per page when a leaking lit-html is loaded. */
4
- export declare function warnLeakingLitHtmlOnce(): void;
5
- /** Test hook: allow the warning again. */
6
- export declare function resetLitHtmlWarningForTests(): void;
@@ -1,48 +0,0 @@
1
- // Development-only warning for the lit-html >= 3.3.1 repeat() leak (gyral-9y6, ADR 0015,
2
- // lit/lit#5298): removing repeat() items leaves one comment node per item in the DOM.
3
- // lit-html records every loaded copy's version in `globalThis.litHtmlVersions`. Called from
4
- // devtools.ts, which production builds replace, so this costs nothing in production.
5
- /** First lit-html release with the leak. Raise the upper bound once upstream ships a fix. */
6
- const FIRST_LEAKING = [3, 3, 1];
7
- function parse(version) {
8
- const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
9
- return match === null ? undefined : [Number(match[1]), Number(match[2]), Number(match[3])];
10
- }
11
- function atLeast(version, floor) {
12
- for (let i = 0; i < floor.length; i++) {
13
- const a = version[i] ?? 0;
14
- const b = floor[i] ?? 0;
15
- if (a !== b)
16
- return a > b;
17
- }
18
- return true;
19
- }
20
- /** The loaded lit-html versions that have the repeat() leak. */
21
- export function leakingLitHtml(versions) {
22
- return versions.filter((v) => {
23
- const parsed = parse(v);
24
- return parsed !== undefined && parsed[0] === 3 && atLeast(parsed, FIRST_LEAKING);
25
- });
26
- }
27
- let warned = false;
28
- /** Warns once per page when a leaking lit-html is loaded. */
29
- export function warnLeakingLitHtmlOnce() {
30
- if (warned)
31
- return;
32
- warned = true;
33
- const versions = globalThis.litHtmlVersions;
34
- if (!Array.isArray(versions))
35
- return;
36
- const leaking = leakingLitHtml(versions.filter((v) => typeof v === 'string'));
37
- if (leaking.length === 0)
38
- return;
39
- console.warn(`gyral: lit-html ${leaking.join(', ')} leaks one DOM comment per removed repeat() item ` +
40
- '(https://github.com/lit/lit/issues/5298). Pin lit-html to 3.3.0 with an override: ' +
41
- 'https://github.com/gyraljs/gyral/blob/main/docs/references/consumer-setup.md' +
42
- '#known-issue-lit-html-331-list-leak (development builds only).');
43
- }
44
- /** Test hook: allow the warning again. */
45
- export function resetLitHtmlWarningForTests() {
46
- warned = false;
47
- }
48
- //# sourceMappingURL=lit-html-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lit-html-check.js","sourceRoot":"","sources":["../src/lit-html-check.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,sFAAsF;AACtF,4FAA4F;AAC5F,qFAAqF;AAErF,6FAA6F;AAC7F,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAC;AAEzC,SAAS,KAAK,CAAC,OAAe;IAC5B,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,OAAO,CAAC,OAA0B,EAAE,KAAwB;IACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,cAAc,CAAC,QAA2B;IACxD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB;IACpC,IAAI,MAAM;QAAE,OAAO;IACnB,MAAM,GAAG,IAAI,CAAC;IACd,MAAM,QAAQ,GAAI,UAA4C,CAAC,eAAe,CAAC;IAC/E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAAE,OAAO;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC;IAC3F,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACjC,OAAO,CAAC,IAAI,CACV,mBAAmB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,mDAAmD;QACtF,oFAAoF;QACpF,8EAA8E;QAC9E,gEAAgE,CACnE,CAAC;AACJ,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,2BAA2B;IACzC,MAAM,GAAG,KAAK,CAAC;AACjB,CAAC","sourcesContent":["// Development-only warning for the lit-html >= 3.3.1 repeat() leak (gyral-9y6, ADR 0015,\n// lit/lit#5298): removing repeat() items leaves one comment node per item in the DOM.\n// lit-html records every loaded copy's version in `globalThis.litHtmlVersions`. Called from\n// devtools.ts, which production builds replace, so this costs nothing in production.\n\n/** First lit-html release with the leak. Raise the upper bound once upstream ships a fix. */\nconst FIRST_LEAKING = [3, 3, 1] as const;\n\nfunction parse(version: string): readonly number[] | undefined {\n const match = /^(\\d+)\\.(\\d+)\\.(\\d+)/.exec(version);\n return match === null ? undefined : [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction atLeast(version: readonly number[], floor: readonly number[]): boolean {\n for (let i = 0; i < floor.length; i++) {\n const a = version[i] ?? 0;\n const b = floor[i] ?? 0;\n if (a !== b) return a > b;\n }\n return true;\n}\n\n/** The loaded lit-html versions that have the repeat() leak. */\nexport function leakingLitHtml(versions: readonly string[]): string[] {\n return versions.filter((v) => {\n const parsed = parse(v);\n return parsed !== undefined && parsed[0] === 3 && atLeast(parsed, FIRST_LEAKING);\n });\n}\n\nlet warned = false;\n\n/** Warns once per page when a leaking lit-html is loaded. */\nexport function warnLeakingLitHtmlOnce(): void {\n if (warned) return;\n warned = true;\n const versions = (globalThis as { litHtmlVersions?: unknown }).litHtmlVersions;\n if (!Array.isArray(versions)) return;\n const leaking = leakingLitHtml(versions.filter((v): v is string => typeof v === 'string'));\n if (leaking.length === 0) return;\n console.warn(\n `gyral: lit-html ${leaking.join(', ')} leaks one DOM comment per removed repeat() item ` +\n '(https://github.com/lit/lit/issues/5298). Pin lit-html to 3.3.0 with an override: ' +\n 'https://github.com/gyraljs/gyral/blob/main/docs/references/consumer-setup.md' +\n '#known-issue-lit-html-331-list-leak (development builds only).',\n );\n}\n\n/** Test hook: allow the warning again. */\nexport function resetLitHtmlWarningForTests(): void {\n warned = false;\n}\n"]}
@@ -1,22 +0,0 @@
1
- import { Directive, type AttributePart, type PartInfo } from 'lit/directive.js';
2
- /**
3
- * A boolean that is right both in server-rendered markup and in the live DOM (ADR 0012).
4
- * Use it in a boolean attribute binding:
5
- *
6
- * <input type="checkbox" ?checked=${liveBoolean(s.on)} />
7
- * <option ?selected=${liveBoolean(s.sort === 'price')}>Price</option>
8
- *
9
- * - On the server it renders the attribute when true and omits it when false.
10
- * (A property binding, `.checked=${false}`, is serialized by Lit SSR as `checked="false"`,
11
- * which *checks* the box. Never bind boolean form state as a property in SSR'd views.)
12
- * - In the browser it also sets the element's property of the same name (`checked`,
13
- * `selected`, `open`, …), so the control follows model state even after the user has
14
- * changed it. The attribute alone stops controlling `checked` once a box has been clicked.
15
- */
16
- declare class LiveBoolean extends Directive {
17
- constructor(info: PartInfo);
18
- render(value: boolean): boolean;
19
- update(part: AttributePart, [value]: [boolean]): boolean;
20
- }
21
- export declare const liveBoolean: (value: boolean) => import("lit/directive.js").DirectiveResult<typeof LiveBoolean>;
22
- export {};
@@ -1,34 +0,0 @@
1
- import { Directive, directive, PartType, } from 'lit/directive.js';
2
- /**
3
- * A boolean that is right both in server-rendered markup and in the live DOM (ADR 0012).
4
- * Use it in a boolean attribute binding:
5
- *
6
- * <input type="checkbox" ?checked=${liveBoolean(s.on)} />
7
- * <option ?selected=${liveBoolean(s.sort === 'price')}>Price</option>
8
- *
9
- * - On the server it renders the attribute when true and omits it when false.
10
- * (A property binding, `.checked=${false}`, is serialized by Lit SSR as `checked="false"`,
11
- * which *checks* the box. Never bind boolean form state as a property in SSR'd views.)
12
- * - In the browser it also sets the element's property of the same name (`checked`,
13
- * `selected`, `open`, …), so the control follows model state even after the user has
14
- * changed it. The attribute alone stops controlling `checked` once a box has been clicked.
15
- */
16
- class LiveBoolean extends Directive {
17
- constructor(info) {
18
- super(info);
19
- if (info.type !== PartType.BOOLEAN_ATTRIBUTE) {
20
- throw new Error('liveBoolean() must be used in a boolean attribute: ?checked=${…}');
21
- }
22
- }
23
- render(value) {
24
- return value;
25
- }
26
- update(part, [value]) {
27
- const element = part.element;
28
- if (part.name in part.element && element[part.name] !== value)
29
- element[part.name] = value;
30
- return value;
31
- }
32
- }
33
- export const liveBoolean = directive(LiveBoolean);
34
- //# sourceMappingURL=live-boolean.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"live-boolean.js","sourceRoot":"","sources":["../src/live-boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,GAGT,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAY,SAAQ,SAAS;IACjC,YAAY,IAAc;QACxB,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,iBAAiB,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;IAEQ,MAAM,CAAC,KAAc;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAEQ,MAAM,CAAC,IAAmB,EAAE,CAAC,KAAK,CAAY;QACrD,MAAM,OAAO,GAAG,IAAI,CAAC,OAA6C,CAAC;QACnE,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK;YAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC1F,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import {\n Directive,\n directive,\n PartType,\n type AttributePart,\n type PartInfo,\n} from 'lit/directive.js';\n\n/**\n * A boolean that is right both in server-rendered markup and in the live DOM (ADR 0012).\n * Use it in a boolean attribute binding:\n *\n * <input type=\"checkbox\" ?checked=${liveBoolean(s.on)} />\n * <option ?selected=${liveBoolean(s.sort === 'price')}>Price</option>\n *\n * - On the server it renders the attribute when true and omits it when false.\n * (A property binding, `.checked=${false}`, is serialized by Lit SSR as `checked=\"false\"`,\n * which *checks* the box. Never bind boolean form state as a property in SSR'd views.)\n * - In the browser it also sets the element's property of the same name (`checked`,\n * `selected`, `open`, …), so the control follows model state even after the user has\n * changed it. The attribute alone stops controlling `checked` once a box has been clicked.\n */\nclass LiveBoolean extends Directive {\n constructor(info: PartInfo) {\n super(info);\n if (info.type !== PartType.BOOLEAN_ATTRIBUTE) {\n throw new Error('liveBoolean() must be used in a boolean attribute: ?checked=${…}');\n }\n }\n\n override render(value: boolean): boolean {\n return value;\n }\n\n override update(part: AttributePart, [value]: [boolean]): boolean {\n const element = part.element as unknown as Record<string, unknown>;\n if (part.name in part.element && element[part.name] !== value) element[part.name] = value;\n return value;\n }\n}\n\nexport const liveBoolean = directive(LiveBoolean);\n"]}
package/dist/random.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { type Command, type Driver } from './command.js';
2
- export interface RandomInput {
3
- /** How many numbers to draw. */
4
- readonly count: number;
5
- }
6
- /** Uniform numbers in [0, 1). Substitute it in tests: `el.drivers = { random: fake }`. */
7
- export declare const randomDriver: Driver<RandomInput, readonly number[]>;
8
- /** Draws `count` uniform numbers in [0, 1) and turns them into a message. */
9
- export declare function random<M>(count: number, toMsg: (values: readonly number[]) => M | undefined): Command<M>;
10
- /** Maps a uniform number in [0, 1) to an integer in `min..max` (inclusive). Pure. */
11
- export declare const toInt: (u: number, min: number, max: number) => number;
12
- /** Draws one integer in `min..max` (inclusive). */
13
- export declare function randomInt<M>(min: number, max: number, toMsg: (value: number) => M | undefined): Command<M>;
package/dist/random.js DELETED
@@ -1,19 +0,0 @@
1
- // Randomness as an effect (gyral-czi.10): reducers ask for random numbers with a command,
2
- // so models stay pure and tests substitute a deterministic driver by name.
3
- import { command, defineDriver } from './command.js';
4
- /** Uniform numbers in [0, 1). Substitute it in tests: `el.drivers = { random: fake }`. */
5
- export const randomDriver = defineDriver({
6
- name: 'random',
7
- run: ({ count }) => Array.from({ length: count }, () => Math.random()),
8
- });
9
- /** Draws `count` uniform numbers in [0, 1) and turns them into a message. */
10
- export function random(count, toMsg) {
11
- return command(randomDriver, { count }, { onSuccess: toMsg });
12
- }
13
- /** Maps a uniform number in [0, 1) to an integer in `min..max` (inclusive). Pure. */
14
- export const toInt = (u, min, max) => min + Math.min(max - min, Math.floor(u * (max - min + 1)));
15
- /** Draws one integer in `min..max` (inclusive). */
16
- export function randomInt(min, max, toMsg) {
17
- return random(1, ([u = 0]) => toMsg(toInt(u, min, max)));
18
- }
19
- //# sourceMappingURL=random.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random.js","sourceRoot":"","sources":["../src/random.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,2EAA2E;AAC3E,OAAO,EAAE,OAAO,EAAE,YAAY,EAA6B,MAAM,cAAc,CAAC;AAOhF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,YAAY,GAA2C,YAAY,CAAC;IAC/E,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,CAAC,EAAE,KAAK,EAAe,EAAqB,EAAE,CACjD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;CACrD,CAAC,CAAC;AAEH,6EAA6E;AAC7E,MAAM,UAAU,MAAM,CACpB,KAAa,EACb,KAAmD;IAEnD,OAAO,OAAO,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW,EAAU,EAAE,CACnE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7D,mDAAmD;AACnD,MAAM,UAAU,SAAS,CACvB,GAAW,EACX,GAAW,EACX,KAAuC;IAEvC,OAAO,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["// Randomness as an effect (gyral-czi.10): reducers ask for random numbers with a command,\n// so models stay pure and tests substitute a deterministic driver by name.\nimport { command, defineDriver, type Command, type Driver } from './command.js';\n\nexport interface RandomInput {\n /** How many numbers to draw. */\n readonly count: number;\n}\n\n/** Uniform numbers in [0, 1). Substitute it in tests: `el.drivers = { random: fake }`. */\nexport const randomDriver: Driver<RandomInput, readonly number[]> = defineDriver({\n name: 'random',\n run: ({ count }: RandomInput): readonly number[] =>\n Array.from({ length: count }, () => Math.random()),\n});\n\n/** Draws `count` uniform numbers in [0, 1) and turns them into a message. */\nexport function random<M>(\n count: number,\n toMsg: (values: readonly number[]) => M | undefined,\n): Command<M> {\n return command(randomDriver, { count }, { onSuccess: toMsg });\n}\n\n/** Maps a uniform number in [0, 1) to an integer in `min..max` (inclusive). Pure. */\nexport const toInt = (u: number, min: number, max: number): number =>\n min + Math.min(max - min, Math.floor(u * (max - min + 1)));\n\n/** Draws one integer in `min..max` (inclusive). */\nexport function randomInt<M>(\n min: number,\n max: number,\n toMsg: (value: number) => M | undefined,\n): Command<M> {\n return random(1, ([u = 0]) => toMsg(toInt(u, min, max)));\n}\n"]}
package/dist/styles.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { type CSSResultGroup, type CSSResultOrNative } from 'lit';
2
- /**
3
- * What `spec.styles` accepts:
4
- * - `css` tagged templates (Lit's `CSSResult`);
5
- * - plain strings, e.g. a stylesheet module shared with the document (`import base from
6
- * './base.css?raw'`). Strings are trusted CSS from your own code, never user input;
7
- * - `CSSStyleSheet` instances (constructable stylesheets, shared across components);
8
- * - arrays of any of these, nested freely.
9
- */
10
- export type Styles = CSSResultOrNative | string | readonly Styles[];
11
- /** Normalizes `Styles` into what Lit's `static styles` expects. */
12
- export declare function toCssResultGroup(styles: Styles): CSSResultGroup;
package/dist/styles.js DELETED
@@ -1,11 +0,0 @@
1
- // Component styles (gyral-czi.24): `css` templates, plain strings or constructed sheets.
2
- import { unsafeCSS } from 'lit';
3
- /** Normalizes `Styles` into what Lit's `static styles` expects. */
4
- export function toCssResultGroup(styles) {
5
- if (typeof styles === 'string')
6
- return unsafeCSS(styles);
7
- if (Array.isArray(styles))
8
- return styles.map(toCssResultGroup);
9
- return styles;
10
- }
11
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,SAAS,EAA+C,MAAM,KAAK,CAAC;AAY7E,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAQ,MAA4B,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACtF,OAAO,MAA2B,CAAC;AACrC,CAAC","sourcesContent":["// Component styles (gyral-czi.24): `css` templates, plain strings or constructed sheets.\nimport { unsafeCSS, type CSSResultGroup, type CSSResultOrNative } from 'lit';\n\n/**\n * What `spec.styles` accepts:\n * - `css` tagged templates (Lit's `CSSResult`);\n * - plain strings, e.g. a stylesheet module shared with the document (`import base from\n * './base.css?raw'`). Strings are trusted CSS from your own code, never user input;\n * - `CSSStyleSheet` instances (constructable stylesheets, shared across components);\n * - arrays of any of these, nested freely.\n */\nexport type Styles = CSSResultOrNative | string | readonly Styles[];\n\n/** Normalizes `Styles` into what Lit's `static styles` expects. */\nexport function toCssResultGroup(styles: Styles): CSSResultGroup {\n if (typeof styles === 'string') return unsafeCSS(styles);\n if (Array.isArray(styles)) return (styles as readonly Styles[]).map(toCssResultGroup);\n return styles as CSSResultOrNative;\n}\n"]}
@@ -1,7 +0,0 @@
1
- /** Minified copy of template strings (same length, bindings unmoved). Idempotent. */
2
- export declare function minifyStrings(strings: readonly string[]): string[];
3
- /**
4
- * The minified TemplateStringsArray for a call site. Cached by identity, so Lit's own template
5
- * cache (keyed by the strings array) still hits once per call site.
6
- */
7
- export declare function minifyTemplate(strings: TemplateStringsArray): TemplateStringsArray;
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-whitespace.js","sourceRoot":"","sources":["../src/template-whitespace.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,8FAA8F;AAC9F,iGAAiG;AACjG,kGAAkG;AAClG,+FAA+F;AAC/F,+FAA+F;AAC/F,yDAAyD;AACzD,EAAE;AACF,qFAAqF;AACrF,4FAA4F;AAC5F,6FAA6F;AAC7F,yFAAyF;AACzF,yCAAyC;AACzC,6FAA6F;AAC7F,mDAAmD;AACnD,0FAA0F;AAC1F,6FAA6F;AAC7F,uEAAuE;AACvE,0EAA0E;AAE1E,+EAA+E;AAC/E,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,CACE,4FAA4F;IAC5F,4FAA4F;IAC5F,6FAA6F;IAC7F,0BAA0B;IAC1B,wEAAwE;IACxE,sFAAsF;IACtF,8CAA8C,CAC/C,CAAC,KAAK,CAAC,GAAG,CAAC,CACb,CAAC;AAEF,6FAA6F;AAC7F,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,MAAM,QAAQ,GAAG,KAAK,CAAC;AAKvB;;;GAGG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjD;;;GAGG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,MAAe;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACrC,OAAO,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9D,CAAC;AAED,MAAM,EAAE,GAAG,gBAAgB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,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Template whitespace minification (gyral-9rf, ADR 0016 addendum).\n//\n// lit-html keeps every newline and indent between tags as a DOM text node; compilers (Svelte,\n// Solid, JSX) drop them. In a benchmark table row that is 12 extra nodes out of 25, and removing\n// them made create/replace/clear 11-24% faster (gyral-1kq). Gyral's `html` and `svg` tags run the\n// template strings through `minifyTemplate()` once per call site (cached by strings identity),\n// so the server and the browser always build the same template: hydration digests match in any\n// toolchain (Vite, tsx, plain Node), with no build step.\n//\n// Rules (the same text everywhere, documented in docs/references/consumer-setup.md):\n// - Whitespace-only text that contains a newline is removed when it sits next to a template\n// edge, a block-level tag, or the inside edge of a <button>/<select> (CSS never renders it\n// there). Between two inline neighbours (phrasing elements, custom elements, bindings,\n// comments) it collapses to one space.\n// - Other runs of whitespace in text collapse to one space; a leading or trailing run with a\n// newline next to one of those edges is removed.\n// - <pre>, <textarea>, <script>, <style> and <title> contents, tags and attribute values,\n// and comments are copied unchanged. Binding positions never move: the result has the same\n// number of strings, so Lit parts and SSR hydration markers line up.\n// The function is idempotent: minifying minified strings changes nothing.\n\n/** Elements whose box is block-level (or never laid out inline) by default. */\nconst BLOCK = new Set(\n (\n 'address article aside blockquote body caption col colgroup datalist dd details dialog div ' +\n 'dl dt fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html ' +\n 'legend li main menu nav ol optgroup option p pre search section select summary table tbody ' +\n 'td tfoot th thead tr ul ' +\n // SVG containers and shapes: whitespace between them is never rendered.\n 'circle clippath defs ellipse g line lineargradient marker mask path pattern polygon ' +\n 'polyline radialgradient rect stop symbol use'\n ).split(' '),\n);\n\n/** Elements whose text content is copied verbatim (whitespace is meaningful or raw text). */\nconst RAW_TEXT = new Set(['script', 'style', 'textarea', 'title']);\nconst PRESERVE = 'pre';\n\n/** What sits on one side of a text chunk. */\ntype Edge = 'template' | 'inline' | 'block';\n\n/**\n * Inline-block controls: they sit inline among their neighbours, but whitespace at the start or\n * end of their own content is never rendered (it is at the edge of their own line box).\n */\nconst INLINE_BOX = new Set(['button', 'select']);\n\n/**\n * The edge a tag makes for the text next to it. `inside` is true when the text is inside the\n * element (after its start tag, or before its end tag).\n */\nfunction edgeOfTag(name: string, inside: boolean): Edge {\n const lower = name.toLowerCase();\n if (BLOCK.has(lower)) return 'block';\n return inside && INLINE_BOX.has(lower) ? 'block' : 'inline';\n}\n\nconst WS = /^[ \\t\\n\\r\\f]*$/;\nconst RUN = /[ \\t\\n\\r\\f]+/g;\n\nfunction minifyChunk(text: string, left: Edge, right: Edge): string {\n if (text === '') return text;\n if (WS.test(text)) {\n const removable =\n /[\\n\\r]/.test(text) &&\n (left === 'template' || right === 'template' || left === 'block' || right === 'block');\n return removable ? '' : ' ';\n }\n // Mixed text: a leading or trailing run with a newline next to a removable edge goes too.\n const dropStart = left !== 'inline' && /^[ \\t\\f]*[\\n\\r]/.test(text);\n const dropEnd = right !== 'inline' && /[\\n\\r][ \\t\\n\\r\\f]*$/.test(text);\n let body = text.replace(RUN, ' ');\n if (dropStart) body = body.replace(/^ /, '');\n if (dropEnd) body = body.replace(/ $/, '');\n return body;\n}\n\nconst Mode = { Text: 0, Tag: 1, Comment: 2, RawText: 3 } as const;\ntype Mode = (typeof Mode)[keyof typeof Mode];\n\ninterface Scan {\n mode: Mode;\n /** Quote char while inside an attribute value in a tag, else ''. */\n quote: string;\n /** Name of the tag being read (lower case), and whether it is a closing tag. */\n tagName: string;\n closing: boolean;\n /** Raw-text element we are inside (its contents are copied verbatim). */\n rawName: string;\n /** Depth of open <pre> elements: text is copied verbatim while > 0. */\n preDepth: number;\n /** Edge type of the boundary before the current text chunk. */\n left: Edge;\n}\n\nconst TAG_START = /^<(\\/?)([A-Za-z!?][^\\s/>]*)/;\n\n/** Minify one segment, carrying the HTML scan state across bindings. */\nfunction minifySegment(segment: string, state: Scan, last: boolean): string {\n let out = '';\n let chunk = '';\n const flushText = (right: Edge): void => {\n out += state.preDepth > 0 ? chunk : minifyChunk(chunk, state.left, right);\n chunk = '';\n };\n let i = 0;\n while (i < segment.length) {\n const ch = segment.charAt(i);\n if (state.mode === Mode.Comment) {\n if (segment.startsWith('-->', i)) {\n out += '-->';\n i += 3;\n state.mode = Mode.Text;\n state.left = 'inline';\n } else {\n out += ch;\n i += 1;\n }\n continue;\n }\n if (state.mode === Mode.RawText) {\n const close = `</${state.rawName}`;\n if (segment.slice(i, i + close.length).toLowerCase() === close) {\n state.mode = Mode.Text;\n state.left = 'inline';\n continue; // the closing tag is read in Text mode\n }\n out += ch;\n i += 1;\n continue;\n }\n if (state.mode === Mode.Tag) {\n out += ch;\n i += 1;\n if (state.quote !== '') {\n if (ch === state.quote) state.quote = '';\n } else if (ch === '\"' || ch === \"'\") {\n state.quote = ch;\n } else if (ch === '>') {\n endTag(state, out.endsWith('/>'));\n }\n continue;\n }\n // Text mode.\n if (ch === '<' && segment.startsWith('<!--', i)) {\n flushText('inline');\n state.mode = Mode.Comment;\n out += '<!--';\n i += 4;\n continue;\n }\n const tag = ch === '<' ? TAG_START.exec(segment.slice(i)) : null;\n if (tag !== null) {\n const name = (tag[2] ?? '').toLowerCase();\n const closing = tag[1] === '/';\n flushText(edgeOfTag(name, closing));\n state.closing = closing;\n state.tagName = name;\n state.mode = Mode.Tag;\n out += tag[0];\n i += tag[0].length;\n continue;\n }\n chunk += ch;\n i += 1;\n }\n if (state.mode === Mode.Text) {\n flushText(last ? 'template' : 'inline');\n state.left = 'inline'; // the next segment starts after a binding\n }\n return out;\n}\n\nfunction endTag(state: Scan, selfClosing: boolean): void {\n const name = state.tagName;\n state.mode = Mode.Text;\n state.left = edgeOfTag(name, !state.closing && !selfClosing);\n if (name === PRESERVE) {\n if (state.closing) state.preDepth = Math.max(0, state.preDepth - 1);\n else if (!selfClosing) state.preDepth += 1;\n }\n if (!state.closing && !selfClosing && RAW_TEXT.has(name)) {\n state.mode = Mode.RawText;\n state.rawName = name;\n }\n}\n\n/** Minified copy of template strings (same length, bindings unmoved). Idempotent. */\nexport function minifyStrings(strings: readonly string[]): string[] {\n const state: Scan = {\n mode: Mode.Text,\n quote: '',\n tagName: '',\n closing: false,\n rawName: '',\n preDepth: 0,\n left: 'template',\n };\n return strings.map((segment, index) =>\n minifySegment(segment, state, index === strings.length - 1),\n );\n}\n\nconst cache = new WeakMap<TemplateStringsArray, TemplateStringsArray>();\n\n/**\n * The minified TemplateStringsArray for a call site. Cached by identity, so Lit's own template\n * cache (keyed by the strings array) still hits once per call site.\n */\nexport function minifyTemplate(strings: TemplateStringsArray): TemplateStringsArray {\n const cached = cache.get(strings);\n if (cached !== undefined) return cached;\n const minified = minifyStrings(strings);\n // Lit accepts only arrays with an own `raw` field (its anti-spoofing check), as lit/static-html\n // builds them. Cooked strings are what Lit reads; `raw` mirrors them.\n const result = Object.freeze(\n Object.assign(minified, { raw: Object.freeze([...minified]) }),\n ) as unknown as TemplateStringsArray;\n cache.set(strings, result);\n return result;\n}\n"]}
@@ -1,5 +0,0 @@
1
- import { type TemplateResult } from 'lit';
2
- /** Lit's `html`, with indentation whitespace between tags removed. */
3
- export declare function html(strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<1>;
4
- /** Lit's `svg`, with indentation whitespace between elements removed. */
5
- export declare function svg(strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<2>;
package/dist/templates.js DELETED
@@ -1,15 +0,0 @@
1
- // Gyral's `html` and `svg` template tags: Lit's, with template whitespace minified once per call
2
- // site (template-whitespace.ts, gyral-9rf). Server and browser run the same code, so the
3
- // templates (and their hydration digests) are identical in every toolchain. For exact
4
- // whitespace outside <pre>/<textarea>, import `html` from 'lit' instead.
5
- import { html as litHtml, svg as litSvg } from 'lit';
6
- import { minifyTemplate } from './template-whitespace.js';
7
- /** Lit's `html`, with indentation whitespace between tags removed. */
8
- export function html(strings, ...values) {
9
- return litHtml(minifyTemplate(strings), ...values);
10
- }
11
- /** Lit's `svg`, with indentation whitespace between elements removed. */
12
- export function svg(strings, ...values) {
13
- return litSvg(minifyTemplate(strings), ...values);
14
- }
15
- //# sourceMappingURL=templates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,yFAAyF;AACzF,sFAAsF;AACtF,yEAAyE;AACzE,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,GAAG,IAAI,MAAM,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,sEAAsE;AACtE,MAAM,UAAU,IAAI,CAAC,OAA6B,EAAE,GAAG,MAAiB;IACtE,OAAO,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAiB;IACrE,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Gyral's `html` and `svg` template tags: Lit's, with template whitespace minified once per call\n// site (template-whitespace.ts, gyral-9rf). Server and browser run the same code, so the\n// templates (and their hydration digests) are identical in every toolchain. For exact\n// whitespace outside <pre>/<textarea>, import `html` from 'lit' instead.\nimport { html as litHtml, svg as litSvg, type TemplateResult } from 'lit';\nimport { minifyTemplate } from './template-whitespace.js';\n\n/** Lit's `html`, with indentation whitespace between tags removed. */\nexport function html(strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<1> {\n return litHtml(minifyTemplate(strings), ...values);\n}\n\n/** Lit's `svg`, with indentation whitespace between elements removed. */\nexport function svg(strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<2> {\n return litSvg(minifyTemplate(strings), ...values);\n}\n"]}
@@ -1,26 +0,0 @@
1
- import { Directive, type ChildPart, type PartInfo } from 'lit/directive.js';
2
- export type TextareaAttribute = string | number | boolean | null | undefined;
3
- export interface TextareaOptions {
4
- /** The model's value. Applied to the live element only when the model changes. */
5
- readonly value: string;
6
- /** Attributes such as name, id, rows, required, maxlength, data-intent, aria-invalid. */
7
- readonly attrs?: Readonly<Record<string, TextareaAttribute>>;
8
- }
9
- /** The markup the server writes, and the client's first render: escaped, no bindings inside. */
10
- export declare function textareaMarkup({ value, attrs }: TextareaOptions): string;
11
- declare class TextareaDirective extends Directive {
12
- #private;
13
- constructor(info: PartInfo);
14
- render(options: TextareaOptions): unknown;
15
- update(part: ChildPart, [options]: [TextareaOptions]): unknown;
16
- }
17
- /**
18
- * A `<textarea>` whose content comes from the model, safe for SSR and hydration:
19
- *
20
- * ${textarea({ value: s.message, attrs: { name: 'message', rows: 5, required: true,
21
- * 'data-intent': i.Message } })}
22
- *
23
- * Text typed before or after hydration is kept until the model's value changes.
24
- */
25
- export declare const textarea: (options: TextareaOptions) => import("lit/directive.js").DirectiveResult<typeof TextareaDirective>;
26
- export {};
package/dist/textarea.js DELETED
@@ -1,85 +0,0 @@
1
- // <textarea> support (gyral-czi.34). Lit can't bind inside <textarea>: its content is raw
2
- // text, so `html\`<textarea>${v}</textarea>\`` throws during SSR ("Unexpected final
3
- // partIndex") and never updates in the browser. `textarea()` renders the element as a static,
4
- // escaped template (correct no-JS markup and a hydration match), then keeps it in sync by
5
- // setting properties and attributes on the same element.
6
- import { noChange } from 'lit';
7
- import { Directive, directive, PartType } from 'lit/directive.js';
8
- import { html as staticHtml, unsafeStatic } from 'lit/static-html.js';
9
- const escapeText = (s) => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
10
- const escapeAttr = (s) => escapeText(s).replace(/"/g, '&quot;');
11
- const ATTR_NAME = /^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/;
12
- function attrMarkup(attrs) {
13
- return Object.entries(attrs ?? {})
14
- .map(([name, value]) => {
15
- if (!ATTR_NAME.test(name))
16
- throw new Error(`textarea(): invalid attribute name "${name}"`);
17
- if (value === false || value === null || value === undefined)
18
- return '';
19
- return value === true ? ` ${name}` : ` ${name}="${escapeAttr(String(value))}"`;
20
- })
21
- .join('');
22
- }
23
- /** The markup the server writes, and the client's first render: escaped, no bindings inside. */
24
- export function textareaMarkup({ value, attrs }) {
25
- return `<textarea${attrMarkup(attrs)}>${escapeText(value)}</textarea>`;
26
- }
27
- function findTextarea(part) {
28
- for (let node = part.startNode?.nextSibling; node && node !== part.endNode; node = node.nextSibling) {
29
- if (node instanceof HTMLTextAreaElement)
30
- return node;
31
- }
32
- return undefined;
33
- }
34
- function syncAttributes(el, attrs) {
35
- for (const [name, value] of Object.entries(attrs ?? {})) {
36
- if (value === false || value === null || value === undefined)
37
- el.removeAttribute(name);
38
- else
39
- el.setAttribute(name, value === true ? '' : String(value));
40
- }
41
- }
42
- class TextareaDirective extends Directive {
43
- /** The model value last applied, so typing isn't overwritten by an unchanged model. */
44
- #applied;
45
- constructor(info) {
46
- super(info);
47
- if (info.type !== PartType.CHILD) {
48
- throw new Error('textarea() must be used in a child position: html`${textarea({…})}`');
49
- }
50
- }
51
- render(options) {
52
- return staticHtml `${unsafeStatic(textareaMarkup(options))}`;
53
- }
54
- update(part, [options]) {
55
- const el = findTextarea(part);
56
- if (el === undefined) {
57
- // First render (client) or hydration (server markup already in place): same template.
58
- this.#applied = options.value;
59
- return this.render(options);
60
- }
61
- syncAttributes(el, options.attrs);
62
- if (this.#applied === undefined) {
63
- // Hydration: the server's element is already here. Keep whatever the user typed before
64
- // the script loaded; only later model changes write the value.
65
- this.#applied = options.value;
66
- return noChange;
67
- }
68
- if (options.value !== this.#applied) {
69
- this.#applied = options.value;
70
- if (el.value !== options.value)
71
- el.value = options.value;
72
- }
73
- return noChange;
74
- }
75
- }
76
- /**
77
- * A `<textarea>` whose content comes from the model, safe for SSR and hydration:
78
- *
79
- * ${textarea({ value: s.message, attrs: { name: 'message', rows: 5, required: true,
80
- * 'data-intent': i.Message } })}
81
- *
82
- * Text typed before or after hydration is kept until the model's value changes.
83
- */
84
- export const textarea = directive(TextareaDirective);
85
- //# sourceMappingURL=textarea.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../src/textarea.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,oFAAoF;AACpF,8FAA8F;AAC9F,0FAA0F;AAC1F,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAiC,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAWtE,MAAM,UAAU,GAAG,CAAC,CAAS,EAAU,EAAE,CACvC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACvE,MAAM,UAAU,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChF,MAAM,SAAS,GAAG,8BAA8B,CAAC;AAEjD,SAAS,UAAU,CAAC,KAA+B;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QACrB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,GAAG,CAAC,CAAC;QAC3F,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACxE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,E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CAAC,KAAK,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAEQ,MAAM,CAAC,OAAwB;QACtC,OAAO,UAAU,CAAA,GAAG,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;IAC9D,CAAC;IAEQ,MAAM,CAAC,IAAe,EAAE,CAAC,OAAO,CAAoB;QAC3D,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACrB,sFAAsF;YACtF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;YAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACD,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,uFAAuF;YACvF,+DAA+D;YAC/D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;YAC9B,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;YAC9B,IAAI,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK;gBAAE,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3D,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["// <textarea> support (gyral-czi.34). Lit can't bind inside <textarea>: its content is raw\n// text, so `html\\`<textarea>${v}</textarea>\\`` throws during SSR (\"Unexpected final\n// partIndex\") and never updates in the browser. `textarea()` renders the element as a static,\n// escaped template (correct no-JS markup and a hydration match), then keeps it in sync by\n// setting properties and attributes on the same element.\nimport { noChange } from 'lit';\nimport { Directive, directive, PartType, type ChildPart, type PartInfo } from 'lit/directive.js';\nimport { html as staticHtml, unsafeStatic } from 'lit/static-html.js';\n\nexport type TextareaAttribute = string | number | boolean | null | undefined;\n\nexport interface TextareaOptions {\n /** The model's value. Applied to the live element only when the model changes. */\n readonly value: string;\n /** Attributes such as name, id, rows, required, maxlength, data-intent, aria-invalid. */\n readonly attrs?: Readonly<Record<string, TextareaAttribute>>;\n}\n\nconst escapeText = (s: string): string =>\n s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\nconst escapeAttr = (s: string): string => escapeText(s).replace(/\"/g, '&quot;');\nconst ATTR_NAME = /^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/;\n\nfunction attrMarkup(attrs: TextareaOptions['attrs']): string {\n return Object.entries(attrs ?? {})\n .map(([name, value]) => {\n if (!ATTR_NAME.test(name)) throw new Error(`textarea(): invalid attribute name \"${name}\"`);\n if (value === false || value === null || value === undefined) return '';\n return value === true ? ` ${name}` : ` ${name}=\"${escapeAttr(String(value))}\"`;\n })\n .join('');\n}\n\n/** The markup the server writes, and the client's first render: escaped, no bindings inside. */\nexport function textareaMarkup({ value, attrs }: TextareaOptions): string {\n return `<textarea${attrMarkup(attrs)}>${escapeText(value)}</textarea>`;\n}\n\nfunction findTextarea(part: ChildPart): HTMLTextAreaElement | undefined {\n for (\n let node = part.startNode?.nextSibling;\n node && node !== part.endNode;\n node = node.nextSibling\n ) {\n if (node instanceof HTMLTextAreaElement) return node;\n }\n return undefined;\n}\n\nfunction syncAttributes(el: HTMLTextAreaElement, attrs: TextareaOptions['attrs']): void {\n for (const [name, value] of Object.entries(attrs ?? {})) {\n if (value === false || value === null || value === undefined) el.removeAttribute(name);\n else el.setAttribute(name, value === true ? '' : String(value));\n }\n}\n\nclass TextareaDirective extends Directive {\n /** The model value last applied, so typing isn't overwritten by an unchanged model. */\n #applied: string | undefined;\n\n constructor(info: PartInfo) {\n super(info);\n if (info.type !== PartType.CHILD) {\n throw new Error('textarea() must be used in a child position: html`${textarea({…})}`');\n }\n }\n\n override render(options: TextareaOptions): unknown {\n return staticHtml`${unsafeStatic(textareaMarkup(options))}`;\n }\n\n override update(part: ChildPart, [options]: [TextareaOptions]): unknown {\n const el = findTextarea(part);\n if (el === undefined) {\n // First render (client) or hydration (server markup already in place): same template.\n this.#applied = options.value;\n return this.render(options);\n }\n syncAttributes(el, options.attrs);\n if (this.#applied === undefined) {\n // Hydration: the server's element is already here. Keep whatever the user typed before\n // the script loaded; only later model changes write the value.\n this.#applied = options.value;\n return noChange;\n }\n if (options.value !== this.#applied) {\n this.#applied = options.value;\n if (el.value !== options.value) el.value = options.value;\n }\n return noChange;\n }\n}\n\n/**\n * A `<textarea>` whose content comes from the model, safe for SSR and hydration:\n *\n * ${textarea({ value: s.message, attrs: { name: 'message', rows: 5, required: true,\n * 'data-intent': i.Message } })}\n *\n * Text typed before or after hydration is kept until the model's value changes.\n */\nexport const textarea = directive(TextareaDirective);\n"]}