@xanui/core 1.1.9 → 1.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xanui/core",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "./index.js",
@@ -1,8 +1,8 @@
1
1
  import { ThemeOptions } from './types.js';
2
2
 
3
3
  type ThemeSwitcherOption = {
4
- store: "memory" | "session" | "local";
5
- onChange: (theme: string) => void;
4
+ store?: "memory" | "session" | "local";
5
+ onChange?: (theme: string) => void;
6
6
  };
7
7
  declare const createThemeSwitcher: (defaultTheme: string, option?: ThemeSwitcherOption) => () => {
8
8
  name: string;
@@ -2,7 +2,7 @@
2
2
  const useThemeState = reactStateBucket.createBucket({ name: defaultTheme }, {
3
3
  store: (option === null || option === void 0 ? void 0 : option.store) || "memory",
4
4
  onChange: (key, value) => {
5
- option === null || option === void 0 ? void 0 : option.onChange(value);
5
+ (option === null || option === void 0 ? void 0 : option.onChange) && (option === null || option === void 0 ? void 0 : option.onChange(value));
6
6
  }
7
7
  });
8
8
  const useThemeSwitcher = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"createThemeSwitcher.js","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nexport type ThemeSwitcherOption = {\n store: \"memory\" | \"session\" | \"local\",\n onChange: (theme: string) => void\n}\n\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\n\n const useThemeState = createBucket({ name: defaultTheme }, {\n store: option?.store || \"memory\",\n onChange: (key, value) => {\n option?.onChange(value)\n }\n })\n\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],"names":["createBucket","getTheme"],"mappings":"mJAQA,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,MAA4B,KAAI;IAEhF,MAAM,aAAa,GAAGA,6BAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;QACxD,KAAK,EAAE,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,KAAI,QAAQ;AAChC,QAAA,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;YACtB,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,QAAQ,CAAC,KAAK,CAAC;QAC1B;AACF,KAAA,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAK;AAC3B,QAAA,MAAM,KAAK,GAAG,aAAa,EAAE;QAC7B,OAAO;AACJ,YAAA,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YACvB,KAAK,EAAEC,aAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,YAAA,MAAM,EAAE,CAAC,KAAa,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK;SACpD;AACJ,IAAA,CAAC;AACD,IAAA,OAAO,gBAAgB;AAC1B"}
1
+ {"version":3,"file":"createThemeSwitcher.js","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nexport type ThemeSwitcherOption = {\n store?: \"memory\" | \"session\" | \"local\",\n onChange?: (theme: string) => void\n}\n\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\n\n const useThemeState = createBucket({ name: defaultTheme }, {\n store: option?.store || \"memory\",\n onChange: (key, value) => {\n option?.onChange && option?.onChange(value)\n }\n })\n\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],"names":["createBucket","getTheme"],"mappings":"mJAQA,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,MAA4B,KAAI;IAEhF,MAAM,aAAa,GAAGA,6BAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;QACxD,KAAK,EAAE,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,KAAI,QAAQ;AAChC,QAAA,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;AACtB,YAAA,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,MAAI,MAAM,aAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9C;AACF,KAAA,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAK;AAC3B,QAAA,MAAM,KAAK,GAAG,aAAa,EAAE;QAC7B,OAAO;AACJ,YAAA,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YACvB,KAAK,EAAEC,aAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,YAAA,MAAM,EAAE,CAAC,KAAa,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK;SACpD;AACJ,IAAA,CAAC;AACD,IAAA,OAAO,gBAAgB;AAC1B"}
@@ -2,7 +2,7 @@ import {createBucket}from'react-state-bucket';import {getTheme}from'./core.mjs';
2
2
  const useThemeState = createBucket({ name: defaultTheme }, {
3
3
  store: (option === null || option === void 0 ? void 0 : option.store) || "memory",
4
4
  onChange: (key, value) => {
5
- option === null || option === void 0 ? void 0 : option.onChange(value);
5
+ (option === null || option === void 0 ? void 0 : option.onChange) && (option === null || option === void 0 ? void 0 : option.onChange(value));
6
6
  }
7
7
  });
8
8
  const useThemeSwitcher = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"createThemeSwitcher.mjs","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nexport type ThemeSwitcherOption = {\n store: \"memory\" | \"session\" | \"local\",\n onChange: (theme: string) => void\n}\n\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\n\n const useThemeState = createBucket({ name: defaultTheme }, {\n store: option?.store || \"memory\",\n onChange: (key, value) => {\n option?.onChange(value)\n }\n })\n\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],"names":[],"mappings":"gFAQA,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,MAA4B,KAAI;IAEhF,MAAM,aAAa,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;QACxD,KAAK,EAAE,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,KAAI,QAAQ;AAChC,QAAA,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;YACtB,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,QAAQ,CAAC,KAAK,CAAC;QAC1B;AACF,KAAA,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAK;AAC3B,QAAA,MAAM,KAAK,GAAG,aAAa,EAAE;QAC7B,OAAO;AACJ,YAAA,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YACvB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,YAAA,MAAM,EAAE,CAAC,KAAa,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK;SACpD;AACJ,IAAA,CAAC;AACD,IAAA,OAAO,gBAAgB;AAC1B"}
1
+ {"version":3,"file":"createThemeSwitcher.mjs","sources":["../../src/theme/createThemeSwitcher.ts"],"sourcesContent":["import { createBucket } from \"react-state-bucket\"\nimport { getTheme } from \"./core\"\n\nexport type ThemeSwitcherOption = {\n store?: \"memory\" | \"session\" | \"local\",\n onChange?: (theme: string) => void\n}\n\nconst createThemeSwitcher = (defaultTheme: string, option?: ThemeSwitcherOption) => {\n\n const useThemeState = createBucket({ name: defaultTheme }, {\n store: option?.store || \"memory\",\n onChange: (key, value) => {\n option?.onChange && option?.onChange(value)\n }\n })\n\n const useThemeSwitcher = () => {\n const state = useThemeState()\n return {\n name: state.get(\"name\"),\n theme: getTheme(state.get(\"name\")),\n change: (theme: string) => state.set(\"name\", theme)\n }\n }\n return useThemeSwitcher\n}\n\n\nexport default createThemeSwitcher"],"names":[],"mappings":"gFAQA,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,MAA4B,KAAI;IAEhF,MAAM,aAAa,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;QACxD,KAAK,EAAE,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,KAAI,QAAQ;AAChC,QAAA,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,KAAI;AACtB,YAAA,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,MAAI,MAAM,aAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9C;AACF,KAAA,CAAC;IAEF,MAAM,gBAAgB,GAAG,MAAK;AAC3B,QAAA,MAAM,KAAK,GAAG,aAAa,EAAE;QAC7B,OAAO;AACJ,YAAA,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YACvB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAClC,YAAA,MAAM,EAAE,CAAC,KAAa,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK;SACpD;AACJ,IAAA,CAAC;AACD,IAAA,OAAO,gBAAgB;AAC1B"}