@kbach/react-native 1.0.0-beta.42 → 1.0.0-beta.43

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,10 +1,10 @@
1
- import "./chunk-YYCSHELO.mjs";
1
+ import "./chunk-45OSRKPS.mjs";
2
2
  import {
3
3
  Fragment,
4
4
  jsx,
5
5
  jsxs
6
- } from "./chunk-3AY4XSVY.mjs";
7
- import "./chunk-A3PV4XGK.mjs";
6
+ } from "./chunk-ZURXKRQE.mjs";
7
+ import "./chunk-BTIGG7K2.mjs";
8
8
 
9
9
  // src/jsxRuntimeCore.ts
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -44,14 +44,20 @@ function findModeAwareColor(base, theme) {
44
44
  const rest = important ? base.slice(1) : base;
45
45
  for (const prefix of MODE_AWARE_COLOR_PREFIXES) {
46
46
  if (!rest.startsWith(prefix)) continue;
47
- const value = rest.slice(prefix.length);
48
- const entry = theme.colors[value];
47
+ const [name, opacity] = splitOpacity(rest.slice(prefix.length));
48
+ const entry = theme.colors[name];
49
49
  if (typeof entry === "object" && entry !== null) {
50
- return { prefix: `${important}${prefix}`, light: entry.light, dark: entry.dark };
50
+ return { prefix: `${important}${prefix}`, opacity, light: entry.light, dark: entry.dark };
51
51
  }
52
52
  }
53
53
  return null;
54
54
  }
55
+ function applyOpacityToHex(hex, opacity) {
56
+ if (opacity === null) return hex;
57
+ const rgb = hexToRgb(hex);
58
+ if (rgb === null) return hex;
59
+ return `rgba(${rgb.join(",")},${opacity / 100})`;
60
+ }
55
61
  function substituteModeAwareColorToken(token, theme, colorScheme) {
56
62
  const segments = token.split(":");
57
63
  const base = segments.pop() ?? token;
@@ -59,7 +65,7 @@ function substituteModeAwareColorToken(token, theme, colorScheme) {
59
65
  const found = findModeAwareColor(base, theme);
60
66
  if (found === null) return token;
61
67
  const hex = colorScheme === "dark" ? found.dark : found.light;
62
- return `${modifierPrefix}${found.prefix}[${hex}]`;
68
+ return `${modifierPrefix}${found.prefix}[${applyOpacityToHex(hex, found.opacity)}]`;
63
69
  }
64
70
  function classStringUsesModeAwareColor(classString, theme) {
65
71
  return classString.split(/\s+/).some((rawToken) => {