sculpted 0.3.1 → 0.3.3
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/README.md +4 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/{patcher-DQgKdozw.mjs → patcher-nj9VhRT-.mjs} +131 -11
- package/dist/{runtime-C911j-aR.d.mts → runtime-Cpxddehp.d.mts} +3 -2
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +530 -18
- package/dist/{sourceSyntax-U2iybN9L.d.mts → sourceSyntax-DKIh-VKA.d.mts} +1 -1
- package/dist/tsrx.d.mts +1 -1
- package/dist/{types-CdByW0ji.d.mts → types-0a4hNfAF.d.mts} +11 -1
- package/dist/ui.d.mts +7 -2
- package/dist/ui.mjs +430 -72
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +493 -185
- package/docs/source-writeback.md +4 -2
- package/examples/vite-preact-pandacss/src/BatchFixtures.tsx +77 -0
- package/examples/vite-preact-pandacss/src/main.tsx +2 -0
- package/examples/vite-react-pandacss/src/BatchFixtures.tsx +77 -0
- package/examples/vite-react-pandacss/src/main.tsx +2 -0
- package/package.json +3 -2
package/dist/ui.mjs
CHANGED
|
@@ -1011,6 +1011,23 @@ const RefreshCw = createLucideIcon("refresh-cw", [
|
|
|
1011
1011
|
}]
|
|
1012
1012
|
]);
|
|
1013
1013
|
//#endregion
|
|
1014
|
+
//#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/settings.mjs
|
|
1015
|
+
/**
|
|
1016
|
+
* @license lucide-preact v1.16.0 - ISC
|
|
1017
|
+
*
|
|
1018
|
+
* This source code is licensed under the ISC license.
|
|
1019
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
1020
|
+
*/
|
|
1021
|
+
const Settings = createLucideIcon("settings", [["path", {
|
|
1022
|
+
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
1023
|
+
key: "1i5ecw"
|
|
1024
|
+
}], ["circle", {
|
|
1025
|
+
cx: "12",
|
|
1026
|
+
cy: "12",
|
|
1027
|
+
r: "3",
|
|
1028
|
+
key: "1v7zrd"
|
|
1029
|
+
}]]);
|
|
1030
|
+
//#endregion
|
|
1014
1031
|
//#region node_modules/.pnpm/lucide-preact@1.16.0_preact@10.29.2/node_modules/lucide-preact/dist/esm/icons/square-dashed-mouse-pointer.mjs
|
|
1015
1032
|
/**
|
|
1016
1033
|
* @license lucide-preact v1.16.0 - ISC
|
|
@@ -7240,6 +7257,7 @@ function selectedElementPanelView(info) {
|
|
|
7240
7257
|
editable: false,
|
|
7241
7258
|
styleRows: [],
|
|
7242
7259
|
editableTargets: [],
|
|
7260
|
+
inheritedTargets: [],
|
|
7243
7261
|
inlineSourceCreate: void 0,
|
|
7244
7262
|
inspectedJsxSource: void 0,
|
|
7245
7263
|
inspectedComponentSource: void 0,
|
|
@@ -7269,6 +7287,7 @@ function selectedElementPanelView(info) {
|
|
|
7269
7287
|
const editable = editableTargets.length > 0;
|
|
7270
7288
|
const styleRows = editableTargets.flatMap((editableTarget) => editableTarget.styleRows);
|
|
7271
7289
|
const editableComputedProperties = editableComputedPropertySet(editableTargets);
|
|
7290
|
+
const inheritedTargets = inheritedEditableTargets(info.evidence?.inheritedStyleSources ?? [], info.evidence?.computedStyles ?? [], editableComputedProperties);
|
|
7272
7291
|
const inspectedJsxSource = inspectedComponentLayerSource(info.evidence?.componentLayers ?? []);
|
|
7273
7292
|
const inspectedComponentSource = inspectedComponentSourceLocation(info.evidence?.componentLayers ?? []);
|
|
7274
7293
|
const hasInlineEditableSource = editableTargets.some((editableTarget) => editableTarget.attribute === "class" || editableTarget.attribute === "className");
|
|
@@ -7279,6 +7298,7 @@ function selectedElementPanelView(info) {
|
|
|
7279
7298
|
editable,
|
|
7280
7299
|
styleRows,
|
|
7281
7300
|
editableTargets,
|
|
7301
|
+
inheritedTargets,
|
|
7282
7302
|
inlineSourceCreate: inspectedJsxSource && !hasInlineEditableSource ? { jsxSource: inspectedJsxSource } : void 0,
|
|
7283
7303
|
inspectedJsxSource,
|
|
7284
7304
|
inspectedComponentSource,
|
|
@@ -7344,6 +7364,52 @@ function previewInputValue(value, path) {
|
|
|
7344
7364
|
function visibleComputedRows(computedStyles, editableComputedProperties = /* @__PURE__ */ new Set()) {
|
|
7345
7365
|
return computedStyles.filter((row) => !isKnownInitialComputedValue(row) && !editableComputedProperties.has(row.property.toLowerCase())).slice(0, 16);
|
|
7346
7366
|
}
|
|
7367
|
+
function inheritedEditableTargets(sources, inspectedComputedStyles, ownComputedProperties) {
|
|
7368
|
+
if (sources.length === 0 || inspectedComputedStyles.length === 0) return [];
|
|
7369
|
+
const inspectedComputed = declarationValueMap(inspectedComputedStyles);
|
|
7370
|
+
const claimedProperties = /* @__PURE__ */ new Set();
|
|
7371
|
+
const inheritedTargets = [];
|
|
7372
|
+
for (const source of sources) {
|
|
7373
|
+
const ancestorComputed = declarationValueMap(source.computedStyles);
|
|
7374
|
+
const inheritedRows = [];
|
|
7375
|
+
const targetRows = styleObjectRows(source.target.styleObject);
|
|
7376
|
+
for (const row of targetRows) {
|
|
7377
|
+
if (row.previewValue === void 0) continue;
|
|
7378
|
+
const inheritedProperties = previewDeclarationsForPandaInput(row.path.split("."), row.previewValue).flatMap((declaration) => expandedComputedProperties(declaration.property)).filter((property) => INHERITED_COMPUTED_PROPERTIES.has(property));
|
|
7379
|
+
if (inheritedProperties.length === 0) continue;
|
|
7380
|
+
const matchingProperties = inheritedProperties.filter((property) => {
|
|
7381
|
+
if (ownComputedProperties.has(property) || claimedProperties.has(property)) return false;
|
|
7382
|
+
const inspectedValue = inspectedComputed.get(property);
|
|
7383
|
+
if (!inspectedValue) return false;
|
|
7384
|
+
return inspectedValue === ancestorComputed.get(property);
|
|
7385
|
+
});
|
|
7386
|
+
if (matchingProperties.length === 0) continue;
|
|
7387
|
+
inheritedRows.push(row);
|
|
7388
|
+
matchingProperties.forEach((property) => {
|
|
7389
|
+
claimedProperties.add(property);
|
|
7390
|
+
});
|
|
7391
|
+
}
|
|
7392
|
+
if (inheritedRows.length === 0) continue;
|
|
7393
|
+
inheritedTargets.push({
|
|
7394
|
+
id: source.target.id,
|
|
7395
|
+
name: source.target.name,
|
|
7396
|
+
source: source.target.file,
|
|
7397
|
+
sourceLocation: sourceLocationLabel(source.target.file, source.target.loc),
|
|
7398
|
+
attribute: source.target.attribute,
|
|
7399
|
+
jsxSource: source.target.jsxSource,
|
|
7400
|
+
jsxSourceAliases: source.target.jsxSourceAliases,
|
|
7401
|
+
styleRows: inheritedRows,
|
|
7402
|
+
depth: source.depth,
|
|
7403
|
+
inheritedFrom: source.component ?? source.source ?? `${source.tagName}${source.depth === 1 ? " parent" : ` ancestor ${source.depth}`}`
|
|
7404
|
+
});
|
|
7405
|
+
}
|
|
7406
|
+
return inheritedTargets;
|
|
7407
|
+
}
|
|
7408
|
+
function declarationValueMap(declarations) {
|
|
7409
|
+
const values = /* @__PURE__ */ new Map();
|
|
7410
|
+
for (const declaration of declarations) values.set(declaration.property.toLowerCase(), declaration.value.trim());
|
|
7411
|
+
return values;
|
|
7412
|
+
}
|
|
7347
7413
|
function editableComputedPropertySet(targets) {
|
|
7348
7414
|
const properties = /* @__PURE__ */ new Set();
|
|
7349
7415
|
for (const target of targets) for (const row of target.styleRows) {
|
|
@@ -7395,6 +7461,21 @@ const KNOWN_COMPUTED_INITIAL_VALUES = {
|
|
|
7395
7461
|
"z-index": "auto"
|
|
7396
7462
|
};
|
|
7397
7463
|
const COMPUTED_PROPERTY_EXPANSIONS = {
|
|
7464
|
+
font: [
|
|
7465
|
+
"font-family",
|
|
7466
|
+
"font-size",
|
|
7467
|
+
"font-stretch",
|
|
7468
|
+
"font-style",
|
|
7469
|
+
"font-variant",
|
|
7470
|
+
"font-weight",
|
|
7471
|
+
"line-height"
|
|
7472
|
+
],
|
|
7473
|
+
"list-style": [
|
|
7474
|
+
"list-style-image",
|
|
7475
|
+
"list-style-position",
|
|
7476
|
+
"list-style-type"
|
|
7477
|
+
],
|
|
7478
|
+
text: ["color"],
|
|
7398
7479
|
border: [
|
|
7399
7480
|
"border-bottom-color",
|
|
7400
7481
|
"border-bottom-style",
|
|
@@ -7426,6 +7507,39 @@ const COMPUTED_PROPERTY_EXPANSIONS = {
|
|
|
7426
7507
|
"padding-inline": ["padding-left", "padding-right"],
|
|
7427
7508
|
"padding-block": ["padding-bottom", "padding-top"]
|
|
7428
7509
|
};
|
|
7510
|
+
const INHERITED_COMPUTED_PROPERTIES = new Set([
|
|
7511
|
+
"border-collapse",
|
|
7512
|
+
"border-spacing",
|
|
7513
|
+
"caption-side",
|
|
7514
|
+
"color",
|
|
7515
|
+
"cursor",
|
|
7516
|
+
"direction",
|
|
7517
|
+
"empty-cells",
|
|
7518
|
+
"font-family",
|
|
7519
|
+
"font-feature-settings",
|
|
7520
|
+
"font-kerning",
|
|
7521
|
+
"font-size",
|
|
7522
|
+
"font-stretch",
|
|
7523
|
+
"font-style",
|
|
7524
|
+
"font-variant",
|
|
7525
|
+
"font-variant-caps",
|
|
7526
|
+
"font-weight",
|
|
7527
|
+
"letter-spacing",
|
|
7528
|
+
"line-height",
|
|
7529
|
+
"list-style-image",
|
|
7530
|
+
"list-style-position",
|
|
7531
|
+
"list-style-type",
|
|
7532
|
+
"quotes",
|
|
7533
|
+
"tab-size",
|
|
7534
|
+
"text-align",
|
|
7535
|
+
"text-indent",
|
|
7536
|
+
"text-rendering",
|
|
7537
|
+
"text-transform",
|
|
7538
|
+
"visibility",
|
|
7539
|
+
"white-space",
|
|
7540
|
+
"word-break",
|
|
7541
|
+
"word-spacing"
|
|
7542
|
+
]);
|
|
7429
7543
|
function isStyleValue(value) {
|
|
7430
7544
|
return value.kind === "literal" || value.kind === "unsupported";
|
|
7431
7545
|
}
|
|
@@ -7461,6 +7575,9 @@ const INSPECTOR_DIALOG_PORTAL_ROOT = "data-sculpted-dialog-root";
|
|
|
7461
7575
|
const INSPECTOR_MENU_PORTAL_ROOT = "data-sculpted-menu-root";
|
|
7462
7576
|
const INLINE_SOURCE_PREVIEW_PATH = ["__inlineSource"];
|
|
7463
7577
|
const STYLE_MODULE_ACTION_PREVIEW_PATH = ["__styleModuleAction"];
|
|
7578
|
+
const COPY_ELEMENT_PATH_AFTER_INSPECT_STORAGE_KEY = "sculpted.copyElementPathAfterInspect";
|
|
7579
|
+
const PANEL_DOCKED_STORAGE_KEY = "sculpted.panelDocked";
|
|
7580
|
+
const PANEL_SIDE_STORAGE_KEY = "sculpted.panelSide";
|
|
7464
7581
|
function installReadonlyInspectorPanel(runtime, options = {}) {
|
|
7465
7582
|
let panel = null;
|
|
7466
7583
|
let previousBodyMarginLeft;
|
|
@@ -7575,14 +7692,41 @@ function applyInspectorPanelFrame(panel, state) {
|
|
|
7575
7692
|
panel.style.borderRadius = "8px";
|
|
7576
7693
|
panel.style.boxShadow = "0 18px 54px rgba(15, 23, 42, 0.18)";
|
|
7577
7694
|
}
|
|
7695
|
+
function loadBooleanPreference(storageKey, defaultValue) {
|
|
7696
|
+
try {
|
|
7697
|
+
const stored = window.localStorage.getItem(storageKey);
|
|
7698
|
+
if (stored === "true") return true;
|
|
7699
|
+
if (stored === "false") return false;
|
|
7700
|
+
} catch {}
|
|
7701
|
+
return defaultValue;
|
|
7702
|
+
}
|
|
7703
|
+
function saveBooleanPreference(storageKey, value) {
|
|
7704
|
+
try {
|
|
7705
|
+
window.localStorage.setItem(storageKey, value ? "true" : "false");
|
|
7706
|
+
} catch {}
|
|
7707
|
+
}
|
|
7708
|
+
function loadPanelSidePreference(defaultValue) {
|
|
7709
|
+
try {
|
|
7710
|
+
const stored = window.localStorage.getItem(PANEL_SIDE_STORAGE_KEY);
|
|
7711
|
+
if (stored === "left" || stored === "right") return stored;
|
|
7712
|
+
} catch {}
|
|
7713
|
+
return defaultValue;
|
|
7714
|
+
}
|
|
7715
|
+
function savePanelSidePreference(value) {
|
|
7716
|
+
try {
|
|
7717
|
+
window.localStorage.setItem(PANEL_SIDE_STORAGE_KEY, value);
|
|
7718
|
+
} catch {}
|
|
7719
|
+
}
|
|
7578
7720
|
function InspectorPanel(props) {
|
|
7579
7721
|
const { runtime, title, onFrameChange } = props;
|
|
7580
7722
|
const selected = useSignal();
|
|
7581
7723
|
const visible = useSignal(false);
|
|
7582
|
-
const docked = useSignal(false);
|
|
7583
|
-
const side = useSignal("right");
|
|
7724
|
+
const docked = useSignal(loadBooleanPreference(PANEL_DOCKED_STORAGE_KEY, false));
|
|
7725
|
+
const side = useSignal(loadPanelSidePreference("right"));
|
|
7584
7726
|
const isInspecting = useSignal(false);
|
|
7727
|
+
const settingsOpen = useSignal(false);
|
|
7585
7728
|
const previewEnabled = useSignal(true);
|
|
7729
|
+
const copyElementPathAfterInspect = useSignal(loadBooleanPreference(COPY_ELEMENT_PATH_AFTER_INSPECT_STORAGE_KEY, false));
|
|
7586
7730
|
const forcedPreviewStates = useSignal(/* @__PURE__ */ new Set());
|
|
7587
7731
|
const pendingPreviewChanges = useSignal(/* @__PURE__ */ new Map());
|
|
7588
7732
|
const expandedShorthandInputs = useSignal(/* @__PURE__ */ new Set());
|
|
@@ -7593,6 +7737,7 @@ function InspectorPanel(props) {
|
|
|
7593
7737
|
const elementStyleModule = useSignal({ status: "idle" });
|
|
7594
7738
|
const showingStyleModulePage = useComputed(() => styleModulePanel.value.status !== "idle");
|
|
7595
7739
|
const panelHeaderTitle = useComputed(() => {
|
|
7740
|
+
if (settingsOpen.value) return "Settings";
|
|
7596
7741
|
return styleModulePanel.value.status === "idle" ? title : "Style List";
|
|
7597
7742
|
});
|
|
7598
7743
|
const editorMetadata = useSignal();
|
|
@@ -7614,11 +7759,11 @@ function InspectorPanel(props) {
|
|
|
7614
7759
|
const contentScroller = A$1(null);
|
|
7615
7760
|
const previousPreviewBarVisible = A$1(false);
|
|
7616
7761
|
const pendingPreviewBarScrollDelta = A$1(0);
|
|
7617
|
-
const
|
|
7618
|
-
const previewBarVisible = useSignal(false);
|
|
7762
|
+
const inputMenuOpen = useSignal(false);
|
|
7619
7763
|
const view = useComputed(() => selectedElementPanelView(selected.value));
|
|
7620
7764
|
const inspectedComponentSource = useComputed(() => view.value.inspectedComponentSource);
|
|
7621
7765
|
const previewChangeCount = useComputed(() => pendingPreviewChanges.value.size);
|
|
7766
|
+
const previewBarVisible = useComputed(() => previewChangeCount.value > 0 && !inputMenuOpen.value);
|
|
7622
7767
|
const canUndoPreview = useComputed(() => previewUndoStack.value.length > 0 || previewHistoryBatchOpen.value);
|
|
7623
7768
|
const canRedoPreview = useComputed(() => previewRedoStack.value.length > 0);
|
|
7624
7769
|
const saving = useComputed(() => saveFlow.value.status === "saving");
|
|
@@ -7668,6 +7813,7 @@ function InspectorPanel(props) {
|
|
|
7668
7813
|
};
|
|
7669
7814
|
}, (error) => {
|
|
7670
7815
|
if (inspectedComponentSource.value !== componentSource) return;
|
|
7816
|
+
logUnexpectedInspectorError("Failed to load component style module.", error);
|
|
7671
7817
|
elementStyleModule.value = {
|
|
7672
7818
|
status: "error",
|
|
7673
7819
|
componentSource,
|
|
@@ -7676,13 +7822,11 @@ function InspectorPanel(props) {
|
|
|
7676
7822
|
});
|
|
7677
7823
|
}, [inspectedComponentSource.value]);
|
|
7678
7824
|
_$2(() => {
|
|
7679
|
-
const visible =
|
|
7680
|
-
if (inputMenuOpenCount.value > 0) return;
|
|
7825
|
+
const visible = previewBarVisible.value;
|
|
7681
7826
|
if (visible === previousPreviewBarVisible.current) return;
|
|
7682
7827
|
pendingPreviewBarScrollDelta.current += visible ? PREVIEW_CHANGES_BAR_HEIGHT : -45;
|
|
7683
7828
|
previousPreviewBarVisible.current = visible;
|
|
7684
|
-
|
|
7685
|
-
}, [previewChangeCount.value > 0, inputMenuOpenCount.value]);
|
|
7829
|
+
}, [previewBarVisible.value]);
|
|
7686
7830
|
_$2(() => {
|
|
7687
7831
|
const scrollDelta = pendingPreviewBarScrollDelta.current;
|
|
7688
7832
|
if (scrollDelta === 0) return;
|
|
@@ -7692,7 +7836,7 @@ function InspectorPanel(props) {
|
|
|
7692
7836
|
scroller.scrollTop = Math.max(0, scroller.scrollTop + scrollDelta);
|
|
7693
7837
|
}, [previewBarVisible.value]);
|
|
7694
7838
|
const onInputMenuOpenChange = (open) => {
|
|
7695
|
-
|
|
7839
|
+
inputMenuOpen.value = open;
|
|
7696
7840
|
};
|
|
7697
7841
|
_$2(() => {
|
|
7698
7842
|
const onAddPropertyShortcut = (event) => {
|
|
@@ -7754,7 +7898,8 @@ function InspectorPanel(props) {
|
|
|
7754
7898
|
runtime.applyForcedStates?.(selectedElement.current, Array.from(forcedPreviewStates.value));
|
|
7755
7899
|
const declarationsByEditId = /* @__PURE__ */ new Map();
|
|
7756
7900
|
const includedChangeKeys = /* @__PURE__ */ new Set();
|
|
7757
|
-
|
|
7901
|
+
const previewTargets = editableTargetsWithPendingInlineSource(view.value, pendingPreviewChanges.value);
|
|
7902
|
+
for (const target of previewTargets) for (const row of target.styleRows) {
|
|
7758
7903
|
if (row.previewValue === void 0) continue;
|
|
7759
7904
|
const path = row.path.split(".");
|
|
7760
7905
|
const condition = pandaPreviewCondition(path);
|
|
@@ -7923,6 +8068,11 @@ function InspectorPanel(props) {
|
|
|
7923
8068
|
isInspecting.value = false;
|
|
7924
8069
|
clearInspectCursor();
|
|
7925
8070
|
};
|
|
8071
|
+
const copyInspectedElementPath = (evidence) => {
|
|
8072
|
+
if (!copyElementPathAfterInspect.value) return;
|
|
8073
|
+
const identity = inspectedElementIdentityFromLayers(evidence?.componentLayers ?? []);
|
|
8074
|
+
if (identity) navigator.clipboard?.writeText(identity).catch(() => {});
|
|
8075
|
+
};
|
|
7926
8076
|
const isPanelEditableFocused = () => {
|
|
7927
8077
|
const root = shell.current?.getRootNode();
|
|
7928
8078
|
const active = root && isShadowRoot(root) ? root.activeElement : document.activeElement;
|
|
@@ -7971,6 +8121,7 @@ function InspectorPanel(props) {
|
|
|
7971
8121
|
document.getSelection()?.removeAllRanges();
|
|
7972
8122
|
stopActiveInspecting();
|
|
7973
8123
|
clearModifierPreview();
|
|
8124
|
+
copyInspectedElementPath(typeof runtime.inspectElementEvidence === "function" ? runtime.inspectElementEvidence(element) : void 0);
|
|
7974
8125
|
runtime.selectElement(element).then((info) => {
|
|
7975
8126
|
selectedElement.current = element;
|
|
7976
8127
|
selectedElementAutofocusRevision.value += 1;
|
|
@@ -8015,9 +8166,12 @@ function InspectorPanel(props) {
|
|
|
8015
8166
|
selectedElement.current = element;
|
|
8016
8167
|
selectedElementAutofocusRevision.value += 1;
|
|
8017
8168
|
selected.value = info;
|
|
8169
|
+
settingsOpen.value = false;
|
|
8018
8170
|
applyPreviewChanges(pendingPreviewChanges.value, previewEnabled.value);
|
|
8019
8171
|
setPanelVisible(true);
|
|
8020
|
-
}, onStopInspecting)
|
|
8172
|
+
}, onStopInspecting, (_element, evidence) => {
|
|
8173
|
+
copyInspectedElementPath(evidence);
|
|
8174
|
+
});
|
|
8021
8175
|
isInspecting.value = true;
|
|
8022
8176
|
setInspectCursor();
|
|
8023
8177
|
};
|
|
@@ -8050,6 +8204,7 @@ function InspectorPanel(props) {
|
|
|
8050
8204
|
};
|
|
8051
8205
|
const toggleDocked = () => {
|
|
8052
8206
|
docked.value = !docked.value;
|
|
8207
|
+
saveBooleanPreference(PANEL_DOCKED_STORAGE_KEY, docked.value);
|
|
8053
8208
|
onFrameChange({
|
|
8054
8209
|
visible: visible.value,
|
|
8055
8210
|
docked: docked.value,
|
|
@@ -8059,12 +8214,20 @@ function InspectorPanel(props) {
|
|
|
8059
8214
|
const snapPanelSide = (nextSide) => {
|
|
8060
8215
|
if (side.value === nextSide) return;
|
|
8061
8216
|
side.value = nextSide;
|
|
8217
|
+
savePanelSidePreference(nextSide);
|
|
8062
8218
|
onFrameChange({
|
|
8063
8219
|
visible: visible.value,
|
|
8064
8220
|
docked: docked.value,
|
|
8065
8221
|
side: nextSide
|
|
8066
8222
|
});
|
|
8067
8223
|
};
|
|
8224
|
+
const openSettings = () => {
|
|
8225
|
+
settingsOpen.value = true;
|
|
8226
|
+
};
|
|
8227
|
+
const updateCopyElementPathAfterInspect = (enabled) => {
|
|
8228
|
+
copyElementPathAfterInspect.value = enabled;
|
|
8229
|
+
saveBooleanPreference(COPY_ELEMENT_PATH_AFTER_INSPECT_STORAGE_KEY, enabled);
|
|
8230
|
+
};
|
|
8068
8231
|
const togglePreview = (enabled) => {
|
|
8069
8232
|
previewEnabled.value = enabled;
|
|
8070
8233
|
applyPreviewChanges(pendingPreviewChanges.value, enabled);
|
|
@@ -8180,6 +8343,7 @@ function InspectorPanel(props) {
|
|
|
8180
8343
|
const changesByEditId = /* @__PURE__ */ new Map();
|
|
8181
8344
|
for (const change of pendingPreviewChanges.value.values()) {
|
|
8182
8345
|
if (isInlineSourcePreviewChange(change)) continue;
|
|
8346
|
+
if (change.editId.startsWith("inline-source:")) continue;
|
|
8183
8347
|
if (isStyleModulePreviewChange(change)) continue;
|
|
8184
8348
|
if (styleModuleCreateEditIds.has(change.editId)) continue;
|
|
8185
8349
|
changesByEditId.set(change.editId, [...changesByEditId.get(change.editId) ?? [], change]);
|
|
@@ -8208,10 +8372,24 @@ function InspectorPanel(props) {
|
|
|
8208
8372
|
flushPreviewHistoryBatch();
|
|
8209
8373
|
return Array.from(pendingPreviewChanges.value.values()).flatMap((change) => {
|
|
8210
8374
|
if (!isInlineSourcePreviewChange(change)) return [];
|
|
8375
|
+
const edits = Array.from(pendingPreviewChanges.value.values()).flatMap((propertyChange) => {
|
|
8376
|
+
if (propertyChange.editId !== change.editId) return [];
|
|
8377
|
+
if (isInlineSourcePreviewChange(propertyChange)) return [];
|
|
8378
|
+
if (propertyChange.op === "delete") return [{
|
|
8379
|
+
op: "delete",
|
|
8380
|
+
path: propertyChange.path
|
|
8381
|
+
}];
|
|
8382
|
+
return [{
|
|
8383
|
+
op: "set",
|
|
8384
|
+
path: propertyChange.path,
|
|
8385
|
+
value: propertyChange.value
|
|
8386
|
+
}];
|
|
8387
|
+
});
|
|
8211
8388
|
return [{
|
|
8212
8389
|
editId: change.editId,
|
|
8213
8390
|
kind: "panda-css-inline-source",
|
|
8214
|
-
jsxSource: change.value
|
|
8391
|
+
jsxSource: change.value,
|
|
8392
|
+
edits: edits.length > 0 ? edits : void 0
|
|
8215
8393
|
}];
|
|
8216
8394
|
});
|
|
8217
8395
|
};
|
|
@@ -8264,15 +8442,29 @@ function InspectorPanel(props) {
|
|
|
8264
8442
|
const styleModuleRequests = createStyleModuleRequests();
|
|
8265
8443
|
if (requests.length === 0 && inlineSourceRequests.length === 0 && styleModuleRequests.length === 0) return;
|
|
8266
8444
|
saveFlow.value = { status: "saving" };
|
|
8267
|
-
const
|
|
8268
|
-
const
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8445
|
+
const saveOperationCount = (requests.length > 0 ? 1 : 0) + inlineSourceRequests.length + styleModuleRequests.length;
|
|
8446
|
+
const requestResponses = (write) => {
|
|
8447
|
+
const styleResponses = requests.length > 0 ? runtime.requestStyleEditBatch(requests, write) : Promise.resolve([]);
|
|
8448
|
+
const inlineSourceResponses = Promise.all(inlineSourceRequests.map((request) => runtime.requestInlineCssSource(request, write)));
|
|
8449
|
+
const styleModuleResponses = Promise.all(styleModuleRequests.map((request) => runtime.requestStyleModuleEdit(request, write)));
|
|
8450
|
+
return Promise.all([
|
|
8451
|
+
styleResponses,
|
|
8452
|
+
inlineSourceResponses,
|
|
8453
|
+
styleModuleResponses
|
|
8454
|
+
]).then((responses) => responses.flat());
|
|
8455
|
+
};
|
|
8456
|
+
(async () => {
|
|
8457
|
+
if (saveOperationCount > 1) {
|
|
8458
|
+
const dryRunFailure = (await requestResponses(false)).find((response) => !response.ok);
|
|
8459
|
+
if (dryRunFailure) {
|
|
8460
|
+
saveFlow.value = {
|
|
8461
|
+
status: "error",
|
|
8462
|
+
message: styleEditResponseMessage(dryRunFailure)
|
|
8463
|
+
};
|
|
8464
|
+
return;
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
const allResponses = await requestResponses(true);
|
|
8276
8468
|
const failure = allResponses.find((response) => !response.ok);
|
|
8277
8469
|
if (failure) {
|
|
8278
8470
|
saveFlow.value = {
|
|
@@ -8281,6 +8473,9 @@ function InspectorPanel(props) {
|
|
|
8281
8473
|
};
|
|
8282
8474
|
return;
|
|
8283
8475
|
}
|
|
8476
|
+
return allResponses;
|
|
8477
|
+
})().then(async (allResponses) => {
|
|
8478
|
+
if (!allResponses) return;
|
|
8284
8479
|
if (allResponses.find((response) => !response.manifestUpdate)) {
|
|
8285
8480
|
saveFlow.value = {
|
|
8286
8481
|
status: "error",
|
|
@@ -8291,6 +8486,7 @@ function InspectorPanel(props) {
|
|
|
8291
8486
|
try {
|
|
8292
8487
|
await refreshSelectedElementInfo();
|
|
8293
8488
|
} catch (error) {
|
|
8489
|
+
logUnexpectedInspectorError("Failed to refresh selection after save.", error);
|
|
8294
8490
|
saveFlow.value = {
|
|
8295
8491
|
status: "error",
|
|
8296
8492
|
message: errorMessage(error)
|
|
@@ -8301,6 +8497,7 @@ function InspectorPanel(props) {
|
|
|
8301
8497
|
resetPreviewHistory();
|
|
8302
8498
|
saveFlow.value = { status: "idle" };
|
|
8303
8499
|
}, (error) => {
|
|
8500
|
+
logUnexpectedInspectorError("Failed to save preview changes.", error);
|
|
8304
8501
|
saveFlow.value = {
|
|
8305
8502
|
status: "error",
|
|
8306
8503
|
message: errorMessage(error)
|
|
@@ -8337,6 +8534,7 @@ function InspectorPanel(props) {
|
|
|
8337
8534
|
module: response
|
|
8338
8535
|
};
|
|
8339
8536
|
}, (error) => {
|
|
8537
|
+
logUnexpectedInspectorError("Failed to open style module.", error);
|
|
8340
8538
|
styleModulePanel.value = {
|
|
8341
8539
|
status: "error",
|
|
8342
8540
|
component,
|
|
@@ -8469,8 +8667,10 @@ function InspectorPanel(props) {
|
|
|
8469
8667
|
title: panelHeaderTitle,
|
|
8470
8668
|
isInspecting,
|
|
8471
8669
|
docked,
|
|
8472
|
-
showInspect: !showingStyleModulePage.value,
|
|
8473
|
-
onBack:
|
|
8670
|
+
showInspect: !showingStyleModulePage.value && !settingsOpen.value,
|
|
8671
|
+
onBack: settingsOpen.value ? () => {
|
|
8672
|
+
settingsOpen.value = false;
|
|
8673
|
+
} : showingStyleModulePage.value ? () => {
|
|
8474
8674
|
styleModulePanel.value = { status: "idle" };
|
|
8475
8675
|
} : void 0,
|
|
8476
8676
|
onInspect: toggleInspecting,
|
|
@@ -8481,6 +8681,7 @@ function InspectorPanel(props) {
|
|
|
8481
8681
|
disabled: saving,
|
|
8482
8682
|
onUndoPreview: undoPreviewChange,
|
|
8483
8683
|
onRedoPreview: redoPreviewChange,
|
|
8684
|
+
onSettings: openSettings,
|
|
8484
8685
|
onToggleDocked: toggleDocked,
|
|
8485
8686
|
onToggleSide: () => {
|
|
8486
8687
|
snapPanelSide(side.value === "right" ? "left" : "right");
|
|
@@ -8494,11 +8695,15 @@ function InspectorPanel(props) {
|
|
|
8494
8695
|
flex: "1 1 auto",
|
|
8495
8696
|
padding: "12px",
|
|
8496
8697
|
display: "grid",
|
|
8698
|
+
alignContent: "start",
|
|
8497
8699
|
gap: "12px",
|
|
8498
8700
|
overflow: "auto",
|
|
8499
8701
|
minHeight: 0
|
|
8500
8702
|
},
|
|
8501
|
-
children: [/* @__PURE__ */ u(SaveStatusSection, { saveFlow }),
|
|
8703
|
+
children: [/* @__PURE__ */ u(SaveStatusSection, { saveFlow }), settingsOpen.value ? /* @__PURE__ */ u(SettingsSection, {
|
|
8704
|
+
copyElementPathAfterInspect,
|
|
8705
|
+
onCopyElementPathAfterInspectChange: updateCopyElementPathAfterInspect
|
|
8706
|
+
}) : showingStyleModulePage.value ? /* @__PURE__ */ u(StyleModuleSection, {
|
|
8502
8707
|
state: styleModulePanel,
|
|
8503
8708
|
pendingChanges: pendingPreviewChanges,
|
|
8504
8709
|
preview,
|
|
@@ -8625,6 +8830,67 @@ function InspectorPanel(props) {
|
|
|
8625
8830
|
shorthandFocusRequest.value = null;
|
|
8626
8831
|
}
|
|
8627
8832
|
}),
|
|
8833
|
+
/* @__PURE__ */ u(EditableTargetsSection, {
|
|
8834
|
+
heading: "Inherited Styles",
|
|
8835
|
+
targets: view.value.inheritedTargets,
|
|
8836
|
+
view,
|
|
8837
|
+
preview,
|
|
8838
|
+
forcedPreviewStates,
|
|
8839
|
+
expandedShorthandInputs,
|
|
8840
|
+
shorthandFocusRequest,
|
|
8841
|
+
colorTokenOptions,
|
|
8842
|
+
fontTokenOptions,
|
|
8843
|
+
tokenSources,
|
|
8844
|
+
propertyOptions,
|
|
8845
|
+
saving,
|
|
8846
|
+
addedInputActivationRequest,
|
|
8847
|
+
onPreviewInput: updatePreviewInput,
|
|
8848
|
+
onCreateColorToken: createColorToken,
|
|
8849
|
+
onAddedInputActivationHandled: () => {
|
|
8850
|
+
addedInputActivationRequest.value = null;
|
|
8851
|
+
},
|
|
8852
|
+
onAddProperty: addPreviewProperty,
|
|
8853
|
+
onCreateInlineSource: createInlineSource,
|
|
8854
|
+
onRemoveProperty: removePreviewProperty,
|
|
8855
|
+
onFocusRestoreButton: focusRestoreButton,
|
|
8856
|
+
onFocusPreviewControl: focusPreviewControlByTarget,
|
|
8857
|
+
onRestoreProperty: restorePreviewProperty,
|
|
8858
|
+
onHighlightSourceTarget: (editId) => {
|
|
8859
|
+
runtime.highlightSourceTarget(editId);
|
|
8860
|
+
},
|
|
8861
|
+
onClearHighlight: () => {
|
|
8862
|
+
runtime.clearHighlight();
|
|
8863
|
+
},
|
|
8864
|
+
onOpenSource: (source) => {
|
|
8865
|
+
runtime.openSourceLocation({
|
|
8866
|
+
kind: "source",
|
|
8867
|
+
source
|
|
8868
|
+
});
|
|
8869
|
+
},
|
|
8870
|
+
onInputMenuOpenChange,
|
|
8871
|
+
onToggleShorthandInput: (key) => {
|
|
8872
|
+
const next = new Set(expandedShorthandInputs.value);
|
|
8873
|
+
if (next.has(key)) next.delete(key);
|
|
8874
|
+
else next.add(key);
|
|
8875
|
+
expandedShorthandInputs.value = next;
|
|
8876
|
+
},
|
|
8877
|
+
onExpandShorthandInput: (key) => {
|
|
8878
|
+
if (expandedShorthandInputs.value.has(key)) return;
|
|
8879
|
+
expandedShorthandInputs.value = new Set([...expandedShorthandInputs.value, key]);
|
|
8880
|
+
},
|
|
8881
|
+
onCollapseShorthandInput: (key) => {
|
|
8882
|
+
if (!expandedShorthandInputs.value.has(key)) return;
|
|
8883
|
+
const next = new Set(expandedShorthandInputs.value);
|
|
8884
|
+
next.delete(key);
|
|
8885
|
+
expandedShorthandInputs.value = next;
|
|
8886
|
+
},
|
|
8887
|
+
onRequestShorthandFocus: (request) => {
|
|
8888
|
+
shorthandFocusRequest.value = request;
|
|
8889
|
+
},
|
|
8890
|
+
onShorthandFocusRequestHandled: () => {
|
|
8891
|
+
shorthandFocusRequest.value = null;
|
|
8892
|
+
}
|
|
8893
|
+
}),
|
|
8628
8894
|
/* @__PURE__ */ u(ComponentLayersSection, {
|
|
8629
8895
|
view,
|
|
8630
8896
|
onOpenStyleModule: openStyleModule,
|
|
@@ -9015,6 +9281,22 @@ function PanelHeader(props) {
|
|
|
9015
9281
|
children: "Clear"
|
|
9016
9282
|
})]
|
|
9017
9283
|
})
|
|
9284
|
+
}),
|
|
9285
|
+
/* @__PURE__ */ u(ShadowMenuItem, {
|
|
9286
|
+
class: "sculpted-menu-item",
|
|
9287
|
+
disabled: props.disabled.value,
|
|
9288
|
+
onSelect: props.onSettings,
|
|
9289
|
+
children: /* @__PURE__ */ u("span", {
|
|
9290
|
+
"data-menu-action": "settings",
|
|
9291
|
+
style: { display: "contents" },
|
|
9292
|
+
children: [/* @__PURE__ */ u(Settings, {
|
|
9293
|
+
size: 15,
|
|
9294
|
+
"aria-hidden": "true"
|
|
9295
|
+
}), /* @__PURE__ */ u("span", {
|
|
9296
|
+
style: { font: "inherit" },
|
|
9297
|
+
children: "Settings"
|
|
9298
|
+
})]
|
|
9299
|
+
})
|
|
9018
9300
|
})
|
|
9019
9301
|
]
|
|
9020
9302
|
})]
|
|
@@ -9064,6 +9346,39 @@ function SaveStatusSection(props) {
|
|
|
9064
9346
|
children: /* @__PURE__ */ u("div", { children: state.message })
|
|
9065
9347
|
});
|
|
9066
9348
|
}
|
|
9349
|
+
function SettingsSection(props) {
|
|
9350
|
+
return /* @__PURE__ */ u("section", {
|
|
9351
|
+
"data-settings-section": "true",
|
|
9352
|
+
style: {
|
|
9353
|
+
display: "grid",
|
|
9354
|
+
gap: "10px"
|
|
9355
|
+
},
|
|
9356
|
+
children: /* @__PURE__ */ u("label", {
|
|
9357
|
+
style: {
|
|
9358
|
+
display: "flex",
|
|
9359
|
+
alignItems: "center",
|
|
9360
|
+
justifyContent: "space-between",
|
|
9361
|
+
gap: "12px",
|
|
9362
|
+
border: "1px solid #d6dde8",
|
|
9363
|
+
borderRadius: "6px",
|
|
9364
|
+
padding: "10px",
|
|
9365
|
+
cursor: "pointer"
|
|
9366
|
+
},
|
|
9367
|
+
children: [/* @__PURE__ */ u("span", {
|
|
9368
|
+
style: { fontWeight: 700 },
|
|
9369
|
+
children: "Copy element path after inspect"
|
|
9370
|
+
}), /* @__PURE__ */ u("input", {
|
|
9371
|
+
type: "checkbox",
|
|
9372
|
+
"data-setting": "copy-element-path-after-inspect",
|
|
9373
|
+
checked: props.copyElementPathAfterInspect.value,
|
|
9374
|
+
onChange: (event) => {
|
|
9375
|
+
props.onCopyElementPathAfterInspectChange(event.currentTarget.checked);
|
|
9376
|
+
},
|
|
9377
|
+
style: { margin: 0 }
|
|
9378
|
+
})]
|
|
9379
|
+
})
|
|
9380
|
+
});
|
|
9381
|
+
}
|
|
9067
9382
|
function StyleModuleSection(props) {
|
|
9068
9383
|
const { state, pendingChanges, preview, forcedPreviewStates, expandedShorthandInputs, shorthandFocusRequest, colorTokenOptions, fontTokenOptions, tokenSources, propertyOptions, saving, addedInputActivationRequest, onPreviewInput, onCreateColorToken, onAddedInputActivationHandled, onAddProperty, onRemoveProperty, onFocusRestoreButton, onFocusPreviewControl, onRestoreProperty, onHighlightSourceTarget, onClearHighlight, onOpenSource, onInputMenuOpenChange, onToggleShorthandInput, onExpandShorthandInput, onCollapseShorthandInput, onRequestShorthandFocus, onShorthandFocusRequestHandled, onAddSource } = props;
|
|
9069
9384
|
if (state.value.status === "idle") return null;
|
|
@@ -9129,6 +9444,7 @@ function StyleModuleSection(props) {
|
|
|
9129
9444
|
editable: editableStyleTargets.length > 0,
|
|
9130
9445
|
styleRows: editableStyleTargets.flatMap((target) => target.styleRows),
|
|
9131
9446
|
editableTargets: editableStyleTargets,
|
|
9447
|
+
inheritedTargets: [],
|
|
9132
9448
|
inlineSourceCreate: void 0,
|
|
9133
9449
|
inspectedJsxSource: void 0,
|
|
9134
9450
|
inspectedComponentSource: void 0,
|
|
@@ -9242,7 +9558,9 @@ function StyleModuleSection(props) {
|
|
|
9242
9558
|
});
|
|
9243
9559
|
}
|
|
9244
9560
|
function EditableTargetsSection(props) {
|
|
9245
|
-
const { view, preview, elementStyleModule, heading = "Style Sources", forcedPreviewStates, expandedShorthandInputs, shorthandFocusRequest, colorTokenOptions, fontTokenOptions, tokenSources, propertyOptions, saving, addedInputActivationRequest, onPreviewInput, onCreateColorToken, onAddedInputActivationHandled, onAddProperty, onCreateInlineSource, onAttachStyleModuleSource, onDetachStyleModuleSource, onRemoveProperty, onFocusRestoreButton, onFocusPreviewControl, onRestoreProperty, onHighlightSourceTarget, onClearHighlight, onOpenSource, onInputMenuOpenChange, onToggleShorthandInput, onExpandShorthandInput, onCollapseShorthandInput, onRequestShorthandFocus, onShorthandFocusRequestHandled } = props;
|
|
9561
|
+
const { view, targets, preview, elementStyleModule, heading = "Style Sources", forcedPreviewStates, expandedShorthandInputs, shorthandFocusRequest, colorTokenOptions, fontTokenOptions, tokenSources, propertyOptions, saving, addedInputActivationRequest, onPreviewInput, onCreateColorToken, onAddedInputActivationHandled, onAddProperty, onCreateInlineSource, onAttachStyleModuleSource, onDetachStyleModuleSource, onRemoveProperty, onFocusRestoreButton, onFocusPreviewControl, onRestoreProperty, onHighlightSourceTarget, onClearHighlight, onOpenSource, onInputMenuOpenChange, onToggleShorthandInput, onExpandShorthandInput, onCollapseShorthandInput, onRequestShorthandFocus, onShorthandFocusRequestHandled } = props;
|
|
9562
|
+
const sourceManagementEnabled = targets === void 0;
|
|
9563
|
+
const baseEditableTargets = targets ?? view.value.editableTargets;
|
|
9246
9564
|
const inspectedJsxSource = view.value.inspectedJsxSource;
|
|
9247
9565
|
const inspectedComponentSource = view.value.inspectedComponentSource;
|
|
9248
9566
|
const readyElementStyleModule = elementStyleModule?.value.status === "ready" && elementStyleModule.value.componentSource === inspectedComponentSource && elementStyleModule.value.module.exists ? elementStyleModule.value.module : void 0;
|
|
@@ -9251,7 +9569,7 @@ function EditableTargetsSection(props) {
|
|
|
9251
9569
|
const action = styleModuleActionForPreviewChange(change);
|
|
9252
9570
|
if (action && action.kind !== "create" && action.componentSource === inspectedComponentSource && action.jsxSource === inspectedJsxSource) styleModulePendingActions.push(action);
|
|
9253
9571
|
}
|
|
9254
|
-
const attachedStyleSourceNames = new Set(
|
|
9572
|
+
const attachedStyleSourceNames = new Set(baseEditableTargets.flatMap((target) => target.name && inspectedJsxSource && (target.jsxSource === inspectedJsxSource || (target.jsxSourceAliases ?? []).includes(inspectedJsxSource)) ? [target.name] : []));
|
|
9255
9573
|
for (const action of styleModulePendingActions) {
|
|
9256
9574
|
if (action.kind === "attach") attachedStyleSourceNames.add(action.name);
|
|
9257
9575
|
if (action.kind === "detach") attachedStyleSourceNames.delete(action.name);
|
|
@@ -9263,7 +9581,26 @@ function EditableTargetsSection(props) {
|
|
|
9263
9581
|
} : void 0;
|
|
9264
9582
|
const canAttachStyleSource = attachStyleSourceContext !== void 0;
|
|
9265
9583
|
const pendingAttachedStyleSources = styleModulePendingActions.filter((action) => action.kind === "attach");
|
|
9266
|
-
|
|
9584
|
+
const pendingAttachedStyleSourceTargets = sourceManagementEnabled && inspectedJsxSource ? pendingAttachedStyleSources.flatMap((action) => {
|
|
9585
|
+
const source = readyElementStyleModule?.sources.find((candidate) => candidate.name === action.name);
|
|
9586
|
+
if (!source?.editId || !source.styleObject) return [];
|
|
9587
|
+
return [{
|
|
9588
|
+
id: source.editId,
|
|
9589
|
+
name: source.name,
|
|
9590
|
+
source: source.file,
|
|
9591
|
+
sourceLocation: source.editId,
|
|
9592
|
+
jsxSource: inspectedJsxSource,
|
|
9593
|
+
styleRows: styleObjectRows(source.styleObject)
|
|
9594
|
+
}];
|
|
9595
|
+
}) : [];
|
|
9596
|
+
const pendingInlineSourceTarget = sourceManagementEnabled ? pendingInlineSourceTargetForView(view.value, preview.changes.value) : void 0;
|
|
9597
|
+
const editableTargets = [
|
|
9598
|
+
...baseEditableTargets,
|
|
9599
|
+
...pendingAttachedStyleSourceTargets,
|
|
9600
|
+
...pendingInlineSourceTarget ? [pendingInlineSourceTarget] : []
|
|
9601
|
+
];
|
|
9602
|
+
const inlineSourceCreate = sourceManagementEnabled && view.value.inlineSourceCreate && !pendingInlineSourceTarget ? view.value.inlineSourceCreate : void 0;
|
|
9603
|
+
if (editableTargets.length === 0 && (!sourceManagementEnabled || !inlineSourceCreate) && (!sourceManagementEnabled || !canAttachStyleSource)) return null;
|
|
9267
9604
|
return /* @__PURE__ */ u("section", {
|
|
9268
9605
|
"data-editable-sources-section": "true",
|
|
9269
9606
|
children: [
|
|
@@ -9274,19 +9611,19 @@ function EditableTargetsSection(props) {
|
|
|
9274
9611
|
},
|
|
9275
9612
|
children: heading
|
|
9276
9613
|
}) : null,
|
|
9277
|
-
|
|
9614
|
+
sourceManagementEnabled && (inlineSourceCreate || canAttachStyleSource) ? /* @__PURE__ */ u("div", {
|
|
9278
9615
|
style: {
|
|
9279
9616
|
display: "flex",
|
|
9280
9617
|
flexWrap: "wrap",
|
|
9281
9618
|
gap: "6px",
|
|
9282
9619
|
marginTop: "4px"
|
|
9283
9620
|
},
|
|
9284
|
-
children: [
|
|
9621
|
+
children: [inlineSourceCreate ? /* @__PURE__ */ u("button", {
|
|
9285
9622
|
type: "button",
|
|
9286
9623
|
"data-action": "create-inline-source",
|
|
9287
9624
|
disabled: saving.value,
|
|
9288
9625
|
onClick: () => {
|
|
9289
|
-
|
|
9626
|
+
onCreateInlineSource(inlineSourceCreate.jsxSource);
|
|
9290
9627
|
},
|
|
9291
9628
|
children: /* @__PURE__ */ u("span", {
|
|
9292
9629
|
style: {
|
|
@@ -9309,40 +9646,7 @@ function EditableTargetsSection(props) {
|
|
|
9309
9646
|
onMenuOpenChange: onInputMenuOpenChange
|
|
9310
9647
|
}) : null]
|
|
9311
9648
|
}) : null,
|
|
9312
|
-
|
|
9313
|
-
style: {
|
|
9314
|
-
display: "grid",
|
|
9315
|
-
gap: "4px",
|
|
9316
|
-
marginTop: "8px"
|
|
9317
|
-
},
|
|
9318
|
-
children: pendingAttachedStyleSources.map((action) => /* @__PURE__ */ u("div", {
|
|
9319
|
-
"data-pending-attached-style-source": "true",
|
|
9320
|
-
style: {
|
|
9321
|
-
display: "grid",
|
|
9322
|
-
gridTemplateColumns: "minmax(0, 1fr) 24px",
|
|
9323
|
-
alignItems: "center",
|
|
9324
|
-
gap: "6px",
|
|
9325
|
-
color: "#526070"
|
|
9326
|
-
},
|
|
9327
|
-
children: [/* @__PURE__ */ u("code", { children: [action.name, " (pending)"] }), /* @__PURE__ */ u("button", {
|
|
9328
|
-
type: "button",
|
|
9329
|
-
"data-action": "detach-style-source",
|
|
9330
|
-
"data-style-source-name": action.name,
|
|
9331
|
-
"data-icon-button": "true",
|
|
9332
|
-
"aria-label": `Remove ${action.name} style source`,
|
|
9333
|
-
title: `Remove ${action.name} style source`,
|
|
9334
|
-
disabled: saving.value,
|
|
9335
|
-
onClick: () => {
|
|
9336
|
-
onDetachStyleModuleSource(action.componentSource, action.jsxSource, action.name);
|
|
9337
|
-
},
|
|
9338
|
-
children: /* @__PURE__ */ u(Trash2, {
|
|
9339
|
-
size: 13,
|
|
9340
|
-
"aria-hidden": "true"
|
|
9341
|
-
})
|
|
9342
|
-
})]
|
|
9343
|
-
}, `${action.componentSource}:${action.jsxSource}:${action.name}`))
|
|
9344
|
-
}) : null,
|
|
9345
|
-
view.value.editableTargets.map((target) => /* @__PURE__ */ u("div", {
|
|
9649
|
+
editableTargets.map((target) => /* @__PURE__ */ u("div", {
|
|
9346
9650
|
"data-editable-target-panel": "true",
|
|
9347
9651
|
"data-editable-target-id": target.id,
|
|
9348
9652
|
style: {
|
|
@@ -9375,6 +9679,13 @@ function EditableTargetsSection(props) {
|
|
|
9375
9679
|
style: { color: "#172033" },
|
|
9376
9680
|
children: target.name
|
|
9377
9681
|
}) : null,
|
|
9682
|
+
"inheritedFrom" in target ? /* @__PURE__ */ u("span", {
|
|
9683
|
+
style: {
|
|
9684
|
+
color: "#667085",
|
|
9685
|
+
fontSize: "12px"
|
|
9686
|
+
},
|
|
9687
|
+
children: ["Inherited from ", target.inheritedFrom]
|
|
9688
|
+
}) : null,
|
|
9378
9689
|
/* @__PURE__ */ u("button", {
|
|
9379
9690
|
type: "button",
|
|
9380
9691
|
"data-action": "open-editable-source-location",
|
|
@@ -9782,18 +10093,20 @@ function EditableTargetsSection(props) {
|
|
|
9782
10093
|
options: propertyOptions,
|
|
9783
10094
|
propertyContext: previewPropertyContext,
|
|
9784
10095
|
saving,
|
|
10096
|
+
autoOpen: target.id === pendingInlineSourceTarget?.id,
|
|
9785
10097
|
onAddProperty,
|
|
9786
10098
|
onMenuOpenChange: onInputMenuOpenChange
|
|
9787
|
-
}) : /* @__PURE__ */ u(AddPropertyMenu, {
|
|
10099
|
+
}) : sourceManagementEnabled ? /* @__PURE__ */ u(AddPropertyMenu, {
|
|
9788
10100
|
targetId: target.id,
|
|
9789
10101
|
pathPrefix: defaultAddPropertyPathPrefix,
|
|
9790
10102
|
existingPaths,
|
|
9791
10103
|
options: propertyOptions,
|
|
9792
10104
|
propertyContext: previewPropertyContext,
|
|
9793
10105
|
saving,
|
|
10106
|
+
autoOpen: target.id === pendingInlineSourceTarget?.id,
|
|
9794
10107
|
onAddProperty,
|
|
9795
10108
|
onMenuOpenChange: onInputMenuOpenChange
|
|
9796
|
-
})
|
|
10109
|
+
}) : null
|
|
9797
10110
|
]
|
|
9798
10111
|
}, group.key)) });
|
|
9799
10112
|
})()]
|
|
@@ -9887,6 +10200,7 @@ function targetRowsWithPendingChanges(target, changes) {
|
|
|
9887
10200
|
for (const change of changes.values()) {
|
|
9888
10201
|
if (change.editId !== target.id || change.op !== "set") continue;
|
|
9889
10202
|
if (isStyleModulePreviewChange(change)) continue;
|
|
10203
|
+
if (isInlineSourcePreviewChange(change)) continue;
|
|
9890
10204
|
const path = change.path.join(".");
|
|
9891
10205
|
if (existingPaths.has(path)) continue;
|
|
9892
10206
|
rows.push({
|
|
@@ -9898,6 +10212,26 @@ function targetRowsWithPendingChanges(target, changes) {
|
|
|
9898
10212
|
}
|
|
9899
10213
|
return rows;
|
|
9900
10214
|
}
|
|
10215
|
+
function editableTargetsWithPendingInlineSource(view, changes) {
|
|
10216
|
+
const pendingInlineSourceTarget = pendingInlineSourceTargetForView(view, changes);
|
|
10217
|
+
return pendingInlineSourceTarget ? [...view.editableTargets, pendingInlineSourceTarget] : view.editableTargets;
|
|
10218
|
+
}
|
|
10219
|
+
function pendingInlineSourceTargetForView(view, changes) {
|
|
10220
|
+
const inlineSourceCreate = view.inlineSourceCreate;
|
|
10221
|
+
if (!inlineSourceCreate) return void 0;
|
|
10222
|
+
const editId = inlineSourcePreviewEditId(inlineSourceCreate.jsxSource);
|
|
10223
|
+
const createChange = changes.get(previewChangeKey(editId, INLINE_SOURCE_PREVIEW_PATH));
|
|
10224
|
+
if (!createChange || !isInlineSourcePreviewChange(createChange)) return void 0;
|
|
10225
|
+
return {
|
|
10226
|
+
id: editId,
|
|
10227
|
+
name: "Inline source (new)",
|
|
10228
|
+
source: inlineSourceCreate.jsxSource.replace(/:\d+:\d+$/, ""),
|
|
10229
|
+
sourceLocation: inlineSourceCreate.jsxSource,
|
|
10230
|
+
attribute: "className",
|
|
10231
|
+
jsxSource: inlineSourceCreate.jsxSource,
|
|
10232
|
+
styleRows: []
|
|
10233
|
+
};
|
|
10234
|
+
}
|
|
9901
10235
|
function propertySelectorOptions(metadata) {
|
|
9902
10236
|
if (metadata?.properties.status !== "available") return [];
|
|
9903
10237
|
return metadata.properties.items.flatMap((property) => {
|
|
@@ -10306,6 +10640,10 @@ function AttachStyleSourceMenu(props) {
|
|
|
10306
10640
|
if (props.saving.value) return;
|
|
10307
10641
|
menuOpen.value = false;
|
|
10308
10642
|
query.value = "";
|
|
10643
|
+
if (previousMenuOpen.current) {
|
|
10644
|
+
props.onMenuOpenChange(false);
|
|
10645
|
+
previousMenuOpen.current = false;
|
|
10646
|
+
}
|
|
10309
10647
|
props.onAttach(props.componentSource, props.jsxSource, option.name);
|
|
10310
10648
|
};
|
|
10311
10649
|
const moveActiveOption = (direction) => {
|
|
@@ -10433,6 +10771,7 @@ function AttachStyleSourceMenu(props) {
|
|
|
10433
10771
|
children: "No matching style sources."
|
|
10434
10772
|
}) : filteredOptions.map((option) => /* @__PURE__ */ u(ShadowMenuItem, {
|
|
10435
10773
|
active: activeSelectableOptionId === option.id,
|
|
10774
|
+
class: "panda-property-selector-menu-item",
|
|
10436
10775
|
disabled: props.saving.value,
|
|
10437
10776
|
onPreview: () => {
|
|
10438
10777
|
activeOptionId.value = option.id;
|
|
@@ -10449,7 +10788,8 @@ function AttachStyleSourceMenu(props) {
|
|
|
10449
10788
|
style: {
|
|
10450
10789
|
minWidth: 0,
|
|
10451
10790
|
display: "grid",
|
|
10452
|
-
gap: "2px"
|
|
10791
|
+
gap: "2px",
|
|
10792
|
+
textAlign: "left"
|
|
10453
10793
|
},
|
|
10454
10794
|
children: [/* @__PURE__ */ u("code", {
|
|
10455
10795
|
style: { color: "#172033" },
|
|
@@ -10553,7 +10893,7 @@ function isVerticalAlignDisplay(display) {
|
|
|
10553
10893
|
return display === "inline" || display === "inline-block" || display === "table-cell";
|
|
10554
10894
|
}
|
|
10555
10895
|
function AddPropertyMenu(props) {
|
|
10556
|
-
const menuOpen = useSignal(
|
|
10896
|
+
const menuOpen = useSignal(props.autoOpen === true);
|
|
10557
10897
|
const query = useSignal("");
|
|
10558
10898
|
const activeOptionId = useSignal();
|
|
10559
10899
|
const trigger = A$1(null);
|
|
@@ -10977,11 +11317,19 @@ function ComponentLayersSection(props) {
|
|
|
10977
11317
|
})] });
|
|
10978
11318
|
}
|
|
10979
11319
|
function componentLayerElementIdentity(view, layerIndex, elementIndex, jsxSource) {
|
|
10980
|
-
|
|
11320
|
+
return componentLayerElementIdentityFromLayers(view.componentLayers, layerIndex, elementIndex, jsxSource);
|
|
11321
|
+
}
|
|
11322
|
+
function componentLayerElementIdentityFromLayers(layers, layerIndex, elementIndex, jsxSource) {
|
|
10981
11323
|
const parentComponents = layers.slice(layerIndex).toReversed().map((layer) => layer.component);
|
|
10982
11324
|
const elementPath = layers[layerIndex]?.elements.slice(elementIndex).toReversed().map((element) => element.tagName);
|
|
10983
11325
|
return `I want to edit the following JSX element:\n ${[...parentComponents, ...elementPath ?? []].join(" → ")}${sourceLocationAvailable(jsxSource) ? `\n (found at ${jsxSource})` : ""}\n\n\n`;
|
|
10984
11326
|
}
|
|
11327
|
+
function inspectedElementIdentityFromLayers(layers) {
|
|
11328
|
+
for (const [layerIndex, layer] of layers.entries()) {
|
|
11329
|
+
const elementIndex = layer.elements.findIndex((element) => element.inspected === true);
|
|
11330
|
+
if (elementIndex !== -1) return componentLayerElementIdentityFromLayers(layers, layerIndex, elementIndex, layer.elements[elementIndex]?.source);
|
|
11331
|
+
}
|
|
11332
|
+
}
|
|
10985
11333
|
function componentLayerSource(layer) {
|
|
10986
11334
|
return layer.elements.find((element) => sourceLocationAvailable(element.source))?.source;
|
|
10987
11335
|
}
|
|
@@ -11031,12 +11379,19 @@ function ComputedRowsSection(props) {
|
|
|
11031
11379
|
gridTemplateColumns: "120px 1fr",
|
|
11032
11380
|
gap: "8px",
|
|
11033
11381
|
marginTop: "4px",
|
|
11034
|
-
color: "#526070"
|
|
11382
|
+
color: "#526070",
|
|
11383
|
+
userSelect: "text"
|
|
11035
11384
|
},
|
|
11036
|
-
children: [/* @__PURE__ */ u("code", {
|
|
11385
|
+
children: [/* @__PURE__ */ u("code", {
|
|
11386
|
+
"data-computed-css-property": "true",
|
|
11387
|
+
style: { userSelect: "text" },
|
|
11388
|
+
children: row.property
|
|
11389
|
+
}), /* @__PURE__ */ u("code", {
|
|
11390
|
+
"data-computed-css-value": "true",
|
|
11037
11391
|
style: {
|
|
11038
11392
|
whiteSpace: "normal",
|
|
11039
|
-
wordBreak: "break-word"
|
|
11393
|
+
wordBreak: "break-word",
|
|
11394
|
+
userSelect: "text"
|
|
11040
11395
|
},
|
|
11041
11396
|
children: row.value
|
|
11042
11397
|
})]
|
|
@@ -11108,6 +11463,9 @@ function isInspectorOwnedElement(element) {
|
|
|
11108
11463
|
function isShadowRoot(root) {
|
|
11109
11464
|
return typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot;
|
|
11110
11465
|
}
|
|
11466
|
+
function logUnexpectedInspectorError(message, error) {
|
|
11467
|
+
console.error(`[sculpted] ${message}`, error);
|
|
11468
|
+
}
|
|
11111
11469
|
function isOnlyShiftAlt(event) {
|
|
11112
11470
|
return event.shiftKey && event.altKey && !event.ctrlKey && !event.metaKey;
|
|
11113
11471
|
}
|