@ohhwells/bridge 0.1.172-next.457 → 0.1.173-next.460
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/index.cjs +1683 -559
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +114 -1
- package/dist/index.d.ts +114 -1
- package/dist/index.js +1246 -140
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,10 @@ __export(index_exports, {
|
|
|
66
66
|
SITE_OG_IMAGE_KEY: () => SITE_OG_IMAGE_KEY,
|
|
67
67
|
SchedulingWidget: () => SchedulingWidget,
|
|
68
68
|
TEMPLATE_LOGO_ATTR: () => TEMPLATE_LOGO_ATTR,
|
|
69
|
+
TONE_ATTR: () => TONE_ATTR,
|
|
70
|
+
TONE_CHANGE_EVENT: () => TONE_CHANGE_EVENT,
|
|
71
|
+
TONE_FIX_ATTR: () => TONE_FIX_ATTR,
|
|
72
|
+
TONE_THRESHOLD: () => TONE_THRESHOLD,
|
|
69
73
|
Toggle: () => Toggle,
|
|
70
74
|
ToggleGroup: () => ToggleGroup,
|
|
71
75
|
ToggleGroupItem: () => ToggleGroupItem,
|
|
@@ -84,11 +88,16 @@ __export(index_exports, {
|
|
|
84
88
|
canRemoveAiBlock: () => canRemoveAiBlock,
|
|
85
89
|
canRemoveAiTextBlock: () => canRemoveAiTextBlock,
|
|
86
90
|
canSoftHideEditable: () => canSoftHideEditable,
|
|
91
|
+
compositeColor: () => compositeColor,
|
|
92
|
+
compositeGradient: () => compositeGradient,
|
|
93
|
+
computeBackgroundTones: () => computeBackgroundTones,
|
|
94
|
+
contrastRatioOf: () => contrastRatioOf,
|
|
87
95
|
dropIndicatorVariants: () => dropIndicatorVariants,
|
|
88
96
|
ensureFooterTree: () => ensureFooterTree,
|
|
89
97
|
filterAvailablePages: () => filterAvailablePages,
|
|
90
98
|
foldAlignIntoTrees: () => foldAlignIntoTrees,
|
|
91
99
|
getEditModeInitialState: () => getEditModeInitialState,
|
|
100
|
+
gradientStopColors: () => gradientStopColors,
|
|
92
101
|
hasMountedContentNodes: () => hasMountedContentNodes,
|
|
93
102
|
indexCollectionItems: () => indexCollectionItems,
|
|
94
103
|
insertFooterHours: () => insertFooterHours,
|
|
@@ -100,16 +109,21 @@ __export(index_exports, {
|
|
|
100
109
|
isRenderableTree: () => isRenderableTree,
|
|
101
110
|
isStickySearchParam: () => isStickySearchParam,
|
|
102
111
|
isValidUrl: () => isValidUrl,
|
|
112
|
+
linearGradientColourAt: () => linearGradientColourAt,
|
|
113
|
+
mapRegionToImage: () => mapRegionToImage,
|
|
103
114
|
matchCollectionItemClick: () => matchCollectionItemClick,
|
|
115
|
+
mountBackgroundTone: () => mountBackgroundTone,
|
|
104
116
|
nextViableSlide: () => nextViableSlide,
|
|
105
117
|
parseAiFooterState: () => parseAiFooterState,
|
|
106
118
|
parseAiSectionsState: () => parseAiSectionsState,
|
|
119
|
+
parseCssColor: () => parseCssColor,
|
|
107
120
|
parseTarget: () => parseTarget,
|
|
108
121
|
planAiBlockRemoval: () => planAiBlockRemoval,
|
|
109
122
|
planAiTextBlockRemoval: () => planAiTextBlockRemoval,
|
|
110
123
|
planBuildPageSync: () => planBuildPageSync,
|
|
111
124
|
readHiddenEditables: () => readHiddenEditables,
|
|
112
125
|
recordOverriddenPaths: () => recordOverriddenPaths,
|
|
126
|
+
relativeLuminanceOf: () => relativeLuminanceOf,
|
|
113
127
|
releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
|
|
114
128
|
removeBlockAtPath: () => removeBlockAtPath,
|
|
115
129
|
removeFooterBlock: () => removeFooterBlock,
|
|
@@ -121,11 +135,15 @@ __export(index_exports, {
|
|
|
121
135
|
shouldFetchContentForPath: () => shouldFetchContentForPath,
|
|
122
136
|
softHideEditableInDom: () => softHideEditableInDom,
|
|
123
137
|
softUnhideEditableInDom: () => softUnhideEditableInDom,
|
|
138
|
+
splitTopLevel: () => splitTopLevel,
|
|
124
139
|
stepViableSlide: () => stepViableSlide,
|
|
125
140
|
stripPlaceholderText: () => stripPlaceholderText,
|
|
126
141
|
stripPlaceholders: () => stripPlaceholders,
|
|
127
142
|
stripTextAlignCss: () => stripTextAlignCss,
|
|
128
143
|
toggleVariants: () => toggleVariants,
|
|
144
|
+
toneFor: () => toneFor,
|
|
145
|
+
toneOfColor: () => toneOfColor,
|
|
146
|
+
toneOfLuminance: () => toneOfLuminance,
|
|
129
147
|
useOhwCarousel: () => useOhwCarousel,
|
|
130
148
|
validateUrlInput: () => validateUrlInput,
|
|
131
149
|
viableSlides: () => viableSlides,
|
|
@@ -135,7 +153,7 @@ __export(index_exports, {
|
|
|
135
153
|
module.exports = __toCommonJS(index_exports);
|
|
136
154
|
|
|
137
155
|
// src/OhhwellsBridge.tsx
|
|
138
|
-
var
|
|
156
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
139
157
|
var import_client3 = require("react-dom/client");
|
|
140
158
|
var import_react_dom5 = require("react-dom");
|
|
141
159
|
|
|
@@ -614,10 +632,10 @@ function logoTextElement(root) {
|
|
|
614
632
|
if (root.matches(SELECTOR)) return root;
|
|
615
633
|
const marked = root.querySelector(SELECTOR);
|
|
616
634
|
if (marked) return marked;
|
|
617
|
-
const
|
|
635
|
+
const hasOwnText2 = Array.from(root.childNodes).some(
|
|
618
636
|
(node) => node.nodeType === Node.TEXT_NODE && node.textContent?.trim()
|
|
619
637
|
);
|
|
620
|
-
return
|
|
638
|
+
return hasOwnText2 ? root : null;
|
|
621
639
|
}
|
|
622
640
|
var TEMPLATE_LOGO_ATTR = "data-ohw-template-logo";
|
|
623
641
|
function releaseTemplateLogoIfReplaced(img, url) {
|
|
@@ -6221,8 +6239,11 @@ function styleSheetCss() {
|
|
|
6221
6239
|
for (const [tone, value] of Object.entries(BG_VALUES)) {
|
|
6222
6240
|
rules.push(`[data-ohw-style-bg="${tone}"] { background: ${value} !important; }`);
|
|
6223
6241
|
}
|
|
6242
|
+
const lightText = "var(--ohw-brand-light, var(--color-light, #FFFFFF))";
|
|
6243
|
+
const darkText = "var(--ohw-brand-dark, var(--color-dark, #0C0A09))";
|
|
6224
6244
|
rules.push(
|
|
6225
|
-
|
|
6245
|
+
`:is([data-ohw-style-bg], [data-ohw-style-bgcolor])[data-ohw-tone="dark"], [data-ohw-tone-fix="dark"] { color: ${lightText} !important; }`,
|
|
6246
|
+
`:is([data-ohw-style-bg], [data-ohw-style-bgcolor])[data-ohw-tone="light"], [data-ohw-tone-fix="light"] { color: ${darkText} !important; }`
|
|
6226
6247
|
);
|
|
6227
6248
|
rules.push(
|
|
6228
6249
|
`[data-ohw-style-distribution="space-between"] { display: flex !important; flex-direction: column; justify-content: space-between; }`,
|
|
@@ -12784,9 +12805,1035 @@ function useNavDropdownToggle(isEditMode) {
|
|
|
12784
12805
|
}, [pathname, isEditMode]);
|
|
12785
12806
|
}
|
|
12786
12807
|
|
|
12787
|
-
// src/
|
|
12808
|
+
// src/useBackgroundTone.ts
|
|
12788
12809
|
var import_react6 = require("react");
|
|
12789
12810
|
|
|
12811
|
+
// src/lib/background-tone.ts
|
|
12812
|
+
var TONE_THRESHOLD = 0.5;
|
|
12813
|
+
var TONE_ATTR = "data-ohw-tone";
|
|
12814
|
+
var TONE_FIX_ATTR = "data-ohw-tone-fix";
|
|
12815
|
+
var TONE_CHANGE_EVENT = "ohw:tone-change";
|
|
12816
|
+
var IMAGE_COVER_RATIO = 0.8;
|
|
12817
|
+
var SURFACE_MIN_PX = 24;
|
|
12818
|
+
var OPAQUE_ALPHA = 0.9;
|
|
12819
|
+
var VISIBLE_ALPHA = 0.05;
|
|
12820
|
+
var SAMPLE_SIZE = 32;
|
|
12821
|
+
var SAMPLE_TIMEOUT_MS = 3e3;
|
|
12822
|
+
var WHITE = { r: 255, g: 255, b: 255, a: 1 };
|
|
12823
|
+
var SECTION_SELECTOR = "[data-ohw-section]";
|
|
12824
|
+
var TEXT_SELECTOR = '[data-ohw-editable="text"], [data-ohw-editable="plain"], [data-ohw-field-label]';
|
|
12825
|
+
var BUTTON_SELECTOR = CTA_BUTTON_SELECTOR;
|
|
12826
|
+
var PICKED_BUTTON_TEXT_VARS = ["--brand-button-primary-text", "--brand-button-secondary-text"];
|
|
12827
|
+
var MEASURING_ATTR = "data-ohw-tone-measuring";
|
|
12828
|
+
var TONE_FIX_LINE_ATTR = "data-ohw-tone-fix-line";
|
|
12829
|
+
var INK_FIX_STYLE_ID = "ohw-tone-ink-fix";
|
|
12830
|
+
var INK_MIN_CONTRAST = 3;
|
|
12831
|
+
var IMAGE_TEXT_MIN_CONTRAST = 3;
|
|
12832
|
+
var NEVER_SURFACE = /* @__PURE__ */ new Set(["IMG", "SVG", "VIDEO", "CANVAS", "IFRAME", "PICTURE", "PATH", "SCRIPT", "STYLE"]);
|
|
12833
|
+
var clamp01 = (n) => Math.min(1, Math.max(0, n));
|
|
12834
|
+
function num(raw, percentOf = 1) {
|
|
12835
|
+
if (!raw || raw === "none") return 0;
|
|
12836
|
+
return raw.endsWith("%") ? parseFloat(raw) / 100 * percentOf : parseFloat(raw);
|
|
12837
|
+
}
|
|
12838
|
+
function alphaOf(raw) {
|
|
12839
|
+
return raw == null ? 1 : clamp01(num(raw, 1));
|
|
12840
|
+
}
|
|
12841
|
+
function linearToSrgb255(v) {
|
|
12842
|
+
const c = clamp01(v);
|
|
12843
|
+
return 255 * (c <= 31308e-7 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055);
|
|
12844
|
+
}
|
|
12845
|
+
function oklabToRgba(L, A, B, a) {
|
|
12846
|
+
const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3;
|
|
12847
|
+
const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3;
|
|
12848
|
+
const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3;
|
|
12849
|
+
return {
|
|
12850
|
+
r: linearToSrgb255(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
|
|
12851
|
+
g: linearToSrgb255(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
|
|
12852
|
+
b: linearToSrgb255(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
|
|
12853
|
+
a
|
|
12854
|
+
};
|
|
12855
|
+
}
|
|
12856
|
+
function parseCssColor(input) {
|
|
12857
|
+
if (!input) return null;
|
|
12858
|
+
const value = input.trim().toLowerCase();
|
|
12859
|
+
if (value === "transparent") return { r: 0, g: 0, b: 0, a: 0 };
|
|
12860
|
+
const hex = value.match(/^#([0-9a-f]{3,8})$/);
|
|
12861
|
+
if (hex) {
|
|
12862
|
+
const raw = hex[1];
|
|
12863
|
+
const short = raw.length <= 4;
|
|
12864
|
+
const part = (i) => parseInt(short ? raw[i] + raw[i] : raw.slice(i * 2, i * 2 + 2), 16);
|
|
12865
|
+
if (![3, 4, 6, 8].includes(raw.length)) return null;
|
|
12866
|
+
return { r: part(0), g: part(1), b: part(2), a: raw.length === 4 || raw.length === 8 ? part(3) / 255 : 1 };
|
|
12867
|
+
}
|
|
12868
|
+
const fn = value.match(/^([a-z]+)\((.*)\)$/);
|
|
12869
|
+
if (!fn) return null;
|
|
12870
|
+
const [, name, body] = fn;
|
|
12871
|
+
const [channelsRaw, slashAlpha] = body.split("/").map((s) => s.trim());
|
|
12872
|
+
const parts = channelsRaw.split(/[\s,]+/).filter(Boolean);
|
|
12873
|
+
if (name === "rgb" || name === "rgba") {
|
|
12874
|
+
if (parts.length < 3) return null;
|
|
12875
|
+
const alpha = slashAlpha ?? parts[3];
|
|
12876
|
+
return { r: num(parts[0], 255), g: num(parts[1], 255), b: num(parts[2], 255), a: alphaOf(alpha) };
|
|
12877
|
+
}
|
|
12878
|
+
if (name === "color") {
|
|
12879
|
+
const [space, r2, g, b] = parts;
|
|
12880
|
+
if (space !== "srgb" || b == null) return null;
|
|
12881
|
+
return { r: num(r2) * 255, g: num(g) * 255, b: num(b) * 255, a: alphaOf(slashAlpha) };
|
|
12882
|
+
}
|
|
12883
|
+
if (name === "oklch") {
|
|
12884
|
+
if (parts.length < 3) return null;
|
|
12885
|
+
const L = num(parts[0]);
|
|
12886
|
+
const C = num(parts[1], 0.4);
|
|
12887
|
+
const h = num(parts[2].replace("deg", "")) * Math.PI / 180;
|
|
12888
|
+
return oklabToRgba(L, C * Math.cos(h), C * Math.sin(h), alphaOf(slashAlpha));
|
|
12889
|
+
}
|
|
12890
|
+
if (name === "oklab") {
|
|
12891
|
+
if (parts.length < 3) return null;
|
|
12892
|
+
return oklabToRgba(num(parts[0]), num(parts[1], 0.4), num(parts[2], 0.4), alphaOf(slashAlpha));
|
|
12893
|
+
}
|
|
12894
|
+
return null;
|
|
12895
|
+
}
|
|
12896
|
+
function compositeColor(fg, bg) {
|
|
12897
|
+
const a = fg.a + bg.a * (1 - fg.a);
|
|
12898
|
+
if (a < 1e-3) return { r: bg.r, g: bg.g, b: bg.b, a: 0 };
|
|
12899
|
+
const mix = (f, b) => (f * fg.a + b * bg.a * (1 - fg.a)) / a;
|
|
12900
|
+
return { r: mix(fg.r, bg.r), g: mix(fg.g, bg.g), b: mix(fg.b, bg.b), a };
|
|
12901
|
+
}
|
|
12902
|
+
function relativeLuminanceOf(color) {
|
|
12903
|
+
const channel = (value) => {
|
|
12904
|
+
const s = clamp01(value / 255);
|
|
12905
|
+
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
12906
|
+
};
|
|
12907
|
+
return 0.2126 * channel(color.r) + 0.7152 * channel(color.g) + 0.0722 * channel(color.b);
|
|
12908
|
+
}
|
|
12909
|
+
function toneOfLuminance(luminance) {
|
|
12910
|
+
return luminance >= TONE_THRESHOLD ? "light" : "dark";
|
|
12911
|
+
}
|
|
12912
|
+
function toneOfColor(color) {
|
|
12913
|
+
return toneOfLuminance(relativeLuminanceOf(color));
|
|
12914
|
+
}
|
|
12915
|
+
function contrastRatioOf(a, b) {
|
|
12916
|
+
const la = relativeLuminanceOf(a);
|
|
12917
|
+
const lb = relativeLuminanceOf(b);
|
|
12918
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
12919
|
+
}
|
|
12920
|
+
function splitTopLevel(value) {
|
|
12921
|
+
const out = [];
|
|
12922
|
+
let depth = 0;
|
|
12923
|
+
let start = 0;
|
|
12924
|
+
for (let i = 0; i < value.length; i++) {
|
|
12925
|
+
const ch = value[i];
|
|
12926
|
+
if (ch === "(") depth++;
|
|
12927
|
+
else if (ch === ")") depth--;
|
|
12928
|
+
else if (ch === "," && depth === 0) {
|
|
12929
|
+
out.push(value.slice(start, i).trim());
|
|
12930
|
+
start = i + 1;
|
|
12931
|
+
}
|
|
12932
|
+
}
|
|
12933
|
+
const last = value.slice(start).trim();
|
|
12934
|
+
if (last) out.push(last);
|
|
12935
|
+
return out;
|
|
12936
|
+
}
|
|
12937
|
+
var COLOR_TOKEN = /(?:rgba?|color|oklch|oklab)\([^()]*\)|#[0-9a-f]{3,8}\b|\btransparent\b/gi;
|
|
12938
|
+
function gradientStopColors(layer) {
|
|
12939
|
+
if (!/gradient\(/i.test(layer)) return [];
|
|
12940
|
+
return (layer.match(COLOR_TOKEN) ?? []).map(parseCssColor).filter((c) => c !== null);
|
|
12941
|
+
}
|
|
12942
|
+
function compositeGradient(stops, behind) {
|
|
12943
|
+
if (stops.length === 0) return behind;
|
|
12944
|
+
const sum = { r: 0, g: 0, b: 0, a: 0 };
|
|
12945
|
+
for (const stop of stops) {
|
|
12946
|
+
const c = compositeColor(stop, behind);
|
|
12947
|
+
sum.r += c.r;
|
|
12948
|
+
sum.g += c.g;
|
|
12949
|
+
sum.b += c.b;
|
|
12950
|
+
sum.a += c.a;
|
|
12951
|
+
}
|
|
12952
|
+
const n = stops.length;
|
|
12953
|
+
return { r: sum.r / n, g: sum.g / n, b: sum.b / n, a: sum.a / n };
|
|
12954
|
+
}
|
|
12955
|
+
function stopPosition(token, length) {
|
|
12956
|
+
const n = parseFloat(token);
|
|
12957
|
+
if (!Number.isFinite(n)) return null;
|
|
12958
|
+
if (token.trim().endsWith("%")) return n / 100;
|
|
12959
|
+
return length > 0 ? n / length : null;
|
|
12960
|
+
}
|
|
12961
|
+
function gradientDirection(arg, w, h) {
|
|
12962
|
+
const a = arg.trim().toLowerCase();
|
|
12963
|
+
const deg = a.match(/^(-?[\d.]+)(deg|turn|rad|grad)$/);
|
|
12964
|
+
if (deg) {
|
|
12965
|
+
const v2 = parseFloat(deg[1]);
|
|
12966
|
+
const rad = deg[2] === "turn" ? v2 * 2 * Math.PI : deg[2] === "rad" ? v2 : deg[2] === "grad" ? v2 * Math.PI / 200 : v2 * Math.PI / 180;
|
|
12967
|
+
return { dx: Math.sin(rad), dy: -Math.cos(rad) };
|
|
12968
|
+
}
|
|
12969
|
+
if (!a.startsWith("to ")) return null;
|
|
12970
|
+
const sx = a.includes("right") ? 1 : a.includes("left") ? -1 : 0;
|
|
12971
|
+
const sy = a.includes("bottom") ? 1 : a.includes("top") ? -1 : 0;
|
|
12972
|
+
const v = sx !== 0 && sy !== 0 ? { dx: sx * h, dy: sy * w } : { dx: sx, dy: sy };
|
|
12973
|
+
const len = Math.hypot(v.dx, v.dy);
|
|
12974
|
+
return len > 0 ? { dx: v.dx / len, dy: v.dy / len } : null;
|
|
12975
|
+
}
|
|
12976
|
+
function linearGradientColourAt(layer, px2, py, w, h) {
|
|
12977
|
+
const m = layer.trim().match(/^linear-gradient\((.*)\)$/i);
|
|
12978
|
+
if (!m) return null;
|
|
12979
|
+
const args = splitTopLevel(m[1]);
|
|
12980
|
+
let dir = { dx: 0, dy: 1 };
|
|
12981
|
+
if (args.length > 0 && !parseCssColor((args[0].match(COLOR_TOKEN) ?? [""])[0])) {
|
|
12982
|
+
const parsed = gradientDirection(args[0], w, h);
|
|
12983
|
+
if (!parsed) return null;
|
|
12984
|
+
dir = parsed;
|
|
12985
|
+
args.shift();
|
|
12986
|
+
}
|
|
12987
|
+
const length = Math.abs(w * dir.dx) + Math.abs(h * dir.dy);
|
|
12988
|
+
const stops = [];
|
|
12989
|
+
for (const arg of args) {
|
|
12990
|
+
const colourToken = (arg.match(COLOR_TOKEN) ?? [])[0];
|
|
12991
|
+
const color = colourToken ? parseCssColor(colourToken) : null;
|
|
12992
|
+
if (!color) continue;
|
|
12993
|
+
const rest = arg.replace(colourToken, "").trim().split(/\s+/).filter(Boolean);
|
|
12994
|
+
if (rest.length === 0) stops.push({ color, at: null });
|
|
12995
|
+
for (const token of rest.slice(0, 2)) stops.push({ color, at: stopPosition(token, length) });
|
|
12996
|
+
}
|
|
12997
|
+
if (stops.length === 0) return null;
|
|
12998
|
+
if (stops[0].at === null) stops[0].at = 0;
|
|
12999
|
+
if (stops[stops.length - 1].at === null) stops[stops.length - 1].at = 1;
|
|
13000
|
+
for (let i = 1; i < stops.length; i++) {
|
|
13001
|
+
if (stops[i].at !== null) {
|
|
13002
|
+
stops[i].at = Math.max(stops[i].at, stops[i - 1].at);
|
|
13003
|
+
continue;
|
|
13004
|
+
}
|
|
13005
|
+
let j = i;
|
|
13006
|
+
while (stops[j].at === null) j++;
|
|
13007
|
+
const from = stops[i - 1].at;
|
|
13008
|
+
const span = j - (i - 1);
|
|
13009
|
+
for (let k = i; k < j; k++) stops[k].at = from + (stops[j].at - from) * (k - (i - 1)) / span;
|
|
13010
|
+
}
|
|
13011
|
+
const t = length > 0 ? ((px2 - w / 2) * dir.dx + (py - h / 2) * dir.dy) / length + 0.5 : 0.5;
|
|
13012
|
+
if (t <= stops[0].at) return stops[0].color;
|
|
13013
|
+
const last = stops[stops.length - 1];
|
|
13014
|
+
if (t >= last.at) return last.color;
|
|
13015
|
+
for (let i = 1; i < stops.length; i++) {
|
|
13016
|
+
const a = stops[i - 1];
|
|
13017
|
+
const b = stops[i];
|
|
13018
|
+
if (t > b.at) continue;
|
|
13019
|
+
const f = b.at > a.at ? (t - a.at) / (b.at - a.at) : 1;
|
|
13020
|
+
const alpha = a.color.a + (b.color.a - a.color.a) * f;
|
|
13021
|
+
const mix = (x, y) => (x * a.color.a + (y * b.color.a - x * a.color.a) * f) / (alpha || 1);
|
|
13022
|
+
return { r: mix(a.color.r, b.color.r), g: mix(a.color.g, b.color.g), b: mix(a.color.b, b.color.b), a: alpha };
|
|
13023
|
+
}
|
|
13024
|
+
return last.color;
|
|
13025
|
+
}
|
|
13026
|
+
function positionOffset(token, free) {
|
|
13027
|
+
if (!token) return free / 2;
|
|
13028
|
+
if (token === "left" || token === "top") return 0;
|
|
13029
|
+
if (token === "right" || token === "bottom") return free;
|
|
13030
|
+
if (token === "center") return free / 2;
|
|
13031
|
+
if (token.endsWith("%")) return parseFloat(token) / 100 * free;
|
|
13032
|
+
if (token.endsWith("px")) return parseFloat(token);
|
|
13033
|
+
return free / 2;
|
|
13034
|
+
}
|
|
13035
|
+
function mapRegionToImage(region, element, image, fit, position) {
|
|
13036
|
+
const { width: w, height: h } = element;
|
|
13037
|
+
const { width: iw, height: ih } = image;
|
|
13038
|
+
if (w <= 0 || h <= 0 || iw <= 0 || ih <= 0) return null;
|
|
13039
|
+
let dw = iw;
|
|
13040
|
+
let dh = ih;
|
|
13041
|
+
const f = fit.trim().toLowerCase();
|
|
13042
|
+
if (f === "cover" || f === "contain" || f === "scale-down") {
|
|
13043
|
+
let s = f === "cover" ? Math.max(w / iw, h / ih) : Math.min(w / iw, h / ih);
|
|
13044
|
+
if (f === "scale-down") s = Math.min(1, s);
|
|
13045
|
+
dw = iw * s;
|
|
13046
|
+
dh = ih * s;
|
|
13047
|
+
} else if (f === "fill") {
|
|
13048
|
+
dw = w;
|
|
13049
|
+
dh = h;
|
|
13050
|
+
} else if (f !== "none" && f !== "auto" && f !== "auto auto") {
|
|
13051
|
+
const [sw, sh] = f.split(/\s+/);
|
|
13052
|
+
const size = (token, full, natural, other) => {
|
|
13053
|
+
if (!token || token === "auto") return other ?? natural;
|
|
13054
|
+
return token.endsWith("%") ? parseFloat(token) / 100 * full : parseFloat(token);
|
|
13055
|
+
};
|
|
13056
|
+
dw = size(sw, w, iw, null);
|
|
13057
|
+
dh = sh && sh !== "auto" ? size(sh, h, ih, null) : dw / iw * ih;
|
|
13058
|
+
}
|
|
13059
|
+
const [px2, py] = position.trim().toLowerCase().split(/\s+/);
|
|
13060
|
+
const ox = positionOffset(px2, w - dw);
|
|
13061
|
+
const oy = positionOffset(py, h - dh);
|
|
13062
|
+
const sx = Math.max(0, (region.x - ox) / dw * iw);
|
|
13063
|
+
const sy = Math.max(0, (region.y - oy) / dh * ih);
|
|
13064
|
+
const ex = Math.min(iw, (region.x + region.width - ox) / dw * iw);
|
|
13065
|
+
const ey = Math.min(ih, (region.y + region.height - oy) / dh * ih);
|
|
13066
|
+
if (ex - sx < 1 || ey - sy < 1) return null;
|
|
13067
|
+
return { x: sx, y: sy, width: ex - sx, height: ey - sy };
|
|
13068
|
+
}
|
|
13069
|
+
var imageCache = /* @__PURE__ */ new Map();
|
|
13070
|
+
function loadImage(url, onSettled) {
|
|
13071
|
+
const cached = imageCache.get(url);
|
|
13072
|
+
if (cached) {
|
|
13073
|
+
if (cached.state === "loading") cached.waiters.add(onSettled);
|
|
13074
|
+
return cached;
|
|
13075
|
+
}
|
|
13076
|
+
const entry = { state: "loading", waiters: /* @__PURE__ */ new Set([onSettled]) };
|
|
13077
|
+
imageCache.set(url, entry);
|
|
13078
|
+
const img = new Image();
|
|
13079
|
+
img.crossOrigin = "anonymous";
|
|
13080
|
+
img.decoding = "async";
|
|
13081
|
+
let done = false;
|
|
13082
|
+
const settle = (ok) => {
|
|
13083
|
+
if (done) return;
|
|
13084
|
+
done = true;
|
|
13085
|
+
clearTimeout(timer);
|
|
13086
|
+
if (!ok) console.debug?.("[ohw-tone] image sampling unavailable, reading as Light", url);
|
|
13087
|
+
imageCache.set(url, ok ? { state: "ok", img } : { state: "fail" });
|
|
13088
|
+
for (const waiter of entry.waiters) waiter();
|
|
13089
|
+
};
|
|
13090
|
+
const timer = setTimeout(() => settle(false), SAMPLE_TIMEOUT_MS);
|
|
13091
|
+
img.onload = () => settle(img.naturalWidth > 0);
|
|
13092
|
+
img.onerror = () => settle(false);
|
|
13093
|
+
img.src = url;
|
|
13094
|
+
return entry;
|
|
13095
|
+
}
|
|
13096
|
+
var sampleCanvas = null;
|
|
13097
|
+
function sampleImage(img, region) {
|
|
13098
|
+
try {
|
|
13099
|
+
sampleCanvas ?? (sampleCanvas = document.createElement("canvas"));
|
|
13100
|
+
sampleCanvas.width = SAMPLE_SIZE;
|
|
13101
|
+
sampleCanvas.height = SAMPLE_SIZE;
|
|
13102
|
+
const ctx = sampleCanvas.getContext("2d", { willReadFrequently: true });
|
|
13103
|
+
if (!ctx) return null;
|
|
13104
|
+
ctx.clearRect(0, 0, SAMPLE_SIZE, SAMPLE_SIZE);
|
|
13105
|
+
const r2 = region ?? { x: 0, y: 0, width: img.naturalWidth, height: img.naturalHeight };
|
|
13106
|
+
ctx.drawImage(img, r2.x, r2.y, r2.width, r2.height, 0, 0, SAMPLE_SIZE, SAMPLE_SIZE);
|
|
13107
|
+
const data = ctx.getImageData(0, 0, SAMPLE_SIZE, SAMPLE_SIZE).data;
|
|
13108
|
+
let r0 = 0;
|
|
13109
|
+
let g0 = 0;
|
|
13110
|
+
let b0 = 0;
|
|
13111
|
+
let weight = 0;
|
|
13112
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
13113
|
+
const a = data[i + 3] / 255;
|
|
13114
|
+
r0 += data[i] * a;
|
|
13115
|
+
g0 += data[i + 1] * a;
|
|
13116
|
+
b0 += data[i + 2] * a;
|
|
13117
|
+
weight += a;
|
|
13118
|
+
}
|
|
13119
|
+
const pixels = data.length / 4;
|
|
13120
|
+
if (weight === 0) return { r: 0, g: 0, b: 0, a: 0 };
|
|
13121
|
+
return { r: r0 / weight, g: g0 / weight, b: b0 / weight, a: weight / pixels };
|
|
13122
|
+
} catch {
|
|
13123
|
+
return null;
|
|
13124
|
+
}
|
|
13125
|
+
}
|
|
13126
|
+
function browserDeps() {
|
|
13127
|
+
return {
|
|
13128
|
+
style: (el) => getComputedStyle(el),
|
|
13129
|
+
rect: (el) => {
|
|
13130
|
+
const r2 = el.getBoundingClientRect();
|
|
13131
|
+
return { x: r2.left, y: r2.top, width: r2.width, height: r2.height };
|
|
13132
|
+
},
|
|
13133
|
+
sample: (url, region, onReady) => {
|
|
13134
|
+
const entry = loadImage(url, onReady);
|
|
13135
|
+
if (entry.state === "loading") return "loading";
|
|
13136
|
+
if (entry.state === "fail") return null;
|
|
13137
|
+
const natural = { width: entry.img.naturalWidth, height: entry.img.naturalHeight };
|
|
13138
|
+
return sampleImage(entry.img, region(natural));
|
|
13139
|
+
},
|
|
13140
|
+
pseudo: (el, which) => getComputedStyle(el, which)
|
|
13141
|
+
};
|
|
13142
|
+
}
|
|
13143
|
+
function bgLayers(style) {
|
|
13144
|
+
const value = style.backgroundImage;
|
|
13145
|
+
return value && value !== "none" ? splitTopLevel(value) : [];
|
|
13146
|
+
}
|
|
13147
|
+
function urlOf(layer) {
|
|
13148
|
+
const m = layer.match(/^url\(\s*(['"]?)(.*?)\1\s*\)$/i);
|
|
13149
|
+
return m ? m[2] : null;
|
|
13150
|
+
}
|
|
13151
|
+
function paintOver(style, behind, at) {
|
|
13152
|
+
let color = behind;
|
|
13153
|
+
let painted = false;
|
|
13154
|
+
let opaque = false;
|
|
13155
|
+
const own = parseCssColor(style.backgroundColor);
|
|
13156
|
+
if (own && own.a > VISIBLE_ALPHA) {
|
|
13157
|
+
color = compositeColor(own, color);
|
|
13158
|
+
painted = true;
|
|
13159
|
+
opaque = own.a >= OPAQUE_ALPHA;
|
|
13160
|
+
}
|
|
13161
|
+
for (const layer of bgLayers(style).reverse()) {
|
|
13162
|
+
const stops = gradientStopColors(layer);
|
|
13163
|
+
if (stops.length === 0) continue;
|
|
13164
|
+
const point = at ? linearGradientColourAt(layer, at.x, at.y, at.width, at.height) : null;
|
|
13165
|
+
color = point ? compositeColor(point, color) : compositeGradient(stops, color);
|
|
13166
|
+
painted = true;
|
|
13167
|
+
if (stops.every((s) => s.a >= OPAQUE_ALPHA)) opaque = true;
|
|
13168
|
+
}
|
|
13169
|
+
return { color, opaque, painted };
|
|
13170
|
+
}
|
|
13171
|
+
function area(b) {
|
|
13172
|
+
return Math.max(0, b.width) * Math.max(0, b.height);
|
|
13173
|
+
}
|
|
13174
|
+
function intersect(a, b) {
|
|
13175
|
+
const x = Math.max(a.x, b.x);
|
|
13176
|
+
const y = Math.max(a.y, b.y);
|
|
13177
|
+
return { x, y, width: Math.min(a.x + a.width, b.x + b.width) - x, height: Math.min(a.y + a.height, b.y + b.height) - y };
|
|
13178
|
+
}
|
|
13179
|
+
function union(a, b) {
|
|
13180
|
+
if (!a) return b;
|
|
13181
|
+
const x = Math.min(a.x, b.x);
|
|
13182
|
+
const y = Math.min(a.y, b.y);
|
|
13183
|
+
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
13184
|
+
}
|
|
13185
|
+
function covers(deps, el, section) {
|
|
13186
|
+
const sectionArea = area(section);
|
|
13187
|
+
return sectionArea > 0 && area(intersect(deps.rect(el), section)) >= IMAGE_COVER_RATIO * sectionArea;
|
|
13188
|
+
}
|
|
13189
|
+
function colourBehind(deps, el) {
|
|
13190
|
+
const chain = [];
|
|
13191
|
+
for (let p = el.parentElement; p; p = p.parentElement) chain.push(p);
|
|
13192
|
+
let color = WHITE;
|
|
13193
|
+
for (const ancestor of chain.reverse()) color = paintOver(deps.style(ancestor), color).color;
|
|
13194
|
+
return color;
|
|
13195
|
+
}
|
|
13196
|
+
function findImages(deps, section) {
|
|
13197
|
+
const out = [];
|
|
13198
|
+
const candidates = [section, ...Array.from(section.querySelectorAll("*"))];
|
|
13199
|
+
for (const el of candidates) {
|
|
13200
|
+
if (el !== section && el.closest(SECTION_SELECTOR) !== section) continue;
|
|
13201
|
+
const style = deps.style(el);
|
|
13202
|
+
if (style.display === "none" || style.visibility === "hidden") continue;
|
|
13203
|
+
if (el.tagName === "IMG") {
|
|
13204
|
+
const img = el;
|
|
13205
|
+
const url = img.currentSrc || img.src;
|
|
13206
|
+
if (url && style.objectFit === "cover") out.push({ el, url, urlLayer: -1 });
|
|
13207
|
+
continue;
|
|
13208
|
+
}
|
|
13209
|
+
const layers = bgLayers(style);
|
|
13210
|
+
const urlLayer = layers.findIndex((l) => urlOf(l) !== null);
|
|
13211
|
+
if (urlLayer >= 0) out.push({ el, url: urlOf(layers[urlLayer]), urlLayer });
|
|
13212
|
+
}
|
|
13213
|
+
return out;
|
|
13214
|
+
}
|
|
13215
|
+
function findImageHosts(deps, section, images, sectionImage, onReady) {
|
|
13216
|
+
const out = /* @__PURE__ */ new Map();
|
|
13217
|
+
for (const image of images) {
|
|
13218
|
+
if (image.el === sectionImage?.el) continue;
|
|
13219
|
+
let host = null;
|
|
13220
|
+
for (let p = image.urlLayer < 0 ? image.el.parentElement : image.el; p && p !== section; p = p.parentElement) {
|
|
13221
|
+
if (!covers(deps, image.el, deps.rect(p))) break;
|
|
13222
|
+
host = p;
|
|
13223
|
+
}
|
|
13224
|
+
if (!host || out.has(host)) continue;
|
|
13225
|
+
const box = deps.rect(host);
|
|
13226
|
+
if (box.width < SURFACE_MIN_PX || box.height < SURFACE_MIN_PX) continue;
|
|
13227
|
+
if (!textRegion(deps, host, deps.rect(image.el))) continue;
|
|
13228
|
+
out.set(host, imageSectionColour(deps, host, box, image, onReady));
|
|
13229
|
+
}
|
|
13230
|
+
return out;
|
|
13231
|
+
}
|
|
13232
|
+
function findOverlays(deps, section, image, box) {
|
|
13233
|
+
const out = [];
|
|
13234
|
+
for (const el of Array.from(section.querySelectorAll("*"))) {
|
|
13235
|
+
if (el === image || el.contains(image)) continue;
|
|
13236
|
+
const after = image.contains(el) || Boolean(
|
|
13237
|
+
image.compareDocumentPosition(el) & 4
|
|
13238
|
+
/* DOCUMENT_POSITION_FOLLOWING */
|
|
13239
|
+
);
|
|
13240
|
+
if (!after) continue;
|
|
13241
|
+
const style = deps.style(el);
|
|
13242
|
+
const paint3 = paintOver(style, { r: 0, g: 0, b: 0, a: 0 });
|
|
13243
|
+
if (paint3.painted && covers(deps, el, box)) out.push(el);
|
|
13244
|
+
}
|
|
13245
|
+
return out;
|
|
13246
|
+
}
|
|
13247
|
+
function findPseudoOverlays(deps, section, image, overlays, box) {
|
|
13248
|
+
if (!deps.pseudo) return [];
|
|
13249
|
+
const out = [];
|
|
13250
|
+
const read = (host, which) => {
|
|
13251
|
+
let style;
|
|
13252
|
+
try {
|
|
13253
|
+
style = deps.pseudo(host, which);
|
|
13254
|
+
} catch {
|
|
13255
|
+
return;
|
|
13256
|
+
}
|
|
13257
|
+
if (!style || !style.content || style.content === "none" || style.content === "normal") return;
|
|
13258
|
+
if (style.display === "none" || style.position !== "absolute" && style.position !== "fixed") return;
|
|
13259
|
+
if (!paintOver(style, { r: 0, g: 0, b: 0, a: 0 }).painted) return;
|
|
13260
|
+
const hostBox = deps.rect(host);
|
|
13261
|
+
const px2 = (v) => /^-?[\d.]+px$/.test(v) ? parseFloat(v) : NaN;
|
|
13262
|
+
let pseudoBox;
|
|
13263
|
+
const w = px2(style.width);
|
|
13264
|
+
const h = px2(style.height);
|
|
13265
|
+
if (Number.isFinite(w) && Number.isFinite(h)) {
|
|
13266
|
+
pseudoBox = { x: hostBox.x + (px2(style.left) || 0), y: hostBox.y + (px2(style.top) || 0), width: w, height: h };
|
|
13267
|
+
} else if ([style.top, style.left, style.right, style.bottom].every((v) => px2(v) === 0)) {
|
|
13268
|
+
pseudoBox = hostBox;
|
|
13269
|
+
} else {
|
|
13270
|
+
return;
|
|
13271
|
+
}
|
|
13272
|
+
const sectionArea = area(box);
|
|
13273
|
+
if (sectionArea > 0 && area(intersect(pseudoBox, box)) >= IMAGE_COVER_RATIO * sectionArea) out.push({ style, box: pseudoBox });
|
|
13274
|
+
};
|
|
13275
|
+
if (image.tagName !== "IMG") {
|
|
13276
|
+
read(image, "::before");
|
|
13277
|
+
read(image, "::after");
|
|
13278
|
+
}
|
|
13279
|
+
for (let p = image.parentElement; p && section.contains(p); p = p.parentElement) {
|
|
13280
|
+
read(p, "::after");
|
|
13281
|
+
if (p === section) break;
|
|
13282
|
+
}
|
|
13283
|
+
for (const overlay of overlays) {
|
|
13284
|
+
read(overlay, "::before");
|
|
13285
|
+
read(overlay, "::after");
|
|
13286
|
+
}
|
|
13287
|
+
return out;
|
|
13288
|
+
}
|
|
13289
|
+
function textRegion(deps, section, imageBox) {
|
|
13290
|
+
let region = null;
|
|
13291
|
+
for (const el of Array.from(section.querySelectorAll(TEXT_SELECTOR))) {
|
|
13292
|
+
const box = intersect(deps.rect(el), imageBox);
|
|
13293
|
+
if (box.width > 0 && box.height > 0) region = union(region, box);
|
|
13294
|
+
}
|
|
13295
|
+
return region ? { ...region, x: region.x - imageBox.x, y: region.y - imageBox.y } : null;
|
|
13296
|
+
}
|
|
13297
|
+
function opacityOf(style) {
|
|
13298
|
+
const n = parseFloat(style.opacity);
|
|
13299
|
+
return Number.isFinite(n) ? clamp01(n) : 1;
|
|
13300
|
+
}
|
|
13301
|
+
function imageSectionColour(deps, section, box, image, onReady) {
|
|
13302
|
+
const imageStyle = deps.style(image.el);
|
|
13303
|
+
const imageBox = deps.rect(image.el);
|
|
13304
|
+
const isImg = image.urlLayer < 0;
|
|
13305
|
+
const fit = isImg ? imageStyle.objectFit : splitTopLevel(imageStyle.backgroundSize)[image.urlLayer] ?? "auto";
|
|
13306
|
+
const position = isImg ? imageStyle.objectPosition : splitTopLevel(imageStyle.backgroundPosition)[image.urlLayer] ?? "0% 0%";
|
|
13307
|
+
const visible = intersect(imageBox, box);
|
|
13308
|
+
const fallback = { x: visible.x - imageBox.x, y: visible.y - imageBox.y, width: visible.width, height: visible.height };
|
|
13309
|
+
const region = textRegion(deps, section, imageBox) ?? fallback;
|
|
13310
|
+
const overlays = findOverlays(deps, section, image.el, box);
|
|
13311
|
+
const skip = /* @__PURE__ */ new Set([image.el, ...overlays]);
|
|
13312
|
+
for (let p = image.el.parentElement; p && p !== section && section.contains(p); p = p.parentElement) skip.add(p);
|
|
13313
|
+
const behind = colourBehind(deps, image.el);
|
|
13314
|
+
const above = isImg ? "" : bgLayers(imageStyle).slice(0, image.urlLayer).join(", ");
|
|
13315
|
+
const overlayParts = [
|
|
13316
|
+
...findPseudoOverlays(deps, section, image.el, overlays, box),
|
|
13317
|
+
...overlays.map((el) => ({ style: deps.style(el), box: deps.rect(el) }))
|
|
13318
|
+
];
|
|
13319
|
+
const compose = (area2, point) => {
|
|
13320
|
+
const sampled = deps.sample(image.url, (natural) => mapRegionToImage(area2, imageBox, natural, fit, position), onReady);
|
|
13321
|
+
if (sampled === "loading" || sampled === null) return sampled;
|
|
13322
|
+
const atIn = (b) => point ? { x: point.x - b.x, y: point.y - b.y, width: b.width, height: b.height } : void 0;
|
|
13323
|
+
let color2 = behind;
|
|
13324
|
+
if (!isImg) color2 = paintOver({ backgroundColor: imageStyle.backgroundColor, backgroundImage: "none" }, color2).color;
|
|
13325
|
+
color2 = compositeColor({ ...sampled, a: sampled.a * opacityOf(imageStyle) }, color2);
|
|
13326
|
+
if (above) color2 = paintOver({ backgroundColor: "transparent", backgroundImage: above }, color2, atIn(imageBox)).color;
|
|
13327
|
+
for (const overlay of overlayParts) {
|
|
13328
|
+
const layer = paintOver(overlay.style, { r: 0, g: 0, b: 0, a: 0 }, atIn(overlay.box)).color;
|
|
13329
|
+
color2 = compositeColor({ ...layer, a: layer.a * opacityOf(overlay.style) }, color2);
|
|
13330
|
+
}
|
|
13331
|
+
return color2;
|
|
13332
|
+
};
|
|
13333
|
+
const color = compose(region);
|
|
13334
|
+
if (color === "loading" || color === null) return { color, skip };
|
|
13335
|
+
const at = (box2) => {
|
|
13336
|
+
const local = intersect(box2, imageBox);
|
|
13337
|
+
if (local.width <= 0 || local.height <= 0) return null;
|
|
13338
|
+
const result = compose(
|
|
13339
|
+
{ x: local.x - imageBox.x, y: local.y - imageBox.y, width: local.width, height: local.height },
|
|
13340
|
+
{ x: local.x + local.width / 2, y: local.y + local.height / 2 }
|
|
13341
|
+
);
|
|
13342
|
+
return result === "loading" ? null : result;
|
|
13343
|
+
};
|
|
13344
|
+
return { color, skip, at };
|
|
13345
|
+
}
|
|
13346
|
+
function writeTone(el, tone) {
|
|
13347
|
+
const previous = el.getAttribute(TONE_ATTR);
|
|
13348
|
+
if (previous === tone) return;
|
|
13349
|
+
el.setAttribute(TONE_ATTR, tone);
|
|
13350
|
+
const Event2 = el.ownerDocument?.defaultView?.CustomEvent ?? CustomEvent;
|
|
13351
|
+
el.dispatchEvent(new Event2(TONE_CHANGE_EVENT, { bubbles: true, detail: { tone, previous } }));
|
|
13352
|
+
}
|
|
13353
|
+
function isEditorBackground(el) {
|
|
13354
|
+
return el.hasAttribute("data-ohw-style-bg") || el.hasAttribute("data-ohw-style-bgcolor");
|
|
13355
|
+
}
|
|
13356
|
+
function hasPickedColour(el, context) {
|
|
13357
|
+
for (let node = el; node && node !== context; node = node.parentElement) {
|
|
13358
|
+
const style = node.style;
|
|
13359
|
+
if (style?.color && style.getPropertyPriority("color") === "important") return true;
|
|
13360
|
+
}
|
|
13361
|
+
return false;
|
|
13362
|
+
}
|
|
13363
|
+
var TEXT_SPOTS = [
|
|
13364
|
+
[1 / 6, 1 / 4],
|
|
13365
|
+
[1 / 2, 1 / 4],
|
|
13366
|
+
[5 / 6, 1 / 4],
|
|
13367
|
+
[1 / 6, 3 / 4],
|
|
13368
|
+
[1 / 2, 3 / 4],
|
|
13369
|
+
[5 / 6, 3 / 4]
|
|
13370
|
+
];
|
|
13371
|
+
function fixInks(doc) {
|
|
13372
|
+
const view = doc?.defaultView;
|
|
13373
|
+
const root = doc?.documentElement;
|
|
13374
|
+
const read = (names, fallback) => {
|
|
13375
|
+
if (!view || !root) return fallback;
|
|
13376
|
+
let style;
|
|
13377
|
+
try {
|
|
13378
|
+
style = view.getComputedStyle(root);
|
|
13379
|
+
} catch {
|
|
13380
|
+
return fallback;
|
|
13381
|
+
}
|
|
13382
|
+
for (const name of names) {
|
|
13383
|
+
const parsed = parseCssColor(style.getPropertyValue(name).trim());
|
|
13384
|
+
if (parsed) return parsed;
|
|
13385
|
+
}
|
|
13386
|
+
return fallback;
|
|
13387
|
+
};
|
|
13388
|
+
return {
|
|
13389
|
+
dark: read(["--ohw-brand-dark", "--color-dark"], { r: 12, g: 10, b: 9, a: 1 }),
|
|
13390
|
+
light: read(["--ohw-brand-light", "--color-light"], WHITE)
|
|
13391
|
+
};
|
|
13392
|
+
}
|
|
13393
|
+
function glyphBox(el) {
|
|
13394
|
+
try {
|
|
13395
|
+
const range = el.ownerDocument?.createRange?.();
|
|
13396
|
+
if (!range) return null;
|
|
13397
|
+
range.selectNodeContents(el);
|
|
13398
|
+
const r2 = range.getBoundingClientRect?.();
|
|
13399
|
+
range.detach?.();
|
|
13400
|
+
return r2 && r2.width > 0 && r2.height > 0 ? { x: r2.left, y: r2.top, width: r2.width, height: r2.height } : null;
|
|
13401
|
+
} catch {
|
|
13402
|
+
return null;
|
|
13403
|
+
}
|
|
13404
|
+
}
|
|
13405
|
+
function worstContrast(ink, spots) {
|
|
13406
|
+
let worst = Infinity;
|
|
13407
|
+
for (const bg of spots) worst = Math.min(worst, contrastRatioOf(compositeColor(ink, bg), bg));
|
|
13408
|
+
return worst;
|
|
13409
|
+
}
|
|
13410
|
+
function spotsOf(box, at) {
|
|
13411
|
+
const spots = [];
|
|
13412
|
+
if (box.width <= 0 || box.height <= 0) return spots;
|
|
13413
|
+
const w = box.width / 3;
|
|
13414
|
+
const h = box.height / 2;
|
|
13415
|
+
for (const [fx, fy] of TEXT_SPOTS) {
|
|
13416
|
+
const bg = at({ x: box.x + fx * box.width - w / 2, y: box.y + fy * box.height - h / 2, width: w, height: h });
|
|
13417
|
+
if (bg) spots.push(bg);
|
|
13418
|
+
}
|
|
13419
|
+
return spots;
|
|
13420
|
+
}
|
|
13421
|
+
function fixTextOnImage(el, text, box, at, inks) {
|
|
13422
|
+
if (!text) return;
|
|
13423
|
+
const spots = spotsOf(box, at);
|
|
13424
|
+
if (spots.length === 0 || worstContrast(text, spots) >= IMAGE_TEXT_MIN_CONTRAST) return;
|
|
13425
|
+
const darkWorks = worstContrast(inks.dark, spots) >= IMAGE_TEXT_MIN_CONTRAST;
|
|
13426
|
+
const lightWorks = worstContrast(inks.light, spots) >= IMAGE_TEXT_MIN_CONTRAST;
|
|
13427
|
+
if (darkWorks && (!lightWorks || worstContrast(inks.dark, spots) >= worstContrast(inks.light, spots))) {
|
|
13428
|
+
el.setAttribute(TONE_FIX_ATTR, "light");
|
|
13429
|
+
} else if (lightWorks) {
|
|
13430
|
+
el.setAttribute(TONE_FIX_ATTR, "dark");
|
|
13431
|
+
}
|
|
13432
|
+
}
|
|
13433
|
+
var KEYED_TEXT_SELECTOR = "[data-ohw-key]:not([data-ohw-editable])";
|
|
13434
|
+
function hasOwnText(el) {
|
|
13435
|
+
for (const node of Array.from(el.childNodes)) if (node.nodeType === 3 && node.textContent?.trim()) return true;
|
|
13436
|
+
return false;
|
|
13437
|
+
}
|
|
13438
|
+
function hiddenWithin(deps, el, stop) {
|
|
13439
|
+
for (let node = el; node && node !== stop; node = node.parentElement) {
|
|
13440
|
+
const style = deps.style(node);
|
|
13441
|
+
if (style.visibility === "hidden" || opacityOf(style) < VISIBLE_ALPHA) return true;
|
|
13442
|
+
}
|
|
13443
|
+
return false;
|
|
13444
|
+
}
|
|
13445
|
+
function fixTextContrast(deps, section, resolved, imageContexts, pending) {
|
|
13446
|
+
let inks = null;
|
|
13447
|
+
const texts = new Set(Array.from(section.querySelectorAll(TEXT_SELECTOR)));
|
|
13448
|
+
const keyed = /* @__PURE__ */ new Set();
|
|
13449
|
+
for (const el of Array.from(section.querySelectorAll(KEYED_TEXT_SELECTOR))) {
|
|
13450
|
+
if (!texts.has(el) && hasOwnText(el)) keyed.add(el);
|
|
13451
|
+
}
|
|
13452
|
+
for (const el of [...texts, ...keyed]) {
|
|
13453
|
+
const overlayRoot = el.closest(OVERLAY_ROOT_SELECTOR);
|
|
13454
|
+
if (overlayRoot && !onOwnSurface(deps, el, overlayRoot)) continue;
|
|
13455
|
+
const context = el.closest(`[${TONE_ATTR}]`);
|
|
13456
|
+
if (context && pending.has(context)) continue;
|
|
13457
|
+
const bg = context ? resolved.get(context) : void 0;
|
|
13458
|
+
const imageAt = context ? imageContexts.get(context) : void 0;
|
|
13459
|
+
const onImage = !!imageAt;
|
|
13460
|
+
if (!context || !bg || !isEditorBackground(context) && !onImage || keyed.has(el) && !onImage) {
|
|
13461
|
+
el.removeAttribute(TONE_FIX_ATTR);
|
|
13462
|
+
continue;
|
|
13463
|
+
}
|
|
13464
|
+
if (imageAt && !isEditorBackground(context) && hiddenWithin(deps, el, context)) continue;
|
|
13465
|
+
const had = el.getAttribute(TONE_FIX_ATTR);
|
|
13466
|
+
if (had) el.removeAttribute(TONE_FIX_ATTR);
|
|
13467
|
+
if (imageAt && !isEditorBackground(context)) {
|
|
13468
|
+
if (!hasPickedColour(el, context)) {
|
|
13469
|
+
inks ?? (inks = fixInks(section.ownerDocument));
|
|
13470
|
+
fixTextOnImage(el, parseCssColor(deps.style(el).color), glyphBox(el) ?? deps.rect(el), imageAt, inks);
|
|
13471
|
+
}
|
|
13472
|
+
continue;
|
|
13473
|
+
}
|
|
13474
|
+
const text = parseCssColor(deps.style(el).color);
|
|
13475
|
+
const bgTone = toneOfColor(bg);
|
|
13476
|
+
const needsFix = text !== null && toneOfColor(compositeColor(text, bg)) === bgTone;
|
|
13477
|
+
if (needsFix) el.setAttribute(TONE_FIX_ATTR, bgTone);
|
|
13478
|
+
}
|
|
13479
|
+
}
|
|
13480
|
+
function pickedButtonInks(doc) {
|
|
13481
|
+
const root = doc?.documentElement;
|
|
13482
|
+
const inks = [];
|
|
13483
|
+
for (const name of PICKED_BUTTON_TEXT_VARS) {
|
|
13484
|
+
const raw = root?.style?.getPropertyValue(name).trim();
|
|
13485
|
+
if (!raw) continue;
|
|
13486
|
+
const ink = parseCssColor(raw);
|
|
13487
|
+
if (!ink) return "any";
|
|
13488
|
+
inks.push(ink);
|
|
13489
|
+
}
|
|
13490
|
+
return inks;
|
|
13491
|
+
}
|
|
13492
|
+
function sameColour(a, b) {
|
|
13493
|
+
return Math.abs(a.r - b.r) < 2 && Math.abs(a.g - b.g) < 2 && Math.abs(a.b - b.b) < 2;
|
|
13494
|
+
}
|
|
13495
|
+
function unreadableOn(ink, bg) {
|
|
13496
|
+
if (!ink) return false;
|
|
13497
|
+
const seen = compositeColor(ink, bg);
|
|
13498
|
+
return toneOfColor(seen) === toneOfColor(bg) && contrastRatioOf(seen, bg) < INK_MIN_CONTRAST;
|
|
13499
|
+
}
|
|
13500
|
+
function fixButtonInk(deps, section, painted) {
|
|
13501
|
+
const buttons = Array.from(section.querySelectorAll(BUTTON_SELECTOR));
|
|
13502
|
+
if (buttons.length === 0) return;
|
|
13503
|
+
const picked = pickedButtonInks(section.ownerDocument);
|
|
13504
|
+
for (const button of buttons) {
|
|
13505
|
+
const icons = Array.from(button.querySelectorAll("svg"));
|
|
13506
|
+
const chips = [];
|
|
13507
|
+
for (const icon of icons) if (icon.parentElement && icon.parentElement !== button) chips.push(icon.parentElement);
|
|
13508
|
+
const targets = [button, ...chips, ...icons];
|
|
13509
|
+
for (const el of targets) {
|
|
13510
|
+
el.setAttribute(MEASURING_ATTR, "");
|
|
13511
|
+
if (!chips.includes(el)) el.removeAttribute(TONE_FIX_ATTR);
|
|
13512
|
+
}
|
|
13513
|
+
try {
|
|
13514
|
+
const own = button;
|
|
13515
|
+
if (picked === "any" || button.hasAttribute("data-ohw-btn-variant") || own.style?.color) continue;
|
|
13516
|
+
const fresh = (el) => {
|
|
13517
|
+
const behind = el?.parentElement ? painted.get(el.parentElement) : void 0;
|
|
13518
|
+
return el && behind && painted.has(el) ? paintOver(deps.style(el), behind).color : void 0;
|
|
13519
|
+
};
|
|
13520
|
+
const fill = fresh(button);
|
|
13521
|
+
if (!fill) continue;
|
|
13522
|
+
const ink = parseCssColor(deps.style(button).color);
|
|
13523
|
+
if (ink && picked.some((p) => sameColour(p, ink))) continue;
|
|
13524
|
+
if (unreadableOn(ink, fill)) button.setAttribute(TONE_FIX_ATTR, toneOfColor(fill));
|
|
13525
|
+
for (const icon of icons) {
|
|
13526
|
+
const behind = fresh(icon.parentElement);
|
|
13527
|
+
if (behind && unreadableOn(parseCssColor(deps.style(icon).color), behind)) {
|
|
13528
|
+
icon.setAttribute(TONE_FIX_ATTR, toneOfColor(behind));
|
|
13529
|
+
}
|
|
13530
|
+
}
|
|
13531
|
+
} finally {
|
|
13532
|
+
void deps.style(button).color;
|
|
13533
|
+
for (const el of targets) el.removeAttribute(MEASURING_ATTR);
|
|
13534
|
+
}
|
|
13535
|
+
}
|
|
13536
|
+
}
|
|
13537
|
+
var INK_FIX_CSS = `[${MEASURING_ATTR}] { transition: none !important; }
|
|
13538
|
+
[${TONE_FIX_ATTR}="dark"] { color: var(--ohw-brand-light, var(--color-light, #FFFFFF)) !important; }
|
|
13539
|
+
[${TONE_FIX_ATTR}="light"] { color: var(--ohw-brand-dark, var(--color-dark, #0C0A09)) !important; }
|
|
13540
|
+
[${TONE_FIX_LINE_ATTR}="dark"] { border-bottom-color: var(--ohw-brand-light, var(--color-light, #FFFFFF)) !important; }
|
|
13541
|
+
[${TONE_FIX_LINE_ATTR}="light"] { border-bottom-color: var(--ohw-brand-dark, var(--color-dark, #0C0A09)) !important; }`;
|
|
13542
|
+
function ensureInkFixStyles(doc) {
|
|
13543
|
+
if (doc.getElementById(INK_FIX_STYLE_ID)) return;
|
|
13544
|
+
const style = doc.createElement("style");
|
|
13545
|
+
style.id = INK_FIX_STYLE_ID;
|
|
13546
|
+
style.textContent = INK_FIX_CSS;
|
|
13547
|
+
doc.head?.appendChild(style);
|
|
13548
|
+
}
|
|
13549
|
+
var sectionPhotos = /* @__PURE__ */ new WeakMap();
|
|
13550
|
+
var OVERLAY_ROOT_SELECTOR = "[data-ohw-nav-root]";
|
|
13551
|
+
function onOwnSurface(deps, el, root) {
|
|
13552
|
+
for (let node = el; node; node = node.parentElement) {
|
|
13553
|
+
if (paintOver(deps.style(node), { r: 0, g: 0, b: 0, a: 0 }).painted) return true;
|
|
13554
|
+
if (node === root) break;
|
|
13555
|
+
}
|
|
13556
|
+
return false;
|
|
13557
|
+
}
|
|
13558
|
+
function contains(box, x, y) {
|
|
13559
|
+
return x >= box.x && x <= box.x + box.width && y >= box.y && y <= box.y + box.height;
|
|
13560
|
+
}
|
|
13561
|
+
function fixOverlayText(deps, doc) {
|
|
13562
|
+
const roots = Array.from(doc.querySelectorAll(OVERLAY_ROOT_SELECTOR));
|
|
13563
|
+
if (roots.length === 0) return;
|
|
13564
|
+
const photoSections = topSections(doc).filter((s) => sectionPhotos.has(s));
|
|
13565
|
+
const boxes = new Map(photoSections.map((s) => [s, deps.rect(s)]));
|
|
13566
|
+
let inks = null;
|
|
13567
|
+
for (const root of roots) {
|
|
13568
|
+
const items = [];
|
|
13569
|
+
for (const el of Array.from(root.querySelectorAll(TEXT_SELECTOR))) {
|
|
13570
|
+
if (onOwnSurface(deps, el, root)) continue;
|
|
13571
|
+
const box = glyphBox(el) ?? deps.rect(el);
|
|
13572
|
+
const cx2 = box.x + box.width / 2;
|
|
13573
|
+
const cy = box.y + box.height / 2;
|
|
13574
|
+
const under = photoSections.find((s) => contains(boxes.get(s), cx2, cy));
|
|
13575
|
+
const photo = under ? sectionPhotos.get(under) : void 0;
|
|
13576
|
+
if (photo === "loading") continue;
|
|
13577
|
+
el.removeAttribute(TONE_FIX_ATTR);
|
|
13578
|
+
for (let node = el; node; node = node.parentElement) {
|
|
13579
|
+
node.removeAttribute(TONE_FIX_LINE_ATTR);
|
|
13580
|
+
if (node === root) break;
|
|
13581
|
+
}
|
|
13582
|
+
if (!photo || el.closest(BUTTON_SELECTOR)) continue;
|
|
13583
|
+
if (hasPickedColour(el, doc.documentElement) || hiddenWithin(deps, el, null)) continue;
|
|
13584
|
+
const text = parseCssColor(deps.style(el).color);
|
|
13585
|
+
const spots = spotsOf(box, photo);
|
|
13586
|
+
if (text && spots.length > 0) items.push({ el, text, spots, line: underlineOf(deps, el, root) });
|
|
13587
|
+
}
|
|
13588
|
+
inks ?? (inks = fixInks(doc));
|
|
13589
|
+
fixBarInk(items, inks);
|
|
13590
|
+
for (const item of items) {
|
|
13591
|
+
const fix = item.el.getAttribute(TONE_FIX_ATTR);
|
|
13592
|
+
if (fix) item.line?.setAttribute(TONE_FIX_LINE_ATTR, fix);
|
|
13593
|
+
}
|
|
13594
|
+
}
|
|
13595
|
+
}
|
|
13596
|
+
function underlineOf(deps, el, root) {
|
|
13597
|
+
const text = parseCssColor(deps.style(el).color);
|
|
13598
|
+
if (!text) return null;
|
|
13599
|
+
for (let node = el; node; node = node.parentElement) {
|
|
13600
|
+
const style = deps.style(node);
|
|
13601
|
+
const line = parseCssColor(style.borderBottomColor);
|
|
13602
|
+
if (line && line.a > VISIBLE_ALPHA && parseFloat(style.borderBottomWidth ?? "0") > 0 && style.borderBottomStyle !== "none" && sameColour(line, text)) {
|
|
13603
|
+
return node;
|
|
13604
|
+
}
|
|
13605
|
+
if (node === root) break;
|
|
13606
|
+
}
|
|
13607
|
+
return null;
|
|
13608
|
+
}
|
|
13609
|
+
function fixBarInk(items, inks) {
|
|
13610
|
+
if (!items.some((item) => worstContrast(item.text, item.spots) < IMAGE_TEXT_MIN_CONTRAST)) return;
|
|
13611
|
+
const score = (ink) => {
|
|
13612
|
+
let readable = 0;
|
|
13613
|
+
let worst = Infinity;
|
|
13614
|
+
for (const item of items) {
|
|
13615
|
+
const c = worstContrast(ink, item.spots);
|
|
13616
|
+
if (c >= IMAGE_TEXT_MIN_CONTRAST) readable++;
|
|
13617
|
+
worst = Math.min(worst, c);
|
|
13618
|
+
}
|
|
13619
|
+
return { readable, worst };
|
|
13620
|
+
};
|
|
13621
|
+
const dark = score(inks.dark);
|
|
13622
|
+
const light = score(inks.light);
|
|
13623
|
+
if (dark.readable === 0 && light.readable === 0) return;
|
|
13624
|
+
const useDark = dark.readable > light.readable || dark.readable === light.readable && dark.worst >= light.worst;
|
|
13625
|
+
const fix = useDark ? "light" : "dark";
|
|
13626
|
+
for (const item of items) {
|
|
13627
|
+
if (toneOfColor(item.text) === (useDark ? "dark" : "light")) continue;
|
|
13628
|
+
item.el.setAttribute(TONE_FIX_ATTR, fix);
|
|
13629
|
+
}
|
|
13630
|
+
}
|
|
13631
|
+
function computeSection(deps, section, onReady) {
|
|
13632
|
+
const box = deps.rect(section);
|
|
13633
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
13634
|
+
const painted = /* @__PURE__ */ new Map();
|
|
13635
|
+
const written = /* @__PURE__ */ new Set();
|
|
13636
|
+
const imageContexts = /* @__PURE__ */ new Map();
|
|
13637
|
+
const pending = /* @__PURE__ */ new Set();
|
|
13638
|
+
let base;
|
|
13639
|
+
let skip = /* @__PURE__ */ new Set();
|
|
13640
|
+
const images = box.width > 0 && box.height > 0 ? findImages(deps, section) : [];
|
|
13641
|
+
const image = images.find((candidate) => covers(deps, candidate.el, box)) ?? null;
|
|
13642
|
+
if (image) {
|
|
13643
|
+
const result = imageSectionColour(deps, section, box, image, onReady);
|
|
13644
|
+
if (result.color === "loading") {
|
|
13645
|
+
sectionPhotos.set(section, "loading");
|
|
13646
|
+
return;
|
|
13647
|
+
}
|
|
13648
|
+
skip = result.skip;
|
|
13649
|
+
base = result.color ?? WHITE;
|
|
13650
|
+
writeTone(section, result.color ? toneOfColor(base) : "light");
|
|
13651
|
+
if (result.color && result.at) {
|
|
13652
|
+
imageContexts.set(section, result.at);
|
|
13653
|
+
sectionPhotos.set(section, result.at);
|
|
13654
|
+
} else {
|
|
13655
|
+
sectionPhotos.delete(section);
|
|
13656
|
+
}
|
|
13657
|
+
} else {
|
|
13658
|
+
sectionPhotos.delete(section);
|
|
13659
|
+
base = paintOver(deps.style(section), colourBehind(deps, section)).color;
|
|
13660
|
+
writeTone(section, toneOfColor(base));
|
|
13661
|
+
}
|
|
13662
|
+
resolved.set(section, base);
|
|
13663
|
+
painted.set(section, base);
|
|
13664
|
+
written.add(section);
|
|
13665
|
+
const hosts = findImageHosts(deps, section, images, image, onReady);
|
|
13666
|
+
for (const hosted of hosts.values()) for (const el of hosted.skip) skip.add(el);
|
|
13667
|
+
const visit = (parent, behind, context) => {
|
|
13668
|
+
for (const child of Array.from(parent.children)) {
|
|
13669
|
+
if (NEVER_SURFACE.has(child.tagName.toUpperCase())) continue;
|
|
13670
|
+
const hosted = hosts.get(child);
|
|
13671
|
+
if (hosted) {
|
|
13672
|
+
written.add(child);
|
|
13673
|
+
if (hosted.color === "loading") {
|
|
13674
|
+
pending.add(child);
|
|
13675
|
+
painted.set(child, behind);
|
|
13676
|
+
visit(child, behind, context);
|
|
13677
|
+
continue;
|
|
13678
|
+
}
|
|
13679
|
+
const color = hosted.color ?? WHITE;
|
|
13680
|
+
writeTone(child, hosted.color ? toneOfColor(color) : "light");
|
|
13681
|
+
if (hosted.color && hosted.at) imageContexts.set(child, hosted.at);
|
|
13682
|
+
resolved.set(child, color);
|
|
13683
|
+
painted.set(child, color);
|
|
13684
|
+
visit(child, color, color);
|
|
13685
|
+
continue;
|
|
13686
|
+
}
|
|
13687
|
+
if (skip.has(child)) {
|
|
13688
|
+
painted.set(child, behind);
|
|
13689
|
+
visit(child, behind, context);
|
|
13690
|
+
continue;
|
|
13691
|
+
}
|
|
13692
|
+
const style = deps.style(child);
|
|
13693
|
+
if (style.display === "none") continue;
|
|
13694
|
+
const paint3 = paintOver(style, behind);
|
|
13695
|
+
painted.set(child, paint3.color);
|
|
13696
|
+
let nextContext = context;
|
|
13697
|
+
const forced = isEditorBackground(child) || child.matches(SECTION_SELECTOR);
|
|
13698
|
+
if (forced || paint3.painted && paint3.opaque) {
|
|
13699
|
+
const rect = deps.rect(child);
|
|
13700
|
+
const bigEnough = rect.width >= SURFACE_MIN_PX && rect.height >= SURFACE_MIN_PX;
|
|
13701
|
+
const differs = Math.abs(relativeLuminanceOf(paint3.color) - relativeLuminanceOf(context)) > 0.01 || toneOfColor(paint3.color) !== toneOfColor(context);
|
|
13702
|
+
if (forced || bigEnough && differs) {
|
|
13703
|
+
writeTone(child, toneOfColor(paint3.color));
|
|
13704
|
+
resolved.set(child, paint3.color);
|
|
13705
|
+
written.add(child);
|
|
13706
|
+
nextContext = paint3.color;
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13709
|
+
visit(child, paint3.color, nextContext);
|
|
13710
|
+
}
|
|
13711
|
+
};
|
|
13712
|
+
visit(section, base, base);
|
|
13713
|
+
for (const stale of Array.from(section.querySelectorAll(`[${TONE_ATTR}]`))) {
|
|
13714
|
+
if (!written.has(stale)) stale.removeAttribute(TONE_ATTR);
|
|
13715
|
+
}
|
|
13716
|
+
fixTextContrast(deps, section, resolved, imageContexts, pending);
|
|
13717
|
+
fixButtonInk(deps, section, painted);
|
|
13718
|
+
}
|
|
13719
|
+
function topSections(root) {
|
|
13720
|
+
return Array.from(root.querySelectorAll(SECTION_SELECTOR)).filter((el) => !el.parentElement?.closest(SECTION_SELECTOR));
|
|
13721
|
+
}
|
|
13722
|
+
function computeBackgroundTones(doc, options = {}) {
|
|
13723
|
+
const deps = options.deps ?? browserDeps();
|
|
13724
|
+
const sections = options.only ? Array.from(options.only) : topSections(doc);
|
|
13725
|
+
for (const section of sections) {
|
|
13726
|
+
if (!section.isConnected) continue;
|
|
13727
|
+
computeSection(deps, section, () => options.onImageReady?.(section));
|
|
13728
|
+
}
|
|
13729
|
+
fixOverlayText(deps, doc);
|
|
13730
|
+
}
|
|
13731
|
+
function toneFor(el) {
|
|
13732
|
+
const value = el?.closest(`[${TONE_ATTR}]`)?.getAttribute(TONE_ATTR);
|
|
13733
|
+
return value === "dark" ? "dark" : "light";
|
|
13734
|
+
}
|
|
13735
|
+
var WATCHED_ATTRS = [
|
|
13736
|
+
"style",
|
|
13737
|
+
"class",
|
|
13738
|
+
"src",
|
|
13739
|
+
"srcset",
|
|
13740
|
+
"data-ohw-style-bg",
|
|
13741
|
+
"data-ohw-style-bgcolor",
|
|
13742
|
+
"data-ohw-style-cardbg",
|
|
13743
|
+
// The editor's Default / Hover toggle forces :hover rules through this attribute.
|
|
13744
|
+
"data-ohw-active-state"
|
|
13745
|
+
];
|
|
13746
|
+
var VISIBILITY_TRANSITIONS = /* @__PURE__ */ new Set(["opacity", "visibility"]);
|
|
13747
|
+
function outermostSection(node) {
|
|
13748
|
+
let el = node instanceof Element ? node : node?.parentElement ?? null;
|
|
13749
|
+
let top = null;
|
|
13750
|
+
while (el) {
|
|
13751
|
+
const section = el.closest(SECTION_SELECTOR);
|
|
13752
|
+
if (!section) break;
|
|
13753
|
+
top = section;
|
|
13754
|
+
el = section.parentElement;
|
|
13755
|
+
}
|
|
13756
|
+
return top;
|
|
13757
|
+
}
|
|
13758
|
+
function mountBackgroundTone(doc = document) {
|
|
13759
|
+
const win = doc.defaultView;
|
|
13760
|
+
if (!win) return () => void 0;
|
|
13761
|
+
const dirty = /* @__PURE__ */ new Set();
|
|
13762
|
+
let all = true;
|
|
13763
|
+
let frame = 0;
|
|
13764
|
+
const run = () => {
|
|
13765
|
+
frame = 0;
|
|
13766
|
+
const only = all ? void 0 : Array.from(dirty);
|
|
13767
|
+
all = false;
|
|
13768
|
+
dirty.clear();
|
|
13769
|
+
computeBackgroundTones(doc, { only, onImageReady: (section) => schedule(section) });
|
|
13770
|
+
};
|
|
13771
|
+
function schedule(section) {
|
|
13772
|
+
if (section) dirty.add(section);
|
|
13773
|
+
else all = true;
|
|
13774
|
+
if (!frame) frame = win.requestAnimationFrame(run);
|
|
13775
|
+
}
|
|
13776
|
+
ensureInkFixStyles(doc);
|
|
13777
|
+
const observer = new MutationObserver((records) => {
|
|
13778
|
+
for (const record of records) {
|
|
13779
|
+
const target = record.target;
|
|
13780
|
+
if (target === doc.documentElement || doc.head?.contains(target)) {
|
|
13781
|
+
schedule();
|
|
13782
|
+
continue;
|
|
13783
|
+
}
|
|
13784
|
+
const section = outermostSection(target);
|
|
13785
|
+
if (section) {
|
|
13786
|
+
schedule(section);
|
|
13787
|
+
continue;
|
|
13788
|
+
}
|
|
13789
|
+
const targetEl = target instanceof Element ? target : target.parentElement;
|
|
13790
|
+
if (targetEl?.closest(OVERLAY_ROOT_SELECTOR)) {
|
|
13791
|
+
if (!frame) frame = win.requestAnimationFrame(run);
|
|
13792
|
+
continue;
|
|
13793
|
+
}
|
|
13794
|
+
for (const added of Array.from(record.addedNodes)) {
|
|
13795
|
+
if (added instanceof Element && (added.matches(SECTION_SELECTOR) || added.querySelector(SECTION_SELECTOR))) {
|
|
13796
|
+
schedule();
|
|
13797
|
+
break;
|
|
13798
|
+
}
|
|
13799
|
+
}
|
|
13800
|
+
}
|
|
13801
|
+
});
|
|
13802
|
+
observer.observe(doc.documentElement, {
|
|
13803
|
+
subtree: true,
|
|
13804
|
+
childList: true,
|
|
13805
|
+
characterData: true,
|
|
13806
|
+
attributes: true,
|
|
13807
|
+
attributeFilter: WATCHED_ATTRS
|
|
13808
|
+
});
|
|
13809
|
+
const onResize = () => schedule();
|
|
13810
|
+
const onTransitionEnd = (event) => {
|
|
13811
|
+
if (!VISIBILITY_TRANSITIONS.has(event.propertyName)) return;
|
|
13812
|
+
const section = outermostSection(event.target);
|
|
13813
|
+
if (section) schedule(section);
|
|
13814
|
+
};
|
|
13815
|
+
win.addEventListener("resize", onResize);
|
|
13816
|
+
win.addEventListener("load", onResize);
|
|
13817
|
+
doc.addEventListener("transitionend", onTransitionEnd, true);
|
|
13818
|
+
doc.fonts?.ready.then(() => schedule()).catch(() => void 0);
|
|
13819
|
+
schedule();
|
|
13820
|
+
return () => {
|
|
13821
|
+
observer.disconnect();
|
|
13822
|
+
win.removeEventListener("resize", onResize);
|
|
13823
|
+
win.removeEventListener("load", onResize);
|
|
13824
|
+
doc.removeEventListener("transitionend", onTransitionEnd, true);
|
|
13825
|
+
if (frame) win.cancelAnimationFrame(frame);
|
|
13826
|
+
};
|
|
13827
|
+
}
|
|
13828
|
+
|
|
13829
|
+
// src/useBackgroundTone.ts
|
|
13830
|
+
function useBackgroundTone() {
|
|
13831
|
+
(0, import_react6.useEffect)(() => mountBackgroundTone(), []);
|
|
13832
|
+
}
|
|
13833
|
+
|
|
13834
|
+
// src/useHashLinkScroll.ts
|
|
13835
|
+
var import_react7 = require("react");
|
|
13836
|
+
|
|
12790
13837
|
// src/lib/scroll-to-section.ts
|
|
12791
13838
|
var MAX_ATTEMPTS = 12;
|
|
12792
13839
|
var RETRY_MS = 100;
|
|
@@ -12839,7 +13886,7 @@ function samePageSectionId(anchor) {
|
|
|
12839
13886
|
return id || null;
|
|
12840
13887
|
}
|
|
12841
13888
|
function useHashLinkScroll(isEditMode) {
|
|
12842
|
-
(0,
|
|
13889
|
+
(0, import_react7.useEffect)(() => {
|
|
12843
13890
|
if (isEditMode) return;
|
|
12844
13891
|
const onClick = (e) => {
|
|
12845
13892
|
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
@@ -12854,7 +13901,7 @@ function useHashLinkScroll(isEditMode) {
|
|
|
12854
13901
|
}
|
|
12855
13902
|
|
|
12856
13903
|
// src/usePublishedPlaceholderStrip.ts
|
|
12857
|
-
var
|
|
13904
|
+
var import_react8 = require("react");
|
|
12858
13905
|
|
|
12859
13906
|
// src/lib/strip-placeholders.ts
|
|
12860
13907
|
var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
@@ -12941,7 +13988,7 @@ function stripTextNode(node) {
|
|
|
12941
13988
|
|
|
12942
13989
|
// src/usePublishedPlaceholderStrip.ts
|
|
12943
13990
|
function usePublishedPlaceholderStrip(isEditMode) {
|
|
12944
|
-
(0,
|
|
13991
|
+
(0, import_react8.useEffect)(() => {
|
|
12945
13992
|
if (isEditMode) return;
|
|
12946
13993
|
stripPlaceholders(document.body);
|
|
12947
13994
|
const observer = new MutationObserver((records) => {
|
|
@@ -12962,10 +14009,10 @@ function usePublishedPlaceholderStrip(isEditMode) {
|
|
|
12962
14009
|
}
|
|
12963
14010
|
|
|
12964
14011
|
// src/ui/SchedulingWidget.tsx
|
|
12965
|
-
var
|
|
14012
|
+
var import_react10 = require("react");
|
|
12966
14013
|
|
|
12967
14014
|
// src/ui/EmailCaptureModal.tsx
|
|
12968
|
-
var
|
|
14015
|
+
var import_react9 = require("react");
|
|
12969
14016
|
var import_radix_ui = require("radix-ui");
|
|
12970
14017
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
12971
14018
|
var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
@@ -12995,11 +14042,11 @@ function Spinner() {
|
|
|
12995
14042
|
);
|
|
12996
14043
|
}
|
|
12997
14044
|
function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
|
|
12998
|
-
const [email, setEmail] = (0,
|
|
12999
|
-
const [submittedEmail, setSubmittedEmail] = (0,
|
|
13000
|
-
const [loading, setLoading] = (0,
|
|
13001
|
-
const [success, setSuccess] = (0,
|
|
13002
|
-
const [error, setError] = (0,
|
|
14045
|
+
const [email, setEmail] = (0, import_react9.useState)("");
|
|
14046
|
+
const [submittedEmail, setSubmittedEmail] = (0, import_react9.useState)("");
|
|
14047
|
+
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
14048
|
+
const [success, setSuccess] = (0, import_react9.useState)(false);
|
|
14049
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
13003
14050
|
const isBook = title === "Confirm your spot";
|
|
13004
14051
|
const handleSubmit = async () => {
|
|
13005
14052
|
const trimmed = email.trim();
|
|
@@ -13266,21 +14313,21 @@ function LoadingSkeleton() {
|
|
|
13266
14313
|
] });
|
|
13267
14314
|
}
|
|
13268
14315
|
function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
|
|
13269
|
-
const todayMs = (0,
|
|
14316
|
+
const todayMs = (0, import_react10.useMemo)(() => {
|
|
13270
14317
|
const d = /* @__PURE__ */ new Date();
|
|
13271
14318
|
d.setHours(0, 0, 0, 0);
|
|
13272
14319
|
return d.getTime();
|
|
13273
14320
|
}, []);
|
|
13274
|
-
const scrollRef = (0,
|
|
13275
|
-
const [canScrollLeft, setCanScrollLeft] = (0,
|
|
13276
|
-
const [canScrollRight, setCanScrollRight] = (0,
|
|
14321
|
+
const scrollRef = (0, import_react10.useRef)(null);
|
|
14322
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react10.useState)(false);
|
|
14323
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react10.useState)(false);
|
|
13277
14324
|
const updateScrollState = () => {
|
|
13278
14325
|
const el = scrollRef.current;
|
|
13279
14326
|
if (!el) return;
|
|
13280
14327
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
13281
14328
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
13282
14329
|
};
|
|
13283
|
-
(0,
|
|
14330
|
+
(0, import_react10.useEffect)(() => {
|
|
13284
14331
|
const el = scrollRef.current;
|
|
13285
14332
|
if (!el) return;
|
|
13286
14333
|
updateScrollState();
|
|
@@ -13295,9 +14342,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
13295
14342
|
const scroll = (dir) => {
|
|
13296
14343
|
scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
|
|
13297
14344
|
};
|
|
13298
|
-
const isDragging = (0,
|
|
13299
|
-
const dragStartX = (0,
|
|
13300
|
-
const dragStartScrollLeft = (0,
|
|
14345
|
+
const isDragging = (0, import_react10.useRef)(false);
|
|
14346
|
+
const dragStartX = (0, import_react10.useRef)(0);
|
|
14347
|
+
const dragStartScrollLeft = (0, import_react10.useRef)(0);
|
|
13301
14348
|
const onDragStart = (e) => {
|
|
13302
14349
|
if (!scrollRef.current) return;
|
|
13303
14350
|
isDragging.current = true;
|
|
@@ -13317,14 +14364,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
13317
14364
|
scrollRef.current.style.cursor = "grab";
|
|
13318
14365
|
scrollRef.current.style.userSelect = "";
|
|
13319
14366
|
};
|
|
13320
|
-
const datesWithClasses = (0,
|
|
14367
|
+
const datesWithClasses = (0, import_react10.useMemo)(
|
|
13321
14368
|
() => new Set(dates.map(
|
|
13322
14369
|
(d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
|
|
13323
14370
|
).filter((i) => i >= 0)),
|
|
13324
14371
|
[dates, schedule]
|
|
13325
14372
|
);
|
|
13326
14373
|
const selectedDate = dates[selectedIdx];
|
|
13327
|
-
const selectedClasses = (0,
|
|
14374
|
+
const selectedClasses = (0, import_react10.useMemo)(
|
|
13328
14375
|
() => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
|
|
13329
14376
|
[schedule, selectedDate]
|
|
13330
14377
|
);
|
|
@@ -13509,16 +14556,16 @@ function CalendarFoldIcon() {
|
|
|
13509
14556
|
);
|
|
13510
14557
|
}
|
|
13511
14558
|
function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
|
|
13512
|
-
const autoId = (0,
|
|
14559
|
+
const autoId = (0, import_react10.useId)();
|
|
13513
14560
|
const insertAfter = insertAfterProp ?? autoId;
|
|
13514
|
-
const [schedule, setSchedule] = (0,
|
|
13515
|
-
const [loading, setLoading] = (0,
|
|
13516
|
-
const [inEditor, setInEditor] = (0,
|
|
13517
|
-
const [isHovered, setIsHovered] = (0,
|
|
13518
|
-
const [modalState, setModalState] = (0,
|
|
13519
|
-
const switchScheduleIdRef = (0,
|
|
13520
|
-
const liveScheduleIdRef = (0,
|
|
13521
|
-
const refetchLiveSchedule = (0,
|
|
14561
|
+
const [schedule, setSchedule] = (0, import_react10.useState)(null);
|
|
14562
|
+
const [loading, setLoading] = (0, import_react10.useState)(initialScheduleId !== null);
|
|
14563
|
+
const [inEditor, setInEditor] = (0, import_react10.useState)(false);
|
|
14564
|
+
const [isHovered, setIsHovered] = (0, import_react10.useState)(false);
|
|
14565
|
+
const [modalState, setModalState] = (0, import_react10.useState)(null);
|
|
14566
|
+
const switchScheduleIdRef = (0, import_react10.useRef)(null);
|
|
14567
|
+
const liveScheduleIdRef = (0, import_react10.useRef)(null);
|
|
14568
|
+
const refetchLiveSchedule = (0, import_react10.useCallback)(async () => {
|
|
13522
14569
|
const id = liveScheduleIdRef.current;
|
|
13523
14570
|
if (!id) return;
|
|
13524
14571
|
try {
|
|
@@ -13528,7 +14575,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
13528
14575
|
} catch {
|
|
13529
14576
|
}
|
|
13530
14577
|
}, []);
|
|
13531
|
-
const dates = (0,
|
|
14578
|
+
const dates = (0, import_react10.useMemo)(() => {
|
|
13532
14579
|
const today = /* @__PURE__ */ new Date();
|
|
13533
14580
|
today.setHours(0, 0, 0, 0);
|
|
13534
14581
|
return Array.from({ length: 14 }, (_, i) => {
|
|
@@ -13537,8 +14584,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
13537
14584
|
return d;
|
|
13538
14585
|
});
|
|
13539
14586
|
}, []);
|
|
13540
|
-
const [selectedIdx, setSelectedIdx] = (0,
|
|
13541
|
-
(0,
|
|
14587
|
+
const [selectedIdx, setSelectedIdx] = (0, import_react10.useState)(0);
|
|
14588
|
+
(0, import_react10.useEffect)(() => {
|
|
13542
14589
|
if (!schedule?.classes) return;
|
|
13543
14590
|
for (let i = 0; i < dates.length; i++) {
|
|
13544
14591
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -13547,7 +14594,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
13547
14594
|
}
|
|
13548
14595
|
}
|
|
13549
14596
|
}, [schedule, dates]);
|
|
13550
|
-
(0,
|
|
14597
|
+
(0, import_react10.useEffect)(() => {
|
|
13551
14598
|
if (typeof window === "undefined") return;
|
|
13552
14599
|
const onVisible = () => {
|
|
13553
14600
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -13559,7 +14606,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
13559
14606
|
document.removeEventListener("visibilitychange", onVisible);
|
|
13560
14607
|
};
|
|
13561
14608
|
}, [refetchLiveSchedule]);
|
|
13562
|
-
(0,
|
|
14609
|
+
(0, import_react10.useEffect)(() => {
|
|
13563
14610
|
if (typeof window === "undefined") return;
|
|
13564
14611
|
const isInEditor = window.self !== window.top;
|
|
13565
14612
|
setInEditor(isInEditor);
|
|
@@ -17314,7 +18361,7 @@ var CustomToolbarButton = React5.forwardRef(
|
|
|
17314
18361
|
CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
17315
18362
|
|
|
17316
18363
|
// src/ui/item-action-toolbar.tsx
|
|
17317
|
-
var
|
|
18364
|
+
var import_react11 = require("react");
|
|
17318
18365
|
var import_lucide_react3 = require("lucide-react");
|
|
17319
18366
|
|
|
17320
18367
|
// src/ui/dropdown-menu.tsx
|
|
@@ -17499,7 +18546,7 @@ function ItemActionToolbar({
|
|
|
17499
18546
|
headingVisible = null,
|
|
17500
18547
|
onHeadingVisibleChange
|
|
17501
18548
|
}) {
|
|
17502
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
18549
|
+
const [moreOpen, setMoreOpen] = (0, import_react11.useState)(false);
|
|
17503
18550
|
const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
|
|
17504
18551
|
const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
|
|
17505
18552
|
const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
|
|
@@ -17707,7 +18754,7 @@ function ItemActionToolbar({
|
|
|
17707
18754
|
}
|
|
17708
18755
|
|
|
17709
18756
|
// src/ui/item-interaction-layer.tsx
|
|
17710
|
-
var
|
|
18757
|
+
var import_react12 = require("react");
|
|
17711
18758
|
var import_react_dom3 = require("react-dom");
|
|
17712
18759
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
17713
18760
|
var PRIMARY = "var(--ohw-primary, #0885FE)";
|
|
@@ -17764,8 +18811,8 @@ function ClampedToolbarSlot({
|
|
|
17764
18811
|
align = "center",
|
|
17765
18812
|
children
|
|
17766
18813
|
}) {
|
|
17767
|
-
const slotRef = (0,
|
|
17768
|
-
(0,
|
|
18814
|
+
const slotRef = (0, import_react12.useRef)(null);
|
|
18815
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
17769
18816
|
const slot = slotRef.current;
|
|
17770
18817
|
if (!slot) return;
|
|
17771
18818
|
const clamp = () => {
|
|
@@ -17828,15 +18875,15 @@ function DetachedBelowToolbarSlot({
|
|
|
17828
18875
|
belowEl,
|
|
17829
18876
|
children
|
|
17830
18877
|
}) {
|
|
17831
|
-
const slotRef = (0,
|
|
17832
|
-
const [anchorBottom, setAnchorBottom] = (0,
|
|
17833
|
-
const [portalTarget] = (0,
|
|
18878
|
+
const slotRef = (0, import_react12.useRef)(null);
|
|
18879
|
+
const [anchorBottom, setAnchorBottom] = (0, import_react12.useState)(belowRect.bottom);
|
|
18880
|
+
const [portalTarget] = (0, import_react12.useState)(
|
|
17834
18881
|
() => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
|
|
17835
18882
|
);
|
|
17836
|
-
(0,
|
|
18883
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
17837
18884
|
setAnchorBottom(belowRect.bottom);
|
|
17838
18885
|
}, [belowRect.bottom, belowRect.height, belowRect.top]);
|
|
17839
|
-
(0,
|
|
18886
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
17840
18887
|
const slot = slotRef.current;
|
|
17841
18888
|
if (!slot) return;
|
|
17842
18889
|
const sync = () => {
|
|
@@ -17917,8 +18964,8 @@ function ItemInteractionLayer({
|
|
|
17917
18964
|
hidden = false,
|
|
17918
18965
|
className
|
|
17919
18966
|
}) {
|
|
17920
|
-
const localRef = (0,
|
|
17921
|
-
(0,
|
|
18967
|
+
const localRef = (0, import_react12.useRef)(null);
|
|
18968
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
17922
18969
|
const node = localRef.current;
|
|
17923
18970
|
if (!node) return;
|
|
17924
18971
|
node.style.display = hidden ? "none" : "block";
|
|
@@ -18193,7 +19240,7 @@ function apiBase() {
|
|
|
18193
19240
|
function bridgeVersion() {
|
|
18194
19241
|
try {
|
|
18195
19242
|
if (true) {
|
|
18196
|
-
return "0.1.
|
|
19243
|
+
return "0.1.173-next.460";
|
|
18197
19244
|
}
|
|
18198
19245
|
} catch {
|
|
18199
19246
|
}
|
|
@@ -18207,7 +19254,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
18207
19254
|
return;
|
|
18208
19255
|
}
|
|
18209
19256
|
try {
|
|
18210
|
-
const v = true ? "0.1.
|
|
19257
|
+
const v = true ? "0.1.173-next.460" : "";
|
|
18211
19258
|
if (v) {
|
|
18212
19259
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
18213
19260
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -19151,7 +20198,7 @@ function CarouselOverlay({
|
|
|
19151
20198
|
}
|
|
19152
20199
|
|
|
19153
20200
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
19154
|
-
var
|
|
20201
|
+
var import_react13 = require("react");
|
|
19155
20202
|
var import_lucide_react7 = require("lucide-react");
|
|
19156
20203
|
|
|
19157
20204
|
// src/lib/ai-change-highlight.ts
|
|
@@ -19283,8 +20330,8 @@ function readRect(instanceId) {
|
|
|
19283
20330
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19284
20331
|
}
|
|
19285
20332
|
function useLiveSectionRect(sectionId) {
|
|
19286
|
-
const [rect, setRect] = (0,
|
|
19287
|
-
(0,
|
|
20333
|
+
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
20334
|
+
(0, import_react13.useEffect)(() => {
|
|
19288
20335
|
if (!sectionId) {
|
|
19289
20336
|
setRect(null);
|
|
19290
20337
|
return;
|
|
@@ -19323,8 +20370,8 @@ function readNavToggleRect() {
|
|
|
19323
20370
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19324
20371
|
}
|
|
19325
20372
|
function useLiveNavToggleHole(active) {
|
|
19326
|
-
const [rect, setRect] = (0,
|
|
19327
|
-
(0,
|
|
20373
|
+
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
20374
|
+
(0, import_react13.useEffect)(() => {
|
|
19328
20375
|
if (!active) {
|
|
19329
20376
|
setRect(null);
|
|
19330
20377
|
return;
|
|
@@ -19386,7 +20433,7 @@ function ReviewButton({
|
|
|
19386
20433
|
background,
|
|
19387
20434
|
color
|
|
19388
20435
|
}) {
|
|
19389
|
-
const [hover, setHover] = (0,
|
|
20436
|
+
const [hover, setHover] = (0, import_react13.useState)(false);
|
|
19390
20437
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
|
|
19391
20438
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
19392
20439
|
"button",
|
|
@@ -19441,17 +20488,17 @@ function AiSectionOverlay({
|
|
|
19441
20488
|
apiRef,
|
|
19442
20489
|
onSelectionChange
|
|
19443
20490
|
}) {
|
|
19444
|
-
const [selectedId, setSelectedId] = (0,
|
|
19445
|
-
const [reviewId, setReviewId] = (0,
|
|
19446
|
-
const [reviewButtonsHidden, setReviewButtonsHidden] = (0,
|
|
19447
|
-
const reviewIdRef = (0,
|
|
20491
|
+
const [selectedId, setSelectedId] = (0, import_react13.useState)(null);
|
|
20492
|
+
const [reviewId, setReviewId] = (0, import_react13.useState)(null);
|
|
20493
|
+
const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react13.useState)(false);
|
|
20494
|
+
const reviewIdRef = (0, import_react13.useRef)(null);
|
|
19448
20495
|
reviewIdRef.current = reviewId;
|
|
19449
|
-
const selectedIdRef = (0,
|
|
20496
|
+
const selectedIdRef = (0, import_react13.useRef)(null);
|
|
19450
20497
|
selectedIdRef.current = selectedId;
|
|
19451
|
-
(0,
|
|
20498
|
+
(0, import_react13.useEffect)(() => {
|
|
19452
20499
|
onSelectionChange?.(selectedId);
|
|
19453
20500
|
}, [selectedId, onSelectionChange]);
|
|
19454
|
-
const report = (0,
|
|
20501
|
+
const report = (0, import_react13.useCallback)(
|
|
19455
20502
|
(el) => {
|
|
19456
20503
|
const labelSrc = el ? sectionElementOf(el) : null;
|
|
19457
20504
|
postToParent2({
|
|
@@ -19462,7 +20509,7 @@ function AiSectionOverlay({
|
|
|
19462
20509
|
},
|
|
19463
20510
|
[postToParent2]
|
|
19464
20511
|
);
|
|
19465
|
-
const selectFromElement = (0,
|
|
20512
|
+
const selectFromElement = (0, import_react13.useCallback)(
|
|
19466
20513
|
(el, options) => {
|
|
19467
20514
|
const inner = el?.closest("[data-ohw-section]") ?? null;
|
|
19468
20515
|
const sectionEl2 = inner ? movableUnit(inner) : null;
|
|
@@ -19474,7 +20521,7 @@ function AiSectionOverlay({
|
|
|
19474
20521
|
},
|
|
19475
20522
|
[report]
|
|
19476
20523
|
);
|
|
19477
|
-
(0,
|
|
20524
|
+
(0, import_react13.useEffect)(() => {
|
|
19478
20525
|
apiRef.current = {
|
|
19479
20526
|
selectFromElement,
|
|
19480
20527
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
@@ -19499,7 +20546,7 @@ function AiSectionOverlay({
|
|
|
19499
20546
|
apiRef.current = null;
|
|
19500
20547
|
};
|
|
19501
20548
|
}, [apiRef, selectFromElement, report]);
|
|
19502
|
-
(0,
|
|
20549
|
+
(0, import_react13.useEffect)(() => {
|
|
19503
20550
|
const onMessage = (e) => {
|
|
19504
20551
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
19505
20552
|
selectedIdRef.current = null;
|
|
@@ -19524,10 +20571,10 @@ function AiSectionOverlay({
|
|
|
19524
20571
|
window.addEventListener("message", onMessage);
|
|
19525
20572
|
return () => window.removeEventListener("message", onMessage);
|
|
19526
20573
|
}, [postToParent2]);
|
|
19527
|
-
(0,
|
|
19528
|
-
(0,
|
|
19529
|
-
const [hoveredId, setHoveredId] = (0,
|
|
19530
|
-
(0,
|
|
20574
|
+
(0, import_react13.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
|
|
20575
|
+
(0, import_react13.useEffect)(() => installHistoryKeyRelay(), []);
|
|
20576
|
+
const [hoveredId, setHoveredId] = (0, import_react13.useState)(null);
|
|
20577
|
+
(0, import_react13.useEffect)(() => {
|
|
19531
20578
|
const onMove = (e) => {
|
|
19532
20579
|
const t = e.target;
|
|
19533
20580
|
if (!(t instanceof Element)) return;
|
|
@@ -19552,7 +20599,7 @@ function AiSectionOverlay({
|
|
|
19552
20599
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19553
20600
|
};
|
|
19554
20601
|
}, []);
|
|
19555
|
-
(0,
|
|
20602
|
+
(0, import_react13.useEffect)(() => {
|
|
19556
20603
|
const onKeyDown = (e) => {
|
|
19557
20604
|
if (e.key !== "Escape") return;
|
|
19558
20605
|
if (reviewIdRef.current) return;
|
|
@@ -19566,7 +20613,7 @@ function AiSectionOverlay({
|
|
|
19566
20613
|
document.addEventListener("keydown", onKeyDown);
|
|
19567
20614
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
19568
20615
|
}, [report]);
|
|
19569
|
-
const decide = (0,
|
|
20616
|
+
const decide = (0, import_react13.useCallback)(
|
|
19570
20617
|
(decision) => {
|
|
19571
20618
|
const sectionId = reviewIdRef.current;
|
|
19572
20619
|
if (!sectionId) return;
|
|
@@ -19575,8 +20622,8 @@ function AiSectionOverlay({
|
|
|
19575
20622
|
},
|
|
19576
20623
|
[postToParent2]
|
|
19577
20624
|
);
|
|
19578
|
-
const [navDropdownForceOpen, setNavDropdownForceOpen] = (0,
|
|
19579
|
-
(0,
|
|
20625
|
+
const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react13.useState)(false);
|
|
20626
|
+
(0, import_react13.useEffect)(() => {
|
|
19580
20627
|
const update = () => {
|
|
19581
20628
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
19582
20629
|
};
|
|
@@ -19595,7 +20642,7 @@ function AiSectionOverlay({
|
|
|
19595
20642
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
19596
20643
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
19597
20644
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
19598
|
-
(0,
|
|
20645
|
+
(0, import_react13.useEffect)(() => {
|
|
19599
20646
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
19600
20647
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
19601
20648
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -19715,7 +20762,7 @@ function AiSectionOverlay({
|
|
|
19715
20762
|
}
|
|
19716
20763
|
|
|
19717
20764
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19718
|
-
var
|
|
20765
|
+
var import_react14 = require("react");
|
|
19719
20766
|
var import_lucide_react9 = require("lucide-react");
|
|
19720
20767
|
|
|
19721
20768
|
// src/lib/ai-media-strip-tree.ts
|
|
@@ -19996,8 +21043,8 @@ function readStripRect(ref) {
|
|
|
19996
21043
|
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19997
21044
|
}
|
|
19998
21045
|
function useLiveItemRect(ref, strip = false) {
|
|
19999
|
-
const [rect, setRect] = (0,
|
|
20000
|
-
(0,
|
|
21046
|
+
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
21047
|
+
(0, import_react14.useEffect)(() => {
|
|
20001
21048
|
if (!ref) {
|
|
20002
21049
|
setRect(null);
|
|
20003
21050
|
return;
|
|
@@ -20025,10 +21072,10 @@ var TOOLBAR_STRIP_GAP = 52;
|
|
|
20025
21072
|
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
20026
21073
|
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
20027
21074
|
function StripToolbarSlot({ stripRect, children }) {
|
|
20028
|
-
const slotRef = (0,
|
|
20029
|
-
const [shift, setShift] = (0,
|
|
21075
|
+
const slotRef = (0, import_react14.useRef)(null);
|
|
21076
|
+
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
20030
21077
|
const centerX = stripRect.left + stripRect.width / 2;
|
|
20031
|
-
(0,
|
|
21078
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
20032
21079
|
const slot = slotRef.current;
|
|
20033
21080
|
if (!slot) return;
|
|
20034
21081
|
const clamp = () => {
|
|
@@ -20177,9 +21224,9 @@ function LinkModal({
|
|
|
20177
21224
|
onClose,
|
|
20178
21225
|
onSave
|
|
20179
21226
|
}) {
|
|
20180
|
-
const [draft, setDraft] = (0,
|
|
20181
|
-
const [newTab, setNewTab] = (0,
|
|
20182
|
-
const [invalid, setInvalid] = (0,
|
|
21227
|
+
const [draft, setDraft] = (0, import_react14.useState)(href);
|
|
21228
|
+
const [newTab, setNewTab] = (0, import_react14.useState)(linkTarget !== "same-tab");
|
|
21229
|
+
const [invalid, setInvalid] = (0, import_react14.useState)(false);
|
|
20183
21230
|
const save = () => {
|
|
20184
21231
|
const next = draft.trim();
|
|
20185
21232
|
if (next && !HTTP_URL_RE.test(next)) {
|
|
@@ -20388,17 +21435,17 @@ function AiMediaStripOverlay({
|
|
|
20388
21435
|
applyTreeLocalRef,
|
|
20389
21436
|
clearInteractionChromeRef
|
|
20390
21437
|
}) {
|
|
20391
|
-
const [hover, setHover] = (0,
|
|
20392
|
-
const [active, setActive] = (0,
|
|
20393
|
-
const [itemEditOn, setItemEditOn] = (0,
|
|
20394
|
-
const [linkOpen, setLinkOpen] = (0,
|
|
20395
|
-
const [pending, setPending] = (0,
|
|
20396
|
-
const [error, setError] = (0,
|
|
20397
|
-
const activeRef = (0,
|
|
21438
|
+
const [hover, setHover] = (0, import_react14.useState)(null);
|
|
21439
|
+
const [active, setActive] = (0, import_react14.useState)(null);
|
|
21440
|
+
const [itemEditOn, setItemEditOn] = (0, import_react14.useState)(false);
|
|
21441
|
+
const [linkOpen, setLinkOpen] = (0, import_react14.useState)(false);
|
|
21442
|
+
const [pending, setPending] = (0, import_react14.useState)(false);
|
|
21443
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
21444
|
+
const activeRef = (0, import_react14.useRef)(null);
|
|
20398
21445
|
activeRef.current = active;
|
|
20399
|
-
const linkOpenRef = (0,
|
|
21446
|
+
const linkOpenRef = (0, import_react14.useRef)(false);
|
|
20400
21447
|
linkOpenRef.current = linkOpen;
|
|
20401
|
-
(0,
|
|
21448
|
+
(0, import_react14.useEffect)(() => {
|
|
20402
21449
|
const onMove = (e) => {
|
|
20403
21450
|
const ref = itemRefFromTarget(e.target);
|
|
20404
21451
|
const t = e.target;
|
|
@@ -20416,7 +21463,7 @@ function AiMediaStripOverlay({
|
|
|
20416
21463
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20417
21464
|
};
|
|
20418
21465
|
}, []);
|
|
20419
|
-
(0,
|
|
21466
|
+
(0, import_react14.useEffect)(() => {
|
|
20420
21467
|
const onClick = (e) => {
|
|
20421
21468
|
const t = e.target;
|
|
20422
21469
|
if (!(t instanceof Element)) return;
|
|
@@ -20431,7 +21478,7 @@ function AiMediaStripOverlay({
|
|
|
20431
21478
|
document.addEventListener("click", onClick, true);
|
|
20432
21479
|
return () => document.removeEventListener("click", onClick, true);
|
|
20433
21480
|
}, [clearInteractionChromeRef]);
|
|
20434
|
-
(0,
|
|
21481
|
+
(0, import_react14.useEffect)(() => {
|
|
20435
21482
|
const onBlur = () => {
|
|
20436
21483
|
if (!activeRef.current) return;
|
|
20437
21484
|
setActive(null);
|
|
@@ -20442,7 +21489,7 @@ function AiMediaStripOverlay({
|
|
|
20442
21489
|
window.addEventListener("blur", onBlur);
|
|
20443
21490
|
return () => window.removeEventListener("blur", onBlur);
|
|
20444
21491
|
}, []);
|
|
20445
|
-
(0,
|
|
21492
|
+
(0, import_react14.useEffect)(() => {
|
|
20446
21493
|
const onKeyDown = (e) => {
|
|
20447
21494
|
if (e.key !== "Escape") return;
|
|
20448
21495
|
if (!activeRef.current) return;
|
|
@@ -20455,14 +21502,14 @@ function AiMediaStripOverlay({
|
|
|
20455
21502
|
document.addEventListener("keydown", onKeyDown);
|
|
20456
21503
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
20457
21504
|
}, []);
|
|
20458
|
-
const findEntry = (0,
|
|
21505
|
+
const findEntry = (0, import_react14.useCallback)(
|
|
20459
21506
|
(sectionId) => {
|
|
20460
21507
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
20461
21508
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
20462
21509
|
},
|
|
20463
21510
|
[aiSectionsRef]
|
|
20464
21511
|
);
|
|
20465
|
-
const runMutation = (0,
|
|
21512
|
+
const runMutation = (0, import_react14.useCallback)(
|
|
20466
21513
|
async (sectionId, mutate, extraMedia) => {
|
|
20467
21514
|
const entry = findEntry(sectionId);
|
|
20468
21515
|
if (!entry) return false;
|
|
@@ -20605,7 +21652,7 @@ function AiMediaStripOverlay({
|
|
|
20605
21652
|
}
|
|
20606
21653
|
|
|
20607
21654
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
20608
|
-
var
|
|
21655
|
+
var import_react15 = require("react");
|
|
20609
21656
|
var import_lucide_react10 = require("lucide-react");
|
|
20610
21657
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
20611
21658
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
@@ -20648,8 +21695,8 @@ function readGridRect(ref) {
|
|
|
20648
21695
|
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
20649
21696
|
}
|
|
20650
21697
|
function useLiveCardRect(ref, grid = false) {
|
|
20651
|
-
const [rect, setRect] = (0,
|
|
20652
|
-
(0,
|
|
21698
|
+
const [rect, setRect] = (0, import_react15.useState)(null);
|
|
21699
|
+
(0, import_react15.useEffect)(() => {
|
|
20653
21700
|
if (!ref) {
|
|
20654
21701
|
setRect(null);
|
|
20655
21702
|
return;
|
|
@@ -20677,10 +21724,10 @@ var TOOLBAR_GRID_GAP = 52;
|
|
|
20677
21724
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
20678
21725
|
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
20679
21726
|
function GridToolbarSlot({ gridRect, children }) {
|
|
20680
|
-
const slotRef = (0,
|
|
20681
|
-
const [shift, setShift] = (0,
|
|
21727
|
+
const slotRef = (0, import_react15.useRef)(null);
|
|
21728
|
+
const [shift, setShift] = (0, import_react15.useState)(0);
|
|
20682
21729
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
20683
|
-
(0,
|
|
21730
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
20684
21731
|
const slot = slotRef.current;
|
|
20685
21732
|
if (!slot) return;
|
|
20686
21733
|
const clamp = () => {
|
|
@@ -20937,13 +21984,13 @@ function AiPricingCardOverlay({
|
|
|
20937
21984
|
aiSectionsRef,
|
|
20938
21985
|
applyTreeLocalRef
|
|
20939
21986
|
}) {
|
|
20940
|
-
const [hover, setHover] = (0,
|
|
20941
|
-
const [active, setActive] = (0,
|
|
20942
|
-
const [pending, setPending] = (0,
|
|
20943
|
-
const [error, setError] = (0,
|
|
20944
|
-
const activeRef = (0,
|
|
21987
|
+
const [hover, setHover] = (0, import_react15.useState)(null);
|
|
21988
|
+
const [active, setActive] = (0, import_react15.useState)(null);
|
|
21989
|
+
const [pending, setPending] = (0, import_react15.useState)(false);
|
|
21990
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
21991
|
+
const activeRef = (0, import_react15.useRef)(null);
|
|
20945
21992
|
activeRef.current = active;
|
|
20946
|
-
(0,
|
|
21993
|
+
(0, import_react15.useEffect)(() => {
|
|
20947
21994
|
const onMove = (e) => {
|
|
20948
21995
|
const ref = cardRefFromTarget(e.target);
|
|
20949
21996
|
const t = e.target;
|
|
@@ -20961,7 +22008,7 @@ function AiPricingCardOverlay({
|
|
|
20961
22008
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20962
22009
|
};
|
|
20963
22010
|
}, []);
|
|
20964
|
-
(0,
|
|
22011
|
+
(0, import_react15.useEffect)(() => {
|
|
20965
22012
|
const onClick = (e) => {
|
|
20966
22013
|
const t = e.target;
|
|
20967
22014
|
if (!(t instanceof Element)) return;
|
|
@@ -20973,7 +22020,7 @@ function AiPricingCardOverlay({
|
|
|
20973
22020
|
document.addEventListener("click", onClick, true);
|
|
20974
22021
|
return () => document.removeEventListener("click", onClick, true);
|
|
20975
22022
|
}, []);
|
|
20976
|
-
(0,
|
|
22023
|
+
(0, import_react15.useEffect)(() => {
|
|
20977
22024
|
const onBlur = () => {
|
|
20978
22025
|
if (!activeRef.current) return;
|
|
20979
22026
|
setActive(null);
|
|
@@ -20982,7 +22029,7 @@ function AiPricingCardOverlay({
|
|
|
20982
22029
|
window.addEventListener("blur", onBlur);
|
|
20983
22030
|
return () => window.removeEventListener("blur", onBlur);
|
|
20984
22031
|
}, []);
|
|
20985
|
-
(0,
|
|
22032
|
+
(0, import_react15.useEffect)(() => {
|
|
20986
22033
|
const onKeyDown = (e) => {
|
|
20987
22034
|
if (e.key !== "Escape") return;
|
|
20988
22035
|
if (!activeRef.current) return;
|
|
@@ -20993,14 +22040,14 @@ function AiPricingCardOverlay({
|
|
|
20993
22040
|
document.addEventListener("keydown", onKeyDown);
|
|
20994
22041
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
20995
22042
|
}, []);
|
|
20996
|
-
const findEntry = (0,
|
|
22043
|
+
const findEntry = (0, import_react15.useCallback)(
|
|
20997
22044
|
(sectionId) => {
|
|
20998
22045
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
20999
22046
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
21000
22047
|
},
|
|
21001
22048
|
[aiSectionsRef]
|
|
21002
22049
|
);
|
|
21003
|
-
const runMutation = (0,
|
|
22050
|
+
const runMutation = (0, import_react15.useCallback)(
|
|
21004
22051
|
async (sectionId, mutate) => {
|
|
21005
22052
|
const entry = findEntry(sectionId);
|
|
21006
22053
|
if (!entry) return false;
|
|
@@ -21087,7 +22134,7 @@ function AiPricingCardOverlay({
|
|
|
21087
22134
|
}
|
|
21088
22135
|
|
|
21089
22136
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
21090
|
-
var
|
|
22137
|
+
var import_react16 = require("react");
|
|
21091
22138
|
var import_lucide_react11 = require("lucide-react");
|
|
21092
22139
|
|
|
21093
22140
|
// src/lib/ai-video-tree.ts
|
|
@@ -21152,8 +22199,8 @@ function readRect4(ref) {
|
|
|
21152
22199
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
21153
22200
|
}
|
|
21154
22201
|
function useLiveBlockRect(ref) {
|
|
21155
|
-
const [rect, setRect] = (0,
|
|
21156
|
-
(0,
|
|
22202
|
+
const [rect, setRect] = (0, import_react16.useState)(null);
|
|
22203
|
+
(0, import_react16.useEffect)(() => {
|
|
21157
22204
|
if (!ref) {
|
|
21158
22205
|
setRect(null);
|
|
21159
22206
|
return;
|
|
@@ -21231,9 +22278,9 @@ function watchUrl(id) {
|
|
|
21231
22278
|
return `https://www.youtube.com/watch?v=${id}`;
|
|
21232
22279
|
}
|
|
21233
22280
|
function VideoUrlInput({ value, onCommit }) {
|
|
21234
|
-
const [draft, setDraft] = (0,
|
|
21235
|
-
const [invalid, setInvalid] = (0,
|
|
21236
|
-
(0,
|
|
22281
|
+
const [draft, setDraft] = (0, import_react16.useState)(value ? watchUrl(value) : "");
|
|
22282
|
+
const [invalid, setInvalid] = (0, import_react16.useState)(false);
|
|
22283
|
+
(0, import_react16.useEffect)(() => {
|
|
21237
22284
|
setDraft(value ? watchUrl(value) : "");
|
|
21238
22285
|
setInvalid(false);
|
|
21239
22286
|
}, [value]);
|
|
@@ -21370,13 +22417,13 @@ function AiVideoOverlay({
|
|
|
21370
22417
|
applyTreeLocalRef,
|
|
21371
22418
|
clearInteractionChromeRef
|
|
21372
22419
|
}) {
|
|
21373
|
-
const [hover, setHover] = (0,
|
|
21374
|
-
const [active, setActive] = (0,
|
|
21375
|
-
const [pending, setPending] = (0,
|
|
21376
|
-
const [error, setError] = (0,
|
|
21377
|
-
const activeRef = (0,
|
|
22420
|
+
const [hover, setHover] = (0, import_react16.useState)(null);
|
|
22421
|
+
const [active, setActive] = (0, import_react16.useState)(null);
|
|
22422
|
+
const [pending, setPending] = (0, import_react16.useState)(false);
|
|
22423
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
22424
|
+
const activeRef = (0, import_react16.useRef)(null);
|
|
21378
22425
|
activeRef.current = active;
|
|
21379
|
-
(0,
|
|
22426
|
+
(0, import_react16.useEffect)(() => {
|
|
21380
22427
|
const onMove = (e) => {
|
|
21381
22428
|
const t = e.target;
|
|
21382
22429
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -21406,7 +22453,7 @@ function AiVideoOverlay({
|
|
|
21406
22453
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
21407
22454
|
};
|
|
21408
22455
|
}, []);
|
|
21409
|
-
(0,
|
|
22456
|
+
(0, import_react16.useEffect)(() => {
|
|
21410
22457
|
const onClick = (e) => {
|
|
21411
22458
|
const current = activeRef.current;
|
|
21412
22459
|
if (!current) return;
|
|
@@ -21421,7 +22468,7 @@ function AiVideoOverlay({
|
|
|
21421
22468
|
document.addEventListener("click", onClick, true);
|
|
21422
22469
|
return () => document.removeEventListener("click", onClick, true);
|
|
21423
22470
|
}, []);
|
|
21424
|
-
(0,
|
|
22471
|
+
(0, import_react16.useEffect)(() => {
|
|
21425
22472
|
const onBlur = () => {
|
|
21426
22473
|
if (!activeRef.current) return;
|
|
21427
22474
|
setActive(null);
|
|
@@ -21430,7 +22477,7 @@ function AiVideoOverlay({
|
|
|
21430
22477
|
window.addEventListener("blur", onBlur);
|
|
21431
22478
|
return () => window.removeEventListener("blur", onBlur);
|
|
21432
22479
|
}, []);
|
|
21433
|
-
(0,
|
|
22480
|
+
(0, import_react16.useEffect)(() => {
|
|
21434
22481
|
const onKeyDown = (e) => {
|
|
21435
22482
|
if (e.key !== "Escape") return;
|
|
21436
22483
|
if (!activeRef.current) return;
|
|
@@ -21440,14 +22487,14 @@ function AiVideoOverlay({
|
|
|
21440
22487
|
document.addEventListener("keydown", onKeyDown);
|
|
21441
22488
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
21442
22489
|
}, []);
|
|
21443
|
-
const findEntry = (0,
|
|
22490
|
+
const findEntry = (0, import_react16.useCallback)(
|
|
21444
22491
|
(sectionId) => {
|
|
21445
22492
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
21446
22493
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
21447
22494
|
},
|
|
21448
22495
|
[aiSectionsRef]
|
|
21449
22496
|
);
|
|
21450
|
-
const runMutation = (0,
|
|
22497
|
+
const runMutation = (0, import_react16.useCallback)(
|
|
21451
22498
|
async (sectionId, mutate) => {
|
|
21452
22499
|
const entry = findEntry(sectionId);
|
|
21453
22500
|
if (!entry) return false;
|
|
@@ -21539,7 +22586,7 @@ function AiVideoOverlay({
|
|
|
21539
22586
|
}
|
|
21540
22587
|
|
|
21541
22588
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
21542
|
-
var
|
|
22589
|
+
var import_react17 = require("react");
|
|
21543
22590
|
var import_lucide_react12 = require("lucide-react");
|
|
21544
22591
|
|
|
21545
22592
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -21612,8 +22659,8 @@ function readRect5(ref) {
|
|
|
21612
22659
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
21613
22660
|
}
|
|
21614
22661
|
function useLiveItemRect2(ref) {
|
|
21615
|
-
const [rect, setRect] = (0,
|
|
21616
|
-
(0,
|
|
22662
|
+
const [rect, setRect] = (0, import_react17.useState)(null);
|
|
22663
|
+
(0, import_react17.useEffect)(() => {
|
|
21617
22664
|
if (!ref) {
|
|
21618
22665
|
setRect(null);
|
|
21619
22666
|
return;
|
|
@@ -21820,19 +22867,19 @@ function AiFadeCarouselOverlay({
|
|
|
21820
22867
|
applyTreeLocalRef,
|
|
21821
22868
|
clearInteractionChromeRef
|
|
21822
22869
|
}) {
|
|
21823
|
-
const [hover, setHover] = (0,
|
|
21824
|
-
const [active, setActive] = (0,
|
|
21825
|
-
const [pending, setPending] = (0,
|
|
21826
|
-
const [error, setError] = (0,
|
|
21827
|
-
const [autoplayOverride, setAutoplayOverride] = (0,
|
|
21828
|
-
const [swapping, setSwapping] = (0,
|
|
21829
|
-
const skeletonRef = (0,
|
|
21830
|
-
const activeRef = (0,
|
|
22870
|
+
const [hover, setHover] = (0, import_react17.useState)(null);
|
|
22871
|
+
const [active, setActive] = (0, import_react17.useState)(null);
|
|
22872
|
+
const [pending, setPending] = (0, import_react17.useState)(false);
|
|
22873
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
22874
|
+
const [autoplayOverride, setAutoplayOverride] = (0, import_react17.useState)(null);
|
|
22875
|
+
const [swapping, setSwapping] = (0, import_react17.useState)(null);
|
|
22876
|
+
const skeletonRef = (0, import_react17.useRef)(null);
|
|
22877
|
+
const activeRef = (0, import_react17.useRef)(null);
|
|
21831
22878
|
activeRef.current = active;
|
|
21832
|
-
(0,
|
|
22879
|
+
(0, import_react17.useEffect)(() => {
|
|
21833
22880
|
setAutoplayOverride(null);
|
|
21834
22881
|
}, [active?.sectionId, active?.index]);
|
|
21835
|
-
(0,
|
|
22882
|
+
(0, import_react17.useEffect)(() => {
|
|
21836
22883
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
21837
22884
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
21838
22885
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -21842,7 +22889,7 @@ function AiFadeCarouselOverlay({
|
|
|
21842
22889
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
21843
22890
|
return () => anim.cancel();
|
|
21844
22891
|
}, [swapping?.fadingOut]);
|
|
21845
|
-
(0,
|
|
22892
|
+
(0, import_react17.useEffect)(() => {
|
|
21846
22893
|
const onMove = (e) => {
|
|
21847
22894
|
const t = e.target;
|
|
21848
22895
|
if (!(t instanceof Element)) return;
|
|
@@ -21876,7 +22923,7 @@ function AiFadeCarouselOverlay({
|
|
|
21876
22923
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
21877
22924
|
};
|
|
21878
22925
|
}, []);
|
|
21879
|
-
(0,
|
|
22926
|
+
(0, import_react17.useEffect)(() => {
|
|
21880
22927
|
const onClick = (e) => {
|
|
21881
22928
|
const current = activeRef.current;
|
|
21882
22929
|
if (!current) return;
|
|
@@ -21891,7 +22938,7 @@ function AiFadeCarouselOverlay({
|
|
|
21891
22938
|
document.addEventListener("click", onClick, true);
|
|
21892
22939
|
return () => document.removeEventListener("click", onClick, true);
|
|
21893
22940
|
}, []);
|
|
21894
|
-
(0,
|
|
22941
|
+
(0, import_react17.useEffect)(() => {
|
|
21895
22942
|
const onBlur = () => {
|
|
21896
22943
|
if (!activeRef.current) return;
|
|
21897
22944
|
setActive(null);
|
|
@@ -21900,7 +22947,7 @@ function AiFadeCarouselOverlay({
|
|
|
21900
22947
|
window.addEventListener("blur", onBlur);
|
|
21901
22948
|
return () => window.removeEventListener("blur", onBlur);
|
|
21902
22949
|
}, []);
|
|
21903
|
-
(0,
|
|
22950
|
+
(0, import_react17.useEffect)(() => {
|
|
21904
22951
|
const onKeyDown = (e) => {
|
|
21905
22952
|
if (e.key !== "Escape") return;
|
|
21906
22953
|
if (!activeRef.current) return;
|
|
@@ -21910,14 +22957,14 @@ function AiFadeCarouselOverlay({
|
|
|
21910
22957
|
document.addEventListener("keydown", onKeyDown);
|
|
21911
22958
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
21912
22959
|
}, []);
|
|
21913
|
-
const findEntry = (0,
|
|
22960
|
+
const findEntry = (0, import_react17.useCallback)(
|
|
21914
22961
|
(sectionId) => {
|
|
21915
22962
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
21916
22963
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
21917
22964
|
},
|
|
21918
22965
|
[aiSectionsRef]
|
|
21919
22966
|
);
|
|
21920
|
-
const runMutation = (0,
|
|
22967
|
+
const runMutation = (0, import_react17.useCallback)(
|
|
21921
22968
|
async (sectionId, mutate, extraMedia) => {
|
|
21922
22969
|
const entry = findEntry(sectionId);
|
|
21923
22970
|
if (!entry) return false;
|
|
@@ -22056,6 +23103,51 @@ function AiFadeCarouselOverlay({
|
|
|
22056
23103
|
var import_react_dom6 = require("react-dom");
|
|
22057
23104
|
var import_navigation4 = require("next/navigation");
|
|
22058
23105
|
|
|
23106
|
+
// src/lib/seeable.ts
|
|
23107
|
+
var MIN_SEEN_OPACITY = 0.05;
|
|
23108
|
+
function isSeeable(el) {
|
|
23109
|
+
const view = el.ownerDocument?.defaultView;
|
|
23110
|
+
if (!view) return true;
|
|
23111
|
+
for (let node = el; node && node !== el.ownerDocument.documentElement; node = node.parentElement) {
|
|
23112
|
+
const style = view.getComputedStyle(node);
|
|
23113
|
+
if (style.display === "none" || style.visibility === "hidden") return false;
|
|
23114
|
+
const opacity = parseFloat(style.opacity);
|
|
23115
|
+
if (Number.isFinite(opacity) && opacity < MIN_SEEN_OPACITY) return false;
|
|
23116
|
+
}
|
|
23117
|
+
return true;
|
|
23118
|
+
}
|
|
23119
|
+
function shownAs(el) {
|
|
23120
|
+
if (isSeeable(el)) return el;
|
|
23121
|
+
const key = el.getAttribute("data-ohw-key");
|
|
23122
|
+
if (!key) return null;
|
|
23123
|
+
const twin = Array.from(el.ownerDocument.querySelectorAll("[data-ohw-key]")).find(
|
|
23124
|
+
(other) => other !== el && other.getAttribute("data-ohw-key") === key && isSeeable(other)
|
|
23125
|
+
);
|
|
23126
|
+
return twin ?? null;
|
|
23127
|
+
}
|
|
23128
|
+
function hitsShown(el, x, y) {
|
|
23129
|
+
const shown = shownAs(el);
|
|
23130
|
+
if (!shown) return false;
|
|
23131
|
+
const r2 = shown.getBoundingClientRect();
|
|
23132
|
+
return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
|
|
23133
|
+
}
|
|
23134
|
+
function findHiddenTwinAt(selector, x, y) {
|
|
23135
|
+
return Array.from(document.querySelectorAll(selector)).find(
|
|
23136
|
+
(el) => !isSeeable(el) && hitsShown(el, x, y)
|
|
23137
|
+
) ?? null;
|
|
23138
|
+
}
|
|
23139
|
+
function stateCardFor(el, x, y) {
|
|
23140
|
+
const own = el.closest("[data-ohw-editable-state]");
|
|
23141
|
+
if (own) return own;
|
|
23142
|
+
return Array.from(document.querySelectorAll("[data-ohw-editable-state]")).find((card) => {
|
|
23143
|
+
const r2 = card.getBoundingClientRect();
|
|
23144
|
+
return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
|
|
23145
|
+
}) ?? null;
|
|
23146
|
+
}
|
|
23147
|
+
function hoverFrame(el) {
|
|
23148
|
+
return shownAs(el) ?? el;
|
|
23149
|
+
}
|
|
23150
|
+
|
|
22059
23151
|
// src/lib/media-overlay-guards.ts
|
|
22060
23152
|
var BRIDGE_CHROME_SELECTOR = [
|
|
22061
23153
|
"[data-ohw-toolbar]",
|
|
@@ -22096,7 +23188,9 @@ function findButtonAtPoint(x, y, media) {
|
|
|
22096
23188
|
// markup, so the bbox sweep that makes real CTAs win over a full-bleed hero image
|
|
22097
23189
|
// (OHH-798) claimed them too and drew the editable-item hover frame around a control
|
|
22098
23190
|
// that isn't content. They move the slideshow; there is nothing there to edit.
|
|
22099
|
-
!el.closest("[data-ohw-carousel-control]")
|
|
23191
|
+
!el.closest("[data-ohw-carousel-control]") && // Faded out but still laid out: rebound's instructor card keeps BOOK NOW in an opacity-0
|
|
23192
|
+
// hover panel, so the Default view framed (and clicked) a button nobody can see.
|
|
23193
|
+
isSeeable(el)
|
|
22100
23194
|
);
|
|
22101
23195
|
if (hits.length === 0) return null;
|
|
22102
23196
|
return hits.reduce((best, el) => best.contains(el) ? el : best);
|
|
@@ -22197,7 +23291,7 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
22197
23291
|
}
|
|
22198
23292
|
|
|
22199
23293
|
// src/ui/link-modal/LinkPopover.tsx
|
|
22200
|
-
var
|
|
23294
|
+
var import_react21 = require("react");
|
|
22201
23295
|
|
|
22202
23296
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
22203
23297
|
var import_lucide_react16 = require("lucide-react");
|
|
@@ -22290,7 +23384,7 @@ function SectionTreeItem({
|
|
|
22290
23384
|
}
|
|
22291
23385
|
|
|
22292
23386
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
22293
|
-
var
|
|
23387
|
+
var import_react18 = require("react");
|
|
22294
23388
|
|
|
22295
23389
|
// src/ui/input.tsx
|
|
22296
23390
|
var React10 = __toESM(require("react"), 1);
|
|
@@ -22358,11 +23452,11 @@ function UrlOrPageInput({
|
|
|
22358
23452
|
readOnly = false,
|
|
22359
23453
|
urlError
|
|
22360
23454
|
}) {
|
|
22361
|
-
const inputId = (0,
|
|
22362
|
-
const inputRef = (0,
|
|
22363
|
-
const rootRef = (0,
|
|
22364
|
-
const [isFocused, setIsFocused] = (0,
|
|
22365
|
-
(0,
|
|
23455
|
+
const inputId = (0, import_react18.useId)();
|
|
23456
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
23457
|
+
const rootRef = (0, import_react18.useRef)(null);
|
|
23458
|
+
const [isFocused, setIsFocused] = (0, import_react18.useState)(false);
|
|
23459
|
+
(0, import_react18.useEffect)(() => {
|
|
22366
23460
|
if (!dropdownOpen) return;
|
|
22367
23461
|
const isOutside = (e) => {
|
|
22368
23462
|
const root = rootRef.current;
|
|
@@ -22570,7 +23664,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
22570
23664
|
}
|
|
22571
23665
|
|
|
22572
23666
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
22573
|
-
var
|
|
23667
|
+
var import_react19 = require("react");
|
|
22574
23668
|
var import_react_dom4 = require("react-dom");
|
|
22575
23669
|
var import_lucide_react17 = require("lucide-react");
|
|
22576
23670
|
var import_navigation3 = require("next/navigation");
|
|
@@ -22627,12 +23721,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
|
|
|
22627
23721
|
return null;
|
|
22628
23722
|
}
|
|
22629
23723
|
function useSectionRects(sectionIdsKey, enabled) {
|
|
22630
|
-
const [rects, setRects] = (0,
|
|
22631
|
-
const sectionIds = (0,
|
|
23724
|
+
const [rects, setRects] = (0, import_react19.useState)(/* @__PURE__ */ new Map());
|
|
23725
|
+
const sectionIds = (0, import_react19.useMemo)(
|
|
22632
23726
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
22633
23727
|
[sectionIdsKey]
|
|
22634
23728
|
);
|
|
22635
|
-
(0,
|
|
23729
|
+
(0, import_react19.useEffect)(() => {
|
|
22636
23730
|
if (!enabled || sectionIds.length === 0) {
|
|
22637
23731
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
22638
23732
|
return;
|
|
@@ -22673,13 +23767,13 @@ function SectionPickerOverlay({
|
|
|
22673
23767
|
}) {
|
|
22674
23768
|
const router = (0, import_navigation3.useRouter)();
|
|
22675
23769
|
const pathname = (0, import_navigation3.usePathname)();
|
|
22676
|
-
const [selectedId, setSelectedId] = (0,
|
|
22677
|
-
const [hoveredId, setHoveredId] = (0,
|
|
22678
|
-
const pointerRef = (0,
|
|
22679
|
-
const pointerScreenRef = (0,
|
|
22680
|
-
const iframeOffsetTopRef = (0,
|
|
22681
|
-
const sectionIdsRef = (0,
|
|
22682
|
-
const [chromeClip, setChromeClip] = (0,
|
|
23770
|
+
const [selectedId, setSelectedId] = (0, import_react19.useState)(null);
|
|
23771
|
+
const [hoveredId, setHoveredId] = (0, import_react19.useState)(null);
|
|
23772
|
+
const pointerRef = (0, import_react19.useRef)(null);
|
|
23773
|
+
const pointerScreenRef = (0, import_react19.useRef)(null);
|
|
23774
|
+
const iframeOffsetTopRef = (0, import_react19.useRef)(null);
|
|
23775
|
+
const sectionIdsRef = (0, import_react19.useRef)([]);
|
|
23776
|
+
const [chromeClip, setChromeClip] = (0, import_react19.useState)(
|
|
22683
23777
|
() => ({
|
|
22684
23778
|
top: 0,
|
|
22685
23779
|
bottom: typeof window !== "undefined" ? window.innerHeight : 0
|
|
@@ -22687,12 +23781,12 @@ function SectionPickerOverlay({
|
|
|
22687
23781
|
);
|
|
22688
23782
|
const normalizedTarget = normalizePath(pagePath);
|
|
22689
23783
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
22690
|
-
(0,
|
|
23784
|
+
(0, import_react19.useEffect)(() => {
|
|
22691
23785
|
if (isOnTargetPage) return;
|
|
22692
23786
|
const search = readPreservedSearch();
|
|
22693
23787
|
router.push(`${normalizedTarget}${search}`);
|
|
22694
23788
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
22695
|
-
(0,
|
|
23789
|
+
(0, import_react19.useEffect)(() => {
|
|
22696
23790
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
22697
23791
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
22698
23792
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -22704,24 +23798,24 @@ function SectionPickerOverlay({
|
|
|
22704
23798
|
document.documentElement.removeAttribute("data-ohw-section-picking");
|
|
22705
23799
|
};
|
|
22706
23800
|
}, []);
|
|
22707
|
-
const liveSections = (0,
|
|
23801
|
+
const liveSections = (0, import_react19.useMemo)(() => {
|
|
22708
23802
|
if (!isOnTargetPage) return sections;
|
|
22709
23803
|
const live = collectSectionsFromDom();
|
|
22710
23804
|
if (live.length === 0) return sections;
|
|
22711
23805
|
const labels = new Map(sections.map((s) => [s.id, s.label]));
|
|
22712
23806
|
return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
|
|
22713
23807
|
}, [isOnTargetPage, sections, pathname]);
|
|
22714
|
-
const sectionIdsKey = (0,
|
|
23808
|
+
const sectionIdsKey = (0, import_react19.useMemo)(
|
|
22715
23809
|
() => liveSections.map((s) => s.id).join("\0"),
|
|
22716
23810
|
[liveSections]
|
|
22717
23811
|
);
|
|
22718
|
-
const sectionIds = (0,
|
|
23812
|
+
const sectionIds = (0, import_react19.useMemo)(
|
|
22719
23813
|
() => liveSections.map((s) => s.id),
|
|
22720
23814
|
[liveSections]
|
|
22721
23815
|
);
|
|
22722
23816
|
sectionIdsRef.current = sectionIds;
|
|
22723
23817
|
const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
|
|
22724
|
-
const applyHoverAt = (0,
|
|
23818
|
+
const applyHoverAt = (0, import_react19.useCallback)(
|
|
22725
23819
|
(x, y, liveRects) => {
|
|
22726
23820
|
const ids = sectionIdsRef.current;
|
|
22727
23821
|
const map = liveRects ?? readSectionRects(ids);
|
|
@@ -22730,7 +23824,7 @@ function SectionPickerOverlay({
|
|
|
22730
23824
|
},
|
|
22731
23825
|
[]
|
|
22732
23826
|
);
|
|
22733
|
-
(0,
|
|
23827
|
+
(0, import_react19.useEffect)(() => {
|
|
22734
23828
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
22735
23829
|
const next = getIframeVisibleClip({
|
|
22736
23830
|
iframeOffsetTop,
|
|
@@ -22774,12 +23868,12 @@ function SectionPickerOverlay({
|
|
|
22774
23868
|
window.removeEventListener("resize", onResize);
|
|
22775
23869
|
};
|
|
22776
23870
|
}, [applyHoverAt]);
|
|
22777
|
-
(0,
|
|
23871
|
+
(0, import_react19.useEffect)(() => {
|
|
22778
23872
|
const ptr = pointerRef.current;
|
|
22779
23873
|
if (!ptr) return;
|
|
22780
23874
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
22781
23875
|
}, [rects, applyHoverAt]);
|
|
22782
|
-
(0,
|
|
23876
|
+
(0, import_react19.useEffect)(() => {
|
|
22783
23877
|
const rememberPointer = (clientX, clientY) => {
|
|
22784
23878
|
pointerRef.current = { x: clientX, y: clientY };
|
|
22785
23879
|
const top = iframeOffsetTopRef.current;
|
|
@@ -22803,7 +23897,7 @@ function SectionPickerOverlay({
|
|
|
22803
23897
|
window.removeEventListener("message", onPointerSync);
|
|
22804
23898
|
};
|
|
22805
23899
|
}, [rects, applyHoverAt]);
|
|
22806
|
-
const handleSelect = (0,
|
|
23900
|
+
const handleSelect = (0, import_react19.useCallback)(
|
|
22807
23901
|
(section) => {
|
|
22808
23902
|
if (selectedId) return;
|
|
22809
23903
|
setSelectedId(section.id);
|
|
@@ -22811,7 +23905,7 @@ function SectionPickerOverlay({
|
|
|
22811
23905
|
},
|
|
22812
23906
|
[selectedId, onSelect]
|
|
22813
23907
|
);
|
|
22814
|
-
(0,
|
|
23908
|
+
(0, import_react19.useEffect)(() => {
|
|
22815
23909
|
const onKeyDown = (e) => {
|
|
22816
23910
|
if (e.key === "Escape") {
|
|
22817
23911
|
e.preventDefault();
|
|
@@ -22934,7 +24028,7 @@ function SectionPickerOverlay({
|
|
|
22934
24028
|
}
|
|
22935
24029
|
|
|
22936
24030
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22937
|
-
var
|
|
24031
|
+
var import_react20 = require("react");
|
|
22938
24032
|
function useLinkModalState({
|
|
22939
24033
|
open,
|
|
22940
24034
|
mode,
|
|
@@ -22946,14 +24040,14 @@ function useLinkModalState({
|
|
|
22946
24040
|
onClose,
|
|
22947
24041
|
onSubmit
|
|
22948
24042
|
}) {
|
|
22949
|
-
const availablePages = (0,
|
|
22950
|
-
const [searchValue, setSearchValue] = (0,
|
|
22951
|
-
const [selectedPage, setSelectedPage] = (0,
|
|
22952
|
-
const [selectedSection, setSelectedSection] = (0,
|
|
22953
|
-
const [step, setStep] = (0,
|
|
22954
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
22955
|
-
const [urlError, setUrlError] = (0,
|
|
22956
|
-
const reset = (0,
|
|
24043
|
+
const availablePages = (0, import_react20.useMemo)(() => pages, [pages]);
|
|
24044
|
+
const [searchValue, setSearchValue] = (0, import_react20.useState)("");
|
|
24045
|
+
const [selectedPage, setSelectedPage] = (0, import_react20.useState)(null);
|
|
24046
|
+
const [selectedSection, setSelectedSection] = (0, import_react20.useState)(null);
|
|
24047
|
+
const [step, setStep] = (0, import_react20.useState)("input");
|
|
24048
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react20.useState)(false);
|
|
24049
|
+
const [urlError, setUrlError] = (0, import_react20.useState)("");
|
|
24050
|
+
const reset = (0, import_react20.useCallback)(() => {
|
|
22957
24051
|
setSearchValue("");
|
|
22958
24052
|
setSelectedPage(null);
|
|
22959
24053
|
setSelectedSection(null);
|
|
@@ -22961,7 +24055,7 @@ function useLinkModalState({
|
|
|
22961
24055
|
setDropdownOpen(false);
|
|
22962
24056
|
setUrlError("");
|
|
22963
24057
|
}, []);
|
|
22964
|
-
(0,
|
|
24058
|
+
(0, import_react20.useEffect)(() => {
|
|
22965
24059
|
if (!open) return;
|
|
22966
24060
|
if (mode === "edit" && initialTarget) {
|
|
22967
24061
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22977,11 +24071,11 @@ function useLinkModalState({
|
|
|
22977
24071
|
setDropdownOpen(false);
|
|
22978
24072
|
setUrlError("");
|
|
22979
24073
|
}, [open, mode, initialTarget, reset]);
|
|
22980
|
-
const filteredPages = (0,
|
|
24074
|
+
const filteredPages = (0, import_react20.useMemo)(() => {
|
|
22981
24075
|
if (!searchValue.trim()) return availablePages;
|
|
22982
24076
|
return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
|
|
22983
24077
|
}, [availablePages, searchValue]);
|
|
22984
|
-
const activeSections = (0,
|
|
24078
|
+
const activeSections = (0, import_react20.useMemo)(() => {
|
|
22985
24079
|
if (!selectedPage) return [];
|
|
22986
24080
|
return getSectionsForPath(sectionsByPath, selectedPage.path);
|
|
22987
24081
|
}, [selectedPage, sectionsByPath]);
|
|
@@ -23030,7 +24124,7 @@ function useLinkModalState({
|
|
|
23030
24124
|
reset();
|
|
23031
24125
|
onClose();
|
|
23032
24126
|
};
|
|
23033
|
-
const isValid = (0,
|
|
24127
|
+
const isValid = (0, import_react20.useMemo)(() => {
|
|
23034
24128
|
if (urlError) return false;
|
|
23035
24129
|
if (showBreadcrumb) return true;
|
|
23036
24130
|
if (selectedPage) return true;
|
|
@@ -23127,7 +24221,7 @@ function LinkPopover({
|
|
|
23127
24221
|
onSubmit
|
|
23128
24222
|
});
|
|
23129
24223
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
23130
|
-
(0,
|
|
24224
|
+
(0, import_react21.useEffect)(() => {
|
|
23131
24225
|
if (!open) return;
|
|
23132
24226
|
if (sectionPickerActive) {
|
|
23133
24227
|
postToParent({ type: "ui:unlock" });
|
|
@@ -23369,7 +24463,7 @@ function addFooterColumnWithPersist({
|
|
|
23369
24463
|
}
|
|
23370
24464
|
|
|
23371
24465
|
// src/ui/FloatingPanel.tsx
|
|
23372
|
-
var
|
|
24466
|
+
var import_react22 = require("react");
|
|
23373
24467
|
var import_lucide_react18 = require("lucide-react");
|
|
23374
24468
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
23375
24469
|
var PANEL_WIDTH = 256;
|
|
@@ -23431,10 +24525,10 @@ function FloatingPanel({
|
|
|
23431
24525
|
className,
|
|
23432
24526
|
bodyClassName
|
|
23433
24527
|
}) {
|
|
23434
|
-
const panelRef = (0,
|
|
23435
|
-
const [measured, setMeasured] = (0,
|
|
23436
|
-
const dragRef = (0,
|
|
23437
|
-
const homeRef = (0,
|
|
24528
|
+
const panelRef = (0, import_react22.useRef)(null);
|
|
24529
|
+
const [measured, setMeasured] = (0, import_react22.useState)({ w: PANEL_WIDTH, h: 280 });
|
|
24530
|
+
const dragRef = (0, import_react22.useRef)(null);
|
|
24531
|
+
const homeRef = (0, import_react22.useRef)(null);
|
|
23438
24532
|
if (!open) {
|
|
23439
24533
|
homeRef.current = null;
|
|
23440
24534
|
} else if (position) {
|
|
@@ -23442,17 +24536,17 @@ function FloatingPanel({
|
|
|
23442
24536
|
} else if (homeRef.current == null) {
|
|
23443
24537
|
homeRef.current = defaultFloatingPanelPosition(parentScroll);
|
|
23444
24538
|
}
|
|
23445
|
-
const [liveScroll, setLiveScroll] = (0,
|
|
24539
|
+
const [liveScroll, setLiveScroll] = (0, import_react22.useState)(parentScroll);
|
|
23446
24540
|
const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
|
|
23447
24541
|
const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
|
|
23448
24542
|
const clamped = {
|
|
23449
24543
|
x: clampX(home.x, measured.w),
|
|
23450
24544
|
y: fittedY
|
|
23451
24545
|
};
|
|
23452
|
-
(0,
|
|
24546
|
+
(0, import_react22.useEffect)(() => {
|
|
23453
24547
|
setLiveScroll(parentScroll);
|
|
23454
24548
|
}, [parentScroll]);
|
|
23455
|
-
(0,
|
|
24549
|
+
(0, import_react22.useEffect)(() => {
|
|
23456
24550
|
if (!open) return;
|
|
23457
24551
|
const onParentScroll = (e) => {
|
|
23458
24552
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -23462,8 +24556,8 @@ function FloatingPanel({
|
|
|
23462
24556
|
window.addEventListener("message", onParentScroll);
|
|
23463
24557
|
return () => window.removeEventListener("message", onParentScroll);
|
|
23464
24558
|
}, [open]);
|
|
23465
|
-
const positionRef = (0,
|
|
23466
|
-
(0,
|
|
24559
|
+
const positionRef = (0, import_react22.useRef)(position);
|
|
24560
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
23467
24561
|
if (!open) {
|
|
23468
24562
|
positionRef.current = position;
|
|
23469
24563
|
return;
|
|
@@ -23473,7 +24567,7 @@ function FloatingPanel({
|
|
|
23473
24567
|
}
|
|
23474
24568
|
positionRef.current = position;
|
|
23475
24569
|
}, [open, position, liveScroll, parentScroll]);
|
|
23476
|
-
(0,
|
|
24570
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
23477
24571
|
if (!open || !panelRef.current) return;
|
|
23478
24572
|
const el = panelRef.current;
|
|
23479
24573
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -23482,7 +24576,7 @@ function FloatingPanel({
|
|
|
23482
24576
|
const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
|
|
23483
24577
|
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
23484
24578
|
}, [open, children, title, context]);
|
|
23485
|
-
const onHeaderPointerDown = (0,
|
|
24579
|
+
const onHeaderPointerDown = (0, import_react22.useCallback)(
|
|
23486
24580
|
(e) => {
|
|
23487
24581
|
if (e.button !== 0) return;
|
|
23488
24582
|
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
@@ -23501,7 +24595,7 @@ function FloatingPanel({
|
|
|
23501
24595
|
},
|
|
23502
24596
|
[clamped.x, clamped.y]
|
|
23503
24597
|
);
|
|
23504
|
-
const onHeaderPointerMove = (0,
|
|
24598
|
+
const onHeaderPointerMove = (0, import_react22.useCallback)(
|
|
23505
24599
|
(e) => {
|
|
23506
24600
|
const drag = dragRef.current;
|
|
23507
24601
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
@@ -23527,7 +24621,7 @@ function FloatingPanel({
|
|
|
23527
24621
|
},
|
|
23528
24622
|
[measured.w, onPositionChange, liveScroll]
|
|
23529
24623
|
);
|
|
23530
|
-
const endDrag = (0,
|
|
24624
|
+
const endDrag = (0, import_react22.useCallback)((e) => {
|
|
23531
24625
|
const drag = dragRef.current;
|
|
23532
24626
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
23533
24627
|
dragRef.current = null;
|
|
@@ -23537,11 +24631,11 @@ function FloatingPanel({
|
|
|
23537
24631
|
} catch {
|
|
23538
24632
|
}
|
|
23539
24633
|
}, []);
|
|
23540
|
-
(0,
|
|
24634
|
+
(0, import_react22.useEffect)(() => {
|
|
23541
24635
|
if (open) return;
|
|
23542
24636
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
23543
24637
|
}, [open]);
|
|
23544
|
-
(0,
|
|
24638
|
+
(0, import_react22.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
23545
24639
|
if (!open) return null;
|
|
23546
24640
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
23547
24641
|
"div",
|
|
@@ -24061,7 +25155,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
24061
25155
|
}
|
|
24062
25156
|
|
|
24063
25157
|
// src/useNavItemDrag.ts
|
|
24064
|
-
var
|
|
25158
|
+
var import_react23 = require("react");
|
|
24065
25159
|
function useNavItemDrag({
|
|
24066
25160
|
isEditMode,
|
|
24067
25161
|
editContentRef,
|
|
@@ -24085,11 +25179,11 @@ function useNavItemDrag({
|
|
|
24085
25179
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
24086
25180
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
24087
25181
|
}) {
|
|
24088
|
-
const navDragRef = (0,
|
|
24089
|
-
const [navDropSlots, setNavDropSlots] = (0,
|
|
24090
|
-
const [activeNavDropIndex, setActiveNavDropIndex] = (0,
|
|
24091
|
-
const navPointerDragRef = (0,
|
|
24092
|
-
const clearNavDragVisuals = (0,
|
|
25182
|
+
const navDragRef = (0, import_react23.useRef)(null);
|
|
25183
|
+
const [navDropSlots, setNavDropSlots] = (0, import_react23.useState)([]);
|
|
25184
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react23.useState)(null);
|
|
25185
|
+
const navPointerDragRef = (0, import_react23.useRef)(null);
|
|
25186
|
+
const clearNavDragVisuals = (0, import_react23.useCallback)(() => {
|
|
24093
25187
|
const session = navDragRef.current;
|
|
24094
25188
|
const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
|
|
24095
25189
|
navDragRef.current = null;
|
|
@@ -24122,7 +25216,7 @@ function useNavItemDrag({
|
|
|
24122
25216
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
24123
25217
|
unlockItemDragInteraction();
|
|
24124
25218
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
24125
|
-
const refreshNavDragVisuals = (0,
|
|
25219
|
+
const refreshNavDragVisuals = (0, import_react23.useCallback)(
|
|
24126
25220
|
(session, activeSlot, clientX, clientY) => {
|
|
24127
25221
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
24128
25222
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -24140,13 +25234,13 @@ function useNavItemDrag({
|
|
|
24140
25234
|
},
|
|
24141
25235
|
[setDraggedItemRect, setSiblingHintRects]
|
|
24142
25236
|
);
|
|
24143
|
-
const refreshNavDragVisualsRef = (0,
|
|
25237
|
+
const refreshNavDragVisualsRef = (0, import_react23.useRef)(refreshNavDragVisuals);
|
|
24144
25238
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
24145
|
-
const commitNavDragRef = (0,
|
|
25239
|
+
const commitNavDragRef = (0, import_react23.useRef)(() => {
|
|
24146
25240
|
});
|
|
24147
|
-
const beginNavDragRef = (0,
|
|
25241
|
+
const beginNavDragRef = (0, import_react23.useRef)(() => {
|
|
24148
25242
|
});
|
|
24149
|
-
const beginNavDrag = (0,
|
|
25243
|
+
const beginNavDrag = (0, import_react23.useCallback)(
|
|
24150
25244
|
(session) => {
|
|
24151
25245
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
24152
25246
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -24185,7 +25279,7 @@ function useNavItemDrag({
|
|
|
24185
25279
|
]
|
|
24186
25280
|
);
|
|
24187
25281
|
beginNavDragRef.current = beginNavDrag;
|
|
24188
|
-
const commitNavDrag = (0,
|
|
25282
|
+
const commitNavDrag = (0, import_react23.useCallback)(
|
|
24189
25283
|
(clientX, clientY) => {
|
|
24190
25284
|
const session = navDragRef.current;
|
|
24191
25285
|
if (!session) {
|
|
@@ -24264,7 +25358,7 @@ function useNavItemDrag({
|
|
|
24264
25358
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
24265
25359
|
);
|
|
24266
25360
|
commitNavDragRef.current = commitNavDrag;
|
|
24267
|
-
const startNavLinkDrag = (0,
|
|
25361
|
+
const startNavLinkDrag = (0, import_react23.useCallback)(
|
|
24268
25362
|
(anchor, clientX, clientY, wasSelected) => {
|
|
24269
25363
|
if (footerDragRef.current) return false;
|
|
24270
25364
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -24282,7 +25376,7 @@ function useNavItemDrag({
|
|
|
24282
25376
|
},
|
|
24283
25377
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
24284
25378
|
);
|
|
24285
|
-
const onNavDragOver = (0,
|
|
25379
|
+
const onNavDragOver = (0, import_react23.useCallback)(
|
|
24286
25380
|
(e) => {
|
|
24287
25381
|
const session = navDragRef.current;
|
|
24288
25382
|
if (!session) return false;
|
|
@@ -24294,7 +25388,7 @@ function useNavItemDrag({
|
|
|
24294
25388
|
},
|
|
24295
25389
|
[]
|
|
24296
25390
|
);
|
|
24297
|
-
(0,
|
|
25391
|
+
(0, import_react23.useEffect)(() => {
|
|
24298
25392
|
if (!isEditMode) return;
|
|
24299
25393
|
const THRESHOLD = 10;
|
|
24300
25394
|
const resolveWasSelected = (el) => {
|
|
@@ -24421,7 +25515,7 @@ function useNavItemDrag({
|
|
|
24421
25515
|
setLinkPopover,
|
|
24422
25516
|
suppressNextClickRef
|
|
24423
25517
|
]);
|
|
24424
|
-
const armNavPressFromChrome = (0,
|
|
25518
|
+
const armNavPressFromChrome = (0, import_react23.useCallback)(
|
|
24425
25519
|
(selected, clientX, clientY, pointerId) => {
|
|
24426
25520
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
24427
25521
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -24453,7 +25547,7 @@ function useNavItemDrag({
|
|
|
24453
25547
|
}
|
|
24454
25548
|
|
|
24455
25549
|
// src/useSectionDrag.ts
|
|
24456
|
-
var
|
|
25550
|
+
var import_react24 = require("react");
|
|
24457
25551
|
|
|
24458
25552
|
// src/lib/section-dnd.ts
|
|
24459
25553
|
function isFooterSection(el) {
|
|
@@ -24546,21 +25640,21 @@ function useSectionDrag({
|
|
|
24546
25640
|
suppressNextClickRef,
|
|
24547
25641
|
suppressClickUntilRef
|
|
24548
25642
|
}) {
|
|
24549
|
-
const sectionDragRef = (0,
|
|
24550
|
-
const [sectionDropSlots, setSectionDropSlots] = (0,
|
|
24551
|
-
const [activeSectionDropIndex, setActiveSectionDropIndex] = (0,
|
|
24552
|
-
const [isSectionDragging, setIsSectionDragging] = (0,
|
|
24553
|
-
const sectionPointerDragRef = (0,
|
|
24554
|
-
const autoScrollRafRef = (0,
|
|
24555
|
-
const autoScrollDeltaRef = (0,
|
|
24556
|
-
const stopAutoScroll = (0,
|
|
25643
|
+
const sectionDragRef = (0, import_react24.useRef)(null);
|
|
25644
|
+
const [sectionDropSlots, setSectionDropSlots] = (0, import_react24.useState)([]);
|
|
25645
|
+
const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react24.useState)(null);
|
|
25646
|
+
const [isSectionDragging, setIsSectionDragging] = (0, import_react24.useState)(false);
|
|
25647
|
+
const sectionPointerDragRef = (0, import_react24.useRef)(null);
|
|
25648
|
+
const autoScrollRafRef = (0, import_react24.useRef)(null);
|
|
25649
|
+
const autoScrollDeltaRef = (0, import_react24.useRef)(0);
|
|
25650
|
+
const stopAutoScroll = (0, import_react24.useCallback)(() => {
|
|
24557
25651
|
if (autoScrollRafRef.current != null) {
|
|
24558
25652
|
cancelAnimationFrame(autoScrollRafRef.current);
|
|
24559
25653
|
autoScrollRafRef.current = null;
|
|
24560
25654
|
}
|
|
24561
25655
|
autoScrollDeltaRef.current = 0;
|
|
24562
25656
|
}, []);
|
|
24563
|
-
const tickAutoScroll = (0,
|
|
25657
|
+
const tickAutoScroll = (0, import_react24.useCallback)(() => {
|
|
24564
25658
|
if (!sectionDragRef.current) {
|
|
24565
25659
|
stopAutoScroll();
|
|
24566
25660
|
return;
|
|
@@ -24570,7 +25664,7 @@ function useSectionDrag({
|
|
|
24570
25664
|
}
|
|
24571
25665
|
autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
|
|
24572
25666
|
}, [postToParentRef, stopAutoScroll]);
|
|
24573
|
-
const updateAutoScroll = (0,
|
|
25667
|
+
const updateAutoScroll = (0, import_react24.useCallback)(
|
|
24574
25668
|
(clientY) => {
|
|
24575
25669
|
const clip = getIframeChromeClip(parentScrollRef.current);
|
|
24576
25670
|
let delta = 0;
|
|
@@ -24592,7 +25686,7 @@ function useSectionDrag({
|
|
|
24592
25686
|
},
|
|
24593
25687
|
[parentScrollRef, stopAutoScroll, tickAutoScroll]
|
|
24594
25688
|
);
|
|
24595
|
-
const clearSectionDragVisuals = (0,
|
|
25689
|
+
const clearSectionDragVisuals = (0, import_react24.useCallback)(() => {
|
|
24596
25690
|
sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
|
|
24597
25691
|
sectionDragRef.current = null;
|
|
24598
25692
|
setSectionDropSlots([]);
|
|
@@ -24602,7 +25696,7 @@ function useSectionDrag({
|
|
|
24602
25696
|
document.documentElement.removeAttribute("data-ohw-section-dragging-root");
|
|
24603
25697
|
unlockItemDragInteraction();
|
|
24604
25698
|
}, [stopAutoScroll]);
|
|
24605
|
-
const refreshSectionDragVisuals = (0,
|
|
25699
|
+
const refreshSectionDragVisuals = (0, import_react24.useCallback)(
|
|
24606
25700
|
(session, clientX, clientY) => {
|
|
24607
25701
|
session.lastClientX = clientX;
|
|
24608
25702
|
session.lastClientY = clientY;
|
|
@@ -24616,7 +25710,7 @@ function useSectionDrag({
|
|
|
24616
25710
|
},
|
|
24617
25711
|
[updateAutoScroll]
|
|
24618
25712
|
);
|
|
24619
|
-
const beginSectionDrag = (0,
|
|
25713
|
+
const beginSectionDrag = (0, import_react24.useCallback)(
|
|
24620
25714
|
(session) => {
|
|
24621
25715
|
sectionDragRef.current = session;
|
|
24622
25716
|
setIsSectionDragging(true);
|
|
@@ -24627,7 +25721,7 @@ function useSectionDrag({
|
|
|
24627
25721
|
},
|
|
24628
25722
|
[refreshSectionDragVisuals]
|
|
24629
25723
|
);
|
|
24630
|
-
const commitSectionDrag = (0,
|
|
25724
|
+
const commitSectionDrag = (0, import_react24.useCallback)(() => {
|
|
24631
25725
|
const session = sectionDragRef.current;
|
|
24632
25726
|
if (!session) {
|
|
24633
25727
|
clearSectionDragVisuals();
|
|
@@ -24663,7 +25757,7 @@ function useSectionDrag({
|
|
|
24663
25757
|
});
|
|
24664
25758
|
});
|
|
24665
25759
|
}, [clearSectionDragVisuals, editContentRef, postToParentRef]);
|
|
24666
|
-
const startSectionPressDrag = (0,
|
|
25760
|
+
const startSectionPressDrag = (0, import_react24.useCallback)(
|
|
24667
25761
|
(el, clientX, clientY, pointerId) => {
|
|
24668
25762
|
if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
|
|
24669
25763
|
const instanceId = instanceIdOf(el);
|
|
@@ -24680,7 +25774,7 @@ function useSectionDrag({
|
|
|
24680
25774
|
},
|
|
24681
25775
|
[footerDragRef, navDragRef]
|
|
24682
25776
|
);
|
|
24683
|
-
(0,
|
|
25777
|
+
(0, import_react24.useEffect)(() => {
|
|
24684
25778
|
if (!isEditMode) return;
|
|
24685
25779
|
const onPointerDown = (e) => {
|
|
24686
25780
|
if (e.button !== 0) return;
|
|
@@ -25005,7 +26099,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
25005
26099
|
}
|
|
25006
26100
|
|
|
25007
26101
|
// src/lib/build-page-sync.ts
|
|
25008
|
-
var
|
|
26102
|
+
var import_react25 = require("react");
|
|
25009
26103
|
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
25010
26104
|
function normalisePath(path) {
|
|
25011
26105
|
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
@@ -25070,12 +26164,12 @@ function collectLinks() {
|
|
|
25070
26164
|
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
25071
26165
|
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
25072
26166
|
if (seen.has(hrefKey)) return;
|
|
25073
|
-
const
|
|
25074
|
-
if (!
|
|
26167
|
+
const area2 = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
26168
|
+
if (!area2) return;
|
|
25075
26169
|
const label = labelEl(el);
|
|
25076
|
-
if (!label &&
|
|
26170
|
+
if (!label && area2 !== "chrome") return;
|
|
25077
26171
|
seen.add(hrefKey);
|
|
25078
|
-
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
26172
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area: area2 });
|
|
25079
26173
|
});
|
|
25080
26174
|
return links;
|
|
25081
26175
|
}
|
|
@@ -25118,7 +26212,7 @@ function applyBuildPageSync(msg, deps) {
|
|
|
25118
26212
|
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
25119
26213
|
}
|
|
25120
26214
|
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
25121
|
-
(0,
|
|
26215
|
+
(0, import_react25.useEffect)(() => {
|
|
25122
26216
|
if (!isEditMode) return;
|
|
25123
26217
|
const onMessage = (e) => {
|
|
25124
26218
|
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
@@ -26593,9 +27687,9 @@ function FloatingToolbar({
|
|
|
26593
27687
|
onDelete,
|
|
26594
27688
|
deleteDisabled
|
|
26595
27689
|
}) {
|
|
26596
|
-
const localRef =
|
|
26597
|
-
const [measuredW, setMeasuredW] =
|
|
26598
|
-
const setRefs =
|
|
27690
|
+
const localRef = import_react26.default.useRef(null);
|
|
27691
|
+
const [measuredW, setMeasuredW] = import_react26.default.useState(330);
|
|
27692
|
+
const setRefs = import_react26.default.useCallback(
|
|
26599
27693
|
(node) => {
|
|
26600
27694
|
localRef.current = node;
|
|
26601
27695
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -26607,7 +27701,7 @@ function FloatingToolbar({
|
|
|
26607
27701
|
},
|
|
26608
27702
|
[elRef]
|
|
26609
27703
|
);
|
|
26610
|
-
|
|
27704
|
+
import_react26.default.useLayoutEffect(() => {
|
|
26611
27705
|
const node = localRef.current;
|
|
26612
27706
|
if (!node) return;
|
|
26613
27707
|
const update = () => {
|
|
@@ -26633,7 +27727,7 @@ function FloatingToolbar({
|
|
|
26633
27727
|
pointerEvents: "auto"
|
|
26634
27728
|
},
|
|
26635
27729
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
26636
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
27730
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react26.default.Fragment, { children: [
|
|
26637
27731
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
26638
27732
|
btns.map((btn) => {
|
|
26639
27733
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -26863,8 +27957,8 @@ function OhhwellsBridge() {
|
|
|
26863
27957
|
const router = (0, import_navigation4.useRouter)();
|
|
26864
27958
|
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
26865
27959
|
const isEditMode = isEditSessionActive();
|
|
26866
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
26867
|
-
(0,
|
|
27960
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react26.useState)(null);
|
|
27961
|
+
(0, import_react26.useEffect)(() => {
|
|
26868
27962
|
const figtreeFontId = "ohw-figtree-font";
|
|
26869
27963
|
if (!document.getElementById(figtreeFontId)) {
|
|
26870
27964
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -26890,8 +27984,8 @@ function OhhwellsBridge() {
|
|
|
26890
27984
|
};
|
|
26891
27985
|
}, []);
|
|
26892
27986
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26893
|
-
const [subdomain, setSubdomain] = (0,
|
|
26894
|
-
(0,
|
|
27987
|
+
const [subdomain, setSubdomain] = (0, import_react26.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
27988
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
26895
27989
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26896
27990
|
if (next !== subdomain) setSubdomain(next);
|
|
26897
27991
|
if (next) return;
|
|
@@ -26903,7 +27997,7 @@ function OhhwellsBridge() {
|
|
|
26903
27997
|
}, 0);
|
|
26904
27998
|
return () => window.clearTimeout(t);
|
|
26905
27999
|
}, [subdomainFromQuery, subdomain]);
|
|
26906
|
-
(0,
|
|
28000
|
+
(0, import_react26.useEffect)(() => {
|
|
26907
28001
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
26908
28002
|
const url = new URL(window.location.href);
|
|
26909
28003
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -26914,24 +28008,25 @@ function OhhwellsBridge() {
|
|
|
26914
28008
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
26915
28009
|
useSavedLinkNavigation(isEditMode);
|
|
26916
28010
|
useNavDropdownToggle(isEditMode);
|
|
28011
|
+
useBackgroundTone();
|
|
26917
28012
|
useHashLinkScroll(isEditMode);
|
|
26918
28013
|
usePublishedPlaceholderStrip(isEditMode);
|
|
26919
|
-
const postToParent2 = (0,
|
|
28014
|
+
const postToParent2 = (0, import_react26.useCallback)((data) => {
|
|
26920
28015
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
26921
28016
|
window.parent.postMessage(data, "*");
|
|
26922
28017
|
}
|
|
26923
28018
|
}, []);
|
|
26924
|
-
const [fetchState, setFetchState] = (0,
|
|
26925
|
-
const [showBranding, setShowBranding] = (0,
|
|
26926
|
-
const autoSaveTimers = (0,
|
|
26927
|
-
(0,
|
|
28019
|
+
const [fetchState, setFetchState] = (0, import_react26.useState)("idle");
|
|
28020
|
+
const [showBranding, setShowBranding] = (0, import_react26.useState)(false);
|
|
28021
|
+
const autoSaveTimers = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
|
|
28022
|
+
(0, import_react26.useEffect)(() => {
|
|
26928
28023
|
stampBridgeVersionOnDocument();
|
|
26929
28024
|
}, []);
|
|
26930
|
-
(0,
|
|
28025
|
+
(0, import_react26.useEffect)(() => {
|
|
26931
28026
|
if (isEditMode) return;
|
|
26932
28027
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26933
28028
|
}, [isEditMode, subdomain, fetchState]);
|
|
26934
|
-
(0,
|
|
28029
|
+
(0, import_react26.useEffect)(() => {
|
|
26935
28030
|
if (isEditMode || !subdomain) return;
|
|
26936
28031
|
const onError = (event) => {
|
|
26937
28032
|
reportOutageBeacon({
|
|
@@ -26952,40 +28047,40 @@ function OhhwellsBridge() {
|
|
|
26952
28047
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
26953
28048
|
};
|
|
26954
28049
|
}, [isEditMode, subdomain]);
|
|
26955
|
-
const activeElRef = (0,
|
|
26956
|
-
const pointerHeldRef = (0,
|
|
26957
|
-
const selectedElRef = (0,
|
|
26958
|
-
const selectedHrefKeyRef = (0,
|
|
26959
|
-
const selectedFooterColAttrRef = (0,
|
|
26960
|
-
const footerHeadingTitleCacheRef = (0,
|
|
26961
|
-
const originalContentRef = (0,
|
|
26962
|
-
const activeStateElRef = (0,
|
|
26963
|
-
const parentScrollRef = (0,
|
|
26964
|
-
const visibleViewportRef = (0,
|
|
26965
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
26966
|
-
const attachVisibleViewport = (0,
|
|
28050
|
+
const activeElRef = (0, import_react26.useRef)(null);
|
|
28051
|
+
const pointerHeldRef = (0, import_react26.useRef)(false);
|
|
28052
|
+
const selectedElRef = (0, import_react26.useRef)(null);
|
|
28053
|
+
const selectedHrefKeyRef = (0, import_react26.useRef)(null);
|
|
28054
|
+
const selectedFooterColAttrRef = (0, import_react26.useRef)(null);
|
|
28055
|
+
const footerHeadingTitleCacheRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
|
|
28056
|
+
const originalContentRef = (0, import_react26.useRef)(null);
|
|
28057
|
+
const activeStateElRef = (0, import_react26.useRef)(null);
|
|
28058
|
+
const parentScrollRef = (0, import_react26.useRef)(null);
|
|
28059
|
+
const visibleViewportRef = (0, import_react26.useRef)(null);
|
|
28060
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react26.useState)(null);
|
|
28061
|
+
const attachVisibleViewport = (0, import_react26.useCallback)((node) => {
|
|
26967
28062
|
visibleViewportRef.current = node;
|
|
26968
28063
|
setDialogPortalContainer(node);
|
|
26969
28064
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26970
28065
|
}, []);
|
|
26971
|
-
const toolbarElRef = (0,
|
|
26972
|
-
const glowElRef = (0,
|
|
26973
|
-
const hoveredImageRef = (0,
|
|
26974
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
26975
|
-
const dragOverElRef = (0,
|
|
26976
|
-
const [mediaHover, setMediaHover] = (0,
|
|
26977
|
-
const [selectedAiSectionId, setSelectedAiSectionId] = (0,
|
|
26978
|
-
const selectedAiSectionIdRef = (0,
|
|
26979
|
-
const handleAiSectionSelectionChange = (0,
|
|
28066
|
+
const toolbarElRef = (0, import_react26.useRef)(null);
|
|
28067
|
+
const glowElRef = (0, import_react26.useRef)(null);
|
|
28068
|
+
const hoveredImageRef = (0, import_react26.useRef)(null);
|
|
28069
|
+
const hoveredImageHasTextOverlapRef = (0, import_react26.useRef)(false);
|
|
28070
|
+
const dragOverElRef = (0, import_react26.useRef)(null);
|
|
28071
|
+
const [mediaHover, setMediaHover] = (0, import_react26.useState)(null);
|
|
28072
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react26.useState)(null);
|
|
28073
|
+
const selectedAiSectionIdRef = (0, import_react26.useRef)(null);
|
|
28074
|
+
const handleAiSectionSelectionChange = (0, import_react26.useCallback)((id) => {
|
|
26980
28075
|
selectedAiSectionIdRef.current = id;
|
|
26981
28076
|
setSelectedAiSectionId(id);
|
|
26982
28077
|
}, []);
|
|
26983
|
-
const [selectedMedia, setSelectedMedia] = (0,
|
|
26984
|
-
const selectedMediaElRef = (0,
|
|
26985
|
-
const mediaKeyDropTokenRef = (0,
|
|
26986
|
-
const selectedIconElRef = (0,
|
|
26987
|
-
const selectedSocialElRef = (0,
|
|
26988
|
-
const queueSectionKeyDrop = (0,
|
|
28078
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react26.useState)(null);
|
|
28079
|
+
const selectedMediaElRef = (0, import_react26.useRef)(null);
|
|
28080
|
+
const mediaKeyDropTokenRef = (0, import_react26.useRef)(0);
|
|
28081
|
+
const selectedIconElRef = (0, import_react26.useRef)(null);
|
|
28082
|
+
const selectedSocialElRef = (0, import_react26.useRef)(null);
|
|
28083
|
+
const queueSectionKeyDrop = (0, import_react26.useCallback)((prev) => {
|
|
26989
28084
|
const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
|
|
26990
28085
|
if (!sectionEl2) return;
|
|
26991
28086
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
|
|
@@ -27006,31 +28101,31 @@ function OhhwellsBridge() {
|
|
|
27006
28101
|
window.addEventListener("message", onQueueDrained);
|
|
27007
28102
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
27008
28103
|
}, []);
|
|
27009
|
-
const clearMediaSelection = (0,
|
|
28104
|
+
const clearMediaSelection = (0, import_react26.useCallback)(() => {
|
|
27010
28105
|
const prev = selectedMediaElRef.current;
|
|
27011
28106
|
selectedMediaElRef.current = null;
|
|
27012
28107
|
setSelectedMedia(null);
|
|
27013
28108
|
queueSectionKeyDrop(prev);
|
|
27014
28109
|
}, [queueSectionKeyDrop]);
|
|
27015
|
-
const clearMediaSelectionRef = (0,
|
|
28110
|
+
const clearMediaSelectionRef = (0, import_react26.useRef)(clearMediaSelection);
|
|
27016
28111
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
27017
|
-
const clearIconSelection = (0,
|
|
28112
|
+
const clearIconSelection = (0, import_react26.useCallback)(() => {
|
|
27018
28113
|
const prev = selectedIconElRef.current;
|
|
27019
28114
|
if (!prev) return;
|
|
27020
28115
|
selectedIconElRef.current = null;
|
|
27021
28116
|
queueSectionKeyDrop(prev);
|
|
27022
28117
|
}, [queueSectionKeyDrop]);
|
|
27023
|
-
const clearIconSelectionRef = (0,
|
|
28118
|
+
const clearIconSelectionRef = (0, import_react26.useRef)(clearIconSelection);
|
|
27024
28119
|
clearIconSelectionRef.current = clearIconSelection;
|
|
27025
|
-
const clearSocialSelection = (0,
|
|
28120
|
+
const clearSocialSelection = (0, import_react26.useCallback)(() => {
|
|
27026
28121
|
const prev = selectedSocialElRef.current;
|
|
27027
28122
|
if (!prev) return;
|
|
27028
28123
|
selectedSocialElRef.current = null;
|
|
27029
28124
|
queueSectionKeyDrop(prev);
|
|
27030
28125
|
}, [queueSectionKeyDrop]);
|
|
27031
|
-
const clearSocialSelectionRef = (0,
|
|
28126
|
+
const clearSocialSelectionRef = (0, import_react26.useRef)(clearSocialSelection);
|
|
27032
28127
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
27033
|
-
const selectIconElement = (0,
|
|
28128
|
+
const selectIconElement = (0, import_react26.useCallback)((el) => {
|
|
27034
28129
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
27035
28130
|
selectedIconElRef.current = el;
|
|
27036
28131
|
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
@@ -27043,9 +28138,9 @@ function OhhwellsBridge() {
|
|
|
27043
28138
|
keyLabel: "Icon"
|
|
27044
28139
|
});
|
|
27045
28140
|
}, []);
|
|
27046
|
-
const selectIconElementRef = (0,
|
|
28141
|
+
const selectIconElementRef = (0, import_react26.useRef)(selectIconElement);
|
|
27047
28142
|
selectIconElementRef.current = selectIconElement;
|
|
27048
|
-
const selectMediaElement = (0,
|
|
28143
|
+
const selectMediaElement = (0, import_react26.useCallback)((el) => {
|
|
27049
28144
|
const r2 = el.getBoundingClientRect();
|
|
27050
28145
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
27051
28146
|
selectedIconElRef.current = null;
|
|
@@ -27070,9 +28165,9 @@ function OhhwellsBridge() {
|
|
|
27070
28165
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
27071
28166
|
});
|
|
27072
28167
|
}, []);
|
|
27073
|
-
const selectMediaElementRef = (0,
|
|
28168
|
+
const selectMediaElementRef = (0, import_react26.useRef)(selectMediaElement);
|
|
27074
28169
|
selectMediaElementRef.current = selectMediaElement;
|
|
27075
|
-
(0,
|
|
28170
|
+
(0, import_react26.useEffect)(() => {
|
|
27076
28171
|
if (!selectedMedia) return;
|
|
27077
28172
|
const update = () => {
|
|
27078
28173
|
const el = selectedMediaElRef.current;
|
|
@@ -27092,54 +28187,56 @@ function OhhwellsBridge() {
|
|
|
27092
28187
|
window.removeEventListener("resize", update);
|
|
27093
28188
|
};
|
|
27094
28189
|
}, [selectedMedia !== null]);
|
|
27095
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
27096
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
27097
|
-
const hoveredGapRef = (0,
|
|
27098
|
-
const imageUnhoverTimerRef = (0,
|
|
27099
|
-
const imageShowTimerRef = (0,
|
|
27100
|
-
const editStylesRef = (0,
|
|
27101
|
-
const activateRef = (0,
|
|
28190
|
+
const [carouselHover, setCarouselHover] = (0, import_react26.useState)(null);
|
|
28191
|
+
const [uploadingRects, setUploadingRects] = (0, import_react26.useState)({});
|
|
28192
|
+
const hoveredGapRef = (0, import_react26.useRef)(null);
|
|
28193
|
+
const imageUnhoverTimerRef = (0, import_react26.useRef)(null);
|
|
28194
|
+
const imageShowTimerRef = (0, import_react26.useRef)(null);
|
|
28195
|
+
const editStylesRef = (0, import_react26.useRef)(null);
|
|
28196
|
+
const activateRef = (0, import_react26.useRef)(() => {
|
|
27102
28197
|
});
|
|
27103
|
-
const
|
|
28198
|
+
const stateChangeRef = (0, import_react26.useRef)(() => {
|
|
27104
28199
|
});
|
|
27105
|
-
const
|
|
28200
|
+
const deactivateRef = (0, import_react26.useRef)(() => {
|
|
27106
28201
|
});
|
|
27107
|
-
const
|
|
28202
|
+
const selectRef = (0, import_react26.useRef)(() => {
|
|
27108
28203
|
});
|
|
27109
|
-
const
|
|
28204
|
+
const selectFrameRef = (0, import_react26.useRef)(() => {
|
|
27110
28205
|
});
|
|
27111
|
-
const
|
|
28206
|
+
const selectLogoRef = (0, import_react26.useRef)(() => {
|
|
27112
28207
|
});
|
|
27113
|
-
const
|
|
28208
|
+
const openLogoSizePanelRef = (0, import_react26.useRef)(() => {
|
|
27114
28209
|
});
|
|
27115
|
-
const
|
|
28210
|
+
const deselectRef = (0, import_react26.useRef)(() => {
|
|
27116
28211
|
});
|
|
27117
|
-
const
|
|
28212
|
+
const closeFloatingPanelOnlyRef = (0, import_react26.useRef)(() => {
|
|
27118
28213
|
});
|
|
27119
|
-
const
|
|
28214
|
+
const reselectNavigationItemRef = (0, import_react26.useRef)(() => {
|
|
27120
28215
|
});
|
|
27121
|
-
const
|
|
27122
|
-
const runPendingDeleteUndoRef = (0, import_react25.useRef)(() => false);
|
|
27123
|
-
const isFooterFrameSelectionRef = (0, import_react25.useRef)(false);
|
|
27124
|
-
const refreshActiveCommandsRef = (0, import_react25.useRef)(() => {
|
|
28216
|
+
const commitNavigationTextEditRef = (0, import_react26.useRef)(() => {
|
|
27125
28217
|
});
|
|
27126
|
-
const
|
|
28218
|
+
const handleDeleteSelectedRef = (0, import_react26.useRef)(() => false);
|
|
28219
|
+
const runPendingDeleteUndoRef = (0, import_react26.useRef)(() => false);
|
|
28220
|
+
const isFooterFrameSelectionRef = (0, import_react26.useRef)(false);
|
|
28221
|
+
const refreshActiveCommandsRef = (0, import_react26.useRef)(() => {
|
|
28222
|
+
});
|
|
28223
|
+
const postToParentRef = (0, import_react26.useRef)(postToParent2);
|
|
27127
28224
|
postToParentRef.current = postToParent2;
|
|
27128
|
-
const aiSectionApiRef = (0,
|
|
27129
|
-
const sectionsLoadedRef = (0,
|
|
27130
|
-
const pendingScheduleConfigRequests = (0,
|
|
27131
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
27132
|
-
const [formPickRect, setFormPickRect] = (0,
|
|
27133
|
-
const formPickElRef = (0,
|
|
27134
|
-
const [formViewState, setFormViewStateUi] = (0,
|
|
27135
|
-
const [formPickCount, setFormPickCount] = (0,
|
|
27136
|
-
const [formHoverRect, setFormHoverRect] = (0,
|
|
27137
|
-
const formHoverElRef = (0,
|
|
27138
|
-
const [fieldPickRect, setFieldPickRect] = (0,
|
|
27139
|
-
const fieldPickElRef = (0,
|
|
27140
|
-
const [fieldPickState, setFieldPickState] = (0,
|
|
27141
|
-
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0,
|
|
27142
|
-
const clearFormPick = (0,
|
|
28225
|
+
const aiSectionApiRef = (0, import_react26.useRef)(null);
|
|
28226
|
+
const sectionsLoadedRef = (0, import_react26.useRef)(false);
|
|
28227
|
+
const pendingScheduleConfigRequests = (0, import_react26.useRef)([]);
|
|
28228
|
+
const [toolbarRect, setToolbarRect] = (0, import_react26.useState)(null);
|
|
28229
|
+
const [formPickRect, setFormPickRect] = (0, import_react26.useState)(null);
|
|
28230
|
+
const formPickElRef = (0, import_react26.useRef)(null);
|
|
28231
|
+
const [formViewState, setFormViewStateUi] = (0, import_react26.useState)("default");
|
|
28232
|
+
const [formPickCount, setFormPickCount] = (0, import_react26.useState)(null);
|
|
28233
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react26.useState)(null);
|
|
28234
|
+
const formHoverElRef = (0, import_react26.useRef)(null);
|
|
28235
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react26.useState)(null);
|
|
28236
|
+
const fieldPickElRef = (0, import_react26.useRef)(null);
|
|
28237
|
+
const [fieldPickState, setFieldPickState] = (0, import_react26.useState)(null);
|
|
28238
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react26.useState)(false);
|
|
28239
|
+
const clearFormPick = (0, import_react26.useCallback)(() => {
|
|
27143
28240
|
const form = formPickElRef.current;
|
|
27144
28241
|
const editing = fieldPickElRef.current;
|
|
27145
28242
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -27159,7 +28256,7 @@ function OhhwellsBridge() {
|
|
|
27159
28256
|
formPickElRef.current = null;
|
|
27160
28257
|
setFormPickRect(null);
|
|
27161
28258
|
}, []);
|
|
27162
|
-
const clearFieldPick = (0,
|
|
28259
|
+
const clearFieldPick = (0, import_react26.useCallback)(() => {
|
|
27163
28260
|
const wrapper = fieldPickElRef.current;
|
|
27164
28261
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
27165
28262
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -27169,9 +28266,9 @@ function OhhwellsBridge() {
|
|
|
27169
28266
|
setFieldPickRect(null);
|
|
27170
28267
|
setFieldPickState(null);
|
|
27171
28268
|
}, []);
|
|
27172
|
-
const persistFieldsRef = (0,
|
|
28269
|
+
const persistFieldsRef = (0, import_react26.useRef)(() => {
|
|
27173
28270
|
});
|
|
27174
|
-
const persistFields = (0,
|
|
28271
|
+
const persistFields = (0, import_react26.useCallback)(
|
|
27175
28272
|
(form) => {
|
|
27176
28273
|
const key = formKeyOf(form);
|
|
27177
28274
|
if (!key) return;
|
|
@@ -27182,7 +28279,7 @@ function OhhwellsBridge() {
|
|
|
27182
28279
|
[]
|
|
27183
28280
|
);
|
|
27184
28281
|
persistFieldsRef.current = persistFields;
|
|
27185
|
-
const selectField = (0,
|
|
28282
|
+
const selectField = (0, import_react26.useCallback)((wrapper) => {
|
|
27186
28283
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
27187
28284
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
27188
28285
|
}
|
|
@@ -27195,7 +28292,7 @@ function OhhwellsBridge() {
|
|
|
27195
28292
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
27196
28293
|
setFieldTypePickerOpen(false);
|
|
27197
28294
|
}, []);
|
|
27198
|
-
const withSelectedField = (0,
|
|
28295
|
+
const withSelectedField = (0, import_react26.useCallback)(
|
|
27199
28296
|
(run) => {
|
|
27200
28297
|
const wrapper = fieldPickElRef.current;
|
|
27201
28298
|
const form = formPickElRef.current;
|
|
@@ -27208,28 +28305,28 @@ function OhhwellsBridge() {
|
|
|
27208
28305
|
},
|
|
27209
28306
|
[persistFields]
|
|
27210
28307
|
);
|
|
27211
|
-
const handleFieldTypeChange = (0,
|
|
28308
|
+
const handleFieldTypeChange = (0, import_react26.useCallback)(
|
|
27212
28309
|
(type) => withSelectedField((_form, wrapper) => {
|
|
27213
28310
|
applyFieldType(wrapper, type);
|
|
27214
28311
|
selectField(wrapper);
|
|
27215
28312
|
}),
|
|
27216
28313
|
[selectField, withSelectedField]
|
|
27217
28314
|
);
|
|
27218
|
-
const handleFieldRequiredToggle = (0,
|
|
28315
|
+
const handleFieldRequiredToggle = (0, import_react26.useCallback)(
|
|
27219
28316
|
() => withSelectedField((_form, wrapper) => {
|
|
27220
28317
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
27221
28318
|
selectField(wrapper);
|
|
27222
28319
|
}),
|
|
27223
28320
|
[selectField, withSelectedField]
|
|
27224
28321
|
);
|
|
27225
|
-
const handleFieldDuplicate = (0,
|
|
28322
|
+
const handleFieldDuplicate = (0, import_react26.useCallback)(
|
|
27226
28323
|
() => withSelectedField((form, wrapper) => {
|
|
27227
28324
|
const copy = duplicateField(form, wrapper);
|
|
27228
28325
|
selectField(copy);
|
|
27229
28326
|
}),
|
|
27230
28327
|
[selectField, withSelectedField]
|
|
27231
28328
|
);
|
|
27232
|
-
const handleFieldDelete = (0,
|
|
28329
|
+
const handleFieldDelete = (0, import_react26.useCallback)(
|
|
27233
28330
|
() => withSelectedField((_form, wrapper) => {
|
|
27234
28331
|
removeField(wrapper);
|
|
27235
28332
|
clearFieldPick();
|
|
@@ -27237,7 +28334,7 @@ function OhhwellsBridge() {
|
|
|
27237
28334
|
}),
|
|
27238
28335
|
[clearFieldPick, withSelectedField]
|
|
27239
28336
|
);
|
|
27240
|
-
const handleAddField = (0,
|
|
28337
|
+
const handleAddField = (0, import_react26.useCallback)(
|
|
27241
28338
|
(type) => {
|
|
27242
28339
|
const form = formPickElRef.current;
|
|
27243
28340
|
if (!form) return;
|
|
@@ -27253,8 +28350,8 @@ function OhhwellsBridge() {
|
|
|
27253
28350
|
},
|
|
27254
28351
|
[persistFields, selectField]
|
|
27255
28352
|
);
|
|
27256
|
-
const fieldDragRef = (0,
|
|
27257
|
-
const buildFieldDropSlots = (0,
|
|
28353
|
+
const fieldDragRef = (0, import_react26.useRef)(null);
|
|
28354
|
+
const buildFieldDropSlots = (0, import_react26.useCallback)((form, draggedKey) => {
|
|
27258
28355
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
27259
28356
|
const slots = others.map((el) => {
|
|
27260
28357
|
const rect = el.getBoundingClientRect();
|
|
@@ -27267,7 +28364,7 @@ function OhhwellsBridge() {
|
|
|
27267
28364
|
}
|
|
27268
28365
|
return slots;
|
|
27269
28366
|
}, []);
|
|
27270
|
-
const handleFieldDragStart = (0,
|
|
28367
|
+
const handleFieldDragStart = (0, import_react26.useCallback)(() => {
|
|
27271
28368
|
const wrapper = fieldPickElRef.current;
|
|
27272
28369
|
const form = formPickElRef.current;
|
|
27273
28370
|
if (!wrapper || !form) return;
|
|
@@ -27276,18 +28373,18 @@ function OhhwellsBridge() {
|
|
|
27276
28373
|
setFieldDragging(true);
|
|
27277
28374
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
27278
28375
|
}, [buildFieldDropSlots]);
|
|
27279
|
-
const handleFieldDragEnd = (0,
|
|
28376
|
+
const handleFieldDragEnd = (0, import_react26.useCallback)(() => {
|
|
27280
28377
|
fieldDragRef.current = null;
|
|
27281
28378
|
setFieldDropIndex(null);
|
|
27282
28379
|
setFieldDropSlots([]);
|
|
27283
28380
|
setFieldDragging(false);
|
|
27284
28381
|
}, []);
|
|
27285
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
27286
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
27287
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
27288
|
-
const clearFormPickRef = (0,
|
|
28382
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react26.useState)(null);
|
|
28383
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react26.useState)([]);
|
|
28384
|
+
const [fieldDragging, setFieldDragging] = (0, import_react26.useState)(false);
|
|
28385
|
+
const clearFormPickRef = (0, import_react26.useRef)(clearFormPick);
|
|
27289
28386
|
clearFormPickRef.current = clearFormPick;
|
|
27290
|
-
(0,
|
|
28387
|
+
(0, import_react26.useEffect)(() => {
|
|
27291
28388
|
const el = fieldPickElRef.current;
|
|
27292
28389
|
if (!el || fieldPickRect === null) return;
|
|
27293
28390
|
const observer = new ResizeObserver(() => {
|
|
@@ -27296,7 +28393,7 @@ function OhhwellsBridge() {
|
|
|
27296
28393
|
observer.observe(el);
|
|
27297
28394
|
return () => observer.disconnect();
|
|
27298
28395
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
27299
|
-
(0,
|
|
28396
|
+
(0, import_react26.useEffect)(() => {
|
|
27300
28397
|
const el = formPickElRef.current;
|
|
27301
28398
|
if (!el || formPickRect === null) return;
|
|
27302
28399
|
const observer = new ResizeObserver(() => {
|
|
@@ -27305,27 +28402,27 @@ function OhhwellsBridge() {
|
|
|
27305
28402
|
observer.observe(el);
|
|
27306
28403
|
return () => observer.disconnect();
|
|
27307
28404
|
}, [formPickRect !== null, formViewState]);
|
|
27308
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
27309
|
-
const toolbarVariantRef = (0,
|
|
28405
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react26.useState)("none");
|
|
28406
|
+
const toolbarVariantRef = (0, import_react26.useRef)("none");
|
|
27310
28407
|
toolbarVariantRef.current = toolbarVariant;
|
|
27311
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
27312
|
-
const [selectedIsSocial, setSelectedIsSocial] = (0,
|
|
27313
|
-
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0,
|
|
27314
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
27315
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
27316
|
-
const [toggleState, setToggleState] = (0,
|
|
27317
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
27318
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
27319
|
-
const [sectionGap, setSectionGap] = (0,
|
|
27320
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
27321
|
-
const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0,
|
|
27322
|
-
const deletingAiBlockRef = (0,
|
|
27323
|
-
const hoveredNavContainerRef = (0,
|
|
27324
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
27325
|
-
const hoveredItemElRef = (0,
|
|
27326
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
27327
|
-
const [hoveredTextRect, setHoveredTextRect] = (0,
|
|
27328
|
-
(0,
|
|
28408
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react26.useState)(false);
|
|
28409
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react26.useState)(false);
|
|
28410
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react26.useState)(false);
|
|
28411
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react26.useState)(null);
|
|
28412
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react26.useState)(false);
|
|
28413
|
+
const [toggleState, setToggleState] = (0, import_react26.useState)(null);
|
|
28414
|
+
const [maxBadge, setMaxBadge] = (0, import_react26.useState)(null);
|
|
28415
|
+
const [activeCommands, setActiveCommands] = (0, import_react26.useState)(/* @__PURE__ */ new Set());
|
|
28416
|
+
const [sectionGap, setSectionGap] = (0, import_react26.useState)(null);
|
|
28417
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react26.useState)(false);
|
|
28418
|
+
const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react26.useState)(false);
|
|
28419
|
+
const deletingAiBlockRef = (0, import_react26.useRef)(false);
|
|
28420
|
+
const hoveredNavContainerRef = (0, import_react26.useRef)(null);
|
|
28421
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react26.useState)(null);
|
|
28422
|
+
const hoveredItemElRef = (0, import_react26.useRef)(null);
|
|
28423
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react26.useState)(null);
|
|
28424
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react26.useState)(null);
|
|
28425
|
+
(0, import_react26.useEffect)(() => {
|
|
27329
28426
|
const sync = () => {
|
|
27330
28427
|
const el = document.querySelector(
|
|
27331
28428
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -27369,66 +28466,66 @@ function OhhwellsBridge() {
|
|
|
27369
28466
|
});
|
|
27370
28467
|
return () => observer.disconnect();
|
|
27371
28468
|
}, []);
|
|
27372
|
-
const siblingHintElRef = (0,
|
|
27373
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
27374
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
27375
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
27376
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
28469
|
+
const siblingHintElRef = (0, import_react26.useRef)(null);
|
|
28470
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react26.useState)(null);
|
|
28471
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react26.useState)([]);
|
|
28472
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react26.useState)(false);
|
|
28473
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react26.useState)(false);
|
|
27377
28474
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
27378
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0,
|
|
27379
|
-
const [footerHeadingVisible, setFooterHeadingVisible] = (0,
|
|
27380
|
-
const footerDragRef = (0,
|
|
27381
|
-
const [footerDropSlots, setFooterDropSlots] = (0,
|
|
27382
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0,
|
|
27383
|
-
const [draggedItemRect, setDraggedItemRect] = (0,
|
|
27384
|
-
const footerPointerDragRef = (0,
|
|
27385
|
-
const suppressNextClickRef = (0,
|
|
27386
|
-
const suppressClickUntilRef = (0,
|
|
27387
|
-
const [linkPopover, setLinkPopover] = (0,
|
|
27388
|
-
const linkPopoverSessionRef = (0,
|
|
27389
|
-
const addNavAfterAnchorRef = (0,
|
|
27390
|
-
const editContentRef = (0,
|
|
28475
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react26.useState)(null);
|
|
28476
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react26.useState)(null);
|
|
28477
|
+
const footerDragRef = (0, import_react26.useRef)(null);
|
|
28478
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react26.useState)([]);
|
|
28479
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react26.useState)(null);
|
|
28480
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react26.useState)(null);
|
|
28481
|
+
const footerPointerDragRef = (0, import_react26.useRef)(null);
|
|
28482
|
+
const suppressNextClickRef = (0, import_react26.useRef)(false);
|
|
28483
|
+
const suppressClickUntilRef = (0, import_react26.useRef)(0);
|
|
28484
|
+
const [linkPopover, setLinkPopover] = (0, import_react26.useState)(null);
|
|
28485
|
+
const linkPopoverSessionRef = (0, import_react26.useRef)(null);
|
|
28486
|
+
const addNavAfterAnchorRef = (0, import_react26.useRef)(null);
|
|
28487
|
+
const editContentRef = (0, import_react26.useRef)({});
|
|
27391
28488
|
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
27392
|
-
const aiSectionsRef = (0,
|
|
27393
|
-
const aiFooterRef = (0,
|
|
27394
|
-
const applyTreeLocalRef = (0,
|
|
28489
|
+
const aiSectionsRef = (0, import_react26.useRef)("");
|
|
28490
|
+
const aiFooterRef = (0, import_react26.useRef)("");
|
|
28491
|
+
const applyTreeLocalRef = (0, import_react26.useRef)(
|
|
27395
28492
|
null
|
|
27396
28493
|
);
|
|
27397
|
-
const applyFooterTreeLocalRef = (0,
|
|
27398
|
-
const clearInteractionChromeRef = (0,
|
|
28494
|
+
const applyFooterTreeLocalRef = (0, import_react26.useRef)(null);
|
|
28495
|
+
const clearInteractionChromeRef = (0, import_react26.useRef)(() => {
|
|
27399
28496
|
});
|
|
27400
|
-
const brandKitRef = (0,
|
|
27401
|
-
const stylesRef = (0,
|
|
27402
|
-
const appliedDrawerRef = (0,
|
|
27403
|
-
const pendingDeleteUndoRef = (0,
|
|
27404
|
-
const [floatingPanel, setFloatingPanel] = (0,
|
|
27405
|
-
const floatingPanelOpenRef = (0,
|
|
27406
|
-
const floatingPanelRef = (0,
|
|
28497
|
+
const brandKitRef = (0, import_react26.useRef)("");
|
|
28498
|
+
const stylesRef = (0, import_react26.useRef)("");
|
|
28499
|
+
const appliedDrawerRef = (0, import_react26.useRef)(null);
|
|
28500
|
+
const pendingDeleteUndoRef = (0, import_react26.useRef)(null);
|
|
28501
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react26.useState)(null);
|
|
28502
|
+
const floatingPanelOpenRef = (0, import_react26.useRef)(false);
|
|
28503
|
+
const floatingPanelRef = (0, import_react26.useRef)(null);
|
|
27407
28504
|
floatingPanelRef.current = floatingPanel;
|
|
27408
|
-
const setFloatingPanelRef = (0,
|
|
27409
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0,
|
|
27410
|
-
const buttonCollectionDragRef = (0,
|
|
27411
|
-
const buttonDropInsertIndexRef = (0,
|
|
27412
|
-
const [buttonDropSlots, setButtonDropSlots] = (0,
|
|
27413
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0,
|
|
27414
|
-
const buttonPointerDragRef = (0,
|
|
27415
|
-
const [buttonStyleTick, setButtonStyleTick] = (0,
|
|
27416
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0,
|
|
27417
|
-
const [editorViewport, setEditorViewport] = (0,
|
|
27418
|
-
const [parentScrollSnap, setParentScrollSnap] = (0,
|
|
27419
|
-
const [sitePages, setSitePages] = (0,
|
|
27420
|
-
const collectionItemsRef = (0,
|
|
27421
|
-
const [sectionsByPath, setSectionsByPath] = (0,
|
|
27422
|
-
const sectionsPrefetchGenRef = (0,
|
|
27423
|
-
const setLinkPopoverRef = (0,
|
|
27424
|
-
const linkPopoverPanelRef = (0,
|
|
27425
|
-
const linkPopoverOpenRef = (0,
|
|
27426
|
-
const linkPopoverGraceUntilRef = (0,
|
|
28505
|
+
const setFloatingPanelRef = (0, import_react26.useRef)(setFloatingPanel);
|
|
28506
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react26.useState)(null);
|
|
28507
|
+
const buttonCollectionDragRef = (0, import_react26.useRef)(null);
|
|
28508
|
+
const buttonDropInsertIndexRef = (0, import_react26.useRef)(null);
|
|
28509
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react26.useState)([]);
|
|
28510
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react26.useState)(null);
|
|
28511
|
+
const buttonPointerDragRef = (0, import_react26.useRef)(null);
|
|
28512
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react26.useState)(0);
|
|
28513
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react26.useState)(null);
|
|
28514
|
+
const [editorViewport, setEditorViewport] = (0, import_react26.useState)("desktop");
|
|
28515
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react26.useState)(null);
|
|
28516
|
+
const [sitePages, setSitePages] = (0, import_react26.useState)([]);
|
|
28517
|
+
const collectionItemsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
|
|
28518
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react26.useState)({});
|
|
28519
|
+
const sectionsPrefetchGenRef = (0, import_react26.useRef)(0);
|
|
28520
|
+
const setLinkPopoverRef = (0, import_react26.useRef)(setLinkPopover);
|
|
28521
|
+
const linkPopoverPanelRef = (0, import_react26.useRef)(null);
|
|
28522
|
+
const linkPopoverOpenRef = (0, import_react26.useRef)(false);
|
|
28523
|
+
const linkPopoverGraceUntilRef = (0, import_react26.useRef)(0);
|
|
27427
28524
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27428
28525
|
setFloatingPanelRef.current = setFloatingPanel;
|
|
27429
28526
|
linkPopoverSessionRef.current = linkPopover;
|
|
27430
28527
|
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27431
|
-
(0,
|
|
28528
|
+
(0, import_react26.useEffect)(() => {
|
|
27432
28529
|
const syncViewport = () => {
|
|
27433
28530
|
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27434
28531
|
setEditorViewport((prev) => prev === next ? prev : next);
|
|
@@ -27437,7 +28534,7 @@ function OhhwellsBridge() {
|
|
|
27437
28534
|
window.addEventListener("resize", syncViewport);
|
|
27438
28535
|
return () => window.removeEventListener("resize", syncViewport);
|
|
27439
28536
|
}, []);
|
|
27440
|
-
(0,
|
|
28537
|
+
(0, import_react26.useEffect)(() => {
|
|
27441
28538
|
setSectionOrderPersistHandler((entries) => {
|
|
27442
28539
|
const currentPath = window.location.pathname;
|
|
27443
28540
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -27447,7 +28544,7 @@ function OhhwellsBridge() {
|
|
|
27447
28544
|
});
|
|
27448
28545
|
return () => setSectionOrderPersistHandler(null);
|
|
27449
28546
|
}, []);
|
|
27450
|
-
(0,
|
|
28547
|
+
(0, import_react26.useEffect)(() => {
|
|
27451
28548
|
setAiFooterMountOptions({
|
|
27452
28549
|
resolvePageHref: (pageOrAnchorId) => {
|
|
27453
28550
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -27510,7 +28607,7 @@ function OhhwellsBridge() {
|
|
|
27510
28607
|
const bumpLinkPopoverGrace = () => {
|
|
27511
28608
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
27512
28609
|
};
|
|
27513
|
-
const runSectionsPrefetch = (0,
|
|
28610
|
+
const runSectionsPrefetch = (0, import_react26.useCallback)((pages) => {
|
|
27514
28611
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
27515
28612
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
27516
28613
|
const paths = pages.map((p) => p.path);
|
|
@@ -27529,9 +28626,9 @@ function OhhwellsBridge() {
|
|
|
27529
28626
|
);
|
|
27530
28627
|
});
|
|
27531
28628
|
}, [isEditMode, pathname]);
|
|
27532
|
-
const runSectionsPrefetchRef = (0,
|
|
28629
|
+
const runSectionsPrefetchRef = (0, import_react26.useRef)(runSectionsPrefetch);
|
|
27533
28630
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
27534
|
-
(0,
|
|
28631
|
+
(0, import_react26.useEffect)(() => {
|
|
27535
28632
|
if (!linkPopover) {
|
|
27536
28633
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
27537
28634
|
return;
|
|
@@ -27559,7 +28656,7 @@ function OhhwellsBridge() {
|
|
|
27559
28656
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
27560
28657
|
};
|
|
27561
28658
|
}, [linkPopover, postToParent2]);
|
|
27562
|
-
(0,
|
|
28659
|
+
(0, import_react26.useEffect)(() => {
|
|
27563
28660
|
if (!isEditMode) return;
|
|
27564
28661
|
const useFixtures = shouldUseDevFixtures();
|
|
27565
28662
|
if (useFixtures) {
|
|
@@ -27585,7 +28682,7 @@ function OhhwellsBridge() {
|
|
|
27585
28682
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
27586
28683
|
return () => window.removeEventListener("message", onSitePages);
|
|
27587
28684
|
}, [isEditMode, postToParent2]);
|
|
27588
|
-
(0,
|
|
28685
|
+
(0, import_react26.useEffect)(() => {
|
|
27589
28686
|
if (!isEditMode) return;
|
|
27590
28687
|
const deps = {
|
|
27591
28688
|
getEditContent: () => editContentRef.current,
|
|
@@ -27622,14 +28719,14 @@ function OhhwellsBridge() {
|
|
|
27622
28719
|
window.addEventListener("message", onPageMessage);
|
|
27623
28720
|
return () => window.removeEventListener("message", onPageMessage);
|
|
27624
28721
|
}, [isEditMode, postToParent2]);
|
|
27625
|
-
(0,
|
|
28722
|
+
(0, import_react26.useEffect)(() => {
|
|
27626
28723
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
27627
28724
|
void loadAllSectionsManifest().then((manifest) => {
|
|
27628
28725
|
if (Object.keys(manifest).length === 0) return;
|
|
27629
28726
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
27630
28727
|
});
|
|
27631
28728
|
}, [isEditMode]);
|
|
27632
|
-
(0,
|
|
28729
|
+
(0, import_react26.useEffect)(() => {
|
|
27633
28730
|
const update = () => {
|
|
27634
28731
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
27635
28732
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27653,10 +28750,10 @@ function OhhwellsBridge() {
|
|
|
27653
28750
|
vvp.removeEventListener("resize", update);
|
|
27654
28751
|
};
|
|
27655
28752
|
}, []);
|
|
27656
|
-
const refreshStateRules = (0,
|
|
28753
|
+
const refreshStateRules = (0, import_react26.useCallback)(() => {
|
|
27657
28754
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
27658
28755
|
}, []);
|
|
27659
|
-
const processConfigRequest = (0,
|
|
28756
|
+
const processConfigRequest = (0, import_react26.useCallback)((insertAfterVal) => {
|
|
27660
28757
|
const tracker = getSectionsTracker();
|
|
27661
28758
|
let entries = [];
|
|
27662
28759
|
try {
|
|
@@ -27679,7 +28776,7 @@ function OhhwellsBridge() {
|
|
|
27679
28776
|
}
|
|
27680
28777
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
27681
28778
|
}, [isEditMode]);
|
|
27682
|
-
const deactivate = (0,
|
|
28779
|
+
const deactivate = (0, import_react26.useCallback)(() => {
|
|
27683
28780
|
const el = activeElRef.current;
|
|
27684
28781
|
if (!el) return;
|
|
27685
28782
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -27746,12 +28843,12 @@ function OhhwellsBridge() {
|
|
|
27746
28843
|
setToolbarShowAiBlockDelete(false);
|
|
27747
28844
|
postToParent2({ type: "ow:exit-edit" });
|
|
27748
28845
|
}, [postToParent2]);
|
|
27749
|
-
const clearSelectedAttr = (0,
|
|
28846
|
+
const clearSelectedAttr = (0, import_react26.useCallback)(() => {
|
|
27750
28847
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
27751
28848
|
el.removeAttribute("data-ohw-selected");
|
|
27752
28849
|
});
|
|
27753
28850
|
}, []);
|
|
27754
|
-
const deselect = (0,
|
|
28851
|
+
const deselect = (0, import_react26.useCallback)(() => {
|
|
27755
28852
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
27756
28853
|
clearSelectedAttr();
|
|
27757
28854
|
selectedElRef.current = null;
|
|
@@ -27787,20 +28884,20 @@ function OhhwellsBridge() {
|
|
|
27787
28884
|
setToolbarVariant("none");
|
|
27788
28885
|
}
|
|
27789
28886
|
}, [clearSelectedAttr]);
|
|
27790
|
-
const markSelected = (0,
|
|
28887
|
+
const markSelected = (0, import_react26.useCallback)((el) => {
|
|
27791
28888
|
clearSelectedAttr();
|
|
27792
28889
|
el.removeAttribute("data-ohw-hovered");
|
|
27793
28890
|
el.setAttribute("data-ohw-selected", "");
|
|
27794
28891
|
}, [clearSelectedAttr]);
|
|
27795
|
-
const isSelectedForHover = (0,
|
|
28892
|
+
const isSelectedForHover = (0, import_react26.useCallback)((el) => {
|
|
27796
28893
|
if (!el) return false;
|
|
27797
28894
|
return [selectedElRef.current, activeElRef.current].some(
|
|
27798
28895
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
27799
28896
|
);
|
|
27800
28897
|
}, []);
|
|
27801
|
-
const isSelectedForHoverRef = (0,
|
|
28898
|
+
const isSelectedForHoverRef = (0, import_react26.useRef)(isSelectedForHover);
|
|
27802
28899
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
27803
|
-
const resolveHrefKeyElement = (0,
|
|
28900
|
+
const resolveHrefKeyElement = (0, import_react26.useCallback)((hrefKey) => {
|
|
27804
28901
|
if (isFooterHrefKey(hrefKey)) {
|
|
27805
28902
|
return document.querySelector(
|
|
27806
28903
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -27815,7 +28912,7 @@ function OhhwellsBridge() {
|
|
|
27815
28912
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
27816
28913
|
);
|
|
27817
28914
|
}, []);
|
|
27818
|
-
const resyncSelectedNavigationItem = (0,
|
|
28915
|
+
const resyncSelectedNavigationItem = (0, import_react26.useCallback)(() => {
|
|
27819
28916
|
const hrefKey = selectedHrefKeyRef.current;
|
|
27820
28917
|
if (hrefKey) {
|
|
27821
28918
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -27853,7 +28950,7 @@ function OhhwellsBridge() {
|
|
|
27853
28950
|
);
|
|
27854
28951
|
}
|
|
27855
28952
|
}, [resolveHrefKeyElement]);
|
|
27856
|
-
const reselectNavigationItem = (0,
|
|
28953
|
+
const reselectNavigationItem = (0, import_react26.useCallback)((navAnchor) => {
|
|
27857
28954
|
selectedElRef.current = navAnchor;
|
|
27858
28955
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
27859
28956
|
selectedFooterColAttrRef.current = null;
|
|
@@ -27884,7 +28981,7 @@ function OhhwellsBridge() {
|
|
|
27884
28981
|
setToolbarShowEditLink(false);
|
|
27885
28982
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27886
28983
|
}, [markSelected]);
|
|
27887
|
-
const commitNavigationTextEdit = (0,
|
|
28984
|
+
const commitNavigationTextEdit = (0, import_react26.useCallback)((navAnchor) => {
|
|
27888
28985
|
const el = activeElRef.current;
|
|
27889
28986
|
if (!el) return;
|
|
27890
28987
|
const key = el.dataset.ohwKey;
|
|
@@ -27918,7 +29015,7 @@ function OhhwellsBridge() {
|
|
|
27918
29015
|
postToParent2({ type: "ow:exit-edit" });
|
|
27919
29016
|
reselectNavigationItem(navAnchor);
|
|
27920
29017
|
}, [postToParent2, reselectNavigationItem]);
|
|
27921
|
-
const handleAddTopLevelNavItem = (0,
|
|
29018
|
+
const handleAddTopLevelNavItem = (0, import_react26.useCallback)(() => {
|
|
27922
29019
|
const items = listNavbarRootItems();
|
|
27923
29020
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
27924
29021
|
deselectRef.current();
|
|
@@ -27930,7 +29027,7 @@ function OhhwellsBridge() {
|
|
|
27930
29027
|
intent: "add-nav"
|
|
27931
29028
|
});
|
|
27932
29029
|
}, []);
|
|
27933
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
29030
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react26.useCallback)(
|
|
27934
29031
|
(anchor) => {
|
|
27935
29032
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
27936
29033
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -27943,7 +29040,7 @@ function OhhwellsBridge() {
|
|
|
27943
29040
|
},
|
|
27944
29041
|
[postToParent2]
|
|
27945
29042
|
);
|
|
27946
|
-
const handleNavDropdownOpenChange = (0,
|
|
29043
|
+
const handleNavDropdownOpenChange = (0, import_react26.useCallback)((open) => {
|
|
27947
29044
|
const selected = selectedElRef.current;
|
|
27948
29045
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
27949
29046
|
if (isNestedNavChild(selected)) return;
|
|
@@ -27959,7 +29056,7 @@ function OhhwellsBridge() {
|
|
|
27959
29056
|
}
|
|
27960
29057
|
});
|
|
27961
29058
|
}, []);
|
|
27962
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
29059
|
+
const handleFooterHeadingVisibleChange = (0, import_react26.useCallback)(
|
|
27963
29060
|
(visible) => {
|
|
27964
29061
|
const selected = selectedElRef.current;
|
|
27965
29062
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -28012,7 +29109,7 @@ function OhhwellsBridge() {
|
|
|
28012
29109
|
},
|
|
28013
29110
|
[postToParent2]
|
|
28014
29111
|
);
|
|
28015
|
-
const enterEditOnNewItem = (0,
|
|
29112
|
+
const enterEditOnNewItem = (0, import_react26.useCallback)((anchor) => {
|
|
28016
29113
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
28017
29114
|
if (!label) {
|
|
28018
29115
|
selectRef.current(anchor);
|
|
@@ -28021,8 +29118,8 @@ function OhhwellsBridge() {
|
|
|
28021
29118
|
setNavGroupForceOpen(anchor, true);
|
|
28022
29119
|
activateRef.current(label);
|
|
28023
29120
|
}, []);
|
|
28024
|
-
const pendingSocialAddRef = (0,
|
|
28025
|
-
const handleAddChildItem = (0,
|
|
29121
|
+
const pendingSocialAddRef = (0, import_react26.useRef)(null);
|
|
29122
|
+
const handleAddChildItem = (0, import_react26.useCallback)(() => {
|
|
28026
29123
|
const selected = selectedElRef.current;
|
|
28027
29124
|
if (!selected) return;
|
|
28028
29125
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -28149,7 +29246,7 @@ function OhhwellsBridge() {
|
|
|
28149
29246
|
});
|
|
28150
29247
|
});
|
|
28151
29248
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
28152
|
-
const handleAddFooterColumn = (0,
|
|
29249
|
+
const handleAddFooterColumn = (0, import_react26.useCallback)(() => {
|
|
28153
29250
|
if (document.querySelector("[data-ai-footer]")) {
|
|
28154
29251
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
28155
29252
|
if (!state?.tree) return;
|
|
@@ -28205,7 +29302,7 @@ function OhhwellsBridge() {
|
|
|
28205
29302
|
selectRef.current(result.firstLink);
|
|
28206
29303
|
});
|
|
28207
29304
|
}, [postToParent2]);
|
|
28208
|
-
const clearFooterDragVisuals = (0,
|
|
29305
|
+
const clearFooterDragVisuals = (0, import_react26.useCallback)(() => {
|
|
28209
29306
|
footerDragRef.current = null;
|
|
28210
29307
|
setSiblingHintRects([]);
|
|
28211
29308
|
setFooterDropSlots([]);
|
|
@@ -28214,7 +29311,7 @@ function OhhwellsBridge() {
|
|
|
28214
29311
|
setIsItemDragging(false);
|
|
28215
29312
|
unlockFooterDragInteraction();
|
|
28216
29313
|
}, []);
|
|
28217
|
-
const refreshFooterDragVisuals = (0,
|
|
29314
|
+
const refreshFooterDragVisuals = (0, import_react26.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
28218
29315
|
const dragged = session.draggedEl;
|
|
28219
29316
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
28220
29317
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -28246,13 +29343,13 @@ function OhhwellsBridge() {
|
|
|
28246
29343
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
28247
29344
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
28248
29345
|
}, []);
|
|
28249
|
-
const refreshFooterDragVisualsRef = (0,
|
|
29346
|
+
const refreshFooterDragVisualsRef = (0, import_react26.useRef)(refreshFooterDragVisuals);
|
|
28250
29347
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
28251
|
-
const commitFooterDragRef = (0,
|
|
29348
|
+
const commitFooterDragRef = (0, import_react26.useRef)(() => {
|
|
28252
29349
|
});
|
|
28253
|
-
const beginFooterDragRef = (0,
|
|
29350
|
+
const beginFooterDragRef = (0, import_react26.useRef)(() => {
|
|
28254
29351
|
});
|
|
28255
|
-
const beginFooterDrag = (0,
|
|
29352
|
+
const beginFooterDrag = (0, import_react26.useCallback)(
|
|
28256
29353
|
(session) => {
|
|
28257
29354
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
28258
29355
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -28272,7 +29369,7 @@ function OhhwellsBridge() {
|
|
|
28272
29369
|
[refreshFooterDragVisuals]
|
|
28273
29370
|
);
|
|
28274
29371
|
beginFooterDragRef.current = beginFooterDrag;
|
|
28275
|
-
const commitFooterDrag = (0,
|
|
29372
|
+
const commitFooterDrag = (0, import_react26.useCallback)(
|
|
28276
29373
|
(clientX, clientY) => {
|
|
28277
29374
|
const session = footerDragRef.current;
|
|
28278
29375
|
if (!session) {
|
|
@@ -28444,7 +29541,7 @@ function OhhwellsBridge() {
|
|
|
28444
29541
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
28445
29542
|
);
|
|
28446
29543
|
commitFooterDragRef.current = commitFooterDrag;
|
|
28447
|
-
const startFooterLinkDrag = (0,
|
|
29544
|
+
const startFooterLinkDrag = (0, import_react26.useCallback)(
|
|
28448
29545
|
(anchor, clientX, clientY, wasSelected) => {
|
|
28449
29546
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
28450
29547
|
if (!hrefKey) return false;
|
|
@@ -28480,7 +29577,7 @@ function OhhwellsBridge() {
|
|
|
28480
29577
|
},
|
|
28481
29578
|
[beginFooterDrag]
|
|
28482
29579
|
);
|
|
28483
|
-
const startFooterColumnDrag = (0,
|
|
29580
|
+
const startFooterColumnDrag = (0, import_react26.useCallback)(
|
|
28484
29581
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
28485
29582
|
const columns = listFooterColumns(columnEl);
|
|
28486
29583
|
const idx = columns.indexOf(columnEl);
|
|
@@ -28500,7 +29597,7 @@ function OhhwellsBridge() {
|
|
|
28500
29597
|
},
|
|
28501
29598
|
[beginFooterDrag]
|
|
28502
29599
|
);
|
|
28503
|
-
const persistButtonCollectionDrag = (0,
|
|
29600
|
+
const persistButtonCollectionDrag = (0, import_react26.useCallback)(
|
|
28504
29601
|
(button, clientX) => {
|
|
28505
29602
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
28506
29603
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -28524,7 +29621,7 @@ function OhhwellsBridge() {
|
|
|
28524
29621
|
},
|
|
28525
29622
|
[postToParent2]
|
|
28526
29623
|
);
|
|
28527
|
-
const refreshButtonDragVisuals = (0,
|
|
29624
|
+
const refreshButtonDragVisuals = (0, import_react26.useCallback)((button, clientX, clientY) => {
|
|
28528
29625
|
const collection = buttonCollectionOf(button);
|
|
28529
29626
|
if (!collection) {
|
|
28530
29627
|
setButtonDropSlots([]);
|
|
@@ -28541,7 +29638,7 @@ function OhhwellsBridge() {
|
|
|
28541
29638
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
28542
29639
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
28543
29640
|
}, []);
|
|
28544
|
-
const handleItemDragStart = (0,
|
|
29641
|
+
const handleItemDragStart = (0, import_react26.useCallback)(
|
|
28545
29642
|
(e) => {
|
|
28546
29643
|
const selected = selectedElRef.current;
|
|
28547
29644
|
if (!selected) {
|
|
@@ -28572,7 +29669,7 @@ function OhhwellsBridge() {
|
|
|
28572
29669
|
},
|
|
28573
29670
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
28574
29671
|
);
|
|
28575
|
-
const handleItemDragEnd = (0,
|
|
29672
|
+
const handleItemDragEnd = (0, import_react26.useCallback)(
|
|
28576
29673
|
(e) => {
|
|
28577
29674
|
const collectionButton = buttonCollectionDragRef.current;
|
|
28578
29675
|
if (collectionButton) {
|
|
@@ -28603,7 +29700,7 @@ function OhhwellsBridge() {
|
|
|
28603
29700
|
},
|
|
28604
29701
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
28605
29702
|
);
|
|
28606
|
-
const handleItemChromePointerDown = (0,
|
|
29703
|
+
const handleItemChromePointerDown = (0, import_react26.useCallback)((e) => {
|
|
28607
29704
|
if (e.button !== 0) return;
|
|
28608
29705
|
const selected = selectedElRef.current;
|
|
28609
29706
|
if (!selected) return;
|
|
@@ -28644,7 +29741,7 @@ function OhhwellsBridge() {
|
|
|
28644
29741
|
}
|
|
28645
29742
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
28646
29743
|
}, [armNavPressFromChrome]);
|
|
28647
|
-
const handleItemChromeClick = (0,
|
|
29744
|
+
const handleItemChromeClick = (0, import_react26.useCallback)((clientX, clientY) => {
|
|
28648
29745
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
28649
29746
|
suppressNextClickRef.current = false;
|
|
28650
29747
|
return;
|
|
@@ -28657,7 +29754,7 @@ function OhhwellsBridge() {
|
|
|
28657
29754
|
}, []);
|
|
28658
29755
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
28659
29756
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
28660
|
-
const select = (0,
|
|
29757
|
+
const select = (0, import_react26.useCallback)((anchor) => {
|
|
28661
29758
|
if (!isNavigationItem2(anchor)) return;
|
|
28662
29759
|
if (activeElRef.current) deactivate();
|
|
28663
29760
|
clearSocialSelectionRef.current();
|
|
@@ -28734,7 +29831,7 @@ function OhhwellsBridge() {
|
|
|
28734
29831
|
setLogoSizeDraft(null);
|
|
28735
29832
|
}
|
|
28736
29833
|
}, [deactivate, markSelected]);
|
|
28737
|
-
const selectFrame = (0,
|
|
29834
|
+
const selectFrame = (0, import_react26.useCallback)((el) => {
|
|
28738
29835
|
if (!isNavigationContainer(el)) return;
|
|
28739
29836
|
if (activeElRef.current) deactivate();
|
|
28740
29837
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -28775,7 +29872,7 @@ function OhhwellsBridge() {
|
|
|
28775
29872
|
setFloatingPanelPos(null);
|
|
28776
29873
|
setLogoSizeDraft(null);
|
|
28777
29874
|
}, [deactivate, markSelected, postToParent2]);
|
|
28778
|
-
const selectLogo = (0,
|
|
29875
|
+
const selectLogo = (0, import_react26.useCallback)(
|
|
28779
29876
|
(logoEl) => {
|
|
28780
29877
|
if (activeElRef.current) deactivate();
|
|
28781
29878
|
selectedElRef.current = logoEl;
|
|
@@ -28804,7 +29901,7 @@ function OhhwellsBridge() {
|
|
|
28804
29901
|
},
|
|
28805
29902
|
[deactivate, markSelected]
|
|
28806
29903
|
);
|
|
28807
|
-
const openLogoSizePanel = (0,
|
|
29904
|
+
const openLogoSizePanel = (0, import_react26.useCallback)((logoEl) => {
|
|
28808
29905
|
const placement = getLogoPlacement(logoEl);
|
|
28809
29906
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
28810
29907
|
setLogoSizeDraft(draft);
|
|
@@ -28817,7 +29914,7 @@ function OhhwellsBridge() {
|
|
|
28817
29914
|
placement
|
|
28818
29915
|
});
|
|
28819
29916
|
}, []);
|
|
28820
|
-
const openSocialsDisplayPanel = (0,
|
|
29917
|
+
const openSocialsDisplayPanel = (0, import_react26.useCallback)((row) => {
|
|
28821
29918
|
setFloatingPanelPos(null);
|
|
28822
29919
|
setParentScrollSnap(parentScrollRef.current);
|
|
28823
29920
|
setFloatingPanel({
|
|
@@ -28828,7 +29925,7 @@ function OhhwellsBridge() {
|
|
|
28828
29925
|
row
|
|
28829
29926
|
});
|
|
28830
29927
|
}, []);
|
|
28831
|
-
const rememberButtonTokens = (0,
|
|
29928
|
+
const rememberButtonTokens = (0, import_react26.useCallback)(
|
|
28832
29929
|
(content, tokens, nodes) => {
|
|
28833
29930
|
if (nodes.length === 0) return content;
|
|
28834
29931
|
const next = { ...content };
|
|
@@ -28839,7 +29936,7 @@ function OhhwellsBridge() {
|
|
|
28839
29936
|
},
|
|
28840
29937
|
[postToParent2]
|
|
28841
29938
|
);
|
|
28842
|
-
const tokensForButton = (0,
|
|
29939
|
+
const tokensForButton = (0, import_react26.useCallback)(
|
|
28843
29940
|
(el, persistFallback = false) => {
|
|
28844
29941
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
28845
29942
|
if (stored) return stored;
|
|
@@ -28854,7 +29951,7 @@ function OhhwellsBridge() {
|
|
|
28854
29951
|
},
|
|
28855
29952
|
[rememberButtonTokens]
|
|
28856
29953
|
);
|
|
28857
|
-
const openButtonStylePanel = (0,
|
|
29954
|
+
const openButtonStylePanel = (0, import_react26.useCallback)(
|
|
28858
29955
|
(anchor) => {
|
|
28859
29956
|
const id = buttonId(anchor);
|
|
28860
29957
|
if (!id) return;
|
|
@@ -28872,7 +29969,7 @@ function OhhwellsBridge() {
|
|
|
28872
29969
|
},
|
|
28873
29970
|
[tokensForButton]
|
|
28874
29971
|
);
|
|
28875
|
-
const applySelectedButtonStyle = (0,
|
|
29972
|
+
const applySelectedButtonStyle = (0, import_react26.useCallback)(
|
|
28876
29973
|
(patch) => {
|
|
28877
29974
|
const panel = floatingPanelRef.current;
|
|
28878
29975
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -28890,7 +29987,7 @@ function OhhwellsBridge() {
|
|
|
28890
29987
|
},
|
|
28891
29988
|
[postToParent2]
|
|
28892
29989
|
);
|
|
28893
|
-
(0,
|
|
29990
|
+
(0, import_react26.useEffect)(() => {
|
|
28894
29991
|
const onDragOver = (e) => {
|
|
28895
29992
|
const dragged = buttonCollectionDragRef.current;
|
|
28896
29993
|
if (!dragged) return;
|
|
@@ -28909,11 +30006,11 @@ function OhhwellsBridge() {
|
|
|
28909
30006
|
document.removeEventListener("drop", onDrop);
|
|
28910
30007
|
};
|
|
28911
30008
|
}, [refreshButtonDragVisuals]);
|
|
28912
|
-
const isEditModeRef = (0,
|
|
28913
|
-
const requestMissingSocialIconsRef = (0,
|
|
30009
|
+
const isEditModeRef = (0, import_react26.useRef)(false);
|
|
30010
|
+
const requestMissingSocialIconsRef = (0, import_react26.useRef)(() => {
|
|
28914
30011
|
});
|
|
28915
|
-
const askedSocialIconsRef = (0,
|
|
28916
|
-
const requestMissingSocialIcons = (0,
|
|
30012
|
+
const askedSocialIconsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Set());
|
|
30013
|
+
const requestMissingSocialIcons = (0, import_react26.useCallback)(() => {
|
|
28917
30014
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
28918
30015
|
const missing = socialsMissingIcons(row);
|
|
28919
30016
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -28925,7 +30022,7 @@ function OhhwellsBridge() {
|
|
|
28925
30022
|
}, []);
|
|
28926
30023
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
28927
30024
|
isEditModeRef.current = isEditMode;
|
|
28928
|
-
const changeSocialsDisplay = (0,
|
|
30025
|
+
const changeSocialsDisplay = (0, import_react26.useCallback)(
|
|
28929
30026
|
(row, next) => {
|
|
28930
30027
|
if (next.icon) {
|
|
28931
30028
|
const missing = socialsMissingIcons(row);
|
|
@@ -28949,19 +30046,19 @@ function OhhwellsBridge() {
|
|
|
28949
30046
|
},
|
|
28950
30047
|
[]
|
|
28951
30048
|
);
|
|
28952
|
-
const closeFloatingPanelOnly = (0,
|
|
30049
|
+
const closeFloatingPanelOnly = (0, import_react26.useCallback)(() => {
|
|
28953
30050
|
setFloatingPanel(null);
|
|
28954
30051
|
setFloatingPanelPos(null);
|
|
28955
30052
|
setLogoSizeDraft(null);
|
|
28956
30053
|
}, []);
|
|
28957
30054
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28958
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
30055
|
+
const closeFloatingPanelAndDeselect = (0, import_react26.useCallback)(() => {
|
|
28959
30056
|
setFloatingPanel(null);
|
|
28960
30057
|
setFloatingPanelPos(null);
|
|
28961
30058
|
setLogoSizeDraft(null);
|
|
28962
30059
|
deselectRef.current();
|
|
28963
30060
|
}, []);
|
|
28964
|
-
(0,
|
|
30061
|
+
(0, import_react26.useEffect)(() => {
|
|
28965
30062
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28966
30063
|
if (!session || !logoSizeDraft) {
|
|
28967
30064
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28980,7 +30077,7 @@ function OhhwellsBridge() {
|
|
|
28980
30077
|
max: LOGO_SIZE_MAX
|
|
28981
30078
|
});
|
|
28982
30079
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28983
|
-
const persistLogoSizeDraft = (0,
|
|
30080
|
+
const persistLogoSizeDraft = (0, import_react26.useCallback)(
|
|
28984
30081
|
(placement, draft) => {
|
|
28985
30082
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28986
30083
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -29020,7 +30117,7 @@ function OhhwellsBridge() {
|
|
|
29020
30117
|
},
|
|
29021
30118
|
[postToParent2]
|
|
29022
30119
|
);
|
|
29023
|
-
const activate = (0,
|
|
30120
|
+
const activate = (0, import_react26.useCallback)((el, options) => {
|
|
29024
30121
|
if (activeElRef.current === el) return;
|
|
29025
30122
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
29026
30123
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -29125,8 +30222,8 @@ function OhhwellsBridge() {
|
|
|
29125
30222
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
29126
30223
|
deselectRef.current = deselect;
|
|
29127
30224
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
29128
|
-
const lastSiteWideScopeRef = (0,
|
|
29129
|
-
(0,
|
|
30225
|
+
const lastSiteWideScopeRef = (0, import_react26.useRef)(null);
|
|
30226
|
+
(0, import_react26.useEffect)(() => {
|
|
29130
30227
|
if (!isEditMode) {
|
|
29131
30228
|
if (lastSiteWideScopeRef.current !== false) {
|
|
29132
30229
|
lastSiteWideScopeRef.current = false;
|
|
@@ -29152,7 +30249,7 @@ function OhhwellsBridge() {
|
|
|
29152
30249
|
isFooterFrameSelection,
|
|
29153
30250
|
postToParent2
|
|
29154
30251
|
]);
|
|
29155
|
-
(0,
|
|
30252
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
29156
30253
|
if (!subdomain || isEditMode) {
|
|
29157
30254
|
setFetchState("done");
|
|
29158
30255
|
return;
|
|
@@ -29308,7 +30405,7 @@ function OhhwellsBridge() {
|
|
|
29308
30405
|
cancelled = true;
|
|
29309
30406
|
};
|
|
29310
30407
|
}, [subdomain, isEditMode]);
|
|
29311
|
-
(0,
|
|
30408
|
+
(0, import_react26.useEffect)(() => {
|
|
29312
30409
|
if (!isEditMode) return;
|
|
29313
30410
|
const resolveIndex = (form, clientY) => {
|
|
29314
30411
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -29349,7 +30446,7 @@ function OhhwellsBridge() {
|
|
|
29349
30446
|
window.removeEventListener("drop", onDrop, true);
|
|
29350
30447
|
};
|
|
29351
30448
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
29352
|
-
(0,
|
|
30449
|
+
(0, import_react26.useEffect)(() => {
|
|
29353
30450
|
if (!isEditMode) return;
|
|
29354
30451
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
29355
30452
|
markFormFields(form);
|
|
@@ -29361,7 +30458,7 @@ function OhhwellsBridge() {
|
|
|
29361
30458
|
});
|
|
29362
30459
|
return () => observer.disconnect();
|
|
29363
30460
|
}, [isEditMode, fetchState, pathname]);
|
|
29364
|
-
(0,
|
|
30461
|
+
(0, import_react26.useEffect)(() => {
|
|
29365
30462
|
if (!isEditMode) return;
|
|
29366
30463
|
let saveTimer = null;
|
|
29367
30464
|
const onInput = (e) => {
|
|
@@ -29383,14 +30480,14 @@ function OhhwellsBridge() {
|
|
|
29383
30480
|
document.addEventListener("input", onInput, true);
|
|
29384
30481
|
return () => document.removeEventListener("input", onInput, true);
|
|
29385
30482
|
}, [isEditMode, persistFields]);
|
|
29386
|
-
(0,
|
|
30483
|
+
(0, import_react26.useEffect)(() => {
|
|
29387
30484
|
if (isEditMode || fetchState !== "done") return;
|
|
29388
30485
|
const content = contentCache.get(subdomain) ?? {};
|
|
29389
30486
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
29390
30487
|
reconcileFieldsFromContent(form, content);
|
|
29391
30488
|
});
|
|
29392
30489
|
}, [isEditMode, fetchState, subdomain]);
|
|
29393
|
-
(0,
|
|
30490
|
+
(0, import_react26.useEffect)(() => {
|
|
29394
30491
|
if (!isEditMode) return;
|
|
29395
30492
|
const swallow = (e) => {
|
|
29396
30493
|
const target = e.target;
|
|
@@ -29399,14 +30496,14 @@ function OhhwellsBridge() {
|
|
|
29399
30496
|
document.addEventListener("submit", swallow, true);
|
|
29400
30497
|
return () => document.removeEventListener("submit", swallow, true);
|
|
29401
30498
|
}, [isEditMode]);
|
|
29402
|
-
(0,
|
|
30499
|
+
(0, import_react26.useEffect)(() => {
|
|
29403
30500
|
if (isEditMode || fetchState !== "done") return;
|
|
29404
30501
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
29405
30502
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
29406
30503
|
console.log({ apiUrl, subdomain });
|
|
29407
30504
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
29408
30505
|
}, [isEditMode, fetchState, subdomain]);
|
|
29409
|
-
(0,
|
|
30506
|
+
(0, import_react26.useEffect)(() => {
|
|
29410
30507
|
if (!subdomain || isEditMode) return;
|
|
29411
30508
|
let debounceTimer = null;
|
|
29412
30509
|
let observer = null;
|
|
@@ -29528,16 +30625,16 @@ function OhhwellsBridge() {
|
|
|
29528
30625
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
29529
30626
|
};
|
|
29530
30627
|
}, [subdomain, isEditMode, pathname]);
|
|
29531
|
-
(0,
|
|
30628
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
29532
30629
|
const el = document.getElementById("ohw-loader");
|
|
29533
30630
|
if (!el) return;
|
|
29534
30631
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
29535
30632
|
el.style.display = visible ? "flex" : "none";
|
|
29536
30633
|
}, [subdomain, fetchState]);
|
|
29537
|
-
(0,
|
|
30634
|
+
(0, import_react26.useEffect)(() => {
|
|
29538
30635
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
29539
30636
|
}, [pathname, postToParent2]);
|
|
29540
|
-
(0,
|
|
30637
|
+
(0, import_react26.useEffect)(() => {
|
|
29541
30638
|
if (!subdomain || isEditMode) return;
|
|
29542
30639
|
const content = contentCache.get(subdomain);
|
|
29543
30640
|
if (!content) return;
|
|
@@ -29555,7 +30652,7 @@ function OhhwellsBridge() {
|
|
|
29555
30652
|
}
|
|
29556
30653
|
applyAiFooterFromContent(content);
|
|
29557
30654
|
}, [pathname, subdomain, isEditMode]);
|
|
29558
|
-
(0,
|
|
30655
|
+
(0, import_react26.useEffect)(() => {
|
|
29559
30656
|
if (!isEditMode) return;
|
|
29560
30657
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
29561
30658
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -29563,12 +30660,12 @@ function OhhwellsBridge() {
|
|
|
29563
30660
|
deselectRef.current();
|
|
29564
30661
|
deactivateRef.current();
|
|
29565
30662
|
}, [pathname, isEditMode]);
|
|
29566
|
-
(0,
|
|
30663
|
+
(0, import_react26.useEffect)(() => {
|
|
29567
30664
|
if (!isEditMode) return;
|
|
29568
30665
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
29569
30666
|
initItemInstancesFromContent(editContentRef.current);
|
|
29570
30667
|
}, [pathname, isEditMode]);
|
|
29571
|
-
(0,
|
|
30668
|
+
(0, import_react26.useEffect)(() => {
|
|
29572
30669
|
if (!isEditMode) return;
|
|
29573
30670
|
const observer = new MutationObserver(() => {
|
|
29574
30671
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -29579,7 +30676,7 @@ function OhhwellsBridge() {
|
|
|
29579
30676
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
29580
30677
|
return () => observer.disconnect();
|
|
29581
30678
|
}, [isEditMode, pathname]);
|
|
29582
|
-
(0,
|
|
30679
|
+
(0, import_react26.useEffect)(() => {
|
|
29583
30680
|
const contentForNav = () => {
|
|
29584
30681
|
if (isEditMode) return editContentRef.current;
|
|
29585
30682
|
if (!subdomain) return {};
|
|
@@ -29653,7 +30750,7 @@ function OhhwellsBridge() {
|
|
|
29653
30750
|
observer?.disconnect();
|
|
29654
30751
|
};
|
|
29655
30752
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
29656
|
-
(0,
|
|
30753
|
+
(0, import_react26.useEffect)(() => {
|
|
29657
30754
|
if (!isEditMode) return;
|
|
29658
30755
|
let applying = false;
|
|
29659
30756
|
let rafId = null;
|
|
@@ -29691,7 +30788,7 @@ function OhhwellsBridge() {
|
|
|
29691
30788
|
observer.disconnect();
|
|
29692
30789
|
};
|
|
29693
30790
|
}, [isEditMode, pathname]);
|
|
29694
|
-
(0,
|
|
30791
|
+
(0, import_react26.useEffect)(() => {
|
|
29695
30792
|
if (!isEditMode) return;
|
|
29696
30793
|
let lastPosted = 0;
|
|
29697
30794
|
const measure = () => {
|
|
@@ -29720,7 +30817,7 @@ function OhhwellsBridge() {
|
|
|
29720
30817
|
ro.disconnect();
|
|
29721
30818
|
};
|
|
29722
30819
|
}, [pathname, isEditMode, postToParent2]);
|
|
29723
|
-
(0,
|
|
30820
|
+
(0, import_react26.useEffect)(() => {
|
|
29724
30821
|
if (isEditMode) return;
|
|
29725
30822
|
const handleClick = (e) => {
|
|
29726
30823
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -29734,7 +30831,7 @@ function OhhwellsBridge() {
|
|
|
29734
30831
|
document.addEventListener("click", handleClick, true);
|
|
29735
30832
|
return () => document.removeEventListener("click", handleClick, true);
|
|
29736
30833
|
}, [isEditMode, router, pathname]);
|
|
29737
|
-
(0,
|
|
30834
|
+
(0, import_react26.useEffect)(() => {
|
|
29738
30835
|
if (!isEditMode) {
|
|
29739
30836
|
editStylesRef.current?.base.remove();
|
|
29740
30837
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -30182,6 +31279,16 @@ function OhhwellsBridge() {
|
|
|
30182
31279
|
const inner = target.closest("svg")?.querySelectorAll("[data-ohw-editable]");
|
|
30183
31280
|
if (inner && inner.length === 1) editable = inner[0];
|
|
30184
31281
|
}
|
|
31282
|
+
const hiddenTwin = !editable || isMediaEditable(editable) ? findHiddenTwinAt(NON_MEDIA_SELECTOR, e.clientX, e.clientY) : null;
|
|
31283
|
+
if (hiddenTwin) {
|
|
31284
|
+
editable = hiddenTwin;
|
|
31285
|
+
const card = stateCardFor(hiddenTwin, e.clientX, e.clientY);
|
|
31286
|
+
const hoverState = card && !card.hasAttribute("data-ohw-active-state") ? deriveStates(card.dataset.ohwEditableState ?? "")[1] : void 0;
|
|
31287
|
+
if (card && hoverState) {
|
|
31288
|
+
activeStateElRef.current = card;
|
|
31289
|
+
stateChangeRef.current(hoverState);
|
|
31290
|
+
}
|
|
31291
|
+
}
|
|
30185
31292
|
if (editable && !(editable instanceof HTMLElement)) {
|
|
30186
31293
|
e.preventDefault();
|
|
30187
31294
|
e.stopPropagation();
|
|
@@ -30546,6 +31653,8 @@ function OhhwellsBridge() {
|
|
|
30546
31653
|
if (!editable) return;
|
|
30547
31654
|
const editableRect = editable.getBoundingClientRect();
|
|
30548
31655
|
if (editableRect.width <= 0 || editableRect.height <= 0) return;
|
|
31656
|
+
const shownEditable = shownAs(editable);
|
|
31657
|
+
if (!shownEditable || shownEditable !== editable && !hitsShown(editable, e.clientX, e.clientY)) return;
|
|
30549
31658
|
const selected = selectedElRef.current;
|
|
30550
31659
|
if (selected && (selected === editable || selected.contains(editable))) return;
|
|
30551
31660
|
if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
|
|
@@ -30560,7 +31669,7 @@ function OhhwellsBridge() {
|
|
|
30560
31669
|
hoveredItemElRef.current = hoverTarget;
|
|
30561
31670
|
setHoveredItemRect(hoverTarget.getBoundingClientRect());
|
|
30562
31671
|
} else if (!isInsideNavigationItem(editable) && !isSelectedForHoverRef.current(hoverTarget)) {
|
|
30563
|
-
hoverTarget.setAttribute("data-ohw-hovered", "");
|
|
31672
|
+
hoverFrame(hoverTarget).setAttribute("data-ohw-hovered", "");
|
|
30564
31673
|
if (editable.closest("footer") || editable.closest('[data-ohw-section="footer"]')) {
|
|
30565
31674
|
hoveredNavContainerRef.current = null;
|
|
30566
31675
|
setHoveredNavContainerRect(null);
|
|
@@ -31021,8 +32130,7 @@ function OhhwellsBridge() {
|
|
|
31021
32130
|
document.querySelectorAll(NON_MEDIA_SELECTOR)
|
|
31022
32131
|
).find((el) => {
|
|
31023
32132
|
if (el.closest("[data-ohw-nav-children]") && !getNavigationItemAnchor(el)) return false;
|
|
31024
|
-
|
|
31025
|
-
return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
|
|
32133
|
+
return hitsShown(el, x2, y2);
|
|
31026
32134
|
});
|
|
31027
32135
|
if (imageUnhoverTimerRef.current) {
|
|
31028
32136
|
clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -31068,7 +32176,7 @@ function OhhwellsBridge() {
|
|
|
31068
32176
|
}
|
|
31069
32177
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
31070
32178
|
if (textEditable && !textEditable.closest("[data-ohw-href-key]") && !isSelectedForHoverRef.current(textEditable)) {
|
|
31071
|
-
textEditable.setAttribute("data-ohw-hovered", "");
|
|
32179
|
+
hoverFrame(textEditable).setAttribute("data-ohw-hovered", "");
|
|
31072
32180
|
}
|
|
31073
32181
|
return;
|
|
31074
32182
|
}
|
|
@@ -31080,7 +32188,7 @@ function OhhwellsBridge() {
|
|
|
31080
32188
|
}
|
|
31081
32189
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
31082
32190
|
if (textEditable && !textEditable.closest("[data-ohw-href-key]") && !isSelectedForHoverRef.current(textEditable)) {
|
|
31083
|
-
textEditable.setAttribute("data-ohw-hovered", "");
|
|
32191
|
+
hoverFrame(textEditable).setAttribute("data-ohw-hovered", "");
|
|
31084
32192
|
}
|
|
31085
32193
|
return;
|
|
31086
32194
|
}
|
|
@@ -31124,8 +32232,7 @@ function OhhwellsBridge() {
|
|
|
31124
32232
|
).find((el) => {
|
|
31125
32233
|
if (!isNavigationItem2(el) || isCtaButton(el)) return false;
|
|
31126
32234
|
if (!isNavItemPointerTarget(el)) return false;
|
|
31127
|
-
|
|
31128
|
-
return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
|
|
32235
|
+
return hitsShown(el, x2, y2);
|
|
31129
32236
|
});
|
|
31130
32237
|
if (navLinkHit) {
|
|
31131
32238
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
@@ -31141,8 +32248,7 @@ function OhhwellsBridge() {
|
|
|
31141
32248
|
document.querySelectorAll(NON_MEDIA_SELECTOR)
|
|
31142
32249
|
).find((el) => {
|
|
31143
32250
|
if (el.closest("[data-ohw-nav-children]") && !getNavigationItemAnchor(el)) return false;
|
|
31144
|
-
|
|
31145
|
-
return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
|
|
32251
|
+
return hitsShown(el, x2, y2);
|
|
31146
32252
|
});
|
|
31147
32253
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
31148
32254
|
if (textEl && !textEl.hasAttribute("contenteditable")) {
|
|
@@ -31157,7 +32263,7 @@ function OhhwellsBridge() {
|
|
|
31157
32263
|
} else if (!textEl.closest("[data-ohw-href-key]") && !isSelectedForHoverRef.current(textEl)) {
|
|
31158
32264
|
hoveredItemElRef.current = null;
|
|
31159
32265
|
setHoveredItemRect(null);
|
|
31160
|
-
textEl.setAttribute("data-ohw-hovered", "");
|
|
32266
|
+
hoverFrame(textEl).setAttribute("data-ohw-hovered", "");
|
|
31161
32267
|
} else {
|
|
31162
32268
|
hoveredItemElRef.current = null;
|
|
31163
32269
|
setHoveredItemRect(null);
|
|
@@ -33058,8 +34164,7 @@ function OhhwellsBridge() {
|
|
|
33058
34164
|
const textEditable = Array.from(
|
|
33059
34165
|
document.querySelectorAll(NON_MEDIA_SELECTOR)
|
|
33060
34166
|
).find((el) => {
|
|
33061
|
-
|
|
33062
|
-
return clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom;
|
|
34167
|
+
return hitsShown(el, clientX, clientY);
|
|
33063
34168
|
});
|
|
33064
34169
|
if (textEditable) {
|
|
33065
34170
|
const hrefCtx = getHrefKeyFromElement(textEditable);
|
|
@@ -33246,7 +34351,7 @@ function OhhwellsBridge() {
|
|
|
33246
34351
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
33247
34352
|
};
|
|
33248
34353
|
}, [isEditMode, refreshStateRules]);
|
|
33249
|
-
(0,
|
|
34354
|
+
(0, import_react26.useEffect)(() => {
|
|
33250
34355
|
if (!isEditMode) return;
|
|
33251
34356
|
const THRESHOLD = 10;
|
|
33252
34357
|
const resolveWasSelected = (el) => {
|
|
@@ -33402,7 +34507,7 @@ function OhhwellsBridge() {
|
|
|
33402
34507
|
unlockFooterDragInteraction();
|
|
33403
34508
|
};
|
|
33404
34509
|
}, [isEditMode]);
|
|
33405
|
-
(0,
|
|
34510
|
+
(0, import_react26.useEffect)(() => {
|
|
33406
34511
|
if (!isEditMode) return;
|
|
33407
34512
|
const THRESHOLD = 10;
|
|
33408
34513
|
const onPointerDown = (e) => {
|
|
@@ -33493,7 +34598,7 @@ function OhhwellsBridge() {
|
|
|
33493
34598
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
33494
34599
|
};
|
|
33495
34600
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
33496
|
-
(0,
|
|
34601
|
+
(0, import_react26.useEffect)(() => {
|
|
33497
34602
|
const handler = (e) => {
|
|
33498
34603
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
33499
34604
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -33509,7 +34614,7 @@ function OhhwellsBridge() {
|
|
|
33509
34614
|
window.addEventListener("message", handler);
|
|
33510
34615
|
return () => window.removeEventListener("message", handler);
|
|
33511
34616
|
}, [processConfigRequest]);
|
|
33512
|
-
(0,
|
|
34617
|
+
(0, import_react26.useEffect)(() => {
|
|
33513
34618
|
if (!isEditMode) return;
|
|
33514
34619
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
33515
34620
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -33533,7 +34638,7 @@ function OhhwellsBridge() {
|
|
|
33533
34638
|
postToParent2({
|
|
33534
34639
|
type: "ow:ready",
|
|
33535
34640
|
version: "1",
|
|
33536
|
-
bridgeVersion: "0.1.
|
|
34641
|
+
bridgeVersion: "0.1.173-next.460",
|
|
33537
34642
|
path: pathname,
|
|
33538
34643
|
nodes: collectEditableNodes(editContentRef.current),
|
|
33539
34644
|
sections
|
|
@@ -33545,13 +34650,13 @@ function OhhwellsBridge() {
|
|
|
33545
34650
|
clearTimeout(timer);
|
|
33546
34651
|
};
|
|
33547
34652
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
33548
|
-
(0,
|
|
34653
|
+
(0, import_react26.useEffect)(() => {
|
|
33549
34654
|
scrollToHashSectionWhenReady();
|
|
33550
34655
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
33551
34656
|
window.addEventListener("hashchange", onHashChange);
|
|
33552
34657
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
33553
34658
|
}, [pathname]);
|
|
33554
|
-
const handleCommand = (0,
|
|
34659
|
+
const handleCommand = (0, import_react26.useCallback)((cmd) => {
|
|
33555
34660
|
const el = activeElRef.current;
|
|
33556
34661
|
const selBefore = window.getSelection();
|
|
33557
34662
|
let savedOffsets = null;
|
|
@@ -33587,7 +34692,7 @@ function OhhwellsBridge() {
|
|
|
33587
34692
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
33588
34693
|
refreshActiveCommandsRef.current();
|
|
33589
34694
|
}, []);
|
|
33590
|
-
(0,
|
|
34695
|
+
(0, import_react26.useEffect)(() => {
|
|
33591
34696
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
33592
34697
|
if (!session || !logoSizeDraft) return;
|
|
33593
34698
|
const onPanelAction = (e) => {
|
|
@@ -33625,7 +34730,7 @@ function OhhwellsBridge() {
|
|
|
33625
34730
|
window.addEventListener("message", onPanelAction);
|
|
33626
34731
|
return () => window.removeEventListener("message", onPanelAction);
|
|
33627
34732
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
33628
|
-
const handleStateChange = (0,
|
|
34733
|
+
const handleStateChange = (0, import_react26.useCallback)((state) => {
|
|
33629
34734
|
if (!activeStateElRef.current) return;
|
|
33630
34735
|
const el = activeStateElRef.current;
|
|
33631
34736
|
if (state === "Default") {
|
|
@@ -33638,7 +34743,8 @@ function OhhwellsBridge() {
|
|
|
33638
34743
|
}
|
|
33639
34744
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
33640
34745
|
}, [deactivate]);
|
|
33641
|
-
|
|
34746
|
+
stateChangeRef.current = handleStateChange;
|
|
34747
|
+
const reselectAfterLinkPopover = (0, import_react26.useCallback)(
|
|
33642
34748
|
(hrefKey) => {
|
|
33643
34749
|
requestAnimationFrame(() => {
|
|
33644
34750
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -33647,7 +34753,7 @@ function OhhwellsBridge() {
|
|
|
33647
34753
|
},
|
|
33648
34754
|
[resolveHrefKeyElement]
|
|
33649
34755
|
);
|
|
33650
|
-
const closeLinkPopover = (0,
|
|
34756
|
+
const closeLinkPopover = (0, import_react26.useCallback)(() => {
|
|
33651
34757
|
const session = linkPopoverSessionRef.current;
|
|
33652
34758
|
addNavAfterAnchorRef.current = null;
|
|
33653
34759
|
setLinkPopover(null);
|
|
@@ -33655,9 +34761,9 @@ function OhhwellsBridge() {
|
|
|
33655
34761
|
reselectAfterLinkPopover(session.key);
|
|
33656
34762
|
}
|
|
33657
34763
|
}, [reselectAfterLinkPopover]);
|
|
33658
|
-
const closeLinkPopoverRef = (0,
|
|
34764
|
+
const closeLinkPopoverRef = (0, import_react26.useRef)(closeLinkPopover);
|
|
33659
34765
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
33660
|
-
const openLinkPopoverForActive = (0,
|
|
34766
|
+
const openLinkPopoverForActive = (0, import_react26.useCallback)(() => {
|
|
33661
34767
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
33662
34768
|
if (!hrefCtx) return;
|
|
33663
34769
|
bumpLinkPopoverGrace();
|
|
@@ -33668,7 +34774,7 @@ function OhhwellsBridge() {
|
|
|
33668
34774
|
});
|
|
33669
34775
|
deactivate();
|
|
33670
34776
|
}, [deactivate]);
|
|
33671
|
-
const openLinkPopoverForSelected = (0,
|
|
34777
|
+
const openLinkPopoverForSelected = (0, import_react26.useCallback)(() => {
|
|
33672
34778
|
const anchor = selectedElRef.current;
|
|
33673
34779
|
if (!anchor) return;
|
|
33674
34780
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -33685,7 +34791,7 @@ function OhhwellsBridge() {
|
|
|
33685
34791
|
});
|
|
33686
34792
|
deselect();
|
|
33687
34793
|
}, [deselect]);
|
|
33688
|
-
const handleSelectParent = (0,
|
|
34794
|
+
const handleSelectParent = (0, import_react26.useCallback)(() => {
|
|
33689
34795
|
const selected = selectedElRef.current;
|
|
33690
34796
|
if (!selected) return;
|
|
33691
34797
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -33712,7 +34818,7 @@ function OhhwellsBridge() {
|
|
|
33712
34818
|
}
|
|
33713
34819
|
deselectRef.current();
|
|
33714
34820
|
}, []);
|
|
33715
|
-
const handleDuplicateSelected = (0,
|
|
34821
|
+
const handleDuplicateSelected = (0, import_react26.useCallback)(() => {
|
|
33716
34822
|
const selected = selectedElRef.current;
|
|
33717
34823
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
33718
34824
|
if (isCtaButton(selected)) {
|
|
@@ -33882,7 +34988,7 @@ function OhhwellsBridge() {
|
|
|
33882
34988
|
});
|
|
33883
34989
|
}
|
|
33884
34990
|
}, [postToParent2, tokensForButton]);
|
|
33885
|
-
const runPendingDeleteUndo = (0,
|
|
34991
|
+
const runPendingDeleteUndo = (0, import_react26.useCallback)(() => {
|
|
33886
34992
|
const pending = pendingDeleteUndoRef.current;
|
|
33887
34993
|
if (!pending) return false;
|
|
33888
34994
|
pendingDeleteUndoRef.current = null;
|
|
@@ -33890,7 +34996,7 @@ function OhhwellsBridge() {
|
|
|
33890
34996
|
enforceLinkHrefs();
|
|
33891
34997
|
return true;
|
|
33892
34998
|
}, []);
|
|
33893
|
-
const deleteAiBlock = (0,
|
|
34999
|
+
const deleteAiBlock = (0, import_react26.useCallback)(
|
|
33894
35000
|
(editKey, opts) => {
|
|
33895
35001
|
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33896
35002
|
if (deletingAiBlockRef.current) return false;
|
|
@@ -33959,7 +35065,7 @@ function OhhwellsBridge() {
|
|
|
33959
35065
|
},
|
|
33960
35066
|
[postToParent2]
|
|
33961
35067
|
);
|
|
33962
|
-
const softHideTemplateEditable = (0,
|
|
35068
|
+
const softHideTemplateEditable = (0, import_react26.useCallback)(
|
|
33963
35069
|
(el, opts) => {
|
|
33964
35070
|
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33965
35071
|
if (!canSoftHideEditable(el, {
|
|
@@ -34004,7 +35110,7 @@ function OhhwellsBridge() {
|
|
|
34004
35110
|
},
|
|
34005
35111
|
[postToParent2]
|
|
34006
35112
|
);
|
|
34007
|
-
const deleteFromToolbar = (0,
|
|
35113
|
+
const deleteFromToolbar = (0, import_react26.useCallback)(
|
|
34008
35114
|
(editKey, el) => {
|
|
34009
35115
|
if (!editKey && !el) return false;
|
|
34010
35116
|
if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
|
|
@@ -34016,7 +35122,7 @@ function OhhwellsBridge() {
|
|
|
34016
35122
|
},
|
|
34017
35123
|
[deleteAiBlock, softHideTemplateEditable]
|
|
34018
35124
|
);
|
|
34019
|
-
const resolveSelectedAiBlockKey = (0,
|
|
35125
|
+
const resolveSelectedAiBlockKey = (0, import_react26.useCallback)(() => {
|
|
34020
35126
|
const candidates = [
|
|
34021
35127
|
activeElRef.current?.dataset.ohwKey,
|
|
34022
35128
|
selectedMediaElRef.current?.dataset.ohwKey,
|
|
@@ -34031,7 +35137,7 @@ function OhhwellsBridge() {
|
|
|
34031
35137
|
}
|
|
34032
35138
|
return null;
|
|
34033
35139
|
}, [selectedMedia]);
|
|
34034
|
-
const handleDeleteSelected = (0,
|
|
35140
|
+
const handleDeleteSelected = (0, import_react26.useCallback)(() => {
|
|
34035
35141
|
if (!activeElRef.current) {
|
|
34036
35142
|
const aiKey = resolveSelectedAiBlockKey();
|
|
34037
35143
|
if (aiKey && deleteAiBlock(aiKey)) return true;
|
|
@@ -34099,7 +35205,7 @@ function OhhwellsBridge() {
|
|
|
34099
35205
|
}, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
|
|
34100
35206
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
34101
35207
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
34102
|
-
const handleLinkPopoverSubmit = (0,
|
|
35208
|
+
const handleLinkPopoverSubmit = (0, import_react26.useCallback)(
|
|
34103
35209
|
(target) => {
|
|
34104
35210
|
const session = linkPopoverSessionRef.current;
|
|
34105
35211
|
if (!session) return;
|
|
@@ -34165,14 +35271,14 @@ function OhhwellsBridge() {
|
|
|
34165
35271
|
const showEditLink = toolbarShowEditLink;
|
|
34166
35272
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
34167
35273
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
34168
|
-
const handleMediaSelect = (0,
|
|
35274
|
+
const handleMediaSelect = (0, import_react26.useCallback)((key) => {
|
|
34169
35275
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
34170
35276
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
34171
35277
|
) ?? null;
|
|
34172
35278
|
if (!el) return;
|
|
34173
35279
|
selectMediaElementRef.current(el);
|
|
34174
35280
|
}, []);
|
|
34175
|
-
const handleMediaReplace = (0,
|
|
35281
|
+
const handleMediaReplace = (0, import_react26.useCallback)(
|
|
34176
35282
|
(key) => {
|
|
34177
35283
|
postToParent2({
|
|
34178
35284
|
type: "ow:image-pick",
|
|
@@ -34182,13 +35288,13 @@ function OhhwellsBridge() {
|
|
|
34182
35288
|
},
|
|
34183
35289
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
34184
35290
|
);
|
|
34185
|
-
const handleEditCarousel = (0,
|
|
35291
|
+
const handleEditCarousel = (0, import_react26.useCallback)(
|
|
34186
35292
|
(key) => {
|
|
34187
35293
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
34188
35294
|
},
|
|
34189
35295
|
[postToParent2]
|
|
34190
35296
|
);
|
|
34191
|
-
const handleMediaFadeOutComplete = (0,
|
|
35297
|
+
const handleMediaFadeOutComplete = (0, import_react26.useCallback)((key) => {
|
|
34192
35298
|
setUploadingRects((prev) => {
|
|
34193
35299
|
if (!(key in prev)) return prev;
|
|
34194
35300
|
const next = { ...prev };
|
|
@@ -34196,7 +35302,7 @@ function OhhwellsBridge() {
|
|
|
34196
35302
|
return next;
|
|
34197
35303
|
});
|
|
34198
35304
|
}, []);
|
|
34199
|
-
const handleVideoSettingsChange = (0,
|
|
35305
|
+
const handleVideoSettingsChange = (0, import_react26.useCallback)(
|
|
34200
35306
|
(key, settings) => {
|
|
34201
35307
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
34202
35308
|
const video = getVideoEl2(el);
|
|
@@ -34922,6 +36028,10 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34922
36028
|
SITE_OG_IMAGE_KEY,
|
|
34923
36029
|
SchedulingWidget,
|
|
34924
36030
|
TEMPLATE_LOGO_ATTR,
|
|
36031
|
+
TONE_ATTR,
|
|
36032
|
+
TONE_CHANGE_EVENT,
|
|
36033
|
+
TONE_FIX_ATTR,
|
|
36034
|
+
TONE_THRESHOLD,
|
|
34925
36035
|
Toggle,
|
|
34926
36036
|
ToggleGroup,
|
|
34927
36037
|
ToggleGroupItem,
|
|
@@ -34940,11 +36050,16 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34940
36050
|
canRemoveAiBlock,
|
|
34941
36051
|
canRemoveAiTextBlock,
|
|
34942
36052
|
canSoftHideEditable,
|
|
36053
|
+
compositeColor,
|
|
36054
|
+
compositeGradient,
|
|
36055
|
+
computeBackgroundTones,
|
|
36056
|
+
contrastRatioOf,
|
|
34943
36057
|
dropIndicatorVariants,
|
|
34944
36058
|
ensureFooterTree,
|
|
34945
36059
|
filterAvailablePages,
|
|
34946
36060
|
foldAlignIntoTrees,
|
|
34947
36061
|
getEditModeInitialState,
|
|
36062
|
+
gradientStopColors,
|
|
34948
36063
|
hasMountedContentNodes,
|
|
34949
36064
|
indexCollectionItems,
|
|
34950
36065
|
insertFooterHours,
|
|
@@ -34956,16 +36071,21 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34956
36071
|
isRenderableTree,
|
|
34957
36072
|
isStickySearchParam,
|
|
34958
36073
|
isValidUrl,
|
|
36074
|
+
linearGradientColourAt,
|
|
36075
|
+
mapRegionToImage,
|
|
34959
36076
|
matchCollectionItemClick,
|
|
36077
|
+
mountBackgroundTone,
|
|
34960
36078
|
nextViableSlide,
|
|
34961
36079
|
parseAiFooterState,
|
|
34962
36080
|
parseAiSectionsState,
|
|
36081
|
+
parseCssColor,
|
|
34963
36082
|
parseTarget,
|
|
34964
36083
|
planAiBlockRemoval,
|
|
34965
36084
|
planAiTextBlockRemoval,
|
|
34966
36085
|
planBuildPageSync,
|
|
34967
36086
|
readHiddenEditables,
|
|
34968
36087
|
recordOverriddenPaths,
|
|
36088
|
+
relativeLuminanceOf,
|
|
34969
36089
|
releaseTemplateLogoIfReplaced,
|
|
34970
36090
|
removeBlockAtPath,
|
|
34971
36091
|
removeFooterBlock,
|
|
@@ -34977,11 +36097,15 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34977
36097
|
shouldFetchContentForPath,
|
|
34978
36098
|
softHideEditableInDom,
|
|
34979
36099
|
softUnhideEditableInDom,
|
|
36100
|
+
splitTopLevel,
|
|
34980
36101
|
stepViableSlide,
|
|
34981
36102
|
stripPlaceholderText,
|
|
34982
36103
|
stripPlaceholders,
|
|
34983
36104
|
stripTextAlignCss,
|
|
34984
36105
|
toggleVariants,
|
|
36106
|
+
toneFor,
|
|
36107
|
+
toneOfColor,
|
|
36108
|
+
toneOfLuminance,
|
|
34985
36109
|
useOhwCarousel,
|
|
34986
36110
|
validateUrlInput,
|
|
34987
36111
|
viableSlides,
|