@blocklet/theme 2.13.7

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/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2018-2025 ArcBlock
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Blocklet Theme
2
+
3
+ A preset MUI-based theme configuration designed for use with Blocklet.
@@ -0,0 +1,438 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // node_modules/deepmerge/dist/cjs.js
33
+ var require_cjs = __commonJS({
34
+ "node_modules/deepmerge/dist/cjs.js"(exports2, module2) {
35
+ "use strict";
36
+ var isMergeableObject = function isMergeableObject2(value) {
37
+ return isNonNullObject(value) && !isSpecial(value);
38
+ };
39
+ function isNonNullObject(value) {
40
+ return !!value && typeof value === "object";
41
+ }
42
+ function isSpecial(value) {
43
+ var stringValue = Object.prototype.toString.call(value);
44
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
45
+ }
46
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
47
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
48
+ function isReactElement(value) {
49
+ return value.$$typeof === REACT_ELEMENT_TYPE;
50
+ }
51
+ function emptyTarget(val) {
52
+ return Array.isArray(val) ? [] : {};
53
+ }
54
+ function cloneUnlessOtherwiseSpecified(value, options) {
55
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
56
+ }
57
+ function defaultArrayMerge(target, source, options) {
58
+ return target.concat(source).map(function(element) {
59
+ return cloneUnlessOtherwiseSpecified(element, options);
60
+ });
61
+ }
62
+ function getMergeFunction(key, options) {
63
+ if (!options.customMerge) {
64
+ return deepmerge2;
65
+ }
66
+ var customMerge = options.customMerge(key);
67
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
68
+ }
69
+ function getEnumerableOwnPropertySymbols(target) {
70
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
71
+ return Object.propertyIsEnumerable.call(target, symbol);
72
+ }) : [];
73
+ }
74
+ function getKeys(target) {
75
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
76
+ }
77
+ function propertyIsOnObject(object, property) {
78
+ try {
79
+ return property in object;
80
+ } catch (_) {
81
+ return false;
82
+ }
83
+ }
84
+ function propertyIsUnsafe(target, key) {
85
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
86
+ }
87
+ function mergeObject(target, source, options) {
88
+ var destination = {};
89
+ if (options.isMergeableObject(target)) {
90
+ getKeys(target).forEach(function(key) {
91
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
92
+ });
93
+ }
94
+ getKeys(source).forEach(function(key) {
95
+ if (propertyIsUnsafe(target, key)) {
96
+ return;
97
+ }
98
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
99
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
100
+ } else {
101
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
102
+ }
103
+ });
104
+ return destination;
105
+ }
106
+ function deepmerge2(target, source, options) {
107
+ options = options || {};
108
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
109
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
110
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
111
+ var sourceIsArray = Array.isArray(source);
112
+ var targetIsArray = Array.isArray(target);
113
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
114
+ if (!sourceAndTargetTypesMatch) {
115
+ return cloneUnlessOtherwiseSpecified(source, options);
116
+ } else if (sourceIsArray) {
117
+ return options.arrayMerge(target, source, options);
118
+ } else {
119
+ return mergeObject(target, source, options);
120
+ }
121
+ }
122
+ deepmerge2.all = function deepmergeAll(array, options) {
123
+ if (!Array.isArray(array)) {
124
+ throw new Error("first argument should be an array");
125
+ }
126
+ return array.reduce(function(prev, next) {
127
+ return deepmerge2(prev, next, options);
128
+ }, {});
129
+ };
130
+ var deepmerge_1 = deepmerge2;
131
+ module2.exports = deepmerge_1;
132
+ }
133
+ });
134
+
135
+ // src/index.ts
136
+ var src_exports = {};
137
+ __export(src_exports, {
138
+ BLOCKLET_THEME_DARK: () => BLOCKLET_THEME_DARK,
139
+ BLOCKLET_THEME_LIGHT: () => BLOCKLET_THEME_LIGHT,
140
+ DEFAULT_FONTS: () => DEFAULT_FONTS
141
+ });
142
+ module.exports = __toCommonJS(src_exports);
143
+ var import_deepmerge = __toESM(require_cjs());
144
+ var DEFAULT_FONTS = ["Roboto", "Helvetica", "Arial", "sans-serif"];
145
+ var grey = {
146
+ 50: "#fafafa",
147
+ 100: "#f5f5f5",
148
+ 200: "#eeeeee",
149
+ 300: "#e0e0e0",
150
+ 400: "#bdbdbd",
151
+ 500: "#9e9e9e",
152
+ 600: "#757575",
153
+ 700: "#616161",
154
+ 800: "#424242",
155
+ 900: "#212121",
156
+ A100: "#d5d5d5",
157
+ A200: "#aaaaaa",
158
+ A400: "#303030",
159
+ A700: "#616161"
160
+ };
161
+ var paletteLight = {
162
+ mode: "light",
163
+ primary: { main: "#1DC1C7", contrastText: "#fff" },
164
+ secondary: { main: "#0086FF", contrastText: "#fff" },
165
+ error: { main: "#F16E6E", contrastText: "#fff" },
166
+ warning: { main: "#DE9E37", contrastText: "#fff" },
167
+ info: { main: "#0775F8", contrastText: "#fff" },
168
+ success: { main: "#34BE74", contrastText: "#fff" },
169
+ grey,
170
+ text: {
171
+ primary: "rgba(0, 0, 0, 0.87)",
172
+ secondary: "rgba(0, 0, 0, 0.54)",
173
+ disabled: "rgba(0, 0, 0, 0.38)",
174
+ hint: "rgba(0, 0, 0, 0.38)"
175
+ },
176
+ divider: "#eeeeee",
177
+ background: {
178
+ default: "#fff",
179
+ paper: "#fff"
180
+ },
181
+ common: {
182
+ black: "#000",
183
+ white: "#fff"
184
+ },
185
+ // @extends palette
186
+ storeSecondary: { main: "#EBFEFF", contrastText: "#fff" },
187
+ // 适用于 did 相关的组件, 如果某些产品整体风格是 did 系列, 可以扩展出一个 did 系列的 theme
188
+ did: {
189
+ primary: "#4598FA",
190
+ secondary: "#49C3AD"
191
+ }
192
+ };
193
+ var BLOCKLET_THEME_LIGHT = {
194
+ palette: paletteLight,
195
+ typography: {
196
+ fontSize: 14,
197
+ fontFamily: DEFAULT_FONTS.join(","),
198
+ button: {
199
+ fontWeight: 700,
200
+ textTransform: "none"
201
+ },
202
+ allVariants: {
203
+ textTransform: "none"
204
+ },
205
+ h1: {
206
+ fontSize: "1.875rem",
207
+ lineHeight: 1.2,
208
+ fontWeight: 700
209
+ },
210
+ h2: {
211
+ fontSize: "1.5rem",
212
+ lineHeight: 1.3333333,
213
+ fontWeight: 700
214
+ },
215
+ h3: {
216
+ fontSize: "1.25rem",
217
+ lineHeight: 1.4,
218
+ fontWeight: 700
219
+ },
220
+ h4: {
221
+ fontSize: "1.125rem",
222
+ lineHeight: 1.55,
223
+ fontWeight: 600
224
+ },
225
+ h5: {
226
+ fontSize: "1rem",
227
+ lineHeight: 1.5,
228
+ fontWeight: 700
229
+ },
230
+ h6: {
231
+ fontSize: "0.875rem",
232
+ lineHeight: 1.43,
233
+ fontWeight: 700
234
+ },
235
+ subtitle1: {
236
+ fontSize: "1rem",
237
+ lineHeight: 1.5,
238
+ fontWeight: 500
239
+ },
240
+ subtitle2: {
241
+ fontSize: "0.875rem",
242
+ lineHeight: 1.43,
243
+ fontWeight: 500
244
+ },
245
+ body1: {
246
+ fontSize: "1rem",
247
+ lineHeight: 1.75
248
+ },
249
+ body2: {
250
+ fontSize: "0.875rem",
251
+ lineHeight: 1.43
252
+ },
253
+ caption: {
254
+ fontSize: "0.75rem",
255
+ lineHeight: 1.33
256
+ },
257
+ overline: {
258
+ fontSize: "0.75rem",
259
+ lineHeight: 1.33,
260
+ fontWeight: 500
261
+ },
262
+ // @extends-start
263
+ color: {
264
+ // 此处 #222222 必须硬编码, layout/sidebar.js -> Icon/image 加载图片时 color 会影响加载路径
265
+ // TODO: 此处硬编码的色值后面需要改为 colors.grey[900],
266
+ // 或者如果可以的话直接删掉 typography#color, 文本颜色建议使用 theme.palette.text 中的色值?
267
+ // layout 组件建议重构, sidebar 中建议使用 icon 替换 img (#366)
268
+ main: "#222222",
269
+ gray: paletteLight.grey[500]
270
+ }
271
+ },
272
+ components: {
273
+ MuiButton: {
274
+ styleOverrides: {
275
+ root: {
276
+ boxShadow: "none"
277
+ }
278
+ }
279
+ },
280
+ MuiButtonGroup: {
281
+ styleOverrides: {
282
+ root: {
283
+ boxShadow: "none"
284
+ }
285
+ }
286
+ },
287
+ MuiTableCell: {
288
+ styleOverrides: {
289
+ sizeSmall: {
290
+ borderBottomWidth: "0",
291
+ paddingTop: "8px",
292
+ paddingBottom: "8px",
293
+ paddingLeft: 0,
294
+ paddingRight: "20px"
295
+ },
296
+ sizeMedium: {
297
+ borderBottomWidth: "0",
298
+ paddingTop: "14px",
299
+ paddingBottom: "14px",
300
+ paddingLeft: 0,
301
+ paddingRight: "30px"
302
+ },
303
+ head: {
304
+ textTransform: "uppercase",
305
+ color: paletteLight.grey[900]
306
+ },
307
+ body: {
308
+ color: paletteLight.grey[900]
309
+ }
310
+ }
311
+ },
312
+ MuiTableRow: {
313
+ styleOverrides: {
314
+ root: {
315
+ "&:nth-child(even)": {
316
+ backgroundColor: "rgba(0, 0, 0, 0.02)"
317
+ }
318
+ },
319
+ head: {
320
+ backgroundColor: "transparent"
321
+ }
322
+ }
323
+ }
324
+ },
325
+ breakpoints: {
326
+ values: {
327
+ xs: 0,
328
+ sm: 600,
329
+ md: 960,
330
+ lg: 1280,
331
+ xl: 1920
332
+ }
333
+ }
334
+ };
335
+ var paletteDark = {
336
+ mode: "dark",
337
+ common: {
338
+ black: "#000",
339
+ white: "#fff"
340
+ },
341
+ primary: {
342
+ main: "#90caf9",
343
+ light: "#e3f2fd",
344
+ dark: "#42a5f5",
345
+ contrastText: "rgba(0, 0, 0, 0.87)"
346
+ },
347
+ secondary: {
348
+ main: "#ce93d8",
349
+ light: "#f3e5f5",
350
+ dark: "#ab47bc",
351
+ contrastText: "rgba(0, 0, 0, 0.87)"
352
+ },
353
+ error: {
354
+ main: "#f44336",
355
+ light: "#e57373",
356
+ dark: "#d32f2f",
357
+ contrastText: "#fff"
358
+ },
359
+ warning: {
360
+ main: "#ffa726",
361
+ light: "#ffb74d",
362
+ dark: "#f57c00",
363
+ contrastText: "rgba(0, 0, 0, 0.87)"
364
+ },
365
+ info: {
366
+ main: "#29b6f6",
367
+ light: "#4fc3f7",
368
+ dark: "#0288d1",
369
+ contrastText: "rgba(0, 0, 0, 0.87)"
370
+ },
371
+ success: {
372
+ main: "#66bb6a",
373
+ light: "#81c784",
374
+ dark: "#388e3c",
375
+ contrastText: "rgba(0, 0, 0, 0.87)"
376
+ },
377
+ contrastThreshold: 3,
378
+ tonalOffset: 0.2,
379
+ text: {
380
+ primary: "#fff",
381
+ secondary: "rgba(255, 255, 255, 0.7)",
382
+ disabled: "rgba(255, 255, 255, 0.5)"
383
+ },
384
+ divider: "rgba(255, 255, 255, 0.12)",
385
+ background: {
386
+ paper: "#212121",
387
+ default: "#212121"
388
+ },
389
+ action: {
390
+ active: "#fff",
391
+ hover: "rgba(255, 255, 255, 0.08)",
392
+ hoverOpacity: 0.08,
393
+ selected: "rgba(255, 255, 255, 0.16)",
394
+ selectedOpacity: 0.16,
395
+ disabled: "rgba(255, 255, 255, 0.3)",
396
+ disabledBackground: "rgba(255, 255, 255, 0.12)",
397
+ disabledOpacity: 0.38,
398
+ focus: "rgba(255, 255, 255, 0.12)",
399
+ focusOpacity: 0.12,
400
+ activatedOpacity: 0.24
401
+ }
402
+ };
403
+ var BLOCKLET_THEME_DARK = (0, import_deepmerge.default)(BLOCKLET_THEME_LIGHT, {
404
+ palette: paletteDark,
405
+ typography: {
406
+ // @extends-start
407
+ color: {
408
+ main: "#fff",
409
+ gray: grey[300]
410
+ }
411
+ },
412
+ components: {
413
+ MuiTableCell: {
414
+ styleOverrides: {
415
+ head: {
416
+ textTransform: "uppercase",
417
+ color: grey[300]
418
+ },
419
+ body: {
420
+ color: grey[300]
421
+ }
422
+ }
423
+ },
424
+ MuiTableRow: {
425
+ root: {
426
+ "&:nth-child(even)": {
427
+ backgroundColor: "rgba(255, 255, 255, 0.02)"
428
+ }
429
+ }
430
+ }
431
+ }
432
+ });
433
+ // Annotate the CommonJS export names for ESM import in node:
434
+ 0 && (module.exports = {
435
+ BLOCKLET_THEME_DARK,
436
+ BLOCKLET_THEME_LIGHT,
437
+ DEFAULT_FONTS
438
+ });
@@ -0,0 +1,425 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // node_modules/deepmerge/dist/cjs.js
28
+ var require_cjs = __commonJS({
29
+ "node_modules/deepmerge/dist/cjs.js"(exports, module) {
30
+ "use strict";
31
+ var isMergeableObject = function isMergeableObject2(value) {
32
+ return isNonNullObject(value) && !isSpecial(value);
33
+ };
34
+ function isNonNullObject(value) {
35
+ return !!value && typeof value === "object";
36
+ }
37
+ function isSpecial(value) {
38
+ var stringValue = Object.prototype.toString.call(value);
39
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
40
+ }
41
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
42
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
43
+ function isReactElement(value) {
44
+ return value.$$typeof === REACT_ELEMENT_TYPE;
45
+ }
46
+ function emptyTarget(val) {
47
+ return Array.isArray(val) ? [] : {};
48
+ }
49
+ function cloneUnlessOtherwiseSpecified(value, options) {
50
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
51
+ }
52
+ function defaultArrayMerge(target, source, options) {
53
+ return target.concat(source).map(function(element) {
54
+ return cloneUnlessOtherwiseSpecified(element, options);
55
+ });
56
+ }
57
+ function getMergeFunction(key, options) {
58
+ if (!options.customMerge) {
59
+ return deepmerge2;
60
+ }
61
+ var customMerge = options.customMerge(key);
62
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
63
+ }
64
+ function getEnumerableOwnPropertySymbols(target) {
65
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
66
+ return Object.propertyIsEnumerable.call(target, symbol);
67
+ }) : [];
68
+ }
69
+ function getKeys(target) {
70
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
71
+ }
72
+ function propertyIsOnObject(object, property) {
73
+ try {
74
+ return property in object;
75
+ } catch (_) {
76
+ return false;
77
+ }
78
+ }
79
+ function propertyIsUnsafe(target, key) {
80
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
81
+ }
82
+ function mergeObject(target, source, options) {
83
+ var destination = {};
84
+ if (options.isMergeableObject(target)) {
85
+ getKeys(target).forEach(function(key) {
86
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
87
+ });
88
+ }
89
+ getKeys(source).forEach(function(key) {
90
+ if (propertyIsUnsafe(target, key)) {
91
+ return;
92
+ }
93
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
94
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
95
+ } else {
96
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
97
+ }
98
+ });
99
+ return destination;
100
+ }
101
+ function deepmerge2(target, source, options) {
102
+ options = options || {};
103
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
104
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
105
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
106
+ var sourceIsArray = Array.isArray(source);
107
+ var targetIsArray = Array.isArray(target);
108
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
109
+ if (!sourceAndTargetTypesMatch) {
110
+ return cloneUnlessOtherwiseSpecified(source, options);
111
+ } else if (sourceIsArray) {
112
+ return options.arrayMerge(target, source, options);
113
+ } else {
114
+ return mergeObject(target, source, options);
115
+ }
116
+ }
117
+ deepmerge2.all = function deepmergeAll(array, options) {
118
+ if (!Array.isArray(array)) {
119
+ throw new Error("first argument should be an array");
120
+ }
121
+ return array.reduce(function(prev, next) {
122
+ return deepmerge2(prev, next, options);
123
+ }, {});
124
+ };
125
+ var deepmerge_1 = deepmerge2;
126
+ module.exports = deepmerge_1;
127
+ }
128
+ });
129
+
130
+ // src/index.ts
131
+ var import_deepmerge = __toESM(require_cjs());
132
+ var DEFAULT_FONTS = ["Roboto", "Helvetica", "Arial", "sans-serif"];
133
+ var grey = {
134
+ 50: "#fafafa",
135
+ 100: "#f5f5f5",
136
+ 200: "#eeeeee",
137
+ 300: "#e0e0e0",
138
+ 400: "#bdbdbd",
139
+ 500: "#9e9e9e",
140
+ 600: "#757575",
141
+ 700: "#616161",
142
+ 800: "#424242",
143
+ 900: "#212121",
144
+ A100: "#d5d5d5",
145
+ A200: "#aaaaaa",
146
+ A400: "#303030",
147
+ A700: "#616161"
148
+ };
149
+ var paletteLight = {
150
+ mode: "light",
151
+ primary: { main: "#1DC1C7", contrastText: "#fff" },
152
+ secondary: { main: "#0086FF", contrastText: "#fff" },
153
+ error: { main: "#F16E6E", contrastText: "#fff" },
154
+ warning: { main: "#DE9E37", contrastText: "#fff" },
155
+ info: { main: "#0775F8", contrastText: "#fff" },
156
+ success: { main: "#34BE74", contrastText: "#fff" },
157
+ grey,
158
+ text: {
159
+ primary: "rgba(0, 0, 0, 0.87)",
160
+ secondary: "rgba(0, 0, 0, 0.54)",
161
+ disabled: "rgba(0, 0, 0, 0.38)",
162
+ hint: "rgba(0, 0, 0, 0.38)"
163
+ },
164
+ divider: "#eeeeee",
165
+ background: {
166
+ default: "#fff",
167
+ paper: "#fff"
168
+ },
169
+ common: {
170
+ black: "#000",
171
+ white: "#fff"
172
+ },
173
+ // @extends palette
174
+ storeSecondary: { main: "#EBFEFF", contrastText: "#fff" },
175
+ // 适用于 did 相关的组件, 如果某些产品整体风格是 did 系列, 可以扩展出一个 did 系列的 theme
176
+ did: {
177
+ primary: "#4598FA",
178
+ secondary: "#49C3AD"
179
+ }
180
+ };
181
+ var BLOCKLET_THEME_LIGHT = {
182
+ palette: paletteLight,
183
+ typography: {
184
+ fontSize: 14,
185
+ fontFamily: DEFAULT_FONTS.join(","),
186
+ button: {
187
+ fontWeight: 700,
188
+ textTransform: "none"
189
+ },
190
+ allVariants: {
191
+ textTransform: "none"
192
+ },
193
+ h1: {
194
+ fontSize: "1.875rem",
195
+ lineHeight: 1.2,
196
+ fontWeight: 700
197
+ },
198
+ h2: {
199
+ fontSize: "1.5rem",
200
+ lineHeight: 1.3333333,
201
+ fontWeight: 700
202
+ },
203
+ h3: {
204
+ fontSize: "1.25rem",
205
+ lineHeight: 1.4,
206
+ fontWeight: 700
207
+ },
208
+ h4: {
209
+ fontSize: "1.125rem",
210
+ lineHeight: 1.55,
211
+ fontWeight: 600
212
+ },
213
+ h5: {
214
+ fontSize: "1rem",
215
+ lineHeight: 1.5,
216
+ fontWeight: 700
217
+ },
218
+ h6: {
219
+ fontSize: "0.875rem",
220
+ lineHeight: 1.43,
221
+ fontWeight: 700
222
+ },
223
+ subtitle1: {
224
+ fontSize: "1rem",
225
+ lineHeight: 1.5,
226
+ fontWeight: 500
227
+ },
228
+ subtitle2: {
229
+ fontSize: "0.875rem",
230
+ lineHeight: 1.43,
231
+ fontWeight: 500
232
+ },
233
+ body1: {
234
+ fontSize: "1rem",
235
+ lineHeight: 1.75
236
+ },
237
+ body2: {
238
+ fontSize: "0.875rem",
239
+ lineHeight: 1.43
240
+ },
241
+ caption: {
242
+ fontSize: "0.75rem",
243
+ lineHeight: 1.33
244
+ },
245
+ overline: {
246
+ fontSize: "0.75rem",
247
+ lineHeight: 1.33,
248
+ fontWeight: 500
249
+ },
250
+ // @extends-start
251
+ color: {
252
+ // 此处 #222222 必须硬编码, layout/sidebar.js -> Icon/image 加载图片时 color 会影响加载路径
253
+ // TODO: 此处硬编码的色值后面需要改为 colors.grey[900],
254
+ // 或者如果可以的话直接删掉 typography#color, 文本颜色建议使用 theme.palette.text 中的色值?
255
+ // layout 组件建议重构, sidebar 中建议使用 icon 替换 img (#366)
256
+ main: "#222222",
257
+ gray: paletteLight.grey[500]
258
+ }
259
+ },
260
+ components: {
261
+ MuiButton: {
262
+ styleOverrides: {
263
+ root: {
264
+ boxShadow: "none"
265
+ }
266
+ }
267
+ },
268
+ MuiButtonGroup: {
269
+ styleOverrides: {
270
+ root: {
271
+ boxShadow: "none"
272
+ }
273
+ }
274
+ },
275
+ MuiTableCell: {
276
+ styleOverrides: {
277
+ sizeSmall: {
278
+ borderBottomWidth: "0",
279
+ paddingTop: "8px",
280
+ paddingBottom: "8px",
281
+ paddingLeft: 0,
282
+ paddingRight: "20px"
283
+ },
284
+ sizeMedium: {
285
+ borderBottomWidth: "0",
286
+ paddingTop: "14px",
287
+ paddingBottom: "14px",
288
+ paddingLeft: 0,
289
+ paddingRight: "30px"
290
+ },
291
+ head: {
292
+ textTransform: "uppercase",
293
+ color: paletteLight.grey[900]
294
+ },
295
+ body: {
296
+ color: paletteLight.grey[900]
297
+ }
298
+ }
299
+ },
300
+ MuiTableRow: {
301
+ styleOverrides: {
302
+ root: {
303
+ "&:nth-child(even)": {
304
+ backgroundColor: "rgba(0, 0, 0, 0.02)"
305
+ }
306
+ },
307
+ head: {
308
+ backgroundColor: "transparent"
309
+ }
310
+ }
311
+ }
312
+ },
313
+ breakpoints: {
314
+ values: {
315
+ xs: 0,
316
+ sm: 600,
317
+ md: 960,
318
+ lg: 1280,
319
+ xl: 1920
320
+ }
321
+ }
322
+ };
323
+ var paletteDark = {
324
+ mode: "dark",
325
+ common: {
326
+ black: "#000",
327
+ white: "#fff"
328
+ },
329
+ primary: {
330
+ main: "#90caf9",
331
+ light: "#e3f2fd",
332
+ dark: "#42a5f5",
333
+ contrastText: "rgba(0, 0, 0, 0.87)"
334
+ },
335
+ secondary: {
336
+ main: "#ce93d8",
337
+ light: "#f3e5f5",
338
+ dark: "#ab47bc",
339
+ contrastText: "rgba(0, 0, 0, 0.87)"
340
+ },
341
+ error: {
342
+ main: "#f44336",
343
+ light: "#e57373",
344
+ dark: "#d32f2f",
345
+ contrastText: "#fff"
346
+ },
347
+ warning: {
348
+ main: "#ffa726",
349
+ light: "#ffb74d",
350
+ dark: "#f57c00",
351
+ contrastText: "rgba(0, 0, 0, 0.87)"
352
+ },
353
+ info: {
354
+ main: "#29b6f6",
355
+ light: "#4fc3f7",
356
+ dark: "#0288d1",
357
+ contrastText: "rgba(0, 0, 0, 0.87)"
358
+ },
359
+ success: {
360
+ main: "#66bb6a",
361
+ light: "#81c784",
362
+ dark: "#388e3c",
363
+ contrastText: "rgba(0, 0, 0, 0.87)"
364
+ },
365
+ contrastThreshold: 3,
366
+ tonalOffset: 0.2,
367
+ text: {
368
+ primary: "#fff",
369
+ secondary: "rgba(255, 255, 255, 0.7)",
370
+ disabled: "rgba(255, 255, 255, 0.5)"
371
+ },
372
+ divider: "rgba(255, 255, 255, 0.12)",
373
+ background: {
374
+ paper: "#212121",
375
+ default: "#212121"
376
+ },
377
+ action: {
378
+ active: "#fff",
379
+ hover: "rgba(255, 255, 255, 0.08)",
380
+ hoverOpacity: 0.08,
381
+ selected: "rgba(255, 255, 255, 0.16)",
382
+ selectedOpacity: 0.16,
383
+ disabled: "rgba(255, 255, 255, 0.3)",
384
+ disabledBackground: "rgba(255, 255, 255, 0.12)",
385
+ disabledOpacity: 0.38,
386
+ focus: "rgba(255, 255, 255, 0.12)",
387
+ focusOpacity: 0.12,
388
+ activatedOpacity: 0.24
389
+ }
390
+ };
391
+ var BLOCKLET_THEME_DARK = (0, import_deepmerge.default)(BLOCKLET_THEME_LIGHT, {
392
+ palette: paletteDark,
393
+ typography: {
394
+ // @extends-start
395
+ color: {
396
+ main: "#fff",
397
+ gray: grey[300]
398
+ }
399
+ },
400
+ components: {
401
+ MuiTableCell: {
402
+ styleOverrides: {
403
+ head: {
404
+ textTransform: "uppercase",
405
+ color: grey[300]
406
+ },
407
+ body: {
408
+ color: grey[300]
409
+ }
410
+ }
411
+ },
412
+ MuiTableRow: {
413
+ root: {
414
+ "&:nth-child(even)": {
415
+ backgroundColor: "rgba(255, 255, 255, 0.02)"
416
+ }
417
+ }
418
+ }
419
+ }
420
+ });
421
+ export {
422
+ BLOCKLET_THEME_DARK,
423
+ BLOCKLET_THEME_LIGHT,
424
+ DEFAULT_FONTS
425
+ };
@@ -0,0 +1,60 @@
1
+ import { PaletteMode } from '@mui/material';
2
+ import { Components, PaletteColorOptions, ThemeOptions } from '@mui/material/styles';
3
+ import { Typography } from '@mui/material/styles/createTypography';
4
+
5
+ declare module "@mui/material/styles" {
6
+ // @extend theme
7
+ interface Theme {
8
+ mode?: PaletteMode;
9
+ themeName?: string;
10
+ pageWidth?: string;
11
+ /** @deprecated 请使用 theme.palette */
12
+ colors?: Record<string, string>;
13
+ }
14
+ interface ThemeOptions {
15
+ themeName?: string;
16
+ mode?: PaletteMode;
17
+ pageWidth?: string;
18
+ /** @deprecated 请使用 theme.palette */
19
+ colors?: Record<string, string>;
20
+ /** @deprecated 请使用 components */
21
+ overrides?: Components<Omit<Theme, "components">>;
22
+ }
23
+ // @extend theme.palette
24
+ interface Palette {
25
+ storeSecondary: Palette["primary"];
26
+ did: {
27
+ primary: string;
28
+ secondary: string;
29
+ };
30
+ }
31
+ interface PaletteOptions {
32
+ storeSecondary?: PaletteColorOptions;
33
+ did?: {
34
+ primary?: string;
35
+ secondary?: string;
36
+ };
37
+ }
38
+ // @extend theme.palette.text
39
+ interface TypeText {
40
+ hint: string;
41
+ }
42
+ }
43
+ declare module "@mui/material/styles/createTypography" {
44
+ // @extend theme.typography
45
+ interface Typography {
46
+ /** @deprecated 请使用 theme.palette.text */
47
+ color: Record<string, string>;
48
+ }
49
+ interface TypographyOptions {
50
+ color?: Record<string, string>;
51
+ }
52
+ }
53
+ export declare const DEFAULT_FONTS: string[];
54
+ /**
55
+ * figma: https://www.figma.com/file/1qHyMF137EXOQpSFVByszG/UX-Library?node-id=295%3A1518
56
+ */
57
+ export declare const BLOCKLET_THEME_LIGHT: ThemeOptions;
58
+ export declare const BLOCKLET_THEME_DARK: ThemeOptions;
59
+
60
+ export {};
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@blocklet/theme",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "2.13.7",
7
+ "description": "A preset MUI-based theme configuration designed for use with Blocklet.",
8
+ "main": "dist/cjs/index.js",
9
+ "module": "dist/es/index.js",
10
+ "types": "dist/types/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/cjs/index.js",
14
+ "import": "./dist/es/index.js",
15
+ "types": "./dist/types/index.d.ts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "lint": "eslint src tests",
23
+ "lint:fix": "npm run lint -- --fix",
24
+ "test": "NODE_ENV=test node tools/jest.js",
25
+ "coverage": "npm run test -- --coverage",
26
+ "clean": "rm -rf dist",
27
+ "build:types": "dts-bundle-generator -o dist/types/index.d.ts src/index.ts --no-banner --inline-declare-externals",
28
+ "build:cjs": "esbuild src/index.ts --bundle --outfile=dist/cjs/index.js --platform=node --format=cjs",
29
+ "build:esm": "esbuild src/index.ts --bundle --outfile=dist/es/index.js --platform=node --format=esm",
30
+ "build": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:types"
31
+ },
32
+ "author": "wangshijun<wangshijun2010@gmail.com>",
33
+ "license": "Apache-2.0",
34
+ "peerDependencies": {
35
+ "@mui/material": ">=5.15.0"
36
+ },
37
+ "dependencies": {
38
+ "deepmerge": "^4.3.1"
39
+ },
40
+ "devDependencies": {
41
+ "@arcblock/eslint-config-ts": "^0.3.3",
42
+ "@types/jest": "^29.5.13",
43
+ "@types/node": "^20.14.9",
44
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
45
+ "@typescript-eslint/parser": "^7.1.0",
46
+ "dts-bundle-generator": "^9.2.3",
47
+ "esbuild": "^0.20.2",
48
+ "eslint": "^8.57.0",
49
+ "jest": "^29.7.0",
50
+ "prettier": "^3.2.5",
51
+ "ts-jest": "^29.1.2",
52
+ "typescript": "~5.5.4"
53
+ },
54
+ "gitHead": "9db5da4c6bc8ec9bd239bcd6d080930b52601bd2"
55
+ }