@steveencues/starter-react-ui 1.0.4 → 1.0.5

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 (76) hide show
  1. package/dist/index.cjs +7 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +217 -384
  4. package/dist/index.js.map +1 -1
  5. package/dist/libs/aplicacion/contexts/theme.context.d.ts +3 -3
  6. package/dist/libs/aplicacion/hooks/index.d.ts +0 -1
  7. package/dist/libs/aplicacion/hooks/use-theme.d.ts +5 -4
  8. package/dist/libs/aplicacion/providers/theme-provider.d.ts +6 -6
  9. package/dist/libs/aplicacion/services/custom-theme.service.d.ts +67 -0
  10. package/dist/libs/aplicacion/services/index.d.ts +1 -0
  11. package/dist/libs/aplicacion/utils/theme.utils.d.ts +29 -11
  12. package/dist/libs/components/Button/Button.d.ts +5 -12
  13. package/dist/libs/domain/constants/theme-css-variable.const.d.ts +33 -64
  14. package/dist/libs/domain/interface/index.d.ts +2 -3
  15. package/dist/libs/domain/interface/{manifest/theme-manifest.interface.d.ts → theme-manifest.interface.d.ts} +1 -3
  16. package/dist/libs/domain/interface/theme.interface.d.ts +41 -0
  17. package/dist/libs/domain/types/index.d.ts +1 -1
  18. package/dist/libs/domain/types/theme.type.d.ts +42 -0
  19. package/dist/style.css +3 -0
  20. package/package.json +4 -2
  21. package/dist/libs/aplicacion/hooks/use-theme-preference.hook.d.ts +0 -7
  22. package/dist/libs/domain/interface/manifest/index.d.ts +0 -1
  23. package/dist/libs/domain/interface/theme/accessibility/index.d.ts +0 -1
  24. package/dist/libs/domain/interface/theme/accessibility/theme-accessibility.interface.d.ts +0 -15
  25. package/dist/libs/domain/interface/theme/colors/index.d.ts +0 -8
  26. package/dist/libs/domain/interface/theme/colors/theme-border-colors.interface.d.ts +0 -17
  27. package/dist/libs/domain/interface/theme/colors/theme-brand-colors.interface.d.ts +0 -24
  28. package/dist/libs/domain/interface/theme/colors/theme-color-palette.interface.d.ts +0 -30
  29. package/dist/libs/domain/interface/theme/colors/theme-data-colors.interface.d.ts +0 -15
  30. package/dist/libs/domain/interface/theme/colors/theme-overlay-colors.interface.d.ts +0 -13
  31. package/dist/libs/domain/interface/theme/colors/theme-state-colors.interface.d.ts +0 -23
  32. package/dist/libs/domain/interface/theme/colors/theme-surface-colors.interface.d.ts +0 -19
  33. package/dist/libs/domain/interface/theme/colors/theme-text-colors.interface.d.ts +0 -19
  34. package/dist/libs/domain/interface/theme/core/app-theme.interface.d.ts +0 -11
  35. package/dist/libs/domain/interface/theme/core/index.d.ts +0 -2
  36. package/dist/libs/domain/interface/theme/core/theme.interface.d.ts +0 -20
  37. package/dist/libs/domain/interface/theme/effects/index.d.ts +0 -5
  38. package/dist/libs/domain/interface/theme/effects/theme-animation.interface.d.ts +0 -17
  39. package/dist/libs/domain/interface/theme/effects/theme-effects.interface.d.ts +0 -22
  40. package/dist/libs/domain/interface/theme/effects/theme-gradient-stop.interface.d.ts +0 -11
  41. package/dist/libs/domain/interface/theme/effects/theme-gradient.interface.d.ts +0 -16
  42. package/dist/libs/domain/interface/theme/effects/theme-gradients.interface.d.ts +0 -17
  43. package/dist/libs/domain/interface/theme/index.d.ts +0 -6
  44. package/dist/libs/domain/interface/theme/preferences/index.d.ts +0 -5
  45. package/dist/libs/domain/interface/theme/preferences/theme-context.interface.d.ts +0 -11
  46. package/dist/libs/domain/interface/theme/preferences/theme-preference-configuration.interface.d.ts +0 -11
  47. package/dist/libs/domain/interface/theme/preferences/theme-preference-result.interface.d.ts +0 -11
  48. package/dist/libs/domain/interface/theme/preferences/theme-preference-state.interface.d.ts +0 -10
  49. package/dist/libs/domain/interface/theme/preferences/theme-provider.interface.d.ts +0 -13
  50. package/dist/libs/domain/interface/theme/typography/index.d.ts +0 -5
  51. package/dist/libs/domain/interface/theme/typography/theme-font-family.interface.d.ts +0 -13
  52. package/dist/libs/domain/interface/theme/typography/theme-font-sizes.interface.d.ts +0 -20
  53. package/dist/libs/domain/interface/theme/typography/theme-font-weights.interface.d.ts +0 -17
  54. package/dist/libs/domain/interface/theme/typography/theme-text-style.interface.d.ts +0 -18
  55. package/dist/libs/domain/interface/theme/typography/theme-typography.interface.d.ts +0 -37
  56. package/dist/libs/domain/types/theme/index.d.ts +0 -20
  57. package/dist/libs/domain/types/theme/theme-animation.type.d.ts +0 -18
  58. package/dist/libs/domain/types/theme/theme-border.type.d.ts +0 -7
  59. package/dist/libs/domain/types/theme/theme-brand.type.d.ts +0 -7
  60. package/dist/libs/domain/types/theme/theme-category.type.d.ts +0 -12
  61. package/dist/libs/domain/types/theme/theme-color-scale.type.d.ts +0 -6
  62. package/dist/libs/domain/types/theme/theme-css.type.d.ts +0 -15
  63. package/dist/libs/domain/types/theme/theme-effect.type.d.ts +0 -7
  64. package/dist/libs/domain/types/theme/theme-font-weights.type.d.ts +0 -7
  65. package/dist/libs/domain/types/theme/theme-font.type.d.ts +0 -19
  66. package/dist/libs/domain/types/theme/theme-gradient.type.d.ts +0 -12
  67. package/dist/libs/domain/types/theme/theme-layout.type.d.ts +0 -24
  68. package/dist/libs/domain/types/theme/theme-name.types.d.ts +0 -6
  69. package/dist/libs/domain/types/theme/theme-preference.type.d.ts +0 -8
  70. package/dist/libs/domain/types/theme/theme-shadow.type.d.ts +0 -7
  71. package/dist/libs/domain/types/theme/theme-state.type.d.ts +0 -7
  72. package/dist/libs/domain/types/theme/theme-surface.type.d.ts +0 -7
  73. package/dist/libs/domain/types/theme/theme-text-style.type.d.ts +0 -12
  74. package/dist/libs/domain/types/theme/theme-text.type.d.ts +0 -7
  75. package/dist/libs/domain/types/theme/theme-typography.type.d.ts +0 -7
  76. package/dist/libs/domain/types/theme/theme-value.type.d.ts +0 -12
package/dist/index.js CHANGED
@@ -11,28 +11,28 @@ function l() {
11
11
  }
12
12
  //#endregion
13
13
  //#region src/libs/aplicacion/hooks/use-theme.ts
14
- function u() {
14
+ var u = () => {
15
15
  let e = n(c);
16
- if (e === null) throw Error("useTheme must be used inside ThemeProvider.");
16
+ if (!e) throw Error("useTheme must be used inside ThemeProvider.");
17
17
  return e;
18
- }
18
+ };
19
19
  //#endregion
20
20
  //#region src/libs/infraestructura/storage/encrypted-preference.storage.ts
21
21
  async function d(e, t, n) {
22
22
  if (t.length !== 0 && n.length !== 0) try {
23
- let r = W();
23
+ let r = U();
24
24
  if (r === void 0) return;
25
- let i = await Q(t, n);
25
+ let i = await X(t, n);
26
26
  if (i === void 0) return;
27
27
  r.setItem(e, i);
28
28
  } catch {}
29
29
  }
30
30
  async function f(e, t) {
31
31
  if (t.length !== 0) try {
32
- let n = W();
32
+ let n = U();
33
33
  if (n === void 0) return;
34
34
  let r = n.getItem(e);
35
- return r === null ? void 0 : await $(r, t);
35
+ return r === null ? void 0 : await Z(r, t);
36
36
  } catch {
37
37
  return;
38
38
  }
@@ -53,98 +53,43 @@ var g = "starter-react-ui:theme-preference:v1";
53
53
  function _(e, t) {
54
54
  return d(g, e, t);
55
55
  }
56
- async function v(e, t) {
56
+ async function ee(e, t) {
57
57
  let n = await f(g, t);
58
58
  if (n !== void 0) return e.find((e) => e.name === n)?.name;
59
59
  }
60
60
  //#endregion
61
- //#region src/libs/aplicacion/hooks/use-theme-preference.hook.ts
62
- function y(e, t, n) {
63
- return {
64
- ...e,
65
- themeName: t,
66
- isLoaded: n
67
- };
68
- }
69
- function b(e, t) {
70
- return e.themes === t.themes && e.initialTheme === t.initialTheme && e.themeEncryptionKey === t.themeEncryptionKey;
71
- }
72
- async function ee(e) {
73
- try {
74
- return await v(e.themes, e.themeEncryptionKey);
75
- } catch {
76
- return;
77
- }
78
- }
79
- function te(e, t) {
80
- r(() => {
81
- let n = !0;
82
- return (async () => {
83
- let r = await ee(e);
84
- if (!n) return;
85
- let i = z(e.themes, e.initialTheme);
86
- t((t) => b(t, e) && t.isLoaded ? t : y(e, r ?? i.name, !0));
87
- })(), () => {
88
- n = !1;
89
- };
90
- }, [e, t]);
91
- }
92
- function ne(e, n) {
93
- return t((t) => {
94
- V(e.themes, t), n(y(e, t, !0));
95
- }, [e, n]);
96
- }
97
- function x(e) {
98
- let { themes: t, initialTheme: n, themeEncryptionKey: r } = e, o = i(() => ({
99
- themes: t,
100
- initialTheme: n,
101
- themeEncryptionKey: r
102
- }), [
103
- t,
104
- n,
105
- r
106
- ]), [s, c] = a(() => y(o, z(t, n).name, !1));
107
- te(o, c);
108
- let l = b(s, o);
109
- return {
110
- themeName: l ? s.themeName : z(t, n).name,
111
- isPreferenceLoaded: l && s.isLoaded,
112
- setThemeName: ne(o, c)
113
- };
114
- }
115
- //#endregion
116
61
  //#region src/libs/aplicacion/providers/translate.provider.tsx
117
- function S(e, t, n) {
62
+ function v(e, t, n) {
118
63
  return {
119
64
  ...e,
120
65
  selectedLanguage: t,
121
66
  isLoaded: n
122
67
  };
123
68
  }
124
- function C(e, t) {
69
+ function y(e, t) {
125
70
  return e.translations === t.translations && e.initialLanguage === t.initialLanguage && e.fallbackLanguage === t.fallbackLanguage && e.languageEncryptionKey === t.languageEncryptionKey && e.languages === t.languages;
126
71
  }
127
- async function re(e) {
72
+ async function te(e) {
128
73
  try {
129
74
  return await h(e.languages, e.languageEncryptionKey);
130
75
  } catch {
131
76
  return;
132
77
  }
133
78
  }
134
- function ie(e, t) {
79
+ function ne(e, t) {
135
80
  r(() => {
136
81
  let n = !0;
137
82
  return (async () => {
138
- let r = await re(e);
83
+ let r = await te(e);
139
84
  if (!n) return;
140
- let i = j(e.translations, e.initialLanguage, e.fallbackLanguage);
141
- t((t) => C(t, e) && t.isLoaded ? t : S(e, r ?? i, !0));
85
+ let i = k(e.translations, e.initialLanguage, e.fallbackLanguage);
86
+ t((t) => y(t, e) && t.isLoaded ? t : v(e, r ?? i, !0));
142
87
  })(), () => {
143
88
  n = !1;
144
89
  };
145
90
  }, [e, t]);
146
91
  }
147
- function ae(e, t, n) {
92
+ function b(e, t, n) {
148
93
  r(() => {
149
94
  n && m(t, e.languageEncryptionKey);
150
95
  }, [
@@ -153,22 +98,22 @@ function ae(e, t, n) {
153
98
  n
154
99
  ]);
155
100
  }
156
- function oe(e, n) {
101
+ function re(e, n) {
157
102
  return t((t) => {
158
- N(e.translations, t), n(S(e, t, !0));
103
+ j(e.translations, t), n(v(e, t, !0));
159
104
  }, [e, n]);
160
105
  }
161
- function se(e) {
162
- let [t, n] = a(() => S(e, e.initialLanguage, !1));
163
- ie(e, n);
164
- let r = C(t, e), i = r ? t.selectedLanguage : e.initialLanguage, o = r && t.isLoaded, s = oe(e, n);
106
+ function ie(e) {
107
+ let [t, n] = a(() => v(e, e.initialLanguage, !1));
108
+ ne(e, n);
109
+ let r = y(t, e), i = r ? t.selectedLanguage : e.initialLanguage, o = r && t.isLoaded, s = re(e, n);
165
110
  return {
166
- language: M(e.translations, i, e.initialLanguage, e.fallbackLanguage),
111
+ language: A(e.translations, i, e.initialLanguage, e.fallbackLanguage),
167
112
  isLoaded: o,
168
113
  setLanguage: s
169
114
  };
170
115
  }
171
- function ce({ translations: e, initialLanguage: t, fallbackLanguage: n = "en", languageEncryptionKey: r, children: a }) {
116
+ function ae({ translations: e, initialLanguage: t, fallbackLanguage: n = "en", languageEncryptionKey: r, children: a }) {
172
117
  let c = i(() => Object.keys(e), [e]), l = i(() => ({
173
118
  translations: e,
174
119
  initialLanguage: t,
@@ -181,16 +126,16 @@ function ce({ translations: e, initialLanguage: t, fallbackLanguage: n = "en", l
181
126
  n,
182
127
  r,
183
128
  c
184
- ]), u = se(l);
185
- ae(l, u.language, u.isLoaded);
186
- let d = le(l, u);
129
+ ]), u = ie(l);
130
+ b(l, u.language, u.isLoaded);
131
+ let d = oe(l, u);
187
132
  return /* @__PURE__ */ o(s.Provider, {
188
133
  value: d,
189
134
  children: a
190
135
  });
191
136
  }
192
- function le(e, n) {
193
- let r = e.translations[n.language], a = e.translations[e.fallbackLanguage], o = t((e, t) => L(r, a, e, t), [r, a]);
137
+ function oe(e, n) {
138
+ let r = e.translations[n.language], a = e.translations[e.fallbackLanguage], o = t((e, t) => I(r, a, e, t), [r, a]);
194
139
  return i(() => ({
195
140
  language: n.language,
196
141
  languages: e.languages,
@@ -205,107 +150,80 @@ function le(e, n) {
205
150
  }
206
151
  //#endregion
207
152
  //#region src/libs/aplicacion/providers/theme-provider.tsx
208
- function ue({ themes: e, initialTheme: n, themeEncryptionKey: a, children: s }) {
209
- let { themeName: l, isPreferenceLoaded: u, setThemeName: d } = x({
210
- themes: e,
211
- initialTheme: n,
212
- themeEncryptionKey: a
213
- }), f = B(e, l, n);
153
+ var se = (e, t) => {
154
+ let n = L(e, t);
155
+ if (n !== void 0) return n;
156
+ if (e.length === 0) throw Error("ThemeProvider requires at least one theme.");
157
+ return e[0];
158
+ }, ce = (e, t) => e.some((e) => e.name === t.name) ? e.map((e) => e.name === t.name ? t : e) : [...e, t], le = (e, t, n, r) => ({
159
+ theme: e,
160
+ themeName: e.name,
161
+ themes: t,
162
+ setTheme: n,
163
+ registerTheme: r
164
+ }), ue = ({ themes: e, initialTheme: n, children: s }) => {
165
+ let [l, u] = a([]), d = i(() => [...e, ...l], [e, l]), [f, p] = a(() => z(e, n)), m = i(() => se(d, f), [d, f]), h = t((e) => {
166
+ $.register(e), u((t) => ce(t, e));
167
+ }, []), g = t((e) => {
168
+ let t = L(d, e);
169
+ t !== void 0 && (R(t) && $.register(t), p(t.name));
170
+ }, [d]);
214
171
  r(() => {
215
- u && _(f.name, a);
216
- }, [
217
- u,
218
- f.name,
219
- a
220
- ]);
221
- let p = t((e) => d(e), [d]), m = i(() => H(f), [f]), h = i(() => ({
222
- theme: f,
223
- themeName: f.name,
224
- themes: e,
225
- setTheme: p
226
- }), [
227
- f,
228
- e,
229
- p
172
+ B(m.name), V(m.name);
173
+ }, [m.name]);
174
+ let _ = i(() => le(m, d, g, h), [
175
+ m,
176
+ d,
177
+ g,
178
+ h
230
179
  ]);
231
180
  return /* @__PURE__ */ o(c.Provider, {
232
- value: h,
233
- children: /* @__PURE__ */ o("div", {
234
- "data-rui-theme": f.name,
235
- style: {
236
- ...m,
237
- display: "contents"
238
- },
239
- children: s
240
- })
181
+ value: _,
182
+ children: s
241
183
  });
242
- }
243
- //#endregion
244
- //#region src/libs/domain/enums/translation-regex.enum.ts
245
- var w = Object.freeze({ INTERPOLATION_PLACEHOLDER: String.raw`\{\{([a-zA-Z0-9_]+)\}\}` }), T = "g", E = "AES-GCM", de = 12, D = "SHA-256", fe = "raw", pe = ".", O = ["encrypt", "decrypt"], me = 2, k = {
246
- SURFACE_BACKGROUND: "--rui-surface-background",
247
- SURFACE_SURFACE: "--rui-surface-surface",
248
- SURFACE_SURFACE_ELEVATED: "--rui-surface-surface-elevated",
249
- SURFACE_SURFACE_HOVER: "--rui-surface-surface-hover",
250
- SURFACE_SURFACE_ACTIVE: "--rui-surface-surface-active",
251
- SURFACE_SURFACE_DISABLED: "--rui-surface-surface-disabled",
252
- TEXT_PRIMARY: "--rui-text-primary",
253
- TEXT_SECONDARY: "--rui-text-secondary",
254
- TEXT_MUTED: "--rui-text-muted",
255
- TEXT_DISABLED: "--rui-text-disabled",
256
- TEXT_INVERSE: "--rui-text-inverse",
257
- TEXT_LINK: "--rui-text-link",
258
- TEXT_LINK_HOVER: "--rui-text-link-hover",
259
- BRAND_PRIMARY: "--rui-brand-primary",
260
- BRAND_PRIMARY_HOVER: "--rui-brand-primary-hover",
261
- BRAND_PRIMARY_ACTIVE: "--rui-brand-primary-active",
262
- BRAND_PRIMARY_CONTRAST: "--rui-brand-primary-contrast",
263
- BRAND_SECONDARY: "--rui-brand-secondary",
264
- BRAND_SECONDARY_HOVER: "--rui-brand-secondary-hover",
265
- BRAND_SECONDARY_ACTIVE: "--rui-brand-secondary-active",
266
- BRAND_SECONDARY_CONTRAST: "--rui-brand-secondary-contrast",
267
- BRAND_ACCENT: "--rui-brand-accent",
268
- BRAND_ACCENT_HOVER: "--rui-brand-accent-hover",
269
- BRAND_ACCENT_CONTRAST: "--rui-brand-accent-contrast",
270
- STATE_SUCCESS: "--rui-state-success",
271
- STATE_SUCCESS_BACKGROUND: "--rui-state-success-background",
272
- STATE_WARNING: "--rui-state-warning",
273
- STATE_WARNING_BACKGROUND: "--rui-state-warning-background",
274
- STATE_ERROR: "--rui-state-error",
275
- STATE_ERROR_BACKGROUND: "--rui-state-error-background",
276
- STATE_INFO: "--rui-state-info",
277
- STATE_INFO_BACKGROUND: "--rui-state-info-background",
278
- BORDER_DEFAULT: "--rui-border-default",
279
- BORDER_SUBTLE: "--rui-border-subtle",
280
- BORDER_STRONG: "--rui-border-strong",
281
- BORDER_FOCUS: "--rui-border-focus",
282
- BORDER_HOVER: "--rui-border-hover",
283
- BORDER_ACTIVE: "--rui-border-active",
284
- BORDER_DISABLED: "--rui-border-disabled",
285
- SHADOW_COLOR: "--rui-shadow-color",
286
- SHADOW_SUBTLE: "--rui-shadow-subtle",
287
- SHADOW_SMALL: "--rui-shadow-small",
288
- SHADOW_MEDIUM: "--rui-shadow-medium",
289
- SHADOW_LARGE: "--rui-shadow-large",
290
- SHADOW_GLOW: "--rui-shadow-glow",
291
- EFFECTS_OVERLAY: "--rui-effects-overlay",
292
- EFFECTS_BACKDROP: "--rui-effects-backdrop",
293
- EFFECTS_BLUR: "--rui-effects-blur",
294
- EFFECTS_BLUR_STRONG: "--rui-effects-blur-strong",
295
- EFFECTS_GLASS_BACKGROUND: "--rui-effects-glass-background",
296
- EFFECTS_GLASS_BORDER: "--rui-effects-glass-border",
297
- TYPOGRAPHY_HEADING_PRIMARY: "--rui-typography-heading-primary",
298
- TYPOGRAPHY_HEADING_SECONDARY: "--rui-typography-heading-secondary",
299
- TYPOGRAPHY_HEADING_MUTED: "--rui-typography-heading-muted",
300
- TYPOGRAPHY_BODY_PRIMARY: "--rui-typography-body-primary",
301
- TYPOGRAPHY_BODY_SECONDARY: "--rui-typography-body-secondary",
302
- TYPOGRAPHY_BODY_MUTED: "--rui-typography-body-muted",
303
- TYPOGRAPHY_LABEL_PRIMARY: "--rui-typography-label-primary",
304
- TYPOGRAPHY_LABEL_SECONDARY: "--rui-typography-label-secondary",
305
- TYPOGRAPHY_LABEL_MUTED: "--rui-typography-label-muted",
306
- TYPOGRAPHY_BUTTON_PRIMARY: "--rui-typography-button-primary",
307
- TYPOGRAPHY_BUTTON_SECONDARY: "--rui-typography-button-secondary"
308
- }, he = {
184
+ }, x = Object.freeze({ INTERPOLATION_PLACEHOLDER: String.raw`\{\{([a-zA-Z0-9_]+)\}\}` }), de = "g", S = "AES-GCM", fe = 12, C = "SHA-256", pe = "raw", me = ".", w = ["encrypt", "decrypt"], T = 2, E = {
185
+ primary: "--color-primary",
186
+ primaryContent: "--color-primary-content",
187
+ secondary: "--color-secondary",
188
+ secondaryContent: "--color-secondary-content",
189
+ accent: "--color-accent",
190
+ accentContent: "--color-accent-content",
191
+ neutral: "--color-neutral",
192
+ neutralContent: "--color-neutral-content",
193
+ base100: "--color-base-100",
194
+ base200: "--color-base-200",
195
+ base300: "--color-base-300",
196
+ baseContent: "--color-base-content",
197
+ info: "--color-info",
198
+ infoContent: "--color-info-content",
199
+ success: "--color-success",
200
+ successContent: "--color-success-content",
201
+ warning: "--color-warning",
202
+ warningContent: "--color-warning-content",
203
+ error: "--color-error",
204
+ errorContent: "--color-error-content"
205
+ }, D = [
206
+ ["primary", E.primary],
207
+ ["primaryContent", E.primaryContent],
208
+ ["secondary", E.secondary],
209
+ ["secondaryContent", E.secondaryContent],
210
+ ["accent", E.accent],
211
+ ["accentContent", E.accentContent],
212
+ ["neutral", E.neutral],
213
+ ["neutralContent", E.neutralContent],
214
+ ["base100", E.base100],
215
+ ["base200", E.base200],
216
+ ["base300", E.base300],
217
+ ["baseContent", E.baseContent],
218
+ ["info", E.info],
219
+ ["infoContent", E.infoContent],
220
+ ["success", E.success],
221
+ ["successContent", E.successContent],
222
+ ["warning", E.warning],
223
+ ["warningContent", E.warningContent],
224
+ ["error", E.error],
225
+ ["errorContent", E.errorContent]
226
+ ], he = {
309
227
  THIN: 100,
310
228
  EXTRA_LIGHT: 200,
311
229
  LIGHT: 300,
@@ -318,25 +236,25 @@ var w = Object.freeze({ INTERPOLATION_PLACEHOLDER: String.raw`\{\{([a-zA-Z0-9_]+
318
236
  };
319
237
  //#endregion
320
238
  //#region src/libs/aplicacion/utils/translation.utils.ts
321
- function A(e, t) {
239
+ function O(e, t) {
322
240
  return Object.hasOwn(e, t);
323
241
  }
324
242
  function ge(e) {
325
243
  let [t] = Object.keys(e);
326
244
  return t;
327
245
  }
328
- function j(e, t, n) {
329
- if (A(e, t)) return t;
330
- if (A(e, n)) return n;
246
+ function k(e, t, n) {
247
+ if (O(e, t)) return t;
248
+ if (O(e, n)) return n;
331
249
  let r = ge(e);
332
250
  if (r === void 0) throw Error("TranslateProvider requires at least one translation catalog.");
333
251
  return r;
334
252
  }
335
- function M(e, t, n, r) {
336
- return A(e, t) ? t : j(e, n, r);
253
+ function A(e, t, n, r) {
254
+ return O(e, t) ? t : k(e, n, r);
337
255
  }
338
- function N(e, t) {
339
- if (!A(e, t)) throw Error(`Language "${t}" is not available in the translation catalog.`);
256
+ function j(e, t) {
257
+ if (!O(e, t)) throw Error(`Language "${t}" is not available in the translation catalog.`);
340
258
  }
341
259
  function _e(e, t) {
342
260
  let n = e;
@@ -346,144 +264,43 @@ function _e(e, t) {
346
264
  }
347
265
  return n;
348
266
  }
349
- function P(e, t) {
267
+ function M(e, t) {
350
268
  if (e === void 0 || t === "") return;
351
269
  let n = _e(e, t);
352
270
  return typeof n == "string" ? n : void 0;
353
271
  }
354
- function F(e, t, n) {
272
+ function N(e, t, n) {
355
273
  let r = n?.[t];
356
274
  return r === void 0 ? e : String(r);
357
275
  }
358
- function I(e, t) {
359
- let n = new RegExp(w.INTERPOLATION_PLACEHOLDER, "g");
360
- return e.replace(n, (e, n) => F(e, n, t));
276
+ function P(e, t) {
277
+ let n = new RegExp(x.INTERPOLATION_PLACEHOLDER, "g");
278
+ return e.replace(n, (e, n) => N(e, n, t));
361
279
  }
362
- function ve(e, t, n) {
363
- let r = P(e, n);
364
- return r === void 0 ? P(t, n) ?? n : r;
280
+ function F(e, t, n) {
281
+ let r = M(e, n);
282
+ return r === void 0 ? M(t, n) ?? n : r;
365
283
  }
366
- function L(e, t, n, r) {
367
- return I(ve(e, t, n), r);
284
+ function I(e, t, n, r) {
285
+ return P(F(e, t, n), r);
368
286
  }
369
287
  //#endregion
370
288
  //#region src/libs/aplicacion/utils/theme.utils.ts
371
- function R(e, t) {
372
- return e.find((e) => e.name === t);
373
- }
374
- function ye(e) {
375
- let t = e.at(0);
376
- if (t === void 0) throw Error("ThemeProvider requires at least one registered theme.");
377
- return t;
378
- }
379
- function z(e, t) {
380
- return R(e, t) ?? ye(e);
381
- }
382
- function B(e, t, n) {
383
- return R(e, t) ?? z(e, n);
384
- }
385
- function V(e, t) {
386
- if (R(e, t) === void 0) throw Error(`Theme "${t}" is not registered in ThemeProvider.`);
387
- }
388
- function be(e) {
389
- return {
390
- [k.SURFACE_BACKGROUND]: e.surface.background,
391
- [k.SURFACE_SURFACE]: e.surface.surface,
392
- [k.SURFACE_SURFACE_ELEVATED]: e.surface.surfaceElevated,
393
- [k.SURFACE_SURFACE_HOVER]: e.surface.surfaceHover,
394
- [k.SURFACE_SURFACE_ACTIVE]: e.surface.surfaceActive,
395
- [k.SURFACE_SURFACE_DISABLED]: e.surface.surfaceDisabled
396
- };
397
- }
398
- function xe(e) {
399
- return {
400
- [k.TEXT_PRIMARY]: e.text.primary,
401
- [k.TEXT_SECONDARY]: e.text.secondary,
402
- [k.TEXT_MUTED]: e.text.muted,
403
- [k.TEXT_DISABLED]: e.text.disabled,
404
- [k.TEXT_INVERSE]: e.text.inverse,
405
- [k.TEXT_LINK]: e.text.link,
406
- [k.TEXT_LINK_HOVER]: e.text.linkHover
407
- };
408
- }
409
- function Se(e) {
410
- return {
411
- [k.BRAND_PRIMARY]: e.brand.primary,
412
- [k.BRAND_PRIMARY_HOVER]: e.brand.primaryHover,
413
- [k.BRAND_PRIMARY_ACTIVE]: e.brand.primaryActive,
414
- [k.BRAND_PRIMARY_CONTRAST]: e.brand.primaryContrast,
415
- [k.BRAND_SECONDARY]: e.brand.secondary,
416
- [k.BRAND_SECONDARY_HOVER]: e.brand.secondaryHover,
417
- [k.BRAND_SECONDARY_ACTIVE]: e.brand.secondaryActive,
418
- [k.BRAND_SECONDARY_CONTRAST]: e.brand.secondaryContrast,
419
- [k.BRAND_ACCENT]: e.brand.accent,
420
- [k.BRAND_ACCENT_HOVER]: e.brand.accentHover,
421
- [k.BRAND_ACCENT_CONTRAST]: e.brand.accentContrast
422
- };
423
- }
424
- function Ce(e) {
425
- return {
426
- [k.STATE_SUCCESS]: e.state.success,
427
- [k.STATE_SUCCESS_BACKGROUND]: e.state.successBackground,
428
- [k.STATE_WARNING]: e.state.warning,
429
- [k.STATE_WARNING_BACKGROUND]: e.state.warningBackground,
430
- [k.STATE_ERROR]: e.state.error,
431
- [k.STATE_ERROR_BACKGROUND]: e.state.errorBackground,
432
- [k.STATE_INFO]: e.state.info,
433
- [k.STATE_INFO_BACKGROUND]: e.state.infoBackground
434
- };
435
- }
436
- function we(e) {
437
- return {
438
- [k.BORDER_DEFAULT]: e.border.default,
439
- [k.BORDER_SUBTLE]: e.border.subtle,
440
- [k.BORDER_STRONG]: e.border.strong,
441
- [k.BORDER_FOCUS]: e.border.focus,
442
- [k.BORDER_HOVER]: e.border.hover,
443
- [k.BORDER_ACTIVE]: e.border.active,
444
- [k.BORDER_DISABLED]: e.border.disabled
445
- };
446
- }
447
- function Te(e) {
448
- return {
449
- [k.EFFECTS_OVERLAY]: e.effects.overlay,
450
- [k.EFFECTS_BACKDROP]: e.effects.backdrop,
451
- [k.EFFECTS_BLUR]: e.effects.blur,
452
- [k.EFFECTS_BLUR_STRONG]: e.effects.blurStrong,
453
- [k.EFFECTS_GLASS_BACKGROUND]: e.effects.glassBackground,
454
- [k.EFFECTS_GLASS_BORDER]: e.effects.glassBorder
455
- };
456
- }
457
- function Ee(e) {
458
- return {
459
- [k.TYPOGRAPHY_HEADING_PRIMARY]: e.typography.heading.h1.color,
460
- [k.TYPOGRAPHY_HEADING_SECONDARY]: e.typography.heading.h2.color,
461
- [k.TYPOGRAPHY_HEADING_MUTED]: e.typography.body.muted.color,
462
- [k.TYPOGRAPHY_BODY_PRIMARY]: e.typography.body.primary.color,
463
- [k.TYPOGRAPHY_BODY_SECONDARY]: e.typography.body.secondary.color,
464
- [k.TYPOGRAPHY_BODY_MUTED]: e.typography.body.muted.color,
465
- [k.TYPOGRAPHY_LABEL_PRIMARY]: e.typography.label.primary.color,
466
- [k.TYPOGRAPHY_LABEL_SECONDARY]: e.typography.label.secondary.color,
467
- [k.TYPOGRAPHY_LABEL_MUTED]: e.typography.label.muted.color,
468
- [k.TYPOGRAPHY_BUTTON_PRIMARY]: e.typography.button.primary.color,
469
- [k.TYPOGRAPHY_BUTTON_SECONDARY]: e.typography.button.secondary.color
470
- };
471
- }
472
- function H(e) {
473
- let { themes: t } = e;
474
- return {
475
- ...be(t),
476
- ...xe(t),
477
- ...Se(t),
478
- ...Ce(t),
479
- ...we(t),
480
- ...Te(t),
481
- ...Ee(t)
482
- };
483
- }
289
+ var L = (e, t) => e.find((e) => e.name === t), R = (e) => "daisyUI" in e, z = (e, t) => {
290
+ if (typeof window < "u") {
291
+ let t = window.localStorage.getItem("app_theme");
292
+ if (t !== null && t.length > 0 && L(e, t) !== void 0) return t;
293
+ }
294
+ let n = L(e, t);
295
+ return n === void 0 ? e.length === 0 ? t : e[0].name : n.name;
296
+ }, B = (e) => {
297
+ typeof document < "u" && document.documentElement.setAttribute("data-theme", e);
298
+ }, V = (e) => {
299
+ typeof window < "u" && window.localStorage.setItem("app_theme", e);
300
+ };
484
301
  //#endregion
485
302
  //#region src/libs/aplicacion/utils/crypto-api.util.ts
486
- function U() {
303
+ function H() {
487
304
  try {
488
305
  return globalThis.crypto;
489
306
  } catch {
@@ -492,7 +309,7 @@ function U() {
492
309
  }
493
310
  //#endregion
494
311
  //#region src/libs/aplicacion/utils/storage-api.util.ts
495
- function W() {
312
+ function U() {
496
313
  try {
497
314
  return globalThis.localStorage;
498
315
  } catch {
@@ -501,140 +318,156 @@ function W() {
501
318
  }
502
319
  //#endregion
503
320
  //#region src/libs/aplicacion/utils/text-encoding.util.ts
504
- function G(e) {
321
+ function W(e) {
505
322
  return new TextEncoder().encode(e);
506
323
  }
507
- function K(e) {
324
+ function G(e) {
508
325
  return new TextDecoder().decode(e);
509
326
  }
510
327
  //#endregion
511
328
  //#region src/libs/aplicacion/utils/base64.util.ts
512
- function q(e) {
329
+ function K(e) {
513
330
  let t = "";
514
331
  for (let n of e) t += String.fromCharCode(n);
515
332
  return btoa(t);
516
333
  }
517
- function J(e) {
334
+ function q(e) {
518
335
  let t = atob(e), n = new Uint8Array(t.length);
519
336
  for (let e = 0; e < t.length; e += 1) n[e] = t.charCodeAt(e);
520
337
  return n;
521
338
  }
522
339
  //#endregion
523
340
  //#region src/libs/aplicacion/services/encryption.service.ts
524
- async function Y(e) {
525
- let t = U();
341
+ async function J(e) {
342
+ let t = H();
526
343
  if (t === void 0 || e.length === 0) return;
527
- let n = await t.subtle.digest(D, G(e));
528
- return t.subtle.importKey("raw", n, { name: E }, !1, O);
344
+ let n = await t.subtle.digest(C, W(e));
345
+ return t.subtle.importKey("raw", n, { name: S }, !1, w);
529
346
  }
530
- function De() {
531
- let e = U();
347
+ function ve() {
348
+ let e = H();
532
349
  if (e === void 0) throw Error("Cryptographic API is unavailable.");
533
350
  return e.getRandomValues(/* @__PURE__ */ new Uint8Array(12));
534
351
  }
535
- function Oe(e) {
352
+ function ye(e) {
536
353
  try {
537
- let t = J(e);
354
+ let t = q(e);
538
355
  return t.length === 12 ? t : void 0;
539
356
  } catch {
540
357
  return;
541
358
  }
542
359
  }
543
- function ke(e) {
360
+ function be(e) {
544
361
  return e.length === 2;
545
362
  }
546
- function Ae(e) {
547
- if (ke(e)) return [e[0], e[1]];
363
+ function xe(e) {
364
+ if (be(e)) return [e[0], e[1]];
548
365
  }
549
- function X(e) {
550
- let t = Ae(e.split("."));
366
+ function Se(e) {
367
+ let t = xe(e.split("."));
551
368
  if (t === void 0) return;
552
- let [n, r] = t, i = Oe(n);
369
+ let [n, r] = t, i = ye(n);
553
370
  if (i !== void 0) try {
554
371
  return {
555
372
  iv: i,
556
- ciphertext: J(r)
373
+ ciphertext: q(r)
557
374
  };
558
375
  } catch {
559
376
  return;
560
377
  }
561
378
  }
562
- async function je(e, t, n) {
563
- return Z().subtle.encrypt({
564
- name: E,
379
+ async function Ce(e, t, n) {
380
+ return Y().subtle.encrypt({
381
+ name: S,
565
382
  iv: n
566
383
  }, t, e);
567
384
  }
568
- async function Me(e, t) {
569
- return Z().subtle.decrypt({
570
- name: E,
385
+ async function we(e, t) {
386
+ return Y().subtle.decrypt({
387
+ name: S,
571
388
  iv: e.iv
572
389
  }, t, e.ciphertext);
573
390
  }
574
- function Z() {
575
- let e = U();
391
+ function Y() {
392
+ let e = H();
576
393
  if (e === void 0) throw Error("Cryptographic API is unavailable.");
577
394
  return e;
578
395
  }
579
- async function Q(e, t) {
396
+ async function X(e, t) {
580
397
  try {
581
- let n = await Y(t);
398
+ let n = await J(t);
582
399
  if (n === void 0) return;
583
- let r = De(), i = await je(G(e), n, r);
584
- return [q(r), q(new Uint8Array(i))].join(".");
400
+ let r = ve(), i = await Ce(W(e), n, r);
401
+ return [K(r), K(new Uint8Array(i))].join(".");
585
402
  } catch {
586
403
  return;
587
404
  }
588
405
  }
589
- async function $(e, t) {
406
+ async function Z(e, t) {
590
407
  try {
591
- let n = X(e);
408
+ let n = Se(e);
592
409
  if (n === void 0) return;
593
- let r = await Y(t);
594
- return r === void 0 ? void 0 : K(await Me(n, r));
410
+ let r = await J(t);
411
+ return r === void 0 ? void 0 : G(await we(n, r));
595
412
  } catch {
596
413
  return;
597
414
  }
598
415
  }
599
416
  //#endregion
600
- //#region src/libs/components/Button/Button.tsx
601
- var Ne = ({ titulo: e, variant: t = "solid", disabled: n = !1, className: r = "", style: i, type: a = "button", ...s }) => {
602
- let { t: c } = l(), { theme: d } = u(), f = d.themes.brand.primary, p = {
603
- solid: "border",
604
- outline: "border bg-transparent",
605
- ghost: "border border-transparent bg-transparent"
606
- }, m = {
607
- solid: {
608
- backgroundColor: f,
609
- borderColor: f
610
- },
611
- outline: {
612
- color: f,
613
- borderColor: f
614
- },
615
- ghost: { color: f }
616
- };
417
+ //#region src/libs/aplicacion/services/custom-theme.service.ts
418
+ var Q = class e {
419
+ static STYLE_ID_PREFIX = "daisyui-custom-theme-";
420
+ register(e) {
421
+ this.validateThemeName(e.name);
422
+ let t = this.getOrCreateStyleElement(e.name), n = this.createColorDeclarations(e);
423
+ t.textContent = this.createThemeStylesheet(e, n);
424
+ }
425
+ unregister(e) {
426
+ this.validateThemeName(e), document.getElementById(this.getStyleElementId(e))?.remove();
427
+ }
428
+ isRegistered(e) {
429
+ return this.validateThemeName(e), document.getElementById(this.getStyleElementId(e)) !== null;
430
+ }
431
+ validateThemeName(e) {
432
+ if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(e)) throw Error(`Invalid theme name: ${e}`);
433
+ }
434
+ createColorDeclarations(e) {
435
+ return D.map(([t, n]) => {
436
+ let r = e.daisyUI[t];
437
+ return this.validateCssColor(t, r), `${n}: ${r};`;
438
+ }).join("\n");
439
+ }
440
+ validateCssColor(e, t) {
441
+ if (typeof CSS > "u" || !CSS.supports("color", t)) throw Error(`Invalid CSS color for theme token: ${e}`);
442
+ }
443
+ createThemeStylesheet(e, t) {
444
+ return `
445
+ [data-theme="${e.name}"] {
446
+ color-scheme: ${e.daisyUI.colorScheme};
447
+ ${t}
448
+ }
449
+ `;
450
+ }
451
+ getOrCreateStyleElement(e) {
452
+ let t = this.getStyleElementId(e), n = document.getElementById(t);
453
+ if (n instanceof HTMLStyleElement) return n;
454
+ n?.remove();
455
+ let r = document.createElement("style");
456
+ return r.id = t, document.head.appendChild(r), r;
457
+ }
458
+ getStyleElementId(t) {
459
+ return `${e.STYLE_ID_PREFIX}${t}`;
460
+ }
461
+ }, $ = new Q(), Te = ({ label: e, className: t = "", ...n }) => {
462
+ let { t: r } = l();
617
463
  return /* @__PURE__ */ o("button", {
618
- ...s,
619
- type: a,
620
- disabled: n,
621
- "aria-label": s["aria-label"] ?? c(e),
622
- className: [
623
- "inline-flex items-center justify-center rounded-md px-4 py-2",
624
- "transition-colors focus-visible:outline-2",
625
- "focus-visible:outline-offset-2 disabled:cursor-not-allowed",
626
- "disabled:opacity-50",
627
- p[t],
628
- r
629
- ].filter(Boolean).join(" "),
630
- style: {
631
- ...m[t],
632
- ...i
633
- },
634
- children: c(e)
464
+ ...n,
465
+ type: n.type ?? "button",
466
+ className: `btn btn-primary ${t}`,
467
+ children: e ?? r("common.button")
635
468
  });
636
469
  };
637
470
  //#endregion
638
- export { E as AES_GCM_ALGORITHM, de as AES_GCM_IV_LENGTH, Ne as Button, me as ENCRYPTED_VALUE_PART_COUNT, T as GLOBAL_REGEX_FLAG, O as KEY_USAGES, fe as RAW_KEY_FORMAT, D as SHA_256_ALGORITHM, pe as STORAGE_VALUE_SEPARATOR, he as THEME_FONT_WEIGHT, c as ThemeContext, k as ThemeCssVariable, ue as ThemeProvider, s as TranslateContext, ce as TranslateProvider, w as TranslationRegex, N as assertLanguageExists, V as assertThemeExists, H as createThemeVariables, J as decodeBase64, K as decodeText, $ as decryptText, q as encodeBase64, G as encodeText, Q as encryptText, P as findTranslation, U as getCryptoApi, W as getLocalStorage, I as interpolateTranslation, f as loadEncryptedPreference, h as loadLanguagePreference, v as loadThemePreference, M as resolveActiveLanguage, B as resolveActiveTheme, j as resolveInitialLanguage, z as resolveInitialTheme, d as saveEncryptedPreference, m as saveLanguagePreference, _ as saveThemePreference, L as translateMessage, l as useLanguage, u as useTheme, x as useThemePreference };
471
+ export { S as AES_GCM_ALGORITHM, fe as AES_GCM_IV_LENGTH, Te as Button, E as CSS_THEME_TOKENS, D as CSS_THEME_TOKEN_ENTRIES, Q as CustomThemeService, T as ENCRYPTED_VALUE_PART_COUNT, de as GLOBAL_REGEX_FLAG, w as KEY_USAGES, pe as RAW_KEY_FORMAT, C as SHA_256_ALGORITHM, me as STORAGE_VALUE_SEPARATOR, he as THEME_FONT_WEIGHT, c as ThemeContext, ue as ThemeProvider, s as TranslateContext, ae as TranslateProvider, x as TranslationRegex, B as applyThemeToDocument, j as assertLanguageExists, $ as customThemeService, q as decodeBase64, G as decodeText, Z as decryptText, K as encodeBase64, W as encodeText, X as encryptText, L as findThemeByName, M as findTranslation, H as getCryptoApi, U as getLocalStorage, P as interpolateTranslation, R as isCustomThemeDefinition, f as loadEncryptedPreference, h as loadLanguagePreference, ee as loadThemePreference, V as persistTheme, A as resolveActiveLanguage, k as resolveInitialLanguage, z as resolveInitialTheme, d as saveEncryptedPreference, m as saveLanguagePreference, _ as saveThemePreference, I as translateMessage, l as useLanguage, u as useTheme };
639
472
 
640
473
  //# sourceMappingURL=index.js.map