slexkit 0.3.1 → 0.3.3
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/ai/llms-full.txt +53 -21
- package/dist/ai/llms.txt +1 -1
- package/dist/ai/slexkit-ai-manifest.json +29 -29
- package/dist/base.css +0 -46
- package/dist/components/index.js +12 -10
- package/dist/components/input.css +85 -13
- package/dist/components/slider.css +56 -13
- package/dist/components/slider.js +12 -10
- package/dist/components/text-input.css +29 -0
- package/dist/runtime.cjs +46 -24
- package/dist/runtime.js +46 -24
- package/dist/slexkit.cjs +58 -34
- package/dist/slexkit.css +85 -59
- package/dist/slexkit.js +58 -34
- package/dist/types/engine/types.d.ts +1 -1
- package/dist/types/version.d.ts +2 -2
- package/dist/umd/slexkit.tooling.umd.js +57 -33
- package/dist/umd/slexkit.umd.js +58 -34
- package/package.json +1 -1
- package/src/components/svelte/input/Slider.svelte +15 -13
- package/src/styles/components/slider.css +56 -13
- package/src/styles/components/text-input.css +29 -0
- package/src/styles/layout.css +0 -46
|
@@ -30,22 +30,71 @@
|
|
|
30
30
|
font-weight: 600;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
.slex-slider-control {
|
|
34
|
+
position: relative;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 1rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.slex-slider-track {
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset-inline: 0;
|
|
43
|
+
top: 50%;
|
|
44
|
+
height: 0.5rem;
|
|
45
|
+
border-radius: 999px;
|
|
46
|
+
background: linear-gradient(
|
|
47
|
+
to right,
|
|
48
|
+
var(--primary) 0%,
|
|
49
|
+
var(--primary) var(--slex-slider-progress, 0%),
|
|
50
|
+
var(--secondary) var(--slex-slider-progress, 0%),
|
|
51
|
+
var(--secondary) 100%
|
|
52
|
+
);
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
transform: translateY(-50%);
|
|
55
|
+
}
|
|
56
|
+
|
|
33
57
|
.slex-slider {
|
|
58
|
+
position: relative;
|
|
59
|
+
z-index: 1;
|
|
34
60
|
box-sizing: border-box;
|
|
61
|
+
display: block;
|
|
35
62
|
width: 100%;
|
|
36
63
|
height: 1rem;
|
|
64
|
+
margin: 0;
|
|
37
65
|
padding: 0;
|
|
38
66
|
border: 0;
|
|
39
67
|
border-radius: 999px;
|
|
40
68
|
-webkit-appearance: none;
|
|
41
69
|
appearance: none;
|
|
42
70
|
background: transparent;
|
|
71
|
+
color: transparent;
|
|
43
72
|
accent-color: var(--primary);
|
|
44
73
|
cursor: pointer;
|
|
45
74
|
overflow: visible;
|
|
46
75
|
transition: box-shadow 150ms ease, filter 150ms ease;
|
|
47
76
|
}
|
|
48
77
|
|
|
78
|
+
.slexkit-root .slex-slider-control input.slex-slider {
|
|
79
|
+
position: relative;
|
|
80
|
+
z-index: 1;
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
display: block;
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 1rem;
|
|
85
|
+
min-height: 0;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
border-radius: 999px;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
background: transparent;
|
|
92
|
+
color: transparent;
|
|
93
|
+
-webkit-appearance: none;
|
|
94
|
+
appearance: none;
|
|
95
|
+
overflow: visible;
|
|
96
|
+
}
|
|
97
|
+
|
|
49
98
|
.slex-slider:focus-visible {
|
|
50
99
|
outline: 2px solid var(--ring);
|
|
51
100
|
outline-offset: 4px;
|
|
@@ -55,7 +104,7 @@
|
|
|
55
104
|
box-sizing: border-box;
|
|
56
105
|
width: 1rem;
|
|
57
106
|
height: 1rem;
|
|
58
|
-
margin-top:
|
|
107
|
+
margin-top: 0;
|
|
59
108
|
border: 2px solid var(--primary);
|
|
60
109
|
border-radius: 999px;
|
|
61
110
|
background-color: var(--background);
|
|
@@ -69,16 +118,10 @@
|
|
|
69
118
|
.slex-slider::-webkit-slider-runnable-track {
|
|
70
119
|
box-sizing: border-box;
|
|
71
120
|
width: 100%;
|
|
72
|
-
height:
|
|
121
|
+
height: 1rem;
|
|
73
122
|
border: 0;
|
|
74
123
|
border-radius: 999px;
|
|
75
|
-
background:
|
|
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
|
-
);
|
|
124
|
+
background: transparent;
|
|
82
125
|
}
|
|
83
126
|
|
|
84
127
|
.slex-slider::-moz-range-thumb {
|
|
@@ -114,16 +157,16 @@
|
|
|
114
157
|
}
|
|
115
158
|
|
|
116
159
|
.slex-slider::-moz-range-track {
|
|
117
|
-
height:
|
|
160
|
+
height: 1rem;
|
|
118
161
|
border: 0;
|
|
119
162
|
border-radius: 999px;
|
|
120
|
-
background:
|
|
163
|
+
background: transparent;
|
|
121
164
|
}
|
|
122
165
|
|
|
123
166
|
.slex-slider::-moz-range-progress {
|
|
124
|
-
height:
|
|
167
|
+
height: 1rem;
|
|
125
168
|
border-radius: 999px;
|
|
126
|
-
background:
|
|
169
|
+
background: transparent;
|
|
127
170
|
}
|
|
128
171
|
|
|
129
172
|
.slex-slider-label-text {
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
import { register } from "../runtime.js";
|
|
35
35
|
|
|
36
36
|
// src/components/svelte/input/Slider.svelte
|
|
37
|
-
var root = from_html(`<div class="slex-slider-field"><div class="slex-slider-label"><span class="slex-slider-label-text"><!> <span> </span></span> <span class="slex-slider-value"> <!></span></div> <input type="range" class="slex-slider"/></div>`);
|
|
37
|
+
var root = from_html(`<div class="slex-slider-field"><div class="slex-slider-label"><span class="slex-slider-label-text"><!> <span> </span></span> <span class="slex-slider-value"> <!></span></div> <div class="slex-slider-control"><span class="slex-slider-track" aria-hidden="true"></span> <input type="range" class="slex-slider"/></div></div>`);
|
|
38
38
|
function Slider($$anchor, $$props) {
|
|
39
39
|
push($$props, true);
|
|
40
40
|
let p = state(proxy({}));
|
|
@@ -134,30 +134,32 @@ function Slider($$anchor, $$props) {
|
|
|
134
134
|
}
|
|
135
135
|
reset(span_2);
|
|
136
136
|
reset(div_1);
|
|
137
|
-
var
|
|
137
|
+
var div_2 = sibling(div_1, 2);
|
|
138
|
+
var input_1 = sibling(child(div_2), 2);
|
|
138
139
|
remove_input_defaults(input_1);
|
|
140
|
+
reset(div_2);
|
|
139
141
|
reset(div);
|
|
140
142
|
template_effect(($0, $1, $2, $3, $4, $5, $6, $7, $8) => {
|
|
141
143
|
set_attribute(div, "data-orientation", $0);
|
|
142
144
|
set_text(text_1, $1);
|
|
143
145
|
set_text(text_2, $2);
|
|
144
|
-
|
|
145
|
-
set_attribute(input_1, "
|
|
146
|
-
set_attribute(input_1, "
|
|
147
|
-
|
|
146
|
+
set_style(div_2, $3);
|
|
147
|
+
set_attribute(input_1, "min", $4);
|
|
148
|
+
set_attribute(input_1, "max", $5);
|
|
149
|
+
set_attribute(input_1, "step", $6);
|
|
150
|
+
set_value(input_1, $7);
|
|
148
151
|
input_1.disabled = !!get(p).disabled;
|
|
149
|
-
set_attribute(input_1, "aria-label", $
|
|
150
|
-
set_style(input_1, $8);
|
|
152
|
+
set_attribute(input_1, "aria-label", $8);
|
|
151
153
|
}, [
|
|
152
154
|
() => text2(get(p).orientation, "horizontal"),
|
|
153
155
|
() => text2(get(p).label ?? $$props.componentName),
|
|
154
156
|
() => text2(get(value) ?? 0),
|
|
157
|
+
() => `--slex-slider-progress: ${sliderProgress(get(value), get(p).min, get(p).max)}`,
|
|
155
158
|
() => Number(get(p).min ?? 0),
|
|
156
159
|
() => Number(get(p).max ?? 100),
|
|
157
160
|
() => Number(get(p).step ?? 1),
|
|
158
161
|
() => Number(get(value) ?? 0),
|
|
159
|
-
() => text2(get(p)["aria-label"] ?? get(p).ariaLabel ?? get(p).label ?? $$props.componentName)
|
|
160
|
-
() => `--slex-slider-progress: ${sliderProgress(get(value), get(p).min, get(p).max)}`
|
|
162
|
+
() => text2(get(p)["aria-label"] ?? get(p).ariaLabel ?? get(p).label ?? $$props.componentName)
|
|
161
163
|
]);
|
|
162
164
|
delegated("pointerdown", input_1, grabSlider);
|
|
163
165
|
delegated("input", input_1, (event) => choose(Number(event.target.value)));
|
|
@@ -56,11 +56,40 @@
|
|
|
56
56
|
transition: border-color 150ms ease, box-shadow 150ms ease;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
.slexkit-root .slex-input-control input.slex-input {
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
display: block;
|
|
62
|
+
flex: 1 1 auto;
|
|
63
|
+
width: 100%;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
min-height: 2.5625rem;
|
|
66
|
+
height: auto;
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: 0.5rem 0.75rem;
|
|
69
|
+
border: 1px solid var(--input);
|
|
70
|
+
border-radius: var(--radius);
|
|
71
|
+
box-shadow: none;
|
|
72
|
+
background: var(--background);
|
|
73
|
+
background-clip: padding-box;
|
|
74
|
+
color: var(--foreground);
|
|
75
|
+
font-family: inherit;
|
|
76
|
+
font-size: 0.875rem;
|
|
77
|
+
line-height: 1.5;
|
|
78
|
+
outline: none;
|
|
79
|
+
-webkit-appearance: none;
|
|
80
|
+
appearance: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
59
83
|
.slex-input-control[data-has-unit="true"] .slex-input {
|
|
60
84
|
border-top-right-radius: 0;
|
|
61
85
|
border-bottom-right-radius: 0;
|
|
62
86
|
}
|
|
63
87
|
|
|
88
|
+
.slexkit-root .slex-input-control[data-has-unit="true"] input.slex-input {
|
|
89
|
+
border-top-right-radius: 0;
|
|
90
|
+
border-bottom-right-radius: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
64
93
|
.slex-input-unit {
|
|
65
94
|
box-sizing: border-box;
|
|
66
95
|
display: inline-flex;
|
package/dist/runtime.cjs
CHANGED
|
@@ -468,19 +468,31 @@ function configureComponentScope(options) {
|
|
|
468
468
|
function createComponentAccessor(read) {
|
|
469
469
|
const subscribers = new Set;
|
|
470
470
|
let current = read();
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
471
|
+
let stopEffect;
|
|
472
|
+
const start = () => {
|
|
473
|
+
if (stopEffect)
|
|
474
|
+
return;
|
|
475
|
+
stopEffect = createEffect(() => {
|
|
476
476
|
current = read();
|
|
477
|
-
for (const subscriber of subscribers)
|
|
477
|
+
for (const subscriber of Array.from(subscribers))
|
|
478
478
|
subscriber(current);
|
|
479
479
|
flushDom?.();
|
|
480
480
|
});
|
|
481
|
+
};
|
|
482
|
+
const accessor = () => current;
|
|
483
|
+
accessor.subscribe = (run) => {
|
|
484
|
+
const wasIdle = subscribers.size === 0;
|
|
485
|
+
subscribers.add(run);
|
|
486
|
+
if (wasIdle)
|
|
487
|
+
start();
|
|
488
|
+
else
|
|
489
|
+
run(current);
|
|
481
490
|
return () => {
|
|
482
491
|
subscribers.delete(run);
|
|
483
|
-
|
|
492
|
+
if (subscribers.size === 0) {
|
|
493
|
+
stopEffect?.();
|
|
494
|
+
stopEffect = undefined;
|
|
495
|
+
}
|
|
484
496
|
};
|
|
485
497
|
};
|
|
486
498
|
return accessor;
|
|
@@ -1331,9 +1343,10 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1331
1343
|
const renderer = getRenderer(type);
|
|
1332
1344
|
if (!renderer)
|
|
1333
1345
|
return;
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
|
|
1346
|
+
const doc = container.ownerDocument || document;
|
|
1347
|
+
const startAnchor = doc.createComment(`slexkit-for:${fullKey}:start`);
|
|
1348
|
+
const endAnchor = doc.createComment(`slexkit-for:${fullKey}:end`);
|
|
1349
|
+
container.append(startAnchor, endAnchor);
|
|
1337
1350
|
const evalCtx = buildComponentEvalContext(g, components, componentTypes, api, forCtx);
|
|
1338
1351
|
const items = createMemo(() => trackForCollection(evalRead(props.$for, evalCtx, ns, `${fullKey}:$for`)));
|
|
1339
1352
|
const $keyProp = props.$key;
|
|
@@ -1346,8 +1359,10 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1346
1359
|
disposedSlots.add(slot);
|
|
1347
1360
|
leavingSlots.delete(slot);
|
|
1348
1361
|
callHook(g, name, "onUnmount");
|
|
1349
|
-
|
|
1350
|
-
|
|
1362
|
+
if (slot.el) {
|
|
1363
|
+
disposeComponent(slot.el);
|
|
1364
|
+
slot.el.remove();
|
|
1365
|
+
}
|
|
1351
1366
|
if (slot.dispose)
|
|
1352
1367
|
slot.dispose();
|
|
1353
1368
|
};
|
|
@@ -1372,12 +1387,16 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1372
1387
|
}
|
|
1373
1388
|
}
|
|
1374
1389
|
for (const slot of deletedSlots) {
|
|
1375
|
-
container.appendChild(slot.el);
|
|
1376
1390
|
leavingSlots.add(slot);
|
|
1391
|
+
if (!slot.el) {
|
|
1392
|
+
disposeSlot(slot);
|
|
1393
|
+
continue;
|
|
1394
|
+
}
|
|
1377
1395
|
applyLeaveAnimation(slot.el, slot.props, () => {
|
|
1378
1396
|
disposeSlot(slot);
|
|
1379
1397
|
});
|
|
1380
1398
|
}
|
|
1399
|
+
let cursor = startAnchor;
|
|
1381
1400
|
arr.forEach((item, index) => {
|
|
1382
1401
|
item = asReactiveValue(item, g);
|
|
1383
1402
|
const keyVal = newKeys[index];
|
|
@@ -1405,20 +1424,22 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1405
1424
|
const indexSignal = createSignal(index);
|
|
1406
1425
|
const revisionSignal = createSignal(0);
|
|
1407
1426
|
slot = renderAndMountSlot(item, index, keyVal, indexSignal, revisionSignal, renderer, type, name, props, container, g, components, componentTypes, api, forCtx, ns, fullKey, options);
|
|
1408
|
-
if (slot.el) {
|
|
1409
|
-
|
|
1410
|
-
|
|
1427
|
+
if (!slot.el) {
|
|
1428
|
+
disposeSlot(slot);
|
|
1429
|
+
return;
|
|
1411
1430
|
}
|
|
1431
|
+
applyEnterAnimation(slot.el, slot.props);
|
|
1432
|
+
callHook(g, name, "onMount");
|
|
1412
1433
|
slotMap.set(keyVal, slot);
|
|
1413
1434
|
}
|
|
1414
|
-
const
|
|
1415
|
-
if (slot.el &&
|
|
1416
|
-
|
|
1435
|
+
const nextChild = cursor.nextSibling;
|
|
1436
|
+
if (slot.el && nextChild !== slot.el) {
|
|
1437
|
+
container.insertBefore(slot.el, nextChild ?? endAnchor);
|
|
1438
|
+
}
|
|
1439
|
+
if (slot.el) {
|
|
1440
|
+
cursor = slot.el;
|
|
1417
1441
|
}
|
|
1418
1442
|
});
|
|
1419
|
-
while (forWrapper.children.length > arr.length) {
|
|
1420
|
-
forWrapper.lastChild.remove();
|
|
1421
|
-
}
|
|
1422
1443
|
});
|
|
1423
1444
|
onCleanup(() => {
|
|
1424
1445
|
for (const slot of Array.from(slotMap.values()))
|
|
@@ -1426,7 +1447,8 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1426
1447
|
slotMap.clear();
|
|
1427
1448
|
for (const slot of Array.from(leavingSlots))
|
|
1428
1449
|
disposeSlot(slot);
|
|
1429
|
-
|
|
1450
|
+
startAnchor.remove();
|
|
1451
|
+
endAnchor.remove();
|
|
1430
1452
|
});
|
|
1431
1453
|
}
|
|
1432
1454
|
function renderNormalNode(fullKey, props, container, g, components, componentTypes, api, forCtx, ns, options) {
|
|
@@ -1803,7 +1825,7 @@ ${parseSource}
|
|
|
1803
1825
|
var parseSlexKitDsl = parseSlexSource;
|
|
1804
1826
|
|
|
1805
1827
|
// src/version.ts
|
|
1806
|
-
var SLEXKIT_VERSION = "0.3.
|
|
1828
|
+
var SLEXKIT_VERSION = "0.3.3";
|
|
1807
1829
|
var SLEX_PROTOCOL_VERSION = "0.1";
|
|
1808
1830
|
var SLEXKIT_COMPONENTS_VERSION = SLEXKIT_VERSION;
|
|
1809
1831
|
function getSlexKitInfo() {
|
package/dist/runtime.js
CHANGED
|
@@ -396,19 +396,31 @@ function configureComponentScope(options) {
|
|
|
396
396
|
function createComponentAccessor(read) {
|
|
397
397
|
const subscribers = new Set;
|
|
398
398
|
let current = read();
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
399
|
+
let stopEffect;
|
|
400
|
+
const start = () => {
|
|
401
|
+
if (stopEffect)
|
|
402
|
+
return;
|
|
403
|
+
stopEffect = createEffect(() => {
|
|
404
404
|
current = read();
|
|
405
|
-
for (const subscriber of subscribers)
|
|
405
|
+
for (const subscriber of Array.from(subscribers))
|
|
406
406
|
subscriber(current);
|
|
407
407
|
flushDom?.();
|
|
408
408
|
});
|
|
409
|
+
};
|
|
410
|
+
const accessor = () => current;
|
|
411
|
+
accessor.subscribe = (run) => {
|
|
412
|
+
const wasIdle = subscribers.size === 0;
|
|
413
|
+
subscribers.add(run);
|
|
414
|
+
if (wasIdle)
|
|
415
|
+
start();
|
|
416
|
+
else
|
|
417
|
+
run(current);
|
|
409
418
|
return () => {
|
|
410
419
|
subscribers.delete(run);
|
|
411
|
-
|
|
420
|
+
if (subscribers.size === 0) {
|
|
421
|
+
stopEffect?.();
|
|
422
|
+
stopEffect = undefined;
|
|
423
|
+
}
|
|
412
424
|
};
|
|
413
425
|
};
|
|
414
426
|
return accessor;
|
|
@@ -1259,9 +1271,10 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1259
1271
|
const renderer = getRenderer(type);
|
|
1260
1272
|
if (!renderer)
|
|
1261
1273
|
return;
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
|
|
1274
|
+
const doc = container.ownerDocument || document;
|
|
1275
|
+
const startAnchor = doc.createComment(`slexkit-for:${fullKey}:start`);
|
|
1276
|
+
const endAnchor = doc.createComment(`slexkit-for:${fullKey}:end`);
|
|
1277
|
+
container.append(startAnchor, endAnchor);
|
|
1265
1278
|
const evalCtx = buildComponentEvalContext(g, components, componentTypes, api, forCtx);
|
|
1266
1279
|
const items = createMemo(() => trackForCollection(evalRead(props.$for, evalCtx, ns, `${fullKey}:$for`)));
|
|
1267
1280
|
const $keyProp = props.$key;
|
|
@@ -1274,8 +1287,10 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1274
1287
|
disposedSlots.add(slot);
|
|
1275
1288
|
leavingSlots.delete(slot);
|
|
1276
1289
|
callHook(g, name, "onUnmount");
|
|
1277
|
-
|
|
1278
|
-
|
|
1290
|
+
if (slot.el) {
|
|
1291
|
+
disposeComponent(slot.el);
|
|
1292
|
+
slot.el.remove();
|
|
1293
|
+
}
|
|
1279
1294
|
if (slot.dispose)
|
|
1280
1295
|
slot.dispose();
|
|
1281
1296
|
};
|
|
@@ -1300,12 +1315,16 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1300
1315
|
}
|
|
1301
1316
|
}
|
|
1302
1317
|
for (const slot of deletedSlots) {
|
|
1303
|
-
container.appendChild(slot.el);
|
|
1304
1318
|
leavingSlots.add(slot);
|
|
1319
|
+
if (!slot.el) {
|
|
1320
|
+
disposeSlot(slot);
|
|
1321
|
+
continue;
|
|
1322
|
+
}
|
|
1305
1323
|
applyLeaveAnimation(slot.el, slot.props, () => {
|
|
1306
1324
|
disposeSlot(slot);
|
|
1307
1325
|
});
|
|
1308
1326
|
}
|
|
1327
|
+
let cursor = startAnchor;
|
|
1309
1328
|
arr.forEach((item, index) => {
|
|
1310
1329
|
item = asReactiveValue(item, g);
|
|
1311
1330
|
const keyVal = newKeys[index];
|
|
@@ -1333,20 +1352,22 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1333
1352
|
const indexSignal = createSignal(index);
|
|
1334
1353
|
const revisionSignal = createSignal(0);
|
|
1335
1354
|
slot = renderAndMountSlot(item, index, keyVal, indexSignal, revisionSignal, renderer, type, name, props, container, g, components, componentTypes, api, forCtx, ns, fullKey, options);
|
|
1336
|
-
if (slot.el) {
|
|
1337
|
-
|
|
1338
|
-
|
|
1355
|
+
if (!slot.el) {
|
|
1356
|
+
disposeSlot(slot);
|
|
1357
|
+
return;
|
|
1339
1358
|
}
|
|
1359
|
+
applyEnterAnimation(slot.el, slot.props);
|
|
1360
|
+
callHook(g, name, "onMount");
|
|
1340
1361
|
slotMap.set(keyVal, slot);
|
|
1341
1362
|
}
|
|
1342
|
-
const
|
|
1343
|
-
if (slot.el &&
|
|
1344
|
-
|
|
1363
|
+
const nextChild = cursor.nextSibling;
|
|
1364
|
+
if (slot.el && nextChild !== slot.el) {
|
|
1365
|
+
container.insertBefore(slot.el, nextChild ?? endAnchor);
|
|
1366
|
+
}
|
|
1367
|
+
if (slot.el) {
|
|
1368
|
+
cursor = slot.el;
|
|
1345
1369
|
}
|
|
1346
1370
|
});
|
|
1347
|
-
while (forWrapper.children.length > arr.length) {
|
|
1348
|
-
forWrapper.lastChild.remove();
|
|
1349
|
-
}
|
|
1350
1371
|
});
|
|
1351
1372
|
onCleanup(() => {
|
|
1352
1373
|
for (const slot of Array.from(slotMap.values()))
|
|
@@ -1354,7 +1375,8 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1354
1375
|
slotMap.clear();
|
|
1355
1376
|
for (const slot of Array.from(leavingSlots))
|
|
1356
1377
|
disposeSlot(slot);
|
|
1357
|
-
|
|
1378
|
+
startAnchor.remove();
|
|
1379
|
+
endAnchor.remove();
|
|
1358
1380
|
});
|
|
1359
1381
|
}
|
|
1360
1382
|
function renderNormalNode(fullKey, props, container, g, components, componentTypes, api, forCtx, ns, options) {
|
|
@@ -1731,7 +1753,7 @@ ${parseSource}
|
|
|
1731
1753
|
var parseSlexKitDsl = parseSlexSource;
|
|
1732
1754
|
|
|
1733
1755
|
// src/version.ts
|
|
1734
|
-
var SLEXKIT_VERSION = "0.3.
|
|
1756
|
+
var SLEXKIT_VERSION = "0.3.3";
|
|
1735
1757
|
var SLEX_PROTOCOL_VERSION = "0.1";
|
|
1736
1758
|
var SLEXKIT_COMPONENTS_VERSION = SLEXKIT_VERSION;
|
|
1737
1759
|
function getSlexKitInfo() {
|
package/dist/slexkit.cjs
CHANGED
|
@@ -490,19 +490,31 @@ function configureComponentScope(options) {
|
|
|
490
490
|
function createComponentAccessor(read) {
|
|
491
491
|
const subscribers = new Set;
|
|
492
492
|
let current = read();
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
493
|
+
let stopEffect;
|
|
494
|
+
const start = () => {
|
|
495
|
+
if (stopEffect)
|
|
496
|
+
return;
|
|
497
|
+
stopEffect = createEffect(() => {
|
|
498
498
|
current = read();
|
|
499
|
-
for (const subscriber of subscribers)
|
|
499
|
+
for (const subscriber of Array.from(subscribers))
|
|
500
500
|
subscriber(current);
|
|
501
501
|
flushDom?.();
|
|
502
502
|
});
|
|
503
|
+
};
|
|
504
|
+
const accessor = () => current;
|
|
505
|
+
accessor.subscribe = (run) => {
|
|
506
|
+
const wasIdle = subscribers.size === 0;
|
|
507
|
+
subscribers.add(run);
|
|
508
|
+
if (wasIdle)
|
|
509
|
+
start();
|
|
510
|
+
else
|
|
511
|
+
run(current);
|
|
503
512
|
return () => {
|
|
504
513
|
subscribers.delete(run);
|
|
505
|
-
|
|
514
|
+
if (subscribers.size === 0) {
|
|
515
|
+
stopEffect?.();
|
|
516
|
+
stopEffect = undefined;
|
|
517
|
+
}
|
|
506
518
|
};
|
|
507
519
|
};
|
|
508
520
|
return accessor;
|
|
@@ -1353,9 +1365,10 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1353
1365
|
const renderer = getRenderer(type);
|
|
1354
1366
|
if (!renderer)
|
|
1355
1367
|
return;
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1358
|
-
|
|
1368
|
+
const doc = container.ownerDocument || document;
|
|
1369
|
+
const startAnchor = doc.createComment(`slexkit-for:${fullKey}:start`);
|
|
1370
|
+
const endAnchor = doc.createComment(`slexkit-for:${fullKey}:end`);
|
|
1371
|
+
container.append(startAnchor, endAnchor);
|
|
1359
1372
|
const evalCtx = buildComponentEvalContext(g, components, componentTypes, api, forCtx);
|
|
1360
1373
|
const items = createMemo(() => trackForCollection(evalRead(props.$for, evalCtx, ns, `${fullKey}:$for`)));
|
|
1361
1374
|
const $keyProp = props.$key;
|
|
@@ -1368,8 +1381,10 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1368
1381
|
disposedSlots.add(slot);
|
|
1369
1382
|
leavingSlots.delete(slot);
|
|
1370
1383
|
callHook(g, name, "onUnmount");
|
|
1371
|
-
|
|
1372
|
-
|
|
1384
|
+
if (slot.el) {
|
|
1385
|
+
disposeComponent(slot.el);
|
|
1386
|
+
slot.el.remove();
|
|
1387
|
+
}
|
|
1373
1388
|
if (slot.dispose)
|
|
1374
1389
|
slot.dispose();
|
|
1375
1390
|
};
|
|
@@ -1394,12 +1409,16 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1394
1409
|
}
|
|
1395
1410
|
}
|
|
1396
1411
|
for (const slot of deletedSlots) {
|
|
1397
|
-
container.appendChild(slot.el);
|
|
1398
1412
|
leavingSlots.add(slot);
|
|
1413
|
+
if (!slot.el) {
|
|
1414
|
+
disposeSlot(slot);
|
|
1415
|
+
continue;
|
|
1416
|
+
}
|
|
1399
1417
|
applyLeaveAnimation(slot.el, slot.props, () => {
|
|
1400
1418
|
disposeSlot(slot);
|
|
1401
1419
|
});
|
|
1402
1420
|
}
|
|
1421
|
+
let cursor = startAnchor;
|
|
1403
1422
|
arr.forEach((item, index) => {
|
|
1404
1423
|
item = asReactiveValue(item, g);
|
|
1405
1424
|
const keyVal = newKeys[index];
|
|
@@ -1427,20 +1446,22 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1427
1446
|
const indexSignal = createSignal(index);
|
|
1428
1447
|
const revisionSignal = createSignal(0);
|
|
1429
1448
|
slot = renderAndMountSlot(item, index, keyVal, indexSignal, revisionSignal, renderer, type, name, props, container, g, components, componentTypes, api, forCtx, ns, fullKey, options);
|
|
1430
|
-
if (slot.el) {
|
|
1431
|
-
|
|
1432
|
-
|
|
1449
|
+
if (!slot.el) {
|
|
1450
|
+
disposeSlot(slot);
|
|
1451
|
+
return;
|
|
1433
1452
|
}
|
|
1453
|
+
applyEnterAnimation(slot.el, slot.props);
|
|
1454
|
+
callHook(g, name, "onMount");
|
|
1434
1455
|
slotMap.set(keyVal, slot);
|
|
1435
1456
|
}
|
|
1436
|
-
const
|
|
1437
|
-
if (slot.el &&
|
|
1438
|
-
|
|
1457
|
+
const nextChild = cursor.nextSibling;
|
|
1458
|
+
if (slot.el && nextChild !== slot.el) {
|
|
1459
|
+
container.insertBefore(slot.el, nextChild ?? endAnchor);
|
|
1460
|
+
}
|
|
1461
|
+
if (slot.el) {
|
|
1462
|
+
cursor = slot.el;
|
|
1439
1463
|
}
|
|
1440
1464
|
});
|
|
1441
|
-
while (forWrapper.children.length > arr.length) {
|
|
1442
|
-
forWrapper.lastChild.remove();
|
|
1443
|
-
}
|
|
1444
1465
|
});
|
|
1445
1466
|
onCleanup(() => {
|
|
1446
1467
|
for (const slot of Array.from(slotMap.values()))
|
|
@@ -1448,7 +1469,8 @@ function renderForNode(fullKey, props, container, g, components, componentTypes,
|
|
|
1448
1469
|
slotMap.clear();
|
|
1449
1470
|
for (const slot of Array.from(leavingSlots))
|
|
1450
1471
|
disposeSlot(slot);
|
|
1451
|
-
|
|
1472
|
+
startAnchor.remove();
|
|
1473
|
+
endAnchor.remove();
|
|
1452
1474
|
});
|
|
1453
1475
|
}
|
|
1454
1476
|
function renderNormalNode(fullKey, props, container, g, components, componentTypes, api, forCtx, ns, options) {
|
|
@@ -1825,7 +1847,7 @@ ${parseSource}
|
|
|
1825
1847
|
var parseSlexKitDsl = parseSlexSource;
|
|
1826
1848
|
|
|
1827
1849
|
// src/version.ts
|
|
1828
|
-
var SLEXKIT_VERSION = "0.3.
|
|
1850
|
+
var SLEXKIT_VERSION = "0.3.3";
|
|
1829
1851
|
var SLEX_PROTOCOL_VERSION = "0.1";
|
|
1830
1852
|
var SLEXKIT_COMPONENTS_VERSION = SLEXKIT_VERSION;
|
|
1831
1853
|
function getSlexKitInfo() {
|
|
@@ -12232,7 +12254,7 @@ function Row($$anchor, $$props) {
|
|
|
12232
12254
|
}
|
|
12233
12255
|
|
|
12234
12256
|
// src/components/svelte/input/Slider.svelte
|
|
12235
|
-
var root5 = from_html(`<div class="slex-slider-field"><div class="slex-slider-label"><span class="slex-slider-label-text"><!> <span> </span></span> <span class="slex-slider-value"> <!></span></div> <input type="range" class="slex-slider"/></div>`);
|
|
12257
|
+
var root5 = from_html(`<div class="slex-slider-field"><div class="slex-slider-label"><span class="slex-slider-label-text"><!> <span> </span></span> <span class="slex-slider-value"> <!></span></div> <div class="slex-slider-control"><span class="slex-slider-track" aria-hidden="true"></span> <input type="range" class="slex-slider"/></div></div>`);
|
|
12236
12258
|
function Slider($$anchor, $$props) {
|
|
12237
12259
|
push($$props, true);
|
|
12238
12260
|
let p = state(proxy({}));
|
|
@@ -12332,30 +12354,32 @@ function Slider($$anchor, $$props) {
|
|
|
12332
12354
|
}
|
|
12333
12355
|
reset(span_2);
|
|
12334
12356
|
reset(div_1);
|
|
12335
|
-
var
|
|
12357
|
+
var div_2 = sibling(div_1, 2);
|
|
12358
|
+
var input_1 = sibling(child(div_2), 2);
|
|
12336
12359
|
remove_input_defaults(input_1);
|
|
12360
|
+
reset(div_2);
|
|
12337
12361
|
reset(div);
|
|
12338
12362
|
template_effect(($0, $1, $2, $3, $4, $5, $6, $7, $8) => {
|
|
12339
12363
|
set_attribute2(div, "data-orientation", $0);
|
|
12340
12364
|
set_text(text_1, $1);
|
|
12341
12365
|
set_text(text_2, $2);
|
|
12342
|
-
|
|
12343
|
-
set_attribute2(input_1, "
|
|
12344
|
-
set_attribute2(input_1, "
|
|
12345
|
-
|
|
12366
|
+
set_style(div_2, $3);
|
|
12367
|
+
set_attribute2(input_1, "min", $4);
|
|
12368
|
+
set_attribute2(input_1, "max", $5);
|
|
12369
|
+
set_attribute2(input_1, "step", $6);
|
|
12370
|
+
set_value(input_1, $7);
|
|
12346
12371
|
input_1.disabled = !!get2(p).disabled;
|
|
12347
|
-
set_attribute2(input_1, "aria-label", $
|
|
12348
|
-
set_style(input_1, $8);
|
|
12372
|
+
set_attribute2(input_1, "aria-label", $8);
|
|
12349
12373
|
}, [
|
|
12350
12374
|
() => text2(get2(p).orientation, "horizontal"),
|
|
12351
12375
|
() => text2(get2(p).label ?? $$props.componentName),
|
|
12352
12376
|
() => text2(get2(value) ?? 0),
|
|
12377
|
+
() => `--slex-slider-progress: ${sliderProgress(get2(value), get2(p).min, get2(p).max)}`,
|
|
12353
12378
|
() => Number(get2(p).min ?? 0),
|
|
12354
12379
|
() => Number(get2(p).max ?? 100),
|
|
12355
12380
|
() => Number(get2(p).step ?? 1),
|
|
12356
12381
|
() => Number(get2(value) ?? 0),
|
|
12357
|
-
() => text2(get2(p)["aria-label"] ?? get2(p).ariaLabel ?? get2(p).label ?? $$props.componentName)
|
|
12358
|
-
() => `--slex-slider-progress: ${sliderProgress(get2(value), get2(p).min, get2(p).max)}`
|
|
12382
|
+
() => text2(get2(p)["aria-label"] ?? get2(p).ariaLabel ?? get2(p).label ?? $$props.componentName)
|
|
12359
12383
|
]);
|
|
12360
12384
|
delegated("pointerdown", input_1, grabSlider);
|
|
12361
12385
|
delegated("input", input_1, (event2) => choose(Number(event2.target.value)));
|