@shwfed/config 2.7.2 → 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.
- package/dist/mcp.mjs +1095 -1019
- package/dist/module.json +1 -1
- package/dist/preview/assets/{badge-CJpxWUkB.js → badge-CV7CwAKY.js} +1 -1
- package/dist/preview/assets/{config-BRiILJ2a.js → config-5JFmp62X.js} +1 -1
- package/dist/preview/assets/{config-CbMKku2N.js → config-BkS5uufU.js} +1 -1
- package/dist/preview/assets/{config-D8tXo17l.js → config-Bo4cd_u5.js} +1 -1
- package/dist/preview/assets/{config-QHRydAV_.js → config-BoVPp04e.js} +1 -1
- package/dist/preview/assets/{config-dtgP-3mj.js → config-CMcqX_mc.js} +1 -1
- package/dist/preview/assets/{config-OQtpit00.js → config-Ck5_8YaL.js} +1 -1
- package/dist/preview/assets/{config-DtCRvYa9.js → config-DE97oObU.js} +1 -1
- package/dist/preview/assets/{config-B-uvT_pb.js → config-L72ON8PT.js} +1 -1
- package/dist/preview/assets/{config-D9pA2oC8.js → config-dk7L4924.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-Dp8O3US_.js → definition.vue_vue_type_script_setup_true_lang-Cr7UNELp.js} +1 -1
- package/dist/preview/assets/index-C2PrdVxC.css +1 -0
- package/dist/preview/assets/{index-BBJQYeyQ.js → index-CTZy_nrf.js} +167 -167
- package/dist/preview/assets/index-CY99yvOi.js +1 -0
- package/dist/preview/assets/{index-BWNTkzpm.js → index-DumuGVME.js} +1 -1
- package/dist/preview/assets/{item-BpzTGOEt.js → item-BhBaPg4Z.js} +1 -1
- package/dist/preview/assets/{runtime-BDyVuoP3.js → runtime-BbGu9CHo.js} +1 -1
- package/dist/preview/assets/{runtime-C29fORZL.js → runtime-C6Pc6N3T.js} +1 -1
- package/dist/preview/assets/{runtime-DMsEFiBw.js → runtime-CILO8PDD.js} +1 -1
- package/dist/preview/assets/{runtime-By0VH4uC.js → runtime-CrNhb4dv.js} +1 -1
- package/dist/preview/assets/{runtime-DiTvLHpE.js → runtime-DZuxXJrv.js} +1 -1
- package/dist/preview/assets/{runtime-Busbr90M.js → runtime-DrxczhTW.js} +1 -1
- package/dist/preview/assets/{runtime-B5S6icpw.js → runtime-KTenCV-J.js} +1 -1
- package/dist/preview/assets/{runtime-DfP3qvGT.js → runtime-iR16bMIx.js} +1 -1
- package/dist/preview/assets/{runtime-BjB2wvFX.js → runtime-luMscNiE.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.vue +27 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.vue +18 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.d.ts +2 -1
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.js +10 -1
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.d.vue.ts +34 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.vue +153 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.vue.d.ts +34 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.d.vue.ts +34 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue +41 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue.d.ts +34 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.d.ts +33 -0
- package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.js +45 -0
- package/dist/runtime/components/config/config.vue +135 -22
- package/dist/runtime/components/config/index.d.vue.ts +4 -0
- package/dist/runtime/components/config/index.vue +26 -2
- package/dist/runtime/components/config/index.vue.d.ts +4 -0
- package/dist/runtime/components/config/schema.d.ts +20 -0
- package/dist/runtime/components/config/schema.js +15 -1
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +18 -18
- package/package.json +1 -1
- package/dist/preview/assets/index-ChitoGhE.js +0 -1
- package/dist/preview/assets/index-DFKLSxdT.css +0 -1
package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.d.vue.ts
ADDED
|
@@ -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>
|
package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue.d.ts
ADDED
|
@@ -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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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",
|
package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts
CHANGED
|
@@ -41,27 +41,27 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
41
41
|
} | undefined;
|
|
42
42
|
readonly format?: string | undefined;
|
|
43
43
|
readonly valueFormat?: string | undefined;
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
44
|
+
readonly presets?: readonly {
|
|
45
|
+
readonly label: readonly [{
|
|
46
46
|
readonly locale: "zh";
|
|
47
47
|
readonly message: string;
|
|
48
48
|
}, ...{
|
|
49
49
|
readonly locale: "en" | "ja" | "ko";
|
|
50
50
|
readonly message: string;
|
|
51
51
|
}[]];
|
|
52
|
-
readonly
|
|
53
|
-
readonly
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly value: string;
|
|
54
54
|
}[] | undefined;
|
|
55
|
-
readonly
|
|
56
|
-
readonly
|
|
55
|
+
readonly validations?: readonly {
|
|
56
|
+
readonly message: readonly [{
|
|
57
57
|
readonly locale: "zh";
|
|
58
58
|
readonly message: string;
|
|
59
59
|
}, ...{
|
|
60
60
|
readonly locale: "en" | "ja" | "ko";
|
|
61
61
|
readonly message: string;
|
|
62
62
|
}[]];
|
|
63
|
-
readonly
|
|
64
|
-
readonly
|
|
63
|
+
readonly warning?: boolean | undefined;
|
|
64
|
+
readonly when: string;
|
|
65
65
|
}[] | undefined;
|
|
66
66
|
}) => any;
|
|
67
67
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
@@ -103,27 +103,27 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
103
103
|
} | undefined;
|
|
104
104
|
readonly format?: string | undefined;
|
|
105
105
|
readonly valueFormat?: string | undefined;
|
|
106
|
-
readonly
|
|
107
|
-
readonly
|
|
106
|
+
readonly presets?: readonly {
|
|
107
|
+
readonly label: readonly [{
|
|
108
108
|
readonly locale: "zh";
|
|
109
109
|
readonly message: string;
|
|
110
110
|
}, ...{
|
|
111
111
|
readonly locale: "en" | "ja" | "ko";
|
|
112
112
|
readonly message: string;
|
|
113
113
|
}[]];
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
114
|
+
readonly id: string;
|
|
115
|
+
readonly value: string;
|
|
116
116
|
}[] | undefined;
|
|
117
|
-
readonly
|
|
118
|
-
readonly
|
|
117
|
+
readonly validations?: readonly {
|
|
118
|
+
readonly message: readonly [{
|
|
119
119
|
readonly locale: "zh";
|
|
120
120
|
readonly message: string;
|
|
121
121
|
}, ...{
|
|
122
122
|
readonly locale: "en" | "ja" | "ko";
|
|
123
123
|
readonly message: string;
|
|
124
124
|
}[]];
|
|
125
|
-
readonly
|
|
126
|
-
readonly
|
|
125
|
+
readonly warning?: boolean | undefined;
|
|
126
|
+
readonly when: string;
|
|
127
127
|
}[] | undefined;
|
|
128
128
|
}) => any) | undefined;
|
|
129
129
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|