@blocklet/component-studio-cli 0.4.134
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/README.md +84 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +11 -0
- package/dist/commands/add.d.ts +2 -0
- package/dist/commands/add.js +140 -0
- package/dist/commands/component-studio.d.ts +2 -0
- package/dist/commands/component-studio.js +70 -0
- package/dist/commands/dev.d.ts +2 -0
- package/dist/commands/dev.js +87 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +114 -0
- package/dist/commands/migrate.d.ts +2 -0
- package/dist/commands/migrate.js +177 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +22 -0
- package/dist/utils/display-logo.d.ts +2 -0
- package/dist/utils/display-logo.js +24 -0
- package/dist/utils/helper.d.ts +97 -0
- package/dist/utils/helper.js +479 -0
- package/package.json +58 -0
- package/templates/add/components/HelloWorld/@metadata.json +433 -0
- package/templates/add/components/HelloWorld/@template.json +4 -0
- package/templates/add/components/HelloWorld/index.tsx +560 -0
- package/templates/add/tools/cursor-rules/.cursor/rules/@metadata-json.mdc +549 -0
- package/templates/add/tools/cursor-rules/.cursor/rules/component-studio.mdc +138 -0
- package/templates/add/tools/cursor-rules/.cursor/rules/index-tsx.mdc +192 -0
- package/templates/add/tools/cursor-rules/@template.json +4 -0
- package/templates/init/0-basic/@template.json +4 -0
- package/templates/init/0-basic/README.md +30 -0
- package/templates/init/0-basic/package.json +26 -0
- package/templates/init/0-basic/src/HelloWorld/@metadata.json +433 -0
- package/templates/init/0-basic/src/HelloWorld/index.tsx +560 -0
- package/templates/init/1-professional/@template.json +4 -0
- package/templates/init/1-professional/README.md +75 -0
- package/templates/init/1-professional/biome.json +36 -0
- package/templates/init/1-professional/global.d.ts +131 -0
- package/templates/init/1-professional/package.json +73 -0
- package/templates/init/1-professional/scripts/bump-version.mjs +35 -0
- package/templates/init/1-professional/src/atoms/AnimationWrapper.tsx +95 -0
- package/templates/init/1-professional/src/atoms/ArrayTable.tsx +114 -0
- package/templates/init/1-professional/src/atoms/Card.tsx +52 -0
- package/templates/init/1-professional/src/atoms/ContentWrapper.tsx +72 -0
- package/templates/init/1-professional/src/atoms/CopyrightFooter.tsx +31 -0
- package/templates/init/1-professional/src/atoms/DataDisplays.tsx +157 -0
- package/templates/init/1-professional/src/atoms/GradientTitle.tsx +64 -0
- package/templates/init/1-professional/src/atoms/Logo.tsx +58 -0
- package/templates/init/1-professional/src/atoms/index.ts +27 -0
- package/templates/init/1-professional/src/components/HelloWorld/@metadata.json +433 -0
- package/templates/init/1-professional/src/components/HelloWorld/index.tsx +224 -0
- package/templates/init/1-professional/src/type.d.ts +42 -0
- package/templates/init/1-professional/src/utils/index.ts +1 -0
- package/templates/init/1-professional/tsconfig.json +102 -0
- package/templates/init/1-professional/version +1 -0
- package/templates/init/2-blank/@template.json +4 -0
- package/templates/init/2-blank/README.md +27 -0
- package/templates/init/2-blank/package.json +26 -0
- package/templates/workspace/.component-studio-runtime/_theme.tsx +4 -0
- package/templates/workspace/.editorconfig +23 -0
- package/templates/workspace/.env +1 -0
- package/templates/workspace/.init-component-studio +0 -0
- package/templates/workspace/LICENSE +13 -0
- package/templates/workspace/README.md +127 -0
- package/templates/workspace/api/dev.ts +21 -0
- package/templates/workspace/api/src/index.ts +50 -0
- package/templates/workspace/api/src/libs/auth.ts +17 -0
- package/templates/workspace/api/src/libs/env.ts +6 -0
- package/templates/workspace/api/src/libs/logger.ts +3 -0
- package/templates/workspace/api/src/routes/index.ts +12 -0
- package/templates/workspace/api/third.d.ts +17 -0
- package/templates/workspace/biome.json +36 -0
- package/templates/workspace/blocklet.md +8 -0
- package/templates/workspace/blocklet.yml +58 -0
- package/templates/workspace/index.html +15 -0
- package/templates/workspace/logo.png +0 -0
- package/templates/workspace/package.json +125 -0
- package/templates/workspace/pnpm-workspace.yaml +3 -0
- package/templates/workspace/scripts/build-clean.mjs +6 -0
- package/templates/workspace/scripts/bump-version.mjs +39 -0
- package/templates/workspace/scripts/init-component-studio.mjs +36 -0
- package/templates/workspace/tsconfig.api.json +12 -0
- package/templates/workspace/tsconfig.json +102 -0
- package/templates/workspace/version +1 -0
- package/templates/workspace/vite-server.config.ts +39 -0
- package/templates/workspace/vite.config.ts +68 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "KEHGy3vdflE8JGrV",
|
|
3
|
+
"createdAt": "2025-03-20T16:01:56.655Z",
|
|
4
|
+
"updatedAt": "2025-03-21T01:24:04.008Z",
|
|
5
|
+
"name": "HelloWorld",
|
|
6
|
+
"description": "",
|
|
7
|
+
"properties": {
|
|
8
|
+
"gs1rn5jmxfvpxptx": {
|
|
9
|
+
"index": 0,
|
|
10
|
+
"data": {
|
|
11
|
+
"id": "gs1rn5jmxfvpxptx",
|
|
12
|
+
"key": "title",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"visible": true,
|
|
15
|
+
"locales": {
|
|
16
|
+
"zh": {
|
|
17
|
+
"name": "标题",
|
|
18
|
+
"defaultValue": "Hello World"
|
|
19
|
+
},
|
|
20
|
+
"en": {
|
|
21
|
+
"name": "Title",
|
|
22
|
+
"defaultValue": "Hello World"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"9ajrz12ik7esfk1z": {
|
|
28
|
+
"index": 1,
|
|
29
|
+
"data": {
|
|
30
|
+
"id": "9ajrz12ik7esfk1z",
|
|
31
|
+
"key": "description",
|
|
32
|
+
"type": "string",
|
|
33
|
+
"visible": true,
|
|
34
|
+
"locales": {
|
|
35
|
+
"zh": {
|
|
36
|
+
"name": "描述",
|
|
37
|
+
"defaultValue": "这是你的创意实验室,在这里可以:\n- 设计和构建各类强大组件\n- 将创意转化为可复用代码\n- 打造专属于您的组件库\n释放你的开发潜能,开始创作吧!"
|
|
38
|
+
},
|
|
39
|
+
"en": {
|
|
40
|
+
"name": "Description",
|
|
41
|
+
"defaultValue": "This is your creative lab, where you can:\n- Design and build powerful components\n- Transform ideas into reusable code\n- Create your own component library\nUnleash your development potential and start creating!"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"3ckcfvf6b7zyskk8": {
|
|
47
|
+
"index": 2,
|
|
48
|
+
"data": {
|
|
49
|
+
"id": "3ckcfvf6b7zyskk8",
|
|
50
|
+
"key": "logo",
|
|
51
|
+
"type": "url",
|
|
52
|
+
"visible": true,
|
|
53
|
+
"locales": {
|
|
54
|
+
"zh": {
|
|
55
|
+
"defaultValue": {
|
|
56
|
+
"url": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80",
|
|
57
|
+
"mediaKitUrl": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80"
|
|
58
|
+
},
|
|
59
|
+
"name": "Logo"
|
|
60
|
+
},
|
|
61
|
+
"en": {
|
|
62
|
+
"defaultValue": {
|
|
63
|
+
"url": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80",
|
|
64
|
+
"mediaKitUrl": "/.well-known/service/blocklet/logo?imageFilter=convert&f=png&h=80"
|
|
65
|
+
},
|
|
66
|
+
"name": "Logo"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"subProperties": {
|
|
70
|
+
"ML-CDw7LvtlhM_cl": {
|
|
71
|
+
"index": 0,
|
|
72
|
+
"data": {
|
|
73
|
+
"id": "ML-CDw7LvtlhM_cl",
|
|
74
|
+
"key": "url",
|
|
75
|
+
"locales": {
|
|
76
|
+
"en": {
|
|
77
|
+
"name": "url"
|
|
78
|
+
},
|
|
79
|
+
"zh": {
|
|
80
|
+
"name": "url"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"K-HYgPHtAsmO_mer": {
|
|
86
|
+
"index": 1,
|
|
87
|
+
"data": {
|
|
88
|
+
"id": "K-HYgPHtAsmO_mer",
|
|
89
|
+
"key": "mediaKitUrl",
|
|
90
|
+
"locales": {
|
|
91
|
+
"en": {
|
|
92
|
+
"name": "mediaKitUrl"
|
|
93
|
+
},
|
|
94
|
+
"zh": {
|
|
95
|
+
"name": "mediaKitUrl"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"evequmAWgWEWZLex": {
|
|
101
|
+
"index": 2,
|
|
102
|
+
"data": {
|
|
103
|
+
"id": "evequmAWgWEWZLex",
|
|
104
|
+
"key": "width",
|
|
105
|
+
"locales": {
|
|
106
|
+
"en": {
|
|
107
|
+
"name": "width"
|
|
108
|
+
},
|
|
109
|
+
"zh": {
|
|
110
|
+
"name": "width"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"poeAwflRHJeUmfLa": {
|
|
116
|
+
"index": 3,
|
|
117
|
+
"data": {
|
|
118
|
+
"id": "poeAwflRHJeUmfLa",
|
|
119
|
+
"key": "height",
|
|
120
|
+
"locales": {
|
|
121
|
+
"en": {
|
|
122
|
+
"name": "height"
|
|
123
|
+
},
|
|
124
|
+
"zh": {
|
|
125
|
+
"name": "height"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"x3lqht8ikble1itx": {
|
|
134
|
+
"index": 3,
|
|
135
|
+
"data": {
|
|
136
|
+
"id": "x3lqht8ikble1itx",
|
|
137
|
+
"key": "copyright",
|
|
138
|
+
"type": "string",
|
|
139
|
+
"visible": false,
|
|
140
|
+
"locales": {
|
|
141
|
+
"zh": {
|
|
142
|
+
"name": "版权信息",
|
|
143
|
+
"defaultValue": "由 Component Studio 提供支持"
|
|
144
|
+
},
|
|
145
|
+
"en": {
|
|
146
|
+
"name": "Copyright",
|
|
147
|
+
"defaultValue": "Powered by Component Studio"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"q0ezdj81v0m14y5m": {
|
|
153
|
+
"index": 4,
|
|
154
|
+
"data": {
|
|
155
|
+
"id": "q0ezdj81v0m14y5m",
|
|
156
|
+
"key": "number",
|
|
157
|
+
"type": "number",
|
|
158
|
+
"visible": true,
|
|
159
|
+
"locales": {
|
|
160
|
+
"zh": {
|
|
161
|
+
"name": "整数",
|
|
162
|
+
"defaultValue": 42
|
|
163
|
+
},
|
|
164
|
+
"en": {
|
|
165
|
+
"name": "Integer",
|
|
166
|
+
"defaultValue": 42
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"bl0rimfebwbencoj": {
|
|
172
|
+
"index": 5,
|
|
173
|
+
"data": {
|
|
174
|
+
"id": "bl0rimfebwbencoj",
|
|
175
|
+
"key": "decimal",
|
|
176
|
+
"type": "decimal",
|
|
177
|
+
"visible": true,
|
|
178
|
+
"locales": {
|
|
179
|
+
"zh": {
|
|
180
|
+
"name": "小数",
|
|
181
|
+
"defaultValue": 3.14
|
|
182
|
+
},
|
|
183
|
+
"en": {
|
|
184
|
+
"name": "Decimal",
|
|
185
|
+
"defaultValue": 3.14
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"gioetxz8d13jabz6": {
|
|
191
|
+
"index": 6,
|
|
192
|
+
"data": {
|
|
193
|
+
"id": "gioetxz8d13jabz6",
|
|
194
|
+
"key": "showCopyright",
|
|
195
|
+
"type": "boolean",
|
|
196
|
+
"visible": true,
|
|
197
|
+
"locales": {
|
|
198
|
+
"zh": {
|
|
199
|
+
"name": "是否展示 Copyright",
|
|
200
|
+
"defaultValue": true
|
|
201
|
+
},
|
|
202
|
+
"en": {
|
|
203
|
+
"name": "Show Description",
|
|
204
|
+
"defaultValue": true
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"yi1oj4rq1eziup1d": {
|
|
210
|
+
"index": 7,
|
|
211
|
+
"data": {
|
|
212
|
+
"id": "yi1oj4rq1eziup1d",
|
|
213
|
+
"key": "titleColor",
|
|
214
|
+
"type": "color",
|
|
215
|
+
"visible": true,
|
|
216
|
+
"locales": {
|
|
217
|
+
"zh": {
|
|
218
|
+
"defaultValue": "rgb(45, 36, 45)",
|
|
219
|
+
"name": "标题颜色"
|
|
220
|
+
},
|
|
221
|
+
"en": {
|
|
222
|
+
"defaultValue": "rgb(44, 39, 44)",
|
|
223
|
+
"name": "Title Color"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"4f49q5uidkcp5ak4": {
|
|
229
|
+
"index": 8,
|
|
230
|
+
"data": {
|
|
231
|
+
"id": "4f49q5uidkcp5ak4",
|
|
232
|
+
"key": "json",
|
|
233
|
+
"type": "json",
|
|
234
|
+
"visible": true,
|
|
235
|
+
"locales": {
|
|
236
|
+
"zh": {
|
|
237
|
+
"name": "JSON 数据",
|
|
238
|
+
"defaultValue": {
|
|
239
|
+
"foo": "-",
|
|
240
|
+
"bar": "-"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"en": {
|
|
244
|
+
"name": "JSON Data",
|
|
245
|
+
"defaultValue": {
|
|
246
|
+
"foo": "foo",
|
|
247
|
+
"bar": "bar"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"subProperties": {
|
|
252
|
+
"gpy89bsxc6ovvlsp": {
|
|
253
|
+
"index": 0,
|
|
254
|
+
"data": {
|
|
255
|
+
"id": "gpy89bsxc6ovvlsp",
|
|
256
|
+
"key": "foo",
|
|
257
|
+
"type": "string",
|
|
258
|
+
"visible": true,
|
|
259
|
+
"locales": {
|
|
260
|
+
"zh": {
|
|
261
|
+
"name": "名称",
|
|
262
|
+
"defaultValue": "-"
|
|
263
|
+
},
|
|
264
|
+
"en": {
|
|
265
|
+
"name": "Foo",
|
|
266
|
+
"defaultValue": "foo"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"1j34jdhdptp2xm5e": {
|
|
272
|
+
"index": 1,
|
|
273
|
+
"data": {
|
|
274
|
+
"id": "1j34jdhdptp2xm5e",
|
|
275
|
+
"key": "bar",
|
|
276
|
+
"type": "string",
|
|
277
|
+
"visible": true,
|
|
278
|
+
"locales": {
|
|
279
|
+
"zh": {
|
|
280
|
+
"name": "属性",
|
|
281
|
+
"defaultValue": "-"
|
|
282
|
+
},
|
|
283
|
+
"en": {
|
|
284
|
+
"name": "Bar",
|
|
285
|
+
"defaultValue": "bar"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"lbclpm6mxrp10w2k": {
|
|
294
|
+
"index": 9,
|
|
295
|
+
"data": {
|
|
296
|
+
"id": "lbclpm6mxrp10w2k",
|
|
297
|
+
"key": "array",
|
|
298
|
+
"type": "array",
|
|
299
|
+
"visible": true,
|
|
300
|
+
"locales": {
|
|
301
|
+
"zh": {
|
|
302
|
+
"name": "数组数据",
|
|
303
|
+
"defaultValue": [
|
|
304
|
+
{
|
|
305
|
+
"name": "示例用户",
|
|
306
|
+
"bio": "这是一个示例用户"
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
"en": {
|
|
311
|
+
"name": "Array Data",
|
|
312
|
+
"defaultValue": [
|
|
313
|
+
{
|
|
314
|
+
"name": "Example User",
|
|
315
|
+
"bio": "This is an example user"
|
|
316
|
+
}
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"subProperties": {
|
|
321
|
+
"1c5vl2p9cn9ryvgh": {
|
|
322
|
+
"index": 0,
|
|
323
|
+
"data": {
|
|
324
|
+
"id": "1c5vl2p9cn9ryvgh",
|
|
325
|
+
"key": "name",
|
|
326
|
+
"type": "string",
|
|
327
|
+
"visible": true,
|
|
328
|
+
"locales": {
|
|
329
|
+
"zh": {
|
|
330
|
+
"name": "姓名",
|
|
331
|
+
"defaultValue": ""
|
|
332
|
+
},
|
|
333
|
+
"en": {
|
|
334
|
+
"name": "Name",
|
|
335
|
+
"defaultValue": ""
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"c5whnccwzqqzaa0w": {
|
|
341
|
+
"index": 1,
|
|
342
|
+
"data": {
|
|
343
|
+
"id": "c5whnccwzqqzaa0w",
|
|
344
|
+
"key": "bio",
|
|
345
|
+
"type": "multiline",
|
|
346
|
+
"visible": true,
|
|
347
|
+
"locales": {
|
|
348
|
+
"zh": {
|
|
349
|
+
"name": "简介",
|
|
350
|
+
"defaultValue": ""
|
|
351
|
+
},
|
|
352
|
+
"en": {
|
|
353
|
+
"name": "Bio",
|
|
354
|
+
"defaultValue": ""
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"s0tund4p07bzizgv": {
|
|
363
|
+
"index": 10,
|
|
364
|
+
"data": {
|
|
365
|
+
"id": "s0tund4p07bzizgv",
|
|
366
|
+
"key": "yaml",
|
|
367
|
+
"type": "yaml",
|
|
368
|
+
"visible": true,
|
|
369
|
+
"locales": {
|
|
370
|
+
"zh": {
|
|
371
|
+
"name": "YAML 配置",
|
|
372
|
+
"defaultValue": ""
|
|
373
|
+
},
|
|
374
|
+
"en": {
|
|
375
|
+
"name": "YAML Configuration",
|
|
376
|
+
"defaultValue": "ya: ya\nml: ml\n"
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"subProperties": {
|
|
380
|
+
"1q8tsreh4k2mhbgs": {
|
|
381
|
+
"index": 0,
|
|
382
|
+
"data": {
|
|
383
|
+
"id": "1q8tsreh4k2mhbgs",
|
|
384
|
+
"key": "ya",
|
|
385
|
+
"type": "string",
|
|
386
|
+
"visible": true,
|
|
387
|
+
"locales": {
|
|
388
|
+
"en": {
|
|
389
|
+
"name": "Ya",
|
|
390
|
+
"defaultValue": "ya"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"09w8sncxwrj6tldi": {
|
|
396
|
+
"index": 1,
|
|
397
|
+
"data": {
|
|
398
|
+
"id": "09w8sncxwrj6tldi",
|
|
399
|
+
"key": "ml",
|
|
400
|
+
"type": "string",
|
|
401
|
+
"visible": true,
|
|
402
|
+
"locales": {
|
|
403
|
+
"en": {
|
|
404
|
+
"name": "Ml",
|
|
405
|
+
"defaultValue": "ml"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
"8e7g6c61pxcy0q4w": {
|
|
414
|
+
"index": 11,
|
|
415
|
+
"data": {
|
|
416
|
+
"id": "8e7g6c61pxcy0q4w",
|
|
417
|
+
"key": "children",
|
|
418
|
+
"type": "component",
|
|
419
|
+
"visible": true,
|
|
420
|
+
"locales": {
|
|
421
|
+
"zh": {
|
|
422
|
+
"name": "子组件",
|
|
423
|
+
"defaultValue": {}
|
|
424
|
+
},
|
|
425
|
+
"en": {
|
|
426
|
+
"name": "Children Components",
|
|
427
|
+
"defaultValue": {}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ContentWrapper,
|
|
5
|
+
GradientTitle,
|
|
6
|
+
Logo,
|
|
7
|
+
NumberDisplay,
|
|
8
|
+
JsonDisplay,
|
|
9
|
+
YamlDisplay,
|
|
10
|
+
ArrayTable,
|
|
11
|
+
CopyrightFooter,
|
|
12
|
+
AnimationWrapper,
|
|
13
|
+
} from '../../atoms';
|
|
14
|
+
import { logger } from '../../utils';
|
|
15
|
+
|
|
16
|
+
export interface BlockProps {
|
|
17
|
+
/** @description id: gs1rn5jmxfvpxptx | type: string | visible: true */
|
|
18
|
+
title?: string;
|
|
19
|
+
/** @description id: 9ajrz12ik7esfk1z | type: string | visible: true */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** @description id: 3ckcfvf6b7zyskk8 | type: url | visible: true */
|
|
22
|
+
logo?: {
|
|
23
|
+
url: string;
|
|
24
|
+
mediaKitUrl?: string;
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
};
|
|
28
|
+
/** @description id: x3lqht8ikble1itx | type: string | visible: false */
|
|
29
|
+
copyright?: string;
|
|
30
|
+
/** @description id: q0ezdj81v0m14y5m | type: number | visible: true */
|
|
31
|
+
number?: number;
|
|
32
|
+
/** @description id: bl0rimfebwbencoj | type: decimal | visible: true */
|
|
33
|
+
decimal?: number;
|
|
34
|
+
/** @description id: gioetxz8d13jabz6 | type: boolean | visible: true */
|
|
35
|
+
showCopyright?: boolean;
|
|
36
|
+
/** @description id: yi1oj4rq1eziup1d | type: color | visible: true */
|
|
37
|
+
titleColor?: string;
|
|
38
|
+
/** @description id: 4f49q5uidkcp5ak4 | type: json | visible: true */
|
|
39
|
+
json?: {
|
|
40
|
+
/** @description id: gpy89bsxc6ovvlsp | type: string | visible: true */
|
|
41
|
+
foo?: string;
|
|
42
|
+
/** @description id: 1j34jdhdptp2xm5e | type: string | visible: true */
|
|
43
|
+
bar?: string;
|
|
44
|
+
};
|
|
45
|
+
/** @description id: lbclpm6mxrp10w2k | type: array | visible: true */
|
|
46
|
+
array?: {
|
|
47
|
+
/** @description id: 1c5vl2p9cn9ryvgh | type: string | visible: true */
|
|
48
|
+
name?: string;
|
|
49
|
+
/** @description id: c5whnccwzqqzaa0w | type: multiline | visible: true */
|
|
50
|
+
bio?: string;
|
|
51
|
+
}[];
|
|
52
|
+
/** @description id: s0tund4p07bzizgv | type: yaml | visible: true */
|
|
53
|
+
yaml?: {
|
|
54
|
+
/** @description id: 1q8tsreh4k2mhbgs | type: string | visible: true */
|
|
55
|
+
ya?: string;
|
|
56
|
+
/** @description id: 09w8sncxwrj6tldi | type: string | visible: true */
|
|
57
|
+
ml?: string;
|
|
58
|
+
};
|
|
59
|
+
/** @description id: 8e7g6c61pxcy0q4w | type: component | visible: true */
|
|
60
|
+
children?: any;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Define the type of array items
|
|
64
|
+
type ArrayItem = {
|
|
65
|
+
name?: string;
|
|
66
|
+
bio?: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// default export
|
|
70
|
+
export default function BlockComponent({
|
|
71
|
+
title = 'Hello World',
|
|
72
|
+
logo,
|
|
73
|
+
description,
|
|
74
|
+
copyright = 'Powered by Component Studio',
|
|
75
|
+
number,
|
|
76
|
+
decimal,
|
|
77
|
+
showCopyright = true,
|
|
78
|
+
titleColor = '#6366F1',
|
|
79
|
+
json,
|
|
80
|
+
array,
|
|
81
|
+
yaml,
|
|
82
|
+
children,
|
|
83
|
+
}: BlockProps) {
|
|
84
|
+
// Create array table column configuration
|
|
85
|
+
const arrayColumns = [
|
|
86
|
+
{ key: 'name' as keyof ArrayItem, header: 'Name' },
|
|
87
|
+
{ key: 'bio' as keyof ArrayItem, header: 'Bio' },
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
logger.log('arrayColumns', arrayColumns);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<ContentWrapper>
|
|
94
|
+
{/* Logo area */}
|
|
95
|
+
{logo && <Logo src={typeof logo === 'object' ? logo.url : logo} width={logo?.width} height={logo?.height} />}
|
|
96
|
+
|
|
97
|
+
{/* Title area */}
|
|
98
|
+
{title && <GradientTitle title={title} startColor={titleColor} animate />}
|
|
99
|
+
|
|
100
|
+
{/* Description area */}
|
|
101
|
+
{description && (
|
|
102
|
+
<AnimationWrapper animationType="fadeSlideUp" delay="0.2s">
|
|
103
|
+
<div
|
|
104
|
+
style={{
|
|
105
|
+
color: '#4B5563',
|
|
106
|
+
padding: '1.5rem 2rem',
|
|
107
|
+
background: 'rgba(255, 255, 255, 0.8)',
|
|
108
|
+
backdropFilter: 'blur(10px)',
|
|
109
|
+
borderRadius: '16px',
|
|
110
|
+
marginTop: '1.5rem',
|
|
111
|
+
border: '1px solid rgba(255, 255, 255, 0.5)',
|
|
112
|
+
boxShadow: '0 4px 20px rgba(0, 0, 0, 0.05)',
|
|
113
|
+
whiteSpace: 'pre-wrap',
|
|
114
|
+
lineHeight: 1.7,
|
|
115
|
+
fontSize: '1.1rem',
|
|
116
|
+
}}>
|
|
117
|
+
{description}
|
|
118
|
+
</div>
|
|
119
|
+
</AnimationWrapper>
|
|
120
|
+
)}
|
|
121
|
+
|
|
122
|
+
{/* Data display area */}
|
|
123
|
+
{(number !== undefined || decimal !== undefined || json) && (
|
|
124
|
+
<div
|
|
125
|
+
className="data-section"
|
|
126
|
+
style={{
|
|
127
|
+
display: 'flex',
|
|
128
|
+
gap: '1.5rem',
|
|
129
|
+
margin: '2rem 0',
|
|
130
|
+
flexWrap: 'wrap',
|
|
131
|
+
justifyContent: 'center',
|
|
132
|
+
}}>
|
|
133
|
+
{/* Number display */}
|
|
134
|
+
{(number !== undefined || decimal !== undefined) && <NumberDisplay integer={number} decimal={decimal} />}
|
|
135
|
+
|
|
136
|
+
{/* JSON data display */}
|
|
137
|
+
{json && <JsonDisplay data={json} />}
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
|
|
141
|
+
{/* Array data table */}
|
|
142
|
+
{array && array.length > 0 && <ArrayTable<ArrayItem> data={array} columns={arrayColumns} />}
|
|
143
|
+
|
|
144
|
+
{/* YAML display */}
|
|
145
|
+
{yaml && <YamlDisplay data={yaml} />}
|
|
146
|
+
|
|
147
|
+
{/* Sub components */}
|
|
148
|
+
{children && (
|
|
149
|
+
<AnimationWrapper animationType="fadeSlideUp" delay="0.5s">
|
|
150
|
+
<div
|
|
151
|
+
style={{
|
|
152
|
+
margin: '2.5rem 0',
|
|
153
|
+
padding: '2rem',
|
|
154
|
+
borderRadius: '16px',
|
|
155
|
+
background: 'rgba(255, 255, 255, 0.7)',
|
|
156
|
+
backdropFilter: 'blur(10px)',
|
|
157
|
+
border: '1px solid rgba(99, 102, 241, 0.2)',
|
|
158
|
+
boxShadow: '0 10px 30px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03)',
|
|
159
|
+
}}>
|
|
160
|
+
<h3
|
|
161
|
+
style={{
|
|
162
|
+
textAlign: 'center',
|
|
163
|
+
marginTop: '0',
|
|
164
|
+
marginBottom: '1.5rem',
|
|
165
|
+
color: '#4F46E5',
|
|
166
|
+
fontSize: '1.5rem',
|
|
167
|
+
fontWeight: 600,
|
|
168
|
+
}}>
|
|
169
|
+
Children Components
|
|
170
|
+
</h3>
|
|
171
|
+
{children}
|
|
172
|
+
</div>
|
|
173
|
+
</AnimationWrapper>
|
|
174
|
+
)}
|
|
175
|
+
|
|
176
|
+
{/* Copyright information */}
|
|
177
|
+
{showCopyright && copyright && <CopyrightFooter text={copyright} />}
|
|
178
|
+
</ContentWrapper>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// export edit component
|
|
183
|
+
export const EditComponent: React.FC<BlockProps & { onChange?: (value: BlockProps) => void }> = ({
|
|
184
|
+
onChange,
|
|
185
|
+
...props
|
|
186
|
+
}) => {
|
|
187
|
+
return (
|
|
188
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
189
|
+
<div
|
|
190
|
+
style={{
|
|
191
|
+
fontSize: '14px',
|
|
192
|
+
fontWeight: 500,
|
|
193
|
+
color: '#333',
|
|
194
|
+
padding: '8px 0',
|
|
195
|
+
borderBottom: '1px solid #eee',
|
|
196
|
+
}}>
|
|
197
|
+
Extra Edit Component
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
{/* Copyright information input */}
|
|
201
|
+
<div>
|
|
202
|
+
<label htmlFor="copyright-input" style={{ display: 'block', marginBottom: '4px', fontSize: '14px' }}>
|
|
203
|
+
Copyright Text
|
|
204
|
+
</label>
|
|
205
|
+
<input
|
|
206
|
+
id="copyright-input"
|
|
207
|
+
type="text"
|
|
208
|
+
style={{
|
|
209
|
+
width: '100%',
|
|
210
|
+
padding: '8px 12px',
|
|
211
|
+
border: '1px solid #ddd',
|
|
212
|
+
borderRadius: '4px',
|
|
213
|
+
fontSize: '14px',
|
|
214
|
+
transition: 'border-color 0.3s',
|
|
215
|
+
outline: 'none',
|
|
216
|
+
}}
|
|
217
|
+
value={props.copyright || ''}
|
|
218
|
+
onChange={(e) => onChange?.({ ...props, copyright: e.target.value })}
|
|
219
|
+
placeholder="Please Input Copyright"
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface TextProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
type?: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
style: {
|
|
6
|
+
color?: string;
|
|
7
|
+
fontSize?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RichDescriptionProps {
|
|
12
|
+
list: Array<
|
|
13
|
+
| TextProps
|
|
14
|
+
| {
|
|
15
|
+
id?: string;
|
|
16
|
+
type: 'image';
|
|
17
|
+
url: string;
|
|
18
|
+
alt?: string;
|
|
19
|
+
width?: string;
|
|
20
|
+
height?: string;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
id?: string;
|
|
24
|
+
type: 'link';
|
|
25
|
+
text: string;
|
|
26
|
+
color?: 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success';
|
|
27
|
+
variant?: 'text' | 'outlined' | 'contained' | 'icon';
|
|
28
|
+
startIcon?: string;
|
|
29
|
+
endIcon?: string;
|
|
30
|
+
size?: 'small' | 'medium' | 'large';
|
|
31
|
+
url: string;
|
|
32
|
+
target?: '_blank' | '_self';
|
|
33
|
+
}
|
|
34
|
+
>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ImageProps {
|
|
38
|
+
url: string;
|
|
39
|
+
mediaKitUrl?: string;
|
|
40
|
+
width?: string;
|
|
41
|
+
height?: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const logger = console;
|