@perkyzz/emvb 0.9.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +10 -1
  2. package/package.json +2 -2
  3. package/src/admin/agents-api.ts +45 -0
  4. package/src/admin/bulk-api.ts +67 -0
  5. package/src/admin/content-api.ts +10 -6
  6. package/src/admin/copy-rich-text.ts +119 -0
  7. package/src/admin/dialog-tab-wrap.ts +78 -0
  8. package/src/admin/editor/A11yCopilot.tsx +3 -1
  9. package/src/admin/editor/Editor.tsx +311 -250
  10. package/src/admin/editor/Timeline.tsx +8 -3
  11. package/src/admin/editor/TopBar.tsx +29 -7
  12. package/src/admin/editor/canvas/CanvasFrame.tsx +7 -2
  13. package/src/admin/editor/canvas/DeviceBar.tsx +31 -10
  14. package/src/admin/editor/canvas/canvas-scale.ts +3 -3
  15. package/src/admin/editor/canvas/use-canvas-session.ts +2 -2
  16. package/src/admin/editor/co-design.ts +190 -0
  17. package/src/admin/editor/dnd/new-element.ts +48 -4
  18. package/src/admin/editor/editor-chrome.tsx +8 -6
  19. package/src/admin/editor/editor-commands.ts +15 -4
  20. package/src/admin/editor/editor-css.ts +2 -1
  21. package/src/admin/editor/element-chrome.ts +3 -1
  22. package/src/admin/editor/extension-manifests.ts +20 -0
  23. package/src/admin/editor/extensions/ExtensionPanels.tsx +26 -0
  24. package/src/admin/editor/extensions-context.tsx +27 -0
  25. package/src/admin/editor/feature-css.ts +17 -0
  26. package/src/admin/editor/palette-items.ts +2 -2
  27. package/src/admin/editor/panels/AddPanel.tsx +31 -1
  28. package/src/admin/editor/panels/AgentRequestBox.tsx +116 -0
  29. package/src/admin/editor/panels/ClassesSection.tsx +9 -6
  30. package/src/admin/editor/panels/CoDesignPanel.tsx +170 -0
  31. package/src/admin/editor/panels/ColorControl.tsx +2 -2
  32. package/src/admin/editor/panels/ElementPanel.tsx +68 -20
  33. package/src/admin/editor/panels/LanguagesSection.tsx +152 -0
  34. package/src/admin/editor/panels/LayersPanel.tsx +10 -6
  35. package/src/admin/editor/panels/LeftPanel.tsx +33 -5
  36. package/src/admin/editor/panels/PageSettings.tsx +4 -0
  37. package/src/admin/editor/panels/SettingsPanel.tsx +21 -2
  38. package/src/admin/editor/panels/SiteStylesDrawer.tsx +7 -7
  39. package/src/admin/editor/panels/settings/BackgroundControls.tsx +72 -15
  40. package/src/admin/editor/panels/settings/BackgroundFill.tsx +8 -6
  41. package/src/admin/editor/panels/settings/BoxControl.tsx +5 -5
  42. package/src/admin/editor/panels/settings/EffectsControls.tsx +183 -10
  43. package/src/admin/editor/panels/settings/FieldControl.tsx +9 -3
  44. package/src/admin/editor/panels/settings/IconControls.tsx +25 -11
  45. package/src/admin/editor/panels/settings/LengthRow.tsx +63 -19
  46. package/src/admin/editor/panels/settings/LoopControl.tsx +269 -0
  47. package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +19 -1
  48. package/src/admin/editor/panels/settings/MotionControl.tsx +12 -11
  49. package/src/admin/editor/panels/settings/QueryStyleRows.tsx +7 -4
  50. package/src/admin/editor/panels/settings/StyleRow.tsx +120 -13
  51. package/src/admin/editor/panels/settings/TextMarksControl.tsx +247 -0
  52. package/src/admin/editor/panels/settings/VariableBinding.tsx +2 -2
  53. package/src/admin/editor/panels/settings/background-mode.ts +14 -11
  54. package/src/admin/editor/panels/settings/box-link-name.ts +1 -1
  55. package/src/admin/editor/panels/settings/box-sides.ts +22 -14
  56. package/src/admin/editor/panels/settings/heading-warning.ts +5 -1
  57. package/src/admin/editor/panels/settings/length-units.ts +68 -4
  58. package/src/admin/editor/panels/settings/query-style.ts +3 -3
  59. package/src/admin/editor/panels/settings/style-sections.ts +52 -10
  60. package/src/admin/editor/panels/style-target.ts +22 -7
  61. package/src/admin/editor/presence.ts +60 -0
  62. package/src/admin/editor/section-templates.ts +26 -4
  63. package/src/admin/editor/store.ts +14 -4
  64. package/src/admin/editor/useCoDesign.ts +177 -0
  65. package/src/admin/editor/useEditorCommands.ts +7 -5
  66. package/src/admin/editor/useExtensions.ts +45 -0
  67. package/src/admin/editor/useNodeActions.ts +18 -7
  68. package/src/admin/editor/useProposals.ts +81 -0
  69. package/src/admin/export-api.ts +221 -0
  70. package/src/admin/index.tsx +6 -1
  71. package/src/admin/languages-api.ts +61 -0
  72. package/src/admin/pages/AgentSetup.tsx +148 -0
  73. package/src/admin/pages/AgentsPage.tsx +9 -26
  74. package/src/admin/pages/CreateDialog.tsx +15 -0
  75. package/src/admin/pages/ExportDialog.tsx +395 -0
  76. package/src/admin/pages/ImportButton.tsx +18 -0
  77. package/src/admin/pages/ImportElementorDialog.tsx +669 -0
  78. package/src/admin/pages/ImportPageLinks.tsx +86 -0
  79. package/src/admin/pages/PageList.tsx +82 -3
  80. package/src/admin/pages/ThemePartList.tsx +52 -2
  81. package/src/admin/pages/bulk.tsx +303 -0
  82. package/src/admin/pages/section-head.tsx +27 -0
  83. package/src/admin/proposals-api.ts +91 -0
  84. package/src/admin/search.ts +20 -0
  85. package/src/admin/theme-api.ts +4 -0
  86. package/src/admin/ui.ts +50 -4
  87. package/src/admin/widgets/CanvasField.tsx +8 -0
  88. package/src/admin/widgets/ConvertToRichText.tsx +136 -0
  89. package/src/admin/widgets/ExportEntryHtml.tsx +92 -0
  90. package/src/admin/widgets/convert-body.ts +73 -2
  91. package/src/astro/content-port.ts +14 -1
  92. package/src/astro/render.ts +6 -6
  93. package/src/astro/resolve-theme.ts +25 -8
  94. package/src/astro/resolve.ts +89 -2
  95. package/src/astro/tabs/runtime.ts +16 -6
  96. package/src/constants.ts +1 -1
  97. package/src/core/a11y/audit.ts +45 -14
  98. package/src/core/arrange.ts +5 -1
  99. package/src/core/bounded-array.ts +31 -0
  100. package/src/core/clipboard.ts +9 -0
  101. package/src/core/contract.ts +305 -0
  102. package/src/core/css/generate.ts +151 -20
  103. package/src/core/css/scope.ts +10 -2
  104. package/src/core/css/trace.ts +47 -13
  105. package/src/core/css-keywords.ts +51 -1
  106. package/src/core/design/cascade.ts +12 -9
  107. package/src/core/design/classes.ts +28 -9
  108. package/src/core/design/devices.ts +89 -13
  109. package/src/core/design/states.ts +5 -3
  110. package/src/core/design/transfer.ts +5 -0
  111. package/src/core/design/variables.ts +31 -5
  112. package/src/core/elements/dynamic-elements.ts +3 -3
  113. package/src/core/elements/index.ts +73 -9
  114. package/src/core/export/runtimes.generated.ts +9 -0
  115. package/src/core/export/site.ts +562 -0
  116. package/src/core/export/zip.ts +95 -0
  117. package/src/core/extensions/define.ts +13 -0
  118. package/src/core/extensions/index.ts +41 -0
  119. package/src/core/extensions/namespace.ts +82 -0
  120. package/src/core/extensions/normalize.ts +141 -0
  121. package/src/core/extensions/placeholder.ts +41 -0
  122. package/src/core/extensions/registry.ts +94 -0
  123. package/src/core/extensions/render-ext.ts +118 -0
  124. package/src/core/extensions/safe-nodes.ts +93 -0
  125. package/src/core/extensions/schema.ts +112 -0
  126. package/src/core/extensions/types.ts +159 -0
  127. package/src/core/forms/binding.ts +1 -1
  128. package/src/core/history/diff.ts +26 -1
  129. package/src/core/import/elementor/atomic.ts +1608 -0
  130. package/src/core/import/elementor/classes.ts +127 -0
  131. package/src/core/import/elementor/context.ts +429 -0
  132. package/src/core/import/elementor/counter-steps.ts +72 -0
  133. package/src/core/import/elementor/css.ts +445 -0
  134. package/src/core/import/elementor/html.ts +500 -0
  135. package/src/core/import/elementor/index.ts +967 -0
  136. package/src/core/import/elementor/inline-marks.ts +81 -0
  137. package/src/core/import/elementor/snapshots.ts +48 -0
  138. package/src/core/import/elementor/style.ts +429 -0
  139. package/src/core/import/elementor/values.ts +241 -0
  140. package/src/core/import/elementor/widgets.ts +1897 -0
  141. package/src/core/index.ts +96 -0
  142. package/src/core/json-schema.ts +114 -0
  143. package/src/core/limits.ts +19 -0
  144. package/src/core/migrate/index.ts +6 -1
  145. package/src/core/migrate/v18.ts +222 -0
  146. package/src/core/perf/meter.ts +42 -24
  147. package/src/core/portable-text-export.ts +243 -0
  148. package/src/core/proposals-safety.ts +102 -0
  149. package/src/core/proposals.ts +357 -0
  150. package/src/core/public-attributes.ts +30 -0
  151. package/src/core/recipes/index.ts +2 -2
  152. package/src/core/render/extras.ts +3 -3
  153. package/src/core/render/index.ts +222 -23
  154. package/src/core/render/loop.ts +1 -1
  155. package/src/core/render/section.ts +4 -4
  156. package/src/core/render/tabs.ts +18 -11
  157. package/src/core/render/vnode.ts +1 -1
  158. package/src/core/sanitize/css.ts +151 -10
  159. package/src/core/sanitize/motion.ts +116 -0
  160. package/src/core/saved-sections.ts +6 -0
  161. package/src/core/schema/descriptors.ts +3 -1
  162. package/src/core/schema/design.ts +4 -3
  163. package/src/core/schema/layout.ts +92 -16
  164. package/src/core/schema/style.ts +296 -112
  165. package/src/core/search-text.ts +70 -0
  166. package/src/core/text-marks.ts +227 -0
  167. package/src/core/theme/dynamic.ts +9 -4
  168. package/src/core/theme/float.ts +2 -0
  169. package/src/core/theme/popup-rules.ts +33 -1
  170. package/src/core/translatable.ts +34 -0
  171. package/src/core/validate.ts +13 -1
  172. package/src/index.ts +24 -0
  173. package/src/mcp/errors.ts +3 -1
  174. package/src/mcp/ports.ts +67 -0
  175. package/src/mcp/prompts.ts +1 -11
  176. package/src/mcp/proposals.ts +281 -0
  177. package/src/mcp/read.ts +10 -10
  178. package/src/mcp/tools.ts +71 -3
  179. package/src/mcp/write.ts +66 -11
  180. package/src/server/agent-settings.ts +5 -1
  181. package/src/server/icon-routes.ts +52 -12
  182. package/src/server/mcp-routes.ts +15 -0
  183. package/src/server/plugin.ts +35 -2
  184. package/src/server/presence.ts +78 -0
  185. package/src/server/proposals.ts +261 -0
  186. package/src/server/requests.ts +196 -0
  187. package/src/server/tools-served.ts +45 -0
@@ -1,7 +1,11 @@
1
1
  import { Button, Input, Select } from "@cloudflare/kumo";
2
2
  import { PlusIcon } from "@phosphor-icons/react";
3
3
  import * as React from "react";
4
- import { sanitizeMediaUrl, type DesignSystem, type StyleProps } from "../../../../core/index.ts";
4
+ import {
5
+ sanitizeMediaUrl,
6
+ type DesignSystem,
7
+ type FlatStyleProps,
8
+ } from "../../../../core/index.ts";
5
9
  import type { Fetcher } from "../../../api.ts";
6
10
  import { listImages, uploadImage, type MediaLibraryItem } from "../../../media-api.ts";
7
11
  import { BUTTON, FIELD } from "../../../ui.ts";
@@ -9,8 +13,8 @@ import { ColorControl } from "../ColorControl.tsx";
9
13
  import { NumberField, type NumberSpec } from "./NumberRow.tsx";
10
14
  import { isCommitEnter } from "../../ime.ts";
11
15
 
12
- type Gradient = NonNullable<StyleProps["gradient"]>;
13
- type Overlay = NonNullable<StyleProps["overlay"]>;
16
+ type Gradient = NonNullable<FlatStyleProps["gradient"]>;
17
+ type Overlay = NonNullable<FlatStyleProps["overlay"]>;
14
18
 
15
19
  const ANGLE: NumberSpec = { min: 0, max: 360, integer: true, example: "180", suffix: "°" };
16
20
  const OVERLAY_OPACITY: NumberSpec = { min: 0, max: 100, scale: 100, example: "40", suffix: "%" };
@@ -404,6 +408,18 @@ export function GradientControl({
404
408
  );
405
409
  }
406
410
 
411
+ /** A gradient overlay starts as a scrim: dark behind the text on the left, clear on the right. */
412
+ const NEW_GRADIENT_OVERLAY: Overlay = {
413
+ gradient: {
414
+ type: "linear",
415
+ angle: 90,
416
+ stops: [
417
+ { color: "#000000cc", at: 0 },
418
+ { color: "#00000000", at: 100 },
419
+ ],
420
+ },
421
+ };
422
+
407
423
  export function OverlayControl({
408
424
  value,
409
425
  design,
@@ -417,9 +433,19 @@ export function OverlayControl({
417
433
  onDesignChange: (design: DesignSystem) => Promise<void>;
418
434
  reset: React.ReactNode;
419
435
  }) {
420
- const patch = (part: Partial<Overlay>) => {
421
- if (!value) return;
422
- onChange({ ...value, ...part });
436
+ const kind = value && "gradient" in value ? "gradient" : "color";
437
+ // W-949: switching kind keeps the opacity and swaps the paint.
438
+ const choose = (next: "color" | "gradient") => {
439
+ if (!value || next === kind) return;
440
+ const opacity = value.opacity;
441
+ if (next === "gradient") {
442
+ onChange({
443
+ ...NEW_GRADIENT_OVERLAY,
444
+ ...(opacity !== undefined && opacity !== 1 ? { opacity } : {}),
445
+ });
446
+ } else {
447
+ onChange({ ...NEW_OVERLAY, ...(opacity !== undefined ? { opacity } : {}) });
448
+ }
423
449
  };
424
450
  return (
425
451
  <div className="emvb-style-row" data-emvb-style="overlay" data-set={value ? "true" : undefined}>
@@ -427,19 +453,50 @@ export function OverlayControl({
427
453
  <span className="emvb-var-field-label">Overlay</span>
428
454
  {value ? (
429
455
  <>
430
- <ColorControl
431
- label="Overlay color"
432
- value={value.color}
433
- design={design}
434
- onChange={(color) => color && patch({ color })}
435
- onDesignChange={onDesignChange}
436
- />
456
+ <div className="emvb-fill-types" role="radiogroup" aria-label="Overlay type">
457
+ {(["color", "gradient"] as const).map((option) => (
458
+ <button
459
+ key={option}
460
+ type="button"
461
+ role="radio"
462
+ aria-checked={kind === option}
463
+ // The Fill type above has its own Color and Gradient: these name the overlay.
464
+ aria-label={option === "color" ? "Color overlay" : "Gradient overlay"}
465
+ data-emvb-overlay-type={option}
466
+ onClick={() => choose(option)}
467
+ >
468
+ {option === "color" ? "Color" : "Gradient"}
469
+ </button>
470
+ ))}
471
+ </div>
472
+ {"color" in value ? (
473
+ <ColorControl
474
+ label="Overlay color"
475
+ value={value.color}
476
+ design={design}
477
+ onChange={(color) => color && onChange({ ...value, color })}
478
+ onDesignChange={onDesignChange}
479
+ />
480
+ ) : (
481
+ <GradientControl
482
+ value={value.gradient}
483
+ design={design}
484
+ onChange={(gradient) => onChange({ ...value, gradient })}
485
+ onDesignChange={onDesignChange}
486
+ />
487
+ )}
437
488
  <NumberField
438
489
  fieldKey="overlay.opacity"
439
490
  label="Overlay opacity"
440
- value={value.opacity}
491
+ value={value.opacity ?? ("gradient" in value ? 1 : undefined)}
441
492
  spec={OVERLAY_OPACITY}
442
- onCommit={(n) => patch({ opacity: n ?? 0 })}
493
+ onCommit={(n) => {
494
+ if ("color" in value) onChange({ ...value, opacity: n ?? 0 });
495
+ else {
496
+ const { opacity: _old, ...rest } = value;
497
+ onChange(n === undefined || n === 1 ? rest : { ...rest, opacity: n });
498
+ }
499
+ }}
443
500
  />
444
501
  </>
445
502
  ) : (
@@ -1,6 +1,6 @@
1
1
  import { Input, Select } from "@cloudflare/kumo";
2
2
  import * as React from "react";
3
- import type { DesignSystem, StyleProps } from "../../../../core/index.ts";
3
+ import type { DesignSystem, FlatStyleProps } from "../../../../core/index.ts";
4
4
  import type { Fetcher } from "../../../api.ts";
5
5
  import { FIELD } from "../../../ui.ts";
6
6
  import { ColorControl } from "../ColorControl.tsx";
@@ -39,14 +39,14 @@ export function BackgroundFill({
39
39
  reset,
40
40
  memoryScope = "",
41
41
  }: {
42
- style: StyleProps | undefined;
42
+ style: FlatStyleProps | undefined;
43
43
  elementType?: string;
44
44
  design: DesignSystem;
45
45
  fetcher?: Fetcher;
46
46
  sizeOptions: { value: string; label: string }[];
47
47
  positionOptions: { value: string; label: string }[];
48
48
  repeatOptions: { value: string; label: string }[];
49
- onPatch: (patch: Partial<StyleProps>) => void;
49
+ onPatch: (patch: Partial<FlatStyleProps>) => void;
50
50
  onDesignChange: (design: DesignSystem) => Promise<void>;
51
51
  reset: React.ReactNode;
52
52
  /** Keeps remembered fills apart per class, device and state on one element (W-184). */
@@ -140,7 +140,7 @@ export function BackgroundFill({
140
140
  value={style?.backgroundSize}
141
141
  options={sizeOptions}
142
142
  onChange={(backgroundSize) =>
143
- onPatch({ backgroundSize: backgroundSize as StyleProps["backgroundSize"] })
143
+ onPatch({ backgroundSize: backgroundSize as FlatStyleProps["backgroundSize"] })
144
144
  }
145
145
  />
146
146
  <OptionSelect
@@ -149,7 +149,7 @@ export function BackgroundFill({
149
149
  options={positionOptions}
150
150
  onChange={(backgroundPosition) =>
151
151
  onPatch({
152
- backgroundPosition: backgroundPosition as StyleProps["backgroundPosition"],
152
+ backgroundPosition: backgroundPosition as FlatStyleProps["backgroundPosition"],
153
153
  })
154
154
  }
155
155
  />
@@ -158,7 +158,9 @@ export function BackgroundFill({
158
158
  value={style?.backgroundRepeat}
159
159
  options={repeatOptions}
160
160
  onChange={(backgroundRepeat) =>
161
- onPatch({ backgroundRepeat: backgroundRepeat as StyleProps["backgroundRepeat"] })
161
+ onPatch({
162
+ backgroundRepeat: backgroundRepeat as FlatStyleProps["backgroundRepeat"],
163
+ })
162
164
  }
163
165
  />
164
166
  </>
@@ -1,7 +1,7 @@
1
1
  import { DropdownMenu } from "@cloudflare/kumo";
2
2
  import { CaretDownIcon, LinkSimpleBreakIcon, LinkSimpleIcon } from "@phosphor-icons/react";
3
3
  import * as React from "react";
4
- import type { DesignSystem, StyleProps } from "../../../../core/index.ts";
4
+ import type { DesignSystem, FlatStyleProps } from "../../../../core/index.ts";
5
5
  import {
6
6
  allSame,
7
7
  groupSet,
@@ -23,7 +23,7 @@ import { bindKind, boundRef, VariableButton } from "./VariableBinding.tsx";
23
23
  import { isCommitEnter } from "../../ime.ts";
24
24
 
25
25
  /** Margin's "auto" menu item: auto left and right margins centre a box with a width (W-151). */
26
- const autoSidesPatch = (group: BoxGroup): Partial<StyleProps> => ({
26
+ const autoSidesPatch = (group: BoxGroup): Partial<FlatStyleProps> => ({
27
27
  [group.sides[1]]: "auto",
28
28
  [group.sides[3]]: "auto",
29
29
  });
@@ -40,11 +40,11 @@ export function BoxControl({
40
40
  onPatch,
41
41
  }: {
42
42
  group: BoxGroup;
43
- style: StyleProps | undefined;
43
+ style: FlatStyleProps | undefined;
44
44
  /** The Normal styles while a state is edited, shown as placeholders (W-089). */
45
- inherited?: StyleProps;
45
+ inherited?: FlatStyleProps;
46
46
  design: DesignSystem;
47
- onPatch: (patch: Partial<StyleProps>) => void;
47
+ onPatch: (patch: Partial<FlatStyleProps>) => void;
48
48
  }) {
49
49
  const values = sideValues(group, style);
50
50
  const normal = inherited ? sideValues(group, inherited) : [];
@@ -1,17 +1,68 @@
1
1
  import * as React from "react";
2
2
  import { Button, Select } from "@cloudflare/kumo";
3
- import { PlusIcon } from "@phosphor-icons/react";
4
- import type { DesignSystem, StyleProps } from "../../../../core/index.ts";
3
+ import { PencilSimpleIcon, PlusIcon } from "@phosphor-icons/react";
4
+ import type { DesignSystem, FlatStyleProps } from "../../../../core/index.ts";
5
5
  import { BUTTON, FIELD } from "../../../ui.ts";
6
6
  import { ColorControl } from "../ColorControl.tsx";
7
7
  import { NumberField, NumberRow, type NumberSpec } from "./NumberRow.tsx";
8
8
 
9
- type Shadow = NonNullable<StyleProps["boxShadow"]>;
10
- type Filter = NonNullable<StyleProps["filter"]>;
11
- type Transition = NonNullable<StyleProps["transition"]>;
12
- type Entrance = NonNullable<StyleProps["entrance"]>;
9
+ type Shadow = NonNullable<FlatStyleProps["boxShadow"]>;
10
+ type Filter = NonNullable<FlatStyleProps["filter"]>;
11
+ type Transition = NonNullable<FlatStyleProps["transition"]>;
12
+ type Entrance = NonNullable<FlatStyleProps["entrance"]>;
13
13
 
14
14
  /** DESIGN.md: Add shadow starts at 0 4 12 0, 18 % black. */
15
+ /**
16
+ * W-969: a composite style (shadow, entrance, transition, drop shadow) that is unset here but
17
+ * inherited (from a wider device, the Normal state, a class or the Site styles default) says what
18
+ * it inherits, and Edit here starts from that value instead of the default.
19
+ */
20
+ export function InheritedStart({
21
+ summary,
22
+ label,
23
+ onEdit,
24
+ }: {
25
+ summary: string;
26
+ label: string;
27
+ onEdit: () => void;
28
+ }) {
29
+ return (
30
+ <>
31
+ <p className="emvb-helper" data-emvb-inherited-note="">
32
+ Inherited: {summary}.
33
+ </p>
34
+ <Button
35
+ type="button"
36
+ variant="secondary"
37
+ className={`${BUTTON} emvb-add-shadow`}
38
+ icon={<PencilSimpleIcon aria-hidden="true" />}
39
+ onClick={onEdit}
40
+ aria-label={`Edit ${label} here`}
41
+ >
42
+ Edit here
43
+ </Button>
44
+ </>
45
+ );
46
+ }
47
+
48
+ const hexOf = (color: unknown) =>
49
+ typeof color === "string"
50
+ ? color
51
+ : color && typeof color === "object" && "var" in color
52
+ ? `variable ${String((color as { var: unknown }).var)}`
53
+ : "";
54
+
55
+ export const shadowSummary = (s: {
56
+ x: number;
57
+ y: number;
58
+ blur: number;
59
+ spread?: number;
60
+ color?: unknown;
61
+ }) =>
62
+ [`${s.x} ${s.y} ${s.blur}${s.spread !== undefined ? ` ${s.spread}` : ""} px`, hexOf(s.color)]
63
+ .filter(Boolean)
64
+ .join(", ");
65
+
15
66
  const NEW_SHADOW: Shadow = { x: 0, y: 4, blur: 12, spread: 0, color: "#0000002e" };
16
67
 
17
68
  const OFFSET: NumberSpec = { min: -1000, max: 1000, example: "4" };
@@ -27,12 +78,14 @@ const SHADOW_FIELDS: ReadonlyArray<
27
78
  /** One box shadow: Add shadow when unset; X, Y, blur, spread, colour and inset when set. */
28
79
  export function ShadowControl({
29
80
  value,
81
+ inherited,
30
82
  design,
31
83
  onChange,
32
84
  onDesignChange,
33
85
  reset,
34
86
  }: {
35
87
  value: Shadow | undefined;
88
+ inherited?: Shadow | undefined;
36
89
  design: DesignSystem;
37
90
  onChange: (next: Shadow | undefined) => void;
38
91
  onDesignChange: (design: DesignSystem) => Promise<void>;
@@ -49,6 +102,7 @@ export function ShadowControl({
49
102
  className="emvb-style-row"
50
103
  data-emvb-style="boxShadow"
51
104
  data-set={value ? "true" : undefined}
105
+ data-inherited={!value && inherited ? "true" : undefined}
52
106
  >
53
107
  <div className="emvb-field-group emvb-shadow">
54
108
  <span className="emvb-var-field-label">Box shadow</span>
@@ -88,6 +142,12 @@ export function ShadowControl({
88
142
  ))}
89
143
  </div>
90
144
  </>
145
+ ) : inherited ? (
146
+ <InheritedStart
147
+ summary={shadowSummary(inherited)}
148
+ label="box shadow"
149
+ onEdit={() => onChange({ ...inherited })}
150
+ />
91
151
  ) : (
92
152
  <Button
93
153
  type="button"
@@ -121,15 +181,108 @@ const FILTER_ROWS: ReadonlyArray<[key: keyof Filter, label: string, NumberSpec]>
121
181
  ["hueRotate", "Hue rotation", { min: 0, max: 360, example: "90", suffix: "°", placeholder: "0" }],
122
182
  ];
123
183
 
184
+ type Transform = NonNullable<FlatStyleProps["transform"]>;
185
+
186
+ /** One full turn, in degrees. */
187
+ const TURN = 360;
188
+
189
+ const TRANSFORM_ROWS: ReadonlyArray<[key: keyof Transform, label: string, NumberSpec]> = [
190
+ [
191
+ "x",
192
+ "Move X",
193
+ { min: -2000, max: 2000, integer: true, example: "8", suffix: "px", placeholder: "0" },
194
+ ],
195
+ [
196
+ "y",
197
+ "Move Y",
198
+ { min: -2000, max: 2000, integer: true, example: "-4", suffix: "px", placeholder: "0" },
199
+ ],
200
+ [
201
+ "scale",
202
+ "Scale",
203
+ { min: 10, max: 400, integer: true, example: "105", suffix: "%", placeholder: "100" },
204
+ ],
205
+ [
206
+ "rotate",
207
+ "Rotate",
208
+ { min: -360, max: TURN, integer: true, example: "15", suffix: "°", placeholder: "0" },
209
+ ],
210
+ ];
211
+
212
+ /**
213
+ * W-953: move, scale and rotate, one number row each; clearing the last row unsets Transform.
214
+ * In the Hover state it lifts or nudges the element (with a Transform transition to animate it).
215
+ */
216
+ export function TransformControl({
217
+ value,
218
+ inherited,
219
+ onChange,
220
+ }: {
221
+ value: Transform | undefined;
222
+ inherited?: Transform;
223
+ onChange: (next: Transform | undefined) => void;
224
+ }) {
225
+ const patch = (key: keyof Transform, n: number | undefined) => {
226
+ const next: Record<string, number> = {};
227
+ for (const [k, v] of Object.entries({ ...value, [key]: n })) {
228
+ if (typeof v === "number") next[k] = v;
229
+ }
230
+ onChange(Object.keys(next).length > 0 ? (next as Transform) : undefined);
231
+ };
232
+ const [open, setOpen] = React.useState(value !== undefined || inherited !== undefined);
233
+ const rows = React.useRef<HTMLDivElement>(null);
234
+ return (
235
+ <div
236
+ className="emvb-filters"
237
+ data-emvb-style="transform"
238
+ data-set={value ? "true" : undefined}
239
+ ref={rows}
240
+ >
241
+ <p className="emvb-sub-label">Transform</p>
242
+ {value || inherited || open ? (
243
+ TRANSFORM_ROWS.map(([key, label, spec]) => (
244
+ <NumberRow
245
+ key={key}
246
+ rowKey={`transform.${key}`}
247
+ label={label}
248
+ value={value?.[key]}
249
+ spec={spec}
250
+ inherited={inherited?.[key]}
251
+ onCommit={(n) => patch(key, n)}
252
+ />
253
+ ))
254
+ ) : (
255
+ <Button
256
+ type="button"
257
+ variant="secondary"
258
+ className={`${BUTTON} emvb-add-transform`}
259
+ icon={<PlusIcon aria-hidden="true" />}
260
+ onClick={() => {
261
+ setOpen(true);
262
+ requestAnimationFrame(() => rows.current?.querySelector<HTMLElement>("input")?.focus());
263
+ }}
264
+ >
265
+ Add transform
266
+ </Button>
267
+ )}
268
+ </div>
269
+ );
270
+ }
271
+
124
272
  /** The filter functions, one number row each; clearing the last one unsets Filters. */
125
273
  export function FiltersControl({
126
274
  value,
127
275
  inherited,
128
276
  onChange,
277
+ styleKey = "filter",
278
+ label: heading = "Filters",
129
279
  }: {
130
280
  value: Filter | undefined;
131
281
  inherited?: Filter;
132
282
  onChange: (next: Filter | undefined) => void;
283
+ /** W-957: the same rows edit `backdropFilter` (what's behind the element). */
284
+ styleKey?: "filter" | "backdropFilter";
285
+ label?: string;
133
286
  }) {
134
287
  const patch = (key: keyof Filter, n: number | undefined) => {
135
288
  const next: Record<string, number> = {};
@@ -144,16 +297,16 @@ export function FiltersControl({
144
297
  return (
145
298
  <div
146
299
  className="emvb-filters"
147
- data-emvb-style="filter"
300
+ data-emvb-style={styleKey}
148
301
  data-set={value ? "true" : undefined}
149
302
  ref={rows}
150
303
  >
151
- <p className="emvb-sub-label">Filters</p>
304
+ <p className="emvb-sub-label">{heading}</p>
152
305
  {open || value || inherited ? (
153
306
  FILTER_ROWS.map(([key, label, spec]) => (
154
307
  <NumberRow
155
308
  key={key}
156
- rowKey={`filter.${key}`}
309
+ rowKey={`${styleKey}.${key}`}
157
310
  label={label}
158
311
  value={value?.[key]}
159
312
  spec={spec}
@@ -172,7 +325,7 @@ export function FiltersControl({
172
325
  requestAnimationFrame(() => rows.current?.querySelector<HTMLElement>("input")?.focus());
173
326
  }}
174
327
  >
175
- Add filters
328
+ {`Add ${heading.toLowerCase()}`}
176
329
  </Button>
177
330
  )}
178
331
  </div>
@@ -195,6 +348,8 @@ const APPLIES_TO: ReadonlyArray<{ value: Transition["property"]; label: string }
195
348
  { value: "opacity", label: "Opacity" },
196
349
  { value: "shadow", label: "Shadow" },
197
350
  { value: "filter", label: "Filters" },
351
+ // W-953: move, scale and rotate (use it with a hover transform for a lift).
352
+ { value: "transform", label: "Transform" },
198
353
  ];
199
354
 
200
355
  export function TransitionSelect<T extends string>({
@@ -240,10 +395,12 @@ const ENTRANCE_TYPES: { value: Entrance["type"]; label: string }[] = [
240
395
  /** Plays once on load (W-101, Normal only). Add entrance starts at Fade, 400 ms. */
241
396
  export function EntranceControl({
242
397
  value,
398
+ inherited,
243
399
  onChange,
244
400
  reset,
245
401
  }: {
246
402
  value: Entrance | undefined;
403
+ inherited?: Entrance | undefined;
247
404
  onChange: (next: Entrance | undefined) => void;
248
405
  reset: React.ReactNode;
249
406
  }) {
@@ -252,6 +409,7 @@ export function EntranceControl({
252
409
  className="emvb-style-row"
253
410
  data-emvb-style="entrance"
254
411
  data-set={value ? "true" : undefined}
412
+ data-inherited={!value && inherited ? "true" : undefined}
255
413
  >
256
414
  <div className="emvb-field-group emvb-transition">
257
415
  <span className="emvb-var-field-label">Entrance</span>
@@ -290,6 +448,12 @@ export function EntranceControl({
290
448
  }
291
449
  />
292
450
  </>
451
+ ) : inherited ? (
452
+ <InheritedStart
453
+ summary={`${ENTRANCE_TYPES.find((t) => t.value === inherited.type)?.label ?? inherited.type}, ${inherited.duration} ms`}
454
+ label="entrance"
455
+ onEdit={() => onChange({ ...inherited })}
456
+ />
293
457
  ) : (
294
458
  <Button
295
459
  type="button"
@@ -310,10 +474,12 @@ export function EntranceControl({
310
474
  /** One transition (W-089, Normal only): Add transition when unset; duration, delay, easing, property when set. */
311
475
  export function TransitionControl({
312
476
  value,
477
+ inherited,
313
478
  onChange,
314
479
  reset,
315
480
  }: {
316
481
  value: Transition | undefined;
482
+ inherited?: Transition | undefined;
317
483
  onChange: (next: Transition | undefined) => void;
318
484
  reset: React.ReactNode;
319
485
  }) {
@@ -328,6 +494,7 @@ export function TransitionControl({
328
494
  className="emvb-style-row"
329
495
  data-emvb-style="transition"
330
496
  data-set={value ? "true" : undefined}
497
+ data-inherited={!value && inherited ? "true" : undefined}
331
498
  >
332
499
  <div className="emvb-field-group emvb-transition">
333
500
  <span className="emvb-var-field-label">Transition</span>
@@ -362,6 +529,12 @@ export function TransitionControl({
362
529
  onChange={(property) => patch({ property })}
363
530
  />
364
531
  </>
532
+ ) : inherited ? (
533
+ <InheritedStart
534
+ summary={`${inherited.duration} ms, ${EASINGS.find((e) => e.value === inherited.easing)?.label ?? inherited.easing}`}
535
+ label="transition"
536
+ onEdit={() => onChange({ ...inherited })}
537
+ />
365
538
  ) : (
366
539
  <Button
367
540
  type="button"
@@ -13,6 +13,7 @@ import { IconPicker } from "./IconPicker.tsx";
13
13
  import { ImageSourcesField } from "./ImageSourcesField.tsx";
14
14
  import { MediaPicker } from "./MediaPicker.tsx";
15
15
  import { propsOf, withProp } from "./node-props.ts";
16
+ import { TextMarksControl } from "./TextMarksControl.tsx";
16
17
 
17
18
  /** Content-tab control driven by a FieldDescriptor (W-021 / W-024). */
18
19
  export function FieldControl({
@@ -52,18 +53,18 @@ export function FieldControl({
52
53
  );
53
54
  }
54
55
 
55
- if (field.key === "itemPartId" && fetcher) {
56
+ if (field.key === "partId" && node.type === "loop" && fetcher) {
56
57
  return (
57
58
  <LoopItemBindControl
58
59
  key={field.key}
59
60
  value={typeof raw === "string" ? raw : ""}
60
61
  fetcher={fetcher}
61
- onChange={(itemPartId) => onChange(withProp(node, "itemPartId", itemPartId || undefined))}
62
+ onChange={(partId) => onChange(withProp(node, "partId", partId || undefined))}
62
63
  />
63
64
  );
64
65
  }
65
66
 
66
- if (field.key === "partId" && node.type === "section" && fetcher) {
67
+ if (field.key === "partId" && node.type === "part-ref" && fetcher) {
67
68
  return (
68
69
  <LoopItemBindControl
69
70
  key={field.key}
@@ -105,6 +106,10 @@ export function FieldControl({
105
106
  return <IconPicker key={field.key} node={node} fetcher={fetcher} onChange={onChange} />;
106
107
  }
107
108
 
109
+ if (field.kind === "marks") {
110
+ return <TextMarksControl key={field.key} node={node} onChange={onChange} />;
111
+ }
112
+
108
113
  if (field.kind === "image-sources") {
109
114
  return <ImageSourcesField key={field.key} node={node} onChange={onChange} />;
110
115
  }
@@ -296,4 +301,5 @@ export const IMPLEMENTED_FIELD_KINDS = [
296
301
  "icon",
297
302
  "list-items",
298
303
  "image-sources",
304
+ "marks",
299
305
  ] as const;
@@ -6,18 +6,19 @@ import {
6
6
  ProhibitIcon,
7
7
  } from "@phosphor-icons/react";
8
8
  import * as React from "react";
9
- import type { DesignSystem, StyleProps } from "../../../../core/index.ts";
9
+ import type { DesignSystem, FlatStyleProps } from "../../../../core/index.ts";
10
10
  import { BUTTON, FIELD } from "../../../ui.ts";
11
11
  import { ColorControl } from "../ColorControl.tsx";
12
12
  import { radioGroupKeys } from "./ChoiceGroup.tsx";
13
+ import { InheritedStart, shadowSummary } from "./EffectsControls.tsx";
13
14
  import { NumberField, ResetButton, type NumberSpec } from "./NumberRow.tsx";
14
15
  import { HintedSwitch } from "./HintedSwitch.tsx";
15
16
 
16
17
  /** W-237: the Icon section's own controls (glyph rotation, flip, drop shadow, loop). */
17
18
 
18
- type Flip = NonNullable<StyleProps["iconFlip"]>;
19
- type IconShadow = NonNullable<StyleProps["iconShadow"]>;
20
- type IconAnimation = NonNullable<StyleProps["iconAnimation"]>;
19
+ type Flip = NonNullable<FlatStyleProps["iconFlip"]>;
20
+ type IconShadow = NonNullable<FlatStyleProps["iconShadow"]>;
21
+ type IconAnimation = NonNullable<FlatStyleProps["iconAnimation"]>;
21
22
 
22
23
  const ICON_ROTATE: NumberSpec = {
23
24
  min: -360,
@@ -146,11 +147,14 @@ const ICON_SHADOW_FIELDS: ReadonlyArray<[key: "x" | "y" | "blur", label: string,
146
147
 
147
148
  export function IconShadowControl({
148
149
  value,
150
+ inherited,
149
151
  design,
150
152
  onChange,
151
153
  onDesignChange,
152
154
  }: {
153
155
  value: IconShadow | undefined;
156
+ /** W-969: the drop shadow this device or state inherits, shown and used by Edit here. */
157
+ inherited?: IconShadow | undefined;
154
158
  design: DesignSystem;
155
159
  onChange: (next: IconShadow | undefined) => void;
156
160
  onDesignChange: (design: DesignSystem) => Promise<void>;
@@ -166,6 +170,7 @@ export function IconShadowControl({
166
170
  className="emvb-style-row"
167
171
  data-emvb-style="iconShadow"
168
172
  data-set={value ? "true" : undefined}
173
+ data-inherited={!value && inherited ? "true" : undefined}
169
174
  >
170
175
  <div className="emvb-field-group emvb-shadow">
171
176
  <span className="emvb-var-field-label">Drop shadow</span>
@@ -191,6 +196,12 @@ export function IconShadowControl({
191
196
  ))}
192
197
  </div>
193
198
  </>
199
+ ) : inherited ? (
200
+ <InheritedStart
201
+ summary={shadowSummary(inherited)}
202
+ label="drop shadow"
203
+ onEdit={() => onChange({ ...inherited })}
204
+ />
194
205
  ) : (
195
206
  <Button
196
207
  type="button"
@@ -345,7 +356,7 @@ type IconShape = "none" | "circle" | "rounded" | "square";
345
356
  const SHAPE_PADDING = { value: 12, unit: "px" } as const;
346
357
  /** A light neutral, so the default icon colour (the text colour) reads on it. */
347
358
  const SHAPE_BACKGROUND = "#f1f5f9";
348
- const SHAPE_RADIUS: Record<Exclude<IconShape, "none">, StyleProps["borderRadius"]> = {
359
+ const SHAPE_RADIUS: Record<Exclude<IconShape, "none">, FlatStyleProps["borderRadius"]> = {
349
360
  circle: { value: 50, unit: "%" },
350
361
  rounded: { value: 12, unit: "px" },
351
362
  square: { value: 0, unit: "px" },
@@ -359,7 +370,7 @@ const CORNERS = [
359
370
  ] as const;
360
371
 
361
372
  /** The shape the styles in effect make: a background or border, and the corner radius. */
362
- function iconShapeOf(style: StyleProps | undefined): IconShape {
373
+ function iconShapeOf(style: FlatStyleProps | undefined): IconShape {
363
374
  if (!style || (style.backgroundColor === undefined && style.borderWidth === undefined))
364
375
  return "none";
365
376
  const radius = style.borderRadius;
@@ -376,8 +387,11 @@ function iconShapeOf(style: StyleProps | undefined): IconShape {
376
387
  * keeps a background or border already set, and adds 12 px padding only where none is set.
377
388
  * None clears the background, radius and padding it would have added.
378
389
  */
379
- function iconShapePatch(shape: IconShape, style: StyleProps | undefined): Partial<StyleProps> {
380
- const patch: Partial<StyleProps> = {};
390
+ function iconShapePatch(
391
+ shape: IconShape,
392
+ style: FlatStyleProps | undefined,
393
+ ): Partial<FlatStyleProps> {
394
+ const patch: Partial<FlatStyleProps> = {};
381
395
  for (const corner of CORNERS) if (style?.[corner] !== undefined) patch[corner] = undefined;
382
396
  if (shape === "none") {
383
397
  patch.backgroundColor = undefined;
@@ -406,9 +420,9 @@ export function IconShapeRow({
406
420
  inherited,
407
421
  onPatch,
408
422
  }: {
409
- style: StyleProps | undefined;
410
- inherited?: StyleProps;
411
- onPatch: (patch: Partial<StyleProps>) => void;
423
+ style: FlatStyleProps | undefined;
424
+ inherited?: FlatStyleProps;
425
+ onPatch: (patch: Partial<FlatStyleProps>) => void;
412
426
  }) {
413
427
  const effective = { ...inherited, ...style };
414
428
  const current = iconShapeOf(effective);