@jxsuite/studio 0.16.0 → 0.16.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.
- package/dist/studio.js +72 -50
- package/dist/studio.js.map +7 -7
- package/package.json +1 -1
- package/src/canvas/canvas-live-render.js +1 -27
- package/src/files/files.js +3 -1
- package/src/panels/panel-events.js +24 -19
- package/src/panels/properties-panel.js +14 -14
- package/src/workspace/workspace.js +44 -0
package/dist/studio.js
CHANGED
|
@@ -1508,8 +1508,10 @@ var init_tab = __esm(() => {
|
|
|
1508
1508
|
var exports_workspace = {};
|
|
1509
1509
|
__export(exports_workspace, {
|
|
1510
1510
|
workspace: () => workspace,
|
|
1511
|
+
replaceAllTabs: () => replaceAllTabs,
|
|
1511
1512
|
openTab: () => openTab,
|
|
1512
1513
|
closeTab: () => closeTab,
|
|
1514
|
+
closeAllTabs: () => closeAllTabs,
|
|
1513
1515
|
activeTab: () => activeTab,
|
|
1514
1516
|
activateTab: () => activateTab
|
|
1515
1517
|
});
|
|
@@ -1531,6 +1533,32 @@ function closeTab(tabId) {
|
|
|
1531
1533
|
workspace.activeTabId = workspace.tabOrder[workspace.tabOrder.length - 1] || null;
|
|
1532
1534
|
}
|
|
1533
1535
|
}
|
|
1536
|
+
function closeAllTabs() {
|
|
1537
|
+
const tabs = [...workspace.tabs.values()];
|
|
1538
|
+
workspace.tabs.clear();
|
|
1539
|
+
workspace.tabOrder = [];
|
|
1540
|
+
workspace.activeTabId = null;
|
|
1541
|
+
for (const tab of tabs) {
|
|
1542
|
+
disposeTab(tab);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
function replaceAllTabs(newTabOpts) {
|
|
1546
|
+
const oldIds = [...workspace.tabs.keys()];
|
|
1547
|
+
const oldTabs = [...workspace.tabs.values()];
|
|
1548
|
+
const newTab = createTab(newTabOpts);
|
|
1549
|
+
workspace.tabs.set(newTab.id, newTab);
|
|
1550
|
+
workspace.activeTabId = newTab.id;
|
|
1551
|
+
workspace.tabOrder = [newTab.id];
|
|
1552
|
+
for (const id of oldIds) {
|
|
1553
|
+
if (id === newTab.id)
|
|
1554
|
+
continue;
|
|
1555
|
+
workspace.tabs.delete(id);
|
|
1556
|
+
}
|
|
1557
|
+
for (const tab of oldTabs) {
|
|
1558
|
+
disposeTab(tab);
|
|
1559
|
+
}
|
|
1560
|
+
return newTab;
|
|
1561
|
+
}
|
|
1534
1562
|
function activateTab(tabId) {
|
|
1535
1563
|
if (workspace.tabs.has(tabId))
|
|
1536
1564
|
workspace.activeTabId = tabId;
|
|
@@ -178841,23 +178869,6 @@ async function renderCanvasLive(gen, doc, canvasEl) {
|
|
|
178841
178869
|
} else {
|
|
178842
178870
|
canvasEl.removeAttribute("data-content-mode");
|
|
178843
178871
|
}
|
|
178844
|
-
const platform3 = globalThis.__jxPlatform;
|
|
178845
|
-
if (platform3?.resolveAssetUrl && docBase) {
|
|
178846
|
-
const mediaEls = el.querySelectorAll("img[src], video[src], source[src], video[poster]");
|
|
178847
|
-
for (const node2 of mediaEls) {
|
|
178848
|
-
for (const attr of ["src", "poster"]) {
|
|
178849
|
-
const val = node2.getAttribute(attr);
|
|
178850
|
-
if (val && !val.startsWith("data:") && !val.startsWith("blob:") && !val.startsWith("http")) {
|
|
178851
|
-
try {
|
|
178852
|
-
const resolved = new URL(val, docBase).pathname.replace(/^\//, "");
|
|
178853
|
-
const dataUrl = await platform3.resolveAssetUrl(resolved);
|
|
178854
|
-
if (dataUrl)
|
|
178855
|
-
node2.setAttribute(attr, dataUrl);
|
|
178856
|
-
} catch {}
|
|
178857
|
-
}
|
|
178858
|
-
}
|
|
178859
|
-
}
|
|
178860
|
-
}
|
|
178861
178872
|
canvasEl.appendChild(el);
|
|
178862
178873
|
if (canvasMode === "design" || canvasMode === "edit") {
|
|
178863
178874
|
requestAnimationFrame(() => {
|
|
@@ -183083,38 +183094,40 @@ function registerPanelEvents(panel) {
|
|
|
183083
183094
|
const tab = activeTab.value;
|
|
183084
183095
|
const canvasMode = _ctx8.getCanvasMode();
|
|
183085
183096
|
const elements = withPanelPointerEvents(() => document.elementsFromPoint(e.clientX, e.clientY));
|
|
183097
|
+
if (!tab)
|
|
183098
|
+
return;
|
|
183086
183099
|
for (const el of elements) {
|
|
183087
183100
|
if (canvas.contains(el) && el !== canvas) {
|
|
183088
183101
|
if (layoutElements.has(el)) {
|
|
183089
183102
|
view.layoutSelection = { el, layoutPath: activeLayoutPath };
|
|
183090
|
-
|
|
183103
|
+
tab.session.selection = null;
|
|
183091
183104
|
renderOnly("rightPanel");
|
|
183092
183105
|
return;
|
|
183093
183106
|
}
|
|
183094
183107
|
view.layoutSelection = null;
|
|
183095
183108
|
const originalPath = elToPath.get(el);
|
|
183096
183109
|
if (originalPath) {
|
|
183097
|
-
let path2 = bubbleInlinePath(tab
|
|
183110
|
+
let path2 = bubbleInlinePath(tab.doc.document, originalPath);
|
|
183098
183111
|
const newMedia = mediaName === "base" ? null : mediaName ?? null;
|
|
183099
183112
|
const resolvedEl = path2 === originalPath ? el : findCanvasElement(path2, canvas) || el;
|
|
183100
|
-
if (pathsEqual(path2, tab
|
|
183101
|
-
|
|
183113
|
+
if (pathsEqual(path2, tab.session.selection) && isEditableBlock(resolvedEl) && (canvasMode === "edit" || tab.doc.mode === "content")) {
|
|
183114
|
+
tab.session.ui.activeMedia = newMedia;
|
|
183102
183115
|
_ctx8.enterInlineEdit(resolvedEl, path2);
|
|
183103
183116
|
return;
|
|
183104
183117
|
}
|
|
183105
|
-
if (canvasMode === "design" && tab
|
|
183118
|
+
if (canvasMode === "design" && tab.doc.mode !== "content") {
|
|
183106
183119
|
updateUi("pendingInlineEdit", { path: path2, mediaName });
|
|
183107
|
-
|
|
183108
|
-
|
|
183120
|
+
tab.session.ui.activeMedia = newMedia;
|
|
183121
|
+
tab.session.selection = path2;
|
|
183109
183122
|
return;
|
|
183110
183123
|
}
|
|
183111
|
-
|
|
183112
|
-
|
|
183124
|
+
tab.session.ui.activeMedia = newMedia;
|
|
183125
|
+
tab.session.selection = path2;
|
|
183113
183126
|
return;
|
|
183114
183127
|
}
|
|
183115
183128
|
}
|
|
183116
183129
|
}
|
|
183117
|
-
|
|
183130
|
+
tab.session.selection = null;
|
|
183118
183131
|
}, opts);
|
|
183119
183132
|
overlayClk.addEventListener("dblclick", (e) => {
|
|
183120
183133
|
const barInner = view.blockActionBarEl?.firstElementChild;
|
|
@@ -183128,16 +183141,18 @@ function registerPanelEvents(panel) {
|
|
|
183128
183141
|
return;
|
|
183129
183142
|
const tab = activeTab.value;
|
|
183130
183143
|
const elements = withPanelPointerEvents(() => document.elementsFromPoint(e.clientX, e.clientY));
|
|
183144
|
+
if (!tab)
|
|
183145
|
+
return;
|
|
183131
183146
|
for (const el of elements) {
|
|
183132
183147
|
if (canvas.contains(el) && el !== canvas) {
|
|
183133
183148
|
const originalPath = elToPath.get(el);
|
|
183134
183149
|
if (originalPath) {
|
|
183135
|
-
const path2 = bubbleInlinePath(tab
|
|
183150
|
+
const path2 = bubbleInlinePath(tab.doc.document, originalPath);
|
|
183136
183151
|
const resolvedEl = path2 === originalPath ? el : findCanvasElement(path2, canvas) || el;
|
|
183137
183152
|
if (isEditableBlock(resolvedEl)) {
|
|
183138
183153
|
const newMedia = mediaName === "base" ? null : mediaName ?? null;
|
|
183139
|
-
|
|
183140
|
-
|
|
183154
|
+
tab.session.ui.activeMedia = newMedia;
|
|
183155
|
+
tab.session.selection = path2;
|
|
183141
183156
|
_ctx8.enterInlineEdit(resolvedEl, path2);
|
|
183142
183157
|
return;
|
|
183143
183158
|
}
|
|
@@ -183174,18 +183189,20 @@ function registerPanelEvents(panel) {
|
|
|
183174
183189
|
return;
|
|
183175
183190
|
}
|
|
183176
183191
|
const tab = activeTab.value;
|
|
183192
|
+
if (!tab)
|
|
183193
|
+
return;
|
|
183177
183194
|
const el = withPanelPointerEvents(() => document.elementFromPoint(e.clientX, e.clientY));
|
|
183178
183195
|
if (el && canvas.contains(el) && el !== canvas) {
|
|
183179
183196
|
let path2 = elToPath.get(el);
|
|
183180
183197
|
if (path2) {
|
|
183181
|
-
path2 = bubbleInlinePath(tab
|
|
183182
|
-
if (!pathsEqual(path2, tab
|
|
183183
|
-
|
|
183198
|
+
path2 = bubbleInlinePath(tab.doc.document, path2);
|
|
183199
|
+
if (!pathsEqual(path2, tab.session.hover)) {
|
|
183200
|
+
tab.session.hover = path2;
|
|
183184
183201
|
renderOnly("overlays");
|
|
183185
183202
|
}
|
|
183186
183203
|
}
|
|
183187
|
-
} else if (tab
|
|
183188
|
-
|
|
183204
|
+
} else if (tab.session.hover) {
|
|
183205
|
+
tab.session.hover = null;
|
|
183189
183206
|
renderOnly("overlays");
|
|
183190
183207
|
}
|
|
183191
183208
|
}, opts);
|
|
@@ -184389,6 +184406,7 @@ async function openProject({ renderActivityBar, renderLeftPanel }) {
|
|
|
184389
184406
|
if (!result)
|
|
184390
184407
|
return;
|
|
184391
184408
|
const { config, handle: handle2 } = result;
|
|
184409
|
+
replaceAllTabs({ id: "initial", document: { tagName: "div", children: [] } });
|
|
184392
184410
|
setProjectState({
|
|
184393
184411
|
...projectState,
|
|
184394
184412
|
projectRoot: handle2.root,
|
|
@@ -215003,16 +215021,18 @@ function renderFrontmatterOnlyPanel() {
|
|
|
215003
215021
|
fields.push({ field, entry: fieldSchema, value: fm[field] });
|
|
215004
215022
|
}
|
|
215005
215023
|
for (const [field, value2] of Object.entries(fm)) {
|
|
215006
|
-
if (
|
|
215007
|
-
|
|
215008
|
-
|
|
215009
|
-
|
|
215010
|
-
|
|
215011
|
-
|
|
215012
|
-
}
|
|
215024
|
+
if (schemaProps[field] || field.startsWith("$"))
|
|
215025
|
+
continue;
|
|
215026
|
+
fields.push({
|
|
215027
|
+
field,
|
|
215028
|
+
entry: { type: typeof value2 === "boolean" ? "boolean" : "string" },
|
|
215029
|
+
value: value2
|
|
215030
|
+
});
|
|
215013
215031
|
}
|
|
215014
215032
|
} else {
|
|
215015
215033
|
for (const [field, value2] of Object.entries(fm)) {
|
|
215034
|
+
if (field.startsWith("$"))
|
|
215035
|
+
continue;
|
|
215016
215036
|
fields.push({
|
|
215017
215037
|
field,
|
|
215018
215038
|
entry: { type: typeof value2 === "boolean" ? "boolean" : "string" },
|
|
@@ -216094,16 +216114,18 @@ function renderPropertiesPanelTemplate(ctx) {
|
|
|
216094
216114
|
fields.push({ field, entry: fieldSchema, value: fm[field] });
|
|
216095
216115
|
}
|
|
216096
216116
|
for (const [field, value2] of Object.entries(fm)) {
|
|
216097
|
-
if (
|
|
216098
|
-
|
|
216099
|
-
|
|
216100
|
-
|
|
216101
|
-
|
|
216102
|
-
|
|
216103
|
-
}
|
|
216117
|
+
if (schemaProps[field] || field.startsWith("$"))
|
|
216118
|
+
continue;
|
|
216119
|
+
fields.push({
|
|
216120
|
+
field,
|
|
216121
|
+
entry: { type: typeof value2 === "boolean" ? "boolean" : "string" },
|
|
216122
|
+
value: value2
|
|
216123
|
+
});
|
|
216104
216124
|
}
|
|
216105
216125
|
} else {
|
|
216106
216126
|
for (const [field, value2] of Object.entries(fm)) {
|
|
216127
|
+
if (field.startsWith("$"))
|
|
216128
|
+
continue;
|
|
216107
216129
|
fields.push({
|
|
216108
216130
|
field,
|
|
216109
216131
|
entry: { type: typeof value2 === "boolean" ? "boolean" : "string" },
|
|
@@ -217318,5 +217340,5 @@ effect(() => {
|
|
|
217318
217340
|
scheduleAutosave();
|
|
217319
217341
|
});
|
|
217320
217342
|
|
|
217321
|
-
//# debugId=
|
|
217343
|
+
//# debugId=E697E6D3C357567164756E2164756E21
|
|
217322
217344
|
//# sourceMappingURL=studio.js.map
|