@the-portland-company/shell 0.16.0 → 0.16.1
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/chunk-ZZWM7BZZ.js +68 -0
- package/dist/chunk-ZZWM7BZZ.js.map +1 -0
- package/dist/native.cjs +159 -5
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +7 -2
- package/dist/native.d.ts +7 -2
- package/dist/native.js +96 -7
- package/dist/native.js.map +1 -1
- package/dist/theme-preference.cjs +77 -0
- package/dist/theme-preference.cjs.map +1 -0
- package/dist/theme-preference.d.cts +14 -0
- package/dist/theme-preference.d.ts +14 -0
- package/dist/theme-preference.js +3 -0
- package/dist/theme-preference.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/theme-preference.ts
|
|
2
|
+
var THEME_STORAGE_KEY = "politogy_theme";
|
|
3
|
+
var THEME_COOKIE = "politogy_theme";
|
|
4
|
+
var VALID = ["light", "dark", "system"];
|
|
5
|
+
function isThemePreference(v) {
|
|
6
|
+
return typeof v === "string" && VALID.includes(v);
|
|
7
|
+
}
|
|
8
|
+
function readThemeCookie() {
|
|
9
|
+
if (typeof document === "undefined") return null;
|
|
10
|
+
try {
|
|
11
|
+
const m = document.cookie.match(
|
|
12
|
+
new RegExp(`(?:^|;\\s*)${THEME_COOKIE}=([^;]+)`)
|
|
13
|
+
);
|
|
14
|
+
const v = m ? decodeURIComponent(m[1]) : null;
|
|
15
|
+
return isThemePreference(v) ? v : null;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function writeThemeCookie(pref) {
|
|
21
|
+
if (typeof document === "undefined" || typeof window === "undefined") return;
|
|
22
|
+
const host = window.location.hostname;
|
|
23
|
+
const onParentDomain = /(^|\.)politogyvrm\.com$/i.test(host);
|
|
24
|
+
const domainAttr = onParentDomain ? "; Domain=.politogyvrm.com" : "";
|
|
25
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
26
|
+
document.cookie = `${THEME_COOKIE}=${encodeURIComponent(
|
|
27
|
+
pref
|
|
28
|
+
)}; Path=/; Max-Age=31536000; SameSite=Lax${domainAttr}${secure}`;
|
|
29
|
+
}
|
|
30
|
+
function resolveTheme(pref) {
|
|
31
|
+
if (pref === "system") {
|
|
32
|
+
try {
|
|
33
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
34
|
+
} catch {
|
|
35
|
+
return "light";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return pref;
|
|
39
|
+
}
|
|
40
|
+
function applyThemePreference(pref) {
|
|
41
|
+
if (typeof document === "undefined") return;
|
|
42
|
+
const resolved = resolveTheme(pref);
|
|
43
|
+
const d = document.documentElement;
|
|
44
|
+
d.classList.toggle("dark", resolved === "dark");
|
|
45
|
+
try {
|
|
46
|
+
d.style.colorScheme = resolved;
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var THEME_PREPAINT_SCRIPT = `(function(){try{
|
|
51
|
+
var KEY=${JSON.stringify(THEME_STORAGE_KEY)};
|
|
52
|
+
var VALID=["light","dark","system"];
|
|
53
|
+
function fromCookie(){try{var m=document.cookie.match(/(?:^|;\\s*)${THEME_COOKIE}=([^;]+)/);return m?decodeURIComponent(m[1]):null;}catch(e){return null;}}
|
|
54
|
+
var cookie=fromCookie();
|
|
55
|
+
var ls=null;try{ls=localStorage.getItem(KEY);}catch(e){}
|
|
56
|
+
var pref=cookie||ls||"system";
|
|
57
|
+
if(VALID.indexOf(pref)===-1)pref="system";
|
|
58
|
+
if(cookie&&cookie!==ls){try{localStorage.setItem(KEY,cookie);}catch(e){}}
|
|
59
|
+
var resolved=pref;
|
|
60
|
+
if(pref==="system"){try{resolved=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";}catch(e){resolved="light";}}
|
|
61
|
+
var d=document.documentElement;
|
|
62
|
+
if(resolved==="dark"){d.classList.add("dark");}else{d.classList.remove("dark");}
|
|
63
|
+
try{d.style.colorScheme=resolved;}catch(e){}
|
|
64
|
+
}catch(e){}})();`;
|
|
65
|
+
|
|
66
|
+
export { THEME_COOKIE, THEME_PREPAINT_SCRIPT, THEME_STORAGE_KEY, applyThemePreference, isThemePreference, readThemeCookie, resolveTheme, writeThemeCookie };
|
|
67
|
+
//# sourceMappingURL=chunk-ZZWM7BZZ.js.map
|
|
68
|
+
//# sourceMappingURL=chunk-ZZWM7BZZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/theme-preference.ts"],"names":[],"mappings":";AAqBO,IAAM,iBAAA,GAAoB;AAC1B,IAAM,YAAA,GAAe;AAE5B,IAAM,KAAA,GAAoC,CAAC,OAAA,EAAS,MAAA,EAAQ,QAAQ,CAAA;AAE7D,SAAS,kBAAkB,CAAA,EAAkC;AAClE,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAa,KAAA,CAA4B,SAAS,CAAC,CAAA;AACzE;AAGO,SAAS,eAAA,GAA0C;AACxD,EAAA,IAAI,OAAO,QAAA,KAAa,WAAA,EAAa,OAAO,IAAA;AAC5C,EAAA,IAAI;AACF,IAAA,MAAM,CAAA,GAAI,SAAS,MAAA,CAAO,KAAA;AAAA,MACxB,IAAI,MAAA,CAAO,CAAA,WAAA,EAAc,YAAY,CAAA,QAAA,CAAU;AAAA,KACjD;AACA,IAAA,MAAM,IAAI,CAAA,GAAI,kBAAA,CAAmB,CAAA,CAAE,CAAC,CAAC,CAAA,GAAI,IAAA;AACzC,IAAA,OAAO,iBAAA,CAAkB,CAAC,CAAA,GAAI,CAAA,GAAI,IAAA;AAAA,EACpC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAOO,SAAS,iBAAiB,IAAA,EAA6B;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,WAAA,IAAe,OAAO,WAAW,WAAA,EAAa;AACtE,EAAA,MAAM,IAAA,GAAO,OAAO,QAAA,CAAS,QAAA;AAC7B,EAAA,MAAM,cAAA,GAAiB,0BAAA,CAA2B,IAAA,CAAK,IAAI,CAAA;AAC3D,EAAA,MAAM,UAAA,GAAa,iBAAiB,2BAAA,GAA8B,EAAA;AAClE,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,QAAA,CAAS,QAAA,KAAa,WAAW,UAAA,GAAa,EAAA;AACpE,EAAA,QAAA,CAAS,MAAA,GAAS,CAAA,EAAG,YAAY,CAAA,CAAA,EAAI,kBAAA;AAAA,IACnC;AAAA,GACD,CAAA,wCAAA,EAA2C,UAAU,CAAA,EAAG,MAAM,CAAA,CAAA;AACjE;AAGO,SAAS,aAAa,IAAA,EAAyC;AACpE,EAAA,IAAI,SAAS,QAAA,EAAU;AACrB,IAAA,IAAI;AACF,MAAA,OAAO,MAAA,CAAO,UAAA,CAAW,8BAA8B,CAAA,CAAE,UACrD,MAAA,GACA,OAAA;AAAA,IACN,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,OAAA;AAAA,IACT;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,qBAAqB,IAAA,EAA6B;AAChE,EAAA,IAAI,OAAO,aAAa,WAAA,EAAa;AACrC,EAAA,MAAM,QAAA,GAAW,aAAa,IAAI,CAAA;AAClC,EAAA,MAAM,IAAI,QAAA,CAAS,eAAA;AACnB,EAAA,CAAA,CAAE,SAAA,CAAU,MAAA,CAAO,MAAA,EAAQ,QAAA,KAAa,MAAM,CAAA;AAC9C,EAAA,IAAI;AACF,IAAA,CAAA,CAAE,MAAM,WAAA,GAAc,QAAA;AAAA,EACxB,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAQO,IAAM,qBAAA,GAAwB,CAAA;AAAA,QAAA,EAC3B,IAAA,CAAK,SAAA,CAAU,iBAAiB,CAAC,CAAA;AAAA;AAAA,kEAAA,EAEyB,YAAY,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAA","file":"chunk-ZZWM7BZZ.js","sourcesContent":["// Universal theme preference — the ONE cross-app contract.\n//\n// One theme choice (Light / Dark / System) follows the authenticated user\n// across every Politogy app + subdomain. Three layers cooperate:\n// 1. VRM Core `profiles.theme_preference` — source of truth, persisted via\n// the chrome API (`PATCH me/preferences { themePreference }`) and read\n// back from `GET me` (`themePreference`).\n// 2. `.politogyvrm.com` cookie `politogy_theme` — zero-flash pre-paint\n// vehicle that crosses subdomains (auth session cookies are host-only).\n// 3. localStorage `politogy_theme` — offline fallback store.\n//\n// Ported verbatim from contacts/apps/web/src/lib/theme.ts (the origin of the\n// contract) so every app runs the identical behavior from npm. This module is\n// server-safe (no 'use client'): layouts import THEME_PREPAINT_SCRIPT for the\n// pre-paint inline script. The client-side hook lives in ./native\n// (useThemePreference).\n\nexport type ThemePreference = 'light' | 'dark' | 'system'\n\n// Single converged key for BOTH the localStorage store and the\n// cross-subdomain cookie, so a choice in one app is the same key in the next.\nexport const THEME_STORAGE_KEY = 'politogy_theme'\nexport const THEME_COOKIE = 'politogy_theme'\n\nconst VALID: readonly ThemePreference[] = ['light', 'dark', 'system']\n\nexport function isThemePreference(v: unknown): v is ThemePreference {\n return typeof v === 'string' && (VALID as readonly string[]).includes(v)\n}\n\n/** Read the shared cookie (browser only; null on the server or when unset). */\nexport function readThemeCookie(): ThemePreference | null {\n if (typeof document === 'undefined') return null\n try {\n const m = document.cookie.match(\n new RegExp(`(?:^|;\\\\s*)${THEME_COOKIE}=([^;]+)`),\n )\n const v = m ? decodeURIComponent(m[1]) : null\n return isThemePreference(v) ? v : null\n } catch {\n return null\n }\n}\n\n// Set the cross-subdomain cookie. On a *.politogyvrm.com host we scope it to\n// the parent domain so every app subdomain reads it; on any other host\n// (localhost, *.pages.dev preview) we fall back to a host-only cookie so\n// local/preview theming still works without a mismatched Domain attribute\n// (which browsers silently drop). 1-year, SameSite=Lax, Secure on https.\nexport function writeThemeCookie(pref: ThemePreference): void {\n if (typeof document === 'undefined' || typeof window === 'undefined') return\n const host = window.location.hostname\n const onParentDomain = /(^|\\.)politogyvrm\\.com$/i.test(host)\n const domainAttr = onParentDomain ? '; Domain=.politogyvrm.com' : ''\n const secure = window.location.protocol === 'https:' ? '; Secure' : ''\n document.cookie = `${THEME_COOKIE}=${encodeURIComponent(\n pref,\n )}; Path=/; Max-Age=31536000; SameSite=Lax${domainAttr}${secure}`\n}\n\n/** Resolve a preference to the concrete light/dark it renders as right now. */\nexport function resolveTheme(pref: ThemePreference): 'light' | 'dark' {\n if (pref === 'system') {\n try {\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light'\n } catch {\n return 'light'\n }\n }\n return pref\n}\n\n/** Apply a preference to the document (`.dark` class + color-scheme). */\nexport function applyThemePreference(pref: ThemePreference): void {\n if (typeof document === 'undefined') return\n const resolved = resolveTheme(pref)\n const d = document.documentElement\n d.classList.toggle('dark', resolved === 'dark')\n try {\n d.style.colorScheme = resolved\n } catch {\n /* non-fatal */\n }\n}\n\n// Inline pre-paint script — render it in <head> (or as the first child of\n// <body>) so the theme applies before first paint. Resolves the preference\n// from cookie → localStorage → OS, applies the `.dark` class + `color-scheme`,\n// and seeds localStorage from the cookie so the app hydrates to the synced\n// value (the cross-subdomain flash fix). Self-contained, dependency-free, and\n// wrapped so any failure is silent (never blocks paint).\nexport const THEME_PREPAINT_SCRIPT = `(function(){try{\nvar KEY=${JSON.stringify(THEME_STORAGE_KEY)};\nvar VALID=[\"light\",\"dark\",\"system\"];\nfunction fromCookie(){try{var m=document.cookie.match(/(?:^|;\\\\s*)${THEME_COOKIE}=([^;]+)/);return m?decodeURIComponent(m[1]):null;}catch(e){return null;}}\nvar cookie=fromCookie();\nvar ls=null;try{ls=localStorage.getItem(KEY);}catch(e){}\nvar pref=cookie||ls||\"system\";\nif(VALID.indexOf(pref)===-1)pref=\"system\";\nif(cookie&&cookie!==ls){try{localStorage.setItem(KEY,cookie);}catch(e){}}\nvar resolved=pref;\nif(pref===\"system\"){try{resolved=window.matchMedia(\"(prefers-color-scheme: dark)\").matches?\"dark\":\"light\";}catch(e){resolved=\"light\";}}\nvar d=document.documentElement;\nif(resolved===\"dark\"){d.classList.add(\"dark\");}else{d.classList.remove(\"dark\");}\ntry{d.style.colorScheme=resolved;}catch(e){}\n}catch(e){}})();`\n"]}
|
package/dist/native.cjs
CHANGED
|
@@ -52,6 +52,71 @@ function resolveBrandGlyph(name) {
|
|
|
52
52
|
if (!name) return null;
|
|
53
53
|
return GLYPHS[name.trim().toLowerCase()] ?? null;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
// src/theme-preference.ts
|
|
57
|
+
var THEME_STORAGE_KEY = "politogy_theme";
|
|
58
|
+
var THEME_COOKIE = "politogy_theme";
|
|
59
|
+
var VALID = ["light", "dark", "system"];
|
|
60
|
+
function isThemePreference(v) {
|
|
61
|
+
return typeof v === "string" && VALID.includes(v);
|
|
62
|
+
}
|
|
63
|
+
function readThemeCookie() {
|
|
64
|
+
if (typeof document === "undefined") return null;
|
|
65
|
+
try {
|
|
66
|
+
const m = document.cookie.match(
|
|
67
|
+
new RegExp(`(?:^|;\\s*)${THEME_COOKIE}=([^;]+)`)
|
|
68
|
+
);
|
|
69
|
+
const v = m ? decodeURIComponent(m[1]) : null;
|
|
70
|
+
return isThemePreference(v) ? v : null;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function writeThemeCookie(pref) {
|
|
76
|
+
if (typeof document === "undefined" || typeof window === "undefined") return;
|
|
77
|
+
const host = window.location.hostname;
|
|
78
|
+
const onParentDomain = /(^|\.)politogyvrm\.com$/i.test(host);
|
|
79
|
+
const domainAttr = onParentDomain ? "; Domain=.politogyvrm.com" : "";
|
|
80
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
81
|
+
document.cookie = `${THEME_COOKIE}=${encodeURIComponent(
|
|
82
|
+
pref
|
|
83
|
+
)}; Path=/; Max-Age=31536000; SameSite=Lax${domainAttr}${secure}`;
|
|
84
|
+
}
|
|
85
|
+
function resolveTheme(pref) {
|
|
86
|
+
if (pref === "system") {
|
|
87
|
+
try {
|
|
88
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
89
|
+
} catch {
|
|
90
|
+
return "light";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return pref;
|
|
94
|
+
}
|
|
95
|
+
function applyThemePreference(pref) {
|
|
96
|
+
if (typeof document === "undefined") return;
|
|
97
|
+
const resolved = resolveTheme(pref);
|
|
98
|
+
const d = document.documentElement;
|
|
99
|
+
d.classList.toggle("dark", resolved === "dark");
|
|
100
|
+
try {
|
|
101
|
+
d.style.colorScheme = resolved;
|
|
102
|
+
} catch {
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`(function(){try{
|
|
106
|
+
var KEY=${JSON.stringify(THEME_STORAGE_KEY)};
|
|
107
|
+
var VALID=["light","dark","system"];
|
|
108
|
+
function fromCookie(){try{var m=document.cookie.match(/(?:^|;\\s*)${THEME_COOKIE}=([^;]+)/);return m?decodeURIComponent(m[1]):null;}catch(e){return null;}}
|
|
109
|
+
var cookie=fromCookie();
|
|
110
|
+
var ls=null;try{ls=localStorage.getItem(KEY);}catch(e){}
|
|
111
|
+
var pref=cookie||ls||"system";
|
|
112
|
+
if(VALID.indexOf(pref)===-1)pref="system";
|
|
113
|
+
if(cookie&&cookie!==ls){try{localStorage.setItem(KEY,cookie);}catch(e){}}
|
|
114
|
+
var resolved=pref;
|
|
115
|
+
if(pref==="system"){try{resolved=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";}catch(e){resolved="light";}}
|
|
116
|
+
var d=document.documentElement;
|
|
117
|
+
if(resolved==="dark"){d.classList.add("dark");}else{d.classList.remove("dark");}
|
|
118
|
+
try{d.style.colorScheme=resolved;}catch(e){}
|
|
119
|
+
}catch(e){}})();`;
|
|
55
120
|
function topBarIconButtonClass(tone = "default") {
|
|
56
121
|
const toneClass = tone === "danger" || tone === "warning" ? "text-[color:var(--color-race-red)] hover:text-[color:var(--color-race-red)]" : "text-[color:var(--topbar-icon-color,var(--muted))] hover:text-[color:var(--topbar-icon-hover-color,var(--foreground))] hover:bg-[color:var(--topbar-icon-hover-bg,transparent)]";
|
|
57
122
|
return [
|
|
@@ -580,6 +645,96 @@ function NavDisplayAction({
|
|
|
580
645
|
}
|
|
581
646
|
);
|
|
582
647
|
}
|
|
648
|
+
function useThemePreference() {
|
|
649
|
+
const ctx = react.useContext(NavChromeContext);
|
|
650
|
+
const fetchJson = ctx?.fetchJson ?? null;
|
|
651
|
+
const [value, setValueState] = react.useState("system");
|
|
652
|
+
const reconciled = react.useRef(false);
|
|
653
|
+
react.useEffect(() => {
|
|
654
|
+
const cookie = readThemeCookie();
|
|
655
|
+
let ls = null;
|
|
656
|
+
try {
|
|
657
|
+
ls = localStorage.getItem(THEME_STORAGE_KEY);
|
|
658
|
+
} catch {
|
|
659
|
+
}
|
|
660
|
+
const pref = cookie ?? (isThemePreference(ls) ? ls : null) ?? "system";
|
|
661
|
+
setValueState(pref);
|
|
662
|
+
applyThemePreference(pref);
|
|
663
|
+
}, []);
|
|
664
|
+
react.useEffect(() => {
|
|
665
|
+
if (!fetchJson || reconciled.current) return;
|
|
666
|
+
reconciled.current = true;
|
|
667
|
+
fetchJson("me").then((data) => {
|
|
668
|
+
const pref = data?.themePreference;
|
|
669
|
+
if (isThemePreference(pref)) {
|
|
670
|
+
setValueState(pref);
|
|
671
|
+
applyThemePreference(pref);
|
|
672
|
+
writeThemeCookie(pref);
|
|
673
|
+
try {
|
|
674
|
+
localStorage.setItem(THEME_STORAGE_KEY, pref);
|
|
675
|
+
} catch {
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}).catch(() => {
|
|
679
|
+
});
|
|
680
|
+
}, [fetchJson]);
|
|
681
|
+
react.useEffect(() => {
|
|
682
|
+
const onStorage = (e) => {
|
|
683
|
+
if (e.key === THEME_STORAGE_KEY && isThemePreference(e.newValue)) {
|
|
684
|
+
setValueState(e.newValue);
|
|
685
|
+
applyThemePreference(e.newValue);
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
const onWake = () => {
|
|
689
|
+
const cookie = readThemeCookie();
|
|
690
|
+
if (cookie) {
|
|
691
|
+
setValueState((prev) => {
|
|
692
|
+
if (cookie !== prev) applyThemePreference(cookie);
|
|
693
|
+
return cookie;
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
window.addEventListener("storage", onStorage);
|
|
698
|
+
window.addEventListener("focus", onWake);
|
|
699
|
+
document.addEventListener("visibilitychange", onWake);
|
|
700
|
+
return () => {
|
|
701
|
+
window.removeEventListener("storage", onStorage);
|
|
702
|
+
window.removeEventListener("focus", onWake);
|
|
703
|
+
document.removeEventListener("visibilitychange", onWake);
|
|
704
|
+
};
|
|
705
|
+
}, []);
|
|
706
|
+
react.useEffect(() => {
|
|
707
|
+
if (value !== "system") return;
|
|
708
|
+
let mq;
|
|
709
|
+
try {
|
|
710
|
+
mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
711
|
+
} catch {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
const onChange = () => applyThemePreference("system");
|
|
715
|
+
mq.addEventListener("change", onChange);
|
|
716
|
+
return () => mq.removeEventListener("change", onChange);
|
|
717
|
+
}, [value]);
|
|
718
|
+
const setValue = react.useCallback(
|
|
719
|
+
(next) => {
|
|
720
|
+
setValueState(next);
|
|
721
|
+
applyThemePreference(next);
|
|
722
|
+
writeThemeCookie(next);
|
|
723
|
+
try {
|
|
724
|
+
localStorage.setItem(THEME_STORAGE_KEY, next);
|
|
725
|
+
} catch {
|
|
726
|
+
}
|
|
727
|
+
fetchJson?.("me/preferences", {
|
|
728
|
+
method: "PATCH",
|
|
729
|
+
headers: { "Content-Type": "application/json" },
|
|
730
|
+
body: JSON.stringify({ themePreference: next })
|
|
731
|
+
}).catch(() => {
|
|
732
|
+
});
|
|
733
|
+
},
|
|
734
|
+
[fetchJson]
|
|
735
|
+
);
|
|
736
|
+
return { value, setValue };
|
|
737
|
+
}
|
|
583
738
|
|
|
584
739
|
// src/native/standardNav.ts
|
|
585
740
|
var CONTACTS_DEFAULT_CHILDREN = [
|
|
@@ -856,7 +1011,7 @@ function NavSidebar({
|
|
|
856
1011
|
] })
|
|
857
1012
|
] }),
|
|
858
1013
|
footer ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 border-t border-[color:var(--line)] px-4 py-3", children: [
|
|
859
|
-
footer.links && footer.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", children: footer.links.map((l, idx) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
1014
|
+
footer.links && footer.links.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center justify-center gap-1.5 text-xs", children: footer.links.map((l, idx) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
860
1015
|
idx > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--muted)]", children: "|" }) : null,
|
|
861
1016
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
862
1017
|
"a",
|
|
@@ -888,14 +1043,12 @@ function NavSidebar({
|
|
|
888
1043
|
] })
|
|
889
1044
|
] }),
|
|
890
1045
|
footer.commitDate || footer.commitAuthor ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
891
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--muted)]", children: "|" }),
|
|
892
1046
|
footer.commitDate ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: new Date(footer.commitDate).toLocaleDateString(void 0, {
|
|
893
1047
|
month: "short",
|
|
894
1048
|
day: "numeric"
|
|
895
1049
|
}) }) : null,
|
|
896
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--muted)]", children: "|" }),
|
|
897
|
-
footer.commitAuthor ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: footer.commitAuthor.split(/\s+/)[0] }) : null
|
|
898
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--muted)]", children: "|" })
|
|
1050
|
+
footer.commitDate && footer.commitAuthor ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[color:var(--muted)]", children: "|" }) : null,
|
|
1051
|
+
footer.commitAuthor ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: footer.commitAuthor.split(/\s+/)[0] }) : null
|
|
899
1052
|
] }) : null
|
|
900
1053
|
] })
|
|
901
1054
|
] }) : null
|
|
@@ -1426,5 +1579,6 @@ exports.isNavItemActive = isNavItemActive;
|
|
|
1426
1579
|
exports.standardPolitogyNav = standardPolitogyNav;
|
|
1427
1580
|
exports.topBarIconButtonClass = topBarIconButtonClass;
|
|
1428
1581
|
exports.useChromeOrgs = useChromeOrgs;
|
|
1582
|
+
exports.useThemePreference = useThemePreference;
|
|
1429
1583
|
//# sourceMappingURL=native.cjs.map
|
|
1430
1584
|
//# sourceMappingURL=native.cjs.map
|