@blocklet/pages-kit 0.4.99 → 0.4.101
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/lib/cjs/components/CustomComponentRenderer/state.js +5 -2
- package/lib/cjs/contexts/color.js +153 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/types/index.js +1 -0
- package/lib/cjs/types/style.js +2 -0
- package/lib/cjs/utils/common.js +8 -0
- package/lib/cjs/utils/property.js +43 -2
- package/lib/cjs/utils/style.js +172 -0
- package/lib/esm/components/CustomComponentRenderer/state.js +5 -2
- package/lib/esm/contexts/color.js +149 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/types/index.js +1 -0
- package/lib/esm/types/style.js +1 -0
- package/lib/esm/utils/common.js +4 -0
- package/lib/esm/utils/property.js +38 -1
- package/lib/esm/utils/style.js +160 -0
- package/lib/types/contexts/color.d.ts +25 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/index.d.ts +1 -0
- package/lib/types/types/state.d.ts +20 -6
- package/lib/types/types/style.d.ts +31 -0
- package/lib/types/utils/common.d.ts +2 -0
- package/lib/types/utils/property.d.ts +3 -1
- package/lib/types/utils/style.d.ts +23 -0
- package/package.json +16 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CustomComponent } from './core';
|
|
2
|
+
import { StyleConfig } from './style';
|
|
2
3
|
export type PublishMode = 'production';
|
|
3
4
|
export type StateMode = 'draft' | 'production';
|
|
4
5
|
export interface PageTemplateConfig {
|
|
@@ -7,23 +8,34 @@ export interface PageTemplateConfig {
|
|
|
7
8
|
dataSourceId?: string;
|
|
8
9
|
dataSourceParameters?: Record<string, any>;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
+
export type Page = {
|
|
11
12
|
id: string;
|
|
12
13
|
createdAt: string;
|
|
13
14
|
updatedAt: string;
|
|
14
15
|
publishedAt: string;
|
|
15
|
-
isPublic: boolean;
|
|
16
|
-
templateConfig?: PageTemplateConfig;
|
|
17
16
|
slug: string;
|
|
18
17
|
sections: Record<string, Section>;
|
|
19
18
|
sectionIds: string[];
|
|
19
|
+
isPublic: boolean;
|
|
20
|
+
templateConfig?: PageTemplateConfig;
|
|
20
21
|
locales?: Record<string, {
|
|
21
22
|
title?: string;
|
|
22
23
|
description?: string;
|
|
23
24
|
backgroundColor?: string;
|
|
24
25
|
image?: string;
|
|
26
|
+
header?: {
|
|
27
|
+
sticky?: boolean;
|
|
28
|
+
translucent?: boolean;
|
|
29
|
+
hideNavMenus?: boolean;
|
|
30
|
+
translucentTextColor?: string;
|
|
31
|
+
};
|
|
32
|
+
footer?: {
|
|
33
|
+
hidden?: boolean;
|
|
34
|
+
};
|
|
35
|
+
style?: StyleConfig;
|
|
36
|
+
[key: string]: any;
|
|
25
37
|
}>;
|
|
26
|
-
}
|
|
38
|
+
};
|
|
27
39
|
export interface Chunk {
|
|
28
40
|
id: string;
|
|
29
41
|
code?: string;
|
|
@@ -34,11 +46,12 @@ export interface Section<T = {
|
|
|
34
46
|
id: string;
|
|
35
47
|
component: string;
|
|
36
48
|
config?: T;
|
|
49
|
+
visibility?: 'visible' | 'hidden';
|
|
37
50
|
name?: string;
|
|
38
51
|
isTemplateSection?: boolean;
|
|
39
52
|
templateDescription?: string;
|
|
40
53
|
llmConfig?: {
|
|
41
|
-
properties
|
|
54
|
+
properties?: Record<string, {
|
|
42
55
|
key: string;
|
|
43
56
|
isNeedGenerate: boolean;
|
|
44
57
|
displayName?: string;
|
|
@@ -51,7 +64,6 @@ export interface Section<T = {
|
|
|
51
64
|
}>;
|
|
52
65
|
}>;
|
|
53
66
|
};
|
|
54
|
-
visibility?: 'visible' | 'hidden';
|
|
55
67
|
locales?: Record<string, T>;
|
|
56
68
|
}
|
|
57
69
|
export type State = {
|
|
@@ -60,6 +72,8 @@ export type State = {
|
|
|
60
72
|
components: Record<string, {
|
|
61
73
|
index: number;
|
|
62
74
|
data: CustomComponent;
|
|
75
|
+
blockletId?: string;
|
|
76
|
+
blockletTitle?: string;
|
|
63
77
|
}>;
|
|
64
78
|
supportedLocales: {
|
|
65
79
|
locale: string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type SizeEnum = 'none' | 'small' | 'normal' | 'large';
|
|
2
|
+
export type StyleEnum = 'paddingY' | 'paddingX' | 'maxWidth';
|
|
3
|
+
export type StyleFormat = 'sx';
|
|
4
|
+
export type CommonPaddingItem = {
|
|
5
|
+
title: string;
|
|
6
|
+
value: SizeEnum;
|
|
7
|
+
sx: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type PaddingYItem = CommonPaddingItem;
|
|
12
|
+
export type PaddingXItem = CommonPaddingItem;
|
|
13
|
+
export type MaxWidthSizeEnum = 'full' | 'sm' | 'md' | 'lg' | 'xl';
|
|
14
|
+
export type MaxWidthItem = {
|
|
15
|
+
title: string;
|
|
16
|
+
value: MaxWidthSizeEnum;
|
|
17
|
+
sx: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export interface StyleValueOptions {
|
|
22
|
+
type: StyleEnum;
|
|
23
|
+
value: string;
|
|
24
|
+
format?: StyleFormat;
|
|
25
|
+
defaultValue?: any;
|
|
26
|
+
}
|
|
27
|
+
export type StyleConfig = {
|
|
28
|
+
paddingY?: SizeEnum;
|
|
29
|
+
paddingX?: SizeEnum;
|
|
30
|
+
maxWidth?: MaxWidthSizeEnum;
|
|
31
|
+
};
|
|
@@ -22,9 +22,11 @@ export declare function mergeComponent({ componentId, getComponent, locale, defa
|
|
|
22
22
|
export declare const RenderNestedComponent = "__RENDER_NESTED_COMPONENT__";
|
|
23
23
|
export declare function safeJSONParse(value: string | Record<string, any>): any;
|
|
24
24
|
export declare function safeYamlParse(value: string | Record<string, any>): any;
|
|
25
|
-
export declare
|
|
25
|
+
export declare const initDynamicParsePropertyValueHandlers: () => Promise<Record<string, any>>;
|
|
26
|
+
export declare function parsePropertyValue(property: NonNullable<CustomComponent['properties']>[string]['data'], value: any, { locale, defaultLocale, propertyHandlers, }: {
|
|
26
27
|
locale?: string;
|
|
27
28
|
defaultLocale?: string;
|
|
29
|
+
propertyHandlers?: Record<string, (value: any) => any>;
|
|
28
30
|
}): any;
|
|
29
31
|
export declare function assignNullableFields(properties: any, newProperties: any): any;
|
|
30
32
|
export declare function getComponentDependencies({ state, pageIds, componentIds, }: {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare function getBlockletTheme(): Theme;
|
|
3
|
+
export declare function isGradient(color: string): boolean;
|
|
4
|
+
export declare function isColorString(color: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* 检查字符串是否为有效的MUI颜色键
|
|
7
|
+
*/
|
|
8
|
+
export declare function isMuiColorKey(value: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 处理渐变的解析,并转换为rgba格式
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSafeGradient(color: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* 解析颜色字符串
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseColor(color?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* 转换颜色
|
|
19
|
+
* @param color - 颜色字符串
|
|
20
|
+
* @param _theme - 主题对象,默认为全局主题
|
|
21
|
+
* @returns 转换后的颜色字符串
|
|
22
|
+
*/
|
|
23
|
+
export declare function colorConvert(color: string, _theme?: Theme): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/pages-kit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.101",
|
|
4
4
|
"description": "Pages Kit components and utils for blocklet(s)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"./utils/*": {
|
|
48
48
|
"import": "./lib/esm/utils/*.js",
|
|
49
49
|
"require": "./lib/cjs/utils/*.js"
|
|
50
|
+
},
|
|
51
|
+
"./contexts/*": {
|
|
52
|
+
"import": "./lib/esm/contexts/*.js",
|
|
53
|
+
"require": "./lib/cjs/contexts/*.js"
|
|
50
54
|
}
|
|
51
55
|
},
|
|
52
56
|
"typesVersions": {
|
|
@@ -77,6 +81,10 @@
|
|
|
77
81
|
"utils/*": [
|
|
78
82
|
"./lib/types/utils/*.d.ts",
|
|
79
83
|
"./lib/types/utils/*/index.d.ts"
|
|
84
|
+
],
|
|
85
|
+
"contexts/*": [
|
|
86
|
+
"./lib/types/contexts/*.d.ts",
|
|
87
|
+
"./lib/types/contexts/*/index.d.ts"
|
|
80
88
|
]
|
|
81
89
|
}
|
|
82
90
|
},
|
|
@@ -92,7 +100,7 @@
|
|
|
92
100
|
"url": "git+https://github.com/blocklet/pages-kit.git"
|
|
93
101
|
},
|
|
94
102
|
"dependencies": {
|
|
95
|
-
"@arcblock/did-connect": "^2.12.
|
|
103
|
+
"@arcblock/did-connect": "^2.12.58",
|
|
96
104
|
"@blocklet/ai-kit": "^0.1.72",
|
|
97
105
|
"@blocklet/js-sdk": "^1.16.41",
|
|
98
106
|
"@blocklet/sdk": "^1.16.41",
|
|
@@ -107,6 +115,7 @@
|
|
|
107
115
|
"es-module-shims": "^2.0.10",
|
|
108
116
|
"eventsource-parser": "^2.0.1",
|
|
109
117
|
"file-saver": "^2.0.5",
|
|
118
|
+
"gradient-parser": "^1.0.2",
|
|
110
119
|
"html2pdf.js": "^0.10.2",
|
|
111
120
|
"immer": "^10.1.1",
|
|
112
121
|
"isomorphic-dompurify": "^2.14.0",
|
|
@@ -131,6 +140,7 @@
|
|
|
131
140
|
"react-transition-group": "^4.4.5",
|
|
132
141
|
"react-wrap-balancer": "^1.1.1",
|
|
133
142
|
"remark-gfm": "^4.0.0",
|
|
143
|
+
"tinycolor2": "^1.6.0",
|
|
134
144
|
"typescript": "~5.5.4",
|
|
135
145
|
"ufo": "^1.5.4",
|
|
136
146
|
"yaml": "^2.5.0",
|
|
@@ -153,8 +163,8 @@
|
|
|
153
163
|
"react-router-dom": "^6.16.0"
|
|
154
164
|
},
|
|
155
165
|
"devDependencies": {
|
|
156
|
-
"@arcblock/ux": "^2.12.
|
|
157
|
-
"@blocklet/ai-runtime": "^0.4.
|
|
166
|
+
"@arcblock/ux": "^2.12.58",
|
|
167
|
+
"@blocklet/ai-runtime": "^0.4.255",
|
|
158
168
|
"@blocklet/js-sdk": "^1.16.41",
|
|
159
169
|
"@blocklet/sdk": "^1.16.41",
|
|
160
170
|
"@emotion/cache": "^11.13.1",
|
|
@@ -163,6 +173,7 @@
|
|
|
163
173
|
"@mui/icons-material": "^5.16.14",
|
|
164
174
|
"@mui/lab": "^5.0.0-alpha.173",
|
|
165
175
|
"@mui/material": "^5.16.14",
|
|
176
|
+
"@types/gradient-parser": "^0.1.5",
|
|
166
177
|
"@types/lodash": "^4.17.7",
|
|
167
178
|
"@types/mustache": "^4.2.5",
|
|
168
179
|
"@types/node-fetch": "^2.6.11",
|
|
@@ -170,6 +181,7 @@
|
|
|
170
181
|
"@types/react-helmet": "^6.1.11",
|
|
171
182
|
"@types/react-scroll-to-bottom": "^4.2.5",
|
|
172
183
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
184
|
+
"@types/tinycolor2": "^1.4.6",
|
|
173
185
|
"axios": "^1.7.4",
|
|
174
186
|
"npm-run-all": "^4.1.5",
|
|
175
187
|
"react": "^18.3.1",
|