@base44-preview/vite-plugin 1.0.6-pr.63.d7abd73 → 1.0.18-pr.80.79b32f2
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/html-injections-plugin.d.ts.map +1 -1
- package/dist/html-injections-plugin.js +4 -2
- package/dist/html-injections-plugin.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/injections/auto-popup-suppressor.d.ts +6 -0
- package/dist/injections/auto-popup-suppressor.d.ts.map +1 -0
- package/dist/injections/auto-popup-suppressor.js +264 -0
- package/dist/injections/auto-popup-suppressor.js.map +1 -0
- package/dist/injections/canvas-wheel-zoom-bridge.d.ts +5 -0
- package/dist/injections/canvas-wheel-zoom-bridge.d.ts.map +1 -0
- package/dist/injections/canvas-wheel-zoom-bridge.js +64 -0
- package/dist/injections/canvas-wheel-zoom-bridge.js.map +1 -0
- package/dist/injections/page-height-bridge.d.ts +14 -0
- package/dist/injections/page-height-bridge.d.ts.map +1 -0
- package/dist/injections/page-height-bridge.js +510 -0
- package/dist/injections/page-height-bridge.js.map +1 -0
- package/dist/injections/visual-edit-agent.d.ts.map +1 -1
- package/dist/injections/visual-edit-agent.js +21 -0
- package/dist/injections/visual-edit-agent.js.map +1 -1
- package/dist/jsx-processor.d.ts.map +1 -1
- package/dist/jsx-processor.js +1 -0
- package/dist/jsx-processor.js.map +1 -1
- package/dist/processors/collection-id-processor.d.ts +1 -0
- package/dist/processors/collection-id-processor.d.ts.map +1 -1
- package/dist/processors/collection-id-processor.js +17 -0
- package/dist/processors/collection-id-processor.js.map +1 -1
- package/dist/processors/collection-item-field-processor.d.ts.map +1 -1
- package/dist/processors/collection-item-field-processor.js +16 -5
- package/dist/processors/collection-item-field-processor.js.map +1 -1
- package/dist/processors/collection-item-id-processor.d.ts +27 -0
- package/dist/processors/collection-item-id-processor.d.ts.map +1 -1
- package/dist/processors/collection-item-id-processor.js +128 -1
- package/dist/processors/collection-item-id-processor.js.map +1 -1
- package/dist/processors/utils/collection-tracing-utils.d.ts +1 -1
- package/dist/processors/utils/collection-tracing-utils.d.ts.map +1 -1
- package/dist/processors/utils/collection-tracing-utils.js +48 -10
- package/dist/processors/utils/collection-tracing-utils.js.map +1 -1
- package/dist/processors/utils/shared-utils.js +1 -1
- package/dist/processors/utils/shared-utils.js.map +1 -1
- package/dist/statics/index.mjs +8 -8
- package/dist/statics/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/bridge.ts +1 -1
- package/src/html-injections-plugin.ts +4 -2
- package/src/index.ts +2 -2
- package/src/injections/auto-popup-suppressor.ts +271 -0
- package/src/injections/canvas-wheel-zoom-bridge.ts +78 -0
- package/src/injections/page-height-bridge.ts +566 -0
- package/src/injections/visual-edit-agent.ts +32 -1
- package/src/jsx-processor.ts +1 -0
- package/src/processors/collection-id-processor.ts +17 -0
- package/src/processors/collection-item-field-processor.ts +23 -5
- package/src/processors/collection-item-id-processor.ts +154 -0
- package/src/processors/utils/collection-tracing-utils.ts +54 -8
- package/src/processors/utils/shared-utils.ts +1 -1
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
// page-height-bridge — postMessage protocol the iframe exposes to its parent.
|
|
2
|
+
// Inert until the parent posts a message; no observers, rewrites, or timers
|
|
3
|
+
// fire on their own.
|
|
4
|
+
//
|
|
5
|
+
// parent → child { type: "freeze-vh-units", referenceVhBase?: number }
|
|
6
|
+
// Rewrites every viewport-height unit (`vh`/`dvh`/`svh`/`lvh`) in
|
|
7
|
+
// <style> + CSSOM to a CSS variable-backed expression (kills the
|
|
8
|
+
// vh ↔ auto-resize feedback loop). Repeated calls update the variable,
|
|
9
|
+
// so callers can rebase without recovering raw CSS. Idempotent; covers
|
|
10
|
+
// HMR-added styles too. Fire-and-forget.
|
|
11
|
+
//
|
|
12
|
+
// parent → child { type: "measure-page-height", settleMs?: number }
|
|
13
|
+
// After `settleMs` (default 2000) posts the page's measured content height
|
|
14
|
+
// as `{ type: "page-height-measured", height }` to the requester.
|
|
15
|
+
const FALLBACK_VHBASE = 900;
|
|
16
|
+
const MIN_VHBASE = 400;
|
|
17
|
+
const DEFAULT_SETTLE_MS = 2000;
|
|
18
|
+
const NEUTRALIZE_DEBOUNCE_MS = 16;
|
|
19
|
+
// Three consecutive same-height samples ≈ ~50ms of "no change". Three is
|
|
20
|
+
// enough to filter single-frame jitter from layout passes but short enough
|
|
21
|
+
// that responses arrive promptly when the DOM is already settled.
|
|
22
|
+
const STABILITY_SAMPLES = 3;
|
|
23
|
+
// Interval between stability samples. ~1 frame at 60Hz; chosen as a plain
|
|
24
|
+
// setTimeout (not rAF) because jsdom rAFs are unreliably timed for tests and
|
|
25
|
+
// in real browsers a 16ms tick is post-layout for any layout work that fits
|
|
26
|
+
// inside one frame.
|
|
27
|
+
const STABILITY_TICK_MS = 16;
|
|
28
|
+
// Hard cap on the stability poll past settleMs. Pages that genuinely never
|
|
29
|
+
// stabilize (looping height-animating content) reply with their last sample
|
|
30
|
+
// rather than hanging the parent's resize logic.
|
|
31
|
+
const STABILITY_MAX_WAIT_MS = 1500;
|
|
32
|
+
const REFERENCE_VH_BASE_VAR = "--base44-reference-vh-base";
|
|
33
|
+
const noop = () => { };
|
|
34
|
+
let started = false;
|
|
35
|
+
/**
|
|
36
|
+
* Installs the parent-driven message listener. Returns a teardown that
|
|
37
|
+
* removes the listener, disconnects any observers attached as a result of
|
|
38
|
+
* `freeze-vh-units`, and clears any pending response timer. Returns a
|
|
39
|
+
* no-op when bailed (already started, SSR, top window).
|
|
40
|
+
*/
|
|
41
|
+
export function setupPageHeightBridge() {
|
|
42
|
+
if (started)
|
|
43
|
+
return noop;
|
|
44
|
+
if (typeof window === "undefined")
|
|
45
|
+
return noop;
|
|
46
|
+
if (window.self === window.top)
|
|
47
|
+
return noop;
|
|
48
|
+
started = true;
|
|
49
|
+
const controller = createPageHeightBridgeController();
|
|
50
|
+
const onMessage = (event) => {
|
|
51
|
+
const data = (event.data ?? null);
|
|
52
|
+
if (!data || typeof data !== "object")
|
|
53
|
+
return;
|
|
54
|
+
switch (data.type) {
|
|
55
|
+
case "freeze-vh-units": {
|
|
56
|
+
const override = typeof data.referenceVhBase === "number" ? data.referenceVhBase : undefined;
|
|
57
|
+
controller.freezeVhUnits(override);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
case "measure-page-height": {
|
|
61
|
+
const settleMs = typeof data.settleMs === "number" ? data.settleMs : DEFAULT_SETTLE_MS;
|
|
62
|
+
const origin = event.origin && event.origin !== "null" ? event.origin : "*";
|
|
63
|
+
controller.measurePageHeight(origin, settleMs);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
window.addEventListener("message", onMessage);
|
|
69
|
+
let torn = false;
|
|
70
|
+
return () => {
|
|
71
|
+
if (torn)
|
|
72
|
+
return;
|
|
73
|
+
torn = true;
|
|
74
|
+
started = false;
|
|
75
|
+
window.removeEventListener("message", onMessage);
|
|
76
|
+
controller.teardown();
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function createPageHeightBridgeController() {
|
|
80
|
+
let vhCleanups = null;
|
|
81
|
+
let vhForceRun = null;
|
|
82
|
+
let pendingSettle;
|
|
83
|
+
let pendingTick;
|
|
84
|
+
let pendingOrigin = "*";
|
|
85
|
+
const cancelPending = () => {
|
|
86
|
+
if (pendingSettle !== undefined) {
|
|
87
|
+
window.clearTimeout(pendingSettle);
|
|
88
|
+
pendingSettle = undefined;
|
|
89
|
+
}
|
|
90
|
+
if (pendingTick !== undefined) {
|
|
91
|
+
window.clearTimeout(pendingTick);
|
|
92
|
+
pendingTick = undefined;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
freezeVhUnits: (override) => {
|
|
97
|
+
const referenceVhBase = resolveReferenceVhBase(override);
|
|
98
|
+
setReferenceVhBase(referenceVhBase);
|
|
99
|
+
if (vhCleanups) {
|
|
100
|
+
vhForceRun?.();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
vhCleanups = [];
|
|
104
|
+
vhForceRun = startVhNeutralizer(vhCleanups);
|
|
105
|
+
},
|
|
106
|
+
// Target the requester's origin so the height isn't broadcast to anyone
|
|
107
|
+
// who happens to embed us. Falls back to "*" when origin is unavailable
|
|
108
|
+
// (jsdom default, sandboxed iframes with `null` origin).
|
|
109
|
+
//
|
|
110
|
+
// Stability-wait response: after `settleMs`, poll measureContentHeight at
|
|
111
|
+
// STABILITY_TICK_MS intervals until it's unchanged for STABILITY_SAMPLES
|
|
112
|
+
// consecutive ticks, then send exactly one reply. Catches late React
|
|
113
|
+
// mounts (sticky-positioned sections committing after settleMs), debounced
|
|
114
|
+
// neutralizer mutations not yet flushed, image/font-driven layout shifts.
|
|
115
|
+
// STABILITY_MAX_WAIT_MS caps the poll so a page that genuinely never
|
|
116
|
+
// settles still replies eventually.
|
|
117
|
+
measurePageHeight: (origin, settleMs = DEFAULT_SETTLE_MS) => {
|
|
118
|
+
pendingOrigin = origin;
|
|
119
|
+
cancelPending();
|
|
120
|
+
pendingSettle = window.setTimeout(() => {
|
|
121
|
+
pendingSettle = undefined;
|
|
122
|
+
// Flush any debounced unscroll / inline-vh rewrites NOW so the first
|
|
123
|
+
// sample sees a DOM that reflects every mutation triggered during the
|
|
124
|
+
// settle window. Without this, an `overflow-y: scroll` container that
|
|
125
|
+
// mounted mid-settle can still be hiding its children at sample time.
|
|
126
|
+
vhForceRun?.();
|
|
127
|
+
const deadline = nowMs() + STABILITY_MAX_WAIT_MS;
|
|
128
|
+
let lastHeight = -1;
|
|
129
|
+
let stableSamples = 0;
|
|
130
|
+
const respond = (height) => {
|
|
131
|
+
pendingTick = undefined;
|
|
132
|
+
window.parent.postMessage({ type: "page-height-measured", height }, pendingOrigin);
|
|
133
|
+
};
|
|
134
|
+
const tick = () => {
|
|
135
|
+
pendingTick = undefined;
|
|
136
|
+
const height = measureContentHeight();
|
|
137
|
+
if (height === lastHeight) {
|
|
138
|
+
stableSamples++;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
stableSamples = 1;
|
|
142
|
+
lastHeight = height;
|
|
143
|
+
}
|
|
144
|
+
if (stableSamples >= STABILITY_SAMPLES || nowMs() >= deadline) {
|
|
145
|
+
respond(height);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
pendingTick = window.setTimeout(tick, STABILITY_TICK_MS);
|
|
149
|
+
};
|
|
150
|
+
tick();
|
|
151
|
+
}, settleMs);
|
|
152
|
+
},
|
|
153
|
+
teardown: () => {
|
|
154
|
+
if (vhCleanups) {
|
|
155
|
+
for (const c of vhCleanups)
|
|
156
|
+
c();
|
|
157
|
+
vhCleanups = null;
|
|
158
|
+
vhForceRun = null;
|
|
159
|
+
}
|
|
160
|
+
cancelPending();
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function nowMs() {
|
|
165
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
166
|
+
return performance.now();
|
|
167
|
+
}
|
|
168
|
+
return Date.now();
|
|
169
|
+
}
|
|
170
|
+
function resolveReferenceVhBase(override) {
|
|
171
|
+
if (override !== undefined)
|
|
172
|
+
return override;
|
|
173
|
+
const detected = window.innerHeight || 0;
|
|
174
|
+
return detected >= MIN_VHBASE ? detected : FALLBACK_VHBASE;
|
|
175
|
+
}
|
|
176
|
+
function setReferenceVhBase(referenceVhBase) {
|
|
177
|
+
document.documentElement.style.setProperty(REFERENCE_VH_BASE_VAR, `${referenceVhBase}px`);
|
|
178
|
+
}
|
|
179
|
+
// Caches keep work proportional to *new* CSS, not total CSS. <head> observer
|
|
180
|
+
// catches `<style>`/`<link>` adds; per-element observers catch HMR text edits.
|
|
181
|
+
// Returns a `forceRun` so the caller can re-trigger neutralization on later
|
|
182
|
+
// parent requests (idempotent — already-rewritten text is skipped via the
|
|
183
|
+
// processed sets).
|
|
184
|
+
function startVhNeutralizer(cleanups) {
|
|
185
|
+
// Match vh + the dynamic/small/large variants. Tailwind v4 emits `h-screen`
|
|
186
|
+
// as `100dvh`; all four collapse to the same frozen `referenceVhBase`.
|
|
187
|
+
const VH_RE = /(\d+(?:\.\d+)?)(?:d|s|l)?vh\b/g;
|
|
188
|
+
const processedStyles = new WeakSet();
|
|
189
|
+
const processedSheets = new WeakMap();
|
|
190
|
+
const watchedStyles = new WeakSet();
|
|
191
|
+
const styleObservers = new Set();
|
|
192
|
+
const unscrolled = new WeakSet();
|
|
193
|
+
const rewrite = (input) => input.replace(VH_RE, (_match, n) => `calc(var(${REFERENCE_VH_BASE_VAR}) * ${formatVhFactor(n)})`);
|
|
194
|
+
// Defeats internal vertical scrollers. The canvas wants the whole page laid
|
|
195
|
+
// out top-to-bottom, but `<div class="overflow-y-auto" style={{height:
|
|
196
|
+
// "100vh"}}>` hides its children behind an internal scrollbar — only the
|
|
197
|
+
// first child appears in the preview. Forcing `overflow-y: visible` lets
|
|
198
|
+
// children paint outside the parent's box; block flow positions them at
|
|
199
|
+
// their natural offsets so document.body extends to include them. `auto`
|
|
200
|
+
// and `scroll` only — `hidden` and `clip` express intentional clipping (UI
|
|
201
|
+
// chrome, rounded-corner masks) we shouldn't undo.
|
|
202
|
+
const unscrollY = (el) => {
|
|
203
|
+
if (unscrolled.has(el))
|
|
204
|
+
return;
|
|
205
|
+
const computedStyle = window.getComputedStyle(el);
|
|
206
|
+
const ovY = computedStyle.overflowY;
|
|
207
|
+
if (ovY !== "auto" && ovY !== "scroll")
|
|
208
|
+
return;
|
|
209
|
+
unscrolled.add(el);
|
|
210
|
+
el.style.setProperty("overflow-y", "visible", "important");
|
|
211
|
+
};
|
|
212
|
+
const unscrollSubtree = (root) => {
|
|
213
|
+
unscrollY(root);
|
|
214
|
+
root.querySelectorAll("*").forEach(unscrollY);
|
|
215
|
+
};
|
|
216
|
+
// Rewrites vh-bearing properties on a single element's inline style. Covers
|
|
217
|
+
// React's `style={{ height: "100vh" }}` and imperative `el.style.h = ".vh"`
|
|
218
|
+
// — both bypass <style> tags and CSSOM. Per-property setProperty preserves
|
|
219
|
+
// `!important`. Snapshotting prop names first guards against iteration-time
|
|
220
|
+
// mutation of `style.length`.
|
|
221
|
+
const rewriteInlineStyle = (el) => {
|
|
222
|
+
const style = el.style;
|
|
223
|
+
if (!style || style.length === 0)
|
|
224
|
+
return;
|
|
225
|
+
const props = [];
|
|
226
|
+
for (let i = 0; i < style.length; i++) {
|
|
227
|
+
const prop = style[i];
|
|
228
|
+
if (prop)
|
|
229
|
+
props.push(prop);
|
|
230
|
+
}
|
|
231
|
+
for (const prop of props) {
|
|
232
|
+
const value = style.getPropertyValue(prop);
|
|
233
|
+
if (!value || value.indexOf("vh") === -1)
|
|
234
|
+
continue;
|
|
235
|
+
const next = rewrite(value);
|
|
236
|
+
if (next !== value)
|
|
237
|
+
style.setProperty(prop, next, style.getPropertyPriority(prop));
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const neutralize = () => {
|
|
241
|
+
document.querySelectorAll("style").forEach((el) => {
|
|
242
|
+
watchStyleEl(el);
|
|
243
|
+
if (processedStyles.has(el))
|
|
244
|
+
return;
|
|
245
|
+
processedStyles.add(el);
|
|
246
|
+
const text = el.textContent;
|
|
247
|
+
if (!text || text.indexOf("vh") === -1)
|
|
248
|
+
return;
|
|
249
|
+
const next = rewrite(text);
|
|
250
|
+
if (next !== text)
|
|
251
|
+
el.textContent = next;
|
|
252
|
+
});
|
|
253
|
+
for (let i = 0; i < document.styleSheets.length; i++) {
|
|
254
|
+
const sheet = document.styleSheets[i];
|
|
255
|
+
if (!sheet)
|
|
256
|
+
continue;
|
|
257
|
+
let rules;
|
|
258
|
+
try {
|
|
259
|
+
rules = sheet.cssRules;
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
continue; // CORS-protected
|
|
263
|
+
}
|
|
264
|
+
if (processedSheets.get(sheet) === rules.length)
|
|
265
|
+
continue;
|
|
266
|
+
rewriteVhInRules(rules, rewrite);
|
|
267
|
+
processedSheets.set(sheet, rules.length);
|
|
268
|
+
}
|
|
269
|
+
// Initial sweep of inline `style="...vh..."` attributes already in the DOM
|
|
270
|
+
// at freeze time. Future inline-style mutations (React commits, motion
|
|
271
|
+
// libraries, imperative assignments) are picked up by inlineStyleObserver.
|
|
272
|
+
document.querySelectorAll('[style*="vh"]').forEach(rewriteInlineStyle);
|
|
273
|
+
// Defeat internal scrollers — same dual coverage (initial sweep here,
|
|
274
|
+
// subtree additions in inlineStyleObserver).
|
|
275
|
+
if (document.body)
|
|
276
|
+
unscrollSubtree(document.body);
|
|
277
|
+
};
|
|
278
|
+
const debouncer = createDebouncer(neutralize, NEUTRALIZE_DEBOUNCE_MS);
|
|
279
|
+
const debouncedNeutralize = debouncer.trigger;
|
|
280
|
+
cleanups.push(debouncer.cancel);
|
|
281
|
+
const watchStyleEl = (el) => {
|
|
282
|
+
if (watchedStyles.has(el))
|
|
283
|
+
return;
|
|
284
|
+
watchedStyles.add(el);
|
|
285
|
+
const obs = new MutationObserver(() => {
|
|
286
|
+
processedStyles.delete(el);
|
|
287
|
+
debouncedNeutralize();
|
|
288
|
+
});
|
|
289
|
+
obs.observe(el, { characterData: true, childList: true, subtree: true });
|
|
290
|
+
styleObservers.add(obs);
|
|
291
|
+
};
|
|
292
|
+
cleanups.push(() => {
|
|
293
|
+
for (const obs of styleObservers)
|
|
294
|
+
obs.disconnect();
|
|
295
|
+
styleObservers.clear();
|
|
296
|
+
});
|
|
297
|
+
debouncedNeutralize();
|
|
298
|
+
if (document.readyState === "loading") {
|
|
299
|
+
document.addEventListener("DOMContentLoaded", debouncedNeutralize);
|
|
300
|
+
cleanups.push(() => document.removeEventListener("DOMContentLoaded", debouncedNeutralize));
|
|
301
|
+
}
|
|
302
|
+
window.addEventListener("load", debouncedNeutralize);
|
|
303
|
+
cleanups.push(() => window.removeEventListener("load", debouncedNeutralize));
|
|
304
|
+
const headObserver = new MutationObserver((mutations) => {
|
|
305
|
+
for (const m of mutations) {
|
|
306
|
+
if (containsStylesheetNode(m.addedNodes) || containsStylesheetNode(m.removedNodes)) {
|
|
307
|
+
debouncedNeutralize();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
cleanups.push(() => headObserver.disconnect());
|
|
313
|
+
const attachHeadObserver = () => {
|
|
314
|
+
if (document.head)
|
|
315
|
+
headObserver.observe(document.head, { childList: true, subtree: false });
|
|
316
|
+
};
|
|
317
|
+
if (document.head) {
|
|
318
|
+
attachHeadObserver();
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
document.addEventListener("DOMContentLoaded", attachHeadObserver);
|
|
322
|
+
cleanups.push(() => document.removeEventListener("DOMContentLoaded", attachHeadObserver));
|
|
323
|
+
}
|
|
324
|
+
// Pass 3: inline `style` attributes. One global observer covers every
|
|
325
|
+
// element — past, present, and future — without per-node tracking. Two
|
|
326
|
+
// mutation kinds matter:
|
|
327
|
+
// • attributes: React/JS sets `style` on an element already in the tree
|
|
328
|
+
// (`el.style.h = "..vh"`, re-render diff). After rewrite the value has
|
|
329
|
+
// no "vh", so the next mutation gates out — single-tick convergence.
|
|
330
|
+
// • childList: a node is mounted with its `style` attribute already set
|
|
331
|
+
// off-tree (React's initial mount path uses createElement+setAttribute
|
|
332
|
+
// BEFORE appendChild, so attribute mutations never fire for them). Scan
|
|
333
|
+
// the added subtree for `[style*="vh"]` and rewrite.
|
|
334
|
+
// Microtask delivery means rewrites land before layout, so no flash.
|
|
335
|
+
const scanSubtreeForInlineVh = (node) => {
|
|
336
|
+
if (!(node instanceof Element))
|
|
337
|
+
return;
|
|
338
|
+
const attr = node.getAttribute("style");
|
|
339
|
+
if (attr && attr.indexOf("vh") !== -1)
|
|
340
|
+
rewriteInlineStyle(node);
|
|
341
|
+
node.querySelectorAll('[style*="vh"]').forEach(rewriteInlineStyle);
|
|
342
|
+
// New subtrees may introduce overflow-y: auto|scroll containers (route
|
|
343
|
+
// changes, conditional UI). Catch them here too.
|
|
344
|
+
unscrollSubtree(node);
|
|
345
|
+
};
|
|
346
|
+
const inlineStyleObserver = new MutationObserver((mutations) => {
|
|
347
|
+
for (const m of mutations) {
|
|
348
|
+
if (m.type === "attributes") {
|
|
349
|
+
const target = m.target;
|
|
350
|
+
if (!(target instanceof Element))
|
|
351
|
+
continue;
|
|
352
|
+
const attr = target.getAttribute("style");
|
|
353
|
+
if (!attr || attr.indexOf("vh") === -1)
|
|
354
|
+
continue;
|
|
355
|
+
rewriteInlineStyle(target);
|
|
356
|
+
}
|
|
357
|
+
else if (m.type === "childList") {
|
|
358
|
+
for (let i = 0; i < m.addedNodes.length; i++) {
|
|
359
|
+
const node = m.addedNodes[i];
|
|
360
|
+
if (node)
|
|
361
|
+
scanSubtreeForInlineVh(node);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
cleanups.push(() => inlineStyleObserver.disconnect());
|
|
367
|
+
const attachInlineStyleObserver = () => {
|
|
368
|
+
const root = document.documentElement;
|
|
369
|
+
if (!root)
|
|
370
|
+
return;
|
|
371
|
+
inlineStyleObserver.observe(root, {
|
|
372
|
+
attributes: true,
|
|
373
|
+
attributeFilter: ["style"],
|
|
374
|
+
childList: true,
|
|
375
|
+
subtree: true,
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
attachInlineStyleObserver();
|
|
379
|
+
return debouncedNeutralize;
|
|
380
|
+
}
|
|
381
|
+
function formatVhFactor(value) {
|
|
382
|
+
return String(Number((parseFloat(value) / 100).toFixed(6)));
|
|
383
|
+
}
|
|
384
|
+
function rewriteVhInRules(rules, rewrite) {
|
|
385
|
+
for (let i = 0; i < rules.length; i++) {
|
|
386
|
+
const rule = rules[i];
|
|
387
|
+
if (!rule)
|
|
388
|
+
continue;
|
|
389
|
+
if (rule.cssRules)
|
|
390
|
+
rewriteVhInRules(rule.cssRules, rewrite);
|
|
391
|
+
const style = rule.style;
|
|
392
|
+
if (!style)
|
|
393
|
+
continue;
|
|
394
|
+
for (let j = 0; j < style.length; j++) {
|
|
395
|
+
const prop = style[j];
|
|
396
|
+
if (!prop)
|
|
397
|
+
continue;
|
|
398
|
+
const value = style.getPropertyValue(prop);
|
|
399
|
+
if (!value || value.indexOf("vh") === -1)
|
|
400
|
+
continue;
|
|
401
|
+
const next = rewrite(value);
|
|
402
|
+
if (next !== value)
|
|
403
|
+
style.setProperty(prop, next, style.getPropertyPriority(prop));
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function containsStylesheetNode(nodes) {
|
|
408
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
409
|
+
const node = nodes[i];
|
|
410
|
+
if (node instanceof HTMLStyleElement || node instanceof HTMLLinkElement)
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
function measureContentHeight() {
|
|
416
|
+
const scrollHeight = Math.max(document.documentElement.scrollHeight, document.body?.scrollHeight ?? 0);
|
|
417
|
+
const referenceVhBase = readReferenceVhBase();
|
|
418
|
+
// Excludes `body.clientHeight`: it grows with content, which makes
|
|
419
|
+
// viewportBottom land at the document bottom and trips the stretched-
|
|
420
|
+
// container heuristic on the last section. `referenceVhBase` keeps the
|
|
421
|
+
// h-screen-wrapper case covered when the iframe is shorter than 100vh.
|
|
422
|
+
const viewportHeight = Math.max(window.innerHeight || 0, document.documentElement.clientHeight, referenceVhBase);
|
|
423
|
+
const contentBottom = measureElementContentBottom(viewportHeight);
|
|
424
|
+
if (contentBottom > 0)
|
|
425
|
+
return Math.ceil(Math.max(contentBottom, referenceVhBase));
|
|
426
|
+
return Math.ceil(Math.max(scrollHeight, referenceVhBase));
|
|
427
|
+
}
|
|
428
|
+
function readReferenceVhBase() {
|
|
429
|
+
const value = document.documentElement.style.getPropertyValue(REFERENCE_VH_BASE_VAR);
|
|
430
|
+
const parsed = parseFloat(value);
|
|
431
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
432
|
+
}
|
|
433
|
+
function measureElementContentBottom(viewportHeight) {
|
|
434
|
+
if (!document.body)
|
|
435
|
+
return 0;
|
|
436
|
+
const elements = [document.body, ...Array.from(document.body.querySelectorAll("*"))];
|
|
437
|
+
const contentBottoms = new WeakMap();
|
|
438
|
+
const viewportBottom = window.scrollY + viewportHeight;
|
|
439
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
440
|
+
const el = elements[i];
|
|
441
|
+
if (!el)
|
|
442
|
+
continue;
|
|
443
|
+
const childContentBottom = readChildrenContentBottom(el, contentBottoms);
|
|
444
|
+
const metrics = readElementMetrics(el);
|
|
445
|
+
const selfBottom = isViewportStretchedContainer(metrics, childContentBottom, viewportHeight, viewportBottom)
|
|
446
|
+
? 0
|
|
447
|
+
: metrics.bottom;
|
|
448
|
+
contentBottoms.set(el, Math.max(childContentBottom, selfBottom));
|
|
449
|
+
}
|
|
450
|
+
return contentBottoms.get(document.body) ?? 0;
|
|
451
|
+
}
|
|
452
|
+
function readChildrenContentBottom(el, contentBottoms) {
|
|
453
|
+
let childContentBottom = 0;
|
|
454
|
+
for (let i = 0; i < el.children.length; i++) {
|
|
455
|
+
const child = el.children[i];
|
|
456
|
+
if (!child)
|
|
457
|
+
continue;
|
|
458
|
+
childContentBottom = Math.max(childContentBottom, contentBottoms.get(child) ?? 0);
|
|
459
|
+
}
|
|
460
|
+
return childContentBottom;
|
|
461
|
+
}
|
|
462
|
+
function readElementMetrics(el) {
|
|
463
|
+
const computedStyle = window.getComputedStyle(el);
|
|
464
|
+
if (isOutOfFlowDecoration(computedStyle))
|
|
465
|
+
return { bottom: 0, height: 0 };
|
|
466
|
+
const rect = el.getBoundingClientRect();
|
|
467
|
+
if (rect.width === 0 && rect.height === 0)
|
|
468
|
+
return { bottom: 0, height: 0 };
|
|
469
|
+
return {
|
|
470
|
+
bottom: rect.bottom + window.scrollY + readMarginBottom(computedStyle),
|
|
471
|
+
height: rect.height,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function readMarginBottom(computedStyle) {
|
|
475
|
+
const marginBottom = parseFloat(computedStyle.marginBottom);
|
|
476
|
+
return Number.isFinite(marginBottom) ? marginBottom : 0;
|
|
477
|
+
}
|
|
478
|
+
function isOutOfFlowDecoration(computedStyle) {
|
|
479
|
+
if (computedStyle.position === "fixed")
|
|
480
|
+
return true;
|
|
481
|
+
return computedStyle.position === "absolute" && computedStyle.pointerEvents === "none";
|
|
482
|
+
}
|
|
483
|
+
// A "stretched container" spans the full viewport top-to-bottom. Requires
|
|
484
|
+
// BOTH `bottom ≈ viewportBottom` AND `height ≈ viewportHeight` — otherwise an
|
|
485
|
+
// in-flow section that just happens to end at viewportBottom (e.g. when the
|
|
486
|
+
// iframe has been content-sized to the previous measurement) gets falsely
|
|
487
|
+
// filtered, undermeasuring the page.
|
|
488
|
+
function isViewportStretchedContainer(metrics, childBottom, viewportHeight, viewportBottom) {
|
|
489
|
+
return (childBottom > 0 &&
|
|
490
|
+
Math.abs(metrics.bottom - viewportBottom) <= 1 &&
|
|
491
|
+
Math.abs(metrics.height - viewportHeight) <= 1 &&
|
|
492
|
+
metrics.bottom - childBottom > 8);
|
|
493
|
+
}
|
|
494
|
+
function createDebouncer(fn, delayMs) {
|
|
495
|
+
let timer;
|
|
496
|
+
return {
|
|
497
|
+
trigger: () => {
|
|
498
|
+
if (timer !== undefined)
|
|
499
|
+
window.clearTimeout(timer);
|
|
500
|
+
timer = window.setTimeout(fn, delayMs);
|
|
501
|
+
},
|
|
502
|
+
cancel: () => {
|
|
503
|
+
if (timer !== undefined) {
|
|
504
|
+
window.clearTimeout(timer);
|
|
505
|
+
timer = undefined;
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
//# sourceMappingURL=page-height-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-height-bridge.js","sourceRoot":"","sources":["../../src/injections/page-height-bridge.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC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qCAAqC;AACrC,SAAS,4BAA4B,CACnC,OAAuB,EACvB,WAAmB,EACnB,cAAsB,EACtB,cAAsB;IAEtB,OAAO,CACL,WAAW,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC;QAC9C,OAAO,CAAC,MAAM,GAAG,WAAW,GAAG,CAAC,CACjC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,EAAc,EAAE,OAAe;IACtD,IAAI,KAAyB,CAAC;IAC9B,OAAO;QACL,OAAO,EAAE,GAAS,EAAE;YAClB,IAAI,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACpD,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,EAAE,GAAS,EAAE;YACjB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3B,KAAK,GAAG,SAAS,CAAC;YACpB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-edit-agent.d.ts","sourceRoot":"","sources":["../../src/injections/visual-edit-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"visual-edit-agent.d.ts","sourceRoot":"","sources":["../../src/injections/visual-edit-agent.ts"],"names":[],"mappings":"AAWA,wBAAgB,oBAAoB,SAyuBnC"}
|
|
@@ -3,8 +3,14 @@ import { createLayerController } from "./layer-dropdown/controller.js";
|
|
|
3
3
|
import { LAYER_DROPDOWN_ATTR } from "./layer-dropdown/consts.js";
|
|
4
4
|
import { createInlineEditController } from "../capabilities/inline-edit/index.js";
|
|
5
5
|
import { THEME_FONT_PREVIEW_ID } from "../consts.js";
|
|
6
|
+
import { createCanvasWheelZoomBridgeController } from "./canvas-wheel-zoom-bridge.js";
|
|
7
|
+
import { createPageHeightBridgeController } from "./page-height-bridge.js";
|
|
8
|
+
import { createAutoPopupSuppressorController } from "./auto-popup-suppressor.js";
|
|
6
9
|
const REPOSITION_DELAY_MS = 50;
|
|
7
10
|
export function setupVisualEditAgent() {
|
|
11
|
+
const canvasWheelZoomBridge = createCanvasWheelZoomBridgeController();
|
|
12
|
+
const pageHeightBridge = createPageHeightBridgeController();
|
|
13
|
+
const autoPopupSuppressor = createAutoPopupSuppressorController();
|
|
8
14
|
// State variables (replacing React useState/useRef)
|
|
9
15
|
let isVisualEditMode = false;
|
|
10
16
|
let isPopoverDragging = false;
|
|
@@ -362,6 +368,7 @@ export function setupVisualEditAgent() {
|
|
|
362
368
|
const toggleVisualEditMode = (isEnabled) => {
|
|
363
369
|
isVisualEditMode = isEnabled;
|
|
364
370
|
if (!isEnabled) {
|
|
371
|
+
canvasWheelZoomBridge.disable();
|
|
365
372
|
resumeAnimations();
|
|
366
373
|
inlineEdit.stopEditing();
|
|
367
374
|
clearSelection();
|
|
@@ -525,6 +532,20 @@ export function setupVisualEditAgent() {
|
|
|
525
532
|
inlineEdit.handleToggleMessage(message.data);
|
|
526
533
|
}
|
|
527
534
|
break;
|
|
535
|
+
case "freeze-vh-units":
|
|
536
|
+
pageHeightBridge.freezeVhUnits(typeof message.referenceVhBase === "number"
|
|
537
|
+
? message.referenceVhBase
|
|
538
|
+
: undefined);
|
|
539
|
+
break;
|
|
540
|
+
case "measure-page-height":
|
|
541
|
+
pageHeightBridge.measurePageHeight(event.origin && event.origin !== "null" ? event.origin : "*", typeof message.settleMs === "number" ? message.settleMs : undefined);
|
|
542
|
+
break;
|
|
543
|
+
case "suppress-auto-popups":
|
|
544
|
+
autoPopupSuppressor.suppress();
|
|
545
|
+
break;
|
|
546
|
+
case "toggle-canvas-wheel-zoom-bridge":
|
|
547
|
+
canvasWheelZoomBridge.enable();
|
|
548
|
+
break;
|
|
528
549
|
default:
|
|
529
550
|
break;
|
|
530
551
|
}
|