@perkyzz/emvb 1.2.0 → 1.4.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 +2 -2
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/package.json +4 -4
- package/src/admin/bulk-api.ts +5 -1
- package/src/admin/editor/A11yCopilot.tsx +3 -1
- package/src/admin/editor/Editor.tsx +22 -2
- package/src/admin/editor/Timeline.tsx +1 -8
- package/src/admin/editor/canvas/DeviceBar.tsx +7 -2
- package/src/admin/editor/canvas/EmptyCanvas.tsx +11 -2
- package/src/admin/editor/canvas/use-canvas-dnd.ts +1 -20
- package/src/admin/editor/canvas/vnode-react.tsx +5 -0
- package/src/admin/editor/co-design.ts +36 -1
- package/src/admin/editor/dnd/dragged-source.ts +22 -0
- package/src/admin/editor/dnd/layer-drop.ts +141 -0
- package/src/admin/editor/dnd/new-element.ts +76 -0
- package/src/admin/editor/editor-css.ts +9 -1
- package/src/admin/editor/element-chrome.ts +34 -0
- package/src/admin/editor/feature-css.ts +22 -0
- package/src/admin/editor/inert-links.ts +8 -0
- package/src/admin/editor/panels/ColorControl.tsx +2 -2
- package/src/admin/editor/panels/FontFaces.tsx +342 -0
- package/src/admin/editor/panels/LayersPanel.tsx +56 -6
- package/src/admin/editor/panels/LeftPanel.tsx +153 -29
- package/src/admin/editor/panels/SettingsPanel.tsx +1 -0
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +5 -0
- package/src/admin/editor/panels/TemplatesPanel.tsx +205 -0
- package/src/admin/editor/panels/TokenScales.tsx +2 -0
- package/src/admin/editor/panels/TriggersEditor.tsx +203 -9
- package/src/admin/editor/panels/VariableSection.tsx +111 -7
- package/src/admin/editor/panels/color-space.ts +71 -6
- package/src/admin/editor/panels/settings/AudienceEditor.tsx +3 -0
- package/src/admin/editor/panels/settings/FieldControl.tsx +18 -0
- package/src/admin/editor/panels/settings/ItemList.tsx +33 -0
- package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +9 -3
- package/src/admin/editor/panels/settings/StickyControl.tsx +97 -0
- package/src/admin/editor/panels/settings/StyleRow.tsx +14 -0
- package/src/admin/editor/panels/settings/style-sections.ts +19 -2
- package/src/admin/editor/panels/url-rules.ts +43 -0
- package/src/admin/editor/panels/use-layers-drop.ts +232 -0
- package/src/admin/editor/store.ts +4 -2
- package/src/admin/editor/useExtensions.ts +3 -1
- package/src/admin/editor/useNodeActions.ts +74 -1
- package/src/admin/editor/useSave.ts +116 -85
- package/src/admin/export-api.ts +25 -2
- package/src/admin/extension-outputs.ts +179 -0
- package/src/admin/font-files-api.ts +38 -0
- package/src/admin/pages/ImportButton.tsx +15 -4
- package/src/admin/pages/ImportElementorDialog.tsx +22 -188
- package/src/admin/pages/ImportHtmlDialog.tsx +209 -0
- package/src/admin/pages/ImportImageCopies.tsx +167 -0
- package/src/admin/pages/ImportReport.tsx +63 -0
- package/src/admin/pages/NewPageDialog.tsx +54 -32
- package/src/admin/pages/PageList.tsx +9 -0
- package/src/admin/pages/ThemePartList.tsx +9 -0
- package/src/astro/EmVBPage.astro +5 -2
- package/src/astro/extension-styles.ts +35 -0
- package/src/astro/forms/EmVBFormsClient.astro +3 -0
- package/src/astro/forms/enhance.ts +107 -0
- package/src/astro/popups/runtime.ts +47 -2
- package/src/astro/render.ts +19 -4
- package/src/astro/request-data.ts +6 -0
- package/src/astro/resolve-theme.ts +11 -4
- package/src/astro/resolve.ts +9 -0
- package/src/astro/widgets/EmVBCountdownRuntime.astro +8 -0
- package/src/astro/widgets/EmVBCounterRuntime.astro +8 -0
- package/src/astro/widgets/EmVBHeadlineRuntime.astro +9 -0
- package/src/astro/widgets/EmVBMapRuntime.astro +8 -0
- package/src/astro/widgets/EmVBShareRuntime.astro +9 -0
- package/src/astro/widgets/EmVBStickyRuntime.astro +9 -0
- package/src/astro/widgets/EmVBThemeRuntime.astro +9 -0
- package/src/astro/widgets/EmVBWidgetRuntimes.astro +22 -0
- package/src/astro/widgets/alerts.ts +16 -2
- package/src/astro/widgets/carousel.ts +65 -24
- package/src/astro/widgets/countdown.ts +91 -0
- package/src/astro/widgets/counter.ts +98 -0
- package/src/astro/widgets/extension-runtimes.ts +27 -0
- package/src/astro/widgets/headline.ts +99 -0
- package/src/astro/widgets/map.ts +37 -0
- package/src/astro/widgets/share.ts +21 -0
- package/src/astro/widgets/sticky.ts +87 -0
- package/src/astro/widgets/theme.ts +52 -0
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +177 -6
- package/src/core/arrange.ts +71 -1
- package/src/core/canvas-collections.ts +28 -0
- package/src/core/css/font-face.ts +72 -0
- package/src/core/css/generate.ts +35 -1
- package/src/core/elements/counter-format.ts +15 -0
- package/src/core/elements/form-elements.ts +119 -9
- package/src/core/elements/icon-svg.ts +14 -0
- package/src/core/elements/index.ts +54 -4
- package/src/core/elements/input-limits.ts +44 -0
- package/src/core/elements/marketing.ts +1490 -0
- package/src/core/elements/menu.ts +109 -47
- package/src/core/elements/site.ts +108 -0
- package/src/core/elements/widgets.ts +40 -5
- package/src/core/export/runtimes.generated.ts +10 -3
- package/src/core/export/site.ts +55 -4
- package/src/core/extensions/classes.ts +114 -0
- package/src/core/extensions/index.ts +17 -2
- package/src/core/extensions/normalize.ts +13 -0
- package/src/core/extensions/registry.ts +134 -10
- package/src/core/extensions/render-ext.ts +66 -21
- package/src/core/extensions/safe-nodes.ts +67 -11
- package/src/core/extensions/types.ts +48 -1
- package/src/core/fonts/files.ts +74 -0
- package/src/core/fonts/google.ts +112 -0
- package/src/core/fonts/test-font.ts +9 -0
- package/src/core/import/elementor/context.ts +13 -4
- package/src/core/import/elementor/index.ts +32 -21
- package/src/core/import/elementor/widgets.ts +532 -293
- package/src/core/import/html/blocks.ts +602 -0
- package/src/core/import/html/index.ts +155 -0
- package/src/core/import/html/map.ts +958 -0
- package/src/core/import/html/parse.ts +430 -0
- package/src/core/index.ts +45 -0
- package/src/core/limits.ts +6 -0
- package/src/core/migrate/v18.ts +3 -0
- package/src/core/public-attributes.ts +17 -0
- package/src/core/render/extras.ts +31 -7
- package/src/core/render/form.ts +103 -10
- package/src/core/render/index.ts +172 -16
- package/src/core/render/section.ts +31 -1
- package/src/core/render/spacer-basis.ts +102 -0
- package/src/core/render/theme-boot.ts +16 -0
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +68 -3
- package/src/core/sanitize/motion.ts +12 -0
- package/src/core/schema/design.ts +40 -0
- package/src/core/schema/layout.ts +534 -22
- package/src/core/schema/style.ts +28 -0
- package/src/core/templates/index.ts +218 -0
- package/src/core/templates/pages.ts +29 -0
- package/src/core/templates/sections.ts +794 -0
- package/src/core/templates/types.ts +9 -0
- package/src/core/theme/dynamic.ts +11 -6
- package/src/core/theme/popup-markup.ts +21 -2
- package/src/core/theme/popup-rules.ts +36 -0
- package/src/core/theme/triggers.ts +64 -5
- package/src/core/translatable.ts +5 -2
- package/src/extension-build.ts +331 -0
- package/src/index.ts +25 -3
- package/src/mcp/brief.ts +191 -0
- package/src/mcp/prompts.ts +33 -0
- package/src/mcp/read.ts +29 -1
- package/src/mcp/tools.ts +40 -1
- package/src/mcp/write.ts +41 -1
- package/src/server/extension-routes.ts +73 -0
- package/src/server/font-routes.ts +301 -0
- package/src/server/plugin.ts +11 -1
package/src/core/arrange.ts
CHANGED
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
MAX_DEPTH,
|
|
4
4
|
MAX_GALLERY_IMAGES,
|
|
5
5
|
MAX_NODES,
|
|
6
|
+
MAX_HOTSPOTS,
|
|
7
|
+
MAX_PRICE_ITEMS,
|
|
8
|
+
MAX_SHARE_LINKS,
|
|
6
9
|
MAX_SOCIAL_LINKS,
|
|
7
10
|
MAX_TABS,
|
|
8
11
|
} from "./limits.ts";
|
|
@@ -25,6 +28,7 @@ import {
|
|
|
25
28
|
newNodeId,
|
|
26
29
|
nodeChildren,
|
|
27
30
|
removeNode,
|
|
31
|
+
someNode,
|
|
28
32
|
starterLayout,
|
|
29
33
|
updateNode,
|
|
30
34
|
} from "./tree-ops.ts";
|
|
@@ -63,7 +67,9 @@ export const REASONS = {
|
|
|
63
67
|
top: "It's already at the top level.",
|
|
64
68
|
noContainerAbove: "There's no container just above it to move into.",
|
|
65
69
|
nestedForm: "A form can't go inside another form.",
|
|
70
|
+
searchInForm: "A Search form can't go inside a form.",
|
|
66
71
|
fieldOutsideForm: "Form fields must be placed inside a form.",
|
|
72
|
+
stepOutsideForm: "Form steps can only go directly inside a form.",
|
|
67
73
|
formIntoField: "A form can only go inside a layout container.",
|
|
68
74
|
tabOutsideTabs: "Tab panels can only go inside Tabs.",
|
|
69
75
|
onlyTabPanels: "Tabs can only hold tab panels.",
|
|
@@ -80,6 +86,15 @@ export const REASONS = {
|
|
|
80
86
|
slideOutsideCarousel: "Slides can only go inside a Carousel.",
|
|
81
87
|
onlySlides: "A carousel can only hold slides.",
|
|
82
88
|
tooManySlides: `A carousel can hold up to ${MAX_CAROUSEL_SLIDES} slides.`,
|
|
89
|
+
itemOutsidePriceList: "Price list items can only go inside a Price list.",
|
|
90
|
+
onlyPriceItems: "A price list can only hold price list items.",
|
|
91
|
+
tooManyPriceItems: `A price list can hold up to ${MAX_PRICE_ITEMS} items.`,
|
|
92
|
+
shareOutsideButtons: "Share links can only go inside Share buttons.",
|
|
93
|
+
onlyShareLinks: "Share buttons can only hold share links.",
|
|
94
|
+
tooManyShareLinks: `Share buttons can hold up to ${MAX_SHARE_LINKS} links.`,
|
|
95
|
+
hotspotOutsidePicture: "Hotspots can only go inside a Hotspots picture.",
|
|
96
|
+
onlyHotspots: "A Hotspots picture can only hold hotspots.",
|
|
97
|
+
tooManyHotspots: `A Hotspots picture can hold up to ${MAX_HOTSPOTS} markers.`,
|
|
83
98
|
emptyOutsideLoop: "An Empty state can only go inside a Loop.",
|
|
84
99
|
} as const;
|
|
85
100
|
|
|
@@ -175,8 +190,28 @@ export function parentChildRefusal(
|
|
|
175
190
|
return REASONS.slideOutsideCarousel;
|
|
176
191
|
}
|
|
177
192
|
if (parent.type === "carousel" && child.type !== "carousel-slide") return REASONS.onlySlides;
|
|
193
|
+
if (child.type === "price-list-item" && parent.type !== "price-list") {
|
|
194
|
+
return REASONS.itemOutsidePriceList;
|
|
195
|
+
}
|
|
196
|
+
if (parent.type === "price-list" && child.type !== "price-list-item") {
|
|
197
|
+
return REASONS.onlyPriceItems;
|
|
198
|
+
}
|
|
199
|
+
if (child.type === "share-link" && parent.type !== "share-buttons") {
|
|
200
|
+
return REASONS.shareOutsideButtons;
|
|
201
|
+
}
|
|
202
|
+
if (parent.type === "share-buttons" && child.type !== "share-link") {
|
|
203
|
+
return REASONS.onlyShareLinks;
|
|
204
|
+
}
|
|
205
|
+
if (child.type === "hotspot" && parent.type !== "hotspots") {
|
|
206
|
+
return REASONS.hotspotOutsidePicture;
|
|
207
|
+
}
|
|
208
|
+
if (parent.type === "hotspots" && child.type !== "hotspot") return REASONS.onlyHotspots;
|
|
178
209
|
if (isFormNode(child) && inForm) return REASONS.nestedForm;
|
|
210
|
+
// W-1073: a Search form is a <form> too; inside a form its button sent that form.
|
|
211
|
+
if (child.type === "search-form" && inForm) return REASONS.searchInForm;
|
|
179
212
|
if (isFormFieldType(child.type) && !inForm) return REASONS.fieldOutsideForm;
|
|
213
|
+
// W-1065: the forms script pages through the form's own steps; a nested one would never show.
|
|
214
|
+
if (child.type === "form-step" && !isFormNode(parent)) return REASONS.stepOutsideForm;
|
|
180
215
|
return undefined;
|
|
181
216
|
}
|
|
182
217
|
|
|
@@ -215,6 +250,30 @@ const DROP_RULES: [breaks: (drop: Drop) => boolean, reason: string][] = [
|
|
|
215
250
|
nodeChildren(into.node).length >= MAX_CAROUSEL_SLIDES,
|
|
216
251
|
REASONS.tooManySlides,
|
|
217
252
|
],
|
|
253
|
+
// W-1043: a full Price list takes no new item; moving within it is fine.
|
|
254
|
+
[
|
|
255
|
+
({ node, into }) =>
|
|
256
|
+
into.node.type === "price-list" &&
|
|
257
|
+
!nodeChildren(into.node).some((child) => child.id === node.id) &&
|
|
258
|
+
nodeChildren(into.node).length >= MAX_PRICE_ITEMS,
|
|
259
|
+
REASONS.tooManyPriceItems,
|
|
260
|
+
],
|
|
261
|
+
// W-1047: a full Share buttons takes no new link; moving within it is fine.
|
|
262
|
+
[
|
|
263
|
+
({ node, into }) =>
|
|
264
|
+
into.node.type === "share-buttons" &&
|
|
265
|
+
!nodeChildren(into.node).some((child) => child.id === node.id) &&
|
|
266
|
+
nodeChildren(into.node).length >= MAX_SHARE_LINKS,
|
|
267
|
+
REASONS.tooManyShareLinks,
|
|
268
|
+
],
|
|
269
|
+
// W-1048: a full Hotspots picture takes no new marker; moving within it is fine.
|
|
270
|
+
[
|
|
271
|
+
({ node, into }) =>
|
|
272
|
+
into.node.type === "hotspots" &&
|
|
273
|
+
!nodeChildren(into.node).some((child) => child.id === node.id) &&
|
|
274
|
+
nodeChildren(into.node).length >= MAX_HOTSPOTS,
|
|
275
|
+
REASONS.tooManyHotspots,
|
|
276
|
+
],
|
|
218
277
|
[({ node, into }) => into.depth + height(node) > MAX_DEPTH, REASONS.tooDeep],
|
|
219
278
|
[
|
|
220
279
|
({ node, layout, isNew }) => isNew && size(layout.root) + size(node) > MAX_NODES,
|
|
@@ -243,8 +302,19 @@ export function canDrop(layout: Layout, source: DragSource, parentId: string): A
|
|
|
243
302
|
const moving = dragged(layout, source, parentId);
|
|
244
303
|
if (!moving.ok) return moving;
|
|
245
304
|
if (!isParentNode(into.node)) return refuse(REASONS.notContainer);
|
|
246
|
-
const
|
|
305
|
+
const inForm = underForm(layout, into.node.id);
|
|
306
|
+
const placed = parentChildRefusal(into.node, moving.node, inForm);
|
|
247
307
|
if (placed) return refuse(placed);
|
|
308
|
+
// A box holding a form or Search form can't go into a form either: the save would refuse it.
|
|
309
|
+
if (inForm) {
|
|
310
|
+
const inner = nodeChildren(moving.node).find((child) =>
|
|
311
|
+
someNode(child, (n) => isFormNode(n) || n.type === "search-form"),
|
|
312
|
+
);
|
|
313
|
+
if (inner) {
|
|
314
|
+
const nested = someNode(inner, isFormNode);
|
|
315
|
+
return refuse(nested ? REASONS.nestedForm : REASONS.searchInForm);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
248
318
|
const drop: Drop = { layout, node: moving.node, into, isNew: source.kind === "new" };
|
|
249
319
|
const broken = DROP_RULES.find(([breaks]) => breaks(drop));
|
|
250
320
|
return broken ? refuse(broken[1]) : { ok: true };
|
|
@@ -18,3 +18,31 @@ export function canvasCollectionSlugs(input: unknown): string[] {
|
|
|
18
18
|
}
|
|
19
19
|
return out;
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* W-1036 (S-08, render side): the running site's list, set when the plugin starts and read when
|
|
24
|
+
* `resolveEmVBPage` renders a host collection. Kept on globalThis like core/geo-trust.ts. Unset
|
|
25
|
+
* (the plugin never started in this process, as in unit tests) means "unknown", never "unlisted".
|
|
26
|
+
*/
|
|
27
|
+
const KEY = Symbol.for("emvb.canvasCollections");
|
|
28
|
+
const WARNED = Symbol.for("emvb.canvasCollectionsWarned");
|
|
29
|
+
|
|
30
|
+
type Holder = { [KEY]?: readonly string[]; [WARNED]?: Set<string> };
|
|
31
|
+
|
|
32
|
+
export function setCanvasCollections(input: unknown): void {
|
|
33
|
+
(globalThis as Holder)[KEY] = canvasCollectionSlugs(input);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* True the first time a layout from `collection` renders while the site's `canvasCollections`
|
|
38
|
+
* leaves it out: the caller logs one warning per collection and process (1.3; 2.0 refuses).
|
|
39
|
+
*/
|
|
40
|
+
export function unlistedCanvasCollectionFirstSeen(collection: string): boolean {
|
|
41
|
+
const holder = globalThis as Holder;
|
|
42
|
+
const listed = holder[KEY];
|
|
43
|
+
if (listed === undefined || listed.includes(collection) || OWN.has(collection)) return false;
|
|
44
|
+
const warned = (holder[WARNED] ??= new Set());
|
|
45
|
+
if (warned.has(collection)) return false;
|
|
46
|
+
warned.add(collection);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FONT_FAMILY_NAME, UNICODE_RANGE } from "../schema/design.ts";
|
|
2
|
+
import type { FontFace, FontVariable } from "../schema/design.ts";
|
|
3
|
+
import { fontVariableName } from "../sanitize/css.ts";
|
|
4
|
+
import { sanitizeMediaUrl } from "../sanitize/media-url.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* W-1072: the characters a font file URL may hold in the emitted CSS. A URL that passes the media
|
|
8
|
+
* URL check may still hold braces, parentheses, `;` or spaces, which are harmless inside a quoted
|
|
9
|
+
* `url("…")` but would confuse the scoping pass, so those URLs are left out.
|
|
10
|
+
*/
|
|
11
|
+
const SRC_CHARS = /^[A-Za-z0-9\-._~:/?#[\]@!$&*+,=%]+$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A font file URL safe to write in `url("…")`, or undefined. Only a path on the site itself
|
|
15
|
+
* (`/…`, never `//host`): a page must not ask Google Fonts or any other host for a font, even when
|
|
16
|
+
* a design was edited by hand, imported or written by an agent.
|
|
17
|
+
*/
|
|
18
|
+
export function fontFaceSrc(src: string): string | undefined {
|
|
19
|
+
const url = sanitizeMediaUrl(src);
|
|
20
|
+
if (!url?.startsWith("/") || url.startsWith("//")) return undefined;
|
|
21
|
+
return SRC_CHARS.test(url) ? url : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A double-quoted CSS string. Letters, digits, spaces, `_`, `.` and `-` stay as they are; any
|
|
26
|
+
* other character (a quote, a backslash, a newline, `<`) is written as a hex escape.
|
|
27
|
+
*/
|
|
28
|
+
export function cssString(value: string): string {
|
|
29
|
+
let out = "";
|
|
30
|
+
for (const ch of value) {
|
|
31
|
+
out += /^[\p{L}\p{N} _.-]$/u.test(ch) ? ch : `\\${(ch.codePointAt(0) ?? 0).toString(16)} `;
|
|
32
|
+
}
|
|
33
|
+
return `"${out}"`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function faceRule(family: string, face: FontFace): string | undefined {
|
|
37
|
+
const src = fontFaceSrc(face.src);
|
|
38
|
+
if (!src) return undefined;
|
|
39
|
+
if (!Number.isInteger(face.weight) || face.weight < 1 || face.weight > 1000) return undefined;
|
|
40
|
+
if (face.style !== "normal" && face.style !== "italic") return undefined;
|
|
41
|
+
const range =
|
|
42
|
+
face.unicodeRange !== undefined && face.unicodeRange.length <= 1000
|
|
43
|
+
? UNICODE_RANGE.test(face.unicodeRange)
|
|
44
|
+
? `;unicode-range:${face.unicodeRange}`
|
|
45
|
+
: undefined
|
|
46
|
+
: "";
|
|
47
|
+
if (range === undefined) return undefined;
|
|
48
|
+
return `@font-face{font-family:${cssString(family)};src:url("${src}") format("woff2");font-weight:${face.weight};font-style:${face.style};font-display:swap${range}}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Every `@font-face` rule of one font variable, whether a page uses it or not. */
|
|
52
|
+
export function fontFaceRules(font: Pick<FontVariable, "family" | "faces">): string[] {
|
|
53
|
+
const family = font.family;
|
|
54
|
+
if (!family || !FONT_FAMILY_NAME.test(family)) return [];
|
|
55
|
+
const rules = (font.faces ?? []).flatMap((face) => faceRule(family, face) ?? []);
|
|
56
|
+
return [...new Set(rules)];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* W-1072: the `@font-face` rules of the font variables `sheet` uses (`var(--emvb-f-<id>)`), so a
|
|
61
|
+
* page downloads only the fonts it shows. Empty when no used variable has custom faces, so every
|
|
62
|
+
* existing design keeps the exact CSS it had.
|
|
63
|
+
*/
|
|
64
|
+
export function fontFaceCss(fonts: readonly FontVariable[] | undefined, sheet: string): string {
|
|
65
|
+
const rules = (fonts ?? []).flatMap((font) => {
|
|
66
|
+
const name = fontVariableName(font.id);
|
|
67
|
+
if (!name || !font.faces?.length) return [];
|
|
68
|
+
if (!sheet.includes(`var(${name})`) && !sheet.includes(`var(${name},`)) return [];
|
|
69
|
+
return fontFaceRules(font);
|
|
70
|
+
});
|
|
71
|
+
return [...new Set(rules)].join("");
|
|
72
|
+
}
|
package/src/core/css/generate.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cssTypeName } from "../schema/layout.ts";
|
|
2
2
|
import { MARK_CSS } from "../text-marks.ts";
|
|
3
|
+
import { fontFaceCss } from "./font-face.ts";
|
|
3
4
|
import { DEFAULT_FLUID_RANGE, fluidClamp } from "../design/tokens.ts";
|
|
4
5
|
import type { FluidRange, LengthVariable } from "../schema/design.ts";
|
|
5
6
|
import type { DesignSystem } from "../schema/design.ts";
|
|
@@ -20,7 +21,12 @@ import {
|
|
|
20
21
|
} from "../sanitize/css.ts";
|
|
21
22
|
import { STYLE_STATES, type StyleStateName } from "../schema/state-names.ts";
|
|
22
23
|
import { DEVICE_MEDIA, type Device, type EditorDevice } from "../theme/popup-rules.ts";
|
|
23
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
LOOP_KEYFRAMES,
|
|
26
|
+
MOTION_KEYFRAMES,
|
|
27
|
+
STICKY_KEYFRAMES,
|
|
28
|
+
usesSticky,
|
|
29
|
+
} from "../sanitize/motion.ts";
|
|
24
30
|
|
|
25
31
|
export type CssInput = {
|
|
26
32
|
design: DesignSystem;
|
|
@@ -145,6 +151,25 @@ function declare<T extends { id: string }>(
|
|
|
145
151
|
});
|
|
146
152
|
}
|
|
147
153
|
|
|
154
|
+
/**
|
|
155
|
+
* W-1067: colour variables' dark values. They apply when the visitor's system prefers dark and no
|
|
156
|
+
* Theme toggle chose light, and whenever it chose dark; the toggle marks `<html>` with
|
|
157
|
+
* `data-emvb-theme`. Written as `.emvb-root:is([…] *)` so the sheet's scope prefix still matches.
|
|
158
|
+
*/
|
|
159
|
+
function darkCss(colors: DesignSystem["variables"]["colors"]): string {
|
|
160
|
+
const dark = declare(
|
|
161
|
+
colors.filter((color) => color.dark !== undefined),
|
|
162
|
+
colorVariableName,
|
|
163
|
+
(color) => safe(color.dark ?? ""),
|
|
164
|
+
);
|
|
165
|
+
if (dark.length === 0) return "";
|
|
166
|
+
const declarations = [...dark, { property: "color-scheme", value: "dark" }];
|
|
167
|
+
return (
|
|
168
|
+
`@media (prefers-color-scheme: dark){${block('.emvb-root:not(:is([data-emvb-theme="light"] *))', declarations)}}` +
|
|
169
|
+
block('.emvb-root:is([data-emvb-theme="dark"] *)', declarations)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
148
173
|
/** W-319: declarations that play scroll motion. */
|
|
149
174
|
const usesMotion = (declarations: readonly Declaration[]) =>
|
|
150
175
|
declarations.some((d) => d.property === "animation" && /\bemvb-m[otsrb]\b/.test(d.value));
|
|
@@ -199,6 +224,8 @@ export function generateCss({
|
|
|
199
224
|
let motion = false;
|
|
200
225
|
/** W-938: any loop on the page, so its keyframes are sent. */
|
|
201
226
|
let loops = false;
|
|
227
|
+
/** W-1070: any sticky effect, so its keyframes are sent. */
|
|
228
|
+
let sticky = false;
|
|
202
229
|
const rules = (selector: string, declarations: Declaration[], states: StateDeclarations) => [
|
|
203
230
|
block(selector, declarations),
|
|
204
231
|
...STYLE_STATES.map((state) =>
|
|
@@ -215,6 +242,7 @@ export function generateCss({
|
|
|
215
242
|
if (declarations.some((d) => d.property === "animation")) entrances.push(selector);
|
|
216
243
|
if (usesMotion(declarations)) motion = true;
|
|
217
244
|
if (usesLoop(declarations)) loops = true;
|
|
245
|
+
if (usesSticky(declarations)) sticky = true;
|
|
218
246
|
return declarations;
|
|
219
247
|
};
|
|
220
248
|
const classes = (design.classes ?? []).flatMap((cls) => {
|
|
@@ -338,6 +366,7 @@ export function generateCss({
|
|
|
338
366
|
const devices = [rule.wide ?? [], rule.laptop, rule.tablet, rule.mobile];
|
|
339
367
|
if (devices.some(usesMotion)) motion = true;
|
|
340
368
|
if (devices.some(usesLoop)) loops = true;
|
|
369
|
+
if (devices.some(usesSticky)) sticky = true;
|
|
341
370
|
if (
|
|
342
371
|
!entrances.includes(rule.selector) &&
|
|
343
372
|
devices.flat().some((d) => d.property === "animation")
|
|
@@ -353,6 +382,7 @@ export function generateCss({
|
|
|
353
382
|
const selector = `.emvb-e-${rule.id}`;
|
|
354
383
|
if (usesMotion(query)) motion = true;
|
|
355
384
|
if (usesLoop(query)) loops = true;
|
|
385
|
+
if (usesSticky(query)) sticky = true;
|
|
356
386
|
if (!entrances.includes(selector) && query.some((d) => d.property === "animation")) {
|
|
357
387
|
entrances.push(selector);
|
|
358
388
|
}
|
|
@@ -366,7 +396,9 @@ export function generateCss({
|
|
|
366
396
|
: "",
|
|
367
397
|
entrances.length > 0 && motion ? MOTION_KEYFRAMES : "",
|
|
368
398
|
entrances.length > 0 && loops ? LOOP_KEYFRAMES : "",
|
|
399
|
+
entrances.length > 0 && sticky ? STICKY_KEYFRAMES : "",
|
|
369
400
|
block(".emvb-root", variables),
|
|
401
|
+
darkCss(colors),
|
|
370
402
|
defaultsCss,
|
|
371
403
|
backgroundVideo
|
|
372
404
|
? ".emvb-has-bg-video{position:relative;overflow:hidden}.emvb-bg-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0;pointer-events:none}.emvb-has-bg-video>:not(.emvb-bg-video){position:relative;z-index:1}" +
|
|
@@ -406,6 +438,8 @@ export function generateCss({
|
|
|
406
438
|
// W-952: list marker colour and size, and numbered steps, only on pages that use them, so
|
|
407
439
|
// every page saved before them keeps the exact CSS it had.
|
|
408
440
|
return [
|
|
441
|
+
// W-1072: the custom fonts this sheet uses, first; nothing for a design without them.
|
|
442
|
+
fontFaceCss(fonts, sheet),
|
|
409
443
|
sheet,
|
|
410
444
|
sheet.includes("--emvb-marker-") ? LIST_MARKER_CSS : "",
|
|
411
445
|
listSteps ? LIST_STEPS_CSS : "",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W-1038: how a Counter writes its number. Shared by the renderer and the opt-in counter runtime,
|
|
3
|
+
* so the count-up ends on exactly the text the page was rendered with.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** `value` with `decimals` digits after a "." and `separator` between thousands. */
|
|
7
|
+
export function formatCounter(value: number, decimals = 0, separator = ""): string {
|
|
8
|
+
const fixed = Math.abs(value).toFixed(decimals);
|
|
9
|
+
const [whole = "0", fraction] = fixed.split(".");
|
|
10
|
+
const grouped = separator ? whole.replace(/\B(?=(\d{3})+(?!\d))/g, separator) : whole;
|
|
11
|
+
// With "." between thousands, the decimal mark is ",", as people write it.
|
|
12
|
+
const mark = separator === "." ? "," : ".";
|
|
13
|
+
const sign = value < 0 && Number(fixed) !== 0 ? "-" : "";
|
|
14
|
+
return `${sign}${grouped}${fraction === undefined ? "" : `${mark}${fraction}`}`;
|
|
15
|
+
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { selectPrompt } from "./select-prompt.ts";
|
|
2
2
|
import { controlId } from "./field-id.ts";
|
|
3
|
+
import { typedInputAttrs } from "./input-limits.ts";
|
|
3
4
|
import type {
|
|
4
5
|
CheckboxNode,
|
|
5
6
|
FormNode,
|
|
7
|
+
FormStepNode,
|
|
6
8
|
RadioNode,
|
|
7
9
|
SelectNode,
|
|
8
10
|
SubmitNode,
|
|
9
11
|
TextInputNode,
|
|
10
12
|
TextareaNode,
|
|
11
13
|
} from "../schema/layout.ts";
|
|
14
|
+
import { MAX_INPUT_NUMBER } from "../schema/layout.ts";
|
|
12
15
|
import type { VNode } from "../render/vnode.ts";
|
|
13
16
|
import type { ElementDescriptor } from "../schema/descriptors.ts";
|
|
14
17
|
import type { ElementDefinition } from "./definition.ts";
|
|
@@ -57,6 +60,20 @@ export const form: ElementDefinition<FormNode> = {
|
|
|
57
60
|
defaults: () => ({ type: "form", props: { formId: "" }, children: [] }),
|
|
58
61
|
descriptor: fieldDescriptor("form", "Form", [
|
|
59
62
|
{ key: "formId", kind: "text", label: "Form id", message: "Paste a forms-plugin form id." },
|
|
63
|
+
{
|
|
64
|
+
key: "nextLabel",
|
|
65
|
+
kind: "text",
|
|
66
|
+
label: "Next button",
|
|
67
|
+
optional: true,
|
|
68
|
+
message: 'For a form with steps. Leave it empty for "Next".',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "prevLabel",
|
|
72
|
+
kind: "text",
|
|
73
|
+
label: "Previous button",
|
|
74
|
+
optional: true,
|
|
75
|
+
message: 'For a form with steps. Leave it empty for "Previous".',
|
|
76
|
+
},
|
|
60
77
|
]),
|
|
61
78
|
build: (_node, attrs, children) => ({
|
|
62
79
|
tag: "form",
|
|
@@ -65,6 +82,44 @@ export const form: ElementDefinition<FormNode> = {
|
|
|
65
82
|
}),
|
|
66
83
|
};
|
|
67
84
|
|
|
85
|
+
/**
|
|
86
|
+
* W-1065: a form step. The form renders it as a page of the forms plugin's multi-page markup
|
|
87
|
+
* (`data-page`, render/form.ts); on its own it is a fieldset named by its title.
|
|
88
|
+
*/
|
|
89
|
+
export const formStep: ElementDefinition<FormStepNode> = {
|
|
90
|
+
baseCss:
|
|
91
|
+
".emvb-form-step{display:flex;flex-direction:column;gap:12px;min-width:0;margin:0;padding:0;border:0}.emvb-form-step[hidden]{display:none!important}.emvb-form-step:focus{outline:none}" +
|
|
92
|
+
":where(.emvb-form-step-title){float:left;width:100%;margin:0 0 4px;padding:0;font-weight:700;font-size:1.125em}" +
|
|
93
|
+
".emvb-form-step-nav{display:flex;flex-wrap:wrap;gap:8px}.emvb-form-step-nav [hidden],.emvb-form .ec-form-submit[hidden]{display:none!important}" +
|
|
94
|
+
":where(.emvb-form-step-nav button){padding:.5em 1em;font:inherit;color:inherit;background:transparent;border:1px solid currentColor;border-radius:6px;cursor:pointer}" +
|
|
95
|
+
":where(.emvb-form-step-nav button:focus-visible){outline:2px solid currentColor;outline-offset:2px}" +
|
|
96
|
+
".emvb-form-step-progress{margin:0}.emvb-form-step-progress:empty{display:none}" +
|
|
97
|
+
"@media (prefers-reduced-motion:no-preference){.emvb-form-step[data-page]:not([hidden]){animation:emvb-form-step-in .2s ease-out}}@keyframes emvb-form-step-in{from{opacity:0;transform:translateY(6px)}}",
|
|
98
|
+
defaults: () => ({ type: "form-step", props: { title: "Step" }, children: [] }),
|
|
99
|
+
descriptor: fieldDescriptor("form-step", "Form step", [
|
|
100
|
+
{
|
|
101
|
+
key: "title",
|
|
102
|
+
kind: "text",
|
|
103
|
+
label: "Title",
|
|
104
|
+
optional: true,
|
|
105
|
+
message: 'Read out when the step opens. Leave it empty for "Step 2".',
|
|
106
|
+
},
|
|
107
|
+
]),
|
|
108
|
+
build: (node, attrs, children) => {
|
|
109
|
+
const title = node.props.title?.trim();
|
|
110
|
+
return {
|
|
111
|
+
tag: "fieldset",
|
|
112
|
+
attrs,
|
|
113
|
+
children: [
|
|
114
|
+
...(title
|
|
115
|
+
? [{ tag: "legend", attrs: { class: "emvb-form-step-title" }, children: [title] }]
|
|
116
|
+
: []),
|
|
117
|
+
...children,
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
68
123
|
/** Where the forms runtime writes a field's validation message. */
|
|
69
124
|
const errorSlot = (name: string, controlFor: string): VNode => ({
|
|
70
125
|
tag: "span",
|
|
@@ -146,15 +201,70 @@ const textControl = (
|
|
|
146
201
|
export const textInput: ElementDefinition<TextInputNode> = {
|
|
147
202
|
baseCss: ".emvb-text-input{display:flex;flex-direction:column;gap:4px}",
|
|
148
203
|
defaults: () => ({ type: "text-input", props: { field: "name", label: "Name" } }),
|
|
149
|
-
descriptor: fieldDescriptor("text-input", "Text input",
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
204
|
+
descriptor: fieldDescriptor("text-input", "Text input", [
|
|
205
|
+
...TEXT_FIELDS,
|
|
206
|
+
{
|
|
207
|
+
key: "inputType",
|
|
208
|
+
kind: "select",
|
|
209
|
+
label: "Asks for",
|
|
210
|
+
optional: true,
|
|
211
|
+
options: [
|
|
212
|
+
{ value: "number", label: "A number" },
|
|
213
|
+
{ value: "date", label: "A date" },
|
|
214
|
+
],
|
|
215
|
+
message: "Unset: text. A form field that is an email, number or date keeps its own type.",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
key: "min",
|
|
219
|
+
kind: "decimal",
|
|
220
|
+
label: "Lowest number",
|
|
221
|
+
optional: true,
|
|
222
|
+
min: -MAX_INPUT_NUMBER,
|
|
223
|
+
max: MAX_INPUT_NUMBER,
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
key: "max",
|
|
227
|
+
kind: "decimal",
|
|
228
|
+
label: "Highest number",
|
|
229
|
+
optional: true,
|
|
230
|
+
min: -MAX_INPUT_NUMBER,
|
|
231
|
+
max: MAX_INPUT_NUMBER,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
key: "step",
|
|
235
|
+
kind: "decimal",
|
|
236
|
+
label: "Step",
|
|
237
|
+
optional: true,
|
|
238
|
+
min: 0.000001,
|
|
239
|
+
max: MAX_INPUT_NUMBER,
|
|
240
|
+
message: "Allowed numbers go up by this much, such as 1 or 0.5. Leave it empty for any.",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
key: "minDate",
|
|
244
|
+
kind: "text",
|
|
245
|
+
label: "Earliest date",
|
|
246
|
+
optional: true,
|
|
247
|
+
message: "As YYYY-MM-DD, such as 2026-01-31.",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
key: "maxDate",
|
|
251
|
+
kind: "text",
|
|
252
|
+
label: "Latest date",
|
|
253
|
+
optional: true,
|
|
254
|
+
message: "As YYYY-MM-DD, such as 2026-12-31.",
|
|
255
|
+
},
|
|
256
|
+
]),
|
|
257
|
+
build: (node, attrs) => {
|
|
258
|
+
const control = textControl("input", node.props, controlId(node.id));
|
|
259
|
+
const type = node.props.inputType;
|
|
260
|
+
const typed: VNode = type
|
|
261
|
+
? {
|
|
262
|
+
...control,
|
|
263
|
+
attrs: { ...control.attrs, type, ...typedInputAttrs(type, node.props) },
|
|
264
|
+
}
|
|
265
|
+
: control;
|
|
266
|
+
return fieldWrap(controlId(node.id), node.props.field, node.props.label, typed, attrs);
|
|
267
|
+
},
|
|
158
268
|
};
|
|
159
269
|
|
|
160
270
|
export const textareaEl: ElementDefinition<TextareaNode> = {
|
|
@@ -92,6 +92,18 @@ function pickedIconAttrs(attrs: Record<string, string>): Record<string, string>
|
|
|
92
92
|
* W-1020: an icon's `<svg>` at `size` px with `aria` (its name, or `aria-hidden`), or undefined
|
|
93
93
|
* when the id is unknown and no SVG is stored.
|
|
94
94
|
*/
|
|
95
|
+
/**
|
|
96
|
+
* W-1079: an icon that points along the reading direction (an arrow, chevron, caret or angle to
|
|
97
|
+
* the left or right). On a right-to-left page it is mirrored, so "next" still points forward.
|
|
98
|
+
*/
|
|
99
|
+
export function isDirectionalIcon(iconId: string): boolean {
|
|
100
|
+
const name = (iconId.split(":").pop() ?? "").toLowerCase();
|
|
101
|
+
return (
|
|
102
|
+
/(^|[-_])(arrows?|chevrons?|carets?|angles?|triangle)([-_]|$)/.test(name) &&
|
|
103
|
+
/(^|[-_])(left|right)([-_]|$)/.test(name)
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
95
107
|
export function iconGlyph(
|
|
96
108
|
props: { iconId: string; iconSvg?: string | undefined; singleColor?: boolean | undefined },
|
|
97
109
|
size: number,
|
|
@@ -129,6 +141,8 @@ export function iconGlyph(
|
|
|
129
141
|
children: [],
|
|
130
142
|
}));
|
|
131
143
|
strokeClass(svgAttrs);
|
|
144
|
+
if (isDirectionalIcon(props.iconId))
|
|
145
|
+
svgAttrs.class = svgAttrs.class ? `${svgAttrs.class} emvb-icon-dir` : "emvb-icon-dir";
|
|
132
146
|
const single = picked !== undefined && props.singleColor === true;
|
|
133
147
|
if (single) monochromeRoot(svgAttrs);
|
|
134
148
|
return { tag: "svg", attrs: svgAttrs, children: single ? monochrome(children) : children };
|
|
@@ -36,9 +36,26 @@ import { resolveEmbedUrl } from "../sanitize/embed-url.ts";
|
|
|
36
36
|
import type { VNode } from "../render/vnode.ts";
|
|
37
37
|
|
|
38
38
|
import type { ElementDefinition } from "./definition.ts";
|
|
39
|
-
import { ICON_STROKE_WIDTHS, iconGlyph } from "./icon-svg.ts";
|
|
39
|
+
import { ICON_STROKE_WIDTHS, iconGlyph, isDirectionalIcon } from "./icon-svg.ts";
|
|
40
40
|
export { iconHasAdjustableStroke, iconHasOwnColors } from "./icon-svg.ts";
|
|
41
41
|
import { menu, menuItem } from "./menu.ts";
|
|
42
|
+
import { searchForm, themeToggle } from "./site.ts";
|
|
43
|
+
import {
|
|
44
|
+
countdown,
|
|
45
|
+
counter,
|
|
46
|
+
cta,
|
|
47
|
+
flipBox,
|
|
48
|
+
headline,
|
|
49
|
+
map,
|
|
50
|
+
priceList,
|
|
51
|
+
priceListItem,
|
|
52
|
+
priceTable,
|
|
53
|
+
hotspot,
|
|
54
|
+
hotspots,
|
|
55
|
+
progress,
|
|
56
|
+
shareButtons,
|
|
57
|
+
shareLink,
|
|
58
|
+
} from "./marketing.ts";
|
|
42
59
|
import {
|
|
43
60
|
alert,
|
|
44
61
|
carousel,
|
|
@@ -52,7 +69,16 @@ import {
|
|
|
52
69
|
socialLink,
|
|
53
70
|
testimonial,
|
|
54
71
|
} from "./widgets.ts";
|
|
55
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
checkbox,
|
|
74
|
+
form,
|
|
75
|
+
formStep,
|
|
76
|
+
radio,
|
|
77
|
+
selectEl,
|
|
78
|
+
submit,
|
|
79
|
+
textInput,
|
|
80
|
+
textareaEl,
|
|
81
|
+
} from "./form-elements.ts";
|
|
56
82
|
import {
|
|
57
83
|
loop,
|
|
58
84
|
loopEmpty,
|
|
@@ -300,7 +326,7 @@ const link: ElementDefinition<LinkNode> = {
|
|
|
300
326
|
const button: ElementDefinition<ButtonNode> = {
|
|
301
327
|
baseCss:
|
|
302
328
|
// The look sits in :where() so site tag defaults, classes and local styles all win (W-148).
|
|
303
|
-
".emvb-button{display:inline-flex;align-items:center;justify-content:center;gap:0.5em;overflow-wrap:anywhere;text-align:center;margin:0;font:inherit;text-decoration:none;cursor:pointer}:where(.emvb-button){color:inherit;background:transparent;border:1px solid currentColor;border-radius:6px;padding:0.625em 1.25em;line-height:1.2}.emvb-button-icon{display:inline-flex;flex:none}.emvb-button-icon svg{width:100%;height:100%;display:block}.emvb-button-icon--sm{width:1em;height:1em}.emvb-button-icon--md{width:1.25em;height:1.25em}.emvb-button-icon--lg{width:1.5em;height:1.5em}",
|
|
329
|
+
".emvb-button{display:inline-flex;align-items:center;justify-content:center;gap:0.5em;overflow-wrap:anywhere;text-align:center;margin:0;font:inherit;text-decoration:none;cursor:pointer}:where(.emvb-button){color:inherit;background:transparent;border:1px solid currentColor;border-radius:6px;padding:0.625em 1.25em;line-height:1.2}.emvb-button-icon{display:inline-flex;flex:none}.emvb-button-icon svg{width:100%;height:100%;display:block}.emvb-button-icon--sm{width:1em;height:1em}.emvb-button-icon--md{width:1.25em;height:1.25em}.emvb-button-icon--lg{width:1.5em;height:1.5em}.emvb-icon-dir:dir(rtl){transform:scaleX(-1)}",
|
|
304
330
|
defaults: () => ({ type: "button", props: { text: "Button" } }),
|
|
305
331
|
descriptor: {
|
|
306
332
|
type: "button",
|
|
@@ -388,6 +414,10 @@ function buttonChildren(node: ButtonNode): (VNode | string)[] {
|
|
|
388
414
|
children: [],
|
|
389
415
|
})),
|
|
390
416
|
};
|
|
417
|
+
// W-1079: an arrow points forward on a right-to-left page too, as on an Icon.
|
|
418
|
+
if (node.props.iconId && isDirectionalIcon(node.props.iconId)) {
|
|
419
|
+
svg.attrs.class = svg.attrs.class ? `${svg.attrs.class} emvb-icon-dir` : "emvb-icon-dir";
|
|
420
|
+
}
|
|
391
421
|
const size = node.props.iconSize ?? "md";
|
|
392
422
|
const icon: VNode = {
|
|
393
423
|
tag: "span",
|
|
@@ -628,12 +658,15 @@ const icon: ElementDefinition<IconNode> = {
|
|
|
628
658
|
// W-237: the glyph reads the wrapper's icon custom properties (rotate, flip, shadow, loop,
|
|
629
659
|
// stroke); unset they change nothing. The svg inherits the wrapper's transition for hover.
|
|
630
660
|
// W-803: an icon larger than its box (512 px on a phone) shrinks to fit, keeping its shape.
|
|
661
|
+
// W-1079: the right-to-left mirror is a transform, and the spin and pulse keyframes set
|
|
662
|
+
// transform too; `add` composes them onto the mirror instead of dropping it while animating
|
|
663
|
+
// (`scale` already holds the Flip setting, so the mirror can't go there).
|
|
631
664
|
".emvb-icon{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}.emvb-icon-link{display:inline-flex;max-width:100%;color:inherit}.emvb-icon svg{display:block;max-width:100%;rotate:var(--emvb-icon-rotate,0deg);scale:var(--emvb-icon-flip,1 1);filter:var(--emvb-icon-shadow,none);animation:var(--emvb-icon-animation,none);transition:inherit}" +
|
|
632
665
|
ICON_STROKE_WIDTHS.map(
|
|
633
666
|
(width) =>
|
|
634
667
|
`.emvb-icon-sw${width.replace(".", "_")}{stroke-width:var(--emvb-icon-stroke,${width})}`,
|
|
635
668
|
).join("") +
|
|
636
|
-
"@keyframes emvb-icon-spin{to{transform:rotate(360deg)}}@keyframes emvb-icon-pulse{from{transform:scale(1)}to{transform:scale(1.15)}}@media (prefers-reduced-motion: reduce){.emvb-icon svg{animation:none}}.emvb-icon-missing{min-width:1em;min-height:1em;background:var(--color-kumo-tint,#eee)}",
|
|
669
|
+
"@keyframes emvb-icon-spin{to{transform:rotate(360deg)}}@keyframes emvb-icon-pulse{from{transform:scale(1)}to{transform:scale(1.15)}}@media (prefers-reduced-motion: reduce){.emvb-icon svg{animation:none}}.emvb-icon-dir:dir(rtl){transform:scaleX(-1)}.emvb-icon svg.emvb-icon-dir{animation-composition:add}.emvb-icon-missing{min-width:1em;min-height:1em;background:var(--color-kumo-tint,#eee)}",
|
|
637
670
|
defaults: () => ({
|
|
638
671
|
type: "icon",
|
|
639
672
|
props: { iconId: "star", title: "Star", decorative: false, size: 24 },
|
|
@@ -1124,6 +1157,22 @@ export const ELEMENTS = {
|
|
|
1124
1157
|
"gallery-image": galleryImage,
|
|
1125
1158
|
carousel,
|
|
1126
1159
|
"carousel-slide": carouselSlide,
|
|
1160
|
+
counter,
|
|
1161
|
+
progress,
|
|
1162
|
+
countdown,
|
|
1163
|
+
map,
|
|
1164
|
+
"price-table": priceTable,
|
|
1165
|
+
"price-list": priceList,
|
|
1166
|
+
"price-list-item": priceListItem,
|
|
1167
|
+
cta,
|
|
1168
|
+
"flip-box": flipBox,
|
|
1169
|
+
headline,
|
|
1170
|
+
"share-buttons": shareButtons,
|
|
1171
|
+
"share-link": shareLink,
|
|
1172
|
+
hotspots,
|
|
1173
|
+
hotspot,
|
|
1174
|
+
"search-form": searchForm,
|
|
1175
|
+
"theme-toggle": themeToggle,
|
|
1127
1176
|
container,
|
|
1128
1177
|
"layout-section": layoutSection,
|
|
1129
1178
|
spacer,
|
|
@@ -1137,6 +1186,7 @@ export const ELEMENTS = {
|
|
|
1137
1186
|
icon,
|
|
1138
1187
|
video,
|
|
1139
1188
|
form,
|
|
1189
|
+
"form-step": formStep,
|
|
1140
1190
|
"text-input": textInput,
|
|
1141
1191
|
textarea: textareaEl,
|
|
1142
1192
|
select: selectEl,
|