wevu 0.0.2-alpha.0 → 1.0.0-alpha.2
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 +35 -37
- package/dist/{index-D1r6nN-t.d.cts → index-0dF4y5p6.d.mts} +4 -2
- package/dist/{index-DHBSC7mS.d.mts → index-DVEFI-Uo.d.cts} +4 -2
- package/dist/index.cjs +176 -145
- package/dist/index.d.cts +35 -24
- package/dist/index.d.mts +35 -24
- package/dist/index.mjs +171 -144
- package/dist/{store-BcU7YVhB.mjs → store-2q4qcdBi.mjs} +100 -12
- package/dist/{store-Cmw9vWBT.cjs → store-D0GD8ulz.cjs} +135 -11
- 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 +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
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-
|
|
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-DVEFI-Uo.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/reactivity/computed.d.ts
|
|
4
4
|
type ComputedGetter<T$1> = () => T$1;
|
|
5
5
|
type ComputedSetter<T$1> = (value: T$1) => void;
|
|
6
|
-
interface
|
|
6
|
+
interface BaseComputedRef<T$1, S = T$1> extends Ref<T$1, S> {
|
|
7
|
+
[key: symbol]: any;
|
|
8
|
+
}
|
|
9
|
+
interface ComputedRef<T$1 = any> extends BaseComputedRef<T$1> {
|
|
7
10
|
readonly value: T$1;
|
|
8
11
|
}
|
|
9
|
-
interface WritableComputedRef<T$1> {
|
|
12
|
+
interface WritableComputedRef<T$1, S = T$1> extends BaseComputedRef<T$1, S> {
|
|
10
13
|
value: T$1;
|
|
11
14
|
}
|
|
12
15
|
interface WritableComputedOptions<T$1> {
|
|
@@ -27,9 +30,23 @@ interface ReactiveEffect<T$1 = any> {
|
|
|
27
30
|
deps: Dep[];
|
|
28
31
|
scheduler?: EffectScheduler;
|
|
29
32
|
active: boolean;
|
|
33
|
+
_running: boolean;
|
|
30
34
|
_fn: () => T$1;
|
|
31
35
|
onStop?: () => void;
|
|
32
36
|
}
|
|
37
|
+
declare function startBatch(): void;
|
|
38
|
+
declare function endBatch(): void;
|
|
39
|
+
declare function batch<T$1>(fn: () => T$1): T$1;
|
|
40
|
+
interface EffectScope {
|
|
41
|
+
active: boolean;
|
|
42
|
+
effects: ReactiveEffect[];
|
|
43
|
+
cleanups: (() => void)[];
|
|
44
|
+
run: <T$1>(fn: () => T$1) => T$1 | undefined;
|
|
45
|
+
stop: () => void;
|
|
46
|
+
}
|
|
47
|
+
declare function effectScope(detached?: boolean): EffectScope;
|
|
48
|
+
declare function getCurrentScope(): EffectScope | undefined;
|
|
49
|
+
declare function onScopeDispose(fn: () => void): void;
|
|
33
50
|
interface EffectOptions {
|
|
34
51
|
scheduler?: EffectScheduler;
|
|
35
52
|
lazy?: boolean;
|
|
@@ -328,6 +345,11 @@ interface InternalRuntimeState {
|
|
|
328
345
|
__wevuExposed?: Record<string, any>;
|
|
329
346
|
}
|
|
330
347
|
interface DefineComponentOptions<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends Omit<CreateAppOptions<D, C, M>, 'setup'> {
|
|
348
|
+
/**
|
|
349
|
+
* Page-only feature gates (e.g. scroll/share hooks).
|
|
350
|
+
* Only takes effect on page entries.
|
|
351
|
+
*/
|
|
352
|
+
features?: PageFeatures;
|
|
331
353
|
/**
|
|
332
354
|
* Vue-like props definition (will be normalized to mini-program `properties`)
|
|
333
355
|
*/
|
|
@@ -380,10 +402,13 @@ interface ComponentDefinition<D extends object, C extends ComputedDefinitions, M
|
|
|
380
402
|
watch: Record<string, any> | undefined;
|
|
381
403
|
setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'];
|
|
382
404
|
mpOptions: Record<string, any>;
|
|
405
|
+
features?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['features'];
|
|
383
406
|
};
|
|
384
407
|
}
|
|
385
408
|
/**
|
|
386
|
-
* 按 Vue 3
|
|
409
|
+
* 按 Vue 3 风格定义一个小程序组件/页面。
|
|
410
|
+
*
|
|
411
|
+
* - 统一注册为 `Component()`
|
|
387
412
|
*
|
|
388
413
|
* @param options 组件定义项
|
|
389
414
|
* @returns 可手动注册的组件定义
|
|
@@ -397,31 +422,18 @@ interface ComponentDefinition<D extends object, C extends ComputedDefinitions, M
|
|
|
397
422
|
* }
|
|
398
423
|
* })
|
|
399
424
|
* ```
|
|
400
|
-
*/
|
|
401
|
-
declare function defineComponent<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options: DefineComponentOptions<P$1, D, C, M>): ComponentDefinition<D, C, M>;
|
|
402
|
-
/**
|
|
403
|
-
* 按 Vue 3 风格定义一个小程序页面
|
|
404
|
-
*
|
|
405
|
-
* @param options 页面定义
|
|
406
|
-
* @param features 页面特性(例如 listenPageScroll、enableShareAppMessage 等)
|
|
407
|
-
* @returns 页面定义
|
|
408
425
|
*
|
|
409
426
|
* @example
|
|
410
427
|
* ```ts
|
|
411
|
-
*
|
|
412
|
-
*
|
|
428
|
+
* defineComponent({
|
|
429
|
+
* features: { listenPageScroll: true },
|
|
413
430
|
* setup() {
|
|
414
|
-
*
|
|
415
|
-
* onMounted(() => console.log('page mounted'))
|
|
416
|
-
* return { count }
|
|
431
|
+
* onPageScroll(() => {})
|
|
417
432
|
* }
|
|
418
|
-
* }, {
|
|
419
|
-
* listenPageScroll: true,
|
|
420
|
-
* enableShareAppMessage: true
|
|
421
433
|
* })
|
|
422
434
|
* ```
|
|
423
435
|
*/
|
|
424
|
-
declare function
|
|
436
|
+
declare function defineComponent<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options: DefineComponentOptions<P$1, D, C, M>): ComponentDefinition<D, C, M>;
|
|
425
437
|
/**
|
|
426
438
|
* 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。
|
|
427
439
|
*
|
|
@@ -551,7 +563,6 @@ declare function runSetupFunction(setup: ((...args: any[]) => any) | undefined,
|
|
|
551
563
|
declare function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(target: InternalRuntimeState, runtimeApp: RuntimeApp<D, C, M>, watchMap: WatchMap | undefined, setup?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']): RuntimeInstance<D, C, M>;
|
|
552
564
|
declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
|
|
553
565
|
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: Record<string, any>): void;
|
|
554
|
-
declare function
|
|
555
|
-
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: Record<string, any>): void;
|
|
566
|
+
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: Record<string, any>, features?: PageFeatures): void;
|
|
556
567
|
//#endregion
|
|
557
|
-
export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, MethodDefinitions, MiniProgramAdapter, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent,
|
|
568
|
+
export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, MethodDefinitions, MiniProgramAdapter, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, 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, 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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
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-
|
|
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-0dF4y5p6.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/reactivity/computed.d.ts
|
|
4
4
|
type ComputedGetter<T$1> = () => T$1;
|
|
5
5
|
type ComputedSetter<T$1> = (value: T$1) => void;
|
|
6
|
-
interface
|
|
6
|
+
interface BaseComputedRef<T$1, S = T$1> extends Ref<T$1, S> {
|
|
7
|
+
[key: symbol]: any;
|
|
8
|
+
}
|
|
9
|
+
interface ComputedRef<T$1 = any> extends BaseComputedRef<T$1> {
|
|
7
10
|
readonly value: T$1;
|
|
8
11
|
}
|
|
9
|
-
interface WritableComputedRef<T$1> {
|
|
12
|
+
interface WritableComputedRef<T$1, S = T$1> extends BaseComputedRef<T$1, S> {
|
|
10
13
|
value: T$1;
|
|
11
14
|
}
|
|
12
15
|
interface WritableComputedOptions<T$1> {
|
|
@@ -27,9 +30,23 @@ interface ReactiveEffect<T$1 = any> {
|
|
|
27
30
|
deps: Dep[];
|
|
28
31
|
scheduler?: EffectScheduler;
|
|
29
32
|
active: boolean;
|
|
33
|
+
_running: boolean;
|
|
30
34
|
_fn: () => T$1;
|
|
31
35
|
onStop?: () => void;
|
|
32
36
|
}
|
|
37
|
+
declare function startBatch(): void;
|
|
38
|
+
declare function endBatch(): void;
|
|
39
|
+
declare function batch<T$1>(fn: () => T$1): T$1;
|
|
40
|
+
interface EffectScope {
|
|
41
|
+
active: boolean;
|
|
42
|
+
effects: ReactiveEffect[];
|
|
43
|
+
cleanups: (() => void)[];
|
|
44
|
+
run: <T$1>(fn: () => T$1) => T$1 | undefined;
|
|
45
|
+
stop: () => void;
|
|
46
|
+
}
|
|
47
|
+
declare function effectScope(detached?: boolean): EffectScope;
|
|
48
|
+
declare function getCurrentScope(): EffectScope | undefined;
|
|
49
|
+
declare function onScopeDispose(fn: () => void): void;
|
|
33
50
|
interface EffectOptions {
|
|
34
51
|
scheduler?: EffectScheduler;
|
|
35
52
|
lazy?: boolean;
|
|
@@ -328,6 +345,11 @@ interface InternalRuntimeState {
|
|
|
328
345
|
__wevuExposed?: Record<string, any>;
|
|
329
346
|
}
|
|
330
347
|
interface DefineComponentOptions<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions> extends Omit<CreateAppOptions<D, C, M>, 'setup'> {
|
|
348
|
+
/**
|
|
349
|
+
* Page-only feature gates (e.g. scroll/share hooks).
|
|
350
|
+
* Only takes effect on page entries.
|
|
351
|
+
*/
|
|
352
|
+
features?: PageFeatures;
|
|
331
353
|
/**
|
|
332
354
|
* Vue-like props definition (will be normalized to mini-program `properties`)
|
|
333
355
|
*/
|
|
@@ -380,10 +402,13 @@ interface ComponentDefinition<D extends object, C extends ComputedDefinitions, M
|
|
|
380
402
|
watch: Record<string, any> | undefined;
|
|
381
403
|
setup: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup'];
|
|
382
404
|
mpOptions: Record<string, any>;
|
|
405
|
+
features?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['features'];
|
|
383
406
|
};
|
|
384
407
|
}
|
|
385
408
|
/**
|
|
386
|
-
* 按 Vue 3
|
|
409
|
+
* 按 Vue 3 风格定义一个小程序组件/页面。
|
|
410
|
+
*
|
|
411
|
+
* - 统一注册为 `Component()`
|
|
387
412
|
*
|
|
388
413
|
* @param options 组件定义项
|
|
389
414
|
* @returns 可手动注册的组件定义
|
|
@@ -397,31 +422,18 @@ interface ComponentDefinition<D extends object, C extends ComputedDefinitions, M
|
|
|
397
422
|
* }
|
|
398
423
|
* })
|
|
399
424
|
* ```
|
|
400
|
-
*/
|
|
401
|
-
declare function defineComponent<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options: DefineComponentOptions<P$1, D, C, M>): ComponentDefinition<D, C, M>;
|
|
402
|
-
/**
|
|
403
|
-
* 按 Vue 3 风格定义一个小程序页面
|
|
404
|
-
*
|
|
405
|
-
* @param options 页面定义
|
|
406
|
-
* @param features 页面特性(例如 listenPageScroll、enableShareAppMessage 等)
|
|
407
|
-
* @returns 页面定义
|
|
408
425
|
*
|
|
409
426
|
* @example
|
|
410
427
|
* ```ts
|
|
411
|
-
*
|
|
412
|
-
*
|
|
428
|
+
* defineComponent({
|
|
429
|
+
* features: { listenPageScroll: true },
|
|
413
430
|
* setup() {
|
|
414
|
-
*
|
|
415
|
-
* onMounted(() => console.log('page mounted'))
|
|
416
|
-
* return { count }
|
|
431
|
+
* onPageScroll(() => {})
|
|
417
432
|
* }
|
|
418
|
-
* }, {
|
|
419
|
-
* listenPageScroll: true,
|
|
420
|
-
* enableShareAppMessage: true
|
|
421
433
|
* })
|
|
422
434
|
* ```
|
|
423
435
|
*/
|
|
424
|
-
declare function
|
|
436
|
+
declare function defineComponent<P$1 extends ComponentPropsOptions = ComponentPropsOptions, D extends object = Record<string, any>, C extends ComputedDefinitions = ComputedDefinitions, M extends MethodDefinitions = MethodDefinitions>(options: DefineComponentOptions<P$1, D, C, M>): ComponentDefinition<D, C, M>;
|
|
425
437
|
/**
|
|
426
438
|
* 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。
|
|
427
439
|
*
|
|
@@ -551,7 +563,6 @@ declare function runSetupFunction(setup: ((...args: any[]) => any) | undefined,
|
|
|
551
563
|
declare function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(target: InternalRuntimeState, runtimeApp: RuntimeApp<D, C, M>, watchMap: WatchMap | undefined, setup?: DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']): RuntimeInstance<D, C, M>;
|
|
552
564
|
declare function teardownRuntimeInstance(target: InternalRuntimeState): void;
|
|
553
565
|
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: Record<string, any>): void;
|
|
554
|
-
declare function
|
|
555
|
-
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: Record<string, any>): void;
|
|
566
|
+
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: Record<string, any>, features?: PageFeatures): void;
|
|
556
567
|
//#endregion
|
|
557
|
-
export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, MethodDefinitions, MiniProgramAdapter, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, WatchOptions, WatchStopHandle, WevuPlugin, WritableComputedOptions, WritableComputedRef, callHookList, callHookReturn, callUpdateHooks, computed, createApp, createStore, createWevuComponent, defineComponent,
|
|
568
|
+
export { ActionSubscriber, AppConfig, ComponentDefinition, ComponentPropsOptions, ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, DefineAppOptions, DefineComponentOptions, DefineStoreOptions, EffectScope, ExtractComputed, ExtractMethods, InferPropType, InferProps, InternalRuntimeState, MethodDefinitions, MiniProgramAdapter, ModelBinding, ModelBindingOptions, MutationType, PageFeatures, PropConstructor, PropOptions, PropType, Ref, RuntimeApp, RuntimeInstance, SetupContext, SetupFunction, StoreManager, SubscriptionCallback, ToRefs, 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, 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 };
|