@perkyzz/emvb 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/THIRD_PARTY_NOTICES.md +23 -1
- package/licenses/exif-js.LICENSE +21 -0
- package/licenses/fflate.LICENSE +21 -0
- package/licenses/glfx.js.LICENSE +19 -0
- package/licenses/mini-photo-editor.LICENSE +21 -0
- package/licenses/photocn.LICENSE +21 -0
- package/package.json +2 -1
- package/src/admin/access/RequireEditor.tsx +7 -7
- package/src/admin/access/role.ts +5 -2
- package/src/admin/content-api.ts +10 -3
- package/src/admin/content-item.ts +1 -1
- package/src/admin/editor/A11yCopilot.tsx +104 -56
- package/src/admin/editor/CommandPalette.tsx +29 -13
- package/src/admin/editor/Editor.tsx +88 -20
- package/src/admin/editor/EditorToasts.tsx +26 -0
- package/src/admin/editor/PerfMeter.tsx +97 -72
- package/src/admin/editor/ShareLink.tsx +107 -72
- package/src/admin/editor/ShortcutsDialog.tsx +27 -16
- package/src/admin/editor/Timeline.tsx +255 -160
- package/src/admin/editor/TopBar.tsx +71 -14
- package/src/admin/editor/canvas/CanvasFrame.tsx +10 -1
- package/src/admin/editor/canvas/CanvasTextEdit.tsx +8 -2
- package/src/admin/editor/canvas/drop-line.ts +11 -3
- package/src/admin/editor/canvas/frame-focus-ring.ts +37 -0
- package/src/admin/editor/canvas/use-canvas-dnd.ts +32 -3
- package/src/admin/editor/canvas/vnode-react.tsx +7 -0
- package/src/admin/editor/collection-previews.ts +16 -1
- package/src/admin/editor/dialogs.tsx +38 -14
- package/src/admin/editor/dnd/drop-target.ts +26 -1
- package/src/admin/editor/edited-noun.ts +15 -0
- package/src/admin/editor/editor-chrome.tsx +108 -7
- package/src/admin/editor/editor-commands.ts +15 -1
- package/src/admin/editor/editor-css.ts +75 -22
- package/src/admin/editor/element-chrome.ts +21 -11
- package/src/admin/editor/feature-css.ts +45 -13
- package/src/admin/editor/icons/IconLibraryDialog.tsx +52 -11
- package/src/admin/editor/icons/library.ts +1 -1
- package/src/admin/editor/icons/use-icon-library.ts +5 -2
- package/src/admin/editor/ime.ts +29 -0
- package/src/admin/editor/palette-items.ts +10 -3
- package/src/admin/editor/panels/AddPanel.tsx +35 -10
- package/src/admin/editor/panels/ClassesSection.tsx +18 -7
- package/src/admin/editor/panels/ColorControl.tsx +135 -27
- package/src/admin/editor/panels/ConditionsEditor.tsx +52 -26
- package/src/admin/editor/panels/ElementPanel.tsx +134 -24
- package/src/admin/editor/panels/LayersPanel.tsx +68 -22
- package/src/admin/editor/panels/PageSettings.tsx +66 -35
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +170 -32
- package/src/admin/editor/panels/TokenScales.tsx +76 -36
- package/src/admin/editor/panels/TriggerSettings.tsx +50 -12
- package/src/admin/editor/panels/TriggersEditor.tsx +2 -1
- package/src/admin/editor/panels/VariableSection.tsx +53 -21
- package/src/admin/editor/panels/color-space.ts +9 -3
- package/src/admin/editor/panels/settings/AdvancedFields.tsx +12 -2
- package/src/admin/editor/panels/settings/AudienceEditor.tsx +51 -35
- package/src/admin/editor/panels/settings/BackgroundControls.tsx +55 -11
- package/src/admin/editor/panels/settings/BackgroundFill.tsx +3 -2
- package/src/admin/editor/panels/settings/BindingsEditor.tsx +15 -18
- package/src/admin/editor/panels/settings/BoxControl.tsx +2 -1
- package/src/admin/editor/panels/settings/ClassChip.tsx +21 -9
- package/src/admin/editor/panels/settings/ClassChipInput.tsx +24 -16
- package/src/admin/editor/panels/settings/DraftTextField.tsx +41 -3
- package/src/admin/editor/panels/settings/EffectsControls.tsx +38 -14
- package/src/admin/editor/panels/settings/FieldBindControl.tsx +46 -28
- package/src/admin/editor/panels/settings/FieldControl.tsx +38 -15
- package/src/admin/editor/panels/settings/FormBindControl.tsx +2 -2
- package/src/admin/editor/panels/settings/HintedSwitch.tsx +33 -0
- package/src/admin/editor/panels/settings/IconControls.tsx +12 -8
- package/src/admin/editor/panels/settings/IconPicker.tsx +2 -0
- package/src/admin/editor/panels/settings/ImageSourcesField.tsx +3 -1
- package/src/admin/editor/panels/settings/ItemList.tsx +15 -2
- package/src/admin/editor/panels/settings/LengthRow.tsx +8 -6
- package/src/admin/editor/panels/settings/MediaPicker.tsx +274 -20
- package/src/admin/editor/panels/settings/MotionControl.tsx +28 -15
- package/src/admin/editor/panels/settings/NumberRow.tsx +9 -3
- package/src/admin/editor/panels/settings/PanelSelect.tsx +50 -0
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +25 -18
- package/src/admin/editor/panels/settings/RequiredFieldsNotice.tsx +141 -0
- package/src/admin/editor/panels/settings/StyleRow.tsx +10 -3
- package/src/admin/editor/panels/settings/StyleSources.tsx +4 -1
- package/src/admin/editor/panels/settings/VariantEditor.tsx +10 -1
- package/src/admin/editor/panels/settings/box-link-name.ts +6 -2
- package/src/admin/editor/panels/settings/class-suggest.ts +7 -7
- package/src/admin/editor/panels/settings/query-style.ts +38 -9
- package/src/admin/editor/panels/settings/svg-images.ts +13 -0
- package/src/admin/editor/panels/site-list.tsx +20 -6
- package/src/admin/editor/panels/variable-values.ts +25 -4
- package/src/admin/editor/restore-deleted.ts +21 -2
- package/src/admin/editor/section-templates.ts +81 -12
- package/src/admin/editor/shortcuts.ts +17 -2
- package/src/admin/editor/store.ts +14 -3
- package/src/admin/editor/useEditorCommands.ts +61 -15
- package/src/admin/editor/useEditorData.ts +4 -2
- package/src/admin/editor/useEditorShortcuts.ts +17 -7
- package/src/admin/editor/useNodeActions.ts +61 -6
- package/src/admin/editor/useSave.ts +22 -7
- package/src/admin/forms-api.ts +2 -0
- package/src/admin/image-editor/BlurFocus.tsx +112 -0
- package/src/admin/image-editor/Canvas.tsx +261 -0
- package/src/admin/image-editor/CropOverlay.tsx +390 -0
- package/src/admin/image-editor/CurvesPanel.tsx +395 -0
- package/src/admin/image-editor/ExportDialog.tsx +384 -0
- package/src/admin/image-editor/ImageEditButton.tsx +83 -0
- package/src/admin/image-editor/ImageEditorDialog.tsx +828 -0
- package/src/admin/image-editor/MetadataPanel.tsx +194 -0
- package/src/admin/image-editor/announce.tsx +65 -0
- package/src/admin/image-editor/crop-geometry.ts +162 -0
- package/src/admin/image-editor/curve-math.ts +177 -0
- package/src/admin/image-editor/data-url-fetch.ts +59 -0
- package/src/admin/image-editor/engine.ts +55 -0
- package/src/admin/image-editor/exif.ts +82 -0
- package/src/admin/image-editor/flatten.ts +54 -0
- package/src/admin/image-editor/gpu-fit.ts +81 -0
- package/src/admin/image-editor/image-editor-css.ts +400 -0
- package/src/admin/image-editor/load.ts +116 -0
- package/src/admin/image-editor/panels.tsx +287 -0
- package/src/admin/image-editor/parts.tsx +614 -0
- package/src/admin/image-editor/save.ts +141 -0
- package/src/admin/image-editor/tone-panels.tsx +338 -0
- package/src/admin/image-editor/tools.ts +59 -0
- package/src/admin/image-editor/worker.ts +111 -0
- package/src/admin/media-api.ts +114 -3
- package/src/admin/pages/AgentsPage.tsx +138 -27
- package/src/admin/pages/CreateDialog.tsx +97 -30
- package/src/admin/pages/NewPageDialog.tsx +21 -3
- package/src/admin/pages/NewThemePartDialog.tsx +11 -3
- package/src/admin/pages/PageList.tsx +14 -6
- package/src/admin/pages/SetupShell.tsx +28 -12
- package/src/admin/pages/ThemePartList.tsx +27 -7
- package/src/admin/pages/list-kit.tsx +106 -24
- package/src/admin/search.ts +15 -0
- package/src/admin/setup/useSetupStatus.ts +1 -1
- package/src/admin/theme-api.ts +13 -3
- package/src/admin/ui.ts +78 -22
- package/src/astro/EmVBPage.astro +11 -2
- package/src/astro/floats/runtime.ts +21 -0
- package/src/astro/menu/runtime.ts +34 -1
- package/src/astro/popups/runtime.ts +33 -3
- package/src/astro/render.ts +6 -0
- package/src/astro/resolve-theme.ts +67 -14
- package/src/astro/resolve.ts +9 -1
- package/src/astro/tabs/runtime.ts +12 -0
- package/src/astro/theme-posts.ts +2 -2
- package/src/astro/visitor.ts +6 -3
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +171 -24
- package/src/core/arrange.ts +29 -6
- package/src/core/audience/rules.ts +5 -1
- package/src/core/audience/variants.ts +29 -3
- package/src/core/clipboard.ts +7 -0
- package/src/core/css/generate.ts +31 -6
- package/src/core/data/bindings.ts +19 -6
- package/src/core/design/classes.ts +20 -9
- package/src/core/design/diff.ts +9 -1
- package/src/core/design/merge.ts +93 -3
- package/src/core/design/tokens.ts +16 -2
- package/src/core/design/transfer.ts +46 -8
- package/src/core/design/variables.ts +32 -10
- package/src/core/elements/dynamic-elements.ts +53 -6
- package/src/core/elements/form-elements.ts +68 -30
- package/src/core/elements/index.ts +83 -38
- package/src/core/elements/menu.ts +37 -19
- package/src/core/elements/plain-text.ts +2 -2
- package/src/core/elements/select-prompt.ts +3 -0
- package/src/core/elements/svg-ids.ts +39 -0
- package/src/core/forms/binding.ts +190 -2
- package/src/core/forms/definition.ts +72 -0
- package/src/core/history/diff.ts +49 -4
- package/src/core/icons/catalog.ts +3 -2
- package/src/core/image-edit/schema.ts +155 -0
- package/src/core/image-edit/summary.ts +61 -0
- package/src/core/index.ts +29 -1
- package/src/core/limits.ts +21 -0
- package/src/core/migrate/index.ts +3 -1
- package/src/core/perf/meter.ts +51 -8
- package/src/core/recipes/index.ts +5 -4
- package/src/core/render/context.ts +8 -0
- package/src/core/render/dynamic-post.ts +71 -13
- package/src/core/render/extras.ts +77 -4
- package/src/core/render/form.ts +164 -12
- package/src/core/render/index.ts +179 -22
- package/src/core/render/loop.ts +43 -7
- package/src/core/render/pagination.ts +18 -4
- package/src/core/render/section.ts +27 -0
- package/src/core/render/tabs.ts +12 -3
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +15 -2
- package/src/core/sanitize/embed-url.ts +42 -5
- package/src/core/sanitize/url.ts +2 -1
- package/src/core/schema/layout.ts +26 -7
- package/src/core/share/link.ts +5 -2
- package/src/core/stable-json.ts +15 -0
- package/src/core/stats.ts +2 -1
- package/src/core/theme/conditions.ts +3 -1
- package/src/core/theme/dynamic.ts +57 -23
- package/src/core/theme/float.ts +9 -2
- package/src/core/theme/pagination.ts +57 -10
- package/src/core/theme/popup-markup.ts +23 -5
- package/src/core/theme/popup-rules.ts +11 -5
- package/src/core/theme/triggers.ts +3 -2
- package/src/core/tree-ops.ts +27 -0
- package/src/mcp/ports.ts +8 -1
- package/src/mcp/rate-limit.ts +2 -1
- package/src/mcp/read.ts +82 -3
- package/src/mcp/refs.ts +18 -0
- package/src/mcp/tools.ts +1 -1
- package/src/mcp/write.ts +271 -25
- package/src/server/agent-settings.ts +29 -4
- package/src/server/hooks.ts +5 -3
- package/src/server/icon-routes.ts +33 -9
- package/src/server/mcp-routes.ts +74 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, Input, Select } from "@cloudflare/kumo";
|
|
1
|
+
import { Button, Input, Loader, Select } from "@cloudflare/kumo";
|
|
2
2
|
import { PlusIcon } from "@phosphor-icons/react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import {
|
|
@@ -22,8 +22,15 @@ import {
|
|
|
22
22
|
toHex,
|
|
23
23
|
} from "./color-space.ts";
|
|
24
24
|
import { InlineError } from "./inline-error.tsx";
|
|
25
|
-
import { pickerHex } from "./variable-values.ts";
|
|
25
|
+
import { pickerHex, withPreviousAlpha } from "./variable-values.ts";
|
|
26
|
+
import { isCommitEnter } from "../ime.ts";
|
|
27
|
+
import { useMediaQuery } from "../useMediaQuery.ts";
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* W-673: Kumo's Input `variant="error"` is deprecated (and warns), and its `error` prop would print
|
|
31
|
+
* a second message under our InlineError, so a refused field gets Kumo's error ring as classes.
|
|
32
|
+
*/
|
|
33
|
+
const INVALID = " !ring-kumo-danger focus:ring-kumo-danger/50 focus:ring-[1.5px]";
|
|
27
34
|
const HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
28
35
|
const NONE = "__none__";
|
|
29
36
|
const CUSTOM = "__custom__";
|
|
@@ -39,7 +46,7 @@ function Swatch({ color }: { color: string }) {
|
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
const uniqueId = (design: DesignSystem, name: string) => {
|
|
42
|
-
const base = slugify(name).slice(0, 34) || "color";
|
|
49
|
+
const base = slugify(name).slice(0, 34).replace(/-+$/, "") || "color";
|
|
43
50
|
const taken = new Set(design.variables.colors.map((color) => color.id));
|
|
44
51
|
let id = base;
|
|
45
52
|
for (let n = 2; taken.has(id); n++) id = `${base}-${n}`;
|
|
@@ -71,6 +78,17 @@ export function ColorControl({
|
|
|
71
78
|
const colors = design.variables.colors;
|
|
72
79
|
const bound = value && typeof value === "object" ? colors.find((c) => c.id === value.var) : null;
|
|
73
80
|
const [creating, setCreating] = React.useState(false);
|
|
81
|
+
// W-818: Cancel and Create unmount the form, which dropped keyboard focus to the page body.
|
|
82
|
+
// Focus goes back to New variable when the form closes, unless it already moved elsewhere.
|
|
83
|
+
const newVariableRef = React.useRef<HTMLButtonElement>(null);
|
|
84
|
+
const wasCreating = React.useRef(false);
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
const closed = wasCreating.current && !creating;
|
|
87
|
+
wasCreating.current = creating;
|
|
88
|
+
if (!closed) return;
|
|
89
|
+
const active = document.activeElement;
|
|
90
|
+
if (!active || active === document.body) newVariableRef.current?.focus();
|
|
91
|
+
}, [creating]);
|
|
74
92
|
const [customOpen, setCustomOpen] = React.useState(false);
|
|
75
93
|
// The hex an out-of-gamut OKLCH entry was clipped to. It lives here because committing a custom
|
|
76
94
|
// colour remounts CustomColor (W-183).
|
|
@@ -197,6 +215,7 @@ export function ColorControl({
|
|
|
197
215
|
variant="ghost"
|
|
198
216
|
className={BUTTON}
|
|
199
217
|
icon={<PlusIcon aria-hidden="true" />}
|
|
218
|
+
ref={newVariableRef}
|
|
200
219
|
onClick={() => setCreating(true)}
|
|
201
220
|
disabled={variableListFull(design, "color")}
|
|
202
221
|
>
|
|
@@ -250,8 +269,9 @@ function CustomColor({
|
|
|
250
269
|
const el = picker.current;
|
|
251
270
|
if (!el) return;
|
|
252
271
|
const onPicked = () => {
|
|
253
|
-
|
|
254
|
-
|
|
272
|
+
const picked = withPreviousAlpha(el.value, value);
|
|
273
|
+
setDraft(picked);
|
|
274
|
+
commit(picked);
|
|
255
275
|
};
|
|
256
276
|
el.addEventListener("change", onPicked);
|
|
257
277
|
return () => el.removeEventListener("change", onPicked);
|
|
@@ -261,15 +281,14 @@ function CustomColor({
|
|
|
261
281
|
<div className="emvb-custom-color-row">
|
|
262
282
|
<Input
|
|
263
283
|
label="Custom color"
|
|
264
|
-
className={`${FIELD} emvb-mono`}
|
|
284
|
+
className={`${FIELD} emvb-mono${error?.field === "hex" ? INVALID : ""}`}
|
|
265
285
|
placeholder="#1a2b3c"
|
|
266
286
|
value={draft}
|
|
267
|
-
variant={error?.field === "hex" ? "error" : undefined}
|
|
268
287
|
aria-invalid={error?.field === "hex" ? true : undefined}
|
|
269
288
|
onChange={(event) => setDraft(event.target.value)}
|
|
270
289
|
onBlur={() => commit(draft)}
|
|
271
290
|
onKeyDown={(event) => {
|
|
272
|
-
if (event
|
|
291
|
+
if (isCommitEnter(event)) commit(draft);
|
|
273
292
|
}}
|
|
274
293
|
/>
|
|
275
294
|
<input
|
|
@@ -278,7 +297,7 @@ function CustomColor({
|
|
|
278
297
|
aria-label={`Pick ${label.toLowerCase()}`}
|
|
279
298
|
ref={picker}
|
|
280
299
|
value={pickerHex(HEX.test(draft) ? draft : value || "#000000")}
|
|
281
|
-
onChange={(event) => setDraft(event.target.value)}
|
|
300
|
+
onChange={(event) => setDraft(withPreviousAlpha(event.target.value, value))}
|
|
282
301
|
/>
|
|
283
302
|
</div>
|
|
284
303
|
{error?.field === "hex" && <InlineError>{error.message}</InlineError>}
|
|
@@ -357,17 +376,16 @@ function NotationRow({
|
|
|
357
376
|
<>
|
|
358
377
|
<Input
|
|
359
378
|
label={label}
|
|
360
|
-
className={`${FIELD} emvb-mono`}
|
|
379
|
+
className={`${FIELD} emvb-mono${error ? INVALID : ""}`}
|
|
361
380
|
placeholder={placeholder}
|
|
362
381
|
value={draft}
|
|
363
|
-
variant={error ? "error" : undefined}
|
|
364
382
|
aria-invalid={error ? true : undefined}
|
|
365
383
|
onChange={(event) => setDraft(event.target.value)}
|
|
366
384
|
onBlur={() => {
|
|
367
385
|
if (draft.trim() !== text) onCommit(draft);
|
|
368
386
|
}}
|
|
369
387
|
onKeyDown={(event) => {
|
|
370
|
-
if (event
|
|
388
|
+
if (isCommitEnter(event)) onCommit(draft);
|
|
371
389
|
}}
|
|
372
390
|
/>
|
|
373
391
|
{error && <InlineError>{error}</InlineError>}
|
|
@@ -386,7 +404,10 @@ function VariableValue({
|
|
|
386
404
|
}) {
|
|
387
405
|
const [draft, setDraft] = React.useState(value);
|
|
388
406
|
const [error, setError] = React.useState<string | null>(null);
|
|
407
|
+
const [phase, setPhase] = React.useState<"idle" | "saving" | "saved">("idle");
|
|
408
|
+
const pending = React.useRef(false);
|
|
389
409
|
const commit = async () => {
|
|
410
|
+
if (pending.current) return;
|
|
390
411
|
const hex = hexInput(draft);
|
|
391
412
|
if (hex === value) return;
|
|
392
413
|
if (!hex) {
|
|
@@ -395,30 +416,53 @@ function VariableValue({
|
|
|
395
416
|
}
|
|
396
417
|
setError(null);
|
|
397
418
|
setDraft(hex);
|
|
419
|
+
pending.current = true;
|
|
420
|
+
setPhase("saving");
|
|
398
421
|
try {
|
|
399
422
|
await onCommit(hex);
|
|
423
|
+
setPhase("saved");
|
|
400
424
|
} catch (failure) {
|
|
401
425
|
setError(errorText(failure));
|
|
426
|
+
setPhase("idle");
|
|
427
|
+
} finally {
|
|
428
|
+
pending.current = false;
|
|
402
429
|
}
|
|
403
430
|
};
|
|
404
431
|
return (
|
|
405
432
|
<>
|
|
406
433
|
<Input
|
|
407
434
|
label={`${name} value`}
|
|
408
|
-
className={`${FIELD} emvb-mono`}
|
|
435
|
+
className={`${FIELD} emvb-mono${error ? INVALID : ""}`}
|
|
409
436
|
value={draft}
|
|
410
|
-
|
|
411
|
-
|
|
437
|
+
readOnly={phase === "saving"}
|
|
438
|
+
aria-busy={phase === "saving"}
|
|
439
|
+
aria-invalid={error ? true : undefined}
|
|
440
|
+
onChange={(event) => {
|
|
441
|
+
setDraft(event.target.value);
|
|
442
|
+
setPhase("idle");
|
|
443
|
+
}}
|
|
412
444
|
onBlur={() => void commit()}
|
|
413
445
|
onKeyDown={(event) => {
|
|
414
|
-
if (event
|
|
446
|
+
if (isCommitEnter(event)) void commit();
|
|
415
447
|
}}
|
|
416
448
|
/>
|
|
417
|
-
|
|
418
|
-
<
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
449
|
+
<div className="emvb-variable-value-feedback">
|
|
450
|
+
<p
|
|
451
|
+
className="emvb-helper"
|
|
452
|
+
role="status"
|
|
453
|
+
aria-label="Color variable status"
|
|
454
|
+
aria-live="polite"
|
|
455
|
+
>
|
|
456
|
+
{error
|
|
457
|
+
? ""
|
|
458
|
+
: phase === "saving"
|
|
459
|
+
? "Saving color variable…"
|
|
460
|
+
: phase === "saved"
|
|
461
|
+
? "Color variable saved. Publish styles to make it live."
|
|
462
|
+
: "Style changes stay unpublished until you publish styles."}
|
|
463
|
+
</p>
|
|
464
|
+
{error && <InlineError>{error}</InlineError>}
|
|
465
|
+
</div>
|
|
422
466
|
</>
|
|
423
467
|
);
|
|
424
468
|
}
|
|
@@ -433,24 +477,55 @@ function NewVariable({
|
|
|
433
477
|
const [name, setName] = React.useState("");
|
|
434
478
|
const [hex, setHex] = React.useState("");
|
|
435
479
|
const [error, setError] = React.useState<string | null>(null);
|
|
480
|
+
// W-820: a refused name or value focuses that field and marks it invalid, like W-813.
|
|
481
|
+
const [invalid, setInvalid] = React.useState<"name" | "value" | null>(null);
|
|
482
|
+
const nameRef = React.useRef<HTMLInputElement>(null);
|
|
483
|
+
const valueRef = React.useRef<HTMLInputElement>(null);
|
|
436
484
|
const [busy, setBusy] = React.useState(false);
|
|
485
|
+
const pending = React.useRef(false);
|
|
486
|
+
const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
487
|
+
const refuse = (field: "name" | "value", message: string) => {
|
|
488
|
+
setError(message);
|
|
489
|
+
setInvalid(field);
|
|
490
|
+
(field === "name" ? nameRef : valueRef).current?.focus();
|
|
491
|
+
};
|
|
437
492
|
const create = async () => {
|
|
438
|
-
if (
|
|
493
|
+
if (pending.current) return;
|
|
494
|
+
if (!name.trim()) return refuse("name", "Enter a name for the variable.");
|
|
439
495
|
const typed = hexInput(hex);
|
|
440
|
-
if (!typed) return
|
|
496
|
+
if (!typed) return refuse("value", BAD_HEX);
|
|
441
497
|
setError(null);
|
|
498
|
+
setInvalid(null);
|
|
499
|
+
pending.current = true;
|
|
442
500
|
setBusy(true);
|
|
443
501
|
try {
|
|
444
502
|
await onCreate(name.trim(), typed);
|
|
445
503
|
} catch (failure) {
|
|
446
504
|
setError(errorText(failure));
|
|
505
|
+
} finally {
|
|
506
|
+
pending.current = false;
|
|
447
507
|
setBusy(false);
|
|
448
508
|
}
|
|
449
509
|
};
|
|
450
510
|
return (
|
|
451
|
-
<div
|
|
511
|
+
<div
|
|
512
|
+
className="emvb-new-variable"
|
|
513
|
+
data-emvb-form="new-variable"
|
|
514
|
+
onKeyDown={(event) => {
|
|
515
|
+
// W-821: Escape cancels the form like Cancel (W-818 returns focus to New variable).
|
|
516
|
+
// The editor's own Escape must not also run; a pending create can't be cancelled.
|
|
517
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
518
|
+
event.preventDefault();
|
|
519
|
+
event.stopPropagation();
|
|
520
|
+
if (!pending.current) onCancel();
|
|
521
|
+
}}
|
|
522
|
+
>
|
|
452
523
|
<Input
|
|
453
524
|
label="Variable name"
|
|
525
|
+
ref={nameRef}
|
|
526
|
+
aria-invalid={invalid === "name" || undefined}
|
|
527
|
+
readOnly={busy}
|
|
528
|
+
aria-disabled={busy}
|
|
454
529
|
className={FIELD}
|
|
455
530
|
value={name}
|
|
456
531
|
autoFocus
|
|
@@ -458,20 +533,53 @@ function NewVariable({
|
|
|
458
533
|
/>
|
|
459
534
|
<Input
|
|
460
535
|
label="Value"
|
|
536
|
+
ref={valueRef}
|
|
537
|
+
aria-invalid={invalid === "value" || undefined}
|
|
538
|
+
readOnly={busy}
|
|
539
|
+
aria-disabled={busy}
|
|
461
540
|
className={`${FIELD} emvb-mono`}
|
|
462
541
|
placeholder="#1a2b3c"
|
|
463
542
|
value={hex}
|
|
464
543
|
onChange={(event) => setHex(event.target.value)}
|
|
465
544
|
onKeyDown={(event) => {
|
|
466
|
-
if (event
|
|
545
|
+
if (isCommitEnter(event)) void create();
|
|
467
546
|
}}
|
|
468
547
|
/>
|
|
469
548
|
{error && <InlineError>{error}</InlineError>}
|
|
549
|
+
<p
|
|
550
|
+
className="emvb-helper emvb-new-variable-status"
|
|
551
|
+
role="status"
|
|
552
|
+
aria-label="Color variable status"
|
|
553
|
+
aria-live="polite"
|
|
554
|
+
>
|
|
555
|
+
{busy ? "Creating color variable…" : ""}
|
|
556
|
+
</p>
|
|
470
557
|
<div className="emvb-row-actions">
|
|
471
|
-
|
|
558
|
+
{/* W-822: locked, not disabled, while creating, so keyboard focus stays in the form. */}
|
|
559
|
+
<Button
|
|
560
|
+
variant="secondary"
|
|
561
|
+
className={BUTTON}
|
|
562
|
+
aria-disabled={busy}
|
|
563
|
+
onClick={() => {
|
|
564
|
+
if (!pending.current) onCancel();
|
|
565
|
+
}}
|
|
566
|
+
>
|
|
472
567
|
Cancel
|
|
473
568
|
</Button>
|
|
474
|
-
<Button
|
|
569
|
+
<Button
|
|
570
|
+
variant="secondary"
|
|
571
|
+
className={BUTTON}
|
|
572
|
+
icon={
|
|
573
|
+
busy && !reducedMotion ? (
|
|
574
|
+
<Loader size={14} />
|
|
575
|
+
) : (
|
|
576
|
+
<PlusIcon size={14} aria-hidden="true" />
|
|
577
|
+
)
|
|
578
|
+
}
|
|
579
|
+
aria-disabled={busy}
|
|
580
|
+
aria-busy={busy}
|
|
581
|
+
onClick={() => void create()}
|
|
582
|
+
>
|
|
475
583
|
Create variable
|
|
476
584
|
</Button>
|
|
477
585
|
</div>
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
type ConditionRule,
|
|
7
7
|
type ConditionsDoc,
|
|
8
8
|
} from "../../../core/index.ts";
|
|
9
|
-
import {
|
|
9
|
+
import { conditionRuleLabel } from "../../theme-api.ts";
|
|
10
|
+
import { BUTTON } from "../../ui.ts";
|
|
11
|
+
import { PanelSelect } from "./settings/PanelSelect.tsx";
|
|
10
12
|
|
|
11
13
|
type Props = {
|
|
12
14
|
conditions: ConditionsDoc | undefined;
|
|
@@ -18,6 +20,8 @@ const GROUP_OPTIONS = [
|
|
|
18
20
|
{ value: "singular:front", label: "Front page", group: "singular", name: "front" },
|
|
19
21
|
{ value: "singular:all", label: "All singular", group: "singular", name: "all" },
|
|
20
22
|
{ value: "singular:not_found", label: "404 page", group: "singular", name: "not_found" },
|
|
23
|
+
// W-694: the Archive part's default rule; the menu showed it as "Entire site".
|
|
24
|
+
{ value: "archive:all", label: "All archives", group: "archive", name: "all" },
|
|
21
25
|
{
|
|
22
26
|
value: "singular:collection:pages",
|
|
23
27
|
label: "Pages (all)",
|
|
@@ -63,6 +67,22 @@ const GROUP_OPTIONS = [
|
|
|
63
67
|
},
|
|
64
68
|
] as const;
|
|
65
69
|
|
|
70
|
+
/** The menu value that keeps a rule the menu can't build (one entry, one term, another collection). */
|
|
71
|
+
const CURRENT_RULE = "current";
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The menu value for a rule: its option, or CURRENT_RULE when no option builds it exactly.
|
|
75
|
+
* W-694: such rules (from MCP, an import or an older EmVB) showed as "Entire site", and touching
|
|
76
|
+
* the menu replaced them; they now show their Theme Builder label, e.g. "Tag: news".
|
|
77
|
+
*/
|
|
78
|
+
function menuValue(rule: ConditionRule): string {
|
|
79
|
+
const value = optionValue(rule);
|
|
80
|
+
const option = GROUP_OPTIONS.find((o) => o.value === value);
|
|
81
|
+
if (!option) return CURRENT_RULE;
|
|
82
|
+
const expected = "args" in option ? Object.keys(option.args).length : 0;
|
|
83
|
+
return Object.keys(rule.args).length === expected ? value : CURRENT_RULE;
|
|
84
|
+
}
|
|
85
|
+
|
|
66
86
|
export function optionValue(rule: ConditionRule): string {
|
|
67
87
|
if (rule.group === "singular" && rule.name === "collection") {
|
|
68
88
|
return `singular:collection:${String(rule.args["collection"] ?? "")}`;
|
|
@@ -130,36 +150,39 @@ export function ConditionsEditor({ conditions, onChange }: Props) {
|
|
|
130
150
|
<ul className="emvb-condition-list">
|
|
131
151
|
{doc.rules.map((rule) => (
|
|
132
152
|
<li key={rule.id} className="emvb-condition-row" data-emvb-condition={rule.id}>
|
|
133
|
-
<
|
|
153
|
+
<PanelSelect
|
|
134
154
|
className="emvb-condition-op"
|
|
135
|
-
|
|
155
|
+
label="Include or exclude"
|
|
136
156
|
value={rule.op}
|
|
137
|
-
|
|
138
|
-
|
|
157
|
+
options={[
|
|
158
|
+
{ value: "include", label: "Include" },
|
|
159
|
+
{ value: "exclude", label: "Exclude" },
|
|
160
|
+
]}
|
|
161
|
+
onChange={(value) =>
|
|
162
|
+
update(rule.id, { op: value === "exclude" ? "exclude" : "include" })
|
|
139
163
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
164
|
+
/>
|
|
165
|
+
<PanelSelect
|
|
166
|
+
className="emvb-condition-where"
|
|
167
|
+
label="Where"
|
|
168
|
+
value={menuValue(rule)}
|
|
169
|
+
options={[
|
|
170
|
+
...(menuValue(rule) === CURRENT_RULE
|
|
171
|
+
? [{ value: CURRENT_RULE, label: conditionRuleLabel(rule) }]
|
|
172
|
+
: []),
|
|
173
|
+
...GROUP_OPTIONS.map((option) => ({ value: option.value, label: option.label })),
|
|
174
|
+
]}
|
|
175
|
+
onChange={(value) => {
|
|
176
|
+
if (value === CURRENT_RULE) return;
|
|
177
|
+
update(rule.id, ruleFromOption(value, rule.op, rule.id));
|
|
151
178
|
}}
|
|
152
|
-
|
|
153
|
-
{GROUP_OPTIONS.map((option) => (
|
|
154
|
-
<option key={option.value} value={option.value}>
|
|
155
|
-
{option.label}
|
|
156
|
-
</option>
|
|
157
|
-
))}
|
|
158
|
-
</select>
|
|
179
|
+
/>
|
|
159
180
|
<Button
|
|
160
181
|
type="button"
|
|
161
182
|
variant="ghost"
|
|
162
|
-
|
|
183
|
+
shape="square"
|
|
184
|
+
// W-767: the 28 px icon button its grid column expects; the text-button size overflowed.
|
|
185
|
+
className="emvb-icon-btn"
|
|
163
186
|
aria-label="Remove condition"
|
|
164
187
|
icon={<TrashIcon aria-hidden="true" />}
|
|
165
188
|
onClick={() => remove(rule.id)}
|
|
@@ -167,6 +190,7 @@ export function ConditionsEditor({ conditions, onChange }: Props) {
|
|
|
167
190
|
</li>
|
|
168
191
|
))}
|
|
169
192
|
</ul>
|
|
193
|
+
{/* UX-051: sentence case; the plus says "add", so both fit on one row at 264 px. */}
|
|
170
194
|
<div className="emvb-condition-actions">
|
|
171
195
|
<Button
|
|
172
196
|
type="button"
|
|
@@ -176,8 +200,9 @@ export function ConditionsEditor({ conditions, onChange }: Props) {
|
|
|
176
200
|
disabled={full}
|
|
177
201
|
title={full ? fullReason : undefined}
|
|
178
202
|
onClick={() => add("include")}
|
|
203
|
+
aria-label="Add include rule"
|
|
179
204
|
>
|
|
180
|
-
|
|
205
|
+
Include
|
|
181
206
|
</Button>
|
|
182
207
|
<Button
|
|
183
208
|
type="button"
|
|
@@ -187,8 +212,9 @@ export function ConditionsEditor({ conditions, onChange }: Props) {
|
|
|
187
212
|
disabled={full}
|
|
188
213
|
title={full ? fullReason : undefined}
|
|
189
214
|
onClick={() => add("exclude")}
|
|
215
|
+
aria-label="Add exclude rule"
|
|
190
216
|
>
|
|
191
|
-
|
|
217
|
+
Exclude
|
|
192
218
|
</Button>
|
|
193
219
|
</div>
|
|
194
220
|
{full && (
|
|
@@ -12,7 +12,11 @@ import { ELEMENT_NAMES, elementIcon } from "../element-chrome.ts";
|
|
|
12
12
|
import { indexLayout } from "../../../core/tree-ops.ts";
|
|
13
13
|
import type { ThemePartType } from "../../../core/theme/part-types.ts";
|
|
14
14
|
import { sharedPartH1 } from "./settings/heading-warning.ts";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
HELD_BACK_BOX_LINK_NOTE,
|
|
17
|
+
UNNAMED_BOX_LINK_NOTE,
|
|
18
|
+
unnamedBoxLink,
|
|
19
|
+
} from "./settings/box-link-name.ts";
|
|
16
20
|
import { imageAltNote } from "./settings/image-alt.ts";
|
|
17
21
|
import { loopContextNote } from "./settings/loop-context.ts";
|
|
18
22
|
import { buttonUrlNote } from "./settings/button-url.ts";
|
|
@@ -25,6 +29,7 @@ import {
|
|
|
25
29
|
localStylesToClass,
|
|
26
30
|
localToClassRefusal,
|
|
27
31
|
isFormNode,
|
|
32
|
+
loneAbTests,
|
|
28
33
|
type DesignSystem,
|
|
29
34
|
type ElementDescriptor,
|
|
30
35
|
type Layout,
|
|
@@ -41,6 +46,7 @@ import {
|
|
|
41
46
|
STYLE_STATES,
|
|
42
47
|
type StyleProps,
|
|
43
48
|
type StyleStates,
|
|
49
|
+
boxLinkHeldBack,
|
|
44
50
|
} from "../../../core/index.ts";
|
|
45
51
|
import { applyStylePatch } from "./style-target.ts";
|
|
46
52
|
import { FieldControl } from "./settings/FieldControl.tsx";
|
|
@@ -82,6 +88,22 @@ const enclosingFormId = (layout: Layout, nodeId: string): string | undefined =>
|
|
|
82
88
|
return undefined;
|
|
83
89
|
};
|
|
84
90
|
|
|
91
|
+
const GRID_ITEM_KEYS = new Set<string>([
|
|
92
|
+
"gridColumnSpan",
|
|
93
|
+
"gridColumnStart",
|
|
94
|
+
"gridRowSpan",
|
|
95
|
+
"gridRowStart",
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
/** Whether the node sits directly in a box that lays its children out on a grid. */
|
|
99
|
+
const inGridParent = (layout: Layout | null | undefined, nodeId: string): boolean => {
|
|
100
|
+
if (!layout) return true;
|
|
101
|
+
const index = indexLayout(layout);
|
|
102
|
+
const parentId = index.parentOf.get(nodeId);
|
|
103
|
+
const parent = parentId ? index.byId.get(parentId) : undefined;
|
|
104
|
+
return parent?.type === "grid" || parent?.type === "loop";
|
|
105
|
+
};
|
|
106
|
+
|
|
85
107
|
const sectionKey = (type: string) => `emvb-style-sections:${type}`;
|
|
86
108
|
|
|
87
109
|
/**
|
|
@@ -269,6 +291,60 @@ function Alert({
|
|
|
269
291
|
);
|
|
270
292
|
}
|
|
271
293
|
|
|
294
|
+
/**
|
|
295
|
+
* UX-028: settings that only matter once another is set stay out of the way
|
|
296
|
+
* until then. A value already stored always shows, so nothing set is ever hidden.
|
|
297
|
+
*/
|
|
298
|
+
const DEPENDS_ON: Readonly<Record<string, string>> = {
|
|
299
|
+
iconPosition: "iconId",
|
|
300
|
+
iconSize: "iconId",
|
|
301
|
+
iconGap: "iconId",
|
|
302
|
+
// UX-072: a new tab needs a link, typed or bound to live data (W-276 drops the target without one).
|
|
303
|
+
newTab: "href",
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/** UX-040: number pairs that read as one setting share a row (X beside Y, width beside height). */
|
|
307
|
+
const PAIRED: Readonly<Record<string, string>> = { focalX: "focalY", width: "height" };
|
|
308
|
+
|
|
309
|
+
function pairFields<F extends { key: string }>(fields: readonly F[]): F[][] {
|
|
310
|
+
const rows: F[][] = [];
|
|
311
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
312
|
+
const field = fields[i] as F;
|
|
313
|
+
const next = fields[i + 1];
|
|
314
|
+
if (next && PAIRED[field.key] === next.key) {
|
|
315
|
+
rows.push([field, next]);
|
|
316
|
+
i += 1;
|
|
317
|
+
} else rows.push([field]);
|
|
318
|
+
}
|
|
319
|
+
return rows;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** UX-071: fields that only apply to some values of another field on the same element. */
|
|
323
|
+
const SHOWN_WHEN: Readonly<
|
|
324
|
+
Record<string, (props: Record<string, unknown>, device: PopupDevice) => boolean>
|
|
325
|
+
> = {
|
|
326
|
+
"loop.columns": (props) => props["display"] === "grid" || props["display"] === "cards",
|
|
327
|
+
"pagination.countText": (props) => props["showCount"] === true,
|
|
328
|
+
// Post Link always links to its post, so its new-tab switch always applies.
|
|
329
|
+
"post-link.newTab": () => true,
|
|
330
|
+
// UX-075: each device's tracks show on that device, as Columns does (W-139).
|
|
331
|
+
"grid.columnTracks": (_props, device) => device === "desktop",
|
|
332
|
+
"grid.columnTracksTablet": (_props, device) => device === "tablet",
|
|
333
|
+
"grid.columnTracksMobile": (_props, device) => device === "mobile",
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
function fieldShown(key: string, node: LayoutNode, device: PopupDevice = "desktop"): boolean {
|
|
337
|
+
const props = node.props as Record<string, unknown>;
|
|
338
|
+
// A stored value always shows, so it can be seen and reset.
|
|
339
|
+
if (props[key] !== undefined) return true;
|
|
340
|
+
const when = SHOWN_WHEN[`${node.type}.${key}`];
|
|
341
|
+
if (when) return when(props, device);
|
|
342
|
+
const parent = DEPENDS_ON[key];
|
|
343
|
+
if (!parent) return true;
|
|
344
|
+
const bound = (node as { bind?: Record<string, unknown> }).bind?.[parent] !== undefined;
|
|
345
|
+
return (props[parent] !== undefined && props[parent] !== "") || bound;
|
|
346
|
+
}
|
|
347
|
+
|
|
272
348
|
/** Right panel with an element selected (IA / W-021): descriptor Content + Style sections. */
|
|
273
349
|
export function ElementPanel(props: Props) {
|
|
274
350
|
const descriptor = ELEMENT_DESCRIPTORS.find((d) => d.type === props.node.type);
|
|
@@ -360,6 +436,7 @@ function KnownElementPanel({
|
|
|
360
436
|
? { ...fromBelow, ...ownInherited }
|
|
361
437
|
: ownInherited;
|
|
362
438
|
const position = positionInEffect(node, design, cls);
|
|
439
|
+
const inGrid = inGridParent(layout, node.id);
|
|
363
440
|
const iconSvg =
|
|
364
441
|
node.type === "icon" && typeof node.props.iconSvg === "string" ? node.props.iconSvg : undefined;
|
|
365
442
|
const strokeAdjustable = React.useMemo(
|
|
@@ -446,13 +523,20 @@ function KnownElementPanel({
|
|
|
446
523
|
{crumbs.map((crumb, index) => (
|
|
447
524
|
<React.Fragment key={crumb.id ?? "page"}>
|
|
448
525
|
{index > 0 && <span aria-hidden="true"> › </span>}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
className="emvb-breadcrumb-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
526
|
+
{index === crumbs.length - 1 ? (
|
|
527
|
+
// UX-065: the element being edited is where you are, not a link back to itself.
|
|
528
|
+
<span className="emvb-breadcrumb-current" aria-current="location">
|
|
529
|
+
{crumb.label}
|
|
530
|
+
</span>
|
|
531
|
+
) : (
|
|
532
|
+
<button
|
|
533
|
+
type="button"
|
|
534
|
+
className="emvb-breadcrumb-part"
|
|
535
|
+
onClick={() => onSelect(crumb.id)}
|
|
536
|
+
>
|
|
537
|
+
{crumb.label}
|
|
538
|
+
</button>
|
|
539
|
+
)}
|
|
456
540
|
</React.Fragment>
|
|
457
541
|
))}
|
|
458
542
|
</nav>
|
|
@@ -481,26 +565,39 @@ function KnownElementPanel({
|
|
|
481
565
|
: "This element has no content settings."}
|
|
482
566
|
</p>
|
|
483
567
|
) : (
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
568
|
+
pairFields(
|
|
569
|
+
descriptor.fields.filter((field) => fieldShown(field.key, node, device)),
|
|
570
|
+
).map((row) => {
|
|
571
|
+
const controls = row.map((field) => (
|
|
572
|
+
<React.Fragment key={field.key}>
|
|
573
|
+
<FieldControl
|
|
574
|
+
field={field}
|
|
575
|
+
node={node}
|
|
576
|
+
onChange={onChange}
|
|
577
|
+
fetcher={fetcher}
|
|
578
|
+
parentFormId={layout ? enclosingFormId(layout, node.id) : undefined}
|
|
579
|
+
duplicateName={
|
|
580
|
+
field.key === "field" && layout ? duplicateFieldName(layout, node.id) : false
|
|
581
|
+
}
|
|
582
|
+
device={device}
|
|
583
|
+
/>
|
|
584
|
+
</React.Fragment>
|
|
585
|
+
));
|
|
586
|
+
return row.length === 2 ? (
|
|
587
|
+
<div className="emvb-field-pair" key={row[0]?.key} data-emvb-field-pair="">
|
|
588
|
+
{controls}
|
|
589
|
+
</div>
|
|
590
|
+
) : (
|
|
591
|
+
controls
|
|
592
|
+
);
|
|
593
|
+
})
|
|
498
594
|
)}
|
|
499
595
|
<BindingsEditor node={node} onChange={onChange} post={SAMPLE_POST} />
|
|
500
596
|
<AudienceEditor node={node} isRoot={layout?.root.id === node.id} onChange={onChange} />
|
|
501
597
|
<VariantEditor
|
|
502
598
|
node={node}
|
|
503
599
|
isRoot={layout?.root.id === node.id}
|
|
600
|
+
lone={Boolean(layout && node.variant && loneAbTests(layout).has(node.variant.test))}
|
|
504
601
|
onChange={onChange}
|
|
505
602
|
onArrange={onArrange}
|
|
506
603
|
/>
|
|
@@ -531,6 +628,11 @@ function KnownElementPanel({
|
|
|
531
628
|
{imageAltNote(node)}
|
|
532
629
|
</p>
|
|
533
630
|
)}
|
|
631
|
+
{boxLinkHeldBack(node) && (
|
|
632
|
+
<p className="emvb-helper" data-emvb-held-back-link>
|
|
633
|
+
{HELD_BACK_BOX_LINK_NOTE}
|
|
634
|
+
</p>
|
|
635
|
+
)}
|
|
534
636
|
{unnamedBoxLink(node) && (
|
|
535
637
|
<p className="emvb-helper" data-emvb-unnamed-link>
|
|
536
638
|
{UNNAMED_BOX_LINK_NOTE}
|
|
@@ -568,8 +670,12 @@ function KnownElementPanel({
|
|
|
568
670
|
onChange={setStyleState}
|
|
569
671
|
/>
|
|
570
672
|
) : (
|
|
571
|
-
|
|
572
|
-
|
|
673
|
+
// UX-063: say which device is being edited, as states say "Editing Hover".
|
|
674
|
+
<p className="emvb-helper" data-emvb-device-note={device}>
|
|
675
|
+
{device === "mobile"
|
|
676
|
+
? "Editing Mobile. These styles override Tablet and Desktop."
|
|
677
|
+
: "Editing Tablet. These styles override Desktop."}{" "}
|
|
678
|
+
Hover, Focus and Active are set on Desktop and apply on every device.
|
|
573
679
|
</p>
|
|
574
680
|
)}
|
|
575
681
|
{!cls && <StyleSources node={node} design={design} device={device} state={styleState} />}
|
|
@@ -597,6 +703,10 @@ function KnownElementPanel({
|
|
|
597
703
|
const keys = keysFor(node.type, id, style, position).filter(
|
|
598
704
|
(key) =>
|
|
599
705
|
(styleState === "normal" || !NORMAL_ONLY_KEYS.has(key)) &&
|
|
706
|
+
// UX-034: spans and starts only place an element inside a Grid (or a Loop's grid).
|
|
707
|
+
(!GRID_ITEM_KEYS.has(key) ||
|
|
708
|
+
inGrid ||
|
|
709
|
+
(style as Record<string, unknown> | undefined)?.[key] !== undefined) &&
|
|
600
710
|
// W-237: Stroke width only for stroke-drawn icons (or once set, so it can be reset).
|
|
601
711
|
(key !== "iconStrokeWidth" ||
|
|
602
712
|
strokeAdjustable ||
|