wevu 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/compiler.cjs +17 -0
- package/dist/compiler.d.cts +17 -0
- package/dist/compiler.d.mts +17 -0
- package/dist/compiler.mjs +16 -0
- package/dist/index.cjs +175 -41
- package/dist/index.d.cts +187 -47
- package/dist/index.d.mts +187 -47
- package/dist/index.mjs +170 -42
- package/dist/{store-D0GD8ulz.cjs → store-DTqmKv0w.cjs} +1 -2
- package/dist/{store-2q4qcdBi.mjs → store-YHZDsE3y.mjs} +1 -2
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +1 -1
- package/dist/store.d.mts +1 -1
- package/dist/store.mjs +1 -1
- package/package.json +15 -1
- /package/dist/{index-0dF4y5p6.d.mts → index-B63NgJPS.d.cts} +0 -0
- /package/dist/{index-DVEFI-Uo.d.cts → index-Bq83Mwxo.d.mts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as onScopeDispose, D as queueJob, E as nextTick, S as getCurrentScope, T as stop, _ as computed, a as isRef, b as effectScope, c as isObject, d as isShallowReactive, f as markRaw, g as touchReactive, h as toRaw, i as customRef, l as isRaw, m as shallowReactive, n as defineStore, o as ref, p as reactive, r as createStore, s as unref, t as storeToRefs, u as isReactive, v as batch, w as startBatch, x as endBatch, y as effect } from "./store-
|
|
1
|
+
import { C as onScopeDispose, D as queueJob, E as nextTick, S as getCurrentScope, T as stop, _ as computed, a as isRef, b as effectScope, c as isObject, d as isShallowReactive, f as markRaw, g as touchReactive, h as toRaw, i as customRef, l as isRaw, m as shallowReactive, n as defineStore, o as ref, p as reactive, r as createStore, s as unref, t as storeToRefs, u as isReactive, v as batch, w as startBatch, x as endBatch, y as effect } from "./store-YHZDsE3y.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/reactivity/readonly.ts
|
|
4
4
|
function readonly(target) {
|
|
@@ -437,6 +437,10 @@ function onShow(handler) {
|
|
|
437
437
|
if (!__currentInstance) throw new Error("onShow() must be called synchronously inside setup()");
|
|
438
438
|
pushHook(__currentInstance, "onShow", handler);
|
|
439
439
|
}
|
|
440
|
+
function onLoad(handler) {
|
|
441
|
+
if (!__currentInstance) throw new Error("onLoad() must be called synchronously inside setup()");
|
|
442
|
+
pushHook(__currentInstance, "onLoad", handler);
|
|
443
|
+
}
|
|
440
444
|
function onHide(handler) {
|
|
441
445
|
if (!__currentInstance) throw new Error("onHide() must be called synchronously inside setup()");
|
|
442
446
|
pushHook(__currentInstance, "onHide", handler);
|
|
@@ -449,6 +453,14 @@ function onReady(handler) {
|
|
|
449
453
|
if (!__currentInstance) throw new Error("onReady() must be called synchronously inside setup()");
|
|
450
454
|
pushHook(__currentInstance, "onReady", handler);
|
|
451
455
|
}
|
|
456
|
+
function onPullDownRefresh(handler) {
|
|
457
|
+
if (!__currentInstance) throw new Error("onPullDownRefresh() must be called synchronously inside setup()");
|
|
458
|
+
pushHook(__currentInstance, "onPullDownRefresh", handler);
|
|
459
|
+
}
|
|
460
|
+
function onReachBottom(handler) {
|
|
461
|
+
if (!__currentInstance) throw new Error("onReachBottom() must be called synchronously inside setup()");
|
|
462
|
+
pushHook(__currentInstance, "onReachBottom", handler);
|
|
463
|
+
}
|
|
452
464
|
function onPageScroll(handler) {
|
|
453
465
|
if (!__currentInstance) throw new Error("onPageScroll() must be called synchronously inside setup()");
|
|
454
466
|
pushHook(__currentInstance, "onPageScroll", handler);
|
|
@@ -461,6 +473,18 @@ function onTabItemTap(handler) {
|
|
|
461
473
|
if (!__currentInstance) throw new Error("onTabItemTap() must be called synchronously inside setup()");
|
|
462
474
|
pushHook(__currentInstance, "onTabItemTap", handler);
|
|
463
475
|
}
|
|
476
|
+
function onResize(handler) {
|
|
477
|
+
if (!__currentInstance) throw new Error("onResize() must be called synchronously inside setup()");
|
|
478
|
+
pushHook(__currentInstance, "onResize", handler);
|
|
479
|
+
}
|
|
480
|
+
function onMoved(handler) {
|
|
481
|
+
if (!__currentInstance) throw new Error("onMoved() must be called synchronously inside setup()");
|
|
482
|
+
pushHook(__currentInstance, "onMoved", handler);
|
|
483
|
+
}
|
|
484
|
+
function onError(handler) {
|
|
485
|
+
if (!__currentInstance) throw new Error("onError() must be called synchronously inside setup()");
|
|
486
|
+
pushHook(__currentInstance, "onError", handler);
|
|
487
|
+
}
|
|
464
488
|
function onSaveExitState(handler) {
|
|
465
489
|
if (!__currentInstance) throw new Error("onSaveExitState() must be called synchronously inside setup()");
|
|
466
490
|
pushHook(__currentInstance, "onSaveExitState", handler, { single: true });
|
|
@@ -633,11 +657,35 @@ function registerWatches(runtime, watchMap, instance) {
|
|
|
633
657
|
}
|
|
634
658
|
return stops;
|
|
635
659
|
}
|
|
636
|
-
function mountRuntimeInstance(target, runtimeApp, watchMap, setup) {
|
|
660
|
+
function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
637
661
|
if (target.__wevu) return target.__wevu;
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
662
|
+
const createDeferredAdapter = (instance) => {
|
|
663
|
+
let pending;
|
|
664
|
+
let enabled = false;
|
|
665
|
+
const adapter$1 = { setData(payload) {
|
|
666
|
+
if (!enabled) {
|
|
667
|
+
pending = {
|
|
668
|
+
...pending ?? {},
|
|
669
|
+
...payload
|
|
670
|
+
};
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
if (typeof instance.setData === "function") return instance.setData(payload);
|
|
674
|
+
} };
|
|
675
|
+
adapter$1.__wevu_enableSetData = () => {
|
|
676
|
+
enabled = true;
|
|
677
|
+
if (pending && Object.keys(pending).length && typeof instance.setData === "function") {
|
|
678
|
+
const payload = pending;
|
|
679
|
+
pending = void 0;
|
|
680
|
+
instance.setData(payload);
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
return adapter$1;
|
|
684
|
+
};
|
|
685
|
+
const adapter = options?.deferSetData ? createDeferredAdapter(target) : { setData(payload) {
|
|
686
|
+
if (typeof target.setData === "function") return target.setData(payload);
|
|
687
|
+
} };
|
|
688
|
+
const runtime = runtimeApp.mount({ ...adapter });
|
|
641
689
|
const runtimeProxy = runtime?.proxy ?? {};
|
|
642
690
|
const runtimeState = runtime?.state ?? {};
|
|
643
691
|
if (!runtime?.methods) try {
|
|
@@ -675,8 +723,8 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup) {
|
|
|
675
723
|
bindModel: runtimeBindModel.bind(runtimeWithDefaults),
|
|
676
724
|
watch: runtimeWatch.bind(runtimeWithDefaults),
|
|
677
725
|
instance: target,
|
|
678
|
-
emit: (event,
|
|
679
|
-
if (typeof target.triggerEvent === "function") target.triggerEvent(event,
|
|
726
|
+
emit: (event, detail, options$1) => {
|
|
727
|
+
if (typeof target.triggerEvent === "function") target.triggerEvent(event, detail, options$1);
|
|
680
728
|
},
|
|
681
729
|
expose: (exposed) => {
|
|
682
730
|
target.__wevuExposed = exposed;
|
|
@@ -704,6 +752,10 @@ function mountRuntimeInstance(target, runtimeApp, watchMap, setup) {
|
|
|
704
752
|
} catch {}
|
|
705
753
|
return runtime;
|
|
706
754
|
}
|
|
755
|
+
function enableDeferredSetData(target) {
|
|
756
|
+
const adapter = target.__wevu?.adapter;
|
|
757
|
+
if (adapter && typeof adapter.__wevu_enableSetData === "function") adapter.__wevu_enableSetData();
|
|
758
|
+
}
|
|
707
759
|
function teardownRuntimeInstance(target) {
|
|
708
760
|
const runtime = target.__wevu;
|
|
709
761
|
if (runtime && target.__wevuHooks) callHookList(target, "onUnload", []);
|
|
@@ -743,7 +795,7 @@ function registerApp(runtimeApp, methods, watch$1, setup, mpOptions) {
|
|
|
743
795
|
if (typeof userOnHide === "function") userOnHide.apply(this, args);
|
|
744
796
|
};
|
|
745
797
|
const userOnError = appOptions.onError;
|
|
746
|
-
appOptions.onError = function onError(...args) {
|
|
798
|
+
appOptions.onError = function onError$1(...args) {
|
|
747
799
|
callHookList(this, "onAppError", args);
|
|
748
800
|
if (typeof userOnError === "function") userOnError.apply(this, args);
|
|
749
801
|
};
|
|
@@ -760,7 +812,7 @@ function registerApp(runtimeApp, methods, watch$1, setup, mpOptions) {
|
|
|
760
812
|
}
|
|
761
813
|
App(appOptions);
|
|
762
814
|
}
|
|
763
|
-
function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions
|
|
815
|
+
function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions) {
|
|
764
816
|
const { methods: userMethods = {}, lifetimes: userLifetimes = {}, pageLifetimes: userPageLifetimes = {}, options: userOptions = {}, ...rest } = mpOptions;
|
|
765
817
|
const userOnLoad = rest.onLoad;
|
|
766
818
|
const userOnUnload = rest.onUnload;
|
|
@@ -768,21 +820,68 @@ function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions, featu
|
|
|
768
820
|
const userOnHide = rest.onHide;
|
|
769
821
|
const userOnReady = rest.onReady;
|
|
770
822
|
const userOnSaveExitState = rest.onSaveExitState;
|
|
823
|
+
const userOnPullDownRefresh = rest.onPullDownRefresh;
|
|
824
|
+
const userOnReachBottom = rest.onReachBottom;
|
|
771
825
|
const userOnPageScroll = rest.onPageScroll;
|
|
826
|
+
const userOnRouteDone = rest.onRouteDone;
|
|
827
|
+
const userOnTabItemTap = rest.onTabItemTap;
|
|
828
|
+
const userOnResize = rest.onResize;
|
|
772
829
|
const userOnShareAppMessage = rest.onShareAppMessage;
|
|
773
830
|
const userOnShareTimeline = rest.onShareTimeline;
|
|
774
831
|
const userOnAddToFavorites = rest.onAddToFavorites;
|
|
832
|
+
const features = rest.features ?? {};
|
|
775
833
|
const restOptions = { ...rest };
|
|
834
|
+
const legacyCreated = restOptions.created;
|
|
835
|
+
delete restOptions.features;
|
|
836
|
+
delete restOptions.created;
|
|
776
837
|
delete restOptions.onLoad;
|
|
777
838
|
delete restOptions.onUnload;
|
|
778
839
|
delete restOptions.onShow;
|
|
779
840
|
delete restOptions.onHide;
|
|
780
841
|
delete restOptions.onReady;
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
842
|
+
const enableOnPullDownRefresh = typeof userOnPullDownRefresh === "function" || Boolean(features.enableOnPullDownRefresh);
|
|
843
|
+
const enableOnReachBottom = typeof userOnReachBottom === "function" || Boolean(features.enableOnReachBottom);
|
|
844
|
+
const enableOnPageScroll = typeof userOnPageScroll === "function" || Boolean(features.enableOnPageScroll);
|
|
845
|
+
const enableOnRouteDone = typeof userOnRouteDone === "function" || Boolean(features.enableOnRouteDone);
|
|
846
|
+
const enableOnTabItemTap = typeof userOnTabItemTap === "function" || Boolean(features.enableOnTabItemTap);
|
|
847
|
+
const enableOnResize = typeof userOnResize === "function" || Boolean(features.enableOnResize);
|
|
848
|
+
const enableOnShareAppMessage = typeof userOnShareAppMessage === "function" || Boolean(features.enableOnShareAppMessage);
|
|
849
|
+
const enableOnShareTimeline = typeof userOnShareTimeline === "function" || Boolean(features.enableOnShareTimeline);
|
|
850
|
+
const enableOnAddToFavorites = typeof userOnAddToFavorites === "function" || Boolean(features.enableOnAddToFavorites);
|
|
851
|
+
const enableOnSaveExitState = typeof userOnSaveExitState === "function" || Boolean(features.enableOnSaveExitState);
|
|
852
|
+
const fallbackNoop = () => {};
|
|
853
|
+
const fallbackShareContent = () => ({});
|
|
854
|
+
const fallbackTimelineContent = () => ({});
|
|
855
|
+
const effectiveOnSaveExitState = typeof userOnSaveExitState === "function" ? userOnSaveExitState : (() => ({ data: void 0 }));
|
|
856
|
+
const effectiveOnPullDownRefresh = typeof userOnPullDownRefresh === "function" ? userOnPullDownRefresh : fallbackNoop;
|
|
857
|
+
const effectiveOnReachBottom = typeof userOnReachBottom === "function" ? userOnReachBottom : fallbackNoop;
|
|
858
|
+
const effectiveOnPageScroll = typeof userOnPageScroll === "function" ? userOnPageScroll : fallbackNoop;
|
|
859
|
+
const effectiveOnRouteDone = typeof userOnRouteDone === "function" ? userOnRouteDone : fallbackNoop;
|
|
860
|
+
const effectiveOnTabItemTap = typeof userOnTabItemTap === "function" ? userOnTabItemTap : fallbackNoop;
|
|
861
|
+
const effectiveOnResize = typeof userOnResize === "function" ? userOnResize : fallbackNoop;
|
|
862
|
+
const effectiveOnShareAppMessage = typeof userOnShareAppMessage === "function" ? userOnShareAppMessage : fallbackShareContent;
|
|
863
|
+
const effectiveOnShareTimeline = typeof userOnShareTimeline === "function" ? userOnShareTimeline : fallbackTimelineContent;
|
|
864
|
+
const effectiveOnAddToFavorites = typeof userOnAddToFavorites === "function" ? userOnAddToFavorites : (() => ({}));
|
|
865
|
+
const hasHook = (target, name) => {
|
|
866
|
+
const hooks = target.__wevuHooks;
|
|
867
|
+
if (!hooks) return false;
|
|
868
|
+
const entry = hooks[name];
|
|
869
|
+
if (!entry) return false;
|
|
870
|
+
if (Array.isArray(entry)) return entry.length > 0;
|
|
871
|
+
return typeof entry === "function";
|
|
872
|
+
};
|
|
873
|
+
{
|
|
874
|
+
const userExport = restOptions.export;
|
|
875
|
+
restOptions.export = function __wevu_export() {
|
|
876
|
+
const exposed = this.__wevuExposed ?? {};
|
|
877
|
+
const base = typeof userExport === "function" ? userExport.call(this) : {};
|
|
878
|
+
if (base && typeof base === "object" && !Array.isArray(base)) return {
|
|
879
|
+
...exposed,
|
|
880
|
+
...base
|
|
881
|
+
};
|
|
882
|
+
return base ?? exposed;
|
|
883
|
+
};
|
|
884
|
+
}
|
|
786
885
|
const finalOptions = {
|
|
787
886
|
multipleSlots: userOptions.multipleSlots ?? true,
|
|
788
887
|
...userOptions
|
|
@@ -804,18 +903,11 @@ function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions, featu
|
|
|
804
903
|
return result;
|
|
805
904
|
};
|
|
806
905
|
}
|
|
807
|
-
const wrapSpecial = (name) => {
|
|
808
|
-
const user = userLifetimes[name] ?? userPageLifetimes[name];
|
|
809
|
-
finalMethods[name] = function wrapped(...args) {
|
|
810
|
-
callHookList(this, name, args);
|
|
811
|
-
if (typeof user === "function") return user.apply(this, args);
|
|
812
|
-
};
|
|
813
|
-
};
|
|
814
|
-
wrapSpecial("onTabItemTap");
|
|
815
|
-
wrapSpecial("onRouteDone");
|
|
816
906
|
const pageLifecycleHooks = {
|
|
817
907
|
onLoad(...args) {
|
|
818
908
|
mountRuntimeInstance(this, runtimeApp, watch$1, setup);
|
|
909
|
+
enableDeferredSetData(this);
|
|
910
|
+
callHookList(this, "onLoad", args);
|
|
819
911
|
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args);
|
|
820
912
|
},
|
|
821
913
|
onUnload(...args) {
|
|
@@ -836,39 +928,69 @@ function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions, featu
|
|
|
836
928
|
callHookList(this, "onReady", args);
|
|
837
929
|
}
|
|
838
930
|
if (typeof userOnReady === "function") return userOnReady.apply(this, args);
|
|
839
|
-
},
|
|
840
|
-
onSaveExitState(...args) {
|
|
841
|
-
const ret = callHookReturn(this, "onSaveExitState", args);
|
|
842
|
-
if (ret !== void 0) return ret;
|
|
843
|
-
if (typeof userOnSaveExitState === "function") return userOnSaveExitState.apply(this, args);
|
|
844
931
|
}
|
|
845
932
|
};
|
|
846
|
-
if (
|
|
933
|
+
if (enableOnSaveExitState) pageLifecycleHooks.onSaveExitState = function onSaveExitState$1(...args) {
|
|
934
|
+
const ret = callHookReturn(this, "onSaveExitState", args);
|
|
935
|
+
if (ret !== void 0) return ret;
|
|
936
|
+
return effectiveOnSaveExitState.apply(this, args);
|
|
937
|
+
};
|
|
938
|
+
if (enableOnPullDownRefresh) pageLifecycleHooks.onPullDownRefresh = function onPullDownRefresh$1(...args) {
|
|
939
|
+
callHookList(this, "onPullDownRefresh", args);
|
|
940
|
+
if (!hasHook(this, "onPullDownRefresh")) return effectiveOnPullDownRefresh.apply(this, args);
|
|
941
|
+
};
|
|
942
|
+
if (enableOnReachBottom) pageLifecycleHooks.onReachBottom = function onReachBottom$1(...args) {
|
|
943
|
+
callHookList(this, "onReachBottom", args);
|
|
944
|
+
if (!hasHook(this, "onReachBottom")) return effectiveOnReachBottom.apply(this, args);
|
|
945
|
+
};
|
|
946
|
+
if (enableOnPageScroll) pageLifecycleHooks.onPageScroll = function onPageScroll$1(...args) {
|
|
847
947
|
callHookList(this, "onPageScroll", args);
|
|
848
|
-
if (
|
|
948
|
+
if (!hasHook(this, "onPageScroll")) return effectiveOnPageScroll.apply(this, args);
|
|
849
949
|
};
|
|
850
|
-
if (
|
|
950
|
+
if (enableOnRouteDone) pageLifecycleHooks.onRouteDone = function onRouteDone$1(...args) {
|
|
951
|
+
callHookList(this, "onRouteDone", args);
|
|
952
|
+
if (!hasHook(this, "onRouteDone")) return effectiveOnRouteDone.apply(this, args);
|
|
953
|
+
};
|
|
954
|
+
if (enableOnTabItemTap) pageLifecycleHooks.onTabItemTap = function onTabItemTap$1(...args) {
|
|
955
|
+
callHookList(this, "onTabItemTap", args);
|
|
956
|
+
if (!hasHook(this, "onTabItemTap")) return effectiveOnTabItemTap.apply(this, args);
|
|
957
|
+
};
|
|
958
|
+
if (enableOnResize) pageLifecycleHooks.onResize = function onResize$1(...args) {
|
|
959
|
+
callHookList(this, "onResize", args);
|
|
960
|
+
if (!hasHook(this, "onResize")) return effectiveOnResize.apply(this, args);
|
|
961
|
+
};
|
|
962
|
+
if (enableOnShareAppMessage) pageLifecycleHooks.onShareAppMessage = function onShareAppMessage$1(...args) {
|
|
851
963
|
const ret = callHookReturn(this, "onShareAppMessage", args);
|
|
852
964
|
if (ret !== void 0) return ret;
|
|
853
|
-
|
|
965
|
+
return effectiveOnShareAppMessage.apply(this, args);
|
|
854
966
|
};
|
|
855
|
-
if (
|
|
967
|
+
if (enableOnShareTimeline) pageLifecycleHooks.onShareTimeline = function onShareTimeline$1(...args) {
|
|
856
968
|
const ret = callHookReturn(this, "onShareTimeline", args);
|
|
857
969
|
if (ret !== void 0) return ret;
|
|
858
|
-
|
|
970
|
+
return effectiveOnShareTimeline.apply(this, args);
|
|
859
971
|
};
|
|
860
|
-
if (
|
|
972
|
+
if (enableOnAddToFavorites) pageLifecycleHooks.onAddToFavorites = function onAddToFavorites$1(...args) {
|
|
861
973
|
const ret = callHookReturn(this, "onAddToFavorites", args);
|
|
862
974
|
if (ret !== void 0) return ret;
|
|
863
|
-
|
|
975
|
+
return effectiveOnAddToFavorites.apply(this, args);
|
|
864
976
|
};
|
|
865
977
|
Component({
|
|
866
978
|
...restOptions,
|
|
867
979
|
...pageLifecycleHooks,
|
|
868
980
|
lifetimes: {
|
|
869
981
|
...userLifetimes,
|
|
982
|
+
created: function created(...args) {
|
|
983
|
+
mountRuntimeInstance(this, runtimeApp, watch$1, setup, { deferSetData: true });
|
|
984
|
+
if (typeof legacyCreated === "function") legacyCreated.apply(this, args);
|
|
985
|
+
if (typeof userLifetimes.created === "function") userLifetimes.created.apply(this, args);
|
|
986
|
+
},
|
|
987
|
+
moved: function moved(...args) {
|
|
988
|
+
callHookList(this, "onMoved", args);
|
|
989
|
+
if (typeof userLifetimes.moved === "function") userLifetimes.moved.apply(this, args);
|
|
990
|
+
},
|
|
870
991
|
attached: function attached(...args) {
|
|
871
992
|
mountRuntimeInstance(this, runtimeApp, watch$1, setup);
|
|
993
|
+
enableDeferredSetData(this);
|
|
872
994
|
if (typeof userLifetimes.attached === "function") userLifetimes.attached.apply(this, args);
|
|
873
995
|
},
|
|
874
996
|
ready: function ready(...args) {
|
|
@@ -881,6 +1003,10 @@ function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions, featu
|
|
|
881
1003
|
detached: function detached(...args) {
|
|
882
1004
|
teardownRuntimeInstance(this);
|
|
883
1005
|
if (typeof userLifetimes.detached === "function") userLifetimes.detached.apply(this, args);
|
|
1006
|
+
},
|
|
1007
|
+
error: function error(...args) {
|
|
1008
|
+
callHookList(this, "onError", args);
|
|
1009
|
+
if (typeof userLifetimes.error === "function") userLifetimes.error.apply(this, args);
|
|
884
1010
|
}
|
|
885
1011
|
},
|
|
886
1012
|
pageLifetimes: {
|
|
@@ -892,6 +1018,10 @@ function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions, featu
|
|
|
892
1018
|
hide: function hide(...args) {
|
|
893
1019
|
callHookList(this, "onHide", args);
|
|
894
1020
|
if (typeof userPageLifetimes.hide === "function") userPageLifetimes.hide.apply(this, args);
|
|
1021
|
+
},
|
|
1022
|
+
resize: function resize(...args) {
|
|
1023
|
+
callHookList(this, "onResize", args);
|
|
1024
|
+
if (typeof userPageLifetimes.resize === "function") userPageLifetimes.resize.apply(this, args);
|
|
895
1025
|
}
|
|
896
1026
|
},
|
|
897
1027
|
methods: finalMethods,
|
|
@@ -1126,7 +1256,6 @@ function setComputedValue(setters, key, value) {
|
|
|
1126
1256
|
* @example
|
|
1127
1257
|
* ```ts
|
|
1128
1258
|
* defineComponent({
|
|
1129
|
-
* features: { listenPageScroll: true },
|
|
1130
1259
|
* setup() {
|
|
1131
1260
|
* onPageScroll(() => {})
|
|
1132
1261
|
* }
|
|
@@ -1134,7 +1263,7 @@ function setComputedValue(setters, key, value) {
|
|
|
1134
1263
|
* ```
|
|
1135
1264
|
*/
|
|
1136
1265
|
function defineComponent(options) {
|
|
1137
|
-
const {
|
|
1266
|
+
const { data, computed: computed$1, methods, watch: watch$1, setup, props, ...mpOptions } = options;
|
|
1138
1267
|
const runtimeApp = createApp({
|
|
1139
1268
|
data,
|
|
1140
1269
|
computed: computed$1,
|
|
@@ -1151,10 +1280,9 @@ function defineComponent(options) {
|
|
|
1151
1280
|
methods,
|
|
1152
1281
|
watch: watch$1,
|
|
1153
1282
|
setup: setupWrapper,
|
|
1154
|
-
mpOptions: mpOptionsWithProps
|
|
1155
|
-
features
|
|
1283
|
+
mpOptions: mpOptionsWithProps
|
|
1156
1284
|
};
|
|
1157
|
-
registerComponent(runtimeApp, methods ?? {}, watch$1, setupWrapper, mpOptionsWithProps
|
|
1285
|
+
registerComponent(runtimeApp, methods ?? {}, watch$1, setupWrapper, mpOptionsWithProps);
|
|
1158
1286
|
return {
|
|
1159
1287
|
__wevu_runtime: runtimeApp,
|
|
1160
1288
|
__wevu_options: componentOptions
|
|
@@ -1314,4 +1442,4 @@ function injectGlobal(key, defaultValue) {
|
|
|
1314
1442
|
}
|
|
1315
1443
|
|
|
1316
1444
|
//#endregion
|
|
1317
|
-
export { batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getDeepWatchStrategy, inject, injectGlobal, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markRaw, mountRuntimeInstance, nextTick, onActivated, onAddToFavorites, onAppError, onAppHide, onAppShow, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onHide, onMounted, onPageScroll, onReady, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onUnload, onUnmounted, onUpdated, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, runSetupFunction, setCurrentInstance, setDeepWatchStrategy, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, watch, watchEffect };
|
|
1445
|
+
export { batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getDeepWatchStrategy, inject, injectGlobal, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markRaw, mountRuntimeInstance, nextTick, onActivated, onAddToFavorites, onAppError, onAppHide, onAppShow, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLoad, onMounted, onMoved, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onUnload, onUnmounted, onUpdated, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, runSetupFunction, setCurrentInstance, setDeepWatchStrategy, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, watch, watchEffect };
|
|
@@ -317,7 +317,6 @@ function convertToReactive(value) {
|
|
|
317
317
|
return isObject$1(value) ? reactive(value) : value;
|
|
318
318
|
}
|
|
319
319
|
/**
|
|
320
|
-
* Establish a dependency on the whole reactive object "version".
|
|
321
320
|
* 让 effect 订阅整个对象的“版本号”,无需深度遍历即可对任何字段变化做出响应。
|
|
322
321
|
*/
|
|
323
322
|
function touchReactive(target) {
|
|
@@ -381,7 +380,7 @@ function shallowReactive(target) {
|
|
|
381
380
|
return proxy;
|
|
382
381
|
}
|
|
383
382
|
/**
|
|
384
|
-
*
|
|
383
|
+
* 判断一个值是否为 shallowReactive 创建的浅层响应式对象
|
|
385
384
|
*/
|
|
386
385
|
function isShallowReactive(value) {
|
|
387
386
|
const raw = toRaw(value);
|
|
@@ -316,7 +316,6 @@ function convertToReactive(value) {
|
|
|
316
316
|
return isObject$1(value) ? reactive(value) : value;
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
|
-
* Establish a dependency on the whole reactive object "version".
|
|
320
319
|
* 让 effect 订阅整个对象的“版本号”,无需深度遍历即可对任何字段变化做出响应。
|
|
321
320
|
*/
|
|
322
321
|
function touchReactive(target) {
|
|
@@ -380,7 +379,7 @@ function shallowReactive(target) {
|
|
|
380
379
|
return proxy;
|
|
381
380
|
}
|
|
382
381
|
/**
|
|
383
|
-
*
|
|
382
|
+
* 判断一个值是否为 shallowReactive 创建的浅层响应式对象
|
|
384
383
|
*/
|
|
385
384
|
function isShallowReactive(value) {
|
|
386
385
|
const raw = toRaw(value);
|
package/dist/store.cjs
CHANGED
package/dist/store.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DefineStoreOptions, c as SubscriptionCallback, i as ActionSubscriber, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs } from "./index-
|
|
1
|
+
import { a as DefineStoreOptions, c as SubscriptionCallback, i as ActionSubscriber, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs } from "./index-B63NgJPS.cjs";
|
|
2
2
|
export { ActionSubscriber, DefineStoreOptions, MutationType, StoreManager, SubscriptionCallback, createStore, defineStore, storeToRefs };
|
package/dist/store.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DefineStoreOptions, c as SubscriptionCallback, i as ActionSubscriber, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs } from "./index-
|
|
1
|
+
import { a as DefineStoreOptions, c as SubscriptionCallback, i as ActionSubscriber, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs } from "./index-Bq83Mwxo.mjs";
|
|
2
2
|
export { ActionSubscriber, DefineStoreOptions, MutationType, StoreManager, SubscriptionCallback, createStore, defineStore, storeToRefs };
|
package/dist/store.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wevu",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.3",
|
|
5
5
|
"description": "Vue 3 风格的小程序运行时,包含响应式、diff+setData 与轻量状态管理",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,6 +37,17 @@
|
|
|
37
37
|
"types": "./dist/index.d.cts",
|
|
38
38
|
"default": "./dist/index.cjs"
|
|
39
39
|
}
|
|
40
|
+
},
|
|
41
|
+
"./compiler": {
|
|
42
|
+
"types": "./dist/compiler.d.mts",
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/compiler.d.mts",
|
|
45
|
+
"default": "./dist/compiler.mjs"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/compiler.d.cts",
|
|
49
|
+
"default": "./dist/compiler.cjs"
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
},
|
|
42
53
|
"main": "./dist/index.cjs",
|
|
@@ -52,6 +63,9 @@
|
|
|
52
63
|
"engines": {
|
|
53
64
|
"node": ">=20.19.0"
|
|
54
65
|
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"miniprogram-api-typings": "^4.1.2"
|
|
68
|
+
},
|
|
55
69
|
"scripts": {
|
|
56
70
|
"dev": "tsdown -w",
|
|
57
71
|
"build": "tsdown",
|
|
File without changes
|
|
File without changes
|