cortena-ui 1.1.0 → 1.1.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/index.d.ts +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/use-cortena-theme.ts +12 -4
package/dist/index.d.ts
CHANGED
|
@@ -895,7 +895,7 @@ declare function AvatarFallback({ className, ...props }: Avatar$1.Fallback.Props
|
|
|
895
895
|
* for cortenaweb call sites.
|
|
896
896
|
*/
|
|
897
897
|
declare const badgeVariants: (props?: ({
|
|
898
|
-
variant?: "default" | "success" | "
|
|
898
|
+
variant?: "default" | "success" | "warning" | "warn" | "danger" | "destructive" | "info" | "neutral" | "secondary" | "outline" | null | undefined;
|
|
899
899
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
900
900
|
interface BadgeProps extends React$1.ComponentProps<"span">, VariantProps<typeof badgeVariants> {}
|
|
901
901
|
declare function Badge({ className, variant, ...props }: BadgeProps): React$1.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -6004,17 +6004,20 @@ function subscribeTheme(onChange) {
|
|
|
6004
6004
|
window.removeEventListener("storage", onChange);
|
|
6005
6005
|
};
|
|
6006
6006
|
}
|
|
6007
|
+
function schemeQuery() {
|
|
6008
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(DARK_QUERY) : null;
|
|
6009
|
+
}
|
|
6007
6010
|
function subscribeScheme(onChange) {
|
|
6008
|
-
const query =
|
|
6009
|
-
query
|
|
6011
|
+
const query = schemeQuery();
|
|
6012
|
+
query?.addEventListener("change", onChange);
|
|
6010
6013
|
const unsubscribeTheme = subscribeTheme(onChange);
|
|
6011
6014
|
return () => {
|
|
6012
|
-
query
|
|
6015
|
+
query?.removeEventListener("change", onChange);
|
|
6013
6016
|
unsubscribeTheme();
|
|
6014
6017
|
};
|
|
6015
6018
|
}
|
|
6016
6019
|
function systemScheme() {
|
|
6017
|
-
return
|
|
6020
|
+
return schemeQuery()?.matches ? "dark" : "light";
|
|
6018
6021
|
}
|
|
6019
6022
|
function useCortenaTheme(options = {}) {
|
|
6020
6023
|
const { storageKey = DEFAULT_THEME_STORAGE_KEY, allowedOrigins, listen = true } = options;
|