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.
- package/CHANGELOG.md +70 -0
- package/LICENSE +21 -21
- package/README.md +4 -3
- package/README.zh-CN.md +4 -3
- package/dist/ai/llms-authoring.txt +2 -0
- package/dist/ai/llms-capabilities.txt +126 -0
- package/dist/ai/llms-components.txt +29 -7
- package/dist/ai/llms-full.txt +1909 -153
- package/dist/ai/llms-runtime.txt +18 -13
- package/dist/ai/llms.txt +22 -1
- package/dist/ai/slexkit-ai-manifest.json +717 -62
- package/dist/base.css +359 -359
- package/dist/chunks/{accordion-cfjyxw93.js → button-53ccjq5p.js} +11 -11
- package/dist/chunks/{accordion-nw12ytps.js → button-cr1fhsa7.js} +48 -2
- package/dist/chunks/{accordion-5f0nvjjm.js → button-dsftwzvg.js} +4 -3
- package/dist/chunks/{accordion-hzyrngd6.js → button-faf563xf.js} +2 -2
- package/dist/chunks/{accordion-ehnhpeca.js → button-jxv4c65t.js} +2 -2
- package/dist/chunks/{accordion-cw5r75jm.js → button-xv2dz7vn.js} +1 -1
- package/dist/chunks/{accordion-830dw78f.js → button-z5yv24ks.js} +2 -2
- package/dist/components/accordion.js +2 -2
- package/dist/components/badge.js +2 -2
- package/dist/components/button.css +101 -101
- package/dist/components/button.js +3 -3
- package/dist/components/callout.js +4 -4
- package/dist/components/card.js +2 -2
- package/dist/components/checkbox.js +3 -2
- package/dist/components/choice.css +151 -151
- package/dist/components/code-block.js +2 -2
- package/dist/components/collapsible.js +2 -2
- package/dist/components/column.js +1 -1
- package/dist/components/content.css +273 -250
- package/dist/components/display.css +1 -1
- package/dist/components/divider.js +2 -2
- package/dist/components/grid.js +1 -1
- package/dist/components/index.js +13994 -172
- package/dist/components/input.css +786 -852
- package/dist/components/input.js +34 -144
- package/dist/components/link.js +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/radio-group.js +3 -2
- package/dist/components/row.js +1 -1
- package/dist/components/section.js +2 -2
- package/dist/components/select.css +175 -181
- package/dist/components/select.js +3 -3
- package/dist/components/slider.css +125 -116
- package/dist/components/slider.js +2 -2
- package/dist/components/specs.js +34 -1
- package/dist/components/stat.js +2 -2
- package/dist/components/submit.css +8 -8
- package/dist/components/submit.js +1 -1
- package/dist/components/switch.css +105 -105
- package/dist/components/switch.js +4 -3
- package/dist/components/table.js +4 -4
- package/dist/components/tabs.css +95 -95
- package/dist/components/tabs.js +4 -4
- package/dist/components/text-input.css +26 -95
- package/dist/components/text.js +13 -1
- package/dist/components/toast.js +4 -4
- package/dist/components/tooling.css +0 -1
- package/dist/components/tooling.js +73 -8
- package/dist/runtime.cjs +1610 -17
- package/dist/runtime.js +1609 -16
- package/dist/slexkit.cjs +28191 -13865
- package/dist/slexkit.css +1525 -1569
- package/dist/slexkit.js +28190 -13864
- package/dist/tooling.js +117 -11
- package/dist/types/components/svelte/helpers.d.ts +8 -1
- package/dist/types/engine/capabilities.d.ts +54 -0
- package/dist/types/engine/index.d.ts +6 -0
- package/dist/types/engine/secure-runtime.d.ts +9 -1
- package/dist/types/engine/stdlib.d.ts +30 -0
- package/dist/types/engine/types.d.ts +1 -0
- package/dist/types/engine/validation.d.ts +28 -0
- package/dist/types/index.d.ts +6 -3
- package/dist/types/runtime.d.ts +6 -3
- package/dist/types/version.d.ts +2 -2
- package/dist/umd/slexkit.tooling.umd.js +45084 -44775
- package/dist/umd/slexkit.umd.js +28191 -13865
- package/package.json +5 -3
- package/skills/slexkit-host-integration/SKILL.md +1 -1
- package/src/components/svelte/content/Formula.svelte +27 -0
- package/src/components/svelte/content/Table.svelte +1 -1
- package/src/components/svelte/display/Text.svelte +14 -1
- package/src/components/svelte/helpers.ts +56 -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/Select.svelte +2 -2
- package/src/components/svelte/input/Switch.svelte +2 -2
- package/src/components/svelte/input/Tabs.svelte +7 -7
- package/src/components/svelte/tooling/PlaygroundMarkdown.svelte +84 -2
- package/src/styles/components/button.css +101 -101
- package/src/styles/components/choice.css +152 -152
- package/src/styles/components/select.css +175 -181
- package/src/styles/components/slider.css +125 -116
- package/src/styles/components/submit.css +8 -8
- package/src/styles/components/switch.css +105 -105
- package/src/styles/components/tabs.css +95 -95
- package/src/styles/components/text-input.css +26 -95
- package/src/styles/content.css +274 -251
- package/src/styles/display.css +1 -1
- package/src/styles/input.css +8 -8
- package/src/styles/layout.css +360 -360
- package/src/styles/tooling.css +0 -1
package/dist/tooling.js
CHANGED
|
@@ -33811,6 +33811,49 @@ function list(value) {
|
|
|
33811
33811
|
function emit(ctx, event2, data2) {
|
|
33812
33812
|
ctx.emit(event2, data2);
|
|
33813
33813
|
}
|
|
33814
|
+
function scheduleFrame(ctx, fn) {
|
|
33815
|
+
const handle = { kind: "microtask", canceled: false };
|
|
33816
|
+
const run3 = (time) => {
|
|
33817
|
+
if (!handle.canceled)
|
|
33818
|
+
fn(time);
|
|
33819
|
+
};
|
|
33820
|
+
const apiRaf = ctx.api?.raf;
|
|
33821
|
+
if (typeof apiRaf === "function") {
|
|
33822
|
+
try {
|
|
33823
|
+
handle.kind = "api";
|
|
33824
|
+
handle.id = apiRaf(run3);
|
|
33825
|
+
return handle;
|
|
33826
|
+
} catch {
|
|
33827
|
+
handle.kind = "microtask";
|
|
33828
|
+
handle.id = undefined;
|
|
33829
|
+
}
|
|
33830
|
+
}
|
|
33831
|
+
const ownerWindow = ctx.document.defaultView;
|
|
33832
|
+
if (ownerWindow && typeof ownerWindow.requestAnimationFrame === "function") {
|
|
33833
|
+
try {
|
|
33834
|
+
handle.kind = "native";
|
|
33835
|
+
handle.id = ownerWindow.requestAnimationFrame(run3);
|
|
33836
|
+
return handle;
|
|
33837
|
+
} catch {
|
|
33838
|
+
handle.kind = "microtask";
|
|
33839
|
+
handle.id = undefined;
|
|
33840
|
+
}
|
|
33841
|
+
}
|
|
33842
|
+
queueMicrotask(() => run3());
|
|
33843
|
+
return handle;
|
|
33844
|
+
}
|
|
33845
|
+
function cancelScheduledFrame(ctx, handle) {
|
|
33846
|
+
if (!handle || handle.canceled)
|
|
33847
|
+
return;
|
|
33848
|
+
handle.canceled = true;
|
|
33849
|
+
if (handle.kind === "api" && typeof ctx.api?.cancelRaf === "function") {
|
|
33850
|
+
try {
|
|
33851
|
+
ctx.api.cancelRaf(handle.id);
|
|
33852
|
+
} catch {}
|
|
33853
|
+
} else if (handle.kind === "native" && typeof handle.id === "number") {
|
|
33854
|
+
ctx.document.defaultView?.cancelAnimationFrame(handle.id);
|
|
33855
|
+
}
|
|
33856
|
+
}
|
|
33814
33857
|
function formatScriptKey(key2) {
|
|
33815
33858
|
return /^[A-Za-z_$][\w$]*$/.test(key2) ? key2 : JSON.stringify(key2);
|
|
33816
33859
|
}
|
|
@@ -34536,7 +34579,7 @@ function Select($$anchor, $$props) {
|
|
|
34536
34579
|
set(open, false);
|
|
34537
34580
|
set(activeIndex, selectedIndex(), true);
|
|
34538
34581
|
if (focusTrigger)
|
|
34539
|
-
|
|
34582
|
+
scheduleFrame($$props.ctx, () => get2(triggerEl)?.focus());
|
|
34540
34583
|
}
|
|
34541
34584
|
function toggle() {
|
|
34542
34585
|
if (get2(open))
|
|
@@ -37507,14 +37550,13 @@ function Tabs2($$anchor, $$props) {
|
|
|
37507
37550
|
};
|
|
37508
37551
|
}
|
|
37509
37552
|
function annotateTabs(node) {
|
|
37510
|
-
let
|
|
37553
|
+
let frame;
|
|
37511
37554
|
let resizeObserver;
|
|
37512
37555
|
let indicatorReady = false;
|
|
37513
37556
|
function scheduleIndicatorUpdate(list3, selectedTrigger) {
|
|
37514
|
-
|
|
37515
|
-
|
|
37516
|
-
|
|
37517
|
-
raf2 = undefined;
|
|
37557
|
+
cancelScheduledFrame($$props.ctx, frame);
|
|
37558
|
+
frame = scheduleFrame($$props.ctx, () => {
|
|
37559
|
+
frame = undefined;
|
|
37518
37560
|
if (!selectedTrigger) {
|
|
37519
37561
|
list3.style.setProperty("--slex-tabs-indicator-opacity", "0");
|
|
37520
37562
|
return;
|
|
@@ -37541,7 +37583,7 @@ function Tabs2($$anchor, $$props) {
|
|
|
37541
37583
|
list3.style.setProperty("--slex-tabs-indicator-opacity", "1");
|
|
37542
37584
|
if (!indicatorReady) {
|
|
37543
37585
|
indicatorReady = true;
|
|
37544
|
-
|
|
37586
|
+
scheduleFrame($$props.ctx, () => {
|
|
37545
37587
|
list3.dataset.indicatorReady = "true";
|
|
37546
37588
|
});
|
|
37547
37589
|
}
|
|
@@ -37582,8 +37624,7 @@ function Tabs2($$anchor, $$props) {
|
|
|
37582
37624
|
apply2();
|
|
37583
37625
|
},
|
|
37584
37626
|
destroy() {
|
|
37585
|
-
|
|
37586
|
-
cancelAnimationFrame(raf2);
|
|
37627
|
+
cancelScheduledFrame($$props.ctx, frame);
|
|
37587
37628
|
resizeObserver?.disconnect();
|
|
37588
37629
|
}
|
|
37589
37630
|
};
|
|
@@ -58302,11 +58343,72 @@ function PlaygroundSlexCode($$anchor, $$props) {
|
|
|
58302
58343
|
}
|
|
58303
58344
|
|
|
58304
58345
|
// src/components/svelte/tooling/PlaygroundMarkdown.svelte
|
|
58305
|
-
var root105 = from_html(`<div class="slex-doc-streamdown"><!></div>`);
|
|
58346
|
+
var root105 = from_html(`<div class="slex-doc-prose slex-doc-streamdown"><!></div>`);
|
|
58306
58347
|
function PlaygroundMarkdown($$anchor, $$props) {
|
|
58307
58348
|
push($$props, true);
|
|
58308
58349
|
const extensions = [markedKatex({ singleDollarInline: true })];
|
|
58309
58350
|
const renderers = { inlineKatex: KatexRenderer, blockKatex: KatexRenderer };
|
|
58351
|
+
const options = { headerIds: false };
|
|
58352
|
+
function stripFrontmatter(value) {
|
|
58353
|
+
const raw = String(value ?? "").replace(/^\uFEFF/, "").replace(/\r\n/g, `
|
|
58354
|
+
`);
|
|
58355
|
+
if (!raw.startsWith("---"))
|
|
58356
|
+
return raw;
|
|
58357
|
+
const end = raw.indexOf(`
|
|
58358
|
+
---`, 3);
|
|
58359
|
+
if (end === -1)
|
|
58360
|
+
return raw;
|
|
58361
|
+
const closeEnd = raw.indexOf(`
|
|
58362
|
+
`, end + 1);
|
|
58363
|
+
return raw.slice(closeEnd === -1 ? raw.length : closeEnd + 1).trimStart();
|
|
58364
|
+
}
|
|
58365
|
+
function escapeHtml(value) {
|
|
58366
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
58367
|
+
}
|
|
58368
|
+
function stripInlineMarkdown(value) {
|
|
58369
|
+
return String(value).replace(/\s+\{#[A-Za-z0-9_-]+\}\s*$/, "").replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/<[^>]+>/g, "").replace(/\s+#+\s*$/, "").trim();
|
|
58370
|
+
}
|
|
58371
|
+
function slugText(value) {
|
|
58372
|
+
const slug2 = String(value).toLowerCase().replace(/[`"'\u2018\u2019\u201c\u201d]/g, "").replace(/[^a-z0-9\u4e00-\u9fa5]+/g, "-").replace(/^-+|-+$/g, "");
|
|
58373
|
+
return slug2 || "section";
|
|
58374
|
+
}
|
|
58375
|
+
function createHeadingIdGenerator() {
|
|
58376
|
+
const counts = new Map;
|
|
58377
|
+
return (rawTitle) => {
|
|
58378
|
+
const explicit = rawTitle.match(/\s+\{#([A-Za-z0-9_-]+)\}\s*$/)?.[1] ?? "";
|
|
58379
|
+
const base2 = explicit || slugText(stripInlineMarkdown(rawTitle));
|
|
58380
|
+
const count2 = counts.get(base2) ?? 0;
|
|
58381
|
+
counts.set(base2, count2 + 1);
|
|
58382
|
+
return count2 ? `${base2}-${count2 + 1}` : base2;
|
|
58383
|
+
};
|
|
58384
|
+
}
|
|
58385
|
+
function normalizeHeadingAnchors(markdown2) {
|
|
58386
|
+
const nextId = createHeadingIdGenerator();
|
|
58387
|
+
let fence = null;
|
|
58388
|
+
return String(markdown2 ?? "").split(/\n/).map((line) => {
|
|
58389
|
+
const marker = String(line).match(/^[ \t]{0,3}(`{3,}|~{3,})/);
|
|
58390
|
+
if (fence) {
|
|
58391
|
+
if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length)
|
|
58392
|
+
fence = null;
|
|
58393
|
+
return line;
|
|
58394
|
+
}
|
|
58395
|
+
if (marker) {
|
|
58396
|
+
fence = { char: marker[1][0], length: marker[1].length };
|
|
58397
|
+
return line;
|
|
58398
|
+
}
|
|
58399
|
+
const heading2 = String(line).match(/^(#{1,6})[ \t]+(.+)$/);
|
|
58400
|
+
if (!heading2)
|
|
58401
|
+
return line;
|
|
58402
|
+
const rawTitle = heading2[2].replace(/\s+#+\s*$/, "");
|
|
58403
|
+
const renderedTitle = rawTitle.replace(/\s+\{#[A-Za-z0-9_-]+\}\s*$/, "").trim();
|
|
58404
|
+
return `<span id="${escapeHtml(nextId(rawTitle))}" class="slex-doc-heading-anchor"></span>
|
|
58405
|
+
${heading2[1]} ${renderedTitle}`;
|
|
58406
|
+
}).join(`
|
|
58407
|
+
`);
|
|
58408
|
+
}
|
|
58409
|
+
function previewMarkdown(value) {
|
|
58410
|
+
return normalizeHeadingAnchors(stripFrontmatter(value));
|
|
58411
|
+
}
|
|
58310
58412
|
var div = root105();
|
|
58311
58413
|
var node = child(div);
|
|
58312
58414
|
{
|
|
@@ -58325,9 +58427,10 @@ function PlaygroundMarkdown($$anchor, $$props) {
|
|
|
58325
58427
|
}
|
|
58326
58428
|
});
|
|
58327
58429
|
};
|
|
58430
|
+
let $0 = user_derived(() => previewMarkdown($$props.content));
|
|
58328
58431
|
dist_default(node, {
|
|
58329
58432
|
get source() {
|
|
58330
|
-
return
|
|
58433
|
+
return get2($0);
|
|
58331
58434
|
},
|
|
58332
58435
|
get extensions() {
|
|
58333
58436
|
return extensions;
|
|
@@ -58335,6 +58438,9 @@ function PlaygroundMarkdown($$anchor, $$props) {
|
|
|
58335
58438
|
get renderers() {
|
|
58336
58439
|
return renderers;
|
|
58337
58440
|
},
|
|
58441
|
+
get options() {
|
|
58442
|
+
return options;
|
|
58443
|
+
},
|
|
58338
58444
|
code: code2,
|
|
58339
58445
|
$$slots: { code: true }
|
|
58340
58446
|
});
|
|
@@ -18,7 +18,7 @@ export declare function itemLabel(item: unknown): string;
|
|
|
18
18
|
export declare function itemDescription(item: unknown): string;
|
|
19
19
|
export declare function readColumns(value: unknown): string[];
|
|
20
20
|
export declare function readColumnLabel(column: unknown, fallback: string): string;
|
|
21
|
-
export declare function readCell(row: unknown, column: string): string;
|
|
21
|
+
export declare function readCell(row: unknown, column: string, index?: number): string;
|
|
22
22
|
export declare function catalogItems(value: unknown): Record<string, unknown>[];
|
|
23
23
|
export declare function catalogGroups(value: unknown): Array<{
|
|
24
24
|
label: string;
|
|
@@ -28,6 +28,13 @@ export declare function renderChildren(node: HTMLElement, ctx: RenderContext): {
|
|
|
28
28
|
destroy(): void;
|
|
29
29
|
};
|
|
30
30
|
export declare function emit(ctx: RenderContext, event: string, data?: unknown): void;
|
|
31
|
+
export type ScheduledFrame = {
|
|
32
|
+
kind: "api" | "native" | "microtask";
|
|
33
|
+
id?: unknown;
|
|
34
|
+
canceled: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function scheduleFrame(ctx: RenderContext, fn: (time?: number) => void): ScheduledFrame;
|
|
37
|
+
export declare function cancelScheduledFrame(ctx: RenderContext, handle: ScheduledFrame | undefined): void;
|
|
31
38
|
export declare function formatScriptValue(value: unknown, indent?: number): string;
|
|
32
39
|
export declare function stringifySource(source: unknown): string;
|
|
33
40
|
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type SlexKitStdlibFunctionDoc = {
|
|
2
|
+
name: string;
|
|
3
|
+
signature: string;
|
|
4
|
+
summary: string;
|
|
5
|
+
pure: true;
|
|
6
|
+
example: string;
|
|
7
|
+
};
|
|
8
|
+
export type SlexKitStdlibNamespaceDoc = {
|
|
9
|
+
name: "math" | "stats" | "format" | "units";
|
|
10
|
+
summary: string;
|
|
11
|
+
functions: SlexKitStdlibFunctionDoc[];
|
|
12
|
+
};
|
|
13
|
+
export type SlexKitRuntimeCapabilityDoc = {
|
|
14
|
+
name: string;
|
|
15
|
+
policy: "network" | "timer" | "animation" | "canvas" | "lifecycle" | "diagnostics";
|
|
16
|
+
signature: string;
|
|
17
|
+
summary: string;
|
|
18
|
+
example: string;
|
|
19
|
+
secureDefault: "denied" | "available";
|
|
20
|
+
forbidden?: string[];
|
|
21
|
+
};
|
|
22
|
+
export declare const slexkitExpressionContext: readonly [{
|
|
23
|
+
readonly name: "g";
|
|
24
|
+
readonly scope: "always";
|
|
25
|
+
readonly summary: "Reactive state proxy.";
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "std";
|
|
28
|
+
readonly scope: "always";
|
|
29
|
+
readonly summary: "Pure deterministic SlexKit standard library.";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "api";
|
|
32
|
+
readonly scope: "host-injected";
|
|
33
|
+
readonly summary: "Host or secure runtime capability object.";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "$event";
|
|
36
|
+
readonly scope: "event handlers";
|
|
37
|
+
readonly summary: "Event payload for on* handlers.";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "$item";
|
|
40
|
+
readonly scope: "$for";
|
|
41
|
+
readonly summary: "Current array item.";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "$index";
|
|
44
|
+
readonly scope: "$for";
|
|
45
|
+
readonly summary: "Current item index.";
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "$key";
|
|
48
|
+
readonly scope: "$for";
|
|
49
|
+
readonly summary: "Current item key.";
|
|
50
|
+
}];
|
|
51
|
+
export declare const slexkitStdlibDocs: SlexKitStdlibNamespaceDoc[];
|
|
52
|
+
export declare const slexkitRuntimeCapabilities: SlexKitRuntimeCapabilityDoc[];
|
|
53
|
+
export declare const slexkitStdlibFunctionNames: string[];
|
|
54
|
+
export declare const slexkitRuntimeCapabilityNames: string[];
|
|
@@ -3,10 +3,16 @@ import type { SecureMountOptions } from "./secure-runtime";
|
|
|
3
3
|
export { register, getRenderer } from "./registry";
|
|
4
4
|
export { diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, parseSlexSource, parseSlexKitDsl, } from "./diagnostics";
|
|
5
5
|
export type { SlexKitParseResult, SlexKitSourceDiagnostic } from "./diagnostics";
|
|
6
|
+
export { validateSlexSource } from "./validation";
|
|
7
|
+
export type { SlexKitValidationMode, SlexKitValidationOptions, SlexKitValidationResult, SlexKitValidationWarning, SlexKitValidationWarningCode, } from "./validation";
|
|
6
8
|
export type { ComponentRegistrationOptions, ComponentRenderer, ComponentStateMode, MountOptions, RenderContext, SlexExpression, ThemeMode,
|
|
7
9
|
/** @deprecated Use SlexExpression instead. */
|
|
8
10
|
DSL, } from "./types";
|
|
9
11
|
export { createSecureRuntime, SlexKitRuntimeError, serializeRuntimeError, } from "./secure-runtime";
|
|
12
|
+
export { slexkitStd } from "./stdlib";
|
|
13
|
+
export type { SlexKitStdlib } from "./stdlib";
|
|
14
|
+
export { slexkitExpressionContext, slexkitRuntimeCapabilities, slexkitRuntimeCapabilityNames, slexkitStdlibDocs, slexkitStdlibFunctionNames, } from "./capabilities";
|
|
15
|
+
export type { SlexKitRuntimeCapabilityDoc, SlexKitStdlibFunctionDoc, SlexKitStdlibNamespaceDoc, } from "./capabilities";
|
|
10
16
|
export { createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost, } from "./markdown-runtime";
|
|
11
17
|
export type { SlexKitMarkdownBlock, SlexKitMarkdownRuntimeHost, SlexKitMarkdownRuntimeMode, SlexKitMarkdownRuntimeOptions, } from "./markdown-runtime";
|
|
12
18
|
export type { SlexKitRuntimeApi, HostFetchRequest, HostRuntimeAdapter, HostRuntimePolicy, NetworkOptions, NetworkResult, RafId, RuntimeCanvasContext, RuntimeCanvasContextId, RuntimeErrorEvent, RuntimeErrorKind, RuntimeNetworkLogEvent, SandboxSlotSizeMessage, SandboxSlotsMessage, SandboxFetchRequestMessage, SandboxFetchResponseMessage, SandboxHostMessage, SandboxMountMessage, SandboxRunnerMessage, SandboxStatusMessage, SecureFrameOptions, SecureArtifactSlot, SecureMountOptions, SecureRuntimeHandle, SerializedRuntimeError, TimerId, } from "./secure-runtime";
|
|
@@ -113,6 +113,7 @@ export type SecureFrameOptions = {
|
|
|
113
113
|
sandbox?: string;
|
|
114
114
|
unsafeAllowSameOrigin?: boolean;
|
|
115
115
|
runtimeUrl?: string;
|
|
116
|
+
styleUrl?: string | false;
|
|
116
117
|
loadTimeoutMs?: number;
|
|
117
118
|
/**
|
|
118
119
|
* @deprecated Use runtimeUrl. The runner is now shipped inside the main SlexKit runtime module.
|
|
@@ -186,6 +187,13 @@ export type SandboxSlotSizeMessage = {
|
|
|
186
187
|
slotId: string;
|
|
187
188
|
height: number;
|
|
188
189
|
};
|
|
190
|
+
export type SandboxFrameSizeMessage = {
|
|
191
|
+
channel: "slexkit-secure";
|
|
192
|
+
type: "frame-size";
|
|
193
|
+
id: string;
|
|
194
|
+
token: string;
|
|
195
|
+
height: number;
|
|
196
|
+
};
|
|
189
197
|
export type SandboxStatusMessage = {
|
|
190
198
|
channel: "slexkit-secure";
|
|
191
199
|
type: "ready" | "mounted" | "heartbeat" | "disposed" | "error";
|
|
@@ -194,7 +202,7 @@ export type SandboxStatusMessage = {
|
|
|
194
202
|
error?: SerializedRuntimeError;
|
|
195
203
|
};
|
|
196
204
|
export type SandboxHostMessage = SandboxMountMessage | SandboxDisposeMessage | SandboxFetchResponseMessage | SandboxSlotsMessage;
|
|
197
|
-
export type SandboxRunnerMessage = SandboxFetchRequestMessage | SandboxSlotSizeMessage | SandboxStatusMessage;
|
|
205
|
+
export type SandboxRunnerMessage = SandboxFetchRequestMessage | SandboxFrameSizeMessage | SandboxSlotSizeMessage | SandboxStatusMessage;
|
|
198
206
|
export type SerializedRuntimeError = {
|
|
199
207
|
name: string;
|
|
200
208
|
message: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type SlexKitStdlib = {
|
|
2
|
+
math: {
|
|
3
|
+
clamp: (value: unknown, min: unknown, max: unknown) => number;
|
|
4
|
+
round: (value: unknown, digits?: unknown) => number;
|
|
5
|
+
safeDivide: (numerator: unknown, denominator: unknown, fallback?: unknown) => number;
|
|
6
|
+
percent: (part: unknown, total: unknown, digits?: unknown) => number;
|
|
7
|
+
lerp: (start: unknown, end: unknown, t: unknown) => number;
|
|
8
|
+
};
|
|
9
|
+
stats: {
|
|
10
|
+
sum: (values: unknown) => number;
|
|
11
|
+
mean: (values: unknown) => number;
|
|
12
|
+
min: (values: unknown) => number;
|
|
13
|
+
max: (values: unknown) => number;
|
|
14
|
+
median: (values: unknown) => number;
|
|
15
|
+
};
|
|
16
|
+
format: {
|
|
17
|
+
fixed: (value: unknown, digits?: unknown) => string;
|
|
18
|
+
number: (value: unknown, digits?: unknown, locale?: unknown) => string;
|
|
19
|
+
compact: (value: unknown, digits?: unknown, locale?: unknown) => string;
|
|
20
|
+
percent: (ratio: unknown, digits?: unknown) => string;
|
|
21
|
+
currency: (value: unknown, currency?: unknown, locale?: unknown) => string;
|
|
22
|
+
};
|
|
23
|
+
units: {
|
|
24
|
+
withUnit: (value: unknown, unit: unknown, digits?: unknown) => string;
|
|
25
|
+
bytes: (value: unknown, digits?: unknown) => string;
|
|
26
|
+
duration: (ms: unknown, digits?: unknown) => string;
|
|
27
|
+
si: (value: unknown, unit?: unknown, digits?: unknown) => string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare const slexkitStd: SlexKitStdlib;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type SlexKitSourceDiagnostic } from "./diagnostics";
|
|
2
|
+
export type SlexKitValidationMode = "trusted" | "secure";
|
|
3
|
+
export type SlexKitValidationWarningCode = "unknown_component" | "unknown_prop" | "unknown_std_member" | "unknown_api_member" | "native_secure_capability";
|
|
4
|
+
export type SlexKitValidationWarning = {
|
|
5
|
+
code: SlexKitValidationWarningCode;
|
|
6
|
+
message: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
};
|
|
10
|
+
export type SlexKitValidationOptions = {
|
|
11
|
+
mode?: SlexKitValidationMode;
|
|
12
|
+
};
|
|
13
|
+
export type SlexKitValidationResult = {
|
|
14
|
+
ok: true;
|
|
15
|
+
value: unknown;
|
|
16
|
+
warnings: SlexKitValidationWarning[];
|
|
17
|
+
componentUsage: string[];
|
|
18
|
+
stdlibUsage: string[];
|
|
19
|
+
apiUsage: string[];
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
diagnostic: SlexKitSourceDiagnostic;
|
|
23
|
+
warnings: SlexKitValidationWarning[];
|
|
24
|
+
componentUsage: string[];
|
|
25
|
+
stdlibUsage: string[];
|
|
26
|
+
apiUsage: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare function validateSlexSource(source: string, options?: SlexKitValidationOptions): SlexKitValidationResult;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
1
|
+
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, validateSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
2
2
|
import { registerAll, registerSvelteComponent, registerSubset } from "./components/index";
|
|
3
3
|
import { renderToolCall, registerToolTemplate } from "./toolhost/index";
|
|
4
4
|
import { startSlexKitSandboxRunner } from "./engine/sandbox-runner";
|
|
@@ -17,6 +17,7 @@ declare const formatSlexKitDiagnosticApi: typeof formatSlexKitDiagnostic;
|
|
|
17
17
|
declare const mountSecureArtifactApi: typeof mountSecureArtifact;
|
|
18
18
|
declare const parseSlexSourceApi: typeof parseSlexSource;
|
|
19
19
|
declare const parseSlexKitDslApi: typeof parseSlexSource;
|
|
20
|
+
declare const validateSlexSourceApi: typeof validateSlexSource;
|
|
20
21
|
declare const createSecureRuntimeApi: typeof createSecureRuntime;
|
|
21
22
|
declare const SlexKitRuntimeErrorApi: typeof SlexKitRuntimeError;
|
|
22
23
|
declare const getSlexKitRuntimeUrlApi: typeof getSlexKitRuntimeUrl;
|
|
@@ -24,6 +25,7 @@ declare const setSlexKitRuntimeUrlApi: typeof setSlexKitRuntimeUrl;
|
|
|
24
25
|
declare const createSlexKitMarkdownRuntimeHostApi: typeof createSlexKitMarkdownRuntimeHost;
|
|
25
26
|
declare const getSlexKitMarkdownRuntimeHostApi: typeof getSlexKitMarkdownRuntimeHost;
|
|
26
27
|
declare const installSlexKitMarkdownRuntimeHostApi: typeof installSlexKitMarkdownRuntimeHost;
|
|
28
|
+
declare const slexkitStdApi: import(".").SlexKitStdlib;
|
|
27
29
|
declare const registerAllApi: typeof registerAll;
|
|
28
30
|
declare const registerSvelteComponentApi: typeof registerSvelteComponent;
|
|
29
31
|
declare const registerSubsetApi: typeof registerSubset;
|
|
@@ -43,10 +45,11 @@ declare const resolveIconWeightApi: typeof resolveIconWeight;
|
|
|
43
45
|
declare const attachComponentDisposerApi: typeof attachComponentDisposer;
|
|
44
46
|
declare const configureComponentScopeApi: typeof configureComponentScope;
|
|
45
47
|
declare const getSlexKitInfoApi: typeof getSlexKitInfo;
|
|
46
|
-
export { SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION, SLEXKIT_COMPONENTS_VERSION, getSlexKitInfoApi as getSlexKitInfo, mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, };
|
|
48
|
+
export { SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION, SLEXKIT_COMPONENTS_VERSION, getSlexKitInfoApi as getSlexKitInfo, mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, validateSlexSourceApi as validateSlexSource, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, slexkitStdApi as slexkitStd, };
|
|
47
49
|
export type { BootOptions } from "./engine/index";
|
|
48
50
|
export type { SlexKitParseResult, SlexKitSourceDiagnostic } from "./engine/index";
|
|
49
|
-
export type {
|
|
51
|
+
export type { SlexKitValidationMode, SlexKitValidationOptions, SlexKitValidationResult, SlexKitValidationWarning, SlexKitValidationWarningCode, } from "./engine/index";
|
|
52
|
+
export type { SlexKitRuntimeApi, HostFetchRequest, HostRuntimeAdapter, HostRuntimePolicy, NetworkOptions, NetworkResult, RafId, RuntimeCanvasContext, RuntimeCanvasContextId, RuntimeErrorEvent, RuntimeErrorKind, RuntimeNetworkLogEvent, SandboxSlotSizeMessage, SandboxSlotsMessage, SandboxFetchRequestMessage, SandboxFetchResponseMessage, SandboxHostMessage, SandboxMountMessage, SandboxRunnerMessage, SandboxStatusMessage, SecureFrameOptions, SecureArtifactSlot, SecureMountOptions, SecureRuntimeHandle, SerializedRuntimeError, TimerId, SlexKitStdlib, } from "./engine/index";
|
|
50
53
|
export type { SlexKitMarkdownBlock, SlexKitMarkdownRuntimeHost, SlexKitMarkdownRuntimeMode, SlexKitMarkdownRuntimeOptions, } from "./engine/index";
|
|
51
54
|
export type { ComponentRenderer, RenderContext, SlexExpression, DSL } from "./engine/types";
|
|
52
55
|
export { registerAllApi as registerAll, registerSvelteComponentApi as registerSvelteComponent, registerSubsetApi as registerSubset, };
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
1
|
+
import { mount, ingest, boot, disposeNamespace, register, getRenderer, diagnoseSlexKitSource, SlexKitSyntaxError, formatSlexKitDiagnostic, mountSecureArtifact, parseSlexSource, validateSlexSource, createSecureRuntime, SlexKitRuntimeError, getSlexKitRuntimeUrl, setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHost } from "./engine/index";
|
|
2
2
|
import { attachComponentDisposer, configureComponentScope } from "./engine/component-scope";
|
|
3
3
|
import { startSlexKitSandboxRunner } from "./engine/sandbox-runner";
|
|
4
4
|
import { getSlexKitInfo, SLEXKIT_COMPONENTS_VERSION, SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION } from "./version";
|
|
5
5
|
export type { BootOptions } from "./engine/index";
|
|
6
6
|
export type { SlexKitParseResult, SlexKitSourceDiagnostic } from "./engine/index";
|
|
7
|
-
export type {
|
|
7
|
+
export type { SlexKitValidationMode, SlexKitValidationOptions, SlexKitValidationResult, SlexKitValidationWarning, SlexKitValidationWarningCode, } from "./engine/index";
|
|
8
|
+
export type { ComponentRenderer, ComponentRegistrationOptions, ComponentStateMode, RenderContext, SlexExpression, DSL, SlexKitRuntimeApi, HostFetchRequest, HostRuntimeAdapter, HostRuntimePolicy, NetworkOptions, NetworkResult, RafId, RuntimeCanvasContext, RuntimeCanvasContextId, RuntimeErrorEvent, RuntimeErrorKind, RuntimeNetworkLogEvent, SandboxSlotSizeMessage, SandboxSlotsMessage, SandboxFetchRequestMessage, SandboxFetchResponseMessage, SandboxHostMessage, SandboxMountMessage, SandboxRunnerMessage, SandboxStatusMessage, SecureFrameOptions, SecureArtifactSlot, SecureMountOptions, SecureRuntimeHandle, SerializedRuntimeError, TimerId, SlexKitStdlib, } from "./engine/index";
|
|
8
9
|
export type { SlexKitMarkdownBlock, SlexKitMarkdownRuntimeHost, SlexKitMarkdownRuntimeMode, SlexKitMarkdownRuntimeOptions, } from "./engine/index";
|
|
9
10
|
declare const mountApi: typeof mount;
|
|
10
11
|
declare const ingestApi: typeof ingest;
|
|
@@ -18,6 +19,7 @@ declare const formatSlexKitDiagnosticApi: typeof formatSlexKitDiagnostic;
|
|
|
18
19
|
declare const mountSecureArtifactApi: typeof mountSecureArtifact;
|
|
19
20
|
declare const parseSlexSourceApi: typeof parseSlexSource;
|
|
20
21
|
declare const parseSlexKitDslApi: typeof parseSlexSource;
|
|
22
|
+
declare const validateSlexSourceApi: typeof validateSlexSource;
|
|
21
23
|
declare const createSecureRuntimeApi: typeof createSecureRuntime;
|
|
22
24
|
declare const SlexKitRuntimeErrorApi: typeof SlexKitRuntimeError;
|
|
23
25
|
declare const getSlexKitRuntimeUrlApi: typeof getSlexKitRuntimeUrl;
|
|
@@ -25,8 +27,9 @@ declare const setSlexKitRuntimeUrlApi: typeof setSlexKitRuntimeUrl;
|
|
|
25
27
|
declare const createSlexKitMarkdownRuntimeHostApi: typeof createSlexKitMarkdownRuntimeHost;
|
|
26
28
|
declare const getSlexKitMarkdownRuntimeHostApi: typeof getSlexKitMarkdownRuntimeHost;
|
|
27
29
|
declare const installSlexKitMarkdownRuntimeHostApi: typeof installSlexKitMarkdownRuntimeHost;
|
|
30
|
+
declare const slexkitStdApi: import(".").SlexKitStdlib;
|
|
28
31
|
declare const attachComponentDisposerApi: typeof attachComponentDisposer;
|
|
29
32
|
declare const configureComponentScopeApi: typeof configureComponentScope;
|
|
30
33
|
declare const startSlexKitSandboxRunnerApi: typeof startSlexKitSandboxRunner;
|
|
31
34
|
declare const getSlexKitInfoApi: typeof getSlexKitInfo;
|
|
32
|
-
export { SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION, SLEXKIT_COMPONENTS_VERSION, getSlexKitInfoApi as getSlexKitInfo, mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, attachComponentDisposerApi as attachComponentDisposer, configureComponentScopeApi as configureComponentScope, startSlexKitSandboxRunnerApi as startSlexKitSandboxRunner, };
|
|
35
|
+
export { SLEXKIT_VERSION, SLEX_PROTOCOL_VERSION, SLEXKIT_COMPONENTS_VERSION, getSlexKitInfoApi as getSlexKitInfo, mountApi as mount, ingestApi as ingest, bootApi as boot, disposeNamespaceApi as disposeNamespace, registerApi as register, getRendererApi as getRenderer, diagnoseSlexKitSourceApi as diagnoseSlexKitSource, SlexKitSyntaxErrorApi as SlexKitSyntaxError, formatSlexKitDiagnosticApi as formatSlexKitDiagnostic, mountSecureArtifactApi as mountSecureArtifact, parseSlexSourceApi as parseSlexSource, parseSlexKitDslApi as parseSlexKitDsl, validateSlexSourceApi as validateSlexSource, createSecureRuntimeApi as createSecureRuntime, SlexKitRuntimeErrorApi as SlexKitRuntimeError, getSlexKitRuntimeUrlApi as getSlexKitRuntimeUrl, setSlexKitRuntimeUrlApi as setSlexKitRuntimeUrl, createSlexKitMarkdownRuntimeHostApi as createSlexKitMarkdownRuntimeHost, getSlexKitMarkdownRuntimeHostApi as getSlexKitMarkdownRuntimeHost, installSlexKitMarkdownRuntimeHostApi as installSlexKitMarkdownRuntimeHost, slexkitStdApi as slexkitStd, attachComponentDisposerApi as attachComponentDisposer, configureComponentScopeApi as configureComponentScope, startSlexKitSandboxRunnerApi as startSlexKitSandboxRunner, };
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const SLEXKIT_VERSION = "0.
|
|
1
|
+
export declare const SLEXKIT_VERSION = "0.3.1";
|
|
2
2
|
export declare const SLEX_PROTOCOL_VERSION = "0.1";
|
|
3
|
-
export declare const SLEXKIT_COMPONENTS_VERSION = "0.
|
|
3
|
+
export declare const SLEXKIT_COMPONENTS_VERSION = "0.3.1";
|
|
4
4
|
export declare function getSlexKitInfo(): {
|
|
5
5
|
version: string;
|
|
6
6
|
protocolVersion: string;
|