@jxsuite/studio 2.0.0 → 2.1.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 (419) hide show
  1. package/canvas.html +21 -0
  2. package/dist/chunks/Overlay.dev-qfjzkms8.js +23 -0
  3. package/dist/chunks/{Overlay.dev-cszx7yn5.js.map → Overlay.dev-qfjzkms8.js.map} +1 -1
  4. package/dist/chunks/{adapter-z8fkmbmv.js → adapter-qfnesn5v.js} +2 -2
  5. package/dist/chunks/{cf-settings-mmyv436d.js → cf-settings-73sh5z4p.js} +3 -3
  6. package/dist/chunks/{components-0hzentwq.js → components-2bpqp4mq.js} +5 -7
  7. package/dist/chunks/{components-0hzentwq.js.map → components-2bpqp4mq.js.map} +1 -1
  8. package/dist/chunks/content-source-34gnkbnn.js +38 -0
  9. package/dist/chunks/content-source-34gnkbnn.js.map +9 -0
  10. package/dist/chunks/convert-to-repeater-t8kxre5s.js +258 -0
  11. package/dist/chunks/convert-to-repeater-t8kxre5s.js.map +10 -0
  12. package/dist/chunks/extension-sections-6mqydz35.js +301 -0
  13. package/dist/chunks/extension-sections-6mqydz35.js.map +11 -0
  14. package/dist/chunks/files-8kn321h1.js +70 -0
  15. package/dist/chunks/files-8kn321h1.js.map +9 -0
  16. package/dist/chunks/{format-host-2c188n41.js → format-host-mkwsmt8d.js} +3 -3
  17. package/dist/chunks/git-panel-tjbr191d.js +51 -0
  18. package/dist/chunks/git-panel-tjbr191d.js.map +9 -0
  19. package/dist/chunks/{index-baeg2x3y.js → index-7pxchcce.js} +4 -3
  20. package/dist/chunks/{index-baeg2x3y.js.map → index-7pxchcce.js.map} +3 -3
  21. package/dist/chunks/{jx-validate-qx8degj7.js → jx-validate-v6qgknrs.js} +3 -3
  22. package/dist/chunks/layers-panel-87pb25km.js +58 -0
  23. package/dist/chunks/layers-panel-87pb25km.js.map +9 -0
  24. package/dist/chunks/{monaco-setup-zjdp9zdw.js → monaco-setup-e0yh25j4.js} +4 -75
  25. package/dist/chunks/{monaco-setup-zjdp9zdw.js.map → monaco-setup-e0yh25j4.js.map} +3 -4
  26. package/dist/chunks/publish-panel-m0fcgdrt.js +21 -0
  27. package/dist/chunks/publish-panel-m0fcgdrt.js.map +9 -0
  28. package/dist/chunks/quick-search-rhs6cbsb.js +53 -0
  29. package/dist/chunks/quick-search-rhs6cbsb.js.map +9 -0
  30. package/dist/chunks/right-panel-zpdxd98t.js +37 -0
  31. package/dist/chunks/right-panel-zpdxd98t.js.map +9 -0
  32. package/dist/chunks/section-registry-zmckaxf4.js +30 -0
  33. package/dist/chunks/section-registry-zmckaxf4.js.map +9 -0
  34. package/dist/chunks/sp-overlay.dev-9ran0sfq.js +18 -0
  35. package/dist/chunks/sp-overlay.dev-9ran0sfq.js.map +9 -0
  36. package/dist/chunks/sp-popover.dev-rebmdncr.js +9 -0
  37. package/dist/chunks/sp-popover.dev-rebmdncr.js.map +9 -0
  38. package/dist/chunks/sp-progress-circle.dev-5vkppfkt.js +15 -0
  39. package/dist/chunks/sp-progress-circle.dev-5vkppfkt.js.map +9 -0
  40. package/dist/chunks/sp-tooltip.dev-ykqrg8h5.js +15 -0
  41. package/dist/chunks/sp-tooltip.dev-ykqrg8h5.js.map +9 -0
  42. package/dist/chunks/{sp-tray.dev-pb2fsd65.js → sp-tray.dev-ey59vfh7.js} +10 -8
  43. package/dist/chunks/{sp-tray.dev-pb2fsd65.js.map → sp-tray.dev-ey59vfh7.js.map} +2 -2
  44. package/dist/chunks/{studio-9qr6fq7p.js → studio-0rqqhrdy.js} +10 -378
  45. package/dist/chunks/{studio-9qr6fq7p.js.map → studio-0rqqhrdy.js.map} +4 -14
  46. package/dist/chunks/{studio-5x6tqqec.js → studio-2sj1jj3v.js} +10 -8
  47. package/dist/chunks/{studio-5x6tqqec.js.map → studio-2sj1jj3v.js.map} +2 -2
  48. package/dist/chunks/{studio-h3fw0wn8.js → studio-3fk1ac9z.js} +6 -4
  49. package/dist/chunks/{studio-h3fw0wn8.js.map → studio-3fk1ac9z.js.map} +2 -2
  50. package/dist/chunks/studio-41exgzhq.js +6690 -0
  51. package/dist/chunks/studio-41exgzhq.js.map +38 -0
  52. package/dist/chunks/{studio-7v2bpweq.js → studio-4mqb9a0j.js} +6 -4
  53. package/dist/chunks/{studio-7v2bpweq.js.map → studio-4mqb9a0j.js.map} +2 -2
  54. package/dist/chunks/studio-50k77cca.js +1787 -0
  55. package/dist/chunks/studio-50k77cca.js.map +18 -0
  56. package/dist/chunks/{studio-56v3zwk6.js → studio-6a0h7sne.js} +10 -8
  57. package/dist/chunks/{studio-56v3zwk6.js.map → studio-6a0h7sne.js.map} +2 -2
  58. package/dist/chunks/studio-6f0am8f2.js +53 -0
  59. package/dist/chunks/studio-6f0am8f2.js.map +10 -0
  60. package/dist/chunks/studio-6nmjc5qk.js +7002 -0
  61. package/dist/chunks/studio-6nmjc5qk.js.map +32 -0
  62. package/dist/chunks/studio-7afd21nw.js +67 -0
  63. package/dist/chunks/studio-7afd21nw.js.map +10 -0
  64. package/dist/chunks/{studio-xze4zrs1.js → studio-7bmdvzne.js} +2 -2
  65. package/dist/chunks/studio-7bmdvzne.js.map +10 -0
  66. package/dist/chunks/studio-8jpzqk5s.js +128 -0
  67. package/dist/chunks/studio-8jpzqk5s.js.map +10 -0
  68. package/dist/chunks/studio-94m77tgk.js +1482 -0
  69. package/dist/chunks/studio-94m77tgk.js.map +13 -0
  70. package/dist/chunks/studio-9je6w5sq.js +1000 -0
  71. package/dist/chunks/studio-9je6w5sq.js.map +16 -0
  72. package/dist/chunks/{studio-w7c6kvk7.js → studio-a7pzveq1.js} +2 -2
  73. package/dist/chunks/{studio-97qcgvdn.js → studio-adn0z1k3.js} +14 -8
  74. package/dist/chunks/{studio-97qcgvdn.js.map → studio-adn0z1k3.js.map} +3 -3
  75. package/dist/chunks/{studio-kr88ryr7.js → studio-bsxxx3x2.js} +17 -15
  76. package/dist/chunks/{studio-kr88ryr7.js.map → studio-bsxxx3x2.js.map} +7 -6
  77. package/dist/chunks/studio-bw5dz6km.js +608 -0
  78. package/dist/chunks/studio-bw5dz6km.js.map +21 -0
  79. package/dist/chunks/studio-c6s5getc.js +4232 -0
  80. package/dist/chunks/studio-c6s5getc.js.map +39 -0
  81. package/dist/chunks/studio-cjm7fdjf.js +451 -0
  82. package/dist/chunks/studio-cjm7fdjf.js.map +14 -0
  83. package/dist/chunks/{studio-cx91mnh8.js → studio-ckwz4d3x.js} +53 -53
  84. package/dist/chunks/{studio-cx91mnh8.js.map → studio-ckwz4d3x.js.map} +5 -5
  85. package/dist/chunks/studio-dg7zyt5x.js +28 -0
  86. package/dist/chunks/studio-dg7zyt5x.js.map +10 -0
  87. package/dist/chunks/studio-dzcyvvvz.js +166 -0
  88. package/dist/chunks/studio-dzcyvvvz.js.map +10 -0
  89. package/dist/chunks/{studio-7kqe41sa.js → studio-evkr5d3b.js} +15 -7
  90. package/dist/chunks/{studio-7kqe41sa.js.map → studio-evkr5d3b.js.map} +5 -4
  91. package/dist/chunks/studio-f12h6177.js +411 -0
  92. package/dist/chunks/studio-f12h6177.js.map +13 -0
  93. package/dist/chunks/studio-hbp1s8m9.js +1817 -0
  94. package/dist/chunks/studio-hbp1s8m9.js.map +14 -0
  95. package/dist/chunks/studio-k2sxjph5.js +15295 -0
  96. package/dist/chunks/studio-k2sxjph5.js.map +235 -0
  97. package/dist/chunks/studio-myje51t3.js +385 -0
  98. package/dist/chunks/studio-myje51t3.js.map +12 -0
  99. package/dist/chunks/studio-na6rwzhw.js +353 -0
  100. package/dist/chunks/studio-na6rwzhw.js.map +11 -0
  101. package/dist/chunks/{studio-4k0m4fmp.js → studio-p471gg5n.js} +126 -3
  102. package/dist/chunks/studio-p471gg5n.js.map +14 -0
  103. package/dist/chunks/{studio-9bjwf0d4.js → studio-rgwcpast.js} +5 -46
  104. package/dist/chunks/{studio-9bjwf0d4.js.map → studio-rgwcpast.js.map} +4 -5
  105. package/dist/chunks/{studio-hhj92gcr.js → studio-s519zc99.js} +3 -3
  106. package/dist/chunks/studio-sas7mt3k.js +75 -0
  107. package/dist/chunks/studio-sas7mt3k.js.map +10 -0
  108. package/dist/chunks/studio-t5wqwzdh.js +74 -0
  109. package/dist/chunks/studio-t5wqwzdh.js.map +10 -0
  110. package/dist/chunks/{studio-9qpspwfn.js → studio-temv5bw4.js} +5 -5
  111. package/dist/chunks/{studio-9qpspwfn.js.map → studio-temv5bw4.js.map} +1 -1
  112. package/dist/chunks/{studio-qkvt37c0.js → studio-tr20m8g8.js} +669 -18
  113. package/dist/chunks/studio-tr20m8g8.js.map +9 -0
  114. package/dist/chunks/{studio-ygzav7z5.js → studio-v96qfnww.js} +5514 -4291
  115. package/dist/chunks/studio-v96qfnww.js.map +54 -0
  116. package/dist/chunks/studio-vcetc91k.js +659 -0
  117. package/dist/chunks/studio-vcetc91k.js.map +10 -0
  118. package/dist/chunks/{studio-n9zmpxjg.js → studio-vmymjefp.js} +2972 -4937
  119. package/dist/chunks/studio-vmymjefp.js.map +98 -0
  120. package/dist/chunks/{studio-bghqfmea.js → studio-wwseqyw0.js} +2 -2
  121. package/dist/chunks/studio-x9hmy5kr.js +390 -0
  122. package/dist/chunks/studio-x9hmy5kr.js.map +10 -0
  123. package/dist/chunks/studio-xa0ce0n7.js +335 -0
  124. package/dist/chunks/studio-xa0ce0n7.js.map +10 -0
  125. package/dist/chunks/studio-xm3dbxvn.js +378 -0
  126. package/dist/chunks/studio-xm3dbxvn.js.map +19 -0
  127. package/dist/chunks/{studio-nqw433kv.js → studio-xmvbhg31.js} +2 -2
  128. package/dist/chunks/studio-zv37yrfa.js +1054 -0
  129. package/dist/chunks/studio-zv37yrfa.js.map +13 -0
  130. package/dist/chunks/{ws-client-q7hkz3j9.js → ws-client-654ts66j.js} +6 -4
  131. package/dist/chunks/ws-client-654ts66j.js.map +11 -0
  132. package/dist/iframe-entry.js +668 -230
  133. package/dist/studio.js +23711 -35185
  134. package/index.html +35 -4685
  135. package/package.json +17 -15
  136. package/src/about/about-modal.ts +42 -11
  137. package/src/browse/library-commands.ts +240 -0
  138. package/src/browse/library-layouts.ts +369 -0
  139. package/src/browse/library-model.ts +396 -0
  140. package/src/browse/library-pane.ts +1049 -0
  141. package/src/browse/library-preview.ts +252 -0
  142. package/src/browse/library-source.ts +150 -0
  143. package/src/canvas/canvas-helpers.ts +33 -9
  144. package/src/canvas/canvas-live-render.ts +45 -29
  145. package/src/canvas/canvas-patcher.ts +151 -31
  146. package/src/canvas/canvas-perf.ts +46 -7
  147. package/src/canvas/canvas-render.ts +1092 -220
  148. package/src/canvas/canvas-surface.ts +240 -0
  149. package/src/canvas/canvas-utils.ts +1166 -124
  150. package/src/canvas/iframe-drop.ts +2 -1
  151. package/src/canvas/iframe-entry.ts +241 -4
  152. package/src/canvas/iframe-host.ts +1226 -143
  153. package/src/canvas/iframe-inline-edit.ts +31 -0
  154. package/src/canvas/iframe-interaction.ts +76 -16
  155. package/src/canvas/iframe-keys.ts +107 -45
  156. package/src/canvas/iframe-overlay.ts +38 -1
  157. package/src/canvas/iframe-protocol.ts +137 -2
  158. package/src/canvas/iframe-render.ts +70 -2
  159. package/src/canvas/iframe-slash.ts +6 -0
  160. package/src/canvas/path-mapping.ts +56 -6
  161. package/src/canvas/surface-registry.ts +292 -0
  162. package/src/collab/collab-commands.ts +244 -0
  163. package/src/collab/collab-session.ts +198 -32
  164. package/src/collab/collab-state.ts +28 -2
  165. package/src/collab/presence-chips.ts +100 -9
  166. package/src/commands/active-registry.ts +42 -0
  167. package/src/commands/app-commands.ts +176 -0
  168. package/src/commands/budget.ts +158 -0
  169. package/src/commands/command-args.ts +253 -0
  170. package/src/commands/context.ts +387 -0
  171. package/src/commands/defaults.ts +580 -0
  172. package/src/commands/keymap.ts +571 -0
  173. package/src/commands/levels.ts +345 -0
  174. package/src/commands/live-context.ts +193 -0
  175. package/src/commands/reference.ts +227 -0
  176. package/src/commands/registry.ts +293 -0
  177. package/src/component-props.ts +3 -2
  178. package/src/content/draft-state.ts +106 -0
  179. package/src/content/entry-commands.ts +282 -0
  180. package/src/content/entry-editor.ts +327 -0
  181. package/src/content/entry-fields.ts +116 -0
  182. package/src/content/entry-model.ts +175 -0
  183. package/src/editor/canvas-context-menu.ts +17 -11
  184. package/src/editor/canvas-slash-bridge.ts +11 -4
  185. package/src/editor/context-menu.ts +804 -204
  186. package/src/editor/convert-to-component.ts +31 -10
  187. package/src/editor/convert-to-repeater.ts +3 -2
  188. package/src/editor/inline-edit-apply.ts +5 -5
  189. package/src/editor/inline-edit.ts +86 -50
  190. package/src/editor/insert-zone-action.ts +1 -1
  191. package/src/editor/shortcuts.ts +1043 -329
  192. package/src/editor/slash-menu.ts +1 -0
  193. package/src/files/elements.ts +166 -0
  194. package/src/files/file-ops.ts +178 -31
  195. package/src/files/files.ts +898 -268
  196. package/src/files/fs-events.ts +21 -0
  197. package/src/files/media-meta.ts +203 -0
  198. package/src/files/media-paths.ts +141 -0
  199. package/src/files/media-upload.ts +7 -3
  200. package/src/files/media-usage.ts +189 -0
  201. package/src/github/github-auth.ts +235 -33
  202. package/src/github/github-publish.ts +80 -21
  203. package/src/grid/grid-controller.ts +152 -12
  204. package/src/grid/grid-layout.ts +225 -20
  205. package/src/grid/grid-open.ts +120 -0
  206. package/src/grid/grid-panel.ts +554 -39
  207. package/src/grid/grid-source.ts +27 -1
  208. package/src/grid/redirects-grid.ts +599 -0
  209. package/src/grid/redirects.ts +398 -0
  210. package/src/grid/sources/content-source.ts +108 -2
  211. package/src/i18n/i18n-commands.ts +322 -0
  212. package/src/new-project/add-repo-modal.ts +8 -10
  213. package/src/new-project/import-tab.ts +34 -9
  214. package/src/new-project/location-fields.ts +9 -1
  215. package/src/new-project/new-project-modal.ts +270 -262
  216. package/src/packages/jxsuite-update.ts +97 -48
  217. package/src/packages/pull-package-sync.ts +18 -9
  218. package/src/page-params.ts +2 -1
  219. package/src/panels/activity-bar.ts +152 -91
  220. package/src/panels/activity-panel.ts +481 -0
  221. package/src/panels/ai-chat/chat-markdown.ts +8 -3
  222. package/src/panels/ai-chat/chat-view.ts +245 -18
  223. package/src/panels/ai-chat/composer.ts +31 -5
  224. package/src/panels/ai-chat/sessions-view.ts +17 -10
  225. package/src/panels/ai-panel.ts +279 -120
  226. package/src/panels/block-action-bar.ts +1115 -224
  227. package/src/panels/bottom-dock.ts +337 -0
  228. package/src/panels/canvas-dnd-bridge.ts +37 -8
  229. package/src/panels/chat-panel.ts +29 -12
  230. package/src/panels/data-explorer.ts +254 -112
  231. package/src/panels/data-grid.ts +10 -4
  232. package/src/panels/dnd.ts +28 -51
  233. package/src/panels/editors.ts +434 -107
  234. package/src/panels/elements-panel.ts +66 -2
  235. package/src/panels/empty-state.ts +112 -0
  236. package/src/panels/events-panel.ts +596 -82
  237. package/src/panels/formula-workspace.ts +408 -218
  238. package/src/panels/frontmatter-fields.ts +51 -10
  239. package/src/panels/frontmatter-panel.ts +357 -79
  240. package/src/panels/git-panel.ts +375 -164
  241. package/src/panels/head-panel.ts +791 -85
  242. package/src/panels/i18n-panel.ts +592 -0
  243. package/src/panels/imports-panel.ts +95 -85
  244. package/src/panels/jump-bar.ts +584 -0
  245. package/src/panels/layers-panel.ts +1106 -328
  246. package/src/panels/left-panel.ts +109 -204
  247. package/src/panels/navigator-panels.ts +131 -0
  248. package/src/panels/overlays.ts +7 -2
  249. package/src/panels/pane-context.ts +1477 -0
  250. package/src/panels/pane-grid.ts +406 -0
  251. package/src/panels/panel-registry.ts +340 -0
  252. package/src/panels/panel-scheduler.ts +75 -0
  253. package/src/panels/problems-panel.ts +234 -0
  254. package/src/panels/properties-panel.ts +946 -1139
  255. package/src/panels/provenance.ts +258 -0
  256. package/src/panels/quick-search.ts +791 -122
  257. package/src/panels/right-panel.ts +228 -102
  258. package/src/panels/seo-modal.ts +395 -0
  259. package/src/panels/settings-pane.ts +203 -0
  260. package/src/panels/signals-panel.ts +354 -137
  261. package/src/panels/statement-editor.ts +41 -25
  262. package/src/panels/statusbar.ts +342 -106
  263. package/src/panels/style-panel.ts +974 -463
  264. package/src/panels/style-utils.ts +3 -3
  265. package/src/panels/stylebook-doc.ts +4 -2
  266. package/src/panels/stylebook-layers-panel.ts +3 -2
  267. package/src/panels/stylebook-panel.ts +51 -26
  268. package/src/panels/tab-strip.ts +1058 -78
  269. package/src/panels/target-line.ts +274 -0
  270. package/src/panels/toolbar.ts +631 -484
  271. package/src/panels/welcome-screen.ts +301 -198
  272. package/src/platform-errors.ts +26 -3
  273. package/src/platform.ts +96 -2
  274. package/src/platforms/cloud.ts +71 -8
  275. package/src/platforms/devserver.ts +92 -29
  276. package/src/publish/deploy-checklist.ts +383 -0
  277. package/src/publish/pages-service.ts +10 -1
  278. package/src/publish/publish-commands.ts +218 -0
  279. package/src/publish/publish-panel.ts +110 -16
  280. package/src/recent-projects.ts +3 -2
  281. package/src/services/a11y-report.ts +505 -0
  282. package/src/services/ai-models.ts +75 -2
  283. package/src/services/ai-project-tools.ts +29 -10
  284. package/src/services/ai-system-prompt.ts +53 -14
  285. package/src/services/ai-tools.ts +39 -3
  286. package/src/services/ai-writes.ts +154 -0
  287. package/src/services/announce.ts +97 -0
  288. package/src/services/automation.ts +424 -175
  289. package/src/services/cem-export.ts +9 -4
  290. package/src/services/clock.ts +61 -0
  291. package/src/services/document-assistant.ts +36 -8
  292. package/src/services/idle.ts +179 -0
  293. package/src/services/import-client.ts +26 -0
  294. package/src/services/monaco-buffer.ts +627 -0
  295. package/src/services/monaco-lazy.ts +36 -0
  296. package/src/services/notify.ts +271 -0
  297. package/src/services/profile.ts +155 -0
  298. package/src/services/references.ts +0 -0
  299. package/src/services/token-lint.ts +3 -2
  300. package/src/services/tool-executor.ts +53 -7
  301. package/src/services/trusted-types.ts +123 -0
  302. package/src/settings/contexts-section.ts +427 -0
  303. package/src/settings/contributed-section.ts +149 -11
  304. package/src/settings/css-vars-editor.ts +306 -349
  305. package/src/settings/defs-editor.ts +93 -34
  306. package/src/settings/dependencies-editor.ts +7 -7
  307. package/src/settings/extension-sections.ts +37 -5
  308. package/src/settings/general-settings.ts +204 -121
  309. package/src/settings/locales-section.ts +347 -0
  310. package/src/settings/preferences-accounts.ts +140 -0
  311. package/src/settings/preferences-dialog.ts +620 -0
  312. package/src/settings/preferences-keymap.ts +270 -0
  313. package/src/settings/project-sections.ts +260 -0
  314. package/src/settings/section-registry.ts +169 -0
  315. package/src/settings/settings-document.ts +385 -0
  316. package/src/shell.ts +1549 -0
  317. package/src/site-context.ts +45 -20
  318. package/src/state.ts +14 -275
  319. package/src/store.ts +88 -43
  320. package/src/studio.ts +790 -346
  321. package/src/style/live-preview.ts +36 -0
  322. package/src/style/project-styles.ts +349 -0
  323. package/src/style/token-ref.ts +123 -0
  324. package/src/tabs/patch-ops.ts +16 -4
  325. package/src/tabs/project-config.ts +416 -0
  326. package/src/tabs/selection.ts +323 -0
  327. package/src/tabs/tab.ts +182 -47
  328. package/src/tabs/transact.ts +209 -28
  329. package/src/types.ts +68 -13
  330. package/src/ui/ai-credentials-form.ts +39 -35
  331. package/src/ui/ai-managed-connect.ts +113 -0
  332. package/src/ui/dynamic-slot.ts +224 -81
  333. package/src/ui/expression-editor.ts +71 -63
  334. package/src/ui/field-input.ts +4 -6
  335. package/src/ui/field-row.ts +215 -38
  336. package/src/ui/form-controls.ts +194 -7
  337. package/src/ui/layers.ts +492 -69
  338. package/src/ui/media-picker.ts +115 -25
  339. package/src/ui/panel-resize.ts +109 -91
  340. package/src/ui/progress-modal.ts +131 -50
  341. package/src/ui/regions.ts +462 -0
  342. package/src/ui/schema-form.ts +229 -45
  343. package/src/ui/spectrum.ts +24 -8
  344. package/src/ui/timing.ts +49 -0
  345. package/src/ui/value-selector.ts +20 -0
  346. package/src/ui/value-source.ts +348 -0
  347. package/src/ui/virtual-window.ts +400 -0
  348. package/src/utils/edit-display.ts +3 -2
  349. package/src/utils/inherited-style.ts +67 -37
  350. package/src/view.ts +64 -78
  351. package/src/workspace/pane-derive.ts +1258 -0
  352. package/src/workspace/session.ts +317 -0
  353. package/src/workspace/workspace.ts +1345 -23
  354. package/styles/canvas.css +653 -0
  355. package/styles/forced-colors.css +106 -0
  356. package/styles/inspector.css +1454 -0
  357. package/styles/overlays.css +2704 -0
  358. package/styles/panels.css +1701 -0
  359. package/styles/shell.css +1423 -0
  360. package/styles/tokens.css +151 -0
  361. package/dist/chunks/Overlay.dev-cszx7yn5.js +0 -22
  362. package/dist/chunks/extension-sections-qct0gt8f.js +0 -531
  363. package/dist/chunks/extension-sections-qct0gt8f.js.map +0 -12
  364. package/dist/chunks/files-02zn5y24.js +0 -50
  365. package/dist/chunks/files-02zn5y24.js.map +0 -9
  366. package/dist/chunks/git-panel-mbb0y0hz.js +0 -28
  367. package/dist/chunks/git-panel-mbb0y0hz.js.map +0 -9
  368. package/dist/chunks/layers-panel-9qekmqk1.js +0 -26
  369. package/dist/chunks/layers-panel-9qekmqk1.js.map +0 -9
  370. package/dist/chunks/settings-modal-gj0hrah4.js +0 -29
  371. package/dist/chunks/settings-modal-gj0hrah4.js.map +0 -9
  372. package/dist/chunks/sp-overlay.dev-earn5as8.js +0 -17
  373. package/dist/chunks/sp-overlay.dev-earn5as8.js.map +0 -9
  374. package/dist/chunks/sp-popover.dev-frxtfejn.js +0 -8
  375. package/dist/chunks/sp-popover.dev-frxtfejn.js.map +0 -9
  376. package/dist/chunks/sp-progress-circle.dev-7tvw34h8.js +0 -14
  377. package/dist/chunks/sp-progress-circle.dev-7tvw34h8.js.map +0 -9
  378. package/dist/chunks/sp-tooltip.dev-a9fywesm.js +0 -21
  379. package/dist/chunks/sp-tooltip.dev-a9fywesm.js.map +0 -10
  380. package/dist/chunks/studio-4k0m4fmp.js.map +0 -13
  381. package/dist/chunks/studio-568nx4t5.js +0 -469
  382. package/dist/chunks/studio-568nx4t5.js.map +0 -14
  383. package/dist/chunks/studio-9smfzqhc.js +0 -19
  384. package/dist/chunks/studio-9smfzqhc.js.map +0 -10
  385. package/dist/chunks/studio-asvf0j9e.js +0 -429
  386. package/dist/chunks/studio-asvf0j9e.js.map +0 -13
  387. package/dist/chunks/studio-d77qm3pk.js +0 -3427
  388. package/dist/chunks/studio-d77qm3pk.js.map +0 -26
  389. package/dist/chunks/studio-j6gqyjf4.js +0 -1854
  390. package/dist/chunks/studio-j6gqyjf4.js.map +0 -18
  391. package/dist/chunks/studio-n9zmpxjg.js.map +0 -115
  392. package/dist/chunks/studio-qkvt37c0.js.map +0 -9
  393. package/dist/chunks/studio-rq0vxb19.js +0 -3744
  394. package/dist/chunks/studio-rq0vxb19.js.map +0 -22
  395. package/dist/chunks/studio-wd6ewdvd.js +0 -853
  396. package/dist/chunks/studio-wd6ewdvd.js.map +0 -12
  397. package/dist/chunks/studio-xq0t7n5t.js +0 -140
  398. package/dist/chunks/studio-xq0t7n5t.js.map +0 -10
  399. package/dist/chunks/studio-xze4zrs1.js.map +0 -10
  400. package/dist/chunks/studio-ygzav7z5.js.map +0 -46
  401. package/dist/chunks/studio-zmy7241e.js +0 -399
  402. package/dist/chunks/studio-zmy7241e.js.map +0 -12
  403. package/dist/chunks/ws-client-q7hkz3j9.js.map +0 -11
  404. package/src/browse/browse-modal.ts +0 -69
  405. package/src/browse/browse.ts +0 -904
  406. package/src/canvas/canvas-diff.ts +0 -216
  407. package/src/canvas/nested-site-style.ts +0 -58
  408. package/src/new-project/design-fields.ts +0 -264
  409. package/src/new-project/templates.ts +0 -61
  410. package/src/panels/tab-bar.ts +0 -548
  411. package/src/settings/settings-modal.ts +0 -203
  412. /package/dist/chunks/{adapter-z8fkmbmv.js.map → adapter-qfnesn5v.js.map} +0 -0
  413. /package/dist/chunks/{cf-settings-mmyv436d.js.map → cf-settings-73sh5z4p.js.map} +0 -0
  414. /package/dist/chunks/{format-host-2c188n41.js.map → format-host-mkwsmt8d.js.map} +0 -0
  415. /package/dist/chunks/{jx-validate-qx8degj7.js.map → jx-validate-v6qgknrs.js.map} +0 -0
  416. /package/dist/chunks/{studio-w7c6kvk7.js.map → studio-a7pzveq1.js.map} +0 -0
  417. /package/dist/chunks/{studio-hhj92gcr.js.map → studio-s519zc99.js.map} +0 -0
  418. /package/dist/chunks/{studio-bghqfmea.js.map → studio-wwseqyw0.js.map} +0 -0
  419. /package/dist/chunks/{studio-nqw433kv.js.map → studio-xmvbhg31.js.map} +0 -0
@@ -0,0 +1,1787 @@
1
+ import {
2
+ pendingSchedulers
3
+ } from "./studio-8jpzqk5s.js";
4
+ import {
5
+ live
6
+ } from "./studio-xmvbhg31.js";
7
+ import {
8
+ activityIdleBlockers,
9
+ beginActivity,
10
+ showProgressModal
11
+ } from "./studio-na6rwzhw.js";
12
+ import {
13
+ canvasIdleBlockers,
14
+ canvasPointAt,
15
+ registerPanel,
16
+ renderEmptyState,
17
+ revealCanvasPath
18
+ } from "./studio-v96qfnww.js";
19
+ import {
20
+ activeTab,
21
+ collabState,
22
+ errorMessage,
23
+ flushAllCollab,
24
+ notify,
25
+ now,
26
+ overlayIdleBlockers,
27
+ shell,
28
+ showConfirmDialog,
29
+ showDialog,
30
+ showPromptDialog
31
+ } from "./studio-41exgzhq.js";
32
+ import {
33
+ ref,
34
+ repeat
35
+ } from "./studio-p471gg5n.js";
36
+ import {
37
+ html,
38
+ nothing
39
+ } from "./studio-5x5774ak.js";
40
+ import {
41
+ POLL_GIT,
42
+ projectState,
43
+ render,
44
+ rendersInFlight
45
+ } from "./studio-cjm7fdjf.js";
46
+ import {
47
+ formatForPath
48
+ } from "./studio-adn0z1k3.js";
49
+ import {
50
+ getPlatform,
51
+ hasPlatform,
52
+ platformInFlight
53
+ } from "./studio-sas7mt3k.js";
54
+ import {
55
+ __require
56
+ } from "./studio-md4gps17.js";
57
+
58
+ // src/github/github-auth.ts
59
+ var CLIENT_ID = "Ov23liYVlMFpgjOEPXJH";
60
+ var STORAGE_KEY = "jx_github_token";
61
+ function nativeAuth() {
62
+ return globalThis.__jxPlatform?.githubAuth ?? null;
63
+ }
64
+ var nativeToken = null;
65
+ var nativeStored = false;
66
+ function githubTokenStored() {
67
+ return nativeToken !== null || nativeStored || localStorage.getItem(STORAGE_KEY) !== null;
68
+ }
69
+ function githubTokenLocation() {
70
+ return nativeAuth() ? "desktop" : "browser";
71
+ }
72
+ var NOTIFY_KEY = "github.auth";
73
+ var SOURCE = "Source Control";
74
+ var RETRY = "git.signInToGithub";
75
+ var MAX_POLL_FAILURES = 3;
76
+ var UNREACHABLE_DETAIL = "The request never reached GitHub. GitHub's device-flow endpoints send no CORS headers, so a " + "browser cannot call them directly — the desktop app can. A machine that is offline fails " + "identically, and the browser does not say which happened.";
77
+ function getGithubToken() {
78
+ return nativeToken ?? localStorage.getItem(STORAGE_KEY);
79
+ }
80
+ function clearGithubToken() {
81
+ nativeToken = null;
82
+ nativeStored = false;
83
+ localStorage.removeItem(STORAGE_KEY);
84
+ nativeAuth()?.signOut().catch(() => {});
85
+ }
86
+ function reportUnreachable(error) {
87
+ notify.error("Could not reach GitHub to sign in.", {
88
+ action: RETRY,
89
+ detail: `${UNREACHABLE_DETAIL}
90
+
91
+ ${errorMessage(error)}`,
92
+ key: NOTIFY_KEY,
93
+ source: SOURCE
94
+ });
95
+ }
96
+ function reportRefused(message, detail) {
97
+ notify.warn(message, { action: RETRY, detail, key: NOTIFY_KEY, source: SOURCE });
98
+ }
99
+ async function requestDeviceCode() {
100
+ let codeRes;
101
+ try {
102
+ codeRes = await fetch("https://github.com/login/device/code", {
103
+ body: JSON.stringify({ client_id: CLIENT_ID, scope: "repo" }),
104
+ headers: {
105
+ Accept: "application/json",
106
+ "Content-Type": "application/json"
107
+ },
108
+ method: "POST"
109
+ });
110
+ } catch (error) {
111
+ reportUnreachable(error);
112
+ return null;
113
+ }
114
+ if (!codeRes.ok) {
115
+ reportRefused("GitHub refused to start the sign-in.", `GitHub answered ${codeRes.status}${codeRes.statusText ? ` ${codeRes.statusText}` : ""}.`);
116
+ return null;
117
+ }
118
+ return await codeRes.json();
119
+ }
120
+ async function authenticateGithub() {
121
+ const existing = getGithubToken();
122
+ if (existing) {
123
+ return existing;
124
+ }
125
+ const native = nativeAuth();
126
+ if (native) {
127
+ try {
128
+ const { token } = await native.signIn();
129
+ nativeToken = token;
130
+ return token;
131
+ } catch (error) {
132
+ reportRefused("GitHub sign-in was not completed.", errorMessage(error));
133
+ return null;
134
+ }
135
+ }
136
+ const codeData = await requestDeviceCode();
137
+ if (!codeData) {
138
+ return null;
139
+ }
140
+ const { device_code, user_code, verification_uri, interval = 5 } = codeData;
141
+ return showDialog((done) => {
142
+ let cancelled = false;
143
+ let pollTimer = null;
144
+ let failures = 0;
145
+ const stop = () => {
146
+ cancelled = true;
147
+ if (pollTimer) {
148
+ clearTimeout(pollTimer);
149
+ }
150
+ done(null);
151
+ };
152
+ const poll = async () => {
153
+ if (cancelled) {
154
+ return;
155
+ }
156
+ try {
157
+ const tokenRes = await fetch("https://github.com/login/oauth/access_token", {
158
+ body: JSON.stringify({
159
+ client_id: CLIENT_ID,
160
+ device_code,
161
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
162
+ }),
163
+ headers: {
164
+ Accept: "application/json",
165
+ "Content-Type": "application/json"
166
+ },
167
+ method: "POST"
168
+ });
169
+ const tokenData = await tokenRes.json();
170
+ failures = 0;
171
+ if (tokenData.access_token) {
172
+ localStorage.setItem(STORAGE_KEY, tokenData.access_token);
173
+ done(tokenData.access_token);
174
+ return;
175
+ }
176
+ if (tokenData.error === "authorization_pending") {
177
+ pollTimer = setTimeout(poll, interval * 1000);
178
+ return;
179
+ }
180
+ if (tokenData.error === "slow_down") {
181
+ pollTimer = setTimeout(poll, (interval + 5) * 1000);
182
+ return;
183
+ }
184
+ reportRefused("GitHub sign-in was not completed.", tokenData.error === "access_denied" ? "The authorization was declined on GitHub." : tokenData.error === "expired_token" ? "The device code expired before it was entered." : `GitHub answered "${tokenData.error ?? "an unrecognised response"}".`);
185
+ cancelled = true;
186
+ done(null);
187
+ } catch (error) {
188
+ failures += 1;
189
+ if (failures >= MAX_POLL_FAILURES) {
190
+ reportUnreachable(error);
191
+ cancelled = true;
192
+ done(null);
193
+ return;
194
+ }
195
+ pollTimer = setTimeout(poll, interval * 1000);
196
+ }
197
+ };
198
+ pollTimer = setTimeout(poll, interval * 1000);
199
+ return html`
200
+ <sp-dialog-wrapper
201
+ open
202
+ headline="Sign in to GitHub"
203
+ cancel-label="Cancel"
204
+ @cancel=${stop}
205
+ @close=${stop}
206
+ >
207
+ <div class="github-auth-dialog">
208
+ <p>Enter this code on GitHub to authorize Jx Studio:</p>
209
+ <div class="github-auth-code">${user_code}</div>
210
+ <p>
211
+ <a href="${verification_uri}" target="_blank" rel="noopener"
212
+ >Open ${verification_uri}</a
213
+ >
214
+ </p>
215
+ <p class="github-auth-waiting">Waiting for authorization…</p>
216
+ </div>
217
+ </sp-dialog-wrapper>
218
+ `;
219
+ });
220
+ }
221
+
222
+ // src/github/github-publish.ts
223
+ var REPO_STEPS = ["Create the repository", "Add the remote", "Push"];
224
+ async function createGithubRepository({ projectName }) {
225
+ const token = await authenticateGithub();
226
+ if (!token) {
227
+ return false;
228
+ }
229
+ const repoOpts = await showDialog((done) => {
230
+ let _nameInput = null;
231
+ let _descInput = null;
232
+ let _privateToggle = null;
233
+ return html`
234
+ <sp-dialog-wrapper
235
+ open
236
+ headline="Create GitHub Repository"
237
+ confirm-label="Create Repository"
238
+ cancel-label="Cancel"
239
+ @confirm=${() => {
240
+ done({
241
+ description: _descInput?.value || "",
242
+ isPrivate: _privateToggle?.checked ?? true,
243
+ name: _nameInput?.value || projectName
244
+ });
245
+ }}
246
+ @cancel=${() => done(null)}
247
+ @close=${() => done(null)}
248
+ >
249
+ <div class="github-publish-dialog">
250
+ <sp-field-label for="repo-name">Repository name</sp-field-label>
251
+ <sp-textfield
252
+ id="repo-name"
253
+ name="repo-name"
254
+ value="${projectName}"
255
+ placeholder="my-project"
256
+ ${ref((el) => {
257
+ _nameInput = el || null;
258
+ })}
259
+ ></sp-textfield>
260
+
261
+ <sp-field-label for="repo-desc">Description (optional)</sp-field-label>
262
+ <sp-textfield
263
+ id="repo-desc"
264
+ name="repo-desc"
265
+ placeholder="A brief description"
266
+ ${ref((el) => {
267
+ _descInput = el || null;
268
+ })}
269
+ ></sp-textfield>
270
+
271
+ <sp-field-label>Visibility</sp-field-label>
272
+ <sp-switch
273
+ name="repo-private"
274
+ checked
275
+ ${ref((el) => {
276
+ _privateToggle = el || null;
277
+ })}
278
+ >Private repository</sp-switch
279
+ >
280
+ </div>
281
+ </sp-dialog-wrapper>
282
+ `;
283
+ });
284
+ if (!repoOpts) {
285
+ return false;
286
+ }
287
+ const activity = beginActivity({
288
+ source: "Source Control",
289
+ status: `Creating ${repoOpts.name}…`,
290
+ steps: [...REPO_STEPS],
291
+ title: "Create GitHub repository"
292
+ });
293
+ activity.step(REPO_STEPS[0]);
294
+ const createRes = await fetch("https://api.github.com/user/repos", {
295
+ body: JSON.stringify({
296
+ auto_init: false,
297
+ description: repoOpts.description,
298
+ name: repoOpts.name,
299
+ private: repoOpts.isPrivate
300
+ }),
301
+ headers: {
302
+ Accept: "application/vnd.github+json",
303
+ Authorization: `Bearer ${token}`,
304
+ "Content-Type": "application/json"
305
+ },
306
+ method: "POST"
307
+ }).catch((error) => {
308
+ activity.log(errorMessage(error));
309
+ return null;
310
+ });
311
+ if (!createRes) {
312
+ activity.fail("Could not reach GitHub to create the repository.", {
313
+ action: "git.createGithubRepository"
314
+ });
315
+ return false;
316
+ }
317
+ if (!createRes.ok) {
318
+ const err = await createRes.json();
319
+ activity.log(err.errors?.[0]?.message || err.message || `GitHub answered ${createRes.status}.`);
320
+ activity.fail("Could not create the GitHub repository.", {
321
+ action: "git.createGithubRepository"
322
+ });
323
+ return false;
324
+ }
325
+ const repo = await createRes.json();
326
+ activity.log(`Created ${repo.html_url}`);
327
+ const platform = getPlatform();
328
+ activity.step(REPO_STEPS[1]);
329
+ try {
330
+ await platform.gitAddRemote("origin", repo.clone_url);
331
+ } catch (error) {
332
+ activity.log(errorMessage(error));
333
+ activity.fail("The repository was created, but the remote could not be added.", {
334
+ action: "panel.focus.git"
335
+ });
336
+ return false;
337
+ }
338
+ activity.step(REPO_STEPS[2]);
339
+ try {
340
+ await platform.gitPush({ setUpstream: true });
341
+ } catch (error) {
342
+ activity.log(errorMessage(error));
343
+ activity.fail("The repository was created, but the push failed.", {
344
+ action: "git.push"
345
+ });
346
+ return false;
347
+ }
348
+ const { refreshGitStatus } = await import("./git-panel-tjbr191d.js");
349
+ await refreshGitStatus();
350
+ activity.done(repo.html_url);
351
+ notify.success(`Repository created: ${repo.html_url}`, { key: "github.repo" });
352
+ return true;
353
+ }
354
+
355
+ // src/project-list.ts
356
+ var cache = [];
357
+ function platformListsProjects() {
358
+ return hasPlatform() && typeof getPlatform().listProjects === "function";
359
+ }
360
+ async function hydrateProjectList() {
361
+ if (!platformListsProjects()) {
362
+ cache = [];
363
+ return;
364
+ }
365
+ try {
366
+ cache = await getPlatform().listProjects?.() ?? [];
367
+ } catch {
368
+ cache = [];
369
+ }
370
+ }
371
+ function getProjectList() {
372
+ return cache;
373
+ }
374
+ function seedProjectList(entries) {
375
+ cache = entries;
376
+ }
377
+
378
+ // src/services/idle.ts
379
+ var QUIET_FRAMES = 2;
380
+ var DEFAULT_IDLE_TIMEOUT_MS = 1e4;
381
+
382
+ class NotIdleError extends Error {
383
+ blockedBy;
384
+ constructor(blockedBy, timeoutMs) {
385
+ 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("; ")}`);
386
+ this.name = "NotIdleError";
387
+ this.blockedBy = blockedBy;
388
+ }
389
+ }
390
+ function defaultIdleSources() {
391
+ return [
392
+ {
393
+ blockers: () => {
394
+ const count = rendersInFlight();
395
+ return count > 0 ? [`render: ${count} renderer(s) mid-paint`] : [];
396
+ },
397
+ name: "render"
398
+ },
399
+ {
400
+ blockers: () => pendingSchedulers().map((panel) => `panels: ${panel}`),
401
+ name: "panels"
402
+ },
403
+ { blockers: canvasIdleBlockers, name: "canvas" },
404
+ {
405
+ blockers: () => {
406
+ const calls = platformInFlight();
407
+ if (calls.length === 0) {
408
+ return [];
409
+ }
410
+ return [`platform: ${calls.length} in-flight (${[...new Set(calls)].join(", ")})`];
411
+ },
412
+ name: "platform"
413
+ },
414
+ { blockers: overlayIdleBlockers, name: "overlay" },
415
+ { blockers: activityIdleBlockers, name: "activity" }
416
+ ];
417
+ }
418
+ function idleBlockers(sources = defaultIdleSources()) {
419
+ const blockers = [];
420
+ for (const source of sources) {
421
+ blockers.push(...source.blockers());
422
+ }
423
+ return blockers;
424
+ }
425
+ function probeIdle(options = {}) {
426
+ const {
427
+ frames = QUIET_FRAMES,
428
+ now: now2 = () => Date.now(),
429
+ raf = (callback) => {
430
+ requestAnimationFrame(() => callback());
431
+ },
432
+ sources = defaultIdleSources(),
433
+ timeoutMs = DEFAULT_IDLE_TIMEOUT_MS
434
+ } = options;
435
+ return new Promise((resolve, reject) => {
436
+ const deadline = now2() + timeoutMs;
437
+ let quiet = 0;
438
+ let settled = false;
439
+ let lastBlockers = [];
440
+ const tick = () => {
441
+ if (settled) {
442
+ return;
443
+ }
444
+ const blockers = idleBlockers(sources);
445
+ if (blockers.length > 0) {
446
+ lastBlockers = blockers;
447
+ quiet = 0;
448
+ } else {
449
+ quiet += 1;
450
+ if (quiet >= frames) {
451
+ settled = true;
452
+ resolve();
453
+ return;
454
+ }
455
+ }
456
+ if (now2() >= deadline) {
457
+ settled = true;
458
+ reject(new NotIdleError(blockers.length > 0 ? blockers : lastBlockers, timeoutMs));
459
+ return;
460
+ }
461
+ raf(tick);
462
+ };
463
+ raf(tick);
464
+ });
465
+ }
466
+
467
+ // src/services/automation.ts
468
+ var TOGGLE_ID = /\.toggle[A-Z]/;
469
+ function setterFor(id) {
470
+ return id.replace(/\.toggle([A-Z])/, (_match, initial) => `.set${initial}`);
471
+ }
472
+ function isScriptable(command) {
473
+ return !TOGGLE_ID.test(command.id);
474
+ }
475
+ var AUTOMATION_COMMANDS = {
476
+ "file.contextMenu": {
477
+ disposition: "refused",
478
+ note: "opening a menu to press an item names a control; the ITEM is the command"
479
+ },
480
+ "layers.contextMenu": {
481
+ disposition: "refused",
482
+ note: "matched RENDERED TEXT, which §13's R1 forbids; P5.5 stamps data-jx-path on rows"
483
+ },
484
+ "media.browse": { disposition: "command", note: "P7.5 — media.browse" },
485
+ "project.showWelcome": {
486
+ disposition: "refused",
487
+ note: "cold start is a startup profile (?profile=fresh), not an action"
488
+ },
489
+ "settings.setSection": {
490
+ disposition: "refused",
491
+ note: `mirrored the section registry's LABELS; say settings.open { section: "cssVars" }`
492
+ },
493
+ "view.setStatus": {
494
+ disposition: "refused",
495
+ note: "the status bar is not staged — if a capture needs a calm shell, the app must BE calm"
496
+ }
497
+ };
498
+ var REFUSED_SEEDS = {
499
+ openSettings: 'a user opens Settings — run("settings.open")',
500
+ select: 'a user selects a node — run("selection.set", { path })',
501
+ setActivity: 'a user picks a Navigator panel — run("navigator.showPanel", { panel })',
502
+ setRightTab: 'a user picks an Inspector tab — run("inspector.setTab", { tab })',
503
+ setStatus: "the status bar reports what the app just did; staging it is the one lie §13.3 names outright",
504
+ setZoom: 'a user zooms — run("canvas.setZoom", { zoom })'
505
+ };
506
+ function arrayArg(args, key) {
507
+ const value = args[key];
508
+ if (value === undefined) {
509
+ return [];
510
+ }
511
+ if (!Array.isArray(value)) {
512
+ throw new TypeError(`seed argument "${key}" must be an array`);
513
+ }
514
+ return value;
515
+ }
516
+ function requiredArg(args, key) {
517
+ const value = args[key];
518
+ if (value === null || typeof value !== "object") {
519
+ throw new TypeError(`seed argument "${key}" must be an object`);
520
+ }
521
+ return value;
522
+ }
523
+ function optionalString(args, key) {
524
+ const value = args[key];
525
+ if (value === undefined) {
526
+ return;
527
+ }
528
+ if (typeof value !== "string") {
529
+ throw new TypeError(`seed argument "${key}" must be a string`);
530
+ }
531
+ return value;
532
+ }
533
+ function createSeeds(deps) {
534
+ return [
535
+ {
536
+ boundary: "the assistant's model stream",
537
+ id: "seed.assistant",
538
+ run: (args) => {
539
+ deps.seedAssistantMessages(arrayArg(args, "messages"));
540
+ }
541
+ },
542
+ {
543
+ boundary: "the collaboration websocket (awareness + sync)",
544
+ id: "seed.collab",
545
+ run: (args) => {
546
+ const tab = activeTab.value;
547
+ if (!tab) {
548
+ return;
549
+ }
550
+ const state = collabState(tab);
551
+ state.status = "synced";
552
+ state.active = true;
553
+ const peers = [];
554
+ for (const peer of arrayArg(args, "peers")) {
555
+ const peerState = { ...peer.state };
556
+ peerState.focusedPath ??= tab.documentPath;
557
+ peers.push({ ...peer, state: peerState });
558
+ }
559
+ state.peers = peers;
560
+ render();
561
+ }
562
+ },
563
+ {
564
+ boundary: "the Cloudflare Pages API",
565
+ id: "seed.publish",
566
+ run: (args) => {
567
+ const accountId = optionalString(args, "accountId");
568
+ deps.seedPublishConnected({
569
+ deployment: requiredArg(args, "deployment"),
570
+ ...accountId ? { accountId } : {}
571
+ });
572
+ }
573
+ },
574
+ {
575
+ boundary: "the platform's git routes (`gitStatus` / `gitBranches` / `gitLog`)",
576
+ id: "seed.git",
577
+ run: (args) => {
578
+ shell.git.status = args.status ?? null;
579
+ shell.git.branches = args.branches ?? null;
580
+ shell.git.logEntries = args.log ?? null;
581
+ shell.git.loading = false;
582
+ shell.git.error = null;
583
+ render();
584
+ }
585
+ },
586
+ {
587
+ boundary: "the platform's recent-projects store (desktop IPC / cloud API)",
588
+ id: "seed.projectList",
589
+ run: (args) => {
590
+ seedProjectList(arrayArg(args, "projects"));
591
+ render();
592
+ }
593
+ }
594
+ ];
595
+ }
596
+ class AutomationRefusedError extends Error {
597
+ id;
598
+ constructor(id, reason) {
599
+ super(`automation refuses "${id}" — ${reason}`);
600
+ this.name = "AutomationRefusedError";
601
+ this.id = id;
602
+ }
603
+ }
604
+ function scriptableCommands(registry) {
605
+ const projected = [];
606
+ for (const command of registry.visible()) {
607
+ if (!isScriptable(command)) {
608
+ continue;
609
+ }
610
+ const requires = registry.disabledReason(command.id);
611
+ const entry = {
612
+ enabled: requires === undefined,
613
+ id: command.id,
614
+ title: command.title
615
+ };
616
+ if (command.args) {
617
+ entry.args = command.args;
618
+ }
619
+ if (requires !== undefined) {
620
+ entry.requires = requires;
621
+ }
622
+ projected.push(entry);
623
+ }
624
+ return projected;
625
+ }
626
+ function unknownCommandMessage(id, registry, seeds) {
627
+ if (seeds.has(id)) {
628
+ return `"${id}" is a seed, not a command — call seed("${id}", …)`;
629
+ }
630
+ const gap = AUTOMATION_COMMANDS[id];
631
+ if (gap?.disposition === "refused") {
632
+ return `"${id}" is refused by spec §13.5: ${gap.note}`;
633
+ }
634
+ if (gap) {
635
+ return `"${id}" has no command record yet (${gap.note}) — __jxAutomation.run projects the registry and nothing else`;
636
+ }
637
+ const known = registry.list().filter((command) => isScriptable(command)).map((command) => command.id);
638
+ return `unknown command "${id}" — the registry declares ${known.length} scriptable id(s)`;
639
+ }
640
+ function createAutomationApi(deps) {
641
+ const seeds = new Map(createSeeds(deps).map((seed) => [seed.id, seed]));
642
+ const seedIdSet = new Set(seeds.keys());
643
+ return {
644
+ probe: {
645
+ commands: () => scriptableCommands(deps.registry),
646
+ idle: (options = {}) => probeIdle(options),
647
+ pointAt: (target) => canvasPointAt(target.path),
648
+ revealPath: (path) => revealCanvasPath(path),
649
+ seeds: () => [...seeds.values()].map((seed) => ({ boundary: seed.boundary, id: seed.id })),
650
+ state: () => deps.registry.context()
651
+ },
652
+ async run(id, args = {}) {
653
+ if (TOGGLE_ID.test(id)) {
654
+ throw new AutomationRefusedError(id, `it names a delta against state the caller cannot observe; call "${setterFor(id)}"`);
655
+ }
656
+ const { registry } = deps;
657
+ if (!registry.get(id)) {
658
+ throw new Error(unknownCommandMessage(id, registry, seedIdSet));
659
+ }
660
+ await registry.run(id, args);
661
+ },
662
+ async seed(id, args = {}) {
663
+ const bare = id.startsWith("seed.") ? id.slice(5) : id;
664
+ const refusal = REFUSED_SEEDS[bare];
665
+ if (refusal) {
666
+ throw new AutomationRefusedError(id, `a seed stands in for a remote, never for a user: ${refusal}`);
667
+ }
668
+ const seed = seeds.get(id.startsWith("seed.") ? id : `seed.${id}`);
669
+ if (!seed) {
670
+ throw new Error(`unknown seed "${id}" — declared seeds are ${[...seeds.keys()].join(", ")}`);
671
+ }
672
+ await seed.run(args);
673
+ }
674
+ };
675
+ }
676
+ function shouldInstallAutomation(search) {
677
+ return new URLSearchParams(search).get("automation") === "1";
678
+ }
679
+ function installAutomationHook(deps) {
680
+ if (!shouldInstallAutomation(location.search)) {
681
+ return false;
682
+ }
683
+ globalThis.__jxAutomation = createAutomationApi(deps);
684
+ return true;
685
+ }
686
+
687
+ // src/packages/semver.ts
688
+ function stripRange(range) {
689
+ const base = range.replace(/^[\^~>=<v\s]+/, "").trim();
690
+ return base.split(/\s+/)[0] ?? "";
691
+ }
692
+ function isComparable(spec) {
693
+ if (spec.includes(":")) {
694
+ return false;
695
+ }
696
+ return /^\d+\.\d+/.test(stripRange(spec));
697
+ }
698
+ function parts(version) {
699
+ const core = stripRange(version).split(/[-+]/)[0] ?? "";
700
+ const [major = 0, minor = 0, patch = 0] = core.split(".").map((n) => Math.trunc(Number(n)) || 0);
701
+ return [major, minor, patch];
702
+ }
703
+ function compareSemver(a, b) {
704
+ const pa = parts(a);
705
+ const pb = parts(b);
706
+ for (let i = 0;i < 3; i++) {
707
+ const da = pa[i] ?? 0;
708
+ const db = pb[i] ?? 0;
709
+ if (da !== db) {
710
+ return da < db ? -1 : 1;
711
+ }
712
+ }
713
+ return 0;
714
+ }
715
+ function isUpgrade(current, latest) {
716
+ if (!isComparable(current) || !isComparable(latest)) {
717
+ return false;
718
+ }
719
+ return compareSemver(latest, current) > 0;
720
+ }
721
+
722
+ // src/packages/jxsuite-update.ts
723
+ var JXSUITE_PREFIX = "@jxsuite/";
724
+ async function checkJxsuiteUpdate() {
725
+ const platform = getPlatform();
726
+ if (!platform.outdatedPackages) {
727
+ return [];
728
+ }
729
+ let reported;
730
+ try {
731
+ reported = await platform.outdatedPackages();
732
+ } catch {
733
+ return [];
734
+ }
735
+ const outdated = [];
736
+ for (const p of reported) {
737
+ if (p.name.startsWith(JXSUITE_PREFIX) && isUpgrade(p.current, p.latest)) {
738
+ outdated.push({ current: p.current, dev: Boolean(p.dev), latest: p.latest, name: p.name });
739
+ }
740
+ }
741
+ return outdated;
742
+ }
743
+ function dismissKey(root, outdated) {
744
+ const signature = outdated.map((p) => `${p.name}@${p.latest}`).toSorted().join(",");
745
+ return `jx:jxsuite-update-dismissed:${root}:${signature}`;
746
+ }
747
+ function isDismissed(root, outdated) {
748
+ try {
749
+ return localStorage.getItem(dismissKey(root, outdated)) === "1";
750
+ } catch {
751
+ return false;
752
+ }
753
+ }
754
+ function setDismissed(root, outdated) {
755
+ try {
756
+ localStorage.setItem(dismissKey(root, outdated), "1");
757
+ } catch {}
758
+ }
759
+ async function applyJxsuiteUpdate(outdated) {
760
+ const platform = getPlatform();
761
+ if (!platform.setPackageVersions || outdated.length === 0) {
762
+ return;
763
+ }
764
+ const progress = showProgressModal({
765
+ status: "Updating @jxsuite packages…",
766
+ title: "Updating dependencies"
767
+ });
768
+ try {
769
+ const result = await platform.setPackageVersions(outdated.map((p) => ({ dev: p.dev, name: p.name, version: `^${p.latest}` })));
770
+ if (result.ok) {
771
+ progress.done();
772
+ notify.success(`Updated ${outdated.length} @jxsuite package(s) to their latest versions.`);
773
+ } else {
774
+ progress.fail(result.log ?? "Update failed");
775
+ }
776
+ } catch (error) {
777
+ progress.fail(error instanceof Error ? error.message : String(error));
778
+ }
779
+ }
780
+ async function maybePromptJxsuiteUpdate(projectRoot) {
781
+ if (shouldInstallAutomation(location.search)) {
782
+ return;
783
+ }
784
+ const platform = getPlatform();
785
+ if (!platform.setPackageVersions) {
786
+ return;
787
+ }
788
+ const outdated = await checkJxsuiteUpdate();
789
+ if (outdated.length === 0 || isDismissed(projectRoot, outdated)) {
790
+ return;
791
+ }
792
+ const list = outdated.map((p) => `${p.name} ${p.current} → ^${p.latest}`).join(`
793
+ `);
794
+ const confirmed = await showConfirmDialog("Update @jxsuite packages?", html`Newer versions of these packages have been published. Update the project to them?
795
+ <br /><br /><span
796
+ style="font-size:var(--spectrum-font-size-75, 12px);color:var(--fg-dim);white-space:pre-line"
797
+ >${list}</span
798
+ >`, { cancelLabel: "Not now", confirmLabel: "Update" });
799
+ if (!confirmed) {
800
+ setDismissed(projectRoot, outdated);
801
+ return;
802
+ }
803
+ await applyJxsuiteUpdate(outdated);
804
+ }
805
+
806
+ // src/packages/pull-package-sync.ts
807
+ var PKG_PATHS = ["package.json", "bun.lock", "bun.lockb"];
808
+ var UNTRACKED_STATUSES = new Set(["??", "U"]);
809
+ var MAX_CONFLICT_SCAN = 25;
810
+ var JXSUITE_PREFIX2 = "@jxsuite/";
811
+ function isRecord(value) {
812
+ return typeof value === "object" && value !== null && !Array.isArray(value);
813
+ }
814
+ function sortKeys(value) {
815
+ if (Array.isArray(value)) {
816
+ return value.map((entry) => sortKeys(entry));
817
+ }
818
+ if (isRecord(value)) {
819
+ const out = {};
820
+ for (const key of Object.keys(value).toSorted()) {
821
+ out[key] = sortKeys(value[key]);
822
+ }
823
+ return out;
824
+ }
825
+ return value;
826
+ }
827
+ function maskJxsuiteVersions(pkg) {
828
+ const out = { ...pkg };
829
+ for (const section of ["dependencies", "devDependencies"]) {
830
+ const deps = out[section];
831
+ if (!isRecord(deps)) {
832
+ continue;
833
+ }
834
+ const masked = { ...deps };
835
+ for (const name of Object.keys(masked)) {
836
+ if (name.startsWith(JXSUITE_PREFIX2)) {
837
+ masked[name] = "*";
838
+ }
839
+ }
840
+ out[section] = masked;
841
+ }
842
+ return out;
843
+ }
844
+ function isAutomatedPackageDiff(headText, workingText) {
845
+ if (headText === null || workingText === null) {
846
+ return false;
847
+ }
848
+ let head;
849
+ let working;
850
+ try {
851
+ head = JSON.parse(headText);
852
+ working = JSON.parse(workingText);
853
+ } catch {
854
+ return false;
855
+ }
856
+ if (!isRecord(head) || !isRecord(working)) {
857
+ return false;
858
+ }
859
+ return JSON.stringify(sortKeys(maskJxsuiteVersions(head))) === JSON.stringify(sortKeys(maskJxsuiteVersions(working)));
860
+ }
861
+ async function tryShow(path, ref2) {
862
+ try {
863
+ return await getPlatform().gitShow({ path, ref: ref2 });
864
+ } catch {
865
+ return null;
866
+ }
867
+ }
868
+ async function tryRead(path) {
869
+ try {
870
+ return await getPlatform().readFile(path);
871
+ } catch {
872
+ return null;
873
+ }
874
+ }
875
+ async function planPackageDiscard(status) {
876
+ const discard = [];
877
+ const removeUntracked = [];
878
+ let automated = true;
879
+ for (const path of PKG_PATHS) {
880
+ const entries = status.files.filter((f) => f.path === path);
881
+ if (entries.length === 0) {
882
+ continue;
883
+ }
884
+ const upstream = await tryShow(path, "@{u}");
885
+ if (entries.every((f) => UNTRACKED_STATUSES.has(f.status))) {
886
+ if (upstream !== null) {
887
+ removeUntracked.push(path);
888
+ }
889
+ continue;
890
+ }
891
+ const head = await tryShow(path, "HEAD");
892
+ if (upstream === null || upstream === head) {
893
+ continue;
894
+ }
895
+ discard.push(path);
896
+ if (path === "package.json") {
897
+ automated &&= isAutomatedPackageDiff(head, await tryRead(path));
898
+ }
899
+ }
900
+ return { automated, discard, removeUntracked };
901
+ }
902
+ function planIsEmpty(plan) {
903
+ return plan.discard.length === 0 && plan.removeUntracked.length === 0;
904
+ }
905
+ async function otherFilesConflict(status) {
906
+ const paths = [
907
+ ...new Set(status.files.filter((f) => !PKG_PATHS.includes(f.path)).map((f) => f.path))
908
+ ];
909
+ if (paths.length > MAX_CONFLICT_SCAN) {
910
+ return true;
911
+ }
912
+ for (const path of paths) {
913
+ const upstream = await tryShow(path, "@{u}");
914
+ if (upstream !== null && upstream !== await tryShow(path, "HEAD")) {
915
+ return true;
916
+ }
917
+ }
918
+ return false;
919
+ }
920
+ async function applyDiscard(plan) {
921
+ const platform = getPlatform();
922
+ if (plan.discard.length > 0) {
923
+ await platform.gitUnstage(plan.discard);
924
+ await platform.gitDiscard(plan.discard);
925
+ }
926
+ for (const path of plan.removeUntracked) {
927
+ await platform.deleteFile(path);
928
+ }
929
+ }
930
+ async function syncPackagesAfterPull() {
931
+ const platform = getPlatform();
932
+ let outdated = [];
933
+ try {
934
+ outdated = await checkJxsuiteUpdate();
935
+ } catch {
936
+ outdated = [];
937
+ }
938
+ if (outdated.length > 0 && platform.setPackageVersions) {
939
+ await applyJxsuiteUpdate(outdated);
940
+ return;
941
+ }
942
+ if (!platform.installDependencies) {
943
+ return;
944
+ }
945
+ const progress = showProgressModal({
946
+ status: "Running bun install…",
947
+ title: "Syncing dependencies"
948
+ });
949
+ try {
950
+ const result = await platform.installDependencies();
951
+ if (result.ok) {
952
+ progress.done();
953
+ } else {
954
+ progress.fail(result.log ?? "bun install failed");
955
+ }
956
+ } catch (error) {
957
+ progress.fail(errorMessage(error));
958
+ }
959
+ }
960
+ async function discardPullAndSync(plan) {
961
+ const platform = getPlatform();
962
+ try {
963
+ await applyDiscard(plan);
964
+ } catch (error) {
965
+ throw new Error(`Could not reset local package files: ${errorMessage(error)}`, {
966
+ cause: error
967
+ });
968
+ }
969
+ try {
970
+ await platform.gitPull();
971
+ } catch (error) {
972
+ await syncPackagesAfterPull();
973
+ throw error;
974
+ }
975
+ notify.warn("Local package updates were superseded by pulled changes.", {
976
+ source: "Source Control"
977
+ });
978
+ await syncPackagesAfterPull();
979
+ }
980
+ async function recoverAfterFailedPull(original) {
981
+ const platform = getPlatform();
982
+ let status;
983
+ try {
984
+ status = await platform.gitStatus();
985
+ } catch {
986
+ throw original;
987
+ }
988
+ if (!(status.behind > 0)) {
989
+ throw original;
990
+ }
991
+ const plan = await planPackageDiscard(status);
992
+ if (planIsEmpty(plan) || await otherFilesConflict(status)) {
993
+ throw original;
994
+ }
995
+ if (!plan.automated) {
996
+ const confirmed = await showConfirmDialog("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 });
997
+ if (!confirmed) {
998
+ throw original;
999
+ }
1000
+ }
1001
+ await discardPullAndSync(plan);
1002
+ }
1003
+ async function snapshotPackageFiles() {
1004
+ let present;
1005
+ try {
1006
+ const entries = await getPlatform().listDirectory("");
1007
+ present = new Set(entries.filter((e) => e.type === "file").map((e) => e.name));
1008
+ } catch {
1009
+ present = new Set(PKG_PATHS);
1010
+ }
1011
+ return Promise.all(PKG_PATHS.map((path) => present.has(path) ? tryRead(path) : Promise.resolve(null)));
1012
+ }
1013
+ async function pullWithPackageSync() {
1014
+ const platform = getPlatform();
1015
+ const before = await snapshotPackageFiles();
1016
+ let status = null;
1017
+ try {
1018
+ await platform.gitFetch();
1019
+ status = await platform.gitStatus();
1020
+ } catch {
1021
+ status = null;
1022
+ }
1023
+ if (status && status.behind > 0) {
1024
+ const plan = await planPackageDiscard(status);
1025
+ if (!planIsEmpty(plan) && plan.automated) {
1026
+ await discardPullAndSync(plan);
1027
+ return;
1028
+ }
1029
+ }
1030
+ try {
1031
+ await platform.gitPull();
1032
+ } catch (error) {
1033
+ await recoverAfterFailedPull(error);
1034
+ return;
1035
+ }
1036
+ const after = await snapshotPackageFiles();
1037
+ if (before.some((content, i) => content !== after[i])) {
1038
+ await syncPackagesAfterPull();
1039
+ }
1040
+ }
1041
+ async function autoSyncProjectOnOpen() {
1042
+ const platform = getPlatform();
1043
+ let status;
1044
+ try {
1045
+ status = await platform.gitStatus();
1046
+ } catch {
1047
+ return;
1048
+ }
1049
+ if (!status?.isRepo || (status.remotes?.length ?? 0) === 0) {
1050
+ return;
1051
+ }
1052
+ notify.info("Syncing project…", { key: "project.sync", source: "Source Control" });
1053
+ try {
1054
+ await pullWithPackageSync();
1055
+ } catch (error) {
1056
+ notify.warn("The project could not be synced with its remote.", {
1057
+ detail: errorMessage(error),
1058
+ key: "project.sync",
1059
+ source: "Source Control",
1060
+ tier: "problem"
1061
+ });
1062
+ }
1063
+ }
1064
+
1065
+ // src/panels/git-panel.ts
1066
+ async function refreshGitStatus() {
1067
+ if (!projectState) {
1068
+ return;
1069
+ }
1070
+ const plat = getPlatform();
1071
+ const { git } = shell;
1072
+ git.loading = true;
1073
+ git.error = null;
1074
+ try {
1075
+ const [status, branches] = await Promise.allSettled([plat.gitStatus(), plat.gitBranches()]);
1076
+ if (status.status === "fulfilled") {
1077
+ git.status = status.value;
1078
+ }
1079
+ if (branches.status === "fulfilled") {
1080
+ git.branches = branches.value;
1081
+ }
1082
+ const failure = status.status === "rejected" ? status.reason : branches.status === "rejected" && status.value?.isRepo ? branches.reason : null;
1083
+ if (failure) {
1084
+ git.error = errorMessage(failure);
1085
+ }
1086
+ git.lastUpdated = now();
1087
+ } catch (error) {
1088
+ git.error = errorMessage(error);
1089
+ } finally {
1090
+ git.loading = false;
1091
+ }
1092
+ }
1093
+ async function cloneRepository(ctx) {
1094
+ const platform = getPlatform();
1095
+ if (!platform.gitClone) {
1096
+ notify.warn("Cloning is not supported on this platform.", { source: "Source Control" });
1097
+ return;
1098
+ }
1099
+ const url = await showPromptDialog("Clone Git Repository", {
1100
+ confirmLabel: "Clone",
1101
+ message: "Repository URL",
1102
+ placeholder: "https://github.com/user/repo.git",
1103
+ validate: (v) => v.trim() ? "" : "Enter a repository URL."
1104
+ });
1105
+ if (!url) {
1106
+ return;
1107
+ }
1108
+ try {
1109
+ notify.info("Cloning repository…", { key: "git.clone", source: "Source Control" });
1110
+ const result = await platform.gitClone(url);
1111
+ if (result?.root) {
1112
+ notify.success("Clone complete.", { key: "git.clone" });
1113
+ await ctx.openRecentProject(result.root);
1114
+ }
1115
+ } catch (error) {
1116
+ notify.error("Could not clone the repository.", {
1117
+ detail: errorMessage(error),
1118
+ key: "git.clone",
1119
+ source: "Source Control"
1120
+ });
1121
+ }
1122
+ }
1123
+ function platformSupportsClone() {
1124
+ return Boolean(getPlatform().gitClone);
1125
+ }
1126
+ async function readGitDiff(path, fileStatus) {
1127
+ const plat = getPlatform();
1128
+ const [originalContent, currentContent] = await Promise.all([
1129
+ fileStatus === "A" ? Promise.resolve("") : plat.gitShow({ path, ref: "HEAD" }),
1130
+ plat.readFile(path)
1131
+ ]);
1132
+ return { currentContent, filePath: path, fileStatus, originalContent };
1133
+ }
1134
+ async function loadDiffForLens(path, fileStatus) {
1135
+ try {
1136
+ return await readGitDiff(path, fileStatus);
1137
+ } catch (error) {
1138
+ console.warn("loadDiffForLens:", errorMessage(error));
1139
+ return null;
1140
+ }
1141
+ }
1142
+ async function initRepository() {
1143
+ try {
1144
+ notify.info("Initializing repository…", { key: "git.init" });
1145
+ await getPlatform().gitInit();
1146
+ notify.success("Repository initialized.", { key: "git.init" });
1147
+ } catch (error) {
1148
+ notify.error("Could not initialize the repository.", {
1149
+ action: "git.init",
1150
+ detail: errorMessage(error),
1151
+ key: "git.init",
1152
+ source: "Source Control"
1153
+ });
1154
+ return;
1155
+ }
1156
+ await refreshGitStatus();
1157
+ }
1158
+ async function pushCurrentBranch() {
1159
+ await gitAction("gitPush");
1160
+ }
1161
+ async function signInToGithub() {
1162
+ const token = await authenticateGithub();
1163
+ if (token) {
1164
+ notify.success("Signed in to GitHub.", { key: "github.auth" });
1165
+ }
1166
+ }
1167
+ async function gitAction(action, body) {
1168
+ const plat = getPlatform();
1169
+ shell.git.loading = true;
1170
+ shell.git.error = null;
1171
+ try {
1172
+ await plat[action](body);
1173
+ await refreshGitStatus();
1174
+ } catch (error) {
1175
+ shell.git.error = errorMessage(error);
1176
+ shell.git.loading = false;
1177
+ }
1178
+ }
1179
+ async function doPull() {
1180
+ shell.git.loading = true;
1181
+ shell.git.error = null;
1182
+ try {
1183
+ await pullWithPackageSync();
1184
+ await refreshGitStatus();
1185
+ } catch (error) {
1186
+ shell.git.error = errorMessage(error);
1187
+ shell.git.loading = false;
1188
+ }
1189
+ }
1190
+ var _pollTimer = null;
1191
+ async function fetchGitLog() {
1192
+ const plat = getPlatform();
1193
+ try {
1194
+ shell.git.logEntries = await plat.gitLog(30);
1195
+ } catch (error) {
1196
+ shell.git.error = errorMessage(error);
1197
+ }
1198
+ }
1199
+ function renderGitPanel(ctx) {
1200
+ if (!projectState) {
1201
+ return html`<div class="git-panel git-panel-empty">
1202
+ ${renderEmptyState({
1203
+ actions: platformSupportsClone() ? [
1204
+ {
1205
+ icon: html`<sp-icon-download slot="icon"></sp-icon-download>`,
1206
+ label: "Clone Git Repository",
1207
+ run: () => ctx.cloneRepository?.()
1208
+ }
1209
+ ] : [],
1210
+ message: "Source control keeps every version of a project, so any change can be undone. " + "Open a project to see its history."
1211
+ })}
1212
+ </div>`;
1213
+ }
1214
+ const { branches, loading, status } = shell.git;
1215
+ if (!status && !loading && !shell.git.error) {
1216
+ refreshGitStatus();
1217
+ return html`<div class="git-panel">
1218
+ <div class="git-loading">Loading...</div>
1219
+ </div>`;
1220
+ }
1221
+ if (status && !status.isRepo) {
1222
+ return html`<div class="git-panel git-panel-empty">
1223
+ ${renderEmptyState({
1224
+ actions: [
1225
+ {
1226
+ disabled: Boolean(loading),
1227
+ icon: html`<sp-icon-add slot="icon"></sp-icon-add>`,
1228
+ label: "Initialize Repository",
1229
+ run: () => {
1230
+ initRepository();
1231
+ }
1232
+ },
1233
+ {
1234
+ disabled: Boolean(loading),
1235
+ icon: html`<sp-icon-share slot="icon"></sp-icon-share>`,
1236
+ label: "Create GitHub repository",
1237
+ run: () => {
1238
+ createGithubRepository({ projectName: projectState?.name || "my-project" });
1239
+ }
1240
+ }
1241
+ ],
1242
+ message: "This project is not tracked by git yet. Start tracking it to keep a history " + "of every change and to publish it anywhere."
1243
+ })}
1244
+ </div>`;
1245
+ }
1246
+ if (!_pollTimer) {
1247
+ _pollTimer = setInterval(() => {
1248
+ if (shell.leftTab === "git" && !shell.git.loading) {
1249
+ refreshGitStatus();
1250
+ }
1251
+ }, POLL_GIT);
1252
+ }
1253
+ const stagedFiles = status?.files?.filter((f) => f.staged) || [];
1254
+ const unstagedFiles = status?.files?.filter((f) => !f.staged) || [];
1255
+ const totalChanges = status?.files?.length || 0;
1256
+ const doCommit = async () => {
1257
+ const msg = shell.git.commitMessage.trim();
1258
+ if (!msg) {
1259
+ return;
1260
+ }
1261
+ shell.git.commitMessage = "";
1262
+ await flushAllCollab();
1263
+ await gitAction("gitCommit", msg);
1264
+ };
1265
+ const doCommitAndSync = async () => {
1266
+ const msg = shell.git.commitMessage.trim();
1267
+ if (!msg) {
1268
+ return;
1269
+ }
1270
+ shell.git.commitMessage = "";
1271
+ shell.git.loading = true;
1272
+ shell.git.error = null;
1273
+ await flushAllCollab();
1274
+ const plat = getPlatform();
1275
+ try {
1276
+ await plat.gitCommit(msg);
1277
+ await plat.gitPush();
1278
+ await refreshGitStatus();
1279
+ } catch (error) {
1280
+ shell.git.error = errorMessage(error);
1281
+ shell.git.loading = false;
1282
+ }
1283
+ };
1284
+ const isUpToDate = !status?.ahead && !status?.behind;
1285
+ const syncLabel = isUpToDate ? "Up to date" : `${status?.ahead ? `${status.ahead} ahead` : ""}${status?.ahead && status?.behind ? ", " : ""}${status?.behind ? `${status.behind} behind` : ""}`;
1286
+ const lastUpdatedStr = shell.git.lastUpdated ? new Date(shell.git.lastUpdated).toLocaleTimeString([], {
1287
+ hour: "2-digit",
1288
+ minute: "2-digit"
1289
+ }) : "";
1290
+ const hasRemotes = (status?.remotes?.length ?? 0) > 0;
1291
+ const syncBarT = hasRemotes ? html`
1292
+ <div class="git-sync-bar">
1293
+ <sp-action-button
1294
+ size="s"
1295
+ quiet
1296
+ class="git-sync-icon"
1297
+ title="Refresh"
1298
+ @click=${() => refreshGitStatus()}
1299
+ ?disabled=${loading}
1300
+ >
1301
+ <sp-icon-refresh slot="icon"></sp-icon-refresh>
1302
+ </sp-action-button>
1303
+ <div class="git-sync-text">
1304
+ <span class="git-sync-label">${syncLabel}</span>
1305
+ ${lastUpdatedStr ? html`<span class="git-sync-time">Last updated ${lastUpdatedStr}</span>` : nothing}
1306
+ </div>
1307
+ <sp-action-group size="xs" quiet class="git-sync-actions">
1308
+ <sp-action-button
1309
+ title="Fetch"
1310
+ @click=${() => gitAction("gitFetch")}
1311
+ ?disabled=${loading}
1312
+ >
1313
+ <sp-icon-download slot="icon" size="xs"></sp-icon-download>
1314
+ </sp-action-button>
1315
+ <sp-action-button
1316
+ title="Pull${status?.behind ? ` (${status.behind} behind)` : ""}"
1317
+ @click=${() => {
1318
+ doPull();
1319
+ }}
1320
+ ?disabled=${loading}
1321
+ >
1322
+ <sp-icon-arrow-down slot="icon" size="xs"></sp-icon-arrow-down>
1323
+ </sp-action-button>
1324
+ <sp-action-button
1325
+ title="Push${status?.ahead ? ` (${status.ahead} ahead)` : ""}"
1326
+ @click=${() => gitAction("gitPush")}
1327
+ ?disabled=${loading}
1328
+ >
1329
+ <sp-icon-arrow-up slot="icon" size="xs"></sp-icon-arrow-up>
1330
+ </sp-action-button>
1331
+ </sp-action-group>
1332
+ </div>
1333
+ ` : html`
1334
+ <div class="git-sync-bar git-sync-bar--no-remote">
1335
+ <sp-action-button
1336
+ size="s"
1337
+ quiet
1338
+ class="git-sync-icon"
1339
+ title="Refresh"
1340
+ @click=${() => refreshGitStatus()}
1341
+ ?disabled=${loading}
1342
+ >
1343
+ <sp-icon-refresh slot="icon"></sp-icon-refresh>
1344
+ </sp-action-button>
1345
+ <div class="git-sync-text">
1346
+ <span class="git-sync-label">Local only (no remote)</span>
1347
+ </div>
1348
+ <sp-action-button
1349
+ size="s"
1350
+ @click=${() => createGithubRepository({
1351
+ projectName: projectState?.name || "my-project"
1352
+ })}
1353
+ ?disabled=${loading}
1354
+ >
1355
+ <sp-icon-share slot="icon"></sp-icon-share>
1356
+ Create GitHub repository
1357
+ </sp-action-button>
1358
+ </div>
1359
+ `;
1360
+ const branchSelectorT = html`
1361
+ <div class="git-branch-row">
1362
+ <svg
1363
+ class="git-branch-icon"
1364
+ xmlns="http://www.w3.org/2000/svg"
1365
+ width="18"
1366
+ height="18"
1367
+ viewBox="0 0 24 24"
1368
+ fill="none"
1369
+ stroke="currentColor"
1370
+ stroke-width="2"
1371
+ stroke-linecap="round"
1372
+ stroke-linejoin="round"
1373
+ >
1374
+ <line x1="6" y1="3" x2="6" y2="15"></line>
1375
+ <circle cx="18" cy="6" r="3"></circle>
1376
+ <circle cx="6" cy="18" r="3"></circle>
1377
+ <path d="M18 9a9 9 0 0 1-9 9"></path>
1378
+ </svg>
1379
+ <div class="git-branch-text">
1380
+ <span class="git-branch-label">Active branch</span>
1381
+ <span class="git-branch-name">${branches?.current || status?.branch || "—"}</span>
1382
+ </div>
1383
+ <sp-picker
1384
+ size="s"
1385
+ quiet
1386
+ class="git-branch-picker"
1387
+ .value=${live(branches?.current || "")}
1388
+ @change=${async (e) => {
1389
+ const val = e.target.value;
1390
+ if (val === "__new__") {
1391
+ e.target.value = branches?.current || "";
1392
+ const name = await showPromptDialog("New Branch", {
1393
+ confirmLabel: "Create",
1394
+ message: `Branching from ${branches?.current || status?.branch || "the current branch"}.`,
1395
+ placeholder: "feature/my-change",
1396
+ validate: (v) => v.trim() ? "" : "Enter a branch name."
1397
+ });
1398
+ if (name) {
1399
+ await gitAction("gitCreateBranch", name);
1400
+ }
1401
+ return;
1402
+ }
1403
+ if (val !== branches?.current) {
1404
+ await gitAction("gitCheckout", val);
1405
+ }
1406
+ }}
1407
+ >
1408
+ ${(branches?.branches || []).map((b) => html`<sp-menu-item value=${b}>${b}</sp-menu-item>`)}
1409
+ <sp-menu-divider></sp-menu-divider>
1410
+ <sp-menu-item value="__new__">+ New branch...</sp-menu-item>
1411
+ </sp-picker>
1412
+ </div>
1413
+ `;
1414
+ const switchTab = (tab) => {
1415
+ shell.git.subTab = tab;
1416
+ if (tab === "history" && !shell.git.logEntries) {
1417
+ fetchGitLog();
1418
+ }
1419
+ };
1420
+ const tabsT = html`
1421
+ <div class="git-tabs">
1422
+ <button
1423
+ class="git-tab ${shell.git.subTab === "changes" ? "active" : ""}"
1424
+ @click=${() => switchTab("changes")}
1425
+ >
1426
+ Local Changes${totalChanges > 0 ? ` (${totalChanges})` : ""}
1427
+ </button>
1428
+ <button
1429
+ class="git-tab ${shell.git.subTab === "history" ? "active" : ""}"
1430
+ @click=${() => switchTab("history")}
1431
+ >
1432
+ History
1433
+ </button>
1434
+ </div>
1435
+ `;
1436
+ const commitT = html`
1437
+ <div class="git-commit-area" data-jx-region="navigator/panel:git/commit">
1438
+ <label class="git-commit-label">Please write a commit message</label>
1439
+ <sp-textfield
1440
+ size="s"
1441
+ multiline
1442
+ class="git-commit-input"
1443
+ placeholder="Describe your changes"
1444
+ .value=${live(shell.git.commitMessage)}
1445
+ @input=${(e) => {
1446
+ shell.git.commitMessage = e.target.value;
1447
+ }}
1448
+ @keydown=${(e) => {
1449
+ if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
1450
+ e.preventDefault();
1451
+ doCommit();
1452
+ }
1453
+ }}
1454
+ ></sp-textfield>
1455
+ <div class="git-commit-actions">
1456
+ <div class="git-split-btn">
1457
+ <sp-action-button
1458
+ class="git-commit-btn"
1459
+ size="s"
1460
+ @click=${doCommitAndSync}
1461
+ ?disabled=${loading}
1462
+ >
1463
+ Commit and sync
1464
+ </sp-action-button>
1465
+ <sp-action-button
1466
+ class="git-split-trigger"
1467
+ size="s"
1468
+ @click=${(e) => {
1469
+ const menu = e.currentTarget.parentElement.querySelector(".git-split-menu");
1470
+ if (menu) {
1471
+ menu.toggleAttribute("hidden");
1472
+ }
1473
+ }}
1474
+ >
1475
+ <sp-icon-chevron-down slot="icon" size="xs"></sp-icon-chevron-down>
1476
+ </sp-action-button>
1477
+ <div class="git-split-menu" hidden>
1478
+ <button
1479
+ class="git-split-menu-item"
1480
+ @click=${(e) => {
1481
+ e.currentTarget.parentElement.setAttribute("hidden", "");
1482
+ doCommit();
1483
+ }}
1484
+ >
1485
+ Commit (don't sync)
1486
+ </button>
1487
+ </div>
1488
+ </div>
1489
+ </div>
1490
+ </div>
1491
+ `;
1492
+ const fileRowT = (file) => {
1493
+ const parts2 = file.path.split("/");
1494
+ const name = parts2.pop();
1495
+ const dir = parts2.join("/");
1496
+ const onFileClick = async () => {
1497
+ if (file.status !== "M" && file.status !== "A") {
1498
+ return;
1499
+ }
1500
+ if (!file.path.endsWith(".json") && !formatForPath(file.path)) {
1501
+ return;
1502
+ }
1503
+ try {
1504
+ shell.git.loading = true;
1505
+ const diffState = await readGitDiff(file.path, file.status);
1506
+ shell.git.diffState = diffState;
1507
+ if (ctx?.setCanvasMode) {
1508
+ if (ctx.setGitDiffState) {
1509
+ ctx.setGitDiffState(diffState);
1510
+ }
1511
+ ctx.setCanvasMode(activeTab.value, "git-diff");
1512
+ }
1513
+ } catch (error) {
1514
+ shell.git.error = `Failed to load diff: ${errorMessage(error)}`;
1515
+ } finally {
1516
+ shell.git.loading = false;
1517
+ }
1518
+ };
1519
+ return html`
1520
+ <div class="git-file-row">
1521
+ <span
1522
+ class="git-file-info"
1523
+ style="cursor: pointer; flex: 1;"
1524
+ title="Click to view diff"
1525
+ @click=${onFileClick}
1526
+ >
1527
+ <span class="git-file-name" title=${file.path}>${name}</span>
1528
+ ${dir ? html`<span class="git-file-dir">${dir}</span>` : nothing}
1529
+ </span>
1530
+ <span class="git-file-actions">
1531
+ ${file.staged ? html`
1532
+ <sp-action-button
1533
+ size="xs"
1534
+ quiet
1535
+ title="Unstage"
1536
+ @click=${() => gitAction("gitUnstage", [file.path])}
1537
+ >
1538
+ <sp-icon-remove slot="icon" size="xs"></sp-icon-remove>
1539
+ </sp-action-button>
1540
+ ` : html`
1541
+ <sp-action-button
1542
+ size="xs"
1543
+ quiet
1544
+ title="Discard changes"
1545
+ @click=${async () => {
1546
+ if (file.status === "U") {
1547
+ return;
1548
+ }
1549
+ const confirmed = await showConfirmDialog("Discard Changes", `Discard changes to ${file.path}?`, { confirmLabel: "Discard", destructive: true });
1550
+ if (!confirmed) {
1551
+ return;
1552
+ }
1553
+ await gitAction("gitDiscard", [file.path]);
1554
+ }}
1555
+ ?disabled=${file.status === "U"}
1556
+ >
1557
+ <sp-icon-undo slot="icon" size="xs"></sp-icon-undo>
1558
+ </sp-action-button>
1559
+ <sp-action-button
1560
+ size="xs"
1561
+ quiet
1562
+ title="Stage"
1563
+ @click=${() => gitAction("gitStage", [file.path])}
1564
+ >
1565
+ <sp-icon-add slot="icon" size="xs"></sp-icon-add>
1566
+ </sp-action-button>
1567
+ `}
1568
+ </span>
1569
+ <span class="git-file-badge git-status-${file.status}">${file.status}</span>
1570
+ </div>
1571
+ `;
1572
+ };
1573
+ const groupFilesByComponent = (files) => {
1574
+ const groups = new Map;
1575
+ for (const f of files) {
1576
+ const parts2 = f.path.split("/");
1577
+ let component;
1578
+ if (f.path.endsWith(".json") || f.path.endsWith(".class.json") || formatForPath(f.path)) {
1579
+ component = parts2.length > 1 ? `/${parts2.at(-2)}` : `/${parts2[0]}`;
1580
+ } else {
1581
+ component = "Other";
1582
+ }
1583
+ if (!groups.has(component)) {
1584
+ groups.set(component, []);
1585
+ }
1586
+ groups.get(component).push(f);
1587
+ }
1588
+ return groups;
1589
+ };
1590
+ const allFiles = [...stagedFiles, ...unstagedFiles];
1591
+ const componentGroups = groupFilesByComponent(allFiles);
1592
+ const changesT = html`
1593
+ ${stagedFiles.length > 0 ? html`
1594
+ <div class="git-section">
1595
+ <div class="git-section-header">
1596
+ <span>Staged Changes</span>
1597
+ <span class="git-count">${stagedFiles.length}</span>
1598
+ <sp-action-button
1599
+ size="xs"
1600
+ quiet
1601
+ title="Unstage all"
1602
+ @click=${() => gitAction("gitUnstage", stagedFiles.map((f) => f.path))}
1603
+ >
1604
+ <sp-icon-remove slot="icon" size="xs"></sp-icon-remove>
1605
+ </sp-action-button>
1606
+ </div>
1607
+ ${repeat(stagedFiles, (f) => f.path, fileRowT)}
1608
+ </div>
1609
+ ` : nothing}
1610
+ <div class="git-section">
1611
+ <div class="git-section-header">
1612
+ <span>Changed Components</span>
1613
+ <span class="git-count">${allFiles.length}</span>
1614
+ ${unstagedFiles.length > 0 ? html`
1615
+ <sp-action-button
1616
+ size="xs"
1617
+ quiet
1618
+ title="Stage all"
1619
+ @click=${() => gitAction("gitStage", unstagedFiles.map((f) => f.path))}
1620
+ >
1621
+ <sp-icon-add slot="icon" size="xs"></sp-icon-add>
1622
+ </sp-action-button>
1623
+ ` : nothing}
1624
+ </div>
1625
+ ${allFiles.length > 0 ? html`
1626
+ ${[...componentGroups.entries()].map(([comp, files]) => html`
1627
+ <div class="git-component-group">
1628
+ <div class="git-component-header">
1629
+ <sp-action-button
1630
+ size="xs"
1631
+ quiet
1632
+ class="git-component-overflow"
1633
+ title="Actions"
1634
+ >
1635
+ <sp-icon-more slot="icon" size="xs"></sp-icon-more>
1636
+ </sp-action-button>
1637
+ <span class="git-component-name">${comp}</span>
1638
+ </div>
1639
+ ${repeat(files, (f) => f.path, fileRowT)}
1640
+ </div>
1641
+ `)}
1642
+ ` : renderEmptyState({
1643
+ compact: true,
1644
+ message: "Nothing to commit. Files you edit and save show up here."
1645
+ })}
1646
+ </div>
1647
+ `;
1648
+ const logEntries = shell.git.logEntries || [];
1649
+ const historyT = html`
1650
+ <div class="git-history">
1651
+ ${logEntries.length === 0 ? renderEmptyState({
1652
+ compact: true,
1653
+ message: "No commits yet. Each commit you make is a version you can come back to."
1654
+ }) : repeat(logEntries, (e) => e.hash, (entry) => html`
1655
+ <div class="git-history-entry">
1656
+ <span class="git-history-hash">${entry.hash.slice(0, 7)}</span>
1657
+ <span class="git-history-message">${entry.message}</span>
1658
+ <span class="git-history-meta"
1659
+ >${entry.author} · ${relativeDate(entry.date)}</span
1660
+ >
1661
+ </div>
1662
+ `)}
1663
+ </div>
1664
+ `;
1665
+ return html`
1666
+ <div class="git-panel">
1667
+ ${syncBarT} ${branchSelectorT} ${tabsT}
1668
+ ${shell.git.subTab === "changes" ? html`${commitT}${changesT}` : historyT}
1669
+ ${loading ? html`<div class="git-loading">Loading...</div>` : nothing}
1670
+ ${shell.git.error ? html`<div class="git-error">${shell.git.error}</div>` : nothing}
1671
+ </div>
1672
+ `;
1673
+ }
1674
+ function relativeDate(iso) {
1675
+ const d = new Date(iso);
1676
+ const diff = now() - d.getTime();
1677
+ const mins = Math.floor(diff / 60000);
1678
+ if (mins < 1) {
1679
+ return "just now";
1680
+ }
1681
+ if (mins < 60) {
1682
+ return `${mins}m ago`;
1683
+ }
1684
+ const hours = Math.floor(mins / 60);
1685
+ if (hours < 24) {
1686
+ return `${hours}h ago`;
1687
+ }
1688
+ const days = Math.floor(hours / 24);
1689
+ if (days < 30) {
1690
+ return `${days}d ago`;
1691
+ }
1692
+ return d.toLocaleDateString();
1693
+ }
1694
+ function sourceControlCommands() {
1695
+ return [
1696
+ {
1697
+ category: "Source Control",
1698
+ id: "git.init",
1699
+ level: "project",
1700
+ menus: ["commandbar/overflow", "palette"],
1701
+ group: "7_scm",
1702
+ requires: "an open project that git is not already tracking",
1703
+ when: (ctx) => ctx.project.open,
1704
+ enablement: (ctx) => !ctx.project.isRepo,
1705
+ aiTool: {
1706
+ description: "Run git init in the project root so the project has a history and can be pushed.",
1707
+ name: "init_repository"
1708
+ },
1709
+ run: async () => {
1710
+ await initRepository();
1711
+ },
1712
+ title: "Initialize Repository"
1713
+ },
1714
+ {
1715
+ category: "Source Control",
1716
+ id: "git.createGithubRepository",
1717
+ level: "project",
1718
+ menus: ["commandbar/overflow", "palette"],
1719
+ group: "7_scm",
1720
+ requires: "a project tracked by git",
1721
+ when: (ctx) => ctx.project.open,
1722
+ enablement: (ctx) => ctx.project.isRepo,
1723
+ aiTool: {
1724
+ description: "Create a new GitHub repository for this project, add it as the origin remote, and push. " + "This creates a repository; it does not deploy a site — that is publish.setUp.",
1725
+ name: "create_github_repository"
1726
+ },
1727
+ run: async () => {
1728
+ await createGithubRepository({ projectName: projectState?.name || "my-project" });
1729
+ },
1730
+ title: "Create GitHub Repository"
1731
+ },
1732
+ {
1733
+ category: "Source Control",
1734
+ id: "git.push",
1735
+ level: "project",
1736
+ menus: ["commandbar/overflow", "palette"],
1737
+ group: "7_scm",
1738
+ requires: "a project tracked by git",
1739
+ when: (ctx) => ctx.project.open,
1740
+ enablement: (ctx) => ctx.project.isRepo,
1741
+ aiTool: {
1742
+ description: "Push the current branch to its remote.",
1743
+ name: "git_push"
1744
+ },
1745
+ run: async () => {
1746
+ await pushCurrentBranch();
1747
+ },
1748
+ title: "Push"
1749
+ },
1750
+ {
1751
+ category: "Source Control",
1752
+ id: "git.signInToGithub",
1753
+ level: "application",
1754
+ menus: ["palette"],
1755
+ group: "7_scm",
1756
+ run: async () => {
1757
+ await signInToGithub();
1758
+ },
1759
+ title: "Sign In to GitHub"
1760
+ }
1761
+ ];
1762
+ }
1763
+ function registerSourceControlCommands(registry) {
1764
+ registry.registerAll(sourceControlCommands());
1765
+ }
1766
+ function cleanupGitPanel() {
1767
+ if (_pollTimer) {
1768
+ clearInterval(_pollTimer);
1769
+ _pollTimer = null;
1770
+ }
1771
+ }
1772
+ function registerGitPanel() {
1773
+ registerPanel({
1774
+ id: "git",
1775
+ title: "Source Control",
1776
+ level: "project",
1777
+ dock: "navigator",
1778
+ icon: "sp-icon-git-branch",
1779
+ badge: (ctx) => ctx.git.dirtyCount || null,
1780
+ render: (ctx) => ctx.deps.renderGitPanel(ctx.deps)
1781
+ });
1782
+ }
1783
+
1784
+ export { hydrateProjectList, getProjectList, shouldInstallAutomation, installAutomationHook, stripRange, isComparable, isUpgrade, maybePromptJxsuiteUpdate, autoSyncProjectOnOpen, githubTokenStored, githubTokenLocation, clearGithubToken, refreshGitStatus, cloneRepository, platformSupportsClone, readGitDiff, loadDiffForLens, initRepository, pushCurrentBranch, signInToGithub, renderGitPanel, relativeDate, sourceControlCommands, registerSourceControlCommands, cleanupGitPanel, registerGitPanel };
1785
+
1786
+ //# debugId=369A489EB1E6F95564756E2164756E21
1787
+ //# sourceMappingURL=studio-50k77cca.js.map