@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.
- package/README.md +78 -0
- package/dist/chunk-SVMYVXY6.mjs +44 -0
- package/dist/chunk-YHF3QLRL.mjs +374 -0
- package/dist/index.d.mts +148 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +469 -0
- package/dist/index.mjs +80 -0
- package/dist/jsx-dev-runtime.d.mts +19 -0
- package/dist/jsx-dev-runtime.d.ts +19 -0
- package/dist/jsx-dev-runtime.js +411 -0
- package/dist/jsx-dev-runtime.mjs +20 -0
- package/dist/jsx-runtime.d.mts +27 -0
- package/dist/jsx-runtime.d.ts +27 -0
- package/dist/jsx-runtime.js +401 -0
- package/dist/jsx-runtime.mjs +11 -0
- package/package.json +66 -0
- package/src/babel-plugin.js +39 -0
|
@@ -0,0 +1,401 @@
|
|
|
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-runtime.tsx
|
|
21
|
+
var jsx_runtime_exports = {};
|
|
22
|
+
__export(jsx_runtime_exports, {
|
|
23
|
+
Fragment: () => import_react.Fragment,
|
|
24
|
+
jsx: () => jsx,
|
|
25
|
+
jsxs: () => jsxs
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(jsx_runtime_exports);
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_react_native3 = require("react-native");
|
|
31
|
+
|
|
32
|
+
// src/nativeBridge.ts
|
|
33
|
+
var import_react_native2 = require("react-native");
|
|
34
|
+
|
|
35
|
+
// src/generatedPalette.ts
|
|
36
|
+
var PALETTE = {
|
|
37
|
+
"amber-1": "#fffbeb",
|
|
38
|
+
"amber-10": "#78350f",
|
|
39
|
+
"amber-11": "#451a03",
|
|
40
|
+
"amber-12": "#291002",
|
|
41
|
+
"amber-2": "#fef3c7",
|
|
42
|
+
"amber-3": "#fde68a",
|
|
43
|
+
"amber-4": "#fcd34d",
|
|
44
|
+
"amber-5": "#fbbf24",
|
|
45
|
+
"amber-6": "#f59e0b",
|
|
46
|
+
"amber-7": "#d97706",
|
|
47
|
+
"amber-8": "#b45309",
|
|
48
|
+
"amber-9": "#92400e",
|
|
49
|
+
"black": "#000000",
|
|
50
|
+
"blue-1": "#eff6ff",
|
|
51
|
+
"blue-10": "#1e3a8a",
|
|
52
|
+
"blue-11": "#172554",
|
|
53
|
+
"blue-12": "#0d1633",
|
|
54
|
+
"blue-2": "#dbeafe",
|
|
55
|
+
"blue-3": "#bfdbfe",
|
|
56
|
+
"blue-4": "#93c5fd",
|
|
57
|
+
"blue-5": "#60a5fa",
|
|
58
|
+
"blue-6": "#3b82f6",
|
|
59
|
+
"blue-7": "#2563eb",
|
|
60
|
+
"blue-8": "#1d4ed8",
|
|
61
|
+
"blue-9": "#1e40af",
|
|
62
|
+
"bronze": "#cd7f32",
|
|
63
|
+
"coal": "#1c1c1c",
|
|
64
|
+
"copper": "#b87333",
|
|
65
|
+
"current": "currentColor",
|
|
66
|
+
"cyan-1": "#ecfeff",
|
|
67
|
+
"cyan-10": "#164e63",
|
|
68
|
+
"cyan-11": "#083344",
|
|
69
|
+
"cyan-12": "#041e28",
|
|
70
|
+
"cyan-2": "#cffafe",
|
|
71
|
+
"cyan-3": "#a5f3fc",
|
|
72
|
+
"cyan-4": "#67e8f9",
|
|
73
|
+
"cyan-5": "#22d3ee",
|
|
74
|
+
"cyan-6": "#06b6d4",
|
|
75
|
+
"cyan-7": "#0891b2",
|
|
76
|
+
"cyan-8": "#0e7490",
|
|
77
|
+
"cyan-9": "#155e75",
|
|
78
|
+
"emerald-1": "#ecfdf5",
|
|
79
|
+
"emerald-10": "#064e3b",
|
|
80
|
+
"emerald-11": "#022c22",
|
|
81
|
+
"emerald-12": "#011a14",
|
|
82
|
+
"emerald-2": "#d1fae5",
|
|
83
|
+
"emerald-3": "#a7f3d0",
|
|
84
|
+
"emerald-4": "#6ee7b7",
|
|
85
|
+
"emerald-5": "#34d399",
|
|
86
|
+
"emerald-6": "#10b981",
|
|
87
|
+
"emerald-7": "#059669",
|
|
88
|
+
"emerald-8": "#047857",
|
|
89
|
+
"emerald-9": "#065f46",
|
|
90
|
+
"fuchsia-1": "#fdf4ff",
|
|
91
|
+
"fuchsia-10": "#701a75",
|
|
92
|
+
"fuchsia-11": "#4a044e",
|
|
93
|
+
"fuchsia-12": "#2d022f",
|
|
94
|
+
"fuchsia-2": "#fae8ff",
|
|
95
|
+
"fuchsia-3": "#f5d0fe",
|
|
96
|
+
"fuchsia-4": "#f0abfc",
|
|
97
|
+
"fuchsia-5": "#e879f9",
|
|
98
|
+
"fuchsia-6": "#d946ef",
|
|
99
|
+
"fuchsia-7": "#c026d3",
|
|
100
|
+
"fuchsia-8": "#a21caf",
|
|
101
|
+
"fuchsia-9": "#86198f",
|
|
102
|
+
"gold": "#d4af37",
|
|
103
|
+
"gray-1": "#f9fafb",
|
|
104
|
+
"gray-10": "#111827",
|
|
105
|
+
"gray-11": "#030712",
|
|
106
|
+
"gray-12": "#020409",
|
|
107
|
+
"gray-2": "#f3f4f6",
|
|
108
|
+
"gray-3": "#e5e7eb",
|
|
109
|
+
"gray-4": "#d1d5db",
|
|
110
|
+
"gray-5": "#9ca3af",
|
|
111
|
+
"gray-6": "#6b7280",
|
|
112
|
+
"gray-7": "#4b5563",
|
|
113
|
+
"gray-8": "#374151",
|
|
114
|
+
"gray-9": "#1f2937",
|
|
115
|
+
"green-1": "#f0fdf4",
|
|
116
|
+
"green-10": "#14532d",
|
|
117
|
+
"green-11": "#052e16",
|
|
118
|
+
"green-12": "#031b0d",
|
|
119
|
+
"green-2": "#dcfce7",
|
|
120
|
+
"green-3": "#bbf7d0",
|
|
121
|
+
"green-4": "#86efac",
|
|
122
|
+
"green-5": "#4ade80",
|
|
123
|
+
"green-6": "#22c55e",
|
|
124
|
+
"green-7": "#16a34a",
|
|
125
|
+
"green-8": "#15803d",
|
|
126
|
+
"green-9": "#166534",
|
|
127
|
+
"indigo-1": "#eef2ff",
|
|
128
|
+
"indigo-10": "#312e81",
|
|
129
|
+
"indigo-11": "#1e1b4b",
|
|
130
|
+
"indigo-12": "#12102d",
|
|
131
|
+
"indigo-2": "#e0e7ff",
|
|
132
|
+
"indigo-3": "#c7d2fe",
|
|
133
|
+
"indigo-4": "#a5b4fc",
|
|
134
|
+
"indigo-5": "#818cf8",
|
|
135
|
+
"indigo-6": "#6366f1",
|
|
136
|
+
"indigo-7": "#4f46e5",
|
|
137
|
+
"indigo-8": "#4338ca",
|
|
138
|
+
"indigo-9": "#3730a3",
|
|
139
|
+
"lime-1": "#f7fee7",
|
|
140
|
+
"lime-10": "#365314",
|
|
141
|
+
"lime-11": "#1a2e05",
|
|
142
|
+
"lime-12": "#0f1b03",
|
|
143
|
+
"lime-2": "#ecfccb",
|
|
144
|
+
"lime-3": "#d9f99d",
|
|
145
|
+
"lime-4": "#bef264",
|
|
146
|
+
"lime-5": "#a3e635",
|
|
147
|
+
"lime-6": "#84cc16",
|
|
148
|
+
"lime-7": "#65a30d",
|
|
149
|
+
"lime-8": "#4d7c0f",
|
|
150
|
+
"lime-9": "#3f6212",
|
|
151
|
+
"neutral-1": "#fafafa",
|
|
152
|
+
"neutral-10": "#171717",
|
|
153
|
+
"neutral-11": "#0a0a0a",
|
|
154
|
+
"neutral-12": "#050505",
|
|
155
|
+
"neutral-2": "#f5f5f5",
|
|
156
|
+
"neutral-3": "#e5e5e5",
|
|
157
|
+
"neutral-4": "#d4d4d4",
|
|
158
|
+
"neutral-5": "#a3a3a3",
|
|
159
|
+
"neutral-6": "#737373",
|
|
160
|
+
"neutral-7": "#525252",
|
|
161
|
+
"neutral-8": "#404040",
|
|
162
|
+
"neutral-9": "#262626",
|
|
163
|
+
"orange-1": "#fff7ed",
|
|
164
|
+
"orange-10": "#7c2d12",
|
|
165
|
+
"orange-11": "#431407",
|
|
166
|
+
"orange-12": "#270c04",
|
|
167
|
+
"orange-2": "#ffedd5",
|
|
168
|
+
"orange-3": "#fed7aa",
|
|
169
|
+
"orange-4": "#fdba74",
|
|
170
|
+
"orange-5": "#fb923c",
|
|
171
|
+
"orange-6": "#f97316",
|
|
172
|
+
"orange-7": "#ea580c",
|
|
173
|
+
"orange-8": "#c2410c",
|
|
174
|
+
"orange-9": "#9a3412",
|
|
175
|
+
"pink-1": "#fdf2f8",
|
|
176
|
+
"pink-10": "#831843",
|
|
177
|
+
"pink-11": "#500724",
|
|
178
|
+
"pink-12": "#300415",
|
|
179
|
+
"pink-2": "#fce7f3",
|
|
180
|
+
"pink-3": "#fbcfe8",
|
|
181
|
+
"pink-4": "#f9a8d4",
|
|
182
|
+
"pink-5": "#f472b6",
|
|
183
|
+
"pink-6": "#ec4899",
|
|
184
|
+
"pink-7": "#db2777",
|
|
185
|
+
"pink-8": "#be185d",
|
|
186
|
+
"pink-9": "#9d174d",
|
|
187
|
+
"purple-1": "#faf5ff",
|
|
188
|
+
"purple-10": "#581c87",
|
|
189
|
+
"purple-11": "#3b0764",
|
|
190
|
+
"purple-12": "#23043c",
|
|
191
|
+
"purple-2": "#f3e8ff",
|
|
192
|
+
"purple-3": "#e9d5ff",
|
|
193
|
+
"purple-4": "#d8b4fe",
|
|
194
|
+
"purple-5": "#c084fc",
|
|
195
|
+
"purple-6": "#a855f7",
|
|
196
|
+
"purple-7": "#9333ea",
|
|
197
|
+
"purple-8": "#7e22ce",
|
|
198
|
+
"purple-9": "#6b21a8",
|
|
199
|
+
"red-1": "#fef2f2",
|
|
200
|
+
"red-10": "#7f1d1d",
|
|
201
|
+
"red-11": "#450a0a",
|
|
202
|
+
"red-12": "#280606",
|
|
203
|
+
"red-2": "#fee2e2",
|
|
204
|
+
"red-3": "#fecaca",
|
|
205
|
+
"red-4": "#fca5a5",
|
|
206
|
+
"red-5": "#f87171",
|
|
207
|
+
"red-6": "#ef4444",
|
|
208
|
+
"red-7": "#dc2626",
|
|
209
|
+
"red-8": "#b91c1c",
|
|
210
|
+
"red-9": "#991b1b",
|
|
211
|
+
"rose-1": "#fff1f2",
|
|
212
|
+
"rose-10": "#881337",
|
|
213
|
+
"rose-11": "#4c0519",
|
|
214
|
+
"rose-12": "#2d030e",
|
|
215
|
+
"rose-2": "#ffe4e6",
|
|
216
|
+
"rose-3": "#fecdd3",
|
|
217
|
+
"rose-4": "#fda4af",
|
|
218
|
+
"rose-5": "#fb7185",
|
|
219
|
+
"rose-6": "#f43f5e",
|
|
220
|
+
"rose-7": "#e11d48",
|
|
221
|
+
"rose-8": "#be123c",
|
|
222
|
+
"rose-9": "#9f1239",
|
|
223
|
+
"silver": "#c0c0c0",
|
|
224
|
+
"sky-1": "#f0f9ff",
|
|
225
|
+
"sky-10": "#0c4a6e",
|
|
226
|
+
"sky-11": "#082f49",
|
|
227
|
+
"sky-12": "#041b2b",
|
|
228
|
+
"sky-2": "#e0f2fe",
|
|
229
|
+
"sky-3": "#bae6fd",
|
|
230
|
+
"sky-4": "#7dd3fc",
|
|
231
|
+
"sky-5": "#38bdf8",
|
|
232
|
+
"sky-6": "#0ea5e9",
|
|
233
|
+
"sky-7": "#0284c7",
|
|
234
|
+
"sky-8": "#0369a1",
|
|
235
|
+
"sky-9": "#075985",
|
|
236
|
+
"slate-1": "#f8fafc",
|
|
237
|
+
"slate-10": "#0f172a",
|
|
238
|
+
"slate-11": "#020617",
|
|
239
|
+
"slate-12": "#01020a",
|
|
240
|
+
"slate-2": "#f1f5f9",
|
|
241
|
+
"slate-3": "#e2e8f0",
|
|
242
|
+
"slate-4": "#cbd5e1",
|
|
243
|
+
"slate-5": "#94a3b8",
|
|
244
|
+
"slate-6": "#64748b",
|
|
245
|
+
"slate-7": "#475569",
|
|
246
|
+
"slate-8": "#334155",
|
|
247
|
+
"slate-9": "#1e293b",
|
|
248
|
+
"stone-1": "#fafaf9",
|
|
249
|
+
"stone-10": "#1c1917",
|
|
250
|
+
"stone-11": "#0c0a09",
|
|
251
|
+
"stone-12": "#070605",
|
|
252
|
+
"stone-2": "#f5f5f4",
|
|
253
|
+
"stone-3": "#e7e5e4",
|
|
254
|
+
"stone-4": "#d6d3d1",
|
|
255
|
+
"stone-5": "#a8a29e",
|
|
256
|
+
"stone-6": "#78716c",
|
|
257
|
+
"stone-7": "#57534e",
|
|
258
|
+
"stone-8": "#44403c",
|
|
259
|
+
"stone-9": "#292524",
|
|
260
|
+
"teal-1": "#f0fdfa",
|
|
261
|
+
"teal-10": "#134e4a",
|
|
262
|
+
"teal-11": "#042f2e",
|
|
263
|
+
"teal-12": "#021c1b",
|
|
264
|
+
"teal-2": "#ccfbf1",
|
|
265
|
+
"teal-3": "#99f6e4",
|
|
266
|
+
"teal-4": "#5eead4",
|
|
267
|
+
"teal-5": "#2dd4bf",
|
|
268
|
+
"teal-6": "#14b8a6",
|
|
269
|
+
"teal-7": "#0d9488",
|
|
270
|
+
"teal-8": "#0f766e",
|
|
271
|
+
"teal-9": "#115e59",
|
|
272
|
+
"transparent": "transparent",
|
|
273
|
+
"violet-1": "#f5f3ff",
|
|
274
|
+
"violet-10": "#4c1d95",
|
|
275
|
+
"violet-11": "#2e1065",
|
|
276
|
+
"violet-12": "#1c0a3d",
|
|
277
|
+
"violet-2": "#ede9fe",
|
|
278
|
+
"violet-3": "#ddd6fe",
|
|
279
|
+
"violet-4": "#c4b5fd",
|
|
280
|
+
"violet-5": "#a78bfa",
|
|
281
|
+
"violet-6": "#8b5cf6",
|
|
282
|
+
"violet-7": "#7c3aed",
|
|
283
|
+
"violet-8": "#6d28d9",
|
|
284
|
+
"violet-9": "#5b21b6",
|
|
285
|
+
"white": "#ffffff",
|
|
286
|
+
"yellow-1": "#fefce8",
|
|
287
|
+
"yellow-10": "#713f12",
|
|
288
|
+
"yellow-11": "#422006",
|
|
289
|
+
"yellow-12": "#271304",
|
|
290
|
+
"yellow-2": "#fef9c3",
|
|
291
|
+
"yellow-3": "#fef08a",
|
|
292
|
+
"yellow-4": "#fde047",
|
|
293
|
+
"yellow-5": "#facc15",
|
|
294
|
+
"yellow-6": "#eab308",
|
|
295
|
+
"yellow-7": "#ca8a04",
|
|
296
|
+
"yellow-8": "#a16207",
|
|
297
|
+
"yellow-9": "#854d0e",
|
|
298
|
+
"zinc-1": "#fafafa",
|
|
299
|
+
"zinc-10": "#18181b",
|
|
300
|
+
"zinc-11": "#09090b",
|
|
301
|
+
"zinc-12": "#050506",
|
|
302
|
+
"zinc-2": "#f4f4f5",
|
|
303
|
+
"zinc-3": "#e4e4e7",
|
|
304
|
+
"zinc-4": "#d4d4d8",
|
|
305
|
+
"zinc-5": "#a1a1aa",
|
|
306
|
+
"zinc-6": "#71717a",
|
|
307
|
+
"zinc-7": "#52525b",
|
|
308
|
+
"zinc-8": "#3f3f46",
|
|
309
|
+
"zinc-9": "#27272a"
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
// src/theme.ts
|
|
313
|
+
var defaultTheme = {
|
|
314
|
+
colors: PALETTE,
|
|
315
|
+
spacing: {
|
|
316
|
+
// "0" is always a hardcoded zero in real Tailwind's own scale too,
|
|
317
|
+
// regardless of the base spacing unit — needed for `p-0`/`m-0`/etc.
|
|
318
|
+
// Mirrors the identical fix in @kbach/react's theme.ts.
|
|
319
|
+
"0": 0,
|
|
320
|
+
"1": 4,
|
|
321
|
+
"2": 8,
|
|
322
|
+
"4": 16,
|
|
323
|
+
"6": 24,
|
|
324
|
+
"8": 32
|
|
325
|
+
},
|
|
326
|
+
screens: {},
|
|
327
|
+
darkMode: "attribute"
|
|
328
|
+
};
|
|
329
|
+
var activeThemeJson = JSON.stringify(defaultTheme);
|
|
330
|
+
function getThemeJson() {
|
|
331
|
+
return activeThemeJson;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// src/darkModeStore.ts
|
|
335
|
+
var import_react_native = require("react-native");
|
|
336
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
337
|
+
function systemPrefersDark() {
|
|
338
|
+
return import_react_native.Appearance.getColorScheme() === "dark";
|
|
339
|
+
}
|
|
340
|
+
function resolveIsDark(m) {
|
|
341
|
+
return m === "system" ? systemPrefersDark() : m === "dark";
|
|
342
|
+
}
|
|
343
|
+
var mode = "system";
|
|
344
|
+
var isDark = resolveIsDark(mode);
|
|
345
|
+
var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
|
|
346
|
+
if (mode !== "system") return;
|
|
347
|
+
isDark = colorScheme === "dark";
|
|
348
|
+
notify();
|
|
349
|
+
});
|
|
350
|
+
function notify() {
|
|
351
|
+
for (const listener of listeners) listener();
|
|
352
|
+
}
|
|
353
|
+
function getGlobalDarkMode() {
|
|
354
|
+
return isDark;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/nativeBridge.ts
|
|
358
|
+
function resolveStyle(classString, pressed = false) {
|
|
359
|
+
const KbachModule = import_react_native2.TurboModuleRegistry.getEnforcing("KbachModule");
|
|
360
|
+
const colorScheme = getGlobalDarkMode() ? "dark" : "light";
|
|
361
|
+
const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed);
|
|
362
|
+
return JSON.parse(json);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// src/jsx-runtime.tsx
|
|
366
|
+
function makeElement(isStaticChildren, type, props, key) {
|
|
367
|
+
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
368
|
+
}
|
|
369
|
+
function resolvedStyleFor(classStrRaw, userStyle, pressed) {
|
|
370
|
+
const resolved = resolveStyle(classStrRaw, pressed);
|
|
371
|
+
if (userStyle === void 0) {
|
|
372
|
+
return resolved;
|
|
373
|
+
}
|
|
374
|
+
if (typeof userStyle === "function") {
|
|
375
|
+
return [resolved, userStyle({ pressed })];
|
|
376
|
+
}
|
|
377
|
+
return [resolved, userStyle];
|
|
378
|
+
}
|
|
379
|
+
function processElement(type, rawProps, key, isStaticChildren) {
|
|
380
|
+
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
381
|
+
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
382
|
+
}
|
|
383
|
+
const { className: classStrRaw, style: userStyle, ...rest } = rawProps;
|
|
384
|
+
if (typeof classStrRaw !== "string") {
|
|
385
|
+
return makeElement(isStaticChildren, type, rawProps, key);
|
|
386
|
+
}
|
|
387
|
+
const finalStyle = type === import_react_native3.Pressable ? (state) => resolvedStyleFor(classStrRaw, userStyle, state.pressed) : resolvedStyleFor(classStrRaw, userStyle, false);
|
|
388
|
+
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
|
|
389
|
+
}
|
|
390
|
+
function jsx(type, props, key) {
|
|
391
|
+
return processElement(type, props, key, false);
|
|
392
|
+
}
|
|
393
|
+
function jsxs(type, props, key) {
|
|
394
|
+
return processElement(type, props, key, true);
|
|
395
|
+
}
|
|
396
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
397
|
+
0 && (module.exports = {
|
|
398
|
+
Fragment,
|
|
399
|
+
jsx,
|
|
400
|
+
jsxs
|
|
401
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kbach/react-native",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
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. Beta, Android-only.",
|
|
5
|
+
"keywords": ["css", "react-native", "tailwind", "utility-first", "styling", "android"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "semsakadanupol",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/semsakadanupol/kbach.git",
|
|
11
|
+
"directory": "packages/react-native"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/semsakadanupol/kbach#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/semsakadanupol/kbach/issues"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"files": ["dist", "src/babel-plugin.js"],
|
|
21
|
+
"source": "./src/index.ts",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.mjs",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"source": "./src/index.ts",
|
|
29
|
+
"import": "./dist/index.mjs",
|
|
30
|
+
"require": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./jsx-runtime": {
|
|
33
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
34
|
+
"source": "./src/jsx-runtime.tsx",
|
|
35
|
+
"import": "./dist/jsx-runtime.mjs",
|
|
36
|
+
"require": "./dist/jsx-runtime.js"
|
|
37
|
+
},
|
|
38
|
+
"./jsx-dev-runtime": {
|
|
39
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
40
|
+
"source": "./src/jsx-dev-runtime.tsx",
|
|
41
|
+
"import": "./dist/jsx-dev-runtime.mjs",
|
|
42
|
+
"require": "./dist/jsx-dev-runtime.js"
|
|
43
|
+
},
|
|
44
|
+
"./babel-plugin": "./src/babel-plugin.js"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"dev": "tsup --watch",
|
|
49
|
+
"test": "vitest run --passWithNoTests",
|
|
50
|
+
"lint": "tsc --noEmit",
|
|
51
|
+
"generate:colors": "node ../core-engine/scripts/generate-palette.mjs src/generatedPalette.ts"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/react": "^19.2.0",
|
|
55
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
56
|
+
"react-native": "^0.87.0",
|
|
57
|
+
"react-test-renderer": "^19.2.0",
|
|
58
|
+
"tsup": "^8.0.0",
|
|
59
|
+
"typescript": "^6.0.0",
|
|
60
|
+
"vitest": "^1.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"react": ">=18.0.0",
|
|
64
|
+
"react-native": ">=0.70.0"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Injects a per-file `@jsxImportSource @kbach/react-native` pragma comment
|
|
5
|
+
* so Metro's JSX transform routes className resolution through
|
|
6
|
+
* @kbach/react-native/jsx-runtime instead of react/jsx-runtime.
|
|
7
|
+
*
|
|
8
|
+
* Ported from old-kbach/src/native/babel-plugin/index.js's pre() hook —
|
|
9
|
+
* same mechanism, same reason: setting jsxImportSource globally via preset
|
|
10
|
+
* options would set the DEFAULT JSX pragma for every file Metro bundles,
|
|
11
|
+
* including node_modules and React Native's own internals (which know
|
|
12
|
+
* nothing about Kbach's className/style interception and would break). A
|
|
13
|
+
* per-file pragma comment — explicitly skipping node_modules — only ever
|
|
14
|
+
* applies to the user's own app files.
|
|
15
|
+
*
|
|
16
|
+
* Raw, unbuilt CommonJS on purpose: this runs inside a Metro/Babel worker
|
|
17
|
+
* process, which can't require() TypeScript.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately NOT porting old-kbach's build-time class-resolution half
|
|
20
|
+
* (the __kbachStyles fast path) — resolution happens at the (already
|
|
21
|
+
* synchronous) native-bridge call inside the jsx-runtime instead (see
|
|
22
|
+
* nativeBridge.ts), so this plugin's only job is the pragma injection.
|
|
23
|
+
*/
|
|
24
|
+
module.exports = function kbachReactNativeBabelPlugin() {
|
|
25
|
+
return {
|
|
26
|
+
name: 'kbach-react-native',
|
|
27
|
+
pre(file) {
|
|
28
|
+
const filename = file.opts && file.opts.filename;
|
|
29
|
+
if (filename && filename.indexOf('node_modules') !== -1) return;
|
|
30
|
+
|
|
31
|
+
const comments = file.ast.comments || (file.ast.comments = []);
|
|
32
|
+
const alreadySet = comments.some((c) => /@jsxImportSource|@jsxRuntime/.test(c.value));
|
|
33
|
+
if (!alreadySet) {
|
|
34
|
+
comments.unshift({ type: 'CommentLine', value: ' @jsxImportSource @kbach/react-native' });
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
visitor: {},
|
|
38
|
+
};
|
|
39
|
+
};
|