@cyberskill/shared 3.2.0 → 3.3.0

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 (237) hide show
  1. package/dist/config/commitlint/index.js +8 -9
  2. package/dist/config/commitlint/index.js.map +1 -1
  3. package/dist/config/config.type.js +8 -5
  4. package/dist/config/config.type.js.map +1 -1
  5. package/dist/config/config.util.js +33 -42
  6. package/dist/config/config.util.js.map +1 -1
  7. package/dist/config/env/env.constant.js +6 -5
  8. package/dist/config/env/env.constant.js.map +1 -1
  9. package/dist/config/env/env.util.js +26 -27
  10. package/dist/config/env/env.util.js.map +1 -1
  11. package/dist/config/env/index.js +2 -7
  12. package/dist/config/eslint/index.js +23 -19
  13. package/dist/config/eslint/index.js.map +1 -1
  14. package/dist/config/graphql-codegen/graphql-codegen.util.js +30 -38
  15. package/dist/config/graphql-codegen/graphql-codegen.util.js.map +1 -1
  16. package/dist/config/graphql-codegen/index.js +2 -5
  17. package/dist/config/index.js +3 -7
  18. package/dist/config/lint-staged/index.js +8 -7
  19. package/dist/config/lint-staged/index.js.map +1 -1
  20. package/dist/config/storybook/index.js +2 -6
  21. package/dist/config/storybook/storybook.main.js +19 -18
  22. package/dist/config/storybook/storybook.main.js.map +1 -1
  23. package/dist/config/storybook/storybook.preview.js +31 -37
  24. package/dist/config/storybook/storybook.preview.js.map +1 -1
  25. package/dist/config/vitest/index.js +3 -7
  26. package/dist/config/vitest/vitest.e2e.js +14 -17
  27. package/dist/config/vitest/vitest.e2e.js.map +1 -1
  28. package/dist/config/vitest/vitest.unit.js +31 -32
  29. package/dist/config/vitest/vitest.unit.js.map +1 -1
  30. package/dist/constant/common.js +6 -5
  31. package/dist/constant/common.js.map +1 -1
  32. package/dist/constant/index.js +3 -7
  33. package/dist/constant/response-status.d.ts +186 -186
  34. package/dist/constant/response-status.js +254 -253
  35. package/dist/constant/response-status.js.map +1 -1
  36. package/dist/node/apollo-server/apollo-server.util.js +27 -29
  37. package/dist/node/apollo-server/apollo-server.util.js.map +1 -1
  38. package/dist/node/apollo-server/index.js +2 -7
  39. package/dist/node/cli/index.js +112 -113
  40. package/dist/node/cli/index.js.map +1 -1
  41. package/dist/node/command/command.type.js +8 -5
  42. package/dist/node/command/command.type.js.map +1 -1
  43. package/dist/node/command/command.util.js +136 -149
  44. package/dist/node/command/command.util.js.map +1 -1
  45. package/dist/node/command/index.js +3 -12
  46. package/dist/node/express/express.type.d.ts +11 -0
  47. package/dist/node/express/express.type.js +2 -0
  48. package/dist/node/express/express.util.js +74 -65
  49. package/dist/node/express/express.util.js.map +1 -1
  50. package/dist/node/express/index.js +3 -14
  51. package/dist/node/fs/fs.util.js +27 -51
  52. package/dist/node/fs/fs.util.js.map +1 -1
  53. package/dist/node/fs/index.js +2 -19
  54. package/dist/node/log/index.js +2 -8
  55. package/dist/node/log/log.type.js +8 -5
  56. package/dist/node/log/log.type.js.map +1 -1
  57. package/dist/node/log/log.util.js +51 -68
  58. package/dist/node/log/log.util.js.map +1 -1
  59. package/dist/node/mongo/index.js +8 -26
  60. package/dist/node/mongo/mongo.constant.js +6 -6
  61. package/dist/node/mongo/mongo.constant.js.map +1 -1
  62. package/dist/node/mongo/mongo.controller.mongoose.d.ts +6 -1
  63. package/dist/node/mongo/mongo.controller.mongoose.js +333 -467
  64. package/dist/node/mongo/mongo.controller.mongoose.js.map +1 -1
  65. package/dist/node/mongo/mongo.controller.native.js +153 -212
  66. package/dist/node/mongo/mongo.controller.native.js.map +1 -1
  67. package/dist/node/mongo/mongo.dynamic-populate.js +164 -192
  68. package/dist/node/mongo/mongo.dynamic-populate.js.map +1 -1
  69. package/dist/node/mongo/mongo.populate.js +229 -262
  70. package/dist/node/mongo/mongo.populate.js.map +1 -1
  71. package/dist/node/mongo/mongo.type.js +8 -17
  72. package/dist/node/mongo/mongo.type.js.map +1 -1
  73. package/dist/node/mongo/mongo.util.js +134 -293
  74. package/dist/node/mongo/mongo.util.js.map +1 -1
  75. package/dist/node/package/index.js +3 -11
  76. package/dist/node/package/package.type.js +8 -5
  77. package/dist/node/package/package.type.js.map +1 -1
  78. package/dist/node/package/package.util.js +216 -225
  79. package/dist/node/package/package.util.js.map +1 -1
  80. package/dist/node/path/index.js +3 -58
  81. package/dist/node/path/path.constant.js +211 -298
  82. package/dist/node/path/path.constant.js.map +1 -1
  83. package/dist/node/path/path.util.js +13 -16
  84. package/dist/node/path/path.util.js.map +1 -1
  85. package/dist/node/storage/index.js +3 -10
  86. package/dist/node/storage/storage.constant.js +6 -8
  87. package/dist/node/storage/storage.constant.js.map +1 -1
  88. package/dist/node/storage/storage.util.js +127 -178
  89. package/dist/node/storage/storage.util.js.map +1 -1
  90. package/dist/node/upload/index.js +4 -16
  91. package/dist/node/upload/upload.constant.js +58 -32
  92. package/dist/node/upload/upload.constant.js.map +1 -1
  93. package/dist/node/upload/upload.type.js +8 -5
  94. package/dist/node/upload/upload.type.js.map +1 -1
  95. package/dist/node/upload/upload.util.js +125 -137
  96. package/dist/node/upload/upload.util.js.map +1 -1
  97. package/dist/node/ws/index.js +2 -6
  98. package/dist/node/ws/ws.type.d.ts +7 -8
  99. package/dist/node/ws/ws.util.js +46 -44
  100. package/dist/node/ws/ws.util.js.map +1 -1
  101. package/dist/node_modules/.pnpm/vitest@4.1.0_@types_node@25.5.0_jsdom@29.0.0_@noble_hashes@1.8.0__vite@8.0.0_@types_nod_53aa4254f295b3c40bb8f17b6ab226b5/node_modules/vitest/dist/config.js +8 -0
  102. package/dist/node_modules/.pnpm/vitest@4.1.0_@types_node@25.5.0_jsdom@29.0.0_@noble_hashes@1.8.0__vite@8.0.0_@types_nod_53aa4254f295b3c40bb8f17b6ab226b5/node_modules/vitest/dist/config.js.map +1 -0
  103. package/dist/react/apollo-client/apollo-client.component.js +16 -18
  104. package/dist/react/apollo-client/apollo-client.component.js.map +1 -1
  105. package/dist/react/apollo-client/apollo-client.constant.js +6 -5
  106. package/dist/react/apollo-client/apollo-client.constant.js.map +1 -1
  107. package/dist/react/apollo-client/apollo-client.context.js +10 -13
  108. package/dist/react/apollo-client/apollo-client.context.js.map +1 -1
  109. package/dist/react/apollo-client/apollo-client.module.scss.js +8 -7
  110. package/dist/react/apollo-client/apollo-client.module.scss.js.map +1 -1
  111. package/dist/react/apollo-client/apollo-client.util.js +57 -75
  112. package/dist/react/apollo-client/apollo-client.util.js.map +1 -1
  113. package/dist/react/apollo-client/index.js +7 -30
  114. package/dist/react/apollo-client/links/index.js +2 -5
  115. package/dist/react/apollo-client/links/upload.js +63 -107
  116. package/dist/react/apollo-client/links/upload.js.map +1 -1
  117. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +14 -16
  118. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js.map +1 -1
  119. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js +8 -7
  120. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js.map +1 -1
  121. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +14 -14
  122. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js.map +1 -1
  123. package/dist/react/apollo-client-nextjs/index.js +3 -7
  124. package/dist/react/apollo-error/apollo-error.component.js +57 -69
  125. package/dist/react/apollo-error/apollo-error.component.js.map +1 -1
  126. package/dist/react/apollo-error/apollo-error.context.js +7 -6
  127. package/dist/react/apollo-error/apollo-error.context.js.map +1 -1
  128. package/dist/react/apollo-error/apollo-error.hook.js +10 -10
  129. package/dist/react/apollo-error/apollo-error.hook.js.map +1 -1
  130. package/dist/react/apollo-error/apollo-error.module.scss.js +15 -11
  131. package/dist/react/apollo-error/apollo-error.module.scss.js.map +1 -1
  132. package/dist/react/apollo-error/apollo-error.provider.js +31 -25
  133. package/dist/react/apollo-error/apollo-error.provider.js.map +1 -1
  134. package/dist/react/apollo-error/apollo-error.util.js +14 -16
  135. package/dist/react/apollo-error/apollo-error.util.js.map +1 -1
  136. package/dist/react/apollo-error/index.js +5 -15
  137. package/dist/react/i18next/i18next.hook.js +7 -6
  138. package/dist/react/i18next/i18next.hook.js.map +1 -1
  139. package/dist/react/i18next/i18next.util.js +9 -8
  140. package/dist/react/i18next/i18next.util.js.map +1 -1
  141. package/dist/react/i18next/index.js +3 -7
  142. package/dist/react/loading/index.js +3 -9
  143. package/dist/react/loading/loading.component.js +47 -48
  144. package/dist/react/loading/loading.component.js.map +1 -1
  145. package/dist/react/loading/loading.context.js +7 -6
  146. package/dist/react/loading/loading.context.js.map +1 -1
  147. package/dist/react/loading/loading.hook.js +11 -11
  148. package/dist/react/loading/loading.hook.js.map +1 -1
  149. package/dist/react/loading/loading.module.scss.js +18 -15
  150. package/dist/react/loading/loading.module.scss.js.map +1 -1
  151. package/dist/react/loading/loading.provider.js +26 -18
  152. package/dist/react/loading/loading.provider.js.map +1 -1
  153. package/dist/react/log/index.js +2 -6
  154. package/dist/react/log/log.util.d.ts +8 -0
  155. package/dist/react/log/log.util.js +33 -29
  156. package/dist/react/log/log.util.js.map +1 -1
  157. package/dist/react/next-intl/index.js +6 -14
  158. package/dist/react/next-intl/next-intl.constant.js +16 -15
  159. package/dist/react/next-intl/next-intl.constant.js.map +1 -1
  160. package/dist/react/next-intl/next-intl.context.js +7 -6
  161. package/dist/react/next-intl/next-intl.context.js.map +1 -1
  162. package/dist/react/next-intl/next-intl.hoc.js +20 -23
  163. package/dist/react/next-intl/next-intl.hoc.js.map +1 -1
  164. package/dist/react/next-intl/next-intl.hook.js +13 -14
  165. package/dist/react/next-intl/next-intl.hook.js.map +1 -1
  166. package/dist/react/next-intl/next-intl.provider.js +28 -23
  167. package/dist/react/next-intl/next-intl.provider.js.map +1 -1
  168. package/dist/react/storage/index.js +3 -7
  169. package/dist/react/storage/storage.hook.js +61 -58
  170. package/dist/react/storage/storage.hook.js.map +1 -1
  171. package/dist/react/storage/storage.util.js +36 -68
  172. package/dist/react/storage/storage.util.js.map +1 -1
  173. package/dist/react/toast/index.js +2 -6
  174. package/dist/react/userback/index.js +2 -5
  175. package/dist/react/userback/userback.component.js +27 -27
  176. package/dist/react/userback/userback.component.js.map +1 -1
  177. package/dist/style.css +2 -1
  178. package/dist/typescript/common.type.js +8 -5
  179. package/dist/typescript/common.type.js.map +1 -1
  180. package/dist/typescript/index.js +2 -5
  181. package/dist/util/common/common.util.js +119 -48
  182. package/dist/util/common/common.util.js.map +1 -1
  183. package/dist/util/common/index.js +2 -9
  184. package/dist/util/index.js +6 -27
  185. package/dist/util/object/index.d.ts +3 -0
  186. package/dist/util/object/index.js +2 -10
  187. package/dist/util/object/object.util.js +94 -128
  188. package/dist/util/object/object.util.js.map +1 -1
  189. package/dist/util/serializer/index.js +2 -5
  190. package/dist/util/serializer/serializer.util.js +73 -78
  191. package/dist/util/serializer/serializer.util.js.map +1 -1
  192. package/dist/util/string/index.d.ts +3 -0
  193. package/dist/util/string/index.js +2 -10
  194. package/dist/util/string/string.util.js +59 -71
  195. package/dist/util/string/string.util.js.map +1 -1
  196. package/dist/util/validate/index.d.ts +3 -0
  197. package/dist/util/validate/index.js +2 -5
  198. package/dist/util/validate/validate.util.js +13 -39
  199. package/dist/util/validate/validate.util.js.map +1 -1
  200. package/package.json +29 -27
  201. package/dist/config/env/index.js.map +0 -1
  202. package/dist/config/graphql-codegen/index.js.map +0 -1
  203. package/dist/config/index.js.map +0 -1
  204. package/dist/config/storybook/index.js.map +0 -1
  205. package/dist/config/vitest/index.js.map +0 -1
  206. package/dist/constant/index.js.map +0 -1
  207. package/dist/node/apollo-server/index.js.map +0 -1
  208. package/dist/node/command/index.js.map +0 -1
  209. package/dist/node/express/index.js.map +0 -1
  210. package/dist/node/fs/index.js.map +0 -1
  211. package/dist/node/log/index.js.map +0 -1
  212. package/dist/node/mongo/index.js.map +0 -1
  213. package/dist/node/package/index.js.map +0 -1
  214. package/dist/node/path/index.js.map +0 -1
  215. package/dist/node/storage/index.js.map +0 -1
  216. package/dist/node/upload/index.js.map +0 -1
  217. package/dist/node/ws/index.js.map +0 -1
  218. package/dist/node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.5_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js +0 -7
  219. package/dist/node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.5_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js.map +0 -1
  220. package/dist/react/apollo-client/index.js.map +0 -1
  221. package/dist/react/apollo-client/links/index.js.map +0 -1
  222. package/dist/react/apollo-client-nextjs/index.js.map +0 -1
  223. package/dist/react/apollo-error/index.js.map +0 -1
  224. package/dist/react/i18next/index.js.map +0 -1
  225. package/dist/react/loading/index.js.map +0 -1
  226. package/dist/react/log/index.js.map +0 -1
  227. package/dist/react/next-intl/index.js.map +0 -1
  228. package/dist/react/storage/index.js.map +0 -1
  229. package/dist/react/toast/index.js.map +0 -1
  230. package/dist/react/userback/index.js.map +0 -1
  231. package/dist/typescript/index.js.map +0 -1
  232. package/dist/util/common/index.js.map +0 -1
  233. package/dist/util/index.js.map +0 -1
  234. package/dist/util/object/index.js.map +0 -1
  235. package/dist/util/serializer/index.js.map +0 -1
  236. package/dist/util/string/index.js.map +0 -1
  237. package/dist/util/validate/index.js.map +0 -1
@@ -1,15 +1,14 @@
1
- import { useTranslations as e } from "next-intl";
2
- import { use as n } from "react";
3
- import { NextIntlContext as r } from "./next-intl.context.js";
4
- function u() {
5
- const t = n(r);
6
- if (!t)
7
- throw new Error("useNextIntl must be used within a NextIntlProvider");
8
- return t;
1
+ import { NextIntlContext as e } from "./next-intl.context.js";
2
+ import { use as t } from "react";
3
+ import { useTranslations as n } from "next-intl";
4
+ //#region src/react/next-intl/next-intl.hook.tsx
5
+ function r() {
6
+ let n = t(e);
7
+ if (!n) throw Error("useNextIntl must be used within a NextIntlProvider");
8
+ return n;
9
9
  }
10
- const x = e;
11
- export {
12
- u as useNextIntl,
13
- x as useTranslateNextIntl
14
- };
15
- //# sourceMappingURL=next-intl.hook.js.map
10
+ var i = n;
11
+ //#endregion
12
+ export { r as useNextIntl, i as useTranslateNextIntl };
13
+
14
+ //# sourceMappingURL=next-intl.hook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.hook.js","sources":["../../../src/react/next-intl/next-intl.hook.tsx"],"sourcesContent":["import { useTranslations } from 'next-intl';\nimport { use } from 'react';\n\nimport type { I_NextIntlContext } from './next-intl.type.js';\n\nimport { NextIntlContext } from './next-intl.context.js';\n\n/**\n * React hook that provides access to Next.js internationalization context.\n * This hook retrieves the Next.js internationalization context which contains\n * language information and language switching functionality. It provides a\n * convenient way to access internationalization features within components.\n *\n * The hook will throw an error if used outside of a NextIntlProvider,\n * ensuring proper context usage and providing clear error messages for debugging.\n *\n * @returns The Next.js internationalization context containing language state and control methods.\n * @throws {Error} When used outside of a NextIntlProvider context.\n */\nexport function useNextIntl(): I_NextIntlContext {\n const context = use(NextIntlContext);\n\n if (!context) {\n throw new Error('useNextIntl must be used within a NextIntlProvider');\n }\n\n return context;\n}\n\n/**\n * React hook that provides Next.js translation functionality.\n * This hook is a wrapper around next-intl's useTranslations hook,\n * providing access to translation functions and current locale information.\n * It enables internationalization features including text translation,\n * locale switching, and pluralization support for Next.js applications.\n *\n * @returns The useTranslations hook result with translation functions and locale information.\n */\nexport const useTranslateNextIntl: typeof useTranslations = useTranslations;\n"],"names":["useTranslations","use","NextIntlContext","useNextIntl","context","useTranslateNextIntl"],"mappings":"AAmBO,SAAA,mBAAAA,SAAA;AAAA,SAAA,OAAAC,SAAA;AAAA,SAAA,mBAAAC,SAAA;AAAA,SAASC,IAAiC;AAC7C,QAAMC,IAAUH,EAAIC,CAAe;AAEnC,MAAI,CAACE;AACD,UAAM,IAAI,MAAM,oDAAoD;AAGxE,SAAOA;AACX;AAWO,MAAMC,IAA+CL;"}
1
+ {"version":3,"file":"next-intl.hook.js","names":[],"sources":["../../../src/react/next-intl/next-intl.hook.tsx"],"sourcesContent":["import { useTranslations } from 'next-intl';\nimport { use } from 'react';\n\nimport type { I_NextIntlContext } from './next-intl.type.js';\n\nimport { NextIntlContext } from './next-intl.context.js';\n\n/**\n * React hook that provides access to Next.js internationalization context.\n * This hook retrieves the Next.js internationalization context which contains\n * language information and language switching functionality. It provides a\n * convenient way to access internationalization features within components.\n *\n * The hook will throw an error if used outside of a NextIntlProvider,\n * ensuring proper context usage and providing clear error messages for debugging.\n *\n * @returns The Next.js internationalization context containing language state and control methods.\n * @throws {Error} When used outside of a NextIntlProvider context.\n */\nexport function useNextIntl(): I_NextIntlContext {\n const context = use(NextIntlContext);\n\n if (!context) {\n throw new Error('useNextIntl must be used within a NextIntlProvider');\n }\n\n return context;\n}\n\n/**\n * React hook that provides Next.js translation functionality.\n * This hook is a wrapper around next-intl's useTranslations hook,\n * providing access to translation functions and current locale information.\n * It enables internationalization features including text translation,\n * locale switching, and pluralization support for Next.js applications.\n *\n * @returns The useTranslations hook result with translation functions and locale information.\n */\nexport const useTranslateNextIntl: typeof useTranslations = useTranslations;\n"],"mappings":";;;;AAmBA,SAAgB,IAAiC;CAC7C,IAAM,IAAU,EAAI,EAAgB;AAEpC,KAAI,CAAC,EACD,OAAU,MAAM,qDAAqD;AAGzE,QAAO;;AAYX,IAAa,IAA+C"}
@@ -1,25 +1,30 @@
1
- import * as t from "react";
2
- import { useMemo as u } from "react";
3
- import { NEXT_INTL_DEFAULT_LANGUAGE as c } from "./next-intl.constant.js";
4
- import { NextIntlContext as p } from "./next-intl.context.js";
5
- import { withNextIntl as i } from "./next-intl.hoc.js";
6
- import { useStorage as l } from "../storage/storage.hook.js";
7
- function f({ children: r }) {
8
- return /* @__PURE__ */ t.createElement(t.Fragment, null, r);
1
+ import { useStorage as e } from "../storage/storage.hook.js";
2
+ import { NEXT_INTL_DEFAULT_LANGUAGE as t } from "./next-intl.constant.js";
3
+ import { NextIntlContext as n } from "./next-intl.context.js";
4
+ import { withNextIntl as r } from "./next-intl.hoc.js";
5
+ import * as i from "react";
6
+ import { useMemo as a } from "react";
7
+ //#region src/react/next-intl/next-intl.provider.tsx
8
+ function o({ children: e }) {
9
+ return /* @__PURE__ */ i.createElement(i.Fragment, null, e);
9
10
  }
10
- const L = i(f);
11
- function I({
12
- children: r,
13
- languages: e,
14
- messages: m
15
- }) {
16
- const { value: n, set: o } = l("lang", e[0]), a = u(
17
- () => ({ languages: e, currentLanguage: n ?? c, setCurrentLanguage: o }),
18
- [e, o, n]
19
- );
20
- return /* @__PURE__ */ t.createElement(p, { value: a }, /* @__PURE__ */ t.createElement(L, { languages: e, messages: m }, r));
11
+ var s = r(o);
12
+ function c({ children: r, languages: o, messages: c }) {
13
+ let { value: l, set: u } = e("lang", o[0]), d = a(() => ({
14
+ languages: o,
15
+ currentLanguage: l ?? t,
16
+ setCurrentLanguage: u
17
+ }), [
18
+ o,
19
+ u,
20
+ l
21
+ ]);
22
+ return /* @__PURE__ */ i.createElement(n, { value: d }, /* @__PURE__ */ i.createElement(s, {
23
+ languages: o,
24
+ messages: c
25
+ }, r));
21
26
  }
22
- export {
23
- I as NextIntlProvider
24
- };
25
- //# sourceMappingURL=next-intl.provider.js.map
27
+ //#endregion
28
+ export { c as NextIntlProvider };
29
+
30
+ //# sourceMappingURL=next-intl.provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.provider.js","sources":["../../../src/react/next-intl/next-intl.provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\n\nimport type { I_Children } from '#typescript/index.js';\n\nimport type { I_NextIntlLanguage, I_NextIntlProviderProps } from './next-intl.type.js';\n\nimport { useStorage } from '../storage/index.js';\nimport { NEXT_INTL_DEFAULT_LANGUAGE } from './next-intl.constant.js';\nimport { NextIntlContext } from './next-intl.context.js';\nimport { withNextIntl } from './next-intl.hoc.js';\n\n/**\n * Base component that serves as a wrapper for the withNextIntl HOC.\n * This component is used internally by the NextIntlProvider to create\n * the language wrapper component with internationalization capabilities.\n *\n * @param props - Component props containing children.\n * @param props.children - React children to be wrapped with internationalization support.\n * @returns A React component that passes through its children.\n */\nfunction LanguageWrapperBase({ children }: I_Children) {\n return <>{children}</>;\n}\n\nconst LanguageWrapper = withNextIntl(LanguageWrapperBase);\n\n/**\n * Provider component that manages Next.js internationalization state and provides i18n context.\n * This component sets up a complete internationalization system for Next.js applications,\n * including language management, message loading, and persistent language preferences.\n * It integrates with the storage system to remember user language choices and provides\n * a comprehensive i18n context to all child components.\n *\n * Features:\n * - Language state management with persistence\n * - Automatic language detection and fallback\n * - Message loading and caching\n * - Timezone configuration per language\n * - Integration with Next.js internationalization\n * - Memoized context value for performance optimization\n *\n * @param props - Component props containing children, languages, and messages.\n * @param props.children - React children that will have access to the internationalization context.\n * @param props.languages - Array of supported languages with their configurations.\n * @param props.messages - Object containing translation messages for each supported language.\n * @returns A React component that provides internationalization context to its children.\n */\nexport function NextIntlProvider({\n children,\n languages,\n messages,\n}: I_NextIntlProviderProps) {\n const { value, set } = useStorage<I_NextIntlLanguage>('lang', languages[0]);\n\n const contextValue = useMemo(\n () => ({ languages, currentLanguage: value ?? NEXT_INTL_DEFAULT_LANGUAGE, setCurrentLanguage: set }),\n [languages, set, value],\n );\n\n return (\n <NextIntlContext value={contextValue}>\n <LanguageWrapper languages={languages} messages={messages}>\n {children}\n </LanguageWrapper>\n </NextIntlContext>\n );\n}\n"],"names":["React","useMemo","NEXT_INTL_DEFAULT_LANGUAGE","NextIntlContext","withNextIntl","useStorage","LanguageWrapperBase","children","LanguageWrapper","NextIntlProvider","languages","messages","value","set","contextValue"],"mappings":"AAqBA,YAAAA,OAAA;AAAA,SAAA,WAAAC,SAAA;AAAA,SAAA,8BAAAC,SAAA;AAAA,SAAA,mBAAAC,SAAA;AAAA,SAAA,gBAAAC,SAAA;AAAA,SAAA,cAAAC,SAAA;AAAA,SAASC,EAAoB,EAAE,UAAAC,KAAwB;AACnD,2DAAUA,CAAS;AACvB;AAEA,MAAMC,IAAkBJ,EAAaE,CAAmB;AAuBjD,SAASG,EAAiB;AAAA,EAC7B,UAAAF;AAAA,EACA,WAAAG;AAAA,EACA,UAAAC;AACJ,GAA4B;AACxB,QAAM,EAAE,OAAAC,GAAO,KAAAC,EAAA,IAAQR,EAA+B,QAAQK,EAAU,CAAC,CAAC,GAEpEI,IAAeb;AAAA,IACjB,OAAO,EAAE,WAAAS,GAAW,iBAAiBE,KAASV,GAA4B,oBAAoBW;IAC9F,CAACH,GAAWG,GAAKD,CAAK;AAAA,EAAA;AAG1B,SACI,gBAAAZ,EAAA,cAACG,KAAgB,OAAOW,EAAA,mCACnBN,GAAA,EAAgB,WAAAE,GAAsB,UAAAC,EAAA,GAClCJ,CACL,CACJ;AAER;"}
1
+ {"version":3,"file":"next-intl.provider.js","names":[],"sources":["../../../src/react/next-intl/next-intl.provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMemo } from 'react';\n\nimport type { I_Children } from '#typescript/index.js';\n\nimport type { I_NextIntlLanguage, I_NextIntlProviderProps } from './next-intl.type.js';\n\nimport { useStorage } from '../storage/index.js';\nimport { NEXT_INTL_DEFAULT_LANGUAGE } from './next-intl.constant.js';\nimport { NextIntlContext } from './next-intl.context.js';\nimport { withNextIntl } from './next-intl.hoc.js';\n\n/**\n * Base component that serves as a wrapper for the withNextIntl HOC.\n * This component is used internally by the NextIntlProvider to create\n * the language wrapper component with internationalization capabilities.\n *\n * @param props - Component props containing children.\n * @param props.children - React children to be wrapped with internationalization support.\n * @returns A React component that passes through its children.\n */\nfunction LanguageWrapperBase({ children }: I_Children) {\n return <>{children}</>;\n}\n\nconst LanguageWrapper = withNextIntl(LanguageWrapperBase);\n\n/**\n * Provider component that manages Next.js internationalization state and provides i18n context.\n * This component sets up a complete internationalization system for Next.js applications,\n * including language management, message loading, and persistent language preferences.\n * It integrates with the storage system to remember user language choices and provides\n * a comprehensive i18n context to all child components.\n *\n * Features:\n * - Language state management with persistence\n * - Automatic language detection and fallback\n * - Message loading and caching\n * - Timezone configuration per language\n * - Integration with Next.js internationalization\n * - Memoized context value for performance optimization\n *\n * @param props - Component props containing children, languages, and messages.\n * @param props.children - React children that will have access to the internationalization context.\n * @param props.languages - Array of supported languages with their configurations.\n * @param props.messages - Object containing translation messages for each supported language.\n * @returns A React component that provides internationalization context to its children.\n */\nexport function NextIntlProvider({\n children,\n languages,\n messages,\n}: I_NextIntlProviderProps) {\n const { value, set } = useStorage<I_NextIntlLanguage>('lang', languages[0]);\n\n const contextValue = useMemo(\n () => ({ languages, currentLanguage: value ?? NEXT_INTL_DEFAULT_LANGUAGE, setCurrentLanguage: set }),\n [languages, set, value],\n );\n\n return (\n <NextIntlContext value={contextValue}>\n <LanguageWrapper languages={languages} messages={messages}>\n {children}\n </LanguageWrapper>\n </NextIntlContext>\n );\n}\n"],"mappings":";;;;;;;AAqBA,SAAS,EAAoB,EAAE,eAAwB;AACnD,QAAO,kBAAA,cAAA,EAAA,UAAA,MAAG,EAAY;;AAG1B,IAAM,IAAkB,EAAa,EAAoB;AAuBzD,SAAgB,EAAiB,EAC7B,aACA,cACA,eACwB;CACxB,IAAM,EAAE,UAAO,WAAQ,EAA+B,QAAQ,EAAU,GAAG,EAErE,IAAe,SACV;EAAE;EAAW,iBAAiB,KAAS;EAA4B,oBAAoB;EAAK,GACnG;EAAC;EAAW;EAAK;EAAM,CAC1B;AAED,QACI,kBAAA,cAAC,GAAD,EAAiB,OAAO,GAIN,EAHd,kBAAA,cAAC,GAAD;EAA4B;EAAqB;EAE/B,EADb,EACa,CACJ"}
@@ -1,7 +1,3 @@
1
- import { useStorage as e } from "./storage.hook.js";
2
- import { storage as a } from "./storage.util.js";
3
- export {
4
- a as storage,
5
- e as useStorage
6
- };
7
- //# sourceMappingURL=index.js.map
1
+ import { storage as e } from "./storage.util.js";
2
+ import { useStorage as t } from "./storage.hook.js";
3
+ export { e as storage, t as useStorage };
@@ -1,60 +1,63 @@
1
- import { useState as m, useEffect as v, useCallback as p } from "react";
1
+ import { serializer as e } from "../../util/serializer/serializer.util.js";
2
+ import { catchError as t } from "../log/log.util.js";
2
3
  import { storage as n } from "./storage.util.js";
3
- import { serializer as w } from "../../util/serializer/serializer.util.js";
4
- import { catchError as d } from "../log/log.util.js";
5
- function S(e, o, a = w) {
6
- const [c, r] = m(o), [i, l] = m(!1);
7
- v(() => {
8
- let t = !0;
9
- return (async () => {
10
- try {
11
- const f = await n.get(e);
12
- if (t)
13
- if (f !== null) {
14
- const u = a.deserialize(f);
15
- r(u);
16
- } else if (o !== void 0) {
17
- const u = a.serialize(o);
18
- await n.set(e, u), r(o);
19
- } else
20
- r(void 0);
21
- } catch (f) {
22
- d(f), t && r(o);
23
- } finally {
24
- t && l(!0);
25
- }
26
- })(), () => {
27
- t = !1, l(!1);
28
- };
29
- }, [e, o, a]), v(() => {
30
- if (!i)
31
- return;
32
- (async () => {
33
- try {
34
- if (c !== void 0) {
35
- const s = a.serialize(c);
36
- await n.set(e, s);
37
- }
38
- } catch (s) {
39
- d(s);
40
- }
41
- })();
42
- }, [c, e, a, i]);
43
- const h = p(
44
- (t) => {
45
- r((s) => typeof t == "function" ? t(s) : t);
46
- },
47
- []
48
- ), g = p(async () => {
49
- try {
50
- await n.remove(e), r(void 0);
51
- } catch (t) {
52
- d(t);
53
- }
54
- }, [e]);
55
- return { value: c, set: h, remove: g };
4
+ import { useCallback as r, useEffect as i, useState as a } from "react";
5
+ //#region src/react/storage/storage.hook.tsx
6
+ function o(o, s, c = e) {
7
+ let [l, u] = a(s), [d, f] = a(!1);
8
+ return i(() => {
9
+ let e = !0;
10
+ return (async () => {
11
+ try {
12
+ let t = await n.get(o);
13
+ if (e) if (t !== null) u(c.deserialize(t));
14
+ else if (s !== void 0) {
15
+ let e = c.serialize(s);
16
+ await n.set(o, e), u(s);
17
+ } else u(void 0);
18
+ } catch (n) {
19
+ t(n), e && u(s);
20
+ } finally {
21
+ e && f(!0);
22
+ }
23
+ })(), () => {
24
+ e = !1, f(!1);
25
+ };
26
+ }, [
27
+ o,
28
+ s,
29
+ c
30
+ ]), i(() => {
31
+ d && (async () => {
32
+ try {
33
+ if (l !== void 0) {
34
+ let e = c.serialize(l);
35
+ await n.set(o, e);
36
+ }
37
+ } catch (e) {
38
+ t(e);
39
+ }
40
+ })();
41
+ }, [
42
+ l,
43
+ o,
44
+ c,
45
+ d
46
+ ]), {
47
+ value: l,
48
+ set: r((e) => {
49
+ u((t) => typeof e == "function" ? e(t) : e);
50
+ }, []),
51
+ remove: r(async () => {
52
+ try {
53
+ await n.remove(o), u(void 0);
54
+ } catch (e) {
55
+ t(e);
56
+ }
57
+ }, [o])
58
+ };
56
59
  }
57
- export {
58
- S as useStorage
59
- };
60
- //# sourceMappingURL=storage.hook.js.map
60
+ //#endregion
61
+ export { o as useStorage };
62
+
63
+ //# sourceMappingURL=storage.hook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.hook.js","sources":["../../../src/react/storage/storage.hook.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { I_Serializer } from '#util/serializer/index.js';\n\nimport { serializer as defaultSerializer } from '#util/serializer/index.js';\n\nimport { catchError } from '../log/index.js';\nimport { storage } from './storage.util.js';\n\n/**\n * React hook that provides persistent storage functionality with automatic serialization.\n * This hook manages state that persists across browser sessions using localForage,\n * with automatic serialization/deserialization of complex data types. It provides\n * a React-friendly interface for storage operations with proper error handling.\n *\n * Features:\n * - Automatic data serialization and deserialization\n * - Persistent storage across browser sessions\n * - Initial value handling and fallback\n * - Error handling with graceful degradation\n * - Automatic storage synchronization\n * - Support for complex data types via custom serializers\n *\n * @param key - The unique storage key for the data.\n * @param initialValue - Optional initial value to use if no stored value exists.\n * @param serializer - Optional custom serializer for complex data types (defaults to JSON serializer).\n * @returns An object containing the current value, set function, and remove function.\n */\nexport function useStorage<T>(\n key: string,\n initialValue?: T,\n serializer: I_Serializer<T> = defaultSerializer as I_Serializer<T>,\n) {\n const [value, setValue] = useState<T | undefined>(initialValue);\n const [isLoaded, setIsLoaded] = useState(false);\n\n useEffect(() => {\n let isMounted = true;\n\n const loadValue = async () => {\n try {\n const valueFound = await storage.get<string>(key);\n\n if (isMounted) {\n if (valueFound !== null) {\n const parsedValue = serializer.deserialize(valueFound);\n setValue(parsedValue);\n }\n else if (initialValue !== undefined) {\n const serialized = serializer.serialize(initialValue);\n await storage.set(key, serialized);\n setValue(initialValue);\n }\n else {\n setValue(undefined);\n }\n }\n }\n catch (error) {\n catchError(error);\n\n if (isMounted) {\n setValue(initialValue);\n }\n }\n finally {\n if (isMounted)\n setIsLoaded(true);\n }\n };\n\n loadValue();\n\n return () => {\n isMounted = false;\n setIsLoaded(false);\n };\n }, [key, initialValue, serializer]);\n\n useEffect(() => {\n if (!isLoaded)\n return;\n\n const saveValue = async () => {\n try {\n if (value !== undefined) {\n const serialized = serializer.serialize(value);\n await storage.set(key, serialized);\n }\n }\n catch (error) {\n catchError(error);\n }\n };\n\n saveValue();\n }, [value, key, serializer, isLoaded]);\n\n const set = useCallback(\n (newValue: T | ((val: T | undefined) => T)) => {\n setValue((prev) => {\n if (typeof newValue === 'function') {\n return (newValue as (val: T | undefined) => T)(prev);\n }\n return newValue;\n });\n },\n [],\n );\n\n const remove = useCallback(async () => {\n try {\n await storage.remove(key);\n setValue(undefined);\n }\n catch (error) {\n catchError(error);\n }\n }, [key]);\n\n return { value, set, remove };\n}\n"],"names":["useStorage","key","initialValue","serializer","defaultSerializer","value","setValue","useState","isLoaded","setIsLoaded","useEffect","isMounted","valueFound","storage","parsedValue","serialized","error","catchError","set","useCallback","newValue","prev","remove"],"mappings":";;;;AA4BO,SAASA,EACZC,GACAC,GACAC,IAA8BC,GAChC;AACE,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAwBL,CAAY,GACxD,CAACM,GAAUC,CAAW,IAAIF,EAAS,EAAK;AAE9C,EAAAG,EAAU,MAAM;AACZ,QAAIC,IAAY;AAkChB,YAhCkB,YAAY;AAC1B,UAAI;AACA,cAAMC,IAAa,MAAMC,EAAQ,IAAYZ,CAAG;AAEhD,YAAIU;AACA,cAAIC,MAAe,MAAM;AACrB,kBAAME,IAAcX,EAAW,YAAYS,CAAU;AACrD,YAAAN,EAASQ,CAAW;AAAA,UACxB,WACSZ,MAAiB,QAAW;AACjC,kBAAMa,IAAaZ,EAAW,UAAUD,CAAY;AACpD,kBAAMW,EAAQ,IAAIZ,GAAKc,CAAU,GACjCT,EAASJ,CAAY;AAAA,UACzB;AAEI,YAAAI,EAAS,MAAS;AAAA,MAG9B,SACOU,GAAO;AACV,QAAAC,EAAWD,CAAK,GAEZL,KACAL,EAASJ,CAAY;AAAA,MAE7B,UAAA;AAEI,QAAIS,KACAF,EAAY,EAAI;AAAA,MACxB;AAAA,IACJ,GAEA,GAEO,MAAM;AACT,MAAAE,IAAY,IACZF,EAAY,EAAK;AAAA,IACrB;AAAA,EACJ,GAAG,CAACR,GAAKC,GAAcC,CAAU,CAAC,GAElCO,EAAU,MAAM;AACZ,QAAI,CAACF;AACD;AAcJ,KAZkB,YAAY;AAC1B,UAAI;AACA,YAAIH,MAAU,QAAW;AACrB,gBAAMU,IAAaZ,EAAW,UAAUE,CAAK;AAC7C,gBAAMQ,EAAQ,IAAIZ,GAAKc,CAAU;AAAA,QACrC;AAAA,MACJ,SACOC,GAAO;AACV,QAAAC,EAAWD,CAAK;AAAA,MACpB;AAAA,IACJ,GAEA;AAAA,EACJ,GAAG,CAACX,GAAOJ,GAAKE,GAAYK,CAAQ,CAAC;AAErC,QAAMU,IAAMC;AAAA,IACR,CAACC,MAA8C;AAC3C,MAAAd,EAAS,CAACe,MACF,OAAOD,KAAa,aACZA,EAAuCC,CAAI,IAEhDD,CACV;AAAA,IACL;AAAA,IACA,CAAA;AAAA,EAAC,GAGCE,IAASH,EAAY,YAAY;AACnC,QAAI;AACA,YAAMN,EAAQ,OAAOZ,CAAG,GACxBK,EAAS,MAAS;AAAA,IACtB,SACOU,GAAO;AACV,MAAAC,EAAWD,CAAK;AAAA,IACpB;AAAA,EACJ,GAAG,CAACf,CAAG,CAAC;AAER,SAAO,EAAE,OAAAI,GAAO,KAAAa,GAAK,QAAAI,EAAA;AACzB;"}
1
+ {"version":3,"file":"storage.hook.js","names":[],"sources":["../../../src/react/storage/storage.hook.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { I_Serializer } from '#util/serializer/index.js';\n\nimport { serializer as defaultSerializer } from '#util/serializer/index.js';\n\nimport { catchError } from '../log/index.js';\nimport { storage } from './storage.util.js';\n\n/**\n * React hook that provides persistent storage functionality with automatic serialization.\n * This hook manages state that persists across browser sessions using localForage,\n * with automatic serialization/deserialization of complex data types. It provides\n * a React-friendly interface for storage operations with proper error handling.\n *\n * Features:\n * - Automatic data serialization and deserialization\n * - Persistent storage across browser sessions\n * - Initial value handling and fallback\n * - Error handling with graceful degradation\n * - Automatic storage synchronization\n * - Support for complex data types via custom serializers\n *\n * @param key - The unique storage key for the data.\n * @param initialValue - Optional initial value to use if no stored value exists.\n * @param serializer - Optional custom serializer for complex data types (defaults to JSON serializer).\n * @returns An object containing the current value, set function, and remove function.\n */\nexport function useStorage<T>(\n key: string,\n initialValue?: T,\n serializer: I_Serializer<T> = defaultSerializer as I_Serializer<T>,\n) {\n const [value, setValue] = useState<T | undefined>(initialValue);\n const [isLoaded, setIsLoaded] = useState(false);\n\n useEffect(() => {\n let isMounted = true;\n\n const loadValue = async () => {\n try {\n const valueFound = await storage.get<string>(key);\n\n if (isMounted) {\n if (valueFound !== null) {\n const parsedValue = serializer.deserialize(valueFound);\n setValue(parsedValue);\n }\n else if (initialValue !== undefined) {\n const serialized = serializer.serialize(initialValue);\n await storage.set(key, serialized);\n setValue(initialValue);\n }\n else {\n setValue(undefined);\n }\n }\n }\n catch (error) {\n catchError(error);\n\n if (isMounted) {\n setValue(initialValue);\n }\n }\n finally {\n if (isMounted)\n setIsLoaded(true);\n }\n };\n\n loadValue();\n\n return () => {\n isMounted = false;\n setIsLoaded(false);\n };\n }, [key, initialValue, serializer]);\n\n useEffect(() => {\n if (!isLoaded)\n return;\n\n const saveValue = async () => {\n try {\n if (value !== undefined) {\n const serialized = serializer.serialize(value);\n await storage.set(key, serialized);\n }\n }\n catch (error) {\n catchError(error);\n }\n };\n\n saveValue();\n }, [value, key, serializer, isLoaded]);\n\n const set = useCallback(\n (newValue: T | ((val: T | undefined) => T)) => {\n setValue((prev) => {\n if (typeof newValue === 'function') {\n return (newValue as (val: T | undefined) => T)(prev);\n }\n return newValue;\n });\n },\n [],\n );\n\n const remove = useCallback(async () => {\n try {\n await storage.remove(key);\n setValue(undefined);\n }\n catch (error) {\n catchError(error);\n }\n }, [key]);\n\n return { value, set, remove };\n}\n"],"mappings":";;;;;AA4BA,SAAgB,EACZ,GACA,GACA,IAA8B,GAChC;CACE,IAAM,CAAC,GAAO,KAAY,EAAwB,EAAa,EACzD,CAAC,GAAU,KAAe,EAAS,GAAM;AAsF/C,QApFA,QAAgB;EACZ,IAAI,IAAY;AAoChB,UAlCkB,YAAY;AAC1B,OAAI;IACA,IAAM,IAAa,MAAM,EAAQ,IAAY,EAAI;AAEjD,QAAI,EACA,KAAI,MAAe,KAEf,GADoB,EAAW,YAAY,EAAW,CACjC;aAEhB,MAAiB,KAAA,GAAW;KACjC,IAAM,IAAa,EAAW,UAAU,EAAa;AAErD,KADA,MAAM,EAAQ,IAAI,GAAK,EAAW,EAClC,EAAS,EAAa;UAGtB,GAAS,KAAA,EAAU;YAIxB,GAAO;AAGV,IAFA,EAAW,EAAM,EAEb,KACA,EAAS,EAAa;aAGtB;AACJ,IAAI,KACA,EAAY,GAAK;;MAIlB,QAEE;AAET,GADA,IAAY,IACZ,EAAY,GAAM;;IAEvB;EAAC;EAAK;EAAc;EAAW,CAAC,EAEnC,QAAgB;AACP,QAGa,YAAY;AAC1B,OAAI;AACA,QAAI,MAAU,KAAA,GAAW;KACrB,IAAM,IAAa,EAAW,UAAU,EAAM;AAC9C,WAAM,EAAQ,IAAI,GAAK,EAAW;;YAGnC,GAAO;AACV,MAAW,EAAM;;MAId;IACZ;EAAC;EAAO;EAAK;EAAY;EAAS,CAAC,EAwB/B;EAAE;EAAO,KAtBJ,GACP,MAA8C;AAC3C,MAAU,MACF,OAAO,KAAa,aACZ,EAAuC,EAAK,GAEjD,EACT;KAEN,EAAE,CACL;EAYoB,QAVN,EAAY,YAAY;AACnC,OAAI;AAEA,IADA,MAAM,EAAQ,OAAO,EAAI,EACzB,EAAS,KAAA,EAAU;YAEhB,GAAO;AACV,MAAW,EAAM;;KAEtB,CAAC,EAAI,CAAC;EAEoB"}
@@ -1,69 +1,37 @@
1
- import e from "localforage";
2
- import { catchError as a } from "../log/log.util.js";
3
- const s = {
4
- /**
5
- * Retrieves a value from browser storage by key.
6
- * This method fetches data that was previously stored using the set method.
7
- * Returns null if the key doesn't exist or if an error occurs during retrieval.
8
- *
9
- * @param key - The unique identifier for the stored value.
10
- * @returns A promise that resolves to the stored value or null if not found.
11
- */
12
- async get(r) {
13
- try {
14
- return await e.getItem(r);
15
- } catch (t) {
16
- return a(t, { returnValue: null });
17
- }
18
- },
19
- /**
20
- * Stores a value in browser storage with a unique key.
21
- * This method saves data that can be retrieved later using the get method.
22
- * The data is automatically handled by localForage which chooses the optimal
23
- * storage method for the browser environment.
24
- *
25
- * @param key - The unique identifier for the value to store.
26
- * @param value - The data to store (will be automatically handled by localForage).
27
- * @returns A promise that resolves when the storage operation is complete.
28
- */
29
- async set(r, t) {
30
- try {
31
- await e.setItem(r, t);
32
- } catch (c) {
33
- a(c);
34
- }
35
- },
36
- /**
37
- * Removes a value from browser storage by key.
38
- * This method permanently deletes the stored data associated with the specified key.
39
- * If the key doesn't exist, the operation completes successfully without error.
40
- *
41
- * @param key - The unique identifier of the value to remove.
42
- * @returns A promise that resolves when the removal operation is complete.
43
- */
44
- async remove(r) {
45
- try {
46
- await e.removeItem(r);
47
- } catch (t) {
48
- a(t);
49
- }
50
- },
51
- /**
52
- * Retrieves all storage keys.
53
- * This method returns an array of all keys that currently have stored values.
54
- * Returns an empty array if no keys exist or if an error occurs during retrieval.
55
- *
56
- * @returns A promise that resolves to an array of storage keys.
57
- */
58
- async keys() {
59
- try {
60
- return await e.keys() ?? [];
61
- } catch (r) {
62
- return a(r, { returnValue: [] });
63
- }
64
- }
1
+ import { catchError as e } from "../log/log.util.js";
2
+ import t from "localforage";
3
+ //#region src/react/storage/storage.util.ts
4
+ var n = {
5
+ async get(n) {
6
+ try {
7
+ return await t.getItem(n);
8
+ } catch (t) {
9
+ return e(t, { returnValue: null });
10
+ }
11
+ },
12
+ async set(n, r) {
13
+ try {
14
+ await t.setItem(n, r);
15
+ } catch (t) {
16
+ e(t);
17
+ }
18
+ },
19
+ async remove(n) {
20
+ try {
21
+ await t.removeItem(n);
22
+ } catch (t) {
23
+ e(t);
24
+ }
25
+ },
26
+ async keys() {
27
+ try {
28
+ return await t.keys() ?? [];
29
+ } catch (t) {
30
+ return e(t, { returnValue: [] });
31
+ }
32
+ }
65
33
  };
66
- export {
67
- s as storage
68
- };
69
- //# sourceMappingURL=storage.util.js.map
34
+ //#endregion
35
+ export { n as storage };
36
+
37
+ //# sourceMappingURL=storage.util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.util.js","sources":["../../../src/react/storage/storage.util.ts"],"sourcesContent":["import localForage from 'localforage';\n\nimport { catchError } from '../log/index.js';\n\n/**\n * Browser storage utility object using localForage for cross-browser compatibility.\n * This object provides a unified interface for browser storage operations using localForage,\n * which automatically chooses the best available storage method (IndexedDB, WebSQL, or localStorage)\n * based on browser capabilities. It includes comprehensive error handling and type safety.\n */\nexport const storage = {\n /**\n * Retrieves a value from browser storage by key.\n * This method fetches data that was previously stored using the set method.\n * Returns null if the key doesn't exist or if an error occurs during retrieval.\n *\n * @param key - The unique identifier for the stored value.\n * @returns A promise that resolves to the stored value or null if not found.\n */\n async get<T = unknown>(key: string): Promise<T | null> {\n try {\n return await localForage.getItem<T>(key);\n }\n catch (error) {\n return catchError(error, { returnValue: null });\n }\n },\n /**\n * Stores a value in browser storage with a unique key.\n * This method saves data that can be retrieved later using the get method.\n * The data is automatically handled by localForage which chooses the optimal\n * storage method for the browser environment.\n *\n * @param key - The unique identifier for the value to store.\n * @param value - The data to store (will be automatically handled by localForage).\n * @returns A promise that resolves when the storage operation is complete.\n */\n async set<T = unknown>(key: string, value: T): Promise<void> {\n try {\n await localForage.setItem(key, value);\n }\n catch (error) {\n catchError(error);\n }\n },\n /**\n * Removes a value from browser storage by key.\n * This method permanently deletes the stored data associated with the specified key.\n * If the key doesn't exist, the operation completes successfully without error.\n *\n * @param key - The unique identifier of the value to remove.\n * @returns A promise that resolves when the removal operation is complete.\n */\n async remove(key: string): Promise<void> {\n try {\n await localForage.removeItem(key);\n }\n catch (error) {\n catchError(error);\n }\n },\n /**\n * Retrieves all storage keys.\n * This method returns an array of all keys that currently have stored values.\n * Returns an empty array if no keys exist or if an error occurs during retrieval.\n *\n * @returns A promise that resolves to an array of storage keys.\n */\n async keys(): Promise<string[]> {\n try {\n const keys = await localForage.keys();\n\n return keys ?? [];\n }\n catch (error) {\n return catchError(error, { returnValue: [] });\n }\n },\n};\n"],"names":["localForage","catchError","storage","key","error","value"],"mappings":"AAUO,OAAAA,OAAA;AAAA,SAAA,cAAAC,SAAA;AAAA,MAAMC,IAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnB,MAAM,IAAiBC,GAAgC;AACnD,QAAI;AACA,aAAO,MAAMH,EAAY,QAAWG,CAAG;AAAA,IAC3C,SACOC,GAAO;AACV,aAAOH,EAAWG,GAAO,EAAE,aAAa,MAAM;AAAA,IAClD;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,IAAiBD,GAAaE,GAAyB;AACzD,QAAI;AACA,YAAML,EAAY,QAAQG,GAAKE,CAAK;AAAA,IACxC,SACOD,GAAO;AACV,MAAAH,EAAWG,CAAK;AAAA,IACpB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,OAAOD,GAA4B;AACrC,QAAI;AACA,YAAMH,EAAY,WAAWG,CAAG;AAAA,IACpC,SACOC,GAAO;AACV,MAAAH,EAAWG,CAAK;AAAA,IACpB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAA0B;AAC5B,QAAI;AAGA,aAFa,MAAMJ,EAAY,KAAA,KAEhB,CAAA;AAAA,IACnB,SACOI,GAAO;AACV,aAAOH,EAAWG,GAAO,EAAE,aAAa,CAAA,GAAI;AAAA,IAChD;AAAA,EACJ;AACJ;"}
1
+ {"version":3,"file":"storage.util.js","names":[],"sources":["../../../src/react/storage/storage.util.ts"],"sourcesContent":["import localForage from 'localforage';\n\nimport { catchError } from '../log/index.js';\n\n/**\n * Browser storage utility object using localForage for cross-browser compatibility.\n * This object provides a unified interface for browser storage operations using localForage,\n * which automatically chooses the best available storage method (IndexedDB, WebSQL, or localStorage)\n * based on browser capabilities. It includes comprehensive error handling and type safety.\n */\nexport const storage = {\n /**\n * Retrieves a value from browser storage by key.\n * This method fetches data that was previously stored using the set method.\n * Returns null if the key doesn't exist or if an error occurs during retrieval.\n *\n * @param key - The unique identifier for the stored value.\n * @returns A promise that resolves to the stored value or null if not found.\n */\n async get<T = unknown>(key: string): Promise<T | null> {\n try {\n return await localForage.getItem<T>(key);\n }\n catch (error) {\n return catchError(error, { returnValue: null });\n }\n },\n /**\n * Stores a value in browser storage with a unique key.\n * This method saves data that can be retrieved later using the get method.\n * The data is automatically handled by localForage which chooses the optimal\n * storage method for the browser environment.\n *\n * @param key - The unique identifier for the value to store.\n * @param value - The data to store (will be automatically handled by localForage).\n * @returns A promise that resolves when the storage operation is complete.\n */\n async set<T = unknown>(key: string, value: T): Promise<void> {\n try {\n await localForage.setItem(key, value);\n }\n catch (error) {\n catchError(error);\n }\n },\n /**\n * Removes a value from browser storage by key.\n * This method permanently deletes the stored data associated with the specified key.\n * If the key doesn't exist, the operation completes successfully without error.\n *\n * @param key - The unique identifier of the value to remove.\n * @returns A promise that resolves when the removal operation is complete.\n */\n async remove(key: string): Promise<void> {\n try {\n await localForage.removeItem(key);\n }\n catch (error) {\n catchError(error);\n }\n },\n /**\n * Retrieves all storage keys.\n * This method returns an array of all keys that currently have stored values.\n * Returns an empty array if no keys exist or if an error occurs during retrieval.\n *\n * @returns A promise that resolves to an array of storage keys.\n */\n async keys(): Promise<string[]> {\n try {\n const keys = await localForage.keys();\n\n return keys ?? [];\n }\n catch (error) {\n return catchError(error, { returnValue: [] });\n }\n },\n};\n"],"mappings":";;;AAUA,IAAa,IAAU;CASnB,MAAM,IAAiB,GAAgC;AACnD,MAAI;AACA,UAAO,MAAM,EAAY,QAAW,EAAI;WAErC,GAAO;AACV,UAAO,EAAW,GAAO,EAAE,aAAa,MAAM,CAAC;;;CAavD,MAAM,IAAiB,GAAa,GAAyB;AACzD,MAAI;AACA,SAAM,EAAY,QAAQ,GAAK,EAAM;WAElC,GAAO;AACV,KAAW,EAAM;;;CAWzB,MAAM,OAAO,GAA4B;AACrC,MAAI;AACA,SAAM,EAAY,WAAW,EAAI;WAE9B,GAAO;AACV,KAAW,EAAM;;;CAUzB,MAAM,OAA0B;AAC5B,MAAI;AAGA,UAFa,MAAM,EAAY,MAAM,IAEtB,EAAE;WAEd,GAAO;AACV,UAAO,EAAW,GAAO,EAAE,aAAa,EAAE,EAAE,CAAC;;;CAGxD"}
@@ -1,6 +1,2 @@
1
- import { Toaster as r, toast as a } from "react-hot-toast";
2
- export {
3
- r as Toaster,
4
- a as toast
5
- };
6
- //# sourceMappingURL=index.js.map
1
+ import { Toaster as e, toast as t } from "react-hot-toast";
2
+ export { e as Toaster, t as toast };
@@ -1,5 +1,2 @@
1
- import { Userback as o } from "./userback.component.js";
2
- export {
3
- o as Userback
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ import { Userback as e } from "./userback.component.js";
2
+ export { e as Userback };
@@ -1,28 +1,28 @@
1
- import a from "@userback/widget";
2
- import { useEffect as l } from "react";
3
- function d({ token: r, options: n }) {
4
- return l(() => {
5
- if (!r)
6
- return;
7
- let t;
8
- return (async () => {
9
- const { hide: e, ...u } = n || {};
10
- await a(r, u), e && e.length > 0 && e.forEach((o) => {
11
- document.querySelectorAll(o).forEach((c) => c.remove());
12
- }), t = new MutationObserver(() => {
13
- e && e.length > 0 && e.forEach((o) => {
14
- document.querySelectorAll(o).forEach((c) => c.remove());
15
- });
16
- }), t.observe(document.body, {
17
- childList: !0,
18
- subtree: !0
19
- });
20
- })(), () => {
21
- t?.disconnect();
22
- };
23
- }, [r, n]), null;
1
+ import e from "@userback/widget";
2
+ import { useEffect as t } from "react";
3
+ //#region src/react/userback/userback.component.tsx
4
+ function n({ token: n, options: r }) {
5
+ return t(() => {
6
+ if (!n) return;
7
+ let t;
8
+ return (async () => {
9
+ let { hide: i, ...a } = r || {};
10
+ await e(n, a), i && i.length > 0 && i.forEach((e) => {
11
+ document.querySelectorAll(e).forEach((e) => e.remove());
12
+ }), t = new MutationObserver(() => {
13
+ i && i.length > 0 && i.forEach((e) => {
14
+ document.querySelectorAll(e).forEach((e) => e.remove());
15
+ });
16
+ }), t.observe(document.body, {
17
+ childList: !0,
18
+ subtree: !0
19
+ });
20
+ })(), () => {
21
+ t?.disconnect();
22
+ };
23
+ }, [n]), null;
24
24
  }
25
- export {
26
- d as Userback
27
- };
28
- //# sourceMappingURL=userback.component.js.map
25
+ //#endregion
26
+ export { n as Userback };
27
+
28
+ //# sourceMappingURL=userback.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"userback.component.js","sources":["../../../src/react/userback/userback.component.tsx"],"sourcesContent":["import UserbackWidget from '@userback/widget';\nimport { useEffect } from 'react';\n\nimport type { I_UserBackProps } from './userback.type.js';\n\n/**\n * Userback feedback widget component for collecting user feedback.\n * This component integrates the Userback feedback widget into React applications,\n * providing a customizable feedback collection interface for users to submit\n * bug reports, feature requests, and general feedback.\n *\n * Features:\n * - Userback widget integration\n * - Customizable feedback collection\n * - Automatic widget initialization\n * - Token-based configuration\n * - Responsive design support\n *\n * @param props - Component props containing token and options.\n * @param props.token - The Userback token for widget authentication.\n * @param props.options - Optional configuration options for the Userback widget.\n * @returns A React component that renders the Userback feedback widget.\n */\nexport function Userback({ token, options }: I_UserBackProps) {\n useEffect(() => {\n if (!token) {\n return;\n }\n\n let observer: MutationObserver;\n\n const loadUserback = async () => {\n const { hide, ...rest } = options || {};\n\n await UserbackWidget(token, rest);\n\n if (hide && hide.length > 0) {\n hide.forEach((selector: string) => {\n document.querySelectorAll(selector).forEach(el => el.remove());\n });\n }\n\n observer = new MutationObserver(() => {\n if (hide && hide.length > 0) {\n hide.forEach((selector: string) => {\n document.querySelectorAll(selector).forEach(el => el.remove());\n });\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n };\n\n loadUserback();\n\n return () => {\n observer?.disconnect();\n };\n }, [token, options]);\n\n return null;\n}\n"],"names":["UserbackWidget","useEffect","Userback","token","options","observer","hide","rest","selector","el"],"mappings":"AAuBO,OAAAA,OAAA;AAAA,SAAA,aAAAC,SAAA;AAAA,SAASC,EAAS,EAAE,OAAAC,GAAO,SAAAC,KAA4B;AAC1D,SAAAH,EAAU,MAAM;AACZ,QAAI,CAACE;AACD;AAGJ,QAAIE;AA2BJ,YAzBqB,YAAY;AAC7B,YAAM,EAAE,MAAAC,GAAM,GAAGC,EAAA,IAASH,KAAW,CAAA;AAErC,YAAMJ,EAAeG,GAAOI,CAAI,GAE5BD,KAAQA,EAAK,SAAS,KACtBA,EAAK,QAAQ,CAACE,MAAqB;AAC/B,iBAAS,iBAAiBA,CAAQ,EAAE,QAAQ,CAAAC,MAAMA,EAAG,QAAQ;AAAA,MACjE,CAAC,GAGLJ,IAAW,IAAI,iBAAiB,MAAM;AAClC,QAAIC,KAAQA,EAAK,SAAS,KACtBA,EAAK,QAAQ,CAACE,MAAqB;AAC/B,mBAAS,iBAAiBA,CAAQ,EAAE,QAAQ,CAAAC,MAAMA,EAAG,QAAQ;AAAA,QACjE,CAAC;AAAA,MAET,CAAC,GAEDJ,EAAS,QAAQ,SAAS,MAAM;AAAA,QAC5B,WAAW;AAAA,QACX,SAAS;AAAA,MAAA,CACZ;AAAA,IACL,GAEA,GAEO,MAAM;AACT,MAAAA,GAAU,WAAA;AAAA,IACd;AAAA,EACJ,GAAG,CAACF,GAAOC,CAAO,CAAC,GAEZ;AACX;"}
1
+ {"version":3,"file":"userback.component.js","names":[],"sources":["../../../src/react/userback/userback.component.tsx"],"sourcesContent":["import UserbackWidget from '@userback/widget';\nimport { useEffect } from 'react';\n\nimport type { I_UserBackProps } from './userback.type.js';\n\n/**\n * Userback feedback widget component for collecting user feedback.\n * This component integrates the Userback feedback widget into React applications,\n * providing a customizable feedback collection interface for users to submit\n * bug reports, feature requests, and general feedback.\n *\n * Features:\n * - Userback widget integration\n * - Customizable feedback collection\n * - Automatic widget initialization\n * - Token-based configuration\n * - Responsive design support\n *\n * @param props - Component props containing token and options.\n * @param props.token - The Userback token for widget authentication.\n * @param props.options - Optional configuration options for the Userback widget.\n * @returns A React component that renders the Userback feedback widget.\n */\nexport function Userback({ token, options }: I_UserBackProps) {\n useEffect(() => {\n if (!token) {\n return;\n }\n\n let observer: MutationObserver;\n\n const loadUserback = async () => {\n const { hide, ...rest } = options || {};\n\n await UserbackWidget(token, rest);\n\n if (hide && hide.length > 0) {\n hide.forEach((selector: string) => {\n document.querySelectorAll(selector).forEach(el => el.remove());\n });\n }\n\n observer = new MutationObserver(() => {\n if (hide && hide.length > 0) {\n hide.forEach((selector: string) => {\n document.querySelectorAll(selector).forEach(el => el.remove());\n });\n }\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n };\n\n loadUserback();\n\n return () => {\n observer?.disconnect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- options is intentionally excluded to prevent infinite re-renders (object ref changes each render)\n }, [token]);\n\n return null;\n}\n"],"mappings":";;;AAuBA,SAAgB,EAAS,EAAE,UAAO,cAA4B;AAyC1D,QAxCA,QAAgB;AACZ,MAAI,CAAC,EACD;EAGJ,IAAI;AA6BJ,UA3BqB,YAAY;GAC7B,IAAM,EAAE,SAAM,GAAG,MAAS,KAAW,EAAE;AAkBvC,GAhBA,MAAM,EAAe,GAAO,EAAK,EAE7B,KAAQ,EAAK,SAAS,KACtB,EAAK,SAAS,MAAqB;AAC/B,aAAS,iBAAiB,EAAS,CAAC,SAAQ,MAAM,EAAG,QAAQ,CAAC;KAChE,EAGN,IAAW,IAAI,uBAAuB;AAClC,IAAI,KAAQ,EAAK,SAAS,KACtB,EAAK,SAAS,MAAqB;AAC/B,cAAS,iBAAiB,EAAS,CAAC,SAAQ,MAAM,EAAG,QAAQ,CAAC;MAChE;KAER,EAEF,EAAS,QAAQ,SAAS,MAAM;IAC5B,WAAW;IACX,SAAS;IACZ,CAAC;MAGQ,QAED;AACT,MAAU,YAAY;;IAG3B,CAAC,EAAM,CAAC,EAEJ"}
package/dist/style.css CHANGED
@@ -1 +1,2 @@
1
- ._overlay_b1d9o_1,._full_b1d9o_1,._block_b1d9o_2{z-index:999999;background:linear-gradient(135deg,#ffffff59,#ffffffb3);backdrop-filter:blur(20px) saturate(200%);display:flex;justify-content:center;align-items:center;width:100%;height:100%;animation:_overlay-fade-in_b1d9o_1 .5s ease-out;border:1.5px solid rgba(255,255,255,.35);box-shadow:0 4px 32px #1f26872e,inset 0 1.5px 8px #ffffff40}._full_b1d9o_1,._block_b1d9o_2{pointer-events:none}._full_b1d9o_1{position:fixed;inset:0}._block_b1d9o_2{position:absolute;width:100%;height:100%;left:50%;top:50%;transform:translate(-50%,-50%);background:#ffffff1a;backdrop-filter:blur(4px)}._container_b1d9o_40{display:flex;flex-direction:column;justify-content:center;align-items:center;position:relative;padding:1rem;gap:1.5rem;text-align:center}._container_b1d9o_40 ._ring_b1d9o_50{width:clamp(60px,10vw,150px);height:clamp(60px,10vw,150px);border:2px solid transparent;border-radius:50%;position:absolute;transition:transform .3s ease}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(1){border-bottom:8px solid hsl(315,90%,60%);animation:_rotate1_b1d9o_1 1s linear infinite}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(2){border-bottom:8px solid hsl(345,90%,50%);animation:_rotate2_b1d9o_1 1s linear infinite}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(3){border-bottom:8px solid hsl(180,80%,40%);animation:_rotate3_b1d9o_1 1s linear infinite}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(4){border-bottom:8px solid hsl(40,100%,45%);animation:_rotate4_b1d9o_1 1s linear infinite}._container_b1d9o_40 ._message_b1d9o_74{font-weight:700;color:#2f2f37;text-shadow:0 1px 2px rgba(255,255,255,.8);animation:_text-fade_b1d9o_1 2s ease-in-out infinite alternate;word-break:break-word;hyphens:auto}@keyframes _rotate1_b1d9o_1{0%{transform:rotateX(50deg) rotate(110deg)}to{transform:rotateX(50deg) rotate(470deg)}}@keyframes _rotate2_b1d9o_1{0%{transform:rotateX(20deg) rotateY(50deg) rotate(20deg)}to{transform:rotateX(20deg) rotateY(50deg) rotate(380deg)}}@keyframes _rotate3_b1d9o_1{0%{transform:rotateX(40deg) rotateY(130deg) rotate(450deg)}to{transform:rotateX(40deg) rotateY(130deg) rotate(90deg)}}@keyframes _rotate4_b1d9o_1{0%{transform:rotateX(70deg) rotate(270deg)}to{transform:rotateX(70deg) rotate(630deg)}}@keyframes _text-fade_b1d9o_1{0%{opacity:.6}to{opacity:1}}@keyframes _overlay-fade-in_b1d9o_1{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){._ring_b1d9o_50,._message_b1d9o_74,._overlay_b1d9o_1,._full_b1d9o_1,._block_b1d9o_2{animation:none!important}}._modal-backdrop_199u4_1{position:fixed;inset:0;z-index:9999999;background-color:#0009;display:flex;align-items:center;justify-content:center;padding:1rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11{position:relative;background-color:#0f172a;color:#fff;max-width:80vw;width:100%;border-radius:.75rem;box-shadow:0 10px 20px #00000080;overflow:hidden;padding:2rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._btn-close_199u4_22{position:absolute;top:.75rem;right:1rem;font-size:1.25rem;color:#fff;background:none;border:none;cursor:pointer;transition:color .2s}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._btn-close_199u4_22:hover{color:#f87171}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._btn-close_199u4_22:focus-visible{outline:none;box-shadow:0 0 0 2px #f87171;border-radius:.125rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41{font-weight:700;margin-bottom:1rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41 ._btn-retry_199u4_45{background:linear-gradient(to right,#3b82f6,#06b6d4);color:#fff;font-weight:600;padding:.5rem 1.5rem;border-radius:.75rem;transition:background .3s ease;border:none;cursor:pointer}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41 ._btn-retry_199u4_45:hover{background:linear-gradient(to right,#2563eb,#0891b2)}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41 ._btn-retry_199u4_45:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62{background-color:#1e293b;text-align:left;font-size:.875rem;border-radius:.5rem;padding:1rem;margin-bottom:1.5rem;max-height:50vh;overflow-y:auto;border:1px solid #334155;display:flex;flex-direction:column;gap:.5rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre{white-space:pre-wrap;word-break:break-word}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre._main_199u4_80{color:#fca5a5}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre._network_199u4_83{color:#fde68a}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre._extra_199u4_86{color:#67e8f9;overflow-x:auto;white-space:pre;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;background-color:#0f172a;padding:.5rem;border-radius:.375rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 ul{padding-left:1rem;color:#fda4af;list-style:disc}._error-container_oofeh_1{display:flex;align-items:center;justify-content:center;gap:.5rem}._error-details-button_oofeh_8{display:inline-flex;align-items:center;justify-content:center;padding:.5rem 1rem;background-color:#ef4444;color:#fff;border:2px solid #dc2626;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease-in-out}._error-details-button_oofeh_8:hover{background-color:#dc2626;border-color:#b91c1c;transform:translateY(-1px);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}._error-details-button_oofeh_8:active{transform:translateY(0);box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f}._error-details-button_oofeh_8:focus{outline:none;ring:2px;ring-color:#fca5a5;ring-offset:2px}
1
+ ._error-container_wq4ix_1{justify-content:center;align-items:center;gap:.5rem;display:flex}._error-details-button_wq4ix_8{color:#fff;cursor:pointer;background-color:#ef4444;border:2px solid #dc2626;border-radius:.5rem;justify-content:center;align-items:center;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:all .2s ease-in-out;display:inline-flex}._error-details-button_wq4ix_8:hover{background-color:#dc2626;border-color:#b91c1c;transform:translateY(-1px);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}._error-details-button_wq4ix_8:active{transform:translateY(0);box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f}._error-details-button_wq4ix_8:focus-visible{outline-offset:2px;outline:2px solid #fca5a5}._modal-backdrop_199u4_1{z-index:9999999;background-color:#0009;justify-content:center;align-items:center;padding:1rem;display:flex;position:fixed;inset:0}._modal-backdrop_199u4_1 ._modal-content_199u4_11{color:#fff;background-color:#0f172a;border-radius:.75rem;width:100%;max-width:80vw;padding:2rem;position:relative;overflow:hidden;box-shadow:0 10px 20px #00000080}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._btn-close_199u4_22{color:#fff;cursor:pointer;background:0 0;border:none;font-size:1.25rem;transition:color .2s;position:absolute;top:.75rem;right:1rem}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._btn-close_199u4_22:hover{color:#f87171}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._btn-close_199u4_22:focus-visible{border-radius:.125rem;outline:none;box-shadow:0 0 0 2px #f87171}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41{margin-bottom:1rem;font-weight:700}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41 ._btn-retry_199u4_45{color:#fff;cursor:pointer;background:linear-gradient(90deg,#3b82f6,#06b6d4);border:none;border-radius:.75rem;padding:.5rem 1.5rem;font-weight:600;transition:background .3s}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41 ._btn-retry_199u4_45:hover{background:linear-gradient(90deg,#2563eb,#0891b2)}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-title_199u4_41 ._btn-retry_199u4_45:focus-visible{outline-offset:2px;outline:2px solid #3b82f6}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62{text-align:left;background-color:#1e293b;border:1px solid #334155;border-radius:.5rem;flex-direction:column;gap:.5rem;max-height:50vh;margin-bottom:1.5rem;padding:1rem;font-size:.875rem;display:flex;overflow-y:auto}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre{white-space:pre-wrap;word-break:break-word}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre._main_199u4_80{color:#fca5a5}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre._network_199u4_83{color:#fde68a}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 pre._extra_199u4_86{color:#67e8f9;white-space:pre;background-color:#0f172a;border-radius:.375rem;padding:.5rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;overflow-x:auto}._modal-backdrop_199u4_1 ._modal-content_199u4_11 ._error-details_199u4_62 ul{color:#fda4af;padding-left:1rem;list-style:outside}._overlay_b1d9o_1,._full_b1d9o_1,._block_b1d9o_2{z-index:999999;-webkit-backdrop-filter:blur(20px)saturate(200%);backdrop-filter:blur(20px)saturate(200%);background:linear-gradient(135deg,#ffffff59,#ffffffb3);border:1.5px solid #ffffff59;justify-content:center;align-items:center;width:100%;height:100%;animation:.5s ease-out _overlay-fade-in_b1d9o_1;display:flex;box-shadow:0 4px 32px #1f26872e,inset 0 1.5px 8px #ffffff40}._full_b1d9o_1,._block_b1d9o_2{pointer-events:none}._full_b1d9o_1{position:fixed;inset:0}._block_b1d9o_2{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#ffffff1a;width:100%;height:100%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}._container_b1d9o_40{text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:1.5rem;padding:1rem;display:flex;position:relative}._container_b1d9o_40 ._ring_b1d9o_50{border:2px solid #0000;border-radius:50%;width:clamp(60px,10vw,150px);height:clamp(60px,10vw,150px);transition:transform .3s;position:absolute}._container_b1d9o_40 ._ring_b1d9o_50:first-child{border-bottom:8px solid #f53dc7;animation:1s linear infinite _rotate1_b1d9o_1}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(2){border-bottom:8px solid #f20d46;animation:1s linear infinite _rotate2_b1d9o_1}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(3){border-bottom:8px solid #14b8b8;animation:1s linear infinite _rotate3_b1d9o_1}._container_b1d9o_40 ._ring_b1d9o_50:nth-child(4){border-bottom:8px solid #e69900;animation:1s linear infinite _rotate4_b1d9o_1}._container_b1d9o_40 ._message_b1d9o_74{color:#2f2f37;text-shadow:0 1px 2px #fffc;word-break:break-word;-webkit-hyphens:auto;hyphens:auto;font-weight:700;animation:2s ease-in-out infinite alternate _text-fade_b1d9o_1}@keyframes _rotate1_b1d9o_1{0%{transform:rotateX(50deg)rotate(110deg)}to{transform:rotateX(50deg)rotate(470deg)}}@keyframes _rotate2_b1d9o_1{0%{transform:rotateX(20deg)rotateY(50deg)rotate(20deg)}to{transform:rotateX(20deg)rotateY(50deg)rotate(380deg)}}@keyframes _rotate3_b1d9o_1{0%{transform:rotateX(40deg)rotateY(130deg)rotate(450deg)}to{transform:rotateX(40deg)rotateY(130deg)rotate(90deg)}}@keyframes _rotate4_b1d9o_1{0%{transform:rotateX(70deg)rotate(270deg)}to{transform:rotateX(70deg)rotate(630deg)}}@keyframes _text-fade_b1d9o_1{0%{opacity:.6}to{opacity:1}}@keyframes _overlay-fade-in_b1d9o_1{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){._ring_b1d9o_50,._message_b1d9o_74,._overlay_b1d9o_1,._full_b1d9o_1,._block_b1d9o_2{animation:none!important}}
2
+ /*$vite$:1*/
@@ -1,5 +1,8 @@
1
- var p = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e.DEVELOPMENT = "development", e))(p || {});
2
- export {
3
- p as E_Environment
4
- };
5
- //# sourceMappingURL=common.type.js.map
1
+ //#region src/typescript/common.type.ts
2
+ var e = /* @__PURE__ */ function(e) {
3
+ return e.PRODUCTION = "production", e.STAGING = "staging", e.DEVELOPMENT = "development", e;
4
+ }({});
5
+ //#endregion
6
+ export { e as E_Environment };
7
+
8
+ //# sourceMappingURL=common.type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.type.js","sources":["../../src/typescript/common.type.ts"],"sourcesContent":["import type consola from 'consola';\n\n/**\n * Generic object type with string keys and values of type T (defaults to unknown).\n */\nexport type T_Object<T = unknown> = Record<string, T>;\n\n/**\n * Logging interface for browser and Node.js environments, compatible with consola.\n */\nexport interface I_Log {\n silent: typeof consola['silent'];\n level: typeof consola['level'];\n fatal: typeof consola['fatal'];\n error: typeof consola['error'];\n warn: typeof consola['warn'];\n log: typeof consola['log'];\n info: typeof consola['info'];\n success: typeof consola['success'];\n ready: typeof consola['ready'];\n start: typeof consola['start'];\n box: typeof consola['box'];\n debug: typeof consola['debug'];\n trace: typeof consola['trace'];\n verbose: typeof consola['verbose'];\n}\n\n/**\n * Base interface for return types with common properties.\n */\nexport interface I_ReturnBase {\n success: boolean;\n message?: string;\n code?: number | string;\n}\n\n/**\n * Success return type with result data.\n * @template T - The main result type\n * @template E - Additional properties to merge with the result (defaults to unknown)\n */\nexport interface I_ReturnSuccess<T, E = unknown> extends I_ReturnBase {\n success: true;\n result: T & E;\n}\n\n/**\n * Failure return type with error information.\n */\nexport interface I_ReturnFailure extends I_ReturnBase {\n success: false;\n message: string;\n code: number | string;\n}\n\n/**\n * Discriminated union type for function return values.\n * Provides type-safe handling of success and failure cases.\n *\n * @template T - The success result type (defaults to void)\n * @template E - Additional properties to merge with the result (defaults to unknown)\n *\n * @example\n * ```typescript\n * function fetchUser(id: string): I_Return<User> {\n * try {\n * const user = await getUser(id);\n * return { success: true, result: user };\n * } catch (error) {\n * return { success: false, message: error.message, code: 'USER_NOT_FOUND' };\n * }\n * }\n * ```\n */\nexport type I_Return<T = void, E = unknown> = I_ReturnSuccess<T, E> | I_ReturnFailure;\n\nexport enum E_Environment {\n PRODUCTION = 'production',\n STAGING = 'staging',\n DEVELOPMENT = 'development',\n}\n"],"names":["E_Environment"],"mappings":"AA4EO,IAAKA,sBAAAA,OACRA,EAAA,aAAa,cACbA,EAAA,UAAU,WACVA,EAAA,cAAc,eAHNA,IAAAA,KAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"common.type.js","names":[],"sources":["../../src/typescript/common.type.ts"],"sourcesContent":["import type consola from 'consola';\n\n/**\n * Generic object type with string keys and values of type T (defaults to unknown).\n */\nexport type T_Object<T = unknown> = Record<string, T>;\n\n/**\n * Logging interface for browser and Node.js environments, compatible with consola.\n */\nexport interface I_Log {\n silent: typeof consola['silent'];\n level: typeof consola['level'];\n fatal: typeof consola['fatal'];\n error: typeof consola['error'];\n warn: typeof consola['warn'];\n log: typeof consola['log'];\n info: typeof consola['info'];\n success: typeof consola['success'];\n ready: typeof consola['ready'];\n start: typeof consola['start'];\n box: typeof consola['box'];\n debug: typeof consola['debug'];\n trace: typeof consola['trace'];\n verbose: typeof consola['verbose'];\n}\n\n/**\n * Base interface for return types with common properties.\n */\nexport interface I_ReturnBase {\n success: boolean;\n message?: string;\n code?: number | string;\n}\n\n/**\n * Success return type with result data.\n * @template T - The main result type\n * @template E - Additional properties to merge with the result (defaults to unknown)\n */\nexport interface I_ReturnSuccess<T, E = unknown> extends I_ReturnBase {\n success: true;\n result: T & E;\n}\n\n/**\n * Failure return type with error information.\n */\nexport interface I_ReturnFailure extends I_ReturnBase {\n success: false;\n message: string;\n code: number | string;\n}\n\n/**\n * Discriminated union type for function return values.\n * Provides type-safe handling of success and failure cases.\n *\n * @template T - The success result type (defaults to void)\n * @template E - Additional properties to merge with the result (defaults to unknown)\n *\n * @example\n * ```typescript\n * function fetchUser(id: string): I_Return<User> {\n * try {\n * const user = await getUser(id);\n * return { success: true, result: user };\n * } catch (error) {\n * return { success: false, message: error.message, code: 'USER_NOT_FOUND' };\n * }\n * }\n * ```\n */\nexport type I_Return<T = void, E = unknown> = I_ReturnSuccess<T, E> | I_ReturnFailure;\n\nexport enum E_Environment {\n PRODUCTION = 'production',\n STAGING = 'staging',\n DEVELOPMENT = 'development',\n}\n"],"mappings":";AA4EA,IAAY,IAAL,yBAAA,GAAA;QACH,EAAA,aAAA,cACA,EAAA,UAAA,WACA,EAAA,cAAA;KACH"}
@@ -1,5 +1,2 @@
1
- import { E_Environment as r } from "./common.type.js";
2
- export {
3
- r as E_Environment
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ import { E_Environment as e } from "./common.type.js";
2
+ export { e as E_Environment };