@jxsuite/studio 3.0.0 → 4.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 (197) hide show
  1. package/README.md +5 -5
  2. package/dist/chunks/{2020-xp8vnwma.js → 2020-n6tfwnda.js} +2 -2
  3. package/dist/chunks/Overlay.dev-etqjwyf9.js +23 -0
  4. package/dist/chunks/cf-account-picker-en86v7x7.js +163 -0
  5. package/dist/chunks/{cf-settings-zj2cj1ar.js → cf-settings-45fgyx8y.js} +6 -5
  6. package/dist/chunks/{components-z6cnkyy1.js → components-zmx10t62.js} +6 -5
  7. package/dist/chunks/content-source-48xg86wj.js +49 -0
  8. package/dist/chunks/{convert-to-repeater-6vvx96n2.js → convert-to-repeater-43tfn7cs.js} +33 -25
  9. package/dist/chunks/entry-commands-e63f1xc0.js +46 -0
  10. package/dist/chunks/{extension-sections-kwzvpemr.js → extension-sections-txv08xxg.js} +34 -26
  11. package/dist/chunks/file-ops-wbh4hhsx.js +48 -0
  12. package/dist/chunks/files-3kfkwhk4.js +93 -0
  13. package/dist/chunks/{focus-trap.esm-ggawf1hy.js → focus-trap.esm-9t2drp0g.js} +6 -5
  14. package/dist/chunks/{format-host-8fr3545e.js → format-host-w16q81tf.js} +3 -3
  15. package/dist/chunks/fs-events-hrrg328g.js +21 -0
  16. package/dist/chunks/{git-panel-g01d93vc.js → git-panel-532whr1y.js} +22 -16
  17. package/dist/chunks/{index-nj44jpzj.js → index-wcnt3r9g.js} +2 -2
  18. package/dist/chunks/{jx-validate-jj9rnt4n.js → jx-validate-8er6gbxy.js} +6 -4
  19. package/dist/chunks/layers-panel-07hm7g5j.js +67 -0
  20. package/dist/chunks/layers-q75tj2mf.js +45 -0
  21. package/dist/chunks/lit-html-j055mkh8.js +22 -0
  22. package/dist/chunks/monaco-buffer-dqw0xxpx.js +25 -0
  23. package/dist/chunks/{monaco-setup-a5wkmbgh.js → monaco-setup-vx9bhp1d.js} +4 -4
  24. package/dist/chunks/notify-yjm79n4s.js +30 -0
  25. package/dist/chunks/parse-24d0gay3.js +19 -0
  26. package/dist/chunks/platform-ba1j1gbh.js +16 -0
  27. package/dist/chunks/publish-panel-v9st96ja.js +29 -0
  28. package/dist/chunks/quick-search-zccjp6gv.js +66 -0
  29. package/dist/chunks/references-3qx8fkyp.js +29 -0
  30. package/dist/chunks/right-panel-vm3b6kwy.js +46 -0
  31. package/dist/chunks/sp-overlay.dev-qgvhnxf4.js +18 -0
  32. package/dist/chunks/sp-popover.dev-n2etmqdp.js +9 -0
  33. package/dist/chunks/sp-progress-circle.dev-hryhj0es.js +15 -0
  34. package/dist/chunks/sp-tooltip.dev-4sastdnw.js +15 -0
  35. package/dist/chunks/{sp-tray.dev-64v4pxw8.js → sp-tray.dev-tkbscm06.js} +5 -5
  36. package/dist/chunks/{studio-wdt9y92a.js → studio-0bq6eh7v.js} +2 -2
  37. package/dist/chunks/studio-1ngbejft.js +181 -0
  38. package/dist/chunks/studio-1wagb550.js +118 -0
  39. package/dist/chunks/{studio-j595e748.js → studio-2b946z26.js} +172 -95
  40. package/dist/chunks/{studio-pkp61mh8.js → studio-3bqpr0zh.js} +25 -17
  41. package/dist/chunks/{studio-k4jvjcfx.js → studio-4b5z1x43.js} +46 -12
  42. package/dist/chunks/{studio-ry1vz5sv.js → studio-4n2b5gzb.js} +15 -13
  43. package/dist/chunks/{studio-p5dja96s.js → studio-4r1pv6zf.js} +2 -2
  44. package/dist/chunks/{studio-kvfx9z2c.js → studio-4rzyrtjz.js} +70 -31
  45. package/dist/chunks/{studio-tzx3xmvx.js → studio-5fx3g9jg.js} +33 -52
  46. package/dist/chunks/{studio-rh1cnamv.js → studio-5myknm0a.js} +565 -135
  47. package/dist/chunks/studio-6yw4y3my.js +91 -0
  48. package/dist/chunks/{studio-0rqqhrdy.js → studio-7nte2hj4.js} +2 -2
  49. package/dist/chunks/studio-92ab2jqe.js +282 -0
  50. package/dist/chunks/{studio-6z5eyjwn.js → studio-950k0dx6.js} +72 -135
  51. package/dist/chunks/{studio-sas7mt3k.js → studio-9ab8gqsm.js} +2 -2
  52. package/dist/chunks/studio-9n4mrmnb.js +184 -0
  53. package/dist/chunks/{studio-hcxzyk3x.js → studio-ahn3pdgx.js} +6 -6
  54. package/dist/chunks/studio-b55y6ewx.js +498 -0
  55. package/dist/chunks/{studio-s519zc99.js → studio-bgxt93ga.js} +3 -3
  56. package/dist/chunks/studio-cft9r4r7.js +119 -0
  57. package/dist/chunks/{studio-dc8s8heb.js → studio-cmb03bg5.js} +6904 -8321
  58. package/dist/chunks/studio-dm19q43r.js +195 -0
  59. package/dist/chunks/{studio-2x9zbxmx.js → studio-ef49pnzx.js} +11 -9
  60. package/dist/chunks/{studio-ay8wcr2b.js → studio-eqq1w638.js} +7 -9
  61. package/dist/chunks/{studio-5efrtn1m.js → studio-ew0djmhg.js} +23 -19
  62. package/dist/chunks/{studio-tr20m8g8.js → studio-f3wqjtk5.js} +39 -3
  63. package/dist/chunks/{studio-xntfdy1x.js → studio-fbf92ckf.js} +36 -23
  64. package/dist/chunks/{studio-4q0wznzf.js → studio-gcye7qka.js} +442 -126
  65. package/dist/chunks/{studio-7p35254k.js → studio-gfgb8pe6.js} +36 -193
  66. package/dist/chunks/studio-jc994dnr.js +1066 -0
  67. package/dist/chunks/{studio-hj2se583.js → studio-jkftxyvz.js} +69 -3423
  68. package/dist/chunks/{studio-5x5774ak.js → studio-kryvsw6j.js} +3 -3
  69. package/dist/chunks/{studio-kfpek536.js → studio-kyh9avvv.js} +2 -2
  70. package/dist/chunks/{studio-twsafr1e.js → studio-m3hwn7y1.js} +3 -3
  71. package/dist/chunks/studio-msd847zn.js +1315 -0
  72. package/dist/chunks/{studio-g5gdqnyd.js → studio-mtfnaqs9.js} +19 -19
  73. package/dist/chunks/{studio-7ejemhej.js → studio-n6j9t10q.js} +6 -6
  74. package/dist/chunks/{studio-vhk5fmfv.js → studio-n8b9wqwy.js} +5 -5
  75. package/dist/chunks/{studio-cjm7fdjf.js → studio-p4ngc046.js} +8 -104
  76. package/dist/chunks/studio-q43a5y9h.js +394 -0
  77. package/dist/chunks/studio-q7v10cg2.js +106 -0
  78. package/dist/chunks/{studio-6kv3apa9.js → studio-q9jd1a60.js} +27 -11
  79. package/dist/chunks/studio-qcy05dp8.js +1743 -0
  80. package/dist/chunks/{studio-a0yp7syn.js → studio-qjy2z9bv.js} +29 -132
  81. package/dist/chunks/{studio-2w11grav.js → studio-qq6jym04.js} +3 -3
  82. package/dist/chunks/{studio-3fk1ac9z.js → studio-rdx8jcxy.js} +4 -4
  83. package/dist/chunks/{studio-4mqb9a0j.js → studio-rn9ta2mz.js} +4 -4
  84. package/dist/chunks/studio-t7qb9db8.js +665 -0
  85. package/dist/chunks/studio-tmc5emrw.js +8 -0
  86. package/dist/chunks/{studio-r5xbtctf.js → studio-trxrabqf.js} +292 -2297
  87. package/dist/chunks/studio-wcy8trfx.js +263 -0
  88. package/dist/chunks/{studio-3dkcd4c5.js → studio-x4qkdat5.js} +62 -57
  89. package/dist/chunks/studio-x813zp48.js +195 -0
  90. package/dist/chunks/{studio-qpfq7xhm.js → studio-xrapxwwc.js} +22 -285
  91. package/dist/chunks/{studio-xm3dbxvn.js → studio-zczps70q.js} +2 -2
  92. package/dist/chunks/{studio-8ezdegcx.js → studio-zqazsct2.js} +40 -36
  93. package/dist/chunks/workspace-fjx52ryv.js +89 -0
  94. package/dist/iframe-entry.js +141 -56
  95. package/dist/manifest.json +7 -0
  96. package/dist/studio.js +2605 -1950
  97. package/favicon.ico +0 -0
  98. package/index.html +1 -0
  99. package/package.json +20 -18
  100. package/src/about/about-modal.ts +4 -3
  101. package/src/browse/library-pane.ts +57 -3
  102. package/src/canvas/canvas-render.ts +23 -1
  103. package/src/canvas/iframe-patch.ts +47 -21
  104. package/src/canvas/iframe-render.ts +22 -6
  105. package/src/commands/app-commands.ts +4 -0
  106. package/src/commands/command-args.ts +29 -0
  107. package/src/commands/context.ts +15 -1
  108. package/src/commands/defaults.ts +29 -1
  109. package/src/commands/levels.ts +16 -0
  110. package/src/commands/live-context.ts +3 -0
  111. package/src/content/collection-match.ts +267 -0
  112. package/src/content/entry-commands.ts +38 -29
  113. package/src/content/entry-fields.ts +6 -0
  114. package/src/editor/shortcuts.ts +5 -0
  115. package/src/files/file-ops.ts +10 -42
  116. package/src/files/files.ts +487 -59
  117. package/src/files/fs-events.ts +9 -0
  118. package/src/files/gitignore.ts +432 -0
  119. package/src/files/media-paths.ts +13 -42
  120. package/src/files/media-usage.ts +41 -131
  121. package/src/files/serialize-document.ts +60 -0
  122. package/src/format/convert-file.ts +511 -0
  123. package/src/format/format-choices.ts +199 -0
  124. package/src/grid/grid-view.ts +16 -2
  125. package/src/hosting/document.ts +2 -0
  126. package/src/hosting/layout.ts +8 -0
  127. package/src/media/media-open.ts +58 -0
  128. package/src/media/media-pane.ts +310 -0
  129. package/src/new-project/import-tab.ts +357 -163
  130. package/src/new-project/location-fields.ts +8 -5
  131. package/src/new-project/new-project-modal.ts +27 -34
  132. package/src/packages/ensure-deps.ts +14 -7
  133. package/src/packages/jxsuite-update.ts +11 -11
  134. package/src/page-params.ts +10 -46
  135. package/src/panels/activity-bar.ts +45 -16
  136. package/src/panels/ai-chat/attached-context.ts +6 -1
  137. package/src/panels/ai-chat/chat-view.ts +255 -13
  138. package/src/panels/ai-chat/composer.ts +31 -97
  139. package/src/panels/ai-panel.ts +116 -2
  140. package/src/panels/navigator-panels.ts +7 -6
  141. package/src/panels/settings-menu.ts +799 -0
  142. package/src/panels/toolbar.ts +135 -15
  143. package/src/platforms/cloud.ts +261 -70
  144. package/src/platforms/devserver.ts +67 -33
  145. package/src/preview/preview-overlay.ts +226 -0
  146. package/src/publish/publish-panel.ts +62 -2
  147. package/src/services/ai-ask.ts +247 -0
  148. package/src/services/ai-import-tools.ts +532 -0
  149. package/src/services/ai-models.ts +108 -1
  150. package/src/services/ai-project-tools.ts +20 -26
  151. package/src/services/ai-system-prompt.ts +88 -2
  152. package/src/services/ai-turn-signal.ts +70 -0
  153. package/src/services/connection.ts +74 -0
  154. package/src/services/context-manager.ts +101 -1
  155. package/src/services/document-assistant.ts +45 -4
  156. package/src/services/import-client.ts +33 -6
  157. package/src/services/import-run.ts +158 -0
  158. package/src/services/import-seed.ts +120 -0
  159. package/src/services/jx-validate.ts +58 -6
  160. package/src/services/project-adoption.ts +71 -0
  161. package/src/services/references.ts +0 -0
  162. package/src/services/settings/definitions.ts +17 -0
  163. package/src/services/tool-executor.ts +45 -2
  164. package/src/settings/contexts-section.ts +45 -3
  165. package/src/settings/dependencies-editor.ts +43 -23
  166. package/src/settings/general-settings.ts +30 -12
  167. package/src/settings/preferences-accounts.ts +193 -12
  168. package/src/settings/preferences-dialog.ts +93 -59
  169. package/src/settings/preferences-sections.ts +57 -0
  170. package/src/settings/settings-document.ts +65 -9
  171. package/src/studio.ts +33 -6
  172. package/src/tabs/transact.ts +42 -19
  173. package/src/types.ts +129 -7
  174. package/src/ui/ai-managed-connect.ts +62 -13
  175. package/src/ui/ai-model-picker.ts +189 -0
  176. package/src/ui/cf-account-picker.ts +200 -0
  177. package/src/ui/choice-field.ts +72 -0
  178. package/src/ui/layers.ts +83 -5
  179. package/src/utils/studio-utils.ts +22 -52
  180. package/styles/forced-colors.css +7 -0
  181. package/styles/overlays.css +256 -0
  182. package/styles/panels.css +13 -1
  183. package/styles/shell.css +147 -0
  184. package/dist/chunks/Overlay.dev-d2ajy6sj.js +0 -23
  185. package/dist/chunks/content-source-7fy9qrm0.js +0 -40
  186. package/dist/chunks/files-xcybanxe.js +0 -70
  187. package/dist/chunks/layers-panel-27essgkc.js +0 -60
  188. package/dist/chunks/publish-panel-09sy2bab.js +0 -22
  189. package/dist/chunks/quick-search-sefb61v8.js +0 -55
  190. package/dist/chunks/right-panel-9r32jd5j.js +0 -39
  191. package/dist/chunks/sp-overlay.dev-s18hymn9.js +0 -18
  192. package/dist/chunks/sp-popover.dev-dj9x7e7a.js +0 -9
  193. package/dist/chunks/sp-progress-circle.dev-0zxcyz3r.js +0 -15
  194. package/dist/chunks/sp-tooltip.dev-5c6d1kjz.js +0 -15
  195. package/dist/chunks/studio-bw5dz6km.js +0 -608
  196. package/dist/chunks/studio-c31yb4t6.js +0 -55
  197. package/src/canvas/site-style-css.ts +0 -117
@@ -0,0 +1,263 @@
1
+ import {
2
+ notify,
3
+ toRaw
4
+ } from "./studio-xrapxwwc.js";
5
+
6
+ // src/view.ts
7
+ var view = {
8
+ functionEditor: null,
9
+ blockActionBarEl: null,
10
+ selDragCleanup: null,
11
+ dndCleanups: [],
12
+ elementsCollapsed: new Set,
13
+ elementsFilter: "",
14
+ _currentDropTargetRow: null,
15
+ layerDragSourceHeight: 0,
16
+ _completionRegistered: false,
17
+ _layersCollapsed: null
18
+ };
19
+
20
+ // src/canvas/surface-registry.ts
21
+ var STAGE_CLASS = "pane-stage";
22
+ var _nextGen = 0;
23
+ function nextRenderGeneration() {
24
+ _nextGen += 1;
25
+ return _nextGen;
26
+ }
27
+ var _surfaces = new Map;
28
+ function surfaceForPane(paneId) {
29
+ let surface = _surfaces.get(paneId);
30
+ if (!surface) {
31
+ surface = freshSurface(paneId);
32
+ _surfaces.set(paneId, surface);
33
+ }
34
+ return surface;
35
+ }
36
+ function freshSurface(paneId) {
37
+ return {
38
+ centerObserver: null,
39
+ monacoEditor: null,
40
+ needsCenter: true,
41
+ panX: 0,
42
+ panY: 0,
43
+ panels: [],
44
+ paneId,
45
+ panzoomWrap: null,
46
+ prevCanvasMode: null,
47
+ prevStylebookCustomizedOnly: null,
48
+ prevStylebookFilter: null,
49
+ renderGeneration: 0,
50
+ sourceCollabCleanup: null,
51
+ wrap: null
52
+ };
53
+ }
54
+ function allCanvasSurfaces() {
55
+ return [..._surfaces.values()];
56
+ }
57
+ function stageContaining(node) {
58
+ if (!node) {
59
+ return null;
60
+ }
61
+ for (const surface of _surfaces.values()) {
62
+ if (surface.wrap?.contains(node)) {
63
+ return surface;
64
+ }
65
+ }
66
+ return null;
67
+ }
68
+ function releaseMountedPanels(surface) {
69
+ for (const panel of surface.panels) {
70
+ panel.renderScope?.stop();
71
+ panel.renderScope = null;
72
+ }
73
+ surface.panels.length = 0;
74
+ surface.prevCanvasMode = null;
75
+ }
76
+ function registerCanvasSurface(paneId, wrap) {
77
+ const surface = surfaceForPane(paneId);
78
+ surface.wrap = wrap;
79
+ releaseMountedPanels(surface);
80
+ return surface;
81
+ }
82
+ function createPaneSurface(paneId) {
83
+ const existing = _surfaces.get(paneId);
84
+ if (existing) {
85
+ disposePaneSurface(paneId);
86
+ }
87
+ const surface = freshSurface(paneId);
88
+ _surfaces.set(paneId, surface);
89
+ return surface;
90
+ }
91
+ var _teardown = null;
92
+ function setSurfaceTeardown(fn) {
93
+ _teardown = fn;
94
+ }
95
+ function disposePaneSurface(paneId) {
96
+ const surface = _surfaces.get(paneId);
97
+ if (!surface) {
98
+ return;
99
+ }
100
+ _teardown?.(surface);
101
+ releaseMountedPanels(surface);
102
+ unregisterCanvasSurface(paneId);
103
+ }
104
+ function unregisterCanvasSurface(paneId) {
105
+ _surfaces.delete(paneId);
106
+ }
107
+
108
+ // src/services/monaco-buffer.ts
109
+ var BUFFER_COMMIT = "commit";
110
+ function bufferWrites(buffer) {
111
+ const timers = new Map;
112
+ const runs = new Map;
113
+ const inFlight = new Map;
114
+ let isAhead = false;
115
+ let isTyped = false;
116
+ let isShared = false;
117
+ function track(key, result) {
118
+ if (typeof result?.then !== "function") {
119
+ return result;
120
+ }
121
+ const promise = result.finally(() => {
122
+ if (inFlight.get(key) === promise) {
123
+ inFlight.delete(key);
124
+ }
125
+ });
126
+ inFlight.set(key, promise);
127
+ return promise;
128
+ }
129
+ const writes = {
130
+ arm(key, ms, run) {
131
+ clearTimeout(timers.get(key));
132
+ runs.set(key, run);
133
+ timers.set(key, setTimeout(() => {
134
+ timers.delete(key);
135
+ runs.delete(key);
136
+ track(key, run());
137
+ }, ms));
138
+ },
139
+ cancel() {
140
+ for (const timer of timers.values()) {
141
+ clearTimeout(timer);
142
+ }
143
+ timers.clear();
144
+ runs.clear();
145
+ },
146
+ flush(key) {
147
+ const run = runs.get(key);
148
+ if (!run) {
149
+ return inFlight.get(key);
150
+ }
151
+ clearTimeout(timers.get(key));
152
+ timers.delete(key);
153
+ runs.delete(key);
154
+ return track(key, run());
155
+ },
156
+ ahead: () => isAhead,
157
+ markAhead() {
158
+ isAhead = true;
159
+ },
160
+ typed: () => isTyped,
161
+ markTyped() {
162
+ isAhead = true;
163
+ isTyped = true;
164
+ },
165
+ markSettled() {
166
+ isAhead = false;
167
+ isTyped = false;
168
+ },
169
+ shared: () => isShared,
170
+ markShared() {
171
+ isShared = true;
172
+ }
173
+ };
174
+ buffer._writes = writes;
175
+ return writes;
176
+ }
177
+ var SURFACE = {
178
+ logic: { holds: "The handler you were typing", reached: "written into", source: "Logic" },
179
+ source: { holds: "The source you were typing", reached: "parsed into", source: "Editor" }
180
+ };
181
+ function reportDiscarded(buffer, surface, failure) {
182
+ const writes = buffer._writes;
183
+ if (writes?.typed() !== true) {
184
+ return true;
185
+ }
186
+ const tab = buffer._editingTab ?? null;
187
+ const where = tab?.documentPath ?? "Untitled";
188
+ const { holds, reached, source } = SURFACE[surface];
189
+ notify.warn(`${holds} was discarded — it was never ${reached} "${where}".`, {
190
+ ...failure ? { detail: describeCommitFailure(failure.error) } : {},
191
+ key: `buffer-discarded:${surface}:${tab?.id ?? "none"}`,
192
+ source,
193
+ ...tab?.documentPath ? { path: tab.documentPath } : {}
194
+ });
195
+ return false;
196
+ }
197
+ function describeCommitFailure(error) {
198
+ return error instanceof Error ? error.stack ?? error.message : String(error);
199
+ }
200
+ function commitBufferWrites(buffer, surface) {
201
+ const writes = buffer?._writes;
202
+ if (!buffer || !writes) {
203
+ return true;
204
+ }
205
+ let pending;
206
+ try {
207
+ pending = writes.flush(BUFFER_COMMIT);
208
+ } catch (error) {
209
+ writes.cancel();
210
+ return reportDiscarded(buffer, surface, { error });
211
+ }
212
+ writes.cancel();
213
+ if (typeof pending?.then === "function") {
214
+ pending.then(() => reportDiscarded(buffer, surface, null), (error) => reportDiscarded(buffer, surface, { error }));
215
+ return true;
216
+ }
217
+ return reportDiscarded(buffer, surface, null);
218
+ }
219
+ function cancelBufferWrites(buffer) {
220
+ buffer?._writes?.cancel();
221
+ }
222
+ function bufferIsLive(buffer) {
223
+ return Boolean(buffer?.getModel());
224
+ }
225
+ function bufferMovedOn(buffer, expected) {
226
+ if (!bufferIsLive(buffer) || buffer.hasTextFocus() || buffer._writes?.ahead() || buffer._writes?.shared()) {
227
+ return true;
228
+ }
229
+ return expected !== undefined && buffer.getValue() !== expected;
230
+ }
231
+ function buffersForTab(tab) {
232
+ const raw = toRaw(tab);
233
+ const mounted = [
234
+ ...allCanvasSurfaces().map((surface) => surface.monacoEditor),
235
+ view.functionEditor
236
+ ];
237
+ return mounted.filter((buffer) => buffer != null && buffer._editingTab != null && toRaw(buffer._editingTab) === raw && bufferIsLive(buffer));
238
+ }
239
+ async function commitTabBuffers(tab) {
240
+ for (const buffer of buffersForTab(tab)) {
241
+ if (!bufferIsLive(buffer)) {
242
+ continue;
243
+ }
244
+ try {
245
+ await buffer._writes?.flush(BUFFER_COMMIT);
246
+ } catch (error) {
247
+ notify.error(`Could not save the editor's contents into "${tab.documentPath ?? "Untitled"}".`, {
248
+ detail: error instanceof Error ? error.stack ?? error.message : String(error),
249
+ key: `buffer-commit:${tab.id}`,
250
+ source: "Editor",
251
+ ...tab.documentPath ? { path: tab.documentPath } : {}
252
+ });
253
+ }
254
+ }
255
+ }
256
+ function tabBufferUnsaved(tab) {
257
+ return buffersForTab(tab).some((buffer) => buffer._writes?.typed() === true);
258
+ }
259
+
260
+ export { view, STAGE_CLASS, nextRenderGeneration, surfaceForPane, allCanvasSurfaces, stageContaining, registerCanvasSurface, createPaneSurface, setSurfaceTeardown, disposePaneSurface, BUFFER_COMMIT, bufferWrites, commitBufferWrites, cancelBufferWrites, bufferIsLive, bufferMovedOn, commitTabBuffers, tabBufferUnsaved };
261
+
262
+ //# debugId=19DB9325F890591F64756E2164756E21
263
+ //# sourceMappingURL=studio-wcy8trfx.js.map
@@ -1,6 +1,3 @@
1
- import {
2
- live
3
- } from "./studio-c31yb4t6.js";
4
1
  import {
5
2
  BLESSED_GLOBALS,
6
3
  BLESSED_OPERATORS,
@@ -8,35 +5,38 @@ import {
8
5
  intlHelpersClause,
9
6
  rectOf,
10
7
  renderEmptyState
11
- } from "./studio-j595e748.js";
8
+ } from "./studio-2b946z26.js";
12
9
  import {
13
10
  LANGUAGE_TAG_PATTERN,
14
- activeTab,
15
- getLayerSlot
16
- } from "./studio-r5xbtctf.js";
11
+ activeTab
12
+ } from "./studio-trxrabqf.js";
17
13
  import {
18
14
  classMap,
19
15
  ifDefined,
20
16
  styleMap
21
- } from "./studio-twsafr1e.js";
17
+ } from "./studio-m3hwn7y1.js";
18
+ import {
19
+ cloneValue
20
+ } from "./studio-5ehhackm.js";
21
+ import {
22
+ getLayerSlot
23
+ } from "./studio-t7qb9db8.js";
22
24
  import {
25
+ live,
23
26
  ref
24
- } from "./studio-kvfx9z2c.js";
27
+ } from "./studio-4rzyrtjz.js";
25
28
  import {
26
29
  html,
27
30
  nothing,
28
31
  render
29
- } from "./studio-5x5774ak.js";
32
+ } from "./studio-kryvsw6j.js";
30
33
  import {
31
34
  isFunctionDef,
32
35
  isJsonObject,
33
36
  isNamedFormulaDef,
34
37
  isRef,
35
38
  isTemplateString
36
- } from "./studio-cjm7fdjf.js";
37
- import {
38
- cloneValue
39
- } from "./studio-5ehhackm.js";
39
+ } from "./studio-q7v10cg2.js";
40
40
 
41
41
  // src/panels/provenance.ts
42
42
  var PROVENANCE_TITLES = {
@@ -1700,6 +1700,10 @@ var functionDefSchema = {
1700
1700
  description: "Named export in $src module. Defaults to the state key name.",
1701
1701
  type: "string"
1702
1702
  },
1703
+ $lazy: {
1704
+ description: "Load $src on first call instead of importing it up front. The function then returns a " + "promise, so it may only be called from a handler or lifecycle hook — never bound as a " + "computed value. Use it for code most visitors never reach.",
1705
+ type: "boolean"
1706
+ },
1703
1707
  $prototype: { const: "Function", type: "string" },
1704
1708
  $src: {
1705
1709
  description: "External module specifier. Mutually exclusive with body.",
@@ -2083,6 +2087,7 @@ var CLASS_METHOD_ROLES = [
2083
2087
  "accessor",
2084
2088
  "parse",
2085
2089
  "serialize",
2090
+ "rewrite",
2086
2091
  "discover",
2087
2092
  "load",
2088
2093
  "projectData",
@@ -2098,7 +2103,7 @@ var CLASS_METHOD_ROLES = [
2098
2103
  "testConnection"
2099
2104
  ];
2100
2105
  var classMethodDefSchema = {
2101
- description: "A class method or accessor definition. Capability roles (parse, serialize, discover, load) " + "mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",
2106
+ description: "A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) " + "mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",
2102
2107
  properties: {
2103
2108
  $prototype: { const: "Function", type: "string" },
2104
2109
  access: { enum: ["public", "private", "protected"], type: "string" },
@@ -3003,6 +3008,45 @@ function configFieldSchema(field) {
3003
3008
  return { anyOf: [declared, { $ref: "#/$defs/RefObject" }] };
3004
3009
  }
3005
3010
 
3011
+ // src/services/context-resolver.ts
3012
+ var PARAM_SEGMENT = /^\{@(\w+)\}$/;
3013
+ function resolveContextPointer(pointer, opts) {
3014
+ if (!pointer.startsWith("#/$context/")) {
3015
+ return;
3016
+ }
3017
+ const segments = [];
3018
+ for (const raw of pointer.slice("#/$context/".length).split("/")) {
3019
+ const match = raw.match(PARAM_SEGMENT);
3020
+ if (match) {
3021
+ const value = opts.scope?.[match[1]];
3022
+ if (typeof value !== "string" && typeof value !== "number") {
3023
+ return;
3024
+ }
3025
+ const substituted = String(value);
3026
+ if (!substituted) {
3027
+ return;
3028
+ }
3029
+ segments.push(substituted);
3030
+ } else {
3031
+ segments.push(raw);
3032
+ }
3033
+ }
3034
+ if (segments[0] === "$formats") {
3035
+ if (segments.length !== 1) {
3036
+ return;
3037
+ }
3038
+ return (opts.formats ?? []).map((format) => format.name);
3039
+ }
3040
+ let node = opts.projectConfig;
3041
+ for (const segment of segments) {
3042
+ if (node === null || typeof node !== "object") {
3043
+ return;
3044
+ }
3045
+ node = node[segment];
3046
+ }
3047
+ return node;
3048
+ }
3049
+
3006
3050
  // src/ui/expression-editor.ts
3007
3051
  var UNARY_OPS = new Set(["!", "-"]);
3008
3052
  var BINARY_OPS = new Set([
@@ -4187,46 +4231,7 @@ function renderForm(schema, value, opts) {
4187
4231
  return html`${propertyFields}`;
4188
4232
  }
4189
4233
 
4190
- // src/services/context-resolver.ts
4191
- var PARAM_SEGMENT = /^\{@(\w+)\}$/;
4192
- function resolveContextPointer(pointer, opts) {
4193
- if (!pointer.startsWith("#/$context/")) {
4194
- return;
4195
- }
4196
- const segments = [];
4197
- for (const raw of pointer.slice("#/$context/".length).split("/")) {
4198
- const match = raw.match(PARAM_SEGMENT);
4199
- if (match) {
4200
- const value = opts.scope?.[match[1]];
4201
- if (typeof value !== "string" && typeof value !== "number") {
4202
- return;
4203
- }
4204
- const substituted = String(value);
4205
- if (!substituted) {
4206
- return;
4207
- }
4208
- segments.push(substituted);
4209
- } else {
4210
- segments.push(raw);
4211
- }
4212
- }
4213
- if (segments[0] === "$formats") {
4214
- if (segments.length !== 1) {
4215
- return;
4216
- }
4217
- return (opts.formats ?? []).map((format) => format.name);
4218
- }
4219
- let node = opts.projectConfig;
4220
- for (const segment of segments) {
4221
- if (node === null || typeof node !== "object") {
4222
- return;
4223
- }
4224
- node = node[segment];
4225
- }
4226
- return node;
4227
- }
4228
-
4229
- export { renderProvenanceChip, countProvenance, renderProvenanceDots, renderFieldRow, renderKvRow, renderStaticKvRow, chipSummary, renderFormulaChips, applyCatalogPick, globalEntries, namedFormulaEntries, formulaCatalog, openFormulaPalette, REDIRECT_STATUSES, VALUE_SOURCE_LABELS, slotMode, capsForPosition, isActionExpression, expressionHint, renderOperandEditor, renderExpressionEditor, switchSlotMode, renderDynamicSlot, registerFormControl, getFormControl, referenceTarget, NULL_FORM_CONTEXT, renderForm, resolveContextPointer };
4234
+ export { renderProvenanceChip, countProvenance, renderProvenanceDots, renderFieldRow, renderKvRow, renderStaticKvRow, chipSummary, renderFormulaChips, applyCatalogPick, globalEntries, namedFormulaEntries, formulaCatalog, openFormulaPalette, REDIRECT_STATUSES, VALUE_SOURCE_LABELS, slotMode, capsForPosition, resolveContextPointer, isActionExpression, expressionHint, renderOperandEditor, renderExpressionEditor, switchSlotMode, renderDynamicSlot, registerFormControl, getFormControl, referenceTarget, NULL_FORM_CONTEXT, renderForm };
4230
4235
 
4231
- //# debugId=D548DF8319DDE4D664756E2164756E21
4232
- //# sourceMappingURL=studio-3dkcd4c5.js.map
4236
+ //# debugId=DDC68693A8D15CAC64756E2164756E21
4237
+ //# sourceMappingURL=studio-x4qkdat5.js.map
@@ -0,0 +1,195 @@
1
+ import {
2
+ clearAiProvider,
3
+ getBaseUrl,
4
+ hasOpenAiKey,
5
+ preferredModel,
6
+ resetModelCache
7
+ } from "./studio-dm19q43r.js";
8
+ import {
9
+ clearCfConnection,
10
+ getCfAccountId,
11
+ getCfToken
12
+ } from "./studio-kyh9avvv.js";
13
+ import {
14
+ clearGithubToken,
15
+ githubTokenLocation,
16
+ githubTokenStored
17
+ } from "./studio-1ngbejft.js";
18
+ import {
19
+ getPlatform,
20
+ hasPlatform
21
+ } from "./studio-9ab8gqsm.js";
22
+ import {
23
+ __require
24
+ } from "./studio-a0tswy0w.js";
25
+
26
+ // src/settings/preferences-accounts.ts
27
+ var _cfState = "checking";
28
+ var _cfInFlight = null;
29
+ function platformBrokersCf() {
30
+ return hasPlatform() && Boolean(getPlatform().cfConnect);
31
+ }
32
+ async function refreshCfConnection() {
33
+ if (!platformBrokersCf()) {
34
+ return;
35
+ }
36
+ _cfInFlight ??= (async () => {
37
+ try {
38
+ _cfState = await getPlatform().cfConnection?.() ?? null;
39
+ } catch {
40
+ _cfState = null;
41
+ }
42
+ _cfInFlight = null;
43
+ notifyCredentialsChanged();
44
+ })();
45
+ await _cfInFlight;
46
+ }
47
+ function ensureCfConnection() {
48
+ if (platformBrokersCf() && _cfState === "checking" && !_cfInFlight) {
49
+ refreshCfConnection();
50
+ }
51
+ }
52
+ function resetCfConnectionCache() {
53
+ _cfState = "checking";
54
+ _cfInFlight = null;
55
+ }
56
+ async function hostedConnect() {
57
+ const outcome = await getPlatform().cfConnect?.();
58
+ if (outcome?.status === "connected" && !outcome.connection.accountId) {
59
+ const { openCfAccountPicker } = await import("./cf-account-picker-en86v7x7.js");
60
+ await openCfAccountPicker();
61
+ }
62
+ resetModelCache();
63
+ await refreshCfConnection();
64
+ }
65
+ function brokeredCloudflareRecord() {
66
+ const disconnect = {
67
+ id: "disconnect",
68
+ label: "Disconnect",
69
+ run: async () => {
70
+ await getPlatform().cfDisconnect?.();
71
+ resetModelCache();
72
+ await refreshCfConnection();
73
+ },
74
+ variant: "negative"
75
+ };
76
+ const connect = (label) => ({
77
+ id: label === "Connect" ? "connect" : "reconnect",
78
+ label,
79
+ run: hostedConnect,
80
+ variant: "accent"
81
+ });
82
+ const base = { id: "cloudflare", label: "Cloudflare", revoke: () => {} };
83
+ if (_cfState === "checking") {
84
+ return { ...base, actions: [], connected: false, detail: "Checking your connection…" };
85
+ }
86
+ if (!_cfState?.connected) {
87
+ return {
88
+ ...base,
89
+ actions: [connect("Connect")],
90
+ connected: false,
91
+ detail: "Not connected. Connecting publishes this site and runs the assistant on Workers AI."
92
+ };
93
+ }
94
+ const revoke = () => {
95
+ disconnect.run();
96
+ };
97
+ if (_cfState.needsReconnect) {
98
+ return {
99
+ ...base,
100
+ actions: [connect("Reconnect"), disconnect],
101
+ connected: true,
102
+ detail: "Connection expired. Reconnect to keep publishing and the assistant working.",
103
+ revoke
104
+ };
105
+ }
106
+ if (_cfState.needsAccount || !_cfState.accountId) {
107
+ return {
108
+ ...base,
109
+ actions: [
110
+ {
111
+ id: "choose-account",
112
+ label: "Choose account",
113
+ run: async () => {
114
+ const { openCfAccountPicker } = await import("./cf-account-picker-en86v7x7.js");
115
+ if (await openCfAccountPicker()) {
116
+ resetModelCache();
117
+ await refreshCfConnection();
118
+ }
119
+ },
120
+ variant: "accent"
121
+ },
122
+ disconnect
123
+ ],
124
+ connected: true,
125
+ detail: "Connected, but no account is chosen yet — publishing and the assistant need one.",
126
+ revoke
127
+ };
128
+ }
129
+ return {
130
+ ...base,
131
+ actions: [disconnect],
132
+ connected: true,
133
+ detail: `Connected — ${_cfState.accountName ?? _cfState.accountId}.`,
134
+ revoke
135
+ };
136
+ }
137
+ function localCloudflareRecord() {
138
+ const cfToken = getCfToken();
139
+ const cfAccount = getCfAccountId();
140
+ return {
141
+ connected: Boolean(cfToken),
142
+ detail: cfToken ? `Connected${cfAccount ? ` — account ${cfAccount}` : ""}.` : "Not connected. Publishing will ask when it needs it.",
143
+ id: "cloudflare",
144
+ label: "Cloudflare",
145
+ revoke: clearCfConnection
146
+ };
147
+ }
148
+ function listAccounts() {
149
+ const githubToken = githubTokenStored();
150
+ const model = preferredModel();
151
+ const endpoint = getBaseUrl();
152
+ return [
153
+ {
154
+ id: "github",
155
+ label: "GitHub",
156
+ detail: githubToken ? githubTokenLocation() === "desktop" ? "Signed in — the token is in this app's config folder, readable only by you." : "Signed in — a device-flow token is stored in this browser." : "Not signed in. Cloning and pushing will ask when they need it.",
157
+ connected: Boolean(githubToken),
158
+ revoke: clearGithubToken
159
+ },
160
+ {
161
+ id: "ai",
162
+ label: "AI provider",
163
+ detail: hasOpenAiKey() ? `Key stored. Model ${model}${endpoint ? ` via ${endpoint}` : ""}.` : "No key stored. The Assistant section is where one is entered.",
164
+ connected: hasOpenAiKey(),
165
+ revoke: clearAiProvider
166
+ },
167
+ platformBrokersCf() ? brokeredCloudflareRecord() : localCloudflareRecord()
168
+ ];
169
+ }
170
+ function revokeAccount(id) {
171
+ const account = listAccounts().find((candidate) => candidate.id === id);
172
+ if (!account) {
173
+ return false;
174
+ }
175
+ account.revoke();
176
+ notifyCredentialsChanged();
177
+ return true;
178
+ }
179
+ var _listeners = new Set;
180
+ function onCredentialsChanged(listener) {
181
+ _listeners.add(listener);
182
+ return () => {
183
+ _listeners.delete(listener);
184
+ };
185
+ }
186
+ function notifyCredentialsChanged() {
187
+ for (const listener of _listeners) {
188
+ listener();
189
+ }
190
+ }
191
+
192
+ export { platformBrokersCf, refreshCfConnection, ensureCfConnection, resetCfConnectionCache, listAccounts, revokeAccount, onCredentialsChanged, notifyCredentialsChanged };
193
+
194
+ //# debugId=ECD354251070A96664756E2164756E21
195
+ //# sourceMappingURL=studio-x813zp48.js.map