@jxsuite/studio 0.20.0 → 0.21.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 +1229 -477
- package/dist/studio.js.map +41 -39
- package/package.json +6 -5
- package/src/browse/browse-modal.js +16 -13
- package/src/browse/browse.js +19 -16
- package/src/canvas/canvas-live-render.js +19 -0
- package/src/canvas/canvas-utils.js +13 -6
- package/src/editor/context-menu.js +27 -13
- package/src/editor/convert-targets.js +60 -0
- package/src/editor/convert-to-component.js +9 -10
- package/src/editor/convert-to-repeater.js +226 -0
- package/src/editor/inline-edit.js +3 -0
- package/src/editor/shortcuts.js +10 -2
- package/src/editor/slash-menu.js +36 -17
- package/src/files/files.js +244 -16
- package/src/github/github-publish.js +26 -15
- package/src/panels/activity-bar.js +5 -5
- package/src/panels/ai-panel.js +10 -3
- package/src/panels/block-action-bar.js +73 -24
- package/src/panels/git-panel.js +7 -2
- package/src/panels/imports-panel.js +6 -1
- package/src/panels/left-panel.js +20 -1
- package/src/panels/properties-panel.js +16 -11
- package/src/panels/quick-search.js +4 -4
- package/src/panels/right-panel.js +16 -14
- package/src/panels/signals-panel.js +120 -0
- package/src/panels/statusbar.js +6 -2
- package/src/panels/style-panel.js +6 -2
- package/src/panels/tab-strip.js +5 -2
- package/src/settings/content-types-editor.js +1 -1
- package/src/settings/settings-modal.js +12 -9
- package/src/store.js +15 -9
- package/src/studio.js +17 -9
- package/src/ui/layers.js +31 -1
- package/src/utils/edit-display.js +1 -6
- package/src/utils/studio-utils.js +11 -11
- package/src/workspace/workspace.js +19 -0
package/dist/studio.js
CHANGED
|
@@ -194849,6 +194849,18 @@ function activateTab(tabId) {
|
|
|
194849
194849
|
if (workspace.tabs.has(tabId))
|
|
194850
194850
|
workspace.activeTabId = tabId;
|
|
194851
194851
|
}
|
|
194852
|
+
function renameTab(oldId, newId, newDocumentPath) {
|
|
194853
|
+
const tab = workspace.tabs.get(oldId);
|
|
194854
|
+
if (!tab)
|
|
194855
|
+
return;
|
|
194856
|
+
tab.id = newId;
|
|
194857
|
+
tab.documentPath = newDocumentPath;
|
|
194858
|
+
workspace.tabs.delete(oldId);
|
|
194859
|
+
workspace.tabs.set(newId, tab);
|
|
194860
|
+
workspace.tabOrder = workspace.tabOrder.map((id) => id === oldId ? newId : id);
|
|
194861
|
+
if (workspace.activeTabId === oldId)
|
|
194862
|
+
workspace.activeTabId = newId;
|
|
194863
|
+
}
|
|
194852
194864
|
var workspace, activeTab;
|
|
194853
194865
|
var init_workspace2 = __esm(() => {
|
|
194854
194866
|
init_reactivity();
|
|
@@ -194968,6 +194980,14 @@ function requireProjectState() {
|
|
|
194968
194980
|
var projectState = null;
|
|
194969
194981
|
|
|
194970
194982
|
// src/store.js
|
|
194983
|
+
function initShellRefs() {
|
|
194984
|
+
canvasWrap = document.querySelector("#canvas-wrap");
|
|
194985
|
+
activityBar = document.querySelector("#activity-bar");
|
|
194986
|
+
leftPanel = document.querySelector("#left-panel");
|
|
194987
|
+
rightPanel = document.querySelector("#right-panel");
|
|
194988
|
+
toolbarEl = document.querySelector("#toolbar");
|
|
194989
|
+
statusbarEl = document.querySelector("#statusbar");
|
|
194990
|
+
}
|
|
194971
194991
|
function isNestedSelector(k) {
|
|
194972
194992
|
return k.startsWith(":") || k.startsWith(".") || k.startsWith("&") || k.startsWith("[");
|
|
194973
194993
|
}
|
|
@@ -195072,15 +195092,9 @@ function updateCanvas(patch) {
|
|
|
195072
195092
|
}
|
|
195073
195093
|
}
|
|
195074
195094
|
}
|
|
195075
|
-
var canvasWrap, activityBar, leftPanel, rightPanel, toolbarEl, statusbarEl, elToPath, canvasPanels, VOID_ELEMENTS, COMMON_SELECTORS, _styleDebounceTimers, _renderers;
|
|
195095
|
+
var canvasWrap = null, activityBar = null, leftPanel = null, rightPanel = null, toolbarEl = null, statusbarEl = null, elToPath, canvasPanels, VOID_ELEMENTS, COMMON_SELECTORS, _styleDebounceTimers, _renderers;
|
|
195076
195096
|
var init_store = __esm(() => {
|
|
195077
195097
|
init_workspace2();
|
|
195078
|
-
canvasWrap = document.querySelector("#canvas-wrap");
|
|
195079
|
-
activityBar = document.querySelector("#activity-bar");
|
|
195080
|
-
leftPanel = document.querySelector("#left-panel");
|
|
195081
|
-
rightPanel = document.querySelector("#right-panel");
|
|
195082
|
-
toolbarEl = document.querySelector("#toolbar");
|
|
195083
|
-
statusbarEl = document.querySelector("#statusbar");
|
|
195084
195098
|
elToPath = new WeakMap;
|
|
195085
195099
|
canvasPanels = [];
|
|
195086
195100
|
VOID_ELEMENTS = new Set([
|
|
@@ -195943,231 +195957,6 @@ var init_lit_html = __esm(() => {
|
|
|
195943
195957
|
}
|
|
195944
195958
|
});
|
|
195945
195959
|
|
|
195946
|
-
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directive.js
|
|
195947
|
-
class Directive {
|
|
195948
|
-
constructor(_partInfo) {}
|
|
195949
|
-
get _$isConnected() {
|
|
195950
|
-
return this._$parent._$isConnected;
|
|
195951
|
-
}
|
|
195952
|
-
_$initialize(part, parent, attributeIndex) {
|
|
195953
|
-
this.__part = part;
|
|
195954
|
-
this._$parent = parent;
|
|
195955
|
-
this.__attributeIndex = attributeIndex;
|
|
195956
|
-
}
|
|
195957
|
-
_$resolve(part, props) {
|
|
195958
|
-
return this.update(part, props);
|
|
195959
|
-
}
|
|
195960
|
-
update(_part, props) {
|
|
195961
|
-
return this.render(...props);
|
|
195962
|
-
}
|
|
195963
|
-
}
|
|
195964
|
-
var PartType, directive = (c) => (...values) => ({
|
|
195965
|
-
["_$litDirective$"]: c,
|
|
195966
|
-
values
|
|
195967
|
-
});
|
|
195968
|
-
var init_directive = __esm(() => {
|
|
195969
|
-
PartType = {
|
|
195970
|
-
ATTRIBUTE: 1,
|
|
195971
|
-
CHILD: 2,
|
|
195972
|
-
PROPERTY: 3,
|
|
195973
|
-
BOOLEAN_ATTRIBUTE: 4,
|
|
195974
|
-
EVENT: 5,
|
|
195975
|
-
ELEMENT: 6
|
|
195976
|
-
};
|
|
195977
|
-
});
|
|
195978
|
-
|
|
195979
|
-
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/style-map.js
|
|
195980
|
-
var important = "important", importantFlag, flagTrim, StyleMapDirective, styleMap;
|
|
195981
|
-
var init_style_map = __esm(() => {
|
|
195982
|
-
init_lit_html();
|
|
195983
|
-
init_directive();
|
|
195984
|
-
importantFlag = " !" + important;
|
|
195985
|
-
flagTrim = 0 - importantFlag.length;
|
|
195986
|
-
StyleMapDirective = class StyleMapDirective extends Directive {
|
|
195987
|
-
constructor(partInfo) {
|
|
195988
|
-
super(partInfo);
|
|
195989
|
-
if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== "style" || partInfo.strings?.length > 2) {
|
|
195990
|
-
throw new Error("The `styleMap` directive must be used in the `style` attribute " + "and must be the only part in the attribute.");
|
|
195991
|
-
}
|
|
195992
|
-
}
|
|
195993
|
-
render(styleInfo) {
|
|
195994
|
-
return Object.keys(styleInfo).reduce((style, prop) => {
|
|
195995
|
-
const value = styleInfo[prop];
|
|
195996
|
-
if (value == null) {
|
|
195997
|
-
return style;
|
|
195998
|
-
}
|
|
195999
|
-
prop = prop.includes("-") ? prop : prop.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase();
|
|
196000
|
-
return style + `${prop}:${value};`;
|
|
196001
|
-
}, "");
|
|
196002
|
-
}
|
|
196003
|
-
update(part, [styleInfo]) {
|
|
196004
|
-
const { style } = part.element;
|
|
196005
|
-
if (this._previousStyleProperties === undefined) {
|
|
196006
|
-
this._previousStyleProperties = new Set(Object.keys(styleInfo));
|
|
196007
|
-
return this.render(styleInfo);
|
|
196008
|
-
}
|
|
196009
|
-
for (const name of this._previousStyleProperties) {
|
|
196010
|
-
if (styleInfo[name] == null) {
|
|
196011
|
-
this._previousStyleProperties.delete(name);
|
|
196012
|
-
if (name.includes("-")) {
|
|
196013
|
-
style.removeProperty(name);
|
|
196014
|
-
} else {
|
|
196015
|
-
style[name] = null;
|
|
196016
|
-
}
|
|
196017
|
-
}
|
|
196018
|
-
}
|
|
196019
|
-
for (const name in styleInfo) {
|
|
196020
|
-
const value = styleInfo[name];
|
|
196021
|
-
if (value != null) {
|
|
196022
|
-
this._previousStyleProperties.add(name);
|
|
196023
|
-
const isImportant = typeof value === "string" && value.endsWith(importantFlag);
|
|
196024
|
-
if (name.includes("-") || isImportant) {
|
|
196025
|
-
style.setProperty(name, isImportant ? value.slice(0, flagTrim) : value, isImportant ? important : "");
|
|
196026
|
-
} else {
|
|
196027
|
-
style[name] = value;
|
|
196028
|
-
}
|
|
196029
|
-
}
|
|
196030
|
-
}
|
|
196031
|
-
return noChange;
|
|
196032
|
-
}
|
|
196033
|
-
};
|
|
196034
|
-
styleMap = directive(StyleMapDirective);
|
|
196035
|
-
});
|
|
196036
|
-
|
|
196037
|
-
// ../../node_modules/.bun/bind-event-listener@3.0.0/node_modules/bind-event-listener/dist/bind.js
|
|
196038
|
-
var require_bind = __commonJS((exports) => {
|
|
196039
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196040
|
-
exports.bind = undefined;
|
|
196041
|
-
function bind(target, _a3) {
|
|
196042
|
-
var { type, listener, options } = _a3;
|
|
196043
|
-
target.addEventListener(type, listener, options);
|
|
196044
|
-
return function unbind() {
|
|
196045
|
-
target.removeEventListener(type, listener, options);
|
|
196046
|
-
};
|
|
196047
|
-
}
|
|
196048
|
-
exports.bind = bind;
|
|
196049
|
-
});
|
|
196050
|
-
|
|
196051
|
-
// ../../node_modules/.bun/bind-event-listener@3.0.0/node_modules/bind-event-listener/dist/bind-all.js
|
|
196052
|
-
var require_bind_all = __commonJS((exports) => {
|
|
196053
|
-
var __assign = exports && exports.__assign || function() {
|
|
196054
|
-
__assign = Object.assign || function(t) {
|
|
196055
|
-
for (var s, i2 = 1, n2 = arguments.length;i2 < n2; i2++) {
|
|
196056
|
-
s = arguments[i2];
|
|
196057
|
-
for (var p in s)
|
|
196058
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
196059
|
-
t[p] = s[p];
|
|
196060
|
-
}
|
|
196061
|
-
return t;
|
|
196062
|
-
};
|
|
196063
|
-
return __assign.apply(this, arguments);
|
|
196064
|
-
};
|
|
196065
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196066
|
-
exports.bindAll = undefined;
|
|
196067
|
-
var bind_1 = require_bind();
|
|
196068
|
-
function toOptions(value) {
|
|
196069
|
-
if (typeof value === "undefined") {
|
|
196070
|
-
return;
|
|
196071
|
-
}
|
|
196072
|
-
if (typeof value === "boolean") {
|
|
196073
|
-
return {
|
|
196074
|
-
capture: value
|
|
196075
|
-
};
|
|
196076
|
-
}
|
|
196077
|
-
return value;
|
|
196078
|
-
}
|
|
196079
|
-
function getBinding(original, sharedOptions) {
|
|
196080
|
-
if (sharedOptions == null) {
|
|
196081
|
-
return original;
|
|
196082
|
-
}
|
|
196083
|
-
var binding = __assign(__assign({}, original), { options: __assign(__assign({}, toOptions(sharedOptions)), toOptions(original.options)) });
|
|
196084
|
-
return binding;
|
|
196085
|
-
}
|
|
196086
|
-
function bindAll(target, bindings, sharedOptions) {
|
|
196087
|
-
var unbinds = bindings.map(function(original) {
|
|
196088
|
-
var binding = getBinding(original, sharedOptions);
|
|
196089
|
-
return (0, bind_1.bind)(target, binding);
|
|
196090
|
-
});
|
|
196091
|
-
return function unbindAll() {
|
|
196092
|
-
unbinds.forEach(function(unbind) {
|
|
196093
|
-
return unbind();
|
|
196094
|
-
});
|
|
196095
|
-
};
|
|
196096
|
-
}
|
|
196097
|
-
exports.bindAll = bindAll;
|
|
196098
|
-
});
|
|
196099
|
-
|
|
196100
|
-
// ../../node_modules/.bun/bind-event-listener@3.0.0/node_modules/bind-event-listener/dist/index.js
|
|
196101
|
-
var require_dist = __commonJS((exports) => {
|
|
196102
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196103
|
-
exports.bindAll = exports.bind = undefined;
|
|
196104
|
-
var bind_1 = require_bind();
|
|
196105
|
-
Object.defineProperty(exports, "bind", { enumerable: true, get: function() {
|
|
196106
|
-
return bind_1.bind;
|
|
196107
|
-
} });
|
|
196108
|
-
var bind_all_1 = require_bind_all();
|
|
196109
|
-
Object.defineProperty(exports, "bindAll", { enumerable: true, get: function() {
|
|
196110
|
-
return bind_all_1.bindAll;
|
|
196111
|
-
} });
|
|
196112
|
-
});
|
|
196113
|
-
|
|
196114
|
-
// src/platform.js
|
|
196115
|
-
function registerPlatform(platform3) {
|
|
196116
|
-
g.__jxPlatform = platform3;
|
|
196117
|
-
}
|
|
196118
|
-
function getPlatform() {
|
|
196119
|
-
if (!g.__jxPlatform)
|
|
196120
|
-
throw new Error("No platform registered. Call registerPlatform() before starting Studio.");
|
|
196121
|
-
return g.__jxPlatform;
|
|
196122
|
-
}
|
|
196123
|
-
function hasPlatform() {
|
|
196124
|
-
return g.__jxPlatform != null;
|
|
196125
|
-
}
|
|
196126
|
-
var g;
|
|
196127
|
-
var init_platform3 = __esm(() => {
|
|
196128
|
-
g = globalThis;
|
|
196129
|
-
});
|
|
196130
|
-
|
|
196131
|
-
// src/files/components.js
|
|
196132
|
-
var exports_components = {};
|
|
196133
|
-
__export(exports_components, {
|
|
196134
|
-
loadComponentRegistry: () => loadComponentRegistry,
|
|
196135
|
-
computeRelativePath: () => computeRelativePath,
|
|
196136
|
-
componentRegistry: () => componentRegistry,
|
|
196137
|
-
_componentRegistryLoaded: () => _componentRegistryLoaded
|
|
196138
|
-
});
|
|
196139
|
-
async function loadComponentRegistry() {
|
|
196140
|
-
try {
|
|
196141
|
-
const platform3 = getPlatform();
|
|
196142
|
-
componentRegistry = await platform3.discoverComponents(projectState?.projectRoot || undefined);
|
|
196143
|
-
_componentRegistryLoaded = true;
|
|
196144
|
-
} catch {
|
|
196145
|
-
_componentRegistryLoaded = true;
|
|
196146
|
-
}
|
|
196147
|
-
}
|
|
196148
|
-
function computeRelativePath(fromDocPath, toCompPath) {
|
|
196149
|
-
if (!fromDocPath)
|
|
196150
|
-
return `./${toCompPath}`;
|
|
196151
|
-
const from = fromDocPath.replaceAll("\\", "/");
|
|
196152
|
-
const to = toCompPath.replaceAll("\\", "/");
|
|
196153
|
-
const fromDir = from.substring(0, from.lastIndexOf("/"));
|
|
196154
|
-
const fromParts = fromDir.split("/").filter(Boolean);
|
|
196155
|
-
const toParts = to.split("/").filter(Boolean);
|
|
196156
|
-
let common = 0;
|
|
196157
|
-
while (common < fromParts.length && common < toParts.length && fromParts[common] === toParts[common]) {
|
|
196158
|
-
common++;
|
|
196159
|
-
}
|
|
196160
|
-
const ups = fromParts.length - common;
|
|
196161
|
-
const remaining = toParts.slice(common);
|
|
196162
|
-
return (ups > 0 ? "../".repeat(ups) : "./") + remaining.join("/");
|
|
196163
|
-
}
|
|
196164
|
-
var componentRegistry, _componentRegistryLoaded = false;
|
|
196165
|
-
var init_components = __esm(() => {
|
|
196166
|
-
init_platform3();
|
|
196167
|
-
init_store();
|
|
196168
|
-
componentRegistry = [];
|
|
196169
|
-
});
|
|
196170
|
-
|
|
196171
195960
|
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directive-helpers.js
|
|
196172
195961
|
var ChildPart2, ENABLE_SHADYDOM_NOPATCH2 = true, wrap2, isPrimitive2 = (value) => value === null || typeof value != "object" && typeof value != "function", isSingleExpression = (part) => part.strings === undefined, createMarker2 = () => document.createComment(""), insertPart = (containerPart, refPart, part) => {
|
|
196173
195962
|
const container = wrap2(containerPart._$startNode).parentNode;
|
|
@@ -196189,11 +195978,11 @@ var ChildPart2, ENABLE_SHADYDOM_NOPATCH2 = true, wrap2, isPrimitive2 = (value) =
|
|
|
196189
195978
|
}
|
|
196190
195979
|
}
|
|
196191
195980
|
if (endNode !== refNode || parentChanged) {
|
|
196192
|
-
let
|
|
196193
|
-
while (
|
|
196194
|
-
const n2 = wrap2(
|
|
196195
|
-
wrap2(container).insertBefore(
|
|
196196
|
-
|
|
195981
|
+
let start = part._$startNode;
|
|
195982
|
+
while (start !== endNode) {
|
|
195983
|
+
const n2 = wrap2(start).nextSibling;
|
|
195984
|
+
wrap2(container).insertBefore(start, refNode);
|
|
195985
|
+
start = n2;
|
|
196197
195986
|
}
|
|
196198
195987
|
}
|
|
196199
195988
|
}
|
|
@@ -196212,6 +196001,39 @@ var init_directive_helpers = __esm(() => {
|
|
|
196212
196001
|
RESET_VALUE = {};
|
|
196213
196002
|
});
|
|
196214
196003
|
|
|
196004
|
+
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directive.js
|
|
196005
|
+
class Directive {
|
|
196006
|
+
constructor(_partInfo) {}
|
|
196007
|
+
get _$isConnected() {
|
|
196008
|
+
return this._$parent._$isConnected;
|
|
196009
|
+
}
|
|
196010
|
+
_$initialize(part, parent, attributeIndex) {
|
|
196011
|
+
this.__part = part;
|
|
196012
|
+
this._$parent = parent;
|
|
196013
|
+
this.__attributeIndex = attributeIndex;
|
|
196014
|
+
}
|
|
196015
|
+
_$resolve(part, props) {
|
|
196016
|
+
return this.update(part, props);
|
|
196017
|
+
}
|
|
196018
|
+
update(_part, props) {
|
|
196019
|
+
return this.render(...props);
|
|
196020
|
+
}
|
|
196021
|
+
}
|
|
196022
|
+
var PartType, directive = (c) => (...values) => ({
|
|
196023
|
+
["_$litDirective$"]: c,
|
|
196024
|
+
values
|
|
196025
|
+
});
|
|
196026
|
+
var init_directive = __esm(() => {
|
|
196027
|
+
PartType = {
|
|
196028
|
+
ATTRIBUTE: 1,
|
|
196029
|
+
CHILD: 2,
|
|
196030
|
+
PROPERTY: 3,
|
|
196031
|
+
BOOLEAN_ATTRIBUTE: 4,
|
|
196032
|
+
EVENT: 5,
|
|
196033
|
+
ELEMENT: 6
|
|
196034
|
+
};
|
|
196035
|
+
});
|
|
196036
|
+
|
|
196215
196037
|
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/async-directive.js
|
|
196216
196038
|
function reparentDisconnectables(newParent) {
|
|
196217
196039
|
if (this._$disconnectableChildren !== undefined) {
|
|
@@ -196386,6 +196208,198 @@ var init_ref = __esm(() => {
|
|
|
196386
196208
|
ref2 = directive(RefDirective);
|
|
196387
196209
|
});
|
|
196388
196210
|
|
|
196211
|
+
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/style-map.js
|
|
196212
|
+
var important = "important", importantFlag, flagTrim, StyleMapDirective, styleMap;
|
|
196213
|
+
var init_style_map = __esm(() => {
|
|
196214
|
+
init_lit_html();
|
|
196215
|
+
init_directive();
|
|
196216
|
+
importantFlag = " !" + important;
|
|
196217
|
+
flagTrim = 0 - importantFlag.length;
|
|
196218
|
+
StyleMapDirective = class StyleMapDirective extends Directive {
|
|
196219
|
+
constructor(partInfo) {
|
|
196220
|
+
super(partInfo);
|
|
196221
|
+
if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== "style" || partInfo.strings?.length > 2) {
|
|
196222
|
+
throw new Error("The `styleMap` directive must be used in the `style` attribute " + "and must be the only part in the attribute.");
|
|
196223
|
+
}
|
|
196224
|
+
}
|
|
196225
|
+
render(styleInfo) {
|
|
196226
|
+
return Object.keys(styleInfo).reduce((style, prop) => {
|
|
196227
|
+
const value = styleInfo[prop];
|
|
196228
|
+
if (value == null) {
|
|
196229
|
+
return style;
|
|
196230
|
+
}
|
|
196231
|
+
prop = prop.includes("-") ? prop : prop.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase();
|
|
196232
|
+
return style + `${prop}:${value};`;
|
|
196233
|
+
}, "");
|
|
196234
|
+
}
|
|
196235
|
+
update(part, [styleInfo]) {
|
|
196236
|
+
const { style } = part.element;
|
|
196237
|
+
if (this._previousStyleProperties === undefined) {
|
|
196238
|
+
this._previousStyleProperties = new Set(Object.keys(styleInfo));
|
|
196239
|
+
return this.render(styleInfo);
|
|
196240
|
+
}
|
|
196241
|
+
for (const name of this._previousStyleProperties) {
|
|
196242
|
+
if (styleInfo[name] == null) {
|
|
196243
|
+
this._previousStyleProperties.delete(name);
|
|
196244
|
+
if (name.includes("-")) {
|
|
196245
|
+
style.removeProperty(name);
|
|
196246
|
+
} else {
|
|
196247
|
+
style[name] = null;
|
|
196248
|
+
}
|
|
196249
|
+
}
|
|
196250
|
+
}
|
|
196251
|
+
for (const name in styleInfo) {
|
|
196252
|
+
const value = styleInfo[name];
|
|
196253
|
+
if (value != null) {
|
|
196254
|
+
this._previousStyleProperties.add(name);
|
|
196255
|
+
const isImportant = typeof value === "string" && value.endsWith(importantFlag);
|
|
196256
|
+
if (name.includes("-") || isImportant) {
|
|
196257
|
+
style.setProperty(name, isImportant ? value.slice(0, flagTrim) : value, isImportant ? important : "");
|
|
196258
|
+
} else {
|
|
196259
|
+
style[name] = value;
|
|
196260
|
+
}
|
|
196261
|
+
}
|
|
196262
|
+
}
|
|
196263
|
+
return noChange;
|
|
196264
|
+
}
|
|
196265
|
+
};
|
|
196266
|
+
styleMap = directive(StyleMapDirective);
|
|
196267
|
+
});
|
|
196268
|
+
|
|
196269
|
+
// ../../node_modules/.bun/bind-event-listener@3.0.0/node_modules/bind-event-listener/dist/bind.js
|
|
196270
|
+
var require_bind = __commonJS((exports) => {
|
|
196271
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196272
|
+
exports.bind = undefined;
|
|
196273
|
+
function bind(target, _a3) {
|
|
196274
|
+
var { type, listener, options } = _a3;
|
|
196275
|
+
target.addEventListener(type, listener, options);
|
|
196276
|
+
return function unbind() {
|
|
196277
|
+
target.removeEventListener(type, listener, options);
|
|
196278
|
+
};
|
|
196279
|
+
}
|
|
196280
|
+
exports.bind = bind;
|
|
196281
|
+
});
|
|
196282
|
+
|
|
196283
|
+
// ../../node_modules/.bun/bind-event-listener@3.0.0/node_modules/bind-event-listener/dist/bind-all.js
|
|
196284
|
+
var require_bind_all = __commonJS((exports) => {
|
|
196285
|
+
var __assign = exports && exports.__assign || function() {
|
|
196286
|
+
__assign = Object.assign || function(t) {
|
|
196287
|
+
for (var s, i2 = 1, n2 = arguments.length;i2 < n2; i2++) {
|
|
196288
|
+
s = arguments[i2];
|
|
196289
|
+
for (var p in s)
|
|
196290
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
196291
|
+
t[p] = s[p];
|
|
196292
|
+
}
|
|
196293
|
+
return t;
|
|
196294
|
+
};
|
|
196295
|
+
return __assign.apply(this, arguments);
|
|
196296
|
+
};
|
|
196297
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196298
|
+
exports.bindAll = undefined;
|
|
196299
|
+
var bind_1 = require_bind();
|
|
196300
|
+
function toOptions(value) {
|
|
196301
|
+
if (typeof value === "undefined") {
|
|
196302
|
+
return;
|
|
196303
|
+
}
|
|
196304
|
+
if (typeof value === "boolean") {
|
|
196305
|
+
return {
|
|
196306
|
+
capture: value
|
|
196307
|
+
};
|
|
196308
|
+
}
|
|
196309
|
+
return value;
|
|
196310
|
+
}
|
|
196311
|
+
function getBinding(original, sharedOptions) {
|
|
196312
|
+
if (sharedOptions == null) {
|
|
196313
|
+
return original;
|
|
196314
|
+
}
|
|
196315
|
+
var binding = __assign(__assign({}, original), { options: __assign(__assign({}, toOptions(sharedOptions)), toOptions(original.options)) });
|
|
196316
|
+
return binding;
|
|
196317
|
+
}
|
|
196318
|
+
function bindAll(target, bindings, sharedOptions) {
|
|
196319
|
+
var unbinds = bindings.map(function(original) {
|
|
196320
|
+
var binding = getBinding(original, sharedOptions);
|
|
196321
|
+
return (0, bind_1.bind)(target, binding);
|
|
196322
|
+
});
|
|
196323
|
+
return function unbindAll() {
|
|
196324
|
+
unbinds.forEach(function(unbind) {
|
|
196325
|
+
return unbind();
|
|
196326
|
+
});
|
|
196327
|
+
};
|
|
196328
|
+
}
|
|
196329
|
+
exports.bindAll = bindAll;
|
|
196330
|
+
});
|
|
196331
|
+
|
|
196332
|
+
// ../../node_modules/.bun/bind-event-listener@3.0.0/node_modules/bind-event-listener/dist/index.js
|
|
196333
|
+
var require_dist = __commonJS((exports) => {
|
|
196334
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196335
|
+
exports.bindAll = exports.bind = undefined;
|
|
196336
|
+
var bind_1 = require_bind();
|
|
196337
|
+
Object.defineProperty(exports, "bind", { enumerable: true, get: function() {
|
|
196338
|
+
return bind_1.bind;
|
|
196339
|
+
} });
|
|
196340
|
+
var bind_all_1 = require_bind_all();
|
|
196341
|
+
Object.defineProperty(exports, "bindAll", { enumerable: true, get: function() {
|
|
196342
|
+
return bind_all_1.bindAll;
|
|
196343
|
+
} });
|
|
196344
|
+
});
|
|
196345
|
+
|
|
196346
|
+
// src/platform.js
|
|
196347
|
+
function registerPlatform(platform3) {
|
|
196348
|
+
g.__jxPlatform = platform3;
|
|
196349
|
+
}
|
|
196350
|
+
function getPlatform() {
|
|
196351
|
+
if (!g.__jxPlatform)
|
|
196352
|
+
throw new Error("No platform registered. Call registerPlatform() before starting Studio.");
|
|
196353
|
+
return g.__jxPlatform;
|
|
196354
|
+
}
|
|
196355
|
+
function hasPlatform() {
|
|
196356
|
+
return g.__jxPlatform != null;
|
|
196357
|
+
}
|
|
196358
|
+
var g;
|
|
196359
|
+
var init_platform3 = __esm(() => {
|
|
196360
|
+
g = globalThis;
|
|
196361
|
+
});
|
|
196362
|
+
|
|
196363
|
+
// src/files/components.js
|
|
196364
|
+
var exports_components = {};
|
|
196365
|
+
__export(exports_components, {
|
|
196366
|
+
loadComponentRegistry: () => loadComponentRegistry,
|
|
196367
|
+
computeRelativePath: () => computeRelativePath,
|
|
196368
|
+
componentRegistry: () => componentRegistry,
|
|
196369
|
+
_componentRegistryLoaded: () => _componentRegistryLoaded
|
|
196370
|
+
});
|
|
196371
|
+
async function loadComponentRegistry() {
|
|
196372
|
+
try {
|
|
196373
|
+
const platform3 = getPlatform();
|
|
196374
|
+
componentRegistry = await platform3.discoverComponents(projectState?.projectRoot || undefined);
|
|
196375
|
+
_componentRegistryLoaded = true;
|
|
196376
|
+
} catch {
|
|
196377
|
+
_componentRegistryLoaded = true;
|
|
196378
|
+
}
|
|
196379
|
+
}
|
|
196380
|
+
function computeRelativePath(fromDocPath, toCompPath) {
|
|
196381
|
+
if (!fromDocPath)
|
|
196382
|
+
return `./${toCompPath}`;
|
|
196383
|
+
const from = fromDocPath.replaceAll("\\", "/");
|
|
196384
|
+
const to = toCompPath.replaceAll("\\", "/");
|
|
196385
|
+
const fromDir = from.substring(0, from.lastIndexOf("/"));
|
|
196386
|
+
const fromParts = fromDir.split("/").filter(Boolean);
|
|
196387
|
+
const toParts = to.split("/").filter(Boolean);
|
|
196388
|
+
let common = 0;
|
|
196389
|
+
while (common < fromParts.length && common < toParts.length && fromParts[common] === toParts[common]) {
|
|
196390
|
+
common++;
|
|
196391
|
+
}
|
|
196392
|
+
const ups = fromParts.length - common;
|
|
196393
|
+
const remaining = toParts.slice(common);
|
|
196394
|
+
return (ups > 0 ? "../".repeat(ups) : "./") + remaining.join("/");
|
|
196395
|
+
}
|
|
196396
|
+
var componentRegistry, _componentRegistryLoaded = false;
|
|
196397
|
+
var init_components = __esm(() => {
|
|
196398
|
+
init_platform3();
|
|
196399
|
+
init_store();
|
|
196400
|
+
componentRegistry = [];
|
|
196401
|
+
});
|
|
196402
|
+
|
|
196389
196403
|
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/class-map.js
|
|
196390
196404
|
var ClassMapDirective, classMap;
|
|
196391
196405
|
var init_class_map = __esm(() => {
|
|
@@ -200060,12 +200074,12 @@ function charactersToExpressionCached(subset) {
|
|
|
200060
200074
|
return cached;
|
|
200061
200075
|
}
|
|
200062
200076
|
function charactersToExpression(subset) {
|
|
200063
|
-
const
|
|
200077
|
+
const groups2 = [];
|
|
200064
200078
|
let index2 = -1;
|
|
200065
200079
|
while (++index2 < subset.length) {
|
|
200066
|
-
|
|
200080
|
+
groups2.push(subset[index2].replace(regexEscapeRegex, "\\$&"));
|
|
200067
200081
|
}
|
|
200068
|
-
return new RegExp("(?:" +
|
|
200082
|
+
return new RegExp("(?:" + groups2.join("|") + ")", "g");
|
|
200069
200083
|
}
|
|
200070
200084
|
var defaultSubsetRegex, surrogatePairsRegex, controlCharactersRegex, regexEscapeRegex, subsetToRegexCache;
|
|
200071
200085
|
var init_core = __esm(() => {
|
|
@@ -254973,8 +254987,25 @@ var elements_meta_default = {
|
|
|
254973
254987
|
$id: "elements-meta",
|
|
254974
254988
|
title: "HTML Element Metadata",
|
|
254975
254989
|
description: "Inline scoping and inline toolbar action metadata for HTML elements.",
|
|
254990
|
+
$convertGroups: {
|
|
254991
|
+
text: ["p", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote"],
|
|
254992
|
+
container: [
|
|
254993
|
+
"div",
|
|
254994
|
+
"section",
|
|
254995
|
+
"article",
|
|
254996
|
+
"aside",
|
|
254997
|
+
"main",
|
|
254998
|
+
"header",
|
|
254999
|
+
"footer",
|
|
255000
|
+
"nav",
|
|
255001
|
+
"search"
|
|
255002
|
+
],
|
|
255003
|
+
list: ["ul", "ol"]
|
|
255004
|
+
},
|
|
254976
255005
|
$defs: {
|
|
254977
255006
|
p: {
|
|
255007
|
+
$convertTo: "text",
|
|
255008
|
+
$convertToWhenEmpty: ["text", "container"],
|
|
254978
255009
|
$inlineChildren: [
|
|
254979
255010
|
"em",
|
|
254980
255011
|
"strong",
|
|
@@ -255035,6 +255066,7 @@ var elements_meta_default = {
|
|
|
255035
255066
|
]
|
|
255036
255067
|
},
|
|
255037
255068
|
h1: {
|
|
255069
|
+
$convertTo: "text",
|
|
255038
255070
|
$inlineChildren: ["em", "strong", "code", "a", "span", "br", "b", "i", "u", "sub", "sup"],
|
|
255039
255071
|
$inlineActions: [
|
|
255040
255072
|
{
|
|
@@ -255056,22 +255088,27 @@ var elements_meta_default = {
|
|
|
255056
255088
|
]
|
|
255057
255089
|
},
|
|
255058
255090
|
h2: {
|
|
255091
|
+
$convertTo: "text",
|
|
255059
255092
|
$inlineChildren: ["em", "strong", "code", "a", "span", "br", "b", "i", "u", "sub", "sup"],
|
|
255060
255093
|
$inlineActions: "h1"
|
|
255061
255094
|
},
|
|
255062
255095
|
h3: {
|
|
255096
|
+
$convertTo: "text",
|
|
255063
255097
|
$inlineChildren: ["em", "strong", "code", "a", "span", "br", "b", "i", "u", "sub", "sup"],
|
|
255064
255098
|
$inlineActions: "h1"
|
|
255065
255099
|
},
|
|
255066
255100
|
h4: {
|
|
255101
|
+
$convertTo: "text",
|
|
255067
255102
|
$inlineChildren: ["em", "strong", "code", "a", "span", "br", "b", "i", "u", "sub", "sup"],
|
|
255068
255103
|
$inlineActions: "h1"
|
|
255069
255104
|
},
|
|
255070
255105
|
h5: {
|
|
255106
|
+
$convertTo: "text",
|
|
255071
255107
|
$inlineChildren: ["em", "strong", "code", "a", "span", "br", "b", "i", "u", "sub", "sup"],
|
|
255072
255108
|
$inlineActions: "h1"
|
|
255073
255109
|
},
|
|
255074
255110
|
h6: {
|
|
255111
|
+
$convertTo: "text",
|
|
255075
255112
|
$inlineChildren: ["em", "strong", "code", "a", "span", "br", "b", "i", "u", "sub", "sup"],
|
|
255076
255113
|
$inlineActions: "h1"
|
|
255077
255114
|
},
|
|
@@ -255131,6 +255168,7 @@ var elements_meta_default = {
|
|
|
255131
255168
|
$inlineActions: "p"
|
|
255132
255169
|
},
|
|
255133
255170
|
blockquote: {
|
|
255171
|
+
$convertTo: "text",
|
|
255134
255172
|
$inlineChildren: []
|
|
255135
255173
|
},
|
|
255136
255174
|
a: {
|
|
@@ -255170,16 +255208,20 @@ var elements_meta_default = {
|
|
|
255170
255208
|
],
|
|
255171
255209
|
$inlineActions: "p"
|
|
255172
255210
|
},
|
|
255173
|
-
div: {
|
|
255174
|
-
|
|
255175
|
-
|
|
255176
|
-
|
|
255177
|
-
|
|
255178
|
-
|
|
255179
|
-
|
|
255180
|
-
|
|
255181
|
-
|
|
255182
|
-
|
|
255211
|
+
div: {
|
|
255212
|
+
$convertTo: "container",
|
|
255213
|
+
$convertToWhenEmpty: ["container", "text"],
|
|
255214
|
+
$inlineChildren: []
|
|
255215
|
+
},
|
|
255216
|
+
section: { $convertTo: "container", $inlineChildren: [] },
|
|
255217
|
+
article: { $convertTo: "container", $inlineChildren: [] },
|
|
255218
|
+
nav: { $convertTo: "container", $inlineChildren: [] },
|
|
255219
|
+
main: { $convertTo: "container", $inlineChildren: [] },
|
|
255220
|
+
header: { $convertTo: "container", $inlineChildren: [] },
|
|
255221
|
+
footer: { $convertTo: "container", $inlineChildren: [] },
|
|
255222
|
+
aside: { $convertTo: "container", $inlineChildren: [] },
|
|
255223
|
+
ul: { $convertTo: "list", $inlineChildren: [] },
|
|
255224
|
+
ol: { $convertTo: "list", $inlineChildren: [] },
|
|
255183
255225
|
pre: { $inlineChildren: ["code"] },
|
|
255184
255226
|
table: { $inlineChildren: [] },
|
|
255185
255227
|
thead: { $inlineChildren: [] },
|
|
@@ -255543,6 +255585,7 @@ function findTemplateExpressions(text2) {
|
|
|
255543
255585
|
|
|
255544
255586
|
// src/editor/slash-menu.js
|
|
255545
255587
|
init_lit_html();
|
|
255588
|
+
init_ref();
|
|
255546
255589
|
|
|
255547
255590
|
// src/ui/layers.js
|
|
255548
255591
|
init_lit_html();
|
|
@@ -255571,6 +255614,25 @@ function showDialog(templateFn) {
|
|
|
255571
255614
|
render2(templateFn(done), slot);
|
|
255572
255615
|
});
|
|
255573
255616
|
}
|
|
255617
|
+
function showConfirmDialog(headline, message, opts = {}) {
|
|
255618
|
+
const { confirmLabel = "Confirm", cancelLabel = "Cancel", destructive = false } = opts;
|
|
255619
|
+
return showDialog((done) => html3`
|
|
255620
|
+
<sp-dialog-wrapper
|
|
255621
|
+
open
|
|
255622
|
+
underlay
|
|
255623
|
+
headline=${headline}
|
|
255624
|
+
confirm-label=${confirmLabel}
|
|
255625
|
+
cancel-label=${cancelLabel}
|
|
255626
|
+
size="s"
|
|
255627
|
+
@confirm=${() => done(true)}
|
|
255628
|
+
@cancel=${() => done(false)}
|
|
255629
|
+
@close=${() => done(false)}
|
|
255630
|
+
class=${destructive ? "dialog-destructive" : ""}
|
|
255631
|
+
>
|
|
255632
|
+
<p>${message}</p>
|
|
255633
|
+
</sp-dialog-wrapper>
|
|
255634
|
+
`);
|
|
255635
|
+
}
|
|
255574
255636
|
function openModal(template) {
|
|
255575
255637
|
const slot = document.createElement("div");
|
|
255576
255638
|
slot.style.pointerEvents = "auto";
|
|
@@ -255659,6 +255721,8 @@ var filteredItems = [];
|
|
|
255659
255721
|
var open = false;
|
|
255660
255722
|
var _anchorEl = null;
|
|
255661
255723
|
var _anchorRect = null;
|
|
255724
|
+
var _filterEl = null;
|
|
255725
|
+
var _popoverEl = null;
|
|
255662
255726
|
function getHost() {
|
|
255663
255727
|
return getLayerSlot("popover", "slash-menu");
|
|
255664
255728
|
}
|
|
@@ -255669,7 +255733,8 @@ function showSlashMenu(anchorEl, filter, cbs) {
|
|
|
255669
255733
|
callbacks = cbs;
|
|
255670
255734
|
_anchorEl = anchorEl;
|
|
255671
255735
|
_anchorRect = anchorEl.getBoundingClientRect();
|
|
255672
|
-
|
|
255736
|
+
const source = cbs.commands || SLASH_COMMANDS;
|
|
255737
|
+
filteredItems = filter ? source.filter((c) => c.label.toLowerCase().includes(filter) || c.tag.toLowerCase().includes(filter)) : source;
|
|
255673
255738
|
if (!filteredItems.length && !cbs.showFilter) {
|
|
255674
255739
|
dismissSlashMenu();
|
|
255675
255740
|
return;
|
|
@@ -255685,9 +255750,8 @@ function showSlashMenu(anchorEl, filter, cbs) {
|
|
|
255685
255750
|
}
|
|
255686
255751
|
if (cbs.showFilter) {
|
|
255687
255752
|
requestAnimationFrame(() => {
|
|
255688
|
-
|
|
255689
|
-
|
|
255690
|
-
input.focus();
|
|
255753
|
+
if (_filterEl)
|
|
255754
|
+
_filterEl.focus();
|
|
255691
255755
|
});
|
|
255692
255756
|
}
|
|
255693
255757
|
}
|
|
@@ -255698,6 +255762,8 @@ function dismissSlashMenu() {
|
|
|
255698
255762
|
callbacks = null;
|
|
255699
255763
|
_anchorEl = null;
|
|
255700
255764
|
_anchorRect = null;
|
|
255765
|
+
_filterEl = null;
|
|
255766
|
+
_popoverEl = null;
|
|
255701
255767
|
filteredItems = [];
|
|
255702
255768
|
document.removeEventListener("keydown", onKeydown, true);
|
|
255703
255769
|
document.removeEventListener("mousedown", onOutsideClick, true);
|
|
@@ -255708,6 +255774,9 @@ function render3(anchorEl, showFilter) {
|
|
|
255708
255774
|
render2(html3`
|
|
255709
255775
|
<sp-popover
|
|
255710
255776
|
open
|
|
255777
|
+
${ref2((el) => {
|
|
255778
|
+
_popoverEl = el || null;
|
|
255779
|
+
})}
|
|
255711
255780
|
style="position:fixed;left:${rect.left}px;top:${rect.bottom + 4}px;z-index:9999;max-height:320px;overflow-y:auto"
|
|
255712
255781
|
>
|
|
255713
255782
|
${showFilter ? html3`<input
|
|
@@ -255716,6 +255785,9 @@ function render3(anchorEl, showFilter) {
|
|
|
255716
255785
|
placeholder="Filter…"
|
|
255717
255786
|
autocomplete="off"
|
|
255718
255787
|
style="display:block;width:100%;box-sizing:border-box;padding:6px 10px;border:none;border-bottom:1px solid var(--border, #444);outline:none;font-size:13px;background:transparent;color:inherit"
|
|
255788
|
+
${ref2((el) => {
|
|
255789
|
+
_filterEl = el || null;
|
|
255790
|
+
})}
|
|
255719
255791
|
@input=${onFilterInput}
|
|
255720
255792
|
/>` : nothing}
|
|
255721
255793
|
<sp-menu style="min-width:220px">
|
|
@@ -255737,9 +255809,7 @@ function render3(anchorEl, showFilter) {
|
|
|
255737
255809
|
`, getHost());
|
|
255738
255810
|
}
|
|
255739
255811
|
function onOutsideClick(e) {
|
|
255740
|
-
|
|
255741
|
-
const popover = host.querySelector("sp-popover");
|
|
255742
|
-
if (popover && !popover.contains(e.target)) {
|
|
255812
|
+
if (_popoverEl && !_popoverEl.contains(e.target)) {
|
|
255743
255813
|
dismissSlashMenu();
|
|
255744
255814
|
}
|
|
255745
255815
|
}
|
|
@@ -255751,15 +255821,15 @@ function select(cmd) {
|
|
|
255751
255821
|
function onFilterInput(e) {
|
|
255752
255822
|
const input = e.target;
|
|
255753
255823
|
const filter = input.value.toLowerCase();
|
|
255754
|
-
|
|
255824
|
+
const source = callbacks?.commands || SLASH_COMMANDS;
|
|
255825
|
+
filteredItems = filter ? source.filter((c) => c.label.toLowerCase().includes(filter) || c.tag.toLowerCase().includes(filter)) : source;
|
|
255755
255826
|
activeIdx = 0;
|
|
255756
255827
|
if (_anchorEl)
|
|
255757
255828
|
render3(_anchorEl, true);
|
|
255758
255829
|
requestAnimationFrame(() => {
|
|
255759
|
-
|
|
255760
|
-
|
|
255761
|
-
|
|
255762
|
-
el.selectionStart = el.selectionEnd = el.value.length;
|
|
255830
|
+
if (_filterEl && _filterEl !== document.activeElement) {
|
|
255831
|
+
_filterEl.focus();
|
|
255832
|
+
_filterEl.selectionStart = _filterEl.selectionEnd = _filterEl.value.length;
|
|
255763
255833
|
}
|
|
255764
255834
|
});
|
|
255765
255835
|
}
|
|
@@ -255826,7 +255896,10 @@ var EDITABLE_BLOCKS = new Set([
|
|
|
255826
255896
|
"li",
|
|
255827
255897
|
"td",
|
|
255828
255898
|
"th",
|
|
255829
|
-
"blockquote"
|
|
255899
|
+
"blockquote",
|
|
255900
|
+
"span",
|
|
255901
|
+
"a",
|
|
255902
|
+
"label"
|
|
255830
255903
|
]);
|
|
255831
255904
|
function isInlineInContext(childTag, parentTag) {
|
|
255832
255905
|
if (!parentTag)
|
|
@@ -256216,6 +256289,7 @@ init_workspace2();
|
|
|
256216
256289
|
// src/panels/block-action-bar.js
|
|
256217
256290
|
init_lit_html();
|
|
256218
256291
|
init_style_map();
|
|
256292
|
+
init_ref();
|
|
256219
256293
|
|
|
256220
256294
|
// ../../node_modules/.bun/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
256221
256295
|
function _arrayWithHoles(r) {
|
|
@@ -257783,6 +257857,7 @@ init_components();
|
|
|
257783
257857
|
|
|
257784
257858
|
// src/editor/convert-to-component.js
|
|
257785
257859
|
init_lit_html();
|
|
257860
|
+
init_ref();
|
|
257786
257861
|
init_store();
|
|
257787
257862
|
init_workspace2();
|
|
257788
257863
|
init_components();
|
|
@@ -257813,6 +257888,7 @@ function mountStatusbar() {
|
|
|
257813
257888
|
renderStatusbar();
|
|
257814
257889
|
});
|
|
257815
257890
|
});
|
|
257891
|
+
statusbarEl?.addEventListener("click", _onStatusbarClick);
|
|
257816
257892
|
}
|
|
257817
257893
|
function esc(text2) {
|
|
257818
257894
|
return String(text2).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -257843,7 +257919,7 @@ function renderStatusbar() {
|
|
|
257843
257919
|
parts.push(esc(statusMsg));
|
|
257844
257920
|
statusbarEl.innerHTML = parts.join(" | ") || "Jx Studio";
|
|
257845
257921
|
}
|
|
257846
|
-
|
|
257922
|
+
function _onStatusbarClick(e) {
|
|
257847
257923
|
const target = e.target;
|
|
257848
257924
|
if (!target.classList.contains("sb-path-seg"))
|
|
257849
257925
|
return;
|
|
@@ -257855,7 +257931,7 @@ statusbarEl?.addEventListener("click", (e) => {
|
|
|
257855
257931
|
updateSession({ selection: path });
|
|
257856
257932
|
renderOnly("leftPanel", "rightPanel", "canvas");
|
|
257857
257933
|
} catch {}
|
|
257858
|
-
}
|
|
257934
|
+
}
|
|
257859
257935
|
function statusMessage(msg, duration = 3000) {
|
|
257860
257936
|
statusMsg = msg;
|
|
257861
257937
|
_rerender?.();
|
|
@@ -257940,7 +258016,7 @@ function promptComponentName(defaultName) {
|
|
|
257940
258016
|
let value = defaultName;
|
|
257941
258017
|
let error = "";
|
|
257942
258018
|
return showDialog((done) => {
|
|
257943
|
-
function
|
|
258019
|
+
function confirm() {
|
|
257944
258020
|
const result = validateName(value);
|
|
257945
258021
|
if (!result.valid) {
|
|
257946
258022
|
error = result.error;
|
|
@@ -257957,7 +258033,7 @@ function promptComponentName(defaultName) {
|
|
|
257957
258033
|
}
|
|
257958
258034
|
function onKeydown2(e) {
|
|
257959
258035
|
if (e.key === "Enter")
|
|
257960
|
-
|
|
258036
|
+
confirm();
|
|
257961
258037
|
}
|
|
257962
258038
|
function rerender() {
|
|
257963
258039
|
const layer = document.getElementById("layer-dialog");
|
|
@@ -257974,7 +258050,7 @@ function promptComponentName(defaultName) {
|
|
|
257974
258050
|
confirm-label="Convert"
|
|
257975
258051
|
cancel-label="Cancel"
|
|
257976
258052
|
size="s"
|
|
257977
|
-
@confirm=${
|
|
258053
|
+
@confirm=${confirm}
|
|
257978
258054
|
@cancel=${() => done(null)}
|
|
257979
258055
|
@close=${() => done(null)}
|
|
257980
258056
|
>
|
|
@@ -257985,22 +258061,21 @@ function promptComponentName(defaultName) {
|
|
|
257985
258061
|
?negative=${!!error}
|
|
257986
258062
|
@input=${onInput}
|
|
257987
258063
|
@keydown=${onKeydown2}
|
|
258064
|
+
${ref2((el) => {
|
|
258065
|
+
if (el)
|
|
258066
|
+
requestAnimationFrame(() => {
|
|
258067
|
+
el.focus();
|
|
258068
|
+
const input = el.shadowRoot?.querySelector("input");
|
|
258069
|
+
if (input)
|
|
258070
|
+
input.select();
|
|
258071
|
+
});
|
|
258072
|
+
})}
|
|
257988
258073
|
>
|
|
257989
258074
|
<sp-help-text slot="negative-help-text">${error}</sp-help-text>
|
|
257990
258075
|
</sp-textfield>
|
|
257991
258076
|
</sp-dialog-wrapper>
|
|
257992
258077
|
`;
|
|
257993
258078
|
}
|
|
257994
|
-
requestAnimationFrame(() => {
|
|
257995
|
-
const layer = document.getElementById("layer-dialog");
|
|
257996
|
-
const tf = layer?.querySelector("sp-textfield");
|
|
257997
|
-
if (tf) {
|
|
257998
|
-
tf.focus();
|
|
257999
|
-
const input = tf.shadowRoot?.querySelector("input");
|
|
258000
|
-
if (input)
|
|
258001
|
-
input.select();
|
|
258002
|
-
}
|
|
258003
|
-
});
|
|
258004
258079
|
return buildTpl();
|
|
258005
258080
|
});
|
|
258006
258081
|
}
|
|
@@ -258094,6 +258169,48 @@ function overlayBoxDescriptor(el, type, panel) {
|
|
|
258094
258169
|
};
|
|
258095
258170
|
}
|
|
258096
258171
|
|
|
258172
|
+
// src/editor/convert-targets.js
|
|
258173
|
+
var TAG_LABELS = {
|
|
258174
|
+
p: "Paragraph",
|
|
258175
|
+
h1: "Heading 1",
|
|
258176
|
+
h2: "Heading 2",
|
|
258177
|
+
h3: "Heading 3",
|
|
258178
|
+
h4: "Heading 4",
|
|
258179
|
+
h5: "Heading 5",
|
|
258180
|
+
h6: "Heading 6",
|
|
258181
|
+
blockquote: "Blockquote",
|
|
258182
|
+
div: "Div",
|
|
258183
|
+
section: "Section",
|
|
258184
|
+
article: "Article",
|
|
258185
|
+
aside: "Aside",
|
|
258186
|
+
main: "Main",
|
|
258187
|
+
header: "Header",
|
|
258188
|
+
footer: "Footer",
|
|
258189
|
+
nav: "Nav",
|
|
258190
|
+
search: "Search",
|
|
258191
|
+
ul: "Bulleted List",
|
|
258192
|
+
ol: "Numbered List"
|
|
258193
|
+
};
|
|
258194
|
+
var groups = elements_meta_default.$convertGroups || {};
|
|
258195
|
+
function getConvertTargets(currentTag, isEmpty) {
|
|
258196
|
+
const def3 = elements_meta_default.$defs?.[currentTag];
|
|
258197
|
+
if (!def3?.$convertTo)
|
|
258198
|
+
return [];
|
|
258199
|
+
const groupNames = isEmpty && def3.$convertToWhenEmpty ? def3.$convertToWhenEmpty : [def3.$convertTo];
|
|
258200
|
+
const tags = new Set;
|
|
258201
|
+
for (const name of groupNames) {
|
|
258202
|
+
for (const tag3 of groups[name] || []) {
|
|
258203
|
+
if (tag3 !== currentTag)
|
|
258204
|
+
tags.add(tag3);
|
|
258205
|
+
}
|
|
258206
|
+
}
|
|
258207
|
+
return [...tags].map((tag3) => ({
|
|
258208
|
+
label: TAG_LABELS[tag3] || tag3.charAt(0).toUpperCase() + tag3.slice(1),
|
|
258209
|
+
tag: tag3,
|
|
258210
|
+
description: ""
|
|
258211
|
+
}));
|
|
258212
|
+
}
|
|
258213
|
+
|
|
258097
258214
|
// src/panels/block-action-bar.js
|
|
258098
258215
|
var _ctx2 = null;
|
|
258099
258216
|
function initBlockActionBar(ctx) {
|
|
@@ -258118,8 +258235,23 @@ function onBarMousedown(e) {
|
|
|
258118
258235
|
return;
|
|
258119
258236
|
if (e.target.closest(".bar-drag-handle"))
|
|
258120
258237
|
return;
|
|
258238
|
+
if (e.target.closest(".bar-tag--interactive"))
|
|
258239
|
+
return;
|
|
258121
258240
|
e.preventDefault();
|
|
258122
258241
|
}
|
|
258242
|
+
function onTagBadgeClick(e, targets, selection) {
|
|
258243
|
+
e.stopPropagation();
|
|
258244
|
+
const anchorEl = e.currentTarget;
|
|
258245
|
+
showSlashMenu(anchorEl, "", {
|
|
258246
|
+
showFilter: targets.length > 6,
|
|
258247
|
+
commands: targets,
|
|
258248
|
+
onSelect: (cmd) => {
|
|
258249
|
+
transactDoc(activeTab.value, (t) => {
|
|
258250
|
+
mutateUpdateProperty(t, selection, "tagName", cmd.tag);
|
|
258251
|
+
});
|
|
258252
|
+
}
|
|
258253
|
+
});
|
|
258254
|
+
}
|
|
258123
258255
|
function captureSelectionRange() {
|
|
258124
258256
|
const sel = window.getSelection();
|
|
258125
258257
|
if (sel && sel.rangeCount)
|
|
@@ -258240,9 +258372,9 @@ function showLinkPopover(anchorBtn) {
|
|
|
258240
258372
|
}
|
|
258241
258373
|
}
|
|
258242
258374
|
const rect = anchorBtn.getBoundingClientRect();
|
|
258375
|
+
let _linkField = null;
|
|
258243
258376
|
const onApply = () => {
|
|
258244
|
-
const
|
|
258245
|
-
const url = field?.value || "";
|
|
258377
|
+
const url = _linkField?.value || "";
|
|
258246
258378
|
if (existingLink) {
|
|
258247
258379
|
existingLink.setAttribute("href", url);
|
|
258248
258380
|
} else if (url) {
|
|
@@ -258285,6 +258417,11 @@ function showLinkPopover(anchorBtn) {
|
|
|
258285
258417
|
style="width:200px"
|
|
258286
258418
|
value=${existingLink?.getAttribute("href") || ""}
|
|
258287
258419
|
@keydown=${onKeydown2}
|
|
258420
|
+
${ref2((el) => {
|
|
258421
|
+
_linkField = el || null;
|
|
258422
|
+
if (el)
|
|
258423
|
+
requestAnimationFrame(() => el.focus());
|
|
258424
|
+
})}
|
|
258288
258425
|
></sp-textfield>
|
|
258289
258426
|
<sp-action-button size="xs" @click=${onApply}>
|
|
258290
258427
|
${existingLink ? "Update" : "Apply"}
|
|
@@ -258292,7 +258429,6 @@ function showLinkPopover(anchorBtn) {
|
|
|
258292
258429
|
${existingLink ? html3` <sp-action-button size="xs" @click=${onRemove}>Remove</sp-action-button> ` : nothing}
|
|
258293
258430
|
</sp-popover>
|
|
258294
258431
|
`, host);
|
|
258295
|
-
requestAnimationFrame(() => host.querySelector("sp-textfield")?.focus());
|
|
258296
258432
|
}
|
|
258297
258433
|
function moveSelectionUp() {
|
|
258298
258434
|
const tab = activeTab.value;
|
|
@@ -258355,6 +258491,10 @@ function renderBlockActionBar() {
|
|
|
258355
258491
|
const actions = getInlineActions(tag3) || [];
|
|
258356
258492
|
const showFormat = inlineEditing && actions.length > 0;
|
|
258357
258493
|
const activeValues = showFormat ? actions.filter((a) => isTagActiveInSelection(a.tag, el)).map((a) => a.tag) : [];
|
|
258494
|
+
const isComponent = node.tagName?.includes("-") && componentRegistry.some((c) => c.tagName === node.tagName);
|
|
258495
|
+
const isEmpty = !node.textContent && (!node.children || node.children.length === 0 || Array.isArray(node.children) && node.children.length === 1 && typeof node.children[0] === "object" && node.children[0]?.tagName === "br");
|
|
258496
|
+
const convertTargets = !isComponent ? getConvertTargets(tag3, isEmpty) : [];
|
|
258497
|
+
const badgeInteractive = convertTargets.length > 0;
|
|
258358
258498
|
render2(html3`
|
|
258359
258499
|
<div
|
|
258360
258500
|
class="block-action-bar"
|
|
@@ -258363,9 +258503,32 @@ function renderBlockActionBar() {
|
|
|
258363
258503
|
>
|
|
258364
258504
|
${selection.length >= 2 ? renderParentSelector() : nothing}
|
|
258365
258505
|
|
|
258366
|
-
<span
|
|
258506
|
+
<span
|
|
258507
|
+
class="bar-tag${badgeInteractive ? " bar-tag--interactive" : ""}"
|
|
258508
|
+
@click=${badgeInteractive ? (e) => onTagBadgeClick(e, convertTargets, selection) : nothing}
|
|
258509
|
+
>${node.$id || (node.tagName ?? "div")}</span
|
|
258510
|
+
>
|
|
258367
258511
|
|
|
258368
|
-
${selection.length >= 2 ? html3`<span
|
|
258512
|
+
${selection.length >= 2 ? html3`<span
|
|
258513
|
+
class="bar-drag-handle"
|
|
258514
|
+
title="Drag to reorder"
|
|
258515
|
+
${ref2((el2) => {
|
|
258516
|
+
if (!el2)
|
|
258517
|
+
return;
|
|
258518
|
+
if (view.selDragCleanup) {
|
|
258519
|
+
view.selDragCleanup();
|
|
258520
|
+
view.selDragCleanup = null;
|
|
258521
|
+
}
|
|
258522
|
+
view.selDragCleanup = draggable({
|
|
258523
|
+
element: el2,
|
|
258524
|
+
getInitialData: () => ({
|
|
258525
|
+
type: "tree-node",
|
|
258526
|
+
path: activeTab.value?.session.selection
|
|
258527
|
+
})
|
|
258528
|
+
});
|
|
258529
|
+
})}
|
|
258530
|
+
>⠿</span
|
|
258531
|
+
>` : nothing}
|
|
258369
258532
|
${selection.length >= 2 ? renderMoveArrows() : nothing}
|
|
258370
258533
|
${selection.length >= 2 && node.tagName ? (() => {
|
|
258371
258534
|
const isComp = node.tagName.includes("-") && componentRegistry.some((c) => c.tagName === node.tagName);
|
|
@@ -258419,20 +258582,6 @@ function renderBlockActionBar() {
|
|
|
258419
258582
|
if (barRect.right > window.innerWidth) {
|
|
258420
258583
|
bar.style.left = `${Math.max(0, window.innerWidth - barRect.width)}px`;
|
|
258421
258584
|
}
|
|
258422
|
-
const currentTab = activeTab.value;
|
|
258423
|
-
if (currentTab?.session.selection && currentTab.session.selection.length >= 2) {
|
|
258424
|
-
const handle = bar.querySelector(".bar-drag-handle");
|
|
258425
|
-
if (handle) {
|
|
258426
|
-
if (view.selDragCleanup) {
|
|
258427
|
-
view.selDragCleanup();
|
|
258428
|
-
view.selDragCleanup = null;
|
|
258429
|
-
}
|
|
258430
|
-
view.selDragCleanup = draggable({
|
|
258431
|
-
element: handle,
|
|
258432
|
-
getInitialData: () => ({ type: "tree-node", path: activeTab.value?.session.selection })
|
|
258433
|
-
});
|
|
258434
|
-
}
|
|
258435
|
-
}
|
|
258436
258585
|
});
|
|
258437
258586
|
}
|
|
258438
258587
|
|
|
@@ -258781,11 +258930,6 @@ function prepareForEditMode(node) {
|
|
|
258781
258930
|
{
|
|
258782
258931
|
tagName: "div",
|
|
258783
258932
|
className: "repeater-perimeter",
|
|
258784
|
-
state: {
|
|
258785
|
-
$map: { item: {}, index: 0 },
|
|
258786
|
-
"$map/item": {},
|
|
258787
|
-
"$map/index": 0
|
|
258788
|
-
},
|
|
258789
258933
|
children: [prepareForEditMode(template)]
|
|
258790
258934
|
}
|
|
258791
258935
|
];
|
|
@@ -258833,8 +258977,8 @@ function prepareForEditMode(node) {
|
|
|
258833
258977
|
} else if (typeof v === "string" && v.includes("${")) {
|
|
258834
258978
|
out[k] = templateToEditDisplay(v);
|
|
258835
258979
|
} else if (v && typeof v === "object" && v.$ref) {
|
|
258836
|
-
const
|
|
258837
|
-
const label =
|
|
258980
|
+
const ref3 = v.$ref;
|
|
258981
|
+
const label = ref3.startsWith("#/state/") ? ref3.slice(8) : ref3;
|
|
258838
258982
|
out[k] = `{${label}}`;
|
|
258839
258983
|
} else {
|
|
258840
258984
|
out[k] = prepareForEditMode(v);
|
|
@@ -259059,6 +259203,7 @@ init_if_defined();
|
|
|
259059
259203
|
init_store();
|
|
259060
259204
|
init_workspace2();
|
|
259061
259205
|
var _ctx4;
|
|
259206
|
+
var _zoomIndicatorEl = null;
|
|
259062
259207
|
function initCanvasUtils(ctx) {
|
|
259063
259208
|
_ctx4 = ctx;
|
|
259064
259209
|
}
|
|
@@ -259258,7 +259403,12 @@ function renderZoomIndicator() {
|
|
|
259258
259403
|
const zoom = _ctx4.getZoom();
|
|
259259
259404
|
const host = getLayerSlot("popover", "zoom-indicator");
|
|
259260
259405
|
render2(html3`
|
|
259261
|
-
<div
|
|
259406
|
+
<div
|
|
259407
|
+
class="zoom-indicator"
|
|
259408
|
+
${ref2((el) => {
|
|
259409
|
+
_zoomIndicatorEl = el || null;
|
|
259410
|
+
})}
|
|
259411
|
+
>
|
|
259262
259412
|
<span class="zoom-indicator-action" title="Reset to 100%" @click=${resetZoom}>
|
|
259263
259413
|
<svg
|
|
259264
259414
|
width="14"
|
|
@@ -259291,13 +259441,12 @@ function renderZoomIndicator() {
|
|
|
259291
259441
|
positionZoomIndicator();
|
|
259292
259442
|
}
|
|
259293
259443
|
function positionZoomIndicator() {
|
|
259294
|
-
|
|
259295
|
-
if (!indicator)
|
|
259444
|
+
if (!_zoomIndicatorEl)
|
|
259296
259445
|
return;
|
|
259297
259446
|
const rect = canvasWrap.getBoundingClientRect();
|
|
259298
|
-
|
|
259299
|
-
|
|
259300
|
-
|
|
259447
|
+
_zoomIndicatorEl.style.left = `${rect.left + rect.width / 2}px`;
|
|
259448
|
+
_zoomIndicatorEl.style.top = `${rect.bottom - 32}px`;
|
|
259449
|
+
_zoomIndicatorEl.style.transform = "translateX(-50%)";
|
|
259301
259450
|
}
|
|
259302
259451
|
function updateActivePanelHeaders() {
|
|
259303
259452
|
const activeMedia = activeTab.value?.session.ui.activeMedia ?? null;
|
|
@@ -263126,6 +263275,7 @@ init_workspace2();
|
|
|
263126
263275
|
|
|
263127
263276
|
// src/github/github-publish.js
|
|
263128
263277
|
init_lit_html();
|
|
263278
|
+
init_ref();
|
|
263129
263279
|
|
|
263130
263280
|
// src/github/github-auth.js
|
|
263131
263281
|
init_lit_html();
|
|
@@ -263229,21 +263379,20 @@ async function publishToGithub({ projectName }) {
|
|
|
263229
263379
|
if (!token)
|
|
263230
263380
|
return false;
|
|
263231
263381
|
const repoOpts = await showDialog((done) => {
|
|
263382
|
+
let _nameInput = null;
|
|
263383
|
+
let _descInput = null;
|
|
263384
|
+
let _privateToggle = null;
|
|
263232
263385
|
return html3`
|
|
263233
263386
|
<sp-dialog-wrapper
|
|
263234
263387
|
open
|
|
263235
263388
|
headline="Publish to GitHub"
|
|
263236
263389
|
confirm-label="Create Repository"
|
|
263237
263390
|
cancel-label="Cancel"
|
|
263238
|
-
@confirm=${(
|
|
263239
|
-
const dialog = e.target;
|
|
263240
|
-
const nameInput = dialog.querySelector('[name="repo-name"]');
|
|
263241
|
-
const descInput = dialog.querySelector('[name="repo-desc"]');
|
|
263242
|
-
const privateToggle = dialog.querySelector('[name="repo-private"]');
|
|
263391
|
+
@confirm=${() => {
|
|
263243
263392
|
done({
|
|
263244
|
-
name:
|
|
263245
|
-
description:
|
|
263246
|
-
isPrivate:
|
|
263393
|
+
name: _nameInput?.value || projectName,
|
|
263394
|
+
description: _descInput?.value || "",
|
|
263395
|
+
isPrivate: _privateToggle?.checked ?? true
|
|
263247
263396
|
});
|
|
263248
263397
|
}}
|
|
263249
263398
|
@cancel=${() => done(null)}
|
|
@@ -263256,6 +263405,9 @@ async function publishToGithub({ projectName }) {
|
|
|
263256
263405
|
name="repo-name"
|
|
263257
263406
|
value="${projectName}"
|
|
263258
263407
|
placeholder="my-project"
|
|
263408
|
+
${ref2((el) => {
|
|
263409
|
+
_nameInput = el || null;
|
|
263410
|
+
})}
|
|
263259
263411
|
></sp-textfield>
|
|
263260
263412
|
|
|
263261
263413
|
<sp-field-label for="repo-desc">Description (optional)</sp-field-label>
|
|
@@ -263263,10 +263415,20 @@ async function publishToGithub({ projectName }) {
|
|
|
263263
263415
|
id="repo-desc"
|
|
263264
263416
|
name="repo-desc"
|
|
263265
263417
|
placeholder="A brief description"
|
|
263418
|
+
${ref2((el) => {
|
|
263419
|
+
_descInput = el || null;
|
|
263420
|
+
})}
|
|
263266
263421
|
></sp-textfield>
|
|
263267
263422
|
|
|
263268
263423
|
<sp-field-label>Visibility</sp-field-label>
|
|
263269
|
-
<sp-switch
|
|
263424
|
+
<sp-switch
|
|
263425
|
+
name="repo-private"
|
|
263426
|
+
checked
|
|
263427
|
+
${ref2((el) => {
|
|
263428
|
+
_privateToggle = el || null;
|
|
263429
|
+
})}
|
|
263430
|
+
>Private repository</sp-switch
|
|
263431
|
+
>
|
|
263270
263432
|
</div>
|
|
263271
263433
|
</sp-dialog-wrapper>
|
|
263272
263434
|
`;
|
|
@@ -263739,7 +263901,8 @@ function renderGitPanel(S, ctx) {
|
|
|
263739
263901
|
@click=${async () => {
|
|
263740
263902
|
if (file.status === "U")
|
|
263741
263903
|
return;
|
|
263742
|
-
|
|
263904
|
+
const confirmed = await showConfirmDialog("Discard Changes", `Discard changes to ${file.path}?`, { confirmLabel: "Discard", destructive: true });
|
|
263905
|
+
if (!confirmed)
|
|
263743
263906
|
return;
|
|
263744
263907
|
await gitAction("gitDiscard", [file.path]);
|
|
263745
263908
|
}}
|
|
@@ -263762,7 +263925,7 @@ function renderGitPanel(S, ctx) {
|
|
|
263762
263925
|
`;
|
|
263763
263926
|
};
|
|
263764
263927
|
const groupFilesByComponent = (files) => {
|
|
263765
|
-
const
|
|
263928
|
+
const groups2 = new Map;
|
|
263766
263929
|
for (const f of files) {
|
|
263767
263930
|
const parts = f.path.split("/");
|
|
263768
263931
|
let component;
|
|
@@ -263771,11 +263934,11 @@ function renderGitPanel(S, ctx) {
|
|
|
263771
263934
|
} else {
|
|
263772
263935
|
component = "Other";
|
|
263773
263936
|
}
|
|
263774
|
-
if (!
|
|
263775
|
-
|
|
263776
|
-
|
|
263937
|
+
if (!groups2.has(component))
|
|
263938
|
+
groups2.set(component, []);
|
|
263939
|
+
groups2.get(component).push(f);
|
|
263777
263940
|
}
|
|
263778
|
-
return
|
|
263941
|
+
return groups2;
|
|
263779
263942
|
};
|
|
263780
263943
|
const allFiles = [...stagedFiles, ...unstagedFiles];
|
|
263781
263944
|
const componentGroups = groupFilesByComponent(allFiles);
|
|
@@ -264264,6 +264427,10 @@ var _serverFnConfig = { skip: false };
|
|
|
264264
264427
|
function setSkipServerFunctions(v) {
|
|
264265
264428
|
_serverFnConfig.skip = v;
|
|
264266
264429
|
}
|
|
264430
|
+
var _contentConfig = { skip: false };
|
|
264431
|
+
function setSkipContentResolution(v) {
|
|
264432
|
+
_contentConfig.skip = v;
|
|
264433
|
+
}
|
|
264267
264434
|
async function buildScope(doc, parentScope = {}, base2 = location.href) {
|
|
264268
264435
|
const raw = {};
|
|
264269
264436
|
for (const [key, val] of Object.entries(parentScope)) {
|
|
@@ -264347,8 +264514,9 @@ function hasSchemaKeywords(obj) {
|
|
|
264347
264514
|
return false;
|
|
264348
264515
|
}
|
|
264349
264516
|
function evaluateTemplate(str, state) {
|
|
264350
|
-
const
|
|
264351
|
-
|
|
264517
|
+
const $map = state?.$map;
|
|
264518
|
+
const fn = new Function("state", "$map", "item", "index", `return \`${str}\``);
|
|
264519
|
+
return fn(state, $map, $map?.item, $map?.index);
|
|
264352
264520
|
}
|
|
264353
264521
|
var _moduleCache = new Map;
|
|
264354
264522
|
async function resolveFunction(def3, state, key, base2) {
|
|
@@ -264865,6 +265033,39 @@ async function resolvePrototype(def3, state, key, base2) {
|
|
|
264865
265033
|
return new Blob(def3.parts ?? [], { type: def3.type ?? "text/plain" });
|
|
264866
265034
|
case "ReadableStream":
|
|
264867
265035
|
return null;
|
|
265036
|
+
case "ContentCollection":
|
|
265037
|
+
case "ContentEntry": {
|
|
265038
|
+
if (_contentConfig.skip) {
|
|
265039
|
+
return ref(def3.$prototype === "ContentCollection" ? [{ id: "", data: {} }] : null);
|
|
265040
|
+
}
|
|
265041
|
+
const s2 = ref(def3.$prototype === "ContentCollection" ? [] : null);
|
|
265042
|
+
effect(() => {
|
|
265043
|
+
let id = def3.id;
|
|
265044
|
+
if (id && typeof id === "object" && id.$ref?.startsWith("#/$params/")) {
|
|
265045
|
+
const paramName = id.$ref.replace("#/$params/", "");
|
|
265046
|
+
id = state?.$params?.[paramName];
|
|
265047
|
+
} else if (typeof id === "string" && id.includes("${")) {
|
|
265048
|
+
id = evaluateTemplate(id, state);
|
|
265049
|
+
}
|
|
265050
|
+
if (def3.$prototype === "ContentEntry" && !id)
|
|
265051
|
+
return;
|
|
265052
|
+
fetch("/__studio/content", {
|
|
265053
|
+
method: "POST",
|
|
265054
|
+
headers: { "Content-Type": "application/json" },
|
|
265055
|
+
body: JSON.stringify({
|
|
265056
|
+
$prototype: def3.$prototype,
|
|
265057
|
+
contentType: def3.contentType,
|
|
265058
|
+
id,
|
|
265059
|
+
filter: def3.filter,
|
|
265060
|
+
sort: def3.sort,
|
|
265061
|
+
limit: def3.limit
|
|
265062
|
+
})
|
|
265063
|
+
}).then((r) => r.ok ? r.json() : null).then((d2) => {
|
|
265064
|
+
s2.value = d2;
|
|
265065
|
+
}).catch(() => {});
|
|
265066
|
+
});
|
|
265067
|
+
return s2;
|
|
265068
|
+
}
|
|
264868
265069
|
default:
|
|
264869
265070
|
console.warn(`Jx: unknown $prototype "${def3.$prototype}" for "${key}". Did you mean to add '$src'?`);
|
|
264870
265071
|
return ref(null);
|
|
@@ -265427,6 +265628,12 @@ function camelToKebab2(s2) {
|
|
|
265427
265628
|
}
|
|
265428
265629
|
|
|
265429
265630
|
// src/canvas/canvas-live-render.js
|
|
265631
|
+
function _preventNav(e) {
|
|
265632
|
+
if (e.target.closest("a[href]")) {
|
|
265633
|
+
e.preventDefault();
|
|
265634
|
+
}
|
|
265635
|
+
}
|
|
265636
|
+
var _navGuarded = new WeakSet;
|
|
265430
265637
|
var _ctx6 = null;
|
|
265431
265638
|
var layoutElements = new WeakSet;
|
|
265432
265639
|
var _failedElements = new Set;
|
|
@@ -265483,6 +265690,7 @@ async function renderCanvasLive(gen, doc, canvasEl) {
|
|
|
265483
265690
|
_failedElementsDocPath = S.documentPath ?? null;
|
|
265484
265691
|
}
|
|
265485
265692
|
setSkipServerFunctions(canvasMode !== "preview");
|
|
265693
|
+
setSkipContentResolution(canvasMode !== "preview");
|
|
265486
265694
|
let renderDoc = canvasMode === "preview" ? structuredClone(toRaw(doc)) : prepareForEditMode(stripEventHandlers(doc));
|
|
265487
265695
|
let layoutWrapped = false;
|
|
265488
265696
|
activeLayoutPath = null;
|
|
@@ -265729,6 +265937,10 @@ async function renderCanvasLive(gen, doc, canvasEl) {
|
|
|
265729
265937
|
canvasEl.removeAttribute("data-content-mode");
|
|
265730
265938
|
}
|
|
265731
265939
|
canvasEl.appendChild(el);
|
|
265940
|
+
if (!_navGuarded.has(canvasEl)) {
|
|
265941
|
+
canvasEl.addEventListener("click", _preventNav);
|
|
265942
|
+
_navGuarded.add(canvasEl);
|
|
265943
|
+
}
|
|
265732
265944
|
if (canvasMode === "design" || canvasMode === "edit") {
|
|
265733
265945
|
requestAnimationFrame(() => {
|
|
265734
265946
|
const editingEl = getActiveElement2();
|
|
@@ -266055,20 +266267,20 @@ function normParam(p) {
|
|
|
266055
266267
|
function renderSignalsTemplate(S, ctx) {
|
|
266056
266268
|
const defs = S.document.state || {};
|
|
266057
266269
|
const entries2 = Object.entries(defs);
|
|
266058
|
-
const
|
|
266270
|
+
const groups2 = {
|
|
266059
266271
|
state: [],
|
|
266060
266272
|
computed: [],
|
|
266061
266273
|
data: [],
|
|
266062
266274
|
function: []
|
|
266063
266275
|
};
|
|
266064
266276
|
for (const [name, def3] of entries2) {
|
|
266065
|
-
|
|
266277
|
+
groups2[defCategory(def3)].push([name, def3]);
|
|
266066
266278
|
}
|
|
266067
266279
|
const categories = [
|
|
266068
|
-
{ key: "state", label: "State", items:
|
|
266069
|
-
{ key: "computed", label: "Computed", items:
|
|
266070
|
-
{ key: "data", label: "Data", items:
|
|
266071
|
-
{ key: "function", label: "Functions", items:
|
|
266280
|
+
{ key: "state", label: "State", items: groups2.state },
|
|
266281
|
+
{ key: "computed", label: "Computed", items: groups2.computed },
|
|
266282
|
+
{ key: "data", label: "Data", items: groups2.data },
|
|
266283
|
+
{ key: "function", label: "Functions", items: groups2.function }
|
|
266072
266284
|
];
|
|
266073
266285
|
const collapsedCats = S._collapsedSignalCats || (S._collapsedSignalCats = new Set);
|
|
266074
266286
|
const catTemplates = categories.filter((c) => c.items.length > 0).map(({ key, label: label4, items }) => html3`
|
|
@@ -266342,6 +266554,9 @@ function renderDataSourceFields(S, name, def3, textareaRow, pickerRow, ctx) {
|
|
|
266342
266554
|
${signalFieldRow("Default", String(def3.default || ""), (v) => transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { default: v })))}
|
|
266343
266555
|
`;
|
|
266344
266556
|
}
|
|
266557
|
+
if (proto2 === "ContentEntry" || proto2 === "ContentCollection") {
|
|
266558
|
+
return renderContentPrototypeFields(name, def3, proto2);
|
|
266559
|
+
}
|
|
266345
266560
|
if (proto2 === "Set" || proto2 === "Map" || proto2 === "FormData") {
|
|
266346
266561
|
const fieldName = proto2 === "FormData" ? "fields" : "default";
|
|
266347
266562
|
const fieldLabel = proto2 === "FormData" ? "Fields" : "Default";
|
|
@@ -266354,6 +266569,85 @@ function renderDataSourceFields(S, name, def3, textareaRow, pickerRow, ctx) {
|
|
|
266354
266569
|
}
|
|
266355
266570
|
return renderExternalPrototypeEditorTemplate(S, name, def3, ctx);
|
|
266356
266571
|
}
|
|
266572
|
+
function renderContentPrototypeFields(name, def3, proto2) {
|
|
266573
|
+
const contentTypes = projectState?.projectConfig?.contentTypes;
|
|
266574
|
+
const typeNames = contentTypes ? Object.keys(contentTypes) : [];
|
|
266575
|
+
const currentType = def3.contentType || "";
|
|
266576
|
+
const schema4 = currentType && contentTypes?.[currentType]?.schema || undefined;
|
|
266577
|
+
const contentTypeField = typeNames.length ? html3`
|
|
266578
|
+
<div class="signal-field-row">
|
|
266579
|
+
<label class="signal-field-label">Content Type</label>
|
|
266580
|
+
<sp-picker
|
|
266581
|
+
size="s"
|
|
266582
|
+
value=${currentType}
|
|
266583
|
+
style="width:100%"
|
|
266584
|
+
@change=${(e) => {
|
|
266585
|
+
const v = e.target.value;
|
|
266586
|
+
transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { contentType: v }));
|
|
266587
|
+
}}
|
|
266588
|
+
>
|
|
266589
|
+
${typeNames.map((t) => html3`<sp-menu-item value=${t}>${t}</sp-menu-item>`)}
|
|
266590
|
+
</sp-picker>
|
|
266591
|
+
</div>
|
|
266592
|
+
` : signalFieldRow("Content Type", currentType, (v) => transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { contentType: v })));
|
|
266593
|
+
let entryFields = nothing;
|
|
266594
|
+
if (proto2 === "ContentEntry") {
|
|
266595
|
+
const idVal = def3.id;
|
|
266596
|
+
const idStr = idVal && typeof idVal === "object" && idVal.$ref ? idVal.$ref : typeof idVal === "string" ? idVal : "";
|
|
266597
|
+
entryFields = signalFieldRow("ID", idStr, (v) => {
|
|
266598
|
+
const val = v.startsWith("#/") ? { $ref: v } : v;
|
|
266599
|
+
transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { id: val }));
|
|
266600
|
+
});
|
|
266601
|
+
} else {
|
|
266602
|
+
const filterStr = def3.filter ? JSON.stringify(def3.filter) : "";
|
|
266603
|
+
const sortStr = def3.sort ? `${def3.sort.field || ""} ${def3.sort.order || ""}`.trim() : "";
|
|
266604
|
+
const limitStr = def3.limit != null ? String(def3.limit) : "";
|
|
266605
|
+
entryFields = html3`
|
|
266606
|
+
${signalFieldRow("Filter", filterStr, (v) => {
|
|
266607
|
+
try {
|
|
266608
|
+
const parsed = v ? JSON.parse(v) : undefined;
|
|
266609
|
+
transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { filter: parsed }));
|
|
266610
|
+
} catch {}
|
|
266611
|
+
})}
|
|
266612
|
+
${signalFieldRow("Sort", sortStr, (v) => {
|
|
266613
|
+
if (!v) {
|
|
266614
|
+
transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { sort: undefined }));
|
|
266615
|
+
return;
|
|
266616
|
+
}
|
|
266617
|
+
const [field, order2] = v.split(" ");
|
|
266618
|
+
transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { sort: { field, order: order2 || "asc" } }));
|
|
266619
|
+
})}
|
|
266620
|
+
${signalFieldRow("Limit", limitStr, (v) => {
|
|
266621
|
+
const num = v ? parseInt(v, 10) : undefined;
|
|
266622
|
+
transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { limit: num }));
|
|
266623
|
+
})}
|
|
266624
|
+
`;
|
|
266625
|
+
}
|
|
266626
|
+
let schemaFields = nothing;
|
|
266627
|
+
if (schema4?.properties) {
|
|
266628
|
+
const fields = Object.entries(schema4.properties);
|
|
266629
|
+
const required = new Set(schema4.required || []);
|
|
266630
|
+
schemaFields = html3`
|
|
266631
|
+
<div style="margin-top:8px;padding:6px 0;border-top:1px solid var(--border-dim)">
|
|
266632
|
+
<div style="font-size:11px;color:var(--fg-dim);margin-bottom:4px;font-weight:500">
|
|
266633
|
+
Fields (${currentType})
|
|
266634
|
+
</div>
|
|
266635
|
+
${fields.map(([field, fieldDef]) => html3`
|
|
266636
|
+
<div style="font-size:11px;padding:2px 0;display:flex;gap:4px;align-items:center">
|
|
266637
|
+
<code style="color:var(--fg-default)">${field}</code>
|
|
266638
|
+
<span style="color:var(--fg-dim)">${fieldDef.type || ""}</span>
|
|
266639
|
+
${required.has(field) ? html3`<span style="color:var(--color-accent,#f36f32);font-size:9px">req</span>` : nothing}
|
|
266640
|
+
</div>
|
|
266641
|
+
`)}
|
|
266642
|
+
</div>
|
|
266643
|
+
`;
|
|
266644
|
+
}
|
|
266645
|
+
return html3`
|
|
266646
|
+
${contentTypeField}
|
|
266647
|
+
${signalFieldRow("Prototype", proto2, (v) => transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { $prototype: v })))}
|
|
266648
|
+
${entryFields} ${schemaFields}
|
|
266649
|
+
`;
|
|
266650
|
+
}
|
|
266357
266651
|
function renderFunctionFields(S, name, def3, textareaRow, ctx) {
|
|
266358
266652
|
const descriptionField = signalFieldRow("Description", def3.description || "", (v) => transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { description: v || undefined })));
|
|
266359
266653
|
const bodyField = def3.$src ? html3`
|
|
@@ -268221,8 +268515,203 @@ init_workspace2();
|
|
|
268221
268515
|
|
|
268222
268516
|
// src/editor/context-menu.js
|
|
268223
268517
|
init_lit_html();
|
|
268518
|
+
init_ref();
|
|
268224
268519
|
init_store();
|
|
268225
268520
|
init_workspace2();
|
|
268521
|
+
|
|
268522
|
+
// src/editor/convert-to-repeater.js
|
|
268523
|
+
init_lit_html();
|
|
268524
|
+
init_ref();
|
|
268525
|
+
init_store();
|
|
268526
|
+
init_workspace2();
|
|
268527
|
+
async function convertToRepeater() {
|
|
268528
|
+
const tab = activeTab.value;
|
|
268529
|
+
if (!tab?.session.selection || tab.session.selection.length < 2)
|
|
268530
|
+
return;
|
|
268531
|
+
const path2 = tab.session.selection;
|
|
268532
|
+
const node2 = getNodeAtPath(tab.doc.document, path2);
|
|
268533
|
+
if (!node2)
|
|
268534
|
+
return;
|
|
268535
|
+
const defs = tab.doc.document.state || {};
|
|
268536
|
+
const config = await promptRepeaterConfig(defs);
|
|
268537
|
+
if (!config)
|
|
268538
|
+
return;
|
|
268539
|
+
transactDoc(tab, (t) => {
|
|
268540
|
+
const doc = t.doc.document;
|
|
268541
|
+
if (config.newDef) {
|
|
268542
|
+
if (!doc.state)
|
|
268543
|
+
doc.state = {};
|
|
268544
|
+
doc.state[config.newDef.name] = { type: "array", default: [] };
|
|
268545
|
+
}
|
|
268546
|
+
const pp = parentElementPath(path2);
|
|
268547
|
+
if (!pp)
|
|
268548
|
+
return;
|
|
268549
|
+
const idx = childIndex(path2);
|
|
268550
|
+
const parent = getNodeAtPath(doc, pp);
|
|
268551
|
+
if (!parent?.children)
|
|
268552
|
+
return;
|
|
268553
|
+
const element3 = parent.children[idx];
|
|
268554
|
+
const repeater = {
|
|
268555
|
+
$prototype: "Array",
|
|
268556
|
+
items: config.items,
|
|
268557
|
+
map: element3
|
|
268558
|
+
};
|
|
268559
|
+
if (config.filter)
|
|
268560
|
+
repeater.filter = config.filter;
|
|
268561
|
+
if (config.sort)
|
|
268562
|
+
repeater.sort = config.sort;
|
|
268563
|
+
parent.children[idx] = {
|
|
268564
|
+
tagName: "div",
|
|
268565
|
+
children: repeater
|
|
268566
|
+
};
|
|
268567
|
+
});
|
|
268568
|
+
}
|
|
268569
|
+
function promptRepeaterConfig(defs) {
|
|
268570
|
+
const arrayDefs = Object.entries(defs).filter(([, d2]) => d2?.type === "array" || Array.isArray(d2?.default) || d2?.$prototype === "Array");
|
|
268571
|
+
const fnDefs = Object.entries(defs).filter(([, d2]) => defCategory(d2) === "function");
|
|
268572
|
+
let source = arrayDefs.length > 0 ? arrayDefs[0][0] : "__new__";
|
|
268573
|
+
let newDefName = "";
|
|
268574
|
+
let filterDef = "";
|
|
268575
|
+
let sortDef = "";
|
|
268576
|
+
let error = "";
|
|
268577
|
+
return showDialog((done) => {
|
|
268578
|
+
function confirm() {
|
|
268579
|
+
if (source === "__new__") {
|
|
268580
|
+
const name = newDefName.trim();
|
|
268581
|
+
if (!name) {
|
|
268582
|
+
error = "Enter a name for the new state definition.";
|
|
268583
|
+
rerender();
|
|
268584
|
+
return;
|
|
268585
|
+
}
|
|
268586
|
+
if (defs[name]) {
|
|
268587
|
+
error = `"${name}" already exists.`;
|
|
268588
|
+
rerender();
|
|
268589
|
+
return;
|
|
268590
|
+
}
|
|
268591
|
+
if (!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)) {
|
|
268592
|
+
error = "Invalid identifier name.";
|
|
268593
|
+
rerender();
|
|
268594
|
+
return;
|
|
268595
|
+
}
|
|
268596
|
+
done({
|
|
268597
|
+
items: { $ref: `#/$defs/${name}` },
|
|
268598
|
+
filter: filterDef ? { $ref: `#/$defs/${filterDef}` } : undefined,
|
|
268599
|
+
sort: sortDef ? { $ref: `#/$defs/${sortDef}` } : undefined,
|
|
268600
|
+
newDef: { name }
|
|
268601
|
+
});
|
|
268602
|
+
} else {
|
|
268603
|
+
done({
|
|
268604
|
+
items: { $ref: `#/$defs/${source}` },
|
|
268605
|
+
filter: filterDef ? { $ref: `#/$defs/${filterDef}` } : undefined,
|
|
268606
|
+
sort: sortDef ? { $ref: `#/$defs/${sortDef}` } : undefined
|
|
268607
|
+
});
|
|
268608
|
+
}
|
|
268609
|
+
}
|
|
268610
|
+
function rerender() {
|
|
268611
|
+
const layer = document.getElementById("layer-dialog");
|
|
268612
|
+
const slot = layer?.lastElementChild;
|
|
268613
|
+
if (slot)
|
|
268614
|
+
render2(buildTpl(), slot);
|
|
268615
|
+
}
|
|
268616
|
+
function buildTpl() {
|
|
268617
|
+
return html3`
|
|
268618
|
+
<sp-dialog-wrapper
|
|
268619
|
+
open
|
|
268620
|
+
underlay
|
|
268621
|
+
headline="Repeat..."
|
|
268622
|
+
confirm-label="Create Repeater"
|
|
268623
|
+
cancel-label="Cancel"
|
|
268624
|
+
size="s"
|
|
268625
|
+
@confirm=${confirm}
|
|
268626
|
+
@cancel=${() => done(null)}
|
|
268627
|
+
@close=${() => done(null)}
|
|
268628
|
+
>
|
|
268629
|
+
<div style="display:flex;flex-direction:column;gap:12px">
|
|
268630
|
+
<label>
|
|
268631
|
+
<sp-field-label size="s">Items source</sp-field-label>
|
|
268632
|
+
<sp-picker
|
|
268633
|
+
label="Items source"
|
|
268634
|
+
size="s"
|
|
268635
|
+
.value=${source}
|
|
268636
|
+
@change=${(e) => {
|
|
268637
|
+
source = e.target.value;
|
|
268638
|
+
error = "";
|
|
268639
|
+
rerender();
|
|
268640
|
+
}}
|
|
268641
|
+
>
|
|
268642
|
+
${arrayDefs.map(([name]) => html3`<sp-menu-item value=${name}>${name}</sp-menu-item>`)}
|
|
268643
|
+
<sp-menu-divider></sp-menu-divider>
|
|
268644
|
+
<sp-menu-item value="__new__">Create new...</sp-menu-item>
|
|
268645
|
+
</sp-picker>
|
|
268646
|
+
</label>
|
|
268647
|
+
|
|
268648
|
+
${source === "__new__" ? html3`
|
|
268649
|
+
<label>
|
|
268650
|
+
<sp-field-label size="s">New definition name</sp-field-label>
|
|
268651
|
+
<sp-textfield
|
|
268652
|
+
size="s"
|
|
268653
|
+
placeholder="myItems"
|
|
268654
|
+
.value=${newDefName}
|
|
268655
|
+
?negative=${!!error}
|
|
268656
|
+
@input=${(e) => {
|
|
268657
|
+
newDefName = e.target.value || "";
|
|
268658
|
+
error = "";
|
|
268659
|
+
rerender();
|
|
268660
|
+
}}
|
|
268661
|
+
@keydown=${(e) => {
|
|
268662
|
+
if (e.key === "Enter")
|
|
268663
|
+
confirm();
|
|
268664
|
+
}}
|
|
268665
|
+
${ref2((el) => {
|
|
268666
|
+
if (el && source === "__new__")
|
|
268667
|
+
requestAnimationFrame(() => el.focus());
|
|
268668
|
+
})}
|
|
268669
|
+
>
|
|
268670
|
+
<sp-help-text slot="negative-help-text">${error}</sp-help-text>
|
|
268671
|
+
</sp-textfield>
|
|
268672
|
+
</label>
|
|
268673
|
+
` : nothing}
|
|
268674
|
+
${fnDefs.length > 0 ? html3`
|
|
268675
|
+
<label>
|
|
268676
|
+
<sp-field-label size="s">Filter (optional)</sp-field-label>
|
|
268677
|
+
<sp-picker
|
|
268678
|
+
label="Filter"
|
|
268679
|
+
size="s"
|
|
268680
|
+
.value=${filterDef}
|
|
268681
|
+
@change=${(e) => {
|
|
268682
|
+
filterDef = e.target.value;
|
|
268683
|
+
rerender();
|
|
268684
|
+
}}
|
|
268685
|
+
>
|
|
268686
|
+
<sp-menu-item value="">None</sp-menu-item>
|
|
268687
|
+
${fnDefs.map(([name]) => html3`<sp-menu-item value=${name}>${name}</sp-menu-item>`)}
|
|
268688
|
+
</sp-picker>
|
|
268689
|
+
</label>
|
|
268690
|
+
<label>
|
|
268691
|
+
<sp-field-label size="s">Sort (optional)</sp-field-label>
|
|
268692
|
+
<sp-picker
|
|
268693
|
+
label="Sort"
|
|
268694
|
+
size="s"
|
|
268695
|
+
.value=${sortDef}
|
|
268696
|
+
@change=${(e) => {
|
|
268697
|
+
sortDef = e.target.value;
|
|
268698
|
+
rerender();
|
|
268699
|
+
}}
|
|
268700
|
+
>
|
|
268701
|
+
<sp-menu-item value="">None</sp-menu-item>
|
|
268702
|
+
${fnDefs.map(([name]) => html3`<sp-menu-item value=${name}>${name}</sp-menu-item>`)}
|
|
268703
|
+
</sp-picker>
|
|
268704
|
+
</label>
|
|
268705
|
+
` : nothing}
|
|
268706
|
+
</div>
|
|
268707
|
+
</sp-dialog-wrapper>
|
|
268708
|
+
`;
|
|
268709
|
+
}
|
|
268710
|
+
return buildTpl();
|
|
268711
|
+
});
|
|
268712
|
+
}
|
|
268713
|
+
|
|
268714
|
+
// src/editor/context-menu.js
|
|
268226
268715
|
init_components();
|
|
268227
268716
|
|
|
268228
268717
|
// src/panels/layers-panel.js
|
|
@@ -268635,6 +269124,12 @@ function showContextMenu(e, path2, opts = {}) {
|
|
|
268635
269124
|
label: "Wrap in Div",
|
|
268636
269125
|
action: () => transactDoc(activeTab.value, (t) => mutateWrapNode(t, path2))
|
|
268637
269126
|
});
|
|
269127
|
+
if (!(path2.length >= 2 && path2[path2.length - 2] === "children" && path2[path2.length - 1] === "map")) {
|
|
269128
|
+
items.push({
|
|
269129
|
+
label: "Repeat...",
|
|
269130
|
+
action: () => convertToRepeater()
|
|
269131
|
+
});
|
|
269132
|
+
}
|
|
268638
269133
|
items.push({
|
|
268639
269134
|
label: "Set Title",
|
|
268640
269135
|
action: () => {
|
|
@@ -268686,7 +269181,24 @@ function showContextMenu(e, path2, opts = {}) {
|
|
|
268686
269181
|
}
|
|
268687
269182
|
}
|
|
268688
269183
|
let { clientX: x, clientY: y } = e;
|
|
268689
|
-
_ctxHandle = renderPopover(html3`<sp-popover
|
|
269184
|
+
_ctxHandle = renderPopover(html3`<sp-popover
|
|
269185
|
+
open
|
|
269186
|
+
style="position:fixed;z-index:10000;left:${x}px;top:${y}px"
|
|
269187
|
+
${ref2((el) => {
|
|
269188
|
+
if (!el)
|
|
269189
|
+
return;
|
|
269190
|
+
requestAnimationFrame(() => {
|
|
269191
|
+
const popover = el;
|
|
269192
|
+
const menuRect = popover.getBoundingClientRect();
|
|
269193
|
+
if (x + menuRect.width > window.innerWidth)
|
|
269194
|
+
x = window.innerWidth - menuRect.width - 4;
|
|
269195
|
+
if (y + menuRect.height > window.innerHeight)
|
|
269196
|
+
y = window.innerHeight - menuRect.height - 4;
|
|
269197
|
+
popover.style.left = `${x}px`;
|
|
269198
|
+
popover.style.top = `${y}px`;
|
|
269199
|
+
});
|
|
269200
|
+
})}
|
|
269201
|
+
>
|
|
268690
269202
|
<sp-menu>
|
|
268691
269203
|
${items.map((item) => item.label === "—" ? html3`<sp-menu-divider></sp-menu-divider>` : html3`<sp-menu-item
|
|
268692
269204
|
style=${item.danger ? "color: var(--danger)" : ""}
|
|
@@ -268703,18 +269215,6 @@ function showContextMenu(e, path2, opts = {}) {
|
|
|
268703
269215
|
_ctxHandle = null;
|
|
268704
269216
|
}
|
|
268705
269217
|
});
|
|
268706
|
-
requestAnimationFrame(() => {
|
|
268707
|
-
const popover = _ctxHandle?.host.querySelector("sp-popover");
|
|
268708
|
-
if (!popover)
|
|
268709
|
-
return;
|
|
268710
|
-
const menuRect = popover.getBoundingClientRect();
|
|
268711
|
-
if (x + menuRect.width > window.innerWidth)
|
|
268712
|
-
x = window.innerWidth - menuRect.width - 4;
|
|
268713
|
-
if (y + menuRect.height > window.innerHeight)
|
|
268714
|
-
y = window.innerHeight - menuRect.height - 4;
|
|
268715
|
-
popover.style.left = `${x}px`;
|
|
268716
|
-
popover.style.top = `${y}px`;
|
|
268717
|
-
});
|
|
268718
269218
|
}
|
|
268719
269219
|
|
|
268720
269220
|
// src/editor/insertion-helper.js
|
|
@@ -269929,6 +270429,7 @@ function renderOverlays() {
|
|
|
269929
270429
|
// src/files/files.js
|
|
269930
270430
|
init_lit_html();
|
|
269931
270431
|
init_class_map();
|
|
270432
|
+
init_ref();
|
|
269932
270433
|
init_store();
|
|
269933
270434
|
init_platform3();
|
|
269934
270435
|
init_components();
|
|
@@ -270250,6 +270751,144 @@ function setupTreeKeyboard(tree) {
|
|
|
270250
270751
|
if (first2)
|
|
270251
270752
|
first2.setAttribute("tabindex", "0");
|
|
270252
270753
|
}
|
|
270754
|
+
var _fileTreeDndCleanups = [];
|
|
270755
|
+
function registerFileTreeDnD({ renderLeftPanel }) {
|
|
270756
|
+
for (const fn of _fileTreeDndCleanups)
|
|
270757
|
+
fn();
|
|
270758
|
+
_fileTreeDndCleanups = [];
|
|
270759
|
+
requestAnimationFrame(() => {
|
|
270760
|
+
const tree = document.querySelector(".file-tree");
|
|
270761
|
+
if (!tree)
|
|
270762
|
+
return;
|
|
270763
|
+
const items = tree.querySelectorAll(".file-tree-item");
|
|
270764
|
+
items.forEach((row) => {
|
|
270765
|
+
const path2 = row.dataset.path;
|
|
270766
|
+
const type = row.dataset.type;
|
|
270767
|
+
if (!path2)
|
|
270768
|
+
return;
|
|
270769
|
+
const cleanups = [
|
|
270770
|
+
draggable({
|
|
270771
|
+
element: row,
|
|
270772
|
+
getInitialData() {
|
|
270773
|
+
return { type: "file-tree", path: path2, entryType: type };
|
|
270774
|
+
},
|
|
270775
|
+
onDragStart() {
|
|
270776
|
+
row.classList.add("dragging");
|
|
270777
|
+
},
|
|
270778
|
+
onDrop() {
|
|
270779
|
+
row.classList.remove("dragging");
|
|
270780
|
+
}
|
|
270781
|
+
})
|
|
270782
|
+
];
|
|
270783
|
+
if (type === "directory") {
|
|
270784
|
+
cleanups.push(dropTargetForElements({
|
|
270785
|
+
element: row,
|
|
270786
|
+
canDrop({ source }) {
|
|
270787
|
+
if (source.data.type !== "file-tree")
|
|
270788
|
+
return false;
|
|
270789
|
+
const srcPath = source.data.path;
|
|
270790
|
+
if (srcPath === path2)
|
|
270791
|
+
return false;
|
|
270792
|
+
if (srcPath.startsWith(path2 + "/"))
|
|
270793
|
+
return false;
|
|
270794
|
+
const srcParent = parentDir(srcPath);
|
|
270795
|
+
if (srcParent === path2)
|
|
270796
|
+
return false;
|
|
270797
|
+
return true;
|
|
270798
|
+
},
|
|
270799
|
+
onDragEnter() {
|
|
270800
|
+
row.classList.add("drag-over");
|
|
270801
|
+
},
|
|
270802
|
+
onDrag() {
|
|
270803
|
+
if (!row.classList.contains("drag-over"))
|
|
270804
|
+
row.classList.add("drag-over");
|
|
270805
|
+
},
|
|
270806
|
+
onDragLeave() {
|
|
270807
|
+
row.classList.remove("drag-over");
|
|
270808
|
+
},
|
|
270809
|
+
onDrop() {
|
|
270810
|
+
row.classList.remove("drag-over");
|
|
270811
|
+
},
|
|
270812
|
+
getData() {
|
|
270813
|
+
return { type: "file-tree-target", targetDir: path2 };
|
|
270814
|
+
}
|
|
270815
|
+
}));
|
|
270816
|
+
}
|
|
270817
|
+
_fileTreeDndCleanups.push(combine(...cleanups));
|
|
270818
|
+
});
|
|
270819
|
+
const rootCleanup = dropTargetForElements({
|
|
270820
|
+
element: tree,
|
|
270821
|
+
canDrop({ source }) {
|
|
270822
|
+
if (source.data.type !== "file-tree")
|
|
270823
|
+
return false;
|
|
270824
|
+
const srcPath = source.data.path;
|
|
270825
|
+
return parentDir(srcPath) !== ".";
|
|
270826
|
+
},
|
|
270827
|
+
onDragEnter() {
|
|
270828
|
+
tree.classList.add("drag-over-root");
|
|
270829
|
+
},
|
|
270830
|
+
onDragLeave() {
|
|
270831
|
+
tree.classList.remove("drag-over-root");
|
|
270832
|
+
},
|
|
270833
|
+
onDrop() {
|
|
270834
|
+
tree.classList.remove("drag-over-root");
|
|
270835
|
+
},
|
|
270836
|
+
getData() {
|
|
270837
|
+
return { type: "file-tree-target", targetDir: "." };
|
|
270838
|
+
}
|
|
270839
|
+
});
|
|
270840
|
+
_fileTreeDndCleanups.push(rootCleanup);
|
|
270841
|
+
const monitorCleanup = monitorForElements({
|
|
270842
|
+
onDrop({ source, location: location3 }) {
|
|
270843
|
+
const target = location3.current.dropTargets[0];
|
|
270844
|
+
if (!target)
|
|
270845
|
+
return;
|
|
270846
|
+
if (source.data.type !== "file-tree")
|
|
270847
|
+
return;
|
|
270848
|
+
if (target.data.type !== "file-tree-target")
|
|
270849
|
+
return;
|
|
270850
|
+
const srcPath = source.data.path;
|
|
270851
|
+
const targetDirPath = target.data.targetDir;
|
|
270852
|
+
const fileName = srcPath.split("/").pop();
|
|
270853
|
+
const newPath = targetDirPath === "." ? fileName : `${targetDirPath}/${fileName}`;
|
|
270854
|
+
if (newPath === srcPath)
|
|
270855
|
+
return;
|
|
270856
|
+
moveFileEntry(srcPath, newPath, renderLeftPanel);
|
|
270857
|
+
}
|
|
270858
|
+
});
|
|
270859
|
+
_fileTreeDndCleanups.push(monitorCleanup);
|
|
270860
|
+
});
|
|
270861
|
+
}
|
|
270862
|
+
async function moveFileEntry(oldPath, newPath, renderLeftPanel) {
|
|
270863
|
+
const platform3 = getPlatform();
|
|
270864
|
+
try {
|
|
270865
|
+
await platform3.renameFile(oldPath, newPath);
|
|
270866
|
+
for (const [id] of workspace.tabs.entries()) {
|
|
270867
|
+
if (id === oldPath) {
|
|
270868
|
+
renameTab(oldPath, newPath, newPath);
|
|
270869
|
+
} else if (id.startsWith(oldPath + "/")) {
|
|
270870
|
+
const newTabPath = newPath + id.slice(oldPath.length);
|
|
270871
|
+
renameTab(id, newTabPath, newTabPath);
|
|
270872
|
+
}
|
|
270873
|
+
}
|
|
270874
|
+
const oldParent = parentDir(oldPath);
|
|
270875
|
+
const newParent = parentDir(newPath);
|
|
270876
|
+
await loadDirectory(oldParent);
|
|
270877
|
+
if (newParent !== oldParent)
|
|
270878
|
+
await loadDirectory(newParent);
|
|
270879
|
+
if (newParent !== ".")
|
|
270880
|
+
requireProjectState().expanded.add(newParent);
|
|
270881
|
+
renderLeftPanel();
|
|
270882
|
+
statusMessage(`Moved to ${newPath}`);
|
|
270883
|
+
} catch (e) {
|
|
270884
|
+
statusMessage(`Error: ${e.message}`);
|
|
270885
|
+
}
|
|
270886
|
+
}
|
|
270887
|
+
function parentDir(path2) {
|
|
270888
|
+
const normalized = path2.replaceAll("\\", "/");
|
|
270889
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
270890
|
+
return lastSlash === -1 ? "." : normalized.substring(0, lastSlash);
|
|
270891
|
+
}
|
|
270253
270892
|
var _fileCtxHandle = null;
|
|
270254
270893
|
function dismissFileContextMenu() {
|
|
270255
270894
|
if (_fileCtxHandle) {
|
|
@@ -270279,7 +270918,24 @@ function showFileContextMenu(e, entry, ctx) {
|
|
|
270279
270918
|
danger: true
|
|
270280
270919
|
});
|
|
270281
270920
|
let { clientX: x, clientY: y } = e;
|
|
270282
|
-
_fileCtxHandle = renderPopover(html3`<sp-popover
|
|
270921
|
+
_fileCtxHandle = renderPopover(html3`<sp-popover
|
|
270922
|
+
open
|
|
270923
|
+
style="position:fixed;z-index:10000;left:${x}px;top:${y}px"
|
|
270924
|
+
${ref2((el) => {
|
|
270925
|
+
if (!el)
|
|
270926
|
+
return;
|
|
270927
|
+
requestAnimationFrame(() => {
|
|
270928
|
+
const popover = el;
|
|
270929
|
+
const menuRect = popover.getBoundingClientRect();
|
|
270930
|
+
if (x + menuRect.width > window.innerWidth)
|
|
270931
|
+
x = window.innerWidth - menuRect.width - 4;
|
|
270932
|
+
if (y + menuRect.height > window.innerHeight)
|
|
270933
|
+
y = window.innerHeight - menuRect.height - 4;
|
|
270934
|
+
popover.style.left = `${x}px`;
|
|
270935
|
+
popover.style.top = `${y}px`;
|
|
270936
|
+
});
|
|
270937
|
+
})}
|
|
270938
|
+
>
|
|
270283
270939
|
<sp-menu>
|
|
270284
270940
|
${items.map((item) => item.label === "—" ? html3`<sp-menu-divider></sp-menu-divider>` : html3`<sp-menu-item
|
|
270285
270941
|
style=${item.danger ? "color: var(--danger)" : ""}
|
|
@@ -270296,18 +270952,6 @@ function showFileContextMenu(e, entry, ctx) {
|
|
|
270296
270952
|
_fileCtxHandle = null;
|
|
270297
270953
|
}
|
|
270298
270954
|
});
|
|
270299
|
-
requestAnimationFrame(() => {
|
|
270300
|
-
const popover = _fileCtxHandle?.host.querySelector("sp-popover");
|
|
270301
|
-
if (!popover)
|
|
270302
|
-
return;
|
|
270303
|
-
const menuRect = popover.getBoundingClientRect();
|
|
270304
|
-
if (x + menuRect.width > window.innerWidth)
|
|
270305
|
-
x = window.innerWidth - menuRect.width - 4;
|
|
270306
|
-
if (y + menuRect.height > window.innerHeight)
|
|
270307
|
-
y = window.innerHeight - menuRect.height - 4;
|
|
270308
|
-
popover.style.left = `${x}px`;
|
|
270309
|
-
popover.style.top = `${y}px`;
|
|
270310
|
-
});
|
|
270311
270955
|
}
|
|
270312
270956
|
async function createNewFile(dirPath = ".", renderLeftPanel) {
|
|
270313
270957
|
const name = prompt("File name:", "untitled.json");
|
|
@@ -270329,20 +270973,70 @@ title: Untitled
|
|
|
270329
270973
|
statusMessage(`Error: ${e.message}`);
|
|
270330
270974
|
}
|
|
270331
270975
|
}
|
|
270976
|
+
function showRenameFileDialog(currentName) {
|
|
270977
|
+
let value2 = currentName;
|
|
270978
|
+
return showDialog((done) => {
|
|
270979
|
+
function confirm() {
|
|
270980
|
+
const trimmed = value2.trim();
|
|
270981
|
+
if (!trimmed)
|
|
270982
|
+
return;
|
|
270983
|
+
done(trimmed);
|
|
270984
|
+
}
|
|
270985
|
+
const tpl = html3`
|
|
270986
|
+
<sp-dialog-wrapper
|
|
270987
|
+
open
|
|
270988
|
+
underlay
|
|
270989
|
+
headline="Rename"
|
|
270990
|
+
confirm-label="Rename"
|
|
270991
|
+
cancel-label="Cancel"
|
|
270992
|
+
size="s"
|
|
270993
|
+
@confirm=${confirm}
|
|
270994
|
+
@cancel=${() => done(null)}
|
|
270995
|
+
@close=${() => done(null)}
|
|
270996
|
+
>
|
|
270997
|
+
<sp-textfield
|
|
270998
|
+
style="width:100%"
|
|
270999
|
+
value=${currentName}
|
|
271000
|
+
@input=${(e) => {
|
|
271001
|
+
value2 = e.target.value || "";
|
|
271002
|
+
}}
|
|
271003
|
+
@keydown=${(e) => {
|
|
271004
|
+
if (e.key === "Enter")
|
|
271005
|
+
confirm();
|
|
271006
|
+
}}
|
|
271007
|
+
></sp-textfield>
|
|
271008
|
+
</sp-dialog-wrapper>
|
|
271009
|
+
`;
|
|
271010
|
+
requestAnimationFrame(() => {
|
|
271011
|
+
const layer = document.getElementById("layer-dialog");
|
|
271012
|
+
const tf = layer?.querySelector("sp-textfield");
|
|
271013
|
+
if (tf) {
|
|
271014
|
+
tf.focus();
|
|
271015
|
+
const input = tf.shadowRoot?.querySelector("input");
|
|
271016
|
+
if (input)
|
|
271017
|
+
input.select();
|
|
271018
|
+
}
|
|
271019
|
+
});
|
|
271020
|
+
return tpl;
|
|
271021
|
+
});
|
|
271022
|
+
}
|
|
270332
271023
|
async function renameFile(entry, renderLeftPanel) {
|
|
270333
|
-
const newName =
|
|
271024
|
+
const newName = await showRenameFileDialog(entry.name);
|
|
270334
271025
|
if (!newName || newName === entry.name)
|
|
270335
271026
|
return;
|
|
270336
271027
|
const entryPath = entry.path.replaceAll("\\", "/");
|
|
270337
|
-
const
|
|
270338
|
-
const newPath =
|
|
271028
|
+
const parentDir2 = entryPath.includes("/") ? entryPath.substring(0, entryPath.lastIndexOf("/")) : ".";
|
|
271029
|
+
const newPath = parentDir2 === "." ? newName : `${parentDir2}/${newName}`;
|
|
270339
271030
|
try {
|
|
270340
271031
|
const platform3 = getPlatform();
|
|
270341
271032
|
await platform3.renameFile(entry.path, newPath);
|
|
270342
|
-
await loadDirectory(
|
|
271033
|
+
await loadDirectory(parentDir2);
|
|
270343
271034
|
if (requireProjectState().selectedPath === entry.path) {
|
|
270344
271035
|
requireProjectState().selectedPath = newPath;
|
|
270345
271036
|
}
|
|
271037
|
+
if (workspace.tabs.has(entry.path)) {
|
|
271038
|
+
renameTab(entry.path, newPath, newPath);
|
|
271039
|
+
}
|
|
270346
271040
|
renderLeftPanel();
|
|
270347
271041
|
statusMessage(`Renamed to ${newName}`);
|
|
270348
271042
|
} catch (e) {
|
|
@@ -270350,14 +271044,18 @@ async function renameFile(entry, renderLeftPanel) {
|
|
|
270350
271044
|
}
|
|
270351
271045
|
}
|
|
270352
271046
|
async function deleteFile(entry, renderLeftPanel) {
|
|
270353
|
-
|
|
271047
|
+
const confirmed = await showConfirmDialog("Delete File", `Delete "${entry.name}"?`, {
|
|
271048
|
+
confirmLabel: "Delete",
|
|
271049
|
+
destructive: true
|
|
271050
|
+
});
|
|
271051
|
+
if (!confirmed)
|
|
270354
271052
|
return;
|
|
270355
271053
|
try {
|
|
270356
271054
|
const platform3 = getPlatform();
|
|
270357
271055
|
await platform3.deleteFile(entry.path);
|
|
270358
271056
|
const delPath = entry.path.replaceAll("\\", "/");
|
|
270359
|
-
const
|
|
270360
|
-
await loadDirectory(
|
|
271057
|
+
const parentDir2 = delPath.includes("/") ? delPath.substring(0, delPath.lastIndexOf("/")) : ".";
|
|
271058
|
+
await loadDirectory(parentDir2);
|
|
270361
271059
|
if (requireProjectState().selectedPath === entry.path) {
|
|
270362
271060
|
requireProjectState().selectedPath = null;
|
|
270363
271061
|
}
|
|
@@ -270453,15 +271151,15 @@ function isComponentEnabled(comp, elements) {
|
|
|
270453
271151
|
return false;
|
|
270454
271152
|
}
|
|
270455
271153
|
function groupByPackage() {
|
|
270456
|
-
const
|
|
271154
|
+
const groups2 = new Map;
|
|
270457
271155
|
for (const comp of componentRegistry) {
|
|
270458
271156
|
if (comp.source !== "npm" || !comp.package || !comp.modulePath)
|
|
270459
271157
|
continue;
|
|
270460
|
-
if (!
|
|
270461
|
-
|
|
270462
|
-
|
|
271158
|
+
if (!groups2.has(comp.package))
|
|
271159
|
+
groups2.set(comp.package, []);
|
|
271160
|
+
groups2.get(comp.package)?.push(comp);
|
|
270463
271161
|
}
|
|
270464
|
-
return
|
|
271162
|
+
return groups2;
|
|
270465
271163
|
}
|
|
270466
271164
|
function renderImportsTemplate({
|
|
270467
271165
|
renderLeftPanel,
|
|
@@ -270553,7 +271251,11 @@ function renderSiteLevelImports(renderLeftPanel) {
|
|
|
270553
271251
|
size="xs"
|
|
270554
271252
|
title="Remove package"
|
|
270555
271253
|
@click=${async () => {
|
|
270556
|
-
|
|
271254
|
+
const confirmed = await showConfirmDialog("Remove Package", `Remove ${pkg}?`, {
|
|
271255
|
+
confirmLabel: "Remove",
|
|
271256
|
+
destructive: true
|
|
271257
|
+
});
|
|
271258
|
+
if (!confirmed)
|
|
270557
271259
|
return;
|
|
270558
271260
|
try {
|
|
270559
271261
|
const platform3 = getPlatform();
|
|
@@ -270856,11 +271558,17 @@ function findContentTypeSchema(documentPath, projectConfig) {
|
|
|
270856
271558
|
for (const [name, def3] of Object.entries(projectConfig.contentTypes)) {
|
|
270857
271559
|
if (!def3.source || !def3.schema)
|
|
270858
271560
|
continue;
|
|
270859
|
-
const src = def3.source.replace(/^\.\//, "");
|
|
270860
|
-
const
|
|
270861
|
-
|
|
270862
|
-
|
|
270863
|
-
|
|
271561
|
+
const src = def3.source.replace(/^\.\//, "").replace(/\/$/, "");
|
|
271562
|
+
const hasExt = src.includes(".") && !src.endsWith("/");
|
|
271563
|
+
if (hasExt) {
|
|
271564
|
+
if (documentPath === src || documentPath.endsWith("/" + src)) {
|
|
271565
|
+
return { name, schema: def3.schema };
|
|
271566
|
+
}
|
|
271567
|
+
} else {
|
|
271568
|
+
const ext = `.${def3.format || "md"}`;
|
|
271569
|
+
if (documentPath.startsWith(src + "/") && documentPath.endsWith(ext)) {
|
|
271570
|
+
return { name, schema: def3.schema };
|
|
271571
|
+
}
|
|
270864
271572
|
}
|
|
270865
271573
|
}
|
|
270866
271574
|
return null;
|
|
@@ -297298,6 +298006,7 @@ init_workspace2();
|
|
|
297298
298006
|
init_lit_html();
|
|
297299
298007
|
init_class_map();
|
|
297300
298008
|
init_live();
|
|
298009
|
+
init_ref();
|
|
297301
298010
|
init_platform3();
|
|
297302
298011
|
var _open = false;
|
|
297303
298012
|
var _query = "";
|
|
@@ -297314,11 +298023,6 @@ function openQuickSearch() {
|
|
|
297314
298023
|
_results = [];
|
|
297315
298024
|
_selectedIndex = 0;
|
|
297316
298025
|
renderOverlay();
|
|
297317
|
-
requestAnimationFrame(() => {
|
|
297318
|
-
const input = getContainer().querySelector(".quick-search-input");
|
|
297319
|
-
if (input)
|
|
297320
|
-
input.focus();
|
|
297321
|
-
});
|
|
297322
298026
|
}
|
|
297323
298027
|
function closeQuickSearch() {
|
|
297324
298028
|
_open = false;
|
|
@@ -297412,6 +298116,10 @@ function renderOverlay() {
|
|
|
297412
298116
|
.value=${live(_query)}
|
|
297413
298117
|
@input=${onInput}
|
|
297414
298118
|
@keydown=${onKeydown2}
|
|
298119
|
+
${ref2((el) => {
|
|
298120
|
+
if (el)
|
|
298121
|
+
requestAnimationFrame(() => el.focus());
|
|
298122
|
+
})}
|
|
297415
298123
|
/>
|
|
297416
298124
|
<div class="quick-search-results">
|
|
297417
298125
|
${items.length === 0 && _query.trim() ? html3`<div class="quick-search-empty">No results</div>` : nothing}
|
|
@@ -297544,10 +298252,13 @@ function initShortcuts(getContext) {
|
|
|
297544
298252
|
const tab2 = workspace.tabs.get(workspace.activeTabId);
|
|
297545
298253
|
if (tab2?.doc.dirty) {
|
|
297546
298254
|
const name = tab2.documentPath?.split("/").pop() || "Untitled";
|
|
297547
|
-
|
|
297548
|
-
|
|
298255
|
+
showConfirmDialog("Unsaved Changes", `"${name}" has unsaved changes. Close without saving?`, { confirmLabel: "Close", destructive: true }).then((confirmed) => {
|
|
298256
|
+
if (confirmed && workspace.activeTabId)
|
|
298257
|
+
closeTab(workspace.activeTabId);
|
|
298258
|
+
});
|
|
298259
|
+
} else {
|
|
298260
|
+
closeTab(workspace.activeTabId);
|
|
297549
298261
|
}
|
|
297550
|
-
closeTab(workspace.activeTabId);
|
|
297551
298262
|
}
|
|
297552
298263
|
break;
|
|
297553
298264
|
case "o":
|
|
@@ -298356,7 +299067,7 @@ function handleNewContentType(rerender) {
|
|
|
298356
299067
|
if (config.contentTypes[slug])
|
|
298357
299068
|
return;
|
|
298358
299069
|
config.contentTypes[slug] = {
|
|
298359
|
-
source: `./content/${slug}
|
|
299070
|
+
source: `./content/${slug}/`,
|
|
298360
299071
|
schema: { type: "object", properties: {}, required: [] }
|
|
298361
299072
|
};
|
|
298362
299073
|
selectedContentType = slug;
|
|
@@ -298680,20 +299391,20 @@ function renderCssVarsEditor(container) {
|
|
|
298680
299391
|
const config = projectState?.projectConfig || {};
|
|
298681
299392
|
const rootStyle = config.style || {};
|
|
298682
299393
|
const media = getEffectiveMedia(config.$media);
|
|
298683
|
-
const
|
|
299394
|
+
const groups2 = { color: [], font: [], size: [], other: [] };
|
|
298684
299395
|
for (const [k, v] of Object.entries(rootStyle)) {
|
|
298685
299396
|
if (!k.startsWith("--"))
|
|
298686
299397
|
continue;
|
|
298687
299398
|
if (typeof v !== "string" && typeof v !== "number")
|
|
298688
299399
|
continue;
|
|
298689
299400
|
if (k.startsWith("--color"))
|
|
298690
|
-
|
|
299401
|
+
groups2.color.push([k, v]);
|
|
298691
299402
|
else if (k.startsWith("--font"))
|
|
298692
|
-
|
|
299403
|
+
groups2.font.push([k, v]);
|
|
298693
299404
|
else if (k.startsWith("--size") || k.startsWith("--spacing") || k.startsWith("--radius"))
|
|
298694
|
-
|
|
299405
|
+
groups2.size.push([k, v]);
|
|
298695
299406
|
else
|
|
298696
|
-
|
|
299407
|
+
groups2.other.push([k, v]);
|
|
298697
299408
|
}
|
|
298698
299409
|
const mediaNames = media ? Object.keys(media).filter((m3) => m3 !== "--") : [];
|
|
298699
299410
|
const save = () => {
|
|
@@ -298720,10 +299431,10 @@ function renderCssVarsEditor(container) {
|
|
|
298720
299431
|
<div class="settings-section">
|
|
298721
299432
|
<h3 class="settings-section-title">CSS Variables</h3>
|
|
298722
299433
|
|
|
298723
|
-
${renderColorSection(
|
|
298724
|
-
${renderFontSection(
|
|
298725
|
-
${renderSizeSection(
|
|
298726
|
-
${
|
|
299434
|
+
${renderColorSection(groups2.color, updateVar, deleteVar, addVar)}
|
|
299435
|
+
${renderFontSection(groups2.font, updateVar, deleteVar, addVar)}
|
|
299436
|
+
${renderSizeSection(groups2.size, updateVar, deleteVar, addVar, rootStyle, mediaNames)}
|
|
299437
|
+
${groups2.other.length > 0 ? renderOtherSection(groups2.other, updateVar, deleteVar, addVar, rootStyle, mediaNames) : nothing}
|
|
298727
299438
|
</div>
|
|
298728
299439
|
`;
|
|
298729
299440
|
render2(tpl, container);
|
|
@@ -299287,6 +299998,7 @@ function renderGeneralSettings(container) {
|
|
|
299287
299998
|
// src/settings/settings-modal.js
|
|
299288
299999
|
var _handle = null;
|
|
299289
300000
|
var _activeSection = "general";
|
|
300001
|
+
var _contentEl = null;
|
|
299290
300002
|
var sections = [
|
|
299291
300003
|
{ key: "general", label: "General", icon: "sp-icon-properties" },
|
|
299292
300004
|
{ key: "head", label: "Head", icon: "sp-icon-file-single-web-page" },
|
|
@@ -299305,6 +300017,7 @@ function closeSettingsModal() {
|
|
|
299305
300017
|
return;
|
|
299306
300018
|
_handle.close();
|
|
299307
300019
|
_handle = null;
|
|
300020
|
+
_contentEl = null;
|
|
299308
300021
|
}
|
|
299309
300022
|
function renderModal() {
|
|
299310
300023
|
const onNavClick = (key) => {
|
|
@@ -299341,7 +300054,8 @@ function renderModal() {
|
|
|
299341
300054
|
<div
|
|
299342
300055
|
class="settings-modal-content"
|
|
299343
300056
|
${ref2((el) => {
|
|
299344
|
-
|
|
300057
|
+
_contentEl = el || null;
|
|
300058
|
+
if (_contentEl)
|
|
299345
300059
|
requestAnimationFrame(() => renderActiveSection());
|
|
299346
300060
|
})}
|
|
299347
300061
|
></div>
|
|
@@ -299355,26 +300069,23 @@ function renderModal() {
|
|
|
299355
300069
|
}
|
|
299356
300070
|
}
|
|
299357
300071
|
function renderActiveSection() {
|
|
299358
|
-
if (!_handle)
|
|
299359
|
-
return;
|
|
299360
|
-
const container = _handle.host.querySelector(".settings-modal-content");
|
|
299361
|
-
if (!container)
|
|
300072
|
+
if (!_handle || !_contentEl)
|
|
299362
300073
|
return;
|
|
299363
300074
|
switch (_activeSection) {
|
|
299364
300075
|
case "general":
|
|
299365
|
-
renderGeneralSettings(
|
|
300076
|
+
renderGeneralSettings(_contentEl);
|
|
299366
300077
|
break;
|
|
299367
300078
|
case "head":
|
|
299368
|
-
renderHeadEditor(
|
|
300079
|
+
renderHeadEditor(_contentEl);
|
|
299369
300080
|
break;
|
|
299370
300081
|
case "cssVars":
|
|
299371
|
-
renderCssVarsEditor(
|
|
300082
|
+
renderCssVarsEditor(_contentEl);
|
|
299372
300083
|
break;
|
|
299373
300084
|
case "definitions":
|
|
299374
|
-
renderDefsEditor(
|
|
300085
|
+
renderDefsEditor(_contentEl);
|
|
299375
300086
|
break;
|
|
299376
300087
|
case "contentTypes":
|
|
299377
|
-
renderContentTypesEditor(
|
|
300088
|
+
renderContentTypesEditor(_contentEl);
|
|
299378
300089
|
break;
|
|
299379
300090
|
}
|
|
299380
300091
|
}
|
|
@@ -299386,11 +300097,11 @@ function mount4() {
|
|
|
299386
300097
|
_scope3.run(() => {
|
|
299387
300098
|
effect(() => {
|
|
299388
300099
|
const tab = activeTab.value;
|
|
299389
|
-
if (
|
|
299390
|
-
|
|
299391
|
-
|
|
299392
|
-
|
|
299393
|
-
|
|
300100
|
+
if (tab) {
|
|
300101
|
+
const gs = tab.session.ui.gitStatus;
|
|
300102
|
+
if (!gs && !tab.session.ui.gitLoading) {
|
|
300103
|
+
refreshGitStatus();
|
|
300104
|
+
}
|
|
299394
300105
|
}
|
|
299395
300106
|
renderActivityBar();
|
|
299396
300107
|
});
|
|
@@ -299437,8 +300148,6 @@ function tabIcon(tag5, size4) {
|
|
|
299437
300148
|
}
|
|
299438
300149
|
function renderActivityBar() {
|
|
299439
300150
|
const tab = activeTab.value;
|
|
299440
|
-
if (!tab)
|
|
299441
|
-
return;
|
|
299442
300151
|
const leftTab = view.leftTab;
|
|
299443
300152
|
const gitFileCount = tab?.session.ui.gitStatus?.files?.length || 0;
|
|
299444
300153
|
const tabs = [
|
|
@@ -299502,6 +300211,7 @@ init_platform3();
|
|
|
299502
300211
|
|
|
299503
300212
|
// src/browse/browse-modal.js
|
|
299504
300213
|
init_lit_html();
|
|
300214
|
+
init_ref();
|
|
299505
300215
|
|
|
299506
300216
|
// src/browse/browse.js
|
|
299507
300217
|
init_lit_html();
|
|
@@ -299612,7 +300322,7 @@ function contentTypeFor(filePath) {
|
|
|
299612
300322
|
const d3 = def3;
|
|
299613
300323
|
if (!d3.source)
|
|
299614
300324
|
continue;
|
|
299615
|
-
const prefix = d3.source.replace(/^\.\//, "").
|
|
300325
|
+
const prefix = d3.source.replace(/^\.\//, "").replace(/\/$/, "");
|
|
299616
300326
|
if (filePath.startsWith(prefix + "/") || filePath === prefix) {
|
|
299617
300327
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
299618
300328
|
}
|
|
@@ -299672,12 +300382,12 @@ function getContentTypeTypes() {
|
|
|
299672
300382
|
return [];
|
|
299673
300383
|
return Object.entries(config.contentTypes).map(([name, def3]) => {
|
|
299674
300384
|
const d3 = def3;
|
|
299675
|
-
const dir = d3.source ? d3.source.replace(/^\.\//, "").
|
|
300385
|
+
const dir = d3.source ? d3.source.replace(/^\.\//, "").replace(/\/$/, "") : name;
|
|
299676
300386
|
return {
|
|
299677
300387
|
key: `contentType:${name}`,
|
|
299678
300388
|
label: name.charAt(0).toUpperCase() + name.slice(1),
|
|
299679
300389
|
dir,
|
|
299680
|
-
ext: "
|
|
300390
|
+
ext: `.${d3.format || "md"}`,
|
|
299681
300391
|
contentTypeName: name
|
|
299682
300392
|
};
|
|
299683
300393
|
});
|
|
@@ -299761,7 +300471,24 @@ function showBrowseContextMenu(e20, file, container, ctx) {
|
|
|
299761
300471
|
}
|
|
299762
300472
|
];
|
|
299763
300473
|
let { clientX: x, clientY: y } = e20;
|
|
299764
|
-
_browseCtxHandle = renderPopover(html3`<sp-popover
|
|
300474
|
+
_browseCtxHandle = renderPopover(html3`<sp-popover
|
|
300475
|
+
open
|
|
300476
|
+
style="position:fixed;left:${x}px;top:${y}px"
|
|
300477
|
+
${ref2((el) => {
|
|
300478
|
+
if (!el)
|
|
300479
|
+
return;
|
|
300480
|
+
requestAnimationFrame(() => {
|
|
300481
|
+
const popover = el;
|
|
300482
|
+
const menuRect = popover.getBoundingClientRect();
|
|
300483
|
+
if (x + menuRect.width > window.innerWidth)
|
|
300484
|
+
x = window.innerWidth - menuRect.width - 4;
|
|
300485
|
+
if (y + menuRect.height > window.innerHeight)
|
|
300486
|
+
y = window.innerHeight - menuRect.height - 4;
|
|
300487
|
+
popover.style.left = `${x}px`;
|
|
300488
|
+
popover.style.top = `${y}px`;
|
|
300489
|
+
});
|
|
300490
|
+
})}
|
|
300491
|
+
>
|
|
299765
300492
|
<sp-menu>
|
|
299766
300493
|
${items.map((item) => item.label === "—" ? html3`<sp-menu-divider></sp-menu-divider>` : html3`<sp-menu-item
|
|
299767
300494
|
style=${item.danger ? "color: var(--danger)" : ""}
|
|
@@ -299779,26 +300506,14 @@ function showBrowseContextMenu(e20, file, container, ctx) {
|
|
|
299779
300506
|
},
|
|
299780
300507
|
layer: "dialog"
|
|
299781
300508
|
});
|
|
299782
|
-
requestAnimationFrame(() => {
|
|
299783
|
-
const popover = _browseCtxHandle?.host.querySelector("sp-popover");
|
|
299784
|
-
if (!popover)
|
|
299785
|
-
return;
|
|
299786
|
-
const menuRect = popover.getBoundingClientRect();
|
|
299787
|
-
if (x + menuRect.width > window.innerWidth)
|
|
299788
|
-
x = window.innerWidth - menuRect.width - 4;
|
|
299789
|
-
if (y + menuRect.height > window.innerHeight)
|
|
299790
|
-
y = window.innerHeight - menuRect.height - 4;
|
|
299791
|
-
popover.style.left = `${x}px`;
|
|
299792
|
-
popover.style.top = `${y}px`;
|
|
299793
|
-
});
|
|
299794
300509
|
}
|
|
299795
300510
|
async function browseRenameFile(file, container, ctx) {
|
|
299796
300511
|
const newName = await showRenameDialog(file.name);
|
|
299797
300512
|
if (!newName || newName === file.name)
|
|
299798
300513
|
return;
|
|
299799
300514
|
const filePath = file.path.replaceAll("\\", "/");
|
|
299800
|
-
const
|
|
299801
|
-
const newPath =
|
|
300515
|
+
const parentDir2 = filePath.includes("/") ? filePath.substring(0, filePath.lastIndexOf("/")) : ".";
|
|
300516
|
+
const newPath = parentDir2 === "." ? newName : `${parentDir2}/${newName}`;
|
|
299802
300517
|
try {
|
|
299803
300518
|
const platform4 = getPlatform();
|
|
299804
300519
|
await platform4.renameFile(file.path, newPath);
|
|
@@ -299811,11 +300526,11 @@ async function browseRenameFile(file, container, ctx) {
|
|
|
299811
300526
|
}
|
|
299812
300527
|
async function browseDuplicateFile(file, container, ctx) {
|
|
299813
300528
|
const filePath = file.path.replaceAll("\\", "/");
|
|
299814
|
-
const
|
|
300529
|
+
const parentDir2 = filePath.includes("/") ? filePath.substring(0, filePath.lastIndexOf("/")) : ".";
|
|
299815
300530
|
const baseName = file.name.replace(/(\.[^.]+)$/, "");
|
|
299816
300531
|
const ext = file.ext || "";
|
|
299817
300532
|
const copyName = `${baseName}-copy${ext}`;
|
|
299818
|
-
const copyPath =
|
|
300533
|
+
const copyPath = parentDir2 === "." ? copyName : `${parentDir2}/${copyName}`;
|
|
299819
300534
|
try {
|
|
299820
300535
|
const platform4 = getPlatform();
|
|
299821
300536
|
const content3 = await platform4.readFile(file.path);
|
|
@@ -299844,7 +300559,7 @@ async function browseDeleteFile(file, container, ctx) {
|
|
|
299844
300559
|
function showRenameDialog(currentName) {
|
|
299845
300560
|
let value2 = currentName;
|
|
299846
300561
|
return showDialog((done) => {
|
|
299847
|
-
function
|
|
300562
|
+
function confirm() {
|
|
299848
300563
|
const trimmed = value2.trim();
|
|
299849
300564
|
if (!trimmed)
|
|
299850
300565
|
return;
|
|
@@ -299858,7 +300573,7 @@ function showRenameDialog(currentName) {
|
|
|
299858
300573
|
confirm-label="Rename"
|
|
299859
300574
|
cancel-label="Cancel"
|
|
299860
300575
|
size="s"
|
|
299861
|
-
@confirm=${
|
|
300576
|
+
@confirm=${confirm}
|
|
299862
300577
|
@cancel=${() => done(null)}
|
|
299863
300578
|
@close=${() => done(null)}
|
|
299864
300579
|
>
|
|
@@ -299870,7 +300585,7 @@ function showRenameDialog(currentName) {
|
|
|
299870
300585
|
}}
|
|
299871
300586
|
@keydown=${(e20) => {
|
|
299872
300587
|
if (e20.key === "Enter")
|
|
299873
|
-
|
|
300588
|
+
confirm();
|
|
299874
300589
|
}}
|
|
299875
300590
|
></sp-textfield>
|
|
299876
300591
|
</sp-dialog-wrapper>
|
|
@@ -300149,21 +300864,24 @@ function openBrowseModal() {
|
|
|
300149
300864
|
<sp-icon-close slot="icon"></sp-icon-close>
|
|
300150
300865
|
</sp-action-button>
|
|
300151
300866
|
</div>
|
|
300152
|
-
<div
|
|
300867
|
+
<div
|
|
300868
|
+
class="browse-modal-content"
|
|
300869
|
+
${ref2((el) => {
|
|
300870
|
+
if (el) {
|
|
300871
|
+
requestAnimationFrame(() => {
|
|
300872
|
+
renderBrowse(el, {
|
|
300873
|
+
openFile: (path2) => {
|
|
300874
|
+
closeBrowseModal();
|
|
300875
|
+
openFileInTab(path2);
|
|
300876
|
+
}
|
|
300877
|
+
});
|
|
300878
|
+
});
|
|
300879
|
+
}
|
|
300880
|
+
})}
|
|
300881
|
+
></div>
|
|
300153
300882
|
</div>
|
|
300154
300883
|
`;
|
|
300155
300884
|
_handle2 = openModal(tpl);
|
|
300156
|
-
requestAnimationFrame(() => {
|
|
300157
|
-
const container = _handle2?.host.querySelector(".browse-modal-content");
|
|
300158
|
-
if (container) {
|
|
300159
|
-
renderBrowse(container, {
|
|
300160
|
-
openFile: (path2) => {
|
|
300161
|
-
closeBrowseModal();
|
|
300162
|
-
openFileInTab(path2);
|
|
300163
|
-
}
|
|
300164
|
-
});
|
|
300165
|
-
}
|
|
300166
|
-
});
|
|
300167
300885
|
}
|
|
300168
300886
|
function closeBrowseModal() {
|
|
300169
300887
|
if (!_handle2)
|
|
@@ -303948,10 +304666,15 @@ function bindableFieldRow(label4, type2, rawValue, onChange, filterFn = null, ex
|
|
|
303948
304666
|
debounce = setTimeout(() => onChange(e20.target.value), 400);
|
|
303949
304667
|
};
|
|
303950
304668
|
const staticVal = isBound ? "" : rawValue ?? "";
|
|
303951
|
-
const staticTpl = type2 === "textarea" ? html3`<sp-textfield
|
|
304669
|
+
const staticTpl = type2 === "textarea" ? html3`<sp-textfield
|
|
304670
|
+
multiline
|
|
304671
|
+
size="s"
|
|
304672
|
+
.value=${live(staticVal)}
|
|
304673
|
+
@input=${onInput2}
|
|
304674
|
+
></sp-textfield>` : type2 === "checkbox" ? html3`<sp-checkbox
|
|
303952
304675
|
?checked=${!!staticVal}
|
|
303953
304676
|
@change=${(e20) => onChange(e20.target.checked)}
|
|
303954
|
-
></sp-checkbox>` : html3`<sp-textfield size="s" value=${staticVal} @input=${onInput2}></sp-textfield>`;
|
|
304677
|
+
></sp-checkbox>` : html3`<sp-textfield size="s" .value=${live(staticVal)} @input=${onInput2}></sp-textfield>`;
|
|
303955
304678
|
const boundTpl = html3`
|
|
303956
304679
|
<sp-picker
|
|
303957
304680
|
size="s"
|
|
@@ -304017,7 +304740,7 @@ function kvRow(key, value2, onChange, onDelete, datalistId = null) {
|
|
|
304017
304740
|
<sp-textfield
|
|
304018
304741
|
size="s"
|
|
304019
304742
|
class="kv-key"
|
|
304020
|
-
value=${key}
|
|
304743
|
+
.value=${live(key)}
|
|
304021
304744
|
@input=${(e20) => {
|
|
304022
304745
|
currentKey = e20.target.value;
|
|
304023
304746
|
commit();
|
|
@@ -304031,7 +304754,7 @@ function kvRow(key, value2, onChange, onDelete, datalistId = null) {
|
|
|
304031
304754
|
<sp-textfield
|
|
304032
304755
|
size="s"
|
|
304033
304756
|
class="kv-val"
|
|
304034
|
-
value=${value2}
|
|
304757
|
+
.value=${live(value2)}
|
|
304035
304758
|
placeholder=${placeholder}
|
|
304036
304759
|
@input=${(e20) => {
|
|
304037
304760
|
currentVal = e20.target.value;
|
|
@@ -304088,7 +304811,7 @@ function renderSwitchFieldsTemplate(node2, path2, mapSignals) {
|
|
|
304088
304811
|
<div class="field-row" style="display:flex;align-items:center;gap:4px;margin-bottom:3px">
|
|
304089
304812
|
<input
|
|
304090
304813
|
class="field-input"
|
|
304091
|
-
value=${caseName}
|
|
304814
|
+
.value=${live(caseName)}
|
|
304092
304815
|
style="flex:1"
|
|
304093
304816
|
@input=${(e20) => {
|
|
304094
304817
|
clearTimeout(debounce);
|
|
@@ -304198,7 +304921,7 @@ function renderComponentPropsFieldsTemplate(node2, path2, mapSignals, navigateTo
|
|
|
304198
304921
|
widgetTpl = html3`<sp-textfield
|
|
304199
304922
|
size="s"
|
|
304200
304923
|
placeholder="YYYY-MM-DD"
|
|
304201
|
-
value=${staticVal}
|
|
304924
|
+
.value=${live(staticVal)}
|
|
304202
304925
|
@input=${(e20) => {
|
|
304203
304926
|
clearTimeout(debounce);
|
|
304204
304927
|
debounce = setTimeout(() => onChange(e20.target.value), 400);
|
|
@@ -304213,7 +304936,7 @@ function renderComponentPropsFieldsTemplate(node2, path2, mapSignals, navigateTo
|
|
|
304213
304936
|
} else if (parsed.kind === "number") {
|
|
304214
304937
|
widgetTpl = html3`<sp-number-field
|
|
304215
304938
|
size="s"
|
|
304216
|
-
value=${staticVal}
|
|
304939
|
+
.value=${live(staticVal)}
|
|
304217
304940
|
@input=${(e20) => {
|
|
304218
304941
|
clearTimeout(debounce);
|
|
304219
304942
|
debounce = setTimeout(() => onChange(e20.target.value), 400);
|
|
@@ -304231,7 +304954,7 @@ function renderComponentPropsFieldsTemplate(node2, path2, mapSignals, navigateTo
|
|
|
304231
304954
|
} else {
|
|
304232
304955
|
widgetTpl = html3`<sp-textfield
|
|
304233
304956
|
size="s"
|
|
304234
|
-
value=${staticVal}
|
|
304957
|
+
.value=${live(staticVal)}
|
|
304235
304958
|
@input=${(e20) => {
|
|
304236
304959
|
clearTimeout(debounce);
|
|
304237
304960
|
debounce = setTimeout(() => onChange(e20.target.value), 400);
|
|
@@ -304294,7 +305017,7 @@ function renderMediaFieldsTemplate(node2) {
|
|
|
304294
305017
|
class="field-input"
|
|
304295
305018
|
style="width:70px;flex:none"
|
|
304296
305019
|
placeholder="320px"
|
|
304297
|
-
value=${media["--"] || ""}
|
|
305020
|
+
.value=${live(media["--"] || "")}
|
|
304298
305021
|
@input=${(e20) => {
|
|
304299
305022
|
clearTimeout(baseDebounce);
|
|
304300
305023
|
baseDebounce = setTimeout(() => {
|
|
@@ -304385,7 +305108,7 @@ function mediaBreakpointRowTemplate(name, query3) {
|
|
|
304385
305108
|
<div style="display:flex;align-items:center;gap:4px;margin-bottom:2px">
|
|
304386
305109
|
<input
|
|
304387
305110
|
class="field-input"
|
|
304388
|
-
value=${mediaDisplayName(name)}
|
|
305111
|
+
.value=${live(mediaDisplayName(name))}
|
|
304389
305112
|
style="flex:1;font-weight:600;font-size:12px"
|
|
304390
305113
|
@input=${(e20) => {
|
|
304391
305114
|
const newKey = friendlyNameToMedia(e20.target.value);
|
|
@@ -304419,7 +305142,7 @@ function mediaBreakpointRowTemplate(name, query3) {
|
|
|
304419
305142
|
<div style="display:flex;gap:4px;align-items:center">
|
|
304420
305143
|
<input
|
|
304421
305144
|
class="field-input bp-query-input"
|
|
304422
|
-
value=${query3}
|
|
305145
|
+
.value=${live(query3)}
|
|
304423
305146
|
style="flex:1"
|
|
304424
305147
|
@input=${(e20) => {
|
|
304425
305148
|
clearTimeout(debounceTimer);
|
|
@@ -304903,6 +305626,7 @@ function renderPropertiesPanelTemplate(ctx) {
|
|
|
304903
305626
|
|
|
304904
305627
|
// src/panels/ai-panel.js
|
|
304905
305628
|
init_lit_html();
|
|
305629
|
+
init_ref();
|
|
304906
305630
|
|
|
304907
305631
|
// ../../node_modules/.bun/quikchat@1.2.7/node_modules/quikchat/dist/quikchat-md.esm.min.js
|
|
304908
305632
|
function e20(e21, t15) {
|
|
@@ -305592,7 +306316,6 @@ q.quikdown = k;
|
|
|
305592
306316
|
|
|
305593
306317
|
// src/panels/ai-panel.js
|
|
305594
306318
|
init_platform3();
|
|
305595
|
-
init_store();
|
|
305596
306319
|
var messages2 = [];
|
|
305597
306320
|
var streaming = false;
|
|
305598
306321
|
var sessionId = null;
|
|
@@ -305603,6 +306326,7 @@ var eventSource = null;
|
|
|
305603
306326
|
var mounted2 = false;
|
|
305604
306327
|
var chatInstance = null;
|
|
305605
306328
|
var chatContainerEl = null;
|
|
306329
|
+
var _quikChatEl = null;
|
|
305606
306330
|
var currentStreamMsgId = null;
|
|
305607
306331
|
var streamStarted = false;
|
|
305608
306332
|
var pendingFileReloads = new Set;
|
|
@@ -305622,7 +306346,7 @@ function registerRightPanelRender(fn) {
|
|
|
305622
306346
|
globalThis.__jxRightPanelRender = { render: fn };
|
|
305623
306347
|
}
|
|
305624
306348
|
function mountQuikChat() {
|
|
305625
|
-
const container =
|
|
306349
|
+
const container = _quikChatEl;
|
|
305626
306350
|
if (!container)
|
|
305627
306351
|
return;
|
|
305628
306352
|
if (chatInstance && chatContainerEl === container)
|
|
@@ -305900,7 +306624,12 @@ function renderAiPanelTemplate() {
|
|
|
305900
306624
|
New Chat
|
|
305901
306625
|
</sp-action-button>
|
|
305902
306626
|
</div>
|
|
305903
|
-
<div
|
|
306627
|
+
<div
|
|
306628
|
+
id="ai-quikchat"
|
|
306629
|
+
${ref2((el) => {
|
|
306630
|
+
_quikChatEl = el || null;
|
|
306631
|
+
})}
|
|
306632
|
+
></div>
|
|
305904
306633
|
</div>
|
|
305905
306634
|
`;
|
|
305906
306635
|
}
|
|
@@ -305910,10 +306639,20 @@ var _ctx13 = null;
|
|
|
305910
306639
|
var _scope5 = null;
|
|
305911
306640
|
var _rendering = false;
|
|
305912
306641
|
var _scheduled2 = false;
|
|
306642
|
+
var _hasFocus = false;
|
|
306643
|
+
function _onFocusIn() {
|
|
306644
|
+
_hasFocus = true;
|
|
306645
|
+
}
|
|
306646
|
+
function _onFocusOut() {
|
|
306647
|
+
_hasFocus = false;
|
|
306648
|
+
render6();
|
|
306649
|
+
}
|
|
305913
306650
|
function mount6(ctx) {
|
|
305914
306651
|
_ctx13 = ctx;
|
|
305915
306652
|
mountAiPanel();
|
|
305916
306653
|
registerRightPanelRender(render6);
|
|
306654
|
+
rightPanel.addEventListener("focusin", _onFocusIn);
|
|
306655
|
+
rightPanel.addEventListener("focusout", _onFocusOut);
|
|
305917
306656
|
_scope5 = effectScope();
|
|
305918
306657
|
_scope5.run(() => {
|
|
305919
306658
|
effect(() => {
|
|
@@ -305930,10 +306669,7 @@ function mount6(ctx) {
|
|
|
305930
306669
|
tab.session.ui.styleFilter;
|
|
305931
306670
|
tab.session.ui.styleFilterActive;
|
|
305932
306671
|
tab.session.ui.inspectorSections;
|
|
305933
|
-
|
|
305934
|
-
const activeTag = document.activeElement?.tagName;
|
|
305935
|
-
const rightHasFocus = !colorPopoverOpen && rightPanel.contains(document.activeElement) && (activeTag === "INPUT" || activeTag === "TEXTAREA" || activeTag === "SP-TEXTFIELD" || activeTag === "SP-NUMBER-FIELD" || activeTag === "SP-PICKER" || activeTag === "SP-COMBOBOX" || activeTag === "SP-SEARCH");
|
|
305936
|
-
if (!rightHasFocus) {
|
|
306672
|
+
if (!_hasFocus && !isColorPopoverOpen()) {
|
|
305937
306673
|
render6();
|
|
305938
306674
|
}
|
|
305939
306675
|
});
|
|
@@ -306248,8 +306984,18 @@ var _ctx14 = null;
|
|
|
306248
306984
|
var _scope6 = null;
|
|
306249
306985
|
var _rendering2 = false;
|
|
306250
306986
|
var _scheduled3 = false;
|
|
306987
|
+
var _hasFocus2 = false;
|
|
306988
|
+
function _onFocusIn2() {
|
|
306989
|
+
_hasFocus2 = true;
|
|
306990
|
+
}
|
|
306991
|
+
function _onFocusOut2() {
|
|
306992
|
+
_hasFocus2 = false;
|
|
306993
|
+
render7();
|
|
306994
|
+
}
|
|
306251
306995
|
function mount7(ctx) {
|
|
306252
306996
|
_ctx14 = ctx;
|
|
306997
|
+
leftPanel.addEventListener("focusin", _onFocusIn2);
|
|
306998
|
+
leftPanel.addEventListener("focusout", _onFocusOut2);
|
|
306253
306999
|
_scope6 = effectScope();
|
|
306254
307000
|
_scope6.run(() => {
|
|
306255
307001
|
effect(() => {
|
|
@@ -306263,7 +307009,9 @@ function mount7(ctx) {
|
|
|
306263
307009
|
tab.session.ui.gitLoading;
|
|
306264
307010
|
tab.session.ui.gitError;
|
|
306265
307011
|
}
|
|
306266
|
-
|
|
307012
|
+
if (!_hasFocus2) {
|
|
307013
|
+
render7();
|
|
307014
|
+
}
|
|
306267
307015
|
});
|
|
306268
307016
|
});
|
|
306269
307017
|
}
|
|
@@ -306312,6 +307060,7 @@ function _render() {
|
|
|
306312
307060
|
const tree = leftPanel.querySelector(".file-tree");
|
|
306313
307061
|
if (tree)
|
|
306314
307062
|
ctx.setupTreeKeyboard(tree);
|
|
307063
|
+
ctx.registerFileTreeDnD({ renderLeftPanel: render7 });
|
|
306315
307064
|
return;
|
|
306316
307065
|
}
|
|
306317
307066
|
if (tab === "git") {
|
|
@@ -306480,12 +307229,12 @@ function tabLabel(tab) {
|
|
|
306480
307229
|
const parts = path2.split("/");
|
|
306481
307230
|
return parts[parts.length - 1];
|
|
306482
307231
|
}
|
|
306483
|
-
function requestClose(id) {
|
|
307232
|
+
async function requestClose(id) {
|
|
306484
307233
|
const tab = workspace.tabs.get(id);
|
|
306485
307234
|
if (!tab)
|
|
306486
307235
|
return;
|
|
306487
307236
|
if (tab.doc.dirty) {
|
|
306488
|
-
const confirmed =
|
|
307237
|
+
const confirmed = await showConfirmDialog("Unsaved Changes", `"${tabLabel(tab)}" has unsaved changes. Close without saving?`, { confirmLabel: "Close", destructive: true });
|
|
306489
307238
|
if (!confirmed)
|
|
306490
307239
|
return;
|
|
306491
307240
|
}
|
|
@@ -306635,6 +307384,7 @@ if (!hasPlatform()) {
|
|
|
306635
307384
|
registerPlatform(createDevServerPlatform());
|
|
306636
307385
|
}
|
|
306637
307386
|
mountResizeEdges();
|
|
307387
|
+
initShellRefs();
|
|
306638
307388
|
mount5(toolbarEl, {
|
|
306639
307389
|
navigateBack: () => navigateBack(),
|
|
306640
307390
|
navigateToLevel: (i8) => navigateToLevel(i8),
|
|
@@ -306756,6 +307506,7 @@ mount7({
|
|
|
306756
307506
|
registerElementsDnD,
|
|
306757
307507
|
registerComponentsDnD,
|
|
306758
307508
|
setupTreeKeyboard,
|
|
307509
|
+
registerFileTreeDnD,
|
|
306759
307510
|
cloneRepository: () => cloneRepository({ openRecentProject }),
|
|
306760
307511
|
setGitDiffState: (state3) => {
|
|
306761
307512
|
gitDiffState = state3;
|
|
@@ -306779,18 +307530,19 @@ function safeRenderRightPanel() {
|
|
|
306779
307530
|
render6();
|
|
306780
307531
|
}
|
|
306781
307532
|
registerFunctionCompletions();
|
|
306782
|
-
var
|
|
306783
|
-
|
|
306784
|
-
|
|
307533
|
+
var _urlParams = new URLSearchParams(location.search);
|
|
307534
|
+
var _projectParam = _urlParams.get("project") || _urlParams.get("open");
|
|
307535
|
+
if (_projectParam) {
|
|
307536
|
+
const isAbsPath = _projectParam.startsWith("/") || _projectParam.startsWith("~") || /^[A-Za-z]:[/\\]/.test(_projectParam);
|
|
306785
307537
|
if (!isAbsPath) {
|
|
306786
|
-
statusMessage(`Error: ?
|
|
307538
|
+
statusMessage(`Error: ?project= requires an absolute path (got "${_projectParam}")`);
|
|
306787
307539
|
render();
|
|
306788
307540
|
} else {
|
|
306789
307541
|
render();
|
|
306790
307542
|
const platform4 = getPlatform();
|
|
306791
307543
|
(async () => {
|
|
306792
307544
|
try {
|
|
306793
|
-
const siteCtx = platform4.resolveSiteContext ? await platform4.resolveSiteContext(
|
|
307545
|
+
const siteCtx = platform4.resolveSiteContext ? await platform4.resolveSiteContext(_projectParam) : { sitePath: null };
|
|
306794
307546
|
if (siteCtx.sitePath) {
|
|
306795
307547
|
if (siteCtx.sitePath) {
|
|
306796
307548
|
platform4.projectRoot = siteCtx.sitePath;
|
|
@@ -306832,8 +307584,8 @@ if (_openParam) {
|
|
|
306832
307584
|
}
|
|
306833
307585
|
requireProjectState().projectDirs = foundDirs;
|
|
306834
307586
|
}
|
|
306835
|
-
const _fileParam =
|
|
306836
|
-
let fileRelPath = _fileParam || siteCtx.fileRelPath ||
|
|
307587
|
+
const _fileParam = _urlParams.get("file");
|
|
307588
|
+
let fileRelPath = _fileParam || siteCtx.fileRelPath || _projectParam;
|
|
306837
307589
|
if (fileRelPath === "project.json" || fileRelPath.endsWith("/project.json")) {
|
|
306838
307590
|
let opened = false;
|
|
306839
307591
|
for (const candidate of ["pages/index.md", "pages/index.json"]) {
|
|
@@ -306871,7 +307623,7 @@ if (_openParam) {
|
|
|
306871
307623
|
activeTab.value.session.ui.canvasMode = "stylebook";
|
|
306872
307624
|
}
|
|
306873
307625
|
render();
|
|
306874
|
-
statusMessage(`Opened ${
|
|
307626
|
+
statusMessage(`Opened ${fileRelPath}`);
|
|
306875
307627
|
}
|
|
306876
307628
|
} catch (e21) {
|
|
306877
307629
|
statusMessage(`Error: ${e21.message}`);
|
|
@@ -306997,5 +307749,5 @@ effect(() => {
|
|
|
306997
307749
|
scheduleAutosave();
|
|
306998
307750
|
});
|
|
306999
307751
|
|
|
307000
|
-
//# debugId=
|
|
307752
|
+
//# debugId=F13607B73179696E64756E2164756E21
|
|
307001
307753
|
//# sourceMappingURL=studio.js.map
|