@funhub/platform 0.1.134 → 0.1.136
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/biz.d.mts +12 -12
- package/dist/cli/init/create-client.mjs +2 -0
- package/dist/cli/init/create-sdk.mjs +2 -0
- package/dist/cli/init/shared/command.mjs +2 -0
- package/dist/cli/init/shared/constants.mjs +2 -0
- package/dist/cli/init/shared/create-project.mjs +3 -0
- package/dist/cli/init/shared/file.mjs +2 -0
- package/dist/cli/init/shared/package-manager.mjs +2 -0
- package/dist/cli/init/shared/prompts.mjs +2 -0
- package/dist/cli/init/shared/template.mjs +2 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +4 -0
- package/dist/components/biz/business/banner/index.d.mts +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/index.d.mts +2 -2
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +25 -3
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +20 -1
- package/dist/components/biz/business/banner/variants/basic-banner/material.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.d.mts +2 -1
- package/dist/components/biz/business/banner-carousel/material.d.mts +23 -1
- package/dist/components/biz/business/banner-carousel/material.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/schema.d.mts +28 -0
- package/dist/components/biz/business/banner-carousel/schema.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/server.d.mts +18 -0
- package/dist/components/biz/business/channel-list/client.d.mts +8 -0
- package/dist/components/biz/business/channel-list/material.d.mts +19 -1
- package/dist/components/biz/business/channel-list/material.mjs +1 -1
- package/dist/components/biz/business/channel-list/schema.d.mts +30 -0
- package/dist/components/biz/business/channel-list/schema.mjs +1 -1
- package/dist/components/biz/business/detail/shared/registry.d.mts +75 -2
- package/dist/components/biz/business/detail/shared/registry.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/client.d.mts +12 -2
- package/dist/components/biz/business/detail/video-detail-actions/index.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-actions/material.d.mts +13 -1
- package/dist/components/biz/business/detail/video-detail-actions/material.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/schema.d.mts +20 -1
- package/dist/components/biz/business/detail/video-detail-actions/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/server.d.mts +15 -2
- package/dist/components/biz/business/detail/video-detail-info/client.d.mts +14 -2
- package/dist/components/biz/business/detail/video-detail-info/index.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-info/material.d.mts +16 -1
- package/dist/components/biz/business/detail/video-detail-info/material.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info/schema.d.mts +22 -1
- package/dist/components/biz/business/detail/video-detail-info/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info/server.d.mts +15 -2
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/client.d.mts +14 -2
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/index.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/material.d.mts +16 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/material.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/schema.d.mts +22 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/server.d.mts +15 -2
- package/dist/components/biz/business/detail/video-detail-player/client.d.mts +13 -2
- package/dist/components/biz/business/detail/video-detail-player/index.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-player/material.d.mts +13 -1
- package/dist/components/biz/business/detail/video-detail-player/material.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-player/schema.d.mts +22 -1
- package/dist/components/biz/business/detail/video-detail-player/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-player/server.d.mts +10 -2
- package/dist/components/biz/business/detail/video-detail-recommend/client.d.mts +22 -2
- package/dist/components/biz/business/detail/video-detail-recommend/index.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-recommend/material.d.mts +40 -1
- package/dist/components/biz/business/detail/video-detail-recommend/material.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/schema.d.mts +42 -1
- package/dist/components/biz/business/detail/video-detail-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/server.d.mts +10 -2
- package/dist/components/biz/business/floating-ball/index.d.mts +2 -2
- package/dist/components/biz/business/floating-ball/material.d.mts +16 -1
- package/dist/components/biz/business/floating-ball/material.mjs +1 -1
- package/dist/components/biz/business/floating-ball/schema.d.mts +16 -3
- package/dist/components/biz/business/floating-ball/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/client.d.mts +13 -2
- package/dist/components/biz/business/header-search/header-avatar-icon/index.d.mts +4 -4
- package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +13 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/material.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/schema.d.mts +18 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-icon/server.d.mts +10 -2
- package/dist/components/biz/business/header-search/header-avatar-logo-search/client.d.mts +11 -2
- package/dist/components/biz/business/header-search/header-avatar-logo-search/index.d.mts +4 -4
- package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +16 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/material.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.d.mts +22 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/server.d.mts +10 -2
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/client.d.mts +11 -2
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/index.d.mts +4 -4
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +16 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/schema.d.mts +20 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/server.d.mts +10 -2
- package/dist/components/biz/business/header-search/header-logo-search/client.d.mts +13 -2
- package/dist/components/biz/business/header-search/header-logo-search/index.d.mts +4 -4
- package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +16 -1
- package/dist/components/biz/business/header-search/header-logo-search/material.mjs +1 -1
- package/dist/components/biz/business/header-search/header-logo-search/schema.d.mts +22 -1
- package/dist/components/biz/business/header-search/header-logo-search/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-logo-search/server.d.mts +10 -2
- package/dist/components/biz/business/header-search/header-search/client.d.mts +13 -2
- package/dist/components/biz/business/header-search/header-search/index.d.mts +4 -4
- package/dist/components/biz/business/header-search/header-search/material.d.mts +13 -1
- package/dist/components/biz/business/header-search/header-search/material.mjs +1 -1
- package/dist/components/biz/business/header-search/header-search/schema.d.mts +18 -1
- package/dist/components/biz/business/header-search/header-search/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-search/server.d.mts +10 -2
- package/dist/components/biz/business/home-recommend/home-recommend-grid/client.d.mts +2 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/index.d.mts +2 -2
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.d.mts +52 -3
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/material.d.mts +43 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/material.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/client.d.mts +2 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/index.d.mts +2 -2
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.d.mts +47 -3
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/material.d.mts +40 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/material.mjs +1 -1
- package/dist/components/biz/business/home-recommend/index.d.mts +2 -2
- package/dist/components/biz/business/image-text-recommend/client.d.mts +2 -1
- package/dist/components/biz/business/image-text-recommend/index.d.mts +2 -2
- package/dist/components/biz/business/image-text-recommend/material.d.mts +35 -1
- package/dist/components/biz/business/image-text-recommend/material.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/schema.d.mts +31 -1
- package/dist/components/biz/business/image-text-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/index.d.mts +11 -11
- package/dist/components/biz/business/large-feature-grid/material.d.mts +9 -1
- package/dist/components/biz/business/large-feature-grid/material.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/schema.mjs +1 -1
- package/dist/components/biz/business/marquee/client.d.mts +2 -1
- package/dist/components/biz/business/marquee/index.d.mts +2 -2
- package/dist/components/biz/business/marquee/material.d.mts +34 -1
- package/dist/components/biz/business/marquee/material.mjs +1 -1
- package/dist/components/biz/business/marquee/schema.d.mts +30 -1
- package/dist/components/biz/business/marquee/schema.mjs +1 -1
- package/dist/components/biz/business/profile/index.d.mts +1 -1
- package/dist/components/biz/business/profile/profile-header/material.d.mts +31 -2
- package/dist/components/biz/business/profile/profile-header/material.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/schema.d.mts +11 -3
- package/dist/components/biz/business/profile/profile-header/schema.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/index.d.mts +1 -1
- package/dist/components/biz/business/profile/profile-main/material.d.mts +13 -1
- package/dist/components/biz/business/profile/profile-main/material.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/schema.d.mts +11 -3
- package/dist/components/biz/business/profile/profile-main/schema.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.d.mts +2 -1
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.d.mts +2 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.d.mts +2 -1
- package/dist/components/biz/business/profile/profile-main/tabs/publish-tab/client.d.mts +2 -1
- package/dist/components/biz/business/search-history/client.d.mts +2 -1
- package/dist/components/biz/business/search-history/index.d.mts +2 -2
- package/dist/components/biz/business/search-history/material.d.mts +16 -1
- package/dist/components/biz/business/search-history/material.mjs +1 -1
- package/dist/components/biz/business/search-history/schema.d.mts +13 -1
- package/dist/components/biz/business/search-history/schema.mjs +1 -1
- package/dist/components/biz/business/search-input/index.d.mts +2 -2
- package/dist/components/biz/business/search-input/material.d.mts +13 -1
- package/dist/components/biz/business/search-input/material.mjs +1 -1
- package/dist/components/biz/business/search-input/schema.d.mts +11 -3
- package/dist/components/biz/business/search-input/schema.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/client.d.mts +12 -0
- package/dist/components/biz/business/shortcut-grid/material.d.mts +22 -1
- package/dist/components/biz/business/shortcut-grid/material.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/schema.d.mts +26 -0
- package/dist/components/biz/business/shortcut-grid/schema.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/server.d.mts +11 -0
- package/dist/components/biz/business/tab-bar/index.d.mts +2 -2
- package/dist/components/biz/business/tab-bar/material.d.mts +13 -1
- package/dist/components/biz/business/tab-bar/material.mjs +1 -1
- package/dist/components/biz/business/tab-bar/schema.d.mts +11 -3
- package/dist/components/biz/business/tab-bar/schema.mjs +1 -1
- package/dist/components/biz/business/text-recommend/client.d.mts +2 -1
- package/dist/components/biz/business/text-recommend/index.d.mts +2 -2
- package/dist/components/biz/business/text-recommend/material.d.mts +19 -1
- package/dist/components/biz/business/text-recommend/material.mjs +1 -1
- package/dist/components/biz/business/text-recommend/schema.d.mts +15 -1
- package/dist/components/biz/business/text-recommend/schema.mjs +1 -1
- package/dist/components/biz/example/button/index.d.mts +2 -2
- package/dist/components/biz/example/button/material.d.mts +24 -1
- package/dist/components/biz/example/button/material.mjs +1 -1
- package/dist/components/biz/example/button/schema.d.mts +30 -3
- package/dist/components/biz/example/button/schema.mjs +1 -1
- package/dist/components/biz/renderer/renderer.d.mts +2 -1
- package/dist/components/biz/renderer/renderer.mjs +1 -1
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/empty.d.mts +1 -1
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/materials.d.mts +10 -10
- package/dist/utils/schema/index.d.mts +1 -1
- package/dist/utils/schema/material.d.mts +1 -1
- package/dist/utils/schema/schema.d.mts +35 -0
- package/dist/utils.d.mts +3 -3
- package/package.json +8 -3
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../utils.mjs";
|
|
5
|
+
import { ButtonClient } from "./client.mjs";
|
|
6
|
+
import { Button } from "./server.mjs";
|
|
7
|
+
import * as zod from "zod";
|
|
8
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
|
+
|
|
2
10
|
//#region components/biz/example/button/material.d.ts
|
|
3
|
-
declare const exampleButtonMaterial:
|
|
11
|
+
declare const exampleButtonMaterial: DefineMaterialOption<typeof Button, typeof ButtonClient, zod.ZodObject<{
|
|
12
|
+
text: zod.ZodString & SchemaHasDefaultValue;
|
|
13
|
+
variant: zod.ZodType<"default" | "blue" | "red", unknown, zod_v4_core0.$ZodTypeInternals<"default" | "blue" | "red", unknown>> & SchemaHasDefaultValue;
|
|
14
|
+
disabled: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
|
|
15
|
+
loading: zod.ZodOptional<zod.ZodBoolean>;
|
|
16
|
+
items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
17
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
18
|
+
}, zod_v4_core0.$strip>>> & SchemaHasDefaultValue;
|
|
19
|
+
info: zod.ZodOptional<zod.ZodObject<{
|
|
20
|
+
readonly address: zod.ZodOptional<zod.ZodString>;
|
|
21
|
+
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
22
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
23
|
+
renderer: "renderer";
|
|
24
|
+
editor: "editor";
|
|
25
|
+
}>>;
|
|
26
|
+
}, zod_v4_core0.$strip>, "example-button", "行为组件">;
|
|
4
27
|
//#endregion
|
|
5
28
|
export { exampleButtonMaterial };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{
|
|
2
|
+
import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{ButtonClient as t}from"./client.mjs";import{buttonInspectorPropsSchema as n}from"./schema.mjs";import{Button as r}from"./server.mjs";const i=e({type:`example-button`,name:`按钮`,icon:`/icon/button.png`,category:`行为组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as exampleButtonMaterial};
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
|
|
2
|
-
import { InferSchemaProps } from "
|
|
2
|
+
import { InferSchemaProps, SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../utils.mjs";
|
|
4
|
+
import z$1 from "zod";
|
|
3
5
|
|
|
4
6
|
//#region components/biz/example/button/schema.d.ts
|
|
5
7
|
/**
|
|
6
8
|
* 定义可以被低代码右侧inspector编辑的props
|
|
7
9
|
*/
|
|
8
|
-
declare const buttonInspectorPropsSchema:
|
|
9
|
-
|
|
10
|
+
declare const buttonInspectorPropsSchema: z$1.ZodObject<{
|
|
11
|
+
text: z$1.ZodString & SchemaHasDefaultValue;
|
|
12
|
+
variant: z$1.ZodType<"default" | "blue" | "red", unknown, z$1.core.$ZodTypeInternals<"default" | "blue" | "red", unknown>> & SchemaHasDefaultValue;
|
|
13
|
+
disabled: z$1.ZodOptional<z$1.ZodBoolean> & SchemaHasDefaultValue;
|
|
14
|
+
loading: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
15
|
+
items: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
16
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
17
|
+
}, z$1.core.$strip>>> & SchemaHasDefaultValue;
|
|
18
|
+
info: z$1.ZodOptional<z$1.ZodObject<{
|
|
19
|
+
readonly address: z$1.ZodOptional<z$1.ZodString>;
|
|
20
|
+
}, z$1.core.$strip>> & SchemaHasDefaultValue;
|
|
21
|
+
mode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
22
|
+
renderer: "renderer";
|
|
23
|
+
editor: "editor";
|
|
24
|
+
}>>;
|
|
25
|
+
}, z$1.core.$strip>;
|
|
26
|
+
declare const buttonInspectorDefaultProps: {
|
|
27
|
+
text: string;
|
|
28
|
+
variant: "default" | "blue" | "red";
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
items: {
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
info: {
|
|
34
|
+
address?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
10
37
|
type ButtonInspectorProps<T extends object = object> = InferSchemaProps<typeof buttonInspectorPropsSchema> & T;
|
|
11
38
|
/**
|
|
12
39
|
* 基于ButtonInspectorProps再派生出组件真正的props(因为不是所有props都需要被编辑,比如说下面的children就不需要,但是button组件又需要传入children)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{
|
|
2
|
+
import{defineArrayItemPropSchema as e,defineCheckboxPropSchema as t,defineComponentPropsSchema as n,defineObjectPropSchema as r,defineSelectEnumPropSchema as i,defineSwitchPropSchema as a,defineTextPropSchema as o,getSchemaDefaultProps as s}from"../../../../utils/schema/schema.mjs";import{buttonVariantOptions as c}from"./variants.mjs";import l from"zod";const u=n({text:o({label:`文本`,defaultValue:`example button`}),variant:i(c,{label:`变体`,defaultValue:`red`}),disabled:t({label:`禁用`,defaultValue:!1,required:!1}),loading:a({label:`加载`,required:!1}),items:e(l.object({name:o({label:`名称`,required:!1})}),{required:!1,label:`items`,defaultValue:[{name:`string`}]}),info:r({address:o({label:`地址`,required:!1})},{label:`info`,required:!1,defaultValue:{address:`SHENZHEN`}})}),d=s(u);export{d as buttonInspectorDefaultProps,u as buttonInspectorPropsSchema};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
import { DefineMaterialOption } from "../../../utils/schema/material.mjs";
|
|
3
|
+
import "../../../utils.mjs";
|
|
2
4
|
import { ComponentType, ReactNode } from "react";
|
|
3
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
6
|
import z$1 from "zod";
|
|
5
|
-
import { DefineMaterialOption } from "create-funhub/sdk";
|
|
6
7
|
|
|
7
8
|
//#region components/biz/renderer/renderer.d.ts
|
|
8
9
|
type NodeInspectorProps = Record<string, unknown>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{cn as e}from"../../../utils/cn.mjs";import{
|
|
2
|
+
import{cn as e}from"../../../utils/cn.mjs";import{generateMaterialMap as t}from"../../../utils/schema/utils.mjs";import{materials_exports as n}from"../../../materials.mjs";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";function o(e,t){let n=t.props,r=e.propsSchema.safeParse(n);return r.success?{isValid:!0,props:r.data}:{isValid:!1,props:n,message:r.error?.message}}function s(e){let{document:t,materialMap:n,nodeId:c,ancestors:l,mode:u}=e;if(l.has(c))return null;let d=t.page.nodes[c];if(!d)return null;let f=new Set(l);f.add(c);let p=d.children.map(e=>i(s,{document:t,materialMap:n,nodeId:e,ancestors:f,mode:u},e)),m=n[d.type];if(!m)return p.length===0?null:i(r,{children:p});let h=o(m,d);return h.isValid?i(u===`client`?m.clientComponent:m.serverComponent,{...h.props,children:p}):a(`div`,{children:[`组件配置错误`,h.message]})}function c(r){let{className:a,document:o,materials:c,mode:l=`server`}=r,u=o.page.nodes[o.page.rootId];if(!u)return i(`div`,{className:e(`funhub-renderer`,a)});let d=t(c??Object.values(n));return i(`div`,{className:e(`funhub-renderer`,a),children:i(s,{document:o,materialMap:d,nodeId:u.id,ancestors:new Set,mode:l})})}export{c as Renderer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as o,validatePasswordPair as ee}from"../../../../utils/password-validator.mjs";import{Box as s}from"../../../ui/box.mjs";import{Drawer as c,DrawerContent as te,DrawerDescription as ne,DrawerHeader as re,DrawerTitle as l}from"../../../ui/drawer.mjs";import{Text as u}from"../../../ui/text.mjs";import d from"../../../ui/legacy/button.mjs";import{EyeIcon as f}from"../../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as p}from"../../../../assets/icons/eye-off-icon.mjs";import{HeaderNav as m}from"../../../common/header-nav/client.mjs";import h from"../../../ui/legacy/input.mjs";import{useEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as ie}from"next-intl";function ae(e){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function C(C){let w=ie(`components.pages.settings.components`),{open:oe,onOpenChange:T}=C,E=n(e=>e.userInfo),[D,O]=y([,,,,,,].fill(``)),[k,A]=y(0),j=v(null),M=D.
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as o,validatePasswordPair as ee}from"../../../../utils/password-validator.mjs";import{Box as s}from"../../../ui/box.mjs";import{Drawer as c,DrawerContent as te,DrawerDescription as ne,DrawerHeader as re,DrawerTitle as l}from"../../../ui/drawer.mjs";import{Text as u}from"../../../ui/text.mjs";import d from"../../../ui/legacy/button.mjs";import{EyeIcon as f}from"../../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as p}from"../../../../assets/icons/eye-off-icon.mjs";import{HeaderNav as m}from"../../../common/header-nav/client.mjs";import h from"../../../ui/legacy/input.mjs";import{useEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as ie}from"next-intl";function ae(e){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function C(C){let w=ie(`components.pages.settings.components`),{open:oe,onOpenChange:T}=C,E=n(e=>e.userInfo),[D,O]=y([,,,,,,].fill(``)),[k,A]=y(0),j=v(null),M=D.includes(``),[N,P]=y(``),F=v(null),[se,I]=y(60),[L,R]=y(!1),z=_(()=>ae(E?.email||``),[E?.email]);async function B(){if(L)return;let e=S.loading(w(`resetPasswordDrawer.sending`));try{let t=await i({user_id:E?.user_id});t.code===0?(S.success(w(`resetPasswordDrawer.codeSentSuccess`),{id:e}),R(!0),I(60),P(``)):S.error(t.message||w(`resetPasswordDrawer.sendFailed`),{id:e})}catch(t){console.error(t),S.error(w(`resetPasswordDrawer.sendFailed`),{id:e})}}function V(){W(e=>e===1?e:e+1)}async function H(){let e=S.loading(w(`resetPasswordDrawer.verifying`));try{P(``);let t=await a({user_id:E?.user_id,email_code:D.join(``)});t.code===0?(S.success(w(`resetPasswordDrawer.verifySuccess`),{id:e}),V()):(P(t.message||w(`resetPasswordDrawer.verifyFailed`)),S.error(t.message||w(`resetPasswordDrawer.verifyFailed`),{id:e}))}catch(t){console.error(t),P(w(`resetPasswordDrawer.verifyFailed`)),S.error(w(`resetPasswordDrawer.verifyFailed`),{id:e})}}g(()=>{if(L)return F.current=setInterval(()=>{I(e=>e<=1?(F.current&&clearInterval(F.current),R(!1),60):e-1)},1e3),()=>{F.current&&clearInterval(F.current)}},[L]);let[U,W]=y(0);g(()=>{U===0&&j.current?.focus()},[U]);let[G,K]=y({password:``,confirmPassword:``}),[q,J]=y(!1),[Y,ce]=y(!1),[X,le]=y(!1),Z=_(()=>ee(G.password,G.confirmPassword),[G.password,G.confirmPassword]),Q=_(()=>o(Z),[Z]),$=_(()=>q||G.password.length===0||G.confirmPassword.length===0||Z.type!==`none`,[q,G.password.length,G.confirmPassword.length,Z.type]);async function ue(){if($)return;let e=S.loading(w(`resetPasswordDrawer.submitting`));try{J(!0);let n=await r({user_id:E?.user_id,password:t(G.password)});n.code===0?(S.success(w(`resetPasswordDrawer.passwordResetSuccess`),{id:e}),K({password:``,confirmPassword:``}),O([,,,,,,].fill(``)),A(0),T(!1)):S.error(n.message||w(`resetPasswordDrawer.resetFailed`),{id:e})}catch(t){console.error(t),S.error(w(`resetPasswordDrawer.resetFailed`),{id:e})}finally{J(!1)}}function de(e){let t=e.target.value.replace(/\D/g,``);if(t.length===0)return;let n=[...D],r=t.split(``),i=k;for(let e of r){if(i>=6)break;n[i]=e,i+=1}O(n),A(Math.min(i,5)),N&&P(``)}function fe(e){if(e.key===`Backspace`){e.preventDefault();let t=[...D];t[k]?t[k]=``:k>0&&(t[k-1]=``,A(k-1)),O(t),N&&P(``);return}e.key===`ArrowLeft`&&k>0&&A(k-1),e.key===`ArrowRight`&&k<5&&A(k+1)}function pe(e){A(e),j.current?.focus()}let me=x(s,{className:`p-6`,children:[x(s,{className:`space-y-[12px]`,children:[b(u,{className:`text-[24px] leading-[32px] font-bold text-text1`,children:`请输入验证码`}),x(s,{className:`flex items-center justify-between gap-[8px]`,children:[x(u,{className:`min-w-0 flex-1 truncate text-[12px] leading-[16px] text-text2`,children:[w(`resetPasswordDrawer.boundEmailNotice`),b(u,{className:`dark:text-white text-white`,children:z}),w(`resetPasswordDrawer.verifyHint`)]}),b(e,{variant:`link`,disabled:L,onClick:B,className:`h-auto shrink-0 rounded-[10px] bg-line1 px-[10px] py-[4px] text-[10px] leading-[12px] text-text1 no-underline hover:no-underline disabled:opacity-60`,children:L?`${w(`resetPasswordDrawer.sendCode`)} (${se}s)`:w(`resetPasswordDrawer.sendCode`)})]})]}),x(s,{className:`mt-[28px]`,children:[x(s,{className:`relative`,children:[b(`input`,{ref:j,type:`text`,inputMode:`numeric`,pattern:`[0-9]*`,value:``,onChange:de,onKeyDown:fe,className:`absolute inset-0 h-full w-full opacity-0 pointer-events-none`,autoComplete:`one-time-code`}),b(s,{className:`flex justify-between gap-[10px]`,children:D.map((e,t)=>b(s,{onClick:()=>pe(t),className:`
|
|
3
3
|
h-[48px] flex-1 rounded-[6px] border-2 flex items-center justify-center cursor-pointer transition-all duration-200
|
|
4
4
|
${N?`border-theme5 bg-line1`:t===k?`border-theme3 bg-theme3/10`:`border-transparent bg-line1`}
|
|
5
5
|
`,children:b(u,{className:`text-[24px] leading-none font-semibold text-text1 select-none`,children:e})},`${t}-${e||`empty`}`))})]}),b(s,{className:`min-h-[22px] pt-[8px]`,children:b(u,{className:`text-[12px] leading-[18px] text-theme5`,children:N})}),b(d,{onClick:H,disabled:M,className:`mt-[180px] w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:`提交`})]})]}),he=x(s,{className:`p-6`,children:[b(s,{children:b(u,{className:`text-text2`,children:w(`resetPasswordDrawer.setNewPasswordHint`)})}),x(s,{className:`mt-6 space-y-6`,children:[x(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Q?`border-theme5`:`border-line1`}`,children:[b(h,{value:G.password,onChange:e=>K(t=>({...t,password:e})),placeholder:w(`resetPasswordDrawer.passwordPlaceholder`),type:Y?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),b(`button`,{type:`button`,onClick:()=>ce(!Y),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:b(Y?p:f,{className:`w-5 h-5`})})]}),x(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Z.type===`not-match`?`border-theme5`:`border-line1`}`,children:[b(h,{value:G.confirmPassword,onChange:e=>K(t=>({...t,confirmPassword:e})),placeholder:w(`resetPasswordDrawer.confirmPasswordPlaceholder`),type:X?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),b(`button`,{type:`button`,onClick:()=>le(!X),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:b(X?p:f,{className:`w-5 h-5`})})]}),Q?b(s,{children:b(u,{className:`min-h-[22px] text-[14px] text-theme5 px-[12px]`,children:Q})}):null,b(d,{onClick:ue,disabled:$,className:`w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:w(q?`resetPasswordDrawer.submitting`:`resetPasswordDrawer.resetPassword`)})]})]});return x(c,{open:oe,onOpenChange:T,direction:`right`,handleOnly:!0,children:[x(re,{className:`hidden`,children:[b(l,{children:w(`resetPasswordDrawer.title`)}),b(ne,{children:w(`resetPasswordDrawer.title`)})]}),x(te,{className:`!w-full`,children:[b(m,{onBack:()=>T(!1),title:w(`resetPasswordDrawer.title`)}),U===0&&me,U===1&&he]})]})}export{C as ResetPasswordDrawer};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -7,8 +7,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
7
7
|
//#region components/ui/button.d.ts
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
11
|
-
size?: "
|
|
10
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -34,7 +34,7 @@ type EmptyStateProps = React.ComponentProps<'div'> & {
|
|
|
34
34
|
};
|
|
35
35
|
/** emptyMediaVariants 工具定义。 */
|
|
36
36
|
declare const emptyMediaVariants: (props?: ({
|
|
37
|
-
variant?: "
|
|
37
|
+
variant?: "default" | "icon" | null | undefined;
|
|
38
38
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
39
39
|
/** EmptyMedia 组件。 */
|
|
40
40
|
declare function EmptyMedia({
|
|
@@ -82,7 +82,7 @@ declare function Item({
|
|
|
82
82
|
}: ItemProps): React.ReactElement;
|
|
83
83
|
/** itemMediaVariants 工具定义。 */
|
|
84
84
|
declare const itemMediaVariants: (props?: ({
|
|
85
|
-
variant?: "
|
|
85
|
+
variant?: "default" | "icon" | "image" | null | undefined;
|
|
86
86
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
87
87
|
/** ItemMedia 组件。 */
|
|
88
88
|
declare function ItemMedia({
|
package/dist/materials.d.mts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
import { videoDetailPlayerMaterial } from "./components/biz/business/detail/video-detail-player/material.mjs";
|
|
3
|
+
import "./components/biz/business/detail/video-detail-player/index.mjs";
|
|
4
|
+
import { videoDetailInfoMaterial } from "./components/biz/business/detail/video-detail-info/material.mjs";
|
|
5
|
+
import "./components/biz/business/detail/video-detail-info/index.mjs";
|
|
6
|
+
import { videoDetailInfoTitleTagsEpisodesMaterial } from "./components/biz/business/detail/video-detail-info-title-tags-episodes/material.mjs";
|
|
7
|
+
import "./components/biz/business/detail/video-detail-info-title-tags-episodes/index.mjs";
|
|
8
|
+
import { videoDetailActionsMaterial } from "./components/biz/business/detail/video-detail-actions/material.mjs";
|
|
9
|
+
import "./components/biz/business/detail/video-detail-actions/index.mjs";
|
|
10
|
+
import { videoDetailRecommendMaterial } from "./components/biz/business/detail/video-detail-recommend/material.mjs";
|
|
11
|
+
import "./components/biz/business/detail/video-detail-recommend/index.mjs";
|
|
2
12
|
import { floatingBallMaterial } from "./components/biz/business/floating-ball/material.mjs";
|
|
3
13
|
import { homeRecommendGridMaterial } from "./components/biz/business/home-recommend/home-recommend-grid/material.mjs";
|
|
4
14
|
import { homeRecommendWaterfallMaterial } from "./components/biz/business/home-recommend/home-recommend-waterfall/material.mjs";
|
|
@@ -13,16 +23,6 @@ import { textRecommendMaterial } from "./components/biz/business/text-recommend/
|
|
|
13
23
|
import { exampleButtonMaterial } from "./components/biz/example/button/material.mjs";
|
|
14
24
|
import { BannerCarouselMaterial } from "./components/biz/business/banner-carousel/material.mjs";
|
|
15
25
|
import { channelListMaterial } from "./components/biz/business/channel-list/material.mjs";
|
|
16
|
-
import { videoDetailActionsMaterial } from "./components/biz/business/detail/video-detail-actions/material.mjs";
|
|
17
|
-
import "./components/biz/business/detail/video-detail-actions/index.mjs";
|
|
18
|
-
import { videoDetailInfoMaterial } from "./components/biz/business/detail/video-detail-info/material.mjs";
|
|
19
|
-
import "./components/biz/business/detail/video-detail-info/index.mjs";
|
|
20
|
-
import { videoDetailInfoTitleTagsEpisodesMaterial } from "./components/biz/business/detail/video-detail-info-title-tags-episodes/material.mjs";
|
|
21
|
-
import "./components/biz/business/detail/video-detail-info-title-tags-episodes/index.mjs";
|
|
22
|
-
import { videoDetailPlayerMaterial } from "./components/biz/business/detail/video-detail-player/material.mjs";
|
|
23
|
-
import "./components/biz/business/detail/video-detail-player/index.mjs";
|
|
24
|
-
import { videoDetailRecommendMaterial } from "./components/biz/business/detail/video-detail-recommend/material.mjs";
|
|
25
|
-
import "./components/biz/business/detail/video-detail-recommend/index.mjs";
|
|
26
26
|
import { headerAvatarIconMaterial } from "./components/biz/business/header-search/header-avatar-icon/material.mjs";
|
|
27
27
|
import { headerAvatarLogoSearchMaterial } from "./components/biz/business/header-search/header-avatar-logo-search/material.mjs";
|
|
28
28
|
import { headerAvatarLogoSearchIconMaterial } from "./components/biz/business/header-search/header-avatar-logo-search-icon/material.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
import { INSPECTOR_META_KEY, InferSchemaProps, MaterialComponentMode, MaterialComponentProps, SchemaHasDefaultValue, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, getSchemaDefaultProps, withInspectorMeta } from "./schema.mjs";
|
|
3
|
-
import { defineMaterial, overwriteMaterial } from "./material.mjs";
|
|
3
|
+
import { DefineMaterialOption, MaterialCategory, OverwriteMaterialOption, defineMaterial, overwriteMaterial } from "./material.mjs";
|
|
4
4
|
import { MaterialMap, generateMaterialMap, generateMaterialMapGroupByCategory } from "./utils.mjs";
|
|
@@ -51,4 +51,4 @@ interface OverwriteMaterialOption<TServerComponent extends ComponentType<any>, T
|
|
|
51
51
|
*/
|
|
52
52
|
declare function overwriteMaterial<TRawServerComponent extends ComponentType<any>, TRawClientComponent extends ComponentType<any>, TPropsSchema extends MaterialPropsSchema, TType extends string, TCategory extends MaterialCategory, TServerComponent extends ComponentType<any> = TRawServerComponent, TClientComponent extends ComponentType<any> = TRawClientComponent>(rawMaterial: DefineMaterialOption<TRawServerComponent, TRawClientComponent, TPropsSchema, TType, TCategory>, option?: OverwriteMaterialOption<TServerComponent, TClientComponent, TPropsSchema, TCategory>): DefineMaterialOption<TServerComponent, TClientComponent, TPropsSchema, TType, TCategory>;
|
|
53
53
|
//#endregion
|
|
54
|
-
export { DefineMaterialOption, MaterialCategory, defineMaterial, overwriteMaterial };
|
|
54
|
+
export { DefineMaterialOption, MaterialCategory, OverwriteMaterialOption, defineMaterial, overwriteMaterial };
|
|
@@ -61,9 +61,16 @@ declare function defineNumberPropSchema<const TOption extends NumberInspectorFie
|
|
|
61
61
|
declare function defineColorPropSchema<const TOption extends ColorInspectorFieldOption & {
|
|
62
62
|
required?: boolean;
|
|
63
63
|
}>(option: TOption): MaybeSchemaWithDefaultValue<SchemaByRequired<z.ZodString, TOption['required']>, TOption>;
|
|
64
|
+
/**
|
|
65
|
+
* 定义日期时间字段schema,用于时间段选择。
|
|
66
|
+
* 值为 ISO 8601 或 YYYY-MM-DD HH:mm:ss 格式字符串。
|
|
67
|
+
* @param option inspector 字段配置
|
|
68
|
+
* @returns zod schema
|
|
69
|
+
*/
|
|
64
70
|
declare function defineDatetimePropSchema<const TOption extends DatetimeInspectorFieldOption & {
|
|
65
71
|
required?: boolean;
|
|
66
72
|
}>(option: TOption): MaybeSchemaWithDefaultValue<SchemaByRequired<z.ZodString, TOption['required']>, TOption>;
|
|
73
|
+
/** 时间段结构:{ start: 开始时间, end: 结束时间 },格式 YYYY-MM-DD HH:mm:ss */
|
|
67
74
|
declare const timeRangeShape: {
|
|
68
75
|
readonly start: z.ZodString;
|
|
69
76
|
readonly end: z.ZodString;
|
|
@@ -75,6 +82,11 @@ interface TimeRangeValue {
|
|
|
75
82
|
interface TimeRangeInspectorOption extends Omit<TimeRangeInspectorFieldOption, 'defaultValue'> {
|
|
76
83
|
defaultValue?: TimeRangeValue;
|
|
77
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* 定义时间段字段schema,用于开始时间+结束时间范围选择。
|
|
87
|
+
* @param option inspector 字段配置
|
|
88
|
+
* @returns zod schema
|
|
89
|
+
*/
|
|
78
90
|
declare function defineTimeRangePropSchema<const TOption extends TimeRangeInspectorOption & {
|
|
79
91
|
required?: boolean;
|
|
80
92
|
}>(option: TOption): MaybeSchemaWithDefaultValue<SchemaByRequired<z.ZodObject<typeof timeRangeShape>, TOption['required']>, TOption>;
|
|
@@ -85,6 +97,12 @@ type StringTuple = readonly [string, ...string[]];
|
|
|
85
97
|
type SelectEnumInspectorFieldOption<TValues extends StringTuple> = Omit<SelectInspectorFieldOption, 'defaultValue'> & {
|
|
86
98
|
defaultValue?: TValues[number];
|
|
87
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* 基于字符串元组定义select字段schema。
|
|
102
|
+
* @param values 可选值元组
|
|
103
|
+
* @param option inspector 字段配置
|
|
104
|
+
* @returns zod schema
|
|
105
|
+
*/
|
|
88
106
|
declare function defineSelectEnumPropSchema<const TValues extends StringTuple, const TOption extends SelectEnumInspectorFieldOption<TValues> & {
|
|
89
107
|
required?: boolean;
|
|
90
108
|
}>(values: TValues, option: TOption): MaybeSchemaWithDefaultValue<SchemaByRequired<z.ZodType<TValues[number]>, TOption['required']>, TOption>;
|
|
@@ -97,6 +115,11 @@ declare function defineSwitchPropSchema<const TOption extends SwitchInspectorFie
|
|
|
97
115
|
type SchemaShape<TSchema extends z.ZodObject<z.ZodRawShape>> = TSchema extends z.ZodObject<infer TShape> ? TShape : never;
|
|
98
116
|
type SchemaFieldDefaultValue<TFieldSchema> = TFieldSchema extends z.ZodTypeAny ? TFieldSchema extends SchemaHasDefaultValue ? Exclude<z.infer<TFieldSchema>, undefined> : never : never;
|
|
99
117
|
type SchemaDefaultProps<TSchema extends z.ZodObject<z.ZodRawShape>> = { [Key in keyof SchemaShape<TSchema> as [SchemaFieldDefaultValue<SchemaShape<TSchema>[Key]>] extends [never] ? never : Key]: SchemaFieldDefaultValue<SchemaShape<TSchema>[Key]> };
|
|
118
|
+
/**
|
|
119
|
+
* 提取schema中定义的默认props
|
|
120
|
+
* @param schema
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
100
123
|
declare function getSchemaDefaultProps<const TSchema extends z.ZodObject<z.ZodRawShape>>(schema: TSchema): SchemaDefaultProps<TSchema>;
|
|
101
124
|
type ArrayItemInspectorOption<TItemSchema extends z.ZodTypeAny> = Omit<ArrayInspectorFieldOption, 'defaultValue'> & {
|
|
102
125
|
defaultValue?: z.infer<TItemSchema>[];
|
|
@@ -104,9 +127,21 @@ type ArrayItemInspectorOption<TItemSchema extends z.ZodTypeAny> = Omit<ArrayInsp
|
|
|
104
127
|
type ObjectPropInspectorOption<TShape extends z.ZodRawShape> = Omit<ObjectInspectorFieldOption, 'defaultValue'> & {
|
|
105
128
|
defaultValue?: z.infer<z.ZodObject<TShape>>;
|
|
106
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* 定义数组字段schema,支持声明数组项schema。
|
|
132
|
+
* @param itemSchema 数组项schema
|
|
133
|
+
* @param option inspector 字段配置
|
|
134
|
+
* @returns zod schema
|
|
135
|
+
*/
|
|
107
136
|
declare function defineArrayItemPropSchema<TItemSchema extends z.ZodTypeAny, const TOption extends ArrayItemInspectorOption<TItemSchema> & {
|
|
108
137
|
required?: boolean;
|
|
109
138
|
}>(itemSchema: TItemSchema, option: TOption): MaybeSchemaWithDefaultValue<SchemaByRequired<z.ZodArray<TItemSchema>, TOption['required']>, TOption>;
|
|
139
|
+
/**
|
|
140
|
+
* 定义对象字段schema,支持声明对象shape。
|
|
141
|
+
* @param shape 对象字段shape
|
|
142
|
+
* @param option inspector 字段配置
|
|
143
|
+
* @returns zod schema
|
|
144
|
+
*/
|
|
110
145
|
declare function defineObjectPropSchema<const TShape extends z.ZodRawShape, const TOption extends ObjectPropInspectorOption<TShape> & {
|
|
111
146
|
required?: boolean;
|
|
112
147
|
}>(shape: TShape, option: TOption): MaybeSchemaWithDefaultValue<SchemaByRequired<z.ZodObject<TShape>, TOption['required']>, TOption>;
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { HttpClient, HttpError, RequestConfig, RequestMethod, ResponseData, httpClient } from "./utils/http.mjs";
|
|
3
2
|
import { clearMyChannelsFromStorage, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, saveHiddenChannelIdsToStorage } from "./utils/channel-storage.mjs";
|
|
4
3
|
import { cn } from "./utils/cn.mjs";
|
|
5
4
|
import { debounceFun, formatVideoDuration, generateDynamicSign, generateUUID, getAtUserElement, getCookie, getCurrentSecondTime, getUserId, hashPassword, isClient, isMobileDevice, numToString, parseResolution, parseTextAtUserIds, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, secondToTime, setCookie, stringToNumber, stripHtmlTags, updateUrlParams } from "./utils/common.mjs";
|
|
@@ -8,15 +7,16 @@ import { eventBus } from "./utils/event-bus.mjs";
|
|
|
8
7
|
import { checkFollowStatus, followUser, getAppId, getCurrentUserId, unfollowUser } from "./utils/follow-service.mjs";
|
|
9
8
|
import { getResUrl } from "./utils/get-res-url.mjs";
|
|
10
9
|
import { disablePageScroll, enablePageScroll, normalizeClassName, pxToVw } from "./utils/helper.mjs";
|
|
10
|
+
import { HttpClient, HttpError, RequestConfig, RequestMethod, ResponseData, httpClient } from "./utils/http.mjs";
|
|
11
11
|
import { ImageCompressionQualityRule, compressImage, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, getImageCompressionQuality, imageCompressionQualityRules } from "./utils/image-compression.mjs";
|
|
12
12
|
import { components, loadComponent, rewriteComponent } from "./utils/loaders.mjs";
|
|
13
13
|
import { createInputAndSelectFile, getCoverImage, getImageResolutionFromFile } from "./utils/media.mjs";
|
|
14
14
|
import { PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasswordValidationResult, PasswordValidationType, getFirstInvalidPasswordChar, getPasswordCharacterTypeCount, getPasswordValidationErrorText, validatePasswordPair } from "./utils/password-validator.mjs";
|
|
15
15
|
import { PresignedUploadInfo, UploadToS3Options, UploadToS3Result, uploadToS3WithPresignedUrl } from "./utils/s3-uploader.mjs";
|
|
16
16
|
import { INSPECTOR_META_KEY, InferSchemaProps, MaterialComponentMode, MaterialComponentProps, SchemaHasDefaultValue, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, getSchemaDefaultProps, withInspectorMeta } from "./utils/schema/schema.mjs";
|
|
17
|
-
import { defineMaterial, overwriteMaterial } from "./utils/schema/material.mjs";
|
|
17
|
+
import { DefineMaterialOption, MaterialCategory, OverwriteMaterialOption, defineMaterial, overwriteMaterial } from "./utils/schema/material.mjs";
|
|
18
18
|
import { MaterialMap, generateMaterialMap, generateMaterialMapGroupByCategory } from "./utils/schema/utils.mjs";
|
|
19
19
|
import "./utils/schema/index.mjs";
|
|
20
20
|
import { base64ToUint8Array, uint8ArrayToBase64, uint8ArrayToNumberArray } from "./utils/uint8.mjs";
|
|
21
21
|
import { UploadFileResult, encryptBncBuffer, uploadFile } from "./utils/upload-file.mjs";
|
|
22
|
-
export { eventBus as EventBus, HttpClient, HttpError, INSPECTOR_META_KEY, ImageCompressionQualityRule, InferSchemaProps, MaterialComponentMode, MaterialComponentProps, MaterialMap, PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasswordValidationResult, PasswordValidationType, PresignedUploadInfo, RequestConfig, RequestMethod, ResponseData, SchemaHasDefaultValue, UploadFileResult, UploadToS3Options, UploadToS3Result, base64ToUint8Array, checkFollowStatus, clearMyChannelsFromStorage, cn, components, compressImage, createInputAndSelectFile, debounceFun, decryptImageToArrayBuffer, decryptImageToUint8Array, decryptImageUrl, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineMaterial, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, disablePageScroll, enablePageScroll, encryptBncBuffer, followUser, formatVideoDuration, generateDynamicSign, generateMaterialMap, generateMaterialMapGroupByCategory, generateUUID, getAppId, getAtUserElement, getCookie, getCoverImage, getCurrentSecondTime, getCurrentUserId, getFirstInvalidPasswordChar, getImageCompressionQuality, getImageResolutionFromFile, getPasswordCharacterTypeCount, getPasswordValidationErrorText, getResUrl, getSchemaDefaultProps, getUserId, guessImageContentTypeFromUrl, hashPassword, httpClient, imageCompressionQualityRules, isClient, isEncryptedImageUrl, isMobileDevice, loadComponent, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, normalizeClassName, numToString, overwriteMaterial, parseResolution, parseTextAtUserIds, pxToVw, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, resolveImageUrl, rewriteComponent, saveHiddenChannelIdsToStorage, secondToTime, setCookie, shouldProbeImageUrl, shouldUseApiResDirectly, stringToNumber, stripHtmlTags, uint8ArrayToBase64, uint8ArrayToNumberArray, unfollowUser, updateUrlParams, uploadFile, uploadToS3WithPresignedUrl, validatePasswordPair, withInspectorMeta };
|
|
22
|
+
export { DefineMaterialOption, eventBus as EventBus, HttpClient, HttpError, INSPECTOR_META_KEY, ImageCompressionQualityRule, InferSchemaProps, MaterialCategory, MaterialComponentMode, MaterialComponentProps, MaterialMap, OverwriteMaterialOption, PASSWORD_ALLOWED_SPECIAL_CHARS, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, PasswordValidationResult, PasswordValidationType, PresignedUploadInfo, RequestConfig, RequestMethod, ResponseData, SchemaHasDefaultValue, UploadFileResult, UploadToS3Options, UploadToS3Result, base64ToUint8Array, checkFollowStatus, clearMyChannelsFromStorage, cn, components, compressImage, createInputAndSelectFile, debounceFun, decryptImageToArrayBuffer, decryptImageToUint8Array, decryptImageUrl, defaultImageCompressionMaxSizeMB, defaultImageCompressionQuality, defineArrayItemPropSchema, defineCheckboxPropSchema, defineColorPropSchema, defineComponentPropsSchema, defineDatetimePropSchema, defineMaterial, defineNumberPropSchema, defineObjectPropSchema, defineSelectEnumPropSchema, defineSelectPropSchema, defineSwitchPropSchema, defineTextPropSchema, defineTextareaPropSchema, defineTimeRangePropSchema, disablePageScroll, enablePageScroll, encryptBncBuffer, followUser, formatVideoDuration, generateDynamicSign, generateMaterialMap, generateMaterialMapGroupByCategory, generateUUID, getAppId, getAtUserElement, getCookie, getCoverImage, getCurrentSecondTime, getCurrentUserId, getFirstInvalidPasswordChar, getImageCompressionQuality, getImageResolutionFromFile, getPasswordCharacterTypeCount, getPasswordValidationErrorText, getResUrl, getSchemaDefaultProps, getUserId, guessImageContentTypeFromUrl, hashPassword, httpClient, imageCompressionQualityRules, isClient, isEncryptedImageUrl, isMobileDevice, loadComponent, loadHiddenChannelIdsFromStorage, loadMyChannelsFromStorage, normalizeClassName, numToString, overwriteMaterial, parseResolution, parseTextAtUserIds, pxToVw, randomString, removeCookie, replaceAtUserElement, replaceAtUserElementHtmlStr, resolveImageUrl, rewriteComponent, saveHiddenChannelIdsToStorage, secondToTime, setCookie, shouldProbeImageUrl, shouldUseApiResDirectly, stringToNumber, stripHtmlTags, uint8ArrayToBase64, uint8ArrayToNumberArray, unfollowUser, updateUrlParams, uploadFile, uploadToS3WithPresignedUrl, validatePasswordPair, withInspectorMeta };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funhub/platform",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.136",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css"
|
|
@@ -62,6 +62,9 @@
|
|
|
62
62
|
},
|
|
63
63
|
"./theme.css": "./theme.css"
|
|
64
64
|
},
|
|
65
|
+
"bin": {
|
|
66
|
+
"funhub-platform": "./dist/cli.mjs"
|
|
67
|
+
},
|
|
65
68
|
"files": [
|
|
66
69
|
"config",
|
|
67
70
|
"dist",
|
|
@@ -80,6 +83,7 @@
|
|
|
80
83
|
"@aws-sdk/client-s3": "^3.890.0",
|
|
81
84
|
"@aws-sdk/lib-storage": "^3.890.0",
|
|
82
85
|
"@base-ui/react": "^1.0.0",
|
|
86
|
+
"@clack/prompts": "^1.1.0",
|
|
83
87
|
"@ncdai/react-wheel-picker": "^1.1.0",
|
|
84
88
|
"@next/bundle-analyzer": "^16.1.6",
|
|
85
89
|
"browser-image-compression": "^2.0.2",
|
|
@@ -91,6 +95,7 @@
|
|
|
91
95
|
"dayjs": "^1.11.13",
|
|
92
96
|
"embla-carousel-react": "^8.6.0",
|
|
93
97
|
"foxact": "^0.2.52",
|
|
98
|
+
"giget": "^3.1.2",
|
|
94
99
|
"html-react-parser": "^5.2.11",
|
|
95
100
|
"immer": "^10.1.1",
|
|
96
101
|
"input-otp": "^1.4.2",
|
|
@@ -98,6 +103,7 @@
|
|
|
98
103
|
"lucide-react": "^0.562.0",
|
|
99
104
|
"next-themes": "^0.4.6",
|
|
100
105
|
"nuqs": "^2.8.6",
|
|
106
|
+
"package-manager-detector": "^1.6.0",
|
|
101
107
|
"photoswipe": "^5.4.4",
|
|
102
108
|
"react-content-loader": "^7.1.2",
|
|
103
109
|
"react-easy-crop": "^5.5.6",
|
|
@@ -109,8 +115,7 @@
|
|
|
109
115
|
"xgplayer": "^3.0.23",
|
|
110
116
|
"xgplayer-hls": "^3.0.23",
|
|
111
117
|
"zod": "^4.3.6",
|
|
112
|
-
"zustand": "^5.0.9"
|
|
113
|
-
"create-funhub": "npm:@funhub/create-app@0.1.0"
|
|
118
|
+
"zustand": "^5.0.9"
|
|
114
119
|
},
|
|
115
120
|
"devDependencies": {
|
|
116
121
|
"@svgr/webpack": "^8.1.0",
|