@motion-proto/live-tokens 0.7.1 → 0.8.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/dist-plugin/index.cjs +707 -90
- package/dist-plugin/index.d.cts +1 -0
- package/dist-plugin/index.d.ts +1 -0
- package/dist-plugin/index.js +707 -90
- package/package.json +2 -1
- package/src/app/site.css +1 -1
- package/src/editor/component-editor/CollapsibleSectionEditor.svelte +34 -27
- package/src/editor/component-editor/DialogEditor.svelte +4 -4
- package/src/editor/component-editor/NotificationEditor.svelte +3 -1
- package/src/editor/component-editor/SectionDividerEditor.svelte +439 -112
- package/src/editor/component-editor/StandardButtonsEditor.svelte +13 -1
- package/src/editor/component-editor/editors.d.ts +10 -0
- package/src/editor/component-editor/scaffolding/AngleDial.svelte +52 -13
- package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +10 -11
- package/src/editor/component-editor/scaffolding/LinkedBlock.svelte +0 -1
- package/src/editor/component-editor/scaffolding/RadialShapePad.svelte +483 -0
- package/src/editor/component-editor/scaffolding/ShadowBackdrop.svelte +15 -2
- package/src/editor/component-editor/scaffolding/StateBlock.svelte +103 -15
- package/src/editor/component-editor/scaffolding/TokenLayout.svelte +9 -6
- package/src/editor/component-editor/scaffolding/TypeEditor.svelte +13 -1
- package/src/editor/component-editor/scaffolding/VariantGroup.svelte +239 -25
- package/src/editor/component-editor/scaffolding/buildTypeGroupTokens.ts +1 -0
- package/src/editor/component-editor/scaffolding/types.ts +11 -0
- package/src/editor/core/components/componentConfigKeys.ts +8 -0
- package/src/editor/core/components/componentConfigService.ts +2 -2
- package/src/editor/core/components/componentPersist.ts +7 -5
- package/src/editor/core/manifests/manifestService.ts +58 -3
- package/src/editor/core/palettes/familySwap.ts +99 -0
- package/src/editor/core/palettes/paletteDerivation.ts +69 -0
- package/src/editor/core/palettes/tokenRegistry.ts +4 -1
- package/src/editor/core/store/editorStore.ts +206 -12
- package/src/editor/core/store/editorTypes.ts +55 -12
- package/src/editor/core/store/gradientSource.ts +192 -0
- package/src/editor/core/themes/migrations/2026-05-19-collapsiblesection-drop-frame-surface.ts +28 -0
- package/src/editor/core/themes/migrations/2026-05-19-sectiondivider-rich-gradient.ts +35 -0
- package/src/editor/core/themes/migrations/2026-05-20-sectiondivider-slim-variants.ts +82 -0
- package/src/editor/core/themes/migrations/2026-05-21-sectiondivider-spacing-to-padding.ts +24 -0
- package/src/editor/core/themes/migrations/2026-05-22-sectiondivider-intrinsics-to-css.ts +81 -0
- package/src/editor/core/themes/migrations/index.ts +10 -0
- package/src/editor/core/themes/slices/components.ts +18 -4
- package/src/editor/core/themes/slices/gradients.ts +88 -13
- package/src/editor/core/themes/themeInit.ts +2 -2
- package/src/editor/core/themes/themeTypes.ts +56 -1
- package/src/editor/overlay/ColumnsOverlay.svelte +0 -1
- package/src/editor/overlay/LiveEditorOverlay.svelte +1 -4
- package/src/editor/styles/ui-editor.css +1 -0
- package/src/editor/styles/ui-form-controls.css +19 -20
- package/src/editor/ui/BezierCurveEditor.svelte +114 -63
- package/src/editor/ui/EditorViewSwitcher.svelte +0 -1
- package/src/editor/ui/FileLoadList.svelte +22 -5
- package/src/editor/ui/FontStackEditor.svelte +214 -76
- package/src/editor/ui/GradientEditor.svelte +435 -215
- package/src/editor/ui/GradientStopPicker.svelte +11 -3
- package/src/editor/ui/ManifestFileManager.svelte +71 -4
- package/src/editor/ui/PaletteEditor.svelte +52 -79
- package/src/editor/ui/ProjectFontsSection.svelte +328 -293
- package/src/editor/ui/ThemeFileManager.svelte +0 -4
- package/src/editor/ui/UIFontFamilySelector.svelte +0 -1
- package/src/editor/ui/UIFontSizeSelector.svelte +3 -0
- package/src/editor/ui/UIInfoPopover.svelte +0 -1
- package/src/editor/ui/UILetterSpacingSelector.svelte +65 -0
- package/src/editor/ui/UIPaletteSelector.svelte +31 -4
- package/src/editor/ui/UIPillButton.svelte +33 -3
- package/src/editor/ui/UISegmentedControl.svelte +114 -0
- package/src/editor/ui/UITokenSelector.svelte +4 -1
- package/src/editor/ui/VariablesTab.svelte +41 -35
- package/src/editor/ui/palette/OverridesPanel.svelte +14 -37
- package/src/editor/ui/palette/PaletteBase.svelte +3 -3
- package/src/editor/ui/sections/ColumnsSection.svelte +1 -2
- package/src/editor/ui/sections/GradientsSection.svelte +1 -1
- package/src/editor/ui/sections/OverlaysSection.svelte +1 -1
- package/src/editor/ui/sections/ShadowsSection.svelte +1 -1
- package/src/system/components/Button.svelte +2 -2
- package/src/system/components/Card.svelte +29 -1
- package/src/system/components/CollapsibleSection.svelte +25 -2
- package/src/system/components/FloatingTokenTags.css +43 -24
- package/src/system/components/FloatingTokenTags.svelte +88 -137
- package/src/system/components/Notification.svelte +8 -1
- package/src/system/components/SectionDivider.svelte +456 -379
- package/src/system/styles/CONVENTIONS.md +1 -1
- package/src/system/styles/fonts.css +3 -16
- package/src/system/styles/tokens.css +356 -1199
- package/src/system/styles/tokens.generated.css +544 -0
- package/src/editor/component-editor/scaffolding/DividerEditor.svelte +0 -94
- package/src/editor/component-editor/scaffolding/GradientCard.svelte +0 -296
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motion-proto/live-tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 6/7.",
|
|
6
6
|
"keywords": [
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"./styles/ui-editor.css": "./src/editor/styles/ui-editor.css",
|
|
66
66
|
"./app/tokens.css": "./src/system/styles/tokens.css",
|
|
67
|
+
"./app/tokens.generated.css": "./src/system/styles/tokens.generated.css",
|
|
67
68
|
"./app/site.css": "./src/app/site.css",
|
|
68
69
|
"./app/fonts.css": "./src/system/styles/fonts.css"
|
|
69
70
|
},
|
package/src/app/site.css
CHANGED
|
@@ -24,7 +24,7 @@ h2 {
|
|
|
24
24
|
font-size: var(--font-size-2xl);
|
|
25
25
|
font-weight: var(--font-weight-semibold);
|
|
26
26
|
color: var(--text-primary);
|
|
27
|
-
letter-spacing:
|
|
27
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
28
28
|
margin: var(--space-32) 0 var(--space-12);
|
|
29
29
|
line-height: var(--line-height-sm);
|
|
30
30
|
overflow-wrap: break-word;
|
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
const VARIANTS = ['chromeless', 'divider', 'container'] as const;
|
|
8
8
|
type Variant = typeof VARIANTS[number];
|
|
9
|
+
// CSS-layer state names (used in the var names) vs UI-layer labels (shown in
|
|
10
|
+
// the editor). The CSS keeps the historical `active` slug for compatibility;
|
|
11
|
+
// the UI surfaces it as "Current" because users read `:active` as click-press.
|
|
9
12
|
const HEADER_STATES = ['default', 'hover', 'active'] as const;
|
|
10
13
|
type HeaderState = typeof HEADER_STATES[number];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const HEADER_STATE_LABELS: Record<HeaderState, string> = {
|
|
15
|
+
default: 'Default',
|
|
16
|
+
hover: 'Hover',
|
|
17
|
+
active: 'Current',
|
|
18
|
+
};
|
|
15
19
|
|
|
16
20
|
const VARIANT_LABELS: Record<Variant, string> = {
|
|
17
21
|
chromeless: 'Chromeless',
|
|
@@ -21,7 +25,7 @@
|
|
|
21
25
|
|
|
22
26
|
// Header tokens per variant. Chromeless has no chrome; divider exposes the
|
|
23
27
|
// bottom-border (the divider line) per state; container's outer chrome lives
|
|
24
|
-
// in
|
|
28
|
+
// in the Container part so the header strip just owns surface + padding + text.
|
|
25
29
|
function headerStateTokens(v: Variant, s: HeaderState): Token[] {
|
|
26
30
|
const p = `--collapsiblesection-${v}-${s}`;
|
|
27
31
|
const base: Token[] = [
|
|
@@ -39,17 +43,17 @@
|
|
|
39
43
|
return base;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
// Container
|
|
43
|
-
const
|
|
44
|
-
{ label: 'surface color', groupKey: 'surface', variable: '--collapsiblesection-container-frame-surface' },
|
|
46
|
+
// Container part: the always-on outer chrome of the Container variant only.
|
|
47
|
+
const containerPartTokens: Token[] = [
|
|
45
48
|
{ label: 'border color', groupKey: 'border', variable: '--collapsiblesection-container-frame-border' },
|
|
46
49
|
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: '--collapsiblesection-container-frame-border-width' },
|
|
47
50
|
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: '--collapsiblesection-container-frame-radius' },
|
|
48
51
|
];
|
|
49
52
|
|
|
50
|
-
//
|
|
51
|
-
// its own surface so the
|
|
52
|
-
|
|
53
|
+
// Body: revealed content area. Chromeless/divider only own padding; container
|
|
54
|
+
// also paints its own surface so the body can read distinct from the header.
|
|
55
|
+
// (CSS var name keeps the `expanded` slug for backward compatibility.)
|
|
56
|
+
function bodyTokens(v: Variant): Token[] {
|
|
53
57
|
const p = `--collapsiblesection-${v}-expanded`;
|
|
54
58
|
const tokens: Token[] = [];
|
|
55
59
|
if (v === 'container') tokens.push({ label: 'surface color', groupKey: 'surface', variable: `${p}-surface` });
|
|
@@ -57,21 +61,24 @@
|
|
|
57
61
|
return tokens;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
64
|
+
// Two-tier "Element / State" key convention. VariantGroup detects the " / "
|
|
65
|
+
// separator and renders a parts strip on top with a state sub-strip beneath
|
|
66
|
+
// when the active part has interaction states. Parts:
|
|
67
|
+
// - Container: outer chrome (container variant only) — no sub-states
|
|
68
|
+
// - Header: the always-visible bar — has Default/Hover/Current states
|
|
69
|
+
// - Body: the revealed content panel — no sub-states
|
|
63
70
|
function variantStates(v: Variant): Record<string, Token[]> {
|
|
64
71
|
const out: Record<string, Token[]> = {};
|
|
65
|
-
if (v === 'container') out
|
|
66
|
-
for (const s of HEADER_STATES) out[s] = headerStateTokens(v, s);
|
|
67
|
-
out
|
|
72
|
+
if (v === 'container') out['Container'] = containerPartTokens;
|
|
73
|
+
for (const s of HEADER_STATES) out[`Header / ${HEADER_STATE_LABELS[s]}`] = headerStateTokens(v, s);
|
|
74
|
+
out['Body'] = bodyTokens(v);
|
|
68
75
|
return out;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
// Label typography only attaches to header states;
|
|
72
|
-
// own text.
|
|
78
|
+
// Label typography only attaches to header states; Container and Body don't
|
|
79
|
+
// own text. Keys match the corresponding entries in `variantStates`.
|
|
73
80
|
function variantTypeGroups(v: Variant): Record<string, TypeGroupConfig[]> {
|
|
74
|
-
return Object.fromEntries(HEADER_STATES.map((s) => [s
|
|
81
|
+
return Object.fromEntries(HEADER_STATES.map((s) => [`Header / ${HEADER_STATE_LABELS[s]}`, [{
|
|
75
82
|
legend: 'label',
|
|
76
83
|
colorVariable: `--collapsiblesection-${v}-${s}-label`,
|
|
77
84
|
familyVariable: `--collapsiblesection-${v}-${s}-label-font-family`,
|
|
@@ -144,20 +151,20 @@
|
|
|
144
151
|
|
|
145
152
|
>
|
|
146
153
|
{#snippet children({ activeState })}
|
|
147
|
-
|
|
148
|
-
{@const
|
|
149
|
-
{@const forceClass = activeState === '
|
|
150
|
-
{@const forceActive = activeState === '
|
|
154
|
+
{@const isContainerPart = activeState === 'Container'}
|
|
155
|
+
{@const isBody = activeState === 'Body'}
|
|
156
|
+
{@const forceClass = activeState === 'Header / Hover' ? 'force-hover' : ''}
|
|
157
|
+
{@const forceActive = activeState === 'Header / Current'}
|
|
151
158
|
<CollapsibleSection
|
|
152
159
|
variant={v}
|
|
153
160
|
label="Click to expand"
|
|
154
|
-
expanded={
|
|
161
|
+
expanded={isBody}
|
|
155
162
|
active={forceActive}
|
|
156
163
|
class={forceClass}
|
|
157
164
|
>
|
|
158
165
|
<p style="margin: 0; color: var(--text-secondary);">
|
|
159
|
-
{#if
|
|
160
|
-
(
|
|
166
|
+
{#if isContainerPart}
|
|
167
|
+
(Container) — outer chrome only; switch to Body to see the content area.
|
|
161
168
|
{:else}
|
|
162
169
|
This content is revealed when the section is expanded. Any content can go here.
|
|
163
170
|
{/if}
|
|
@@ -166,10 +166,10 @@
|
|
|
166
166
|
|
|
167
167
|
:global(.ui-form-select.compact) {
|
|
168
168
|
min-height: 1.75rem;
|
|
169
|
-
padding: 0 var(--ui-space-8)
|
|
170
|
-
padding-right: var(--ui-space-24)
|
|
171
|
-
background-color: var(--ui-surface-low)
|
|
172
|
-
background-position: right var(--ui-space-8) center
|
|
169
|
+
padding: 0 var(--ui-space-8);
|
|
170
|
+
padding-right: var(--ui-space-24);
|
|
171
|
+
background-color: var(--ui-surface-low);
|
|
172
|
+
background-position: right var(--ui-space-8) center;
|
|
173
173
|
font-size: var(--ui-font-size-sm);
|
|
174
174
|
width: 100%;
|
|
175
175
|
}
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
const variants = ['info', 'success', 'warning', 'danger'] as const;
|
|
7
7
|
type Variant = typeof variants[number];
|
|
8
8
|
|
|
9
|
-
// Per variant: notification frame (surface, border, border-width, radius, padding) + icon (color, size)
|
|
9
|
+
// Per variant: notification frame (surface, border, border-width, radius, padding) + icon (color, size)
|
|
10
|
+
// + action backdrop surface (paints behind the optional header action button).
|
|
10
11
|
function variantTokens(v: Variant): Token[] {
|
|
11
12
|
return [
|
|
12
13
|
{ label: 'surface color', groupKey: 'surface', variable: `--notification-${v}-surface` },
|
|
14
|
+
{ label: 'action surface', groupKey: 'action-surface', variable: `--notification-${v}-action-surface` },
|
|
13
15
|
{ label: 'border color', groupKey: 'border', variable: `--notification-${v}-border` },
|
|
14
16
|
{ label: 'border width', canBeLinked: true, groupKey: 'border-width', variable: `--notification-${v}-border-width` },
|
|
15
17
|
{ label: 'corner radius', canBeLinked: true, groupKey: 'radius', variable: `--notification-${v}-radius` },
|