@shwfed/config 2.7.1 → 2.7.2

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 (75) hide show
  1. package/dist/mcp.mjs +1125 -1014
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/badge-CJpxWUkB.js +1 -0
  4. package/dist/preview/assets/config-B-uvT_pb.js +1 -0
  5. package/dist/preview/assets/config-BRiILJ2a.js +1 -0
  6. package/dist/preview/assets/config-CbMKku2N.js +1 -0
  7. package/dist/preview/assets/config-D8tXo17l.js +1 -0
  8. package/dist/preview/assets/config-D9pA2oC8.js +1 -0
  9. package/dist/preview/assets/config-DtCRvYa9.js +1 -0
  10. package/dist/preview/assets/config-OQtpit00.js +1 -0
  11. package/dist/preview/assets/config-QHRydAV_.js +1 -0
  12. package/dist/preview/assets/config-dtgP-3mj.js +1 -0
  13. package/dist/preview/assets/definition.vue_vue_type_script_setup_true_lang-Dp8O3US_.js +1 -0
  14. package/dist/preview/assets/{index-BGFrUxgg.js → index-BBJQYeyQ.js} +170 -170
  15. package/dist/preview/assets/{index-Bw16PZhL.js → index-BWNTkzpm.js} +1 -1
  16. package/dist/preview/assets/index-ChitoGhE.js +1 -0
  17. package/dist/preview/assets/index-DFKLSxdT.css +1 -0
  18. package/dist/preview/assets/{item-aVe51Gy6.js → item-BpzTGOEt.js} +1 -1
  19. package/dist/preview/assets/{runtime-3rNI0KDH.js → runtime-B5S6icpw.js} +1 -1
  20. package/dist/preview/assets/{runtime-CYGmRjmI.js → runtime-BDyVuoP3.js} +1 -1
  21. package/dist/preview/assets/{runtime-CfVt6IWe.js → runtime-BjB2wvFX.js} +1 -1
  22. package/dist/preview/assets/{runtime-CXQuhSAX.js → runtime-Busbr90M.js} +1 -1
  23. package/dist/preview/assets/runtime-By0VH4uC.js +1 -0
  24. package/dist/preview/assets/{runtime-DYj-R8SZ.js → runtime-C29fORZL.js} +1 -1
  25. package/dist/preview/assets/runtime-DMsEFiBw.js +1 -0
  26. package/dist/preview/assets/runtime-DfP3qvGT.js +1 -0
  27. package/dist/preview/assets/runtime-DiTvLHpE.js +1 -0
  28. package/dist/preview/index.html +2 -2
  29. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.d.ts +1 -1
  30. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.js +1 -1
  31. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.d.vue.ts +7 -0
  32. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.vue +91 -0
  33. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.vue.d.ts +7 -0
  34. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.d.vue.ts +96 -0
  35. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue +522 -0
  36. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue.d.ts +96 -0
  37. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.d.vue.ts +96 -0
  38. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.vue +72 -0
  39. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.vue.d.ts +96 -0
  40. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.d.ts +121 -0
  41. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.js +100 -0
  42. package/dist/runtime/components/form/config.vue +10 -18
  43. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  44. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  45. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  46. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  47. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  48. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  49. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  50. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  51. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  52. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  53. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  54. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  55. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  56. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  57. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  58. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  59. package/package.json +1 -1
  60. package/dist/preview/assets/config-B5FFtD0s.js +0 -1
  61. package/dist/preview/assets/config-BpWP2vu_.js +0 -1
  62. package/dist/preview/assets/config-C2OqUTNd.js +0 -1
  63. package/dist/preview/assets/config-D7cjMBeK.js +0 -1
  64. package/dist/preview/assets/config-DhORWTZC.js +0 -1
  65. package/dist/preview/assets/config-DuuYvFG_.js +0 -1
  66. package/dist/preview/assets/config-dpwN2-UY.js +0 -1
  67. package/dist/preview/assets/config-eP0EblYK.js +0 -1
  68. package/dist/preview/assets/config-hs_pZ5MM.js +0 -1
  69. package/dist/preview/assets/definition.vue_vue_type_script_setup_true_lang-B8-Uydoy.js +0 -1
  70. package/dist/preview/assets/index-BoGW90Pq.css +0 -1
  71. package/dist/preview/assets/index-CG261V86.js +0 -1
  72. package/dist/preview/assets/runtime-BOn8EwHL.js +0 -1
  73. package/dist/preview/assets/runtime-Bwr-rb58.js +0 -1
  74. package/dist/preview/assets/runtime-Ca79Fs6I.js +0 -1
  75. package/dist/preview/assets/runtime-Dd1GqYeP.js +0 -1
@@ -0,0 +1,96 @@
1
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ configure?: (env: Environment) => void;
5
+ };
6
+ type __VLS_ModelProps = {
7
+ 'block': Value;
8
+ };
9
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:block": (value: {
12
+ readonly type: "com.shwfed.block.card";
13
+ readonly style?: string | undefined;
14
+ readonly id: string;
15
+ readonly slot: {
16
+ readonly blocks: readonly any[];
17
+ readonly layouts: readonly {
18
+ readonly name: string;
19
+ readonly layout: {
20
+ readonly style?: string | undefined;
21
+ readonly columns: number;
22
+ readonly gap?: number | undefined;
23
+ readonly rows?: number | undefined;
24
+ readonly placements: {
25
+ readonly [x: string]: {
26
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
27
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
28
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
29
+ };
30
+ };
31
+ };
32
+ readonly media?: string | undefined;
33
+ }[];
34
+ };
35
+ readonly displayName?: string | undefined;
36
+ readonly url?: string | undefined;
37
+ readonly compatibilityDate: "2026-06-02";
38
+ readonly badge?: {
39
+ readonly content?: readonly [{
40
+ readonly locale: "zh";
41
+ readonly message: string;
42
+ }, ...{
43
+ readonly locale: "en" | "ja" | "ko";
44
+ readonly message: string;
45
+ }[]] | undefined;
46
+ readonly dot?: boolean | undefined;
47
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
48
+ readonly request?: string | undefined;
49
+ readonly interval?: number | undefined;
50
+ } | undefined;
51
+ }) => any;
52
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
53
+ "onUpdate:block"?: ((value: {
54
+ readonly type: "com.shwfed.block.card";
55
+ readonly style?: string | undefined;
56
+ readonly id: string;
57
+ readonly slot: {
58
+ readonly blocks: readonly any[];
59
+ readonly layouts: readonly {
60
+ readonly name: string;
61
+ readonly layout: {
62
+ readonly style?: string | undefined;
63
+ readonly columns: number;
64
+ readonly gap?: number | undefined;
65
+ readonly rows?: number | undefined;
66
+ readonly placements: {
67
+ readonly [x: string]: {
68
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
69
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
70
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
71
+ };
72
+ };
73
+ };
74
+ readonly media?: string | undefined;
75
+ }[];
76
+ };
77
+ readonly displayName?: string | undefined;
78
+ readonly url?: string | undefined;
79
+ readonly compatibilityDate: "2026-06-02";
80
+ readonly badge?: {
81
+ readonly content?: readonly [{
82
+ readonly locale: "zh";
83
+ readonly message: string;
84
+ }, ...{
85
+ readonly locale: "en" | "ja" | "ko";
86
+ readonly message: string;
87
+ }[]] | undefined;
88
+ readonly dot?: boolean | undefined;
89
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
90
+ readonly request?: string | undefined;
91
+ readonly interval?: number | undefined;
92
+ } | undefined;
93
+ }) => any) | undefined;
94
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
95
+ declare const _default: typeof __VLS_export;
96
+ export default _default;
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ import { computed, defineAsyncComponent } from "vue";
3
+ import { Effect } from "effect";
4
+ import { cel } from "../../../../../utils/cel";
5
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
6
+ import SlotRenderer from "../../../../../share/slot-renderer.vue";
7
+ import { findBlock } from "../../../utils/resolve";
8
+ defineOptions({ name: "ShwfedBlockCardRuntime" });
9
+ const CardBadge = defineAsyncComponent(() => import("./badge.vue"));
10
+ const block = defineModel("block", { type: null, ...{ required: true } });
11
+ const props = defineProps({
12
+ configure: { type: Function, required: false }
13
+ });
14
+ const configure = computed(() => props.configure ?? (() => {
15
+ }));
16
+ const inheritedContext = injectCELContext();
17
+ function baseContext() {
18
+ return celBindings(inheritedContext);
19
+ }
20
+ function evalStyle(expression) {
21
+ if (!expression) return void 0;
22
+ try {
23
+ const r = Effect.runSync(cel(expression, baseContext()));
24
+ if (r === null || r === void 0) return void 0;
25
+ if (typeof r === "string") return r;
26
+ if (typeof r === "object") return r;
27
+ return String(r);
28
+ } catch {
29
+ return void 0;
30
+ }
31
+ }
32
+ const styleValue = computed(() => evalStyle(block.value.style));
33
+ const hasUrl = computed(() => !!block.value.url && block.value.url.trim().length > 0);
34
+ function onCardClick(e) {
35
+ if (!hasUrl.value) return;
36
+ const target = e.target;
37
+ if (target?.closest('a, button, input, select, textarea, label, [role="button"]')) return;
38
+ try {
39
+ const url = Effect.runSync(cel(block.value.url, baseContext()));
40
+ if (typeof url === "string" && url) window.open(url, "_self");
41
+ } catch (err) {
42
+ console.warn("[shwfed-card] url evaluation failed", err);
43
+ }
44
+ }
45
+ function updateSlot(next) {
46
+ block.value = { ...block.value, slot: next };
47
+ }
48
+ </script>
49
+
50
+ <template>
51
+ <div
52
+ class="relative h-full rounded-sm border border-zinc-200 bg-white p-4"
53
+ :class="hasUrl ? 'cursor-pointer' : ''"
54
+ :style="styleValue"
55
+ @click="onCardClick"
56
+ >
57
+ <ClientOnly>
58
+ <CardBadge
59
+ v-if="block.badge"
60
+ :badge="block.badge"
61
+ class="absolute -right-2 -top-2 z-10"
62
+ />
63
+ </ClientOnly>
64
+
65
+ <SlotRenderer
66
+ :slot-value="block.slot"
67
+ :configure="configure"
68
+ :find-entry="findBlock"
69
+ @update:slot-value="(s) => updateSlot(s)"
70
+ />
71
+ </div>
72
+ </template>
@@ -0,0 +1,96 @@
1
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ configure?: (env: Environment) => void;
5
+ };
6
+ type __VLS_ModelProps = {
7
+ 'block': Value;
8
+ };
9
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:block": (value: {
12
+ readonly type: "com.shwfed.block.card";
13
+ readonly style?: string | undefined;
14
+ readonly id: string;
15
+ readonly slot: {
16
+ readonly blocks: readonly any[];
17
+ readonly layouts: readonly {
18
+ readonly name: string;
19
+ readonly layout: {
20
+ readonly style?: string | undefined;
21
+ readonly columns: number;
22
+ readonly gap?: number | undefined;
23
+ readonly rows?: number | undefined;
24
+ readonly placements: {
25
+ readonly [x: string]: {
26
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
27
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
28
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
29
+ };
30
+ };
31
+ };
32
+ readonly media?: string | undefined;
33
+ }[];
34
+ };
35
+ readonly displayName?: string | undefined;
36
+ readonly url?: string | undefined;
37
+ readonly compatibilityDate: "2026-06-02";
38
+ readonly badge?: {
39
+ readonly content?: readonly [{
40
+ readonly locale: "zh";
41
+ readonly message: string;
42
+ }, ...{
43
+ readonly locale: "en" | "ja" | "ko";
44
+ readonly message: string;
45
+ }[]] | undefined;
46
+ readonly dot?: boolean | undefined;
47
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
48
+ readonly request?: string | undefined;
49
+ readonly interval?: number | undefined;
50
+ } | undefined;
51
+ }) => any;
52
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
53
+ "onUpdate:block"?: ((value: {
54
+ readonly type: "com.shwfed.block.card";
55
+ readonly style?: string | undefined;
56
+ readonly id: string;
57
+ readonly slot: {
58
+ readonly blocks: readonly any[];
59
+ readonly layouts: readonly {
60
+ readonly name: string;
61
+ readonly layout: {
62
+ readonly style?: string | undefined;
63
+ readonly columns: number;
64
+ readonly gap?: number | undefined;
65
+ readonly rows?: number | undefined;
66
+ readonly placements: {
67
+ readonly [x: string]: {
68
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
69
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
70
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
71
+ };
72
+ };
73
+ };
74
+ readonly media?: string | undefined;
75
+ }[];
76
+ };
77
+ readonly displayName?: string | undefined;
78
+ readonly url?: string | undefined;
79
+ readonly compatibilityDate: "2026-06-02";
80
+ readonly badge?: {
81
+ readonly content?: readonly [{
82
+ readonly locale: "zh";
83
+ readonly message: string;
84
+ }, ...{
85
+ readonly locale: "en" | "ja" | "ko";
86
+ readonly message: string;
87
+ }[]] | undefined;
88
+ readonly dot?: boolean | undefined;
89
+ readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
90
+ readonly request?: string | undefined;
91
+ readonly interval?: number | undefined;
92
+ } | undefined;
93
+ }) => any) | undefined;
94
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
95
+ declare const _default: typeof __VLS_export;
96
+ export default _default;
@@ -0,0 +1,121 @@
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.card";
7
+ export declare const compatibilityDate: "2026-06-02";
8
+ export declare const metadata: {
9
+ readonly name: "卡片";
10
+ readonly icon: "fluent:card-ui-20-regular";
11
+ readonly w: {
12
+ readonly initial: 12;
13
+ readonly min: 4;
14
+ readonly max: number;
15
+ };
16
+ readonly h: {
17
+ readonly initial: 6;
18
+ readonly min: 4;
19
+ readonly max: number;
20
+ };
21
+ };
22
+ export declare const BADGE_VARIANTS: readonly ["default", "secondary", "destructive", "outline"];
23
+ /**
24
+ * The card's top-right badge: an optional HTTP datasource whose response feeds
25
+ * an inline-markdown localized `content` (with `{{ 表达式 }}` CEL interpolation),
26
+ * optionally polled. Exported so the config editor can read field annotations.
27
+ *
28
+ * Every field is optional; an absent (or empty) `content` means no badge is
29
+ * rendered at all.
30
+ */
31
+ export declare function badgeSchema(configure: Configure): Schema.Struct<{
32
+ request: Schema.optional<Schema.Schema<string, string, never>>;
33
+ content: Schema.optional<Schema.filter<Schema.TupleType<readonly [Schema.Struct<{
34
+ locale: Schema.Literal<["zh"]>;
35
+ message: Schema.SchemaClass<string, string, never>;
36
+ }>], [Schema.Struct<{
37
+ locale: Schema.Literal<["ja", "en", "ko"]>;
38
+ message: Schema.SchemaClass<string, string, never>;
39
+ }>]>>>;
40
+ interval: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
41
+ dot: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
42
+ variant: Schema.optional<Schema.Literal<["default", "secondary", "destructive", "outline"]>>;
43
+ }>;
44
+ export declare function schema(configure: Configure, blockRef: AnySchema): Schema.Struct<{
45
+ id: Schema.refine<string, typeof Schema.String>;
46
+ type: Schema.tag<"com.shwfed.block.card">;
47
+ compatibilityDate: Schema.tag<"2026-06-02">;
48
+ displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
49
+ style: Schema.optional<Schema.Schema<string, string, never>>;
50
+ url: Schema.optional<Schema.Schema<string, string, never>>;
51
+ badge: Schema.optional<Schema.Struct<{
52
+ request: Schema.optional<Schema.Schema<string, string, never>>;
53
+ content: Schema.optional<Schema.filter<Schema.TupleType<readonly [Schema.Struct<{
54
+ locale: Schema.Literal<["zh"]>;
55
+ message: Schema.SchemaClass<string, string, never>;
56
+ }>], [Schema.Struct<{
57
+ locale: Schema.Literal<["ja", "en", "ko"]>;
58
+ message: Schema.SchemaClass<string, string, never>;
59
+ }>]>>>;
60
+ interval: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
61
+ dot: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
62
+ variant: Schema.optional<Schema.Literal<["default", "secondary", "destructive", "outline"]>>;
63
+ }>>;
64
+ slot: Schema.refine<{
65
+ readonly blocks: readonly any[];
66
+ readonly layouts: readonly {
67
+ readonly name: string;
68
+ readonly layout: {
69
+ readonly style?: string | undefined;
70
+ readonly columns: number;
71
+ readonly gap?: number | undefined;
72
+ readonly rows?: number | undefined;
73
+ readonly placements: {
74
+ readonly [x: string]: {
75
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
76
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
77
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
78
+ };
79
+ };
80
+ };
81
+ readonly media?: string | undefined;
82
+ }[];
83
+ }, Schema.Struct<{
84
+ blocks: Schema.Array$<Schema.Schema<any, any, never>>;
85
+ layouts: Schema.refine<readonly {
86
+ readonly name: string;
87
+ readonly layout: {
88
+ readonly style?: string | undefined;
89
+ readonly columns: number;
90
+ readonly gap?: number | undefined;
91
+ readonly rows?: number | undefined;
92
+ readonly placements: {
93
+ readonly [x: string]: {
94
+ readonly area: readonly [readonly [number, number], readonly [number, number]];
95
+ readonly v?: "stretch" | "center" | "end" | "start" | undefined;
96
+ readonly h?: "stretch" | "center" | "end" | "start" | undefined;
97
+ };
98
+ };
99
+ };
100
+ readonly media?: string | undefined;
101
+ }[], Schema.Array$<Schema.Struct<{
102
+ name: Schema.SchemaClass<string, string, never>;
103
+ media: Schema.optional<Schema.Schema<string, string, never>>;
104
+ layout: Schema.Struct<{
105
+ columns: Schema.refine<number, Schema.filter<typeof Schema.Number>>;
106
+ rows: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
107
+ gap: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
108
+ style: Schema.optional<Schema.SchemaClass<string, string, never>>;
109
+ placements: Schema.Record$<typeof Schema.String, Schema.Struct<{
110
+ area: Schema.refine<readonly [readonly [number, number], readonly [number, number]], Schema.Tuple2<Schema.Tuple2<Schema.filter<Schema.filter<typeof Schema.Number>>, Schema.filter<Schema.filter<typeof Schema.Number>>>, Schema.Tuple2<Schema.filter<Schema.filter<typeof Schema.Number>>, Schema.filter<Schema.filter<typeof Schema.Number>>>>>;
111
+ h: Schema.optional<Schema.Literal<["start", "center", "end", "stretch"]>>;
112
+ v: Schema.optional<Schema.Literal<["start", "center", "end", "stretch"]>>;
113
+ }>>;
114
+ }>;
115
+ }>>>;
116
+ }>>;
117
+ }>;
118
+ export declare function defaultBody(): Record<string, unknown>;
119
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
120
+ export type BadgeValue = NonNullable<Value['badge']>;
121
+ export type BadgeVariant = (typeof BADGE_VARIANTS)[number];
@@ -0,0 +1,100 @@
1
+ import { Schema } from "effect";
2
+ import { Expression, LocaleMarkdown } from "../../../../../share/expression.js";
3
+ import { Slot, defaultSlot } from "../../../../../share/layout.js";
4
+ export { getStructFieldDescription, getStructFieldTitle } from "../../../../table/utils/schema-meta.js";
5
+ export const type = "com.shwfed.block.card";
6
+ export const compatibilityDate = "2026-06-02";
7
+ export const metadata = {
8
+ name: "\u5361\u7247",
9
+ icon: "fluent:card-ui-20-regular",
10
+ w: { initial: 12, min: 4, max: Infinity },
11
+ h: { initial: 6, min: 4, max: Infinity }
12
+ };
13
+ function registerJson(env) {
14
+ env.registerVariable("json", "optional<dyn>", {
15
+ label: "HTTP \u54CD\u5E94\u4F53",
16
+ description: "HTTP \u54CD\u5E94\u4F53\uFF08\u914D\u7F6E\u4E86\u8BF7\u6C42\u65F6\u4E3A\u5DF2\u89E3\u6790 JSON\uFF0C\u5426\u5219\u4E3A none\uFF09"
17
+ });
18
+ }
19
+ export const BADGE_VARIANTS = ["default", "secondary", "destructive", "outline"];
20
+ export function badgeSchema(configure) {
21
+ const CelRequest = Expression({
22
+ configure,
23
+ resultType: "HttpRequest"
24
+ });
25
+ const Content = LocaleMarkdown({
26
+ configure: (env) => {
27
+ configure(env);
28
+ registerJson(env);
29
+ }
30
+ });
31
+ return Schema.Struct({
32
+ request: Schema.optional(CelRequest).annotations({
33
+ title: "\u8BF7\u6C42",
34
+ description: "\u53EF\u9009\u7684 HTTP \u8BF7\u6C42\u8868\u8FBE\u5F0F\uFF08\u8FD4\u56DE `HttpRequest`\uFF09\uFF1B\u672A\u914D\u7F6E\u65F6\u63D2\u503C\u4E2D\u7684 `json` \u4E3A none"
35
+ }),
36
+ content: Schema.optional(Content).annotations({
37
+ title: "\u5185\u5BB9",
38
+ description: "\u672C\u5730\u5316\u7684\u5185\u8054 Markdown\uFF0C\u652F\u6301 `{{ \u8868\u8FBE\u5F0F }}` CEL \u63D2\u503C\uFF0C\u53EF\u5F15\u7528 `json`\uFF1B\u7559\u7A7A\u5219\u4E0D\u663E\u793A\u5FBD\u7AE0"
39
+ }),
40
+ interval: Schema.optional(
41
+ Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
42
+ title: "\u8F6E\u8BE2\u95F4\u9694",
43
+ 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"
44
+ })
45
+ ),
46
+ dot: Schema.optional(Schema.Boolean.annotations({
47
+ title: "\u5706\u70B9",
48
+ description: "\u5F00\u542F\u540E\u5FBD\u7AE0\u6298\u53E0\u4E3A\u4E00\u4E2A\u5C0F\u5706\u70B9\uFF08\u4EC5\u4FDD\u7559\u53D8\u4F53\u989C\u8272\uFF0C\u4E0D\u5C55\u793A\u6587\u672C\uFF09"
49
+ })),
50
+ variant: Schema.optional(Schema.Literal(...BADGE_VARIANTS).annotations({
51
+ title: "\u6837\u5F0F\u53D8\u4F53",
52
+ description: "\u5FBD\u7AE0\u5916\u89C2\uFF1A`default` | `secondary` | `destructive` | `outline`\uFF1B\u7559\u7A7A\u7B49\u540C `default`"
53
+ }))
54
+ }).annotations({
55
+ title: "\u5FBD\u7AE0",
56
+ description: "\u5361\u7247\u53F3\u4E0A\u89D2\u5FBD\u7AE0\uFF1B`\u5185\u5BB9` \u7559\u7A7A\u5219\u4E0D\u663E\u793A"
57
+ });
58
+ }
59
+ export function schema(configure, blockRef) {
60
+ const CardSlot = Slot(blockRef, configure);
61
+ const CelStyle = Expression({
62
+ configure,
63
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("map") || t.startsWith("optional")
64
+ });
65
+ const CelUrl = Expression({
66
+ configure,
67
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("optional")
68
+ });
69
+ return Schema.Struct({
70
+ id: Schema.UUID.annotations({ description: "\u5757\u552F\u4E00\u6807\u8BC6" }),
71
+ type: Schema.tag(type),
72
+ compatibilityDate: Schema.tag(compatibilityDate),
73
+ displayName: Schema.optional(Schema.String.annotations({
74
+ title: "\u5185\u90E8\u540D\u79F0",
75
+ 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"
76
+ })),
77
+ style: Schema.optional(CelStyle).annotations({
78
+ title: "\u6837\u5F0F",
79
+ description: "\u8FD4\u56DE\u5E94\u7528\u5728\u5361\u7247\u6839\u5143\u7D20\u4E0A\u7684\u6837\u5F0F\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8FD4\u56DE CSS \u5B57\u7B26\u4E32\uFF08\u5982 `'padding: 2rem'`\uFF09\u6216\u6837\u5F0F\u5BF9\u8C61\uFF08\u5982 `{'padding': '2rem'}`\uFF09\uFF1B\u7559\u7A7A\u5219\u4E0D\u8BBE\u989D\u5916\u6837\u5F0F"
80
+ }),
81
+ url: Schema.optional(CelUrl).annotations({
82
+ title: "\u94FE\u63A5",
83
+ description: "\u8FD4\u56DE `string` \u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u914D\u7F6E\u540E\u70B9\u51FB\u5361\u7247\u7A7A\u767D\u5904\u5C06\u5728\u5F53\u524D\u6807\u7B7E\u9875\u6253\u5F00\u8BE5\u94FE\u63A5\u3002\u70B9\u51FB\u5361\u7247\u5185\u7684\u6309\u94AE\u3001\u94FE\u63A5\u7B49\u4EA4\u4E92\u5143\u7D20\u4E0D\u4F1A\u89E6\u53D1"
84
+ }),
85
+ badge: Schema.optional(badgeSchema(configure)).annotations({
86
+ title: "\u5FBD\u7AE0",
87
+ description: "\u5361\u7247\u53F3\u4E0A\u89D2\u5FBD\u7AE0\uFF1B\u7559\u7A7A\u5219\u4E0D\u663E\u793A"
88
+ }),
89
+ slot: CardSlot.annotations({
90
+ title: "\u5185\u5BB9",
91
+ description: "\u5361\u7247\u5185\u90E8\u7684\u5757\u4E0E\u5E03\u5C40"
92
+ })
93
+ }).annotations({
94
+ title: "\u5361\u7247\u5757",
95
+ description: "\u5E26\u53EF\u9009\u5FBD\u7AE0\u7684\u6837\u5F0F\u5316\u5BB9\u5668\uFF0C\u53EF\u653E\u5165\u4EFB\u610F\u5757\u4E0E\u5E03\u5C40\uFF1B\u652F\u6301\u4EFB\u610F\u5C42\u7EA7\u5D4C\u5957"
96
+ });
97
+ }
98
+ export function defaultBody() {
99
+ return { slot: defaultSlot() };
100
+ }
@@ -33,23 +33,15 @@ const EXTRAS = [
33
33
  { id: "general", label: "\u901A\u7528\u914D\u7F6E", icon: "fluent:settings-20-regular" }
34
34
  ];
35
35
  const selection = ref({ kind: "extras", id: "general" });
36
- function updateInitialData(value) {
37
- const next = { ...config.value };
38
- if (value.trim() === "") {
39
- const { initial: _omit, ...rest } = next;
40
- config.value = rest;
41
- } else {
42
- config.value = { ...next, initial: { ...next.initial, data: value } };
43
- }
44
- }
45
- function updateInitialRequest(value) {
46
- const current = config.value.initial;
47
- if (!current) return;
48
- if (value.trim() === "") {
49
- const { request: _omit, ...rest } = current;
50
- config.value = { ...config.value, initial: rest };
36
+ function setInitialField(key, value) {
37
+ const current = config.value.initial ?? {};
38
+ const { [key]: _omit, ...rest } = current;
39
+ const next = value.trim() === "" ? rest : { ...rest, [key]: value };
40
+ if (Object.keys(next).length === 0) {
41
+ const { initial: _drop, ...cfg } = config.value;
42
+ config.value = cfg;
51
43
  } else {
52
- config.value = { ...config.value, initial: { ...current, request: value } };
44
+ config.value = { ...config.value, initial: next };
53
45
  }
54
46
  }
55
47
  function updateReadonly(value) {
@@ -102,7 +94,7 @@ function updateStyle(value) {
102
94
  :extra-vars="{ json: { type: 'optional<dyn>', label: 'HTTP \u54CD\u5E94\u4F53', description: '\u300C\u8BF7\u6C42\u300D\u7684\u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u672A\u914D\u7F6E\u8BF7\u6C42\u65F6\u4E3A none' } }"
103
95
  multiline
104
96
  class="min-h-20"
105
- @update:model-value="updateInitialData"
97
+ @update:model-value="(v) => setInitialField('data', v)"
106
98
  />
107
99
  </Field>
108
100
 
@@ -122,7 +114,7 @@ function updateStyle(value) {
122
114
  placeholder="如 http.get('https://api.example.com/record/1')"
123
115
  result-type="HttpRequest"
124
116
  class="min-h-10"
125
- @update:model-value="updateInitialRequest"
117
+ @update:model-value="(v) => setInitialField('request', v)"
126
118
  />
127
119
  </Field>
128
120
 
@@ -50,9 +50,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
50
50
  readonly locale: "en" | "ja" | "ko";
51
51
  readonly message: string;
52
52
  }[]];
53
+ readonly successMessage?: string | undefined;
53
54
  readonly accessor: string;
54
55
  readonly sortKey?: string | undefined;
55
- readonly successMessage?: string | undefined;
56
56
  }) => any;
57
57
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
58
58
  "onUpdate:modelValue"?: ((value: {
@@ -102,9 +102,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
102
102
  readonly locale: "en" | "ja" | "ko";
103
103
  readonly message: string;
104
104
  }[]];
105
+ readonly successMessage?: string | undefined;
105
106
  readonly accessor: string;
106
107
  readonly sortKey?: string | undefined;
107
- readonly successMessage?: string | undefined;
108
108
  }) => any) | undefined;
109
109
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
110
110
  declare const _default: typeof __VLS_export;
@@ -50,9 +50,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
50
50
  readonly locale: "en" | "ja" | "ko";
51
51
  readonly message: string;
52
52
  }[]];
53
+ readonly successMessage?: string | undefined;
53
54
  readonly accessor: string;
54
55
  readonly sortKey?: string | undefined;
55
- readonly successMessage?: string | undefined;
56
56
  }) => any;
57
57
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
58
58
  "onUpdate:modelValue"?: ((value: {
@@ -102,9 +102,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
102
102
  readonly locale: "en" | "ja" | "ko";
103
103
  readonly message: string;
104
104
  }[]];
105
+ readonly successMessage?: string | undefined;
105
106
  readonly accessor: string;
106
107
  readonly sortKey?: string | undefined;
107
- readonly successMessage?: string | undefined;
108
108
  }) => any) | undefined;
109
109
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
110
110
  declare const _default: typeof __VLS_export;
@@ -64,9 +64,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
64
64
  readonly readonly?: string | undefined;
65
65
  readonly grow?: boolean | undefined;
66
66
  readonly enableSorting?: boolean | undefined;
67
+ readonly successMessage?: string | undefined;
67
68
  readonly accessor: string;
68
69
  readonly sortKey?: string | undefined;
69
- readonly successMessage?: string | undefined;
70
70
  }) => any;
71
71
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
72
72
  "onUpdate:modelValue"?: ((value: {
@@ -130,9 +130,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
130
130
  readonly readonly?: string | undefined;
131
131
  readonly grow?: boolean | undefined;
132
132
  readonly enableSorting?: boolean | undefined;
133
+ readonly successMessage?: string | undefined;
133
134
  readonly accessor: string;
134
135
  readonly sortKey?: string | undefined;
135
- readonly successMessage?: string | undefined;
136
136
  }) => any) | undefined;
137
137
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
138
138
  declare const _default: typeof __VLS_export;
@@ -64,9 +64,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
64
64
  readonly readonly?: string | undefined;
65
65
  readonly grow?: boolean | undefined;
66
66
  readonly enableSorting?: boolean | undefined;
67
+ readonly successMessage?: string | undefined;
67
68
  readonly accessor: string;
68
69
  readonly sortKey?: string | undefined;
69
- readonly successMessage?: string | undefined;
70
70
  }) => any;
71
71
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
72
72
  "onUpdate:modelValue"?: ((value: {
@@ -130,9 +130,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
130
130
  readonly readonly?: string | undefined;
131
131
  readonly grow?: boolean | undefined;
132
132
  readonly enableSorting?: boolean | undefined;
133
+ readonly successMessage?: string | undefined;
133
134
  readonly accessor: string;
134
135
  readonly sortKey?: string | undefined;
135
- readonly successMessage?: string | undefined;
136
136
  }) => any) | undefined;
137
137
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
138
138
  declare const _default: typeof __VLS_export;
@@ -50,9 +50,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
50
50
  readonly locale: "en" | "ja" | "ko";
51
51
  readonly message: string;
52
52
  }[]];
53
+ readonly successMessage?: string | undefined;
53
54
  readonly accessor: string;
54
55
  readonly sortKey?: string | undefined;
55
- readonly successMessage?: string | undefined;
56
56
  }) => any;
57
57
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
58
58
  "onUpdate:modelValue"?: ((value: {
@@ -102,9 +102,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
102
102
  readonly locale: "en" | "ja" | "ko";
103
103
  readonly message: string;
104
104
  }[]];
105
+ readonly successMessage?: string | undefined;
105
106
  readonly accessor: string;
106
107
  readonly sortKey?: string | undefined;
107
- readonly successMessage?: string | undefined;
108
108
  }) => any) | undefined;
109
109
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
110
110
  declare const _default: typeof __VLS_export;