@slexkit/mcp 0.2.0 → 0.3.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/README.md +3 -3
- package/dist/data/llms-authoring.txt +2 -0
- package/dist/data/llms-capabilities.txt +126 -0
- package/dist/data/llms-components.txt +27 -6
- package/dist/data/llms-full.txt +1729 -4
- package/dist/data/llms-runtime.txt +7 -1
- package/dist/data/llms.txt +22 -1
- package/dist/data/slexkit-ai-manifest.json +674 -23
- package/dist/index.js +1482 -41
- package/dist/index.js.map +5 -5
- package/package.json +39 -39
|
@@ -51,7 +51,7 @@ ComponentKey = ComponentType ":" Identifier
|
|
|
51
51
|
- Named components use `Identifier` for instance state and lifecycle hooks.
|
|
52
52
|
- Keys without `:` are not rendered as component nodes.
|
|
53
53
|
|
|
54
|
-
Reserved context names: `g`, `api`, `$event`, `$item`, `$index`, `$key`.
|
|
54
|
+
Reserved context names: `g`, `std`, `api`, `$event`, `$item`, `$index`, `$key`.
|
|
55
55
|
|
|
56
56
|
## 3. Props classification
|
|
57
57
|
|
|
@@ -108,6 +108,7 @@ Expressions can access these variables:
|
|
|
108
108
|
| Variable | Type | Scope |
|
|
109
109
|
| ------------------ | ----------------------------- | ------------------------ |
|
|
110
110
|
| `g` | Reactive state proxy | Always |
|
|
111
|
+
| `std` | Pure SlexKit standard library | Always |
|
|
111
112
|
| Component state | e.g. `slider.value` | Named components |
|
|
112
113
|
| `api` | Host-injected object | If `api` option provided |
|
|
113
114
|
| `$event` | Event data | `on*` handlers only |
|
|
@@ -116,6 +117,8 @@ Expressions can access these variables:
|
|
|
116
117
|
| `$key` | Current item key | `$for` context only |
|
|
117
118
|
| Named `$for` alias | e.g. `user` for `"card:user"` | `$for` context only |
|
|
118
119
|
|
|
120
|
+
`std` contains deterministic helpers for math, formatting, units, and small statistics. Sensitive capabilities stay under host-injected `api.*` and may require secure runtime policy.
|
|
121
|
+
|
|
119
122
|
Expression evaluation errors are caught and produce a warning with namespace and path information. The last known value is returned as a fallback.
|
|
120
123
|
|
|
121
124
|
## 6. Component instance state
|
|
@@ -524,6 +527,7 @@ The `RenderContext` provides:
|
|
|
524
527
|
| Property | Type | Description |
|
|
525
528
|
|----------|------|-------------|
|
|
526
529
|
| `g` | reactive proxy | Global state |
|
|
530
|
+
| `std` | `SlexKitStdlib` | Pure deterministic helpers |
|
|
527
531
|
| `api` | `Record<string, unknown>` | Host-injected capabilities |
|
|
528
532
|
| `dir` | `"ltr"` or `"rtl"` | Resolved direction |
|
|
529
533
|
| `labels` | `Partial<Record<string, string>>` | Runtime labels |
|
|
@@ -591,6 +595,8 @@ type MountOptions = {
|
|
|
591
595
|
|
|
592
596
|
Calling `mount()` again on the same `container` clears the old root first, then appends a new root. The returned cleanup only unmounts the current root; it does not delete the namespace store.
|
|
593
597
|
|
|
598
|
+
Every expression receives `std`, SlexKit's pure deterministic standard library. Hosts can still inject capability objects through `api`, but network, timers, animation, and canvas should remain policy-gated in secure mode.
|
|
599
|
+
|
|
594
600
|
### `ingest(input)`
|
|
595
601
|
|
|
596
602
|
Ingests state-only Slex: updates `g` without rendering UI. Used by the Markdown runtime host for state-only fences. Returns `true` if parsing succeeded.
|
package/dist/data/llms.txt
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
- [Full documentation](/llms-full.txt): all canonical English docs pages in one text file.
|
|
6
6
|
- [Component reference](/llms-components.txt): component docs index plus generated props/state reference.
|
|
7
7
|
- [Runtime docs](/llms-runtime.txt): runtime, host integration, and secure rendering docs.
|
|
8
|
+
- [Capabilities](/llms-capabilities.txt): expression context, `std.*` standard library, and policy-gated `api.*`.
|
|
8
9
|
- [ToolHost docs](/llms-toolhost.txt): structured user-input UI docs.
|
|
9
10
|
- [Authoring rules](/llms-authoring.txt): concise rules for Markdown `slex` fences.
|
|
10
11
|
- [AI manifest](/slexkit-ai-manifest.json): structured page, component, and hash metadata.
|
|
11
12
|
|
|
12
13
|
SlexKit raw docs are Markdown (`.md`) with explicit `slex` fences. The interactive layer is the fenced `slex` source inside each Markdown page.
|
|
13
14
|
|
|
14
|
-
Version: 0.
|
|
15
|
+
Version: 0.3.0
|
|
15
16
|
|
|
16
17
|
## Table of Contents
|
|
17
18
|
|
|
@@ -24,6 +25,25 @@ Version: 0.2.0
|
|
|
24
25
|
- [Secure Runtime Setup](/docs/guides/security-runtime.md): Decision and setup guide for rendering untrusted or agent-generated Slex source.
|
|
25
26
|
- [AI / Agents](/docs/guides/ai-agents.md): LLM docs, MCP server, skills, and authoring rules for SlexKit agents.
|
|
26
27
|
|
|
28
|
+
### Examples
|
|
29
|
+
- [你的第一个 SlexKit 卡片](/zh-CN/examples/hello-slexkit.md): 零交互、纯展示的静态卡片,展示 SlexKit 声明式 DSL 的渲染效果。
|
|
30
|
+
- [第一个交互:滑块操控数据](/zh-CN/examples/first-interaction.md): 在 SlexKit 卡片引入 g 对象和第一个滑块交互,体验响应式数据绑定。
|
|
31
|
+
- [多输入协同:两个滑块联动](/zh-CN/examples/multi-input-coordination.md): 两个 slider 相互影响,引入 g 方法、formula 组件和条件渲染。
|
|
32
|
+
- [分支与切换:模式选择器](/zh-CN/examples/tabs-and-branching.md): 用 select 实现场景切换,展示 UI = f(state) 的分支渲染模式。
|
|
33
|
+
- [五险一金计算器](/zh-CN/examples/salary-calculator.md): 输入工资基数和城市,计算五险一金明细,显示个人缴纳、单位缴纳和总计。
|
|
34
|
+
- [软件项目成本估算器](/zh-CN/examples/project-cost-estimator.md): 输入团队规模、开发周期和人员成本,计算项目总成本和人均成本。
|
|
35
|
+
- [分压器计算器](/zh-CN/examples/voltage-divider.md): 输入电压和两个电阻值,计算分压输出,并评估负载效应带来的误差。
|
|
36
|
+
- [RC 低通滤波器](/zh-CN/examples/rc-low-pass-filter.md): 用电阻和电容搭建的频率选择电路,计算截止频率和任意频率下的增益衰减。
|
|
37
|
+
- [波特率误差计算器](/zh-CN/examples/baud-rate-calculator.md): 输入晶振频率和目标波特率,计算 UART 波特率误差百分比,判断通信可靠性。
|
|
38
|
+
- [搜索与过滤表格](/zh-CN/examples/search-filter-table.md): 搜索输入框实时过滤表格行,点击行展开详情,展示 input + 动态 table + collapsible 组合。
|
|
39
|
+
- [项目仪表盘](/zh-CN/examples/project-dashboard.md): 用 section + grid 搭建信息仪表盘,覆盖 Sprint 进度、质量指标和团队健康度的多卡片联动。
|
|
40
|
+
- [ToolHost 表单提问](/zh-CN/examples/form-wizard-steps.md): AI 对话过程中突然需要收集用户信息,弹出表单卡片等待用户提交,提交后显示结果。
|
|
41
|
+
- [技术选型评估](/zh-CN/examples/tech-selection-evaluator.md): 评估不同技术方案的优劣,通过跨 fence 联动实现参数选择、评分分析和结论推荐。
|
|
42
|
+
- [ToolHost 对话演示](/zh-CN/examples/toolhost-demo.md): 展示 SlexKit 的 ToolHost 能力:在 AI 对话流中内嵌交互式表单,收集用户输入后返回结构化 ToolResult。
|
|
43
|
+
- [自建还是外购决策](/zh-CN/examples/roi-estimator.md): 自建还是外购决策矩阵——功能覆盖、成本对比、时间线、风险四维度评估,自动推荐方案。
|
|
44
|
+
- [跨文档状态实验室](/zh-CN/examples/cross-doc-state-lab.md): 展示 SlexKit 最独特的跨 fence 状态共享——文档不同位置的多块 slex 代码共享同一个响应式 g 对象。
|
|
45
|
+
- [JSONPlaceholder 网络请求实验台](/zh-CN/examples/network-policy-fetch-card.md): 用 JSONPlaceholder 演示 secure runtime 如何把用户触发的网络请求交给 host policy 审核和代理。
|
|
46
|
+
|
|
27
47
|
### Components
|
|
28
48
|
- [Accordion](/docs/components/accordion.md): Expandable grouped panels.
|
|
29
49
|
- [Badge](/docs/components/badge.md): Compact label for status or classification.
|
|
@@ -35,6 +55,7 @@ Version: 0.2.0
|
|
|
35
55
|
- [Collapsible](/docs/components/collapsible.md): Single expandable region.
|
|
36
56
|
- [Column](/docs/components/column.md): Vertical layout container.
|
|
37
57
|
- [Divider](/docs/components/divider.md): Visual separator.
|
|
58
|
+
- [Formula](/docs/components/formula.md): Reactive KaTeX formula display.
|
|
38
59
|
- [Grid](/docs/components/grid.md): Responsive grid container.
|
|
39
60
|
- [Icon](/docs/components/icon.md): Shared icon field capability.
|
|
40
61
|
- [Input](/docs/components/input.md): Text or engineering-value input.
|