@kbach/react-native 1.1.1-beta.1 → 1.1.1-beta.2
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/AGENTS.md +10 -0
- package/README.md +25 -2
- package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
- package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
- package/dist/{chunk-FSO4WVCH.mjs → chunk-BN6RWNCE.mjs} +1 -1
- package/dist/chunk-TCSCNQQ7.mjs +623 -0
- package/dist/{chunk-6F44N62F.mjs → chunk-VMI2JVCQ.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +69 -1
- package/dist/index.web.d.ts +1 -1
- package/dist/index.web.js +12 -1
- package/dist/index.web.mjs +13 -2
- package/dist/jsx-dev-runtime.js +76 -2
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +76 -2
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/dist/{semanticElements-Bk3TB-vt.d.ts → semanticElements-CY-W_7tU.d.ts} +7 -0
- package/dist/theme.d.ts +2 -0
- package/llms.txt +7 -2
- package/package.json +1 -1
- package/dist/chunk-R7E5D3D6.mjs +0 -623
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ColorEntry, ContainerConfig, ThemeConfig, defaultTheme, getTheme, setTheme } from './theme';
|
|
2
|
-
export { B as Button, a as ButtonProps, C as ClassArray, b as ClassDictionary, c as ClassValue, d as ColorScale, e as ColorsAPI, H as H1, f as H2, g as H3, h as H4, i as H5, j as H6, k as HeadingProps, K as KbachConfig, P as Paragraph, l as ParagraphProps, T as ThemeProvider, m as ThemeProviderProps, n as ThemeState, o as ThemeStorageAdapter, p as applyKbachConfig, q as clsx, r as resolveKbachConfig, u as useColors, s as useDynamicToken, t as useTheme } from './semanticElements-
|
|
2
|
+
export { B as Button, a as ButtonProps, C as ClassArray, b as ClassDictionary, c as ClassValue, d as ColorScale, e as ColorsAPI, H as H1, f as H2, g as H3, h as H4, i as H5, j as H6, k as HeadingProps, K as KbachConfig, P as Paragraph, l as ParagraphProps, T as ThemeProvider, m as ThemeProviderProps, n as ThemeState, o as ThemeStorageAdapter, p as applyKbachConfig, q as clsx, r as resolveKbachConfig, u as useColors, s as useDynamicToken, t as useTheme } from './semanticElements-CY-W_7tU.js';
|
|
3
3
|
export { ThemeMode, getGlobalDarkMode, getGlobalThemeMode, setGlobalThemeMode, subscribeGlobalDarkMode, toggleGlobalDarkMode } from './darkModeStore';
|
|
4
4
|
export { deleteDynamicToken, getDynamicToken, setDynamicToken, subscribeDynamicTokens } from './dynamicTokens';
|
|
5
5
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -608,6 +608,63 @@ function expandToken(token, prefix, important, out) {
|
|
|
608
608
|
for (const part of splitTopLevel(token.slice(open + 1, close))) expandToken(part, innerPrefix, rest === "!" || important, out);
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
+
// src/jsEngine/compose.ts
|
|
612
|
+
var MAX_DEPTH = 8;
|
|
613
|
+
function splitVariants(token) {
|
|
614
|
+
let depth = 0;
|
|
615
|
+
let last = -1;
|
|
616
|
+
for (let i = 0; i < token.length; i++) {
|
|
617
|
+
const ch = token[i];
|
|
618
|
+
if (ch === "[" || ch === "(") depth++;
|
|
619
|
+
else if (ch === "]" || ch === ")") depth--;
|
|
620
|
+
else if (ch === ":" && depth === 0) last = i;
|
|
621
|
+
}
|
|
622
|
+
return last < 0 ? ["", token] : [token.slice(0, last + 1), token.slice(last + 1)];
|
|
623
|
+
}
|
|
624
|
+
function stripImportant(base) {
|
|
625
|
+
if (base.endsWith("!")) return [base.slice(0, -1), true];
|
|
626
|
+
if (base.startsWith("!")) return [base.slice(1), true];
|
|
627
|
+
return [base, false];
|
|
628
|
+
}
|
|
629
|
+
function withImportant(cls, important) {
|
|
630
|
+
const [, base] = splitVariants(cls);
|
|
631
|
+
return important && !cls.endsWith("!") && !base.startsWith("!") ? cls + "!" : cls;
|
|
632
|
+
}
|
|
633
|
+
function expandInto(prefix, value, important, compose, path, out) {
|
|
634
|
+
for (const cls of expandVariantGroups(value).split(/\s+/).filter(Boolean)) {
|
|
635
|
+
const [variants, base] = splitVariants(cls);
|
|
636
|
+
const [name, bang] = stripImportant(base);
|
|
637
|
+
const inner = Object.prototype.hasOwnProperty.call(compose, name) ? compose[name] : void 0;
|
|
638
|
+
if (inner !== void 0 && path.length < MAX_DEPTH && !path.includes(name)) {
|
|
639
|
+
path.push(name);
|
|
640
|
+
expandInto(prefix + variants, inner, important || bang, compose, path, out);
|
|
641
|
+
path.pop();
|
|
642
|
+
} else {
|
|
643
|
+
out.push(withImportant(prefix + cls, important));
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function expandComposeToken(token, compose) {
|
|
648
|
+
if (!compose) return null;
|
|
649
|
+
const [variants, base] = splitVariants(token);
|
|
650
|
+
const [name, important] = stripImportant(base);
|
|
651
|
+
if (!Object.prototype.hasOwnProperty.call(compose, name)) return null;
|
|
652
|
+
const out = [];
|
|
653
|
+
expandInto(variants, compose[name], important, compose, [name], out);
|
|
654
|
+
return out;
|
|
655
|
+
}
|
|
656
|
+
function expandComposeClasses(classString, compose) {
|
|
657
|
+
if (!compose || Object.keys(compose).length === 0) return classString;
|
|
658
|
+
const composed = [];
|
|
659
|
+
const own = [];
|
|
660
|
+
for (const token of classString.split(/\s+/).filter(Boolean)) {
|
|
661
|
+
const classes = expandComposeToken(token, compose);
|
|
662
|
+
if (classes) composed.push(...classes);
|
|
663
|
+
else own.push(token);
|
|
664
|
+
}
|
|
665
|
+
return composed.length === 0 ? classString : [...composed, ...own].join(" ");
|
|
666
|
+
}
|
|
667
|
+
|
|
611
668
|
// src/jsEngine/shared.ts
|
|
612
669
|
function decl(property, value) {
|
|
613
670
|
return { property, value };
|
|
@@ -2137,7 +2194,7 @@ Fix: use a plain px/rem calc, a fraction utility (e.g. w-1/2), or resolve this v
|
|
|
2137
2194
|
return { value: null, warning };
|
|
2138
2195
|
}
|
|
2139
2196
|
function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, width) {
|
|
2140
|
-
classString = expandVariantGroups(classString);
|
|
2197
|
+
classString = expandComposeClasses(expandVariantGroups(classString), theme.compose);
|
|
2141
2198
|
const style = {};
|
|
2142
2199
|
const warnings = [];
|
|
2143
2200
|
let shadowOffset = null;
|
|
@@ -2273,6 +2330,14 @@ From className: "${highlightToken(classString, warning)}"`;
|
|
|
2273
2330
|
// src/config.ts
|
|
2274
2331
|
var import_theme2 = require("./theme");
|
|
2275
2332
|
var import_darkModeStore2 = require("./darkModeStore");
|
|
2333
|
+
function composeMap(compose) {
|
|
2334
|
+
const out = {};
|
|
2335
|
+
for (const [name, value] of Object.entries(compose)) {
|
|
2336
|
+
const text = Array.isArray(value) ? value.join(" ") : value;
|
|
2337
|
+
if (typeof text === "string" && text.trim() !== "" && name.trim() !== "") out[name.trim()] = text.trim();
|
|
2338
|
+
}
|
|
2339
|
+
return out;
|
|
2340
|
+
}
|
|
2276
2341
|
function parseHexRgb(hex) {
|
|
2277
2342
|
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
2278
2343
|
if (!m) return null;
|
|
@@ -2342,6 +2407,9 @@ function resolveKbachConfig(config) {
|
|
|
2342
2407
|
if (config.extend?.container) {
|
|
2343
2408
|
theme = { ...theme, container: { ...theme.container, ...config.extend.container } };
|
|
2344
2409
|
}
|
|
2410
|
+
if (config.compose) {
|
|
2411
|
+
theme = { ...theme, compose: { ...theme.compose, ...composeMap(config.compose) } };
|
|
2412
|
+
}
|
|
2345
2413
|
if (config.darkMode) {
|
|
2346
2414
|
theme = { ...theme, darkMode: config.darkMode };
|
|
2347
2415
|
}
|
package/dist/index.web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ColorEntry, ContainerConfig, ThemeConfig, defaultTheme, getTheme, setTheme } from './theme';
|
|
2
|
-
export { B as Button, a as ButtonProps, C as ClassArray, b as ClassDictionary, c as ClassValue, d as ColorScale, e as ColorsAPI, H as H1, f as H2, g as H3, h as H4, i as H5, j as H6, k as HeadingProps, K as KbachConfig, P as Paragraph, l as ParagraphProps, T as ThemeProvider, m as ThemeProviderProps, n as ThemeState, p as applyKbachConfig, q as clsx, r as resolveKbachConfig, u as useColors, s as useDynamicToken, t as useTheme } from './semanticElements-
|
|
2
|
+
export { B as Button, a as ButtonProps, C as ClassArray, b as ClassDictionary, c as ClassValue, d as ColorScale, e as ColorsAPI, H as H1, f as H2, g as H3, h as H4, i as H5, j as H6, k as HeadingProps, K as KbachConfig, P as Paragraph, l as ParagraphProps, T as ThemeProvider, m as ThemeProviderProps, n as ThemeState, p as applyKbachConfig, q as clsx, r as resolveKbachConfig, u as useColors, s as useDynamicToken, t as useTheme } from './semanticElements-CY-W_7tU.js';
|
|
3
3
|
export { ThemeMode, getGlobalDarkMode, getGlobalThemeMode, setGlobalThemeMode, subscribeGlobalDarkMode, toggleGlobalDarkMode } from './darkModeStore';
|
|
4
4
|
export { deleteDynamicToken, getDynamicToken, setDynamicToken, subscribeDynamicTokens } from './dynamicTokens';
|
|
5
5
|
import 'react';
|