slexkit 0.3.0 → 0.3.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 +18 -0
- package/README.md +4 -3
- package/README.zh-CN.md +4 -3
- package/dist/ai/llms-components.txt +2 -1
- package/dist/ai/llms-full.txt +73 -42
- package/dist/ai/llms-runtime.txt +11 -12
- package/dist/ai/llms.txt +1 -1
- package/dist/ai/slexkit-ai-manifest.json +77 -73
- package/dist/components/checkbox.js +1 -0
- package/dist/components/choice.css +2 -2
- package/dist/components/display.css +1 -1
- package/dist/components/index.js +56 -153
- package/dist/components/input.css +53 -119
- package/dist/components/input.js +33 -143
- package/dist/components/radio-group.js +1 -0
- package/dist/components/select.css +0 -6
- package/dist/components/slider.css +27 -18
- package/dist/components/specs.js +2 -1
- package/dist/components/switch.css +3 -3
- package/dist/components/switch.js +1 -0
- package/dist/components/text-input.css +21 -90
- package/dist/components/text.js +12 -0
- package/dist/components/tooling.css +0 -1
- package/dist/runtime.cjs +22 -5
- package/dist/runtime.js +22 -5
- package/dist/slexkit.cjs +78 -158
- package/dist/slexkit.css +54 -121
- package/dist/slexkit.js +78 -158
- package/dist/types/version.d.ts +2 -2
- package/dist/umd/slexkit.tooling.umd.js +77 -158
- package/dist/umd/slexkit.umd.js +78 -158
- package/package.json +3 -2
- package/skills/slexkit-host-integration/SKILL.md +1 -1
- package/src/components/svelte/display/Text.svelte +14 -1
- package/src/components/svelte/input/Checkbox.svelte +1 -1
- package/src/components/svelte/input/Input.svelte +0 -110
- package/src/components/svelte/input/RadioGroup.svelte +1 -1
- package/src/components/svelte/input/Switch.svelte +1 -1
- package/src/styles/components/choice.css +2 -2
- package/src/styles/components/select.css +0 -6
- package/src/styles/components/slider.css +27 -18
- package/src/styles/components/switch.css +3 -3
- package/src/styles/components/text-input.css +21 -90
- package/src/styles/display.css +1 -1
- package/src/styles/tooling.css +0 -1
|
@@ -164,53 +164,62 @@
|
|
|
164
164
|
.slex-slider {
|
|
165
165
|
box-sizing: border-box;
|
|
166
166
|
width: 100%;
|
|
167
|
-
height:
|
|
167
|
+
height: 1rem;
|
|
168
|
+
padding: 0;
|
|
169
|
+
border: 0;
|
|
168
170
|
border-radius: 999px;
|
|
169
171
|
-webkit-appearance: none;
|
|
170
172
|
appearance: none;
|
|
171
|
-
background:
|
|
172
|
-
to right,
|
|
173
|
-
var(--primary) 0%,
|
|
174
|
-
var(--primary) var(--slex-slider-progress, 0%),
|
|
175
|
-
var(--secondary) var(--slex-slider-progress, 0%),
|
|
176
|
-
var(--secondary) 100%
|
|
177
|
-
);
|
|
173
|
+
background: transparent;
|
|
178
174
|
accent-color: var(--primary);
|
|
179
175
|
cursor: pointer;
|
|
176
|
+
overflow: visible;
|
|
180
177
|
transition: box-shadow 150ms ease, filter 150ms ease;
|
|
181
178
|
}
|
|
182
179
|
|
|
183
|
-
.slex-slider:hover {
|
|
184
|
-
box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 8%, transparent);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.slex-slider:active {
|
|
188
|
-
box-shadow: 0 0 0 5px color-mix(in oklab, var(--primary) 12%, transparent);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
180
|
.slex-slider:focus-visible {
|
|
192
181
|
outline: 2px solid var(--ring);
|
|
193
182
|
outline-offset: 4px;
|
|
194
183
|
}
|
|
195
184
|
|
|
196
185
|
.slex-slider::-webkit-slider-thumb {
|
|
186
|
+
box-sizing: border-box;
|
|
197
187
|
width: 1rem;
|
|
198
188
|
height: 1rem;
|
|
189
|
+
margin-top: -0.25rem;
|
|
199
190
|
border: 2px solid var(--primary);
|
|
200
191
|
border-radius: 999px;
|
|
201
|
-
background: var(--background)
|
|
192
|
+
background-color: var(--background);
|
|
193
|
+
background-clip: padding-box;
|
|
202
194
|
box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 14%, transparent);
|
|
203
195
|
-webkit-appearance: none;
|
|
204
196
|
appearance: none;
|
|
205
197
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
|
|
206
198
|
}
|
|
207
199
|
|
|
200
|
+
.slex-slider::-webkit-slider-runnable-track {
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
width: 100%;
|
|
203
|
+
height: 0.5rem;
|
|
204
|
+
border: 0;
|
|
205
|
+
border-radius: 999px;
|
|
206
|
+
background: linear-gradient(
|
|
207
|
+
to right,
|
|
208
|
+
var(--primary) 0%,
|
|
209
|
+
var(--primary) var(--slex-slider-progress, 0%),
|
|
210
|
+
var(--secondary) var(--slex-slider-progress, 0%),
|
|
211
|
+
var(--secondary) 100%
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
208
215
|
.slex-slider::-moz-range-thumb {
|
|
216
|
+
box-sizing: border-box;
|
|
209
217
|
width: 1rem;
|
|
210
218
|
height: 1rem;
|
|
211
219
|
border: 2px solid var(--primary);
|
|
212
220
|
border-radius: 999px;
|
|
213
|
-
background: var(--background)
|
|
221
|
+
background-color: var(--background);
|
|
222
|
+
background-clip: padding-box;
|
|
214
223
|
box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 14%, transparent);
|
|
215
224
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
|
|
216
225
|
}
|
|
@@ -363,12 +372,12 @@
|
|
|
363
372
|
opacity: 0.55;
|
|
364
373
|
}
|
|
365
374
|
|
|
366
|
-
.slex-switch
|
|
375
|
+
.slex-switch[data-disabled="true"] {
|
|
367
376
|
cursor: not-allowed;
|
|
368
377
|
}
|
|
369
378
|
|
|
370
|
-
.slex-switch
|
|
371
|
-
.slex-switch
|
|
379
|
+
.slex-switch[data-disabled="true"]:hover .slex-switch-control,
|
|
380
|
+
.slex-switch[data-disabled="true"]:hover .slex-switch-control::after {
|
|
372
381
|
box-shadow: none;
|
|
373
382
|
}
|
|
374
383
|
|
|
@@ -421,16 +430,18 @@
|
|
|
421
430
|
border: 1px solid var(--input);
|
|
422
431
|
border-radius: var(--radius);
|
|
423
432
|
background: var(--background);
|
|
433
|
+
background-clip: padding-box;
|
|
424
434
|
color: var(--foreground);
|
|
425
435
|
font-family: inherit;
|
|
426
436
|
font-size: 0.875rem;
|
|
427
437
|
line-height: 1.5;
|
|
428
438
|
outline: none;
|
|
439
|
+
-webkit-appearance: none;
|
|
440
|
+
appearance: none;
|
|
429
441
|
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
430
442
|
}
|
|
431
443
|
|
|
432
|
-
.slex-input-control[data-has-unit="true"] .slex-input
|
|
433
|
-
.slex-input-control[data-has-controls="true"] .slex-input {
|
|
444
|
+
.slex-input-control[data-has-unit="true"] .slex-input {
|
|
434
445
|
border-top-right-radius: 0;
|
|
435
446
|
border-bottom-right-radius: 0;
|
|
436
447
|
}
|
|
@@ -454,79 +465,16 @@
|
|
|
454
465
|
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
455
466
|
}
|
|
456
467
|
|
|
457
|
-
.slex-input-control[data-has-controls="true"] .slex-input-unit {
|
|
458
|
-
border-radius: 0;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
.slex-input-controls {
|
|
462
|
-
box-sizing: border-box;
|
|
463
|
-
display: inline-grid;
|
|
464
|
-
grid-template-rows: repeat(2, minmax(0, 1fr));
|
|
465
|
-
align-items: stretch;
|
|
466
|
-
flex: 0 0 auto;
|
|
467
|
-
width: 1.875rem;
|
|
468
|
-
min-width: 1.875rem;
|
|
469
|
-
min-height: 2.5625rem;
|
|
470
|
-
overflow: hidden;
|
|
471
|
-
border: 1px solid var(--input);
|
|
472
|
-
border-left: 0;
|
|
473
|
-
border-radius: 0 var(--radius) var(--radius) 0;
|
|
474
|
-
background: var(--background);
|
|
475
|
-
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
.slex-input-step {
|
|
479
|
-
box-sizing: border-box;
|
|
480
|
-
display: inline-flex;
|
|
481
|
-
align-items: center;
|
|
482
|
-
justify-content: center;
|
|
483
|
-
width: 100%;
|
|
484
|
-
min-width: 0;
|
|
485
|
-
min-height: 0;
|
|
486
|
-
padding: 0;
|
|
487
|
-
border: 0;
|
|
488
|
-
border-top: 1px solid var(--input);
|
|
489
|
-
border-radius: 0;
|
|
490
|
-
background: transparent;
|
|
491
|
-
color: var(--foreground);
|
|
492
|
-
font: inherit;
|
|
493
|
-
font-size: 0.75rem;
|
|
494
|
-
font-weight: 600;
|
|
495
|
-
line-height: 1;
|
|
496
|
-
cursor: pointer;
|
|
497
|
-
transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.slex-input-step:first-child {
|
|
501
|
-
border-top: 0;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
.slex-input-step:last-child {
|
|
505
|
-
border-radius: 0;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
.slex-input-step:hover:not(:disabled) {
|
|
509
|
-
background: color-mix(in oklab, var(--muted) 52%, var(--background));
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.slex-input-step:focus-visible {
|
|
513
|
-
z-index: 1;
|
|
514
|
-
outline: none;
|
|
515
|
-
background: color-mix(in oklab, var(--muted) 58%, var(--background));
|
|
516
|
-
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ring) 34%, transparent);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
.slex-input-step:disabled {
|
|
520
|
-
opacity: 0.45;
|
|
521
|
-
cursor: not-allowed;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
468
|
.slex-input::placeholder {
|
|
525
469
|
color: var(--muted-foreground);
|
|
526
470
|
}
|
|
527
471
|
|
|
528
472
|
.slex-input:focus {
|
|
529
473
|
border-color: var(--ring);
|
|
474
|
+
box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 18%, transparent);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.slex-input-control[data-has-unit="true"] .slex-input:focus {
|
|
530
478
|
box-shadow: none;
|
|
531
479
|
}
|
|
532
480
|
|
|
@@ -551,6 +499,10 @@
|
|
|
551
499
|
|
|
552
500
|
.slex-input-field[data-invalid="true"] .slex-input:focus {
|
|
553
501
|
border-color: var(--destructive);
|
|
502
|
+
box-shadow: 0 0 0 2px color-mix(in oklab, var(--destructive) 18%, transparent);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.slex-input-field[data-invalid="true"] .slex-input-control[data-has-unit="true"] .slex-input:focus {
|
|
554
506
|
box-shadow: none;
|
|
555
507
|
}
|
|
556
508
|
|
|
@@ -558,13 +510,12 @@
|
|
|
558
510
|
box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 16%, transparent);
|
|
559
511
|
}
|
|
560
512
|
|
|
561
|
-
.slex-input-control:focus-within
|
|
562
|
-
|
|
563
|
-
.slex-input-control:focus-within .slex-input-controls {
|
|
564
|
-
border-color: var(--ring);
|
|
513
|
+
.slex-input-control:not([data-has-unit]):focus-within {
|
|
514
|
+
box-shadow: none;
|
|
565
515
|
}
|
|
566
516
|
|
|
567
|
-
.slex-input-control:focus-within .slex-input
|
|
517
|
+
.slex-input-control:focus-within .slex-input,
|
|
518
|
+
.slex-input-control:focus-within .slex-input-unit {
|
|
568
519
|
border-color: var(--ring);
|
|
569
520
|
}
|
|
570
521
|
|
|
@@ -573,22 +524,16 @@
|
|
|
573
524
|
color: color-mix(in oklab, var(--destructive) 84%, var(--muted-foreground));
|
|
574
525
|
}
|
|
575
526
|
|
|
576
|
-
.slex-input-field[data-invalid="true"] .slex-input-step {
|
|
577
|
-
border-color: color-mix(in oklab, var(--destructive) 72%, var(--input));
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
.slex-input-field[data-invalid="true"] .slex-input-controls {
|
|
581
|
-
border-color: color-mix(in oklab, var(--destructive) 72%, var(--input));
|
|
582
|
-
}
|
|
583
|
-
|
|
584
527
|
.slex-input-field[data-invalid="true"] .slex-input-control:focus-within {
|
|
585
528
|
box-shadow: 0 0 0 2px color-mix(in oklab, var(--destructive) 18%, transparent);
|
|
586
529
|
}
|
|
587
530
|
|
|
531
|
+
.slex-input-field[data-invalid="true"] .slex-input-control:not([data-has-unit]):focus-within {
|
|
532
|
+
box-shadow: none;
|
|
533
|
+
}
|
|
534
|
+
|
|
588
535
|
.slex-input-field[data-invalid="true"] .slex-input-control:focus-within .slex-input,
|
|
589
|
-
.slex-input-field[data-invalid="true"] .slex-input-control:focus-within .slex-input-unit
|
|
590
|
-
.slex-input-field[data-invalid="true"] .slex-input-control:focus-within .slex-input-controls,
|
|
591
|
-
.slex-input-field[data-invalid="true"] .slex-input-control:focus-within .slex-input-step {
|
|
536
|
+
.slex-input-field[data-invalid="true"] .slex-input-control:focus-within .slex-input-unit {
|
|
592
537
|
border-color: var(--destructive);
|
|
593
538
|
}
|
|
594
539
|
|
|
@@ -602,11 +547,6 @@
|
|
|
602
547
|
cursor: not-allowed;
|
|
603
548
|
}
|
|
604
549
|
|
|
605
|
-
.slex-input[disabled] ~ .slex-input-controls,
|
|
606
|
-
.slex-input[readonly] ~ .slex-input-controls {
|
|
607
|
-
opacity: 0.6;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
550
|
.slex-input-description {
|
|
611
551
|
color: var(--muted-foreground);
|
|
612
552
|
font-size: 0.75rem;
|
|
@@ -734,7 +674,6 @@
|
|
|
734
674
|
border: 0;
|
|
735
675
|
overflow: hidden;
|
|
736
676
|
clip: rect(0 0 0 0);
|
|
737
|
-
clip-path: inset(50%);
|
|
738
677
|
white-space: nowrap;
|
|
739
678
|
}
|
|
740
679
|
|
|
@@ -793,11 +732,6 @@
|
|
|
793
732
|
color: var(--accent-foreground);
|
|
794
733
|
}
|
|
795
734
|
|
|
796
|
-
.slex-select-menu:has(.slex-select-option:hover) .slex-select-option--active:not(:hover) {
|
|
797
|
-
background: transparent;
|
|
798
|
-
color: var(--popover-foreground, var(--foreground));
|
|
799
|
-
}
|
|
800
|
-
|
|
801
735
|
.slex-select-option--selected {
|
|
802
736
|
font-weight: 500;
|
|
803
737
|
}
|
|
@@ -1236,8 +1170,8 @@
|
|
|
1236
1170
|
transform: none;
|
|
1237
1171
|
}
|
|
1238
1172
|
|
|
1239
|
-
.slex-checkbox-field
|
|
1240
|
-
.slex-radio-field
|
|
1173
|
+
.slex-checkbox-field[data-disabled="true"],
|
|
1174
|
+
.slex-radio-field[data-disabled="true"] {
|
|
1241
1175
|
cursor: not-allowed;
|
|
1242
1176
|
opacity: 0.65;
|
|
1243
1177
|
}
|
package/dist/components/input.js
CHANGED
|
@@ -117,26 +117,11 @@ function parseEngineeringNumber(input) {
|
|
|
117
117
|
var nextInputId = 0;
|
|
118
118
|
var root_1 = from_html(`<label class="slex-input-label"> </label>`);
|
|
119
119
|
var root_2 = from_html(`<span class="slex-input-unit" aria-hidden="true"> </span>`);
|
|
120
|
-
var root_3 = from_html(`<
|
|
121
|
-
var root_4 = from_html(`<div class="slex-input-
|
|
122
|
-
var
|
|
123
|
-
var root = from_html(`<div class="slex-input-field"><!> <div class="slex-input-control"><input class="slex-input"/> <!> <!></div> <!> <!></div>`);
|
|
120
|
+
var root_3 = from_html(`<div class="slex-input-description"> </div>`);
|
|
121
|
+
var root_4 = from_html(`<div class="slex-input-error" role="alert"> </div>`);
|
|
122
|
+
var root = from_html(`<div class="slex-input-field"><!> <div class="slex-input-control"><input class="slex-input"/> <!></div> <!> <!></div>`);
|
|
124
123
|
function Input($$anchor, $$props) {
|
|
125
124
|
push($$props, true);
|
|
126
|
-
const engineeringPrefixFactors = {
|
|
127
|
-
p: 0.000000000001,
|
|
128
|
-
n: 0.000000001,
|
|
129
|
-
u: 0.000001,
|
|
130
|
-
"µ": 0.000001,
|
|
131
|
-
"碌": 0.000001,
|
|
132
|
-
m: 0.001,
|
|
133
|
-
k: 1000,
|
|
134
|
-
K: 1000,
|
|
135
|
-
M: 1e6,
|
|
136
|
-
meg: 1e6,
|
|
137
|
-
G: 1e9,
|
|
138
|
-
T: 1000000000000
|
|
139
|
-
};
|
|
140
125
|
let p = state(proxy({}));
|
|
141
126
|
let value = state("");
|
|
142
127
|
const fallbackId = `slex-input-${++nextInputId}`;
|
|
@@ -148,8 +133,6 @@ function Input($$anchor, $$props) {
|
|
|
148
133
|
const readonly = user_derived(() => bool(get(p).readonly) || bool(get(p).readOnly));
|
|
149
134
|
const required = user_derived(() => bool(get(p).required));
|
|
150
135
|
const invalid2 = user_derived(() => bool(get(p).invalid) || !!get(errorText));
|
|
151
|
-
const steppable = user_derived(isSteppableInput);
|
|
152
|
-
const controls = user_derived(() => get(steppable) && get(p).controls !== false && get(p).controls !== "false");
|
|
153
136
|
const componentId = user_derived(() => safeId($$props.componentName));
|
|
154
137
|
const inputId = user_derived(() => text(get(p).id) || (get(componentId) ? `slex-input-${get(componentId)}` : fallbackId));
|
|
155
138
|
const descriptionId = user_derived(() => `${get(inputId)}-description`);
|
|
@@ -160,10 +143,6 @@ function Input($$anchor, $$props) {
|
|
|
160
143
|
get(descriptionText) ? get(descriptionId) : "",
|
|
161
144
|
get(errorText) ? get(errorId) : ""
|
|
162
145
|
].filter(Boolean).join(" "));
|
|
163
|
-
const numericValue = user_derived(readNumericValue);
|
|
164
|
-
const controlLabel = user_derived(() => get(labelText) || text(get(p).placeholder) || $$props.componentName || "input");
|
|
165
|
-
const decrementDisabled = user_derived(() => !canStep(-1));
|
|
166
|
-
const incrementDisabled = user_derived(() => !canStep(1));
|
|
167
146
|
user_effect(() => bindPropStore($$props.props, (next) => {
|
|
168
147
|
set(p, next, true);
|
|
169
148
|
set(value, text(next.value), true);
|
|
@@ -174,72 +153,6 @@ function Input($$anchor, $$props) {
|
|
|
174
153
|
function inputType() {
|
|
175
154
|
return text(get(p).type, "text") === "engineering" ? "text" : text(get(p).type, "text");
|
|
176
155
|
}
|
|
177
|
-
function isSteppableInput() {
|
|
178
|
-
const kind = text(get(p).type, "text");
|
|
179
|
-
return kind === "number" || kind === "engineering" || get(p).min !== undefined || get(p).max !== undefined || get(p).step !== undefined;
|
|
180
|
-
}
|
|
181
|
-
function numericProp(input) {
|
|
182
|
-
if (input === undefined || input === null || input === "")
|
|
183
|
-
return;
|
|
184
|
-
const next = Number(input);
|
|
185
|
-
return Number.isFinite(next) ? next : undefined;
|
|
186
|
-
}
|
|
187
|
-
function stepSize() {
|
|
188
|
-
const next = numericProp(get(p).step);
|
|
189
|
-
if (next !== undefined && next > 0)
|
|
190
|
-
return next;
|
|
191
|
-
if (text(get(p).type, "text") !== "engineering")
|
|
192
|
-
return 1;
|
|
193
|
-
const parsed = parseEngineeringNumber(get(value));
|
|
194
|
-
if (!parsed.valid || !parsed.prefix)
|
|
195
|
-
return 1;
|
|
196
|
-
return engineeringPrefixFactors[parsed.prefix] ?? 1;
|
|
197
|
-
}
|
|
198
|
-
function readNumericValue() {
|
|
199
|
-
if (text(get(p).type, "text") === "engineering") {
|
|
200
|
-
const parsed = parseEngineeringNumber(get(value));
|
|
201
|
-
return parsed.valid && parsed.number !== null ? parsed.number : null;
|
|
202
|
-
}
|
|
203
|
-
const next = Number(get(value));
|
|
204
|
-
return Number.isFinite(next) ? next : null;
|
|
205
|
-
}
|
|
206
|
-
function clamp(next) {
|
|
207
|
-
const min = numericProp(get(p).min);
|
|
208
|
-
const max = numericProp(get(p).max);
|
|
209
|
-
let clamped = next;
|
|
210
|
-
if (min !== undefined)
|
|
211
|
-
clamped = Math.max(min, clamped);
|
|
212
|
-
if (max !== undefined)
|
|
213
|
-
clamped = Math.min(max, clamped);
|
|
214
|
-
return clamped;
|
|
215
|
-
}
|
|
216
|
-
function canStep(direction) {
|
|
217
|
-
if (!get(controls) || get(disabled) || get(readonly) || get(numericValue) === null)
|
|
218
|
-
return false;
|
|
219
|
-
return clamp(get(numericValue) + direction * stepSize()) !== get(numericValue);
|
|
220
|
-
}
|
|
221
|
-
function formatSteppedValue(next) {
|
|
222
|
-
if (text(get(p).type, "text") !== "engineering")
|
|
223
|
-
return text(next);
|
|
224
|
-
const parsed = parseEngineeringNumber(get(value));
|
|
225
|
-
if (!parsed.valid)
|
|
226
|
-
return text(next);
|
|
227
|
-
const factor = parsed.prefix ? engineeringPrefixFactors[parsed.prefix] : undefined;
|
|
228
|
-
const visibleNumber = factor ? next / factor : next;
|
|
229
|
-
return `${formatNumber(visibleNumber)}${parsed.prefix}${parsed.unit}`;
|
|
230
|
-
}
|
|
231
|
-
function formatNumber(next) {
|
|
232
|
-
return text(Number(next.toPrecision(12)));
|
|
233
|
-
}
|
|
234
|
-
function emitValue(nextValue) {
|
|
235
|
-
set(value, nextValue, true);
|
|
236
|
-
emit($$props.ctx, "change", text(get(p).type, "text") === "engineering" ? parseEngineeringNumber(get(value)) : get(value));
|
|
237
|
-
}
|
|
238
|
-
function stepBy(direction) {
|
|
239
|
-
if (!canStep(direction) || get(numericValue) === null)
|
|
240
|
-
return;
|
|
241
|
-
emitValue(formatSteppedValue(clamp(get(numericValue) + direction * stepSize())));
|
|
242
|
-
}
|
|
243
156
|
function update(event) {
|
|
244
157
|
if (get(disabled) || get(readonly))
|
|
245
158
|
return;
|
|
@@ -265,9 +178,9 @@ function Input($$anchor, $$props) {
|
|
|
265
178
|
});
|
|
266
179
|
}
|
|
267
180
|
var div_1 = sibling(node, 2);
|
|
268
|
-
var
|
|
269
|
-
remove_input_defaults(
|
|
270
|
-
var node_1 = sibling(
|
|
181
|
+
var input = child(div_1);
|
|
182
|
+
remove_input_defaults(input);
|
|
183
|
+
var node_1 = sibling(input, 2);
|
|
271
184
|
{
|
|
272
185
|
var consequent_1 = ($$anchor2) => {
|
|
273
186
|
var span = root_2();
|
|
@@ -281,33 +194,11 @@ function Input($$anchor, $$props) {
|
|
|
281
194
|
$$render(consequent_1);
|
|
282
195
|
});
|
|
283
196
|
}
|
|
284
|
-
var node_2 = sibling(node_1, 2);
|
|
285
|
-
{
|
|
286
|
-
var consequent_2 = ($$anchor2) => {
|
|
287
|
-
var span_1 = root_3();
|
|
288
|
-
var button = child(span_1);
|
|
289
|
-
var button_1 = sibling(button, 2);
|
|
290
|
-
reset(span_1);
|
|
291
|
-
template_effect(() => {
|
|
292
|
-
set_attribute(button, "aria-label", `Increase ${get(controlLabel)}`);
|
|
293
|
-
button.disabled = get(incrementDisabled);
|
|
294
|
-
set_attribute(button_1, "aria-label", `Decrease ${get(controlLabel)}`);
|
|
295
|
-
button_1.disabled = get(decrementDisabled);
|
|
296
|
-
});
|
|
297
|
-
delegated("click", button, () => stepBy(1));
|
|
298
|
-
delegated("click", button_1, () => stepBy(-1));
|
|
299
|
-
append($$anchor2, span_1);
|
|
300
|
-
};
|
|
301
|
-
if_block(node_2, ($$render) => {
|
|
302
|
-
if (get(controls))
|
|
303
|
-
$$render(consequent_2);
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
197
|
reset(div_1);
|
|
307
|
-
var
|
|
198
|
+
var node_2 = sibling(div_1, 2);
|
|
308
199
|
{
|
|
309
|
-
var
|
|
310
|
-
var div_2 =
|
|
200
|
+
var consequent_2 = ($$anchor2) => {
|
|
201
|
+
var div_2 = root_3();
|
|
311
202
|
var text_3 = child(div_2, true);
|
|
312
203
|
reset(div_2);
|
|
313
204
|
template_effect(() => {
|
|
@@ -316,15 +207,15 @@ function Input($$anchor, $$props) {
|
|
|
316
207
|
});
|
|
317
208
|
append($$anchor2, div_2);
|
|
318
209
|
};
|
|
319
|
-
if_block(
|
|
210
|
+
if_block(node_2, ($$render) => {
|
|
320
211
|
if (get(descriptionText))
|
|
321
|
-
$$render(
|
|
212
|
+
$$render(consequent_2);
|
|
322
213
|
});
|
|
323
214
|
}
|
|
324
|
-
var
|
|
215
|
+
var node_3 = sibling(node_2, 2);
|
|
325
216
|
{
|
|
326
|
-
var
|
|
327
|
-
var div_3 =
|
|
217
|
+
var consequent_3 = ($$anchor2) => {
|
|
218
|
+
var div_3 = root_4();
|
|
328
219
|
var text_4 = child(div_3, true);
|
|
329
220
|
reset(div_3);
|
|
330
221
|
template_effect(() => {
|
|
@@ -333,9 +224,9 @@ function Input($$anchor, $$props) {
|
|
|
333
224
|
});
|
|
334
225
|
append($$anchor2, div_3);
|
|
335
226
|
};
|
|
336
|
-
if_block(
|
|
227
|
+
if_block(node_3, ($$render) => {
|
|
337
228
|
if (get(errorText))
|
|
338
|
-
$$render(
|
|
229
|
+
$$render(consequent_3);
|
|
339
230
|
});
|
|
340
231
|
}
|
|
341
232
|
reset(div);
|
|
@@ -344,21 +235,20 @@ function Input($$anchor, $$props) {
|
|
|
344
235
|
set_attribute(div, "data-required", get(required) ? "true" : undefined);
|
|
345
236
|
set_attribute(div, "data-readonly", get(readonly) ? "true" : undefined);
|
|
346
237
|
set_attribute(div_1, "data-has-unit", get(unitText) ? "true" : undefined);
|
|
347
|
-
set_attribute(
|
|
348
|
-
set_attribute(
|
|
349
|
-
set_attribute(
|
|
350
|
-
set_attribute(
|
|
351
|
-
set_attribute(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
set_attribute(
|
|
357
|
-
set_attribute(
|
|
358
|
-
set_attribute(
|
|
359
|
-
set_attribute(
|
|
360
|
-
set_attribute(
|
|
361
|
-
set_attribute(input_1, "aria-invalid", get(invalid2) ? "true" : undefined);
|
|
238
|
+
set_attribute(input, "id", get(inputId));
|
|
239
|
+
set_attribute(input, "type", $0);
|
|
240
|
+
set_attribute(input, "inputmode", $1);
|
|
241
|
+
set_attribute(input, "name", $2);
|
|
242
|
+
set_attribute(input, "placeholder", $3);
|
|
243
|
+
input.disabled = get(disabled);
|
|
244
|
+
input.readOnly = get(readonly);
|
|
245
|
+
input.required = get(required);
|
|
246
|
+
set_attribute(input, "min", $4);
|
|
247
|
+
set_attribute(input, "max", $5);
|
|
248
|
+
set_attribute(input, "step", $6);
|
|
249
|
+
set_attribute(input, "aria-label", get(computedAriaLabel) || undefined);
|
|
250
|
+
set_attribute(input, "aria-describedby", get(describedBy) || undefined);
|
|
251
|
+
set_attribute(input, "aria-invalid", get(invalid2) ? "true" : undefined);
|
|
362
252
|
}, [
|
|
363
253
|
() => inputType(),
|
|
364
254
|
() => text(get(p).type, "text") === "engineering" ? "decimal" : undefined,
|
|
@@ -368,12 +258,12 @@ function Input($$anchor, $$props) {
|
|
|
368
258
|
() => get(p).max === undefined ? undefined : text(get(p).max),
|
|
369
259
|
() => get(p).step === undefined ? undefined : text(get(p).step)
|
|
370
260
|
]);
|
|
371
|
-
delegated("input",
|
|
372
|
-
bind_value(
|
|
261
|
+
delegated("input", input, update);
|
|
262
|
+
bind_value(input, () => get(value), ($$value) => set(value, $$value));
|
|
373
263
|
append($$anchor, div);
|
|
374
264
|
pop();
|
|
375
265
|
}
|
|
376
|
-
delegate(["input"
|
|
266
|
+
delegate(["input"]);
|
|
377
267
|
|
|
378
268
|
// src/components/entries/input.ts
|
|
379
269
|
register("input", createSvelteRenderer("input", Input), { state: "value" });
|
|
@@ -150,6 +150,7 @@ function RadioGroup($$anchor, $$props) {
|
|
|
150
150
|
reset(label);
|
|
151
151
|
reset(span_1);
|
|
152
152
|
template_effect(($0, $1, $2) => {
|
|
153
|
+
set_attribute(label, "data-disabled", get(disabled) ? "true" : undefined);
|
|
153
154
|
set_attribute(input, "name", $0);
|
|
154
155
|
set_value(input, $1);
|
|
155
156
|
set_checked(input, get(itemValue) === get(value));
|
|
@@ -110,7 +110,6 @@
|
|
|
110
110
|
border: 0;
|
|
111
111
|
overflow: hidden;
|
|
112
112
|
clip: rect(0 0 0 0);
|
|
113
|
-
clip-path: inset(50%);
|
|
114
113
|
white-space: nowrap;
|
|
115
114
|
}
|
|
116
115
|
|
|
@@ -169,11 +168,6 @@
|
|
|
169
168
|
color: var(--accent-foreground);
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
.slex-select-menu:has(.slex-select-option:hover) .slex-select-option--active:not(:hover) {
|
|
173
|
-
background: transparent;
|
|
174
|
-
color: var(--popover-foreground, var(--foreground));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
171
|
.slex-select-option--selected {
|
|
178
172
|
font-weight: 500;
|
|
179
173
|
}
|
|
@@ -33,53 +33,62 @@
|
|
|
33
33
|
.slex-slider {
|
|
34
34
|
box-sizing: border-box;
|
|
35
35
|
width: 100%;
|
|
36
|
-
height:
|
|
36
|
+
height: 1rem;
|
|
37
|
+
padding: 0;
|
|
38
|
+
border: 0;
|
|
37
39
|
border-radius: 999px;
|
|
38
40
|
-webkit-appearance: none;
|
|
39
41
|
appearance: none;
|
|
40
|
-
background:
|
|
41
|
-
to right,
|
|
42
|
-
var(--primary) 0%,
|
|
43
|
-
var(--primary) var(--slex-slider-progress, 0%),
|
|
44
|
-
var(--secondary) var(--slex-slider-progress, 0%),
|
|
45
|
-
var(--secondary) 100%
|
|
46
|
-
);
|
|
42
|
+
background: transparent;
|
|
47
43
|
accent-color: var(--primary);
|
|
48
44
|
cursor: pointer;
|
|
45
|
+
overflow: visible;
|
|
49
46
|
transition: box-shadow 150ms ease, filter 150ms ease;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
.slex-slider:hover {
|
|
53
|
-
box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 8%, transparent);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.slex-slider:active {
|
|
57
|
-
box-shadow: 0 0 0 5px color-mix(in oklab, var(--primary) 12%, transparent);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
.slex-slider:focus-visible {
|
|
61
50
|
outline: 2px solid var(--ring);
|
|
62
51
|
outline-offset: 4px;
|
|
63
52
|
}
|
|
64
53
|
|
|
65
54
|
.slex-slider::-webkit-slider-thumb {
|
|
55
|
+
box-sizing: border-box;
|
|
66
56
|
width: 1rem;
|
|
67
57
|
height: 1rem;
|
|
58
|
+
margin-top: -0.25rem;
|
|
68
59
|
border: 2px solid var(--primary);
|
|
69
60
|
border-radius: 999px;
|
|
70
|
-
background: var(--background)
|
|
61
|
+
background-color: var(--background);
|
|
62
|
+
background-clip: padding-box;
|
|
71
63
|
box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 14%, transparent);
|
|
72
64
|
-webkit-appearance: none;
|
|
73
65
|
appearance: none;
|
|
74
66
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
|
|
75
67
|
}
|
|
76
68
|
|
|
69
|
+
.slex-slider::-webkit-slider-runnable-track {
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 0.5rem;
|
|
73
|
+
border: 0;
|
|
74
|
+
border-radius: 999px;
|
|
75
|
+
background: linear-gradient(
|
|
76
|
+
to right,
|
|
77
|
+
var(--primary) 0%,
|
|
78
|
+
var(--primary) var(--slex-slider-progress, 0%),
|
|
79
|
+
var(--secondary) var(--slex-slider-progress, 0%),
|
|
80
|
+
var(--secondary) 100%
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
.slex-slider::-moz-range-thumb {
|
|
85
|
+
box-sizing: border-box;
|
|
78
86
|
width: 1rem;
|
|
79
87
|
height: 1rem;
|
|
80
88
|
border: 2px solid var(--primary);
|
|
81
89
|
border-radius: 999px;
|
|
82
|
-
background: var(--background)
|
|
90
|
+
background-color: var(--background);
|
|
91
|
+
background-clip: padding-box;
|
|
83
92
|
box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 14%, transparent);
|
|
84
93
|
transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
|
|
85
94
|
}
|
package/dist/components/specs.js
CHANGED
|
@@ -526,7 +526,6 @@ var inputSpec = component({
|
|
|
526
526
|
min: { type: "string | number", dynamic: true, description: "Minimum value used by numeric input controls." },
|
|
527
527
|
max: { type: "string | number", dynamic: true, description: "Maximum value used by numeric input controls." },
|
|
528
528
|
step: { type: "string | number", dynamic: true, description: "Step size used by numeric input controls." },
|
|
529
|
-
controls: { type: "boolean", default: true, dynamic: true, description: "Show decrement and increment buttons for numeric inputs." },
|
|
530
529
|
onchange: { type: "write-expression", description: "Write expression invoked when the value changes." }
|
|
531
530
|
},
|
|
532
531
|
children: noChildren,
|
|
@@ -1034,6 +1033,8 @@ var textSpec = component({
|
|
|
1034
1033
|
content: { type: "string", dynamic: true, description: "Alias for text." },
|
|
1035
1034
|
label: { type: "string", dynamic: true, description: "Alias for text." },
|
|
1036
1035
|
variant: { type: "string", values: ["default", "muted"], default: "default", description: "Text visual variant." },
|
|
1036
|
+
color: { type: "string", dynamic: true, description: "Optional CSS color for controlled previews." },
|
|
1037
|
+
size: { type: "string | number", dynamic: true, description: "Optional font size. Numbers are treated as px." },
|
|
1037
1038
|
class: { type: "string", description: "Additional host-controlled CSS class." }
|
|
1038
1039
|
},
|
|
1039
1040
|
children: noChildren,
|