@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.
@@ -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
- <div class="label-row">
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 clickable-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
- >{copiedKey === '__base__' ? 'copied!' : baseHex}</button>
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
- <ColorEditPanel
103
- title={isEditingBase ? editPanelTitle : 'Base Color'}
104
- showRemoveOverride={false}
105
- hideActions={!isEditingBase}
106
- hue={baseOklch.h}
107
- chroma={baseOklch.c}
108
- lightness={baseOklch.l * 100}
109
- chromaMax={CHROMA_MAX}
110
- chromaHint={pickerChromaHint}
111
- onHueChromaChange={onBaseChange}
112
- onConfirm={onConfirm}
113
- onCancel={onCancel}
114
- onRemoveOverride={() => {}}
115
- onSliderStart={() => beginSliderGesture(`edit ${label} base`)}
116
- >
117
- {#snippet actions()}
118
- <Toggle
119
- checked={anchorToBase}
120
- onchange={(v) => onAnchorToBaseChange(v ?? !anchorToBase)}
121
- label={anchorStepLabel ? `Base color placed at ${anchorStepLabel}` : 'Place base color in palette'}
122
- />
123
- {/snippet}
124
- </ColorEditPanel>
125
- {/if}
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: center;
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
- .label-row {
149
- display: flex;
150
- align-items: center;
151
- gap: var(--ui-space-10);
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: 4rem;
157
- height: 4rem;
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
- font-size: var(--ui-font-size-md);
182
- color: var(--ui-text-secondary);
183
- font-family: var(--ui-font-mono);
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
- .clickable-hex:hover {
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: 3rem;
208
- height: 3rem;
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. The compact
39
- pill's line box is shorter than the glyph draws, so the padding grows with
40
- it rather than letting it cross the border. */
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>