@orion-studios/payload-studio 0.6.0-beta.113 → 0.6.0-beta.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-v2/client.js +171 -8
- package/dist/builder-v2/client.mjs +171 -8
- package/dist/builder-v2/styles.css +42 -0
- package/package.json +1 -1
|
@@ -695,6 +695,51 @@ var syncModelBackgroundToBlock = (model) => {
|
|
|
695
695
|
})
|
|
696
696
|
});
|
|
697
697
|
};
|
|
698
|
+
var spacingLonghands = [
|
|
699
|
+
"margin-top",
|
|
700
|
+
"margin-bottom",
|
|
701
|
+
"margin-left",
|
|
702
|
+
"margin-right",
|
|
703
|
+
"padding-top",
|
|
704
|
+
"padding-bottom",
|
|
705
|
+
"padding-left",
|
|
706
|
+
"padding-right"
|
|
707
|
+
];
|
|
708
|
+
var hasSpacingStyle = (style, property) => Boolean(style[property] || style[property.replace(/-([a-z])/g, (_, char) => char.toUpperCase())]);
|
|
709
|
+
var hoistPreviewSpacingToModel = (view) => {
|
|
710
|
+
const element = view.el;
|
|
711
|
+
const preview = element?.querySelector?.(".xo-builder-preview");
|
|
712
|
+
if (!preview) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
const model = view.model;
|
|
716
|
+
const style = model.getStyle?.() || {};
|
|
717
|
+
const computed = window.getComputedStyle(preview);
|
|
718
|
+
const nextStyle = {};
|
|
719
|
+
spacingLonghands.forEach((property) => {
|
|
720
|
+
const isPadding = property.startsWith("padding-");
|
|
721
|
+
if (hasSpacingStyle(style, property) || hasSpacingStyle(style, isPadding ? "padding" : "margin")) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const value = computed.getPropertyValue(property).trim();
|
|
725
|
+
if (value && (isPadding || value !== "0px")) {
|
|
726
|
+
nextStyle[property] = value;
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
if (Object.keys(nextStyle).length > 0) {
|
|
730
|
+
model.addStyle?.(nextStyle);
|
|
731
|
+
}
|
|
732
|
+
preview.style.margin = "0";
|
|
733
|
+
preview.style.marginTop = "0";
|
|
734
|
+
preview.style.marginRight = "0";
|
|
735
|
+
preview.style.marginBottom = "0";
|
|
736
|
+
preview.style.marginLeft = "0";
|
|
737
|
+
preview.style.padding = "0";
|
|
738
|
+
preview.style.paddingTop = "0";
|
|
739
|
+
preview.style.paddingRight = "0";
|
|
740
|
+
preview.style.paddingBottom = "0";
|
|
741
|
+
preview.style.paddingLeft = "0";
|
|
742
|
+
};
|
|
698
743
|
var previewForDefinition = (definition, props) => definition.editorPreview?.(props) || `<div class="orion-builder-v2-dynamic-placeholder"><strong>${definition.label}</strong></div>`;
|
|
699
744
|
var blockPreviewForDefinition = (type) => {
|
|
700
745
|
const normalizedType = type.replace(/[^a-z0-9-]/gi, "-");
|
|
@@ -1032,6 +1077,7 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
1032
1077
|
this.model.addAttributes?.({ "data-orion-background-color": backgroundColor });
|
|
1033
1078
|
}
|
|
1034
1079
|
this.model.components(previewForDefinition(definition, props));
|
|
1080
|
+
hoistPreviewSpacingToModel(this);
|
|
1035
1081
|
lockPreviewChildren(this.model);
|
|
1036
1082
|
queueMicrotask(() => bindEditablePreview(this, editor));
|
|
1037
1083
|
}
|
|
@@ -1201,6 +1247,53 @@ var decorateBuilderColorEyeDroppers = (root = document) => {
|
|
|
1201
1247
|
swatch.insertAdjacentElement("afterend", button);
|
|
1202
1248
|
});
|
|
1203
1249
|
};
|
|
1250
|
+
var decorateBuilderNumericSteppers = (root = document) => {
|
|
1251
|
+
const panel = document.getElementById("orion-builder-v2-styles");
|
|
1252
|
+
if (!panel || !("querySelector" in root)) {
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
stepperProperties.forEach((property) => {
|
|
1256
|
+
const control = panel.querySelector(`.gjs-sm-property__${CSS.escape(property)}`);
|
|
1257
|
+
const field = control?.querySelector(".gjs-field");
|
|
1258
|
+
const input = field?.querySelector("input");
|
|
1259
|
+
if (!field || !input || field.querySelector(".orion-builder-v2-stepper")) {
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
field.classList.add("has-orion-builder-stepper");
|
|
1263
|
+
const stepper = document.createElement("span");
|
|
1264
|
+
stepper.className = "orion-builder-v2-stepper";
|
|
1265
|
+
const updateValue = (direction) => {
|
|
1266
|
+
const current = Number.parseFloat(input.value || "0");
|
|
1267
|
+
const next = Number.isFinite(current) ? current + direction : direction;
|
|
1268
|
+
input.value = Number.isInteger(next) ? String(next) : String(Number(next.toFixed(2)));
|
|
1269
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true, inputType: "insertText" }));
|
|
1270
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1271
|
+
};
|
|
1272
|
+
[
|
|
1273
|
+
{ className: "is-up", direction: 1, label: "Increase", text: "\u25B2" },
|
|
1274
|
+
{ className: "is-down", direction: -1, label: "Decrease", text: "\u25BC" }
|
|
1275
|
+
].forEach((step) => {
|
|
1276
|
+
const button = document.createElement("button");
|
|
1277
|
+
button.type = "button";
|
|
1278
|
+
button.className = `orion-builder-v2-stepper-button ${step.className}`;
|
|
1279
|
+
button.setAttribute("aria-label", `${step.label} ${property.replace(/-/g, " ")}`);
|
|
1280
|
+
button.textContent = step.text;
|
|
1281
|
+
button.addEventListener("click", (event) => {
|
|
1282
|
+
event.preventDefault();
|
|
1283
|
+
event.stopPropagation();
|
|
1284
|
+
updateValue(step.direction);
|
|
1285
|
+
input.focus();
|
|
1286
|
+
});
|
|
1287
|
+
stepper.appendChild(button);
|
|
1288
|
+
});
|
|
1289
|
+
field.appendChild(stepper);
|
|
1290
|
+
});
|
|
1291
|
+
};
|
|
1292
|
+
var decorateBuilderControls = (root = document) => {
|
|
1293
|
+
decorateBuilderSettingHelp(root);
|
|
1294
|
+
decorateBuilderColorEyeDroppers(root);
|
|
1295
|
+
decorateBuilderNumericSteppers(root);
|
|
1296
|
+
};
|
|
1204
1297
|
var closeBuilderHelpPopovers = (except) => {
|
|
1205
1298
|
document.querySelectorAll(".is-builder-help-open").forEach((element) => {
|
|
1206
1299
|
if (element !== except) {
|
|
@@ -1511,6 +1604,11 @@ var readStylePanelColor = (property) => {
|
|
|
1511
1604
|
return swatchColor;
|
|
1512
1605
|
};
|
|
1513
1606
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1607
|
+
var propertyNameFromStyleControl = (element) => {
|
|
1608
|
+
const property = element?.closest(".gjs-sm-property");
|
|
1609
|
+
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
1610
|
+
return className?.replace(/^gjs-sm-property__/, "") || "";
|
|
1611
|
+
};
|
|
1514
1612
|
var writeStylePanelLength = (property, value) => {
|
|
1515
1613
|
const control = readStylePanelValue(property);
|
|
1516
1614
|
const input = control?.querySelector("input");
|
|
@@ -1540,8 +1638,58 @@ var spacingProperties = [
|
|
|
1540
1638
|
];
|
|
1541
1639
|
var spacingTargetForComponent = (component) => {
|
|
1542
1640
|
const element = component?.getEl?.();
|
|
1543
|
-
return element
|
|
1544
|
-
};
|
|
1641
|
+
return element || null;
|
|
1642
|
+
};
|
|
1643
|
+
var liveStyleProperties = /* @__PURE__ */ new Set([
|
|
1644
|
+
"align-items",
|
|
1645
|
+
"bottom",
|
|
1646
|
+
"flex-direction",
|
|
1647
|
+
"flex-wrap",
|
|
1648
|
+
"font-size",
|
|
1649
|
+
"font-weight",
|
|
1650
|
+
"gap",
|
|
1651
|
+
"height",
|
|
1652
|
+
"justify-content",
|
|
1653
|
+
"left",
|
|
1654
|
+
"letter-spacing",
|
|
1655
|
+
"line-height",
|
|
1656
|
+
"margin",
|
|
1657
|
+
"margin-bottom",
|
|
1658
|
+
"margin-left",
|
|
1659
|
+
"margin-right",
|
|
1660
|
+
"margin-top",
|
|
1661
|
+
"min-height",
|
|
1662
|
+
"opacity",
|
|
1663
|
+
"padding",
|
|
1664
|
+
"padding-bottom",
|
|
1665
|
+
"padding-left",
|
|
1666
|
+
"padding-right",
|
|
1667
|
+
"padding-top",
|
|
1668
|
+
"right",
|
|
1669
|
+
"top",
|
|
1670
|
+
"width"
|
|
1671
|
+
]);
|
|
1672
|
+
var stepperProperties = /* @__PURE__ */ new Set([
|
|
1673
|
+
"bottom",
|
|
1674
|
+
"font-size",
|
|
1675
|
+
"gap",
|
|
1676
|
+
"height",
|
|
1677
|
+
"left",
|
|
1678
|
+
"letter-spacing",
|
|
1679
|
+
"line-height",
|
|
1680
|
+
"margin-bottom",
|
|
1681
|
+
"margin-left",
|
|
1682
|
+
"margin-right",
|
|
1683
|
+
"margin-top",
|
|
1684
|
+
"min-height",
|
|
1685
|
+
"padding-bottom",
|
|
1686
|
+
"padding-left",
|
|
1687
|
+
"padding-right",
|
|
1688
|
+
"padding-top",
|
|
1689
|
+
"right",
|
|
1690
|
+
"top",
|
|
1691
|
+
"width"
|
|
1692
|
+
]);
|
|
1545
1693
|
var hasExplicitHorizontalAlign = (block) => {
|
|
1546
1694
|
const settings = readNestedRecord(block, "settings");
|
|
1547
1695
|
const typography = readNestedRecord(settings, "typography");
|
|
@@ -1984,7 +2132,7 @@ function GrapesPageEditor({
|
|
|
1984
2132
|
setSelectionSummary(summarizeSelectedComponent(component));
|
|
1985
2133
|
setQuickLayoutState(readQuickLayoutState(component));
|
|
1986
2134
|
setDetailedLayoutControlState(readDetailedLayoutControlState(component));
|
|
1987
|
-
window.requestAnimationFrame(() =>
|
|
2135
|
+
window.requestAnimationFrame(() => decorateBuilderControls());
|
|
1988
2136
|
};
|
|
1989
2137
|
const applySelectedStyle = (style) => {
|
|
1990
2138
|
const component = selectedComponentRef.current;
|
|
@@ -2005,6 +2153,21 @@ function GrapesPageEditor({
|
|
|
2005
2153
|
rememberComponentSnapshot(component);
|
|
2006
2154
|
refreshSelectedState(component);
|
|
2007
2155
|
};
|
|
2156
|
+
const applyLiveStylePanelValue = (target) => {
|
|
2157
|
+
const property = propertyNameFromStyleControl(target);
|
|
2158
|
+
if (!property || !liveStyleProperties.has(property)) {
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2162
|
+
if (!selected) {
|
|
2163
|
+
return;
|
|
2164
|
+
}
|
|
2165
|
+
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2166
|
+
selectedComponentRef.current = selected;
|
|
2167
|
+
lastSelectedComponentRef.current = selected;
|
|
2168
|
+
selected.addStyle?.({ [property]: value });
|
|
2169
|
+
editorRef.current?.select?.(selected);
|
|
2170
|
+
};
|
|
2008
2171
|
const updateSelectedOrionBlock = (updates) => {
|
|
2009
2172
|
const component = selectedComponentRef.current;
|
|
2010
2173
|
if (!component) {
|
|
@@ -2495,6 +2658,7 @@ function GrapesPageEditor({
|
|
|
2495
2658
|
if (!sidebarPointerActiveRef.current && !activeElement?.closest("#orion-builder-v2-styles")) {
|
|
2496
2659
|
return;
|
|
2497
2660
|
}
|
|
2661
|
+
applyLiveStylePanelValue(target);
|
|
2498
2662
|
stylePanelEditActiveRef.current = true;
|
|
2499
2663
|
if (!stylePanelHistoryBeforeRef.current) {
|
|
2500
2664
|
stylePanelHistoryBeforeRef.current = snapshotComponent(getCurrentOrionBlockTarget(getCurrentStyleTarget()));
|
|
@@ -2790,7 +2954,7 @@ function GrapesPageEditor({
|
|
|
2790
2954
|
setSelectedDevice(editor.getDevice() || "desktop");
|
|
2791
2955
|
runValidation(editor);
|
|
2792
2956
|
updateHistoryState(editor);
|
|
2793
|
-
|
|
2957
|
+
decorateBuilderControls();
|
|
2794
2958
|
setLoading(false);
|
|
2795
2959
|
} catch (initError) {
|
|
2796
2960
|
setError(initError instanceof Error ? initError.message : "Could not load the website builder.");
|
|
@@ -2900,8 +3064,7 @@ function GrapesPageEditor({
|
|
|
2900
3064
|
saveRef.current = save;
|
|
2901
3065
|
}, [saving]);
|
|
2902
3066
|
(0, import_react.useEffect)(() => {
|
|
2903
|
-
|
|
2904
|
-
decorateBuilderColorEyeDroppers();
|
|
3067
|
+
decorateBuilderControls();
|
|
2905
3068
|
const refreshControls = () => refreshSelectedState(selectedComponentRef.current);
|
|
2906
3069
|
const onStylePanelInput = (event) => {
|
|
2907
3070
|
const target = event.target;
|
|
@@ -2910,6 +3073,7 @@ function GrapesPageEditor({
|
|
|
2910
3073
|
if (!sidebarPointerActiveRef.current && !activeElement?.closest("#orion-builder-v2-styles")) {
|
|
2911
3074
|
return;
|
|
2912
3075
|
}
|
|
3076
|
+
applyLiveStylePanelValue(target);
|
|
2913
3077
|
syncStylePanelChange();
|
|
2914
3078
|
}
|
|
2915
3079
|
};
|
|
@@ -2960,8 +3124,7 @@ function GrapesPageEditor({
|
|
|
2960
3124
|
openBuilderHelpPopover(helpTrigger, wrapper, willOpen);
|
|
2961
3125
|
};
|
|
2962
3126
|
const observer = new MutationObserver(() => {
|
|
2963
|
-
|
|
2964
|
-
decorateBuilderColorEyeDroppers();
|
|
3127
|
+
decorateBuilderControls();
|
|
2965
3128
|
});
|
|
2966
3129
|
observer.observe(document.body, {
|
|
2967
3130
|
childList: true,
|
|
@@ -571,6 +571,51 @@ var syncModelBackgroundToBlock = (model) => {
|
|
|
571
571
|
})
|
|
572
572
|
});
|
|
573
573
|
};
|
|
574
|
+
var spacingLonghands = [
|
|
575
|
+
"margin-top",
|
|
576
|
+
"margin-bottom",
|
|
577
|
+
"margin-left",
|
|
578
|
+
"margin-right",
|
|
579
|
+
"padding-top",
|
|
580
|
+
"padding-bottom",
|
|
581
|
+
"padding-left",
|
|
582
|
+
"padding-right"
|
|
583
|
+
];
|
|
584
|
+
var hasSpacingStyle = (style, property) => Boolean(style[property] || style[property.replace(/-([a-z])/g, (_, char) => char.toUpperCase())]);
|
|
585
|
+
var hoistPreviewSpacingToModel = (view) => {
|
|
586
|
+
const element = view.el;
|
|
587
|
+
const preview = element?.querySelector?.(".xo-builder-preview");
|
|
588
|
+
if (!preview) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const model = view.model;
|
|
592
|
+
const style = model.getStyle?.() || {};
|
|
593
|
+
const computed = window.getComputedStyle(preview);
|
|
594
|
+
const nextStyle = {};
|
|
595
|
+
spacingLonghands.forEach((property) => {
|
|
596
|
+
const isPadding = property.startsWith("padding-");
|
|
597
|
+
if (hasSpacingStyle(style, property) || hasSpacingStyle(style, isPadding ? "padding" : "margin")) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
const value = computed.getPropertyValue(property).trim();
|
|
601
|
+
if (value && (isPadding || value !== "0px")) {
|
|
602
|
+
nextStyle[property] = value;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
if (Object.keys(nextStyle).length > 0) {
|
|
606
|
+
model.addStyle?.(nextStyle);
|
|
607
|
+
}
|
|
608
|
+
preview.style.margin = "0";
|
|
609
|
+
preview.style.marginTop = "0";
|
|
610
|
+
preview.style.marginRight = "0";
|
|
611
|
+
preview.style.marginBottom = "0";
|
|
612
|
+
preview.style.marginLeft = "0";
|
|
613
|
+
preview.style.padding = "0";
|
|
614
|
+
preview.style.paddingTop = "0";
|
|
615
|
+
preview.style.paddingRight = "0";
|
|
616
|
+
preview.style.paddingBottom = "0";
|
|
617
|
+
preview.style.paddingLeft = "0";
|
|
618
|
+
};
|
|
574
619
|
var previewForDefinition = (definition, props) => definition.editorPreview?.(props) || `<div class="orion-builder-v2-dynamic-placeholder"><strong>${definition.label}</strong></div>`;
|
|
575
620
|
var blockPreviewForDefinition = (type) => {
|
|
576
621
|
const normalizedType = type.replace(/[^a-z0-9-]/gi, "-");
|
|
@@ -908,6 +953,7 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
908
953
|
this.model.addAttributes?.({ "data-orion-background-color": backgroundColor });
|
|
909
954
|
}
|
|
910
955
|
this.model.components(previewForDefinition(definition, props));
|
|
956
|
+
hoistPreviewSpacingToModel(this);
|
|
911
957
|
lockPreviewChildren(this.model);
|
|
912
958
|
queueMicrotask(() => bindEditablePreview(this, editor));
|
|
913
959
|
}
|
|
@@ -1077,6 +1123,53 @@ var decorateBuilderColorEyeDroppers = (root = document) => {
|
|
|
1077
1123
|
swatch.insertAdjacentElement("afterend", button);
|
|
1078
1124
|
});
|
|
1079
1125
|
};
|
|
1126
|
+
var decorateBuilderNumericSteppers = (root = document) => {
|
|
1127
|
+
const panel = document.getElementById("orion-builder-v2-styles");
|
|
1128
|
+
if (!panel || !("querySelector" in root)) {
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
stepperProperties.forEach((property) => {
|
|
1132
|
+
const control = panel.querySelector(`.gjs-sm-property__${CSS.escape(property)}`);
|
|
1133
|
+
const field = control?.querySelector(".gjs-field");
|
|
1134
|
+
const input = field?.querySelector("input");
|
|
1135
|
+
if (!field || !input || field.querySelector(".orion-builder-v2-stepper")) {
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
field.classList.add("has-orion-builder-stepper");
|
|
1139
|
+
const stepper = document.createElement("span");
|
|
1140
|
+
stepper.className = "orion-builder-v2-stepper";
|
|
1141
|
+
const updateValue = (direction) => {
|
|
1142
|
+
const current = Number.parseFloat(input.value || "0");
|
|
1143
|
+
const next = Number.isFinite(current) ? current + direction : direction;
|
|
1144
|
+
input.value = Number.isInteger(next) ? String(next) : String(Number(next.toFixed(2)));
|
|
1145
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true, inputType: "insertText" }));
|
|
1146
|
+
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1147
|
+
};
|
|
1148
|
+
[
|
|
1149
|
+
{ className: "is-up", direction: 1, label: "Increase", text: "\u25B2" },
|
|
1150
|
+
{ className: "is-down", direction: -1, label: "Decrease", text: "\u25BC" }
|
|
1151
|
+
].forEach((step) => {
|
|
1152
|
+
const button = document.createElement("button");
|
|
1153
|
+
button.type = "button";
|
|
1154
|
+
button.className = `orion-builder-v2-stepper-button ${step.className}`;
|
|
1155
|
+
button.setAttribute("aria-label", `${step.label} ${property.replace(/-/g, " ")}`);
|
|
1156
|
+
button.textContent = step.text;
|
|
1157
|
+
button.addEventListener("click", (event) => {
|
|
1158
|
+
event.preventDefault();
|
|
1159
|
+
event.stopPropagation();
|
|
1160
|
+
updateValue(step.direction);
|
|
1161
|
+
input.focus();
|
|
1162
|
+
});
|
|
1163
|
+
stepper.appendChild(button);
|
|
1164
|
+
});
|
|
1165
|
+
field.appendChild(stepper);
|
|
1166
|
+
});
|
|
1167
|
+
};
|
|
1168
|
+
var decorateBuilderControls = (root = document) => {
|
|
1169
|
+
decorateBuilderSettingHelp(root);
|
|
1170
|
+
decorateBuilderColorEyeDroppers(root);
|
|
1171
|
+
decorateBuilderNumericSteppers(root);
|
|
1172
|
+
};
|
|
1080
1173
|
var closeBuilderHelpPopovers = (except) => {
|
|
1081
1174
|
document.querySelectorAll(".is-builder-help-open").forEach((element) => {
|
|
1082
1175
|
if (element !== except) {
|
|
@@ -1387,6 +1480,11 @@ var readStylePanelColor = (property) => {
|
|
|
1387
1480
|
return swatchColor;
|
|
1388
1481
|
};
|
|
1389
1482
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1483
|
+
var propertyNameFromStyleControl = (element) => {
|
|
1484
|
+
const property = element?.closest(".gjs-sm-property");
|
|
1485
|
+
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
1486
|
+
return className?.replace(/^gjs-sm-property__/, "") || "";
|
|
1487
|
+
};
|
|
1390
1488
|
var writeStylePanelLength = (property, value) => {
|
|
1391
1489
|
const control = readStylePanelValue(property);
|
|
1392
1490
|
const input = control?.querySelector("input");
|
|
@@ -1416,8 +1514,58 @@ var spacingProperties = [
|
|
|
1416
1514
|
];
|
|
1417
1515
|
var spacingTargetForComponent = (component) => {
|
|
1418
1516
|
const element = component?.getEl?.();
|
|
1419
|
-
return element
|
|
1420
|
-
};
|
|
1517
|
+
return element || null;
|
|
1518
|
+
};
|
|
1519
|
+
var liveStyleProperties = /* @__PURE__ */ new Set([
|
|
1520
|
+
"align-items",
|
|
1521
|
+
"bottom",
|
|
1522
|
+
"flex-direction",
|
|
1523
|
+
"flex-wrap",
|
|
1524
|
+
"font-size",
|
|
1525
|
+
"font-weight",
|
|
1526
|
+
"gap",
|
|
1527
|
+
"height",
|
|
1528
|
+
"justify-content",
|
|
1529
|
+
"left",
|
|
1530
|
+
"letter-spacing",
|
|
1531
|
+
"line-height",
|
|
1532
|
+
"margin",
|
|
1533
|
+
"margin-bottom",
|
|
1534
|
+
"margin-left",
|
|
1535
|
+
"margin-right",
|
|
1536
|
+
"margin-top",
|
|
1537
|
+
"min-height",
|
|
1538
|
+
"opacity",
|
|
1539
|
+
"padding",
|
|
1540
|
+
"padding-bottom",
|
|
1541
|
+
"padding-left",
|
|
1542
|
+
"padding-right",
|
|
1543
|
+
"padding-top",
|
|
1544
|
+
"right",
|
|
1545
|
+
"top",
|
|
1546
|
+
"width"
|
|
1547
|
+
]);
|
|
1548
|
+
var stepperProperties = /* @__PURE__ */ new Set([
|
|
1549
|
+
"bottom",
|
|
1550
|
+
"font-size",
|
|
1551
|
+
"gap",
|
|
1552
|
+
"height",
|
|
1553
|
+
"left",
|
|
1554
|
+
"letter-spacing",
|
|
1555
|
+
"line-height",
|
|
1556
|
+
"margin-bottom",
|
|
1557
|
+
"margin-left",
|
|
1558
|
+
"margin-right",
|
|
1559
|
+
"margin-top",
|
|
1560
|
+
"min-height",
|
|
1561
|
+
"padding-bottom",
|
|
1562
|
+
"padding-left",
|
|
1563
|
+
"padding-right",
|
|
1564
|
+
"padding-top",
|
|
1565
|
+
"right",
|
|
1566
|
+
"top",
|
|
1567
|
+
"width"
|
|
1568
|
+
]);
|
|
1421
1569
|
var hasExplicitHorizontalAlign = (block) => {
|
|
1422
1570
|
const settings = readNestedRecord(block, "settings");
|
|
1423
1571
|
const typography = readNestedRecord(settings, "typography");
|
|
@@ -1860,7 +2008,7 @@ function GrapesPageEditor({
|
|
|
1860
2008
|
setSelectionSummary(summarizeSelectedComponent(component));
|
|
1861
2009
|
setQuickLayoutState(readQuickLayoutState(component));
|
|
1862
2010
|
setDetailedLayoutControlState(readDetailedLayoutControlState(component));
|
|
1863
|
-
window.requestAnimationFrame(() =>
|
|
2011
|
+
window.requestAnimationFrame(() => decorateBuilderControls());
|
|
1864
2012
|
};
|
|
1865
2013
|
const applySelectedStyle = (style) => {
|
|
1866
2014
|
const component = selectedComponentRef.current;
|
|
@@ -1881,6 +2029,21 @@ function GrapesPageEditor({
|
|
|
1881
2029
|
rememberComponentSnapshot(component);
|
|
1882
2030
|
refreshSelectedState(component);
|
|
1883
2031
|
};
|
|
2032
|
+
const applyLiveStylePanelValue = (target) => {
|
|
2033
|
+
const property = propertyNameFromStyleControl(target);
|
|
2034
|
+
if (!property || !liveStyleProperties.has(property)) {
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2038
|
+
if (!selected) {
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2042
|
+
selectedComponentRef.current = selected;
|
|
2043
|
+
lastSelectedComponentRef.current = selected;
|
|
2044
|
+
selected.addStyle?.({ [property]: value });
|
|
2045
|
+
editorRef.current?.select?.(selected);
|
|
2046
|
+
};
|
|
1884
2047
|
const updateSelectedOrionBlock = (updates) => {
|
|
1885
2048
|
const component = selectedComponentRef.current;
|
|
1886
2049
|
if (!component) {
|
|
@@ -2371,6 +2534,7 @@ function GrapesPageEditor({
|
|
|
2371
2534
|
if (!sidebarPointerActiveRef.current && !activeElement?.closest("#orion-builder-v2-styles")) {
|
|
2372
2535
|
return;
|
|
2373
2536
|
}
|
|
2537
|
+
applyLiveStylePanelValue(target);
|
|
2374
2538
|
stylePanelEditActiveRef.current = true;
|
|
2375
2539
|
if (!stylePanelHistoryBeforeRef.current) {
|
|
2376
2540
|
stylePanelHistoryBeforeRef.current = snapshotComponent(getCurrentOrionBlockTarget(getCurrentStyleTarget()));
|
|
@@ -2666,7 +2830,7 @@ function GrapesPageEditor({
|
|
|
2666
2830
|
setSelectedDevice(editor.getDevice() || "desktop");
|
|
2667
2831
|
runValidation(editor);
|
|
2668
2832
|
updateHistoryState(editor);
|
|
2669
|
-
|
|
2833
|
+
decorateBuilderControls();
|
|
2670
2834
|
setLoading(false);
|
|
2671
2835
|
} catch (initError) {
|
|
2672
2836
|
setError(initError instanceof Error ? initError.message : "Could not load the website builder.");
|
|
@@ -2776,8 +2940,7 @@ function GrapesPageEditor({
|
|
|
2776
2940
|
saveRef.current = save;
|
|
2777
2941
|
}, [saving]);
|
|
2778
2942
|
useEffect(() => {
|
|
2779
|
-
|
|
2780
|
-
decorateBuilderColorEyeDroppers();
|
|
2943
|
+
decorateBuilderControls();
|
|
2781
2944
|
const refreshControls = () => refreshSelectedState(selectedComponentRef.current);
|
|
2782
2945
|
const onStylePanelInput = (event) => {
|
|
2783
2946
|
const target = event.target;
|
|
@@ -2786,6 +2949,7 @@ function GrapesPageEditor({
|
|
|
2786
2949
|
if (!sidebarPointerActiveRef.current && !activeElement?.closest("#orion-builder-v2-styles")) {
|
|
2787
2950
|
return;
|
|
2788
2951
|
}
|
|
2952
|
+
applyLiveStylePanelValue(target);
|
|
2789
2953
|
syncStylePanelChange();
|
|
2790
2954
|
}
|
|
2791
2955
|
};
|
|
@@ -2836,8 +3000,7 @@ function GrapesPageEditor({
|
|
|
2836
3000
|
openBuilderHelpPopover(helpTrigger, wrapper, willOpen);
|
|
2837
3001
|
};
|
|
2838
3002
|
const observer = new MutationObserver(() => {
|
|
2839
|
-
|
|
2840
|
-
decorateBuilderColorEyeDroppers();
|
|
3003
|
+
decorateBuilderControls();
|
|
2841
3004
|
});
|
|
2842
3005
|
observer.observe(document.body, {
|
|
2843
3006
|
childList: true,
|
|
@@ -1365,6 +1365,48 @@
|
|
|
1365
1365
|
padding-right: 8px;
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
|
+
.orion-builder-v2-editor .gjs-field.has-orion-builder-stepper {
|
|
1369
|
+
align-items: stretch;
|
|
1370
|
+
display: grid !important;
|
|
1371
|
+
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
.orion-builder-v2-editor .gjs-field.has-orion-builder-stepper input {
|
|
1375
|
+
min-width: 0;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
.orion-builder-v2-stepper {
|
|
1379
|
+
align-self: stretch;
|
|
1380
|
+
border-left: 1px solid rgba(214, 183, 161, 0.72);
|
|
1381
|
+
display: grid;
|
|
1382
|
+
grid-template-rows: 1fr 1fr;
|
|
1383
|
+
min-height: 34px;
|
|
1384
|
+
width: 24px;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
.orion-builder-v2-stepper-button {
|
|
1388
|
+
align-items: center;
|
|
1389
|
+
appearance: none;
|
|
1390
|
+
background: #fff6ec;
|
|
1391
|
+
border: 0;
|
|
1392
|
+
color: #7a543e;
|
|
1393
|
+
cursor: pointer;
|
|
1394
|
+
display: inline-flex;
|
|
1395
|
+
font: 800 8px/1 var(--font-xo-sans, ui-sans-serif, system-ui, sans-serif);
|
|
1396
|
+
justify-content: center;
|
|
1397
|
+
min-height: 0;
|
|
1398
|
+
padding: 0;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
.orion-builder-v2-stepper-button + .orion-builder-v2-stepper-button {
|
|
1402
|
+
border-top: 1px solid rgba(214, 183, 161, 0.72);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
.orion-builder-v2-stepper-button:hover {
|
|
1406
|
+
background: #f4e2d3;
|
|
1407
|
+
color: #1f2d4d;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1368
1410
|
.orion-builder-v2-editor .gjs-field-color {
|
|
1369
1411
|
cursor: pointer;
|
|
1370
1412
|
display: grid !important;
|
package/package.json
CHANGED