@steveencues/starter-react-ui 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +338 -148
- package/dist/index.js.map +1 -1
- package/dist/libs/components/index.d.ts +1 -0
- package/dist/libs/components/theme-selector/index.d.ts +2 -0
- package/dist/libs/components/theme-selector/theme-selector-list.d.ts +8 -0
- package/dist/libs/components/theme-selector/theme-selector-option.d.ts +8 -0
- package/dist/libs/components/theme-selector/theme-selector-panel.d.ts +21 -0
- package/dist/libs/components/theme-selector/theme-selector-search.d.ts +8 -0
- package/dist/libs/components/theme-selector/theme-selector-trigger.d.ts +8 -0
- package/dist/libs/components/theme-selector/theme-selector.d.ts +9 -0
- package/dist/libs/components/theme-selector/theme-selector.types.d.ts +55 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
2
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
3
|
//#region src/libs/aplicacion/contexts/translate.context.ts
|
|
4
|
-
var
|
|
4
|
+
var c = e(null), l = e(null);
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/libs/aplicacion/hooks/use-language.ts
|
|
7
|
-
function
|
|
8
|
-
let e = n(
|
|
7
|
+
function u() {
|
|
8
|
+
let e = n(c);
|
|
9
9
|
if (e === null) throw Error("useLanguage must be used inside TranslateProvider.");
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/libs/aplicacion/hooks/use-theme.ts
|
|
14
|
-
var
|
|
15
|
-
let e = n(
|
|
14
|
+
var d = () => {
|
|
15
|
+
let e = n(l);
|
|
16
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
|
-
async function
|
|
21
|
+
async function f(e, t, n) {
|
|
22
22
|
if (t.length !== 0 && n.length !== 0) try {
|
|
23
|
-
let r =
|
|
23
|
+
let r = H();
|
|
24
24
|
if (r === void 0) return;
|
|
25
|
-
let i = await
|
|
25
|
+
let i = await Y(t, n);
|
|
26
26
|
if (i === void 0) return;
|
|
27
27
|
r.setItem(e, i);
|
|
28
28
|
} catch {}
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function p(e, t) {
|
|
31
31
|
if (t.length !== 0) try {
|
|
32
|
-
let n =
|
|
32
|
+
let n = H();
|
|
33
33
|
if (n === void 0) return;
|
|
34
34
|
let r = n.getItem(e);
|
|
35
|
-
return r === null ? void 0 : await
|
|
35
|
+
return r === null ? void 0 : await X(r, t);
|
|
36
36
|
} catch {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/libs/infraestructura/storage/language-preference.storage.ts
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
return
|
|
42
|
+
var m = "starter-react-ui:language-preference:v1";
|
|
43
|
+
function h(e, t) {
|
|
44
|
+
return f(m, e, t);
|
|
45
45
|
}
|
|
46
|
-
async function
|
|
47
|
-
let n = await
|
|
46
|
+
async function g(e, t) {
|
|
47
|
+
let n = await p(m, t);
|
|
48
48
|
if (n !== void 0 && e.includes(n)) return n;
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/libs/infraestructura/storage/theme-preference.storage.ts
|
|
52
|
-
var
|
|
53
|
-
function
|
|
54
|
-
return
|
|
52
|
+
var _ = "starter-react-ui:theme-preference:v1";
|
|
53
|
+
function ee(e, t) {
|
|
54
|
+
return f(_, e, t);
|
|
55
55
|
}
|
|
56
|
-
async function
|
|
57
|
-
let n = await
|
|
56
|
+
async function te(e, t) {
|
|
57
|
+
let n = await p(_, t);
|
|
58
58
|
if (n !== void 0) return e.find((e) => e.name === n)?.name;
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
@@ -69,73 +69,73 @@ function v(e, t, n) {
|
|
|
69
69
|
function y(e, t) {
|
|
70
70
|
return e.translations === t.translations && e.initialLanguage === t.initialLanguage && e.fallbackLanguage === t.fallbackLanguage && e.languageEncryptionKey === t.languageEncryptionKey && e.languages === t.languages;
|
|
71
71
|
}
|
|
72
|
-
async function
|
|
72
|
+
async function ne(e) {
|
|
73
73
|
try {
|
|
74
|
-
return await
|
|
74
|
+
return await g(e.languages, e.languageEncryptionKey);
|
|
75
75
|
} catch {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function re(e, t) {
|
|
80
80
|
r(() => {
|
|
81
81
|
let n = !0;
|
|
82
82
|
return (async () => {
|
|
83
|
-
let r = await
|
|
83
|
+
let r = await ne(e);
|
|
84
84
|
if (!n) return;
|
|
85
|
-
let i =
|
|
85
|
+
let i = O(e.translations, e.initialLanguage, e.fallbackLanguage);
|
|
86
86
|
t((t) => y(t, e) && t.isLoaded ? t : v(e, r ?? i, !0));
|
|
87
87
|
})(), () => {
|
|
88
88
|
n = !1;
|
|
89
89
|
};
|
|
90
90
|
}, [e, t]);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function ie(e, t, n) {
|
|
93
93
|
r(() => {
|
|
94
|
-
n &&
|
|
94
|
+
n && h(t, e.languageEncryptionKey);
|
|
95
95
|
}, [
|
|
96
96
|
e.languageEncryptionKey,
|
|
97
97
|
t,
|
|
98
98
|
n
|
|
99
99
|
]);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function ae(e, n) {
|
|
102
102
|
return t((t) => {
|
|
103
|
-
|
|
103
|
+
A(e.translations, t), n(v(e, t, !0));
|
|
104
104
|
}, [e, n]);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function oe(e) {
|
|
107
107
|
let [t, n] = a(() => v(e, e.initialLanguage, !1));
|
|
108
|
-
|
|
109
|
-
let r = y(t, e), i = r ? t.selectedLanguage : e.initialLanguage, o = r && t.isLoaded, s =
|
|
108
|
+
re(e, n);
|
|
109
|
+
let r = y(t, e), i = r ? t.selectedLanguage : e.initialLanguage, o = r && t.isLoaded, s = ae(e, n);
|
|
110
110
|
return {
|
|
111
|
-
language:
|
|
111
|
+
language: k(e.translations, i, e.initialLanguage, e.fallbackLanguage),
|
|
112
112
|
isLoaded: o,
|
|
113
113
|
setLanguage: s
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
let
|
|
116
|
+
function se({ translations: e, initialLanguage: t, fallbackLanguage: n = "en", languageEncryptionKey: r, children: a }) {
|
|
117
|
+
let s = i(() => Object.keys(e), [e]), l = i(() => ({
|
|
118
118
|
translations: e,
|
|
119
119
|
initialLanguage: t,
|
|
120
120
|
fallbackLanguage: n,
|
|
121
121
|
languageEncryptionKey: r,
|
|
122
|
-
languages:
|
|
122
|
+
languages: s
|
|
123
123
|
}), [
|
|
124
124
|
e,
|
|
125
125
|
t,
|
|
126
126
|
n,
|
|
127
127
|
r,
|
|
128
|
-
|
|
129
|
-
]), u =
|
|
130
|
-
|
|
131
|
-
let d =
|
|
132
|
-
return /* @__PURE__ */ o(
|
|
128
|
+
s
|
|
129
|
+
]), u = oe(l);
|
|
130
|
+
ie(l, u.language, u.isLoaded);
|
|
131
|
+
let d = ce(l, u);
|
|
132
|
+
return /* @__PURE__ */ o(c.Provider, {
|
|
133
133
|
value: d,
|
|
134
134
|
children: a
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
let r = e.translations[n.language], a = e.translations[e.fallbackLanguage], o = t((e, t) =>
|
|
137
|
+
function ce(e, n) {
|
|
138
|
+
let r = e.translations[n.language], a = e.translations[e.fallbackLanguage], o = t((e, t) => F(r, a, e, t), [r, a]);
|
|
139
139
|
return i(() => ({
|
|
140
140
|
language: n.language,
|
|
141
141
|
languages: e.languages,
|
|
@@ -150,38 +150,38 @@ function oe(e, n) {
|
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/libs/aplicacion/providers/theme-provider.tsx
|
|
153
|
-
var
|
|
154
|
-
let n =
|
|
153
|
+
var le = (e, t) => {
|
|
154
|
+
let n = I(e, t);
|
|
155
155
|
if (n !== void 0) return n;
|
|
156
156
|
if (e.length === 0) throw Error("ThemeProvider requires at least one theme.");
|
|
157
157
|
return e[0];
|
|
158
|
-
},
|
|
158
|
+
}, ue = (e, t) => e.some((e) => e.name === t.name) ? e.map((e) => e.name === t.name ? t : e) : [...e, t], de = (e, t, n, r) => ({
|
|
159
159
|
theme: e,
|
|
160
160
|
themeName: e.name,
|
|
161
161
|
themes: t,
|
|
162
162
|
setTheme: n,
|
|
163
163
|
registerTheme: r
|
|
164
|
-
}),
|
|
165
|
-
let [
|
|
166
|
-
|
|
164
|
+
}), fe = ({ themes: e, initialTheme: n, children: s }) => {
|
|
165
|
+
let [c, u] = a([]), d = i(() => [...e, ...c], [e, c]), [f, p] = a(() => R(e, n)), m = i(() => le(d, f), [d, f]), h = t((e) => {
|
|
166
|
+
Q.register(e), u((t) => ue(t, e));
|
|
167
167
|
}, []), g = t((e) => {
|
|
168
|
-
let t =
|
|
169
|
-
t !== void 0 && (
|
|
168
|
+
let t = I(d, e);
|
|
169
|
+
t !== void 0 && (L(t) && Q.register(t), p(t.name));
|
|
170
170
|
}, [d]);
|
|
171
171
|
r(() => {
|
|
172
|
-
|
|
172
|
+
z(m.name), B(m.name);
|
|
173
173
|
}, [m.name]);
|
|
174
|
-
let _ = i(() =>
|
|
174
|
+
let _ = i(() => de(m, d, g, h), [
|
|
175
175
|
m,
|
|
176
176
|
d,
|
|
177
177
|
g,
|
|
178
178
|
h
|
|
179
179
|
]);
|
|
180
|
-
return /* @__PURE__ */ o(
|
|
180
|
+
return /* @__PURE__ */ o(l.Provider, {
|
|
181
181
|
value: _,
|
|
182
182
|
children: s
|
|
183
183
|
});
|
|
184
|
-
},
|
|
184
|
+
}, b = Object.freeze({ INTERPOLATION_PLACEHOLDER: String.raw`\{\{([a-zA-Z0-9_]+)\}\}` }), pe = "g", x = "AES-GCM", me = 12, S = "SHA-256", he = "raw", C = ".", w = ["encrypt", "decrypt"], ge = 2, T = {
|
|
185
185
|
primary: "--color-primary",
|
|
186
186
|
primaryContent: "--color-primary-content",
|
|
187
187
|
secondary: "--color-secondary",
|
|
@@ -202,28 +202,28 @@ var se = (e, t) => {
|
|
|
202
202
|
warningContent: "--color-warning-content",
|
|
203
203
|
error: "--color-error",
|
|
204
204
|
errorContent: "--color-error-content"
|
|
205
|
-
},
|
|
206
|
-
["primary",
|
|
207
|
-
["primaryContent",
|
|
208
|
-
["secondary",
|
|
209
|
-
["secondaryContent",
|
|
210
|
-
["accent",
|
|
211
|
-
["accentContent",
|
|
212
|
-
["neutral",
|
|
213
|
-
["neutralContent",
|
|
214
|
-
["base100",
|
|
215
|
-
["base200",
|
|
216
|
-
["base300",
|
|
217
|
-
["baseContent",
|
|
218
|
-
["info",
|
|
219
|
-
["infoContent",
|
|
220
|
-
["success",
|
|
221
|
-
["successContent",
|
|
222
|
-
["warning",
|
|
223
|
-
["warningContent",
|
|
224
|
-
["error",
|
|
225
|
-
["errorContent",
|
|
226
|
-
],
|
|
205
|
+
}, E = [
|
|
206
|
+
["primary", T.primary],
|
|
207
|
+
["primaryContent", T.primaryContent],
|
|
208
|
+
["secondary", T.secondary],
|
|
209
|
+
["secondaryContent", T.secondaryContent],
|
|
210
|
+
["accent", T.accent],
|
|
211
|
+
["accentContent", T.accentContent],
|
|
212
|
+
["neutral", T.neutral],
|
|
213
|
+
["neutralContent", T.neutralContent],
|
|
214
|
+
["base100", T.base100],
|
|
215
|
+
["base200", T.base200],
|
|
216
|
+
["base300", T.base300],
|
|
217
|
+
["baseContent", T.baseContent],
|
|
218
|
+
["info", T.info],
|
|
219
|
+
["infoContent", T.infoContent],
|
|
220
|
+
["success", T.success],
|
|
221
|
+
["successContent", T.successContent],
|
|
222
|
+
["warning", T.warning],
|
|
223
|
+
["warningContent", T.warningContent],
|
|
224
|
+
["error", T.error],
|
|
225
|
+
["errorContent", T.errorContent]
|
|
226
|
+
], _e = {
|
|
227
227
|
THIN: 100,
|
|
228
228
|
EXTRA_LIGHT: 200,
|
|
229
229
|
LIGHT: 300,
|
|
@@ -236,27 +236,27 @@ var se = (e, t) => {
|
|
|
236
236
|
};
|
|
237
237
|
//#endregion
|
|
238
238
|
//#region src/libs/aplicacion/utils/translation.utils.ts
|
|
239
|
-
function
|
|
239
|
+
function D(e, t) {
|
|
240
240
|
return Object.hasOwn(e, t);
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function ve(e) {
|
|
243
243
|
let [t] = Object.keys(e);
|
|
244
244
|
return t;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
if (
|
|
248
|
-
if (
|
|
249
|
-
let r =
|
|
246
|
+
function O(e, t, n) {
|
|
247
|
+
if (D(e, t)) return t;
|
|
248
|
+
if (D(e, n)) return n;
|
|
249
|
+
let r = ve(e);
|
|
250
250
|
if (r === void 0) throw Error("TranslateProvider requires at least one translation catalog.");
|
|
251
251
|
return r;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
return
|
|
253
|
+
function k(e, t, n, r) {
|
|
254
|
+
return D(e, t) ? t : O(e, n, r);
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
if (!
|
|
256
|
+
function A(e, t) {
|
|
257
|
+
if (!D(e, t)) throw Error(`Language "${t}" is not available in the translation catalog.`);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function ye(e, t) {
|
|
260
260
|
let n = e;
|
|
261
261
|
for (let e of t.split(".")) {
|
|
262
262
|
if (typeof n == "string" || !Object.hasOwn(n, e)) return;
|
|
@@ -264,43 +264,43 @@ function _e(e, t) {
|
|
|
264
264
|
}
|
|
265
265
|
return n;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function j(e, t) {
|
|
268
268
|
if (e === void 0 || t === "") return;
|
|
269
|
-
let n =
|
|
269
|
+
let n = ye(e, t);
|
|
270
270
|
return typeof n == "string" ? n : void 0;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function M(e, t, n) {
|
|
273
273
|
let r = n?.[t];
|
|
274
274
|
return r === void 0 ? e : String(r);
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
let n = new RegExp(
|
|
278
|
-
return e.replace(n, (e, n) =>
|
|
276
|
+
function N(e, t) {
|
|
277
|
+
let n = new RegExp(b.INTERPOLATION_PLACEHOLDER, "g");
|
|
278
|
+
return e.replace(n, (e, n) => M(e, n, t));
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
let r =
|
|
282
|
-
return r === void 0 ?
|
|
280
|
+
function P(e, t, n) {
|
|
281
|
+
let r = j(e, n);
|
|
282
|
+
return r === void 0 ? j(t, n) ?? n : r;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
return P(
|
|
284
|
+
function F(e, t, n, r) {
|
|
285
|
+
return N(P(e, t, n), r);
|
|
286
286
|
}
|
|
287
287
|
//#endregion
|
|
288
288
|
//#region src/libs/aplicacion/utils/theme.utils.ts
|
|
289
|
-
var
|
|
289
|
+
var I = (e, t) => e.find((e) => e.name === t), L = (e) => "daisyUI" in e, R = (e, t) => {
|
|
290
290
|
if (typeof window < "u") {
|
|
291
291
|
let t = window.localStorage.getItem("app_theme");
|
|
292
|
-
if (t !== null && t.length > 0 &&
|
|
292
|
+
if (t !== null && t.length > 0 && I(e, t) !== void 0) return t;
|
|
293
293
|
}
|
|
294
|
-
let n =
|
|
294
|
+
let n = I(e, t);
|
|
295
295
|
return n === void 0 ? e.length === 0 ? t : e[0].name : n.name;
|
|
296
|
-
},
|
|
296
|
+
}, z = (e) => {
|
|
297
297
|
typeof document < "u" && document.documentElement.setAttribute("data-theme", e);
|
|
298
|
-
},
|
|
298
|
+
}, B = (e) => {
|
|
299
299
|
typeof window < "u" && window.localStorage.setItem("app_theme", e);
|
|
300
300
|
};
|
|
301
301
|
//#endregion
|
|
302
302
|
//#region src/libs/aplicacion/utils/crypto-api.util.ts
|
|
303
|
-
function
|
|
303
|
+
function V() {
|
|
304
304
|
try {
|
|
305
305
|
return globalThis.crypto;
|
|
306
306
|
} catch {
|
|
@@ -309,7 +309,7 @@ function H() {
|
|
|
309
309
|
}
|
|
310
310
|
//#endregion
|
|
311
311
|
//#region src/libs/aplicacion/utils/storage-api.util.ts
|
|
312
|
-
function
|
|
312
|
+
function H() {
|
|
313
313
|
try {
|
|
314
314
|
return globalThis.localStorage;
|
|
315
315
|
} catch {
|
|
@@ -318,104 +318,104 @@ function U() {
|
|
|
318
318
|
}
|
|
319
319
|
//#endregion
|
|
320
320
|
//#region src/libs/aplicacion/utils/text-encoding.util.ts
|
|
321
|
-
function
|
|
321
|
+
function U(e) {
|
|
322
322
|
return new TextEncoder().encode(e);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function W(e) {
|
|
325
325
|
return new TextDecoder().decode(e);
|
|
326
326
|
}
|
|
327
327
|
//#endregion
|
|
328
328
|
//#region src/libs/aplicacion/utils/base64.util.ts
|
|
329
|
-
function
|
|
329
|
+
function G(e) {
|
|
330
330
|
let t = "";
|
|
331
331
|
for (let n of e) t += String.fromCharCode(n);
|
|
332
332
|
return btoa(t);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function K(e) {
|
|
335
335
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
336
336
|
for (let e = 0; e < t.length; e += 1) n[e] = t.charCodeAt(e);
|
|
337
337
|
return n;
|
|
338
338
|
}
|
|
339
339
|
//#endregion
|
|
340
340
|
//#region src/libs/aplicacion/services/encryption.service.ts
|
|
341
|
-
async function
|
|
342
|
-
let t =
|
|
341
|
+
async function q(e) {
|
|
342
|
+
let t = V();
|
|
343
343
|
if (t === void 0 || e.length === 0) return;
|
|
344
|
-
let n = await t.subtle.digest(
|
|
345
|
-
return t.subtle.importKey("raw", n, { name:
|
|
344
|
+
let n = await t.subtle.digest(S, U(e));
|
|
345
|
+
return t.subtle.importKey("raw", n, { name: x }, !1, w);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
348
|
-
let e =
|
|
347
|
+
function be() {
|
|
348
|
+
let e = V();
|
|
349
349
|
if (e === void 0) throw Error("Cryptographic API is unavailable.");
|
|
350
350
|
return e.getRandomValues(/* @__PURE__ */ new Uint8Array(12));
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function xe(e) {
|
|
353
353
|
try {
|
|
354
|
-
let t =
|
|
354
|
+
let t = K(e);
|
|
355
355
|
return t.length === 12 ? t : void 0;
|
|
356
356
|
} catch {
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Se(e) {
|
|
361
361
|
return e.length === 2;
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
if (
|
|
363
|
+
function Ce(e) {
|
|
364
|
+
if (Se(e)) return [e[0], e[1]];
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
let t =
|
|
366
|
+
function we(e) {
|
|
367
|
+
let t = Ce(e.split("."));
|
|
368
368
|
if (t === void 0) return;
|
|
369
|
-
let [n, r] = t, i =
|
|
369
|
+
let [n, r] = t, i = xe(n);
|
|
370
370
|
if (i !== void 0) try {
|
|
371
371
|
return {
|
|
372
372
|
iv: i,
|
|
373
|
-
ciphertext:
|
|
373
|
+
ciphertext: K(r)
|
|
374
374
|
};
|
|
375
375
|
} catch {
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
async function
|
|
380
|
-
return
|
|
381
|
-
name:
|
|
379
|
+
async function Te(e, t, n) {
|
|
380
|
+
return J().subtle.encrypt({
|
|
381
|
+
name: x,
|
|
382
382
|
iv: n
|
|
383
383
|
}, t, e);
|
|
384
384
|
}
|
|
385
|
-
async function
|
|
386
|
-
return
|
|
387
|
-
name:
|
|
385
|
+
async function Ee(e, t) {
|
|
386
|
+
return J().subtle.decrypt({
|
|
387
|
+
name: x,
|
|
388
388
|
iv: e.iv
|
|
389
389
|
}, t, e.ciphertext);
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
let e =
|
|
391
|
+
function J() {
|
|
392
|
+
let e = V();
|
|
393
393
|
if (e === void 0) throw Error("Cryptographic API is unavailable.");
|
|
394
394
|
return e;
|
|
395
395
|
}
|
|
396
|
-
async function
|
|
396
|
+
async function Y(e, t) {
|
|
397
397
|
try {
|
|
398
|
-
let n = await
|
|
398
|
+
let n = await q(t);
|
|
399
399
|
if (n === void 0) return;
|
|
400
|
-
let r =
|
|
401
|
-
return [
|
|
400
|
+
let r = be(), i = await Te(U(e), n, r);
|
|
401
|
+
return [G(r), G(new Uint8Array(i))].join(".");
|
|
402
402
|
} catch {
|
|
403
403
|
return;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
async function
|
|
406
|
+
async function X(e, t) {
|
|
407
407
|
try {
|
|
408
|
-
let n =
|
|
408
|
+
let n = we(e);
|
|
409
409
|
if (n === void 0) return;
|
|
410
|
-
let r = await
|
|
411
|
-
return r === void 0 ? void 0 :
|
|
410
|
+
let r = await q(t);
|
|
411
|
+
return r === void 0 ? void 0 : W(await Ee(n, r));
|
|
412
412
|
} catch {
|
|
413
413
|
return;
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
417
|
//#region src/libs/aplicacion/services/custom-theme.service.ts
|
|
418
|
-
var
|
|
418
|
+
var Z = class e {
|
|
419
419
|
static STYLE_ID_PREFIX = "daisyui-custom-theme-";
|
|
420
420
|
register(e) {
|
|
421
421
|
this.validateThemeName(e.name);
|
|
@@ -432,7 +432,7 @@ var Q = class e {
|
|
|
432
432
|
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(e)) throw Error(`Invalid theme name: ${e}`);
|
|
433
433
|
}
|
|
434
434
|
createColorDeclarations(e) {
|
|
435
|
-
return
|
|
435
|
+
return E.map(([t, n]) => {
|
|
436
436
|
let r = e.daisyUI[t];
|
|
437
437
|
return this.validateCssColor(t, r), `${n}: ${r};`;
|
|
438
438
|
}).join("\n");
|
|
@@ -458,16 +458,206 @@ var Q = class e {
|
|
|
458
458
|
getStyleElementId(t) {
|
|
459
459
|
return `${e.STYLE_ID_PREFIX}${t}`;
|
|
460
460
|
}
|
|
461
|
-
},
|
|
462
|
-
let { t: r } =
|
|
461
|
+
}, Q = new Z(), De = ({ label: e, className: t = "", ...n }) => {
|
|
462
|
+
let { t: r } = u();
|
|
463
463
|
return /* @__PURE__ */ o("button", {
|
|
464
464
|
...n,
|
|
465
465
|
type: n.type ?? "button",
|
|
466
466
|
className: `btn btn-primary ${t}`,
|
|
467
467
|
children: e ?? r("common.button")
|
|
468
468
|
});
|
|
469
|
+
}, $ = ({ theme: e, isOpen: t, onToggle: n }) => /* @__PURE__ */ s("button", {
|
|
470
|
+
type: "button",
|
|
471
|
+
"aria-haspopup": "listbox",
|
|
472
|
+
"aria-expanded": t,
|
|
473
|
+
onClick: n,
|
|
474
|
+
className: "flex w-full items-center gap-3 rounded-2xl border border-base-300 bg-base-100 p-3 text-left shadow-sm transition hover:border-primary/50 hover:shadow-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
475
|
+
children: [
|
|
476
|
+
/* @__PURE__ */ o("span", {
|
|
477
|
+
"data-theme": e.name,
|
|
478
|
+
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-primary text-primary-content shadow-sm",
|
|
479
|
+
children: /* @__PURE__ */ o("span", {
|
|
480
|
+
className: "text-lg font-bold",
|
|
481
|
+
children: e.manifest.name.charAt(0).toUpperCase()
|
|
482
|
+
})
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ s("span", {
|
|
485
|
+
className: "min-w-0 flex-1",
|
|
486
|
+
children: [/* @__PURE__ */ o("span", {
|
|
487
|
+
className: "block truncate font-semibold text-base-content",
|
|
488
|
+
children: e.manifest.name
|
|
489
|
+
}), /* @__PURE__ */ o("span", {
|
|
490
|
+
className: "block text-xs text-base-content/60",
|
|
491
|
+
children: "Tema seleccionado"
|
|
492
|
+
})]
|
|
493
|
+
}),
|
|
494
|
+
/* @__PURE__ */ o("svg", {
|
|
495
|
+
"aria-hidden": "true",
|
|
496
|
+
viewBox: "0 0 24 24",
|
|
497
|
+
fill: "none",
|
|
498
|
+
stroke: "currentColor",
|
|
499
|
+
strokeWidth: "2",
|
|
500
|
+
className: `h-5 w-5 shrink-0 transition-transform ${t ? "rotate-180" : ""}`,
|
|
501
|
+
children: /* @__PURE__ */ o("path", {
|
|
502
|
+
d: "m6 9 6 6 6-6",
|
|
503
|
+
strokeLinecap: "round",
|
|
504
|
+
strokeLinejoin: "round"
|
|
505
|
+
})
|
|
506
|
+
})
|
|
507
|
+
]
|
|
508
|
+
}), Oe = ({ value: e, placeholder: t, onChange: n }) => /* @__PURE__ */ s("label", {
|
|
509
|
+
className: "input input-bordered flex w-full items-center gap-2 rounded-xl",
|
|
510
|
+
children: [/* @__PURE__ */ s("svg", {
|
|
511
|
+
"aria-hidden": "true",
|
|
512
|
+
viewBox: "0 0 24 24",
|
|
513
|
+
fill: "none",
|
|
514
|
+
stroke: "currentColor",
|
|
515
|
+
strokeWidth: "2",
|
|
516
|
+
className: "h-4 w-4 opacity-60",
|
|
517
|
+
children: [/* @__PURE__ */ o("circle", {
|
|
518
|
+
cx: "11",
|
|
519
|
+
cy: "11",
|
|
520
|
+
r: "7"
|
|
521
|
+
}), /* @__PURE__ */ o("path", {
|
|
522
|
+
d: "m16 16 4 4",
|
|
523
|
+
strokeLinecap: "round"
|
|
524
|
+
})]
|
|
525
|
+
}), /* @__PURE__ */ o("input", {
|
|
526
|
+
type: "search",
|
|
527
|
+
value: e,
|
|
528
|
+
onChange: (e) => n(e.target.value),
|
|
529
|
+
placeholder: t,
|
|
530
|
+
"aria-label": t,
|
|
531
|
+
className: "grow"
|
|
532
|
+
})]
|
|
533
|
+
}), ke = ({ theme: e, isSelected: t, showDescription: n, onSelect: r }) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ s("button", {
|
|
534
|
+
type: "button",
|
|
535
|
+
role: "option",
|
|
536
|
+
"aria-selected": t,
|
|
537
|
+
onClick: () => r(e.name),
|
|
538
|
+
className: `flex w-full items-center gap-3 rounded-xl p-3 text-left transition ${t ? "bg-primary/10 text-primary" : "text-base-content hover:bg-base-200"}`,
|
|
539
|
+
children: [
|
|
540
|
+
/* @__PURE__ */ s("span", {
|
|
541
|
+
"data-theme": e.name,
|
|
542
|
+
className: "flex h-10 w-10 shrink-0 items-center justify-center gap-1 overflow-hidden rounded-xl border border-base-300 bg-base-100 p-1",
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ o("span", { className: "h-full w-2 rounded-full bg-primary" }),
|
|
545
|
+
/* @__PURE__ */ o("span", { className: "h-full w-2 rounded-full bg-secondary" }),
|
|
546
|
+
/* @__PURE__ */ o("span", { className: "h-full w-2 rounded-full bg-accent" })
|
|
547
|
+
]
|
|
548
|
+
}),
|
|
549
|
+
/* @__PURE__ */ s("span", {
|
|
550
|
+
className: "min-w-0 flex-1",
|
|
551
|
+
children: [/* @__PURE__ */ o("span", {
|
|
552
|
+
className: "block truncate text-sm font-semibold",
|
|
553
|
+
children: e.manifest.name
|
|
554
|
+
}), n && /* @__PURE__ */ o("span", {
|
|
555
|
+
className: "mt-0.5 block truncate text-xs text-base-content/60",
|
|
556
|
+
children: e.manifest.description
|
|
557
|
+
})]
|
|
558
|
+
}),
|
|
559
|
+
t && /* @__PURE__ */ o("svg", {
|
|
560
|
+
"aria-hidden": "true",
|
|
561
|
+
viewBox: "0 0 24 24",
|
|
562
|
+
fill: "none",
|
|
563
|
+
stroke: "currentColor",
|
|
564
|
+
strokeWidth: "2.5",
|
|
565
|
+
className: "h-5 w-5 shrink-0",
|
|
566
|
+
children: /* @__PURE__ */ o("path", {
|
|
567
|
+
d: "m5 12 4 4L19 6",
|
|
568
|
+
strokeLinecap: "round",
|
|
569
|
+
strokeLinejoin: "round"
|
|
570
|
+
})
|
|
571
|
+
})
|
|
572
|
+
]
|
|
573
|
+
}) }), Ae = ({ themes: e, selectedTheme: t, showDescriptions: n, label: r, onSelect: i }) => /* @__PURE__ */ s("ul", {
|
|
574
|
+
role: "listbox",
|
|
575
|
+
"aria-label": r,
|
|
576
|
+
className: "max-h-72 space-y-1 overflow-y-auto p-2",
|
|
577
|
+
children: [e.map((e) => /* @__PURE__ */ o(ke, {
|
|
578
|
+
theme: e,
|
|
579
|
+
isSelected: e.name === t,
|
|
580
|
+
showDescription: n,
|
|
581
|
+
onSelect: i
|
|
582
|
+
}, e.name)), e.length === 0 && /* @__PURE__ */ o("li", {
|
|
583
|
+
className: "px-3 py-8 text-center text-sm text-base-content/60",
|
|
584
|
+
children: "No se encontraron temas."
|
|
585
|
+
})]
|
|
586
|
+
}), je = ({ themes: e, totalThemes: t, selectedTheme: n, search: r, showSearch: i, placeholder: a, label: c, showDescriptions: l, onSearchChange: u, onSelectTheme: d }) => /* @__PURE__ */ s("div", {
|
|
587
|
+
className: "absolute left-0 right-0 top-full z-50 mt-2 overflow-hidden rounded-2xl border border-base-300 bg-base-100 shadow-xl",
|
|
588
|
+
children: [
|
|
589
|
+
/* @__PURE__ */ s("div", {
|
|
590
|
+
className: "border-b border-base-300 p-3",
|
|
591
|
+
children: [/* @__PURE__ */ o("p", {
|
|
592
|
+
className: "mb-2 text-xs font-semibold uppercase tracking-wider text-base-content/60",
|
|
593
|
+
children: "Selecciona un tema"
|
|
594
|
+
}), i && /* @__PURE__ */ o(Oe, {
|
|
595
|
+
value: r,
|
|
596
|
+
placeholder: a,
|
|
597
|
+
onChange: u
|
|
598
|
+
})]
|
|
599
|
+
}),
|
|
600
|
+
/* @__PURE__ */ o(Ae, {
|
|
601
|
+
themes: e,
|
|
602
|
+
selectedTheme: n,
|
|
603
|
+
showDescriptions: l,
|
|
604
|
+
label: c,
|
|
605
|
+
onSelect: d
|
|
606
|
+
}),
|
|
607
|
+
/* @__PURE__ */ o("div", {
|
|
608
|
+
className: "border-t border-base-300 px-3 py-2",
|
|
609
|
+
children: /* @__PURE__ */ s("p", {
|
|
610
|
+
className: "text-xs text-base-content/50",
|
|
611
|
+
children: [
|
|
612
|
+
e.length,
|
|
613
|
+
" de ",
|
|
614
|
+
t,
|
|
615
|
+
" temas"
|
|
616
|
+
]
|
|
617
|
+
})
|
|
618
|
+
})
|
|
619
|
+
]
|
|
620
|
+
}), Me = 5, Ne = (e, t) => {
|
|
621
|
+
let n = t.trim().toLocaleLowerCase();
|
|
622
|
+
return e.filter((e) => [
|
|
623
|
+
e.name,
|
|
624
|
+
e.manifest.name,
|
|
625
|
+
e.manifest.description
|
|
626
|
+
].some((e) => e.toLocaleLowerCase().includes(n)));
|
|
627
|
+
}, Pe = ({ label: e = "Tema visual", placeholder: t = "Buscar tema...", className: n = "", showDescriptions: r = !0 }) => {
|
|
628
|
+
let { theme: i, themes: c, setTheme: l } = d(), [u, f] = a(!1), [p, m] = a(""), h = Ne(c, p);
|
|
629
|
+
return /* @__PURE__ */ s("div", {
|
|
630
|
+
className: `relative w-full max-w-sm ${n}`,
|
|
631
|
+
children: [
|
|
632
|
+
/* @__PURE__ */ o("label", {
|
|
633
|
+
className: "mb-2 block text-sm font-semibold text-base-content",
|
|
634
|
+
children: e
|
|
635
|
+
}),
|
|
636
|
+
/* @__PURE__ */ o($, {
|
|
637
|
+
theme: i,
|
|
638
|
+
isOpen: u,
|
|
639
|
+
onToggle: () => {
|
|
640
|
+
f((e) => !e), m("");
|
|
641
|
+
}
|
|
642
|
+
}),
|
|
643
|
+
u && /* @__PURE__ */ o(je, {
|
|
644
|
+
themes: h,
|
|
645
|
+
totalThemes: c.length,
|
|
646
|
+
selectedTheme: i.name,
|
|
647
|
+
search: p,
|
|
648
|
+
showSearch: c.length > Me,
|
|
649
|
+
placeholder: t,
|
|
650
|
+
label: e,
|
|
651
|
+
showDescriptions: r,
|
|
652
|
+
onSearchChange: m,
|
|
653
|
+
onSelectTheme: (e) => {
|
|
654
|
+
l(e), f(!1), m("");
|
|
655
|
+
}
|
|
656
|
+
})
|
|
657
|
+
]
|
|
658
|
+
});
|
|
469
659
|
};
|
|
470
660
|
//#endregion
|
|
471
|
-
export {
|
|
661
|
+
export { x as AES_GCM_ALGORITHM, me as AES_GCM_IV_LENGTH, De as Button, T as CSS_THEME_TOKENS, E as CSS_THEME_TOKEN_ENTRIES, Z as CustomThemeService, ge as ENCRYPTED_VALUE_PART_COUNT, pe as GLOBAL_REGEX_FLAG, w as KEY_USAGES, he as RAW_KEY_FORMAT, S as SHA_256_ALGORITHM, C as STORAGE_VALUE_SEPARATOR, _e as THEME_FONT_WEIGHT, l as ThemeContext, fe as ThemeProvider, Pe as ThemeSelector, c as TranslateContext, se as TranslateProvider, b as TranslationRegex, z as applyThemeToDocument, A as assertLanguageExists, Q as customThemeService, K as decodeBase64, W as decodeText, X as decryptText, G as encodeBase64, U as encodeText, Y as encryptText, I as findThemeByName, j as findTranslation, V as getCryptoApi, H as getLocalStorage, N as interpolateTranslation, L as isCustomThemeDefinition, p as loadEncryptedPreference, g as loadLanguagePreference, te as loadThemePreference, B as persistTheme, k as resolveActiveLanguage, O as resolveInitialLanguage, R as resolveInitialTheme, f as saveEncryptedPreference, h as saveLanguagePreference, ee as saveThemePreference, F as translateMessage, u as useLanguage, d as useTheme };
|
|
472
662
|
|
|
473
663
|
//# sourceMappingURL=index.js.map
|