@shellui/core 0.0.4 → 0.0.6

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 (35) hide show
  1. package/dist/components/ui/sidebar.d.ts.map +1 -1
  2. package/dist/features/layouts/DefaultLayout.d.ts.map +1 -1
  3. package/dist/index.js +6795 -9
  4. package/dist/index.js.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +4 -3
  7. package/src/components/ui/sidebar.tsx +43 -5
  8. package/src/features/layouts/DefaultLayout.tsx +22 -6
  9. package/src/index.css +5 -0
  10. package/dist/ContentView-CZG-ro_B.js +0 -146
  11. package/dist/ContentView-CZG-ro_B.js.map +0 -1
  12. package/dist/CookiePreferencesView-MhO9FO-4.js +0 -213
  13. package/dist/CookiePreferencesView-MhO9FO-4.js.map +0 -1
  14. package/dist/DefaultLayout-Dbb3uJED.js +0 -394
  15. package/dist/DefaultLayout-Dbb3uJED.js.map +0 -1
  16. package/dist/FullscreenLayout-1SgPHWw-.js +0 -30
  17. package/dist/FullscreenLayout-1SgPHWw-.js.map +0 -1
  18. package/dist/HomeView-DYU-O_Il.js +0 -21
  19. package/dist/HomeView-DYU-O_Il.js.map +0 -1
  20. package/dist/NotFoundView-CeYjJNg0.js +0 -52
  21. package/dist/NotFoundView-CeYjJNg0.js.map +0 -1
  22. package/dist/OverlayShell-pzbqQW25.js +0 -642
  23. package/dist/OverlayShell-pzbqQW25.js.map +0 -1
  24. package/dist/SettingsView-Bndrta44.js +0 -2207
  25. package/dist/SettingsView-Bndrta44.js.map +0 -1
  26. package/dist/ViewRoute-ChSPabOy.js +0 -32
  27. package/dist/ViewRoute-ChSPabOy.js.map +0 -1
  28. package/dist/WindowsLayout-CXGNPKoY.js +0 -633
  29. package/dist/WindowsLayout-CXGNPKoY.js.map +0 -1
  30. package/dist/index-lmRk5L6z.js +0 -2160
  31. package/dist/index-lmRk5L6z.js.map +0 -1
  32. package/dist/sidebar-ClIeZ2zb.js +0 -303
  33. package/dist/sidebar-ClIeZ2zb.js.map +0 -1
  34. package/dist/switch-8SzUJz7Q.js +0 -44
  35. package/dist/switch-8SzUJz7Q.js.map +0 -1
@@ -1,213 +0,0 @@
1
- import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
- import { useMemo as b, useState as B, useRef as T, useEffect as H, useCallback as g } from "react";
3
- import { useTranslation as $ } from "react-i18next";
4
- import { useLocation as F } from "react-router";
5
- import { shellui as y } from "@shellui/sdk";
6
- import { u as I, a as U, r as G, B as S } from "./index-lmRk5L6z.js";
7
- import { S as w } from "./switch-8SzUJz7Q.js";
8
- const V = [
9
- "strict_necessary",
10
- "functional_performance",
11
- "targeting",
12
- "social_media_embedded"
13
- ];
14
- function W(t, f) {
15
- return t < 60 ? f("preferences.duration.seconds", { count: t }) : t < 3600 ? f("preferences.duration.minutes", { count: Math.floor(t / 60) }) : t < 86400 ? f("preferences.duration.hours", { count: Math.floor(t / 3600) }) : t < 31536e3 ? f("preferences.duration.days", { count: Math.floor(t / 86400) }) : f("preferences.duration.years", { count: Math.floor(t / 31536e3) });
16
- }
17
- function te() {
18
- const { t, i18n: f } = $("cookieConsent"), { config: A } = I(), { settings: x, updateSetting: d } = U(), L = F(), m = new URLSearchParams(L.search).get("initial") === "true", _ = f.language || "en", p = A?.cookieConsent?.cookies ?? [], a = b(() => p.map((e) => e.host), [p]), i = b(
19
- () => p.filter((e) => e.category === "strict_necessary").map((e) => e.host),
20
- [p]
21
- ), h = x?.cookieConsent?.acceptedHosts ?? [], [u, k] = B(() => [
22
- .../* @__PURE__ */ new Set([...h, ...i])
23
- ]), C = T(!1);
24
- H(() => {
25
- m && k([.../* @__PURE__ */ new Set([...h, ...i])]);
26
- }, [m, h, i]), H(() => {
27
- if (!m) return;
28
- const e = () => {
29
- (x?.cookieConsent?.consentedCookieHosts ?? []).length === 0 && !C.current && d("cookieConsent", {
30
- acceptedHosts: i,
31
- consentedCookieHosts: a
32
- });
33
- };
34
- return y.addMessageListener("SHELLUI_CLOSE_DRAWER", e);
35
- }, [m, i, a, d, x]), H(() => () => {
36
- m && !C.current && (x?.cookieConsent?.consentedCookieHosts ?? []).length === 0 && d("cookieConsent", {
37
- acceptedHosts: i,
38
- consentedCookieHosts: a
39
- });
40
- }, [m, i, a, d, x]);
41
- const N = b(() => {
42
- const e = /* @__PURE__ */ new Map();
43
- for (const s of p) {
44
- const r = e.get(s.category) ?? [];
45
- e.set(s.category, [...r, s]);
46
- }
47
- return e;
48
- }, [p]), R = g((e, s) => {
49
- k((r) => s ? [...r, e] : r.filter((o) => o !== e));
50
- }, []), j = g(
51
- (e, s) => {
52
- const r = N.get(e)?.map((o) => o.host) ?? [];
53
- k((o) => {
54
- if (s)
55
- return [.../* @__PURE__ */ new Set([...o, ...r])];
56
- {
57
- const c = new Set(r);
58
- return o.filter((v) => !c.has(v));
59
- }
60
- });
61
- },
62
- [N]
63
- ), D = g(
64
- (e) => {
65
- const s = N.get(e)?.map((o) => o.host) ?? [];
66
- if (s.length === 0) return "none";
67
- const r = s.filter((o) => u.includes(o)).length;
68
- return r === s.length ? "all" : r > 0 ? "some" : "none";
69
- },
70
- [N, u]
71
- ), E = g(() => {
72
- C.current = !0, d("cookieConsent", {
73
- acceptedHosts: a,
74
- consentedCookieHosts: a
75
- }), y.closeDrawer();
76
- }, [a, d]), M = g(() => {
77
- C.current = !0, d("cookieConsent", {
78
- acceptedHosts: i,
79
- consentedCookieHosts: a
80
- }), y.closeDrawer();
81
- }, [i, a, d]), z = g(() => {
82
- C.current = !0;
83
- const e = [.../* @__PURE__ */ new Set([...u, ...i])];
84
- d("cookieConsent", {
85
- acceptedHosts: e,
86
- consentedCookieHosts: a
87
- }), y.closeDrawer();
88
- }, [u, i, a, d]), O = b(() => {
89
- if (u.length !== h.length) return !0;
90
- const e = [...u].sort(), s = [...h].sort();
91
- return e.some((r, o) => r !== s[o]);
92
- }, [u, h]);
93
- return p.length === 0 ? /* @__PURE__ */ n("div", { className: "flex items-center justify-center h-full p-6", children: /* @__PURE__ */ n("p", { className: "text-muted-foreground", children: t("preferences.noCookies") }) }) : /* @__PURE__ */ l("div", { className: "flex flex-col h-full bg-background", children: [
94
- /* @__PURE__ */ l("div", { className: "flex flex-col space-y-2 border-b border-border/60 px-6 pt-5 pb-4", children: [
95
- /* @__PURE__ */ n(
96
- "h2",
97
- {
98
- className: "text-lg font-semibold leading-none tracking-tight",
99
- style: { fontFamily: "var(--heading-font-family, inherit)" },
100
- children: t("preferences.title")
101
- }
102
- ),
103
- /* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: t("preferences.description") })
104
- ] }),
105
- /* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-6 py-4", children: V.map((e) => {
106
- const s = N.get(e);
107
- if (!s || s.length === 0) return null;
108
- const r = D(e), o = e === "strict_necessary";
109
- return /* @__PURE__ */ l(
110
- "div",
111
- {
112
- className: "mb-6 last:mb-0",
113
- children: [
114
- /* @__PURE__ */ l("div", { className: "flex items-center justify-between mb-3", children: [
115
- /* @__PURE__ */ l("div", { className: "flex-1 min-w-0", children: [
116
- /* @__PURE__ */ n(
117
- "h3",
118
- {
119
- className: "text-sm font-semibold",
120
- style: { fontFamily: "var(--heading-font-family, inherit)" },
121
- children: t(`preferences.categories.${e}.title`)
122
- }
123
- ),
124
- /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground mt-0.5", children: t(`preferences.categories.${e}.description`) })
125
- ] }),
126
- /* @__PURE__ */ l("div", { className: "ml-4 flex items-center gap-2", children: [
127
- !o && r === "some" && /* @__PURE__ */ n("span", { className: "text-xs text-muted-foreground", children: t("preferences.partial") }),
128
- o ? /* @__PURE__ */ n("span", { className: "text-xs text-muted-foreground", children: t("preferences.alwaysOn") }) : /* @__PURE__ */ n(
129
- w,
130
- {
131
- checked: r === "all",
132
- onCheckedChange: (c) => j(e, c),
133
- "aria-label": t(`preferences.categories.${e}.title`)
134
- }
135
- )
136
- ] })
137
- ] }),
138
- !o && /* @__PURE__ */ n("div", { className: "space-y-2 pl-2 border-l-2 border-border ml-1", children: s.map((c) => {
139
- const v = u.includes(c.host);
140
- return /* @__PURE__ */ l(
141
- "div",
142
- {
143
- className: "flex items-start justify-between gap-3 py-2 px-3 rounded-md bg-muted/30",
144
- children: [
145
- /* @__PURE__ */ l("div", { className: "flex-1 min-w-0", children: [
146
- /* @__PURE__ */ n("span", { className: "text-sm font-medium truncate", children: c.name }),
147
- c.description && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: G(c.description, _) }),
148
- /* @__PURE__ */ l("div", { className: "flex items-center gap-3 mt-1 text-[10px] text-muted-foreground/70", children: [
149
- /* @__PURE__ */ n("span", { children: c.host }),
150
- /* @__PURE__ */ n("span", { children: "•" }),
151
- /* @__PURE__ */ n("span", { children: W(c.durationSeconds, t) }),
152
- /* @__PURE__ */ n("span", { children: "•" }),
153
- /* @__PURE__ */ n("span", { className: "capitalize", children: c.type.replace("_", " ") })
154
- ] })
155
- ] }),
156
- /* @__PURE__ */ n(
157
- w,
158
- {
159
- checked: v,
160
- onCheckedChange: (P) => R(c.host, P),
161
- "aria-label": c.name
162
- }
163
- )
164
- ]
165
- },
166
- c.host
167
- );
168
- }) })
169
- ]
170
- },
171
- e
172
- );
173
- }) }),
174
- /* @__PURE__ */ l("div", { className: "mt-auto flex flex-col gap-2 border-t border-border px-6 py-4", children: [
175
- /* @__PURE__ */ l("div", { className: "flex gap-2", children: [
176
- /* @__PURE__ */ n(
177
- S,
178
- {
179
- variant: "outline",
180
- size: "sm",
181
- onClick: M,
182
- className: "flex-1",
183
- children: t("preferences.rejectAll")
184
- }
185
- ),
186
- /* @__PURE__ */ n(
187
- S,
188
- {
189
- variant: "outline",
190
- size: "sm",
191
- onClick: E,
192
- className: "flex-1",
193
- children: t("preferences.acceptAll")
194
- }
195
- )
196
- ] }),
197
- /* @__PURE__ */ n(
198
- S,
199
- {
200
- size: "sm",
201
- onClick: z,
202
- disabled: !O && !m,
203
- className: "w-full",
204
- children: t("preferences.save")
205
- }
206
- )
207
- ] })
208
- ] });
209
- }
210
- export {
211
- te as CookiePreferencesView
212
- };
213
- //# sourceMappingURL=CookiePreferencesView-MhO9FO-4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CookiePreferencesView-MhO9FO-4.js","sources":["../src/features/cookieConsent/CookiePreferencesView.tsx"],"sourcesContent":["import { useState, useCallback, useMemo, useEffect, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useLocation } from 'react-router';\nimport { shellui } from '@shellui/sdk';\nimport { Button } from '@/components/ui/button';\nimport { Switch } from '@/components/ui/switch';\nimport { useConfig } from '../config/useConfig';\nimport { useSettings } from '../settings/hooks/useSettings';\nimport { resolveLocalizedString } from '../layouts/utils';\nimport type { CookieConsentCategory, CookieDefinition } from '../config/types';\n\n/** Category display order and labels */\nconst CATEGORY_ORDER: CookieConsentCategory[] = [\n 'strict_necessary',\n 'functional_performance',\n 'targeting',\n 'social_media_embedded',\n];\n\n/** Format duration in human-readable format */\nfunction formatDuration(\n seconds: number,\n t: (key: string, options?: Record<string, unknown>) => string,\n): string {\n if (seconds < 60) return t('preferences.duration.seconds', { count: seconds });\n if (seconds < 3600) return t('preferences.duration.minutes', { count: Math.floor(seconds / 60) });\n if (seconds < 86400)\n return t('preferences.duration.hours', { count: Math.floor(seconds / 3600) });\n if (seconds < 31536000)\n return t('preferences.duration.days', { count: Math.floor(seconds / 86400) });\n return t('preferences.duration.years', { count: Math.floor(seconds / 31536000) });\n}\n\nexport function CookiePreferencesView() {\n const { t, i18n } = useTranslation('cookieConsent');\n const { config } = useConfig();\n const { settings, updateSetting } = useSettings();\n const location = useLocation();\n const searchParams = new URLSearchParams(location.search);\n const isInitialConsent = searchParams.get('initial') === 'true';\n const currentLanguage = i18n.language || 'en';\n\n const cookies = config?.cookieConsent?.cookies ?? [];\n const allHosts = useMemo(() => cookies.map((c) => c.host), [cookies]);\n\n // Strictly necessary hosts are always enabled\n const strictNecessaryHosts = useMemo(\n () => cookies.filter((c) => c.category === 'strict_necessary').map((c) => c.host),\n [cookies],\n );\n\n const currentAcceptedHosts = settings?.cookieConsent?.acceptedHosts ?? [];\n\n // Local state for unsaved changes (always include strict necessary)\n const [localAcceptedHosts, setLocalAcceptedHosts] = useState<string[]>(() => [\n ...new Set([...currentAcceptedHosts, ...strictNecessaryHosts]),\n ]);\n\n // Track if save/accept/reject was clicked to avoid rejecting on intentional close\n const actionClickedRef = useRef(false);\n\n // Reset local state when drawer opens (when URL changes to include initial param)\n useEffect(() => {\n if (isInitialConsent) {\n // Always include strict necessary hosts\n setLocalAcceptedHosts([...new Set([...currentAcceptedHosts, ...strictNecessaryHosts])]);\n }\n }, [isInitialConsent, currentAcceptedHosts, strictNecessaryHosts]);\n\n // Handle drawer close without saving during initial consent\n useEffect(() => {\n if (!isInitialConsent) return;\n\n const handleDrawerClose = () => {\n // If closing without saving during initial consent, reject all except strict necessary\n // Check if user has never consented and no action was clicked\n const neverConsented = (settings?.cookieConsent?.consentedCookieHosts ?? []).length === 0;\n if (neverConsented && !actionClickedRef.current) {\n updateSetting('cookieConsent', {\n acceptedHosts: strictNecessaryHosts,\n consentedCookieHosts: allHosts,\n });\n }\n };\n\n const cleanup = shellui.addMessageListener('SHELLUI_CLOSE_DRAWER', handleDrawerClose);\n return cleanup;\n }, [isInitialConsent, strictNecessaryHosts, allHosts, updateSetting, settings]);\n\n // Cleanup on unmount: if initial consent and drawer closes without save, reject all\n useEffect(() => {\n return () => {\n if (isInitialConsent && !actionClickedRef.current) {\n // Check if user has never consented\n const neverConsented = (settings?.cookieConsent?.consentedCookieHosts ?? []).length === 0;\n if (neverConsented) {\n updateSetting('cookieConsent', {\n acceptedHosts: strictNecessaryHosts,\n consentedCookieHosts: allHosts,\n });\n }\n }\n };\n }, [isInitialConsent, strictNecessaryHosts, allHosts, updateSetting, settings]);\n\n // Group cookies by category\n const cookiesByCategory = useMemo(() => {\n const grouped = new Map<CookieConsentCategory, CookieDefinition[]>();\n for (const cookie of cookies) {\n const existing = grouped.get(cookie.category) ?? [];\n grouped.set(cookie.category, [...existing, cookie]);\n }\n return grouped;\n }, [cookies]);\n\n // Toggle individual cookie\n const toggleCookie = useCallback((host: string, enabled: boolean) => {\n setLocalAcceptedHosts((prev) => (enabled ? [...prev, host] : prev.filter((h) => h !== host)));\n }, []);\n\n // Toggle entire category\n const toggleCategory = useCallback(\n (category: CookieConsentCategory, enabled: boolean) => {\n const categoryHosts = cookiesByCategory.get(category)?.map((c) => c.host) ?? [];\n setLocalAcceptedHosts((prev) => {\n if (enabled) {\n return [...new Set([...prev, ...categoryHosts])];\n } else {\n const hostsSet = new Set(categoryHosts);\n return prev.filter((h) => !hostsSet.has(h));\n }\n });\n },\n [cookiesByCategory],\n );\n\n // Check if category is fully or partially enabled\n const getCategoryState = useCallback(\n (category: CookieConsentCategory): 'all' | 'some' | 'none' => {\n const categoryHosts = cookiesByCategory.get(category)?.map((c) => c.host) ?? [];\n if (categoryHosts.length === 0) return 'none';\n const enabledCount = categoryHosts.filter((h) => localAcceptedHosts.includes(h)).length;\n if (enabledCount === categoryHosts.length) return 'all';\n if (enabledCount > 0) return 'some';\n return 'none';\n },\n [cookiesByCategory, localAcceptedHosts],\n );\n\n // Accept all\n const handleAcceptAll = useCallback(() => {\n actionClickedRef.current = true;\n updateSetting('cookieConsent', {\n acceptedHosts: allHosts,\n consentedCookieHosts: allHosts,\n });\n shellui.closeDrawer();\n }, [allHosts, updateSetting]);\n\n // Reject all except strict necessary (which are always enabled)\n const handleRejectAll = useCallback(() => {\n actionClickedRef.current = true;\n updateSetting('cookieConsent', {\n acceptedHosts: strictNecessaryHosts,\n consentedCookieHosts: allHosts,\n });\n shellui.closeDrawer();\n }, [strictNecessaryHosts, allHosts, updateSetting]);\n\n // Save custom preferences (always include strict necessary)\n const handleSave = useCallback(() => {\n actionClickedRef.current = true;\n const hostsToSave = [...new Set([...localAcceptedHosts, ...strictNecessaryHosts])];\n updateSetting('cookieConsent', {\n acceptedHosts: hostsToSave,\n consentedCookieHosts: allHosts,\n });\n shellui.closeDrawer();\n }, [localAcceptedHosts, strictNecessaryHosts, allHosts, updateSetting]);\n\n // Check if preferences have changed\n const hasChanges = useMemo(() => {\n if (localAcceptedHosts.length !== currentAcceptedHosts.length) return true;\n const sortedLocal = [...localAcceptedHosts].sort();\n const sortedCurrent = [...currentAcceptedHosts].sort();\n return sortedLocal.some((h, i) => h !== sortedCurrent[i]);\n }, [localAcceptedHosts, currentAcceptedHosts]);\n\n if (cookies.length === 0) {\n return (\n <div className=\"flex items-center justify-center h-full p-6\">\n <p className=\"text-muted-foreground\">{t('preferences.noCookies')}</p>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col h-full bg-background\">\n {/* Header */}\n <div className=\"flex flex-col space-y-2 border-b border-border/60 px-6 pt-5 pb-4\">\n <h2\n className=\"text-lg font-semibold leading-none tracking-tight\"\n style={{ fontFamily: 'var(--heading-font-family, inherit)' }}\n >\n {t('preferences.title')}\n </h2>\n <p className=\"text-sm text-muted-foreground\">{t('preferences.description')}</p>\n </div>\n\n {/* Content */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4\">\n {CATEGORY_ORDER.map((category) => {\n const categoryCookies = cookiesByCategory.get(category);\n if (!categoryCookies || categoryCookies.length === 0) return null;\n\n const categoryState = getCategoryState(category);\n const isStrictNecessary = category === 'strict_necessary';\n\n return (\n <div\n key={category}\n className=\"mb-6 last:mb-0\"\n >\n {/* Category header with toggle */}\n <div className=\"flex items-center justify-between mb-3\">\n <div className=\"flex-1 min-w-0\">\n <h3\n className=\"text-sm font-semibold\"\n style={{ fontFamily: 'var(--heading-font-family, inherit)' }}\n >\n {t(`preferences.categories.${category}.title`)}\n </h3>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t(`preferences.categories.${category}.description`)}\n </p>\n </div>\n <div className=\"ml-4 flex items-center gap-2\">\n {!isStrictNecessary && categoryState === 'some' && (\n <span className=\"text-xs text-muted-foreground\">\n {t('preferences.partial')}\n </span>\n )}\n {isStrictNecessary ? (\n <span className=\"text-xs text-muted-foreground\">\n {t('preferences.alwaysOn')}\n </span>\n ) : (\n <Switch\n checked={categoryState === 'all'}\n onCheckedChange={(checked) => toggleCategory(category, checked)}\n aria-label={t(`preferences.categories.${category}.title`)}\n />\n )}\n </div>\n </div>\n\n {/* Individual cookies - only show for non-strictly-necessary categories */}\n {!isStrictNecessary && (\n <div className=\"space-y-2 pl-2 border-l-2 border-border ml-1\">\n {categoryCookies.map((cookie) => {\n const isEnabled = localAcceptedHosts.includes(cookie.host);\n return (\n <div\n key={cookie.host}\n className=\"flex items-start justify-between gap-3 py-2 px-3 rounded-md bg-muted/30\"\n >\n <div className=\"flex-1 min-w-0\">\n <span className=\"text-sm font-medium truncate\">{cookie.name}</span>\n {cookie.description && (\n <p className=\"text-xs text-muted-foreground mt-0.5 line-clamp-2\">\n {resolveLocalizedString(cookie.description, currentLanguage)}\n </p>\n )}\n <div className=\"flex items-center gap-3 mt-1 text-[10px] text-muted-foreground/70\">\n <span>{cookie.host}</span>\n <span>•</span>\n <span>{formatDuration(cookie.durationSeconds, t)}</span>\n <span>•</span>\n <span className=\"capitalize\">{cookie.type.replace('_', ' ')}</span>\n </div>\n </div>\n <Switch\n checked={isEnabled}\n onCheckedChange={(checked) => toggleCookie(cookie.host, checked)}\n aria-label={cookie.name}\n />\n </div>\n );\n })}\n </div>\n )}\n </div>\n );\n })}\n </div>\n\n {/* Footer */}\n <div className=\"mt-auto flex flex-col gap-2 border-t border-border px-6 py-4\">\n <div className=\"flex gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleRejectAll}\n className=\"flex-1\"\n >\n {t('preferences.rejectAll')}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={handleAcceptAll}\n className=\"flex-1\"\n >\n {t('preferences.acceptAll')}\n </Button>\n </div>\n <Button\n size=\"sm\"\n onClick={handleSave}\n disabled={!hasChanges && !isInitialConsent}\n className=\"w-full\"\n >\n {t('preferences.save')}\n </Button>\n </div>\n </div>\n );\n}\n"],"names":["CATEGORY_ORDER","formatDuration","seconds","t","CookiePreferencesView","i18n","useTranslation","config","useConfig","settings","updateSetting","useSettings","location","useLocation","isInitialConsent","currentLanguage","cookies","allHosts","useMemo","c","strictNecessaryHosts","currentAcceptedHosts","localAcceptedHosts","setLocalAcceptedHosts","useState","actionClickedRef","useRef","useEffect","handleDrawerClose","shellui","cookiesByCategory","grouped","cookie","existing","toggleCookie","useCallback","host","enabled","prev","h","toggleCategory","category","categoryHosts","hostsSet","getCategoryState","enabledCount","handleAcceptAll","handleRejectAll","handleSave","hostsToSave","hasChanges","sortedLocal","sortedCurrent","i","jsx","jsxs","categoryCookies","categoryState","isStrictNecessary","Switch","checked","isEnabled","resolveLocalizedString","Button"],"mappings":";;;;;;;AAYA,MAAMA,IAA0C;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGA,SAASC,EACPC,GACAC,GACQ;AACR,SAAID,IAAU,KAAWC,EAAE,gCAAgC,EAAE,OAAOD,GAAS,IACzEA,IAAU,OAAaC,EAAE,gCAAgC,EAAE,OAAO,KAAK,MAAMD,IAAU,EAAE,EAAA,CAAG,IAC5FA,IAAU,QACLC,EAAE,8BAA8B,EAAE,OAAO,KAAK,MAAMD,IAAU,IAAI,GAAG,IAC1EA,IAAU,UACLC,EAAE,6BAA6B,EAAE,OAAO,KAAK,MAAMD,IAAU,KAAK,GAAG,IACvEC,EAAE,8BAA8B,EAAE,OAAO,KAAK,MAAMD,IAAU,OAAQ,GAAG;AAClF;AAEO,SAASE,KAAwB;AACtC,QAAM,EAAE,GAAG,MAAAC,MAASC,EAAe,eAAe,GAC5C,EAAE,QAAAC,EAAA,IAAWC,EAAA,GACb,EAAE,UAAAC,GAAU,eAAAC,EAAA,IAAkBC,EAAA,GAC9BC,IAAWC,EAAA,GAEXC,IADe,IAAI,gBAAgBF,EAAS,MAAM,EAClB,IAAI,SAAS,MAAM,QACnDG,I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import { useLocation as M, Outlet as F, Link as I } from "react-router";
3
- import { useMemo as _, useEffect as P, useState as C, useRef as G, useLayoutEffect as H } from "react";
4
- import { useTranslation as R } from "react-i18next";
5
- import { shellui as S } from "@shellui/sdk";
6
- import { S as U, a as V, b as X, c as Z, d as q, e as J, f as K, g as Q, h as T, i as B, j as Y } from "./sidebar-ClIeZ2zb.js";
7
- import { f as z, s as ee, b as $, d as ne, c as p, Z as te, r as re } from "./index-lmRk5L6z.js";
8
- import { L as oe, O as se } from "./OverlayShell-pzbqQW25.js";
9
- const W = (n) => {
10
- try {
11
- const o = new URL(n).hostname;
12
- return o ? `https://icons.duckduckgo.com/ip3/${o}.ico` : null;
13
- } catch {
14
- return null;
15
- }
16
- }, A = ({
17
- navigation: n
18
- }) => {
19
- const a = M(), { i18n: o } = R(), s = o.language || "en", b = (t, l) => typeof t == "string" ? t : t[l] || t.en || t.fr || Object.values(t)[0] || "", f = _(() => n.some((t) => "title" in t && "items" in t ? t.items.some((l) => !!l.icon) : !!t.icon), [n]), c = (t) => "title" in t && "items" in t, d = (t) => {
20
- const l = `/${t.path}`, m = t.openIn === "modal" || t.openIn === "drawer", u = t.openIn === "external", r = !m && !u && (a.pathname === l || a.pathname.startsWith(`${l}/`)), i = b(t.label, s), g = u && !t.icon ? W(t.url) : null, x = t.icon ?? g ?? null, v = x ? /* @__PURE__ */ e(
21
- "img",
22
- {
23
- src: x,
24
- alt: "",
25
- className: p("h-4 w-4", "shrink-0")
26
- }
27
- ) : f ? /* @__PURE__ */ e("span", { className: "h-4 w-4 shrink-0" }) : null, w = /* @__PURE__ */ h(O, { children: [
28
- v,
29
- /* @__PURE__ */ e("span", { className: "truncate", children: i }),
30
- u ? /* @__PURE__ */ e(
31
- "img",
32
- {
33
- src: "/icons/external-link.svg",
34
- alt: "",
35
- className: "ml-auto h-4 w-4 shrink-0 opacity-70",
36
- "aria-hidden": !0
37
- }
38
- ) : null
39
- ] }), N = t.openIn === "modal" ? /* @__PURE__ */ e(
40
- "button",
41
- {
42
- type: "button",
43
- onClick: () => S.openModal(t.url),
44
- className: "flex items-center gap-2 w-full cursor-pointer text-left",
45
- children: w
46
- }
47
- ) : t.openIn === "drawer" ? /* @__PURE__ */ e(
48
- "button",
49
- {
50
- type: "button",
51
- onClick: () => S.openDrawer({ url: t.url, position: t.drawerPosition }),
52
- className: "flex items-center gap-2 w-full cursor-pointer text-left",
53
- children: w
54
- }
55
- ) : t.openIn === "external" ? /* @__PURE__ */ e(
56
- "a",
57
- {
58
- href: t.url,
59
- target: "_blank",
60
- rel: "noopener noreferrer",
61
- className: "flex items-center gap-2 w-full",
62
- children: w
63
- }
64
- ) : /* @__PURE__ */ e(
65
- I,
66
- {
67
- to: `/${t.path}`,
68
- className: "flex items-center gap-2 w-full",
69
- children: w
70
- }
71
- );
72
- return /* @__PURE__ */ e(
73
- Y,
74
- {
75
- asChild: !0,
76
- isActive: r,
77
- className: p("w-full", r && "bg-sidebar-accent text-sidebar-accent-foreground"),
78
- children: N
79
- }
80
- );
81
- };
82
- return /* @__PURE__ */ e(O, { children: n.map((t) => {
83
- if (c(t)) {
84
- const l = b(t.title, s);
85
- return /* @__PURE__ */ h(
86
- J,
87
- {
88
- className: "mt-0",
89
- children: [
90
- /* @__PURE__ */ e(K, { className: "mb-1", children: l }),
91
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(T, { className: "gap-0.5", children: t.items.map((m) => /* @__PURE__ */ e(B, { children: d(m) }, m.path)) }) })
92
- ]
93
- },
94
- l
95
- );
96
- } else
97
- return /* @__PURE__ */ e(
98
- T,
99
- {
100
- className: "gap-0.5",
101
- children: /* @__PURE__ */ e(B, { children: d(t) })
102
- },
103
- t.path
104
- );
105
- }) });
106
- }, ae = ({
107
- title: n,
108
- logo: a,
109
- startNav: o,
110
- endItems: s
111
- }) => /* @__PURE__ */ h(O, { children: [
112
- /* @__PURE__ */ e(X, { className: "border-b border-sidebar-border pb-4", children: (n || a) && /* @__PURE__ */ e(
113
- I,
114
- {
115
- to: "/",
116
- className: "flex items-center pl-1 pr-3 py-2 text-lg font-semibold text-sidebar-foreground hover:text-sidebar-foreground/80 transition-colors",
117
- children: a && a.trim() ? /* @__PURE__ */ e(
118
- "img",
119
- {
120
- src: a,
121
- alt: n || "Logo",
122
- className: "h-5 w-auto shrink-0 object-contain sidebar-logo"
123
- }
124
- ) : n ? /* @__PURE__ */ e("span", { className: "leading-none", children: n }) : null
125
- }
126
- ) }),
127
- /* @__PURE__ */ e(Z, { className: "gap-1", children: /* @__PURE__ */ e(A, { navigation: o }) }),
128
- s.length > 0 && /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(A, { navigation: s }) })
129
- ] });
130
- function ie(n, a) {
131
- return typeof n == "string" ? n : n[a] || n.en || n.fr || Object.values(n)[0] || "";
132
- }
133
- const le = 64, E = 4, ce = 12, de = 6, ue = (n) => n.startsWith("/icons/"), he = ({
134
- item: n,
135
- label: a,
136
- isActive: o,
137
- iconSrc: s,
138
- applyIconTheme: b
139
- }) => {
140
- const f = `/${n.path}`, c = /* @__PURE__ */ h("span", { className: "flex flex-col items-center justify-center gap-1 w-full min-w-0 max-w-full overflow-hidden", children: [
141
- s ? /* @__PURE__ */ e(
142
- "img",
143
- {
144
- src: s,
145
- alt: "",
146
- className: p(
147
- "size-4 shrink-0 rounded-sm object-cover",
148
- b && "opacity-90 dark:opacity-100 dark:invert"
149
- )
150
- }
151
- ) : /* @__PURE__ */ e("span", { className: "size-4 shrink-0 rounded-sm bg-muted" }),
152
- /* @__PURE__ */ e("span", { className: "text-[11px] leading-tight truncate w-full min-w-0 text-center block", children: a })
153
- ] }), d = p(
154
- "flex flex-col items-center justify-center rounded-md py-1.5 px-2 min-w-0 max-w-full transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
155
- o ? "bg-accent text-accent-foreground [&_span]:text-accent-foreground" : "text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground [&_span]:inherit"
156
- );
157
- return n.openIn === "modal" ? /* @__PURE__ */ e(
158
- "button",
159
- {
160
- type: "button",
161
- onClick: () => S.openModal(n.url),
162
- className: d,
163
- children: c
164
- }
165
- ) : n.openIn === "drawer" ? /* @__PURE__ */ e(
166
- "button",
167
- {
168
- type: "button",
169
- onClick: () => S.openDrawer({ url: n.url, position: n.drawerPosition }),
170
- className: d,
171
- children: c
172
- }
173
- ) : n.openIn === "external" ? /* @__PURE__ */ e(
174
- "a",
175
- {
176
- href: n.url,
177
- target: "_blank",
178
- rel: "noopener noreferrer",
179
- className: d,
180
- children: c
181
- }
182
- ) : /* @__PURE__ */ e(
183
- I,
184
- {
185
- to: f,
186
- className: d,
187
- children: c
188
- }
189
- );
190
- }, pe = ({ className: n }) => /* @__PURE__ */ e(
191
- "svg",
192
- {
193
- xmlns: "http://www.w3.org/2000/svg",
194
- width: "24",
195
- height: "24",
196
- viewBox: "0 0 24 24",
197
- fill: "none",
198
- stroke: "currentColor",
199
- strokeWidth: "2",
200
- strokeLinecap: "round",
201
- strokeLinejoin: "round",
202
- className: p("shrink-0", n),
203
- "aria-hidden": !0,
204
- children: /* @__PURE__ */ e("path", { d: "m18 15-6-6-6 6" })
205
- }
206
- ), fe = ({ className: n }) => /* @__PURE__ */ e(
207
- "svg",
208
- {
209
- xmlns: "http://www.w3.org/2000/svg",
210
- width: "24",
211
- height: "24",
212
- viewBox: "0 0 24 24",
213
- fill: "none",
214
- stroke: "currentColor",
215
- strokeWidth: "2",
216
- strokeLinecap: "round",
217
- strokeLinejoin: "round",
218
- className: p("shrink-0", n),
219
- "aria-hidden": !0,
220
- children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
221
- }
222
- ), me = ({ className: n }) => /* @__PURE__ */ h(
223
- "svg",
224
- {
225
- xmlns: "http://www.w3.org/2000/svg",
226
- width: "24",
227
- height: "24",
228
- viewBox: "0 0 24 24",
229
- fill: "none",
230
- stroke: "currentColor",
231
- strokeWidth: "2",
232
- strokeLinecap: "round",
233
- strokeLinejoin: "round",
234
- className: p("shrink-0", n),
235
- "aria-hidden": !0,
236
- children: [
237
- /* @__PURE__ */ e("path", { d: "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }),
238
- /* @__PURE__ */ e("polyline", { points: "9 22 9 12 15 12 15 22" })
239
- ]
240
- }
241
- ), ge = ({
242
- items: n,
243
- currentLanguage: a
244
- }) => {
245
- const o = M(), [s, b] = C(!1), f = G(null), [c, d] = C(0);
246
- H(() => {
247
- const r = f.current;
248
- if (!r) return;
249
- const i = new ResizeObserver((g) => {
250
- const x = g[0]?.contentRect.width ?? 0;
251
- d(x);
252
- });
253
- return i.observe(r), d(r.getBoundingClientRect().width), () => i.disconnect();
254
- }, []);
255
- const { rowItems: t, overflowItems: l, hasMore: m } = _(() => {
256
- const r = n.slice(), i = Math.max(0, c - ce * 2), g = le + E, x = c > 0 ? Math.floor((i + E) / g) : 5, v = Math.min(Math.max(0, x), de), k = v - 1, N = r.length <= k ? r.length : Math.max(0, v - 2), y = r.slice(0, N), D = new Set(y.map((L) => L.path)), j = r.filter((L) => !D.has(L.path));
257
- return {
258
- rowItems: y,
259
- overflowItems: j,
260
- hasMore: j.length > 0
261
- };
262
- }, [n, c]);
263
- P(() => {
264
- b(!1);
265
- }, [o.pathname]);
266
- const u = (r, i) => {
267
- const g = `/${r.path}`, v = !(r.openIn === "modal" || r.openIn === "drawer" || r.openIn === "external") && (o.pathname === g || o.pathname.startsWith(`${g}/`)), k = re(r.label, a), w = r.openIn === "external" && !r.icon ? W(r.url) : null, N = r.icon ?? w ?? null, y = N ? ue(N) : !1;
268
- return /* @__PURE__ */ e(
269
- he,
270
- {
271
- item: r,
272
- label: k,
273
- isActive: v,
274
- iconSrc: N,
275
- applyIconTheme: y
276
- },
277
- `${r.path}-${r.url}-${i}`
278
- );
279
- };
280
- return /* @__PURE__ */ h(
281
- "nav",
282
- {
283
- ref: f,
284
- className: "fixed bottom-0 left-0 right-0 z-[9999] md:hidden border-t border-sidebar-border bg-sidebar-background overflow-hidden pt-2",
285
- style: {
286
- zIndex: te.SIDEBAR_TRIGGER,
287
- paddingBottom: "calc(0.5rem + env(safe-area-inset-bottom, 0px))"
288
- },
289
- children: [
290
- /* @__PURE__ */ h("div", { className: "flex flex-row flex-nowrap items-center justify-center gap-1 px-3 overflow-x-hidden", children: [
291
- /* @__PURE__ */ h(
292
- I,
293
- {
294
- to: "/",
295
- className: p(
296
- "flex flex-col items-center justify-center gap-1 rounded-md py-1.5 px-2 min-w-0 transition-colors cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
297
- o.pathname === "/" || o.pathname === "" ? "bg-sidebar-accent text-sidebar-accent-foreground [&_span]:text-sidebar-accent-foreground" : "text-sidebar-foreground/80 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground [&_span]:inherit"
298
- ),
299
- "aria-label": "Home",
300
- children: [
301
- /* @__PURE__ */ e("span", { className: "size-4 shrink-0 flex items-center justify-center [&_svg]:text-current", children: /* @__PURE__ */ e(me, { className: "size-4" }) }),
302
- /* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Home" })
303
- ]
304
- }
305
- ),
306
- t.map((r, i) => u(r, i)),
307
- m && /* @__PURE__ */ h(
308
- "button",
309
- {
310
- type: "button",
311
- onClick: () => b((r) => !r),
312
- className: p(
313
- "flex flex-col items-center justify-center gap-1 rounded-md py-1.5 px-2 min-w-0 transition-colors cursor-pointer",
314
- "text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
315
- ),
316
- "aria-expanded": s,
317
- "aria-label": s ? "Show less" : "Show more",
318
- children: [
319
- /* @__PURE__ */ e("span", { className: "size-4 shrink-0 flex items-center justify-center", children: s ? /* @__PURE__ */ e(fe, { className: "size-4" }) : /* @__PURE__ */ e(pe, { className: "size-4" }) }),
320
- /* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: s ? "Less" : "More" })
321
- ]
322
- }
323
- )
324
- ] }),
325
- /* @__PURE__ */ e(
326
- "div",
327
- {
328
- className: p(
329
- "grid transition-[grid-template-rows] duration-300 ease-out",
330
- s ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
331
- ),
332
- children: /* @__PURE__ */ e("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ e("div", { className: "px-4 pt-3 pb-2 border-t border-sidebar-border/50 mt-1", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-5 gap-2 justify-items-center max-w-xs mx-auto", children: s ? l.map((r, i) => u(r, i)) : null }) }) })
333
- }
334
- )
335
- ]
336
- }
337
- );
338
- }, be = ({ title: n, logo: a, navigation: o }) => {
339
- const s = M(), { i18n: b } = R(), f = b.language || "en", { startNav: c, endItems: d, navigationItems: t, mobileNavItems: l } = _(() => {
340
- const m = z(o, "desktop"), u = z(o, "mobile"), { start: r, end: i } = ee(m), g = $(m), x = $(u);
341
- return {
342
- startNav: ne(r),
343
- endItems: i,
344
- navigationItems: g,
345
- mobileNavItems: x
346
- };
347
- }, [o]);
348
- return P(() => {
349
- if (!n) return;
350
- const u = (s.pathname.replace(/^\/+|\/+$/g, "") || "").split("/")[0];
351
- if (!u) {
352
- document.title = n;
353
- return;
354
- }
355
- const r = t.find((i) => i.path === u);
356
- if (r) {
357
- const i = ie(r.label, f);
358
- document.title = `${i} | ${n}`;
359
- } else
360
- document.title = n;
361
- }, [s.pathname, n, t, f]), /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(U, { children: /* @__PURE__ */ h(se, { navigationItems: t, children: [
362
- /* @__PURE__ */ h("div", { className: "flex h-screen overflow-hidden", children: [
363
- /* @__PURE__ */ e(V, { className: p("hidden md:flex shrink-0"), children: /* @__PURE__ */ e(
364
- ae,
365
- {
366
- title: n,
367
- logo: a,
368
- startNav: c,
369
- endItems: d
370
- }
371
- ) }),
372
- /* @__PURE__ */ e("main", { className: "flex-1 flex flex-col overflow-hidden bg-background relative min-w-0", children: /* @__PURE__ */ e("div", { className: "flex-1 flex flex-col overflow-auto pb-16 md:pb-0", children: /* @__PURE__ */ e(F, {}) }) })
373
- ] }),
374
- /* @__PURE__ */ e(
375
- ge,
376
- {
377
- items: l,
378
- currentLanguage: f
379
- }
380
- )
381
- ] }) }) });
382
- }, Le = ({ title: n, appIcon: a, logo: o, navigation: s }) => /* @__PURE__ */ e(
383
- be,
384
- {
385
- title: n,
386
- appIcon: a,
387
- logo: o,
388
- navigation: s
389
- }
390
- );
391
- export {
392
- Le as DefaultLayout
393
- };
394
- //# sourceMappingURL=DefaultLayout-Dbb3uJED.js.map