@perkyzz/emvb 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/THIRD_PARTY_NOTICES.md +3 -2
  2. package/package.json +11 -10
  3. package/src/admin/agents-api.ts +5 -1
  4. package/src/admin/content-api.ts +29 -0
  5. package/src/admin/editor/Editor.tsx +6 -1
  6. package/src/admin/editor/ScheduleDialog.tsx +167 -0
  7. package/src/admin/editor/TopBar.tsx +33 -1
  8. package/src/admin/editor/canvas/vnode-react.tsx +3 -0
  9. package/src/admin/editor/dnd/new-element.ts +106 -0
  10. package/src/admin/editor/editor-chrome.tsx +9 -0
  11. package/src/admin/editor/element-chrome.ts +50 -0
  12. package/src/admin/editor/panels/ElementPanel.tsx +5 -1
  13. package/src/admin/editor/panels/settings/DraftTextField.tsx +33 -1
  14. package/src/admin/editor/panels/settings/FieldBindControl.tsx +6 -1
  15. package/src/admin/editor/panels/settings/FieldControl.tsx +10 -1
  16. package/src/admin/editor/panels/settings/IconPicker.tsx +4 -1
  17. package/src/admin/editor/panels/settings/ItemList.tsx +69 -2
  18. package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
  19. package/src/admin/editor/store.ts +7 -1
  20. package/src/admin/editor/useEditorData.ts +4 -0
  21. package/src/admin/editor/useSave.ts +47 -3
  22. package/src/admin/export-api.ts +20 -3
  23. package/src/admin/menus-api.ts +113 -0
  24. package/src/admin/pages/ImportElementorDialog.tsx +25 -1
  25. package/src/astro/EmVBPage.astro +3 -0
  26. package/src/astro/render.ts +43 -18
  27. package/src/astro/request-data.ts +9 -0
  28. package/src/astro/resolve-theme.ts +77 -44
  29. package/src/astro/resolve.ts +9 -0
  30. package/src/astro/visitor.ts +23 -4
  31. package/src/astro/widgets/EmVBAlertsRuntime.astro +8 -0
  32. package/src/astro/widgets/EmVBCarouselRuntime.astro +8 -0
  33. package/src/astro/widgets/EmVBCountdownRuntime.astro +8 -0
  34. package/src/astro/widgets/EmVBCounterRuntime.astro +8 -0
  35. package/src/astro/widgets/EmVBHeadlineRuntime.astro +9 -0
  36. package/src/astro/widgets/EmVBLightboxRuntime.astro +8 -0
  37. package/src/astro/widgets/EmVBMapRuntime.astro +8 -0
  38. package/src/astro/widgets/EmVBShareRuntime.astro +9 -0
  39. package/src/astro/widgets/EmVBWidgetRuntimes.astro +29 -0
  40. package/src/astro/widgets/alerts.ts +37 -0
  41. package/src/astro/widgets/carousel.ts +167 -0
  42. package/src/astro/widgets/countdown.ts +80 -0
  43. package/src/astro/widgets/counter.ts +98 -0
  44. package/src/astro/widgets/headline.ts +90 -0
  45. package/src/astro/widgets/index.ts +1 -0
  46. package/src/astro/widgets/lightbox.ts +123 -0
  47. package/src/astro/widgets/map.ts +37 -0
  48. package/src/astro/widgets/share.ts +21 -0
  49. package/src/constants.ts +1 -1
  50. package/src/core/a11y/audit.ts +127 -5
  51. package/src/core/arrange.ts +109 -1
  52. package/src/core/bounded-array.ts +16 -13
  53. package/src/core/canvas-collections.ts +28 -0
  54. package/src/core/contract.ts +4 -1
  55. package/src/core/elements/counter-format.ts +15 -0
  56. package/src/core/elements/icon-svg.ts +135 -0
  57. package/src/core/elements/index.ts +63 -127
  58. package/src/core/elements/marketing.ts +1490 -0
  59. package/src/core/elements/widgets.ts +932 -0
  60. package/src/core/export/runtimes.generated.ts +8 -0
  61. package/src/core/export/site.ts +25 -3
  62. package/src/core/extensions/schema.ts +2 -1
  63. package/src/core/geo-trust.ts +18 -0
  64. package/src/core/icons/social.generated.ts +29 -0
  65. package/src/core/image-edit/schema.ts +2 -1
  66. package/src/core/import/elementor/context.ts +18 -0
  67. package/src/core/import/elementor/index.ts +50 -7
  68. package/src/core/import/elementor/widgets.ts +783 -385
  69. package/src/core/issue-cap.ts +19 -0
  70. package/src/core/limits.ts +12 -0
  71. package/src/core/loop-collections.ts +33 -0
  72. package/src/core/proposals.ts +8 -2
  73. package/src/core/render/index.ts +48 -5
  74. package/src/core/render/vnode.ts +44 -6
  75. package/src/core/sanitize/svg-upload.ts +276 -23
  76. package/src/core/sanitize/svg.ts +3 -3
  77. package/src/core/schema/descriptors.ts +4 -0
  78. package/src/core/schema/design.ts +6 -5
  79. package/src/core/schema/layout.ts +798 -15
  80. package/src/core/schema/style.ts +2 -1
  81. package/src/core/shadowing-ids.ts +41 -0
  82. package/src/core/theme/conditions.ts +2 -1
  83. package/src/core/theme/dynamic.ts +2 -0
  84. package/src/core/theme/parse-doc.ts +10 -5
  85. package/src/core/theme/triggers.ts +3 -2
  86. package/src/core/validate.ts +3 -2
  87. package/src/index.ts +23 -2
  88. package/src/mcp/ports.ts +18 -7
  89. package/src/mcp/proposals.ts +36 -11
  90. package/src/mcp/tools.ts +1 -1
  91. package/src/server/agent-settings.ts +12 -1
  92. package/src/server/hooks.ts +41 -6
  93. package/src/server/mcp-routes.ts +11 -5
  94. package/src/server/plugin.ts +29 -3
  95. package/src/server/presence.ts +5 -1
  96. package/src/server/proposals.ts +16 -4
  97. package/src/server/requests.ts +60 -11
  98. package/src/server/site-origin.ts +13 -0
  99. package/src/server/targets.ts +26 -0
@@ -10,7 +10,7 @@ When an editor picks an icon, its SVG is stored with the page and shown inline o
10
10
 
11
11
  ## Lucide
12
12
 
13
- - Package: `lucide-static` 1.61.0, <https://lucide.dev>
13
+ - Package: `lucide-static` 1.73.0, <https://lucide.dev>
14
14
  - License: ISC, Copyright (c) 2026 Lucide Icons and Contributors. Icons derived from Feather: MIT, Copyright (c) 2013-present Cole Bemis. Full text: [`licenses/lucide-static.LICENSE`](licenses/lucide-static.LICENSE).
15
15
  - The 26 icons EmVB bundled before the library (`src/core/icons/catalog.ts`) are also Lucide icons, under the same license.
16
16
 
@@ -20,10 +20,11 @@ When an editor picks an icon, its SVG is stored with the page and shown inline o
20
20
  - Icons: Font Awesome Free by Fonticons, Inc., licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Full text: [`licenses/fontawesome-free.LICENSE`](licenses/fontawesome-free.LICENSE).
21
21
  - Changes: the attribution comment in each SVG file is removed by EmVB's sanitizer, so this notice carries the attribution. Each path's `fill="currentColor"` moves to the root `<svg>`.
22
22
  - Brand icons are trademarks of their owners. Use them only to represent the company, product or service they refer to.
23
+ - The Social icons element (W-1024) ships 22 of these icons in the plugin itself (`src/core/icons/social.generated.ts`, built by `scripts/build-social-icons.ts` from the icon library's set), so public pages draw them without the library: 19 brand icons and the solid envelope, RSS and globe icons. Same license and changes as above.
23
24
 
24
25
  ## Tabler Icons
25
26
 
26
- - Package: `@tabler/icons` 3.49.0, <https://tabler.io/icons>
27
+ - Package: `@tabler/icons` 3.52.0, <https://tabler.io/icons>
27
28
  - License: MIT, Copyright (c) 2020-2026 Paweł Kuna. Full text: [`licenses/tabler-icons.LICENSE`](licenses/tabler-icons.LICENSE).
28
29
  - Changes: the invisible 24×24 bounding path (`M0 0h24v24H0z`) is left out.
29
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perkyzz/emvb",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Visual page builder plugin for EmDash CMS",
5
5
  "keywords": [
6
6
  "astro",
@@ -40,6 +40,7 @@
40
40
  "./astro/floats": "./src/astro/floats/index.ts",
41
41
  "./astro/tabs": "./src/astro/tabs/index.ts",
42
42
  "./astro/menu": "./src/astro/menu/index.ts",
43
+ "./astro/widgets": "./src/astro/widgets/index.ts",
43
44
  "./mcp": "./src/mcp/index.ts"
44
45
  },
45
46
  "publishConfig": {
@@ -49,28 +50,28 @@
49
50
  "test:astro": "bun --bun vitest run"
50
51
  },
51
52
  "dependencies": {
52
- "@perkyzz/emvb-icons": "1.1.0",
53
+ "@perkyzz/emvb-icons": "1.3.0",
53
54
  "photocn": "0.1.2",
54
- "zod": "~4.5.4"
55
+ "zod": ">=4.5.4 <5"
55
56
  },
56
57
  "devDependencies": {
57
- "@cloudflare/kumo": "2.6.0",
58
- "@emdash-cms/plugin-forms": "0.2.12",
58
+ "@cloudflare/kumo": "2.15.0",
59
+ "@emdash-cms/plugin-forms": "0.2.13",
59
60
  "@phosphor-icons/react": "2.1.10",
60
61
  "@types/react": "19.3.0",
61
62
  "@types/react-dom": "19.3.0",
62
- "astro": "7.3.5",
63
- "emdash": "1.4.0",
63
+ "astro": "7.4.12",
64
+ "emdash": "1.5.0",
64
65
  "react": "19.3.1",
65
66
  "react-dom": "19.3.1",
66
- "vitest": "5.0.5"
67
+ "vitest": "5.1.0"
67
68
  },
68
69
  "peerDependencies": {
69
- "@cloudflare/kumo": "2.6.0",
70
+ "@cloudflare/kumo": "2.6.0 || 2.15.0",
70
71
  "@emdash-cms/plugin-forms": "^0.2.9",
71
72
  "@phosphor-icons/react": "^2.1.10",
72
73
  "astro": "^7.0.0",
73
- "emdash": "^1.0.0",
74
+ "emdash": ">=1.4.0 <2",
74
75
  "react": "^19.0.0",
75
76
  "react-dom": "^19.0.0"
76
77
  },
@@ -25,7 +25,11 @@ export type AgentsState = {
25
25
 
26
26
  const base = `/_emdash/api/plugins/${PLUGIN_ID}`;
27
27
 
28
- export const loadAgents = (fetcher: Fetcher) => requestJson<AgentsState>(fetcher, `${base}/agents`);
28
+ /** S-05 (W-995): the server may send the endpoint's path alone; it is resolved against this page. */
29
+ export async function loadAgents(fetcher: Fetcher): Promise<AgentsState> {
30
+ const state = await requestJson<AgentsState>(fetcher, `${base}/agents`);
31
+ return { ...state, endpoint: new URL(state.endpoint, globalThis.location?.href).toString() };
32
+ }
29
33
 
30
34
  /** Saves the agent settings; the returned revision is the one the next save must send. */
31
35
  export async function saveAgentSettings(
@@ -147,6 +147,35 @@ export async function publishEntry(
147
147
  return { rev: body["_rev"], slug: body.item.slug ?? "" };
148
148
  }
149
149
 
150
+ /**
151
+ * W-1027: has EmDash publish the saved draft of entry `id` by itself at `at` (sent as ISO with
152
+ * its offset), or with `at` null cancels that. `rev` makes a stale draft fail with 409.
153
+ */
154
+ export async function scheduleEntry(
155
+ fetcher: Fetcher,
156
+ contentPath: string,
157
+ id: string,
158
+ at: Date | null,
159
+ rev: string | null,
160
+ ): Promise<{ rev: string; status: string; scheduledAt: string | null }> {
161
+ const path = `${contentPath}/${encodeURIComponent(id)}/schedule`;
162
+ const body = await requestJson<{
163
+ _rev: string;
164
+ item: { status?: string; scheduledAt?: string | null; draftRevisionId?: string | null };
165
+ }>(
166
+ fetcher,
167
+ path,
168
+ at
169
+ ? { method: "POST", body: { scheduledAt: at.toISOString(), ...(rev ? { _rev: rev } : {}) } }
170
+ : { method: "DELETE" },
171
+ );
172
+ return {
173
+ rev: body["_rev"],
174
+ status: entryStatus(body.item),
175
+ scheduledAt: body.item.scheduledAt ?? null,
176
+ };
177
+ }
178
+
150
179
  /**
151
180
  * Drops the saved draft of entry `id` so it is back to its published version (W-193). EmDash's
152
181
  * `discard-draft` checks `rev`, so a draft saved elsewhere meanwhile fails with 409.
@@ -482,7 +482,11 @@ function EditorApp({
482
482
  {wideEnough ? (
483
483
  <>
484
484
  <TopBar
485
- page={{ title: state.page.title, status: state.status }}
485
+ page={{
486
+ title: state.page.title,
487
+ status: state.status,
488
+ scheduledAt: state.scheduledAt ?? null,
489
+ }}
486
490
  dirty={dirty}
487
491
  status={saver.status}
488
492
  busy={busy}
@@ -495,6 +499,7 @@ function EditorApp({
495
499
  stylesUnpublished={state.designUnpublished === true}
496
500
  canRevert={canRevert}
497
501
  onRevert={() => chrome.open("revert")}
502
+ {...(host.field ? {} : { onSchedule: () => chrome.open("schedule") })}
498
503
  {...(host.field ? { onApply: () => host.field?.apply(state.page.layout) } : {})}
499
504
  tools={
500
505
  <>
@@ -0,0 +1,167 @@
1
+ import { Button, Dialog, Loader } from "@cloudflare/kumo";
2
+ import * as React from "react";
3
+ import { BUTTON, FIELD, SOLID_PRIMARY, UI_CSS } from "../ui.ts";
4
+ import { DialogCloseButton } from "./DialogCloseButton.tsx";
5
+ import { useEditedNoun } from "./edited-noun.ts";
6
+ import { useMediaQuery } from "./useMediaQuery.ts";
7
+
8
+ /** W-1027: a date and time as people read it here: "14 Nov 2026, 09:00". */
9
+ export const scheduleLabel = (iso: string) =>
10
+ new Intl.DateTimeFormat(undefined, { dateStyle: "medium", timeStyle: "short" }).format(
11
+ new Date(iso),
12
+ );
13
+
14
+ const pad = (n: number) => String(n).padStart(2, "0");
15
+
16
+ /** The visitor's time zone name, such as America/Toronto. */
17
+ const timeZone = () => new Intl.DateTimeFormat().resolvedOptions().timeZone;
18
+
19
+ const systemNow = () => new Date();
20
+
21
+ /** A local time as a datetime-local input's value. */
22
+ export function localInputValue(date: Date): string {
23
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
24
+ }
25
+
26
+ /** Tomorrow at 9:00, local time: the first suggestion. */
27
+ function tomorrowMorning(now: Date): Date {
28
+ const next = new Date(now);
29
+ next.setDate(next.getDate() + 1);
30
+ next.setHours(9, 0, 0, 0);
31
+ return next;
32
+ }
33
+
34
+ /**
35
+ * W-1027: Schedule publish. EmDash publishes the saved draft at the chosen time; until then the
36
+ * page stays as it is (a draft, or its published version). Unsaved edits are saved first. When
37
+ * a time is set, the dialog shows it and can change or cancel it.
38
+ */
39
+ export function ScheduleDialog({
40
+ open,
41
+ onOpenChange,
42
+ scheduledAt,
43
+ onSchedule,
44
+ now = systemNow,
45
+ }: {
46
+ open: boolean;
47
+ onOpenChange: (open: boolean) => void;
48
+ scheduledAt: string | null;
49
+ /** Schedules at a time, or with null cancels; resolves to an error message or null. */
50
+ onSchedule: (at: Date | null) => Promise<string | null>;
51
+ /** Test seam. */
52
+ now?: () => Date;
53
+ }) {
54
+ const noun = useEditedNoun();
55
+ const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
56
+ const id = React.useId();
57
+ const [value, setValue] = React.useState("");
58
+ const [error, setError] = React.useState<string | null>(null);
59
+ const [busy, setBusy] = React.useState<"schedule" | "cancel" | null>(null);
60
+ const [wasOpen, setWasOpen] = React.useState(false);
61
+ if (open !== wasOpen) {
62
+ setWasOpen(open);
63
+ if (open) {
64
+ setValue(localInputValue(scheduledAt ? new Date(scheduledAt) : tomorrowMorning(now())));
65
+ setError(null);
66
+ setBusy(null);
67
+ }
68
+ }
69
+ const zone = timeZone();
70
+
71
+ const run = async (kind: "schedule" | "cancel") => {
72
+ if (busy) return;
73
+ let at: Date | null = null;
74
+ if (kind === "schedule") {
75
+ at = value ? new Date(value) : null;
76
+ if (!at || Number.isNaN(at.getTime())) {
77
+ setError("Choose a date and a time.");
78
+ return;
79
+ }
80
+ if (at.getTime() <= now().getTime() + 60_000) {
81
+ setError("Choose a time at least a minute from now.");
82
+ return;
83
+ }
84
+ }
85
+ setBusy(kind);
86
+ setError(null);
87
+ const failure = await onSchedule(at);
88
+ setBusy(null);
89
+ if (failure) setError(failure);
90
+ else onOpenChange(false);
91
+ };
92
+
93
+ return (
94
+ <Dialog.Root
95
+ open={open}
96
+ onOpenChange={(next) => {
97
+ if (!next && busy) return;
98
+ onOpenChange(next);
99
+ }}
100
+ >
101
+ <Dialog size="base" className="p-6">
102
+ <style>{UI_CSS}</style>
103
+ <form
104
+ data-emvb-dialog="schedule"
105
+ className="emvb-dialog"
106
+ onSubmit={(event) => {
107
+ event.preventDefault();
108
+ void run("schedule");
109
+ }}
110
+ >
111
+ <Dialog.Title>Schedule publishing</Dialog.Title>
112
+ <Dialog.Description>
113
+ {scheduledAt
114
+ ? `This ${noun} publishes on ${scheduleLabel(scheduledAt)}. Change the time or cancel it.`
115
+ : `Choose when this ${noun} goes live. Your saved changes publish then; until then visitors see what is live now.`}
116
+ </Dialog.Description>
117
+ <label className="emvb-field-label" htmlFor={id}>
118
+ Publish on
119
+ </label>
120
+ <input
121
+ id={id}
122
+ type="datetime-local"
123
+ className={FIELD}
124
+ value={value}
125
+ min={localInputValue(now())}
126
+ aria-describedby={`${id}-zone${error ? ` ${id}-error` : ""}`}
127
+ aria-invalid={error ? true : undefined}
128
+ onChange={(event) => setValue(event.currentTarget.value)}
129
+ />
130
+ <p className="emvb-helper" id={`${id}-zone`}>
131
+ Time zone: {zone}.
132
+ </p>
133
+ {error && (
134
+ <p className="emvb-inline-error" role="alert" id={`${id}-error`}>
135
+ {error}
136
+ </p>
137
+ )}
138
+ <div className="emvb-dialog-actions">
139
+ <DialogCloseButton>Close</DialogCloseButton>
140
+ {scheduledAt && (
141
+ <Button
142
+ variant="secondary"
143
+ className={BUTTON}
144
+ aria-disabled={busy !== null}
145
+ aria-busy={busy === "cancel"}
146
+ onClick={() => void run("cancel")}
147
+ >
148
+ Cancel schedule
149
+ </Button>
150
+ )}
151
+ <Button
152
+ type="submit"
153
+ variant="primary"
154
+ className={BUTTON}
155
+ style={SOLID_PRIMARY}
156
+ aria-disabled={busy !== null}
157
+ aria-busy={busy === "schedule"}
158
+ icon={busy === "schedule" && !reducedMotion ? <Loader size={14} /> : undefined}
159
+ >
160
+ {scheduledAt ? "Change schedule" : "Schedule"}
161
+ </Button>
162
+ </div>
163
+ </form>
164
+ </Dialog>
165
+ </Dialog.Root>
166
+ );
167
+ }
@@ -2,6 +2,7 @@ import { Button, DropdownMenu, Loader } from "@cloudflare/kumo";
2
2
  import * as React from "react";
3
3
  import {
4
4
  ArrowSquareOutIcon,
5
+ CalendarBlankIcon,
5
6
  CaretDownIcon,
6
7
  CheckIcon,
7
8
  EyeIcon,
@@ -19,6 +20,7 @@ import {
19
20
  } from "@phosphor-icons/react";
20
21
  import { BUTTON, SOLID_PRIMARY } from "../ui.ts";
21
22
  import { statusLabel } from "../entry-status.ts";
23
+ import { scheduleLabel } from "./ScheduleDialog.tsx";
22
24
  import type { SaveStatus } from "./useSave.ts";
23
25
  import { WIDE_MIN_PX, type EditorDevice } from "../../core/index.ts";
24
26
  import { useMediaQuery } from "./useMediaQuery.ts";
@@ -32,7 +34,12 @@ const PREVIEW_SIZES = [
32
34
  { device: "mobile", label: "Mobile (390 px)", icon: DeviceMobileIcon },
33
35
  ] as const;
34
36
 
35
- export type TopBarPage = { title: string; status: string };
37
+ export type TopBarPage = {
38
+ title: string;
39
+ status: string;
40
+ /** W-1027: when EmDash publishes the saved draft by itself. */
41
+ scheduledAt?: string | null;
42
+ };
36
43
 
37
44
  const wideScreenFits = () =>
38
45
  typeof window !== "undefined" && (window.screen?.availWidth ?? 0) >= WIDE_MIN_PX;
@@ -87,6 +94,7 @@ export function TopBar({
87
94
  stylesUnpublished = false,
88
95
  canRevert = false,
89
96
  onRevert,
97
+ onSchedule,
90
98
  tools,
91
99
  onApply,
92
100
  }: {
@@ -107,6 +115,8 @@ export function TopBar({
107
115
  canRevert?: boolean;
108
116
  /** Shown once the entry has a published version; asks before discarding. */
109
117
  onRevert?: () => void;
118
+ /** W-1027: opens Schedule publishing. */
119
+ onSchedule?: () => void;
110
120
  /** Extra tools beside Site styles: the page weight and accessibility meters, … (W-310). */
111
121
  tools?: React.ReactNode;
112
122
  /** Field mode (W-900): one Apply button replaces Preview, Revert, Save draft and Publish. */
@@ -148,6 +158,12 @@ export function TopBar({
148
158
  <span className="emvb-status-dot" aria-hidden="true" />
149
159
  {statusLabel(page.status)}
150
160
  </span>
161
+ {page.scheduledAt && (
162
+ <span className="emvb-status" data-emvb-scheduled="">
163
+ <CalendarBlankIcon size={12} aria-hidden="true" />
164
+ Publishes {scheduleLabel(page.scheduledAt)}
165
+ </span>
166
+ )}
151
167
  </>
152
168
  )}
153
169
  </div>
@@ -321,6 +337,22 @@ export function TopBar({
321
337
  Save draft
322
338
  {dirty && <span className="emvb-unsaved-dot" aria-hidden="true" />}
323
339
  </Button>
340
+ {onSchedule && (
341
+ <Button
342
+ variant="secondary"
343
+ shape="square"
344
+ className="emvb-icon-btn"
345
+ // Named without "Publish", so the Publish button keeps a name of its own.
346
+ aria-label={page?.scheduledAt ? "Change schedule" : "Schedule"}
347
+ title={page?.scheduledAt ? "Change scheduled publishing" : "Schedule publishing"}
348
+ aria-disabled={busy !== null}
349
+ onClick={() => {
350
+ if (busy === null) onSchedule();
351
+ }}
352
+ >
353
+ <CalendarBlankIcon size={16} aria-hidden="true" />
354
+ </Button>
355
+ )}
324
356
  <Button
325
357
  variant="primary"
326
358
  className={`${BUTTON} emvb-publish-button`}
@@ -20,6 +20,9 @@ const REACT_ATTR: Record<string, string> = {
20
20
  playsinline: "playsInline",
21
21
  autoplay: "autoPlay",
22
22
  datetime: "dateTime",
23
+ // W-1048: Hotspots open their notes with the Popover API.
24
+ popovertarget: "popoverTarget",
25
+ popovertargetaction: "popoverTargetAction",
23
26
  // The canvas never updates a radio from props, so a tab chosen there stays chosen (QA-5).
24
27
  checked: "defaultChecked",
25
28
  };
@@ -83,6 +83,82 @@ export function newTabPanel(n: number, random?: () => number): LayoutNode {
83
83
  };
84
84
  }
85
85
 
86
+ /** W-1024: the networks new Social links cycle through, and an example profile for each. */
87
+ const STARTER_NETWORKS = [
88
+ ["facebook", "https://facebook.com/"],
89
+ ["instagram", "https://instagram.com/"],
90
+ ["linkedin", "https://linkedin.com/"],
91
+ ["youtube", "https://youtube.com/"],
92
+ ["x", "https://x.com/"],
93
+ ] as const;
94
+
95
+ /** W-1024: a Social link for a new Social icons element or its Add link. */
96
+ export function newSocialLink(n: number, random?: () => number): LayoutNode {
97
+ const [network, href] =
98
+ STARTER_NETWORKS[(n - 1) % STARTER_NETWORKS.length] ?? STARTER_NETWORKS[0];
99
+ return { id: newNodeId(random), type: "social-link", props: { network, href, newTab: true } };
100
+ }
101
+
102
+ /** W-1018: a Carousel slide holding a heading and a Text, for a new Carousel or its Add slide. */
103
+ export function newCarouselSlide(n: number, random?: () => number): LayoutNode {
104
+ return {
105
+ id: newNodeId(random),
106
+ type: "carousel-slide",
107
+ props: {},
108
+ children: [
109
+ { id: newNodeId(random), type: "heading", props: { text: `Slide ${n}`, level: 3 } },
110
+ textNode(`What slide ${n} says. Replace this text or add elements here.`, random),
111
+ ],
112
+ };
113
+ }
114
+
115
+ /** W-1043: the rows a new Price list starts with, then its Add item cycles through them. */
116
+ const STARTER_PRICES = [
117
+ ["Espresso", "$3", "A double shot, served short."],
118
+ ["Cappuccino", "$4.50", "Espresso, steamed milk and foam."],
119
+ ["Croissant", "$3.75", "Baked every morning."],
120
+ ] as const;
121
+
122
+ /** W-1043: a Price list item for a new Price list or its Add item. */
123
+ export function newPriceListItem(n: number, random?: () => number): LayoutNode {
124
+ const [title, price, description] =
125
+ STARTER_PRICES[(n - 1) % STARTER_PRICES.length] ?? STARTER_PRICES[0];
126
+ return { id: newNodeId(random), type: "price-list-item", props: { title, price, description } };
127
+ }
128
+
129
+ /** W-1047: the services new Share links cycle through. */
130
+ const STARTER_SHARES = ["facebook", "x", "linkedin", "email", "whatsapp", "bluesky"] as const;
131
+
132
+ /** W-1047: a Share link for new Share buttons or their Add link. */
133
+ export function newShareLink(n: number, random?: () => number): LayoutNode {
134
+ const network = STARTER_SHARES[(n - 1) % STARTER_SHARES.length] ?? STARTER_SHARES[0];
135
+ return { id: newNodeId(random), type: "share-link", props: { network } };
136
+ }
137
+
138
+ /** W-1048: where new Hotspots land, so markers added one after another don't overlap. */
139
+ const STARTER_SPOTS = [
140
+ [25, 35],
141
+ [60, 25],
142
+ [45, 70],
143
+ [80, 60],
144
+ [15, 80],
145
+ ] as const;
146
+
147
+ /** W-1048: a Hotspot for a new Hotspots picture or its Add marker. */
148
+ export function newHotspot(n: number, random?: () => number): LayoutNode {
149
+ const [x, y] = STARTER_SPOTS[(n - 1) % STARTER_SPOTS.length] ?? STARTER_SPOTS[0];
150
+ return {
151
+ id: newNodeId(random),
152
+ type: "hotspot",
153
+ props: { title: `Point ${n}`, text: `What point ${n} shows.`, x, y },
154
+ };
155
+ }
156
+
157
+ /** W-1019: an empty Gallery image for a Gallery's Add picture; its panel picks the picture. */
158
+ export function newGalleryImage(random?: () => number): LayoutNode {
159
+ return { id: newNodeId(random), type: "gallery-image", props: { src: "", alt: "Image" } };
160
+ }
161
+
86
162
  /**
87
163
  * Default node for a new element from the Add panel. Only new inserts get starter children;
88
164
  * saved Accordions and Tabs with no items keep working as they are (W-130).
@@ -140,6 +216,36 @@ export function newElement(
140
216
  ],
141
217
  };
142
218
  }
219
+ if (type === "carousel") {
220
+ return {
221
+ ...defaultElement("carousel", newNodeId(random)),
222
+ children: [1, 2, 3].map((n) => newCarouselSlide(n, random)),
223
+ };
224
+ }
225
+ if (type === "hotspots") {
226
+ return {
227
+ ...defaultElement("hotspots", newNodeId(random)),
228
+ children: [1, 2, 3].map((n) => newHotspot(n, random)),
229
+ };
230
+ }
231
+ if (type === "share-buttons") {
232
+ return {
233
+ ...defaultElement("share-buttons", newNodeId(random)),
234
+ children: [1, 2, 3, 4].map((n) => newShareLink(n, random)),
235
+ };
236
+ }
237
+ if (type === "price-list") {
238
+ return {
239
+ ...defaultElement("price-list", newNodeId(random)),
240
+ children: [1, 2, 3].map((n) => newPriceListItem(n, random)),
241
+ };
242
+ }
243
+ if (type === "social-icons") {
244
+ return {
245
+ ...defaultElement("social-icons", newNodeId(random)),
246
+ children: [1, 2, 3].map((n) => newSocialLink(n, random)),
247
+ };
248
+ }
143
249
  if (type === "accordion") {
144
250
  const accordion = defaultElement("accordion", newNodeId(random));
145
251
  return {
@@ -18,6 +18,7 @@ import { saveEditedCopy } from "../media-api.ts";
18
18
  import { A11yDialog } from "./A11yCopilot.tsx";
19
19
  import { CommandPalette } from "./CommandPalette.tsx";
20
20
  import { ConflictDialog, DeleteSubtreeDialog, LeaveDialog, RevertDialog } from "./dialogs.tsx";
21
+ import { ScheduleDialog } from "./ScheduleDialog.tsx";
21
22
  import type { EditorCommand } from "./editor-commands.ts";
22
23
  import { paletteItems } from "./palette-items.ts";
23
24
  import { PerfMeterDialog } from "./PerfMeter.tsx";
@@ -47,6 +48,7 @@ export const initialState = (entry: EditorEntry, design: LoadedDesign): EditorSt
47
48
  float: entry.float,
48
49
  },
49
50
  status: entry.status,
51
+ scheduledAt: entry.scheduledAt ?? null,
50
52
  rev: entry.rev,
51
53
  design: design.design,
52
54
  designRevision: design.revision,
@@ -69,6 +71,7 @@ const CLOSED = {
69
71
  a11y: false,
70
72
  leave: false,
71
73
  revert: false,
74
+ schedule: false,
72
75
  imageEditor: false,
73
76
  };
74
77
 
@@ -359,6 +362,12 @@ export function EditorDialogs({
359
362
  onReload={() => void reloadEntry({ fetcher, collection, state, dispatch, saver })}
360
363
  onOverwrite={() => void saver.overwrite()}
361
364
  />
365
+ <ScheduleDialog
366
+ open={chrome.flags.schedule}
367
+ onOpenChange={chrome.setOpen("schedule")}
368
+ scheduledAt={state.scheduledAt ?? null}
369
+ onSchedule={saver.schedule}
370
+ />
362
371
  <RevertDialog
363
372
  open={chrome.flags.revert}
364
373
  onOpenChange={chrome.setOpen("revert")}
@@ -1,35 +1,59 @@
1
1
  import {
2
+ ArrowsClockwiseIcon,
2
3
  ArrowsLeftRightIcon,
3
4
  ArrowsVerticalIcon,
4
5
  ArticleIcon,
5
6
  BrowserIcon,
6
7
  BrowsersIcon,
7
8
  CalendarBlankIcon,
9
+ CardsIcon,
10
+ SlideshowIcon,
8
11
  CaretCircleDoubleDownIcon,
9
12
  CaretCircleDownIcon,
10
13
  CaretDownIcon,
11
14
  CaretRightIcon,
12
15
  CheckSquareIcon,
13
16
  ColumnsIcon,
17
+ CurrencyDollarIcon,
18
+ CrosshairIcon,
14
19
  CursorClickIcon,
20
+ FrameCornersIcon,
15
21
  GraphIcon,
22
+ GaugeIcon,
16
23
  GridFourIcon,
24
+ HighlighterIcon,
25
+ TimerIcon,
26
+ HashIcon,
17
27
  ImageIcon,
28
+ ImagesIcon,
29
+ ImageSquareIcon,
18
30
  LinkIcon,
19
31
  ListBulletsIcon,
32
+ ListDashesIcon,
20
33
  ListIcon,
21
34
  ListNumbersIcon,
22
35
  TranslateIcon,
36
+ MapPinIcon,
37
+ MegaphoneIcon,
23
38
  MinusIcon,
24
39
  NotePencilIcon,
40
+ NumberCircleOneIcon,
25
41
  PaperPlaneRightIcon,
42
+ QuotesIcon,
26
43
  RadioButtonIcon,
27
44
  RepeatIcon,
28
45
  RowsIcon,
46
+ LinkSimpleIcon,
47
+ ShareFatIcon,
48
+ ShareIcon,
49
+ ShareNetworkIcon,
29
50
  SmileyIcon,
30
51
  SquareIcon,
52
+ TagIcon,
31
53
  SquaresFourIcon,
54
+ SquareHalfBottomIcon,
32
55
  StackIcon,
56
+ StarIcon,
33
57
  TextAaIcon,
34
58
  TextAlignLeftIcon,
35
59
  TextboxIcon,
@@ -37,6 +61,7 @@ import {
37
61
  TextTIcon,
38
62
  UserIcon,
39
63
  VideoCameraIcon,
64
+ WarningCircleIcon,
40
65
  type Icon,
41
66
  } from "@phosphor-icons/react";
42
67
  import { ELEMENT_DESCRIPTORS } from "../../core/index.ts";
@@ -76,6 +101,31 @@ export const ELEMENT_ICONS: Record<string, Icon> = {
76
101
  "menu-item": CaretDownIcon,
77
102
  toc: ListNumbersIcon,
78
103
  "language-switcher": TranslateIcon,
104
+ rating: StarIcon,
105
+ alert: WarningCircleIcon,
106
+ "icon-box": SquareHalfBottomIcon,
107
+ "image-box": ImageSquareIcon,
108
+ testimonial: QuotesIcon,
109
+ "social-icons": ShareNetworkIcon,
110
+ "social-link": LinkSimpleIcon,
111
+ gallery: ImagesIcon,
112
+ "gallery-image": FrameCornersIcon,
113
+ carousel: SlideshowIcon,
114
+ "carousel-slide": CardsIcon,
115
+ counter: HashIcon,
116
+ progress: GaugeIcon,
117
+ countdown: TimerIcon,
118
+ map: MapPinIcon,
119
+ "price-table": TagIcon,
120
+ "price-list": ListDashesIcon,
121
+ "price-list-item": CurrencyDollarIcon,
122
+ cta: MegaphoneIcon,
123
+ "flip-box": ArrowsClockwiseIcon,
124
+ headline: HighlighterIcon,
125
+ "share-buttons": ShareFatIcon,
126
+ "share-link": ShareIcon,
127
+ hotspots: CrosshairIcon,
128
+ hotspot: NumberCircleOneIcon,
79
129
  video: VideoCameraIcon,
80
130
  form: ArticleIcon,
81
131
  "text-input": TextboxIcon,
@@ -608,7 +608,7 @@ function KnownElementPanel({
608
608
  />
609
609
  {tab === "content" && (
610
610
  <div className="emvb-panel-body" data-emvb-tab="content">
611
- {hasItemList(node.type) ? (
611
+ {hasItemList(node.type) && descriptor.fields.length === 0 ? (
612
612
  <ItemList node={node} onChange={onChange} onSelect={onSelect} actions={items} />
613
613
  ) : descriptor.fields.length === 0 ? (
614
614
  <p className="emvb-helper">
@@ -644,6 +644,10 @@ function KnownElementPanel({
644
644
  );
645
645
  })
646
646
  )}
647
+ {/* W-1024: an element with its own settings lists its items after them. */}
648
+ {hasItemList(node.type) && descriptor.fields.length > 0 && (
649
+ <ItemList node={node} onChange={onChange} onSelect={onSelect} actions={items} />
650
+ )}
647
651
  <BindingsEditor node={node} onChange={onChange} post={SAMPLE_POST} />
648
652
  <AudienceEditor node={node} isRoot={layout?.root.id === node.id} onChange={onChange} />
649
653
  <VariantEditor