wevu 1.0.0-alpha.3 → 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,13 @@
1
- import { a as DefineStoreOptions, c as SubscriptionCallback, d as ref, f as unref, i as ActionSubscriber, l as Ref, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs, u as isRef } from "./index-B63NgJPS.cjs";
2
-
1
+ //#region src/reactivity/ref.d.ts
2
+ interface Ref<T$1 = any, S = T$1> {
3
+ get value(): T$1;
4
+ set value(_: S);
5
+ [key: symbol]: any;
6
+ }
7
+ declare function isRef(value: unknown): value is Ref<any>;
8
+ declare function ref<T$1>(value: T$1): Ref<T$1>;
9
+ declare function unref<T$1>(value: T$1 | Ref<T$1>): T$1;
10
+ //#endregion
3
11
  //#region src/reactivity/computed.d.ts
4
12
  type ComputedGetter<T$1> = () => T$1;
5
13
  type ComputedSetter<T$1> = (value: T$1) => void;
@@ -405,6 +413,10 @@ interface SetupContext<D extends object, C extends ComputedDefinitions, M extend
405
413
  * Vue 3 对齐:attrs(小程序场景兜底为空对象)
406
414
  */
407
415
  attrs: Record<string, any>;
416
+ /**
417
+ * Vue 3 对齐:slots(小程序场景兜底为空对象)
418
+ */
419
+ slots: Record<string, any>;
408
420
  }
409
421
  type TriggerEventOptions = WechatMiniprogram.Component.TriggerEventOption;
410
422
  interface InternalRuntimeStateFields {
@@ -578,6 +590,8 @@ declare function createWevuComponent<D extends object, C extends ComputedDefinit
578
590
  //#region src/runtime/hooks.d.ts
579
591
  declare function getCurrentInstance<T$1 extends InternalRuntimeState = InternalRuntimeState>(): T$1 | undefined;
580
592
  declare function setCurrentInstance(inst: InternalRuntimeState | undefined): void;
593
+ declare function getCurrentSetupContext<T$1 = any>(): T$1 | undefined;
594
+ declare function setCurrentSetupContext(ctx: any | undefined): void;
581
595
  declare function callHookList(target: InternalRuntimeState, name: string, args?: any[]): void;
582
596
  declare function callHookReturn(target: InternalRuntimeState, name: string, args?: any[]): any;
583
597
  declare function onAppShow(handler: (options: WechatMiniprogram.App.LaunchShowOption) => void): void;
@@ -705,4 +719,79 @@ declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
705
719
  declare function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineAppOptions<D, C, M>['setup'], mpOptions: MiniProgramAppOptions): void;
706
720
  declare function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'], mpOptions: MiniProgramComponentRawOptions): void;
707
721
  //#endregion
708
- export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, InternalRuntimeStateFields, MethodDefinitions, MiniProgramAdapter, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, MiniProgramComponentBehaviorOptions, MiniProgramComponentOptions, MiniProgramComponentRawOptions, MiniProgramInstance, MiniProgramPageLifetimes, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, TriggerEventOptions, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, 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 };
722
+ //#region src/runtime/vueCompat.d.ts
723
+ declare function useAttrs(): Record<string, any>;
724
+ declare function useSlots(): Record<string, any>;
725
+ declare function useModel<T$1 = any>(props: Record<string, any>, name: string): Ref<T$1>;
726
+ declare function mergeModels<T$1>(a: T$1, b: T$1): T$1;
727
+ //#endregion
728
+ //#region src/store/types.d.ts
729
+ type MutationType = 'patch object' | 'patch function';
730
+ interface SubscriptionCallback<S = any> {
731
+ (mutation: {
732
+ type: MutationType;
733
+ storeId: string;
734
+ }, state: S): void;
735
+ }
736
+ interface ActionSubscriber<TStore = any> {
737
+ (context: {
738
+ name: string;
739
+ store: TStore;
740
+ args: any[];
741
+ after: (cb: (result: any) => void) => void;
742
+ onError: (cb: (error: any) => void) => void;
743
+ }): void;
744
+ }
745
+ interface StoreManager {
746
+ install: (app: any) => void;
747
+ _stores: Map<string, any>;
748
+ use: (plugin: (context: {
749
+ store: any;
750
+ }) => void) => StoreManager;
751
+ _plugins: Array<(context: {
752
+ store: any;
753
+ }) => void>;
754
+ }
755
+ type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
756
+ type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
757
+ interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
758
+ state: () => S;
759
+ getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
760
+ actions?: A & ThisType<S & StoreGetters<G> & A>;
761
+ }
762
+ //#endregion
763
+ //#region src/store/define.d.ts
764
+ type SetupDefinition<T$1> = () => T$1;
765
+ declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
766
+ $id: string;
767
+ $patch: (patch: Record<string, any> | ((state: any) => void)) => void;
768
+ $subscribe: (cb: (mutation: {
769
+ type: MutationType;
770
+ storeId: string;
771
+ }, state: any) => void, opts?: {
772
+ detached?: boolean;
773
+ }) => () => void;
774
+ $onAction: (cb: (context: any) => void) => () => void;
775
+ };
776
+ declare function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(id: string, options: DefineStoreOptions<S, G, A>): () => S & StoreGetters<G> & A & {
777
+ $id: string;
778
+ $state: S;
779
+ $patch: (patch: Partial<S> | ((state: S) => void)) => void;
780
+ $reset: () => void;
781
+ $subscribe: (cb: (mutation: {
782
+ type: MutationType;
783
+ storeId: string;
784
+ }, state: S) => void, opts?: {
785
+ detached?: boolean;
786
+ }) => () => void;
787
+ $onAction: (cb: (context: any) => () => void) => () => void;
788
+ };
789
+ //#endregion
790
+ //#region src/store/manager.d.ts
791
+ declare function createStore(): StoreManager;
792
+ //#endregion
793
+ //#region src/store/storeToRefs.d.ts
794
+ type StoreToRefsResult<T$1 extends Record<string, any>> = { [K in keyof T$1]: T$1[K] extends ((...args: any[]) => any) ? T$1[K] : T$1[K] extends Ref<infer V> ? Ref<V> : Ref<T$1[K]> };
795
+ declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
796
+ //#endregion
797
+ export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, InternalRuntimeStateFields, MethodDefinitions, MiniProgramAdapter, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, MiniProgramComponentBehaviorOptions, MiniProgramComponentOptions, MiniProgramComponentRawOptions, MiniProgramInstance, MiniProgramPageLifetimes, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, TriggerEventOptions, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, inject, injectGlobal, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markRaw, mergeModels, 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, setCurrentSetupContext, setDeepWatchStrategy, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, useAttrs, useModel, useSlots, watch, watchEffect };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,13 @@
1
- import { a as DefineStoreOptions, c as SubscriptionCallback, d as ref, f as unref, i as ActionSubscriber, l as Ref, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs, u as isRef } from "./index-Bq83Mwxo.mjs";
2
-
1
+ //#region src/reactivity/ref.d.ts
2
+ interface Ref<T$1 = any, S = T$1> {
3
+ get value(): T$1;
4
+ set value(_: S);
5
+ [key: symbol]: any;
6
+ }
7
+ declare function isRef(value: unknown): value is Ref<any>;
8
+ declare function ref<T$1>(value: T$1): Ref<T$1>;
9
+ declare function unref<T$1>(value: T$1 | Ref<T$1>): T$1;
10
+ //#endregion
3
11
  //#region src/reactivity/computed.d.ts
4
12
  type ComputedGetter<T$1> = () => T$1;
5
13
  type ComputedSetter<T$1> = (value: T$1) => void;
@@ -405,6 +413,10 @@ interface SetupContext<D extends object, C extends ComputedDefinitions, M extend
405
413
  * Vue 3 对齐:attrs(小程序场景兜底为空对象)
406
414
  */
407
415
  attrs: Record<string, any>;
416
+ /**
417
+ * Vue 3 对齐:slots(小程序场景兜底为空对象)
418
+ */
419
+ slots: Record<string, any>;
408
420
  }
409
421
  type TriggerEventOptions = WechatMiniprogram.Component.TriggerEventOption;
410
422
  interface InternalRuntimeStateFields {
@@ -578,6 +590,8 @@ declare function createWevuComponent<D extends object, C extends ComputedDefinit
578
590
  //#region src/runtime/hooks.d.ts
579
591
  declare function getCurrentInstance<T$1 extends InternalRuntimeState = InternalRuntimeState>(): T$1 | undefined;
580
592
  declare function setCurrentInstance(inst: InternalRuntimeState | undefined): void;
593
+ declare function getCurrentSetupContext<T$1 = any>(): T$1 | undefined;
594
+ declare function setCurrentSetupContext(ctx: any | undefined): void;
581
595
  declare function callHookList(target: InternalRuntimeState, name: string, args?: any[]): void;
582
596
  declare function callHookReturn(target: InternalRuntimeState, name: string, args?: any[]): any;
583
597
  declare function onAppShow(handler: (options: WechatMiniprogram.App.LaunchShowOption) => void): void;
@@ -705,4 +719,79 @@ declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
705
719
  declare function registerApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineAppOptions<D, C, M>['setup'], mpOptions: MiniProgramAppOptions): void;
706
720
  declare function registerComponent<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(runtimeApp: RuntimeApp<D, C, M>, methods: MethodDefinitions, watch: WatchMap | undefined, setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'], mpOptions: MiniProgramComponentRawOptions): void;
707
721
  //#endregion
708
- export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, InternalRuntimeStateFields, MethodDefinitions, MiniProgramAdapter, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, MiniProgramComponentBehaviorOptions, MiniProgramComponentOptions, MiniProgramComponentRawOptions, MiniProgramInstance, MiniProgramPageLifetimes, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, TriggerEventOptions, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, 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 };
722
+ //#region src/runtime/vueCompat.d.ts
723
+ declare function useAttrs(): Record<string, any>;
724
+ declare function useSlots(): Record<string, any>;
725
+ declare function useModel<T$1 = any>(props: Record<string, any>, name: string): Ref<T$1>;
726
+ declare function mergeModels<T$1>(a: T$1, b: T$1): T$1;
727
+ //#endregion
728
+ //#region src/store/types.d.ts
729
+ type MutationType = 'patch object' | 'patch function';
730
+ interface SubscriptionCallback<S = any> {
731
+ (mutation: {
732
+ type: MutationType;
733
+ storeId: string;
734
+ }, state: S): void;
735
+ }
736
+ interface ActionSubscriber<TStore = any> {
737
+ (context: {
738
+ name: string;
739
+ store: TStore;
740
+ args: any[];
741
+ after: (cb: (result: any) => void) => void;
742
+ onError: (cb: (error: any) => void) => void;
743
+ }): void;
744
+ }
745
+ interface StoreManager {
746
+ install: (app: any) => void;
747
+ _stores: Map<string, any>;
748
+ use: (plugin: (context: {
749
+ store: any;
750
+ }) => void) => StoreManager;
751
+ _plugins: Array<(context: {
752
+ store: any;
753
+ }) => void>;
754
+ }
755
+ type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
756
+ type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
757
+ interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
758
+ state: () => S;
759
+ getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
760
+ actions?: A & ThisType<S & StoreGetters<G> & A>;
761
+ }
762
+ //#endregion
763
+ //#region src/store/define.d.ts
764
+ type SetupDefinition<T$1> = () => T$1;
765
+ declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
766
+ $id: string;
767
+ $patch: (patch: Record<string, any> | ((state: any) => void)) => void;
768
+ $subscribe: (cb: (mutation: {
769
+ type: MutationType;
770
+ storeId: string;
771
+ }, state: any) => void, opts?: {
772
+ detached?: boolean;
773
+ }) => () => void;
774
+ $onAction: (cb: (context: any) => void) => () => void;
775
+ };
776
+ declare function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(id: string, options: DefineStoreOptions<S, G, A>): () => S & StoreGetters<G> & A & {
777
+ $id: string;
778
+ $state: S;
779
+ $patch: (patch: Partial<S> | ((state: S) => void)) => void;
780
+ $reset: () => void;
781
+ $subscribe: (cb: (mutation: {
782
+ type: MutationType;
783
+ storeId: string;
784
+ }, state: S) => void, opts?: {
785
+ detached?: boolean;
786
+ }) => () => void;
787
+ $onAction: (cb: (context: any) => () => void) => () => void;
788
+ };
789
+ //#endregion
790
+ //#region src/store/manager.d.ts
791
+ declare function createStore(): StoreManager;
792
+ //#endregion
793
+ //#region src/store/storeToRefs.d.ts
794
+ type StoreToRefsResult<T$1 extends Record<string, any>> = { [K in keyof T$1]: T$1[K] extends ((...args: any[]) => any) ? T$1[K] : T$1[K] extends Ref<infer V> ? Ref<V> : Ref<T$1[K]> };
795
+ declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
796
+ //#endregion
797
+ export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, InternalRuntimeStateFields, MethodDefinitions, MiniProgramAdapter, MiniProgramAppOptions, MiniProgramBehaviorIdentifier, MiniProgramComponentBehaviorOptions, MiniProgramComponentOptions, MiniProgramComponentRawOptions, MiniProgramInstance, MiniProgramPageLifetimes, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, TriggerEventOptions, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, inject, injectGlobal, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markRaw, mergeModels, 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, setCurrentSetupContext, setDeepWatchStrategy, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, useAttrs, useModel, useSlots, watch, watchEffect };