@shwfed/config 2.6.0 → 2.7.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.
Files changed (59) hide show
  1. package/dist/mcp.mjs +1212 -1045
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +2 -1
  4. package/dist/preview/assets/config-B5FFtD0s.js +1 -0
  5. package/dist/preview/assets/config-BpWP2vu_.js +1 -0
  6. package/dist/preview/assets/{config-Co--BPbb.js → config-C2OqUTNd.js} +1 -1
  7. package/dist/preview/assets/{config-VChcvg_y.js → config-D7cjMBeK.js} +1 -1
  8. package/dist/preview/assets/config-DhORWTZC.js +1 -0
  9. package/dist/preview/assets/config-DuuYvFG_.js +1 -0
  10. package/dist/preview/assets/config-dpwN2-UY.js +1 -0
  11. package/dist/preview/assets/{config-Du7AdGIY.js → config-eP0EblYK.js} +1 -1
  12. package/dist/preview/assets/{config-LdNKbqCx.js → config-hs_pZ5MM.js} +1 -1
  13. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-Ma8i-2ox.js → definition.vue_vue_type_script_setup_true_lang-B8-Uydoy.js} +1 -1
  14. package/dist/preview/assets/index-BGFrUxgg.js +680 -0
  15. package/dist/preview/assets/index-BoGW90Pq.css +1 -0
  16. package/dist/preview/assets/index-Bw16PZhL.js +1 -0
  17. package/dist/preview/assets/index-CG261V86.js +1 -0
  18. package/dist/preview/assets/item-aVe51Gy6.js +1 -0
  19. package/dist/preview/assets/runtime-3rNI0KDH.js +1 -0
  20. package/dist/preview/assets/runtime-BOn8EwHL.js +1 -0
  21. package/dist/preview/assets/runtime-Bwr-rb58.js +1 -0
  22. package/dist/preview/assets/runtime-CXQuhSAX.js +1 -0
  23. package/dist/preview/assets/runtime-CYGmRjmI.js +1 -0
  24. package/dist/preview/assets/runtime-Ca79Fs6I.js +1 -0
  25. package/dist/preview/assets/runtime-CfVt6IWe.js +1 -0
  26. package/dist/preview/assets/runtime-DYj-R8SZ.js +1 -0
  27. package/dist/preview/assets/runtime-Dd1GqYeP.js +1 -0
  28. package/dist/preview/index.html +2 -2
  29. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/config.d.vue.ts +59 -0
  30. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/config.vue +452 -0
  31. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/config.vue.d.ts +59 -0
  32. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/item.d.vue.ts +7 -0
  33. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/item.vue +112 -0
  34. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/item.vue.d.ts +7 -0
  35. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/runtime.d.vue.ts +59 -0
  36. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/runtime.vue +47 -0
  37. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/runtime.vue.d.ts +59 -0
  38. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/schema.d.ts +92 -0
  39. package/dist/runtime/components/config/blocks/2026-06-01/com.shwfed.block.animated.number/schema.js +117 -0
  40. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +1 -1
  41. package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +1 -1
  42. package/package.json +2 -1
  43. package/dist/preview/assets/config-BF-HYbrD.js +0 -1
  44. package/dist/preview/assets/config-CevoqLCe.js +0 -1
  45. package/dist/preview/assets/config-DMOAQ9zl.js +0 -1
  46. package/dist/preview/assets/config-RACtdV3v.js +0 -1
  47. package/dist/preview/assets/config-oBOXGUjR.js +0 -1
  48. package/dist/preview/assets/index-C-nzF9-u.js +0 -1
  49. package/dist/preview/assets/index-CHEiFlnE.css +0 -1
  50. package/dist/preview/assets/index-rxUrWg1Y.js +0 -680
  51. package/dist/preview/assets/runtime-BNzaUtd-.js +0 -1
  52. package/dist/preview/assets/runtime-CAj4SjAs.js +0 -1
  53. package/dist/preview/assets/runtime-CE_42oyr.js +0 -1
  54. package/dist/preview/assets/runtime-CLMz0SYI.js +0 -1
  55. package/dist/preview/assets/runtime-COCfVWBL.js +0 -1
  56. package/dist/preview/assets/runtime-GfHY6wxJ.js +0 -1
  57. package/dist/preview/assets/runtime-Y00C-S73.js +0 -1
  58. package/dist/preview/assets/runtime-llw5ZA1Z.js +0 -1
  59. package/dist/preview/assets/runtime-wAJ77Q3a.js +0 -1
@@ -0,0 +1,59 @@
1
+ import type { Value } from './schema.js';
2
+ type __VLS_ModelProps = {
3
+ 'block': Value;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:block": (value: {
7
+ readonly type: "com.shwfed.block.animated.number";
8
+ readonly id: string;
9
+ readonly locale?: readonly [{
10
+ readonly locale: "zh";
11
+ readonly message: string;
12
+ }, ...{
13
+ readonly locale: "en" | "ja" | "ko";
14
+ readonly message: string;
15
+ }[]] | undefined;
16
+ readonly displayName?: string | undefined;
17
+ readonly compatibilityDate: "2026-06-01";
18
+ readonly items: readonly {
19
+ readonly name?: string | undefined;
20
+ readonly style?: string | undefined;
21
+ readonly id: string;
22
+ readonly prefix?: string | undefined;
23
+ readonly dataSource: {
24
+ readonly value: string;
25
+ readonly request?: string | undefined;
26
+ };
27
+ readonly pollingInterval?: number | undefined;
28
+ readonly suffix?: string | undefined;
29
+ }[];
30
+ }) => any;
31
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
32
+ "onUpdate:block"?: ((value: {
33
+ readonly type: "com.shwfed.block.animated.number";
34
+ readonly id: string;
35
+ readonly locale?: readonly [{
36
+ readonly locale: "zh";
37
+ readonly message: string;
38
+ }, ...{
39
+ readonly locale: "en" | "ja" | "ko";
40
+ readonly message: string;
41
+ }[]] | undefined;
42
+ readonly displayName?: string | undefined;
43
+ readonly compatibilityDate: "2026-06-01";
44
+ readonly items: readonly {
45
+ readonly name?: string | undefined;
46
+ readonly style?: string | undefined;
47
+ readonly id: string;
48
+ readonly prefix?: string | undefined;
49
+ readonly dataSource: {
50
+ readonly value: string;
51
+ readonly request?: string | undefined;
52
+ };
53
+ readonly pollingInterval?: number | undefined;
54
+ readonly suffix?: string | undefined;
55
+ }[];
56
+ }) => any) | undefined;
57
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
+ declare const _default: typeof __VLS_export;
59
+ export default _default;
@@ -0,0 +1,47 @@
1
+ <script setup>
2
+ import { computed, defineAsyncComponent, onMounted, ref } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import { getLocalizedText } from "../../../../../share/locale";
5
+ import { cel } from "../../../../../utils/cel";
6
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
7
+ import { interpolateMarkdown } from "../../../../table/utils/runtime";
8
+ import { Markdown } from "../../../../ui/markdown";
9
+ defineOptions({ name: "ShwfedBlockAnimatedNumberRuntime" });
10
+ const NumberFlowGroup = defineAsyncComponent(
11
+ () => import("@number-flow/vue").then((m) => m.NumberFlowGroup)
12
+ );
13
+ const Item = defineAsyncComponent(() => import("./item.vue"));
14
+ const block = defineModel("block", { type: null, ...{ required: true } });
15
+ const { locale } = useI18n();
16
+ const inheritedContext = injectCELContext();
17
+ const mounted = ref(false);
18
+ onMounted(() => {
19
+ mounted.value = true;
20
+ });
21
+ const caption = computed(() => {
22
+ const template = getLocalizedText(block.value.locale, locale.value) || "";
23
+ if (!template) return "";
24
+ return interpolateMarkdown(template, cel, celBindings(inheritedContext));
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <div class="flex h-full w-full flex-col items-center justify-center gap-2 text-center">
30
+ <!-- NumberFlowGroup synchronizes the digit animations across all items. -->
31
+ <NumberFlowGroup v-if="mounted">
32
+ <div class="flex flex-wrap items-center justify-center gap-4 font-semibold text-zinc-900">
33
+ <Item
34
+ v-for="it in block.items"
35
+ :key="it.id"
36
+ :item="it"
37
+ />
38
+ </div>
39
+ </NumberFlowGroup>
40
+
41
+ <Markdown
42
+ v-if="caption"
43
+ :source="caption"
44
+ class="prose prose-sm prose-zinc max-w-none text-xs text-zinc-500"
45
+ />
46
+ </div>
47
+ </template>
@@ -0,0 +1,59 @@
1
+ import type { Value } from './schema.js';
2
+ type __VLS_ModelProps = {
3
+ 'block': Value;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:block": (value: {
7
+ readonly type: "com.shwfed.block.animated.number";
8
+ readonly id: string;
9
+ readonly locale?: readonly [{
10
+ readonly locale: "zh";
11
+ readonly message: string;
12
+ }, ...{
13
+ readonly locale: "en" | "ja" | "ko";
14
+ readonly message: string;
15
+ }[]] | undefined;
16
+ readonly displayName?: string | undefined;
17
+ readonly compatibilityDate: "2026-06-01";
18
+ readonly items: readonly {
19
+ readonly name?: string | undefined;
20
+ readonly style?: string | undefined;
21
+ readonly id: string;
22
+ readonly prefix?: string | undefined;
23
+ readonly dataSource: {
24
+ readonly value: string;
25
+ readonly request?: string | undefined;
26
+ };
27
+ readonly pollingInterval?: number | undefined;
28
+ readonly suffix?: string | undefined;
29
+ }[];
30
+ }) => any;
31
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
32
+ "onUpdate:block"?: ((value: {
33
+ readonly type: "com.shwfed.block.animated.number";
34
+ readonly id: string;
35
+ readonly locale?: readonly [{
36
+ readonly locale: "zh";
37
+ readonly message: string;
38
+ }, ...{
39
+ readonly locale: "en" | "ja" | "ko";
40
+ readonly message: string;
41
+ }[]] | undefined;
42
+ readonly displayName?: string | undefined;
43
+ readonly compatibilityDate: "2026-06-01";
44
+ readonly items: readonly {
45
+ readonly name?: string | undefined;
46
+ readonly style?: string | undefined;
47
+ readonly id: string;
48
+ readonly prefix?: string | undefined;
49
+ readonly dataSource: {
50
+ readonly value: string;
51
+ readonly request?: string | undefined;
52
+ };
53
+ readonly pollingInterval?: number | undefined;
54
+ readonly suffix?: string | undefined;
55
+ }[];
56
+ }) => any) | undefined;
57
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
+ declare const _default: typeof __VLS_export;
59
+ export default _default;
@@ -0,0 +1,92 @@
1
+ import { Schema } from 'effect';
2
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
3
+ export { getStructFieldDescription, getStructFieldTitle } from '../../../../table/utils/schema-meta.js';
4
+ type AnySchema = Schema.Schema<any, any, never>;
5
+ type Configure = (env: Environment) => void;
6
+ export declare const type: "com.shwfed.block.animated.number";
7
+ export declare const compatibilityDate: "2026-06-01";
8
+ export declare const metadata: {
9
+ readonly name: "动画数字";
10
+ readonly icon: "fluent:number-symbol-20-regular";
11
+ readonly w: {
12
+ readonly initial: 8;
13
+ readonly min: 2;
14
+ readonly max: number;
15
+ };
16
+ readonly h: {
17
+ readonly initial: 3;
18
+ readonly min: 2;
19
+ readonly max: number;
20
+ };
21
+ };
22
+ /**
23
+ * One item's datasource: an optional HTTP request plus the expression that
24
+ * derives its number. Mirrors `table`'s `DataSource` (minus `total`), but the
25
+ * `value` expression returns a number rather than a list.
26
+ */
27
+ export declare function dataSourceSchema(configure: Configure): Schema.Struct<{
28
+ request: Schema.optional<Schema.Schema<string, string, never>>;
29
+ value: Schema.Schema<string, string, never>;
30
+ }>;
31
+ /**
32
+ * One animated-number item — a single `NumberFlow`. Exported so the config
33
+ * editor can read its field `title` / `description` annotations.
34
+ */
35
+ export declare function itemSchema(configure: Configure): Schema.Struct<{
36
+ id: Schema.refine<string, typeof Schema.String>;
37
+ name: Schema.optional<Schema.SchemaClass<string, string, never>>;
38
+ dataSource: Schema.Struct<{
39
+ request: Schema.optional<Schema.Schema<string, string, never>>;
40
+ value: Schema.Schema<string, string, never>;
41
+ }>;
42
+ pollingInterval: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
43
+ prefix: Schema.optional<Schema.Schema<string, string, never>>;
44
+ suffix: Schema.optional<Schema.Schema<string, string, never>>;
45
+ style: Schema.optional<Schema.Schema<string, string, never>>;
46
+ }>;
47
+ export declare function schema(configure: Configure, _blockRef?: AnySchema): Schema.Struct<{
48
+ id: Schema.refine<string, typeof Schema.String>;
49
+ type: Schema.tag<"com.shwfed.block.animated.number">;
50
+ compatibilityDate: Schema.tag<"2026-06-01">;
51
+ displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
52
+ locale: Schema.optional<Schema.refine<readonly [{
53
+ readonly locale: "zh";
54
+ readonly message: string;
55
+ }, ...{
56
+ readonly locale: "en" | "ja" | "ko";
57
+ readonly message: string;
58
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
59
+ locale: Schema.Literal<["zh"]>;
60
+ message: Schema.SchemaClass<string, string, never>;
61
+ }>], [Schema.Struct<{
62
+ locale: Schema.Literal<["ja", "en", "ko"]>;
63
+ message: Schema.SchemaClass<string, string, never>;
64
+ }>]>>>;
65
+ items: Schema.refine<readonly {
66
+ readonly name?: string | undefined;
67
+ readonly style?: string | undefined;
68
+ readonly id: string;
69
+ readonly prefix?: string | undefined;
70
+ readonly dataSource: {
71
+ readonly value: string;
72
+ readonly request?: string | undefined;
73
+ };
74
+ readonly pollingInterval?: number | undefined;
75
+ readonly suffix?: string | undefined;
76
+ }[], Schema.Array$<Schema.Struct<{
77
+ id: Schema.refine<string, typeof Schema.String>;
78
+ name: Schema.optional<Schema.SchemaClass<string, string, never>>;
79
+ dataSource: Schema.Struct<{
80
+ request: Schema.optional<Schema.Schema<string, string, never>>;
81
+ value: Schema.Schema<string, string, never>;
82
+ }>;
83
+ pollingInterval: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
84
+ prefix: Schema.optional<Schema.Schema<string, string, never>>;
85
+ suffix: Schema.optional<Schema.Schema<string, string, never>>;
86
+ style: Schema.optional<Schema.Schema<string, string, never>>;
87
+ }>>>;
88
+ }>;
89
+ export declare function defaultBody(): Record<string, unknown>;
90
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
91
+ export type ItemValue = Value['items'][number];
92
+ export type DataSourceValue = ItemValue['dataSource'];
@@ -0,0 +1,117 @@
1
+ import { Schema } from "effect";
2
+ import { Expression, LocaleMarkdown } from "../../../../../share/expression.js";
3
+ export { getStructFieldDescription, getStructFieldTitle } from "../../../../table/utils/schema-meta.js";
4
+ export const type = "com.shwfed.block.animated.number";
5
+ export const compatibilityDate = "2026-06-01";
6
+ export const metadata = {
7
+ name: "\u52A8\u753B\u6570\u5B57",
8
+ icon: "fluent:number-symbol-20-regular",
9
+ w: { initial: 8, min: 2, max: Infinity },
10
+ h: { initial: 3, min: 2, max: Infinity }
11
+ };
12
+ function registerJson(env) {
13
+ env.registerVariable("json", "optional<dyn>", {
14
+ label: "HTTP \u54CD\u5E94\u4F53",
15
+ description: "HTTP \u54CD\u5E94\u4F53\uFF08\u914D\u7F6E\u4E86\u8BF7\u6C42\u65F6\u4E3A\u5DF2\u89E3\u6790 JSON\uFF0C\u5426\u5219\u4E3A none\uFF09"
16
+ });
17
+ }
18
+ export function dataSourceSchema(configure) {
19
+ const CelRequest = Expression({
20
+ configure,
21
+ resultType: "HttpRequest"
22
+ });
23
+ const CelNumber = Expression({
24
+ configure: (env) => {
25
+ configure(env);
26
+ registerJson(env);
27
+ },
28
+ // Tolerate `dyn` / `optional` like `tableDataSource`'s total — most
29
+ // response-derived expressions check as `dyn`, narrowing only at runtime.
30
+ resultType: (t) => t === "number" || t === "dyn" || t.startsWith("optional")
31
+ });
32
+ return Schema.Struct({
33
+ request: Schema.optional(CelRequest).annotations({
34
+ title: "\u8BF7\u6C42",
35
+ description: "\u53EF\u9009\u7684 HTTP \u8BF7\u6C42\u8868\u8FBE\u5F0F\uFF1B\u672A\u914D\u7F6E\u65F6\u6570\u503C\u76F4\u63A5\u4ECE `\u6570\u503C` \u8868\u8FBE\u5F0F\u8BFB\u53D6\uFF08\u901A\u5E38\u5F15\u7528\u4E0A\u4E0B\u6587\u53D8\u91CF\uFF09"
36
+ }),
37
+ value: CelNumber.annotations({
38
+ title: "\u6570\u503C",
39
+ description: "\u8FD4\u56DE\u8981\u5C55\u793A\u7684\u6570\u5B57\uFF08`number`\uFF09\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u914D\u7F6E\u4E86 `\u8BF7\u6C42` \u65F6\u53EF\u901A\u8FC7 `json` \u5F15\u7528\u54CD\u5E94\u4F53"
40
+ })
41
+ }).annotations({
42
+ title: "\u6570\u636E\u6E90",
43
+ description: "\u4E00\u4E2A HTTP \u8BF7\u6C42\u52A0\u4E00\u4E2A\u8FD4\u56DE\u6570\u5B57\u7684\u8868\u8FBE\u5F0F"
44
+ });
45
+ }
46
+ export function itemSchema(configure) {
47
+ const CelString = Expression({
48
+ configure: (env) => {
49
+ configure(env);
50
+ registerJson(env);
51
+ },
52
+ // Tolerate `dyn` / `optional` so a `json`-derived string (which checks as
53
+ // `dyn`) passes validation, mirroring the `value` field's tolerance.
54
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("optional")
55
+ });
56
+ const CelStyle = Expression({
57
+ configure: (env) => {
58
+ configure(env);
59
+ registerJson(env);
60
+ },
61
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("map") || t.startsWith("optional")
62
+ });
63
+ return Schema.Struct({
64
+ id: Schema.UUID.annotations({ description: "\u6570\u5B57\u9879\u552F\u4E00\u6807\u8BC6" }),
65
+ name: Schema.optional(Schema.String.annotations({
66
+ title: "\u5185\u90E8\u540D\u79F0",
67
+ description: "\u4EC5\u5728\u7F16\u8F91\u5668\u5185\u53EF\u89C1\u7684\u6570\u5B57\u9879\u540D\uFF0C\u7528\u4F5C\u4FA7\u8FB9\u680F\u6807\u7B7E\uFF1B\u8FD0\u884C\u65F6\u4E0D\u5C55\u793A"
68
+ })),
69
+ dataSource: dataSourceSchema(configure),
70
+ pollingInterval: Schema.optional(
71
+ Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
72
+ title: "\u8F6E\u8BE2\u95F4\u9694",
73
+ description: "\u8F6E\u8BE2\u5237\u65B0\u95F4\u9694\uFF08\u79D2\uFF09\uFF0C\u6B63\u6574\u6570\uFF1B\u7559\u7A7A\u5219\u4E0D\u8F6E\u8BE2\u3002\u7A97\u53E3\u5931\u7126\u65F6\u6682\u505C\uFF0C\u91CD\u65B0\u805A\u7126\u65F6\u7ACB\u5373\u5237\u65B0\u5E76\u6062\u590D\u8F6E\u8BE2"
74
+ })
75
+ ),
76
+ prefix: Schema.optional(CelString.annotations({
77
+ title: "\u524D\u7F00",
78
+ description: "\u8FD4\u56DE\u6570\u5B57\u524D\u5C55\u793A\u6587\u672C\uFF08`string`\uFF09\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u53EF\u5F15\u7528 `json`\u3002\u7559\u7A7A\u5219\u4E0D\u5C55\u793A"
79
+ })),
80
+ suffix: Schema.optional(CelString.annotations({
81
+ title: "\u540E\u7F00",
82
+ description: "\u8FD4\u56DE\u6570\u5B57\u540E\u5C55\u793A\u6587\u672C\uFF08`string`\uFF09\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u53EF\u5F15\u7528 `json`\u3002\u7559\u7A7A\u5219\u4E0D\u5C55\u793A"
83
+ })),
84
+ style: Schema.optional(CelStyle.annotations({
85
+ title: "\u6837\u5F0F",
86
+ description: "\u8FD4\u56DE\u5E94\u7528\u5728\u8BE5\u6570\u5B57\u4E0A\u7684\u6837\u5F0F\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8FD4\u56DE CSS \u5B57\u7B26\u4E32\uFF08\u5982 `'font-size: 3rem'`\uFF09\u6216\u6837\u5F0F\u5BF9\u8C61\uFF08\u5982 `{'fontSize': '3rem'}`\uFF09\uFF1B\u53EF\u5F15\u7528 `json`\u3002\u7559\u7A7A\u5219\u4E0D\u8BBE\u6837\u5F0F"
87
+ }))
88
+ }).annotations({
89
+ title: "\u6570\u5B57\u9879",
90
+ description: "\u4E00\u4E2A\u72EC\u7ACB\u53D6\u6570\u3001\u53EF\u8F6E\u8BE2\u7684\u52A8\u753B\u6570\u5B57"
91
+ });
92
+ }
93
+ export function schema(configure, _blockRef) {
94
+ return Schema.Struct({
95
+ id: Schema.UUID.annotations({ description: "\u5757\u552F\u4E00\u6807\u8BC6" }),
96
+ type: Schema.tag(type),
97
+ compatibilityDate: Schema.tag(compatibilityDate),
98
+ displayName: Schema.optional(Schema.String.annotations({
99
+ title: "\u5185\u90E8\u540D\u79F0",
100
+ description: "\u4EC5\u5728\u7F16\u8F91\u5668\u5185\u53EF\u89C1\u7684\u5757\u540D\uFF0C\u7528\u4E8E\u5728\u4FA7\u8FB9\u680F\u548C\u5E03\u5C40\u7F16\u8F91\u5668\u4E2D\u8BC6\u522B\u5757\uFF1B\u8FD0\u884C\u65F6\u4E0D\u5C55\u793A"
101
+ })),
102
+ locale: Schema.optional(LocaleMarkdown({ configure }).annotations({
103
+ title: "\u8BF4\u660E\u6587\u5B57",
104
+ description: "\u663E\u793A\u5728\u6570\u5B57\u4E0B\u65B9\u7684\u672C\u5730\u5316\u8BF4\u660E\u6587\u5B57\uFF0C\u6309\u5185\u8054 Markdown \u6E32\u67D3\uFF0C\u652F\u6301 `{{ \u8868\u8FBE\u5F0F }}` CEL \u63D2\u503C\uFF1B\u7559\u7A7A\u5219\u4E0D\u663E\u793A"
105
+ })),
106
+ items: Schema.Array(itemSchema(configure)).pipe(Schema.minItems(1)).annotations({
107
+ title: "\u6570\u5B57\u9879",
108
+ description: "\u4E00\u4E2A\u6216\u591A\u4E2A\u52A8\u753B\u6570\u5B57\uFF0C\u5E76\u6392\u5C55\u793A\u5E76\u5171\u4EAB\u52A8\u753B\u5206\u7EC4\uFF1B\u81F3\u5C11\u914D\u7F6E\u4E00\u4E2A"
109
+ })
110
+ }).annotations({
111
+ title: "\u52A8\u753B\u6570\u5B57\u5757",
112
+ description: "\u628A\u4E00\u4E2A\u6216\u591A\u4E2A\u6570\u636E\u6E90\u5404\u53D6\u4E00\u4E2A\u6570\u5B57\uFF0C\u4EE5\u52A8\u753B\u8FC7\u6E21\u5E76\u6392\u6E32\u67D3\uFF0C\u53EF\u9009\u9010\u9879\u8F6E\u8BE2"
113
+ });
114
+ }
115
+ export function defaultBody() {
116
+ return { items: [{ id: crypto.randomUUID(), dataSource: { value: "0" } }] };
117
+ }
@@ -10,7 +10,7 @@ export const metadata = {
10
10
  w: { initial: 8, min: 4, max: Infinity },
11
11
  h: { initial: 2, min: 2, max: 2 }
12
12
  };
13
- const isListType = (actual) => actual === "dyn" || actual.startsWith("list");
13
+ const isListType = (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional");
14
14
  function configureWithOption(configure) {
15
15
  return (env) => {
16
16
  configure(env);
@@ -10,7 +10,7 @@ export const metadata = {
10
10
  w: { initial: 8, min: 4, max: Infinity },
11
11
  h: { initial: 2, min: 2, max: 2 }
12
12
  };
13
- const isListType = (actual) => actual === "dyn" || actual.startsWith("list");
13
+ const isListType = (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional");
14
14
  function configureWithOption(configure) {
15
15
  return (env) => {
16
16
  configure(env);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/config",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Configurable UI for SHWFED",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -54,6 +54,7 @@
54
54
  "@intlify/unplugin-vue-i18n": "^11.2.3",
55
55
  "@lezer/highlight": "^1.2.3",
56
56
  "@modelcontextprotocol/sdk": "^1.29.0",
57
+ "@number-flow/vue": "^0.5.0",
57
58
  "@nuxt/kit": "^4.4.5",
58
59
  "@tailwindcss/typography": "^0.5.19",
59
60
  "@tailwindcss/vite": "^4.3.0",
@@ -1 +0,0 @@
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-rxUrWg1Y.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 +0,0 @@
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-rxUrWg1Y.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 +0,0 @@
1
- import{d as x,b as k,aN 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-rxUrWg1Y.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 +0,0 @@
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-rxUrWg1Y.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 +0,0 @@
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-rxUrWg1Y.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 +0,0 @@
1
- import{aO as e}from"./index-rxUrWg1Y.js";import{aP as r,aQ as s,aR as t}from"./index-rxUrWg1Y.js";export{r as TableConfig,s as createTableConfig,e as default,t as getColumnTechnicalKey};