@kbach/react-native 1.0.0-beta.13 → 1.0.0-beta.14
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/dist/{chunk-4DQXTAM3.mjs → chunk-H57O3BJO.mjs} +26 -5
- package/dist/{chunk-GU6DH6UE.mjs → chunk-WT6WH54F.mjs} +1 -1
- package/dist/jsx-dev-runtime.js +27 -3
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-dev-runtime.web.mjs +1 -1
- package/dist/jsx-runtime.js +27 -3
- package/dist/jsx-runtime.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getGlobalDarkMode
|
|
2
|
+
getGlobalDarkMode,
|
|
3
|
+
subscribeGlobalDarkMode
|
|
3
4
|
} from "./chunk-RBJXE32L.mjs";
|
|
4
5
|
|
|
5
6
|
// src/jsxRuntimeCore.ts
|
|
6
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Fragment } from "react";
|
|
8
|
+
import { Fragment, useSyncExternalStore } from "react";
|
|
8
9
|
import { Pressable } from "react-native";
|
|
9
10
|
function makeElement(isStaticChildren, type, props, key) {
|
|
10
11
|
return (isStaticChildren ? _jsxs : _jsx)(type, props, key);
|
|
@@ -23,6 +24,21 @@ var DARK_MODIFIER_RE = /(^|\s)dark:/;
|
|
|
23
24
|
function darkModeKeySuffix(classStrRaw) {
|
|
24
25
|
return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${getGlobalDarkMode()}` : "";
|
|
25
26
|
}
|
|
27
|
+
function DarkAwareElement({
|
|
28
|
+
hostType,
|
|
29
|
+
hostRest,
|
|
30
|
+
classStrRaw,
|
|
31
|
+
userStyle,
|
|
32
|
+
resolveStyle,
|
|
33
|
+
elementKey,
|
|
34
|
+
isStaticChildren
|
|
35
|
+
}) {
|
|
36
|
+
useSyncExternalStore(subscribeGlobalDarkMode, getGlobalDarkMode);
|
|
37
|
+
const finalStyle = hostType === Pressable ? (state) => resolvedStyleFor(resolveStyle, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle, classStrRaw, userStyle, false);
|
|
38
|
+
const suffix = darkModeKeySuffix(classStrRaw);
|
|
39
|
+
const finalKey = suffix ? `${elementKey ?? ""}${suffix}` : elementKey;
|
|
40
|
+
return makeElement(isStaticChildren, hostType, { ...hostRest, style: finalStyle }, finalKey);
|
|
41
|
+
}
|
|
26
42
|
function processElement(resolveStyle, type, rawProps, key, isStaticChildren) {
|
|
27
43
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
28
44
|
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
@@ -31,10 +47,15 @@ function processElement(resolveStyle, type, rawProps, key, isStaticChildren) {
|
|
|
31
47
|
if (typeof classStrRaw !== "string") {
|
|
32
48
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
33
49
|
}
|
|
50
|
+
if (DARK_MODIFIER_RE.test(classStrRaw)) {
|
|
51
|
+
return _jsx(
|
|
52
|
+
DarkAwareElement,
|
|
53
|
+
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle, elementKey: key, isStaticChildren },
|
|
54
|
+
key
|
|
55
|
+
);
|
|
56
|
+
}
|
|
34
57
|
const finalStyle = type === Pressable ? (state) => resolvedStyleFor(resolveStyle, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle, classStrRaw, userStyle, false);
|
|
35
|
-
|
|
36
|
-
const finalKey = suffix ? `${key ?? ""}${suffix}` : key;
|
|
37
|
-
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, finalKey);
|
|
58
|
+
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
|
|
38
59
|
}
|
|
39
60
|
function createJsxFunctions(resolveStyle) {
|
|
40
61
|
function jsx(type, props, key) {
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -424,6 +424,10 @@ function notify() {
|
|
|
424
424
|
function getGlobalDarkMode() {
|
|
425
425
|
return isDark;
|
|
426
426
|
}
|
|
427
|
+
function subscribeGlobalDarkMode(listener) {
|
|
428
|
+
listeners.add(listener);
|
|
429
|
+
return () => listeners.delete(listener);
|
|
430
|
+
}
|
|
427
431
|
|
|
428
432
|
// src/jsxRuntimeCore.ts
|
|
429
433
|
function makeElement(isStaticChildren, type, props, key) {
|
|
@@ -443,6 +447,21 @@ var DARK_MODIFIER_RE = /(^|\s)dark:/;
|
|
|
443
447
|
function darkModeKeySuffix(classStrRaw) {
|
|
444
448
|
return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${getGlobalDarkMode()}` : "";
|
|
445
449
|
}
|
|
450
|
+
function DarkAwareElement({
|
|
451
|
+
hostType,
|
|
452
|
+
hostRest,
|
|
453
|
+
classStrRaw,
|
|
454
|
+
userStyle,
|
|
455
|
+
resolveStyle: resolveStyle2,
|
|
456
|
+
elementKey,
|
|
457
|
+
isStaticChildren
|
|
458
|
+
}) {
|
|
459
|
+
(0, import_react.useSyncExternalStore)(subscribeGlobalDarkMode, getGlobalDarkMode);
|
|
460
|
+
const finalStyle = hostType === import_react_native2.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
461
|
+
const suffix = darkModeKeySuffix(classStrRaw);
|
|
462
|
+
const finalKey = suffix ? `${elementKey ?? ""}${suffix}` : elementKey;
|
|
463
|
+
return makeElement(isStaticChildren, hostType, { ...hostRest, style: finalStyle }, finalKey);
|
|
464
|
+
}
|
|
446
465
|
function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
447
466
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
448
467
|
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
@@ -451,10 +470,15 @@ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
|
451
470
|
if (typeof classStrRaw !== "string") {
|
|
452
471
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
453
472
|
}
|
|
473
|
+
if (DARK_MODIFIER_RE.test(classStrRaw)) {
|
|
474
|
+
return (0, import_jsx_runtime.jsx)(
|
|
475
|
+
DarkAwareElement,
|
|
476
|
+
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
477
|
+
key
|
|
478
|
+
);
|
|
479
|
+
}
|
|
454
480
|
const finalStyle = type === import_react_native2.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
455
|
-
|
|
456
|
-
const finalKey = suffix ? `${key ?? ""}${suffix}` : key;
|
|
457
|
-
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, finalKey);
|
|
481
|
+
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
|
|
458
482
|
}
|
|
459
483
|
function createJsxFunctions(resolveStyle2) {
|
|
460
484
|
function jsx2(type, props, key) {
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsx,
|
|
3
3
|
jsxs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WT6WH54F.mjs";
|
|
5
5
|
import "./chunk-JMNJCPGK.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Fragment,
|
|
8
8
|
createJsxDEV
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-H57O3BJO.mjs";
|
|
10
10
|
import "./chunk-RBJXE32L.mjs";
|
|
11
11
|
import "./chunk-HK6PDJJK.mjs";
|
|
12
12
|
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -425,6 +425,10 @@ function notify() {
|
|
|
425
425
|
function getGlobalDarkMode() {
|
|
426
426
|
return isDark;
|
|
427
427
|
}
|
|
428
|
+
function subscribeGlobalDarkMode(listener) {
|
|
429
|
+
listeners.add(listener);
|
|
430
|
+
return () => listeners.delete(listener);
|
|
431
|
+
}
|
|
428
432
|
|
|
429
433
|
// src/jsxRuntimeCore.ts
|
|
430
434
|
function makeElement(isStaticChildren, type, props, key) {
|
|
@@ -444,6 +448,21 @@ var DARK_MODIFIER_RE = /(^|\s)dark:/;
|
|
|
444
448
|
function darkModeKeySuffix(classStrRaw) {
|
|
445
449
|
return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${getGlobalDarkMode()}` : "";
|
|
446
450
|
}
|
|
451
|
+
function DarkAwareElement({
|
|
452
|
+
hostType,
|
|
453
|
+
hostRest,
|
|
454
|
+
classStrRaw,
|
|
455
|
+
userStyle,
|
|
456
|
+
resolveStyle: resolveStyle2,
|
|
457
|
+
elementKey,
|
|
458
|
+
isStaticChildren
|
|
459
|
+
}) {
|
|
460
|
+
(0, import_react.useSyncExternalStore)(subscribeGlobalDarkMode, getGlobalDarkMode);
|
|
461
|
+
const finalStyle = hostType === import_react_native2.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
462
|
+
const suffix = darkModeKeySuffix(classStrRaw);
|
|
463
|
+
const finalKey = suffix ? `${elementKey ?? ""}${suffix}` : elementKey;
|
|
464
|
+
return makeElement(isStaticChildren, hostType, { ...hostRest, style: finalStyle }, finalKey);
|
|
465
|
+
}
|
|
447
466
|
function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
448
467
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
449
468
|
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
@@ -452,10 +471,15 @@ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
|
452
471
|
if (typeof classStrRaw !== "string") {
|
|
453
472
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
454
473
|
}
|
|
474
|
+
if (DARK_MODIFIER_RE.test(classStrRaw)) {
|
|
475
|
+
return (0, import_jsx_runtime.jsx)(
|
|
476
|
+
DarkAwareElement,
|
|
477
|
+
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
478
|
+
key
|
|
479
|
+
);
|
|
480
|
+
}
|
|
455
481
|
const finalStyle = type === import_react_native2.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
456
|
-
|
|
457
|
-
const finalKey = suffix ? `${key ?? ""}${suffix}` : key;
|
|
458
|
-
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, finalKey);
|
|
482
|
+
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
|
|
459
483
|
}
|
|
460
484
|
function createJsxFunctions(resolveStyle2) {
|
|
461
485
|
function jsx2(type, props, key) {
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsx,
|
|
3
3
|
jsxs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WT6WH54F.mjs";
|
|
5
5
|
import "./chunk-JMNJCPGK.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Fragment
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-H57O3BJO.mjs";
|
|
9
9
|
import "./chunk-RBJXE32L.mjs";
|
|
10
10
|
import "./chunk-HK6PDJJK.mjs";
|
|
11
11
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/react-native",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.14",
|
|
4
4
|
"description": "Kbach's utility-class styling engine for React Native — the same class names as @kbach/react, resolved to a StyleSheet-ready style object via a Kotlin/JNI TurboModule (native), the same WASM engine @kbach/react uses (Expo Web / react-native-web), or a pure-JS fallback engine (Expo Go). Ships its own native Android module — one npm install, no separate native package. Beta. Native is Android-only (no iOS bridge yet); works with the React Native CLI, an Expo dev client, AND Expo Go (a reduced-coverage pure-JS fallback, since Expo Go can't load any custom native module).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|