@perkyzz/emvb 0.9.0 → 1.1.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 +10 -1
- package/package.json +2 -2
- package/src/admin/agents-api.ts +45 -0
- package/src/admin/bulk-api.ts +67 -0
- package/src/admin/content-api.ts +10 -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 +3 -1
- package/src/admin/editor/Editor.tsx +311 -250
- package/src/admin/editor/Timeline.tsx +8 -3
- package/src/admin/editor/TopBar.tsx +29 -7
- package/src/admin/editor/canvas/CanvasFrame.tsx +7 -2
- package/src/admin/editor/canvas/DeviceBar.tsx +31 -10
- 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/co-design.ts +190 -0
- package/src/admin/editor/dnd/new-element.ts +48 -4
- package/src/admin/editor/editor-chrome.tsx +8 -6
- package/src/admin/editor/editor-commands.ts +15 -4
- package/src/admin/editor/editor-css.ts +2 -1
- package/src/admin/editor/element-chrome.ts +3 -1
- package/src/admin/editor/extension-manifests.ts +20 -0
- package/src/admin/editor/extensions/ExtensionPanels.tsx +26 -0
- package/src/admin/editor/extensions-context.tsx +27 -0
- package/src/admin/editor/feature-css.ts +17 -0
- package/src/admin/editor/palette-items.ts +2 -2
- package/src/admin/editor/panels/AddPanel.tsx +31 -1
- package/src/admin/editor/panels/AgentRequestBox.tsx +116 -0
- package/src/admin/editor/panels/ClassesSection.tsx +9 -6
- package/src/admin/editor/panels/CoDesignPanel.tsx +170 -0
- package/src/admin/editor/panels/ColorControl.tsx +2 -2
- package/src/admin/editor/panels/ElementPanel.tsx +68 -20
- package/src/admin/editor/panels/LanguagesSection.tsx +152 -0
- package/src/admin/editor/panels/LayersPanel.tsx +10 -6
- package/src/admin/editor/panels/LeftPanel.tsx +33 -5
- package/src/admin/editor/panels/PageSettings.tsx +4 -0
- package/src/admin/editor/panels/SettingsPanel.tsx +21 -2
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +7 -7
- package/src/admin/editor/panels/settings/BackgroundControls.tsx +72 -15
- package/src/admin/editor/panels/settings/BackgroundFill.tsx +8 -6
- package/src/admin/editor/panels/settings/BoxControl.tsx +5 -5
- package/src/admin/editor/panels/settings/EffectsControls.tsx +183 -10
- package/src/admin/editor/panels/settings/FieldControl.tsx +9 -3
- package/src/admin/editor/panels/settings/IconControls.tsx +25 -11
- package/src/admin/editor/panels/settings/LengthRow.tsx +63 -19
- package/src/admin/editor/panels/settings/LoopControl.tsx +269 -0
- package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +19 -1
- package/src/admin/editor/panels/settings/MotionControl.tsx +12 -11
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +7 -4
- package/src/admin/editor/panels/settings/StyleRow.tsx +120 -13
- package/src/admin/editor/panels/settings/TextMarksControl.tsx +247 -0
- package/src/admin/editor/panels/settings/VariableBinding.tsx +2 -2
- package/src/admin/editor/panels/settings/background-mode.ts +14 -11
- package/src/admin/editor/panels/settings/box-link-name.ts +1 -1
- package/src/admin/editor/panels/settings/box-sides.ts +22 -14
- package/src/admin/editor/panels/settings/heading-warning.ts +5 -1
- package/src/admin/editor/panels/settings/length-units.ts +68 -4
- package/src/admin/editor/panels/settings/query-style.ts +3 -3
- package/src/admin/editor/panels/settings/style-sections.ts +52 -10
- package/src/admin/editor/panels/style-target.ts +22 -7
- package/src/admin/editor/presence.ts +60 -0
- package/src/admin/editor/section-templates.ts +26 -4
- package/src/admin/editor/store.ts +14 -4
- package/src/admin/editor/useCoDesign.ts +177 -0
- package/src/admin/editor/useEditorCommands.ts +7 -5
- package/src/admin/editor/useExtensions.ts +45 -0
- package/src/admin/editor/useNodeActions.ts +18 -7
- package/src/admin/editor/useProposals.ts +81 -0
- package/src/admin/export-api.ts +221 -0
- package/src/admin/index.tsx +6 -1
- package/src/admin/languages-api.ts +61 -0
- package/src/admin/pages/AgentSetup.tsx +148 -0
- package/src/admin/pages/AgentsPage.tsx +9 -26
- package/src/admin/pages/CreateDialog.tsx +15 -0
- package/src/admin/pages/ExportDialog.tsx +395 -0
- package/src/admin/pages/ImportButton.tsx +18 -0
- package/src/admin/pages/ImportElementorDialog.tsx +669 -0
- package/src/admin/pages/ImportPageLinks.tsx +86 -0
- package/src/admin/pages/PageList.tsx +82 -3
- package/src/admin/pages/ThemePartList.tsx +52 -2
- package/src/admin/pages/bulk.tsx +303 -0
- package/src/admin/pages/section-head.tsx +27 -0
- package/src/admin/proposals-api.ts +91 -0
- package/src/admin/search.ts +20 -0
- package/src/admin/theme-api.ts +4 -0
- package/src/admin/ui.ts +50 -4
- 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/content-port.ts +14 -1
- package/src/astro/render.ts +6 -6
- package/src/astro/resolve-theme.ts +25 -8
- package/src/astro/resolve.ts +89 -2
- package/src/astro/tabs/runtime.ts +16 -6
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +45 -14
- package/src/core/arrange.ts +5 -1
- package/src/core/bounded-array.ts +31 -0
- package/src/core/clipboard.ts +9 -0
- package/src/core/contract.ts +305 -0
- package/src/core/css/generate.ts +151 -20
- package/src/core/css/scope.ts +10 -2
- package/src/core/css/trace.ts +47 -13
- package/src/core/css-keywords.ts +51 -1
- package/src/core/design/cascade.ts +12 -9
- package/src/core/design/classes.ts +28 -9
- package/src/core/design/devices.ts +89 -13
- package/src/core/design/states.ts +5 -3
- package/src/core/design/transfer.ts +5 -0
- package/src/core/design/variables.ts +31 -5
- package/src/core/elements/dynamic-elements.ts +3 -3
- package/src/core/elements/index.ts +73 -9
- package/src/core/export/runtimes.generated.ts +9 -0
- package/src/core/export/site.ts +562 -0
- package/src/core/export/zip.ts +95 -0
- package/src/core/extensions/define.ts +13 -0
- package/src/core/extensions/index.ts +41 -0
- package/src/core/extensions/namespace.ts +82 -0
- package/src/core/extensions/normalize.ts +141 -0
- package/src/core/extensions/placeholder.ts +41 -0
- package/src/core/extensions/registry.ts +94 -0
- package/src/core/extensions/render-ext.ts +118 -0
- package/src/core/extensions/safe-nodes.ts +93 -0
- package/src/core/extensions/schema.ts +112 -0
- package/src/core/extensions/types.ts +159 -0
- package/src/core/forms/binding.ts +1 -1
- package/src/core/history/diff.ts +26 -1
- package/src/core/import/elementor/atomic.ts +1608 -0
- package/src/core/import/elementor/classes.ts +127 -0
- package/src/core/import/elementor/context.ts +429 -0
- package/src/core/import/elementor/counter-steps.ts +72 -0
- package/src/core/import/elementor/css.ts +445 -0
- package/src/core/import/elementor/html.ts +500 -0
- package/src/core/import/elementor/index.ts +967 -0
- package/src/core/import/elementor/inline-marks.ts +81 -0
- package/src/core/import/elementor/snapshots.ts +48 -0
- package/src/core/import/elementor/style.ts +429 -0
- package/src/core/import/elementor/values.ts +241 -0
- package/src/core/import/elementor/widgets.ts +1897 -0
- package/src/core/index.ts +96 -0
- package/src/core/json-schema.ts +114 -0
- package/src/core/limits.ts +19 -0
- package/src/core/migrate/index.ts +6 -1
- package/src/core/migrate/v18.ts +222 -0
- package/src/core/perf/meter.ts +42 -24
- package/src/core/portable-text-export.ts +243 -0
- package/src/core/proposals-safety.ts +102 -0
- package/src/core/proposals.ts +357 -0
- package/src/core/public-attributes.ts +30 -0
- package/src/core/recipes/index.ts +2 -2
- package/src/core/render/extras.ts +3 -3
- package/src/core/render/index.ts +222 -23
- package/src/core/render/loop.ts +1 -1
- package/src/core/render/section.ts +4 -4
- package/src/core/render/tabs.ts +18 -11
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +151 -10
- package/src/core/sanitize/motion.ts +116 -0
- package/src/core/saved-sections.ts +6 -0
- package/src/core/schema/descriptors.ts +3 -1
- package/src/core/schema/design.ts +4 -3
- package/src/core/schema/layout.ts +92 -16
- package/src/core/schema/style.ts +296 -112
- package/src/core/search-text.ts +70 -0
- package/src/core/text-marks.ts +227 -0
- package/src/core/theme/dynamic.ts +9 -4
- package/src/core/theme/float.ts +2 -0
- package/src/core/theme/popup-rules.ts +33 -1
- package/src/core/translatable.ts +34 -0
- package/src/core/validate.ts +13 -1
- package/src/index.ts +24 -0
- package/src/mcp/errors.ts +3 -1
- package/src/mcp/ports.ts +67 -0
- package/src/mcp/prompts.ts +1 -11
- package/src/mcp/proposals.ts +281 -0
- package/src/mcp/read.ts +10 -10
- package/src/mcp/tools.ts +71 -3
- package/src/mcp/write.ts +66 -11
- package/src/server/agent-settings.ts +5 -1
- package/src/server/icon-routes.ts +52 -12
- package/src/server/mcp-routes.ts +15 -0
- package/src/server/plugin.ts +35 -2
- package/src/server/presence.ts +78 -0
- package/src/server/proposals.ts +261 -0
- package/src/server/requests.ts +196 -0
- package/src/server/tools-served.ts +45 -0
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { LIST_MARKERS } from "../css-keywords.ts";
|
|
2
3
|
import { MAX_TEXT_LENGTH } from "../limits.ts";
|
|
3
4
|
import { ImageEdit } from "../image-edit/schema.ts";
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ColorValue,
|
|
7
|
+
DeviceStyles,
|
|
8
|
+
HiddenOn,
|
|
9
|
+
Length,
|
|
10
|
+
OwnStyle,
|
|
11
|
+
StyleProps,
|
|
12
|
+
StyleStates,
|
|
13
|
+
} from "./style.ts";
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* 16 since W-481 (D-061): an optional editor-only `edit` record on images (image editor).
|
|
@@ -15,9 +24,19 @@ import { DeviceStyles, HiddenOn, Length, StyleProps, StyleStates } from "./style
|
|
|
15
24
|
* Loop's Empty state element. Every other value is unchanged.
|
|
16
25
|
* 12 since W-160: gradient type, stop locations, and up to 10 stops. v11 gradients
|
|
17
26
|
* (`{ angle, from, to }`) become a linear gradient on read.
|
|
27
|
+
* 18 since W-925 (D-065, contract 1.0): the Section reference node is `part-ref`, a node's
|
|
28
|
+
* editor name is `editorLabel`, a Loop's template part is `partId`, and the four motion style
|
|
29
|
+
* keys sit under one `motion` record. Older documents are rewritten on read.
|
|
18
30
|
* 11 since W-156 and W-157 (D-045): the layout Section element and an editor-only node label.
|
|
19
31
|
*/
|
|
20
|
-
export const LAYOUT_SCHEMA_VERSION =
|
|
32
|
+
export const LAYOUT_SCHEMA_VERSION = 18;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The frozen document contract (W-925, D-065). Within 1.x a new optional key may appear
|
|
36
|
+
* without a schemaVersion bump, and readers keep keys they do not know; a rename or a removal
|
|
37
|
+
* needs 2.0. `schemaVersion` stays a plain number for the migration chain.
|
|
38
|
+
*/
|
|
39
|
+
export const CONTRACT_VERSION = "1.0";
|
|
21
40
|
|
|
22
41
|
export const NodeId = z
|
|
23
42
|
.string()
|
|
@@ -156,14 +175,15 @@ const BoxLink = {
|
|
|
156
175
|
* `dir`, `container` and `query` before this.
|
|
157
176
|
*/
|
|
158
177
|
const sharedNodeFields = {
|
|
159
|
-
style:
|
|
178
|
+
style: OwnStyle.optional(),
|
|
160
179
|
states: StyleStates.optional(),
|
|
161
180
|
devices: DeviceStyles.optional(),
|
|
162
181
|
hiddenOn: HiddenOn.optional(),
|
|
163
182
|
classes: ClassIds.optional(),
|
|
164
183
|
htmlId: HtmlId.optional(),
|
|
165
184
|
attributes: HtmlAttributes.optional(),
|
|
166
|
-
label
|
|
185
|
+
/** The name shown in the editor's Navigator (was `label` before schema 18). Never rendered. */
|
|
186
|
+
editorLabel: NodeLabel.optional(),
|
|
167
187
|
bind: Bindings.optional(),
|
|
168
188
|
variant: Variant.optional(),
|
|
169
189
|
audience: Audience.optional(),
|
|
@@ -202,6 +222,26 @@ const parentNode = <T extends string, P extends z.ZodType>(type: T, props: P) =>
|
|
|
202
222
|
},
|
|
203
223
|
});
|
|
204
224
|
|
|
225
|
+
/** W-950: at most this many formatted ranges in one Heading or Text. */
|
|
226
|
+
export const MAX_TEXT_MARKS = 100;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* W-950: formatting on part of a Heading's or Text's words: characters `start` to `end` (end not
|
|
230
|
+
* included) are bold, italic, in a colour and/or a link. The text stays plain; ranges past its
|
|
231
|
+
* end are clipped when the page is drawn, so changing the text never makes a page invalid.
|
|
232
|
+
*/
|
|
233
|
+
export const TextMark = z.strictObject({
|
|
234
|
+
start: z.number().int().min(0).max(MAX_TEXT_LENGTH),
|
|
235
|
+
end: z.number().int().min(1).max(MAX_TEXT_LENGTH),
|
|
236
|
+
bold: z.literal(true).optional(),
|
|
237
|
+
italic: z.literal(true).optional(),
|
|
238
|
+
color: ColorValue.optional(),
|
|
239
|
+
href: z.string().min(1).max(2000).optional(),
|
|
240
|
+
newTab: z.literal(true).optional(),
|
|
241
|
+
});
|
|
242
|
+
export type TextMark = z.infer<typeof TextMark>;
|
|
243
|
+
const TextMarks = z.array(TextMark).max(MAX_TEXT_MARKS);
|
|
244
|
+
|
|
205
245
|
export const HeadingNode = leafNode(
|
|
206
246
|
"heading",
|
|
207
247
|
z.strictObject({
|
|
@@ -210,6 +250,8 @@ export const HeadingNode = leafNode(
|
|
|
210
250
|
/** Optional link around the text (W-141), like Elementor's Heading link. */
|
|
211
251
|
href: z.string().max(2000).optional(),
|
|
212
252
|
newTab: z.boolean().optional(),
|
|
253
|
+
/** W-950: bold, italic, colour and links on part of the text (links only when unlinked). */
|
|
254
|
+
marks: TextMarks.optional(),
|
|
213
255
|
}),
|
|
214
256
|
);
|
|
215
257
|
|
|
@@ -227,6 +269,8 @@ export const TextNode = leafNode(
|
|
|
227
269
|
z.strictObject({
|
|
228
270
|
text: z.string().max(MAX_TEXT_LENGTH),
|
|
229
271
|
tag: z.enum(TEXT_TAGS).optional(),
|
|
272
|
+
/** W-950: bold, italic, colour and links on part of the text. */
|
|
273
|
+
marks: TextMarks.optional(),
|
|
230
274
|
}),
|
|
231
275
|
);
|
|
232
276
|
|
|
@@ -265,6 +309,10 @@ export const ListNode = leafNode(
|
|
|
265
309
|
"list",
|
|
266
310
|
z.strictObject({
|
|
267
311
|
ordered: z.boolean().optional(),
|
|
312
|
+
/** W-952: the marker style; a number style or `steps` makes the list numbered. */
|
|
313
|
+
marker: z.enum(LIST_MARKERS).optional(),
|
|
314
|
+
/** W-952: the first number of a numbered list. */
|
|
315
|
+
start: z.number().int().min(1).max(9999).optional(),
|
|
268
316
|
items: z.array(z.string().max(MAX_TEXT_LENGTH)).max(200),
|
|
269
317
|
}),
|
|
270
318
|
);
|
|
@@ -560,7 +608,7 @@ export const PostLinkNode = leafNode(
|
|
|
560
608
|
|
|
561
609
|
/**
|
|
562
610
|
* Repeats its item template for each post in ThemeDynamicData.posts.
|
|
563
|
-
* When `
|
|
611
|
+
* When `partId` is set, the host supplies that Loop Item layout in loopTemplates;
|
|
564
612
|
* otherwise children are the inline item template.
|
|
565
613
|
*/
|
|
566
614
|
/** How a Loop lays out its items (W-308): one design, shown as a list, a grid or cards. */
|
|
@@ -584,7 +632,7 @@ export const LOOP_ORDERS = ["newest", "oldest", "title"] as const;
|
|
|
584
632
|
export const LoopNode = parentNode(
|
|
585
633
|
"loop",
|
|
586
634
|
z.strictObject({
|
|
587
|
-
|
|
635
|
+
partId: z.string().max(128).optional(),
|
|
588
636
|
/** Posts per archive page, 1–50 (W-221). Unset = 20. */
|
|
589
637
|
perPage: z.number().int().min(1).max(50).optional(),
|
|
590
638
|
/**
|
|
@@ -671,7 +719,7 @@ export const PaginationNode = leafNode(
|
|
|
671
719
|
* `sectionTemplates` and the part's children render in place of `children`.
|
|
672
720
|
*/
|
|
673
721
|
export const SectionNode = parentNode(
|
|
674
|
-
"
|
|
722
|
+
"part-ref",
|
|
675
723
|
z.strictObject({
|
|
676
724
|
partId: z.string().max(128).optional(),
|
|
677
725
|
}),
|
|
@@ -708,7 +756,7 @@ export const KNOWN_ELEMENT_TYPES = [
|
|
|
708
756
|
"loop",
|
|
709
757
|
"loop-empty",
|
|
710
758
|
"pagination",
|
|
711
|
-
"
|
|
759
|
+
"part-ref",
|
|
712
760
|
"div-block",
|
|
713
761
|
"flexbox",
|
|
714
762
|
"grid",
|
|
@@ -721,6 +769,7 @@ export const KNOWN_ELEMENT_TYPES = [
|
|
|
721
769
|
"menu-item",
|
|
722
770
|
"layout-section",
|
|
723
771
|
"toc",
|
|
772
|
+
"language-switcher",
|
|
724
773
|
] as const;
|
|
725
774
|
|
|
726
775
|
/** Headings on this page, as a list of links. No script (W-345). */
|
|
@@ -731,6 +780,17 @@ export const TocNode = leafNode(
|
|
|
731
780
|
}),
|
|
732
781
|
);
|
|
733
782
|
|
|
783
|
+
/**
|
|
784
|
+
* W-937: links to this page in its other published languages (EmDash translations), each with
|
|
785
|
+
* hreflang. `label` names the navigation for screen readers. The host fills the links.
|
|
786
|
+
*/
|
|
787
|
+
export const LanguageSwitcherNode = leafNode(
|
|
788
|
+
"language-switcher",
|
|
789
|
+
z.strictObject({
|
|
790
|
+
label: z.string().max(80).optional(),
|
|
791
|
+
}),
|
|
792
|
+
);
|
|
793
|
+
|
|
734
794
|
const knownTypeSet = new Set<string>(KNOWN_ELEMENT_TYPES);
|
|
735
795
|
|
|
736
796
|
/**
|
|
@@ -742,7 +802,8 @@ const UnknownNodeSchema = z.strictObject({
|
|
|
742
802
|
type: z
|
|
743
803
|
.string()
|
|
744
804
|
.min(1)
|
|
745
|
-
.
|
|
805
|
+
// W-927: extension types are ext:<pkg>/<name>; 128 fits the longest allowed id.
|
|
806
|
+
.max(128)
|
|
746
807
|
.refine((value) => !knownTypeSet.has(value), "Unknown element type"),
|
|
747
808
|
props: z.record(z.string(), z.unknown()),
|
|
748
809
|
...sharedNodeFields,
|
|
@@ -762,6 +823,7 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
|
|
|
762
823
|
TabPanelNode,
|
|
763
824
|
HeadingNode,
|
|
764
825
|
TocNode,
|
|
826
|
+
LanguageSwitcherNode,
|
|
765
827
|
SpacerNode,
|
|
766
828
|
DividerNode,
|
|
767
829
|
TextNode,
|
|
@@ -801,6 +863,7 @@ export const KNOWN_NODE_SCHEMAS = KnownLayoutNode.options;
|
|
|
801
863
|
|
|
802
864
|
export type HeadingNode = z.infer<typeof HeadingNode>;
|
|
803
865
|
export type TocNode = z.infer<typeof TocNode>;
|
|
866
|
+
export type LanguageSwitcherNode = z.infer<typeof LanguageSwitcherNode>;
|
|
804
867
|
export type SpacerNode = z.infer<typeof SpacerNode>;
|
|
805
868
|
export type DividerNode = z.infer<typeof DividerNode>;
|
|
806
869
|
export type TextNode = z.infer<typeof TextNode>;
|
|
@@ -848,14 +911,14 @@ export type NodeExtras = {
|
|
|
848
911
|
/** Identity, style and extras shared by every node type (W-352). */
|
|
849
912
|
type NodeEnvelope = {
|
|
850
913
|
id: IdOf;
|
|
851
|
-
style?:
|
|
914
|
+
style?: z.infer<typeof OwnStyle>;
|
|
852
915
|
states?: StatesOf;
|
|
853
916
|
devices?: DevicesOf;
|
|
854
917
|
hiddenOn?: HiddenOnOf;
|
|
855
918
|
classes?: ClassesOf;
|
|
856
919
|
htmlId?: HtmlIdOf;
|
|
857
920
|
attributes?: HtmlAttributeOf[];
|
|
858
|
-
|
|
921
|
+
editorLabel?: string;
|
|
859
922
|
} & NodeExtras;
|
|
860
923
|
|
|
861
924
|
/** Manual recursive types so UnknownNode does not poison `z.infer` of the tree. */
|
|
@@ -937,7 +1000,7 @@ export type FormNode = NodeEnvelope & {
|
|
|
937
1000
|
export type LoopNode = NodeEnvelope & {
|
|
938
1001
|
type: "loop";
|
|
939
1002
|
props: {
|
|
940
|
-
|
|
1003
|
+
partId?: string;
|
|
941
1004
|
perPage?: number;
|
|
942
1005
|
collection?: string;
|
|
943
1006
|
limit?: number;
|
|
@@ -955,7 +1018,7 @@ export type LoopEmptyNode = NodeEnvelope & {
|
|
|
955
1018
|
};
|
|
956
1019
|
|
|
957
1020
|
export type SectionNode = NodeEnvelope & {
|
|
958
|
-
type: "
|
|
1021
|
+
type: "part-ref";
|
|
959
1022
|
props: { partId?: string };
|
|
960
1023
|
children: LayoutNode[];
|
|
961
1024
|
};
|
|
@@ -999,6 +1062,7 @@ export type LayoutNode =
|
|
|
999
1062
|
| SectionNode
|
|
1000
1063
|
| HeadingNode
|
|
1001
1064
|
| TocNode
|
|
1065
|
+
| LanguageSwitcherNode
|
|
1002
1066
|
| SpacerNode
|
|
1003
1067
|
| DividerNode
|
|
1004
1068
|
| TextNode
|
|
@@ -1081,7 +1145,19 @@ export const isFormNode = (node: LayoutNode): node is FormNode => node.type ===
|
|
|
1081
1145
|
|
|
1082
1146
|
export const isLoopNode = (node: LayoutNode): node is LoopNode => node.type === "loop";
|
|
1083
1147
|
|
|
1084
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* The class name an element type renders with (`emvb-<name>`). A Section reference became
|
|
1150
|
+
* `part-ref` in schema 18 (W-925) but keeps its public class `emvb-section`, so site CSS and
|
|
1151
|
+
* the rendered output are unchanged.
|
|
1152
|
+
*/
|
|
1153
|
+
export const cssTypeName = (type: string): string => {
|
|
1154
|
+
if (type === "part-ref") return "section";
|
|
1155
|
+
// W-927: every extension element shares the emvb-ext class (type holds : and /).
|
|
1156
|
+
if (type.startsWith("ext:")) return "ext";
|
|
1157
|
+
return type;
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
export const isSectionNode = (node: LayoutNode): node is SectionNode => node.type === "part-ref";
|
|
1085
1161
|
|
|
1086
1162
|
export const isDivBlockNode = (node: LayoutNode): node is DivBlockNode => node.type === "div-block";
|
|
1087
1163
|
|
|
@@ -1112,7 +1188,7 @@ export const isLayoutParentNode = (
|
|
|
1112
1188
|
node.type === "flexbox" ||
|
|
1113
1189
|
node.type === "grid" ||
|
|
1114
1190
|
node.type === "tab-panel" ||
|
|
1115
|
-
node.type === "
|
|
1191
|
+
node.type === "part-ref" ||
|
|
1116
1192
|
node.type === "loop-empty" ||
|
|
1117
1193
|
node.type === "accordion-item" ||
|
|
1118
1194
|
node.type === "menu-item";
|
|
@@ -1144,7 +1220,7 @@ export const isParentNode = (
|
|
|
1144
1220
|
node.type === "form" ||
|
|
1145
1221
|
node.type === "loop" ||
|
|
1146
1222
|
node.type === "loop-empty" ||
|
|
1147
|
-
node.type === "
|
|
1223
|
+
node.type === "part-ref" ||
|
|
1148
1224
|
node.type === "tabs" ||
|
|
1149
1225
|
node.type === "tab-panel" ||
|
|
1150
1226
|
node.type === "accordion" ||
|