@motion-proto/live-tokens 0.47.0 → 0.47.1
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/CHANGELOG.md +22 -0
- package/dist-plugin/index.cjs +52 -2
- package/dist-plugin/index.js +52 -2
- package/package.json +1 -1
- package/src/editor/core/palettes/paletteDerivation.ts +45 -3
- package/src/editor/ui/BezierCurveEditor.svelte +2 -2
- package/src/editor/ui/ColorEditPanel.svelte +1 -1
- package/src/editor/ui/PaletteEditor.svelte +26 -12
- package/src/editor/ui/UIPillButton.svelte +7 -2
- package/src/editor/ui/colors/ColorWheel.svelte +34 -1
- package/src/editor/ui/curveEngine.ts +48 -0
- package/src/editor/ui/palette/PaletteBase.svelte +75 -51
- package/src/editor/ui/palette/PaletteJumpButton.svelte +3 -8
- package/src/live-tokens/data/themes/default.json +571 -461
- package/src/live-tokens/data/tokens.generated.css +118 -118
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import ColorEditPanel from '../ColorEditPanel.svelte';
|
|
3
3
|
import Toggle from '../Toggle.svelte';
|
|
4
|
-
import PaletteJumpButton from './PaletteJumpButton.svelte';
|
|
5
4
|
import { beginSliderGesture } from '../../core/store/editorStore';
|
|
6
5
|
import { oklchToHexClamped, type Oklch } from '../../core/palettes/oklch';
|
|
7
6
|
|
|
@@ -85,46 +84,58 @@
|
|
|
85
84
|
onkeydown={(e) => e.key === 'Enter' && onStartEdit()}
|
|
86
85
|
></div>
|
|
87
86
|
<div class="primary-info">
|
|
88
|
-
<
|
|
89
|
-
<span class="editor-label">{displayLabel ?? label}</span>
|
|
90
|
-
<PaletteJumpButton family={label} {displayLabel} target="wheel" />
|
|
91
|
-
</div>
|
|
87
|
+
<span class="editor-label">{displayLabel ?? label}</span>
|
|
92
88
|
<button
|
|
93
|
-
class="base-hex
|
|
89
|
+
class="base-hex"
|
|
90
|
+
class:copied={copiedKey === '__base__'}
|
|
94
91
|
type="button"
|
|
92
|
+
title="Copy {baseHex}"
|
|
95
93
|
onclick={(e) => onCopyBaseHex('__base__', baseHex, e)}
|
|
96
|
-
>
|
|
94
|
+
>
|
|
95
|
+
<span class="hex-value">{baseHex}</span>
|
|
96
|
+
<i
|
|
97
|
+
class="fas"
|
|
98
|
+
class:fa-copy={copiedKey !== '__base__'}
|
|
99
|
+
class:fa-check={copiedKey === '__base__'}
|
|
100
|
+
aria-hidden="true"
|
|
101
|
+
></i>
|
|
102
|
+
</button>
|
|
97
103
|
</div>
|
|
98
104
|
</div>
|
|
99
|
-
</div>
|
|
100
105
|
|
|
101
|
-
{#if pinnedOpen || (isEditingBase && panelOpen && editingColor)}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
{/
|
|
106
|
+
{#if pinnedOpen || (isEditingBase && panelOpen && editingColor)}
|
|
107
|
+
<div class="editor-controls">
|
|
108
|
+
<ColorEditPanel
|
|
109
|
+
title={isEditingBase ? editPanelTitle : 'Base Color'}
|
|
110
|
+
showRemoveOverride={false}
|
|
111
|
+
hideActions={!isEditingBase}
|
|
112
|
+
hidePreview
|
|
113
|
+
hue={baseOklch.h}
|
|
114
|
+
chroma={baseOklch.c}
|
|
115
|
+
lightness={baseOklch.l * 100}
|
|
116
|
+
chromaMax={CHROMA_MAX}
|
|
117
|
+
chromaHint={pickerChromaHint}
|
|
118
|
+
onHueChromaChange={onBaseChange}
|
|
119
|
+
onConfirm={onConfirm}
|
|
120
|
+
onCancel={onCancel}
|
|
121
|
+
onRemoveOverride={() => {}}
|
|
122
|
+
onSliderStart={() => beginSliderGesture(`edit ${label} base`)}
|
|
123
|
+
>
|
|
124
|
+
{#snippet actions()}
|
|
125
|
+
<Toggle
|
|
126
|
+
checked={anchorToBase}
|
|
127
|
+
onchange={(v) => onAnchorToBaseChange(v ?? !anchorToBase)}
|
|
128
|
+
label={anchorStepLabel ? `Base color placed at ${anchorStepLabel}` : 'Place base color in palette'}
|
|
129
|
+
/>
|
|
130
|
+
{/snippet}
|
|
131
|
+
</ColorEditPanel>
|
|
132
|
+
</div>
|
|
133
|
+
{/if}
|
|
134
|
+
</div>
|
|
126
135
|
|
|
127
136
|
<style>
|
|
137
|
+
/* Identity and controls read as one band: the sliders sit beside the swatch
|
|
138
|
+
rather than under it, which is what leaves the palette below its height. */
|
|
128
139
|
.editor-top {
|
|
129
140
|
display: flex;
|
|
130
141
|
align-items: flex-start;
|
|
@@ -134,7 +145,7 @@
|
|
|
134
145
|
|
|
135
146
|
.editor-primary {
|
|
136
147
|
display: flex;
|
|
137
|
-
align-items:
|
|
148
|
+
align-items: stretch;
|
|
138
149
|
gap: var(--ui-space-12);
|
|
139
150
|
flex-shrink: 0;
|
|
140
151
|
}
|
|
@@ -142,19 +153,20 @@
|
|
|
142
153
|
.primary-info {
|
|
143
154
|
display: flex;
|
|
144
155
|
flex-direction: column;
|
|
156
|
+
align-items: flex-start;
|
|
145
157
|
gap: var(--ui-space-2);
|
|
146
158
|
}
|
|
147
159
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
160
|
+
/* Basis, not width: the panel takes the rest of the row and drops below only
|
|
161
|
+
when it can't hold that much. */
|
|
162
|
+
.editor-controls {
|
|
163
|
+
flex: 1 1 26rem;
|
|
164
|
+
min-width: 0;
|
|
152
165
|
}
|
|
153
166
|
|
|
154
|
-
|
|
155
167
|
.header-swatch {
|
|
156
|
-
width:
|
|
157
|
-
height:
|
|
168
|
+
width: 4.5rem;
|
|
169
|
+
min-height: 4.5rem;
|
|
158
170
|
border-radius: var(--ui-radius-md);
|
|
159
171
|
border: 2px solid var(--ui-border);
|
|
160
172
|
flex-shrink: 0;
|
|
@@ -178,13 +190,9 @@
|
|
|
178
190
|
}
|
|
179
191
|
|
|
180
192
|
.base-hex {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.clickable-hex {
|
|
187
|
-
align-self: flex-start;
|
|
193
|
+
display: inline-flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
gap: var(--ui-space-6);
|
|
188
196
|
background: none;
|
|
189
197
|
border: none;
|
|
190
198
|
cursor: pointer;
|
|
@@ -197,15 +205,31 @@
|
|
|
197
205
|
text-align: left;
|
|
198
206
|
}
|
|
199
207
|
|
|
200
|
-
|
|
208
|
+
/* The glyph only announces itself on approach; the hex is the content. */
|
|
209
|
+
.base-hex i {
|
|
210
|
+
font-size: var(--ui-font-size-xs);
|
|
211
|
+
color: var(--ui-text-muted);
|
|
212
|
+
transition: color var(--ui-transition-fast);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.base-hex:hover {
|
|
201
216
|
background: var(--ui-surface-highest);
|
|
202
217
|
color: var(--ui-text-primary);
|
|
203
218
|
}
|
|
204
219
|
|
|
220
|
+
.base-hex:hover i {
|
|
221
|
+
color: var(--ui-text-secondary);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.base-hex.copied,
|
|
225
|
+
.base-hex.copied i {
|
|
226
|
+
color: var(--ui-text-accent);
|
|
227
|
+
}
|
|
228
|
+
|
|
205
229
|
@media (max-width: 1280px) {
|
|
206
230
|
.header-swatch {
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
231
|
+
width: 3.5rem;
|
|
232
|
+
min-height: 3.5rem;
|
|
209
233
|
}
|
|
210
234
|
}
|
|
211
235
|
</style>
|
|
@@ -35,15 +35,10 @@
|
|
|
35
35
|
display: inline-flex;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/* fa-palette loses its bowl at the pill's default icon size
|
|
39
|
-
pill's
|
|
40
|
-
it
|
|
41
|
-
.palette-jump :global(.ui-pill) {
|
|
42
|
-
padding-block: var(--ui-space-6);
|
|
43
|
-
}
|
|
44
|
-
|
|
38
|
+
/* fa-palette loses its bowl at the pill's default icon size; the compact
|
|
39
|
+
pill's min-height carries the taller glyph without changing the pill's
|
|
40
|
+
height, so it still lines up with the plain pills beside it. */
|
|
45
41
|
.palette-jump :global(.ui-pill i) {
|
|
46
42
|
font-size: var(--ui-font-size-md);
|
|
47
|
-
line-height: 1.2;
|
|
48
43
|
}
|
|
49
44
|
</style>
|