@jxsuite/studio 0.32.0 → 0.34.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.
- package/dist/iframe-entry.js +6230 -0
- package/dist/iframe-entry.js.map +35 -0
- package/dist/studio.js +22791 -13709
- package/dist/studio.js.map +181 -74
- package/package.json +12 -7
- package/src/browse/browse.ts +11 -4
- package/src/canvas/canvas-helpers.ts +2 -56
- package/src/canvas/canvas-live-render.ts +102 -435
- package/src/canvas/canvas-origin.ts +66 -0
- package/src/canvas/canvas-patcher.ts +63 -403
- package/src/canvas/canvas-render.ts +70 -212
- package/src/canvas/canvas-utils.ts +37 -65
- package/src/canvas/iframe-channel.ts +154 -0
- package/src/canvas/iframe-drop.ts +484 -0
- package/src/canvas/iframe-entry.ts +600 -0
- package/src/canvas/iframe-host.ts +1373 -0
- package/src/canvas/iframe-inline-edit.ts +367 -0
- package/src/canvas/iframe-insert.ts +164 -0
- package/src/canvas/iframe-interaction.ts +176 -0
- package/src/canvas/iframe-keys.ts +85 -0
- package/src/canvas/iframe-overlay.ts +218 -0
- package/src/canvas/iframe-patch.ts +363 -0
- package/src/canvas/iframe-protocol.ts +361 -0
- package/src/canvas/iframe-render.ts +458 -0
- package/src/canvas/iframe-slash.ts +114 -0
- package/src/canvas/iframe-subtree.ts +113 -0
- package/src/canvas/path-mapping.ts +86 -0
- package/src/canvas/serialize-scope.ts +65 -0
- package/src/editor/canvas-context-menu.ts +40 -0
- package/src/editor/canvas-slash-bridge.ts +21 -0
- package/src/editor/context-menu.ts +2 -1
- package/src/editor/inline-edit-apply.ts +183 -0
- package/src/editor/inline-edit.ts +99 -21
- package/src/editor/inline-link.ts +89 -0
- package/src/editor/insert-zone-action.ts +35 -0
- package/src/editor/merge-tags.ts +26 -2
- package/src/editor/repeater-scope.ts +144 -0
- package/src/editor/shortcuts.ts +14 -28
- package/src/editor/slash-menu.ts +73 -42
- package/src/files/files.ts +2 -1
- package/src/page-params.ts +383 -0
- package/src/panels/ai-panel.ts +386 -328
- package/src/panels/block-action-bar.ts +296 -138
- package/src/panels/canvas-dnd-bridge.ts +397 -0
- package/src/panels/component-preview.ts +56 -0
- package/src/panels/dnd.ts +41 -17
- package/src/panels/drag-ghost.ts +62 -0
- package/src/panels/editors.ts +1 -1
- package/src/panels/overlays.ts +10 -125
- package/src/panels/properties-panel.ts +210 -0
- package/src/panels/right-panel.ts +0 -2
- package/src/panels/signals-panel.ts +136 -22
- package/src/panels/stylebook-doc.ts +373 -0
- package/src/panels/stylebook-panel.ts +46 -689
- package/src/panels/tab-bar.ts +159 -13
- package/src/panels/toolbar.ts +3 -2
- package/src/platforms/devserver.ts +18 -47
- package/src/services/ai-settings.ts +107 -0
- package/src/services/ai-system-prompt.ts +617 -0
- package/src/services/ai-tools.ts +854 -0
- package/src/services/context-manager.ts +200 -0
- package/src/services/document-assistant.ts +183 -0
- package/src/services/jx-validate.ts +65 -0
- package/src/services/monaco-setup.ts +12 -0
- package/src/services/render-critic.ts +75 -0
- package/src/services/token-lint.ts +140 -0
- package/src/services/tool-executor.ts +156 -0
- package/src/settings/css-vars-editor.ts +2 -2
- package/src/state.ts +29 -0
- package/src/store.ts +4 -62
- package/src/studio.ts +90 -40
- package/src/tabs/doc-op-apply.ts +89 -0
- package/src/tabs/patch-ops.ts +6 -2
- package/src/tabs/tab.ts +23 -4
- package/src/tabs/transact.ts +33 -69
- package/src/types.ts +16 -24
- package/src/ui/jx-theme.ts +63 -0
- package/src/ui/media-picker.ts +6 -4
- package/src/ui/spectrum.ts +5 -0
- package/src/utils/canvas-media.ts +0 -137
- package/src/utils/edit-display.ts +23 -3
- package/src/utils/geometry.ts +43 -0
- package/src/utils/link-target.ts +93 -0
- package/src/utils/strip-events.ts +54 -0
- package/src/view.ts +0 -23
- package/src/workspace/workspace.ts +14 -1
- package/src/canvas/canvas-subtree-render.ts +0 -113
- package/src/editor/component-inline-edit.ts +0 -349
- package/src/editor/content-inline-edit.ts +0 -207
- package/src/editor/insertion-helper.ts +0 -308
- package/src/panels/canvas-dnd.ts +0 -329
- package/src/panels/panel-events.ts +0 -306
- package/src/panels/preview-render.ts +0 -132
- 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.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Jx Studio — visual builder for Jx documents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"build": "bun run scripts/build.ts",
|
|
27
27
|
"build:metafile": "bun build ./src/studio.ts --outdir dist --target browser --sourcemap=linked --metafile=metafile.json",
|
|
28
28
|
"gen:webdata": "bun run scripts/gen-webdata.js",
|
|
29
|
+
"eval": "bun run evals/cli.ts",
|
|
30
|
+
"eval:headless": "bun run tests/harness/run-eval.ts",
|
|
29
31
|
"lint:styles": "bun run scripts/check-styles.ts",
|
|
30
32
|
"test": "bun run lint:styles && bun test --isolate",
|
|
31
33
|
"test:coverage": "bun test --isolate --coverage",
|
|
@@ -34,9 +36,10 @@
|
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@atlaskit/pragmatic-drag-and-drop": "^2.0.1",
|
|
36
38
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
|
|
37
|
-
"@jxsuite/
|
|
38
|
-
"@jxsuite/
|
|
39
|
-
"@jxsuite/
|
|
39
|
+
"@jxsuite/ai": "^0.33.0",
|
|
40
|
+
"@jxsuite/parser": "^0.34.0",
|
|
41
|
+
"@jxsuite/runtime": "^0.34.0",
|
|
42
|
+
"@jxsuite/schema": "^0.34.0",
|
|
40
43
|
"@spectrum-web-components/accordion": "^1.12.1",
|
|
41
44
|
"@spectrum-web-components/action-bar": "1.12.1",
|
|
42
45
|
"@spectrum-web-components/action-button": "^1.12.1",
|
|
@@ -73,7 +76,9 @@
|
|
|
73
76
|
"@spectrum-web-components/toast": "^1.12.1",
|
|
74
77
|
"@spectrum-web-components/tooltip": "^1.12.1",
|
|
75
78
|
"@spectrum-web-components/underlay": "^1.12.1",
|
|
76
|
-
"@vue/reactivity": "3.5.
|
|
79
|
+
"@vue/reactivity": "3.5.39",
|
|
80
|
+
"ajv": "^8.20.0",
|
|
81
|
+
"ajv-formats": "^3.0.1",
|
|
77
82
|
"lit": "^3.3.3",
|
|
78
83
|
"lit-html": "^3.3.3",
|
|
79
84
|
"monaco-editor": "^0.55.1",
|
|
@@ -83,9 +88,9 @@
|
|
|
83
88
|
"devDependencies": {
|
|
84
89
|
"@happy-dom/global-registrator": "^20.10.6",
|
|
85
90
|
"@types/mdast": "^4.0.4",
|
|
86
|
-
"@webref/css": "^8.6.
|
|
91
|
+
"@webref/css": "^8.6.1",
|
|
87
92
|
"@webref/elements": "^2.7.1",
|
|
88
|
-
"@webref/idl": "^3.81.
|
|
93
|
+
"@webref/idl": "^3.81.2"
|
|
89
94
|
},
|
|
90
95
|
"//vue-reactivity": "Exact pin required — must match @jxsuite/runtime to avoid cross-boundary proxy bugs"
|
|
91
96
|
}
|
package/src/browse/browse.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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
|
-
|
|
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
|
}
|