@lostgradient/cinder 0.24.3 → 0.24.5
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 +17 -0
- package/components.json +1 -1
- package/dist/components/json-schema-editor/index.js +2095 -5515
- package/dist/components/json-schema-editor/json-schema-editor-state.svelte.d.ts +1 -0
- package/dist/components/json-schema-editor/json-schema-editor.css +4 -0
- package/dist/components/waveform/index.js +17 -5
- package/dist/components/waveform/waveform.css +27 -0
- package/dist/index.js +344 -312
- package/dist/server/components/json-schema-editor/index.js +2 -10
- package/dist/server/components/waveform/index.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/{index.server-tdrncj5e.js → index.server-qhfya7fx.js} +10 -3
- package/dist/server/{index.server-7h3nmj3g.js → index.server-tb414d8x.js} +62 -58
- package/package.json +3 -2
- package/src/components/json-schema-editor/diff-view.svelte +1 -1
- package/src/components/json-schema-editor/json-schema-editor-impl.svelte +2 -2
- package/src/components/json-schema-editor/json-schema-editor-state.svelte.ts +26 -16
- package/src/components/json-schema-editor/json-schema-editor.css +4 -0
- package/src/components/json-schema-editor/json-schema-toolbar.svelte +2 -2
- package/src/components/json-schema-editor/json-schema-validator.ts +17 -3
- package/src/components/json-schema-editor/property-editor.constants.ts +0 -1
- package/src/components/json-schema-editor/property-editor.svelte +4 -10
- package/src/components/json-schema-editor/property-list.svelte +19 -4
- package/src/components/waveform/waveform.css +27 -0
- package/src/components/waveform/waveform.svelte +28 -15
- package/src/styles/tokens-base.css +3 -3
|
@@ -8,6 +8,7 @@ import { onDestroy } from 'svelte';
|
|
|
8
8
|
import Alert from '../alert/alert.svelte';
|
|
9
9
|
import Button from '../button/button.svelte';
|
|
10
10
|
import Chip from '../chip/chip.svelte';
|
|
11
|
+
import Badge from '@lostgradient/cinder/badge';
|
|
11
12
|
import Collapsible from '@lostgradient/cinder/collapsible';
|
|
12
13
|
import Input from '../input/input.svelte';
|
|
13
14
|
import PropertyEditor from './property-editor.svelte';
|
|
@@ -182,6 +183,7 @@ function removeRequiredOnly(name) {
|
|
|
182
183
|
{#each propertyNames as key (key)}
|
|
183
184
|
{@const isRequired = required.includes(key)}
|
|
184
185
|
{@const isOpen = expanded[key] === true}
|
|
186
|
+
{@const childValidationErrorCount = childValidationCounts[key] ?? 0}
|
|
185
187
|
{@const panelId = `${idPrefix}-${key}-panel`}
|
|
186
188
|
<!--
|
|
187
189
|
Custom disclosure (not <details>/<summary>) so the action buttons can
|
|
@@ -189,12 +191,16 @@ function removeRequiredOnly(name) {
|
|
|
189
191
|
<button> inside <summary> creates an ARIA "interactive within
|
|
190
192
|
interactive" violation.
|
|
191
193
|
-->
|
|
192
|
-
<div
|
|
194
|
+
<div
|
|
195
|
+
class="cinder-jse-property-row"
|
|
196
|
+
data-cinder-required={isRequired ? '' : undefined}
|
|
197
|
+
data-cinder-invalid={childValidationErrorCount > 0 ? '' : undefined}
|
|
198
|
+
>
|
|
193
199
|
<div class="cinder-jse-property-row__summary" style={`--cinder-jse-property-depth: ${depth}`}>
|
|
194
200
|
<button
|
|
195
201
|
type="button"
|
|
196
202
|
class="cinder-jse-property-row__trigger"
|
|
197
|
-
aria-label={`${isOpen ? 'Collapse' : 'Expand'} ${key} property`}
|
|
203
|
+
aria-label={`${isOpen ? 'Collapse' : 'Expand'} ${key} property${childValidationErrorCount > 0 ? `, ${childValidationErrorCount} validation ${childValidationErrorCount === 1 ? 'error' : 'errors'}` : ''}`}
|
|
198
204
|
aria-expanded={isOpen}
|
|
199
205
|
aria-controls={panelId}
|
|
200
206
|
onclick={() => toggleExpanded(key, isOpen)}
|
|
@@ -207,6 +213,15 @@ function removeRequiredOnly(name) {
|
|
|
207
213
|
/>
|
|
208
214
|
<span class="cinder-jse-property-row__name">{key}</span>
|
|
209
215
|
<span class="cinder-jse-property-row__type">{summariseType(properties[key] ?? {})}</span>
|
|
216
|
+
{#if childValidationErrorCount > 0}
|
|
217
|
+
<Badge
|
|
218
|
+
variant="danger"
|
|
219
|
+
aria-label={`${childValidationErrorCount} validation ${childValidationErrorCount === 1 ? 'error' : 'errors'} in ${key}`}
|
|
220
|
+
>
|
|
221
|
+
{childValidationErrorCount}{' '}
|
|
222
|
+
{childValidationErrorCount === 1 ? 'error' : 'errors'}
|
|
223
|
+
</Badge>
|
|
224
|
+
{/if}
|
|
210
225
|
</button>
|
|
211
226
|
<span class="cinder-jse-property-row__spacer"></span>
|
|
212
227
|
<Button
|
|
@@ -223,7 +238,7 @@ function removeRequiredOnly(name) {
|
|
|
223
238
|
variant="ghost"
|
|
224
239
|
size="xs"
|
|
225
240
|
disabled={readonly}
|
|
226
|
-
aria-label=
|
|
241
|
+
aria-label={`Move ${key} up`}
|
|
227
242
|
onclick={() => moveProperty(key, -1)}
|
|
228
243
|
>
|
|
229
244
|
↑
|
|
@@ -232,7 +247,7 @@ function removeRequiredOnly(name) {
|
|
|
232
247
|
variant="ghost"
|
|
233
248
|
size="xs"
|
|
234
249
|
disabled={readonly}
|
|
235
|
-
aria-label=
|
|
250
|
+
aria-label={`Move ${key} down`}
|
|
236
251
|
onclick={() => moveProperty(key, 1)}
|
|
237
252
|
>
|
|
238
253
|
↓
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
.cinder-waveform {
|
|
4
4
|
display: grid;
|
|
5
5
|
gap: var(--cinder-space-2);
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
max-inline-size: 100%;
|
|
6
8
|
color: var(--_cinder-chart-foreground, currentColor);
|
|
7
9
|
background: var(--_cinder-chart-background, transparent);
|
|
8
10
|
}
|
|
@@ -17,6 +19,31 @@
|
|
|
17
19
|
position: relative;
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
.cinder-waveform__table-scroll {
|
|
23
|
+
inline-size: 100%;
|
|
24
|
+
max-inline-size: 100%;
|
|
25
|
+
overflow-x: auto;
|
|
26
|
+
overscroll-behavior-inline: contain;
|
|
27
|
+
-webkit-overflow-scrolling: touch;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.cinder-waveform__table-scroll > table {
|
|
31
|
+
min-inline-size: max-content;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cinder-waveform__table-scroll:focus-visible {
|
|
35
|
+
outline: var(--cinder-ring-width) solid transparent;
|
|
36
|
+
box-shadow: var(--_cinder-focus-ring-shadow);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (forced-colors: active) {
|
|
40
|
+
.cinder-waveform__table-scroll:focus-visible {
|
|
41
|
+
outline: var(--cinder-ring-width) solid ButtonText;
|
|
42
|
+
outline-offset: 2px;
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
20
47
|
.cinder-waveform svg {
|
|
21
48
|
display: block;
|
|
22
49
|
inline-size: 100%;
|
|
@@ -227,22 +227,35 @@ const tableCaption = $derived.by(() => {
|
|
|
227
227
|
</svg>
|
|
228
228
|
</div>
|
|
229
229
|
{#if hasDataTable}
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
<
|
|
239
|
-
{
|
|
230
|
+
<div
|
|
231
|
+
class={dataTableVisibility === 'screen-reader-only'
|
|
232
|
+
? 'cinder-sr-only'
|
|
233
|
+
: 'cinder-waveform__table-scroll'}
|
|
234
|
+
{...dataTableVisibility === 'visible'
|
|
235
|
+
? { role: 'region', 'aria-label': `${label} data table`, tabindex: 0 }
|
|
236
|
+
: {}}
|
|
237
|
+
>
|
|
238
|
+
<table
|
|
239
|
+
class={dataTableClass(
|
|
240
|
+
dataTableVisibility === 'screen-reader-only' ? 'visible' : dataTableVisibility,
|
|
241
|
+
)}
|
|
242
|
+
>
|
|
243
|
+
<caption>{tableCaption}</caption>
|
|
244
|
+
<thead>
|
|
240
245
|
<tr>
|
|
241
|
-
<
|
|
242
|
-
<
|
|
246
|
+
<th scope="col">Sample index</th>
|
|
247
|
+
<th scope="col">Amplitude</th>
|
|
243
248
|
</tr>
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
249
|
+
</thead>
|
|
250
|
+
<tbody>
|
|
251
|
+
{#each tableSamples as sample (sample.index)}
|
|
252
|
+
<tr>
|
|
253
|
+
<td>{sample.index}</td>
|
|
254
|
+
<td>{sample.value.toFixed(4)}</td>
|
|
255
|
+
</tr>
|
|
256
|
+
{/each}
|
|
257
|
+
</tbody>
|
|
258
|
+
</table>
|
|
259
|
+
</div>
|
|
247
260
|
{/if}
|
|
248
261
|
</figure>
|
|
@@ -478,7 +478,7 @@
|
|
|
478
478
|
* accent (≥5:1) and the dark page bg (≥18:1). Used by FloatingAction
|
|
479
479
|
* primary variant. Raw oklch is legitimate here (tokens-base.css is the
|
|
480
480
|
* one place raw colors are allowed). */
|
|
481
|
-
--cinder-ring-on-accent: light-dark(oklch(
|
|
481
|
+
--cinder-ring-on-accent: light-dark(oklch(15% 0.035 245), oklch(100% 0 0));
|
|
482
482
|
|
|
483
483
|
/* Focus ring.
|
|
484
484
|
*
|
|
@@ -694,7 +694,7 @@
|
|
|
694
694
|
--cinder-scrollbar-thumb: oklch(100% 0 0 / 0.45);
|
|
695
695
|
--cinder-scrollbar-thumb-hover: oklch(100% 0 0 / 0.65);
|
|
696
696
|
--cinder-ring-offset-color: var(--cinder-surface-raised);
|
|
697
|
-
--cinder-ring-on-accent: oklch(
|
|
697
|
+
--cinder-ring-on-accent: oklch(100% 0 0);
|
|
698
698
|
--cinder-ring-color: oklch(from var(--cinder-accent) 0.7 0.14 h);
|
|
699
699
|
--cinder-button-bg: var(--cinder-surface-raised);
|
|
700
700
|
--cinder-button-fg: var(--cinder-text);
|
|
@@ -782,7 +782,7 @@
|
|
|
782
782
|
--cinder-scrollbar-thumb: oklch(0% 0 0 / 0.45);
|
|
783
783
|
--cinder-scrollbar-thumb-hover: oklch(0% 0 0 / 0.65);
|
|
784
784
|
--cinder-ring-offset-color: var(--cinder-surface-raised);
|
|
785
|
-
--cinder-ring-on-accent: oklch(
|
|
785
|
+
--cinder-ring-on-accent: oklch(15% 0.035 245);
|
|
786
786
|
--cinder-ring-color: oklch(from var(--cinder-accent) 0.55 0.16 h);
|
|
787
787
|
--cinder-button-bg: var(--cinder-surface-raised);
|
|
788
788
|
--cinder-button-fg: var(--cinder-text);
|