wevu 1.0.0-alpha.3 → 1.0.0-alpha.5

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,11 @@
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";
1
+ import { Ref as Ref$1 } from "@vue/reactivity";
2
2
 
3
+ //#region src/reactivity/ref.d.ts
4
+ type Ref<T$1 = any, S = T$1> = Ref$1<T$1, S>;
5
+ declare function isRef(value: unknown): value is Ref<any>;
6
+ declare function ref<T$1>(value: T$1): Ref<T$1>;
7
+ declare function unref<T$1>(value: T$1 | Ref<T$1>): T$1;
8
+ //#endregion
3
9
  //#region src/reactivity/computed.d.ts
4
10
  type ComputedGetter<T$1> = () => T$1;
5
11
  type ComputedSetter<T$1> = (value: T$1) => void;
@@ -405,6 +411,10 @@ interface SetupContext<D extends object, C extends ComputedDefinitions, M extend
405
411
  * Vue 3 对齐:attrs(小程序场景兜底为空对象)
406
412
  */
407
413
  attrs: Record<string, any>;
414
+ /**
415
+ * Vue 3 对齐:slots(小程序场景兜底为空对象)
416
+ */
417
+ slots: Record<string, any>;
408
418
  }
409
419
  type TriggerEventOptions = WechatMiniprogram.Component.TriggerEventOption;
410
420
  interface InternalRuntimeStateFields {
@@ -578,6 +588,8 @@ declare function createWevuComponent<D extends object, C extends ComputedDefinit
578
588
  //#region src/runtime/hooks.d.ts
579
589
  declare function getCurrentInstance<T$1 extends InternalRuntimeState = InternalRuntimeState>(): T$1 | undefined;
580
590
  declare function setCurrentInstance(inst: InternalRuntimeState | undefined): void;
591
+ declare function getCurrentSetupContext<T$1 = any>(): T$1 | undefined;
592
+ declare function setCurrentSetupContext(ctx: any | undefined): void;
581
593
  declare function callHookList(target: InternalRuntimeState, name: string, args?: any[]): void;
582
594
  declare function callHookReturn(target: InternalRuntimeState, name: string, args?: any[]): any;
583
595
  declare function onAppShow(handler: (options: WechatMiniprogram.App.LaunchShowOption) => void): void;
@@ -705,4 +717,79 @@ declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
705
717
  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
718
  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
719
  //#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 };
720
+ //#region src/runtime/vueCompat.d.ts
721
+ declare function useAttrs(): Record<string, any>;
722
+ declare function useSlots(): Record<string, any>;
723
+ declare function useModel<T$1 = any>(props: Record<string, any>, name: string): Ref<T$1>;
724
+ declare function mergeModels<T$1>(a: T$1, b: T$1): T$1;
725
+ //#endregion
726
+ //#region src/store/types.d.ts
727
+ type MutationType = 'patch object' | 'patch function';
728
+ interface SubscriptionCallback<S = any> {
729
+ (mutation: {
730
+ type: MutationType;
731
+ storeId: string;
732
+ }, state: S): void;
733
+ }
734
+ interface ActionSubscriber<TStore = any> {
735
+ (context: {
736
+ name: string;
737
+ store: TStore;
738
+ args: any[];
739
+ after: (cb: (result: any) => void) => void;
740
+ onError: (cb: (error: any) => void) => void;
741
+ }): void;
742
+ }
743
+ interface StoreManager {
744
+ install: (app: any) => void;
745
+ _stores: Map<string, any>;
746
+ use: (plugin: (context: {
747
+ store: any;
748
+ }) => void) => StoreManager;
749
+ _plugins: Array<(context: {
750
+ store: any;
751
+ }) => void>;
752
+ }
753
+ type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
754
+ type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
755
+ interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
756
+ state: () => S;
757
+ getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
758
+ actions?: A & ThisType<S & StoreGetters<G> & A>;
759
+ }
760
+ //#endregion
761
+ //#region src/store/define.d.ts
762
+ type SetupDefinition<T$1> = () => T$1;
763
+ declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
764
+ $id: string;
765
+ $patch: (patch: Record<string, any> | ((state: any) => void)) => void;
766
+ $subscribe: (cb: (mutation: {
767
+ type: MutationType;
768
+ storeId: string;
769
+ }, state: any) => void, opts?: {
770
+ detached?: boolean;
771
+ }) => () => void;
772
+ $onAction: (cb: (context: any) => void) => () => void;
773
+ };
774
+ 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 & {
775
+ $id: string;
776
+ $state: S;
777
+ $patch: (patch: Partial<S> | ((state: S) => void)) => void;
778
+ $reset: () => void;
779
+ $subscribe: (cb: (mutation: {
780
+ type: MutationType;
781
+ storeId: string;
782
+ }, state: S) => void, opts?: {
783
+ detached?: boolean;
784
+ }) => () => void;
785
+ $onAction: (cb: (context: any) => () => void) => () => void;
786
+ };
787
+ //#endregion
788
+ //#region src/store/manager.d.ts
789
+ declare function createStore(): StoreManager;
790
+ //#endregion
791
+ //#region src/store/storeToRefs.d.ts
792
+ 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]> };
793
+ declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
794
+ //#endregion
795
+ 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,11 @@
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";
1
+ import { Ref as Ref$1 } from "@vue/reactivity";
2
2
 
3
+ //#region src/reactivity/ref.d.ts
4
+ type Ref<T$1 = any, S = T$1> = Ref$1<T$1, S>;
5
+ declare function isRef(value: unknown): value is Ref<any>;
6
+ declare function ref<T$1>(value: T$1): Ref<T$1>;
7
+ declare function unref<T$1>(value: T$1 | Ref<T$1>): T$1;
8
+ //#endregion
3
9
  //#region src/reactivity/computed.d.ts
4
10
  type ComputedGetter<T$1> = () => T$1;
5
11
  type ComputedSetter<T$1> = (value: T$1) => void;
@@ -405,6 +411,10 @@ interface SetupContext<D extends object, C extends ComputedDefinitions, M extend
405
411
  * Vue 3 对齐:attrs(小程序场景兜底为空对象)
406
412
  */
407
413
  attrs: Record<string, any>;
414
+ /**
415
+ * Vue 3 对齐:slots(小程序场景兜底为空对象)
416
+ */
417
+ slots: Record<string, any>;
408
418
  }
409
419
  type TriggerEventOptions = WechatMiniprogram.Component.TriggerEventOption;
410
420
  interface InternalRuntimeStateFields {
@@ -578,6 +588,8 @@ declare function createWevuComponent<D extends object, C extends ComputedDefinit
578
588
  //#region src/runtime/hooks.d.ts
579
589
  declare function getCurrentInstance<T$1 extends InternalRuntimeState = InternalRuntimeState>(): T$1 | undefined;
580
590
  declare function setCurrentInstance(inst: InternalRuntimeState | undefined): void;
591
+ declare function getCurrentSetupContext<T$1 = any>(): T$1 | undefined;
592
+ declare function setCurrentSetupContext(ctx: any | undefined): void;
581
593
  declare function callHookList(target: InternalRuntimeState, name: string, args?: any[]): void;
582
594
  declare function callHookReturn(target: InternalRuntimeState, name: string, args?: any[]): any;
583
595
  declare function onAppShow(handler: (options: WechatMiniprogram.App.LaunchShowOption) => void): void;
@@ -705,4 +717,79 @@ declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
705
717
  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
718
  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
719
  //#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 };
720
+ //#region src/runtime/vueCompat.d.ts
721
+ declare function useAttrs(): Record<string, any>;
722
+ declare function useSlots(): Record<string, any>;
723
+ declare function useModel<T$1 = any>(props: Record<string, any>, name: string): Ref<T$1>;
724
+ declare function mergeModels<T$1>(a: T$1, b: T$1): T$1;
725
+ //#endregion
726
+ //#region src/store/types.d.ts
727
+ type MutationType = 'patch object' | 'patch function';
728
+ interface SubscriptionCallback<S = any> {
729
+ (mutation: {
730
+ type: MutationType;
731
+ storeId: string;
732
+ }, state: S): void;
733
+ }
734
+ interface ActionSubscriber<TStore = any> {
735
+ (context: {
736
+ name: string;
737
+ store: TStore;
738
+ args: any[];
739
+ after: (cb: (result: any) => void) => void;
740
+ onError: (cb: (error: any) => void) => void;
741
+ }): void;
742
+ }
743
+ interface StoreManager {
744
+ install: (app: any) => void;
745
+ _stores: Map<string, any>;
746
+ use: (plugin: (context: {
747
+ store: any;
748
+ }) => void) => StoreManager;
749
+ _plugins: Array<(context: {
750
+ store: any;
751
+ }) => void>;
752
+ }
753
+ type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
754
+ type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
755
+ interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
756
+ state: () => S;
757
+ getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
758
+ actions?: A & ThisType<S & StoreGetters<G> & A>;
759
+ }
760
+ //#endregion
761
+ //#region src/store/define.d.ts
762
+ type SetupDefinition<T$1> = () => T$1;
763
+ declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
764
+ $id: string;
765
+ $patch: (patch: Record<string, any> | ((state: any) => void)) => void;
766
+ $subscribe: (cb: (mutation: {
767
+ type: MutationType;
768
+ storeId: string;
769
+ }, state: any) => void, opts?: {
770
+ detached?: boolean;
771
+ }) => () => void;
772
+ $onAction: (cb: (context: any) => void) => () => void;
773
+ };
774
+ 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 & {
775
+ $id: string;
776
+ $state: S;
777
+ $patch: (patch: Partial<S> | ((state: S) => void)) => void;
778
+ $reset: () => void;
779
+ $subscribe: (cb: (mutation: {
780
+ type: MutationType;
781
+ storeId: string;
782
+ }, state: S) => void, opts?: {
783
+ detached?: boolean;
784
+ }) => () => void;
785
+ $onAction: (cb: (context: any) => () => void) => () => void;
786
+ };
787
+ //#endregion
788
+ //#region src/store/manager.d.ts
789
+ declare function createStore(): StoreManager;
790
+ //#endregion
791
+ //#region src/store/storeToRefs.d.ts
792
+ 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]> };
793
+ declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
794
+ //#endregion
795
+ 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 };