@thewhileloop/whileui 0.2.8 → 0.2.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-colors.d.ts","sourceRoot":"","sources":["../../src/lib/theme-colors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme-colors.d.ts","sourceRoot":"","sources":["../../src/lib/theme-colors.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,cAAc,IAAI,WAAW,CAmC5C;AAED,oFAAoF;AACpF,wBAAgB,aAAa;;;;;;;EAU5B"}
|
package/dist/lib/theme-colors.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { useCSSVariable } from 'uniwind';
|
|
2
|
+
/** React Native tintColor/color props require hex. Guard against oklch/hsl from useCSSVariable. */
|
|
3
|
+
const HEX_RE = /^#[0-9a-fA-F]{3,8}$/;
|
|
4
|
+
function toHex(value, fallback) {
|
|
5
|
+
if (value == null)
|
|
6
|
+
return fallback;
|
|
7
|
+
const s = String(value);
|
|
8
|
+
return HEX_RE.test(s) ? s : fallback;
|
|
9
|
+
}
|
|
2
10
|
export function useThemeColors() {
|
|
3
11
|
const [primary, primaryForeground, foreground, muted, mutedForeground, background, border, accent, destructive,] = useCSSVariable([
|
|
4
12
|
'--color-primary',
|
|
@@ -11,17 +19,17 @@ export function useThemeColors() {
|
|
|
11
19
|
'--color-accent',
|
|
12
20
|
'--color-destructive',
|
|
13
21
|
]);
|
|
14
|
-
// Fallbacks
|
|
22
|
+
// Fallbacks when undefined; toHex guards against oklch/hsl (RN tintColor/color need hex)
|
|
15
23
|
return {
|
|
16
|
-
primary:
|
|
17
|
-
primaryForeground:
|
|
18
|
-
foreground:
|
|
19
|
-
muted:
|
|
20
|
-
mutedForeground:
|
|
21
|
-
background:
|
|
22
|
-
border:
|
|
23
|
-
accent:
|
|
24
|
-
destructive:
|
|
24
|
+
primary: toHex(primary, '#000000'),
|
|
25
|
+
primaryForeground: toHex(primaryForeground, '#ffffff'),
|
|
26
|
+
foreground: toHex(foreground, '#000000'),
|
|
27
|
+
muted: toHex(muted, '#f5f5f5'),
|
|
28
|
+
mutedForeground: toHex(mutedForeground, '#737373'),
|
|
29
|
+
background: toHex(background, '#ffffff'),
|
|
30
|
+
border: toHex(border, '#e5e5e5'),
|
|
31
|
+
accent: toHex(accent, '#22c55e'),
|
|
32
|
+
destructive: toHex(destructive, '#dc2626'),
|
|
25
33
|
};
|
|
26
34
|
}
|
|
27
35
|
/** Icon colors derived from theme. For @expo/vector-icons which need hex values. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-colors.js","sourceRoot":"","sources":["../../src/lib/theme-colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"theme-colors.js","sourceRoot":"","sources":["../../src/lib/theme-colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,mGAAmG;AACnG,MAAM,MAAM,GAAG,qBAAqB,CAAC;AACrC,SAAS,KAAK,CAAC,KAAkC,EAAE,QAAgB;IACjE,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,QAAQ,CAAC;IACnC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,IAAI,CAAC,CA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