@perkyzz/emvb 1.3.0 → 1.4.1
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/package.json +2 -2
- package/src/admin/bulk-api.ts +5 -1
- package/src/admin/content-item.ts +3 -0
- package/src/admin/copy-rich-text.ts +99 -9
- package/src/admin/editor/A11yCopilot.tsx +3 -1
- package/src/admin/editor/Editor.tsx +28 -3
- 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 +2 -0
- package/src/admin/editor/co-design.ts +36 -1
- package/src/admin/editor/collection-previews.ts +7 -8
- 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 +16 -0
- package/src/admin/editor/editor-css.ts +9 -1
- package/src/admin/editor/element-chrome.ts +6 -0
- package/src/admin/editor/extensions/ExtensionPanels.tsx +33 -1
- package/src/admin/editor/extensions-context.tsx +16 -1
- package/src/admin/editor/feature-css.ts +27 -0
- package/src/admin/editor/inert-links.ts +8 -0
- package/src/admin/editor/panels/ColorControl.tsx +2 -2
- package/src/admin/editor/panels/ConditionsEditor.tsx +18 -0
- package/src/admin/editor/panels/ElementPanel.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 +33 -0
- package/src/admin/editor/panels/settings/FormBindControl.tsx +27 -31
- package/src/admin/editor/panels/settings/ImageFieldControl.tsx +106 -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/loop-context.ts +34 -3
- 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 +27 -2
- package/src/admin/extension-outputs.ts +236 -0
- package/src/admin/font-files-api.ts +38 -0
- package/src/admin/import-forms.ts +133 -0
- package/src/admin/pages/ImportButton.tsx +15 -4
- package/src/admin/pages/ImportElementorDialog.tsx +53 -187
- package/src/admin/pages/ImportForms.tsx +71 -0
- 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/admin/setup/plan.ts +2 -0
- package/src/admin/ui.ts +7 -0
- package/src/admin/widgets/ConvertToRichText.tsx +3 -2
- 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 +25 -4
- package/src/astro/resolve-theme.ts +11 -4
- package/src/astro/resolve.ts +2 -0
- package/src/astro/theme-posts.ts +17 -23
- package/src/astro/visitor.ts +14 -5
- package/src/astro/widgets/EmVBStickyRuntime.astro +9 -0
- package/src/astro/widgets/EmVBThemeRuntime.astro +9 -0
- package/src/astro/widgets/EmVBWidgetRuntimes.astro +12 -0
- package/src/astro/widgets/alerts.ts +16 -2
- package/src/astro/widgets/carousel.ts +65 -24
- package/src/astro/widgets/countdown.ts +18 -7
- package/src/astro/widgets/extension-runtimes.ts +27 -0
- package/src/astro/widgets/headline.ts +14 -5
- 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 +150 -2
- package/src/core/arrange.ts +19 -1
- package/src/core/css/font-face.ts +72 -0
- package/src/core/css/generate.ts +41 -2
- package/src/core/css/trace.ts +8 -0
- package/src/core/data/bindings.ts +7 -4
- package/src/core/elements/dynamic-elements.ts +1 -1
- package/src/core/elements/element-nouns.ts +48 -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 +24 -4
- package/src/core/elements/input-limits.ts +44 -0
- package/src/core/elements/menu.ts +109 -47
- package/src/core/elements/site.ts +108 -0
- package/src/core/elements/widgets.ts +13 -3
- package/src/core/export/runtimes.generated.ts +7 -5
- package/src/core/export/site.ts +53 -4
- package/src/core/extensions/classes.ts +114 -0
- package/src/core/extensions/index.ts +19 -2
- package/src/core/extensions/normalize.ts +13 -0
- package/src/core/extensions/placeholder.ts +7 -2
- package/src/core/extensions/registry.ts +134 -10
- package/src/core/extensions/render-ext.ts +115 -36
- 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 +42 -4
- package/src/core/import/elementor/index.ts +55 -23
- package/src/core/import/elementor/widgets.ts +242 -20
- 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 +54 -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 +165 -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 +118 -6
- 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 +9 -6
- package/src/core/theme/media-value.ts +88 -0
- 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/core/visitor-cookie.ts +91 -0
- package/src/extension-build.ts +331 -0
- package/src/index.ts +53 -4
- package/src/mcp/agent-defaults.ts +40 -0
- package/src/mcp/brief.ts +191 -0
- package/src/mcp/extensions.ts +138 -0
- package/src/mcp/prompts.ts +33 -0
- package/src/mcp/read.ts +84 -20
- package/src/mcp/tools.ts +42 -3
- package/src/mcp/write.ts +124 -9
- package/src/server/extension-routes.ts +110 -0
- package/src/server/font-routes.ts +301 -0
- package/src/server/plugin.ts +15 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {
|
|
2
|
+
canDrop,
|
|
3
|
+
findNode,
|
|
4
|
+
isParentNode,
|
|
5
|
+
parentOf,
|
|
6
|
+
type DragSource,
|
|
7
|
+
type Layout,
|
|
8
|
+
} from "../../../core/index.ts";
|
|
9
|
+
|
|
10
|
+
/** W-1080: hovering a collapsed row this long during a drag opens it. */
|
|
11
|
+
export const EXPAND_DELAY_MS = 600;
|
|
12
|
+
/** W-1080: hovering the Layers tab this long during a drag from Add switches to it. */
|
|
13
|
+
export const TAB_SPRING_MS = 500;
|
|
14
|
+
|
|
15
|
+
/** Which part of a Layers row the pointer is over. */
|
|
16
|
+
export type LayerZone = "before" | "inside" | "after";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A row's top quarter drops before it and its bottom quarter after it; the middle half drops
|
|
20
|
+
* inside an element that holds others. Rows that hold nothing split in two. The page row always
|
|
21
|
+
* takes the drop inside.
|
|
22
|
+
*/
|
|
23
|
+
export function layerZone(
|
|
24
|
+
offsetY: number,
|
|
25
|
+
height: number,
|
|
26
|
+
holdsOthers: boolean,
|
|
27
|
+
isRoot: boolean,
|
|
28
|
+
): LayerZone {
|
|
29
|
+
if (isRoot) return "inside";
|
|
30
|
+
const part = height > 0 ? offsetY / height : 0.5;
|
|
31
|
+
if (!holdsOthers) return part < 0.5 ? "before" : "after";
|
|
32
|
+
return part < 0.25 ? "before" : part > 0.75 ? "after" : "inside";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The deepest level whose indent the pointer has passed (`x` from the row's left edge). */
|
|
36
|
+
export function depthAtX(x: number, indent: (depth: number) => number, maxDepth: number): number {
|
|
37
|
+
let depth = 0;
|
|
38
|
+
while (depth < maxDepth && x >= indent(depth + 1)) depth += 1;
|
|
39
|
+
return depth;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The row being hovered, as Layers shows it. */
|
|
43
|
+
export type LayerRowView = {
|
|
44
|
+
id: string;
|
|
45
|
+
depth: number;
|
|
46
|
+
/** Expanded with its children shown below it. */
|
|
47
|
+
open: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type LayerPlace = {
|
|
51
|
+
parentId: string;
|
|
52
|
+
index: number;
|
|
53
|
+
/** The depth the drop line is drawn at (the new element's depth). */
|
|
54
|
+
depth: number;
|
|
55
|
+
/** Line above or below the hovered row; null when the row itself is highlighted (inside). */
|
|
56
|
+
edge: "top" | "bottom" | null;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const siblingsOf = (layout: Layout, id: string) => {
|
|
60
|
+
const parentId = parentOf(layout, id);
|
|
61
|
+
const parent = parentId ? findNode(layout, parentId) : undefined;
|
|
62
|
+
return parent && isParentNode(parent)
|
|
63
|
+
? { parent, index: parent.children.findIndex((child) => child.id === id) }
|
|
64
|
+
: null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Where a drop on `row` in `zone` goes. "after" an open element goes first inside it (the line
|
|
69
|
+
* sits between it and its first child). "after" the last child can climb out `outdent` levels,
|
|
70
|
+
* as the pointer moves left, to drop after its parent instead. Null when the row is gone.
|
|
71
|
+
*/
|
|
72
|
+
export function layerPlace(
|
|
73
|
+
layout: Layout,
|
|
74
|
+
row: LayerRowView,
|
|
75
|
+
zone: LayerZone,
|
|
76
|
+
outdent = 0,
|
|
77
|
+
): LayerPlace | null {
|
|
78
|
+
const node = findNode(layout, row.id);
|
|
79
|
+
if (!node) return null;
|
|
80
|
+
if (zone === "inside" || row.id === layout.root.id) {
|
|
81
|
+
if (!isParentNode(node)) return null;
|
|
82
|
+
return { parentId: node.id, index: node.children.length, depth: row.depth + 1, edge: null };
|
|
83
|
+
}
|
|
84
|
+
if (zone === "before") {
|
|
85
|
+
const at = siblingsOf(layout, row.id);
|
|
86
|
+
return at ? { parentId: at.parent.id, index: at.index, depth: row.depth, edge: "top" } : null;
|
|
87
|
+
}
|
|
88
|
+
if (row.open && isParentNode(node) && node.children.length > 0) {
|
|
89
|
+
return { parentId: node.id, index: 0, depth: row.depth + 1, edge: "bottom" };
|
|
90
|
+
}
|
|
91
|
+
let depth = row.depth;
|
|
92
|
+
let at = siblingsOf(layout, row.id);
|
|
93
|
+
while (at && outdent > 0 && at.index === at.parent.children.length - 1) {
|
|
94
|
+
const up = siblingsOf(layout, at.parent.id);
|
|
95
|
+
if (!up) break;
|
|
96
|
+
depth -= 1;
|
|
97
|
+
outdent -= 1;
|
|
98
|
+
at = up;
|
|
99
|
+
}
|
|
100
|
+
if (!at) return null;
|
|
101
|
+
return { parentId: at.parent.id, index: at.index + 1, depth, edge: "bottom" };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type LayerDrop =
|
|
105
|
+
| { ok: true; place: LayerPlace }
|
|
106
|
+
| { ok: false; reason: string; place: LayerPlace };
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A Layers drop, checked with the canvas's own rule (`canDrop`): into itself or a descendant,
|
|
110
|
+
* a parent that refuses the child, full Tabs and the like are refused with the canvas's reason.
|
|
111
|
+
* An unknown source (the browser hides it until drop) is allowed provisionally; the drop checks
|
|
112
|
+
* again.
|
|
113
|
+
*/
|
|
114
|
+
export function resolveLayerDrop(
|
|
115
|
+
layout: Layout,
|
|
116
|
+
row: LayerRowView,
|
|
117
|
+
zone: LayerZone,
|
|
118
|
+
source: DragSource | null,
|
|
119
|
+
outdent = 0,
|
|
120
|
+
): LayerDrop | null {
|
|
121
|
+
const place = layerPlace(layout, row, zone, outdent);
|
|
122
|
+
if (!place) return null;
|
|
123
|
+
if (!source) return { ok: true, place };
|
|
124
|
+
const allowed = canDrop(layout, source, place.parentId);
|
|
125
|
+
return allowed.ok ? { ok: true, place } : { ok: false, reason: allowed.reason, place };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Pixels to scroll the panel by for a pointer near its top or bottom edge during a drag. */
|
|
129
|
+
export function autoScrollStep(
|
|
130
|
+
pointerY: number,
|
|
131
|
+
top: number,
|
|
132
|
+
bottom: number,
|
|
133
|
+
edge = 32,
|
|
134
|
+
max = 14,
|
|
135
|
+
): number {
|
|
136
|
+
if (bottom - top < edge * 3) return 0;
|
|
137
|
+
const speed = (into: number) => Math.ceil(max * Math.min(1, into / edge));
|
|
138
|
+
if (pointerY < top + edge) return -speed(top + edge - pointerY);
|
|
139
|
+
if (pointerY > bottom - edge) return speed(pointerY - (bottom - edge));
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultElement,
|
|
3
|
+
emptyDesign,
|
|
4
|
+
templateSectionNode,
|
|
3
5
|
updateNode,
|
|
4
6
|
ELEMENTS,
|
|
5
7
|
isExtensionType,
|
|
@@ -159,6 +161,15 @@ export function newGalleryImage(random?: () => number): LayoutNode {
|
|
|
159
161
|
return { id: newNodeId(random), type: "gallery-image", props: { src: "", alt: "Image" } };
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
const TEMPLATE_PREFIX = "template:";
|
|
165
|
+
|
|
166
|
+
/** W-1068: the drag type of a starter section template, carried like a new element's type. */
|
|
167
|
+
export const templateDragType = (id: string) => `${TEMPLATE_PREFIX}${id}`;
|
|
168
|
+
|
|
169
|
+
/** The template id a drag type names, or null for an element type. */
|
|
170
|
+
export const templateIdOf = (type: string): string | null =>
|
|
171
|
+
type.startsWith(TEMPLATE_PREFIX) ? type.slice(TEMPLATE_PREFIX.length) : null;
|
|
172
|
+
|
|
162
173
|
/**
|
|
163
174
|
* Default node for a new element from the Add panel. Only new inserts get starter children;
|
|
164
175
|
* saved Accordions and Tabs with no items keep working as they are (W-130).
|
|
@@ -168,6 +179,11 @@ export function newElement(
|
|
|
168
179
|
random?: () => number,
|
|
169
180
|
extensionDefaults?: Record<string, unknown>,
|
|
170
181
|
): LayoutNode | null {
|
|
182
|
+
// W-1068: a dragged starter template. Drops build it again with the site's styles.
|
|
183
|
+
const template = templateIdOf(type);
|
|
184
|
+
if (template !== null) {
|
|
185
|
+
return templateSectionNode(template, emptyDesign(), null, random ? { random } : {}) ?? null;
|
|
186
|
+
}
|
|
171
187
|
// W-927: extension elements are stored as UnknownNodes with namespaced types.
|
|
172
188
|
if (isExtensionType(type)) {
|
|
173
189
|
return {
|
|
@@ -100,6 +100,7 @@ export const EDITOR_CSS = `${UI_CSS}
|
|
|
100
100
|
.emvb-check > input { width: 16px; height: 16px; margin: 0; }
|
|
101
101
|
@keyframes emvb-panel-enter { from { opacity: 0; } to { opacity: 1; } }
|
|
102
102
|
.emvb-left-panel > [data-emvb-panel],
|
|
103
|
+
.emvb-left-panel > .emvb-add-holder > [data-emvb-panel],
|
|
103
104
|
.emvb-panel-right [data-emvb-tab],
|
|
104
105
|
.emvb-site-styles-body { animation: emvb-panel-enter 150ms cubic-bezier(0, 0, 0.2, 1); }
|
|
105
106
|
/* UX-010: a section's rows fade in as it opens (closing stays instant); the Site styles drawer slides in. */
|
|
@@ -177,7 +178,7 @@ export const EDITOR_CSS = `${UI_CSS}
|
|
|
177
178
|
.emvb-gradient-stop { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; box-shadow: inset 0 1px 0 var(--color-kumo-line); }
|
|
178
179
|
.emvb-row-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
179
180
|
.emvb-layers { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1px; }
|
|
180
|
-
.emvb-layer-row { display: flex; align-items: center; gap: 6px; width: 100%; height: var(--emvb-control); padding-
|
|
181
|
+
.emvb-layer-row { display: flex; align-items: center; gap: 6px; width: 100%; height: var(--emvb-control); padding-inline-end: 4px; border-radius: 6px; color: var(--text-color-kumo-default); font-size: 13px; }
|
|
181
182
|
.emvb-layer-select { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; height: var(--emvb-control); padding: 0 4px 0 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
|
|
182
183
|
.emvb-layer-row:hover, .emvb-layer-row:hover .emvb-layer-select { background: var(--color-kumo-tint); }
|
|
183
184
|
.emvb-layers:empty::after, .emvb-panel-body > .emvb-helper { color: var(--text-color-kumo-subtle); }
|
|
@@ -192,6 +193,13 @@ export const EDITOR_CSS = `${UI_CSS}
|
|
|
192
193
|
.emvb-layer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
193
194
|
.emvb-layer-preview { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-color-kumo-subtle); }
|
|
194
195
|
.emvb-layer-select[aria-current="true"] .emvb-layer-preview { color: inherit; }
|
|
196
|
+
/* W-1080: drops on Layers. The line tracks the pointer without easing, like the canvas drop line.
|
|
197
|
+
Indents, the line and the refusal use logical sides so Layers reads right to left in RTL. */
|
|
198
|
+
.emvb-layers-body { position: relative; }
|
|
199
|
+
.emvb-layer-drop-line { position: absolute; inset-inline-end: 4px; height: 2px; border-radius: 1px; background: var(--color-kumo-brand); box-shadow: 0 0 0 1px var(--color-kumo-base, #fff); pointer-events: none; z-index: 2; }
|
|
200
|
+
.emvb-layer-row[data-emvb-drop="inside"] { box-shadow: inset 0 0 0 1px var(--color-kumo-brand); background: var(--color-kumo-tint); }
|
|
201
|
+
.emvb-layer-row[data-emvb-drop="invalid"] { outline: 1px dashed var(--color-kumo-danger); outline-offset: -1px; cursor: not-allowed; }
|
|
202
|
+
.emvb-layer-drop-refusal { inset-inline-end: 4px; height: auto; min-height: 24px; padding: 4px 6px; white-space: normal; }
|
|
195
203
|
.emvb-canvas { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--color-kumo-canvas); }
|
|
196
204
|
.emvb-device-bar { display: flex; flex: none; align-items: center; justify-content: center; gap: 12px; height: 36px; border-bottom: 1px solid var(--color-kumo-line); background: var(--color-kumo-surface); }
|
|
197
205
|
/* W-127: the segmented control hugs its three options; a fixed width left a gap on the right. */
|
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
ListIcon,
|
|
34
34
|
ListNumbersIcon,
|
|
35
35
|
TranslateIcon,
|
|
36
|
+
MagnifyingGlassIcon,
|
|
37
|
+
MoonIcon,
|
|
36
38
|
MapPinIcon,
|
|
37
39
|
MegaphoneIcon,
|
|
38
40
|
MinusIcon,
|
|
@@ -63,6 +65,7 @@ import {
|
|
|
63
65
|
VideoCameraIcon,
|
|
64
66
|
WarningCircleIcon,
|
|
65
67
|
type Icon,
|
|
68
|
+
StepsIcon,
|
|
66
69
|
} from "@phosphor-icons/react";
|
|
67
70
|
import { ELEMENT_DESCRIPTORS } from "../../core/index.ts";
|
|
68
71
|
|
|
@@ -116,6 +119,8 @@ export const ELEMENT_ICONS: Record<string, Icon> = {
|
|
|
116
119
|
progress: GaugeIcon,
|
|
117
120
|
countdown: TimerIcon,
|
|
118
121
|
map: MapPinIcon,
|
|
122
|
+
"search-form": MagnifyingGlassIcon,
|
|
123
|
+
"theme-toggle": MoonIcon,
|
|
119
124
|
"price-table": TagIcon,
|
|
120
125
|
"price-list": ListDashesIcon,
|
|
121
126
|
"price-list-item": CurrencyDollarIcon,
|
|
@@ -128,6 +133,7 @@ export const ELEMENT_ICONS: Record<string, Icon> = {
|
|
|
128
133
|
hotspot: NumberCircleOneIcon,
|
|
129
134
|
video: VideoCameraIcon,
|
|
130
135
|
form: ArticleIcon,
|
|
136
|
+
"form-step": StepsIcon,
|
|
131
137
|
"text-input": TextboxIcon,
|
|
132
138
|
textarea: TextAaIcon,
|
|
133
139
|
select: CaretCircleDownIcon,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ExtensionManifest } from "../../../core/index.ts";
|
|
2
|
+
import { useExtensions, useExtensionSourceValuesContext } from "../extensions-context.tsx";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* W-927 / D-067: Kumo-slot area for declarative extension panels. EmVB renders the
|
|
5
6
|
* panel copy with existing EmVB/Kumo tokens; extensions may not inject global admin CSS.
|
|
7
|
+
* W-1088 (#36): a panel that names a source lists that source's values read-only, as plain text.
|
|
6
8
|
*/
|
|
7
9
|
export function ExtensionPanels() {
|
|
8
10
|
const extensions = useExtensions();
|
|
@@ -19,8 +21,38 @@ export function ExtensionPanels() {
|
|
|
19
21
|
From {ext.label}
|
|
20
22
|
{panel.source ? ` · source “${panel.source}”` : ""}
|
|
21
23
|
</p>
|
|
24
|
+
{panel.source ? <SourceValues ext={ext} name={panel.source} /> : null}
|
|
22
25
|
</div>
|
|
23
26
|
))}
|
|
24
27
|
</div>
|
|
25
28
|
);
|
|
26
29
|
}
|
|
30
|
+
|
|
31
|
+
/** One source's values as a read-only list of labels and values. */
|
|
32
|
+
function SourceValues({ ext, name }: { ext: ExtensionManifest; name: string }) {
|
|
33
|
+
const all = useExtensionSourceValuesContext();
|
|
34
|
+
const source = ext.sources.find((s) => s.name === name);
|
|
35
|
+
if (!source) return null;
|
|
36
|
+
const id = `ext:${ext.id}/${name}`;
|
|
37
|
+
if (!all) return <p className="emvb-helper">Loading values…</p>;
|
|
38
|
+
const values = all.get(id);
|
|
39
|
+
if (!values) {
|
|
40
|
+
return (
|
|
41
|
+
<p className="emvb-helper" data-emvb-ext-source-unavailable="">
|
|
42
|
+
This source's values couldn't be read on this server.
|
|
43
|
+
</p>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const entries = Object.entries(values);
|
|
47
|
+
if (entries.length === 0) return <p className="emvb-helper">This source has no values.</p>;
|
|
48
|
+
return (
|
|
49
|
+
<dl className="emvb-ext-source" data-emvb-ext-source={id} aria-label={`${source.label} values`}>
|
|
50
|
+
{entries.map(([key, value]) => (
|
|
51
|
+
<div key={key}>
|
|
52
|
+
<dt>{key}</dt>
|
|
53
|
+
<dd>{value}</dd>
|
|
54
|
+
</div>
|
|
55
|
+
))}
|
|
56
|
+
</dl>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ExtensionManifest } from "../../core/index.ts";
|
|
3
|
+
import type { ExtensionSourceValues } from "../extension-outputs.ts";
|
|
3
4
|
import { extensionElementManifests } from "./useExtensions.ts";
|
|
4
5
|
|
|
5
6
|
const ExtensionsContext = React.createContext<readonly ExtensionManifest[]>([]);
|
|
7
|
+
/** W-1088: the values of the sources extension panels name; undefined while loading. */
|
|
8
|
+
const ExtensionSourcesContext = React.createContext<ExtensionSourceValues | undefined>(undefined);
|
|
6
9
|
|
|
7
10
|
export function ExtensionsProvider({
|
|
8
11
|
extensions,
|
|
12
|
+
sourceValues,
|
|
9
13
|
children,
|
|
10
14
|
}: {
|
|
11
15
|
extensions: readonly ExtensionManifest[];
|
|
16
|
+
sourceValues?: ExtensionSourceValues;
|
|
12
17
|
children: React.ReactNode;
|
|
13
18
|
}) {
|
|
14
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
<ExtensionsContext.Provider value={extensions}>
|
|
21
|
+
<ExtensionSourcesContext.Provider value={sourceValues}>
|
|
22
|
+
{children}
|
|
23
|
+
</ExtensionSourcesContext.Provider>
|
|
24
|
+
</ExtensionsContext.Provider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useExtensionSourceValuesContext(): ExtensionSourceValues | undefined {
|
|
29
|
+
return React.useContext(ExtensionSourcesContext);
|
|
15
30
|
}
|
|
16
31
|
|
|
17
32
|
export function useExtensions(): readonly ExtensionManifest[] {
|
|
@@ -26,6 +26,11 @@ export const FEATURE_CSS = `
|
|
|
26
26
|
.emvb-bind-row > .emvb-bind-label + .emvb-field:last-child { grid-column: 1 / -1; }
|
|
27
27
|
.emvb-bind-live { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--text-color-kumo-default); overflow-wrap: anywhere; }
|
|
28
28
|
.emvb-bind-live > b { font-weight: 600; }
|
|
29
|
+
/* W-1088: an extension panel's source values, read-only. */
|
|
30
|
+
.emvb-ext-source { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 2px 12px; margin: 4px 0 0; font-size: 12px; line-height: 16px; }
|
|
31
|
+
.emvb-ext-source > div { display: contents; }
|
|
32
|
+
.emvb-ext-source dt { font-weight: 600; color: var(--text-color-kumo-default); overflow-wrap: anywhere; }
|
|
33
|
+
.emvb-ext-source dd { margin: 0; color: var(--text-color-kumo-default); overflow-wrap: anywhere; white-space: pre-line; }
|
|
29
34
|
.emvb-bind-outside { grid-column: 1 / -1; display: grid; gap: 4px; }
|
|
30
35
|
.emvb-bind-outside > label { display: flex; gap: 6px; align-items: center; font-size: 12px; }
|
|
31
36
|
.emvb-bind-warning { margin: 0; padding: 6px 8px; border-radius: 6px; font-size: 12px; background: var(--color-kumo-warning-tint); color: var(--text-color-kumo-default); }
|
|
@@ -150,6 +155,20 @@ export const FEATURE_CSS = `
|
|
|
150
155
|
.emvb-recipe-tile:hover, .emvb-recipe-tile:focus-visible { border-color: var(--color-kumo-brand); }
|
|
151
156
|
.emvb-recipe-name { font-weight: 600; font-size: 13px; }
|
|
152
157
|
.emvb-recipe-desc { font-size: 12px; color: var(--text-color-kumo-subtle); }
|
|
158
|
+
/* W-1068: Add panel Elements | Templates, and the starter template tiles with their pictures. */
|
|
159
|
+
.emvb-add-switch-tabs { width: 100%; }
|
|
160
|
+
.emvb-add-switch-tabs [role="tablist"] { width: 100%; height: var(--emvb-control); min-height: var(--emvb-control); }
|
|
161
|
+
.emvb-add-switch-tabs [role="tab"] { flex: 1 1 0; justify-content: center; height: 100%; font-size: 13px; line-height: 18px; }
|
|
162
|
+
.emvb-add-switch-tabs [role="tab"][aria-selected="false"] { color: var(--text-color-kumo-default); }
|
|
163
|
+
.emvb-template-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
|
|
164
|
+
.emvb-template-tile { position: relative; display: grid; gap: 2px; padding: 0 0 8px; border-radius: 8px; border: 1px solid var(--color-kumo-line); background: var(--color-kumo-base, transparent); overflow: hidden; }
|
|
165
|
+
.emvb-template-tile:hover, .emvb-template-tile:has(.emvb-template-insert:focus-visible) { border-color: var(--color-kumo-brand); }
|
|
166
|
+
.emvb-template-tile:has(.emvb-template-insert:focus-visible) { outline: 2px solid var(--color-kumo-brand); outline-offset: 1px; }
|
|
167
|
+
.emvb-template-preview { position: relative; height: 104px; overflow: hidden; border-bottom: 1px solid var(--color-kumo-line); background: var(--color-kumo-recessed, transparent); }
|
|
168
|
+
.emvb-template-preview iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 640px; border: 0; transform-origin: 0 0; pointer-events: none; }
|
|
169
|
+
.emvb-template-insert { all: unset; padding: 6px 10px 0; font-weight: 600; font-size: 13px; line-height: 18px; cursor: grab; }
|
|
170
|
+
.emvb-template-insert::after { content: ""; position: absolute; inset: 0; }
|
|
171
|
+
.emvb-template-desc { margin: 0; padding: 0 10px; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); }
|
|
153
172
|
/* W-876: My sections, names only (D-060). */
|
|
154
173
|
.emvb-saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
|
|
155
174
|
.emvb-saved-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
|
|
@@ -180,4 +199,12 @@ export const FEATURE_CSS = `
|
|
|
180
199
|
.emvb-codesign-ask-form { display: grid; gap: 6px; }
|
|
181
200
|
.emvb-codesign-ask-form .emvb-helper { margin: 0; }
|
|
182
201
|
.emvb-codesign-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 12px 0; padding: 8px 8px 8px 12px; border: 1px solid var(--color-kumo-line); border-radius: 10px; background: var(--color-kumo-tint); font-size: 13px; line-height: 18px; }
|
|
202
|
+
/* W-1072: a font variable's own files (Site styles, Fonts). */
|
|
203
|
+
.emvb-font-faces .emvb-bind-label { margin: 4px 0 0; }
|
|
204
|
+
.emvb-font-face-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
|
|
205
|
+
.emvb-font-face-list > li { display: flex; align-items: center; gap: 6px; min-height: 28px; font-size: 13px; }
|
|
206
|
+
.emvb-font-face-list > li > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
207
|
+
.emvb-font-face-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
|
|
208
|
+
.emvb-font-weights { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 0; border: 0; font-size: 12px; }
|
|
209
|
+
.emvb-font-weights > legend { width: 100%; padding: 0; margin-bottom: 2px; }
|
|
183
210
|
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W-752: a preview picture is not a page to browse. A link in it took keyboard focus and Enter
|
|
3
|
+
* loaded the site (or the admin, for an in-page anchor) inside the picture. Inside a tag, core
|
|
4
|
+
* escapes `"` and `>` in attribute values, so the tag and its href are found exactly; text is
|
|
5
|
+
* left alone. Used by the version timeline and the template previews (W-1068).
|
|
6
|
+
*/
|
|
7
|
+
export const inertLinks = (html: string) =>
|
|
8
|
+
html.replaceAll(/<a\b[^>]*>/g, (tag) => tag.replace(/ href="[^"]*"/, ""));
|
|
@@ -338,8 +338,8 @@ function CustomColor({
|
|
|
338
338
|
/>
|
|
339
339
|
{clipped !== null && clipped === draft && !error && (
|
|
340
340
|
<p className="emvb-helper" role="status" data-emvb-clipped="">
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
Mapped to {clipped}: that OKLCH colour is outside sRGB, so it keeps its lightness and hue
|
|
342
|
+
with less chroma.
|
|
343
343
|
</p>
|
|
344
344
|
)}
|
|
345
345
|
</div>
|
|
@@ -111,6 +111,10 @@ export function ruleFromOption(
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/** W-1090 (#40): the install guide's section on theme parts for the site's own routes. */
|
|
115
|
+
const OTHER_ROUTES_DOCS =
|
|
116
|
+
"https://github.com/PerkyZZ999/EmVB/blob/main/docs/guides/install-in-a-host-site.md#theme-parts-on-your-sites-other-routes";
|
|
117
|
+
|
|
114
118
|
let ruleSeq = 0;
|
|
115
119
|
const newConditionId = () => `r-${Date.now().toString(36)}-${(++ruleSeq).toString(36)}`;
|
|
116
120
|
|
|
@@ -121,6 +125,10 @@ export function ConditionsEditor({ conditions, onChange }: Props) {
|
|
|
121
125
|
|
|
122
126
|
/** The schema allows at most 20 rules, so a 21st would make the part unsavable (W-092). */
|
|
123
127
|
const full = doc.rules.length >= MAX_CONDITION_RULES;
|
|
128
|
+
// W-1090 (#40): routes that don't call resolveThemeParts never show the part.
|
|
129
|
+
const entireSite = doc.rules.some(
|
|
130
|
+
(rule) => rule.op === "include" && rule.group === "general" && rule.name === "entire_site",
|
|
131
|
+
);
|
|
124
132
|
const fullReason = `${MAX_CONDITION_RULES} conditions is the most one part can have. Remove one to add another.`;
|
|
125
133
|
|
|
126
134
|
const add = (op: "include" | "exclude") => {
|
|
@@ -190,6 +198,16 @@ export function ConditionsEditor({ conditions, onChange }: Props) {
|
|
|
190
198
|
</li>
|
|
191
199
|
))}
|
|
192
200
|
</ul>
|
|
201
|
+
{entireSite && (
|
|
202
|
+
<p className="emvb-helper" data-emvb-entire-site-hint="">
|
|
203
|
+
Entire site means every page that renders EmVB theme parts: EmVB pages and the routes
|
|
204
|
+
whose layout adds them. A blog home or post list from your site's own templates may
|
|
205
|
+
not.{" "}
|
|
206
|
+
<a href={OTHER_ROUTES_DOCS} target="_blank" rel="noopener noreferrer">
|
|
207
|
+
Add theme parts to other routes
|
|
208
|
+
</a>
|
|
209
|
+
</p>
|
|
210
|
+
)}
|
|
193
211
|
{/* UX-051: sentence case; the plus says "add", so both fit on one row at 264 px. */}
|
|
194
212
|
<div className="emvb-condition-actions">
|
|
195
213
|
<Button
|
|
@@ -674,9 +674,9 @@ function KnownElementPanel({
|
|
|
674
674
|
{buttonUrlNote(node)}
|
|
675
675
|
</p>
|
|
676
676
|
)}
|
|
677
|
-
{loopContextNote(node, partType) && (
|
|
677
|
+
{loopContextNote(node, partType, layout) && (
|
|
678
678
|
<p className="emvb-helper" data-emvb-loop-note>
|
|
679
|
-
{loopContextNote(node, partType)}
|
|
679
|
+
{loopContextNote(node, partType, layout)}
|
|
680
680
|
</p>
|
|
681
681
|
)}
|
|
682
682
|
{imageAltNote(node) && (
|