@perkyzz/emvb 0.6.0 → 0.8.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.
Files changed (208) hide show
  1. package/README.md +2 -2
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/package.json +7 -7
  4. package/src/admin/access/RequireEditor.tsx +7 -7
  5. package/src/admin/access/role.ts +5 -2
  6. package/src/admin/content-api.ts +10 -3
  7. package/src/admin/content-item.ts +1 -1
  8. package/src/admin/editor/A11yCopilot.tsx +104 -56
  9. package/src/admin/editor/CommandPalette.tsx +29 -13
  10. package/src/admin/editor/DialogCloseButton.tsx +16 -0
  11. package/src/admin/editor/Editor.tsx +115 -20
  12. package/src/admin/editor/EditorToasts.tsx +26 -0
  13. package/src/admin/editor/PerfMeter.tsx +92 -73
  14. package/src/admin/editor/SavedSectionDialogs.tsx +169 -0
  15. package/src/admin/editor/ShareLink.tsx +102 -72
  16. package/src/admin/editor/ShortcutsDialog.tsx +37 -18
  17. package/src/admin/editor/Timeline.tsx +250 -160
  18. package/src/admin/editor/TopBar.tsx +71 -14
  19. package/src/admin/editor/canvas/CanvasFrame.tsx +10 -1
  20. package/src/admin/editor/canvas/CanvasTextEdit.tsx +8 -2
  21. package/src/admin/editor/canvas/drop-line.ts +11 -3
  22. package/src/admin/editor/canvas/frame-focus-ring.ts +37 -0
  23. package/src/admin/editor/canvas/use-canvas-dnd.ts +32 -3
  24. package/src/admin/editor/canvas/vnode-react.tsx +7 -0
  25. package/src/admin/editor/collection-previews.ts +10 -0
  26. package/src/admin/editor/dialogs.tsx +41 -28
  27. package/src/admin/editor/dnd/drop-target.ts +26 -1
  28. package/src/admin/editor/edited-noun.ts +15 -0
  29. package/src/admin/editor/editor-chrome.tsx +43 -7
  30. package/src/admin/editor/editor-commands.ts +17 -2
  31. package/src/admin/editor/editor-css.ts +75 -24
  32. package/src/admin/editor/element-chrome.ts +21 -11
  33. package/src/admin/editor/feature-css.ts +56 -14
  34. package/src/admin/editor/focus-when-lost.ts +23 -0
  35. package/src/admin/editor/icons/IconLibraryDialog.tsx +54 -18
  36. package/src/admin/editor/icons/library.ts +1 -1
  37. package/src/admin/editor/icons/use-icon-library.ts +5 -2
  38. package/src/admin/editor/ime.ts +29 -0
  39. package/src/admin/editor/palette-items.ts +27 -3
  40. package/src/admin/editor/panels/AddPanel.tsx +44 -11
  41. package/src/admin/editor/panels/ClassesSection.tsx +18 -7
  42. package/src/admin/editor/panels/ColorControl.tsx +130 -23
  43. package/src/admin/editor/panels/ConditionsEditor.tsx +52 -26
  44. package/src/admin/editor/panels/ElementPanel.tsx +134 -24
  45. package/src/admin/editor/panels/LayersPanel.tsx +61 -20
  46. package/src/admin/editor/panels/LeftPanel.tsx +9 -1
  47. package/src/admin/editor/panels/PageSettings.tsx +66 -35
  48. package/src/admin/editor/panels/SavedSectionsGroup.tsx +246 -0
  49. package/src/admin/editor/panels/SiteStylesDrawer.tsx +224 -42
  50. package/src/admin/editor/panels/TokenScales.tsx +88 -48
  51. package/src/admin/editor/panels/TriggerSettings.tsx +50 -12
  52. package/src/admin/editor/panels/TriggersEditor.tsx +3 -2
  53. package/src/admin/editor/panels/VariableSection.tsx +48 -18
  54. package/src/admin/editor/panels/color-space.ts +23 -29
  55. package/src/admin/editor/panels/settings/AdvancedFields.tsx +12 -2
  56. package/src/admin/editor/panels/settings/AudienceEditor.tsx +87 -74
  57. package/src/admin/editor/panels/settings/BackgroundControls.tsx +55 -11
  58. package/src/admin/editor/panels/settings/BackgroundFill.tsx +3 -2
  59. package/src/admin/editor/panels/settings/BindingsEditor.tsx +15 -18
  60. package/src/admin/editor/panels/settings/BoxControl.tsx +2 -1
  61. package/src/admin/editor/panels/settings/ClassChip.tsx +21 -9
  62. package/src/admin/editor/panels/settings/ClassChipInput.tsx +24 -16
  63. package/src/admin/editor/panels/settings/DraftTextField.tsx +41 -3
  64. package/src/admin/editor/panels/settings/EffectsControls.tsx +38 -14
  65. package/src/admin/editor/panels/settings/FieldBindControl.tsx +46 -28
  66. package/src/admin/editor/panels/settings/FieldControl.tsx +20 -8
  67. package/src/admin/editor/panels/settings/FormBindControl.tsx +2 -2
  68. package/src/admin/editor/panels/settings/HintedSwitch.tsx +33 -0
  69. package/src/admin/editor/panels/settings/IconControls.tsx +33 -13
  70. package/src/admin/editor/panels/settings/IconPicker.tsx +2 -0
  71. package/src/admin/editor/panels/settings/ImageSourcesField.tsx +3 -1
  72. package/src/admin/editor/panels/settings/ItemList.tsx +15 -2
  73. package/src/admin/editor/panels/settings/LengthRow.tsx +8 -6
  74. package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +1 -1
  75. package/src/admin/editor/panels/settings/MediaPicker.tsx +127 -23
  76. package/src/admin/editor/panels/settings/MotionControl.tsx +28 -15
  77. package/src/admin/editor/panels/settings/NumberRow.tsx +9 -3
  78. package/src/admin/editor/panels/settings/PanelSelect.tsx +50 -0
  79. package/src/admin/editor/panels/settings/QueryStyleRows.tsx +25 -18
  80. package/src/admin/editor/panels/settings/RequiredFieldsNotice.tsx +66 -1
  81. package/src/admin/editor/panels/settings/StyleRow.tsx +10 -3
  82. package/src/admin/editor/panels/settings/StyleSources.tsx +4 -1
  83. package/src/admin/editor/panels/settings/VariantEditor.tsx +10 -1
  84. package/src/admin/editor/panels/settings/box-link-name.ts +6 -2
  85. package/src/admin/editor/panels/settings/class-suggest.ts +7 -7
  86. package/src/admin/editor/panels/settings/query-style.ts +38 -9
  87. package/src/admin/editor/panels/settings/svg-images.ts +13 -0
  88. package/src/admin/editor/panels/site-list.tsx +20 -6
  89. package/src/admin/editor/panels/variable-values.ts +11 -4
  90. package/src/admin/editor/restore-deleted.ts +21 -2
  91. package/src/admin/editor/section-templates.ts +81 -12
  92. package/src/admin/editor/shortcuts.ts +31 -2
  93. package/src/admin/editor/store.ts +7 -0
  94. package/src/admin/editor/useEditorCommands.ts +61 -15
  95. package/src/admin/editor/useEditorData.ts +4 -2
  96. package/src/admin/editor/useEditorShortcuts.ts +17 -7
  97. package/src/admin/editor/useNodeActions.ts +61 -6
  98. package/src/admin/editor/useSave.ts +22 -7
  99. package/src/admin/editor/useSavedSections.ts +197 -0
  100. package/src/admin/forms-api.ts +2 -0
  101. package/src/admin/image-editor/Canvas.tsx +61 -17
  102. package/src/admin/image-editor/CurvesPanel.tsx +2 -1
  103. package/src/admin/image-editor/ExportDialog.tsx +48 -18
  104. package/src/admin/image-editor/ImageEditorDialog.tsx +179 -8
  105. package/src/admin/image-editor/MetadataPanel.tsx +15 -4
  106. package/src/admin/image-editor/crop-geometry.ts +3 -2
  107. package/src/admin/image-editor/image-editor-css.ts +15 -10
  108. package/src/admin/image-editor/load.ts +9 -2
  109. package/src/admin/image-editor/parts.tsx +69 -19
  110. package/src/admin/image-editor/save.ts +54 -8
  111. package/src/admin/media-api.ts +2 -1
  112. package/src/admin/pages/AgentsPage.tsx +138 -27
  113. package/src/admin/pages/CreateDialog.tsx +97 -30
  114. package/src/admin/pages/NewPageDialog.tsx +21 -3
  115. package/src/admin/pages/NewThemePartDialog.tsx +11 -3
  116. package/src/admin/pages/PageList.tsx +14 -6
  117. package/src/admin/pages/SetupShell.tsx +28 -12
  118. package/src/admin/pages/ThemePartList.tsx +59 -11
  119. package/src/admin/pages/list-kit.tsx +106 -24
  120. package/src/admin/saved-sections-api.ts +51 -0
  121. package/src/admin/search.ts +15 -0
  122. package/src/admin/setup/useSetupStatus.ts +1 -1
  123. package/src/admin/theme-api.ts +16 -5
  124. package/src/admin/ui.ts +82 -22
  125. package/src/astro/floats/runtime.ts +21 -0
  126. package/src/astro/menu/runtime.ts +34 -1
  127. package/src/astro/popups/runtime.ts +41 -9
  128. package/src/astro/render.ts +3 -0
  129. package/src/astro/resolve-theme.ts +53 -11
  130. package/src/astro/resolve.ts +9 -1
  131. package/src/astro/tabs/runtime.ts +12 -0
  132. package/src/astro/theme-posts.ts +2 -2
  133. package/src/astro/visitor.ts +2 -0
  134. package/src/constants.ts +1 -1
  135. package/src/core/a11y/audit.ts +196 -24
  136. package/src/core/arrange.ts +48 -12
  137. package/src/core/audience/rules.ts +5 -1
  138. package/src/core/audience/variants.ts +29 -3
  139. package/src/core/clipboard.ts +7 -0
  140. package/src/core/css/generate.ts +31 -6
  141. package/src/core/css/print.ts +5 -0
  142. package/src/core/data/bindings.ts +8 -1
  143. package/src/core/design/classes.ts +39 -16
  144. package/src/core/design/devices.ts +7 -13
  145. package/src/core/design/diff.ts +6 -0
  146. package/src/core/design/merge.ts +90 -2
  147. package/src/core/design/states.ts +7 -13
  148. package/src/core/design/tokens.ts +16 -2
  149. package/src/core/design/transfer.ts +33 -6
  150. package/src/core/design/variables.ts +30 -9
  151. package/src/core/elements/dynamic-elements.ts +53 -14
  152. package/src/core/elements/form-elements.ts +55 -16
  153. package/src/core/elements/index.ts +84 -39
  154. package/src/core/elements/menu.ts +40 -19
  155. package/src/core/elements/select-prompt.ts +3 -0
  156. package/src/core/elements/svg-ids.ts +39 -0
  157. package/src/core/forms/binding.ts +57 -16
  158. package/src/core/forms/definition.ts +72 -0
  159. package/src/core/history/diff.ts +18 -1
  160. package/src/core/icons/animation-runs.ts +11 -0
  161. package/src/core/icons/catalog.ts +3 -2
  162. package/src/core/image-edit/schema.ts +11 -1
  163. package/src/core/image-edit/summary.ts +6 -3
  164. package/src/core/index.ts +35 -1
  165. package/src/core/limits.ts +12 -1
  166. package/src/core/migrate/index.ts +3 -0
  167. package/src/core/perf/meter.ts +42 -7
  168. package/src/core/recipes/index.ts +5 -4
  169. package/src/core/render/context.ts +8 -0
  170. package/src/core/render/dynamic-post.ts +69 -12
  171. package/src/core/render/extras.ts +77 -4
  172. package/src/core/render/form.ts +140 -6
  173. package/src/core/render/index.ts +156 -20
  174. package/src/core/render/loop.ts +44 -8
  175. package/src/core/render/pagination.ts +18 -4
  176. package/src/core/render/section.ts +27 -0
  177. package/src/core/render/tabs.ts +12 -3
  178. package/src/core/render/vnode.ts +1 -1
  179. package/src/core/sanitize/css.ts +29 -8
  180. package/src/core/sanitize/embed-url.ts +42 -5
  181. package/src/core/sanitize/url.ts +2 -1
  182. package/src/core/saved-sections.ts +318 -0
  183. package/src/core/schema/design.ts +1 -1
  184. package/src/core/schema/layout.ts +16 -7
  185. package/src/core/schema/style.ts +4 -2
  186. package/src/core/stats.ts +2 -1
  187. package/src/core/theme/conditions.ts +3 -1
  188. package/src/core/theme/dynamic.ts +36 -5
  189. package/src/core/theme/float.ts +12 -2
  190. package/src/core/theme/pagination.ts +50 -29
  191. package/src/core/theme/part-types.ts +4 -4
  192. package/src/core/theme/popup-markup.ts +23 -5
  193. package/src/core/theme/popup-rules.ts +1 -0
  194. package/src/core/theme/triggers.ts +3 -2
  195. package/src/core/tree-ops.ts +27 -0
  196. package/src/mcp/ports.ts +22 -1
  197. package/src/mcp/rate-limit.ts +2 -1
  198. package/src/mcp/read.ts +15 -3
  199. package/src/mcp/refs.ts +18 -0
  200. package/src/mcp/sections.ts +183 -0
  201. package/src/mcp/tools.ts +44 -0
  202. package/src/mcp/write.ts +178 -14
  203. package/src/server/agent-settings.ts +1 -1
  204. package/src/server/hooks.ts +5 -3
  205. package/src/server/icon-routes.ts +30 -9
  206. package/src/server/mcp-routes.ts +8 -1
  207. package/src/server/plugin.ts +14 -0
  208. package/src/server/saved-sections.ts +163 -0
@@ -18,7 +18,7 @@ export const postTitle: ElementDefinition<PostTitleNode> = {
18
18
  defaults: () => ({ type: "post-title", props: { level: 1 } }),
19
19
  descriptor: {
20
20
  type: "post-title",
21
- name: "Post Title",
21
+ name: "Post title",
22
22
  group: "dynamic",
23
23
  defaultTab: "content",
24
24
  fields: [
@@ -40,7 +40,7 @@ export const postExcerpt: ElementDefinition<PostExcerptNode> = {
40
40
  defaults: () => ({ type: "post-excerpt", props: {} }),
41
41
  descriptor: {
42
42
  type: "post-excerpt",
43
- name: "Post Excerpt",
43
+ name: "Post excerpt",
44
44
  group: "dynamic",
45
45
  defaultTab: "style",
46
46
  fields: [
@@ -61,7 +61,7 @@ export const postContent: ElementDefinition<PostContentNode> = {
61
61
  defaults: () => ({ type: "post-content", props: {} }),
62
62
  descriptor: {
63
63
  type: "post-content",
64
- name: "Post Content",
64
+ name: "Post content",
65
65
  group: "dynamic",
66
66
  defaultTab: "style",
67
67
  fields: [],
@@ -78,7 +78,7 @@ export const postImage: ElementDefinition<PostImageNode> = {
78
78
  defaults: () => ({ type: "post-image", props: { decorative: false } }),
79
79
  descriptor: {
80
80
  type: "post-image",
81
- name: "Post Image",
81
+ name: "Post image",
82
82
  group: "dynamic",
83
83
  defaultTab: "content",
84
84
  fields: [{ key: "decorative", kind: "boolean", label: "Decorative", optional: true }],
@@ -95,7 +95,7 @@ export const postDate: ElementDefinition<PostDateNode> = {
95
95
  defaults: () => ({ type: "post-date", props: {} }),
96
96
  descriptor: {
97
97
  type: "post-date",
98
- name: "Post Date",
98
+ name: "Post date",
99
99
  group: "dynamic",
100
100
  defaultTab: "style",
101
101
  fields: [
@@ -122,7 +122,7 @@ export const postAuthor: ElementDefinition<PostAuthorNode> = {
122
122
  defaults: () => ({ type: "post-author", props: {} }),
123
123
  descriptor: {
124
124
  type: "post-author",
125
- name: "Post Author",
125
+ name: "Post author",
126
126
  group: "dynamic",
127
127
  defaultTab: "style",
128
128
  fields: [],
@@ -135,7 +135,7 @@ export const postLink: ElementDefinition<PostLinkNode> = {
135
135
  defaults: () => ({ type: "post-link", props: {} }),
136
136
  descriptor: {
137
137
  type: "post-link",
138
- name: "Post Link",
138
+ name: "Post link",
139
139
  group: "dynamic",
140
140
  defaultTab: "content",
141
141
  fields: [
@@ -146,7 +146,7 @@ export const postLink: ElementDefinition<PostLinkNode> = {
146
146
  optional: true,
147
147
  message: "Leave blank to use the post title.",
148
148
  },
149
- { key: "newTab", kind: "boolean", label: "Open in new tab", optional: true },
149
+ { key: "newTab", kind: "boolean", label: "Open in a new tab", optional: true },
150
150
  ],
151
151
  },
152
152
  build: (_node, attrs) => ({ tag: "a", attrs: { ...attrs, href: "#" }, children: ["Post link"] }),
@@ -222,21 +222,22 @@ export const loop: ElementDefinition<LoopNode> = {
222
222
  label: "Link pattern",
223
223
  optional: true,
224
224
  message:
225
- "Where each entry links, e.g. /team/{slug}; {slug} and {id} are filled in. Leave it empty for /collection/{slug}.",
225
+ "Where each entry links, such as /team/{slug}; {slug} and {id} are filled in. Leave it empty for /collection/{slug}.",
226
226
  },
227
227
  {
228
228
  key: "imageField",
229
229
  kind: "text",
230
230
  label: "Image field",
231
231
  optional: true,
232
- message: "The field Post Image shows, e.g. photo. Leave it empty for the featured image.",
232
+ message:
233
+ "The field Post image shows, such as photo. Leave it empty for the featured image.",
233
234
  },
234
235
  {
235
236
  key: "excerptField",
236
237
  kind: "text",
237
238
  label: "Excerpt field",
238
239
  optional: true,
239
- message: "The field Post Excerpt shows, e.g. role. Leave it empty for the excerpt.",
240
+ message: "The field Post excerpt shows, such as role. Leave it empty for the excerpt.",
240
241
  },
241
242
  {
242
243
  key: "filter",
@@ -244,15 +245,15 @@ export const loop: ElementDefinition<LoopNode> = {
244
245
  label: "Only entries where",
245
246
  optional: true,
246
247
  message:
247
- "field=value pairs separated by ;, e.g. category=news; team=design. A taxonomy works too. The same field twice matches either value.",
248
+ "field=value pairs separated by semicolons, such as category=news; team=design. A taxonomy works too. The same field twice matches either value.",
248
249
  },
249
250
  {
250
251
  key: "itemPartId",
251
252
  kind: "text",
252
- label: "Loop Item",
253
+ label: "Loop item",
253
254
  optional: true,
254
255
  message:
255
- "Optional published Loop Item theme part. Leave blank to use nested elements as the item template.",
256
+ "Optional published Loop item theme part. Leave blank to use nested elements as the item template.",
256
257
  },
257
258
  {
258
259
  key: "perPage",
@@ -318,6 +319,44 @@ export const pagination: ElementDefinition<PaginationNode> = {
318
319
  message:
319
320
  'The browser title of page 2 onward. {title} and {page} are filled in; unset is "{title} – page {page}".',
320
321
  },
322
+ {
323
+ key: "archiveTitle",
324
+ kind: "text",
325
+ label: "Posts archive title",
326
+ optional: true,
327
+ message:
328
+ "Replaces \"Posts\" as the posts archive's title, in the site's language. Category and tag archives use the term's name.",
329
+ },
330
+ {
331
+ key: "navLabel",
332
+ kind: "text",
333
+ label: "Screen reader name",
334
+ optional: true,
335
+ message:
336
+ 'What screen readers call the links, in the site\'s language. Unset is "Pagination".',
337
+ },
338
+ {
339
+ key: "pageLabel",
340
+ kind: "text",
341
+ label: "Page number name",
342
+ optional: true,
343
+ message:
344
+ 'What screen readers call each number. {page} is filled in; unset is "Page {page}".',
345
+ },
346
+ {
347
+ key: "prevLabel",
348
+ kind: "text",
349
+ label: "Previous name",
350
+ optional: true,
351
+ message: 'Read out when Previous text is only an arrow. Unset is "Previous page".',
352
+ },
353
+ {
354
+ key: "nextLabel",
355
+ kind: "text",
356
+ label: "Next name",
357
+ optional: true,
358
+ message: 'Read out when Next text is only an arrow. Unset is "Next page".',
359
+ },
321
360
  ],
322
361
  },
323
362
  // Rendered by core/render/pagination.ts from the archive's page data (W-222).
@@ -1,3 +1,4 @@
1
+ import { selectPrompt } from "./select-prompt.ts";
1
2
  import { controlId } from "./field-id.ts";
2
3
  import type {
3
4
  CheckboxNode,
@@ -43,14 +44,14 @@ const FORM_FIELD_CSS =
43
44
  ":where(.emvb-form .ec-form-input:focus-visible){outline:2px solid currentColor;outline-offset:1px;border-color:currentColor}" +
44
45
  ':where(.emvb-form .ec-form-input[aria-invalid="true"]){border-color:#b3261e}' +
45
46
  ':where(.emvb-form input[type="checkbox"],.emvb-form input[type="radio"]){width:1.1em;height:1.1em;margin:0;accent-color:currentColor}' +
46
- ":where(.emvb-form .emvb-form-checkbox-label,.emvb-form .emvb-form-radio-label){display:inline-flex;align-items:center;gap:.5em}" +
47
+ ":where(.emvb-form .emvb-form-checkbox-label,.emvb-form .emvb-form-radio-label){display:inline-flex;align-items:center;gap:.5em;overflow-wrap:anywhere}" +
47
48
  ":where(.emvb-form .emvb-radio-group){display:flex;flex-direction:column;gap:6px;margin:0;padding:0;border:0;min-width:0}" +
48
49
  ":where(.emvb-form .emvb-radio-group>legend){float:left;width:100%;margin:0 0 -2px;padding:0}" +
49
50
  ":where(.emvb-form .ec-form-error){font-size:.875em;color:#b3261e}";
50
51
 
51
52
  export const form: ElementDefinition<FormNode> = {
52
53
  baseCss:
53
- ".emvb-form{display:flex;flex-direction:column;gap:12px;min-width:0}.emvb-form-unbound{min-height:48px;padding:12px;color:var(--text-color-kumo-subtle,#666);background:var(--color-kumo-tint,#eee)}.ec-form-hp{position:absolute;left:-9999px}" +
54
+ ".emvb-form{display:flex;flex-direction:column;gap:12px;min-width:0}.emvb-form-unbound{min-height:48px;padding:12px;color:var(--text-color-kumo-subtle,#666);background:var(--color-kumo-tint,#eee)}.emvb-form-field[hidden]{display:none!important}.ec-form-hp{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}" +
54
55
  ":where(.emvb-form-paused){padding:12px 16px;border:1px solid rgba(128,128,128,.5);border:1px solid color-mix(in srgb,currentColor 25%,transparent);border-radius:6px}:where(.emvb-form-paused p){margin:0}" +
55
56
  FORM_FIELD_CSS,
56
57
  defaults: () => ({ type: "form", props: { formId: "" }, children: [] }),
@@ -65,12 +66,24 @@ export const form: ElementDefinition<FormNode> = {
65
66
  };
66
67
 
67
68
  /** Where the forms runtime writes a field's validation message. */
68
- const errorSlot = (name: string): VNode => ({
69
+ const errorSlot = (name: string, controlFor: string): VNode => ({
69
70
  tag: "span",
70
- attrs: { class: "ec-form-error", "data-error-for": name, "aria-live": "polite" },
71
+ attrs: {
72
+ class: "ec-form-error",
73
+ id: errorId(controlFor),
74
+ "data-error-for": name,
75
+ "aria-live": "polite",
76
+ },
71
77
  children: [],
72
78
  });
73
79
 
80
+ /**
81
+ * W-780: the message was only announced as it appeared; back on the field it wasn't read. Each
82
+ * control now names its error slot in aria-describedby (an empty slot adds nothing).
83
+ */
84
+ const errorId = (controlFor: string) => `${controlFor}-error`;
85
+ const describedBy = (controlFor: string) => ({ "aria-describedby": errorId(controlFor) });
86
+
74
87
  const fieldBox = (attrs: Record<string, string>, children: VNode["children"]): VNode => ({
75
88
  tag: "div",
76
89
  attrs: { ...attrs, class: `${attrs.class ?? ""} emvb-form-field`.trim() },
@@ -85,7 +98,8 @@ const fieldWrap = (
85
98
  attrs: Record<string, string>,
86
99
  ): VNode =>
87
100
  fieldBox(attrs, [
88
- ...(labelText
101
+ // W-587: a blank label is no label.
102
+ ...(labelText?.trim()
89
103
  ? [
90
104
  {
91
105
  tag: "label",
@@ -94,10 +108,24 @@ const fieldWrap = (
94
108
  } as VNode,
95
109
  ]
96
110
  : []),
97
- control,
98
- errorSlot(name),
111
+ withDescription(labelText?.trim() ? control : named(control, name), controlFor),
112
+ errorSlot(name, controlFor),
99
113
  ]);
100
114
 
115
+ const withDescription = (control: VNode, controlFor: string): VNode => ({
116
+ ...control,
117
+ attrs: { ...control.attrs, ...describedBy(controlFor) },
118
+ });
119
+
120
+ /**
121
+ * W-753: a field with no label (and no placeholder to read out) had no name at all, so a screen
122
+ * reader said only "edit text" or "group". It falls back to the field name, as a checkbox does.
123
+ */
124
+ const named = (control: VNode, name: string): VNode =>
125
+ control.attrs.placeholder?.trim() || !name.trim()
126
+ ? control
127
+ : { ...control, attrs: { ...control.attrs, "aria-label": name } };
128
+
101
129
  /** A text input or textarea bound to `field`, with its optional placeholder. */
102
130
  const textControl = (
103
131
  tag: "input" | "textarea",
@@ -146,13 +174,14 @@ export const textareaEl: ElementDefinition<TextareaNode> = {
146
174
  export const selectEl: ElementDefinition<SelectNode> = {
147
175
  baseCss: ".emvb-select{display:flex;flex-direction:column;gap:4px}",
148
176
  defaults: () => ({ type: "select", props: { field: "choice", label: "Choice" } }),
149
- descriptor: fieldDescriptor("select", "Select", NAME_AND_LABEL),
177
+ // W-686: the Placeholder words the empty first choice ("Choose…"), for sites in other languages.
178
+ descriptor: fieldDescriptor("select", "Select", TEXT_FIELDS),
150
179
  build: (node, attrs) => {
151
180
  const name = node.props.field;
152
181
  const control: VNode = {
153
182
  tag: "select",
154
183
  attrs: { class: "ec-form-input", id: controlId(node.id), name },
155
- children: [{ tag: "option", attrs: { value: "" }, children: ["Choose…"] }],
184
+ children: [{ tag: "option", attrs: { value: "" }, children: [selectPrompt(node.props)] }],
156
185
  };
157
186
  return fieldWrap(controlId(node.id), name, node.props.label, control, attrs);
158
187
  },
@@ -166,15 +195,21 @@ export const checkbox: ElementDefinition<CheckboxNode> = {
166
195
  const name = node.props.field;
167
196
  const input: VNode = {
168
197
  tag: "input",
169
- attrs: { type: "checkbox", id: controlId(node.id), name, value: "true" },
198
+ attrs: {
199
+ type: "checkbox",
200
+ id: controlId(node.id),
201
+ name,
202
+ value: "true",
203
+ ...describedBy(controlId(node.id)),
204
+ },
170
205
  children: [],
171
206
  };
172
207
  const labelEl: VNode = {
173
208
  tag: "label",
174
209
  attrs: { class: "emvb-form-checkbox-label" },
175
- children: [input, ` ${node.props.label ?? name}`],
210
+ children: [input, ` ${node.props.label?.trim() || name}`],
176
211
  };
177
- return fieldBox(attrs, [labelEl, errorSlot(name)]);
212
+ return fieldBox(attrs, [labelEl, errorSlot(name, controlId(node.id))]);
178
213
  },
179
214
  };
180
215
 
@@ -188,7 +223,7 @@ export const radio: ElementDefinition<RadioNode> = {
188
223
  const id = controlId(node.id);
189
224
  // W-524: the question is the fieldset's <legend>, so the group is named natively (it was a
190
225
  // <label> pointing at nothing plus aria-labelledby, W-442). The id stays for old references.
191
- const legend: VNode[] = node.props.label
226
+ const legend: VNode[] = node.props.label?.trim()
192
227
  ? [
193
228
  {
194
229
  tag: "legend",
@@ -199,7 +234,11 @@ export const radio: ElementDefinition<RadioNode> = {
199
234
  : [];
200
235
  const control: VNode = {
201
236
  tag: "fieldset",
202
- attrs: { class: "emvb-radio-group" },
237
+ attrs: {
238
+ class: "emvb-radio-group",
239
+ ...describedBy(id),
240
+ ...(legend.length || !name.trim() ? {} : { "aria-label": name }),
241
+ },
203
242
  children: [
204
243
  ...legend,
205
244
  {
@@ -212,12 +251,12 @@ export const radio: ElementDefinition<RadioNode> = {
212
251
  },
213
252
  ],
214
253
  };
215
- return fieldBox(attrs, [control, errorSlot(name)]);
254
+ return fieldBox(attrs, [control, errorSlot(name, id)]);
216
255
  },
217
256
  };
218
257
 
219
258
  export const submit: ElementDefinition<SubmitNode> = {
220
- baseCss: ".emvb-submit{display:inline-flex}",
259
+ baseCss: ".emvb-submit{display:inline-flex;max-width:100%;overflow-wrap:anywhere}",
221
260
  defaults: () => ({ type: "submit", props: { label: "Submit" } }),
222
261
  descriptor: fieldDescriptor("submit", "Submit", [
223
262
  { key: "label", kind: "text", label: "Label", optional: true },
@@ -26,6 +26,7 @@ import { CONTAINER_TAGS, TEXT_TAGS } from "../schema/layout.ts";
26
26
  import type { ElementDescriptor } from "../schema/descriptors.ts";
27
27
  import { sanitizeHref } from "../sanitize/href.ts";
28
28
  import { sanitizeSvgMarkup } from "../sanitize/svg.ts";
29
+ import { scopeSvgIds } from "./svg-ids.ts";
29
30
  import { sanitizeMediaUrl } from "../sanitize/media-url.ts";
30
31
  import { getBundledIcon } from "../icons/catalog.ts";
31
32
  import { resolveEmbedUrl } from "../sanitize/embed-url.ts";
@@ -53,6 +54,19 @@ export const HEADING_TAGS = ["h1", "h2", "h3", "h4", "h5", "h6"] as const;
53
54
  const newTabAttrs = (newTab: boolean | undefined): Record<string, string> =>
54
55
  newTab ? { target: "_blank", rel: "noopener noreferrer" } : {};
55
56
 
57
+ /** UX-059: tag choices read as words; p, which isn't one, names itself. */
58
+ const TAG_LABELS: Record<(typeof CONTAINER_TAGS)[number] | (typeof TEXT_TAGS)[number], string> = {
59
+ div: "Div",
60
+ section: "Section",
61
+ header: "Header",
62
+ footer: "Footer",
63
+ main: "Main",
64
+ article: "Article",
65
+ aside: "Aside",
66
+ nav: "Nav",
67
+ p: "Paragraph (p)",
68
+ };
69
+
56
70
  const LINK_MESSAGE = "Use a full URL such as https://example.com or a path such as /pricing.";
57
71
 
58
72
  /** Optional Link and new-tab fields for elements that wrap their content in a link (W-141). */
@@ -112,13 +126,21 @@ const heading: ElementDefinition<HeadingNode> = {
112
126
  /** A box link is checked like any link, so a bad URL gets an inline error, not a silent drop (W-176). */
113
127
  const BOX_LINK_FIELDS = [
114
128
  { key: "href", kind: "href" as const, label: "Link", optional: true, message: LINK_MESSAGE },
115
- { key: "newTab", kind: "boolean" as const, label: "Open in new tab", optional: true },
129
+ { key: "newTab", kind: "boolean" as const, label: "Open in a new tab", optional: true },
116
130
  ];
117
131
 
132
+ /**
133
+ * W-797: a linked box is an <a>, so without this its whole content took the browser's blue,
134
+ * underlined link look. Like a heading link it inherits; :where() lets site and local styles win.
135
+ * Every box type ships it, as any of them can be the link (W-792: CSS ships with its element).
136
+ */
137
+ const BOX_LINK_CSS = ":where(a.emvb-box-link){color:inherit;text-decoration:inherit}";
138
+
118
139
  const container: ElementDefinition<ContainerNode> = {
119
140
  // W-299: a word longer than the line (a pasted URL) breaks instead of widening the page on a phone.
120
141
  baseCss:
121
- ".emvb-container{display:flex;flex-direction:column;min-width:0;overflow-wrap:break-word}",
142
+ ".emvb-container{display:flex;flex-direction:column;min-width:0;overflow-wrap:break-word}" +
143
+ BOX_LINK_CSS,
122
144
  defaults: () => ({ type: "container", props: {}, children: [] }),
123
145
  descriptor: {
124
146
  type: "container",
@@ -131,7 +153,7 @@ const container: ElementDefinition<ContainerNode> = {
131
153
  kind: "select",
132
154
  label: "HTML tag",
133
155
  optional: true,
134
- options: CONTAINER_TAGS.map((tag) => ({ value: tag, label: tag })),
156
+ options: CONTAINER_TAGS.map((tag) => ({ value: tag, label: TAG_LABELS[tag] })),
135
157
  message: "Pick a landmark or div.",
136
158
  },
137
159
  ...BOX_LINK_FIELDS,
@@ -201,7 +223,7 @@ const text: ElementDefinition<TextNode> = {
201
223
  kind: "select",
202
224
  label: "HTML tag",
203
225
  optional: true,
204
- options: TEXT_TAGS.map((tag) => ({ value: tag, label: tag })),
226
+ options: TEXT_TAGS.map((tag) => ({ value: tag, label: TAG_LABELS[tag] })),
205
227
  },
206
228
  ],
207
229
  },
@@ -258,7 +280,7 @@ const link: ElementDefinition<LinkNode> = {
258
280
  const button: ElementDefinition<ButtonNode> = {
259
281
  baseCss:
260
282
  // The look sits in :where() so site tag defaults, classes and local styles all win (W-148).
261
- ".emvb-button{display:inline-flex;align-items:center;justify-content:center;gap:0.5em;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-figure{margin:0}.emvb-figcaption{margin-top:0.35em}.emvb-image-link{display:contents}",
283
+ ".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}",
262
284
  defaults: () => ({ type: "button", props: { text: "Button" } }),
263
285
  descriptor: {
264
286
  type: "button",
@@ -356,7 +378,9 @@ function buttonChildren(node: ButtonNode): (VNode | string)[] {
356
378
  }
357
379
 
358
380
  const list: ElementDefinition<ListNode> = {
359
- baseCss: ".emvb-list{margin:0;padding-inline-start:1.25em}.emvb-list li{margin:0}",
381
+ // W-796: "100." is wider than 1.25em, so three-digit numbers sat outside the list's box.
382
+ baseCss:
383
+ ".emvb-list{margin:0;padding-inline-start:1.25em}.emvb-list li{margin:0}.emvb-list--wide{padding-inline-start:2.25em}",
360
384
  defaults: () => ({ type: "list", props: { items: ["Item"] } }),
361
385
  descriptor: {
362
386
  type: "list",
@@ -368,21 +392,26 @@ const list: ElementDefinition<ListNode> = {
368
392
  { key: "items", kind: "list-items", label: "Items" },
369
393
  ],
370
394
  },
371
- build: (node, attrs) => ({
372
- tag: node.props.ordered ? "ol" : "ul",
373
- attrs,
395
+ build: (node, attrs) => {
374
396
  // W-275: blank items would be empty bullets on the page; a list of only blanks has none.
375
- children: node.props.items
376
- .filter((item) => item.trim() !== "")
377
- .map((item) => ({ tag: "li", attrs: {}, children: [item] })),
378
- }),
397
+ const items = node.props.items.filter((item) => item.trim() !== "");
398
+ const wide = node.props.ordered === true && items.length >= 100;
399
+ return {
400
+ tag: node.props.ordered ? "ol" : "ul",
401
+ attrs: wide ? { ...attrs, class: `${attrs.class ?? ""} emvb-list--wide`.trim() } : attrs,
402
+ children: items.map((item) => ({ tag: "li", attrs: {}, children: [item] })),
403
+ };
404
+ },
379
405
  };
380
406
 
381
407
  const image: ElementDefinition<ImageNode> = {
382
408
  // W-269: natural size, at most the container's width. A container's default stretch made a
383
409
  // 400 px image 1184 px wide (blurry); a Width (px) attribute or a style width still sets it.
384
410
  baseCss:
385
- ".emvb-image{display:block;max-width:100%;height:auto}:where(img.emvb-image:not([width])){width:fit-content}",
411
+ ".emvb-image{display:block;max-width:100%;height:auto}:where(img.emvb-image:not([width])){width:fit-content}" +
412
+ // W-792: these sat in the Button's base CSS, so a page without a Button gave a captioned
413
+ // image the browser's 40 px figure margins and a linked image a stray inline box.
414
+ ".emvb-figure{margin:0}.emvb-figcaption{margin-top:0.35em}.emvb-image-link{display:contents}",
386
415
  defaults: () => ({
387
416
  type: "image",
388
417
  props: { src: "", alt: "Image", decorative: false },
@@ -404,7 +433,7 @@ const image: ElementDefinition<ImageNode> = {
404
433
  {
405
434
  key: "decorative",
406
435
  kind: "boolean",
407
- label: "Decorative (empty alt)",
436
+ label: "Decorative",
408
437
  optional: true,
409
438
  },
410
439
  // The first big image people see (hero, LCP) shouldn't wait for lazy loading (W-226).
@@ -504,25 +533,33 @@ function imageSources(
504
533
  width: number | undefined,
505
534
  ): string | undefined {
506
535
  if (!sources || sources.length === 0) return undefined;
507
- const parts: string[] = [];
508
- const seen = new Set<string>();
536
+ const main = srcsetUrl(src);
509
537
  let srcWidth: number | undefined;
510
538
  for (const source of sources) {
511
- const url = srcsetUrl(sanitizeMediaUrl(source.src));
512
539
  if (!validSourceWidth(source.width)) continue;
513
- if (url === srcsetUrl(src)) {
514
- srcWidth ??= source.width;
515
- continue;
540
+ if (srcsetUrl(sanitizeMediaUrl(source.src)) === main) {
541
+ srcWidth = source.width;
542
+ break;
516
543
  }
544
+ }
545
+ srcWidth ??= validSourceWidth(width) ? width : undefined;
546
+ const mainListed = srcWidth !== undefined && main !== undefined && !/[\s,]/.test(main);
547
+ const parts: string[] = [];
548
+ const seen = new Set<string>();
549
+ // W-541: two candidates with one width make the whole srcset invalid; the first wins, and the
550
+ // main image's width is kept for the main image.
551
+ const widths = new Set<number>(mainListed ? [srcWidth as number] : []);
552
+ for (const source of sources) {
553
+ const url = srcsetUrl(sanitizeMediaUrl(source.src));
554
+ if (!validSourceWidth(source.width) || url === main) continue;
517
555
  // A comma or space is another srcset candidate, so one field would request a second host.
518
- if (!url || /[\s,]/.test(url) || seen.has(url)) continue;
556
+ if (!url || /[\s,]/.test(url) || seen.has(url) || widths.has(source.width)) continue;
519
557
  seen.add(url);
558
+ widths.add(source.width);
520
559
  parts.push(`${url} ${source.width}w`);
521
560
  }
522
561
  if (parts.length === 0) return undefined;
523
- srcWidth ??= validSourceWidth(width) ? width : undefined;
524
- const main = srcsetUrl(src);
525
- if (srcWidth !== undefined && main && !/[\s,]/.test(main)) parts.push(`${main} ${srcWidth}w`);
562
+ if (mainListed) parts.push(`${main} ${srcWidth}w`);
526
563
  return parts.join(", ");
527
564
  }
528
565
 
@@ -533,7 +570,8 @@ const icon: ElementDefinition<IconNode> = {
533
570
  baseCss:
534
571
  // W-237: the glyph reads the wrapper's icon custom properties (rotate, flip, shadow, loop,
535
572
  // stroke); unset they change nothing. The svg inherits the wrapper's transition for hover.
536
- ".emvb-icon{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}.emvb-icon-link{display:inline-flex;color:inherit}.emvb-icon svg{display:block;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}" +
573
+ // W-803: an icon larger than its box (512 px on a phone) shrinks to fit, keeping its shape.
574
+ ".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}" +
537
575
  ICON_STROKE_WIDTHS.map(
538
576
  (width) =>
539
577
  `.emvb-icon-sw${width.replace(".", "_")}{stroke-width:var(--emvb-icon-stroke,${width})}`,
@@ -554,7 +592,7 @@ const icon: ElementDefinition<IconNode> = {
554
592
  {
555
593
  key: "decorative",
556
594
  kind: "boolean",
557
- label: "Decorative (hide from assistive tech)",
595
+ label: "Decorative",
558
596
  optional: true,
559
597
  },
560
598
  {
@@ -754,13 +792,15 @@ const video: ElementDefinition<VideoNode> = {
754
792
  children: [],
755
793
  };
756
794
  }
795
+ // W-549: an empty Title left the player unnamed for screen readers.
796
+ const title = String(node.props.title ?? "").trim() || "Video";
757
797
  if (target.kind === "iframe") {
758
798
  return {
759
799
  tag: "iframe",
760
800
  attrs: {
761
801
  ...attrs,
762
802
  src: target.src,
763
- title: node.props.title,
803
+ title,
764
804
  loading: "lazy",
765
805
  referrerpolicy: "strict-origin-when-cross-origin",
766
806
  allow: "encrypted-media; picture-in-picture; fullscreen",
@@ -776,7 +816,7 @@ const video: ElementDefinition<VideoNode> = {
776
816
  attrs: {
777
817
  ...attrs,
778
818
  src: target.src,
779
- title: node.props.title,
819
+ title,
780
820
  controls: "",
781
821
  preload: "metadata",
782
822
  },
@@ -831,7 +871,7 @@ const svgEl: ElementDefinition<SvgNode> = {
831
871
  {
832
872
  key: "decorative",
833
873
  kind: "boolean",
834
- label: "Decorative (hide from assistive tech)",
874
+ label: "Decorative",
835
875
  optional: true,
836
876
  },
837
877
  {
@@ -876,7 +916,7 @@ const svgEl: ElementDefinition<SvgNode> = {
876
916
  return {
877
917
  tag: "span",
878
918
  attrs,
879
- children: [{ tag: "svg", attrs: svgAttrs, children: tree.children }],
919
+ children: [{ tag: "svg", attrs: svgAttrs, children: scopeSvgIds(tree.children, node.id) }],
880
920
  };
881
921
  },
882
922
  };
@@ -900,7 +940,7 @@ const tabPanel: ElementDefinition<TabPanelNode> = {
900
940
 
901
941
  const tabs: ElementDefinition<TabsNode> = {
902
942
  baseCss:
903
- ".emvb-tabs{display:flex;flex-direction:column;min-width:0;gap:0}.emvb-tab-input{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}.emvb-tab-list{display:flex;flex-wrap:wrap;gap:0;border-bottom:1px solid currentColor;margin:0;padding:0}.emvb-tab-label{display:inline-block;padding:8px 12px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px}.emvb-tab-panels{min-width:0}.emvb-tab-panel{display:none;padding-top:12px;min-width:0}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(1):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(1){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(1):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(1){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(2):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(2){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(2):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(2){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(3):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(3){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(3):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(3){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(4):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(4){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(4):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(4){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(5):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(5){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(5):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(5){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(6):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(6){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(6):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(6){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(7):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(7){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(7):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(7){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(8):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(8){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(8):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(8){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(9):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(9){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(9):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(9){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(10):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(10){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(10):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(10){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(11):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(11){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(11):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(11){display:block}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(12):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(12){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(12):checked) > .emvb-tab-panels > .emvb-tab-panel:nth-of-type(12){display:block}",
943
+ ".emvb-tabs{display:flex;flex-direction:column;min-width:0;gap:0}.emvb-tab-input{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px}.emvb-tab-list{display:flex;flex-wrap:wrap;gap:0;border-bottom:1px solid currentColor;margin:0;padding:0}.emvb-tab-label{display:inline-block;padding:8px 12px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;min-width:0;overflow-wrap:anywhere}.emvb-tab-panels{min-width:0}.emvb-tab-panel{padding-top:12px;min-width:0}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(1):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(1){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(1):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(1)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(2):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(2){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(2):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(2)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(3):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(3){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(3):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(3)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(4):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(4){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(4):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(4)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(5):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(5){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(5):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(5)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(6):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(6){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(6):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(6)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(7):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(7){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(7):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(7)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(8):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(8){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(8):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(8)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(9):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(9){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(9):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(9)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(10):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(10){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(10):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(10)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(11):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(11){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(11):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(11)){display:none!important}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(12):checked) > .emvb-tab-list > .emvb-tab-label:nth-of-type(12){border-bottom-color:currentColor;font-weight:600}.emvb-tabs:has(> .emvb-tab-input:nth-of-type(12):checked) > .emvb-tab-panels > .emvb-tab-panel:not(:nth-of-type(12)){display:none!important}",
904
944
  defaults: () => ({
905
945
  type: "tabs",
906
946
  props: {},
@@ -918,11 +958,11 @@ const tabs: ElementDefinition<TabsNode> = {
918
958
  };
919
959
 
920
960
  const divBlock: ElementDefinition<DivBlockNode> = {
921
- baseCss: ".emvb-div-block{display:block;min-width:0}",
961
+ baseCss: ".emvb-div-block{display:block;min-width:0}" + BOX_LINK_CSS,
922
962
  defaults: () => ({ type: "div-block", props: {}, children: [] }),
923
963
  descriptor: {
924
964
  type: "div-block",
925
- name: "Div Block",
965
+ name: "Div block",
926
966
  group: "layout",
927
967
  defaultTab: "style",
928
968
  fields: BOX_LINK_FIELDS,
@@ -968,7 +1008,7 @@ const layoutSection: ElementDefinition<LayoutSectionNode> = {
968
1008
  kind: "select",
969
1009
  label: "HTML tag",
970
1010
  optional: true,
971
- options: CONTAINER_TAGS.map((tag) => ({ value: tag, label: tag })),
1011
+ options: CONTAINER_TAGS.map((tag) => ({ value: tag, label: TAG_LABELS[tag] })),
972
1012
  message: "Pick a landmark or div. A section is a section by default.",
973
1013
  },
974
1014
  ],
@@ -986,7 +1026,7 @@ const TRACKS_HINT =
986
1026
  "Up to 12 tracks, one per line: 1fr, 2fr, 3fr, auto, min-content, max-content, or a length.";
987
1027
 
988
1028
  const grid: ElementDefinition<GridNode> = {
989
- baseCss: ".emvb-grid{display:grid;min-width:0}",
1029
+ baseCss: ".emvb-grid{display:grid;min-width:0}" + BOX_LINK_CSS,
990
1030
  defaults: () => ({ type: "grid", props: { columns: 3 }, children: [] }),
991
1031
  descriptor: {
992
1032
  type: "grid",
@@ -1033,7 +1073,10 @@ const grid: ElementDefinition<GridNode> = {
1033
1073
 
1034
1074
  const flexbox: ElementDefinition<FlexboxNode> = {
1035
1075
  baseCss:
1036
- ".emvb-flexbox{display:flex;flex-direction:row;flex-wrap:wrap;align-items:stretch;min-width:0;gap:16px}",
1076
+ // W-800: a word longer than the line (a pasted URL) widened a row or a centred column and the
1077
+ // page scrolled sideways on a phone; break-word (W-299) doesn't shrink a flex item, anywhere does.
1078
+ ".emvb-flexbox{display:flex;flex-direction:row;flex-wrap:wrap;align-items:stretch;min-width:0;gap:16px;overflow-wrap:anywhere}" +
1079
+ BOX_LINK_CSS,
1037
1080
  defaults: () => ({
1038
1081
  type: "flexbox",
1039
1082
  props: {},
@@ -1074,11 +1117,13 @@ const accordionItem: ElementDefinition<AccordionItemNode> = {
1074
1117
  defaultTab: "content",
1075
1118
  fields: [
1076
1119
  { key: "summary", kind: "text", label: "Title" },
1077
- { key: "open", kind: "boolean", label: "Open", optional: true },
1120
+ { key: "open", kind: "boolean", label: "Open by default", optional: true },
1078
1121
  ],
1079
1122
  },
1080
1123
  build: (node, attrs, children) => {
1081
- const summary: VNode = { tag: "summary", attrs: {}, children: [node.props.summary] };
1124
+ // W-664: a title of only spaces left a blank, unnamed toggle.
1125
+ const title = node.props.summary.trim() || "Details";
1126
+ const summary: VNode = { tag: "summary", attrs: {}, children: [title] };
1082
1127
  const body: VNode = { tag: "div", attrs: { class: "emvb-accordion-body" }, children };
1083
1128
  return {
1084
1129
  tag: "details",