@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,4763 @@
1
+ import {
2
+ nothing2
3
+ } from "./studio-1k325pwf.js";
4
+ import {
5
+ errorMessage2
6
+ } from "./studio-yxa81f45.js";
7
+ import {
8
+ platformInFlight2,
9
+ getPlatform2,
10
+ hasPlatform2
11
+ } from "./studio-6nzaktvy.js";
12
+ import {
13
+ formatForPath2
14
+ } from "./studio-79y5sz51.js";
15
+ import {
16
+ POLL_GIT,
17
+ projectState,
18
+ rendersInFlight,
19
+ render3
20
+ } from "./studio-6ewqv390.js";
21
+ import {
22
+ collabState,
23
+ flushAllCollab,
24
+ workspace2,
25
+ activeTab2,
26
+ openTab2,
27
+ activateTab2
28
+ } from "./studio-az3zd49t.js";
29
+ import {
30
+ effectScope,
31
+ effect,
32
+ reactive,
33
+ now,
34
+ notify2
35
+ } from "./studio-p1dw8wfw.js";
36
+ import {
37
+ extensionOf,
38
+ isMediaFile,
39
+ mediaKind,
40
+ mediaSiteUrl,
41
+ previewFileSrc
42
+ } from "./studio-vz68yn9e.js";
43
+ import {
44
+ REGION_ATTR,
45
+ paneRegion,
46
+ overlayRegion,
47
+ registerSurface,
48
+ mountSurface,
49
+ whenReady,
50
+ layerHost2,
51
+ showConfirmDialog2,
52
+ showPromptDialog2,
53
+ overlayIdleBlockers2
54
+ } from "./studio-erdatzvp.js";
55
+ import {
56
+ showModal,
57
+ close2
58
+ } from "./studio-5jy81t3s.js";
59
+ import {
60
+ peekMediaMeta,
61
+ loadMediaMeta,
62
+ recordImageSize,
63
+ formatBytes
64
+ } from "./studio-5523bpzt.js";
65
+ import {
66
+ shell
67
+ } from "./studio-25hkdrkw.js";
68
+ import {
69
+ registerPanel
70
+ } from "./studio-26d7myd1.js";
71
+ import {
72
+ authenticateGithub
73
+ } from "./studio-d1ja2x9r.js";
74
+ import {
75
+ beginActivity,
76
+ activityIdleBlockers,
77
+ showProgressModal,
78
+ peekMediaUsages,
79
+ loadMediaUsages,
80
+ mediaUsageHeadline
81
+ } from "./studio-cpvb2ed1.js";
82
+ import {
83
+ canvasIdleBlockers2,
84
+ canvasPointAt2,
85
+ revealCanvasPath2
86
+ } from "./studio-rkstz940.js";
87
+ import {
88
+ rectOf
89
+ } from "./studio-rs76k67r.js";
90
+ import {
91
+ __preload
92
+ } from "./studio-5te5tqng.js";
93
+ // src/surfaces/media-pane.json
94
+ var media_pane_default = {
95
+ $schema: "https://jxsuite.com/schema/v1",
96
+ $id: "StudioMediaPane",
97
+ $description: "The Media viewer: a pane that SHOWS a file the studio has no document model for — an image at its own size, a video or audio player, an embedded PDF, a font set in a pangram, or an honest line about a format nothing here can draw. The adapter hands in one projection: which of the six stages to draw, the URL that loads it, the file's name and facts, the reference a document would write for it, and the documents that already do. Nothing here decides anything; a control asks the host to copy, to open a path, or to record the pixel size the browser just learned.",
98
+ tagName: "div",
99
+ attributes: {
100
+ part: "viewer",
101
+ "data-jx-region": "${state.region}"
102
+ },
103
+ style: {
104
+ $description: "What `.media-viewer`, `.media-stage`, `.media-image`, `.media-video`, `.media-embed`, `.media-audio`, `.media-specimen`, `.media-specimen-line`, `.media-unviewable`, `.media-note`, `.media-details`, `.media-name`, `.media-facts`, `.media-ref`, `.media-ref-value`, `.media-usage`, `.media-usage-title`, `.media-usage-headline`, `.media-usage-list`, `.media-usage-link` and `.media-usage-count` said in `styles/overlays.css`, keyed on `part` and re-pointed at the studio token layer. All twenty-two were this surface's alone, so the stylesheet block goes with the conversion rather than being copied. Eight `var(--spectrum-font-size-…)` names could not come with the declarations: every one of them resolves only inside `<sp-theme>`, and this document is mounted in a pane stage that is outside it, so each would silently have taken its hex fallback — they are the kit's `--jx-text-xs`, `--jx-text-sm`, `--jx-text-md` and `--jx-text-lg` instead.",
105
+ height: "100%",
106
+ display: "flex",
107
+ gap: "var(--jx-space-5)",
108
+ padding: "var(--jx-space-5)",
109
+ overflowY: "auto",
110
+ background: "var(--bg-panel)",
111
+ fontFamily: "var(--jx-font-sans)",
112
+ color: "var(--fg)",
113
+ '& [part="asset-slot"], & [part="usage-slot"], & [part="list-slot"]': {
114
+ $description: "A `$switch` renders its own container, and none of these three is a box: each stands exactly where its case does, so the case's own rule is the only one that lays anything out.",
115
+ display: "contents"
116
+ },
117
+ '& [part="stage"]': {
118
+ $description: "The asset takes the room and the details column keeps a fixed width, so the file is the thing being looked at and the facts about it are beside it rather than on top of it.",
119
+ flex: "1",
120
+ minWidth: "0",
121
+ display: "flex",
122
+ alignItems: "flex-start",
123
+ justifyContent: "center"
124
+ },
125
+ '& [part="image"]': {
126
+ $description: "Never larger than its own pixels: an upscaled thumbnail is a lie about the asset, and judging whether an imported image is big enough is the whole reason somebody opens this.",
127
+ maxWidth: "100%",
128
+ height: "auto",
129
+ border: "1px solid var(--border)",
130
+ borderRadius: "var(--radius)",
131
+ background: "var(--bg-input)"
132
+ },
133
+ '& [part="video"], & [part="embed"]': {
134
+ width: "100%",
135
+ maxHeight: "70vh",
136
+ border: "1px solid var(--border)",
137
+ borderRadius: "var(--radius)",
138
+ background: "var(--bg-input)"
139
+ },
140
+ '& [part="audio"]': {
141
+ width: "100%"
142
+ },
143
+ '& [part="specimen"]': {
144
+ $description: "A font is shown by being USED. The face itself arrives as a `@font-face` the adapter writes, under a family name generated from the path so two specimens open side by side cannot claim the same one; the element carries only that NAME, as a custom property, and the fallback stack that catches a face the browser refuses stays here where it is a rule rather than data.",
145
+ width: "100%",
146
+ padding: "var(--jx-space-5)",
147
+ border: "1px solid var(--border)",
148
+ borderRadius: "var(--radius)",
149
+ background: "var(--bg-input)",
150
+ color: "var(--fg)",
151
+ fontFamily: "var(--jx-specimen-family, system-ui), system-ui, sans-serif"
152
+ },
153
+ '& [part="specimen-line"]': {
154
+ margin: "0 0 var(--jx-space-4)",
155
+ lineHeight: "1.3",
156
+ overflowWrap: "anywhere"
157
+ },
158
+ '& [part="specimen-line"][data-size="48"]': {
159
+ fontSize: "48px"
160
+ },
161
+ '& [part="specimen-line"][data-size="32"]': {
162
+ fontSize: "32px"
163
+ },
164
+ '& [part="specimen-line"][data-size="24"]': {
165
+ fontSize: "24px"
166
+ },
167
+ '& [part="specimen-line"][data-size="18"]': {
168
+ fontSize: "18px"
169
+ },
170
+ '& [part="specimen-line"][data-size="14"]': {
171
+ fontSize: "var(--jx-text-lg)"
172
+ },
173
+ '& [part="unviewable"]': {
174
+ $description: "Not a failure state. A file the browser cannot render is a zip, or a format this build has never heard of, so the box says what the file IS and that the project still builds with it in.",
175
+ padding: "var(--jx-space-6)",
176
+ border: "1px dashed var(--border)",
177
+ borderRadius: "var(--radius)",
178
+ color: "var(--fg-dim)",
179
+ textAlign: "center"
180
+ },
181
+ '& [part="note"]': {
182
+ fontSize: "var(--jx-text-md)",
183
+ color: "var(--fg-dim)"
184
+ },
185
+ '& [part="details"]': {
186
+ flex: "0 0 260px",
187
+ display: "flex",
188
+ flexDirection: "column",
189
+ gap: "var(--jx-space-4)"
190
+ },
191
+ '& [part="title"]': {
192
+ margin: "0",
193
+ fontSize: "var(--jx-text-lg)",
194
+ color: "var(--fg)",
195
+ overflowWrap: "anywhere"
196
+ },
197
+ '& [part="facts"]': {
198
+ $description: 'Kind, pixel size, bytes and modified date, joined by the adapter. Each is omitted rather than zeroed when it is not known: a real file can almost be `0 × 0` or `0 B`, so neither may double as "we did not find out".',
199
+ margin: "0",
200
+ fontSize: "var(--jx-text-md)",
201
+ color: "var(--fg-dim)"
202
+ },
203
+ '& [part="ref"]': {
204
+ $description: "The reference a document writes for this file — `/hero.jpg` for `public/hero.jpg`, which shares not one segment with it. Getting this wrong is the commonest way an image goes missing from a page, which is why it is on screen next to a button that copies it.",
205
+ display: "flex",
206
+ alignItems: "center",
207
+ gap: "6px"
208
+ },
209
+ '& [part="ref-value"]': {
210
+ flex: "1",
211
+ minWidth: "0",
212
+ fontFamily: "var(--font-mono)",
213
+ fontSize: "var(--jx-text-sm)",
214
+ background: "var(--bg-input)",
215
+ border: "1px solid var(--border)",
216
+ borderRadius: "var(--radius)",
217
+ padding: "3px 6px",
218
+ overflowWrap: "anywhere"
219
+ },
220
+ '& [part="usage"]': {
221
+ display: "flex",
222
+ flexDirection: "column"
223
+ },
224
+ '& [part="group-title"]': {
225
+ margin: "0 0 var(--jx-space-2)",
226
+ fontSize: "var(--jx-text-md)",
227
+ fontWeight: "500",
228
+ color: "var(--fg-dim)"
229
+ },
230
+ '& [part="message"]': {
231
+ margin: "0",
232
+ fontSize: "var(--jx-text-md)",
233
+ color: "var(--fg-dim)"
234
+ },
235
+ '& [part="list"]': {
236
+ listStyle: "none",
237
+ margin: "var(--jx-space-3) 0 0",
238
+ padding: "0",
239
+ display: "flex",
240
+ flexDirection: "column",
241
+ gap: "var(--jx-space-1)"
242
+ },
243
+ '& [part="row"]': {
244
+ display: "flex",
245
+ alignItems: "baseline",
246
+ gap: "6px",
247
+ fontSize: "var(--jx-text-md)"
248
+ },
249
+ '& [part="file-path"]': {
250
+ $description: 'The path is a control, not a label: it opens the document that references this file. A plain button rather than a `jx-button`, for the reason the Problems rows give — what it has to look like is a line of text, and every fill, border and control height the kit draws would have to be taken back off again. Named `file-path` and not `path` because `jx-icon` puts `part="path"` on the `<path>` of every glyph it draws, so `[part="path"]` would select this button and any SVG path beside it.',
251
+ flex: "1",
252
+ minWidth: "0",
253
+ margin: "0",
254
+ padding: "0",
255
+ background: "none",
256
+ border: "none",
257
+ borderRadius: "var(--jx-radius-xs)",
258
+ textAlign: "left",
259
+ color: "var(--accent)",
260
+ cursor: "pointer",
261
+ font: "inherit",
262
+ overflowWrap: "anywhere",
263
+ ":hover": {
264
+ textDecoration: "underline"
265
+ },
266
+ ":focus-visible": {
267
+ outline: "var(--jx-focus-ring)",
268
+ outlineOffset: "2px"
269
+ }
270
+ },
271
+ '& [part="count"]': {
272
+ flex: "0 0 auto",
273
+ fontFamily: "var(--font-mono)",
274
+ fontSize: "var(--jx-text-xs)",
275
+ color: "var(--fg-dim)"
276
+ }
277
+ },
278
+ children: [
279
+ {
280
+ tagName: "div",
281
+ attributes: {
282
+ part: "stage"
283
+ },
284
+ children: [
285
+ {
286
+ tagName: "div",
287
+ attributes: {
288
+ part: "asset-slot",
289
+ role: "none"
290
+ },
291
+ $switch: {
292
+ $ref: "#/state/kind"
293
+ },
294
+ cases: {
295
+ image: {
296
+ tagName: "img",
297
+ attributes: {
298
+ part: "image",
299
+ src: "${state.src}",
300
+ alt: ""
301
+ },
302
+ onload: {
303
+ $prototype: "Function",
304
+ body: [
305
+ {
306
+ operator: "call",
307
+ target: {
308
+ $ref: "#/state/imageLoaded"
309
+ },
310
+ value: [
311
+ {
312
+ $ref: "event#/target/naturalWidth"
313
+ },
314
+ {
315
+ $ref: "event#/target/naturalHeight"
316
+ }
317
+ ]
318
+ }
319
+ ],
320
+ description: "The only honest source of pixel dimensions in a browser is an image that has loaded, and this viewer is showing one at full size anyway. The host decides whether the numbers are new; a repeat load of the same picture must not repaint the pane."
321
+ }
322
+ },
323
+ video: {
324
+ tagName: "video",
325
+ attributes: {
326
+ part: "video",
327
+ src: "${state.src}",
328
+ controls: true
329
+ }
330
+ },
331
+ audio: {
332
+ tagName: "audio",
333
+ attributes: {
334
+ part: "audio",
335
+ src: "${state.src}",
336
+ controls: true
337
+ }
338
+ },
339
+ embed: {
340
+ tagName: "embed",
341
+ attributes: {
342
+ part: "embed",
343
+ src: "${state.src}",
344
+ type: "application/pdf",
345
+ title: "${state.name}"
346
+ }
347
+ },
348
+ font: {
349
+ tagName: "div",
350
+ attributes: {
351
+ part: "specimen",
352
+ style: "${state.specimenFamily}"
353
+ },
354
+ children: [
355
+ {
356
+ tagName: "style",
357
+ textContent: "${state.fontFace}"
358
+ },
359
+ {
360
+ tagName: "p",
361
+ attributes: {
362
+ part: "specimen-line",
363
+ "data-size": "48"
364
+ },
365
+ textContent: "${state.specimen}"
366
+ },
367
+ {
368
+ tagName: "p",
369
+ attributes: {
370
+ part: "specimen-line",
371
+ "data-size": "32"
372
+ },
373
+ textContent: "${state.specimen}"
374
+ },
375
+ {
376
+ tagName: "p",
377
+ attributes: {
378
+ part: "specimen-line",
379
+ "data-size": "24"
380
+ },
381
+ textContent: "${state.specimen}"
382
+ },
383
+ {
384
+ tagName: "p",
385
+ attributes: {
386
+ part: "specimen-line",
387
+ "data-size": "18"
388
+ },
389
+ textContent: "${state.specimen}"
390
+ },
391
+ {
392
+ tagName: "p",
393
+ attributes: {
394
+ part: "specimen-line",
395
+ "data-size": "14"
396
+ },
397
+ textContent: "${state.specimen}"
398
+ }
399
+ ]
400
+ },
401
+ unviewable: {
402
+ tagName: "div",
403
+ attributes: {
404
+ part: "unviewable"
405
+ },
406
+ children: [
407
+ {
408
+ tagName: "p",
409
+ children: [
410
+ {
411
+ tagName: "span",
412
+ textContent: "Jx has no viewer for "
413
+ },
414
+ {
415
+ tagName: "code",
416
+ textContent: "${state.extLabel}"
417
+ },
418
+ {
419
+ tagName: "span",
420
+ textContent: "."
421
+ }
422
+ ]
423
+ },
424
+ {
425
+ tagName: "p",
426
+ attributes: {
427
+ part: "note"
428
+ },
429
+ textContent: "The file is in the project and builds normally."
430
+ }
431
+ ]
432
+ }
433
+ }
434
+ }
435
+ ]
436
+ },
437
+ {
438
+ tagName: "div",
439
+ attributes: {
440
+ part: "details"
441
+ },
442
+ children: [
443
+ {
444
+ tagName: "h3",
445
+ attributes: {
446
+ part: "title"
447
+ },
448
+ textContent: "${state.name}"
449
+ },
450
+ {
451
+ tagName: "p",
452
+ attributes: {
453
+ part: "facts"
454
+ },
455
+ textContent: "${state.facts}"
456
+ },
457
+ {
458
+ tagName: "div",
459
+ attributes: {
460
+ part: "ref"
461
+ },
462
+ children: [
463
+ {
464
+ tagName: "code",
465
+ attributes: {
466
+ part: "ref-value"
467
+ },
468
+ textContent: "${state.ref}"
469
+ },
470
+ {
471
+ tagName: "jx-action-button",
472
+ $props: {
473
+ size: "sm",
474
+ quiet: true,
475
+ hint: "Copy the reference"
476
+ },
477
+ attributes: {
478
+ part: "copy"
479
+ },
480
+ onclick: {
481
+ $prototype: "Function",
482
+ body: [
483
+ {
484
+ operator: "call",
485
+ target: {
486
+ $ref: "#/state/copyRef"
487
+ }
488
+ }
489
+ ]
490
+ },
491
+ children: [
492
+ {
493
+ tagName: "span",
494
+ textContent: "Copy"
495
+ }
496
+ ]
497
+ }
498
+ ]
499
+ },
500
+ {
501
+ tagName: "div",
502
+ attributes: {
503
+ part: "usage-slot",
504
+ role: "none"
505
+ },
506
+ $switch: {
507
+ $ref: "#/state/usageState"
508
+ },
509
+ cases: {
510
+ shown: {
511
+ tagName: "div",
512
+ attributes: {
513
+ part: "usage"
514
+ },
515
+ children: [
516
+ {
517
+ tagName: "h4",
518
+ attributes: {
519
+ part: "group-title"
520
+ },
521
+ textContent: "Used by"
522
+ },
523
+ {
524
+ tagName: "p",
525
+ attributes: {
526
+ part: "message"
527
+ },
528
+ textContent: "${state.usageHeadline}"
529
+ },
530
+ {
531
+ tagName: "div",
532
+ attributes: {
533
+ part: "list-slot",
534
+ role: "none"
535
+ },
536
+ $switch: {
537
+ $ref: "#/state/hasUsageFiles"
538
+ },
539
+ cases: {
540
+ true: {
541
+ tagName: "ul",
542
+ attributes: {
543
+ part: "list"
544
+ },
545
+ children: [
546
+ {
547
+ $prototype: "Array",
548
+ items: {
549
+ $ref: "#/state/usageFiles"
550
+ },
551
+ key: {
552
+ $ref: "$map/item/path"
553
+ },
554
+ map: {
555
+ tagName: "li",
556
+ attributes: {
557
+ part: "row",
558
+ "data-usage": "${$map.item.path}"
559
+ },
560
+ children: [
561
+ {
562
+ tagName: "button",
563
+ attributes: {
564
+ part: "file-path",
565
+ type: "button"
566
+ },
567
+ textContent: "${$map.item.path}",
568
+ onclick: {
569
+ $prototype: "Function",
570
+ body: [
571
+ {
572
+ operator: "call",
573
+ target: {
574
+ $ref: "#/state/openDocument"
575
+ },
576
+ value: [
577
+ {
578
+ $ref: "$map/item/path"
579
+ }
580
+ ]
581
+ }
582
+ ]
583
+ }
584
+ },
585
+ {
586
+ tagName: "span",
587
+ attributes: {
588
+ part: "count"
589
+ },
590
+ textContent: "${$map.item.count}"
591
+ }
592
+ ]
593
+ }
594
+ }
595
+ ]
596
+ }
597
+ }
598
+ }
599
+ ]
600
+ }
601
+ }
602
+ }
603
+ ]
604
+ }
605
+ ]
606
+ };
607
+
608
+ // src/surfaces/media-pane.ts
609
+ registerSurface("media-pane", media_pane_default);
610
+ function project(scope, view) {
611
+ scope.region = view.region;
612
+ scope.name = view.name;
613
+ scope.kind = view.kind;
614
+ scope.src = view.src;
615
+ scope.facts = view.facts;
616
+ scope.ref = view.ref;
617
+ scope.specimen = view.specimen;
618
+ scope.specimenFamily = view.specimenFamily;
619
+ scope.fontFace = view.fontFace;
620
+ scope.extLabel = view.extLabel;
621
+ scope.usageState = view.usageState;
622
+ scope.usageHeadline = view.usageHeadline;
623
+ scope.usageFiles = view.usageFiles;
624
+ scope.hasUsageFiles = view.usageFiles.length > 0;
625
+ }
626
+ function mountMediaSurface(host, view, actions) {
627
+ host.replaceChildren();
628
+ const scope = reactive({
629
+ copyRef: actions.copyRef,
630
+ extLabel: "",
631
+ facts: "",
632
+ fontFace: "",
633
+ hasUsageFiles: false,
634
+ imageLoaded: actions.imageLoaded,
635
+ kind: "unviewable",
636
+ name: "",
637
+ openDocument: actions.openDocument,
638
+ ref: "",
639
+ region: "",
640
+ specimen: "",
641
+ specimenFamily: "",
642
+ src: "",
643
+ usageFiles: [],
644
+ usageHeadline: "",
645
+ usageState: "hidden"
646
+ });
647
+ project(scope, view);
648
+ let mounted = null;
649
+ let disposed = false;
650
+ const ready = mountSurface("media-pane", scope, host).then((surface) => {
651
+ if (disposed) {
652
+ surface.dispose();
653
+ return surface.root;
654
+ }
655
+ mounted = surface;
656
+ return surface.root;
657
+ });
658
+ return {
659
+ attached: () => {
660
+ if (disposed) {
661
+ return false;
662
+ }
663
+ const root = mounted?.root;
664
+ return root === undefined ? true : root instanceof HTMLElement && host.contains(root);
665
+ },
666
+ dispose() {
667
+ disposed = true;
668
+ mounted?.dispose();
669
+ mounted = null;
670
+ },
671
+ ready,
672
+ update: (next) => project(scope, next)
673
+ };
674
+ }
675
+
676
+ // src/media/media-pane.ts
677
+ var MEDIA_MODE = "media";
678
+ var FONT_EXTENSIONS = new Set([".woff", ".woff2", ".ttf", ".otf"]);
679
+ var SPECIMEN = "The quick brown fox jumps over the lazy dog";
680
+ var _active = new Map;
681
+ function activeIn(paneId) {
682
+ return _active.get(paneId) ?? null;
683
+ }
684
+ function mediaPaneMounted(paneId, tab) {
685
+ const panel = activeIn(paneId);
686
+ return panel !== null && panel.tabId === tab.id && panel.wrap.isConnected && panel.surface.attached();
687
+ }
688
+ function detachMediaPane(paneId) {
689
+ const panel = _active.get(paneId);
690
+ if (!panel) {
691
+ return;
692
+ }
693
+ panel.scope.stop();
694
+ panel.surface.dispose();
695
+ _active.delete(paneId);
696
+ }
697
+ function stageFor(path) {
698
+ const ext = extensionOf(path);
699
+ if (FONT_EXTENSIONS.has(ext)) {
700
+ return "font";
701
+ }
702
+ const kind = mediaKind({ name: path });
703
+ if (kind === "image" || kind === "video" || kind === "audio") {
704
+ return kind;
705
+ }
706
+ return ext === ".pdf" ? "embed" : "unviewable";
707
+ }
708
+ function factsLine(path, meta) {
709
+ const facts = [mediaKind({ name: path })];
710
+ if (meta?.width != null && meta.height != null) {
711
+ facts.push(`${meta.width} × ${meta.height}`);
712
+ }
713
+ if (meta?.bytes != null) {
714
+ facts.push(formatBytes(meta.bytes));
715
+ }
716
+ if (meta?.modified) {
717
+ facts.push(`modified ${meta.modified.slice(0, 10)}`);
718
+ }
719
+ return facts.join(" · ");
720
+ }
721
+ function specimenFamily(path) {
722
+ return `jx-specimen-${path.replaceAll(/[^a-zA-Z0-9]/g, "-")}`;
723
+ }
724
+ function usageOf(usage) {
725
+ const headline = mediaUsageHeadline(usage);
726
+ if (headline === null) {
727
+ return { usageFiles: [], usageHeadline: "", usageState: "hidden" };
728
+ }
729
+ const files = usage?.status === "ready" ? usage.result.files : [];
730
+ return {
731
+ usageFiles: files.map((file) => ({ count: String(file.count), path: file.path })),
732
+ usageHeadline: headline,
733
+ usageState: "shown"
734
+ };
735
+ }
736
+ async function openDocument(path) {
737
+ const { openFileInTab } = await (__preload("ef8fgs3w"), import("./files-ef8fgs3w.js"));
738
+ await openFileInTab(path);
739
+ }
740
+ function renderMediaMode(surface, tab) {
741
+ const { paneId, wrap: canvasWrap } = surface;
742
+ if (mediaPaneMounted(paneId, tab)) {
743
+ return;
744
+ }
745
+ detachMediaPane(paneId);
746
+ const path = tab.documentPath ?? "";
747
+ const family = specimenFamily(path);
748
+ const src = previewFileSrc(path);
749
+ const ref = mediaSiteUrl(path);
750
+ const ext = extensionOf(path);
751
+ const kind = stageFor(path);
752
+ let panel = null;
753
+ const redraw = () => {
754
+ if (panel !== null && activeIn(paneId) === panel) {
755
+ draw();
756
+ }
757
+ };
758
+ const view = () => {
759
+ const meta = peekMediaMeta(path);
760
+ const usage = peekMediaUsages(path);
761
+ if (meta === null) {
762
+ loadMediaMeta(path).then(redraw);
763
+ }
764
+ if (usage === null || usage.status === "pending") {
765
+ loadMediaUsages(path).then(redraw);
766
+ }
767
+ return {
768
+ extLabel: ext || "this file",
769
+ facts: factsLine(path, meta),
770
+ fontFace: kind === "font" ? `@font-face { font-family: "${family}"; src: url("${src}"); }` : "",
771
+ kind,
772
+ name: path.split("/").pop() ?? "",
773
+ ref,
774
+ region: paneRegion(paneId, "media"),
775
+ specimen: SPECIMEN,
776
+ specimenFamily: `--jx-specimen-family: "${family}"`,
777
+ src,
778
+ ...usageOf(usage)
779
+ };
780
+ };
781
+ const draw = () => {
782
+ panel?.surface.update(view());
783
+ };
784
+ const scope = effectScope();
785
+ const mounted = mountMediaSurface(canvasWrap, view(), {
786
+ copyRef: () => {
787
+ navigator.clipboard?.writeText(ref);
788
+ },
789
+ imageLoaded: (width, height) => {
790
+ if (recordImageSize(path, width, height)) {
791
+ redraw();
792
+ }
793
+ },
794
+ openDocument: (target) => {
795
+ openDocument(target);
796
+ }
797
+ });
798
+ panel = { paneId, scope, surface: mounted, tabId: tab.id, wrap: canvasWrap };
799
+ _active.set(paneId, panel);
800
+ scope.run(() => {
801
+ effect(() => {
802
+ if (activeIn(paneId) !== panel) {
803
+ return;
804
+ }
805
+ tab.documentPath;
806
+ draw();
807
+ });
808
+ });
809
+ }
810
+
811
+ // src/media/media-open.ts
812
+ var MEDIA_STUB_DOCUMENT = { children: [], tagName: "div" };
813
+ function isViewableMedia(path) {
814
+ return isMediaFile(path);
815
+ }
816
+ function mediaTabModes(path) {
817
+ return extensionOf(path) === ".svg" ? [MEDIA_MODE, "source"] : [MEDIA_MODE];
818
+ }
819
+ function openMediaTab(path) {
820
+ const existing = workspace2.tabs.get(path);
821
+ if (existing) {
822
+ activateTab2(path);
823
+ return existing;
824
+ }
825
+ return openTab2({
826
+ capabilities: { modes: mediaTabModes(path) },
827
+ document: structuredClone(MEDIA_STUB_DOCUMENT),
828
+ documentPath: path,
829
+ id: path,
830
+ sourceFormat: null
831
+ });
832
+ }
833
+
834
+ // src/panels/git-diff-open.ts
835
+ var DIFF_STUB_DOCUMENT = { children: [], tagName: "div" };
836
+ var NON_DOCUMENT_JSON = new Set([
837
+ "bunfig.json",
838
+ "jsconfig.json",
839
+ "package-lock.json",
840
+ "package.json",
841
+ "tsconfig.json",
842
+ "wrangler.json"
843
+ ]);
844
+ function canRenderComparison(path) {
845
+ const name = path.slice(path.lastIndexOf("/") + 1);
846
+ if (NON_DOCUMENT_JSON.has(name) || name.endsWith(".schema.json")) {
847
+ return false;
848
+ }
849
+ return path.endsWith(".json") || Boolean(formatForPath2(path));
850
+ }
851
+ function comparisonRefusal(path, fileStatus) {
852
+ if (path.startsWith("../") || path.includes("/../")) {
853
+ return `"${path}" is outside this project, so its comparison belongs to the project that owns it.`;
854
+ }
855
+ if (fileStatus === "R") {
856
+ return `A renamed file's comparison needs both paths, and Studio does not model the old name yet.`;
857
+ }
858
+ if (isViewableMedia(path)) {
859
+ return `"${path}" is an image or media file, and a comparison of one is not text.`;
860
+ }
861
+ return null;
862
+ }
863
+ function diffTabModes() {
864
+ return ["git-diff"];
865
+ }
866
+ function openDiffTab(path) {
867
+ const existing = workspace2.tabs.get(path);
868
+ if (existing) {
869
+ activateTab2(path);
870
+ return existing;
871
+ }
872
+ return openTab2({
873
+ capabilities: { modes: diffTabModes() },
874
+ document: structuredClone(DIFF_STUB_DOCUMENT),
875
+ documentPath: path,
876
+ id: path,
877
+ sourceFormat: null
878
+ });
879
+ }
880
+ async function openComparisonTab(path) {
881
+ if (!canRenderComparison(path)) {
882
+ return openDiffTab(path);
883
+ }
884
+ const files = await (__preload("ef8fgs3w"), import("./files-ef8fgs3w.js"));
885
+ const opened = await files.openFileInTab(path, {});
886
+ return opened ?? [...workspace2.tabs.values()].find((tab) => tab.documentPath === path) ?? null;
887
+ }
888
+ // src/surfaces/github-publish.json
889
+ var github_publish_default = {
890
+ $schema: "https://jxsuite.com/schema/v1",
891
+ $id: "StudioGithubPublish",
892
+ $description: "Create GitHub Repository: the three things the flow needs before it calls the API — the repository's name, an optional description, and whether it is private. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answer buttons. Nothing here reaches GitHub: `github/github-publish.ts` keeps the token, the request and the activity, and this document only collects.",
893
+ tagName: "jx-dialog",
894
+ $props: {
895
+ headline: "Create GitHub Repository",
896
+ confirmLabel: "Create Repository",
897
+ cancelLabel: "Cancel",
898
+ size: "sm"
899
+ },
900
+ attributes: {
901
+ part: "github-publish"
902
+ },
903
+ onconfirm: {
904
+ $prototype: "Function",
905
+ body: [
906
+ {
907
+ operator: "call",
908
+ target: {
909
+ $ref: "#/state/confirm"
910
+ },
911
+ value: []
912
+ }
913
+ ]
914
+ },
915
+ oncancel: {
916
+ $prototype: "Function",
917
+ body: [
918
+ {
919
+ operator: "call",
920
+ target: {
921
+ $ref: "#/state/cancel"
922
+ },
923
+ value: []
924
+ }
925
+ ]
926
+ },
927
+ onclose: {
928
+ $prototype: "Function",
929
+ body: [
930
+ {
931
+ operator: "call",
932
+ target: {
933
+ $ref: "#/state/closed"
934
+ },
935
+ value: []
936
+ }
937
+ ]
938
+ },
939
+ style: {
940
+ $description: 'What is NOT here is most of the conversion. `.github-publish-dialog` was a flex column with an 8px gap and `8px 0` of padding: the gap is the one thing it said that nothing else draws, and `jx-dialog`\'s own body already pads the content, so only the gap survives. `.github-publish-dialog sp-textfield { width: 100% }` had nothing to transcribe either — a `jx-field` row is a grid whose control cell stretches, so the field fills the row without being told to. The three `sp-field-label`s are gone with them, because `jx-field` draws the label AND names the control from it; the third of them carried no `for` at all, so "Visibility" was text beside a switch rather than a name for it.',
941
+ '& [part="rows"]': {
942
+ display: "flex",
943
+ flexDirection: "column",
944
+ gap: "var(--jx-space-3)"
945
+ }
946
+ },
947
+ children: [
948
+ {
949
+ tagName: "div",
950
+ attributes: {
951
+ part: "rows"
952
+ },
953
+ children: [
954
+ {
955
+ tagName: "jx-field",
956
+ $props: {
957
+ span: true,
958
+ label: "Repository name"
959
+ },
960
+ attributes: {
961
+ part: "row",
962
+ "data-field": "name"
963
+ },
964
+ children: [
965
+ {
966
+ tagName: "jx-textfield",
967
+ $props: {
968
+ placeholder: "my-project",
969
+ value: {
970
+ $ref: "#/state/name"
971
+ }
972
+ },
973
+ attributes: {
974
+ part: "field"
975
+ },
976
+ oninput: {
977
+ $prototype: "Function",
978
+ body: [
979
+ {
980
+ operator: "call",
981
+ target: {
982
+ $ref: "#/state/setName"
983
+ },
984
+ value: [
985
+ {
986
+ $ref: "event#/target/value"
987
+ }
988
+ ]
989
+ }
990
+ ]
991
+ }
992
+ }
993
+ ]
994
+ },
995
+ {
996
+ tagName: "jx-field",
997
+ $props: {
998
+ span: true,
999
+ label: "Description (optional)"
1000
+ },
1001
+ attributes: {
1002
+ part: "row",
1003
+ "data-field": "description"
1004
+ },
1005
+ children: [
1006
+ {
1007
+ tagName: "jx-textfield",
1008
+ $props: {
1009
+ placeholder: "A brief description",
1010
+ value: {
1011
+ $ref: "#/state/description"
1012
+ }
1013
+ },
1014
+ attributes: {
1015
+ part: "field"
1016
+ },
1017
+ oninput: {
1018
+ $prototype: "Function",
1019
+ body: [
1020
+ {
1021
+ operator: "call",
1022
+ target: {
1023
+ $ref: "#/state/setDescription"
1024
+ },
1025
+ value: [
1026
+ {
1027
+ $ref: "event#/target/value"
1028
+ }
1029
+ ]
1030
+ }
1031
+ ]
1032
+ }
1033
+ }
1034
+ ]
1035
+ },
1036
+ {
1037
+ tagName: "jx-field",
1038
+ $props: {
1039
+ span: true,
1040
+ label: "Visibility"
1041
+ },
1042
+ attributes: {
1043
+ part: "row",
1044
+ "data-field": "visibility"
1045
+ },
1046
+ children: [
1047
+ {
1048
+ tagName: "div",
1049
+ $description: 'The row opens with a plain `div`, and that is the whole reason it exists: `jx-field` names the first thing slotted into it that observes `labelledby`, so a switch slotted straight in would be announced "Visibility" over the top of the words printed beside it. A `div` observes no naming, so the switch keeps the name its own label gives it.',
1050
+ attributes: {
1051
+ part: "visibility-row"
1052
+ },
1053
+ children: [
1054
+ {
1055
+ tagName: "jx-switch",
1056
+ attributes: {
1057
+ part: "toggle"
1058
+ },
1059
+ $props: {
1060
+ checked: {
1061
+ $ref: "#/state/isPrivate"
1062
+ }
1063
+ },
1064
+ onchange: {
1065
+ $prototype: "Function",
1066
+ body: [
1067
+ {
1068
+ operator: "call",
1069
+ target: {
1070
+ $ref: "#/state/setPrivate"
1071
+ },
1072
+ value: [
1073
+ {
1074
+ $ref: "event#/target/checked"
1075
+ }
1076
+ ]
1077
+ }
1078
+ ]
1079
+ },
1080
+ children: [
1081
+ {
1082
+ tagName: "span",
1083
+ textContent: "Private repository"
1084
+ }
1085
+ ]
1086
+ }
1087
+ ]
1088
+ }
1089
+ ]
1090
+ }
1091
+ ]
1092
+ }
1093
+ ]
1094
+ };
1095
+
1096
+ // src/surfaces/github-publish.ts
1097
+ registerSurface("github-publish", github_publish_default);
1098
+ function openGithubPublishSurface(options) {
1099
+ const slot = document.createElement("div");
1100
+ slot.style.pointerEvents = "auto";
1101
+ slot.setAttribute(REGION_ATTR, overlayRegion("dialog", "github-publish"));
1102
+ options.layer.append(slot);
1103
+ let closed = false;
1104
+ const finish = () => {
1105
+ if (closed) {
1106
+ return;
1107
+ }
1108
+ closed = true;
1109
+ options.onClosed();
1110
+ };
1111
+ const scope = reactive({
1112
+ cancel: () => {
1113
+ options.onCancel();
1114
+ },
1115
+ closed: finish,
1116
+ confirm: () => {
1117
+ options.onConfirm({
1118
+ description: scope.description,
1119
+ isPrivate: scope.isPrivate,
1120
+ name: scope.name
1121
+ });
1122
+ },
1123
+ description: "",
1124
+ isPrivate: true,
1125
+ name: options.name,
1126
+ setDescription: (value) => {
1127
+ scope.description = value;
1128
+ },
1129
+ setName: (value) => {
1130
+ scope.name = value;
1131
+ },
1132
+ setPrivate: (value) => {
1133
+ scope.isPrivate = value;
1134
+ }
1135
+ });
1136
+ let mounted = null;
1137
+ const ready = mountSurface("github-publish", scope, slot).then(async (surface) => {
1138
+ mounted = surface;
1139
+ const element = surface.root;
1140
+ if (closed) {
1141
+ surface.dispose();
1142
+ return element;
1143
+ }
1144
+ await whenReady(element);
1145
+ if (closed) {
1146
+ return element;
1147
+ }
1148
+ showModal(element);
1149
+ return element;
1150
+ });
1151
+ const handle = {
1152
+ close() {
1153
+ if (closed) {
1154
+ return;
1155
+ }
1156
+ const element = mounted?.root;
1157
+ if (element instanceof HTMLElement) {
1158
+ close2(element);
1159
+ }
1160
+ mounted?.dispose();
1161
+ mounted = null;
1162
+ slot.remove();
1163
+ finish();
1164
+ },
1165
+ host: slot,
1166
+ ready
1167
+ };
1168
+ return handle;
1169
+ }
1170
+
1171
+ // src/github/github-publish.ts
1172
+ var REPO_STEPS = ["Create the repository", "Add the remote", "Push"];
1173
+ function askForRepoOptions(projectName) {
1174
+ return new Promise((resolve) => {
1175
+ let answered = false;
1176
+ const settle = (value) => {
1177
+ if (answered) {
1178
+ return;
1179
+ }
1180
+ answered = true;
1181
+ resolve(value);
1182
+ };
1183
+ const handle = openGithubPublishSurface({
1184
+ layer: layerHost2("dialog"),
1185
+ name: projectName,
1186
+ onCancel: () => {
1187
+ handle.close();
1188
+ },
1189
+ onClosed: () => {
1190
+ settle(null);
1191
+ },
1192
+ onConfirm: (values) => {
1193
+ settle({ ...values, name: values.name || projectName });
1194
+ handle.close();
1195
+ }
1196
+ });
1197
+ });
1198
+ }
1199
+ async function createGithubRepository({ projectName }) {
1200
+ const token = await authenticateGithub();
1201
+ if (!token) {
1202
+ return false;
1203
+ }
1204
+ const repoOpts = await askForRepoOptions(projectName);
1205
+ if (!repoOpts) {
1206
+ return false;
1207
+ }
1208
+ const activity = beginActivity({
1209
+ source: "Source Control",
1210
+ status: `Creating ${repoOpts.name}…`,
1211
+ steps: [...REPO_STEPS],
1212
+ title: "Create GitHub repository"
1213
+ });
1214
+ activity.step(REPO_STEPS[0]);
1215
+ const createRes = await fetch("https://api.github.com/user/repos", {
1216
+ body: JSON.stringify({
1217
+ auto_init: false,
1218
+ description: repoOpts.description,
1219
+ name: repoOpts.name,
1220
+ private: repoOpts.isPrivate
1221
+ }),
1222
+ headers: {
1223
+ Accept: "application/vnd.github+json",
1224
+ Authorization: `Bearer ${token}`,
1225
+ "Content-Type": "application/json"
1226
+ },
1227
+ method: "POST"
1228
+ }).catch((error) => {
1229
+ activity.log(errorMessage2(error));
1230
+ return null;
1231
+ });
1232
+ if (!createRes) {
1233
+ activity.fail("Could not reach GitHub to create the repository.", {
1234
+ action: "git.createGithubRepository"
1235
+ });
1236
+ return false;
1237
+ }
1238
+ if (!createRes.ok) {
1239
+ const err = await createRes.json();
1240
+ activity.log(err.errors?.[0]?.message || err.message || `GitHub answered ${createRes.status}.`);
1241
+ activity.fail("Could not create the GitHub repository.", {
1242
+ action: "git.createGithubRepository"
1243
+ });
1244
+ return false;
1245
+ }
1246
+ const repo = await createRes.json();
1247
+ activity.log(`Created ${repo.html_url}`);
1248
+ const platform = getPlatform2();
1249
+ activity.step(REPO_STEPS[1]);
1250
+ try {
1251
+ await platform.gitAddRemote("origin", repo.clone_url);
1252
+ } catch (error) {
1253
+ activity.log(errorMessage2(error));
1254
+ activity.fail("The repository was created, but the remote could not be added.", {
1255
+ action: "panel.focus.git"
1256
+ });
1257
+ return false;
1258
+ }
1259
+ activity.step(REPO_STEPS[2]);
1260
+ try {
1261
+ await platform.gitPush({ setUpstream: true });
1262
+ } catch (error) {
1263
+ activity.log(errorMessage2(error));
1264
+ activity.fail("The repository was created, but the push failed.", {
1265
+ action: "git.push"
1266
+ });
1267
+ return false;
1268
+ }
1269
+ const { refreshGitStatus } = await (__preload("4wp2rn9b"), import("./git-panel-4wp2rn9b.js"));
1270
+ await refreshGitStatus();
1271
+ activity.done(repo.html_url);
1272
+ notify2.success(`Repository created: ${repo.html_url}`, { key: "github.repo" });
1273
+ return true;
1274
+ }
1275
+
1276
+ // src/project-list.ts
1277
+ var cache = [];
1278
+ function platformListsProjects() {
1279
+ return hasPlatform2() && typeof getPlatform2().listProjects === "function";
1280
+ }
1281
+ async function hydrateProjectList() {
1282
+ if (!platformListsProjects()) {
1283
+ cache = [];
1284
+ return;
1285
+ }
1286
+ try {
1287
+ cache = await getPlatform2().listProjects?.() ?? [];
1288
+ } catch {
1289
+ cache = [];
1290
+ }
1291
+ }
1292
+ function getProjectList() {
1293
+ return cache;
1294
+ }
1295
+ function seedProjectList(entries) {
1296
+ cache = entries;
1297
+ }
1298
+
1299
+ // src/grid/grid-idle.ts
1300
+ var liveGrids = new Set;
1301
+ function registerGridProbe(probe) {
1302
+ liveGrids.add(probe);
1303
+ return () => liveGrids.delete(probe);
1304
+ }
1305
+ function gridIdleBlockers() {
1306
+ const blockers = [];
1307
+ for (const probe of liveGrids) {
1308
+ try {
1309
+ const reason = probe();
1310
+ if (reason) {
1311
+ blockers.push(reason);
1312
+ }
1313
+ } catch {}
1314
+ }
1315
+ return blockers;
1316
+ }
1317
+
1318
+ // src/services/idle.ts
1319
+ var QUIET_FRAMES = 2;
1320
+ var DEFAULT_IDLE_TIMEOUT_MS = 1e4;
1321
+
1322
+ class NotIdleError extends Error {
1323
+ blockedBy;
1324
+ constructor(blockedBy, timeoutMs) {
1325
+ super(blockedBy.length === 0 ? `Studio did not report ${QUIET_FRAMES} consecutive quiet frames within ${timeoutMs}ms` : `Studio was not idle after ${timeoutMs}ms — blocked by ${blockedBy.join("; ")}`);
1326
+ this.name = "NotIdleError";
1327
+ this.blockedBy = blockedBy;
1328
+ }
1329
+ }
1330
+ function defaultIdleSources() {
1331
+ return [
1332
+ {
1333
+ blockers: () => {
1334
+ const count = rendersInFlight();
1335
+ return count > 0 ? [`render: ${count} renderer(s) mid-paint`] : [];
1336
+ },
1337
+ name: "render"
1338
+ },
1339
+ { blockers: canvasIdleBlockers2, name: "canvas" },
1340
+ {
1341
+ blockers: () => {
1342
+ const calls = platformInFlight2();
1343
+ if (calls.length === 0) {
1344
+ return [];
1345
+ }
1346
+ return [`platform: ${calls.length} in-flight (${[...new Set(calls)].join(", ")})`];
1347
+ },
1348
+ name: "platform"
1349
+ },
1350
+ { blockers: overlayIdleBlockers2, name: "overlay" },
1351
+ { blockers: activityIdleBlockers, name: "activity" },
1352
+ { blockers: gridIdleBlockers, name: "grid" }
1353
+ ];
1354
+ }
1355
+ function idleBlockers(sources = defaultIdleSources()) {
1356
+ const blockers = [];
1357
+ for (const source of sources) {
1358
+ blockers.push(...source.blockers());
1359
+ }
1360
+ return blockers;
1361
+ }
1362
+ function probeIdle(options = {}) {
1363
+ const {
1364
+ frames = QUIET_FRAMES,
1365
+ now = () => Date.now(),
1366
+ raf = (callback) => {
1367
+ requestAnimationFrame(() => callback());
1368
+ },
1369
+ sources = defaultIdleSources(),
1370
+ timeoutMs = DEFAULT_IDLE_TIMEOUT_MS
1371
+ } = options;
1372
+ return new Promise((resolve, reject) => {
1373
+ const deadline = now() + timeoutMs;
1374
+ let quiet = 0;
1375
+ let settled = false;
1376
+ let lastBlockers = [];
1377
+ const tick = () => {
1378
+ if (settled) {
1379
+ return;
1380
+ }
1381
+ const blockers = idleBlockers(sources);
1382
+ if (blockers.length > 0) {
1383
+ lastBlockers = blockers;
1384
+ quiet = 0;
1385
+ } else {
1386
+ quiet += 1;
1387
+ if (quiet >= frames) {
1388
+ settled = true;
1389
+ resolve();
1390
+ return;
1391
+ }
1392
+ }
1393
+ if (now() >= deadline) {
1394
+ settled = true;
1395
+ reject(new NotIdleError(blockers.length > 0 ? blockers : lastBlockers, timeoutMs));
1396
+ return;
1397
+ }
1398
+ raf(tick);
1399
+ };
1400
+ raf(tick);
1401
+ });
1402
+ }
1403
+
1404
+ // src/services/automation.ts
1405
+ var TOGGLE_ID = /\.toggle[A-Z]/;
1406
+ function setterFor(id) {
1407
+ return id.replace(/\.toggle([A-Z])/, (_match, initial) => `.set${initial}`);
1408
+ }
1409
+ function isScriptable(command) {
1410
+ return !TOGGLE_ID.test(command.id);
1411
+ }
1412
+ var AUTOMATION_COMMANDS = {
1413
+ "file.contextMenu": {
1414
+ disposition: "refused",
1415
+ note: "opening a menu to press an item names a control; the ITEM is the command"
1416
+ },
1417
+ "layers.contextMenu": {
1418
+ disposition: "refused",
1419
+ note: "matched RENDERED TEXT, which §13's R1 forbids; P5.5 stamps data-jx-path on rows"
1420
+ },
1421
+ "media.browse": { disposition: "command", note: "P7.5 — media.browse" },
1422
+ "project.showWelcome": {
1423
+ disposition: "refused",
1424
+ note: "cold start is a startup profile (?profile=fresh), not an action"
1425
+ },
1426
+ "settings.setSection": {
1427
+ disposition: "refused",
1428
+ note: `mirrored the section registry's LABELS; say settings.open { section: "cssVars" }`
1429
+ },
1430
+ "view.setStatus": {
1431
+ disposition: "refused",
1432
+ note: "the status bar is not staged — if a capture needs a calm shell, the app must BE calm"
1433
+ }
1434
+ };
1435
+ var REFUSED_SEEDS = {
1436
+ openSettings: 'a user opens Settings — run("settings.open")',
1437
+ select: 'a user selects a node — run("selection.set", { path })',
1438
+ setActivity: 'a user picks a Navigator panel — run("navigator.showPanel", { panel })',
1439
+ setRightTab: 'a user picks an Inspector tab — run("inspector.setTab", { tab })',
1440
+ setStatus: "the status bar reports what the app just did; staging it is the one lie §13.3 names outright",
1441
+ setZoom: 'a user zooms — run("canvas.setZoom", { zoom })'
1442
+ };
1443
+ function arrayArg(args, key) {
1444
+ const value = args[key];
1445
+ if (value === undefined) {
1446
+ return [];
1447
+ }
1448
+ if (!Array.isArray(value)) {
1449
+ throw new TypeError(`seed argument "${key}" must be an array`);
1450
+ }
1451
+ return value;
1452
+ }
1453
+ function requiredArg(args, key) {
1454
+ const value = args[key];
1455
+ if (value === null || typeof value !== "object") {
1456
+ throw new TypeError(`seed argument "${key}" must be an object`);
1457
+ }
1458
+ return value;
1459
+ }
1460
+ function optionalString(args, key) {
1461
+ const value = args[key];
1462
+ if (value === undefined) {
1463
+ return;
1464
+ }
1465
+ if (typeof value !== "string") {
1466
+ throw new TypeError(`seed argument "${key}" must be a string`);
1467
+ }
1468
+ return value;
1469
+ }
1470
+ function createSeeds(deps) {
1471
+ return [
1472
+ {
1473
+ boundary: "the assistant's model stream",
1474
+ id: "seed.assistant",
1475
+ run: (args) => {
1476
+ deps.seedAssistantMessages(arrayArg(args, "messages"));
1477
+ }
1478
+ },
1479
+ {
1480
+ boundary: "the collaboration websocket (awareness + sync)",
1481
+ id: "seed.collab",
1482
+ run: (args) => {
1483
+ const tab = activeTab2.value;
1484
+ if (!tab) {
1485
+ return;
1486
+ }
1487
+ const state = collabState(tab);
1488
+ state.status = "synced";
1489
+ state.active = true;
1490
+ const peers = [];
1491
+ for (const peer of arrayArg(args, "peers")) {
1492
+ const peerState = { ...peer.state };
1493
+ peerState.focusedPath ??= tab.documentPath;
1494
+ peers.push({ ...peer, state: peerState });
1495
+ }
1496
+ state.peers = peers;
1497
+ render3();
1498
+ }
1499
+ },
1500
+ {
1501
+ boundary: "the Cloudflare Pages API",
1502
+ id: "seed.publish",
1503
+ run: (args) => {
1504
+ const accountId = optionalString(args, "accountId");
1505
+ deps.seedPublishConnected({
1506
+ deployment: requiredArg(args, "deployment"),
1507
+ ...accountId ? { accountId } : {}
1508
+ });
1509
+ }
1510
+ },
1511
+ {
1512
+ boundary: "the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",
1513
+ id: "seed.git",
1514
+ run: (args) => {
1515
+ shell.git.status = args.status ?? null;
1516
+ shell.git.branches = args.branches ?? null;
1517
+ shell.git.logEntries = args.log ?? null;
1518
+ shell.git.loading = false;
1519
+ shell.git.error = null;
1520
+ render3();
1521
+ }
1522
+ },
1523
+ {
1524
+ boundary: "the platform's recent-projects store (desktop IPC / cloud API)",
1525
+ id: "seed.projectList",
1526
+ run: (args) => {
1527
+ seedProjectList(arrayArg(args, "projects"));
1528
+ render3();
1529
+ }
1530
+ }
1531
+ ];
1532
+ }
1533
+ class AutomationRefusedError extends Error {
1534
+ id;
1535
+ constructor(id, reason) {
1536
+ super(`automation refuses "${id}" — ${reason}`);
1537
+ this.name = "AutomationRefusedError";
1538
+ this.id = id;
1539
+ }
1540
+ }
1541
+ function scriptableCommands(registry) {
1542
+ const projected = [];
1543
+ for (const command of registry.visible()) {
1544
+ if (!isScriptable(command)) {
1545
+ continue;
1546
+ }
1547
+ const requires = registry.disabledReason(command.id);
1548
+ const entry = {
1549
+ enabled: requires === undefined,
1550
+ id: command.id,
1551
+ title: command.title
1552
+ };
1553
+ if (command.args) {
1554
+ entry.args = command.args;
1555
+ }
1556
+ if (requires !== undefined) {
1557
+ entry.requires = requires;
1558
+ }
1559
+ projected.push(entry);
1560
+ }
1561
+ return projected;
1562
+ }
1563
+ function unknownCommandMessage(id, registry, seeds) {
1564
+ if (seeds.has(id)) {
1565
+ return `"${id}" is a seed, not a command — call seed("${id}", …)`;
1566
+ }
1567
+ const gap = AUTOMATION_COMMANDS[id];
1568
+ if (gap?.disposition === "refused") {
1569
+ return `"${id}" is refused by spec §13.5: ${gap.note}`;
1570
+ }
1571
+ if (gap) {
1572
+ return `"${id}" has no command record yet (${gap.note}) — __jxAutomation.run projects the registry and nothing else`;
1573
+ }
1574
+ const known = registry.list().filter((command) => isScriptable(command)).map((command) => command.id);
1575
+ return `unknown command "${id}" — the registry declares ${known.length} scriptable id(s)`;
1576
+ }
1577
+ function createAutomationApi(deps) {
1578
+ const seeds = new Map(createSeeds(deps).map((seed) => [seed.id, seed]));
1579
+ const seedIdSet = new Set(seeds.keys());
1580
+ return {
1581
+ probe: {
1582
+ commands: () => scriptableCommands(deps.registry),
1583
+ idle: (options = {}) => probeIdle(options),
1584
+ pointAt: (target) => canvasPointAt2(target.path),
1585
+ revealPath: (path) => revealCanvasPath2(path),
1586
+ seeds: () => [...seeds.values()].map((seed) => ({ boundary: seed.boundary, id: seed.id })),
1587
+ state: () => deps.registry.context()
1588
+ },
1589
+ async run(id, args = {}) {
1590
+ if (TOGGLE_ID.test(id)) {
1591
+ throw new AutomationRefusedError(id, `it names a delta against state the caller cannot observe; call "${setterFor(id)}"`);
1592
+ }
1593
+ const { registry } = deps;
1594
+ if (!registry.get(id)) {
1595
+ throw new Error(unknownCommandMessage(id, registry, seedIdSet));
1596
+ }
1597
+ await registry.run(id, args);
1598
+ },
1599
+ async seed(id, args = {}) {
1600
+ const bare = id.startsWith("seed.") ? id.slice(5) : id;
1601
+ const refusal = REFUSED_SEEDS[bare];
1602
+ if (refusal) {
1603
+ throw new AutomationRefusedError(id, `a seed stands in for a remote, never for a user: ${refusal}`);
1604
+ }
1605
+ const seed = seeds.get(id.startsWith("seed.") ? id : `seed.${id}`);
1606
+ if (!seed) {
1607
+ throw new Error(`unknown seed "${id}" — declared seeds are ${[...seeds.keys()].join(", ")}`);
1608
+ }
1609
+ await seed.run(args);
1610
+ }
1611
+ };
1612
+ }
1613
+ function shouldInstallAutomation(search) {
1614
+ return new URLSearchParams(search).get("automation") === "1";
1615
+ }
1616
+ function installAutomationHook(deps) {
1617
+ if (!shouldInstallAutomation(location.search)) {
1618
+ return false;
1619
+ }
1620
+ globalThis.__jxAutomation = createAutomationApi(deps);
1621
+ return true;
1622
+ }
1623
+ // src/surfaces/jxsuite-update.json
1624
+ var jxsuite_update_default = {
1625
+ $schema: "https://jxsuite.com/schema/v1",
1626
+ $id: "StudioJxsuiteUpdate",
1627
+ $description: "The on-open offer to bring a project's `@jxsuite/*` dependencies up to their newest published versions: one sentence, and the packages that would move. A `jx-dialog`, so the platform owns modality, Escape, focus restoration and the backdrop, and the kit draws both answers. Nothing here asks the registry or writes a manifest: `packages/jxsuite-update.ts` keeps the lookup, the dismissal key and the install, and this document only says what is on offer.",
1628
+ tagName: "jx-dialog",
1629
+ $props: {
1630
+ headline: "Update @jxsuite packages?",
1631
+ confirmLabel: "Update",
1632
+ cancelLabel: "Not now",
1633
+ size: "sm"
1634
+ },
1635
+ attributes: {
1636
+ part: "jxsuite-update"
1637
+ },
1638
+ onconfirm: {
1639
+ $prototype: "Function",
1640
+ body: [
1641
+ {
1642
+ operator: "call",
1643
+ target: {
1644
+ $ref: "#/state/confirm"
1645
+ },
1646
+ value: []
1647
+ }
1648
+ ]
1649
+ },
1650
+ oncancel: {
1651
+ $prototype: "Function",
1652
+ body: [
1653
+ {
1654
+ operator: "call",
1655
+ target: {
1656
+ $ref: "#/state/cancel"
1657
+ },
1658
+ value: []
1659
+ }
1660
+ ]
1661
+ },
1662
+ onclose: {
1663
+ $prototype: "Function",
1664
+ body: [
1665
+ {
1666
+ operator: "call",
1667
+ target: {
1668
+ $ref: "#/state/closed"
1669
+ },
1670
+ value: []
1671
+ }
1672
+ ]
1673
+ },
1674
+ style: {
1675
+ $description: 'The old body was a lit template with no stylesheet at all, which is why the conversion is mostly a deletion. Two `<br />`s stood in for a paragraph break, and one `<span style="white-space: pre-line">` held every package as a single `\\n`-joined string — a list spelled as whitespace. Neither is addressable and neither announces as what it is, so a screen reader read one run-on line and a test could only match a substring of it. It is a `<ul>` of keyed rows now: the list says how many packages there are, and each row is `[data-package]`. The one token repair travels with it — that span asked for `--spectrum-font-size-75`, which resolves only inside `<sp-theme>`, and a document mounted in the dialog layer is outside it, so the size silently fell back to the hard-coded `12px` written beside it.',
1676
+ '& [part="offer"]': {
1677
+ display: "flex",
1678
+ flexDirection: "column",
1679
+ gap: "var(--jx-space-3)"
1680
+ },
1681
+ '& [part="lede"]': {
1682
+ margin: "0"
1683
+ },
1684
+ '& [part="list"]': {
1685
+ $description: "Capped and scrolling, because the count is the registry's rather than this dialog's: a project that has not been opened in a year can have every `@jxsuite/*` package behind at once, and a dialog that grows past the viewport puts its own Update button off screen.",
1686
+ listStyle: "none",
1687
+ margin: "0",
1688
+ padding: "0",
1689
+ display: "flex",
1690
+ flexDirection: "column",
1691
+ gap: "var(--jx-space-1)",
1692
+ maxHeight: "240px",
1693
+ overflowY: "auto"
1694
+ },
1695
+ '& [part="package"]': {
1696
+ display: "flex",
1697
+ justifyContent: "space-between",
1698
+ alignItems: "baseline",
1699
+ gap: "var(--jx-space-3)",
1700
+ fontSize: "var(--jx-text-sm)"
1701
+ },
1702
+ '& [part="package-name"]': {
1703
+ color: "var(--fg)"
1704
+ },
1705
+ '& [part="package-move"]': {
1706
+ $description: "Tabular figures, so a column of versions does not jitter between rows of different widths.",
1707
+ color: "var(--fg-dim)",
1708
+ fontVariantNumeric: "tabular-nums",
1709
+ whiteSpace: "nowrap"
1710
+ }
1711
+ },
1712
+ children: [
1713
+ {
1714
+ tagName: "div",
1715
+ attributes: {
1716
+ part: "offer"
1717
+ },
1718
+ children: [
1719
+ {
1720
+ tagName: "p",
1721
+ attributes: {
1722
+ part: "lede"
1723
+ },
1724
+ textContent: "Newer versions of these packages have been published. Update the project to them?"
1725
+ },
1726
+ {
1727
+ tagName: "ul",
1728
+ attributes: {
1729
+ part: "list"
1730
+ },
1731
+ children: [
1732
+ {
1733
+ $prototype: "Array",
1734
+ items: {
1735
+ $ref: "#/state/packages"
1736
+ },
1737
+ key: {
1738
+ $ref: "$map/item/name"
1739
+ },
1740
+ map: {
1741
+ tagName: "li",
1742
+ attributes: {
1743
+ part: "package",
1744
+ "data-package": "${$map.item.name}"
1745
+ },
1746
+ children: [
1747
+ {
1748
+ tagName: "span",
1749
+ attributes: {
1750
+ part: "package-name"
1751
+ },
1752
+ textContent: "${$map.item.name}"
1753
+ },
1754
+ {
1755
+ tagName: "span",
1756
+ attributes: {
1757
+ part: "package-move"
1758
+ },
1759
+ textContent: "${$map.item.current} → ${$map.item.target}"
1760
+ }
1761
+ ]
1762
+ }
1763
+ }
1764
+ ]
1765
+ }
1766
+ ]
1767
+ }
1768
+ ]
1769
+ };
1770
+
1771
+ // src/surfaces/jxsuite-update.ts
1772
+ registerSurface("jxsuite-update", jxsuite_update_default);
1773
+ function openJxsuiteUpdateSurface(options) {
1774
+ const slot = document.createElement("div");
1775
+ slot.style.pointerEvents = "auto";
1776
+ slot.setAttribute(REGION_ATTR, overlayRegion("dialog", "jxsuite-update"));
1777
+ options.layer.append(slot);
1778
+ let closed = false;
1779
+ const finish = () => {
1780
+ if (closed) {
1781
+ return;
1782
+ }
1783
+ closed = true;
1784
+ options.onClosed();
1785
+ };
1786
+ const scope = reactive({
1787
+ cancel: () => {
1788
+ options.onCancel();
1789
+ },
1790
+ closed: finish,
1791
+ confirm: () => {
1792
+ options.onConfirm();
1793
+ },
1794
+ packages: options.packages
1795
+ });
1796
+ let mounted = null;
1797
+ const ready = mountSurface("jxsuite-update", scope, slot).then(async (surface) => {
1798
+ mounted = surface;
1799
+ const element = surface.root;
1800
+ if (closed) {
1801
+ surface.dispose();
1802
+ return element;
1803
+ }
1804
+ await whenReady(element);
1805
+ if (closed) {
1806
+ return element;
1807
+ }
1808
+ showModal(element);
1809
+ return element;
1810
+ });
1811
+ return {
1812
+ close() {
1813
+ const element = mounted?.root;
1814
+ if (element instanceof HTMLElement) {
1815
+ close2(element);
1816
+ }
1817
+ mounted?.dispose();
1818
+ mounted = null;
1819
+ slot.remove();
1820
+ finish();
1821
+ },
1822
+ host: slot,
1823
+ ready
1824
+ };
1825
+ }
1826
+
1827
+ // src/packages/semver.ts
1828
+ function stripRange(range) {
1829
+ const base = range.replace(/^[\^~>=<v\s]+/, "").trim();
1830
+ return base.split(/\s+/)[0] ?? "";
1831
+ }
1832
+ function isComparable(spec) {
1833
+ if (spec.includes(":")) {
1834
+ return false;
1835
+ }
1836
+ return /^\d+\.\d+/.test(stripRange(spec));
1837
+ }
1838
+ function parts(version) {
1839
+ const core = stripRange(version).split(/[-+]/)[0] ?? "";
1840
+ const [major = 0, minor = 0, patch = 0] = core.split(".").map((n) => Math.trunc(Number(n)) || 0);
1841
+ return [major, minor, patch];
1842
+ }
1843
+ function compareSemver(a, b) {
1844
+ const pa = parts(a);
1845
+ const pb = parts(b);
1846
+ for (let i = 0;i < 3; i++) {
1847
+ const da = pa[i] ?? 0;
1848
+ const db = pb[i] ?? 0;
1849
+ if (da !== db) {
1850
+ return da < db ? -1 : 1;
1851
+ }
1852
+ }
1853
+ return 0;
1854
+ }
1855
+ function isUpgrade(current, latest) {
1856
+ if (!isComparable(current) || !isComparable(latest)) {
1857
+ return false;
1858
+ }
1859
+ return compareSemver(latest, current) > 0;
1860
+ }
1861
+
1862
+ // src/packages/jxsuite-update.ts
1863
+ var JXSUITE_PREFIX = "@jxsuite/";
1864
+ async function checkJxsuiteUpdate() {
1865
+ const platform = getPlatform2();
1866
+ if (!platform.packageVersions) {
1867
+ return [];
1868
+ }
1869
+ let reported;
1870
+ try {
1871
+ reported = await platform.packageVersions();
1872
+ } catch {
1873
+ return [];
1874
+ }
1875
+ const outdated = [];
1876
+ for (const p of reported) {
1877
+ if (p.name.startsWith(JXSUITE_PREFIX) && isUpgrade(p.current, p.latest)) {
1878
+ outdated.push({ current: p.current, dev: Boolean(p.dev), latest: p.latest, name: p.name });
1879
+ }
1880
+ }
1881
+ return outdated;
1882
+ }
1883
+ function dismissKey(root, outdated) {
1884
+ const signature = outdated.map((p) => `${p.name}@${p.latest}`).toSorted().join(",");
1885
+ return `jx:jxsuite-update-dismissed:${root}:${signature}`;
1886
+ }
1887
+ function isDismissed(root, outdated) {
1888
+ try {
1889
+ return localStorage.getItem(dismissKey(root, outdated)) === "1";
1890
+ } catch {
1891
+ return false;
1892
+ }
1893
+ }
1894
+ function setDismissed(root, outdated) {
1895
+ try {
1896
+ localStorage.setItem(dismissKey(root, outdated), "1");
1897
+ } catch {}
1898
+ }
1899
+ async function applyJxsuiteUpdate(outdated) {
1900
+ const platform = getPlatform2();
1901
+ if (!platform.setPackageVersions || outdated.length === 0) {
1902
+ return;
1903
+ }
1904
+ const progress = showProgressModal({
1905
+ status: "Updating @jxsuite packages…",
1906
+ title: "Updating dependencies"
1907
+ });
1908
+ try {
1909
+ const result = await platform.setPackageVersions(outdated.map((p) => ({ dev: p.dev, name: p.name, version: `^${p.latest}` })));
1910
+ if (result.ok) {
1911
+ progress.done();
1912
+ notify2.success(`Updated ${outdated.length} @jxsuite package(s) to their latest versions.`);
1913
+ } else {
1914
+ progress.fail(result.log ?? "Update failed");
1915
+ }
1916
+ } catch (error) {
1917
+ progress.fail(error instanceof Error ? error.message : String(error));
1918
+ }
1919
+ }
1920
+ function askToUpdate(outdated) {
1921
+ return new Promise((resolve) => {
1922
+ let answered = false;
1923
+ const settle = (value) => {
1924
+ if (answered) {
1925
+ return;
1926
+ }
1927
+ answered = true;
1928
+ resolve(value);
1929
+ };
1930
+ let closing = false;
1931
+ const takeDown = () => {
1932
+ if (closing) {
1933
+ return;
1934
+ }
1935
+ closing = true;
1936
+ handle.close();
1937
+ };
1938
+ const handle = openJxsuiteUpdateSurface({
1939
+ layer: layerHost2("dialog"),
1940
+ onCancel: () => {
1941
+ takeDown();
1942
+ },
1943
+ onClosed: () => {
1944
+ settle(false);
1945
+ takeDown();
1946
+ },
1947
+ onConfirm: () => {
1948
+ settle(true);
1949
+ takeDown();
1950
+ },
1951
+ packages: outdated.map((p) => ({
1952
+ current: p.current,
1953
+ name: p.name,
1954
+ target: `^${p.latest}`
1955
+ }))
1956
+ });
1957
+ });
1958
+ }
1959
+ async function maybePromptJxsuiteUpdate(projectRoot) {
1960
+ if (shouldInstallAutomation(location.search)) {
1961
+ return;
1962
+ }
1963
+ const platform = getPlatform2();
1964
+ if (!platform.setPackageVersions) {
1965
+ return;
1966
+ }
1967
+ const outdated = await checkJxsuiteUpdate();
1968
+ if (outdated.length === 0 || isDismissed(projectRoot, outdated)) {
1969
+ return;
1970
+ }
1971
+ const confirmed = await askToUpdate(outdated);
1972
+ if (!confirmed) {
1973
+ setDismissed(projectRoot, outdated);
1974
+ return;
1975
+ }
1976
+ await applyJxsuiteUpdate(outdated);
1977
+ }
1978
+
1979
+ // src/packages/pull-package-sync.ts
1980
+ var PKG_PATHS = ["package.json", "bun.lock", "bun.lockb"];
1981
+ var UNTRACKED_STATUSES = new Set(["??", "U"]);
1982
+ var MAX_CONFLICT_SCAN = 25;
1983
+ var JXSUITE_PREFIX2 = "@jxsuite/";
1984
+ function isRecord(value) {
1985
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1986
+ }
1987
+ function sortKeys(value) {
1988
+ if (Array.isArray(value)) {
1989
+ return value.map((entry) => sortKeys(entry));
1990
+ }
1991
+ if (isRecord(value)) {
1992
+ const out = {};
1993
+ for (const key of Object.keys(value).toSorted()) {
1994
+ out[key] = sortKeys(value[key]);
1995
+ }
1996
+ return out;
1997
+ }
1998
+ return value;
1999
+ }
2000
+ function maskJxsuiteVersions(pkg) {
2001
+ const out = { ...pkg };
2002
+ for (const section of ["dependencies", "devDependencies"]) {
2003
+ const deps = out[section];
2004
+ if (!isRecord(deps)) {
2005
+ continue;
2006
+ }
2007
+ const masked = { ...deps };
2008
+ for (const name of Object.keys(masked)) {
2009
+ if (name.startsWith(JXSUITE_PREFIX2)) {
2010
+ masked[name] = "*";
2011
+ }
2012
+ }
2013
+ out[section] = masked;
2014
+ }
2015
+ return out;
2016
+ }
2017
+ function isAutomatedPackageDiff(headText, workingText) {
2018
+ if (headText === null || workingText === null) {
2019
+ return false;
2020
+ }
2021
+ let head;
2022
+ let working;
2023
+ try {
2024
+ head = JSON.parse(headText);
2025
+ working = JSON.parse(workingText);
2026
+ } catch {
2027
+ return false;
2028
+ }
2029
+ if (!isRecord(head) || !isRecord(working)) {
2030
+ return false;
2031
+ }
2032
+ return JSON.stringify(sortKeys(maskJxsuiteVersions(head))) === JSON.stringify(sortKeys(maskJxsuiteVersions(working)));
2033
+ }
2034
+ async function tryShow(path, ref) {
2035
+ try {
2036
+ return await getPlatform2().gitShow({ path, ref });
2037
+ } catch {
2038
+ return null;
2039
+ }
2040
+ }
2041
+ async function tryRead(path) {
2042
+ try {
2043
+ return await getPlatform2().readFile(path);
2044
+ } catch {
2045
+ return null;
2046
+ }
2047
+ }
2048
+ async function planPackageDiscard(status) {
2049
+ const discard = [];
2050
+ const removeUntracked = [];
2051
+ let automated = true;
2052
+ for (const path of PKG_PATHS) {
2053
+ const entries = status.files.filter((f) => f.path === path);
2054
+ if (entries.length === 0) {
2055
+ continue;
2056
+ }
2057
+ const upstream = await tryShow(path, "@{u}");
2058
+ if (entries.every((f) => UNTRACKED_STATUSES.has(f.status))) {
2059
+ if (upstream !== null) {
2060
+ removeUntracked.push(path);
2061
+ }
2062
+ continue;
2063
+ }
2064
+ const head = await tryShow(path, "HEAD");
2065
+ if (upstream === null || upstream === head) {
2066
+ continue;
2067
+ }
2068
+ discard.push(path);
2069
+ if (path === "package.json") {
2070
+ automated &&= isAutomatedPackageDiff(head, await tryRead(path));
2071
+ }
2072
+ }
2073
+ return { automated, discard, removeUntracked };
2074
+ }
2075
+ function planIsEmpty(plan) {
2076
+ return plan.discard.length === 0 && plan.removeUntracked.length === 0;
2077
+ }
2078
+ async function otherFilesConflict(status) {
2079
+ const paths = [
2080
+ ...new Set(status.files.filter((f) => !PKG_PATHS.includes(f.path)).map((f) => f.path))
2081
+ ];
2082
+ if (paths.length > MAX_CONFLICT_SCAN) {
2083
+ return true;
2084
+ }
2085
+ for (const path of paths) {
2086
+ const upstream = await tryShow(path, "@{u}");
2087
+ if (upstream !== null && upstream !== await tryShow(path, "HEAD")) {
2088
+ return true;
2089
+ }
2090
+ }
2091
+ return false;
2092
+ }
2093
+ async function applyDiscard(plan) {
2094
+ const platform = getPlatform2();
2095
+ if (plan.discard.length > 0) {
2096
+ await platform.gitUnstage(plan.discard);
2097
+ await platform.gitDiscard(plan.discard);
2098
+ }
2099
+ for (const path of plan.removeUntracked) {
2100
+ await platform.deleteFile(path);
2101
+ }
2102
+ }
2103
+ async function syncPackagesAfterPull() {
2104
+ const platform = getPlatform2();
2105
+ let outdated = [];
2106
+ try {
2107
+ outdated = await checkJxsuiteUpdate();
2108
+ } catch {
2109
+ outdated = [];
2110
+ }
2111
+ if (outdated.length > 0 && platform.setPackageVersions) {
2112
+ await applyJxsuiteUpdate(outdated);
2113
+ return;
2114
+ }
2115
+ if (!platform.installDependencies) {
2116
+ return;
2117
+ }
2118
+ const progress = showProgressModal({
2119
+ status: "Running bun install…",
2120
+ title: "Syncing dependencies"
2121
+ });
2122
+ try {
2123
+ const result = await platform.installDependencies();
2124
+ if (result.ok) {
2125
+ progress.done();
2126
+ } else {
2127
+ progress.fail(result.log ?? "bun install failed");
2128
+ }
2129
+ } catch (error) {
2130
+ progress.fail(errorMessage2(error));
2131
+ }
2132
+ }
2133
+ async function discardPullAndSync(plan) {
2134
+ const platform = getPlatform2();
2135
+ try {
2136
+ await applyDiscard(plan);
2137
+ } catch (error) {
2138
+ throw new Error(`Could not reset local package files: ${errorMessage2(error)}`, {
2139
+ cause: error
2140
+ });
2141
+ }
2142
+ try {
2143
+ await platform.gitPull();
2144
+ } catch (error) {
2145
+ await syncPackagesAfterPull();
2146
+ throw error;
2147
+ }
2148
+ notify2.warn("Local package updates were superseded by pulled changes.", {
2149
+ source: "Source Control"
2150
+ });
2151
+ await syncPackagesAfterPull();
2152
+ }
2153
+ async function recoverAfterFailedPull(original) {
2154
+ const platform = getPlatform2();
2155
+ let status;
2156
+ try {
2157
+ status = await platform.gitStatus();
2158
+ } catch {
2159
+ throw original;
2160
+ }
2161
+ if (!(status.behind > 0)) {
2162
+ throw original;
2163
+ }
2164
+ const plan = await planPackageDiscard(status);
2165
+ if (planIsEmpty(plan) || await otherFilesConflict(status)) {
2166
+ throw original;
2167
+ }
2168
+ if (!plan.automated) {
2169
+ const confirmed = await showConfirmDialog2("Discard local package changes?", "package.json / bun.lock have local edits that conflict with incoming changes. Discard them, pull, and re-sync packages?", { confirmLabel: "Discard and pull", destructive: true });
2170
+ if (!confirmed) {
2171
+ throw original;
2172
+ }
2173
+ }
2174
+ await discardPullAndSync(plan);
2175
+ }
2176
+ async function snapshotPackageFiles() {
2177
+ let present;
2178
+ try {
2179
+ const entries = await getPlatform2().listDirectory("");
2180
+ present = new Set(entries.filter((e) => e.type === "file").map((e) => e.name));
2181
+ } catch {
2182
+ present = new Set(PKG_PATHS);
2183
+ }
2184
+ return Promise.all(PKG_PATHS.map((path) => present.has(path) ? tryRead(path) : Promise.resolve(null)));
2185
+ }
2186
+ async function pullWithPackageSync() {
2187
+ const platform = getPlatform2();
2188
+ const before = await snapshotPackageFiles();
2189
+ let status = null;
2190
+ try {
2191
+ await platform.gitFetch();
2192
+ status = await platform.gitStatus();
2193
+ } catch {
2194
+ status = null;
2195
+ }
2196
+ if (status && status.behind > 0) {
2197
+ const plan = await planPackageDiscard(status);
2198
+ if (!planIsEmpty(plan) && plan.automated) {
2199
+ await discardPullAndSync(plan);
2200
+ return;
2201
+ }
2202
+ }
2203
+ try {
2204
+ await platform.gitPull();
2205
+ } catch (error) {
2206
+ await recoverAfterFailedPull(error);
2207
+ return;
2208
+ }
2209
+ const after = await snapshotPackageFiles();
2210
+ if (before.some((content, i) => content !== after[i])) {
2211
+ await syncPackagesAfterPull();
2212
+ }
2213
+ }
2214
+ async function autoSyncProjectOnOpen() {
2215
+ const platform = getPlatform2();
2216
+ let status;
2217
+ try {
2218
+ status = await platform.gitStatus();
2219
+ } catch {
2220
+ return;
2221
+ }
2222
+ if (!status?.isRepo || (status.remotes?.length ?? 0) === 0) {
2223
+ return;
2224
+ }
2225
+ notify2.info("Syncing project…", { key: "project.sync", source: "Source Control" });
2226
+ try {
2227
+ await pullWithPackageSync();
2228
+ } catch (error) {
2229
+ notify2.warn("The project could not be synced with its remote.", {
2230
+ detail: errorMessage2(error),
2231
+ key: "project.sync",
2232
+ source: "Source Control",
2233
+ tier: "problem"
2234
+ });
2235
+ }
2236
+ }
2237
+ // src/surfaces/git-panel.json
2238
+ var git_panel_default = {
2239
+ $schema: "https://jxsuite.com/schema/v1",
2240
+ $id: "StudioPanelGit",
2241
+ $description: "The Navigator's Source Control panel: what git says about this project, and every verb that answers. It has four moods and the adapter names which one — no project, a first read still in flight, a project git is not tracking yet, and a repository — so nothing here asks whether `status` is null or what `isRepo` means. Under the fourth mood it draws the sync bar (with or without a remote), the branch row, the two sub-tabs, and then either the commit form over the changed files or the log. `panels/git-panel.ts` keeps every decision: what a comparison is, which files group under which component, what a status letter reads aloud, what a commit does before it runs, and which of the four verbs a row's buttons are. Rows arrive as strings and booleans, keyed by path.",
2242
+ tagName: "div",
2243
+ attributes: {
2244
+ part: "git-panel"
2245
+ },
2246
+ style: {
2247
+ $description: "The sixty-odd `.git-*` rules in `styles/overlays.css`, keyed on `part` and carried here. Four token repairs travel with them, all of the shape `surfaces/panel-imports.json` describes: `--spectrum-font-size-75` and `--spectrum-font-size-50` resolved only inside `<sp-theme>` and a document is mounted outside it, so every rule that read one would silently have taken its px fallback — they are `--jx-text-md` (12px) and `--jx-text-sm` (11px) here, at the same values, and the bare `10px` literals are `--jx-text-xs`. The one deliberate move is the two headline values, the sync label and the branch name: they were 13px, which is not a step on the scale, and they take `--jx-text-lg` (14px). Three rules are DELETED rather than moved, because the kit already draws them: the sub-tab strip's own fill, hover and selected underline are `jx-tabs`/`jx-tab`, the branch picker's box is `jx-select`, and `.git-split-btn`'s hand-built dropdown is the kit menu (see `openCommitMenu`). And one is repaired: a row's action buttons were `opacity: 0` until the ROW was hovered, so tabbing to Stage moved the keyboard onto an invisible control — the reveal is `:focus-within` as well as `:hover`.",
2248
+ display: "flex",
2249
+ flexDirection: "column",
2250
+ height: "100%",
2251
+ fontFamily: "var(--jx-font-sans)",
2252
+ fontSize: "var(--jx-text-md)",
2253
+ color: "var(--fg)",
2254
+ '& [part="empty"]': {
2255
+ $description: "Drawn here rather than borrowed from `panels/empty-state.ts`, which is a lit template a document cannot call. What is kept is the pattern's rules (§11): one sentence saying what the region is for, then the action that fills it.",
2256
+ display: "flex",
2257
+ flex: "1",
2258
+ flexDirection: "column",
2259
+ alignItems: "center",
2260
+ justifyContent: "center",
2261
+ gap: "var(--jx-space-3)",
2262
+ padding: "var(--jx-space-5)",
2263
+ textAlign: "center",
2264
+ color: "var(--fg-dim)"
2265
+ },
2266
+ '& [part="empty-message"]': {
2267
+ margin: "0",
2268
+ maxWidth: "34ch",
2269
+ lineHeight: "1.5"
2270
+ },
2271
+ '& [part="empty-actions"]': {
2272
+ display: "flex",
2273
+ flexDirection: "column",
2274
+ gap: "var(--jx-space-2)"
2275
+ },
2276
+ '& [part="sync-bar"]': {
2277
+ display: "flex",
2278
+ alignItems: "center",
2279
+ gap: "var(--jx-space-4)",
2280
+ padding: "var(--jx-space-4)",
2281
+ borderBottom: "1px solid var(--border)"
2282
+ },
2283
+ '& [part="sync-bar"][data-remote="none"]': {
2284
+ gap: "var(--jx-space-3)"
2285
+ },
2286
+ '& [part="sync-text"]': {
2287
+ display: "flex",
2288
+ flex: "1",
2289
+ flexDirection: "column",
2290
+ gap: "1px",
2291
+ minWidth: "0"
2292
+ },
2293
+ '& [part="sync-label"]': {
2294
+ fontSize: "var(--jx-text-lg)",
2295
+ fontWeight: "600",
2296
+ color: "var(--fg)"
2297
+ },
2298
+ '& [part="sync-time"]': {
2299
+ fontSize: "var(--jx-text-sm)",
2300
+ color: "var(--fg-dim)"
2301
+ },
2302
+ '& [part="sync-actions"]': {
2303
+ display: "flex",
2304
+ flex: "none",
2305
+ marginLeft: "auto"
2306
+ },
2307
+ '& [part="branch-row"]': {
2308
+ display: "flex",
2309
+ alignItems: "center",
2310
+ gap: "var(--jx-space-4)",
2311
+ padding: "10px var(--jx-space-4)",
2312
+ borderBottom: "1px solid var(--border)"
2313
+ },
2314
+ '& [part="branch-icon"]': {
2315
+ $description: "The hand-drawn 18px branch SVG this panel carried is the kit's `git-branch` glyph — the same key `PanelRecord.icon` already names for this panel's rail button, so the two drawings cannot drift.",
2316
+ flex: "none",
2317
+ "--jx-icon-size": "18px",
2318
+ color: "var(--fg-dim)"
2319
+ },
2320
+ '& [part="branch-text"]': {
2321
+ display: "flex",
2322
+ flex: "1",
2323
+ flexDirection: "column",
2324
+ gap: "1px",
2325
+ minWidth: "0"
2326
+ },
2327
+ '& [part="branch-label"]': {
2328
+ fontSize: "var(--jx-text-sm)",
2329
+ color: "var(--fg-dim)"
2330
+ },
2331
+ '& [part="branch-name"]': {
2332
+ overflow: "hidden",
2333
+ fontSize: "var(--jx-text-lg)",
2334
+ fontWeight: "600",
2335
+ color: "var(--fg)",
2336
+ textOverflow: "ellipsis",
2337
+ whiteSpace: "nowrap"
2338
+ },
2339
+ '& [part="branch-picker"]': {
2340
+ flex: "none",
2341
+ maxWidth: "40%"
2342
+ },
2343
+ '& [part="commit"]': {
2344
+ display: "flex",
2345
+ flexDirection: "column",
2346
+ gap: "var(--jx-space-3)",
2347
+ padding: "var(--jx-space-4)",
2348
+ borderBottom: "1px solid var(--border)"
2349
+ },
2350
+ '& [part="commit-label"]': {
2351
+ fontWeight: "500",
2352
+ color: "var(--fg-dim)"
2353
+ },
2354
+ '& [part="commit-actions"]': {
2355
+ display: "flex",
2356
+ gap: "var(--jx-space-2)"
2357
+ },
2358
+ '& [part="commit-button"]': {
2359
+ flex: "1"
2360
+ },
2361
+ '& [part="section"]': {
2362
+ borderBottom: "1px solid var(--border)"
2363
+ },
2364
+ '& [part="section-header"]': {
2365
+ display: "flex",
2366
+ alignItems: "center",
2367
+ gap: "var(--jx-space-3)",
2368
+ padding: "var(--jx-space-3) var(--jx-space-4) 6px",
2369
+ fontWeight: "700",
2370
+ color: "var(--fg)"
2371
+ },
2372
+ '& [part="count"]': {
2373
+ $description: "The pill beside a section title. `margin-inline-end: auto` is what pushes the section's own button to the right edge — it was a second rule (`.git-section-header .git-count`) over the same element, and there is only one place a count is drawn.",
2374
+ display: "inline-flex",
2375
+ alignItems: "center",
2376
+ justifyContent: "center",
2377
+ minWidth: "18px",
2378
+ height: "18px",
2379
+ marginInlineEnd: "auto",
2380
+ padding: "0 5px",
2381
+ borderRadius: "9px",
2382
+ background: "var(--accent-15)",
2383
+ color: "var(--accent)",
2384
+ fontSize: "var(--jx-text-xs)",
2385
+ fontWeight: "600"
2386
+ },
2387
+ '& [part="group"]': {
2388
+ marginBottom: "var(--jx-space-1)"
2389
+ },
2390
+ '& [part="group-header"]': {
2391
+ display: "flex",
2392
+ alignItems: "center",
2393
+ gap: "6px",
2394
+ padding: "var(--jx-space-2) var(--jx-space-3)"
2395
+ },
2396
+ '& [part="group-name"]': {
2397
+ fontWeight: "500",
2398
+ color: "var(--fg)"
2399
+ },
2400
+ '& [part="file-row"]': {
2401
+ display: "flex",
2402
+ alignItems: "center",
2403
+ gap: "var(--jx-space-2)",
2404
+ padding: "var(--jx-space-1) var(--jx-space-3) var(--jx-space-1) var(--jx-space-5)"
2405
+ },
2406
+ '& [part="file-row"]:hover': {
2407
+ background: "var(--hover-bg)"
2408
+ },
2409
+ '& [part="file-open"]': {
2410
+ $description: "A REAL button, because it does something. It was a bare span with a cursor and a `title`: not focusable, no role, and Enter did nothing — so the panel's primary verb was mouse-only. A `<button>` needs no role, no tabindex and no key handler of its own, which is three lines of the old row that simply go.",
2411
+ display: "flex",
2412
+ flex: "1",
2413
+ alignItems: "baseline",
2414
+ gap: "6px",
2415
+ minWidth: "0",
2416
+ margin: "0",
2417
+ padding: "0",
2418
+ overflow: "hidden",
2419
+ border: "none",
2420
+ borderRadius: "var(--radius)",
2421
+ background: "none",
2422
+ color: "inherit",
2423
+ font: "inherit",
2424
+ textAlign: "left",
2425
+ cursor: "pointer",
2426
+ ":focus-visible": {
2427
+ outline: "var(--jx-focus-ring)",
2428
+ outlineOffset: "-2px"
2429
+ }
2430
+ },
2431
+ '& [part="file-name"]': {
2432
+ overflow: "hidden",
2433
+ textOverflow: "ellipsis",
2434
+ whiteSpace: "nowrap"
2435
+ },
2436
+ '& [part="file-dir"]': {
2437
+ overflow: "hidden",
2438
+ color: "var(--fg-dim)",
2439
+ fontSize: "var(--jx-text-xs)",
2440
+ textOverflow: "ellipsis",
2441
+ whiteSpace: "nowrap"
2442
+ },
2443
+ '& [part="file-actions"]': {
2444
+ $description: "Revealed on `:focus-within` as well as on the row's hover. Opacity alone hid a control the keyboard could still reach: tabbing through a changed file landed on an invisible Stage button.",
2445
+ display: "flex",
2446
+ flex: "none",
2447
+ opacity: "0"
2448
+ },
2449
+ '& [part="file-row"]:hover [part="file-actions"], & [part="file-actions"]:focus-within': {
2450
+ opacity: "1"
2451
+ },
2452
+ '& [part="badge"]': {
2453
+ $description: "One letter and a colour, which is why every row's open button carries the status in words as well.",
2454
+ flex: "none",
2455
+ width: "16px",
2456
+ color: "var(--signal)",
2457
+ fontFamily: "var(--font-mono)",
2458
+ fontSize: "var(--jx-text-xs)",
2459
+ fontWeight: "700",
2460
+ textAlign: "center"
2461
+ },
2462
+ '& [part="badge"][data-status="A"], & [part="badge"][data-status="U"]': {
2463
+ color: "var(--success)"
2464
+ },
2465
+ '& [part="badge"][data-status="D"]': {
2466
+ color: "var(--danger)"
2467
+ },
2468
+ '& [part="badge"][data-status="R"], & [part="badge"][data-status="C"]': {
2469
+ color: "var(--tag)"
2470
+ },
2471
+ '& [part="history"]': {
2472
+ flex: "1",
2473
+ overflowY: "auto",
2474
+ padding: "var(--jx-space-2) 0"
2475
+ },
2476
+ '& [part="history-list"]': {
2477
+ margin: "0",
2478
+ padding: "0",
2479
+ listStyle: "none"
2480
+ },
2481
+ '& [part="history-entry"]': {
2482
+ display: "flex",
2483
+ flexDirection: "column",
2484
+ gap: "var(--jx-space-1)",
2485
+ padding: "6px var(--jx-space-4)",
2486
+ borderBottom: "1px solid var(--border)"
2487
+ },
2488
+ '& [part="history-entry"]:hover': {
2489
+ background: "var(--hover-bg)"
2490
+ },
2491
+ '& [part="history-hash"]': {
2492
+ color: "var(--accent)",
2493
+ fontFamily: "var(--font-mono)",
2494
+ fontSize: "var(--jx-text-xs)"
2495
+ },
2496
+ '& [part="history-message"]': {
2497
+ color: "var(--fg)"
2498
+ },
2499
+ '& [part="history-meta"]': {
2500
+ color: "var(--fg-dim)",
2501
+ fontSize: "var(--jx-text-xs)"
2502
+ },
2503
+ '& [part="status"]': {
2504
+ margin: "0",
2505
+ padding: "var(--jx-space-3)",
2506
+ color: "var(--fg-dim)",
2507
+ fontSize: "var(--jx-text-sm)",
2508
+ textAlign: "center"
2509
+ },
2510
+ '& [part="error"]': {
2511
+ margin: "0",
2512
+ padding: "6px var(--jx-space-3)",
2513
+ borderBottom: "1px solid var(--border)",
2514
+ background: "color-mix(in srgb, var(--danger) 8%, transparent)",
2515
+ color: "var(--danger)",
2516
+ fontSize: "var(--jx-text-sm)"
2517
+ },
2518
+ "@(forced-colors: active)": {
2519
+ '& [part="error"]': {
2520
+ $description: "The wash behind the banner collapses into the page when every author colour is replaced, so the border is what is left to mark it.",
2521
+ border: "1px solid CanvasText",
2522
+ color: "CanvasText"
2523
+ }
2524
+ }
2525
+ },
2526
+ children: [
2527
+ {
2528
+ tagName: "div",
2529
+ attributes: {
2530
+ part: "view-slot",
2531
+ role: "none"
2532
+ },
2533
+ style: {
2534
+ display: "contents"
2535
+ },
2536
+ $switch: {
2537
+ $ref: "#/state/view"
2538
+ },
2539
+ cases: {
2540
+ "no-project": {
2541
+ tagName: "div",
2542
+ attributes: {
2543
+ part: "empty",
2544
+ "data-view": "no-project"
2545
+ },
2546
+ children: [
2547
+ {
2548
+ tagName: "p",
2549
+ attributes: {
2550
+ part: "empty-message"
2551
+ },
2552
+ textContent: "Source control keeps every version of a project, so any change can be undone. Open a project to see its history."
2553
+ },
2554
+ {
2555
+ tagName: "div",
2556
+ attributes: {
2557
+ part: "clone-slot",
2558
+ role: "none"
2559
+ },
2560
+ style: {
2561
+ display: "contents"
2562
+ },
2563
+ $switch: {
2564
+ $ref: "#/state/canClone"
2565
+ },
2566
+ cases: {
2567
+ true: {
2568
+ tagName: "div",
2569
+ attributes: {
2570
+ part: "empty-actions"
2571
+ },
2572
+ children: [
2573
+ {
2574
+ tagName: "jx-button",
2575
+ attributes: {
2576
+ part: "clone",
2577
+ "data-action": "clone"
2578
+ },
2579
+ $props: {
2580
+ size: "sm"
2581
+ },
2582
+ onclick: {
2583
+ $prototype: "Function",
2584
+ body: [
2585
+ {
2586
+ operator: "call",
2587
+ target: {
2588
+ $ref: "#/state/clone"
2589
+ },
2590
+ value: []
2591
+ }
2592
+ ]
2593
+ },
2594
+ children: [
2595
+ {
2596
+ tagName: "jx-icon",
2597
+ $props: {
2598
+ name: "download-simple"
2599
+ }
2600
+ },
2601
+ {
2602
+ tagName: "span",
2603
+ textContent: "Clone Git Repository"
2604
+ }
2605
+ ]
2606
+ }
2607
+ ]
2608
+ }
2609
+ }
2610
+ }
2611
+ ]
2612
+ },
2613
+ loading: {
2614
+ tagName: "p",
2615
+ attributes: {
2616
+ part: "status",
2617
+ "data-view": "loading"
2618
+ },
2619
+ textContent: "Loading…"
2620
+ },
2621
+ "no-repo": {
2622
+ tagName: "div",
2623
+ attributes: {
2624
+ part: "empty",
2625
+ "data-view": "no-repo"
2626
+ },
2627
+ children: [
2628
+ {
2629
+ tagName: "p",
2630
+ attributes: {
2631
+ part: "empty-message"
2632
+ },
2633
+ textContent: "This project is not tracked by git yet. Start tracking it to keep a history of every change and to publish it anywhere."
2634
+ },
2635
+ {
2636
+ tagName: "div",
2637
+ attributes: {
2638
+ part: "empty-actions"
2639
+ },
2640
+ children: [
2641
+ {
2642
+ tagName: "jx-button",
2643
+ attributes: {
2644
+ part: "init",
2645
+ "data-action": "init"
2646
+ },
2647
+ $props: {
2648
+ size: "sm",
2649
+ variant: "accent",
2650
+ disabled: {
2651
+ $ref: "#/state/busy"
2652
+ }
2653
+ },
2654
+ onclick: {
2655
+ $prototype: "Function",
2656
+ body: [
2657
+ {
2658
+ operator: "call",
2659
+ target: {
2660
+ $ref: "#/state/initRepository"
2661
+ },
2662
+ value: []
2663
+ }
2664
+ ]
2665
+ },
2666
+ children: [
2667
+ {
2668
+ tagName: "jx-icon",
2669
+ $props: {
2670
+ name: "plus"
2671
+ }
2672
+ },
2673
+ {
2674
+ tagName: "span",
2675
+ textContent: "Initialize Repository"
2676
+ }
2677
+ ]
2678
+ },
2679
+ {
2680
+ tagName: "jx-button",
2681
+ attributes: {
2682
+ part: "create-repository",
2683
+ "data-action": "create-repository"
2684
+ },
2685
+ $props: {
2686
+ size: "sm",
2687
+ disabled: {
2688
+ $ref: "#/state/busy"
2689
+ }
2690
+ },
2691
+ onclick: {
2692
+ $prototype: "Function",
2693
+ body: [
2694
+ {
2695
+ operator: "call",
2696
+ target: {
2697
+ $ref: "#/state/createRepository"
2698
+ },
2699
+ value: []
2700
+ }
2701
+ ]
2702
+ },
2703
+ children: [
2704
+ {
2705
+ tagName: "jx-icon",
2706
+ $props: {
2707
+ name: "share-network"
2708
+ }
2709
+ },
2710
+ {
2711
+ tagName: "span",
2712
+ textContent: "Create GitHub repository"
2713
+ }
2714
+ ]
2715
+ }
2716
+ ]
2717
+ }
2718
+ ]
2719
+ },
2720
+ repo: {
2721
+ tagName: "div",
2722
+ attributes: {
2723
+ part: "repo",
2724
+ role: "none"
2725
+ },
2726
+ style: {
2727
+ display: "contents"
2728
+ },
2729
+ children: [
2730
+ {
2731
+ tagName: "div",
2732
+ attributes: {
2733
+ part: "remote-slot",
2734
+ role: "none"
2735
+ },
2736
+ style: {
2737
+ display: "contents"
2738
+ },
2739
+ $switch: {
2740
+ $ref: "#/state/remoteState"
2741
+ },
2742
+ cases: {
2743
+ remote: {
2744
+ tagName: "div",
2745
+ attributes: {
2746
+ part: "sync-bar",
2747
+ "data-remote": "yes"
2748
+ },
2749
+ children: [
2750
+ {
2751
+ tagName: "jx-action-button",
2752
+ attributes: {
2753
+ part: "refresh",
2754
+ "data-action": "refresh"
2755
+ },
2756
+ $props: {
2757
+ icon: "arrows-clockwise",
2758
+ size: "sm",
2759
+ quiet: true,
2760
+ label: "Refresh",
2761
+ hint: "Refresh",
2762
+ disabled: {
2763
+ $ref: "#/state/busy"
2764
+ }
2765
+ },
2766
+ onclick: {
2767
+ $prototype: "Function",
2768
+ body: [
2769
+ {
2770
+ operator: "call",
2771
+ target: {
2772
+ $ref: "#/state/refresh"
2773
+ },
2774
+ value: []
2775
+ }
2776
+ ]
2777
+ }
2778
+ },
2779
+ {
2780
+ tagName: "div",
2781
+ attributes: {
2782
+ part: "sync-text"
2783
+ },
2784
+ children: [
2785
+ {
2786
+ tagName: "span",
2787
+ attributes: {
2788
+ part: "sync-label"
2789
+ },
2790
+ textContent: "${state.syncLabel}"
2791
+ },
2792
+ {
2793
+ tagName: "span",
2794
+ attributes: {
2795
+ part: "updated-slot",
2796
+ role: "none"
2797
+ },
2798
+ style: {
2799
+ display: "contents"
2800
+ },
2801
+ $switch: {
2802
+ $ref: "#/state/hasLastUpdated"
2803
+ },
2804
+ cases: {
2805
+ true: {
2806
+ tagName: "span",
2807
+ attributes: {
2808
+ part: "sync-time"
2809
+ },
2810
+ textContent: "${state.lastUpdated}"
2811
+ }
2812
+ }
2813
+ }
2814
+ ]
2815
+ },
2816
+ {
2817
+ tagName: "jx-action-group",
2818
+ attributes: {
2819
+ part: "sync-actions"
2820
+ },
2821
+ $props: {
2822
+ label: "Remote actions",
2823
+ compact: true
2824
+ },
2825
+ children: [
2826
+ {
2827
+ tagName: "jx-action-button",
2828
+ attributes: {
2829
+ part: "fetch",
2830
+ "data-action": "fetch"
2831
+ },
2832
+ $props: {
2833
+ icon: "download-simple",
2834
+ size: "sm",
2835
+ quiet: true,
2836
+ label: "Fetch",
2837
+ hint: "Fetch",
2838
+ disabled: {
2839
+ $ref: "#/state/busy"
2840
+ }
2841
+ },
2842
+ onclick: {
2843
+ $prototype: "Function",
2844
+ body: [
2845
+ {
2846
+ operator: "call",
2847
+ target: {
2848
+ $ref: "#/state/fetch"
2849
+ },
2850
+ value: []
2851
+ }
2852
+ ]
2853
+ }
2854
+ },
2855
+ {
2856
+ tagName: "jx-action-button",
2857
+ attributes: {
2858
+ part: "pull",
2859
+ "data-action": "pull"
2860
+ },
2861
+ $props: {
2862
+ icon: "arrow-down",
2863
+ size: "sm",
2864
+ quiet: true,
2865
+ label: {
2866
+ $ref: "#/state/pullLabel"
2867
+ },
2868
+ hint: {
2869
+ $ref: "#/state/pullLabel"
2870
+ },
2871
+ disabled: {
2872
+ $ref: "#/state/busy"
2873
+ }
2874
+ },
2875
+ onclick: {
2876
+ $prototype: "Function",
2877
+ body: [
2878
+ {
2879
+ operator: "call",
2880
+ target: {
2881
+ $ref: "#/state/pull"
2882
+ },
2883
+ value: []
2884
+ }
2885
+ ]
2886
+ }
2887
+ },
2888
+ {
2889
+ tagName: "jx-action-button",
2890
+ attributes: {
2891
+ part: "push",
2892
+ "data-action": "push"
2893
+ },
2894
+ $props: {
2895
+ icon: "arrow-up",
2896
+ size: "sm",
2897
+ quiet: true,
2898
+ label: {
2899
+ $ref: "#/state/pushLabel"
2900
+ },
2901
+ hint: {
2902
+ $ref: "#/state/pushLabel"
2903
+ },
2904
+ disabled: {
2905
+ $ref: "#/state/busy"
2906
+ }
2907
+ },
2908
+ onclick: {
2909
+ $prototype: "Function",
2910
+ body: [
2911
+ {
2912
+ operator: "call",
2913
+ target: {
2914
+ $ref: "#/state/push"
2915
+ },
2916
+ value: []
2917
+ }
2918
+ ]
2919
+ }
2920
+ }
2921
+ ]
2922
+ }
2923
+ ]
2924
+ },
2925
+ local: {
2926
+ tagName: "div",
2927
+ attributes: {
2928
+ part: "sync-bar",
2929
+ "data-remote": "none"
2930
+ },
2931
+ children: [
2932
+ {
2933
+ tagName: "jx-action-button",
2934
+ attributes: {
2935
+ part: "refresh",
2936
+ "data-action": "refresh"
2937
+ },
2938
+ $props: {
2939
+ icon: "arrows-clockwise",
2940
+ size: "sm",
2941
+ quiet: true,
2942
+ label: "Refresh",
2943
+ hint: "Refresh",
2944
+ disabled: {
2945
+ $ref: "#/state/busy"
2946
+ }
2947
+ },
2948
+ onclick: {
2949
+ $prototype: "Function",
2950
+ body: [
2951
+ {
2952
+ operator: "call",
2953
+ target: {
2954
+ $ref: "#/state/refresh"
2955
+ },
2956
+ value: []
2957
+ }
2958
+ ]
2959
+ }
2960
+ },
2961
+ {
2962
+ tagName: "div",
2963
+ attributes: {
2964
+ part: "sync-text"
2965
+ },
2966
+ children: [
2967
+ {
2968
+ tagName: "span",
2969
+ attributes: {
2970
+ part: "sync-label"
2971
+ },
2972
+ textContent: "Local only (no remote)"
2973
+ }
2974
+ ]
2975
+ },
2976
+ {
2977
+ tagName: "jx-button",
2978
+ attributes: {
2979
+ part: "create-repository",
2980
+ "data-action": "create-repository"
2981
+ },
2982
+ $props: {
2983
+ size: "sm",
2984
+ disabled: {
2985
+ $ref: "#/state/busy"
2986
+ }
2987
+ },
2988
+ onclick: {
2989
+ $prototype: "Function",
2990
+ body: [
2991
+ {
2992
+ operator: "call",
2993
+ target: {
2994
+ $ref: "#/state/createRepository"
2995
+ },
2996
+ value: []
2997
+ }
2998
+ ]
2999
+ },
3000
+ children: [
3001
+ {
3002
+ tagName: "jx-icon",
3003
+ $props: {
3004
+ name: "share-network"
3005
+ }
3006
+ },
3007
+ {
3008
+ tagName: "span",
3009
+ textContent: "Create GitHub repository"
3010
+ }
3011
+ ]
3012
+ }
3013
+ ]
3014
+ }
3015
+ }
3016
+ },
3017
+ {
3018
+ tagName: "div",
3019
+ attributes: {
3020
+ part: "branch-row"
3021
+ },
3022
+ children: [
3023
+ {
3024
+ tagName: "jx-icon",
3025
+ attributes: {
3026
+ part: "branch-icon"
3027
+ },
3028
+ $props: {
3029
+ name: "git-branch"
3030
+ }
3031
+ },
3032
+ {
3033
+ tagName: "div",
3034
+ attributes: {
3035
+ part: "branch-text"
3036
+ },
3037
+ children: [
3038
+ {
3039
+ tagName: "span",
3040
+ attributes: {
3041
+ part: "branch-label"
3042
+ },
3043
+ textContent: "Active branch"
3044
+ },
3045
+ {
3046
+ tagName: "span",
3047
+ attributes: {
3048
+ part: "branch-name"
3049
+ },
3050
+ textContent: "${state.branchName}"
3051
+ }
3052
+ ]
3053
+ },
3054
+ {
3055
+ tagName: "jx-select",
3056
+ attributes: {
3057
+ part: "branch-picker"
3058
+ },
3059
+ $props: {
3060
+ label: "Switch branch",
3061
+ size: "sm",
3062
+ options: {
3063
+ $ref: "#/state/branchOptions"
3064
+ },
3065
+ value: {
3066
+ $ref: "#/state/branchValue"
3067
+ }
3068
+ },
3069
+ onchange: {
3070
+ $prototype: "Function",
3071
+ body: [
3072
+ {
3073
+ operator: "call",
3074
+ target: {
3075
+ $ref: "#/state/chooseBranch"
3076
+ },
3077
+ value: [
3078
+ {
3079
+ $ref: "event#/target/value"
3080
+ }
3081
+ ]
3082
+ }
3083
+ ]
3084
+ }
3085
+ }
3086
+ ]
3087
+ },
3088
+ {
3089
+ tagName: "jx-tabs",
3090
+ attributes: {
3091
+ part: "tabs",
3092
+ selected: "${state.subTab}"
3093
+ },
3094
+ $props: {
3095
+ label: "Source control views"
3096
+ },
3097
+ onchange: {
3098
+ $prototype: "Function",
3099
+ body: [
3100
+ {
3101
+ operator: "call",
3102
+ target: {
3103
+ $ref: "#/state/selectTab"
3104
+ },
3105
+ value: [
3106
+ {
3107
+ $ref: "event#/detail"
3108
+ }
3109
+ ]
3110
+ }
3111
+ ]
3112
+ },
3113
+ children: [
3114
+ {
3115
+ tagName: "jx-tab",
3116
+ attributes: {
3117
+ part: "tab",
3118
+ "data-tab": "changes",
3119
+ value: "changes",
3120
+ label: "${state.changesLabel}",
3121
+ panel: "git-panel-body"
3122
+ }
3123
+ },
3124
+ {
3125
+ tagName: "jx-tab",
3126
+ attributes: {
3127
+ part: "tab",
3128
+ "data-tab": "history",
3129
+ value: "history",
3130
+ label: "History",
3131
+ panel: "git-panel-body"
3132
+ }
3133
+ }
3134
+ ]
3135
+ },
3136
+ {
3137
+ tagName: "div",
3138
+ attributes: {
3139
+ part: "body",
3140
+ id: "git-panel-body",
3141
+ role: "tabpanel",
3142
+ "data-tab": "${state.subTab}"
3143
+ },
3144
+ style: {
3145
+ display: "contents"
3146
+ },
3147
+ $switch: {
3148
+ $ref: "#/state/subTab"
3149
+ },
3150
+ cases: {
3151
+ changes: {
3152
+ tagName: "div",
3153
+ attributes: {
3154
+ part: "changes",
3155
+ role: "none"
3156
+ },
3157
+ style: {
3158
+ display: "contents"
3159
+ },
3160
+ children: [
3161
+ {
3162
+ tagName: "div",
3163
+ attributes: {
3164
+ part: "commit",
3165
+ "data-jx-region": "navigator/panel:git/commit"
3166
+ },
3167
+ children: [
3168
+ {
3169
+ tagName: "span",
3170
+ attributes: {
3171
+ part: "commit-label",
3172
+ id: "git-commit-label"
3173
+ },
3174
+ textContent: "Please write a commit message"
3175
+ },
3176
+ {
3177
+ tagName: "jx-textfield",
3178
+ attributes: {
3179
+ part: "commit-input",
3180
+ "data-field": "commit-message"
3181
+ },
3182
+ $props: {
3183
+ labelledby: "git-commit-label",
3184
+ multiline: true,
3185
+ size: "sm",
3186
+ placeholder: "Describe your changes",
3187
+ value: {
3188
+ $ref: "#/state/commitMessage"
3189
+ }
3190
+ },
3191
+ oninput: {
3192
+ $prototype: "Function",
3193
+ body: [
3194
+ {
3195
+ operator: "call",
3196
+ target: {
3197
+ $ref: "#/state/editMessage"
3198
+ },
3199
+ value: [
3200
+ {
3201
+ $ref: "event#/target/value"
3202
+ }
3203
+ ]
3204
+ }
3205
+ ]
3206
+ },
3207
+ onkeydown: {
3208
+ $prototype: "Function",
3209
+ body: [
3210
+ {
3211
+ $switch: {
3212
+ $ref: "event#/key"
3213
+ },
3214
+ cases: {
3215
+ Enter: [
3216
+ {
3217
+ if: {
3218
+ operator: "||",
3219
+ target: {
3220
+ $ref: "event#/ctrlKey"
3221
+ },
3222
+ value: {
3223
+ $ref: "event#/metaKey"
3224
+ }
3225
+ },
3226
+ then: [
3227
+ {
3228
+ preventDefault: true
3229
+ },
3230
+ {
3231
+ operator: "call",
3232
+ target: {
3233
+ $ref: "#/state/commit"
3234
+ },
3235
+ value: []
3236
+ }
3237
+ ]
3238
+ }
3239
+ ]
3240
+ }
3241
+ }
3242
+ ]
3243
+ }
3244
+ },
3245
+ {
3246
+ tagName: "div",
3247
+ attributes: {
3248
+ part: "commit-actions"
3249
+ },
3250
+ children: [
3251
+ {
3252
+ tagName: "jx-button",
3253
+ attributes: {
3254
+ part: "commit-button",
3255
+ "data-action": "commit-and-sync"
3256
+ },
3257
+ $props: {
3258
+ size: "sm",
3259
+ variant: "accent",
3260
+ disabled: {
3261
+ $ref: "#/state/busy"
3262
+ }
3263
+ },
3264
+ onclick: {
3265
+ $prototype: "Function",
3266
+ body: [
3267
+ {
3268
+ operator: "call",
3269
+ target: {
3270
+ $ref: "#/state/commitAndSync"
3271
+ },
3272
+ value: []
3273
+ }
3274
+ ]
3275
+ },
3276
+ children: [
3277
+ {
3278
+ tagName: "span",
3279
+ textContent: "Commit and sync"
3280
+ }
3281
+ ]
3282
+ },
3283
+ {
3284
+ tagName: "jx-action-button",
3285
+ attributes: {
3286
+ part: "commit-menu",
3287
+ "data-action": "commit-menu"
3288
+ },
3289
+ $props: {
3290
+ icon: "caret-down",
3291
+ size: "sm",
3292
+ label: "More commit options",
3293
+ hint: "More commit options",
3294
+ haspopup: "menu"
3295
+ },
3296
+ onclick: {
3297
+ $prototype: "Function",
3298
+ body: [
3299
+ {
3300
+ operator: "call",
3301
+ target: {
3302
+ $ref: "#/state/openCommitMenu"
3303
+ },
3304
+ value: [
3305
+ {
3306
+ $ref: "event#/currentTarget"
3307
+ }
3308
+ ]
3309
+ }
3310
+ ]
3311
+ }
3312
+ }
3313
+ ]
3314
+ }
3315
+ ]
3316
+ },
3317
+ {
3318
+ tagName: "div",
3319
+ attributes: {
3320
+ part: "staged-slot",
3321
+ role: "none"
3322
+ },
3323
+ style: {
3324
+ display: "contents"
3325
+ },
3326
+ $switch: {
3327
+ $ref: "#/state/hasStaged"
3328
+ },
3329
+ cases: {
3330
+ true: {
3331
+ tagName: "section",
3332
+ attributes: {
3333
+ part: "section",
3334
+ "data-section": "staged",
3335
+ "aria-label": "Staged Changes"
3336
+ },
3337
+ children: [
3338
+ {
3339
+ tagName: "div",
3340
+ attributes: {
3341
+ part: "section-header"
3342
+ },
3343
+ children: [
3344
+ {
3345
+ tagName: "span",
3346
+ attributes: {
3347
+ part: "section-title"
3348
+ },
3349
+ textContent: "Staged Changes"
3350
+ },
3351
+ {
3352
+ tagName: "span",
3353
+ attributes: {
3354
+ part: "count"
3355
+ },
3356
+ textContent: "${state.stagedCount}"
3357
+ },
3358
+ {
3359
+ tagName: "jx-action-button",
3360
+ attributes: {
3361
+ part: "unstage-all",
3362
+ "data-action": "unstage-all"
3363
+ },
3364
+ $props: {
3365
+ icon: "minus",
3366
+ size: "sm",
3367
+ quiet: true,
3368
+ label: "Unstage all",
3369
+ hint: "Unstage all"
3370
+ },
3371
+ onclick: {
3372
+ $prototype: "Function",
3373
+ body: [
3374
+ {
3375
+ operator: "call",
3376
+ target: {
3377
+ $ref: "#/state/unstageAll"
3378
+ },
3379
+ value: []
3380
+ }
3381
+ ]
3382
+ }
3383
+ }
3384
+ ]
3385
+ },
3386
+ {
3387
+ $prototype: "Array",
3388
+ items: {
3389
+ $ref: "#/state/stagedFiles"
3390
+ },
3391
+ key: {
3392
+ $ref: "$map/item/key"
3393
+ },
3394
+ map: {
3395
+ $description: "One changed file. Every row opens the file it names — renderability decides which VIEW opens, not whether the row responds — and carries the two or three verbs its staged state allows. `$map/item` inside a nested map is the FILE, which is why the row hands its own path back to every action rather than an index.",
3396
+ tagName: "div",
3397
+ attributes: {
3398
+ part: "file-row",
3399
+ "data-path": "${$map.item.path}",
3400
+ "data-status": "${$map.item.status}"
3401
+ },
3402
+ children: [
3403
+ {
3404
+ tagName: "button",
3405
+ attributes: {
3406
+ part: "file-open",
3407
+ type: "button",
3408
+ "aria-label": "${$map.item.label}",
3409
+ title: "Open this file's comparison"
3410
+ },
3411
+ onclick: {
3412
+ $prototype: "Function",
3413
+ body: [
3414
+ {
3415
+ operator: "call",
3416
+ target: {
3417
+ $ref: "#/state/openFile"
3418
+ },
3419
+ value: [
3420
+ {
3421
+ $ref: "$map/item/path"
3422
+ }
3423
+ ]
3424
+ }
3425
+ ]
3426
+ },
3427
+ children: [
3428
+ {
3429
+ tagName: "span",
3430
+ attributes: {
3431
+ part: "file-name"
3432
+ },
3433
+ textContent: "${$map.item.name}"
3434
+ },
3435
+ {
3436
+ tagName: "span",
3437
+ attributes: {
3438
+ part: "dir-slot",
3439
+ role: "none"
3440
+ },
3441
+ style: {
3442
+ display: "contents"
3443
+ },
3444
+ $switch: {
3445
+ $ref: "$map/item/hasDir"
3446
+ },
3447
+ cases: {
3448
+ true: {
3449
+ tagName: "span",
3450
+ attributes: {
3451
+ part: "file-dir"
3452
+ },
3453
+ textContent: "${$map.item.dir}"
3454
+ }
3455
+ }
3456
+ }
3457
+ ]
3458
+ },
3459
+ {
3460
+ tagName: "span",
3461
+ attributes: {
3462
+ part: "file-actions"
3463
+ },
3464
+ $switch: {
3465
+ $ref: "$map/item/staged"
3466
+ },
3467
+ cases: {
3468
+ true: {
3469
+ tagName: "jx-action-button",
3470
+ attributes: {
3471
+ part: "unstage",
3472
+ "data-action": "unstage"
3473
+ },
3474
+ $props: {
3475
+ icon: "minus",
3476
+ size: "sm",
3477
+ quiet: true,
3478
+ label: "Unstage ${$map.item.path}",
3479
+ hint: "Unstage"
3480
+ },
3481
+ onclick: {
3482
+ $prototype: "Function",
3483
+ body: [
3484
+ {
3485
+ operator: "call",
3486
+ target: {
3487
+ $ref: "#/state/unstage"
3488
+ },
3489
+ value: [
3490
+ {
3491
+ $ref: "$map/item/path"
3492
+ }
3493
+ ]
3494
+ }
3495
+ ]
3496
+ }
3497
+ },
3498
+ false: {
3499
+ tagName: "span",
3500
+ attributes: {
3501
+ part: "unstaged-actions",
3502
+ role: "none"
3503
+ },
3504
+ style: {
3505
+ display: "contents"
3506
+ },
3507
+ children: [
3508
+ {
3509
+ tagName: "jx-action-button",
3510
+ attributes: {
3511
+ part: "discard",
3512
+ "data-action": "discard"
3513
+ },
3514
+ $props: {
3515
+ icon: "arrow-u-up-left",
3516
+ size: "sm",
3517
+ quiet: true,
3518
+ label: "Discard changes to ${$map.item.path}",
3519
+ hint: "Discard changes",
3520
+ disabled: {
3521
+ $ref: "$map/item/cannotDiscard"
3522
+ }
3523
+ },
3524
+ onclick: {
3525
+ $prototype: "Function",
3526
+ body: [
3527
+ {
3528
+ operator: "call",
3529
+ target: {
3530
+ $ref: "#/state/discard"
3531
+ },
3532
+ value: [
3533
+ {
3534
+ $ref: "$map/item/path"
3535
+ }
3536
+ ]
3537
+ }
3538
+ ]
3539
+ }
3540
+ },
3541
+ {
3542
+ tagName: "jx-action-button",
3543
+ attributes: {
3544
+ part: "stage",
3545
+ "data-action": "stage"
3546
+ },
3547
+ $props: {
3548
+ icon: "plus",
3549
+ size: "sm",
3550
+ quiet: true,
3551
+ label: "Stage ${$map.item.path}",
3552
+ hint: "Stage"
3553
+ },
3554
+ onclick: {
3555
+ $prototype: "Function",
3556
+ body: [
3557
+ {
3558
+ operator: "call",
3559
+ target: {
3560
+ $ref: "#/state/stage"
3561
+ },
3562
+ value: [
3563
+ {
3564
+ $ref: "$map/item/path"
3565
+ }
3566
+ ]
3567
+ }
3568
+ ]
3569
+ }
3570
+ }
3571
+ ]
3572
+ }
3573
+ }
3574
+ },
3575
+ {
3576
+ tagName: "span",
3577
+ attributes: {
3578
+ part: "badge",
3579
+ "data-status": "${$map.item.status}"
3580
+ },
3581
+ textContent: "${$map.item.status}"
3582
+ }
3583
+ ]
3584
+ }
3585
+ }
3586
+ ]
3587
+ }
3588
+ }
3589
+ },
3590
+ {
3591
+ tagName: "section",
3592
+ attributes: {
3593
+ part: "section",
3594
+ "data-section": "changed",
3595
+ "aria-label": "Changed Components"
3596
+ },
3597
+ children: [
3598
+ {
3599
+ tagName: "div",
3600
+ attributes: {
3601
+ part: "section-header"
3602
+ },
3603
+ children: [
3604
+ {
3605
+ tagName: "span",
3606
+ attributes: {
3607
+ part: "section-title"
3608
+ },
3609
+ textContent: "Changed Components"
3610
+ },
3611
+ {
3612
+ tagName: "span",
3613
+ attributes: {
3614
+ part: "count"
3615
+ },
3616
+ textContent: "${state.changedCount}"
3617
+ },
3618
+ {
3619
+ tagName: "span",
3620
+ attributes: {
3621
+ part: "stage-all-slot",
3622
+ role: "none"
3623
+ },
3624
+ style: {
3625
+ display: "contents"
3626
+ },
3627
+ $switch: {
3628
+ $ref: "#/state/hasUnstaged"
3629
+ },
3630
+ cases: {
3631
+ true: {
3632
+ tagName: "jx-action-button",
3633
+ attributes: {
3634
+ part: "stage-all",
3635
+ "data-action": "stage-all"
3636
+ },
3637
+ $props: {
3638
+ icon: "plus",
3639
+ size: "sm",
3640
+ quiet: true,
3641
+ label: "Stage all",
3642
+ hint: "Stage all"
3643
+ },
3644
+ onclick: {
3645
+ $prototype: "Function",
3646
+ body: [
3647
+ {
3648
+ operator: "call",
3649
+ target: {
3650
+ $ref: "#/state/stageAll"
3651
+ },
3652
+ value: []
3653
+ }
3654
+ ]
3655
+ }
3656
+ }
3657
+ }
3658
+ }
3659
+ ]
3660
+ },
3661
+ {
3662
+ tagName: "div",
3663
+ attributes: {
3664
+ part: "groups-slot",
3665
+ role: "none"
3666
+ },
3667
+ style: {
3668
+ display: "contents"
3669
+ },
3670
+ $switch: {
3671
+ $ref: "#/state/filesState"
3672
+ },
3673
+ cases: {
3674
+ listed: {
3675
+ tagName: "div",
3676
+ attributes: {
3677
+ part: "groups"
3678
+ },
3679
+ children: [
3680
+ {
3681
+ $prototype: "Array",
3682
+ items: {
3683
+ $ref: "#/state/groups"
3684
+ },
3685
+ key: {
3686
+ $ref: "$map/item/key"
3687
+ },
3688
+ map: {
3689
+ tagName: "div",
3690
+ attributes: {
3691
+ part: "group",
3692
+ "data-group": "${$map.item.key}"
3693
+ },
3694
+ children: [
3695
+ {
3696
+ tagName: "div",
3697
+ attributes: {
3698
+ part: "group-header"
3699
+ },
3700
+ children: [
3701
+ {
3702
+ tagName: "span",
3703
+ attributes: {
3704
+ part: "group-name"
3705
+ },
3706
+ textContent: "${$map.item.name}"
3707
+ }
3708
+ ]
3709
+ },
3710
+ {
3711
+ $prototype: "Array",
3712
+ items: {
3713
+ $ref: "$map/item/files"
3714
+ },
3715
+ key: {
3716
+ $ref: "$map/item/key"
3717
+ },
3718
+ map: {
3719
+ tagName: "div",
3720
+ attributes: {
3721
+ part: "file-row",
3722
+ "data-path": "${$map.item.path}",
3723
+ "data-status": "${$map.item.status}"
3724
+ },
3725
+ children: [
3726
+ {
3727
+ tagName: "button",
3728
+ attributes: {
3729
+ part: "file-open",
3730
+ type: "button",
3731
+ "aria-label": "${$map.item.label}",
3732
+ title: "Open this file's comparison"
3733
+ },
3734
+ onclick: {
3735
+ $prototype: "Function",
3736
+ body: [
3737
+ {
3738
+ operator: "call",
3739
+ target: {
3740
+ $ref: "#/state/openFile"
3741
+ },
3742
+ value: [
3743
+ {
3744
+ $ref: "$map/item/path"
3745
+ }
3746
+ ]
3747
+ }
3748
+ ]
3749
+ },
3750
+ children: [
3751
+ {
3752
+ tagName: "span",
3753
+ attributes: {
3754
+ part: "file-name"
3755
+ },
3756
+ textContent: "${$map.item.name}"
3757
+ },
3758
+ {
3759
+ tagName: "span",
3760
+ attributes: {
3761
+ part: "dir-slot",
3762
+ role: "none"
3763
+ },
3764
+ style: {
3765
+ display: "contents"
3766
+ },
3767
+ $switch: {
3768
+ $ref: "$map/item/hasDir"
3769
+ },
3770
+ cases: {
3771
+ true: {
3772
+ tagName: "span",
3773
+ attributes: {
3774
+ part: "file-dir"
3775
+ },
3776
+ textContent: "${$map.item.dir}"
3777
+ }
3778
+ }
3779
+ }
3780
+ ]
3781
+ },
3782
+ {
3783
+ tagName: "span",
3784
+ attributes: {
3785
+ part: "file-actions"
3786
+ },
3787
+ $switch: {
3788
+ $ref: "$map/item/staged"
3789
+ },
3790
+ cases: {
3791
+ true: {
3792
+ tagName: "jx-action-button",
3793
+ attributes: {
3794
+ part: "unstage",
3795
+ "data-action": "unstage"
3796
+ },
3797
+ $props: {
3798
+ icon: "minus",
3799
+ size: "sm",
3800
+ quiet: true,
3801
+ label: "Unstage ${$map.item.path}",
3802
+ hint: "Unstage"
3803
+ },
3804
+ onclick: {
3805
+ $prototype: "Function",
3806
+ body: [
3807
+ {
3808
+ operator: "call",
3809
+ target: {
3810
+ $ref: "#/state/unstage"
3811
+ },
3812
+ value: [
3813
+ {
3814
+ $ref: "$map/item/path"
3815
+ }
3816
+ ]
3817
+ }
3818
+ ]
3819
+ }
3820
+ },
3821
+ false: {
3822
+ tagName: "span",
3823
+ attributes: {
3824
+ part: "unstaged-actions",
3825
+ role: "none"
3826
+ },
3827
+ style: {
3828
+ display: "contents"
3829
+ },
3830
+ children: [
3831
+ {
3832
+ tagName: "jx-action-button",
3833
+ attributes: {
3834
+ part: "discard",
3835
+ "data-action": "discard"
3836
+ },
3837
+ $props: {
3838
+ icon: "arrow-u-up-left",
3839
+ size: "sm",
3840
+ quiet: true,
3841
+ label: "Discard changes to ${$map.item.path}",
3842
+ hint: "Discard changes",
3843
+ disabled: {
3844
+ $ref: "$map/item/cannotDiscard"
3845
+ }
3846
+ },
3847
+ onclick: {
3848
+ $prototype: "Function",
3849
+ body: [
3850
+ {
3851
+ operator: "call",
3852
+ target: {
3853
+ $ref: "#/state/discard"
3854
+ },
3855
+ value: [
3856
+ {
3857
+ $ref: "$map/item/path"
3858
+ }
3859
+ ]
3860
+ }
3861
+ ]
3862
+ }
3863
+ },
3864
+ {
3865
+ tagName: "jx-action-button",
3866
+ attributes: {
3867
+ part: "stage",
3868
+ "data-action": "stage"
3869
+ },
3870
+ $props: {
3871
+ icon: "plus",
3872
+ size: "sm",
3873
+ quiet: true,
3874
+ label: "Stage ${$map.item.path}",
3875
+ hint: "Stage"
3876
+ },
3877
+ onclick: {
3878
+ $prototype: "Function",
3879
+ body: [
3880
+ {
3881
+ operator: "call",
3882
+ target: {
3883
+ $ref: "#/state/stage"
3884
+ },
3885
+ value: [
3886
+ {
3887
+ $ref: "$map/item/path"
3888
+ }
3889
+ ]
3890
+ }
3891
+ ]
3892
+ }
3893
+ }
3894
+ ]
3895
+ }
3896
+ }
3897
+ },
3898
+ {
3899
+ tagName: "span",
3900
+ attributes: {
3901
+ part: "badge",
3902
+ "data-status": "${$map.item.status}"
3903
+ },
3904
+ textContent: "${$map.item.status}"
3905
+ }
3906
+ ]
3907
+ }
3908
+ }
3909
+ ]
3910
+ }
3911
+ }
3912
+ ]
3913
+ },
3914
+ empty: {
3915
+ tagName: "p",
3916
+ attributes: {
3917
+ part: "empty-message",
3918
+ "data-empty": "changes"
3919
+ },
3920
+ textContent: "Nothing to commit. Files you edit and save show up here."
3921
+ }
3922
+ }
3923
+ }
3924
+ ]
3925
+ }
3926
+ ]
3927
+ },
3928
+ history: {
3929
+ tagName: "div",
3930
+ attributes: {
3931
+ part: "history"
3932
+ },
3933
+ children: [
3934
+ {
3935
+ tagName: "div",
3936
+ attributes: {
3937
+ part: "history-slot",
3938
+ role: "none"
3939
+ },
3940
+ style: {
3941
+ display: "contents"
3942
+ },
3943
+ $switch: {
3944
+ $ref: "#/state/historyState"
3945
+ },
3946
+ cases: {
3947
+ listed: {
3948
+ tagName: "ul",
3949
+ attributes: {
3950
+ part: "history-list"
3951
+ },
3952
+ children: [
3953
+ {
3954
+ $prototype: "Array",
3955
+ items: {
3956
+ $ref: "#/state/commits"
3957
+ },
3958
+ key: {
3959
+ $ref: "$map/item/key"
3960
+ },
3961
+ map: {
3962
+ tagName: "li",
3963
+ attributes: {
3964
+ part: "history-entry",
3965
+ "data-hash": "${$map.item.hash}"
3966
+ },
3967
+ children: [
3968
+ {
3969
+ tagName: "span",
3970
+ attributes: {
3971
+ part: "history-hash"
3972
+ },
3973
+ textContent: "${$map.item.hash}"
3974
+ },
3975
+ {
3976
+ tagName: "span",
3977
+ attributes: {
3978
+ part: "history-message"
3979
+ },
3980
+ textContent: "${$map.item.message}"
3981
+ },
3982
+ {
3983
+ tagName: "span",
3984
+ attributes: {
3985
+ part: "history-meta"
3986
+ },
3987
+ textContent: "${$map.item.meta}"
3988
+ }
3989
+ ]
3990
+ }
3991
+ }
3992
+ ]
3993
+ },
3994
+ empty: {
3995
+ tagName: "p",
3996
+ attributes: {
3997
+ part: "empty-message",
3998
+ "data-empty": "history"
3999
+ },
4000
+ textContent: "No commits yet. Each commit you make is a version you can come back to."
4001
+ }
4002
+ }
4003
+ }
4004
+ ]
4005
+ }
4006
+ }
4007
+ },
4008
+ {
4009
+ tagName: "div",
4010
+ attributes: {
4011
+ part: "busy-slot",
4012
+ role: "none"
4013
+ },
4014
+ style: {
4015
+ display: "contents"
4016
+ },
4017
+ $switch: {
4018
+ $ref: "#/state/busy"
4019
+ },
4020
+ cases: {
4021
+ true: {
4022
+ tagName: "p",
4023
+ attributes: {
4024
+ part: "status",
4025
+ "data-status": "busy"
4026
+ },
4027
+ textContent: "Loading…"
4028
+ }
4029
+ }
4030
+ },
4031
+ {
4032
+ tagName: "div",
4033
+ attributes: {
4034
+ part: "error-slot",
4035
+ role: "none"
4036
+ },
4037
+ style: {
4038
+ display: "contents"
4039
+ },
4040
+ $switch: {
4041
+ $ref: "#/state/hasError"
4042
+ },
4043
+ cases: {
4044
+ true: {
4045
+ tagName: "p",
4046
+ attributes: {
4047
+ part: "error",
4048
+ role: "alert"
4049
+ },
4050
+ textContent: "${state.error}"
4051
+ }
4052
+ }
4053
+ }
4054
+ ]
4055
+ }
4056
+ }
4057
+ }
4058
+ ]
4059
+ };
4060
+
4061
+ // src/surfaces/git-panel.ts
4062
+ registerSurface("git-panel", git_panel_default);
4063
+ function project2(scope, values) {
4064
+ scope.view = values.view;
4065
+ scope.canClone = values.canClone;
4066
+ scope.busy = values.busy;
4067
+ scope.hasError = values.hasError;
4068
+ scope.error = values.error;
4069
+ scope.remoteState = values.remoteState;
4070
+ scope.syncLabel = values.syncLabel;
4071
+ scope.lastUpdated = values.lastUpdated;
4072
+ scope.hasLastUpdated = values.hasLastUpdated;
4073
+ scope.pullLabel = values.pullLabel;
4074
+ scope.pushLabel = values.pushLabel;
4075
+ scope.branchName = values.branchName;
4076
+ scope.branchValue = values.branchValue;
4077
+ scope.branchOptions = values.branchOptions;
4078
+ scope.subTab = values.subTab;
4079
+ scope.changesLabel = values.changesLabel;
4080
+ scope.commitMessage = values.commitMessage;
4081
+ scope.hasStaged = values.hasStaged;
4082
+ scope.stagedCount = values.stagedCount;
4083
+ scope.stagedFiles = values.stagedFiles;
4084
+ scope.changedCount = values.changedCount;
4085
+ scope.hasUnstaged = values.hasUnstaged;
4086
+ scope.filesState = values.filesState;
4087
+ scope.groups = values.groups;
4088
+ scope.historyState = values.historyState;
4089
+ scope.commits = values.commits;
4090
+ }
4091
+ function emptyValues() {
4092
+ return {
4093
+ branchName: "",
4094
+ branchOptions: [],
4095
+ branchValue: "",
4096
+ busy: false,
4097
+ canClone: false,
4098
+ changedCount: "0",
4099
+ changesLabel: "Local Changes",
4100
+ commitMessage: "",
4101
+ commits: [],
4102
+ error: "",
4103
+ filesState: "empty",
4104
+ groups: [],
4105
+ hasError: false,
4106
+ hasLastUpdated: false,
4107
+ hasStaged: false,
4108
+ hasUnstaged: false,
4109
+ historyState: "empty",
4110
+ lastUpdated: "",
4111
+ pullLabel: "Pull",
4112
+ pushLabel: "Push",
4113
+ remoteState: "local",
4114
+ stagedCount: "0",
4115
+ stagedFiles: [],
4116
+ subTab: "changes",
4117
+ syncLabel: "",
4118
+ view: "loading"
4119
+ };
4120
+ }
4121
+ function mountGitPanelSurface(container, values, actions) {
4122
+ const scope = reactive({
4123
+ ...emptyValues(),
4124
+ ...actions
4125
+ });
4126
+ project2(scope, values);
4127
+ let mounted = null;
4128
+ let disposed = false;
4129
+ mountSurface("git-panel", scope, container).then((surface) => {
4130
+ if (disposed) {
4131
+ surface.dispose();
4132
+ return;
4133
+ }
4134
+ mounted = surface;
4135
+ });
4136
+ return {
4137
+ connected: () => !disposed && (mounted === null || mounted.root.parentNode === container),
4138
+ dispose() {
4139
+ disposed = true;
4140
+ mounted?.dispose();
4141
+ mounted = null;
4142
+ },
4143
+ update: (next) => {
4144
+ project2(scope, next);
4145
+ }
4146
+ };
4147
+ }
4148
+
4149
+ // src/panels/git-panel.ts
4150
+ async function refreshGitStatus2() {
4151
+ if (!projectState) {
4152
+ return;
4153
+ }
4154
+ const plat = getPlatform2();
4155
+ const { git } = shell;
4156
+ git.loading = true;
4157
+ git.error = null;
4158
+ try {
4159
+ const [status, branches] = await Promise.allSettled([plat.gitStatus(), plat.gitBranches()]);
4160
+ if (status.status === "fulfilled") {
4161
+ git.status = status.value;
4162
+ }
4163
+ if (branches.status === "fulfilled") {
4164
+ git.branches = branches.value;
4165
+ }
4166
+ const failure = status.status === "rejected" ? status.reason : branches.status === "rejected" && status.value?.isRepo ? branches.reason : null;
4167
+ if (failure) {
4168
+ git.error = errorMessage2(failure);
4169
+ }
4170
+ git.lastUpdated = now();
4171
+ git.rev += 1;
4172
+ await rereadOpenComparison();
4173
+ } catch (error) {
4174
+ git.error = errorMessage2(error);
4175
+ } finally {
4176
+ git.loading = false;
4177
+ }
4178
+ }
4179
+ async function rereadOpenComparison() {
4180
+ const state = shell.git.diffState;
4181
+ if (!state) {
4182
+ return;
4183
+ }
4184
+ const change = shell.git.status?.files.find((file) => file.path === state.filePath);
4185
+ if (!change || !isDiffableStatus(change.status)) {
4186
+ shell.git.diffState = null;
4187
+ return;
4188
+ }
4189
+ try {
4190
+ shell.git.diffState = await readGitDiff(state.filePath, change.status);
4191
+ } catch {}
4192
+ }
4193
+ async function noteFileSaved2(path) {
4194
+ shell.git.rev += 1;
4195
+ const state = shell.git.diffState;
4196
+ if (!path || state?.filePath !== path) {
4197
+ return;
4198
+ }
4199
+ try {
4200
+ shell.git.diffState = await readGitDiff(path, state.fileStatus);
4201
+ } catch {}
4202
+ }
4203
+ async function cloneRepository2(ctx) {
4204
+ const platform = getPlatform2();
4205
+ if (!platform.gitClone) {
4206
+ notify2.warn("Cloning is not supported on this platform.", { source: "Source Control" });
4207
+ return;
4208
+ }
4209
+ const url = await showPromptDialog2("Clone Git Repository", {
4210
+ confirmLabel: "Clone",
4211
+ message: "Repository URL",
4212
+ placeholder: "https://github.com/user/repo.git",
4213
+ validate: (v) => v.trim() ? "" : "Enter a repository URL."
4214
+ });
4215
+ if (!url) {
4216
+ return;
4217
+ }
4218
+ try {
4219
+ notify2.info("Cloning repository…", { key: "git.clone", source: "Source Control" });
4220
+ const result = await platform.gitClone(url);
4221
+ if (result?.root) {
4222
+ notify2.success("Clone complete.", { key: "git.clone" });
4223
+ await ctx.openRecentProject(result.root);
4224
+ }
4225
+ } catch (error) {
4226
+ notify2.error("Could not clone the repository.", {
4227
+ detail: errorMessage2(error),
4228
+ key: "git.clone",
4229
+ source: "Source Control"
4230
+ });
4231
+ }
4232
+ }
4233
+ function platformSupportsClone2() {
4234
+ return hasPlatform2() && Boolean(getPlatform2().gitClone);
4235
+ }
4236
+ var STATUS_WORDS = {
4237
+ A: "added",
4238
+ D: "deleted",
4239
+ M: "modified",
4240
+ R: "renamed",
4241
+ U: "untracked"
4242
+ };
4243
+ var DIFFABLE_STATUSES = new Set(["M", "A", "U", "D"]);
4244
+ function isDiffableStatus(fileStatus) {
4245
+ return DIFFABLE_STATUSES.has(fileStatus);
4246
+ }
4247
+ async function readGitDiff(path, fileStatus) {
4248
+ const plat = getPlatform2();
4249
+ const inHead = fileStatus !== "A" && fileStatus !== "U";
4250
+ const onDisk = fileStatus !== "D";
4251
+ const [originalContent, currentContent] = await Promise.all([
4252
+ inHead ? plat.gitShow({ path, ref: "HEAD" }) : Promise.resolve(""),
4253
+ onDisk ? plat.readFile(path) : Promise.resolve("")
4254
+ ]);
4255
+ return { currentContent, filePath: path, fileStatus, originalContent };
4256
+ }
4257
+ async function loadDiffForLens2(path, fileStatus) {
4258
+ try {
4259
+ return await readGitDiff(path, fileStatus);
4260
+ } catch (error) {
4261
+ console.warn("loadDiffForLens:", errorMessage2(error));
4262
+ return null;
4263
+ }
4264
+ }
4265
+ async function initRepository() {
4266
+ try {
4267
+ notify2.info("Initializing repository…", { key: "git.init" });
4268
+ await getPlatform2().gitInit();
4269
+ notify2.success("Repository initialized.", { key: "git.init" });
4270
+ } catch (error) {
4271
+ notify2.error("Could not initialize the repository.", {
4272
+ action: "git.init",
4273
+ detail: errorMessage2(error),
4274
+ key: "git.init",
4275
+ source: "Source Control"
4276
+ });
4277
+ return;
4278
+ }
4279
+ await refreshGitStatus2();
4280
+ }
4281
+ async function pushCurrentBranch() {
4282
+ await gitAction("gitPush");
4283
+ }
4284
+ async function signInToGithub() {
4285
+ const token = await authenticateGithub();
4286
+ if (token) {
4287
+ notify2.success("Signed in to GitHub.", { key: "github.auth" });
4288
+ }
4289
+ }
4290
+ async function gitAction(action, body) {
4291
+ const plat = getPlatform2();
4292
+ shell.git.loading = true;
4293
+ shell.git.error = null;
4294
+ try {
4295
+ await plat[action](body);
4296
+ await refreshGitStatus2();
4297
+ } catch (error) {
4298
+ shell.git.error = errorMessage2(error);
4299
+ shell.git.loading = false;
4300
+ }
4301
+ }
4302
+ async function doPull() {
4303
+ shell.git.loading = true;
4304
+ shell.git.error = null;
4305
+ try {
4306
+ await pullWithPackageSync();
4307
+ await refreshGitStatus2();
4308
+ } catch (error) {
4309
+ shell.git.error = errorMessage2(error);
4310
+ shell.git.loading = false;
4311
+ }
4312
+ }
4313
+ var _pollTimer = null;
4314
+ async function fetchGitLog() {
4315
+ const plat = getPlatform2();
4316
+ try {
4317
+ shell.git.logEntries = await plat.gitLog(30);
4318
+ } catch (error) {
4319
+ shell.git.error = errorMessage2(error);
4320
+ }
4321
+ }
4322
+ var _deps = {};
4323
+ var _branchOverride = null;
4324
+ function fileRowView(file) {
4325
+ const parts = file.path.split("/");
4326
+ const name = parts.pop() ?? file.path;
4327
+ const dir = parts.join("/");
4328
+ return {
4329
+ cannotDiscard: file.status === "U",
4330
+ dir,
4331
+ hasDir: dir !== "",
4332
+ key: file.path,
4333
+ label: `${file.path}, ${STATUS_WORDS[file.status] ?? "changed"}`,
4334
+ name,
4335
+ path: file.path,
4336
+ staged: Boolean(file.staged),
4337
+ status: file.status
4338
+ };
4339
+ }
4340
+ function groupFilesByComponent(files) {
4341
+ const groups = new Map;
4342
+ for (const f of files) {
4343
+ const parts = f.path.split("/");
4344
+ let component;
4345
+ if (f.path.endsWith(".json") || f.path.endsWith(".class.json") || formatForPath2(f.path)) {
4346
+ component = parts.length > 1 ? `/${parts.at(-2)}` : `/${parts[0]}`;
4347
+ } else {
4348
+ component = "Other";
4349
+ }
4350
+ if (!groups.has(component)) {
4351
+ groups.set(component, []);
4352
+ }
4353
+ groups.get(component).push(f);
4354
+ }
4355
+ return [...groups.entries()].map(([name, entries]) => ({
4356
+ files: entries.map((entry) => fileRowView(entry)),
4357
+ key: name,
4358
+ name
4359
+ }));
4360
+ }
4361
+ function commitView(entry) {
4362
+ return {
4363
+ hash: entry.hash.slice(0, 7),
4364
+ key: entry.hash,
4365
+ message: entry.message,
4366
+ meta: `${entry.author} · ${relativeDate(entry.date)}`
4367
+ };
4368
+ }
4369
+ function lastUpdatedLabel(stamp) {
4370
+ return stamp ? `Last updated ${new Date(stamp).toLocaleTimeString([], {
4371
+ hour: "2-digit",
4372
+ minute: "2-digit"
4373
+ })}` : "";
4374
+ }
4375
+ function panelView() {
4376
+ if (!projectState) {
4377
+ return "no-project";
4378
+ }
4379
+ const { error, loading, status } = shell.git;
4380
+ if (!status && !loading && !error) {
4381
+ return "loading";
4382
+ }
4383
+ return status && !status.isRepo ? "no-repo" : "repo";
4384
+ }
4385
+ function gitPanelValues() {
4386
+ const { branches, commitMessage, error, lastUpdated, loading, logEntries, status, subTab } = shell.git;
4387
+ const files = status?.files ?? [];
4388
+ const staged = files.filter((f) => f.staged);
4389
+ const unstaged = files.filter((f) => !f.staged);
4390
+ const all = [...staged, ...unstaged];
4391
+ const upToDate = !status?.ahead && !status?.behind;
4392
+ const ahead = status?.ahead ? `${status.ahead} ahead` : "";
4393
+ const behind = status?.behind ? `${status.behind} behind` : "";
4394
+ const commits = logEntries ?? [];
4395
+ const current = branches?.current ?? status?.branch ?? "";
4396
+ return {
4397
+ branchName: current || "—",
4398
+ branchOptions: [
4399
+ ...(branches?.branches ?? []).map((branch) => ({ label: branch, value: branch })),
4400
+ { label: "+ New branch…", value: NEW_BRANCH }
4401
+ ],
4402
+ branchValue: _branchOverride ?? branches?.current ?? "",
4403
+ busy: Boolean(loading),
4404
+ canClone: platformSupportsClone2(),
4405
+ changedCount: String(all.length),
4406
+ changesLabel: all.length > 0 ? `Local Changes (${all.length})` : "Local Changes",
4407
+ commitMessage,
4408
+ commits: commits.map((entry) => commitView(entry)),
4409
+ error: error ?? "",
4410
+ filesState: all.length > 0 ? "listed" : "empty",
4411
+ groups: groupFilesByComponent(all),
4412
+ hasError: Boolean(error),
4413
+ hasLastUpdated: Boolean(lastUpdated),
4414
+ hasStaged: staged.length > 0,
4415
+ hasUnstaged: unstaged.length > 0,
4416
+ historyState: commits.length > 0 ? "listed" : "empty",
4417
+ lastUpdated: lastUpdatedLabel(lastUpdated),
4418
+ pullLabel: behind ? `Pull (${behind})` : "Pull",
4419
+ pushLabel: ahead ? `Push (${ahead})` : "Push",
4420
+ remoteState: (status?.remotes?.length ?? 0) > 0 ? "remote" : "local",
4421
+ stagedCount: String(staged.length),
4422
+ stagedFiles: staged.map((file) => fileRowView(file)),
4423
+ subTab,
4424
+ syncLabel: upToDate ? "Up to date" : `${ahead}${ahead && behind ? ", " : ""}${behind}`,
4425
+ view: panelView()
4426
+ };
4427
+ }
4428
+ var NEW_BRANCH = "__new__";
4429
+ function fileAt(path) {
4430
+ return shell.git.status?.files.find((file) => file.path === path);
4431
+ }
4432
+ async function doCommit() {
4433
+ const message = shell.git.commitMessage.trim();
4434
+ if (!message) {
4435
+ return;
4436
+ }
4437
+ shell.git.commitMessage = "";
4438
+ await flushAllCollab();
4439
+ await gitAction("gitCommit", message);
4440
+ }
4441
+ async function doCommitAndSync() {
4442
+ const message = shell.git.commitMessage.trim();
4443
+ if (!message) {
4444
+ return;
4445
+ }
4446
+ shell.git.commitMessage = "";
4447
+ shell.git.loading = true;
4448
+ shell.git.error = null;
4449
+ await flushAllCollab();
4450
+ const plat = getPlatform2();
4451
+ try {
4452
+ await plat.gitCommit(message);
4453
+ await plat.gitPush();
4454
+ await refreshGitStatus2();
4455
+ } catch (error) {
4456
+ shell.git.error = errorMessage2(error);
4457
+ shell.git.loading = false;
4458
+ }
4459
+ }
4460
+ async function chooseBranch(value) {
4461
+ const { branches, status } = shell.git;
4462
+ if (value === NEW_BRANCH) {
4463
+ _branchOverride = NEW_BRANCH;
4464
+ syncGitPanel();
4465
+ const name = await showPromptDialog2("New Branch", {
4466
+ confirmLabel: "Create",
4467
+ message: `Branching from ${branches?.current || status?.branch || "the current branch"}.`,
4468
+ placeholder: "feature/my-change",
4469
+ validate: (v) => v.trim() ? "" : "Enter a branch name."
4470
+ });
4471
+ _branchOverride = null;
4472
+ syncGitPanel();
4473
+ if (name) {
4474
+ await gitAction("gitCreateBranch", name);
4475
+ }
4476
+ return;
4477
+ }
4478
+ if (value !== branches?.current) {
4479
+ await gitAction("gitCheckout", value);
4480
+ }
4481
+ }
4482
+ async function openFileComparison(path) {
4483
+ const file = fileAt(path);
4484
+ if (!file) {
4485
+ return;
4486
+ }
4487
+ const refusal = isDiffableStatus(file.status) ? comparisonRefusal(file.path, file.status) : `"${file.path}" has no change this view can open.`;
4488
+ if (refusal) {
4489
+ shell.git.error = refusal;
4490
+ return;
4491
+ }
4492
+ try {
4493
+ shell.git.loading = true;
4494
+ const diffState = await readGitDiff(file.path, file.status);
4495
+ shell.git.diffState = diffState;
4496
+ const tab = await openComparisonTab(file.path);
4497
+ _deps.setGitDiffState?.(diffState);
4498
+ if (tab) {
4499
+ _deps.setCanvasMode?.(tab, "git-diff");
4500
+ }
4501
+ } catch (error) {
4502
+ shell.git.error = `Failed to load diff: ${errorMessage2(error)}`;
4503
+ } finally {
4504
+ shell.git.loading = false;
4505
+ }
4506
+ }
4507
+ async function discardFile(path) {
4508
+ if (fileAt(path)?.status === "U") {
4509
+ return;
4510
+ }
4511
+ const confirmed = await showConfirmDialog2("Discard Changes", `Discard changes to ${path}?`, {
4512
+ confirmLabel: "Discard",
4513
+ destructive: true
4514
+ });
4515
+ if (!confirmed) {
4516
+ return;
4517
+ }
4518
+ await gitAction("gitDiscard", [path]);
4519
+ }
4520
+ function openCommitMenu(anchor) {
4521
+ (__preload("rf7n72mf"), import("./menu-rf7n72mf.js")).then(({ openMenu }) => {
4522
+ openMenu({
4523
+ label: "Commit options",
4524
+ opener: anchor,
4525
+ place: (box) => {
4526
+ const rect = rectOf(anchor);
4527
+ return { x: Math.max(4, rect.right - box.width), y: rect.bottom + 4 };
4528
+ },
4529
+ region: "git-commit",
4530
+ rows: [
4531
+ {
4532
+ destructive: false,
4533
+ disabled: false,
4534
+ dividerAbove: false,
4535
+ id: "git.commitWithoutSync",
4536
+ run: () => {
4537
+ doCommit();
4538
+ },
4539
+ title: "Commit (don't sync)"
4540
+ }
4541
+ ]
4542
+ });
4543
+ });
4544
+ }
4545
+ function selectTab(tab) {
4546
+ shell.git.subTab = tab;
4547
+ if (tab === "history" && !shell.git.logEntries) {
4548
+ fetchGitLog();
4549
+ }
4550
+ }
4551
+ var ACTIONS = {
4552
+ chooseBranch: (value) => {
4553
+ chooseBranch(value);
4554
+ },
4555
+ clone: () => {
4556
+ _deps.cloneRepository?.();
4557
+ },
4558
+ commit: () => {
4559
+ doCommit();
4560
+ },
4561
+ commitAndSync: () => {
4562
+ doCommitAndSync();
4563
+ },
4564
+ createRepository: () => {
4565
+ createGithubRepository({ projectName: projectState?.name || "my-project" });
4566
+ },
4567
+ discard: (path) => {
4568
+ discardFile(path);
4569
+ },
4570
+ editMessage: (value) => {
4571
+ shell.git.commitMessage = value;
4572
+ },
4573
+ fetch: () => {
4574
+ gitAction("gitFetch");
4575
+ },
4576
+ initRepository: () => {
4577
+ initRepository();
4578
+ },
4579
+ openCommitMenu,
4580
+ openFile: (path) => {
4581
+ openFileComparison(path);
4582
+ },
4583
+ pull: () => {
4584
+ doPull();
4585
+ },
4586
+ push: () => {
4587
+ gitAction("gitPush");
4588
+ },
4589
+ refresh: () => {
4590
+ refreshGitStatus2();
4591
+ },
4592
+ selectTab,
4593
+ stage: (path) => {
4594
+ gitAction("gitStage", [path]);
4595
+ },
4596
+ stageAll: () => {
4597
+ const paths = (shell.git.status?.files ?? []).filter((file) => !file.staged).map((file) => file.path);
4598
+ gitAction("gitStage", paths);
4599
+ },
4600
+ unstage: (path) => {
4601
+ gitAction("gitUnstage", [path]);
4602
+ },
4603
+ unstageAll: () => {
4604
+ const paths = (shell.git.status?.files ?? []).filter((file) => file.staged).map((file) => file.path);
4605
+ gitAction("gitUnstage", paths);
4606
+ }
4607
+ };
4608
+ var _standing = null;
4609
+ function unmountStanding() {
4610
+ if (!_standing) {
4611
+ return;
4612
+ }
4613
+ _standing.scope.stop();
4614
+ _standing.handle.dispose();
4615
+ _standing = null;
4616
+ }
4617
+ function syncGitPanel() {
4618
+ _standing?.handle.update(gitPanelValues());
4619
+ }
4620
+ function armPoll() {
4621
+ if (_pollTimer) {
4622
+ return;
4623
+ }
4624
+ _pollTimer = setInterval(() => {
4625
+ if (shell.leftTab === "git" && !shell.git.loading) {
4626
+ refreshGitStatus2();
4627
+ }
4628
+ }, POLL_GIT);
4629
+ }
4630
+ function mountGitPanel(host, deps) {
4631
+ _deps = deps;
4632
+ const container = host.querySelector(".panel-content") ?? host;
4633
+ if (hasPlatform2() && panelView() === "loading") {
4634
+ refreshGitStatus2();
4635
+ }
4636
+ if (_standing && (_standing.host !== container || !_standing.handle.connected())) {
4637
+ unmountStanding();
4638
+ }
4639
+ if (_standing) {
4640
+ return;
4641
+ }
4642
+ const handle = mountGitPanelSurface(container, gitPanelValues(), ACTIONS);
4643
+ const scope = effectScope();
4644
+ scope.run(() => {
4645
+ effect(() => {
4646
+ const values = gitPanelValues();
4647
+ if (values.view === "repo") {
4648
+ armPoll();
4649
+ }
4650
+ handle.update(values);
4651
+ });
4652
+ });
4653
+ _standing = { handle, host: container, scope };
4654
+ }
4655
+ function renderGitPanel2(_against) {
4656
+ return nothing2;
4657
+ }
4658
+ function relativeDate(iso) {
4659
+ const d = new Date(iso);
4660
+ const diff = now() - d.getTime();
4661
+ const mins = Math.floor(diff / 60000);
4662
+ if (mins < 1) {
4663
+ return "just now";
4664
+ }
4665
+ if (mins < 60) {
4666
+ return `${mins}m ago`;
4667
+ }
4668
+ const hours = Math.floor(mins / 60);
4669
+ if (hours < 24) {
4670
+ return `${hours}h ago`;
4671
+ }
4672
+ const days = Math.floor(hours / 24);
4673
+ if (days < 30) {
4674
+ return `${days}d ago`;
4675
+ }
4676
+ return d.toLocaleDateString();
4677
+ }
4678
+ function sourceControlCommands() {
4679
+ return [
4680
+ {
4681
+ category: "Source Control",
4682
+ id: "git.init",
4683
+ level: "project",
4684
+ menus: ["commandbar/overflow", "palette"],
4685
+ group: "7_scm",
4686
+ requires: "an open project that git is not already tracking",
4687
+ when: (ctx) => ctx.project.open,
4688
+ enablement: (ctx) => !ctx.project.isRepo,
4689
+ run: async () => {
4690
+ await initRepository();
4691
+ },
4692
+ title: "Initialize Repository"
4693
+ },
4694
+ {
4695
+ category: "Source Control",
4696
+ id: "git.createGithubRepository",
4697
+ level: "project",
4698
+ menus: ["commandbar/overflow", "palette"],
4699
+ group: "7_scm",
4700
+ requires: "a project tracked by git",
4701
+ when: (ctx) => ctx.project.open,
4702
+ enablement: (ctx) => ctx.project.isRepo,
4703
+ run: async () => {
4704
+ await createGithubRepository({ projectName: projectState?.name || "my-project" });
4705
+ },
4706
+ title: "Create GitHub Repository"
4707
+ },
4708
+ {
4709
+ category: "Source Control",
4710
+ id: "git.push",
4711
+ level: "project",
4712
+ menus: ["commandbar/overflow", "palette"],
4713
+ group: "7_scm",
4714
+ requires: "a project tracked by git",
4715
+ when: (ctx) => ctx.project.open,
4716
+ enablement: (ctx) => ctx.project.isRepo,
4717
+ run: async () => {
4718
+ await pushCurrentBranch();
4719
+ },
4720
+ title: "Push"
4721
+ },
4722
+ {
4723
+ category: "Source Control",
4724
+ id: "git.signInToGithub",
4725
+ level: "application",
4726
+ menus: ["palette"],
4727
+ group: "7_scm",
4728
+ run: async () => {
4729
+ await signInToGithub();
4730
+ },
4731
+ title: "Sign In to GitHub"
4732
+ }
4733
+ ];
4734
+ }
4735
+ function registerSourceControlCommands2(registry) {
4736
+ registry.registerAll(sourceControlCommands());
4737
+ }
4738
+ function cleanupGitPanel2() {
4739
+ if (_pollTimer) {
4740
+ clearInterval(_pollTimer);
4741
+ _pollTimer = null;
4742
+ }
4743
+ unmountStanding();
4744
+ }
4745
+ function registerGitPanel2() {
4746
+ registerPanel({
4747
+ id: "git",
4748
+ title: "Source Control",
4749
+ level: "project",
4750
+ dock: "navigator",
4751
+ icon: "git-branch",
4752
+ badge: (ctx) => ctx.git.dirtyCount || null,
4753
+ render: () => nothing2,
4754
+ afterRender: (ctx, host) => {
4755
+ mountGitPanel(host, ctx.deps);
4756
+ }
4757
+ });
4758
+ }
4759
+
4760
+ export { hydrateProjectList, getProjectList, registerGridProbe, shouldInstallAutomation, installAutomationHook, stripRange, isUpgrade, maybePromptJxsuiteUpdate, autoSyncProjectOnOpen, mediaPaneMounted, detachMediaPane, renderMediaMode, isViewableMedia, openMediaTab, canRenderComparison, refreshGitStatus2, noteFileSaved2, cloneRepository2, platformSupportsClone2, loadDiffForLens2, renderGitPanel2, registerSourceControlCommands2, cleanupGitPanel2, registerGitPanel2 };
4761
+
4762
+ //# debugId=C2AF7BC5F2DB186C64756E2164756E21
4763
+ //# sourceMappingURL=studio-pm6hgy7r.js.map