@shwfed/config 2.7.1 → 2.7.3

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 (109) hide show
  1. package/dist/mcp.mjs +1205 -1018
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/badge-CV7CwAKY.js +1 -0
  4. package/dist/preview/assets/config-5JFmp62X.js +1 -0
  5. package/dist/preview/assets/config-BkS5uufU.js +1 -0
  6. package/dist/preview/assets/config-Bo4cd_u5.js +1 -0
  7. package/dist/preview/assets/config-BoVPp04e.js +1 -0
  8. package/dist/preview/assets/config-CMcqX_mc.js +1 -0
  9. package/dist/preview/assets/config-Ck5_8YaL.js +1 -0
  10. package/dist/preview/assets/config-DE97oObU.js +1 -0
  11. package/dist/preview/assets/config-L72ON8PT.js +1 -0
  12. package/dist/preview/assets/config-dk7L4924.js +1 -0
  13. package/dist/preview/assets/definition.vue_vue_type_script_setup_true_lang-Cr7UNELp.js +1 -0
  14. package/dist/preview/assets/index-C2PrdVxC.css +1 -0
  15. package/dist/preview/assets/{index-BGFrUxgg.js → index-CTZy_nrf.js} +189 -189
  16. package/dist/preview/assets/index-CY99yvOi.js +1 -0
  17. package/dist/preview/assets/{index-Bw16PZhL.js → index-DumuGVME.js} +1 -1
  18. package/dist/preview/assets/{item-aVe51Gy6.js → item-BhBaPg4Z.js} +1 -1
  19. package/dist/preview/assets/{runtime-CYGmRjmI.js → runtime-BbGu9CHo.js} +1 -1
  20. package/dist/preview/assets/{runtime-DYj-R8SZ.js → runtime-C6Pc6N3T.js} +1 -1
  21. package/dist/preview/assets/runtime-CILO8PDD.js +1 -0
  22. package/dist/preview/assets/runtime-CrNhb4dv.js +1 -0
  23. package/dist/preview/assets/runtime-DZuxXJrv.js +1 -0
  24. package/dist/preview/assets/{runtime-CXQuhSAX.js → runtime-DrxczhTW.js} +1 -1
  25. package/dist/preview/assets/{runtime-3rNI0KDH.js → runtime-KTenCV-J.js} +1 -1
  26. package/dist/preview/assets/runtime-iR16bMIx.js +1 -0
  27. package/dist/preview/assets/{runtime-CfVt6IWe.js → runtime-luMscNiE.js} +1 -1
  28. package/dist/preview/index.html +2 -2
  29. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.d.vue.ts +2 -0
  30. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.vue +27 -0
  31. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.vue.d.ts +2 -0
  32. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.d.vue.ts +2 -0
  33. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.vue +18 -0
  34. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.vue.d.ts +2 -0
  35. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.d.ts +2 -1
  36. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.js +10 -1
  37. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.d.ts +1 -1
  38. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.js +1 -1
  39. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.d.vue.ts +7 -0
  40. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.vue +91 -0
  41. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.vue.d.ts +7 -0
  42. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.d.vue.ts +96 -0
  43. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue +522 -0
  44. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue.d.ts +96 -0
  45. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.d.vue.ts +96 -0
  46. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.vue +72 -0
  47. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.vue.d.ts +96 -0
  48. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.d.ts +121 -0
  49. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.js +100 -0
  50. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.d.vue.ts +34 -0
  51. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.vue +153 -0
  52. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.vue.d.ts +34 -0
  53. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.d.vue.ts +34 -0
  54. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue +41 -0
  55. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue.d.ts +34 -0
  56. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.d.ts +33 -0
  57. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.js +45 -0
  58. package/dist/runtime/components/config/config.vue +135 -22
  59. package/dist/runtime/components/config/index.d.vue.ts +4 -0
  60. package/dist/runtime/components/config/index.vue +26 -2
  61. package/dist/runtime/components/config/index.vue.d.ts +4 -0
  62. package/dist/runtime/components/config/schema.d.ts +20 -0
  63. package/dist/runtime/components/config/schema.js +15 -1
  64. package/dist/runtime/components/form/config.vue +10 -18
  65. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts +16 -16
  66. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue.d.ts +16 -16
  67. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
  68. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
  69. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +16 -16
  70. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +16 -16
  71. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +18 -18
  72. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +18 -18
  73. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +16 -16
  74. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +16 -16
  75. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +18 -18
  76. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +18 -18
  77. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  78. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  79. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  80. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  81. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  82. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  83. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  84. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  85. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  86. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  87. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  88. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  89. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  90. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  91. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  92. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  93. package/package.json +1 -1
  94. package/dist/preview/assets/config-B5FFtD0s.js +0 -1
  95. package/dist/preview/assets/config-BpWP2vu_.js +0 -1
  96. package/dist/preview/assets/config-C2OqUTNd.js +0 -1
  97. package/dist/preview/assets/config-D7cjMBeK.js +0 -1
  98. package/dist/preview/assets/config-DhORWTZC.js +0 -1
  99. package/dist/preview/assets/config-DuuYvFG_.js +0 -1
  100. package/dist/preview/assets/config-dpwN2-UY.js +0 -1
  101. package/dist/preview/assets/config-eP0EblYK.js +0 -1
  102. package/dist/preview/assets/config-hs_pZ5MM.js +0 -1
  103. package/dist/preview/assets/definition.vue_vue_type_script_setup_true_lang-B8-Uydoy.js +0 -1
  104. package/dist/preview/assets/index-BoGW90Pq.css +0 -1
  105. package/dist/preview/assets/index-CG261V86.js +0 -1
  106. package/dist/preview/assets/runtime-BOn8EwHL.js +0 -1
  107. package/dist/preview/assets/runtime-Bwr-rb58.js +0 -1
  108. package/dist/preview/assets/runtime-Ca79Fs6I.js +0 -1
  109. 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
+ }
@@ -0,0 +1,34 @@
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
+ modelValue: 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:modelValue": (value: {
12
+ readonly size?: number | undefined;
13
+ readonly type: "com.shwfed.block.icon";
14
+ readonly id: string;
15
+ readonly icon: string;
16
+ readonly color?: string | undefined;
17
+ readonly circle?: boolean | undefined;
18
+ readonly displayName?: string | undefined;
19
+ readonly compatibilityDate: "2026-06-02";
20
+ }) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: {
23
+ readonly size?: number | undefined;
24
+ readonly type: "com.shwfed.block.icon";
25
+ readonly id: string;
26
+ readonly icon: string;
27
+ readonly color?: string | undefined;
28
+ readonly circle?: boolean | undefined;
29
+ readonly displayName?: string | undefined;
30
+ readonly compatibilityDate: "2026-06-02";
31
+ }) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
@@ -0,0 +1,153 @@
1
+ <script setup>
2
+ import { Schema } from "effect";
3
+ import { ColorPicker } from "../../../../ui/color-picker";
4
+ import { Field, FieldLabel } from "../../../../ui/field";
5
+ import { IconPicker } from "../../../../ui/icon-picker";
6
+ import { InputGroup, InputGroupInput, InputGroupNumberField } from "../../../../ui/input-group";
7
+ import { Markdown } from "../../../../ui/markdown";
8
+ import { Switch } from "../../../../ui/switch";
9
+ import {
10
+ getStructFieldDescription,
11
+ getStructFieldTitle,
12
+ schema
13
+ } from "./schema";
14
+ defineOptions({ name: "ShwfedBlockIconConfig" });
15
+ const block = defineModel({ type: null, ...{ required: true } });
16
+ defineProps({
17
+ configure: { type: Function, required: false }
18
+ });
19
+ const blockSchema = schema(() => {
20
+ }, Schema.Any);
21
+ const fieldTitle = (f) => getStructFieldTitle(blockSchema, f) ?? f;
22
+ const fieldDescription = (f) => getStructFieldDescription(blockSchema, f);
23
+ function setDisplayName(v) {
24
+ const s = String(v ?? "");
25
+ block.value = { ...block.value, displayName: s.length > 0 ? s : void 0 };
26
+ }
27
+ function setIcon(v) {
28
+ block.value = { ...block.value, icon: v };
29
+ }
30
+ function setColor(v) {
31
+ block.value = { ...block.value, color: v.trim().length > 0 ? v : void 0 };
32
+ }
33
+ function setSize(v) {
34
+ block.value = { ...block.value, size: typeof v === "number" && v > 0 ? Math.round(v) : void 0 };
35
+ }
36
+ function setCircle(v) {
37
+ block.value = { ...block.value, circle: v ? true : void 0 };
38
+ }
39
+ </script>
40
+
41
+ <template>
42
+ <div class="flex flex-col gap-3">
43
+ <Field orientation="vertical">
44
+ <FieldLabel class="text-xs text-zinc-500">
45
+ <template
46
+ v-if="fieldDescription('displayName')"
47
+ #tooltip
48
+ >
49
+ <Markdown
50
+ :source="fieldDescription('displayName')"
51
+ block
52
+ class="prose prose-sm prose-zinc"
53
+ />
54
+ </template>
55
+ {{ fieldTitle("displayName") }}
56
+ </FieldLabel>
57
+ <InputGroup>
58
+ <InputGroupInput
59
+ :model-value="block.displayName ?? ''"
60
+ placeholder="例:状态图标"
61
+ @update:model-value="setDisplayName"
62
+ />
63
+ </InputGroup>
64
+ </Field>
65
+
66
+ <Field orientation="vertical">
67
+ <FieldLabel class="text-xs text-zinc-500">
68
+ <template
69
+ v-if="fieldDescription('icon')"
70
+ #tooltip
71
+ >
72
+ <Markdown
73
+ :source="fieldDescription('icon')"
74
+ block
75
+ class="prose prose-sm prose-zinc"
76
+ />
77
+ </template>
78
+ {{ fieldTitle("icon") }}
79
+ </FieldLabel>
80
+ <IconPicker
81
+ :model-value="block.icon"
82
+ @update:model-value="setIcon"
83
+ />
84
+ </Field>
85
+
86
+ <div class="grid grid-cols-2 gap-3">
87
+ <Field orientation="vertical">
88
+ <FieldLabel class="text-xs text-zinc-500">
89
+ <template
90
+ v-if="fieldDescription('color')"
91
+ #tooltip
92
+ >
93
+ <Markdown
94
+ :source="fieldDescription('color')"
95
+ block
96
+ class="prose prose-sm prose-zinc"
97
+ />
98
+ </template>
99
+ {{ fieldTitle("color") }}
100
+ </FieldLabel>
101
+ <ColorPicker
102
+ :model-value="block.color ?? ''"
103
+ placeholder="#4f46e5"
104
+ @update:model-value="setColor"
105
+ />
106
+ </Field>
107
+
108
+ <Field orientation="vertical">
109
+ <FieldLabel class="text-xs text-zinc-500">
110
+ <template
111
+ v-if="fieldDescription('size')"
112
+ #tooltip
113
+ >
114
+ <Markdown
115
+ :source="fieldDescription('size')"
116
+ block
117
+ class="prose prose-sm prose-zinc"
118
+ />
119
+ </template>
120
+ {{ fieldTitle("size") }}
121
+ </FieldLabel>
122
+ <InputGroup>
123
+ <InputGroupNumberField
124
+ :model-value="block.size"
125
+ :min="1"
126
+ placeholder="8"
127
+ @update:model-value="(v) => setSize(v)"
128
+ />
129
+ </InputGroup>
130
+ </Field>
131
+ </div>
132
+
133
+ <Field orientation="horizontal">
134
+ <FieldLabel class="text-xs text-zinc-500">
135
+ <template
136
+ v-if="fieldDescription('circle')"
137
+ #tooltip
138
+ >
139
+ <Markdown
140
+ :source="fieldDescription('circle')"
141
+ block
142
+ class="prose prose-sm prose-zinc"
143
+ />
144
+ </template>
145
+ {{ fieldTitle("circle") }}
146
+ </FieldLabel>
147
+ <Switch
148
+ :model-value="block.circle ?? false"
149
+ @update:model-value="setCircle"
150
+ />
151
+ </Field>
152
+ </div>
153
+ </template>