@nocobase/plugin-theme-editor 0.12.0-alpha.4 → 0.13.0-alpha.1

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.
@@ -79,11 +79,12 @@
79
79
  return algorithm.toString();
80
80
  }
81
81
  function changeAlgorithmFromStringToFunction(themeConfig) {
82
+ var _a2;
82
83
  themeConfig = _$1.cloneDeep(themeConfig);
83
84
  if (_$1.isString(themeConfig.config.algorithm)) {
84
85
  themeConfig.config.algorithm = antd.theme[themeConfig.config.algorithm];
85
86
  }
86
- if (Array.isArray(themeConfig.config.algorithm)) {
87
+ if (Array.isArray((_a2 = themeConfig.config) == null ? void 0 : _a2.algorithm)) {
87
88
  themeConfig.config.algorithm = themeConfig.config.algorithm.map((item) => {
88
89
  if (_$1.isString(item)) {
89
90
  return antd.theme[item];
@@ -16347,7 +16348,7 @@
16347
16348
  ) });
16348
16349
  };
16349
16350
  const ThemeCard = (props2) => {
16350
- var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
16351
+ var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
16351
16352
  const {
16352
16353
  theme: currentTheme,
16353
16354
  setTheme,
@@ -16585,7 +16586,7 @@
16585
16586
  {
16586
16587
  hoverable: true,
16587
16588
  extra,
16588
- title: t2(item.config.name),
16589
+ title: t2((_p = item.config) == null ? void 0 : _p.name),
16589
16590
  size: "small",
16590
16591
  style: cardStyle,
16591
16592
  headStyle: { minHeight: 38 },
@@ -0,0 +1,230 @@
1
+ declare const _default: {
2
+ openapi: string;
3
+ info: {
4
+ title: string;
5
+ };
6
+ components: {
7
+ schemas: {
8
+ Theme: {
9
+ type: string;
10
+ properties: {
11
+ id: {
12
+ type: string;
13
+ };
14
+ config: {
15
+ type: string;
16
+ properties: {
17
+ name: {
18
+ type: string;
19
+ };
20
+ token: {
21
+ type: string;
22
+ additionalProperties: boolean;
23
+ };
24
+ };
25
+ required: string[];
26
+ additionalProperties: boolean;
27
+ };
28
+ optional: {
29
+ type: string;
30
+ };
31
+ isBuiltIn: {
32
+ type: string;
33
+ };
34
+ updatedAt: {
35
+ type: string;
36
+ format: string;
37
+ };
38
+ createdAt: {
39
+ type: string;
40
+ format: string;
41
+ };
42
+ };
43
+ required: string[];
44
+ additionalProperties: boolean;
45
+ };
46
+ };
47
+ };
48
+ tags: any[];
49
+ paths: {
50
+ '/themeConfig:list': {
51
+ get: {
52
+ tags: string[];
53
+ description: string;
54
+ parameters: any[];
55
+ responses: {
56
+ '200': {
57
+ description: string;
58
+ content: {
59
+ 'application/json': {
60
+ schema: {
61
+ type: string;
62
+ items: {
63
+ $ref: string;
64
+ };
65
+ };
66
+ };
67
+ };
68
+ };
69
+ '401': {
70
+ description: string;
71
+ };
72
+ '404': {
73
+ description: string;
74
+ };
75
+ };
76
+ };
77
+ };
78
+ '/themeConfig:create': {
79
+ post: {
80
+ tags: string[];
81
+ description: string;
82
+ requestBody: {
83
+ required: boolean;
84
+ content: {
85
+ 'application/json': {
86
+ schema: {
87
+ type: string;
88
+ properties: {
89
+ config: {
90
+ type: string;
91
+ properties: {
92
+ name: {
93
+ type: string;
94
+ };
95
+ token: {
96
+ type: string;
97
+ };
98
+ };
99
+ required: string[];
100
+ additionalProperties: boolean;
101
+ };
102
+ optional: {
103
+ type: string;
104
+ };
105
+ isBuiltIn: {
106
+ type: string;
107
+ };
108
+ };
109
+ required: string[];
110
+ additionalProperties: boolean;
111
+ };
112
+ };
113
+ };
114
+ };
115
+ responses: {
116
+ '200': {
117
+ description: string;
118
+ content: {
119
+ 'application/json': {
120
+ schema: {
121
+ $ref: string;
122
+ };
123
+ };
124
+ };
125
+ };
126
+ '400': {
127
+ description: string;
128
+ };
129
+ '401': {
130
+ description: string;
131
+ };
132
+ };
133
+ };
134
+ };
135
+ '/themeConfig:update': {
136
+ post: {
137
+ tags: string[];
138
+ description: string;
139
+ parameters: {
140
+ name: string;
141
+ in: string;
142
+ description: string;
143
+ required: boolean;
144
+ schema: {
145
+ type: string;
146
+ };
147
+ }[];
148
+ requestBody: {
149
+ required: boolean;
150
+ content: {
151
+ 'application/json': {
152
+ schema: {
153
+ type: string;
154
+ properties: {
155
+ config: {
156
+ type: string;
157
+ properties: {
158
+ name: {
159
+ type: string;
160
+ };
161
+ token: {
162
+ type: string;
163
+ };
164
+ };
165
+ additionalProperties: boolean;
166
+ };
167
+ optional: {
168
+ type: string;
169
+ };
170
+ isBuiltIn: {
171
+ type: string;
172
+ };
173
+ };
174
+ additionalProperties: boolean;
175
+ };
176
+ };
177
+ };
178
+ };
179
+ responses: {
180
+ '200': {
181
+ description: string;
182
+ content: {
183
+ 'application/json': {
184
+ schema: {
185
+ $ref: string;
186
+ };
187
+ };
188
+ };
189
+ };
190
+ '400': {
191
+ description: string;
192
+ };
193
+ '401': {
194
+ description: string;
195
+ };
196
+ '404': {
197
+ description: string;
198
+ };
199
+ };
200
+ };
201
+ };
202
+ '/themeConfig:destroy': {
203
+ post: {
204
+ tags: string[];
205
+ description: string;
206
+ parameters: {
207
+ name: string;
208
+ in: string;
209
+ description: string;
210
+ required: boolean;
211
+ schema: {
212
+ type: string;
213
+ };
214
+ }[];
215
+ responses: {
216
+ '204': {
217
+ description: string;
218
+ };
219
+ '401': {
220
+ description: string;
221
+ };
222
+ '404': {
223
+ description: string;
224
+ };
225
+ };
226
+ };
227
+ };
228
+ };
229
+ };
230
+ export default _default;
@@ -0,0 +1,227 @@
1
+ 'use strict';
2
+
3
+ var swagger_default = {
4
+ openapi: "3.0.2",
5
+ info: {
6
+ title: "NocoBase API - Theme editor plugin"
7
+ },
8
+ components: {
9
+ schemas: {
10
+ Theme: {
11
+ type: "object",
12
+ properties: {
13
+ id: {
14
+ type: "integer"
15
+ },
16
+ config: {
17
+ type: "object",
18
+ properties: {
19
+ name: {
20
+ type: "string"
21
+ },
22
+ token: {
23
+ type: "object",
24
+ additionalProperties: false
25
+ }
26
+ },
27
+ required: ["name"],
28
+ additionalProperties: false
29
+ },
30
+ optional: {
31
+ type: "boolean"
32
+ },
33
+ isBuiltIn: {
34
+ type: "boolean"
35
+ },
36
+ updatedAt: {
37
+ type: "string",
38
+ format: "date-time"
39
+ },
40
+ createdAt: {
41
+ type: "string",
42
+ format: "date-time"
43
+ }
44
+ },
45
+ required: ["id", "config", "optional", "isBuiltIn"],
46
+ additionalProperties: false
47
+ }
48
+ }
49
+ },
50
+ tags: [],
51
+ paths: {
52
+ "/themeConfig:list": {
53
+ get: {
54
+ tags: ["themeConfig"],
55
+ description: "Get a list of themes",
56
+ parameters: [],
57
+ responses: {
58
+ "200": {
59
+ description: "OK",
60
+ content: {
61
+ "application/json": {
62
+ schema: {
63
+ type: "array",
64
+ items: {
65
+ $ref: "#/components/schemas/Theme"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "401": {
72
+ description: "Unauthorized"
73
+ },
74
+ "404": {
75
+ description: "Not Found"
76
+ }
77
+ }
78
+ }
79
+ },
80
+ "/themeConfig:create": {
81
+ post: {
82
+ tags: ["themeConfig"],
83
+ description: "Create a new theme",
84
+ requestBody: {
85
+ required: true,
86
+ content: {
87
+ "application/json": {
88
+ schema: {
89
+ type: "object",
90
+ properties: {
91
+ config: {
92
+ type: "object",
93
+ properties: {
94
+ name: { type: "string" },
95
+ token: {
96
+ type: "object"
97
+ }
98
+ // 可以根据需要添加其他属性
99
+ },
100
+ required: ["name"],
101
+ additionalProperties: false
102
+ },
103
+ optional: { type: "boolean" },
104
+ isBuiltIn: { type: "boolean" }
105
+ },
106
+ required: ["config"],
107
+ additionalProperties: false
108
+ }
109
+ }
110
+ }
111
+ },
112
+ responses: {
113
+ "200": {
114
+ description: "OK",
115
+ content: {
116
+ "application/json": {
117
+ schema: {
118
+ $ref: "#/components/schemas/Theme"
119
+ }
120
+ }
121
+ }
122
+ },
123
+ "400": {
124
+ description: "Bad Request"
125
+ },
126
+ "401": {
127
+ description: "Unauthorized"
128
+ }
129
+ }
130
+ }
131
+ },
132
+ "/themeConfig:update": {
133
+ post: {
134
+ tags: ["themeConfig"],
135
+ description: "Update an existing theme",
136
+ parameters: [
137
+ {
138
+ name: "id",
139
+ in: "path",
140
+ description: "ID of the theme to update",
141
+ required: true,
142
+ schema: {
143
+ type: "string"
144
+ }
145
+ }
146
+ ],
147
+ requestBody: {
148
+ required: true,
149
+ content: {
150
+ "application/json": {
151
+ schema: {
152
+ type: "object",
153
+ properties: {
154
+ config: {
155
+ type: "object",
156
+ properties: {
157
+ name: { type: "string" },
158
+ token: {
159
+ type: "object"
160
+ }
161
+ // 可以根据需要添加其他属性
162
+ },
163
+ additionalProperties: false
164
+ },
165
+ optional: { type: "boolean" },
166
+ isBuiltIn: { type: "boolean" }
167
+ },
168
+ additionalProperties: false
169
+ }
170
+ }
171
+ }
172
+ },
173
+ responses: {
174
+ "200": {
175
+ description: "OK",
176
+ content: {
177
+ "application/json": {
178
+ schema: {
179
+ $ref: "#/components/schemas/Theme"
180
+ }
181
+ }
182
+ }
183
+ },
184
+ "400": {
185
+ description: "Bad Request"
186
+ },
187
+ "401": {
188
+ description: "Unauthorized"
189
+ },
190
+ "404": {
191
+ description: "Not Found"
192
+ }
193
+ }
194
+ }
195
+ },
196
+ "/themeConfig:destroy": {
197
+ post: {
198
+ tags: ["themeConfig"],
199
+ description: "Delete an existing theme",
200
+ parameters: [
201
+ {
202
+ name: "id",
203
+ in: "path",
204
+ description: "ID of the theme to delete",
205
+ required: true,
206
+ schema: {
207
+ type: "string"
208
+ }
209
+ }
210
+ ],
211
+ responses: {
212
+ "204": {
213
+ description: "No Content"
214
+ },
215
+ "401": {
216
+ description: "Unauthorized"
217
+ },
218
+ "404": {
219
+ description: "Not Found"
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+ };
226
+
227
+ module.exports = swagger_default;
package/dist/types.d.ts CHANGED
@@ -6,7 +6,7 @@ export type ThemeConfig = Config & {
6
6
  export interface ThemeItem {
7
7
  id: number;
8
8
  /** 主题配置内容,一个 JSON 字符串 */
9
- config: ThemeConfig;
9
+ config: ThemeConfig | null;
10
10
  /** 主题是否可选 */
11
11
  optional: boolean;
12
12
  isBuiltIn?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-theme-editor",
3
- "version": "0.12.0-alpha.4",
3
+ "version": "0.13.0-alpha.1",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Theme editor",
6
6
  "displayName.zh-CN": "主题编辑器",
@@ -30,5 +30,5 @@
30
30
  "@nocobase/test": "0.x",
31
31
  "@nocobase/utils": "0.x"
32
32
  },
33
- "gitHead": "215dc3b2437c501ca903b56cc378ab5e81c8a11c"
33
+ "gitHead": "0ebd4e85a1b0b0d0943768ab6cb5c3d824562239"
34
34
  }