@kbach/react-native 1.0.0-beta.13 → 1.0.0-beta.15
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 +50 -0
- package/dist/chunk-AXGAYOQ7.mjs +192 -0
- package/dist/{chunk-4DQXTAM3.mjs → chunk-EMZ47OSG.mjs} +43 -6
- package/dist/{chunk-GU6DH6UE.mjs → chunk-UNZ6PQVO.mjs} +1 -1
- package/dist/{chunk-6QFPLRSP.mjs → chunk-VD233W3L.mjs} +1 -1
- package/dist/darkModeStore.js +112 -0
- package/dist/index.js +36 -448
- package/dist/index.web.js +34 -447
- package/dist/index.web.mjs +1 -1
- package/dist/jsx-dev-runtime.js +48 -408
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-dev-runtime.web.js +7 -396
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.js +48 -408
- package/dist/jsx-runtime.mjs +2 -2
- package/dist/jsx-runtime.web.js +4 -354
- package/dist/jsx-runtime.web.mjs +2 -2
- package/dist/theme.js +396 -0
- package/package.json +3 -3
- package/dist/chunk-ZB2UU6EO.mjs +0 -192
- package/dist/index.d.ts +0 -83
- package/dist/index.web.d.ts +0 -15
- package/dist/jsx-dev-runtime.d.ts +0 -10
- package/dist/jsx-dev-runtime.web.d.ts +0 -10
- package/dist/jsx-runtime.d.ts +0 -7
- package/dist/jsx-runtime.web.d.ts +0 -7
- package/dist/useColors-C6jyCLuG.d.ts +0 -239
package/dist/index.web.mjs
CHANGED
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -28,404 +28,9 @@ 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_native2 = require("react-native");
|
|
32
|
-
|
|
33
|
-
// src/darkModeStore.ts
|
|
34
31
|
var import_react_native = require("react-native");
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
// Real Tailwind's default spacing scale in full — every step is exactly
|
|
317
|
-
// `n * 4px`, including the fractional `.5` steps (`1.5` -> 6px, `2.5` ->
|
|
318
|
-
// 10px, `3.5` -> 14px) and the "px" literal (a bare 1px). Only the
|
|
319
|
-
// "usual stops", though — `jsEngine/shared.ts`'s `spacingPx` (and the
|
|
320
|
-
// native Rust dispatcher's own `spacing_px`) falls back to Tailwind v4's
|
|
321
|
-
// live `n * 4px` formula for any bare numeric step not listed here
|
|
322
|
-
// (`p-0.25`, `w-13`, ...), so this table names the common values and
|
|
323
|
-
// gives a theme override something to target, not the full resolvable
|
|
324
|
-
// set. Mirrors @kbach/react's theme.ts exactly.
|
|
325
|
-
spacing: {
|
|
326
|
-
"0": 0,
|
|
327
|
-
"px": 1,
|
|
328
|
-
"0.5": 2,
|
|
329
|
-
"1": 4,
|
|
330
|
-
"1.5": 6,
|
|
331
|
-
"2": 8,
|
|
332
|
-
"2.5": 10,
|
|
333
|
-
"3": 12,
|
|
334
|
-
"3.5": 14,
|
|
335
|
-
"4": 16,
|
|
336
|
-
"5": 20,
|
|
337
|
-
"6": 24,
|
|
338
|
-
"7": 28,
|
|
339
|
-
"8": 32,
|
|
340
|
-
"9": 36,
|
|
341
|
-
"10": 40,
|
|
342
|
-
"11": 44,
|
|
343
|
-
"12": 48,
|
|
344
|
-
"14": 56,
|
|
345
|
-
"16": 64,
|
|
346
|
-
"20": 80,
|
|
347
|
-
"24": 96,
|
|
348
|
-
"28": 112,
|
|
349
|
-
"32": 128,
|
|
350
|
-
"36": 144,
|
|
351
|
-
"40": 160,
|
|
352
|
-
"44": 176,
|
|
353
|
-
"48": 192,
|
|
354
|
-
"52": 208,
|
|
355
|
-
"56": 224,
|
|
356
|
-
"60": 240,
|
|
357
|
-
"64": 256,
|
|
358
|
-
"72": 288,
|
|
359
|
-
"80": 320,
|
|
360
|
-
"96": 384
|
|
361
|
-
},
|
|
362
|
-
screens: {
|
|
363
|
-
sm: 640,
|
|
364
|
-
md: 768,
|
|
365
|
-
lg: 1024,
|
|
366
|
-
xl: 1280,
|
|
367
|
-
"2xl": 1536
|
|
368
|
-
},
|
|
369
|
-
// Byte-for-byte the same three stacks
|
|
370
|
-
// packages/core-engine/src/resolvers/typography.rs's `font_family_value`
|
|
371
|
-
// falls back to. On native these three still effectively no-op (see
|
|
372
|
-
// `first_font_name`'s own doc comment for why a generic CSS keyword
|
|
373
|
-
// isn't a real loadable font) — only a caller-configured custom name
|
|
374
|
-
// changes native rendering; Expo Web uses the full stack as-is.
|
|
375
|
-
fontFamily: {
|
|
376
|
-
sans: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
377
|
-
serif: 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
|
|
378
|
-
mono: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
|
379
|
-
},
|
|
380
|
-
darkMode: "attribute",
|
|
381
|
-
// Empty by default, matching real Tailwind's own defaults.
|
|
382
|
-
container: {}
|
|
383
|
-
};
|
|
384
|
-
var activeTheme = defaultTheme;
|
|
385
|
-
var activeThemeJson = JSON.stringify(defaultTheme);
|
|
386
|
-
function getTheme() {
|
|
387
|
-
return activeTheme;
|
|
388
|
-
}
|
|
389
|
-
function getThemeJson() {
|
|
390
|
-
return activeThemeJson;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// src/darkModeStore.ts
|
|
394
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
395
|
-
function systemPrefersDark() {
|
|
396
|
-
return import_react_native.Appearance.getColorScheme() === "dark";
|
|
397
|
-
}
|
|
398
|
-
function resolveIsDark(m) {
|
|
399
|
-
return m === "system" ? systemPrefersDark() : m === "dark";
|
|
400
|
-
}
|
|
401
|
-
function applyToDom(dark) {
|
|
402
|
-
if (typeof document === "undefined") return;
|
|
403
|
-
const root = document.documentElement;
|
|
404
|
-
const strategy = getTheme().darkMode;
|
|
405
|
-
if (strategy === "class") {
|
|
406
|
-
root.classList.toggle("dark", dark);
|
|
407
|
-
root.classList.toggle("light", !dark);
|
|
408
|
-
} else if (strategy === "attribute") {
|
|
409
|
-
root.setAttribute("data-theme", dark ? "dark" : "light");
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
var mode = "system";
|
|
413
|
-
var isDark = resolveIsDark(mode);
|
|
414
|
-
applyToDom(isDark);
|
|
415
|
-
var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
|
|
416
|
-
if (mode !== "system") return;
|
|
417
|
-
isDark = colorScheme === "dark";
|
|
418
|
-
applyToDom(isDark);
|
|
419
|
-
notify();
|
|
420
|
-
});
|
|
421
|
-
function notify() {
|
|
422
|
-
for (const listener of listeners) listener();
|
|
423
|
-
}
|
|
424
|
-
function getGlobalDarkMode() {
|
|
425
|
-
return isDark;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// src/jsxRuntimeCore.ts
|
|
32
|
+
var import_darkModeStore = require("./darkModeStore");
|
|
33
|
+
var import_theme = require("./theme");
|
|
429
34
|
function makeElement(isStaticChildren, type, props, key) {
|
|
430
35
|
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
431
36
|
}
|
|
@@ -440,8 +45,36 @@ function resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, pressed) {
|
|
|
440
45
|
return [resolved, userStyle];
|
|
441
46
|
}
|
|
442
47
|
var DARK_MODIFIER_RE = /(^|\s)dark:/;
|
|
48
|
+
var BREAKPOINT_MODIFIER_RE = /(^|\s)(sm|md|lg|xl|2xl):/;
|
|
49
|
+
var BREAKPOINT_MODIFIER_MATCH_RE = /(?:^|\s)(sm|md|lg|xl|2xl):/g;
|
|
443
50
|
function darkModeKeySuffix(classStrRaw) {
|
|
444
|
-
return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${getGlobalDarkMode()}` : "";
|
|
51
|
+
return DARK_MODIFIER_RE.test(classStrRaw) ? `:kb-dark-${(0, import_darkModeStore.getGlobalDarkMode)()}` : "";
|
|
52
|
+
}
|
|
53
|
+
function breakpointKeySuffix(classStrRaw, width) {
|
|
54
|
+
const matches = classStrRaw.match(BREAKPOINT_MODIFIER_MATCH_RE);
|
|
55
|
+
if (!matches) {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
const screens = (0, import_theme.getTheme)().screens;
|
|
59
|
+
const present = Array.from(new Set(matches.map((m) => m.trim().slice(0, -1))));
|
|
60
|
+
const state = present.map((name) => screens[name] !== void 0 && width >= screens[name] ? "1" : "0").join("");
|
|
61
|
+
return `:kb-bp-${state}`;
|
|
62
|
+
}
|
|
63
|
+
function ReactiveElement({
|
|
64
|
+
hostType,
|
|
65
|
+
hostRest,
|
|
66
|
+
classStrRaw,
|
|
67
|
+
userStyle,
|
|
68
|
+
resolveStyle: resolveStyle2,
|
|
69
|
+
elementKey,
|
|
70
|
+
isStaticChildren
|
|
71
|
+
}) {
|
|
72
|
+
(0, import_react.useSyncExternalStore)(import_darkModeStore.subscribeGlobalDarkMode, import_darkModeStore.getGlobalDarkMode);
|
|
73
|
+
const { width } = (0, import_react_native.useWindowDimensions)();
|
|
74
|
+
const finalStyle = hostType === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
75
|
+
const suffix = darkModeKeySuffix(classStrRaw) + breakpointKeySuffix(classStrRaw, width);
|
|
76
|
+
const finalKey = suffix ? `${elementKey ?? ""}${suffix}` : elementKey;
|
|
77
|
+
return makeElement(isStaticChildren, hostType, { ...hostRest, style: finalStyle }, finalKey);
|
|
445
78
|
}
|
|
446
79
|
function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
447
80
|
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
@@ -451,10 +84,15 @@ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
|
|
|
451
84
|
if (typeof classStrRaw !== "string") {
|
|
452
85
|
return makeElement(isStaticChildren, type, rawProps, key);
|
|
453
86
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
87
|
+
if (DARK_MODIFIER_RE.test(classStrRaw) || BREAKPOINT_MODIFIER_RE.test(classStrRaw)) {
|
|
88
|
+
return (0, import_jsx_runtime.jsx)(
|
|
89
|
+
ReactiveElement,
|
|
90
|
+
{ hostType: type, hostRest: rest, classStrRaw, userStyle, resolveStyle: resolveStyle2, elementKey: key, isStaticChildren },
|
|
91
|
+
key
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const finalStyle = type === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
|
|
95
|
+
return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
|
|
458
96
|
}
|
|
459
97
|
function createJsxFunctions(resolveStyle2) {
|
|
460
98
|
function jsx2(type, props, key) {
|
|
@@ -477,7 +115,9 @@ function createJsxDEV(jsx2, jsxs2) {
|
|
|
477
115
|
}
|
|
478
116
|
|
|
479
117
|
// src/nativeBridge.ts
|
|
480
|
-
var
|
|
118
|
+
var import_react_native2 = require("react-native");
|
|
119
|
+
var import_theme2 = require("./theme");
|
|
120
|
+
var import_darkModeStore2 = require("./darkModeStore");
|
|
481
121
|
|
|
482
122
|
// src/jsEngine/parser.ts
|
|
483
123
|
var VALUE_PREFIXES = [
|
|
@@ -1694,13 +1334,13 @@ function resolveStyleJs(classString, theme, colorScheme, pressed, width) {
|
|
|
1694
1334
|
|
|
1695
1335
|
// src/nativeBridge.ts
|
|
1696
1336
|
function resolveStyle(classString, pressed = false) {
|
|
1697
|
-
const colorScheme = getGlobalDarkMode() ? "dark" : "light";
|
|
1698
|
-
const width =
|
|
1699
|
-
const KbachModule =
|
|
1337
|
+
const colorScheme = (0, import_darkModeStore2.getGlobalDarkMode)() ? "dark" : "light";
|
|
1338
|
+
const width = import_react_native2.Dimensions.get("window").width;
|
|
1339
|
+
const KbachModule = import_react_native2.TurboModuleRegistry.get("KbachModule");
|
|
1700
1340
|
if (!KbachModule) {
|
|
1701
|
-
return resolveStyleJs(classString, getTheme(), colorScheme, pressed, width);
|
|
1341
|
+
return resolveStyleJs(classString, (0, import_theme2.getTheme)(), colorScheme, pressed, width);
|
|
1702
1342
|
}
|
|
1703
|
-
const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed, width);
|
|
1343
|
+
const json = KbachModule.resolveStyle(classString, (0, import_theme2.getThemeJson)(), colorScheme, pressed, width);
|
|
1704
1344
|
return JSON.parse(json);
|
|
1705
1345
|
}
|
|
1706
1346
|
|
package/dist/jsx-dev-runtime.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
jsx,
|
|
3
3
|
jsxs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UNZ6PQVO.mjs";
|
|
5
5
|
import "./chunk-JMNJCPGK.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Fragment,
|
|
8
8
|
createJsxDEV
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EMZ47OSG.mjs";
|
|
10
10
|
import "./chunk-RBJXE32L.mjs";
|
|
11
11
|
import "./chunk-HK6PDJJK.mjs";
|
|
12
12
|
|