@thelacanians/vue-native-runtime 0.1.2 → 0.3.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 +1763 -107
- package/dist/index.d.cts +1946 -132
- package/dist/index.d.ts +1946 -132
- package/dist/index.js +1732 -108
- 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__",
|
|
@@ -128,7 +160,7 @@ function createCommentNode(text) {
|
|
|
128
160
|
}
|
|
129
161
|
|
|
130
162
|
// src/bridge.ts
|
|
131
|
-
var
|
|
163
|
+
var _NativeBridgeImpl = class _NativeBridgeImpl {
|
|
132
164
|
constructor() {
|
|
133
165
|
/** Pending operations waiting to be flushed to native */
|
|
134
166
|
this.pendingOps = [];
|
|
@@ -138,7 +170,8 @@ var NativeBridgeImpl = class {
|
|
|
138
170
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
139
171
|
/** Pending async callbacks from native module invocations */
|
|
140
172
|
this.pendingCallbacks = /* @__PURE__ */ new Map();
|
|
141
|
-
/** Auto-incrementing callback ID for async native module calls
|
|
173
|
+
/** Auto-incrementing callback ID for async native module calls.
|
|
174
|
+
* Wraps around at MAX_SAFE_CALLBACK_ID to prevent overflow. */
|
|
142
175
|
this.nextCallbackId = 1;
|
|
143
176
|
/** Global event listeners: eventName -> Set of callbacks */
|
|
144
177
|
this.globalEventHandlers = /* @__PURE__ */ new Map();
|
|
@@ -170,10 +203,14 @@ var NativeBridgeImpl = class {
|
|
|
170
203
|
const json = JSON.stringify(ops);
|
|
171
204
|
const flushFn = globalThis.__VN_flushOperations;
|
|
172
205
|
if (typeof flushFn === "function") {
|
|
173
|
-
|
|
174
|
-
|
|
206
|
+
try {
|
|
207
|
+
flushFn(json);
|
|
208
|
+
} catch (err) {
|
|
209
|
+
console.error("[VueNative] Error in __VN_flushOperations:", err);
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
175
212
|
console.warn(
|
|
176
|
-
"[VueNative] __VN_flushOperations is not registered. Make sure the
|
|
213
|
+
"[VueNative] __VN_flushOperations is not registered. Make sure the native runtime has been initialized."
|
|
177
214
|
);
|
|
178
215
|
}
|
|
179
216
|
}
|
|
@@ -333,7 +370,12 @@ var NativeBridgeImpl = class {
|
|
|
333
370
|
*/
|
|
334
371
|
invokeNativeModule(moduleName, methodName, args = [], timeoutMs = 3e4) {
|
|
335
372
|
return new Promise((resolve, reject) => {
|
|
336
|
-
const callbackId = this.nextCallbackId
|
|
373
|
+
const callbackId = this.nextCallbackId;
|
|
374
|
+
if (this.nextCallbackId >= _NativeBridgeImpl.MAX_CALLBACK_ID) {
|
|
375
|
+
this.nextCallbackId = 1;
|
|
376
|
+
} else {
|
|
377
|
+
this.nextCallbackId++;
|
|
378
|
+
}
|
|
337
379
|
const timeoutId = setTimeout(() => {
|
|
338
380
|
if (this.pendingCallbacks.has(callbackId)) {
|
|
339
381
|
this.pendingCallbacks.delete(callbackId);
|
|
@@ -404,9 +446,9 @@ var NativeBridgeImpl = class {
|
|
|
404
446
|
}
|
|
405
447
|
const handlers = this.globalEventHandlers.get(eventName);
|
|
406
448
|
if (handlers) {
|
|
407
|
-
handlers.forEach((
|
|
449
|
+
handlers.forEach((h28) => {
|
|
408
450
|
try {
|
|
409
|
-
|
|
451
|
+
h28(payload);
|
|
410
452
|
} catch (err) {
|
|
411
453
|
console.error(`[VueNative] Error in global event handler "${eventName}":`, err);
|
|
412
454
|
}
|
|
@@ -428,6 +470,9 @@ var NativeBridgeImpl = class {
|
|
|
428
470
|
this.globalEventHandlers.clear();
|
|
429
471
|
}
|
|
430
472
|
};
|
|
473
|
+
/** Maximum callback ID before wraparound (safe for 32-bit signed int) */
|
|
474
|
+
_NativeBridgeImpl.MAX_CALLBACK_ID = 2147483647;
|
|
475
|
+
var NativeBridgeImpl = _NativeBridgeImpl;
|
|
431
476
|
if (typeof globalThis.__DEV__ === "undefined") {
|
|
432
477
|
;
|
|
433
478
|
globalThis.__DEV__ = true;
|
|
@@ -446,17 +491,21 @@ function toEventName(key) {
|
|
|
446
491
|
return key.slice(2).toLowerCase();
|
|
447
492
|
}
|
|
448
493
|
function patchStyle(nodeId, prevStyle, nextStyle) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
494
|
+
try {
|
|
495
|
+
const prev = prevStyle || {};
|
|
496
|
+
const next = nextStyle || {};
|
|
497
|
+
for (const key in next) {
|
|
498
|
+
if (next[key] !== prev[key]) {
|
|
499
|
+
NativeBridge.updateStyle(nodeId, key, next[key]);
|
|
500
|
+
}
|
|
454
501
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
502
|
+
for (const key in prev) {
|
|
503
|
+
if (!(key in next)) {
|
|
504
|
+
NativeBridge.updateStyle(nodeId, key, null);
|
|
505
|
+
}
|
|
459
506
|
}
|
|
507
|
+
} catch (err) {
|
|
508
|
+
console.error(`[VueNative] Error patching style on node ${nodeId}:`, err);
|
|
460
509
|
}
|
|
461
510
|
}
|
|
462
511
|
var nodeOps = {
|
|
@@ -509,22 +558,26 @@ var nodeOps = {
|
|
|
509
558
|
* - all else -> updateProp
|
|
510
559
|
*/
|
|
511
560
|
patchProp(el, key, prevValue, nextValue) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
561
|
+
try {
|
|
562
|
+
if (key.startsWith("on") && key.length > 2 && key[2] === key[2].toUpperCase()) {
|
|
563
|
+
const eventName = toEventName(key);
|
|
564
|
+
if (prevValue) {
|
|
565
|
+
NativeBridge.removeEventListener(el.id, eventName);
|
|
566
|
+
}
|
|
567
|
+
if (nextValue) {
|
|
568
|
+
NativeBridge.addEventListener(el.id, eventName, nextValue);
|
|
569
|
+
}
|
|
570
|
+
return;
|
|
516
571
|
}
|
|
517
|
-
if (
|
|
518
|
-
|
|
572
|
+
if (key === "style") {
|
|
573
|
+
patchStyle(el.id, prevValue, nextValue);
|
|
574
|
+
return;
|
|
519
575
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
return;
|
|
576
|
+
el.props[key] = nextValue;
|
|
577
|
+
NativeBridge.updateProp(el.id, key, nextValue);
|
|
578
|
+
} catch (err) {
|
|
579
|
+
console.error(`[VueNative] Error patching prop "${key}" on node ${el.id}:`, err);
|
|
525
580
|
}
|
|
526
|
-
el.props[key] = nextValue;
|
|
527
|
-
NativeBridge.updateProp(el.id, key, nextValue);
|
|
528
581
|
},
|
|
529
582
|
/**
|
|
530
583
|
* Insert a child node into a parent, optionally before an anchor node.
|
|
@@ -539,30 +592,34 @@ var nodeOps = {
|
|
|
539
592
|
}
|
|
540
593
|
}
|
|
541
594
|
child.parent = parent;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
parent.children.push(child);
|
|
548
|
-
}
|
|
549
|
-
if (child.type !== "__COMMENT__") {
|
|
550
|
-
if (anchor.type !== "__COMMENT__") {
|
|
551
|
-
NativeBridge.insertBefore(parent.id, child.id, anchor.id);
|
|
595
|
+
try {
|
|
596
|
+
if (anchor) {
|
|
597
|
+
const anchorIdx = parent.children.indexOf(anchor);
|
|
598
|
+
if (anchorIdx !== -1) {
|
|
599
|
+
parent.children.splice(anchorIdx, 0, child);
|
|
552
600
|
} else {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
601
|
+
parent.children.push(child);
|
|
602
|
+
}
|
|
603
|
+
if (child.type !== "__COMMENT__") {
|
|
604
|
+
if (anchor.type !== "__COMMENT__") {
|
|
605
|
+
NativeBridge.insertBefore(parent.id, child.id, anchor.id);
|
|
556
606
|
} else {
|
|
557
|
-
|
|
607
|
+
const realAnchor = findNextNonComment(parent, anchor);
|
|
608
|
+
if (realAnchor) {
|
|
609
|
+
NativeBridge.insertBefore(parent.id, child.id, realAnchor.id);
|
|
610
|
+
} else {
|
|
611
|
+
NativeBridge.appendChild(parent.id, child.id);
|
|
612
|
+
}
|
|
558
613
|
}
|
|
559
614
|
}
|
|
615
|
+
} else {
|
|
616
|
+
parent.children.push(child);
|
|
617
|
+
if (child.type !== "__COMMENT__") {
|
|
618
|
+
NativeBridge.appendChild(parent.id, child.id);
|
|
619
|
+
}
|
|
560
620
|
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
if (child.type !== "__COMMENT__") {
|
|
564
|
-
NativeBridge.appendChild(parent.id, child.id);
|
|
565
|
-
}
|
|
621
|
+
} catch (err) {
|
|
622
|
+
console.error(`[VueNative] Error inserting node ${child.id} into ${parent.id}:`, err);
|
|
566
623
|
}
|
|
567
624
|
},
|
|
568
625
|
/**
|
|
@@ -576,8 +633,12 @@ var nodeOps = {
|
|
|
576
633
|
parent.children.splice(idx, 1);
|
|
577
634
|
}
|
|
578
635
|
child.parent = null;
|
|
579
|
-
|
|
580
|
-
|
|
636
|
+
try {
|
|
637
|
+
if (child.type !== "__COMMENT__") {
|
|
638
|
+
NativeBridge.removeChild(parent.id, child.id);
|
|
639
|
+
}
|
|
640
|
+
} catch (err) {
|
|
641
|
+
console.error(`[VueNative] Error removing node ${child.id}:`, err);
|
|
581
642
|
}
|
|
582
643
|
}
|
|
583
644
|
},
|
|
@@ -617,7 +678,10 @@ var VView = (0, import_runtime_core2.defineComponent)({
|
|
|
617
678
|
props: {
|
|
618
679
|
style: Object,
|
|
619
680
|
testID: String,
|
|
620
|
-
accessibilityLabel: String
|
|
681
|
+
accessibilityLabel: String,
|
|
682
|
+
accessibilityRole: String,
|
|
683
|
+
accessibilityHint: String,
|
|
684
|
+
accessibilityState: Object
|
|
621
685
|
},
|
|
622
686
|
setup(props, { slots }) {
|
|
623
687
|
return () => (0, import_runtime_core2.h)("VView", { ...props }, slots.default?.());
|
|
@@ -635,7 +699,10 @@ var VText = (0, import_runtime_core3.defineComponent)({
|
|
|
635
699
|
type: Boolean,
|
|
636
700
|
default: false
|
|
637
701
|
},
|
|
638
|
-
|
|
702
|
+
accessibilityLabel: String,
|
|
703
|
+
accessibilityRole: String,
|
|
704
|
+
accessibilityHint: String,
|
|
705
|
+
accessibilityState: Object
|
|
639
706
|
},
|
|
640
707
|
setup(props, { slots }) {
|
|
641
708
|
return () => (0, import_runtime_core3.h)("VText", { ...props }, slots.default?.());
|
|
@@ -657,7 +724,11 @@ var VButton = (0, import_runtime_core4.defineComponent)({
|
|
|
657
724
|
default: 0.7
|
|
658
725
|
},
|
|
659
726
|
onPress: Function,
|
|
660
|
-
onLongPress: Function
|
|
727
|
+
onLongPress: Function,
|
|
728
|
+
accessibilityLabel: String,
|
|
729
|
+
accessibilityRole: String,
|
|
730
|
+
accessibilityHint: String,
|
|
731
|
+
accessibilityState: Object
|
|
661
732
|
},
|
|
662
733
|
setup(props, { slots }) {
|
|
663
734
|
return () => (0, import_runtime_core4.h)(
|
|
@@ -707,7 +778,11 @@ var VInput = (0, import_runtime_core5.defineComponent)({
|
|
|
707
778
|
type: Boolean,
|
|
708
779
|
default: false
|
|
709
780
|
},
|
|
710
|
-
style: Object
|
|
781
|
+
style: Object,
|
|
782
|
+
accessibilityLabel: String,
|
|
783
|
+
accessibilityRole: String,
|
|
784
|
+
accessibilityHint: String,
|
|
785
|
+
accessibilityState: Object
|
|
711
786
|
},
|
|
712
787
|
emits: ["update:modelValue", "focus", "blur", "submit"],
|
|
713
788
|
setup(props, { emit }) {
|
|
@@ -735,6 +810,10 @@ var VInput = (0, import_runtime_core5.defineComponent)({
|
|
|
735
810
|
maxLength: props.maxLength,
|
|
736
811
|
multiline: props.multiline,
|
|
737
812
|
style: props.style,
|
|
813
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
814
|
+
accessibilityRole: props.accessibilityRole,
|
|
815
|
+
accessibilityHint: props.accessibilityHint,
|
|
816
|
+
accessibilityState: props.accessibilityState,
|
|
738
817
|
onChangetext,
|
|
739
818
|
onFocus,
|
|
740
819
|
onBlur,
|
|
@@ -758,7 +837,11 @@ var VSwitch = (0, import_runtime_core6.defineComponent)({
|
|
|
758
837
|
},
|
|
759
838
|
onTintColor: String,
|
|
760
839
|
thumbTintColor: String,
|
|
761
|
-
style: Object
|
|
840
|
+
style: Object,
|
|
841
|
+
accessibilityLabel: String,
|
|
842
|
+
accessibilityRole: String,
|
|
843
|
+
accessibilityHint: String,
|
|
844
|
+
accessibilityState: Object
|
|
762
845
|
},
|
|
763
846
|
emits: ["update:modelValue", "change"],
|
|
764
847
|
setup(props, { emit }) {
|
|
@@ -773,6 +856,10 @@ var VSwitch = (0, import_runtime_core6.defineComponent)({
|
|
|
773
856
|
onTintColor: props.onTintColor,
|
|
774
857
|
thumbTintColor: props.thumbTintColor,
|
|
775
858
|
style: props.style,
|
|
859
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
860
|
+
accessibilityRole: props.accessibilityRole,
|
|
861
|
+
accessibilityHint: props.accessibilityHint,
|
|
862
|
+
accessibilityState: props.accessibilityState,
|
|
776
863
|
onChange
|
|
777
864
|
});
|
|
778
865
|
}
|
|
@@ -845,7 +932,11 @@ var VScrollView = (0, import_runtime_core8.defineComponent)({
|
|
|
845
932
|
type: Boolean,
|
|
846
933
|
default: false
|
|
847
934
|
},
|
|
848
|
-
style: Object
|
|
935
|
+
style: Object,
|
|
936
|
+
accessibilityLabel: String,
|
|
937
|
+
accessibilityRole: String,
|
|
938
|
+
accessibilityHint: String,
|
|
939
|
+
accessibilityState: Object
|
|
849
940
|
},
|
|
850
941
|
emits: ["scroll", "refresh"],
|
|
851
942
|
setup(props, { slots, emit }) {
|
|
@@ -867,6 +958,10 @@ var VScrollView = (0, import_runtime_core8.defineComponent)({
|
|
|
867
958
|
contentContainerStyle: props.contentContainerStyle,
|
|
868
959
|
refreshing: props.refreshing,
|
|
869
960
|
style: props.style,
|
|
961
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
962
|
+
accessibilityRole: props.accessibilityRole,
|
|
963
|
+
accessibilityHint: props.accessibilityHint,
|
|
964
|
+
accessibilityState: props.accessibilityState,
|
|
870
965
|
onScroll,
|
|
871
966
|
onRefresh
|
|
872
967
|
},
|
|
@@ -887,7 +982,10 @@ var VImage = (0, import_runtime_core9.defineComponent)({
|
|
|
887
982
|
},
|
|
888
983
|
style: Object,
|
|
889
984
|
testID: String,
|
|
890
|
-
accessibilityLabel: String
|
|
985
|
+
accessibilityLabel: String,
|
|
986
|
+
accessibilityRole: String,
|
|
987
|
+
accessibilityHint: String,
|
|
988
|
+
accessibilityState: Object
|
|
891
989
|
},
|
|
892
990
|
emits: ["load", "error"],
|
|
893
991
|
setup(props, { emit }) {
|
|
@@ -935,7 +1033,11 @@ var VSlider = (0, import_runtime_core12.defineComponent)({
|
|
|
935
1033
|
modelValue: { type: Number, default: 0 },
|
|
936
1034
|
min: { type: Number, default: 0 },
|
|
937
1035
|
max: { type: Number, default: 1 },
|
|
938
|
-
style: { type: Object, default: () => ({}) }
|
|
1036
|
+
style: { type: Object, default: () => ({}) },
|
|
1037
|
+
accessibilityLabel: String,
|
|
1038
|
+
accessibilityRole: String,
|
|
1039
|
+
accessibilityHint: String,
|
|
1040
|
+
accessibilityState: Object
|
|
939
1041
|
},
|
|
940
1042
|
emits: ["update:modelValue", "change"],
|
|
941
1043
|
setup(props, { emit }) {
|
|
@@ -944,6 +1046,10 @@ var VSlider = (0, import_runtime_core12.defineComponent)({
|
|
|
944
1046
|
value: props.modelValue,
|
|
945
1047
|
minimumValue: props.min,
|
|
946
1048
|
maximumValue: props.max,
|
|
1049
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1050
|
+
accessibilityRole: props.accessibilityRole,
|
|
1051
|
+
accessibilityHint: props.accessibilityHint,
|
|
1052
|
+
accessibilityState: props.accessibilityState,
|
|
947
1053
|
onChange: (val) => {
|
|
948
1054
|
emit("update:modelValue", val);
|
|
949
1055
|
emit("change", val);
|
|
@@ -1230,6 +1336,352 @@ var VActionSheet = (0, import_runtime_core21.defineComponent)({
|
|
|
1230
1336
|
}
|
|
1231
1337
|
});
|
|
1232
1338
|
|
|
1339
|
+
// src/components/VRefreshControl.ts
|
|
1340
|
+
var import_runtime_core22 = require("@vue/runtime-core");
|
|
1341
|
+
var VRefreshControl = (0, import_runtime_core22.defineComponent)({
|
|
1342
|
+
name: "VRefreshControl",
|
|
1343
|
+
props: {
|
|
1344
|
+
refreshing: {
|
|
1345
|
+
type: Boolean,
|
|
1346
|
+
default: false
|
|
1347
|
+
},
|
|
1348
|
+
onRefresh: Function,
|
|
1349
|
+
tintColor: String,
|
|
1350
|
+
title: String,
|
|
1351
|
+
style: Object
|
|
1352
|
+
},
|
|
1353
|
+
setup(props) {
|
|
1354
|
+
return () => (0, import_runtime_core22.h)("VRefreshControl", {
|
|
1355
|
+
refreshing: props.refreshing,
|
|
1356
|
+
onRefresh: props.onRefresh,
|
|
1357
|
+
tintColor: props.tintColor,
|
|
1358
|
+
title: props.title
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
// src/components/VPressable.ts
|
|
1364
|
+
var import_runtime_core23 = require("@vue/runtime-core");
|
|
1365
|
+
var VPressable = (0, import_runtime_core23.defineComponent)({
|
|
1366
|
+
name: "VPressable",
|
|
1367
|
+
props: {
|
|
1368
|
+
style: Object,
|
|
1369
|
+
disabled: {
|
|
1370
|
+
type: Boolean,
|
|
1371
|
+
default: false
|
|
1372
|
+
},
|
|
1373
|
+
activeOpacity: {
|
|
1374
|
+
type: Number,
|
|
1375
|
+
default: 0.7
|
|
1376
|
+
},
|
|
1377
|
+
onPress: Function,
|
|
1378
|
+
onPressIn: Function,
|
|
1379
|
+
onPressOut: Function,
|
|
1380
|
+
onLongPress: Function,
|
|
1381
|
+
accessibilityLabel: String,
|
|
1382
|
+
accessibilityRole: String,
|
|
1383
|
+
accessibilityHint: String,
|
|
1384
|
+
accessibilityState: Object
|
|
1385
|
+
},
|
|
1386
|
+
setup(props, { slots }) {
|
|
1387
|
+
return () => (0, import_runtime_core23.h)(
|
|
1388
|
+
"VPressable",
|
|
1389
|
+
{
|
|
1390
|
+
...props,
|
|
1391
|
+
onPress: props.disabled ? void 0 : props.onPress,
|
|
1392
|
+
onPressIn: props.disabled ? void 0 : props.onPressIn,
|
|
1393
|
+
onPressOut: props.disabled ? void 0 : props.onPressOut,
|
|
1394
|
+
onLongPress: props.disabled ? void 0 : props.onLongPress
|
|
1395
|
+
},
|
|
1396
|
+
slots.default?.()
|
|
1397
|
+
);
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
|
|
1401
|
+
// src/components/VSectionList.ts
|
|
1402
|
+
var import_runtime_core24 = require("@vue/runtime-core");
|
|
1403
|
+
var VSectionList = (0, import_runtime_core24.defineComponent)({
|
|
1404
|
+
name: "VSectionList",
|
|
1405
|
+
props: {
|
|
1406
|
+
/** Array of section objects, each with a title and data array */
|
|
1407
|
+
sections: {
|
|
1408
|
+
type: Array,
|
|
1409
|
+
required: true
|
|
1410
|
+
},
|
|
1411
|
+
/** Extract a unique key from each item. Defaults to index as string. */
|
|
1412
|
+
keyExtractor: {
|
|
1413
|
+
type: Function,
|
|
1414
|
+
default: (_item, index) => String(index)
|
|
1415
|
+
},
|
|
1416
|
+
/** Estimated height per row in points. Default: 44 */
|
|
1417
|
+
estimatedItemHeight: {
|
|
1418
|
+
type: Number,
|
|
1419
|
+
default: 44
|
|
1420
|
+
},
|
|
1421
|
+
/** Whether section headers stick to the top when scrolling. Default: true */
|
|
1422
|
+
stickySectionHeaders: {
|
|
1423
|
+
type: Boolean,
|
|
1424
|
+
default: true
|
|
1425
|
+
},
|
|
1426
|
+
/** Show vertical scroll indicator. Default: true */
|
|
1427
|
+
showsScrollIndicator: {
|
|
1428
|
+
type: Boolean,
|
|
1429
|
+
default: true
|
|
1430
|
+
},
|
|
1431
|
+
/** Enable bounce at scroll boundaries. Default: true */
|
|
1432
|
+
bounces: {
|
|
1433
|
+
type: Boolean,
|
|
1434
|
+
default: true
|
|
1435
|
+
},
|
|
1436
|
+
style: {
|
|
1437
|
+
type: Object,
|
|
1438
|
+
default: () => ({})
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
emits: ["scroll", "endReached"],
|
|
1442
|
+
setup(props, { slots, emit }) {
|
|
1443
|
+
return () => {
|
|
1444
|
+
const sections = props.sections ?? [];
|
|
1445
|
+
const children = [];
|
|
1446
|
+
if (slots.header) {
|
|
1447
|
+
children.push(
|
|
1448
|
+
(0, import_runtime_core24.h)("VView", { key: "__header__", style: { flexShrink: 0 } }, slots.header())
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
const totalItems = sections.reduce((sum, s) => sum + (s.data?.length ?? 0), 0);
|
|
1452
|
+
if (totalItems === 0 && slots.empty) {
|
|
1453
|
+
children.push(
|
|
1454
|
+
(0, import_runtime_core24.h)("VView", { key: "__empty__", style: { flexShrink: 0 } }, slots.empty())
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) {
|
|
1458
|
+
const section = sections[sectionIndex];
|
|
1459
|
+
if (slots.sectionHeader) {
|
|
1460
|
+
children.push(
|
|
1461
|
+
(0, import_runtime_core24.h)(
|
|
1462
|
+
"VView",
|
|
1463
|
+
{
|
|
1464
|
+
key: `__section_header_${sectionIndex}__`,
|
|
1465
|
+
__sectionHeader: true,
|
|
1466
|
+
style: { flexShrink: 0 }
|
|
1467
|
+
},
|
|
1468
|
+
slots.sectionHeader({ section, index: sectionIndex })
|
|
1469
|
+
)
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
const items = section.data ?? [];
|
|
1473
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
1474
|
+
const item = items[itemIndex];
|
|
1475
|
+
children.push(
|
|
1476
|
+
(0, import_runtime_core24.h)(
|
|
1477
|
+
"VView",
|
|
1478
|
+
{
|
|
1479
|
+
key: `${sectionIndex}_${props.keyExtractor(item, itemIndex)}`,
|
|
1480
|
+
style: { flexShrink: 0 }
|
|
1481
|
+
},
|
|
1482
|
+
slots.item?.({ item, index: itemIndex, section }) ?? []
|
|
1483
|
+
)
|
|
1484
|
+
);
|
|
1485
|
+
}
|
|
1486
|
+
if (slots.sectionFooter) {
|
|
1487
|
+
children.push(
|
|
1488
|
+
(0, import_runtime_core24.h)(
|
|
1489
|
+
"VView",
|
|
1490
|
+
{
|
|
1491
|
+
key: `__section_footer_${sectionIndex}__`,
|
|
1492
|
+
style: { flexShrink: 0 }
|
|
1493
|
+
},
|
|
1494
|
+
slots.sectionFooter({ section, index: sectionIndex })
|
|
1495
|
+
)
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
if (slots.footer) {
|
|
1500
|
+
children.push(
|
|
1501
|
+
(0, import_runtime_core24.h)("VView", { key: "__footer__", style: { flexShrink: 0 } }, slots.footer())
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
return (0, import_runtime_core24.h)(
|
|
1505
|
+
"VSectionList",
|
|
1506
|
+
{
|
|
1507
|
+
style: props.style,
|
|
1508
|
+
estimatedItemHeight: props.estimatedItemHeight,
|
|
1509
|
+
stickySectionHeaders: props.stickySectionHeaders,
|
|
1510
|
+
showsScrollIndicator: props.showsScrollIndicator,
|
|
1511
|
+
bounces: props.bounces,
|
|
1512
|
+
onScroll: (e) => emit("scroll", e),
|
|
1513
|
+
onEndReached: () => emit("endReached")
|
|
1514
|
+
},
|
|
1515
|
+
children
|
|
1516
|
+
);
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
|
|
1521
|
+
// src/components/VCheckbox.ts
|
|
1522
|
+
var import_runtime_core25 = require("@vue/runtime-core");
|
|
1523
|
+
var VCheckbox = (0, import_runtime_core25.defineComponent)({
|
|
1524
|
+
name: "VCheckbox",
|
|
1525
|
+
props: {
|
|
1526
|
+
modelValue: {
|
|
1527
|
+
type: Boolean,
|
|
1528
|
+
default: false
|
|
1529
|
+
},
|
|
1530
|
+
disabled: {
|
|
1531
|
+
type: Boolean,
|
|
1532
|
+
default: false
|
|
1533
|
+
},
|
|
1534
|
+
label: {
|
|
1535
|
+
type: String,
|
|
1536
|
+
default: void 0
|
|
1537
|
+
},
|
|
1538
|
+
checkColor: String,
|
|
1539
|
+
tintColor: String,
|
|
1540
|
+
style: Object,
|
|
1541
|
+
accessibilityLabel: String,
|
|
1542
|
+
accessibilityHint: String
|
|
1543
|
+
},
|
|
1544
|
+
emits: ["update:modelValue", "change"],
|
|
1545
|
+
setup(props, { emit }) {
|
|
1546
|
+
const onChange = (payload) => {
|
|
1547
|
+
const value = typeof payload === "boolean" ? payload : !!(payload?.value ?? payload);
|
|
1548
|
+
emit("update:modelValue", value);
|
|
1549
|
+
emit("change", value);
|
|
1550
|
+
};
|
|
1551
|
+
return () => (0, import_runtime_core25.h)("VCheckbox", {
|
|
1552
|
+
value: props.modelValue,
|
|
1553
|
+
disabled: props.disabled,
|
|
1554
|
+
label: props.label,
|
|
1555
|
+
checkColor: props.checkColor,
|
|
1556
|
+
tintColor: props.tintColor,
|
|
1557
|
+
style: props.style,
|
|
1558
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1559
|
+
accessibilityHint: props.accessibilityHint,
|
|
1560
|
+
onChange
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
// src/components/VRadio.ts
|
|
1566
|
+
var import_runtime_core26 = require("@vue/runtime-core");
|
|
1567
|
+
var VRadio = (0, import_runtime_core26.defineComponent)({
|
|
1568
|
+
name: "VRadio",
|
|
1569
|
+
props: {
|
|
1570
|
+
modelValue: {
|
|
1571
|
+
type: String,
|
|
1572
|
+
default: void 0
|
|
1573
|
+
},
|
|
1574
|
+
options: {
|
|
1575
|
+
type: Array,
|
|
1576
|
+
required: true
|
|
1577
|
+
},
|
|
1578
|
+
disabled: {
|
|
1579
|
+
type: Boolean,
|
|
1580
|
+
default: false
|
|
1581
|
+
},
|
|
1582
|
+
tintColor: String,
|
|
1583
|
+
style: Object,
|
|
1584
|
+
accessibilityLabel: String
|
|
1585
|
+
},
|
|
1586
|
+
emits: ["update:modelValue", "change"],
|
|
1587
|
+
setup(props, { emit }) {
|
|
1588
|
+
const onChange = (payload) => {
|
|
1589
|
+
const value = payload?.value ?? payload;
|
|
1590
|
+
emit("update:modelValue", value);
|
|
1591
|
+
emit("change", value);
|
|
1592
|
+
};
|
|
1593
|
+
return () => (0, import_runtime_core26.h)("VRadio", {
|
|
1594
|
+
selectedValue: props.modelValue,
|
|
1595
|
+
options: props.options,
|
|
1596
|
+
disabled: props.disabled,
|
|
1597
|
+
tintColor: props.tintColor,
|
|
1598
|
+
style: props.style,
|
|
1599
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1600
|
+
onChange
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
|
|
1605
|
+
// src/components/VDropdown.ts
|
|
1606
|
+
var import_runtime_core27 = require("@vue/runtime-core");
|
|
1607
|
+
var VDropdown = (0, import_runtime_core27.defineComponent)({
|
|
1608
|
+
name: "VDropdown",
|
|
1609
|
+
props: {
|
|
1610
|
+
modelValue: {
|
|
1611
|
+
type: String,
|
|
1612
|
+
default: void 0
|
|
1613
|
+
},
|
|
1614
|
+
options: {
|
|
1615
|
+
type: Array,
|
|
1616
|
+
required: true
|
|
1617
|
+
},
|
|
1618
|
+
placeholder: {
|
|
1619
|
+
type: String,
|
|
1620
|
+
default: "Select..."
|
|
1621
|
+
},
|
|
1622
|
+
disabled: {
|
|
1623
|
+
type: Boolean,
|
|
1624
|
+
default: false
|
|
1625
|
+
},
|
|
1626
|
+
tintColor: String,
|
|
1627
|
+
style: Object,
|
|
1628
|
+
accessibilityLabel: String
|
|
1629
|
+
},
|
|
1630
|
+
emits: ["update:modelValue", "change"],
|
|
1631
|
+
setup(props, { emit }) {
|
|
1632
|
+
const onChange = (payload) => {
|
|
1633
|
+
const value = payload?.value ?? payload;
|
|
1634
|
+
emit("update:modelValue", value);
|
|
1635
|
+
emit("change", value);
|
|
1636
|
+
};
|
|
1637
|
+
return () => (0, import_runtime_core27.h)("VDropdown", {
|
|
1638
|
+
selectedValue: props.modelValue,
|
|
1639
|
+
options: props.options,
|
|
1640
|
+
placeholder: props.placeholder,
|
|
1641
|
+
disabled: props.disabled,
|
|
1642
|
+
tintColor: props.tintColor,
|
|
1643
|
+
style: props.style,
|
|
1644
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
1645
|
+
onChange
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
|
|
1650
|
+
// src/components/VVideo.ts
|
|
1651
|
+
var import_runtime_core28 = require("@vue/runtime-core");
|
|
1652
|
+
var VVideo = (0, import_runtime_core28.defineComponent)({
|
|
1653
|
+
name: "VVideo",
|
|
1654
|
+
props: {
|
|
1655
|
+
source: Object,
|
|
1656
|
+
autoplay: { type: Boolean, default: false },
|
|
1657
|
+
loop: { type: Boolean, default: false },
|
|
1658
|
+
muted: { type: Boolean, default: false },
|
|
1659
|
+
paused: { type: Boolean, default: false },
|
|
1660
|
+
controls: { type: Boolean, default: true },
|
|
1661
|
+
volume: { type: Number, default: 1 },
|
|
1662
|
+
resizeMode: {
|
|
1663
|
+
type: String,
|
|
1664
|
+
default: "cover"
|
|
1665
|
+
},
|
|
1666
|
+
poster: String,
|
|
1667
|
+
style: Object,
|
|
1668
|
+
testID: String,
|
|
1669
|
+
accessibilityLabel: String
|
|
1670
|
+
},
|
|
1671
|
+
emits: ["ready", "play", "pause", "end", "error", "progress"],
|
|
1672
|
+
setup(props, { emit }) {
|
|
1673
|
+
return () => (0, import_runtime_core28.h)("VVideo", {
|
|
1674
|
+
...props,
|
|
1675
|
+
onReady: (e) => emit("ready", e),
|
|
1676
|
+
onPlay: () => emit("play"),
|
|
1677
|
+
onPause: () => emit("pause"),
|
|
1678
|
+
onEnd: () => emit("end"),
|
|
1679
|
+
onError: (e) => emit("error", e),
|
|
1680
|
+
onProgress: (e) => emit("progress", e)
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1684
|
+
|
|
1233
1685
|
// src/directives/vShow.ts
|
|
1234
1686
|
var vShow = {
|
|
1235
1687
|
beforeMount(el, { value }) {
|
|
@@ -1241,8 +1693,53 @@ var vShow = {
|
|
|
1241
1693
|
}
|
|
1242
1694
|
};
|
|
1243
1695
|
|
|
1244
|
-
// src/
|
|
1245
|
-
|
|
1696
|
+
// src/errorBoundary.ts
|
|
1697
|
+
var import_runtime_core29 = require("@vue/runtime-core");
|
|
1698
|
+
var ErrorBoundary = (0, import_runtime_core29.defineComponent)({
|
|
1699
|
+
name: "ErrorBoundary",
|
|
1700
|
+
props: {
|
|
1701
|
+
onError: Function,
|
|
1702
|
+
resetKeys: {
|
|
1703
|
+
type: Array,
|
|
1704
|
+
default: () => []
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
setup(props, { slots }) {
|
|
1708
|
+
const error = (0, import_runtime_core29.ref)(null);
|
|
1709
|
+
const errorInfo = (0, import_runtime_core29.ref)("");
|
|
1710
|
+
(0, import_runtime_core29.onErrorCaptured)((err, _instance, info) => {
|
|
1711
|
+
const normalizedError = err instanceof Error ? err : new Error(String(err));
|
|
1712
|
+
error.value = normalizedError;
|
|
1713
|
+
errorInfo.value = info;
|
|
1714
|
+
if (props.onError) {
|
|
1715
|
+
props.onError(normalizedError, info);
|
|
1716
|
+
}
|
|
1717
|
+
return false;
|
|
1718
|
+
});
|
|
1719
|
+
function reset() {
|
|
1720
|
+
error.value = null;
|
|
1721
|
+
errorInfo.value = "";
|
|
1722
|
+
}
|
|
1723
|
+
(0, import_runtime_core29.watch)(
|
|
1724
|
+
() => props.resetKeys,
|
|
1725
|
+
() => {
|
|
1726
|
+
if (error.value) {
|
|
1727
|
+
reset();
|
|
1728
|
+
}
|
|
1729
|
+
},
|
|
1730
|
+
{ deep: true }
|
|
1731
|
+
);
|
|
1732
|
+
return () => {
|
|
1733
|
+
if (error.value && slots.fallback) {
|
|
1734
|
+
return slots.fallback({ error: error.value, errorInfo: errorInfo.value, reset });
|
|
1735
|
+
}
|
|
1736
|
+
return slots.default?.();
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
});
|
|
1740
|
+
|
|
1741
|
+
// src/index.ts
|
|
1742
|
+
__reExport(index_exports, require("@vue/runtime-core"), module.exports);
|
|
1246
1743
|
|
|
1247
1744
|
// src/stylesheet.ts
|
|
1248
1745
|
var validStyleProperties = /* @__PURE__ */ new Set([
|
|
@@ -1285,6 +1782,7 @@ var validStyleProperties = /* @__PURE__ */ new Set([
|
|
|
1285
1782
|
"gap",
|
|
1286
1783
|
"rowGap",
|
|
1287
1784
|
"columnGap",
|
|
1785
|
+
"direction",
|
|
1288
1786
|
"display",
|
|
1289
1787
|
"overflow",
|
|
1290
1788
|
"zIndex",
|
|
@@ -1332,7 +1830,15 @@ var validStyleProperties = /* @__PURE__ */ new Set([
|
|
|
1332
1830
|
"resizeMode",
|
|
1333
1831
|
"tintColor",
|
|
1334
1832
|
// Transform
|
|
1335
|
-
"transform"
|
|
1833
|
+
"transform",
|
|
1834
|
+
// Accessibility
|
|
1835
|
+
"accessibilityLabel",
|
|
1836
|
+
"accessibilityRole",
|
|
1837
|
+
"accessibilityHint",
|
|
1838
|
+
"accessibilityState",
|
|
1839
|
+
"accessibilityValue",
|
|
1840
|
+
"accessible",
|
|
1841
|
+
"importantForAccessibility"
|
|
1336
1842
|
]);
|
|
1337
1843
|
function createStyleSheet(styles) {
|
|
1338
1844
|
const isDev = typeof __DEV__ !== "undefined" ? __DEV__ : true;
|
|
@@ -1390,9 +1896,9 @@ function useAsyncStorage() {
|
|
|
1390
1896
|
}
|
|
1391
1897
|
|
|
1392
1898
|
// src/composables/useClipboard.ts
|
|
1393
|
-
var
|
|
1899
|
+
var import_runtime_core30 = require("@vue/runtime-core");
|
|
1394
1900
|
function useClipboard() {
|
|
1395
|
-
const content = (0,
|
|
1901
|
+
const content = (0, import_runtime_core30.ref)("");
|
|
1396
1902
|
function copy(text) {
|
|
1397
1903
|
return NativeBridge.invokeNativeModule("Clipboard", "copy", [text]).then(() => void 0);
|
|
1398
1904
|
}
|
|
@@ -1406,16 +1912,16 @@ function useClipboard() {
|
|
|
1406
1912
|
}
|
|
1407
1913
|
|
|
1408
1914
|
// src/composables/useDeviceInfo.ts
|
|
1409
|
-
var
|
|
1915
|
+
var import_runtime_core31 = require("@vue/runtime-core");
|
|
1410
1916
|
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,
|
|
1917
|
+
const model = (0, import_runtime_core31.ref)("");
|
|
1918
|
+
const systemVersion = (0, import_runtime_core31.ref)("");
|
|
1919
|
+
const systemName = (0, import_runtime_core31.ref)("");
|
|
1920
|
+
const name = (0, import_runtime_core31.ref)("");
|
|
1921
|
+
const screenWidth = (0, import_runtime_core31.ref)(0);
|
|
1922
|
+
const screenHeight = (0, import_runtime_core31.ref)(0);
|
|
1923
|
+
const scale = (0, import_runtime_core31.ref)(1);
|
|
1924
|
+
const isLoaded = (0, import_runtime_core31.ref)(false);
|
|
1419
1925
|
async function fetchInfo() {
|
|
1420
1926
|
const info = await NativeBridge.invokeNativeModule("DeviceInfo", "getInfo", []);
|
|
1421
1927
|
model.value = info.model ?? "";
|
|
@@ -1427,7 +1933,7 @@ function useDeviceInfo() {
|
|
|
1427
1933
|
scale.value = info.scale ?? 1;
|
|
1428
1934
|
isLoaded.value = true;
|
|
1429
1935
|
}
|
|
1430
|
-
(0,
|
|
1936
|
+
(0, import_runtime_core31.onMounted)(() => {
|
|
1431
1937
|
fetchInfo();
|
|
1432
1938
|
});
|
|
1433
1939
|
return {
|
|
@@ -1444,10 +1950,10 @@ function useDeviceInfo() {
|
|
|
1444
1950
|
}
|
|
1445
1951
|
|
|
1446
1952
|
// src/composables/useKeyboard.ts
|
|
1447
|
-
var
|
|
1953
|
+
var import_runtime_core32 = require("@vue/runtime-core");
|
|
1448
1954
|
function useKeyboard() {
|
|
1449
|
-
const isVisible = (0,
|
|
1450
|
-
const height = (0,
|
|
1955
|
+
const isVisible = (0, import_runtime_core32.ref)(false);
|
|
1956
|
+
const height = (0, import_runtime_core32.ref)(0);
|
|
1451
1957
|
function dismiss() {
|
|
1452
1958
|
return NativeBridge.invokeNativeModule("Keyboard", "dismiss", []).then(() => void 0);
|
|
1453
1959
|
}
|
|
@@ -1511,10 +2017,10 @@ function useAnimation() {
|
|
|
1511
2017
|
}
|
|
1512
2018
|
|
|
1513
2019
|
// src/composables/useNetwork.ts
|
|
1514
|
-
var
|
|
2020
|
+
var import_runtime_core33 = require("@vue/runtime-core");
|
|
1515
2021
|
function useNetwork() {
|
|
1516
|
-
const isConnected = (0,
|
|
1517
|
-
const connectionType = (0,
|
|
2022
|
+
const isConnected = (0, import_runtime_core33.ref)(true);
|
|
2023
|
+
const connectionType = (0, import_runtime_core33.ref)("unknown");
|
|
1518
2024
|
NativeBridge.invokeNativeModule("Network", "getStatus").then((status) => {
|
|
1519
2025
|
isConnected.value = status.isConnected;
|
|
1520
2026
|
connectionType.value = status.connectionType;
|
|
@@ -1524,14 +2030,14 @@ function useNetwork() {
|
|
|
1524
2030
|
isConnected.value = payload.isConnected;
|
|
1525
2031
|
connectionType.value = payload.connectionType;
|
|
1526
2032
|
});
|
|
1527
|
-
(0,
|
|
2033
|
+
(0, import_runtime_core33.onUnmounted)(unsubscribe);
|
|
1528
2034
|
return { isConnected, connectionType };
|
|
1529
2035
|
}
|
|
1530
2036
|
|
|
1531
2037
|
// src/composables/useAppState.ts
|
|
1532
|
-
var
|
|
2038
|
+
var import_runtime_core34 = require("@vue/runtime-core");
|
|
1533
2039
|
function useAppState() {
|
|
1534
|
-
const state = (0,
|
|
2040
|
+
const state = (0, import_runtime_core34.ref)("active");
|
|
1535
2041
|
NativeBridge.invokeNativeModule("AppState", "getState").then((s) => {
|
|
1536
2042
|
state.value = s;
|
|
1537
2043
|
}).catch(() => {
|
|
@@ -1539,7 +2045,7 @@ function useAppState() {
|
|
|
1539
2045
|
const unsubscribe = NativeBridge.onGlobalEvent("appState:change", (payload) => {
|
|
1540
2046
|
state.value = payload.state;
|
|
1541
2047
|
});
|
|
1542
|
-
(0,
|
|
2048
|
+
(0, import_runtime_core34.onUnmounted)(unsubscribe);
|
|
1543
2049
|
return { state };
|
|
1544
2050
|
}
|
|
1545
2051
|
|
|
@@ -1574,10 +2080,10 @@ function usePermissions() {
|
|
|
1574
2080
|
}
|
|
1575
2081
|
|
|
1576
2082
|
// src/composables/useGeolocation.ts
|
|
1577
|
-
var
|
|
2083
|
+
var import_runtime_core35 = require("@vue/runtime-core");
|
|
1578
2084
|
function useGeolocation() {
|
|
1579
|
-
const coords = (0,
|
|
1580
|
-
const error = (0,
|
|
2085
|
+
const coords = (0, import_runtime_core35.ref)(null);
|
|
2086
|
+
const error = (0, import_runtime_core35.ref)(null);
|
|
1581
2087
|
let watchId = null;
|
|
1582
2088
|
async function getCurrentPosition() {
|
|
1583
2089
|
const result = await NativeBridge.invokeNativeModule("Geolocation", "getCurrentPosition");
|
|
@@ -1590,7 +2096,7 @@ function useGeolocation() {
|
|
|
1590
2096
|
const unsubscribe = NativeBridge.onGlobalEvent("location:update", (payload) => {
|
|
1591
2097
|
coords.value = payload;
|
|
1592
2098
|
});
|
|
1593
|
-
(0,
|
|
2099
|
+
(0, import_runtime_core35.onUnmounted)(() => {
|
|
1594
2100
|
unsubscribe();
|
|
1595
2101
|
if (watchId !== null) clearWatch(watchId);
|
|
1596
2102
|
});
|
|
@@ -1604,20 +2110,43 @@ function useGeolocation() {
|
|
|
1604
2110
|
}
|
|
1605
2111
|
|
|
1606
2112
|
// src/composables/useCamera.ts
|
|
2113
|
+
var import_runtime_core36 = require("@vue/runtime-core");
|
|
1607
2114
|
function useCamera() {
|
|
2115
|
+
const qrCleanups = [];
|
|
1608
2116
|
async function launchCamera(options = {}) {
|
|
1609
2117
|
return NativeBridge.invokeNativeModule("Camera", "launchCamera", [options]);
|
|
1610
2118
|
}
|
|
1611
2119
|
async function launchImageLibrary(options = {}) {
|
|
1612
2120
|
return NativeBridge.invokeNativeModule("Camera", "launchImageLibrary", [options]);
|
|
1613
2121
|
}
|
|
1614
|
-
|
|
2122
|
+
async function captureVideo(options = {}) {
|
|
2123
|
+
return NativeBridge.invokeNativeModule("Camera", "captureVideo", [options]);
|
|
2124
|
+
}
|
|
2125
|
+
async function scanQRCode() {
|
|
2126
|
+
return NativeBridge.invokeNativeModule("Camera", "scanQRCode");
|
|
2127
|
+
}
|
|
2128
|
+
async function stopQRScan() {
|
|
2129
|
+
return NativeBridge.invokeNativeModule("Camera", "stopQRScan");
|
|
2130
|
+
}
|
|
2131
|
+
function onQRCodeDetected(callback) {
|
|
2132
|
+
const unsubscribe = NativeBridge.onGlobalEvent("camera:qrDetected", callback);
|
|
2133
|
+
qrCleanups.push(unsubscribe);
|
|
2134
|
+
return unsubscribe;
|
|
2135
|
+
}
|
|
2136
|
+
(0, import_runtime_core36.onUnmounted)(() => {
|
|
2137
|
+
NativeBridge.invokeNativeModule("Camera", "stopQRScan").catch(() => {
|
|
2138
|
+
});
|
|
2139
|
+
qrCleanups.forEach((fn) => fn());
|
|
2140
|
+
qrCleanups.length = 0;
|
|
2141
|
+
});
|
|
2142
|
+
return { launchCamera, launchImageLibrary, captureVideo, scanQRCode, stopQRScan, onQRCodeDetected };
|
|
1615
2143
|
}
|
|
1616
2144
|
|
|
1617
2145
|
// src/composables/useNotifications.ts
|
|
1618
|
-
var
|
|
2146
|
+
var import_runtime_core37 = require("@vue/runtime-core");
|
|
1619
2147
|
function useNotifications() {
|
|
1620
|
-
const isGranted = (0,
|
|
2148
|
+
const isGranted = (0, import_runtime_core37.ref)(false);
|
|
2149
|
+
const pushToken = (0, import_runtime_core37.ref)(null);
|
|
1621
2150
|
async function requestPermission() {
|
|
1622
2151
|
const granted = await NativeBridge.invokeNativeModule("Notifications", "requestPermission");
|
|
1623
2152
|
isGranted.value = granted;
|
|
@@ -1637,10 +2166,44 @@ function useNotifications() {
|
|
|
1637
2166
|
}
|
|
1638
2167
|
function onNotification(handler) {
|
|
1639
2168
|
const unsubscribe = NativeBridge.onGlobalEvent("notification:received", handler);
|
|
1640
|
-
(0,
|
|
2169
|
+
(0, import_runtime_core37.onUnmounted)(unsubscribe);
|
|
1641
2170
|
return unsubscribe;
|
|
1642
2171
|
}
|
|
1643
|
-
|
|
2172
|
+
async function registerForPush() {
|
|
2173
|
+
await NativeBridge.invokeNativeModule("Notifications", "registerForPush");
|
|
2174
|
+
}
|
|
2175
|
+
async function getToken() {
|
|
2176
|
+
return NativeBridge.invokeNativeModule("Notifications", "getToken");
|
|
2177
|
+
}
|
|
2178
|
+
function onPushToken(handler) {
|
|
2179
|
+
const unsubscribe = NativeBridge.onGlobalEvent("push:token", (payload) => {
|
|
2180
|
+
pushToken.value = payload.token;
|
|
2181
|
+
handler(payload.token);
|
|
2182
|
+
});
|
|
2183
|
+
(0, import_runtime_core37.onUnmounted)(unsubscribe);
|
|
2184
|
+
return unsubscribe;
|
|
2185
|
+
}
|
|
2186
|
+
function onPushReceived(handler) {
|
|
2187
|
+
const unsubscribe = NativeBridge.onGlobalEvent("push:received", handler);
|
|
2188
|
+
(0, import_runtime_core37.onUnmounted)(unsubscribe);
|
|
2189
|
+
return unsubscribe;
|
|
2190
|
+
}
|
|
2191
|
+
return {
|
|
2192
|
+
// Local
|
|
2193
|
+
isGranted,
|
|
2194
|
+
requestPermission,
|
|
2195
|
+
getPermissionStatus,
|
|
2196
|
+
scheduleLocal,
|
|
2197
|
+
cancel,
|
|
2198
|
+
cancelAll,
|
|
2199
|
+
onNotification,
|
|
2200
|
+
// Push
|
|
2201
|
+
pushToken,
|
|
2202
|
+
registerForPush,
|
|
2203
|
+
getToken,
|
|
2204
|
+
onPushToken,
|
|
2205
|
+
onPushReceived
|
|
2206
|
+
};
|
|
1644
2207
|
}
|
|
1645
2208
|
|
|
1646
2209
|
// src/composables/useBiometry.ts
|
|
@@ -1658,10 +2221,18 @@ function useBiometry() {
|
|
|
1658
2221
|
}
|
|
1659
2222
|
|
|
1660
2223
|
// src/composables/useHttp.ts
|
|
1661
|
-
var
|
|
2224
|
+
var import_runtime_core38 = require("@vue/runtime-core");
|
|
1662
2225
|
function useHttp(config = {}) {
|
|
1663
|
-
|
|
1664
|
-
|
|
2226
|
+
if (config.pins && Object.keys(config.pins).length > 0) {
|
|
2227
|
+
const configurePins = globalThis.__VN_configurePins;
|
|
2228
|
+
if (typeof configurePins === "function") {
|
|
2229
|
+
configurePins(JSON.stringify(config.pins));
|
|
2230
|
+
} else {
|
|
2231
|
+
NativeBridge.invokeNativeModule("Http", "configurePins", [config.pins]);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
const loading = (0, import_runtime_core38.ref)(false);
|
|
2235
|
+
const error = (0, import_runtime_core38.ref)(null);
|
|
1665
2236
|
async function request(method, url, options = {}) {
|
|
1666
2237
|
const fullUrl = config.baseURL ? `${config.baseURL}${url}` : url;
|
|
1667
2238
|
loading.value = true;
|
|
@@ -1707,10 +2278,10 @@ function useHttp(config = {}) {
|
|
|
1707
2278
|
}
|
|
1708
2279
|
|
|
1709
2280
|
// src/composables/useColorScheme.ts
|
|
1710
|
-
var
|
|
2281
|
+
var import_runtime_core39 = require("@vue/runtime-core");
|
|
1711
2282
|
function useColorScheme() {
|
|
1712
|
-
const colorScheme = (0,
|
|
1713
|
-
const isDark = (0,
|
|
2283
|
+
const colorScheme = (0, import_runtime_core39.ref)("light");
|
|
2284
|
+
const isDark = (0, import_runtime_core39.ref)(false);
|
|
1714
2285
|
const unsubscribe = NativeBridge.onGlobalEvent(
|
|
1715
2286
|
"colorScheme:change",
|
|
1716
2287
|
(payload) => {
|
|
@@ -1718,23 +2289,1067 @@ function useColorScheme() {
|
|
|
1718
2289
|
isDark.value = payload.colorScheme === "dark";
|
|
1719
2290
|
}
|
|
1720
2291
|
);
|
|
1721
|
-
(0,
|
|
2292
|
+
(0, import_runtime_core39.onUnmounted)(unsubscribe);
|
|
1722
2293
|
return { colorScheme, isDark };
|
|
1723
2294
|
}
|
|
1724
2295
|
|
|
1725
2296
|
// src/composables/useBackHandler.ts
|
|
1726
|
-
var
|
|
2297
|
+
var import_runtime_core40 = require("@vue/runtime-core");
|
|
1727
2298
|
function useBackHandler(handler) {
|
|
1728
2299
|
let unsubscribe = null;
|
|
1729
|
-
(0,
|
|
2300
|
+
(0, import_runtime_core40.onMounted)(() => {
|
|
1730
2301
|
unsubscribe = NativeBridge.onGlobalEvent("hardware:backPress", () => {
|
|
1731
2302
|
handler();
|
|
1732
2303
|
});
|
|
1733
2304
|
});
|
|
1734
|
-
(0,
|
|
2305
|
+
(0, import_runtime_core40.onUnmounted)(() => {
|
|
2306
|
+
unsubscribe?.();
|
|
2307
|
+
unsubscribe = null;
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// src/composables/useSecureStorage.ts
|
|
2312
|
+
function useSecureStorage() {
|
|
2313
|
+
function getItem(key) {
|
|
2314
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "get", [key]);
|
|
2315
|
+
}
|
|
2316
|
+
function setItem(key, value) {
|
|
2317
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "set", [key, value]).then(() => void 0);
|
|
2318
|
+
}
|
|
2319
|
+
function removeItem(key) {
|
|
2320
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "remove", [key]).then(() => void 0);
|
|
2321
|
+
}
|
|
2322
|
+
function clear() {
|
|
2323
|
+
return NativeBridge.invokeNativeModule("SecureStorage", "clear", []).then(() => void 0);
|
|
2324
|
+
}
|
|
2325
|
+
return { getItem, setItem, removeItem, clear };
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
// src/composables/useI18n.ts
|
|
2329
|
+
var import_runtime_core41 = require("@vue/runtime-core");
|
|
2330
|
+
function useI18n() {
|
|
2331
|
+
const isRTL = (0, import_runtime_core41.ref)(false);
|
|
2332
|
+
const locale = (0, import_runtime_core41.ref)("en");
|
|
2333
|
+
(0, import_runtime_core41.onMounted)(async () => {
|
|
2334
|
+
try {
|
|
2335
|
+
const info = await NativeBridge.invokeNativeModule("DeviceInfo", "getDeviceInfo", []);
|
|
2336
|
+
locale.value = info?.locale || "en";
|
|
2337
|
+
isRTL.value = ["ar", "he", "fa", "ur"].some((l) => locale.value.startsWith(l));
|
|
2338
|
+
} catch {
|
|
2339
|
+
}
|
|
2340
|
+
});
|
|
2341
|
+
return { isRTL, locale };
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
// src/composables/usePlatform.ts
|
|
2345
|
+
function usePlatform() {
|
|
2346
|
+
const platform = typeof __PLATFORM__ !== "undefined" ? __PLATFORM__ : "ios";
|
|
2347
|
+
const isIOS = platform === "ios";
|
|
2348
|
+
const isAndroid = platform === "android";
|
|
2349
|
+
return { platform, isIOS, isAndroid };
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// src/composables/useDimensions.ts
|
|
2353
|
+
var import_runtime_core42 = require("@vue/runtime-core");
|
|
2354
|
+
function useDimensions() {
|
|
2355
|
+
const width = (0, import_runtime_core42.ref)(0);
|
|
2356
|
+
const height = (0, import_runtime_core42.ref)(0);
|
|
2357
|
+
const scale = (0, import_runtime_core42.ref)(1);
|
|
2358
|
+
(0, import_runtime_core42.onMounted)(async () => {
|
|
2359
|
+
try {
|
|
2360
|
+
const info = await NativeBridge.invokeNativeModule("DeviceInfo", "getInfo", []);
|
|
2361
|
+
width.value = info?.screenWidth || 0;
|
|
2362
|
+
height.value = info?.screenHeight || 0;
|
|
2363
|
+
scale.value = info?.scale || 1;
|
|
2364
|
+
} catch {
|
|
2365
|
+
}
|
|
2366
|
+
});
|
|
2367
|
+
const cleanup = NativeBridge.onGlobalEvent("dimensionsChange", (payload) => {
|
|
2368
|
+
if (payload.width != null) width.value = payload.width;
|
|
2369
|
+
if (payload.height != null) height.value = payload.height;
|
|
2370
|
+
if (payload.scale != null) scale.value = payload.scale;
|
|
2371
|
+
});
|
|
2372
|
+
(0, import_runtime_core42.onUnmounted)(cleanup);
|
|
2373
|
+
return { width, height, scale };
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
// src/composables/useWebSocket.ts
|
|
2377
|
+
var import_runtime_core43 = require("@vue/runtime-core");
|
|
2378
|
+
var connectionCounter = 0;
|
|
2379
|
+
function useWebSocket(url, options = {}) {
|
|
2380
|
+
const {
|
|
2381
|
+
autoConnect = true,
|
|
2382
|
+
autoReconnect = false,
|
|
2383
|
+
maxReconnectAttempts = 3,
|
|
2384
|
+
reconnectInterval = 1e3
|
|
2385
|
+
} = options;
|
|
2386
|
+
const connectionId = `ws_${++connectionCounter}_${Date.now()}`;
|
|
2387
|
+
const status = (0, import_runtime_core43.ref)("CLOSED");
|
|
2388
|
+
const lastMessage = (0, import_runtime_core43.ref)(null);
|
|
2389
|
+
const error = (0, import_runtime_core43.ref)(null);
|
|
2390
|
+
let reconnectAttempts = 0;
|
|
2391
|
+
let reconnectTimer = null;
|
|
2392
|
+
const unsubscribers = [];
|
|
2393
|
+
unsubscribers.push(
|
|
2394
|
+
NativeBridge.onGlobalEvent("websocket:open", (payload) => {
|
|
2395
|
+
if (payload.connectionId !== connectionId) return;
|
|
2396
|
+
status.value = "OPEN";
|
|
2397
|
+
error.value = null;
|
|
2398
|
+
reconnectAttempts = 0;
|
|
2399
|
+
})
|
|
2400
|
+
);
|
|
2401
|
+
unsubscribers.push(
|
|
2402
|
+
NativeBridge.onGlobalEvent("websocket:message", (payload) => {
|
|
2403
|
+
if (payload.connectionId !== connectionId) return;
|
|
2404
|
+
lastMessage.value = payload.data;
|
|
2405
|
+
})
|
|
2406
|
+
);
|
|
2407
|
+
unsubscribers.push(
|
|
2408
|
+
NativeBridge.onGlobalEvent("websocket:close", (payload) => {
|
|
2409
|
+
if (payload.connectionId !== connectionId) return;
|
|
2410
|
+
status.value = "CLOSED";
|
|
2411
|
+
if (autoReconnect && reconnectAttempts < maxReconnectAttempts && payload.code !== 1e3) {
|
|
2412
|
+
reconnectAttempts++;
|
|
2413
|
+
reconnectTimer = setTimeout(() => {
|
|
2414
|
+
open();
|
|
2415
|
+
}, reconnectInterval);
|
|
2416
|
+
}
|
|
2417
|
+
})
|
|
2418
|
+
);
|
|
2419
|
+
unsubscribers.push(
|
|
2420
|
+
NativeBridge.onGlobalEvent("websocket:error", (payload) => {
|
|
2421
|
+
if (payload.connectionId !== connectionId) return;
|
|
2422
|
+
error.value = payload.message;
|
|
2423
|
+
})
|
|
2424
|
+
);
|
|
2425
|
+
function open() {
|
|
2426
|
+
if (status.value === "OPEN" || status.value === "CONNECTING") return;
|
|
2427
|
+
status.value = "CONNECTING";
|
|
2428
|
+
error.value = null;
|
|
2429
|
+
NativeBridge.invokeNativeModule("WebSocket", "connect", [url, connectionId]).catch((err) => {
|
|
2430
|
+
status.value = "CLOSED";
|
|
2431
|
+
error.value = err.message;
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
function send(data) {
|
|
2435
|
+
if (status.value !== "OPEN") return;
|
|
2436
|
+
const message = typeof data === "string" ? data : JSON.stringify(data);
|
|
2437
|
+
NativeBridge.invokeNativeModule("WebSocket", "send", [connectionId, message]).catch((err) => {
|
|
2438
|
+
error.value = err.message;
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
function close(code, reason) {
|
|
2442
|
+
if (status.value === "CLOSED" || status.value === "CLOSING") return;
|
|
2443
|
+
status.value = "CLOSING";
|
|
2444
|
+
if (reconnectTimer) {
|
|
2445
|
+
clearTimeout(reconnectTimer);
|
|
2446
|
+
reconnectTimer = null;
|
|
2447
|
+
}
|
|
2448
|
+
reconnectAttempts = maxReconnectAttempts;
|
|
2449
|
+
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, code ?? 1e3, reason ?? ""]).catch(() => {
|
|
2450
|
+
status.value = "CLOSED";
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
if (autoConnect) {
|
|
2454
|
+
open();
|
|
2455
|
+
}
|
|
2456
|
+
(0, import_runtime_core43.onUnmounted)(() => {
|
|
2457
|
+
if (reconnectTimer) {
|
|
2458
|
+
clearTimeout(reconnectTimer);
|
|
2459
|
+
}
|
|
2460
|
+
if (status.value === "OPEN" || status.value === "CONNECTING") {
|
|
2461
|
+
reconnectAttempts = maxReconnectAttempts;
|
|
2462
|
+
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, 1e3, ""]).catch(() => {
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2465
|
+
unsubscribers.forEach((unsub) => unsub());
|
|
2466
|
+
});
|
|
2467
|
+
return { status, lastMessage, error, send, close, open };
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// src/composables/useFileSystem.ts
|
|
2471
|
+
function useFileSystem() {
|
|
2472
|
+
function readFile(path, encoding) {
|
|
2473
|
+
return NativeBridge.invokeNativeModule("FileSystem", "readFile", [path, encoding ?? "utf8"]);
|
|
2474
|
+
}
|
|
2475
|
+
function writeFile(path, content, encoding) {
|
|
2476
|
+
return NativeBridge.invokeNativeModule("FileSystem", "writeFile", [path, content, encoding ?? "utf8"]).then(() => void 0);
|
|
2477
|
+
}
|
|
2478
|
+
function deleteFile(path) {
|
|
2479
|
+
return NativeBridge.invokeNativeModule("FileSystem", "deleteFile", [path]).then(() => void 0);
|
|
2480
|
+
}
|
|
2481
|
+
function exists(path) {
|
|
2482
|
+
return NativeBridge.invokeNativeModule("FileSystem", "exists", [path]);
|
|
2483
|
+
}
|
|
2484
|
+
function listDirectory(path) {
|
|
2485
|
+
return NativeBridge.invokeNativeModule("FileSystem", "listDirectory", [path]);
|
|
2486
|
+
}
|
|
2487
|
+
function downloadFile(url, destPath) {
|
|
2488
|
+
return NativeBridge.invokeNativeModule("FileSystem", "downloadFile", [url, destPath]);
|
|
2489
|
+
}
|
|
2490
|
+
function getDocumentsPath() {
|
|
2491
|
+
return NativeBridge.invokeNativeModule("FileSystem", "getDocumentsPath", []);
|
|
2492
|
+
}
|
|
2493
|
+
function getCachesPath() {
|
|
2494
|
+
return NativeBridge.invokeNativeModule("FileSystem", "getCachesPath", []);
|
|
2495
|
+
}
|
|
2496
|
+
function stat(path) {
|
|
2497
|
+
return NativeBridge.invokeNativeModule("FileSystem", "stat", [path]);
|
|
2498
|
+
}
|
|
2499
|
+
function mkdir(path) {
|
|
2500
|
+
return NativeBridge.invokeNativeModule("FileSystem", "mkdir", [path]).then(() => void 0);
|
|
2501
|
+
}
|
|
2502
|
+
function copyFile(srcPath, destPath) {
|
|
2503
|
+
return NativeBridge.invokeNativeModule("FileSystem", "copyFile", [srcPath, destPath]).then(() => void 0);
|
|
2504
|
+
}
|
|
2505
|
+
function moveFile(srcPath, destPath) {
|
|
2506
|
+
return NativeBridge.invokeNativeModule("FileSystem", "moveFile", [srcPath, destPath]).then(() => void 0);
|
|
2507
|
+
}
|
|
2508
|
+
return {
|
|
2509
|
+
readFile,
|
|
2510
|
+
writeFile,
|
|
2511
|
+
deleteFile,
|
|
2512
|
+
exists,
|
|
2513
|
+
listDirectory,
|
|
2514
|
+
downloadFile,
|
|
2515
|
+
getDocumentsPath,
|
|
2516
|
+
getCachesPath,
|
|
2517
|
+
stat,
|
|
2518
|
+
mkdir,
|
|
2519
|
+
copyFile,
|
|
2520
|
+
moveFile
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
// src/composables/useSensors.ts
|
|
2525
|
+
var import_runtime_core44 = require("@vue/runtime-core");
|
|
2526
|
+
function useAccelerometer(options = {}) {
|
|
2527
|
+
const x = (0, import_runtime_core44.ref)(0);
|
|
2528
|
+
const y = (0, import_runtime_core44.ref)(0);
|
|
2529
|
+
const z = (0, import_runtime_core44.ref)(0);
|
|
2530
|
+
const isAvailable = (0, import_runtime_core44.ref)(false);
|
|
2531
|
+
let running = false;
|
|
2532
|
+
let unsubscribe = null;
|
|
2533
|
+
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["accelerometer"]).then((result) => {
|
|
2534
|
+
isAvailable.value = result.available;
|
|
2535
|
+
}).catch(() => {
|
|
2536
|
+
});
|
|
2537
|
+
function start() {
|
|
2538
|
+
if (running) return;
|
|
2539
|
+
running = true;
|
|
2540
|
+
unsubscribe = NativeBridge.onGlobalEvent("sensor:accelerometer", (payload) => {
|
|
2541
|
+
x.value = payload.x;
|
|
2542
|
+
y.value = payload.y;
|
|
2543
|
+
z.value = payload.z;
|
|
2544
|
+
});
|
|
2545
|
+
NativeBridge.invokeNativeModule("Sensors", "startAccelerometer", [
|
|
2546
|
+
options.interval ?? 100
|
|
2547
|
+
]).catch(() => {
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
function stop() {
|
|
2551
|
+
if (!running) return;
|
|
2552
|
+
running = false;
|
|
1735
2553
|
unsubscribe?.();
|
|
1736
2554
|
unsubscribe = null;
|
|
2555
|
+
NativeBridge.invokeNativeModule("Sensors", "stopAccelerometer").catch(() => {
|
|
2556
|
+
});
|
|
2557
|
+
}
|
|
2558
|
+
(0, import_runtime_core44.onUnmounted)(() => {
|
|
2559
|
+
stop();
|
|
1737
2560
|
});
|
|
2561
|
+
return { x, y, z, isAvailable, start, stop };
|
|
2562
|
+
}
|
|
2563
|
+
function useGyroscope(options = {}) {
|
|
2564
|
+
const x = (0, import_runtime_core44.ref)(0);
|
|
2565
|
+
const y = (0, import_runtime_core44.ref)(0);
|
|
2566
|
+
const z = (0, import_runtime_core44.ref)(0);
|
|
2567
|
+
const isAvailable = (0, import_runtime_core44.ref)(false);
|
|
2568
|
+
let running = false;
|
|
2569
|
+
let unsubscribe = null;
|
|
2570
|
+
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["gyroscope"]).then((result) => {
|
|
2571
|
+
isAvailable.value = result.available;
|
|
2572
|
+
}).catch(() => {
|
|
2573
|
+
});
|
|
2574
|
+
function start() {
|
|
2575
|
+
if (running) return;
|
|
2576
|
+
running = true;
|
|
2577
|
+
unsubscribe = NativeBridge.onGlobalEvent("sensor:gyroscope", (payload) => {
|
|
2578
|
+
x.value = payload.x;
|
|
2579
|
+
y.value = payload.y;
|
|
2580
|
+
z.value = payload.z;
|
|
2581
|
+
});
|
|
2582
|
+
NativeBridge.invokeNativeModule("Sensors", "startGyroscope", [
|
|
2583
|
+
options.interval ?? 100
|
|
2584
|
+
]).catch(() => {
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2587
|
+
function stop() {
|
|
2588
|
+
if (!running) return;
|
|
2589
|
+
running = false;
|
|
2590
|
+
unsubscribe?.();
|
|
2591
|
+
unsubscribe = null;
|
|
2592
|
+
NativeBridge.invokeNativeModule("Sensors", "stopGyroscope").catch(() => {
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
(0, import_runtime_core44.onUnmounted)(() => {
|
|
2596
|
+
stop();
|
|
2597
|
+
});
|
|
2598
|
+
return { x, y, z, isAvailable, start, stop };
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
// src/composables/useAudio.ts
|
|
2602
|
+
var import_runtime_core45 = require("@vue/runtime-core");
|
|
2603
|
+
function useAudio() {
|
|
2604
|
+
const duration = (0, import_runtime_core45.ref)(0);
|
|
2605
|
+
const position = (0, import_runtime_core45.ref)(0);
|
|
2606
|
+
const isPlaying = (0, import_runtime_core45.ref)(false);
|
|
2607
|
+
const isRecording = (0, import_runtime_core45.ref)(false);
|
|
2608
|
+
const error = (0, import_runtime_core45.ref)(null);
|
|
2609
|
+
const unsubProgress = NativeBridge.onGlobalEvent("audio:progress", (payload) => {
|
|
2610
|
+
position.value = payload.currentTime ?? 0;
|
|
2611
|
+
duration.value = payload.duration ?? 0;
|
|
2612
|
+
});
|
|
2613
|
+
const unsubComplete = NativeBridge.onGlobalEvent("audio:complete", () => {
|
|
2614
|
+
isPlaying.value = false;
|
|
2615
|
+
position.value = 0;
|
|
2616
|
+
});
|
|
2617
|
+
const unsubError = NativeBridge.onGlobalEvent("audio:error", (payload) => {
|
|
2618
|
+
error.value = payload.message ?? "Unknown audio error";
|
|
2619
|
+
isPlaying.value = false;
|
|
2620
|
+
});
|
|
2621
|
+
(0, import_runtime_core45.onUnmounted)(() => {
|
|
2622
|
+
unsubProgress();
|
|
2623
|
+
unsubComplete();
|
|
2624
|
+
unsubError();
|
|
2625
|
+
NativeBridge.invokeNativeModule("Audio", "stop", []).catch(() => {
|
|
2626
|
+
});
|
|
2627
|
+
if (isRecording.value) {
|
|
2628
|
+
NativeBridge.invokeNativeModule("Audio", "stopRecording", []).catch(() => {
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
});
|
|
2632
|
+
async function play(uri, options = {}) {
|
|
2633
|
+
error.value = null;
|
|
2634
|
+
const result = await NativeBridge.invokeNativeModule("Audio", "play", [uri, options]);
|
|
2635
|
+
if (result?.duration != null) {
|
|
2636
|
+
duration.value = result.duration;
|
|
2637
|
+
}
|
|
2638
|
+
isPlaying.value = true;
|
|
2639
|
+
}
|
|
2640
|
+
async function pause() {
|
|
2641
|
+
await NativeBridge.invokeNativeModule("Audio", "pause", []);
|
|
2642
|
+
isPlaying.value = false;
|
|
2643
|
+
}
|
|
2644
|
+
async function resume() {
|
|
2645
|
+
await NativeBridge.invokeNativeModule("Audio", "resume", []);
|
|
2646
|
+
isPlaying.value = true;
|
|
2647
|
+
}
|
|
2648
|
+
async function stop() {
|
|
2649
|
+
await NativeBridge.invokeNativeModule("Audio", "stop", []);
|
|
2650
|
+
isPlaying.value = false;
|
|
2651
|
+
position.value = 0;
|
|
2652
|
+
duration.value = 0;
|
|
2653
|
+
}
|
|
2654
|
+
async function seek(positionSec) {
|
|
2655
|
+
await NativeBridge.invokeNativeModule("Audio", "seek", [positionSec]);
|
|
2656
|
+
}
|
|
2657
|
+
async function setVolume(volume) {
|
|
2658
|
+
await NativeBridge.invokeNativeModule("Audio", "setVolume", [volume]);
|
|
2659
|
+
}
|
|
2660
|
+
async function startRecording(options = {}) {
|
|
2661
|
+
error.value = null;
|
|
2662
|
+
const result = await NativeBridge.invokeNativeModule("Audio", "startRecording", [options]);
|
|
2663
|
+
isRecording.value = true;
|
|
2664
|
+
return result?.uri ?? "";
|
|
2665
|
+
}
|
|
2666
|
+
async function stopRecording() {
|
|
2667
|
+
const result = await NativeBridge.invokeNativeModule("Audio", "stopRecording", []);
|
|
2668
|
+
isRecording.value = false;
|
|
2669
|
+
return { uri: result?.uri ?? "", duration: result?.duration ?? 0 };
|
|
2670
|
+
}
|
|
2671
|
+
async function pauseRecording() {
|
|
2672
|
+
await NativeBridge.invokeNativeModule("Audio", "pauseRecording", []);
|
|
2673
|
+
}
|
|
2674
|
+
async function resumeRecording() {
|
|
2675
|
+
await NativeBridge.invokeNativeModule("Audio", "resumeRecording", []);
|
|
2676
|
+
}
|
|
2677
|
+
return {
|
|
2678
|
+
// Playback
|
|
2679
|
+
play,
|
|
2680
|
+
pause,
|
|
2681
|
+
resume,
|
|
2682
|
+
stop,
|
|
2683
|
+
seek,
|
|
2684
|
+
setVolume,
|
|
2685
|
+
// Recording
|
|
2686
|
+
startRecording,
|
|
2687
|
+
stopRecording,
|
|
2688
|
+
pauseRecording,
|
|
2689
|
+
resumeRecording,
|
|
2690
|
+
// Reactive state
|
|
2691
|
+
duration,
|
|
2692
|
+
position,
|
|
2693
|
+
isPlaying,
|
|
2694
|
+
isRecording,
|
|
2695
|
+
error
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
// src/composables/useDatabase.ts
|
|
2700
|
+
var import_runtime_core46 = require("@vue/runtime-core");
|
|
2701
|
+
function useDatabase(name = "default") {
|
|
2702
|
+
const isOpen = (0, import_runtime_core46.ref)(false);
|
|
2703
|
+
let opened = false;
|
|
2704
|
+
async function ensureOpen() {
|
|
2705
|
+
if (opened) return;
|
|
2706
|
+
await NativeBridge.invokeNativeModule("Database", "open", [name]);
|
|
2707
|
+
opened = true;
|
|
2708
|
+
isOpen.value = true;
|
|
2709
|
+
}
|
|
2710
|
+
async function execute(sql, params) {
|
|
2711
|
+
await ensureOpen();
|
|
2712
|
+
return NativeBridge.invokeNativeModule("Database", "execute", [name, sql, params ?? []]);
|
|
2713
|
+
}
|
|
2714
|
+
async function query(sql, params) {
|
|
2715
|
+
await ensureOpen();
|
|
2716
|
+
return NativeBridge.invokeNativeModule("Database", "query", [name, sql, params ?? []]);
|
|
2717
|
+
}
|
|
2718
|
+
async function transaction(callback) {
|
|
2719
|
+
await ensureOpen();
|
|
2720
|
+
const statements = [];
|
|
2721
|
+
const ctx = {
|
|
2722
|
+
execute: async (sql, params) => {
|
|
2723
|
+
statements.push({ sql, params: params ?? [] });
|
|
2724
|
+
return { rowsAffected: 0 };
|
|
2725
|
+
},
|
|
2726
|
+
query: async (sql, params) => {
|
|
2727
|
+
if (statements.length > 0) {
|
|
2728
|
+
await NativeBridge.invokeNativeModule("Database", "executeTransaction", [name, statements.splice(0)]);
|
|
2729
|
+
}
|
|
2730
|
+
return NativeBridge.invokeNativeModule("Database", "query", [name, sql, params ?? []]);
|
|
2731
|
+
}
|
|
2732
|
+
};
|
|
2733
|
+
await callback(ctx);
|
|
2734
|
+
if (statements.length > 0) {
|
|
2735
|
+
await NativeBridge.invokeNativeModule("Database", "executeTransaction", [name, statements]);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
async function close() {
|
|
2739
|
+
if (!opened) return;
|
|
2740
|
+
await NativeBridge.invokeNativeModule("Database", "close", [name]);
|
|
2741
|
+
opened = false;
|
|
2742
|
+
isOpen.value = false;
|
|
2743
|
+
}
|
|
2744
|
+
(0, import_runtime_core46.onUnmounted)(() => {
|
|
2745
|
+
if (opened) {
|
|
2746
|
+
NativeBridge.invokeNativeModule("Database", "close", [name]).catch(() => {
|
|
2747
|
+
});
|
|
2748
|
+
opened = false;
|
|
2749
|
+
isOpen.value = false;
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
return { execute, query, transaction, close, isOpen };
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
// src/composables/usePerformance.ts
|
|
2756
|
+
var import_runtime_core47 = require("@vue/runtime-core");
|
|
2757
|
+
function usePerformance() {
|
|
2758
|
+
const isProfiling = (0, import_runtime_core47.ref)(false);
|
|
2759
|
+
const fps = (0, import_runtime_core47.ref)(0);
|
|
2760
|
+
const memoryMB = (0, import_runtime_core47.ref)(0);
|
|
2761
|
+
const bridgeOps = (0, import_runtime_core47.ref)(0);
|
|
2762
|
+
let unsubscribe = null;
|
|
2763
|
+
function handleMetrics(payload) {
|
|
2764
|
+
fps.value = payload.fps ?? 0;
|
|
2765
|
+
memoryMB.value = payload.memoryMB ?? 0;
|
|
2766
|
+
bridgeOps.value = payload.bridgeOps ?? 0;
|
|
2767
|
+
}
|
|
2768
|
+
async function startProfiling() {
|
|
2769
|
+
if (isProfiling.value) return;
|
|
2770
|
+
unsubscribe = NativeBridge.onGlobalEvent("perf:metrics", handleMetrics);
|
|
2771
|
+
await NativeBridge.invokeNativeModule("Performance", "startProfiling", []);
|
|
2772
|
+
isProfiling.value = true;
|
|
2773
|
+
}
|
|
2774
|
+
async function stopProfiling() {
|
|
2775
|
+
if (!isProfiling.value) return;
|
|
2776
|
+
await NativeBridge.invokeNativeModule("Performance", "stopProfiling", []);
|
|
2777
|
+
isProfiling.value = false;
|
|
2778
|
+
if (unsubscribe) {
|
|
2779
|
+
unsubscribe();
|
|
2780
|
+
unsubscribe = null;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
async function getMetrics() {
|
|
2784
|
+
return NativeBridge.invokeNativeModule("Performance", "getMetrics", []);
|
|
2785
|
+
}
|
|
2786
|
+
(0, import_runtime_core47.onUnmounted)(() => {
|
|
2787
|
+
if (isProfiling.value) {
|
|
2788
|
+
NativeBridge.invokeNativeModule("Performance", "stopProfiling", []).catch(() => {
|
|
2789
|
+
});
|
|
2790
|
+
isProfiling.value = false;
|
|
2791
|
+
}
|
|
2792
|
+
if (unsubscribe) {
|
|
2793
|
+
unsubscribe();
|
|
2794
|
+
unsubscribe = null;
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
return {
|
|
2798
|
+
startProfiling,
|
|
2799
|
+
stopProfiling,
|
|
2800
|
+
getMetrics,
|
|
2801
|
+
isProfiling,
|
|
2802
|
+
fps,
|
|
2803
|
+
memoryMB,
|
|
2804
|
+
bridgeOps
|
|
2805
|
+
};
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
// src/composables/useSharedElementTransition.ts
|
|
2809
|
+
var import_runtime_core48 = require("@vue/runtime-core");
|
|
2810
|
+
var sharedElementRegistry = /* @__PURE__ */ new Map();
|
|
2811
|
+
function useSharedElementTransition(elementId) {
|
|
2812
|
+
const viewId = (0, import_runtime_core48.ref)(null);
|
|
2813
|
+
function register(nativeViewId) {
|
|
2814
|
+
viewId.value = nativeViewId;
|
|
2815
|
+
sharedElementRegistry.set(elementId, nativeViewId);
|
|
2816
|
+
}
|
|
2817
|
+
function unregister() {
|
|
2818
|
+
viewId.value = null;
|
|
2819
|
+
sharedElementRegistry.delete(elementId);
|
|
2820
|
+
}
|
|
2821
|
+
(0, import_runtime_core48.onUnmounted)(() => {
|
|
2822
|
+
unregister();
|
|
2823
|
+
});
|
|
2824
|
+
return {
|
|
2825
|
+
id: elementId,
|
|
2826
|
+
viewId,
|
|
2827
|
+
register,
|
|
2828
|
+
unregister
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
async function measureViewFrame(nativeViewId) {
|
|
2832
|
+
return NativeBridge.invokeNativeModule("Animation", "measureView", [nativeViewId]);
|
|
2833
|
+
}
|
|
2834
|
+
function getSharedElementViewId(elementId) {
|
|
2835
|
+
return sharedElementRegistry.get(elementId);
|
|
2836
|
+
}
|
|
2837
|
+
function getRegisteredSharedElements() {
|
|
2838
|
+
return Array.from(sharedElementRegistry.keys());
|
|
2839
|
+
}
|
|
2840
|
+
function clearSharedElementRegistry() {
|
|
2841
|
+
sharedElementRegistry.clear();
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
// src/composables/useIAP.ts
|
|
2845
|
+
var import_runtime_core49 = require("@vue/runtime-core");
|
|
2846
|
+
function useIAP() {
|
|
2847
|
+
const products = (0, import_runtime_core49.ref)([]);
|
|
2848
|
+
const isReady = (0, import_runtime_core49.ref)(false);
|
|
2849
|
+
const error = (0, import_runtime_core49.ref)(null);
|
|
2850
|
+
const cleanups = [];
|
|
2851
|
+
const unsubscribe = NativeBridge.onGlobalEvent("iap:transactionUpdate", (payload) => {
|
|
2852
|
+
if (payload.state === "failed" && payload.error) {
|
|
2853
|
+
error.value = payload.error;
|
|
2854
|
+
}
|
|
2855
|
+
});
|
|
2856
|
+
cleanups.push(unsubscribe);
|
|
2857
|
+
NativeBridge.invokeNativeModule("IAP", "initialize").then(() => {
|
|
2858
|
+
isReady.value = true;
|
|
2859
|
+
}).catch((err) => {
|
|
2860
|
+
error.value = String(err);
|
|
2861
|
+
});
|
|
2862
|
+
async function getProducts(skus) {
|
|
2863
|
+
error.value = null;
|
|
2864
|
+
try {
|
|
2865
|
+
const result = await NativeBridge.invokeNativeModule("IAP", "getProducts", [skus]);
|
|
2866
|
+
const productList = result;
|
|
2867
|
+
products.value = productList;
|
|
2868
|
+
return productList;
|
|
2869
|
+
} catch (err) {
|
|
2870
|
+
error.value = String(err);
|
|
2871
|
+
return [];
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
async function purchase(sku) {
|
|
2875
|
+
error.value = null;
|
|
2876
|
+
try {
|
|
2877
|
+
return await NativeBridge.invokeNativeModule("IAP", "purchase", [sku]);
|
|
2878
|
+
} catch (err) {
|
|
2879
|
+
error.value = String(err);
|
|
2880
|
+
return null;
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2883
|
+
async function restorePurchases() {
|
|
2884
|
+
error.value = null;
|
|
2885
|
+
try {
|
|
2886
|
+
return await NativeBridge.invokeNativeModule("IAP", "restorePurchases");
|
|
2887
|
+
} catch (err) {
|
|
2888
|
+
error.value = String(err);
|
|
2889
|
+
return [];
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
async function getActiveSubscriptions() {
|
|
2893
|
+
error.value = null;
|
|
2894
|
+
try {
|
|
2895
|
+
return await NativeBridge.invokeNativeModule("IAP", "getActiveSubscriptions");
|
|
2896
|
+
} catch (err) {
|
|
2897
|
+
error.value = String(err);
|
|
2898
|
+
return [];
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
function onTransactionUpdate(callback) {
|
|
2902
|
+
const unsub = NativeBridge.onGlobalEvent("iap:transactionUpdate", callback);
|
|
2903
|
+
cleanups.push(unsub);
|
|
2904
|
+
return unsub;
|
|
2905
|
+
}
|
|
2906
|
+
(0, import_runtime_core49.onUnmounted)(() => {
|
|
2907
|
+
cleanups.forEach((fn) => fn());
|
|
2908
|
+
cleanups.length = 0;
|
|
2909
|
+
});
|
|
2910
|
+
return {
|
|
2911
|
+
products,
|
|
2912
|
+
isReady,
|
|
2913
|
+
error,
|
|
2914
|
+
getProducts,
|
|
2915
|
+
purchase,
|
|
2916
|
+
restorePurchases,
|
|
2917
|
+
getActiveSubscriptions,
|
|
2918
|
+
onTransactionUpdate
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
// src/composables/useAppleSignIn.ts
|
|
2923
|
+
var import_runtime_core50 = require("@vue/runtime-core");
|
|
2924
|
+
function useAppleSignIn() {
|
|
2925
|
+
const user = (0, import_runtime_core50.ref)(null);
|
|
2926
|
+
const isAuthenticated = (0, import_runtime_core50.ref)(false);
|
|
2927
|
+
const error = (0, import_runtime_core50.ref)(null);
|
|
2928
|
+
const cleanups = [];
|
|
2929
|
+
const unsubscribe = NativeBridge.onGlobalEvent("auth:appleCredentialRevoked", () => {
|
|
2930
|
+
user.value = null;
|
|
2931
|
+
isAuthenticated.value = false;
|
|
2932
|
+
});
|
|
2933
|
+
cleanups.push(unsubscribe);
|
|
2934
|
+
NativeBridge.invokeNativeModule("SocialAuth", "getCurrentUser", ["apple"]).then((result) => {
|
|
2935
|
+
if (result && result.userId) {
|
|
2936
|
+
user.value = { ...result, provider: "apple" };
|
|
2937
|
+
isAuthenticated.value = true;
|
|
2938
|
+
}
|
|
2939
|
+
}).catch(() => {
|
|
2940
|
+
});
|
|
2941
|
+
async function signIn() {
|
|
2942
|
+
error.value = null;
|
|
2943
|
+
try {
|
|
2944
|
+
const result = await NativeBridge.invokeNativeModule("SocialAuth", "signInWithApple");
|
|
2945
|
+
const socialUser = { ...result, provider: "apple" };
|
|
2946
|
+
user.value = socialUser;
|
|
2947
|
+
isAuthenticated.value = true;
|
|
2948
|
+
return { success: true, user: socialUser };
|
|
2949
|
+
} catch (err) {
|
|
2950
|
+
const message = String(err);
|
|
2951
|
+
error.value = message;
|
|
2952
|
+
return { success: false, error: message };
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
async function signOut() {
|
|
2956
|
+
error.value = null;
|
|
2957
|
+
try {
|
|
2958
|
+
await NativeBridge.invokeNativeModule("SocialAuth", "signOut", ["apple"]);
|
|
2959
|
+
user.value = null;
|
|
2960
|
+
isAuthenticated.value = false;
|
|
2961
|
+
} catch (err) {
|
|
2962
|
+
error.value = String(err);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
(0, import_runtime_core50.onUnmounted)(() => {
|
|
2966
|
+
cleanups.forEach((fn) => fn());
|
|
2967
|
+
cleanups.length = 0;
|
|
2968
|
+
});
|
|
2969
|
+
return { signIn, signOut, user, isAuthenticated, error };
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
// src/composables/useGoogleSignIn.ts
|
|
2973
|
+
var import_runtime_core51 = require("@vue/runtime-core");
|
|
2974
|
+
function useGoogleSignIn(clientId) {
|
|
2975
|
+
const user = (0, import_runtime_core51.ref)(null);
|
|
2976
|
+
const isAuthenticated = (0, import_runtime_core51.ref)(false);
|
|
2977
|
+
const error = (0, import_runtime_core51.ref)(null);
|
|
2978
|
+
const cleanups = [];
|
|
2979
|
+
NativeBridge.invokeNativeModule("SocialAuth", "getCurrentUser", ["google"]).then((result) => {
|
|
2980
|
+
if (result && result.userId) {
|
|
2981
|
+
user.value = { ...result, provider: "google" };
|
|
2982
|
+
isAuthenticated.value = true;
|
|
2983
|
+
}
|
|
2984
|
+
}).catch(() => {
|
|
2985
|
+
});
|
|
2986
|
+
async function signIn() {
|
|
2987
|
+
error.value = null;
|
|
2988
|
+
try {
|
|
2989
|
+
const result = await NativeBridge.invokeNativeModule("SocialAuth", "signInWithGoogle", [clientId]);
|
|
2990
|
+
const socialUser = { ...result, provider: "google" };
|
|
2991
|
+
user.value = socialUser;
|
|
2992
|
+
isAuthenticated.value = true;
|
|
2993
|
+
return { success: true, user: socialUser };
|
|
2994
|
+
} catch (err) {
|
|
2995
|
+
const message = String(err);
|
|
2996
|
+
error.value = message;
|
|
2997
|
+
return { success: false, error: message };
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
async function signOut() {
|
|
3001
|
+
error.value = null;
|
|
3002
|
+
try {
|
|
3003
|
+
await NativeBridge.invokeNativeModule("SocialAuth", "signOut", ["google"]);
|
|
3004
|
+
user.value = null;
|
|
3005
|
+
isAuthenticated.value = false;
|
|
3006
|
+
} catch (err) {
|
|
3007
|
+
error.value = String(err);
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
(0, import_runtime_core51.onUnmounted)(() => {
|
|
3011
|
+
cleanups.forEach((fn) => fn());
|
|
3012
|
+
cleanups.length = 0;
|
|
3013
|
+
});
|
|
3014
|
+
return { signIn, signOut, user, isAuthenticated, error };
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
// src/composables/useBackgroundTask.ts
|
|
3018
|
+
var import_runtime_core52 = require("@vue/runtime-core");
|
|
3019
|
+
function useBackgroundTask() {
|
|
3020
|
+
const taskHandlers = /* @__PURE__ */ new Map();
|
|
3021
|
+
const defaultHandler = (0, import_runtime_core52.ref)(null);
|
|
3022
|
+
const unsubscribe = NativeBridge.onGlobalEvent("background:taskExecute", (payload) => {
|
|
3023
|
+
const handler = taskHandlers.get(payload.taskId) || defaultHandler.value;
|
|
3024
|
+
if (handler) {
|
|
3025
|
+
handler(payload.taskId);
|
|
3026
|
+
}
|
|
3027
|
+
});
|
|
3028
|
+
(0, import_runtime_core52.onUnmounted)(unsubscribe);
|
|
3029
|
+
function registerTask(taskId) {
|
|
3030
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "registerTask", [taskId]).then(() => void 0);
|
|
3031
|
+
}
|
|
3032
|
+
function scheduleTask(taskId, options = {}) {
|
|
3033
|
+
const type = options.type ?? "refresh";
|
|
3034
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "scheduleTask", [taskId, type, {
|
|
3035
|
+
earliestBeginDate: options.earliestBeginDate,
|
|
3036
|
+
requiresNetworkConnectivity: options.requiresNetworkConnectivity,
|
|
3037
|
+
requiresExternalPower: options.requiresExternalPower,
|
|
3038
|
+
interval: options.interval
|
|
3039
|
+
}]).then(() => void 0);
|
|
3040
|
+
}
|
|
3041
|
+
function cancelTask(taskId) {
|
|
3042
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "cancelTask", [taskId]).then(() => void 0);
|
|
3043
|
+
}
|
|
3044
|
+
function cancelAllTasks() {
|
|
3045
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "cancelAllTasks", []).then(() => void 0);
|
|
3046
|
+
}
|
|
3047
|
+
function completeTask(taskId, success = true) {
|
|
3048
|
+
return NativeBridge.invokeNativeModule("BackgroundTask", "completeTask", [taskId, success]).then(() => void 0);
|
|
3049
|
+
}
|
|
3050
|
+
function onTaskExecute(handler, taskId) {
|
|
3051
|
+
if (taskId) {
|
|
3052
|
+
taskHandlers.set(taskId, handler);
|
|
3053
|
+
return () => {
|
|
3054
|
+
taskHandlers.delete(taskId);
|
|
3055
|
+
};
|
|
3056
|
+
} else {
|
|
3057
|
+
defaultHandler.value = handler;
|
|
3058
|
+
return () => {
|
|
3059
|
+
defaultHandler.value = null;
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
return { registerTask, scheduleTask, cancelTask, cancelAllTasks, completeTask, onTaskExecute };
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
// src/composables/useOTAUpdate.ts
|
|
3067
|
+
var import_runtime_core53 = require("@vue/runtime-core");
|
|
3068
|
+
function useOTAUpdate(serverUrl) {
|
|
3069
|
+
const currentVersion = (0, import_runtime_core53.ref)("embedded");
|
|
3070
|
+
const availableVersion = (0, import_runtime_core53.ref)(null);
|
|
3071
|
+
const downloadProgress = (0, import_runtime_core53.ref)(0);
|
|
3072
|
+
const isChecking = (0, import_runtime_core53.ref)(false);
|
|
3073
|
+
const isDownloading = (0, import_runtime_core53.ref)(false);
|
|
3074
|
+
const status = (0, import_runtime_core53.ref)("idle");
|
|
3075
|
+
const error = (0, import_runtime_core53.ref)(null);
|
|
3076
|
+
let lastUpdateInfo = null;
|
|
3077
|
+
const unsubscribe = NativeBridge.onGlobalEvent("ota:downloadProgress", (payload) => {
|
|
3078
|
+
downloadProgress.value = payload.progress;
|
|
3079
|
+
});
|
|
3080
|
+
(0, import_runtime_core53.onUnmounted)(unsubscribe);
|
|
3081
|
+
NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []).then((info) => {
|
|
3082
|
+
currentVersion.value = info.version;
|
|
3083
|
+
}).catch(() => {
|
|
3084
|
+
});
|
|
3085
|
+
async function checkForUpdate() {
|
|
3086
|
+
isChecking.value = true;
|
|
3087
|
+
status.value = "checking";
|
|
3088
|
+
error.value = null;
|
|
3089
|
+
try {
|
|
3090
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "checkForUpdate", [serverUrl]);
|
|
3091
|
+
lastUpdateInfo = info;
|
|
3092
|
+
if (info.updateAvailable) {
|
|
3093
|
+
availableVersion.value = info.version;
|
|
3094
|
+
} else {
|
|
3095
|
+
availableVersion.value = null;
|
|
3096
|
+
}
|
|
3097
|
+
status.value = info.updateAvailable ? "idle" : "idle";
|
|
3098
|
+
return info;
|
|
3099
|
+
} catch (err) {
|
|
3100
|
+
error.value = err?.message || String(err);
|
|
3101
|
+
status.value = "error";
|
|
3102
|
+
throw err;
|
|
3103
|
+
} finally {
|
|
3104
|
+
isChecking.value = false;
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
async function downloadUpdate(url, hash) {
|
|
3108
|
+
const downloadUrl = url || lastUpdateInfo?.downloadUrl;
|
|
3109
|
+
const expectedHash = hash || lastUpdateInfo?.hash;
|
|
3110
|
+
if (!downloadUrl) {
|
|
3111
|
+
const msg = "No download URL. Call checkForUpdate() first or provide a URL.";
|
|
3112
|
+
error.value = msg;
|
|
3113
|
+
status.value = "error";
|
|
3114
|
+
throw new Error(msg);
|
|
3115
|
+
}
|
|
3116
|
+
isDownloading.value = true;
|
|
3117
|
+
downloadProgress.value = 0;
|
|
3118
|
+
status.value = "downloading";
|
|
3119
|
+
error.value = null;
|
|
3120
|
+
try {
|
|
3121
|
+
await NativeBridge.invokeNativeModule("OTA", "downloadUpdate", [downloadUrl, expectedHash || ""]);
|
|
3122
|
+
status.value = "ready";
|
|
3123
|
+
} catch (err) {
|
|
3124
|
+
error.value = err?.message || String(err);
|
|
3125
|
+
status.value = "error";
|
|
3126
|
+
throw err;
|
|
3127
|
+
} finally {
|
|
3128
|
+
isDownloading.value = false;
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
async function applyUpdate() {
|
|
3132
|
+
error.value = null;
|
|
3133
|
+
try {
|
|
3134
|
+
await NativeBridge.invokeNativeModule("OTA", "applyUpdate", []);
|
|
3135
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []);
|
|
3136
|
+
currentVersion.value = info.version;
|
|
3137
|
+
availableVersion.value = null;
|
|
3138
|
+
status.value = "idle";
|
|
3139
|
+
} catch (err) {
|
|
3140
|
+
error.value = err?.message || String(err);
|
|
3141
|
+
status.value = "error";
|
|
3142
|
+
throw err;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
async function rollback() {
|
|
3146
|
+
error.value = null;
|
|
3147
|
+
try {
|
|
3148
|
+
await NativeBridge.invokeNativeModule("OTA", "rollback", []);
|
|
3149
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []);
|
|
3150
|
+
currentVersion.value = info.version;
|
|
3151
|
+
status.value = "idle";
|
|
3152
|
+
} catch (err) {
|
|
3153
|
+
error.value = err?.message || String(err);
|
|
3154
|
+
status.value = "error";
|
|
3155
|
+
throw err;
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
async function getCurrentVersion() {
|
|
3159
|
+
const info = await NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []);
|
|
3160
|
+
currentVersion.value = info.version;
|
|
3161
|
+
return info;
|
|
3162
|
+
}
|
|
3163
|
+
return {
|
|
3164
|
+
checkForUpdate,
|
|
3165
|
+
downloadUpdate,
|
|
3166
|
+
applyUpdate,
|
|
3167
|
+
rollback,
|
|
3168
|
+
getCurrentVersion,
|
|
3169
|
+
currentVersion,
|
|
3170
|
+
availableVersion,
|
|
3171
|
+
downloadProgress,
|
|
3172
|
+
isChecking,
|
|
3173
|
+
isDownloading,
|
|
3174
|
+
status,
|
|
3175
|
+
error
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
// src/composables/useBluetooth.ts
|
|
3180
|
+
var import_runtime_core54 = require("@vue/runtime-core");
|
|
3181
|
+
function useBluetooth() {
|
|
3182
|
+
const devices = (0, import_runtime_core54.ref)([]);
|
|
3183
|
+
const connectedDevice = (0, import_runtime_core54.ref)(null);
|
|
3184
|
+
const isScanning = (0, import_runtime_core54.ref)(false);
|
|
3185
|
+
const isAvailable = (0, import_runtime_core54.ref)(false);
|
|
3186
|
+
const error = (0, import_runtime_core54.ref)(null);
|
|
3187
|
+
const cleanups = [];
|
|
3188
|
+
NativeBridge.invokeNativeModule("Bluetooth", "getState").then((state) => {
|
|
3189
|
+
isAvailable.value = state === "poweredOn";
|
|
3190
|
+
}).catch(() => {
|
|
3191
|
+
isAvailable.value = false;
|
|
3192
|
+
});
|
|
3193
|
+
const unsubState = NativeBridge.onGlobalEvent("ble:stateChanged", (payload) => {
|
|
3194
|
+
isAvailable.value = payload.state === "poweredOn";
|
|
3195
|
+
});
|
|
3196
|
+
cleanups.push(unsubState);
|
|
3197
|
+
const unsubFound = NativeBridge.onGlobalEvent("ble:deviceFound", (payload) => {
|
|
3198
|
+
const existing = devices.value.findIndex((d) => d.id === payload.id);
|
|
3199
|
+
if (existing >= 0) {
|
|
3200
|
+
devices.value[existing] = payload;
|
|
3201
|
+
} else {
|
|
3202
|
+
devices.value = [...devices.value, payload];
|
|
3203
|
+
}
|
|
3204
|
+
});
|
|
3205
|
+
cleanups.push(unsubFound);
|
|
3206
|
+
const unsubConnected = NativeBridge.onGlobalEvent("ble:connected", (payload) => {
|
|
3207
|
+
connectedDevice.value = payload;
|
|
3208
|
+
});
|
|
3209
|
+
cleanups.push(unsubConnected);
|
|
3210
|
+
const unsubDisconnected = NativeBridge.onGlobalEvent("ble:disconnected", () => {
|
|
3211
|
+
connectedDevice.value = null;
|
|
3212
|
+
});
|
|
3213
|
+
cleanups.push(unsubDisconnected);
|
|
3214
|
+
const unsubError = NativeBridge.onGlobalEvent("ble:error", (payload) => {
|
|
3215
|
+
error.value = payload.message;
|
|
3216
|
+
});
|
|
3217
|
+
cleanups.push(unsubError);
|
|
3218
|
+
async function scan(serviceUUIDs) {
|
|
3219
|
+
devices.value = [];
|
|
3220
|
+
isScanning.value = true;
|
|
3221
|
+
error.value = null;
|
|
3222
|
+
try {
|
|
3223
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "startScan", [serviceUUIDs]);
|
|
3224
|
+
} catch (e) {
|
|
3225
|
+
error.value = e?.message || String(e);
|
|
3226
|
+
isScanning.value = false;
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
async function stopScan() {
|
|
3230
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "stopScan");
|
|
3231
|
+
isScanning.value = false;
|
|
3232
|
+
}
|
|
3233
|
+
async function connect(deviceId) {
|
|
3234
|
+
error.value = null;
|
|
3235
|
+
const result = await NativeBridge.invokeNativeModule("Bluetooth", "connect", [deviceId]);
|
|
3236
|
+
return result;
|
|
3237
|
+
}
|
|
3238
|
+
async function disconnect(deviceId) {
|
|
3239
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "disconnect", [deviceId]);
|
|
3240
|
+
connectedDevice.value = null;
|
|
3241
|
+
}
|
|
3242
|
+
async function read(deviceId, serviceUUID, charUUID) {
|
|
3243
|
+
return NativeBridge.invokeNativeModule("Bluetooth", "readCharacteristic", [deviceId, serviceUUID, charUUID]);
|
|
3244
|
+
}
|
|
3245
|
+
async function write(deviceId, serviceUUID, charUUID, data) {
|
|
3246
|
+
return NativeBridge.invokeNativeModule("Bluetooth", "writeCharacteristic", [deviceId, serviceUUID, charUUID, data]);
|
|
3247
|
+
}
|
|
3248
|
+
async function subscribe(deviceId, serviceUUID, charUUID, callback) {
|
|
3249
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "subscribeToCharacteristic", [deviceId, serviceUUID, charUUID]);
|
|
3250
|
+
const unsubscribe = NativeBridge.onGlobalEvent("ble:characteristicChanged", (payload) => {
|
|
3251
|
+
if (payload.deviceId === deviceId && payload.serviceUUID === serviceUUID && payload.characteristicUUID === charUUID) {
|
|
3252
|
+
callback(payload);
|
|
3253
|
+
}
|
|
3254
|
+
});
|
|
3255
|
+
cleanups.push(unsubscribe);
|
|
3256
|
+
return async () => {
|
|
3257
|
+
unsubscribe();
|
|
3258
|
+
await NativeBridge.invokeNativeModule("Bluetooth", "unsubscribeFromCharacteristic", [
|
|
3259
|
+
deviceId,
|
|
3260
|
+
serviceUUID,
|
|
3261
|
+
charUUID
|
|
3262
|
+
]);
|
|
3263
|
+
};
|
|
3264
|
+
}
|
|
3265
|
+
(0, import_runtime_core54.onUnmounted)(() => {
|
|
3266
|
+
if (isScanning.value) {
|
|
3267
|
+
NativeBridge.invokeNativeModule("Bluetooth", "stopScan").catch(() => {
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
cleanups.forEach((fn) => fn());
|
|
3271
|
+
cleanups.length = 0;
|
|
3272
|
+
});
|
|
3273
|
+
return {
|
|
3274
|
+
scan,
|
|
3275
|
+
stopScan,
|
|
3276
|
+
connect,
|
|
3277
|
+
disconnect,
|
|
3278
|
+
read,
|
|
3279
|
+
write,
|
|
3280
|
+
subscribe,
|
|
3281
|
+
devices,
|
|
3282
|
+
connectedDevice,
|
|
3283
|
+
isScanning,
|
|
3284
|
+
isAvailable,
|
|
3285
|
+
error
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
// src/composables/useCalendar.ts
|
|
3290
|
+
var import_runtime_core55 = require("@vue/runtime-core");
|
|
3291
|
+
function useCalendar() {
|
|
3292
|
+
const hasAccess = (0, import_runtime_core55.ref)(false);
|
|
3293
|
+
const error = (0, import_runtime_core55.ref)(null);
|
|
3294
|
+
async function requestAccess() {
|
|
3295
|
+
try {
|
|
3296
|
+
const result = await NativeBridge.invokeNativeModule("Calendar", "requestAccess");
|
|
3297
|
+
hasAccess.value = result.granted;
|
|
3298
|
+
return result.granted;
|
|
3299
|
+
} catch (e) {
|
|
3300
|
+
error.value = e?.message || String(e);
|
|
3301
|
+
return false;
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
async function getEvents(startDate, endDate) {
|
|
3305
|
+
return NativeBridge.invokeNativeModule("Calendar", "getEvents", [startDate, endDate]);
|
|
3306
|
+
}
|
|
3307
|
+
async function createEvent(options) {
|
|
3308
|
+
return NativeBridge.invokeNativeModule("Calendar", "createEvent", [
|
|
3309
|
+
options.title,
|
|
3310
|
+
options.startDate,
|
|
3311
|
+
options.endDate,
|
|
3312
|
+
options.notes,
|
|
3313
|
+
options.calendarId
|
|
3314
|
+
]);
|
|
3315
|
+
}
|
|
3316
|
+
async function deleteEvent(eventId) {
|
|
3317
|
+
return NativeBridge.invokeNativeModule("Calendar", "deleteEvent", [eventId]);
|
|
3318
|
+
}
|
|
3319
|
+
async function getCalendars() {
|
|
3320
|
+
return NativeBridge.invokeNativeModule("Calendar", "getCalendars");
|
|
3321
|
+
}
|
|
3322
|
+
return { requestAccess, getEvents, createEvent, deleteEvent, getCalendars, hasAccess, error };
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
// src/composables/useContacts.ts
|
|
3326
|
+
var import_runtime_core56 = require("@vue/runtime-core");
|
|
3327
|
+
function useContacts() {
|
|
3328
|
+
const hasAccess = (0, import_runtime_core56.ref)(false);
|
|
3329
|
+
const error = (0, import_runtime_core56.ref)(null);
|
|
3330
|
+
async function requestAccess() {
|
|
3331
|
+
try {
|
|
3332
|
+
const result = await NativeBridge.invokeNativeModule("Contacts", "requestAccess");
|
|
3333
|
+
hasAccess.value = result.granted;
|
|
3334
|
+
return result.granted;
|
|
3335
|
+
} catch (e) {
|
|
3336
|
+
error.value = e?.message || String(e);
|
|
3337
|
+
return false;
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
async function getContacts(query) {
|
|
3341
|
+
return NativeBridge.invokeNativeModule("Contacts", "getContacts", [query]);
|
|
3342
|
+
}
|
|
3343
|
+
async function getContact(id) {
|
|
3344
|
+
return NativeBridge.invokeNativeModule("Contacts", "getContact", [id]);
|
|
3345
|
+
}
|
|
3346
|
+
async function createContact(data) {
|
|
3347
|
+
return NativeBridge.invokeNativeModule("Contacts", "createContact", [data]);
|
|
3348
|
+
}
|
|
3349
|
+
async function deleteContact(id) {
|
|
3350
|
+
return NativeBridge.invokeNativeModule("Contacts", "deleteContact", [id]);
|
|
3351
|
+
}
|
|
3352
|
+
return { requestAccess, getContacts, getContact, createContact, deleteContact, hasAccess, error };
|
|
1738
3353
|
}
|
|
1739
3354
|
|
|
1740
3355
|
// src/index.ts
|
|
@@ -1760,6 +3375,15 @@ function createApp(rootComponent, rootProps) {
|
|
|
1760
3375
|
app.component("VPicker", VPicker);
|
|
1761
3376
|
app.component("VSegmentedControl", VSegmentedControl);
|
|
1762
3377
|
app.component("VActionSheet", VActionSheet);
|
|
3378
|
+
app.component("VRefreshControl", VRefreshControl);
|
|
3379
|
+
app.component("VPressable", VPressable);
|
|
3380
|
+
app.component("VSectionList", VSectionList);
|
|
3381
|
+
app.component("VCheckbox", VCheckbox);
|
|
3382
|
+
app.component("VRadio", VRadio);
|
|
3383
|
+
app.component("VDropdown", VDropdown);
|
|
3384
|
+
app.component("VVideo", VVideo);
|
|
3385
|
+
app.component("ErrorBoundary", ErrorBoundary);
|
|
3386
|
+
app.component("VErrorBoundary", ErrorBoundary);
|
|
1763
3387
|
app.directive("show", vShow);
|
|
1764
3388
|
app.config.errorHandler = (err, instance, info) => {
|
|
1765
3389
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
@@ -1777,7 +3401,7 @@ function createApp(rootComponent, rootProps) {
|
|
|
1777
3401
|
}
|
|
1778
3402
|
};
|
|
1779
3403
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
1780
|
-
app.config.warnHandler = (msg, instance,
|
|
3404
|
+
app.config.warnHandler = (msg, instance, _trace) => {
|
|
1781
3405
|
const componentName = instance?.$options?.name || instance?.$.type?.name || "Anonymous";
|
|
1782
3406
|
console.warn(`[VueNative] Warning in ${componentName}: ${msg}`);
|
|
1783
3407
|
};
|
|
@@ -1786,7 +3410,7 @@ function createApp(rootComponent, rootProps) {
|
|
|
1786
3410
|
const root = createNativeNode("__ROOT__");
|
|
1787
3411
|
NativeBridge.createNode(root.id, "__ROOT__");
|
|
1788
3412
|
NativeBridge.setRootView(root.id);
|
|
1789
|
-
const vnode = (0,
|
|
3413
|
+
const vnode = (0, import_runtime_core57.createVNode)(rootComponent, rootProps);
|
|
1790
3414
|
vnode.appContext = app._context;
|
|
1791
3415
|
render(vnode, root);
|
|
1792
3416
|
return root;
|
|
@@ -1795,52 +3419,84 @@ function createApp(rootComponent, rootProps) {
|
|
|
1795
3419
|
}
|
|
1796
3420
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1797
3421
|
0 && (module.exports = {
|
|
3422
|
+
ErrorBoundary,
|
|
1798
3423
|
NativeBridge,
|
|
1799
3424
|
VActionSheet,
|
|
1800
3425
|
VActivityIndicator,
|
|
1801
3426
|
VAlertDialog,
|
|
1802
3427
|
VButton,
|
|
3428
|
+
VCheckbox,
|
|
3429
|
+
VDropdown,
|
|
1803
3430
|
VImage,
|
|
1804
3431
|
VInput,
|
|
1805
3432
|
VKeyboardAvoiding,
|
|
1806
3433
|
VList,
|
|
1807
3434
|
VModal,
|
|
1808
3435
|
VPicker,
|
|
3436
|
+
VPressable,
|
|
1809
3437
|
VProgressBar,
|
|
3438
|
+
VRadio,
|
|
3439
|
+
VRefreshControl,
|
|
1810
3440
|
VSafeArea,
|
|
1811
3441
|
VScrollView,
|
|
3442
|
+
VSectionList,
|
|
1812
3443
|
VSegmentedControl,
|
|
1813
3444
|
VSlider,
|
|
1814
3445
|
VStatusBar,
|
|
1815
3446
|
VSwitch,
|
|
1816
3447
|
VText,
|
|
3448
|
+
VVideo,
|
|
1817
3449
|
VView,
|
|
1818
3450
|
VWebView,
|
|
3451
|
+
clearSharedElementRegistry,
|
|
1819
3452
|
createApp,
|
|
1820
3453
|
createCommentNode,
|
|
1821
3454
|
createNativeNode,
|
|
1822
3455
|
createStyleSheet,
|
|
1823
3456
|
createTextNode,
|
|
3457
|
+
getRegisteredSharedElements,
|
|
3458
|
+
getSharedElementViewId,
|
|
3459
|
+
measureViewFrame,
|
|
1824
3460
|
render,
|
|
1825
3461
|
resetNodeId,
|
|
3462
|
+
useAccelerometer,
|
|
1826
3463
|
useAnimation,
|
|
1827
3464
|
useAppState,
|
|
3465
|
+
useAppleSignIn,
|
|
1828
3466
|
useAsyncStorage,
|
|
3467
|
+
useAudio,
|
|
1829
3468
|
useBackHandler,
|
|
3469
|
+
useBackgroundTask,
|
|
1830
3470
|
useBiometry,
|
|
3471
|
+
useBluetooth,
|
|
3472
|
+
useCalendar,
|
|
1831
3473
|
useCamera,
|
|
1832
3474
|
useClipboard,
|
|
1833
3475
|
useColorScheme,
|
|
3476
|
+
useContacts,
|
|
3477
|
+
useDatabase,
|
|
1834
3478
|
useDeviceInfo,
|
|
3479
|
+
useDimensions,
|
|
3480
|
+
useFileSystem,
|
|
1835
3481
|
useGeolocation,
|
|
3482
|
+
useGoogleSignIn,
|
|
3483
|
+
useGyroscope,
|
|
1836
3484
|
useHaptics,
|
|
1837
3485
|
useHttp,
|
|
3486
|
+
useI18n,
|
|
3487
|
+
useIAP,
|
|
1838
3488
|
useKeyboard,
|
|
1839
3489
|
useLinking,
|
|
1840
3490
|
useNetwork,
|
|
1841
3491
|
useNotifications,
|
|
3492
|
+
useOTAUpdate,
|
|
3493
|
+
usePerformance,
|
|
1842
3494
|
usePermissions,
|
|
3495
|
+
usePlatform,
|
|
3496
|
+
useSecureStorage,
|
|
1843
3497
|
useShare,
|
|
3498
|
+
useSharedElementTransition,
|
|
3499
|
+
useWebSocket,
|
|
1844
3500
|
vShow,
|
|
1845
3501
|
validStyleProperties,
|
|
1846
3502
|
...require("@vue/runtime-core")
|