@kbach/react-native 1.0.0-beta.10 → 1.0.0-beta.11

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,3 +1,7 @@
1
+ import {
2
+ getGlobalDarkMode
3
+ } from "./chunk-RBJXE32L.mjs";
4
+
1
5
  // src/jsxRuntimeCore.ts
2
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
7
  import { Fragment } from "react";
@@ -15,6 +19,10 @@ function resolvedStyleFor(resolveStyle, classStrRaw, userStyle, pressed) {
15
19
  }
16
20
  return [resolved, userStyle];
17
21
  }
22
+ var DARK_MODIFIER_RE = /(^|\s)dark:/;
23
+ function darkModeKeySuffix(classStrRaw) {
24
+ return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${getGlobalDarkMode()}` : "";
25
+ }
18
26
  function processElement(resolveStyle, type, rawProps, key, isStaticChildren) {
19
27
  if (type === null || typeof type === "symbol" || !rawProps) {
20
28
  return makeElement(isStaticChildren, type, rawProps ?? {}, key);
@@ -24,7 +32,9 @@ function processElement(resolveStyle, type, rawProps, key, isStaticChildren) {
24
32
  return makeElement(isStaticChildren, type, rawProps, key);
25
33
  }
26
34
  const finalStyle = type === Pressable ? (state) => resolvedStyleFor(resolveStyle, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle, classStrRaw, userStyle, false);
27
- return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
35
+ const suffix = darkModeKeySuffix(classStrRaw);
36
+ const finalKey = suffix ? `${key ?? ""}${suffix}` : key;
37
+ return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, finalKey);
28
38
  }
29
39
  function createJsxFunctions(resolveStyle) {
30
40
  function jsx(type, props, key) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-XHL653X2.mjs";
4
4
  import {
5
5
  createJsxFunctions
6
- } from "./chunk-DLIXI5OW.mjs";
6
+ } from "./chunk-4DQXTAM3.mjs";
7
7
 
8
8
  // src/jsx-runtime.tsx
9
9
  var { jsx, jsxs } = createJsxFunctions(resolveStyle);
@@ -5,6 +5,9 @@ import {
5
5
  useColors,
6
6
  useTheme
7
7
  } from "./chunk-TDWBXJH5.mjs";
8
+ import {
9
+ resolveClassName
10
+ } from "./chunk-H5Z24XX5.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,
@@ -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 import_react_native = require("react-native");
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/nativeBridge.ts
77
- var import_react_native3 = require("react-native");
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 import_react_native2.Appearance.getColorScheme() === "dark";
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 = import_react_native2.Appearance.addChangeListener(({ colorScheme }) => {
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-",
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  jsx,
3
3
  jsxs
4
- } from "./chunk-4N7UEVQL.mjs";
4
+ } from "./chunk-5MU6PEXV.mjs";
5
5
  import "./chunk-XHL653X2.mjs";
6
- import "./chunk-RBJXE32L.mjs";
7
6
  import {
8
7
  Fragment,
9
8
  createJsxDEV
10
- } from "./chunk-DLIXI5OW.mjs";
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