slexkit 0.2.0
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/AGENTS.slexkit.md +29 -0
- package/CHANGELOG.md +90 -0
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/README.zh-CN.md +165 -0
- package/dist/ai/llms-authoring.txt +44 -0
- package/dist/ai/llms-components.txt +669 -0
- package/dist/ai/llms-full.txt +6586 -0
- package/dist/ai/llms-runtime.txt +1475 -0
- package/dist/ai/llms-toolhost.txt +295 -0
- package/dist/ai/llms.txt +69 -0
- package/dist/ai/slexkit-ai-manifest.json +2922 -0
- package/dist/base.css +621 -0
- package/dist/chunks/accordion-5f0nvjjm.js +376 -0
- package/dist/chunks/accordion-830dw78f.js +221 -0
- package/dist/chunks/accordion-cfjyxw93.js +630 -0
- package/dist/chunks/accordion-cw5r75jm.js +424 -0
- package/dist/chunks/accordion-ehnhpeca.js +492 -0
- package/dist/chunks/accordion-hzyrngd6.js +2377 -0
- package/dist/chunks/accordion-nw12ytps.js +6823 -0
- package/dist/components/accordion.js +163 -0
- package/dist/components/badge.js +80 -0
- package/dist/components/button.css +114 -0
- package/dist/components/button.js +16 -0
- package/dist/components/callout.js +154 -0
- package/dist/components/card.js +95 -0
- package/dist/components/checkbox.js +114 -0
- package/dist/components/choice.css +165 -0
- package/dist/components/code-block.js +264 -0
- package/dist/components/collapsible.js +111 -0
- package/dist/components/column.js +49 -0
- package/dist/components/content.css +474 -0
- package/dist/components/disclosure.css +162 -0
- package/dist/components/display.css +259 -0
- package/dist/components/divider.js +98 -0
- package/dist/components/feedback.css +219 -0
- package/dist/components/grid.js +67 -0
- package/dist/components/index.js +13364 -0
- package/dist/components/input.css +1247 -0
- package/dist/components/input.js +384 -0
- package/dist/components/link.js +77 -0
- package/dist/components/progress.js +111 -0
- package/dist/components/radio-group.js +189 -0
- package/dist/components/row.js +200 -0
- package/dist/components/section.js +161 -0
- package/dist/components/select.css +260 -0
- package/dist/components/select.js +16 -0
- package/dist/components/slider.css +125 -0
- package/dist/components/slider.js +175 -0
- package/dist/components/specs.js +1090 -0
- package/dist/components/stat.js +178 -0
- package/dist/components/submit.css +9 -0
- package/dist/components/submit.js +77 -0
- package/dist/components/switch.css +114 -0
- package/dist/components/switch.js +114 -0
- package/dist/components/table.js +157 -0
- package/dist/components/tabs.css +192 -0
- package/dist/components/tabs.js +17 -0
- package/dist/components/text-input.css +245 -0
- package/dist/components/text.js +50 -0
- package/dist/components/toast.js +240 -0
- package/dist/components/tooling.css +1009 -0
- package/dist/components/tooling.js +48951 -0
- package/dist/runtime.cjs +3728 -0
- package/dist/runtime.js +3686 -0
- package/dist/slexkit.cjs +18539 -0
- package/dist/slexkit.css +4776 -0
- package/dist/slexkit.js +18497 -0
- package/dist/tooling.js +59141 -0
- package/dist/types/components/accordion.d.ts +2 -0
- package/dist/types/components/badge.d.ts +2 -0
- package/dist/types/components/button.d.ts +2 -0
- package/dist/types/components/callout.d.ts +2 -0
- package/dist/types/components/card.d.ts +2 -0
- package/dist/types/components/checkbox.d.ts +2 -0
- package/dist/types/components/code-block.d.ts +2 -0
- package/dist/types/components/collapsible.d.ts +2 -0
- package/dist/types/components/column.d.ts +2 -0
- package/dist/types/components/divider.d.ts +2 -0
- package/dist/types/components/entries/accordion.d.ts +3 -0
- package/dist/types/components/entries/badge.d.ts +3 -0
- package/dist/types/components/entries/button.d.ts +3 -0
- package/dist/types/components/entries/callout.d.ts +3 -0
- package/dist/types/components/entries/card.d.ts +3 -0
- package/dist/types/components/entries/checkbox.d.ts +3 -0
- package/dist/types/components/entries/code-block.d.ts +3 -0
- package/dist/types/components/entries/collapsible.d.ts +3 -0
- package/dist/types/components/entries/column.d.ts +3 -0
- package/dist/types/components/entries/divider.d.ts +3 -0
- package/dist/types/components/entries/grid.d.ts +3 -0
- package/dist/types/components/entries/input.d.ts +3 -0
- package/dist/types/components/entries/link.d.ts +3 -0
- package/dist/types/components/entries/progress.d.ts +3 -0
- package/dist/types/components/entries/radio-group.d.ts +3 -0
- package/dist/types/components/entries/row.d.ts +3 -0
- package/dist/types/components/entries/section.d.ts +3 -0
- package/dist/types/components/entries/select.d.ts +3 -0
- package/dist/types/components/entries/slider.d.ts +3 -0
- package/dist/types/components/entries/specs.d.ts +1 -0
- package/dist/types/components/entries/stat.d.ts +3 -0
- package/dist/types/components/entries/submit.d.ts +3 -0
- package/dist/types/components/entries/switch.d.ts +3 -0
- package/dist/types/components/entries/table.d.ts +3 -0
- package/dist/types/components/entries/tabs.d.ts +3 -0
- package/dist/types/components/entries/text.d.ts +3 -0
- package/dist/types/components/entries/toast.d.ts +3 -0
- package/dist/types/components/entries/tooling.d.ts +1 -0
- package/dist/types/components/grid.d.ts +2 -0
- package/dist/types/components/index.d.ts +6 -0
- package/dist/types/components/input.d.ts +2 -0
- package/dist/types/components/link.d.ts +2 -0
- package/dist/types/components/progress.d.ts +2 -0
- package/dist/types/components/radio-group.d.ts +2 -0
- package/dist/types/components/row.d.ts +2 -0
- package/dist/types/components/section.d.ts +2 -0
- package/dist/types/components/select.d.ts +2 -0
- package/dist/types/components/slider.d.ts +2 -0
- package/dist/types/components/spec-helpers.d.ts +23 -0
- package/dist/types/components/spec-registry.d.ts +12 -0
- package/dist/types/components/spec-schema.d.ts +74 -0
- package/dist/types/components/specs.d.ts +2 -0
- package/dist/types/components/stat.d.ts +2 -0
- package/dist/types/components/submit.d.ts +2 -0
- package/dist/types/components/svelte/adapter.d.ts +3 -0
- package/dist/types/components/svelte/bindProps.d.ts +2 -0
- package/dist/types/components/svelte/helpers.d.ts +33 -0
- package/dist/types/components/svelte/layout/balancedTiles.d.ts +14 -0
- package/dist/types/components/svelte/types.d.ts +12 -0
- package/dist/types/components/switch.d.ts +2 -0
- package/dist/types/components/table.d.ts +2 -0
- package/dist/types/components/tabs.d.ts +2 -0
- package/dist/types/components/text.d.ts +2 -0
- package/dist/types/components/toast.d.ts +2 -0
- package/dist/types/components/tooling.d.ts +2 -0
- package/dist/types/components-svelte.d.ts +5 -0
- package/dist/types/engine/component-scope.d.ts +14 -0
- package/dist/types/engine/component-state.d.ts +9 -0
- package/dist/types/engine/diagnostics.d.ts +24 -0
- package/dist/types/engine/engineering.d.ts +11 -0
- package/dist/types/engine/eval.d.ts +5 -0
- package/dist/types/engine/index.d.ts +26 -0
- package/dist/types/engine/markdown-runtime.d.ts +33 -0
- package/dist/types/engine/merge.d.ts +1 -0
- package/dist/types/engine/reactive.d.ts +11 -0
- package/dist/types/engine/registry.d.ts +4 -0
- package/dist/types/engine/renderer.d.ts +6 -0
- package/dist/types/engine/sandbox-runner.d.ts +2 -0
- package/dist/types/engine/secure-runtime.d.ts +214 -0
- package/dist/types/engine/store.d.ts +12 -0
- package/dist/types/engine/types.d.ts +58 -0
- package/dist/types/icons/manager.d.ts +17 -0
- package/dist/types/icons/phosphor.d.ts +45 -0
- package/dist/types/index.d.ts +61 -0
- package/dist/types/runtime.d.ts +32 -0
- package/dist/types/toolhost/index.d.ts +78 -0
- package/dist/types/tooling-umd.d.ts +47 -0
- package/dist/types/version.d.ts +8 -0
- package/dist/umd/slexkit.tooling.umd.js +66553 -0
- package/dist/umd/slexkit.umd.js +18552 -0
- package/package.json +136 -0
- package/scripts/cli.mjs +47 -0
- package/skills/slexkit/SKILL.md +27 -0
- package/skills/slexkit-author/SKILL.md +50 -0
- package/skills/slexkit-host-integration/SKILL.md +33 -0
- package/skills/slexkit-secure-runtime/SKILL.md +31 -0
- package/skills/slexkit-toolhost/SKILL.md +38 -0
- package/skills/slexkit-update/SKILL.md +23 -0
- package/src/components/svelte/InlineIcon.svelte +66 -0
- package/src/components/svelte/adapter.ts +76 -0
- package/src/components/svelte/bindProps.ts +9 -0
- package/src/components/svelte/content/Badge.svelte +19 -0
- package/src/components/svelte/content/Callout.svelte +57 -0
- package/src/components/svelte/content/CodeBlock.svelte +130 -0
- package/src/components/svelte/content/Divider.svelte +21 -0
- package/src/components/svelte/content/Link.svelte +21 -0
- package/src/components/svelte/content/Section.svelte +24 -0
- package/src/components/svelte/content/Table.svelte +44 -0
- package/src/components/svelte/disclosure/Accordion.svelte +100 -0
- package/src/components/svelte/disclosure/Collapsible.svelte +45 -0
- package/src/components/svelte/display/Stat.svelte +102 -0
- package/src/components/svelte/display/Text.svelte +11 -0
- package/src/components/svelte/feedback/Progress.svelte +34 -0
- package/src/components/svelte/feedback/Toast.svelte +105 -0
- package/src/components/svelte/helpers.ts +148 -0
- package/src/components/svelte/input/Button.svelte +78 -0
- package/src/components/svelte/input/Checkbox.svelte +52 -0
- package/src/components/svelte/input/Input.svelte +202 -0
- package/src/components/svelte/input/RadioGroup.svelte +71 -0
- package/src/components/svelte/input/Select.svelte +220 -0
- package/src/components/svelte/input/Slider.svelte +96 -0
- package/src/components/svelte/input/Submit.svelte +32 -0
- package/src/components/svelte/input/Switch.svelte +53 -0
- package/src/components/svelte/input/Tabs.svelte +188 -0
- package/src/components/svelte/layout/Card.svelte +17 -0
- package/src/components/svelte/layout/Column.svelte +15 -0
- package/src/components/svelte/layout/Grid.svelte +26 -0
- package/src/components/svelte/layout/Row.svelte +105 -0
- package/src/components/svelte/layout/balancedTiles.ts +85 -0
- package/src/components/svelte/tooling/CodeMirror.svelte +91 -0
- package/src/components/svelte/tooling/Playground.svelte +765 -0
- package/src/components/svelte/tooling/PlaygroundMarkdown.svelte +26 -0
- package/src/components/svelte/tooling/PlaygroundSlexCode.svelte +76 -0
- package/src/components/svelte/types.ts +17 -0
- package/src/styles/animation.css +98 -0
- package/src/styles/components/button.css +114 -0
- package/src/styles/components/choice.css +165 -0
- package/src/styles/components/select.css +260 -0
- package/src/styles/components/slider.css +125 -0
- package/src/styles/components/submit.css +9 -0
- package/src/styles/components/switch.css +114 -0
- package/src/styles/components/tabs.css +192 -0
- package/src/styles/components/text-input.css +245 -0
- package/src/styles/content.css +474 -0
- package/src/styles/disclosure.css +162 -0
- package/src/styles/display.css +259 -0
- package/src/styles/entry.css +34 -0
- package/src/styles/feedback.css +219 -0
- package/src/styles/input.css +8 -0
- package/src/styles/layout.css +365 -0
- package/src/styles/theme.css +31 -0
- package/src/styles/tooling.css +1009 -0
package/package.json
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slexkit",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Zero-build, Markdown-friendly reactive UI runtime for AI output.",
|
|
5
|
+
"author": "SlexKit contributors",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/slexkit/slexkit.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/slexkit/slexkit#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/slexkit/slexkit/issues"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/slexkit.cjs",
|
|
16
|
+
"module": "./dist/slexkit.js",
|
|
17
|
+
"types": "./dist/types/index.d.ts",
|
|
18
|
+
"bin": {
|
|
19
|
+
"slex": "./scripts/cli.mjs"
|
|
20
|
+
},
|
|
21
|
+
"workspaces": [
|
|
22
|
+
"packages/*"
|
|
23
|
+
],
|
|
24
|
+
"sideEffects": [
|
|
25
|
+
"**/*.css",
|
|
26
|
+
"dist/tooling.js",
|
|
27
|
+
"dist/components/*.js",
|
|
28
|
+
"dist/components/*.cjs"
|
|
29
|
+
],
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/types/index.d.ts",
|
|
33
|
+
"import": "./dist/slexkit.js",
|
|
34
|
+
"require": "./dist/slexkit.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./runtime": {
|
|
37
|
+
"types": "./dist/types/runtime.d.ts",
|
|
38
|
+
"import": "./dist/runtime.js",
|
|
39
|
+
"require": "./dist/runtime.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./components": {
|
|
42
|
+
"types": "./dist/types/components/index.d.ts",
|
|
43
|
+
"import": "./dist/components/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./components/*": {
|
|
46
|
+
"types": "./dist/types/components/*.d.ts",
|
|
47
|
+
"import": "./dist/components/*.js"
|
|
48
|
+
},
|
|
49
|
+
"./tooling": {
|
|
50
|
+
"types": "./dist/types/components/tooling.d.ts",
|
|
51
|
+
"import": "./dist/tooling.js"
|
|
52
|
+
},
|
|
53
|
+
"./style.css": "./dist/slexkit.css",
|
|
54
|
+
"./base.css": "./dist/base.css",
|
|
55
|
+
"./components/*.css": "./dist/components/*.css",
|
|
56
|
+
"./dist/slexkit.js": "./dist/slexkit.js",
|
|
57
|
+
"./dist/runtime.js": "./dist/runtime.js",
|
|
58
|
+
"./dist/style.css": "./dist/slexkit.css",
|
|
59
|
+
"./dist/base.css": "./dist/base.css",
|
|
60
|
+
"./dist/components/*.css": "./dist/components/*.css",
|
|
61
|
+
"./styles/*": {
|
|
62
|
+
"import": "./src/styles/*.css"
|
|
63
|
+
},
|
|
64
|
+
"./src-components/*": {
|
|
65
|
+
"import": "./src/components/svelte/*"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"files": [
|
|
69
|
+
"dist/",
|
|
70
|
+
"skills/",
|
|
71
|
+
"scripts/cli.mjs",
|
|
72
|
+
"src/styles/*.css",
|
|
73
|
+
"src/styles/components/*.css",
|
|
74
|
+
"src/components/svelte/**/*.svelte",
|
|
75
|
+
"src/components/svelte/**/*.ts",
|
|
76
|
+
"AGENTS.slexkit.md",
|
|
77
|
+
"CHANGELOG.md",
|
|
78
|
+
"README.md",
|
|
79
|
+
"README.zh-CN.md",
|
|
80
|
+
"LICENSE"
|
|
81
|
+
],
|
|
82
|
+
"scripts": {
|
|
83
|
+
"dev": "bun run site/server.ts",
|
|
84
|
+
"build": "bun run build:core && bun run --filter @slexkit/streamdown build && bun run --filter @slexkit/obsidian build && bun run --filter @slexkit/mcp build",
|
|
85
|
+
"build:core": "bun run scripts/build-core.ts",
|
|
86
|
+
"ai:docs": "bun run scripts/generate-ai-docs.ts",
|
|
87
|
+
"version:sync": "bun run scripts/sync-version.ts",
|
|
88
|
+
"changelog:sync": "bun run scripts/sync-changelog.ts",
|
|
89
|
+
"docs:sync-spec": "bun run site/scripts/sync-doc-spec-blocks.ts",
|
|
90
|
+
"site:export": "bun run build:core && bun run site/scripts/export-static.ts",
|
|
91
|
+
"site:preview-static": "bunx serve site-static",
|
|
92
|
+
"copy-runtime": "node scripts/cli.mjs copy-runtime",
|
|
93
|
+
"preview": "bun run site/server.ts",
|
|
94
|
+
"smoke:release": "node scripts/release-smoke.mjs",
|
|
95
|
+
"test": "bun test --conditions browser --isolate --preload ./tests/setup.ts tests packages",
|
|
96
|
+
"test:watch": "bun test --conditions browser --isolate --watch --preload ./tests/setup.ts tests packages",
|
|
97
|
+
"lint": "eslint src/",
|
|
98
|
+
"format": "prettier --write src/",
|
|
99
|
+
"publish:npm": "node scripts/publish-npm.mjs"
|
|
100
|
+
},
|
|
101
|
+
"keywords": [
|
|
102
|
+
"reactive",
|
|
103
|
+
"ui",
|
|
104
|
+
"slex",
|
|
105
|
+
"expression",
|
|
106
|
+
"assembly",
|
|
107
|
+
"streaming",
|
|
108
|
+
"svelte"
|
|
109
|
+
],
|
|
110
|
+
"license": "MIT",
|
|
111
|
+
"dependencies": {
|
|
112
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
113
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
114
|
+
"@codemirror/state": "^6.6.0",
|
|
115
|
+
"@codemirror/view": "^6.43.0",
|
|
116
|
+
"@humanspeak/svelte-markdown": "^1.5.2",
|
|
117
|
+
"@phosphor-icons/core": "^2.1.1",
|
|
118
|
+
"codemirror": "^6.0.2",
|
|
119
|
+
"flowbite": "^4.0.2",
|
|
120
|
+
"flowbite-svelte": "^1.33.1",
|
|
121
|
+
"katex": "^0.17.0",
|
|
122
|
+
"svelte": "^5.55.9",
|
|
123
|
+
"svelte-highlight": "^7.9.0"
|
|
124
|
+
},
|
|
125
|
+
"devDependencies": {
|
|
126
|
+
"@types/bun": "^1.3.4",
|
|
127
|
+
"@unocss/cli": "^66.7.0",
|
|
128
|
+
"@unocss/preset-wind4": "^66.7.0",
|
|
129
|
+
"eslint": "^9.0.0",
|
|
130
|
+
"jsdom": "^25.0.0",
|
|
131
|
+
"prettier": "^3.4.0",
|
|
132
|
+
"tailwindcss": "^4.3.0",
|
|
133
|
+
"typescript": "^5.7.0",
|
|
134
|
+
"typescript-eslint": "^8.59.3"
|
|
135
|
+
}
|
|
136
|
+
}
|
package/scripts/cli.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { copyFileSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
|
|
8
|
+
function help() {
|
|
9
|
+
console.log(`SlexKit CLI
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
slex copy-runtime [target]
|
|
13
|
+
|
|
14
|
+
Commands:
|
|
15
|
+
copy-runtime Copy dist/runtime.js to a public static path.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
slex copy-runtime public/slexkit.runtime.js
|
|
19
|
+
`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function copyRuntime(target = "public/slexkit.runtime.js") {
|
|
23
|
+
const source = resolve(packageRoot, "dist", "runtime.js");
|
|
24
|
+
const destination = resolve(process.cwd(), target);
|
|
25
|
+
mkdirSync(dirname(destination), { recursive: true });
|
|
26
|
+
copyFileSync(source, destination);
|
|
27
|
+
console.log(`Copied SlexKit runtime to ${destination}`);
|
|
28
|
+
console.log("Serve this file with:");
|
|
29
|
+
console.log(" Access-Control-Allow-Origin: *");
|
|
30
|
+
console.log(" Content-Type: text/javascript");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const command = process.argv[2];
|
|
34
|
+
|
|
35
|
+
if (!command || command === "--help" || command === "-h") {
|
|
36
|
+
help();
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (command === "copy-runtime") {
|
|
41
|
+
copyRuntime(process.argv[3]);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.error(`Unknown SlexKit command: ${command}`);
|
|
46
|
+
help();
|
|
47
|
+
process.exit(1);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slexkit
|
|
3
|
+
description: Slash-command style `/slexkit` skill for SlexKit architecture, positioning, package boundaries, and display UI versus ToolHost decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SlexKit
|
|
7
|
+
|
|
8
|
+
Use this skill as `/slexkit` for project overview and boundary decisions.
|
|
9
|
+
|
|
10
|
+
## Core Position
|
|
11
|
+
|
|
12
|
+
SlexKit is a zero-build, Markdown-friendly reactive UI runtime for AI output. It renders small interactive fragments in chat messages, documents, agent panels, and tool dashboards.
|
|
13
|
+
|
|
14
|
+
## Boundaries
|
|
15
|
+
|
|
16
|
+
- Display UI goes through Markdown `slex` fences or direct runtime mounting.
|
|
17
|
+
- Structured user input goes through ToolHost.
|
|
18
|
+
- Untrusted or agent-generated source uses secure runtime mode.
|
|
19
|
+
- SlexKit raw docs are `.md` files with `slex` fences, not `.mdx`.
|
|
20
|
+
- SlexKit is not a full app framework and not a React JSX generator.
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
1. Read `/llms.txt` first for navigation.
|
|
25
|
+
2. Use `slexkitDocs` from `@slexkit/mcp` when available.
|
|
26
|
+
3. Use `slexkitExamples` for component examples or host snippets.
|
|
27
|
+
4. Use `slexkitValidate` before presenting generated Slex source.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slexkit-author
|
|
3
|
+
description: Slash-command style `/author` skill for writing SlexKit display-oriented interactive UI as explicit Markdown `slex` fences with readable fallback.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SlexKit Author
|
|
7
|
+
|
|
8
|
+
Use this skill as `/author` when creating display-oriented SlexKit output.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Prefer the `@slexkit/mcp` tools when available: call `slexkitDocs`, `slexkitExamples`, and `slexkitValidate`.
|
|
13
|
+
2. Read `/llms-authoring.txt` for authoring rules and `/llms-components.txt` for component props when MCP is unavailable.
|
|
14
|
+
3. Emit a fenced Markdown block tagged `slex`.
|
|
15
|
+
4. Use the envelope `{ namespace, g, layout }`.
|
|
16
|
+
5. Put state and helper logic in `g`; put component tree fields in `layout`.
|
|
17
|
+
6. Add Markdown fallback immediately after the fence.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- Use display UI for summaries, status cards, metrics, calculators, progress, tables, and dashboards.
|
|
22
|
+
- Component keys must be `type:identifier`.
|
|
23
|
+
- Dynamic props use `$` read-pipes, for example `"$text": "g.done + ' done'"`.
|
|
24
|
+
- Event handlers use `on*` write-pipes, for example `onclick: "g.count++"`.
|
|
25
|
+
- Do not emit imports, JSX, Svelte, Vue, or app scaffolding.
|
|
26
|
+
- Do not ask hosts to scan plain JavaScript or JSON blocks.
|
|
27
|
+
- Do not use ToolHost unless the UI must return submitted or ignored structured data.
|
|
28
|
+
- Do not request `.mdx`; SlexKit raw docs are `.md` files with `slex` fences.
|
|
29
|
+
|
|
30
|
+
## Output Shape
|
|
31
|
+
|
|
32
|
+
````md
|
|
33
|
+
```slex
|
|
34
|
+
{
|
|
35
|
+
namespace: "status",
|
|
36
|
+
g: { done: 3, total: 4 },
|
|
37
|
+
layout: {
|
|
38
|
+
"card:summary": {
|
|
39
|
+
title: "Status",
|
|
40
|
+
"text:count": { "$text": "g.done + '/' + g.total + ' complete'" },
|
|
41
|
+
"progress:bar": { "$value": "g.done / g.total * 100" }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Status:** 3/4 complete.
|
|
48
|
+
````
|
|
49
|
+
|
|
50
|
+
Validate generated source before presenting it when a local parser or MCP tool is available.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slexkit-host-integration
|
|
3
|
+
description: Slash-command style `/host` skill for integrating SlexKit into Markdown renderers, chat hosts, Streamdown, Obsidian, or custom host adapters.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SlexKit Host Integration
|
|
7
|
+
|
|
8
|
+
Use this skill as `/host` when adding SlexKit to a host application or documentation renderer.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Read `/llms-runtime.txt` or call `slexkitDocs` through `@slexkit/mcp` with `group: "Runtime"`.
|
|
13
|
+
2. Determine the trust boundary:
|
|
14
|
+
- Trusted content: use `mount()` or trusted Markdown runtime mode.
|
|
15
|
+
- Untrusted or agent-generated content: use `mountSecureArtifact()` or secure Markdown runtime mode.
|
|
16
|
+
3. Process only explicitly tagged `slex` fences.
|
|
17
|
+
4. Preserve fallback Markdown in unsupported environments.
|
|
18
|
+
5. Serve `slexkit.runtime.js` as a public ES module for secure iframe mode.
|
|
19
|
+
|
|
20
|
+
## Integration Paths
|
|
21
|
+
|
|
22
|
+
- Vanilla host: `createSlexKitMarkdownRuntimeHost`.
|
|
23
|
+
- React/Streamdown: `@slexkit/streamdown`.
|
|
24
|
+
- Obsidian: `@slexkit/obsidian`, readonly fenced block rendering.
|
|
25
|
+
- Custom host: detect the `slex` code fence, pass source plus artifact id to the runtime host, dispose when the block is removed.
|
|
26
|
+
|
|
27
|
+
## Rules
|
|
28
|
+
|
|
29
|
+
- Do not scan arbitrary JavaScript, JSON, or untagged code blocks.
|
|
30
|
+
- Do not add `.mdx` handling; use Markdown `.md` sources with explicit `slex` fences.
|
|
31
|
+
- Do not bypass secure mode for untrusted model output.
|
|
32
|
+
- Keep ToolHost separate from ordinary display fence rendering.
|
|
33
|
+
- Use `runtimeHost`, `securePolicy`, `hostAdapter`, and `secureFrame` options instead of inventing a second lifecycle.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slexkit-secure-runtime
|
|
3
|
+
description: Slash-command style `/secure` skill for configuring SlexKit secure runtime, sandbox iframe isolation, host policy, and fail-closed behavior.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SlexKit Secure Runtime
|
|
7
|
+
|
|
8
|
+
Use this skill as `/secure` when rendering untrusted or agent-generated Slex source.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Read `/llms-runtime.txt` or call `slexkitDocs` through `@slexkit/mcp` with `group: "Security"` or `group: "Runtime"`.
|
|
13
|
+
2. Use secure runtime mode for untrusted source.
|
|
14
|
+
3. Serve `slexkit.runtime.js` as a public ES module.
|
|
15
|
+
4. Configure host policy for sensitive capabilities.
|
|
16
|
+
5. Keep the iframe sandboxed with an opaque origin.
|
|
17
|
+
6. Dispose runtime artifacts when the owning Markdown block or message is removed.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
- Do not run untrusted source in the host realm.
|
|
22
|
+
- Do not grant network, timers, canvas, or host APIs unless the host policy explicitly allows them.
|
|
23
|
+
- Do not use security as a parser substitute: still process only explicit `slex` fences.
|
|
24
|
+
- Keep fail-closed behavior. If runtime boot, heartbeat, policy, or parse validation fails, show fallback or diagnostics instead of executing in trusted mode.
|
|
25
|
+
|
|
26
|
+
## Checks
|
|
27
|
+
|
|
28
|
+
- `runtimeUrl` points to the built runtime module.
|
|
29
|
+
- CORS and content type are correct for ES module loading.
|
|
30
|
+
- Host policy is minimal.
|
|
31
|
+
- Fallback Markdown remains readable if secure rendering fails.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slexkit-toolhost
|
|
3
|
+
description: Slash-command style `/toolhost` skill for SlexKit confirmations, choices, and forms that return structured submitted or ignored results.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SlexKit ToolHost
|
|
7
|
+
|
|
8
|
+
Use this skill as `/toolhost` when UI must return structured user input to the host.
|
|
9
|
+
|
|
10
|
+
## When To Use
|
|
11
|
+
|
|
12
|
+
Use ToolHost for:
|
|
13
|
+
|
|
14
|
+
- confirmations and approvals
|
|
15
|
+
- single or multi-choice option lists
|
|
16
|
+
- forms
|
|
17
|
+
- flows that must resolve a Promise with `submitted` or `ignored`
|
|
18
|
+
|
|
19
|
+
Do not use ToolHost for ordinary display-only status cards, dashboards, calculators, summaries, or metrics. Those should be `slex` fences.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. Read `/llms-toolhost.txt` or call `slexkitDocs` through `@slexkit/mcp` with `group: "ToolHost"`.
|
|
24
|
+
2. Prefer built-in templates: `confirm-action`, `choose-options`, `option-list`, `fill-form`.
|
|
25
|
+
3. Use `renderToolCall(call, container)` for host rendering.
|
|
26
|
+
4. Await `handle.promise` and dispose the handle after completion.
|
|
27
|
+
5. For custom templates, compile a `ToolCall` into a `SlexExpression` and include a `submit:actions` boundary.
|
|
28
|
+
|
|
29
|
+
## Result Contract
|
|
30
|
+
|
|
31
|
+
Tool results resolve to:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
{ toolName: string; status: "submitted"; value: Record<string, unknown> }
|
|
35
|
+
{ toolName: string; status: "ignored"; value: null }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Keep returned values small, explicit, and host-readable.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slexkit-update
|
|
3
|
+
description: Slash-command style `/update` skill for regenerating SlexKit AI docs, MCP data, skills, and tests after docs, component, or public API changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SlexKit Update
|
|
7
|
+
|
|
8
|
+
Use this skill as `/update` after SlexKit docs, component specs, examples, or public APIs change.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Regenerate AI docs with `bun run ai:docs` or as part of `bun run build:core`.
|
|
13
|
+
2. Rebuild the MCP package with `bun run --filter @slexkit/mcp build`.
|
|
14
|
+
3. Verify `/llms.txt` remains a `.md` documentation index and contains no `.mdx`.
|
|
15
|
+
4. Verify `slexkit-ai-manifest.json` page entries have `rawHref` values ending in `.md`.
|
|
16
|
+
5. Run targeted AI tooling tests, then the normal project test gate.
|
|
17
|
+
|
|
18
|
+
## Checks
|
|
19
|
+
|
|
20
|
+
- `llms.txt` is navigable and grouped.
|
|
21
|
+
- `llms-full.txt` preserves Markdown `slex` fences.
|
|
22
|
+
- MCP exposes `slexkitDocs`, `slexkitExamples`, and `slexkitValidate`.
|
|
23
|
+
- Skills still describe `/slexkit`, `/author`, `/host`, `/toolhost`, `/secure`, and `/update`.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getIcon, iconCacheKey, loadIcon } from "../../icons/manager";
|
|
3
|
+
import type { IconState, IconWeight } from "../../icons/manager";
|
|
4
|
+
import { text } from "./helpers";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
name,
|
|
8
|
+
selected = false,
|
|
9
|
+
active = false,
|
|
10
|
+
pressed = false,
|
|
11
|
+
current = false,
|
|
12
|
+
weight,
|
|
13
|
+
className = "",
|
|
14
|
+
onIconLoad,
|
|
15
|
+
}: {
|
|
16
|
+
name?: unknown;
|
|
17
|
+
selected?: unknown;
|
|
18
|
+
active?: unknown;
|
|
19
|
+
pressed?: unknown;
|
|
20
|
+
current?: unknown;
|
|
21
|
+
weight?: IconWeight | null;
|
|
22
|
+
className?: string;
|
|
23
|
+
onIconLoad?: () => void;
|
|
24
|
+
} = $props();
|
|
25
|
+
|
|
26
|
+
let loadedIcons = $state<Record<string, string>>({});
|
|
27
|
+
let iconRequest = 0;
|
|
28
|
+
const iconName = $derived(text(name));
|
|
29
|
+
|
|
30
|
+
function iconState(): IconState {
|
|
31
|
+
return { selected, active, pressed, current, weight };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function hasStateVariant(): boolean {
|
|
35
|
+
return !!(selected || active || pressed || current || (weight && weight !== "regular"));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function icon(): string {
|
|
39
|
+
if (!iconName) return "";
|
|
40
|
+
const nextState = iconState();
|
|
41
|
+
const variantIcon = getIcon(iconName, nextState) || loadedIcons[iconCacheKey(iconName, nextState)] || "";
|
|
42
|
+
if (variantIcon) return variantIcon;
|
|
43
|
+
return hasStateVariant()
|
|
44
|
+
? getIcon(iconName) || loadedIcons[iconCacheKey(iconName)] || ""
|
|
45
|
+
: "";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
$effect(() => {
|
|
49
|
+
const nextName = iconName;
|
|
50
|
+
if (!nextName) return;
|
|
51
|
+
const nextState = iconState();
|
|
52
|
+
const key = iconCacheKey(nextName, nextState);
|
|
53
|
+
if (getIcon(nextName, nextState) || loadedIcons[key]) return;
|
|
54
|
+
|
|
55
|
+
const request = ++iconRequest;
|
|
56
|
+
void loadIcon(nextName, nextState).then((svg) => {
|
|
57
|
+
if (request !== iconRequest || !svg) return;
|
|
58
|
+
loadedIcons = { ...loadedIcons, [key]: svg };
|
|
59
|
+
onIconLoad?.();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
{#if icon()}
|
|
65
|
+
<span class={`slex-icon ${className}`.trim()} aria-hidden="true">{@html icon()}</span>
|
|
66
|
+
{/if}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { flushSync, mount as mountSvelte, unmount } from "svelte";
|
|
2
|
+
import type { ComponentRenderer } from "../../engine/types";
|
|
3
|
+
import { attachComponentDisposer, configureComponentScope } from "../../engine/component-scope";
|
|
4
|
+
import type { PropStore, PropValues, SvelteBuiltinComponent } from "./types";
|
|
5
|
+
|
|
6
|
+
type Readable<T = unknown> = {
|
|
7
|
+
subscribe(run: (value: T) => void): () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
configureComponentScope({ flush: () => flushSync() });
|
|
11
|
+
|
|
12
|
+
function isReadable(value: unknown): value is Readable {
|
|
13
|
+
return !!value &&
|
|
14
|
+
(typeof value === "object" || typeof value === "function") &&
|
|
15
|
+
typeof (value as Readable).subscribe === "function";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function createPropsStore(
|
|
19
|
+
props: Record<string, unknown>,
|
|
20
|
+
): PropStore {
|
|
21
|
+
return {
|
|
22
|
+
subscribe(run) {
|
|
23
|
+
const current: PropValues = {};
|
|
24
|
+
const cleanups: Array<() => void> = [];
|
|
25
|
+
let ready = false;
|
|
26
|
+
|
|
27
|
+
const emit = () => {
|
|
28
|
+
if (ready) run({ ...current });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
for (const [key, value] of Object.entries(props)) {
|
|
32
|
+
if (key.startsWith("on") && typeof value === "function") continue;
|
|
33
|
+
const propName = key.startsWith("$") ? key.slice(1) : key;
|
|
34
|
+
if (isReadable(value)) {
|
|
35
|
+
cleanups.push(value.subscribe((next) => {
|
|
36
|
+
current[propName] = next;
|
|
37
|
+
emit();
|
|
38
|
+
}));
|
|
39
|
+
} else {
|
|
40
|
+
current[propName] = value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ready = true;
|
|
45
|
+
run({ ...current });
|
|
46
|
+
return () => {
|
|
47
|
+
for (const cleanup of cleanups) cleanup();
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createSvelteRenderer(type: string, Component: SvelteBuiltinComponent): ComponentRenderer {
|
|
54
|
+
return (props, name, ctx) => {
|
|
55
|
+
const host = (ctx.document || document).createElement("div");
|
|
56
|
+
const instance = mountSvelte(Component, {
|
|
57
|
+
target: host,
|
|
58
|
+
props: {
|
|
59
|
+
componentName: name,
|
|
60
|
+
ctx,
|
|
61
|
+
props: createPropsStore(props),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
flushSync();
|
|
65
|
+
const root = host.firstElementChild as HTMLElement | null;
|
|
66
|
+
if (!root) {
|
|
67
|
+
void unmount(instance);
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
root.remove();
|
|
71
|
+
attachComponentDisposer(root, () => {
|
|
72
|
+
void unmount(instance);
|
|
73
|
+
});
|
|
74
|
+
return root;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { bindPropStore } from "../bindProps";
|
|
3
|
+
import { text } from "../helpers";
|
|
4
|
+
import InlineIcon from "../InlineIcon.svelte";
|
|
5
|
+
import type { PropValues, SvelteComponentProps } from "../types";
|
|
6
|
+
|
|
7
|
+
let { props, componentName }: SvelteComponentProps = $props();
|
|
8
|
+
let p = $state<PropValues>({});
|
|
9
|
+
$effect(() => bindPropStore(props, (next) => (p = next)));
|
|
10
|
+
|
|
11
|
+
function tone(): string {
|
|
12
|
+
const raw = text(p.tone ?? p.type ?? p.variant, "neutral").toLowerCase();
|
|
13
|
+
if (raw === "danger" || raw === "error") return "destructive";
|
|
14
|
+
if (raw === "muted" || raw === "neutral" || raw === "default") return "neutral";
|
|
15
|
+
return raw;
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<span class="slex-badge" data-tone={tone()}>{#if p.icon}<InlineIcon name={p.icon} className="slex-badge-icon" />{/if}<span class="slex-badge-label">{text(p.label ?? p.text ?? p.content ?? componentName)}</span></span>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import FlowbiteToast from "../../../../node_modules/flowbite-svelte/dist/toast/Toast.svelte";
|
|
3
|
+
import { bindPropStore } from "../bindProps";
|
|
4
|
+
import { renderChildren, text } from "../helpers";
|
|
5
|
+
import InlineIcon from "../InlineIcon.svelte";
|
|
6
|
+
import type { PropValues, SvelteComponentProps } from "../types";
|
|
7
|
+
|
|
8
|
+
let { props, ctx }: SvelteComponentProps = $props();
|
|
9
|
+
let p = $state<PropValues>({});
|
|
10
|
+
$effect(() => bindPropStore(props, (next) => (p = next)));
|
|
11
|
+
|
|
12
|
+
function tone(): string {
|
|
13
|
+
const raw = text(p.tone ?? p.type, "info").toLowerCase();
|
|
14
|
+
if (raw === "error" || raw === "destructive") return "danger";
|
|
15
|
+
if (raw === "neutral" || raw === "default" || raw === "muted") return "info";
|
|
16
|
+
return raw;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function titleText(): string {
|
|
20
|
+
return text(p.title ?? p.label ?? p.heading);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function descriptionText(): string {
|
|
24
|
+
return text(p.text ?? p.content ?? p.description ?? p.message);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function role(): "alert" | "note" {
|
|
28
|
+
return tone() === "danger" ? "alert" : "note";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function color(): "blue" | "green" | "yellow" | "red" | "gray" {
|
|
32
|
+
const kind = tone();
|
|
33
|
+
if (kind === "success") return "green";
|
|
34
|
+
if (kind === "warning") return "yellow";
|
|
35
|
+
if (kind === "danger") return "red";
|
|
36
|
+
if (kind === "muted" || kind === "neutral") return "gray";
|
|
37
|
+
return "blue";
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<FlowbiteToast
|
|
42
|
+
class="slex-callout"
|
|
43
|
+
data-scope="callout"
|
|
44
|
+
data-tone={tone()}
|
|
45
|
+
color={color()}
|
|
46
|
+
role={role()}
|
|
47
|
+
aria-live={role() === "alert" ? "assertive" : "polite"}
|
|
48
|
+
dismissable={false}
|
|
49
|
+
align={false}
|
|
50
|
+
classes={{ icon: "slex-callout-mark", content: "slex-callout-content" }}
|
|
51
|
+
>
|
|
52
|
+
{#snippet icon()}
|
|
53
|
+
<span aria-hidden="true"></span>
|
|
54
|
+
{/snippet}
|
|
55
|
+
{#if titleText()}<div class="slex-callout-title">{#if p.icon}<InlineIcon name={p.icon} className="slex-callout-icon" />{/if}<span>{titleText()}</span></div>{/if}
|
|
56
|
+
<div class="slex-callout-body" use:renderChildren={ctx}>{descriptionText()}</div>
|
|
57
|
+
</FlowbiteToast>
|