@kbach/react 0.2.5 → 0.2.6

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.
@@ -1043,6 +1043,25 @@ function resolveColor(value, colors, isArbitrary) {
1043
1043
  }
1044
1044
  }
1045
1045
  }
1046
+ if (hex && !hex.startsWith("#") && !hex.startsWith("rgb") && hex !== "transparent" && hex !== "currentColor") {
1047
+ if (hex in colors) {
1048
+ const alias = colors[hex];
1049
+ if (typeof alias === "string") hex = alias;
1050
+ else if (typeof alias === "object" && "6" in alias) hex = alias["6"] ?? hex;
1051
+ } else {
1052
+ const aliasLastDash = hex.lastIndexOf("-");
1053
+ if (aliasLastDash > 0) {
1054
+ const aliasColorName = hex.slice(0, aliasLastDash);
1055
+ const aliasShade = hex.slice(aliasLastDash + 1);
1056
+ const aliasScale = colors[aliasColorName];
1057
+ if (aliasScale && typeof aliasScale === "object") {
1058
+ hex = aliasScale[aliasShade] ?? null;
1059
+ } else if (typeof aliasScale === "string") {
1060
+ hex = aliasScale;
1061
+ }
1062
+ }
1063
+ }
1064
+ }
1046
1065
  if (!hex) return null;
1047
1066
  if (!opacityPart) return hex;
1048
1067
  let alpha;
@@ -5,7 +5,7 @@ import {
5
5
  isWeb,
6
6
  resolve,
7
7
  useGlobalDarkMode
8
- } from "./chunk-IYY3U6L2.mjs";
8
+ } from "./chunk-7YSVROUJ.mjs";
9
9
 
10
10
  // src/jsx-runtime.tsx
11
11
  import { jsx as _jsx, jsxs as _jsxs, Fragment } from "react/jsx-runtime";
package/dist/index.js CHANGED
@@ -1143,6 +1143,25 @@ function resolveColor(value, colors, isArbitrary) {
1143
1143
  }
1144
1144
  }
1145
1145
  }
1146
+ if (hex && !hex.startsWith("#") && !hex.startsWith("rgb") && hex !== "transparent" && hex !== "currentColor") {
1147
+ if (hex in colors) {
1148
+ const alias = colors[hex];
1149
+ if (typeof alias === "string") hex = alias;
1150
+ else if (typeof alias === "object" && "6" in alias) hex = alias["6"] ?? hex;
1151
+ } else {
1152
+ const aliasLastDash = hex.lastIndexOf("-");
1153
+ if (aliasLastDash > 0) {
1154
+ const aliasColorName = hex.slice(0, aliasLastDash);
1155
+ const aliasShade = hex.slice(aliasLastDash + 1);
1156
+ const aliasScale = colors[aliasColorName];
1157
+ if (aliasScale && typeof aliasScale === "object") {
1158
+ hex = aliasScale[aliasShade] ?? null;
1159
+ } else if (typeof aliasScale === "string") {
1160
+ hex = aliasScale;
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1146
1165
  if (!hex) return null;
1147
1166
  if (!opacityPart) return hex;
1148
1167
  let alpha;
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  syncGlobalDarkMode,
16
16
  updateConfig,
17
17
  useGlobalDarkMode
18
- } from "./chunk-IYY3U6L2.mjs";
18
+ } from "./chunk-7YSVROUJ.mjs";
19
19
 
20
20
  // src/context.tsx
21
21
  import { createContext, useContext } from "react";
@@ -1112,6 +1112,25 @@ function resolveColor(value, colors, isArbitrary) {
1112
1112
  }
1113
1113
  }
1114
1114
  }
1115
+ if (hex && !hex.startsWith("#") && !hex.startsWith("rgb") && hex !== "transparent" && hex !== "currentColor") {
1116
+ if (hex in colors) {
1117
+ const alias = colors[hex];
1118
+ if (typeof alias === "string") hex = alias;
1119
+ else if (typeof alias === "object" && "6" in alias) hex = alias["6"] ?? hex;
1120
+ } else {
1121
+ const aliasLastDash = hex.lastIndexOf("-");
1122
+ if (aliasLastDash > 0) {
1123
+ const aliasColorName = hex.slice(0, aliasLastDash);
1124
+ const aliasShade = hex.slice(aliasLastDash + 1);
1125
+ const aliasScale = colors[aliasColorName];
1126
+ if (aliasScale && typeof aliasScale === "object") {
1127
+ hex = aliasScale[aliasShade] ?? null;
1128
+ } else if (typeof aliasScale === "string") {
1129
+ hex = aliasScale;
1130
+ }
1131
+ }
1132
+ }
1133
+ }
1115
1134
  if (!hex) return null;
1116
1135
  if (!opacityPart) return hex;
1117
1136
  let alpha;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-23GRUDYB.mjs";
6
- import "./chunk-IYY3U6L2.mjs";
5
+ } from "./chunk-XW4LEBBB.mjs";
6
+ import "./chunk-7YSVROUJ.mjs";
7
7
 
8
8
  // src/jsx-dev-runtime.tsx
9
9
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -1111,6 +1111,25 @@ function resolveColor(value, colors, isArbitrary) {
1111
1111
  }
1112
1112
  }
1113
1113
  }
1114
+ if (hex && !hex.startsWith("#") && !hex.startsWith("rgb") && hex !== "transparent" && hex !== "currentColor") {
1115
+ if (hex in colors) {
1116
+ const alias = colors[hex];
1117
+ if (typeof alias === "string") hex = alias;
1118
+ else if (typeof alias === "object" && "6" in alias) hex = alias["6"] ?? hex;
1119
+ } else {
1120
+ const aliasLastDash = hex.lastIndexOf("-");
1121
+ if (aliasLastDash > 0) {
1122
+ const aliasColorName = hex.slice(0, aliasLastDash);
1123
+ const aliasShade = hex.slice(aliasLastDash + 1);
1124
+ const aliasScale = colors[aliasColorName];
1125
+ if (aliasScale && typeof aliasScale === "object") {
1126
+ hex = aliasScale[aliasShade] ?? null;
1127
+ } else if (typeof aliasScale === "string") {
1128
+ hex = aliasScale;
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1114
1133
  if (!hex) return null;
1115
1134
  if (!opacityPart) return hex;
1116
1135
  let alpha;
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-23GRUDYB.mjs";
6
- import "./chunk-IYY3U6L2.mjs";
5
+ } from "./chunk-XW4LEBBB.mjs";
6
+ import "./chunk-7YSVROUJ.mjs";
7
7
  export {
8
8
  Fragment,
9
9
  jsx,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",