@gramlot/gramlot 0.3.41 → 0.5.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 (358) hide show
  1. package/assets/icons/align-center.svg +4 -0
  2. package/assets/icons/align-justify.svg +4 -0
  3. package/assets/icons/align-left.svg +4 -0
  4. package/assets/icons/align-right.svg +4 -0
  5. package/assets/icons/applications.svg +4 -0
  6. package/assets/icons/archive.svg +4 -0
  7. package/assets/icons/attachment.svg +4 -0
  8. package/assets/icons/bold.svg +4 -0
  9. package/assets/icons/book.svg +4 -0
  10. package/assets/icons/bookmark.svg +4 -0
  11. package/assets/icons/calendar.svg +4 -0
  12. package/assets/icons/cancel.svg +4 -0
  13. package/assets/icons/chart.svg +4 -1
  14. package/assets/icons/chat.svg +4 -0
  15. package/assets/icons/clock.svg +4 -0
  16. package/assets/icons/code.svg +4 -0
  17. package/assets/icons/collapse.svg +4 -0
  18. package/assets/icons/columns.svg +4 -0
  19. package/assets/icons/confirm.svg +4 -0
  20. package/assets/icons/copy.svg +4 -0
  21. package/assets/icons/cut.svg +4 -0
  22. package/assets/icons/database.svg +4 -0
  23. package/assets/icons/delete.svg +4 -0
  24. package/assets/icons/detach.svg +4 -0
  25. package/assets/icons/document.svg +4 -0
  26. package/assets/icons/download.svg +4 -0
  27. package/assets/icons/duplicate.svg +4 -0
  28. package/assets/icons/edit.svg +4 -0
  29. package/assets/icons/eraser.svg +4 -0
  30. package/assets/icons/expand.svg +4 -0
  31. package/assets/icons/export.svg +4 -0
  32. package/assets/icons/eye.svg +4 -0
  33. package/assets/icons/filter.svg +4 -0
  34. package/assets/icons/first.svg +4 -0
  35. package/assets/icons/folder.svg +4 -0
  36. package/assets/icons/group.svg +4 -0
  37. package/assets/icons/help.svg +4 -0
  38. package/assets/icons/home.svg +4 -0
  39. package/assets/icons/horizontal-rule.svg +4 -0
  40. package/assets/icons/image.svg +4 -0
  41. package/assets/icons/import.svg +4 -0
  42. package/assets/icons/indent.svg +4 -0
  43. package/assets/icons/info.svg +4 -0
  44. package/assets/icons/inspector.svg +4 -0
  45. package/assets/icons/italic.svg +4 -0
  46. package/assets/icons/last.svg +4 -0
  47. package/assets/icons/layers.svg +4 -0
  48. package/assets/icons/link.svg +4 -0
  49. package/assets/icons/list-bulleted.svg +4 -0
  50. package/assets/icons/list-numbered.svg +4 -0
  51. package/assets/icons/list.svg +4 -0
  52. package/assets/icons/lock.svg +4 -0
  53. package/assets/icons/logout.svg +4 -0
  54. package/assets/icons/navigation.svg +4 -0
  55. package/assets/icons/new.svg +4 -0
  56. package/assets/icons/next.svg +4 -0
  57. package/assets/icons/open.svg +4 -0
  58. package/assets/icons/outdent.svg +4 -0
  59. package/assets/icons/palette.svg +4 -0
  60. package/assets/icons/panel-bottom.svg +4 -0
  61. package/assets/icons/panel-left.svg +4 -0
  62. package/assets/icons/panel-right.svg +4 -0
  63. package/assets/icons/panel-top.svg +4 -0
  64. package/assets/icons/paragraph.svg +4 -0
  65. package/assets/icons/paste.svg +4 -0
  66. package/assets/icons/pause.svg +4 -0
  67. package/assets/icons/pin.svg +4 -0
  68. package/assets/icons/play.svg +4 -0
  69. package/assets/icons/previous.svg +4 -0
  70. package/assets/icons/print.svg +4 -0
  71. package/assets/icons/redo.svg +4 -0
  72. package/assets/icons/refresh.svg +4 -0
  73. package/assets/icons/save.svg +4 -0
  74. package/assets/icons/search.svg +4 -0
  75. package/assets/icons/select-all.svg +4 -0
  76. package/assets/icons/send.svg +4 -0
  77. package/assets/icons/settings.svg +4 -0
  78. package/assets/icons/sort-ascending.svg +4 -0
  79. package/assets/icons/sort-descending.svg +4 -0
  80. package/assets/icons/stop.svg +4 -0
  81. package/assets/icons/strikethrough.svg +4 -0
  82. package/assets/icons/table.svg +4 -0
  83. package/assets/icons/tree.svg +4 -0
  84. package/assets/icons/underline.svg +4 -0
  85. package/assets/icons/undo.svg +4 -0
  86. package/assets/icons/unlock.svg +4 -0
  87. package/assets/icons/upload.svg +4 -0
  88. package/assets/icons/user.svg +4 -0
  89. package/assets/icons/warning.svg +4 -0
  90. package/assets/icons/zoom-in.svg +4 -0
  91. package/assets/icons/zoom-out.svg +4 -0
  92. package/dist/components/charts/__init__.py +1 -1
  93. package/dist/components/charts/assets/index.js +1 -1
  94. package/dist/components/charts/assets/libraries/vega.js +11 -11
  95. package/dist/components/charts/grammar.json +2032 -72
  96. package/dist/components/editors/__init__.py +1 -1
  97. package/dist/components/editors/assets/collection.js +1 -1
  98. package/dist/components/editors/assets/index.js +1 -1
  99. package/dist/components/editors/assets/libraries/codemirror.js +30 -31
  100. package/dist/components/editors/assets/libraries/jodit.js +453 -447
  101. package/dist/components/editors/commands.json +113 -1
  102. package/dist/components/editors/grammar.json +12 -5
  103. package/dist/components/grid/__init__.py +1 -1
  104. package/dist/components/grid/assets/index.js +1 -1
  105. package/dist/components/grid/commands.json +4 -6
  106. package/dist/components/grid/grammar.json +112 -0
  107. package/dist/components/inputs/__init__.py +1 -1
  108. package/dist/components/inputs/assets/index.js +1 -1
  109. package/dist/components/inputs/grammar.json +5165 -359
  110. package/dist/components/layout/__init__.py +1 -1
  111. package/dist/components/layout/assets/collection.js +1 -0
  112. package/dist/components/layout/assets/index.js +1 -1
  113. package/dist/components/layout/grammar.json +433 -4
  114. package/dist/components/tree/__init__.py +1 -1
  115. package/dist/components/tree/assets/index.js +1 -1
  116. package/dist/components/tree/grammar.json +51 -0
  117. package/dist/components/typst/__init__.py +1 -1
  118. package/dist/components/typst/assets/collection.js +6 -6
  119. package/dist/components/typst/assets/index.js +1 -1
  120. package/dist/components/uploads/__init__.py +1 -1
  121. package/dist/components/uploads/assets/index.js +1 -1
  122. package/dist/components/uploads/grammar.json +66 -0
  123. package/dist/declared-collections.js +1 -1
  124. package/dist/gramlot.js +5486 -2029
  125. package/dist/gramlot.min.js +361 -138
  126. package/dist/libraries.json +6 -4
  127. package/dist/standard-collections.js +1 -1
  128. package/dist/standard-grammar.js +1 -1
  129. package/package.json +6 -2
  130. package/src/binding/ask-dialog.js +17 -3
  131. package/src/binding/providers.js +3 -2
  132. package/src/binding/remote.js +41 -6
  133. package/src/binding/runtime.js +30 -3
  134. package/src/builder/gramlot-builder.d.ts +3 -1
  135. package/src/builder/gramlot-builder.js +77 -26
  136. package/src/builder/source.js +78 -15
  137. package/src/builder/xml-recipe.js +144 -0
  138. package/src/chat-file-types.js +13 -0
  139. package/src/chat.d.ts +1 -0
  140. package/src/chat.js +35 -25
  141. package/src/commands.d.ts +1 -1
  142. package/src/commands.js +1 -1
  143. package/src/components/border-container.js +64 -6
  144. package/src/components/buttons.js +26 -31
  145. package/src/components/chart-bar3d-options.js +0 -1
  146. package/src/components/chart-boxplot-options.js +1 -1
  147. package/src/components/chart-candlestick-options.js +1 -1
  148. package/src/components/chart-engines/echarts-options.js +6 -5
  149. package/src/components/chart-engines/echarts.js +27 -10
  150. package/src/components/chart-engines/plotly-map.js +1 -1
  151. package/src/components/chart-engines/plotly.js +21 -14
  152. package/src/components/chart-engines/uplot.js +17 -11
  153. package/src/components/chart-engines/vega.js +17 -11
  154. package/src/components/chart-funnel-options.js +1 -1
  155. package/src/components/chart-geographic-options.js +2 -2
  156. package/src/components/chart-heatmap-options.js +1 -1
  157. package/src/components/chart-map-bar3d-options.js +2 -2
  158. package/src/components/chart-map-options.js +2 -2
  159. package/src/components/chart-pane.js +5 -5
  160. package/src/components/chart-parallel-options.js +1 -1
  161. package/src/components/chart-radar-options.js +1 -1
  162. package/src/components/chart-renderer.js +6 -1
  163. package/src/components/chart-sankey-options.js +1 -1
  164. package/src/components/chart-spatial-options.js +6 -2
  165. package/src/components/chart-sunburst-options.js +13 -1
  166. package/src/components/chart-theme.js +14 -0
  167. package/src/components/chart-treemap-options.js +1 -1
  168. package/src/components/chart-type-data.js +24 -4
  169. package/src/components/charts.js +7 -6
  170. package/src/components/check-box-text-editor.js +1 -0
  171. package/src/components/check-box-text.js +2 -0
  172. package/src/components/check-box-tree.js +1 -1
  173. package/src/components/choice-editor.js +5 -4
  174. package/src/components/choice-field-styles.js +9 -1
  175. package/src/components/code-mirror-engine.js +19 -5
  176. package/src/components/code-mirror-gramlot.js +85 -0
  177. package/src/components/code-mirror.js +3 -2
  178. package/src/components/drawing.js +43 -14
  179. package/src/components/editor-commands.js +69 -0
  180. package/src/components/editor-options.js +1 -1
  181. package/src/components/editors.js +5 -3
  182. package/src/components/form-tray-pane.js +18 -0
  183. package/src/components/graphical-ranges.js +190 -0
  184. package/src/components/grid-check-sets.js +39 -3
  185. package/src/components/grid-footer.js +6 -1
  186. package/src/components/grid-header-interaction.js +3 -3
  187. package/src/components/grid-styles.js +30 -5
  188. package/src/components/grid-tools.js +15 -7
  189. package/src/components/grid.js +109 -15
  190. package/src/components/html-editor-commands.js +61 -0
  191. package/src/components/html-editor.js +18 -3
  192. package/src/components/inputs.js +94 -23
  193. package/src/components/jodit-engine.js +110 -7
  194. package/src/components/layout.js +3 -2
  195. package/src/components/menus.js +89 -26
  196. package/src/components/numeric-range.js +39 -0
  197. package/src/components/selected-container.js +123 -64
  198. package/src/components/tab-bar.js +389 -0
  199. package/src/components/toolbar-icon-style.js +22 -0
  200. package/src/components/toolbar-overflow.js +74 -12
  201. package/src/components/tray-base.js +528 -0
  202. package/src/components/tray-pane.js +41 -518
  203. package/src/components/tree.js +56 -4
  204. package/src/components/typed-editor.js +5 -2
  205. package/src/components/typst-preview.js +3 -3
  206. package/src/components/upload-blocks.js +88 -0
  207. package/src/components/upload-engine.js +21 -31
  208. package/src/components/uploader.js +168 -47
  209. package/src/editing-session.js +2 -1
  210. package/src/gramlot.js +6 -3
  211. package/src/handlers/dom-handler.d.ts +2 -0
  212. package/src/handlers/dom-handler.js +9 -0
  213. package/src/handlers/rpc-handler.d.ts +1 -1
  214. package/src/handlers/rpc-handler.js +2 -0
  215. package/src/handlers/source-handler.d.ts +5 -3
  216. package/src/handlers/source-handler.js +31 -13
  217. package/src/icons.js +84 -0
  218. package/src/ide-runtime.js +3 -1
  219. package/src/index-page-runtime.js +20 -5
  220. package/src/index-page-styles.js +1 -1
  221. package/src/index-theme.js +210 -3
  222. package/src/index.d.ts +7 -2
  223. package/src/index.js +7 -2
  224. package/src/libraries.js +4 -4
  225. package/src/object-extract.d.ts +7 -0
  226. package/src/object-extract.js +31 -0
  227. package/src/renderer/attributes.js +1 -1
  228. package/src/renderer/gramlot-renderer.d.ts +2 -2
  229. package/src/renderer/gramlot-renderer.js +4 -1
  230. package/src/server/chat-attachments.js +139 -0
  231. package/src/server/chat.d.ts +33 -0
  232. package/src/server/chat.js +168 -0
  233. package/src/server/database-selectors.d.ts +6 -0
  234. package/src/server/database-selectors.js +13 -0
  235. package/src/server/gramlot-file-server.js +6 -1
  236. package/src/server/gramlot-server.d.ts +19 -3
  237. package/src/server/gramlot-server.js +149 -19
  238. package/src/server/index-page.d.ts +10 -0
  239. package/src/server/index-page.js +92 -8
  240. package/src/server/index.d.ts +1 -1
  241. package/src/server/index.js +1 -1
  242. package/src/server/page-base.js +4 -0
  243. package/src/server/page-store.d.ts +21 -0
  244. package/src/server/page-store.js +219 -0
  245. package/src/server/page.d.ts +6 -1
  246. package/src/server/page.js +5 -1
  247. package/src/server/store-recipe.js +102 -0
  248. package/src/server/toolbar-icon-name.d.ts +93 -0
  249. package/src/server/upload.d.ts +2 -0
  250. package/src/server/upload.js +36 -18
  251. package/src/server/visual-editor.js +4 -2
  252. package/src/tree-store.d.ts +5 -1
  253. package/src/tree-store.js +11 -2
  254. package/src/view/choice-focus.js +17 -0
  255. package/src/view/html.js +21 -1
  256. package/src/view/labelbox.js +6 -1
  257. package/src/view/menu.js +9 -3
  258. package/src/visual-editor.d.ts +1 -0
  259. package/src/visual-editor.js +10 -5
  260. package/themes/gramlot-base/theme.css +60 -28
  261. package/themes/gramlot-compact/theme.css +2 -0
  262. package/themes/gramlot-index/icons/align-center.svg +4 -0
  263. package/themes/gramlot-index/icons/align-justify.svg +4 -0
  264. package/themes/gramlot-index/icons/align-left.svg +4 -0
  265. package/themes/gramlot-index/icons/align-right.svg +4 -0
  266. package/themes/gramlot-index/icons/applications.svg +4 -0
  267. package/themes/gramlot-index/icons/archive.svg +4 -0
  268. package/themes/gramlot-index/icons/attachment.svg +4 -0
  269. package/themes/gramlot-index/icons/bold.svg +4 -0
  270. package/themes/gramlot-index/icons/book.svg +4 -0
  271. package/themes/gramlot-index/icons/bookmark.svg +4 -0
  272. package/themes/gramlot-index/icons/calendar.svg +4 -0
  273. package/themes/gramlot-index/icons/cancel.svg +4 -0
  274. package/themes/gramlot-index/icons/chart.svg +4 -0
  275. package/themes/gramlot-index/icons/chat.svg +4 -0
  276. package/themes/gramlot-index/icons/clock.svg +4 -0
  277. package/themes/gramlot-index/icons/code.svg +4 -0
  278. package/themes/gramlot-index/icons/collapse.svg +4 -0
  279. package/themes/gramlot-index/icons/columns.svg +4 -0
  280. package/themes/gramlot-index/icons/confirm.svg +4 -0
  281. package/themes/gramlot-index/icons/copy.svg +4 -0
  282. package/themes/gramlot-index/icons/cut.svg +4 -0
  283. package/themes/gramlot-index/icons/database.svg +4 -0
  284. package/themes/gramlot-index/icons/delete.svg +4 -0
  285. package/themes/gramlot-index/icons/detach.svg +4 -0
  286. package/themes/gramlot-index/icons/document.svg +4 -0
  287. package/themes/gramlot-index/icons/download.svg +4 -0
  288. package/themes/gramlot-index/icons/duplicate.svg +4 -0
  289. package/themes/gramlot-index/icons/edit.svg +4 -0
  290. package/themes/gramlot-index/icons/eraser.svg +4 -0
  291. package/themes/gramlot-index/icons/expand.svg +4 -0
  292. package/themes/gramlot-index/icons/export.svg +4 -0
  293. package/themes/gramlot-index/icons/eye.svg +4 -0
  294. package/themes/gramlot-index/icons/filter.svg +4 -0
  295. package/themes/gramlot-index/icons/first.svg +4 -0
  296. package/themes/gramlot-index/icons/folder.svg +4 -0
  297. package/themes/gramlot-index/icons/group.svg +4 -0
  298. package/themes/gramlot-index/icons/help.svg +4 -0
  299. package/themes/gramlot-index/icons/home.svg +4 -0
  300. package/themes/gramlot-index/icons/horizontal-rule.svg +4 -0
  301. package/themes/gramlot-index/icons/image.svg +4 -0
  302. package/themes/gramlot-index/icons/import.svg +4 -0
  303. package/themes/gramlot-index/icons/indent.svg +4 -0
  304. package/themes/gramlot-index/icons/info.svg +4 -0
  305. package/themes/gramlot-index/icons/inspector.svg +4 -0
  306. package/themes/gramlot-index/icons/italic.svg +4 -0
  307. package/themes/gramlot-index/icons/last.svg +4 -0
  308. package/themes/gramlot-index/icons/layers.svg +4 -0
  309. package/themes/gramlot-index/icons/link.svg +4 -0
  310. package/themes/gramlot-index/icons/list-bulleted.svg +4 -0
  311. package/themes/gramlot-index/icons/list-numbered.svg +4 -0
  312. package/themes/gramlot-index/icons/list.svg +4 -0
  313. package/themes/gramlot-index/icons/lock.svg +4 -0
  314. package/themes/gramlot-index/icons/logout.svg +4 -0
  315. package/themes/gramlot-index/icons/navigation.svg +4 -0
  316. package/themes/gramlot-index/icons/new.svg +4 -0
  317. package/themes/gramlot-index/icons/next.svg +4 -0
  318. package/themes/gramlot-index/icons/open.svg +4 -0
  319. package/themes/gramlot-index/icons/outdent.svg +4 -0
  320. package/themes/gramlot-index/icons/palette.svg +4 -0
  321. package/themes/gramlot-index/icons/panel-bottom.svg +4 -0
  322. package/themes/gramlot-index/icons/panel-left.svg +4 -0
  323. package/themes/gramlot-index/icons/panel-right.svg +4 -0
  324. package/themes/gramlot-index/icons/panel-top.svg +4 -0
  325. package/themes/gramlot-index/icons/paragraph.svg +4 -0
  326. package/themes/gramlot-index/icons/paste.svg +4 -0
  327. package/themes/gramlot-index/icons/pause.svg +4 -0
  328. package/themes/gramlot-index/icons/pin.svg +4 -0
  329. package/themes/gramlot-index/icons/play.svg +4 -0
  330. package/themes/gramlot-index/icons/previous.svg +4 -0
  331. package/themes/gramlot-index/icons/print.svg +4 -0
  332. package/themes/gramlot-index/icons/redo.svg +4 -0
  333. package/themes/gramlot-index/icons/refresh.svg +4 -0
  334. package/themes/gramlot-index/icons/save.svg +4 -0
  335. package/themes/gramlot-index/icons/search.svg +4 -0
  336. package/themes/gramlot-index/icons/select-all.svg +4 -0
  337. package/themes/gramlot-index/icons/send.svg +4 -0
  338. package/themes/gramlot-index/icons/settings.svg +4 -0
  339. package/themes/gramlot-index/icons/sort-ascending.svg +4 -0
  340. package/themes/gramlot-index/icons/sort-descending.svg +4 -0
  341. package/themes/gramlot-index/icons/stop.svg +4 -0
  342. package/themes/gramlot-index/icons/strikethrough.svg +4 -0
  343. package/themes/gramlot-index/icons/table.svg +4 -0
  344. package/themes/gramlot-index/icons/tree.svg +4 -0
  345. package/themes/gramlot-index/icons/underline.svg +4 -0
  346. package/themes/gramlot-index/icons/undo.svg +4 -0
  347. package/themes/gramlot-index/icons/unlock.svg +4 -0
  348. package/themes/gramlot-index/icons/upload.svg +4 -0
  349. package/themes/gramlot-index/icons/user.svg +4 -0
  350. package/themes/gramlot-index/icons/warning.svg +4 -0
  351. package/themes/gramlot-index/icons/zoom-in.svg +4 -0
  352. package/themes/gramlot-index/icons/zoom-out.svg +4 -0
  353. package/themes/gramlot-index/icons.json +93 -0
  354. package/themes/gramlot-index/theme.css +24 -0
  355. package/themes/joanna/theme.css +2 -0
  356. package/themes/mela/theme.css +2 -0
  357. package/themes/mimi/theme.css +2 -0
  358. package/tools/gramlot-tools-inspector.js +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gramlot/gramlot",
3
- "version": "0.3.41",
3
+ "version": "0.5.0",
4
4
  "description": "Declarative HTML/SVG interfaces with live data binding, authored in JavaScript or Python.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,8 +24,10 @@
24
24
  "@codemirror/lang-json": "^6.0.2",
25
25
  "@codemirror/lang-markdown": "^6.5.2",
26
26
  "@codemirror/lang-python": "^6.2.1",
27
+ "@codemirror/lang-rust": "^6.0.2",
27
28
  "@codemirror/lang-sql": "^6.10.0",
28
29
  "@codemirror/lang-xml": "^6.1.0",
30
+ "@codemirror/lang-yaml": "^6.1.3",
29
31
  "@codemirror/language": "^6.13.1",
30
32
  "@codemirror/lint": "^6.9.8",
31
33
  "@codemirror/search": "^6.7.2",
@@ -34,7 +36,7 @@
34
36
  "@genrojs/bag": ">=0.12.0",
35
37
  "@genrojs/builders": ">=0.7.0",
36
38
  "@genrojs/toolbox": ">=0.19.0",
37
- "@genrojs/tytx": ">=0.16.3",
39
+ "@genrojs/tytx": ">=0.16.4",
38
40
  "@lezer/highlight": "^1.2.5",
39
41
  "@myriaddreamin/typst-ts-renderer": "0.7.0",
40
42
  "@myriaddreamin/typst-ts-web-compiler": "0.7.0",
@@ -60,6 +62,7 @@
60
62
  "write-excel-file": "4.1.1"
61
63
  },
62
64
  "devDependencies": {
65
+ "@gramlot/builder": "file:../tools/gramlot-builder",
63
66
  "c8": "10.1.3",
64
67
  "esbuild": "0.28.2",
65
68
  "jsdom": "27.0.1",
@@ -72,6 +75,7 @@
72
75
  "./build-plugins": "./src/build-plugins.js",
73
76
  "./markdown": "./src/markdown.js",
74
77
  "./page": "./src/server/page.js",
78
+ "./db": "./src/server/database-selectors.js",
75
79
  "./gramlot-server": "./src/server/gramlot-server.js",
76
80
  "./themes/*": "./themes/*",
77
81
  "./assets/branding/*": "./assets/branding/*",
@@ -37,7 +37,7 @@ export class AskDialog {
37
37
  }
38
38
 
39
39
  /** Show the dialog of `specification`; resolves with the values of its fields, or null when cancelled. */
40
- show(binding, specification, parameters, title = 'Parameters') {
40
+ show(binding, specification, parameters, title = 'Parameters', {interpolate = false} = {}) {
41
41
  const spec = typeof specification === 'string' ? {msg: specification, title} : specification;
42
42
  if (!spec || typeof spec !== 'object' || Array.isArray(spec)) throw new TypeError('ask requires text or a parameter description');
43
43
  for (const key of Object.keys(spec)) {
@@ -86,8 +86,22 @@ export class AskDialog {
86
86
  connect_oncancel: `${group}.cancel`, connect_onclose: `${group}.cancel`,
87
87
  class: 'gramlot-ask', 'aria-labelledby': `${id}_title`,
88
88
  style: 'border:1px solid #aab4c2;border-radius:8px;padding:16px;max-width:32rem;width:calc(100% - 48px);font:inherit;'});
89
- dialog.h2(spec.title ?? title, {id: `${id}_title`, style: 'font-size:1.1em;margin:0 0 12px;'});
90
- if (spec.msg) dialog.p(spec.msg);
89
+ const dialogText = (key, text) => {
90
+ if (!interpolate || typeof text !== 'string' || /^[=^]/.test(text)) return text;
91
+ let substituted = false;
92
+ const formatted = text.replace(/\{([A-Za-z_]\w*)\}/g, (token, name) => {
93
+ if (!Object.hasOwn(parameters, name)) return token;
94
+ substituted = true;
95
+ return String(parameters[name] ?? '');
96
+ });
97
+ if (!substituted) return text;
98
+ // Bind the result as Data so argument values are always displayed as text.
99
+ const path = `.ask-text.${key}`;
100
+ app.data.setItem(id + path, formatted);
101
+ return '^' + path;
102
+ };
103
+ dialog.h2(dialogText('title', spec.title ?? title), {id: `${id}_title`, style: 'font-size:1.1em;margin:0 0 12px;'});
104
+ if (spec.msg) dialog.p(dialogText('msg', spec.msg));
91
105
  const form = dialog.form({request: id, connect_onsubmit: `${group}.confirm`});
92
106
  for (const field of fields) {
93
107
  form.dataSetter({destination_path: `.${field.name}`,
@@ -157,7 +157,7 @@ export class Provider {
157
157
 
158
158
  /**
159
159
  * The one pipeline of every trigger, `{kind: 'data'|'init'|'built'|'start'|'timing', change}` or
160
- * `{kind: 'click', event, counter}`:
160
+ * `{kind: 'click', event, counter}`, or `{kind: 'fireNode', change: null, runKwargs}` (`Source node.fireNode`, merged over the arguments):
161
161
  * arguments, `_if`, body, and for a formula the write of the result at `result_path`. `_if` and
162
162
  * `_else` are inline (Q11.1): a false `_if` stops, or `_else` replaces the body (D5); an empty `_if`
163
163
  * is absent and an empty `_else` or body is none, as legacy. A body is
@@ -175,6 +175,7 @@ export class Provider {
175
175
  const rpc = this.kind === 'rpc';
176
176
  const remote = this.kind === 'remote';
177
177
  const kwargs = this.readArguments(trigger);
178
+ if (trigger.runKwargs) Object.assign(kwargs, trigger.runKwargs);
178
179
  if (trigger.askResult) {
179
180
  Object.assign(kwargs, trigger.askResult);
180
181
  kwargs._askResult = trigger.askResult;
@@ -182,7 +183,7 @@ export class Provider {
182
183
  const ask = node.getAttr('_ask');
183
184
  const askDialog = this.binding.runtime.askDialog;
184
185
  if (ask && !trigger.askDone && askDialog.required(this.binding, ask, kwargs, '_ask')) {
185
- return askDialog.show(this.binding, ask, kwargs, node.getAttr('_ask_title') ?? 'Warning').then(result => {
186
+ return askDialog.show(this.binding, ask, kwargs, node.getAttr('_ask_title') ?? 'Warning', {interpolate: true}).then(result => {
186
187
  if (this.binding.closed) return;
187
188
  if (result === null) {
188
189
  const cancel = node.getAttr('_ask_onCancel');
@@ -1,6 +1,7 @@
1
1
  import {invokeHook} from './hooks.js';
2
2
  import {toTytx} from '@genrojs/tytx';
3
3
  import {TriggerTimers} from './providers.js';
4
+ import {objectExtract} from '../object-extract.js';
4
5
 
5
6
  /**
6
7
  * The `remote` attribute of a Source node (GC-095 §105): the content of the element is the fragment of a
@@ -12,9 +13,12 @@ import {TriggerTimers} from './providers.js';
12
13
  * The control attributes: `_cachedRemote` (no call when name and parameters equal those of the request in
13
14
  * flight, or of the fragment mounted last when none is in flight), `_if` (inline, false → no call, and `_else`
14
15
  * runs when present; a readiness condition that never cancels a request), `_onCalling` (inline, before the
15
- * call; `false` makes no call), `_onRemote` (inline, after the fragment is mounted), `_delay` (ms of debounce
16
+ * call; `false` makes no call), `_onRemote` (inline, after the fragment is mounted), `_waitingMessage` (a layer
17
+ * with a message over the element while the request runs), `_delay` (ms of debounce
16
18
  * of a Data change), `_timing` (seconds between two calls) and `_userChanges` (only the changes of level
17
- * `node` call). The inline code has the parameters as locals and `this` = the node.
19
+ * `node` call). The inline code has the parameters as locals and `this` = the node. The parameter
20
+ * `sendInheritedAttributes` sends `node.getInheritedAttributes()` as `_inheritedAttributes`: the server
21
+ * builds the fragment on a root that carries them.
18
22
  */
19
23
  export class RemoteBinding {
20
24
  #binding;
@@ -74,9 +78,10 @@ export class RemoteBinding {
74
78
  const node = this.node;
75
79
  const [, attrs] = node.rootBuilder.runtimeValues(node);
76
80
  const name = attrs.remote;
77
- const params = {};
78
- for (const [key, value] of Object.entries(attrs)) {
79
- if (key.startsWith('remote_')) params[key.slice('remote_'.length)] = value;
81
+ const params = objectExtract(attrs, 'remote_*', {pop: false});
82
+ // As legacy: the server builds the fragment on a root that carries the inherited attributes.
83
+ if (objectExtract(params, 'sendInheritedAttributes').sendInheritedAttributes) {
84
+ params._inheritedAttributes = node.getInheritedAttributes();
80
85
  }
81
86
  const condition = node.getAttr('_if');
82
87
  if (condition && !this.#inline('_if', condition, `return (${condition})`, params)) {
@@ -90,7 +95,9 @@ export class RemoteBinding {
90
95
  if (attrs._cachedRemote && this.#cached(name, text)) return;
91
96
  const onCalling = node.getAttr('_onCalling');
92
97
  if (!node.requests.calling(onCalling ? () => this.#inline('_onCalling', onCalling, onCalling, params) : null)) return;
93
- mounted = await this.binding.runtime.gramlot.src.remoteSource(node, name, params);
98
+ const hide = this.#showWaiting(attrs._waitingMessage);
99
+ try { mounted = await this.binding.runtime.gramlot.src.remoteSource(node, name, params); }
100
+ finally { hide(); }
94
101
  } catch (error) {
95
102
  throw new Error(`${node.nodeTag} '${node.label}': remote '${name}' failed: ${error.message}`, {cause: error});
96
103
  }
@@ -114,6 +121,34 @@ export class RemoteBinding {
114
121
  return name === this.#lastName && text === this.#lastParams;
115
122
  }
116
123
 
124
+ /**
125
+ * `_waitingMessage`, as legacy (`gnrdomsource.js:1820`): while the request runs, a layer with the message
126
+ * (`'Loading content'` for `true`) covers the element of the node, which is marked `aria-busy`. A static
127
+ * element is positioned for the time of the layer. Returns the function that removes the layer.
128
+ */
129
+ #showWaiting(message) {
130
+ // An element is missing only before the node's first build, when no request starts.
131
+ const element = message ? this.binding.runtime.gramlot.dom.getDomNode(this.node) : null;
132
+ if (!element) return () => {};
133
+ const document = element.ownerDocument;
134
+ const layer = document.createElement('div');
135
+ layer.className = 'gramlot-waiting-layer';
136
+ layer.setAttribute('role', 'status');
137
+ const text = document.createElement('div');
138
+ text.className = 'gramlot-waiting-message';
139
+ text.textContent = message === true ? 'Loading content' : String(message);
140
+ layer.append(text);
141
+ const positioned = document.defaultView.getComputedStyle(element).position === 'static';
142
+ if (positioned) element.classList.add('gramlot-waiting-host');
143
+ element.setAttribute('aria-busy', 'true');
144
+ element.append(layer);
145
+ return () => {
146
+ layer.remove();
147
+ element.removeAttribute('aria-busy');
148
+ if (positioned) element.classList.remove('gramlot-waiting-host');
149
+ };
150
+ }
151
+
117
152
  /** The current value of a control attribute: a pointer is read from Data. */
118
153
  #control(name) {
119
154
  const [, attrs] = this.node.rootBuilder.runtimeValues(this.node);
@@ -69,6 +69,7 @@ export class BindingRuntime {
69
69
  #dataRootTrees = new Set();
70
70
  // One collection store per absolute Data path and rowMode, never per Bag identity.
71
71
  #collectionStores = new Map();
72
+ #pendingFires = new Map();
72
73
 
73
74
  constructor(gramlot, {subscriptions}) {
74
75
  this.#gramlot = gramlot;
@@ -231,6 +232,28 @@ export class BindingRuntime {
231
232
  }
232
233
  }
233
234
 
235
+ /**
236
+ * The fire scheduled by `FIRE_AFTER` for the absolute Data `path`, one per path in the page (legacy
237
+ * `pendingCallAfter`, `genro.js:1216`): a new call cancels the pending one. `binding`, when given,
238
+ * owns the timer, so the close of its node cancels it. Returns the cancellation of this call.
239
+ */
240
+ fireAfter(path, delay, binding, run) {
241
+ this.#pendingFires.get(path)?.();
242
+ let release = null;
243
+ const cancel = () => {
244
+ clearTimeout(timer);
245
+ release?.();
246
+ if (this.#pendingFires.get(path) === cancel) this.#pendingFires.delete(path);
247
+ };
248
+ const timer = setTimeout(() => {
249
+ cancel();
250
+ run();
251
+ }, delay);
252
+ release = binding?.track(cancel) ?? null;
253
+ this.#pendingFires.set(path, cancel);
254
+ return cancel;
255
+ }
256
+
234
257
  /** The open NodeBinding of `node`, or null. */
235
258
  bindingFor(node) {
236
259
  return this.#bindings.get(node) ?? null;
@@ -405,6 +428,7 @@ export class BindingRuntime {
405
428
  this.root.unsubscribe(this.#subscription, {any: true});
406
429
  this.nodeIds.clear();
407
430
  this.#dependents.clear();
431
+ for (const cancel of [...this.#pendingFires.values()]) cancel();
408
432
  this.#collectionStores.clear();
409
433
  const errors = [];
410
434
  for (const [node, binding] of [...this.#bindings.entries()].reverse()) {
@@ -763,7 +787,7 @@ export class NodeBinding {
763
787
 
764
788
  /**
765
789
  * Send `request`, the request of this node in flight (NodeRequests), through `gramlot.rpc.call` as
766
- * `contentType`; resolves with the value. The close of the node aborts it until the answer arrives, also
790
+ * `contentType`; returns the envelope for Source and the value for Data. The close of the node aborts it until the answer arrives, also
767
791
  * when the answer arrived and was not yet received here: the call then rejects with the abort reason.
768
792
  * Used by `dataRpc`, `dataRemote` and `remoteSource`.
769
793
  */
@@ -771,8 +795,11 @@ export class NodeBinding {
771
795
  const {controller} = request;
772
796
  const release = this.track(() => controller.abort());
773
797
  try {
774
- const value = await this.runtime.gramlot.rpc.call(contentType, request.method, request.params,
775
- {signal: controller.signal});
798
+ const rpc = this.runtime.gramlot.rpc;
799
+ const options = {signal: controller.signal};
800
+ const value = contentType === 'source'
801
+ ? await rpc.callEnvelope(contentType, request.method, request.params, options)
802
+ : await rpc.call(contentType, request.method, request.params, options);
776
803
  if (controller.signal.aborted) throw controller.signal.reason;
777
804
  return value;
778
805
  } finally {
@@ -24,9 +24,11 @@ export class GramlotBuilder extends HtmlBuilder {
24
24
  /** The dialect name, `'gramlot'`. */
25
25
  static _name: string;
26
26
  static containers: string[];
27
+ codeMirrorWithOptions(parent: SourceBag | SourceBagNode, options: Parameters<typeof import('../components/editor-options.js').codeMirrorWithOptions>[1]): void;
28
+ VisualEditor(parent: SourceBag | SourceBagNode, options: ConstructorParameters<typeof import('../server/visual-editor.js').VisualEditor>[1]): void;
27
29
  /** Build an ordinary framePane containing center.grid; requires layout and grid. */
28
30
  frameGrid(parent: SourceBag | SourceBagNode, options: SourceAttributes & {
29
- storepath: string; rowMode: 'values' | 'attributes'; structpath?: string; searchOn?: boolean | string; searchHelp?: boolean; chart?: boolean | string;
31
+ storepath: string; rowMode: 'values' | 'attributes'; structpath?: string; searchOn?: boolean | string; searchHelp?: boolean; addrow?: boolean; addrow_label?: string; delrow?: boolean | 'row'; delrow_label?: string; chart?: boolean | string;
30
32
  }): SourceBagNode;
31
33
  /** Tag prefixes of the parent dialects, from the names of the classes above `GramlotBuilder`. */
32
34
  static get dialectPrefixes(): string[];
@@ -4,8 +4,12 @@
4
4
  *
5
5
  * @module
6
6
  */
7
+ import {codeMirrorWithOptions} from '../components/editor-options.js';
8
+ import {htmlEditorToolbar} from '../components/html-editor-commands.js';
9
+ import {VisualEditor} from '../server/visual-editor.js';
7
10
  import buttons from '../components/buttons.js';
8
11
  import {ComponentCollection} from '../components/registry.js';
12
+ import {objectExtract} from '../object-extract.js';
9
13
  import {Bag} from '@genrojs/bag';
10
14
  import {HtmlBuilder, META_ATTRS, SourceBagNode, sourceTarget} from '@genrojs/builders';
11
15
  import {toTytx} from '@genrojs/tytx';
@@ -43,6 +47,8 @@ const EXPORT_FORMATS = {csv:'CSV', json:'JSON', tytx:'TYTX', xml:'XML', xlsx:'Ex
43
47
  // frameGrid composes these grid attributes itself; its own parameters reach the grid too.
44
48
  const FRAME_GRID_COMPOSED = new Set(['node_label', 'frameTarget', 'nodeId']);
45
49
  const FRAME_GRID_PARAMETERS = new Set(['storepath', 'rowMode', 'structpath']);
50
+ // An editor frame composes these canvas attributes itself.
51
+ const EDITOR_FRAME_COMPOSED = new Set(['node_label', 'frameTarget']);
46
52
 
47
53
  /**
48
54
  * An element whose `_meta.keywordPattern` is set accepts, besides its declared attributes, only the
@@ -102,24 +108,52 @@ function excludedAttribute(attrs) {
102
108
  /** Gramlot vocabulary and inert authoring on the shared builder grammar. */
103
109
  export class GramlotBuilder extends HtmlBuilder {
104
110
  static _name = 'gramlot';
105
- static containers = ['frameGrid'];
111
+ static containers = ['frameGrid', 'codeMirrorWithOptions', 'VisualEditor', 'htmlEditor'];
106
112
  static _sourceClass = GramlotBuilderBag;
107
113
  // Composed on the inherited HtmlBuilder grammar; its data-elements replace Builder's.
108
114
  static { this.defineGrammar(BINDING); }
109
115
  static { this.defineGrammar(WEBCOMPONENT); }
110
116
  static { this.defineGrammar(buttons.toDocument()); }
111
117
 
118
+ codeMirrorWithOptions(parent, options) {
119
+ codeMirrorWithOptions(parent, options);
120
+ }
121
+
122
+ VisualEditor(parent, options) {
123
+ return new VisualEditor(parent, options);
124
+ }
125
+
126
+ /** A framePane with the htmlEditorCanvas in its center and, unless `toolbar` is false, the htmlEditor toolbar in top.bar. */
127
+ htmlEditor(parent, {toolbar = true, ...attrs} = {}) {
128
+ if (typeof toolbar !== 'boolean') throw new TypeError('htmlEditor toolbar requires a boolean');
129
+ return this.editorFrame(parent, 'htmlEditor', 'htmlEditorCanvas', toolbar ? htmlEditorToolbar : null, attrs);
130
+ }
131
+
132
+ /**
133
+ * Compose an editor frame: a framePane, the canvas as frame target in its center (node `canvas`) and
134
+ * the standard toolbar in top.bar. Canvas parameters go to the canvas; `canvas_`/`frame_` force any attribute.
135
+ */
136
+ editorFrame(parent, owner, canvasTag, toolbar, attrs) {
137
+ for (const tag of ['framePane', canvasTag]) {
138
+ if (!this.schemaTag(tag)) throw new TypeError(`${owner} requires the ${tag} collection`);
139
+ }
140
+ const [frameAttrs, routed] = this.frameRoute(attrs, {owner, tag:canvasTag, prefix:'canvas_', composed:EDITOR_FRAME_COMPOSED});
141
+ const canvasAttrs = {...routed, node_label:'canvas', frameTarget:true, height:'100%', box_height:'100%'};
142
+ this.validateNodeValues(canvasTag, null, canvasAttrs);
143
+ const frame = parent.framePane({height:'400px', ...frameAttrs});
144
+ frame.center[canvasTag](canvasAttrs);
145
+ if (toolbar) toolbar(frame.top.menu({presentation:'bar', node_label:'bar', aria_label:'Editor toolbar', labelPosition:'tooltip'}));
146
+ return frame;
147
+ }
148
+
112
149
  /** Compose real Source nodes; frame/grid/menu retain their existing runtime owners. */
113
150
  frameGrid(parent, {storepath, rowMode, structpath, searchOn = false, searchHelp = false, chart = false,
114
- export: exportRows = false, printRows = false, advancedTools = false, addrow = false, addrow_defaults = null,
115
- duprow = false, delrow = false, gridsemaphore = false, ...attrs} = {}) {
151
+ export: exportRows = false, printRows = false, advancedTools = false, addrow = false, addrow_defaults = null, addrow_label = null,
152
+ duprow = false, delrow = false, delrow_label = null, gridsemaphore = false, ...attrs} = {}) {
116
153
  for (const tag of ['framePane', 'grid']) {
117
154
  if (!this.schemaTag(tag)) throw new TypeError(`frameGrid requires the ${tag} collection`);
118
155
  }
119
- const chartOptions = {};
120
- for (const key of Object.keys(attrs)) if (key.startsWith('chart_')) {
121
- chartOptions[key.slice(6)] = attrs[key]; delete attrs[key];
122
- }
156
+ const chartOptions = objectExtract(attrs, 'chart_*');
123
157
  const [frameAttrs, routed] = this.frameGridRoute(attrs);
124
158
  const twice = Object.keys(routed).find(name => ['storepath', 'rowMode'].includes(name) || name === 'structpath' && structpath != null);
125
159
  if (twice !== undefined) throw new TypeError(`frameGrid: '${twice}' is given twice`);
@@ -130,9 +164,10 @@ export class GramlotBuilder extends HtmlBuilder {
130
164
  if (typeof chart === 'string') chartOptions.chartType = chart;
131
165
  } else if (Object.keys(chartOptions).length) throw new TypeError('chart_* options require chart');
132
166
  const exportFormats = frameGridExportFormats(exportRows);
133
- for (const [name, value] of Object.entries({printRows, advancedTools, addrow, duprow, delrow, gridsemaphore})) {
167
+ for (const [name, value] of Object.entries({printRows, advancedTools, addrow, duprow, gridsemaphore})) {
134
168
  if (typeof value !== 'boolean') throw new TypeError(`frameGrid ${name} requires a boolean`);
135
169
  }
170
+ if (typeof delrow !== 'boolean' && delrow !== 'row') throw new TypeError('frameGrid delrow requires a boolean or row');
136
171
  if (addrow_defaults !== null && (!addrow || typeof addrow_defaults !== 'object' || Array.isArray(addrow_defaults))) {
137
172
  throw new TypeError('addrow_defaults requires addrow and a mapping');
138
173
  }
@@ -145,6 +180,10 @@ export class GramlotBuilder extends HtmlBuilder {
145
180
  node_label: 'grid', frameTarget: true, height: '100%', width: '100%',
146
181
  // Legacy frameGrid default: the current row identity at .selectedId of the frame's own datapath.
147
182
  ...(frameAttrs.datapath ? {selectedId: '^.selectedId'} : {}), ...routed};
183
+ if (delrow === 'row') {
184
+ gridAttrs.delrow = delrow;
185
+ if (delrow_label !== null) gridAttrs.delrow_label = delrow_label;
186
+ }
148
187
  if (chart !== false) gridAttrs.nodeId = randomId();
149
188
  this.validateNodeValues('grid', null, gridAttrs);
150
189
  if (searchOn !== false) this.validateNodeValues('searchBox', null, {searchOn, searchHelp});
@@ -152,24 +191,26 @@ export class GramlotBuilder extends HtmlBuilder {
152
191
  frame.center.grid(gridAttrs);
153
192
  const bar = frame.top.menu({presentation:'bar', node_label:'bar', aria_label:'Grid toolbar', class:'gramlot-grid-toolbar'});
154
193
  if (searchOn !== false) bar.menuline({group:true, node_label:'search', class:'gramlot-grid-search'}).searchBox({searchOn, searchHelp});
155
- if (addrow) bar.menuline({command:'grid:addrow', node_label:'addrow', ...(addrow_defaults === null ? {} : {parameters:{defaults:addrow_defaults}})});
194
+ if (addrow) bar.menuline({command:'grid:addrow', node_label:'addrow', class:'button--standard',
195
+ ...(addrow_label === null ? {} : {caption:addrow_label}), ...(addrow_defaults === null ? {} : {parameters:{defaults:addrow_defaults}})});
156
196
  if (duprow) bar.menuline({command:'grid:duprow', node_label:'duprow'});
157
- if (delrow) bar.menuline({command:'grid:delrow', node_label:'delrow'});
197
+ if (delrow === true) bar.menuline({command:'grid:delrow', node_label:'delrow', disabled:true, class:'button--standard',
198
+ ...(delrow_label === null ? {} : {caption:delrow_label})});
158
199
  const exportMenu = parent => {
159
- const menu = parent.menuline({caption:'Export', icon:'⇩', labelPosition:'tooltip', node_label:'export'}).menu();
200
+ const menu = parent.menuline({caption:'Export', icon:'download', labelPosition:'tooltip', node_label:'export'}).menu();
160
201
  for (const name of exportFormats) menu.menuline({command:'grid:export', caption:EXPORT_FORMATS[name], parameters:{format:name}, node_label:name});
161
202
  };
162
203
  if (exportFormats.length) exportMenu(bar);
163
204
  if (printRows) bar.menuline({command:'grid:printRows', node_label:'printRows'});
164
205
  if (advancedTools) {
165
- const tools = bar.menuline({caption:'Advanced tools', icon:'…', labelPosition:'tooltip', node_label:'advancedTools'}).menu();
206
+ const tools = bar.menuline({caption:'Advanced tools', icon:'list', labelPosition:'tooltip', node_label:'advancedTools'}).menu();
166
207
  tools.menuline({command:'grid:lineNumbers', node_label:'lineNumbers'});
167
208
  if (exportFormats.length) exportMenu(tools);
168
209
  if (printRows) tools.menuline({command:'grid:printRows', node_label:'printRows'});
169
210
  }
170
211
  if (gridsemaphore) bar.menuline({group:true, node_label:'semaphore'}).editingStatus();
171
212
  if (chart !== false) {
172
- bar.menuline({caption:'Chart', icon:'▥', labelPosition:'tooltip', node_label:'chart', action:"this.SET('._chart.open',true)"});
213
+ bar.menuline({caption:'Chart', icon:'chart', labelPosition:'tooltip', node_label:'chart', action:"this.SET('._chart.open',true)"});
173
214
  const window = frame.center.floatingPane({title:'Chart', open:'^._chart.open', width:'820px', height:'560px',
174
215
  movable:true, resizable:true, maximizable:true, node_label:'chartWindow'});
175
216
  window.frame.center.chartPane({storepath,rowMode,gridId:gridAttrs.nodeId,configpath:'._chart',
@@ -180,25 +221,35 @@ export class GramlotBuilder extends HtmlBuilder {
180
221
 
181
222
  /** Split frameGrid keywords: unprefixed grid parameters go to the grid, `grid_`/`frame_` force any attribute. */
182
223
  frameGridRoute(attrs) {
183
- const declared = tag => new Set(this.schema[tag].attributes.parameters.filter(parameter => !parameter.kind.startsWith('var_')).map(parameter => parameter.name));
224
+ return this.frameRoute(attrs, {owner:'frameGrid', tag:'grid', prefix:'grid_', composed:FRAME_GRID_COMPOSED, parameters:FRAME_GRID_PARAMETERS});
225
+ }
226
+
227
+ /**
228
+ * Split the keywords of a frame composite between the frame and its central `tag`. Unprefixed parameters
229
+ * of `tag` go to it; `prefix` and `frame_` force any attribute. `composed` names are set by the composite;
230
+ * `parameters` are its own keywords.
231
+ */
232
+ frameRoute(attrs, {owner, tag, prefix, composed, parameters = new Set()}) {
233
+ const declared = name => new Set(this.schema[name].attributes.parameters.filter(parameter => !parameter.kind.startsWith('var_')).map(parameter => parameter.name));
184
234
  const source = new Set([...FRAMEWORK_ATTRIBUTES, ...META_ATTRS]);
185
- const gridNames = declared('grid'), frameNames = declared('framePane');
186
- const pattern = new RegExp(this.schema.grid._meta.parameterPattern);
187
- // A name the frame also accepts stays on the frame unless forced with grid_.
188
- const routed = name => (gridNames.has(name) || pattern.test(name)) && !frameNames.has(name) && !source.has(name)
189
- && !FRAME_GRID_COMPOSED.has(name) && !FRAME_GRID_PARAMETERS.has(name);
190
- const frame = {}, grid = {};
235
+ const childNames = declared(tag), frameNames = declared('framePane');
236
+ // A declared parameter family (grid selected_<field>); most elements declare none.
237
+ const family = this.schema[tag]._meta.parameterPattern, pattern = family ? new RegExp(family) : null;
238
+ // A name the frame also accepts stays on the frame unless forced with the prefix.
239
+ const routed = name => (childNames.has(name) || Boolean(pattern?.test(name))) && !frameNames.has(name) && !source.has(name)
240
+ && !composed.has(name) && !parameters.has(name);
241
+ const frame = {}, child = {};
191
242
  for (const [key, value] of Object.entries(attrs)) {
192
243
  let name, target;
193
- if (key.startsWith('grid_')) {
194
- name = key.slice('grid_'.length); target = grid;
195
- if (FRAME_GRID_COMPOSED.has(name)) throw new TypeError(`frameGrid: '${key}' is composed by frameGrid`);
244
+ if (key.startsWith(prefix)) {
245
+ name = key.slice(prefix.length); target = child;
246
+ if (composed.has(name)) throw new TypeError(`${owner}: '${key}' is composed by ${owner}`);
196
247
  } else if (key.startsWith('frame_')) { name = key.slice('frame_'.length); target = frame; }
197
- else { name = key; target = routed(key) ? grid : frame; }
198
- if (Object.hasOwn(target, name)) throw new TypeError(`frameGrid: '${name}' is given twice`);
248
+ else { name = key; target = routed(key) ? child : frame; }
249
+ if (Object.hasOwn(target, name)) throw new TypeError(`${owner}: '${name}' is given twice`);
199
250
  target[name] = value;
200
251
  }
201
- return [frame, grid];
252
+ return [frame, child];
202
253
  }
203
254
 
204
255
  /** Tag prefixes of the parent dialects, from the `_name` of the classes above GramlotBuilder. */
@@ -14,7 +14,8 @@ const CODE_ATTRIBUTES = {
14
14
  };
15
15
 
16
16
  // The control attributes of `remote`, written on the node as they are; every other parameter becomes `remote_<k>`.
17
- const REMOTE_CONTROLS = ['_cachedRemote', '_if', '_else', '_onRemote', '_onCalling', '_delay', '_timing', '_userChanges'];
17
+ const REMOTE_CONTROLS = ['_cachedRemote', '_if', '_else', '_onRemote', '_onCalling', '_waitingMessage', '_delay', '_timing',
18
+ '_userChanges'];
18
19
  // The inline code attributes of any node whose `remote` is a string.
19
20
  const REMOTE_CODE_ATTRIBUTES = ['_if', '_else', '_onRemote', '_onCalling'];
20
21
 
@@ -204,6 +205,15 @@ export function stringHash(text) {
204
205
  return Math.abs(hash);
205
206
  }
206
207
 
208
+ // Resolver captions are data even when their text starts with a pointer symbol.
209
+ export const resolverMenuLines = new WeakSet();
210
+
211
+ function literalMenuField(node, name, value) {
212
+ if (node.nodeTag !== 'menuline') return false;
213
+ if (name === 'caption') return resolverMenuLines.has(node) || typeof value !== 'string' || !value.startsWith('^');
214
+ return ['tooltip','command'].includes(name);
215
+ }
216
+
207
217
  /** The nearest node of `bag` whose `childname` is `name`: direct children first, then unnamed children's descendants. */
208
218
  function namedChild(bag, name) {
209
219
  const nodes = bag.getNodes();
@@ -288,7 +298,7 @@ export class GramlotBuilderBagNode extends SourceBagNode {
288
298
  frameRegion(region) {
289
299
  if (this.nodeTag !== 'framePane') throw new TypeError('Region accessors require framePane');
290
300
  const existing = this.value instanceof SourceBag
291
- ? this.value.getNodes().find(child => child.getAttr('region') === region) : null;
301
+ ? this.value.getNodes().find(child => child.nodeTag === 'contentPane' && child.getAttr('region') === region) : null;
292
302
  if (existing) return this.builder.wrapSource(existing);
293
303
  const attrs = {region, node_label: region};
294
304
  if (region !== 'center') Object.assign(attrs, {display: 'flex', flex_direction: ['top', 'bottom'].includes(region) ? 'column' : 'row'});
@@ -300,6 +310,7 @@ export class GramlotBuilderBagNode extends SourceBagNode {
300
310
  // The texts of the inline code received with the Source, by the name InlineCompiler uses; null before activation.
301
311
  #activatedCode = null;
302
312
  #requests = null;
313
+ #watches = new Map();
303
314
 
304
315
  /** The requests of this node (NodeRequests): the request in flight and the waiting call of remote, dataRpc and dataRemote. */
305
316
  get requests() {
@@ -372,7 +383,8 @@ export class GramlotBuilderBagNode extends SourceBagNode {
372
383
  /**
373
384
  * Declare the content of this element as the fragment `name` of a `@source` method: writes
374
385
  * `remote = name` and one `remote_<k> = v` per entry of `params` on this node; the control attributes
375
- * `_cachedRemote`, `_if`, `_else`, `_onRemote`, `_onCalling`, `_delay`, `_timing` and `_userChanges` are
386
+ * `_cachedRemote`, `_if`, `_else`, `_onRemote`, `_onCalling`, `_waitingMessage`, `_delay`, `_timing` and
387
+ * `_userChanges` are
376
388
  * written as they are. Returns this node. `name` is a method name, matched by the name syntax of the
377
389
  * page builder (`nameSyntax` of `rootBuilder`), or a `^`/`=` pointer to it; any other name, or another
378
390
  * `_` parameter, is a TypeError.
@@ -405,7 +417,7 @@ export class GramlotBuilderBagNode extends SourceBagNode {
405
417
  pointers() {
406
418
  const datapath = this.getAttr('datapath');
407
419
  const dependencies = pointerTransform(datapath) ? pointerDependencies(this, datapath) : new Set();
408
- const result = super.pointers().filter(([name, pointer]) => !(this.nodeTag === 'menuline' && ['caption','icon','tooltip','command'].includes(name)) && !dependencies.has(name) && !this.#isPathAttribute(name, pointer))
420
+ const result = super.pointers().filter(([name, pointer]) => !literalMenuField(this, name, pointer) && !dependencies.has(name) && !this.#isPathAttribute(name, pointer))
409
421
  .map(([name, pointer]) => [name, pointerTransform(pointer)?.pointer ?? pointer]);
410
422
  for (const name of dependencies) {
411
423
  const value = this.getAttr(name);
@@ -422,7 +434,7 @@ export class GramlotBuilderBagNode extends SourceBagNode {
422
434
  runtimeToEvaluate() {
423
435
  const items = super.runtimeToEvaluate();
424
436
  for (const [name, value] of items) {
425
- if (this.nodeTag === 'menuline' && ['caption','icon','tooltip','command'].includes(name)) {
437
+ if (literalMenuField(this, name, value)) {
426
438
  items.set(name, new BagCbResolver(() => value));
427
439
  continue;
428
440
  }
@@ -516,21 +528,72 @@ export class GramlotBuilderBagNode extends SourceBagNode {
516
528
  /**
517
529
  * FIRE after `delay` ms. A null path (Q7) is an error at the call, not inside the timer. The timer
518
530
  * is tracked on the node's NodeBinding when the node has one, so the close of the node cancels it;
519
- * the returned function cancels it as well.
531
+ * the returned function cancels it as well. As legacy `fireAfter` (`genro.js:1216`), a call
532
+ * cancels the fire still pending for the same absolute path, whichever node scheduled it: the
533
+ * registry is the page's BindingRuntime. A node without a page runtime has no registry.
520
534
  */
521
535
  FIRE_AFTER(path, value = true, delay = 10) {
522
536
  this.#requireWritablePath(path);
523
- const binding = this.rootBuilder?.binding?.bindingFor(this) ?? null;
524
- let release = null;
525
- const timer = setTimeout(() => {
526
- release?.();
527
- this.FIRE(path, value);
537
+ const runtime = this.rootBuilder?.binding ?? null;
538
+ const binding = runtime?.bindingFor(this) ?? null;
539
+ if (runtime) return runtime.fireAfter(this.absDatapath(path), delay, binding, () => this.FIRE(path, value));
540
+ const timer = setTimeout(() => this.FIRE(path, value), delay);
541
+ return () => clearTimeout(timer);
542
+ }
543
+
544
+ /**
545
+ * Legacy `watch` (`gnrdomsource.js:1937`): poll `conditionCb` every `delay` ms (default 200). When it is
546
+ * already true, `action` runs at once; otherwise the first poll that finds it true stops the watch, then
547
+ * runs `action`. A second `watch` with the same `watchId` replaces the first. `action` may be null: a
548
+ * `conditionCb` that works and returns false then runs until `unwatch`. The watches of a node stop when
549
+ * the node closes (the timer is tracked on its NodeBinding, as `FIRE_AFTER`).
550
+ */
551
+ watch(watchId, conditionCb, action = null, delay = 200) {
552
+ delay = delay || 200;
553
+ this.unwatch(watchId);
554
+ if (conditionCb()) {
555
+ action?.();
556
+ return;
557
+ }
558
+ const binding = this.#openBinding();
559
+ const timer = setInterval(() => {
560
+ if (!conditionCb()) return;
561
+ this.unwatch(watchId);
562
+ action?.();
528
563
  }, delay);
529
- release = binding?.track(() => clearTimeout(timer)) ?? null;
530
- return () => {
531
- clearTimeout(timer);
564
+ const release = binding?.track(() => clearInterval(timer)) ?? null;
565
+ this.#watches.set(watchId, () => {
566
+ clearInterval(timer);
532
567
  release?.();
533
- };
568
+ });
569
+ }
570
+
571
+ /** Legacy `unwatch` (`gnrdomsource.js:1930`): stop the watch `watchId` of this node; an unknown id does nothing. */
572
+ unwatch(watchId) {
573
+ const stop = this.#watches.get(watchId);
574
+ if (!stop) return;
575
+ this.#watches.delete(watchId);
576
+ stop();
577
+ }
578
+
579
+ /**
580
+ * Legacy `fireNode` (`gnrdomsource.js:179`): run now the provider of this node (`dataFormula`,
581
+ * `dataController`, `dataRpc`, `dataRemote`) with `runKwargs` merged over its arguments, trigger kind
582
+ * `fireNode`. Returns what `invoke` returns (the promise of a `dataRpc`). A node without a provider is
583
+ * an error; a node without an open NodeBinding runs nothing, as a closed provider.
584
+ */
585
+ fireNode(runKwargs = {}) {
586
+ const binding = this.#openBinding();
587
+ if (binding === null) return undefined;
588
+ const [provider] = binding.providers;
589
+ if (!provider) throw new Error(`fireNode: '${this.label}' has no provider`);
590
+ return provider.invoke({kind: 'fireNode', change: null, runKwargs});
591
+ }
592
+
593
+ /** The open NodeBinding of this node; null for a node outside a Source or without one. */
594
+ #openBinding() {
595
+ if (this.parentBag === null) return null;
596
+ return this.rootBuilder?.binding?.bindingFor(this) ?? null;
534
597
  }
535
598
 
536
599
  /**