wevu 1.0.6 → 1.0.7
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 +104 -73
- package/dist/index.d.mts +104 -73
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -925,76 +925,7 @@ type BindModelWithHelper<DefaultEvent extends string = 'input', DefaultValueProp
|
|
|
925
925
|
declare function useBindModel<DefaultEvent extends string = 'input', DefaultValueProp extends string = 'value'>(defaultOptions?: ModelBindingOptions<any, DefaultEvent, DefaultValueProp, any>): BindModelWithHelper<DefaultEvent, DefaultValueProp>;
|
|
926
926
|
declare function mergeModels<T$1>(a: T$1, b: T$1): T$1;
|
|
927
927
|
//#endregion
|
|
928
|
-
//#region src/
|
|
929
|
-
type MutationType = 'patch object' | 'patch function';
|
|
930
|
-
interface SubscriptionCallback<S = any> {
|
|
931
|
-
(mutation: {
|
|
932
|
-
type: MutationType;
|
|
933
|
-
storeId: string;
|
|
934
|
-
}, state: S): void;
|
|
935
|
-
}
|
|
936
|
-
interface ActionSubscriber<TStore = any> {
|
|
937
|
-
(context: {
|
|
938
|
-
name: string;
|
|
939
|
-
store: TStore;
|
|
940
|
-
args: any[];
|
|
941
|
-
after: (cb: (result: any) => void) => void;
|
|
942
|
-
onError: (cb: (error: any) => void) => void;
|
|
943
|
-
}): void;
|
|
944
|
-
}
|
|
945
|
-
interface StoreManager {
|
|
946
|
-
install: (app: any) => void;
|
|
947
|
-
_stores: Map<string, any>;
|
|
948
|
-
use: (plugin: (context: {
|
|
949
|
-
store: any;
|
|
950
|
-
}) => void) => StoreManager;
|
|
951
|
-
_plugins: Array<(context: {
|
|
952
|
-
store: any;
|
|
953
|
-
}) => void>;
|
|
954
|
-
}
|
|
955
|
-
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
956
|
-
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
957
|
-
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
958
|
-
state: () => S;
|
|
959
|
-
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
960
|
-
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
961
|
-
}
|
|
962
|
-
//#endregion
|
|
963
|
-
//#region src/store/define.d.ts
|
|
964
|
-
type SetupDefinition<T$1> = () => T$1;
|
|
965
|
-
declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
|
|
966
|
-
$id: string;
|
|
967
|
-
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
968
|
-
$subscribe: (cb: (mutation: {
|
|
969
|
-
type: MutationType;
|
|
970
|
-
storeId: string;
|
|
971
|
-
}, state: any) => void, opts?: {
|
|
972
|
-
detached?: boolean;
|
|
973
|
-
}) => () => void;
|
|
974
|
-
$onAction: (cb: (context: any) => void) => () => void;
|
|
975
|
-
};
|
|
976
|
-
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 & {
|
|
977
|
-
$id: string;
|
|
978
|
-
$state: S;
|
|
979
|
-
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
980
|
-
$reset: () => void;
|
|
981
|
-
$subscribe: (cb: (mutation: {
|
|
982
|
-
type: MutationType;
|
|
983
|
-
storeId: string;
|
|
984
|
-
}, state: S) => void, opts?: {
|
|
985
|
-
detached?: boolean;
|
|
986
|
-
}) => () => void;
|
|
987
|
-
$onAction: (cb: (context: any) => () => void) => () => void;
|
|
988
|
-
};
|
|
989
|
-
//#endregion
|
|
990
|
-
//#region src/store/manager.d.ts
|
|
991
|
-
declare function createStore(): StoreManager;
|
|
992
|
-
//#endregion
|
|
993
|
-
//#region src/store/storeToRefs.d.ts
|
|
994
|
-
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]> };
|
|
995
|
-
declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
|
|
996
|
-
//#endregion
|
|
997
|
-
//#region src/index.d.ts
|
|
928
|
+
//#region src/macros.d.ts
|
|
998
929
|
type Prettify<T$1> = { [K in keyof T$1]: T$1[K] } & {};
|
|
999
930
|
type LooseRequired<T$1> = { [P in keyof (T$1 & Required<T$1>)]: T$1[P] };
|
|
1000
931
|
type IfAny<T$1, Y, N> = 0 extends 1 & T$1 ? Y : N;
|
|
@@ -1124,20 +1055,51 @@ declare function defineEmits<T$1 extends (...args: any[]) => any>(): T$1;
|
|
|
1124
1055
|
* ```
|
|
1125
1056
|
*/
|
|
1126
1057
|
declare function defineExpose<T$1 extends Record<string, any> = Record<string, any>>(exposed?: T$1): void;
|
|
1058
|
+
type ScriptSetupDefineOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> = Omit<DefineComponentOptions<ComponentPropsOptions, D, C, M>, 'props' | 'options'> & {
|
|
1059
|
+
/**
|
|
1060
|
+
* props should be defined via defineProps().
|
|
1061
|
+
*/
|
|
1062
|
+
props?: never;
|
|
1063
|
+
/**
|
|
1064
|
+
* emits should be defined via defineEmits().
|
|
1065
|
+
*/
|
|
1066
|
+
emits?: never;
|
|
1067
|
+
/**
|
|
1068
|
+
* expose should be defined via defineExpose().
|
|
1069
|
+
*/
|
|
1070
|
+
expose?: never;
|
|
1071
|
+
/**
|
|
1072
|
+
* slots should be defined via defineSlots().
|
|
1073
|
+
*/
|
|
1074
|
+
slots?: never;
|
|
1075
|
+
/**
|
|
1076
|
+
* Mini-program Component options (multipleSlots/styleIsolation/etc).
|
|
1077
|
+
*/
|
|
1078
|
+
options?: WechatMiniprogram.Component.ComponentOptions;
|
|
1079
|
+
};
|
|
1127
1080
|
/**
|
|
1128
1081
|
* defineOptions 设置组件选项。
|
|
1129
|
-
*
|
|
1082
|
+
* 适合声明组件名、样式隔离等静态选项(仅 <script setup> 宏)。
|
|
1083
|
+
*
|
|
1084
|
+
* 仅用于无法通过 Composition API / 其他宏表达的选项,如:
|
|
1085
|
+
* - `name`
|
|
1086
|
+
* - `inheritAttrs`
|
|
1087
|
+
* - 小程序 `options`(multipleSlots/styleIsolation/etc)
|
|
1088
|
+
*
|
|
1089
|
+
* 注意:`props/emits/expose/slots` 应分别使用对应宏声明。
|
|
1130
1090
|
*
|
|
1131
1091
|
* @example
|
|
1132
1092
|
* ```ts
|
|
1133
1093
|
* defineOptions({
|
|
1134
1094
|
* name: 'EmptyState',
|
|
1135
1095
|
* inheritAttrs: false,
|
|
1136
|
-
*
|
|
1096
|
+
* options: {
|
|
1097
|
+
* multipleSlots: true,
|
|
1098
|
+
* },
|
|
1137
1099
|
* })
|
|
1138
1100
|
* ```
|
|
1139
1101
|
*/
|
|
1140
|
-
declare function defineOptions
|
|
1102
|
+
declare function defineOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options?: ScriptSetupDefineOptions<D, C, M>): void;
|
|
1141
1103
|
/**
|
|
1142
1104
|
* defineSlots 声明 slots 类型。
|
|
1143
1105
|
* 用于限定插槽名称与插槽参数结构。
|
|
@@ -1164,4 +1126,73 @@ declare function defineSlots<T$1 extends Record<string, any> = Record<string, an
|
|
|
1164
1126
|
*/
|
|
1165
1127
|
declare function defineModel<T$1 = any>(name?: string, options?: Record<string, any>): Ref<T$1 | undefined>;
|
|
1166
1128
|
//#endregion
|
|
1129
|
+
//#region src/store/types.d.ts
|
|
1130
|
+
type MutationType = 'patch object' | 'patch function';
|
|
1131
|
+
interface SubscriptionCallback<S = any> {
|
|
1132
|
+
(mutation: {
|
|
1133
|
+
type: MutationType;
|
|
1134
|
+
storeId: string;
|
|
1135
|
+
}, state: S): void;
|
|
1136
|
+
}
|
|
1137
|
+
interface ActionSubscriber<TStore = any> {
|
|
1138
|
+
(context: {
|
|
1139
|
+
name: string;
|
|
1140
|
+
store: TStore;
|
|
1141
|
+
args: any[];
|
|
1142
|
+
after: (cb: (result: any) => void) => void;
|
|
1143
|
+
onError: (cb: (error: any) => void) => void;
|
|
1144
|
+
}): void;
|
|
1145
|
+
}
|
|
1146
|
+
interface StoreManager {
|
|
1147
|
+
install: (app: any) => void;
|
|
1148
|
+
_stores: Map<string, any>;
|
|
1149
|
+
use: (plugin: (context: {
|
|
1150
|
+
store: any;
|
|
1151
|
+
}) => void) => StoreManager;
|
|
1152
|
+
_plugins: Array<(context: {
|
|
1153
|
+
store: any;
|
|
1154
|
+
}) => void>;
|
|
1155
|
+
}
|
|
1156
|
+
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
1157
|
+
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
1158
|
+
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
1159
|
+
state: () => S;
|
|
1160
|
+
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
1161
|
+
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
1162
|
+
}
|
|
1163
|
+
//#endregion
|
|
1164
|
+
//#region src/store/define.d.ts
|
|
1165
|
+
type SetupDefinition<T$1> = () => T$1;
|
|
1166
|
+
declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
|
|
1167
|
+
$id: string;
|
|
1168
|
+
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
1169
|
+
$subscribe: (cb: (mutation: {
|
|
1170
|
+
type: MutationType;
|
|
1171
|
+
storeId: string;
|
|
1172
|
+
}, state: any) => void, opts?: {
|
|
1173
|
+
detached?: boolean;
|
|
1174
|
+
}) => () => void;
|
|
1175
|
+
$onAction: (cb: (context: any) => void) => () => void;
|
|
1176
|
+
};
|
|
1177
|
+
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 & {
|
|
1178
|
+
$id: string;
|
|
1179
|
+
$state: S;
|
|
1180
|
+
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
1181
|
+
$reset: () => void;
|
|
1182
|
+
$subscribe: (cb: (mutation: {
|
|
1183
|
+
type: MutationType;
|
|
1184
|
+
storeId: string;
|
|
1185
|
+
}, state: S) => void, opts?: {
|
|
1186
|
+
detached?: boolean;
|
|
1187
|
+
}) => () => void;
|
|
1188
|
+
$onAction: (cb: (context: any) => () => void) => () => void;
|
|
1189
|
+
};
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/store/manager.d.ts
|
|
1192
|
+
declare function createStore(): StoreManager;
|
|
1193
|
+
//#endregion
|
|
1194
|
+
//#region src/store/storeToRefs.d.ts
|
|
1195
|
+
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]> };
|
|
1196
|
+
declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
|
|
1197
|
+
//#endregion
|
|
1167
1198
|
export { ActionSubscriber, type AllowedComponentProps, type AppConfig, type ComponentCustomProps, ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, type CreateAppOptions, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, DefineStoreOptions, EffectScope, EmitsOptions, type ExtractComputed, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, type MethodDefinitions, type MiniProgramAdapter, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type MiniProgramComponentBehaviorOptions, type MiniProgramComponentOptions, type MiniProgramComponentRawOptions, type MiniProgramInstance, type MiniProgramPageLifetimes, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, type MutationKind, type MutationOp, type MutationRecord, MutationType, type ObjectDirective, type PageFeatures, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, Ref, type RuntimeApp, type RuntimeInstance, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupFunction, type ShallowUnwrapRef, StoreManager, SubscriptionCallback, ToRefs, type TriggerEventOptions, type VNode, type VNodeProps, WatchOptions, WatchStopHandle, WevuDefaults, type WevuPlugin, WritableComputedOptions, WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getReactiveVersion, inject, injectGlobal, isNoSetData, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, removeMutationRecorder, resetWevuDefaults, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setWevuDefaults, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, useAttrs, useBindModel, useModel, useSlots, watch, watchEffect, withDefaults };
|
package/dist/index.d.mts
CHANGED
|
@@ -925,76 +925,7 @@ type BindModelWithHelper<DefaultEvent extends string = 'input', DefaultValueProp
|
|
|
925
925
|
declare function useBindModel<DefaultEvent extends string = 'input', DefaultValueProp extends string = 'value'>(defaultOptions?: ModelBindingOptions<any, DefaultEvent, DefaultValueProp, any>): BindModelWithHelper<DefaultEvent, DefaultValueProp>;
|
|
926
926
|
declare function mergeModels<T$1>(a: T$1, b: T$1): T$1;
|
|
927
927
|
//#endregion
|
|
928
|
-
//#region src/
|
|
929
|
-
type MutationType = 'patch object' | 'patch function';
|
|
930
|
-
interface SubscriptionCallback<S = any> {
|
|
931
|
-
(mutation: {
|
|
932
|
-
type: MutationType;
|
|
933
|
-
storeId: string;
|
|
934
|
-
}, state: S): void;
|
|
935
|
-
}
|
|
936
|
-
interface ActionSubscriber<TStore = any> {
|
|
937
|
-
(context: {
|
|
938
|
-
name: string;
|
|
939
|
-
store: TStore;
|
|
940
|
-
args: any[];
|
|
941
|
-
after: (cb: (result: any) => void) => void;
|
|
942
|
-
onError: (cb: (error: any) => void) => void;
|
|
943
|
-
}): void;
|
|
944
|
-
}
|
|
945
|
-
interface StoreManager {
|
|
946
|
-
install: (app: any) => void;
|
|
947
|
-
_stores: Map<string, any>;
|
|
948
|
-
use: (plugin: (context: {
|
|
949
|
-
store: any;
|
|
950
|
-
}) => void) => StoreManager;
|
|
951
|
-
_plugins: Array<(context: {
|
|
952
|
-
store: any;
|
|
953
|
-
}) => void>;
|
|
954
|
-
}
|
|
955
|
-
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
956
|
-
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
957
|
-
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
958
|
-
state: () => S;
|
|
959
|
-
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
960
|
-
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
961
|
-
}
|
|
962
|
-
//#endregion
|
|
963
|
-
//#region src/store/define.d.ts
|
|
964
|
-
type SetupDefinition<T$1> = () => T$1;
|
|
965
|
-
declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
|
|
966
|
-
$id: string;
|
|
967
|
-
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
968
|
-
$subscribe: (cb: (mutation: {
|
|
969
|
-
type: MutationType;
|
|
970
|
-
storeId: string;
|
|
971
|
-
}, state: any) => void, opts?: {
|
|
972
|
-
detached?: boolean;
|
|
973
|
-
}) => () => void;
|
|
974
|
-
$onAction: (cb: (context: any) => void) => () => void;
|
|
975
|
-
};
|
|
976
|
-
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 & {
|
|
977
|
-
$id: string;
|
|
978
|
-
$state: S;
|
|
979
|
-
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
980
|
-
$reset: () => void;
|
|
981
|
-
$subscribe: (cb: (mutation: {
|
|
982
|
-
type: MutationType;
|
|
983
|
-
storeId: string;
|
|
984
|
-
}, state: S) => void, opts?: {
|
|
985
|
-
detached?: boolean;
|
|
986
|
-
}) => () => void;
|
|
987
|
-
$onAction: (cb: (context: any) => () => void) => () => void;
|
|
988
|
-
};
|
|
989
|
-
//#endregion
|
|
990
|
-
//#region src/store/manager.d.ts
|
|
991
|
-
declare function createStore(): StoreManager;
|
|
992
|
-
//#endregion
|
|
993
|
-
//#region src/store/storeToRefs.d.ts
|
|
994
|
-
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]> };
|
|
995
|
-
declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
|
|
996
|
-
//#endregion
|
|
997
|
-
//#region src/index.d.ts
|
|
928
|
+
//#region src/macros.d.ts
|
|
998
929
|
type Prettify<T$1> = { [K in keyof T$1]: T$1[K] } & {};
|
|
999
930
|
type LooseRequired<T$1> = { [P in keyof (T$1 & Required<T$1>)]: T$1[P] };
|
|
1000
931
|
type IfAny<T$1, Y, N> = 0 extends 1 & T$1 ? Y : N;
|
|
@@ -1124,20 +1055,51 @@ declare function defineEmits<T$1 extends (...args: any[]) => any>(): T$1;
|
|
|
1124
1055
|
* ```
|
|
1125
1056
|
*/
|
|
1126
1057
|
declare function defineExpose<T$1 extends Record<string, any> = Record<string, any>>(exposed?: T$1): void;
|
|
1058
|
+
type ScriptSetupDefineOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> = Omit<DefineComponentOptions<ComponentPropsOptions, D, C, M>, 'props' | 'options'> & {
|
|
1059
|
+
/**
|
|
1060
|
+
* props should be defined via defineProps().
|
|
1061
|
+
*/
|
|
1062
|
+
props?: never;
|
|
1063
|
+
/**
|
|
1064
|
+
* emits should be defined via defineEmits().
|
|
1065
|
+
*/
|
|
1066
|
+
emits?: never;
|
|
1067
|
+
/**
|
|
1068
|
+
* expose should be defined via defineExpose().
|
|
1069
|
+
*/
|
|
1070
|
+
expose?: never;
|
|
1071
|
+
/**
|
|
1072
|
+
* slots should be defined via defineSlots().
|
|
1073
|
+
*/
|
|
1074
|
+
slots?: never;
|
|
1075
|
+
/**
|
|
1076
|
+
* Mini-program Component options (multipleSlots/styleIsolation/etc).
|
|
1077
|
+
*/
|
|
1078
|
+
options?: WechatMiniprogram.Component.ComponentOptions;
|
|
1079
|
+
};
|
|
1127
1080
|
/**
|
|
1128
1081
|
* defineOptions 设置组件选项。
|
|
1129
|
-
*
|
|
1082
|
+
* 适合声明组件名、样式隔离等静态选项(仅 <script setup> 宏)。
|
|
1083
|
+
*
|
|
1084
|
+
* 仅用于无法通过 Composition API / 其他宏表达的选项,如:
|
|
1085
|
+
* - `name`
|
|
1086
|
+
* - `inheritAttrs`
|
|
1087
|
+
* - 小程序 `options`(multipleSlots/styleIsolation/etc)
|
|
1088
|
+
*
|
|
1089
|
+
* 注意:`props/emits/expose/slots` 应分别使用对应宏声明。
|
|
1130
1090
|
*
|
|
1131
1091
|
* @example
|
|
1132
1092
|
* ```ts
|
|
1133
1093
|
* defineOptions({
|
|
1134
1094
|
* name: 'EmptyState',
|
|
1135
1095
|
* inheritAttrs: false,
|
|
1136
|
-
*
|
|
1096
|
+
* options: {
|
|
1097
|
+
* multipleSlots: true,
|
|
1098
|
+
* },
|
|
1137
1099
|
* })
|
|
1138
1100
|
* ```
|
|
1139
1101
|
*/
|
|
1140
|
-
declare function defineOptions
|
|
1102
|
+
declare function defineOptions<D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options?: ScriptSetupDefineOptions<D, C, M>): void;
|
|
1141
1103
|
/**
|
|
1142
1104
|
* defineSlots 声明 slots 类型。
|
|
1143
1105
|
* 用于限定插槽名称与插槽参数结构。
|
|
@@ -1164,4 +1126,73 @@ declare function defineSlots<T$1 extends Record<string, any> = Record<string, an
|
|
|
1164
1126
|
*/
|
|
1165
1127
|
declare function defineModel<T$1 = any>(name?: string, options?: Record<string, any>): Ref<T$1 | undefined>;
|
|
1166
1128
|
//#endregion
|
|
1129
|
+
//#region src/store/types.d.ts
|
|
1130
|
+
type MutationType = 'patch object' | 'patch function';
|
|
1131
|
+
interface SubscriptionCallback<S = any> {
|
|
1132
|
+
(mutation: {
|
|
1133
|
+
type: MutationType;
|
|
1134
|
+
storeId: string;
|
|
1135
|
+
}, state: S): void;
|
|
1136
|
+
}
|
|
1137
|
+
interface ActionSubscriber<TStore = any> {
|
|
1138
|
+
(context: {
|
|
1139
|
+
name: string;
|
|
1140
|
+
store: TStore;
|
|
1141
|
+
args: any[];
|
|
1142
|
+
after: (cb: (result: any) => void) => void;
|
|
1143
|
+
onError: (cb: (error: any) => void) => void;
|
|
1144
|
+
}): void;
|
|
1145
|
+
}
|
|
1146
|
+
interface StoreManager {
|
|
1147
|
+
install: (app: any) => void;
|
|
1148
|
+
_stores: Map<string, any>;
|
|
1149
|
+
use: (plugin: (context: {
|
|
1150
|
+
store: any;
|
|
1151
|
+
}) => void) => StoreManager;
|
|
1152
|
+
_plugins: Array<(context: {
|
|
1153
|
+
store: any;
|
|
1154
|
+
}) => void>;
|
|
1155
|
+
}
|
|
1156
|
+
type GetterTree<S extends Record<string, any>> = Record<string, (state: S) => any>;
|
|
1157
|
+
type StoreGetters<G extends GetterTree<any>> = { [K in keyof G]: G[K] extends ((...args: any[]) => infer R) ? R : never };
|
|
1158
|
+
interface DefineStoreOptions<S extends Record<string, any>, G extends GetterTree<S>, A extends Record<string, any>> {
|
|
1159
|
+
state: () => S;
|
|
1160
|
+
getters?: G & Record<string, (state: S) => any> & ThisType<S & StoreGetters<G> & A>;
|
|
1161
|
+
actions?: A & ThisType<S & StoreGetters<G> & A>;
|
|
1162
|
+
}
|
|
1163
|
+
//#endregion
|
|
1164
|
+
//#region src/store/define.d.ts
|
|
1165
|
+
type SetupDefinition<T$1> = () => T$1;
|
|
1166
|
+
declare function defineStore<T$1 extends Record<string, any>>(id: string, setup: SetupDefinition<T$1>): () => T$1 & {
|
|
1167
|
+
$id: string;
|
|
1168
|
+
$patch: (patch: Record<string, any> | ((state: any) => void)) => void;
|
|
1169
|
+
$subscribe: (cb: (mutation: {
|
|
1170
|
+
type: MutationType;
|
|
1171
|
+
storeId: string;
|
|
1172
|
+
}, state: any) => void, opts?: {
|
|
1173
|
+
detached?: boolean;
|
|
1174
|
+
}) => () => void;
|
|
1175
|
+
$onAction: (cb: (context: any) => void) => () => void;
|
|
1176
|
+
};
|
|
1177
|
+
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 & {
|
|
1178
|
+
$id: string;
|
|
1179
|
+
$state: S;
|
|
1180
|
+
$patch: (patch: Partial<S> | ((state: S) => void)) => void;
|
|
1181
|
+
$reset: () => void;
|
|
1182
|
+
$subscribe: (cb: (mutation: {
|
|
1183
|
+
type: MutationType;
|
|
1184
|
+
storeId: string;
|
|
1185
|
+
}, state: S) => void, opts?: {
|
|
1186
|
+
detached?: boolean;
|
|
1187
|
+
}) => () => void;
|
|
1188
|
+
$onAction: (cb: (context: any) => () => void) => () => void;
|
|
1189
|
+
};
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/store/manager.d.ts
|
|
1192
|
+
declare function createStore(): StoreManager;
|
|
1193
|
+
//#endregion
|
|
1194
|
+
//#region src/store/storeToRefs.d.ts
|
|
1195
|
+
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]> };
|
|
1196
|
+
declare function storeToRefs<T$1 extends Record<string, any>>(store: T$1): StoreToRefsResult<T$1>;
|
|
1197
|
+
//#endregion
|
|
1167
1198
|
export { ActionSubscriber, type AllowedComponentProps, type AppConfig, type ComponentCustomProps, ComponentDefinition, type ComponentOptionsMixin, type ComponentPropsOptions, type ComponentPublicInstance, type ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, type CreateAppOptions, type DefineAppOptions, type DefineComponent, type DefineComponentOptions, DefineStoreOptions, EffectScope, EmitsOptions, type ExtractComputed, type ExtractMethods, type ExtractPropTypes, type ExtractPublicPropTypes, GlobalComponents, GlobalDirectives, type InferPropType, type InferProps, type InternalRuntimeState, type InternalRuntimeStateFields, type MethodDefinitions, type MiniProgramAdapter, type MiniProgramAppOptions, type MiniProgramBehaviorIdentifier, type MiniProgramComponentBehaviorOptions, type MiniProgramComponentOptions, type MiniProgramComponentRawOptions, type MiniProgramInstance, type MiniProgramPageLifetimes, type ModelBinding, type ModelBindingOptions, type ModelBindingPayload, type MutationKind, type MutationOp, type MutationRecord, MutationType, type ObjectDirective, type PageFeatures, type PrelinkReactiveTreeOptions, type PropConstructor, type PropOptions, type PropType, type PublicProps, Ref, type RuntimeApp, type RuntimeInstance, type SetDataDebugInfo, type SetDataSnapshotOptions, type SetupContext, type SetupFunction, type ShallowUnwrapRef, StoreManager, SubscriptionCallback, ToRefs, type TriggerEventOptions, type VNode, type VNodeProps, WatchOptions, WatchStopHandle, WevuDefaults, type WevuPlugin, WritableComputedOptions, WritableComputedRef, addMutationRecorder, batch, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, createWevuScopedSlotComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, defineStore, effect, effectScope, endBatch, getCurrentInstance, getCurrentScope, getCurrentSetupContext, getDeepWatchStrategy, getReactiveVersion, inject, injectGlobal, isNoSetData, isRaw, isReactive, isRef, isShallowReactive, isShallowRef, markNoSetData, markRaw, mergeModels, mountRuntimeInstance, nextTick, normalizeClass, normalizeStyle, onActivated, onAddToFavorites, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onScopeDispose, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, prelinkReactiveTree, provide, provideGlobal, reactive, readonly, ref, registerApp, registerComponent, removeMutationRecorder, resetWevuDefaults, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setDeepWatchStrategy, setWevuDefaults, shallowReactive, shallowRef, startBatch, stop, storeToRefs, teardownRuntimeInstance, toRaw, toRef, toRefs, touchReactive, traverse, triggerRef, unref, useAttrs, useBindModel, useModel, useSlots, watch, watchEffect, withDefaults };
|