@kbach/react-native 1.0.0-beta.8 → 1.0.0

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 (51) hide show
  1. package/AGENTS.md +495 -0
  2. package/LICENSE +21 -0
  3. package/README.md +209 -249
  4. package/THIRD_PARTY_NOTICES.md +41 -0
  5. package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
  6. package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
  7. package/dist/chunk-7CNURQSH.mjs +112 -0
  8. package/dist/{chunk-OIW7OQWO.mjs → chunk-HYQFT32E.mjs} +2 -2
  9. package/dist/chunk-MUPEQJRT.mjs +623 -0
  10. package/dist/darkModeStore.d.ts +73 -0
  11. package/dist/darkModeStore.js +118 -0
  12. package/dist/dynamicTokens.d.ts +53 -0
  13. package/dist/dynamicTokens.js +75 -0
  14. package/dist/index.d.ts +90 -71
  15. package/dist/index.js +1433 -606
  16. package/dist/index.web.d.ts +91 -1
  17. package/dist/index.web.js +323 -428
  18. package/dist/index.web.mjs +297 -11
  19. package/dist/jsx-dev-runtime.d.ts +2 -2
  20. package/dist/jsx-dev-runtime.js +1540 -589
  21. package/dist/jsx-dev-runtime.web.d.ts +2 -2
  22. package/dist/jsx-dev-runtime.web.js +20 -340
  23. package/dist/jsx-dev-runtime.web.mjs +18 -6
  24. package/dist/jsx-runtime.d.ts +3 -3
  25. package/dist/jsx-runtime.js +1530 -579
  26. package/dist/jsx-runtime.web.d.ts +3 -3
  27. package/dist/jsx-runtime.web.js +17 -340
  28. package/dist/jsx-runtime.web.mjs +2 -3
  29. package/dist/semanticElements-Bk3TB-vt.d.ts +334 -0
  30. package/dist/theme.d.ts +79 -0
  31. package/dist/{chunk-4BXM3QUV.mjs → theme.js} +120 -17
  32. package/llms.txt +38 -0
  33. package/package.json +15 -13
  34. package/src/babel-plugin.js +144 -2
  35. package/dist/ThemeContext-Dc5AC-m0.d.mts +0 -98
  36. package/dist/ThemeContext-Dc5AC-m0.d.ts +0 -98
  37. package/dist/chunk-CGU7UM2F.mjs +0 -66
  38. package/dist/chunk-DLIXI5OW.mjs +0 -53
  39. package/dist/chunk-JR3BLUAV.mjs +0 -1204
  40. package/dist/chunk-JS5KIGAB.mjs +0 -192
  41. package/dist/chunk-KV3ZIXSH.mjs +0 -14
  42. package/dist/chunk-Z664AKW7.mjs +0 -54
  43. package/dist/index.d.mts +0 -84
  44. package/dist/index.mjs +0 -34
  45. package/dist/index.web.d.mts +0 -15
  46. package/dist/jsx-dev-runtime.d.mts +0 -10
  47. package/dist/jsx-dev-runtime.mjs +0 -18
  48. package/dist/jsx-dev-runtime.web.d.mts +0 -10
  49. package/dist/jsx-runtime.d.mts +0 -7
  50. package/dist/jsx-runtime.mjs +0 -15
  51. package/dist/jsx-runtime.web.d.mts +0 -7
@@ -0,0 +1,112 @@
1
+ import {
2
+ getTheme
3
+ } from "./chunk-MUPEQJRT.mjs";
4
+
5
+ // src/darkModeStore.ts
6
+ import { Appearance } from "react-native";
7
+ var listeners = /* @__PURE__ */ new Set();
8
+ function systemPrefersDark() {
9
+ return Appearance.getColorScheme() === "dark";
10
+ }
11
+ function resolveIsDark(m) {
12
+ return m === "system" ? systemPrefersDark() : m === "dark";
13
+ }
14
+ function applyToDom(dark) {
15
+ if (typeof document === "undefined") return;
16
+ const root = document.documentElement;
17
+ const strategy = getTheme().darkMode;
18
+ root.classList.toggle("dark", strategy === "class" && dark);
19
+ root.classList.toggle("light", strategy === "class" && !dark);
20
+ if (strategy === "attribute") {
21
+ root.setAttribute("data-theme", dark ? "dark" : "light");
22
+ } else {
23
+ root.removeAttribute("data-theme");
24
+ }
25
+ }
26
+ var mode = "system";
27
+ var isDark = resolveIsDark(mode);
28
+ applyToDom(isDark);
29
+ var hasExplicitChoice = false;
30
+ var subscription = Appearance.addChangeListener(({ colorScheme }) => {
31
+ if (mode !== "system") return;
32
+ isDark = colorScheme === "dark";
33
+ applyToDom(isDark);
34
+ notify();
35
+ });
36
+ function notify() {
37
+ for (const listener of listeners) listener();
38
+ }
39
+ function resyncDomWithActiveTheme() {
40
+ applyToDom(isDark);
41
+ }
42
+ function getGlobalDarkMode() {
43
+ return isDark;
44
+ }
45
+ function getGlobalThemeMode() {
46
+ return mode;
47
+ }
48
+ function setGlobalThemeMode(nextMode) {
49
+ mode = nextMode;
50
+ isDark = resolveIsDark(nextMode);
51
+ hasExplicitChoice = true;
52
+ applyToDom(isDark);
53
+ notify();
54
+ }
55
+ function toggleGlobalDarkMode() {
56
+ setGlobalThemeMode(isDark ? "light" : "dark");
57
+ }
58
+ function subscribeGlobalDarkMode(listener) {
59
+ listeners.add(listener);
60
+ return () => listeners.delete(listener);
61
+ }
62
+ function seedDefaultMode(fallback) {
63
+ if (hasExplicitChoice || mode === fallback) return;
64
+ mode = fallback;
65
+ isDark = resolveIsDark(fallback);
66
+ applyToDom(isDark);
67
+ notify();
68
+ }
69
+
70
+ // src/dynamicTokens.ts
71
+ var tokens = /* @__PURE__ */ new Map();
72
+ var listeners2 = /* @__PURE__ */ new Set();
73
+ var version = 0;
74
+ function applyToDom2(name, value) {
75
+ if (typeof document === "undefined") return;
76
+ document.documentElement.style.setProperty(`--${name}`, value);
77
+ }
78
+ function notify2() {
79
+ version++;
80
+ for (const listener of listeners2) listener();
81
+ }
82
+ function setDynamicToken(name, value) {
83
+ tokens.set(name, value);
84
+ applyToDom2(name, value);
85
+ notify2();
86
+ }
87
+ function getDynamicToken(name) {
88
+ return tokens.get(name);
89
+ }
90
+ function deleteDynamicToken(name) {
91
+ if (!tokens.delete(name)) return;
92
+ if (typeof document !== "undefined") document.documentElement.style.removeProperty(`--${name}`);
93
+ notify2();
94
+ }
95
+ function subscribeDynamicTokens(listener) {
96
+ listeners2.add(listener);
97
+ return () => listeners2.delete(listener);
98
+ }
99
+
100
+ export {
101
+ resyncDomWithActiveTheme,
102
+ getGlobalDarkMode,
103
+ getGlobalThemeMode,
104
+ setGlobalThemeMode,
105
+ toggleGlobalDarkMode,
106
+ subscribeGlobalDarkMode,
107
+ seedDefaultMode,
108
+ setDynamicToken,
109
+ getDynamicToken,
110
+ deleteDynamicToken,
111
+ subscribeDynamicTokens
112
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveClassName
3
- } from "./chunk-JS5KIGAB.mjs";
3
+ } from "./chunk-MUPEQJRT.mjs";
4
4
 
5
5
  // src/jsxRuntimeCoreWeb.ts
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -18,7 +18,7 @@ function processElement(resolveClassName2, type, rawProps, key, isStaticChildren
18
18
  }
19
19
  const resolved = resolveClassName2(classStrRaw);
20
20
  const dataSet = { ...userDataSet, kb: resolved };
21
- return makeElement(isStaticChildren, type, { ...rest, dataSet }, key);
21
+ return makeElement(isStaticChildren, type, { ...rest, className: classStrRaw, dataSet }, key);
22
22
  }
23
23
  function createJsxFunctionsWeb(resolveClassName2) {
24
24
  function jsx2(type, props, key) {