asterui 0.12.54 → 0.12.55

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.
@@ -0,0 +1,15 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as i, useContext as n } from "react";
3
+ const e = i(void 0);
4
+ function c({ size: t, children: o }) {
5
+ return /* @__PURE__ */ r(e.Provider, { value: t, children: o });
6
+ }
7
+ function f() {
8
+ return n(e);
9
+ }
10
+ export {
11
+ e as SizeContext,
12
+ c as SizeProvider,
13
+ f as useSize
14
+ };
15
+ //# sourceMappingURL=SizeContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SizeContext.js","sources":["../../src/contexts/SizeContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react'\n\nexport type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\nexport const SizeContext = createContext<Size | undefined>(undefined)\n\nexport interface SizeProviderProps {\n /** Size to provide to child components */\n size: Size\n /** Child components */\n children: React.ReactNode\n}\n\n/**\n * Provides size context to child components.\n *\n * Used by Button, CopyButton, and other sized components to transmit\n * their size to child icons, allowing icons to automatically match\n * the parent component's size.\n */\nexport function SizeProvider({ size, children }: SizeProviderProps) {\n return (\n <SizeContext.Provider value={size}>\n {children}\n </SizeContext.Provider>\n )\n}\n\n/**\n * Hook to access the current size context.\n * Returns undefined if not within a SizeProvider.\n */\nexport function useSize(): Size | undefined {\n return useContext(SizeContext)\n}\n"],"names":["SizeContext","createContext","SizeProvider","size","children","useSize","useContext"],"mappings":";;AAIO,MAAMA,IAAcC,EAAgC,MAAS;AAgB7D,SAASC,EAAa,EAAE,MAAAC,GAAM,UAAAC,KAA+B;AAClE,2BACGJ,EAAY,UAAZ,EAAqB,OAAOG,GAC1B,UAAAC,GACH;AAEJ;AAMO,SAASC,IAA4B;AAC1C,SAAOC,EAAWN,CAAW;AAC/B;"}
@@ -1,29 +1,39 @@
1
- export interface ThemeColors {
2
- /** Base background color (--b1 / base-100) */
3
- background: string;
4
- /** Base content/text color (--bc / base-content) */
5
- foreground: string;
6
- /** Primary color (--p / primary) */
7
- primary: string;
8
- /** Primary content color (--pc / primary-content) */
9
- primaryContent: string;
10
- }
1
+ import { ThemeColors } from '../components/ThemeProvider';
2
+ export type { ThemeColors };
11
3
  export interface UseThemeReturn {
4
+ /** The theme setting (what user selected). Only available with ThemeProvider. */
5
+ theme: string | undefined;
6
+ /** The actual applied theme. Only available with ThemeProvider. */
7
+ resolvedTheme: string | undefined;
12
8
  /** Whether dark mode is active */
13
9
  isDark: boolean;
10
+ /** Set the theme. Only available with ThemeProvider. */
11
+ setTheme: ((theme: string) => void) | undefined;
14
12
  /** Computed theme colors as hex values */
15
13
  colors: ThemeColors;
14
+ /** The system preference. Only available with ThemeProvider. */
15
+ systemTheme: 'light' | 'dark' | undefined;
16
16
  }
17
17
  /**
18
- * Hook to detect current theme and get computed colors
18
+ * Hook to detect current theme and get computed colors.
19
+ *
20
+ * When used within a ThemeProvider, returns full theme control including
21
+ * setTheme, theme selection, and resolved theme.
19
22
  *
20
- * Checks the `data-theme` attribute on the document root (for DaisyUI themes)
21
- * and falls back to system preference via `prefers-color-scheme`.
23
+ * When used standalone (without ThemeProvider), provides read-only access
24
+ * to isDark and colors based on the current data-theme attribute and
25
+ * system preference.
22
26
  *
23
- * Returns both the dark mode state and computed theme colors as hex values,
24
- * useful for canvas-based components that can't use CSS variables directly.
27
+ * @example
28
+ * // With ThemeProvider (full control)
29
+ * const { theme, setTheme, resolvedTheme, isDark, colors } = useTheme()
30
+ * setTheme('dark')
31
+ * setTheme('system')
25
32
  *
26
- * Automatically updates when theme changes.
33
+ * @example
34
+ * // Without ThemeProvider (read-only)
35
+ * const { isDark, colors } = useTheme()
36
+ * // colors.primary, colors.foreground, etc.
27
37
  */
28
38
  export declare function useTheme(): UseThemeReturn;
29
39
  export default useTheme;
@@ -1,56 +1,117 @@
1
- import { useState as m, useEffect as i } from "react";
2
- function c(t) {
3
- const r = document.createElement("canvas");
4
- r.width = r.height = 1;
5
- const e = r.getContext("2d");
6
- if (!e) return "#000000";
7
- e.fillStyle = t, e.fillRect(0, 0, 1, 1);
8
- const [o, n, a] = e.getImageData(0, 0, 1, 1).data;
9
- return `#${((1 << 24) + (o << 16) + (n << 8) + a).toString(16).slice(1)}`;
1
+ import { useState as i, useEffect as u, useMemo as m } from "react";
2
+ import { useHasThemeProvider as d, useThemeContext as l } from "../components/ThemeProvider.js";
3
+ const h = /* @__PURE__ */ new Set([
4
+ "dark",
5
+ "synthwave",
6
+ "halloween",
7
+ "forest",
8
+ "black",
9
+ "luxury",
10
+ "dracula",
11
+ "business",
12
+ "night",
13
+ "coffee",
14
+ "dim",
15
+ "sunset"
16
+ ]);
17
+ function g(r) {
18
+ if (typeof document > "u") return "#000000";
19
+ const e = document.createElement("canvas");
20
+ e.width = e.height = 1;
21
+ const t = e.getContext("2d");
22
+ if (!t) return "#000000";
23
+ t.fillStyle = r, t.fillRect(0, 0, 1, 1);
24
+ const [n, o, s] = t.getImageData(0, 0, 1, 1).data;
25
+ return `#${((1 << 24) + (n << 16) + (o << 8) + s).toString(16).slice(1)}`;
10
26
  }
11
- function u() {
12
- const t = getComputedStyle(document.documentElement), r = t.getPropertyValue("--b1").trim(), e = t.getPropertyValue("--bc").trim(), o = t.getPropertyValue("--p").trim(), n = t.getPropertyValue("--pc").trim();
27
+ function a() {
28
+ if (typeof document > "u")
29
+ return {
30
+ background: "#ffffff",
31
+ foreground: "#000000",
32
+ primary: "#6366f1",
33
+ primaryContent: "#ffffff",
34
+ secondary: "#f000b8",
35
+ accent: "#37cdbe",
36
+ info: "#3abff8",
37
+ success: "#36d399",
38
+ warning: "#fbbd23",
39
+ error: "#f87272"
40
+ };
41
+ const r = getComputedStyle(document.documentElement), e = (t, n) => {
42
+ const o = r.getPropertyValue(t).trim();
43
+ return o ? g(o) : n;
44
+ };
13
45
  return {
14
- background: r ? c(`oklch(${r})`) : "#ffffff",
15
- foreground: e ? c(`oklch(${e})`) : "#000000",
16
- primary: o ? c(`oklch(${o})`) : "#6366f1",
17
- primaryContent: n ? c(`oklch(${n})`) : "#ffffff"
46
+ background: e("--color-base-100", "#ffffff"),
47
+ foreground: e("--color-base-content", "#000000"),
48
+ primary: e("--color-primary", "#6366f1"),
49
+ primaryContent: e("--color-primary-content", "#ffffff"),
50
+ secondary: e("--color-secondary", "#f000b8"),
51
+ accent: e("--color-accent", "#37cdbe"),
52
+ info: e("--color-info", "#3abff8"),
53
+ success: e("--color-success", "#36d399"),
54
+ warning: e("--color-warning", "#fbbd23"),
55
+ error: e("--color-error", "#f87272")
18
56
  };
19
57
  }
20
- function d() {
21
- const [t, r] = m({
58
+ function y() {
59
+ return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
60
+ }
61
+ function b() {
62
+ return typeof document > "u" ? null : document.documentElement.getAttribute("data-theme");
63
+ }
64
+ function k() {
65
+ if (d()) {
66
+ const e = l();
67
+ return {
68
+ theme: e.theme,
69
+ resolvedTheme: e.resolvedTheme,
70
+ isDark: e.isDark,
71
+ setTheme: e.setTheme,
72
+ colors: e.colors,
73
+ systemTheme: e.systemTheme
74
+ };
75
+ }
76
+ return T();
77
+ }
78
+ function T() {
79
+ const [r, e] = i(() => ({
22
80
  isDark: !1,
23
- colors: {
24
- background: "#ffffff",
25
- foreground: "#000000",
26
- primary: "#6366f1",
27
- primaryContent: "#ffffff"
28
- }
29
- });
30
- return i(() => {
31
- const e = () => {
32
- const s = document.documentElement.getAttribute("data-theme"), f = s === "dark" || !s && window.matchMedia("(prefers-color-scheme: dark)").matches;
33
- requestAnimationFrame(() => {
34
- r({
35
- isDark: f,
36
- colors: u()
81
+ colors: a()
82
+ }));
83
+ return u(() => {
84
+ const t = () => {
85
+ const s = b(), f = y();
86
+ let c = !1;
87
+ s ? c = h.has(s) : c = f === "dark", requestAnimationFrame(() => {
88
+ e({
89
+ isDark: c,
90
+ colors: a()
37
91
  });
38
92
  });
39
93
  };
40
- e();
41
- const o = new MutationObserver(e);
42
- o.observe(document.documentElement, {
94
+ t();
95
+ const n = new MutationObserver(t);
96
+ n.observe(document.documentElement, {
43
97
  attributes: !0,
44
98
  attributeFilter: ["data-theme", "class"]
45
99
  });
46
- const n = window.matchMedia("(prefers-color-scheme: dark)");
47
- return n.addEventListener("change", e), () => {
48
- o.disconnect(), n.removeEventListener("change", e);
100
+ const o = window.matchMedia("(prefers-color-scheme: dark)");
101
+ return o.addEventListener("change", t), () => {
102
+ n.disconnect(), o.removeEventListener("change", t);
49
103
  };
50
- }, []), t;
104
+ }, []), m(() => ({
105
+ theme: void 0,
106
+ resolvedTheme: void 0,
107
+ isDark: r.isDark,
108
+ setTheme: void 0,
109
+ colors: r.colors,
110
+ systemTheme: void 0
111
+ }), [r.isDark, r.colors]);
51
112
  }
52
113
  export {
53
- d as default,
54
- d as useTheme
114
+ k as default,
115
+ k as useTheme
55
116
  };
56
117
  //# sourceMappingURL=useTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.js","sources":["../../src/hooks/useTheme.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\n\nexport interface ThemeColors {\n /** Base background color (--b1 / base-100) */\n background: string\n /** Base content/text color (--bc / base-content) */\n foreground: string\n /** Primary color (--p / primary) */\n primary: string\n /** Primary content color (--pc / primary-content) */\n primaryContent: string\n}\n\nexport interface UseThemeReturn {\n /** Whether dark mode is active */\n isDark: boolean\n /** Computed theme colors as hex values */\n colors: ThemeColors\n}\n\n// Convert any CSS color to hex\nfunction colorToHex(color: string): string {\n const canvas = document.createElement('canvas')\n canvas.width = canvas.height = 1\n const ctx = canvas.getContext('2d')\n if (!ctx) return '#000000'\n ctx.fillStyle = color\n ctx.fillRect(0, 0, 1, 1)\n const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data\n return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`\n}\n\nfunction getThemeColors(): ThemeColors {\n const style = getComputedStyle(document.documentElement)\n\n // Get computed colors from CSS custom properties\n const background = style.getPropertyValue('--b1').trim()\n const foreground = style.getPropertyValue('--bc').trim()\n const primary = style.getPropertyValue('--p').trim()\n const primaryContent = style.getPropertyValue('--pc').trim()\n\n // DaisyUI uses oklch, convert to hex for canvas compatibility\n return {\n background: background ? colorToHex(`oklch(${background})`) : '#ffffff',\n foreground: foreground ? colorToHex(`oklch(${foreground})`) : '#000000',\n primary: primary ? colorToHex(`oklch(${primary})`) : '#6366f1',\n primaryContent: primaryContent ? colorToHex(`oklch(${primaryContent})`) : '#ffffff',\n }\n}\n\n/**\n * Hook to detect current theme and get computed colors\n *\n * Checks the `data-theme` attribute on the document root (for DaisyUI themes)\n * and falls back to system preference via `prefers-color-scheme`.\n *\n * Returns both the dark mode state and computed theme colors as hex values,\n * useful for canvas-based components that can't use CSS variables directly.\n *\n * Automatically updates when theme changes.\n */\nexport function useTheme(): UseThemeReturn {\n const [state, setState] = useState<UseThemeReturn>({\n isDark: false,\n colors: {\n background: '#ffffff',\n foreground: '#000000',\n primary: '#6366f1',\n primaryContent: '#ffffff',\n }\n })\n\n useEffect(() => {\n const checkTheme = () => {\n const html = document.documentElement\n const theme = html.getAttribute('data-theme')\n // Check for explicit dark theme or system preference\n const isDark = theme === 'dark' ||\n (!theme && window.matchMedia('(prefers-color-scheme: dark)').matches)\n\n // Small delay to ensure CSS variables are updated\n requestAnimationFrame(() => {\n setState({\n isDark,\n colors: getThemeColors()\n })\n })\n }\n\n checkTheme()\n\n // Watch for theme changes via attribute mutation\n const observer = new MutationObserver(checkTheme)\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme', 'class']\n })\n\n // Also watch for system preference changes\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\n mediaQuery.addEventListener('change', checkTheme)\n\n return () => {\n observer.disconnect()\n mediaQuery.removeEventListener('change', checkTheme)\n }\n }, [])\n\n return state\n}\n\nexport default useTheme\n"],"names":["colorToHex","color","canvas","ctx","r","g","b","getThemeColors","style","background","foreground","primary","primaryContent","useTheme","state","setState","useState","useEffect","checkTheme","theme","isDark","observer","mediaQuery"],"mappings":";AAqBA,SAASA,EAAWC,GAAuB;AACzC,QAAMC,IAAS,SAAS,cAAc,QAAQ;AAC9C,EAAAA,EAAO,QAAQA,EAAO,SAAS;AAC/B,QAAMC,IAAMD,EAAO,WAAW,IAAI;AAClC,MAAI,CAACC,EAAK,QAAO;AACjB,EAAAA,EAAI,YAAYF,GAChBE,EAAI,SAAS,GAAG,GAAG,GAAG,CAAC;AACvB,QAAM,CAACC,GAAGC,GAAGC,CAAC,IAAIH,EAAI,aAAa,GAAG,GAAG,GAAG,CAAC,EAAE;AAC/C,SAAO,MAAM,KAAK,OAAOC,KAAK,OAAOC,KAAK,KAAKC,GAAG,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AACzE;AAEA,SAASC,IAA8B;AACrC,QAAMC,IAAQ,iBAAiB,SAAS,eAAe,GAGjDC,IAAaD,EAAM,iBAAiB,MAAM,EAAE,KAAA,GAC5CE,IAAaF,EAAM,iBAAiB,MAAM,EAAE,KAAA,GAC5CG,IAAUH,EAAM,iBAAiB,KAAK,EAAE,KAAA,GACxCI,IAAiBJ,EAAM,iBAAiB,MAAM,EAAE,KAAA;AAGtD,SAAO;AAAA,IACL,YAAYC,IAAaT,EAAW,SAASS,CAAU,GAAG,IAAI;AAAA,IAC9D,YAAYC,IAAaV,EAAW,SAASU,CAAU,GAAG,IAAI;AAAA,IAC9D,SAASC,IAAUX,EAAW,SAASW,CAAO,GAAG,IAAI;AAAA,IACrD,gBAAgBC,IAAiBZ,EAAW,SAASY,CAAc,GAAG,IAAI;AAAA,EAAA;AAE9E;AAaO,SAASC,IAA2B;AACzC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAyB;AAAA,IACjD,QAAQ;AAAA,IACR,QAAQ;AAAA,MACN,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,gBAAgB;AAAA,IAAA;AAAA,EAClB,CACD;AAED,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAa,MAAM;AAEvB,YAAMC,IADO,SAAS,gBACH,aAAa,YAAY,GAEtCC,IAASD,MAAU,UACtB,CAACA,KAAS,OAAO,WAAW,8BAA8B,EAAE;AAG/D,4BAAsB,MAAM;AAC1B,QAAAJ,EAAS;AAAA,UACP,QAAAK;AAAA,UACA,QAAQb,EAAA;AAAA,QAAe,CACxB;AAAA,MACH,CAAC;AAAA,IACH;AAEA,IAAAW,EAAA;AAGA,UAAMG,IAAW,IAAI,iBAAiBH,CAAU;AAChD,IAAAG,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,cAAc,OAAO;AAAA,IAAA,CACxC;AAGD,UAAMC,IAAa,OAAO,WAAW,8BAA8B;AACnE,WAAAA,EAAW,iBAAiB,UAAUJ,CAAU,GAEzC,MAAM;AACX,MAAAG,EAAS,WAAA,GACTC,EAAW,oBAAoB,UAAUJ,CAAU;AAAA,IACrD;AAAA,EACF,GAAG,CAAA,CAAE,GAEEJ;AACT;"}
1
+ {"version":3,"file":"useTheme.js","sources":["../../src/hooks/useTheme.ts"],"sourcesContent":["import { useEffect, useState, useMemo } from 'react'\nimport { useHasThemeProvider, useThemeContext, type ThemeColors } from '../components/ThemeProvider'\n\nexport type { ThemeColors }\n\n// Common dark themes in DaisyUI\nconst DARK_THEMES = new Set([\n 'dark', 'synthwave', 'halloween', 'forest', 'black', 'luxury', 'dracula',\n 'business', 'night', 'coffee', 'dim', 'sunset'\n])\n\nexport interface UseThemeReturn {\n /** The theme setting (what user selected). Only available with ThemeProvider. */\n theme: string | undefined\n /** The actual applied theme. Only available with ThemeProvider. */\n resolvedTheme: string | undefined\n /** Whether dark mode is active */\n isDark: boolean\n /** Set the theme. Only available with ThemeProvider. */\n setTheme: ((theme: string) => void) | undefined\n /** Computed theme colors as hex values */\n colors: ThemeColors\n /** The system preference. Only available with ThemeProvider. */\n systemTheme: 'light' | 'dark' | undefined\n}\n\n// Convert any CSS color to hex\nfunction colorToHex(color: string): string {\n if (typeof document === 'undefined') return '#000000'\n const canvas = document.createElement('canvas')\n canvas.width = canvas.height = 1\n const ctx = canvas.getContext('2d')\n if (!ctx) return '#000000'\n ctx.fillStyle = color\n ctx.fillRect(0, 0, 1, 1)\n const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data\n return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`\n}\n\nfunction getThemeColors(): ThemeColors {\n if (typeof document === 'undefined') {\n return {\n background: '#ffffff',\n foreground: '#000000',\n primary: '#6366f1',\n primaryContent: '#ffffff',\n secondary: '#f000b8',\n accent: '#37cdbe',\n info: '#3abff8',\n success: '#36d399',\n warning: '#fbbd23',\n error: '#f87272',\n }\n }\n\n const style = getComputedStyle(document.documentElement)\n const getColor = (varName: string, fallback: string): string => {\n const value = style.getPropertyValue(varName).trim()\n return value ? colorToHex(value) : fallback\n }\n\n return {\n background: getColor('--color-base-100', '#ffffff'),\n foreground: getColor('--color-base-content', '#000000'),\n primary: getColor('--color-primary', '#6366f1'),\n primaryContent: getColor('--color-primary-content', '#ffffff'),\n secondary: getColor('--color-secondary', '#f000b8'),\n accent: getColor('--color-accent', '#37cdbe'),\n info: getColor('--color-info', '#3abff8'),\n success: getColor('--color-success', '#36d399'),\n warning: getColor('--color-warning', '#fbbd23'),\n error: getColor('--color-error', '#f87272'),\n }\n}\n\nfunction getSystemTheme(): 'light' | 'dark' {\n if (typeof window === 'undefined') return 'light'\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n}\n\nfunction getCurrentTheme(): string | null {\n if (typeof document === 'undefined') return null\n return document.documentElement.getAttribute('data-theme')\n}\n\n/**\n * Hook to detect current theme and get computed colors.\n *\n * When used within a ThemeProvider, returns full theme control including\n * setTheme, theme selection, and resolved theme.\n *\n * When used standalone (without ThemeProvider), provides read-only access\n * to isDark and colors based on the current data-theme attribute and\n * system preference.\n *\n * @example\n * // With ThemeProvider (full control)\n * const { theme, setTheme, resolvedTheme, isDark, colors } = useTheme()\n * setTheme('dark')\n * setTheme('system')\n *\n * @example\n * // Without ThemeProvider (read-only)\n * const { isDark, colors } = useTheme()\n * // colors.primary, colors.foreground, etc.\n */\nexport function useTheme(): UseThemeReturn {\n const hasProvider = useHasThemeProvider()\n\n // If we have a provider, use its context\n if (hasProvider) {\n // This is safe because hasProvider is stable after initial render\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const context = useThemeContext()\n return {\n theme: context.theme,\n resolvedTheme: context.resolvedTheme,\n isDark: context.isDark,\n setTheme: context.setTheme,\n colors: context.colors,\n systemTheme: context.systemTheme,\n }\n }\n\n // Standalone mode - no provider\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useThemeStandalone()\n}\n\n/**\n * Standalone theme detection (no ThemeProvider)\n */\nfunction useThemeStandalone(): UseThemeReturn {\n const [state, setState] = useState<{ isDark: boolean; colors: ThemeColors }>(() => ({\n isDark: false,\n colors: getThemeColors(),\n }))\n\n useEffect(() => {\n const updateTheme = () => {\n const currentTheme = getCurrentTheme()\n const systemTheme = getSystemTheme()\n\n // Determine if dark based on data-theme or system preference\n let isDark = false\n if (currentTheme) {\n isDark = DARK_THEMES.has(currentTheme)\n } else {\n isDark = systemTheme === 'dark'\n }\n\n // Update colors after a frame\n requestAnimationFrame(() => {\n setState({\n isDark,\n colors: getThemeColors(),\n })\n })\n }\n\n updateTheme()\n\n // Watch for theme changes via attribute mutation\n const observer = new MutationObserver(updateTheme)\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme', 'class']\n })\n\n // Watch for system preference changes\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\n mediaQuery.addEventListener('change', updateTheme)\n\n return () => {\n observer.disconnect()\n mediaQuery.removeEventListener('change', updateTheme)\n }\n }, [])\n\n return useMemo(() => ({\n theme: undefined,\n resolvedTheme: undefined,\n isDark: state.isDark,\n setTheme: undefined,\n colors: state.colors,\n systemTheme: undefined,\n }), [state.isDark, state.colors])\n}\n\nexport default useTheme\n"],"names":["DARK_THEMES","colorToHex","color","canvas","ctx","r","g","b","getThemeColors","style","getColor","varName","fallback","value","getSystemTheme","getCurrentTheme","useTheme","useHasThemeProvider","context","useThemeContext","useThemeStandalone","state","setState","useState","useEffect","updateTheme","currentTheme","systemTheme","isDark","observer","mediaQuery","useMemo"],"mappings":"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"}
package/dist/index.d.ts CHANGED
@@ -14,8 +14,8 @@ export { Breadcrumb } from './components/Breadcrumb';
14
14
  export type { BreadcrumbProps, BreadcrumbItemProps } from './components/Breadcrumb';
15
15
  export { Button } from './components/Button';
16
16
  export type { ButtonProps } from './components/Button';
17
- export { IconSizeContext } from './contexts/IconSizeContext';
18
- export type { IconSize } from './contexts/IconSizeContext';
17
+ export { SizeContext, SizeProvider, useSize } from './contexts/SizeContext';
18
+ export type { Size } from './contexts/SizeContext';
19
19
  export { CopyButton } from './components/CopyButton';
20
20
  export type { CopyButtonProps, CopyButtonPosition } from './components/CopyButton';
21
21
  export { Checkbox } from './components/Checkbox';
@@ -174,6 +174,8 @@ export { Tag, CheckableTag, TagLiveRegion } from './components/Tag';
174
174
  export type { TagProps, CheckableTagProps, TagSize, TagColor, TagVariant } from './components/Tag';
175
175
  export { ThemeController } from './components/ThemeController';
176
176
  export type { ThemeControllerSwapProps, ThemeControllerDropdownProps, ThemeControllerToggleProps } from './components/ThemeController';
177
+ export { ThemeProvider, useThemeContext, useHasThemeProvider } from './components/ThemeProvider';
178
+ export type { ThemeProviderProps, ThemeContextValue } from './components/ThemeProvider';
177
179
  export { TimePicker } from './components/TimePicker';
178
180
  export type { TimePickerProps } from './components/TimePicker';
179
181
  export { Timeline } from './components/Timeline';