slexkit 0.2.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +21 -21
  3. package/README.md +4 -3
  4. package/README.zh-CN.md +4 -3
  5. package/dist/ai/llms-authoring.txt +2 -0
  6. package/dist/ai/llms-capabilities.txt +126 -0
  7. package/dist/ai/llms-components.txt +29 -7
  8. package/dist/ai/llms-full.txt +1909 -153
  9. package/dist/ai/llms-runtime.txt +18 -13
  10. package/dist/ai/llms.txt +22 -1
  11. package/dist/ai/slexkit-ai-manifest.json +717 -62
  12. package/dist/base.css +359 -359
  13. package/dist/chunks/{accordion-cfjyxw93.js → button-53ccjq5p.js} +11 -11
  14. package/dist/chunks/{accordion-nw12ytps.js → button-cr1fhsa7.js} +48 -2
  15. package/dist/chunks/{accordion-5f0nvjjm.js → button-dsftwzvg.js} +4 -3
  16. package/dist/chunks/{accordion-hzyrngd6.js → button-faf563xf.js} +2 -2
  17. package/dist/chunks/{accordion-ehnhpeca.js → button-jxv4c65t.js} +2 -2
  18. package/dist/chunks/{accordion-cw5r75jm.js → button-xv2dz7vn.js} +1 -1
  19. package/dist/chunks/{accordion-830dw78f.js → button-z5yv24ks.js} +2 -2
  20. package/dist/components/accordion.js +2 -2
  21. package/dist/components/badge.js +2 -2
  22. package/dist/components/button.css +101 -101
  23. package/dist/components/button.js +3 -3
  24. package/dist/components/callout.js +4 -4
  25. package/dist/components/card.js +2 -2
  26. package/dist/components/checkbox.js +3 -2
  27. package/dist/components/choice.css +151 -151
  28. package/dist/components/code-block.js +2 -2
  29. package/dist/components/collapsible.js +2 -2
  30. package/dist/components/column.js +1 -1
  31. package/dist/components/content.css +273 -250
  32. package/dist/components/display.css +1 -1
  33. package/dist/components/divider.js +2 -2
  34. package/dist/components/grid.js +1 -1
  35. package/dist/components/index.js +13994 -172
  36. package/dist/components/input.css +786 -852
  37. package/dist/components/input.js +34 -144
  38. package/dist/components/link.js +2 -2
  39. package/dist/components/progress.js +2 -2
  40. package/dist/components/radio-group.js +3 -2
  41. package/dist/components/row.js +1 -1
  42. package/dist/components/section.js +2 -2
  43. package/dist/components/select.css +175 -181
  44. package/dist/components/select.js +3 -3
  45. package/dist/components/slider.css +125 -116
  46. package/dist/components/slider.js +2 -2
  47. package/dist/components/specs.js +34 -1
  48. package/dist/components/stat.js +2 -2
  49. package/dist/components/submit.css +8 -8
  50. package/dist/components/submit.js +1 -1
  51. package/dist/components/switch.css +105 -105
  52. package/dist/components/switch.js +4 -3
  53. package/dist/components/table.js +4 -4
  54. package/dist/components/tabs.css +95 -95
  55. package/dist/components/tabs.js +4 -4
  56. package/dist/components/text-input.css +26 -95
  57. package/dist/components/text.js +13 -1
  58. package/dist/components/toast.js +4 -4
  59. package/dist/components/tooling.css +0 -1
  60. package/dist/components/tooling.js +73 -8
  61. package/dist/runtime.cjs +1610 -17
  62. package/dist/runtime.js +1609 -16
  63. package/dist/slexkit.cjs +28191 -13865
  64. package/dist/slexkit.css +1525 -1569
  65. package/dist/slexkit.js +28190 -13864
  66. package/dist/tooling.js +117 -11
  67. package/dist/types/components/svelte/helpers.d.ts +8 -1
  68. package/dist/types/engine/capabilities.d.ts +54 -0
  69. package/dist/types/engine/index.d.ts +6 -0
  70. package/dist/types/engine/secure-runtime.d.ts +9 -1
  71. package/dist/types/engine/stdlib.d.ts +30 -0
  72. package/dist/types/engine/types.d.ts +1 -0
  73. package/dist/types/engine/validation.d.ts +28 -0
  74. package/dist/types/index.d.ts +6 -3
  75. package/dist/types/runtime.d.ts +6 -3
  76. package/dist/types/version.d.ts +2 -2
  77. package/dist/umd/slexkit.tooling.umd.js +45084 -44775
  78. package/dist/umd/slexkit.umd.js +28191 -13865
  79. package/package.json +5 -3
  80. package/skills/slexkit-host-integration/SKILL.md +1 -1
  81. package/src/components/svelte/content/Formula.svelte +27 -0
  82. package/src/components/svelte/content/Table.svelte +1 -1
  83. package/src/components/svelte/display/Text.svelte +14 -1
  84. package/src/components/svelte/helpers.ts +56 -1
  85. package/src/components/svelte/input/Checkbox.svelte +1 -1
  86. package/src/components/svelte/input/Input.svelte +0 -110
  87. package/src/components/svelte/input/RadioGroup.svelte +1 -1
  88. package/src/components/svelte/input/Select.svelte +2 -2
  89. package/src/components/svelte/input/Switch.svelte +2 -2
  90. package/src/components/svelte/input/Tabs.svelte +7 -7
  91. package/src/components/svelte/tooling/PlaygroundMarkdown.svelte +84 -2
  92. package/src/styles/components/button.css +101 -101
  93. package/src/styles/components/choice.css +152 -152
  94. package/src/styles/components/select.css +175 -181
  95. package/src/styles/components/slider.css +125 -116
  96. package/src/styles/components/submit.css +8 -8
  97. package/src/styles/components/switch.css +105 -105
  98. package/src/styles/components/tabs.css +95 -95
  99. package/src/styles/components/text-input.css +26 -95
  100. package/src/styles/content.css +274 -251
  101. package/src/styles/display.css +1 -1
  102. package/src/styles/input.css +8 -8
  103. package/src/styles/layout.css +360 -360
  104. package/src/styles/tooling.css +0 -1
@@ -25,7 +25,7 @@ import {
25
25
  text1 as text,
26
26
  user_derived,
27
27
  user_effect
28
- } from "../chunks/accordion-nw12ytps.js";
28
+ } from "../chunks/button-cr1fhsa7.js";
29
29
 
30
30
  // src/components/entries/input.ts
31
31
  import { register } from "../runtime.js";
@@ -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(`<span class="slex-input-controls"><button class="slex-input-step" type="button">-</button> <button class="slex-input-step" type="button">+</button></span>`);
121
- var root_4 = from_html(`<div class="slex-input-description"> </div>`);
122
- var root_5 = from_html(`<div class="slex-input-error" role="alert"> </div>`);
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 input_1 = child(div_1);
269
- remove_input_defaults(input_1);
270
- var node_1 = sibling(input_1, 2);
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", `Decrease ${get(controlLabel)}`);
293
- button.disabled = get(decrementDisabled);
294
- set_attribute(button_1, "aria-label", `Increase ${get(controlLabel)}`);
295
- button_1.disabled = get(incrementDisabled);
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 node_3 = sibling(div_1, 2);
198
+ var node_2 = sibling(div_1, 2);
308
199
  {
309
- var consequent_3 = ($$anchor2) => {
310
- var div_2 = root_4();
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(node_3, ($$render) => {
210
+ if_block(node_2, ($$render) => {
320
211
  if (get(descriptionText))
321
- $$render(consequent_3);
212
+ $$render(consequent_2);
322
213
  });
323
214
  }
324
- var node_4 = sibling(node_3, 2);
215
+ var node_3 = sibling(node_2, 2);
325
216
  {
326
- var consequent_4 = ($$anchor2) => {
327
- var div_3 = root_5();
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(node_4, ($$render) => {
227
+ if_block(node_3, ($$render) => {
337
228
  if (get(errorText))
338
- $$render(consequent_4);
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(div_1, "data-has-controls", get(controls) ? "true" : undefined);
348
- set_attribute(input_1, "id", get(inputId));
349
- set_attribute(input_1, "type", $0);
350
- set_attribute(input_1, "inputmode", $1);
351
- set_attribute(input_1, "name", $2);
352
- set_attribute(input_1, "placeholder", $3);
353
- input_1.disabled = get(disabled);
354
- input_1.readOnly = get(readonly);
355
- input_1.required = get(required);
356
- set_attribute(input_1, "min", $4);
357
- set_attribute(input_1, "max", $5);
358
- set_attribute(input_1, "step", $6);
359
- set_attribute(input_1, "aria-label", get(computedAriaLabel) || undefined);
360
- set_attribute(input_1, "aria-describedby", get(describedBy) || undefined);
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", input_1, update);
372
- bind_value(input_1, () => get(value), ($$value) => set(value, $$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", "click"]);
266
+ delegate(["input"]);
377
267
 
378
268
  // src/components/entries/input.ts
379
269
  register("input", createSvelteRenderer("input", Input), { state: "value" });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InlineIcon
3
- } from "../chunks/accordion-cw5r75jm.js";
3
+ } from "../chunks/button-xv2dz7vn.js";
4
4
  import {
5
5
  append,
6
6
  bindPropStore,
@@ -21,7 +21,7 @@ import {
21
21
  template_effect,
22
22
  text1 as text,
23
23
  user_effect
24
- } from "../chunks/accordion-nw12ytps.js";
24
+ } from "../chunks/button-cr1fhsa7.js";
25
25
 
26
26
  // src/components/entries/link.ts
27
27
  import { register } from "../runtime.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InlineIcon
3
- } from "../chunks/accordion-cw5r75jm.js";
3
+ } from "../chunks/button-xv2dz7vn.js";
4
4
  import {
5
5
  append,
6
6
  bindPropStore,
@@ -22,7 +22,7 @@ import {
22
22
  template_effect,
23
23
  text1 as text,
24
24
  user_effect
25
- } from "../chunks/accordion-nw12ytps.js";
25
+ } from "../chunks/button-cr1fhsa7.js";
26
26
 
27
27
  // src/components/entries/progress.ts
28
28
  import { register } from "../runtime.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InlineIcon
3
- } from "../chunks/accordion-cw5r75jm.js";
3
+ } from "../chunks/button-xv2dz7vn.js";
4
4
  import {
5
5
  append,
6
6
  bindPropStore,
@@ -31,7 +31,7 @@ import {
31
31
  text1 as text,
32
32
  user_derived,
33
33
  user_effect
34
- } from "../chunks/accordion-nw12ytps.js";
34
+ } from "../chunks/button-cr1fhsa7.js";
35
35
 
36
36
  // src/components/entries/radio-group.ts
37
37
  import { register } from "../runtime.js";
@@ -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));
@@ -17,7 +17,7 @@ import {
17
17
  template_effect,
18
18
  text1 as text,
19
19
  user_effect
20
- } from "../chunks/accordion-nw12ytps.js";
20
+ } from "../chunks/button-cr1fhsa7.js";
21
21
 
22
22
  // src/components/entries/row.ts
23
23
  import { register } from "../runtime.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InlineIcon
3
- } from "../chunks/accordion-cw5r75jm.js";
3
+ } from "../chunks/button-xv2dz7vn.js";
4
4
  import {
5
5
  action,
6
6
  append,
@@ -23,7 +23,7 @@ import {
23
23
  template_effect,
24
24
  text1 as text,
25
25
  user_effect
26
- } from "../chunks/accordion-nw12ytps.js";
26
+ } from "../chunks/button-cr1fhsa7.js";
27
27
 
28
28
  // src/components/entries/section.ts
29
29
  import { register } from "../runtime.js";