@zuzjs/ui 0.7.1 → 0.7.3

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.
Files changed (45) hide show
  1. package/dist/bin.js +5 -1
  2. package/dist/comps/Accordion/index.d.ts +1 -1
  3. package/dist/comps/Accordion/types.d.ts +1 -1
  4. package/dist/comps/Avatar/index.d.ts +2 -2
  5. package/dist/comps/Avatar/types.d.ts +2 -2
  6. package/dist/comps/Button/index.d.ts +1 -1
  7. package/dist/comps/Button/index.js +2 -4
  8. package/dist/comps/Button/types.d.ts +3 -3
  9. package/dist/comps/CheckBox/index.d.ts +2 -1
  10. package/dist/comps/CheckBox/index.js +3 -21
  11. package/dist/comps/CheckBox/types.d.ts +2 -1
  12. package/dist/comps/ContextMenu/index.js +0 -56
  13. package/dist/comps/Drawer/index.d.ts +1 -1
  14. package/dist/comps/Drawer/types.d.ts +1 -1
  15. package/dist/comps/Form/index.d.ts +5 -2
  16. package/dist/comps/Form/index.js +24 -6
  17. package/dist/comps/Pagination/index.d.ts +1 -1
  18. package/dist/comps/Pagination/index.js +5 -3
  19. package/dist/comps/Pagination/types.d.ts +1 -1
  20. package/dist/comps/Select/index.js +2 -1
  21. package/dist/comps/Sheet/index.d.ts +7 -1
  22. package/dist/comps/Sheet/index.js +23 -11
  23. package/dist/comps/Switch/index.d.ts +1 -0
  24. package/dist/comps/Table/col.js +0 -8
  25. package/dist/comps/Table/index.d.ts +4 -0
  26. package/dist/comps/Table/index.js +3 -2
  27. package/dist/comps/Table/row.js +6 -3
  28. package/dist/comps/Table/types.d.ts +9 -2
  29. package/dist/comps/TextArea/index.d.ts +3 -0
  30. package/dist/comps/TextArea/index.js +3 -2
  31. package/dist/comps/Treeview/index.js +1 -1
  32. package/dist/comps/Treeview/item.js +1 -1
  33. package/dist/funs/css.d.ts +10 -7
  34. package/dist/funs/css.js +51 -14
  35. package/dist/funs/stylesheet.js +1 -0
  36. package/dist/hooks/useBase.js +1 -1
  37. package/dist/hooks/useColorScheme.d.ts +3 -1
  38. package/dist/hooks/useColorScheme.js +7 -7
  39. package/dist/hooks/useDB.js +2 -2
  40. package/dist/styles.css +1 -1
  41. package/dist/types/enums.d.ts +7 -1
  42. package/dist/types/enums.js +7 -0
  43. package/dist/types/index.d.ts +3 -0
  44. package/dist/types/interfaces.d.ts +6 -0
  45. package/package.json +1 -1
@@ -5,15 +5,18 @@ import TColumn from "./col";
5
5
  import { TRANSITION_CURVES, TRANSITIONS } from "../../types/enums";
6
6
  import { useDelayed } from "../../hooks";
7
7
  const TRow = (props) => {
8
- const { index, schema, data, ids, styles, animate } = props;
8
+ const { index, schema, data, ids, styles, animate, rowClassName, onContextMenu } = props;
9
9
  const mounted = useDelayed();
10
10
  const _animation = useMemo(() => ({
11
11
  transition: TRANSITIONS.SlideInBottom,
12
12
  curve: TRANSITION_CURVES.EaseInOut,
13
13
  delay: .02 * (index + 1),
14
14
  }), []);
15
- return _jsxs(Box, { ...(animate ? { animate: { ..._animation, when: mounted } } : {}), as: `--row flex aic ${index == -1 ? `--row-head` : ``}`, children: [index == -1 && schema.map((c, i) => _jsx(TColumn, { idx: -1, ...c, style: styles[c.id] }, `--col-${c.id}`)), index > -1 && ids && data && schema.map((c, i) => {
16
- return ids.includes(String(c.id)) ? _jsx(TColumn, { idx: i, id: String(c.id), style: styles[String(c.id)], value: c.render ? c.render(data) : data[String(c.id)] }, `--${String(c.id)}-val-${i}`) : null;
15
+ return _jsxs(Box, { onContextMenu: e => onContextMenu ? onContextMenu(e, data) : null, ...(animate ? { animate: { ..._animation, when: mounted } } : {}), as: `--row flex aic ${index == -1 ? `--row-head` : ``} ${rowClassName || ``}`, children: [index == -1 && schema.map((c, i) => {
16
+ const { renderWhenHeader, render, value, ...cc } = c;
17
+ return _jsx(TColumn, { idx: -1, value: renderWhenHeader && render ? render(index == -1 ? c : data, index) : value, ...cc, style: styles[c.id] }, `--col-${c.id}`);
18
+ }), index > -1 && ids && data && schema.map((c, i) => {
19
+ return ids.includes(String(c.id)) ? _jsx(TColumn, { idx: i, id: String(c.id), style: styles[String(c.id)], value: c.render ? c.render(data, index) : data[String(c.id)] }, `--${String(c.id)}-val-${i}`) : null;
17
20
  })] });
18
21
  };
19
22
  export default TRow;
@@ -9,10 +9,12 @@ export type Row = {
9
9
  ids?: string[];
10
10
  animate?: boolean;
11
11
  data?: dynamicObject;
12
+ rowClassName?: string;
13
+ onContextMenu?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, row: dynamicObject) => void;
12
14
  };
13
15
  export type Column = {
14
16
  id: string | number;
15
- value: string | dynamicObject;
17
+ value: string | ReactNode | dynamicObject;
16
18
  weight?: number;
17
19
  w?: number | string;
18
20
  maxW?: number | string;
@@ -22,15 +24,20 @@ export type Column = {
22
24
  minH?: number | string;
23
25
  resize?: boolean;
24
26
  sort?: boolean;
25
- render?: (row: dynamicObject) => ReactNode;
27
+ renderWhenHeader?: boolean;
28
+ render?: (row: dynamicObject, index: number) => ReactNode;
26
29
  };
27
30
  export type TableProps = BoxProps & {
28
31
  schema: Column[];
29
32
  rows?: dynamicObject[];
30
33
  rowCount?: number;
31
34
  rowsPerPage?: number;
35
+ rowClassName?: string;
32
36
  currentPage?: number;
33
37
  pagination?: boolean;
38
+ showPaginationOnZeroPageCount?: boolean;
34
39
  animateRows?: boolean;
40
+ header?: boolean;
41
+ onRowContextMenu?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, row: dynamicObject) => void;
35
42
  onPageChange?: PaginationCallback;
36
43
  };
@@ -1,8 +1,11 @@
1
1
  import { Props } from '../../types';
2
+ import { Variant } from '../../types/enums';
2
3
  export type TextAreaProps = Props<`textarea`> & {
3
4
  autoResize?: boolean;
5
+ variant?: Variant;
4
6
  };
5
7
  declare const TextArea: import("react").ForwardRefExoticComponent<import("../../types").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, keyof import("../../types").ZuzProps> & {
6
8
  autoResize?: boolean;
9
+ variant?: Variant;
7
10
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
8
11
  export default TextArea;
@@ -2,11 +2,12 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { forwardRef } from 'react';
4
4
  import { useBase } from '../../hooks';
5
+ import { Variant } from '../../types/enums';
5
6
  const TextArea = forwardRef((props, ref) => {
6
- const { autoResize, ...pops } = props;
7
+ const { autoResize, variant, ...pops } = props;
7
8
  const { style, className, rest } = useBase(pops);
8
9
  const handleInput = (event) => {
9
10
  };
10
- return _jsx("textarea", { className: `--input --textarea flex ${className}`.trim(), style: style, onInput: handleInput, ref: ref, ...rest });
11
+ return _jsx("textarea", { className: `--input --textarea --${variant || Variant.Small} flex ${className}`.trim(), style: style, onInput: handleInput, ref: ref, ...rest });
11
12
  });
12
13
  export default TextArea;
@@ -19,6 +19,6 @@ const TreeView = forwardRef((props, ref) => {
19
19
  }, [_selected]);
20
20
  return _jsx(Box, { className: `--treeview flex cols`, children: nodes
21
21
  .filter(node => roots.includes(node.tag))
22
- .map(node => _jsx(TreeItem, { treeTag: treeViewTag ? `-${treeViewTag}` : ``, selected: selected, onSelect: e => handleSelect(e), icons: icons, meta: node, nodes: nodes }, `--node-${node.tag}`)) });
22
+ .map(node => _jsx(TreeItem, { treeTag: treeViewTag ? `-${treeViewTag}` : ``, selected: selected, onSelect: e => handleSelect(e), icons: icons, meta: node, skeleton: rest.skeleton, nodes: nodes }, `--node-${node.tag}`)) });
23
23
  });
24
24
  export default TreeView;
@@ -21,6 +21,6 @@ const TreeItem = forwardRef((props, ref) => {
21
21
  setIsOpen(localStorage.getItem(`--tn${treeTag}-${tag}`) == `1`);
22
22
  }, []);
23
23
  const _nodes = nodes.filter(x => x.under == tag);
24
- return _jsxs(Box, { className: `--treenode --treenode-${tag} flex cols`, children: [_jsxs(Box, { className: `--node --node-${tag} flex aic${selected == tag ? ` --selected` : ``}`, children: [_jsx(Button, { onClick: toggle, className: `--node-aro-btn`, children: _jsx(Icon, { className: `--node-aro-icon`, name: isOpen ? icons?.arrowOpen : icons?.arrowClose }) }), _jsxs(Button, { className: `--node-meta flex aic`, onClick: (e) => onSelect(tag), children: [_jsx(Icon, { className: `--node-icon`, name: icon || (isOpen ? icons?.dirOpen : icons?.dirClose) }), _jsx(Text, { ...{ className: `--node-label` }, children: label })] })] }), isOpen && _nodes.length > 0 && _jsx(Box, { className: `--sub-node tree-sub-node-${tag} flex cols`, children: _nodes.map(node => _jsx(TreeItem, { treeTag: treeTag, selected: selected, onSelect: onSelect, icons: icons, meta: node, nodes: nodes }, `--node-${node.tag}`)) })] });
24
+ return _jsxs(Box, { className: `--treenode --treenode-${tag} flex cols`, children: [_jsxs(Box, { className: `--node --node-${tag} flex aic${selected == tag ? ` --selected` : ``}`, children: [_jsx(Button, { skeleton: rest.skeleton, onClick: toggle, className: `--node-aro-btn`, children: _jsx(Icon, { skeleton: rest.skeleton, className: `--node-aro-icon`, name: isOpen ? icons?.arrowOpen : icons?.arrowClose }) }), _jsxs(Button, { className: `--node-meta flex aic`, onClick: (e) => onSelect(tag), children: [_jsx(Icon, { skeleton: rest.skeleton, className: `--node-icon`, name: icon || (isOpen ? icons?.dirOpen : icons?.dirClose) }), _jsx(Text, { ...{ className: `--node-label` }, skeleton: rest.skeleton, children: label })] })] }), isOpen && _nodes.length > 0 && _jsx(Box, { className: `--sub-node tree-sub-node-${tag} flex cols`, children: _nodes.map(node => _jsx(TreeItem, { treeTag: treeTag, selected: selected, onSelect: onSelect, icons: icons, meta: node, nodes: nodes }, `--node-${node.tag}`)) })] });
25
25
  });
26
26
  export default TreeItem;
@@ -3,32 +3,34 @@ import Hashids from "hashids";
3
3
  import { TRANSITION_CURVES, TRANSITIONS } from "../types/enums.js";
4
4
  import { OptionValues } from "commander";
5
5
  declare class CSS {
6
- cx: string[];
7
6
  cache: dynamicObject;
8
7
  PROPS: dynamicObject;
9
8
  DIRECT: dynamicObject;
9
+ IGNORE: string[];
10
+ PROPS_KEYS: string[];
11
+ DIRECT_KEYS: string[];
12
+ cx: string[];
10
13
  hashids: Hashids;
11
14
  chars: string;
12
15
  rgbaRegex: RegExp;
13
- IGNORE: string[];
14
16
  unit: any;
15
17
  keysWithoutCommaToSpace: string[];
16
18
  propCounter: dynamicObject;
17
19
  seperator: string;
18
20
  pseudoList: string[];
19
21
  ids: string[];
22
+ DIRECT_VALUES: string[];
23
+ PROPS_VALUES: string[];
20
24
  mediaQueries: dynamicObject;
25
+ debug: OptionValues | undefined;
26
+ _darkQueries: dynamicObject;
21
27
  _mediaQueries: dynamicObject;
22
28
  _mediaQueriesLabels: dynamicObject;
23
- PROPS_KEYS: string[];
24
- DIRECT_KEYS: string[];
25
29
  _cli: boolean;
26
- DIRECT_VALUES: string[];
27
- PROPS_VALUES: string[];
28
30
  _currentFile: string;
29
- debug: OptionValues | undefined;
30
31
  constructor(options?: dynamicObject | undefined, debug?: OptionValues);
31
32
  buildMediaQueries(queries: dynamicObject): string;
33
+ buildDarkModeQueries(queries: dynamicObject): string;
32
34
  styleSheet(cache: dynamicObject, pseudo?: string): string;
33
35
  _styleSheet(cache: dynamicObject): string;
34
36
  cleanKey(key: string): string;
@@ -44,6 +46,7 @@ declare class CSS {
44
46
  cx: string[];
45
47
  sheet: string;
46
48
  mediaQuery: dynamicObject;
49
+ darkQueries: dynamicObject;
47
50
  };
48
51
  }
49
52
  export default CSS;
package/dist/funs/css.js CHANGED
@@ -5,34 +5,36 @@ import { TRANSITION_CURVES, TRANSITIONS } from "../types/enums.js";
5
5
  import md5 from "md5";
6
6
  import pc from "picocolors";
7
7
  class CSS {
8
- cx;
9
8
  cache;
10
9
  PROPS;
11
10
  DIRECT;
11
+ IGNORE;
12
+ PROPS_KEYS;
13
+ DIRECT_KEYS;
14
+ cx;
12
15
  hashids;
13
16
  chars;
14
17
  rgbaRegex;
15
- IGNORE;
16
18
  unit;
17
19
  keysWithoutCommaToSpace;
18
20
  propCounter;
19
21
  seperator;
20
22
  pseudoList;
21
23
  ids;
24
+ DIRECT_VALUES;
25
+ PROPS_VALUES;
22
26
  mediaQueries;
27
+ debug;
28
+ _darkQueries;
23
29
  _mediaQueries;
24
30
  _mediaQueriesLabels;
25
- PROPS_KEYS;
26
- DIRECT_KEYS;
27
31
  _cli;
28
- DIRECT_VALUES;
29
- PROPS_VALUES;
30
32
  _currentFile;
31
- debug;
32
33
  constructor(options, debug) {
33
34
  const opts = options || {};
34
35
  this.debug = debug;
35
36
  this._cli = false;
37
+ this._darkQueries = [];
36
38
  this._mediaQueries = {};
37
39
  this._mediaQueriesLabels = {
38
40
  ph: `Extra Small Devices (Phones)`,
@@ -60,7 +62,7 @@ class CSS {
60
62
  "@before", "@after", "@active", "@checked", "@default", "@disabled", "@empty", "@enabled", "@first", "@firstChild", "@firstOfType", "@focus", "@hover", "@indeterminate", "@inRange", "@invalid", "@lastChild", "@lastOfType", "@link", "@not", "@nthChild", "@nthLastChild", "@nthLastOfType", "@nthOfType", "@onlyChild", "@onlyOfType", "@optional", "@outOfRange", "@readOnly", "@readWrite", "@required", "@root", "@scope", "@target", "@valid", "@visited"
61
63
  ];
62
64
  this.IGNORE = [
63
- `flex`, `opacity`, `z-index`, `zIndex`, `color`, `line-height`, `anim`, `scale`, `saturate`
65
+ `flex`, `opacity`, `z-index`, `zIndex`, `color`, `line-height`, `anim`, `scale`, `saturate`, `brightness`
64
66
  ];
65
67
  this.keysWithoutCommaToSpace = [
66
68
  `transform`, `translate`, `color`, `background`, `background-color`, `backgroundColor`, `backgroundImage`, `background-image`,
@@ -91,11 +93,24 @@ class CSS {
91
93
  Object.keys(queries).forEach((key) => {
92
94
  scss.push(`/**\n*${self._mediaQueriesLabels[key]}\n*/`);
93
95
  scss.push(`@media screen and ${self.mediaQueries[key]}{`);
94
- scss.push(queries[key].join(`\n`));
96
+ scss.push(`\t${queries[key].join(`\n\t`)}`);
95
97
  scss.push(`}`);
96
98
  });
97
99
  return scss.join(`\n`);
98
100
  }
101
+ buildDarkModeQueries(queries) {
102
+ const self = this;
103
+ const scss = [`\n`];
104
+ if (Object.keys(queries).length > 0) {
105
+ scss.push(`/**\n*Dark Scheme\n*/`);
106
+ scss.push(`[color-scheme="dark"]{`);
107
+ Object.keys(queries).forEach((key) => {
108
+ scss.push(`\t.${key}{${queries[key]}${queries[key].endsWith(`;`) ? `` : `;`}}`);
109
+ });
110
+ scss.push(`}`);
111
+ }
112
+ return scss.join(`\n`);
113
+ }
99
114
  styleSheet(cache, pseudo = ``) {
100
115
  const self = this;
101
116
  const scss = [];
@@ -266,11 +281,13 @@ class CSS {
266
281
  if (!_[_id]) {
267
282
  const cleaned = self.deepClean(cache[_k], level + 1);
268
283
  if (level == 0 &&
269
- (self.pseudoList.includes(`@${__k}`) || __k in self.mediaQueries)) {
284
+ (self.pseudoList.includes(`@${__k}`) ||
285
+ __k in self.mediaQueries ||
286
+ __k in self._darkQueries)) {
270
287
  self.cx.push(_id);
271
288
  _[_id] = { [__k]: cleaned };
272
289
  }
273
- else
290
+ else if (__k !== `dark`)
274
291
  _[__k] = cleaned;
275
292
  }
276
293
  }
@@ -314,7 +331,6 @@ class CSS {
314
331
  }
315
332
  makeValue(k, v) {
316
333
  const self = this;
317
- // console.log(`makeValue`, k, v)
318
334
  if (k in this.PROPS) {
319
335
  const key = this.PROPS[k];
320
336
  let value;
@@ -663,6 +679,11 @@ class CSS {
663
679
  self.mediaQueries[_mediaQuery].push({ [_id]: _out });
664
680
  return {};
665
681
  }
682
+ if (pseudo.startsWith(`dark`)) {
683
+ self._darkQueries[_id] = _out;
684
+ self.cx.push(_id);
685
+ return {};
686
+ }
666
687
  return { [_id]: _out };
667
688
  }
668
689
  else if (key in self.DIRECT) {
@@ -733,6 +754,11 @@ class CSS {
733
754
  self.mediaQueries[_mediaQuery].push({ [_id]: _out });
734
755
  return {};
735
756
  }
757
+ if (pseudo.startsWith(`dark`)) {
758
+ self._darkQueries[_id] = _out;
759
+ self.cx.push(_id);
760
+ return {};
761
+ }
736
762
  return { [_id]: _out };
737
763
  }
738
764
  }
@@ -746,6 +772,11 @@ class CSS {
746
772
  self.mediaQueries[_mediaQuery].push({ [_id]: _out });
747
773
  return {};
748
774
  }
775
+ if (pseudo.startsWith(`dark`)) {
776
+ self._darkQueries[_id] = _out;
777
+ self.cx.push(_id);
778
+ return {};
779
+ }
749
780
  return { [_id]: _out };
750
781
  }
751
782
  else if (_k.trim().match(/^[a-zA-Z0-9\-]+$/g)) {
@@ -801,13 +832,15 @@ class CSS {
801
832
  self._cli = cli;
802
833
  self.cx = [];
803
834
  self.cache = {};
835
+ self._darkQueries = {};
804
836
  self._mediaQueries = {};
805
837
  self._currentFile = ff;
806
838
  if (undefined == css)
807
839
  return {
808
840
  cx: self.cx,
809
841
  sheet: ``,
810
- mediaQuery: {}
842
+ mediaQuery: {},
843
+ darkQueries: []
811
844
  };
812
845
  if (`string` == typeof css) {
813
846
  css = [[css]];
@@ -827,6 +860,7 @@ class CSS {
827
860
  // }
828
861
  const _cleaned = self.deepClean(self.cache);
829
862
  const _stylesheet = self.styleSheet(_cleaned);
863
+ // console.log(_cleaned, _stylesheet)
830
864
  // const _mediaQueries : dynamicObject = {}
831
865
  // if ( !cli ){
832
866
  // console.log(css, self.cx, self.styleSheet(_cleaned))
@@ -843,10 +877,13 @@ class CSS {
843
877
  console.log(pc.cyan(`[sheet]`), _stylesheet);
844
878
  if (self.debug?.media)
845
879
  console.log(pc.cyan(`[mediaquery]`), self._mediaQueries);
880
+ if (self.debug?.dark)
881
+ console.log(pc.cyan(`[darkquery]`), self._darkQueries);
846
882
  const _ = {
847
883
  cx: self.cx,
848
884
  sheet: _stylesheet,
849
- mediaQuery: self._mediaQueries
885
+ mediaQuery: self._mediaQueries,
886
+ darkQueries: self._darkQueries
850
887
  };
851
888
  // console.log(css, _)
852
889
  return _;
@@ -322,6 +322,7 @@ export const cssDirect = {
322
322
  "inlineblock": "display: inline-block;",
323
323
  "blur": "filter: blur(__VALUE__);",
324
324
  "saturate": "filter: saturate(__VALUE__);",
325
+ "brightness": "filter: brightness(__VALUE__);",
325
326
  "ratio": "aspect-ratio: __VALUE__;",
326
327
  "center-h": "left: 50%;transform: translateX(-50%);",
327
328
  "center-v": "top: 50%;transform: translateY(-50%);",
@@ -24,7 +24,7 @@ const buildSkeletonStyle = (s) => {
24
24
  }
25
25
  }
26
26
  else {
27
- style.minWidth = style.minHeight = `100%`;
27
+ style.minWidth = style.minHeight = s.defaultSize || `100%`;
28
28
  }
29
29
  return style;
30
30
  };
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from "react";
2
+ import { ColorTheme } from "../types/enums";
2
3
  export type ColorScheme = `light` | `dark` | `system`;
3
4
  export type ThemeContextProps = {
4
5
  colorScheme: ColorScheme;
@@ -7,7 +8,8 @@ export type ThemeContextProps = {
7
8
  };
8
9
  export interface ThemeProviderProps {
9
10
  children: ReactNode;
11
+ forceTheme?: ColorTheme;
10
12
  storageKey?: string;
11
13
  }
12
14
  export declare const useColorScheme: () => ThemeContextProps;
13
- export declare const ThemeProvider: ({ children, storageKey }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const ThemeProvider: ({ children, storageKey, forceTheme }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,12 +11,12 @@ export const useColorScheme = () => {
11
11
  }
12
12
  return context;
13
13
  };
14
- export const ThemeProvider = ({ children, storageKey = `--ucs` }) => {
15
- return _jsx(Theme, { storageKey: storageKey, children: children });
14
+ export const ThemeProvider = ({ children, storageKey = `--ucs`, forceTheme }) => {
15
+ return _jsx(Theme, { storageKey: storageKey, forceTheme: forceTheme, children: children });
16
16
  };
17
- const Theme = ({ children, storageKey }) => {
18
- const [colorScheme, setThemeState] = useState(() => getTheme(storageKey, `system`));
19
- const [resolvedTheme, setResolvedTheme] = useState(() => getTheme(storageKey));
17
+ const Theme = ({ children, storageKey, forceTheme }) => {
18
+ const [colorScheme, setThemeState] = useState(() => forceTheme || getTheme(storageKey, `system`));
19
+ const [resolvedTheme, setResolvedTheme] = useState(() => forceTheme || getTheme(storageKey));
20
20
  // const [resolvedTheme, setResolvedTheme] = useState<'light' | 'dark' | undefined>(() => {
21
21
  // if ( SSR ) return undefined
22
22
  // return colorScheme === 'system' ? window?.matchMedia(MATCH_MEDIA).matches ? 'dark' : 'light' : colorScheme
@@ -69,10 +69,10 @@ const Theme = ({ children, storageKey }) => {
69
69
  return () => window.removeEventListener(`storage`, handleStorage);
70
70
  }, [switchColorScheme]);
71
71
  useEffect(() => {
72
- applyColorScheme((colorScheme || `system`));
72
+ applyColorScheme((forceTheme || colorScheme || `system`));
73
73
  }, [colorScheme]);
74
74
  return (_jsxs(ThemeContext, { value: { colorScheme: colorScheme, resolvedScheme: resolvedTheme, setColorScheme: switchColorScheme }, children: [_jsx("script", { suppressHydrationWarning: true, dangerouslySetInnerHTML: {
75
- __html: `const el = document.documentElement
75
+ __html: forceTheme ? `` : `const el = document.documentElement
76
76
  const themes = ['light', 'dark']
77
77
  let theme = localStorage.getItem(\`${storageKey}\`) || "system";
78
78
  if (theme === "system") {
@@ -61,7 +61,7 @@ const useDB = (options) => {
61
61
  };
62
62
  })
63
63
  .catch(err => {
64
- reject('Database either corrupted or not initialized');
64
+ reject(err.message || 'Database either corrupted or not initialized');
65
65
  });
66
66
  });
67
67
  const getByID = (storeName, id) => new Promise((resolve, reject) => {
@@ -95,7 +95,7 @@ const useDB = (options) => {
95
95
  };
96
96
  })
97
97
  .catch(err => {
98
- reject('Database either corrupted or not initialized');
98
+ reject(err.message || 'Database either corrupted or not initialized');
99
99
  });
100
100
  });
101
101
  const update = (storeName, value, key) => new Promise((resolve, reject) => {