@jxsuite/studio 2.3.0 → 2.4.1

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 (47) hide show
  1. package/dist/chunks/{content-source-56xpvx83.js → content-source-cn9te96r.js} +8 -8
  2. package/dist/chunks/{convert-to-repeater-0xh9wwek.js → convert-to-repeater-65gjgdst.js} +7 -7
  3. package/dist/chunks/{extension-sections-g34239vm.js → extension-sections-mdgmqrry.js} +11 -11
  4. package/dist/chunks/{files-gkz202dp.js → files-dsh5g8j4.js} +12 -12
  5. package/dist/chunks/{format-host-pej3srnw.js → format-host-m9h45a79.js} +2 -2
  6. package/dist/chunks/{git-panel-4j6xbh8g.js → git-panel-rfs8pqjj.js} +7 -7
  7. package/dist/chunks/{layers-panel-8mvn8sgd.js → layers-panel-6cj5nf6a.js} +10 -10
  8. package/dist/chunks/{publish-panel-ptddc3kg.js → publish-panel-b0xh7b4y.js} +5 -5
  9. package/dist/chunks/{quick-search-j88azfs2.js → quick-search-a83fhnsh.js} +13 -13
  10. package/dist/chunks/{right-panel-egkaxy89.js → right-panel-hrw5kdh5.js} +9 -9
  11. package/dist/chunks/{studio-4058pg09.js → studio-0svvdm0a.js} +4 -4
  12. package/dist/chunks/{studio-5amdrjm4.js → studio-1d6bm7eg.js} +7 -7
  13. package/dist/chunks/{studio-50eed4c9.js → studio-40fm3hyr.js} +2 -2
  14. package/dist/chunks/{studio-0e4h32g6.js → studio-4m39t01b.js} +5 -5
  15. package/dist/chunks/{studio-5ne8mdx9.js → studio-675v08qj.js} +2 -2
  16. package/dist/chunks/{studio-cf4rk7kv.js → studio-91sdrn9x.js} +2 -2
  17. package/dist/chunks/{studio-bak2cyjr.js → studio-9sxn0eaa.js} +4 -4
  18. package/dist/chunks/{studio-3q65xvzv.js → studio-d1f2rqxh.js} +4 -4
  19. package/dist/chunks/{studio-a11d3a1b.js → studio-gfzyxa0m.js} +5 -5
  20. package/dist/chunks/{studio-x3etxs0s.js → studio-gqpbrrj5.js} +8 -8
  21. package/dist/chunks/{studio-10s469da.js → studio-h6553a8h.js} +71 -22
  22. package/dist/chunks/{studio-ncnet0ba.js → studio-jand3kjg.js} +10 -10
  23. package/dist/chunks/{studio-hk523hby.js → studio-kfq9ed73.js} +3 -3
  24. package/dist/chunks/{studio-hs8x23fv.js → studio-n9k15qdg.js} +8 -8
  25. package/dist/chunks/{studio-yxzgjq8q.js → studio-qb6vy1z1.js} +8 -8
  26. package/dist/chunks/{studio-vdpcpada.js → studio-qymkxbcq.js} +3 -3
  27. package/dist/chunks/{studio-zdkgwhkv.js → studio-rkr6pm84.js} +3 -3
  28. package/dist/chunks/{studio-cv606rs1.js → studio-rz861p2b.js} +5 -5
  29. package/dist/chunks/{studio-4enps87v.js → studio-tdt7b6qb.js} +6 -6
  30. package/dist/iframe-entry.js +73 -9
  31. package/dist/studio.js +46 -34
  32. package/package.json +6 -6
  33. package/src/canvas/canvas-live-render.ts +2 -4
  34. package/src/canvas/canvas-origin.ts +25 -0
  35. package/src/canvas/editable-actions.ts +37 -1
  36. package/src/canvas/iframe-editable-root.ts +27 -0
  37. package/src/canvas/iframe-host.ts +118 -7
  38. package/src/canvas/iframe-inline-edit.ts +64 -2
  39. package/src/canvas/iframe-protocol.ts +7 -0
  40. package/src/canvas/iframe-render.ts +38 -1
  41. package/src/editor/inline-edit-apply.ts +10 -4
  42. package/src/editor/inline-edit.ts +62 -4
  43. package/src/platforms/cloud.ts +9 -0
  44. package/src/services/ai-models.ts +14 -1
  45. package/src/types.ts +17 -0
  46. package/src/ui/ai-managed-connect.ts +18 -3
  47. package/styles/shell.css +7 -0
package/src/types.ts CHANGED
@@ -181,6 +181,23 @@ export interface StudioPlatform {
181
181
  * Not keyed on `id`: chromium and electrobun both report `"desktop"`, and only electrobun defers.
182
182
  */
183
183
  canvasUrlDeferred?: boolean;
184
+ /**
185
+ * Base URL the canvas fetches PROJECT FILES from — component `$ref`s, `$src` modules, images.
186
+ *
187
+ * The renderer resolves a `$ref` with `fetch(url).then(r => r.json())` from inside the iframe, so
188
+ * project files have to exist at a URL, not merely behind {@link readFile}. Hosts that serve the
189
+ * project tree from their web root need no value here: the default is `<canvas
190
+ * origin>/<projectRoot>/`, which is what the dev server and the desktop loopback both already
191
+ * answer.
192
+ *
193
+ * A host whose project files are NOT at a URL-shaped `projectRoot` must set this. Jx Cloud is
194
+ * one: its `projectRoot` is the identifier `owner/repo@branch`, nothing served the tree, and
195
+ * every `$ref` fetch landed on the SPA fallback — which answers HTML at **200**, so `res.ok`
196
+ * passed and the parse died on `Unexpected token '<'`. Images failed the same way in silence.
197
+ *
198
+ * Must end in `/`; a project-relative path is appended to it verbatim.
199
+ */
200
+ documentBaseUrl?: string;
184
201
  activate: (root?: string) => Promise<void>;
185
202
  openProject: () => Promise<{
186
203
  config: ProjectConfig;
@@ -24,6 +24,7 @@ import {
24
24
  fetchAvailableModels,
25
25
  isManagedProxy,
26
26
  isProxyConfigured,
27
+ proxyStateCode,
27
28
  } from "../services/ai-models";
28
29
 
29
30
  export interface ManagedConnectOptions {
@@ -91,17 +92,31 @@ export function createManagedConnect(opts: ManagedConnectOptions): ManagedConnec
91
92
  if (!canOffer()) {
92
93
  return nothing;
93
94
  }
95
+ /*
96
+ * A lapsed grant and a fresh one get different words. The backend distinguishes them because
97
+ * "connect" is an invitation and "reconnect" is an explanation — and on a managed platform the
98
+ * lapsed case is the common one: a Cloudflare access token lives an hour.
99
+ */
100
+ const lapsed = proxyStateCode() === "cf_reconnect_required";
101
+ const busyLabel = lapsed ? "Reconnecting…" : "Connecting…";
94
102
  return html`
95
- <div class="ai-managed-connect">
96
- <div>Use Workers AI on your own Cloudflare account — no API key needed.</div>
103
+ <div class="ai-managed-connect" data-jx-recommended="cloudflare">
104
+ <div class="ai-managed-connect-lede">
105
+ ${
106
+ lapsed
107
+ ? "Your Cloudflare connection has expired. Reconnect to keep using the assistant."
108
+ : "Recommended — run the assistant on Workers AI in your own Cloudflare account. No API key to create, copy or rotate."
109
+ }
110
+ </div>
97
111
  <sp-button
98
112
  size="s"
113
+ variant="accent"
99
114
  ?disabled=${busy}
100
115
  @click=${() => {
101
116
  void connect();
102
117
  }}
103
118
  >
104
- ${busy ? "Connecting…" : "Connect Cloudflare"}
119
+ ${busy ? busyLabel : lapsed ? "Reconnect Cloudflare" : "Connect Cloudflare"}
105
120
  </sp-button>
106
121
  ${connectError ? html`<div class="ai-managed-connect-error">${connectError}</div>` : nothing}
107
122
  <div class="ai-managed-connect-divider">— or bring your own key —</div>
package/styles/shell.css CHANGED
@@ -753,6 +753,13 @@
753
753
  gap: 10px;
754
754
  width: 100%;
755
755
  }
756
+ /* The lede reads as the recommendation, so it carries weight the divider beneath it does not. */
757
+ .ai-managed-connect-lede {
758
+ color: var(--fg);
759
+ font-size: var(--spectrum-font-size-75, 12px);
760
+ max-width: 280px;
761
+ text-align: center;
762
+ }
756
763
  .ai-managed-connect-error {
757
764
  color: var(--danger);
758
765
  font-size: var(--spectrum-font-size-50, 11px);