sculpted 0.3.2 → 0.3.4
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-C1gUOAc9.d.mts → runtime-C5jlEq5d.d.mts} +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +5017 -19
- package/dist/{sourceSyntax-U2iybN9L.d.mts → sourceSyntax-BpjcDJyk.d.mts} +1 -1
- package/dist/tsrx.d.mts +1 -1
- package/dist/{types-CdByW0ji.d.mts → types-BWXru9cn.d.mts} +12 -1
- package/dist/ui.d.mts +7 -2
- package/dist/ui.mjs +392 -128
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +553 -186
- package/docs/source-writeback.md +4 -2
- package/docs/vite-plugin.md +11 -2
- package/examples/vite-preact-pandacss/package.json +1 -1
- package/examples/vite-preact-pandacss/postcss.config.cjs +2 -2
- package/examples/vite-preact-pandacss/src/BatchFixtures.tsx +77 -0
- package/examples/vite-preact-pandacss/src/index.css +6 -1
- package/examples/vite-preact-pandacss/src/main.tsx +2 -0
- package/examples/vite-preact-pandacss/vite.config.ts +5 -5
- package/examples/vite-react-pandacss/package.json +1 -1
- package/examples/vite-react-pandacss/src/BatchFixtures.tsx +77 -0
- package/examples/vite-react-pandacss/src/index.css +6 -1
- package/examples/vite-react-pandacss/src/main.tsx +2 -0
- package/package.json +20 -19
package/dist/ui.mjs
CHANGED
|
@@ -7257,6 +7257,7 @@ function selectedElementPanelView(info) {
|
|
|
7257
7257
|
editable: false,
|
|
7258
7258
|
styleRows: [],
|
|
7259
7259
|
editableTargets: [],
|
|
7260
|
+
inheritedTargets: [],
|
|
7260
7261
|
inlineSourceCreate: void 0,
|
|
7261
7262
|
inspectedJsxSource: void 0,
|
|
7262
7263
|
inspectedComponentSource: void 0,
|
|
@@ -7286,6 +7287,7 @@ function selectedElementPanelView(info) {
|
|
|
7286
7287
|
const editable = editableTargets.length > 0;
|
|
7287
7288
|
const styleRows = editableTargets.flatMap((editableTarget) => editableTarget.styleRows);
|
|
7288
7289
|
const editableComputedProperties = editableComputedPropertySet(editableTargets);
|
|
7290
|
+
const inheritedTargets = inheritedEditableTargets(info.evidence?.inheritedStyleSources ?? [], info.evidence?.computedStyles ?? [], editableComputedProperties);
|
|
7289
7291
|
const inspectedJsxSource = inspectedComponentLayerSource(info.evidence?.componentLayers ?? []);
|
|
7290
7292
|
const inspectedComponentSource = inspectedComponentSourceLocation(info.evidence?.componentLayers ?? []);
|
|
7291
7293
|
const hasInlineEditableSource = editableTargets.some((editableTarget) => editableTarget.attribute === "class" || editableTarget.attribute === "className");
|
|
@@ -7296,6 +7298,7 @@ function selectedElementPanelView(info) {
|
|
|
7296
7298
|
editable,
|
|
7297
7299
|
styleRows,
|
|
7298
7300
|
editableTargets,
|
|
7301
|
+
inheritedTargets,
|
|
7299
7302
|
inlineSourceCreate: inspectedJsxSource && !hasInlineEditableSource ? { jsxSource: inspectedJsxSource } : void 0,
|
|
7300
7303
|
inspectedJsxSource,
|
|
7301
7304
|
inspectedComponentSource,
|
|
@@ -7361,6 +7364,52 @@ function previewInputValue(value, path) {
|
|
|
7361
7364
|
function visibleComputedRows(computedStyles, editableComputedProperties = /* @__PURE__ */ new Set()) {
|
|
7362
7365
|
return computedStyles.filter((row) => !isKnownInitialComputedValue(row) && !editableComputedProperties.has(row.property.toLowerCase())).slice(0, 16);
|
|
7363
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
|
+
}
|
|
7364
7413
|
function editableComputedPropertySet(targets) {
|
|
7365
7414
|
const properties = /* @__PURE__ */ new Set();
|
|
7366
7415
|
for (const target of targets) for (const row of target.styleRows) {
|
|
@@ -7412,6 +7461,21 @@ const KNOWN_COMPUTED_INITIAL_VALUES = {
|
|
|
7412
7461
|
"z-index": "auto"
|
|
7413
7462
|
};
|
|
7414
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"],
|
|
7415
7479
|
border: [
|
|
7416
7480
|
"border-bottom-color",
|
|
7417
7481
|
"border-bottom-style",
|
|
@@ -7443,6 +7507,39 @@ const COMPUTED_PROPERTY_EXPANSIONS = {
|
|
|
7443
7507
|
"padding-inline": ["padding-left", "padding-right"],
|
|
7444
7508
|
"padding-block": ["padding-bottom", "padding-top"]
|
|
7445
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
|
+
]);
|
|
7446
7543
|
function isStyleValue(value) {
|
|
7447
7544
|
return value.kind === "literal" || value.kind === "unsupported";
|
|
7448
7545
|
}
|
|
@@ -7662,11 +7759,11 @@ function InspectorPanel(props) {
|
|
|
7662
7759
|
const contentScroller = A$1(null);
|
|
7663
7760
|
const previousPreviewBarVisible = A$1(false);
|
|
7664
7761
|
const pendingPreviewBarScrollDelta = A$1(0);
|
|
7665
|
-
const
|
|
7666
|
-
const previewBarVisible = useSignal(false);
|
|
7762
|
+
const inputMenuOpen = useSignal(false);
|
|
7667
7763
|
const view = useComputed(() => selectedElementPanelView(selected.value));
|
|
7668
7764
|
const inspectedComponentSource = useComputed(() => view.value.inspectedComponentSource);
|
|
7669
7765
|
const previewChangeCount = useComputed(() => pendingPreviewChanges.value.size);
|
|
7766
|
+
const previewBarVisible = useComputed(() => previewChangeCount.value > 0 && !inputMenuOpen.value);
|
|
7670
7767
|
const canUndoPreview = useComputed(() => previewUndoStack.value.length > 0 || previewHistoryBatchOpen.value);
|
|
7671
7768
|
const canRedoPreview = useComputed(() => previewRedoStack.value.length > 0);
|
|
7672
7769
|
const saving = useComputed(() => saveFlow.value.status === "saving");
|
|
@@ -7716,6 +7813,7 @@ function InspectorPanel(props) {
|
|
|
7716
7813
|
};
|
|
7717
7814
|
}, (error) => {
|
|
7718
7815
|
if (inspectedComponentSource.value !== componentSource) return;
|
|
7816
|
+
logUnexpectedInspectorError("Failed to load component style module.", error);
|
|
7719
7817
|
elementStyleModule.value = {
|
|
7720
7818
|
status: "error",
|
|
7721
7819
|
componentSource,
|
|
@@ -7724,13 +7822,11 @@ function InspectorPanel(props) {
|
|
|
7724
7822
|
});
|
|
7725
7823
|
}, [inspectedComponentSource.value]);
|
|
7726
7824
|
_$2(() => {
|
|
7727
|
-
const visible =
|
|
7728
|
-
if (inputMenuOpenCount.value > 0) return;
|
|
7825
|
+
const visible = previewBarVisible.value;
|
|
7729
7826
|
if (visible === previousPreviewBarVisible.current) return;
|
|
7730
7827
|
pendingPreviewBarScrollDelta.current += visible ? PREVIEW_CHANGES_BAR_HEIGHT : -45;
|
|
7731
7828
|
previousPreviewBarVisible.current = visible;
|
|
7732
|
-
|
|
7733
|
-
}, [previewChangeCount.value > 0, inputMenuOpenCount.value]);
|
|
7829
|
+
}, [previewBarVisible.value]);
|
|
7734
7830
|
_$2(() => {
|
|
7735
7831
|
const scrollDelta = pendingPreviewBarScrollDelta.current;
|
|
7736
7832
|
if (scrollDelta === 0) return;
|
|
@@ -7740,7 +7836,7 @@ function InspectorPanel(props) {
|
|
|
7740
7836
|
scroller.scrollTop = Math.max(0, scroller.scrollTop + scrollDelta);
|
|
7741
7837
|
}, [previewBarVisible.value]);
|
|
7742
7838
|
const onInputMenuOpenChange = (open) => {
|
|
7743
|
-
|
|
7839
|
+
inputMenuOpen.value = open;
|
|
7744
7840
|
};
|
|
7745
7841
|
_$2(() => {
|
|
7746
7842
|
const onAddPropertyShortcut = (event) => {
|
|
@@ -7802,7 +7898,8 @@ function InspectorPanel(props) {
|
|
|
7802
7898
|
runtime.applyForcedStates?.(selectedElement.current, Array.from(forcedPreviewStates.value));
|
|
7803
7899
|
const declarationsByEditId = /* @__PURE__ */ new Map();
|
|
7804
7900
|
const includedChangeKeys = /* @__PURE__ */ new Set();
|
|
7805
|
-
|
|
7901
|
+
const previewTargets = editableTargetsWithPendingInlineSource(view.value, pendingPreviewChanges.value);
|
|
7902
|
+
for (const target of previewTargets) for (const row of target.styleRows) {
|
|
7806
7903
|
if (row.previewValue === void 0) continue;
|
|
7807
7904
|
const path = row.path.split(".");
|
|
7808
7905
|
const condition = pandaPreviewCondition(path);
|
|
@@ -8188,7 +8285,10 @@ function InspectorPanel(props) {
|
|
|
8188
8285
|
if (saving.value) return;
|
|
8189
8286
|
const before = pendingPreviewChanges.value;
|
|
8190
8287
|
const next = new Map(before);
|
|
8191
|
-
|
|
8288
|
+
const key = previewChangeKey(editId, path);
|
|
8289
|
+
const existingChange = before.get(key);
|
|
8290
|
+
if (existingChange?.op === "set" && existingChange.originalValue === void 0) next.delete(key);
|
|
8291
|
+
else next.set(key, {
|
|
8192
8292
|
editId,
|
|
8193
8293
|
path,
|
|
8194
8294
|
op: "delete",
|
|
@@ -8246,6 +8346,7 @@ function InspectorPanel(props) {
|
|
|
8246
8346
|
const changesByEditId = /* @__PURE__ */ new Map();
|
|
8247
8347
|
for (const change of pendingPreviewChanges.value.values()) {
|
|
8248
8348
|
if (isInlineSourcePreviewChange(change)) continue;
|
|
8349
|
+
if (change.editId.startsWith("inline-source:")) continue;
|
|
8249
8350
|
if (isStyleModulePreviewChange(change)) continue;
|
|
8250
8351
|
if (styleModuleCreateEditIds.has(change.editId)) continue;
|
|
8251
8352
|
changesByEditId.set(change.editId, [...changesByEditId.get(change.editId) ?? [], change]);
|
|
@@ -8274,10 +8375,24 @@ function InspectorPanel(props) {
|
|
|
8274
8375
|
flushPreviewHistoryBatch();
|
|
8275
8376
|
return Array.from(pendingPreviewChanges.value.values()).flatMap((change) => {
|
|
8276
8377
|
if (!isInlineSourcePreviewChange(change)) return [];
|
|
8378
|
+
const edits = Array.from(pendingPreviewChanges.value.values()).flatMap((propertyChange) => {
|
|
8379
|
+
if (propertyChange.editId !== change.editId) return [];
|
|
8380
|
+
if (isInlineSourcePreviewChange(propertyChange)) return [];
|
|
8381
|
+
if (propertyChange.op === "delete") return [{
|
|
8382
|
+
op: "delete",
|
|
8383
|
+
path: propertyChange.path
|
|
8384
|
+
}];
|
|
8385
|
+
return [{
|
|
8386
|
+
op: "set",
|
|
8387
|
+
path: propertyChange.path,
|
|
8388
|
+
value: propertyChange.value
|
|
8389
|
+
}];
|
|
8390
|
+
});
|
|
8277
8391
|
return [{
|
|
8278
8392
|
editId: change.editId,
|
|
8279
8393
|
kind: "panda-css-inline-source",
|
|
8280
|
-
jsxSource: change.value
|
|
8394
|
+
jsxSource: change.value,
|
|
8395
|
+
edits: edits.length > 0 ? edits : void 0
|
|
8281
8396
|
}];
|
|
8282
8397
|
});
|
|
8283
8398
|
};
|
|
@@ -8330,15 +8445,29 @@ function InspectorPanel(props) {
|
|
|
8330
8445
|
const styleModuleRequests = createStyleModuleRequests();
|
|
8331
8446
|
if (requests.length === 0 && inlineSourceRequests.length === 0 && styleModuleRequests.length === 0) return;
|
|
8332
8447
|
saveFlow.value = { status: "saving" };
|
|
8333
|
-
const
|
|
8334
|
-
const
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8448
|
+
const saveOperationCount = (requests.length > 0 ? 1 : 0) + inlineSourceRequests.length + styleModuleRequests.length;
|
|
8449
|
+
const requestResponses = (write) => {
|
|
8450
|
+
const styleResponses = requests.length > 0 ? runtime.requestStyleEditBatch(requests, write) : Promise.resolve([]);
|
|
8451
|
+
const inlineSourceResponses = Promise.all(inlineSourceRequests.map((request) => runtime.requestInlineCssSource(request, write)));
|
|
8452
|
+
const styleModuleResponses = Promise.all(styleModuleRequests.map((request) => runtime.requestStyleModuleEdit(request, write)));
|
|
8453
|
+
return Promise.all([
|
|
8454
|
+
styleResponses,
|
|
8455
|
+
inlineSourceResponses,
|
|
8456
|
+
styleModuleResponses
|
|
8457
|
+
]).then((responses) => responses.flat());
|
|
8458
|
+
};
|
|
8459
|
+
(async () => {
|
|
8460
|
+
if (saveOperationCount > 1) {
|
|
8461
|
+
const dryRunFailure = (await requestResponses(false)).find((response) => !response.ok);
|
|
8462
|
+
if (dryRunFailure) {
|
|
8463
|
+
saveFlow.value = {
|
|
8464
|
+
status: "error",
|
|
8465
|
+
message: styleEditResponseMessage(dryRunFailure)
|
|
8466
|
+
};
|
|
8467
|
+
return;
|
|
8468
|
+
}
|
|
8469
|
+
}
|
|
8470
|
+
const allResponses = await requestResponses(true);
|
|
8342
8471
|
const failure = allResponses.find((response) => !response.ok);
|
|
8343
8472
|
if (failure) {
|
|
8344
8473
|
saveFlow.value = {
|
|
@@ -8347,6 +8476,9 @@ function InspectorPanel(props) {
|
|
|
8347
8476
|
};
|
|
8348
8477
|
return;
|
|
8349
8478
|
}
|
|
8479
|
+
return allResponses;
|
|
8480
|
+
})().then(async (allResponses) => {
|
|
8481
|
+
if (!allResponses) return;
|
|
8350
8482
|
if (allResponses.find((response) => !response.manifestUpdate)) {
|
|
8351
8483
|
saveFlow.value = {
|
|
8352
8484
|
status: "error",
|
|
@@ -8357,6 +8489,7 @@ function InspectorPanel(props) {
|
|
|
8357
8489
|
try {
|
|
8358
8490
|
await refreshSelectedElementInfo();
|
|
8359
8491
|
} catch (error) {
|
|
8492
|
+
logUnexpectedInspectorError("Failed to refresh selection after save.", error);
|
|
8360
8493
|
saveFlow.value = {
|
|
8361
8494
|
status: "error",
|
|
8362
8495
|
message: errorMessage(error)
|
|
@@ -8367,6 +8500,7 @@ function InspectorPanel(props) {
|
|
|
8367
8500
|
resetPreviewHistory();
|
|
8368
8501
|
saveFlow.value = { status: "idle" };
|
|
8369
8502
|
}, (error) => {
|
|
8503
|
+
logUnexpectedInspectorError("Failed to save preview changes.", error);
|
|
8370
8504
|
saveFlow.value = {
|
|
8371
8505
|
status: "error",
|
|
8372
8506
|
message: errorMessage(error)
|
|
@@ -8403,6 +8537,7 @@ function InspectorPanel(props) {
|
|
|
8403
8537
|
module: response
|
|
8404
8538
|
};
|
|
8405
8539
|
}, (error) => {
|
|
8540
|
+
logUnexpectedInspectorError("Failed to open style module.", error);
|
|
8406
8541
|
styleModulePanel.value = {
|
|
8407
8542
|
status: "error",
|
|
8408
8543
|
component,
|
|
@@ -8698,6 +8833,67 @@ function InspectorPanel(props) {
|
|
|
8698
8833
|
shorthandFocusRequest.value = null;
|
|
8699
8834
|
}
|
|
8700
8835
|
}),
|
|
8836
|
+
/* @__PURE__ */ u(EditableTargetsSection, {
|
|
8837
|
+
heading: "Inherited Styles",
|
|
8838
|
+
targets: view.value.inheritedTargets,
|
|
8839
|
+
view,
|
|
8840
|
+
preview,
|
|
8841
|
+
forcedPreviewStates,
|
|
8842
|
+
expandedShorthandInputs,
|
|
8843
|
+
shorthandFocusRequest,
|
|
8844
|
+
colorTokenOptions,
|
|
8845
|
+
fontTokenOptions,
|
|
8846
|
+
tokenSources,
|
|
8847
|
+
propertyOptions,
|
|
8848
|
+
saving,
|
|
8849
|
+
addedInputActivationRequest,
|
|
8850
|
+
onPreviewInput: updatePreviewInput,
|
|
8851
|
+
onCreateColorToken: createColorToken,
|
|
8852
|
+
onAddedInputActivationHandled: () => {
|
|
8853
|
+
addedInputActivationRequest.value = null;
|
|
8854
|
+
},
|
|
8855
|
+
onAddProperty: addPreviewProperty,
|
|
8856
|
+
onCreateInlineSource: createInlineSource,
|
|
8857
|
+
onRemoveProperty: removePreviewProperty,
|
|
8858
|
+
onFocusRestoreButton: focusRestoreButton,
|
|
8859
|
+
onFocusPreviewControl: focusPreviewControlByTarget,
|
|
8860
|
+
onRestoreProperty: restorePreviewProperty,
|
|
8861
|
+
onHighlightSourceTarget: (editId) => {
|
|
8862
|
+
runtime.highlightSourceTarget(editId);
|
|
8863
|
+
},
|
|
8864
|
+
onClearHighlight: () => {
|
|
8865
|
+
runtime.clearHighlight();
|
|
8866
|
+
},
|
|
8867
|
+
onOpenSource: (source) => {
|
|
8868
|
+
runtime.openSourceLocation({
|
|
8869
|
+
kind: "source",
|
|
8870
|
+
source
|
|
8871
|
+
});
|
|
8872
|
+
},
|
|
8873
|
+
onInputMenuOpenChange,
|
|
8874
|
+
onToggleShorthandInput: (key) => {
|
|
8875
|
+
const next = new Set(expandedShorthandInputs.value);
|
|
8876
|
+
if (next.has(key)) next.delete(key);
|
|
8877
|
+
else next.add(key);
|
|
8878
|
+
expandedShorthandInputs.value = next;
|
|
8879
|
+
},
|
|
8880
|
+
onExpandShorthandInput: (key) => {
|
|
8881
|
+
if (expandedShorthandInputs.value.has(key)) return;
|
|
8882
|
+
expandedShorthandInputs.value = new Set([...expandedShorthandInputs.value, key]);
|
|
8883
|
+
},
|
|
8884
|
+
onCollapseShorthandInput: (key) => {
|
|
8885
|
+
if (!expandedShorthandInputs.value.has(key)) return;
|
|
8886
|
+
const next = new Set(expandedShorthandInputs.value);
|
|
8887
|
+
next.delete(key);
|
|
8888
|
+
expandedShorthandInputs.value = next;
|
|
8889
|
+
},
|
|
8890
|
+
onRequestShorthandFocus: (request) => {
|
|
8891
|
+
shorthandFocusRequest.value = request;
|
|
8892
|
+
},
|
|
8893
|
+
onShorthandFocusRequestHandled: () => {
|
|
8894
|
+
shorthandFocusRequest.value = null;
|
|
8895
|
+
}
|
|
8896
|
+
}),
|
|
8701
8897
|
/* @__PURE__ */ u(ComponentLayersSection, {
|
|
8702
8898
|
view,
|
|
8703
8899
|
onOpenStyleModule: openStyleModule,
|
|
@@ -9251,6 +9447,7 @@ function StyleModuleSection(props) {
|
|
|
9251
9447
|
editable: editableStyleTargets.length > 0,
|
|
9252
9448
|
styleRows: editableStyleTargets.flatMap((target) => target.styleRows),
|
|
9253
9449
|
editableTargets: editableStyleTargets,
|
|
9450
|
+
inheritedTargets: [],
|
|
9254
9451
|
inlineSourceCreate: void 0,
|
|
9255
9452
|
inspectedJsxSource: void 0,
|
|
9256
9453
|
inspectedComponentSource: void 0,
|
|
@@ -9364,7 +9561,9 @@ function StyleModuleSection(props) {
|
|
|
9364
9561
|
});
|
|
9365
9562
|
}
|
|
9366
9563
|
function EditableTargetsSection(props) {
|
|
9367
|
-
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;
|
|
9564
|
+
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;
|
|
9565
|
+
const sourceManagementEnabled = targets === void 0;
|
|
9566
|
+
const baseEditableTargets = targets ?? view.value.editableTargets;
|
|
9368
9567
|
const inspectedJsxSource = view.value.inspectedJsxSource;
|
|
9369
9568
|
const inspectedComponentSource = view.value.inspectedComponentSource;
|
|
9370
9569
|
const readyElementStyleModule = elementStyleModule?.value.status === "ready" && elementStyleModule.value.componentSource === inspectedComponentSource && elementStyleModule.value.module.exists ? elementStyleModule.value.module : void 0;
|
|
@@ -9373,7 +9572,7 @@ function EditableTargetsSection(props) {
|
|
|
9373
9572
|
const action = styleModuleActionForPreviewChange(change);
|
|
9374
9573
|
if (action && action.kind !== "create" && action.componentSource === inspectedComponentSource && action.jsxSource === inspectedJsxSource) styleModulePendingActions.push(action);
|
|
9375
9574
|
}
|
|
9376
|
-
const attachedStyleSourceNames = new Set(
|
|
9575
|
+
const attachedStyleSourceNames = new Set(baseEditableTargets.flatMap((target) => target.name && inspectedJsxSource && (target.jsxSource === inspectedJsxSource || (target.jsxSourceAliases ?? []).includes(inspectedJsxSource)) ? [target.name] : []));
|
|
9377
9576
|
for (const action of styleModulePendingActions) {
|
|
9378
9577
|
if (action.kind === "attach") attachedStyleSourceNames.add(action.name);
|
|
9379
9578
|
if (action.kind === "detach") attachedStyleSourceNames.delete(action.name);
|
|
@@ -9385,7 +9584,26 @@ function EditableTargetsSection(props) {
|
|
|
9385
9584
|
} : void 0;
|
|
9386
9585
|
const canAttachStyleSource = attachStyleSourceContext !== void 0;
|
|
9387
9586
|
const pendingAttachedStyleSources = styleModulePendingActions.filter((action) => action.kind === "attach");
|
|
9388
|
-
|
|
9587
|
+
const pendingAttachedStyleSourceTargets = sourceManagementEnabled && inspectedJsxSource ? pendingAttachedStyleSources.flatMap((action) => {
|
|
9588
|
+
const source = readyElementStyleModule?.sources.find((candidate) => candidate.name === action.name);
|
|
9589
|
+
if (!source?.editId || !source.styleObject) return [];
|
|
9590
|
+
return [{
|
|
9591
|
+
id: source.editId,
|
|
9592
|
+
name: source.name,
|
|
9593
|
+
source: source.file,
|
|
9594
|
+
sourceLocation: source.editId,
|
|
9595
|
+
jsxSource: inspectedJsxSource,
|
|
9596
|
+
styleRows: styleObjectRows(source.styleObject)
|
|
9597
|
+
}];
|
|
9598
|
+
}) : [];
|
|
9599
|
+
const pendingInlineSourceTarget = sourceManagementEnabled ? pendingInlineSourceTargetForView(view.value, preview.changes.value) : void 0;
|
|
9600
|
+
const editableTargets = [
|
|
9601
|
+
...baseEditableTargets,
|
|
9602
|
+
...pendingAttachedStyleSourceTargets,
|
|
9603
|
+
...pendingInlineSourceTarget ? [pendingInlineSourceTarget] : []
|
|
9604
|
+
];
|
|
9605
|
+
const inlineSourceCreate = sourceManagementEnabled && view.value.inlineSourceCreate && !pendingInlineSourceTarget ? view.value.inlineSourceCreate : void 0;
|
|
9606
|
+
if (editableTargets.length === 0 && (!sourceManagementEnabled || !inlineSourceCreate) && (!sourceManagementEnabled || !canAttachStyleSource)) return null;
|
|
9389
9607
|
return /* @__PURE__ */ u("section", {
|
|
9390
9608
|
"data-editable-sources-section": "true",
|
|
9391
9609
|
children: [
|
|
@@ -9396,19 +9614,19 @@ function EditableTargetsSection(props) {
|
|
|
9396
9614
|
},
|
|
9397
9615
|
children: heading
|
|
9398
9616
|
}) : null,
|
|
9399
|
-
|
|
9617
|
+
sourceManagementEnabled && (inlineSourceCreate || canAttachStyleSource) ? /* @__PURE__ */ u("div", {
|
|
9400
9618
|
style: {
|
|
9401
9619
|
display: "flex",
|
|
9402
9620
|
flexWrap: "wrap",
|
|
9403
9621
|
gap: "6px",
|
|
9404
9622
|
marginTop: "4px"
|
|
9405
9623
|
},
|
|
9406
|
-
children: [
|
|
9624
|
+
children: [inlineSourceCreate ? /* @__PURE__ */ u("button", {
|
|
9407
9625
|
type: "button",
|
|
9408
9626
|
"data-action": "create-inline-source",
|
|
9409
9627
|
disabled: saving.value,
|
|
9410
9628
|
onClick: () => {
|
|
9411
|
-
|
|
9629
|
+
onCreateInlineSource(inlineSourceCreate.jsxSource);
|
|
9412
9630
|
},
|
|
9413
9631
|
children: /* @__PURE__ */ u("span", {
|
|
9414
9632
|
style: {
|
|
@@ -9431,40 +9649,7 @@ function EditableTargetsSection(props) {
|
|
|
9431
9649
|
onMenuOpenChange: onInputMenuOpenChange
|
|
9432
9650
|
}) : null]
|
|
9433
9651
|
}) : null,
|
|
9434
|
-
|
|
9435
|
-
style: {
|
|
9436
|
-
display: "grid",
|
|
9437
|
-
gap: "4px",
|
|
9438
|
-
marginTop: "8px"
|
|
9439
|
-
},
|
|
9440
|
-
children: pendingAttachedStyleSources.map((action) => /* @__PURE__ */ u("div", {
|
|
9441
|
-
"data-pending-attached-style-source": "true",
|
|
9442
|
-
style: {
|
|
9443
|
-
display: "grid",
|
|
9444
|
-
gridTemplateColumns: "minmax(0, 1fr) 24px",
|
|
9445
|
-
alignItems: "center",
|
|
9446
|
-
gap: "6px",
|
|
9447
|
-
color: "#526070"
|
|
9448
|
-
},
|
|
9449
|
-
children: [/* @__PURE__ */ u("code", { children: [action.name, " (pending)"] }), /* @__PURE__ */ u("button", {
|
|
9450
|
-
type: "button",
|
|
9451
|
-
"data-action": "detach-style-source",
|
|
9452
|
-
"data-style-source-name": action.name,
|
|
9453
|
-
"data-icon-button": "true",
|
|
9454
|
-
"aria-label": `Remove ${action.name} style source`,
|
|
9455
|
-
title: `Remove ${action.name} style source`,
|
|
9456
|
-
disabled: saving.value,
|
|
9457
|
-
onClick: () => {
|
|
9458
|
-
onDetachStyleModuleSource(action.componentSource, action.jsxSource, action.name);
|
|
9459
|
-
},
|
|
9460
|
-
children: /* @__PURE__ */ u(Trash2, {
|
|
9461
|
-
size: 13,
|
|
9462
|
-
"aria-hidden": "true"
|
|
9463
|
-
})
|
|
9464
|
-
})]
|
|
9465
|
-
}, `${action.componentSource}:${action.jsxSource}:${action.name}`))
|
|
9466
|
-
}) : null,
|
|
9467
|
-
view.value.editableTargets.map((target) => /* @__PURE__ */ u("div", {
|
|
9652
|
+
editableTargets.map((target, targetIndex) => /* @__PURE__ */ u("div", {
|
|
9468
9653
|
"data-editable-target-panel": "true",
|
|
9469
9654
|
"data-editable-target-id": target.id,
|
|
9470
9655
|
style: {
|
|
@@ -9497,6 +9682,13 @@ function EditableTargetsSection(props) {
|
|
|
9497
9682
|
style: { color: "#172033" },
|
|
9498
9683
|
children: target.name
|
|
9499
9684
|
}) : null,
|
|
9685
|
+
"inheritedFrom" in target ? /* @__PURE__ */ u("span", {
|
|
9686
|
+
style: {
|
|
9687
|
+
color: "#667085",
|
|
9688
|
+
fontSize: "12px"
|
|
9689
|
+
},
|
|
9690
|
+
children: ["Inherited from ", target.inheritedFrom]
|
|
9691
|
+
}) : null,
|
|
9500
9692
|
/* @__PURE__ */ u("button", {
|
|
9501
9693
|
type: "button",
|
|
9502
9694
|
"data-action": "open-editable-source-location",
|
|
@@ -9904,18 +10096,21 @@ function EditableTargetsSection(props) {
|
|
|
9904
10096
|
options: propertyOptions,
|
|
9905
10097
|
propertyContext: previewPropertyContext,
|
|
9906
10098
|
saving,
|
|
10099
|
+
autoOpen: target.id === pendingInlineSourceTarget?.id,
|
|
9907
10100
|
onAddProperty,
|
|
9908
10101
|
onMenuOpenChange: onInputMenuOpenChange
|
|
9909
|
-
}) : /* @__PURE__ */ u(AddPropertyMenu, {
|
|
10102
|
+
}) : sourceManagementEnabled ? /* @__PURE__ */ u(AddPropertyMenu, {
|
|
9910
10103
|
targetId: target.id,
|
|
9911
10104
|
pathPrefix: defaultAddPropertyPathPrefix,
|
|
9912
10105
|
existingPaths,
|
|
9913
10106
|
options: propertyOptions,
|
|
9914
10107
|
propertyContext: previewPropertyContext,
|
|
9915
10108
|
saving,
|
|
10109
|
+
autoOpen: target.id === pendingInlineSourceTarget?.id,
|
|
10110
|
+
showShortcutHint: targetIndex === 0,
|
|
9916
10111
|
onAddProperty,
|
|
9917
10112
|
onMenuOpenChange: onInputMenuOpenChange
|
|
9918
|
-
})
|
|
10113
|
+
}) : null
|
|
9919
10114
|
]
|
|
9920
10115
|
}, group.key)) });
|
|
9921
10116
|
})()]
|
|
@@ -10009,6 +10204,7 @@ function targetRowsWithPendingChanges(target, changes) {
|
|
|
10009
10204
|
for (const change of changes.values()) {
|
|
10010
10205
|
if (change.editId !== target.id || change.op !== "set") continue;
|
|
10011
10206
|
if (isStyleModulePreviewChange(change)) continue;
|
|
10207
|
+
if (isInlineSourcePreviewChange(change)) continue;
|
|
10012
10208
|
const path = change.path.join(".");
|
|
10013
10209
|
if (existingPaths.has(path)) continue;
|
|
10014
10210
|
rows.push({
|
|
@@ -10020,6 +10216,26 @@ function targetRowsWithPendingChanges(target, changes) {
|
|
|
10020
10216
|
}
|
|
10021
10217
|
return rows;
|
|
10022
10218
|
}
|
|
10219
|
+
function editableTargetsWithPendingInlineSource(view, changes) {
|
|
10220
|
+
const pendingInlineSourceTarget = pendingInlineSourceTargetForView(view, changes);
|
|
10221
|
+
return pendingInlineSourceTarget ? [...view.editableTargets, pendingInlineSourceTarget] : view.editableTargets;
|
|
10222
|
+
}
|
|
10223
|
+
function pendingInlineSourceTargetForView(view, changes) {
|
|
10224
|
+
const inlineSourceCreate = view.inlineSourceCreate;
|
|
10225
|
+
if (!inlineSourceCreate) return void 0;
|
|
10226
|
+
const editId = inlineSourcePreviewEditId(inlineSourceCreate.jsxSource);
|
|
10227
|
+
const createChange = changes.get(previewChangeKey(editId, INLINE_SOURCE_PREVIEW_PATH));
|
|
10228
|
+
if (!createChange || !isInlineSourcePreviewChange(createChange)) return void 0;
|
|
10229
|
+
return {
|
|
10230
|
+
id: editId,
|
|
10231
|
+
name: "Inline source (new)",
|
|
10232
|
+
source: inlineSourceCreate.jsxSource.replace(/:\d+:\d+$/, ""),
|
|
10233
|
+
sourceLocation: inlineSourceCreate.jsxSource,
|
|
10234
|
+
attribute: "className",
|
|
10235
|
+
jsxSource: inlineSourceCreate.jsxSource,
|
|
10236
|
+
styleRows: []
|
|
10237
|
+
};
|
|
10238
|
+
}
|
|
10023
10239
|
function propertySelectorOptions(metadata) {
|
|
10024
10240
|
if (metadata?.properties.status !== "available") return [];
|
|
10025
10241
|
return metadata.properties.items.flatMap((property) => {
|
|
@@ -10031,13 +10247,8 @@ function propertySelectorOptions(metadata) {
|
|
|
10031
10247
|
label: property.label,
|
|
10032
10248
|
groupLabel: propertyGroupLabel(property),
|
|
10033
10249
|
detail: property.cssProperty ?? property.category,
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
property.cssProperty,
|
|
10037
|
-
property.category,
|
|
10038
|
-
...property.aliases
|
|
10039
|
-
].filter(Boolean).join(" "),
|
|
10040
|
-
defaultValue
|
|
10250
|
+
defaultValue,
|
|
10251
|
+
commonness: property.commonness ?? 1
|
|
10041
10252
|
}];
|
|
10042
10253
|
});
|
|
10043
10254
|
}
|
|
@@ -10191,28 +10402,51 @@ function defaultPropertyUnit(property) {
|
|
|
10191
10402
|
function preparePropertyOption(option) {
|
|
10192
10403
|
return {
|
|
10193
10404
|
option,
|
|
10194
|
-
label: prepare(option.label)
|
|
10195
|
-
detail: prepare(option.detail),
|
|
10196
|
-
searchText: prepare(option.searchText)
|
|
10405
|
+
label: prepare(option.label)
|
|
10197
10406
|
};
|
|
10198
10407
|
}
|
|
10199
10408
|
function filteredPropertyOptions(query, preparedOptions, propertyContext) {
|
|
10200
10409
|
const queryText = query.trim();
|
|
10201
10410
|
if (!queryText) return preparedOptions.map((preparedOption) => preparedOption.option).filter((option) => propertyVisibleByContext(option, propertyContext));
|
|
10202
|
-
return searchFields(queryText, preparedOptions, [
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10411
|
+
return searchFields(queryText, preparedOptions, [{
|
|
10412
|
+
key: "label",
|
|
10413
|
+
extract: (item) => item.label
|
|
10414
|
+
}], { limit: preparedOptions.length }).items.map((match, index) => ({
|
|
10415
|
+
match,
|
|
10416
|
+
index
|
|
10417
|
+
})).sort((left, right) => {
|
|
10418
|
+
const leftExactness = propertyOptionExactness(queryText, left.match.value.option, propertyContext);
|
|
10419
|
+
const rightExactness = propertyOptionExactness(queryText, right.match.value.option, propertyContext);
|
|
10420
|
+
if (rightExactness !== leftExactness) return rightExactness - leftExactness;
|
|
10421
|
+
const rightScore = propertyOptionSearchScore(right.match, propertyVisibleByContext(right.match.value.option, propertyContext), propertyDeboostedByContext(right.match.value.option, propertyContext));
|
|
10422
|
+
const leftScore = propertyOptionSearchScore(left.match, propertyVisibleByContext(left.match.value.option, propertyContext), propertyDeboostedByContext(left.match.value.option, propertyContext));
|
|
10423
|
+
if (rightScore !== leftScore) return rightScore - leftScore;
|
|
10424
|
+
return left.index - right.index;
|
|
10425
|
+
}).map(({ match }) => match.value.option);
|
|
10426
|
+
}
|
|
10427
|
+
function propertyOptionExactness(query, option, context) {
|
|
10428
|
+
const normalizedQuery = query.toLowerCase();
|
|
10429
|
+
const exactTargets = [option.label].flatMap((target) => [
|
|
10430
|
+
target,
|
|
10431
|
+
target.replaceAll("-", ""),
|
|
10432
|
+
target.replaceAll(" ", "")
|
|
10433
|
+
]).map((target) => target.toLowerCase());
|
|
10434
|
+
const exactWordTargets = option.label.split(/[\s-]+/).map((target) => target.toLowerCase()).filter(Boolean);
|
|
10435
|
+
const exactness = exactTargets.some((target) => target === normalizedQuery) ? 4 : exactWordTargets.some((target) => target === normalizedQuery) ? 3 : exactTargets.some((target) => target.startsWith(normalizedQuery)) ? 2 : exactWordTargets.some((target) => target.startsWith(normalizedQuery)) ? 1 : 0;
|
|
10436
|
+
return propertyDeboostedByContext(option, context) ? exactness - 2 : exactness;
|
|
10437
|
+
}
|
|
10438
|
+
function propertyOptionSearchScore(match, applyCommonness, applyContextDeboost) {
|
|
10439
|
+
const contextDeboost = applyContextDeboost ? 1 : 0;
|
|
10440
|
+
if (!applyCommonness || applyContextDeboost) return match.score - contextDeboost;
|
|
10441
|
+
const commonness = match.value.option.commonness;
|
|
10442
|
+
const boundedCommonness = Number.isFinite(commonness) ? Math.max(.25, commonness) : 1;
|
|
10443
|
+
return match.score + Math.log2(boundedCommonness) * .03;
|
|
10444
|
+
}
|
|
10445
|
+
function propertyDeboostedByContext(option, context) {
|
|
10446
|
+
if (!INSET_OFFSET_PROPERTIES.has(option.name)) return false;
|
|
10447
|
+
if (!context) return false;
|
|
10448
|
+
const position = context.position.trim();
|
|
10449
|
+
return position === "static" || position === "relative";
|
|
10216
10450
|
}
|
|
10217
10451
|
function propertyVisibleByContext(option, context) {
|
|
10218
10452
|
if (!context) return true;
|
|
@@ -10428,6 +10662,10 @@ function AttachStyleSourceMenu(props) {
|
|
|
10428
10662
|
if (props.saving.value) return;
|
|
10429
10663
|
menuOpen.value = false;
|
|
10430
10664
|
query.value = "";
|
|
10665
|
+
if (previousMenuOpen.current) {
|
|
10666
|
+
props.onMenuOpenChange(false);
|
|
10667
|
+
previousMenuOpen.current = false;
|
|
10668
|
+
}
|
|
10431
10669
|
props.onAttach(props.componentSource, props.jsxSource, option.name);
|
|
10432
10670
|
};
|
|
10433
10671
|
const moveActiveOption = (direction) => {
|
|
@@ -10555,6 +10793,7 @@ function AttachStyleSourceMenu(props) {
|
|
|
10555
10793
|
children: "No matching style sources."
|
|
10556
10794
|
}) : filteredOptions.map((option) => /* @__PURE__ */ u(ShadowMenuItem, {
|
|
10557
10795
|
active: activeSelectableOptionId === option.id,
|
|
10796
|
+
class: "panda-property-selector-menu-item",
|
|
10558
10797
|
disabled: props.saving.value,
|
|
10559
10798
|
onPreview: () => {
|
|
10560
10799
|
activeOptionId.value = option.id;
|
|
@@ -10571,7 +10810,8 @@ function AttachStyleSourceMenu(props) {
|
|
|
10571
10810
|
style: {
|
|
10572
10811
|
minWidth: 0,
|
|
10573
10812
|
display: "grid",
|
|
10574
|
-
gap: "2px"
|
|
10813
|
+
gap: "2px",
|
|
10814
|
+
textAlign: "left"
|
|
10575
10815
|
},
|
|
10576
10816
|
children: [/* @__PURE__ */ u("code", {
|
|
10577
10817
|
style: { color: "#172033" },
|
|
@@ -10620,6 +10860,13 @@ const STATIC_POSITIONED_PROPERTIES = new Set([
|
|
|
10620
10860
|
"left",
|
|
10621
10861
|
"zIndex"
|
|
10622
10862
|
]);
|
|
10863
|
+
const INSET_OFFSET_PROPERTIES = new Set([
|
|
10864
|
+
"inset",
|
|
10865
|
+
"top",
|
|
10866
|
+
"right",
|
|
10867
|
+
"bottom",
|
|
10868
|
+
"left"
|
|
10869
|
+
]);
|
|
10623
10870
|
const FLEX_CONTAINER_PROPERTIES = new Set([
|
|
10624
10871
|
"flexDirection",
|
|
10625
10872
|
"flexWrap",
|
|
@@ -10675,7 +10922,7 @@ function isVerticalAlignDisplay(display) {
|
|
|
10675
10922
|
return display === "inline" || display === "inline-block" || display === "table-cell";
|
|
10676
10923
|
}
|
|
10677
10924
|
function AddPropertyMenu(props) {
|
|
10678
|
-
const menuOpen = useSignal(
|
|
10925
|
+
const menuOpen = useSignal(props.autoOpen === true);
|
|
10679
10926
|
const query = useSignal("");
|
|
10680
10927
|
const activeOptionId = useSignal();
|
|
10681
10928
|
const trigger = A$1(null);
|
|
@@ -10691,6 +10938,7 @@ function AddPropertyMenu(props) {
|
|
|
10691
10938
|
});
|
|
10692
10939
|
const preparedOptions = availableOptions.map(preparePropertyOption);
|
|
10693
10940
|
const filteredOptions = filteredPropertyOptions(query.value, preparedOptions, props.propertyContext);
|
|
10941
|
+
const hasQuery = query.value.trim().length > 0;
|
|
10694
10942
|
const groupedOptions = groupedPropertyOptions(filteredOptions);
|
|
10695
10943
|
const activeSelectableOptionId = filteredOptions.some((option) => option.id === activeOptionId.value) ? activeOptionId.value : filteredOptions[0]?.id;
|
|
10696
10944
|
const selectOption = (option) => {
|
|
@@ -10714,6 +10962,42 @@ function AddPropertyMenu(props) {
|
|
|
10714
10962
|
const option = filteredOptions.find((item) => item.id === activeSelectableOptionId);
|
|
10715
10963
|
if (option) selectOption(option);
|
|
10716
10964
|
};
|
|
10965
|
+
const renderOption = (option) => /* @__PURE__ */ u(ShadowMenuItem, {
|
|
10966
|
+
active: activeSelectableOptionId === option.id,
|
|
10967
|
+
class: "panda-property-selector-menu-item",
|
|
10968
|
+
disabled: props.saving.value,
|
|
10969
|
+
onSelect: () => {
|
|
10970
|
+
selectOption(option);
|
|
10971
|
+
},
|
|
10972
|
+
children: /* @__PURE__ */ u("span", {
|
|
10973
|
+
"data-property-selector-option": "true",
|
|
10974
|
+
"data-property-selector-option-id": option.id,
|
|
10975
|
+
"data-property-selector-active": activeSelectableOptionId === option.id ? "true" : "false",
|
|
10976
|
+
onClick: (event) => {
|
|
10977
|
+
event.stopPropagation();
|
|
10978
|
+
selectOption(option);
|
|
10979
|
+
},
|
|
10980
|
+
style: {
|
|
10981
|
+
minWidth: 0,
|
|
10982
|
+
display: "grid",
|
|
10983
|
+
gridTemplateColumns: "1fr auto",
|
|
10984
|
+
alignItems: "center",
|
|
10985
|
+
gap: "8px"
|
|
10986
|
+
},
|
|
10987
|
+
children: [/* @__PURE__ */ u("span", {
|
|
10988
|
+
style: {
|
|
10989
|
+
minWidth: 0,
|
|
10990
|
+
overflow: "hidden",
|
|
10991
|
+
textOverflow: "ellipsis",
|
|
10992
|
+
whiteSpace: "nowrap"
|
|
10993
|
+
},
|
|
10994
|
+
children: option.label
|
|
10995
|
+
}), /* @__PURE__ */ u("code", {
|
|
10996
|
+
style: { color: "#667085" },
|
|
10997
|
+
children: option.name
|
|
10998
|
+
})]
|
|
10999
|
+
})
|
|
11000
|
+
}, option.id);
|
|
10717
11001
|
_$2(() => {
|
|
10718
11002
|
if (menuOpen.value) {
|
|
10719
11003
|
if (!previousMenuOpen.current) props.onMenuOpenChange(true);
|
|
@@ -10755,10 +11039,22 @@ function AddPropertyMenu(props) {
|
|
|
10755
11039
|
gap: "6px",
|
|
10756
11040
|
font: "inherit"
|
|
10757
11041
|
},
|
|
10758
|
-
children: [
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
11042
|
+
children: [
|
|
11043
|
+
/* @__PURE__ */ u(Plus, {
|
|
11044
|
+
size: 14,
|
|
11045
|
+
"aria-hidden": "true"
|
|
11046
|
+
}),
|
|
11047
|
+
pathPrefixLabel ? `Add ${statePathLabel(pathPrefixLabel)} property` : "Add property",
|
|
11048
|
+
props.showShortcutHint ? /* @__PURE__ */ u("span", {
|
|
11049
|
+
style: {
|
|
11050
|
+
color: "#98a2b3",
|
|
11051
|
+
fontSize: "11px",
|
|
11052
|
+
fontWeight: 600,
|
|
11053
|
+
transform: "translateY(2px)"
|
|
11054
|
+
},
|
|
11055
|
+
children: "⇧A"
|
|
11056
|
+
}) : null
|
|
11057
|
+
]
|
|
10762
11058
|
})
|
|
10763
11059
|
}), menuOpen.value ? /* @__PURE__ */ u(ShadowMenu, {
|
|
10764
11060
|
open: menuOpen,
|
|
@@ -10830,7 +11126,7 @@ function AddPropertyMenu(props) {
|
|
|
10830
11126
|
padding: "7px 8px"
|
|
10831
11127
|
},
|
|
10832
11128
|
children: "No matching properties."
|
|
10833
|
-
}) : groupedOptions.map((group) => /* @__PURE__ */ u("div", {
|
|
11129
|
+
}) : hasQuery ? filteredOptions.map((option) => renderOption(option)) : groupedOptions.map((group) => /* @__PURE__ */ u("div", {
|
|
10834
11130
|
"data-property-selector-group": group.label,
|
|
10835
11131
|
children: [/* @__PURE__ */ u("div", {
|
|
10836
11132
|
"data-property-selector-group-label": "true",
|
|
@@ -10842,42 +11138,7 @@ function AddPropertyMenu(props) {
|
|
|
10842
11138
|
textTransform: "uppercase"
|
|
10843
11139
|
},
|
|
10844
11140
|
children: group.label
|
|
10845
|
-
}), group.options.map((option) =>
|
|
10846
|
-
active: activeSelectableOptionId === option.id,
|
|
10847
|
-
class: "panda-property-selector-menu-item",
|
|
10848
|
-
disabled: props.saving.value,
|
|
10849
|
-
onSelect: () => {
|
|
10850
|
-
selectOption(option);
|
|
10851
|
-
},
|
|
10852
|
-
children: /* @__PURE__ */ u("span", {
|
|
10853
|
-
"data-property-selector-option": "true",
|
|
10854
|
-
"data-property-selector-option-id": option.id,
|
|
10855
|
-
"data-property-selector-active": activeSelectableOptionId === option.id ? "true" : "false",
|
|
10856
|
-
onClick: (event) => {
|
|
10857
|
-
event.stopPropagation();
|
|
10858
|
-
selectOption(option);
|
|
10859
|
-
},
|
|
10860
|
-
style: {
|
|
10861
|
-
minWidth: 0,
|
|
10862
|
-
display: "grid",
|
|
10863
|
-
gridTemplateColumns: "1fr auto",
|
|
10864
|
-
alignItems: "center",
|
|
10865
|
-
gap: "8px"
|
|
10866
|
-
},
|
|
10867
|
-
children: [/* @__PURE__ */ u("span", {
|
|
10868
|
-
style: {
|
|
10869
|
-
minWidth: 0,
|
|
10870
|
-
overflow: "hidden",
|
|
10871
|
-
textOverflow: "ellipsis",
|
|
10872
|
-
whiteSpace: "nowrap"
|
|
10873
|
-
},
|
|
10874
|
-
children: option.label
|
|
10875
|
-
}), /* @__PURE__ */ u("code", {
|
|
10876
|
-
style: { color: "#667085" },
|
|
10877
|
-
children: option.name
|
|
10878
|
-
})]
|
|
10879
|
-
})
|
|
10880
|
-
}, option.id))]
|
|
11141
|
+
}), group.options.map((option) => renderOption(option))]
|
|
10881
11142
|
}, group.label))
|
|
10882
11143
|
})]
|
|
10883
11144
|
}) : null]
|
|
@@ -11245,6 +11506,9 @@ function isInspectorOwnedElement(element) {
|
|
|
11245
11506
|
function isShadowRoot(root) {
|
|
11246
11507
|
return typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot;
|
|
11247
11508
|
}
|
|
11509
|
+
function logUnexpectedInspectorError(message, error) {
|
|
11510
|
+
console.error(`[sculpted] ${message}`, error);
|
|
11511
|
+
}
|
|
11248
11512
|
function isOnlyShiftAlt(event) {
|
|
11249
11513
|
return event.shiftKey && event.altKey && !event.ctrlKey && !event.metaKey;
|
|
11250
11514
|
}
|