@blocklet/theme 2.13.56 → 2.13.57

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/cjs/index.js CHANGED
@@ -293,7 +293,7 @@ function getDefaultThemePrefer(meta) {
293
293
  return "light";
294
294
  }
295
295
  var buildThemeStyles = (theme) => {
296
- const { light, dark } = theme;
296
+ const { light = {}, dark = {} } = theme ?? {};
297
297
  return `
298
298
  <style id="blocklet-theme-style">
299
299
  :root {
@@ -322,7 +322,7 @@ var buildThemeScript = (theme) => {
322
322
  ${isValidThemeMode.toString()}
323
323
  ${getDefaultThemePrefer.toString()}
324
324
 
325
- const prefer = getDefaultThemePrefer(${JSON.stringify({ theme: { prefer: theme.prefer } })});
325
+ const prefer = getDefaultThemePrefer(${JSON.stringify({ theme: { prefer: theme?.prefer ?? "light" } })});
326
326
 
327
327
  if(prefer === 'dark') {
328
328
  document.documentElement.setAttribute('data-theme', 'dark');
package/dist/es/index.js CHANGED
@@ -271,7 +271,7 @@ function getDefaultThemePrefer(meta) {
271
271
  return "light";
272
272
  }
273
273
  var buildThemeStyles = (theme) => {
274
- const { light, dark } = theme;
274
+ const { light = {}, dark = {} } = theme ?? {};
275
275
  return `
276
276
  <style id="blocklet-theme-style">
277
277
  :root {
@@ -300,7 +300,7 @@ var buildThemeScript = (theme) => {
300
300
  ${isValidThemeMode.toString()}
301
301
  ${getDefaultThemePrefer.toString()}
302
302
 
303
- const prefer = getDefaultThemePrefer(${JSON.stringify({ theme: { prefer: theme.prefer } })});
303
+ const prefer = getDefaultThemePrefer(${JSON.stringify({ theme: { prefer: theme?.prefer ?? "light" } })});
304
304
 
305
305
  if(prefer === 'dark') {
306
306
  document.documentElement.setAttribute('data-theme', 'dark');
@@ -75,9 +75,9 @@ export type ThemeSettings = {
75
75
  dark: ThemeOptions;
76
76
  };
77
77
  /** 生成用于服务端注入的初始样式,避免首屏加载闪白 */
78
- export declare const buildThemeStyles: (theme: ThemeSettings) => string;
78
+ export declare const buildThemeStyles: (theme?: ThemeSettings) => string;
79
79
  /** 生成用于服务端注入的初始脚本,用于选择 theme mode */
80
- export declare const buildThemeScript: (theme: ThemeSettings) => string;
80
+ export declare const buildThemeScript: (theme?: ThemeSettings) => string;
81
81
 
82
82
  export {
83
83
  Theme,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.13.56",
6
+ "version": "2.13.57",
7
7
  "description": "A preset MUI-based theme configuration designed for use with Blocklet.",
8
8
  "main": "dist/cjs/index.js",
9
9
  "module": "dist/es/index.js",
@@ -55,5 +55,5 @@
55
55
  "ts-jest": "^29.1.2",
56
56
  "typescript": "~5.5.4"
57
57
  },
58
- "gitHead": "ebf7d863313f1ce95571b81df01182756395197e"
58
+ "gitHead": "780e1e0d2465208e7f53d5ba23b5cb3f84a819ae"
59
59
  }