@tooark/tokens 1.1.0 → 1.2.0
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/README.md +2 -1
- package/README.pt-BR.md +2 -1
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +48 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ The `@tooark/tokens` package provides:
|
|
|
28
28
|
|
|
29
29
|
- `tokens.css`: a `@theme static` block with semantic colors (`primary`, `secondary`, `success`, `warning`, `danger`, `info`, `neutral`, plus `surface*`, `fg*`, `border*`, `muted`, `ring`) as `light-dark()` values, the size scale (`--size-xs…xl`) and the `--text-2xs` step (no radii: the `rounded` scale is Tailwind's own, `ArkRounded` only types it);
|
|
30
30
|
- motion tokens outside `@theme`: `--ark-duration-*` (eight steps), `--ark-ease-*` (`linear`, `standard`, `in`, `out`, `in-out`, `overshoot`, `sheet`) and `--ark-motion-distance`, zeroed under `prefers-reduced-motion`;
|
|
31
|
-
- JS mirrors of the motion tokens (`ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`) for WAAPI fallbacks;
|
|
31
|
+
- JS mirrors of the motion tokens (`ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`) for WAAPI fallbacks, and of the size scale (`ARK_SIZE_CSS`) and each intent's soft colors (`ARK_INTENT_SOFT_CSS`) for `var()` fallbacks when the tokens CSS is not on the page;
|
|
32
32
|
- `resolveColorScheme(element)` and `observeColorScheme(element, onChange)` to resolve and follow the page theme;
|
|
33
33
|
- the primitive types every package shares: `ArkIntent`, `ArkSize`, `ArkRounded`, `ArkTheme`, `ArkDuration`, `ArkEasing`.
|
|
34
34
|
|
|
@@ -79,6 +79,7 @@ Names as the Tooark stylesheets expose them; in your own Tailwind entry the `@th
|
|
|
79
79
|
- `resolveColorScheme(element?)` → `"light" | "dark"` from the element's computed `color-scheme` (system preference when the page leaves it at `light dark`).
|
|
80
80
|
- `observeColorScheme(element, onChange)` → dispose function; watches `class`, `style`, `data-theme` and `theme` on `<html>`/`<body>` plus the system preference.
|
|
81
81
|
- `ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`.
|
|
82
|
+
- `ARK_SIZE_CSS` (`{ xs: "1.5rem", … }`, mirror of `--ark-size-*`) and `ARK_INTENT_SOFT_CSS` (`{ primary: { soft, softFg }, … }`, the `light-dark()` values of `--ark-color-<intent>-soft`/`-soft-fg`, resolved by the `color-scheme` of the element that uses them): `var(--ark-color-info-soft, ${ARK_INTENT_SOFT_CSS.info.soft})`.
|
|
82
83
|
- Types: `ArkIntent`, `ArkSize`, `ArkRounded`, `ArkStyleVariant`, `ArkTheme`, `ArkThemeSelected`, `ArkDuration`, `ArkEasing`.
|
|
83
84
|
|
|
84
85
|
---
|
package/README.pt-BR.md
CHANGED
|
@@ -28,7 +28,7 @@ O pacote `@tooark/tokens` fornece:
|
|
|
28
28
|
|
|
29
29
|
- `tokens.css`: um bloco `@theme static` com as cores semânticas (`primary`, `secondary`, `success`, `warning`, `danger`, `info`, `neutral`, mais `surface*`, `fg*`, `border*`, `muted`, `ring`) em `light-dark()`, a escala de tamanhos (`--size-xs…xl`) e o degrau `--text-2xs` (sem raios: a escala de `rounded` é a do próprio Tailwind, o `ArkRounded` só a tipa);
|
|
30
30
|
- tokens de motion fora do `@theme`: `--ark-duration-*` (oito passos), `--ark-ease-*` (`linear`, `standard`, `in`, `out`, `in-out`, `overshoot`, `sheet`) e `--ark-motion-distance`, zerados sob `prefers-reduced-motion`;
|
|
31
|
-
- espelhos JS dos tokens de motion (`ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`) para fallback em WAAPI;
|
|
31
|
+
- espelhos JS dos tokens de motion (`ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`) para fallback em WAAPI, e da escala de tamanhos (`ARK_SIZE_CSS`) e das cores suaves de cada intent (`ARK_INTENT_SOFT_CSS`) para fallback em `var()` quando o CSS dos tokens não está na página;
|
|
32
32
|
- `resolveColorScheme(element)` e `observeColorScheme(element, onChange)` para resolver e acompanhar o tema da página;
|
|
33
33
|
- os tipos primitivos que todos os pacotes compartilham: `ArkIntent`, `ArkSize`, `ArkRounded`, `ArkTheme`, `ArkDuration`, `ArkEasing`.
|
|
34
34
|
|
|
@@ -79,6 +79,7 @@ Nomes como as folhas de estilo do Tooark os expõem; na sua própria entrada do
|
|
|
79
79
|
- `resolveColorScheme(element?)` → `"light" | "dark"` pelo `color-scheme` computado do elemento (preferência do sistema quando a página deixa em `light dark`).
|
|
80
80
|
- `observeColorScheme(element, onChange)` → função de dispose; observa `class`, `style`, `data-theme` e `theme` em `<html>`/`<body>` mais a preferência do sistema.
|
|
81
81
|
- `ARK_DURATION_MS`, `ARK_EASING_CSS`, `ARK_MOTION_DISTANCE`.
|
|
82
|
+
- `ARK_SIZE_CSS` (`{ xs: "1.5rem", … }`, espelho de `--ark-size-*`) e `ARK_INTENT_SOFT_CSS` (`{ primary: { soft, softFg }, … }`, os `light-dark()` de `--ark-color-<intent>-soft`/`-soft-fg`, que resolvem pelo `color-scheme` do elemento que os usa): `var(--ark-color-info-soft, ${ARK_INTENT_SOFT_CSS.info.soft})`.
|
|
82
83
|
- Tipos: `ArkIntent`, `ArkSize`, `ArkRounded`, `ArkStyleVariant`, `ArkTheme`, `ArkThemeSelected`, `ArkDuration`, `ArkEasing`.
|
|
83
84
|
|
|
84
85
|
---
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// Cores suaves de cada intent (espelham tokens.css), como `light-dark()`: resolvem
|
|
4
|
+
// pelo color-scheme do elemento que as usa. Servem de fallback em JS quando as
|
|
5
|
+
// custom properties --ark-color-* não estão na página (ex.: CSS de tokens não importado).
|
|
6
|
+
/** Fundo (`soft`) e texto (`softFg`) suaves de cada intent — espelho de --ark-color-<intent>-soft e -soft-fg. */
|
|
7
|
+
const ARK_INTENT_SOFT_CSS = {
|
|
8
|
+
primary: {
|
|
9
|
+
soft: "light-dark(#fffbeb, color-mix(in oklab, #78350f 40%, transparent))",
|
|
10
|
+
softFg: "light-dark(#b45309, #fbbf24)"
|
|
11
|
+
},
|
|
12
|
+
secondary: {
|
|
13
|
+
soft: "light-dark(oklch(98.4% 0.003 247.858), oklch(27.9% 0.041 260.031))",
|
|
14
|
+
softFg: "light-dark(oklch(20.8% 0.042 265.755), oklch(96.8% 0.007 247.896))"
|
|
15
|
+
},
|
|
16
|
+
success: {
|
|
17
|
+
soft: "light-dark(oklch(97.9% 0.021 166.113), color-mix(in oklab, oklch(26.2% 0.051 172.552) 40%, transparent))",
|
|
18
|
+
softFg: "light-dark(oklch(50.8% 0.118 165.612), oklch(84.5% 0.143 164.978))"
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
soft: "light-dark(oklch(98.7% 0.026 102.212), color-mix(in oklab, oklch(42.1% 0.095 57.708) 40%, transparent))",
|
|
22
|
+
softFg: "light-dark(oklch(55.4% 0.135 66.442), oklch(90.5% 0.182 98.111))"
|
|
23
|
+
},
|
|
24
|
+
danger: {
|
|
25
|
+
soft: "light-dark(oklch(97.1% 0.013 17.38), color-mix(in oklab, oklch(25.8% 0.092 26.042) 40%, transparent))",
|
|
26
|
+
softFg: "light-dark(oklch(50.5% 0.213 27.518), oklch(80.8% 0.114 19.571))"
|
|
27
|
+
},
|
|
28
|
+
info: {
|
|
29
|
+
soft: "light-dark(oklch(97.7% 0.013 236.62), color-mix(in oklab, oklch(29.3% 0.066 243.157) 40%, transparent))",
|
|
30
|
+
softFg: "light-dark(oklch(50% 0.134 242.749), oklch(82.8% 0.111 230.318))"
|
|
31
|
+
},
|
|
32
|
+
neutral: {
|
|
33
|
+
soft: "light-dark(oklch(98.5% 0 none), oklch(27.4% 0.006 286.033))",
|
|
34
|
+
softFg: "light-dark(oklch(37% 0.013 285.805), oklch(92% 0.004 286.32))"
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
3
38
|
// Valores canônicos dos motion tokens (espelham tokens.css).
|
|
4
39
|
// Servem de fallback em JS/WAAPI quando as custom properties --ark-* não
|
|
5
40
|
// estão disponíveis no elemento (ex.: CSS de tokens não importado).
|
|
@@ -27,6 +62,18 @@ const ARK_EASING_CSS = {
|
|
|
27
62
|
/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */
|
|
28
63
|
const ARK_MOTION_DISTANCE = "0.75rem";
|
|
29
64
|
|
|
65
|
+
// Valores canônicos da escala de tamanho (espelham tokens.css).
|
|
66
|
+
// Servem de fallback em JS quando as custom properties --ark-size-* não
|
|
67
|
+
// estão na página (ex.: CSS de tokens não importado).
|
|
68
|
+
/** Altura mínima dos controles por tamanho — espelho de --ark-size-*. */
|
|
69
|
+
const ARK_SIZE_CSS = {
|
|
70
|
+
xs: "1.5rem",
|
|
71
|
+
sm: "1.75rem",
|
|
72
|
+
md: "2.25rem",
|
|
73
|
+
lg: "2.75rem",
|
|
74
|
+
xl: "3.25rem"
|
|
75
|
+
};
|
|
76
|
+
|
|
30
77
|
/**
|
|
31
78
|
* Resolve o tema efetivo ("light" | "dark") de um elemento pelo seu color-scheme computado: a página (ou um ancestral
|
|
32
79
|
* com theme="dark") decide, e só "light dark"/"normal" caem na preferência do sistema. Sem DOM devolve "light".
|
|
@@ -84,7 +131,9 @@ function observeColorScheme(element, onChange) {
|
|
|
84
131
|
|
|
85
132
|
exports.ARK_DURATION_MS = ARK_DURATION_MS;
|
|
86
133
|
exports.ARK_EASING_CSS = ARK_EASING_CSS;
|
|
134
|
+
exports.ARK_INTENT_SOFT_CSS = ARK_INTENT_SOFT_CSS;
|
|
87
135
|
exports.ARK_MOTION_DISTANCE = ARK_MOTION_DISTANCE;
|
|
136
|
+
exports.ARK_SIZE_CSS = ARK_SIZE_CSS;
|
|
88
137
|
exports.observeColorScheme = observeColorScheme;
|
|
89
138
|
exports.resolveColorScheme = resolveColorScheme;
|
|
90
139
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/motion.ts","../src/theme.ts"],"sourcesContent":["// Valores canônicos dos motion tokens (espelham tokens.css).\n// Servem de fallback em JS/WAAPI quando as custom properties --ark-* não\n// estão disponíveis no elemento (ex.: CSS de tokens não importado).\n\nimport type { ArkDuration, ArkEasing } from \"./types\";\n\n/** Durações em milissegundos — espelho de --ark-duration-*. */\nexport const ARK_DURATION_MS: Record<ArkDuration, number> = {\n none: 0,\n instant: 75,\n quick: 150,\n default: 250,\n moderate: 350,\n gentle: 500,\n slow: 700,\n long: 1000\n};\n\n/** Easings como strings CSS — espelho de --ark-ease-*. */\nexport const ARK_EASING_CSS: Record<ArkEasing, string> = {\n linear: \"linear\",\n standard: \"cubic-bezier(0.2, 0, 0, 1)\",\n in: \"cubic-bezier(0.4, 0, 1, 1)\",\n out: \"cubic-bezier(0, 0, 0.2, 1)\",\n \"in-out\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n overshoot: \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n sheet: \"cubic-bezier(0.32, 0.72, 0, 1)\"\n};\n\n/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */\nexport const ARK_MOTION_DISTANCE = \"0.75rem\";\n","import type { ArkThemeSelected } from \"./types\";\n\n/**\n * Resolve o tema efetivo (\"light\" | \"dark\") de um elemento pelo seu color-scheme computado: a página (ou um ancestral\n * com theme=\"dark\") decide, e só \"light dark\"/\"normal\" caem na preferência do sistema. Sem DOM devolve \"light\".\n */\nexport function resolveColorScheme(element?: Element | null): ArkThemeSelected {\n // Sem DOM devolve \"light\".\n if (typeof window === \"undefined\") {\n return \"light\";\n }\n\n // Tenta resolver pelo color-scheme computado do elemento.\n if (element && typeof window.getComputedStyle === \"function\") {\n const scheme = window.getComputedStyle(element).colorScheme || \"\";\n const dark = scheme.includes(\"dark\");\n const light = scheme.includes(\"light\");\n\n // Se o color-scheme inclui apenas \"dark\" ou apenas \"light\", retorna o tema correspondente.\n if (dark && !light) {\n return \"dark\";\n }\n if (light && !dark) {\n return \"light\";\n }\n }\n\n // Se não conseguiu resolver pelo color-scheme do elemento, usa a preferência do sistema.\n const prefersDark =\n typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n return prefersDark ? \"dark\" : \"light\";\n}\n\n/**\n * Observa o tema efetivo de um elemento e chama `onChange` quando `resolveColorScheme(element)` passa a devolver\n * outro valor: atributos de `<html>` e `<body>` (`class`, `style`, `data-theme`, `theme`, onde os apps trocam o\n * tema) e a preferência do sistema via `matchMedia`. Devolve a função que para de observar. No-op sem DOM.\n */\nexport function observeColorScheme(element: Element, onChange: (theme: ArkThemeSelected) => void): () => void {\n if (typeof window === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n\n let current = resolveColorScheme(element);\n const check = (): void => {\n const next = resolveColorScheme(element);\n if (next === current) return;\n current = next;\n onChange(next);\n };\n\n const observer = new MutationObserver(check);\n const options = { attributes: true, attributeFilter: [\"class\", \"style\", \"data-theme\", \"theme\"] };\n observer.observe(document.documentElement, options);\n if (document.body) observer.observe(document.body, options);\n\n const media = typeof window.matchMedia === \"function\" ? window.matchMedia(\"(prefers-color-scheme: dark)\") : null;\n media?.addEventListener(\"change\", check);\n\n return () => {\n observer.disconnect();\n media?.removeEventListener(\"change\", check);\n };\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AAIA;AACO,MAAM,eAAe,GAAgC;AAC1D,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,KAAK,EAAE,GAAG;AACV,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,QAAQ,EAAE,GAAG;AACb,IAAA,MAAM,EAAE,GAAG;AACX,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,IAAI,EAAE;;AAGR;AACO,MAAM,cAAc,GAA8B;AACvD,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,QAAQ,EAAE,4BAA4B;AACtC,IAAA,EAAE,EAAE,4BAA4B;AAChC,IAAA,GAAG,EAAE,4BAA4B;AACjC,IAAA,QAAQ,EAAE,8BAA8B;AACxC,IAAA,SAAS,EAAE,mCAAmC;AAC9C,IAAA,KAAK,EAAE;;AAGT;AACO,MAAM,mBAAmB,GAAG;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/color.ts","../src/motion.ts","../src/size.ts","../src/theme.ts"],"sourcesContent":["// Cores suaves de cada intent (espelham tokens.css), como `light-dark()`: resolvem\n// pelo color-scheme do elemento que as usa. Servem de fallback em JS quando as\n// custom properties --ark-color-* não estão na página (ex.: CSS de tokens não importado).\n\nimport type { ArkIntent } from \"./types\";\n\n/** Fundo (`soft`) e texto (`softFg`) suaves de cada intent — espelho de --ark-color-<intent>-soft e -soft-fg. */\nexport const ARK_INTENT_SOFT_CSS: Record<ArkIntent, { soft: string; softFg: string }> = {\n primary: {\n soft: \"light-dark(#fffbeb, color-mix(in oklab, #78350f 40%, transparent))\",\n softFg: \"light-dark(#b45309, #fbbf24)\"\n },\n secondary: {\n soft: \"light-dark(oklch(98.4% 0.003 247.858), oklch(27.9% 0.041 260.031))\",\n softFg: \"light-dark(oklch(20.8% 0.042 265.755), oklch(96.8% 0.007 247.896))\"\n },\n success: {\n soft: \"light-dark(oklch(97.9% 0.021 166.113), color-mix(in oklab, oklch(26.2% 0.051 172.552) 40%, transparent))\",\n softFg: \"light-dark(oklch(50.8% 0.118 165.612), oklch(84.5% 0.143 164.978))\"\n },\n warning: {\n soft: \"light-dark(oklch(98.7% 0.026 102.212), color-mix(in oklab, oklch(42.1% 0.095 57.708) 40%, transparent))\",\n softFg: \"light-dark(oklch(55.4% 0.135 66.442), oklch(90.5% 0.182 98.111))\"\n },\n danger: {\n soft: \"light-dark(oklch(97.1% 0.013 17.38), color-mix(in oklab, oklch(25.8% 0.092 26.042) 40%, transparent))\",\n softFg: \"light-dark(oklch(50.5% 0.213 27.518), oklch(80.8% 0.114 19.571))\"\n },\n info: {\n soft: \"light-dark(oklch(97.7% 0.013 236.62), color-mix(in oklab, oklch(29.3% 0.066 243.157) 40%, transparent))\",\n softFg: \"light-dark(oklch(50% 0.134 242.749), oklch(82.8% 0.111 230.318))\"\n },\n neutral: {\n soft: \"light-dark(oklch(98.5% 0 none), oklch(27.4% 0.006 286.033))\",\n softFg: \"light-dark(oklch(37% 0.013 285.805), oklch(92% 0.004 286.32))\"\n }\n};\n","// Valores canônicos dos motion tokens (espelham tokens.css).\n// Servem de fallback em JS/WAAPI quando as custom properties --ark-* não\n// estão disponíveis no elemento (ex.: CSS de tokens não importado).\n\nimport type { ArkDuration, ArkEasing } from \"./types\";\n\n/** Durações em milissegundos — espelho de --ark-duration-*. */\nexport const ARK_DURATION_MS: Record<ArkDuration, number> = {\n none: 0,\n instant: 75,\n quick: 150,\n default: 250,\n moderate: 350,\n gentle: 500,\n slow: 700,\n long: 1000\n};\n\n/** Easings como strings CSS — espelho de --ark-ease-*. */\nexport const ARK_EASING_CSS: Record<ArkEasing, string> = {\n linear: \"linear\",\n standard: \"cubic-bezier(0.2, 0, 0, 1)\",\n in: \"cubic-bezier(0.4, 0, 1, 1)\",\n out: \"cubic-bezier(0, 0, 0.2, 1)\",\n \"in-out\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n overshoot: \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n sheet: \"cubic-bezier(0.32, 0.72, 0, 1)\"\n};\n\n/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */\nexport const ARK_MOTION_DISTANCE = \"0.75rem\";\n","// Valores canônicos da escala de tamanho (espelham tokens.css).\n// Servem de fallback em JS quando as custom properties --ark-size-* não\n// estão na página (ex.: CSS de tokens não importado).\n\nimport type { ArkSize } from \"./types\";\n\n/** Altura mínima dos controles por tamanho — espelho de --ark-size-*. */\nexport const ARK_SIZE_CSS: Record<ArkSize, string> = {\n xs: \"1.5rem\",\n sm: \"1.75rem\",\n md: \"2.25rem\",\n lg: \"2.75rem\",\n xl: \"3.25rem\"\n};\n","import type { ArkThemeSelected } from \"./types\";\n\n/**\n * Resolve o tema efetivo (\"light\" | \"dark\") de um elemento pelo seu color-scheme computado: a página (ou um ancestral\n * com theme=\"dark\") decide, e só \"light dark\"/\"normal\" caem na preferência do sistema. Sem DOM devolve \"light\".\n */\nexport function resolveColorScheme(element?: Element | null): ArkThemeSelected {\n // Sem DOM devolve \"light\".\n if (typeof window === \"undefined\") {\n return \"light\";\n }\n\n // Tenta resolver pelo color-scheme computado do elemento.\n if (element && typeof window.getComputedStyle === \"function\") {\n const scheme = window.getComputedStyle(element).colorScheme || \"\";\n const dark = scheme.includes(\"dark\");\n const light = scheme.includes(\"light\");\n\n // Se o color-scheme inclui apenas \"dark\" ou apenas \"light\", retorna o tema correspondente.\n if (dark && !light) {\n return \"dark\";\n }\n if (light && !dark) {\n return \"light\";\n }\n }\n\n // Se não conseguiu resolver pelo color-scheme do elemento, usa a preferência do sistema.\n const prefersDark =\n typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n return prefersDark ? \"dark\" : \"light\";\n}\n\n/**\n * Observa o tema efetivo de um elemento e chama `onChange` quando `resolveColorScheme(element)` passa a devolver\n * outro valor: atributos de `<html>` e `<body>` (`class`, `style`, `data-theme`, `theme`, onde os apps trocam o\n * tema) e a preferência do sistema via `matchMedia`. Devolve a função que para de observar. No-op sem DOM.\n */\nexport function observeColorScheme(element: Element, onChange: (theme: ArkThemeSelected) => void): () => void {\n if (typeof window === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n\n let current = resolveColorScheme(element);\n const check = (): void => {\n const next = resolveColorScheme(element);\n if (next === current) return;\n current = next;\n onChange(next);\n };\n\n const observer = new MutationObserver(check);\n const options = { attributes: true, attributeFilter: [\"class\", \"style\", \"data-theme\", \"theme\"] };\n observer.observe(document.documentElement, options);\n if (document.body) observer.observe(document.body, options);\n\n const media = typeof window.matchMedia === \"function\" ? window.matchMedia(\"(prefers-color-scheme: dark)\") : null;\n media?.addEventListener(\"change\", check);\n\n return () => {\n observer.disconnect();\n media?.removeEventListener(\"change\", check);\n };\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AAIA;AACO,MAAM,mBAAmB,GAAwD;AACtF,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,oEAAoE;AAC1E,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,oEAAoE;AAC1E,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,0GAA0G;AAChH,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,yGAAyG;AAC/G,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,uGAAuG;AAC7G,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,yGAAyG;AAC/G,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,6DAA6D;AACnE,QAAA,MAAM,EAAE;AACT;;;ACnCH;AACA;AACA;AAIA;AACO,MAAM,eAAe,GAAgC;AAC1D,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,KAAK,EAAE,GAAG;AACV,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,QAAQ,EAAE,GAAG;AACb,IAAA,MAAM,EAAE,GAAG;AACX,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,IAAI,EAAE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
|
|
16
16
|
type ArkTheme = "auto" | ArkThemeSelected;
|
|
17
17
|
|
|
18
|
+
/** Fundo (`soft`) e texto (`softFg`) suaves de cada intent — espelho de --ark-color-<intent>-soft e -soft-fg. */
|
|
19
|
+
declare const ARK_INTENT_SOFT_CSS: Record<ArkIntent, {
|
|
20
|
+
soft: string;
|
|
21
|
+
softFg: string;
|
|
22
|
+
}>;
|
|
23
|
+
|
|
18
24
|
/** Durações em milissegundos — espelho de --ark-duration-*. */
|
|
19
25
|
declare const ARK_DURATION_MS: Record<ArkDuration, number>;
|
|
20
26
|
/** Easings como strings CSS — espelho de --ark-ease-*. */
|
|
@@ -22,6 +28,9 @@ declare const ARK_EASING_CSS: Record<ArkEasing, string>;
|
|
|
22
28
|
/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */
|
|
23
29
|
declare const ARK_MOTION_DISTANCE = "0.75rem";
|
|
24
30
|
|
|
31
|
+
/** Altura mínima dos controles por tamanho — espelho de --ark-size-*. */
|
|
32
|
+
declare const ARK_SIZE_CSS: Record<ArkSize, string>;
|
|
33
|
+
|
|
25
34
|
/**
|
|
26
35
|
* Resolve o tema efetivo ("light" | "dark") de um elemento pelo seu color-scheme computado: a página (ou um ancestral
|
|
27
36
|
* com theme="dark") decide, e só "light dark"/"normal" caem na preferência do sistema. Sem DOM devolve "light".
|
|
@@ -34,5 +43,5 @@ declare function resolveColorScheme(element?: Element | null): ArkThemeSelected;
|
|
|
34
43
|
*/
|
|
35
44
|
declare function observeColorScheme(element: Element, onChange: (theme: ArkThemeSelected) => void): () => void;
|
|
36
45
|
|
|
37
|
-
export { ARK_DURATION_MS, ARK_EASING_CSS, ARK_MOTION_DISTANCE, observeColorScheme, resolveColorScheme };
|
|
46
|
+
export { ARK_DURATION_MS, ARK_EASING_CSS, ARK_INTENT_SOFT_CSS, ARK_MOTION_DISTANCE, ARK_SIZE_CSS, observeColorScheme, resolveColorScheme };
|
|
38
47
|
export type { ArkDuration, ArkEasing, ArkIntent, ArkRounded, ArkSize, ArkStyleVariant, ArkTheme, ArkThemeSelected };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ type ArkThemeSelected = "light" | "dark";
|
|
|
15
15
|
/** Tema; "auto" herda o color-scheme da página. */
|
|
16
16
|
type ArkTheme = "auto" | ArkThemeSelected;
|
|
17
17
|
|
|
18
|
+
/** Fundo (`soft`) e texto (`softFg`) suaves de cada intent — espelho de --ark-color-<intent>-soft e -soft-fg. */
|
|
19
|
+
declare const ARK_INTENT_SOFT_CSS: Record<ArkIntent, {
|
|
20
|
+
soft: string;
|
|
21
|
+
softFg: string;
|
|
22
|
+
}>;
|
|
23
|
+
|
|
18
24
|
/** Durações em milissegundos — espelho de --ark-duration-*. */
|
|
19
25
|
declare const ARK_DURATION_MS: Record<ArkDuration, number>;
|
|
20
26
|
/** Easings como strings CSS — espelho de --ark-ease-*. */
|
|
@@ -22,6 +28,9 @@ declare const ARK_EASING_CSS: Record<ArkEasing, string>;
|
|
|
22
28
|
/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */
|
|
23
29
|
declare const ARK_MOTION_DISTANCE = "0.75rem";
|
|
24
30
|
|
|
31
|
+
/** Altura mínima dos controles por tamanho — espelho de --ark-size-*. */
|
|
32
|
+
declare const ARK_SIZE_CSS: Record<ArkSize, string>;
|
|
33
|
+
|
|
25
34
|
/**
|
|
26
35
|
* Resolve o tema efetivo ("light" | "dark") de um elemento pelo seu color-scheme computado: a página (ou um ancestral
|
|
27
36
|
* com theme="dark") decide, e só "light dark"/"normal" caem na preferência do sistema. Sem DOM devolve "light".
|
|
@@ -34,5 +43,5 @@ declare function resolveColorScheme(element?: Element | null): ArkThemeSelected;
|
|
|
34
43
|
*/
|
|
35
44
|
declare function observeColorScheme(element: Element, onChange: (theme: ArkThemeSelected) => void): () => void;
|
|
36
45
|
|
|
37
|
-
export { ARK_DURATION_MS, ARK_EASING_CSS, ARK_MOTION_DISTANCE, observeColorScheme, resolveColorScheme };
|
|
46
|
+
export { ARK_DURATION_MS, ARK_EASING_CSS, ARK_INTENT_SOFT_CSS, ARK_MOTION_DISTANCE, ARK_SIZE_CSS, observeColorScheme, resolveColorScheme };
|
|
38
47
|
export type { ArkDuration, ArkEasing, ArkIntent, ArkRounded, ArkSize, ArkStyleVariant, ArkTheme, ArkThemeSelected };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
// Cores suaves de cada intent (espelham tokens.css), como `light-dark()`: resolvem
|
|
2
|
+
// pelo color-scheme do elemento que as usa. Servem de fallback em JS quando as
|
|
3
|
+
// custom properties --ark-color-* não estão na página (ex.: CSS de tokens não importado).
|
|
4
|
+
/** Fundo (`soft`) e texto (`softFg`) suaves de cada intent — espelho de --ark-color-<intent>-soft e -soft-fg. */
|
|
5
|
+
const ARK_INTENT_SOFT_CSS = {
|
|
6
|
+
primary: {
|
|
7
|
+
soft: "light-dark(#fffbeb, color-mix(in oklab, #78350f 40%, transparent))",
|
|
8
|
+
softFg: "light-dark(#b45309, #fbbf24)"
|
|
9
|
+
},
|
|
10
|
+
secondary: {
|
|
11
|
+
soft: "light-dark(oklch(98.4% 0.003 247.858), oklch(27.9% 0.041 260.031))",
|
|
12
|
+
softFg: "light-dark(oklch(20.8% 0.042 265.755), oklch(96.8% 0.007 247.896))"
|
|
13
|
+
},
|
|
14
|
+
success: {
|
|
15
|
+
soft: "light-dark(oklch(97.9% 0.021 166.113), color-mix(in oklab, oklch(26.2% 0.051 172.552) 40%, transparent))",
|
|
16
|
+
softFg: "light-dark(oklch(50.8% 0.118 165.612), oklch(84.5% 0.143 164.978))"
|
|
17
|
+
},
|
|
18
|
+
warning: {
|
|
19
|
+
soft: "light-dark(oklch(98.7% 0.026 102.212), color-mix(in oklab, oklch(42.1% 0.095 57.708) 40%, transparent))",
|
|
20
|
+
softFg: "light-dark(oklch(55.4% 0.135 66.442), oklch(90.5% 0.182 98.111))"
|
|
21
|
+
},
|
|
22
|
+
danger: {
|
|
23
|
+
soft: "light-dark(oklch(97.1% 0.013 17.38), color-mix(in oklab, oklch(25.8% 0.092 26.042) 40%, transparent))",
|
|
24
|
+
softFg: "light-dark(oklch(50.5% 0.213 27.518), oklch(80.8% 0.114 19.571))"
|
|
25
|
+
},
|
|
26
|
+
info: {
|
|
27
|
+
soft: "light-dark(oklch(97.7% 0.013 236.62), color-mix(in oklab, oklch(29.3% 0.066 243.157) 40%, transparent))",
|
|
28
|
+
softFg: "light-dark(oklch(50% 0.134 242.749), oklch(82.8% 0.111 230.318))"
|
|
29
|
+
},
|
|
30
|
+
neutral: {
|
|
31
|
+
soft: "light-dark(oklch(98.5% 0 none), oklch(27.4% 0.006 286.033))",
|
|
32
|
+
softFg: "light-dark(oklch(37% 0.013 285.805), oklch(92% 0.004 286.32))"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
1
36
|
// Valores canônicos dos motion tokens (espelham tokens.css).
|
|
2
37
|
// Servem de fallback em JS/WAAPI quando as custom properties --ark-* não
|
|
3
38
|
// estão disponíveis no elemento (ex.: CSS de tokens não importado).
|
|
@@ -25,6 +60,18 @@ const ARK_EASING_CSS = {
|
|
|
25
60
|
/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */
|
|
26
61
|
const ARK_MOTION_DISTANCE = "0.75rem";
|
|
27
62
|
|
|
63
|
+
// Valores canônicos da escala de tamanho (espelham tokens.css).
|
|
64
|
+
// Servem de fallback em JS quando as custom properties --ark-size-* não
|
|
65
|
+
// estão na página (ex.: CSS de tokens não importado).
|
|
66
|
+
/** Altura mínima dos controles por tamanho — espelho de --ark-size-*. */
|
|
67
|
+
const ARK_SIZE_CSS = {
|
|
68
|
+
xs: "1.5rem",
|
|
69
|
+
sm: "1.75rem",
|
|
70
|
+
md: "2.25rem",
|
|
71
|
+
lg: "2.75rem",
|
|
72
|
+
xl: "3.25rem"
|
|
73
|
+
};
|
|
74
|
+
|
|
28
75
|
/**
|
|
29
76
|
* Resolve o tema efetivo ("light" | "dark") de um elemento pelo seu color-scheme computado: a página (ou um ancestral
|
|
30
77
|
* com theme="dark") decide, e só "light dark"/"normal" caem na preferência do sistema. Sem DOM devolve "light".
|
|
@@ -80,5 +127,5 @@ function observeColorScheme(element, onChange) {
|
|
|
80
127
|
};
|
|
81
128
|
}
|
|
82
129
|
|
|
83
|
-
export { ARK_DURATION_MS, ARK_EASING_CSS, ARK_MOTION_DISTANCE, observeColorScheme, resolveColorScheme };
|
|
130
|
+
export { ARK_DURATION_MS, ARK_EASING_CSS, ARK_INTENT_SOFT_CSS, ARK_MOTION_DISTANCE, ARK_SIZE_CSS, observeColorScheme, resolveColorScheme };
|
|
84
131
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/motion.ts","../src/theme.ts"],"sourcesContent":["// Valores canônicos dos motion tokens (espelham tokens.css).\n// Servem de fallback em JS/WAAPI quando as custom properties --ark-* não\n// estão disponíveis no elemento (ex.: CSS de tokens não importado).\n\nimport type { ArkDuration, ArkEasing } from \"./types\";\n\n/** Durações em milissegundos — espelho de --ark-duration-*. */\nexport const ARK_DURATION_MS: Record<ArkDuration, number> = {\n none: 0,\n instant: 75,\n quick: 150,\n default: 250,\n moderate: 350,\n gentle: 500,\n slow: 700,\n long: 1000\n};\n\n/** Easings como strings CSS — espelho de --ark-ease-*. */\nexport const ARK_EASING_CSS: Record<ArkEasing, string> = {\n linear: \"linear\",\n standard: \"cubic-bezier(0.2, 0, 0, 1)\",\n in: \"cubic-bezier(0.4, 0, 1, 1)\",\n out: \"cubic-bezier(0, 0, 0.2, 1)\",\n \"in-out\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n overshoot: \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n sheet: \"cubic-bezier(0.32, 0.72, 0, 1)\"\n};\n\n/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */\nexport const ARK_MOTION_DISTANCE = \"0.75rem\";\n","import type { ArkThemeSelected } from \"./types\";\n\n/**\n * Resolve o tema efetivo (\"light\" | \"dark\") de um elemento pelo seu color-scheme computado: a página (ou um ancestral\n * com theme=\"dark\") decide, e só \"light dark\"/\"normal\" caem na preferência do sistema. Sem DOM devolve \"light\".\n */\nexport function resolveColorScheme(element?: Element | null): ArkThemeSelected {\n // Sem DOM devolve \"light\".\n if (typeof window === \"undefined\") {\n return \"light\";\n }\n\n // Tenta resolver pelo color-scheme computado do elemento.\n if (element && typeof window.getComputedStyle === \"function\") {\n const scheme = window.getComputedStyle(element).colorScheme || \"\";\n const dark = scheme.includes(\"dark\");\n const light = scheme.includes(\"light\");\n\n // Se o color-scheme inclui apenas \"dark\" ou apenas \"light\", retorna o tema correspondente.\n if (dark && !light) {\n return \"dark\";\n }\n if (light && !dark) {\n return \"light\";\n }\n }\n\n // Se não conseguiu resolver pelo color-scheme do elemento, usa a preferência do sistema.\n const prefersDark =\n typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n return prefersDark ? \"dark\" : \"light\";\n}\n\n/**\n * Observa o tema efetivo de um elemento e chama `onChange` quando `resolveColorScheme(element)` passa a devolver\n * outro valor: atributos de `<html>` e `<body>` (`class`, `style`, `data-theme`, `theme`, onde os apps trocam o\n * tema) e a preferência do sistema via `matchMedia`. Devolve a função que para de observar. No-op sem DOM.\n */\nexport function observeColorScheme(element: Element, onChange: (theme: ArkThemeSelected) => void): () => void {\n if (typeof window === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n\n let current = resolveColorScheme(element);\n const check = (): void => {\n const next = resolveColorScheme(element);\n if (next === current) return;\n current = next;\n onChange(next);\n };\n\n const observer = new MutationObserver(check);\n const options = { attributes: true, attributeFilter: [\"class\", \"style\", \"data-theme\", \"theme\"] };\n observer.observe(document.documentElement, options);\n if (document.body) observer.observe(document.body, options);\n\n const media = typeof window.matchMedia === \"function\" ? window.matchMedia(\"(prefers-color-scheme: dark)\") : null;\n media?.addEventListener(\"change\", check);\n\n return () => {\n observer.disconnect();\n media?.removeEventListener(\"change\", check);\n };\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AAIA;AACO,MAAM,eAAe,GAAgC;AAC1D,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,KAAK,EAAE,GAAG;AACV,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,QAAQ,EAAE,GAAG;AACb,IAAA,MAAM,EAAE,GAAG;AACX,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,IAAI,EAAE;;AAGR;AACO,MAAM,cAAc,GAA8B;AACvD,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,QAAQ,EAAE,4BAA4B;AACtC,IAAA,EAAE,EAAE,4BAA4B;AAChC,IAAA,GAAG,EAAE,4BAA4B;AACjC,IAAA,QAAQ,EAAE,8BAA8B;AACxC,IAAA,SAAS,EAAE,mCAAmC;AAC9C,IAAA,KAAK,EAAE;;AAGT;AACO,MAAM,mBAAmB,GAAG;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/color.ts","../src/motion.ts","../src/size.ts","../src/theme.ts"],"sourcesContent":["// Cores suaves de cada intent (espelham tokens.css), como `light-dark()`: resolvem\n// pelo color-scheme do elemento que as usa. Servem de fallback em JS quando as\n// custom properties --ark-color-* não estão na página (ex.: CSS de tokens não importado).\n\nimport type { ArkIntent } from \"./types\";\n\n/** Fundo (`soft`) e texto (`softFg`) suaves de cada intent — espelho de --ark-color-<intent>-soft e -soft-fg. */\nexport const ARK_INTENT_SOFT_CSS: Record<ArkIntent, { soft: string; softFg: string }> = {\n primary: {\n soft: \"light-dark(#fffbeb, color-mix(in oklab, #78350f 40%, transparent))\",\n softFg: \"light-dark(#b45309, #fbbf24)\"\n },\n secondary: {\n soft: \"light-dark(oklch(98.4% 0.003 247.858), oklch(27.9% 0.041 260.031))\",\n softFg: \"light-dark(oklch(20.8% 0.042 265.755), oklch(96.8% 0.007 247.896))\"\n },\n success: {\n soft: \"light-dark(oklch(97.9% 0.021 166.113), color-mix(in oklab, oklch(26.2% 0.051 172.552) 40%, transparent))\",\n softFg: \"light-dark(oklch(50.8% 0.118 165.612), oklch(84.5% 0.143 164.978))\"\n },\n warning: {\n soft: \"light-dark(oklch(98.7% 0.026 102.212), color-mix(in oklab, oklch(42.1% 0.095 57.708) 40%, transparent))\",\n softFg: \"light-dark(oklch(55.4% 0.135 66.442), oklch(90.5% 0.182 98.111))\"\n },\n danger: {\n soft: \"light-dark(oklch(97.1% 0.013 17.38), color-mix(in oklab, oklch(25.8% 0.092 26.042) 40%, transparent))\",\n softFg: \"light-dark(oklch(50.5% 0.213 27.518), oklch(80.8% 0.114 19.571))\"\n },\n info: {\n soft: \"light-dark(oklch(97.7% 0.013 236.62), color-mix(in oklab, oklch(29.3% 0.066 243.157) 40%, transparent))\",\n softFg: \"light-dark(oklch(50% 0.134 242.749), oklch(82.8% 0.111 230.318))\"\n },\n neutral: {\n soft: \"light-dark(oklch(98.5% 0 none), oklch(27.4% 0.006 286.033))\",\n softFg: \"light-dark(oklch(37% 0.013 285.805), oklch(92% 0.004 286.32))\"\n }\n};\n","// Valores canônicos dos motion tokens (espelham tokens.css).\n// Servem de fallback em JS/WAAPI quando as custom properties --ark-* não\n// estão disponíveis no elemento (ex.: CSS de tokens não importado).\n\nimport type { ArkDuration, ArkEasing } from \"./types\";\n\n/** Durações em milissegundos — espelho de --ark-duration-*. */\nexport const ARK_DURATION_MS: Record<ArkDuration, number> = {\n none: 0,\n instant: 75,\n quick: 150,\n default: 250,\n moderate: 350,\n gentle: 500,\n slow: 700,\n long: 1000\n};\n\n/** Easings como strings CSS — espelho de --ark-ease-*. */\nexport const ARK_EASING_CSS: Record<ArkEasing, string> = {\n linear: \"linear\",\n standard: \"cubic-bezier(0.2, 0, 0, 1)\",\n in: \"cubic-bezier(0.4, 0, 1, 1)\",\n out: \"cubic-bezier(0, 0, 0.2, 1)\",\n \"in-out\": \"cubic-bezier(0.4, 0, 0.2, 1)\",\n overshoot: \"cubic-bezier(0.34, 1.56, 0.64, 1)\",\n sheet: \"cubic-bezier(0.32, 0.72, 0, 1)\"\n};\n\n/** Deslocamento padrão de slides — espelho de --ark-motion-distance. */\nexport const ARK_MOTION_DISTANCE = \"0.75rem\";\n","// Valores canônicos da escala de tamanho (espelham tokens.css).\n// Servem de fallback em JS quando as custom properties --ark-size-* não\n// estão na página (ex.: CSS de tokens não importado).\n\nimport type { ArkSize } from \"./types\";\n\n/** Altura mínima dos controles por tamanho — espelho de --ark-size-*. */\nexport const ARK_SIZE_CSS: Record<ArkSize, string> = {\n xs: \"1.5rem\",\n sm: \"1.75rem\",\n md: \"2.25rem\",\n lg: \"2.75rem\",\n xl: \"3.25rem\"\n};\n","import type { ArkThemeSelected } from \"./types\";\n\n/**\n * Resolve o tema efetivo (\"light\" | \"dark\") de um elemento pelo seu color-scheme computado: a página (ou um ancestral\n * com theme=\"dark\") decide, e só \"light dark\"/\"normal\" caem na preferência do sistema. Sem DOM devolve \"light\".\n */\nexport function resolveColorScheme(element?: Element | null): ArkThemeSelected {\n // Sem DOM devolve \"light\".\n if (typeof window === \"undefined\") {\n return \"light\";\n }\n\n // Tenta resolver pelo color-scheme computado do elemento.\n if (element && typeof window.getComputedStyle === \"function\") {\n const scheme = window.getComputedStyle(element).colorScheme || \"\";\n const dark = scheme.includes(\"dark\");\n const light = scheme.includes(\"light\");\n\n // Se o color-scheme inclui apenas \"dark\" ou apenas \"light\", retorna o tema correspondente.\n if (dark && !light) {\n return \"dark\";\n }\n if (light && !dark) {\n return \"light\";\n }\n }\n\n // Se não conseguiu resolver pelo color-scheme do elemento, usa a preferência do sistema.\n const prefersDark =\n typeof window.matchMedia === \"function\" && window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n return prefersDark ? \"dark\" : \"light\";\n}\n\n/**\n * Observa o tema efetivo de um elemento e chama `onChange` quando `resolveColorScheme(element)` passa a devolver\n * outro valor: atributos de `<html>` e `<body>` (`class`, `style`, `data-theme`, `theme`, onde os apps trocam o\n * tema) e a preferência do sistema via `matchMedia`. Devolve a função que para de observar. No-op sem DOM.\n */\nexport function observeColorScheme(element: Element, onChange: (theme: ArkThemeSelected) => void): () => void {\n if (typeof window === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n\n let current = resolveColorScheme(element);\n const check = (): void => {\n const next = resolveColorScheme(element);\n if (next === current) return;\n current = next;\n onChange(next);\n };\n\n const observer = new MutationObserver(check);\n const options = { attributes: true, attributeFilter: [\"class\", \"style\", \"data-theme\", \"theme\"] };\n observer.observe(document.documentElement, options);\n if (document.body) observer.observe(document.body, options);\n\n const media = typeof window.matchMedia === \"function\" ? window.matchMedia(\"(prefers-color-scheme: dark)\") : null;\n media?.addEventListener(\"change\", check);\n\n return () => {\n observer.disconnect();\n media?.removeEventListener(\"change\", check);\n };\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AAIA;AACO,MAAM,mBAAmB,GAAwD;AACtF,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,oEAAoE;AAC1E,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,oEAAoE;AAC1E,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,0GAA0G;AAChH,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,yGAAyG;AAC/G,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,uGAAuG;AAC7G,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,yGAAyG;AAC/G,QAAA,MAAM,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,6DAA6D;AACnE,QAAA,MAAM,EAAE;AACT;;;ACnCH;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