@jxsuite/studio 0.33.0 → 0.35.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 (106) hide show
  1. package/dist/iframe-entry.js +6238 -0
  2. package/dist/iframe-entry.js.map +35 -0
  3. package/dist/studio.js +30972 -17222
  4. package/dist/studio.js.map +328 -83
  5. package/package.json +9 -9
  6. package/src/browse/browse.ts +11 -4
  7. package/src/canvas/canvas-helpers.ts +2 -56
  8. package/src/canvas/canvas-live-render.ts +102 -435
  9. package/src/canvas/canvas-origin.ts +66 -0
  10. package/src/canvas/canvas-patcher.ts +63 -403
  11. package/src/canvas/canvas-render.ts +70 -212
  12. package/src/canvas/canvas-utils.ts +37 -65
  13. package/src/canvas/iframe-channel.ts +154 -0
  14. package/src/canvas/iframe-drop.ts +484 -0
  15. package/src/canvas/iframe-entry.ts +600 -0
  16. package/src/canvas/iframe-host.ts +1373 -0
  17. package/src/canvas/iframe-inline-edit.ts +367 -0
  18. package/src/canvas/iframe-insert.ts +164 -0
  19. package/src/canvas/iframe-interaction.ts +176 -0
  20. package/src/canvas/iframe-keys.ts +85 -0
  21. package/src/canvas/iframe-overlay.ts +218 -0
  22. package/src/canvas/iframe-patch.ts +363 -0
  23. package/src/canvas/iframe-protocol.ts +361 -0
  24. package/src/canvas/iframe-render.ts +458 -0
  25. package/src/canvas/iframe-slash.ts +114 -0
  26. package/src/canvas/iframe-subtree.ts +113 -0
  27. package/src/canvas/path-mapping.ts +86 -0
  28. package/src/canvas/serialize-scope.ts +65 -0
  29. package/src/editor/canvas-context-menu.ts +40 -0
  30. package/src/editor/canvas-slash-bridge.ts +21 -0
  31. package/src/editor/context-menu.ts +2 -1
  32. package/src/editor/inline-edit-apply.ts +183 -0
  33. package/src/editor/inline-edit.ts +99 -21
  34. package/src/editor/inline-link.ts +89 -0
  35. package/src/editor/insert-zone-action.ts +35 -0
  36. package/src/editor/merge-tags.ts +26 -2
  37. package/src/editor/repeater-scope.ts +144 -0
  38. package/src/editor/shortcuts.ts +14 -28
  39. package/src/editor/slash-menu.ts +73 -42
  40. package/src/files/files.ts +5 -1
  41. package/src/new-project/design-fields.ts +260 -0
  42. package/src/new-project/import-tab.ts +322 -0
  43. package/src/new-project/new-project-modal.ts +472 -89
  44. package/src/new-project/templates.ts +61 -0
  45. package/src/packages/ensure-deps.ts +6 -0
  46. package/src/packages/pull-package-sync.ts +339 -0
  47. package/src/page-params.ts +383 -0
  48. package/src/panels/ai-chat/attached-context.ts +49 -0
  49. package/src/panels/ai-chat/chat-markdown.ts +38 -0
  50. package/src/panels/ai-chat/chat-view.ts +250 -0
  51. package/src/panels/ai-chat/composer.ts +315 -0
  52. package/src/panels/ai-chat/sessions-view.ts +98 -0
  53. package/src/panels/ai-panel.ts +189 -457
  54. package/src/panels/block-action-bar.ts +296 -138
  55. package/src/panels/canvas-dnd-bridge.ts +397 -0
  56. package/src/panels/component-preview.ts +56 -0
  57. package/src/panels/dnd.ts +41 -17
  58. package/src/panels/drag-ghost.ts +62 -0
  59. package/src/panels/editors.ts +1 -1
  60. package/src/panels/git-panel.ts +16 -1
  61. package/src/panels/overlays.ts +10 -125
  62. package/src/panels/properties-panel.ts +210 -0
  63. package/src/panels/right-panel.ts +21 -7
  64. package/src/panels/signals-panel.ts +136 -22
  65. package/src/panels/stylebook-doc.ts +373 -0
  66. package/src/panels/stylebook-panel.ts +46 -689
  67. package/src/panels/tab-bar.ts +159 -13
  68. package/src/panels/toolbar.ts +3 -2
  69. package/src/platforms/devserver.ts +45 -1
  70. package/src/services/agent-seed.ts +91 -0
  71. package/src/services/ai-models.ts +64 -0
  72. package/src/services/ai-session-store.ts +250 -0
  73. package/src/services/ai-settings.ts +5 -0
  74. package/src/services/automation.ts +140 -0
  75. package/src/services/document-assistant.ts +98 -38
  76. package/src/services/import-client.ts +134 -0
  77. package/src/services/monaco-setup.ts +12 -0
  78. package/src/services/render-critic.ts +9 -9
  79. package/src/services/settings-store.ts +93 -0
  80. package/src/settings/css-vars-editor.ts +2 -2
  81. package/src/store.ts +4 -62
  82. package/src/studio.ts +115 -40
  83. package/src/tabs/doc-op-apply.ts +89 -0
  84. package/src/tabs/patch-ops.ts +6 -2
  85. package/src/tabs/tab.ts +23 -4
  86. package/src/tabs/transact.ts +2 -74
  87. package/src/types.ts +98 -18
  88. package/src/ui/ai-credentials-form.ts +205 -0
  89. package/src/ui/jx-theme.ts +63 -0
  90. package/src/ui/media-picker.ts +6 -4
  91. package/src/ui/spectrum.ts +13 -0
  92. package/src/utils/canvas-media.ts +0 -137
  93. package/src/utils/edit-display.ts +23 -3
  94. package/src/utils/geometry.ts +43 -0
  95. package/src/utils/link-target.ts +93 -0
  96. package/src/utils/strip-events.ts +54 -0
  97. package/src/view.ts +0 -23
  98. package/src/workspace/workspace.ts +14 -1
  99. package/src/canvas/canvas-subtree-render.ts +0 -113
  100. package/src/editor/component-inline-edit.ts +0 -349
  101. package/src/editor/content-inline-edit.ts +0 -207
  102. package/src/editor/insertion-helper.ts +0 -308
  103. package/src/panels/canvas-dnd.ts +0 -329
  104. package/src/panels/panel-events.ts +0 -306
  105. package/src/panels/preview-render.ts +0 -132
  106. package/src/panels/pseudo-preview.ts +0 -75
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/studio",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "description": "Jx Studio — visual builder for Jx documents",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,7 +17,8 @@
17
17
  "exports": {
18
18
  ".": "./src/studio.ts",
19
19
  "./platform": "./src/platform.ts",
20
- "./types": "./src/types.ts"
20
+ "./types": "./src/types.ts",
21
+ "./import-client": "./src/services/import-client.ts"
21
22
  },
22
23
  "publishConfig": {
23
24
  "provenance": true
@@ -36,10 +37,10 @@
36
37
  "dependencies": {
37
38
  "@atlaskit/pragmatic-drag-and-drop": "^2.0.1",
38
39
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
39
- "@jxsuite/ai": "^0.1.0",
40
- "@jxsuite/parser": "^0.33.0",
41
- "@jxsuite/runtime": "^0.33.0",
42
- "@jxsuite/schema": "^0.33.0",
40
+ "@jxsuite/ai": "^0.33.0",
41
+ "@jxsuite/parser": "^0.35.0",
42
+ "@jxsuite/runtime": "^0.34.1",
43
+ "@jxsuite/schema": "^0.34.0",
43
44
  "@spectrum-web-components/accordion": "^1.12.1",
44
45
  "@spectrum-web-components/action-bar": "1.12.1",
45
46
  "@spectrum-web-components/action-button": "^1.12.1",
@@ -82,15 +83,14 @@
82
83
  "lit": "^3.3.3",
83
84
  "lit-html": "^3.3.3",
84
85
  "monaco-editor": "^0.55.1",
85
- "quikchat": "^1.2.7",
86
86
  "yaml": "^2.9.0"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@happy-dom/global-registrator": "^20.10.6",
90
90
  "@types/mdast": "^4.0.4",
91
- "@webref/css": "^8.6.0",
91
+ "@webref/css": "^8.6.1",
92
92
  "@webref/elements": "^2.7.1",
93
- "@webref/idl": "^3.81.1"
93
+ "@webref/idl": "^3.81.2"
94
94
  },
95
95
  "//vue-reactivity": "Exact pin required — must match @jxsuite/runtime to avoid cross-boundary proxy bugs"
96
96
  }
@@ -18,9 +18,11 @@ import type { SchemaProperty } from "../settings/schema-field-ui";
18
18
  import { invalidateMediaCache } from "../ui/media-picker";
19
19
  import { statusMessage } from "../panels/statusbar";
20
20
  import { componentRegistry } from "../files/components";
21
+ import { rectOf } from "../utils/geometry";
21
22
 
22
23
  import { renderPopover, showDialog } from "../ui/layers";
23
- import { renderComponentPreview } from "../panels/stylebook-panel";
24
+ import { loopbackAssetSrc } from "../canvas/canvas-origin";
25
+ import { renderComponentPreview } from "../panels/component-preview";
24
26
  import { buildScope, renderNode, setSkipServerFunctions } from "@jxsuite/runtime";
25
27
  import { parseSourceForPath } from "../files/file-ops";
26
28
  import {
@@ -448,7 +450,7 @@ function showBrowseContextMenu(
448
450
  }
449
451
  requestAnimationFrame(() => {
450
452
  const popover = el as HTMLElement;
451
- const menuRect = popover.getBoundingClientRect();
453
+ const menuRect = rectOf(popover);
452
454
  if (x + menuRect.width > window.innerWidth) {
453
455
  x = window.innerWidth - menuRect.width - 4;
454
456
  }
@@ -694,6 +696,11 @@ async function loadPreview(el: Element, file: { path: string; category: string }
694
696
  return;
695
697
  }
696
698
 
699
+ // Component/doc previews instantiate a real runtime custom element that sets img.src verbatim to
700
+ // A relative path — not a direct-parent lit literal, so it cannot be pre-rewritten via
701
+ // LoopbackAssetSrc at this template layer. The desktop MutationObserver (plus activate()'s initial
702
+ // Sweep) still recovers these; the brief stray views:// request is a known cosmetic residual we
703
+ // Intentionally do NOT over-engineer with a per-component rewrite.
697
704
  let preview: HTMLElement | undefined = _previewCache.get(file.path);
698
705
  if (!preview) {
699
706
  try {
@@ -756,7 +763,7 @@ function renderCard(
756
763
  >
757
764
  ${isImg
758
765
  ? html`<img
759
- src="/${file.path}"
766
+ src=${loopbackAssetSrc(`/${file.path}`)}
760
767
  style="max-width:100%;max-height:100%;object-fit:contain"
761
768
  />`
762
769
  : needsPreview
@@ -916,7 +923,7 @@ export async function renderBrowse(
916
923
  >
917
924
  <sp-table-cell class="browse-name-cell"
918
925
  >${isImage(f.ext)
919
- ? html`<img class="browse-thumb" src="/${f.path}" />`
926
+ ? html`<img class="browse-thumb" src=${loopbackAssetSrc(`/${f.path}`)} />`
920
927
  : nothing}${f.name}</sp-table-cell
921
928
  >
922
929
  <sp-table-cell>${f.category}</sp-table-cell>
@@ -5,31 +5,11 @@
5
5
  * multiple canvas-related modules: element lookup, zoom, panel resolution, inline bubbling.
6
6
  */
7
7
 
8
- import { canvasPanels, elToPath, getNodeAtPath, parentElementPath, pathsEqual } from "../store";
8
+ import { canvasPanels, getNodeAtPath, parentElementPath } from "../store";
9
9
  import { activeTab } from "../workspace/workspace";
10
10
  import { isInlineInContext } from "../editor/inline-edit";
11
11
  import type { JxPath } from "../state";
12
12
  import type { JxMutableNode } from "@jxsuite/schema/types";
13
- import type { CanvasPanel } from "../panels/canvas-dnd.js";
14
-
15
- let _ctx: { getCanvasMode: () => string; getZoom: () => number } | null = null;
16
-
17
- /**
18
- * Initialize the canvas helpers module.
19
- *
20
- * @param {{ getCanvasMode: () => string; getZoom: () => number }} ctx
21
- */
22
- export function initCanvasHelpers(ctx: { getCanvasMode: () => string; getZoom: () => number }) {
23
- _ctx = ctx;
24
- }
25
-
26
- /** Effective zoom scale — always 1 in edit (content) mode, actual zoom otherwise. */
27
- export function effectiveZoom() {
28
- const ctx = _ctx!;
29
- return ctx.getCanvasMode() === "edit"
30
- ? 1
31
- : (ctx.getZoom?.() ?? activeTab.value?.session.ui.zoom ?? 1);
32
- }
33
13
 
34
14
  /**
35
15
  * Convert a canvas panel's mediaName to an activeMedia value. Panels without a breakpoint (content
@@ -137,39 +117,5 @@ export function findCanvasElement(path: JxPath, canvasEl: HTMLElement) {
137
117
  i += 2;
138
118
  }
139
119
 
140
- if (el) {
141
- const elPath = elToPath.get(el);
142
- if (elPath && pathsEqual(elPath, path)) {
143
- return el;
144
- }
145
- }
146
-
147
- for (const candidate of canvasEl.querySelectorAll("*")) {
148
- const p = elToPath.get(candidate);
149
- if (p && pathsEqual(p, path)) {
150
- return candidate as HTMLElement;
151
- }
152
- }
153
- return null;
154
- }
155
-
156
- /**
157
- * Build an overlay box descriptor (no DOM creation).
158
- *
159
- * @param {Element} el
160
- * @param {string} type
161
- * @param {import("../panels/canvas-dnd.js").CanvasPanel} panel
162
- */
163
- export function overlayBoxDescriptor(el: Element, type: string, panel: CanvasPanel) {
164
- const viewport = panel.viewport as HTMLElement;
165
- const vpRect = viewport.getBoundingClientRect();
166
- const elRect = el.getBoundingClientRect();
167
- const scale = effectiveZoom();
168
- return {
169
- cls: `overlay-box overlay-${type}`,
170
- height: `${elRect.height / scale}px`,
171
- left: `${(elRect.left - vpRect.left + viewport.scrollLeft) / scale}px`,
172
- top: `${(elRect.top - vpRect.top + viewport.scrollTop) / scale}px`,
173
- width: `${elRect.width / scale}px`,
174
- };
120
+ return el ?? null;
175
121
  }