react-native-better-html 1.0.2 → 1.0.3
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/dist/index.d.mts +285 -0
- package/dist/index.d.ts +285 -0
- package/dist/index.js +1099 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1063 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,1099 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
Animate: () => Animate_default,
|
|
34
|
+
BetterComponentsProvider: () => BetterComponentsProvider_default,
|
|
35
|
+
Button: () => Button_default,
|
|
36
|
+
Loader: () => Loader_default,
|
|
37
|
+
ScreenHolder: () => ScreenHolder_default,
|
|
38
|
+
Text: () => Text_default,
|
|
39
|
+
View: () => View_default,
|
|
40
|
+
asyncStoragePlugin: () => asyncStoragePlugin,
|
|
41
|
+
colorThemeControls: () => import_react_better_core8.colorThemeControls,
|
|
42
|
+
countries: () => import_react_better_core8.countries,
|
|
43
|
+
darkenColor: () => import_react_better_core8.darkenColor,
|
|
44
|
+
defaultAsyncStoragePluginOptions: () => defaultAsyncStoragePluginOptions,
|
|
45
|
+
desaturateColor: () => import_react_better_core8.desaturateColor,
|
|
46
|
+
eventPreventDefault: () => import_react_better_core8.eventPreventDefault,
|
|
47
|
+
eventPreventStop: () => import_react_better_core8.eventPreventStop,
|
|
48
|
+
eventStopPropagation: () => import_react_better_core8.eventStopPropagation,
|
|
49
|
+
formatPhoneNumber: () => import_react_better_core8.formatPhoneNumber,
|
|
50
|
+
generateAsyncStorage: () => generateAsyncStorage,
|
|
51
|
+
generateRandomString: () => import_react_better_core8.generateRandomString,
|
|
52
|
+
getPluralWord: () => import_react_better_core8.getPluralWord,
|
|
53
|
+
lightenColor: () => import_react_better_core8.lightenColor,
|
|
54
|
+
loaderControls: () => import_react_better_core8.loaderControls,
|
|
55
|
+
pressStrength: () => pressStrength,
|
|
56
|
+
saturateColor: () => import_react_better_core8.saturateColor,
|
|
57
|
+
useBetterComponentsContext: () => useBetterComponentsContext,
|
|
58
|
+
useBooleanState: () => import_react_better_core8.useBooleanState,
|
|
59
|
+
useDebounceState: () => import_react_better_core8.useDebounceState,
|
|
60
|
+
useDevice: () => useDevice,
|
|
61
|
+
useLoader: () => import_react_better_core8.useLoader,
|
|
62
|
+
useLoaderControls: () => import_react_better_core8.useLoaderControls,
|
|
63
|
+
useTheme: () => import_react_better_core8.useTheme
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(index_exports);
|
|
66
|
+
var import_react_better_core8 = require("react-better-core");
|
|
67
|
+
|
|
68
|
+
// src/components/BetterComponentsProvider.tsx
|
|
69
|
+
var import_react = require("react");
|
|
70
|
+
var import_react_better_core = require("react-better-core");
|
|
71
|
+
|
|
72
|
+
// src/constants/app.ts
|
|
73
|
+
var appConfig = {};
|
|
74
|
+
|
|
75
|
+
// src/constants/theme.ts
|
|
76
|
+
var theme = {};
|
|
77
|
+
|
|
78
|
+
// src/constants/icons.ts
|
|
79
|
+
var icons = {};
|
|
80
|
+
|
|
81
|
+
// src/constants/assets.ts
|
|
82
|
+
var assets = {};
|
|
83
|
+
|
|
84
|
+
// src/components/BetterComponentsProvider.tsx
|
|
85
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
86
|
+
var betterComponentsContext = (0, import_react.createContext)(void 0);
|
|
87
|
+
var externalBetterCoreContextValue;
|
|
88
|
+
var externalBetterComponentsContextValue;
|
|
89
|
+
var useBetterComponentsContext = () => {
|
|
90
|
+
const coreContext = (0, import_react_better_core.useBetterCoreContext)();
|
|
91
|
+
const context = (0, import_react.useContext)(betterComponentsContext);
|
|
92
|
+
if (context === void 0)
|
|
93
|
+
throw new Error(
|
|
94
|
+
"`useBetterComponentsContext()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
95
|
+
);
|
|
96
|
+
const { plugins, componentsState, ...rest } = context;
|
|
97
|
+
return {
|
|
98
|
+
...coreContext,
|
|
99
|
+
...rest
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
function BetterComponentsProviderInternalContent({ children }) {
|
|
103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
104
|
+
}
|
|
105
|
+
function BetterComponentsProviderInternal({
|
|
106
|
+
config,
|
|
107
|
+
plugins,
|
|
108
|
+
children
|
|
109
|
+
}) {
|
|
110
|
+
const betterCoreContext = (0, import_react_better_core.useBetterCoreContext)();
|
|
111
|
+
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = (0, import_react_better_core.useBooleanState)();
|
|
112
|
+
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = (0, import_react_better_core.useBooleanState)();
|
|
113
|
+
const readyConfig = (0, import_react.useMemo)(
|
|
114
|
+
() => ({
|
|
115
|
+
app: {
|
|
116
|
+
...appConfig,
|
|
117
|
+
...config?.app
|
|
118
|
+
},
|
|
119
|
+
sideMenuIsCollapsed,
|
|
120
|
+
setSideMenuIsCollapsed,
|
|
121
|
+
sideMenuIsOpenMobile,
|
|
122
|
+
setSideMenuIsOpenMobile,
|
|
123
|
+
plugins: plugins ?? [],
|
|
124
|
+
componentsState: {}
|
|
125
|
+
}),
|
|
126
|
+
[config, sideMenuIsCollapsed, sideMenuIsOpenMobile, plugins]
|
|
127
|
+
);
|
|
128
|
+
(0, import_react.useEffect)(() => {
|
|
129
|
+
if (!plugins) return;
|
|
130
|
+
plugins.forEach((plugin) => {
|
|
131
|
+
plugin.initialize?.();
|
|
132
|
+
});
|
|
133
|
+
}, []);
|
|
134
|
+
externalBetterCoreContextValue = betterCoreContext;
|
|
135
|
+
externalBetterComponentsContextValue = readyConfig;
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(betterComponentsContext.Provider, { value: readyConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BetterComponentsProviderInternalContent, { children }) });
|
|
137
|
+
}
|
|
138
|
+
function BetterComponentsProvider({ config, ...props }) {
|
|
139
|
+
const coreConfig = (0, import_react.useMemo)(
|
|
140
|
+
() => ({
|
|
141
|
+
theme: {
|
|
142
|
+
...theme,
|
|
143
|
+
...config?.theme
|
|
144
|
+
},
|
|
145
|
+
// colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
146
|
+
colorTheme: config?.colorTheme ?? "light",
|
|
147
|
+
icons: {
|
|
148
|
+
...icons,
|
|
149
|
+
...config?.icons
|
|
150
|
+
},
|
|
151
|
+
assets: {
|
|
152
|
+
...assets,
|
|
153
|
+
...config?.assets
|
|
154
|
+
},
|
|
155
|
+
loaders: config?.loaders
|
|
156
|
+
}),
|
|
157
|
+
[config]
|
|
158
|
+
);
|
|
159
|
+
const componentsConfig = (0, import_react.useMemo)(
|
|
160
|
+
() => ({
|
|
161
|
+
app: config?.app
|
|
162
|
+
}),
|
|
163
|
+
[config]
|
|
164
|
+
);
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_better_core.BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BetterComponentsProviderInternal, { config: componentsConfig, ...props }) });
|
|
166
|
+
}
|
|
167
|
+
var BetterComponentsProvider_default = (0, import_react.memo)(BetterComponentsProvider);
|
|
168
|
+
|
|
169
|
+
// src/utils/variableFunctions.ts
|
|
170
|
+
var checkBetterCoreContextValue = (value, functionsName) => {
|
|
171
|
+
if (value === void 0) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`\`${functionsName}()\` must be used within a \`<BetterCoreProvider>\`. Make sure to add one at the root of your component tree.`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return value !== void 0;
|
|
177
|
+
};
|
|
178
|
+
var pressStrength = () => {
|
|
179
|
+
if (!checkBetterCoreContextValue(externalBetterCoreContextValue, "pressStrength")) return void 0;
|
|
180
|
+
return {
|
|
181
|
+
z05: externalBetterCoreContextValue.colorTheme === "dark" ? 0.85 : 0.95,
|
|
182
|
+
z1: externalBetterCoreContextValue.colorTheme === "dark" ? 0.6 : 0.8,
|
|
183
|
+
z2: externalBetterCoreContextValue.colorTheme === "dark" ? 0.5 : 0.7,
|
|
184
|
+
z3: externalBetterCoreContextValue.colorTheme === "dark" ? 0.4 : 0.6
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// src/utils/hooks.ts
|
|
189
|
+
var import_react2 = require("react");
|
|
190
|
+
var import_react_native = require("react-native");
|
|
191
|
+
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
192
|
+
var import_react_better_core2 = require("react-better-core");
|
|
193
|
+
|
|
194
|
+
// src/constants/css.ts
|
|
195
|
+
var cssProps = /* @__PURE__ */ new Set([
|
|
196
|
+
"aligncontent",
|
|
197
|
+
"alignitems",
|
|
198
|
+
"alignself",
|
|
199
|
+
"aspectratio",
|
|
200
|
+
"borderbottomwidth",
|
|
201
|
+
"borderendwidth",
|
|
202
|
+
"borderleftwidth",
|
|
203
|
+
"borderrightwidth",
|
|
204
|
+
"borderstartwidth",
|
|
205
|
+
"bordertopwidth",
|
|
206
|
+
"borderwidth",
|
|
207
|
+
"bottom",
|
|
208
|
+
"boxsizing",
|
|
209
|
+
"display",
|
|
210
|
+
"end",
|
|
211
|
+
"flex",
|
|
212
|
+
"flexbasis",
|
|
213
|
+
"flexdirection",
|
|
214
|
+
"rowgap",
|
|
215
|
+
"gap",
|
|
216
|
+
"columngap",
|
|
217
|
+
"flexgrow",
|
|
218
|
+
"flexshrink",
|
|
219
|
+
"flexwrap",
|
|
220
|
+
"height",
|
|
221
|
+
"justifycontent",
|
|
222
|
+
"left",
|
|
223
|
+
"margin",
|
|
224
|
+
"marginbottom",
|
|
225
|
+
"marginend",
|
|
226
|
+
"marginhorizontal",
|
|
227
|
+
"marginleft",
|
|
228
|
+
"marginright",
|
|
229
|
+
"marginstart",
|
|
230
|
+
"margintop",
|
|
231
|
+
"marginvertical",
|
|
232
|
+
"maxheight",
|
|
233
|
+
"maxwidth",
|
|
234
|
+
"minheight",
|
|
235
|
+
"minwidth",
|
|
236
|
+
"overflow",
|
|
237
|
+
"padding",
|
|
238
|
+
"paddingbottom",
|
|
239
|
+
"paddingend",
|
|
240
|
+
"paddinghorizontal",
|
|
241
|
+
"paddingleft",
|
|
242
|
+
"paddingright",
|
|
243
|
+
"paddingstart",
|
|
244
|
+
"paddingtop",
|
|
245
|
+
"paddingvertical",
|
|
246
|
+
"position",
|
|
247
|
+
"right",
|
|
248
|
+
"start",
|
|
249
|
+
"top",
|
|
250
|
+
"width",
|
|
251
|
+
"zindex",
|
|
252
|
+
"direction",
|
|
253
|
+
"inset",
|
|
254
|
+
"insetblock",
|
|
255
|
+
"insetblockend",
|
|
256
|
+
"insetblockstart",
|
|
257
|
+
"insetinline",
|
|
258
|
+
"insetinlineend",
|
|
259
|
+
"insetinlinestart",
|
|
260
|
+
"marginblock",
|
|
261
|
+
"marginblockend",
|
|
262
|
+
"marginblockstart",
|
|
263
|
+
"margininline",
|
|
264
|
+
"margininlineend",
|
|
265
|
+
"margininlinestart",
|
|
266
|
+
"paddingblock",
|
|
267
|
+
"paddingblockend",
|
|
268
|
+
"paddingblockstart",
|
|
269
|
+
"paddinginline",
|
|
270
|
+
"paddinginlineend",
|
|
271
|
+
"paddinginlinestart",
|
|
272
|
+
"shadowcolor",
|
|
273
|
+
"shadowoffset",
|
|
274
|
+
"shadowopacity",
|
|
275
|
+
"shadowradius",
|
|
276
|
+
"transform",
|
|
277
|
+
"transformorigin",
|
|
278
|
+
"transformmatrix",
|
|
279
|
+
"rotation",
|
|
280
|
+
"scalex",
|
|
281
|
+
"scaley",
|
|
282
|
+
"translatex",
|
|
283
|
+
"translatey",
|
|
284
|
+
"backfacevisibility",
|
|
285
|
+
"backgroundcolor",
|
|
286
|
+
"borderblockcolor",
|
|
287
|
+
"borderblockendcolor",
|
|
288
|
+
"borderblockstartcolor",
|
|
289
|
+
"borderbottomcolor",
|
|
290
|
+
"borderbottomendradius",
|
|
291
|
+
"borderbottomleftradius",
|
|
292
|
+
"borderbottomrightradius",
|
|
293
|
+
"borderbottomstartradius",
|
|
294
|
+
"bordercolor",
|
|
295
|
+
"bordercurve",
|
|
296
|
+
"borderendcolor",
|
|
297
|
+
"borderendendradius",
|
|
298
|
+
"borderendstartradius",
|
|
299
|
+
"borderleftcolor",
|
|
300
|
+
"borderradius",
|
|
301
|
+
"borderrightcolor",
|
|
302
|
+
"borderstartcolor",
|
|
303
|
+
"borderstartendradius",
|
|
304
|
+
"borderstartstartradius",
|
|
305
|
+
"borderstyle",
|
|
306
|
+
"bordertopcolor",
|
|
307
|
+
"bordertopendradius",
|
|
308
|
+
"bordertopleftradius",
|
|
309
|
+
"bordertoprightradius",
|
|
310
|
+
"bordertopstartradius",
|
|
311
|
+
"outlinecolor",
|
|
312
|
+
"outlineoffset",
|
|
313
|
+
"outlinestyle",
|
|
314
|
+
"outlinewidth",
|
|
315
|
+
"opacity",
|
|
316
|
+
"elevation",
|
|
317
|
+
"pointerevents",
|
|
318
|
+
"isolation",
|
|
319
|
+
"cursor",
|
|
320
|
+
"boxshadow",
|
|
321
|
+
"filter",
|
|
322
|
+
"mixblendmode",
|
|
323
|
+
"fontvariant",
|
|
324
|
+
"textdecorationcolor",
|
|
325
|
+
"textdecorationstyle",
|
|
326
|
+
"writingdirection",
|
|
327
|
+
"textalignvertical",
|
|
328
|
+
"verticalalign",
|
|
329
|
+
"includefontpadding",
|
|
330
|
+
"color",
|
|
331
|
+
"fontfamily",
|
|
332
|
+
"fontsize",
|
|
333
|
+
"fontstyle",
|
|
334
|
+
"fontweight",
|
|
335
|
+
"letterspacing",
|
|
336
|
+
"lineheight",
|
|
337
|
+
"textalign",
|
|
338
|
+
"textdecorationline",
|
|
339
|
+
"textdecorationstyle",
|
|
340
|
+
"textdecorationcolor",
|
|
341
|
+
"textshadowcolor",
|
|
342
|
+
"textshadowoffset",
|
|
343
|
+
"textshadowradius",
|
|
344
|
+
"texttransform",
|
|
345
|
+
"userselect"
|
|
346
|
+
]);
|
|
347
|
+
var animateProps = /* @__PURE__ */ new Set([
|
|
348
|
+
"x",
|
|
349
|
+
"y",
|
|
350
|
+
"scale",
|
|
351
|
+
"scaleX",
|
|
352
|
+
"scaleY",
|
|
353
|
+
"skewX",
|
|
354
|
+
"skewY",
|
|
355
|
+
"perspective",
|
|
356
|
+
"rotate",
|
|
357
|
+
"rotateX",
|
|
358
|
+
"rotateY",
|
|
359
|
+
"rotateZ",
|
|
360
|
+
"matrix"
|
|
361
|
+
]);
|
|
362
|
+
var animateTransitionProps = /* @__PURE__ */ new Set([
|
|
363
|
+
"type",
|
|
364
|
+
"ease",
|
|
365
|
+
"easing",
|
|
366
|
+
"duration",
|
|
367
|
+
"delay",
|
|
368
|
+
"type",
|
|
369
|
+
"friction",
|
|
370
|
+
"tension",
|
|
371
|
+
"speed",
|
|
372
|
+
"bounciness",
|
|
373
|
+
"stiffness",
|
|
374
|
+
"damping",
|
|
375
|
+
"mass",
|
|
376
|
+
"overshootClamping",
|
|
377
|
+
"restDisplacementThreshold",
|
|
378
|
+
"restSpeedThreshold",
|
|
379
|
+
"velocity",
|
|
380
|
+
"loop"
|
|
381
|
+
]);
|
|
382
|
+
|
|
383
|
+
// src/utils/hooks.ts
|
|
384
|
+
function useDevice() {
|
|
385
|
+
const theme2 = (0, import_react_better_core2.useTheme)();
|
|
386
|
+
const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
387
|
+
const screenDimensions = import_react_native.Dimensions.get("screen");
|
|
388
|
+
const windowDimensions = import_react_native.Dimensions.get("window");
|
|
389
|
+
const isSmallDevice = windowDimensions.height <= 700;
|
|
390
|
+
return {
|
|
391
|
+
safeArea: {
|
|
392
|
+
...safeAreaInsets,
|
|
393
|
+
/** @description The safe area insets after calculations. Recommended to use this instead of the raw insets. */
|
|
394
|
+
afterCalculations: {
|
|
395
|
+
top: safeAreaInsets.top < 25 ? 32 : safeAreaInsets.top < 40 ? 40 : safeAreaInsets.top,
|
|
396
|
+
bottom: (safeAreaInsets.bottom === 0 ? theme2.styles.space : safeAreaInsets.bottom) + (isSmallDevice ? 0 : theme2.styles.space * 2),
|
|
397
|
+
left: safeAreaInsets.left,
|
|
398
|
+
right: safeAreaInsets.right
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
/** @description The dimensions of the device screen. */
|
|
402
|
+
screenDimensions,
|
|
403
|
+
/** @description The dimensions of the app window. */
|
|
404
|
+
windowDimensions,
|
|
405
|
+
/** @description Whether the device is small. */
|
|
406
|
+
isSmallDevice
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function useComponentPropsGrouper(props, prefix) {
|
|
410
|
+
return (0, import_react2.useMemo)(() => {
|
|
411
|
+
const style = {};
|
|
412
|
+
const withPrefixStyle = {};
|
|
413
|
+
const restProps = {};
|
|
414
|
+
for (const key in props) {
|
|
415
|
+
const keyName = key;
|
|
416
|
+
if (cssProps.has(keyName.toLowerCase())) {
|
|
417
|
+
style[keyName] = props[keyName];
|
|
418
|
+
} else if (keyName.startsWith(prefix) && (cssProps.has(keyName.slice(prefix.length).toLowerCase()) || animateProps.has(keyName.slice(prefix.length).toLowerCase()) || animateTransitionProps.has(keyName.slice(prefix.length).toLowerCase()))) {
|
|
419
|
+
const realKey = `${keyName.slice(prefix.length, prefix.length + 1).toLowerCase()}${keyName.slice(
|
|
420
|
+
prefix.length + 1
|
|
421
|
+
)}`;
|
|
422
|
+
withPrefixStyle[realKey] = props[keyName];
|
|
423
|
+
} else {
|
|
424
|
+
restProps[keyName] = props[keyName];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
style,
|
|
429
|
+
withPrefixStyle,
|
|
430
|
+
restProps
|
|
431
|
+
};
|
|
432
|
+
}, [props, prefix]);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/utils/asyncStorage.ts
|
|
436
|
+
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
437
|
+
function generateAsyncStorage() {
|
|
438
|
+
return {
|
|
439
|
+
setItem: async (name, value) => {
|
|
440
|
+
if (value) await import_async_storage.default.setItem(name.toString(), JSON.stringify(value));
|
|
441
|
+
else await import_async_storage.default.removeItem(name.toString());
|
|
442
|
+
},
|
|
443
|
+
getItem: async (name) => {
|
|
444
|
+
const item = await import_async_storage.default.getItem(name.toString());
|
|
445
|
+
if (item === null) return void 0;
|
|
446
|
+
try {
|
|
447
|
+
return JSON.parse(item);
|
|
448
|
+
} catch (error) {
|
|
449
|
+
return void 0;
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
removeItem: async (name) => {
|
|
453
|
+
await import_async_storage.default.removeItem(name.toString());
|
|
454
|
+
},
|
|
455
|
+
removeAllItems: () => {
|
|
456
|
+
import_async_storage.default.clear();
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// src/components/View.tsx
|
|
462
|
+
var import_react3 = require("react");
|
|
463
|
+
var import_react_native2 = require("react-native");
|
|
464
|
+
var import_react_better_core3 = require("react-better-core");
|
|
465
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
466
|
+
var touchableHighlightStyleMoveToContent = [
|
|
467
|
+
"backgroundColor",
|
|
468
|
+
"padding",
|
|
469
|
+
"paddingTop",
|
|
470
|
+
"paddingBottom",
|
|
471
|
+
"paddingLeft",
|
|
472
|
+
"paddingRight",
|
|
473
|
+
"paddingHorizontal",
|
|
474
|
+
"paddingVertical",
|
|
475
|
+
"borderWidth",
|
|
476
|
+
"borderTopWidth",
|
|
477
|
+
"borderBottomWidth",
|
|
478
|
+
"borderLeftWidth",
|
|
479
|
+
"borderRightWidth",
|
|
480
|
+
"borderColor",
|
|
481
|
+
"borderTopColor",
|
|
482
|
+
"borderBottomColor",
|
|
483
|
+
"borderLeftColor",
|
|
484
|
+
"borderRightColor"
|
|
485
|
+
];
|
|
486
|
+
var touchableNativeFeedbackStyleMoveToHolder = [
|
|
487
|
+
"width",
|
|
488
|
+
"height",
|
|
489
|
+
"margin",
|
|
490
|
+
"marginTop",
|
|
491
|
+
"marginBottom",
|
|
492
|
+
"marginLeft",
|
|
493
|
+
"marginRight",
|
|
494
|
+
"marginHorizontal",
|
|
495
|
+
"marginVertical"
|
|
496
|
+
];
|
|
497
|
+
function alphaToHex(alpha) {
|
|
498
|
+
const clamped = Math.min(1, Math.max(0, alpha));
|
|
499
|
+
const value = Math.round(clamped * 255);
|
|
500
|
+
return value.toString(16).padStart(2, "0");
|
|
501
|
+
}
|
|
502
|
+
var ViewComponent = function View({
|
|
503
|
+
isRow,
|
|
504
|
+
value,
|
|
505
|
+
disabled,
|
|
506
|
+
pressType = "highlight",
|
|
507
|
+
pressStrength: pressStrength2 = 0.8,
|
|
508
|
+
onPress,
|
|
509
|
+
onPressIn,
|
|
510
|
+
onPressOut,
|
|
511
|
+
onLongPress,
|
|
512
|
+
onPressWithValue,
|
|
513
|
+
children,
|
|
514
|
+
...props
|
|
515
|
+
}) {
|
|
516
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
517
|
+
const style = (0, import_react3.useMemo)(
|
|
518
|
+
() => ({
|
|
519
|
+
flexDirection: isRow ? "row" : "column",
|
|
520
|
+
...props,
|
|
521
|
+
...props.shadowOffsetWidth !== void 0 || props.shadowOffsetHeight !== void 0 ? {
|
|
522
|
+
shadowOffset: {
|
|
523
|
+
width: props.shadowOffsetWidth ?? 0,
|
|
524
|
+
height: props.shadowOffsetHeight ?? 0
|
|
525
|
+
}
|
|
526
|
+
} : {}
|
|
527
|
+
}),
|
|
528
|
+
[isRow, props]
|
|
529
|
+
);
|
|
530
|
+
const touchableHighlightStyle = (0, import_react3.useMemo)(
|
|
531
|
+
() => ({
|
|
532
|
+
...style,
|
|
533
|
+
...touchableHighlightStyleMoveToContent.reduce((previousValue, currentValue) => {
|
|
534
|
+
if (currentValue === "shadowOffsetWidth" || currentValue === "shadowOffsetHeight")
|
|
535
|
+
previousValue.shadowOffset = void 0;
|
|
536
|
+
else previousValue[currentValue] = void 0;
|
|
537
|
+
return previousValue;
|
|
538
|
+
}, {})
|
|
539
|
+
}),
|
|
540
|
+
[style]
|
|
541
|
+
);
|
|
542
|
+
const touchableHighlightContentProps = (0, import_react3.useMemo)(
|
|
543
|
+
() => touchableHighlightStyleMoveToContent.reduce((previousValue, currentValue) => {
|
|
544
|
+
previousValue[currentValue] = props[currentValue];
|
|
545
|
+
return previousValue;
|
|
546
|
+
}, {}),
|
|
547
|
+
[props]
|
|
548
|
+
);
|
|
549
|
+
const touchableNativeFeedbackHolderStyle = (0, import_react3.useMemo)(
|
|
550
|
+
() => touchableNativeFeedbackStyleMoveToHolder.reduce((previousValue, currentValue) => {
|
|
551
|
+
previousValue[currentValue] = props[currentValue];
|
|
552
|
+
return previousValue;
|
|
553
|
+
}, {}),
|
|
554
|
+
[props]
|
|
555
|
+
);
|
|
556
|
+
const touchableNativeFeedbackContentStyle = (0, import_react3.useMemo)(
|
|
557
|
+
() => ({
|
|
558
|
+
...style,
|
|
559
|
+
...touchableNativeFeedbackStyleMoveToHolder.reduce(
|
|
560
|
+
(previousValue, currentValue) => {
|
|
561
|
+
if (currentValue === "shadowOffsetWidth" || currentValue === "shadowOffsetHeight")
|
|
562
|
+
previousValue.shadowOffset = void 0;
|
|
563
|
+
else previousValue[currentValue] = void 0;
|
|
564
|
+
return previousValue;
|
|
565
|
+
},
|
|
566
|
+
{}
|
|
567
|
+
)
|
|
568
|
+
}),
|
|
569
|
+
[style]
|
|
570
|
+
);
|
|
571
|
+
const pressEvents = (0, import_react3.useMemo)(
|
|
572
|
+
() => !disabled ? {
|
|
573
|
+
onPress: (event) => {
|
|
574
|
+
onPress?.(event);
|
|
575
|
+
if (value !== void 0) onPressWithValue?.(value);
|
|
576
|
+
},
|
|
577
|
+
onPressIn,
|
|
578
|
+
onPressOut,
|
|
579
|
+
onLongPress
|
|
580
|
+
} : {},
|
|
581
|
+
[disabled, onPress, onPressIn, onPressOut, onLongPress, onPressWithValue, value]
|
|
582
|
+
);
|
|
583
|
+
const androidBoxShadow = import_react_native2.Platform.OS === "android" ? props.shadowOffsetWidth !== void 0 || props.shadowOffsetHeight !== void 0 ? `${props.shadowOffsetWidth ?? 0}px ${props.shadowOffsetHeight ?? 0}px ${props.shadowRadius}px ${props.shadowColor?.toString() ?? "#000000"}` : void 0 : void 0;
|
|
584
|
+
const isPressable = onPress || onPressIn || onPressOut || onLongPress || onPressWithValue;
|
|
585
|
+
return isPressable ? pressType === "opacity" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
586
|
+
import_react_native2.TouchableOpacity,
|
|
587
|
+
{
|
|
588
|
+
style,
|
|
589
|
+
activeOpacity: pressStrength2,
|
|
590
|
+
boxShadow: androidBoxShadow,
|
|
591
|
+
...pressEvents,
|
|
592
|
+
...props,
|
|
593
|
+
children
|
|
594
|
+
}
|
|
595
|
+
) : pressType === "highlight" ? import_react_native2.Platform.OS === "ios" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
596
|
+
import_react_native2.TouchableHighlight,
|
|
597
|
+
{
|
|
598
|
+
activeOpacity: pressStrength2,
|
|
599
|
+
underlayColor: theme2.colors.textPrimary,
|
|
600
|
+
style: touchableHighlightStyle,
|
|
601
|
+
...pressEvents,
|
|
602
|
+
...props,
|
|
603
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
604
|
+
ViewComponent,
|
|
605
|
+
{
|
|
606
|
+
width: "100%",
|
|
607
|
+
borderRadius: props.borderRadius,
|
|
608
|
+
borderTopLeftRadius: props.borderTopLeftRadius,
|
|
609
|
+
borderTopRightRadius: props.borderTopRightRadius,
|
|
610
|
+
borderBottomLeftRadius: props.borderBottomLeftRadius,
|
|
611
|
+
borderBottomRightRadius: props.borderBottomRightRadius,
|
|
612
|
+
...touchableHighlightContentProps,
|
|
613
|
+
children
|
|
614
|
+
}
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
) : import_react_native2.Platform.OS === "android" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
618
|
+
ViewComponent,
|
|
619
|
+
{
|
|
620
|
+
...touchableNativeFeedbackHolderStyle,
|
|
621
|
+
borderRadius: props.borderRadius,
|
|
622
|
+
borderTopLeftRadius: props.borderTopLeftRadius,
|
|
623
|
+
borderTopRightRadius: props.borderTopRightRadius,
|
|
624
|
+
borderBottomLeftRadius: props.borderBottomLeftRadius,
|
|
625
|
+
borderBottomRightRadius: props.borderBottomRightRadius,
|
|
626
|
+
boxShadow: androidBoxShadow,
|
|
627
|
+
overflow: "hidden",
|
|
628
|
+
pointerEvents: "box-none",
|
|
629
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
630
|
+
import_react_native2.TouchableNativeFeedback,
|
|
631
|
+
{
|
|
632
|
+
...pressEvents,
|
|
633
|
+
...props,
|
|
634
|
+
background: import_react_native2.TouchableNativeFeedback.Ripple(
|
|
635
|
+
`${theme2.colors.textPrimary}${alphaToHex(1 - pressStrength2)}`,
|
|
636
|
+
false
|
|
637
|
+
),
|
|
638
|
+
useForeground: true,
|
|
639
|
+
touchSoundDisabled: true,
|
|
640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ViewComponent, { flex: 1, ...touchableNativeFeedbackContentStyle, children })
|
|
641
|
+
}
|
|
642
|
+
)
|
|
643
|
+
}
|
|
644
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { boxShadow: androidBoxShadow, style, ...props, children });
|
|
645
|
+
};
|
|
646
|
+
ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
647
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
648
|
+
const shadowProps = (0, import_react3.useMemo)(
|
|
649
|
+
() => withShadow ? {
|
|
650
|
+
shadowOpacity: 0.2,
|
|
651
|
+
shadowOffsetHeight: 10,
|
|
652
|
+
shadowRadius: 10,
|
|
653
|
+
shadowColor: import_react_native2.Platform.OS === "android" ? "#00000020" : void 0
|
|
654
|
+
} : {},
|
|
655
|
+
[]
|
|
656
|
+
);
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
658
|
+
ViewComponent,
|
|
659
|
+
{
|
|
660
|
+
width: "100%",
|
|
661
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
662
|
+
borderWidth: 1,
|
|
663
|
+
borderColor: theme2.colors.border,
|
|
664
|
+
borderRadius: theme2.styles.borderRadius,
|
|
665
|
+
paddingHorizontal: theme2.styles.space,
|
|
666
|
+
paddingVertical: theme2.styles.gap,
|
|
667
|
+
...shadowProps,
|
|
668
|
+
...props
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
};
|
|
672
|
+
var View2 = (0, import_react3.memo)(ViewComponent);
|
|
673
|
+
View2.box = ViewComponent.box;
|
|
674
|
+
var View_default = View2;
|
|
675
|
+
|
|
676
|
+
// src/components/Text.tsx
|
|
677
|
+
var import_react4 = require("react");
|
|
678
|
+
var import_react_native3 = require("react-native");
|
|
679
|
+
var import_react_better_core4 = require("react-better-core");
|
|
680
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
681
|
+
var TextComponent = function Text({ selectionColor, children, ...props }) {
|
|
682
|
+
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
683
|
+
const style = (0, import_react4.useMemo)(
|
|
684
|
+
() => ({
|
|
685
|
+
fontSize: 16,
|
|
686
|
+
color: theme2.colors.textPrimary,
|
|
687
|
+
...props
|
|
688
|
+
}),
|
|
689
|
+
[theme2, props]
|
|
690
|
+
);
|
|
691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { selectionColor: selectionColor ?? theme2.colors.primary, style, ...props, children });
|
|
692
|
+
};
|
|
693
|
+
TextComponent.title = function Title(props) {
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextComponent, { fontSize: 32, fontWeight: 700, ...props });
|
|
695
|
+
};
|
|
696
|
+
TextComponent.subtitle = function Subtitle(props) {
|
|
697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextComponent, { fontSize: 24, fontWeight: 700, ...props });
|
|
698
|
+
};
|
|
699
|
+
TextComponent.body = function Body(props) {
|
|
700
|
+
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextComponent, { color: theme2.colors.textSecondary, ...props });
|
|
702
|
+
};
|
|
703
|
+
TextComponent.caption = function Caption(props) {
|
|
704
|
+
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextComponent, { fontSize: 14, color: theme2.colors.textSecondary, ...props });
|
|
706
|
+
};
|
|
707
|
+
TextComponent.unknown = function Unknown(props) {
|
|
708
|
+
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextComponent, { fontStyle: "italic", textAlign: "center", color: theme2.colors.textSecondary, ...props });
|
|
710
|
+
};
|
|
711
|
+
var Text2 = (0, import_react4.memo)(TextComponent);
|
|
712
|
+
Text2.title = TextComponent.title;
|
|
713
|
+
Text2.subtitle = TextComponent.subtitle;
|
|
714
|
+
Text2.body = TextComponent.body;
|
|
715
|
+
Text2.caption = TextComponent.caption;
|
|
716
|
+
Text2.unknown = TextComponent.unknown;
|
|
717
|
+
var Text_default = Text2;
|
|
718
|
+
|
|
719
|
+
// src/components/Button.tsx
|
|
720
|
+
var import_react7 = require("react");
|
|
721
|
+
var import_react_better_core6 = require("react-better-core");
|
|
722
|
+
|
|
723
|
+
// src/components/Animate.tsx
|
|
724
|
+
var import_react5 = require("react");
|
|
725
|
+
var import_motion = require("@legendapp/motion");
|
|
726
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
727
|
+
var defaultTransitionDuration = 0.15 * 1e3;
|
|
728
|
+
var Animate = {
|
|
729
|
+
View: (0, import_react5.memo)(function View3({ transformOriginX, transformOriginY, children, ...props }) {
|
|
730
|
+
const initialProps = useComponentPropsGrouper(props, "initial");
|
|
731
|
+
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
732
|
+
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
733
|
+
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
734
|
+
const transition = (0, import_react5.useMemo)(
|
|
735
|
+
() => ({
|
|
736
|
+
type: "timing",
|
|
737
|
+
duration: defaultTransitionDuration,
|
|
738
|
+
...transitionProps.withPrefixStyle
|
|
739
|
+
}),
|
|
740
|
+
[transitionProps.withPrefixStyle]
|
|
741
|
+
);
|
|
742
|
+
const transformOrigin = (0, import_react5.useMemo)(
|
|
743
|
+
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
744
|
+
x: transformOriginX ?? 0,
|
|
745
|
+
y: transformOriginY ?? 0
|
|
746
|
+
} : void 0,
|
|
747
|
+
[transformOriginX, transformOriginY]
|
|
748
|
+
);
|
|
749
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
750
|
+
import_motion.Motion.View,
|
|
751
|
+
{
|
|
752
|
+
style: initialProps.style,
|
|
753
|
+
initial: initialProps.withPrefixStyle,
|
|
754
|
+
animate: animateProps2.withPrefixStyle,
|
|
755
|
+
transition,
|
|
756
|
+
whileTap: whileTapProps.withPrefixStyle,
|
|
757
|
+
transformOrigin,
|
|
758
|
+
children
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
return Object.keys(whileTapProps.withPrefixStyle).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_motion.Motion.Pressable, { children: content }) : content;
|
|
762
|
+
}),
|
|
763
|
+
Text: (0, import_react5.memo)(function Text3({ transformOriginX, transformOriginY, children, ...props }) {
|
|
764
|
+
const initialProps = useComponentPropsGrouper(props, "initial");
|
|
765
|
+
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
766
|
+
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
767
|
+
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
768
|
+
const transition = (0, import_react5.useMemo)(
|
|
769
|
+
() => ({
|
|
770
|
+
type: "timing",
|
|
771
|
+
duration: defaultTransitionDuration,
|
|
772
|
+
...transitionProps.withPrefixStyle
|
|
773
|
+
}),
|
|
774
|
+
[transitionProps.withPrefixStyle]
|
|
775
|
+
);
|
|
776
|
+
const transformOrigin = (0, import_react5.useMemo)(
|
|
777
|
+
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
778
|
+
x: transformOriginX ?? 0,
|
|
779
|
+
y: transformOriginY ?? 0
|
|
780
|
+
} : void 0,
|
|
781
|
+
[transformOriginX, transformOriginY]
|
|
782
|
+
);
|
|
783
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
784
|
+
import_motion.Motion.Text,
|
|
785
|
+
{
|
|
786
|
+
style: initialProps.style,
|
|
787
|
+
initial: initialProps.withPrefixStyle,
|
|
788
|
+
animate: animateProps2.withPrefixStyle,
|
|
789
|
+
transition,
|
|
790
|
+
whileTap: whileTapProps.withPrefixStyle,
|
|
791
|
+
transformOrigin,
|
|
792
|
+
children
|
|
793
|
+
}
|
|
794
|
+
);
|
|
795
|
+
return Object.keys(whileTapProps.withPrefixStyle).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_motion.Motion.Pressable, { children: content }) : content;
|
|
796
|
+
})
|
|
797
|
+
};
|
|
798
|
+
var Animate_default = Animate;
|
|
799
|
+
|
|
800
|
+
// src/components/Loader.tsx
|
|
801
|
+
var import_react6 = require("react");
|
|
802
|
+
var import_react_native4 = require("react-native");
|
|
803
|
+
var import_react_better_core5 = require("react-better-core");
|
|
804
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
805
|
+
var LoaderComponent = function Loader({ size = "small", color, ...props }) {
|
|
806
|
+
const theme2 = (0, import_react_better_core5.useTheme)();
|
|
807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(View_default, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.ActivityIndicator, { size, color: color ?? theme2.colors.textPrimary }) });
|
|
808
|
+
};
|
|
809
|
+
LoaderComponent.box = function Box2({ text = "Loading...", size = "large", color, ...props }) {
|
|
810
|
+
const theme2 = (0, import_react_better_core5.useTheme)();
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
812
|
+
View_default,
|
|
813
|
+
{
|
|
814
|
+
width: "100%",
|
|
815
|
+
alignItems: "center",
|
|
816
|
+
gap: theme2.styles.gap,
|
|
817
|
+
marginVertical: theme2.styles.space,
|
|
818
|
+
...props,
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader2, { size, color }),
|
|
821
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text_default, { textAlign: "center", color: color ?? theme2.colors.textSecondary, children: text })
|
|
822
|
+
]
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
};
|
|
826
|
+
LoaderComponent.text = function LoaderText({ text = "Loading...", size, color, ...props }) {
|
|
827
|
+
const theme2 = (0, import_react_better_core5.useTheme)();
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
829
|
+
View_default,
|
|
830
|
+
{
|
|
831
|
+
isRow: true,
|
|
832
|
+
alignItems: "center",
|
|
833
|
+
justifyContent: "center",
|
|
834
|
+
gap: theme2.styles.gap,
|
|
835
|
+
marginVertical: theme2.styles.space,
|
|
836
|
+
...props,
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader2, { size, color }),
|
|
839
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text_default, { textAlign: "center", color: color ?? theme2.colors.textSecondary, children: text })
|
|
840
|
+
]
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
};
|
|
844
|
+
var Loader2 = (0, import_react6.memo)(LoaderComponent);
|
|
845
|
+
Loader2.box = LoaderComponent.box;
|
|
846
|
+
Loader2.text = LoaderComponent.text;
|
|
847
|
+
var Loader_default = Loader2;
|
|
848
|
+
|
|
849
|
+
// src/components/Button.tsx
|
|
850
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
851
|
+
var ButtonComponent = function Button({
|
|
852
|
+
text,
|
|
853
|
+
textFontSize = 16,
|
|
854
|
+
textFontWeight = 700,
|
|
855
|
+
textDecorationLine,
|
|
856
|
+
textColor,
|
|
857
|
+
icon,
|
|
858
|
+
iconPosition = "left",
|
|
859
|
+
iconColor,
|
|
860
|
+
iconSize,
|
|
861
|
+
image,
|
|
862
|
+
imagePosition = "left",
|
|
863
|
+
imageWidth,
|
|
864
|
+
imageHeight,
|
|
865
|
+
loaderName,
|
|
866
|
+
isLoading,
|
|
867
|
+
isSmall,
|
|
868
|
+
animateOpacity,
|
|
869
|
+
flex,
|
|
870
|
+
alignSelf,
|
|
871
|
+
disabled,
|
|
872
|
+
...props
|
|
873
|
+
}) {
|
|
874
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
875
|
+
const isLoadingLoader = (0, import_react_better_core6.useLoader)(loaderName);
|
|
876
|
+
const isLoadingElement = isLoading || isLoadingLoader;
|
|
877
|
+
const isDisabled = disabled || isLoadingElement;
|
|
878
|
+
const lineHeight = 20;
|
|
879
|
+
const color = textColor ?? theme2.colors.base;
|
|
880
|
+
const paddingVertical = props.paddingVertical ? parseFloat(props.paddingVertical.toString()) : theme2.styles.space;
|
|
881
|
+
const paddingHorizontal = props.paddingHorizontal ? parseFloat(props.paddingHorizontal.toString()) : theme2.styles.space + theme2.styles.gap;
|
|
882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
883
|
+
Animate_default.View,
|
|
884
|
+
{
|
|
885
|
+
position: "relative",
|
|
886
|
+
flex,
|
|
887
|
+
alignSelf: alignSelf ?? (isSmall === "left" ? "flex-start" : isSmall === "right" ? "flex-end" : isSmall === "center" ? "center" : isSmall ? "baseline" : void 0),
|
|
888
|
+
initialOpacity: 1,
|
|
889
|
+
animateOpacity: animateOpacity ?? (disabled ? 0.6 : 1),
|
|
890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
891
|
+
View_default,
|
|
892
|
+
{
|
|
893
|
+
position: "relative",
|
|
894
|
+
width: !isSmall ? "100%" : void 0,
|
|
895
|
+
alignItems: "center",
|
|
896
|
+
justifyContent: "center",
|
|
897
|
+
backgroundColor: theme2.colors.primary,
|
|
898
|
+
borderRadius: theme2.styles.borderRadius,
|
|
899
|
+
paddingVertical,
|
|
900
|
+
paddingHorizontal,
|
|
901
|
+
disabled: isDisabled,
|
|
902
|
+
...props,
|
|
903
|
+
children: [
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Animate_default.View, { initialOpacity: 1, animateOpacity: isLoadingElement ? 0 : 1, children: text && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
905
|
+
Text_default,
|
|
906
|
+
{
|
|
907
|
+
fontSize: textFontSize,
|
|
908
|
+
fontWeight: textFontWeight,
|
|
909
|
+
textDecorationLine,
|
|
910
|
+
textDecorationColor: color,
|
|
911
|
+
textAlign: "center",
|
|
912
|
+
lineHeight,
|
|
913
|
+
color,
|
|
914
|
+
children: text
|
|
915
|
+
}
|
|
916
|
+
) }),
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
918
|
+
Animate_default.View,
|
|
919
|
+
{
|
|
920
|
+
position: "absolute",
|
|
921
|
+
width: "100%",
|
|
922
|
+
height: paddingVertical + lineHeight + paddingVertical,
|
|
923
|
+
left: paddingHorizontal,
|
|
924
|
+
alignItems: "center",
|
|
925
|
+
justifyContent: "center",
|
|
926
|
+
initialOpacity: 0,
|
|
927
|
+
animateOpacity: isLoadingElement ? 1 : 0,
|
|
928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Loader_default, { color })
|
|
929
|
+
}
|
|
930
|
+
)
|
|
931
|
+
]
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
};
|
|
937
|
+
ButtonComponent.secondary = function Secondary(props) {
|
|
938
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
940
|
+
ButtonComponent,
|
|
941
|
+
{
|
|
942
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
943
|
+
borderWidth: 1,
|
|
944
|
+
borderColor: theme2.colors.border,
|
|
945
|
+
textColor: theme2.colors.textPrimary,
|
|
946
|
+
pressStrength: pressStrength().z05,
|
|
947
|
+
animateOpacity: props.disabled ? 0.4 : 1,
|
|
948
|
+
...props
|
|
949
|
+
}
|
|
950
|
+
);
|
|
951
|
+
};
|
|
952
|
+
ButtonComponent.destructive = function Destructive(props) {
|
|
953
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ButtonComponent, { backgroundColor: theme2.colors.error, ...props });
|
|
955
|
+
};
|
|
956
|
+
ButtonComponent.text = function ButtonText(props) {
|
|
957
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
959
|
+
ButtonComponent,
|
|
960
|
+
{
|
|
961
|
+
width: "auto",
|
|
962
|
+
textColor: theme2.colors.textPrimary,
|
|
963
|
+
textDecorationLine: "underline",
|
|
964
|
+
backgroundColor: "transparent",
|
|
965
|
+
paddingHorizontal: theme2.styles.space,
|
|
966
|
+
paddingVertical: theme2.styles.gap,
|
|
967
|
+
isSmall: true,
|
|
968
|
+
pressType: "opacity",
|
|
969
|
+
...props
|
|
970
|
+
}
|
|
971
|
+
);
|
|
972
|
+
};
|
|
973
|
+
var Button2 = (0, import_react7.memo)(ButtonComponent);
|
|
974
|
+
Button2.secondary = ButtonComponent.secondary;
|
|
975
|
+
Button2.destructive = ButtonComponent.destructive;
|
|
976
|
+
Button2.text = ButtonComponent.text;
|
|
977
|
+
var Button_default = Button2;
|
|
978
|
+
|
|
979
|
+
// src/components/ScreenHolder.tsx
|
|
980
|
+
var import_react8 = require("react");
|
|
981
|
+
var import_react_native5 = require("react-native");
|
|
982
|
+
var import_react_better_core7 = require("react-better-core");
|
|
983
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
984
|
+
var ScreenHolderComponent = ({
|
|
985
|
+
noScroll,
|
|
986
|
+
noSideSpace,
|
|
987
|
+
refreshTimeout = 1,
|
|
988
|
+
onRefresh,
|
|
989
|
+
onRefreshEnd,
|
|
990
|
+
backgroundColor,
|
|
991
|
+
insideTopSafeArea,
|
|
992
|
+
insideBottomSafeArea,
|
|
993
|
+
bottomSpace = 0,
|
|
994
|
+
footer,
|
|
995
|
+
children
|
|
996
|
+
}) => {
|
|
997
|
+
const theme2 = (0, import_react_better_core7.useTheme)();
|
|
998
|
+
const device = useDevice();
|
|
999
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react_better_core7.useBooleanState)();
|
|
1000
|
+
const onRefreshElement = (0, import_react8.useCallback)(() => {
|
|
1001
|
+
setIsRefreshing.setTrue();
|
|
1002
|
+
onRefresh?.();
|
|
1003
|
+
setTimeout(() => {
|
|
1004
|
+
setIsRefreshing.setFalse();
|
|
1005
|
+
onRefreshEnd?.();
|
|
1006
|
+
}, refreshTimeout * 1e3);
|
|
1007
|
+
}, [onRefresh, onRefreshEnd, refreshTimeout]);
|
|
1008
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1009
|
+
View_default,
|
|
1010
|
+
{
|
|
1011
|
+
flex: 1,
|
|
1012
|
+
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1013
|
+
paddingTop: theme2.styles.gap + (insideTopSafeArea ? device.safeArea.afterCalculations.top : 0),
|
|
1014
|
+
paddingBottom: bottomSpace + (insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : 0),
|
|
1015
|
+
children
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
const withRefresh = onRefresh || onRefreshEnd;
|
|
1019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: [
|
|
1020
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1021
|
+
import_react_native5.ScrollView,
|
|
1022
|
+
{
|
|
1023
|
+
refreshControl: withRefresh ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native5.RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1024
|
+
children: content
|
|
1025
|
+
}
|
|
1026
|
+
) }),
|
|
1027
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { children: footer })
|
|
1028
|
+
] });
|
|
1029
|
+
};
|
|
1030
|
+
ScreenHolderComponent.footer = function Footer({
|
|
1031
|
+
noSideSpace,
|
|
1032
|
+
backgroundColor,
|
|
1033
|
+
insideBottomSafeArea,
|
|
1034
|
+
children
|
|
1035
|
+
}) {
|
|
1036
|
+
const theme2 = (0, import_react_better_core7.useTheme)();
|
|
1037
|
+
const device = useDevice();
|
|
1038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1039
|
+
View_default,
|
|
1040
|
+
{
|
|
1041
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
1042
|
+
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1043
|
+
paddingTop: theme2.styles.gap,
|
|
1044
|
+
paddingBottom: insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : void 0,
|
|
1045
|
+
children
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
};
|
|
1049
|
+
var ScreenHolder = (0, import_react8.memo)(ScreenHolderComponent);
|
|
1050
|
+
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1051
|
+
var ScreenHolder_default = ScreenHolder;
|
|
1052
|
+
|
|
1053
|
+
// src/plugins/asyncStorage.ts
|
|
1054
|
+
var defaultAsyncStoragePluginOptions = {};
|
|
1055
|
+
var asyncStoragePlugin = (options) => ({
|
|
1056
|
+
name: "asyncStorage",
|
|
1057
|
+
initialize: () => {
|
|
1058
|
+
console.log("asyncStorage plugin initialized");
|
|
1059
|
+
},
|
|
1060
|
+
getConfig: () => ({
|
|
1061
|
+
...defaultAsyncStoragePluginOptions,
|
|
1062
|
+
...options
|
|
1063
|
+
})
|
|
1064
|
+
});
|
|
1065
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1066
|
+
0 && (module.exports = {
|
|
1067
|
+
Animate,
|
|
1068
|
+
BetterComponentsProvider,
|
|
1069
|
+
Button,
|
|
1070
|
+
Loader,
|
|
1071
|
+
ScreenHolder,
|
|
1072
|
+
Text,
|
|
1073
|
+
View,
|
|
1074
|
+
asyncStoragePlugin,
|
|
1075
|
+
colorThemeControls,
|
|
1076
|
+
countries,
|
|
1077
|
+
darkenColor,
|
|
1078
|
+
defaultAsyncStoragePluginOptions,
|
|
1079
|
+
desaturateColor,
|
|
1080
|
+
eventPreventDefault,
|
|
1081
|
+
eventPreventStop,
|
|
1082
|
+
eventStopPropagation,
|
|
1083
|
+
formatPhoneNumber,
|
|
1084
|
+
generateAsyncStorage,
|
|
1085
|
+
generateRandomString,
|
|
1086
|
+
getPluralWord,
|
|
1087
|
+
lightenColor,
|
|
1088
|
+
loaderControls,
|
|
1089
|
+
pressStrength,
|
|
1090
|
+
saturateColor,
|
|
1091
|
+
useBetterComponentsContext,
|
|
1092
|
+
useBooleanState,
|
|
1093
|
+
useDebounceState,
|
|
1094
|
+
useDevice,
|
|
1095
|
+
useLoader,
|
|
1096
|
+
useLoaderControls,
|
|
1097
|
+
useTheme
|
|
1098
|
+
});
|
|
1099
|
+
//# sourceMappingURL=index.js.map
|