@kbach/react 0.6.50 → 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 +90 -390
- package/dist/chunk-AFY36PRX.mjs +414 -0
- package/dist/chunk-G3RJJNSY.mjs +100 -0
- package/dist/chunk-VBPQAIZL.mjs +32 -0
- package/dist/index.d.mts +117 -0
- package/dist/index.d.ts +84 -295
- package/dist/index.js +618 -1101
- package/dist/index.mjs +143 -550
- package/dist/jsx-dev-runtime.d.mts +22 -0
- package/dist/jsx-dev-runtime.d.ts +6 -5
- package/dist/jsx-dev-runtime.js +453 -695
- package/dist/jsx-dev-runtime.mjs +3 -3
- package/dist/jsx-runtime.d.mts +22 -0
- package/dist/jsx-runtime.d.ts +11 -6
- package/dist/jsx-runtime.js +455 -706
- package/dist/jsx-runtime.mjs +4 -9
- package/dist/theme-BKAb78KP.d.mts +20 -0
- package/dist/theme-BKAb78KP.d.ts +20 -0
- package/dist/vite-plugin.d.mts +20 -147
- package/dist/vite-plugin.d.ts +20 -147
- package/dist/vite-plugin.js +1380 -3722
- package/dist/vite-plugin.mjs +994 -3713
- package/package.json +20 -46
- package/KBACH.md +0 -1044
- package/dist/chunk-KRRGLJLA.mjs +0 -4187
- package/dist/chunk-LIUJPOTS.mjs +0 -208
- package/dist/core/index.d.ts +0 -1346
- package/dist/core/index.js +0 -3712
- package/dist/native.d.ts +0 -314
- package/dist/native.js +0 -99
- package/dist/web-substitute-CfpYFnE7.d.ts +0 -22
- package/jsx-dev-runtime.js +0 -3
- package/jsx-runtime.js +0 -3
- package/kbach-react.md +0 -889
- package/scripts/postinstall.js +0 -28
- package/src/native/babel/index.js +0 -30
- package/src/native/babel-plugin/index.js +0 -605
- package/src/native/babel-plugin/index.test.ts +0 -86
- package/types.d.ts +0 -1
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -31,731 +30,490 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
30
|
// src/jsx-dev-runtime.tsx
|
|
32
31
|
var jsx_dev_runtime_exports = {};
|
|
33
32
|
__export(jsx_dev_runtime_exports, {
|
|
34
|
-
Fragment: () =>
|
|
33
|
+
Fragment: () => import_react.Fragment,
|
|
35
34
|
jsxDEV: () => jsxDEV
|
|
36
35
|
});
|
|
37
36
|
module.exports = __toCommonJS(jsx_dev_runtime_exports);
|
|
38
37
|
|
|
39
38
|
// src/jsx-runtime.tsx
|
|
40
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
-
var
|
|
42
|
-
var import_core6 = require("./core");
|
|
40
|
+
var import_react = require("react");
|
|
43
41
|
|
|
44
|
-
// src/
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const isServer = typeof window === "undefined";
|
|
55
|
-
const [, forceUpdate] = import_react.default.useReducer((n) => n + 1, 0);
|
|
56
|
-
const value = isServer && getServerSnapshot ? getServerSnapshot() : getSnapshot();
|
|
57
|
-
import_react.default.useEffect(() => {
|
|
58
|
-
if (getSnapshot() !== value) forceUpdate();
|
|
59
|
-
return subscribe(forceUpdate);
|
|
60
|
-
}, [subscribe]);
|
|
61
|
-
return value;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// src/useGlobalDarkMode.ts
|
|
65
|
-
var NOOP_SUB = (_) => () => {
|
|
66
|
-
};
|
|
67
|
-
var FALSE_SNAP = () => false;
|
|
68
|
-
function useConditionalGlobalDarkMode(active) {
|
|
69
|
-
return useSyncExternalStore(
|
|
70
|
-
active ? import_core.subscribeGlobalDarkMode : NOOP_SUB,
|
|
71
|
-
active ? import_core.getGlobalDarkMode : FALSE_SNAP,
|
|
72
|
-
FALSE_SNAP
|
|
73
|
-
);
|
|
42
|
+
// src/wasmLoader.ts
|
|
43
|
+
var import_core_engine = __toESM(require("@kbach/core-engine"));
|
|
44
|
+
var ready = false;
|
|
45
|
+
function generateCss(classString, themeJson) {
|
|
46
|
+
if (!ready) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
"[kbach] generateCss() was called before initKbach() resolved. Call `await initKbach()` once at startup (e.g. before rendering your app) before using kb()."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return (0, import_core_engine.generate_css)(classString, themeJson);
|
|
74
52
|
}
|
|
75
53
|
|
|
76
|
-
// src/
|
|
77
|
-
var
|
|
78
|
-
|
|
54
|
+
// src/generatedPalette.ts
|
|
55
|
+
var PALETTE = {
|
|
56
|
+
"amber-1": "#fffbeb",
|
|
57
|
+
"amber-10": "#78350f",
|
|
58
|
+
"amber-11": "#451a03",
|
|
59
|
+
"amber-12": "#291002",
|
|
60
|
+
"amber-2": "#fef3c7",
|
|
61
|
+
"amber-3": "#fde68a",
|
|
62
|
+
"amber-4": "#fcd34d",
|
|
63
|
+
"amber-5": "#fbbf24",
|
|
64
|
+
"amber-6": "#f59e0b",
|
|
65
|
+
"amber-7": "#d97706",
|
|
66
|
+
"amber-8": "#b45309",
|
|
67
|
+
"amber-9": "#92400e",
|
|
68
|
+
"black": "#000000",
|
|
69
|
+
"blue-1": "#eff6ff",
|
|
70
|
+
"blue-10": "#1e3a8a",
|
|
71
|
+
"blue-11": "#172554",
|
|
72
|
+
"blue-12": "#0d1633",
|
|
73
|
+
"blue-2": "#dbeafe",
|
|
74
|
+
"blue-3": "#bfdbfe",
|
|
75
|
+
"blue-4": "#93c5fd",
|
|
76
|
+
"blue-5": "#60a5fa",
|
|
77
|
+
"blue-6": "#3b82f6",
|
|
78
|
+
"blue-7": "#2563eb",
|
|
79
|
+
"blue-8": "#1d4ed8",
|
|
80
|
+
"blue-9": "#1e40af",
|
|
81
|
+
"bronze": "#cd7f32",
|
|
82
|
+
"coal": "#1c1c1c",
|
|
83
|
+
"copper": "#b87333",
|
|
84
|
+
"current": "currentColor",
|
|
85
|
+
"cyan-1": "#ecfeff",
|
|
86
|
+
"cyan-10": "#164e63",
|
|
87
|
+
"cyan-11": "#083344",
|
|
88
|
+
"cyan-12": "#041e28",
|
|
89
|
+
"cyan-2": "#cffafe",
|
|
90
|
+
"cyan-3": "#a5f3fc",
|
|
91
|
+
"cyan-4": "#67e8f9",
|
|
92
|
+
"cyan-5": "#22d3ee",
|
|
93
|
+
"cyan-6": "#06b6d4",
|
|
94
|
+
"cyan-7": "#0891b2",
|
|
95
|
+
"cyan-8": "#0e7490",
|
|
96
|
+
"cyan-9": "#155e75",
|
|
97
|
+
"emerald-1": "#ecfdf5",
|
|
98
|
+
"emerald-10": "#064e3b",
|
|
99
|
+
"emerald-11": "#022c22",
|
|
100
|
+
"emerald-12": "#011a14",
|
|
101
|
+
"emerald-2": "#d1fae5",
|
|
102
|
+
"emerald-3": "#a7f3d0",
|
|
103
|
+
"emerald-4": "#6ee7b7",
|
|
104
|
+
"emerald-5": "#34d399",
|
|
105
|
+
"emerald-6": "#10b981",
|
|
106
|
+
"emerald-7": "#059669",
|
|
107
|
+
"emerald-8": "#047857",
|
|
108
|
+
"emerald-9": "#065f46",
|
|
109
|
+
"fuchsia-1": "#fdf4ff",
|
|
110
|
+
"fuchsia-10": "#701a75",
|
|
111
|
+
"fuchsia-11": "#4a044e",
|
|
112
|
+
"fuchsia-12": "#2d022f",
|
|
113
|
+
"fuchsia-2": "#fae8ff",
|
|
114
|
+
"fuchsia-3": "#f5d0fe",
|
|
115
|
+
"fuchsia-4": "#f0abfc",
|
|
116
|
+
"fuchsia-5": "#e879f9",
|
|
117
|
+
"fuchsia-6": "#d946ef",
|
|
118
|
+
"fuchsia-7": "#c026d3",
|
|
119
|
+
"fuchsia-8": "#a21caf",
|
|
120
|
+
"fuchsia-9": "#86198f",
|
|
121
|
+
"gold": "#d4af37",
|
|
122
|
+
"gray-1": "#f9fafb",
|
|
123
|
+
"gray-10": "#111827",
|
|
124
|
+
"gray-11": "#030712",
|
|
125
|
+
"gray-12": "#020409",
|
|
126
|
+
"gray-2": "#f3f4f6",
|
|
127
|
+
"gray-3": "#e5e7eb",
|
|
128
|
+
"gray-4": "#d1d5db",
|
|
129
|
+
"gray-5": "#9ca3af",
|
|
130
|
+
"gray-6": "#6b7280",
|
|
131
|
+
"gray-7": "#4b5563",
|
|
132
|
+
"gray-8": "#374151",
|
|
133
|
+
"gray-9": "#1f2937",
|
|
134
|
+
"green-1": "#f0fdf4",
|
|
135
|
+
"green-10": "#14532d",
|
|
136
|
+
"green-11": "#052e16",
|
|
137
|
+
"green-12": "#031b0d",
|
|
138
|
+
"green-2": "#dcfce7",
|
|
139
|
+
"green-3": "#bbf7d0",
|
|
140
|
+
"green-4": "#86efac",
|
|
141
|
+
"green-5": "#4ade80",
|
|
142
|
+
"green-6": "#22c55e",
|
|
143
|
+
"green-7": "#16a34a",
|
|
144
|
+
"green-8": "#15803d",
|
|
145
|
+
"green-9": "#166534",
|
|
146
|
+
"indigo-1": "#eef2ff",
|
|
147
|
+
"indigo-10": "#312e81",
|
|
148
|
+
"indigo-11": "#1e1b4b",
|
|
149
|
+
"indigo-12": "#12102d",
|
|
150
|
+
"indigo-2": "#e0e7ff",
|
|
151
|
+
"indigo-3": "#c7d2fe",
|
|
152
|
+
"indigo-4": "#a5b4fc",
|
|
153
|
+
"indigo-5": "#818cf8",
|
|
154
|
+
"indigo-6": "#6366f1",
|
|
155
|
+
"indigo-7": "#4f46e5",
|
|
156
|
+
"indigo-8": "#4338ca",
|
|
157
|
+
"indigo-9": "#3730a3",
|
|
158
|
+
"lime-1": "#f7fee7",
|
|
159
|
+
"lime-10": "#365314",
|
|
160
|
+
"lime-11": "#1a2e05",
|
|
161
|
+
"lime-12": "#0f1b03",
|
|
162
|
+
"lime-2": "#ecfccb",
|
|
163
|
+
"lime-3": "#d9f99d",
|
|
164
|
+
"lime-4": "#bef264",
|
|
165
|
+
"lime-5": "#a3e635",
|
|
166
|
+
"lime-6": "#84cc16",
|
|
167
|
+
"lime-7": "#65a30d",
|
|
168
|
+
"lime-8": "#4d7c0f",
|
|
169
|
+
"lime-9": "#3f6212",
|
|
170
|
+
"neutral-1": "#fafafa",
|
|
171
|
+
"neutral-10": "#171717",
|
|
172
|
+
"neutral-11": "#0a0a0a",
|
|
173
|
+
"neutral-12": "#050505",
|
|
174
|
+
"neutral-2": "#f5f5f5",
|
|
175
|
+
"neutral-3": "#e5e5e5",
|
|
176
|
+
"neutral-4": "#d4d4d4",
|
|
177
|
+
"neutral-5": "#a3a3a3",
|
|
178
|
+
"neutral-6": "#737373",
|
|
179
|
+
"neutral-7": "#525252",
|
|
180
|
+
"neutral-8": "#404040",
|
|
181
|
+
"neutral-9": "#262626",
|
|
182
|
+
"orange-1": "#fff7ed",
|
|
183
|
+
"orange-10": "#7c2d12",
|
|
184
|
+
"orange-11": "#431407",
|
|
185
|
+
"orange-12": "#270c04",
|
|
186
|
+
"orange-2": "#ffedd5",
|
|
187
|
+
"orange-3": "#fed7aa",
|
|
188
|
+
"orange-4": "#fdba74",
|
|
189
|
+
"orange-5": "#fb923c",
|
|
190
|
+
"orange-6": "#f97316",
|
|
191
|
+
"orange-7": "#ea580c",
|
|
192
|
+
"orange-8": "#c2410c",
|
|
193
|
+
"orange-9": "#9a3412",
|
|
194
|
+
"pink-1": "#fdf2f8",
|
|
195
|
+
"pink-10": "#831843",
|
|
196
|
+
"pink-11": "#500724",
|
|
197
|
+
"pink-12": "#300415",
|
|
198
|
+
"pink-2": "#fce7f3",
|
|
199
|
+
"pink-3": "#fbcfe8",
|
|
200
|
+
"pink-4": "#f9a8d4",
|
|
201
|
+
"pink-5": "#f472b6",
|
|
202
|
+
"pink-6": "#ec4899",
|
|
203
|
+
"pink-7": "#db2777",
|
|
204
|
+
"pink-8": "#be185d",
|
|
205
|
+
"pink-9": "#9d174d",
|
|
206
|
+
"purple-1": "#faf5ff",
|
|
207
|
+
"purple-10": "#581c87",
|
|
208
|
+
"purple-11": "#3b0764",
|
|
209
|
+
"purple-12": "#23043c",
|
|
210
|
+
"purple-2": "#f3e8ff",
|
|
211
|
+
"purple-3": "#e9d5ff",
|
|
212
|
+
"purple-4": "#d8b4fe",
|
|
213
|
+
"purple-5": "#c084fc",
|
|
214
|
+
"purple-6": "#a855f7",
|
|
215
|
+
"purple-7": "#9333ea",
|
|
216
|
+
"purple-8": "#7e22ce",
|
|
217
|
+
"purple-9": "#6b21a8",
|
|
218
|
+
"red-1": "#fef2f2",
|
|
219
|
+
"red-10": "#7f1d1d",
|
|
220
|
+
"red-11": "#450a0a",
|
|
221
|
+
"red-12": "#280606",
|
|
222
|
+
"red-2": "#fee2e2",
|
|
223
|
+
"red-3": "#fecaca",
|
|
224
|
+
"red-4": "#fca5a5",
|
|
225
|
+
"red-5": "#f87171",
|
|
226
|
+
"red-6": "#ef4444",
|
|
227
|
+
"red-7": "#dc2626",
|
|
228
|
+
"red-8": "#b91c1c",
|
|
229
|
+
"red-9": "#991b1b",
|
|
230
|
+
"rose-1": "#fff1f2",
|
|
231
|
+
"rose-10": "#881337",
|
|
232
|
+
"rose-11": "#4c0519",
|
|
233
|
+
"rose-12": "#2d030e",
|
|
234
|
+
"rose-2": "#ffe4e6",
|
|
235
|
+
"rose-3": "#fecdd3",
|
|
236
|
+
"rose-4": "#fda4af",
|
|
237
|
+
"rose-5": "#fb7185",
|
|
238
|
+
"rose-6": "#f43f5e",
|
|
239
|
+
"rose-7": "#e11d48",
|
|
240
|
+
"rose-8": "#be123c",
|
|
241
|
+
"rose-9": "#9f1239",
|
|
242
|
+
"silver": "#c0c0c0",
|
|
243
|
+
"sky-1": "#f0f9ff",
|
|
244
|
+
"sky-10": "#0c4a6e",
|
|
245
|
+
"sky-11": "#082f49",
|
|
246
|
+
"sky-12": "#041b2b",
|
|
247
|
+
"sky-2": "#e0f2fe",
|
|
248
|
+
"sky-3": "#bae6fd",
|
|
249
|
+
"sky-4": "#7dd3fc",
|
|
250
|
+
"sky-5": "#38bdf8",
|
|
251
|
+
"sky-6": "#0ea5e9",
|
|
252
|
+
"sky-7": "#0284c7",
|
|
253
|
+
"sky-8": "#0369a1",
|
|
254
|
+
"sky-9": "#075985",
|
|
255
|
+
"slate-1": "#f8fafc",
|
|
256
|
+
"slate-10": "#0f172a",
|
|
257
|
+
"slate-11": "#020617",
|
|
258
|
+
"slate-12": "#01020a",
|
|
259
|
+
"slate-2": "#f1f5f9",
|
|
260
|
+
"slate-3": "#e2e8f0",
|
|
261
|
+
"slate-4": "#cbd5e1",
|
|
262
|
+
"slate-5": "#94a3b8",
|
|
263
|
+
"slate-6": "#64748b",
|
|
264
|
+
"slate-7": "#475569",
|
|
265
|
+
"slate-8": "#334155",
|
|
266
|
+
"slate-9": "#1e293b",
|
|
267
|
+
"stone-1": "#fafaf9",
|
|
268
|
+
"stone-10": "#1c1917",
|
|
269
|
+
"stone-11": "#0c0a09",
|
|
270
|
+
"stone-12": "#070605",
|
|
271
|
+
"stone-2": "#f5f5f4",
|
|
272
|
+
"stone-3": "#e7e5e4",
|
|
273
|
+
"stone-4": "#d6d3d1",
|
|
274
|
+
"stone-5": "#a8a29e",
|
|
275
|
+
"stone-6": "#78716c",
|
|
276
|
+
"stone-7": "#57534e",
|
|
277
|
+
"stone-8": "#44403c",
|
|
278
|
+
"stone-9": "#292524",
|
|
279
|
+
"teal-1": "#f0fdfa",
|
|
280
|
+
"teal-10": "#134e4a",
|
|
281
|
+
"teal-11": "#042f2e",
|
|
282
|
+
"teal-12": "#021c1b",
|
|
283
|
+
"teal-2": "#ccfbf1",
|
|
284
|
+
"teal-3": "#99f6e4",
|
|
285
|
+
"teal-4": "#5eead4",
|
|
286
|
+
"teal-5": "#2dd4bf",
|
|
287
|
+
"teal-6": "#14b8a6",
|
|
288
|
+
"teal-7": "#0d9488",
|
|
289
|
+
"teal-8": "#0f766e",
|
|
290
|
+
"teal-9": "#115e59",
|
|
291
|
+
"transparent": "transparent",
|
|
292
|
+
"violet-1": "#f5f3ff",
|
|
293
|
+
"violet-10": "#4c1d95",
|
|
294
|
+
"violet-11": "#2e1065",
|
|
295
|
+
"violet-12": "#1c0a3d",
|
|
296
|
+
"violet-2": "#ede9fe",
|
|
297
|
+
"violet-3": "#ddd6fe",
|
|
298
|
+
"violet-4": "#c4b5fd",
|
|
299
|
+
"violet-5": "#a78bfa",
|
|
300
|
+
"violet-6": "#8b5cf6",
|
|
301
|
+
"violet-7": "#7c3aed",
|
|
302
|
+
"violet-8": "#6d28d9",
|
|
303
|
+
"violet-9": "#5b21b6",
|
|
304
|
+
"white": "#ffffff",
|
|
305
|
+
"yellow-1": "#fefce8",
|
|
306
|
+
"yellow-10": "#713f12",
|
|
307
|
+
"yellow-11": "#422006",
|
|
308
|
+
"yellow-12": "#271304",
|
|
309
|
+
"yellow-2": "#fef9c3",
|
|
310
|
+
"yellow-3": "#fef08a",
|
|
311
|
+
"yellow-4": "#fde047",
|
|
312
|
+
"yellow-5": "#facc15",
|
|
313
|
+
"yellow-6": "#eab308",
|
|
314
|
+
"yellow-7": "#ca8a04",
|
|
315
|
+
"yellow-8": "#a16207",
|
|
316
|
+
"yellow-9": "#854d0e",
|
|
317
|
+
"zinc-1": "#fafafa",
|
|
318
|
+
"zinc-10": "#18181b",
|
|
319
|
+
"zinc-11": "#09090b",
|
|
320
|
+
"zinc-12": "#050506",
|
|
321
|
+
"zinc-2": "#f4f4f5",
|
|
322
|
+
"zinc-3": "#e4e4e7",
|
|
323
|
+
"zinc-4": "#d4d4d8",
|
|
324
|
+
"zinc-5": "#a1a1aa",
|
|
325
|
+
"zinc-6": "#71717a",
|
|
326
|
+
"zinc-7": "#52525b",
|
|
327
|
+
"zinc-8": "#3f3f46",
|
|
328
|
+
"zinc-9": "#27272a"
|
|
79
329
|
};
|
|
80
|
-
var ZERO_SNAP = () => 0;
|
|
81
|
-
var EMPTY_BREAKPOINTS = /* @__PURE__ */ new Set();
|
|
82
|
-
var _webListeners = null;
|
|
83
|
-
var _webRaf = 0;
|
|
84
|
-
function _webResizeHandler() {
|
|
85
|
-
cancelAnimationFrame(_webRaf);
|
|
86
|
-
_webRaf = requestAnimationFrame(() => {
|
|
87
|
-
if (_webListeners) for (const cb of _webListeners) cb();
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function subscribeWebWidth(cb) {
|
|
91
|
-
if (typeof window === "undefined") return () => {
|
|
92
|
-
};
|
|
93
|
-
if (!_webListeners) {
|
|
94
|
-
_webListeners = /* @__PURE__ */ new Set();
|
|
95
|
-
window.addEventListener("resize", _webResizeHandler);
|
|
96
|
-
}
|
|
97
|
-
_webListeners.add(cb);
|
|
98
|
-
return () => {
|
|
99
|
-
_webListeners.delete(cb);
|
|
100
|
-
if (_webListeners.size === 0) {
|
|
101
|
-
window.removeEventListener("resize", _webResizeHandler);
|
|
102
|
-
cancelAnimationFrame(_webRaf);
|
|
103
|
-
_webListeners = null;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function getWebWidth() {
|
|
108
|
-
return typeof window !== "undefined" ? window.innerWidth : 0;
|
|
109
|
-
}
|
|
110
|
-
function useConditionalWidth(active) {
|
|
111
|
-
return useSyncExternalStore(
|
|
112
|
-
active ? import_core2.isWeb ? subscribeWebWidth : import_core2.subscribeGlobalWidth : NOOP_SUB2,
|
|
113
|
-
active ? import_core2.isWeb ? getWebWidth : import_core2.getGlobalWidth : ZERO_SNAP,
|
|
114
|
-
ZERO_SNAP
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
330
|
|
|
118
|
-
// src/
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
delete s.gridRowStart;
|
|
153
|
-
delete s.gridRowEnd;
|
|
154
|
-
delete s.gridAutoFlow;
|
|
155
|
-
delete s.gridAutoColumns;
|
|
156
|
-
delete s.gridAutoRows;
|
|
157
|
-
delete s.placeItems;
|
|
158
|
-
delete s.placeContent;
|
|
159
|
-
delete s.justifyItems;
|
|
160
|
-
delete s.placeSelf;
|
|
161
|
-
delete s.justifySelf;
|
|
162
|
-
if (s.position === "sticky" || s.position === "fixed" || s.position === "static") {
|
|
163
|
-
delete s.position;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function composeNativeStyle(computed, userStyle) {
|
|
167
|
-
if (!userStyle) return computed;
|
|
168
|
-
return Array.isArray(userStyle) ? [computed, ...userStyle] : [computed, userStyle];
|
|
331
|
+
// src/theme.ts
|
|
332
|
+
var defaultTheme = {
|
|
333
|
+
colors: {
|
|
334
|
+
...PALETTE,
|
|
335
|
+
surface: { light: "#f9fafb", dark: "#111827" }
|
|
336
|
+
},
|
|
337
|
+
spacing: {
|
|
338
|
+
// "0" is always a hardcoded zero in real Tailwind's own scale too,
|
|
339
|
+
// regardless of the base spacing unit — needed for `p-0`/`m-0`/
|
|
340
|
+
// `top-0`/`inset-0`/etc., and specifically for `sticky top-0` (a
|
|
341
|
+
// sticky element needs an explicit offset to have any stick point at
|
|
342
|
+
// all; without one it behaves just like `relative`, no different from
|
|
343
|
+
// omitting `top-0` outright). Confirmed missing by hand: this
|
|
344
|
+
// sandbox's own header used `sticky top-0`, which silently never
|
|
345
|
+
// resolved (no "0" spacing key existed) until this was added.
|
|
346
|
+
"0": 0,
|
|
347
|
+
"1": 4,
|
|
348
|
+
"2": 8,
|
|
349
|
+
"4": 16,
|
|
350
|
+
"6": 24,
|
|
351
|
+
"8": 32
|
|
352
|
+
},
|
|
353
|
+
screens: {
|
|
354
|
+
sm: 640,
|
|
355
|
+
md: 768,
|
|
356
|
+
lg: 1024,
|
|
357
|
+
xl: 1280,
|
|
358
|
+
"2xl": 1536
|
|
359
|
+
},
|
|
360
|
+
darkMode: "attribute"
|
|
361
|
+
};
|
|
362
|
+
var activeThemeJson = JSON.stringify(defaultTheme);
|
|
363
|
+
function getThemeJson() {
|
|
364
|
+
return activeThemeJson;
|
|
169
365
|
}
|
|
170
366
|
|
|
171
|
-
// src/
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
// On web, onPointerDown/Up drive the wrapper's own pressed state (covers mouse + touch) —
|
|
251
|
-
// onPressIn/onPressOut are RN-only prop names and are never forwarded here, even when
|
|
252
|
-
// Component isn't a literal HTML tag string. A non-string Component on web is just as
|
|
253
|
-
// likely to be an ordinary web component (React Router's <Link>, Next.js's <Link>, any
|
|
254
|
-
// custom wrapper) as an actual react-native-web primitive — "not a string" alone was never
|
|
255
|
-
// a reliable signal that onPressIn/onPressOut are wanted, and forwarding them
|
|
256
|
-
// unconditionally made React DOM warn "Unknown event handler property" the moment any web
|
|
257
|
-
// component got an interactive modifier (hover:, active:, …), which is the common case,
|
|
258
|
-
// not the exception. (A real react-native-web primitive would additionally have this pair
|
|
259
|
-
// of props silently vanish after hydration anyway, once the browser-only web-substitution
|
|
260
|
-
// in jsx-runtime.tsx swaps it for a plain host tag — so keeping them pre-hydration would
|
|
261
|
-
// only have traded one prop-mismatch warning for another.) Genuinely native code paths
|
|
262
|
-
// still get them via the isNative branch below.
|
|
263
|
-
...!import_core4.isNative ? {
|
|
264
|
-
onPointerDown: handlePointerDown,
|
|
265
|
-
onPointerUp: handlePointerUp,
|
|
266
|
-
onPointerLeave: handlePointerLeave,
|
|
267
|
-
onPointerCancel: handlePointerCancel
|
|
268
|
-
} : { onPressIn: handlePressIn, onPressOut: handlePressOut },
|
|
269
|
-
onMouseEnter: handleMouseEnter,
|
|
270
|
-
onMouseLeave: handleMouseLeave,
|
|
271
|
-
onFocus: handleFocus,
|
|
272
|
-
onBlur: handleBlur
|
|
273
|
-
};
|
|
274
|
-
return Array.isArray(children) ? import_react2.default.createElement(Component, componentProps, ...children) : import_react2.default.createElement(Component, componentProps, children);
|
|
275
|
-
}
|
|
276
|
-
);
|
|
277
|
-
InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|
|
278
|
-
|
|
279
|
-
// src/DarkWrapper.tsx
|
|
280
|
-
var import_react3 = __toESM(require("react"));
|
|
281
|
-
var import_core5 = require("./core");
|
|
282
|
-
var DarkWrapper = import_react3.default.forwardRef(
|
|
283
|
-
function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
|
|
284
|
-
const isWebPlatform = (0, import_core5.getEffectiveIsWeb)();
|
|
285
|
-
const isDark = useConditionalGlobalDarkMode(!isWebPlatform);
|
|
286
|
-
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
287
|
-
const width = useConditionalWidth(needsWidth && !isWebPlatform);
|
|
288
|
-
const breakpoints = needsWidth ? (0, import_core5.getActiveBreakpoints)(width) : EMPTY_BREAKPOINTS;
|
|
289
|
-
const screens = (0, import_core5.getGlobalScreens)();
|
|
290
|
-
const isNonStringComponent = typeof Component !== "string";
|
|
291
|
-
const computedStyle = (0, import_react3.useMemo)(() => {
|
|
292
|
-
if (isWebPlatform) return {};
|
|
293
|
-
const s = (0, import_core5.flatten)(resolvedStyle, isDark, {}, breakpoints);
|
|
294
|
-
stripInternalMarkers(s);
|
|
295
|
-
if (isNonStringComponent) stripWebOnlyProps(s);
|
|
296
|
-
return s;
|
|
297
|
-
}, [resolvedStyle, isDark, width, screens, isNonStringComponent]);
|
|
298
|
-
const skipComputedInline = isWebPlatform;
|
|
299
|
-
const finalStyle = skipComputedInline ? styleProp ?? void 0 : composeNativeStyle(computedStyle, styleProp);
|
|
300
|
-
const props = { ref, ...rest, style: finalStyle };
|
|
301
|
-
return Array.isArray(children) ? import_react3.default.createElement(Component, props, ...children) : import_react3.default.createElement(Component, props, children);
|
|
302
|
-
}
|
|
303
|
-
);
|
|
304
|
-
DarkWrapper.displayName = "Kbach.DarkWrapper";
|
|
367
|
+
// src/reset.ts
|
|
368
|
+
var RESET_STYLE_ID = "kbach-reset";
|
|
369
|
+
var RESET_RULES = [
|
|
370
|
+
// border-style: solid means border-N utilities show a visible border without an extra border-solid class.
|
|
371
|
+
// border-width: 0 keeps all elements borderless by default.
|
|
372
|
+
{ css: "*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }" },
|
|
373
|
+
{ css: "body { margin: 0; padding: 0; }" },
|
|
374
|
+
{ css: "h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }", tags: ["h1", "h2", "h3", "h4", "h5", "h6"] },
|
|
375
|
+
{ css: "p { margin: 0; }", tags: ["p"] },
|
|
376
|
+
{ css: "a { color: inherit; text-decoration: none; }", tags: ["a"] },
|
|
377
|
+
{ css: "ul, ol { margin: 0; padding: 0; list-style: none; }", tags: ["ul", "ol"] },
|
|
378
|
+
// svg here only covers a literal <svg> tag in JSX — an icon imported as
|
|
379
|
+
// a component (e.g. `<ArrowIcon />`) never appears as the text "svg" in
|
|
380
|
+
// source, so this rule won't be pulled in by that usage alone. Same
|
|
381
|
+
// caveat applies to every tag-gated rule below: detection is a literal
|
|
382
|
+
// source-text scan (see vite-plugin/scan.ts's scanUsedTags), not a real
|
|
383
|
+
// DOM/type check.
|
|
384
|
+
{ css: "img, video, svg { display: block; max-width: 100%; }", tags: ["img", "video", "svg"] },
|
|
385
|
+
// appearance: none is deliberately NOT applied to checkbox/radio/select below —
|
|
386
|
+
// stripping it hides their native checkmark/arrow with nothing rendered in its
|
|
387
|
+
// place, leaving an invisible checkbox or an arrow-less <select> that looks like
|
|
388
|
+
// plain text. Text-like inputs, textarea, and button don't have that problem
|
|
389
|
+
// (their native chrome is just a skin around content utilities can fully
|
|
390
|
+
// restyle), so they keep the blank-canvas treatment.
|
|
391
|
+
// :where() wraps the :not() exclusions so they contribute ZERO specificity
|
|
392
|
+
// (unlike a bare `input:not([type='checkbox']):not([type='radio'])`, whose
|
|
393
|
+
// two :not([attr]) clauses each add a class-level specificity point — (0,2,1)
|
|
394
|
+
// total, MORE than any single utility class (0,1,0)). Without :where(), this
|
|
395
|
+
// reset's `color: inherit` always won the cascade over a text-* color
|
|
396
|
+
// utility applied directly to a <input>/<textarea> regardless of source
|
|
397
|
+
// order, since author rules only override on a tie or higher specificity —
|
|
398
|
+
// confirmed on a real app: a TextInput's own text color utility resolved
|
|
399
|
+
// and injected correctly, class and all, but silently never painted.
|
|
400
|
+
{
|
|
401
|
+
css: "input:where(:not([type='checkbox']):not([type='radio'])), textarea { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }",
|
|
402
|
+
tags: ["input", "textarea"]
|
|
403
|
+
},
|
|
404
|
+
// Native checkbox/radio/range still get typography + spacing normalized, and
|
|
405
|
+
// accent-color re-themes their native indicator to the current text color
|
|
406
|
+
// instead of the browser/OS default blue, so they stay on-brand without
|
|
407
|
+
// needing to be rebuilt from scratch. Wrapped in :where() for the exact
|
|
408
|
+
// same reason as the input:not(...) exclusions above — a bare
|
|
409
|
+
// `input[type='range']` attribute selector has specificity (0,1,1),
|
|
410
|
+
// MORE than any single utility class (0,1,0), so an `accent-*` utility
|
|
411
|
+
// (Phase 23) applied directly to a checkbox/radio/range would resolve and
|
|
412
|
+
// inject correctly but silently never paint, losing the cascade to this
|
|
413
|
+
// reset regardless of source order — confirmed by hand via
|
|
414
|
+
// getComputedStyle on a real `accent-red-6` range input, which reported
|
|
415
|
+
// `currentColor`'s inherited value instead. `:where()` zeroes this
|
|
416
|
+
// selector's specificity contribution entirely, so any `accent-*`
|
|
417
|
+
// utility trivially wins once applied.
|
|
418
|
+
{
|
|
419
|
+
css: ":where(input[type='checkbox'], input[type='radio'], input[type='range']) { margin: 0; font: inherit; accent-color: currentColor; }",
|
|
420
|
+
tags: ["input"]
|
|
421
|
+
},
|
|
422
|
+
// select keeps its native chrome (border/background/arrow are all part of the
|
|
423
|
+
// same OS-drawn widget that appearance: none would blank out) — only typography
|
|
424
|
+
// and spacing are normalized so it still matches surrounding text.
|
|
425
|
+
{ css: "select { margin: 0; font: inherit; color: inherit; line-height: inherit; }", tags: ["select"] },
|
|
426
|
+
{ css: "button { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: inherit; text-align: inherit; }", tags: ["button"] },
|
|
427
|
+
// Also covers any element opted into the button role (`role="button"` on
|
|
428
|
+
// a <div>/<span>) — but only when a literal <button> tag is ALSO
|
|
429
|
+
// somewhere in the scanned source, since detection here is purely
|
|
430
|
+
// tag-name-based; a project using role="button" exclusively, with no
|
|
431
|
+
// real <button> anywhere, won't pull this rule in. Acceptable tradeoff
|
|
432
|
+
// for this project's scope (rare pattern) — cheap enough that scanning
|
|
433
|
+
// for it separately isn't worth the added complexity.
|
|
434
|
+
{ css: "button, [role='button'] { cursor: pointer; }", tags: ["button"] },
|
|
435
|
+
{ css: ":disabled { cursor: default; }", tags: ["button", "input", "select", "textarea"] },
|
|
436
|
+
{ css: "textarea { resize: vertical; }", tags: ["textarea"] },
|
|
437
|
+
// Firefox renders placeholders at ~54% opacity by default; every other browser uses 1 —
|
|
438
|
+
// normalize to 1 so placeholder color is consistent and fully controlled by the placeholder: modifier.
|
|
439
|
+
{ css: "::placeholder { opacity: 1; }", tags: ["input", "textarea"] },
|
|
440
|
+
{ css: "input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { margin: 0; }", tags: ["input"] },
|
|
441
|
+
{ css: "input[type='search']::-webkit-search-decoration, input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }", tags: ["input"] },
|
|
442
|
+
{ css: "fieldset { padding: 0; margin: 0; }", tags: ["fieldset"] },
|
|
443
|
+
{ css: "table { border-collapse: collapse; border-spacing: 0; }", tags: ["table"] }
|
|
444
|
+
];
|
|
445
|
+
var BASE_RESET = RESET_RULES.map((r) => r.css).join("\n");
|
|
305
446
|
|
|
306
|
-
// src/
|
|
307
|
-
var
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
Image: "img",
|
|
318
|
-
ImageBackground: "div",
|
|
319
|
-
Pressable: "div",
|
|
320
|
-
TouchableOpacity: "div",
|
|
321
|
-
TouchableHighlight: "div",
|
|
322
|
-
TouchableWithoutFeedback: "div",
|
|
323
|
-
TouchableNativeFeedback: "div"
|
|
324
|
-
};
|
|
325
|
-
var _userMap = /* @__PURE__ */ new Map();
|
|
326
|
-
var _cache = /* @__PURE__ */ new WeakMap();
|
|
327
|
-
var _forwardRefOrMemoType = /* @__PURE__ */ new Set([
|
|
328
|
-
/* @__PURE__ */ Symbol.for("react.forward_ref"),
|
|
329
|
-
/* @__PURE__ */ Symbol.for("react.memo")
|
|
330
|
-
]);
|
|
331
|
-
function looksLikeRealRNPrimitive(type) {
|
|
332
|
-
const t = type.$$typeof;
|
|
333
|
-
if (t !== void 0) return _forwardRefOrMemoType.has(t);
|
|
334
|
-
return !!type.prototype?.isReactComponent;
|
|
447
|
+
// src/kb.ts
|
|
448
|
+
var runtimeCSSDisabled = false;
|
|
449
|
+
var styleEl = null;
|
|
450
|
+
var sheetKeys = [];
|
|
451
|
+
var ruleOrderByKey = /* @__PURE__ */ new Map();
|
|
452
|
+
function getStyleEl() {
|
|
453
|
+
if (styleEl) return styleEl;
|
|
454
|
+
styleEl = document.createElement("style");
|
|
455
|
+
styleEl.setAttribute("data-kbach", "");
|
|
456
|
+
document.head.appendChild(styleEl);
|
|
457
|
+
return styleEl;
|
|
335
458
|
}
|
|
336
|
-
function
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (!name) {
|
|
344
|
-
_cache.set(obj, null);
|
|
345
|
-
return null;
|
|
346
|
-
}
|
|
347
|
-
if (name === "TextInput") {
|
|
348
|
-
const multiline = !!props && (props.multiline === true || Number(props.numberOfLines) > 1);
|
|
349
|
-
return multiline ? "textarea" : "input";
|
|
459
|
+
function findInsertionIndex(order) {
|
|
460
|
+
let lo = 0;
|
|
461
|
+
let hi = sheetKeys.length;
|
|
462
|
+
while (lo < hi) {
|
|
463
|
+
const mid = lo + hi >>> 1;
|
|
464
|
+
if (ruleOrderByKey.get(sheetKeys[mid]) > order) hi = mid;
|
|
465
|
+
else lo = mid + 1;
|
|
350
466
|
}
|
|
351
|
-
|
|
352
|
-
const tag = _rnToHtml[name] ?? null;
|
|
353
|
-
_cache.set(obj, tag);
|
|
354
|
-
return tag;
|
|
467
|
+
return lo;
|
|
355
468
|
}
|
|
356
|
-
function
|
|
357
|
-
if (
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
469
|
+
function injectRule(rule, order) {
|
|
470
|
+
if (ruleOrderByKey.has(rule)) return;
|
|
471
|
+
const sheet = getStyleEl().sheet;
|
|
472
|
+
if (!sheet) return;
|
|
473
|
+
const idx = findInsertionIndex(order);
|
|
474
|
+
try {
|
|
475
|
+
sheet.insertRule(rule, idx);
|
|
476
|
+
} catch {
|
|
477
|
+
return;
|
|
365
478
|
}
|
|
366
|
-
|
|
479
|
+
sheetKeys.splice(idx, 0, rule);
|
|
480
|
+
ruleOrderByKey.set(rule, order);
|
|
367
481
|
}
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
"
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
"android_disableSound",
|
|
378
|
-
"onHoverIn",
|
|
379
|
-
"onHoverOut",
|
|
380
|
-
"onHoverStart",
|
|
381
|
-
"onHoverEnd",
|
|
382
|
-
// Layout event
|
|
383
|
-
"onLayout",
|
|
384
|
-
// Accessibility
|
|
385
|
-
"accessible",
|
|
386
|
-
"accessibilityState",
|
|
387
|
-
"accessibilityLiveRegion",
|
|
388
|
-
"importantForAccessibility",
|
|
389
|
-
// Platform
|
|
390
|
-
"nativeID",
|
|
391
|
-
"collapsable",
|
|
392
|
-
"needsOffscreenAlphaCompositing",
|
|
393
|
-
"renderToHardwareTextureAndroid",
|
|
394
|
-
"shouldRasterizeIOS",
|
|
395
|
-
"focusable",
|
|
396
|
-
"hasTVPreferredFocus",
|
|
397
|
-
// 'pointerEvents' is handled in transformToWebProps (mapped to CSS style)
|
|
398
|
-
// Text
|
|
399
|
-
"selectable",
|
|
400
|
-
"allowFontScaling",
|
|
401
|
-
"adjustsFontSizeToFit",
|
|
402
|
-
"minimumFontScale",
|
|
403
|
-
"ellipsizeMode",
|
|
404
|
-
"numberOfLines",
|
|
405
|
-
"onTextLayout",
|
|
406
|
-
"textBreakStrategy",
|
|
407
|
-
"lineBreakStrategyIOS",
|
|
408
|
-
// TextInput
|
|
409
|
-
"multiline",
|
|
410
|
-
// NOTE: 'resizeMode' (Image's prop, not TextInput's) deliberately does NOT
|
|
411
|
-
// go here — it's handled below in the isImage branch (mapped to CSS
|
|
412
|
-
// object-fit). Blacklisting it here would make that branch unreachable.
|
|
413
|
-
"blurOnSubmit",
|
|
414
|
-
"clearButtonMode",
|
|
415
|
-
"clearTextOnFocus",
|
|
416
|
-
"enablesReturnKeyAutomatically",
|
|
417
|
-
"returnKeyType",
|
|
418
|
-
"spellCheck",
|
|
419
|
-
// ScrollView
|
|
420
|
-
"scrollEnabled",
|
|
421
|
-
"showsVerticalScrollIndicator",
|
|
422
|
-
"showsHorizontalScrollIndicator",
|
|
423
|
-
"contentContainerStyle",
|
|
424
|
-
// 'horizontal' is handled in transformToWebProps (converted to CSS overflow-x).
|
|
425
|
-
"keyboardShouldPersistTaps",
|
|
426
|
-
"keyboardDismissMode",
|
|
427
|
-
"pagingEnabled",
|
|
428
|
-
"scrollEventThrottle",
|
|
429
|
-
"decelerationRate",
|
|
430
|
-
"bounces",
|
|
431
|
-
"alwaysBounceHorizontal",
|
|
432
|
-
"alwaysBounceVertical",
|
|
433
|
-
"snapToAlignment",
|
|
434
|
-
"snapToInterval",
|
|
435
|
-
"snapToOffsets",
|
|
436
|
-
"removeClippedSubviews",
|
|
437
|
-
"overScrollMode",
|
|
438
|
-
"stickyHeaderIndices",
|
|
439
|
-
"invertStickyHeaders",
|
|
440
|
-
"onScrollBeginDrag",
|
|
441
|
-
"onScrollEndDrag",
|
|
442
|
-
"onMomentumScrollBegin",
|
|
443
|
-
"onMomentumScrollEnd",
|
|
444
|
-
"contentInset",
|
|
445
|
-
"contentInsetAdjustmentBehavior",
|
|
446
|
-
"automaticallyAdjustContentInsets",
|
|
447
|
-
"automaticallyAdjustsScrollIndicatorInsets",
|
|
448
|
-
// expo-image
|
|
449
|
-
"contentPosition",
|
|
450
|
-
"cachePolicy",
|
|
451
|
-
"recyclingKey",
|
|
452
|
-
"blurRadius",
|
|
453
|
-
"fadeDuration",
|
|
454
|
-
"responsivePolicy",
|
|
455
|
-
"tintColor",
|
|
456
|
-
"allowDownscaling",
|
|
457
|
-
"placeholderContentFit",
|
|
458
|
-
// FlatList / SectionList
|
|
459
|
-
"data",
|
|
460
|
-
"renderItem",
|
|
461
|
-
"keyExtractor",
|
|
462
|
-
"getItemLayout",
|
|
463
|
-
"initialScrollIndex",
|
|
464
|
-
"initialNumToRender",
|
|
465
|
-
"maxToRenderPerBatch",
|
|
466
|
-
"windowSize",
|
|
467
|
-
"updateCellsBatchingPeriod",
|
|
468
|
-
"onEndReached",
|
|
469
|
-
"onEndReachedThreshold",
|
|
470
|
-
"ListHeaderComponent",
|
|
471
|
-
"ListFooterComponent",
|
|
472
|
-
"ListEmptyComponent",
|
|
473
|
-
"ListHeaderComponentStyle",
|
|
474
|
-
"ListFooterComponentStyle",
|
|
475
|
-
"ItemSeparatorComponent",
|
|
476
|
-
"SectionSeparatorComponent",
|
|
477
|
-
"inverted",
|
|
478
|
-
"getItem",
|
|
479
|
-
"getItemCount"
|
|
480
|
-
]);
|
|
481
|
-
var _pressableNames = /* @__PURE__ */ new Set([
|
|
482
|
-
"Pressable",
|
|
483
|
-
"TouchableOpacity",
|
|
484
|
-
"TouchableHighlight",
|
|
485
|
-
"TouchableWithoutFeedback",
|
|
486
|
-
"TouchableNativeFeedback"
|
|
487
|
-
]);
|
|
488
|
-
var _keyboardTypeMap = {
|
|
489
|
-
"numeric": "number",
|
|
490
|
-
"number-pad": "number",
|
|
491
|
-
"decimal-pad": "decimal",
|
|
492
|
-
"email-address": "email",
|
|
493
|
-
"phone-pad": "tel",
|
|
494
|
-
"url": "url"
|
|
495
|
-
};
|
|
496
|
-
var _resizeModeMap = {
|
|
497
|
-
"contain": "contain",
|
|
498
|
-
"cover": "cover",
|
|
499
|
-
"stretch": "fill",
|
|
500
|
-
"center": "none",
|
|
501
|
-
"repeat": "none"
|
|
502
|
-
};
|
|
503
|
-
var PLACEHOLDER_RULE_ATTR = "data-kbach-ph";
|
|
504
|
-
var _placeholderRuleInjected = false;
|
|
505
|
-
function ensurePlaceholderColorRuleInjected() {
|
|
506
|
-
if (_placeholderRuleInjected || typeof document === "undefined") return;
|
|
507
|
-
_placeholderRuleInjected = true;
|
|
508
|
-
const style = document.createElement("style");
|
|
509
|
-
style.setAttribute("data-kbach-placeholder", "");
|
|
510
|
-
style.textContent = `[${PLACEHOLDER_RULE_ATTR}]::placeholder{color:var(--kbach-ph-color)}`;
|
|
511
|
-
document.head.appendChild(style);
|
|
482
|
+
var resetChecked = false;
|
|
483
|
+
function ensureResetInjected() {
|
|
484
|
+
if (resetChecked) return;
|
|
485
|
+
resetChecked = true;
|
|
486
|
+
if (document.getElementById(RESET_STYLE_ID)) return;
|
|
487
|
+
const el = document.createElement("style");
|
|
488
|
+
el.id = RESET_STYLE_ID;
|
|
489
|
+
el.textContent = BASE_RESET;
|
|
490
|
+
document.head.insertBefore(el, document.head.firstChild);
|
|
512
491
|
}
|
|
513
|
-
function
|
|
514
|
-
const
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
for (const [k, v] of Object.entries(props)) {
|
|
521
|
-
if (_rnOnlyProps.has(k)) continue;
|
|
522
|
-
if (k === "onPress") {
|
|
523
|
-
if (!("onClick" in props)) out.onClick = v;
|
|
524
|
-
continue;
|
|
525
|
-
}
|
|
526
|
-
if (k === "accessibilityLabel") {
|
|
527
|
-
if (out["aria-label"] == null) out["aria-label"] = v;
|
|
528
|
-
continue;
|
|
529
|
-
}
|
|
530
|
-
if (k === "accessibilityRole") {
|
|
531
|
-
if (out.role == null) out.role = v;
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
if (k === "testID") {
|
|
535
|
-
if (out["data-testid"] == null) out["data-testid"] = v;
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
538
|
-
if (isTextInput) {
|
|
539
|
-
if (k === "onChangeText") {
|
|
540
|
-
if (!("onChange" in props)) out.onChange = (e) => v(e.target.value);
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
if (k === "onSubmitEditing") {
|
|
544
|
-
if (!("onKeyDown" in props)) {
|
|
545
|
-
out.onKeyDown = (e) => {
|
|
546
|
-
if (e.key === "Enter") v();
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
continue;
|
|
550
|
-
}
|
|
551
|
-
if (k === "placeholderTextColor") {
|
|
552
|
-
if (v) {
|
|
553
|
-
ensurePlaceholderColorRuleInjected();
|
|
554
|
-
out[PLACEHOLDER_RULE_ATTR] = "";
|
|
555
|
-
pendingStyle = { ...pendingStyle ?? {}, "--kbach-ph-color": v };
|
|
556
|
-
}
|
|
557
|
-
continue;
|
|
558
|
-
}
|
|
559
|
-
if (k === "secureTextEntry") {
|
|
560
|
-
if (v && !("type" in props)) out.type = "password";
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
if (k === "keyboardType") {
|
|
564
|
-
if (!("type" in props) && !props.secureTextEntry) {
|
|
565
|
-
const mapped = _keyboardTypeMap[v];
|
|
566
|
-
if (mapped) out.type = mapped;
|
|
567
|
-
}
|
|
568
|
-
continue;
|
|
569
|
-
}
|
|
570
|
-
if (k === "editable") {
|
|
571
|
-
if (v === false) out.readOnly = true;
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
if (k === "maxLength") {
|
|
575
|
-
out.maxLength = v;
|
|
576
|
-
continue;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
if (isScrollable && k === "horizontal") {
|
|
580
|
-
if (v) pendingStyle = { ...pendingStyle ?? {}, display: "flex", flexDirection: "row", overflowX: "auto" };
|
|
581
|
-
continue;
|
|
492
|
+
function kb(classString) {
|
|
493
|
+
const json = generateCss(classString, getThemeJson());
|
|
494
|
+
const { className, rules } = JSON.parse(json);
|
|
495
|
+
if (!runtimeCSSDisabled) {
|
|
496
|
+
ensureResetInjected();
|
|
497
|
+
for (const { rule, order } of rules) {
|
|
498
|
+
injectRule(rule, order);
|
|
582
499
|
}
|
|
583
|
-
if (k === "pointerEvents") {
|
|
584
|
-
if (v === "none" || v === "auto") pendingStyle = { ...pendingStyle ?? {}, pointerEvents: v };
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
if (isImage) {
|
|
588
|
-
if (k === "source") {
|
|
589
|
-
if (typeof v === "string") {
|
|
590
|
-
out.src = v;
|
|
591
|
-
} else if (v && typeof v === "object" && "uri" in v) {
|
|
592
|
-
out.src = v.uri;
|
|
593
|
-
if (v.headers) out["crossOrigin"] = "anonymous";
|
|
594
|
-
}
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
if (k === "resizeMode") {
|
|
598
|
-
pendingStyle = { ...pendingStyle ?? {}, objectFit: _resizeModeMap[v] ?? "cover" };
|
|
599
|
-
continue;
|
|
600
|
-
}
|
|
601
|
-
if (k === "contentFit") {
|
|
602
|
-
pendingStyle = { ...pendingStyle ?? {}, objectFit: v };
|
|
603
|
-
continue;
|
|
604
|
-
}
|
|
605
|
-
if (k === "defaultSource") continue;
|
|
606
|
-
}
|
|
607
|
-
if (k === "style") {
|
|
608
|
-
if (Array.isArray(v)) {
|
|
609
|
-
out.style = Object.assign({}, ...v.filter(Boolean));
|
|
610
|
-
} else if (v != null) {
|
|
611
|
-
out.style = v;
|
|
612
|
-
}
|
|
613
|
-
continue;
|
|
614
|
-
}
|
|
615
|
-
out[k] = v;
|
|
616
|
-
}
|
|
617
|
-
if (pendingStyle) {
|
|
618
|
-
out.style = out.style ? { ...pendingStyle, ...out.style } : pendingStyle;
|
|
619
500
|
}
|
|
620
|
-
|
|
621
|
-
if (isImage && tag === "img" && out.alt == null) out.alt = "";
|
|
622
|
-
return out;
|
|
501
|
+
return className;
|
|
623
502
|
}
|
|
624
503
|
|
|
625
504
|
// src/jsx-runtime.tsx
|
|
626
|
-
var _cachedDefaultFont = void 0;
|
|
627
|
-
var _defaultFontVersion = 0;
|
|
628
|
-
var _lastFontVersion = -1;
|
|
629
|
-
function _invalidateDefaultFontCache() {
|
|
630
|
-
_defaultFontVersion++;
|
|
631
|
-
}
|
|
632
|
-
{
|
|
633
|
-
const _KEY = "__kbach_font_cache_unsub__";
|
|
634
|
-
const g = globalThis;
|
|
635
|
-
if (g[_KEY]) g[_KEY]();
|
|
636
|
-
g[_KEY] = (0, import_core6.onConfigChange)(_invalidateDefaultFontCache);
|
|
637
|
-
}
|
|
638
|
-
function getCachedDefaultFont() {
|
|
639
|
-
if (_lastFontVersion !== _defaultFontVersion) {
|
|
640
|
-
_cachedDefaultFont = (0, import_core6.getDefaultFontFamily)();
|
|
641
|
-
_lastFontVersion = _defaultFontVersion;
|
|
642
|
-
}
|
|
643
|
-
return _cachedDefaultFont;
|
|
644
|
-
}
|
|
645
|
-
var _bucketModsCache = /* @__PURE__ */ new WeakMap();
|
|
646
|
-
function bucketMods(resolved) {
|
|
647
|
-
const cached = _bucketModsCache.get(resolved);
|
|
648
|
-
if (cached) return cached;
|
|
649
|
-
const interactiveMods = (0, import_core6.getInteractiveModifiers)();
|
|
650
|
-
const modeMods = (0, import_core6.getModeModifiers)();
|
|
651
|
-
const responsiveMods = (0, import_core6.getResponsiveModifiers)();
|
|
652
|
-
let interactive = false;
|
|
653
|
-
let modeOrResponsive = false;
|
|
654
|
-
for (const key of Object.keys(resolved)) {
|
|
655
|
-
if (key === "base") continue;
|
|
656
|
-
for (const mod of key.split(":")) {
|
|
657
|
-
if (!interactive && interactiveMods.has(mod)) interactive = true;
|
|
658
|
-
if (!modeOrResponsive && (modeMods.has(mod) || responsiveMods.has(mod))) modeOrResponsive = true;
|
|
659
|
-
}
|
|
660
|
-
if (interactive && modeOrResponsive) break;
|
|
661
|
-
}
|
|
662
|
-
const result = { interactive, modeOrResponsive };
|
|
663
|
-
_bucketModsCache.set(resolved, result);
|
|
664
|
-
return result;
|
|
665
|
-
}
|
|
666
|
-
var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
|
|
667
|
-
function omitConsumed(props) {
|
|
668
|
-
const out = {};
|
|
669
|
-
for (const key of Object.keys(props)) {
|
|
670
|
-
if (!CONSUMED_PROPS.has(key)) out[key] = props[key];
|
|
671
|
-
}
|
|
672
|
-
return out;
|
|
673
|
-
}
|
|
674
505
|
function makeElement(isStaticChildren, type, props, key) {
|
|
675
506
|
return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
|
|
676
507
|
}
|
|
677
508
|
function processElement(type, rawProps, key, isStaticChildren) {
|
|
678
|
-
if (type === null || typeof type === "symbol"
|
|
679
|
-
|
|
680
|
-
const effectiveType = webTag ?? type;
|
|
681
|
-
const originalName = webTag ? type?.displayName ?? type?.name : void 0;
|
|
682
|
-
if (!rawProps) return (0, import_jsx_runtime.jsx)(effectiveType, null, key);
|
|
683
|
-
const workingProps = webTag && originalName ? transformToWebProps(originalName, webTag, rawProps) : rawProps;
|
|
684
|
-
const { className, kb: kbProp, __kbachStyles, __kbachClasses } = workingProps;
|
|
685
|
-
const classStrRaw = className ?? kbProp ?? __kbachClasses;
|
|
686
|
-
if (classStrRaw !== void 0 && typeof classStrRaw !== "string") {
|
|
687
|
-
return makeElement(isStaticChildren, effectiveType, workingProps, key);
|
|
688
|
-
}
|
|
689
|
-
const classStr = classStrRaw;
|
|
690
|
-
const config = (0, import_core6.getConfig)();
|
|
691
|
-
let expandedClassStr = classStr ? (0, import_core6.expandModeAwareColorClasses)(classStr, config.theme.colors) : classStr;
|
|
692
|
-
if (!import_core6.isNative && (0, import_core6.isRuntimeCSSDisabled)() && expandedClassStr && !__kbachStyles) {
|
|
693
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
694
|
-
return makeElement(isStaticChildren, effectiveType, {
|
|
695
|
-
...passProps2,
|
|
696
|
-
className: (0, import_core6.normalizeClassString)(expandedClassStr),
|
|
697
|
-
...userStyle2 !== void 0 ? { style: userStyle2 } : {}
|
|
698
|
-
}, key);
|
|
699
|
-
}
|
|
700
|
-
if (classStr && !__kbachStyles && /^(__[A-Za-z0-9_]+\s*)+$/.test(classStr.trim())) {
|
|
701
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
702
|
-
return makeElement(isStaticChildren, effectiveType, {
|
|
703
|
-
...passProps2,
|
|
704
|
-
className: classStr,
|
|
705
|
-
...userStyle2 !== void 0 ? { style: userStyle2 } : {}
|
|
706
|
-
}, key);
|
|
707
|
-
}
|
|
708
|
-
if (!classStr && !__kbachStyles) {
|
|
709
|
-
if ((0, import_core6.getEffectiveIsWeb)()) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
|
|
710
|
-
const defaultFont = getCachedDefaultFont();
|
|
711
|
-
if (!defaultFont || getWebTag(type) !== "span") {
|
|
712
|
-
return makeElement(isStaticChildren, effectiveType, workingProps, key);
|
|
713
|
-
}
|
|
714
|
-
const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
|
|
715
|
-
const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
|
|
716
|
-
return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
|
|
717
|
-
}
|
|
718
|
-
let resolved = import_core6.isNative && __kbachStyles != null ? __kbachStyles : expandedClassStr ? (0, import_core6.resolve)(expandedClassStr, config.theme, config.darkMode) : {};
|
|
719
|
-
const impliedClasses = getImpliedRNClasses(webTag, resolved.base);
|
|
720
|
-
if (impliedClasses) {
|
|
721
|
-
expandedClassStr = expandedClassStr ? `${expandedClassStr} ${impliedClasses}` : impliedClasses;
|
|
722
|
-
resolved = (0, import_core6.resolve)(expandedClassStr, config.theme, config.darkMode);
|
|
723
|
-
}
|
|
724
|
-
const { style: userStyle, ...passProps } = omitConsumed(workingProps);
|
|
725
|
-
const { interactive, modeOrResponsive } = bucketMods(resolved);
|
|
726
|
-
if (interactive) {
|
|
727
|
-
return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
|
|
728
|
-
Component: effectiveType,
|
|
729
|
-
resolvedStyle: resolved,
|
|
730
|
-
...!import_core6.isNative && expandedClassStr ? { className: (0, import_core6.normalizeClassString)(expandedClassStr) } : {},
|
|
731
|
-
style: userStyle,
|
|
732
|
-
...passProps
|
|
733
|
-
}, key);
|
|
734
|
-
}
|
|
735
|
-
if (modeOrResponsive) {
|
|
736
|
-
return (0, import_jsx_runtime.jsx)(DarkWrapper, {
|
|
737
|
-
Component: effectiveType,
|
|
738
|
-
resolvedStyle: resolved,
|
|
739
|
-
...!import_core6.isNative && expandedClassStr ? { className: (0, import_core6.normalizeClassString)(expandedClassStr) } : {},
|
|
740
|
-
style: userStyle,
|
|
741
|
-
...passProps
|
|
742
|
-
}, key);
|
|
509
|
+
if (type === null || typeof type === "symbol" || !rawProps) {
|
|
510
|
+
return makeElement(isStaticChildren, type, rawProps ?? {}, key);
|
|
743
511
|
}
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
const computedStyle = (0, import_core6.flatten)(resolved, false);
|
|
748
|
-
stripInternalMarkers(computedStyle);
|
|
749
|
-
if (typeof effectiveType !== "string") stripWebOnlyProps(computedStyle);
|
|
750
|
-
finalStyle = composeNativeStyle(computedStyle, userStyle);
|
|
751
|
-
} else {
|
|
752
|
-
finalStyle = userStyle ?? void 0;
|
|
512
|
+
const { className: classStrRaw, ...rest } = rawProps;
|
|
513
|
+
if (typeof classStrRaw !== "string") {
|
|
514
|
+
return makeElement(isStaticChildren, type, rawProps, key);
|
|
753
515
|
}
|
|
754
|
-
return makeElement(isStaticChildren,
|
|
755
|
-
...passProps,
|
|
756
|
-
...finalStyle !== void 0 ? { style: finalStyle } : {},
|
|
757
|
-
...!import_core6.isNative && expandedClassStr ? { className: (0, import_core6.normalizeClassString)(expandedClassStr) } : {}
|
|
758
|
-
}, key);
|
|
516
|
+
return makeElement(isStaticChildren, type, { ...rest, className: kb(classStrRaw) }, key);
|
|
759
517
|
}
|
|
760
518
|
function jsx(type, props, key) {
|
|
761
519
|
return processElement(type, props, key, false);
|