@lerianstudio/sindarian-ui 2.0.0-beta.27 → 2.0.0-beta.29
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/components/ui/alert/styles.css +1 -1
- package/dist/components/ui/card/index.d.ts.map +1 -1
- package/dist/components/ui/card/index.js +1 -1
- package/dist/esm/components/ui/card/index.d.ts.map +1 -1
- package/dist/esm/components/ui/card/index.js +1 -1
- package/dist/esm/theme/mode-toggle.d.ts +3 -2
- package/dist/esm/theme/mode-toggle.d.ts.map +1 -1
- package/dist/esm/theme/mode-toggle.js +1 -1
- package/dist/esm/theme/theme-provider.d.ts.map +1 -1
- package/dist/esm/theme/theme-provider.js +1 -1
- package/dist/theme/mode-toggle.d.ts +3 -2
- package/dist/theme/mode-toggle.d.ts.map +1 -1
- package/dist/theme/mode-toggle.js +1 -1
- package/dist/theme/theme-provider.d.ts.map +1 -1
- package/dist/theme/theme-provider.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,iBAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWjE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQvE;AAED,KAAK,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;IACjD;;;;OAIG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,EAA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A"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Card=Card;exports.CardHeader=CardHeader;exports.CardFooter=CardFooter;exports.CardTitle=CardTitle;exports.CardAction=CardAction;exports.CardDescription=CardDescription;exports.CardContent=CardContent;const jsx_runtime_1=require("react/jsx-runtime");const utils_1=require("../../../lib/utils");function Card({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card",className:(0,utils_1.cn)("bg-card text-card-foreground flex flex-col gap-3 rounded-lg p-6 shadow-xs",t),...e})}function CardHeader({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-header",className:(0,utils_1.cn)("flex flex-col space-y-1.5",t),...e})}function CardTitle({className:t,as:e="h3",...r}){return(0,jsx_runtime_1.jsx)(e,{"data-slot":"card-title",className:(0,utils_1.cn)("text-sm leading-none font-medium",t),...r})}function CardDescription({className:t,...e}){return(0,jsx_runtime_1.jsx)("p",{"data-slot":"card-description",className:(0,utils_1.cn)("text-muted-foreground text-sm",t),...e})}function CardAction({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-action",className:(0,utils_1.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...e})}function CardContent({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-content",className:(0,utils_1.cn)("pt-0",t),...e})}function CardFooter({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-footer",className:(0,utils_1.cn)("flex items-center p-6 pt-0",t),...e})}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Card=Card;exports.CardHeader=CardHeader;exports.CardFooter=CardFooter;exports.CardTitle=CardTitle;exports.CardAction=CardAction;exports.CardDescription=CardDescription;exports.CardContent=CardContent;const jsx_runtime_1=require("react/jsx-runtime");const utils_1=require("../../../lib/utils");function Card({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card",className:(0,utils_1.cn)("bg-card text-card-foreground flex flex-col gap-3 rounded-lg p-6 shadow-xs",t),...e})}function CardHeader({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-header",className:(0,utils_1.cn)("flex flex-col space-y-1.5",t),...e})}function CardTitle({className:t,as:e="h3",...r}){return(0,jsx_runtime_1.jsx)(e,{"data-slot":"card-title",className:(0,utils_1.cn)("text-foreground text-sm leading-none font-medium",t),...r})}function CardDescription({className:t,...e}){return(0,jsx_runtime_1.jsx)("p",{"data-slot":"card-description",className:(0,utils_1.cn)("text-muted-foreground text-sm",t),...e})}function CardAction({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-action",className:(0,utils_1.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...e})}function CardContent({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-content",className:(0,utils_1.cn)("pt-0",t),...e})}function CardFooter({className:t,...e}){return(0,jsx_runtime_1.jsx)("div",{"data-slot":"card-footer",className:(0,utils_1.cn)("flex items-center p-6 pt-0",t),...e})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,iBAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWjE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQvE;AAED,KAAK,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;IACjD;;;;OAIG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC7C,CAAA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,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACZ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{cn as e}from"../../../lib/utils.js";function d({className:t,...a}){return r("div",{"data-slot":"card",className:e("bg-card text-card-foreground flex flex-col gap-3 rounded-lg p-6 shadow-xs",t),...a})}function n({className:t,...a}){return r("div",{"data-slot":"card-header",className:e("flex flex-col space-y-1.5",t),...a})}function s({className:t,as:a="h3",...o}){return r(a,{"data-slot":"card-title",className:e("text-sm leading-none font-medium",t),...o})}function c({className:t,...a}){return r("p",{"data-slot":"card-description",className:e("text-muted-foreground text-sm",t),...a})}function l({className:t,...a}){return r("div",{"data-slot":"card-action",className:e("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function i({className:t,...a}){return r("div",{"data-slot":"card-content",className:e("pt-0",t),...a})}function f({className:t,...a}){return r("div",{"data-slot":"card-footer",className:e("flex items-center p-6 pt-0",t),...a})}export{d as Card,n as CardHeader,f as CardFooter,s as CardTitle,l as CardAction,c as CardDescription,i as CardContent};
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{cn as e}from"../../../lib/utils.js";function d({className:t,...a}){return r("div",{"data-slot":"card",className:e("bg-card text-card-foreground flex flex-col gap-3 rounded-lg p-6 shadow-xs",t),...a})}function n({className:t,...a}){return r("div",{"data-slot":"card-header",className:e("flex flex-col space-y-1.5",t),...a})}function s({className:t,as:a="h3",...o}){return r(a,{"data-slot":"card-title",className:e("text-foreground text-sm leading-none font-medium",t),...o})}function c({className:t,...a}){return r("p",{"data-slot":"card-description",className:e("text-muted-foreground text-sm",t),...a})}function l({className:t,...a}){return r("div",{"data-slot":"card-action",className:e("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function i({className:t,...a}){return r("div",{"data-slot":"card-content",className:e("pt-0",t),...a})}function f({className:t,...a}){return r("div",{"data-slot":"card-footer",className:e("flex items-center p-6 pt-0",t),...a})}export{d as Card,n as CardHeader,f as CardFooter,s as CardTitle,l as CardAction,c as CardDescription,i as CardContent};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* ModeToggle — compact segmented light/system/dark control.
|
|
3
3
|
*
|
|
4
4
|
* Follows the lib's segmented canon: a `role="group"` with an aria-label, each
|
|
5
|
-
* segment a button carrying `aria-pressed
|
|
6
|
-
* `
|
|
5
|
+
* segment a button carrying `aria-pressed`. The active segment is inverted and
|
|
6
|
+
* the frame uses `border-input-border`, so both clear 3:1 on `--card` in both
|
|
7
|
+
* themes (WCAG 1.4.11). Icon-only segments and the group itself carry
|
|
7
8
|
* plain-English aria-labels by default; pass `labels` to localize them
|
|
8
9
|
* (`labels.group` names the whole control). Theme switches are instant — the
|
|
9
10
|
* 150ms transition is the local color-only hover affordance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mode-toggle.d.ts","sourceRoot":"","sources":["../../../src/theme/mode-toggle.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"mode-toggle.d.ts","sourceRoot":"","sources":["../../../src/theme/mode-toggle.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAoCD,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,eAAe,qBAqChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n}from"react/jsx-runtime";import{Monitor as m,Moon as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Monitor as m,Moon as g,Sun as f}from"lucide-react";import{cn as d}from"../lib/utils.js";import{useTheme as b}from"./theme-provider.js";const p=[{value:"light",icon:f},{value:"system",icon:m},{value:"dark",icon:g}];const l={light:"Light",system:"System",dark:"Dark",group:"Theme"};function h(i){const e={...l};for(const o of Object.keys(l)){const r=i?.[o];if(r?.trim())e[o]=r}return e}export function ModeToggle({labels:i,className:e}){const{theme:o,setTheme:r}=b();const s=h(i);return n("div",{role:"group","aria-label":s.group,className:d("border-input-border bg-card grid w-fit grid-cols-3 rounded-md border p-0.5 shadow-[var(--shadow-card)]",e),children:p.map(({value:t,icon:u})=>{const c=t===o;const a=s[t];return n("button",{type:"button","aria-pressed":c,"aria-label":a,title:a,onClick:()=>r(t),className:d("focus-visible:ring-ring flex items-center justify-center rounded-sm px-2 py-1.5 transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:outline-none",c?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:n(u,{className:"size-4","aria-hidden":true})},t)})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAgBzD,KAAK,iBAAiB,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,eAAe,CAAA;IACtB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,mDAAmD;IACnD,aAAa,EAAE,OAAO,GAAG,MAAM,CAAA;CAChC,CAAA;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,UAA8B,EAC9B,YAAuB,EACxB,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAgBzD,KAAK,iBAAiB,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,eAAe,CAAA;IACtB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,mDAAmD;IACnD,aAAa,EAAE,OAAO,GAAG,MAAM,CAAA;CAChC,CAAA;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,UAA8B,EAC9B,YAAuB,EACxB,EAAE,kBAAkB,qBA4FpB;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,SAAS,CAEhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as k}from"react/jsx-runtime";import*as t from"react";const w="(prefers-color-scheme: dark)";function h(o){return o==="light"||o==="dark"||o==="system"}function E(){if(typeof window==="undefined"||typeof window.matchMedia!=="function"){return false}return window.matchMedia(w).matches}const c=t.createContext(null);export function ThemeProvider({children:o,storageKey:r="sindarian.theme",defaultTheme:i="system"}){const[s,a]=t.useState(i);const[u,p]=t.useState(false);const[f,g]=t.useState(i==="dark"?"dark":"light");const m=t.useCallback(e=>{a(e);if(typeof window==="undefined")return;try{window.localStorage.setItem(r,e)}catch{}},[r]);t.useEffect(()=>{if(typeof window==="undefined")return;p(true);try{const e=window.localStorage.getItem(r);if(h(e))a(e)}catch{}},[r]);t.useEffect(()=>{if(typeof document==="undefined"||!u)return;const e=d=>{document.documentElement.classList.toggle("dark",d);g(d?"dark":"light")};e(s==="system"?E():s==="dark");if(s!=="system"||typeof window.matchMedia!=="function"){return}const n=window.matchMedia(w);const l=d=>e(d.matches);n.addEventListener("change",l);return()=>n.removeEventListener("change",l)},[s,u]);t.useEffect(()=>{if(typeof window==="undefined")return;const e=n=>{if(n.storageArea!=null&&n.storageArea!==window.localStorage)return;if(n.key!==null&&n.key!==r)return;a(h(n.newValue)?n.newValue:i)};window.addEventListener("storage",e);return()=>window.removeEventListener("storage",e)},[r,i]);const y=t.useMemo(()=>({theme:s,setTheme:m,resolvedTheme:f}),[s,m,f]);return k(c.Provider,{value:y,children:o})}export function useTheme(){const o=t.useContext(c);if(o===null){throw new Error("useTheme must be used within a ThemeProvider")}return o}export function useOptionalTheme(){return t.useContext(c)??void 0}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* ModeToggle — compact segmented light/system/dark control.
|
|
3
3
|
*
|
|
4
4
|
* Follows the lib's segmented canon: a `role="group"` with an aria-label, each
|
|
5
|
-
* segment a button carrying `aria-pressed
|
|
6
|
-
* `
|
|
5
|
+
* segment a button carrying `aria-pressed`. The active segment is inverted and
|
|
6
|
+
* the frame uses `border-input-border`, so both clear 3:1 on `--card` in both
|
|
7
|
+
* themes (WCAG 1.4.11). Icon-only segments and the group itself carry
|
|
7
8
|
* plain-English aria-labels by default; pass `labels` to localize them
|
|
8
9
|
* (`labels.group` names the whole control). Theme switches are instant — the
|
|
9
10
|
* 150ms transition is the local color-only hover affordance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mode-toggle.d.ts","sourceRoot":"","sources":["../../src/theme/mode-toggle.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"mode-toggle.d.ts","sourceRoot":"","sources":["../../src/theme/mode-toggle.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAoCD,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,eAAe,qBAqChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ModeToggle=ModeToggle;const jsx_runtime_1=require("react/jsx-runtime");const lucide_react_1=require("lucide-react");const utils_1=require("../lib/utils");const theme_provider_1=require("./theme-provider");const SEGMENTS=[{value:"light",icon:lucide_react_1.Sun},{value:"system",icon:lucide_react_1.Monitor},{value:"dark",icon:lucide_react_1.Moon}];const DEFAULT_LABELS={light:"Light",system:"System",dark:"Dark",group:"Theme"};function resolveLabels(s){const e={...DEFAULT_LABELS};for(const r of Object.keys(DEFAULT_LABELS)){const t=s?.[r];if(t?.trim())e[r]=t}return e}function ModeToggle({labels:s,className:e}){const{theme:r,setTheme:t}=(0,theme_provider_1.useTheme)();const i=resolveLabels(s);return(0,jsx_runtime_1.jsx)("div",{role:"group","aria-label":i.group,className:(0,utils_1.cn)("border-input bg-card grid w-fit grid-cols-3 rounded-md border p-0.5 shadow-[var(--shadow-card)]",e),children:SEGMENTS.map(({value:o,icon:u})=>{const n=o===r;const c=i[o];return(0,jsx_runtime_1.jsx)("button",{type:"button","aria-pressed":n,"aria-label":c,title:c,onClick:()=>t(o),className:(0,utils_1.cn)("focus-visible:ring-ring flex items-center justify-center rounded-sm px-2 py-1.5 transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:outline-none",n?"bg-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ModeToggle=ModeToggle;const jsx_runtime_1=require("react/jsx-runtime");const lucide_react_1=require("lucide-react");const utils_1=require("../lib/utils");const theme_provider_1=require("./theme-provider");const SEGMENTS=[{value:"light",icon:lucide_react_1.Sun},{value:"system",icon:lucide_react_1.Monitor},{value:"dark",icon:lucide_react_1.Moon}];const DEFAULT_LABELS={light:"Light",system:"System",dark:"Dark",group:"Theme"};function resolveLabels(s){const e={...DEFAULT_LABELS};for(const r of Object.keys(DEFAULT_LABELS)){const t=s?.[r];if(t?.trim())e[r]=t}return e}function ModeToggle({labels:s,className:e}){const{theme:r,setTheme:t}=(0,theme_provider_1.useTheme)();const i=resolveLabels(s);return(0,jsx_runtime_1.jsx)("div",{role:"group","aria-label":i.group,className:(0,utils_1.cn)("border-input-border bg-card grid w-fit grid-cols-3 rounded-md border p-0.5 shadow-[var(--shadow-card)]",e),children:SEGMENTS.map(({value:o,icon:u})=>{const n=o===r;const c=i[o];return(0,jsx_runtime_1.jsx)("button",{type:"button","aria-pressed":n,"aria-label":c,title:c,onClick:()=>t(o),className:(0,utils_1.cn)("focus-visible:ring-ring flex items-center justify-center rounded-sm px-2 py-1.5 transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:outline-none",n?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:(0,jsx_runtime_1.jsx)(u,{className:"size-4","aria-hidden":true})},o)})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAgBzD,KAAK,iBAAiB,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,eAAe,CAAA;IACtB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,mDAAmD;IACnD,aAAa,EAAE,OAAO,GAAG,MAAM,CAAA;CAChC,CAAA;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,UAA8B,EAC9B,YAAuB,EACxB,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAgBzD,KAAK,iBAAiB,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,eAAe,CAAA;IACtB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,mDAAmD;IACnD,aAAa,EAAE,OAAO,GAAG,MAAM,CAAA;CAChC,CAAA;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,UAA8B,EAC9B,YAAuB,EACxB,EAAE,kBAAkB,qBA4FpB;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,SAAS,CAEhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(n,e,r,t){if(t===void 0)t=r;var
|
|
1
|
+
"use client";"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(n,e,r,t){if(t===void 0)t=r;var o=Object.getOwnPropertyDescriptor(e,r);if(!o||("get"in o?!e.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(n,t,o)}):(function(n,e,r,t){if(t===void 0)t=r;n[t]=e[r]}));var __setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:true,value:e})}):function(n,e){n["default"]=e});var __importStar=this&&this.__importStar||(function(){var n=function(e){n=Object.getOwnPropertyNames||function(r){var t=[];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o))t[t.length]=o;return t};return n(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null){for(var t=n(e),o=0;o<t.length;o++)if(t[o]!=="default")__createBinding(r,e,t[o])}__setModuleDefault(r,e);return r}})();Object.defineProperty(exports,"__esModule",{value:true});exports.ThemeProvider=ThemeProvider;exports.useTheme=useTheme;exports.useOptionalTheme=useOptionalTheme;const jsx_runtime_1=require("react/jsx-runtime");const React=__importStar(require("react"));const DARK_QUERY="(prefers-color-scheme: dark)";function isThemePreference(n){return n==="light"||n==="dark"||n==="system"}function systemPrefersDark(){if(typeof window==="undefined"||typeof window.matchMedia!=="function"){return false}return window.matchMedia(DARK_QUERY).matches}const ThemeContext=React.createContext(null);function ThemeProvider({children:n,storageKey:e="sindarian.theme",defaultTheme:r="system"}){const[t,o]=React.useState(r);const[a,l]=React.useState(false);const[c,h]=React.useState(r==="dark"?"dark":"light");const f=React.useCallback(i=>{o(i);if(typeof window==="undefined")return;try{window.localStorage.setItem(e,i)}catch{}},[e]);React.useEffect(()=>{if(typeof window==="undefined")return;l(true);try{const i=window.localStorage.getItem(e);if(isThemePreference(i))o(i)}catch{}},[e]);React.useEffect(()=>{if(typeof document==="undefined"||!a)return;const i=s=>{document.documentElement.classList.toggle("dark",s);h(s?"dark":"light")};i(t==="system"?systemPrefersDark():t==="dark");if(t!=="system"||typeof window.matchMedia!=="function"){return}const u=window.matchMedia(DARK_QUERY);const d=s=>i(s.matches);u.addEventListener("change",d);return()=>u.removeEventListener("change",d)},[t,a]);React.useEffect(()=>{if(typeof window==="undefined")return;const i=u=>{if(u.storageArea!=null&&u.storageArea!==window.localStorage)return;if(u.key!==null&&u.key!==e)return;o(isThemePreference(u.newValue)?u.newValue:r)};window.addEventListener("storage",i);return()=>window.removeEventListener("storage",i)},[e,r]);const w=React.useMemo(()=>({theme:t,setTheme:f,resolvedTheme:c}),[t,f,c]);return(0,jsx_runtime_1.jsx)(ThemeContext.Provider,{value:w,children:n})}function useTheme(){const n=React.useContext(ThemeContext);if(n===null){throw new Error("useTheme must be used within a ThemeProvider")}return n}function useOptionalTheme(){return React.useContext(ThemeContext)??void 0}
|