@kbach/react-native 1.0.0-beta.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.
@@ -0,0 +1,19 @@
1
+ import { ReactElement } from 'react';
2
+ export { Fragment } from 'react';
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?: {
14
+ fileName: string;
15
+ lineNumber: number;
16
+ columnNumber: number;
17
+ }, self?: unknown): ReactElement;
18
+
19
+ export { jsxDEV };
@@ -0,0 +1,19 @@
1
+ import { ReactElement } from 'react';
2
+ export { Fragment } from 'react';
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?: {
14
+ fileName: string;
15
+ lineNumber: number;
16
+ columnNumber: number;
17
+ }, self?: unknown): ReactElement;
18
+
19
+ export { jsxDEV };
@@ -0,0 +1,411 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/jsx-dev-runtime.tsx
21
+ var jsx_dev_runtime_exports = {};
22
+ __export(jsx_dev_runtime_exports, {
23
+ Fragment: () => import_react.Fragment,
24
+ jsxDEV: () => jsxDEV
25
+ });
26
+ module.exports = __toCommonJS(jsx_dev_runtime_exports);
27
+
28
+ // src/jsx-runtime.tsx
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ var import_react = require("react");
31
+ var import_react_native3 = require("react-native");
32
+
33
+ // src/nativeBridge.ts
34
+ var import_react_native2 = require("react-native");
35
+
36
+ // src/generatedPalette.ts
37
+ var PALETTE = {
38
+ "amber-1": "#fffbeb",
39
+ "amber-10": "#78350f",
40
+ "amber-11": "#451a03",
41
+ "amber-12": "#291002",
42
+ "amber-2": "#fef3c7",
43
+ "amber-3": "#fde68a",
44
+ "amber-4": "#fcd34d",
45
+ "amber-5": "#fbbf24",
46
+ "amber-6": "#f59e0b",
47
+ "amber-7": "#d97706",
48
+ "amber-8": "#b45309",
49
+ "amber-9": "#92400e",
50
+ "black": "#000000",
51
+ "blue-1": "#eff6ff",
52
+ "blue-10": "#1e3a8a",
53
+ "blue-11": "#172554",
54
+ "blue-12": "#0d1633",
55
+ "blue-2": "#dbeafe",
56
+ "blue-3": "#bfdbfe",
57
+ "blue-4": "#93c5fd",
58
+ "blue-5": "#60a5fa",
59
+ "blue-6": "#3b82f6",
60
+ "blue-7": "#2563eb",
61
+ "blue-8": "#1d4ed8",
62
+ "blue-9": "#1e40af",
63
+ "bronze": "#cd7f32",
64
+ "coal": "#1c1c1c",
65
+ "copper": "#b87333",
66
+ "current": "currentColor",
67
+ "cyan-1": "#ecfeff",
68
+ "cyan-10": "#164e63",
69
+ "cyan-11": "#083344",
70
+ "cyan-12": "#041e28",
71
+ "cyan-2": "#cffafe",
72
+ "cyan-3": "#a5f3fc",
73
+ "cyan-4": "#67e8f9",
74
+ "cyan-5": "#22d3ee",
75
+ "cyan-6": "#06b6d4",
76
+ "cyan-7": "#0891b2",
77
+ "cyan-8": "#0e7490",
78
+ "cyan-9": "#155e75",
79
+ "emerald-1": "#ecfdf5",
80
+ "emerald-10": "#064e3b",
81
+ "emerald-11": "#022c22",
82
+ "emerald-12": "#011a14",
83
+ "emerald-2": "#d1fae5",
84
+ "emerald-3": "#a7f3d0",
85
+ "emerald-4": "#6ee7b7",
86
+ "emerald-5": "#34d399",
87
+ "emerald-6": "#10b981",
88
+ "emerald-7": "#059669",
89
+ "emerald-8": "#047857",
90
+ "emerald-9": "#065f46",
91
+ "fuchsia-1": "#fdf4ff",
92
+ "fuchsia-10": "#701a75",
93
+ "fuchsia-11": "#4a044e",
94
+ "fuchsia-12": "#2d022f",
95
+ "fuchsia-2": "#fae8ff",
96
+ "fuchsia-3": "#f5d0fe",
97
+ "fuchsia-4": "#f0abfc",
98
+ "fuchsia-5": "#e879f9",
99
+ "fuchsia-6": "#d946ef",
100
+ "fuchsia-7": "#c026d3",
101
+ "fuchsia-8": "#a21caf",
102
+ "fuchsia-9": "#86198f",
103
+ "gold": "#d4af37",
104
+ "gray-1": "#f9fafb",
105
+ "gray-10": "#111827",
106
+ "gray-11": "#030712",
107
+ "gray-12": "#020409",
108
+ "gray-2": "#f3f4f6",
109
+ "gray-3": "#e5e7eb",
110
+ "gray-4": "#d1d5db",
111
+ "gray-5": "#9ca3af",
112
+ "gray-6": "#6b7280",
113
+ "gray-7": "#4b5563",
114
+ "gray-8": "#374151",
115
+ "gray-9": "#1f2937",
116
+ "green-1": "#f0fdf4",
117
+ "green-10": "#14532d",
118
+ "green-11": "#052e16",
119
+ "green-12": "#031b0d",
120
+ "green-2": "#dcfce7",
121
+ "green-3": "#bbf7d0",
122
+ "green-4": "#86efac",
123
+ "green-5": "#4ade80",
124
+ "green-6": "#22c55e",
125
+ "green-7": "#16a34a",
126
+ "green-8": "#15803d",
127
+ "green-9": "#166534",
128
+ "indigo-1": "#eef2ff",
129
+ "indigo-10": "#312e81",
130
+ "indigo-11": "#1e1b4b",
131
+ "indigo-12": "#12102d",
132
+ "indigo-2": "#e0e7ff",
133
+ "indigo-3": "#c7d2fe",
134
+ "indigo-4": "#a5b4fc",
135
+ "indigo-5": "#818cf8",
136
+ "indigo-6": "#6366f1",
137
+ "indigo-7": "#4f46e5",
138
+ "indigo-8": "#4338ca",
139
+ "indigo-9": "#3730a3",
140
+ "lime-1": "#f7fee7",
141
+ "lime-10": "#365314",
142
+ "lime-11": "#1a2e05",
143
+ "lime-12": "#0f1b03",
144
+ "lime-2": "#ecfccb",
145
+ "lime-3": "#d9f99d",
146
+ "lime-4": "#bef264",
147
+ "lime-5": "#a3e635",
148
+ "lime-6": "#84cc16",
149
+ "lime-7": "#65a30d",
150
+ "lime-8": "#4d7c0f",
151
+ "lime-9": "#3f6212",
152
+ "neutral-1": "#fafafa",
153
+ "neutral-10": "#171717",
154
+ "neutral-11": "#0a0a0a",
155
+ "neutral-12": "#050505",
156
+ "neutral-2": "#f5f5f5",
157
+ "neutral-3": "#e5e5e5",
158
+ "neutral-4": "#d4d4d4",
159
+ "neutral-5": "#a3a3a3",
160
+ "neutral-6": "#737373",
161
+ "neutral-7": "#525252",
162
+ "neutral-8": "#404040",
163
+ "neutral-9": "#262626",
164
+ "orange-1": "#fff7ed",
165
+ "orange-10": "#7c2d12",
166
+ "orange-11": "#431407",
167
+ "orange-12": "#270c04",
168
+ "orange-2": "#ffedd5",
169
+ "orange-3": "#fed7aa",
170
+ "orange-4": "#fdba74",
171
+ "orange-5": "#fb923c",
172
+ "orange-6": "#f97316",
173
+ "orange-7": "#ea580c",
174
+ "orange-8": "#c2410c",
175
+ "orange-9": "#9a3412",
176
+ "pink-1": "#fdf2f8",
177
+ "pink-10": "#831843",
178
+ "pink-11": "#500724",
179
+ "pink-12": "#300415",
180
+ "pink-2": "#fce7f3",
181
+ "pink-3": "#fbcfe8",
182
+ "pink-4": "#f9a8d4",
183
+ "pink-5": "#f472b6",
184
+ "pink-6": "#ec4899",
185
+ "pink-7": "#db2777",
186
+ "pink-8": "#be185d",
187
+ "pink-9": "#9d174d",
188
+ "purple-1": "#faf5ff",
189
+ "purple-10": "#581c87",
190
+ "purple-11": "#3b0764",
191
+ "purple-12": "#23043c",
192
+ "purple-2": "#f3e8ff",
193
+ "purple-3": "#e9d5ff",
194
+ "purple-4": "#d8b4fe",
195
+ "purple-5": "#c084fc",
196
+ "purple-6": "#a855f7",
197
+ "purple-7": "#9333ea",
198
+ "purple-8": "#7e22ce",
199
+ "purple-9": "#6b21a8",
200
+ "red-1": "#fef2f2",
201
+ "red-10": "#7f1d1d",
202
+ "red-11": "#450a0a",
203
+ "red-12": "#280606",
204
+ "red-2": "#fee2e2",
205
+ "red-3": "#fecaca",
206
+ "red-4": "#fca5a5",
207
+ "red-5": "#f87171",
208
+ "red-6": "#ef4444",
209
+ "red-7": "#dc2626",
210
+ "red-8": "#b91c1c",
211
+ "red-9": "#991b1b",
212
+ "rose-1": "#fff1f2",
213
+ "rose-10": "#881337",
214
+ "rose-11": "#4c0519",
215
+ "rose-12": "#2d030e",
216
+ "rose-2": "#ffe4e6",
217
+ "rose-3": "#fecdd3",
218
+ "rose-4": "#fda4af",
219
+ "rose-5": "#fb7185",
220
+ "rose-6": "#f43f5e",
221
+ "rose-7": "#e11d48",
222
+ "rose-8": "#be123c",
223
+ "rose-9": "#9f1239",
224
+ "silver": "#c0c0c0",
225
+ "sky-1": "#f0f9ff",
226
+ "sky-10": "#0c4a6e",
227
+ "sky-11": "#082f49",
228
+ "sky-12": "#041b2b",
229
+ "sky-2": "#e0f2fe",
230
+ "sky-3": "#bae6fd",
231
+ "sky-4": "#7dd3fc",
232
+ "sky-5": "#38bdf8",
233
+ "sky-6": "#0ea5e9",
234
+ "sky-7": "#0284c7",
235
+ "sky-8": "#0369a1",
236
+ "sky-9": "#075985",
237
+ "slate-1": "#f8fafc",
238
+ "slate-10": "#0f172a",
239
+ "slate-11": "#020617",
240
+ "slate-12": "#01020a",
241
+ "slate-2": "#f1f5f9",
242
+ "slate-3": "#e2e8f0",
243
+ "slate-4": "#cbd5e1",
244
+ "slate-5": "#94a3b8",
245
+ "slate-6": "#64748b",
246
+ "slate-7": "#475569",
247
+ "slate-8": "#334155",
248
+ "slate-9": "#1e293b",
249
+ "stone-1": "#fafaf9",
250
+ "stone-10": "#1c1917",
251
+ "stone-11": "#0c0a09",
252
+ "stone-12": "#070605",
253
+ "stone-2": "#f5f5f4",
254
+ "stone-3": "#e7e5e4",
255
+ "stone-4": "#d6d3d1",
256
+ "stone-5": "#a8a29e",
257
+ "stone-6": "#78716c",
258
+ "stone-7": "#57534e",
259
+ "stone-8": "#44403c",
260
+ "stone-9": "#292524",
261
+ "teal-1": "#f0fdfa",
262
+ "teal-10": "#134e4a",
263
+ "teal-11": "#042f2e",
264
+ "teal-12": "#021c1b",
265
+ "teal-2": "#ccfbf1",
266
+ "teal-3": "#99f6e4",
267
+ "teal-4": "#5eead4",
268
+ "teal-5": "#2dd4bf",
269
+ "teal-6": "#14b8a6",
270
+ "teal-7": "#0d9488",
271
+ "teal-8": "#0f766e",
272
+ "teal-9": "#115e59",
273
+ "transparent": "transparent",
274
+ "violet-1": "#f5f3ff",
275
+ "violet-10": "#4c1d95",
276
+ "violet-11": "#2e1065",
277
+ "violet-12": "#1c0a3d",
278
+ "violet-2": "#ede9fe",
279
+ "violet-3": "#ddd6fe",
280
+ "violet-4": "#c4b5fd",
281
+ "violet-5": "#a78bfa",
282
+ "violet-6": "#8b5cf6",
283
+ "violet-7": "#7c3aed",
284
+ "violet-8": "#6d28d9",
285
+ "violet-9": "#5b21b6",
286
+ "white": "#ffffff",
287
+ "yellow-1": "#fefce8",
288
+ "yellow-10": "#713f12",
289
+ "yellow-11": "#422006",
290
+ "yellow-12": "#271304",
291
+ "yellow-2": "#fef9c3",
292
+ "yellow-3": "#fef08a",
293
+ "yellow-4": "#fde047",
294
+ "yellow-5": "#facc15",
295
+ "yellow-6": "#eab308",
296
+ "yellow-7": "#ca8a04",
297
+ "yellow-8": "#a16207",
298
+ "yellow-9": "#854d0e",
299
+ "zinc-1": "#fafafa",
300
+ "zinc-10": "#18181b",
301
+ "zinc-11": "#09090b",
302
+ "zinc-12": "#050506",
303
+ "zinc-2": "#f4f4f5",
304
+ "zinc-3": "#e4e4e7",
305
+ "zinc-4": "#d4d4d8",
306
+ "zinc-5": "#a1a1aa",
307
+ "zinc-6": "#71717a",
308
+ "zinc-7": "#52525b",
309
+ "zinc-8": "#3f3f46",
310
+ "zinc-9": "#27272a"
311
+ };
312
+
313
+ // src/theme.ts
314
+ var defaultTheme = {
315
+ colors: PALETTE,
316
+ spacing: {
317
+ // "0" is always a hardcoded zero in real Tailwind's own scale too,
318
+ // regardless of the base spacing unit — needed for `p-0`/`m-0`/etc.
319
+ // Mirrors the identical fix in @kbach/react's theme.ts.
320
+ "0": 0,
321
+ "1": 4,
322
+ "2": 8,
323
+ "4": 16,
324
+ "6": 24,
325
+ "8": 32
326
+ },
327
+ screens: {},
328
+ darkMode: "attribute"
329
+ };
330
+ var activeThemeJson = JSON.stringify(defaultTheme);
331
+ function getThemeJson() {
332
+ return activeThemeJson;
333
+ }
334
+
335
+ // src/darkModeStore.ts
336
+ var import_react_native = require("react-native");
337
+ var listeners = /* @__PURE__ */ new Set();
338
+ function systemPrefersDark() {
339
+ return import_react_native.Appearance.getColorScheme() === "dark";
340
+ }
341
+ function resolveIsDark(m) {
342
+ return m === "system" ? systemPrefersDark() : m === "dark";
343
+ }
344
+ var mode = "system";
345
+ var isDark = resolveIsDark(mode);
346
+ var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
347
+ if (mode !== "system") return;
348
+ isDark = colorScheme === "dark";
349
+ notify();
350
+ });
351
+ function notify() {
352
+ for (const listener of listeners) listener();
353
+ }
354
+ function getGlobalDarkMode() {
355
+ return isDark;
356
+ }
357
+
358
+ // src/nativeBridge.ts
359
+ function resolveStyle(classString, pressed = false) {
360
+ const KbachModule = import_react_native2.TurboModuleRegistry.getEnforcing("KbachModule");
361
+ const colorScheme = getGlobalDarkMode() ? "dark" : "light";
362
+ const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed);
363
+ return JSON.parse(json);
364
+ }
365
+
366
+ // 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
+ }
397
+
398
+ // 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
+ }
407
+ // Annotate the CommonJS export names for ESM import in node:
408
+ 0 && (module.exports = {
409
+ Fragment,
410
+ jsxDEV
411
+ });
@@ -0,0 +1,20 @@
1
+ import {
2
+ Fragment,
3
+ jsx,
4
+ jsxs
5
+ } from "./chunk-SVMYVXY6.mjs";
6
+ import "./chunk-YHF3QLRL.mjs";
7
+
8
+ // 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
+ }
17
+ export {
18
+ Fragment,
19
+ jsxDEV
20
+ };
@@ -0,0 +1,27 @@
1
+ import { ReactElement } from 'react';
2
+ export { Fragment, JSX } from 'react';
3
+
4
+ /**
5
+ * @kbach/react-native/jsx-runtime
6
+ *
7
+ * Drop-in replacement for react/jsx-runtime — same interception shape as
8
+ * @kbach/react/jsx-runtime (Phase 3), but the resolved value becomes the
9
+ * `style` prop instead of `className`: View/Text have no `className` prop
10
+ * at all. Covers layout, color, spacing, border, typography, dark:, and
11
+ * active: (Pressable only) — see nativeBridge.ts / resolve_style.rs for
12
+ * exactly what's resolved; every other modifier (hover:/responsive/...)
13
+ * parses but isn't applied yet.
14
+ *
15
+ * `active:` needs different handling from every other modifier: whether an
16
+ * element is "pressed" isn't a value that can be read once and reused like
17
+ * `dark:`'s color scheme — only RN's `Pressable` ever knows it, and only
18
+ * via a style FUNCTION it calls on every press/release
19
+ * (`style={({pressed}) => ...}`). So for `type === Pressable` specifically,
20
+ * `style` is built as a function instead of a static value; every other
21
+ * element type is completely unaffected by this — same code path as before.
22
+ */
23
+
24
+ declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
25
+ declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
26
+
27
+ export { jsx, jsxs };
@@ -0,0 +1,27 @@
1
+ import { ReactElement } from 'react';
2
+ export { Fragment, JSX } from 'react';
3
+
4
+ /**
5
+ * @kbach/react-native/jsx-runtime
6
+ *
7
+ * Drop-in replacement for react/jsx-runtime — same interception shape as
8
+ * @kbach/react/jsx-runtime (Phase 3), but the resolved value becomes the
9
+ * `style` prop instead of `className`: View/Text have no `className` prop
10
+ * at all. Covers layout, color, spacing, border, typography, dark:, and
11
+ * active: (Pressable only) — see nativeBridge.ts / resolve_style.rs for
12
+ * exactly what's resolved; every other modifier (hover:/responsive/...)
13
+ * parses but isn't applied yet.
14
+ *
15
+ * `active:` needs different handling from every other modifier: whether an
16
+ * element is "pressed" isn't a value that can be read once and reused like
17
+ * `dark:`'s color scheme — only RN's `Pressable` ever knows it, and only
18
+ * via a style FUNCTION it calls on every press/release
19
+ * (`style={({pressed}) => ...}`). So for `type === Pressable` specifically,
20
+ * `style` is built as a function instead of a static value; every other
21
+ * element type is completely unaffected by this — same code path as before.
22
+ */
23
+
24
+ declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
25
+ declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
26
+
27
+ export { jsx, jsxs };