@thelacanians/vue-native-runtime 0.1.2 → 0.2.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/dist/index.cjs +1686 -59
- package/dist/index.d.cts +1942 -131
- package/dist/index.d.ts +1942 -131
- package/dist/index.js +1644 -49
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -21,57 +21,89 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
|
+
ErrorBoundary: () => ErrorBoundary,
|
|
24
25
|
NativeBridge: () => NativeBridge,
|
|
25
26
|
VActionSheet: () => VActionSheet,
|
|
26
27
|
VActivityIndicator: () => VActivityIndicator,
|
|
27
28
|
VAlertDialog: () => VAlertDialog,
|
|
28
29
|
VButton: () => VButton,
|
|
30
|
+
VCheckbox: () => VCheckbox,
|
|
31
|
+
VDropdown: () => VDropdown,
|
|
29
32
|
VImage: () => VImage,
|
|
30
33
|
VInput: () => VInput,
|
|
31
34
|
VKeyboardAvoiding: () => VKeyboardAvoiding,
|
|
32
35
|
VList: () => VList,
|
|
33
36
|
VModal: () => VModal,
|
|
34
37
|
VPicker: () => VPicker,
|
|
38
|
+
VPressable: () => VPressable,
|
|
35
39
|
VProgressBar: () => VProgressBar,
|
|
40
|
+
VRadio: () => VRadio,
|
|
41
|
+
VRefreshControl: () => VRefreshControl,
|
|
36
42
|
VSafeArea: () => VSafeArea,
|
|
37
43
|
VScrollView: () => VScrollView,
|
|
44
|
+
VSectionList: () => VSectionList,
|
|
38
45
|
VSegmentedControl: () => VSegmentedControl,
|
|
39
46
|
VSlider: () => VSlider,
|
|
40
47
|
VStatusBar: () => VStatusBar,
|
|
41
48
|
VSwitch: () => VSwitch,
|
|
42
49
|
VText: () => VText,
|
|
50
|
+
VVideo: () => VVideo,
|
|
43
51
|
VView: () => VView,
|
|
44
52
|
VWebView: () => VWebView,
|
|
53
|
+
clearSharedElementRegistry: () => clearSharedElementRegistry,
|
|
45
54
|
createApp: () => createApp,
|
|
46
55
|
createCommentNode: () => createCommentNode,
|
|
47
56
|
createNativeNode: () => createNativeNode,
|
|
48
57
|
createStyleSheet: () => createStyleSheet,
|
|
49
58
|
createTextNode: () => createTextNode,
|
|
59
|
+
getRegisteredSharedElements: () => getRegisteredSharedElements,
|
|
60
|
+
getSharedElementViewId: () => getSharedElementViewId,
|
|
61
|
+
measureViewFrame: () => measureViewFrame,
|
|
50
62
|
render: () => render,
|
|
51
63
|
resetNodeId: () => resetNodeId,
|
|
64
|
+
useAccelerometer: () => useAccelerometer,
|
|
52
65
|
useAnimation: () => useAnimation,
|
|
53
66
|
useAppState: () => useAppState,
|
|
67
|
+
useAppleSignIn: () => useAppleSignIn,
|
|
54
68
|
useAsyncStorage: () => useAsyncStorage,
|
|
69
|
+
useAudio: () => useAudio,
|
|
55
70
|
useBackHandler: () => useBackHandler,
|
|
71
|
+
useBackgroundTask: () => useBackgroundTask,
|
|
56
72
|
useBiometry: () => useBiometry,
|
|
73
|
+
useBluetooth: () => useBluetooth,
|
|
74
|
+
useCalendar: () => useCalendar,
|
|
57
75
|
useCamera: () => useCamera,
|
|
58
76
|
useClipboard: () => useClipboard,
|
|
59
77
|
useColorScheme: () => useColorScheme,
|
|
78
|
+
useContacts: () => useContacts,
|
|
79
|
+
useDatabase: () => useDatabase,
|
|
60
80
|
useDeviceInfo: () => useDeviceInfo,
|
|
81
|
+
useDimensions: () => useDimensions,
|
|
82
|
+
useFileSystem: () => useFileSystem,
|
|
61
83
|
useGeolocation: () => useGeolocation,
|
|
84
|
+
useGoogleSignIn: () => useGoogleSignIn,
|
|
85
|
+
useGyroscope: () => useGyroscope,
|
|
62
86
|
useHaptics: () => useHaptics,
|
|
63
87
|
useHttp: () => useHttp,
|
|
88
|
+
useI18n: () => useI18n,
|
|
89
|
+
useIAP: () => useIAP,
|
|
64
90
|
useKeyboard: () => useKeyboard,
|
|
65
91
|
useLinking: () => useLinking,
|
|
66
92
|
useNetwork: () => useNetwork,
|
|
67
93
|
useNotifications: () => useNotifications,
|
|
94
|
+
useOTAUpdate: () => useOTAUpdate,
|
|
95
|
+
usePerformance: () => usePerformance,
|
|
68
96
|
usePermissions: () => usePermissions,
|
|
97
|
+
usePlatform: () => usePlatform,
|
|
98
|
+
useSecureStorage: () => useSecureStorage,
|
|
69
99
|
useShare: () => useShare,
|
|
100
|
+
useSharedElementTransition: () => useSharedElementTransition,
|
|
101
|
+
useWebSocket: () => useWebSocket,
|
|
70
102
|
vShow: () => vShow,
|
|
71
103
|
validStyleProperties: () => validStyleProperties
|
|
72
104
|
});
|
|
73
105
|
module.exports = __toCommonJS(index_exports);
|
|
74
|
-
var
|
|
106
|
+
var import_runtime_core57 = require("@vue/runtime-core");
|
|
75
107
|
|
|
76
108
|
// src/renderer.ts
|
|
77
109
|
var import_runtime_core = require("@vue/runtime-core");
|
|
@@ -115,7 +147,7 @@ function createTextNode(text) {
|
|
|
115
147
|
};
|
|
116
148
|
return (0, import_reactivity.markRaw)(node);
|
|
117
149
|
}
|
|
118
|
-
function createCommentNode(
|
|
150
|
+
function createCommentNode(_text) {
|
|
119
151
|
const node = {
|
|
120
152
|
id: getNextNodeId(),
|
|
121
153
|
type: "__COMMENT__",
|
|
@@ -404,9 +436,9 @@ var NativeBridgeImpl = class {
|
|
|
404
436
|
}
|
|
405
437
|
const handlers = this.globalEventHandlers.get(eventName);
|
|
406
438
|
if (handlers) {
|
|
407
|
-
handlers.forEach((
|
|
439
|
+
handlers.forEach((h28) => {
|
|
408
440
|
try {
|
|
409
|
-
|
|
441
|
+
h28(payload);
|
|
410
442
|
} catch (err) {
|
|
411
443
|
console.error(`[VueNative] Error in global event handler "${eventName}":`, err);
|
|
412
444
|
}
|
|
@@ -617,7 +649,10 @@ var VView = (0, import_runtime_core2.defineComponent)({
|
|
|
617
649
|
props: {
|
|
618
650
|
style: Object,
|
|
619
651
|
testID: String,
|
|
620
|
-
accessibilityLabel: String
|
|
652
|
+
accessibilityLabel: String,
|
|
653
|
+
accessibilityRole: String,
|
|
654
|
+
accessibilityHint: String,
|
|
655
|
+
accessibilityState: Object
|
|
621
656
|
},
|
|
622
657
|
setup(props, { slots }) {
|
|
623
658
|
return () => (0, import_runtime_core2.h)("VView", { ...props }, slots.default?.());
|
|
@@ -635,7 +670,10 @@ var VText = (0, import_runtime_core3.defineComponent)({
|
|
|
635
670
|
type: Boolean,
|
|
636
671
|
default: false
|
|
637
672
|
},
|
|
638
|
-
|
|
673
|
+
accessibilityLabel: String,
|
|
674
|
+
accessibilityRole: String,
|
|
675
|
+
accessibilityHint: String,
|
|
676
|
+
accessibilityState: Object
|
|
639
677
|
},
|
|
640
678
|
setup(props, { slots }) {
|
|
641
679
|
return () => (0, import_runtime_core3.h)("VText", { ...props }, slots.default?.());
|
|
@@ -657,7 +695,11 @@ var VButton = (0, import_runtime_core4.defineComponent)({
|
|
|
657
695
|
default: 0.7
|
|
658
696
|
},
|
|
659
697
|
onPress: Function,
|
|
660
|
-
onLongPress: Function
|
|
698
|
+
onLongPress: Function,
|
|
699
|
+
accessibilityLabel: String,
|
|
700
|
+
accessibilityRole: String,
|
|
701
|
+
accessibilityHint: String,
|
|
702
|
+
accessibilityState: Object
|
|
661
703
|
},
|
|
662
704
|
setup(props, { slots }) {
|
|
663
705
|
return () => (0, import_runtime_core4.h)(
|
|
@@ -707,7 +749,11 @@ var VInput = (0, import_runtime_core5.defineComponent)({
|
|
|
707
749
|
type: Boolean,
|
|
708
750
|
default: false
|
|
709
751
|
},
|
|
710
|
-
style: Object
|
|
752
|
+
style: Object,
|
|
753
|
+
accessibilityLabel: String,
|
|
754
|
+
accessibilityRole: String,
|
|
755
|
+
accessibilityHint: String,
|
|
756
|
+
accessibilityState: Object
|
|
711
757
|
},
|
|
712
758
|
emits: ["update:modelValue", "focus", "blur", "submit"],
|
|
713
759
|
setup(props, { emit }) {
|
|
@@ -735,6 +781,10 @@ var VInput = (0, import_runtime_core5.defineComponent)({
|
|
|
735
781
|
maxLength: props.maxLength,
|
|
736
782
|
multiline: props.multiline,
|
|
737
783
|
style: props.style,
|
|
784
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
785
|
+
accessibilityRole: props.accessibilityRole,
|
|
786
|
+
accessibilityHint: props.accessibilityHint,
|
|
787
|
+
accessibilityState: props.accessibilityState,
|
|
738
788
|
onChangetext,
|
|
739
789
|
onFocus,
|
|
740
790
|
onBlur,
|
|
@@ -758,7 +808,11 @@ var VSwitch = (0, import_runtime_core6.defineComponent)({
|
|
|
758
808
|
},
|
|
759
809
|
onTintColor: String,
|
|
760
810
|
thumbTintColor: String,
|
|
761
|
-
style: Object
|
|
811
|
+
style: Object,
|
|
812
|
+
accessibilityLabel: String,
|
|
813
|
+
accessibilityRole: String,
|
|
814
|
+
accessibilityHint: String,
|
|
815
|
+
accessibilityState: Object
|
|
762
816
|
},
|
|
763
817
|
emits: ["update:modelValue", "change"],
|
|
764
818
|
setup(props, { emit }) {
|
|
@@ -773,6 +827,10 @@ var VSwitch = (0, import_runtime_core6.defineComponent)({
|
|
|
773
827
|
onTintColor: props.onTintColor,
|
|
774
828
|
thumbTintColor: props.thumbTintColor,
|
|
775
829
|
style: props.style,
|
|
830
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
831
|
+
accessibilityRole: props.accessibilityRole,
|
|
832
|
+
accessibilityHint: props.accessibilityHint,
|
|
833
|
+
accessibilityState: props.accessibilityState,
|
|
776
834
|
onChange
|
|
777
835
|
});
|
|
778
836
|
}
|
|
@@ -845,7 +903,11 @@ var VScrollView = (0, import_runtime_core8.defineComponent)({
|
|
|
845
903
|
type: Boolean,
|
|
846
904
|
default: false
|
|
847
905
|
},
|
|
848
|
-
style: Object
|
|
906
|
+
style: Object,
|
|
907
|
+
accessibilityLabel: String,
|
|
908
|
+
accessibilityRole: String,
|
|
909
|
+
accessibilityHint: String,
|
|
910
|
+
accessibilityState: Object
|
|
849
911
|
},
|
|
850
912
|
emits: ["scroll", "refresh"],
|
|
851
913
|
setup(props, { slots, emit }) {
|
|
@@ -867,6 +929,10 @@ var VScrollView = (0, import_runtime_core8.defineComponent)({
|
|
|
867
929
|
contentContainerStyle: props.contentContainerStyle,
|
|
868
930
|
refreshing: props.refreshing,
|
|
869
931
|
style: props.style,
|
|
932
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
933
|
+
accessibilityRole: props.accessibilityRole,
|
|
934
|
+
accessibilityHint: props.accessibilityHint,
|
|
935
|
+
accessibilityState: props.accessibilityState,
|
|
870
936
|
onScroll,
|
|
871
937
|
onRefresh
|
|
872
938
|
},
|
|
@@ -887,7 +953,10 @@ var VImage = (0, import_runtime_core9.defineComponent)({
|
|
|
887
953
|
},
|
|
888
954
|
style: Object,
|
|
889
955
|
testID: String,
|
|
890
|
-
accessibilityLabel: String
|
|
956
|
+
accessibilityLabel: String,
|
|
957
|
+
accessibilityRole: String,
|
|
958
|
+
accessibilityHint: String,
|
|
959
|
+
accessibilityState: Object
|
|
891
960
|
},
|
|
892
961
|
emits: ["load", "error"],
|
|
893
962
|
setup(props, { emit }) {
|
|
@@ -935,7 +1004,11 @@ var VSlider = (0, import_runtime_core12.defineComponent)({
|
|
|
935
1004
|
modelValue: { type: Number, default: 0 },
|
|
936
1005
|
min: { type: Number, default: 0 },
|
|
937
1006
|
max: { type: Number, default: 1 },
|
|
938
|
-
style: { type: Object, default: () => ({}) }
|
|
1007
|
+
style: { type: Object, default: () => ({}) },
|
|
1008
|
+
accessibilityLabel: String,
|
|
1009
|
+
accessibilityRole: String,
|
|
1010
|
+
accessibilityHint: String,
|
|
1011
|
+
accessibilityState: Object
|
|
939
1012
|
},
|
|
940
1013
|
emits: ["update:modelValue", "change"],
|
|
941
1014
|
setup(props, { emit }) {
|
|
@@ -944,6 +1017,10 @@ var VSlider = (0, import_runtime_core12.defineComponent)({
|
|
|
944
1017
|
value: props.modelValue,
|
|
945
1018
|
minimumValue: props.min,
|
|
946
1019
|
maximumValue: props.max,
|
|
1020
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1021
|
+
accessibilityRole: props.accessibilityRole,
|
|
1022
|
+
accessibilityHint: props.accessibilityHint,
|
|
1023
|
+
accessibilityState: props.accessibilityState,
|
|
947
1024
|
onChange: (val) => {
|
|
948
1025
|
emit("update:modelValue", val);
|
|
949
1026
|
emit("change", val);
|
|
@@ -1230,6 +1307,352 @@ var VActionSheet = (0, import_runtime_core21.defineComponent)({
|
|
|
1230
1307
|
}
|
|
1231
1308
|
});
|
|
1232
1309
|
|
|
1310
|
+
// src/components/VRefreshControl.ts
|
|
1311
|
+
var import_runtime_core22 = require("@vue/runtime-core");
|
|
1312
|
+
var VRefreshControl = (0, import_runtime_core22.defineComponent)({
|
|
1313
|
+
name: "VRefreshControl",
|
|
1314
|
+
props: {
|
|
1315
|
+
refreshing: {
|
|
1316
|
+
type: Boolean,
|
|
1317
|
+
default: false
|
|
1318
|
+
},
|
|
1319
|
+
onRefresh: Function,
|
|
1320
|
+
tintColor: String,
|
|
1321
|
+
title: String,
|
|
1322
|
+
style: Object
|
|
1323
|
+
},
|
|
1324
|
+
setup(props) {
|
|
1325
|
+
return () => (0, import_runtime_core22.h)("VRefreshControl", {
|
|
1326
|
+
refreshing: props.refreshing,
|
|
1327
|
+
onRefresh: props.onRefresh,
|
|
1328
|
+
tintColor: props.tintColor,
|
|
1329
|
+
title: props.title
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
});
|
|
1333
|
+
|
|
1334
|
+
// src/components/VPressable.ts
|
|
1335
|
+
var import_runtime_core23 = require("@vue/runtime-core");
|
|
1336
|
+
var VPressable = (0, import_runtime_core23.defineComponent)({
|
|
1337
|
+
name: "VPressable",
|
|
1338
|
+
props: {
|
|
1339
|
+
style: Object,
|
|
1340
|
+
disabled: {
|
|
1341
|
+
type: Boolean,
|
|
1342
|
+
default: false
|
|
1343
|
+
},
|
|
1344
|
+
activeOpacity: {
|
|
1345
|
+
type: Number,
|
|
1346
|
+
default: 0.7
|
|
1347
|
+
},
|
|
1348
|
+
onPress: Function,
|
|
1349
|
+
onPressIn: Function,
|
|
1350
|
+
onPressOut: Function,
|
|
1351
|
+
onLongPress: Function,
|
|
1352
|
+
accessibilityLabel: String,
|
|
1353
|
+
accessibilityRole: String,
|
|
1354
|
+
accessibilityHint: String,
|
|
1355
|
+
accessibilityState: Object
|
|
1356
|
+
},
|
|
1357
|
+
setup(props, { slots }) {
|
|
1358
|
+
return () => (0, import_runtime_core23.h)(
|
|
1359
|
+
"VPressable",
|
|
1360
|
+
{
|
|
1361
|
+
...props,
|
|
1362
|
+
onPress: props.disabled ? void 0 : props.onPress,
|
|
1363
|
+
onPressIn: props.disabled ? void 0 : props.onPressIn,
|
|
1364
|
+
onPressOut: props.disabled ? void 0 : props.onPressOut,
|
|
1365
|
+
onLongPress: props.disabled ? void 0 : props.onLongPress
|
|
1366
|
+
},
|
|
1367
|
+
slots.default?.()
|
|
1368
|
+
);
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
// src/components/VSectionList.ts
|
|
1373
|
+
var import_runtime_core24 = require("@vue/runtime-core");
|
|
1374
|
+
var VSectionList = (0, import_runtime_core24.defineComponent)({
|
|
1375
|
+
name: "VSectionList",
|
|
1376
|
+
props: {
|
|
1377
|
+
/** Array of section objects, each with a title and data array */
|
|
1378
|
+
sections: {
|
|
1379
|
+
type: Array,
|
|
1380
|
+
required: true
|
|
1381
|
+
},
|
|
1382
|
+
/** Extract a unique key from each item. Defaults to index as string. */
|
|
1383
|
+
keyExtractor: {
|
|
1384
|
+
type: Function,
|
|
1385
|
+
default: (_item, index) => String(index)
|
|
1386
|
+
},
|
|
1387
|
+
/** Estimated height per row in points. Default: 44 */
|
|
1388
|
+
estimatedItemHeight: {
|
|
1389
|
+
type: Number,
|
|
1390
|
+
default: 44
|
|
1391
|
+
},
|
|
1392
|
+
/** Whether section headers stick to the top when scrolling. Default: true */
|
|
1393
|
+
stickySectionHeaders: {
|
|
1394
|
+
type: Boolean,
|
|
1395
|
+
default: true
|
|
1396
|
+
},
|
|
1397
|
+
/** Show vertical scroll indicator. Default: true */
|
|
1398
|
+
showsScrollIndicator: {
|
|
1399
|
+
type: Boolean,
|
|
1400
|
+
default: true
|
|
1401
|
+
},
|
|
1402
|
+
/** Enable bounce at scroll boundaries. Default: true */
|
|
1403
|
+
bounces: {
|
|
1404
|
+
type: Boolean,
|
|
1405
|
+
default: true
|
|
1406
|
+
},
|
|
1407
|
+
style: {
|
|
1408
|
+
type: Object,
|
|
1409
|
+
default: () => ({})
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
emits: ["scroll", "endReached"],
|
|
1413
|
+
setup(props, { slots, emit }) {
|
|
1414
|
+
return () => {
|
|
1415
|
+
const sections = props.sections ?? [];
|
|
1416
|
+
const children = [];
|
|
1417
|
+
if (slots.header) {
|
|
1418
|
+
children.push(
|
|
1419
|
+
(0, import_runtime_core24.h)("VView", { key: "__header__", style: { flexShrink: 0 } }, slots.header())
|
|
1420
|
+
);
|
|
1421
|
+
}
|
|
1422
|
+
const totalItems = sections.reduce((sum, s) => sum + (s.data?.length ?? 0), 0);
|
|
1423
|
+
if (totalItems === 0 && slots.empty) {
|
|
1424
|
+
children.push(
|
|
1425
|
+
(0, import_runtime_core24.h)("VView", { key: "__empty__", style: { flexShrink: 0 } }, slots.empty())
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) {
|
|
1429
|
+
const section = sections[sectionIndex];
|
|
1430
|
+
if (slots.sectionHeader) {
|
|
1431
|
+
children.push(
|
|
1432
|
+
(0, import_runtime_core24.h)(
|
|
1433
|
+
"VView",
|
|
1434
|
+
{
|
|
1435
|
+
key: `__section_header_${sectionIndex}__`,
|
|
1436
|
+
__sectionHeader: true,
|
|
1437
|
+
style: { flexShrink: 0 }
|
|
1438
|
+
},
|
|
1439
|
+
slots.sectionHeader({ section, index: sectionIndex })
|
|
1440
|
+
)
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
const items = section.data ?? [];
|
|
1444
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
1445
|
+
const item = items[itemIndex];
|
|
1446
|
+
children.push(
|
|
1447
|
+
(0, import_runtime_core24.h)(
|
|
1448
|
+
"VView",
|
|
1449
|
+
{
|
|
1450
|
+
key: `${sectionIndex}_${props.keyExtractor(item, itemIndex)}`,
|
|
1451
|
+
style: { flexShrink: 0 }
|
|
1452
|
+
},
|
|
1453
|
+
slots.item?.({ item, index: itemIndex, section }) ?? []
|
|
1454
|
+
)
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
if (slots.sectionFooter) {
|
|
1458
|
+
children.push(
|
|
1459
|
+
(0, import_runtime_core24.h)(
|
|
1460
|
+
"VView",
|
|
1461
|
+
{
|
|
1462
|
+
key: `__section_footer_${sectionIndex}__`,
|
|
1463
|
+
style: { flexShrink: 0 }
|
|
1464
|
+
},
|
|
1465
|
+
slots.sectionFooter({ section, index: sectionIndex })
|
|
1466
|
+
)
|
|
1467
|
+
);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
if (slots.footer) {
|
|
1471
|
+
children.push(
|
|
1472
|
+
(0, import_runtime_core24.h)("VView", { key: "__footer__", style: { flexShrink: 0 } }, slots.footer())
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
return (0, import_runtime_core24.h)(
|
|
1476
|
+
"VSectionList",
|
|
1477
|
+
{
|
|
1478
|
+
style: props.style,
|
|
1479
|
+
estimatedItemHeight: props.estimatedItemHeight,
|
|
1480
|
+
stickySectionHeaders: props.stickySectionHeaders,
|
|
1481
|
+
showsScrollIndicator: props.showsScrollIndicator,
|
|
1482
|
+
bounces: props.bounces,
|
|
1483
|
+
onScroll: (e) => emit("scroll", e),
|
|
1484
|
+
onEndReached: () => emit("endReached")
|
|
1485
|
+
},
|
|
1486
|
+
children
|
|
1487
|
+
);
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
// src/components/VCheckbox.ts
|
|
1493
|
+
var import_runtime_core25 = require("@vue/runtime-core");
|
|
1494
|
+
var VCheckbox = (0, import_runtime_core25.defineComponent)({
|
|
1495
|
+
name: "VCheckbox",
|
|
1496
|
+
props: {
|
|
1497
|
+
modelValue: {
|
|
1498
|
+
type: Boolean,
|
|
1499
|
+
default: false
|
|
1500
|
+
},
|
|
1501
|
+
disabled: {
|
|
1502
|
+
type: Boolean,
|
|
1503
|
+
default: false
|
|
1504
|
+
},
|
|
1505
|
+
label: {
|
|
1506
|
+
type: String,
|
|
1507
|
+
default: void 0
|
|
1508
|
+
},
|
|
1509
|
+
checkColor: String,
|
|
1510
|
+
tintColor: String,
|
|
1511
|
+
style: Object,
|
|
1512
|
+
accessibilityLabel: String,
|
|
1513
|
+
accessibilityHint: String
|
|
1514
|
+
},
|
|
1515
|
+
emits: ["update:modelValue", "change"],
|
|
1516
|
+
setup(props, { emit }) {
|
|
1517
|
+
const onChange = (payload) => {
|
|
1518
|
+
const value = typeof payload === "boolean" ? payload : !!(payload?.value ?? payload);
|
|
1519
|
+
emit("update:modelValue", value);
|
|
1520
|
+
emit("change", value);
|
|
1521
|
+
};
|
|
1522
|
+
return () => (0, import_runtime_core25.h)("VCheckbox", {
|
|
1523
|
+
value: props.modelValue,
|
|
1524
|
+
disabled: props.disabled,
|
|
1525
|
+
label: props.label,
|
|
1526
|
+
checkColor: props.checkColor,
|
|
1527
|
+
tintColor: props.tintColor,
|
|
1528
|
+
style: props.style,
|
|
1529
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1530
|
+
accessibilityHint: props.accessibilityHint,
|
|
1531
|
+
onChange
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
// src/components/VRadio.ts
|
|
1537
|
+
var import_runtime_core26 = require("@vue/runtime-core");
|
|
1538
|
+
var VRadio = (0, import_runtime_core26.defineComponent)({
|
|
1539
|
+
name: "VRadio",
|
|
1540
|
+
props: {
|
|
1541
|
+
modelValue: {
|
|
1542
|
+
type: String,
|
|
1543
|
+
default: void 0
|
|
1544
|
+
},
|
|
1545
|
+
options: {
|
|
1546
|
+
type: Array,
|
|
1547
|
+
required: true
|
|
1548
|
+
},
|
|
1549
|
+
disabled: {
|
|
1550
|
+
type: Boolean,
|
|
1551
|
+
default: false
|
|
1552
|
+
},
|
|
1553
|
+
tintColor: String,
|
|
1554
|
+
style: Object,
|
|
1555
|
+
accessibilityLabel: String
|
|
1556
|
+
},
|
|
1557
|
+
emits: ["update:modelValue", "change"],
|
|
1558
|
+
setup(props, { emit }) {
|
|
1559
|
+
const onChange = (payload) => {
|
|
1560
|
+
const value = payload?.value ?? payload;
|
|
1561
|
+
emit("update:modelValue", value);
|
|
1562
|
+
emit("change", value);
|
|
1563
|
+
};
|
|
1564
|
+
return () => (0, import_runtime_core26.h)("VRadio", {
|
|
1565
|
+
selectedValue: props.modelValue,
|
|
1566
|
+
options: props.options,
|
|
1567
|
+
disabled: props.disabled,
|
|
1568
|
+
tintColor: props.tintColor,
|
|
1569
|
+
style: props.style,
|
|
1570
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1571
|
+
onChange
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
|
|
1576
|
+
// src/components/VDropdown.ts
|
|
1577
|
+
var import_runtime_core27 = require("@vue/runtime-core");
|
|
1578
|
+
var VDropdown = (0, import_runtime_core27.defineComponent)({
|
|
1579
|
+
name: "VDropdown",
|
|
1580
|
+
props: {
|
|
1581
|
+
modelValue: {
|
|
1582
|
+
type: String,
|
|
1583
|
+
default: void 0
|
|
1584
|
+
},
|
|
1585
|
+
options: {
|
|
1586
|
+
type: Array,
|
|
1587
|
+
required: true
|
|
1588
|
+
},
|
|
1589
|
+
placeholder: {
|
|
1590
|
+
type: String,
|
|
1591
|
+
default: "Select..."
|
|
1592
|
+
},
|
|
1593
|
+
disabled: {
|
|
1594
|
+
type: Boolean,
|
|
1595
|
+
default: false
|
|
1596
|
+
},
|
|
1597
|
+
tintColor: String,
|
|
1598
|
+
style: Object,
|
|
1599
|
+
accessibilityLabel: String
|
|
1600
|
+
},
|
|
1601
|
+
emits: ["update:modelValue", "change"],
|
|
1602
|
+
setup(props, { emit }) {
|
|
1603
|
+
const onChange = (payload) => {
|
|
1604
|
+
const value = payload?.value ?? payload;
|
|
1605
|
+
emit("update:modelValue", value);
|
|
1606
|
+
emit("change", value);
|
|
1607
|
+
};
|
|
1608
|
+
return () => (0, import_runtime_core27.h)("VDropdown", {
|
|
1609
|
+
selectedValue: props.modelValue,
|
|
1610
|
+
options: props.options,
|
|
1611
|
+
placeholder: props.placeholder,
|
|
1612
|
+
disabled: props.disabled,
|
|
1613
|
+
tintColor: props.tintColor,
|
|
1614
|
+
style: props.style,
|
|
1615
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1616
|
+
onChange
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1620
|
+
|
|
1621
|
+
// src/components/VVideo.ts
|
|
1622
|
+
var import_runtime_core28 = require("@vue/runtime-core");
|
|
1623
|
+
var VVideo = (0, import_runtime_core28.defineComponent)({
|
|
1624
|
+
name: "VVideo",
|
|
1625
|
+
props: {
|
|
1626
|
+
source: Object,
|
|
1627
|
+
autoplay: { type: Boolean, default: false },
|
|
1628
|
+
loop: { type: Boolean, default: false },
|
|
1629
|
+
muted: { type: Boolean, default: false },
|
|
1630
|
+
paused: { type: Boolean, default: false },
|
|
1631
|
+
controls: { type: Boolean, default: true },
|
|
1632
|
+
volume: { type: Number, default: 1 },
|
|
1633
|
+
resizeMode: {
|
|
1634
|
+
type: String,
|
|
1635
|
+
default: "cover"
|
|
1636
|
+
},
|
|
1637
|
+
poster: String,
|
|
1638
|
+
style: Object,
|
|
1639
|
+
testID: String,
|
|
1640
|
+
accessibilityLabel: String
|
|
1641
|
+
},
|
|
1642
|
+
emits: ["ready", "play", "pause", "end", "error", "progress"],
|
|
1643
|
+
setup(props, { emit }) {
|
|
1644
|
+
return () => (0, import_runtime_core28.h)("VVideo", {
|
|
1645
|
+
...props,
|
|
1646
|
+
onReady: (e) => emit("ready", e),
|
|
1647
|
+
onPlay: () => emit("play"),
|
|
1648
|
+
onPause: () => emit("pause"),
|
|
1649
|
+
onEnd: () => emit("end"),
|
|
1650
|
+
onError: (e) => emit("error", e),
|
|
1651
|
+
onProgress: (e) => emit("progress", e)
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
|
|
1233
1656
|
// src/directives/vShow.ts
|
|
1234
1657
|
var vShow = {
|
|
1235
1658
|
beforeMount(el, { value }) {
|
|
@@ -1241,6 +1664,51 @@ var vShow = {
|
|
|
1241
1664
|
}
|
|
1242
1665
|
};
|
|
1243
1666
|
|
|
1667
|
+
// src/errorBoundary.ts
|
|
1668
|
+
var import_runtime_core29 = require("@vue/runtime-core");
|
|
1669
|
+
var ErrorBoundary = (0, import_runtime_core29.defineComponent)({
|
|
1670
|
+
name: "ErrorBoundary",
|
|
1671
|
+
props: {
|
|
1672
|
+
onError: Function,
|
|
1673
|
+
resetKeys: {
|
|
1674
|
+
type: Array,
|
|
1675
|
+
default: () => []
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
setup(props, { slots }) {
|
|
1679
|
+
const error = (0, import_runtime_core29.ref)(null);
|
|
1680
|
+
const errorInfo = (0, import_runtime_core29.ref)("");
|
|
1681
|
+
(0, import_runtime_core29.onErrorCaptured)((err, _instance, info) => {
|
|
1682
|
+
const normalizedError = err instanceof Error ? err : new Error(String(err));
|
|
1683
|
+
error.value = normalizedError;
|
|
1684
|
+
errorInfo.value = info;
|
|
1685
|
+
if (props.onError) {
|
|
1686
|
+
props.onError(normalizedError, info);
|
|
1687
|
+
}
|
|
1688
|
+
return false;
|
|
1689
|
+
});
|
|
1690
|
+
function reset() {
|
|
1691
|
+
error.value = null;
|
|
1692
|
+
errorInfo.value = "";
|
|
1693
|
+
}
|
|
1694
|
+
(0, import_runtime_core29.watch)(
|
|
1695
|
+
() => props.resetKeys,
|
|
1696
|
+
() => {
|
|
1697
|
+
if (error.value) {
|
|
1698
|
+
reset();
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
{ deep: true }
|
|
1702
|
+
);
|
|
1703
|
+
return () => {
|
|
1704
|
+
if (error.value && slots.fallback) {
|
|
1705
|
+
return slots.fallback({ error: error.value, errorInfo: errorInfo.value, reset });
|
|
1706
|
+
}
|
|
1707
|
+
return slots.default?.();
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
|
|
1244
1712
|
// src/index.ts
|
|
1245
1713
|
__reExport(index_exports, require("@vue/runtime-core"), module.exports);
|
|
1246
1714
|
|
|
@@ -1285,6 +1753,7 @@ var validStyleProperties = /* @__PURE__ */ new Set([
|
|
|
1285
1753
|
"gap",
|
|
1286
1754
|
"rowGap",
|
|
1287
1755
|
"columnGap",
|
|
1756
|
+
"direction",
|
|
1288
1757
|
"display",
|
|
1289
1758
|
"overflow",
|
|
1290
1759
|
"zIndex",
|
|
@@ -1332,7 +1801,15 @@ var validStyleProperties = /* @__PURE__ */ new Set([
|
|
|
1332
1801
|
"resizeMode",
|
|
1333
1802
|
"tintColor",
|
|
1334
1803
|
// Transform
|
|
1335
|
-
"transform"
|
|
1804
|
+
"transform",
|
|
1805
|
+
// Accessibility
|
|
1806
|
+
"accessibilityLabel",
|
|
1807
|
+
"accessibilityRole",
|
|
1808
|
+
"accessibilityHint",
|
|
1809
|
+
"accessibilityState",
|
|
1810
|
+
"accessibilityValue",
|
|
1811
|
+
"accessible",
|
|
1812
|
+
"importantForAccessibility"
|
|
1336
1813
|
]);
|
|
1337
1814
|
function createStyleSheet(styles) {
|
|
1338
1815
|
const isDev = typeof __DEV__ !== "undefined" ? __DEV__ : true;
|
|
@@ -1390,9 +1867,9 @@ function useAsyncStorage() {
|
|
|
1390
1867
|
}
|
|
1391
1868
|
|
|
1392
1869
|
// src/composables/useClipboard.ts
|
|
1393
|
-
var
|
|
1870
|
+
var import_runtime_core30 = require("@vue/runtime-core");
|
|
1394
1871
|
function useClipboard() {
|
|
1395
|
-
const content = (0,
|
|
1872
|
+
const content = (0, import_runtime_core30.ref)("");
|
|
1396
1873
|
function copy(text) {
|
|
1397
1874
|
return NativeBridge.invokeNativeModule("Clipboard", "copy", [text]).then(() => void 0);
|
|
1398
1875
|
}
|
|
@@ -1406,16 +1883,16 @@ function useClipboard() {
|
|
|
1406
1883
|
}
|
|
1407
1884
|
|
|
1408
1885
|
// src/composables/useDeviceInfo.ts
|
|
1409
|
-
var
|
|
1886
|
+
var import_runtime_core31 = require("@vue/runtime-core");
|
|
1410
1887
|
function useDeviceInfo() {
|
|
1411
|
-
const model = (0,
|
|
1412
|
-
const systemVersion = (0,
|
|
1413
|
-
const systemName = (0,
|
|
1414
|
-
const name = (0,
|
|
1415
|
-
const screenWidth = (0,
|
|
1416
|
-
const screenHeight = (0,
|
|
1417
|
-
const scale = (0,
|
|
1418
|
-
const isLoaded = (0,
|
|
1888
|
+
const model = (0, import_runtime_core31.ref)("");
|
|
1889
|
+
const systemVersion = (0, import_runtime_core31.ref)("");
|
|
1890
|
+
const systemName = (0, import_runtime_core31.ref)("");
|
|
1891
|
+
const name = (0, import_runtime_core31.ref)("");
|
|
1892
|
+
const screenWidth = (0, import_runtime_core31.ref)(0);
|
|
1893
|
+
const screenHeight = (0, import_runtime_core31.ref)(0);
|
|
1894
|
+
const scale = (0, import_runtime_core31.ref)(1);
|
|
1895
|
+
const isLoaded = (0, import_runtime_core31.ref)(false);
|
|
1419
1896
|
async function fetchInfo() {
|
|
1420
1897
|
const info = await NativeBridge.invokeNativeModule("DeviceInfo", "getInfo", []);
|
|
1421
1898
|
model.value = info.model ?? "";
|
|
@@ -1427,7 +1904,7 @@ function useDeviceInfo() {
|
|
|
1427
1904
|
scale.value = info.scale ?? 1;
|
|
1428
1905
|
isLoaded.value = true;
|
|
1429
1906
|
}
|
|
1430
|
-
(0,
|
|
1907
|
+
(0, import_runtime_core31.onMounted)(() => {
|
|
1431
1908
|
fetchInfo();
|
|
1432
1909
|
});
|
|
1433
1910
|
return {
|
|
@@ -1444,10 +1921,10 @@ function useDeviceInfo() {
|
|
|
1444
1921
|
}
|
|
1445
1922
|
|
|
1446
1923
|
// src/composables/useKeyboard.ts
|
|
1447
|
-
var
|
|
1924
|
+
var import_runtime_core32 = require("@vue/runtime-core");
|
|
1448
1925
|
function useKeyboard() {
|
|
1449
|
-
const isVisible = (0,
|
|
1450
|
-
const height = (0,
|
|
1926
|
+
const isVisible = (0, import_runtime_core32.ref)(false);
|
|
1927
|
+
const height = (0, import_runtime_core32.ref)(0);
|
|
1451
1928
|
function dismiss() {
|
|
1452
1929
|
return NativeBridge.invokeNativeModule("Keyboard", "dismiss", []).then(() => void 0);
|
|
1453
1930
|
}
|
|
@@ -1511,10 +1988,10 @@ function useAnimation() {
|
|
|
1511
1988
|
}
|
|
1512
1989
|
|
|
1513
1990
|
// src/composables/useNetwork.ts
|
|
1514
|
-
var
|
|
1991
|
+
var import_runtime_core33 = require("@vue/runtime-core");
|
|
1515
1992
|
function useNetwork() {
|
|
1516
|
-
const isConnected = (0,
|
|
1517
|
-
const connectionType = (0,
|
|
1993
|
+
const isConnected = (0, import_runtime_core33.ref)(true);
|
|
1994
|
+
const connectionType = (0, import_runtime_core33.ref)("unknown");
|
|
1518
1995
|
NativeBridge.invokeNativeModule("Network", "getStatus").then((status) => {
|
|
1519
1996
|
isConnected.value = status.isConnected;
|
|
1520
1997
|
connectionType.value = status.connectionType;
|
|
@@ -1524,14 +2001,14 @@ function useNetwork() {
|
|
|
1524
2001
|
isConnected.value = payload.isConnected;
|
|
1525
2002
|
connectionType.value = payload.connectionType;
|
|
1526
2003
|
});
|
|
1527
|
-
(0,
|
|
2004
|
+
(0, import_runtime_core33.onUnmounted)(unsubscribe);
|
|
1528
2005
|
return { isConnected, connectionType };
|
|
1529
2006
|
}
|
|
1530
2007
|
|
|
1531
2008
|
// src/composables/useAppState.ts
|
|
1532
|
-
var
|
|
2009
|
+
var import_runtime_core34 = require("@vue/runtime-core");
|
|
1533
2010
|
function useAppState() {
|
|
1534
|
-
const state = (0,
|
|
2011
|
+
const state = (0, import_runtime_core34.ref)("active");
|
|
1535
2012
|
NativeBridge.invokeNativeModule("AppState", "getState").then((s) => {
|
|
1536
2013
|
state.value = s;
|
|
1537
2014
|
}).catch(() => {
|
|
@@ -1539,7 +2016,7 @@ function useAppState() {
|
|
|
1539
2016
|
const unsubscribe = NativeBridge.onGlobalEvent("appState:change", (payload) => {
|
|
1540
2017
|
state.value = payload.state;
|
|
1541
2018
|
});
|
|
1542
|
-
(0,
|
|
2019
|
+
(0, import_runtime_core34.onUnmounted)(unsubscribe);
|
|
1543
2020
|
return { state };
|
|
1544
2021
|
}
|
|
1545
2022
|
|
|
@@ -1574,10 +2051,10 @@ function usePermissions() {
|
|
|
1574
2051
|
}
|
|
1575
2052
|
|
|
1576
2053
|
// src/composables/useGeolocation.ts
|
|
1577
|
-
var
|
|
2054
|
+
var import_runtime_core35 = require("@vue/runtime-core");
|
|
1578
2055
|
function useGeolocation() {
|
|
1579
|
-
const coords = (0,
|
|
1580
|
-
const error = (0,
|
|
2056
|
+
const coords = (0, import_runtime_core35.ref)(null);
|
|
2057
|
+
const error = (0, import_runtime_core35.ref)(null);
|
|
1581
2058
|
let watchId = null;
|
|
1582
2059
|
async function getCurrentPosition() {
|
|
1583
2060
|
const result = await NativeBridge.invokeNativeModule("Geolocation", "getCurrentPosition");
|
|
@@ -1590,7 +2067,7 @@ function useGeolocation() {
|
|
|
1590
2067
|
const unsubscribe = NativeBridge.onGlobalEvent("location:update", (payload) => {
|
|
1591
2068
|
coords.value = payload;
|
|
1592
2069
|
});
|
|
1593
|
-
(0,
|
|
2070
|
+
(0, import_runtime_core35.onUnmounted)(() => {
|
|
1594
2071
|
unsubscribe();
|
|
1595
2072
|
if (watchId !== null) clearWatch(watchId);
|
|
1596
2073
|
});
|
|
@@ -1604,20 +2081,43 @@ function useGeolocation() {
|
|
|
1604
2081
|
}
|
|
1605
2082
|
|
|
1606
2083
|
// src/composables/useCamera.ts
|
|
2084
|
+
var import_runtime_core36 = require("@vue/runtime-core");
|
|
1607
2085
|
function useCamera() {
|
|
2086
|
+
const qrCleanups = [];
|
|
1608
2087
|
async function launchCamera(options = {}) {
|
|
1609
2088
|
return NativeBridge.invokeNativeModule("Camera", "launchCamera", [options]);
|
|
1610
2089
|
}
|
|
1611
2090
|
async function launchImageLibrary(options = {}) {
|
|
1612
2091
|
return NativeBridge.invokeNativeModule("Camera", "launchImageLibrary", [options]);
|
|
1613
2092
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
2093
|
+
async function captureVideo(options = {}) {
|
|
2094
|
+
return NativeBridge.invokeNativeModule("Camera", "captureVideo", [options]);
|
|
2095
|
+
}
|
|
2096
|
+
async function scanQRCode() {
|
|
2097
|
+
return NativeBridge.invokeNativeModule("Camera", "scanQRCode");
|
|
2098
|
+
}
|
|
2099
|
+
async function stopQRScan() {
|
|
2100
|
+
return NativeBridge.invokeNativeModule("Camera", "stopQRScan");
|
|
2101
|
+
}
|
|
2102
|
+
function onQRCodeDetected(callback) {
|
|
2103
|
+
const unsubscribe = NativeBridge.onGlobalEvent("camera:qrDetected", callback);
|
|
2104
|
+
qrCleanups.push(unsubscribe);
|
|
2105
|
+
return unsubscribe;
|
|
2106
|
+
}
|
|
2107
|
+
(0, import_runtime_core36.onUnmounted)(() => {
|
|
2108
|
+
NativeBridge.invokeNativeModule("Camera", "stopQRScan").catch(() => {
|
|
2109
|
+
});
|
|
2110
|
+
qrCleanups.forEach((fn) => fn());
|
|
2111
|
+
qrCleanups.length = 0;
|
|
2112
|
+
});
|
|
2113
|
+
return { launchCamera, launchImageLibrary, captureVideo, scanQRCode, stopQRScan, onQRCodeDetected };
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
// src/composables/useNotifications.ts
|
|
2117
|
+
var import_runtime_core37 = require("@vue/runtime-core");
|
|
1619
2118
|
function useNotifications() {
|
|
1620
|
-
const isGranted = (0,
|
|
2119
|
+
const isGranted = (0, import_runtime_core37.ref)(false);
|
|
2120
|
+
const pushToken = (0, import_runtime_core37.ref)(null);
|
|
1621
2121
|
async function requestPermission() {
|
|
1622
2122
|
const granted = await NativeBridge.invokeNativeModule("Notifications", "requestPermission");
|
|
1623
2123
|
isGranted.value = granted;
|
|
@@ -1637,10 +2137,44 @@ function useNotifications() {
|
|
|
1637
2137
|
}
|
|
1638
2138
|
function onNotification(handler) {
|
|
1639
2139
|
const unsubscribe = NativeBridge.onGlobalEvent("notification:received", handler);
|
|
1640
|
-
(0,
|
|
2140
|
+
(0, import_runtime_core37.onUnmounted)(unsubscribe);
|
|
2141
|
+
return unsubscribe;
|
|
2142
|
+
}
|
|
2143
|
+
async function registerForPush() {
|
|
2144
|
+
await NativeBridge.invokeNativeModule("Notifications", "registerForPush");
|
|
2145
|
+
}
|
|
2146
|
+
async function getToken() {
|
|
2147
|
+
return NativeBridge.invokeNativeModule("Notifications", "getToken");
|
|
2148
|
+
}
|
|
2149
|
+
function onPushToken(handler) {
|
|
2150
|
+
const unsubscribe = NativeBridge.onGlobalEvent("push:token", (payload) => {
|
|
2151
|
+
pushToken.value = payload.token;
|
|
2152
|
+
handler(payload.token);
|
|
2153
|
+
});
|
|
2154
|
+
(0, import_runtime_core37.onUnmounted)(unsubscribe);
|
|
2155
|
+
return unsubscribe;
|
|
2156
|
+
}
|
|
2157
|
+
function onPushReceived(handler) {
|
|
2158
|
+
const unsubscribe = NativeBridge.onGlobalEvent("push:received", handler);
|
|
2159
|
+
(0, import_runtime_core37.onUnmounted)(unsubscribe);
|
|
1641
2160
|
return unsubscribe;
|
|
1642
2161
|
}
|
|
1643
|
-
return {
|
|
2162
|
+
return {
|
|
2163
|
+
// Local
|
|
2164
|
+
isGranted,
|
|
2165
|
+
requestPermission,
|
|
2166
|
+
getPermissionStatus,
|
|
2167
|
+
scheduleLocal,
|
|
2168
|
+
cancel,
|
|
2169
|
+
cancelAll,
|
|
2170
|
+
onNotification,
|
|
2171
|
+
// Push
|
|
2172
|
+
pushToken,
|
|
2173
|
+
registerForPush,
|
|
2174
|
+
getToken,
|
|
2175
|
+
onPushToken,
|
|
2176
|
+
onPushReceived
|
|
2177
|
+
};
|
|
1644
2178
|
}
|
|
1645
2179
|
|
|
1646
2180
|
// src/composables/useBiometry.ts
|
|
@@ -1658,10 +2192,18 @@ function useBiometry() {
|
|
|
1658
2192
|
}
|
|
1659
2193
|
|
|
1660
2194
|
// src/composables/useHttp.ts
|
|
1661
|
-
var
|
|
2195
|
+
var import_runtime_core38 = require("@vue/runtime-core");
|
|
1662
2196
|
function useHttp(config = {}) {
|
|
1663
|
-
|
|
1664
|
-
|
|
2197
|
+
if (config.pins && Object.keys(config.pins).length > 0) {
|
|
2198
|
+
const configurePins = globalThis.__VN_configurePins;
|
|
2199
|
+
if (typeof configurePins === "function") {
|
|
2200
|
+
configurePins(JSON.stringify(config.pins));
|
|
2201
|
+
} else {
|
|
2202
|
+
NativeBridge.invokeNativeModule("Http", "configurePins", [config.pins]);
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
const loading = (0, import_runtime_core38.ref)(false);
|
|
2206
|
+
const error = (0, import_runtime_core38.ref)(null);
|
|
1665
2207
|
async function request(method, url, options = {}) {
|
|
1666
2208
|
const fullUrl = config.baseURL ? `${config.baseURL}${url}` : url;
|
|
1667
2209
|
loading.value = true;
|
|
@@ -1707,10 +2249,10 @@ function useHttp(config = {}) {
|
|
|
1707
2249
|
}
|
|
1708
2250
|
|
|
1709
2251
|
// src/composables/useColorScheme.ts
|
|
1710
|
-
var
|
|
2252
|
+
var import_runtime_core39 = require("@vue/runtime-core");
|
|
1711
2253
|
function useColorScheme() {
|
|
1712
|
-
const colorScheme = (0,
|
|
1713
|
-
const isDark = (0,
|
|
2254
|
+
const colorScheme = (0, import_runtime_core39.ref)("light");
|
|
2255
|
+
const isDark = (0, import_runtime_core39.ref)(false);
|
|
1714
2256
|
const unsubscribe = NativeBridge.onGlobalEvent(
|
|
1715
2257
|
"colorScheme:change",
|
|
1716
2258
|
(payload) => {
|
|
@@ -1718,23 +2260,1067 @@ function useColorScheme() {
|
|
|
1718
2260
|
isDark.value = payload.colorScheme === "dark";
|
|
1719
2261
|
}
|
|
1720
2262
|
);
|
|
1721
|
-
(0,
|
|
2263
|
+
(0, import_runtime_core39.onUnmounted)(unsubscribe);
|
|
1722
2264
|
return { colorScheme, isDark };
|
|
1723
2265
|
}
|
|
1724
2266
|
|
|
1725
2267
|
// src/composables/useBackHandler.ts
|
|
1726
|
-
var
|
|
2268
|
+
var import_runtime_core40 = require("@vue/runtime-core");
|
|
1727
2269
|
function useBackHandler(handler) {
|
|
1728
2270
|
let unsubscribe = null;
|
|
1729
|
-
(0,
|
|
2271
|
+
(0, import_runtime_core40.onMounted)(() => {
|
|
1730
2272
|
unsubscribe = NativeBridge.onGlobalEvent("hardware:backPress", () => {
|
|
1731
2273
|
handler();
|
|
1732
2274
|
});
|
|
1733
2275
|
});
|
|
1734
|
-
(0,
|
|
2276
|
+
(0, import_runtime_core40.onUnmounted)(() => {
|
|
2277
|
+
unsubscribe?.();
|
|
2278
|
+
unsubscribe = null;
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
// src/composables/useSecureStorage.ts
|
|
2283
|
+
function useSecureStorage() {
|
|
2284
|
+
function getItem(key) {
|
|
2285
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "get", [key]);
|
|
2286
|
+
}
|
|
2287
|
+
function setItem(key, value) {
|
|
2288
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "set", [key, value]).then(() => void 0);
|
|
2289
|
+
}
|
|
2290
|
+
function removeItem(key) {
|
|
2291
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "remove", [key]).then(() => void 0);
|
|
2292
|
+
}
|
|
2293
|
+
function clear() {
|
|
2294
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "clear", []).then(() => void 0);
|
|
2295
|
+
}
|
|
2296
|
+
return { getItem, setItem, removeItem, clear };
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
// src/composables/useI18n.ts
|
|
2300
|
+
var import_runtime_core41 = require("@vue/runtime-core");
|
|
2301
|
+
function useI18n() {
|
|
2302
|
+
const isRTL = (0, import_runtime_core41.ref)(false);
|
|
2303
|
+
const locale = (0, import_runtime_core41.ref)("en");
|
|
2304
|
+
(0, import_runtime_core41.onMounted)(async () => {
|
|
2305
|
+
try {
|
|
2306
|
+
const info = await NativeBridge.invokeNativeModule("DeviceInfo", "getDeviceInfo", []);
|
|
2307
|
+
locale.value = info?.locale || "en";
|
|
2308
|
+
isRTL.value = ["ar", "he", "fa", "ur"].some((l) => locale.value.startsWith(l));
|
|
2309
|
+
} catch {
|
|
2310
|
+
}
|
|
2311
|
+
});
|
|
2312
|
+
return { isRTL, locale };
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
// src/composables/usePlatform.ts
|
|
2316
|
+
function usePlatform() {
|
|
2317
|
+
const platform = typeof __PLATFORM__ !== "undefined" ? __PLATFORM__ : "ios";
|
|
2318
|
+
const isIOS = platform === "ios";
|
|
2319
|
+
const isAndroid = platform === "android";
|
|
2320
|
+
return { platform, isIOS, isAndroid };
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
// src/composables/useDimensions.ts
|
|
2324
|
+
var import_runtime_core42 = require("@vue/runtime-core");
|
|
2325
|
+
function useDimensions() {
|
|
2326
|
+
const width = (0, import_runtime_core42.ref)(0);
|
|
2327
|
+
const height = (0, import_runtime_core42.ref)(0);
|
|
2328
|
+
const scale = (0, import_runtime_core42.ref)(1);
|
|
2329
|
+
(0, import_runtime_core42.onMounted)(async () => {
|
|
2330
|
+
try {
|
|
2331
|
+
const info = await NativeBridge.invokeNativeModule("DeviceInfo", "getInfo", []);
|
|
2332
|
+
width.value = info?.screenWidth || 0;
|
|
2333
|
+
height.value = info?.screenHeight || 0;
|
|
2334
|
+
scale.value = info?.scale || 1;
|
|
2335
|
+
} catch {
|
|
2336
|
+
}
|
|
2337
|
+
});
|
|
2338
|
+
const cleanup = NativeBridge.onGlobalEvent("dimensionsChange", (payload) => {
|
|
2339
|
+
if (payload.width != null) width.value = payload.width;
|
|
2340
|
+
if (payload.height != null) height.value = payload.height;
|
|
2341
|
+
if (payload.scale != null) scale.value = payload.scale;
|
|
2342
|
+
});
|
|
2343
|
+
(0, import_runtime_core42.onUnmounted)(cleanup);
|
|
2344
|
+
return { width, height, scale };
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
// src/composables/useWebSocket.ts
|
|
2348
|
+
var import_runtime_core43 = require("@vue/runtime-core");
|
|
2349
|
+
var connectionCounter = 0;
|
|
2350
|
+
function useWebSocket(url, options = {}) {
|
|
2351
|
+
const {
|
|
2352
|
+
autoConnect = true,
|
|
2353
|
+
autoReconnect = false,
|
|
2354
|
+
maxReconnectAttempts = 3,
|
|
2355
|
+
reconnectInterval = 1e3
|
|
2356
|
+
} = options;
|
|
2357
|
+
const connectionId = `ws_${++connectionCounter}_${Date.now()}`;
|
|
2358
|
+
const status = (0, import_runtime_core43.ref)("CLOSED");
|
|
2359
|
+
const lastMessage = (0, import_runtime_core43.ref)(null);
|
|
2360
|
+
const error = (0, import_runtime_core43.ref)(null);
|
|
2361
|
+
let reconnectAttempts = 0;
|
|
2362
|
+
let reconnectTimer = null;
|
|
2363
|
+
const unsubscribers = [];
|
|
2364
|
+
unsubscribers.push(
|
|
2365
|
+
NativeBridge.onGlobalEvent("websocket:open", (payload) => {
|
|
2366
|
+
if (payload.connectionId !== connectionId) return;
|
|
2367
|
+
status.value = "OPEN";
|
|
2368
|
+
error.value = null;
|
|
2369
|
+
reconnectAttempts = 0;
|
|
2370
|
+
})
|
|
2371
|
+
);
|
|
2372
|
+
unsubscribers.push(
|
|
2373
|
+
NativeBridge.onGlobalEvent("websocket:message", (payload) => {
|
|
2374
|
+
if (payload.connectionId !== connectionId) return;
|
|
2375
|
+
lastMessage.value = payload.data;
|
|
2376
|
+
})
|
|
2377
|
+
);
|
|
2378
|
+
unsubscribers.push(
|
|
2379
|
+
NativeBridge.onGlobalEvent("websocket:close", (payload) => {
|
|
2380
|
+
if (payload.connectionId !== connectionId) return;
|
|
2381
|
+
status.value = "CLOSED";
|
|
2382
|
+
if (autoReconnect && reconnectAttempts < maxReconnectAttempts && payload.code !== 1e3) {
|
|
2383
|
+
reconnectAttempts++;
|
|
2384
|
+
reconnectTimer = setTimeout(() => {
|
|
2385
|
+
open();
|
|
2386
|
+
}, reconnectInterval);
|
|
2387
|
+
}
|
|
2388
|
+
})
|
|
2389
|
+
);
|
|
2390
|
+
unsubscribers.push(
|
|
2391
|
+
NativeBridge.onGlobalEvent("websocket:error", (payload) => {
|
|
2392
|
+
if (payload.connectionId !== connectionId) return;
|
|
2393
|
+
error.value = payload.message;
|
|
2394
|
+
})
|
|
2395
|
+
);
|
|
2396
|
+
function open() {
|
|
2397
|
+
if (status.value === "OPEN" || status.value === "CONNECTING") return;
|
|
2398
|
+
status.value = "CONNECTING";
|
|
2399
|
+
error.value = null;
|
|
2400
|
+
NativeBridge.invokeNativeModule("WebSocket", "connect", [url, connectionId]).catch((err) => {
|
|
2401
|
+
status.value = "CLOSED";
|
|
2402
|
+
error.value = err.message;
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
function send(data) {
|
|
2406
|
+
if (status.value !== "OPEN") return;
|
|
2407
|
+
const message = typeof data === "string" ? data : JSON.stringify(data);
|
|
2408
|
+
NativeBridge.invokeNativeModule("WebSocket", "send", [connectionId, message]).catch((err) => {
|
|
2409
|
+
error.value = err.message;
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
function close(code, reason) {
|
|
2413
|
+
if (status.value === "CLOSED" || status.value === "CLOSING") return;
|
|
2414
|
+
status.value = "CLOSING";
|
|
2415
|
+
if (reconnectTimer) {
|
|
2416
|
+
clearTimeout(reconnectTimer);
|
|
2417
|
+
reconnectTimer = null;
|
|
2418
|
+
}
|
|
2419
|
+
reconnectAttempts = maxReconnectAttempts;
|
|
2420
|
+
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, code ?? 1e3, reason ?? ""]).catch(() => {
|
|
2421
|
+
status.value = "CLOSED";
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
if (autoConnect) {
|
|
2425
|
+
open();
|
|
2426
|
+
}
|
|
2427
|
+
(0, import_runtime_core43.onUnmounted)(() => {
|
|
2428
|
+
if (reconnectTimer) {
|
|
2429
|
+
clearTimeout(reconnectTimer);
|
|
2430
|
+
}
|
|
2431
|
+
if (status.value === "OPEN" || status.value === "CONNECTING") {
|
|
2432
|
+
reconnectAttempts = maxReconnectAttempts;
|
|
2433
|
+
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, 1e3, ""]).catch(() => {
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2436
|
+
unsubscribers.forEach((unsub) => unsub());
|
|
2437
|
+
});
|
|
2438
|
+
return { status, lastMessage, error, send, close, open };
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
// src/composables/useFileSystem.ts
|
|
2442
|
+
function useFileSystem() {
|
|
2443
|
+
function readFile(path, encoding) {
|
|
2444
|
+
return NativeBridge.invokeNativeModule("FileSystem", "readFile", [path, encoding ?? "utf8"]);
|
|
2445
|
+
}
|
|
2446
|
+
function writeFile(path, content, encoding) {
|
|
2447
|
+
return NativeBridge.invokeNativeModule("FileSystem", "writeFile", [path, content, encoding ?? "utf8"]).then(() => void 0);
|
|
2448
|
+
}
|
|
2449
|
+
function deleteFile(path) {
|
|
2450
|
+
return NativeBridge.invokeNativeModule("FileSystem", "deleteFile", [path]).then(() => void 0);
|
|
2451
|
+
}
|
|
2452
|
+
function exists(path) {
|
|
2453
|
+
return NativeBridge.invokeNativeModule("FileSystem", "exists", [path]);
|
|
2454
|
+
}
|
|
2455
|
+
function listDirectory(path) {
|
|
2456
|
+
return NativeBridge.invokeNativeModule("FileSystem", "listDirectory", [path]);
|
|
2457
|
+
}
|
|
2458
|
+
function downloadFile(url, destPath) {
|
|
2459
|
+
return NativeBridge.invokeNativeModule("FileSystem", "downloadFile", [url, destPath]);
|
|
2460
|
+
}
|
|
2461
|
+
function getDocumentsPath() {
|
|
2462
|
+
return NativeBridge.invokeNativeModule("FileSystem", "getDocumentsPath", []);
|
|
2463
|
+
}
|
|
2464
|
+
function getCachesPath() {
|
|
2465
|
+
return NativeBridge.invokeNativeModule("FileSystem", "getCachesPath", []);
|
|
2466
|
+
}
|
|
2467
|
+
function stat(path) {
|
|
2468
|
+
return NativeBridge.invokeNativeModule("FileSystem", "stat", [path]);
|
|
2469
|
+
}
|
|
2470
|
+
function mkdir(path) {
|
|
2471
|
+
return NativeBridge.invokeNativeModule("FileSystem", "mkdir", [path]).then(() => void 0);
|
|
2472
|
+
}
|
|
2473
|
+
function copyFile(srcPath, destPath) {
|
|
2474
|
+
return NativeBridge.invokeNativeModule("FileSystem", "copyFile", [srcPath, destPath]).then(() => void 0);
|
|
2475
|
+
}
|
|
2476
|
+
function moveFile(srcPath, destPath) {
|
|
2477
|
+
return NativeBridge.invokeNativeModule("FileSystem", "moveFile", [srcPath, destPath]).then(() => void 0);
|
|
2478
|
+
}
|
|
2479
|
+
return {
|
|
2480
|
+
readFile,
|
|
2481
|
+
writeFile,
|
|
2482
|
+
deleteFile,
|
|
2483
|
+
exists,
|
|
2484
|
+
listDirectory,
|
|
2485
|
+
downloadFile,
|
|
2486
|
+
getDocumentsPath,
|
|
2487
|
+
getCachesPath,
|
|
2488
|
+
stat,
|
|
2489
|
+
mkdir,
|
|
2490
|
+
copyFile,
|
|
2491
|
+
moveFile
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
// src/composables/useSensors.ts
|
|
2496
|
+
var import_runtime_core44 = require("@vue/runtime-core");
|
|
2497
|
+
function useAccelerometer(options = {}) {
|
|
2498
|
+
const x = (0, import_runtime_core44.ref)(0);
|
|
2499
|
+
const y = (0, import_runtime_core44.ref)(0);
|
|
2500
|
+
const z = (0, import_runtime_core44.ref)(0);
|
|
2501
|
+
const isAvailable = (0, import_runtime_core44.ref)(false);
|
|
2502
|
+
let running = false;
|
|
2503
|
+
let unsubscribe = null;
|
|
2504
|
+
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["accelerometer"]).then((result) => {
|
|
2505
|
+
isAvailable.value = result.available;
|
|
2506
|
+
}).catch(() => {
|
|
2507
|
+
});
|
|
2508
|
+
function start() {
|
|
2509
|
+
if (running) return;
|
|
2510
|
+
running = true;
|
|
2511
|
+
unsubscribe = NativeBridge.onGlobalEvent("sensor:accelerometer", (payload) => {
|
|
2512
|
+
x.value = payload.x;
|
|
2513
|
+
y.value = payload.y;
|
|
2514
|
+
z.value = payload.z;
|
|
2515
|
+
});
|
|
2516
|
+
NativeBridge.invokeNativeModule("Sensors", "startAccelerometer", [
|
|
2517
|
+
options.interval ?? 100
|
|
2518
|
+
]).catch(() => {
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
function stop() {
|
|
2522
|
+
if (!running) return;
|
|
2523
|
+
running = false;
|
|
2524
|
+
unsubscribe?.();
|
|
2525
|
+
unsubscribe = null;
|
|
2526
|
+
NativeBridge.invokeNativeModule("Sensors", "stopAccelerometer").catch(() => {
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
(0, import_runtime_core44.onUnmounted)(() => {
|
|
2530
|
+
stop();
|
|
2531
|
+
});
|
|
2532
|
+
return { x, y, z, isAvailable, start, stop };
|
|
2533
|
+
}
|
|
2534
|
+
function useGyroscope(options = {}) {
|
|
2535
|
+
const x = (0, import_runtime_core44.ref)(0);
|
|
2536
|
+
const y = (0, import_runtime_core44.ref)(0);
|
|
2537
|
+
const z = (0, import_runtime_core44.ref)(0);
|
|
2538
|
+
const isAvailable = (0, import_runtime_core44.ref)(false);
|
|
2539
|
+
let running = false;
|
|
2540
|
+
let unsubscribe = null;
|
|
2541
|
+
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["gyroscope"]).then((result) => {
|
|
2542
|
+
isAvailable.value = result.available;
|
|
2543
|
+
}).catch(() => {
|
|
2544
|
+
});
|
|
2545
|
+
function start() {
|
|
2546
|
+
if (running) return;
|
|
2547
|
+
running = true;
|
|
2548
|
+
unsubscribe = NativeBridge.onGlobalEvent("sensor:gyroscope", (payload) => {
|
|
2549
|
+
x.value = payload.x;
|
|
2550
|
+
y.value = payload.y;
|
|
2551
|
+
z.value = payload.z;
|
|
2552
|
+
});
|
|
2553
|
+
NativeBridge.invokeNativeModule("Sensors", "startGyroscope", [
|
|
2554
|
+
options.interval ?? 100
|
|
2555
|
+
]).catch(() => {
|
|
2556
|
+
});
|
|
2557
|
+
}
|
|
2558
|
+
function stop() {
|
|
2559
|
+
if (!running) return;
|
|
2560
|
+
running = false;
|
|
1735
2561
|
unsubscribe?.();
|
|
1736
2562
|
unsubscribe = null;
|
|
2563
|
+
NativeBridge.invokeNativeModule("Sensors", "stopGyroscope").catch(() => {
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
(0, import_runtime_core44.onUnmounted)(() => {
|
|
2567
|
+
stop();
|
|
2568
|
+
});
|
|
2569
|
+
return { x, y, z, isAvailable, start, stop };
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
// src/composables/useAudio.ts
|
|
2573
|
+
var import_runtime_core45 = require("@vue/runtime-core");
|
|
2574
|
+
function useAudio() {
|
|
2575
|
+
const duration = (0, import_runtime_core45.ref)(0);
|
|
2576
|
+
const position = (0, import_runtime_core45.ref)(0);
|
|
2577
|
+
const isPlaying = (0, import_runtime_core45.ref)(false);
|
|
2578
|
+
const isRecording = (0, import_runtime_core45.ref)(false);
|
|
2579
|
+
const error = (0, import_runtime_core45.ref)(null);
|
|
2580
|
+
const unsubProgress = NativeBridge.onGlobalEvent("audio:progress", (payload) => {
|
|
2581
|
+
position.value = payload.currentTime ?? 0;
|
|
2582
|
+
duration.value = payload.duration ?? 0;
|
|
2583
|
+
});
|
|
2584
|
+
const unsubComplete = NativeBridge.onGlobalEvent("audio:complete", () => {
|
|
2585
|
+
isPlaying.value = false;
|
|
2586
|
+
position.value = 0;
|
|
2587
|
+
});
|
|
2588
|
+
const unsubError = NativeBridge.onGlobalEvent("audio:error", (payload) => {
|
|
2589
|
+
error.value = payload.message ?? "Unknown audio error";
|
|
2590
|
+
isPlaying.value = false;
|
|
2591
|
+
});
|
|
2592
|
+
(0, import_runtime_core45.onUnmounted)(() => {
|
|
2593
|
+
unsubProgress();
|
|
2594
|
+
unsubComplete();
|
|
2595
|
+
unsubError();
|
|
2596
|
+
NativeBridge.invokeNativeModule("Audio", "stop", []).catch(() => {
|
|
2597
|
+
});
|
|
2598
|
+
if (isRecording.value) {
|
|
2599
|
+
NativeBridge.invokeNativeModule("Audio", "stopRecording", []).catch(() => {
|
|
2600
|
+
});
|
|
2601
|
+
}
|
|
2602
|
+
});
|
|
2603
|
+
async function play(uri, options = {}) {
|
|
2604
|
+
error.value = null;
|
|
2605
|
+
const result = await NativeBridge.invokeNativeModule("Audio", "play", [uri, options]);
|
|
2606
|
+
if (result?.duration != null) {
|
|
2607
|
+
duration.value = result.duration;
|
|
2608
|
+
}
|
|
2609
|
+
isPlaying.value = true;
|
|
2610
|
+
}
|
|
2611
|
+
async function pause() {
|
|
2612
|
+
await NativeBridge.invokeNativeModule("Audio", "pause", []);
|
|
2613
|
+
isPlaying.value = false;
|
|
2614
|
+
}
|
|
2615
|
+
async function resume() {
|
|
2616
|
+
await NativeBridge.invokeNativeModule("Audio", "resume", []);
|
|
2617
|
+
isPlaying.value = true;
|
|
2618
|
+
}
|
|
2619
|
+
async function stop() {
|
|
2620
|
+
await NativeBridge.invokeNativeModule("Audio", "stop", []);
|
|
2621
|
+
isPlaying.value = false;
|
|
2622
|
+
position.value = 0;
|
|
2623
|
+
duration.value = 0;
|
|
2624
|
+
}
|
|
2625
|
+
async function seek(positionSec) {
|
|
2626
|
+
await NativeBridge.invokeNativeModule("Audio", "seek", [positionSec]);
|
|
2627
|
+
}
|
|
2628
|
+
async function setVolume(volume) {
|
|
2629
|
+
await NativeBridge.invokeNativeModule("Audio", "setVolume", [volume]);
|
|
2630
|
+
}
|
|
2631
|
+
async function startRecording(options = {}) {
|
|
2632
|
+
error.value = null;
|
|
2633
|
+
const result = await NativeBridge.invokeNativeModule("Audio", "startRecording", [options]);
|
|
2634
|
+
isRecording.value = true;
|
|
2635
|
+
return result?.uri ?? "";
|
|
2636
|
+
}
|
|
2637
|
+
async function stopRecording() {
|
|
2638
|
+
const result = await NativeBridge.invokeNativeModule("Audio", "stopRecording", []);
|
|
2639
|
+
isRecording.value = false;
|
|
2640
|
+
return { uri: result?.uri ?? "", duration: result?.duration ?? 0 };
|
|
2641
|
+
}
|
|
2642
|
+
async function pauseRecording() {
|
|
2643
|
+
await NativeBridge.invokeNativeModule("Audio", "pauseRecording", []);
|
|
2644
|
+
}
|
|
2645
|
+
async function resumeRecording() {
|
|
2646
|
+
await NativeBridge.invokeNativeModule("Audio", "resumeRecording", []);
|
|
2647
|
+
}
|
|
2648
|
+
return {
|
|
2649
|
+
// Playback
|
|
2650
|
+
play,
|
|
2651
|
+
pause,
|
|
2652
|
+
resume,
|
|
2653
|
+
stop,
|
|
2654
|
+
seek,
|
|
2655
|
+
setVolume,
|
|
2656
|
+
// Recording
|
|
2657
|
+
startRecording,
|
|
2658
|
+
stopRecording,
|
|
2659
|
+
pauseRecording,
|
|
2660
|
+
resumeRecording,
|
|
2661
|
+
// Reactive state
|
|
2662
|
+
duration,
|
|
2663
|
+
position,
|
|
2664
|
+
isPlaying,
|
|
2665
|
+
isRecording,
|
|
2666
|
+
error
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
// src/composables/useDatabase.ts
|
|
2671
|
+
var import_runtime_core46 = require("@vue/runtime-core");
|
|
2672
|
+
function useDatabase(name = "default") {
|
|
2673
|
+
const isOpen = (0, import_runtime_core46.ref)(false);
|
|
2674
|
+
let opened = false;
|
|
2675
|
+
async function ensureOpen() {
|
|
2676
|
+
if (opened) return;
|
|
2677
|
+
await NativeBridge.invokeNativeModule("Database", "open", [name]);
|
|
2678
|
+
opened = true;
|
|
2679
|
+
isOpen.value = true;
|
|
2680
|
+
}
|
|
2681
|
+
async function execute(sql, params) {
|
|
2682
|
+
await ensureOpen();
|
|
2683
|
+
return NativeBridge.invokeNativeModule("Database", "execute", [name, sql, params ?? []]);
|
|
2684
|
+
}
|
|
2685
|
+
async function query(sql, params) {
|
|
2686
|
+
await ensureOpen();
|
|
2687
|
+
return NativeBridge.invokeNativeModule("Database", "query", [name, sql, params ?? []]);
|
|
2688
|
+
}
|
|
2689
|
+
async function transaction(callback) {
|
|
2690
|
+
await ensureOpen();
|
|
2691
|
+
const statements = [];
|
|
2692
|
+
const ctx = {
|
|
2693
|
+
execute: async (sql, params) => {
|
|
2694
|
+
statements.push({ sql, params: params ?? [] });
|
|
2695
|
+
return { rowsAffected: 0 };
|
|
2696
|
+
},
|
|
2697
|
+
query: async (sql, params) => {
|
|
2698
|
+
if (statements.length > 0) {
|
|
2699
|
+
await NativeBridge.invokeNativeModule("Database", "executeTransaction", [name, statements.splice(0)]);
|
|
2700
|
+
}
|
|
2701
|
+
return NativeBridge.invokeNativeModule("Database", "query", [name, sql, params ?? []]);
|
|
2702
|
+
}
|
|
2703
|
+
};
|
|
2704
|
+
await callback(ctx);
|
|
2705
|
+
if (statements.length > 0) {
|
|
2706
|
+
await NativeBridge.invokeNativeModule("Database", "executeTransaction", [name, statements]);
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
async function close() {
|
|
2710
|
+
if (!opened) return;
|
|
2711
|
+
await NativeBridge.invokeNativeModule("Database", "close", [name]);
|
|
2712
|
+
opened = false;
|
|
2713
|
+
isOpen.value = false;
|
|
2714
|
+
}
|
|
2715
|
+
(0, import_runtime_core46.onUnmounted)(() => {
|
|
2716
|
+
if (opened) {
|
|
2717
|
+
NativeBridge.invokeNativeModule("Database", "close", [name]).catch(() => {
|
|
2718
|
+
});
|
|
2719
|
+
opened = false;
|
|
2720
|
+
isOpen.value = false;
|
|
2721
|
+
}
|
|
2722
|
+
});
|
|
2723
|
+
return { execute, query, transaction, close, isOpen };
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
// src/composables/usePerformance.ts
|
|
2727
|
+
var import_runtime_core47 = require("@vue/runtime-core");
|
|
2728
|
+
function usePerformance() {
|
|
2729
|
+
const isProfiling = (0, import_runtime_core47.ref)(false);
|
|
2730
|
+
const fps = (0, import_runtime_core47.ref)(0);
|
|
2731
|
+
const memoryMB = (0, import_runtime_core47.ref)(0);
|
|
2732
|
+
const bridgeOps = (0, import_runtime_core47.ref)(0);
|
|
2733
|
+
let unsubscribe = null;
|
|
2734
|
+
function handleMetrics(payload) {
|
|
2735
|
+
fps.value = payload.fps ?? 0;
|
|
2736
|
+
memoryMB.value = payload.memoryMB ?? 0;
|
|
2737
|
+
bridgeOps.value = payload.bridgeOps ?? 0;
|
|
2738
|
+
}
|
|
2739
|
+
async function startProfiling() {
|
|
2740
|
+
if (isProfiling.value) return;
|
|
2741
|
+
unsubscribe = NativeBridge.onGlobalEvent("perf:metrics", handleMetrics);
|
|
2742
|
+
await NativeBridge.invokeNativeModule("Performance", "startProfiling", []);
|
|
2743
|
+
isProfiling.value = true;
|
|
2744
|
+
}
|
|
2745
|
+
async function stopProfiling() {
|
|
2746
|
+
if (!isProfiling.value) return;
|
|
2747
|
+
await NativeBridge.invokeNativeModule("Performance", "stopProfiling", []);
|
|
2748
|
+
isProfiling.value = false;
|
|
2749
|
+
if (unsubscribe) {
|
|
2750
|
+
unsubscribe();
|
|
2751
|
+
unsubscribe = null;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
async function getMetrics() {
|
|
2755
|
+
return NativeBridge.invokeNativeModule("Performance", "getMetrics", []);
|
|
2756
|
+
}
|
|
2757
|
+
(0, import_runtime_core47.onUnmounted)(() => {
|
|
2758
|
+
if (isProfiling.value) {
|
|
2759
|
+
NativeBridge.invokeNativeModule("Performance", "stopProfiling", []).catch(() => {
|
|
2760
|
+
});
|
|
2761
|
+
isProfiling.value = false;
|
|
2762
|
+
}
|
|
2763
|
+
if (unsubscribe) {
|
|
2764
|
+
unsubscribe();
|
|
2765
|
+
unsubscribe = null;
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2768
|
+
return {
|
|
2769
|
+
startProfiling,
|
|
2770
|
+
stopProfiling,
|
|
2771
|
+
getMetrics,
|
|
2772
|
+
isProfiling,
|
|
2773
|
+
fps,
|
|
2774
|
+
memoryMB,
|
|
2775
|
+
bridgeOps
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
// src/composables/useSharedElementTransition.ts
|
|
2780
|
+
var import_runtime_core48 = require("@vue/runtime-core");
|
|
2781
|
+
var sharedElementRegistry = /* @__PURE__ */ new Map();
|
|
2782
|
+
function useSharedElementTransition(elementId) {
|
|
2783
|
+
const viewId = (0, import_runtime_core48.ref)(null);
|
|
2784
|
+
function register(nativeViewId) {
|
|
2785
|
+
viewId.value = nativeViewId;
|
|
2786
|
+
sharedElementRegistry.set(elementId, nativeViewId);
|
|
2787
|
+
}
|
|
2788
|
+
function unregister() {
|
|
2789
|
+
viewId.value = null;
|
|
2790
|
+
sharedElementRegistry.delete(elementId);
|
|
2791
|
+
}
|
|
2792
|
+
(0, import_runtime_core48.onUnmounted)(() => {
|
|
2793
|
+
unregister();
|
|
2794
|
+
});
|
|
2795
|
+
return {
|
|
2796
|
+
id: elementId,
|
|
2797
|
+
viewId,
|
|
2798
|
+
register,
|
|
2799
|
+
unregister
|
|
2800
|
+
};
|
|
2801
|
+
}
|
|
2802
|
+
async function measureViewFrame(nativeViewId) {
|
|
2803
|
+
return NativeBridge.invokeNativeModule("Animation", "measureView", [nativeViewId]);
|
|
2804
|
+
}
|
|
2805
|
+
function getSharedElementViewId(elementId) {
|
|
2806
|
+
return sharedElementRegistry.get(elementId);
|
|
2807
|
+
}
|
|
2808
|
+
function getRegisteredSharedElements() {
|
|
2809
|
+
return Array.from(sharedElementRegistry.keys());
|
|
2810
|
+
}
|
|
2811
|
+
function clearSharedElementRegistry() {
|
|
2812
|
+
sharedElementRegistry.clear();
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
// src/composables/useIAP.ts
|
|
2816
|
+
var import_runtime_core49 = require("@vue/runtime-core");
|
|
2817
|
+
function useIAP() {
|
|
2818
|
+
const products = (0, import_runtime_core49.ref)([]);
|
|
2819
|
+
const isReady = (0, import_runtime_core49.ref)(false);
|
|
2820
|
+
const error = (0, import_runtime_core49.ref)(null);
|
|
2821
|
+
const cleanups = [];
|
|
2822
|
+
const unsubscribe = NativeBridge.onGlobalEvent("iap:transactionUpdate", (payload) => {
|
|
2823
|
+
if (payload.state === "failed" && payload.error) {
|
|
2824
|
+
error.value = payload.error;
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
cleanups.push(unsubscribe);
|
|
2828
|
+
NativeBridge.invokeNativeModule("IAP", "initialize").then(() => {
|
|
2829
|
+
isReady.value = true;
|
|
2830
|
+
}).catch((err) => {
|
|
2831
|
+
error.value = String(err);
|
|
2832
|
+
});
|
|
2833
|
+
async function getProducts(skus) {
|
|
2834
|
+
error.value = null;
|
|
2835
|
+
try {
|
|
2836
|
+
const result = await NativeBridge.invokeNativeModule("IAP", "getProducts", [skus]);
|
|
2837
|
+
const productList = result;
|
|
2838
|
+
products.value = productList;
|
|
2839
|
+
return productList;
|
|
2840
|
+
} catch (err) {
|
|
2841
|
+
error.value = String(err);
|
|
2842
|
+
return [];
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
async function purchase(sku) {
|
|
2846
|
+
error.value = null;
|
|
2847
|
+
try {
|
|
2848
|
+
return await NativeBridge.invokeNativeModule("IAP", "purchase", [sku]);
|
|
2849
|
+
} catch (err) {
|
|
2850
|
+
error.value = String(err);
|
|
2851
|
+
return null;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
async function restorePurchases() {
|
|
2855
|
+
error.value = null;
|
|
2856
|
+
try {
|
|
2857
|
+
return await NativeBridge.invokeNativeModule("IAP", "restorePurchases");
|
|
2858
|
+
} catch (err) {
|
|
2859
|
+
error.value = String(err);
|
|
2860
|
+
return [];
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
async function getActiveSubscriptions() {
|
|
2864
|
+
error.value = null;
|
|
2865
|
+
try {
|
|
2866
|
+
return await NativeBridge.invokeNativeModule("IAP", "getActiveSubscriptions");
|
|
2867
|
+
} catch (err) {
|
|
2868
|
+
error.value = String(err);
|
|
2869
|
+
return [];
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
function onTransactionUpdate(callback) {
|
|
2873
|
+
const unsub = NativeBridge.onGlobalEvent("iap:transactionUpdate", callback);
|
|
2874
|
+
cleanups.push(unsub);
|
|
2875
|
+
return unsub;
|
|
2876
|
+
}
|
|
2877
|
+
(0, import_runtime_core49.onUnmounted)(() => {
|
|
2878
|
+
cleanups.forEach((fn) => fn());
|
|
2879
|
+
cleanups.length = 0;
|
|
2880
|
+
});
|
|
2881
|
+
return {
|
|
2882
|
+
products,
|
|
2883
|
+
isReady,
|
|
2884
|
+
error,
|
|
2885
|
+
getProducts,
|
|
2886
|
+
purchase,
|
|
2887
|
+
restorePurchases,
|
|
2888
|
+
getActiveSubscriptions,
|
|
2889
|
+
onTransactionUpdate
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
// src/composables/useAppleSignIn.ts
|
|
2894
|
+
var import_runtime_core50 = require("@vue/runtime-core");
|
|
2895
|
+
function useAppleSignIn() {
|
|
2896
|
+
const user = (0, import_runtime_core50.ref)(null);
|
|
2897
|
+
const isAuthenticated = (0, import_runtime_core50.ref)(false);
|
|
2898
|
+
const error = (0, import_runtime_core50.ref)(null);
|
|
2899
|
+
const cleanups = [];
|
|
2900
|
+
const unsubscribe = NativeBridge.onGlobalEvent("auth:appleCredentialRevoked", () => {
|
|
2901
|
+
user.value = null;
|
|
2902
|
+
isAuthenticated.value = false;
|
|
2903
|
+
});
|
|
2904
|
+
cleanups.push(unsubscribe);
|
|
2905
|
+
NativeBridge.invokeNativeModule("SocialAuth", "getCurrentUser", ["apple"]).then((result) => {
|
|
2906
|
+
if (result && result.userId) {
|
|
2907
|
+
user.value = { ...result, provider: "apple" };
|
|
2908
|
+
isAuthenticated.value = true;
|
|
2909
|
+
}
|
|
2910
|
+
}).catch(() => {
|
|
2911
|
+
});
|
|
2912
|
+
async function signIn() {
|
|
2913
|
+
error.value = null;
|
|
2914
|
+
try {
|
|
2915
|
+
const result = await NativeBridge.invokeNativeModule("SocialAuth", "signInWithApple");
|
|
2916
|
+
const socialUser = { ...result, provider: "apple" };
|
|
2917
|
+
user.value = socialUser;
|
|
2918
|
+
isAuthenticated.value = true;
|
|
2919
|
+
return { success: true, user: socialUser };
|
|
2920
|
+
} catch (err) {
|
|
2921
|
+
const message = String(err);
|
|
2922
|
+
error.value = message;
|
|
2923
|
+
return { success: false, error: message };
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
async function signOut() {
|
|
2927
|
+
error.value = null;
|
|
2928
|
+
try {
|
|
2929
|
+
await NativeBridge.invokeNativeModule("SocialAuth", "signOut", ["apple"]);
|
|
2930
|
+
user.value = null;
|
|
2931
|
+
isAuthenticated.value = false;
|
|
2932
|
+
} catch (err) {
|
|
2933
|
+
error.value = String(err);
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
(0, import_runtime_core50.onUnmounted)(() => {
|
|
2937
|
+
cleanups.forEach((fn) => fn());
|
|
2938
|
+
cleanups.length = 0;
|
|
2939
|
+
});
|
|
2940
|
+
return { signIn, signOut, user, isAuthenticated, error };
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
// src/composables/useGoogleSignIn.ts
|
|
2944
|
+
var import_runtime_core51 = require("@vue/runtime-core");
|
|
2945
|
+
function useGoogleSignIn(clientId) {
|
|
2946
|
+
const user = (0, import_runtime_core51.ref)(null);
|
|
2947
|
+
const isAuthenticated = (0, import_runtime_core51.ref)(false);
|
|
2948
|
+
const error = (0, import_runtime_core51.ref)(null);
|
|
2949
|
+
const cleanups = [];
|
|
2950
|
+
NativeBridge.invokeNativeModule("SocialAuth", "getCurrentUser", ["google"]).then((result) => {
|
|
2951
|
+
if (result && result.userId) {
|
|
2952
|
+
user.value = { ...result, provider: "google" };
|
|
2953
|
+
isAuthenticated.value = true;
|
|
2954
|
+
}
|
|
2955
|
+
}).catch(() => {
|
|
2956
|
+
});
|
|
2957
|
+
async function signIn() {
|
|
2958
|
+
error.value = null;
|
|
2959
|
+
try {
|
|
2960
|
+
const result = await NativeBridge.invokeNativeModule("SocialAuth", "signInWithGoogle", [clientId]);
|
|
2961
|
+
const socialUser = { ...result, provider: "google" };
|
|
2962
|
+
user.value = socialUser;
|
|
2963
|
+
isAuthenticated.value = true;
|
|
2964
|
+
return { success: true, user: socialUser };
|
|
2965
|
+
} catch (err) {
|
|
2966
|
+
const message = String(err);
|
|
2967
|
+
error.value = message;
|
|
2968
|
+
return { success: false, error: message };
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
async function signOut() {
|
|
2972
|
+
error.value = null;
|
|
2973
|
+
try {
|
|
2974
|
+
await NativeBridge.invokeNativeModule("SocialAuth", "signOut", ["google"]);
|
|
2975
|
+
user.value = null;
|
|
2976
|
+
isAuthenticated.value = false;
|
|
2977
|
+
} catch (err) {
|
|
2978
|
+
error.value = String(err);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
(0, import_runtime_core51.onUnmounted)(() => {
|
|
2982
|
+
cleanups.forEach((fn) => fn());
|
|
2983
|
+
cleanups.length = 0;
|
|
2984
|
+
});
|
|
2985
|
+
return { signIn, signOut, user, isAuthenticated, error };
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
// src/composables/useBackgroundTask.ts
|
|
2989
|
+
var import_runtime_core52 = require("@vue/runtime-core");
|
|
2990
|
+
function useBackgroundTask() {
|
|
2991
|
+
const taskHandlers = /* @__PURE__ */ new Map();
|
|
2992
|
+
const defaultHandler = (0, import_runtime_core52.ref)(null);
|
|
2993
|
+
const unsubscribe = NativeBridge.onGlobalEvent("background:taskExecute", (payload) => {
|
|
2994
|
+
const handler = taskHandlers.get(payload.taskId) || defaultHandler.value;
|
|
2995
|
+
if (handler) {
|
|
2996
|
+
handler(payload.taskId);
|
|
2997
|
+
}
|
|
2998
|
+
});
|
|
2999
|
+
(0, import_runtime_core52.onUnmounted)(unsubscribe);
|
|
3000
|
+
function registerTask(taskId) {
|
|
3001
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "registerTask", [taskId]).then(() => void 0);
|
|
3002
|
+
}
|
|
3003
|
+
function scheduleTask(taskId, options = {}) {
|
|
3004
|
+
const type = options.type ?? "refresh";
|
|
3005
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "scheduleTask", [taskId, type, {
|
|
3006
|
+
earliestBeginDate: options.earliestBeginDate,
|
|
3007
|
+
requiresNetworkConnectivity: options.requiresNetworkConnectivity,
|
|
3008
|
+
requiresExternalPower: options.requiresExternalPower,
|
|
3009
|
+
interval: options.interval
|
|
3010
|
+
}]).then(() => void 0);
|
|
3011
|
+
}
|
|
3012
|
+
function cancelTask(taskId) {
|
|
3013
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "cancelTask", [taskId]).then(() => void 0);
|
|
3014
|
+
}
|
|
3015
|
+
function cancelAllTasks() {
|
|
3016
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "cancelAllTasks", []).then(() => void 0);
|
|
3017
|
+
}
|
|
3018
|
+
function completeTask(taskId, success = true) {
|
|
3019
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "completeTask", [taskId, success]).then(() => void 0);
|
|
3020
|
+
}
|
|
3021
|
+
function onTaskExecute(handler, taskId) {
|
|
3022
|
+
if (taskId) {
|
|
3023
|
+
taskHandlers.set(taskId, handler);
|
|
3024
|
+
return () => {
|
|
3025
|
+
taskHandlers.delete(taskId);
|
|
3026
|
+
};
|
|
3027
|
+
} else {
|
|
3028
|
+
defaultHandler.value = handler;
|
|
3029
|
+
return () => {
|
|
3030
|
+
defaultHandler.value = null;
|
|
3031
|
+
};
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
return { registerTask, scheduleTask, cancelTask, cancelAllTasks, completeTask, onTaskExecute };
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
// src/composables/useOTAUpdate.ts
|
|
3038
|
+
var import_runtime_core53 = require("@vue/runtime-core");
|
|
3039
|
+
function useOTAUpdate(serverUrl) {
|
|
3040
|
+
const currentVersion = (0, import_runtime_core53.ref)("embedded");
|
|
3041
|
+
const availableVersion = (0, import_runtime_core53.ref)(null);
|
|
3042
|
+
const downloadProgress = (0, import_runtime_core53.ref)(0);
|
|
3043
|
+
const isChecking = (0, import_runtime_core53.ref)(false);
|
|
3044
|
+
const isDownloading = (0, import_runtime_core53.ref)(false);
|
|
3045
|
+
const status = (0, import_runtime_core53.ref)("idle");
|
|
3046
|
+
const error = (0, import_runtime_core53.ref)(null);
|
|
3047
|
+
let lastUpdateInfo = null;
|
|
3048
|
+
const unsubscribe = NativeBridge.onGlobalEvent("ota:downloadProgress", (payload) => {
|
|
3049
|
+
downloadProgress.value = payload.progress;
|
|
1737
3050
|
});
|
|
3051
|
+
(0, import_runtime_core53.onUnmounted)(unsubscribe);
|
|
3052
|
+
NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []).then((info) => {
|
|
3053
|
+
currentVersion.value = info.version;
|
|
3054
|
+
}).catch(() => {
|
|
3055
|
+
});
|
|
3056
|
+
async function checkForUpdate() {
|
|
3057
|
+
isChecking.value = true;
|
|
3058
|
+
status.value = "checking";
|
|
3059
|
+
error.value = null;
|
|
3060
|
+
try {
|
|
3061
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "checkForUpdate", [serverUrl]);
|
|
3062
|
+
lastUpdateInfo = info;
|
|
3063
|
+
if (info.updateAvailable) {
|
|
3064
|
+
availableVersion.value = info.version;
|
|
3065
|
+
} else {
|
|
3066
|
+
availableVersion.value = null;
|
|
3067
|
+
}
|
|
3068
|
+
status.value = info.updateAvailable ? "idle" : "idle";
|
|
3069
|
+
return info;
|
|
3070
|
+
} catch (err) {
|
|
3071
|
+
error.value = err?.message || String(err);
|
|
3072
|
+
status.value = "error";
|
|
3073
|
+
throw err;
|
|
3074
|
+
} finally {
|
|
3075
|
+
isChecking.value = false;
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
async function downloadUpdate(url, hash) {
|
|
3079
|
+
const downloadUrl = url || lastUpdateInfo?.downloadUrl;
|
|
3080
|
+
const expectedHash = hash || lastUpdateInfo?.hash;
|
|
3081
|
+
if (!downloadUrl) {
|
|
3082
|
+
const msg = "No download URL. Call checkForUpdate() first or provide a URL.";
|
|
3083
|
+
error.value = msg;
|
|
3084
|
+
status.value = "error";
|
|
3085
|
+
throw new Error(msg);
|
|
3086
|
+
}
|
|
3087
|
+
isDownloading.value = true;
|
|
3088
|
+
downloadProgress.value = 0;
|
|
3089
|
+
status.value = "downloading";
|
|
3090
|
+
error.value = null;
|
|
3091
|
+
try {
|
|
3092
|
+
await NativeBridge.invokeNativeModule("OTA", "downloadUpdate", [downloadUrl, expectedHash || ""]);
|
|
3093
|
+
status.value = "ready";
|
|
3094
|
+
} catch (err) {
|
|
3095
|
+
error.value = err?.message || String(err);
|
|
3096
|
+
status.value = "error";
|
|
3097
|
+
throw err;
|
|
3098
|
+
} finally {
|
|
3099
|
+
isDownloading.value = false;
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
async function applyUpdate() {
|
|
3103
|
+
error.value = null;
|
|
3104
|
+
try {
|
|
3105
|
+
await NativeBridge.invokeNativeModule("OTA", "applyUpdate", []);
|
|
3106
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []);
|
|
3107
|
+
currentVersion.value = info.version;
|
|
3108
|
+
availableVersion.value = null;
|
|
3109
|
+
status.value = "idle";
|
|
3110
|
+
} catch (err) {
|
|
3111
|
+
error.value = err?.message || String(err);
|
|
3112
|
+
status.value = "error";
|
|
3113
|
+
throw err;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
async function rollback() {
|
|
3117
|
+
error.value = null;
|
|
3118
|
+
try {
|
|
3119
|
+
await NativeBridge.invokeNativeModule("OTA", "rollback", []);
|
|
3120
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []);
|
|
3121
|
+
currentVersion.value = info.version;
|
|
3122
|
+
status.value = "idle";
|
|
3123
|
+
} catch (err) {
|
|
3124
|
+
error.value = err?.message || String(err);
|
|
3125
|
+
status.value = "error";
|
|
3126
|
+
throw err;
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
async function getCurrentVersion() {
|
|
3130
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []);
|
|
3131
|
+
currentVersion.value = info.version;
|
|
3132
|
+
return info;
|
|
3133
|
+
}
|
|
3134
|
+
return {
|
|
3135
|
+
checkForUpdate,
|
|
3136
|
+
downloadUpdate,
|
|
3137
|
+
applyUpdate,
|
|
3138
|
+
rollback,
|
|
3139
|
+
getCurrentVersion,
|
|
3140
|
+
currentVersion,
|
|
3141
|
+
availableVersion,
|
|
3142
|
+
downloadProgress,
|
|
3143
|
+
isChecking,
|
|
3144
|
+
isDownloading,
|
|
3145
|
+
status,
|
|
3146
|
+
error
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
// src/composables/useBluetooth.ts
|
|
3151
|
+
var import_runtime_core54 = require("@vue/runtime-core");
|
|
3152
|
+
function useBluetooth() {
|
|
3153
|
+
const devices = (0, import_runtime_core54.ref)([]);
|
|
3154
|
+
const connectedDevice = (0, import_runtime_core54.ref)(null);
|
|
3155
|
+
const isScanning = (0, import_runtime_core54.ref)(false);
|
|
3156
|
+
const isAvailable = (0, import_runtime_core54.ref)(false);
|
|
3157
|
+
const error = (0, import_runtime_core54.ref)(null);
|
|
3158
|
+
const cleanups = [];
|
|
3159
|
+
NativeBridge.invokeNativeModule("Bluetooth", "getState").then((state) => {
|
|
3160
|
+
isAvailable.value = state === "poweredOn";
|
|
3161
|
+
}).catch(() => {
|
|
3162
|
+
isAvailable.value = false;
|
|
3163
|
+
});
|
|
3164
|
+
const unsubState = NativeBridge.onGlobalEvent("ble:stateChanged", (payload) => {
|
|
3165
|
+
isAvailable.value = payload.state === "poweredOn";
|
|
3166
|
+
});
|
|
3167
|
+
cleanups.push(unsubState);
|
|
3168
|
+
const unsubFound = NativeBridge.onGlobalEvent("ble:deviceFound", (payload) => {
|
|
3169
|
+
const existing = devices.value.findIndex((d) => d.id === payload.id);
|
|
3170
|
+
if (existing >= 0) {
|
|
3171
|
+
devices.value[existing] = payload;
|
|
3172
|
+
} else {
|
|
3173
|
+
devices.value = [...devices.value, payload];
|
|
3174
|
+
}
|
|
3175
|
+
});
|
|
3176
|
+
cleanups.push(unsubFound);
|
|
3177
|
+
const unsubConnected = NativeBridge.onGlobalEvent("ble:connected", (payload) => {
|
|
3178
|
+
connectedDevice.value = payload;
|
|
3179
|
+
});
|
|
3180
|
+
cleanups.push(unsubConnected);
|
|
3181
|
+
const unsubDisconnected = NativeBridge.onGlobalEvent("ble:disconnected", () => {
|
|
3182
|
+
connectedDevice.value = null;
|
|
3183
|
+
});
|
|
3184
|
+
cleanups.push(unsubDisconnected);
|
|
3185
|
+
const unsubError = NativeBridge.onGlobalEvent("ble:error", (payload) => {
|
|
3186
|
+
error.value = payload.message;
|
|
3187
|
+
});
|
|
3188
|
+
cleanups.push(unsubError);
|
|
3189
|
+
async function scan(serviceUUIDs) {
|
|
3190
|
+
devices.value = [];
|
|
3191
|
+
isScanning.value = true;
|
|
3192
|
+
error.value = null;
|
|
3193
|
+
try {
|
|
3194
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "startScan", [serviceUUIDs]);
|
|
3195
|
+
} catch (e) {
|
|
3196
|
+
error.value = e?.message || String(e);
|
|
3197
|
+
isScanning.value = false;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
async function stopScan() {
|
|
3201
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "stopScan");
|
|
3202
|
+
isScanning.value = false;
|
|
3203
|
+
}
|
|
3204
|
+
async function connect(deviceId) {
|
|
3205
|
+
error.value = null;
|
|
3206
|
+
const result = await NativeBridge.invokeNativeModule("Bluetooth", "connect", [deviceId]);
|
|
3207
|
+
return result;
|
|
3208
|
+
}
|
|
3209
|
+
async function disconnect(deviceId) {
|
|
3210
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "disconnect", [deviceId]);
|
|
3211
|
+
connectedDevice.value = null;
|
|
3212
|
+
}
|
|
3213
|
+
async function read(deviceId, serviceUUID, charUUID) {
|
|
3214
|
+
return NativeBridge.invokeNativeModule("Bluetooth", "readCharacteristic", [deviceId, serviceUUID, charUUID]);
|
|
3215
|
+
}
|
|
3216
|
+
async function write(deviceId, serviceUUID, charUUID, data) {
|
|
3217
|
+
return NativeBridge.invokeNativeModule("Bluetooth", "writeCharacteristic", [deviceId, serviceUUID, charUUID, data]);
|
|
3218
|
+
}
|
|
3219
|
+
async function subscribe(deviceId, serviceUUID, charUUID, callback) {
|
|
3220
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "subscribeToCharacteristic", [deviceId, serviceUUID, charUUID]);
|
|
3221
|
+
const unsubscribe = NativeBridge.onGlobalEvent("ble:characteristicChanged", (payload) => {
|
|
3222
|
+
if (payload.deviceId === deviceId && payload.serviceUUID === serviceUUID && payload.characteristicUUID === charUUID) {
|
|
3223
|
+
callback(payload);
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3226
|
+
cleanups.push(unsubscribe);
|
|
3227
|
+
return async () => {
|
|
3228
|
+
unsubscribe();
|
|
3229
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "unsubscribeFromCharacteristic", [
|
|
3230
|
+
deviceId,
|
|
3231
|
+
serviceUUID,
|
|
3232
|
+
charUUID
|
|
3233
|
+
]);
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
(0, import_runtime_core54.onUnmounted)(() => {
|
|
3237
|
+
if (isScanning.value) {
|
|
3238
|
+
NativeBridge.invokeNativeModule("Bluetooth", "stopScan").catch(() => {
|
|
3239
|
+
});
|
|
3240
|
+
}
|
|
3241
|
+
cleanups.forEach((fn) => fn());
|
|
3242
|
+
cleanups.length = 0;
|
|
3243
|
+
});
|
|
3244
|
+
return {
|
|
3245
|
+
scan,
|
|
3246
|
+
stopScan,
|
|
3247
|
+
connect,
|
|
3248
|
+
disconnect,
|
|
3249
|
+
read,
|
|
3250
|
+
write,
|
|
3251
|
+
subscribe,
|
|
3252
|
+
devices,
|
|
3253
|
+
connectedDevice,
|
|
3254
|
+
isScanning,
|
|
3255
|
+
isAvailable,
|
|
3256
|
+
error
|
|
3257
|
+
};
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
// src/composables/useCalendar.ts
|
|
3261
|
+
var import_runtime_core55 = require("@vue/runtime-core");
|
|
3262
|
+
function useCalendar() {
|
|
3263
|
+
const hasAccess = (0, import_runtime_core55.ref)(false);
|
|
3264
|
+
const error = (0, import_runtime_core55.ref)(null);
|
|
3265
|
+
async function requestAccess() {
|
|
3266
|
+
try {
|
|
3267
|
+
const result = await NativeBridge.invokeNativeModule("Calendar", "requestAccess");
|
|
3268
|
+
hasAccess.value = result.granted;
|
|
3269
|
+
return result.granted;
|
|
3270
|
+
} catch (e) {
|
|
3271
|
+
error.value = e?.message || String(e);
|
|
3272
|
+
return false;
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
async function getEvents(startDate, endDate) {
|
|
3276
|
+
return NativeBridge.invokeNativeModule("Calendar", "getEvents", [startDate, endDate]);
|
|
3277
|
+
}
|
|
3278
|
+
async function createEvent(options) {
|
|
3279
|
+
return NativeBridge.invokeNativeModule("Calendar", "createEvent", [
|
|
3280
|
+
options.title,
|
|
3281
|
+
options.startDate,
|
|
3282
|
+
options.endDate,
|
|
3283
|
+
options.notes,
|
|
3284
|
+
options.calendarId
|
|
3285
|
+
]);
|
|
3286
|
+
}
|
|
3287
|
+
async function deleteEvent(eventId) {
|
|
3288
|
+
return NativeBridge.invokeNativeModule("Calendar", "deleteEvent", [eventId]);
|
|
3289
|
+
}
|
|
3290
|
+
async function getCalendars() {
|
|
3291
|
+
return NativeBridge.invokeNativeModule("Calendar", "getCalendars");
|
|
3292
|
+
}
|
|
3293
|
+
return { requestAccess, getEvents, createEvent, deleteEvent, getCalendars, hasAccess, error };
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
// src/composables/useContacts.ts
|
|
3297
|
+
var import_runtime_core56 = require("@vue/runtime-core");
|
|
3298
|
+
function useContacts() {
|
|
3299
|
+
const hasAccess = (0, import_runtime_core56.ref)(false);
|
|
3300
|
+
const error = (0, import_runtime_core56.ref)(null);
|
|
3301
|
+
async function requestAccess() {
|
|
3302
|
+
try {
|
|
3303
|
+
const result = await NativeBridge.invokeNativeModule("Contacts", "requestAccess");
|
|
3304
|
+
hasAccess.value = result.granted;
|
|
3305
|
+
return result.granted;
|
|
3306
|
+
} catch (e) {
|
|
3307
|
+
error.value = e?.message || String(e);
|
|
3308
|
+
return false;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
async function getContacts(query) {
|
|
3312
|
+
return NativeBridge.invokeNativeModule("Contacts", "getContacts", [query]);
|
|
3313
|
+
}
|
|
3314
|
+
async function getContact(id) {
|
|
3315
|
+
return NativeBridge.invokeNativeModule("Contacts", "getContact", [id]);
|
|
3316
|
+
}
|
|
3317
|
+
async function createContact(data) {
|
|
3318
|
+
return NativeBridge.invokeNativeModule("Contacts", "createContact", [data]);
|
|
3319
|
+
}
|
|
3320
|
+
async function deleteContact(id) {
|
|
3321
|
+
return NativeBridge.invokeNativeModule("Contacts", "deleteContact", [id]);
|
|
3322
|
+
}
|
|
3323
|
+
return { requestAccess, getContacts, getContact, createContact, deleteContact, hasAccess, error };
|
|
1738
3324
|
}
|
|
1739
3325
|
|
|
1740
3326
|
// src/index.ts
|
|
@@ -1760,6 +3346,15 @@ function createApp(rootComponent, rootProps) {
|
|
|
1760
3346
|
app.component("VPicker", VPicker);
|
|
1761
3347
|
app.component("VSegmentedControl", VSegmentedControl);
|
|
1762
3348
|
app.component("VActionSheet", VActionSheet);
|
|
3349
|
+
app.component("VRefreshControl", VRefreshControl);
|
|
3350
|
+
app.component("VPressable", VPressable);
|
|
3351
|
+
app.component("VSectionList", VSectionList);
|
|
3352
|
+
app.component("VCheckbox", VCheckbox);
|
|
3353
|
+
app.component("VRadio", VRadio);
|
|
3354
|
+
app.component("VDropdown", VDropdown);
|
|
3355
|
+
app.component("VVideo", VVideo);
|
|
3356
|
+
app.component("ErrorBoundary", ErrorBoundary);
|
|
3357
|
+
app.component("VErrorBoundary", ErrorBoundary);
|
|
1763
3358
|
app.directive("show", vShow);
|
|
1764
3359
|
app.config.errorHandler = (err, instance, info) => {
|
|
1765
3360
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
@@ -1777,7 +3372,7 @@ function createApp(rootComponent, rootProps) {
|
|
|
1777
3372
|
}
|
|
1778
3373
|
};
|
|
1779
3374
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
1780
|
-
app.config.warnHandler = (msg, instance,
|
|
3375
|
+
app.config.warnHandler = (msg, instance, _trace) => {
|
|
1781
3376
|
const componentName = instance?.$options?.name || instance?.$.type?.name || "Anonymous";
|
|
1782
3377
|
console.warn(`[VueNative] Warning in ${componentName}: ${msg}`);
|
|
1783
3378
|
};
|
|
@@ -1786,7 +3381,7 @@ function createApp(rootComponent, rootProps) {
|
|
|
1786
3381
|
const root = createNativeNode("__ROOT__");
|
|
1787
3382
|
NativeBridge.createNode(root.id, "__ROOT__");
|
|
1788
3383
|
NativeBridge.setRootView(root.id);
|
|
1789
|
-
const vnode = (0,
|
|
3384
|
+
const vnode = (0, import_runtime_core57.createVNode)(rootComponent, rootProps);
|
|
1790
3385
|
vnode.appContext = app._context;
|
|
1791
3386
|
render(vnode, root);
|
|
1792
3387
|
return root;
|
|
@@ -1795,52 +3390,84 @@ function createApp(rootComponent, rootProps) {
|
|
|
1795
3390
|
}
|
|
1796
3391
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1797
3392
|
0 && (module.exports = {
|
|
3393
|
+
ErrorBoundary,
|
|
1798
3394
|
NativeBridge,
|
|
1799
3395
|
VActionSheet,
|
|
1800
3396
|
VActivityIndicator,
|
|
1801
3397
|
VAlertDialog,
|
|
1802
3398
|
VButton,
|
|
3399
|
+
VCheckbox,
|
|
3400
|
+
VDropdown,
|
|
1803
3401
|
VImage,
|
|
1804
3402
|
VInput,
|
|
1805
3403
|
VKeyboardAvoiding,
|
|
1806
3404
|
VList,
|
|
1807
3405
|
VModal,
|
|
1808
3406
|
VPicker,
|
|
3407
|
+
VPressable,
|
|
1809
3408
|
VProgressBar,
|
|
3409
|
+
VRadio,
|
|
3410
|
+
VRefreshControl,
|
|
1810
3411
|
VSafeArea,
|
|
1811
3412
|
VScrollView,
|
|
3413
|
+
VSectionList,
|
|
1812
3414
|
VSegmentedControl,
|
|
1813
3415
|
VSlider,
|
|
1814
3416
|
VStatusBar,
|
|
1815
3417
|
VSwitch,
|
|
1816
3418
|
VText,
|
|
3419
|
+
VVideo,
|
|
1817
3420
|
VView,
|
|
1818
3421
|
VWebView,
|
|
3422
|
+
clearSharedElementRegistry,
|
|
1819
3423
|
createApp,
|
|
1820
3424
|
createCommentNode,
|
|
1821
3425
|
createNativeNode,
|
|
1822
3426
|
createStyleSheet,
|
|
1823
3427
|
createTextNode,
|
|
3428
|
+
getRegisteredSharedElements,
|
|
3429
|
+
getSharedElementViewId,
|
|
3430
|
+
measureViewFrame,
|
|
1824
3431
|
render,
|
|
1825
3432
|
resetNodeId,
|
|
3433
|
+
useAccelerometer,
|
|
1826
3434
|
useAnimation,
|
|
1827
3435
|
useAppState,
|
|
3436
|
+
useAppleSignIn,
|
|
1828
3437
|
useAsyncStorage,
|
|
3438
|
+
useAudio,
|
|
1829
3439
|
useBackHandler,
|
|
3440
|
+
useBackgroundTask,
|
|
1830
3441
|
useBiometry,
|
|
3442
|
+
useBluetooth,
|
|
3443
|
+
useCalendar,
|
|
1831
3444
|
useCamera,
|
|
1832
3445
|
useClipboard,
|
|
1833
3446
|
useColorScheme,
|
|
3447
|
+
useContacts,
|
|
3448
|
+
useDatabase,
|
|
1834
3449
|
useDeviceInfo,
|
|
3450
|
+
useDimensions,
|
|
3451
|
+
useFileSystem,
|
|
1835
3452
|
useGeolocation,
|
|
3453
|
+
useGoogleSignIn,
|
|
3454
|
+
useGyroscope,
|
|
1836
3455
|
useHaptics,
|
|
1837
3456
|
useHttp,
|
|
3457
|
+
useI18n,
|
|
3458
|
+
useIAP,
|
|
1838
3459
|
useKeyboard,
|
|
1839
3460
|
useLinking,
|
|
1840
3461
|
useNetwork,
|
|
1841
3462
|
useNotifications,
|
|
3463
|
+
useOTAUpdate,
|
|
3464
|
+
usePerformance,
|
|
1842
3465
|
usePermissions,
|
|
3466
|
+
usePlatform,
|
|
3467
|
+
useSecureStorage,
|
|
1843
3468
|
useShare,
|
|
3469
|
+
useSharedElementTransition,
|
|
3470
|
+
useWebSocket,
|
|
1844
3471
|
vShow,
|
|
1845
3472
|
validStyleProperties,
|
|
1846
3473
|
...require("@vue/runtime-core")
|