@jxsuite/studio 4.0.0 → 5.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 (613) hide show
  1. package/README.md +1 -1
  2. package/data/elements-meta.json +5 -15
  3. package/data/html-meta.json +51 -6
  4. package/dist/chunks/{2020-xp8vnwma.js → 2020-g79n01v9.js} +14 -14
  5. package/dist/chunks/action-group-sp6tna8v.js +118 -0
  6. package/dist/chunks/adapter-nj7tnjfn.js +13 -0
  7. package/dist/chunks/cf-account-picker-fyf63pmy.js +495 -0
  8. package/dist/chunks/cf-settings-71bv5zn9.js +20 -0
  9. package/dist/chunks/color-area-v17df7b8.js +154 -0
  10. package/dist/chunks/color-field-anwybnkn.js +208 -0
  11. package/dist/chunks/color-slider-44ez96fc.js +79 -0
  12. package/dist/chunks/color-xgg3kfw7.js +35 -0
  13. package/dist/chunks/combobox-5e7jev23.js +236 -0
  14. package/dist/chunks/components-2w1f35qs.js +18 -0
  15. package/dist/chunks/content-source-3wqeas45.js +46 -0
  16. package/dist/chunks/convert-to-repeater-d0cgnb6d.js +639 -0
  17. package/dist/chunks/dialog-s890b918.js +85 -0
  18. package/dist/chunks/editor-3qhbg51x.js +35 -0
  19. package/dist/chunks/entry-commands-d6g50j7s.js +42 -0
  20. package/dist/chunks/extension-sections-fy7q4fe9.js +651 -0
  21. package/dist/chunks/file-ops-3btj6st0.js +47 -0
  22. package/dist/chunks/files-ef8fgs3w.js +72 -0
  23. package/dist/chunks/format-host-3c33nwr8.js +40 -0
  24. package/dist/chunks/fs-events-13tj6sex.js +18 -0
  25. package/dist/chunks/git-panel-4wp2rn9b.js +49 -0
  26. package/dist/chunks/icons-yy10wk9r.js +402 -0
  27. package/dist/chunks/iframe-entry-15g3n6xv.js +114 -0
  28. package/dist/chunks/iframe-entry-b27vq81n.js +203 -0
  29. package/dist/chunks/iframe-entry-nbyxee1y.js +154 -0
  30. package/dist/chunks/iframe-host-jgesd924.js +115 -0
  31. package/dist/chunks/{index-nj44jpzj.js → index-mdmyx6s2.js} +11 -11
  32. package/dist/chunks/index-n4j7qxyr.js +109 -0
  33. package/dist/chunks/{javascript-q8kpmfah.js → javascript-xvrfrpkb.js} +8 -9
  34. package/dist/chunks/{jsonMode-dkr040ga.js → jsonMode-tyx2kj6p.js} +526 -527
  35. package/dist/chunks/jx-validate-j0wxk72w.js +15 -0
  36. package/dist/chunks/layers-1nq5evsh.js +29 -0
  37. package/dist/chunks/layers-panel-ar2gh90g.js +40 -0
  38. package/dist/chunks/listbox-6v2ac08j.js +44 -0
  39. package/dist/chunks/lit-html-m244w9nh.js +17 -0
  40. package/dist/chunks/media-picker-2qbetq73.js +33 -0
  41. package/dist/chunks/menu-q99sy9rf.js +285 -0
  42. package/dist/chunks/menu-rf7n72mf.js +14 -0
  43. package/dist/chunks/{monaco-binding-rj6xpx9y.js → monaco-binding-sw6en4dw.js} +12 -15
  44. package/dist/chunks/monaco-buffer-bhy3hb6m.js +24 -0
  45. package/dist/chunks/{monaco-setup-rws7k4br.js → monaco-setup-8r62fj6y.js} +27 -37
  46. package/dist/chunks/notify-628t0anh.js +21 -0
  47. package/dist/chunks/number-field-5cndyft8.js +72 -0
  48. package/dist/chunks/parse-0zx14y15.js +10 -0
  49. package/dist/chunks/platform-ts9cg1a4.js +15 -0
  50. package/dist/chunks/popover-47z3ytva.js +25 -0
  51. package/dist/chunks/publish-panel-98f7sr3g.js +27 -0
  52. package/dist/chunks/quick-search-srzz83k2.js +45 -0
  53. package/dist/chunks/references-n553f0e1.js +26 -0
  54. package/dist/chunks/right-panel-rrgx2dn3.js +45 -0
  55. package/dist/chunks/section-registry-5pq32t0q.js +25 -0
  56. package/dist/chunks/select-2r16ez41.js +49 -0
  57. package/dist/chunks/split-g7nm1rgb.js +191 -0
  58. package/dist/chunks/studio-0hqbpbd0.js +62 -0
  59. package/dist/chunks/studio-18avnhjp.js +2430 -0
  60. package/dist/chunks/{studio-kryvsw6j.js → studio-1k325pwf.js} +48 -48
  61. package/dist/chunks/{studio-hbtp0eh1.js → studio-25hkdrkw.js} +356 -85
  62. package/dist/chunks/studio-26d7myd1.js +258 -0
  63. package/dist/chunks/{studio-p8j86wag.js → studio-38emantv.js} +22 -5
  64. package/dist/chunks/studio-3gxv60tn.js +422 -0
  65. package/dist/chunks/{studio-8swrjbny.js → studio-3hxkd92t.js} +275 -163
  66. package/dist/chunks/studio-4m0haseg.js +185 -0
  67. package/dist/chunks/{studio-ynxwkrzd.js → studio-4wbb9ct0.js} +1953 -1785
  68. package/dist/chunks/{studio-gv8vvshc.js → studio-5523bpzt.js} +11 -11
  69. package/dist/chunks/{studio-5q69gfag.js → studio-57mf66w2.js} +1753 -2484
  70. package/dist/chunks/studio-5jy81t3s.js +17463 -0
  71. package/dist/chunks/studio-5rt7sqa0.js +1168 -0
  72. package/dist/chunks/studio-5te5tqng.js +81 -0
  73. package/dist/chunks/{studio-p4ngc046.js → studio-6ewqv390.js} +9 -9
  74. package/dist/chunks/{studio-9ab8gqsm.js → studio-6nzaktvy.js} +7 -7
  75. package/dist/chunks/studio-6xa21ej9.js +28 -0
  76. package/dist/chunks/{studio-5ehhackm.js → studio-727xh0e3.js} +19 -19
  77. package/dist/chunks/{studio-eenfkt4e.js → studio-79y5sz51.js} +52 -38
  78. package/dist/chunks/{studio-4q0wznzf.js → studio-7e11jpa9.js} +461 -145
  79. package/dist/chunks/{studio-q7v10cg2.js → studio-7r42c6ca.js} +17 -7
  80. package/dist/chunks/studio-7xptrg0j.js +954 -0
  81. package/dist/chunks/{studio-cft9r4r7.js → studio-81390n6f.js} +22 -22
  82. package/dist/chunks/{studio-q43a5y9h.js → studio-8jn5yhyn.js} +16 -16
  83. package/dist/chunks/studio-8qtrpzr3.js +839 -0
  84. package/dist/chunks/{studio-dg7zyt5x.js → studio-98b3z07n.js} +1 -1
  85. package/dist/chunks/studio-9xxz1q69.js +1356 -0
  86. package/dist/chunks/studio-akbww0j5.js +13615 -0
  87. package/dist/chunks/studio-arfpe389.js +195 -0
  88. package/dist/chunks/{studio-2zkz8evn.js → studio-az3zd49t.js} +473 -281
  89. package/dist/chunks/studio-cpvb2ed1.js +1171 -0
  90. package/dist/chunks/{studio-9r6j5ev1.js → studio-d0300636.js} +5078 -19
  91. package/dist/chunks/{studio-bgxt93ga.js → studio-d055c37e.js} +13 -13
  92. package/dist/chunks/studio-d1ja2x9r.js +362 -0
  93. package/dist/chunks/{studio-b9b6t1dg.js → studio-e1f24eff.js} +5664 -5666
  94. package/dist/chunks/{studio-4pqqxbrt.js → studio-em9nw8eh.js} +301 -112
  95. package/dist/chunks/studio-erdatzvp.js +1190 -0
  96. package/dist/chunks/{studio-g1wdche0.js → studio-esrxgwh6.js} +80 -80
  97. package/dist/chunks/studio-fabxk6r9.js +2811 -0
  98. package/dist/chunks/{studio-3n4ndrzh.js → studio-h4nvnjvz.js} +303 -303
  99. package/dist/chunks/studio-hhvs4sdg.js +195 -0
  100. package/dist/chunks/{studio-68n67094.js → studio-kcgff4r0.js} +15 -18
  101. package/dist/chunks/{studio-685s0ytq.js → studio-nqgawfks.js} +572 -572
  102. package/dist/chunks/{studio-xrapxwwc.js → studio-p1dw8wfw.js} +55 -29
  103. package/dist/chunks/studio-pm6hgy7r.js +4763 -0
  104. package/dist/chunks/studio-q0a3yk4n.js +33 -0
  105. package/dist/chunks/{studio-wcy8trfx.js → studio-q3x06vmj.js} +23 -22
  106. package/dist/chunks/studio-qahxvnan.js +111 -0
  107. package/dist/chunks/{studio-53n8bp04.js → studio-r6xmmtfh.js} +1 -1
  108. package/dist/chunks/{studio-kjjsjak4.js → studio-rkstz940.js} +3661 -6136
  109. package/dist/chunks/{studio-tvgyw9xw.js → studio-rnyf3f8e.js} +83 -250
  110. package/dist/chunks/studio-rpyah2ew.js +2805 -0
  111. package/dist/chunks/studio-rs76k67r.js +12 -0
  112. package/dist/chunks/{studio-yxrkyv8a.js → studio-s6z853aq.js} +12108 -11766
  113. package/dist/chunks/{studio-sf7zjgv1.js → studio-sgdc5pfc.js} +8 -8
  114. package/dist/chunks/studio-tb3ev01j.js +763 -0
  115. package/dist/chunks/{studio-t5wqwzdh.js → studio-tjjk7jvk.js} +1 -1
  116. package/dist/chunks/studio-vhv5tgxm.js +51 -0
  117. package/dist/chunks/{studio-htsf0w6m.js → studio-vz68yn9e.js} +31 -154
  118. package/dist/chunks/studio-wqpngpsk.js +174 -0
  119. package/dist/chunks/{studio-eesa1myv.js → studio-x3rty6tr.js} +58 -58
  120. package/dist/chunks/studio-xsykpvsh.js +8448 -0
  121. package/dist/chunks/{studio-92ab2jqe.js → studio-y9zedyjn.js} +14 -14
  122. package/dist/chunks/studio-yxa81f45.js +12 -0
  123. package/dist/chunks/swatch-group-t0n6h2rn.js +139 -0
  124. package/dist/chunks/tabs-wbp1cdws.js +156 -0
  125. package/dist/chunks/textfield-abk6qyee.js +73 -0
  126. package/dist/chunks/toast-780pvfbv.js +27 -0
  127. package/dist/chunks/toast-host-3sqv46sn.js +116 -0
  128. package/dist/chunks/toolbar-xbh5bhtr.js +194 -0
  129. package/dist/chunks/tooltip-eptb614w.js +369 -0
  130. package/dist/chunks/tree-a73p0pqm.js +367 -0
  131. package/dist/chunks/{tsMode-76kr53q0.js → tsMode-jy4m86rv.js} +83 -85
  132. package/dist/chunks/workspace-wrew8zk4.js +69 -0
  133. package/dist/chunks/{ws-client-6shc5rze.js → ws-client-ny4zc51r.js} +20 -22
  134. package/dist/iframe-entry.js +1812 -698
  135. package/dist/manifest.json +7 -0
  136. package/dist/studio.js +52900 -36573
  137. package/dist/workers/editor.worker.js +1040 -1085
  138. package/dist/workers/json.worker.js +1946 -1991
  139. package/dist/workers/ts.worker.js +4960 -5005
  140. package/favicon.ico +0 -0
  141. package/index.html +2 -0
  142. package/package.json +22 -55
  143. package/src/about/about-modal.ts +73 -123
  144. package/src/browse/library-commands.ts +20 -49
  145. package/src/browse/library-layouts.ts +87 -218
  146. package/src/browse/library-pane.ts +406 -438
  147. package/src/canvas/canvas-helpers.ts +0 -49
  148. package/src/canvas/canvas-live-render.ts +25 -2
  149. package/src/canvas/canvas-render.ts +666 -231
  150. package/src/canvas/canvas-surface.ts +0 -1
  151. package/src/canvas/canvas-utils.ts +310 -117
  152. package/src/canvas/dialog-path.ts +76 -0
  153. package/src/canvas/dialog-state.ts +67 -0
  154. package/src/canvas/diff-marks.ts +252 -0
  155. package/src/canvas/diff-toolbar.ts +349 -0
  156. package/src/canvas/diff-view.ts +123 -0
  157. package/src/canvas/edit-width-drag.ts +187 -0
  158. package/src/canvas/edit-width.ts +150 -0
  159. package/src/canvas/iframe-entry.ts +125 -8
  160. package/src/canvas/iframe-host.ts +271 -15
  161. package/src/canvas/iframe-interaction.ts +133 -13
  162. package/src/canvas/iframe-patch.ts +7 -1
  163. package/src/canvas/iframe-position.ts +5 -6
  164. package/src/canvas/iframe-protocol.ts +106 -5
  165. package/src/canvas/iframe-render.ts +373 -5
  166. package/src/canvas/iframe-slash.ts +2 -2
  167. package/src/canvas/iframe-subtree.ts +5 -8
  168. package/src/canvas/path-mapping.ts +25 -3
  169. package/src/canvas/popover-path.ts +106 -0
  170. package/src/canvas/popover-state.ts +155 -0
  171. package/src/canvas/surface-registry.ts +21 -10
  172. package/src/collab/presence-chips.ts +51 -73
  173. package/src/commands/app-commands.ts +10 -0
  174. package/src/commands/budget.ts +12 -0
  175. package/src/commands/command-args.ts +369 -6
  176. package/src/commands/defaults.ts +44 -14
  177. package/src/commands/live-context.ts +11 -5
  178. package/src/commands/reference.ts +12 -2
  179. package/src/commands/registry.ts +165 -8
  180. package/src/content/entry-commands.ts +16 -23
  181. package/src/content/entry-editor.ts +144 -101
  182. package/src/editor/canvas-slash-bridge.ts +2 -2
  183. package/src/editor/context-menu.ts +49 -200
  184. package/src/editor/convert-to-component.ts +42 -82
  185. package/src/editor/convert-to-repeater.ts +132 -173
  186. package/src/editor/inline-edit.ts +11 -0
  187. package/src/editor/shortcuts.ts +65 -26
  188. package/src/editor/slash-menu.ts +150 -157
  189. package/src/files/file-ops.ts +117 -11
  190. package/src/files/files.ts +949 -664
  191. package/src/files/json-layout.ts +474 -0
  192. package/src/files/media-paths.ts +13 -42
  193. package/src/files/media-usage.ts +41 -131
  194. package/src/files/serialize-document.ts +8 -1
  195. package/src/format/convert-file.ts +16 -10
  196. package/src/format/format-host.ts +50 -1
  197. package/src/github/github-auth.ts +71 -29
  198. package/src/github/github-publish.ts +57 -65
  199. package/src/grid/cell-editors.ts +46 -4
  200. package/src/grid/cell-popovers.ts +65 -62
  201. package/src/grid/grid-open.ts +86 -64
  202. package/src/grid/grid-panel.ts +390 -469
  203. package/src/grid/redirects-grid.ts +40 -44
  204. package/src/hosting/document.ts +2 -0
  205. package/src/hosting/layout.ts +10 -0
  206. package/src/i18n/i18n-commands.ts +127 -62
  207. package/src/media/media-pane.ts +83 -133
  208. package/src/new-project/add-repo-modal.ts +125 -176
  209. package/src/new-project/import-tab.ts +201 -250
  210. package/src/new-project/location-fields.ts +101 -165
  211. package/src/new-project/new-project-modal.ts +376 -367
  212. package/src/packages/jxsuite-update.ts +76 -18
  213. package/src/panels/activity-panel.ts +137 -104
  214. package/src/panels/ai-chat/chat-markdown.ts +15 -13
  215. package/src/panels/ai-chat/chat-view.ts +307 -472
  216. package/src/panels/ai-chat/composer.ts +175 -153
  217. package/src/panels/ai-chat/sessions-view.ts +31 -62
  218. package/src/panels/ai-panel.ts +210 -185
  219. package/src/panels/block-action-bar.ts +437 -643
  220. package/src/panels/bottom-dock.ts +112 -47
  221. package/src/panels/chat-panel.ts +19 -14
  222. package/src/panels/data-explorer.ts +141 -102
  223. package/src/panels/data-grid.ts +183 -150
  224. package/src/panels/dnd.ts +75 -20
  225. package/src/panels/editors.ts +26 -19
  226. package/src/panels/elements-panel.ts +243 -186
  227. package/src/panels/empty-state.ts +26 -42
  228. package/src/panels/events-panel.ts +950 -729
  229. package/src/panels/formula-workspace.ts +434 -207
  230. package/src/panels/frontmatter-fields.ts +185 -153
  231. package/src/panels/frontmatter-panel.ts +411 -187
  232. package/src/panels/git-diff-open.ts +148 -0
  233. package/src/panels/git-panel.ts +679 -605
  234. package/src/panels/head-panel.ts +617 -435
  235. package/src/panels/i18n-panel.ts +153 -133
  236. package/src/panels/imports-panel.ts +388 -414
  237. package/src/panels/jump-bar.ts +174 -147
  238. package/src/panels/layers-panel.ts +785 -671
  239. package/src/panels/left-panel.ts +166 -94
  240. package/src/panels/navigator-panels.ts +1 -1
  241. package/src/panels/pane-context.ts +529 -677
  242. package/src/panels/pane-grid.ts +265 -241
  243. package/src/panels/panel-registry.ts +15 -4
  244. package/src/panels/problems-panel.ts +177 -99
  245. package/src/panels/properties-panel.ts +1525 -966
  246. package/src/panels/provenance.ts +31 -113
  247. package/src/panels/quick-search.ts +217 -172
  248. package/src/panels/right-panel.ts +135 -169
  249. package/src/panels/seo-modal.ts +346 -167
  250. package/src/panels/settings-menu.ts +109 -646
  251. package/src/panels/settings-pane.ts +102 -86
  252. package/src/panels/signals-panel.ts +1318 -1172
  253. package/src/panels/statement-editor.ts +556 -428
  254. package/src/panels/style-panel.ts +1367 -630
  255. package/src/panels/style-utils.ts +36 -32
  256. package/src/panels/stylebook-doc.ts +30 -73
  257. package/src/panels/stylebook-layers-panel.ts +202 -109
  258. package/src/panels/stylebook-panel.ts +124 -88
  259. package/src/panels/tab-strip.ts +385 -287
  260. package/src/platforms/cloud.ts +347 -86
  261. package/src/platforms/devserver.ts +13 -0
  262. package/src/publish/deploy-checklist.ts +124 -78
  263. package/src/publish/publish-commands.ts +4 -12
  264. package/src/publish/publish-panel.ts +165 -299
  265. package/src/services/a11y-report.ts +100 -43
  266. package/src/services/ai-command-tools.ts +468 -0
  267. package/src/services/ai-import-tools.ts +50 -12
  268. package/src/services/ai-models.ts +108 -1
  269. package/src/services/ai-session-store.ts +6 -0
  270. package/src/services/ai-system-prompt.ts +110 -18
  271. package/src/services/ai-tools.ts +28 -143
  272. package/src/services/ai-write-report.ts +174 -0
  273. package/src/services/context-manager.ts +12 -1
  274. package/src/services/document-assistant.ts +50 -2
  275. package/src/services/idle.ts +16 -14
  276. package/src/services/live-surfaces.ts +237 -0
  277. package/src/services/model-uri.ts +75 -0
  278. package/src/services/notify.ts +63 -6
  279. package/src/services/popover-report.ts +325 -0
  280. package/src/services/surface-registry.ts +56 -0
  281. package/src/services/tool-executor.ts +17 -0
  282. package/src/settings/contexts-section.ts +301 -299
  283. package/src/settings/contributed-section.ts +361 -222
  284. package/src/settings/css-vars-editor.ts +320 -325
  285. package/src/settings/defs-editor.ts +572 -535
  286. package/src/settings/dependencies-editor.ts +79 -107
  287. package/src/settings/extension-commands.ts +379 -0
  288. package/src/settings/extension-rows.ts +113 -0
  289. package/src/settings/extensions-section.ts +287 -0
  290. package/src/settings/general-settings.ts +130 -181
  291. package/src/settings/head-editor.ts +10 -305
  292. package/src/settings/locales-section.ts +146 -196
  293. package/src/settings/preferences-accounts.ts +193 -12
  294. package/src/settings/preferences-dialog.ts +384 -307
  295. package/src/settings/project-sections.ts +108 -181
  296. package/src/settings/schema-field-ui.ts +11 -399
  297. package/src/settings/section-registry.ts +8 -1
  298. package/src/settings/settings-document.ts +31 -29
  299. package/src/shell/tree.ts +42 -87
  300. package/src/shell.ts +48 -36
  301. package/src/studio.ts +90 -67
  302. package/src/style/token-ref.ts +0 -39
  303. package/src/surfaces/about.json +263 -0
  304. package/src/surfaces/about.ts +163 -0
  305. package/src/surfaces/add-repo.json +486 -0
  306. package/src/surfaces/add-repo.ts +236 -0
  307. package/src/surfaces/ai-chat.json +2185 -0
  308. package/src/surfaces/ai-chat.ts +549 -0
  309. package/src/surfaces/ai-credentials-form.json +332 -0
  310. package/src/surfaces/ai-credentials-form.ts +151 -0
  311. package/src/surfaces/ai-managed-connect.json +108 -0
  312. package/src/surfaces/ai-managed-connect.ts +123 -0
  313. package/src/surfaces/ai-model-picker.json +114 -0
  314. package/src/surfaces/ai-model-picker.ts +139 -0
  315. package/src/surfaces/block-action-bar.json +640 -0
  316. package/src/surfaces/block-action-bar.ts +368 -0
  317. package/src/surfaces/bottom-dock.json +154 -0
  318. package/src/surfaces/bottom-dock.ts +125 -0
  319. package/src/surfaces/canvas-stage.json +444 -0
  320. package/src/surfaces/canvas-stage.ts +253 -0
  321. package/src/surfaces/cf-account-picker.json +300 -0
  322. package/src/surfaces/cf-account-picker.ts +214 -0
  323. package/src/surfaces/commandbar.json +984 -0
  324. package/src/{panels/toolbar.ts → surfaces/commandbar.ts} +414 -389
  325. package/src/surfaces/convert-repeater.json +309 -0
  326. package/src/surfaces/convert-repeater.ts +276 -0
  327. package/src/surfaces/data-actions.json +157 -0
  328. package/src/surfaces/data-actions.ts +115 -0
  329. package/src/surfaces/dialog.json +289 -0
  330. package/src/surfaces/dialog.ts +343 -0
  331. package/src/surfaces/diff-toolbar.json +266 -0
  332. package/src/surfaces/diff-toolbar.ts +139 -0
  333. package/src/surfaces/doc-header.json +739 -0
  334. package/src/surfaces/doc-header.ts +223 -0
  335. package/src/surfaces/empty-state.json +152 -0
  336. package/src/surfaces/empty-state.ts +173 -0
  337. package/src/surfaces/entry-editor.json +281 -0
  338. package/src/surfaces/entry-editor.ts +191 -0
  339. package/src/surfaces/expression-editor.json +977 -0
  340. package/src/surfaces/expression-editor.ts +266 -0
  341. package/src/surfaces/files-panel.json +592 -0
  342. package/src/surfaces/files-panel.ts +301 -0
  343. package/src/surfaces/formula-palette.json +364 -0
  344. package/src/surfaces/formula-palette.ts +340 -0
  345. package/src/surfaces/git-panel.json +1822 -0
  346. package/src/surfaces/git-panel.ts +272 -0
  347. package/src/surfaces/github-auth.json +112 -0
  348. package/src/surfaces/github-auth.ts +139 -0
  349. package/src/surfaces/github-publish.json +206 -0
  350. package/src/surfaces/github-publish.ts +169 -0
  351. package/src/surfaces/grid-cell.json +218 -0
  352. package/src/surfaces/grid-cell.ts +120 -0
  353. package/src/surfaces/grid-open.json +147 -0
  354. package/src/surfaces/grid-open.ts +87 -0
  355. package/src/surfaces/grid-panel.json +706 -0
  356. package/src/surfaces/grid-panel.ts +206 -0
  357. package/src/surfaces/grid-replace.json +179 -0
  358. package/src/surfaces/grid-replace.ts +89 -0
  359. package/src/surfaces/grid-views.json +446 -0
  360. package/src/surfaces/grid-views.ts +172 -0
  361. package/src/surfaces/inspector-dock.json +187 -0
  362. package/src/surfaces/inspector-dock.ts +161 -0
  363. package/src/surfaces/jump-bar.json +243 -0
  364. package/src/surfaces/jump-bar.ts +129 -0
  365. package/src/surfaces/jxsuite-update.json +146 -0
  366. package/src/surfaces/jxsuite-update.ts +149 -0
  367. package/src/surfaces/library-pane.json +1509 -0
  368. package/src/surfaces/library-pane.ts +363 -0
  369. package/src/surfaces/logic-panel.json +1949 -0
  370. package/src/surfaces/logic-panel.ts +369 -0
  371. package/src/surfaces/logic-workspace.json +685 -0
  372. package/src/surfaces/logic-workspace.ts +238 -0
  373. package/src/surfaces/media-browser.json +303 -0
  374. package/src/surfaces/media-browser.ts +145 -0
  375. package/src/surfaces/media-field.json +163 -0
  376. package/src/surfaces/media-field.ts +116 -0
  377. package/src/surfaces/media-pane.json +513 -0
  378. package/src/surfaces/media-pane.ts +197 -0
  379. package/src/surfaces/menu.json +232 -0
  380. package/src/surfaces/menu.ts +375 -0
  381. package/src/surfaces/navigator-dock.json +113 -0
  382. package/src/surfaces/navigator-dock.ts +130 -0
  383. package/src/surfaces/new-project.json +1654 -0
  384. package/src/surfaces/new-project.ts +411 -0
  385. package/src/surfaces/palette.json +535 -0
  386. package/src/surfaces/pane-context.json +1497 -0
  387. package/src/surfaces/pane-context.ts +513 -0
  388. package/src/surfaces/pane-grid.json +188 -0
  389. package/src/surfaces/pane-grid.ts +250 -0
  390. package/src/surfaces/panel-activity.json +563 -0
  391. package/src/surfaces/panel-activity.ts +187 -0
  392. package/src/surfaces/panel-data.json +141 -0
  393. package/src/surfaces/panel-data.ts +156 -0
  394. package/src/surfaces/panel-deploy-checklist.json +283 -0
  395. package/src/surfaces/panel-deploy-checklist.ts +175 -0
  396. package/src/surfaces/panel-elements.json +367 -0
  397. package/src/surfaces/panel-elements.ts +175 -0
  398. package/src/surfaces/panel-i18n.json +569 -0
  399. package/src/surfaces/panel-i18n.ts +212 -0
  400. package/src/surfaces/panel-imports.json +780 -0
  401. package/src/surfaces/panel-imports.ts +209 -0
  402. package/src/surfaces/panel-outline.json +734 -0
  403. package/src/surfaces/panel-outline.ts +326 -0
  404. package/src/surfaces/panel-page.json +1017 -0
  405. package/src/surfaces/panel-page.ts +240 -0
  406. package/src/surfaces/panel-problems.json +497 -0
  407. package/src/surfaces/panel-problems.ts +157 -0
  408. package/src/surfaces/panel-signals.json +1973 -0
  409. package/src/surfaces/panel-signals.ts +436 -0
  410. package/src/surfaces/panel-stylebook-layers.json +317 -0
  411. package/src/surfaces/panel-stylebook-layers.ts +155 -0
  412. package/src/surfaces/preferences.json +850 -0
  413. package/src/surfaces/preferences.ts +332 -0
  414. package/src/surfaces/progress-modal.json +110 -0
  415. package/src/surfaces/progress-modal.ts +150 -0
  416. package/src/surfaces/properties-panel.json +1578 -0
  417. package/src/surfaces/properties-panel.ts +337 -0
  418. package/src/surfaces/publish.json +945 -0
  419. package/src/surfaces/publish.ts +392 -0
  420. package/src/surfaces/push-plan.json +110 -0
  421. package/src/surfaces/push-plan.ts +87 -0
  422. package/src/surfaces/rail.json +255 -0
  423. package/src/surfaces/rail.ts +206 -0
  424. package/src/surfaces/reference-field.json +191 -0
  425. package/src/surfaces/reference-field.ts +168 -0
  426. package/src/surfaces/schema-builder.json +1011 -0
  427. package/src/surfaces/schema-builder.ts +181 -0
  428. package/src/surfaces/schema-form.json +1013 -0
  429. package/src/surfaces/schema-form.ts +287 -0
  430. package/src/surfaces/secret-field.json +60 -0
  431. package/src/surfaces/secret-field.ts +146 -0
  432. package/src/surfaces/seo.json +932 -0
  433. package/src/surfaces/seo.ts +334 -0
  434. package/src/surfaces/settings-contexts.json +538 -0
  435. package/src/surfaces/settings-contexts.ts +196 -0
  436. package/src/surfaces/settings-contributed.json +489 -0
  437. package/src/surfaces/settings-contributed.ts +199 -0
  438. package/src/surfaces/settings-css-vars.json +820 -0
  439. package/src/surfaces/settings-css-vars.ts +199 -0
  440. package/src/surfaces/settings-defs.json +1363 -0
  441. package/src/surfaces/settings-defs.ts +232 -0
  442. package/src/surfaces/settings-deploy.json +108 -0
  443. package/src/surfaces/settings-deploy.ts +135 -0
  444. package/src/surfaces/settings-extensions.json +486 -0
  445. package/src/surfaces/settings-extensions.ts +201 -0
  446. package/src/surfaces/settings-head.json +779 -0
  447. package/src/surfaces/settings-head.ts +397 -0
  448. package/src/surfaces/settings-locales.json +420 -0
  449. package/src/surfaces/settings-locales.ts +137 -0
  450. package/src/surfaces/settings-overview.json +423 -0
  451. package/src/surfaces/settings-overview.ts +218 -0
  452. package/src/surfaces/settings-packages.json +549 -0
  453. package/src/surfaces/settings-packages.ts +158 -0
  454. package/src/surfaces/settings-pane.json +147 -0
  455. package/src/surfaces/settings-pane.ts +150 -0
  456. package/src/surfaces/settings-rawjson.json +104 -0
  457. package/src/surfaces/settings-rawjson.ts +107 -0
  458. package/src/surfaces/shell.json +99 -0
  459. package/src/surfaces/shell.ts +30 -0
  460. package/src/surfaces/slash-menu.json +180 -0
  461. package/src/surfaces/slash-menu.ts +272 -0
  462. package/src/surfaces/statements.json +607 -0
  463. package/src/surfaces/statements.ts +238 -0
  464. package/src/surfaces/statusbar.json +94 -0
  465. package/src/{panels → surfaces}/statusbar.ts +163 -90
  466. package/src/surfaces/style-panel.json +1643 -0
  467. package/src/surfaces/style-panel.ts +338 -0
  468. package/src/surfaces/stylebook-chrome.json +122 -0
  469. package/src/surfaces/stylebook-chrome.ts +122 -0
  470. package/src/surfaces/tab-strip.json +448 -0
  471. package/src/surfaces/tab-strip.ts +200 -0
  472. package/src/surfaces/target-line.json +419 -0
  473. package/src/surfaces/target-line.ts +349 -0
  474. package/src/surfaces/toasts.json +189 -0
  475. package/src/surfaces/welcome.json +571 -0
  476. package/src/surfaces/welcome.ts +338 -0
  477. package/src/tabs/project-config.ts +71 -15
  478. package/src/tabs/tab.ts +52 -1
  479. package/src/types.ts +49 -3
  480. package/src/ui/ai-credentials-form.ts +104 -100
  481. package/src/ui/ai-managed-connect.ts +116 -49
  482. package/src/ui/ai-model-picker.ts +102 -47
  483. package/src/ui/cf-account-picker.ts +135 -0
  484. package/src/ui/color-selector.ts +80 -301
  485. package/src/ui/dynamic-slot.ts +43 -283
  486. package/src/ui/expression-editor.ts +797 -576
  487. package/src/ui/field-input.ts +8 -181
  488. package/src/ui/form-controls.ts +838 -366
  489. package/src/ui/formula-chips.ts +80 -85
  490. package/src/ui/kit.ts +33 -0
  491. package/src/ui/layers.ts +293 -593
  492. package/src/ui/media-picker.ts +203 -284
  493. package/src/ui/panel-resize.ts +251 -64
  494. package/src/ui/popover-surface.ts +153 -0
  495. package/src/ui/progress-modal.ts +22 -60
  496. package/src/ui/regions.ts +13 -7
  497. package/src/ui/schema-form.ts +906 -440
  498. package/src/ui/surface.ts +122 -0
  499. package/src/ui/unit-selector.ts +15 -131
  500. package/src/ui/value-source.ts +14 -0
  501. package/src/ui/virtual-window.ts +88 -9
  502. package/src/utils/canvas-media.ts +72 -0
  503. package/src/utils/edit-display.ts +7 -2
  504. package/src/utils/element-selectors.ts +69 -0
  505. package/src/utils/link-target.ts +2 -2
  506. package/src/utils/studio-utils.ts +0 -10
  507. package/src/view.ts +15 -0
  508. package/src/workspace/pane-derive.ts +36 -14
  509. package/src/workspace/workspace.ts +15 -6
  510. package/styles/canvas.css +72 -467
  511. package/styles/forced-colors.css +48 -82
  512. package/styles/forced-colors.json +41 -0
  513. package/styles/inspector.css +2 -1301
  514. package/styles/overlays.css +96 -2823
  515. package/styles/panels.css +6 -1423
  516. package/styles/shell-frame.css +272 -0
  517. package/styles/shell-frame.json +227 -0
  518. package/styles/shell.css +0 -1532
  519. package/styles/tokens.css +65 -136
  520. package/styles/tokens.json +84 -0
  521. package/dist/chunks/Overlay.dev-723bv0df.js +0 -23
  522. package/dist/chunks/adapter-jkcyhgtr.js +0 -14
  523. package/dist/chunks/cf-settings-45fgyx8y.js +0 -21
  524. package/dist/chunks/components-zmx10t62.js +0 -21
  525. package/dist/chunks/content-source-t88vb2dr.js +0 -49
  526. package/dist/chunks/convert-to-repeater-dhw1nrz9.js +0 -268
  527. package/dist/chunks/editor-cptq5jp1.js +0 -37
  528. package/dist/chunks/entry-commands-6z6bhxg0.js +0 -46
  529. package/dist/chunks/extension-sections-3ydgjbdy.js +0 -311
  530. package/dist/chunks/file-ops-rskmhxyq.js +0 -48
  531. package/dist/chunks/files-0cratsr0.js +0 -92
  532. package/dist/chunks/flow-qbfgrpeh.js +0 -634
  533. package/dist/chunks/focus-trap.esm-ggawf1hy.js +0 -1024
  534. package/dist/chunks/focus-visible-6eg70z18.js +0 -167
  535. package/dist/chunks/format-host-tgcmfs4p.js +0 -43
  536. package/dist/chunks/fs-events-hrrg328g.js +0 -21
  537. package/dist/chunks/git-panel-0yywyk76.js +0 -58
  538. package/dist/chunks/index-zqxmqxmh.js +0 -109
  539. package/dist/chunks/jx-validate-8q2g05x1.js +0 -19
  540. package/dist/chunks/layers-panel-z3tqe5cd.js +0 -67
  541. package/dist/chunks/layers-q75tj2mf.js +0 -45
  542. package/dist/chunks/lit-html-j055mkh8.js +0 -22
  543. package/dist/chunks/monaco-buffer-dqw0xxpx.js +0 -25
  544. package/dist/chunks/notify-yjm79n4s.js +0 -30
  545. package/dist/chunks/parse-24d0gay3.js +0 -19
  546. package/dist/chunks/platform-ba1j1gbh.js +0 -16
  547. package/dist/chunks/publish-panel-54jvhskq.js +0 -28
  548. package/dist/chunks/quick-search-cgfmjwq5.js +0 -65
  549. package/dist/chunks/references-3qx8fkyp.js +0 -29
  550. package/dist/chunks/right-panel-cqp8bc4v.js +0 -46
  551. package/dist/chunks/section-registry-sx1ykvkw.js +0 -30
  552. package/dist/chunks/sp-overlay.dev-yztmtrs1.js +0 -18
  553. package/dist/chunks/sp-popover.dev-n2etmqdp.js +0 -9
  554. package/dist/chunks/sp-progress-circle.dev-hryhj0es.js +0 -15
  555. package/dist/chunks/sp-tooltip.dev-xcvpnqr0.js +0 -15
  556. package/dist/chunks/sp-tray.dev-tkbscm06.js +0 -199
  557. package/dist/chunks/studio-0a5qrh01.js +0 -3
  558. package/dist/chunks/studio-18j3bmcz.js +0 -14
  559. package/dist/chunks/studio-1hbqnt19.js +0 -1823
  560. package/dist/chunks/studio-4rzyrtjz.js +0 -426
  561. package/dist/chunks/studio-5rywrkxz.js +0 -1903
  562. package/dist/chunks/studio-7afd21nw.js +0 -67
  563. package/dist/chunks/studio-7nte2hj4.js +0 -613
  564. package/dist/chunks/studio-8jpzqk5s.js +0 -128
  565. package/dist/chunks/studio-8q517dfr.js +0 -24
  566. package/dist/chunks/studio-9c4k4vhv.js +0 -357
  567. package/dist/chunks/studio-9n4mrmnb.js +0 -184
  568. package/dist/chunks/studio-a0tswy0w.js +0 -58
  569. package/dist/chunks/studio-ahjfdy6e.js +0 -387
  570. package/dist/chunks/studio-ahnzd9rg.js +0 -23
  571. package/dist/chunks/studio-bw5dz6km.js +0 -608
  572. package/dist/chunks/studio-cb12yz9w.js +0 -15055
  573. package/dist/chunks/studio-d1ks410h.js +0 -175
  574. package/dist/chunks/studio-eqq1w638.js +0 -113
  575. package/dist/chunks/studio-ex8zyp98.js +0 -1813
  576. package/dist/chunks/studio-h4rxscfc.js +0 -10
  577. package/dist/chunks/studio-kyh9avvv.js +0 -28
  578. package/dist/chunks/studio-kyk2v92a.js +0 -659
  579. package/dist/chunks/studio-m3hwn7y1.js +0 -120
  580. package/dist/chunks/studio-mmv72a27.js +0 -4344
  581. package/dist/chunks/studio-n8b9wqwy.js +0 -291
  582. package/dist/chunks/studio-pdfjntbk.js +0 -6939
  583. package/dist/chunks/studio-qq6jym04.js +0 -53
  584. package/dist/chunks/studio-r1r7afxx.js +0 -1066
  585. package/dist/chunks/studio-rdx8jcxy.js +0 -83
  586. package/dist/chunks/studio-rn9ta2mz.js +0 -111
  587. package/dist/chunks/studio-t7qb9db8.js +0 -665
  588. package/dist/chunks/studio-tmc5emrw.js +0 -8
  589. package/dist/chunks/studio-txwkm6p9.js +0 -12
  590. package/dist/chunks/studio-v38hmvx1.js +0 -390
  591. package/dist/chunks/studio-vadzgkrz.js +0 -318
  592. package/dist/chunks/studio-wx5609xd.js +0 -341
  593. package/dist/chunks/studio-z6nw2ek2.js +0 -18
  594. package/dist/chunks/studio-zczps70q.js +0 -378
  595. package/dist/chunks/workspace-xpres40v.js +0 -89
  596. package/src/panels/activity-bar.ts +0 -251
  597. package/src/panels/panel-scheduler.ts +0 -219
  598. package/src/panels/style-inputs.ts +0 -237
  599. package/src/panels/target-line.ts +0 -274
  600. package/src/panels/welcome-screen.ts +0 -346
  601. package/src/ui/button-group.ts +0 -102
  602. package/src/ui/choice-field.ts +0 -72
  603. package/src/ui/field-row.ts +0 -249
  604. package/src/ui/formula-palette.ts +0 -213
  605. package/src/ui/icons.ts +0 -52
  606. package/src/ui/jx-theme.ts +0 -130
  607. package/src/ui/spectrum.ts +0 -340
  608. package/src/ui/value-selector.ts +0 -174
  609. package/src/ui/widgets.ts +0 -172
  610. /package/dist/chunks/{javascript-s56a8dpk.css → javascript-4abzjcy9.css} +0 -0
  611. /package/dist/chunks/{jsonMode-zr9sw0c7.css → jsonMode-vvmpmk34.css} +0 -0
  612. /package/dist/chunks/{monaco-setup-pav68602.css → monaco-setup-8vbyqnhr.css} +0 -0
  613. /package/dist/chunks/{tsMode-ef187txx.css → tsMode-hnxxb73h.css} +0 -0
@@ -0,0 +1,2811 @@
1
+ import {
2
+ loadFormats2,
3
+ formatByName2,
4
+ formatForPath2,
5
+ defaultContentFormat2,
6
+ formatSerialize2
7
+ } from "./studio-79y5sz51.js";
8
+ import {
9
+ effectScope,
10
+ effect,
11
+ reactive,
12
+ notify2
13
+ } from "./studio-p1dw8wfw.js";
14
+ import {
15
+ projectState
16
+ } from "./studio-6ewqv390.js";
17
+ import {
18
+ recordDocOp,
19
+ transactDoc,
20
+ mutateUpdateFrontmatter,
21
+ stringArg,
22
+ booleanArg,
23
+ enumArg,
24
+ argsSchema,
25
+ derivedEnumProperty,
26
+ booleanProperty,
27
+ stringProperty,
28
+ LOCALE_PLACEHOLDER,
29
+ collectionForDirectory,
30
+ camelToLabel,
31
+ toCamelCase,
32
+ workspace2,
33
+ activeTab2,
34
+ activateTab2
35
+ } from "./studio-az3zd49t.js";
36
+ import {
37
+ errorMessage2
38
+ } from "./studio-yxa81f45.js";
39
+ import {
40
+ activeRegistry
41
+ } from "./studio-5jy81t3s.js";
42
+ import {
43
+ paneRegion,
44
+ registerSurface,
45
+ mountSurface
46
+ } from "./studio-erdatzvp.js";
47
+ import {
48
+ registerFormControl,
49
+ referenceTarget,
50
+ mountSchemaForm,
51
+ resolveContextPointer
52
+ } from "./studio-57mf66w2.js";
53
+ import {
54
+ DRAFT_FIELD,
55
+ DRAFT_MEANING,
56
+ isDraftEntry,
57
+ hasDraftAxis,
58
+ setIncludeDrafts,
59
+ reloadDraftAwareGrids2
60
+ } from "./studio-x3rty6tr.js";
61
+ import {
62
+ serializeJson
63
+ } from "./studio-25hkdrkw.js";
64
+ import {
65
+ notePreviewOverlayEdit
66
+ } from "./studio-rpyah2ew.js";
67
+ import {
68
+ entryCollection,
69
+ entryCollections,
70
+ collectionOfPath,
71
+ seedEntry,
72
+ missingRequired
73
+ } from "./studio-sgdc5pfc.js";
74
+ import {
75
+ cloneValue2
76
+ } from "./studio-727xh0e3.js";
77
+ import {
78
+ __preload
79
+ } from "./studio-5te5tqng.js";
80
+
81
+ // src/settings/schema-field-ui.ts
82
+ var FIELD_TYPES = ["string", "number", "boolean", "array", "object", "reference"];
83
+ var FORMAT_OPTIONS = ["", "image", "date", "color"];
84
+ function detectFieldType(schema) {
85
+ if (schema.$ref) {
86
+ return "reference";
87
+ }
88
+ return schema.type || "string";
89
+ }
90
+ function detectFieldFormat(schema) {
91
+ if (schema.type === "array" && schema.items?.format) {
92
+ return schema.items.format;
93
+ }
94
+ return schema.format || "";
95
+ }
96
+ function schemaForType(type, format) {
97
+ switch (type) {
98
+ case "number": {
99
+ return { type: "number" };
100
+ }
101
+ case "boolean": {
102
+ return { type: "boolean" };
103
+ }
104
+ case "array": {
105
+ return format ? { items: { format, type: "string" }, type: "array" } : { items: { type: "string" }, type: "array" };
106
+ }
107
+ case "object": {
108
+ return { properties: {}, required: [], type: "object" };
109
+ }
110
+ case "reference": {
111
+ return { $ref: "#/content/" };
112
+ }
113
+ default: {
114
+ return format ? { format, type: "string" } : { type: "string" };
115
+ }
116
+ }
117
+ }
118
+ // src/surfaces/schema-builder.json
119
+ var schema_builder_default = {
120
+ $schema: "https://jxsuite.com/schema/v1",
121
+ $id: "StudioSchemaBuilder",
122
+ $description: 'The `schema-builder` form control (specs/extensions.md §9.1): the visual editor for a JSON Schema object, drawn as one card per property. A descriptor names it with `"ui": { "<prop>": { "control": "schema-builder" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. The adapter (`surfaces/schema-builder.ts`) hands in the fields already classified and every draft the reader is part-way through typing; `ui/form-controls.ts` decides what a field may be renamed to and what reaches the host\'s `onChange`. Nothing here reads a schema: a document that re-derived a field\'s type while drawing would be a second opinion about what one module already owns. **The card is `surfaces/settings-defs.json`\'s, part for part.** Data Shapes edits the project\'s `$defs` and this edits a content type\'s `schema`; they are the same object with the same six controls per row, so the row vocabulary — `card`, `field-row`, `field-label`, `field-name`, `field-type`, `field-format`, `field-required`, `field-delete`, `nested`, `nested-card`, `nested-add-name`/`-type`/`-button`, `ref-target`, `add-form` — is ONE vocabulary, and the row views it is drawn from are that surface\'s own types rather than a second declaration of them. What differs is only what encloses it: Data Shapes carries the two-column chrome that chooses WHICH shape is being edited, and this one is handed the object to edit.',
123
+ tagName: "div",
124
+ attributes: {
125
+ part: "builder"
126
+ },
127
+ style: {
128
+ $description: "What `.schema-builder`, `.schema-field-list`, `.schema-field-card`, `.schema-field-row`, `.schema-field-nested`, `.schema-field-name-input`, `.schema-nested-add`, `.schema-nested-add-name` and `.schema-add-field` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer — the same translation `surfaces/settings-defs.json` carries, because it is the same card. Two values could not come with them. `.schema-field-card--nested` read `var(--spectrum-gray-300, #444)`, and the caption was an `sp-field-label` at whatever size Spectrum drew it; a document is mounted in the pane rather than inside `<sp-theme>`, so both would have taken their hard-coded fallback every time. The nested card takes the studio layer's `--border`, and the caption says what it is in the type ramp instead.",
129
+ display: "block",
130
+ '& [part="fields"]': {
131
+ display: "flex",
132
+ flexDirection: "column",
133
+ gap: "4px",
134
+ marginBottom: "12px"
135
+ },
136
+ '& [part="card"], & [part="nested-card"]': {
137
+ border: "1px solid var(--border)",
138
+ borderRadius: "var(--radius)",
139
+ padding: "6px 10px"
140
+ },
141
+ '& [part="field-row"]': {
142
+ display: "flex",
143
+ alignItems: "center",
144
+ gap: "8px"
145
+ },
146
+ '& [part="field-label"]': {
147
+ $description: "The field's name in words: a caption on the row rather than a label for a control, since the raw key beside it is what the reader edits and what carries the accessible name.",
148
+ flex: "none",
149
+ minWidth: "84px",
150
+ fontSize: "var(--jx-text-sm)",
151
+ color: "var(--fg-dim)",
152
+ overflowWrap: "anywhere"
153
+ },
154
+ '& [part="field-name"]': {
155
+ flex: "1",
156
+ maxWidth: "140px"
157
+ },
158
+ '& [part="nested"]': {
159
+ marginLeft: "16px",
160
+ marginTop: "6px",
161
+ paddingLeft: "8px",
162
+ borderLeft: "2px solid var(--border)",
163
+ display: "flex",
164
+ flexDirection: "column",
165
+ gap: "4px"
166
+ },
167
+ '& [part="ref-target"]': {
168
+ display: "flex",
169
+ marginTop: "6px",
170
+ maxWidth: "220px"
171
+ },
172
+ '& [part="nested-add"]': {
173
+ display: "flex",
174
+ alignItems: "center",
175
+ gap: "6px",
176
+ padding: "4px 0"
177
+ },
178
+ '& [part="nested-add-name"]': {
179
+ flex: "1",
180
+ maxWidth: "120px"
181
+ },
182
+ '& [part="add-form"]': {
183
+ display: "flex",
184
+ alignItems: "center",
185
+ gap: "8px",
186
+ padding: "8px 0"
187
+ }
188
+ },
189
+ children: [
190
+ {
191
+ tagName: "div",
192
+ attributes: {
193
+ part: "fields"
194
+ },
195
+ children: [
196
+ {
197
+ $prototype: "Array",
198
+ items: {
199
+ $ref: "#/state/fields"
200
+ },
201
+ key: {
202
+ $ref: "$map/item/key"
203
+ },
204
+ map: {
205
+ tagName: "div",
206
+ attributes: {
207
+ part: "card",
208
+ "data-field": "${$map.item.key}"
209
+ },
210
+ children: [
211
+ {
212
+ tagName: "div",
213
+ attributes: {
214
+ part: "field-row"
215
+ },
216
+ children: [
217
+ {
218
+ tagName: "span",
219
+ attributes: {
220
+ part: "field-label"
221
+ },
222
+ textContent: "${$map.item.label}"
223
+ },
224
+ {
225
+ tagName: "jx-textfield",
226
+ attributes: {
227
+ part: "field-name"
228
+ },
229
+ $props: {
230
+ label: "Name for ${$map.item.label}",
231
+ size: "sm",
232
+ value: {
233
+ $ref: "$map/item/name"
234
+ }
235
+ },
236
+ onchange: {
237
+ $prototype: "Function",
238
+ body: [
239
+ {
240
+ operator: "call",
241
+ target: {
242
+ $ref: "#/state/renameField"
243
+ },
244
+ value: [
245
+ {
246
+ $ref: "$map/item/key"
247
+ },
248
+ {
249
+ $ref: "event#/target/value"
250
+ }
251
+ ]
252
+ }
253
+ ]
254
+ }
255
+ },
256
+ {
257
+ tagName: "jx-select",
258
+ attributes: {
259
+ part: "field-type"
260
+ },
261
+ $props: {
262
+ label: "Type for ${$map.item.label}",
263
+ size: "sm",
264
+ options: {
265
+ $ref: "#/state/typeOptions"
266
+ },
267
+ value: {
268
+ $ref: "$map/item/type"
269
+ }
270
+ },
271
+ onchange: {
272
+ $prototype: "Function",
273
+ body: [
274
+ {
275
+ operator: "call",
276
+ target: {
277
+ $ref: "#/state/setType"
278
+ },
279
+ value: [
280
+ {
281
+ $ref: "$map/item/key"
282
+ },
283
+ {
284
+ $ref: "event#/target/value"
285
+ }
286
+ ]
287
+ }
288
+ ]
289
+ }
290
+ },
291
+ {
292
+ tagName: "div",
293
+ attributes: {
294
+ part: "format-slot",
295
+ role: "none"
296
+ },
297
+ style: {
298
+ display: "contents"
299
+ },
300
+ $switch: {
301
+ $ref: "$map/item/hasFormat"
302
+ },
303
+ cases: {
304
+ true: {
305
+ tagName: "jx-select",
306
+ attributes: {
307
+ part: "field-format"
308
+ },
309
+ $props: {
310
+ label: "Format for ${$map.item.label}",
311
+ size: "sm",
312
+ options: {
313
+ $ref: "#/state/formatOptions"
314
+ },
315
+ value: {
316
+ $ref: "$map/item/format"
317
+ }
318
+ },
319
+ onchange: {
320
+ $prototype: "Function",
321
+ body: [
322
+ {
323
+ operator: "call",
324
+ target: {
325
+ $ref: "#/state/setFormat"
326
+ },
327
+ value: [
328
+ {
329
+ $ref: "$map/item/key"
330
+ },
331
+ {
332
+ $ref: "event#/target/value"
333
+ }
334
+ ]
335
+ }
336
+ ]
337
+ }
338
+ }
339
+ }
340
+ },
341
+ {
342
+ tagName: "jx-switch",
343
+ $description: "Whether the object requires this field. The word on screen is the name: `Req` is slotted rather than passed as `label`, because the kit's switch wraps its control in the label the slot lands in, and a second name would be announced over the top of it. Which row it belongs to is the tooltip's job instead, which is what `hint` is.",
344
+ attributes: {
345
+ part: "field-required"
346
+ },
347
+ $props: {
348
+ hint: "Require ${$map.item.label}",
349
+ size: "sm",
350
+ checked: {
351
+ $ref: "$map/item/required"
352
+ }
353
+ },
354
+ onchange: {
355
+ $prototype: "Function",
356
+ body: [
357
+ {
358
+ operator: "call",
359
+ target: {
360
+ $ref: "#/state/setRequired"
361
+ },
362
+ value: [
363
+ {
364
+ $ref: "$map/item/key"
365
+ },
366
+ {
367
+ $ref: "event#/target/checked"
368
+ }
369
+ ]
370
+ }
371
+ ]
372
+ },
373
+ children: [
374
+ {
375
+ tagName: "span",
376
+ textContent: "Req"
377
+ }
378
+ ]
379
+ },
380
+ {
381
+ tagName: "jx-action-button",
382
+ attributes: {
383
+ part: "field-delete"
384
+ },
385
+ $props: {
386
+ label: "Delete ${$map.item.label}",
387
+ hint: "Delete ${$map.item.label}",
388
+ icon: "trash",
389
+ quiet: true,
390
+ size: "sm"
391
+ },
392
+ onclick: {
393
+ $prototype: "Function",
394
+ body: [
395
+ {
396
+ operator: "call",
397
+ target: {
398
+ $ref: "#/state/removeField"
399
+ },
400
+ value: [
401
+ {
402
+ $ref: "$map/item/key"
403
+ }
404
+ ]
405
+ }
406
+ ]
407
+ }
408
+ }
409
+ ]
410
+ },
411
+ {
412
+ tagName: "div",
413
+ attributes: {
414
+ part: "extra-slot",
415
+ role: "none"
416
+ },
417
+ style: {
418
+ display: "contents"
419
+ },
420
+ $switch: {
421
+ $ref: "$map/item/extra"
422
+ },
423
+ cases: {
424
+ reference: {
425
+ tagName: "div",
426
+ attributes: {
427
+ part: "ref-target"
428
+ },
429
+ children: [
430
+ {
431
+ tagName: "jx-select",
432
+ attributes: {
433
+ part: "ref-target-select"
434
+ },
435
+ $props: {
436
+ label: "Target for ${$map.item.label}",
437
+ size: "sm",
438
+ options: {
439
+ $ref: "#/state/targets"
440
+ },
441
+ value: {
442
+ $ref: "$map/item/refTarget"
443
+ }
444
+ },
445
+ onchange: {
446
+ $prototype: "Function",
447
+ body: [
448
+ {
449
+ operator: "call",
450
+ target: {
451
+ $ref: "#/state/setTarget"
452
+ },
453
+ value: [
454
+ {
455
+ $ref: "$map/item/key"
456
+ },
457
+ {
458
+ $ref: "event#/target/value"
459
+ }
460
+ ]
461
+ }
462
+ ]
463
+ }
464
+ }
465
+ ]
466
+ },
467
+ nested: {
468
+ tagName: "div",
469
+ attributes: {
470
+ part: "nested"
471
+ },
472
+ children: [
473
+ {
474
+ $prototype: "Array",
475
+ items: {
476
+ $ref: "$map/item/children"
477
+ },
478
+ key: {
479
+ $ref: "$map/item/key"
480
+ },
481
+ map: {
482
+ tagName: "div",
483
+ attributes: {
484
+ part: "nested-card",
485
+ "data-nested": "${$map.item.key}"
486
+ },
487
+ children: [
488
+ {
489
+ tagName: "div",
490
+ attributes: {
491
+ part: "field-row"
492
+ },
493
+ children: [
494
+ {
495
+ tagName: "jx-textfield",
496
+ attributes: {
497
+ part: "field-name"
498
+ },
499
+ $props: {
500
+ label: "Name for ${$map.item.parent}.${$map.item.key}",
501
+ size: "sm",
502
+ value: {
503
+ $ref: "$map/item/name"
504
+ }
505
+ },
506
+ onchange: {
507
+ $prototype: "Function",
508
+ body: [
509
+ {
510
+ operator: "call",
511
+ target: {
512
+ $ref: "#/state/renameNested"
513
+ },
514
+ value: [
515
+ {
516
+ $ref: "$map/item/parent"
517
+ },
518
+ {
519
+ $ref: "$map/item/key"
520
+ },
521
+ {
522
+ $ref: "event#/target/value"
523
+ }
524
+ ]
525
+ }
526
+ ]
527
+ }
528
+ },
529
+ {
530
+ tagName: "jx-select",
531
+ attributes: {
532
+ part: "field-type"
533
+ },
534
+ $props: {
535
+ label: "Type for ${$map.item.parent}.${$map.item.key}",
536
+ size: "sm",
537
+ options: {
538
+ $ref: "#/state/typeOptions"
539
+ },
540
+ value: {
541
+ $ref: "$map/item/type"
542
+ }
543
+ },
544
+ onchange: {
545
+ $prototype: "Function",
546
+ body: [
547
+ {
548
+ operator: "call",
549
+ target: {
550
+ $ref: "#/state/setNestedType"
551
+ },
552
+ value: [
553
+ {
554
+ $ref: "$map/item/parent"
555
+ },
556
+ {
557
+ $ref: "$map/item/key"
558
+ },
559
+ {
560
+ $ref: "event#/target/value"
561
+ }
562
+ ]
563
+ }
564
+ ]
565
+ }
566
+ },
567
+ {
568
+ tagName: "div",
569
+ attributes: {
570
+ part: "format-slot",
571
+ role: "none"
572
+ },
573
+ style: {
574
+ display: "contents"
575
+ },
576
+ $switch: {
577
+ $ref: "$map/item/hasFormat"
578
+ },
579
+ cases: {
580
+ true: {
581
+ tagName: "jx-select",
582
+ attributes: {
583
+ part: "field-format"
584
+ },
585
+ $props: {
586
+ label: "Format for ${$map.item.parent}.${$map.item.key}",
587
+ size: "sm",
588
+ options: {
589
+ $ref: "#/state/formatOptions"
590
+ },
591
+ value: {
592
+ $ref: "$map/item/format"
593
+ }
594
+ },
595
+ onchange: {
596
+ $prototype: "Function",
597
+ body: [
598
+ {
599
+ operator: "call",
600
+ target: {
601
+ $ref: "#/state/setNestedFormat"
602
+ },
603
+ value: [
604
+ {
605
+ $ref: "$map/item/parent"
606
+ },
607
+ {
608
+ $ref: "$map/item/key"
609
+ },
610
+ {
611
+ $ref: "event#/target/value"
612
+ }
613
+ ]
614
+ }
615
+ ]
616
+ }
617
+ }
618
+ }
619
+ },
620
+ {
621
+ tagName: "jx-switch",
622
+ attributes: {
623
+ part: "field-required"
624
+ },
625
+ $props: {
626
+ hint: "Require ${$map.item.parent}.${$map.item.key}",
627
+ size: "sm",
628
+ checked: {
629
+ $ref: "$map/item/required"
630
+ }
631
+ },
632
+ onchange: {
633
+ $prototype: "Function",
634
+ body: [
635
+ {
636
+ operator: "call",
637
+ target: {
638
+ $ref: "#/state/setNestedRequired"
639
+ },
640
+ value: [
641
+ {
642
+ $ref: "$map/item/parent"
643
+ },
644
+ {
645
+ $ref: "$map/item/key"
646
+ },
647
+ {
648
+ $ref: "event#/target/checked"
649
+ }
650
+ ]
651
+ }
652
+ ]
653
+ },
654
+ children: [
655
+ {
656
+ tagName: "span",
657
+ textContent: "Req"
658
+ }
659
+ ]
660
+ },
661
+ {
662
+ tagName: "jx-action-button",
663
+ attributes: {
664
+ part: "field-delete"
665
+ },
666
+ $props: {
667
+ label: "Delete ${$map.item.parent}.${$map.item.key}",
668
+ hint: "Delete ${$map.item.parent}.${$map.item.key}",
669
+ icon: "trash",
670
+ quiet: true,
671
+ size: "sm"
672
+ },
673
+ onclick: {
674
+ $prototype: "Function",
675
+ body: [
676
+ {
677
+ operator: "call",
678
+ target: {
679
+ $ref: "#/state/removeNested"
680
+ },
681
+ value: [
682
+ {
683
+ $ref: "$map/item/parent"
684
+ },
685
+ {
686
+ $ref: "$map/item/key"
687
+ }
688
+ ]
689
+ }
690
+ ]
691
+ }
692
+ }
693
+ ]
694
+ }
695
+ ]
696
+ }
697
+ },
698
+ {
699
+ tagName: "div",
700
+ attributes: {
701
+ part: "nested-add"
702
+ },
703
+ children: [
704
+ {
705
+ tagName: "jx-textfield",
706
+ attributes: {
707
+ part: "nested-add-name"
708
+ },
709
+ $props: {
710
+ label: "New field in ${$map.item.label}",
711
+ placeholder: "field name",
712
+ size: "sm",
713
+ value: {
714
+ $ref: "$map/item/draftName"
715
+ }
716
+ },
717
+ oninput: {
718
+ $prototype: "Function",
719
+ body: [
720
+ {
721
+ operator: "call",
722
+ target: {
723
+ $ref: "#/state/editDraftName"
724
+ },
725
+ value: [
726
+ {
727
+ $ref: "$map/item/key"
728
+ },
729
+ {
730
+ $ref: "event#/target/value"
731
+ }
732
+ ]
733
+ }
734
+ ]
735
+ },
736
+ onkeydown: {
737
+ $prototype: "Function",
738
+ body: [
739
+ {
740
+ $switch: {
741
+ $ref: "event#/key"
742
+ },
743
+ cases: {
744
+ Enter: [
745
+ {
746
+ preventDefault: true
747
+ },
748
+ {
749
+ operator: "call",
750
+ target: {
751
+ $ref: "#/state/addNested"
752
+ },
753
+ value: [
754
+ {
755
+ $ref: "$map/item/key"
756
+ }
757
+ ]
758
+ }
759
+ ]
760
+ }
761
+ }
762
+ ]
763
+ }
764
+ },
765
+ {
766
+ tagName: "jx-select",
767
+ attributes: {
768
+ part: "nested-add-type"
769
+ },
770
+ $props: {
771
+ label: "Type of the new field in ${$map.item.label}",
772
+ size: "sm",
773
+ options: {
774
+ $ref: "#/state/typeOptions"
775
+ },
776
+ value: {
777
+ $ref: "$map/item/draftType"
778
+ }
779
+ },
780
+ onchange: {
781
+ $prototype: "Function",
782
+ body: [
783
+ {
784
+ operator: "call",
785
+ target: {
786
+ $ref: "#/state/editDraftType"
787
+ },
788
+ value: [
789
+ {
790
+ $ref: "$map/item/key"
791
+ },
792
+ {
793
+ $ref: "event#/target/value"
794
+ }
795
+ ]
796
+ }
797
+ ]
798
+ }
799
+ },
800
+ {
801
+ tagName: "jx-action-button",
802
+ attributes: {
803
+ part: "nested-add-button"
804
+ },
805
+ $props: {
806
+ label: "Add a field to ${$map.item.label}",
807
+ hint: "Add a field to ${$map.item.label}",
808
+ icon: "plus",
809
+ quiet: true,
810
+ size: "sm"
811
+ },
812
+ onclick: {
813
+ $prototype: "Function",
814
+ body: [
815
+ {
816
+ operator: "call",
817
+ target: {
818
+ $ref: "#/state/addNested"
819
+ },
820
+ value: [
821
+ {
822
+ $ref: "$map/item/key"
823
+ }
824
+ ]
825
+ }
826
+ ]
827
+ }
828
+ }
829
+ ]
830
+ }
831
+ ]
832
+ }
833
+ }
834
+ }
835
+ ]
836
+ }
837
+ }
838
+ ]
839
+ },
840
+ {
841
+ tagName: "div",
842
+ attributes: {
843
+ part: "add-slot",
844
+ role: "none"
845
+ },
846
+ style: {
847
+ display: "contents"
848
+ },
849
+ $switch: {
850
+ $ref: "#/state/addState"
851
+ },
852
+ cases: {
853
+ closed: {
854
+ tagName: "jx-action-button",
855
+ attributes: {
856
+ part: "add-open"
857
+ },
858
+ $props: {
859
+ label: "Add Field",
860
+ icon: "plus",
861
+ quiet: true,
862
+ size: "sm"
863
+ },
864
+ onclick: {
865
+ $prototype: "Function",
866
+ body: [
867
+ {
868
+ operator: "call",
869
+ target: {
870
+ $ref: "#/state/openAdd"
871
+ },
872
+ value: []
873
+ }
874
+ ]
875
+ },
876
+ children: [
877
+ {
878
+ tagName: "span",
879
+ textContent: "Add Field"
880
+ }
881
+ ]
882
+ },
883
+ open: {
884
+ tagName: "div",
885
+ attributes: {
886
+ part: "add-form"
887
+ },
888
+ children: [
889
+ {
890
+ tagName: "jx-textfield",
891
+ attributes: {
892
+ part: "add-name"
893
+ },
894
+ $props: {
895
+ label: "New field name",
896
+ placeholder: "Field name",
897
+ size: "sm",
898
+ value: {
899
+ $ref: "#/state/addName"
900
+ }
901
+ },
902
+ oninput: {
903
+ $prototype: "Function",
904
+ body: [
905
+ {
906
+ operator: "call",
907
+ target: {
908
+ $ref: "#/state/editAddName"
909
+ },
910
+ value: [
911
+ {
912
+ $ref: "event#/target/value"
913
+ }
914
+ ]
915
+ }
916
+ ]
917
+ },
918
+ onkeydown: {
919
+ $prototype: "Function",
920
+ body: [
921
+ {
922
+ $switch: {
923
+ $ref: "event#/key"
924
+ },
925
+ cases: {
926
+ Enter: [
927
+ {
928
+ preventDefault: true
929
+ },
930
+ {
931
+ operator: "call",
932
+ target: {
933
+ $ref: "#/state/confirmAdd"
934
+ },
935
+ value: []
936
+ }
937
+ ],
938
+ Escape: [
939
+ {
940
+ preventDefault: true
941
+ },
942
+ {
943
+ operator: "call",
944
+ target: {
945
+ $ref: "#/state/cancelAdd"
946
+ },
947
+ value: []
948
+ }
949
+ ]
950
+ }
951
+ }
952
+ ]
953
+ }
954
+ },
955
+ {
956
+ tagName: "jx-select",
957
+ attributes: {
958
+ part: "add-type"
959
+ },
960
+ $props: {
961
+ label: "Type of the new field",
962
+ size: "sm",
963
+ options: {
964
+ $ref: "#/state/typeOptions"
965
+ },
966
+ value: {
967
+ $ref: "#/state/addType"
968
+ }
969
+ },
970
+ onchange: {
971
+ $prototype: "Function",
972
+ body: [
973
+ {
974
+ operator: "call",
975
+ target: {
976
+ $ref: "#/state/editAddType"
977
+ },
978
+ value: [
979
+ {
980
+ $ref: "event#/target/value"
981
+ }
982
+ ]
983
+ }
984
+ ]
985
+ }
986
+ },
987
+ {
988
+ tagName: "div",
989
+ attributes: {
990
+ part: "add-format-slot",
991
+ role: "none"
992
+ },
993
+ style: {
994
+ display: "contents"
995
+ },
996
+ $switch: {
997
+ $ref: "#/state/addHasFormat"
998
+ },
999
+ cases: {
1000
+ true: {
1001
+ tagName: "jx-select",
1002
+ attributes: {
1003
+ part: "add-format"
1004
+ },
1005
+ $props: {
1006
+ label: "Format of the new field",
1007
+ size: "sm",
1008
+ options: {
1009
+ $ref: "#/state/formatOptions"
1010
+ },
1011
+ value: {
1012
+ $ref: "#/state/addFormat"
1013
+ }
1014
+ },
1015
+ onchange: {
1016
+ $prototype: "Function",
1017
+ body: [
1018
+ {
1019
+ operator: "call",
1020
+ target: {
1021
+ $ref: "#/state/editAddFormat"
1022
+ },
1023
+ value: [
1024
+ {
1025
+ $ref: "event#/target/value"
1026
+ }
1027
+ ]
1028
+ }
1029
+ ]
1030
+ }
1031
+ }
1032
+ }
1033
+ },
1034
+ {
1035
+ tagName: "jx-switch",
1036
+ attributes: {
1037
+ part: "add-required"
1038
+ },
1039
+ $props: {
1040
+ hint: "Require the new field",
1041
+ size: "sm",
1042
+ checked: {
1043
+ $ref: "#/state/addRequired"
1044
+ }
1045
+ },
1046
+ onchange: {
1047
+ $prototype: "Function",
1048
+ body: [
1049
+ {
1050
+ operator: "call",
1051
+ target: {
1052
+ $ref: "#/state/editAddRequired"
1053
+ },
1054
+ value: [
1055
+ {
1056
+ $ref: "event#/target/checked"
1057
+ }
1058
+ ]
1059
+ }
1060
+ ]
1061
+ },
1062
+ children: [
1063
+ {
1064
+ tagName: "span",
1065
+ textContent: "Required"
1066
+ }
1067
+ ]
1068
+ },
1069
+ {
1070
+ tagName: "jx-button",
1071
+ attributes: {
1072
+ part: "add-confirm"
1073
+ },
1074
+ $props: {
1075
+ size: "sm"
1076
+ },
1077
+ onclick: {
1078
+ $prototype: "Function",
1079
+ body: [
1080
+ {
1081
+ operator: "call",
1082
+ target: {
1083
+ $ref: "#/state/confirmAdd"
1084
+ },
1085
+ value: []
1086
+ }
1087
+ ]
1088
+ },
1089
+ children: [
1090
+ {
1091
+ tagName: "span",
1092
+ textContent: "Add"
1093
+ }
1094
+ ]
1095
+ },
1096
+ {
1097
+ tagName: "jx-button",
1098
+ attributes: {
1099
+ part: "add-cancel"
1100
+ },
1101
+ $props: {
1102
+ size: "sm",
1103
+ quiet: true
1104
+ },
1105
+ onclick: {
1106
+ $prototype: "Function",
1107
+ body: [
1108
+ {
1109
+ operator: "call",
1110
+ target: {
1111
+ $ref: "#/state/cancelAdd"
1112
+ },
1113
+ value: []
1114
+ }
1115
+ ]
1116
+ },
1117
+ children: [
1118
+ {
1119
+ tagName: "span",
1120
+ textContent: "Cancel"
1121
+ }
1122
+ ]
1123
+ }
1124
+ ]
1125
+ }
1126
+ }
1127
+ }
1128
+ ]
1129
+ };
1130
+
1131
+ // src/surfaces/schema-builder.ts
1132
+ registerSurface("schema-builder", schema_builder_default);
1133
+ function emptyView() {
1134
+ return {
1135
+ addFormat: "",
1136
+ addHasFormat: true,
1137
+ addName: "",
1138
+ addRequired: false,
1139
+ addState: "closed",
1140
+ addType: "string",
1141
+ fields: [],
1142
+ formatOptions: [],
1143
+ targets: [],
1144
+ typeOptions: []
1145
+ };
1146
+ }
1147
+ function mountSchemaBuilderSurface(host, actions) {
1148
+ host.textContent = "";
1149
+ const scope = reactive({ ...emptyView(), ...actions });
1150
+ let handle = null;
1151
+ let mounting = true;
1152
+ let disposed = false;
1153
+ const mount = () => mountSurface("schema-builder", scope, host).then((mounted) => {
1154
+ mounting = false;
1155
+ if (disposed) {
1156
+ mounted.dispose();
1157
+ return mounted.root;
1158
+ }
1159
+ handle = mounted;
1160
+ return mounted.root;
1161
+ });
1162
+ const ready = mount();
1163
+ return {
1164
+ dispose() {
1165
+ disposed = true;
1166
+ handle?.dispose();
1167
+ handle = null;
1168
+ host.textContent = "";
1169
+ },
1170
+ host,
1171
+ ready,
1172
+ update(view) {
1173
+ scope.addFormat = view.addFormat;
1174
+ scope.addHasFormat = view.addHasFormat;
1175
+ scope.addName = view.addName;
1176
+ scope.addRequired = view.addRequired;
1177
+ scope.addState = view.addState;
1178
+ scope.addType = view.addType;
1179
+ scope.fields = view.fields;
1180
+ scope.formatOptions = view.formatOptions;
1181
+ scope.targets = view.targets;
1182
+ scope.typeOptions = view.typeOptions;
1183
+ if (disposed || mounting || handle !== null && host.contains(handle.root)) {
1184
+ return;
1185
+ }
1186
+ handle?.dispose();
1187
+ handle = null;
1188
+ mounting = true;
1189
+ host.textContent = "";
1190
+ mount();
1191
+ }
1192
+ };
1193
+ }
1194
+ // src/surfaces/reference-field.json
1195
+ var reference_field_default = {
1196
+ $schema: "https://jxsuite.com/schema/v1",
1197
+ $id: "StudioReferenceField",
1198
+ $description: 'The `reference` form control — site-architecture.md §6.1\'s `{ "$ref": "#/content/x" }` and §7.4\'s entry picker. Registered once and dispatched to by `ui/schema-form.ts` for any property whose `$ref` names a collection, so the settings forms, the entry editor and an array-of-objects cell all draw the same control without any of them knowing it exists. `ui/form-controls.ts` decides which of the three states the field is in and what each gesture commits; nothing here reads a schema or lists a directory. The three states are drawn as three different controls on purpose: a picker while the entries are known, a TEXT field while they are not — a failed read leaves the value editable with the reason beside it, because swapping it for an empty dropdown would present "no entries" and "could not find out" as the same screen — and a disabled picker saying so while the read is in flight.',
1199
+ tagName: "div",
1200
+ attributes: {
1201
+ part: "reference",
1202
+ role: "none"
1203
+ },
1204
+ style: {
1205
+ $description: "The five `.reference-*` rules from `styles/inspector.css`, keyed on `part` and re-pointed at the studio token layer. Two values could not come with them. The note read `var(--spectrum-font-size-50, 11px)`, which resolves only inside `<sp-theme>` — this document is mounted in a settings pane, an entry editor or a frontmatter card, all outside that element, so it would silently have taken its hard-coded fallback every time. And `.reference-missing` coloured ONE row of the dropdown red; the kit's select offers a row a face, a swatch and a border style but no tone, so the dangling entry says what it is in words (\"— not found\") and the colour is not replaced by a second channel. The 6px gap comes onto the kit's spacing scale.",
1206
+ display: "flex",
1207
+ flex: "1",
1208
+ minWidth: "0",
1209
+ alignItems: "center",
1210
+ gap: "var(--jx-space-2)",
1211
+ '& [part="picker"], & [part="text"]': {
1212
+ flex: "1",
1213
+ minWidth: "0"
1214
+ },
1215
+ '& [part="note"]': {
1216
+ margin: "0",
1217
+ color: "var(--fg-dim)",
1218
+ fontSize: "var(--jx-text-sm)",
1219
+ lineHeight: "1.4"
1220
+ },
1221
+ '& [part="note"][data-tone="danger"]': {
1222
+ $description: "A listing that failed is a FAULT rather than a fact about the project, and the two notes this control draws are otherwise the same sentence in the same place.",
1223
+ color: "var(--danger)"
1224
+ },
1225
+ '& [part="retry"]': {
1226
+ flex: "none"
1227
+ }
1228
+ },
1229
+ children: [
1230
+ {
1231
+ tagName: "div",
1232
+ attributes: {
1233
+ part: "control-slot",
1234
+ role: "none"
1235
+ },
1236
+ style: {
1237
+ display: "contents"
1238
+ },
1239
+ $switch: {
1240
+ $ref: "#/state/kind"
1241
+ },
1242
+ cases: {
1243
+ picker: {
1244
+ $description: "The collection's entries. The empty row is `\"\"` rather than a sentinel, because the kit's select treats the empty string as a legal value a reader can arrow to; a dangling reference is kept in the list and marked, since blanking the field would delete the evidence and the value in one repaint. While the read is in flight the same control is disabled and offers one row saying so.",
1245
+ tagName: "jx-select",
1246
+ attributes: {
1247
+ part: "picker"
1248
+ },
1249
+ $props: {
1250
+ size: "sm",
1251
+ label: {
1252
+ $ref: "#/state/label"
1253
+ },
1254
+ options: {
1255
+ $ref: "#/state/options"
1256
+ },
1257
+ value: {
1258
+ $ref: "#/state/value"
1259
+ },
1260
+ disabled: {
1261
+ $ref: "#/state/disabled"
1262
+ }
1263
+ },
1264
+ onchange: {
1265
+ $prototype: "Function",
1266
+ body: [
1267
+ {
1268
+ operator: "call",
1269
+ target: {
1270
+ $ref: "#/state/choose"
1271
+ },
1272
+ value: [
1273
+ {
1274
+ $ref: "event#/target/value"
1275
+ }
1276
+ ]
1277
+ }
1278
+ ]
1279
+ }
1280
+ },
1281
+ text: {
1282
+ $description: "The id as the string it is: what a reader gets when the choices could not be listed, and when the control was named by a `ui.control` override on a property that references nothing. Refusing to draw anything would lose the value that is already there.",
1283
+ tagName: "jx-textfield",
1284
+ attributes: {
1285
+ part: "text"
1286
+ },
1287
+ $props: {
1288
+ size: "sm",
1289
+ label: {
1290
+ $ref: "#/state/label"
1291
+ },
1292
+ value: {
1293
+ $ref: "#/state/value"
1294
+ }
1295
+ },
1296
+ onchange: {
1297
+ $prototype: "Function",
1298
+ body: [
1299
+ {
1300
+ operator: "call",
1301
+ target: {
1302
+ $ref: "#/state/edit"
1303
+ },
1304
+ value: [
1305
+ {
1306
+ $ref: "event#/target/value"
1307
+ }
1308
+ ]
1309
+ }
1310
+ ]
1311
+ }
1312
+ }
1313
+ }
1314
+ },
1315
+ {
1316
+ tagName: "div",
1317
+ attributes: {
1318
+ part: "note-slot",
1319
+ role: "none"
1320
+ },
1321
+ style: {
1322
+ display: "contents"
1323
+ },
1324
+ $switch: {
1325
+ $ref: "#/state/hasNote"
1326
+ },
1327
+ cases: {
1328
+ true: {
1329
+ tagName: "p",
1330
+ attributes: {
1331
+ part: "note",
1332
+ "data-tone": "${state.noteTone}",
1333
+ role: "status"
1334
+ },
1335
+ textContent: "${state.note}"
1336
+ }
1337
+ }
1338
+ },
1339
+ {
1340
+ tagName: "div",
1341
+ attributes: {
1342
+ part: "retry-slot",
1343
+ role: "none"
1344
+ },
1345
+ style: {
1346
+ display: "contents"
1347
+ },
1348
+ $switch: {
1349
+ $ref: "#/state/canRetry"
1350
+ },
1351
+ cases: {
1352
+ true: {
1353
+ $description: "Offered only where there is something to try again — a listing that failed. It used to be offered only where the HOST passed a repaint hook, because a template control cannot draw a second frame of its own and a button that cannot do the thing it is named after is worse than its absence. A mounted control redraws itself, so the condition is now the failure rather than the host.",
1354
+ tagName: "jx-action-button",
1355
+ attributes: {
1356
+ part: "retry"
1357
+ },
1358
+ $props: {
1359
+ size: "sm",
1360
+ quiet: true,
1361
+ label: "Retry listing entries"
1362
+ },
1363
+ onclick: {
1364
+ $prototype: "Function",
1365
+ body: [
1366
+ {
1367
+ operator: "call",
1368
+ target: {
1369
+ $ref: "#/state/retry"
1370
+ },
1371
+ value: []
1372
+ }
1373
+ ]
1374
+ },
1375
+ children: [
1376
+ {
1377
+ tagName: "span",
1378
+ textContent: "Retry"
1379
+ }
1380
+ ]
1381
+ }
1382
+ }
1383
+ }
1384
+ ]
1385
+ };
1386
+
1387
+ // src/surfaces/reference-field.ts
1388
+ registerSurface("reference-field", reference_field_default);
1389
+ function emptyView2() {
1390
+ return {
1391
+ canRetry: false,
1392
+ disabled: true,
1393
+ hasNote: false,
1394
+ kind: "picker",
1395
+ label: "",
1396
+ note: "",
1397
+ noteTone: "dim",
1398
+ options: [],
1399
+ value: ""
1400
+ };
1401
+ }
1402
+ function mountReferenceFieldSurface(host, actions) {
1403
+ host.textContent = "";
1404
+ const scope = reactive({ ...emptyView2(), ...actions });
1405
+ let handle = null;
1406
+ let mounting = true;
1407
+ let disposed = false;
1408
+ const mount = () => mountSurface("reference-field", scope, host).then((mounted) => {
1409
+ mounting = false;
1410
+ if (disposed) {
1411
+ mounted.dispose();
1412
+ return mounted.root;
1413
+ }
1414
+ handle = mounted;
1415
+ return mounted.root;
1416
+ });
1417
+ const ready = mount();
1418
+ return {
1419
+ dispose() {
1420
+ disposed = true;
1421
+ handle?.dispose();
1422
+ handle = null;
1423
+ host.textContent = "";
1424
+ },
1425
+ host,
1426
+ ready,
1427
+ update(view) {
1428
+ scope.canRetry = view.canRetry;
1429
+ scope.disabled = view.disabled;
1430
+ scope.hasNote = view.hasNote;
1431
+ scope.kind = view.kind;
1432
+ scope.label = view.label;
1433
+ scope.note = view.note;
1434
+ scope.noteTone = view.noteTone;
1435
+ scope.options = view.options;
1436
+ scope.value = view.value;
1437
+ if (disposed || mounting || handle !== null && host.contains(handle.root)) {
1438
+ return;
1439
+ }
1440
+ handle?.dispose();
1441
+ handle = null;
1442
+ mounting = true;
1443
+ host.textContent = "";
1444
+ mount();
1445
+ }
1446
+ };
1447
+ }
1448
+ // src/surfaces/secret-field.json
1449
+ var secret_field_default = {
1450
+ $schema: "https://jxsuite.com/schema/v1",
1451
+ $id: "StudioSecretField",
1452
+ $description: 'The `secret` form control (specs/extensions.md §9.1, §13): one password field whose VALUE goes to the platform\'s secret store and never to project.json. A descriptor names it with `"ui": { "<field>": { "control": "secret" } }`, and `ui/schema-form.ts` mounts it into the empty host its own document announces for that field. **A surface never renders back the secret it describes, and this document is where that is visible rather than remembered**: the only thing bound to the field\'s value is `#/state/shown`, a scope path whose whole purpose is to hold nothing. What the field is worth is said in the placeholder instead — the env NAME the store gave it, which is the only half of a secret a screen may carry. `ui/form-controls.ts` decides everything else: whether the host has a secret store at all, what the placeholder says, what a commit is worth and what the field persists.',
1453
+ tagName: "div",
1454
+ attributes: {
1455
+ part: "secret",
1456
+ role: "none"
1457
+ },
1458
+ style: {
1459
+ $description: "`.secret-field` carried no rule anywhere — it was one of `check-styles.ts`'s ALLOWED_ORPHANS, a class emitted only so a test could find the control — so there is nothing to translate and the wrapper takes no box of its own. The field takes the width of the control host the form drew, which is the flex item; a kit field is inline-flex by default and would otherwise sit at its intrinsic width in a row sized for it.",
1460
+ display: "contents",
1461
+ '& [part="field"]': {
1462
+ width: "100%"
1463
+ }
1464
+ },
1465
+ children: [
1466
+ {
1467
+ $description: "`autocomplete: new-password` because this is a place to PUT a secret rather than to prove one: without it a password manager offers to fill the field with a credential belonging to whatever site the reader last logged in to, and the offer is the manager's own UI drawn over an editor. The value binding is `#/state/shown` and nothing else ever writes to it — see the document description.",
1468
+ tagName: "jx-textfield",
1469
+ attributes: {
1470
+ part: "field"
1471
+ },
1472
+ $props: {
1473
+ type: "password",
1474
+ size: "sm",
1475
+ autocomplete: "new-password",
1476
+ label: {
1477
+ $ref: "#/state/label"
1478
+ },
1479
+ placeholder: {
1480
+ $ref: "#/state/placeholder"
1481
+ },
1482
+ disabled: {
1483
+ $ref: "#/state/disabled"
1484
+ },
1485
+ value: {
1486
+ $ref: "#/state/shown"
1487
+ }
1488
+ },
1489
+ onchange: {
1490
+ $prototype: "Function",
1491
+ body: [
1492
+ {
1493
+ operator: "call",
1494
+ target: {
1495
+ $ref: "#/state/commit"
1496
+ },
1497
+ value: [
1498
+ {
1499
+ $ref: "event#/target/value"
1500
+ }
1501
+ ]
1502
+ }
1503
+ ],
1504
+ description: "The change bubbles out of the field's own input, so what the reader typed is read off the event rather than off the element — and it is read here, handed to the flow, and never written back onto the scope."
1505
+ }
1506
+ }
1507
+ ]
1508
+ };
1509
+
1510
+ // src/surfaces/secret-field.ts
1511
+ registerSurface("secret-field", secret_field_default);
1512
+ function emptyView3() {
1513
+ return { disabled: true, label: "", placeholder: "Not set" };
1514
+ }
1515
+ function mountSecretFieldSurface(host, actions) {
1516
+ host.textContent = "";
1517
+ const scope = reactive({ ...emptyView3(), ...actions, shown: "" });
1518
+ let handle = null;
1519
+ let mounting = true;
1520
+ let disposed = false;
1521
+ const mount = () => mountSurface("secret-field", scope, host).then((mounted) => {
1522
+ mounting = false;
1523
+ if (disposed) {
1524
+ mounted.dispose();
1525
+ return mounted.root;
1526
+ }
1527
+ handle = mounted;
1528
+ return mounted.root;
1529
+ });
1530
+ const ready = mount();
1531
+ return {
1532
+ clear() {
1533
+ scope.shown = " ";
1534
+ scope.shown = "";
1535
+ },
1536
+ dispose() {
1537
+ disposed = true;
1538
+ handle?.dispose();
1539
+ handle = null;
1540
+ host.textContent = "";
1541
+ },
1542
+ host,
1543
+ ready,
1544
+ update(view) {
1545
+ scope.disabled = view.disabled;
1546
+ scope.label = view.label;
1547
+ scope.placeholder = view.placeholder;
1548
+ if (disposed || mounting || handle !== null && host.contains(handle.root)) {
1549
+ return;
1550
+ }
1551
+ handle?.dispose();
1552
+ handle = null;
1553
+ mounting = true;
1554
+ host.textContent = "";
1555
+ mount();
1556
+ }
1557
+ };
1558
+ }
1559
+
1560
+ // src/ui/form-controls.ts
1561
+ var TYPE_ROWS = FIELD_TYPES.map((type) => ({ label: type, value: type }));
1562
+ var FORMAT_ROWS = FORMAT_OPTIONS.map((format) => ({
1563
+ label: format || "(none)",
1564
+ value: format
1565
+ }));
1566
+ var BLANK_FIELD = { format: "", name: "", required: false, type: "string" };
1567
+ var targetRows = [];
1568
+ var targetNames = " ";
1569
+ function targetsFor(ctx) {
1570
+ const content = ctx.resolvePointer("#/$context/content");
1571
+ const names = content && typeof content === "object" && !Array.isArray(content) ? Object.keys(content) : [];
1572
+ const id = names.join(" ");
1573
+ if (id !== targetNames) {
1574
+ targetNames = id;
1575
+ targetRows = names.map((name) => ({ label: name, value: name }));
1576
+ }
1577
+ return targetRows;
1578
+ }
1579
+ function takesFormat(type) {
1580
+ return type === "string" || type === "array";
1581
+ }
1582
+ function readSchema(value) {
1583
+ return value && typeof value === "object" && !Array.isArray(value) ? value : { properties: {}, required: [], type: "object" };
1584
+ }
1585
+ function cloneSchema(value) {
1586
+ const draft = JSON.parse(JSON.stringify(readSchema(value)));
1587
+ draft.type ??= "object";
1588
+ draft.properties ??= {};
1589
+ draft.required ??= [];
1590
+ return draft;
1591
+ }
1592
+ function nameId(key) {
1593
+ return `name:${key}`;
1594
+ }
1595
+ function requiredId(key) {
1596
+ return `required:${key}`;
1597
+ }
1598
+ function nestedId(parent, key) {
1599
+ return `${parent} ${key}`;
1600
+ }
1601
+ function shown(ui, id, held) {
1602
+ return ui.echo?.id === id ? ui.echo.value : held;
1603
+ }
1604
+ function nestedView(ui, parent, key, schema, required) {
1605
+ const id = nestedId(parent, key);
1606
+ const type = detectFieldType(schema);
1607
+ return {
1608
+ format: detectFieldFormat(schema),
1609
+ hasFormat: takesFormat(type),
1610
+ key,
1611
+ name: shown(ui, nameId(id), key),
1612
+ parent,
1613
+ required: shown(ui, requiredId(id), required),
1614
+ type
1615
+ };
1616
+ }
1617
+ function fieldView(ui, key, schema, required, hasTargets) {
1618
+ const type = detectFieldType(schema);
1619
+ const nested = type === "object";
1620
+ const draft = ui.drafts.get(key);
1621
+ const childRequired = schema.required ?? [];
1622
+ return {
1623
+ children: nested ? Object.entries(schema.properties ?? {}).map(([child, sub]) => nestedView(ui, key, child, sub, childRequired.includes(child))) : [],
1624
+ draftName: draft?.name ?? "",
1625
+ draftType: draft?.type ?? "string",
1626
+ extra: type === "reference" && hasTargets ? "reference" : nested ? "nested" : "none",
1627
+ format: detectFieldFormat(schema),
1628
+ hasFormat: takesFormat(type),
1629
+ key,
1630
+ label: camelToLabel(key),
1631
+ name: shown(ui, nameId(key), key),
1632
+ refTarget: schema.$ref ? schema.$ref.replace(/^#\/[^/]+\//, "") : "",
1633
+ required: shown(ui, requiredId(key), required),
1634
+ type
1635
+ };
1636
+ }
1637
+ function renameKey(properties, from, to) {
1638
+ const next = {};
1639
+ for (const [key, value] of Object.entries(properties)) {
1640
+ next[key === from ? to : key] = value;
1641
+ delete properties[key];
1642
+ }
1643
+ Object.assign(properties, next);
1644
+ }
1645
+ function markRequired(holder, key, required) {
1646
+ holder.required ??= [];
1647
+ const at = holder.required.indexOf(key);
1648
+ if (required && at === -1) {
1649
+ holder.required.push(key);
1650
+ }
1651
+ if (!required && at !== -1) {
1652
+ holder.required.splice(at, 1);
1653
+ }
1654
+ }
1655
+ function mountSchemaBuilder(host, args) {
1656
+ let latest = args;
1657
+ let committed = null;
1658
+ const ui = {
1659
+ add: { ...BLANK_FIELD },
1660
+ addOpen: false,
1661
+ drafts: new Map,
1662
+ echo: null
1663
+ };
1664
+ const source = () => committed ?? readSchema(latest.value);
1665
+ const project = () => {
1666
+ const schema = source();
1667
+ const required = schema.required ?? [];
1668
+ const rows = targetsFor(latest.ctx);
1669
+ return {
1670
+ addFormat: ui.add.format,
1671
+ addHasFormat: takesFormat(ui.add.type),
1672
+ addName: ui.add.name,
1673
+ addRequired: ui.add.required,
1674
+ addState: ui.addOpen ? "open" : "closed",
1675
+ addType: ui.add.type,
1676
+ fields: Object.entries(schema.properties ?? {}).map(([key, property]) => fieldView(ui, key, property, required.includes(key), rows.length > 0)),
1677
+ formatOptions: FORMAT_ROWS,
1678
+ targets: rows,
1679
+ typeOptions: TYPE_ROWS
1680
+ };
1681
+ };
1682
+ const redraw = () => surface.update(project());
1683
+ const say = (id, value) => {
1684
+ ui.echo = { id, value };
1685
+ redraw();
1686
+ };
1687
+ const refuse = () => {
1688
+ ui.echo = null;
1689
+ redraw();
1690
+ };
1691
+ const write = (mutate) => {
1692
+ const draft = cloneSchema(source());
1693
+ if (!mutate(draft)) {
1694
+ refuse();
1695
+ return;
1696
+ }
1697
+ committed = draft;
1698
+ ui.echo = null;
1699
+ latest.onChange(draft);
1700
+ redraw();
1701
+ };
1702
+ const parentOf = (draft, parent) => draft.properties[parent];
1703
+ const draftOf = (parent) => {
1704
+ let draft = ui.drafts.get(parent);
1705
+ if (!draft) {
1706
+ draft = { name: "", type: "string" };
1707
+ ui.drafts.set(parent, draft);
1708
+ }
1709
+ return draft;
1710
+ };
1711
+ const surface = mountSchemaBuilderSurface(host, {
1712
+ addNested(parent) {
1713
+ const draft = draftOf(parent);
1714
+ const name = toCamelCase(draft.name.trim());
1715
+ if (!name) {
1716
+ return;
1717
+ }
1718
+ write((next) => {
1719
+ const holder = parentOf(next, parent);
1720
+ if (!holder) {
1721
+ return false;
1722
+ }
1723
+ holder.properties ??= {};
1724
+ holder.properties[name] = schemaForType(draft.type || "string");
1725
+ draft.name = "";
1726
+ return true;
1727
+ });
1728
+ },
1729
+ cancelAdd() {
1730
+ ui.addOpen = false;
1731
+ ui.add = { ...BLANK_FIELD };
1732
+ redraw();
1733
+ },
1734
+ confirmAdd() {
1735
+ const name = toCamelCase(ui.add.name.trim());
1736
+ if (!name) {
1737
+ return;
1738
+ }
1739
+ const { format, required, type } = ui.add;
1740
+ ui.addOpen = false;
1741
+ ui.add = { ...BLANK_FIELD };
1742
+ write((next) => {
1743
+ next.properties[name] = schemaForType(type, format || undefined);
1744
+ if (required) {
1745
+ markRequired(next, name, true);
1746
+ }
1747
+ return true;
1748
+ });
1749
+ },
1750
+ editAddFormat(value) {
1751
+ ui.add.format = value;
1752
+ redraw();
1753
+ },
1754
+ editAddName(value) {
1755
+ ui.add.name = value;
1756
+ redraw();
1757
+ },
1758
+ editAddRequired(required) {
1759
+ ui.add.required = required;
1760
+ redraw();
1761
+ },
1762
+ editAddType(value) {
1763
+ ui.add.type = value;
1764
+ redraw();
1765
+ },
1766
+ editDraftName(parent, value) {
1767
+ draftOf(parent).name = value;
1768
+ redraw();
1769
+ },
1770
+ editDraftType(parent, value) {
1771
+ draftOf(parent).type = value;
1772
+ redraw();
1773
+ },
1774
+ openAdd() {
1775
+ ui.addOpen = true;
1776
+ ui.add = { ...BLANK_FIELD };
1777
+ redraw();
1778
+ },
1779
+ removeField(key) {
1780
+ write((next) => {
1781
+ if (!next.properties[key]) {
1782
+ return false;
1783
+ }
1784
+ delete next.properties[key];
1785
+ next.required = next.required.filter((name) => name !== key);
1786
+ return true;
1787
+ });
1788
+ },
1789
+ removeNested(parent, key) {
1790
+ write((next) => {
1791
+ const holder = parentOf(next, parent);
1792
+ if (!holder?.properties?.[key]) {
1793
+ return false;
1794
+ }
1795
+ delete holder.properties[key];
1796
+ if (holder.required) {
1797
+ holder.required = holder.required.filter((name) => name !== key);
1798
+ }
1799
+ return true;
1800
+ });
1801
+ },
1802
+ renameField(key, value) {
1803
+ say(nameId(key), value);
1804
+ const name = toCamelCase(value.trim());
1805
+ write((next) => {
1806
+ if (!next.properties[key] || !name || name === key || next.properties[name]) {
1807
+ return false;
1808
+ }
1809
+ renameKey(next.properties, key, name);
1810
+ next.required = next.required.map((entry) => entry === key ? name : entry);
1811
+ return true;
1812
+ });
1813
+ },
1814
+ renameNested(parent, key, value) {
1815
+ say(nameId(nestedId(parent, key)), value);
1816
+ const name = toCamelCase(value.trim());
1817
+ write((next) => {
1818
+ const holder = parentOf(next, parent);
1819
+ if (!holder?.properties?.[key] || !name || name === key || holder.properties[name]) {
1820
+ return false;
1821
+ }
1822
+ renameKey(holder.properties, key, name);
1823
+ if (holder.required) {
1824
+ holder.required = holder.required.map((entry) => entry === key ? name : entry);
1825
+ }
1826
+ return true;
1827
+ });
1828
+ },
1829
+ setFormat(key, value) {
1830
+ write((next) => {
1831
+ const property = next.properties[key];
1832
+ if (!property) {
1833
+ return false;
1834
+ }
1835
+ next.properties[key] = schemaForType(property.type || "string", value || undefined);
1836
+ return true;
1837
+ });
1838
+ },
1839
+ setNestedFormat(parent, key, value) {
1840
+ write((next) => {
1841
+ const holder = parentOf(next, parent);
1842
+ const property = holder?.properties?.[key];
1843
+ if (!holder?.properties || !property) {
1844
+ return false;
1845
+ }
1846
+ holder.properties[key] = schemaForType(property.type || "string", value || undefined);
1847
+ return true;
1848
+ });
1849
+ },
1850
+ setNestedRequired(parent, key, required) {
1851
+ say(requiredId(nestedId(parent, key)), required);
1852
+ write((next) => {
1853
+ const holder = parentOf(next, parent);
1854
+ if (!holder) {
1855
+ return false;
1856
+ }
1857
+ markRequired(holder, key, required);
1858
+ return true;
1859
+ });
1860
+ },
1861
+ setNestedType(parent, key, value) {
1862
+ write((next) => {
1863
+ const holder = parentOf(next, parent);
1864
+ const property = holder?.properties?.[key];
1865
+ if (!holder?.properties || !property) {
1866
+ return false;
1867
+ }
1868
+ const format = takesFormat(value) ? detectFieldFormat(property) : undefined;
1869
+ holder.properties[key] = schemaForType(value, format || undefined);
1870
+ return true;
1871
+ });
1872
+ },
1873
+ setRequired(key, required) {
1874
+ say(requiredId(key), required);
1875
+ write((next) => {
1876
+ if (!next.properties[key]) {
1877
+ return false;
1878
+ }
1879
+ markRequired(next, key, required);
1880
+ return true;
1881
+ });
1882
+ },
1883
+ setTarget(key, value) {
1884
+ write((next) => {
1885
+ if (!next.properties[key]) {
1886
+ return false;
1887
+ }
1888
+ next.properties[key] = { $ref: `#/content/${value}` };
1889
+ return true;
1890
+ });
1891
+ },
1892
+ setType(key, value) {
1893
+ write((next) => {
1894
+ const property = next.properties[key];
1895
+ if (!property) {
1896
+ return false;
1897
+ }
1898
+ const format = takesFormat(value) ? detectFieldFormat(property) : undefined;
1899
+ next.properties[key] = schemaForType(value, format || undefined);
1900
+ return true;
1901
+ });
1902
+ }
1903
+ });
1904
+ redraw();
1905
+ return {
1906
+ dispose: () => surface.dispose(),
1907
+ update(next) {
1908
+ latest = next;
1909
+ committed = null;
1910
+ ui.echo = null;
1911
+ redraw();
1912
+ }
1913
+ };
1914
+ }
1915
+ var schemaBuilderControl = { mount: mountSchemaBuilder };
1916
+ registerFormControl("schema-builder", schemaBuilderControl);
1917
+ function envNameOf(value) {
1918
+ return typeof value === "string" && value ? value : null;
1919
+ }
1920
+ function mountSecret(host, args) {
1921
+ let latest = args;
1922
+ const redraw = () => {
1923
+ const envName = envNameOf(latest.value);
1924
+ surface.update({
1925
+ disabled: !latest.ctx.commitSecret,
1926
+ label: latest.key,
1927
+ placeholder: envName ? `Stored as ${envName}` : "Not set"
1928
+ });
1929
+ };
1930
+ const surface = mountSecretFieldSurface(host, {
1931
+ commit(value) {
1932
+ const { commitSecret } = latest.ctx;
1933
+ if (!commitSecret || !value) {
1934
+ return;
1935
+ }
1936
+ surface.clear();
1937
+ const { key, onChange } = latest;
1938
+ const envName = envNameOf(latest.value);
1939
+ Promise.resolve(commitSecret(key, value)).then((name) => {
1940
+ if (typeof name === "string" && name && name !== envName) {
1941
+ onChange(name);
1942
+ }
1943
+ });
1944
+ }
1945
+ });
1946
+ redraw();
1947
+ return {
1948
+ dispose: () => surface.dispose(),
1949
+ update(next) {
1950
+ latest = next;
1951
+ redraw();
1952
+ }
1953
+ };
1954
+ }
1955
+ var secretControl = { mount: mountSecret };
1956
+ registerFormControl("secret", secretControl);
1957
+ var entryIdCache = new Map;
1958
+ var entryIdResult = new Map;
1959
+ var entryIdWaiting = new Map;
1960
+ function invalidateReferenceEntries(collection) {
1961
+ if (collection === undefined) {
1962
+ entryIdCache.clear();
1963
+ entryIdResult.clear();
1964
+ entryIdWaiting.clear();
1965
+ } else {
1966
+ entryIdCache.delete(collection);
1967
+ entryIdResult.delete(collection);
1968
+ entryIdWaiting.delete(collection);
1969
+ }
1970
+ }
1971
+ function entryIdsFor(collection) {
1972
+ const known = entryIdCache.get(collection);
1973
+ if (known) {
1974
+ return known;
1975
+ }
1976
+ const pending = (__preload("3wqeas45"), import("./content-source-3wqeas45.js")).then((m) => m.listCollectionEntryIds(collection));
1977
+ entryIdCache.set(collection, pending);
1978
+ return pending;
1979
+ }
1980
+ function referenceEntryState(collection, onSettled) {
1981
+ const done = entryIdResult.get(collection);
1982
+ if (done) {
1983
+ return done;
1984
+ }
1985
+ const pending = entryIdsFor(collection);
1986
+ const waiting = entryIdWaiting.get(collection);
1987
+ if (waiting) {
1988
+ if (onSettled) {
1989
+ waiting.add(onSettled);
1990
+ }
1991
+ return null;
1992
+ }
1993
+ entryIdWaiting.set(collection, new Set(onSettled ? [onSettled] : []));
1994
+ const settle = (result) => {
1995
+ if (entryIdCache.get(collection) !== pending) {
1996
+ return;
1997
+ }
1998
+ const listeners = entryIdWaiting.get(collection);
1999
+ entryIdWaiting.delete(collection);
2000
+ entryIdResult.set(collection, result);
2001
+ for (const run of listeners ?? []) {
2002
+ run();
2003
+ }
2004
+ };
2005
+ pending.then((ids) => settle({ ids }), (error) => settle({ error: errorMessage2(error) }));
2006
+ return null;
2007
+ }
2008
+ function referenceView(args, onSettled) {
2009
+ const current = typeof args.value === "string" ? args.value : "";
2010
+ const base = {
2011
+ canRetry: false,
2012
+ disabled: false,
2013
+ hasNote: false,
2014
+ label: args.key,
2015
+ note: "",
2016
+ noteTone: "dim",
2017
+ options: [],
2018
+ value: current
2019
+ };
2020
+ const collection = referenceTarget(args.schema);
2021
+ if (collection === null) {
2022
+ return {
2023
+ ...base,
2024
+ hasNote: true,
2025
+ kind: "text",
2026
+ note: 'No collection referenced — add "$ref": "#/content/<type>" to this field.'
2027
+ };
2028
+ }
2029
+ const state = referenceEntryState(collection, onSettled);
2030
+ if (state === null) {
2031
+ return {
2032
+ ...base,
2033
+ disabled: true,
2034
+ kind: "picker",
2035
+ options: [{ label: "Loading…", value: current }]
2036
+ };
2037
+ }
2038
+ if ("error" in state) {
2039
+ return {
2040
+ ...base,
2041
+ canRetry: true,
2042
+ hasNote: true,
2043
+ kind: "text",
2044
+ note: `Could not list ${collection} entries — ${state.error}`,
2045
+ noteTone: "danger"
2046
+ };
2047
+ }
2048
+ const dangling = current !== "" && !state.ids.includes(current);
2049
+ return {
2050
+ ...base,
2051
+ hasNote: state.ids.length === 0,
2052
+ kind: "picker",
2053
+ note: state.ids.length === 0 ? `No ${collection} entries yet.` : "",
2054
+ options: [
2055
+ { label: "—", value: "" },
2056
+ ...dangling ? [{ label: `${current} — not found`, value: current }] : [],
2057
+ ...state.ids.map((id) => ({ label: id, value: id }))
2058
+ ]
2059
+ };
2060
+ }
2061
+ function mountReference(host, args) {
2062
+ let latest = args;
2063
+ let disposed = false;
2064
+ const redraw = () => {
2065
+ if (!disposed) {
2066
+ surface.update(referenceView(latest, redraw));
2067
+ }
2068
+ };
2069
+ const surface = mountReferenceFieldSurface(host, {
2070
+ choose(value) {
2071
+ latest.onChange(value === "" ? undefined : value);
2072
+ },
2073
+ edit(value) {
2074
+ latest.onChange(value.trim() || undefined);
2075
+ },
2076
+ retry() {
2077
+ const collection = referenceTarget(latest.schema);
2078
+ if (collection !== null) {
2079
+ invalidateReferenceEntries(collection);
2080
+ }
2081
+ redraw();
2082
+ }
2083
+ });
2084
+ redraw();
2085
+ return {
2086
+ dispose() {
2087
+ disposed = true;
2088
+ surface.dispose();
2089
+ },
2090
+ update(next) {
2091
+ latest = next;
2092
+ redraw();
2093
+ }
2094
+ };
2095
+ }
2096
+ var referenceControl = { mount: mountReference };
2097
+ registerFormControl("reference", referenceControl);
2098
+ // src/surfaces/entry-editor.json
2099
+ var entry_editor_default = {
2100
+ $schema: "https://jxsuite.com/schema/v1",
2101
+ $id: "StudioEntryEditor",
2102
+ $description: "The Entry editor (§7.4) — one content entry's fields, in a pane, as a Jx document over the kit. The adapter (`surfaces/entry-editor.ts`) hands in a projection; `content/entry-editor.ts` decides everything in it — which collection the file belongs to, which record its fields live in, which required keys are absent and what a draft flag commits into. The FORM is an island: a schema is `ui/schema-form.ts`'s subject, so this document renders an empty `fields` node and the flow places the element that engine hands back (studio-ui-guidelines.md §9.3, §9.4). That is the whole of the difference between this and the card the lit version drew, and it is why the engine converting in batch 7 is what unblocked this one.",
2103
+ tagName: "div",
2104
+ attributes: {
2105
+ part: "entry",
2106
+ "data-jx-region": "${state.region}"
2107
+ },
2108
+ style: {
2109
+ $description: "What `.entry-editor`, `.entry-editor-header`, `.entry-editor-collection`, `.entry-draft-switch`, `.entry-editor-fields`, `.entry-editor-note` and `.entry-editor-empty` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. This editor was the only emitter of all seven, so those rules are dead in the stylesheet from here; a central sweep removes them rather than this change, which owns no stylesheet. Every `--spectrum-font-size-*` reference is gone rather than renamed: those names resolve only inside `<sp-theme>`, and a pane editor is mounted outside it, so each would silently have taken its hard-coded fallback.",
2110
+ height: "100%",
2111
+ padding: "var(--jx-space-5)",
2112
+ overflowY: "auto",
2113
+ background: "var(--bg-panel)",
2114
+ '& [part="header"]': {
2115
+ display: "flex",
2116
+ alignItems: "center",
2117
+ gap: "var(--jx-space-4)",
2118
+ marginBottom: "var(--jx-space-5)"
2119
+ },
2120
+ '& [part="name"]': {
2121
+ margin: "0",
2122
+ fontSize: "var(--jx-text-lg)",
2123
+ fontWeight: "600",
2124
+ color: "var(--fg)"
2125
+ },
2126
+ '& [part="collection"]': {
2127
+ padding: "1px var(--jx-space-3)",
2128
+ borderRadius: "var(--radius)",
2129
+ background: "var(--bg)",
2130
+ color: "var(--fg-dim)",
2131
+ fontSize: "var(--jx-text-sm)"
2132
+ },
2133
+ '& [part="draft"]': {
2134
+ $description: "Pushed to the far end of the header rather than placed there: the heading and the collection chip are both content-width, so `margin-left: auto` is what keeps the switch on the right edge whatever the entry is called.",
2135
+ marginLeft: "auto"
2136
+ },
2137
+ '& [part="fields"]': {
2138
+ $description: "The schema form's host is `display: contents`, so its rows are the flex items of THIS box — which is why the column lives here and not inside the engine.",
2139
+ display: "flex",
2140
+ flexDirection: "column"
2141
+ },
2142
+ '& [part="note"]': {
2143
+ margin: "0 0 var(--jx-space-4)",
2144
+ color: "var(--fg-dim)",
2145
+ fontSize: "var(--jx-text-md)",
2146
+ lineHeight: "1.5"
2147
+ },
2148
+ '& [part="empty"]': {
2149
+ display: "flex",
2150
+ maxWidth: "46ch",
2151
+ flexDirection: "column",
2152
+ alignItems: "flex-start",
2153
+ gap: "var(--jx-space-3)",
2154
+ color: "var(--fg-dim)",
2155
+ fontSize: "var(--jx-text-md)",
2156
+ lineHeight: "1.5"
2157
+ }
2158
+ },
2159
+ children: [
2160
+ {
2161
+ tagName: "div",
2162
+ attributes: {
2163
+ part: "stage-slot",
2164
+ role: "none"
2165
+ },
2166
+ style: {
2167
+ display: "contents"
2168
+ },
2169
+ $switch: {
2170
+ $ref: "#/state/stage"
2171
+ },
2172
+ cases: {
2173
+ entry: {
2174
+ tagName: "div",
2175
+ attributes: {
2176
+ part: "body",
2177
+ role: "none"
2178
+ },
2179
+ style: {
2180
+ display: "contents"
2181
+ },
2182
+ children: [
2183
+ {
2184
+ tagName: "div",
2185
+ attributes: {
2186
+ part: "header"
2187
+ },
2188
+ children: [
2189
+ {
2190
+ tagName: "h3",
2191
+ attributes: {
2192
+ part: "name"
2193
+ },
2194
+ textContent: "${state.name}"
2195
+ },
2196
+ {
2197
+ tagName: "span",
2198
+ attributes: {
2199
+ part: "collection"
2200
+ },
2201
+ textContent: "${state.collection}"
2202
+ },
2203
+ {
2204
+ tagName: "div",
2205
+ attributes: {
2206
+ part: "draft-slot",
2207
+ role: "none"
2208
+ },
2209
+ style: {
2210
+ display: "contents"
2211
+ },
2212
+ $switch: {
2213
+ $ref: "#/state/draftAxis"
2214
+ },
2215
+ cases: {
2216
+ shown: {
2217
+ $description: "No `label`: the slotted word is on screen and carries the name, so an aria-label would be read twice. The tooltip is `hint`, which is what DRAFT_MEANING has always been.",
2218
+ tagName: "jx-switch",
2219
+ attributes: {
2220
+ part: "draft"
2221
+ },
2222
+ $props: {
2223
+ checked: {
2224
+ $ref: "#/state/draft"
2225
+ },
2226
+ hint: "${state.draftHint}",
2227
+ size: "sm"
2228
+ },
2229
+ onchange: {
2230
+ $prototype: "Function",
2231
+ body: [
2232
+ {
2233
+ operator: "call",
2234
+ target: {
2235
+ $ref: "#/state/setDraft"
2236
+ },
2237
+ value: [
2238
+ {
2239
+ $ref: "event#/target/checked"
2240
+ }
2241
+ ]
2242
+ }
2243
+ ]
2244
+ },
2245
+ children: [
2246
+ {
2247
+ tagName: "span",
2248
+ textContent: "Draft"
2249
+ }
2250
+ ]
2251
+ }
2252
+ }
2253
+ }
2254
+ ]
2255
+ },
2256
+ {
2257
+ tagName: "div",
2258
+ attributes: {
2259
+ part: "note-slot",
2260
+ role: "none"
2261
+ },
2262
+ style: {
2263
+ display: "contents"
2264
+ },
2265
+ $switch: {
2266
+ $ref: "#/state/noteState"
2267
+ },
2268
+ cases: {
2269
+ shown: {
2270
+ tagName: "p",
2271
+ attributes: {
2272
+ part: "note"
2273
+ },
2274
+ textContent: "${state.note}"
2275
+ }
2276
+ }
2277
+ },
2278
+ {
2279
+ $description: "An island: `ui/schema-form.ts` draws this entry's fields into this node, and nothing in this document knows what a schema is.",
2280
+ tagName: "div",
2281
+ attributes: {
2282
+ part: "fields",
2283
+ "data-jx-region": "${state.fieldsRegion}"
2284
+ }
2285
+ }
2286
+ ]
2287
+ },
2288
+ empty: {
2289
+ $description: "The mode is reachable from the palette and from `__jxAutomation` on any tab, so this state is real: it names the reason and the fix rather than drawing an empty form.",
2290
+ tagName: "div",
2291
+ attributes: {
2292
+ part: "empty"
2293
+ },
2294
+ children: [
2295
+ {
2296
+ tagName: "p",
2297
+ attributes: {
2298
+ part: "empty-line"
2299
+ },
2300
+ textContent: "${state.emptyLine}"
2301
+ },
2302
+ {
2303
+ tagName: "p",
2304
+ attributes: {
2305
+ part: "note"
2306
+ },
2307
+ children: [
2308
+ {
2309
+ tagName: "span",
2310
+ textContent: "A collection is a "
2311
+ },
2312
+ {
2313
+ tagName: "code",
2314
+ textContent: "content"
2315
+ },
2316
+ {
2317
+ tagName: "span",
2318
+ textContent: " entry in "
2319
+ },
2320
+ {
2321
+ tagName: "code",
2322
+ textContent: "project.json"
2323
+ },
2324
+ {
2325
+ tagName: "span",
2326
+ textContent: " whose "
2327
+ },
2328
+ {
2329
+ tagName: "code",
2330
+ textContent: "source"
2331
+ },
2332
+ {
2333
+ tagName: "span",
2334
+ textContent: " directory contains this file and which declares a "
2335
+ },
2336
+ {
2337
+ tagName: "code",
2338
+ textContent: "schema"
2339
+ },
2340
+ {
2341
+ tagName: "span",
2342
+ textContent: "."
2343
+ }
2344
+ ]
2345
+ },
2346
+ {
2347
+ tagName: "jx-action-button",
2348
+ attributes: {
2349
+ part: "content-types"
2350
+ },
2351
+ $props: {
2352
+ label: "Content types",
2353
+ size: "sm"
2354
+ },
2355
+ onclick: {
2356
+ $prototype: "Function",
2357
+ body: [
2358
+ {
2359
+ operator: "call",
2360
+ target: {
2361
+ $ref: "#/state/openContentTypes"
2362
+ },
2363
+ value: []
2364
+ }
2365
+ ]
2366
+ },
2367
+ children: [
2368
+ {
2369
+ tagName: "span",
2370
+ textContent: "Content types…"
2371
+ }
2372
+ ]
2373
+ }
2374
+ ]
2375
+ }
2376
+ }
2377
+ }
2378
+ ]
2379
+ };
2380
+
2381
+ // src/surfaces/entry-editor.ts
2382
+ registerSurface("entry-editor", entry_editor_default);
2383
+ function project(scope, view) {
2384
+ scope.region = view.region;
2385
+ scope.fieldsRegion = view.fieldsRegion;
2386
+ scope.stage = view.stage;
2387
+ scope.name = view.name;
2388
+ scope.collection = view.collection;
2389
+ scope.draftAxis = view.draftAxis;
2390
+ scope.draft = view.draft;
2391
+ scope.draftHint = view.draftHint;
2392
+ scope.noteState = view.noteState;
2393
+ scope.note = view.note;
2394
+ scope.emptyLine = view.emptyLine;
2395
+ }
2396
+ function partOf(def) {
2397
+ const attributes = def?.attributes;
2398
+ const part = attributes?.["part"];
2399
+ return typeof part === "string" ? part : "";
2400
+ }
2401
+ function mountEntryEditorSurface(host, view, actions, islands) {
2402
+ host.replaceChildren();
2403
+ const scope = reactive({
2404
+ collection: "",
2405
+ draft: false,
2406
+ draftAxis: "hidden",
2407
+ draftHint: "",
2408
+ emptyLine: "",
2409
+ fieldsRegion: "",
2410
+ name: "",
2411
+ note: "",
2412
+ noteState: "hidden",
2413
+ openContentTypes: actions.openContentTypes,
2414
+ region: "",
2415
+ setDraft: actions.setDraft,
2416
+ stage: "empty"
2417
+ });
2418
+ project(scope, view);
2419
+ let mounted = null;
2420
+ let disposed = false;
2421
+ const ready = mountSurface("entry-editor", scope, host, {
2422
+ onNodeCreated: (element, _path, def) => {
2423
+ if (element instanceof HTMLElement && partOf(def) === "fields") {
2424
+ islands.fieldsSlot(element);
2425
+ }
2426
+ }
2427
+ }).then((surface) => {
2428
+ if (disposed) {
2429
+ surface.dispose();
2430
+ return surface.root;
2431
+ }
2432
+ mounted = surface;
2433
+ return surface.root;
2434
+ });
2435
+ return {
2436
+ attached: () => {
2437
+ if (disposed) {
2438
+ return false;
2439
+ }
2440
+ const root = mounted?.root;
2441
+ return root === undefined ? true : root instanceof HTMLElement && host.contains(root);
2442
+ },
2443
+ dispose() {
2444
+ disposed = true;
2445
+ mounted?.dispose();
2446
+ mounted = null;
2447
+ },
2448
+ ready,
2449
+ update: (next) => project(scope, next)
2450
+ };
2451
+ }
2452
+
2453
+ // src/content/entry-fields.ts
2454
+ function fieldsAreDocument(tab) {
2455
+ return tab.doc.sourceFormat == null && tab.doc.mode !== "content";
2456
+ }
2457
+ function entryFields(tab) {
2458
+ return fieldsAreDocument(tab) ? tab.doc.document : tab.doc.content?.frontmatter ?? {};
2459
+ }
2460
+ function mutateDocumentField(tab, field, value) {
2461
+ const doc = tab.doc.document;
2462
+ const before = Object.hasOwn(doc, field) ? cloneValue2(doc[field]) : undefined;
2463
+ const deletes = value === undefined || value === null || value === "";
2464
+ if (deletes) {
2465
+ delete doc[field];
2466
+ } else {
2467
+ doc[field] = value;
2468
+ }
2469
+ const after = deletes ? undefined : cloneValue2(value);
2470
+ recordDocOp({
2471
+ forward: { key: field, op: "set-key", path: [], value: after },
2472
+ inverse: { key: field, op: "set-key", path: [], value: before }
2473
+ });
2474
+ tab.doc.dirty = true;
2475
+ notePreviewOverlayEdit();
2476
+ }
2477
+ function mutateEntryField(tab, field, value) {
2478
+ if (fieldsAreDocument(tab)) {
2479
+ mutateDocumentField(tab, field, value);
2480
+ } else {
2481
+ mutateUpdateFrontmatter(tab, field, value);
2482
+ }
2483
+ }
2484
+ function commitEntryFields(tab, patch) {
2485
+ transactDoc(tab, (t) => {
2486
+ for (const [field, value] of Object.entries(patch)) {
2487
+ mutateEntryField(t, field, value);
2488
+ }
2489
+ });
2490
+ }
2491
+
2492
+ // src/content/entry-editor.ts
2493
+ var ENTRY_MODE = "entry";
2494
+ var ENTRY_TAB_MODES = [ENTRY_MODE];
2495
+ var _active = new Map;
2496
+ function activeIn(paneId) {
2497
+ return _active.get(paneId) ?? null;
2498
+ }
2499
+ function entryPaneMounted(paneId, tab) {
2500
+ const panel = activeIn(paneId);
2501
+ return panel !== null && panel.tabId === tab.id && panel.wrap.isConnected && panel.surface.attached();
2502
+ }
2503
+ function detachEntryPane(paneId) {
2504
+ const panel = _active.get(paneId);
2505
+ if (!panel) {
2506
+ return;
2507
+ }
2508
+ panel.scope.stop();
2509
+ panel.surface.dispose();
2510
+ _active.delete(paneId);
2511
+ }
2512
+ function setEntryDraft(tab, draft) {
2513
+ transactDoc(tab, (t) => mutateEntryField(t, DRAFT_FIELD, draft));
2514
+ }
2515
+ function entryDraftPill(tab) {
2516
+ const collection = collectionOfPath(tab.documentPath);
2517
+ const fields = entryFields(tab);
2518
+ if (!collection || !hasDraftAxis(collection.schema, fields)) {
2519
+ return null;
2520
+ }
2521
+ const draft = isDraftEntry(fields);
2522
+ return {
2523
+ draft,
2524
+ text: draft ? "Draft" : "Published",
2525
+ title: draft ? DRAFT_MEANING : "Not marked a draft."
2526
+ };
2527
+ }
2528
+ function formContext(tab) {
2529
+ return {
2530
+ fieldKeyPrefix: `entry:${tab.id}`,
2531
+ resolvePointer: (pointer, scope) => resolveContextPointer(pointer, {
2532
+ projectConfig: projectState?.projectConfig ?? {},
2533
+ scope
2534
+ })
2535
+ };
2536
+ }
2537
+ function absentRequiredErrors(collection, fields) {
2538
+ const errors = {};
2539
+ for (const field of missingRequired(collection.schema, fields)) {
2540
+ errors[field] = "Required — this entry does not have one.";
2541
+ }
2542
+ return errors;
2543
+ }
2544
+ function emptyLine(tab) {
2545
+ return `${tab.documentPath ?? "This document"} is not an entry of any content collection, so there is no schema to draw a form from.`;
2546
+ }
2547
+ function entryView(paneId, tab, collection) {
2548
+ const region = paneRegion(paneId, "entry");
2549
+ const fieldsRegion = paneRegion(paneId, "entry/fields");
2550
+ if (!collection) {
2551
+ return {
2552
+ collection: "",
2553
+ draft: false,
2554
+ draftAxis: "hidden",
2555
+ draftHint: DRAFT_MEANING,
2556
+ emptyLine: emptyLine(tab),
2557
+ fieldsRegion,
2558
+ name: "",
2559
+ note: "",
2560
+ noteState: "hidden",
2561
+ region,
2562
+ stage: "empty"
2563
+ };
2564
+ }
2565
+ const fields = entryFields(tab);
2566
+ const draft = isDraftEntry(fields);
2567
+ return {
2568
+ collection: collection.name,
2569
+ draft,
2570
+ draftAxis: hasDraftAxis(collection.schema, fields) ? "shown" : "hidden",
2571
+ draftHint: DRAFT_MEANING,
2572
+ emptyLine: "",
2573
+ fieldsRegion,
2574
+ name: tab.documentPath?.split("/").pop() ?? "Untitled",
2575
+ note: DRAFT_MEANING,
2576
+ noteState: draft ? "shown" : "hidden",
2577
+ region,
2578
+ stage: "entry"
2579
+ };
2580
+ }
2581
+ function renderEntryMode(surface, tab) {
2582
+ const { paneId, wrap: canvasWrap } = surface;
2583
+ if (entryPaneMounted(paneId, tab)) {
2584
+ return;
2585
+ }
2586
+ detachEntryPane(paneId);
2587
+ let panel = null;
2588
+ let formHost = null;
2589
+ const redraw = () => {
2590
+ if (panel !== null && activeIn(paneId) === panel) {
2591
+ draw();
2592
+ }
2593
+ };
2594
+ const paintForm = (collection) => {
2595
+ if (!formHost || !collection) {
2596
+ return;
2597
+ }
2598
+ const fields = entryFields(tab);
2599
+ const form = mountSchemaForm(`entry:${paneId}`, collection.schema, fields, {
2600
+ context: formContext(tab),
2601
+ errors: absentRequiredErrors(collection, fields),
2602
+ onChange: (patch) => commitEntryFields(tab, patch),
2603
+ rerender: redraw
2604
+ });
2605
+ if (form.parentNode !== formHost) {
2606
+ formHost.replaceChildren(form);
2607
+ }
2608
+ };
2609
+ const draw = () => {
2610
+ const collection = collectionOfPath(tab.documentPath);
2611
+ if (!collection) {
2612
+ formHost = null;
2613
+ }
2614
+ panel?.surface.update(entryView(paneId, tab, collection));
2615
+ paintForm(collection);
2616
+ };
2617
+ const scope = effectScope();
2618
+ const mounted = mountEntryEditorSurface(canvasWrap, entryView(paneId, tab, collectionOfPath(tab.documentPath)), {
2619
+ openContentTypes: () => {
2620
+ activeRegistry()?.run("settings.open", { section: "content" });
2621
+ },
2622
+ setDraft: (draft) => setEntryDraft(tab, draft)
2623
+ }, {
2624
+ fieldsSlot: (host) => {
2625
+ formHost = host;
2626
+ paintForm(collectionOfPath(tab.documentPath));
2627
+ }
2628
+ });
2629
+ panel = { paneId, scope, surface: mounted, tabId: tab.id, wrap: canvasWrap };
2630
+ _active.set(paneId, panel);
2631
+ scope.run(() => {
2632
+ effect(() => {
2633
+ if (activeIn(paneId) !== panel) {
2634
+ return;
2635
+ }
2636
+ tab.doc.document;
2637
+ tab.doc.content?.frontmatter;
2638
+ projectState?.projectConfig?.content;
2639
+ draw();
2640
+ });
2641
+ });
2642
+ }
2643
+ async function openEntryEditor(path) {
2644
+ const { openFileInTab } = await (__preload("ef8fgs3w"), import("./files-ef8fgs3w.js"));
2645
+ await openFileInTab(path);
2646
+ for (const [id, tab] of workspace2.tabs.entries()) {
2647
+ if (tab.documentPath !== path) {
2648
+ continue;
2649
+ }
2650
+ for (const mode of ENTRY_TAB_MODES) {
2651
+ if (!tab.capabilities.modes.includes(mode)) {
2652
+ tab.capabilities.modes.unshift(mode);
2653
+ }
2654
+ }
2655
+ tab.session.ui.canvasMode = ENTRY_MODE;
2656
+ tab.session.ui.preview = false;
2657
+ activateTab2(id);
2658
+ return tab;
2659
+ }
2660
+ return null;
2661
+ }
2662
+
2663
+ // src/content/entry-commands.ts
2664
+ function creatableCollections() {
2665
+ return entryCollections().map((collection) => collection.name);
2666
+ }
2667
+ async function seedText(collection) {
2668
+ const seed = seedEntry(collection.schema);
2669
+ const formatName = (collection.def.format ? formatByName2(collection.def.format)?.name : undefined) ?? formatForPath2(`untitled${collection.ext}`)?.name ?? defaultContentFormat2()?.name;
2670
+ if (collection.ext === ".json" || formatName === undefined) {
2671
+ return serializeJson(seed, null);
2672
+ }
2673
+ return formatSerialize2(formatName, { ...seed, children: [] }, { frontmatter: Object.keys(seed).length > 0, mode: "roundtrip" });
2674
+ }
2675
+ async function createEntry2(collectionName, opts = {}) {
2676
+ const collection = entryCollection(collectionName);
2677
+ if (!collection) {
2678
+ notify2.error(`No content collection named "${collectionName}" to create an entry in.`, {
2679
+ detail: "A collection needs a `content` entry in project.json whose `source` is a directory. A " + "collection whose source names a single file (a CSV catalogue) has rows, not entry files.",
2680
+ source: "Content"
2681
+ });
2682
+ return null;
2683
+ }
2684
+ await loadFormats2().catch(() => {});
2685
+ let content;
2686
+ try {
2687
+ content = await seedText(collection);
2688
+ } catch (error) {
2689
+ notify2.error(`Could not prepare a new ${collection.name} entry.`, {
2690
+ detail: errorMessage2(error),
2691
+ path: collection.dir,
2692
+ source: "Content"
2693
+ });
2694
+ return null;
2695
+ }
2696
+ const requested = opts.dir;
2697
+ const destination = requested !== undefined && collectionForDirectory(requested)?.name === collection.name ? requested : collection.dir;
2698
+ if (destination.includes(LOCALE_PLACEHOLDER)) {
2699
+ notify2.error(`"${collection.name}" is a localized collection.`, {
2700
+ detail: `Its entries live in one directory per language (${collection.dir}). Open the folder for ` + "the language you are writing in and create the entry there.",
2701
+ path: collection.dir,
2702
+ source: "Content"
2703
+ });
2704
+ return null;
2705
+ }
2706
+ const { createFileIn } = await (__preload("ef8fgs3w"), import("./files-ef8fgs3w.js"));
2707
+ const created = await createFileIn({
2708
+ content,
2709
+ dir: destination,
2710
+ format: { ext: collection.ext, kind: "fixed" },
2711
+ source: "Content",
2712
+ suggestedName: "untitled",
2713
+ title: `New ${collection.name} entry`
2714
+ });
2715
+ if (created === null) {
2716
+ return null;
2717
+ }
2718
+ invalidateReferenceEntries(collection.name);
2719
+ await openEntryEditor(created);
2720
+ return created;
2721
+ }
2722
+ function activeEntryTab() {
2723
+ const tab = activeTab2.value;
2724
+ return tab && collectionOfPath(tab.documentPath) ? tab : null;
2725
+ }
2726
+ function contentCommands() {
2727
+ return [
2728
+ {
2729
+ args: argsSchema({
2730
+ collection: derivedEnumProperty(creatableCollections, "The content collection the entry is created in.")
2731
+ }),
2732
+ category: "File",
2733
+ id: "content.newEntry",
2734
+ level: "project",
2735
+ menus: ["palette"],
2736
+ group: "1_file",
2737
+ requires: "a project with a directory-backed content collection",
2738
+ when: (ctx) => ctx.project.open,
2739
+ enablement: () => creatableCollections().length > 0,
2740
+ undo: "project",
2741
+ run: async (_ctx, args) => {
2742
+ const names = creatableCollections();
2743
+ await createEntry2(enumArg("content.newEntry", args, "collection", names));
2744
+ },
2745
+ title: "New Entry"
2746
+ },
2747
+ {
2748
+ args: argsSchema({
2749
+ path: stringProperty("Project-relative path of the entry file to open.")
2750
+ }),
2751
+ category: "File",
2752
+ id: "content.openEntry",
2753
+ level: "project",
2754
+ menus: ["context/file", "palette"],
2755
+ group: "1_file",
2756
+ requires: "an open project",
2757
+ when: (ctx) => ctx.project.open,
2758
+ run: async (_ctx, args) => {
2759
+ await openEntryEditor(stringArg("content.openEntry", args, "path"));
2760
+ },
2761
+ title: "Open Entry Form"
2762
+ },
2763
+ {
2764
+ args: argsSchema({
2765
+ draft: booleanProperty("True marks the open entry a draft; false marks it published. Written as a `draft` field on the entry.")
2766
+ }),
2767
+ category: "Document",
2768
+ id: "content.setDraft",
2769
+ level: "document",
2770
+ menus: ["context/tab", "palette"],
2771
+ group: "3_document",
2772
+ requires: "a content entry open",
2773
+ when: (ctx) => ctx.document.open,
2774
+ enablement: () => activeEntryTab() !== null,
2775
+ undo: "document",
2776
+ run: (_ctx, args) => {
2777
+ const tab = activeEntryTab();
2778
+ if (!tab) {
2779
+ throw new Error("content.setDraft: the active document is not a content entry");
2780
+ }
2781
+ setEntryDraft(tab, booleanArg("content.setDraft", args, "draft"));
2782
+ },
2783
+ title: "Set Draft"
2784
+ },
2785
+ {
2786
+ args: argsSchema({
2787
+ include: booleanProperty("True lists entries marked `draft: true` alongside the rest.")
2788
+ }),
2789
+ category: "View",
2790
+ id: "content.setIncludeDrafts",
2791
+ level: "project",
2792
+ menus: ["palette"],
2793
+ group: "2_view",
2794
+ requires: "an open project",
2795
+ when: (ctx) => ctx.project.open,
2796
+ run: async (_ctx, args) => {
2797
+ setIncludeDrafts(booleanArg("content.setIncludeDrafts", args, "include"));
2798
+ await reloadDraftAwareGrids2();
2799
+ },
2800
+ title: "Include Drafts"
2801
+ }
2802
+ ];
2803
+ }
2804
+ function registerContentCommands2(registry) {
2805
+ registry.registerAll(contentCommands());
2806
+ }
2807
+
2808
+ export { FIELD_TYPES, FORMAT_OPTIONS, detectFieldType, detectFieldFormat, schemaForType, referenceEntryState, entryFields, entryPaneMounted, detachEntryPane, entryDraftPill, renderEntryMode, createEntry2, registerContentCommands2 };
2809
+
2810
+ //# debugId=BCB2AC86669613BA64756E2164756E21
2811
+ //# sourceMappingURL=studio-fabxk6r9.js.map