@motion-proto/live-tokens 0.10.0 → 0.11.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/package.json +1 -1
- package/src/editor/component-editor/CardEditor.svelte +2 -0
- package/src/editor/component-editor/scaffolding/ShadowBackdrop.svelte +10 -1
- package/src/editor/core/store/editorRenderer.ts +1 -4
- package/src/editor/core/store/editorStore.ts +5 -9
- package/src/editor/core/store/editorTypes.ts +6 -13
- package/src/editor/core/themes/migrations/2026-05-13-primary-to-brand.ts +2 -29
- package/src/editor/core/themes/migrations/2026-05-26-drop-overlay-extra-stops.ts +46 -0
- package/src/editor/core/themes/migrations/index.ts +6 -0
- package/src/editor/core/themes/slices/overlays.ts +44 -75
- package/src/editor/ui/SurfacesTab.svelte +3 -7
- package/src/editor/ui/UIPaddingSelector.svelte +2 -2
- package/src/editor/ui/UIPaletteSelector.svelte +151 -36
- package/src/editor/ui/{UIRelinkConfirmPopover.svelte → UIRelinkConfirmDialog.svelte} +107 -75
- package/src/editor/ui/UITokenSelector.svelte +15 -2
- package/src/editor/ui/sections/OverlaysSection.svelte +107 -540
- package/src/system/components/Card.svelte +2 -1
- package/src/system/components/ImageLightbox.svelte +1 -1
- package/src/system/components/TabBar.svelte +1 -1
- package/src/system/styles/tokens.css +5 -5
- package/src/system/styles/tokens.generated.css +31 -4
|
@@ -41,7 +41,14 @@
|
|
|
41
41
|
* rendered disabled and not clickable. Out-of-family already-set
|
|
42
42
|
* choices still surface in the trigger meta. */
|
|
43
43
|
familyFilter?: string | null;
|
|
44
|
+
/** When false, omit the "None" (transparent) option from the family list.
|
|
45
|
+
* Slots that must always paint something (e.g. overlay backdrops) opt
|
|
46
|
+
* out — picking None would just degenerate to opacity 0. */
|
|
47
|
+
showNone?: boolean;
|
|
44
48
|
onchange?: () => void;
|
|
49
|
+
/** Forwarded to UITokenSelector — when set, writes route through this
|
|
50
|
+
* callback instead of the DOM. See UITokenSelector.onwrite. */
|
|
51
|
+
onwrite?: (value: string | null) => void;
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
let {
|
|
@@ -51,7 +58,9 @@
|
|
|
51
58
|
disabled = false,
|
|
52
59
|
selectionsLocked = false,
|
|
53
60
|
familyFilter = null,
|
|
61
|
+
showNone = true,
|
|
54
62
|
onchange,
|
|
63
|
+
onwrite,
|
|
55
64
|
}: Props = $props();
|
|
56
65
|
|
|
57
66
|
type Category = 'palette' | 'surface' | 'border' | 'text';
|
|
@@ -137,6 +146,9 @@
|
|
|
137
146
|
let chosenFamily = $state<string | null>(null);
|
|
138
147
|
let chosenStep = $state<string | null>(null);
|
|
139
148
|
let chosenNone = $state(false);
|
|
149
|
+
/** Picked one of the invariants. Bypasses category/family/step — these are
|
|
150
|
+
* not part of any ramp and always resolve to pure white/black. */
|
|
151
|
+
let chosenStatic = $state<'white' | 'black' | null>(null);
|
|
140
152
|
let chosenGradient = $state<string | null>(null);
|
|
141
153
|
/** Per-slot angle override on the chosen linear gradient. Null means
|
|
142
154
|
* "no override" — the slot writes `var(--gradient-N)` and inherits the
|
|
@@ -243,6 +255,14 @@
|
|
|
243
255
|
return { inner: m[1], opacity: parseInt(m[2]) };
|
|
244
256
|
}
|
|
245
257
|
|
|
258
|
+
function parseStatic(raw: string): { name: 'white' | 'black'; opacity: number } | null {
|
|
259
|
+
const direct = raw.match(/^var\(--color-(white|black)\)$/);
|
|
260
|
+
if (direct) return { name: direct[1] as 'white' | 'black', opacity: 100 };
|
|
261
|
+
const wrapped = raw.match(/^color-mix\(in srgb,\s*var\(--color-(white|black)\)\s+(\d+)%,\s*transparent\)$/);
|
|
262
|
+
if (wrapped) return { name: wrapped[1] as 'white' | 'black', opacity: parseInt(wrapped[2]) };
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
|
|
246
266
|
function buildValue(varName: string): string | null {
|
|
247
267
|
if (varName === variable && opacity >= 100) return null;
|
|
248
268
|
if (opacity >= 100) return varName;
|
|
@@ -251,6 +271,11 @@
|
|
|
251
271
|
|
|
252
272
|
function applyOpacity() {
|
|
253
273
|
opacity = Math.max(0, Math.min(100, Math.round(opacity)));
|
|
274
|
+
if (chosenStatic !== null) {
|
|
275
|
+
selector?.writeOverride(buildValue(`--color-${chosenStatic}`));
|
|
276
|
+
onchange?.();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
254
279
|
if (chosenCategory === null || chosenFamily === null || chosenStep === null) return;
|
|
255
280
|
const varName = getVarName(chosenCategory, chosenFamily, chosenStep);
|
|
256
281
|
selector?.writeOverride(buildValue(varName));
|
|
@@ -323,6 +348,7 @@
|
|
|
323
348
|
|
|
324
349
|
if (raw === 'transparent') {
|
|
325
350
|
chosenNone = true;
|
|
351
|
+
chosenStatic = null;
|
|
326
352
|
chosenCategory = null;
|
|
327
353
|
chosenFamily = null;
|
|
328
354
|
chosenStep = null;
|
|
@@ -362,6 +388,17 @@
|
|
|
362
388
|
chosenGradient = null;
|
|
363
389
|
chosenAngle = null;
|
|
364
390
|
|
|
391
|
+
const staticParsed = parseStatic(raw);
|
|
392
|
+
if (staticParsed) {
|
|
393
|
+
chosenStatic = staticParsed.name;
|
|
394
|
+
chosenCategory = null;
|
|
395
|
+
chosenFamily = null;
|
|
396
|
+
chosenStep = null;
|
|
397
|
+
opacity = staticParsed.opacity;
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
chosenStatic = null;
|
|
401
|
+
|
|
365
402
|
const opacityParsed = parseOpacity(raw);
|
|
366
403
|
if (opacityParsed) {
|
|
367
404
|
const parsed = parseRef(opacityParsed.inner);
|
|
@@ -424,6 +461,7 @@
|
|
|
424
461
|
|
|
425
462
|
function selectNone(close: () => void) {
|
|
426
463
|
chosenNone = true;
|
|
464
|
+
chosenStatic = null;
|
|
427
465
|
chosenCategory = null;
|
|
428
466
|
chosenFamily = null;
|
|
429
467
|
chosenStep = null;
|
|
@@ -436,9 +474,24 @@
|
|
|
436
474
|
onchange?.();
|
|
437
475
|
}
|
|
438
476
|
|
|
477
|
+
function selectStatic(name: 'white' | 'black', close: () => void) {
|
|
478
|
+
chosenNone = false;
|
|
479
|
+
chosenStatic = name;
|
|
480
|
+
chosenCategory = null;
|
|
481
|
+
chosenFamily = null;
|
|
482
|
+
chosenStep = null;
|
|
483
|
+
chosenGradient = null;
|
|
484
|
+
chosenAngle = null;
|
|
485
|
+
selector?.writeOverride(buildValue(`--color-${name}`));
|
|
486
|
+
selectedFamily = null;
|
|
487
|
+
close();
|
|
488
|
+
onchange?.();
|
|
489
|
+
}
|
|
490
|
+
|
|
439
491
|
function selectSwatch(category: Category, step: string, close: () => void) {
|
|
440
492
|
const varName = getVarName(category, selectedFamily!, step);
|
|
441
493
|
chosenNone = false;
|
|
494
|
+
chosenStatic = null;
|
|
442
495
|
chosenGradient = null;
|
|
443
496
|
chosenAngle = null;
|
|
444
497
|
chosenCategory = category;
|
|
@@ -456,6 +509,7 @@
|
|
|
456
509
|
// token's default angle but with no local override active.
|
|
457
510
|
function selectGradient(gradientVar: string, close: () => void) {
|
|
458
511
|
chosenNone = false;
|
|
512
|
+
chosenStatic = null;
|
|
459
513
|
chosenCategory = null;
|
|
460
514
|
chosenFamily = null;
|
|
461
515
|
chosenStep = null;
|
|
@@ -493,11 +547,13 @@
|
|
|
493
547
|
|
|
494
548
|
let metaLabel = $derived(chosenNone
|
|
495
549
|
? 'none'
|
|
496
|
-
:
|
|
497
|
-
?
|
|
498
|
-
:
|
|
499
|
-
?
|
|
500
|
-
:
|
|
550
|
+
: chosenStatic
|
|
551
|
+
? `color-${chosenStatic}` + (opacity < 100 ? ` (${opacity}%)` : '')
|
|
552
|
+
: chosenGradient
|
|
553
|
+
? chosenGradient.replace(/^--/, '') + (chosenAngle !== null ? ` (${effectiveAngle}°)` : '')
|
|
554
|
+
: (chosenCategory && chosenFamily && chosenStep !== null
|
|
555
|
+
? getVarName(chosenCategory, chosenFamily, chosenStep).replace(/^--/, '') + (opacity < 100 ? ` (${opacity}%)` : '')
|
|
556
|
+
: ''));
|
|
501
557
|
|
|
502
558
|
let availableTabs = $derived(selectedFamily
|
|
503
559
|
? allCategories.filter(c => c.id !== 'text' || familiesWithText.includes(selectedFamily!))
|
|
@@ -517,6 +573,7 @@
|
|
|
517
573
|
{canBeLinked}
|
|
518
574
|
{disabled}
|
|
519
575
|
{selectionsLocked}
|
|
576
|
+
{onwrite}
|
|
520
577
|
dropdownMinWidth="14rem"
|
|
521
578
|
dropdownMaxWidth="calc(100vw - 2rem)"
|
|
522
579
|
hideDefaultHeader={!!selectedFamily}
|
|
@@ -542,13 +599,23 @@
|
|
|
542
599
|
{#snippet children({ close })}
|
|
543
600
|
|
|
544
601
|
{#if selectedFamily === null}
|
|
545
|
-
<div class="
|
|
546
|
-
<button class="
|
|
547
|
-
<div class="
|
|
548
|
-
|
|
549
|
-
</div>
|
|
550
|
-
<span class="family-label">None</span>
|
|
602
|
+
<div class="static-band">
|
|
603
|
+
<button class="static-chip" class:active={chosenStatic === 'white'} onclick={() => selectStatic('white', close)}>
|
|
604
|
+
<div class="static-swatch static-swatch--white"></div>
|
|
605
|
+
<span class="static-label">White</span>
|
|
551
606
|
</button>
|
|
607
|
+
<button class="static-chip" class:active={chosenStatic === 'black'} onclick={() => selectStatic('black', close)}>
|
|
608
|
+
<div class="static-swatch static-swatch--black"></div>
|
|
609
|
+
<span class="static-label">Black</span>
|
|
610
|
+
</button>
|
|
611
|
+
{#if showNone}
|
|
612
|
+
<button class="static-chip" class:active={chosenNone} onclick={() => selectNone(close)}>
|
|
613
|
+
<div class="static-swatch static-swatch--none"></div>
|
|
614
|
+
<span class="static-label">None</span>
|
|
615
|
+
</button>
|
|
616
|
+
{/if}
|
|
617
|
+
</div>
|
|
618
|
+
<div class="family-list">
|
|
552
619
|
{#each families as fam}
|
|
553
620
|
{@const outOfFamily = familyFilter !== null && fam.name !== familyFilter}
|
|
554
621
|
<button
|
|
@@ -850,6 +917,79 @@
|
|
|
850
917
|
background: var(--ui-hover);
|
|
851
918
|
}
|
|
852
919
|
|
|
920
|
+
/* Inline band of instant-apply atoms (White / Black / None) above the
|
|
921
|
+
family list. Same swatch+label vocabulary as `.step-item`, scaled to
|
|
922
|
+
fit three across so the eye groups them as peer one-clicks distinct
|
|
923
|
+
from the multi-step family rows below. */
|
|
924
|
+
.static-band {
|
|
925
|
+
display: flex;
|
|
926
|
+
gap: var(--ui-space-4);
|
|
927
|
+
padding: var(--ui-space-8);
|
|
928
|
+
border-bottom: 1px solid var(--ui-border-low);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.static-chip {
|
|
932
|
+
flex: 1;
|
|
933
|
+
display: flex;
|
|
934
|
+
flex-direction: column;
|
|
935
|
+
align-items: center;
|
|
936
|
+
gap: var(--ui-space-2);
|
|
937
|
+
padding: var(--ui-space-4);
|
|
938
|
+
background: none;
|
|
939
|
+
border: 1px solid transparent;
|
|
940
|
+
border-radius: var(--ui-radius-sm);
|
|
941
|
+
cursor: pointer;
|
|
942
|
+
transition: all var(--ui-transition-fast);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
.static-chip:hover {
|
|
946
|
+
background: var(--ui-hover);
|
|
947
|
+
border-color: var(--ui-border);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
.static-chip.active {
|
|
951
|
+
border-color: var(--ui-text-accent);
|
|
952
|
+
border-width: 2px;
|
|
953
|
+
background: var(--ui-hover-high);
|
|
954
|
+
padding: 3px;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.static-chip.active .static-label {
|
|
958
|
+
color: var(--ui-text-accent);
|
|
959
|
+
font-weight: var(--ui-font-weight-semibold);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.static-swatch {
|
|
963
|
+
width: 2rem;
|
|
964
|
+
height: 1.5rem;
|
|
965
|
+
border-radius: var(--ui-radius-sm);
|
|
966
|
+
border: 1px solid var(--ui-border-low);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.static-swatch--white {
|
|
970
|
+
background: var(--color-white);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
.static-swatch--black {
|
|
974
|
+
background: var(--color-black);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
.static-swatch--none {
|
|
978
|
+
background: repeating-linear-gradient(
|
|
979
|
+
-45deg,
|
|
980
|
+
transparent,
|
|
981
|
+
transparent 3px,
|
|
982
|
+
var(--ui-border-low) 3px,
|
|
983
|
+
var(--ui-border-low) 4px
|
|
984
|
+
);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
.static-label {
|
|
988
|
+
font-size: var(--ui-font-size-xs);
|
|
989
|
+
color: var(--ui-text-secondary);
|
|
990
|
+
font-family: var(--ui-font-mono);
|
|
991
|
+
}
|
|
992
|
+
|
|
853
993
|
.family-list {
|
|
854
994
|
display: flex;
|
|
855
995
|
flex-direction: column;
|
|
@@ -905,15 +1045,6 @@
|
|
|
905
1045
|
border-radius: 2px;
|
|
906
1046
|
}
|
|
907
1047
|
|
|
908
|
-
.none-swatch {
|
|
909
|
-
width: 2.5rem;
|
|
910
|
-
height: 0.75rem;
|
|
911
|
-
border-radius: 2px;
|
|
912
|
-
border: 1px solid var(--ui-border-low);
|
|
913
|
-
position: relative;
|
|
914
|
-
overflow: hidden;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
1048
|
.gradient-swatch {
|
|
918
1049
|
width: 2.5rem;
|
|
919
1050
|
height: 0.75rem;
|
|
@@ -931,22 +1062,6 @@
|
|
|
931
1062
|
border-top: 1px solid var(--ui-border-low);
|
|
932
1063
|
}
|
|
933
1064
|
|
|
934
|
-
.none-swatch::after {
|
|
935
|
-
content: '';
|
|
936
|
-
position: absolute;
|
|
937
|
-
top: -1px;
|
|
938
|
-
left: -1px;
|
|
939
|
-
right: -1px;
|
|
940
|
-
bottom: -1px;
|
|
941
|
-
background: repeating-linear-gradient(
|
|
942
|
-
-45deg,
|
|
943
|
-
transparent,
|
|
944
|
-
transparent 3px,
|
|
945
|
-
var(--ui-border-low) 3px,
|
|
946
|
-
var(--ui-border-low) 4px
|
|
947
|
-
);
|
|
948
|
-
}
|
|
949
|
-
|
|
950
1065
|
.family-label {
|
|
951
1066
|
flex: 1;
|
|
952
1067
|
font-size: var(--ui-font-size-sm);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { run, createBubbler, stopPropagation } from 'svelte/legacy';
|
|
3
|
-
|
|
4
|
-
const bubble = createBubbler();
|
|
5
2
|
import { onMount, onDestroy } from 'svelte';
|
|
3
|
+
import { self } from 'svelte/legacy';
|
|
6
4
|
import UIRadio from './UIRadio.svelte';
|
|
7
|
-
import { keepInViewport } from './keepInViewport';
|
|
8
5
|
|
|
9
6
|
type Candidate = { variable: string; alias: string };
|
|
10
7
|
|
|
@@ -40,7 +37,7 @@
|
|
|
40
37
|
|
|
41
38
|
let options = $derived(distinctOptions(candidates, initialVariable));
|
|
42
39
|
let selected = $state('');
|
|
43
|
-
|
|
40
|
+
$effect(() => {
|
|
44
41
|
if (selected === '' && options.length > 0) selected = options[0].alias;
|
|
45
42
|
});
|
|
46
43
|
|
|
@@ -64,10 +61,10 @@
|
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
let
|
|
64
|
+
let confirmBtn: HTMLButtonElement | undefined = $state();
|
|
68
65
|
|
|
69
66
|
onMount(() => {
|
|
70
|
-
|
|
67
|
+
confirmBtn?.focus();
|
|
71
68
|
document.addEventListener('keydown', handleKeydown, true);
|
|
72
69
|
});
|
|
73
70
|
|
|
@@ -76,70 +73,93 @@
|
|
|
76
73
|
});
|
|
77
74
|
</script>
|
|
78
75
|
|
|
79
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
80
|
-
<div
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
76
|
+
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_noninteractive_element_interactions a11y_no_static_element_interactions -->
|
|
77
|
+
<div class="ui-relink-backdrop" onclick={self(handleCancel)}>
|
|
78
|
+
<div
|
|
79
|
+
class="ui-relink-dialog"
|
|
80
|
+
role="dialog"
|
|
81
|
+
aria-label="Confirm link"
|
|
82
|
+
aria-modal="true"
|
|
83
|
+
tabindex="-1"
|
|
84
|
+
>
|
|
85
|
+
<div class="ui-relink-header">
|
|
86
|
+
{#if options.length > 1}
|
|
87
|
+
<span class="ui-relink-title">{candidates.length} variants disagree — pick one to broadcast</span>
|
|
88
|
+
{:else}
|
|
89
|
+
<span class="ui-relink-title">Link this property across {candidates.length} variants?</span>
|
|
90
|
+
{/if}
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
class="ui-relink-close"
|
|
94
|
+
onclick={handleCancel}
|
|
95
|
+
aria-label="Close"
|
|
96
|
+
>
|
|
97
|
+
<i class="fas fa-times"></i>
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div class="ui-relink-body" role="radiogroup">
|
|
102
|
+
{#each options as opt}
|
|
103
|
+
<label class="ui-relink-row" class:selected={selected === opt.alias}>
|
|
104
|
+
<UIRadio bind:group={selected} value={opt.alias} />
|
|
105
|
+
<div class="ui-relink-row-info">
|
|
106
|
+
<code class="ui-relink-alias">{opt.alias}</code>
|
|
107
|
+
<span class="ui-relink-sources">
|
|
108
|
+
from {opt.sources.join(', ')}
|
|
109
|
+
</span>
|
|
110
|
+
</div>
|
|
111
|
+
</label>
|
|
112
|
+
{/each}
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div class="ui-relink-footer">
|
|
116
|
+
<button type="button" class="ui-relink-btn ui-relink-btn-cancel" onclick={handleCancel}>Cancel</button>
|
|
117
|
+
<button
|
|
118
|
+
type="button"
|
|
119
|
+
class="ui-relink-btn ui-relink-btn-confirm"
|
|
120
|
+
onclick={handleConfirm}
|
|
121
|
+
bind:this={confirmBtn}
|
|
122
|
+
>Link</button>
|
|
123
|
+
</div>
|
|
114
124
|
</div>
|
|
115
125
|
</div>
|
|
116
126
|
|
|
117
127
|
<style>
|
|
118
|
-
.ui-relink-
|
|
119
|
-
position:
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
.ui-relink-backdrop {
|
|
129
|
+
position: fixed;
|
|
130
|
+
inset: 0;
|
|
131
|
+
background: rgba(0, 0, 0, 0.55);
|
|
132
|
+
display: flex;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
align-items: center;
|
|
135
|
+
z-index: 10000;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ui-relink-dialog {
|
|
122
139
|
background: var(--ui-surface-higher);
|
|
123
140
|
border: 1px solid var(--ui-border-high);
|
|
124
141
|
border-radius: var(--ui-radius-md);
|
|
125
142
|
box-shadow: var(--ui-shadow-lg);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
max-width: 24rem;
|
|
129
|
-
padding: var(--ui-space-8);
|
|
143
|
+
min-width: 22rem;
|
|
144
|
+
max-width: 28rem;
|
|
130
145
|
display: flex;
|
|
131
146
|
flex-direction: column;
|
|
132
|
-
|
|
133
|
-
animation: uiRelinkPopoverIn 120ms ease-out;
|
|
147
|
+
animation: uiRelinkDialogIn 140ms ease-out;
|
|
134
148
|
}
|
|
149
|
+
.ui-relink-dialog:focus { outline: none; }
|
|
135
150
|
|
|
136
|
-
|
|
137
|
-
|
|
151
|
+
@keyframes uiRelinkDialogIn {
|
|
152
|
+
from { opacity: 0; transform: translateY(-6px); }
|
|
153
|
+
to { opacity: 1; transform: translateY(0); }
|
|
138
154
|
}
|
|
139
155
|
|
|
140
156
|
.ui-relink-header {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: space-between;
|
|
160
|
+
gap: var(--ui-space-8);
|
|
161
|
+
padding: var(--ui-space-8) var(--ui-space-12);
|
|
141
162
|
border-bottom: 1px solid var(--ui-border-low);
|
|
142
|
-
padding-bottom: var(--ui-space-6);
|
|
143
163
|
}
|
|
144
164
|
|
|
145
165
|
.ui-relink-title {
|
|
@@ -148,31 +168,52 @@
|
|
|
148
168
|
font-weight: var(--ui-font-weight-medium);
|
|
149
169
|
}
|
|
150
170
|
|
|
171
|
+
.ui-relink-close {
|
|
172
|
+
flex-shrink: 0;
|
|
173
|
+
width: 22px;
|
|
174
|
+
height: 22px;
|
|
175
|
+
display: grid;
|
|
176
|
+
place-items: center;
|
|
177
|
+
background: transparent;
|
|
178
|
+
border: none;
|
|
179
|
+
border-radius: var(--ui-radius-sm);
|
|
180
|
+
color: var(--ui-text-tertiary);
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
font-size: var(--ui-font-size-xs);
|
|
183
|
+
transition: background var(--ui-transition-fast), color var(--ui-transition-fast);
|
|
184
|
+
}
|
|
185
|
+
.ui-relink-close:hover {
|
|
186
|
+
background: var(--ui-hover);
|
|
187
|
+
color: var(--ui-text-primary);
|
|
188
|
+
}
|
|
189
|
+
|
|
151
190
|
.ui-relink-body {
|
|
152
191
|
display: flex;
|
|
153
192
|
flex-direction: column;
|
|
154
193
|
gap: var(--ui-space-4);
|
|
194
|
+
padding: var(--ui-space-8) var(--ui-space-8);
|
|
155
195
|
}
|
|
156
196
|
|
|
157
197
|
.ui-relink-row {
|
|
158
198
|
display: flex;
|
|
159
199
|
align-items: flex-start;
|
|
160
200
|
gap: var(--ui-space-8);
|
|
161
|
-
padding: var(--ui-space-
|
|
201
|
+
padding: var(--ui-space-6) var(--ui-space-8);
|
|
202
|
+
border: 1px solid transparent;
|
|
162
203
|
border-radius: var(--ui-radius-sm);
|
|
163
204
|
cursor: pointer;
|
|
164
|
-
transition:
|
|
205
|
+
transition:
|
|
206
|
+
background var(--ui-transition-fast),
|
|
207
|
+
border-color var(--ui-transition-fast);
|
|
165
208
|
}
|
|
166
|
-
|
|
167
|
-
.ui-relink-row
|
|
209
|
+
.ui-relink-row:hover { background: var(--ui-hover); }
|
|
210
|
+
.ui-relink-row.selected {
|
|
168
211
|
background: var(--ui-hover);
|
|
212
|
+
border-color: var(--ui-border-high);
|
|
169
213
|
}
|
|
170
214
|
|
|
171
|
-
/* Lift the radio
|
|
172
|
-
|
|
173
|
-
.ui-relink-row :global(.ui-radio) {
|
|
174
|
-
margin-top: 0.2rem;
|
|
175
|
-
}
|
|
215
|
+
/* Lift the radio so it visually aligns with the first line of the row label. */
|
|
216
|
+
.ui-relink-row :global(.ui-radio) { margin-top: 0.2rem; }
|
|
176
217
|
|
|
177
218
|
.ui-relink-row-info {
|
|
178
219
|
display: flex;
|
|
@@ -204,7 +245,7 @@
|
|
|
204
245
|
display: flex;
|
|
205
246
|
justify-content: flex-end;
|
|
206
247
|
gap: var(--ui-space-6);
|
|
207
|
-
padding
|
|
248
|
+
padding: var(--ui-space-8) var(--ui-space-12);
|
|
208
249
|
border-top: 1px solid var(--ui-border-low);
|
|
209
250
|
}
|
|
210
251
|
|
|
@@ -222,7 +263,6 @@
|
|
|
222
263
|
border: 1px solid var(--ui-border);
|
|
223
264
|
color: var(--ui-text-secondary);
|
|
224
265
|
}
|
|
225
|
-
|
|
226
266
|
.ui-relink-btn-cancel:hover {
|
|
227
267
|
background: var(--ui-hover);
|
|
228
268
|
color: var(--ui-text-primary);
|
|
@@ -233,13 +273,5 @@
|
|
|
233
273
|
border: 1px solid var(--ui-text-accent);
|
|
234
274
|
color: var(--ui-surface-lowest);
|
|
235
275
|
}
|
|
236
|
-
|
|
237
|
-
.ui-relink-btn-confirm:hover {
|
|
238
|
-
filter: brightness(1.1);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
@keyframes uiRelinkPopoverIn {
|
|
242
|
-
from { opacity: 0; transform: translateY(-2px); }
|
|
243
|
-
to { opacity: 1; transform: translateY(0); }
|
|
244
|
-
}
|
|
276
|
+
.ui-relink-btn-confirm:hover { filter: brightness(1.1); }
|
|
245
277
|
</style>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
getComponentPropertySiblings,
|
|
16
16
|
} from '../core/store/editorStore';
|
|
17
17
|
import UILinkToggle from './UILinkToggle.svelte';
|
|
18
|
-
import
|
|
18
|
+
import UIRelinkConfirmDialog from './UIRelinkConfirmDialog.svelte';
|
|
19
19
|
import { keepInViewport } from './keepInViewport';
|
|
20
20
|
|
|
21
21
|
type DropdownContext = { close: () => void; handleReset: () => void };
|
|
@@ -58,6 +58,14 @@
|
|
|
58
58
|
onopen?: () => void;
|
|
59
59
|
onclose?: () => void;
|
|
60
60
|
onvarChange?: () => void;
|
|
61
|
+
/** When provided, writes route through this callback instead of touching
|
|
62
|
+
* the DOM or component aliases. Caller owns persistence (typically into
|
|
63
|
+
* a typed slice). The callback receives the same payload `writeOverride`
|
|
64
|
+
* would have written: a bare `--token-name`, a CSS expression like
|
|
65
|
+
* `color-mix(...)` or `transparent`, or `null` to reset. Caller is
|
|
66
|
+
* responsible for re-emitting the var so the picker's DOM read-back
|
|
67
|
+
* reflects the new state. */
|
|
68
|
+
onwrite?: (value: string | null) => void;
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
let {
|
|
@@ -81,6 +89,7 @@
|
|
|
81
89
|
onopen,
|
|
82
90
|
onclose,
|
|
83
91
|
onvarChange,
|
|
92
|
+
onwrite,
|
|
84
93
|
}: Props = $props();
|
|
85
94
|
|
|
86
95
|
let open = $state(false);
|
|
@@ -100,6 +109,10 @@
|
|
|
100
109
|
|
|
101
110
|
/** Persist a semantic CSS-var reference (or clear it when null). */
|
|
102
111
|
export function writeOverride(semanticName: string | null): void {
|
|
112
|
+
if (onwrite) {
|
|
113
|
+
onwrite(semanticName);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
103
116
|
if (component) {
|
|
104
117
|
const useLinked = isLinkedDisplay;
|
|
105
118
|
if (semanticName) {
|
|
@@ -280,7 +293,7 @@
|
|
|
280
293
|
</button>
|
|
281
294
|
|
|
282
295
|
{#if relinkOpen && component}
|
|
283
|
-
<
|
|
296
|
+
<UIRelinkConfirmDialog
|
|
284
297
|
candidates={relinkCandidates}
|
|
285
298
|
initialVariable={variable}
|
|
286
299
|
prefixToStrip={`--${component}-`}
|