@perkyzz/emvb 0.5.0 → 0.7.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 +4 -0
- package/THIRD_PARTY_NOTICES.md +23 -1
- package/licenses/exif-js.LICENSE +21 -0
- package/licenses/fflate.LICENSE +21 -0
- package/licenses/glfx.js.LICENSE +19 -0
- package/licenses/mini-photo-editor.LICENSE +21 -0
- package/licenses/photocn.LICENSE +21 -0
- package/package.json +2 -1
- package/src/admin/access/RequireEditor.tsx +7 -7
- package/src/admin/access/role.ts +5 -2
- package/src/admin/content-api.ts +10 -3
- package/src/admin/content-item.ts +1 -1
- package/src/admin/editor/A11yCopilot.tsx +104 -56
- package/src/admin/editor/CommandPalette.tsx +29 -13
- package/src/admin/editor/Editor.tsx +88 -20
- package/src/admin/editor/EditorToasts.tsx +26 -0
- package/src/admin/editor/PerfMeter.tsx +97 -72
- package/src/admin/editor/ShareLink.tsx +107 -72
- package/src/admin/editor/ShortcutsDialog.tsx +27 -16
- package/src/admin/editor/Timeline.tsx +255 -160
- package/src/admin/editor/TopBar.tsx +71 -14
- package/src/admin/editor/canvas/CanvasFrame.tsx +10 -1
- package/src/admin/editor/canvas/CanvasTextEdit.tsx +8 -2
- package/src/admin/editor/canvas/drop-line.ts +11 -3
- package/src/admin/editor/canvas/frame-focus-ring.ts +37 -0
- package/src/admin/editor/canvas/use-canvas-dnd.ts +32 -3
- package/src/admin/editor/canvas/vnode-react.tsx +7 -0
- package/src/admin/editor/collection-previews.ts +16 -1
- package/src/admin/editor/dialogs.tsx +38 -14
- package/src/admin/editor/dnd/drop-target.ts +26 -1
- package/src/admin/editor/edited-noun.ts +15 -0
- package/src/admin/editor/editor-chrome.tsx +108 -7
- package/src/admin/editor/editor-commands.ts +15 -1
- package/src/admin/editor/editor-css.ts +75 -22
- package/src/admin/editor/element-chrome.ts +21 -11
- package/src/admin/editor/feature-css.ts +45 -13
- package/src/admin/editor/icons/IconLibraryDialog.tsx +52 -11
- package/src/admin/editor/icons/library.ts +1 -1
- package/src/admin/editor/icons/use-icon-library.ts +5 -2
- package/src/admin/editor/ime.ts +29 -0
- package/src/admin/editor/palette-items.ts +10 -3
- package/src/admin/editor/panels/AddPanel.tsx +35 -10
- package/src/admin/editor/panels/ClassesSection.tsx +18 -7
- package/src/admin/editor/panels/ColorControl.tsx +135 -27
- package/src/admin/editor/panels/ConditionsEditor.tsx +52 -26
- package/src/admin/editor/panels/ElementPanel.tsx +134 -24
- package/src/admin/editor/panels/LayersPanel.tsx +68 -22
- package/src/admin/editor/panels/PageSettings.tsx +66 -35
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +170 -32
- package/src/admin/editor/panels/TokenScales.tsx +76 -36
- package/src/admin/editor/panels/TriggerSettings.tsx +50 -12
- package/src/admin/editor/panels/TriggersEditor.tsx +2 -1
- package/src/admin/editor/panels/VariableSection.tsx +53 -21
- package/src/admin/editor/panels/color-space.ts +9 -3
- package/src/admin/editor/panels/settings/AdvancedFields.tsx +12 -2
- package/src/admin/editor/panels/settings/AudienceEditor.tsx +51 -35
- package/src/admin/editor/panels/settings/BackgroundControls.tsx +55 -11
- package/src/admin/editor/panels/settings/BackgroundFill.tsx +3 -2
- package/src/admin/editor/panels/settings/BindingsEditor.tsx +15 -18
- package/src/admin/editor/panels/settings/BoxControl.tsx +2 -1
- package/src/admin/editor/panels/settings/ClassChip.tsx +21 -9
- package/src/admin/editor/panels/settings/ClassChipInput.tsx +24 -16
- package/src/admin/editor/panels/settings/DraftTextField.tsx +41 -3
- package/src/admin/editor/panels/settings/EffectsControls.tsx +38 -14
- package/src/admin/editor/panels/settings/FieldBindControl.tsx +46 -28
- package/src/admin/editor/panels/settings/FieldControl.tsx +38 -15
- package/src/admin/editor/panels/settings/FormBindControl.tsx +2 -2
- package/src/admin/editor/panels/settings/HintedSwitch.tsx +33 -0
- package/src/admin/editor/panels/settings/IconControls.tsx +12 -8
- package/src/admin/editor/panels/settings/IconPicker.tsx +2 -0
- package/src/admin/editor/panels/settings/ImageSourcesField.tsx +3 -1
- package/src/admin/editor/panels/settings/ItemList.tsx +15 -2
- package/src/admin/editor/panels/settings/LengthRow.tsx +8 -6
- package/src/admin/editor/panels/settings/MediaPicker.tsx +274 -20
- package/src/admin/editor/panels/settings/MotionControl.tsx +28 -15
- package/src/admin/editor/panels/settings/NumberRow.tsx +9 -3
- package/src/admin/editor/panels/settings/PanelSelect.tsx +50 -0
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +25 -18
- package/src/admin/editor/panels/settings/RequiredFieldsNotice.tsx +141 -0
- package/src/admin/editor/panels/settings/StyleRow.tsx +10 -3
- package/src/admin/editor/panels/settings/StyleSources.tsx +4 -1
- package/src/admin/editor/panels/settings/VariantEditor.tsx +10 -1
- package/src/admin/editor/panels/settings/box-link-name.ts +6 -2
- package/src/admin/editor/panels/settings/class-suggest.ts +7 -7
- package/src/admin/editor/panels/settings/query-style.ts +38 -9
- package/src/admin/editor/panels/settings/svg-images.ts +13 -0
- package/src/admin/editor/panels/site-list.tsx +20 -6
- package/src/admin/editor/panels/variable-values.ts +25 -4
- package/src/admin/editor/restore-deleted.ts +21 -2
- package/src/admin/editor/section-templates.ts +81 -12
- package/src/admin/editor/shortcuts.ts +17 -2
- package/src/admin/editor/store.ts +14 -3
- package/src/admin/editor/useEditorCommands.ts +61 -15
- package/src/admin/editor/useEditorData.ts +4 -2
- package/src/admin/editor/useEditorShortcuts.ts +17 -7
- package/src/admin/editor/useNodeActions.ts +61 -6
- package/src/admin/editor/useSave.ts +22 -7
- package/src/admin/forms-api.ts +2 -0
- package/src/admin/image-editor/BlurFocus.tsx +112 -0
- package/src/admin/image-editor/Canvas.tsx +261 -0
- package/src/admin/image-editor/CropOverlay.tsx +390 -0
- package/src/admin/image-editor/CurvesPanel.tsx +395 -0
- package/src/admin/image-editor/ExportDialog.tsx +384 -0
- package/src/admin/image-editor/ImageEditButton.tsx +83 -0
- package/src/admin/image-editor/ImageEditorDialog.tsx +828 -0
- package/src/admin/image-editor/MetadataPanel.tsx +194 -0
- package/src/admin/image-editor/announce.tsx +65 -0
- package/src/admin/image-editor/crop-geometry.ts +162 -0
- package/src/admin/image-editor/curve-math.ts +177 -0
- package/src/admin/image-editor/data-url-fetch.ts +59 -0
- package/src/admin/image-editor/engine.ts +55 -0
- package/src/admin/image-editor/exif.ts +82 -0
- package/src/admin/image-editor/flatten.ts +54 -0
- package/src/admin/image-editor/gpu-fit.ts +81 -0
- package/src/admin/image-editor/image-editor-css.ts +400 -0
- package/src/admin/image-editor/load.ts +116 -0
- package/src/admin/image-editor/panels.tsx +287 -0
- package/src/admin/image-editor/parts.tsx +614 -0
- package/src/admin/image-editor/save.ts +141 -0
- package/src/admin/image-editor/tone-panels.tsx +338 -0
- package/src/admin/image-editor/tools.ts +59 -0
- package/src/admin/image-editor/worker.ts +111 -0
- package/src/admin/media-api.ts +114 -3
- package/src/admin/pages/AgentsPage.tsx +138 -27
- package/src/admin/pages/CreateDialog.tsx +97 -30
- package/src/admin/pages/NewPageDialog.tsx +21 -3
- package/src/admin/pages/NewThemePartDialog.tsx +11 -3
- package/src/admin/pages/PageList.tsx +14 -6
- package/src/admin/pages/SetupShell.tsx +28 -12
- package/src/admin/pages/ThemePartList.tsx +27 -7
- package/src/admin/pages/list-kit.tsx +106 -24
- package/src/admin/search.ts +15 -0
- package/src/admin/setup/useSetupStatus.ts +1 -1
- package/src/admin/theme-api.ts +13 -3
- package/src/admin/ui.ts +78 -22
- package/src/astro/EmVBPage.astro +11 -2
- package/src/astro/floats/runtime.ts +21 -0
- package/src/astro/menu/runtime.ts +34 -1
- package/src/astro/popups/runtime.ts +33 -3
- package/src/astro/render.ts +6 -0
- package/src/astro/resolve-theme.ts +67 -14
- package/src/astro/resolve.ts +9 -1
- package/src/astro/tabs/runtime.ts +12 -0
- package/src/astro/theme-posts.ts +2 -2
- package/src/astro/visitor.ts +6 -3
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +171 -24
- package/src/core/arrange.ts +29 -6
- package/src/core/audience/rules.ts +5 -1
- package/src/core/audience/variants.ts +29 -3
- package/src/core/clipboard.ts +7 -0
- package/src/core/css/generate.ts +31 -6
- package/src/core/data/bindings.ts +19 -6
- package/src/core/design/classes.ts +20 -9
- package/src/core/design/diff.ts +9 -1
- package/src/core/design/merge.ts +93 -3
- package/src/core/design/tokens.ts +16 -2
- package/src/core/design/transfer.ts +46 -8
- package/src/core/design/variables.ts +32 -10
- package/src/core/elements/dynamic-elements.ts +53 -6
- package/src/core/elements/form-elements.ts +68 -30
- package/src/core/elements/index.ts +83 -38
- package/src/core/elements/menu.ts +37 -19
- package/src/core/elements/plain-text.ts +2 -2
- package/src/core/elements/select-prompt.ts +3 -0
- package/src/core/elements/svg-ids.ts +39 -0
- package/src/core/forms/binding.ts +190 -2
- package/src/core/forms/definition.ts +72 -0
- package/src/core/history/diff.ts +49 -4
- package/src/core/icons/catalog.ts +3 -2
- package/src/core/image-edit/schema.ts +155 -0
- package/src/core/image-edit/summary.ts +61 -0
- package/src/core/index.ts +29 -1
- package/src/core/limits.ts +21 -0
- package/src/core/migrate/index.ts +3 -1
- package/src/core/perf/meter.ts +51 -8
- package/src/core/recipes/index.ts +5 -4
- package/src/core/render/context.ts +8 -0
- package/src/core/render/dynamic-post.ts +71 -13
- package/src/core/render/extras.ts +77 -4
- package/src/core/render/form.ts +164 -12
- package/src/core/render/index.ts +179 -22
- package/src/core/render/loop.ts +43 -7
- package/src/core/render/pagination.ts +18 -4
- package/src/core/render/section.ts +27 -0
- package/src/core/render/tabs.ts +12 -3
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +15 -2
- package/src/core/sanitize/embed-url.ts +42 -5
- package/src/core/sanitize/url.ts +2 -1
- package/src/core/schema/layout.ts +26 -7
- package/src/core/share/link.ts +5 -2
- package/src/core/stable-json.ts +15 -0
- package/src/core/stats.ts +2 -1
- package/src/core/theme/conditions.ts +3 -1
- package/src/core/theme/dynamic.ts +57 -23
- package/src/core/theme/float.ts +9 -2
- package/src/core/theme/pagination.ts +57 -10
- package/src/core/theme/popup-markup.ts +23 -5
- package/src/core/theme/popup-rules.ts +11 -5
- package/src/core/theme/triggers.ts +3 -2
- package/src/core/tree-ops.ts +27 -0
- package/src/mcp/ports.ts +8 -1
- package/src/mcp/rate-limit.ts +2 -1
- package/src/mcp/read.ts +82 -3
- package/src/mcp/refs.ts +18 -0
- package/src/mcp/tools.ts +1 -1
- package/src/mcp/write.ts +271 -25
- package/src/server/agent-settings.ts +29 -4
- package/src/server/hooks.ts +5 -3
- package/src/server/icon-routes.ts +33 -9
- package/src/server/mcp-routes.ts +74 -11
package/src/admin/ui.ts
CHANGED
|
@@ -45,8 +45,14 @@ export const UI_CSS = `
|
|
|
45
45
|
border-radius: 6px;
|
|
46
46
|
}
|
|
47
47
|
.emvb-mono { font-family: var(--font-mono); }
|
|
48
|
-
|
|
48
|
+
/* W-763: helpers quote what was typed; a long value with no spaces ran off the panel. */
|
|
49
|
+
.emvb-helper { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); overflow-wrap: anywhere; }
|
|
49
50
|
.emvb-helper a { color: var(--text-color-kumo-default); text-decoration: underline; text-underline-offset: 2px; }
|
|
51
|
+
.emvb-required-notice { margin-top: 4px; }
|
|
52
|
+
.emvb-required-notice__list { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 12px; line-height: 16px; }
|
|
53
|
+
.emvb-required-notice__list > li { padding-inline-start: 10px; border-inline-start: 2px solid currentColor; }
|
|
54
|
+
.emvb-required-notice__list strong { font-weight: 600; }
|
|
55
|
+
.emvb-required-notice__hint { display: block; margin-top: 8px; font-size: 12px; line-height: 16px; opacity: 0.85; }
|
|
50
56
|
.emvb-inline-error { display: flex; gap: 4px; align-items: flex-start; margin: 0; font-size: 12px; line-height: 16px; color: var(--text-color-kumo-danger); }
|
|
51
57
|
.emvb-status {
|
|
52
58
|
display: inline-flex;
|
|
@@ -68,6 +74,12 @@ export const UI_CSS = `
|
|
|
68
74
|
|
|
69
75
|
/* List / setup pages */
|
|
70
76
|
.emvb-pages { display: flex; flex-direction: column; gap: 16px; }
|
|
77
|
+
.emvb-list-loading { min-height: 200px; }
|
|
78
|
+
.emvb-loading-status { margin: 0; padding: 24px 0; text-align: center; }
|
|
79
|
+
.emvb-list-skeleton-rows { display: grid; gap: 14px; }
|
|
80
|
+
.emvb-list-skeleton-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 16px; align-items: center; }
|
|
81
|
+
.emvb-list-skeleton-title { display: grid; gap: 4px; }
|
|
82
|
+
.emvb-list-loading .skeleton-line { background: var(--color-kumo-tint); }
|
|
71
83
|
.emvb-list-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
72
84
|
.emvb-list-search { max-width: 320px; margin: 12px 0; }
|
|
73
85
|
.emvb-page-title { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; color: var(--text-color-kumo-default); }
|
|
@@ -77,6 +89,10 @@ export const UI_CSS = `
|
|
|
77
89
|
.emvb-row-slug { font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--text-color-kumo-subtle); }
|
|
78
90
|
/* W-209: a long unbroken title or slug wraps instead of pushing Status and Last edited out of the card. */
|
|
79
91
|
.emvb-row-title, .emvb-row-slug { overflow-wrap: anywhere; }
|
|
92
|
+
/* UX-018: on narrow admin widths the short columns keep one line and the title keeps a readable
|
|
93
|
+
width; the card scrolls sideways before anything breaks mid-word or mid-date. */
|
|
94
|
+
.emvb-surface-card[data-emvb-list] :is(th, td):not(:first-child) { white-space: nowrap; }
|
|
95
|
+
.emvb-surface-card[data-emvb-list] td:first-child { min-width: 180px; }
|
|
80
96
|
.emvb-tabular { font-variant-numeric: tabular-nums; color: var(--text-color-kumo-subtle); font-size: 13px; }
|
|
81
97
|
|
|
82
98
|
/* Elevated EmVB-owned card chrome (lists, empty/setup shells) — not host sidebar/header */
|
|
@@ -94,6 +110,7 @@ export const UI_CSS = `
|
|
|
94
110
|
/* Live MCP test: the AI agents page reads as cards with clear headings, not bare browser defaults. */
|
|
95
111
|
.emvb-agents { max-width: 960px; }
|
|
96
112
|
.emvb-agents-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
|
113
|
+
.emvb-agents-save { min-height: 16px; margin: 0; }
|
|
97
114
|
.emvb-agents-header p { margin: 4px 0 0; font-size: 14px; line-height: 20px; color: var(--text-color-kumo-subtle); }
|
|
98
115
|
.emvb-agents-status { display: inline-flex; flex: none; align-items: center; gap: 6px; margin-top: 6px; padding: 2px 10px; border: 1px solid var(--color-kumo-line); border-radius: 999px; background: var(--color-kumo-base); color: var(--text-color-kumo-default); font-size: 12px; line-height: 20px; font-weight: 600; }
|
|
99
116
|
.emvb-agents-status > span { width: 8px; height: 8px; border-radius: 999px; background: var(--text-color-kumo-subtle); }
|
|
@@ -102,6 +119,8 @@ export const UI_CSS = `
|
|
|
102
119
|
.emvb-agents-head { display: flex; align-items: flex-start; gap: 12px; }
|
|
103
120
|
.emvb-agents-icon { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--color-kumo-tint); color: var(--text-color-kumo-default); }
|
|
104
121
|
.emvb-agents-section h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text-color-kumo-default); }
|
|
122
|
+
.emvb-agents-snippet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
|
|
123
|
+
.emvb-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
|
|
105
124
|
.emvb-agents-section h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; line-height: 20px; font-weight: 600; color: var(--text-color-kumo-default); }
|
|
106
125
|
.emvb-agents-section p { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-color-kumo-subtle); }
|
|
107
126
|
.emvb-agents-section code { padding: 1px 5px; border-radius: 4px; background: var(--color-kumo-tint); font-family: var(--font-mono); font-size: 12px; }
|
|
@@ -110,7 +129,8 @@ export const UI_CSS = `
|
|
|
110
129
|
.emvb-agents-field { display: grid; gap: 6px; }
|
|
111
130
|
.emvb-agents-snippets { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
|
|
112
131
|
.emvb-agents-snippet { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--color-kumo-line); border-radius: 8px; }
|
|
113
|
-
.emvb-agents-section pre { margin: 0; padding: 12px; overflow-x: auto; border-radius: 6px; background: var(--color-kumo-
|
|
132
|
+
.emvb-agents-section pre { margin: 0; padding: 12px; overflow-x: auto; border-radius: 6px; background: var(--color-kumo-tint); font-family: var(--font-mono); font-size: 12px; line-height: 18px; }
|
|
133
|
+
.emvb-agents-section pre:focus-visible { outline: 2px solid var(--color-kumo-brand); outline-offset: 2px; }
|
|
114
134
|
.emvb-agents-table { overflow-x: auto; margin-inline: -20px; margin-bottom: -20px; border-top: 1px solid var(--color-kumo-line); }
|
|
115
135
|
.emvb-agents-table table { width: 100%; }
|
|
116
136
|
.emvb-agents-when { color: var(--text-color-kumo-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
@@ -119,8 +139,14 @@ export const UI_CSS = `
|
|
|
119
139
|
.emvb-agents-link:hover { text-decoration: underline; }
|
|
120
140
|
.emvb-agents-link:focus-visible { outline: 2px solid var(--color-kumo-brand); outline-offset: 2px; border-radius: 4px; }
|
|
121
141
|
.emvb-timeline-agent { display: inline-flex; flex: none; align-items: center; gap: 3px; padding: 1px 7px 1px 5px; border: 1px solid var(--color-kumo-line); border-radius: 999px; background: var(--color-kumo-base); color: var(--text-color-kumo-default); font-size: 11px; line-height: 16px; font-weight: 600; }
|
|
122
|
-
.emvb-surface-card[data-emvb-list] { gap: 0; padding: 0; overflow: hidden; }
|
|
142
|
+
.emvb-surface-card[data-emvb-list] { gap: 0; padding: 0; overflow: hidden; overflow-x: auto; }
|
|
123
143
|
.emvb-surface-card[data-emvb-list] table { width: 100%; }
|
|
144
|
+
/* UX-054: the whole row opens the page: the title link stretches over its row,
|
|
145
|
+
and the row tints on hover, so a click on the status or date isn't lost. */
|
|
146
|
+
.emvb-surface-card[data-emvb-list] tbody tr { position: relative; }
|
|
147
|
+
.emvb-surface-card[data-emvb-list] tbody tr:hover { background: var(--color-kumo-tint); }
|
|
148
|
+
.emvb-surface-card[data-emvb-list] tbody tr:hover .emvb-row-title { text-decoration: underline; text-underline-offset: 2px; }
|
|
149
|
+
.emvb-surface-card[data-emvb-list] .emvb-row-title::after { content: ""; position: absolute; inset: 0; }
|
|
124
150
|
.emvb-surface-card .emvb-empty-shell,
|
|
125
151
|
.emvb-empty-shell {
|
|
126
152
|
display: flex;
|
|
@@ -170,14 +196,36 @@ export const UI_CSS = `
|
|
|
170
196
|
.emvb-theme-filter-count { margin-left: 6px; color: var(--text-color-kumo-subtle); font-weight: 400; }
|
|
171
197
|
.emvb-theme-filter:hover { color: var(--text-color-kumo-default); }
|
|
172
198
|
.emvb-theme-filter:focus-visible { outline: 2px solid var(--color-kumo-brand); outline-offset: 2px; }
|
|
199
|
+
/* UX-038: a row that scrolls fades at the edge that has more tabs, so hidden filters aren't
|
|
200
|
+
mistaken for none. The fade follows the row's own scroll; a row that fits has no timeline. */
|
|
201
|
+
@property --emvb-fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
|
|
202
|
+
@property --emvb-fade-end { syntax: "<length>"; inherits: false; initial-value: 0px; }
|
|
203
|
+
@keyframes emvb-edge-fade {
|
|
204
|
+
0% { --emvb-fade-start: 0px; --emvb-fade-end: 32px; }
|
|
205
|
+
8% { --emvb-fade-start: 32px; }
|
|
206
|
+
92% { --emvb-fade-end: 32px; }
|
|
207
|
+
100% { --emvb-fade-start: 32px; --emvb-fade-end: 0px; }
|
|
208
|
+
}
|
|
209
|
+
@supports (animation-timeline: scroll()) {
|
|
210
|
+
.emvb-theme-filters {
|
|
211
|
+
animation: emvb-edge-fade linear both;
|
|
212
|
+
animation-timeline: scroll(self inline);
|
|
213
|
+
mask-image: linear-gradient(to right, transparent, #000 var(--emvb-fade-start), #000 calc(100% - var(--emvb-fade-end)), transparent);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
173
216
|
|
|
174
217
|
/* EmVB-owned dialog body (Kumo Dialog keeps host radius/shadow) */
|
|
175
218
|
.emvb-dialog { display: flex; flex-direction: column; gap: 10px; }
|
|
176
219
|
.emvb-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
|
220
|
+
/* UX-023: selects in EmVB dialogs line up with the full-width fields under them. */
|
|
221
|
+
.emvb-dialog .emvb-field { width: 100%; }
|
|
222
|
+
.emvb-create-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
223
|
+
.emvb-create-status { min-height: 18px; }
|
|
224
|
+
/* UX-090: 16 px so the title stands above the 14 px field labels under it. */
|
|
177
225
|
.emvb-dialog :is(h2, [data-slot="title"]) {
|
|
178
226
|
margin: 0;
|
|
179
|
-
font-size:
|
|
180
|
-
line-height:
|
|
227
|
+
font-size: 16px;
|
|
228
|
+
line-height: 22px;
|
|
181
229
|
font-weight: 600;
|
|
182
230
|
color: var(--text-color-kumo-default);
|
|
183
231
|
}
|
|
@@ -211,6 +259,8 @@ export const UI_CSS = `
|
|
|
211
259
|
.emvb-device-fieldset > .emvb-helper { width: 100%; margin: 0; }
|
|
212
260
|
.emvb-device-option { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; font-size: 13px; cursor: pointer; }
|
|
213
261
|
.emvb-device-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--color-kumo-brand); }
|
|
262
|
+
/* UX-027: every native checkbox and radio EmVB draws takes the accent, not the OS blue. */
|
|
263
|
+
:is([data-emvb-editor], [data-emvb-page]) input:is([type="checkbox"], [type="radio"]) { accent-color: var(--color-kumo-brand); }
|
|
214
264
|
.emvb-device-option input:focus-visible { outline: 2px solid var(--color-kumo-brand); outline-offset: 2px; }
|
|
215
265
|
|
|
216
266
|
/* Conditions editor (theme-part settings) */
|
|
@@ -231,7 +281,7 @@ export const UI_CSS = `
|
|
|
231
281
|
}
|
|
232
282
|
.emvb-condition-row {
|
|
233
283
|
display: grid;
|
|
234
|
-
grid-template-columns: 96px 1fr 28px;
|
|
284
|
+
grid-template-columns: 96px minmax(0, 1fr) 28px;
|
|
235
285
|
gap: 6px;
|
|
236
286
|
align-items: center;
|
|
237
287
|
padding: 6px;
|
|
@@ -239,26 +289,32 @@ export const UI_CSS = `
|
|
|
239
289
|
background: var(--emvb-glass-strong, var(--color-kumo-base));
|
|
240
290
|
box-shadow: var(--emvb-elevation-s);
|
|
241
291
|
}
|
|
242
|
-
.emvb-
|
|
243
|
-
.emvb-
|
|
244
|
-
height: var(--emvb-control, 28px);
|
|
245
|
-
border-radius: 6px;
|
|
246
|
-
border: 1px solid var(--color-kumo-hairline);
|
|
247
|
-
background: var(--color-kumo-control, var(--color-kumo-base));
|
|
248
|
-
color: var(--text-color-kumo-default);
|
|
249
|
-
font: inherit;
|
|
250
|
-
font-size: 13px;
|
|
251
|
-
padding: 0 8px;
|
|
252
|
-
}
|
|
253
|
-
.emvb-condition-op:focus-visible,
|
|
254
|
-
.emvb-condition-where:focus-visible {
|
|
255
|
-
outline: 2px solid var(--color-kumo-brand);
|
|
256
|
-
outline-offset: 2px;
|
|
257
|
-
}
|
|
292
|
+
.emvb-panel-select { display: block; min-width: 0; }
|
|
293
|
+
.emvb-panel-select .emvb-field { width: 100%; min-width: 0; }
|
|
258
294
|
.emvb-condition-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
|
|
259
295
|
|
|
260
296
|
@media (prefers-reduced-motion: reduce) {
|
|
261
297
|
[data-emvb-editor] *, [data-emvb-page] * { transition: none !important; animation: none !important; }
|
|
298
|
+
/* Kumo portals sit outside the editor/page roots; a dialog body identifies EmVB ownership. */
|
|
299
|
+
[data-base-ui-portal]:has([data-emvb-dialog]),
|
|
300
|
+
[data-base-ui-portal]:has([data-emvb-dialog]) *,
|
|
301
|
+
[data-base-ui-portal]:has([data-emvb-dialog])::before,
|
|
302
|
+
[data-base-ui-portal]:has([data-emvb-dialog])::after,
|
|
303
|
+
[data-base-ui-portal]:has([data-emvb-dialog]) *::before,
|
|
304
|
+
[data-base-ui-portal]:has([data-emvb-dialog]) *::after {
|
|
305
|
+
transition: none !important;
|
|
306
|
+
animation: none !important;
|
|
307
|
+
}
|
|
308
|
+
.emvb-list-loading .skeleton-line::after { animation: none !important; }
|
|
309
|
+
[data-emvb-toasts],
|
|
310
|
+
[data-emvb-toasts] *,
|
|
311
|
+
[data-emvb-toasts]::before,
|
|
312
|
+
[data-emvb-toasts]::after,
|
|
313
|
+
[data-emvb-toasts] *::before,
|
|
314
|
+
[data-emvb-toasts] *::after {
|
|
315
|
+
transition: none !important;
|
|
316
|
+
animation: none !important;
|
|
317
|
+
}
|
|
262
318
|
}
|
|
263
319
|
@media (prefers-reduced-transparency: reduce) {
|
|
264
320
|
.emvb-status,
|
package/src/astro/EmVBPage.astro
CHANGED
|
@@ -21,16 +21,25 @@ interface Props {
|
|
|
21
21
|
* canonical, robots (No index), Open Graph and Twitter card. Pass `getSeoMeta(entry, …)`.
|
|
22
22
|
*/
|
|
23
23
|
seo?: PageMeta;
|
|
24
|
+
/**
|
|
25
|
+
* W-528: the document language in blank canvas mode, e.g. "fr-CA". Defaults to the request's
|
|
26
|
+
* Astro locale, then "en"; it was always "en", so screen readers read other sites in English.
|
|
27
|
+
*/
|
|
28
|
+
lang?: string;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
/** A BCP 47-shaped language tag, or undefined. */
|
|
32
|
+
const LANG_TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
|
33
|
+
|
|
34
|
+
const { page, standalone = false, title = "", description, seo, lang } = Astro.props;
|
|
35
|
+
const docLang = [lang, Astro.currentLocale].find((tag) => tag && LANG_TAG.test(tag)) ?? "en";
|
|
27
36
|
const ogTitle = seo?.ogTitle || title;
|
|
28
37
|
const ogDescription = seo?.ogDescription ?? description;
|
|
29
38
|
---
|
|
30
39
|
|
|
31
40
|
{
|
|
32
41
|
standalone ? (
|
|
33
|
-
<html lang=
|
|
42
|
+
<html lang={docLang} dir={page.dir}>
|
|
34
43
|
<head>
|
|
35
44
|
<meta charset="utf-8" />
|
|
36
45
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
@@ -50,8 +50,29 @@ function placeFloats(): void {
|
|
|
50
50
|
root.style.setProperty("--emvb-float-bottom", `${bottom}px`);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
const FOCUSABLE =
|
|
54
|
+
'a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),summary,[tabindex]:not([tabindex="-1"])';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* W-782: hiding the float that holds focus dropped focus to <body>, so the next Tab
|
|
58
|
+
* restarted at the top of the page. Move it to the nearest control after the float,
|
|
59
|
+
* else the one before it.
|
|
60
|
+
*/
|
|
61
|
+
function keepFocusNear(el: HTMLElement): void {
|
|
62
|
+
if (!el.contains(document.activeElement)) return;
|
|
63
|
+
const candidates = [...document.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(
|
|
64
|
+
(c) => !el.contains(c) && !c.closest("[hidden],[inert]"),
|
|
65
|
+
);
|
|
66
|
+
const after = candidates.find(
|
|
67
|
+
(c) => (el.compareDocumentPosition(c) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0,
|
|
68
|
+
);
|
|
69
|
+
const target = after ?? candidates.at(-1);
|
|
70
|
+
target?.focus();
|
|
71
|
+
}
|
|
72
|
+
|
|
53
73
|
function hide(el: HTMLElement): void {
|
|
54
74
|
const id = el.getAttribute("data-emvb-float");
|
|
75
|
+
keepFocusNear(el);
|
|
55
76
|
el.hidden = true;
|
|
56
77
|
if (id) rememberClosed(id);
|
|
57
78
|
placeFloats();
|
|
@@ -5,13 +5,41 @@
|
|
|
5
5
|
* menu item (W-254). Hosts load it when `needsMenuRuntime` is true.
|
|
6
6
|
*/
|
|
7
7
|
const OPEN = "details.emvb-menu-item__disclosure[open]";
|
|
8
|
+
const DISMISSED = "emvbMenuDismissed";
|
|
9
|
+
|
|
10
|
+
/** W-783: the menu items under the pointer, so Escape can hide a hover-shown panel. */
|
|
11
|
+
let pointerOver: Element | null = null;
|
|
12
|
+
|
|
13
|
+
function itemsAround(node: Element | null): HTMLElement[] {
|
|
14
|
+
const items: HTMLElement[] = [];
|
|
15
|
+
let item = node?.closest<HTMLElement>(".emvb-menu .emvb-menu-item") ?? null;
|
|
16
|
+
while (item) {
|
|
17
|
+
items.push(item);
|
|
18
|
+
item = item.parentElement?.closest<HTMLElement>(".emvb-menu .emvb-menu-item") ?? null;
|
|
19
|
+
}
|
|
20
|
+
return items;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Forget a dismissal once the pointer or focus is somewhere else. */
|
|
24
|
+
function clearDismissed(target: Node | null): void {
|
|
25
|
+
for (const item of document.querySelectorAll<HTMLElement>("[data-emvb-menu-dismissed]")) {
|
|
26
|
+
if (target && item.contains(target)) continue;
|
|
27
|
+
delete item.dataset[DISMISSED];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
8
30
|
|
|
9
31
|
function onKeydown(event: KeyboardEvent): void {
|
|
10
32
|
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
11
33
|
const active = document.activeElement;
|
|
12
34
|
const inside = active instanceof Element ? active.closest<HTMLDetailsElement>(OPEN) : null;
|
|
13
35
|
const target = inside ?? document.querySelector<HTMLDetailsElement>(`.emvb-menu ${OPEN}`);
|
|
14
|
-
|
|
36
|
+
// W-783: a panel shown by hover stayed up after Escape until the pointer moved away.
|
|
37
|
+
const hovered = itemsAround(pointerOver);
|
|
38
|
+
for (const item of hovered) item.dataset[DISMISSED] = "1";
|
|
39
|
+
if (!target) {
|
|
40
|
+
if (hovered.length > 0) event.preventDefault();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
15
43
|
target.open = false;
|
|
16
44
|
target.querySelector<HTMLElement>(":scope > summary")?.focus({ preventScroll: true });
|
|
17
45
|
event.preventDefault();
|
|
@@ -20,6 +48,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|
|
20
48
|
/** W-254: an open dropdown closes once focus or a pointer press lands outside its menu item. */
|
|
21
49
|
function closeOthers(event: Event): void {
|
|
22
50
|
const target = event.target instanceof Node ? event.target : null;
|
|
51
|
+
clearDismissed(target);
|
|
23
52
|
for (const details of document.querySelectorAll<HTMLDetailsElement>(`.emvb-menu ${OPEN}`)) {
|
|
24
53
|
const item = details.closest(".emvb-menu-item") ?? details;
|
|
25
54
|
if (target && item.contains(target)) continue;
|
|
@@ -34,4 +63,8 @@ export function initMenus(root: Document = document): void {
|
|
|
34
63
|
root.addEventListener("keydown", onKeydown);
|
|
35
64
|
root.addEventListener("focusin", closeOthers);
|
|
36
65
|
root.addEventListener("pointerdown", closeOthers);
|
|
66
|
+
root.addEventListener("pointerover", (event) => {
|
|
67
|
+
pointerOver = event.target instanceof Element ? event.target : null;
|
|
68
|
+
clearDismissed(pointerOver);
|
|
69
|
+
});
|
|
37
70
|
}
|
|
@@ -156,14 +156,16 @@ function createController(root: HTMLElement): Controller | null {
|
|
|
156
156
|
|
|
157
157
|
function focusables(container: HTMLElement): HTMLElement[] {
|
|
158
158
|
const nodes = container.querySelectorAll<HTMLElement>(
|
|
159
|
-
'a
|
|
159
|
+
// W-672: an accordion's or menu's <summary>, a video player and an editable area take focus
|
|
160
|
+
// too; one of them last in the dialog let Tab leave for the page behind.
|
|
161
|
+
'a[href], button:not([disabled]), textarea, input, select, summary, iframe, video[controls], audio[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])',
|
|
160
162
|
);
|
|
161
163
|
// W-279: a form's hidden inputs and controls hidden on this device can't take focus; counting
|
|
162
164
|
// one as the last control let Tab leave the dialog from the real last one.
|
|
163
165
|
return [...nodes].filter(
|
|
164
166
|
(el) =>
|
|
165
167
|
!el.hasAttribute("disabled") &&
|
|
166
|
-
el.tabIndex >= 0 &&
|
|
168
|
+
(el.tabIndex >= 0 || (el.localName === "summary" && !el.hasAttribute("tabindex"))) &&
|
|
167
169
|
!(el instanceof HTMLInputElement && el.type === "hidden") &&
|
|
168
170
|
!el.closest("[hidden], [inert]") &&
|
|
169
171
|
(typeof el.checkVisibility !== "function" || el.checkVisibility()),
|
|
@@ -193,8 +195,23 @@ function bindA11y(ctrl: Controller): void {
|
|
|
193
195
|
}
|
|
194
196
|
});
|
|
195
197
|
ctrl.dialog.addEventListener("keydown", (event) => {
|
|
198
|
+
// W-676: while an input method is composing (Japanese, Chinese, Korean), Escape cancels the
|
|
199
|
+
// word being typed; it closed the whole popup and lost what was in the form.
|
|
200
|
+
if (event.key === "Escape" && (event.isComposing || event.keyCode === 229)) return;
|
|
196
201
|
if (event.key === "Escape") {
|
|
197
202
|
event.preventDefault();
|
|
203
|
+
// W-580: Escape in an open menu dropdown inside the popup closes that dropdown first (the
|
|
204
|
+
// menu runtime saw the event already handled, so the whole popup closed instead).
|
|
205
|
+
const active = document.activeElement;
|
|
206
|
+
const menu =
|
|
207
|
+
active instanceof Element
|
|
208
|
+
? active.closest<HTMLDetailsElement>("details.emvb-menu-item__disclosure[open]")
|
|
209
|
+
: null;
|
|
210
|
+
if (menu && ctrl.dialog.contains(menu)) {
|
|
211
|
+
menu.open = false;
|
|
212
|
+
menu.querySelector<HTMLElement>(":scope > summary")?.focus({ preventScroll: true });
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
198
215
|
ctrl.close();
|
|
199
216
|
return;
|
|
200
217
|
}
|
|
@@ -208,7 +225,11 @@ function bindA11y(ctrl: Controller): void {
|
|
|
208
225
|
const first = items[0];
|
|
209
226
|
const last = items[items.length - 1];
|
|
210
227
|
if (!first || !last) return;
|
|
211
|
-
|
|
228
|
+
// W-553: opening focuses the dialog itself; Shift+Tab from there left for the page behind.
|
|
229
|
+
if (
|
|
230
|
+
event.shiftKey &&
|
|
231
|
+
(document.activeElement === first || document.activeElement === ctrl.dialog)
|
|
232
|
+
) {
|
|
212
233
|
event.preventDefault();
|
|
213
234
|
last.focus();
|
|
214
235
|
} else if (!event.shiftKey && document.activeElement === last) {
|
|
@@ -296,9 +317,18 @@ function registerTrigger(ctrl: Controller, config: PopupConfig, trigger: OpenTri
|
|
|
296
317
|
arm?.(() => openOnce(ctrl, config), trigger as never);
|
|
297
318
|
}
|
|
298
319
|
|
|
320
|
+
/**
|
|
321
|
+
* W-757: as W-407 for floats, a second call (a host loading the script twice, or calling it again
|
|
322
|
+
* for new markup) gave a popup a second controller: it opened twice, counted two shows against
|
|
323
|
+
* "Show at most", and Escape closed it twice, handing focus to the hidden dialog.
|
|
324
|
+
*/
|
|
325
|
+
const started = new WeakSet<HTMLElement>();
|
|
326
|
+
|
|
299
327
|
export function initPopups(root: ParentNode = document): void {
|
|
300
328
|
const nodes = root.querySelectorAll<HTMLElement>("[data-emvb-popup]");
|
|
301
329
|
for (const node of nodes) {
|
|
330
|
+
if (started.has(node)) continue;
|
|
331
|
+
started.add(node);
|
|
302
332
|
const config = readConfig(node);
|
|
303
333
|
if (!config) continue;
|
|
304
334
|
const ctrl = createController(node);
|
package/src/astro/render.ts
CHANGED
|
@@ -70,6 +70,10 @@ export function renderStored(
|
|
|
70
70
|
pageId: string,
|
|
71
71
|
formDefinitions?: FormDefinitions,
|
|
72
72
|
dynamic?: ThemeDynamicData,
|
|
73
|
+
/** A theme part: generated ids get a suffix of its own (W-527). */
|
|
74
|
+
partIds = false,
|
|
75
|
+
/** The page's language, e.g. "fr-CA", for Post Dates (W-688). */
|
|
76
|
+
lang?: string,
|
|
73
77
|
): RenderedPage {
|
|
74
78
|
const { layout, problem } = inspectLayout(raw);
|
|
75
79
|
if (!layout) {
|
|
@@ -95,6 +99,8 @@ export function renderStored(
|
|
|
95
99
|
formDefinitions,
|
|
96
100
|
dynamic,
|
|
97
101
|
scope: pageId,
|
|
102
|
+
...(partIds ? { partIds } : {}),
|
|
103
|
+
...(lang ? { lang } : {}),
|
|
98
104
|
},
|
|
99
105
|
);
|
|
100
106
|
return {
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
validateTriggers,
|
|
20
20
|
wrapFloatMarkup,
|
|
21
21
|
wrapPopupMarkup,
|
|
22
|
+
type ChromeLabels,
|
|
22
23
|
type FloatSettings,
|
|
23
24
|
type Layout,
|
|
24
25
|
type ThemeDynamicData,
|
|
@@ -29,6 +30,8 @@ import {
|
|
|
29
30
|
type TriggersDoc,
|
|
30
31
|
archivePagePath,
|
|
31
32
|
loopPerPage,
|
|
33
|
+
paginationArchiveTitle,
|
|
34
|
+
paginationTitleText,
|
|
32
35
|
type ArchivePagination,
|
|
33
36
|
} from "../core/index.ts";
|
|
34
37
|
import { THEME_PARTS_COLLECTION } from "../constants.ts";
|
|
@@ -105,11 +108,16 @@ export type ResolvedThemeParts = {
|
|
|
105
108
|
canonicalPath?: string;
|
|
106
109
|
/**
|
|
107
110
|
* The archive's title when an Archive part renders: "Posts", or the category/tag slug
|
|
108
|
-
* (W-229). Hosts build "Posts – page 2" with `archivePageTitle`.
|
|
111
|
+
* (W-229). Hosts build "Posts – page 2" with `archivePageTitle` and `archiveTitleText`.
|
|
109
112
|
*/
|
|
110
113
|
archiveTitle?: string;
|
|
111
114
|
/** The archive page number when an Archive part renders (1 for the bare URL). */
|
|
112
115
|
archivePage?: number;
|
|
116
|
+
/**
|
|
117
|
+
* The Archive part's Pagination "Page title text", when set (W-529). Pass it to
|
|
118
|
+
* `archivePageTitle(archiveTitle, page, archiveTitleText)` for the site's own wording.
|
|
119
|
+
*/
|
|
120
|
+
archiveTitleText?: string;
|
|
113
121
|
/** The site's text direction from Site styles when a part renders, for `<html dir>` (W-230). */
|
|
114
122
|
dir?: "ltr" | "rtl" | "auto";
|
|
115
123
|
};
|
|
@@ -200,15 +208,22 @@ async function loadLoopTemplates(
|
|
|
200
208
|
parts: StoredPart[],
|
|
201
209
|
request?: object,
|
|
202
210
|
): Promise<Record<string, Layout>> {
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
211
|
+
const queue = collectLoopItemPartIds(layout);
|
|
212
|
+
if (queue.length === 0) return {};
|
|
205
213
|
const byId = new Map(parts.map((p) => [p.id, p]));
|
|
206
214
|
const templates: Record<string, Layout> = {};
|
|
207
|
-
|
|
215
|
+
const seen = new Set<string>();
|
|
216
|
+
// W-654: a Loop inside a loop item part can use another loop item part; load those too.
|
|
217
|
+
while (queue.length > 0 && seen.size < 32) {
|
|
218
|
+
const id = queue.shift();
|
|
219
|
+
if (!id || seen.has(id)) continue;
|
|
220
|
+
seen.add(id);
|
|
208
221
|
const part = byId.get(id);
|
|
209
222
|
if (!part || part.partType !== "loop_item") continue;
|
|
210
223
|
const itemLayout = layoutFor(request, part.id, part.layout);
|
|
211
|
-
if (itemLayout)
|
|
224
|
+
if (!itemLayout) continue;
|
|
225
|
+
templates[id] = itemLayout;
|
|
226
|
+
queue.push(...collectLoopItemPartIds(itemLayout));
|
|
212
227
|
}
|
|
213
228
|
return templates;
|
|
214
229
|
}
|
|
@@ -302,6 +317,7 @@ async function loadArchivePosts(
|
|
|
302
317
|
ctx: ThemeRequestContext,
|
|
303
318
|
perPage: number,
|
|
304
319
|
content: ContentPort,
|
|
320
|
+
postsTitle = "Posts",
|
|
305
321
|
): Promise<{
|
|
306
322
|
posts: ThemePostFields[];
|
|
307
323
|
archiveTitle?: string;
|
|
@@ -336,7 +352,7 @@ async function loadArchivePosts(
|
|
|
336
352
|
const archiveTitle = ctx.taxonomy?.slug
|
|
337
353
|
? await termLabel(ctx.taxonomy.type, ctx.taxonomy.slug, content)
|
|
338
354
|
: ctx.collection === "posts"
|
|
339
|
-
?
|
|
355
|
+
? postsTitle
|
|
340
356
|
: undefined;
|
|
341
357
|
return { posts, archiveTitle, pagination: { page, hasMore, basePath: ctx.path } };
|
|
342
358
|
} catch {
|
|
@@ -367,6 +383,8 @@ async function buildDynamicForContent(
|
|
|
367
383
|
ctx,
|
|
368
384
|
loopPerPage(layout),
|
|
369
385
|
content,
|
|
386
|
+
// W-532: the Pagination element's "Posts archive title" words it in the site's language.
|
|
387
|
+
paginationArchiveTitle(layout),
|
|
370
388
|
);
|
|
371
389
|
return { ...referenced, posts, archiveTitle, ...(pagination ? { pagination } : {}) };
|
|
372
390
|
}
|
|
@@ -383,7 +401,13 @@ export async function resolveThemeParts(
|
|
|
383
401
|
astro: AstroLike,
|
|
384
402
|
ctx?: ThemeRequestContext,
|
|
385
403
|
/** What the host knows about the visitor: segments and facts Visitors rules use (W-329). */
|
|
386
|
-
options: {
|
|
404
|
+
options: {
|
|
405
|
+
visitor?: HostVisitor;
|
|
406
|
+
/** The page's language, e.g. "fr-CA", for Post Dates; defaults to Astro's locale (W-688). */
|
|
407
|
+
lang?: string;
|
|
408
|
+
/** Popup and float screen reader names in the site's language (W-690). */
|
|
409
|
+
labels?: ChromeLabels;
|
|
410
|
+
} = {},
|
|
387
411
|
): Promise<ResolvedThemeParts> {
|
|
388
412
|
return resolveThemePartsWith(emdashContent, astro, ctx, options);
|
|
389
413
|
}
|
|
@@ -393,7 +417,13 @@ export async function resolveThemePartsWith(
|
|
|
393
417
|
port: ContentPort,
|
|
394
418
|
astro: AstroLike,
|
|
395
419
|
ctx?: ThemeRequestContext,
|
|
396
|
-
options: {
|
|
420
|
+
options: {
|
|
421
|
+
visitor?: HostVisitor;
|
|
422
|
+
/** The page's language, e.g. "fr-CA", for Post Dates; defaults to Astro's locale (W-688). */
|
|
423
|
+
lang?: string;
|
|
424
|
+
/** Popup and float screen reader names in the site's language (W-690). */
|
|
425
|
+
labels?: ChromeLabels;
|
|
426
|
+
} = {},
|
|
397
427
|
): Promise<ResolvedThemeParts> {
|
|
398
428
|
const context =
|
|
399
429
|
ctx ??
|
|
@@ -484,11 +514,22 @@ export async function resolveThemePartsWith(
|
|
|
484
514
|
...Object.values(dynamic?.loopTemplates ?? {}),
|
|
485
515
|
]),
|
|
486
516
|
);
|
|
487
|
-
const page = renderStored(
|
|
517
|
+
const page = renderStored(
|
|
518
|
+
stored.layout,
|
|
519
|
+
design,
|
|
520
|
+
stored.id,
|
|
521
|
+
formDefinitions,
|
|
522
|
+
dynamic,
|
|
523
|
+
true,
|
|
524
|
+
options.lang ?? astro.currentLocale,
|
|
525
|
+
);
|
|
488
526
|
rendered.push(page);
|
|
489
527
|
// W-216: a header or footer part is the page's banner or contentinfo landmark (hosts put it
|
|
490
528
|
// straight in <body> instead of their own <header>/<footer>).
|
|
491
|
-
|
|
529
|
+
// W-586: a part that already has its own header or footer box keeps that one as the landmark;
|
|
530
|
+
// a second wrapper around it would nest <header> in <header> (invalid, two banners).
|
|
531
|
+
const ownLandmark = /<(?:header|footer)[\s>]/.test(page.html);
|
|
532
|
+
const tag = (!ownLandmark && WRAPPER_TAGS[stored.partType]) || "div";
|
|
492
533
|
const partId = escapeAttr(stored.id);
|
|
493
534
|
const html = page.html
|
|
494
535
|
? `<${tag} class="emvb-theme-${stored.partType}" data-emvb-theme-part="${partId}">${page.html}</${tag}>`
|
|
@@ -511,7 +552,7 @@ export async function resolveThemePartsWith(
|
|
|
511
552
|
};
|
|
512
553
|
|
|
513
554
|
let pastLastPage = false;
|
|
514
|
-
let archiveInfo: { title?: string; page: number } | undefined;
|
|
555
|
+
let archiveInfo: { title?: string; page: number; titleText?: string } | undefined;
|
|
515
556
|
const renderPart = async (
|
|
516
557
|
winner: ThemePartCandidate | null,
|
|
517
558
|
): Promise<RenderedThemePart | null> => {
|
|
@@ -528,7 +569,11 @@ export async function resolveThemePartsWith(
|
|
|
528
569
|
: referenced;
|
|
529
570
|
// A page past the last one has no posts; the host answers 404 (W-221).
|
|
530
571
|
if (winner === contentWinner && dynamic?.pagination) {
|
|
531
|
-
archiveInfo = {
|
|
572
|
+
archiveInfo = {
|
|
573
|
+
title: dynamic.archiveTitle,
|
|
574
|
+
page: dynamic.pagination.page,
|
|
575
|
+
titleText: layout ? paginationTitleText(layout) : undefined,
|
|
576
|
+
};
|
|
532
577
|
}
|
|
533
578
|
if (winner === contentWinner && (dynamic?.pagination?.page ?? 1) > 1) {
|
|
534
579
|
pastLastPage = (dynamic?.posts ?? []).length === 0;
|
|
@@ -571,7 +616,7 @@ export async function resolveThemePartsWith(
|
|
|
571
616
|
const popup: RenderedPopup = {
|
|
572
617
|
id: stored.id,
|
|
573
618
|
title: stored.title,
|
|
574
|
-
html: wrapPopupMarkup(stored.id, html, stored.triggers),
|
|
619
|
+
html: wrapPopupMarkup(stored.id, html, stored.triggers, options.labels),
|
|
575
620
|
css,
|
|
576
621
|
triggers: stored.triggers,
|
|
577
622
|
};
|
|
@@ -595,7 +640,14 @@ export async function resolveThemePartsWith(
|
|
|
595
640
|
const item: RenderedFloat = {
|
|
596
641
|
id: stored.id,
|
|
597
642
|
title: stored.title,
|
|
598
|
-
html: wrapFloatMarkup(
|
|
643
|
+
html: wrapFloatMarkup(
|
|
644
|
+
stored.id,
|
|
645
|
+
stored.title,
|
|
646
|
+
html,
|
|
647
|
+
stored.float,
|
|
648
|
+
surface,
|
|
649
|
+
options.labels?.close,
|
|
650
|
+
),
|
|
599
651
|
css,
|
|
600
652
|
settings: stored.float,
|
|
601
653
|
};
|
|
@@ -630,6 +682,7 @@ export async function resolveThemePartsWith(
|
|
|
630
682
|
...(design.direction ? { dir: design.direction } : {}),
|
|
631
683
|
...(archiveInfo?.title ? { archiveTitle: archiveInfo.title } : {}),
|
|
632
684
|
...(archiveInfo ? { archivePage: archiveInfo.page } : {}),
|
|
685
|
+
...(archiveInfo?.titleText ? { archiveTitleText: archiveInfo.titleText } : {}),
|
|
633
686
|
...(empty.canonicalPath ? { canonicalPath: empty.canonicalPath } : {}),
|
|
634
687
|
};
|
|
635
688
|
}
|
package/src/astro/resolve.ts
CHANGED
|
@@ -38,6 +38,8 @@ export async function resolveEmVBPage(
|
|
|
38
38
|
slug?: string;
|
|
39
39
|
/** What the host knows about the visitor: segments and facts Visitors rules use (W-329). */
|
|
40
40
|
visitor?: HostVisitor;
|
|
41
|
+
/** The page's language, e.g. "fr-CA", for Post Dates; defaults to Astro's locale (W-688). */
|
|
42
|
+
lang?: string;
|
|
41
43
|
} = {},
|
|
42
44
|
): Promise<ResolvedEmVBPage | null> {
|
|
43
45
|
return resolveEmVBPageWith(emdashContent, astro, options);
|
|
@@ -51,6 +53,8 @@ export async function resolveEmVBPageWith(
|
|
|
51
53
|
param?: string;
|
|
52
54
|
slug?: string;
|
|
53
55
|
visitor?: HostVisitor;
|
|
56
|
+
/** The page's language, e.g. "fr-CA", for Post Dates; defaults to Astro's locale (W-688). */
|
|
57
|
+
lang?: string;
|
|
54
58
|
} = {},
|
|
55
59
|
): Promise<ResolvedEmVBPage | null> {
|
|
56
60
|
const slug = options.slug ?? content.decodeSlug(astro.params[options.param ?? "slug"]);
|
|
@@ -91,7 +95,9 @@ export async function resolveEmVBPageWith(
|
|
|
91
95
|
layout,
|
|
92
96
|
astro.url,
|
|
93
97
|
astro,
|
|
94
|
-
|
|
98
|
+
// W-666: Loop Item parts too. A Visitors rule, A/B test, bound field or collection Loop in
|
|
99
|
+
// one was never seen, so the visitor was never read and "only for" elements stayed hidden.
|
|
100
|
+
[...Object.values(sectionTemplates), ...Object.values(loopTemplates)],
|
|
95
101
|
options.visitor ? { visitor: options.visitor } : {},
|
|
96
102
|
content,
|
|
97
103
|
)),
|
|
@@ -103,6 +109,8 @@ export async function resolveEmVBPageWith(
|
|
|
103
109
|
String(data["id"] ?? slug),
|
|
104
110
|
formDefinitions,
|
|
105
111
|
Object.keys(dynamic).length > 0 ? dynamic : undefined,
|
|
112
|
+
false,
|
|
113
|
+
options.lang ?? astro.currentLocale,
|
|
106
114
|
),
|
|
107
115
|
entry,
|
|
108
116
|
title: typeof data["title"] === "string" ? data["title"] : "",
|
|
@@ -90,6 +90,8 @@ function enhance(root: HTMLElement): void {
|
|
|
90
90
|
activate(root, selectedIndex(root));
|
|
91
91
|
|
|
92
92
|
list.addEventListener("keydown", (event) => {
|
|
93
|
+
// W-675: Alt+Left is the browser's Back; Ctrl/Cmd+Home and friends belong to the browser too.
|
|
94
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.defaultPrevented) return;
|
|
93
95
|
// W-405: in right-to-left text the first tab is on the right, so the arrows swap.
|
|
94
96
|
const rtl = list.closest("[dir]")?.getAttribute("dir")?.toLowerCase() === "rtl";
|
|
95
97
|
const key =
|
|
@@ -105,6 +107,16 @@ function enhance(root: HTMLElement): void {
|
|
|
105
107
|
activate(root, target(selectedIndex(root), labels.length), true);
|
|
106
108
|
});
|
|
107
109
|
|
|
110
|
+
// W-779: a click on a tab focused its invisible radio (the label's default), so the arrows that
|
|
111
|
+
// followed moved an unseen focus and Tab stopped on the tab again. Select and focus the tab.
|
|
112
|
+
list.addEventListener("click", (event) => {
|
|
113
|
+
const label = (event.target as Element | null)?.closest?.<HTMLElement>(".emvb-tab-label");
|
|
114
|
+
const index = label ? labels.indexOf(label) : -1;
|
|
115
|
+
if (index < 0 || event.defaultPrevented) return;
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
activate(root, index, true);
|
|
118
|
+
});
|
|
119
|
+
|
|
108
120
|
// Keep ARIA in sync when the CSS-only radio path is used (click / label).
|
|
109
121
|
root.addEventListener("change", (event) => {
|
|
110
122
|
const target = event.target as HTMLInputElement | null;
|