@perkyzz/emvb 1.1.0 → 1.3.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/THIRD_PARTY_NOTICES.md +3 -2
- package/package.json +11 -10
- package/src/admin/agents-api.ts +5 -1
- package/src/admin/content-api.ts +29 -0
- package/src/admin/editor/Editor.tsx +6 -1
- package/src/admin/editor/ScheduleDialog.tsx +167 -0
- package/src/admin/editor/TopBar.tsx +33 -1
- package/src/admin/editor/canvas/vnode-react.tsx +3 -0
- package/src/admin/editor/dnd/new-element.ts +106 -0
- package/src/admin/editor/editor-chrome.tsx +9 -0
- package/src/admin/editor/element-chrome.ts +50 -0
- package/src/admin/editor/panels/ElementPanel.tsx +5 -1
- package/src/admin/editor/panels/settings/DraftTextField.tsx +33 -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/IconPicker.tsx +4 -1
- package/src/admin/editor/panels/settings/ItemList.tsx +69 -2
- package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
- package/src/admin/editor/store.ts +7 -1
- package/src/admin/editor/useEditorData.ts +4 -0
- package/src/admin/editor/useSave.ts +47 -3
- package/src/admin/export-api.ts +20 -3
- package/src/admin/menus-api.ts +113 -0
- package/src/admin/pages/ImportElementorDialog.tsx +25 -1
- package/src/astro/EmVBPage.astro +3 -0
- package/src/astro/render.ts +43 -18
- package/src/astro/request-data.ts +9 -0
- package/src/astro/resolve-theme.ts +77 -44
- package/src/astro/resolve.ts +9 -0
- 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/EmVBCountdownRuntime.astro +8 -0
- package/src/astro/widgets/EmVBCounterRuntime.astro +8 -0
- package/src/astro/widgets/EmVBHeadlineRuntime.astro +9 -0
- package/src/astro/widgets/EmVBLightboxRuntime.astro +8 -0
- package/src/astro/widgets/EmVBMapRuntime.astro +8 -0
- package/src/astro/widgets/EmVBShareRuntime.astro +9 -0
- package/src/astro/widgets/EmVBWidgetRuntimes.astro +29 -0
- package/src/astro/widgets/alerts.ts +37 -0
- package/src/astro/widgets/carousel.ts +167 -0
- package/src/astro/widgets/countdown.ts +80 -0
- package/src/astro/widgets/counter.ts +98 -0
- package/src/astro/widgets/headline.ts +90 -0
- package/src/astro/widgets/index.ts +1 -0
- package/src/astro/widgets/lightbox.ts +123 -0
- package/src/astro/widgets/map.ts +37 -0
- package/src/astro/widgets/share.ts +21 -0
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +127 -5
- package/src/core/arrange.ts +109 -1
- package/src/core/bounded-array.ts +16 -13
- package/src/core/canvas-collections.ts +28 -0
- package/src/core/contract.ts +4 -1
- package/src/core/elements/counter-format.ts +15 -0
- package/src/core/elements/icon-svg.ts +135 -0
- package/src/core/elements/index.ts +63 -127
- package/src/core/elements/marketing.ts +1490 -0
- package/src/core/elements/widgets.ts +932 -0
- package/src/core/export/runtimes.generated.ts +8 -0
- package/src/core/export/site.ts +25 -3
- package/src/core/extensions/schema.ts +2 -1
- package/src/core/geo-trust.ts +18 -0
- package/src/core/icons/social.generated.ts +29 -0
- package/src/core/image-edit/schema.ts +2 -1
- package/src/core/import/elementor/context.ts +18 -0
- package/src/core/import/elementor/index.ts +50 -7
- package/src/core/import/elementor/widgets.ts +783 -385
- package/src/core/issue-cap.ts +19 -0
- package/src/core/limits.ts +12 -0
- package/src/core/loop-collections.ts +33 -0
- package/src/core/proposals.ts +8 -2
- package/src/core/render/index.ts +48 -5
- package/src/core/render/vnode.ts +44 -6
- 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 +6 -5
- package/src/core/schema/layout.ts +798 -15
- package/src/core/schema/style.ts +2 -1
- package/src/core/shadowing-ids.ts +41 -0
- package/src/core/theme/conditions.ts +2 -1
- package/src/core/theme/dynamic.ts +2 -0
- package/src/core/theme/parse-doc.ts +10 -5
- 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/tools.ts +1 -1
- package/src/server/agent-settings.ts +12 -1
- package/src/server/hooks.ts +41 -6
- package/src/server/mcp-routes.ts +11 -5
- package/src/server/plugin.ts +29 -3
- 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
|
@@ -36,7 +36,38 @@ 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";
|
|
40
|
+
export { iconHasAdjustableStroke, iconHasOwnColors } from "./icon-svg.ts";
|
|
39
41
|
import { menu, menuItem } from "./menu.ts";
|
|
42
|
+
import {
|
|
43
|
+
countdown,
|
|
44
|
+
counter,
|
|
45
|
+
cta,
|
|
46
|
+
flipBox,
|
|
47
|
+
headline,
|
|
48
|
+
map,
|
|
49
|
+
priceList,
|
|
50
|
+
priceListItem,
|
|
51
|
+
priceTable,
|
|
52
|
+
hotspot,
|
|
53
|
+
hotspots,
|
|
54
|
+
progress,
|
|
55
|
+
shareButtons,
|
|
56
|
+
shareLink,
|
|
57
|
+
} from "./marketing.ts";
|
|
58
|
+
import {
|
|
59
|
+
alert,
|
|
60
|
+
carousel,
|
|
61
|
+
carouselSlide,
|
|
62
|
+
gallery,
|
|
63
|
+
galleryImage,
|
|
64
|
+
iconBox,
|
|
65
|
+
imageBox,
|
|
66
|
+
rating,
|
|
67
|
+
socialIcons,
|
|
68
|
+
socialLink,
|
|
69
|
+
testimonial,
|
|
70
|
+
} from "./widgets.ts";
|
|
40
71
|
import { checkbox, form, radio, selectEl, submit, textInput, textareaEl } from "./form-elements.ts";
|
|
41
72
|
import {
|
|
42
73
|
loop,
|
|
@@ -608,9 +639,6 @@ function imageSources(
|
|
|
608
639
|
return parts.join(", ");
|
|
609
640
|
}
|
|
610
641
|
|
|
611
|
-
/** Root stroke widths the Stroke width control can override (W-237); Lucide and Tabler use 2. */
|
|
612
|
-
const ICON_STROKE_WIDTHS = ["1", "1.5", "2", "2.5", "3"] as const;
|
|
613
|
-
|
|
614
642
|
const icon: ElementDefinition<IconNode> = {
|
|
615
643
|
baseCss:
|
|
616
644
|
// W-237: the glyph reads the wrapper's icon custom properties (rotate, flip, shadow, loop,
|
|
@@ -651,10 +679,12 @@ const icon: ElementDefinition<IconNode> = {
|
|
|
651
679
|
],
|
|
652
680
|
},
|
|
653
681
|
build: (node, attrs) => {
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
682
|
+
const decorative = node.props.decorative === true;
|
|
683
|
+
const aria: Record<string, string> = decorative
|
|
684
|
+
? { "aria-hidden": "true" }
|
|
685
|
+
: { role: "img", ...(node.props.title ? { "aria-label": node.props.title } : {}) };
|
|
686
|
+
const svg = iconGlyph(node.props, node.props.size ?? 24, aria);
|
|
687
|
+
if (!svg) {
|
|
658
688
|
// Never treat iconId as a URL or raw HTML (R-032 / R-033).
|
|
659
689
|
return {
|
|
660
690
|
tag: "span",
|
|
@@ -666,48 +696,7 @@ const icon: ElementDefinition<IconNode> = {
|
|
|
666
696
|
children: [],
|
|
667
697
|
};
|
|
668
698
|
}
|
|
669
|
-
const
|
|
670
|
-
const size = node.props.size ?? 24;
|
|
671
|
-
const svgAttrs: Record<string, string> = picked
|
|
672
|
-
? {
|
|
673
|
-
...pickedIconAttrs(picked.attrs),
|
|
674
|
-
width: String(size),
|
|
675
|
-
height: String(size),
|
|
676
|
-
focusable: "false",
|
|
677
|
-
}
|
|
678
|
-
: {
|
|
679
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
680
|
-
width: String(size),
|
|
681
|
-
height: String(size),
|
|
682
|
-
viewBox: "0 0 24 24",
|
|
683
|
-
fill: "none",
|
|
684
|
-
stroke: "currentColor",
|
|
685
|
-
"stroke-width": "2",
|
|
686
|
-
"stroke-linecap": "round",
|
|
687
|
-
"stroke-linejoin": "round",
|
|
688
|
-
focusable: "false",
|
|
689
|
-
};
|
|
690
|
-
if (decorative) {
|
|
691
|
-
svgAttrs["aria-hidden"] = "true";
|
|
692
|
-
} else {
|
|
693
|
-
svgAttrs.role = "img";
|
|
694
|
-
if (node.props.title) svgAttrs["aria-label"] = node.props.title;
|
|
695
|
-
}
|
|
696
|
-
const children: (VNode | string)[] = picked
|
|
697
|
-
? picked.children
|
|
698
|
-
: (bundled?.children ?? []).map((child) => ({
|
|
699
|
-
tag: child.tag,
|
|
700
|
-
attrs: { ...child.attrs },
|
|
701
|
-
children: [],
|
|
702
|
-
}));
|
|
703
|
-
strokeClass(svgAttrs);
|
|
704
|
-
const single = picked !== undefined && node.props.singleColor === true;
|
|
705
|
-
if (single) monochromeRoot(svgAttrs);
|
|
706
|
-
const svg: VNode = {
|
|
707
|
-
tag: "svg",
|
|
708
|
-
attrs: svgAttrs,
|
|
709
|
-
children: single ? monochrome(children) : children,
|
|
710
|
-
};
|
|
699
|
+
const svgAttrs = svg.attrs;
|
|
711
700
|
// A linked icon is named by its title on the link, so the svg inside is hidden.
|
|
712
701
|
const title = node.props.title?.trim();
|
|
713
702
|
const { role: _role, "aria-label": _label, ...plain } = svgAttrs;
|
|
@@ -721,84 +710,6 @@ const icon: ElementDefinition<IconNode> = {
|
|
|
721
710
|
},
|
|
722
711
|
};
|
|
723
712
|
|
|
724
|
-
/**
|
|
725
|
-
* W-237: a stroke icon's root `stroke-width` moves into a class whose CSS reads the wrapper's
|
|
726
|
-
* `--emvb-icon-stroke` with the original width as fallback; any other width stays as it was.
|
|
727
|
-
*/
|
|
728
|
-
function strokeClass(svgAttrs: Record<string, string>): void {
|
|
729
|
-
const width = svgAttrs["stroke-width"];
|
|
730
|
-
if (!width || !(ICON_STROKE_WIDTHS as readonly string[]).includes(width)) return;
|
|
731
|
-
if (!svgAttrs.stroke || svgAttrs.stroke === "none") return;
|
|
732
|
-
delete svgAttrs["stroke-width"];
|
|
733
|
-
const cls = `emvb-icon-sw${width.replace(".", "_")}`;
|
|
734
|
-
svgAttrs.class = svgAttrs.class ? `${svgAttrs.class} ${cls}` : cls;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
/** Whether an icon's SVG is stroke-drawn with an adjustable width (the panel shows the control). */
|
|
738
|
-
export function iconHasAdjustableStroke(svg: string | undefined): boolean {
|
|
739
|
-
if (!svg) return true; // bundled Lucide
|
|
740
|
-
const picked = sanitizeSvgMarkup(svg);
|
|
741
|
-
if (!picked) return false;
|
|
742
|
-
const attrs = pickedIconAttrs(picked.attrs);
|
|
743
|
-
const before = attrs["stroke-width"];
|
|
744
|
-
strokeClass(attrs);
|
|
745
|
-
return before !== undefined && attrs["stroke-width"] === undefined;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
/** Paint attributes a multi-colour SVG sets its colours with (W-238). */
|
|
749
|
-
const PAINT_ATTRS = ["fill", "stroke", "stop-color"] as const;
|
|
750
|
-
|
|
751
|
-
const ownColor = (value: string | undefined) =>
|
|
752
|
-
value !== undefined && value !== "none" && value.toLowerCase() !== "currentcolor";
|
|
753
|
-
|
|
754
|
-
/** W-238: every fill, stroke and gradient stop becomes the icon's colour; `none` stays none. */
|
|
755
|
-
function monochrome(nodes: (VNode | string)[]): (VNode | string)[] {
|
|
756
|
-
return nodes.map((child) => {
|
|
757
|
-
if (typeof child === "string") return child;
|
|
758
|
-
const attrs = { ...child.attrs };
|
|
759
|
-
for (const name of PAINT_ATTRS) if (ownColor(attrs[name])) attrs[name] = "currentColor";
|
|
760
|
-
return { ...child, attrs, children: monochrome(child.children) };
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/** The root too; without a fill, SVG paints black, so it gets the icon's colour. */
|
|
765
|
-
function monochromeRoot(attrs: Record<string, string>): void {
|
|
766
|
-
if (attrs.fill === undefined || ownColor(attrs.fill)) attrs.fill = "currentColor";
|
|
767
|
-
if (ownColor(attrs.stroke)) attrs.stroke = "currentColor";
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Whether an icon's SVG paints with its own colours (W-238): any fill, stroke or stop other than
|
|
772
|
-
* `none`/`currentColor`, or a root without a fill (SVG's default is black). The panel offers
|
|
773
|
-
* Force single colour only then. Bundled Lucide icons follow the icon's colour already.
|
|
774
|
-
*/
|
|
775
|
-
export function iconHasOwnColors(svg: string | undefined): boolean {
|
|
776
|
-
if (!svg) return false;
|
|
777
|
-
const picked = sanitizeSvgMarkup(svg);
|
|
778
|
-
if (!picked) return false;
|
|
779
|
-
if (picked.attrs.fill === undefined || PAINT_ATTRS.some((name) => ownColor(picked.attrs[name])))
|
|
780
|
-
return true;
|
|
781
|
-
const walk = (nodes: (VNode | string)[]): boolean =>
|
|
782
|
-
nodes.some(
|
|
783
|
-
(child) =>
|
|
784
|
-
typeof child !== "string" &&
|
|
785
|
-
(PAINT_ATTRS.some((name) => ownColor(child.attrs[name])) || walk(child.children)),
|
|
786
|
-
);
|
|
787
|
-
return walk(picked.children);
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
/** A picked icon's root attributes minus what the element sets itself (size, name, id). */
|
|
791
|
-
function pickedIconAttrs(attrs: Record<string, string>): Record<string, string> {
|
|
792
|
-
const kept: Record<string, string> = { xmlns: "http://www.w3.org/2000/svg" };
|
|
793
|
-
for (const [name, value] of Object.entries(attrs)) {
|
|
794
|
-
if (name === "width" || name === "height" || name === "id" || name === "role") continue;
|
|
795
|
-
if (name.startsWith("aria-") || name === "focusable") continue;
|
|
796
|
-
kept[name] = value;
|
|
797
|
-
}
|
|
798
|
-
if (!kept.viewBox) kept.viewBox = "0 0 24 24";
|
|
799
|
-
return kept;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
713
|
const video: ElementDefinition<VideoNode> = {
|
|
803
714
|
baseCss:
|
|
804
715
|
// W-266: the iframe or <video> is the .emvb-video element itself, so the 16:9 size sits on it
|
|
@@ -1218,6 +1129,31 @@ export const ELEMENTS = {
|
|
|
1218
1129
|
heading,
|
|
1219
1130
|
toc,
|
|
1220
1131
|
"language-switcher": languageSwitcher,
|
|
1132
|
+
rating,
|
|
1133
|
+
alert,
|
|
1134
|
+
"icon-box": iconBox,
|
|
1135
|
+
"image-box": imageBox,
|
|
1136
|
+
testimonial,
|
|
1137
|
+
"social-icons": socialIcons,
|
|
1138
|
+
"social-link": socialLink,
|
|
1139
|
+
gallery,
|
|
1140
|
+
"gallery-image": galleryImage,
|
|
1141
|
+
carousel,
|
|
1142
|
+
"carousel-slide": carouselSlide,
|
|
1143
|
+
counter,
|
|
1144
|
+
progress,
|
|
1145
|
+
countdown,
|
|
1146
|
+
map,
|
|
1147
|
+
"price-table": priceTable,
|
|
1148
|
+
"price-list": priceList,
|
|
1149
|
+
"price-list-item": priceListItem,
|
|
1150
|
+
cta,
|
|
1151
|
+
"flip-box": flipBox,
|
|
1152
|
+
headline,
|
|
1153
|
+
"share-buttons": shareButtons,
|
|
1154
|
+
"share-link": shareLink,
|
|
1155
|
+
hotspots,
|
|
1156
|
+
hotspot,
|
|
1221
1157
|
container,
|
|
1222
1158
|
"layout-section": layoutSection,
|
|
1223
1159
|
spacer,
|