@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,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,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
+ '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 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:block"?: ((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,41 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { Icon } from "@iconify/vue";
4
+ defineOptions({ name: "ShwfedBlockIconRuntime" });
5
+ const block = defineModel("block", { type: null, ...{ required: true } });
6
+ defineProps({
7
+ configure: { type: Function, required: false }
8
+ });
9
+ const DEFAULT_SIZE = 8;
10
+ const iconSize = computed(() => block.value.size ?? DEFAULT_SIZE);
11
+ const iconStyle = computed(() => {
12
+ const s = { fontSize: `calc(${iconSize.value} * 0.25rem)` };
13
+ if (block.value.color) s.color = block.value.color;
14
+ return s;
15
+ });
16
+ const circleStyle = computed(() => ({
17
+ padding: `calc(${iconSize.value} * 0.125rem)`,
18
+ backgroundColor: `color-mix(in srgb, ${block.value.color || "currentColor"} 20%, white)`
19
+ }));
20
+ </script>
21
+
22
+ <template>
23
+ <div class="flex h-full w-full items-center justify-center">
24
+ <div
25
+ v-if="block.circle"
26
+ class="flex items-center justify-center rounded-full"
27
+ :style="circleStyle"
28
+ >
29
+ <Icon
30
+ v-if="block.icon"
31
+ :icon="block.icon"
32
+ :style="iconStyle"
33
+ />
34
+ </div>
35
+ <Icon
36
+ v-else-if="block.icon"
37
+ :icon="block.icon"
38
+ :style="iconStyle"
39
+ />
40
+ </div>
41
+ </template>
@@ -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
+ '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 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:block"?: ((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,33 @@
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.icon";
7
+ export declare const compatibilityDate: "2026-06-02";
8
+ export declare const metadata: {
9
+ readonly name: "图标";
10
+ readonly icon: "fluent:emoji-20-regular";
11
+ readonly w: {
12
+ readonly initial: 4;
13
+ readonly min: 1;
14
+ readonly max: number;
15
+ };
16
+ readonly h: {
17
+ readonly initial: 4;
18
+ readonly min: 1;
19
+ readonly max: number;
20
+ };
21
+ };
22
+ export declare function schema(_configure: Configure, _blockRef?: AnySchema): Schema.Struct<{
23
+ id: Schema.refine<string, typeof Schema.String>;
24
+ type: Schema.tag<"com.shwfed.block.icon">;
25
+ compatibilityDate: Schema.tag<"2026-06-02">;
26
+ displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
27
+ icon: Schema.refine<string, typeof Schema.String>;
28
+ color: Schema.optional<Schema.SchemaClass<string, string, never>>;
29
+ size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
30
+ circle: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
31
+ }>;
32
+ export declare function defaultBody(): Record<string, unknown>;
33
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
@@ -0,0 +1,45 @@
1
+ import { Schema } from "effect";
2
+ export { getStructFieldDescription, getStructFieldTitle } from "../../../../table/utils/schema-meta.js";
3
+ export const type = "com.shwfed.block.icon";
4
+ export const compatibilityDate = "2026-06-02";
5
+ export const metadata = {
6
+ name: "\u56FE\u6807",
7
+ icon: "fluent:emoji-20-regular",
8
+ w: { initial: 4, min: 1, max: Infinity },
9
+ h: { initial: 4, min: 1, max: Infinity }
10
+ };
11
+ export function schema(_configure, _blockRef) {
12
+ return Schema.Struct({
13
+ id: Schema.UUID.annotations({ description: "\u5757\u552F\u4E00\u6807\u8BC6" }),
14
+ type: Schema.tag(type),
15
+ compatibilityDate: Schema.tag(compatibilityDate),
16
+ displayName: Schema.optional(Schema.String.annotations({
17
+ title: "\u5185\u90E8\u540D\u79F0",
18
+ 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"
19
+ })),
20
+ icon: Schema.String.pipe(Schema.minLength(1)).annotations({
21
+ title: "\u56FE\u6807",
22
+ description: "Iconify \u56FE\u6807\u6807\u8BC6\u7B26\uFF0C\u5982 `fluent:add-20-regular`\uFF1B\u53EF\u5728\u56FE\u6807\u6D4F\u89C8\u5668\u4E2D\u67E5\u627E"
23
+ }),
24
+ color: Schema.optional(Schema.String.annotations({
25
+ title: "\u989C\u8272",
26
+ description: "\u56FE\u6807\u989C\u8272\uFF08\u4EFB\u610F CSS \u989C\u8272\uFF0C\u5982 `#4f46e5`\uFF09\uFF1B\u7559\u7A7A\u5219\u7EE7\u627F\u6587\u672C\u989C\u8272\u3002\u5F00\u542F\u5706\u73AF\u65F6\u5706\u73AF\u80CC\u666F\u4E3A\u8BE5\u989C\u8272\u4E0E\u767D\u8272\u6309 2:8 \u6DF7\u5408"
27
+ })),
28
+ size: Schema.optional(
29
+ Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
30
+ title: "\u5927\u5C0F",
31
+ description: "\u56FE\u6807\u5C3A\u5BF8\uFF0C\u5355\u4F4D\u4E3A `0.25rem`\uFF08\u540C Tailwind \u95F4\u8DDD\u523B\u5EA6\uFF0C\u5B9E\u9645\u5C3A\u5BF8\u4E3A `calc(n * 0.25rem)`\uFF09\uFF0C\u6B63\u6574\u6570\uFF1B\u7559\u7A7A\u5219\u4F7F\u7528\u9ED8\u8BA4 8\uFF08\u5373 `2rem`\uFF09"
32
+ })
33
+ ),
34
+ circle: Schema.optional(Schema.Boolean.annotations({
35
+ title: "\u5706\u73AF",
36
+ description: "\u5F00\u542F\u540E\u5C06\u56FE\u6807\u5305\u88F9\u5728\u4E00\u4E2A\u5706\u5F62\u80CC\u666F\u4E2D\uFF08\u80CC\u666F\u8272\u4E3A\u56FE\u6807\u989C\u8272\u4E0E\u767D\u8272\u6309 2:8 \u6DF7\u5408\uFF09"
37
+ }))
38
+ }).annotations({
39
+ title: "\u56FE\u6807\u5757",
40
+ description: "\u6E32\u67D3\u5355\u4E2A Iconify \u56FE\u6807\u4F5C\u4E3A\u9875\u9762\u5757"
41
+ });
42
+ }
43
+ export function defaultBody() {
44
+ return { icon: "" };
45
+ }
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, provide, toRef, useTemplateRef } from "vue";
2
+ import { computed, provide, ref, toRef, useTemplateRef } from "vue";
3
3
  import { Icon } from "@iconify/vue";
4
4
  import { toast } from "vue-sonner";
5
5
  import { readClip, reidFragment, writeClip } from "../../share/clipboard";
@@ -7,12 +7,54 @@ import BlockLayoutEditor from "../block-layout-editor/index.vue";
7
7
  import LayoutsSidebar from "../block-layout-editor/sidebar.vue";
8
8
  import LayoutMetaStrip from "../block-layout-editor/meta-strip.vue";
9
9
  import { Button } from "../ui/button";
10
+ import { ExpressionEditor } from "../ui/expression-editor";
11
+ import { Field, FieldLabel } from "../ui/field";
12
+ import { Locale as LocaleField } from "../ui/locale";
13
+ import { Markdown } from "../ui/markdown";
10
14
  import { ScrollArea } from "../ui/scroll-area";
15
+ import { Separator } from "../ui/separator";
11
16
  import { BREADCRUMB_EXTENSION_KEY } from "./breadcrumb-extension";
17
+ import { PageConfig, getStructFieldDescription, getStructFieldTitle } from "./schema";
12
18
  defineOptions({ name: "ShwfedConfigConfig" });
13
19
  const props = defineProps({
14
20
  state: { type: Object, required: true }
15
21
  });
22
+ const viewMode = ref("content");
23
+ function selectGeneral() {
24
+ viewMode.value = "general";
25
+ }
26
+ function selectLayout(index) {
27
+ activeLayoutIndex.value = index;
28
+ viewMode.value = "content";
29
+ }
30
+ const pageSchema = PageConfig(() => {
31
+ });
32
+ const titleTitle = getStructFieldTitle(pageSchema, "title") ?? "\u6807\u9898";
33
+ const titleDescription = getStructFieldDescription(pageSchema, "title");
34
+ const styleTitle = getStructFieldTitle(pageSchema, "style") ?? "\u6837\u5F0F";
35
+ const styleDescription = getStructFieldDescription(pageSchema, "style");
36
+ function isLocaleBlank(v) {
37
+ return !v || v.every((item) => item.message.trim().length === 0);
38
+ }
39
+ const pageTitle = computed({
40
+ get: () => props.state.draft.value.title,
41
+ set: (v) => {
42
+ props.state.draft.value = {
43
+ ...props.state.draft.value,
44
+ title: isLocaleBlank(v) ? void 0 : v
45
+ };
46
+ }
47
+ });
48
+ const pageStyle = computed({
49
+ get: () => props.state.draft.value.style ?? "",
50
+ set: (v) => {
51
+ const trimmed = v.trim();
52
+ props.state.draft.value = {
53
+ ...props.state.draft.value,
54
+ style: trimmed.length > 0 ? v : void 0
55
+ };
56
+ }
57
+ });
16
58
  const layouts = computed({
17
59
  get: () => props.state.layouts.value,
18
60
  set: (next) => {
@@ -99,11 +141,27 @@ function findBlockMeta(type, compatibilityDate) {
99
141
  class="flex gap-2 min-h-128"
100
142
  >
101
143
  <div class="flex w-64 shrink-0 flex-col">
144
+ <div
145
+ class="row pl-2"
146
+ :class="viewMode === 'general' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
147
+ @click="selectGeneral()"
148
+ >
149
+ <Icon
150
+ icon="fluent:settings-20-regular"
151
+ class="size-4 shrink-0"
152
+ />
153
+ <span class="flex-1 truncate">通用配置</span>
154
+ </div>
155
+
156
+ <Separator class="my-2" />
157
+
102
158
  <ScrollArea class="flex-1">
103
159
  <LayoutsSidebar
104
160
  ref="sidebarRef"
105
161
  v-model="layouts"
106
162
  v-model:active-index="activeLayoutIndex"
163
+ :active="viewMode !== 'general'"
164
+ @select="selectLayout"
107
165
  />
108
166
  </ScrollArea>
109
167
  <Button
@@ -120,29 +178,80 @@ function findBlockMeta(type, compatibilityDate) {
120
178
  </div>
121
179
 
122
180
  <div class="flex flex-1 flex-col gap-2">
123
- <LayoutMetaStrip
124
- v-model="layouts"
125
- :index="activeLayoutIndex"
126
- />
127
- <div class="flex-1">
128
- <BlockLayoutEditor
181
+ <!-- Page-level general settings. -->
182
+ <template v-if="viewMode === 'general'">
183
+ <Field orientation="vertical">
184
+ <FieldLabel class="text-xs text-zinc-500">
185
+ <template
186
+ v-if="titleDescription"
187
+ #tooltip
188
+ >
189
+ <Markdown
190
+ :source="titleDescription"
191
+ block
192
+ class="prose prose-sm prose-zinc"
193
+ />
194
+ </template>
195
+ {{ titleTitle }}
196
+ </FieldLabel>
197
+ <LocaleField
198
+ :model-value="pageTitle"
199
+ translate-hint="page tab title"
200
+ @update:model-value="(v) => {
201
+ pageTitle = v;
202
+ }"
203
+ />
204
+ </Field>
205
+
206
+ <Field orientation="vertical">
207
+ <FieldLabel class="text-xs text-zinc-500">
208
+ <template
209
+ v-if="styleDescription"
210
+ #tooltip
211
+ >
212
+ <Markdown
213
+ :source="styleDescription"
214
+ block
215
+ class="prose prose-sm prose-zinc"
216
+ />
217
+ </template>
218
+ {{ styleTitle }}
219
+ </FieldLabel>
220
+ <ExpressionEditor
221
+ v-model="pageStyle"
222
+ placeholder="返回 CSS 字符串或样式对象的表达式,如 'padding: 2rem'"
223
+ multiline
224
+ class="min-h-16"
225
+ />
226
+ </Field>
227
+ </template>
228
+
229
+ <!-- Per-layout meta + canvas. -->
230
+ <template v-else>
231
+ <LayoutMetaStrip
129
232
  v-model="layouts"
130
- v-model:active-index="activeLayoutIndex"
131
- v-model:selected-item-ids="selectedBlockIds"
132
- :items="blocks"
133
- :find-entry="findBlockMeta"
134
- :get-item-label="getBlockLabel"
135
- :picker-entries="pickerEntries"
136
- :can-delete="true"
137
- item-noun="块"
138
- @add-new="addBlock"
139
- @drill-down="onDrillDown"
140
- @delete-item="(id) => props.state.removeBlock(id)"
141
- @delete-items="(ids) => props.state.removeBlocks(ids)"
142
- @copy-items="copyBlocks"
143
- @paste="pasteBlocks"
233
+ :index="activeLayoutIndex"
144
234
  />
145
- </div>
235
+ <div class="flex-1">
236
+ <BlockLayoutEditor
237
+ v-model="layouts"
238
+ v-model:active-index="activeLayoutIndex"
239
+ v-model:selected-item-ids="selectedBlockIds"
240
+ :items="blocks"
241
+ :find-entry="findBlockMeta"
242
+ :get-item-label="getBlockLabel"
243
+ :picker-entries="pickerEntries"
244
+ :can-delete="true"
245
+ item-noun="块"
246
+ @add-new="addBlock"
247
+ @drill-down="onDrillDown"
248
+ @delete-item="(id) => props.state.removeBlock(id)"
249
+ @delete-items="(ids) => props.state.removeBlocks(ids)"
250
+ @copy-items="copyBlocks"
251
+ @paste="pasteBlocks"
252
+ />
253
+ </div>
254
+ </template>
146
255
  </div>
147
256
  </div>
148
257
 
@@ -172,3 +281,7 @@ function findBlockMeta(type, compatibilityDate) {
172
281
  </div>
173
282
  </div>
174
283
  </template>
284
+
285
+ <style scoped>
286
+ .row{align-items:center;border-radius:.25rem;cursor:pointer;display:flex;font-size:.875rem;gap:.375rem;padding-block:.375rem;padding-left:.5rem;padding-right:.5rem;position:relative;transition:background-color .1s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}
287
+ </style>
@@ -11,6 +11,8 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
12
  "update:config": (value: Readonly<{
13
13
  kind: "shwfed.component.page";
14
+ title?: import("../../share/locale.js").LocaleValue;
15
+ style?: string;
14
16
  slot: Readonly<{
15
17
  blocks: ReadonlyArray<import("./schema.js").BlockValue>;
16
18
  layouts: readonly Readonly<{
@@ -23,6 +25,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
23
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
24
26
  "onUpdate:config"?: ((value: Readonly<{
25
27
  kind: "shwfed.component.page";
28
+ title?: import("../../share/locale.js").LocaleValue;
29
+ style?: string;
26
30
  slot: Readonly<{
27
31
  blocks: ReadonlyArray<import("./schema.js").BlockValue>;
28
32
  layouts: readonly Readonly<{
@@ -1,6 +1,11 @@
1
1
  <script setup>
2
2
  import { computed, ref, watch } from "vue";
3
- import { injectCELContext } from "../../utils/cel-context";
3
+ import { Effect } from "effect";
4
+ import { useI18n } from "vue-i18n";
5
+ import { useHead } from "#app";
6
+ import { getLocalizedText } from "../../share/locale";
7
+ import { cel } from "../../utils/cel";
8
+ import { celBindings, injectCELContext } from "../../utils/cel-context";
4
9
  import SlotRenderer from "../../share/slot-renderer.vue";
5
10
  import ShwfedModal from "../modal.vue";
6
11
  import EditorBody from "./config.vue";
@@ -52,12 +57,31 @@ function onGridClick(event) {
52
57
  function updateSlot(next) {
53
58
  config.value = { ...config.value, slot: next };
54
59
  }
60
+ const pageStyle = computed(() => {
61
+ const expression = config.value.style;
62
+ if (!expression) return void 0;
63
+ try {
64
+ const r = Effect.runSync(cel(expression, celBindings(inheritedCEL)));
65
+ if (r === null || r === void 0) return void 0;
66
+ if (typeof r === "string") return r;
67
+ if (typeof r === "object") return r;
68
+ return String(r);
69
+ } catch {
70
+ return void 0;
71
+ }
72
+ });
73
+ const { locale } = useI18n({ useScope: "global", inheritLocale: true });
74
+ useHead(() => {
75
+ const title = getLocalizedText(config.value.title, locale.value);
76
+ return title ? { title } : {};
77
+ });
55
78
  </script>
56
79
 
57
80
  <template>
58
81
  <ClientOnly>
59
82
  <div
60
- class="contents"
83
+ :class="pageStyle ? '' : 'contents'"
84
+ :style="pageStyle"
61
85
  @click.capture="onGridClick"
62
86
  >
63
87
  <SlotRenderer
@@ -11,6 +11,8 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
12
  "update:config": (value: Readonly<{
13
13
  kind: "shwfed.component.page";
14
+ title?: import("../../share/locale.js").LocaleValue;
15
+ style?: string;
14
16
  slot: Readonly<{
15
17
  blocks: ReadonlyArray<import("./schema.js").BlockValue>;
16
18
  layouts: readonly Readonly<{
@@ -23,6 +25,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
23
25
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
24
26
  "onUpdate:config"?: ((value: Readonly<{
25
27
  kind: "shwfed.component.page";
28
+ title?: import("../../share/locale.js").LocaleValue;
29
+ style?: string;
26
30
  slot: Readonly<{
27
31
  blocks: ReadonlyArray<import("./schema.js").BlockValue>;
28
32
  layouts: readonly Readonly<{
@@ -1,8 +1,18 @@
1
1
  import { Schema } from 'effect';
2
2
  import type { Environment } from '../../vendor/cel-js/lib/index.js';
3
+ import { type LocaleValue } from '../../share/locale.js';
4
+ export { getStructFieldDescription, getStructFieldTitle } from '../table/utils/schema-meta.js';
3
5
  declare const KIND = "shwfed.component.page";
4
6
  export declare function PageConfig(configure: (env: Environment) => void): Schema.Struct<{
5
7
  kind: Schema.tag<"shwfed.component.page">;
8
+ title: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
9
+ locale: Schema.Literal<["zh"]>;
10
+ message: Schema.SchemaClass<string, string, never>;
11
+ }>], [Schema.Struct<{
12
+ locale: Schema.Literal<["ja", "en", "ko"]>;
13
+ message: Schema.SchemaClass<string, string, never>;
14
+ }>]>>;
15
+ style: Schema.optional<Schema.Schema<string, string, never>>;
6
16
  slot: Schema.refine<{
7
17
  readonly blocks: readonly any[];
8
18
  readonly layouts: readonly {
@@ -65,6 +75,14 @@ export declare function PageConfig(configure: (env: Environment) => void): Schem
65
75
  */
66
76
  export declare function defaults(): Pick<PageConfigValue, 'slot'>;
67
77
  export declare function createPageConfig(body?: Partial<Omit<Schema.Schema.Type<ReturnType<typeof PageConfig>>, 'kind'>>): {
78
+ style?: string | undefined;
79
+ title?: readonly [{
80
+ readonly locale: "zh";
81
+ readonly message: string;
82
+ }, ...{
83
+ readonly locale: "en" | "ja" | "ko";
84
+ readonly message: string;
85
+ }[]] | undefined;
68
86
  slot: {
69
87
  readonly blocks: readonly any[];
70
88
  readonly layouts: readonly {
@@ -95,6 +113,8 @@ export type BlockValue = Readonly<{
95
113
  export type { LayoutSetValue } from '../../share/layout.js';
96
114
  export type PageConfigValue = Readonly<{
97
115
  kind: typeof KIND;
116
+ title?: LocaleValue;
117
+ style?: string;
98
118
  slot: Readonly<{
99
119
  blocks: ReadonlyArray<BlockValue>;
100
120
  layouts: ReadonlyArray<import('../../share/layout').LayoutSetValue>;
@@ -1,6 +1,8 @@
1
1
  import { Schema } from "effect";
2
- import { Slot, defaultSlot } from "../../share/layout.js";
2
+ import { Expression, Slot, defaultSlot } from "../../share/layout.js";
3
+ import { Locale } from "../../share/locale.js";
3
4
  import { blockRef } from "./utils/resolve.js";
5
+ export { getStructFieldDescription, getStructFieldTitle } from "../table/utils/schema-meta.js";
4
6
  const KIND = "shwfed.component.page";
5
7
  export function PageConfig(configure) {
6
8
  const Block = blockRef(configure).annotations({
@@ -8,8 +10,20 @@ export function PageConfig(configure) {
8
10
  description: "\u9875\u9762\u5757\uFF0C\u7531 `type` \u5B57\u6BB5\u533A\u5206\u7C7B\u578B"
9
11
  });
10
12
  const PageSlot = Slot(Block, configure);
13
+ const CelStyle = Expression({
14
+ configure,
15
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("map") || t.startsWith("optional")
16
+ });
11
17
  return Schema.Struct({
12
18
  kind: Schema.tag(KIND),
19
+ title: Schema.optional(Locale).annotations({
20
+ title: "\u6807\u9898",
21
+ description: "\u9875\u9762\u6807\u9898\uFF08\u5185\u8054\u672C\u5730\u5316\u6587\u672C\uFF0C\u65E0 Markdown\uFF09\uFF1B\u8BBE\u7F6E\u540E\u7528\u4E8E\u6D4F\u89C8\u5668\u6807\u7B7E\u9875\u6807\u9898\uFF0C\u6309\u5F53\u524D\u8BED\u8A00\u53D6\u5BF9\u5E94\u6587\u6848\uFF0C\u7559\u7A7A\u5219\u4E0D\u8BBE\u7F6E"
22
+ }),
23
+ style: Schema.optional(CelStyle).annotations({
24
+ title: "\u6837\u5F0F",
25
+ description: "\u8FD4\u56DE\u5E94\u7528\u5728\u9875\u9762\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"
26
+ }),
13
27
  slot: PageSlot
14
28
  }).annotations({
15
29
  title: "PageConfig",
@@ -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