@cyclone-ui/state 0.0.31 → 0.0.32

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 (160) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/base/atoms/atom-with-broadcast.cjs +1 -44
  3. package/dist/base/atoms/atom-with-broadcast.mjs +1 -44
  4. package/dist/base/atoms/atom-with-broadcast.mjs.map +1 -1
  5. package/dist/base/atoms/atom-with-compare.cjs +1 -11
  6. package/dist/base/atoms/atom-with-compare.mjs +1 -11
  7. package/dist/base/atoms/atom-with-compare.mjs.map +1 -1
  8. package/dist/base/atoms/atom-with-debounce.cjs +1 -51
  9. package/dist/base/atoms/atom-with-debounce.mjs +1 -51
  10. package/dist/base/atoms/atom-with-debounce.mjs.map +1 -1
  11. package/dist/base/atoms/atom-with-effect.cjs +1 -122
  12. package/dist/base/atoms/atom-with-effect.mjs +1 -119
  13. package/dist/base/atoms/atom-with-effect.mjs.map +1 -1
  14. package/dist/base/atoms/atom-with-listeners.cjs +1 -35
  15. package/dist/base/atoms/atom-with-listeners.mjs +1 -35
  16. package/dist/base/atoms/atom-with-listeners.mjs.map +1 -1
  17. package/dist/base/atoms/atom-with-pending.cjs +1 -13
  18. package/dist/base/atoms/atom-with-pending.mjs +1 -13
  19. package/dist/base/atoms/atom-with-pending.mjs.map +1 -1
  20. package/dist/base/atoms/atom-with-refresh-and-default.cjs +1 -18
  21. package/dist/base/atoms/atom-with-refresh-and-default.mjs +1 -18
  22. package/dist/base/atoms/atom-with-refresh-and-default.mjs.map +1 -1
  23. package/dist/base/atoms/atom-with-refresh.cjs +1 -12
  24. package/dist/base/atoms/atom-with-refresh.mjs +1 -12
  25. package/dist/base/atoms/atom-with-refresh.mjs.map +1 -1
  26. package/dist/base/atoms/atom-with-toggle.cjs +1 -12
  27. package/dist/base/atoms/atom-with-toggle.mjs +1 -12
  28. package/dist/base/atoms/atom-with-toggle.mjs.map +1 -1
  29. package/dist/base/atoms/atom-with-web-storage.cjs +1 -47
  30. package/dist/base/atoms/atom-with-web-storage.mjs +1 -46
  31. package/dist/base/atoms/atom-with-web-storage.mjs.map +1 -1
  32. package/dist/base/atoms/atom-with-wrapper.cjs +1 -24
  33. package/dist/base/atoms/atom-with-wrapper.mjs +1 -24
  34. package/dist/base/atoms/atom-with-wrapper.mjs.map +1 -1
  35. package/dist/base/atoms/base-atom.cjs +1 -24
  36. package/dist/base/atoms/base-atom.mjs +1 -24
  37. package/dist/base/atoms/base-atom.mjs.map +1 -1
  38. package/dist/base/atoms/index.cjs +1 -24
  39. package/dist/base/atoms/index.mjs +1 -13
  40. package/dist/base/hooks/index.cjs +1 -9
  41. package/dist/base/hooks/index.mjs +1 -6
  42. package/dist/base/hooks/use-atom-effect.cjs +1 -16
  43. package/dist/base/hooks/use-atom-effect.mjs +1 -16
  44. package/dist/base/hooks/use-atom-effect.mjs.map +1 -1
  45. package/dist/base/hooks/use-hydrate-molecule.cjs +1 -16
  46. package/dist/base/hooks/use-hydrate-molecule.mjs +1 -16
  47. package/dist/base/hooks/use-hydrate-molecule.mjs.map +1 -1
  48. package/dist/base/hooks/use-prepare-atoms.cjs +1 -19
  49. package/dist/base/hooks/use-prepare-atoms.mjs +1 -19
  50. package/dist/base/hooks/use-prepare-atoms.mjs.map +1 -1
  51. package/dist/base/hooks/use-sync-molecule.cjs +1 -36
  52. package/dist/base/hooks/use-sync-molecule.mjs +1 -36
  53. package/dist/base/hooks/use-sync-molecule.mjs.map +1 -1
  54. package/dist/base/index.cjs +1 -47
  55. package/dist/base/index.mjs +1 -24
  56. package/dist/base/utilities/create-molecule.cjs +1 -104
  57. package/dist/base/utilities/create-molecule.mjs +1 -101
  58. package/dist/base/utilities/create-molecule.mjs.map +1 -1
  59. package/dist/base/utilities/create-web-storage.cjs +1 -54
  60. package/dist/base/utilities/create-web-storage.mjs +1 -54
  61. package/dist/base/utilities/create-web-storage.mjs.map +1 -1
  62. package/dist/base/utilities/debounce.cjs +1 -51
  63. package/dist/base/utilities/debounce.mjs +1 -51
  64. package/dist/base/utilities/debounce.mjs.map +1 -1
  65. package/dist/base/utilities/index.cjs +1 -13
  66. package/dist/base/utilities/index.mjs +1 -6
  67. package/dist/base/utilities/is-atom.cjs +1 -47
  68. package/dist/base/utilities/is-atom.mjs +1 -45
  69. package/dist/base/utilities/is-atom.mjs.map +1 -1
  70. package/dist/base/utilities/set-atom-debug.cjs +1 -23
  71. package/dist/base/utilities/set-atom-debug.mjs +1 -22
  72. package/dist/base/utilities/set-atom-debug.mjs.map +1 -1
  73. package/dist/form/atoms/atom-with-field.cjs +1 -22
  74. package/dist/form/atoms/atom-with-field.mjs +1 -22
  75. package/dist/form/atoms/atom-with-field.mjs.map +1 -1
  76. package/dist/form/atoms/atom-with-messages.cjs +1 -84
  77. package/dist/form/atoms/atom-with-messages.mjs +1 -77
  78. package/dist/form/atoms/atom-with-messages.mjs.map +1 -1
  79. package/dist/form/hooks/index.cjs +1 -7
  80. package/dist/form/hooks/index.mjs +1 -5
  81. package/dist/form/hooks/use-field-actions.cjs +1 -91
  82. package/dist/form/hooks/use-field-actions.mjs +1 -91
  83. package/dist/form/hooks/use-field-actions.mjs.map +1 -1
  84. package/dist/form/hooks/use-field-ref.cjs +1 -15
  85. package/dist/form/hooks/use-field-ref.mjs +1 -15
  86. package/dist/form/hooks/use-field-ref.mjs.map +1 -1
  87. package/dist/form/hooks/use-form-actions.cjs +1 -68
  88. package/dist/form/hooks/use-form-actions.mjs +1 -68
  89. package/dist/form/hooks/use-form-actions.mjs.map +1 -1
  90. package/dist/form/index.cjs +1 -30
  91. package/dist/form/index.mjs +1 -17
  92. package/dist/form/molecules/field-molecule.cjs +1 -156
  93. package/dist/form/molecules/field-molecule.mjs +1 -155
  94. package/dist/form/molecules/field-molecule.mjs.map +1 -1
  95. package/dist/form/molecules/form-molecule.cjs +1 -179
  96. package/dist/form/molecules/form-molecule.mjs +1 -178
  97. package/dist/form/molecules/form-molecule.mjs.map +1 -1
  98. package/dist/form/molecules/index.cjs +1 -7
  99. package/dist/form/molecules/index.mjs +1 -4
  100. package/dist/form/providers/FieldProvider.cjs +1 -102
  101. package/dist/form/providers/FieldProvider.mjs +1 -102
  102. package/dist/form/providers/FieldProvider.mjs.map +1 -1
  103. package/dist/form/providers/FormProvider.cjs +1 -65
  104. package/dist/form/providers/FormProvider.mjs +1 -65
  105. package/dist/form/providers/FormProvider.mjs.map +1 -1
  106. package/dist/form/providers/index.cjs +1 -5
  107. package/dist/form/providers/index.mjs +1 -4
  108. package/dist/form/types.cjs +1 -12
  109. package/dist/form/types.mjs +1 -12
  110. package/dist/form/types.mjs.map +1 -1
  111. package/dist/form/utilities/abort-error.cjs +1 -14
  112. package/dist/form/utilities/abort-error.mjs +1 -14
  113. package/dist/form/utilities/abort-error.mjs.map +1 -1
  114. package/dist/form/utilities/index.cjs +1 -7
  115. package/dist/form/utilities/index.mjs +1 -5
  116. package/dist/form/utilities/is-validation-results.cjs +1 -8
  117. package/dist/form/utilities/is-validation-results.mjs +1 -8
  118. package/dist/form/utilities/is-validation-results.mjs.map +1 -1
  119. package/dist/form/utilities/validators.cjs +1 -7
  120. package/dist/form/utilities/validators.mjs +1 -7
  121. package/dist/form/utilities/validators.mjs.map +1 -1
  122. package/dist/index.cjs +1 -46
  123. package/dist/index.mjs +1 -22
  124. package/dist/message/components/MessageViewport.cjs +1 -20
  125. package/dist/message/components/MessageViewport.mjs +1 -20
  126. package/dist/message/components/MessageViewport.mjs.map +1 -1
  127. package/dist/message/components/index.cjs +1 -3
  128. package/dist/message/components/index.mjs +1 -3
  129. package/dist/message/hooks/index.cjs +1 -3
  130. package/dist/message/hooks/index.mjs +1 -3
  131. package/dist/message/hooks/use-message-actions.cjs +1 -63
  132. package/dist/message/hooks/use-message-actions.mjs +1 -63
  133. package/dist/message/hooks/use-message-actions.mjs.map +1 -1
  134. package/dist/message/index.cjs +1 -23
  135. package/dist/message/index.mjs +1 -8
  136. package/dist/message/providers/MessageProvider.cjs +1 -15
  137. package/dist/message/providers/MessageProvider.mjs +1 -15
  138. package/dist/message/providers/MessageProvider.mjs.map +1 -1
  139. package/dist/theme/hooks/index.cjs +1 -7
  140. package/dist/theme/hooks/index.mjs +1 -4
  141. package/dist/theme/hooks/use-theme-actions.cjs +1 -20
  142. package/dist/theme/hooks/use-theme-actions.mjs +1 -20
  143. package/dist/theme/hooks/use-theme-actions.mjs.map +1 -1
  144. package/dist/theme/hooks/use-theme-store.cjs +1 -60
  145. package/dist/theme/hooks/use-theme-store.mjs +1 -58
  146. package/dist/theme/hooks/use-theme-store.mjs.map +1 -1
  147. package/dist/theme/index.cjs +1 -17
  148. package/dist/theme/index.mjs +1 -9
  149. package/dist/theme/molecules/index.cjs +1 -3
  150. package/dist/theme/molecules/index.mjs +1 -3
  151. package/dist/theme/molecules/theme-molecule.cjs +1 -13
  152. package/dist/theme/molecules/theme-molecule.mjs +1 -13
  153. package/dist/theme/molecules/theme-molecule.mjs.map +1 -1
  154. package/dist/theme/providers/ThemeProvider.cjs +1 -29
  155. package/dist/theme/providers/ThemeProvider.mjs +1 -29
  156. package/dist/theme/providers/ThemeProvider.mjs.map +1 -1
  157. package/dist/theme/utilities/theme-helpers.cjs +1 -70
  158. package/dist/theme/utilities/theme-helpers.mjs +1 -69
  159. package/dist/theme/utilities/theme-helpers.mjs.map +1 -1
  160. package/package.json +3 -3
@@ -1,8 +1 @@
1
- import { MessageViewport } from "./components/MessageViewport.mjs";
2
- import "./components/index.mjs";
3
- import { useMessageActions } from "./hooks/use-message-actions.mjs";
4
- import "./hooks/index.mjs";
5
- import { MessageProvider } from "./providers/MessageProvider.mjs";
6
- import { Toast, toast } from "@tamagui/toast";
7
-
8
- export { MessageProvider, MessageViewport, Toast, toast, useMessageActions };
1
+ import{MessageViewport as e}from"./components/MessageViewport.mjs";import"./components/index.mjs";import{useMessageActions as t}from"./hooks/use-message-actions.mjs";import"./hooks/index.mjs";import{MessageProvider as n}from"./providers/MessageProvider.mjs";import{Toast as r,toast as i}from"@tamagui/toast";export{n as MessageProvider,e as MessageViewport,r as Toast,i as toast,t as useMessageActions};
@@ -1,15 +1 @@
1
- // src/message/providers/MessageProvider.tsx
2
- /**
3
- * A compatibility wrapper for message descendants.
4
- *
5
- * Toast 2 uses a global store, so rendering a MessageProvider is no longer required
6
- * for useMessageActions. Mount Message or MessageViewport once to render the toasts.
7
- *
8
- * @example
9
- * <MessageProvider>
10
- * <App />
11
- * </MessageProvider>
12
- */
13
- const MessageProvider = ({ children }) => children;
14
-
15
- exports.MessageProvider = MessageProvider;
1
+ const e=({children:e})=>e;exports.MessageProvider=e;
@@ -1,16 +1,2 @@
1
- // src/message/providers/MessageProvider.tsx
2
- /**
3
- * A compatibility wrapper for message descendants.
4
- *
5
- * Toast 2 uses a global store, so rendering a MessageProvider is no longer required
6
- * for useMessageActions. Mount Message or MessageViewport once to render the toasts.
7
- *
8
- * @example
9
- * <MessageProvider>
10
- * <App />
11
- * </MessageProvider>
12
- */
13
- const MessageProvider = ({ children }) => children;
14
-
15
- export { MessageProvider };
1
+ const e=({children:e})=>e;export{e as MessageProvider};
16
2
  //# sourceMappingURL=MessageProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageProvider.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"MessageProvider.mjs","names":["MessageProvider","children"],"sources":[],"mappings":""}
@@ -1,7 +1 @@
1
- const require_use_theme_actions = require("./use-theme-actions.cjs");
2
- const require_use_theme_store = require("./use-theme-store.cjs");
3
-
4
- exports.useColorThemeName = require_use_theme_store.useColorThemeName;
5
- exports.useColorThemeNameExists = require_use_theme_store.useColorThemeNameExists;
6
- exports.useThemeActions = require_use_theme_actions.useThemeActions;
7
- exports.useThemeMode = require_use_theme_store.useThemeMode;
1
+ const e=require("./use-theme-actions.cjs"),t=require("./use-theme-store.cjs");exports.useColorThemeName=t.useColorThemeName,exports.useColorThemeNameExists=t.useColorThemeNameExists,exports.useThemeActions=e.useThemeActions,exports.useThemeMode=t.useThemeMode;
@@ -1,4 +1 @@
1
- import { useThemeActions } from "./use-theme-actions.mjs";
2
- import { useColorThemeName, useColorThemeNameExists, useThemeMode } from "./use-theme-store.mjs";
3
-
4
- export { useColorThemeName, useColorThemeNameExists, useThemeActions, useThemeMode };
1
+ import{useThemeActions as e}from"./use-theme-actions.mjs";import{useColorThemeName as t,useColorThemeNameExists as n,useThemeMode as r}from"./use-theme-store.mjs";export{t as useColorThemeName,n as useColorThemeNameExists,e as useThemeActions,r as useThemeMode};
@@ -1,20 +1 @@
1
- const require_theme_molecule = require("../molecules/theme-molecule.cjs");
2
- let jotai_utils = require("jotai/utils");
3
- let react = require("react");
4
-
5
- // src/theme/hooks/use-theme-actions.ts
6
- const useThemeActions = (opts) => {
7
- const themeMolecule = require_theme_molecule.ThemeApi.useMolecule(opts);
8
- const changeMode = (0, jotai_utils.useAtomCallback)((0, react.useCallback)((get, set, mode) => {
9
- if (get(themeMolecule.mode) !== mode) set(themeMolecule.mode, mode);
10
- }, [themeMolecule.mode]));
11
- return {
12
- changeMode,
13
- toggleMode: (0, jotai_utils.useAtomCallback)((0, react.useCallback)((get) => changeMode(get(themeMolecule.mode) === "light" ? "dark" : "light"), [changeMode, themeMolecule.mode])),
14
- reset: (0, jotai_utils.useAtomCallback)((0, react.useCallback)((get, set) => {
15
- set(themeMolecule.mode, jotai_utils.RESET);
16
- }, [themeMolecule.mode]))
17
- };
18
- };
19
-
20
- exports.useThemeActions = useThemeActions;
1
+ const e=require("../molecules/theme-molecule.cjs");let t=require("jotai/utils"),n=require("react");const r=r=>{let i=e.ThemeApi.useMolecule(r),a=(0,t.useAtomCallback)((0,n.useCallback)((e,t,n)=>{e(i.mode)!==n&&t(i.mode,n)},[i.mode]));return{changeMode:a,toggleMode:(0,t.useAtomCallback)((0,n.useCallback)(e=>a(e(i.mode)===`light`?`dark`:`light`),[a,i.mode])),reset:(0,t.useAtomCallback)((0,n.useCallback)((e,n)=>{n(i.mode,t.RESET)},[i.mode]))}};exports.useThemeActions=r;
@@ -1,21 +1,2 @@
1
- import { ThemeApi } from "../molecules/theme-molecule.mjs";
2
- import { RESET, useAtomCallback } from "jotai/utils";
3
- import { useCallback } from "react";
4
-
5
- // src/theme/hooks/use-theme-actions.ts
6
- const useThemeActions = (opts) => {
7
- const themeMolecule = ThemeApi.useMolecule(opts);
8
- const changeMode = useAtomCallback(useCallback((get, set, mode) => {
9
- if (get(themeMolecule.mode) !== mode) set(themeMolecule.mode, mode);
10
- }, [themeMolecule.mode]));
11
- return {
12
- changeMode,
13
- toggleMode: useAtomCallback(useCallback((get) => changeMode(get(themeMolecule.mode) === "light" ? "dark" : "light"), [changeMode, themeMolecule.mode])),
14
- reset: useAtomCallback(useCallback((get, set) => {
15
- set(themeMolecule.mode, RESET);
16
- }, [themeMolecule.mode]))
17
- };
18
- };
19
-
20
- export { useThemeActions };
1
+ import{ThemeApi as e}from"../molecules/theme-molecule.mjs";import{RESET as t,useAtomCallback as n}from"jotai/utils";import{useCallback as r}from"react";const i=i=>{let a=e.useMolecule(i),o=n(r((e,t,n)=>{e(a.mode)!==n&&t(a.mode,n)},[a.mode]));return{changeMode:o,toggleMode:n(r(e=>o(e(a.mode)===`light`?`dark`:`light`),[o,a.mode])),reset:n(r((e,n)=>{n(a.mode,t)},[a.mode]))}};export{i as useThemeActions};
21
2
  //# sourceMappingURL=use-theme-actions.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-theme-actions.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"use-theme-actions.mjs","names":["useThemeActions","themeMolecule","ThemeApi","opts","changeMode","useAtomCallback","useCallback","get","mode","set","RESET"],"sources":[],"mappings":""}
@@ -1,60 +1 @@
1
- const require_theme_molecule = require("../molecules/theme-molecule.cjs");
2
- const require_theme_helpers = require("../utilities/theme-helpers.cjs");
3
- let _tamagui_core = require("@tamagui/core");
4
-
5
- // src/theme/hooks/use-theme-store.ts
6
- /**
7
- * Get the color role scheme for the current theme name
8
- *
9
- * @remarks
10
- * The following color roles are checked:
11
- * - base
12
- * - brand
13
- * - alternate
14
- * - accent
15
- * - link
16
- * - discovery
17
- * - info
18
- * - warning
19
- * - danger
20
- * - success
21
- * - positive
22
- * - negative
23
- *
24
- * @returns The color role scheme for the theme name or undefined
25
- */
26
- const useColorThemeName = () => {
27
- const theme = (0, _tamagui_core.useThemeName)();
28
- return require_theme_helpers.getThemeColorThemeName(theme);
29
- };
30
- /**
31
- * Check if a color role scheme is set for the current theme name
32
- *
33
- * @remarks
34
- * The following color roles are checked:
35
- * - base
36
- * - brand
37
- * - alternate
38
- * - accent
39
- * - link
40
- * - discovery
41
- * - info
42
- * - warning
43
- * - danger
44
- * - success
45
- * - positive
46
- * - negative
47
- *
48
- * @returns An indication if a theme color scheme is set
49
- */
50
- const useColorThemeNameExists = () => {
51
- const theme = (0, _tamagui_core.useThemeName)();
52
- return require_theme_helpers.themeColorThemeNameExists(theme);
53
- };
54
- const useThemeMode = (options) => {
55
- return require_theme_molecule.ThemeApi.use(options).mode.get();
56
- };
57
-
58
- exports.useColorThemeName = useColorThemeName;
59
- exports.useColorThemeNameExists = useColorThemeNameExists;
60
- exports.useThemeMode = useThemeMode;
1
+ const e=require("../molecules/theme-molecule.cjs"),t=require("../utilities/theme-helpers.cjs");let n=require("@tamagui/core");const r=()=>{let e=(0,n.useThemeName)();return t.getThemeColorThemeName(e)},i=()=>{let e=(0,n.useThemeName)();return t.themeColorThemeNameExists(e)},a=t=>e.ThemeApi.use(t).mode.get();exports.useColorThemeName=r,exports.useColorThemeNameExists=i,exports.useThemeMode=a;
@@ -1,59 +1,2 @@
1
- import { ThemeApi } from "../molecules/theme-molecule.mjs";
2
- import { getThemeColorThemeName, themeColorThemeNameExists } from "../utilities/theme-helpers.mjs";
3
- import { useThemeName } from "@tamagui/core";
4
-
5
- // src/theme/hooks/use-theme-store.ts
6
- /**
7
- * Get the color role scheme for the current theme name
8
- *
9
- * @remarks
10
- * The following color roles are checked:
11
- * - base
12
- * - brand
13
- * - alternate
14
- * - accent
15
- * - link
16
- * - discovery
17
- * - info
18
- * - warning
19
- * - danger
20
- * - success
21
- * - positive
22
- * - negative
23
- *
24
- * @returns The color role scheme for the theme name or undefined
25
- */
26
- const useColorThemeName = () => {
27
- const theme = useThemeName();
28
- return getThemeColorThemeName(theme);
29
- };
30
- /**
31
- * Check if a color role scheme is set for the current theme name
32
- *
33
- * @remarks
34
- * The following color roles are checked:
35
- * - base
36
- * - brand
37
- * - alternate
38
- * - accent
39
- * - link
40
- * - discovery
41
- * - info
42
- * - warning
43
- * - danger
44
- * - success
45
- * - positive
46
- * - negative
47
- *
48
- * @returns An indication if a theme color scheme is set
49
- */
50
- const useColorThemeNameExists = () => {
51
- const theme = useThemeName();
52
- return themeColorThemeNameExists(theme);
53
- };
54
- const useThemeMode = (options) => {
55
- return ThemeApi.use(options).mode.get();
56
- };
57
-
58
- export { useColorThemeName, useColorThemeNameExists, useThemeMode };
1
+ import{ThemeApi as e}from"../molecules/theme-molecule.mjs";import{getThemeColorThemeName as t,themeColorThemeNameExists as n}from"../utilities/theme-helpers.mjs";import{useThemeName as r}from"@tamagui/core";const i=()=>{let e=r();return t(e)},a=()=>{let e=r();return n(e)},o=t=>e.use(t).mode.get();export{i as useColorThemeName,a as useColorThemeNameExists,o as useThemeMode};
59
2
  //# sourceMappingURL=use-theme-store.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-theme-store.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"use-theme-store.mjs","names":["useColorThemeName","theme","useThemeName","getThemeColorThemeName","useColorThemeNameExists","themeColorThemeNameExists","useThemeMode","ThemeApi","options"],"sources":[],"mappings":""}
@@ -1,17 +1 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_theme_molecule = require("./molecules/theme-molecule.cjs");
3
- const require_use_theme_actions = require("./hooks/use-theme-actions.cjs");
4
- const require_theme_helpers = require("./utilities/theme-helpers.cjs");
5
- const require_use_theme_store = require("./hooks/use-theme-store.cjs");
6
- require("./hooks/index.cjs");
7
- require("./molecules/index.cjs");
8
- const require_ThemeProvider = require("./providers/ThemeProvider.cjs");
9
-
10
- exports.ThemeApi = require_theme_molecule.ThemeApi;
11
- exports.ThemeProvider = require_ThemeProvider.ThemeProvider;
12
- exports.getThemeColorThemeName = require_theme_helpers.getThemeColorThemeName;
13
- exports.themeColorThemeNameExists = require_theme_helpers.themeColorThemeNameExists;
14
- exports.useColorThemeName = require_use_theme_store.useColorThemeName;
15
- exports.useColorThemeNameExists = require_use_theme_store.useColorThemeNameExists;
16
- exports.useThemeActions = require_use_theme_actions.useThemeActions;
17
- exports.useThemeMode = require_use_theme_store.useThemeMode;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./molecules/theme-molecule.cjs"),t=require("./hooks/use-theme-actions.cjs"),n=require("./utilities/theme-helpers.cjs"),r=require("./hooks/use-theme-store.cjs");require("./hooks/index.cjs"),require("./molecules/index.cjs");const i=require("./providers/ThemeProvider.cjs");exports.ThemeApi=e.ThemeApi,exports.ThemeProvider=i.ThemeProvider,exports.getThemeColorThemeName=n.getThemeColorThemeName,exports.themeColorThemeNameExists=n.themeColorThemeNameExists,exports.useColorThemeName=r.useColorThemeName,exports.useColorThemeNameExists=r.useColorThemeNameExists,exports.useThemeActions=t.useThemeActions,exports.useThemeMode=r.useThemeMode;
@@ -1,9 +1 @@
1
- import { ThemeApi } from "./molecules/theme-molecule.mjs";
2
- import { useThemeActions } from "./hooks/use-theme-actions.mjs";
3
- import { getThemeColorThemeName, themeColorThemeNameExists } from "./utilities/theme-helpers.mjs";
4
- import { useColorThemeName, useColorThemeNameExists, useThemeMode } from "./hooks/use-theme-store.mjs";
5
- import "./hooks/index.mjs";
6
- import "./molecules/index.mjs";
7
- import { ThemeProvider } from "./providers/ThemeProvider.mjs";
8
-
9
- export { ThemeApi, ThemeProvider, getThemeColorThemeName, themeColorThemeNameExists, useColorThemeName, useColorThemeNameExists, useThemeActions, useThemeMode };
1
+ import{ThemeApi as e}from"./molecules/theme-molecule.mjs";import{useThemeActions as t}from"./hooks/use-theme-actions.mjs";import{getThemeColorThemeName as n,themeColorThemeNameExists as r}from"./utilities/theme-helpers.mjs";import{useColorThemeName as i,useColorThemeNameExists as a,useThemeMode as o}from"./hooks/use-theme-store.mjs";import"./hooks/index.mjs";import"./molecules/index.mjs";import{ThemeProvider as s}from"./providers/ThemeProvider.mjs";export{e as ThemeApi,s as ThemeProvider,n as getThemeColorThemeName,r as themeColorThemeNameExists,i as useColorThemeName,a as useColorThemeNameExists,t as useThemeActions,o as useThemeMode};
@@ -1,3 +1 @@
1
- const require_theme_molecule = require("./theme-molecule.cjs");
2
-
3
- exports.ThemeApi = require_theme_molecule.ThemeApi;
1
+ const e=require("./theme-molecule.cjs");exports.ThemeApi=e.ThemeApi;
@@ -1,3 +1 @@
1
- import { ThemeApi } from "./theme-molecule.mjs";
2
-
3
- export { ThemeApi };
1
+ export{ThemeApi}from"./theme-molecule.mjs";
@@ -1,13 +1 @@
1
- const require_create_molecule = require("../../base/utilities/create-molecule.cjs");
2
- let jotai_utils = require("jotai/utils");
3
- let jotai = require("jotai");
4
-
5
- // src/theme/molecules/theme-molecule.ts
6
- const ThemeApi = require_create_molecule.createMoleculeApi(() => {
7
- return {
8
- items: (0, jotai.atom)(["light", "dark"]),
9
- mode: (0, jotai_utils.atomWithReset)("dark")
10
- };
11
- }, { type: "theme" });
12
-
13
- exports.ThemeApi = ThemeApi;
1
+ const e=require("../../base/utilities/create-molecule.cjs");let t=require("jotai/utils"),n=require("jotai");const r=e.createMoleculeApi(()=>({items:(0,n.atom)([`light`,`dark`]),mode:(0,t.atomWithReset)(`dark`)}),{type:`theme`});exports.ThemeApi=r;
@@ -1,14 +1,2 @@
1
- import { createMoleculeApi } from "../../base/utilities/create-molecule.mjs";
2
- import { atomWithReset } from "jotai/utils";
3
- import { atom } from "jotai";
4
-
5
- // src/theme/molecules/theme-molecule.ts
6
- const ThemeApi = createMoleculeApi(() => {
7
- return {
8
- items: atom(["light", "dark"]),
9
- mode: atomWithReset("dark")
10
- };
11
- }, { type: "theme" });
12
-
13
- export { ThemeApi };
1
+ import{createMoleculeApi as e}from"../../base/utilities/create-molecule.mjs";import{atomWithReset as t}from"jotai/utils";import{atom as n}from"jotai";const r=e(()=>({items:n([`light`,`dark`]),mode:t(`dark`)}),{type:`theme`});export{r as ThemeApi};
14
2
  //# sourceMappingURL=theme-molecule.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-molecule.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"theme-molecule.mjs","names":["ThemeApi","createMoleculeApi","atom","atomWithReset"],"sources":[],"mappings":""}
@@ -1,29 +1 @@
1
- const require_theme_molecule = require("../molecules/theme-molecule.cjs");
2
- let react = require("react");
3
- let _tamagui_core = require("@tamagui/core");
4
-
5
- // src/theme/providers/ThemeProvider.tsx
6
- const ThemeStateManager = ({ children, disableInjectCSS = true, ...props }) => {
7
- const mode = require_theme_molecule.ThemeApi.use().mode.get();
8
- return <_tamagui_core.TamaguiProvider {...props} defaultTheme={mode} disableInjectCSS={disableInjectCSS}>
9
- {children}
10
- </_tamagui_core.TamaguiProvider>;
11
- };
12
- const DEFAULT_ITEMS = ["light", "dark"];
13
- const ThemeProvider = ({ children, defaultMode = "dark", items = DEFAULT_ITEMS, ...props }) => {
14
- const mode = (0, react.useMemo)(() => {
15
- if (typeof window !== "undefined" && window.matchMedia) {
16
- if (window.matchMedia("(prefers-color-scheme: light)").matches) return "light";
17
- if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
18
- }
19
- return defaultMode;
20
- }, [defaultMode]);
21
- return <require_theme_molecule.ThemeApi.Provider scope="theme" initialState={{
22
- mode,
23
- items
24
- }}>
25
- <ThemeStateManager {...props}>{children}</ThemeStateManager>
26
- </require_theme_molecule.ThemeApi.Provider>;
27
- };
28
-
29
- exports.ThemeProvider = ThemeProvider;
1
+ const e=require("../molecules/theme-molecule.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@tamagui/core");const i=({children:t,disableInjectCSS:i=!0,...a})=>{let o=e.ThemeApi.use().mode.get();return/* @__PURE__ */ (0,n.jsx)(r.TamaguiProvider,{...a,defaultTheme:o,disableInjectCSS:i,children:t})},a=[`light`,`dark`],o=({children:r,defaultMode:o=`dark`,items:s=a,...c})=>{let l=(0,t.useMemo)(()=>{if(typeof window<`u`&&window.matchMedia){if(window.matchMedia(`(prefers-color-scheme: light)`).matches)return`light`;if(window.matchMedia(`(prefers-color-scheme: dark)`).matches)return`dark`}return o},[o]);return/* @__PURE__ */ (0,n.jsx)(e.ThemeApi.Provider,{scope:`theme`,initialState:{mode:l,items:s},children:/* @__PURE__ */ (0,n.jsx)(i,{...c,children:r})})};exports.ThemeProvider=o;
@@ -1,30 +1,2 @@
1
- import { ThemeApi } from "../molecules/theme-molecule.mjs";
2
- import { useMemo } from "react";
3
- import { TamaguiProvider } from "@tamagui/core";
4
-
5
- // src/theme/providers/ThemeProvider.tsx
6
- const ThemeStateManager = ({ children, disableInjectCSS = true, ...props }) => {
7
- const mode = ThemeApi.use().mode.get();
8
- return <TamaguiProvider {...props} defaultTheme={mode} disableInjectCSS={disableInjectCSS}>
9
- {children}
10
- </TamaguiProvider>;
11
- };
12
- const DEFAULT_ITEMS = ["light", "dark"];
13
- const ThemeProvider = ({ children, defaultMode = "dark", items = DEFAULT_ITEMS, ...props }) => {
14
- const mode = useMemo(() => {
15
- if (typeof window !== "undefined" && window.matchMedia) {
16
- if (window.matchMedia("(prefers-color-scheme: light)").matches) return "light";
17
- if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
18
- }
19
- return defaultMode;
20
- }, [defaultMode]);
21
- return <ThemeApi.Provider scope="theme" initialState={{
22
- mode,
23
- items
24
- }}>
25
- <ThemeStateManager {...props}>{children}</ThemeStateManager>
26
- </ThemeApi.Provider>;
27
- };
28
-
29
- export { ThemeProvider };
1
+ import{ThemeApi as e}from"../molecules/theme-molecule.mjs";import{useMemo as t}from"react";import{jsx as n}from"react/jsx-runtime";import{TamaguiProvider as r}from"@tamagui/core";const i=({children:t,disableInjectCSS:i=!0,...a})=>{let o=e.use().mode.get();return/* @__PURE__ */ n(r,{...a,defaultTheme:o,disableInjectCSS:i,children:t})},a=[`light`,`dark`],o=({children:r,defaultMode:o=`dark`,items:s=a,...c})=>{let l=t(()=>{if(typeof window<`u`&&window.matchMedia){if(window.matchMedia(`(prefers-color-scheme: light)`).matches)return`light`;if(window.matchMedia(`(prefers-color-scheme: dark)`).matches)return`dark`}return o},[o]);return/* @__PURE__ */ n(e.Provider,{scope:`theme`,initialState:{mode:l,items:s},children:/* @__PURE__ */ n(i,{...c,children:r})})};export{o as ThemeProvider};
30
2
  //# sourceMappingURL=ThemeProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"ThemeProvider.mjs","names":["ThemeStateManager","props","mode","ThemeApi","TamaguiProvider","DEFAULT_ITEMS","ThemeProvider","useMemo","defaultMode"],"sources":[],"mappings":""}
@@ -1,70 +1 @@
1
- // src/theme/utilities/theme-helpers.ts
2
- /**
3
- * Get the color role scheme for the current theme name
4
- *
5
- * @example
6
- * getThemeColorThemeName('dark') // undefined
7
- * getThemeColorThemeName('dark_Input') // undefined
8
- * getThemeColorThemeName('dark_base_Input') // "base"
9
- * getThemeColorThemeName('dark_brand_Input') // "brand"
10
- *
11
- * @remarks
12
- * The following color roles are checked:
13
- * - base
14
- * - secondary
15
- * - brand
16
- * - discovery
17
- * - info
18
- * - warning
19
- * - danger
20
- * - success
21
- * - positive
22
- * - negative
23
- *
24
- * @param theme - The theme name
25
- * @returns The color role scheme for the theme name or undefined
26
- */
27
- const getThemeColorThemeName = (theme) => {
28
- if (theme) {
29
- if (theme.includes("base")) return "base";
30
- else if (theme.includes("brand")) return "brand";
31
- else if (theme.includes("discovery")) return "discovery";
32
- else if (theme.includes("info")) return "info";
33
- else if (theme.includes("warning")) return "warning";
34
- else if (theme.includes("danger")) return "danger";
35
- else if (theme.includes("success")) return "success";
36
- else if (theme.includes("positive")) return "positive";
37
- else if (theme.includes("negative")) return "negative";
38
- }
39
- };
40
- /**
41
- * Check if a color role scheme is set for the current theme name
42
- *
43
- * @example
44
- * themeColorThemeNameExists('dark') // false
45
- * themeColorThemeNameExists('dark_Input') // false
46
- * themeColorThemeNameExists('dark_base_Input') // true
47
- * themeColorThemeNameExists('dark_brand_Input') // true
48
- *
49
- * @remarks
50
- * The following color roles are checked:
51
- * - base
52
- * - secondary
53
- * - brand
54
- * - discovery
55
- * - info
56
- * - warning
57
- * - danger
58
- * - success
59
- * - positive
60
- * - negative
61
- *
62
- * @param theme - The theme name
63
- * @returns An indication if a theme color scheme is set
64
- */
65
- const themeColorThemeNameExists = (theme) => {
66
- return Boolean(getThemeColorThemeName(theme));
67
- };
68
-
69
- exports.getThemeColorThemeName = getThemeColorThemeName;
70
- exports.themeColorThemeNameExists = themeColorThemeNameExists;
1
+ const e=e=>{if(e){if(e.includes(`base`))return`base`;if(e.includes(`brand`))return`brand`;if(e.includes(`discovery`))return`discovery`;if(e.includes(`info`))return`info`;if(e.includes(`warning`))return`warning`;if(e.includes(`danger`))return`danger`;if(e.includes(`success`))return`success`;if(e.includes(`positive`))return`positive`;if(e.includes(`negative`))return`negative`}},t=t=>!!e(t);exports.getThemeColorThemeName=e,exports.themeColorThemeNameExists=t;
@@ -1,70 +1,2 @@
1
- // src/theme/utilities/theme-helpers.ts
2
- /**
3
- * Get the color role scheme for the current theme name
4
- *
5
- * @example
6
- * getThemeColorThemeName('dark') // undefined
7
- * getThemeColorThemeName('dark_Input') // undefined
8
- * getThemeColorThemeName('dark_base_Input') // "base"
9
- * getThemeColorThemeName('dark_brand_Input') // "brand"
10
- *
11
- * @remarks
12
- * The following color roles are checked:
13
- * - base
14
- * - secondary
15
- * - brand
16
- * - discovery
17
- * - info
18
- * - warning
19
- * - danger
20
- * - success
21
- * - positive
22
- * - negative
23
- *
24
- * @param theme - The theme name
25
- * @returns The color role scheme for the theme name or undefined
26
- */
27
- const getThemeColorThemeName = (theme) => {
28
- if (theme) {
29
- if (theme.includes("base")) return "base";
30
- else if (theme.includes("brand")) return "brand";
31
- else if (theme.includes("discovery")) return "discovery";
32
- else if (theme.includes("info")) return "info";
33
- else if (theme.includes("warning")) return "warning";
34
- else if (theme.includes("danger")) return "danger";
35
- else if (theme.includes("success")) return "success";
36
- else if (theme.includes("positive")) return "positive";
37
- else if (theme.includes("negative")) return "negative";
38
- }
39
- };
40
- /**
41
- * Check if a color role scheme is set for the current theme name
42
- *
43
- * @example
44
- * themeColorThemeNameExists('dark') // false
45
- * themeColorThemeNameExists('dark_Input') // false
46
- * themeColorThemeNameExists('dark_base_Input') // true
47
- * themeColorThemeNameExists('dark_brand_Input') // true
48
- *
49
- * @remarks
50
- * The following color roles are checked:
51
- * - base
52
- * - secondary
53
- * - brand
54
- * - discovery
55
- * - info
56
- * - warning
57
- * - danger
58
- * - success
59
- * - positive
60
- * - negative
61
- *
62
- * @param theme - The theme name
63
- * @returns An indication if a theme color scheme is set
64
- */
65
- const themeColorThemeNameExists = (theme) => {
66
- return Boolean(getThemeColorThemeName(theme));
67
- };
68
-
69
- export { getThemeColorThemeName, themeColorThemeNameExists };
1
+ const e=e=>{if(e){if(e.includes(`base`))return`base`;if(e.includes(`brand`))return`brand`;if(e.includes(`discovery`))return`discovery`;if(e.includes(`info`))return`info`;if(e.includes(`warning`))return`warning`;if(e.includes(`danger`))return`danger`;if(e.includes(`success`))return`success`;if(e.includes(`positive`))return`positive`;if(e.includes(`negative`))return`negative`}},t=t=>!!e(t);export{e as getThemeColorThemeName,t as themeColorThemeNameExists};
70
2
  //# sourceMappingURL=theme-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-helpers.mjs","names":[],"sources":[],"mappings":""}
1
+ {"version":3,"file":"theme-helpers.mjs","names":["getThemeColorThemeName","theme","themeColorThemeNameExists"],"sources":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclone-ui/state",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "type": "module",
5
5
  "description": "A state management package used to handle state in Storm Software applications.",
6
6
  "repository": {
@@ -118,7 +118,7 @@
118
118
  "optics-ts": "^2.4.1",
119
119
  "react-native-safe-area-context": "^4.14.1",
120
120
  "valibot": "^0.42.1",
121
- "@cyclone-ui/helpers": "0.3.30"
121
+ "@cyclone-ui/helpers": "0.3.31"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@powerlines/plugin-tsdown": "^0.1.618",
@@ -129,5 +129,5 @@
129
129
  },
130
130
  "publishConfig": { "access": "public" },
131
131
  "module": "./dist/index.mjs",
132
- "gitHead": "fa28ae1a56d010305984318717292f2501490fd9"
132
+ "gitHead": "74c039b0d98fa29c94456dba63e0ad376259d559"
133
133
  }