@motion-proto/live-tokens 0.3.9 → 0.5.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 +9 -8
- package/src/component-editor/BadgeEditor.svelte +24 -22
- package/src/component-editor/CalloutEditor.svelte +3 -3
- package/src/component-editor/CardEditor.svelte +25 -21
- package/src/component-editor/CollapsibleSectionEditor.svelte +27 -25
- package/src/component-editor/CornerBadgeEditor.svelte +37 -35
- package/src/component-editor/DialogEditor.svelte +26 -24
- package/src/component-editor/ImageEditor.svelte +11 -9
- package/src/component-editor/InlineEditActionsEditor.svelte +17 -15
- package/src/component-editor/NotificationEditor.svelte +32 -30
- package/src/component-editor/ProgressBarEditor.svelte +3 -3
- package/src/component-editor/RadioButtonEditor.svelte +31 -29
- package/src/component-editor/SectionDividerEditor.svelte +30 -28
- package/src/component-editor/SegmentedControlEditor.svelte +29 -25
- package/src/component-editor/StandardButtonsEditor.svelte +42 -38
- package/src/component-editor/TabBarEditor.svelte +20 -18
- package/src/component-editor/TableEditor.svelte +4 -4
- package/src/component-editor/TooltipEditor.svelte +11 -9
- package/src/component-editor/registry.ts +2 -2
- package/src/component-editor/scaffolding/AngleDial.svelte +20 -19
- package/src/component-editor/scaffolding/ComponentEditorBase.svelte +44 -20
- package/src/component-editor/scaffolding/ComponentFileManager.svelte +260 -37
- package/src/component-editor/scaffolding/ComponentFileMenu.svelte +41 -29
- package/src/component-editor/scaffolding/ComponentsTab.svelte +7 -3
- package/src/component-editor/scaffolding/CopyFromMenu.svelte +21 -12
- package/src/component-editor/scaffolding/DemoHeader.svelte +13 -4
- package/src/component-editor/scaffolding/DividerEditor.svelte +27 -14
- package/src/component-editor/scaffolding/FieldsetWrapper.svelte +10 -4
- package/src/component-editor/scaffolding/GradientCard.svelte +25 -20
- package/src/component-editor/scaffolding/LinkageChart.svelte +43 -34
- package/src/component-editor/scaffolding/LinkedBlock.svelte +24 -21
- package/src/component-editor/scaffolding/NonStylableConfig.svelte +6 -1
- package/src/component-editor/scaffolding/SaveAsDialog.svelte +39 -35
- package/src/component-editor/scaffolding/ShadowBackdrop.svelte +21 -9
- package/src/component-editor/scaffolding/ShadowBackdropControls.svelte +8 -3
- package/src/component-editor/scaffolding/StateBlock.svelte +30 -13
- package/src/component-editor/scaffolding/TokenLayout.svelte +46 -30
- package/src/component-editor/scaffolding/TypeEditor.svelte +52 -26
- package/src/component-editor/scaffolding/VariantGroup.svelte +81 -48
- package/src/component-editor/scaffolding/componentSectionType.ts +2 -2
- package/src/components/Badge.svelte +45 -26
- package/src/components/Button.svelte +44 -21
- package/src/components/Callout.svelte +17 -12
- package/src/components/Card.svelte +23 -11
- package/src/components/CollapsibleSection.svelte +56 -27
- package/src/components/CornerBadge.svelte +32 -18
- package/src/components/Dialog.svelte +55 -31
- package/src/components/Image.svelte +14 -5
- package/src/components/InlineEditActions.svelte +22 -10
- package/src/components/Notification.svelte +39 -19
- package/src/components/ProgressBar.svelte +27 -17
- package/src/components/RadioButton.svelte +27 -10
- package/src/components/SectionDivider.svelte +34 -26
- package/src/components/SegmentedControl.svelte +23 -9
- package/src/components/TabBar.svelte +23 -10
- package/src/components/Table.svelte +8 -3
- package/src/components/Tooltip.svelte +15 -5
- package/src/lib/ColumnsOverlay.svelte +3 -3
- package/src/lib/LiveEditorOverlay.svelte +57 -36
- package/src/pages/ComponentEditorPage.svelte +17 -13
- package/src/pages/EditorShell.svelte +24 -20
- package/src/styles/form-controls.css +2 -2
- package/src/styles/tokens.css +59 -81
- package/src/ui/BezierCurveEditor.svelte +59 -43
- package/src/ui/ColorEditPanel.svelte +71 -44
- package/src/ui/EditorViewSwitcher.svelte +9 -5
- package/src/ui/FontStackEditor.svelte +16 -15
- package/src/ui/GradientEditor.svelte +42 -33
- package/src/ui/GradientStopPicker.svelte +18 -29
- package/src/ui/PaletteEditor.svelte +238 -212
- package/src/ui/PresetFileManager.svelte +20 -18
- package/src/ui/ProjectFontsSection.svelte +30 -30
- package/src/ui/SurfacesTab.svelte +3 -3
- package/src/ui/TextTab.svelte +2 -2
- package/src/ui/ThemeFileManager.svelte +38 -35
- package/src/ui/Toggle.svelte +11 -9
- package/src/ui/UICopyPopover.svelte +19 -15
- package/src/ui/UIDialog.svelte +48 -30
- package/src/ui/UIFontFamilySelector.svelte +104 -78
- package/src/ui/UIFontSizeSelector.svelte +38 -20
- package/src/ui/UIFontWeightSelector.svelte +33 -13
- package/src/ui/UILineHeightSelector.svelte +33 -13
- package/src/ui/UILinkToggle.svelte +7 -6
- package/src/ui/UIOptionItem.svelte +21 -7
- package/src/ui/UIOptionList.svelte +9 -3
- package/src/ui/UIPaddingSelector.svelte +108 -82
- package/src/ui/UIPaletteSelector.svelte +186 -161
- package/src/ui/UIRadio.svelte +23 -8
- package/src/ui/UIRadioGroup.svelte +9 -8
- package/src/ui/UIRelinkConfirmPopover.svelte +26 -16
- package/src/ui/UITokenSelector.svelte +112 -68
- package/src/ui/UIVariantSelector.svelte +79 -57
- package/src/ui/VariablesTab.svelte +15 -15
- package/src/ui/palette/GradientStopEditor.svelte +45 -26
- package/src/ui/palette/OverridesPanel.svelte +85 -49
- package/src/ui/palette/PaletteBase.svelte +60 -32
- package/src/ui/palette/ScaleCurveEditor.svelte +25 -10
- package/src/ui/sections/ColumnsSection.svelte +13 -13
- package/src/ui/sections/GradientsSection.svelte +12 -9
- package/src/ui/sections/OverlaysSection.svelte +50 -47
- package/src/ui/sections/ShadowsSection.svelte +110 -104
- package/src/ui/sections/TokenScaleTable.svelte +38 -22
- package/src/ui/sections/tokenScales.ts +2 -2
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { run } from 'svelte/legacy';
|
|
3
|
+
|
|
2
4
|
/**
|
|
3
5
|
* Parameterised token-display table.
|
|
4
6
|
*
|
|
@@ -10,7 +12,6 @@
|
|
|
10
12
|
* Values are read live via getComputedStyle (passed in by the parent through
|
|
11
13
|
* `tokens`), so tokens.css remains the single source of truth.
|
|
12
14
|
*/
|
|
13
|
-
import { createEventDispatcher } from 'svelte';
|
|
14
15
|
import { editorState } from '../../lib/editorStore';
|
|
15
16
|
|
|
16
17
|
interface TokenItem {
|
|
@@ -29,20 +30,35 @@
|
|
|
29
30
|
| 'line-height' // no preview, table-only rows
|
|
30
31
|
| 'icon-size'; // star icon sized by font-size: var(--xx)
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
interface Props {
|
|
38
|
+
kind: ScaleKind;
|
|
39
|
+
/** Var names to resolve via getComputedStyle. Mutually exclusive with `tokens`. */
|
|
40
|
+
vars?: readonly string[] | undefined;
|
|
41
|
+
/** Pre-built token list. Use when values are static (e.g. duration/z-index/opacity
|
|
36
42
|
* literals) and don't need live CSS resolution. Mutually exclusive with `vars`. */
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
tokens?: TokenItem[] | undefined;
|
|
44
|
+
/** Bumped by the parent when the live CSS values may have changed (breakpoint
|
|
39
45
|
* flip). Triggers re-resolution when reading via `vars`. */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
liveVersion?: number;
|
|
47
|
+
/** When provided, the parent owns the copy-flash UI (pass copiedVar through). */
|
|
48
|
+
copiedVar?: string | null;
|
|
49
|
+
oncopy?: (variable: string) => void;
|
|
50
|
+
}
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
let {
|
|
53
|
+
kind,
|
|
54
|
+
vars = undefined,
|
|
55
|
+
tokens = undefined,
|
|
56
|
+
liveVersion = 0,
|
|
57
|
+
copiedVar = null,
|
|
58
|
+
oncopy
|
|
59
|
+
}: Props = $props();
|
|
60
|
+
|
|
61
|
+
function copy(v: string) { oncopy?.(v); }
|
|
46
62
|
|
|
47
63
|
function readVar(name: string): string {
|
|
48
64
|
if (typeof document === 'undefined') return '';
|
|
@@ -63,8 +79,8 @@
|
|
|
63
79
|
// Re-read whenever liveVersion bumps OR the editor mutates any CSS var
|
|
64
80
|
// (editor edits fan out via cssVarSync to :root). Depending on $editorState
|
|
65
81
|
// keeps the display in sync with user edits for free.
|
|
66
|
-
let resolved: TokenItem[] = [];
|
|
67
|
-
|
|
82
|
+
let resolved: TokenItem[] = $state([]);
|
|
83
|
+
run(() => {
|
|
68
84
|
liveVersion;
|
|
69
85
|
$editorState;
|
|
70
86
|
if (tokens) {
|
|
@@ -74,7 +90,7 @@
|
|
|
74
90
|
} else {
|
|
75
91
|
resolved = [];
|
|
76
92
|
}
|
|
77
|
-
}
|
|
93
|
+
});
|
|
78
94
|
</script>
|
|
79
95
|
|
|
80
96
|
{#if kind === 'spacing'}
|
|
@@ -83,7 +99,7 @@
|
|
|
83
99
|
<div class="spacing-item">
|
|
84
100
|
<div class="spacing-bar" style="width: var({token.variable}); min-width: 2px;"></div>
|
|
85
101
|
<div class="token-info">
|
|
86
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
102
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
87
103
|
<span class="token-value">{token.value}</span>
|
|
88
104
|
</div>
|
|
89
105
|
</div>
|
|
@@ -95,7 +111,7 @@
|
|
|
95
111
|
<div class="spacing-item">
|
|
96
112
|
<div class="border-width-bar" style="height: var({token.variable});"></div>
|
|
97
113
|
<div class="token-info">
|
|
98
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
114
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
99
115
|
<span class="token-value">{token.value}</span>
|
|
100
116
|
</div>
|
|
101
117
|
</div>
|
|
@@ -107,7 +123,7 @@
|
|
|
107
123
|
<div class="radius-item">
|
|
108
124
|
<div class="radius-box" style="border-radius: var({token.variable});"></div>
|
|
109
125
|
<div class="token-info">
|
|
110
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
126
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
111
127
|
<span class="token-value">{token.value}</span>
|
|
112
128
|
</div>
|
|
113
129
|
</div>
|
|
@@ -119,7 +135,7 @@
|
|
|
119
135
|
<div class="font-size-item">
|
|
120
136
|
<span class="font-size-preview" style="font-size: var({token.variable});">Ag</span>
|
|
121
137
|
<div class="token-info">
|
|
122
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
138
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
123
139
|
<span class="token-value">{token.value}</span>
|
|
124
140
|
</div>
|
|
125
141
|
</div>
|
|
@@ -131,7 +147,7 @@
|
|
|
131
147
|
<div class="font-weight-item">
|
|
132
148
|
<span class="font-weight-preview" style="font-weight: var({token.variable});">Ag</span>
|
|
133
149
|
<div class="token-info">
|
|
134
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
150
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
135
151
|
<span class="token-value">{token.value}</span>
|
|
136
152
|
</div>
|
|
137
153
|
</div>
|
|
@@ -141,7 +157,7 @@
|
|
|
141
157
|
<div class="token-table">
|
|
142
158
|
{#each resolved as token}
|
|
143
159
|
<div class="token-row">
|
|
144
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
160
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
145
161
|
<span class="token-value">{token.value}</span>
|
|
146
162
|
</div>
|
|
147
163
|
{/each}
|
|
@@ -154,7 +170,7 @@
|
|
|
154
170
|
<i class="fas fa-star"></i>
|
|
155
171
|
</span>
|
|
156
172
|
<div class="token-info">
|
|
157
|
-
<button class="token-variable copyable" class:copied={copiedVar === token.variable}
|
|
173
|
+
<button class="token-variable copyable" class:copied={copiedVar === token.variable} onclick={() => copy(token.variable)}>{copiedVar === token.variable ? 'copied!' : token.variable}</button>
|
|
158
174
|
<span class="token-value">{token.value}</span>
|
|
159
175
|
</div>
|
|
160
176
|
</div>
|
|
@@ -42,8 +42,8 @@ export const FONT_WEIGHT_VARS = [
|
|
|
42
42
|
] as const;
|
|
43
43
|
|
|
44
44
|
export const LINE_HEIGHT_VARS = [
|
|
45
|
-
'--line-height-
|
|
46
|
-
'--line-height-
|
|
45
|
+
'--line-height-xs', '--line-height-sm', '--line-height-md',
|
|
46
|
+
'--line-height-lg', '--line-height-xl',
|
|
47
47
|
] as const;
|
|
48
48
|
|
|
49
49
|
export interface TokenItem {
|