@perkyzz/emvb 0.8.0 → 1.0.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 (179) hide show
  1. package/README.md +3 -3
  2. package/package.json +4 -4
  3. package/src/admin/agents-api.ts +45 -0
  4. package/src/admin/editor/A11yCopilot.tsx +1 -1
  5. package/src/admin/editor/Editor.tsx +325 -239
  6. package/src/admin/editor/FieldPreview.tsx +164 -0
  7. package/src/admin/editor/Timeline.tsx +2 -1
  8. package/src/admin/editor/TopBar.tsx +36 -3
  9. package/src/admin/editor/canvas/CanvasFrame.tsx +2 -2
  10. package/src/admin/editor/canvas/DeviceBar.tsx +17 -9
  11. package/src/admin/editor/canvas/canvas-scale.ts +2 -2
  12. package/src/admin/editor/canvas/use-canvas-session.ts +2 -2
  13. package/src/admin/editor/co-design.ts +190 -0
  14. package/src/admin/editor/dnd/new-element.ts +26 -4
  15. package/src/admin/editor/editor-chrome.tsx +3 -3
  16. package/src/admin/editor/editor-commands.ts +8 -3
  17. package/src/admin/editor/editor-css.ts +3 -0
  18. package/src/admin/editor/element-chrome.ts +3 -1
  19. package/src/admin/editor/extension-manifests.ts +20 -0
  20. package/src/admin/editor/extensions/ExtensionPanels.tsx +26 -0
  21. package/src/admin/editor/extensions-context.tsx +27 -0
  22. package/src/admin/editor/feature-css.ts +17 -0
  23. package/src/admin/editor/host.ts +6 -0
  24. package/src/admin/editor/palette-items.ts +2 -2
  25. package/src/admin/editor/panels/AddPanel.tsx +31 -1
  26. package/src/admin/editor/panels/AgentRequestBox.tsx +116 -0
  27. package/src/admin/editor/panels/ClassesSection.tsx +9 -6
  28. package/src/admin/editor/panels/CoDesignPanel.tsx +170 -0
  29. package/src/admin/editor/panels/ColorControl.tsx +2 -2
  30. package/src/admin/editor/panels/ElementPanel.tsx +53 -15
  31. package/src/admin/editor/panels/LanguagesSection.tsx +152 -0
  32. package/src/admin/editor/panels/LayersPanel.tsx +10 -6
  33. package/src/admin/editor/panels/LeftPanel.tsx +33 -5
  34. package/src/admin/editor/panels/PageSettings.tsx +4 -0
  35. package/src/admin/editor/panels/SettingsPanel.tsx +21 -2
  36. package/src/admin/editor/panels/SiteStylesDrawer.tsx +7 -7
  37. package/src/admin/editor/panels/settings/BackgroundControls.tsx +76 -20
  38. package/src/admin/editor/panels/settings/BackgroundFill.tsx +8 -6
  39. package/src/admin/editor/panels/settings/BoxControl.tsx +5 -5
  40. package/src/admin/editor/panels/settings/EffectsControls.tsx +104 -9
  41. package/src/admin/editor/panels/settings/FieldControl.tsx +9 -3
  42. package/src/admin/editor/panels/settings/IconControls.tsx +14 -11
  43. package/src/admin/editor/panels/settings/LengthRow.tsx +27 -16
  44. package/src/admin/editor/panels/settings/LoopControl.tsx +269 -0
  45. package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +1 -1
  46. package/src/admin/editor/panels/settings/MediaPicker.tsx +5 -5
  47. package/src/admin/editor/panels/settings/MotionControl.tsx +12 -11
  48. package/src/admin/editor/panels/settings/QueryStyleRows.tsx +7 -4
  49. package/src/admin/editor/panels/settings/StyleRow.tsx +113 -13
  50. package/src/admin/editor/panels/settings/TextMarksControl.tsx +247 -0
  51. package/src/admin/editor/panels/settings/VariableBinding.tsx +2 -2
  52. package/src/admin/editor/panels/settings/background-mode.ts +14 -11
  53. package/src/admin/editor/panels/settings/box-link-name.ts +1 -1
  54. package/src/admin/editor/panels/settings/box-sides.ts +22 -14
  55. package/src/admin/editor/panels/settings/heading-warning.ts +5 -1
  56. package/src/admin/editor/panels/settings/length-units.ts +55 -2
  57. package/src/admin/editor/panels/settings/query-style.ts +3 -3
  58. package/src/admin/editor/panels/settings/style-sections.ts +51 -10
  59. package/src/admin/editor/panels/style-target.ts +9 -7
  60. package/src/admin/editor/presence.ts +60 -0
  61. package/src/admin/editor/store.ts +6 -2
  62. package/src/admin/editor/useCoDesign.ts +177 -0
  63. package/src/admin/editor/useEditorCommands.ts +4 -4
  64. package/src/admin/editor/useExtensions.ts +45 -0
  65. package/src/admin/editor/useNodeActions.ts +15 -6
  66. package/src/admin/editor/useProposals.ts +81 -0
  67. package/src/admin/index.tsx +5 -1
  68. package/src/admin/languages-api.ts +61 -0
  69. package/src/admin/media-api.ts +27 -0
  70. package/src/admin/pages/AgentSetup.tsx +148 -0
  71. package/src/admin/pages/AgentsPage.tsx +11 -28
  72. package/src/admin/pages/CollectionsPage.tsx +215 -0
  73. package/src/admin/pages/CreateDialog.tsx +15 -0
  74. package/src/admin/pages/ImportButton.tsx +18 -0
  75. package/src/admin/pages/ImportElementorDialog.tsx +669 -0
  76. package/src/admin/pages/ImportPageLinks.tsx +86 -0
  77. package/src/admin/pages/PageList.tsx +15 -1
  78. package/src/admin/pages/ThemePartList.tsx +15 -1
  79. package/src/admin/pages/section-head.tsx +27 -0
  80. package/src/admin/proposals-api.ts +91 -0
  81. package/src/admin/setup/host-collections.ts +100 -0
  82. package/src/admin/ui.ts +39 -2
  83. package/src/admin/widgets/CanvasField.tsx +202 -0
  84. package/src/admin/widgets/convert-body.ts +54 -0
  85. package/src/admin/widgets/field-fetcher.ts +79 -0
  86. package/src/astro/content-port.ts +14 -1
  87. package/src/astro/index.ts +2 -0
  88. package/src/astro/page-count.ts +77 -0
  89. package/src/astro/resolve-theme.ts +58 -3
  90. package/src/astro/resolve.ts +128 -5
  91. package/src/astro/responsive-images.ts +99 -0
  92. package/src/constants.ts +1 -1
  93. package/src/core/a11y/audit.ts +44 -14
  94. package/src/core/arrange.ts +5 -1
  95. package/src/core/bounded-array.ts +31 -0
  96. package/src/core/canvas-collections.ts +20 -0
  97. package/src/core/clipboard.ts +9 -0
  98. package/src/core/contract.ts +285 -0
  99. package/src/core/css/generate.ts +89 -20
  100. package/src/core/css/trace.ts +18 -9
  101. package/src/core/css-keywords.ts +51 -1
  102. package/src/core/design/cascade.ts +12 -9
  103. package/src/core/design/classes.ts +4 -5
  104. package/src/core/design/devices.ts +13 -13
  105. package/src/core/design/states.ts +5 -3
  106. package/src/core/design/transfer.ts +5 -0
  107. package/src/core/design/variables.ts +17 -4
  108. package/src/core/elements/dynamic-elements.ts +19 -4
  109. package/src/core/elements/index.ts +73 -9
  110. package/src/core/extensions/define.ts +13 -0
  111. package/src/core/extensions/index.ts +41 -0
  112. package/src/core/extensions/namespace.ts +82 -0
  113. package/src/core/extensions/normalize.ts +141 -0
  114. package/src/core/extensions/placeholder.ts +41 -0
  115. package/src/core/extensions/registry.ts +94 -0
  116. package/src/core/extensions/render-ext.ts +118 -0
  117. package/src/core/extensions/safe-nodes.ts +93 -0
  118. package/src/core/extensions/schema.ts +112 -0
  119. package/src/core/extensions/types.ts +159 -0
  120. package/src/core/forms/binding.ts +1 -1
  121. package/src/core/history/diff.ts +1 -1
  122. package/src/core/import/elementor/atomic.ts +1595 -0
  123. package/src/core/import/elementor/classes.ts +127 -0
  124. package/src/core/import/elementor/context.ts +429 -0
  125. package/src/core/import/elementor/counter-steps.ts +72 -0
  126. package/src/core/import/elementor/css.ts +445 -0
  127. package/src/core/import/elementor/html.ts +500 -0
  128. package/src/core/import/elementor/index.ts +949 -0
  129. package/src/core/import/elementor/inline-marks.ts +81 -0
  130. package/src/core/import/elementor/snapshots.ts +48 -0
  131. package/src/core/import/elementor/style.ts +409 -0
  132. package/src/core/import/elementor/values.ts +241 -0
  133. package/src/core/import/elementor/widgets.ts +1897 -0
  134. package/src/core/index.ts +84 -0
  135. package/src/core/json-schema.ts +107 -0
  136. package/src/core/limits.ts +19 -0
  137. package/src/core/migrate/index.ts +6 -1
  138. package/src/core/migrate/v18.ts +222 -0
  139. package/src/core/perf/meter.ts +5 -5
  140. package/src/core/portable-text.ts +127 -0
  141. package/src/core/proposals-safety.ts +102 -0
  142. package/src/core/proposals.ts +357 -0
  143. package/src/core/recipes/index.ts +2 -2
  144. package/src/core/render/extras.ts +3 -3
  145. package/src/core/render/index.ts +140 -20
  146. package/src/core/render/loop.ts +1 -1
  147. package/src/core/render/pagination.ts +20 -1
  148. package/src/core/render/section.ts +4 -4
  149. package/src/core/render/vnode.ts +1 -1
  150. package/src/core/sanitize/css.ts +125 -10
  151. package/src/core/sanitize/motion.ts +116 -0
  152. package/src/core/saved-sections.ts +6 -0
  153. package/src/core/schema/descriptors.ts +3 -1
  154. package/src/core/schema/design.ts +2 -1
  155. package/src/core/schema/layout.ts +87 -14
  156. package/src/core/schema/style.ts +251 -114
  157. package/src/core/text-marks.ts +227 -0
  158. package/src/core/theme/dynamic.ts +9 -4
  159. package/src/core/theme/float.ts +1 -0
  160. package/src/core/theme/pagination.ts +9 -0
  161. package/src/core/theme/popup-rules.ts +17 -1
  162. package/src/core/translatable.ts +34 -0
  163. package/src/core/validate.ts +13 -1
  164. package/src/index.ts +35 -1
  165. package/src/mcp/errors.ts +3 -1
  166. package/src/mcp/ports.ts +67 -0
  167. package/src/mcp/prompts.ts +1 -11
  168. package/src/mcp/proposals.ts +281 -0
  169. package/src/mcp/read.ts +10 -9
  170. package/src/mcp/tools.ts +71 -3
  171. package/src/mcp/write.ts +66 -11
  172. package/src/server/agent-settings.ts +21 -2
  173. package/src/server/hooks.ts +81 -0
  174. package/src/server/mcp-routes.ts +15 -0
  175. package/src/server/plugin.ts +53 -5
  176. package/src/server/presence.ts +78 -0
  177. package/src/server/proposals.ts +261 -0
  178. package/src/server/requests.ts +196 -0
  179. 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: "%" };
@@ -85,10 +89,6 @@ export function BackgroundImageControl({
85
89
  }
86
90
  }, [fetcher, setBusy]);
87
91
 
88
- React.useEffect(() => {
89
- if (open) void loadLibrary();
90
- }, [open, loadLibrary]);
91
-
92
92
  const applyUrl = (next: string) => {
93
93
  const safe = sanitizeMediaUrl(next);
94
94
  if (!safe || /[()\\\s"'`]/.test(safe)) {
@@ -138,7 +138,10 @@ export function BackgroundImageControl({
138
138
  type="button"
139
139
  className={BUTTON}
140
140
  onClick={() => {
141
- if (!busyRef.current) setOpen(true);
141
+ if (busyRef.current) return;
142
+ // W-906: load in the same update that opens it, so it never paints "No images yet." first.
143
+ setOpen(true);
144
+ void loadLibrary();
142
145
  }}
143
146
  aria-disabled={busy}
144
147
  ref={libraryOpenerRef}
@@ -405,6 +408,18 @@ export function GradientControl({
405
408
  );
406
409
  }
407
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
+
408
423
  export function OverlayControl({
409
424
  value,
410
425
  design,
@@ -418,9 +433,19 @@ export function OverlayControl({
418
433
  onDesignChange: (design: DesignSystem) => Promise<void>;
419
434
  reset: React.ReactNode;
420
435
  }) {
421
- const patch = (part: Partial<Overlay>) => {
422
- if (!value) return;
423
- 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
+ }
424
449
  };
425
450
  return (
426
451
  <div className="emvb-style-row" data-emvb-style="overlay" data-set={value ? "true" : undefined}>
@@ -428,19 +453,50 @@ export function OverlayControl({
428
453
  <span className="emvb-var-field-label">Overlay</span>
429
454
  {value ? (
430
455
  <>
431
- <ColorControl
432
- label="Overlay color"
433
- value={value.color}
434
- design={design}
435
- onChange={(color) => color && patch({ color })}
436
- onDesignChange={onDesignChange}
437
- />
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
+ )}
438
488
  <NumberField
439
489
  fieldKey="overlay.opacity"
440
490
  label="Overlay opacity"
441
- value={value.opacity}
491
+ value={value.opacity ?? ("gradient" in value ? 1 : undefined)}
442
492
  spec={OVERLAY_OPACITY}
443
- 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
+ }}
444
500
  />
445
501
  </>
446
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,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import { Button, Select } from "@cloudflare/kumo";
3
3
  import { PlusIcon } from "@phosphor-icons/react";
4
- import type { DesignSystem, StyleProps } from "../../../../core/index.ts";
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
15
  const NEW_SHADOW: Shadow = { x: 0, y: 4, blur: 12, spread: 0, color: "#0000002e" };
@@ -121,15 +121,108 @@ const FILTER_ROWS: ReadonlyArray<[key: keyof Filter, label: string, NumberSpec]>
121
121
  ["hueRotate", "Hue rotation", { min: 0, max: 360, example: "90", suffix: "°", placeholder: "0" }],
122
122
  ];
123
123
 
124
+ type Transform = NonNullable<FlatStyleProps["transform"]>;
125
+
126
+ /** One full turn, in degrees. */
127
+ const TURN = 360;
128
+
129
+ const TRANSFORM_ROWS: ReadonlyArray<[key: keyof Transform, label: string, NumberSpec]> = [
130
+ [
131
+ "x",
132
+ "Move X",
133
+ { min: -2000, max: 2000, integer: true, example: "8", suffix: "px", placeholder: "0" },
134
+ ],
135
+ [
136
+ "y",
137
+ "Move Y",
138
+ { min: -2000, max: 2000, integer: true, example: "-4", suffix: "px", placeholder: "0" },
139
+ ],
140
+ [
141
+ "scale",
142
+ "Scale",
143
+ { min: 10, max: 400, integer: true, example: "105", suffix: "%", placeholder: "100" },
144
+ ],
145
+ [
146
+ "rotate",
147
+ "Rotate",
148
+ { min: -360, max: TURN, integer: true, example: "15", suffix: "°", placeholder: "0" },
149
+ ],
150
+ ];
151
+
152
+ /**
153
+ * W-953: move, scale and rotate, one number row each; clearing the last row unsets Transform.
154
+ * In the Hover state it lifts or nudges the element (with a Transform transition to animate it).
155
+ */
156
+ export function TransformControl({
157
+ value,
158
+ inherited,
159
+ onChange,
160
+ }: {
161
+ value: Transform | undefined;
162
+ inherited?: Transform;
163
+ onChange: (next: Transform | undefined) => void;
164
+ }) {
165
+ const patch = (key: keyof Transform, n: number | undefined) => {
166
+ const next: Record<string, number> = {};
167
+ for (const [k, v] of Object.entries({ ...value, [key]: n })) {
168
+ if (typeof v === "number") next[k] = v;
169
+ }
170
+ onChange(Object.keys(next).length > 0 ? (next as Transform) : undefined);
171
+ };
172
+ const [open, setOpen] = React.useState(value !== undefined || inherited !== undefined);
173
+ const rows = React.useRef<HTMLDivElement>(null);
174
+ return (
175
+ <div
176
+ className="emvb-filters"
177
+ data-emvb-style="transform"
178
+ data-set={value ? "true" : undefined}
179
+ ref={rows}
180
+ >
181
+ <p className="emvb-sub-label">Transform</p>
182
+ {value || inherited || open ? (
183
+ TRANSFORM_ROWS.map(([key, label, spec]) => (
184
+ <NumberRow
185
+ key={key}
186
+ rowKey={`transform.${key}`}
187
+ label={label}
188
+ value={value?.[key]}
189
+ spec={spec}
190
+ inherited={inherited?.[key]}
191
+ onCommit={(n) => patch(key, n)}
192
+ />
193
+ ))
194
+ ) : (
195
+ <Button
196
+ type="button"
197
+ variant="secondary"
198
+ className={`${BUTTON} emvb-add-transform`}
199
+ icon={<PlusIcon aria-hidden="true" />}
200
+ onClick={() => {
201
+ setOpen(true);
202
+ requestAnimationFrame(() => rows.current?.querySelector<HTMLElement>("input")?.focus());
203
+ }}
204
+ >
205
+ Add transform
206
+ </Button>
207
+ )}
208
+ </div>
209
+ );
210
+ }
211
+
124
212
  /** The filter functions, one number row each; clearing the last one unsets Filters. */
125
213
  export function FiltersControl({
126
214
  value,
127
215
  inherited,
128
216
  onChange,
217
+ styleKey = "filter",
218
+ label: heading = "Filters",
129
219
  }: {
130
220
  value: Filter | undefined;
131
221
  inherited?: Filter;
132
222
  onChange: (next: Filter | undefined) => void;
223
+ /** W-957: the same rows edit `backdropFilter` (what's behind the element). */
224
+ styleKey?: "filter" | "backdropFilter";
225
+ label?: string;
133
226
  }) {
134
227
  const patch = (key: keyof Filter, n: number | undefined) => {
135
228
  const next: Record<string, number> = {};
@@ -144,16 +237,16 @@ export function FiltersControl({
144
237
  return (
145
238
  <div
146
239
  className="emvb-filters"
147
- data-emvb-style="filter"
240
+ data-emvb-style={styleKey}
148
241
  data-set={value ? "true" : undefined}
149
242
  ref={rows}
150
243
  >
151
- <p className="emvb-sub-label">Filters</p>
244
+ <p className="emvb-sub-label">{heading}</p>
152
245
  {open || value || inherited ? (
153
246
  FILTER_ROWS.map(([key, label, spec]) => (
154
247
  <NumberRow
155
248
  key={key}
156
- rowKey={`filter.${key}`}
249
+ rowKey={`${styleKey}.${key}`}
157
250
  label={label}
158
251
  value={value?.[key]}
159
252
  spec={spec}
@@ -172,7 +265,7 @@ export function FiltersControl({
172
265
  requestAnimationFrame(() => rows.current?.querySelector<HTMLElement>("input")?.focus());
173
266
  }}
174
267
  >
175
- Add filters
268
+ {`Add ${heading.toLowerCase()}`}
176
269
  </Button>
177
270
  )}
178
271
  </div>
@@ -195,6 +288,8 @@ const APPLIES_TO: ReadonlyArray<{ value: Transition["property"]; label: string }
195
288
  { value: "opacity", label: "Opacity" },
196
289
  { value: "shadow", label: "Shadow" },
197
290
  { value: "filter", label: "Filters" },
291
+ // W-953: move, scale and rotate (use it with a hover transform for a lift).
292
+ { value: "transform", label: "Transform" },
198
293
  ];
199
294
 
200
295
  export function TransitionSelect<T extends string>({
@@ -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,7 +6,7 @@ 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";
@@ -15,9 +15,9 @@ import { HintedSwitch } from "./HintedSwitch.tsx";
15
15
 
16
16
  /** W-237: the Icon section's own controls (glyph rotation, flip, drop shadow, loop). */
17
17
 
18
- type Flip = NonNullable<StyleProps["iconFlip"]>;
19
- type IconShadow = NonNullable<StyleProps["iconShadow"]>;
20
- type IconAnimation = NonNullable<StyleProps["iconAnimation"]>;
18
+ type Flip = NonNullable<FlatStyleProps["iconFlip"]>;
19
+ type IconShadow = NonNullable<FlatStyleProps["iconShadow"]>;
20
+ type IconAnimation = NonNullable<FlatStyleProps["iconAnimation"]>;
21
21
 
22
22
  const ICON_ROTATE: NumberSpec = {
23
23
  min: -360,
@@ -345,7 +345,7 @@ type IconShape = "none" | "circle" | "rounded" | "square";
345
345
  const SHAPE_PADDING = { value: 12, unit: "px" } as const;
346
346
  /** A light neutral, so the default icon colour (the text colour) reads on it. */
347
347
  const SHAPE_BACKGROUND = "#f1f5f9";
348
- const SHAPE_RADIUS: Record<Exclude<IconShape, "none">, StyleProps["borderRadius"]> = {
348
+ const SHAPE_RADIUS: Record<Exclude<IconShape, "none">, FlatStyleProps["borderRadius"]> = {
349
349
  circle: { value: 50, unit: "%" },
350
350
  rounded: { value: 12, unit: "px" },
351
351
  square: { value: 0, unit: "px" },
@@ -359,7 +359,7 @@ const CORNERS = [
359
359
  ] as const;
360
360
 
361
361
  /** The shape the styles in effect make: a background or border, and the corner radius. */
362
- function iconShapeOf(style: StyleProps | undefined): IconShape {
362
+ function iconShapeOf(style: FlatStyleProps | undefined): IconShape {
363
363
  if (!style || (style.backgroundColor === undefined && style.borderWidth === undefined))
364
364
  return "none";
365
365
  const radius = style.borderRadius;
@@ -376,8 +376,11 @@ function iconShapeOf(style: StyleProps | undefined): IconShape {
376
376
  * keeps a background or border already set, and adds 12 px padding only where none is set.
377
377
  * None clears the background, radius and padding it would have added.
378
378
  */
379
- function iconShapePatch(shape: IconShape, style: StyleProps | undefined): Partial<StyleProps> {
380
- const patch: Partial<StyleProps> = {};
379
+ function iconShapePatch(
380
+ shape: IconShape,
381
+ style: FlatStyleProps | undefined,
382
+ ): Partial<FlatStyleProps> {
383
+ const patch: Partial<FlatStyleProps> = {};
381
384
  for (const corner of CORNERS) if (style?.[corner] !== undefined) patch[corner] = undefined;
382
385
  if (shape === "none") {
383
386
  patch.backgroundColor = undefined;
@@ -406,9 +409,9 @@ export function IconShapeRow({
406
409
  inherited,
407
410
  onPatch,
408
411
  }: {
409
- style: StyleProps | undefined;
410
- inherited?: StyleProps;
411
- onPatch: (patch: Partial<StyleProps>) => void;
412
+ style: FlatStyleProps | undefined;
413
+ inherited?: FlatStyleProps;
414
+ onPatch: (patch: Partial<FlatStyleProps>) => void;
412
415
  }) {
413
416
  const effective = { ...inherited, ...style };
414
417
  const current = iconShapeOf(effective);
@@ -1,11 +1,15 @@
1
1
  import { DropdownMenu, InputGroup } from "@cloudflare/kumo";
2
2
  import { CaretDownIcon } 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 { FIELD } from "../../../ui.ts";
6
6
  import {
7
+ fluidDraft,
8
+ isFluid,
7
9
  parseLengthDraft,
10
+ takesFluid,
8
11
  unitsFor,
12
+ type FluidLiteral,
9
13
  type LengthLiteral,
10
14
  type LengthUnit,
11
15
  type UnitChoice,
@@ -21,7 +25,9 @@ const isLiteral = (value: unknown): value is LengthLiteral =>
21
25
  typeof (value as { unit?: unknown }).unit === "string";
22
26
 
23
27
  const same = (a: unknown, b: unknown) =>
24
- a === b || (isLiteral(a) && isLiteral(b) && a.value === b.value && a.unit === b.unit);
28
+ a === b ||
29
+ (isLiteral(a) && isLiteral(b) && a.value === b.value && a.unit === b.unit) ||
30
+ (isFluid(a) && isFluid(b) && a.fluid.min === b.fluid.min && a.fluid.max === b.fluid.max);
25
31
 
26
32
  type NumericUnit = LengthUnit | "x";
27
33
 
@@ -49,7 +55,7 @@ export function LengthRow({
49
55
  placeholder?: string;
50
56
  /** Gap: a slider for the common range. The number field still accepts the full length. */
51
57
  slider?: boolean;
52
- onPatch: (patch: Partial<StyleProps>) => void;
58
+ onPatch: (patch: Partial<FlatStyleProps>) => void;
53
59
  reset: React.ReactNode;
54
60
  }) {
55
61
  const units = unitsFor(styleKey);
@@ -60,19 +66,22 @@ export function LengthRow({
60
66
  () => (isLiteral(value) ? value : typeof value === "number" ? { value, unit: "x" } : undefined),
61
67
  [value],
62
68
  );
63
- const numericUnit = literal?.unit ?? firstNumeric(units);
64
- const [draft, setDraft] = React.useState(literal ? String(literal.value) : "");
69
+ // W-955: a fluid size shows as "32–56" in px.
70
+ const fluid = isFluid(value) ? value : undefined;
71
+ const textOf = (): string => (fluid ? fluidDraft(fluid) : literal ? String(literal.value) : "");
72
+ const numericUnit = literal?.unit ?? (fluid ? "px" : firstNumeric(units));
73
+ const [draft, setDraft] = React.useState(textOf);
65
74
  const [unit, setUnit] = React.useState<UnitChoice>(value === "auto" ? "auto" : numericUnit);
66
75
  const lastNumeric = React.useRef<NumericUnit>(numericUnit);
67
76
  const [error, setError] = React.useState<string | null>(null);
68
77
  React.useEffect(() => {
69
- setDraft(literal ? String(literal.value) : "");
70
- setUnit(value === "auto" ? "auto" : (literal?.unit ?? lastNumeric.current));
78
+ setDraft(textOf());
79
+ setUnit(value === "auto" ? "auto" : (literal?.unit ?? (fluid ? "px" : lastNumeric.current)));
71
80
  if (literal) lastNumeric.current = literal.unit;
72
81
  setError(null);
73
82
  }, [value, literal]);
74
83
 
75
- const send = (next: LengthLiteral | "auto" | number | undefined) => {
84
+ const send = (next: LengthLiteral | FluidLiteral | "auto" | number | undefined) => {
76
85
  if (!same(next, value)) onPatch({ [styleKey]: next });
77
86
  };
78
87
 
@@ -97,13 +106,15 @@ export function LengthRow({
97
106
  }
98
107
  lastNumeric.current = next;
99
108
  const parsed = parseLengthDraft(draft, styleKey, next);
100
- if (parsed.ok && parsed.value !== undefined && parsed.value !== "auto") {
101
- const n = typeof parsed.value === "number" ? parsed.value : parsed.value.value;
102
- if (next === "x") {
103
- if (n <= 100) send(n);
104
- else setError("Line height without a unit can be from 0 to 100.");
105
- } else send({ value: n, unit: next });
106
- }
109
+ if (!parsed.ok) return;
110
+ const typed = parsed.value;
111
+ // A fluid range is always px; the unit menu leaves it as it is.
112
+ if (typed === undefined || typed === "auto" || isFluid(typed)) return;
113
+ const n = typeof typed === "number" ? typed : typed.value;
114
+ if (next === "x") {
115
+ if (n <= 100) send(n);
116
+ else setError("Line height without a unit can be from 0 to 100.");
117
+ } else send({ value: n, unit: next });
107
118
  };
108
119
 
109
120
  const kind = bindKind(styleKey);
@@ -140,7 +151,7 @@ export function LengthRow({
140
151
  placeholder={unit === "auto" ? "auto" : placeholder}
141
152
  title={`A number in ${unit === "auto" ? lastNumeric.current : unit}, or with its own unit (2rem, 50%)${
142
153
  units.includes("auto") ? ", or auto" : ""
143
- }`}
154
+ }${takesFluid(styleKey) ? ". A range such as 32–56 grows from phones to large screens (px)" : ""}`}
144
155
  aria-invalid={error ? true : undefined}
145
156
  onChange={(event) => {
146
157
  if (unit === "auto") setUnit(lastNumeric.current);