@perkyzz/emvb 1.0.0 → 1.2.0
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 +9 -0
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/package.json +10 -9
- package/src/admin/agents-api.ts +5 -1
- package/src/admin/bulk-api.ts +67 -0
- package/src/admin/content-api.ts +39 -6
- package/src/admin/copy-rich-text.ts +119 -0
- package/src/admin/dialog-tab-wrap.ts +78 -0
- package/src/admin/editor/A11yCopilot.tsx +2 -0
- package/src/admin/editor/Editor.tsx +24 -7
- package/src/admin/editor/ScheduleDialog.tsx +167 -0
- package/src/admin/editor/Timeline.tsx +6 -2
- package/src/admin/editor/TopBar.tsx +60 -8
- package/src/admin/editor/canvas/CanvasFrame.tsx +7 -2
- package/src/admin/editor/canvas/DeviceBar.tsx +22 -9
- package/src/admin/editor/canvas/canvas-scale.ts +3 -3
- package/src/admin/editor/canvas/use-canvas-session.ts +2 -2
- package/src/admin/editor/dnd/new-element.ts +68 -0
- package/src/admin/editor/editor-chrome.tsx +16 -5
- package/src/admin/editor/editor-commands.ts +10 -4
- package/src/admin/editor/editor-css.ts +2 -1
- package/src/admin/editor/element-chrome.ts +22 -0
- package/src/admin/editor/panels/ElementPanel.tsx +34 -17
- package/src/admin/editor/panels/SettingsPanel.tsx +2 -2
- package/src/admin/editor/panels/settings/DraftTextField.tsx +33 -1
- package/src/admin/editor/panels/settings/EffectsControls.tsx +79 -1
- package/src/admin/editor/panels/settings/FieldBindControl.tsx +6 -1
- package/src/admin/editor/panels/settings/FieldControl.tsx +10 -1
- package/src/admin/editor/panels/settings/IconControls.tsx +11 -0
- package/src/admin/editor/panels/settings/IconPicker.tsx +4 -1
- package/src/admin/editor/panels/settings/ItemList.tsx +36 -2
- package/src/admin/editor/panels/settings/LengthRow.tsx +36 -3
- package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +18 -0
- package/src/admin/editor/panels/settings/StyleRow.tsx +7 -0
- package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
- package/src/admin/editor/panels/settings/length-units.ts +15 -3
- package/src/admin/editor/panels/settings/style-sections.ts +1 -0
- package/src/admin/editor/panels/style-target.ts +17 -4
- package/src/admin/editor/section-templates.ts +26 -4
- package/src/admin/editor/store.ts +15 -3
- package/src/admin/editor/useEditorCommands.ts +7 -5
- package/src/admin/editor/useEditorData.ts +4 -0
- package/src/admin/editor/useNodeActions.ts +4 -2
- package/src/admin/editor/useSave.ts +47 -3
- package/src/admin/export-api.ts +238 -0
- package/src/admin/index.tsx +6 -1
- package/src/admin/menus-api.ts +113 -0
- package/src/admin/pages/ExportDialog.tsx +395 -0
- package/src/admin/pages/ImportElementorDialog.tsx +25 -1
- package/src/admin/pages/PageList.tsx +67 -2
- package/src/admin/pages/ThemePartList.tsx +37 -1
- package/src/admin/pages/bulk.tsx +303 -0
- package/src/admin/search.ts +20 -0
- package/src/admin/theme-api.ts +4 -0
- package/src/admin/ui.ts +11 -2
- package/src/admin/widgets/CanvasField.tsx +8 -0
- package/src/admin/widgets/ConvertToRichText.tsx +136 -0
- package/src/admin/widgets/ExportEntryHtml.tsx +92 -0
- package/src/admin/widgets/convert-body.ts +73 -2
- package/src/astro/EmVBPage.astro +3 -0
- package/src/astro/render.ts +47 -22
- package/src/astro/request-data.ts +3 -0
- package/src/astro/resolve-theme.ts +88 -51
- package/src/astro/tabs/runtime.ts +16 -6
- package/src/astro/visitor.ts +23 -4
- package/src/astro/widgets/EmVBAlertsRuntime.astro +8 -0
- package/src/astro/widgets/EmVBCarouselRuntime.astro +8 -0
- package/src/astro/widgets/EmVBLightboxRuntime.astro +8 -0
- package/src/astro/widgets/EmVBWidgetRuntimes.astro +19 -0
- package/src/astro/widgets/alerts.ts +37 -0
- package/src/astro/widgets/carousel.ts +167 -0
- package/src/astro/widgets/index.ts +1 -0
- package/src/astro/widgets/lightbox.ts +123 -0
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +103 -3
- package/src/core/arrange.ts +57 -1
- package/src/core/bounded-array.ts +16 -13
- package/src/core/contract.ts +26 -3
- package/src/core/css/generate.ts +83 -21
- package/src/core/css/scope.ts +10 -2
- package/src/core/css/trace.ts +33 -8
- package/src/core/design/classes.ts +25 -5
- package/src/core/design/devices.ts +78 -2
- package/src/core/design/variables.ts +14 -1
- package/src/core/elements/icon-svg.ts +135 -0
- package/src/core/elements/index.ts +33 -127
- package/src/core/elements/widgets.ts +907 -0
- package/src/core/export/runtimes.generated.ts +12 -0
- package/src/core/export/site.ts +579 -0
- package/src/core/export/zip.ts +95 -0
- package/src/core/extensions/schema.ts +2 -1
- package/src/core/geo-trust.ts +18 -0
- package/src/core/history/diff.ts +25 -0
- package/src/core/icons/social.generated.ts +29 -0
- package/src/core/image-edit/schema.ts +2 -1
- package/src/core/import/elementor/atomic.ts +22 -9
- package/src/core/import/elementor/context.ts +18 -0
- package/src/core/import/elementor/index.ts +72 -11
- package/src/core/import/elementor/style.ts +21 -1
- package/src/core/import/elementor/widgets.ts +394 -133
- package/src/core/index.ts +14 -0
- package/src/core/issue-cap.ts +19 -0
- package/src/core/json-schema.ts +8 -1
- package/src/core/limits.ts +6 -0
- package/src/core/loop-collections.ts +33 -0
- package/src/core/perf/meter.ts +37 -19
- package/src/core/portable-text-export.ts +243 -0
- package/src/core/proposals.ts +8 -2
- package/src/core/public-attributes.ts +30 -0
- package/src/core/render/index.ts +115 -13
- package/src/core/render/tabs.ts +18 -11
- package/src/core/render/vnode.ts +44 -6
- package/src/core/sanitize/css.ts +26 -0
- package/src/core/sanitize/svg-upload.ts +276 -23
- package/src/core/sanitize/svg.ts +3 -3
- package/src/core/schema/descriptors.ts +4 -0
- package/src/core/schema/design.ts +8 -7
- package/src/core/schema/layout.ts +406 -18
- package/src/core/schema/style.ts +49 -1
- package/src/core/search-text.ts +70 -0
- package/src/core/shadowing-ids.ts +41 -0
- package/src/core/theme/conditions.ts +2 -1
- package/src/core/theme/float.ts +1 -0
- package/src/core/theme/parse-doc.ts +10 -5
- package/src/core/theme/popup-rules.ts +16 -0
- package/src/core/theme/triggers.ts +3 -2
- package/src/core/validate.ts +3 -2
- package/src/index.ts +23 -2
- package/src/mcp/ports.ts +18 -7
- package/src/mcp/proposals.ts +36 -11
- package/src/mcp/read.ts +2 -3
- package/src/mcp/tools.ts +1 -1
- package/src/server/agent-settings.ts +12 -1
- package/src/server/hooks.ts +41 -6
- package/src/server/icon-routes.ts +52 -12
- package/src/server/mcp-routes.ts +11 -5
- package/src/server/plugin.ts +27 -2
- package/src/server/presence.ts +5 -1
- package/src/server/proposals.ts +16 -4
- package/src/server/requests.ts +60 -11
- package/src/server/site-origin.ts +13 -0
- package/src/server/targets.ts +26 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal ZIP writer for the HTML/CSS export (W-963): stored entries (no compression), so it
|
|
3
|
+
* needs no dependency and works the same in the admin and in tests. Every unzip tool reads it.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type ZipEntry = { path: string; data: Uint8Array | string };
|
|
7
|
+
|
|
8
|
+
const CRC_TABLE = (() => {
|
|
9
|
+
const table = new Uint32Array(256);
|
|
10
|
+
for (let n = 0; n < 256; n += 1) {
|
|
11
|
+
let c = n;
|
|
12
|
+
for (let k = 0; k < 8; k += 1) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
13
|
+
table[n] = c >>> 0;
|
|
14
|
+
}
|
|
15
|
+
return table;
|
|
16
|
+
})();
|
|
17
|
+
|
|
18
|
+
export function crc32(data: Uint8Array): number {
|
|
19
|
+
let crc = 0xffffffff;
|
|
20
|
+
for (const byte of data) crc = (CRC_TABLE[(crc ^ byte) & 0xff] ?? 0) ^ (crc >>> 8);
|
|
21
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Fixed DOS date/time (2026-01-01 00:00) so the same export gives the same bytes. */
|
|
25
|
+
const DOS_TIME = 0;
|
|
26
|
+
const DOS_DATE = ((2026 - 1980) << 9) | (1 << 5) | 1;
|
|
27
|
+
/** Bit 11: names are UTF-8. */
|
|
28
|
+
const FLAGS = 0x0800;
|
|
29
|
+
|
|
30
|
+
/** A safe relative entry path: no leading slash, no `..`, no backslashes, no empty segments. */
|
|
31
|
+
export function safeZipPath(path: string): boolean {
|
|
32
|
+
if (!path || path.length > 240 || path.startsWith("/") || path.includes("\\")) return false;
|
|
33
|
+
return path.split("/").every((part) => part !== "" && part !== "." && part !== "..");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The entries as one ZIP file. Throws on an unsafe or repeated path. */
|
|
37
|
+
export function zipFiles(entries: readonly ZipEntry[]): Uint8Array {
|
|
38
|
+
const encoder = new TextEncoder();
|
|
39
|
+
const seen = new Set<string>();
|
|
40
|
+
const chunks: Uint8Array[] = [];
|
|
41
|
+
const central: Uint8Array[] = [];
|
|
42
|
+
let offset = 0;
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
if (!safeZipPath(entry.path)) throw new Error(`Unsafe path in export: ${entry.path}`);
|
|
45
|
+
if (seen.has(entry.path)) throw new Error(`Repeated path in export: ${entry.path}`);
|
|
46
|
+
seen.add(entry.path);
|
|
47
|
+
const name = encoder.encode(entry.path);
|
|
48
|
+
const data = typeof entry.data === "string" ? encoder.encode(entry.data) : entry.data;
|
|
49
|
+
const crc = crc32(data);
|
|
50
|
+
const local = new DataView(new ArrayBuffer(30));
|
|
51
|
+
local.setUint32(0, 0x04034b50, true);
|
|
52
|
+
local.setUint16(4, 20, true);
|
|
53
|
+
local.setUint16(6, FLAGS, true);
|
|
54
|
+
local.setUint16(8, 0, true);
|
|
55
|
+
local.setUint16(10, DOS_TIME, true);
|
|
56
|
+
local.setUint16(12, DOS_DATE, true);
|
|
57
|
+
local.setUint32(14, crc, true);
|
|
58
|
+
local.setUint32(18, data.length, true);
|
|
59
|
+
local.setUint32(22, data.length, true);
|
|
60
|
+
local.setUint16(26, name.length, true);
|
|
61
|
+
local.setUint16(28, 0, true);
|
|
62
|
+
chunks.push(new Uint8Array(local.buffer), name, data);
|
|
63
|
+
|
|
64
|
+
const head = new DataView(new ArrayBuffer(46));
|
|
65
|
+
head.setUint32(0, 0x02014b50, true);
|
|
66
|
+
head.setUint16(4, 20, true);
|
|
67
|
+
head.setUint16(6, 20, true);
|
|
68
|
+
head.setUint16(8, FLAGS, true);
|
|
69
|
+
head.setUint16(10, 0, true);
|
|
70
|
+
head.setUint16(12, DOS_TIME, true);
|
|
71
|
+
head.setUint16(14, DOS_DATE, true);
|
|
72
|
+
head.setUint32(16, crc, true);
|
|
73
|
+
head.setUint32(20, data.length, true);
|
|
74
|
+
head.setUint32(24, data.length, true);
|
|
75
|
+
head.setUint16(28, name.length, true);
|
|
76
|
+
head.setUint32(42, offset, true);
|
|
77
|
+
central.push(new Uint8Array(head.buffer), name);
|
|
78
|
+
offset += 30 + name.length + data.length;
|
|
79
|
+
}
|
|
80
|
+
const centralSize = central.reduce((sum, part) => sum + part.length, 0);
|
|
81
|
+
const end = new DataView(new ArrayBuffer(22));
|
|
82
|
+
end.setUint32(0, 0x06054b50, true);
|
|
83
|
+
end.setUint16(8, entries.length, true);
|
|
84
|
+
end.setUint16(10, entries.length, true);
|
|
85
|
+
end.setUint32(12, centralSize, true);
|
|
86
|
+
end.setUint32(16, offset, true);
|
|
87
|
+
const parts = [...chunks, ...central, new Uint8Array(end.buffer)];
|
|
88
|
+
const out = new Uint8Array(parts.reduce((sum, part) => sum + part.length, 0));
|
|
89
|
+
let at = 0;
|
|
90
|
+
for (const part of parts) {
|
|
91
|
+
out.set(part, at);
|
|
92
|
+
at += part.length;
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { boundedArray } from "../bounded-array.ts";
|
|
1
2
|
/**
|
|
2
3
|
* Compile an extension's declarative prop schema into Zod, with EmVB limits on top
|
|
3
4
|
* (W-927). Extensions never pass us a Zod instance — only ExtensionPropSchema.
|
|
@@ -55,7 +56,7 @@ function compileAt(schema: ExtensionPropSchema, depth: number): z.ZodType {
|
|
|
55
56
|
}
|
|
56
57
|
case "array": {
|
|
57
58
|
const maxItems = Math.min(schema.maxItems ?? EXT_MAX_ARRAY, EXT_MAX_ARRAY);
|
|
58
|
-
const a =
|
|
59
|
+
const a = boundedArray(compileAt(schema.items, depth + 1), maxItems);
|
|
59
60
|
return schema.default !== undefined ? a.default([...schema.default]) : a;
|
|
60
61
|
}
|
|
61
62
|
case "object": {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S-10 (W-999): whether country headers are the edge's or could be the visitor's own. Set from
|
|
3
|
+
* `emvb({ trustGeoHeaders })` when the plugin starts; read when a page with Visitors rules
|
|
4
|
+
* renders. Kept on globalThis because the plugin and the page renderer can load this module
|
|
5
|
+
* twice (EmDash's runtime and Astro's SSR graph).
|
|
6
|
+
*/
|
|
7
|
+
const KEY = Symbol.for("emvb.trustGeoHeaders");
|
|
8
|
+
|
|
9
|
+
type Holder = { [KEY]?: boolean };
|
|
10
|
+
|
|
11
|
+
/** `true` trusts every country header, `false` none; anything else means "detect the edge". */
|
|
12
|
+
export function setGeoTrust(value: unknown): void {
|
|
13
|
+
(globalThis as Holder)[KEY] = typeof value === "boolean" ? value : undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function geoTrust(): boolean | undefined {
|
|
17
|
+
return (globalThis as Holder)[KEY];
|
|
18
|
+
}
|
package/src/core/history/diff.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type SectionChange = {
|
|
|
11
11
|
kind: "added" | "removed" | "changed" | "moved" | "same";
|
|
12
12
|
/** Elements inside that differ (added, removed or edited), for changed sections. */
|
|
13
13
|
edits: number;
|
|
14
|
+
/** W-973: the page itself (its root's styles, classes and settings), not a section. */
|
|
15
|
+
page?: true;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -68,6 +70,18 @@ export function diffSections(older: Layout, current: Layout): SectionChange[] {
|
|
|
68
70
|
const beforeIds = new Map(before.map((node, i) => [node.id, i]));
|
|
69
71
|
const afterIds = new Set(after.map((node) => node.id));
|
|
70
72
|
const changes: SectionChange[] = [];
|
|
73
|
+
// W-973: the page's own styles (the root's style, devices, states, classes…) are listed first;
|
|
74
|
+
// a version that only changed those used to read as "no changes".
|
|
75
|
+
if (older.root.id === current.root.id && own(older.root) !== own(current.root)) {
|
|
76
|
+
changes.push({
|
|
77
|
+
id: current.root.id,
|
|
78
|
+
type: "container",
|
|
79
|
+
label: "Page styles",
|
|
80
|
+
kind: "changed",
|
|
81
|
+
edits: 1,
|
|
82
|
+
page: true,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
71
85
|
const removedAt = new Map<number, LayoutNode[]>();
|
|
72
86
|
for (const [i, node] of before.entries()) {
|
|
73
87
|
if (!afterIds.has(node.id)) removedAt.set(i, [...(removedAt.get(i) ?? []), node]);
|
|
@@ -149,6 +163,17 @@ export function restoreSection(
|
|
|
149
163
|
older: Layout,
|
|
150
164
|
sectionId: string,
|
|
151
165
|
): { ok: true; layout: Layout } | { ok: false; reason: string } {
|
|
166
|
+
// W-973: the page's own styles come back without touching its sections.
|
|
167
|
+
if (sectionId === older.root.id && sectionId === current.root.id) {
|
|
168
|
+
const { children: _old, ...settings } = older.root;
|
|
169
|
+
return {
|
|
170
|
+
ok: true,
|
|
171
|
+
layout: {
|
|
172
|
+
...current,
|
|
173
|
+
root: { ...structuredClone(settings), children: current.root.children },
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
152
177
|
const oldIndex = older.root.children.findIndex((n) => n.id === sectionId);
|
|
153
178
|
const section = older.root.children[oldIndex];
|
|
154
179
|
if (!section) return { ok: false, reason: "That section isn't in this version." };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated by scripts/build-social-icons.ts (W-1024). Do not edit; run the script.
|
|
2
|
+
// Font Awesome Free by Fonticons, Inc., CC BY 4.0 (THIRD_PARTY_NOTICES.md). Brand icons are
|
|
3
|
+
// trademarks of their owners.
|
|
4
|
+
|
|
5
|
+
/** Each Social icons preset's SVG: its viewBox and the shapes inside. */
|
|
6
|
+
export const SOCIAL_ICONS = {
|
|
7
|
+
facebook: { viewBox: "0 0 512 512", body: "<path d=\"M512 256C512 114.6 397.4 0 256 0S0 114.6 0 256C0 376 82.7 476.8 194.2 504.5l0-170.3-52.8 0 0-78.2 52.8 0 0-33.7c0-87.1 39.4-127.5 125-127.5 16.2 0 44.2 3.2 55.7 6.4l0 70.8c-6-.6-16.5-1-29.6-1-42 0-58.2 15.9-58.2 57.2l0 27.8 83.6 0-14.4 78.2-69.3 0 0 175.9C413.8 494.8 512 386.9 512 256z\"/>" },
|
|
8
|
+
instagram: { viewBox: "0 0 448 512", body: "<path d=\"M224.3 141a115 115 0 1 0 -.6 230 115 115 0 1 0 .6-230zm-.6 40.4a74.6 74.6 0 1 1 .6 149.2 74.6 74.6 0 1 1 -.6-149.2zm93.4-45.1a26.8 26.8 0 1 1 53.6 0 26.8 26.8 0 1 1 -53.6 0zm129.7 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM399 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z\"/>" },
|
|
9
|
+
x: { viewBox: "0 0 448 512", body: "<path d=\"M357.2 48L427.8 48 273.6 224.2 455 464 313 464 201.7 318.6 74.5 464 3.8 464 168.7 275.5-5.2 48 140.4 48 240.9 180.9 357.2 48zM332.4 421.8l39.1 0-252.4-333.8-42 0 255.3 333.8z\"/>" },
|
|
10
|
+
linkedin: { viewBox: "0 0 448 512", body: "<path d=\"M416 32L31.9 32C14.3 32 0 46.5 0 64.3L0 447.7C0 465.5 14.3 480 31.9 480L416 480c17.6 0 32-14.5 32-32.3l0-383.4C448 46.5 433.6 32 416 32zM135.4 416l-66.4 0 0-213.8 66.5 0 0 213.8-.1 0zM102.2 96a38.5 38.5 0 1 1 0 77 38.5 38.5 0 1 1 0-77zM384.3 416l-66.4 0 0-104c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9l0 105.8-66.4 0 0-213.8 63.7 0 0 29.2 .9 0c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9l0 117.2z\"/>" },
|
|
11
|
+
youtube: { viewBox: "0 0 576 512", body: "<path d=\"M549.7 124.1C543.5 100.4 524.9 81.8 501.4 75.5 458.9 64 288.1 64 288.1 64S117.3 64 74.7 75.5C51.2 81.8 32.7 100.4 26.4 124.1 15 167 15 256.4 15 256.4s0 89.4 11.4 132.3c6.3 23.6 24.8 41.5 48.3 47.8 42.6 11.5 213.4 11.5 213.4 11.5s170.8 0 213.4-11.5c23.5-6.3 42-24.2 48.3-47.8 11.4-42.9 11.4-132.3 11.4-132.3s0-89.4-11.4-132.3zM232.2 337.6l0-162.4 142.7 81.2-142.7 81.2z\"/>" },
|
|
12
|
+
tiktok: { viewBox: "0 0 448 512", body: "<path d=\"M448.5 209.9c-44 .1-87-13.6-122.8-39.2l0 178.7c0 33.1-10.1 65.4-29 92.6s-45.6 48-76.6 59.6-64.8 13.5-96.9 5.3-60.9-25.9-82.7-50.8-35.3-56-39-88.9 2.9-66.1 18.6-95.2 40-52.7 69.6-67.7 62.9-20.5 95.7-16l0 89.9c-15-4.7-31.1-4.6-46 .4s-27.9 14.6-37 27.3-14 28.1-13.9 43.9 5.2 31 14.5 43.7 22.4 22.1 37.4 26.9 31.1 4.8 46-.1 28-14.4 37.2-27.1 14.2-28.1 14.2-43.8l0-349.4 88 0c-.1 7.4 .6 14.9 1.9 22.2 3.1 16.3 9.4 31.9 18.7 45.7s21.3 25.6 35.2 34.6c19.9 13.1 43.2 20.1 67 20.1l0 87.4z\"/>" },
|
|
13
|
+
bluesky: { viewBox: "0 0 576 512", body: "<path d=\"M407.8 294.7c-3.3-.4-6.7-.8-10-1.3 3.4 .4 6.7 .9 10 1.3zM288 227.1C261.9 176.4 190.9 81.9 124.9 35.3 61.6-9.4 37.5-1.7 21.6 5.5 3.3 13.8 0 41.9 0 58.4S9.1 194 15 213.9c19.5 65.7 89.1 87.9 153.2 80.7 3.3-.5 6.6-.9 10-1.4-3.3 .5-6.6 1-10 1.4-93.9 14-177.3 48.2-67.9 169.9 120.3 124.6 164.8-26.7 187.7-103.4 22.9 76.7 49.2 222.5 185.6 103.4 102.4-103.4 28.1-156-65.8-169.9-3.3-.4-6.7-.8-10-1.3 3.4 .4 6.7 .9 10 1.3 64.1 7.1 133.6-15.1 153.2-80.7 5.9-19.9 15-138.9 15-155.5s-3.3-44.7-21.6-52.9c-15.8-7.1-40-14.9-103.2 29.8-66.1 46.6-137.1 141.1-163.2 191.8z\"/>" },
|
|
14
|
+
mastodon: { viewBox: "0 0 448 512", body: "<path d=\"M433 179.1c0-97.2-63.7-125.7-63.7-125.7-62.5-28.7-228.6-28.4-290.5 0 0 0-63.7 28.5-63.7 125.7 0 115.7-6.6 259.4 105.6 289.1 40.5 10.7 75.3 13 103.3 11.4 50.8-2.8 79.3-18.1 79.3-18.1l-1.7-36.9s-36.3 11.4-77.1 10.1c-40.4-1.4-83-4.4-89.6-54-.6-4.6-.9-9.3-.9-13.9 85.6 20.9 158.7 9.1 178.7 6.7 56.1-6.7 105-41.3 111.2-72.9 9.8-49.8 9-121.5 9-121.5zM357.9 304.3l-46.6 0 0-114.2c0-49.7-64-51.6-64 6.9l0 62.5-46.3 0 0-62.5c0-58.5-64-56.6-64-6.9l0 114.2-46.7 0c0-122.1-5.2-147.9 18.4-175 25.9-28.9 79.8-30.8 103.8 6.1l11.6 19.5 11.6-19.5c24.1-37.1 78.1-34.8 103.8-6.1 23.7 27.3 18.4 53 18.4 175l0 0z\"/>" },
|
|
15
|
+
threads: { viewBox: "0 0 448 512", body: "<path d=\"M340.8 238c-.6-69.6-38.3-111.5-102-111.5-42.5 0-78.3 19.2-97.1 49.9l41.2 28.7c10.7-16.8 25.4-30.8 52.4-30.8 30.5 0 46.3 17 50.8 48.5-14.7-2.3-29.5-3.5-44.6-3.5-82.4 0-121.1 37.3-121.1 86.6s38.8 79.7 95.9 79.7c62.7 0 100.1-42.2 115.4-94.5 15.9 7.2 26.9 24 26.9 49.3 0 67.6-78 104.5-144.1 104.5-97.5 0-161.3-64-161.3-168.2 0-127.6 84.3-209.4 197.6-209.4 76 0 113.6 33.4 139.2 78.1L432 115.9c-27.8-58-89.9-99.5-183.1-99.5-148.5 0-249.5 105.4-249.5 258.2 0 139.8 98.9 220.9 216.7 220.9 97.4 0 195.8-56.8 195.8-154 0-50.8-29.2-84.5-71.2-103.5zM214.4 334.9c-21.5 0-40.4-10.2-40.4-29 0-29.6 36.4-38.6 72-38.6 13.5 0 26.8 .9 38.5 3.5-8.4 38.5-33.4 64.2-70 64.2l0 0z\"/>" },
|
|
16
|
+
github: { viewBox: "0 0 512 512", body: "<path d=\"M216.5 362.5c-66-8-112.5-55.5-112.5-117 0-25 9-52 24-70-6.5-16.5-5.5-51.5 2-66 20-2.5 47 8 63 22.5 19-6 39-9 63.5-9s44.5 3 62.5 8.5c15.5-14 43-24.5 63-22 7 13.5 8 48.5 1.5 65.5 16 19 24.5 44.5 24.5 70.5 0 61.5-46.5 108-113.5 116.5 17 11 28.5 35 28.5 62.5l0 52C323 491.5 335.5 500 350.5 494 441 459.5 512 369 512 257 512 115.5 397 0 255.5 0S0 115.5 0 257c0 111 70.5 203 165.5 237.5 13.5 5 26.5-4 26.5-17.5l0-40c-7 3-16 5-24 5-33 0-52.5-18-66.5-51.5-5.5-13.5-11.5-21.5-23-23-6-.5-8-3-8-6 0-6 10-10.5 20-10.5 14.5 0 27 9 40 27.5 10 14.5 20.5 21 33 21s20.5-4.5 32-16c8.5-8.5 15-16 21-21z\"/>" },
|
|
17
|
+
pinterest: { viewBox: "0 0 512 512", body: "<path d=\"M504 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3 .8-3.4 5-20.3 6.9-28.1 .6-2.5 .3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2C161.5 437.2 163.5 467.4 165.6 487 73.4 450.9 8 361.1 8 256 8 119 119 8 256 8S504 119 504 256z\"/>" },
|
|
18
|
+
whatsapp: { viewBox: "0 0 448 512", body: "<path d=\"M380.9 97.1c-41.9-42-97.7-65.1-157-65.1-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480 117.7 449.1c32.4 17.7 68.9 27 106.1 27l.1 0c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3 18.6-68.1-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1s56.2 81.2 56.1 130.5c0 101.8-84.9 184.6-186.6 184.6zM325.1 300.5c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8s-14.3 18-17.6 21.8c-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7 .9-6.9-.5-9.7s-12.5-30.1-17.1-41.2c-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2s-9.7 1.4-14.8 6.9c-5.1 5.6-19.4 19-19.4 46.3s19.9 53.7 22.6 57.4c2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4s4.6-24.1 3.2-26.4c-1.3-2.5-5-3.9-10.5-6.6z\"/>" },
|
|
19
|
+
discord: { viewBox: "0 0 576 512", body: "<path d=\"M492.5 69.8c-.2-.3-.4-.6-.8-.7-38.1-17.5-78.4-30-119.7-37.1-.4-.1-.8 0-1.1 .1s-.6 .4-.8 .8c-5.5 9.9-10.5 20.2-14.9 30.6-44.6-6.8-89.9-6.8-134.4 0-4.5-10.5-9.5-20.7-15.1-30.6-.2-.3-.5-.6-.8-.8s-.7-.2-1.1-.2c-41.3 7.1-81.6 19.6-119.7 37.1-.3 .1-.6 .4-.8 .7-76.2 113.8-97.1 224.9-86.9 334.5 0 .3 .1 .5 .2 .8s.3 .4 .5 .6c44.4 32.9 94 58 146.8 74.2 .4 .1 .8 .1 1.1 0s.7-.4 .9-.7c11.3-15.4 21.4-31.8 30-48.8 .1-.2 .2-.5 .2-.8s0-.5-.1-.8-.2-.5-.4-.6-.4-.3-.7-.4c-15.8-6.1-31.2-13.4-45.9-21.9-.3-.2-.5-.4-.7-.6s-.3-.6-.3-.9 0-.6 .2-.9 .3-.5 .6-.7c3.1-2.3 6.2-4.7 9.1-7.1 .3-.2 .6-.4 .9-.4s.7 0 1 .1c96.2 43.9 200.4 43.9 295.5 0 .3-.1 .7-.2 1-.2s.7 .2 .9 .4c2.9 2.4 6 4.9 9.1 7.2 .2 .2 .4 .4 .6 .7s.2 .6 .2 .9-.1 .6-.3 .9-.4 .5-.6 .6c-14.7 8.6-30 15.9-45.9 21.8-.2 .1-.5 .2-.7 .4s-.3 .4-.4 .7-.1 .5-.1 .8 .1 .5 .2 .8c8.8 17 18.8 33.3 30 48.8 .2 .3 .6 .6 .9 .7s.8 .1 1.1 0c52.9-16.2 102.6-41.3 147.1-74.2 .2-.2 .4-.4 .5-.6s.2-.5 .2-.8c12.3-126.8-20.5-236.9-86.9-334.5zm-302 267.7c-29 0-52.8-26.6-52.8-59.2s23.4-59.2 52.8-59.2c29.7 0 53.3 26.8 52.8 59.2 0 32.7-23.4 59.2-52.8 59.2zm195.4 0c-29 0-52.8-26.6-52.8-59.2s23.4-59.2 52.8-59.2c29.7 0 53.3 26.8 52.8 59.2 0 32.7-23.2 59.2-52.8 59.2z\"/>" },
|
|
20
|
+
twitch: { viewBox: "0 0 448 512", body: "<path d=\"M359.4 103.5l-38.6 0 0 109.7 38.6 0 0-109.7zM253.2 103l-38.6 0 0 109.8 38.6 0 0-109.8zM89 0l-96.5 91.4 0 329.2 115.8 0 0 91.4 96.5-91.4 77.3 0 173.8-164.6 0-256-366.9 0zM417.3 237.8l-77.2 73.1-77.2 0-67.6 64 0-64-86.9 0 0-274.3 308.9 0 0 201.2z\"/>" },
|
|
21
|
+
reddit: { viewBox: "0 0 512 512", body: "<path d=\"M0 256C0 114.6 114.6 0 256 0S512 114.6 512 256 397.4 512 256 512L37.1 512c-13.7 0-20.5-16.5-10.9-26.2L75 437C28.7 390.7 0 326.7 0 256zM349.6 153.6c23.6 0 42.7-19.1 42.7-42.7s-19.1-42.7-42.7-42.7c-20.6 0-37.8 14.6-41.8 34-34.5 3.7-61.4 33-61.4 68.4l0 .2c-37.5 1.6-71.8 12.3-99 29.1-10.1-7.8-22.8-12.5-36.5-12.5-33 0-59.8 26.8-59.8 59.8 0 24 14.1 44.6 34.4 54.1 2 69.4 77.6 125.2 170.6 125.2s168.7-55.9 170.6-125.3c20.2-9.6 34.1-30.2 34.1-54 0-33-26.8-59.8-59.8-59.8-13.7 0-26.3 4.6-36.4 12.4-27.4-17-62.1-27.7-100-29.1l0-.2c0-25.4 18.9-46.5 43.4-49.9 4.4 18.8 21.3 32.8 41.5 32.8l.1 .2zM177.1 246.9c16.7 0 29.5 17.6 28.5 39.3s-13.5 29.6-30.3 29.6-31.4-8.8-30.4-30.5 15.4-38.3 32.1-38.3l.1-.1zm190.1 38.3c1 21.7-13.7 30.5-30.4 30.5s-29.3-7.9-30.3-29.6 11.8-39.3 28.5-39.3 31.2 16.6 32.1 38.3l.1 .1zm-48.1 56.7c-10.3 24.6-34.6 41.9-63 41.9s-52.7-17.3-63-41.9c-1.2-2.9 .8-6.2 3.9-6.5 18.4-1.9 38.3-2.9 59.1-2.9s40.7 1 59.1 2.9c3.1 .3 5.1 3.6 3.9 6.5z\"/>" },
|
|
22
|
+
dribbble: { viewBox: "0 0 512 512", body: "<path d=\"M256 8a248 248 0 1 0 0 496 248 248 0 1 0 0-496zM420 122.4c29.5 36 47.4 82 47.8 132-7-1.5-77-15.7-147.5-6.8-5.8-14-11.2-26.4-18.6-41.6 78.3-32 113.8-77.5 118.3-83.5zM396.4 97.9c-3.8 5.4-35.7 48.3-111 76.5-34.7-63.8-73.2-116.2-79-124 67.2-16.2 138 1.3 190.1 47.5zM165.9 64.6c5.6 7.7 43.4 60.1 78.5 122.5-99.1 26.3-186.4 25.9-195.8 25.8 13.7-65.7 58-120.4 117.3-148.3zM44.2 256.3c0-2.2 0-4.3 .1-6.5 9.3 .2 111.9 1.5 217.7-30.1 6.1 11.9 11.9 23.9 17.2 35.9-76.6 21.6-146.2 83.5-180.5 142.3-33.8-37.6-54.5-87.2-54.5-141.6zM126 423.4c22.1-45.2 82.2-103.6 167.6-132.8 29.7 77.3 42 142.1 45.2 160.6-68.1 29-150 21.1-212.8-27.9zm248.4 8.5c-2.2-12.9-13.4-74.9-41.2-151 66.4-10.6 124.7 6.8 131.9 9.1-9.4 58.9-43.3 109.8-90.8 142z\"/>" },
|
|
23
|
+
behance: { viewBox: "0 0 576 512", body: "<path d=\"M232 237.2c31.8-15.2 48.4-38.2 48.4-74 0-70.6-52.6-87.8-113.3-87.8l-167.1 0 0 354.4 171.8 0c64.4 0 124.9-30.9 124.9-102.9 0-44.5-21.1-77.4-64.7-89.7zM77.9 135.9l73.1 0c28.1 0 53.4 7.9 53.4 40.5 0 30.1-19.7 42.2-47.5 42.2l-79 0 0-82.7zm83.3 233.7l-83.3 0 0-97.6 84.9 0c34.3 0 56 14.3 56 50.6 0 35.8-25.9 47-57.6 47zM519.7 128.9l-143.7 0 0-34.9 143.7 0 0 34.9zM576 305.2c0-75.9-44.4-139.2-124.9-139.2-78.2 0-131.3 58.8-131.3 135.8 0 79.9 50.3 134.7 131.3 134.7 61.3 0 101-27.6 120.1-86.3l-62.2 0c-6.7 21.9-34.3 33.5-55.7 33.5-41.3 0-63-24.2-63-65.3l185.1 0c.3-4.2 .6-8.7 .6-13.2zM390.4 274c2.3-33.7 24.7-54.8 58.5-54.8 35.4 0 53.2 20.8 56.2 54.8l-114.7 0z\"/>" },
|
|
24
|
+
telegram: { viewBox: "0 0 512 512", body: "<path d=\"M256 8a248 248 0 1 0 0 496 248 248 0 1 0 0-496zM371 176.7c-3.7 39.2-19.9 134.4-28.1 178.3-3.5 18.6-10.3 24.8-16.9 25.4-14.4 1.3-25.3-9.5-39.3-18.7-21.8-14.3-34.2-23.2-55.3-37.2-24.5-16.1-8.6-25 5.3-39.5 3.7-3.8 67.1-61.5 68.3-66.7 .2-.7 .3-3.1-1.2-4.4s-3.6-.8-5.1-.5c-2.2 .5-37.1 23.5-104.6 69.1-9.9 6.8-18.9 10.1-26.9 9.9-8.9-.2-25.9-5-38.6-9.1-15.5-5-27.9-7.7-26.8-16.3 .6-4.5 6.7-9 18.4-13.7 72.3-31.5 120.5-52.3 144.6-62.3 68.9-28.6 83.2-33.6 92.5-33.8 2.1 0 6.6 .5 9.6 2.9 2 1.7 3.2 4.1 3.5 6.7 .5 3.2 .6 6.5 .4 9.8z\"/>" },
|
|
25
|
+
spotify: { viewBox: "0 0 512 512", body: "<path d=\"M256 8a248 248 0 1 0 0 496 248 248 0 1 0 0-496zM356.7 372.9c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4zm26.9-65.6c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm31-76.2c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3z\"/>" },
|
|
26
|
+
email: { viewBox: "0 0 512 512", body: "<path d=\"M48 64c-26.5 0-48 21.5-48 48 0 15.1 7.1 29.3 19.2 38.4l208 156c17.1 12.8 40.5 12.8 57.6 0l208-156c12.1-9.1 19.2-23.3 19.2-38.4 0-26.5-21.5-48-48-48L48 64zM0 196L0 384c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-188-198.4 148.8c-34.1 25.6-81.1 25.6-115.2 0L0 196z\"/>" },
|
|
27
|
+
rss: { viewBox: "0 0 448 512", body: "<path d=\"M0 64c0-17.7 14.3-32 32-32 229.8 0 416 186.2 416 416 0 17.7-14.3 32-32 32s-32-14.3-32-32C384 253.6 226.4 96 32 96 14.3 96 0 81.7 0 64zM0 416a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zM32 160c159.1 0 288 128.9 288 288 0 17.7-14.3 32-32 32s-32-14.3-32-32c0-123.7-100.3-224-224-224-17.7 0-32-14.3-32-32s14.3-32 32-32z\"/>" },
|
|
28
|
+
website: { viewBox: "0 0 512 512", body: "<path d=\"M351.9 280l-190.9 0c2.9 64.5 17.2 123.9 37.5 167.4 11.4 24.5 23.7 41.8 35.1 52.4 11.2 10.5 18.9 12.2 22.9 12.2s11.7-1.7 22.9-12.2c11.4-10.6 23.7-28 35.1-52.4 20.3-43.5 34.6-102.9 37.5-167.4zM160.9 232l190.9 0C349 167.5 334.7 108.1 314.4 64.6 303 40.2 290.7 22.8 279.3 12.2 268.1 1.7 260.4 0 256.4 0s-11.7 1.7-22.9 12.2c-11.4 10.6-23.7 28-35.1 52.4-20.3 43.5-34.6 102.9-37.5 167.4zm-48 0C116.4 146.4 138.5 66.9 170.8 14.7 78.7 47.3 10.9 131.2 1.5 232l111.4 0zM1.5 280c9.4 100.8 77.2 184.7 169.3 217.3-32.3-52.2-54.4-131.7-57.9-217.3L1.5 280zm398.4 0c-3.5 85.6-25.6 165.1-57.9 217.3 92.1-32.7 159.9-116.5 169.3-217.3l-111.4 0zm111.4-48C501.9 131.2 434.1 47.3 342 14.7 374.3 66.9 396.4 146.4 399.9 232l111.4 0z\"/>" },
|
|
29
|
+
} as const;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { boundedArray } from "../bounded-array.ts";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -50,7 +51,7 @@ const Blur = z
|
|
|
50
51
|
.partial();
|
|
51
52
|
|
|
52
53
|
const CurvePoint = z.tuple([Unit, Unit]);
|
|
53
|
-
const CurveChannel =
|
|
54
|
+
const CurveChannel = boundedArray(CurvePoint, IMAGE_EDIT_CURVE_POINTS_MAX, 2).nullable();
|
|
54
55
|
const Curves = z.tuple([CurveChannel, CurveChannel, CurveChannel, CurveChannel]);
|
|
55
56
|
|
|
56
57
|
/** Corner targets may sit a little outside the frame (perspective pulls). */
|
|
@@ -721,9 +721,10 @@ function convert(props: Settings, snap: AtomicSnapshots, ctx: ImportContext): Co
|
|
|
721
721
|
return out;
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
-
const DEVICE_OF: Record<string, "desktop" | "laptop" | "tablet" | "mobile"> = {
|
|
724
|
+
const DEVICE_OF: Record<string, "wide" | "desktop" | "laptop" | "tablet" | "mobile"> = {
|
|
725
725
|
desktop: "desktop",
|
|
726
|
-
|
|
726
|
+
// W-959: EmVB has a Wide screen device (2400 px and up), like Elementor's.
|
|
727
|
+
widescreen: "wide",
|
|
727
728
|
// W-956: EmVB has a Laptop device (up to 1366 px), like Elementor's.
|
|
728
729
|
laptop: "laptop",
|
|
729
730
|
tablet_extra: "tablet",
|
|
@@ -746,7 +747,7 @@ type AtomicStyle = {
|
|
|
746
747
|
style: Style;
|
|
747
748
|
devices: { laptop?: Style; tablet?: Style; mobile?: Style };
|
|
748
749
|
states: { hover?: Style; focus?: Style; active?: Style };
|
|
749
|
-
display: { desktop?: string; laptop?: string; tablet?: string; mobile?: string };
|
|
750
|
+
display: { wide?: string; desktop?: string; laptop?: string; tablet?: string; mobile?: string };
|
|
750
751
|
columns: { desktop?: number; tablet?: number; mobile?: number };
|
|
751
752
|
tracks: { desktop?: string[]; tablet?: string[]; mobile?: string[] };
|
|
752
753
|
fullRow: boolean;
|
|
@@ -917,7 +918,8 @@ function atomicStyle(
|
|
|
917
918
|
/** W-958: only these classes, without Elementor's base styles (a class's own look). */
|
|
918
919
|
only?: readonly ClassDef[],
|
|
919
920
|
): AtomicStyle {
|
|
920
|
-
const layers: Record<"desktop" | "laptop" | "tablet" | "mobile", Style> = {
|
|
921
|
+
const layers: Record<"wide" | "desktop" | "laptop" | "tablet" | "mobile", Style> = {
|
|
922
|
+
wide: {},
|
|
921
923
|
desktop: {},
|
|
922
924
|
laptop: {},
|
|
923
925
|
tablet: {},
|
|
@@ -954,7 +956,7 @@ function atomicStyle(
|
|
|
954
956
|
unsupported.add(`${breakpoint} breakpoint`);
|
|
955
957
|
continue;
|
|
956
958
|
}
|
|
957
|
-
if (breakpoint !== device) folded = true;
|
|
959
|
+
if (breakpoint !== device && breakpoint !== "widescreen") folded = true;
|
|
958
960
|
const converted = convert(isRecord(variant.props) ? variant.props : {}, snap, ctx);
|
|
959
961
|
if (variant.custom_css) {
|
|
960
962
|
const raw = isRecord(variant.custom_css) ? variant.custom_css["raw"] : undefined;
|
|
@@ -985,7 +987,9 @@ function atomicStyle(
|
|
|
985
987
|
if (converted.columns && device === "laptop") {
|
|
986
988
|
// EmVB's grid columns have no laptop value: laptops keep the desktop columns.
|
|
987
989
|
unsupported.add("grid columns for laptops (laptops use the desktop columns)");
|
|
988
|
-
} else if (converted.columns && device
|
|
990
|
+
} else if (converted.columns && device === "wide") {
|
|
991
|
+
unsupported.add("grid columns for wide screens (wide screens use the desktop columns)");
|
|
992
|
+
} else if (converted.columns && device !== "laptop" && device !== "wide") {
|
|
989
993
|
columns[device] = converted.columns;
|
|
990
994
|
if (converted.tracks) tracks[device] = converted.tracks;
|
|
991
995
|
else delete tracks[device];
|
|
@@ -995,7 +999,7 @@ function atomicStyle(
|
|
|
995
999
|
ctx.note(
|
|
996
1000
|
"approximated",
|
|
997
1001
|
"Breakpoints",
|
|
998
|
-
"Extra breakpoints were folded into Tablet and Mobile
|
|
1002
|
+
"Extra breakpoints were folded into Tablet and Mobile.",
|
|
999
1003
|
);
|
|
1000
1004
|
if (Object.keys(phoneFromFluid).length > 0 && !quiet) {
|
|
1001
1005
|
ctx.note(
|
|
@@ -1007,8 +1011,10 @@ function atomicStyle(
|
|
|
1007
1011
|
for (const what of quiet ? [] : unsupported) {
|
|
1008
1012
|
ctx.note("approximated", name, `Left out a style EmVB has no setting for: ${what}.`);
|
|
1009
1013
|
}
|
|
1010
|
-
for (const layer of [layers.desktop, layers.laptop, layers.tablet, layers.mobile])
|
|
1014
|
+
for (const layer of [layers.wide, layers.desktop, layers.laptop, layers.tablet, layers.mobile])
|
|
1011
1015
|
finishBorders(layer);
|
|
1016
|
+
// W-959: Wide screen values build on Desktop's and sit in the style's `wide` record.
|
|
1017
|
+
const wideScreen = changedKeys(layers.desktop, layers.wide);
|
|
1012
1018
|
const mobile = { ...narrowFromWidth, ...phoneFromFluid, ...layers.mobile };
|
|
1013
1019
|
const laptop = changedKeys(layers.desktop, layers.laptop);
|
|
1014
1020
|
const wide = { ...layers.desktop, ...laptop };
|
|
@@ -1029,7 +1035,8 @@ function atomicStyle(
|
|
|
1029
1035
|
tracks[device] = Array.from({ length: count }, () => "1fr");
|
|
1030
1036
|
wider = tracks[device] ?? wider;
|
|
1031
1037
|
}
|
|
1032
|
-
|
|
1038
|
+
const style = isEmptyStyle(wideScreen) ? layers.desktop : { ...layers.desktop, wide: wideScreen };
|
|
1039
|
+
return { style, devices, states: statesOut, display, columns, tracks, fullRow };
|
|
1033
1040
|
}
|
|
1034
1041
|
|
|
1035
1042
|
// ---------------------------------------------------------------------------------------------
|
|
@@ -1130,6 +1137,12 @@ function applyStyle(n: N, s: AtomicStyle): N {
|
|
|
1130
1137
|
(d) => shown[d] === "none",
|
|
1131
1138
|
);
|
|
1132
1139
|
if (hidden.length > 0) n["hiddenOn"] = hidden;
|
|
1140
|
+
// W-959: a widescreen display that hides or shows unlike Desktop.
|
|
1141
|
+
if (s.display.wide !== undefined && (s.display.wide === "none") !== hidden.includes("desktop")) {
|
|
1142
|
+
const style = { ...(n["style"] as Style | undefined) };
|
|
1143
|
+
style["wide"] = { ...(style["wide"] as Style | undefined), hidden: s.display.wide === "none" };
|
|
1144
|
+
n["style"] = style;
|
|
1145
|
+
}
|
|
1133
1146
|
return n;
|
|
1134
1147
|
}
|
|
1135
1148
|
|
|
@@ -53,10 +53,23 @@ export type ImportOptions = {
|
|
|
53
53
|
* `classes` for the dialog to add to the site), instead of copying the classes' styles in.
|
|
54
54
|
*/
|
|
55
55
|
classes?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* W-1026: the links of a site menu by the name an Elementor Nav Menu points at (the WordPress
|
|
58
|
+
* menu's slug), as EmDash's WordPress import brings them over; fetched by the dialog.
|
|
59
|
+
*/
|
|
60
|
+
menu?: (name: string) => readonly MenuLink[] | undefined;
|
|
56
61
|
/** Random source for node ids (tests). */
|
|
57
62
|
random?: () => number;
|
|
58
63
|
};
|
|
59
64
|
|
|
65
|
+
/** W-1026: one link of a site menu, with the links under it. */
|
|
66
|
+
export type MenuLink = {
|
|
67
|
+
text: string;
|
|
68
|
+
href?: string;
|
|
69
|
+
newTab?: boolean;
|
|
70
|
+
children?: readonly MenuLink[];
|
|
71
|
+
};
|
|
72
|
+
|
|
60
73
|
/** Elementor's stock kit: what an unstyled site shows. */
|
|
61
74
|
const DEFAULT_COLORS: Record<string, string> = {
|
|
62
75
|
primary: "#6ec1e4",
|
|
@@ -93,6 +106,10 @@ export class ImportContext {
|
|
|
93
106
|
private readonly svg: ImportOptions["svg"];
|
|
94
107
|
private readonly pageLinkOf: ImportOptions["pageLink"];
|
|
95
108
|
private readonly mediaOf: ImportOptions["media"];
|
|
109
|
+
/** W-1026: the site menu a Nav Menu points at, by its name. */
|
|
110
|
+
readonly menuOf: ImportOptions["menu"];
|
|
111
|
+
/** W-1026: the menu names the export's Nav Menus point at, so the dialog can fetch them. */
|
|
112
|
+
readonly menus = new Set<string>();
|
|
96
113
|
/** W-958: Elementor class id → its EmVB class, or undefined when it can't be one. */
|
|
97
114
|
readonly imported = new Map<string, ImportedClass | undefined>();
|
|
98
115
|
readonly useClasses: boolean;
|
|
@@ -121,6 +138,7 @@ export class ImportContext {
|
|
|
121
138
|
this.svg = options.svg;
|
|
122
139
|
this.pageLinkOf = options.pageLink;
|
|
123
140
|
this.mediaOf = options.media;
|
|
141
|
+
this.menuOf = options.menu;
|
|
124
142
|
this.useClasses = options.classes === true;
|
|
125
143
|
this.useDefaults = options.defaults ?? true;
|
|
126
144
|
this.kitGiven = this.readKit(options.kit);
|
|
@@ -19,8 +19,11 @@ import {
|
|
|
19
19
|
deviceStyles,
|
|
20
20
|
entrance,
|
|
21
21
|
flexReader,
|
|
22
|
+
type Device,
|
|
22
23
|
hiddenOn,
|
|
24
|
+
mergeStyles,
|
|
23
25
|
type Style,
|
|
26
|
+
wideHidden,
|
|
24
27
|
widthReader,
|
|
25
28
|
} from "./style.ts";
|
|
26
29
|
import { isRecord, num, type Settings, slider, str } from "./values.ts";
|
|
@@ -66,6 +69,8 @@ export type ElementorImport =
|
|
|
66
69
|
svgFiles: string[];
|
|
67
70
|
/** W-958: WordPress page ids the page links to (their address comes from `pageLink`). */
|
|
68
71
|
pageLinks: number[];
|
|
72
|
+
/** W-1026: the site menus the page's Nav Menus point at (their links come from `menu`). */
|
|
73
|
+
menus: string[];
|
|
69
74
|
/** W-958: images on the old site the page uses (`media` gives their library copies). */
|
|
70
75
|
images: string[];
|
|
71
76
|
/** W-958: with `classes`, the EmVB classes the page's elements point at, to add to the site. */
|
|
@@ -318,6 +323,12 @@ class Walker {
|
|
|
318
323
|
}
|
|
319
324
|
const hidden = hiddenOn(s);
|
|
320
325
|
if (hidden) target["hiddenOn"] = hidden;
|
|
326
|
+
const wide = wideHidden(s);
|
|
327
|
+
if (wide !== undefined) {
|
|
328
|
+
const style = { ...(target["style"] as Style | undefined) };
|
|
329
|
+
style["wide"] = { ...(style["wide"] as Style | undefined), hidden: wide };
|
|
330
|
+
target["style"] = style;
|
|
331
|
+
}
|
|
321
332
|
const id = str(s["_element_id"]) ?? str(s["css_id"]);
|
|
322
333
|
if (id) {
|
|
323
334
|
if (isValidHtmlId(id) && !ctx.htmlIds.has(id) && !target["htmlId"]) {
|
|
@@ -369,8 +380,17 @@ class Walker {
|
|
|
369
380
|
"Scrolling and mouse motion effects weren't imported; add scroll motion in the editor.",
|
|
370
381
|
);
|
|
371
382
|
}
|
|
372
|
-
|
|
373
|
-
|
|
383
|
+
// W-1026: Elementor's Sticky (top or bottom, its offset and devices) as CSS sticky.
|
|
384
|
+
const sticky = stickyStyles(s);
|
|
385
|
+
if (sticky) {
|
|
386
|
+
target["style"] = { ...(target["style"] as Style | undefined), ...sticky.style };
|
|
387
|
+
if (sticky.devices) {
|
|
388
|
+
const devices = { ...(target["devices"] as Record<string, Style> | undefined) };
|
|
389
|
+
for (const [device, style] of Object.entries(sticky.devices))
|
|
390
|
+
devices[device] = { ...devices[device], ...style };
|
|
391
|
+
target["devices"] = devices;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
374
394
|
return nodes;
|
|
375
395
|
}
|
|
376
396
|
|
|
@@ -566,7 +586,7 @@ class Walker {
|
|
|
566
586
|
const layoutDevices = layoutDs.devices;
|
|
567
587
|
|
|
568
588
|
if (!boxed) {
|
|
569
|
-
const style =
|
|
589
|
+
const style = mergeStyles(outerStyle, innerStyle);
|
|
570
590
|
const n = grid
|
|
571
591
|
? node(
|
|
572
592
|
ctx,
|
|
@@ -582,6 +602,14 @@ class Walker {
|
|
|
582
602
|
const boxedWidth = slider(s["boxed_width"]) ?? { value: 1140, unit: "px" as const };
|
|
583
603
|
const minHeight = innerStyle["minHeight"];
|
|
584
604
|
delete innerStyle["minHeight"];
|
|
605
|
+
// W-959: and its Wide screen min height, like the other devices' below.
|
|
606
|
+
const innerWide = innerStyle["wide"] as Style | undefined;
|
|
607
|
+
if (innerWide && "minHeight" in innerWide) {
|
|
608
|
+
const { minHeight: wideMin, ...rest } = innerWide;
|
|
609
|
+
outerStyle["wide"] = { ...(outerStyle["wide"] as Style | undefined), minHeight: wideMin };
|
|
610
|
+
if (Object.keys(rest).length > 0) innerStyle["wide"] = rest;
|
|
611
|
+
else delete innerStyle["wide"];
|
|
612
|
+
}
|
|
585
613
|
const inner = grid
|
|
586
614
|
? node(ctx, "grid", gridProps(columns), {
|
|
587
615
|
style: {
|
|
@@ -610,8 +638,9 @@ class Walker {
|
|
|
610
638
|
);
|
|
611
639
|
// Min height belongs to the outer box on every device, as on desktop.
|
|
612
640
|
const outerDevices = { ...outerDs.devices };
|
|
613
|
-
const innerDevices: { tablet?: Style; mobile?: Style } = {};
|
|
614
|
-
|
|
641
|
+
const innerDevices: { laptop?: Style; tablet?: Style; mobile?: Style } = {};
|
|
642
|
+
// W-956: Laptop's layout values (direction, gap) go to the inner box too; they were dropped.
|
|
643
|
+
for (const key of ["laptop", "tablet", "mobile"] as const) {
|
|
615
644
|
const layout = layoutDevices?.[key];
|
|
616
645
|
if (!layout) continue;
|
|
617
646
|
const { minHeight: deviceMin, ...rest } = layout;
|
|
@@ -705,7 +734,7 @@ function verticalOf(style: Style, grid: boolean): string {
|
|
|
705
734
|
}
|
|
706
735
|
|
|
707
736
|
/** Grid gaps and minimum height per device (column counts are props, see gridColumns). */
|
|
708
|
-
const gridReader = (s: Settings, d:
|
|
737
|
+
const gridReader = (s: Settings, d: Device): Style => {
|
|
709
738
|
const style: Style = {};
|
|
710
739
|
const gaps = s[`grid_gaps${d}`];
|
|
711
740
|
const gap = isRecord(gaps)
|
|
@@ -881,7 +910,7 @@ export function importElementor(input: unknown, options: ImportOptions = {}): El
|
|
|
881
910
|
...(pageCss ? customCss(pageCss, ctx, "Page") : {}),
|
|
882
911
|
});
|
|
883
912
|
if (pageStyle.devices) root["devices"] = pageStyle.devices;
|
|
884
|
-
if (options.media)
|
|
913
|
+
if (options.media) pointAtCopies(root, ctx);
|
|
885
914
|
const candidate: Record<string, unknown> = { schemaVersion: LAYOUT_SCHEMA_VERSION, root };
|
|
886
915
|
const tried = new Set<string>();
|
|
887
916
|
for (let attempt = 0; attempt < 500; attempt++) {
|
|
@@ -901,9 +930,10 @@ export function importElementor(input: unknown, options: ImportOptions = {}): El
|
|
|
901
930
|
fonts: [...ctx.fonts].toSorted(),
|
|
902
931
|
svgFiles: [...ctx.svgFiles],
|
|
903
932
|
pageLinks: [...ctx.pageLinks].toSorted((a, b) => a - b),
|
|
933
|
+
menus: [...ctx.menus].toSorted(),
|
|
904
934
|
images: [...ctx.images],
|
|
905
935
|
classes: usedClasses(checked.layout, ctx).map((cls) =>
|
|
906
|
-
options.media ? (
|
|
936
|
+
options.media ? (pointAtCopies(structuredClone(cls), ctx) as StyleClass) : cls,
|
|
907
937
|
),
|
|
908
938
|
};
|
|
909
939
|
}
|
|
@@ -922,17 +952,17 @@ export function importElementor(input: unknown, options: ImportOptions = {}): El
|
|
|
922
952
|
* W-958: points every use of an old-site image at its media library copy: image sources (which
|
|
923
953
|
* also get the library id), backgrounds and any other stored address equal to it.
|
|
924
954
|
*/
|
|
925
|
-
function
|
|
955
|
+
function pointAtCopies(value: unknown, ctx: ImportContext): unknown {
|
|
926
956
|
if (typeof value === "string")
|
|
927
957
|
return /^https?:\/\//i.test(value) ? (ctx.copied(value)?.url ?? value) : value;
|
|
928
958
|
if (Array.isArray(value)) {
|
|
929
|
-
for (let i = 0; i < value.length; i++) value[i] =
|
|
959
|
+
for (let i = 0; i < value.length; i++) value[i] = pointAtCopies(value[i], ctx);
|
|
930
960
|
return value;
|
|
931
961
|
}
|
|
932
962
|
if (!isRecord(value)) return value;
|
|
933
963
|
const props = value["type"] === "image" && isRecord(value["props"]) ? value["props"] : undefined;
|
|
934
964
|
const copy = props && typeof props["src"] === "string" ? ctx.copied(props["src"]) : undefined;
|
|
935
|
-
for (const [key, inner] of Object.entries(value)) value[key] =
|
|
965
|
+
for (const [key, inner] of Object.entries(value)) value[key] = pointAtCopies(inner, ctx);
|
|
936
966
|
if (props && copy?.id) props["mediaId"] = copy.id;
|
|
937
967
|
return value;
|
|
938
968
|
}
|
|
@@ -947,3 +977,34 @@ function usedClasses(layout: Layout, ctx: ImportContext): StyleClass[] {
|
|
|
947
977
|
visit(layout.root);
|
|
948
978
|
return [...ctx.imported.values()].flatMap((c) => (c && used.has(c.id) ? [c.cls] : []));
|
|
949
979
|
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* W-1026: Elementor's Sticky settings (`sticky`: top or bottom, `sticky_offset` in px,
|
|
983
|
+
* `sticky_on`: the devices) as `position: sticky` with that edge, above the content around it,
|
|
984
|
+
* and `static` on the devices it is off for.
|
|
985
|
+
*/
|
|
986
|
+
function stickyStyles(
|
|
987
|
+
s: Record<string, unknown>,
|
|
988
|
+
): { style: Style; devices?: Record<string, Style> } | undefined {
|
|
989
|
+
const edge = s["sticky"];
|
|
990
|
+
if (edge !== "top" && edge !== "bottom") return undefined;
|
|
991
|
+
const offset =
|
|
992
|
+
typeof s["sticky_offset"] === "number" ? s["sticky_offset"] : Number(s["sticky_offset"] ?? 0);
|
|
993
|
+
const at = {
|
|
994
|
+
value: Number.isFinite(offset) ? Math.min(10_000, Math.max(0, Math.round(offset))) : 0,
|
|
995
|
+
unit: "px" as const,
|
|
996
|
+
};
|
|
997
|
+
const on = Array.isArray(s["sticky_on"])
|
|
998
|
+
? s["sticky_on"].filter((d): d is string => typeof d === "string")
|
|
999
|
+
: ["desktop", "tablet", "mobile"];
|
|
1000
|
+
const sticky: Style = { position: "sticky", [edge]: at, zIndex: 99 };
|
|
1001
|
+
const flat: Style = { position: "static" };
|
|
1002
|
+
const style = on.includes("desktop") ? sticky : flat;
|
|
1003
|
+
const devices: Record<string, Style> = {};
|
|
1004
|
+
const desktop = on.includes("desktop");
|
|
1005
|
+
const tablet = on.includes("tablet");
|
|
1006
|
+
const mobile = on.includes("mobile");
|
|
1007
|
+
if (tablet !== desktop) devices["tablet"] = tablet ? sticky : flat;
|
|
1008
|
+
if (mobile !== tablet) devices["mobile"] = mobile ? sticky : flat;
|
|
1009
|
+
return Object.keys(devices).length > 0 ? { style, devices } : { style };
|
|
1010
|
+
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./values.ts";
|
|
26
26
|
|
|
27
27
|
export type Style = Record<string, unknown>;
|
|
28
|
-
export type Device = "" | "_laptop" | "_tablet" | "_mobile";
|
|
28
|
+
export type Device = "" | "_widescreen" | "_laptop" | "_tablet" | "_mobile";
|
|
29
29
|
|
|
30
30
|
/** Reads one device's style from a widget's settings. */
|
|
31
31
|
export type Reader = (s: Settings, d: Device, ctx: ImportContext, el: string) => Style;
|
|
@@ -39,6 +39,8 @@ export function deviceStyles(
|
|
|
39
39
|
): { style?: Style; devices?: { laptop?: Style; tablet?: Style; mobile?: Style } } {
|
|
40
40
|
const read = (d: Device) => Object.assign({}, ...readers.map((r) => r(s, d, ctx, el))) as Style;
|
|
41
41
|
const desktop = read("");
|
|
42
|
+
// W-959: Elementor's widescreen values (`key_widescreen`), on Desktop's, in `style.wide`.
|
|
43
|
+
const wide = changedKeys(desktop, read("_widescreen"));
|
|
42
44
|
// W-956: Elementor's laptop values (`key_laptop`), between desktop and tablet.
|
|
43
45
|
const laptop = changedKeys(desktop, read("_laptop"));
|
|
44
46
|
const tablet = changedKeys({ ...desktop, ...laptop }, read("_tablet"));
|
|
@@ -47,6 +49,7 @@ export function deviceStyles(
|
|
|
47
49
|
if (!isEmptyStyle(laptop)) devices.laptop = laptop;
|
|
48
50
|
if (!isEmptyStyle(tablet)) devices.tablet = tablet;
|
|
49
51
|
if (!isEmptyStyle(mobile)) devices.mobile = mobile;
|
|
52
|
+
if (!isEmptyStyle(wide)) desktop["wide"] = wide;
|
|
50
53
|
return {
|
|
51
54
|
...(isEmptyStyle(desktop) ? {} : { style: desktop }),
|
|
52
55
|
...(Object.keys(devices).length > 0 ? { devices } : {}),
|
|
@@ -398,6 +401,23 @@ export function entrance(s: Settings, ctx: ImportContext, el: string): Style | u
|
|
|
398
401
|
* without Elementor's laptop breakpoint (no `hide_laptop` setting) hides "desktop" from 1025 px,
|
|
399
402
|
* laptops included.
|
|
400
403
|
*/
|
|
404
|
+
/**
|
|
405
|
+
* W-959: `hide_widescreen` when the site has Elementor's widescreen breakpoint and it hides or
|
|
406
|
+
* shows unlike Desktop (`style.wide.hidden`); undefined when Wide screen follows Desktop.
|
|
407
|
+
*/
|
|
408
|
+
export function wideHidden(s: Settings): boolean | undefined {
|
|
409
|
+
if (!("hide_widescreen" in s)) return undefined;
|
|
410
|
+
const wide = !!str(s["hide_widescreen"]);
|
|
411
|
+
return wide === !!str(s["hide_desktop"]) ? undefined : wide;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** Two styles one after the other; their Wide screen records merge too (W-959). */
|
|
415
|
+
export function mergeStyles(a: Style | undefined, b: Style | undefined): Style {
|
|
416
|
+
const out: Style = { ...a, ...b };
|
|
417
|
+
if (isRecord(a?.["wide"]) && isRecord(b?.["wide"])) out["wide"] = { ...a["wide"], ...b["wide"] };
|
|
418
|
+
return out;
|
|
419
|
+
}
|
|
420
|
+
|
|
401
421
|
export function hiddenOn(s: Settings): ("desktop" | "laptop" | "tablet" | "mobile")[] | undefined {
|
|
402
422
|
const out: ("desktop" | "laptop" | "tablet" | "mobile")[] = [];
|
|
403
423
|
const laptopActive = "hide_laptop" in s;
|