@arkitektio/bsx 4.3.0 → 6.0.0

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 (349) hide show
  1. package/README.md +39 -18
  2. package/dist/bsx/analyze.d.ts +6 -5
  3. package/dist/bsx/analyze.d.ts.map +1 -1
  4. package/dist/bsx/analyze.js +12 -10
  5. package/dist/bsx/analyze.js.map +1 -1
  6. package/dist/bsx/declared.d.ts +111 -0
  7. package/dist/bsx/declared.d.ts.map +1 -0
  8. package/dist/bsx/declared.js +311 -0
  9. package/dist/bsx/declared.js.map +1 -0
  10. package/dist/bsx/index.d.ts +1 -0
  11. package/dist/bsx/index.d.ts.map +1 -1
  12. package/dist/bsx/index.js +1 -0
  13. package/dist/bsx/index.js.map +1 -1
  14. package/dist/bsx/infer.d.ts +40 -17
  15. package/dist/bsx/infer.d.ts.map +1 -1
  16. package/dist/bsx/infer.js +105 -49
  17. package/dist/bsx/infer.js.map +1 -1
  18. package/dist/bsx/language.d.ts +6 -2
  19. package/dist/bsx/language.d.ts.map +1 -1
  20. package/dist/bsx/language.js +65 -21
  21. package/dist/bsx/language.js.map +1 -1
  22. package/dist/bsx/parse.d.ts +19 -8
  23. package/dist/bsx/parse.d.ts.map +1 -1
  24. package/dist/bsx/parse.js +49 -59
  25. package/dist/bsx/parse.js.map +1 -1
  26. package/dist/bsx/print.d.ts.map +1 -1
  27. package/dist/bsx/print.js +25 -35
  28. package/dist/bsx/print.js.map +1 -1
  29. package/dist/bsx/references.d.ts +48 -54
  30. package/dist/bsx/references.d.ts.map +1 -1
  31. package/dist/bsx/references.js +359 -159
  32. package/dist/bsx/references.js.map +1 -1
  33. package/dist/catalogs/html.d.ts +3 -3
  34. package/dist/catalogs/html.d.ts.map +1 -1
  35. package/dist/catalogs/html.js +3 -3
  36. package/dist/catalogs/html.js.map +1 -1
  37. package/dist/catalogs/index.d.ts +172 -180
  38. package/dist/catalogs/index.d.ts.map +1 -1
  39. package/dist/catalogs/index.js +6 -2
  40. package/dist/catalogs/index.js.map +1 -1
  41. package/dist/catalogs/logo.d.ts +19 -33
  42. package/dist/catalogs/logo.d.ts.map +1 -1
  43. package/dist/catalogs/logo.js +4 -5
  44. package/dist/catalogs/logo.js.map +1 -1
  45. package/dist/catalogs/parts/data.d.ts +6 -6
  46. package/dist/catalogs/parts/feedback.d.ts +15 -15
  47. package/dist/catalogs/parts/forms.d.ts +24 -24
  48. package/dist/catalogs/parts/html.d.ts +3 -3
  49. package/dist/catalogs/parts/html.d.ts.map +1 -1
  50. package/dist/catalogs/parts/html.js +1 -1
  51. package/dist/catalogs/parts/html.js.map +1 -1
  52. package/dist/catalogs/parts/icons.d.ts +11 -11
  53. package/dist/catalogs/parts/icons.js +1 -1
  54. package/dist/catalogs/parts/index.d.ts +153 -165
  55. package/dist/catalogs/parts/index.d.ts.map +1 -1
  56. package/dist/catalogs/parts/layout.d.ts +11 -1
  57. package/dist/catalogs/parts/layout.d.ts.map +1 -1
  58. package/dist/catalogs/parts/layout.js +9 -0
  59. package/dist/catalogs/parts/layout.js.map +1 -1
  60. package/dist/catalogs/parts/logo.d.ts +17 -32
  61. package/dist/catalogs/parts/logo.d.ts.map +1 -1
  62. package/dist/catalogs/parts/logo.js +13 -15
  63. package/dist/catalogs/parts/logo.js.map +1 -1
  64. package/dist/catalogs/parts/navigation.d.ts +20 -20
  65. package/dist/catalogs/parts/overlays.d.ts +55 -55
  66. package/dist/catalogs/parts/run.d.ts +5 -13
  67. package/dist/catalogs/parts/run.d.ts.map +1 -1
  68. package/dist/catalogs/parts/run.js +1 -1
  69. package/dist/catalogs/parts/scene.d.ts +9 -17
  70. package/dist/catalogs/parts/scene.d.ts.map +1 -1
  71. package/dist/catalogs/parts/scene.js +1 -5
  72. package/dist/catalogs/parts/scene.js.map +1 -1
  73. package/dist/catalogs/parts/structure.js +2 -2
  74. package/dist/catalogs/parts/toast.js +1 -1
  75. package/dist/catalogs/parts/toast.js.map +1 -1
  76. package/dist/catalogs/parts/typography.d.ts +3 -3
  77. package/dist/catalogs/parts/typography.js +1 -1
  78. package/dist/catalogs/parts/typography.js.map +1 -1
  79. package/dist/catalogs/props.d.ts +4 -4
  80. package/dist/catalogs/scene.d.ts +8 -16
  81. package/dist/catalogs/scene.d.ts.map +1 -1
  82. package/dist/catalogs/scene.js +3 -3
  83. package/dist/catalogs/scene.js.map +1 -1
  84. package/dist/catalogs/shadcn.d.ts +58 -58
  85. package/dist/catalogs/shadcn.d.ts.map +1 -1
  86. package/dist/catalogs/shadcn.js +4 -4
  87. package/dist/catalogs/shadcn.js.map +1 -1
  88. package/dist/catalogs/structure.d.ts +1 -1
  89. package/dist/catalogs/structure.d.ts.map +1 -1
  90. package/dist/catalogs/structure.js +3 -3
  91. package/dist/catalogs/structure.js.map +1 -1
  92. package/dist/catalogs/ui.d.ts +83 -73
  93. package/dist/catalogs/ui.d.ts.map +1 -1
  94. package/dist/catalogs/ui.js +4 -3
  95. package/dist/catalogs/ui.js.map +1 -1
  96. package/dist/catalogs.d.ts +1 -1
  97. package/dist/catalogs.d.ts.map +1 -1
  98. package/dist/catalogs.js +2 -2
  99. package/dist/catalogs.js.map +1 -1
  100. package/dist/logo/actionLogoSource.d.ts +3 -3
  101. package/dist/logo/actionLogoSource.d.ts.map +1 -1
  102. package/dist/logo/actionLogoSource.js +4 -4
  103. package/dist/logo/actionLogoSource.js.map +1 -1
  104. package/dist/ports.js +1 -1
  105. package/dist/ports.js.map +1 -1
  106. package/dist/renderer/BlokRenderer.d.ts +10 -6
  107. package/dist/renderer/BlokRenderer.d.ts.map +1 -1
  108. package/dist/renderer/BlokRenderer.js +23 -9
  109. package/dist/renderer/BlokRenderer.js.map +1 -1
  110. package/dist/renderer/baseCatalog.d.ts +8 -6
  111. package/dist/renderer/baseCatalog.d.ts.map +1 -1
  112. package/dist/renderer/baseCatalog.js +7 -5
  113. package/dist/renderer/baseCatalog.js.map +1 -1
  114. package/dist/renderer/bloks/control.d.ts +20 -2
  115. package/dist/renderer/bloks/control.d.ts.map +1 -1
  116. package/dist/renderer/bloks/control.js +98 -15
  117. package/dist/renderer/bloks/control.js.map +1 -1
  118. package/dist/renderer/bloks/data.d.ts +6 -6
  119. package/dist/renderer/bloks/feedback.d.ts +15 -15
  120. package/dist/renderer/bloks/forms.d.ts +24 -24
  121. package/dist/renderer/bloks/html.d.ts +2 -2
  122. package/dist/renderer/bloks/html.js +2 -2
  123. package/dist/renderer/bloks/icons.d.ts +5 -5
  124. package/dist/renderer/bloks/index.d.ts +145 -144
  125. package/dist/renderer/bloks/index.d.ts.map +1 -1
  126. package/dist/renderer/bloks/index.js +1 -1
  127. package/dist/renderer/bloks/layout.d.ts +9 -1
  128. package/dist/renderer/bloks/layout.d.ts.map +1 -1
  129. package/dist/renderer/bloks/layout.js +15 -0
  130. package/dist/renderer/bloks/layout.js.map +1 -1
  131. package/dist/renderer/bloks/logo/index.d.ts +6 -13
  132. package/dist/renderer/bloks/logo/index.d.ts.map +1 -1
  133. package/dist/renderer/bloks/logo/index.js +3 -4
  134. package/dist/renderer/bloks/logo/index.js.map +1 -1
  135. package/dist/renderer/bloks/logo/logo.fixture.json +266 -250
  136. package/dist/renderer/bloks/navigation.d.ts +20 -20
  137. package/dist/renderer/bloks/overlays.d.ts +55 -55
  138. package/dist/renderer/bloks/run/components.d.ts +2 -6
  139. package/dist/renderer/bloks/run/components.d.ts.map +1 -1
  140. package/dist/renderer/bloks/run/components.js +1 -1
  141. package/dist/renderer/bloks/scene/index.d.ts +5 -9
  142. package/dist/renderer/bloks/scene/index.d.ts.map +1 -1
  143. package/dist/renderer/bloks/scene/interaction.d.ts.map +1 -1
  144. package/dist/renderer/bloks/scene/interaction.js +3 -2
  145. package/dist/renderer/bloks/scene/interaction.js.map +1 -1
  146. package/dist/renderer/bloks/shared/props.d.ts +2 -2
  147. package/dist/renderer/bloks/toast.d.ts +1 -1
  148. package/dist/renderer/bloks/typography.d.ts +3 -3
  149. package/dist/renderer/bloks/typography.js +1 -1
  150. package/dist/renderer/catalog.d.ts +4 -7
  151. package/dist/renderer/catalog.d.ts.map +1 -1
  152. package/dist/renderer/catalog.js +7 -31
  153. package/dist/renderer/catalog.js.map +1 -1
  154. package/dist/renderer/declarations.d.ts +40 -33
  155. package/dist/renderer/declarations.d.ts.map +1 -1
  156. package/dist/renderer/declarations.js +41 -56
  157. package/dist/renderer/declarations.js.map +1 -1
  158. package/dist/renderer/declare.d.ts +31 -19
  159. package/dist/renderer/declare.d.ts.map +1 -1
  160. package/dist/renderer/declare.js +44 -18
  161. package/dist/renderer/declare.js.map +1 -1
  162. package/dist/renderer/persist.d.ts +22 -13
  163. package/dist/renderer/persist.d.ts.map +1 -1
  164. package/dist/renderer/persist.js +40 -21
  165. package/dist/renderer/persist.js.map +1 -1
  166. package/dist/renderer/runtime/catalog.d.ts +27 -7
  167. package/dist/renderer/runtime/catalog.d.ts.map +1 -1
  168. package/dist/renderer/runtime/catalog.js +30 -3
  169. package/dist/renderer/runtime/catalog.js.map +1 -1
  170. package/dist/renderer/runtime/components.d.ts +10 -4
  171. package/dist/renderer/runtime/components.d.ts.map +1 -1
  172. package/dist/renderer/runtime/components.js +8 -5
  173. package/dist/renderer/runtime/components.js.map +1 -1
  174. package/dist/renderer/runtime/context.d.ts +5 -5
  175. package/dist/renderer/runtime/context.d.ts.map +1 -1
  176. package/dist/renderer/runtime/context.js +11 -5
  177. package/dist/renderer/runtime/context.js.map +1 -1
  178. package/dist/renderer/runtime/describe.d.ts +16 -6
  179. package/dist/renderer/runtime/describe.d.ts.map +1 -1
  180. package/dist/renderer/runtime/describe.js +5 -2
  181. package/dist/renderer/runtime/describe.js.map +1 -1
  182. package/dist/renderer/runtime/hooks.d.ts.map +1 -1
  183. package/dist/renderer/runtime/hooks.js +8 -4
  184. package/dist/renderer/runtime/hooks.js.map +1 -1
  185. package/dist/renderer/runtime/index.d.ts +2 -0
  186. package/dist/renderer/runtime/index.d.ts.map +1 -1
  187. package/dist/renderer/runtime/index.js +2 -0
  188. package/dist/renderer/runtime/index.js.map +1 -1
  189. package/dist/renderer/runtime/locals.d.ts +57 -0
  190. package/dist/renderer/runtime/locals.d.ts.map +1 -0
  191. package/dist/renderer/runtime/locals.js +87 -0
  192. package/dist/renderer/runtime/locals.js.map +1 -0
  193. package/dist/renderer/runtime/preflight.d.ts.map +1 -1
  194. package/dist/renderer/runtime/preflight.js +5 -2
  195. package/dist/renderer/runtime/preflight.js.map +1 -1
  196. package/dist/renderer/runtime/scope.d.ts +14 -0
  197. package/dist/renderer/runtime/scope.d.ts.map +1 -1
  198. package/dist/renderer/runtime/scope.js +25 -3
  199. package/dist/renderer/runtime/scope.js.map +1 -1
  200. package/dist/renderer/runtime/text.d.ts +28 -0
  201. package/dist/renderer/runtime/text.d.ts.map +1 -0
  202. package/dist/renderer/runtime/text.js +82 -0
  203. package/dist/renderer/runtime/text.js.map +1 -0
  204. package/dist/renderer/runtime/tree.d.ts.map +1 -1
  205. package/dist/renderer/runtime/tree.js +7 -1
  206. package/dist/renderer/runtime/tree.js.map +1 -1
  207. package/dist/renderer/runtime/types.d.ts +8 -3
  208. package/dist/renderer/runtime/types.d.ts.map +1 -1
  209. package/dist/runtime.d.ts +0 -1
  210. package/dist/runtime.d.ts.map +1 -1
  211. package/dist/runtime.js +0 -1
  212. package/dist/runtime.js.map +1 -1
  213. package/dist/scene.d.ts +1 -1
  214. package/dist/scene.d.ts.map +1 -1
  215. package/dist/scene.js +2 -2
  216. package/dist/scene.js.map +1 -1
  217. package/dist/shadcn.d.ts +154 -153
  218. package/dist/shadcn.d.ts.map +1 -1
  219. package/dist/shadcn.js +7 -7
  220. package/dist/shadcn.js.map +1 -1
  221. package/dist/spec/bsx_v2.json +12324 -6934
  222. package/dist/spec/catalogs/base@4.json +13175 -0
  223. package/dist/spec/catalogs/base@4.json.js +13175 -0
  224. package/dist/spec/catalogs/orkestrator@1.json +489 -0
  225. package/dist/spec/catalogs/orkestrator@1.json.js +489 -0
  226. package/dist/spec/catalogs.d.ts +109 -46
  227. package/dist/spec/catalogs.d.ts.map +1 -1
  228. package/dist/spec/catalogs.js +243 -75
  229. package/dist/spec/catalogs.js.map +1 -1
  230. package/dist/spec/vocabulary.d.ts +44 -7
  231. package/dist/spec/vocabulary.d.ts.map +1 -1
  232. package/dist/spec/vocabulary.js +65 -7
  233. package/dist/spec/vocabulary.js.map +1 -1
  234. package/dist/spec/vocabulary.json +83 -43
  235. package/dist/spec/vocabulary.json.js +83 -43
  236. package/dist/vendor/core/ui/button-group.d.ts +1 -1
  237. package/dist/vendor/core/ui/button.d.ts +1 -1
  238. package/dist/vendor/core/ui/field.d.ts +1 -1
  239. package/package.json +1 -1
  240. package/src/bsx/analyze.ts +14 -12
  241. package/src/bsx/bsx.test.ts +4 -4
  242. package/src/bsx/declared.ts +346 -0
  243. package/src/bsx/index.ts +1 -0
  244. package/src/bsx/infer.test.ts +54 -52
  245. package/src/bsx/infer.ts +128 -71
  246. package/src/bsx/language.test.ts +37 -25
  247. package/src/bsx/language.ts +72 -25
  248. package/src/bsx/parse.ts +51 -64
  249. package/src/bsx/partial.test.ts +1 -1
  250. package/src/bsx/print.ts +27 -34
  251. package/src/bsx/references.test.ts +86 -83
  252. package/src/bsx/references.ts +391 -198
  253. package/src/catalogs/catalogs.test.ts +46 -14
  254. package/src/catalogs/html.ts +3 -3
  255. package/src/catalogs/index.ts +6 -2
  256. package/src/catalogs/logo.ts +4 -5
  257. package/src/catalogs/parts/html.ts +1 -1
  258. package/src/catalogs/parts/icons.ts +1 -1
  259. package/src/catalogs/parts/layout.ts +11 -0
  260. package/src/catalogs/parts/logo.ts +14 -18
  261. package/src/catalogs/parts/run.ts +1 -1
  262. package/src/catalogs/parts/scene.ts +1 -7
  263. package/src/catalogs/parts/structure.ts +2 -2
  264. package/src/catalogs/parts/toast.ts +1 -1
  265. package/src/catalogs/parts/typography.ts +1 -1
  266. package/src/catalogs/scene.ts +3 -3
  267. package/src/catalogs/shadcn.ts +4 -4
  268. package/src/catalogs/structure.ts +3 -3
  269. package/src/catalogs/ui.ts +4 -3
  270. package/src/catalogs.ts +9 -2
  271. package/src/logo/actionLogoSource.ts +4 -4
  272. package/src/ports.ts +1 -1
  273. package/src/renderer/BlokComponentHost.test.tsx +5 -5
  274. package/src/renderer/BlokRenderer.tsx +46 -14
  275. package/src/renderer/addBlokComponents.test.tsx +8 -22
  276. package/src/renderer/baseCatalog.ts +7 -5
  277. package/src/renderer/bloks/components.test.tsx +2 -2
  278. package/src/renderer/bloks/control.tsx +136 -17
  279. package/src/renderer/bloks/flow.test.tsx +1 -1
  280. package/src/renderer/bloks/html.tsx +2 -2
  281. package/src/renderer/bloks/index.ts +1 -1
  282. package/src/renderer/bloks/layout.tsx +28 -0
  283. package/src/renderer/bloks/logo/index.tsx +4 -5
  284. package/src/renderer/bloks/logo/logo.fixture.json +266 -250
  285. package/src/renderer/bloks/logo/logo.test.tsx +18 -7
  286. package/src/renderer/bloks/run/components.tsx +1 -1
  287. package/src/renderer/bloks/run/space.test.tsx +12 -4
  288. package/src/renderer/bloks/scene/interaction.tsx +11 -6
  289. package/src/renderer/bloks/scene/transform.test.ts +8 -7
  290. package/src/renderer/bloks/time.test.tsx +1 -1
  291. package/src/renderer/bloks/toast.tsx +1 -1
  292. package/src/renderer/bloks/typography.tsx +1 -1
  293. package/src/renderer/catalog.tsx +7 -31
  294. package/src/renderer/declarations.test.ts +38 -51
  295. package/src/renderer/declarations.ts +67 -88
  296. package/src/renderer/declare.test.ts +41 -0
  297. package/src/renderer/declare.ts +70 -32
  298. package/src/renderer/persist.test.ts +70 -49
  299. package/src/renderer/persist.ts +57 -34
  300. package/src/renderer/runtime/catalog.test.ts +2 -2
  301. package/src/renderer/runtime/catalog.ts +35 -10
  302. package/src/renderer/runtime/components.tsx +17 -8
  303. package/src/renderer/runtime/context.tsx +17 -10
  304. package/src/renderer/runtime/describe.ts +21 -8
  305. package/src/renderer/runtime/hooks.ts +6 -4
  306. package/src/renderer/runtime/index.ts +2 -0
  307. package/src/renderer/runtime/locals.tsx +105 -0
  308. package/src/renderer/runtime/preflight.ts +5 -2
  309. package/src/renderer/runtime/scope.tsx +31 -3
  310. package/src/renderer/runtime/text.test.tsx +65 -0
  311. package/src/renderer/runtime/text.ts +88 -0
  312. package/src/renderer/runtime/tree.tsx +16 -4
  313. package/src/renderer/runtime/types.ts +8 -3
  314. package/src/runtime.ts +0 -1
  315. package/src/scene.ts +2 -2
  316. package/src/shadcn.ts +7 -7
  317. package/src/spec/bsx_v2.json +12324 -6934
  318. package/src/spec/catalogs/base@4.json +13175 -0
  319. package/src/spec/catalogs/orkestrator@1.json +489 -0
  320. package/src/spec/catalogs.ts +259 -103
  321. package/src/spec/spec.test.ts +93 -24
  322. package/src/spec/vocabulary.json +83 -43
  323. package/src/spec/vocabulary.ts +102 -17
  324. package/dist/renderer/modules.d.ts +0 -4
  325. package/dist/renderer/modules.d.ts.map +0 -1
  326. package/dist/renderer/modules.js +0 -11
  327. package/dist/renderer/modules.js.map +0 -1
  328. package/dist/spec/catalogs/base@2.json +0 -355
  329. package/dist/spec/catalogs/base@2.json.js +0 -355
  330. package/dist/spec/catalogs/html@1.json +0 -308
  331. package/dist/spec/catalogs/html@1.json.js +0 -308
  332. package/dist/spec/catalogs/logo@1.json +0 -1687
  333. package/dist/spec/catalogs/logo@1.json.js +0 -1687
  334. package/dist/spec/catalogs/scene@1.json +0 -878
  335. package/dist/spec/catalogs/scene@1.json.js +0 -878
  336. package/dist/spec/catalogs/shadcn@1.json +0 -4002
  337. package/dist/spec/catalogs/shadcn@1.json.js +0 -4002
  338. package/dist/spec/catalogs/structure@1.json +0 -185
  339. package/dist/spec/catalogs/structure@1.json.js +0 -185
  340. package/dist/spec/catalogs/ui@1.json +0 -5349
  341. package/dist/spec/catalogs/ui@1.json.js +0 -5349
  342. package/src/renderer/modules.ts +0 -12
  343. package/src/spec/catalogs/base@2.json +0 -355
  344. package/src/spec/catalogs/html@1.json +0 -308
  345. package/src/spec/catalogs/logo@1.json +0 -1687
  346. package/src/spec/catalogs/scene@1.json +0 -878
  347. package/src/spec/catalogs/shadcn@1.json +0 -4002
  348. package/src/spec/catalogs/structure@1.json +0 -185
  349. package/src/spec/catalogs/ui@1.json +0 -5349
@@ -1,7 +1,6 @@
1
- import { resolveBlokScope } from '../bsx/infer.js';
2
- import { emptyBlokScope } from '../bsx/references.js';
3
- import { defaultBlokView } from '../spec/catalogs.js';
4
- import { LOCAL_ANY_KIND } from '../spec/vocabulary.js';
1
+ import { declaredQueries as queriesOfTree, declaredSubscriptions as subscriptionsOfTree } from '../bsx/declared.js';
2
+ import { resolveLocals } from '../bsx/infer.js';
3
+ import { viewForTree } from '../bsx/references.js';
5
4
  import { idleTaskRecord, normalizeBlokArgument, pendingReads, } from './runtime/index.js';
6
5
  const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
7
6
  const variablesOf = (raw) => (Array.isArray(raw) ? raw : []).map(argument => normalizeBlokArgument(argument));
@@ -16,8 +15,15 @@ const localPort = (port) => ({
16
15
  label: port.label ?? null,
17
16
  description: port.description ?? null,
18
17
  });
19
- export const declaredLocals = (declarations) => declarations.resolvedLocals.map(local => ({ ...localPort(local), persist: local.persist === true }));
20
- export const declaredQueries = (declarations) => (declarations.queries ?? []).map(query => ({
18
+ export const declaredLocals = (declarations) => declarations.resolvedLocals.map(local => ({ ...localPort(local), node: local.node, persist: local.persist === true }));
19
+ /** The one root of a tree as the wire spells it (a list of roots, or one), or null. */
20
+ const rootOf = (roots) => {
21
+ const list = Array.isArray(roots) ? roots : [roots];
22
+ const [root] = list;
23
+ return list.length === 1 && isRecord(root) && typeof root.component === 'string' ? root : null;
24
+ };
25
+ /** The reads a blok declares: its `<Blok>`'s `<query>` children. */
26
+ export const treeQueries = (roots) => queriesOfTree(rootOf(roots)).map(query => ({
21
27
  key: query.key,
22
28
  service: query.service,
23
29
  document: query.document,
@@ -25,7 +31,8 @@ export const declaredQueries = (declarations) => (declarations.queries ?? []).ma
25
31
  poll: query.poll ?? null,
26
32
  more: query.more ?? null,
27
33
  }));
28
- export const declaredSubscriptions = (declarations) => (declarations.subscriptions ?? []).map(subscription => ({
34
+ /** The streams a blok declares: its `<Blok>`'s `<subscription>` children. */
35
+ export const treeSubscriptions = (roots) => subscriptionsOfTree(rootOf(roots)).map(subscription => ({
29
36
  key: subscription.key,
30
37
  service: subscription.service,
31
38
  document: subscription.document,
@@ -33,8 +40,6 @@ export const declaredSubscriptions = (declarations) => (declarations.subscriptio
33
40
  keep: subscription.keep ?? null,
34
41
  history: subscription.history ?? null,
35
42
  }));
36
- /** Each declared local at its default. */
37
- export const localsModel = (locals) => Object.fromEntries(locals.map(local => [local.key, local.default ?? null]));
38
43
  /** The names `into` gives a task call's record, in the tree. */
39
44
  export const intoNames = (roots) => {
40
45
  const names = new Set();
@@ -53,34 +58,36 @@ export const intoNames = (roots) => {
53
58
  };
54
59
  /** Every `into` record before its call ran: idle. */
55
60
  export const intoModel = (roots) => Object.fromEntries(intoNames(roots).map(name => [name, idleTaskRecord()]));
56
- /** What a renderer shows live before anything synced: locals, idle `into` records, pending reads. */
57
- export const liveModel = (roots, declarations) => {
58
- const reads = pendingReads(declaredQueries(declarations), declaredSubscriptions(declarations));
61
+ /**
62
+ * What a renderer shows live before anything synced: idle `into` records and
63
+ * pending reads. Locals read their defaults until written (`runtime/locals`).
64
+ */
65
+ export const liveModel = (roots) => {
66
+ const reads = pendingReads(treeQueries(roots), treeSubscriptions(roots));
59
67
  return {
60
- data: { ...localsModel(declaredLocals(declarations)), ...intoModel(roots), ...reads.data },
68
+ data: { ...intoModel(roots), ...reads.data },
61
69
  statuses: reads.statuses,
62
70
  };
63
71
  };
64
72
  /**
65
73
  * What a preview renders: the blok's `demo`, mirroring the roots
66
- * (`{deps, args, task, queries, subscriptions}`), with every declared read
67
- * answered by its demo value. Nothing is pending in a preview.
74
+ * (`{deps, args, task, queries, subscriptions}`), with every read the tree
75
+ * declares answered by its demo value. Nothing is pending in a preview.
68
76
  */
69
77
  export const demoModel = (roots, declarations) => {
70
78
  const demo = isRecord(declarations.demo) ? declarations.demo : {};
71
79
  const demoQueries = isRecord(demo.queries) ? demo.queries : {};
72
80
  const demoSubscriptions = isRecord(demo.subscriptions) ? demo.subscriptions : {};
73
- const queries = Object.fromEntries(declaredQueries(declarations).map(query => [
81
+ const queries = Object.fromEntries(treeQueries(roots).map(query => [
74
82
  query.key,
75
83
  { status: 'ready', value: demoQueries[query.key] ?? null, error: null, refetching: false, fetching_more: false },
76
84
  ]));
77
- const subscriptions = Object.fromEntries(declaredSubscriptions(declarations).map(subscription => [
85
+ const subscriptions = Object.fromEntries(treeSubscriptions(roots).map(subscription => [
78
86
  subscription.key,
79
87
  { status: 'ready', value: demoSubscriptions[subscription.key] ?? null, error: null },
80
88
  ]));
81
89
  const task = isRecord(demo.task) ? { ...idleTaskRecord(), ...demo.task } : undefined;
82
90
  return {
83
- ...localsModel(declaredLocals(declarations)),
84
91
  ...intoModel(roots),
85
92
  deps: isRecord(demo.deps) ? demo.deps : {},
86
93
  args: isRecord(demo.args) ? demo.args : {},
@@ -89,18 +96,15 @@ export const demoModel = (roots, declarations) => {
89
96
  ...(Object.keys(subscriptions).length ? { subscriptions } : {}),
90
97
  };
91
98
  };
92
- const optionalNumber = (value) => (typeof value === 'number' ? value : null);
93
99
  const optionalString = (value) => (typeof value === 'string' ? value : null);
94
100
  const jsonChoices = (raw) => Array.isArray(raw)
95
101
  ? raw.filter(isRecord).map(choice => ({ value: choice.value ?? null, label: optionalString(choice.label), description: optionalString(choice.description) }))
96
102
  : null;
97
- /** A port from JSON; a child without a key or kind is dropped. */
98
- const jsonLocalPort = (port) => typeof port.kind === 'string' ? jsonLocalWritten(port, port.kind) : null;
99
- /** A port from JSON with `kind` as given; null without a key. */
100
- const jsonLocalWritten = (port, kind) => typeof port.key === 'string'
103
+ /** A port from JSON; one without a key or kind is dropped. */
104
+ const jsonLocalPort = (port) => typeof port.key === 'string' && typeof port.kind === 'string'
101
105
  ? {
102
106
  key: port.key,
103
- kind,
107
+ kind: port.kind,
104
108
  identifier: optionalString(port.identifier),
105
109
  nullable: port.nullable === true,
106
110
  default: port.default ?? null,
@@ -115,45 +119,26 @@ const jsonLocalWritten = (port, kind) => typeof port.key === 'string'
115
119
  description: optionalString(port.description),
116
120
  }
117
121
  : null;
118
- /** Locals from JSON as written (snake_case port fields plus `persist`, a kind maybe left out); one without a key is dropped. */
119
- const jsonLocals = (raw) => (Array.isArray(raw) ? raw : []).filter(isRecord).flatMap(local => {
120
- const port = jsonLocalWritten(local, typeof local.kind === 'string' ? local.kind : null);
121
- return port ? [{ ...port, persist: local.persist === true }] : [];
122
+ /** Resolved locals from JSON; one without a node, a key or a kind is dropped. */
123
+ const jsonResolvedLocals = (raw) => (Array.isArray(raw) ? raw : []).filter(isRecord).flatMap(local => {
124
+ const port = jsonLocalPort(local);
125
+ return port && typeof local.node === 'string' ? [{ ...port, node: local.node, persist: local.persist === true }] : [];
122
126
  });
123
- const jsonRoots = (raw) => (Array.isArray(raw) ? raw : [raw]).filter((node) => isRecord(node) && typeof node.component === 'string');
124
127
  /**
125
- * Locals as written, resolved against the tree the way the spec and the
126
- * server resolve them (`resolveBlokScope`: default, task argument, bind, else
127
- * ANY); a given kind is kept.
128
+ * The `<local>` nodes of a tree resolved the way the spec and the server
129
+ * resolve them (default, task argument, bind, else ANY), checked unmounted:
130
+ * what a host uses when the server sent no `resolvedLocals`.
128
131
  */
129
- export const resolveWrittenLocals = (roots, locals) => {
130
- if (!locals.length)
132
+ export const resolveTreeLocals = (roots) => {
133
+ const root = rootOf(roots);
134
+ if (!root)
131
135
  return [];
132
- const [root] = roots;
133
- if (!root || roots.length !== 1)
134
- return locals.map(local => ({ ...local, kind: local.kind ?? LOCAL_ANY_KIND }));
135
- return resolveBlokScope(root, { ...emptyBlokScope(), locals }, defaultBlokView()).locals.map(local => ({ ...local }));
136
+ return [...resolveLocals(root, null, viewForTree(root))].map(([node, { local }]) => ({ ...local, node }));
136
137
  };
137
- const jsonReads = (raw) => (Array.isArray(raw) ? raw : []).filter(isRecord).flatMap(read => typeof read.key === 'string' && typeof read.service === 'string' && typeof read.document === 'string'
138
- ? [
139
- {
140
- key: read.key,
141
- service: read.service,
142
- document: read.document,
143
- variables: read.variables,
144
- poll: optionalNumber(read.poll),
145
- more: optionalString(read.more),
146
- keep: optionalNumber(read.keep),
147
- history: optionalString(read.history),
148
- },
149
- ]
150
- : []);
151
- /** A blok's declarations from JSON a service serves, keeping only well-formed entries. */
138
+ /** A blok's declarations from JSON a service serves: its resolved locals as served, or resolved from its tree. */
152
139
  export const parseBlokDeclarations = (raw) => ({
153
140
  vocab: raw.vocab ?? null,
154
- resolvedLocals: resolveWrittenLocals(jsonRoots(raw.componentTree), jsonLocals(raw.locals)),
141
+ resolvedLocals: raw.resolvedLocals !== undefined && raw.resolvedLocals !== null ? jsonResolvedLocals(raw.resolvedLocals) : resolveTreeLocals(raw.componentTree),
155
142
  demo: raw.demo ?? null,
156
- queries: jsonReads(raw.queries),
157
- subscriptions: jsonReads(raw.subscriptions),
158
143
  });
159
144
  //# sourceMappingURL=declarations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../src/renderer/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAElD,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,YAAY,GASb,MAAM,WAAW,CAAC;AAgEnB,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,MAAM,WAAW,GAAG,CAAC,GAAY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C,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAC,KAAK,EAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,IAAI,EAAC,CAAsB,CAAC,CAAC;AAC7H,CAAC,CAAC;AAEF,kHAAkH;AAClH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAyB,EAAoB,EAAE,CAAC,CAAC;IACrF,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,IAAI;IACxB,cAAc,EAAE,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,GAAG,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,aAAa,CAAC;IAC/J,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,IAAI;CACvB,CAAC,CAAC"}
@@ -1,40 +1,52 @@
1
1
  import { type BlokCatalog, type BlokCatalogImplementation, type BlokComponentDefinition, type SpecCatalogJson } from './runtime';
2
+ import type { BlokContextName } from '../spec/vocabulary';
2
3
  /**
3
- * A UI's catalog, declared: the catalogs it implements and nothing inferred.
4
+ * A UI's catalog, declared: what it draws, and nothing inferred.
4
5
  *
5
- * - `catalog` is what its renderers draw: base@2 and every implementation.
6
- * - `claims` are the global catalogs it implements whole (`ui@1`, `scene@1`):
7
- * the server resolves their components from the spec, so a blok that uses
8
- * only claimed catalogs is known to render here.
9
- * - Its own catalogs (unversioned contracts) are part of `catalog`; what it
10
- * registers as its module is `moduleComponentsOf(catalog)`, which also counts
11
- * what its modules add later (`addBlokComponents`).
12
- *
13
- * A global catalog implemented `partial`ly is drawn but not claimed.
6
+ * - `catalog` is what its renderers draw: the language's own elements and every
7
+ * implementation.
8
+ * - `contexts` are the contexts in which it draws the base catalog whole
9
+ * (`HTML`, `SCENE`, `LOGO`): a blok written for the base catalog and drawn in
10
+ * one of them is known to render here.
11
+ * - `claims` are the catalogs it speaks: the base catalog when it draws it
12
+ * whole in at least one context, and each published catalog of its own.
13
+ * - Its own catalogs are part of `catalog`; what it publishes as its app
14
+ * catalog is `ownComponentsOf(catalog)`, which also counts what its modules
15
+ * add later (`addBlokComponents`).
14
16
  */
15
17
  export type BlokUi = {
16
18
  name: string;
17
19
  description: string | null;
18
20
  catalog: BlokCatalog;
19
21
  implementations: readonly BlokCatalogImplementation[];
22
+ contexts: readonly BlokContextName[];
20
23
  claims: readonly string[];
21
24
  };
25
+ /** The contexts in which `catalog` draws every component of the base catalog. */
26
+ export declare const baseContextsOf: (catalog: BlokCatalog) => BlokContextName[];
22
27
  export declare const declareBlokUi: (declaration: {
23
28
  name: string;
24
29
  description?: string;
25
30
  implements: readonly BlokCatalogImplementation[];
26
31
  }) => BlokUi;
27
32
  /**
28
- * What a UI registers as its module (the server's `Module.components`): every
29
- * component of its catalog that is neither base@2's nor a global catalog's. Its
30
- * own catalogs' components, what its modules added since (`addBlokComponents`),
31
- * and a global component a module drew over (it is the module's now).
33
+ * What a UI draws beyond the base catalog: every component of its catalog
34
+ * that is neither the language's own nor one of the base catalog's. Its own
35
+ * catalogs' components, and what its modules added since (`addBlokComponents`).
32
36
  */
33
- export declare const moduleComponentsOf: (catalog: BlokCatalog) => BlokComponentDefinition[];
37
+ export declare const ownComponentsOf: (catalog: BlokCatalog) => BlokComponentDefinition[];
34
38
  /**
35
- * A UI's module as the spec writes a catalog: for the language's default view
36
- * (`registerBlokModules([parseSpecCatalog(blokModuleSpec(...), ...)])`), so the
37
- * parser and the checks know the components only this UI draws.
39
+ * A UI's app catalog as the spec writes one (`{id, name, version, minor,
40
+ * extends, components}`): what it publishes at `id`, registers with the
41
+ * server, and hands the language (`setAppBlokCatalog(parseSpecCatalog(...))`)
42
+ * so its own parser, checks and editor know the components only it draws.
38
43
  */
39
- export declare const blokModuleSpec: (name: string, description: string, catalog: BlokCatalog) => SpecCatalogJson;
44
+ export declare const blokCatalogSpec: (meta: {
45
+ id: string;
46
+ name: string;
47
+ version: number;
48
+ minor?: number;
49
+ extends?: string;
50
+ description: string;
51
+ }, catalog: BlokCatalog) => SpecCatalogJson;
40
52
  //# sourceMappingURL=declare.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,aAAa;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,SAAS,yBAAyB,EAAE,CAAC;CAClD,KAAG,MAqBH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,WAAW,KAAG,uBAAuB,EAG9E,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,aAAa,MAAM,EAAE,SAAS,WAAW,KAAG,eAMvF,CAAC"}
1
+ {"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAYF,iFAAiF;AACjF,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,KAAG,eAAe,EAMpE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,aAAa;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,SAAS,yBAAyB,EAAE,CAAC;CAClD,KAAG,MA2BH,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,uBAAuB,EAG3E,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,EACxG,SAAS,WAAW,KACnB,eAUD,CAAC"}
@@ -1,5 +1,21 @@
1
1
  import { baseBlokCatalog } from './baseCatalog.js';
2
- import { catalogRef, describeBlokComponent, extendBlokCatalog, } from './runtime/index.js';
2
+ import { BASE_CATALOG_ADDRESS, BASE_CATALOG_REF, catalogRef, describeBlokComponent, extendBlokCatalog, } from './runtime/index.js';
3
+ import { baseCatalog } from '../spec/catalogs.js';
4
+ const CONTEXTS = ['PANEL', 'SCENE', 'LOGO'];
5
+ /**
6
+ * The context a base component counts towards: its own, and for one that
7
+ * bridges a panel and another context (`Scene` opens a scene inside a panel),
8
+ * the other one: a renderer that draws no 3D still draws panels whole.
9
+ */
10
+ const contextOf = (component) => component.context !== 'PANEL' ? component.context : (component.childrenContext ?? 'PANEL');
11
+ /** The contexts in which `catalog` draws every component of the base catalog. */
12
+ export const baseContextsOf = (catalog) => {
13
+ const components = baseCatalog().components;
14
+ return CONTEXTS.filter(context => {
15
+ const drawn = components.filter(component => !component.inheritsContext && contextOf(component) === context);
16
+ return drawn.length > 0 && drawn.every(component => catalog.components.has(component.name));
17
+ });
18
+ };
3
19
  export const declareBlokUi = (declaration) => {
4
20
  const implementations = declaration.implements;
5
21
  const refs = implementations.map(implementation => catalogRef(implementation.contract));
@@ -7,33 +23,43 @@ export const declareBlokUi = (declaration) => {
7
23
  if (twice.length > 0) {
8
24
  throw new Error(`${declaration.name} implements ${[...new Set(twice)].join(', ')} twice`);
9
25
  }
26
+ const catalog = extendBlokCatalog(baseBlokCatalog, declaration.name, implementations.flatMap(implementation => implementation.components));
27
+ const contexts = baseContextsOf(catalog);
10
28
  return {
11
29
  name: declaration.name,
12
30
  description: declaration.description ?? null,
13
- catalog: extendBlokCatalog(baseBlokCatalog, declaration.name, implementations.flatMap(implementation => implementation.components)),
31
+ catalog,
14
32
  implementations,
15
- claims: implementations
16
- .filter(implementation => implementation.contract.version !== null && implementation.whole)
17
- .map(implementation => catalogRef(implementation.contract))
18
- .sort(),
33
+ contexts,
34
+ claims: [
35
+ ...(contexts.length > 0 ? [BASE_CATALOG_REF] : []),
36
+ ...implementations
37
+ .filter(implementation => implementation.contract.partOf === null && implementation.contract.version !== null && implementation.whole)
38
+ .map(implementation => catalogRef(implementation.contract))
39
+ .sort(),
40
+ ],
19
41
  };
20
42
  };
21
43
  /**
22
- * What a UI registers as its module (the server's `Module.components`): every
23
- * component of its catalog that is neither base@2's nor a global catalog's. Its
24
- * own catalogs' components, what its modules added since (`addBlokComponents`),
25
- * and a global component a module drew over (it is the module's now).
44
+ * What a UI draws beyond the base catalog: every component of its catalog
45
+ * that is neither the language's own nor one of the base catalog's. Its own
46
+ * catalogs' components, and what its modules added since (`addBlokComponents`).
26
47
  */
27
- export const moduleComponentsOf = (catalog) => [...catalog.components.values()].filter(component => catalog.base?.components.get(component.name) !== component && component.origin?.includes('@') !== true);
48
+ export const ownComponentsOf = (catalog) => [...catalog.components.values()].filter(component => catalog.base?.components.get(component.name) !== component && component.origin !== BASE_CATALOG_REF);
28
49
  /**
29
- * A UI's module as the spec writes a catalog: for the language's default view
30
- * (`registerBlokModules([parseSpecCatalog(blokModuleSpec(...), ...)])`), so the
31
- * parser and the checks know the components only this UI draws.
50
+ * A UI's app catalog as the spec writes one (`{id, name, version, minor,
51
+ * extends, components}`): what it publishes at `id`, registers with the
52
+ * server, and hands the language (`setAppBlokCatalog(parseSpecCatalog(...))`)
53
+ * so its own parser, checks and editor know the components only it draws.
32
54
  */
33
- export const blokModuleSpec = (name, description, catalog) => ({
34
- name,
35
- description,
36
- components: moduleComponentsOf(catalog)
55
+ export const blokCatalogSpec = (meta, catalog) => ({
56
+ id: meta.id,
57
+ name: meta.name,
58
+ version: meta.version,
59
+ minor: meta.minor ?? 0,
60
+ extends: meta.extends ?? BASE_CATALOG_ADDRESS,
61
+ description: meta.description,
62
+ components: ownComponentsOf(catalog)
37
63
  .map(component => describeBlokComponent(component.name, component))
38
64
  .sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),
39
65
  });
@@ -1 +1 @@
1
- {"version":3,"file":"declare.js","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,iBAAiB,GAKlB,MAAM,WAAW,CAAC;AAuBnB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,WAI7B,EAAU,EAAE;IACX,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC;IAC/C,MAAM,IAAI,GAAG,eAAe,CA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OAAO;IACrB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,oBAAoB;IAC7C,WAAW,EAAE,IAAI,CAAC,WAAW;IAC7B,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC;SACjC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;SAClE,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACzF,CAAC,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import * as React from 'react';
2
2
  import type { KeyedStore } from '../cache/keyedStore';
3
- import type { BlokRuntimeStore } from './runtime';
3
+ import { type BlokRuntimeStore } from './runtime';
4
4
  /**
5
5
  * What a blok keeps between openings, on this device only (blok language v2):
6
6
  *
7
- * - **form inputs**: a local declared `Local(default, persist=True)` (a port
8
- * plus `persist`) remembers the viewer's last input;
7
+ * - **form inputs**: a local declared `<local name="x" default={...} persist />`
8
+ * remembers the viewer's last input, by its runtime id: the `<local>`'s node
9
+ * id, plus `@<item key>` per enclosing foreach (one value per item). An
10
+ * explicit `id=` on the `<local>` keeps it across edits of the tree;
9
11
  * - **component state**: a component that offers it as its own BOOL prop
10
12
  * (`<Scene id="main" persist>`, `<Transform id="arm-pose" persist>`) keeps
11
13
  * its interaction state (the camera, the pose) by its id. The language
@@ -13,10 +15,10 @@ import type { BlokRuntimeStore } from './runtime';
13
15
  *
14
16
  * Nothing reaches a server, so keeping cannot become a channel between
15
17
  * clients. Values live in IndexedDB keyed by (hub, user, materialized blok)
16
- * for the locals and (hub, user, materialized blok, component id) for each
17
- * component, and are written a moment after the last change. A local the
18
- * blok no longer persists, or a value that no longer fits its port, is
19
- * dropped when the blok opens.
18
+ * for the locals (one record, values by runtime id) and (hub, user,
19
+ * materialized blok, component id) for each component, and are written a
20
+ * moment after the last change. A local the blok no longer persists, or a
21
+ * value that no longer fits its port, is dropped when the blok opens.
20
22
  */
21
23
  /** A choice a local's port offers (`ChoiceInput`). */
22
24
  export type BlokLocalChoice = {
@@ -41,11 +43,16 @@ export type BlokLocalPort = {
41
43
  label?: string | null;
42
44
  description?: string | null;
43
45
  };
44
- /** A local (vocabulary `locals`): an arg port plus `persist`, remembering the last input on this device. */
46
+ /**
47
+ * A `<local>` (vocabulary `locals`): an arg port plus `persist`, remembering
48
+ * the last input on this device, and `node`, the id of the `<local>` node
49
+ * that declares it.
50
+ */
45
51
  export type BlokLocal = BlokLocalPort & {
52
+ node: string;
46
53
  persist?: boolean | null;
47
54
  };
48
- /** What is kept for one materialization's locals: values by local key. */
55
+ /** What is kept for one materialization's locals: values by the local's runtime id (`runtimeIdOf`). */
49
56
  export type KeptLocals = Record<string, unknown>;
50
57
  /** Whose a kept record is: the hub and user it was set under, and the materialization. */
51
58
  export type BlokPersistScope = {
@@ -53,6 +60,7 @@ export type BlokPersistScope = {
53
60
  user: string;
54
61
  materializedBlok: string;
55
62
  };
63
+ /** Version 2: kept values by runtime id (version 1 kept them by top-level key, and is dropped). */
56
64
  export declare const keptLocalsStore: KeyedStore<KeptLocals>;
57
65
  /** One component's kept state, wrapped so any JSON value fits the store. */
58
66
  export type KeptComponentState = {
@@ -63,6 +71,7 @@ export declare const keptLocalsId: (scope: BlokPersistScope) => string;
63
71
  export declare const keptComponentId: (scope: BlokPersistScope, componentId: string) => string;
64
72
  /** Whether a kept value can stand for a local: it fits the local's port (a kept value that no longer does is dropped). */
65
73
  export declare const fitsLocal: (kept: unknown, local: BlokLocal) => boolean;
74
+ /** What of `record` still stands: the values of persisted locals (by their node) that still fit their port. */
66
75
  export declare const keptValuesOf: (record: KeptLocals | null, locals: readonly BlokLocal[]) => {
67
76
  values: KeptLocals;
68
77
  dropped: boolean;
@@ -72,9 +81,9 @@ export declare const keptValuesOf: (record: KeptLocals | null, locals: readonly
72
81
  * seed the renderer with, and what writes changes back.
73
82
  */
74
83
  export type BlokPersistence = {
75
- /** The locals kept on this device (those declared with `persist`). */
76
- keys: ReadonlySet<string>;
77
- /** The kept locals to seed the runtime with, before the first render. */
84
+ /** The `<local>` node ids kept on this device (those declared with `persist`): `BlokRenderer`'s `keptLocals`. */
85
+ locals: ReadonlySet<string>;
86
+ /** The kept values to seed the runtime with, before the first render, by runtime id: `BlokRenderer`'s `keptValues`. */
78
87
  initial: KeptLocals;
79
88
  /** Follows `store`: a change of a kept local is written after `delay`. Returns the detach, which flushes. */
80
89
  attach: (store: BlokRuntimeStore) => () => void;
@@ -95,7 +104,7 @@ export type BlokComponentStateStore = {
95
104
  export declare const componentStateStore: (scope: BlokPersistScope, store?: KeyedStore<KeptComponentState>, delay?: number) => BlokComponentStateStore;
96
105
  export declare const openBlokPersistence: (options: {
97
106
  scope: BlokPersistScope;
98
- /** The blok's declared locals; those with `persist` are kept. */
107
+ /** The blok's resolved locals (by node); those with `persist` are kept. */
99
108
  locals: readonly BlokLocal[];
100
109
  store?: KeyedStore<KeptLocals>;
101
110
  componentStore?: KeyedStore<KeptComponentState>;
@@ -1 +1 @@
1
- {"version":3,"file":"persist.d.ts","sourceRoot":"","sources":["../../src/renderer/persist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAIvE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AAEH,sDAAsD;AACtD,MAAM,MAAM,eAAe,GAAG;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAA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