@kbach/react-native 1.0.0-beta.2 → 1.0.0-beta.4

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.
Files changed (41) hide show
  1. package/README.md +59 -26
  2. package/android/build.gradle +36 -0
  3. package/android/src/main/AndroidManifest.xml +14 -0
  4. package/android/src/main/java/com/kbachnative/KbachModule.kt +83 -0
  5. package/android/src/main/java/com/kbachnative/KbachPackage.kt +54 -0
  6. package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
  7. package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
  8. package/dist/chunk-4KCCEMEN.mjs +66 -0
  9. package/dist/{chunk-YHF3QLRL.mjs → chunk-AEVOM2NB.mjs} +9 -12
  10. package/dist/{chunk-SVMYVXY6.mjs → chunk-DLIXI5OW.mjs} +23 -14
  11. package/dist/chunk-FG5E4NLJ.mjs +18 -0
  12. package/dist/chunk-KSDFO34H.mjs +32 -0
  13. package/dist/chunk-OJQAJLYT.mjs +14 -0
  14. package/dist/chunk-ZUE6SCTE.mjs +14 -0
  15. package/dist/index.d.mts +13 -0
  16. package/dist/index.d.ts +13 -0
  17. package/dist/index.js +9 -2
  18. package/dist/index.mjs +9 -57
  19. package/dist/index.web.d.mts +7 -0
  20. package/dist/index.web.d.ts +7 -0
  21. package/dist/index.web.js +488 -0
  22. package/dist/index.web.mjs +32 -0
  23. package/dist/jsx-dev-runtime.d.mts +3 -12
  24. package/dist/jsx-dev-runtime.d.ts +3 -12
  25. package/dist/jsx-dev-runtime.js +61 -47
  26. package/dist/jsx-dev-runtime.mjs +8 -11
  27. package/dist/jsx-dev-runtime.web.d.mts +10 -0
  28. package/dist/jsx-dev-runtime.web.d.ts +10 -0
  29. package/dist/jsx-dev-runtime.web.js +437 -0
  30. package/dist/jsx-dev-runtime.web.mjs +17 -0
  31. package/dist/jsx-runtime.d.mts +3 -23
  32. package/dist/jsx-runtime.d.ts +3 -23
  33. package/dist/jsx-runtime.js +51 -38
  34. package/dist/jsx-runtime.mjs +6 -3
  35. package/dist/jsx-runtime.web.d.mts +7 -0
  36. package/dist/jsx-runtime.web.d.ts +7 -0
  37. package/dist/jsx-runtime.web.js +426 -0
  38. package/dist/jsx-runtime.web.mjs +14 -0
  39. package/package.json +27 -6
  40. package/react-native.config.js +29 -0
  41. package/specs/NativeKbachModule.ts +31 -0
@@ -0,0 +1,32 @@
1
+ import {
2
+ ThemeProvider,
3
+ useGlobalDarkMode,
4
+ useTheme
5
+ } from "./chunk-4KCCEMEN.mjs";
6
+ import {
7
+ resolveStyle
8
+ } from "./chunk-KSDFO34H.mjs";
9
+ import {
10
+ defaultTheme,
11
+ getGlobalDarkMode,
12
+ getGlobalThemeMode,
13
+ getTheme,
14
+ setGlobalThemeMode,
15
+ setTheme,
16
+ subscribeGlobalDarkMode,
17
+ toggleGlobalDarkMode
18
+ } from "./chunk-AEVOM2NB.mjs";
19
+ export {
20
+ ThemeProvider,
21
+ defaultTheme,
22
+ getGlobalDarkMode,
23
+ getGlobalThemeMode,
24
+ getTheme,
25
+ resolveStyle,
26
+ setGlobalThemeMode,
27
+ setTheme,
28
+ subscribeGlobalDarkMode,
29
+ toggleGlobalDarkMode,
30
+ useGlobalDarkMode,
31
+ useTheme
32
+ };
@@ -1,19 +1,10 @@
1
- import { ReactElement } from 'react';
1
+ import * as react from 'react';
2
2
  export { Fragment } from 'react';
3
3
 
4
- /**
5
- * @kbach/react-native/jsx-dev-runtime
6
- *
7
- * Development variant — Metro calls jsxDEV instead of jsx/jsxs in dev
8
- * builds. Same pattern as @kbach/react/jsx-dev-runtime (Phase 3): reuses
9
- * jsx/jsxs for the actual interception, then patches _source/_self onto
10
- * the result so React DevTools shows the original file/line.
11
- */
12
-
13
- declare function jsxDEV(type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
4
+ declare const jsxDEV: (type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
14
5
  fileName: string;
15
6
  lineNumber: number;
16
7
  columnNumber: number;
17
- }, self?: unknown): ReactElement;
8
+ }, self?: unknown) => react.ReactElement;
18
9
 
19
10
  export { jsxDEV };
@@ -1,19 +1,10 @@
1
- import { ReactElement } from 'react';
1
+ import * as react from 'react';
2
2
  export { Fragment } from 'react';
3
3
 
4
- /**
5
- * @kbach/react-native/jsx-dev-runtime
6
- *
7
- * Development variant — Metro calls jsxDEV instead of jsx/jsxs in dev
8
- * builds. Same pattern as @kbach/react/jsx-dev-runtime (Phase 3): reuses
9
- * jsx/jsxs for the actual interception, then patches _source/_self onto
10
- * the result so React DevTools shows the original file/line.
11
- */
12
-
13
- declare function jsxDEV(type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
4
+ declare const jsxDEV: (type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
14
5
  fileName: string;
15
6
  lineNumber: number;
16
7
  columnNumber: number;
17
- }, self?: unknown): ReactElement;
8
+ }, self?: unknown) => react.ReactElement;
18
9
 
19
10
  export { jsxDEV };
@@ -25,13 +25,56 @@ __export(jsx_dev_runtime_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(jsx_dev_runtime_exports);
27
27
 
28
- // src/jsx-runtime.tsx
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_native3 = require("react-native");
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
+ }
32
75
 
33
76
  // src/nativeBridge.ts
34
- var import_react_native2 = require("react-native");
77
+ var import_react_native3 = require("react-native");
35
78
 
36
79
  // src/generatedPalette.ts
37
80
  var PALETTE = {
@@ -324,7 +367,13 @@ var defaultTheme = {
324
367
  "6": 24,
325
368
  "8": 32
326
369
  },
327
- screens: {},
370
+ screens: {
371
+ sm: 640,
372
+ md: 768,
373
+ lg: 1024,
374
+ xl: 1280,
375
+ "2xl": 1536
376
+ },
328
377
  darkMode: "attribute"
329
378
  };
330
379
  var activeThemeJson = JSON.stringify(defaultTheme);
@@ -333,17 +382,17 @@ function getThemeJson() {
333
382
  }
334
383
 
335
384
  // src/darkModeStore.ts
336
- var import_react_native = require("react-native");
385
+ var import_react_native2 = require("react-native");
337
386
  var listeners = /* @__PURE__ */ new Set();
338
387
  function systemPrefersDark() {
339
- return import_react_native.Appearance.getColorScheme() === "dark";
388
+ return import_react_native2.Appearance.getColorScheme() === "dark";
340
389
  }
341
390
  function resolveIsDark(m) {
342
391
  return m === "system" ? systemPrefersDark() : m === "dark";
343
392
  }
344
393
  var mode = "system";
345
394
  var isDark = resolveIsDark(mode);
346
- var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
395
+ var subscription = import_react_native2.Appearance.addChangeListener(({ colorScheme }) => {
347
396
  if (mode !== "system") return;
348
397
  isDark = colorScheme === "dark";
349
398
  notify();
@@ -357,53 +406,18 @@ function getGlobalDarkMode() {
357
406
 
358
407
  // src/nativeBridge.ts
359
408
  function resolveStyle(classString, pressed = false) {
360
- const KbachModule = import_react_native2.TurboModuleRegistry.getEnforcing("KbachModule");
409
+ const KbachModule = import_react_native3.TurboModuleRegistry.getEnforcing("KbachModule");
361
410
  const colorScheme = getGlobalDarkMode() ? "dark" : "light";
362
- const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed);
411
+ const width = import_react_native3.Dimensions.get("window").width;
412
+ const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed, width);
363
413
  return JSON.parse(json);
364
414
  }
365
415
 
366
416
  // src/jsx-runtime.tsx
367
- function makeElement(isStaticChildren, type, props, key) {
368
- return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
369
- }
370
- function resolvedStyleFor(classStrRaw, userStyle, pressed) {
371
- const resolved = resolveStyle(classStrRaw, pressed);
372
- if (userStyle === void 0) {
373
- return resolved;
374
- }
375
- if (typeof userStyle === "function") {
376
- return [resolved, userStyle({ pressed })];
377
- }
378
- return [resolved, userStyle];
379
- }
380
- function processElement(type, rawProps, key, isStaticChildren) {
381
- if (type === null || typeof type === "symbol" || !rawProps) {
382
- return makeElement(isStaticChildren, type, rawProps ?? {}, key);
383
- }
384
- const { className: classStrRaw, style: userStyle, ...rest } = rawProps;
385
- if (typeof classStrRaw !== "string") {
386
- return makeElement(isStaticChildren, type, rawProps, key);
387
- }
388
- const finalStyle = type === import_react_native3.Pressable ? (state) => resolvedStyleFor(classStrRaw, userStyle, state.pressed) : resolvedStyleFor(classStrRaw, userStyle, false);
389
- return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
390
- }
391
- function jsx(type, props, key) {
392
- return processElement(type, props, key, false);
393
- }
394
- function jsxs(type, props, key) {
395
- return processElement(type, props, key, true);
396
- }
417
+ var { jsx, jsxs } = createJsxFunctions(resolveStyle);
397
418
 
398
419
  // src/jsx-dev-runtime.tsx
399
- function jsxDEV(type, props, key, isStaticChildren, source, self) {
400
- const element = (isStaticChildren ? jsxs : jsx)(type, props, key);
401
- if (source && element && typeof element === "object" && Object.isExtensible(element)) {
402
- element._source = source;
403
- element._self = self;
404
- }
405
- return element;
406
- }
420
+ var jsxDEV = createJsxDEV(jsx, jsxs);
407
421
  // Annotate the CommonJS export names for ESM import in node:
408
422
  0 && (module.exports = {
409
423
  Fragment,
@@ -1,19 +1,16 @@
1
1
  import {
2
- Fragment,
3
2
  jsx,
4
3
  jsxs
5
- } from "./chunk-SVMYVXY6.mjs";
6
- import "./chunk-YHF3QLRL.mjs";
4
+ } from "./chunk-OJQAJLYT.mjs";
5
+ import "./chunk-FG5E4NLJ.mjs";
6
+ import {
7
+ Fragment,
8
+ createJsxDEV
9
+ } from "./chunk-DLIXI5OW.mjs";
10
+ import "./chunk-AEVOM2NB.mjs";
7
11
 
8
12
  // src/jsx-dev-runtime.tsx
9
- function jsxDEV(type, props, key, isStaticChildren, source, self) {
10
- const element = (isStaticChildren ? jsxs : jsx)(type, props, key);
11
- if (source && element && typeof element === "object" && Object.isExtensible(element)) {
12
- element._source = source;
13
- element._self = self;
14
- }
15
- return element;
16
- }
13
+ var jsxDEV = createJsxDEV(jsx, jsxs);
17
14
  export {
18
15
  Fragment,
19
16
  jsxDEV
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ export { Fragment } from 'react';
3
+
4
+ declare const jsxDEV: (type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
5
+ fileName: string;
6
+ lineNumber: number;
7
+ columnNumber: number;
8
+ }, self?: unknown) => react.ReactElement;
9
+
10
+ export { jsxDEV };
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ export { Fragment } from 'react';
3
+
4
+ declare const jsxDEV: (type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
5
+ fileName: string;
6
+ lineNumber: number;
7
+ columnNumber: number;
8
+ }, self?: unknown) => react.ReactElement;
9
+
10
+ export { jsxDEV };