@perkyzz/emvb 1.1.0 → 1.2.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 (83) hide show
  1. package/THIRD_PARTY_NOTICES.md +1 -0
  2. package/package.json +10 -9
  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/dnd/new-element.ts +46 -0
  9. package/src/admin/editor/editor-chrome.tsx +9 -0
  10. package/src/admin/editor/element-chrome.ts +22 -0
  11. package/src/admin/editor/panels/ElementPanel.tsx +5 -1
  12. package/src/admin/editor/panels/settings/DraftTextField.tsx +33 -1
  13. package/src/admin/editor/panels/settings/FieldBindControl.tsx +6 -1
  14. package/src/admin/editor/panels/settings/FieldControl.tsx +10 -1
  15. package/src/admin/editor/panels/settings/IconPicker.tsx +4 -1
  16. package/src/admin/editor/panels/settings/ItemList.tsx +36 -2
  17. package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
  18. package/src/admin/editor/store.ts +7 -1
  19. package/src/admin/editor/useEditorData.ts +4 -0
  20. package/src/admin/editor/useSave.ts +47 -3
  21. package/src/admin/export-api.ts +20 -3
  22. package/src/admin/menus-api.ts +113 -0
  23. package/src/admin/pages/ImportElementorDialog.tsx +25 -1
  24. package/src/astro/EmVBPage.astro +3 -0
  25. package/src/astro/render.ts +43 -18
  26. package/src/astro/request-data.ts +3 -0
  27. package/src/astro/resolve-theme.ts +77 -44
  28. package/src/astro/visitor.ts +23 -4
  29. package/src/astro/widgets/EmVBAlertsRuntime.astro +8 -0
  30. package/src/astro/widgets/EmVBCarouselRuntime.astro +8 -0
  31. package/src/astro/widgets/EmVBLightboxRuntime.astro +8 -0
  32. package/src/astro/widgets/EmVBWidgetRuntimes.astro +19 -0
  33. package/src/astro/widgets/alerts.ts +37 -0
  34. package/src/astro/widgets/carousel.ts +167 -0
  35. package/src/astro/widgets/index.ts +1 -0
  36. package/src/astro/widgets/lightbox.ts +123 -0
  37. package/src/constants.ts +1 -1
  38. package/src/core/a11y/audit.ts +101 -2
  39. package/src/core/arrange.ts +57 -1
  40. package/src/core/bounded-array.ts +16 -13
  41. package/src/core/contract.ts +4 -1
  42. package/src/core/elements/icon-svg.ts +135 -0
  43. package/src/core/elements/index.ts +33 -127
  44. package/src/core/elements/widgets.ts +907 -0
  45. package/src/core/export/runtimes.generated.ts +3 -0
  46. package/src/core/export/site.ts +20 -3
  47. package/src/core/extensions/schema.ts +2 -1
  48. package/src/core/geo-trust.ts +18 -0
  49. package/src/core/icons/social.generated.ts +29 -0
  50. package/src/core/image-edit/schema.ts +2 -1
  51. package/src/core/import/elementor/context.ts +18 -0
  52. package/src/core/import/elementor/index.ts +50 -7
  53. package/src/core/import/elementor/widgets.ts +394 -133
  54. package/src/core/issue-cap.ts +19 -0
  55. package/src/core/limits.ts +6 -0
  56. package/src/core/loop-collections.ts +33 -0
  57. package/src/core/proposals.ts +8 -2
  58. package/src/core/render/index.ts +27 -4
  59. package/src/core/render/vnode.ts +44 -6
  60. package/src/core/sanitize/svg-upload.ts +276 -23
  61. package/src/core/sanitize/svg.ts +3 -3
  62. package/src/core/schema/descriptors.ts +4 -0
  63. package/src/core/schema/design.ts +6 -5
  64. package/src/core/schema/layout.ts +395 -15
  65. package/src/core/schema/style.ts +2 -1
  66. package/src/core/shadowing-ids.ts +41 -0
  67. package/src/core/theme/conditions.ts +2 -1
  68. package/src/core/theme/parse-doc.ts +10 -5
  69. package/src/core/theme/triggers.ts +3 -2
  70. package/src/core/validate.ts +3 -2
  71. package/src/index.ts +23 -2
  72. package/src/mcp/ports.ts +18 -7
  73. package/src/mcp/proposals.ts +36 -11
  74. package/src/mcp/tools.ts +1 -1
  75. package/src/server/agent-settings.ts +12 -1
  76. package/src/server/hooks.ts +41 -6
  77. package/src/server/mcp-routes.ts +11 -5
  78. package/src/server/plugin.ts +27 -2
  79. package/src/server/presence.ts +5 -1
  80. package/src/server/proposals.ts +16 -4
  81. package/src/server/requests.ts +60 -11
  82. package/src/server/site-origin.ts +13 -0
  83. package/src/server/targets.ts +26 -0
@@ -20,6 +20,7 @@ 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perkyzz/emvb",
3
- "version": "1.1.0",
3
+ "version": "1.2.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.2.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.11",
64
+ "emdash": "1.5.0",
64
65
  "react": "19.3.1",
65
66
  "react-dom": "19.3.1",
66
67
  "vitest": "5.0.5"
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`}
@@ -83,6 +83,40 @@ 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-1019: an empty Gallery image for a Gallery's Add picture; its panel picks the picture. */
116
+ export function newGalleryImage(random?: () => number): LayoutNode {
117
+ return { id: newNodeId(random), type: "gallery-image", props: { src: "", alt: "Image" } };
118
+ }
119
+
86
120
  /**
87
121
  * Default node for a new element from the Add panel. Only new inserts get starter children;
88
122
  * saved Accordions and Tabs with no items keep working as they are (W-130).
@@ -140,6 +174,18 @@ export function newElement(
140
174
  ],
141
175
  };
142
176
  }
177
+ if (type === "carousel") {
178
+ return {
179
+ ...defaultElement("carousel", newNodeId(random)),
180
+ children: [1, 2, 3].map((n) => newCarouselSlide(n, random)),
181
+ };
182
+ }
183
+ if (type === "social-icons") {
184
+ return {
185
+ ...defaultElement("social-icons", newNodeId(random)),
186
+ children: [1, 2, 3].map((n) => newSocialLink(n, random)),
187
+ };
188
+ }
143
189
  if (type === "accordion") {
144
190
  const accordion = defaultElement("accordion", newNodeId(random));
145
191
  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")}
@@ -5,6 +5,8 @@ import {
5
5
  BrowserIcon,
6
6
  BrowsersIcon,
7
7
  CalendarBlankIcon,
8
+ CardsIcon,
9
+ SlideshowIcon,
8
10
  CaretCircleDoubleDownIcon,
9
11
  CaretCircleDownIcon,
10
12
  CaretDownIcon,
@@ -12,9 +14,12 @@ import {
12
14
  CheckSquareIcon,
13
15
  ColumnsIcon,
14
16
  CursorClickIcon,
17
+ FrameCornersIcon,
15
18
  GraphIcon,
16
19
  GridFourIcon,
17
20
  ImageIcon,
21
+ ImagesIcon,
22
+ ImageSquareIcon,
18
23
  LinkIcon,
19
24
  ListBulletsIcon,
20
25
  ListIcon,
@@ -23,13 +28,18 @@ import {
23
28
  MinusIcon,
24
29
  NotePencilIcon,
25
30
  PaperPlaneRightIcon,
31
+ QuotesIcon,
26
32
  RadioButtonIcon,
27
33
  RepeatIcon,
28
34
  RowsIcon,
35
+ LinkSimpleIcon,
36
+ ShareNetworkIcon,
29
37
  SmileyIcon,
30
38
  SquareIcon,
31
39
  SquaresFourIcon,
40
+ SquareHalfBottomIcon,
32
41
  StackIcon,
42
+ StarIcon,
33
43
  TextAaIcon,
34
44
  TextAlignLeftIcon,
35
45
  TextboxIcon,
@@ -37,6 +47,7 @@ import {
37
47
  TextTIcon,
38
48
  UserIcon,
39
49
  VideoCameraIcon,
50
+ WarningCircleIcon,
40
51
  type Icon,
41
52
  } from "@phosphor-icons/react";
42
53
  import { ELEMENT_DESCRIPTORS } from "../../core/index.ts";
@@ -76,6 +87,17 @@ export const ELEMENT_ICONS: Record<string, Icon> = {
76
87
  "menu-item": CaretDownIcon,
77
88
  toc: ListNumbersIcon,
78
89
  "language-switcher": TranslateIcon,
90
+ rating: StarIcon,
91
+ alert: WarningCircleIcon,
92
+ "icon-box": SquareHalfBottomIcon,
93
+ "image-box": ImageSquareIcon,
94
+ testimonial: QuotesIcon,
95
+ "social-icons": ShareNetworkIcon,
96
+ "social-link": LinkSimpleIcon,
97
+ gallery: ImagesIcon,
98
+ "gallery-image": FrameCornersIcon,
99
+ carousel: SlideshowIcon,
100
+ "carousel-slide": CardsIcon,
79
101
  video: VideoCameraIcon,
80
102
  form: ArticleIcon,
81
103
  "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
@@ -32,7 +32,7 @@ function CommitInput({
32
32
  label: string;
33
33
  className: string;
34
34
  description?: string;
35
- inputMode?: "numeric";
35
+ inputMode?: "numeric" | "decimal";
36
36
  fieldKey: string;
37
37
  draft: string;
38
38
  error: string | null;
@@ -174,6 +174,38 @@ export function DraftTextField({
174
174
  );
175
175
  }
176
176
 
177
+ if (field.kind === "decimal") {
178
+ // W-1023: a plain number such as 4.5; its maximum may come from another prop (Stars).
179
+ const min = field.min ?? 0;
180
+ const fromProp = field.maxProp ? props[field.maxProp] : undefined;
181
+ const max = typeof fromProp === "number" ? fromProp : field.max;
182
+ const commit = () => {
183
+ if (commitClearable()) return;
184
+ const value = fieldNumber(draft);
185
+ if (!Number.isFinite(value) || value < min || (max !== undefined && value > max)) {
186
+ setError(
187
+ field.message ??
188
+ (max === undefined ? `Enter ${min} or more.` : `Enter a number from ${min} to ${max}.`),
189
+ );
190
+ return;
191
+ }
192
+ setError(null);
193
+ onChange(withProp(node, field.key, value));
194
+ };
195
+ return (
196
+ <CommitInput
197
+ label={field.label}
198
+ className={`${FIELD} emvb-mono`}
199
+ inputMode="decimal"
200
+ fieldKey={field.key}
201
+ draft={draft}
202
+ error={error}
203
+ setDraft={setDraft}
204
+ commit={commit}
205
+ />
206
+ );
207
+ }
208
+
177
209
  if (field.kind === "int" || field.kind === "number") {
178
210
  const integer = field.kind === "int";
179
211
  const unit =
@@ -120,7 +120,12 @@ export function FieldBindControl({
120
120
  return field ? fieldLabel(field) : CHOOSE;
121
121
  }}
122
122
  >
123
- {!known && <Select.Option value={MANUAL}>{CHOOSE}</Select.Option>}
123
+ {/* W-994: always listed (disabled once a field is picked). Kumo 2.15's Select maps a
124
+ click to an option by its index, so an option that came and went picked the wrong
125
+ field. */}
126
+ <Select.Option value={MANUAL} disabled={known}>
127
+ {CHOOSE}
128
+ </Select.Option>
124
129
  {fields.map((field) => (
125
130
  <Select.Option key={field.name} value={field.name}>
126
131
  {fieldLabel(field)}
@@ -103,7 +103,15 @@ export function FieldControl({
103
103
  }
104
104
 
105
105
  if (field.kind === "icon") {
106
- return <IconPicker key={field.key} node={node} fetcher={fetcher} onChange={onChange} />;
106
+ return (
107
+ <IconPicker
108
+ key={field.key}
109
+ node={node}
110
+ fetcher={fetcher}
111
+ onChange={onChange}
112
+ optional={field.optional === true}
113
+ />
114
+ );
107
115
  }
108
116
 
109
117
  if (field.kind === "marks") {
@@ -294,6 +302,7 @@ export const IMPLEMENTED_FIELD_KINDS = [
294
302
  "textarea",
295
303
  "number",
296
304
  "int",
305
+ "decimal",
297
306
  "select",
298
307
  "boolean",
299
308
  "href",
@@ -87,11 +87,14 @@ export function IconPicker({
87
87
  node,
88
88
  fetcher,
89
89
  onChange,
90
+ optional = node.type === "button",
90
91
  }: {
91
92
  node: LayoutNode;
92
93
  /** Enables My uploads in the library (W-239). */
93
94
  fetcher?: Fetcher;
94
95
  onChange: (node: LayoutNode) => void;
96
+ /** W-1020: only an optional icon (a Button's) can be removed; an Icon box needs one. */
97
+ optional?: boolean;
95
98
  }) {
96
99
  const props = propsOf(node);
97
100
  const current = typeof props.iconId === "string" ? props.iconId : "";
@@ -124,7 +127,7 @@ export function IconPicker({
124
127
  onChange(withProps(node, patch));
125
128
  };
126
129
  // W-387: a Button's icon is optional, so it can be taken off again.
127
- const removable = node.type !== "icon" && (current !== "" || typeof props.iconSvg === "string");
130
+ const removable = optional && (current !== "" || typeof props.iconSvg === "string");
128
131
  const remove = () => {
129
132
  const { iconId: _id, iconSvg: _svg, ...rest } = propsOf(node);
130
133
  onChange({ ...node, props: rest } as LayoutNode);