@shwfed/config 2.3.13 → 2.3.15
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/dist/mcp.mjs +267 -3
- package/dist/module.json +1 -1
- package/dist/preview/assets/{config-0UIjgMSM.js → config-Ccc91IuE.js} +1 -1
- package/dist/preview/assets/{config-f56G9OU7.js → config-Cu4YCf3Q.js} +1 -1
- package/dist/preview/assets/{config-9eu0BvKT.js → config-D1_kk2wE.js} +1 -1
- package/dist/preview/assets/{config-B1jKkIYg.js → config-DSUfhE8f.js} +1 -1
- package/dist/preview/assets/{config-DoQjG5TI.js → config-Dn_aNwUy.js} +1 -1
- package/dist/preview/assets/{config-BpTg08Vv.js → config-DszdIMLk.js} +1 -1
- package/dist/preview/assets/{config-CVS1PW6h.js → config-NH6Ic7o1.js} +1 -1
- package/dist/preview/assets/{config-CDjs2Ohl.js → config-khXqmF8c.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-DbnaeqGK.js → definition.vue_vue_type_script_setup_true_lang-Dd4k-ePD.js} +1 -1
- package/dist/preview/assets/index-CjnEuiHs.js +1 -0
- package/dist/preview/assets/{index-DDthcoXk.js → index-D8qxH74z.js} +72 -72
- package/dist/preview/assets/{runtime-COMOofol.js → runtime-BQ58QCMN.js} +1 -1
- package/dist/preview/assets/{runtime-CPPOlC0F.js → runtime-Bn4rSje6.js} +1 -1
- package/dist/preview/assets/{runtime-BkZp9k_z.js → runtime-CNaG3HID.js} +1 -1
- package/dist/preview/assets/{runtime-YYdaCEw3.js → runtime-DzxLxkDr.js} +1 -1
- package/dist/preview/assets/{runtime-BqFFtMNw.js → runtime-MyzMN1AA.js} +1 -1
- package/dist/preview/assets/{runtime-DejxoCBP.js → runtime-P9oO02Lt.js} +1 -1
- package/dist/preview/assets/{runtime-BICQC6bF.js → runtime-eiWE0E2f.js} +1 -1
- package/dist/preview/assets/{runtime-hKRNY9F6.js → runtime-thWYUmC7.js} +1 -1
- package/dist/preview/index.html +1 -1
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +53 -13
- package/dist/runtime/components/ui/tree/TreeNode.vue +8 -10
- package/dist/runtime/components/ui/tree/useTreeState.js +0 -2
- package/dist/runtime/share/layout.js +1 -1
- package/package.json +1 -1
- package/dist/preview/assets/index-DhkKZ2ii.js +0 -1
package/dist/mcp.mjs
CHANGED
|
@@ -81720,7 +81720,7 @@ const Placement = Struct({
|
|
|
81720
81720
|
v: optional(Align$1.annotations({ title: "垂直对齐", description: "垂直轴对齐(align-self)" }))
|
|
81721
81721
|
}).annotations({
|
|
81722
81722
|
title: "Placement",
|
|
81723
|
-
description: "
|
|
81723
|
+
description: "块在某一布局中的位置与对齐。`area` 的宽 `(x2-x1)` 与高 `(y2-y1)` 推荐取 `search_metadata` 返回的 `w.initial` / `h.initial`;可在 `[w.min, w.max]` / `[h.min, h.max]` 内自行调节以改变实际占位(更大的值即占更多的网格列/行,从而拿到更大的渲染比例)"
|
|
81724
81724
|
});
|
|
81725
81725
|
const Layout = Struct({
|
|
81726
81726
|
columns: TrackCount.annotations({
|
|
@@ -93474,6 +93474,182 @@ function PageConfig(configure) {
|
|
|
93474
93474
|
description: "页面组件完整配置"
|
|
93475
93475
|
});
|
|
93476
93476
|
}
|
|
93477
|
+
const formSubmitCancel = {
|
|
93478
|
+
scenario: "form-submit-cancel",
|
|
93479
|
+
title: "模态表单底部的取消 / 保存按钮",
|
|
93480
|
+
summary: "左侧 取消(关闭模态)+ 右侧 Primary 保存(HTTP 提交、成功后关闭模态并刷新表格)。",
|
|
93481
|
+
notes: [
|
|
93482
|
+
"本片段是 form 的 fields 数组里的最后一项 —— 一个 actions 字段。",
|
|
93483
|
+
'用两个 group 区分变体:default group 装次要按钮(取消),primary group 装主按钮(保存)。把 `variant: "primary"` 同时设在 group 和 item 上是冗余但安全 —— 渲染时 item 优先。',
|
|
93484
|
+
'取消按钮用 `event.dispatch` 触发 `close` operation,target 是打开本表单的那个外层按钮的 id(`<modal-button-id>`)。modal.layout 类型的 action 在挂载时会把"打开它的按钮"作为可达 target 暴露给内部环境。',
|
|
93485
|
+
"保存按钮用 `http.request.json`:",
|
|
93486
|
+
" - `expression` 构造 HTTP 调用;`hostname` 和 `token` 是页面级全局 CEL 变量(见 MCP server 说明),不要在 fragment 内硬编码。`body(form)` 把整个表单当 body 发出去。",
|
|
93487
|
+
" - `messageExpression` 从响应里抽消息字符串显示给用户(成功 / 失败统一走这个)。",
|
|
93488
|
+
' - `resultExpression` 返回字面量 `"success"` 或 `"error"` —— 只有 `"success"` 才会触发 `onSuccess`。',
|
|
93489
|
+
" - `onSuccess` 先关闭 modal,再触发外层表格的 `search` 操作让数据刷新。`<table-id>` 是 page 里那张 table 的 id。",
|
|
93490
|
+
'在 form 的 layout 里把这一行放到底部 + 右下对齐,例如 16 列 10 行的表单:`{ area: [[1, 9], [17, 11]], h: "end", v: "end" }`。'
|
|
93491
|
+
],
|
|
93492
|
+
fragment: {
|
|
93493
|
+
type: "com.shwfed.form.field.actions",
|
|
93494
|
+
compatibilityDate: "2026-04-24",
|
|
93495
|
+
id: "<form-actions-id>",
|
|
93496
|
+
displayName: "提交",
|
|
93497
|
+
gap: 4,
|
|
93498
|
+
groups: [
|
|
93499
|
+
{ id: "<group-default-id>" },
|
|
93500
|
+
{ id: "<group-primary-id>", variant: "primary" }
|
|
93501
|
+
],
|
|
93502
|
+
items: [
|
|
93503
|
+
{
|
|
93504
|
+
id: "<cancel-button-id>",
|
|
93505
|
+
groupId: "<group-default-id>",
|
|
93506
|
+
title: [{ locale: "zh", message: "取消" }],
|
|
93507
|
+
icon: "fluent:dismiss-20-regular",
|
|
93508
|
+
action: {
|
|
93509
|
+
type: "com.shwfed.actions.button.event.dispatch",
|
|
93510
|
+
compatibilityDate: "2026-05-15",
|
|
93511
|
+
triggers: [{ target: "<modal-button-id>", operation: "close" }]
|
|
93512
|
+
}
|
|
93513
|
+
},
|
|
93514
|
+
{
|
|
93515
|
+
id: "<save-button-id>",
|
|
93516
|
+
groupId: "<group-primary-id>",
|
|
93517
|
+
title: [{ locale: "zh", message: "保存" }],
|
|
93518
|
+
icon: "fluent:save-20-regular",
|
|
93519
|
+
variant: "primary",
|
|
93520
|
+
action: {
|
|
93521
|
+
type: "com.shwfed.actions.button.http.request.json",
|
|
93522
|
+
compatibilityDate: "2026-04-18",
|
|
93523
|
+
expression: "http.post(hostname + '/api/endpoint').header('access_token', token).header('Content-Type', 'application/json').body(form)",
|
|
93524
|
+
messageExpression: "string(json.message)",
|
|
93525
|
+
resultExpression: "json.code == 0 ? 'success' : 'error'",
|
|
93526
|
+
onSuccess: [
|
|
93527
|
+
{ target: "<modal-button-id>", operation: "close" },
|
|
93528
|
+
{ target: "<table-id>", operation: "search" }
|
|
93529
|
+
]
|
|
93530
|
+
}
|
|
93531
|
+
}
|
|
93532
|
+
]
|
|
93533
|
+
}
|
|
93534
|
+
};
|
|
93535
|
+
const tableDefaults = {
|
|
93536
|
+
scenario: "table-defaults",
|
|
93537
|
+
title: "表格视觉与分页的常用默认",
|
|
93538
|
+
summary: "撑满屏幕高度 + 斑马条纹 + 选中行高亮 + 100/200/500/1000 档分页。",
|
|
93539
|
+
notes: [
|
|
93540
|
+
"本片段是 table 块下 `table` 配置里的三个相邻字段(`style`、`cellStyle`、`pagination`);按 key 合并到既有 table 配置即可,不要替换整个 table 对象。",
|
|
93541
|
+
"`style`:用 `90vh`(或 `90dvh` 以兼容移动端浏览器地址栏收起场景)让表格刚好撑满视口,留 0.5rem 内边距即可。",
|
|
93542
|
+
"`cellStyle` 是一个 CEL 表达式,作用域里有 `selected`(行是否被勾选)和 `index`(行号):",
|
|
93543
|
+
" - 选中行用 `--primary` 色透明 10% 混白做高亮(!important 是为了覆盖 hover 状态);",
|
|
93544
|
+
" - 未选中按 `index % 2` 做斑马条纹:奇数行 `oklch(98.5% 0 0)`(接近 #fafafa),偶数行白底。",
|
|
93545
|
+
"`pagination`:业务报表场景的默认是 100 起步。不要给 10/20 档 —— 业务侧通常不会用这种粒度翻页。"
|
|
93546
|
+
],
|
|
93547
|
+
fragment: {
|
|
93548
|
+
style: "height: 90vh; padding: 0.5rem;",
|
|
93549
|
+
cellStyle: "selected\n ? { 'background-color': 'color-mix(in srgb, var(--primary) 10%, white) !important' }\n : index % 2 == 1 ? { 'background-color': 'oklch(98.5% 0 0)' } : { 'background-color': 'white' }",
|
|
93550
|
+
pagination: {
|
|
93551
|
+
pageSize: 100,
|
|
93552
|
+
pageSizes: [100, 200, 500, 1e3]
|
|
93553
|
+
}
|
|
93554
|
+
}
|
|
93555
|
+
};
|
|
93556
|
+
const tableSearchBar = {
|
|
93557
|
+
scenario: "table-search-bar",
|
|
93558
|
+
title: "表格上方的搜索条(搜索 / 重置按钮)",
|
|
93559
|
+
summary: "把查询字段铺一行,搜索/重置永远固定在最右侧、Primary 色;重置触发清空 + 回首页。",
|
|
93560
|
+
notes: [
|
|
93561
|
+
"挂在 table 块的 `query` 字段上 —— `query` 本身就是一个嵌入的 form。",
|
|
93562
|
+
'所有查询字段统一用 `orientation: "floating"`(浮动标签,节省纵向空间)。',
|
|
93563
|
+
'布局规范:48 列 × 2 行,查询字段每个占 8 列宽 2 行高,从左往右依次摆放;`actions` 字段固定在右上角 `[[41,1],[49,3]]` + `h: "end"`。如果一行实在铺不下,把 `rows` 改成 4 让查询字段换行,actions 保持在第一行最右。',
|
|
93564
|
+
'搜索 / 重置都是 Primary 变体(同一个 group,groups[0] 不显式声明 variant,统一在 item 上指定 `variant: "primary"`)。',
|
|
93565
|
+
"重置按钮用 `hideTitle: true` 显示为图标按钮,仍保留 `title` 供无障碍读出。",
|
|
93566
|
+
'重置必须触发三个 operation:`reset-query`(清空查询条件)、`clear-selection`(清掉行选)、`reset-pagination`(回第一页)—— 缺一个都会让用户感觉"重置了一半"。',
|
|
93567
|
+
"搜索只需要触发 `search`(用当前 query 重新拉数据)。",
|
|
93568
|
+
"`<table-id>` 是页面里这个 table 块本身的 id —— 用作所有 dispatch 的 target。"
|
|
93569
|
+
],
|
|
93570
|
+
fragment: {
|
|
93571
|
+
kind: "shwfed.component.form",
|
|
93572
|
+
fields: [
|
|
93573
|
+
{
|
|
93574
|
+
type: "com.shwfed.form.field.combobox.single.remote",
|
|
93575
|
+
compatibilityDate: "2026-05-13",
|
|
93576
|
+
id: "<query-field-type-id>",
|
|
93577
|
+
label: [{ locale: "zh", message: "资源类型" }],
|
|
93578
|
+
orientation: "floating",
|
|
93579
|
+
binding: "resource_type",
|
|
93580
|
+
request: "http.get(hostname + '/api/dict').header('access_token', token)",
|
|
93581
|
+
options: "json.?data.orValue([])",
|
|
93582
|
+
optionValue: "option.value",
|
|
93583
|
+
optionLabel: [{ locale: "zh", message: "{{ option.name }}" }]
|
|
93584
|
+
},
|
|
93585
|
+
{
|
|
93586
|
+
type: "com.shwfed.form.field.text",
|
|
93587
|
+
compatibilityDate: "2026-04-22",
|
|
93588
|
+
id: "<query-field-keyword-id>",
|
|
93589
|
+
label: [{ locale: "zh", message: "关键词" }],
|
|
93590
|
+
orientation: "floating",
|
|
93591
|
+
binding: "keyword"
|
|
93592
|
+
},
|
|
93593
|
+
{
|
|
93594
|
+
type: "com.shwfed.form.field.actions",
|
|
93595
|
+
compatibilityDate: "2026-04-24",
|
|
93596
|
+
id: "<query-actions-id>",
|
|
93597
|
+
displayName: "搜索",
|
|
93598
|
+
gap: 4,
|
|
93599
|
+
groups: [{ id: "<query-actions-group-id>" }],
|
|
93600
|
+
items: [
|
|
93601
|
+
{
|
|
93602
|
+
id: "<search-button-id>",
|
|
93603
|
+
groupId: "<query-actions-group-id>",
|
|
93604
|
+
title: [{ locale: "zh", message: "搜索" }],
|
|
93605
|
+
icon: "fluent:search-20-regular",
|
|
93606
|
+
variant: "primary",
|
|
93607
|
+
action: {
|
|
93608
|
+
type: "com.shwfed.actions.button.event.dispatch",
|
|
93609
|
+
compatibilityDate: "2026-05-15",
|
|
93610
|
+
triggers: [{ target: "<table-id>", operation: "search" }]
|
|
93611
|
+
}
|
|
93612
|
+
},
|
|
93613
|
+
{
|
|
93614
|
+
id: "<reset-button-id>",
|
|
93615
|
+
groupId: "<query-actions-group-id>",
|
|
93616
|
+
title: [{ locale: "zh", message: "重置" }],
|
|
93617
|
+
icon: "fluent:arrow-reset-20-regular",
|
|
93618
|
+
variant: "primary",
|
|
93619
|
+
hideTitle: true,
|
|
93620
|
+
action: {
|
|
93621
|
+
type: "com.shwfed.actions.button.event.dispatch",
|
|
93622
|
+
compatibilityDate: "2026-05-15",
|
|
93623
|
+
triggers: [
|
|
93624
|
+
{ target: "<table-id>", operation: "reset-query" },
|
|
93625
|
+
{ target: "<table-id>", operation: "clear-selection" },
|
|
93626
|
+
{ target: "<table-id>", operation: "reset-pagination" }
|
|
93627
|
+
]
|
|
93628
|
+
}
|
|
93629
|
+
}
|
|
93630
|
+
]
|
|
93631
|
+
}
|
|
93632
|
+
],
|
|
93633
|
+
layouts: [{
|
|
93634
|
+
name: "默认",
|
|
93635
|
+
layout: {
|
|
93636
|
+
columns: 48,
|
|
93637
|
+
rows: 2,
|
|
93638
|
+
gap: 4,
|
|
93639
|
+
placements: {
|
|
93640
|
+
"<query-field-type-id>": { area: [[1, 1], [9, 3]] },
|
|
93641
|
+
"<query-field-keyword-id>": { area: [[9, 1], [17, 3]] },
|
|
93642
|
+
"<query-actions-id>": { area: [[41, 1], [49, 3]], h: "end" }
|
|
93643
|
+
}
|
|
93644
|
+
}
|
|
93645
|
+
}]
|
|
93646
|
+
}
|
|
93647
|
+
};
|
|
93648
|
+
const EXAMPLES = [
|
|
93649
|
+
tableSearchBar,
|
|
93650
|
+
tableDefaults,
|
|
93651
|
+
formSubmitCancel
|
|
93652
|
+
];
|
|
93477
93653
|
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
93478
93654
|
const branchesOf = (node, root) => {
|
|
93479
93655
|
const list2 = node.anyOf ?? node.oneOf;
|
|
@@ -93769,6 +93945,19 @@ function postProcessSchema(node, root) {
|
|
|
93769
93945
|
function getSchema() {
|
|
93770
93946
|
return make$2(pageSchema);
|
|
93771
93947
|
}
|
|
93948
|
+
function listExamples() {
|
|
93949
|
+
return EXAMPLES.map((e) => ({ scenario: e.scenario, title: e.title, summary: e.summary }));
|
|
93950
|
+
}
|
|
93951
|
+
function getExample(scenario) {
|
|
93952
|
+
return EXAMPLES.find((e) => e.scenario === scenario);
|
|
93953
|
+
}
|
|
93954
|
+
function generateUUIDs(count = 1) {
|
|
93955
|
+
const n = Number.isFinite(count) ? Math.floor(count) : 1;
|
|
93956
|
+
const clamped = Math.max(1, Math.min(n, 64));
|
|
93957
|
+
const uuids = [];
|
|
93958
|
+
for (let i = 0; i < clamped; i++) uuids.push(crypto.randomUUID());
|
|
93959
|
+
return { uuids };
|
|
93960
|
+
}
|
|
93772
93961
|
function lookupLeafByType(defs, type2, date2) {
|
|
93773
93962
|
if (date2) {
|
|
93774
93963
|
const id22 = `${type2}@${date2}`;
|
|
@@ -93820,6 +94009,12 @@ function getSchemaAtPath(path) {
|
|
|
93820
94009
|
schema: postProcessSchema(r.schema, root)
|
|
93821
94010
|
};
|
|
93822
94011
|
}
|
|
94012
|
+
function toSizeRange(r) {
|
|
94013
|
+
const out = { initial: r.initial, min: r.min };
|
|
94014
|
+
if (Number.isFinite(r.max)) out.max = r.max;
|
|
94015
|
+
if (r.grow) out.grow = true;
|
|
94016
|
+
return out;
|
|
94017
|
+
}
|
|
93823
94018
|
function listMetadata(opts = {}) {
|
|
93824
94019
|
const items2 = [];
|
|
93825
94020
|
for (const e of BLOCKS) {
|
|
@@ -93828,7 +94023,9 @@ function listMetadata(opts = {}) {
|
|
|
93828
94023
|
type: e.type,
|
|
93829
94024
|
compatibilityDate: e.compatibilityDate,
|
|
93830
94025
|
name: e.metadata.name,
|
|
93831
|
-
icon: e.metadata.icon
|
|
94026
|
+
icon: e.metadata.icon,
|
|
94027
|
+
w: toSizeRange(e.metadata.w),
|
|
94028
|
+
h: toSizeRange(e.metadata.h)
|
|
93832
94029
|
});
|
|
93833
94030
|
}
|
|
93834
94031
|
for (const e of FIELDS) {
|
|
@@ -93837,7 +94034,9 @@ function listMetadata(opts = {}) {
|
|
|
93837
94034
|
type: e.type,
|
|
93838
94035
|
compatibilityDate: e.compatibilityDate,
|
|
93839
94036
|
name: e.metadata.name,
|
|
93840
|
-
icon: e.metadata.icon
|
|
94037
|
+
icon: e.metadata.icon,
|
|
94038
|
+
w: toSizeRange(e.metadata.w),
|
|
94039
|
+
h: toSizeRange(e.metadata.h)
|
|
93841
94040
|
};
|
|
93842
94041
|
if (e.deprecated) m.deprecated = true;
|
|
93843
94042
|
if (e.supersededBy) m.supersededBy = { type: e.supersededBy.type, compatibilityDate: e.supersededBy.compatibilityDate };
|
|
@@ -93896,6 +94095,12 @@ const server = new McpServer({
|
|
|
93896
94095
|
"4. `validate_config` — validates a draft. Iterate until it returns `{ valid: true }`. CEL expressions are accepted as strings without evaluation.",
|
|
93897
94096
|
"5. (Optional) `preview_config` / `stop_preview` — render the result in a localhost browser tab.",
|
|
93898
94097
|
"",
|
|
94098
|
+
"UUIDs: many fields require a real RFC 4122 UUID (`id` on blocks, tabs, chart datasources, etc.). NEVER write them by hand — sequential placeholders like `00000000-0000-0000-0000-000000000001` will validate but collide and break the layout editor. ALWAYS call `generate_uuid(count=<n>)` and use the returned values. Request as many as you need in a single call.",
|
|
94099
|
+
"",
|
|
94100
|
+
"Global CEL variables: pages typically reference `token` (auth bearer) and `hostname` (API base URL) as host-managed CEL globals. Generated CEL like `http.get(hostname + '/foo').header('access_token', token)` assumes these exist — when you emit config that uses them, remind the user to register both via their host's CEL environment.",
|
|
94101
|
+
"",
|
|
94102
|
+
"Curated examples: before constructing a common UI pattern from scratch (table search bar, modal-form submit/cancel buttons, table visual & pagination defaults...), call `get_example()` with no arguments to see the catalogue, then `get_example(scenario='<name>')` to pull the minimal fragment. The fragment uses `<placeholder>` strings (e.g. `<table-id>`) for every UUID the agent must substitute via `generate_uuid` — same placeholder name within one fragment means the same UUID.",
|
|
94103
|
+
"",
|
|
93899
94104
|
"Versioning rules: the same `type` may appear at multiple `compatibilityDate`s with DIFFERENT contracts — they are not interchangeable. Always pick the LATEST `compatibilityDate` for new entries (this is the default when you pass bare `<type>`). When editing an existing config that uses an older `compatibilityDate`, prefer migrating it to the latest version and tell the user you did so, instead of preserving the old version silently."
|
|
93900
94105
|
].join("\n")
|
|
93901
94106
|
});
|
|
@@ -93956,6 +94161,7 @@ server.registerTool("search_metadata", {
|
|
|
93956
94161
|
" - `kind`: which slot the entry plugs into (`block` | `field` | `column` | `button` | `item`).",
|
|
93957
94162
|
" - `type`, `compatibilityDate`: identity. The same `type` may appear at multiple dates with incompatible contracts.",
|
|
93958
94163
|
" - `name`, `icon`: human-readable label and icon name (Iconify slug).",
|
|
94164
|
+
" - `w`, `h` (block & field only): layout-grid sizing. `{ initial, min, max?, grow? }` in grid step units. `initial` is the size to use when placing the entry; the user may resize within `[min, max]`. `max` is omitted when unbounded. `h.grow: true` (field-only) means that row track follows content height instead of equal-share. When you author a layout, use `initial` as the default span and keep any chosen w/h within `[min, max]`.",
|
|
93959
94165
|
" - `deprecated`: present and `true` when the entry is superseded.",
|
|
93960
94166
|
" - `supersededBy`: when known, the `(type, compatibilityDate)` to migrate to.",
|
|
93961
94167
|
"",
|
|
@@ -93973,6 +94179,64 @@ server.registerTool("search_metadata", {
|
|
|
93973
94179
|
structuredContent: payload
|
|
93974
94180
|
};
|
|
93975
94181
|
});
|
|
94182
|
+
server.registerTool("get_example", {
|
|
94183
|
+
title: "Get a curated config-fragment example",
|
|
94184
|
+
description: [
|
|
94185
|
+
"Returns curated minimal JSON fragments for common UI patterns the agent would otherwise have to reconstruct from scratch. Examples are scenario-keyed (one entry covers a whole pattern, possibly spanning multiple kinds) — not type-keyed.",
|
|
94186
|
+
"",
|
|
94187
|
+
"Without `scenario`, returns the catalogue: `{ scenario, title, summary }` per entry.",
|
|
94188
|
+
"With `scenario`, returns the full entry: `{ scenario, title, summary, notes[], fragment }`. `fragment` is a JSON object that can be adapted into the target slot in your config.",
|
|
94189
|
+
"",
|
|
94190
|
+
"Placeholders: fragments embed `<role-name>` strings wherever a UUID is required (e.g. `<table-id>`, `<modal-button-id>`, `<group-primary-id>`). Replace every distinct placeholder with a freshly generated UUID via `generate_uuid` — but reuse the SAME UUID for every occurrence of the SAME placeholder name within one fragment (cross-references depend on it).",
|
|
94191
|
+
"",
|
|
94192
|
+
"When to call: ask `get_example()` BEFORE composing a search bar, submit/cancel button row, or table visual/pagination defaults — these patterns have non-obvious conventions (which operations the reset button triggers, what `cellStyle` formula to use, etc.) that the catalogue captures."
|
|
94193
|
+
].join("\n"),
|
|
94194
|
+
inputSchema: {
|
|
94195
|
+
scenario: string$1().optional().describe("Scenario name (from the catalogue). Omit to list the catalogue.")
|
|
94196
|
+
}
|
|
94197
|
+
}, async ({ scenario }) => {
|
|
94198
|
+
if (!scenario || !scenario.trim()) {
|
|
94199
|
+
const items2 = listExamples();
|
|
94200
|
+
const payload = { count: items2.length, scenarios: items2 };
|
|
94201
|
+
return {
|
|
94202
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
94203
|
+
structuredContent: payload
|
|
94204
|
+
};
|
|
94205
|
+
}
|
|
94206
|
+
const found = getExample(scenario.trim());
|
|
94207
|
+
if (!found) {
|
|
94208
|
+
const available = listExamples().map((e) => e.scenario);
|
|
94209
|
+
const payload = { error: `no example with scenario '${scenario}'`, available };
|
|
94210
|
+
return {
|
|
94211
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
94212
|
+
structuredContent: payload,
|
|
94213
|
+
isError: true
|
|
94214
|
+
};
|
|
94215
|
+
}
|
|
94216
|
+
return {
|
|
94217
|
+
content: [{ type: "text", text: JSON.stringify(found, null, 2) }],
|
|
94218
|
+
structuredContent: found
|
|
94219
|
+
};
|
|
94220
|
+
});
|
|
94221
|
+
server.registerTool("generate_uuid", {
|
|
94222
|
+
title: "Generate RFC 4122 UUIDs",
|
|
94223
|
+
description: [
|
|
94224
|
+
"Returns one or more freshly generated RFC 4122 v4 UUIDs. Use this whenever the schema asks for a UUID (e.g. block `id`, tab `id`, datasource `id`).",
|
|
94225
|
+
"",
|
|
94226
|
+
"Why this tool exists: LLMs reliably fabricate placeholder UUIDs (`00000000-0000-0000-0000-000000000001`, repeating patterns, etc.) when asked to invent them. Such values pass the format check but collide across siblings and break the layout editor, which indexes placements by `id`. Always call this tool — do not write UUIDs by hand.",
|
|
94227
|
+
"",
|
|
94228
|
+
"Request `count` UUIDs in one call (1–64). Each value is a distinct, cryptographically random v4 UUID."
|
|
94229
|
+
].join("\n"),
|
|
94230
|
+
inputSchema: {
|
|
94231
|
+
count: number$2().int().min(1).max(64).optional().describe("Number of UUIDs to generate. Defaults to 1. Clamped to [1, 64].")
|
|
94232
|
+
}
|
|
94233
|
+
}, async ({ count }) => {
|
|
94234
|
+
const result = generateUUIDs(count ?? 1);
|
|
94235
|
+
return {
|
|
94236
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
94237
|
+
structuredContent: result
|
|
94238
|
+
};
|
|
94239
|
+
});
|
|
93976
94240
|
server.registerTool("preview_config", {
|
|
93977
94241
|
title: "Preview ShwfedConfig in browser",
|
|
93978
94242
|
description: "Boots a localhost-only preview server (127.0.0.1) that renders the given ShwfedConfig in a real browser using the package's shipped components. Returns the URL for the user to open. The config is validated first; invalid configs are rejected without starting the server. Subsequent calls hot-swap the rendered config and return the same URL — the user reloads the tab to see updates. The preview only knows about components shipped by this package; user-defined extensions in their host app are not visible here. CEL variables (e.g. `token`) are user-managed in the page itself — the agent never sees their values.",
|
package/dist/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as y,b as R,ab as U,o as V,c as z,f as x,g as t,w as n,u as s,h as i,j as u,k as c,l as d,_ as p,ac as g,i as f,t as _,F as D,v as F,T as $,x as C,y as H,$ as S}from"./index-
|
|
1
|
+
import{d as y,b as R,ab as U,o as V,c as z,f as x,g as t,w as n,u as s,h as i,j as u,k as c,l as d,_ as p,ac as g,i as f,t as _,F as D,v as F,T as $,x as C,y as H,$ as S}from"./index-D8qxH74z.js";const L={class:"flex flex-col gap-3"},N={class:"grid grid-cols-2 gap-3"},B={class:"flex items-start gap-2"},M={class:"grid grid-cols-2 gap-3"},I=y({name:"ShwfedHttpDownloadActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(b){const l=R(b,"modelValue"),E=U(()=>{}),m=a=>C(E,a)??a,r=a=>H(E,a),j=["onSuccess","onWarning","onError","onInfo"],h=S({get:()=>l.value.template?.request??"",set:a=>{l.value={...l.value,template:{...l.value.template,request:a}}}}),w=S({get:()=>l.value.template?.download??"",set:a=>{const e=l.value.template??{request:""};if(a.length===0){const{download:o,...v}=e;l.value={...l.value,template:v}}else l.value={...l.value,template:{...e,download:a}}}});function q(a){const e={...l.value};a.length===0?delete e.messageExpression:e.messageExpression=a,l.value=e}function T(a){const e={...l.value};a.length===0?delete e.resultExpression:e.resultExpression=a,l.value=e}function k(a,e){const o={...l.value};e.length===0?Reflect.deleteProperty(o,a):o[a]=e,l.value=o}return(a,e)=>(V(),z("div",L,[x("div",N,[t(s(p),{orientation:"vertical"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},{tooltip:n(()=>[t(s(c),{source:r("template")??"返回 `HttpRequest` 的 CEL 表达式;未配置「下载请求」时直接下载其响应",block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),default:n(()=>[e[2]||(e[2]=u(" 请求 ",-1))]),_:1}),t(s(d),{"model-value":h.value,multiline:"",placeholder:"例:http.get('https://api.example.com/files/123')","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":e[0]||(e[0]=o=>h.value=o)},null,8,["model-value"])]),_:1}),t(s(p),{orientation:"vertical"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},{tooltip:n(()=>[t(s(c),{source:"可选的第二步:用第一步响应 `json` 中的凭据构造真正的下载请求,例如 `json.data.key`",block:"",class:"prose prose-sm prose-zinc"})]),default:n(()=>[e[3]||(e[3]=u(" 下载请求 ",-1))]),_:1}),t(s(d),{"model-value":w.value,multiline:"",placeholder:"例:http.get('https://api.example.com/download').query('key', json.data.key)","result-type":"HttpRequest","extra-vars":{json:s(g)},class:"min-h-16","onUpdate:modelValue":e[1]||(e[1]=o=>w.value=o)},null,8,["model-value","extra-vars"])]),_:1})]),x("div",B,[t(s(p),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m("messageExpression")),1)]),_:2},[r("messageExpression")?{name:"tooltip",fn:n(()=>[t(s(c),{source:r("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(s(d),{"model-value":l.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:s(g)},"onUpdate:modelValue":q},null,8,["model-value","extra-vars"])]),_:1}),t(s(p),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m("resultExpression")),1)]),_:2},[r("resultExpression")?{name:"tooltip",fn:n(()=>[t(s(c),{source:r("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(s(d),{"model-value":l.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:s(g)},"onUpdate:modelValue":T},null,8,["model-value","extra-vars"])]),_:1})]),x("div",M,[(V(),z(D,null,F(j,o=>t(s(p),{key:o,orientation:"vertical",class:"min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m(o)),1)]),_:2},[r(o)?{name:"tooltip",fn:n(()=>[t(s(c),{source:r(o),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t($,{triggers:l.value[o]??[],"onUpdate:triggers":v=>k(o,v)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]))}});export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as g,b as d,x as u,aa as f,c as m,g as a,w as i,u as r,o as p,h as _,j as x,t as h,T as v,_ as T,$ as V}from"./index-
|
|
1
|
+
import{d as g,b as d,x as u,aa as f,c as m,g as a,w as i,u as r,o as p,h as _,j as x,t as h,T as v,_ as T,$ as V}from"./index-D8qxH74z.js";const w={class:"flex flex-col gap-3"},S=g({name:"ShwfedEventDispatchActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(l){const t=d(l,"modelValue"),o=u(f(),"triggers")??"触发的操作",c=V(()=>t.value.triggers??[]);function n(s){const e={...t.value};s.length===0?Reflect.deleteProperty(e,"triggers"):e.triggers=s,t.value=e}return(s,e)=>(p(),m("div",w,[a(r(T),{orientation:"vertical"},{default:i(()=>[a(r(_),{class:"text-xs text-zinc-500"},{default:i(()=>[x(h(r(o)),1)]),_:1}),a(v,{triggers:c.value,"onUpdate:triggers":n},null,8,["triggers"])]),_:1})]))}});export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as V,b as w,z as F,c as v,g as e,w as n,u as s,f as _,F as U,v as j,o as E,h as c,i as u,j as d,t as p,k as m,l as f,_ as x,T as k,x as N,y as R}from"./index-
|
|
1
|
+
import{d as V,b as w,z as F,c as v,g as e,w as n,u as s,f as _,F as U,v as j,o as E,h as c,i as u,j as d,t as p,k as m,l as f,_ as x,T as k,x as N,y as R}from"./index-D8qxH74z.js";const D={class:"flex flex-col gap-3"},H={class:"flex items-start gap-2"},$={class:"grid grid-cols-2 gap-3"},B=V({name:"ShwfedHttpRequestActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(h){const o=w(h,"modelValue"),g=F(()=>{}),i=t=>N(g,t)??t,r=t=>R(g,t),S=["onSuccess","onWarning","onError","onInfo"];function T(t){const l={...o.value};t.length===0?delete l.messageExpression:l.messageExpression=t,o.value=l}function b(t){const l={...o.value};t.length===0?delete l.resultExpression:l.resultExpression=t,o.value=l}function y(t,l){const a={...o.value};l.length===0?Reflect.deleteProperty(a,t):a[t]=l,o.value=a}return(t,l)=>(E(),v("div",D,[e(s(x),{orientation:"vertical"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i("expression")),1)]),_:2},[r("expression")?{name:"tooltip",fn:n(()=>[e(s(m),{source:r("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(f),{"model-value":o.value.expression,multiline:"",placeholder:"例:http.post('/api/foo').body({ id: row.id })","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":l[0]||(l[0]=a=>o.value={...o.value,expression:a})},null,8,["model-value"])]),_:1}),_("div",H,[e(s(x),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i("messageExpression")),1)]),_:2},[r("messageExpression")?{name:"tooltip",fn:n(()=>[e(s(m),{source:r("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(f),{"model-value":o.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":T},null,8,["model-value"])]),_:1}),e(s(x),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i("resultExpression")),1)]),_:2},[r("resultExpression")?{name:"tooltip",fn:n(()=>[e(s(m),{source:r("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(f),{"model-value":o.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":b},null,8,["model-value"])]),_:1})]),_("div",$,[(E(),v(U,null,j(S,a=>e(s(x),{key:a,orientation:"vertical",class:"min-w-0"},{default:n(()=>[e(s(c),{class:"text-xs text-zinc-500"},u({default:n(()=>[d(" "+p(i(a)),1)]),_:2},[r(a)?{name:"tooltip",fn:n(()=>[e(s(m),{source:r(a),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(k,{triggers:o.value[a]??[],"onUpdate:triggers":z=>y(a,z)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]))}});export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as z,o as y,c as w,r as T,n as V,u as e,a as U,b as $,s as j,e as F,w as l,f as v,g as s,_ as d,h as u,i as p,j as m,t as f,k as g,l as b,m as h,p as B,q as C,F as N,v as q,T as D,x as H,y as O}from"./index-
|
|
1
|
+
import{d as z,o as y,c as w,r as T,n as V,u as e,a as U,b as $,s as j,e as F,w as l,f as v,g as s,_ as d,h as u,i as p,j as m,t as f,k as g,l as b,m as h,p as B,q as C,F as N,v as q,T as D,x as H,y as O}from"./index-D8qxH74z.js";const R=z({__name:"FieldGroup",props:{class:{type:[Boolean,null,String,Object,Array]}},setup(_){const r=_;return(x,i)=>(y(),w("div",{"data-slot":"field-group",class:V(e(U)("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",r.class))},[T(x.$slots,"default")],2))}}),L={class:"grid grid-cols-2 gap-4"},P={class:"grid grid-cols-2 gap-4"},A={class:"flex items-start gap-2"},I={class:"grid grid-cols-2 gap-3"},M=z({name:"ShwfedHttpRequestConfirmActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(_){const r=$(_,"modelValue"),x=j(()=>{}),i=n=>H(x,n)??n,a=n=>O(x,n);function c(n){const t={...r.value,...n};for(const[o,k]of Object.entries(n))k===void 0&&Reflect.deleteProperty(t,o);r.value=t}const E=["onSuccess","onWarning","onError","onInfo"];function S(n,t){c({[n]:t.length===0?void 0:t})}return(n,t)=>(y(),F(e(R),null,{default:l(()=>[v("div",L,[s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("expression")),1)]),_:2},[a("expression")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(b),{"model-value":r.value.expression,multiline:"",placeholder:"例:http.post('/api/foo').body({ id: row.id })","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":t[0]||(t[0]=o=>c({expression:o}))},null,8,["model-value"])]),_:1}),s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("markdown")),1)]),_:2},[a("markdown")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("markdown"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(h),{markdown:"","model-value":r.value.markdown,"onUpdate:modelValue":t[1]||(t[1]=o=>c({markdown:o}))},null,8,["model-value"])]),_:1})]),v("div",P,[s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("icon")),1)]),_:2},[a("icon")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("icon"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(B),{"model-value":r.value.icon??"","onUpdate:modelValue":t[2]||(t[2]=o=>c(o.trim()===""?{icon:void 0}:{icon:o}))},null,8,["model-value"])]),_:1}),s(e(d),{orientation:"vertical"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("color")),1)]),_:2},[a("color")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("color"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(C),{"model-value":r.value.color??"","onUpdate:modelValue":t[3]||(t[3]=o=>c(o.trim()===""?{color:void 0}:{color:o}))},null,8,["model-value"])]),_:1})]),v("div",A,[s(e(d),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("messageExpression")),1)]),_:2},[a("messageExpression")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(b),{"model-value":r.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":t[4]||(t[4]=o=>c({messageExpression:o===""?void 0:o}))},null,8,["model-value"])]),_:1}),s(e(d),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("resultExpression")),1)]),_:2},[a("resultExpression")?{name:"tooltip",fn:l(()=>[s(e(g),{source:a("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(b),{"model-value":r.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":t[5]||(t[5]=o=>c({resultExpression:o===""?void 0:o}))},null,8,["model-value"])]),_:1})]),v("div",I,[(y(),w(N,null,q(E,o=>s(e(d),{key:o,orientation:"vertical",class:"min-w-0"},{default:l(()=>[s(e(u),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i(o)),1)]),_:2},[a(o)?{name:"tooltip",fn:l(()=>[s(e(g),{source:a(o),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(D,{triggers:r.value[o]??[],"onUpdate:triggers":k=>S(o,k)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]),_:1}))}});export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as J,b as ee,P as le,Q as te,R as I,S as A,c as v,e as F,g as n,w as s,u as l,U as ae,V as oe,F as R,W as ne,t as p,f as c,X as W,Y as H,Z as se,$ as x,a0 as ie,a1 as h,o as d,a2 as j,a3 as K,I as O,a4 as Y,h as B,i as b,j as U,k as V,m as de,_,a5 as P,x as ue,y as ve,a6 as ce,a7 as re,a8 as me,a9 as fe}from"./index-
|
|
1
|
+
import{d as J,b as ee,P as le,Q as te,R as I,S as A,c as v,e as F,g as n,w as s,u as l,U as ae,V as oe,F as R,W as ne,t as p,f as c,X as W,Y as H,Z as se,$ as x,a0 as ie,a1 as h,o as d,a2 as j,a3 as K,I as O,a4 as Y,h as B,i as b,j as U,k as V,m as de,_,a5 as P,x as ue,y as ve,a6 as ce,a7 as re,a8 as me,a9 as fe}from"./index-D8qxH74z.js";const pe={key:0,class:"flex min-h-96 items-center justify-center p-8 text-sm text-zinc-400"},xe={key:1},ke={key:2,class:"p-6 text-sm text-red-500"},ye={key:2,class:"flex flex-col gap-4"},ge={class:"grid grid-cols-2 gap-4"},Ie={key:0,class:"flex gap-2 min-h-96"},Be={class:"flex w-56 shrink-0 flex-col"},be={class:"flex flex-1 flex-col gap-2"},Ue={class:"flex-1"},Ve={key:1,class:"flex flex-col gap-2"},_e={class:"h-96"},De=J({name:"ShwfedModalLayoutActionConfig",__name:"config",props:se({configure:{type:Function}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(L){const i=ee(L,"modelValue"),X=L,D=x(()=>X.configure??(()=>{})),E=le(()=>{}),k=a=>ue(E,a)??a,r=a=>ve(E,a),q=x({get:()=>i.value.slot??ce(),set:a=>{i.value={...i.value,slot:a}}}),t=te(q,{configure:D.value});function Q(a){i.value={...i.value,modalTitle:a}}function S(a,e){const o=e.trim(),g={...i.value};o.length===0?Reflect.deleteProperty(g,a):g[a]=o,i.value=g}function T(){const a=t.layouts.value;t.layouts.value=[...a,{name:"新布局",layout:{columns:1,placements:{}}}],t.activeLayoutIndex.value=a.length}function M(a,e){t.addBlock(a,e)}function z(a){t.removeBlock(a)}function $(a){t.removeBlocks(a)}const u=ie(null),m=x(()=>{const a=u.value;return a?t.blocks.value.find(e=>e.id===a)??null:null}),w=x(()=>{const a=m.value;return a?re()?.(a.type,a.compatibilityDate)??null:null});function C(a){u.value=a}function Z(){u.value=null}I(()=>t.blocks.value.map(a=>a.id),a=>{const e=u.value;e&&!a.includes(e)&&(u.value=null)});function G(a){const e=u.value;e&&t.updateBlock(e,a)}const N=h(me,null);if(N){const a=N.add();I(m,e=>{e?(a.label.value=t.getBlockLabel(e),a.back.value=Z):(a.label.value=null,a.back.value=null)},{immediate:!0}),A(()=>{a.dispose()})}const f=h(fe,null),y=x(()=>f?.target.value??null);return I(u,a=>{f?.drilled&&(f.drilled.value=!!a)},{immediate:!0}),A(()=>{f?.drilled&&(f.drilled.value=!1)}),(a,e)=>(d(),v(R,null,[y.value&&!u.value?(d(),F(ae,{key:0,to:y.value},[n(l(K),{class:"flex-1"},{default:s(()=>[n(j,{"model-value":l(t).layouts.value,"active-index":l(t).activeLayoutIndex.value,"onUpdate:modelValue":e[0]||(e[0]=o=>{l(t).layouts.value=o}),"onUpdate:activeIndex":e[1]||(e[1]=o=>{l(t).activeLayoutIndex.value=o})},null,8,["model-value","active-index"])]),_:1}),n(l(Y),{variant:"ghost",size:"sm",onClick:e[2]||(e[2]=o=>T())},{default:s(()=>[n(l(O),{icon:"fluent:add-20-regular",class:"size-4"}),e[17]||(e[17]=c("span",null,"新增布局",-1))]),_:1})],8,["to"])):oe("",!0),u.value?(d(),v(R,{key:1},[m.value?w.value?(d(),v("div",xe,[(d(),F(ne(w.value.config),{"model-value":m.value,configure:D.value,"onUpdate:modelValue":e[3]||(e[3]=o=>G(o))},null,8,["model-value","configure"]))])):(d(),v("div",ke," 未注册的块类型:"+p(m.value.type)+"@"+p(m.value.compatibilityDate),1)):(d(),v("div",pe," 块已不存在 "))],64)):(d(),v("div",ye,[n(l(_),{orientation:"vertical"},{default:s(()=>[n(l(B),{class:"text-xs text-zinc-500"},b({default:s(()=>[U(" "+p(k("modalTitle")),1)]),_:2},[r("modalTitle")?{name:"tooltip",fn:s(()=>[n(l(V),{source:r("modalTitle"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),n(l(de),{markdown:"","model-value":i.value.modalTitle,"translate-hint":k("modalTitle"),"onUpdate:modelValue":Q},null,8,["model-value","translate-hint"])]),_:1}),c("div",ge,[n(l(_),{orientation:"vertical"},{default:s(()=>[n(l(B),{class:"text-xs text-zinc-500"},b({default:s(()=>[U(" "+p(k("modalWidth")),1)]),_:2},[r("modalWidth")?{name:"tooltip",fn:s(()=>[n(l(V),{source:r("modalWidth"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),n(l(P),{"model-value":i.value.modalWidth??"",placeholder:"例:720px / 60vw","onUpdate:modelValue":e[4]||(e[4]=o=>S("modalWidth",String(o)))},null,8,["model-value"])]),_:1}),n(l(_),{orientation:"vertical"},{default:s(()=>[n(l(B),{class:"text-xs text-zinc-500"},b({default:s(()=>[U(" "+p(k("modalMinHeight")),1)]),_:2},[r("modalMinHeight")?{name:"tooltip",fn:s(()=>[n(l(V),{source:r("modalMinHeight"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),n(l(P),{"model-value":i.value.modalMinHeight??"",placeholder:"例:400px / 60vh","onUpdate:modelValue":e[5]||(e[5]=o=>S("modalMinHeight",String(o)))},null,8,["model-value"])]),_:1})]),y.value?(d(),v("div",Ve,[n(W,{"model-value":l(t).layouts.value,index:l(t).activeLayoutIndex.value,"onUpdate:modelValue":e[13]||(e[13]=o=>{l(t).layouts.value=o})},null,8,["model-value","index"]),c("div",_e,[n(H,{"model-value":l(t).layouts.value,"active-index":l(t).activeLayoutIndex.value,"selected-item-ids":l(t).selectedBlockIds.value,items:l(t).blocks.value,"find-entry":l(t).findBlockMeta,"get-item-label":l(t).getBlockLabel,"picker-entries":l(t).pickerEntries.value,"can-delete":!0,"item-noun":"块","onUpdate:modelValue":e[14]||(e[14]=o=>{l(t).layouts.value=o}),"onUpdate:activeIndex":e[15]||(e[15]=o=>{l(t).activeLayoutIndex.value=o}),"onUpdate:selectedItemIds":e[16]||(e[16]=o=>{l(t).selectedBlockIds.value=o}),onAddNew:M,onDrillDown:C,onDeleteItem:z,onDeleteItems:$},null,8,["model-value","active-index","selected-item-ids","items","find-entry","get-item-label","picker-entries"])])])):(d(),v("div",Ie,[c("div",Be,[n(l(K),{class:"flex-1"},{default:s(()=>[n(j,{"model-value":l(t).layouts.value,"active-index":l(t).activeLayoutIndex.value,"onUpdate:modelValue":e[6]||(e[6]=o=>{l(t).layouts.value=o}),"onUpdate:activeIndex":e[7]||(e[7]=o=>{l(t).activeLayoutIndex.value=o})},null,8,["model-value","active-index"])]),_:1}),n(l(Y),{variant:"ghost",size:"sm",onClick:e[8]||(e[8]=o=>T())},{default:s(()=>[n(l(O),{icon:"fluent:add-20-regular",class:"size-4"}),e[18]||(e[18]=c("span",null,"新增布局",-1))]),_:1})]),c("div",be,[n(W,{"model-value":l(t).layouts.value,index:l(t).activeLayoutIndex.value,"onUpdate:modelValue":e[9]||(e[9]=o=>{l(t).layouts.value=o})},null,8,["model-value","index"]),c("div",Ue,[n(H,{"model-value":l(t).layouts.value,"active-index":l(t).activeLayoutIndex.value,"selected-item-ids":l(t).selectedBlockIds.value,items:l(t).blocks.value,"find-entry":l(t).findBlockMeta,"get-item-label":l(t).getBlockLabel,"picker-entries":l(t).pickerEntries.value,"can-delete":!0,"item-noun":"块","onUpdate:modelValue":e[10]||(e[10]=o=>{l(t).layouts.value=o}),"onUpdate:activeIndex":e[11]||(e[11]=o=>{l(t).activeLayoutIndex.value=o}),"onUpdate:selectedItemIds":e[12]||(e[12]=o=>{l(t).selectedBlockIds.value=o}),onAddNew:M,onDrillDown:C,onDeleteItem:z,onDeleteItems:$},null,8,["model-value","active-index","selected-item-ids","items","find-entry","get-item-label","picker-entries"])])])]))]))],64))}});export{De as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as _,b as y,B as x,A as b,c,f as i,g as n,w as o,u as a,o as l,C as v,I as u,D as g,E as D,F as h,v as w,e as B,G as C,t as p,H as S}from"./index-
|
|
1
|
+
import{d as _,b as y,B as x,A as b,c,f as i,g as n,w as o,u as a,o as l,C as v,I as u,D as g,E as D,F as h,v as w,e as B,G as C,t as p,H as S}from"./index-D8qxH74z.js";const $={class:"flex flex-col gap-3"},k={class:"flex-1"},E={class:"ml-auto text-xs tabular-nums text-zinc-400"},I=_({name:"ShwfedPrototypeActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(m){const r=y(m,"modelValue"),f=(()=>{const s=new Map;for(const e of x){if(e.type===b||e.deprecated)continue;const t=s.get(e.type);(!t||e.compatibilityDate>t.compatibilityDate)&&s.set(e.type,{type:e.type,compatibilityDate:e.compatibilityDate,name:e.metadata.name,icon:e.metadata.icon})}return[...s.values()].sort((e,t)=>e.name.localeCompare(t.name,"zh"))})();function d(s,e){r.value={type:s,compatibilityDate:e}}return(s,e)=>(l(),c("div",$,[e[0]||(e[0]=i("p",{class:"text-xs text-zinc-500"}," 原型按钮点击后无任何副作用,用于占位。选择下方任意类型可将其转换为正式按钮 —— 此转换仅能进行一次。 ",-1)),n(a(S),null,{default:o(()=>[n(a(v),{align:"inline-start"},{default:o(()=>[n(a(u),{icon:"fluent:arrow-swap-20-regular"})]),_:1}),n(a(g),null,{default:o(()=>[n(a(D),null,{default:o(()=>[(l(!0),c(h,null,w(a(f),t=>(l(),B(a(C),{key:t.type,value:t.type,onSelect:V=>d(t.type,t.compatibilityDate)},{default:o(()=>[n(a(u),{icon:t.icon,class:"size-4 shrink-0"},null,8,["icon"]),i("span",k,p(t.name),1),i("span",E,p(t.compatibilityDate),1)]),_:2},1032,["value","onSelect"]))),128))]),_:1})]),_:1})]),_:1})]))}});export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as x,b as k,aG as g,c as S,g as e,w as o,u as t,o as V,h as r,i as m,j as d,t as f,k as p,a5 as w,_,m as $,x as h,y}from"./index-
|
|
1
|
+
import{d as x,b as k,aG as g,c as S,g as e,w as o,u as t,o as V,h as r,i as m,j as d,t as f,k as p,a5 as w,_,m as $,x as h,y}from"./index-D8qxH74z.js";const z={class:"flex flex-col gap-4"},C=x({name:"ShwfedMarkdownItemConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(v){const a=k(v,"modelValue"),c=g(),u=l=>h(c,l)??l,s=l=>y(c,l);return(l,n)=>(V(),S("div",z,[e(t(_),{orientation:"vertical"},{default:o(()=>[e(t(r),{class:"text-xs text-zinc-500"},m({default:o(()=>[d(" "+f(u("name")),1)]),_:2},[s("name")?{name:"tooltip",fn:o(()=>[e(t(p),{source:s("name"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(t(w),{"model-value":a.value.name,placeholder:"仅用于编辑器内识别","onUpdate:modelValue":n[0]||(n[0]=i=>a.value={...a.value,name:String(i)})},null,8,["model-value"])]),_:1}),e(t(_),{orientation:"vertical"},{default:o(()=>[e(t(r),{class:"text-xs text-zinc-500"},m({default:o(()=>[d(" "+f(u("content")),1)]),_:2},[s("content")?{name:"tooltip",fn:o(()=>[e(t(p),{source:s("content"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(t($),{markdown:"",multiline:"","model-value":a.value.content,"onUpdate:modelValue":n[1]||(n[1]=i=>a.value={...a.value,content:i})},null,8,["model-value"])]),_:1})]))}});export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as $,b,J as S,c as m,g as e,w as a,u as l,o as _,h as f,i as v,j as i,t as r,k as p,l as V,_ as x,K as y,L as h,M as w,N,F as z,v as D,O as F,x as M,y as O}from"./index-
|
|
1
|
+
import{d as $,b,J as S,c as m,g as e,w as a,u as l,o as _,h as f,i as v,j as i,t as r,k as p,l as V,_ as x,K as y,L as h,M as w,N,F as z,v as D,O as F,x as M,y as O}from"./index-D8qxH74z.js";const T={class:"flex flex-col gap-3"},B=$({name:"ShwfedNavigationActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(g){const t=b(g,"modelValue"),c=S(()=>{}),d=o=>M(c,o)??o,n=o=>O(c,o),k=[{value:"_self",label:"当前页面打开"},{value:"_blank",label:"新页面打开"}];return(o,u)=>(_(),m("div",T,[e(l(x),{orientation:"vertical"},{default:a(()=>[e(l(f),{class:"text-xs text-zinc-500"},v({default:a(()=>[i(" "+r(d("url")),1)]),_:2},[n("url")?{name:"tooltip",fn:a(()=>[e(l(p),{source:n("url"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(l(V),{"model-value":t.value.url??"",placeholder:"例:'/detail/' + string(row.id)","result-type":"string",class:"min-h-10","onUpdate:modelValue":u[0]||(u[0]=s=>t.value={...t.value,url:s})},null,8,["model-value"])]),_:1}),e(l(x),{orientation:"vertical"},{default:a(()=>[e(l(f),{class:"text-xs text-zinc-500"},v({default:a(()=>[i(" "+r(d("mode")),1)]),_:2},[n("mode")?{name:"tooltip",fn:a(()=>[e(l(p),{source:n("mode"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(l(y),{"model-value":t.value.mode??"_self","onUpdate:modelValue":u[1]||(u[1]=s=>t.value={...t.value,mode:s})},{default:a(()=>[e(l(h),{class:"w-full"},{default:a(()=>[e(l(w))]),_:1}),e(l(N),null,{default:a(()=>[(_(),m(z,null,D(k,s=>e(l(F),{key:s.value,value:s.value},{default:a(()=>[i(r(s.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])]),_:1})]))}});export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as f,aC as u,aD as m,aE as p,S as g,V as l,a1 as I,aF as y}from"./index-
|
|
1
|
+
import{d as f,aC as u,aD as m,aE as p,S as g,V as l,a1 as I,aF as y}from"./index-D8qxH74z.js";const w=f({name:"ShwfedActionDefinition",inheritAttrs:!1,__name:"definition",props:{actionId:{},effect:{}},setup(r){const n=r,a=u(),t=I(y,void 0),i=crypto.randomUUID(),c=import.meta.dev;let e,s=!1;function d(){!c||s||(s=!0,console.warn("[shwfed-action-definition] must be used inside <shwfed-actions>."))}function o(){if(!t){d();return}e&&e!==n.actionId&&t.unregisterAction(e,i),t.registerAction({ownerId:i,actionId:n.actionId,effect:n.effect,render:a.default}),e=n.actionId}return o(),m(()=>{o()}),p(()=>{o()}),g(()=>{!t||!e||t.unregisterAction(e,i)}),(A,_)=>l("",!0)}});export{w as _};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aH as e}from"./index-D8qxH74z.js";import{aI as r,aJ as s,aK as t}from"./index-D8qxH74z.js";export{r as TableConfig,s as createTableConfig,e as default,t as getColumnTechnicalKey};
|