@base44-preview/vite-plugin 1.0.42-pr.127.dda89c0 → 1.0.44-pr.129.61a8371
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/consts.d.ts +9 -0
- package/dist/consts.d.ts.map +1 -1
- package/dist/consts.js +2 -0
- package/dist/consts.js.map +1 -1
- package/dist/html-injections-plugin.d.ts +1 -7
- package/dist/html-injections-plugin.d.ts.map +1 -1
- package/dist/html-injections-plugin.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jsx-processor.d.ts.map +1 -1
- package/dist/jsx-processor.js +4 -0
- package/dist/jsx-processor.js.map +1 -1
- package/dist/statics/index.mjs +2 -2
- package/dist/statics/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/consts.ts +5 -0
- package/src/html-injections-plugin.ts +1 -3
- package/src/index.ts +1 -0
- package/src/jsx-processor.ts +3 -0
- package/src/visual-edit-plugin.md +6 -5
package/README.md
CHANGED
|
@@ -161,7 +161,7 @@ function RootDocument({ children }) {
|
|
|
161
161
|
}
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
The module is virtual: the plugin decides its contents from the same options, command and env as the `index.html` injections, so dev gets the sandbox scripts (plus `ssr-mount-signal.js`, which reports the mount once the document is parsed because a hydrated page never triggers the mutation observer) and production gets the analytics tracker. Module scripts run in document order, so rendering the component before `<Scripts />` keeps the error handlers registered before hydration starts, as they are in `index.html`. Never render it in `<head>`: the preview proxy prepends its own scripts there, and React 19 fails hydration of a head it did not render. `base44DocumentScripts()` returns the raw `{ src, classic? }` / `{ children }` list
|
|
164
|
+
The module is virtual: the plugin decides its contents from the same options, command and env as the `index.html` injections, so dev gets the sandbox scripts (plus `ssr-mount-signal.js`, which reports the mount once the document is parsed because a hydrated page never triggers the mutation observer) and production gets the analytics tracker. Module scripts run in document order, so rendering the component before `<Scripts />` keeps the error handlers registered before hydration starts, as they are in `index.html`. Never render it in `<head>`: the preview proxy prepends its own scripts there, and React 19 fails hydration of a head it did not render. `base44DocumentScripts()` returns the raw `{ src, classic? }` / `{ children }` list, typed as `DocumentScript` from `@base44/vite-plugin`, for a document that renders the tags itself. Render every entry as `type="module"` except those with `classic: true`: the Tailwind CDN that the sandbox dev server loads for visual edit is a classic script.
|
|
165
165
|
|
|
166
166
|
### Local Development (Visual Edit Agent)
|
|
167
167
|
|
package/dist/consts.d.ts
CHANGED
|
@@ -8,7 +8,16 @@ export declare const DATA_ARR_FIELD = "data-arr-field";
|
|
|
8
8
|
export declare const ALLOWED_CUSTOM_COMPONENTS: string[];
|
|
9
9
|
export declare const MAX_JSX_DEPTH = 10;
|
|
10
10
|
export declare const EXCLUDED_FIELDS: string[];
|
|
11
|
+
/** Document shell a server-rendered root route renders as JSX; never an editable element. */
|
|
12
|
+
export declare const DOCUMENT_ELEMENTS: string[];
|
|
11
13
|
export declare const THEME_FONT_PREVIEW_ID = "__theme-font-preview";
|
|
12
14
|
/** Loaded by visual edit to preview Tailwind classes the app's own build has not compiled yet. */
|
|
13
15
|
export declare const TAILWIND_CDN_SRC = "https://cdn.tailwindcss.com";
|
|
16
|
+
/** A `base44:document` script; `classic` ones render without `type="module"`. */
|
|
17
|
+
export type DocumentScript = {
|
|
18
|
+
src: string;
|
|
19
|
+
classic?: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
children: string;
|
|
22
|
+
};
|
|
14
23
|
//# sourceMappingURL=consts.d.ts.map
|
package/dist/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AACjE,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AACvE,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,yBAAyB,UAAoB,CAAC;AAC3D,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,eAAe,UAAyB,CAAC;AACtD,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAE5D,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AACjE,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AACvE,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,yBAAyB,UAAoB,CAAC;AAC3D,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,eAAe,UAAyB,CAAC;AACtD,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,UAA2B,CAAC;AAC1D,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAE5D,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAE9D,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/consts.js
CHANGED
|
@@ -8,6 +8,8 @@ export const DATA_ARR_FIELD = "data-arr-field";
|
|
|
8
8
|
export const ALLOWED_CUSTOM_COMPONENTS = ["Image", "Link"];
|
|
9
9
|
export const MAX_JSX_DEPTH = 10;
|
|
10
10
|
export const EXCLUDED_FIELDS = ["children", "length"];
|
|
11
|
+
/** Document shell a server-rendered root route renders as JSX; never an editable element. */
|
|
12
|
+
export const DOCUMENT_ELEMENTS = ["html", "head", "body"];
|
|
11
13
|
export const THEME_FONT_PREVIEW_ID = "__theme-font-preview";
|
|
12
14
|
/** Loaded by visual edit to preview Tailwind classes the app's own build has not compiled yet. */
|
|
13
15
|
export const TAILWIND_CDN_SRC = "https://cdn.tailwindcss.com";
|
package/dist/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAE5D,kGAAkG;AAClG,MAAM,CAAC,MAAM,gBAAgB,GAAG,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AACjE,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACtD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAE5D,kGAAkG;AAClG,MAAM,CAAC,MAAM,gBAAgB,GAAG,6BAA6B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ServerResponse } from "node:http";
|
|
2
2
|
import type { Connect, Plugin } from "vite";
|
|
3
|
+
import { type DocumentScript } from "./consts.js";
|
|
3
4
|
/**
|
|
4
5
|
* Bundled dev resolves module-script `src` through the bundler instead of the
|
|
5
6
|
* dev server, so a node_modules URL would break on any non-flat install. These
|
|
@@ -16,13 +17,6 @@ export declare const PLUGIN_DIST_DIR: string;
|
|
|
16
17
|
* from its own options, the command and the env, exactly as for `index.html`.
|
|
17
18
|
*/
|
|
18
19
|
export declare const DOCUMENT_SPECIFIER = "base44:document";
|
|
19
|
-
/** `classic` scripts render without `type="module"`. */
|
|
20
|
-
export type DocumentScript = {
|
|
21
|
-
src: string;
|
|
22
|
-
classic?: boolean;
|
|
23
|
-
} | {
|
|
24
|
-
children: string;
|
|
25
|
-
};
|
|
26
20
|
/**
|
|
27
21
|
* The document renders inline content through `dangerouslySetInnerHTML`, which
|
|
28
22
|
* React does not escape; an env value carrying `</script>` would otherwise
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injections-plugin.d.ts","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAoC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"html-injections-plugin.d.ts","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAoC,MAAM,MAAM,CAAC;AAG9E,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AA+CpE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AAgDtE,gFAAgF;AAChF,eAAO,MAAM,eAAe,QAA+C,CAAC;AAI5E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAIpD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CA2BhE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,SAAkB,GAAG,MAAM,GAAG,SAAS,CAGjG;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,IACzC,KAAK,OAAO,CAAC,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC,YAAY,UA0BtF;AAED,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,WAAmB,GACpB,EAAE;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,EAAE,CAmLX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injections-plugin.js","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"html-injections-plugin.js","sourceRoot":"","sources":["../src/html-injections-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAuB,MAAM,aAAa,CAAC;AAapE,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BhC,CAAC;AAEF,M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B;QAC/B,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,EAAE;YACV,OAAO,EAAE,KAAK,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,EAAE;YACL,OAAO,EAAE,KAAK,iBAAiB,CAAC,CAAC,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7E,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAS/C,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmBlD,eAAO,MAAM,uBAAuB,UAWnC,CAAC;AAeF,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,IAAI,GAAE;IACJ,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACvB,iBAwPP"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAA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G;YACjD,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;YACvB,CAAC,CAAC,EAAE,CAAC;QACP,yEAAyE;QACzE,2EAA2E;QAC3E,yEAAyE;QACzE,iEAAiE;QACjE,mBAAmB,EAAE;QACrB,wEAAwE;QACxE,wEAAwE;QACxE,2EAA2E;QAC3E,4EAA4E;QAC5E,qBAAqB,EAAE;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-processor.d.ts","sourceRoot":"","sources":["../src/jsx-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"jsx-processor.d.ts","sourceRoot":"","sources":["../src/jsx-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,CAAC,MAAM,cAAc,CAAC;AAQvC,qBAAa,YAAY;IAOrB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IAPlB,OAAO,CAAC,qBAAqB,CAAwB;IACrD,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,oBAAoB,CAAuB;gBAGzC,KAAK,EAAE,OAAO,CAAC,EACf,QAAQ,EAAE,MAAM;IAQ1B,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAc5D,OAAO,CAAC,0BAA0B;IAclC,OAAO,CAAC,0BAA0B;IA2BlC,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,+BAA+B;CAgFxC"}
|
package/dist/jsx-processor.js
CHANGED
|
@@ -2,6 +2,8 @@ import { CollectionIdProcessor } from "./processors/collection-id-processor.js";
|
|
|
2
2
|
import { DataItemIdProcessor } from "./processors/collection-item-id-processor.js";
|
|
3
3
|
import { DataItemFieldProcessor } from "./processors/collection-item-field-processor.js";
|
|
4
4
|
import { StaticArrayProcessor } from "./processors/static-array-processor.js";
|
|
5
|
+
import { DOCUMENT_ELEMENTS } from "./consts.js";
|
|
6
|
+
import { JSXUtils } from "./jsx-utils.js";
|
|
5
7
|
export class JSXProcessor {
|
|
6
8
|
types;
|
|
7
9
|
filename;
|
|
@@ -18,6 +20,8 @@ export class JSXProcessor {
|
|
|
18
20
|
this.staticArrayProcessor = new StaticArrayProcessor(types);
|
|
19
21
|
}
|
|
20
22
|
processJSXElement(path) {
|
|
23
|
+
if (DOCUMENT_ELEMENTS.includes(JSXUtils.getElementName(path.node) ?? ""))
|
|
24
|
+
return;
|
|
21
25
|
if (this.hasAttribute(path, "data-source-location"))
|
|
22
26
|
return;
|
|
23
27
|
this.addSourceLocationAttribute(path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-processor.js","sourceRoot":"","sources":["../src/jsx-processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"jsx-processor.js","sourceRoot":"","sources":["../src/jsx-processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACh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AAM,UAAU,GAAG,UAAU,CAAC,cAAc,EAAE,UAAU,IAAI,EAAE,CAAC;QAC/D,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,IAAI,iBAAiB;gBAAE,MAAM;YAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,iBAAiB,GAAG,IAAI,CAAC;gBACzB,MAAM;YACR,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAClD,YAAY,CAAC,IAAI,CAAC,KAA2C,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,iBAAiB;gBAAE,MAAM;YAC7B,YAAY,CAAC,KAA2C,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/statics/index.mjs
CHANGED
|
@@ -8,9 +8,9 @@ function be(e,t){let n=t.top<27,o=t.height>=54,i=t.width>=window.innerWidth-4,a=
|
|
|
8
8
|
`;let t=document.createElement("style");t.id="freeze-pointer-events",t.textContent=`
|
|
9
9
|
[data-visual-edit-active] * { pointer-events: none !important; }
|
|
10
10
|
[${A}], [${A}] * { pointer-events: auto !important; }
|
|
11
|
-
`;let n=document.head||document.documentElement;n.appendChild(e),n.appendChild(t),document.getAnimations().forEach(o=>{let i=o.effect?.target;if(!(i instanceof Element&&i.closest(`[${A}]`)))try{o.finish()}catch{o.pause()}})}function Se(){let e=document.getElementById("freeze-animations");e&&(e.remove(),document.getElementById("freeze-pointer-events")?.remove(),document.documentElement.removeAttribute("data-visual-edit-active"),document.getAnimations().forEach(t=>{if(t.playState==="paused")try{t.play()}catch{}}))}function oe(e,t){let n=document.getElementById("freeze-pointer-events");n&&(n.disabled=!0);let o=document.elementFromPoint(e,t);return n&&(n.disabled=!1),o?.closest("[data-source-location], [data-visual-selector-id]")??null}function Me(e,t,n){let o=oe(e,t);if(!o)return null;let i=_(o);return i===n?null:i}var ut="visual-edit-font-face-";function ft(e){let t=e.trim();if(!t.startsWith("@font-face")||t.includes("\\"))return!1;let n=(t.match(/{/g)||[]).length,o=(t.match(/}/g)||[]).length;if(n!==1||o!==1||!t.endsWith("}"))return!1;let i=t.split(/url\(/i);for(let a=1;a<i.length;a++){let m=i[a].indexOf(")");if(m===-1)return!1;let u=i[a].slice(0,m).trim().replace(/^['"]|['"]$/g,"").trim();if(!/^https:\/\//i.test(u))return!1}return!0}function Ce(e,t){if(typeof e!="string"||!e.trim()||typeof t!="string"||!ft(t))return;let n=`${ut}${e}`;if(document.getElementById(n))return;let o=document.createElement("style");o.id=n,o.dataset.visualEditFontFace="true",o.textContent=t,document.head.appendChild(o)}var Ae={position:"absolute",backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",fontSize:"12px",minWidth:"120px",maxHeight:"200px",overflowY:"auto",zIndex:"10001",padding:"4px 0",pointerEvents:"auto"},_e={padding:"4px 12px",cursor:"pointer",color:"#334155",backgroundColor:"transparent",whiteSpace:"nowrap",lineHeight:"1.5",fontWeight:"400"},K="#526cff",xe="#DBEAFE",De="600",re="#f1f5f9",He=10,ie='<svg width="12" height="12" viewBox="0 0 24 24" style="vertical-align:middle;margin-left:4px"><path d="M6 9l6 6 6-6" stroke="currentColor" stroke-width="2" fill="none"/></svg>',Oe='<svg width="12" height="12" viewBox="0 0 24 24" style="vertical-align:middle;margin-left:4px"><path d="M18 15l-6-6-6 6" stroke="currentColor" stroke-width="2" fill="none"/></svg>',F="data-chevron",Ne=12,W="data-layer-dropdown",Re=2,Pe=2;function se(e,t){for(let n of Object.keys(t))e.style.setProperty(n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`),t[n])}function Be(e){return e.tagName}function le(e,t){let n={element:e,tagName:O(e).toLowerCase(),selectorId:_(e)};return t!==void 0&&(n.depth=t),n}function ke(e,t,n){let o=[];function i(a,m){if(!(m>t))for(let u=0;u<a.children.length;u++){let
|
|
11
|
+
`;let n=document.head||document.documentElement;n.appendChild(e),n.appendChild(t),document.getAnimations().forEach(o=>{let i=o.effect?.target;if(!(i instanceof Element&&i.closest(`[${A}]`)))try{o.finish()}catch{o.pause()}})}function Se(){let e=document.getElementById("freeze-animations");e&&(e.remove(),document.getElementById("freeze-pointer-events")?.remove(),document.documentElement.removeAttribute("data-visual-edit-active"),document.getAnimations().forEach(t=>{if(t.playState==="paused")try{t.play()}catch{}}))}function oe(e,t){let n=document.getElementById("freeze-pointer-events");n&&(n.disabled=!0);let o=document.elementFromPoint(e,t);return n&&(n.disabled=!1),o?.closest("[data-source-location], [data-visual-selector-id]")??null}function Me(e,t,n){let o=oe(e,t);if(!o)return null;let i=_(o);return i===n?null:i}var ut="visual-edit-font-face-";function ft(e){let t=e.trim();if(!t.startsWith("@font-face")||t.includes("\\"))return!1;let n=(t.match(/{/g)||[]).length,o=(t.match(/}/g)||[]).length;if(n!==1||o!==1||!t.endsWith("}"))return!1;let i=t.split(/url\(/i);for(let a=1;a<i.length;a++){let m=i[a].indexOf(")");if(m===-1)return!1;let u=i[a].slice(0,m).trim().replace(/^['"]|['"]$/g,"").trim();if(!/^https:\/\//i.test(u))return!1}return!0}function Ce(e,t){if(typeof e!="string"||!e.trim()||typeof t!="string"||!ft(t))return;let n=`${ut}${e}`;if(document.getElementById(n))return;let o=document.createElement("style");o.id=n,o.dataset.visualEditFontFace="true",o.textContent=t,document.head.appendChild(o)}var Ae={position:"absolute",backgroundColor:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",fontSize:"12px",minWidth:"120px",maxHeight:"200px",overflowY:"auto",zIndex:"10001",padding:"4px 0",pointerEvents:"auto"},_e={padding:"4px 12px",cursor:"pointer",color:"#334155",backgroundColor:"transparent",whiteSpace:"nowrap",lineHeight:"1.5",fontWeight:"400"},K="#526cff",xe="#DBEAFE",De="600",re="#f1f5f9",He=10,ie='<svg width="12" height="12" viewBox="0 0 24 24" style="vertical-align:middle;margin-left:4px"><path d="M6 9l6 6 6-6" stroke="currentColor" stroke-width="2" fill="none"/></svg>',Oe='<svg width="12" height="12" viewBox="0 0 24 24" style="vertical-align:middle;margin-left:4px"><path d="M18 15l-6-6-6 6" stroke="currentColor" stroke-width="2" fill="none"/></svg>',F="data-chevron",Ne=12,W="data-layer-dropdown",Re=2,Pe=2;function se(e,t){for(let n of Object.keys(t))e.style.setProperty(n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`),t[n])}function Be(e){return e.tagName}function le(e,t){let n={element:e,tagName:O(e).toLowerCase(),selectorId:_(e)};return t!==void 0&&(n.depth=t),n}function ke(e,t,n){let o=[];function i(a,m){if(!(m>t))for(let u=0;u<a.children.length;u++){let y=a.children[u];if(ee(y)){let f={element:y,tagName:O(y).toLowerCase(),selectorId:_(y)};n!==void 0&&(f.depth=n+m-1),o.push(f),i(y,m+1)}else i(y,m)}}return i(e,1),o}function mt(e){let t=[],n=e.parentElement;for(;n&&n!==document.documentElement&&n!==document.body&&t.length<Re;)ee(n)&&t.push(le(n)),n=n.parentElement;return t.reverse(),t}function pt(e,t){return t.forEach((n,o)=>{e.push({...n,depth:o})}),t.length}function Ve(e,t,n){e.push(le(t,n));let o=ke(t,Pe,n+1);e.push(...o)}function Et(e){return e.at(-1)?.element??null}function gt(e,t){let n=ke(e,1);return n.some(o=>o.element===t)||n.push(le(t)),n}function ht(e,t,n,o){let i=_(n),a=new Set;for(let m of t)if(m.element===n)Ve(e,n,o),i&&a.add(i);else{let u=m.selectorId;if(u!=null){if(u===i||a.has(u))continue;a.add(u)}e.push({...m,depth:o})}}function Fe(e){let t=mt(e),n=[],o=pt(n,t),i=Et(t);if(i){let a=gt(i,e);ht(n,a,e,o)}else Ve(n,e,o);return n}var B=null,ae=null,$=null,q=null,X=null;function yt(e,t,{onSelect:n,onHover:o,onHoverEnd:i}){let a=document.createElement("div");a.textContent=Be(e),se(a,_e);let m=e.depth??0;return m>0&&(a.style.paddingLeft=`${Ne+m*He}px`),t&&(a.style.color=K,a.style.backgroundColor=xe,a.style.fontWeight=De),a.addEventListener("mouseenter",()=>{t||(a.style.backgroundColor=re),o&&o(e)}),a.addEventListener("mouseleave",()=>{t||(a.style.backgroundColor="transparent"),i&&i()}),a.addEventListener("click",u=>{u.stopPropagation(),u.preventDefault(),n(e)}),a}function vt(e,t,n){let o=document.createElement("div");return o.setAttribute(W,"true"),o.setAttribute(A,"true"),se(o,Ae),e.forEach(i=>{let a=i.element===t;o.appendChild(yt(i,a,n))}),o}function We(e){if(e.querySelector(`[${F}]`))return;let t=document.createElement("span");t.setAttribute(F,"true"),t.style.display="inline-flex",t.innerHTML=ie,e.appendChild(t),e.style.display="inline-flex",e.style.alignItems="center",e.style.cursor="pointer",e.style.userSelect="none",e.style.whiteSpace="nowrap",e.style.pointerEvents="auto",e.setAttribute(W,"true"),e.setAttribute(A,"true")}function bt(e,t,n,{onSelect:o,onHover:i,onHoverEnd:a}){let m=Array.from(e.children),u=t.findIndex(f=>f.element===n),y=f=>{if(u>=0&&u<m.length){let g=m[u];g.style.color!==K&&(g.style.backgroundColor="transparent")}if(u=f,u>=0&&u<m.length){let g=m[u];g.style.color!==K&&(g.style.backgroundColor=re),g.scrollIntoView({block:"nearest"}),i&&u>=0&&u<t.length&&i(t[u])}};X=f=>{f.key==="ArrowDown"?(f.preventDefault(),f.stopPropagation(),y(u<m.length-1?u+1:0)):f.key==="ArrowUp"?(f.preventDefault(),f.stopPropagation(),y(u>0?u-1:m.length-1)):f.key==="Enter"&&u>=0&&u<t.length&&(f.preventDefault(),f.stopPropagation(),a&&a(),o(t[u]),N())},document.addEventListener("keydown",X,!0)}function Lt(e,t){let n=!0;$=o=>{if(n){n=!1;return}let i=o.target;!e.contains(i)&&i!==t&&N()},document.addEventListener("mousedown",$,!0)}function $e(e,t,n,o){N();let i=vt(t,n,{...o,onSelect:u=>{o.onHoverEnd&&o.onHoverEnd(),o.onSelect(u),N()}}),a=e.parentElement;if(!a)return;i.style.top=`${e.offsetTop+e.offsetHeight+2}px`,i.style.left=`${e.offsetLeft}px`,a.appendChild(i),B=i,ae=e;let m=e.querySelector(`[${F}]`);m&&(m.innerHTML=Oe),q=o.onHoverEnd??null,bt(i,t,n,o),Lt(i,e)}function N(){let e=ae?.querySelector(`[${F}]`);e&&(e.innerHTML=ie),ae=null,q&&(q(),q=null),B&&B.parentNode&&B.remove(),B=null,$&&(document.removeEventListener("mousedown",$,!0),$=null),X&&(document.removeEventListener("keydown",X,!0),X=null)}function Xe(){return B!==null}function Ye(e){let t=null,n=null,o=null,i=()=>{t&&t.parentNode&&t.remove(),t=null},a=L=>{i(),_(L.element)!==e.getSelectedElementId()&&(t=e.createPreviewOverlay(L.element))},m=L=>{i(),N(),n&&(document.removeEventListener("keydown",n,!0),n=null),o=null;let s=e.selectElement(L.element);f(s,L.element)},u=()=>{n&&(document.removeEventListener("keydown",n,!0),n=null),o&&(m(o),o=null)},y=(L,s,c,S,w)=>{L.stopPropagation(),L.preventDefault(),Xe()?(N(),u()):(o={element:c,tagName:O(c).toLowerCase(),selectorId:w},e.onDeselect(),n=I=>{I.key==="Escape"&&(I.stopPropagation(),N(),u())},document.addEventListener("keydown",n,!0),$e(s,S,c,{onSelect:m,onHover:a,onHoverEnd:i}))},f=(L,s)=>{if(!L)return;let c=L.querySelector("div");if(!c)return;let S=Fe(s);if(S.length<=1)return;let w=_(s);We(c),c.addEventListener("click",I=>{y(I,c,s,S,w)})};return{attachToOverlay:f,cleanup:()=>{i(),N()}}}var de="visual-edit-focus-styles",Tt=["div","p","h1","h2","h3","h4","h5","h6","span","li","td","a","button","label"],ce=e=>!!e.dataset.arrField,wt=e=>!(!Tt.includes(e.tagName.toLowerCase())||!e.textContent?.trim()||e.querySelector("img, video, canvas, svg")||e.children?.length>0),Ue=()=>{if(document.getElementById(de))return;let e=document.createElement("style");e.id=de,e.textContent=`
|
|
12
12
|
[data-selected="true"][contenteditable="true"]:focus {
|
|
13
13
|
outline: none !important;
|
|
14
14
|
}
|
|
15
|
-
`,document.head.appendChild(e)},ze=()=>{document.getElementById(de)?.remove()},Ke=e=>{let t=document.createRange();t.selectNodeContents(e);let n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)},It=e=>!(e instanceof HTMLElement)||!wt(e)?!1:ce(e)?!0:e.dataset.dynamicContent!=="true",ue=e=>!(e instanceof HTMLElement)||e.dataset.selected!=="true"?!1:It(e);var St=500;function fe(e){let t=null,n=null,o=!1,i=new WeakMap,a=()=>{let s=e.getSelectedElementId();if(!s)return;let c=e.findElementsById(s);e.getSelectedOverlays().forEach((w,I)=>{I<c.length&&c[I]&&e.positionOverlay(w,c[I])})},m=s=>{let c=s.dataset.originalTextContent,S=s.textContent,w=s.getBoundingClientRect(),I={type:"inline-edit",elementInfo:{tagName:s.tagName,classes:z(s),visualSelectorId:e.getSelectedElementId(),content:S,dataSourceLocation:s.dataset.sourceLocation,isDynamicContent:s.dataset.dynamicContent==="true",linenumber:s.dataset.linenumber,filename:s.dataset.filename,position:{top:w.top,left:w.left,right:w.right,bottom:w.bottom,width:w.width,height:w.height,centerX:w.left+w.width/2,centerY:w.top+w.height/2}},originalContent:c,newContent:S};ce(s)&&(I.arrIndex=s.dataset.arrIndex,I.arrVariableName=s.dataset.arrVariableName,I.arrField=s.dataset.arrField),window.parent.postMessage(I,"*"),s.dataset.originalTextContent=S||""},u=s=>{n&&clearTimeout(n),n=setTimeout(()=>m(s),St)},v=s=>{a(),u(s)},f=function(){v(this)},g=s=>{Ue(),s.dataset.originalTextContent=s.textContent||"",s.dataset.originalCursor=s.style.cursor,s.contentEditable="true",s.setAttribute(A,"true");let c=new AbortController;i.set(s,c),s.addEventListener("input",f,{signal:c.signal}),s.style.cursor="text",Ke(s),setTimeout(()=>{s.isConnected&&s.focus()},0)},L=s=>{let c=i.get(s);c&&(c.abort(),i.delete(s)),s.isConnected&&(ze(),s.contentEditable="false",s.removeAttribute(A),delete s.dataset.originalTextContent,s.dataset.originalCursor!==void 0&&(s.style.cursor=s.dataset.originalCursor,delete s.dataset.originalCursor))};return{get enabled(){return o},set enabled(s){o=s},isEditing(){return t!==null},getCurrentElement(){return t},canEdit(s){return ue(s)},startEditing(s){t=s,e.getSelectedOverlays().forEach(c=>{c.style.display="none"}),g(s),window.parent.postMessage({type:"content-editing-started",visualSelectorId:e.getSelectedElementId()},"*")},stopEditing(){if(!t)return;n&&(clearTimeout(n),n=null),L(t),e.getSelectedOverlays().forEach(c=>{c.style.display=""}),a(),window.parent.postMessage({type:"content-editing-ended",visualSelectorId:e.getSelectedElementId()},"*"),t=null},markElementsSelected(s){s.forEach(c=>{c instanceof HTMLElement&&(c.dataset.selected="true")})},clearSelectedMarks(s){s&&e.findElementsById(s).forEach(c=>{c instanceof HTMLElement&&delete c.dataset.selected})},handleToggleMessage(s){if(!o)return;let c=e.findElementsById(s.dataSourceLocation);if(c.length===0||!(c[0]instanceof HTMLElement))return;let S=c[0];if(s.inlineEditingMode){if(!ue(S))return;e.getSelectedElementId()!==s.dataSourceLocation&&(this.stopEditing(),e.clearSelection(),this.markElementsSelected(c),e.createSelectionOverlays(c,s.dataSourceLocation)),this.startEditing(S)}else t===S&&this.stopEditing()},cleanup(){this.stopEditing()}}}var me="__theme-font-preview";function Mt(e){return e instanceof Element?e:e instanceof Node?e.parentElement:null}function Ct(e){return Mt(e)?.closest(`[${A}]`)!=null}function qe(){let e=!1,t=i=>{if(Ct(i.target))return;if(i.preventDefault(),i.ctrlKey||i.metaKey){window.parent.postMessage({type:"canvas-wheel-zoom",data:{deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,metaKey:i.metaKey}},"*");return}let a={deltaX:i.deltaX,deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY,shiftKey:i.shiftKey,ctrlKey:!1,metaKey:!1};window.parent.postMessage({type:"canvas-wheel-pan",data:a},"*")};return{enable:()=>{e||(e=!0,window.addEventListener("wheel",t,{capture:!0,passive:!1}))},disable:()=>{e&&(e=!1,window.removeEventListener("wheel",t,!0))}}}var pe="--base44-reference-vh-base";function Ze(){let e=null,t=null,n,o,i="*",a=()=>{n!==void 0&&(window.clearTimeout(n),n=void 0),o!==void 0&&(window.clearTimeout(o),o=void 0)};return{freezeVhUnits:m=>{let u=At(m);if(_t(u),e){t?.();return}e=[],t=xt(e)},measurePageHeight:(m,u=2e3)=>{i=m,a(),n=window.setTimeout(()=>{n=void 0,t?.();let v=Ge()+1500,f=-1,g=0,L=c=>{o=void 0,window.parent.postMessage({type:"page-height-measured",height:c},i)},s=()=>{o=void 0;let c=Ht();if(c===f?g++:(g=1,f=c),g>=3||Ge()>=v){L(c);return}o=window.setTimeout(s,16)};s()},u)},teardown:()=>{if(e){for(let m of e)m();e=null,t=null}a()}}}function Ge(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function At(e){if(e!==void 0)return e;let t=window.innerHeight||0;return t>=400?t:900}function _t(e){document.documentElement.style.setProperty(pe,`${e}px`)}function xt(e){let t=/(\d+(?:\.\d+)?)(?:d|s|l)?vh\b/g,n=new WeakSet,o=new WeakMap,i=new WeakSet,a=new Set,m=new WeakSet,u=p=>p.replace(t,(h,T)=>`calc(var(${pe}) * ${Dt(T)})`),v=p=>{if(m.has(p))return;let T=window.getComputedStyle(p).overflowY;T!=="auto"&&T!=="scroll"||(m.add(p),p.style.setProperty("overflow-y","visible","important"))},f=p=>{v(p),p.querySelectorAll("*").forEach(v)},g=p=>{let h=p.style;if(!h||h.length===0)return;let T=[];for(let C=0;C<h.length;C++){let D=h[C];D&&T.push(D)}for(let C of T){let D=h.getPropertyValue(C);if(!D||D.indexOf("vh")===-1)continue;let k=u(D);k!==D&&h.setProperty(C,k,h.getPropertyPriority(C))}},s=Ft(()=>{document.querySelectorAll("style").forEach(p=>{if(S(p),n.has(p))return;n.add(p);let h=p.textContent;if(!h||h.indexOf("vh")===-1)return;let T=u(h);T!==h&&(p.textContent=T)});for(let p=0;p<document.styleSheets.length;p++){let h=document.styleSheets[p];if(!h)continue;let T;try{T=h.cssRules}catch{continue}o.get(h)!==T.length&&(Je(T,u),o.set(h,T.length))}document.querySelectorAll('[style*="vh"]').forEach(g),document.body&&f(document.body)},16),c=s.trigger;e.push(s.cancel);let S=p=>{if(i.has(p))return;i.add(p);let h=new MutationObserver(()=>{n.delete(p),c()});h.observe(p,{characterData:!0,childList:!0,subtree:!0}),a.add(h)};e.push(()=>{for(let p of a)p.disconnect();a.clear()}),c(),document.readyState==="loading"&&(document.addEventListener("DOMContentLoaded",c),e.push(()=>document.removeEventListener("DOMContentLoaded",c))),window.addEventListener("load",c),e.push(()=>window.removeEventListener("load",c));let w=new MutationObserver(p=>{for(let h of p)if(je(h.addedNodes)||je(h.removedNodes)){c();return}});e.push(()=>w.disconnect());let I=()=>{document.head&&w.observe(document.head,{childList:!0,subtree:!1})};document.head?I():(document.addEventListener("DOMContentLoaded",I),e.push(()=>document.removeEventListener("DOMContentLoaded",I)));let j=p=>{if(!(p instanceof Element))return;let h=p.getAttribute("style");h&&h.indexOf("vh")!==-1&&g(p),p.querySelectorAll('[style*="vh"]').forEach(g),f(p)},Y=new MutationObserver(p=>{for(let h of p)if(h.type==="attributes"){let T=h.target;if(!(T instanceof Element))continue;let C=T.getAttribute("style");if(!C||C.indexOf("vh")===-1)continue;g(T)}else if(h.type==="childList")for(let T=0;T<h.addedNodes.length;T++){let C=h.addedNodes[T];C&&j(C)}});return e.push(()=>Y.disconnect()),(()=>{let p=document.documentElement;p&&Y.observe(p,{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0})})(),c}function Dt(e){return String(Number((parseFloat(e)/100).toFixed(6)))}function Je(e,t){for(let n=0;n<e.length;n++){let o=e[n];if(!o)continue;o.cssRules&&Je(o.cssRules,t);let i=o.style;if(i)for(let a=0;a<i.length;a++){let m=i[a];if(!m)continue;let u=i.getPropertyValue(m);if(!u||u.indexOf("vh")===-1)continue;let v=t(u);v!==u&&i.setProperty(m,v,i.getPropertyPriority(m))}}}function je(e){for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof HTMLStyleElement||n instanceof HTMLLinkElement)return!0}return!1}function Ht(){let e=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0),t=Ot(),n=Math.max(window.innerHeight||0,document.documentElement.clientHeight,t),o=Nt(n);return o>0?Math.ceil(Math.max(o,t)):Math.ceil(Math.max(e,t))}function Ot(){let e=document.documentElement.style.getPropertyValue(pe),t=parseFloat(e);return Number.isFinite(t)?t:0}function Nt(e){if(!document.body)return 0;let t=[document.body,...Array.from(document.body.querySelectorAll("*"))],n=new WeakMap,o=window.scrollY+e;for(let i=t.length-1;i>=0;i--){let a=t[i];if(!a)continue;let m=Rt(a,n),u=Pt(a),v=Vt(u,m,e,o)?0:u.bottom;n.set(a,Math.max(m,v))}return n.get(document.body)??0}function Rt(e,t){let n=0;for(let o=0;o<e.children.length;o++){let i=e.children[o];i&&(n=Math.max(n,t.get(i)??0))}return n}function Pt(e){let t=window.getComputedStyle(e);if(kt(t))return{bottom:0,height:0};let n=e.getBoundingClientRect();return n.width===0&&n.height===0?{bottom:0,height:0}:{bottom:n.bottom+window.scrollY+Bt(t),height:n.height}}function Bt(e){let t=parseFloat(e.marginBottom);return Number.isFinite(t)?t:0}function kt(e){return e.position==="fixed"?!0:e.position==="absolute"&&e.pointerEvents==="none"}function Vt(e,t,n,o){return t>0&&Math.abs(e.bottom-o)<=1&&Math.abs(e.height-n)<=1&&e.bottom-t>8}function Ft(e,t){let n;return{trigger:()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(e,t)},cancel:()=>{n!==void 0&&(window.clearTimeout(n),n=void 0)}}}var P="data-base44-suppressed-popup",Wt="--base44-reference-vh-base";function et(){let e=null,t=null,n=!1,o=!1,i=(f,g)=>{if(!(f instanceof HTMLElement)||f.hasAttribute(P))return;let L=window.getComputedStyle(f);if(L.position==="fixed"&&he(L)){if(Yt(f,g)&&Ut(f,L)){a(f);return}o&&tt(f,g)&&ge(f)}},a=f=>{f.hasAttribute(P)||(ge(f),o=!0,$t(Ee()))},m=(f,g)=>{i(f,g);let L=f.querySelectorAll(`*:not([${P}])`);for(let s=0;s<L.length;s++){let c=L[s];c&&i(c,g)}},u=()=>{e||(e=new MutationObserver(f=>{let g=Ee();for(let L of f)if(L.type==="childList")for(let s=0;s<L.addedNodes.length;s++){let c=L.addedNodes[s];c instanceof Element&&m(c,g)}}),e.observe(document.documentElement,{childList:!0,subtree:!0}))},v=()=>{document.body&&(m(document.body,Ee()),u())};return{suppress:()=>{n||(n=!0,document.body?v():(t=()=>{t=null,v()},document.addEventListener("DOMContentLoaded",t)))},teardown:()=>{n=!1,o=!1,e&&(e.disconnect(),e=null),t&&(document.removeEventListener("DOMContentLoaded",t),t=null)}}}function $t(e){if(!document.body||e.vw<=0||e.vh<=0)return;let t=document.body.querySelectorAll(`*:not([${P}])`);for(let n=0;n<t.length;n++){let o=t[n];o&&Xt(o,e)&&ge(o)}}function Xt(e,t){if(e.hasAttribute(P))return!1;let n=window.getComputedStyle(e);return n.position!=="fixed"||!he(n)?!1:tt(e,t)}function Yt(e,t){if(t.vw<=0||t.vh<=0)return!1;let n=e.getBoundingClientRect();return n.width>=t.vw*.9&&n.height>=t.vh*.9}function tt(e,t){let n=e.getBoundingClientRect();return n.width>=t.vw*.15&&n.height>=t.vh*.15&&n.width<=t.vw*.95&&n.height<=t.vh*.95}function he(e){let t=parseInt(e.zIndex,10);return Number.isFinite(t)&&t>=40}function Ut(e,t){if(Qe(t.backgroundColor)||t.backdropFilter&&t.backdropFilter!=="none")return!0;let n=e.querySelectorAll("*");for(let o=0;o<n.length;o++){let i=n[o];if(!i)continue;let a=window.getComputedStyle(i);if(!(a.position!=="fixed"&&a.position!=="absolute")&&he(a)&&(Qe(a.backgroundColor)||a.backdropFilter&&a.backdropFilter!=="none"))return!0}return!1}function Qe(e){let t=zt(e);return t!==null&&t>0&&t<1}function zt(e){if(!e)return null;let t=/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*([0-9.]+)\s*)?\)$/.exec(e);if(t)return t[1]===void 0?1:parseFloat(t[1]);let n=/\/\s*([0-9.]+)(%?)\s*\)$/.exec(e);if(n){let o=parseFloat(n[1]);return n[2]==="%"?o/100:o}return/^[a-z]+\s*\(/.test(e)?1:null}function Ee(){let e=window.innerWidth||document.documentElement.clientWidth||0,t=document.documentElement.style.getPropertyValue(Wt),n=parseFloat(t),o=Number.isFinite(n)&&n>0?n:window.innerHeight||document.documentElement.clientHeight||0;return{vw:e,vh:o}}function ge(e){e.hasAttribute(P)||(e.setAttribute(P,"1"),e.style.setProperty("display","none","important"))}var G=50;function Kt(){let e=qe(),t=Ze(),n=et(),o=!1,i=!1,a=!1,m=[],u=[],v=[],f=null,g=null,L=(l=!1)=>{let r=document.createElement("div");return r.style.position="absolute",r.style.pointerEvents="none",r.style.transition="all 0.1s ease-in-out",r.style.zIndex="9999",l?r.style.border="2px solid #2563EB":(r.style.border="2px solid #95a5fc",r.style.backgroundColor="rgba(99, 102, 241, 0.05)"),r},s=(l,r,d=!1)=>{if(!r||!o)return;r.offsetWidth;let b=r.getBoundingClientRect();l.style.top=`${b.top+window.scrollY}px`,l.style.left=`${b.left+window.scrollX}px`,l.style.width=`${b.width}px`,l.style.height=`${b.height}px`;let y=l.querySelector("div");y||(y=document.createElement("div"),y.textContent=O(r).toLowerCase(),y.style.position="absolute",y.style.left="-2px",y.style.padding="2px 8px",y.style.fontSize="11px",y.style.fontWeight=d?"500":"400",y.style.color=d?"#ffffff":"#526cff",y.style.backgroundColor=d?"#2563EB":"#DBEAFE",y.style.borderRadius="3px",y.style.minWidth="24px",y.style.textAlign="center",l.appendChild(y)),be(y,b)},c=fe({findElementsById:x,getSelectedElementId:()=>f,getSelectedOverlays:()=>u,positionOverlay:s,clearSelection:()=>{c.clearSelectedMarks(f),I(),f=null,g=null},createSelectionOverlays:(l,r)=>{l.forEach(d=>{let E=L(!0);document.body.appendChild(E),u.push(E),s(E,d,!0)}),f=r}}),S=()=>{c.clearSelectedMarks(f),I(),f=null,g=null},w=()=>{m.forEach(l=>{l&&l.parentNode&&l.remove()}),m=[],v=[]},I=()=>{u.forEach(l=>{l&&l.parentNode&&l.remove()}),u=[]},j=["p","h1","h2","h3","h4","h5","h6","span","a","label"],Y=l=>{let r=l,d=l.getBoundingClientRect(),E=j.includes(O(l).toLowerCase()),b=r.closest("[data-arr-variable-name]"),y=b?.dataset?.arrVariableName||null,M=b?.dataset?.arrIndex,H=M!=null?parseInt(M,10):null,R=r.dataset?.arrField||null,V=r.closest("[data-collection-id]"),dt=r.closest("[data-collection-item-field]"),ct=r.closest("[data-collection-item-id]");window.parent.postMessage({type:"element-selected",tagName:O(l),classes:z(l),visualSelectorId:_(l),content:E?r.innerText:void 0,dataSourceLocation:r.dataset.sourceLocation,isDynamicContent:r.dataset.dynamicContent==="true",linenumber:r.dataset.linenumber,filename:r.dataset.filename,position:{top:d.top,left:d.left,right:d.right,bottom:d.bottom,width:d.width,height:d.height,centerX:d.left+d.width/2,centerY:d.top+d.height/2},attributes:we(l,ne),isTextElement:E,staticArrayName:y,staticArrayIndex:H,staticArrayField:R,collectionId:V?.dataset?.collectionId||null,collectionItemField:dt?.dataset?.collectionItemField||null,collectionItemId:ct?.dataset?.collectionItemId||null},"*")},U=(l,r=!0)=>{let d=_(l);return I(),x(d||null).forEach(b=>{let y=L(!0);document.body.appendChild(y),u.push(y),s(y,b,!0)}),f=d||null,g=l,w(),r&&Y(l),u[0]},p=()=>{f=null,window.parent.postMessage({type:"unselect-element"},"*")},h=null,T=null,C=()=>{w(),h=null},D=l=>{let r=x(l);w(),r.forEach(d=>{let E=L(!1);document.body.appendChild(E),m.push(E),s(E,d)}),v=r,h=l},k=l=>{!o||i||c.isEditing()||T===null&&(T=requestAnimationFrame(()=>{if(T=null,a){C();return}let r=Me(l.clientX,l.clientY,f);if(!r){C();return}h!==r&&D(r)}))},Z=()=>{T!==null&&(cancelAnimationFrame(T),T=null),C()},ve=l=>{if(!o)return;let r=l.target;if(r.closest(`[${W}]`)||c.enabled&&r instanceof HTMLElement&&r.contentEditable==="true")return;if(c.isEditing()){l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),c.stopEditing();return}if(a){l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),window.parent.postMessage({type:"close-dropdowns"},"*");return}l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation();let d=oe(l.clientX,l.clientY);if(!d)return;let E=d,b=_(d);if(f===b&&E.dataset.selected==="true"&&c.enabled&&c.canEdit(E)){c.startEditing(E);return}c.stopEditing(),c.enabled&&c.markElementsSelected(x(b));let M=U(d);J.attachToOverlay(M,d)},nt=()=>{c.stopEditing(),S()},ot=(l,r)=>{let d=x(l);d.length!==0&&(Le(d,r),setTimeout(()=>{f===l&&u.forEach((E,b)=>{b<d.length&&s(E,d[b])}),v.length>0&&v[0]?.dataset?.visualSelectorId===l&&m.forEach((y,M)=>{M<v.length&&s(y,v[M])})},G))},rt=(l,r,d,E)=>{let b=x(l);if(b.length===0)return;let y=E??(f===l?g?.dataset.arrIndex:void 0);Te(b,r,d,y),setTimeout(()=>{if(f===l){let M=x(l);if(g&&!g.isConnected){let H=g.dataset.arrIndex,R=M.find(V=>V.dataset.arrIndex===H);if(R){let V=U(R,!1);J.attachToOverlay(V,R)}}u.forEach((H,R)=>{R<M.length&&s(H,M[R])})}},G)},it=(l,r,d)=>{let E=x(l);E.length!==0&&(d!=null&&(E=E.filter(b=>b.dataset.arrIndex===String(d))),E.forEach(b=>{b.innerText=r}),setTimeout(()=>{f===l&&u.forEach((b,y)=>{y<E.length&&s(b,E[y])})},G))},J=Ye({createPreviewOverlay:l=>{let r=L(!1);return r.style.zIndex="9998",document.body.appendChild(r),s(r,l),r},getSelectedElementId:()=>f,selectElement:U,onDeselect:p}),st=l=>{o=l,l?(document.body.style.cursor="crosshair",Ie(),document.addEventListener("mousemove",k),document.addEventListener("mouseleave",Z),document.addEventListener("click",ve,!0)):(e.disable(),Se(),c.stopEditing(),S(),J.cleanup(),Z(),document.body.style.cursor="default",document.removeEventListener("mousemove",k),document.removeEventListener("mouseleave",Z),document.removeEventListener("click",ve,!0))},ye=()=>{if(f){let l=g;if(l&&l.isConnected){let r=l.getBoundingClientRect(),d=window.innerHeight,E=window.innerWidth,b=r.top<d&&r.bottom>0&&r.left<E&&r.right>0,y={top:r.top,left:r.left,right:r.right,bottom:r.bottom,width:r.width,height:r.height,centerX:r.left+r.width/2,centerY:r.top+r.height/2};window.parent.postMessage({type:"element-position-update",position:y,isInViewport:b,visualSelectorId:f},"*")}}},lt=l=>{let r=l.data;switch(r.type){case"toggle-visual-edit-mode":st(r.data.enabled),r.data.specs?.newInlineEditEnabled!==void 0&&(c.enabled=r.data.specs.newInlineEditEnabled);break;case"update-classes":r.data&&r.data.classes!==void 0?ot(r.data.visualSelectorId,r.data.classes):console.warn("[VisualEditAgent] Invalid update-classes message:",r);break;case"update-attribute":r.data&&r.data.visualSelectorId&&r.data.attribute!==void 0&&r.data.value!==void 0?rt(r.data.visualSelectorId,r.data.attribute,r.data.value,r.data.arrIndex):console.warn("[VisualEditAgent] Invalid update-attribute message:",r);break;case"unselect-element":nt();break;case"refresh-page":window.location.reload();break;case"update-content":r.data&&r.data.content!==void 0?it(r.data.visualSelectorId,r.data.content,r.data.arrIndex):console.warn("[VisualEditAgent] Invalid update-content message:",r);break;case"request-element-position":if(f&&g&&g.isConnected){let d=g.getBoundingClientRect(),E=window.innerHeight,b=window.innerWidth,y=d.top<E&&d.bottom>0&&d.left<b&&d.right>0,M={top:d.top,left:d.left,right:d.right,bottom:d.bottom,width:d.width,height:d.height,centerX:d.left+d.width/2,centerY:d.top+d.height/2};window.parent.postMessage({type:"element-position-update",position:M,isInViewport:y,visualSelectorId:f},"*")}break;case"popover-drag-state":r.data&&r.data.isDragging!==void 0&&(i=r.data.isDragging,r.data.isDragging&&w());break;case"dropdown-state":r.data&&r.data.isOpen!==void 0&&(a=r.data.isOpen,r.data.isOpen&&w());break;case"update-theme-variables":if(r.data?.variables){let d=r.data.mode==="dark"?document.querySelector(".dark"):document.documentElement;if(d)for(let[E,b]of Object.entries(r.data.variables))d.style.setProperty(E,b)}break;case"inject-font-import":if(r.data?.fontUrl){let d=document.getElementById(me);d||(d=document.createElement("style"),d.id=me,document.head.appendChild(d)),d.textContent=`@import url('${r.data.fontUrl}');`}break;case"inject-font-face":r.data&&Ce(r.data.id,r.data.css);break;case"toggle-inline-edit-mode":r.data&&c.handleToggleMessage(r.data);break;case"freeze-vh-units":t.freezeVhUnits(typeof r.referenceVhBase=="number"?r.referenceVhBase:void 0);break;case"measure-page-height":t.measurePageHeight(l.origin&&l.origin!=="null"?l.origin:"*",typeof r.settleMs=="number"?r.settleMs:void 0);break;case"suppress-auto-popups":n.suppress();break;case"toggle-canvas-wheel-zoom-bridge":e.enable();break;default:break}},Q=()=>{if(f){let l=x(f);u.forEach((r,d)=>{d<l.length&&s(r,l[d])})}v.length>0&&m.forEach((l,r)=>{r<v.length&&s(l,v[r])})};document.querySelectorAll("[data-linenumber]:not([data-visual-selector-id])").forEach((l,r)=>{let d=l,E=`visual-id-${d.dataset.filename}-${d.dataset.linenumber}-${r}`;d.dataset.visualSelectorId=E});let at=new MutationObserver(l=>{l.some(d=>{let E=y=>{if(y.nodeType===Node.ELEMENT_NODE){let M=y;if(M.dataset&&M.dataset.visualSelectorId)return!0;for(let H=0;H<M.children.length;H++)if(E(M.children[H]))return!0}return!1};return d.type==="attributes"&&(d.attributeName==="style"||d.attributeName==="class"||d.attributeName==="width"||d.attributeName==="height")&&E(d.target)})&&setTimeout(Q,G)});window.addEventListener("message",lt),window.addEventListener("scroll",ye,!0),document.addEventListener("scroll",ye,!0),window.addEventListener("resize",Q),window.addEventListener("scroll",Q),at.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class","width","height"]}),window.parent.postMessage({type:"visual-edit-agent-ready"},"*")}export{Kt as setupVisualEditAgent};
|
|
15
|
+
`,document.head.appendChild(e)},ze=()=>{document.getElementById(de)?.remove()},Ke=e=>{let t=document.createRange();t.selectNodeContents(e);let n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)},It=e=>!(e instanceof HTMLElement)||!wt(e)?!1:ce(e)?!0:e.dataset.dynamicContent!=="true",ue=e=>!(e instanceof HTMLElement)||e.dataset.selected!=="true"?!1:It(e);var St=500;function fe(e){let t=null,n=null,o=!1,i=new WeakMap,a=()=>{let s=e.getSelectedElementId();if(!s)return;let c=e.findElementsById(s);e.getSelectedOverlays().forEach((w,I)=>{I<c.length&&c[I]&&e.positionOverlay(w,c[I])})},m=s=>{let c=s.dataset.originalTextContent,S=s.textContent,w=s.getBoundingClientRect(),I={type:"inline-edit",elementInfo:{tagName:s.tagName,classes:z(s),visualSelectorId:e.getSelectedElementId(),content:S,dataSourceLocation:s.dataset.sourceLocation,isDynamicContent:s.dataset.dynamicContent==="true",linenumber:s.dataset.linenumber,filename:s.dataset.filename,position:{top:w.top,left:w.left,right:w.right,bottom:w.bottom,width:w.width,height:w.height,centerX:w.left+w.width/2,centerY:w.top+w.height/2}},originalContent:c,newContent:S};ce(s)&&(I.arrIndex=s.dataset.arrIndex,I.arrVariableName=s.dataset.arrVariableName,I.arrField=s.dataset.arrField),window.parent.postMessage(I,"*"),s.dataset.originalTextContent=S||""},u=s=>{n&&clearTimeout(n),n=setTimeout(()=>m(s),St)},y=s=>{a(),u(s)},f=function(){y(this)},g=s=>{Ue(),s.dataset.originalTextContent=s.textContent||"",s.dataset.originalCursor=s.style.cursor,s.contentEditable="true",s.setAttribute(A,"true");let c=new AbortController;i.set(s,c),s.addEventListener("input",f,{signal:c.signal}),s.style.cursor="text",Ke(s),setTimeout(()=>{s.isConnected&&s.focus()},0)},L=s=>{let c=i.get(s);c&&(c.abort(),i.delete(s)),s.isConnected&&(ze(),s.contentEditable="false",s.removeAttribute(A),delete s.dataset.originalTextContent,s.dataset.originalCursor!==void 0&&(s.style.cursor=s.dataset.originalCursor,delete s.dataset.originalCursor))};return{get enabled(){return o},set enabled(s){o=s},isEditing(){return t!==null},getCurrentElement(){return t},canEdit(s){return ue(s)},startEditing(s){t=s,e.getSelectedOverlays().forEach(c=>{c.style.display="none"}),g(s),window.parent.postMessage({type:"content-editing-started",visualSelectorId:e.getSelectedElementId()},"*")},stopEditing(){if(!t)return;n&&(clearTimeout(n),n=null),L(t),e.getSelectedOverlays().forEach(c=>{c.style.display=""}),a(),window.parent.postMessage({type:"content-editing-ended",visualSelectorId:e.getSelectedElementId()},"*"),t=null},markElementsSelected(s){s.forEach(c=>{c instanceof HTMLElement&&(c.dataset.selected="true")})},clearSelectedMarks(s){s&&e.findElementsById(s).forEach(c=>{c instanceof HTMLElement&&delete c.dataset.selected})},handleToggleMessage(s){if(!o)return;let c=e.findElementsById(s.dataSourceLocation);if(c.length===0||!(c[0]instanceof HTMLElement))return;let S=c[0];if(s.inlineEditingMode){if(!ue(S))return;e.getSelectedElementId()!==s.dataSourceLocation&&(this.stopEditing(),e.clearSelection(),this.markElementsSelected(c),e.createSelectionOverlays(c,s.dataSourceLocation)),this.startEditing(S)}else t===S&&this.stopEditing()},cleanup(){this.stopEditing()}}}var me="__theme-font-preview";function Mt(e){return e instanceof Element?e:e instanceof Node?e.parentElement:null}function Ct(e){return Mt(e)?.closest(`[${A}]`)!=null}function qe(){let e=!1,t=i=>{if(Ct(i.target))return;if(i.preventDefault(),i.ctrlKey||i.metaKey){window.parent.postMessage({type:"canvas-wheel-zoom",data:{deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,metaKey:i.metaKey}},"*");return}let a={deltaX:i.deltaX,deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY,shiftKey:i.shiftKey,ctrlKey:!1,metaKey:!1};window.parent.postMessage({type:"canvas-wheel-pan",data:a},"*")};return{enable:()=>{e||(e=!0,window.addEventListener("wheel",t,{capture:!0,passive:!1}))},disable:()=>{e&&(e=!1,window.removeEventListener("wheel",t,!0))}}}var pe="--base44-reference-vh-base";function Ze(){let e=null,t=null,n,o,i="*",a=()=>{n!==void 0&&(window.clearTimeout(n),n=void 0),o!==void 0&&(window.clearTimeout(o),o=void 0)};return{freezeVhUnits:m=>{let u=At(m);if(_t(u),e){t?.();return}e=[],t=xt(e)},measurePageHeight:(m,u=2e3)=>{i=m,a(),n=window.setTimeout(()=>{n=void 0,t?.();let y=Ge()+1500,f=-1,g=0,L=c=>{o=void 0,window.parent.postMessage({type:"page-height-measured",height:c},i)},s=()=>{o=void 0;let c=Ht();if(c===f?g++:(g=1,f=c),g>=3||Ge()>=y){L(c);return}o=window.setTimeout(s,16)};s()},u)},teardown:()=>{if(e){for(let m of e)m();e=null,t=null}a()}}}function Ge(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function At(e){if(e!==void 0)return e;let t=window.innerHeight||0;return t>=400?t:900}function _t(e){document.documentElement.style.setProperty(pe,`${e}px`)}function xt(e){let t=/(\d+(?:\.\d+)?)(?:d|s|l)?vh\b/g,n=new WeakSet,o=new WeakMap,i=new WeakSet,a=new Set,m=new WeakSet,u=p=>p.replace(t,(h,T)=>`calc(var(${pe}) * ${Dt(T)})`),y=p=>{if(m.has(p))return;let T=window.getComputedStyle(p).overflowY;T!=="auto"&&T!=="scroll"||(m.add(p),p.style.setProperty("overflow-y","visible","important"))},f=p=>{y(p),p.querySelectorAll("*").forEach(y)},g=p=>{let h=p.style;if(!h||h.length===0)return;let T=[];for(let C=0;C<h.length;C++){let D=h[C];D&&T.push(D)}for(let C of T){let D=h.getPropertyValue(C);if(!D||D.indexOf("vh")===-1)continue;let k=u(D);k!==D&&h.setProperty(C,k,h.getPropertyPriority(C))}},s=Ft(()=>{document.querySelectorAll("style").forEach(p=>{if(S(p),n.has(p))return;n.add(p);let h=p.textContent;if(!h||h.indexOf("vh")===-1)return;let T=u(h);T!==h&&(p.textContent=T)});for(let p=0;p<document.styleSheets.length;p++){let h=document.styleSheets[p];if(!h)continue;let T;try{T=h.cssRules}catch{continue}o.get(h)!==T.length&&(Je(T,u),o.set(h,T.length))}document.querySelectorAll('[style*="vh"]').forEach(g),document.body&&f(document.body)},16),c=s.trigger;e.push(s.cancel);let S=p=>{if(i.has(p))return;i.add(p);let h=new MutationObserver(()=>{n.delete(p),c()});h.observe(p,{characterData:!0,childList:!0,subtree:!0}),a.add(h)};e.push(()=>{for(let p of a)p.disconnect();a.clear()}),c(),document.readyState==="loading"&&(document.addEventListener("DOMContentLoaded",c),e.push(()=>document.removeEventListener("DOMContentLoaded",c))),window.addEventListener("load",c),e.push(()=>window.removeEventListener("load",c));let w=new MutationObserver(p=>{for(let h of p)if(je(h.addedNodes)||je(h.removedNodes)){c();return}});e.push(()=>w.disconnect());let I=()=>{document.head&&w.observe(document.head,{childList:!0,subtree:!1})};document.head?I():(document.addEventListener("DOMContentLoaded",I),e.push(()=>document.removeEventListener("DOMContentLoaded",I)));let j=p=>{if(!(p instanceof Element))return;let h=p.getAttribute("style");h&&h.indexOf("vh")!==-1&&g(p),p.querySelectorAll('[style*="vh"]').forEach(g),f(p)},Y=new MutationObserver(p=>{for(let h of p)if(h.type==="attributes"){let T=h.target;if(!(T instanceof Element))continue;let C=T.getAttribute("style");if(!C||C.indexOf("vh")===-1)continue;g(T)}else if(h.type==="childList")for(let T=0;T<h.addedNodes.length;T++){let C=h.addedNodes[T];C&&j(C)}});return e.push(()=>Y.disconnect()),(()=>{let p=document.documentElement;p&&Y.observe(p,{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0})})(),c}function Dt(e){return String(Number((parseFloat(e)/100).toFixed(6)))}function Je(e,t){for(let n=0;n<e.length;n++){let o=e[n];if(!o)continue;o.cssRules&&Je(o.cssRules,t);let i=o.style;if(i)for(let a=0;a<i.length;a++){let m=i[a];if(!m)continue;let u=i.getPropertyValue(m);if(!u||u.indexOf("vh")===-1)continue;let y=t(u);y!==u&&i.setProperty(m,y,i.getPropertyPriority(m))}}}function je(e){for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof HTMLStyleElement||n instanceof HTMLLinkElement)return!0}return!1}function Ht(){let e=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0),t=Ot(),n=Math.max(window.innerHeight||0,document.documentElement.clientHeight,t),o=Nt(n);return o>0?Math.ceil(Math.max(o,t)):Math.ceil(Math.max(e,t))}function Ot(){let e=document.documentElement.style.getPropertyValue(pe),t=parseFloat(e);return Number.isFinite(t)?t:0}function Nt(e){if(!document.body)return 0;let t=[document.body,...Array.from(document.body.querySelectorAll("*"))],n=new WeakMap,o=window.scrollY+e;for(let i=t.length-1;i>=0;i--){let a=t[i];if(!a)continue;let m=Rt(a,n),u=Pt(a),y=Vt(u,m,e,o)?0:u.bottom;n.set(a,Math.max(m,y))}return n.get(document.body)??0}function Rt(e,t){let n=0;for(let o=0;o<e.children.length;o++){let i=e.children[o];i&&(n=Math.max(n,t.get(i)??0))}return n}function Pt(e){let t=window.getComputedStyle(e);if(kt(t))return{bottom:0,height:0};let n=e.getBoundingClientRect();return n.width===0&&n.height===0?{bottom:0,height:0}:{bottom:n.bottom+window.scrollY+Bt(t),height:n.height}}function Bt(e){let t=parseFloat(e.marginBottom);return Number.isFinite(t)?t:0}function kt(e){return e.position==="fixed"?!0:e.position==="absolute"&&e.pointerEvents==="none"}function Vt(e,t,n,o){return t>0&&Math.abs(e.bottom-o)<=1&&Math.abs(e.height-n)<=1&&e.bottom-t>8}function Ft(e,t){let n;return{trigger:()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(e,t)},cancel:()=>{n!==void 0&&(window.clearTimeout(n),n=void 0)}}}var P="data-base44-suppressed-popup",Wt="--base44-reference-vh-base";function et(){let e=null,t=null,n=!1,o=!1,i=(f,g)=>{if(!(f instanceof HTMLElement)||f.hasAttribute(P))return;let L=window.getComputedStyle(f);if(L.position==="fixed"&&he(L)){if(Yt(f,g)&&Ut(f,L)){a(f);return}o&&tt(f,g)&&ge(f)}},a=f=>{f.hasAttribute(P)||(ge(f),o=!0,$t(Ee()))},m=(f,g)=>{i(f,g);let L=f.querySelectorAll(`*:not([${P}])`);for(let s=0;s<L.length;s++){let c=L[s];c&&i(c,g)}},u=()=>{e||(e=new MutationObserver(f=>{let g=Ee();for(let L of f)if(L.type==="childList")for(let s=0;s<L.addedNodes.length;s++){let c=L.addedNodes[s];c instanceof Element&&m(c,g)}}),e.observe(document.documentElement,{childList:!0,subtree:!0}))},y=()=>{document.body&&(m(document.body,Ee()),u())};return{suppress:()=>{n||(n=!0,document.body?y():(t=()=>{t=null,y()},document.addEventListener("DOMContentLoaded",t)))},teardown:()=>{n=!1,o=!1,e&&(e.disconnect(),e=null),t&&(document.removeEventListener("DOMContentLoaded",t),t=null)}}}function $t(e){if(!document.body||e.vw<=0||e.vh<=0)return;let t=document.body.querySelectorAll(`*:not([${P}])`);for(let n=0;n<t.length;n++){let o=t[n];o&&Xt(o,e)&&ge(o)}}function Xt(e,t){if(e.hasAttribute(P))return!1;let n=window.getComputedStyle(e);return n.position!=="fixed"||!he(n)?!1:tt(e,t)}function Yt(e,t){if(t.vw<=0||t.vh<=0)return!1;let n=e.getBoundingClientRect();return n.width>=t.vw*.9&&n.height>=t.vh*.9}function tt(e,t){let n=e.getBoundingClientRect();return n.width>=t.vw*.15&&n.height>=t.vh*.15&&n.width<=t.vw*.95&&n.height<=t.vh*.95}function he(e){let t=parseInt(e.zIndex,10);return Number.isFinite(t)&&t>=40}function Ut(e,t){if(Qe(t.backgroundColor)||t.backdropFilter&&t.backdropFilter!=="none")return!0;let n=e.querySelectorAll("*");for(let o=0;o<n.length;o++){let i=n[o];if(!i)continue;let a=window.getComputedStyle(i);if(!(a.position!=="fixed"&&a.position!=="absolute")&&he(a)&&(Qe(a.backgroundColor)||a.backdropFilter&&a.backdropFilter!=="none"))return!0}return!1}function Qe(e){let t=zt(e);return t!==null&&t>0&&t<1}function zt(e){if(!e)return null;let t=/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*([0-9.]+)\s*)?\)$/.exec(e);if(t)return t[1]===void 0?1:parseFloat(t[1]);let n=/\/\s*([0-9.]+)(%?)\s*\)$/.exec(e);if(n){let o=parseFloat(n[1]);return n[2]==="%"?o/100:o}return/^[a-z]+\s*\(/.test(e)?1:null}function Ee(){let e=window.innerWidth||document.documentElement.clientWidth||0,t=document.documentElement.style.getPropertyValue(Wt),n=parseFloat(t),o=Number.isFinite(n)&&n>0?n:window.innerHeight||document.documentElement.clientHeight||0;return{vw:e,vh:o}}function ge(e){e.hasAttribute(P)||(e.setAttribute(P,"1"),e.style.setProperty("display","none","important"))}var G=50;function Kt(){let e=qe(),t=Ze(),n=et(),o=!1,i=!1,a=!1,m=[],u=[],y=[],f=null,g=null,L=(l=!1)=>{let r=document.createElement("div");return r.style.position="absolute",r.style.pointerEvents="none",r.style.transition="all 0.1s ease-in-out",r.style.zIndex="9999",l?r.style.border="2px solid #2563EB":(r.style.border="2px solid #95a5fc",r.style.backgroundColor="rgba(99, 102, 241, 0.05)"),r},s=(l,r,d=!1)=>{if(!r||!o)return;r.offsetWidth;let b=r.getBoundingClientRect();l.style.top=`${b.top+window.scrollY}px`,l.style.left=`${b.left+window.scrollX}px`,l.style.width=`${b.width}px`,l.style.height=`${b.height}px`;let v=l.querySelector("div");v||(v=document.createElement("div"),v.textContent=O(r).toLowerCase(),v.style.position="absolute",v.style.left="-2px",v.style.padding="2px 8px",v.style.fontSize="11px",v.style.fontWeight=d?"500":"400",v.style.color=d?"#ffffff":"#526cff",v.style.backgroundColor=d?"#2563EB":"#DBEAFE",v.style.borderRadius="3px",v.style.minWidth="24px",v.style.textAlign="center",l.appendChild(v)),be(v,b)},c=fe({findElementsById:x,getSelectedElementId:()=>f,getSelectedOverlays:()=>u,positionOverlay:s,clearSelection:()=>{c.clearSelectedMarks(f),I(),f=null,g=null},createSelectionOverlays:(l,r)=>{l.forEach(d=>{let E=L(!0);document.body.appendChild(E),u.push(E),s(E,d,!0)}),f=r}}),S=()=>{c.clearSelectedMarks(f),I(),f=null,g=null},w=()=>{m.forEach(l=>{l&&l.parentNode&&l.remove()}),m=[],y=[]},I=()=>{u.forEach(l=>{l&&l.parentNode&&l.remove()}),u=[]},j=["p","h1","h2","h3","h4","h5","h6","span","a","label"],Y=l=>{let r=l,d=l.getBoundingClientRect(),E=j.includes(O(l).toLowerCase()),b=r.closest("[data-arr-variable-name]"),v=b?.dataset?.arrVariableName||null,M=b?.dataset?.arrIndex,H=M!=null?parseInt(M,10):null,R=r.dataset?.arrField||null,V=r.closest("[data-collection-id]"),dt=r.closest("[data-collection-item-field]"),ct=r.closest("[data-collection-item-id]");window.parent.postMessage({type:"element-selected",tagName:O(l),classes:z(l),visualSelectorId:_(l),content:E?r.innerText:void 0,dataSourceLocation:r.dataset.sourceLocation,isDynamicContent:r.dataset.dynamicContent==="true",linenumber:r.dataset.linenumber,filename:r.dataset.filename,position:{top:d.top,left:d.left,right:d.right,bottom:d.bottom,width:d.width,height:d.height,centerX:d.left+d.width/2,centerY:d.top+d.height/2},attributes:we(l,ne),isTextElement:E,staticArrayName:v,staticArrayIndex:H,staticArrayField:R,collectionId:V?.dataset?.collectionId||null,collectionItemField:dt?.dataset?.collectionItemField||null,collectionItemId:ct?.dataset?.collectionItemId||null},"*")},U=(l,r=!0)=>{let d=_(l);return I(),x(d||null).forEach(b=>{let v=L(!0);document.body.appendChild(v),u.push(v),s(v,b,!0)}),f=d||null,g=l,w(),r&&Y(l),u[0]},p=()=>{f=null,window.parent.postMessage({type:"unselect-element"},"*")},h=null,T=null,C=()=>{w(),h=null},D=l=>{let r=x(l);w(),r.forEach(d=>{let E=L(!1);document.body.appendChild(E),m.push(E),s(E,d)}),y=r,h=l},k=l=>{!o||i||c.isEditing()||T===null&&(T=requestAnimationFrame(()=>{if(T=null,a){C();return}let r=Me(l.clientX,l.clientY,f);if(!r){C();return}h!==r&&D(r)}))},Z=()=>{T!==null&&(cancelAnimationFrame(T),T=null),C()},ye=l=>{if(!o)return;let r=l.target;if(r.closest(`[${W}]`)||c.enabled&&r instanceof HTMLElement&&r.contentEditable==="true")return;if(c.isEditing()){l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),c.stopEditing();return}if(a){l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),window.parent.postMessage({type:"close-dropdowns"},"*");return}l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation();let d=oe(l.clientX,l.clientY);if(!d)return;let E=d,b=_(d);if(f===b&&E.dataset.selected==="true"&&c.enabled&&c.canEdit(E)){c.startEditing(E);return}c.stopEditing(),c.enabled&&c.markElementsSelected(x(b));let M=U(d);J.attachToOverlay(M,d)},nt=()=>{c.stopEditing(),S()},ot=(l,r)=>{let d=x(l);d.length!==0&&(Le(d,r),setTimeout(()=>{f===l&&u.forEach((E,b)=>{b<d.length&&s(E,d[b])}),y.length>0&&y[0]?.dataset?.visualSelectorId===l&&m.forEach((v,M)=>{M<y.length&&s(v,y[M])})},G))},rt=(l,r,d,E)=>{let b=x(l);if(b.length===0)return;let v=E??(f===l?g?.dataset.arrIndex:void 0);Te(b,r,d,v),setTimeout(()=>{if(f===l){let M=x(l);if(g&&!g.isConnected){let H=g.dataset.arrIndex,R=M.find(V=>V.dataset.arrIndex===H);if(R){let V=U(R,!1);J.attachToOverlay(V,R)}}u.forEach((H,R)=>{R<M.length&&s(H,M[R])})}},G)},it=(l,r,d)=>{let E=x(l);E.length!==0&&(d!=null&&(E=E.filter(b=>b.dataset.arrIndex===String(d))),E.forEach(b=>{b.innerText=r}),setTimeout(()=>{f===l&&u.forEach((b,v)=>{v<E.length&&s(b,E[v])})},G))},J=Ye({createPreviewOverlay:l=>{let r=L(!1);return r.style.zIndex="9998",document.body.appendChild(r),s(r,l),r},getSelectedElementId:()=>f,selectElement:U,onDeselect:p}),st=l=>{o=l,l?(document.body.style.cursor="crosshair",Ie(),document.addEventListener("mousemove",k),document.addEventListener("mouseleave",Z),document.addEventListener("click",ye,!0)):(e.disable(),Se(),c.stopEditing(),S(),J.cleanup(),Z(),document.body.style.cursor="default",document.removeEventListener("mousemove",k),document.removeEventListener("mouseleave",Z),document.removeEventListener("click",ye,!0))},ve=()=>{if(f){let l=g;if(l&&l.isConnected){let r=l.getBoundingClientRect(),d=window.innerHeight,E=window.innerWidth,b=r.top<d&&r.bottom>0&&r.left<E&&r.right>0,v={top:r.top,left:r.left,right:r.right,bottom:r.bottom,width:r.width,height:r.height,centerX:r.left+r.width/2,centerY:r.top+r.height/2};window.parent.postMessage({type:"element-position-update",position:v,isInViewport:b,visualSelectorId:f},"*")}}},lt=l=>{let r=l.data;switch(r.type){case"toggle-visual-edit-mode":st(r.data.enabled),r.data.specs?.newInlineEditEnabled!==void 0&&(c.enabled=r.data.specs.newInlineEditEnabled);break;case"update-classes":r.data&&r.data.classes!==void 0?ot(r.data.visualSelectorId,r.data.classes):console.warn("[VisualEditAgent] Invalid update-classes message:",r);break;case"update-attribute":r.data&&r.data.visualSelectorId&&r.data.attribute!==void 0&&r.data.value!==void 0?rt(r.data.visualSelectorId,r.data.attribute,r.data.value,r.data.arrIndex):console.warn("[VisualEditAgent] Invalid update-attribute message:",r);break;case"unselect-element":nt();break;case"refresh-page":window.location.reload();break;case"update-content":r.data&&r.data.content!==void 0?it(r.data.visualSelectorId,r.data.content,r.data.arrIndex):console.warn("[VisualEditAgent] Invalid update-content message:",r);break;case"request-element-position":if(f&&g&&g.isConnected){let d=g.getBoundingClientRect(),E=window.innerHeight,b=window.innerWidth,v=d.top<E&&d.bottom>0&&d.left<b&&d.right>0,M={top:d.top,left:d.left,right:d.right,bottom:d.bottom,width:d.width,height:d.height,centerX:d.left+d.width/2,centerY:d.top+d.height/2};window.parent.postMessage({type:"element-position-update",position:M,isInViewport:v,visualSelectorId:f},"*")}break;case"popover-drag-state":r.data&&r.data.isDragging!==void 0&&(i=r.data.isDragging,r.data.isDragging&&w());break;case"dropdown-state":r.data&&r.data.isOpen!==void 0&&(a=r.data.isOpen,r.data.isOpen&&w());break;case"update-theme-variables":if(r.data?.variables){let d=r.data.mode==="dark"?document.querySelector(".dark"):document.documentElement;if(d)for(let[E,b]of Object.entries(r.data.variables))d.style.setProperty(E,b)}break;case"inject-font-import":if(r.data?.fontUrl){let d=document.getElementById(me);d||(d=document.createElement("style"),d.id=me,document.head.appendChild(d)),d.textContent=`@import url('${r.data.fontUrl}');`}break;case"inject-font-face":r.data&&Ce(r.data.id,r.data.css);break;case"toggle-inline-edit-mode":r.data&&c.handleToggleMessage(r.data);break;case"freeze-vh-units":t.freezeVhUnits(typeof r.referenceVhBase=="number"?r.referenceVhBase:void 0);break;case"measure-page-height":t.measurePageHeight(l.origin&&l.origin!=="null"?l.origin:"*",typeof r.settleMs=="number"?r.settleMs:void 0);break;case"suppress-auto-popups":n.suppress();break;case"toggle-canvas-wheel-zoom-bridge":e.enable();break;default:break}},Q=()=>{if(f){let l=x(f);u.forEach((r,d)=>{d<l.length&&s(r,l[d])})}y.length>0&&m.forEach((l,r)=>{r<y.length&&s(l,y[r])})};document.querySelectorAll("[data-linenumber]:not([data-visual-selector-id])").forEach((l,r)=>{let d=l,E=`visual-id-${d.dataset.filename}-${d.dataset.linenumber}-${r}`;d.dataset.visualSelectorId=E});let at=new MutationObserver(l=>{l.some(d=>{let E=v=>{if(v.nodeType===Node.ELEMENT_NODE){let M=v;if(M.dataset&&M.dataset.visualSelectorId)return!0;for(let H=0;H<M.children.length;H++)if(E(M.children[H]))return!0}return!1};return d.type==="attributes"&&(d.attributeName==="style"||d.attributeName==="class"||d.attributeName==="width"||d.attributeName==="height")&&E(d.target)})&&setTimeout(Q,G)});window.addEventListener("message",lt),window.addEventListener("scroll",ve,!0),document.addEventListener("scroll",ve,!0),window.addEventListener("resize",Q),window.addEventListener("scroll",Q),at.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["style","class","width","height"]}),window.parent.postMessage({type:"visual-edit-agent-ready"},"*")}export{Kt as setupVisualEditAgent};
|
|
16
16
|
//# sourceMappingURL=index.mjs.map
|