wevu 6.16.26 → 6.16.28
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/dev/index.mjs +4 -4
- package/dist/dev/{ref-DAstlXwV.mjs → ref-BoBfMdVt.mjs} +5 -5
- package/dist/dev/{ref-DAstlXwV.mjs.map → ref-BoBfMdVt.mjs.map} +1 -1
- package/dist/dev/{router-D68ovdoh.mjs → router-ByTtgUmi.mjs} +2 -2
- package/dist/dev/{router-D68ovdoh.mjs.map → router-ByTtgUmi.mjs.map} +1 -1
- package/dist/dev/router.mjs +2 -2
- package/dist/dev/{src-CsKpC_pl.mjs → src-DytVfRYX.mjs} +5 -5
- package/dist/dev/{src-CsKpC_pl.mjs.map → src-DytVfRYX.mjs.map} +1 -1
- package/dist/dev/{store-Bazm64zK.mjs → store-eNxaNZbj.mjs} +2 -2
- package/dist/dev/{store-Bazm64zK.mjs.map → store-eNxaNZbj.mjs.map} +1 -1
- package/dist/dev/store.mjs +1 -1
- package/dist/dev/vue-demi.mjs +4 -4
- package/dist/index.mjs +1 -1
- package/dist/{src-DeIYCwOv.mjs → src-C0BF7KOe.mjs} +1 -1
- package/dist/vue-demi.mjs +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as track, C as effect, d as reactive, g as touchReactive, j as trigger, l as isReactive, n as isRef, r as markAsRef, w as effectScope, y as toRaw } from "./ref-
|
|
1
|
+
import { A as track, C as effect, d as reactive, g as touchReactive, j as trigger, l as isReactive, n as isRef, r as markAsRef, w as effectScope, y as toRaw } from "./ref-BoBfMdVt.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/reactivity/computed.ts
|
|
4
4
|
function computed(getterOrOptions) {
|
|
@@ -515,4 +515,4 @@ function storeToRefs(store) {
|
|
|
515
515
|
|
|
516
516
|
//#endregion
|
|
517
517
|
export { computed as i, defineStore as n, createStore as r, storeToRefs as t };
|
|
518
|
-
//# sourceMappingURL=store-
|
|
518
|
+
//# sourceMappingURL=store-eNxaNZbj.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-Bazm64zK.mjs","names":[],"sources":["../../src/reactivity/computed.ts","../../src/store/actions.ts","../../src/store/utils.ts","../../src/store/base.ts","../../src/store/define/shared.ts","../../src/store/define/optionsStyle.ts","../../src/store/define/setupStyle.ts","../../src/store/manager.ts","../../src/store/define.ts","../../src/store/storeToRefs.ts"],"sourcesContent":["import type { ReactiveEffect } from './core'\nimport type { Ref } from './ref'\nimport { effect, track, trigger } from './core'\nimport { markAsRef } from './ref'\n\nexport type ComputedGetter<T> = () => T\nexport type ComputedSetter<T> = (value: T) => void\n\ninterface BaseComputedRef<T, S = T> extends Ref<T, S> {\n [key: symbol]: any\n}\n\nexport interface ComputedRef<T = any> extends BaseComputedRef<T> {\n readonly value: T\n}\n\nexport interface WritableComputedRef<T, S = T> extends BaseComputedRef<T, S> {\n value: T\n}\n\nexport interface WritableComputedOptions<T> {\n get: ComputedGetter<T>\n set: ComputedSetter<T>\n}\n\nexport function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>\nexport function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>\nexport function computed<T>(\n getterOrOptions: ComputedGetter<T> | WritableComputedOptions<T>,\n): ComputedRef<T> | WritableComputedRef<T> {\n let getter: ComputedGetter<T>\n let setter: ComputedSetter<T>\n const onlyGetter = typeof getterOrOptions === 'function'\n if (onlyGetter) {\n getter = getterOrOptions as ComputedGetter<T>\n setter = () => {\n throw new Error('计算属性是只读的')\n }\n }\n else {\n getter = (getterOrOptions as WritableComputedOptions<T>).get\n setter = (getterOrOptions as WritableComputedOptions<T>).set\n }\n let value: T\n let dirty = true\n let runner: ReactiveEffect<T>\n const obj: any = {\n get value() {\n if (dirty) {\n value = runner()\n dirty = false\n }\n track(obj, 'value')\n return value\n },\n set value(newValue: T) {\n setter(newValue)\n },\n }\n markAsRef(obj)\n runner = effect(getter, {\n lazy: true,\n scheduler: () => {\n if (!dirty) {\n dirty = true\n trigger(obj, 'value')\n }\n },\n })\n return (onlyGetter ? obj as ComputedRef<T> : obj as WritableComputedRef<T>)\n}\n","import type { ActionSubscriber } from './types'\n\nexport function wrapAction<TStore extends Record<string, any>>(\n store: TStore,\n name: string,\n action: (...args: any[]) => any,\n actionSubs: Set<ActionSubscriber<TStore>>,\n) {\n return function wrapped(this: any, ...args: any[]) {\n const afterCbs: Array<(r: any) => void> = []\n const errorCbs: Array<(e: any) => void> = []\n const after = (cb: (r: any) => void) => afterCbs.push(cb)\n const onError = (cb: (e: any) => void) => errorCbs.push(cb)\n actionSubs.forEach((sub) => {\n try {\n sub({ name, store, args, after, onError })\n }\n catch {\n // 捕获订阅者回调内部的异常,避免单个监听器出错影响其他订阅和原始 action 执行链\n }\n })\n let res: any\n try {\n res = action.apply(store, args)\n }\n catch (e) {\n errorCbs.forEach(cb => cb(e))\n throw e\n }\n const finalize = (r: any) => {\n afterCbs.forEach(cb => cb(r))\n return r\n }\n if (res && typeof (res as Promise<any>).then === 'function') {\n return (res as Promise<any>).then(\n r => finalize(r),\n (e) => {\n errorCbs.forEach(cb => cb(e))\n return Promise.reject(e)\n },\n )\n }\n return finalize(res)\n }\n}\n","export function isObject(val: unknown): val is object {\n return typeof val === 'object' && val !== null\n}\n\nexport function isPlainObject(val: unknown): val is Record<string, any> {\n if (!isObject(val)) {\n return false\n }\n const proto = Object.getPrototypeOf(val)\n return proto === Object.prototype || proto === null\n}\n\nexport function mergeShallow(target: Record<string, any>, patch: Record<string, any>) {\n for (const k in patch) {\n target[k] = patch[k]\n }\n}\n\nexport function cloneDeep<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(item => cloneDeep(item)) as T\n }\n if (isPlainObject(value)) {\n const result: Record<string, any> = {}\n for (const key in value) {\n result[key] = cloneDeep((value as any)[key])\n }\n return result as T\n }\n return value\n}\n\nexport function resetObject(target: Record<string, any>, snapshot: Record<string, any> | any[]) {\n if (Array.isArray(target) && Array.isArray(snapshot)) {\n target.length = 0\n snapshot.forEach((item, index) => {\n target[index] = cloneDeep(item)\n })\n return\n }\n if (!isObject(snapshot)) {\n return\n }\n for (const key in target) {\n if (!(key in snapshot)) {\n delete target[key]\n }\n }\n for (const key in snapshot) {\n const snapValue = (snapshot as any)[key]\n const currentValue = target[key]\n if (Array.isArray(snapValue) && Array.isArray(currentValue)) {\n resetObject(currentValue, snapValue)\n continue\n }\n if (isPlainObject(snapValue) && isPlainObject(currentValue)) {\n resetObject(currentValue, snapValue)\n continue\n }\n target[key] = cloneDeep(snapValue)\n }\n}\n","import type { ActionSubscriber, MutationType, SubscriptionCallback } from './types'\nimport { isObject, mergeShallow } from './utils'\n\nexport function createBaseApi<S extends Record<string, any>>(\n id: string,\n stateObj: S | undefined,\n notify: (type: MutationType) => void,\n resetImpl?: () => void,\n) {\n const api: any = {\n $id: id,\n }\n Object.defineProperty(api, '$state', {\n get() {\n return stateObj\n },\n set(v: any) {\n if (stateObj && isObject(v)) {\n mergeShallow(stateObj, v)\n notify('patch object')\n }\n },\n })\n api.$patch = (patch: Record<string, any> | ((state: S) => void)) => {\n if (!stateObj) {\n if (typeof patch === 'function') {\n patch(api as S)\n notify('patch function')\n }\n else {\n mergeShallow(api as any, patch)\n notify('patch object')\n }\n return\n }\n if (typeof patch === 'function') {\n patch(stateObj)\n notify('patch function')\n }\n else {\n mergeShallow(stateObj, patch)\n notify('patch object')\n }\n }\n if (resetImpl) {\n api.$reset = () => resetImpl()\n }\n const subs = new Set<SubscriptionCallback<S>>()\n api.$subscribe = (cb: SubscriptionCallback<S>, _opts?: { detached?: boolean }) => {\n subs.add(cb)\n return () => subs.delete(cb)\n }\n const actionSubs = new Set<ActionSubscriber<any>>()\n api.$onAction = (cb: ActionSubscriber<any>) => {\n actionSubs.add(cb)\n return () => actionSubs.delete(cb)\n }\n return { api, subs, actionSubs }\n}\n","import type { MutationType, SubscriptionCallback } from '../types'\nimport { isReactive, isRef, toRaw } from '../../reactivity'\nimport { cloneDeep } from '../utils'\n\nconst hasOwn = Object.prototype.hasOwnProperty\n\nexport function isTrackableRef(value: unknown) {\n return isRef(value) && hasOwn.call(value, 'dep')\n}\n\nexport function snapshotValue(value: unknown) {\n if (isReactive(value)) {\n return cloneDeep(toRaw(value as any))\n }\n if (isTrackableRef(value)) {\n return cloneDeep((value as any).value)\n }\n return cloneDeep(value)\n}\n\nexport function createSafeNotifier<S>(\n storeId: string,\n subs: Set<SubscriptionCallback<S>>,\n getState: () => S,\n) {\n let notifying = false\n return (type: MutationType) => {\n if (notifying) {\n return\n }\n notifying = true\n try {\n const state = getState()\n subs.forEach((cb) => {\n try {\n cb({ type, storeId }, state)\n }\n catch {}\n })\n }\n finally {\n notifying = false\n }\n }\n}\n","import { computed, effect, reactive, toRaw, touchReactive } from '../../reactivity'\nimport { wrapAction } from '../actions'\nimport { createBaseApi } from '../base'\nimport { cloneDeep, resetObject } from '../utils'\nimport { createSafeNotifier } from './shared'\n\nexport function createOptionsStyleStore(id: string, options: any, manager: any) {\n const rawState = options.state ? options.state() : {}\n const state = reactive(rawState)\n const initialSnapshot = cloneDeep(toRaw(rawState))\n let notify: (type: any) => void = () => {}\n const base = createBaseApi<typeof state>(id, state, t => notify(t), () => {\n resetObject(state as any, initialSnapshot)\n notify('patch object')\n })\n\n let isPatching = false\n const rawPatch = base.api.$patch\n base.api.$patch = (patch: Partial<typeof state> | ((nextState: typeof state) => void)) => {\n isPatching = true\n try {\n rawPatch(patch as any)\n }\n finally {\n isPatching = false\n }\n }\n if (typeof base.api.$reset === 'function') {\n const rawReset = base.api.$reset\n base.api.$reset = () => {\n isPatching = true\n try {\n rawReset()\n }\n finally {\n isPatching = false\n }\n }\n }\n\n notify = createSafeNotifier(id, base.subs, () => state as any)\n\n const store: Record<string, any> = {}\n for (const key of Object.getOwnPropertyNames(base.api)) {\n const d = Object.getOwnPropertyDescriptor(base.api, key)\n if (d) {\n if (key === '$state') {\n Object.defineProperty(store, key, {\n enumerable: d.enumerable,\n configurable: d.configurable,\n get() {\n return (base.api as any).$state\n },\n set(v: any) {\n isPatching = true\n try {\n ;(base.api as any).$state = v\n }\n finally {\n isPatching = false\n }\n },\n })\n }\n else {\n Object.defineProperty(store, key, d)\n }\n }\n }\n\n const getterDefs = options.getters ?? {}\n Object.keys(getterDefs).forEach((key) => {\n const getter = (getterDefs as any)[key]\n if (typeof getter === 'function') {\n const c = computed(() => getter.call(store, state))\n Object.defineProperty(store, key, {\n enumerable: true,\n configurable: true,\n get() {\n return c.value\n },\n })\n }\n })\n\n const actionDefs = options.actions ?? {}\n Object.keys(actionDefs).forEach((key) => {\n const act = (actionDefs as any)[key]\n if (typeof act === 'function') {\n const wrapped = wrapAction(store as any, key, (...args: any[]) => {\n return act.apply(store as any, args)\n }, base.actionSubs)\n store[key] = wrapped\n }\n })\n\n Object.keys(state).forEach((k) => {\n Object.defineProperty(store, k, {\n enumerable: true,\n configurable: true,\n get() {\n return (state as any)[k]\n },\n set(v: any) {\n ;(state as any)[k] = v\n },\n })\n })\n\n let initialized = false\n let dispatchingDirect = false\n effect(() => {\n touchReactive(state)\n if (!initialized) {\n initialized = true\n return\n }\n if (isPatching || dispatchingDirect) {\n return\n }\n dispatchingDirect = true\n try {\n notify('direct')\n }\n finally {\n dispatchingDirect = false\n }\n })\n\n const plugins = manager?._plugins ?? []\n for (const plugin of plugins) {\n try {\n plugin({ store })\n }\n catch {}\n }\n\n return store\n}\n","import { effect, isReactive, isRef, touchReactive } from '../../reactivity'\nimport { wrapAction } from '../actions'\nimport { createBaseApi } from '../base'\nimport { cloneDeep, resetObject } from '../utils'\nimport { createSafeNotifier, isTrackableRef, snapshotValue } from './shared'\n\nexport function createSetupStyleStore(id: string, setupFactory: () => Record<string, any>, manager: any) {\n const result = setupFactory()\n let notify: (type: any) => void = () => {}\n const initialSnapshot = new Map<string, any>()\n Object.keys(result).forEach((k) => {\n const val = (result as any)[k]\n if (typeof val === 'function' || k.startsWith('$')) {\n return\n }\n if (isRef(val) && !isTrackableRef(val)) {\n return\n }\n initialSnapshot.set(k, snapshotValue(val))\n })\n\n let instance: Record<string, any> = {}\n const resetImpl = () => {\n initialSnapshot.forEach((snapValue, key) => {\n const current = (instance as any)[key]\n if (isTrackableRef(current)) {\n current.value = cloneDeep(snapValue)\n return\n }\n if (isReactive(current)) {\n resetObject(current as any, snapValue)\n return\n }\n if (isRef(current)) {\n return\n }\n ;(instance as any)[key] = cloneDeep(snapValue)\n })\n notify('patch object')\n }\n\n const base = createBaseApi<any>(id, undefined, t => notify(t), resetImpl)\n let isPatching = false\n const rawPatch = base.api.$patch\n base.api.$patch = (patch: Record<string, any> | ((state: any) => void)) => {\n isPatching = true\n try {\n rawPatch(patch)\n }\n finally {\n isPatching = false\n }\n }\n if (typeof base.api.$reset === 'function') {\n const rawReset = base.api.$reset\n base.api.$reset = () => {\n isPatching = true\n try {\n rawReset()\n }\n finally {\n isPatching = false\n }\n }\n }\n\n instance = { ...result }\n notify = createSafeNotifier(id, base.subs, () => instance)\n\n // 将 setup 返回值与基础 API 合并,同时保留每个 getter/setter 的描述符,避免覆写访问器行为\n for (const key of Object.getOwnPropertyNames(base.api)) {\n const d = Object.getOwnPropertyDescriptor(base.api, key)\n if (d) {\n if (key === '$state') {\n Object.defineProperty(instance, key, {\n enumerable: d.enumerable,\n configurable: d.configurable,\n get() {\n return (base.api as any).$state\n },\n set(v: any) {\n isPatching = true\n try {\n ;(base.api as any).$state = v\n }\n finally {\n isPatching = false\n }\n },\n })\n }\n else {\n Object.defineProperty(instance, key, d)\n }\n }\n }\n\n const directSources: any[] = []\n Object.keys(result).forEach((k) => {\n const val = (result as any)[k]\n if (typeof val === 'function' && !k.startsWith('$')) {\n ;(instance as any)[k] = wrapAction(instance, k, val, base.actionSubs)\n return\n }\n if (isTrackableRef(val)) {\n directSources.push(val)\n return\n }\n if (isReactive(val)) {\n directSources.push(val)\n return\n }\n if (isRef(val)) {\n return\n }\n if (!k.startsWith('$')) {\n let innerValue = val\n Object.defineProperty(instance, k, {\n enumerable: true,\n configurable: true,\n get() {\n return innerValue\n },\n set(next: any) {\n innerValue = next\n if (!isPatching) {\n notify('direct')\n }\n },\n })\n }\n })\n\n let dispatchingDirect = false\n if (directSources.length > 0) {\n let initialized = false\n effect(() => {\n directSources.forEach((source) => {\n if (isTrackableRef(source)) {\n void source.value\n }\n else {\n touchReactive(source)\n }\n })\n if (!initialized) {\n initialized = true\n return\n }\n if (isPatching || dispatchingDirect) {\n return\n }\n dispatchingDirect = true\n try {\n notify('direct')\n }\n finally {\n dispatchingDirect = false\n }\n })\n }\n\n const plugins = manager?._plugins ?? []\n for (const plugin of plugins) {\n try {\n plugin({ store: instance })\n }\n catch {}\n }\n\n return instance\n}\n","import type { StoreManager } from './types'\n\n/**\n * @description 创建 store 管理器(插件与共享实例入口)\n */\nexport function createStore(): StoreManager {\n const manager: StoreManager = {\n _stores: new Map(),\n _plugins: [],\n install(_app: any) {\n // 小程序场景不需要注册全局插件入口,这里保留 API 但不执行任何操作\n },\n use(plugin: (context: { store: any }) => void) {\n if (typeof plugin === 'function') {\n manager._plugins.push(plugin)\n }\n return manager\n },\n }\n ;(createStore as any)._instance = manager\n return manager\n}\n","import type {\n ActionSubscriber,\n DefineStoreOptions,\n StoreGetters,\n StoreManager,\n StoreSubscribeOptions,\n SubscriptionCallback,\n} from './types'\nimport { effectScope } from '../reactivity'\nimport { createOptionsStyleStore } from './define/optionsStyle'\nimport { createSetupStyleStore } from './define/setupStyle'\nimport { createStore } from './manager'\n\ntype SetupDefinition<T> = () => T\n\n/**\n * @description 定义一个 setup 风格的 store\n */\nexport function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {\n $id: string\n $patch: (patch: Record<string, any> | ((state: any) => void)) => void\n $reset: () => void\n $subscribe: (cb: SubscriptionCallback<any>, opts?: StoreSubscribeOptions) => () => void\n $onAction: (cb: ActionSubscriber<any>) => () => void\n}\n/**\n * @description 定义一个 options 风格的 store\n */\nexport function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(\n id: string,\n options: DefineStoreOptions<S, G, A>,\n): () => S & StoreGetters<G> & A & {\n $id: string\n $state: S\n $patch: (patch: Partial<S> | ((state: S) => void)) => void\n $reset: () => void\n $subscribe: (cb: SubscriptionCallback<S>, opts?: StoreSubscribeOptions) => () => void\n $onAction: (cb: ActionSubscriber<S & StoreGetters<G> & A>) => () => void\n}\nexport function defineStore(id: string, setupOrOptions: any) {\n let instance: any\n let created = false\n const manager = (createStore as any)._instance as StoreManager | undefined\n\n return function useStore(): any {\n if (created && instance) {\n return instance\n }\n created = true\n\n const storeScope = effectScope(true)\n instance = storeScope.run(() => {\n return typeof setupOrOptions === 'function'\n ? createSetupStyleStore(id, setupOrOptions, manager)\n : createOptionsStyleStore(id, setupOrOptions as DefineStoreOptions<any, any, any>, manager)\n })\n\n return instance\n }\n}\n","import type { Ref } from '../reactivity'\nimport { computed, isRef } from '../reactivity'\n\n/**\n * @description storeToRefs 返回类型推导\n */\nexport type StoreToRefsResult<T extends Record<string, any>> = {\n [K in keyof T]:\n T[K] extends (...args: any[]) => any\n ? T[K]\n : T[K] extends Ref<infer V>\n ? Ref<V>\n : Ref<T[K]>\n}\n\n/**\n * @description 将 store 状态转换为 Ref\n */\nexport function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T> {\n const result: Record<string, any> = {}\n for (const key in store) {\n const value = (store as any)[key]\n if (typeof value === 'function') {\n result[key] = value\n continue\n }\n if (isRef(value)) {\n result[key] = value\n }\n else {\n result[key] = computed({\n get: () => (store as any)[key],\n set: (v: any) => {\n ;(store as any)[key] = v\n },\n })\n }\n }\n return result as StoreToRefsResult<T>\n}\n"],"mappings":";;;AA2BA,SAAgB,SACd,iBACyC;CACzC,IAAI;CACJ,IAAI;CACJ,MAAM,aAAa,OAAO,oBAAoB;CAC9C,IAAI,YAAY;EACd,SAAS;EACT,eAAe;GACb,MAAM,IAAI,MAAM,UAAU;EAC5B;CACF,OACK;EACH,SAAU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CACH;CAEA,MAAM,iFAAU,QAAS,yEAAY,CAAC;CACtC,KAAK,MAAM,UAAU,SACnB,IAAI;EACF,OAAO,EAAE,OAAO,SAAS,CAAC;CAC5B,kBACM,CAAC;CAGT,OAAO;AACT;;;;;;;ACtKA,SAAgB,cAA4B;CAC1C,MAAM,UAAwB;EAC5B,yBAAS,IAAI,IAAI;EACjB,UAAU,CAAC;EACX,QAAQ,MAAW,CAEnB;EACA,IAAI,QAA2C;GAC7C,IAAI,OAAO,WAAW,YACpB,QAAQ,SAAS,KAAK,MAAM;GAE9B,OAAO;EACT;CACF;CACC,AAAC,YAAoB,YAAY;CAClC,OAAO;AACT;;;;ACkBA,SAAgB,YAAY,IAAY,gBAAqB;CAC3D,IAAI;CACJ,IAAI,UAAU;CACd,MAAM,UAAW,YAAoB;CAErC,OAAO,SAAS,WAAgB;EAC9B,IAAI,WAAW,UACb,OAAO;EAET,UAAU;EAGV,WADmB,YAAY,IACX,EAAE,UAAU;GAC9B,OAAO,OAAO,mBAAmB,aAC7B,sBAAsB,IAAI,gBAAgB,OAAO,IACjD,wBAAwB,IAAI,gBAAqD,OAAO;EAC9F,CAAC;EAED,OAAO;CACT;AACF;;;;;;;ACzCA,SAAgB,YAA2C,OAAgC;CACzF,MAAM,SAA8B,CAAC;CACrC,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,QAAS,MAAc;EAC7B,IAAI,OAAO,UAAU,YAAY;GAC/B,OAAO,OAAO;GACd;EACF;EACA,IAAI,MAAM,KAAK,GACb,OAAO,OAAO;OAGd,OAAO,OAAO,SAAS;GACrB,WAAY,MAAc;GAC1B,MAAM,MAAW;IACd,AAAC,MAAc,OAAO;GACzB;EACF,CAAC;CAEL;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"store-eNxaNZbj.mjs","names":[],"sources":["../../src/reactivity/computed.ts","../../src/store/actions.ts","../../src/store/utils.ts","../../src/store/base.ts","../../src/store/define/shared.ts","../../src/store/define/optionsStyle.ts","../../src/store/define/setupStyle.ts","../../src/store/manager.ts","../../src/store/define.ts","../../src/store/storeToRefs.ts"],"sourcesContent":["import type { ReactiveEffect } from './core'\nimport type { Ref } from './ref'\nimport { effect, track, trigger } from './core'\nimport { markAsRef } from './ref'\n\nexport type ComputedGetter<T> = () => T\nexport type ComputedSetter<T> = (value: T) => void\n\ninterface BaseComputedRef<T, S = T> extends Ref<T, S> {\n [key: symbol]: any\n}\n\nexport interface ComputedRef<T = any> extends BaseComputedRef<T> {\n readonly value: T\n}\n\nexport interface WritableComputedRef<T, S = T> extends BaseComputedRef<T, S> {\n value: T\n}\n\nexport interface WritableComputedOptions<T> {\n get: ComputedGetter<T>\n set: ComputedSetter<T>\n}\n\nexport function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>\nexport function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>\nexport function computed<T>(\n getterOrOptions: ComputedGetter<T> | WritableComputedOptions<T>,\n): ComputedRef<T> | WritableComputedRef<T> {\n let getter: ComputedGetter<T>\n let setter: ComputedSetter<T>\n const onlyGetter = typeof getterOrOptions === 'function'\n if (onlyGetter) {\n getter = getterOrOptions as ComputedGetter<T>\n setter = () => {\n throw new Error('计算属性是只读的')\n }\n }\n else {\n getter = (getterOrOptions as WritableComputedOptions<T>).get\n setter = (getterOrOptions as WritableComputedOptions<T>).set\n }\n let value: T\n let dirty = true\n let runner: ReactiveEffect<T>\n const obj: any = {\n get value() {\n if (dirty) {\n value = runner()\n dirty = false\n }\n track(obj, 'value')\n return value\n },\n set value(newValue: T) {\n setter(newValue)\n },\n }\n markAsRef(obj)\n runner = effect(getter, {\n lazy: true,\n scheduler: () => {\n if (!dirty) {\n dirty = true\n trigger(obj, 'value')\n }\n },\n })\n return (onlyGetter ? obj as ComputedRef<T> : obj as WritableComputedRef<T>)\n}\n","import type { ActionSubscriber } from './types'\n\nexport function wrapAction<TStore extends Record<string, any>>(\n store: TStore,\n name: string,\n action: (...args: any[]) => any,\n actionSubs: Set<ActionSubscriber<TStore>>,\n) {\n return function wrapped(this: any, ...args: any[]) {\n const afterCbs: Array<(r: any) => void> = []\n const errorCbs: Array<(e: any) => void> = []\n const after = (cb: (r: any) => void) => afterCbs.push(cb)\n const onError = (cb: (e: any) => void) => errorCbs.push(cb)\n actionSubs.forEach((sub) => {\n try {\n sub({ name, store, args, after, onError })\n }\n catch {\n // 捕获订阅者回调内部的异常,避免单个监听器出错影响其他订阅和原始 action 执行链\n }\n })\n let res: any\n try {\n res = action.apply(store, args)\n }\n catch (e) {\n errorCbs.forEach(cb => cb(e))\n throw e\n }\n const finalize = (r: any) => {\n afterCbs.forEach(cb => cb(r))\n return r\n }\n if (res && typeof (res as Promise<any>).then === 'function') {\n return (res as Promise<any>).then(\n r => finalize(r),\n (e) => {\n errorCbs.forEach(cb => cb(e))\n return Promise.reject(e)\n },\n )\n }\n return finalize(res)\n }\n}\n","export function isObject(val: unknown): val is object {\n return typeof val === 'object' && val !== null\n}\n\nexport function isPlainObject(val: unknown): val is Record<string, any> {\n if (!isObject(val)) {\n return false\n }\n const proto = Object.getPrototypeOf(val)\n return proto === Object.prototype || proto === null\n}\n\nexport function mergeShallow(target: Record<string, any>, patch: Record<string, any>) {\n for (const k in patch) {\n target[k] = patch[k]\n }\n}\n\nexport function cloneDeep<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(item => cloneDeep(item)) as T\n }\n if (isPlainObject(value)) {\n const result: Record<string, any> = {}\n for (const key in value) {\n result[key] = cloneDeep((value as any)[key])\n }\n return result as T\n }\n return value\n}\n\nexport function resetObject(target: Record<string, any>, snapshot: Record<string, any> | any[]) {\n if (Array.isArray(target) && Array.isArray(snapshot)) {\n target.length = 0\n snapshot.forEach((item, index) => {\n target[index] = cloneDeep(item)\n })\n return\n }\n if (!isObject(snapshot)) {\n return\n }\n for (const key in target) {\n if (!(key in snapshot)) {\n delete target[key]\n }\n }\n for (const key in snapshot) {\n const snapValue = (snapshot as any)[key]\n const currentValue = target[key]\n if (Array.isArray(snapValue) && Array.isArray(currentValue)) {\n resetObject(currentValue, snapValue)\n continue\n }\n if (isPlainObject(snapValue) && isPlainObject(currentValue)) {\n resetObject(currentValue, snapValue)\n continue\n }\n target[key] = cloneDeep(snapValue)\n }\n}\n","import type { ActionSubscriber, MutationType, SubscriptionCallback } from './types'\nimport { isObject, mergeShallow } from './utils'\n\nexport function createBaseApi<S extends Record<string, any>>(\n id: string,\n stateObj: S | undefined,\n notify: (type: MutationType) => void,\n resetImpl?: () => void,\n) {\n const api: any = {\n $id: id,\n }\n Object.defineProperty(api, '$state', {\n get() {\n return stateObj\n },\n set(v: any) {\n if (stateObj && isObject(v)) {\n mergeShallow(stateObj, v)\n notify('patch object')\n }\n },\n })\n api.$patch = (patch: Record<string, any> | ((state: S) => void)) => {\n if (!stateObj) {\n if (typeof patch === 'function') {\n patch(api as S)\n notify('patch function')\n }\n else {\n mergeShallow(api as any, patch)\n notify('patch object')\n }\n return\n }\n if (typeof patch === 'function') {\n patch(stateObj)\n notify('patch function')\n }\n else {\n mergeShallow(stateObj, patch)\n notify('patch object')\n }\n }\n if (resetImpl) {\n api.$reset = () => resetImpl()\n }\n const subs = new Set<SubscriptionCallback<S>>()\n api.$subscribe = (cb: SubscriptionCallback<S>, _opts?: { detached?: boolean }) => {\n subs.add(cb)\n return () => subs.delete(cb)\n }\n const actionSubs = new Set<ActionSubscriber<any>>()\n api.$onAction = (cb: ActionSubscriber<any>) => {\n actionSubs.add(cb)\n return () => actionSubs.delete(cb)\n }\n return { api, subs, actionSubs }\n}\n","import type { MutationType, SubscriptionCallback } from '../types'\nimport { isReactive, isRef, toRaw } from '../../reactivity'\nimport { cloneDeep } from '../utils'\n\nconst hasOwn = Object.prototype.hasOwnProperty\n\nexport function isTrackableRef(value: unknown) {\n return isRef(value) && hasOwn.call(value, 'dep')\n}\n\nexport function snapshotValue(value: unknown) {\n if (isReactive(value)) {\n return cloneDeep(toRaw(value as any))\n }\n if (isTrackableRef(value)) {\n return cloneDeep((value as any).value)\n }\n return cloneDeep(value)\n}\n\nexport function createSafeNotifier<S>(\n storeId: string,\n subs: Set<SubscriptionCallback<S>>,\n getState: () => S,\n) {\n let notifying = false\n return (type: MutationType) => {\n if (notifying) {\n return\n }\n notifying = true\n try {\n const state = getState()\n subs.forEach((cb) => {\n try {\n cb({ type, storeId }, state)\n }\n catch {}\n })\n }\n finally {\n notifying = false\n }\n }\n}\n","import { computed, effect, reactive, toRaw, touchReactive } from '../../reactivity'\nimport { wrapAction } from '../actions'\nimport { createBaseApi } from '../base'\nimport { cloneDeep, resetObject } from '../utils'\nimport { createSafeNotifier } from './shared'\n\nexport function createOptionsStyleStore(id: string, options: any, manager: any) {\n const rawState = options.state ? options.state() : {}\n const state = reactive(rawState)\n const initialSnapshot = cloneDeep(toRaw(rawState))\n let notify: (type: any) => void = () => {}\n const base = createBaseApi<typeof state>(id, state, t => notify(t), () => {\n resetObject(state as any, initialSnapshot)\n notify('patch object')\n })\n\n let isPatching = false\n const rawPatch = base.api.$patch\n base.api.$patch = (patch: Partial<typeof state> | ((nextState: typeof state) => void)) => {\n isPatching = true\n try {\n rawPatch(patch as any)\n }\n finally {\n isPatching = false\n }\n }\n if (typeof base.api.$reset === 'function') {\n const rawReset = base.api.$reset\n base.api.$reset = () => {\n isPatching = true\n try {\n rawReset()\n }\n finally {\n isPatching = false\n }\n }\n }\n\n notify = createSafeNotifier(id, base.subs, () => state as any)\n\n const store: Record<string, any> = {}\n for (const key of Object.getOwnPropertyNames(base.api)) {\n const d = Object.getOwnPropertyDescriptor(base.api, key)\n if (d) {\n if (key === '$state') {\n Object.defineProperty(store, key, {\n enumerable: d.enumerable,\n configurable: d.configurable,\n get() {\n return (base.api as any).$state\n },\n set(v: any) {\n isPatching = true\n try {\n ;(base.api as any).$state = v\n }\n finally {\n isPatching = false\n }\n },\n })\n }\n else {\n Object.defineProperty(store, key, d)\n }\n }\n }\n\n const getterDefs = options.getters ?? {}\n Object.keys(getterDefs).forEach((key) => {\n const getter = (getterDefs as any)[key]\n if (typeof getter === 'function') {\n const c = computed(() => getter.call(store, state))\n Object.defineProperty(store, key, {\n enumerable: true,\n configurable: true,\n get() {\n return c.value\n },\n })\n }\n })\n\n const actionDefs = options.actions ?? {}\n Object.keys(actionDefs).forEach((key) => {\n const act = (actionDefs as any)[key]\n if (typeof act === 'function') {\n const wrapped = wrapAction(store as any, key, (...args: any[]) => {\n return act.apply(store as any, args)\n }, base.actionSubs)\n store[key] = wrapped\n }\n })\n\n Object.keys(state).forEach((k) => {\n Object.defineProperty(store, k, {\n enumerable: true,\n configurable: true,\n get() {\n return (state as any)[k]\n },\n set(v: any) {\n ;(state as any)[k] = v\n },\n })\n })\n\n let initialized = false\n let dispatchingDirect = false\n effect(() => {\n touchReactive(state)\n if (!initialized) {\n initialized = true\n return\n }\n if (isPatching || dispatchingDirect) {\n return\n }\n dispatchingDirect = true\n try {\n notify('direct')\n }\n finally {\n dispatchingDirect = false\n }\n })\n\n const plugins = manager?._plugins ?? []\n for (const plugin of plugins) {\n try {\n plugin({ store })\n }\n catch {}\n }\n\n return store\n}\n","import { effect, isReactive, isRef, touchReactive } from '../../reactivity'\nimport { wrapAction } from '../actions'\nimport { createBaseApi } from '../base'\nimport { cloneDeep, resetObject } from '../utils'\nimport { createSafeNotifier, isTrackableRef, snapshotValue } from './shared'\n\nexport function createSetupStyleStore(id: string, setupFactory: () => Record<string, any>, manager: any) {\n const result = setupFactory()\n let notify: (type: any) => void = () => {}\n const initialSnapshot = new Map<string, any>()\n Object.keys(result).forEach((k) => {\n const val = (result as any)[k]\n if (typeof val === 'function' || k.startsWith('$')) {\n return\n }\n if (isRef(val) && !isTrackableRef(val)) {\n return\n }\n initialSnapshot.set(k, snapshotValue(val))\n })\n\n let instance: Record<string, any> = {}\n const resetImpl = () => {\n initialSnapshot.forEach((snapValue, key) => {\n const current = (instance as any)[key]\n if (isTrackableRef(current)) {\n current.value = cloneDeep(snapValue)\n return\n }\n if (isReactive(current)) {\n resetObject(current as any, snapValue)\n return\n }\n if (isRef(current)) {\n return\n }\n ;(instance as any)[key] = cloneDeep(snapValue)\n })\n notify('patch object')\n }\n\n const base = createBaseApi<any>(id, undefined, t => notify(t), resetImpl)\n let isPatching = false\n const rawPatch = base.api.$patch\n base.api.$patch = (patch: Record<string, any> | ((state: any) => void)) => {\n isPatching = true\n try {\n rawPatch(patch)\n }\n finally {\n isPatching = false\n }\n }\n if (typeof base.api.$reset === 'function') {\n const rawReset = base.api.$reset\n base.api.$reset = () => {\n isPatching = true\n try {\n rawReset()\n }\n finally {\n isPatching = false\n }\n }\n }\n\n instance = { ...result }\n notify = createSafeNotifier(id, base.subs, () => instance)\n\n // 将 setup 返回值与基础 API 合并,同时保留每个 getter/setter 的描述符,避免覆写访问器行为\n for (const key of Object.getOwnPropertyNames(base.api)) {\n const d = Object.getOwnPropertyDescriptor(base.api, key)\n if (d) {\n if (key === '$state') {\n Object.defineProperty(instance, key, {\n enumerable: d.enumerable,\n configurable: d.configurable,\n get() {\n return (base.api as any).$state\n },\n set(v: any) {\n isPatching = true\n try {\n ;(base.api as any).$state = v\n }\n finally {\n isPatching = false\n }\n },\n })\n }\n else {\n Object.defineProperty(instance, key, d)\n }\n }\n }\n\n const directSources: any[] = []\n Object.keys(result).forEach((k) => {\n const val = (result as any)[k]\n if (typeof val === 'function' && !k.startsWith('$')) {\n ;(instance as any)[k] = wrapAction(instance, k, val, base.actionSubs)\n return\n }\n if (isTrackableRef(val)) {\n directSources.push(val)\n return\n }\n if (isReactive(val)) {\n directSources.push(val)\n return\n }\n if (isRef(val)) {\n return\n }\n if (!k.startsWith('$')) {\n let innerValue = val\n Object.defineProperty(instance, k, {\n enumerable: true,\n configurable: true,\n get() {\n return innerValue\n },\n set(next: any) {\n innerValue = next\n if (!isPatching) {\n notify('direct')\n }\n },\n })\n }\n })\n\n let dispatchingDirect = false\n if (directSources.length > 0) {\n let initialized = false\n effect(() => {\n directSources.forEach((source) => {\n if (isTrackableRef(source)) {\n void source.value\n }\n else {\n touchReactive(source)\n }\n })\n if (!initialized) {\n initialized = true\n return\n }\n if (isPatching || dispatchingDirect) {\n return\n }\n dispatchingDirect = true\n try {\n notify('direct')\n }\n finally {\n dispatchingDirect = false\n }\n })\n }\n\n const plugins = manager?._plugins ?? []\n for (const plugin of plugins) {\n try {\n plugin({ store: instance })\n }\n catch {}\n }\n\n return instance\n}\n","import type { StoreManager } from './types'\n\n/**\n * @description 创建 store 管理器(插件与共享实例入口)\n */\nexport function createStore(): StoreManager {\n const manager: StoreManager = {\n _stores: new Map(),\n _plugins: [],\n install(_app: any) {\n // 小程序场景不需要注册全局插件入口,这里保留 API 但不执行任何操作\n },\n use(plugin: (context: { store: any }) => void) {\n if (typeof plugin === 'function') {\n manager._plugins.push(plugin)\n }\n return manager\n },\n }\n ;(createStore as any)._instance = manager\n return manager\n}\n","import type {\n ActionSubscriber,\n DefineStoreOptions,\n StoreGetters,\n StoreManager,\n StoreSubscribeOptions,\n SubscriptionCallback,\n} from './types'\nimport { effectScope } from '../reactivity'\nimport { createOptionsStyleStore } from './define/optionsStyle'\nimport { createSetupStyleStore } from './define/setupStyle'\nimport { createStore } from './manager'\n\ntype SetupDefinition<T> = () => T\n\n/**\n * @description 定义一个 setup 风格的 store\n */\nexport function defineStore<T extends Record<string, any>>(id: string, setup: SetupDefinition<T>): () => T & {\n $id: string\n $patch: (patch: Record<string, any> | ((state: any) => void)) => void\n $reset: () => void\n $subscribe: (cb: SubscriptionCallback<any>, opts?: StoreSubscribeOptions) => () => void\n $onAction: (cb: ActionSubscriber<any>) => () => void\n}\n/**\n * @description 定义一个 options 风格的 store\n */\nexport function defineStore<S extends Record<string, any>, G extends Record<string, any>, A extends Record<string, any>>(\n id: string,\n options: DefineStoreOptions<S, G, A>,\n): () => S & StoreGetters<G> & A & {\n $id: string\n $state: S\n $patch: (patch: Partial<S> | ((state: S) => void)) => void\n $reset: () => void\n $subscribe: (cb: SubscriptionCallback<S>, opts?: StoreSubscribeOptions) => () => void\n $onAction: (cb: ActionSubscriber<S & StoreGetters<G> & A>) => () => void\n}\nexport function defineStore(id: string, setupOrOptions: any) {\n let instance: any\n let created = false\n const manager = (createStore as any)._instance as StoreManager | undefined\n\n return function useStore(): any {\n if (created && instance) {\n return instance\n }\n created = true\n\n const storeScope = effectScope(true)\n instance = storeScope.run(() => {\n return typeof setupOrOptions === 'function'\n ? createSetupStyleStore(id, setupOrOptions, manager)\n : createOptionsStyleStore(id, setupOrOptions as DefineStoreOptions<any, any, any>, manager)\n })\n\n return instance\n }\n}\n","import type { Ref } from '../reactivity'\nimport { computed, isRef } from '../reactivity'\n\n/**\n * @description storeToRefs 返回类型推导\n */\nexport type StoreToRefsResult<T extends Record<string, any>> = {\n [K in keyof T]:\n T[K] extends (...args: any[]) => any\n ? T[K]\n : T[K] extends Ref<infer V>\n ? Ref<V>\n : Ref<T[K]>\n}\n\n/**\n * @description 将 store 状态转换为 Ref\n */\nexport function storeToRefs<T extends Record<string, any>>(store: T): StoreToRefsResult<T> {\n const result: Record<string, any> = {}\n for (const key in store) {\n const value = (store as any)[key]\n if (typeof value === 'function') {\n result[key] = value\n continue\n }\n if (isRef(value)) {\n result[key] = value\n }\n else {\n result[key] = computed({\n get: () => (store as any)[key],\n set: (v: any) => {\n ;(store as any)[key] = v\n },\n })\n }\n }\n return result as StoreToRefsResult<T>\n}\n"],"mappings":";;;AA2BA,SAAgB,SACd,iBACyC;CACzC,IAAI;CACJ,IAAI;CACJ,MAAM,aAAa,OAAO,oBAAoB;CAC9C,IAAI,YAAY;EACd,SAAS;EACT,eAAe;GACb,MAAM,IAAI,MAAM,UAAU;EAC5B;CACF,OACK;EACH,SAAU,gBAA+C;EACzD,SAAU,gBAA+C;CAC3D;CACA,IAAI;CACJ,IAAI,QAAQ;CACZ,IAAI;CACJ,MAAM,MAAW;EACf,IAAI,QAAQ;GACV,IAAI,OAAO;IACT,QAAQ,OAAO;IACf,QAAQ;GACV;GACA,MAAM,KAAK,OAAO;GAClB,OAAO;EACT;EACA,IAAI,MAAM,UA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EACjB,UAAU,CAAC;EACX,QAAQ,MAAW,CAEnB;EACA,IAAI,QAA2C;GAC7C,IAAI,OAAO,WAAW,YACpB,QAAQ,SAAS,KAAK,MAAM;GAE9B,OAAO;EACT;CACF;CACC,AAAC,YAAoB,YAAY;CAClC,OAAO;AACT;;;;ACkBA,SAAgB,YAAY,IAAY,gBAAqB;CAC3D,IAAI;CACJ,IAAI,UAAU;CACd,MAAM,UAAW,YAAoB;CAErC,OAAO,SAAS,WAAgB;EAC9B,IAAI,WAAW,UACb,OAAO;EAET,UAAU;EAGV,WADmB,YAAY,IACX,EAAE,UAAU;GAC9B,OAAO,OAAO,mBAAmB,aAC7B,sBAAsB,IAAI,gBAAgB,OAAO,IACjD,wBAAwB,IAAI,gBAAqD,OAAO;EAC9F,CAAC;EAED,OAAO;CACT;AACF;;;;;;;ACzCA,SAAgB,YAA2C,OAAgC;CACzF,MAAM,SAA8B,CAAC;CACrC,KAAK,MAAM,OAAO,OAAO;EACvB,MAAM,QAAS,MAAc;EAC7B,IAAI,OAAO,UAAU,YAAY;GAC/B,OAAO,OAAO;GACd;EACF;EACA,IAAI,MAAM,KAAK,GACb,OAAO,OAAO;OAGd,OAAO,OAAO,SAAS;GACrB,WAAY,MAAc;GAC1B,MAAM,MAAW;IACd,AAAC,MAAc,OAAO;GACzB;EACF,CAAC;CAEL;CACA,OAAO;AACT"}
|
package/dist/dev/store.mjs
CHANGED
package/dist/dev/vue-demi.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as setWevuDefaults, A as defineComponent, B as useLayoutHosts, C as useNavigationBarMetrics, Ct as isShallowRef, D as useDisposables, Dt as __reExport, E as useElementIntersectionObserver, Et as __exportAll, F as resolveLayoutBridge, G as teardownRuntimeInstance, H as registerApp, I as resolveLayoutHost, J as setPageLayout, K as runSetupFunction, L as unregisterPageLayoutBridge, M as registerComponent, N as registerPageLayoutBridge, O as createWevuComponent, P as registerRuntimeLayoutHosts, Q as resetWevuDefaults, R as unregisterRuntimeLayoutHosts, S as getNavigationBarMetrics, St as toRefs, T as useIntersectionObserver, Tt as triggerRef, U as mountRuntimeInstance, V as waitForLayoutHost, W as setRuntimeSetDataVisibility, X as syncRuntimePageLayoutStateFromRuntime, Y as syncRuntimePageLayoutState, Z as usePageLayout, _ as useSelectorFields, _t as onServerPrefetch, a as useModel, at as watchPostEffect, b as usePageScrollThrottle, bt as traverse, c as useSlots, ct as setDeepWatchStrategy, d as useUpdatePerformanceListener, dt as onBeforeMount, et as isNoSetData, f as normalizeClass, ft as onBeforeUnmount, g as useScrollOffset, gt as onMounted, h as useBoundingClientRect, ht as onErrorCaptured, i as useChangeModel, it as watchEffect, j as createApp, k as createWevuScopedSlotComponent, l as defineAppSetup, lt as callUpdateHooks, m as resolvePropValue, mt as onDeactivated, n as mergeModels, nt as version, o as useAttrs, ot as watchSyncEffect, p as normalizeStyle, pt as onBeforeUpdate, q as resolveRuntimePageLayoutName, r as useBindModel, rt as watch, s as useNativeInstance, st as getDeepWatchStrategy, t as useTemplateRef, tt as markNoSetData, u as use, ut as onActivated, v as useSelectorQuery, vt as onUnmounted, w as usePageStack, wt as shallowRef, x as getCurrentPageStackSnapshot, xt as toRef, y as useAsyncPullDownRefresh, yt as onUpdated, z as useLayoutBridge } from "./src-
|
|
2
|
-
import { C as effect, D as onScopeDispose, E as getCurrentScope, N as nextTick, O as startBatch, S as batch, T as endBatch, a as toValue, b as addMutationRecorder, c as isRaw, d as reactive, f as isShallowReactive, g as touchReactive, h as prelinkReactiveTree, i as ref, k as stop, l as isReactive, n as isRef, o as unref, p as shallowReactive, s as getReactiveVersion, t as customRef, u as markRaw, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-
|
|
3
|
-
import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-
|
|
4
|
-
import { $ as onUnhandledRejection, A as setGlobalProvidedValue, B as onPageNotFound, F as onHide, G as onResize, H as onPullDownRefresh, I as onLaunch, J as onShareAppMessage, K as onRouteDone, L as onLoad, M as onAttached, N as onDetached, P as onError, Q as onThemeChange, R as onMemoryWarning, U as onReachBottom, V as onPageScroll, W as onReady, X as onShow, Y as onShareTimeline, Z as onTabItemTap, _ as provide, _t as readonly, at as getCurrentSetupContext, ct as setCurrentSetupContext, et as onUnload, g as injectGlobal, gt as isReadonly, h as inject, ht as isProxy, it as getCurrentInstance, j as onAddToFavorites, m as hasInjectionContext, n as useNativeRouter, nt as callHookList, q as onSaveExitState, rt as callHookReturn, st as setCurrentInstance, t as useNativePageRouter, v as provideGlobal, vt as shallowReadonly, z as onMoved } from "./router-
|
|
1
|
+
import { $ as setWevuDefaults, A as defineComponent, B as useLayoutHosts, C as useNavigationBarMetrics, Ct as isShallowRef, D as useDisposables, Dt as __reExport, E as useElementIntersectionObserver, Et as __exportAll, F as resolveLayoutBridge, G as teardownRuntimeInstance, H as registerApp, I as resolveLayoutHost, J as setPageLayout, K as runSetupFunction, L as unregisterPageLayoutBridge, M as registerComponent, N as registerPageLayoutBridge, O as createWevuComponent, P as registerRuntimeLayoutHosts, Q as resetWevuDefaults, R as unregisterRuntimeLayoutHosts, S as getNavigationBarMetrics, St as toRefs, T as useIntersectionObserver, Tt as triggerRef, U as mountRuntimeInstance, V as waitForLayoutHost, W as setRuntimeSetDataVisibility, X as syncRuntimePageLayoutStateFromRuntime, Y as syncRuntimePageLayoutState, Z as usePageLayout, _ as useSelectorFields, _t as onServerPrefetch, a as useModel, at as watchPostEffect, b as usePageScrollThrottle, bt as traverse, c as useSlots, ct as setDeepWatchStrategy, d as useUpdatePerformanceListener, dt as onBeforeMount, et as isNoSetData, f as normalizeClass, ft as onBeforeUnmount, g as useScrollOffset, gt as onMounted, h as useBoundingClientRect, ht as onErrorCaptured, i as useChangeModel, it as watchEffect, j as createApp, k as createWevuScopedSlotComponent, l as defineAppSetup, lt as callUpdateHooks, m as resolvePropValue, mt as onDeactivated, n as mergeModels, nt as version, o as useAttrs, ot as watchSyncEffect, p as normalizeStyle, pt as onBeforeUpdate, q as resolveRuntimePageLayoutName, r as useBindModel, rt as watch, s as useNativeInstance, st as getDeepWatchStrategy, t as useTemplateRef, tt as markNoSetData, u as use, ut as onActivated, v as useSelectorQuery, vt as onUnmounted, w as usePageStack, wt as shallowRef, x as getCurrentPageStackSnapshot, xt as toRef, y as useAsyncPullDownRefresh, yt as onUpdated, z as useLayoutBridge } from "./src-DytVfRYX.mjs";
|
|
2
|
+
import { C as effect, D as onScopeDispose, E as getCurrentScope, N as nextTick, O as startBatch, S as batch, T as endBatch, a as toValue, b as addMutationRecorder, c as isRaw, d as reactive, f as isShallowReactive, g as touchReactive, h as prelinkReactiveTree, i as ref, k as stop, l as isReactive, n as isRef, o as unref, p as shallowReactive, s as getReactiveVersion, t as customRef, u as markRaw, w as effectScope, x as removeMutationRecorder, y as toRaw } from "./ref-BoBfMdVt.mjs";
|
|
3
|
+
import { i as computed, n as defineStore, r as createStore, t as storeToRefs } from "./store-eNxaNZbj.mjs";
|
|
4
|
+
import { $ as onUnhandledRejection, A as setGlobalProvidedValue, B as onPageNotFound, F as onHide, G as onResize, H as onPullDownRefresh, I as onLaunch, J as onShareAppMessage, K as onRouteDone, L as onLoad, M as onAttached, N as onDetached, P as onError, Q as onThemeChange, R as onMemoryWarning, U as onReachBottom, V as onPageScroll, W as onReady, X as onShow, Y as onShareTimeline, Z as onTabItemTap, _ as provide, _t as readonly, at as getCurrentSetupContext, ct as setCurrentSetupContext, et as onUnload, g as injectGlobal, gt as isReadonly, h as inject, ht as isProxy, it as getCurrentInstance, j as onAddToFavorites, m as hasInjectionContext, n as useNativeRouter, nt as callHookList, q as onSaveExitState, rt as callHookReturn, st as setCurrentInstance, t as useNativePageRouter, v as provideGlobal, vt as shallowReadonly, z as onMoved } from "./router-ByTtgUmi.mjs";
|
|
5
5
|
|
|
6
6
|
export * from "@wevu/web-apis"
|
|
7
7
|
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,D as t,E as n,N as r,O as i,S as a,T as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,n as _,o as v,p as y,s as b,t as x,u as S,w as C,x as w,y as T}from"./ref-CRwjgX_d.mjs";import{i as E,n as D,r as O,t as k}from"./store-CNXa5BsN.mjs";import{$ as A,A as j,B as M,F as N,G as P,H as F,I,J as L,K as R,L as z,M as B,N as V,P as H,Q as U,R as W,U as G,V as K,W as q,X as J,Y,Z as X,_ as Z,_t as Q,at as $,ct as ee,et as te,g as ne,gt as re,h as ie,ht as ae,it as oe,j as se,m as ce,n as le,nt as ue,q as de,rt as fe,st as pe,t as me,v as he,vt as ge,z as _e}from"./router-C1IObdgc.mjs";import{$ as ve,A as ye,B as be,C as xe,Ct as Se,D as Ce,E as we,F as Te,G as Ee,H as De,I as Oe,J as ke,K as Ae,L as je,M as Me,N as Ne,O as Pe,P as Fe,Q as Ie,R as Le,S as Re,St as ze,T as Be,Tt as Ve,U as He,V as Ue,W as We,X as Ge,Y as Ke,Z as qe,_ as Je,_t as Ye,a as Xe,at as Ze,b as Qe,bt as $e,c as et,ct as tt,d as nt,dt as rt,et as it,f as at,ft as ot,g as st,gt as ct,h as lt,ht as ut,i as dt,it as ft,j as pt,k as mt,l as ht,lt as gt,m as _t,mt as vt,n as yt,nt as bt,o as xt,ot as St,p as Ct,pt as wt,q as Tt,r as Et,rt as Dt,s as Ot,st as kt,t as At,tt as jt,u as Mt,ut as Nt,v as Pt,vt as Ft,w as It,wt as Lt,x as Rt,xt as zt,y as Bt,yt as Vt,z as Ht}from"./src-
|
|
1
|
+
import{C as e,D as t,E as n,N as r,O as i,S as a,T as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,n as _,o as v,p as y,s as b,t as x,u as S,w as C,x as w,y as T}from"./ref-CRwjgX_d.mjs";import{i as E,n as D,r as O,t as k}from"./store-CNXa5BsN.mjs";import{$ as A,A as j,B as M,F as N,G as P,H as F,I,J as L,K as R,L as z,M as B,N as V,P as H,Q as U,R as W,U as G,V as K,W as q,X as J,Y,Z as X,_ as Z,_t as Q,at as $,ct as ee,et as te,g as ne,gt as re,h as ie,ht as ae,it as oe,j as se,m as ce,n as le,nt as ue,q as de,rt as fe,st as pe,t as me,v as he,vt as ge,z as _e}from"./router-C1IObdgc.mjs";import{$ as ve,A as ye,B as be,C as xe,Ct as Se,D as Ce,E as we,F as Te,G as Ee,H as De,I as Oe,J as ke,K as Ae,L as je,M as Me,N as Ne,O as Pe,P as Fe,Q as Ie,R as Le,S as Re,St as ze,T as Be,Tt as Ve,U as He,V as Ue,W as We,X as Ge,Y as Ke,Z as qe,_ as Je,_t as Ye,a as Xe,at as Ze,b as Qe,bt as $e,c as et,ct as tt,d as nt,dt as rt,et as it,f as at,ft as ot,g as st,gt as ct,h as lt,ht as ut,i as dt,it as ft,j as pt,k as mt,l as ht,lt as gt,m as _t,mt as vt,n as yt,nt as bt,o as xt,ot as St,p as Ct,pt as wt,q as Tt,r as Et,rt as Dt,s as Ot,st as kt,t as At,tt as jt,u as Mt,ut as Nt,v as Pt,vt as Ft,w as It,wt as Lt,x as Rt,xt as zt,y as Bt,yt as Vt,z as Ht}from"./src-C0BF7KOe.mjs";export*from"@wevu/web-apis";export{c as addMutationRecorder,a as batch,ue as callHookList,fe as callHookReturn,gt as callUpdateHooks,E as computed,pt as createApp,O as createStore,Pe as createWevuComponent,mt as createWevuScopedSlotComponent,x as customRef,ht as defineAppSetup,ye as defineComponent,D as defineStore,e as effect,C as effectScope,o as endBatch,oe as getCurrentInstance,Rt as getCurrentPageStackSnapshot,n as getCurrentScope,$ as getCurrentSetupContext,kt as getDeepWatchStrategy,Re as getNavigationBarMetrics,b as getReactiveVersion,ce as hasInjectionContext,ie as inject,ne as injectGlobal,it as isNoSetData,ae as isProxy,l as isRaw,g as isReactive,re as isReadonly,_ as isRef,d as isShallowReactive,Se as isShallowRef,jt as markNoSetData,S as markRaw,yt as mergeModels,He as mountRuntimeInstance,r as nextTick,at as normalizeClass,Ct as normalizeStyle,Nt as onActivated,se as onAddToFavorites,B as onAttached,rt as onBeforeMount,ot as onBeforeUnmount,wt as onBeforeUpdate,vt as onDeactivated,V as onDetached,H as onError,ut as onErrorCaptured,N as onHide,I as onLaunch,z as onLoad,W as onMemoryWarning,ct as onMounted,_e as onMoved,M as onPageNotFound,K as onPageScroll,F as onPullDownRefresh,G as onReachBottom,q as onReady,P as onResize,R as onRouteDone,de as onSaveExitState,t as onScopeDispose,Ye as onServerPrefetch,L as onShareAppMessage,Y as onShareTimeline,J as onShow,X as onTabItemTap,U as onThemeChange,A as onUnhandledRejection,te as onUnload,Ft as onUnmounted,Vt as onUpdated,p as prelinkReactiveTree,Z as provide,he as provideGlobal,u as reactive,Q as readonly,m as ref,De as registerApp,Me as registerComponent,Ne as registerPageLayoutBridge,Fe as registerRuntimeLayoutHosts,w as removeMutationRecorder,Ie as resetWevuDefaults,Te as resolveLayoutBridge,Oe as resolveLayoutHost,_t as resolvePropValue,Tt as resolveRuntimePageLayoutName,Ae as runSetupFunction,pe as setCurrentInstance,ee as setCurrentSetupContext,tt as setDeepWatchStrategy,j as setGlobalProvidedValue,ke as setPageLayout,We as setRuntimeSetDataVisibility,ve as setWevuDefaults,y as shallowReactive,ge as shallowReadonly,Lt as shallowRef,i as startBatch,h as stop,k as storeToRefs,Ke as syncRuntimePageLayoutState,Ge as syncRuntimePageLayoutStateFromRuntime,Ee as teardownRuntimeInstance,T as toRaw,zt as toRef,ze as toRefs,s as toValue,f as touchReactive,$e as traverse,Ve as triggerRef,v as unref,je as unregisterPageLayoutBridge,Le as unregisterRuntimeLayoutHosts,Mt as use,Bt as useAsyncPullDownRefresh,xt as useAttrs,Et as useBindModel,lt as useBoundingClientRect,dt as useChangeModel,Ce as useDisposables,we as useElementIntersectionObserver,Be as useIntersectionObserver,Ht as useLayoutBridge,be as useLayoutHosts,Xe as useModel,Ot as useNativeInstance,me as useNativePageRouter,le as useNativeRouter,xe as useNavigationBarMetrics,qe as usePageLayout,Qe as usePageScrollThrottle,It as usePageStack,st as useScrollOffset,Je as useSelectorFields,Pt as useSelectorQuery,et as useSlots,At as useTemplateRef,nt as useUpdatePerformanceListener,bt as version,Ue as waitForLayoutHost,Dt as watch,ft as watchEffect,Ze as watchPostEffect,St as watchSyncEffect};
|