@orion-studios/payload-studio 0.6.0-beta.126 → 0.6.0-beta.127
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 +33 -6
- package/dist/builder-v2/client.mjs +33 -6
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
|
@@ -1117,6 +1117,9 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
1117
1117
|
},
|
|
1118
1118
|
components: "",
|
|
1119
1119
|
droppable: false,
|
|
1120
|
+
highlightable: true,
|
|
1121
|
+
hoverable: true,
|
|
1122
|
+
selectable: true,
|
|
1120
1123
|
tagName: "div",
|
|
1121
1124
|
traits: [
|
|
1122
1125
|
...(definition.traits || []).map((trait) => ({
|
|
@@ -1524,6 +1527,12 @@ var canvasSelectionCss = `
|
|
|
1524
1527
|
outline-color: #c7643d !important;
|
|
1525
1528
|
}
|
|
1526
1529
|
|
|
1530
|
+
.orion-builder-v2-selected-block {
|
|
1531
|
+
outline: 2px solid #c7643d !important;
|
|
1532
|
+
outline-offset: -2px !important;
|
|
1533
|
+
position: relative;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1527
1536
|
.xo-builder-preview-grid {
|
|
1528
1537
|
display: grid;
|
|
1529
1538
|
gap: 22px;
|
|
@@ -2108,7 +2117,7 @@ function GrapesPageEditor({
|
|
|
2108
2117
|
};
|
|
2109
2118
|
const getCurrentStyleTarget = () => selectedComponentRef.current || lastSelectedComponentRef.current || (editorRef.current?.getSelected?.() || null);
|
|
2110
2119
|
const findOrionBlockByElement = (element) => {
|
|
2111
|
-
const target = element?.closest("[data-orion-block]");
|
|
2120
|
+
const target = element?.closest("[data-orion-block], [data-orion-component]");
|
|
2112
2121
|
const targetID = target?.id || "";
|
|
2113
2122
|
if (!targetID) {
|
|
2114
2123
|
return null;
|
|
@@ -2116,14 +2125,14 @@ function GrapesPageEditor({
|
|
|
2116
2125
|
const editor = editorRef.current;
|
|
2117
2126
|
const wrapper = editor?.DomComponents?.getWrapper?.() || null;
|
|
2118
2127
|
const component = wrapper?.find?.(`#${CSS.escape(targetID)}`)?.[0] || null;
|
|
2119
|
-
return
|
|
2128
|
+
return isOrionBlockComponent(component) ? component : null;
|
|
2120
2129
|
};
|
|
2121
2130
|
const findOrionBlockAncestor = (component) => {
|
|
2122
2131
|
let current = component;
|
|
2123
2132
|
const visited = /* @__PURE__ */ new Set();
|
|
2124
2133
|
while (current && !visited.has(current)) {
|
|
2125
2134
|
visited.add(current);
|
|
2126
|
-
if (
|
|
2135
|
+
if (isOrionBlockComponent(current)) {
|
|
2127
2136
|
return current;
|
|
2128
2137
|
}
|
|
2129
2138
|
current = current.parent?.() || null;
|
|
@@ -2134,7 +2143,10 @@ function GrapesPageEditor({
|
|
|
2134
2143
|
const findSelectedCanvasOrionBlock = () => {
|
|
2135
2144
|
const editor = editorRef.current;
|
|
2136
2145
|
const wrapper = editor?.DomComponents?.getWrapper?.() || null;
|
|
2137
|
-
const candidates =
|
|
2146
|
+
const candidates = [
|
|
2147
|
+
...wrapper?.find?.("[data-orion-block]") || [],
|
|
2148
|
+
...wrapper?.find?.("[data-orion-component]") || []
|
|
2149
|
+
];
|
|
2138
2150
|
return candidates.find((candidate) => {
|
|
2139
2151
|
const element = candidate.getEl?.();
|
|
2140
2152
|
return Boolean(
|
|
@@ -2164,10 +2176,11 @@ function GrapesPageEditor({
|
|
|
2164
2176
|
}
|
|
2165
2177
|
const candidates = [
|
|
2166
2178
|
...selectedID ? wrapper.find?.(`#${selectedID}`) || [] : [],
|
|
2167
|
-
...wrapper.find?.("[data-orion-block]") || []
|
|
2179
|
+
...wrapper.find?.("[data-orion-block]") || [],
|
|
2180
|
+
...wrapper.find?.("[data-orion-component]") || []
|
|
2168
2181
|
];
|
|
2169
2182
|
return candidates.find(
|
|
2170
|
-
(candidate) =>
|
|
2183
|
+
(candidate) => isOrionBlockComponent(candidate)
|
|
2171
2184
|
) || component || selected || null;
|
|
2172
2185
|
};
|
|
2173
2186
|
const selectStyleManagerTarget = (component) => {
|
|
@@ -2177,6 +2190,11 @@ function GrapesPageEditor({
|
|
|
2177
2190
|
const editor = editorRef.current;
|
|
2178
2191
|
editor?.StyleManager?.select?.(component);
|
|
2179
2192
|
};
|
|
2193
|
+
const markSelectedCanvasBlock = (component) => {
|
|
2194
|
+
const canvasDocument = editorRef.current?.Canvas?.getDocument?.();
|
|
2195
|
+
canvasDocument?.querySelectorAll(".orion-builder-v2-selected-block").forEach((element) => element.classList.remove("orion-builder-v2-selected-block"));
|
|
2196
|
+
component?.getEl?.()?.classList.add("orion-builder-v2-selected-block");
|
|
2197
|
+
};
|
|
2180
2198
|
const updateSelectedItems = (updater) => {
|
|
2181
2199
|
const component = getCurrentOrionBlockTarget();
|
|
2182
2200
|
if (!component) {
|
|
@@ -2539,6 +2557,7 @@ function GrapesPageEditor({
|
|
|
2539
2557
|
}
|
|
2540
2558
|
hydrateSelectedTypographyStyleFromOrionBlock(component);
|
|
2541
2559
|
rememberComponentSnapshot(component);
|
|
2560
|
+
markSelectedCanvasBlock(component);
|
|
2542
2561
|
refreshSelectedState(component);
|
|
2543
2562
|
window.requestAnimationFrame(() => {
|
|
2544
2563
|
const element = spacingTargetForComponent(component);
|
|
@@ -2692,6 +2711,7 @@ function GrapesPageEditor({
|
|
|
2692
2711
|
editorRef.current?.select?.(snapshot.component);
|
|
2693
2712
|
selectStyleManagerTarget(snapshot.component);
|
|
2694
2713
|
lastComponentSnapshotRef.current.set(snapshot.component, snapshot);
|
|
2714
|
+
markSelectedCanvasBlock(snapshot.component);
|
|
2695
2715
|
refreshSelectedState(snapshot.component);
|
|
2696
2716
|
};
|
|
2697
2717
|
const restoreCustomHistoryEntry = (entry, target) => {
|
|
@@ -2748,6 +2768,7 @@ function GrapesPageEditor({
|
|
|
2748
2768
|
selectedComponentRef.current = selected;
|
|
2749
2769
|
lastSelectedComponentRef.current = selected;
|
|
2750
2770
|
selectStyleManagerTarget(selected);
|
|
2771
|
+
markSelectedCanvasBlock(selected);
|
|
2751
2772
|
refreshSelectedState(selected);
|
|
2752
2773
|
}
|
|
2753
2774
|
updateHistoryState(editor);
|
|
@@ -3057,9 +3078,11 @@ function GrapesPageEditor({
|
|
|
3057
3078
|
editor.select?.(target);
|
|
3058
3079
|
}
|
|
3059
3080
|
selectStyleManagerTarget(target);
|
|
3081
|
+
markSelectedCanvasBlock(target);
|
|
3060
3082
|
rehydrateSelectedComponentControls(target);
|
|
3061
3083
|
window.setTimeout(() => {
|
|
3062
3084
|
selectStyleManagerTarget(target);
|
|
3085
|
+
markSelectedCanvasBlock(target);
|
|
3063
3086
|
rehydrateSelectedComponentControls(target);
|
|
3064
3087
|
}, 120);
|
|
3065
3088
|
});
|
|
@@ -3082,6 +3105,7 @@ function GrapesPageEditor({
|
|
|
3082
3105
|
return;
|
|
3083
3106
|
}
|
|
3084
3107
|
selectedComponentRef.current = null;
|
|
3108
|
+
markSelectedCanvasBlock(null);
|
|
3085
3109
|
refreshSelectedState(null);
|
|
3086
3110
|
});
|
|
3087
3111
|
const bindCanvasSelectionTracking = () => {
|
|
@@ -3097,6 +3121,9 @@ function GrapesPageEditor({
|
|
|
3097
3121
|
selectedComponentRef.current = target;
|
|
3098
3122
|
lastSelectedComponentRef.current = target;
|
|
3099
3123
|
rememberComponentSnapshot(target);
|
|
3124
|
+
editor.select?.(target);
|
|
3125
|
+
selectStyleManagerTarget(target);
|
|
3126
|
+
markSelectedCanvasBlock(target);
|
|
3100
3127
|
refreshSelectedState(target);
|
|
3101
3128
|
};
|
|
3102
3129
|
canvasDocument.addEventListener("pointerdown", trackCanvasSelection, true);
|
|
@@ -993,6 +993,9 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
993
993
|
},
|
|
994
994
|
components: "",
|
|
995
995
|
droppable: false,
|
|
996
|
+
highlightable: true,
|
|
997
|
+
hoverable: true,
|
|
998
|
+
selectable: true,
|
|
996
999
|
tagName: "div",
|
|
997
1000
|
traits: [
|
|
998
1001
|
...(definition.traits || []).map((trait) => ({
|
|
@@ -1400,6 +1403,12 @@ var canvasSelectionCss = `
|
|
|
1400
1403
|
outline-color: #c7643d !important;
|
|
1401
1404
|
}
|
|
1402
1405
|
|
|
1406
|
+
.orion-builder-v2-selected-block {
|
|
1407
|
+
outline: 2px solid #c7643d !important;
|
|
1408
|
+
outline-offset: -2px !important;
|
|
1409
|
+
position: relative;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1403
1412
|
.xo-builder-preview-grid {
|
|
1404
1413
|
display: grid;
|
|
1405
1414
|
gap: 22px;
|
|
@@ -1984,7 +1993,7 @@ function GrapesPageEditor({
|
|
|
1984
1993
|
};
|
|
1985
1994
|
const getCurrentStyleTarget = () => selectedComponentRef.current || lastSelectedComponentRef.current || (editorRef.current?.getSelected?.() || null);
|
|
1986
1995
|
const findOrionBlockByElement = (element) => {
|
|
1987
|
-
const target = element?.closest("[data-orion-block]");
|
|
1996
|
+
const target = element?.closest("[data-orion-block], [data-orion-component]");
|
|
1988
1997
|
const targetID = target?.id || "";
|
|
1989
1998
|
if (!targetID) {
|
|
1990
1999
|
return null;
|
|
@@ -1992,14 +2001,14 @@ function GrapesPageEditor({
|
|
|
1992
2001
|
const editor = editorRef.current;
|
|
1993
2002
|
const wrapper = editor?.DomComponents?.getWrapper?.() || null;
|
|
1994
2003
|
const component = wrapper?.find?.(`#${CSS.escape(targetID)}`)?.[0] || null;
|
|
1995
|
-
return
|
|
2004
|
+
return isOrionBlockComponent(component) ? component : null;
|
|
1996
2005
|
};
|
|
1997
2006
|
const findOrionBlockAncestor = (component) => {
|
|
1998
2007
|
let current = component;
|
|
1999
2008
|
const visited = /* @__PURE__ */ new Set();
|
|
2000
2009
|
while (current && !visited.has(current)) {
|
|
2001
2010
|
visited.add(current);
|
|
2002
|
-
if (
|
|
2011
|
+
if (isOrionBlockComponent(current)) {
|
|
2003
2012
|
return current;
|
|
2004
2013
|
}
|
|
2005
2014
|
current = current.parent?.() || null;
|
|
@@ -2010,7 +2019,10 @@ function GrapesPageEditor({
|
|
|
2010
2019
|
const findSelectedCanvasOrionBlock = () => {
|
|
2011
2020
|
const editor = editorRef.current;
|
|
2012
2021
|
const wrapper = editor?.DomComponents?.getWrapper?.() || null;
|
|
2013
|
-
const candidates =
|
|
2022
|
+
const candidates = [
|
|
2023
|
+
...wrapper?.find?.("[data-orion-block]") || [],
|
|
2024
|
+
...wrapper?.find?.("[data-orion-component]") || []
|
|
2025
|
+
];
|
|
2014
2026
|
return candidates.find((candidate) => {
|
|
2015
2027
|
const element = candidate.getEl?.();
|
|
2016
2028
|
return Boolean(
|
|
@@ -2040,10 +2052,11 @@ function GrapesPageEditor({
|
|
|
2040
2052
|
}
|
|
2041
2053
|
const candidates = [
|
|
2042
2054
|
...selectedID ? wrapper.find?.(`#${selectedID}`) || [] : [],
|
|
2043
|
-
...wrapper.find?.("[data-orion-block]") || []
|
|
2055
|
+
...wrapper.find?.("[data-orion-block]") || [],
|
|
2056
|
+
...wrapper.find?.("[data-orion-component]") || []
|
|
2044
2057
|
];
|
|
2045
2058
|
return candidates.find(
|
|
2046
|
-
(candidate) =>
|
|
2059
|
+
(candidate) => isOrionBlockComponent(candidate)
|
|
2047
2060
|
) || component || selected || null;
|
|
2048
2061
|
};
|
|
2049
2062
|
const selectStyleManagerTarget = (component) => {
|
|
@@ -2053,6 +2066,11 @@ function GrapesPageEditor({
|
|
|
2053
2066
|
const editor = editorRef.current;
|
|
2054
2067
|
editor?.StyleManager?.select?.(component);
|
|
2055
2068
|
};
|
|
2069
|
+
const markSelectedCanvasBlock = (component) => {
|
|
2070
|
+
const canvasDocument = editorRef.current?.Canvas?.getDocument?.();
|
|
2071
|
+
canvasDocument?.querySelectorAll(".orion-builder-v2-selected-block").forEach((element) => element.classList.remove("orion-builder-v2-selected-block"));
|
|
2072
|
+
component?.getEl?.()?.classList.add("orion-builder-v2-selected-block");
|
|
2073
|
+
};
|
|
2056
2074
|
const updateSelectedItems = (updater) => {
|
|
2057
2075
|
const component = getCurrentOrionBlockTarget();
|
|
2058
2076
|
if (!component) {
|
|
@@ -2415,6 +2433,7 @@ function GrapesPageEditor({
|
|
|
2415
2433
|
}
|
|
2416
2434
|
hydrateSelectedTypographyStyleFromOrionBlock(component);
|
|
2417
2435
|
rememberComponentSnapshot(component);
|
|
2436
|
+
markSelectedCanvasBlock(component);
|
|
2418
2437
|
refreshSelectedState(component);
|
|
2419
2438
|
window.requestAnimationFrame(() => {
|
|
2420
2439
|
const element = spacingTargetForComponent(component);
|
|
@@ -2568,6 +2587,7 @@ function GrapesPageEditor({
|
|
|
2568
2587
|
editorRef.current?.select?.(snapshot.component);
|
|
2569
2588
|
selectStyleManagerTarget(snapshot.component);
|
|
2570
2589
|
lastComponentSnapshotRef.current.set(snapshot.component, snapshot);
|
|
2590
|
+
markSelectedCanvasBlock(snapshot.component);
|
|
2571
2591
|
refreshSelectedState(snapshot.component);
|
|
2572
2592
|
};
|
|
2573
2593
|
const restoreCustomHistoryEntry = (entry, target) => {
|
|
@@ -2624,6 +2644,7 @@ function GrapesPageEditor({
|
|
|
2624
2644
|
selectedComponentRef.current = selected;
|
|
2625
2645
|
lastSelectedComponentRef.current = selected;
|
|
2626
2646
|
selectStyleManagerTarget(selected);
|
|
2647
|
+
markSelectedCanvasBlock(selected);
|
|
2627
2648
|
refreshSelectedState(selected);
|
|
2628
2649
|
}
|
|
2629
2650
|
updateHistoryState(editor);
|
|
@@ -2933,9 +2954,11 @@ function GrapesPageEditor({
|
|
|
2933
2954
|
editor.select?.(target);
|
|
2934
2955
|
}
|
|
2935
2956
|
selectStyleManagerTarget(target);
|
|
2957
|
+
markSelectedCanvasBlock(target);
|
|
2936
2958
|
rehydrateSelectedComponentControls(target);
|
|
2937
2959
|
window.setTimeout(() => {
|
|
2938
2960
|
selectStyleManagerTarget(target);
|
|
2961
|
+
markSelectedCanvasBlock(target);
|
|
2939
2962
|
rehydrateSelectedComponentControls(target);
|
|
2940
2963
|
}, 120);
|
|
2941
2964
|
});
|
|
@@ -2958,6 +2981,7 @@ function GrapesPageEditor({
|
|
|
2958
2981
|
return;
|
|
2959
2982
|
}
|
|
2960
2983
|
selectedComponentRef.current = null;
|
|
2984
|
+
markSelectedCanvasBlock(null);
|
|
2961
2985
|
refreshSelectedState(null);
|
|
2962
2986
|
});
|
|
2963
2987
|
const bindCanvasSelectionTracking = () => {
|
|
@@ -2973,6 +2997,9 @@ function GrapesPageEditor({
|
|
|
2973
2997
|
selectedComponentRef.current = target;
|
|
2974
2998
|
lastSelectedComponentRef.current = target;
|
|
2975
2999
|
rememberComponentSnapshot(target);
|
|
3000
|
+
editor.select?.(target);
|
|
3001
|
+
selectStyleManagerTarget(target);
|
|
3002
|
+
markSelectedCanvasBlock(target);
|
|
2976
3003
|
refreshSelectedState(target);
|
|
2977
3004
|
};
|
|
2978
3005
|
canvasDocument.addEventListener("pointerdown", trackCanvasSelection, true);
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED