@kbach/react-native 1.0.0-beta.10 → 1.0.0-beta.12
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/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-3LNPXJEW.mjs +192 -0
- package/dist/{chunk-DLIXI5OW.mjs → chunk-4DQXTAM3.mjs} +11 -1
- package/dist/{chunk-4N7UEVQL.mjs → chunk-7AIH5MXY.mjs} +2 -2
- package/dist/{chunk-XHL653X2.mjs → chunk-MGXMALPC.mjs} +31 -3
- package/dist/{chunk-YOC3SHF5.mjs → chunk-OJIFXMLD.mjs} +1 -1
- package/dist/index.js +31 -3
- package/dist/index.mjs +1 -1
- package/dist/index.web.js +1 -1
- package/dist/index.web.mjs +3 -3
- package/dist/jsx-dev-runtime.js +90 -52
- package/dist/jsx-dev-runtime.mjs +4 -4
- package/dist/jsx-dev-runtime.web.js +210 -169
- package/dist/jsx-dev-runtime.web.mjs +4 -3
- package/dist/jsx-runtime.js +80 -42
- package/dist/jsx-runtime.mjs +4 -4
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-H5Z24XX5.mjs +0 -192
package/dist/index.web.mjs
CHANGED
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
useColors,
|
|
6
6
|
useTheme
|
|
7
7
|
} from "./chunk-TDWBXJH5.mjs";
|
|
8
|
+
import {
|
|
9
|
+
resolveClassName
|
|
10
|
+
} from "./chunk-3LNPXJEW.mjs";
|
|
8
11
|
import {
|
|
9
12
|
getGlobalDarkMode,
|
|
10
13
|
getGlobalThemeMode,
|
|
@@ -12,9 +15,6 @@ import {
|
|
|
12
15
|
subscribeGlobalDarkMode,
|
|
13
16
|
toggleGlobalDarkMode
|
|
14
17
|
} from "./chunk-RBJXE32L.mjs";
|
|
15
|
-
import {
|
|
16
|
-
resolveClassName
|
|
17
|
-
} from "./chunk-H5Z24XX5.mjs";
|
|
18
18
|
import {
|
|
19
19
|
defaultTheme,
|
|
20
20
|
getTheme,
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -28,53 +28,10 @@ module.exports = __toCommonJS(jsx_dev_runtime_exports);
|
|
|
28
28
|
// src/jsxRuntimeCore.ts
|
|
29
29
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
30
|
var import_react = require("react");
|
|
31
|
-
var
|
|
32
|
-
function makeElement(isStaticChildren, type, props, key) {
|
|
33
|
-
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
34
|
-
}
|
|
35
|
-
function resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, pressed) {
|
|
36
|
-
const resolved = resolveStyle2(classStrRaw, pressed);
|
|
37
|
-
if (userStyle === void 0) {
|
|
38
|
-
return resolved;
|
|
39
|
-
}
|
|
40
|
-
if (typeof userStyle === "function") {
|
|
41
|
-
return [resolved, userStyle({ pressed })];
|
|
42
|
-
}
|
|
43
|
-
return [resolved, userStyle];
|
|
44
|
-
}
|
|
45
|
-
function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
46
|
-
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
47
|
-
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
48
|
-
}
|
|
49
|
-
const { className: classStrRaw, style: userStyle, ...rest } = rawProps;
|
|
50
|
-
if (typeof classStrRaw !== "string") {
|
|
51
|
-
return makeElement(isStaticChildren, type, rawProps, key);
|
|
52
|
-
}
|
|
53
|
-
const finalStyle = type === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
54
|
-
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
|
|
55
|
-
}
|
|
56
|
-
function createJsxFunctions(resolveStyle2) {
|
|
57
|
-
function jsx2(type, props, key) {
|
|
58
|
-
return processElement(resolveStyle2, type, props, key, false);
|
|
59
|
-
}
|
|
60
|
-
function jsxs2(type, props, key) {
|
|
61
|
-
return processElement(resolveStyle2, type, props, key, true);
|
|
62
|
-
}
|
|
63
|
-
return { jsx: jsx2, jsxs: jsxs2 };
|
|
64
|
-
}
|
|
65
|
-
function createJsxDEV(jsx2, jsxs2) {
|
|
66
|
-
return function jsxDEV2(type, props, key, isStaticChildren, source, self) {
|
|
67
|
-
const element = (isStaticChildren ? jsxs2 : jsx2)(type, props, key);
|
|
68
|
-
if (source && element && typeof element === "object" && Object.isExtensible(element)) {
|
|
69
|
-
element._source = source;
|
|
70
|
-
element._self = self;
|
|
71
|
-
}
|
|
72
|
-
return element;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
31
|
+
var import_react_native2 = require("react-native");
|
|
75
32
|
|
|
76
|
-
// src/
|
|
77
|
-
var
|
|
33
|
+
// src/darkModeStore.ts
|
|
34
|
+
var import_react_native = require("react-native");
|
|
78
35
|
|
|
79
36
|
// src/generatedPalette.ts
|
|
80
37
|
var PALETTE = {
|
|
@@ -434,10 +391,9 @@ function getThemeJson() {
|
|
|
434
391
|
}
|
|
435
392
|
|
|
436
393
|
// src/darkModeStore.ts
|
|
437
|
-
var import_react_native2 = require("react-native");
|
|
438
394
|
var listeners = /* @__PURE__ */ new Set();
|
|
439
395
|
function systemPrefersDark() {
|
|
440
|
-
return
|
|
396
|
+
return import_react_native.Appearance.getColorScheme() === "dark";
|
|
441
397
|
}
|
|
442
398
|
function resolveIsDark(m) {
|
|
443
399
|
return m === "system" ? systemPrefersDark() : m === "dark";
|
|
@@ -456,7 +412,7 @@ function applyToDom(dark) {
|
|
|
456
412
|
var mode = "system";
|
|
457
413
|
var isDark = resolveIsDark(mode);
|
|
458
414
|
applyToDom(isDark);
|
|
459
|
-
var subscription =
|
|
415
|
+
var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
|
|
460
416
|
if (mode !== "system") return;
|
|
461
417
|
isDark = colorScheme === "dark";
|
|
462
418
|
applyToDom(isDark);
|
|
@@ -469,6 +425,60 @@ function getGlobalDarkMode() {
|
|
|
469
425
|
return isDark;
|
|
470
426
|
}
|
|
471
427
|
|
|
428
|
+
// src/jsxRuntimeCore.ts
|
|
429
|
+
function makeElement(isStaticChildren, type, props, key) {
|
|
430
|
+
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
431
|
+
}
|
|
432
|
+
function resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, pressed) {
|
|
433
|
+
const resolved = resolveStyle2(classStrRaw, pressed);
|
|
434
|
+
if (userStyle === void 0) {
|
|
435
|
+
return resolved;
|
|
436
|
+
}
|
|
437
|
+
if (typeof userStyle === "function") {
|
|
438
|
+
return [resolved, userStyle({ pressed })];
|
|
439
|
+
}
|
|
440
|
+
return [resolved, userStyle];
|
|
441
|
+
}
|
|
442
|
+
var DARK_MODIFIER_RE = /(^|\s)dark:/;
|
|
443
|
+
function darkModeKeySuffix(classStrRaw) {
|
|
444
|
+
return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${getGlobalDarkMode()}` : "";
|
|
445
|
+
}
|
|
446
|
+
function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
447
|
+
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
448
|
+
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
449
|
+
}
|
|
450
|
+
const { className: classStrRaw, style: userStyle, ...rest } = rawProps;
|
|
451
|
+
if (typeof classStrRaw !== "string") {
|
|
452
|
+
return makeElement(isStaticChildren, type, rawProps, key);
|
|
453
|
+
}
|
|
454
|
+
const finalStyle = type === import_react_native2.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
455
|
+
const suffix = darkModeKeySuffix(classStrRaw);
|
|
456
|
+
const finalKey = suffix ? `${key ?? ""}${suffix}` : key;
|
|
457
|
+
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, finalKey);
|
|
458
|
+
}
|
|
459
|
+
function createJsxFunctions(resolveStyle2) {
|
|
460
|
+
function jsx2(type, props, key) {
|
|
461
|
+
return processElement(resolveStyle2, type, props, key, false);
|
|
462
|
+
}
|
|
463
|
+
function jsxs2(type, props, key) {
|
|
464
|
+
return processElement(resolveStyle2, type, props, key, true);
|
|
465
|
+
}
|
|
466
|
+
return { jsx: jsx2, jsxs: jsxs2 };
|
|
467
|
+
}
|
|
468
|
+
function createJsxDEV(jsx2, jsxs2) {
|
|
469
|
+
return function jsxDEV2(type, props, key, isStaticChildren, source, self) {
|
|
470
|
+
const element = (isStaticChildren ? jsxs2 : jsx2)(type, props, key);
|
|
471
|
+
if (source && element && typeof element === "object" && Object.isExtensible(element)) {
|
|
472
|
+
element._source = source;
|
|
473
|
+
element._self = self;
|
|
474
|
+
}
|
|
475
|
+
return element;
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// src/nativeBridge.ts
|
|
480
|
+
var import_react_native3 = require("react-native");
|
|
481
|
+
|
|
472
482
|
// src/jsEngine/parser.ts
|
|
473
483
|
var VALUE_PREFIXES = [
|
|
474
484
|
"bg-opacity-",
|
|
@@ -1102,6 +1112,36 @@ function lookupHex(theme, key) {
|
|
|
1102
1112
|
const entry = theme.colors[key];
|
|
1103
1113
|
return typeof entry === "string" ? entry : null;
|
|
1104
1114
|
}
|
|
1115
|
+
function hexToRgb(hex) {
|
|
1116
|
+
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
1117
|
+
if (!m) return null;
|
|
1118
|
+
let h = m[1];
|
|
1119
|
+
if (h.length === 3) h = h.split("").map((c) => c + c).join("");
|
|
1120
|
+
const n = parseInt(h, 16);
|
|
1121
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
1122
|
+
}
|
|
1123
|
+
function splitOpacity(value) {
|
|
1124
|
+
const slash = value.lastIndexOf("/");
|
|
1125
|
+
if (slash === -1) return [value, null];
|
|
1126
|
+
const opacityText = value.slice(slash + 1);
|
|
1127
|
+
const n = Number(opacityText);
|
|
1128
|
+
if (opacityText !== "" && Number.isInteger(n) && n >= 0 && n <= 100) {
|
|
1129
|
+
return [value.slice(0, slash), n];
|
|
1130
|
+
}
|
|
1131
|
+
return [value, null];
|
|
1132
|
+
}
|
|
1133
|
+
function colorValue(theme, parsed) {
|
|
1134
|
+
const value = parsed.value;
|
|
1135
|
+
if (value === null) return null;
|
|
1136
|
+
if (parsed.isArbitrary) return value;
|
|
1137
|
+
const [name, opacity] = splitOpacity(value);
|
|
1138
|
+
const hex = lookupHex(theme, name);
|
|
1139
|
+
if (hex === null) return null;
|
|
1140
|
+
if (opacity === null) return hex;
|
|
1141
|
+
const rgb = hexToRgb(hex);
|
|
1142
|
+
if (rgb === null) return hex;
|
|
1143
|
+
return `rgba(${rgb.join(",")},${opacity / 100})`;
|
|
1144
|
+
}
|
|
1105
1145
|
|
|
1106
1146
|
// src/jsEngine/resolvers/border.ts
|
|
1107
1147
|
function radiusSize(key) {
|
|
@@ -1507,9 +1547,7 @@ function resolveLeadingTrackingNative(parsed) {
|
|
|
1507
1547
|
return null;
|
|
1508
1548
|
}
|
|
1509
1549
|
function nativeHexColor(parsed, theme) {
|
|
1510
|
-
|
|
1511
|
-
if (value === null) return null;
|
|
1512
|
-
return parsed.isArbitrary ? value : lookupHex(theme, value);
|
|
1550
|
+
return colorValue(theme, parsed);
|
|
1513
1551
|
}
|
|
1514
1552
|
function resolveTextNative(parsed, theme) {
|
|
1515
1553
|
if (!parsed.isArbitrary && parsed.value !== null) {
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsx,
|
|
3
3
|
jsxs
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-RBJXE32L.mjs";
|
|
4
|
+
} from "./chunk-7AIH5MXY.mjs";
|
|
5
|
+
import "./chunk-MGXMALPC.mjs";
|
|
7
6
|
import {
|
|
8
7
|
Fragment,
|
|
9
8
|
createJsxDEV
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4DQXTAM3.mjs";
|
|
10
|
+
import "./chunk-RBJXE32L.mjs";
|
|
11
11
|
import "./chunk-HK6PDJJK.mjs";
|
|
12
12
|
|
|
13
13
|
// src/jsx-dev-runtime.tsx
|