wevu 6.19.4 → 6.20.1

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.
@@ -10,6 +10,7 @@ import { resolveRuntimePageLayoutName, setPageLayout, syncRuntimePageLayoutState
10
10
  import { runSetupFunction } from "./runtime/register/setup.mjs";
11
11
  import { mountRuntimeInstance, setRuntimeSetDataVisibility, teardownRuntimeInstance } from "./runtime/register/runtimeInstance.mjs";
12
12
  import { registerApp } from "./runtime/register/app.mjs";
13
+ import { Fragment, createTextVNode, createVNode, isVNode, mergeProps, normalizeJsxIsland, resolveComponent, resolveDirective, transformOn, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, withDirectives } from "./runtime/jsxIsland.mjs";
13
14
  import { resolveLayoutBridge, resolveLayoutHost, useLayoutBridge, useLayoutHosts, waitForLayoutHost } from "./runtime/layoutBridge.mjs";
14
15
  import { registerComponent } from "./runtime/register/component.mjs";
15
16
  import { createApp } from "./runtime/app.mjs";
@@ -30,4 +31,4 @@ import { useNativePageRouter, useNativeRouter } from "./runtime/vueCompat/router
30
31
  import { useTemplateRef } from "./runtime/vueCompat/templateRef.mjs";
31
32
  import { createUniAppHost } from "./runtime/uniAppHost.mjs";
32
33
 
33
- export { callHookList, callHookReturn, createApp, createUniAppHost, createWevuComponent, createWevuScopedSlotComponent, defineAppSetup, defineComponent, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentSetupContext, getNavigationBarMetrics, hasInjectionContext, inject, injectGlobal, isNoSetData, markNoSetData, mergeModels, mountRuntimeInstance, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, provideGlobal, registerApp, registerComponent, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, takePendingRuntimeAppRegistration, teardownRuntimeInstance, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, version, waitForLayoutHost };
34
+ export { Fragment, callHookList, callHookReturn, createApp, createTextVNode, createUniAppHost, createVNode, createWevuComponent, createWevuScopedSlotComponent, defineAppSetup, defineComponent, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentSetupContext, getNavigationBarMetrics, hasInjectionContext, inject, injectGlobal, isNoSetData, isVNode, markNoSetData, mergeModels, mergeProps, mountRuntimeInstance, normalizeJsxIsland, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, provideGlobal, registerApp, registerComponent, resetWevuDefaults, resolveComponent, resolveDirective, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, takePendingRuntimeAppRegistration, teardownRuntimeInstance, transformOn, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, version, waitForLayoutHost, withDirectives };
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "6.19.4";
2
+ var version = "6.20.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -39,7 +39,7 @@ function resolveRuntimeBindingPlaceholderData(data, setData) {
39
39
  return Object.keys(resolved).length ? resolved : void 0;
40
40
  }
41
41
  function resolveInitialComputedData(options) {
42
- const { data, computed, setData } = options;
42
+ const { data, computed, methods, setData } = options;
43
43
  const computedKeys = computed ? Object.keys(computed) : [];
44
44
  if (!computedKeys.length) return;
45
45
  const { includeComputed, shouldIncludeKey, toPlainMaxDepth, toPlainMaxKeys, includeFunctions, functionPaths } = resolveSetDataOptions(setData);
@@ -85,6 +85,10 @@ function resolveInitialComputedData(options) {
85
85
  if (key === "data" || key === "$state") return data;
86
86
  if (key === "props" || key === "$props" || key === "$attrs") throw new InitialComputedBailout();
87
87
  if (hasOwn(data, key)) return Reflect.get(target, key, receiver);
88
+ if (methods && hasOwn(methods, key)) {
89
+ const method = methods[key];
90
+ return typeof method === "function" ? method.bind(proxy) : method;
91
+ }
88
92
  if (computed && hasOwn(computed, key)) {
89
93
  const computedValue = resolveComputedValue(key);
90
94
  if (computedValue.ok) return computedValue.value;
@@ -105,11 +109,12 @@ function resolveInitialComputedData(options) {
105
109
  }
106
110
  return Object.keys(resolved).length ? resolved : void 0;
107
111
  }
108
- function resolveNativeInitialData(data, computed, setData) {
112
+ function resolveNativeInitialData(data, computed, setData, methods) {
109
113
  if (!data || typeof data !== "object") return data;
110
114
  const initialComputedData = resolveInitialComputedData({
111
115
  data,
112
116
  computed,
117
+ methods,
113
118
  setData
114
119
  });
115
120
  const runtimeBindingPlaceholderData = resolveRuntimeBindingPlaceholderData(data, setData);
@@ -1 +1 @@
1
- {"version":3,"file":"initialComputed.mjs","names":[],"sources":["../../../../src/runtime/define/initialComputed.ts"],"sourcesContent":["import type { WritableComputedOptions } from '../../reactivity'\nimport type { ComputedDefinitions, SetDataSnapshotOptions } from '../types'\nimport { WEVU_SLOT_OWNER_ID_KEY } from '@weapp-core/constants'\nimport { hasOwn } from '../../utils'\nimport { resolveSetDataOptions } from '../app/setDataOptions'\nimport { toPlain } from '../diff'\n\nclass InitialComputedBailout extends Error {}\n\nfunction resolveComputedGetter(definition: unknown): ((...args: any[]) => unknown) | undefined {\n if (typeof definition === 'function') {\n return definition as (...args: any[]) => unknown\n }\n const getter = (definition as WritableComputedOptions<any> | undefined)?.get\n return typeof getter === 'function' ? getter : undefined\n}\n\nfunction isCompilerGeneratedTemplateComputedKey(key: string) {\n return key.startsWith('__wv_bind_')\n || key.startsWith('__wv_cls_')\n || key.startsWith('__wv_style_')\n}\n\nfunction canResolveInitialTemplateComputed(key: string, getter: (...args: any[]) => unknown) {\n if (!key.startsWith('__wv_bind_')) {\n return false\n }\n try {\n return !/\\bthis\\b/.test(Function.prototype.toString.call(getter))\n }\n catch {\n return false\n }\n}\n\nfunction resolveRuntimeBindingPlaceholder(key: string) {\n if (key === WEVU_SLOT_OWNER_ID_KEY) {\n return ''\n }\n if (key.startsWith('__wv_bind_')) {\n return null\n }\n if (key.startsWith('__wv_cls_') || key.startsWith('__wv_style_')) {\n return ''\n }\n}\n\nfunction resolveRuntimeBindingPlaceholderData(\n data: Record<string, any>,\n setData: SetDataSnapshotOptions | undefined,\n) {\n const pickKeys = Array.isArray(setData?.pick) ? setData.pick : []\n if (!pickKeys.length) {\n return undefined\n }\n const omitKeys = new Set(Array.isArray(setData?.omit) ? setData.omit : [])\n const resolved: Record<string, any> = {}\n for (const key of pickKeys) {\n if (omitKeys.has(key) || hasOwn(data, key)) {\n continue\n }\n const placeholder = resolveRuntimeBindingPlaceholder(key)\n if (placeholder !== undefined) {\n resolved[key] = placeholder\n }\n }\n return Object.keys(resolved).length ? resolved : undefined\n}\n\nexport function resolveInitialComputedData(options: {\n data: Record<string, any>\n computed: ComputedDefinitions | undefined\n setData: SetDataSnapshotOptions | undefined\n}) {\n const {\n data,\n computed,\n setData,\n } = options\n const computedKeys = computed ? Object.keys(computed) : []\n if (!computedKeys.length) {\n return undefined\n }\n\n const {\n includeComputed,\n shouldIncludeKey,\n toPlainMaxDepth,\n toPlainMaxKeys,\n includeFunctions,\n functionPaths,\n } = resolveSetDataOptions(setData)\n if (!includeComputed) {\n return undefined\n }\n\n const resolved: Record<string, any> = {}\n const resolving = new Set<string>()\n let proxy!: Record<string, any>\n const resolveComputedValue = (key: string): { ok: true, value: any } | { ok: false } => {\n if (hasOwn(data, key) || !shouldIncludeKey(key)) {\n return { ok: false }\n }\n if (hasOwn(resolved, key)) {\n return { ok: true, value: resolved[key] }\n }\n if (resolving.has(key)) {\n return { ok: false }\n }\n const getter = resolveComputedGetter((computed as ComputedDefinitions)[key])\n if (!getter) {\n return { ok: false }\n }\n resolving.add(key)\n try {\n const rawValue = getter.call(proxy)\n if (rawValue === undefined) {\n return { ok: false }\n }\n const value = toPlain(rawValue, new WeakMap(), {\n maxDepth: toPlainMaxDepth,\n maxKeys: toPlainMaxKeys,\n includeFunctions,\n functionPaths,\n _path: key,\n })\n if (value === undefined) {\n return { ok: false }\n }\n resolved[key] = value\n return { ok: true, value }\n }\n catch {\n return { ok: false }\n }\n finally {\n resolving.delete(key)\n }\n }\n\n proxy = new Proxy(data, {\n get(target, key, receiver) {\n if (typeof key === 'string') {\n if (key === 'data' || key === '$state') {\n return data\n }\n if (key === 'props' || key === '$props' || key === '$attrs') {\n throw new InitialComputedBailout()\n }\n if (hasOwn(data, key)) {\n return Reflect.get(target, key, receiver)\n }\n if (computed && hasOwn(computed, key)) {\n const computedValue = resolveComputedValue(key)\n if (computedValue.ok) {\n return computedValue.value\n }\n throw new InitialComputedBailout()\n }\n throw new InitialComputedBailout()\n }\n return Reflect.get(target, key, receiver)\n },\n has(target, key) {\n return Reflect.has(target, key)\n || (typeof key === 'string' && Boolean(\n computed && hasOwn(computed, key),\n ))\n },\n })\n\n for (const key of computedKeys) {\n const getter = resolveComputedGetter((computed as ComputedDefinitions)[key])\n if (isCompilerGeneratedTemplateComputedKey(key) && (!getter || !canResolveInitialTemplateComputed(key, getter))) {\n continue\n }\n resolveComputedValue(key)\n }\n\n return Object.keys(resolved).length ? resolved : undefined\n}\n\nexport function resolveNativeInitialData(\n data: unknown,\n computed: ComputedDefinitions | undefined,\n setData: SetDataSnapshotOptions | undefined,\n) {\n if (!data || typeof data !== 'object') {\n return data\n }\n const initialComputedData = resolveInitialComputedData({\n data: data as Record<string, any>,\n computed,\n setData,\n })\n const runtimeBindingPlaceholderData = resolveRuntimeBindingPlaceholderData(data as Record<string, any>, setData)\n return initialComputedData || runtimeBindingPlaceholderData\n ? {\n ...(data as Record<string, any>),\n ...runtimeBindingPlaceholderData,\n ...initialComputedData,\n }\n : data\n}\n"],"mappings":";;;;;;AAOA,IAAM,yBAAN,cAAqC,MAAM,CAAC;AAE5C,SAAS,sBAAsB,YAAgE;CAC7F,IAAI,OAAO,eAAe,YACxB,OAAO;CAET,MAAM,iEAAU,WAAyD;CACzE,OAAO,OAAO,WAAW,aAAa,SAAS;AACjD;AAEA,SAAS,uCAAuC,KAAa;CAC3D,OAAO,IAAI,WAAW,YAAY,KAC7B,IAAI,WAAW,WAAW,KAC1B,IAAI,WAAW,aAAa;AACnC;AAEA,SAAS,kCAAkC,KAAa,QAAqC;CAC3F,IAAI,CAAC,IAAI,WAAW,YAAY,GAC9B,OAAO;CAET,IAAI;EACF,OA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,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,SAAS,sBAAuB,SAAiC,IAAI;EAC3E,IAAI,uCAAuC,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,KAAK,MAAM,IAC3G;EAEF,qBAAqB,GAAG;CAC1B;CAEA,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,WAAW;AACnD;AAEA,SAAgB,yBACd,MACA,UACA,SACA;CACA,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,OAAO;CAET,MAAM,sBAAsB,2BAA2B;EAC/C;EACN;EACA;CACF,CAAC;CACD,MAAM,gCAAgC,qCAAqC,MAA6B,OAAO;CAC/G,OAAO,uBAAuB,gCAC1B;EACE,GAAI;EACJ,GAAG;EACH,GAAG;CACL,IACA;AACN"}
1
+ {"version":3,"file":"initialComputed.mjs","names":[],"sources":["../../../../src/runtime/define/initialComputed.ts"],"sourcesContent":["import type { WritableComputedOptions } from '../../reactivity'\nimport type { ComputedDefinitions, SetDataSnapshotOptions } from '../types'\nimport { WEVU_SLOT_OWNER_ID_KEY } from '@weapp-core/constants'\nimport { hasOwn } from '../../utils'\nimport { resolveSetDataOptions } from '../app/setDataOptions'\nimport { toPlain } from '../diff'\n\nclass InitialComputedBailout extends Error {}\n\nfunction resolveComputedGetter(definition: unknown): ((...args: any[]) => unknown) | undefined {\n if (typeof definition === 'function') {\n return definition as (...args: any[]) => unknown\n }\n const getter = (definition as WritableComputedOptions<any> | undefined)?.get\n return typeof getter === 'function' ? getter : undefined\n}\n\nfunction isCompilerGeneratedTemplateComputedKey(key: string) {\n return key.startsWith('__wv_bind_')\n || key.startsWith('__wv_cls_')\n || key.startsWith('__wv_style_')\n}\n\nfunction canResolveInitialTemplateComputed(key: string, getter: (...args: any[]) => unknown) {\n if (!key.startsWith('__wv_bind_')) {\n return false\n }\n try {\n return !/\\bthis\\b/.test(Function.prototype.toString.call(getter))\n }\n catch {\n return false\n }\n}\n\nfunction resolveRuntimeBindingPlaceholder(key: string) {\n if (key === WEVU_SLOT_OWNER_ID_KEY) {\n return ''\n }\n if (key.startsWith('__wv_bind_')) {\n return null\n }\n if (key.startsWith('__wv_cls_') || key.startsWith('__wv_style_')) {\n return ''\n }\n}\n\nfunction resolveRuntimeBindingPlaceholderData(\n data: Record<string, any>,\n setData: SetDataSnapshotOptions | undefined,\n) {\n const pickKeys = Array.isArray(setData?.pick) ? setData.pick : []\n if (!pickKeys.length) {\n return undefined\n }\n const omitKeys = new Set(Array.isArray(setData?.omit) ? setData.omit : [])\n const resolved: Record<string, any> = {}\n for (const key of pickKeys) {\n if (omitKeys.has(key) || hasOwn(data, key)) {\n continue\n }\n const placeholder = resolveRuntimeBindingPlaceholder(key)\n if (placeholder !== undefined) {\n resolved[key] = placeholder\n }\n }\n return Object.keys(resolved).length ? resolved : undefined\n}\n\nexport function resolveInitialComputedData(options: {\n data: Record<string, any>\n computed: ComputedDefinitions | undefined\n methods?: Record<string, any>\n setData: SetDataSnapshotOptions | undefined\n}) {\n const {\n data,\n computed,\n methods,\n setData,\n } = options\n const computedKeys = computed ? Object.keys(computed) : []\n if (!computedKeys.length) {\n return undefined\n }\n\n const {\n includeComputed,\n shouldIncludeKey,\n toPlainMaxDepth,\n toPlainMaxKeys,\n includeFunctions,\n functionPaths,\n } = resolveSetDataOptions(setData)\n if (!includeComputed) {\n return undefined\n }\n\n const resolved: Record<string, any> = {}\n const resolving = new Set<string>()\n let proxy!: Record<string, any>\n const resolveComputedValue = (key: string): { ok: true, value: any } | { ok: false } => {\n if (hasOwn(data, key) || !shouldIncludeKey(key)) {\n return { ok: false }\n }\n if (hasOwn(resolved, key)) {\n return { ok: true, value: resolved[key] }\n }\n if (resolving.has(key)) {\n return { ok: false }\n }\n const getter = resolveComputedGetter((computed as ComputedDefinitions)[key])\n if (!getter) {\n return { ok: false }\n }\n resolving.add(key)\n try {\n const rawValue = getter.call(proxy)\n if (rawValue === undefined) {\n return { ok: false }\n }\n const value = toPlain(rawValue, new WeakMap(), {\n maxDepth: toPlainMaxDepth,\n maxKeys: toPlainMaxKeys,\n includeFunctions,\n functionPaths,\n _path: key,\n })\n if (value === undefined) {\n return { ok: false }\n }\n resolved[key] = value\n return { ok: true, value }\n }\n catch {\n return { ok: false }\n }\n finally {\n resolving.delete(key)\n }\n }\n\n proxy = new Proxy(data, {\n get(target, key, receiver) {\n if (typeof key === 'string') {\n if (key === 'data' || key === '$state') {\n return data\n }\n if (key === 'props' || key === '$props' || key === '$attrs') {\n throw new InitialComputedBailout()\n }\n if (hasOwn(data, key)) {\n return Reflect.get(target, key, receiver)\n }\n if (methods && hasOwn(methods, key)) {\n const method = methods[key]\n return typeof method === 'function' ? method.bind(proxy) : method\n }\n if (computed && hasOwn(computed, key)) {\n const computedValue = resolveComputedValue(key)\n if (computedValue.ok) {\n return computedValue.value\n }\n throw new InitialComputedBailout()\n }\n throw new InitialComputedBailout()\n }\n return Reflect.get(target, key, receiver)\n },\n has(target, key) {\n return Reflect.has(target, key)\n || (typeof key === 'string' && Boolean(\n computed && hasOwn(computed, key),\n ))\n },\n })\n\n for (const key of computedKeys) {\n const getter = resolveComputedGetter((computed as ComputedDefinitions)[key])\n if (isCompilerGeneratedTemplateComputedKey(key) && (!getter || !canResolveInitialTemplateComputed(key, getter))) {\n continue\n }\n resolveComputedValue(key)\n }\n\n return Object.keys(resolved).length ? resolved : undefined\n}\n\nexport function resolveNativeInitialData(\n data: unknown,\n computed: ComputedDefinitions | undefined,\n setData: SetDataSnapshotOptions | undefined,\n methods?: Record<string, any>,\n) {\n if (!data || typeof data !== 'object') {\n return data\n }\n const initialComputedData = resolveInitialComputedData({\n data: data as Record<string, any>,\n computed,\n methods,\n setData,\n })\n const runtimeBindingPlaceholderData = resolveRuntimeBindingPlaceholderData(data as Record<string, any>, setData)\n return initialComputedData || runtimeBindingPlaceholderData\n ? {\n ...(data as Record<string, any>),\n ...runtimeBindingPlaceholderData,\n ...initialComputedData,\n }\n : data\n}\n"],"mappings":";;;;;;AAOA,IAAM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AAQ;IAE1C,IAAI,WAAW,OAAO,SAAS,GAAG,GAAG;KACnC,MAAM,SAAS,QAAQ;KACvB,OAAO,OAAO,WAAW,aAAa,OAAO,KAAK,KAAK,IAAI;IAC7D;IACA,IAAI,YAAY,OAAO,UAAU,GAAG,GAAG;KACrC,MAAM,gBAAgB,qBAAqB,GAAG;KAC9C,IAAI,cAAc,IAChB,OAAO,cAAc;KAEvB,MAAM,IAAI,uBAAuB;IACnC;IACA,MAAM,IAAI,uBAAuB;GACnC;GACA,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ;EAC1C;EACA,IAAI,QAAQ,KAAK;GACf,OAAO,QAAQ,IAAI,QAAQ,GAAG,KACxB,OAAO,QAAQ,YAAY,QAC7B,YAAY,OAAO,UAAU,GAAG,CAClC;EACJ;CACF,CAAC;CAED,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,SAAS,sBAAuB,SAAiC,IAAI;EAC3E,IAAI,uCAAuC,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,KAAK,MAAM,IAC3G;EAEF,qBAAqB,GAAG;CAC1B;CAEA,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,WAAW;AACnD;AAEA,SAAgB,yBACd,MACA,UACA,SACA,SACA;CACA,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,OAAO;CAET,MAAM,sBAAsB,2BAA2B;EAC/C;EACN;EACA;EACA;CACF,CAAC;CACD,MAAM,gCAAgC,qCAAqC,MAA6B,OAAO;CAC/G,OAAO,uBAAuB,gCAC1B;EACE,GAAI;EACJ,GAAG;EACH,GAAG;CACL,IACA;AACN"}
@@ -90,7 +90,7 @@ function defineComponent(options) {
90
90
  ...nativeData && typeof nativeData === "object" ? nativeData : {},
91
91
  [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions, resolvedSetData) ? (nativeData === null || nativeData === void 0 ? void 0 : nativeData[WEVU_SLOT_OWNER_ID_KEY]) || allocateOwnerId() : (nativeData === null || nativeData === void 0 ? void 0 : nativeData[WEVU_SLOT_OWNER_ID_KEY]) || ""
92
92
  } : nativeData;
93
- const nativeInitialData = resolveNativeInitialData(seededNativeData, computed, resolvedSetData);
93
+ const nativeInitialData = resolveNativeInitialData(seededNativeData, computed, resolvedSetData, methods);
94
94
  const mpOptionsWithProps = nativeInitialData !== void 0 ? {
95
95
  ...normalizedMpOptions,
96
96
  data: nativeInitialData
@@ -1 +1 @@
1
- {"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { InlineExpressionMap } from './register/inline'\nimport type { TemplateRefBinding } from './templateRefs'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_CREATOR_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { createApp } from './app'\nimport { applyWevuComponentDefaults, INTERNAL_DEFAULTS_SCOPE_KEY } from './defaults'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { createScopedSlotOptions } from './define/scopedSlotOptions'\nimport { applySetupResult } from './define/setupResult'\nimport { getScopedSlotHostGlobalObject } from './platform'\nimport { registerComponent, runSetupFunction } from './register'\nimport { allocateOwnerId } from './scopedSlots'\n\nlet scopedSlotCreator: (() => void) | undefined\n\nfunction ensureScopedSlotComponentGlobal() {\n const globalObject = getScopedSlotHostGlobalObject()\n if (!globalObject) {\n return\n }\n const globalRecord = globalObject as Record<string, any>\n if (scopedSlotCreator && globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] !== scopedSlotCreator) {\n globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] = scopedSlotCreator\n }\n}\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldSeedNativeSlotOwnerId(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Boolean((mpOptions as any).__wevu_isPage)\n && Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<string, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n S extends Record<string, any> | void = Record<string, any> | void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n ensureScopedSlotComponentGlobal()\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n ...mpOptions\n } = resolvedOptions\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const runtimeApp = createApp({\n data: resolvedData,\n computed,\n methods,\n setData: resolvedSetData,\n [INTERNAL_DEFAULTS_SCOPE_KEY]: 'component',\n } as any)\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext\n ? ((props, ctx) => {\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = {\n ...injected,\n ...(setupResult ?? {}),\n }\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData)\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions, resolvedSetData)\n ? (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || allocateOwnerId()\n : (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions = {\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps,\n }\n\n registerComponent(runtimeApp as any, methods ?? {}, watch as any, setupWrapper as any, mpOptionsWithProps as any)\n\n // 返回组件定义,便于外部自行注册\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n ensureScopedSlotComponentGlobal()\n const {\n properties,\n props,\n ...restOptions\n } = options\n\n const baseOptions = {\n ...restOptions,\n allowNullPropInput: (restOptions as any).allowNullPropInput ?? true,\n __wevu_allowNullPropInput: true,\n }\n\n // 将 properties 合并到 mpOptions,保持小程序属性定义\n const finalOptions = normalizeProps(baseOptions, props, properties)\n\n defineComponent(finalOptions)\n}\n\n/**\n * scoped slot 兼容组件入口(编译产物内部使用)。\n * @internal\n */\nexport function createWevuScopedSlotComponent(\n overrides?: {\n computed?: ComputedDefinitions\n inlineMap?: InlineExpressionMap\n templateRefs?: TemplateRefBinding[]\n },\n): void {\n const baseOptions = createScopedSlotOptions(overrides)\n createWevuComponent(baseOptions as any)\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AAY;EAChE,CAAC;EAEH,OAAO;CACT,KACE;CAEJ,MAAM,aAAa,OAAO,iBAAiB,aACvC,aAAa,IACb;CAEJ,MAAM,mBADuB,+BAA+B,eAChB,IACxC;EACE,GAAI,cAAc,OAAO,eAAe,WAAW,aAAa,CAAC;GAChE,yBAAyB,4BAA4B,WAAW,eAAe,6DAC3E,WAAqB,4BAA2B,gBAAgB,6DAChE,WAAqB,4BAA2B;CACvD,IACA;CACJ,MAAM,oBAAoB,yBAAyB,kBAAkB,UAAiC,eAAe;CACrH,MAAM,qBAAqB,sBAAsB,SAC7C;EACE,GAAG;EACH,MAAM;CACR,IACA;CAEJ,MAAM,mBAAmB;EACvB,MAAM;EACI;EACD;EACT,SAAS;EACT;EACA,OAAO;EACP,WAAW;CACb;CAEA,kBAAkB,YAAmB,mDAAW,CAAC,GAAG,OAAc,cAAqB,kBAAyB;CAQhH,OAAO;EAJL,gBAAgB;EAChB,gBAAgB;CAGF;AAOlB;;;;;;;AAQA,SAAgB,oBAMd,SACM;;CACN,gCAAgC;CAChC,MAAM,EACJ,YACA,OACA,GAAG,gBACD;CAEJ,MAAM,cAAc;EAClB,GAAG;EACH,2CAAqB,YAAoB,uFAAsB;EAC/D,2BAA2B;CAC7B;CAKA,gBAFqB,eAAe,aAAa,OAAO,UAE7B,CAAC;AAC9B;;;;;AAMA,SAAgB,8BACd,WAKM;CAEN,oBADoB,wBAAwB,SACd,CAAQ;AACxC;AAEA,oBAAoB;AACpB,gCAAgC"}
1
+ {"version":3,"file":"define.mjs","names":[],"sources":["../../../src/runtime/define.ts"],"sourcesContent":["import type { InlineExpressionMap } from './register/inline'\nimport type { TemplateRefBinding } from './templateRefs'\nimport type {\n ComponentPropsOptions,\n ComponentPublicInstance,\n ComputedDefinitions,\n DefineComponent,\n DefineComponentOptions,\n InferProps,\n MethodDefinitions,\n MiniProgramComponentPropertyOption,\n MiniProgramComponentRawOptions,\n ShallowUnwrapRef,\n} from './types'\nimport {\n WEVU_FUNCTION_PROP_PATHS_KEY,\n WEVU_SCOPED_SLOT_CREATOR_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_SLOT_OWNER_ID_PROP,\n WEVU_SLOT_SCOPE_KEY,\n} from '@weapp-core/constants'\nimport { hasOwn } from '../utils'\nimport { createApp } from './app'\nimport { applyWevuComponentDefaults, INTERNAL_DEFAULTS_SCOPE_KEY } from './defaults'\nimport { resolveNativeInitialData } from './define/initialComputed'\nimport { resolveVueComponentOptions } from './define/options'\nimport { applyOptionsApiProvide, resolveOptionsApiInjections } from './define/optionsApi'\nimport { normalizeProps } from './define/props'\nimport { createScopedSlotOptions } from './define/scopedSlotOptions'\nimport { applySetupResult } from './define/setupResult'\nimport { getScopedSlotHostGlobalObject } from './platform'\nimport { registerComponent, runSetupFunction } from './register'\nimport { allocateOwnerId } from './scopedSlots'\n\nlet scopedSlotCreator: (() => void) | undefined\n\nfunction ensureScopedSlotComponentGlobal() {\n const globalObject = getScopedSlotHostGlobalObject()\n if (!globalObject) {\n return\n }\n const globalRecord = globalObject as Record<string, any>\n if (scopedSlotCreator && globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] !== scopedSlotCreator) {\n globalRecord[WEVU_SCOPED_SLOT_CREATOR_KEY] = scopedSlotCreator\n }\n}\n\nfunction resolveInitialDataContext(properties: unknown, methods: MethodDefinitions | undefined) {\n const context: Record<string, unknown> = { ...(methods ?? {}) }\n if (!properties || typeof properties !== 'object') {\n return context\n }\n for (const [name, definition] of Object.entries(properties)) {\n if (definition && typeof definition === 'object' && hasOwn(definition, 'value')) {\n context[name] = (definition as Record<string, unknown>).value\n }\n }\n return context\n}\n\nfunction shouldSeedNativeSlotOwnerId(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Boolean((mpOptions as any).__wevu_isPage)\n && Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction shouldDeclareNativeSlotOwnerId(\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n return Array.isArray(setData?.pick)\n && setData.pick.includes(WEVU_SLOT_OWNER_ID_KEY)\n}\n\nfunction hasScopedSlotHostProperties(mpOptions: Record<string, any>) {\n const properties = mpOptions.properties\n return Boolean(\n properties\n && typeof properties === 'object'\n && (\n WEVU_SLOT_OWNER_ID_PROP in properties\n || WEVU_SLOT_SCOPE_KEY in properties\n ),\n )\n}\n\nfunction resolveScopedSlotHostSetData(\n mpOptions: Record<string, any>,\n setData: DefineComponentOptions<any, any, any, any, any>['setData'],\n) {\n if (setData?.strategy !== 'patch' || !hasScopedSlotHostProperties(mpOptions)) {\n return setData\n }\n return {\n ...setData,\n strategy: 'diff' as const,\n }\n}\n\n/**\n * defineComponent 返回的组件定义描述,用于手动注册或高级用法。\n */\nexport interface ComponentDefinition<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n /**\n * 内部 runtime app(高级能力使用),不对外暴露正式 API。\n * @internal\n */\n __wevu_runtime: import('./types').RuntimeApp<D, C, M>\n\n /**\n * 内部选项快照(高级能力使用),包含 data/computed/methods 等。\n * @internal\n */\n __wevu_options: {\n data: () => D\n computed: C\n methods: M\n setData: import('./types').SetDataSnapshotOptions | undefined\n watch: Record<string, any> | undefined\n setup: ((props: any, ctx: any) => any) | undefined\n mpOptions: MiniProgramComponentRawOptions\n }\n}\n\ntype SetupBindings<S> = Exclude<S, void> extends never ? Record<string, never> : Exclude<S, void>\ntype ResolveProps<P> = P extends ComponentPropsOptions ? InferProps<P> : P\n\nexport interface WevuComponentConstructor<\n Props,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> {\n new (): ComponentPublicInstance<D, C, M, Props> & ShallowUnwrapRef<RawBindings>\n}\n\nexport type WevuDefinedComponent<\n PropsOrPropOptions,\n RawBindings,\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponent<PropsOrPropOptions, RawBindings, D, C, M> & ComponentDefinition<D, C, M>\nexport interface SetupContextWithTypeProps<TypeProps> {\n props: TypeProps\n [key: string]: any\n}\nexport type SetupFunctionWithTypeProps<\n TypeProps,\n> = (\n props: TypeProps,\n ctx: SetupContextWithTypeProps<TypeProps>,\n) => Record<string, any> | void\nexport interface DefineComponentTypePropsOptions<TypeProps> {\n __typeProps: TypeProps\n setup?: SetupFunctionWithTypeProps<TypeProps>\n [key: string]: any\n}\nexport interface DefineComponentWithTypeProps<TypeProps> {\n new (): { $props: TypeProps } & Record<string, any>\n}\n\n/**\n * 按 Vue 3 风格定义一个小程序组件/页面。\n *\n * - 统一注册为 `Component()`\n *\n * @param options 组件定义项\n * @returns 可手动注册的组件定义\n *\n * @example\n * ```ts\n * defineComponent({\n * data: () => ({ count: 0 }),\n * setup() {\n * onMounted(() => console.log('已挂载'))\n * }\n * })\n * ```\n *\n * @example\n * ```ts\n * defineComponent({\n * setup() {\n * onPageScroll(() => {})\n * }\n * })\n * ```\n */\n// @ts-expect-error -- TS2589:__typeProps 签名的重载实例化深度过高。\nexport function defineComponent<\n TypeProps = any,\n>(\n options: DefineComponentTypePropsOptions<TypeProps>,\n): DefineComponentWithTypeProps<TypeProps>\nexport function defineComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n S extends Record<string, any> | void = Record<string, any> | void,\n>(\n options: DefineComponentOptions<P, D, C, M, S>,\n): WevuComponentConstructor<ResolveProps<P>, SetupBindings<S>, D, C, M> & ComponentDefinition<D, C, M>\nexport function defineComponent(\n options: DefineComponentOptions<any, any, any, any, any>,\n): WevuComponentConstructor<Record<string, any>, Record<string, any>, Record<string, any>, ComputedDefinitions, MethodDefinitions>\n & ComponentDefinition<any, any, any> {\n ensureScopedSlotComponentGlobal()\n const resolvedOptions = resolveVueComponentOptions(applyWevuComponentDefaults(options))\n const {\n __typeProps: _typeProps,\n data,\n computed,\n methods,\n setData,\n watch,\n setup,\n props,\n inject: injectOptions,\n provide: provideOptions,\n allowFunctionProps,\n ...mpOptions\n } = resolvedOptions\n\n const rawFunctionPropPaths = (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n const functionPropPaths: string[] = Array.isArray(rawFunctionPropPaths)\n ? [...new Set(rawFunctionPropPaths.filter((path: unknown): path is string => typeof path === 'string' && path.length > 0))]\n : []\n delete (mpOptions as any)[WEVU_FUNCTION_PROP_PATHS_KEY]\n\n const rawResolvedSetData = allowFunctionProps === true\n ? {\n ...(setData ?? {}),\n includeFunctions: true,\n functionPaths: functionPropPaths,\n }\n : allowFunctionProps === false\n ? setData\n : functionPropPaths.length\n ? {\n ...(setData ?? {}),\n functionPaths: functionPropPaths,\n }\n : setData\n const resolvedSetData = resolveScopedSlotHostSetData(mpOptions, rawResolvedSetData)\n const setupFunctionPropKeys = new Set(\n functionPropPaths\n .filter(path => !path.includes('.')),\n )\n\n const normalizedMpOptions = normalizeProps(mpOptions, props)\n const initialDataContext = resolveInitialDataContext(normalizedMpOptions.properties, methods)\n const resolvedData = typeof data === 'function'\n ? () => data.call(initialDataContext)\n : data\n\n const runtimeApp = createApp({\n data: resolvedData,\n computed,\n methods,\n setData: resolvedSetData,\n [INTERNAL_DEFAULTS_SCOPE_KEY]: 'component',\n } as any)\n\n const hasOptionsApiContext = injectOptions != null || provideOptions != null\n const setupWrapper = typeof setup === 'function' || hasOptionsApiContext\n ? ((props, ctx) => {\n const publicInstance = (ctx as any)?.proxy ?? (ctx as any)?.instance ?? Object.create(null)\n const injected = resolveOptionsApiInjections(injectOptions, publicInstance)\n if (provideOptions != null) {\n applyOptionsApiProvide(provideOptions, publicInstance)\n }\n const setupResult = typeof setup === 'function'\n ? runSetupFunction(setup as any, props as Record<string, any>, ctx as any) as Record<string, any> | void\n : undefined\n const result = {\n ...injected,\n ...(setupResult ?? {}),\n }\n if (ctx && Object.keys(result).length) {\n applySetupResult((ctx as any).runtime, (ctx as any).instance, result, {\n includeFunctionsInState: allowFunctionProps === true,\n functionPropPaths: allowFunctionProps === false ? undefined : setupFunctionPropKeys,\n })\n }\n return result\n }) satisfies DefineComponentOptions<ComponentPropsOptions, any, any, any, any>['setup']\n : undefined\n\n const nativeData = typeof resolvedData === 'function'\n ? resolvedData()\n : resolvedData\n const shouldDeclareOwnerId = shouldDeclareNativeSlotOwnerId(resolvedSetData)\n const seededNativeData = shouldDeclareOwnerId\n ? {\n ...(nativeData && typeof nativeData === 'object' ? nativeData : {}),\n [WEVU_SLOT_OWNER_ID_KEY]: shouldSeedNativeSlotOwnerId(mpOptions, resolvedSetData)\n ? (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || allocateOwnerId()\n : (nativeData as any)?.[WEVU_SLOT_OWNER_ID_KEY] || '',\n }\n : nativeData\n const nativeInitialData = resolveNativeInitialData(seededNativeData, computed as ComputedDefinitions, resolvedSetData, methods as Record<string, any> | undefined)\n const mpOptionsWithProps = nativeInitialData !== undefined\n ? {\n ...normalizedMpOptions,\n data: nativeInitialData,\n }\n : normalizedMpOptions\n\n const componentOptions = {\n data: resolvedData as () => Record<string, any>,\n computed: computed as ComputedDefinitions,\n methods: methods as MethodDefinitions,\n setData: resolvedSetData,\n watch,\n setup: setupWrapper,\n mpOptions: mpOptionsWithProps,\n }\n\n registerComponent(runtimeApp as any, methods ?? {}, watch as any, setupWrapper as any, mpOptionsWithProps as any)\n\n // 返回组件定义,便于外部自行注册\n const definition: ComponentDefinition<any, any, any> = {\n __wevu_runtime: runtimeApp as any,\n __wevu_options: componentOptions as ComponentDefinition<any, any, any>['__wevu_options'],\n }\n\n return definition as unknown as WevuComponentConstructor<\n ResolveProps<ComponentPropsOptions>,\n Record<string, any>,\n Record<string, any>,\n ComputedDefinitions,\n MethodDefinitions\n > & ComponentDefinition<any, any, any>\n}\n\n/**\n * 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。\n *\n * @param options 组件选项,可能包含小程序特有的 properties\n * @internal\n */\nexport function createWevuComponent<\n P extends ComponentPropsOptions = ComponentPropsOptions,\n D extends object = Record<string, any>,\n C extends ComputedDefinitions = ComputedDefinitions,\n M extends MethodDefinitions = MethodDefinitions,\n>(\n options: DefineComponentOptions<P, D, C, M> & { properties?: MiniProgramComponentPropertyOption },\n): void {\n ensureScopedSlotComponentGlobal()\n const {\n properties,\n props,\n ...restOptions\n } = options\n\n const baseOptions = {\n ...restOptions,\n allowNullPropInput: (restOptions as any).allowNullPropInput ?? true,\n __wevu_allowNullPropInput: true,\n }\n\n // 将 properties 合并到 mpOptions,保持小程序属性定义\n const finalOptions = normalizeProps(baseOptions, props, properties)\n\n defineComponent(finalOptions)\n}\n\n/**\n * scoped slot 兼容组件入口(编译产物内部使用)。\n * @internal\n */\nexport function createWevuScopedSlotComponent(\n overrides?: {\n computed?: ComputedDefinitions\n inlineMap?: InlineExpressionMap\n templateRefs?: TemplateRefBinding[]\n },\n): void {\n const baseOptions = createScopedSlotOptions(overrides)\n createWevuComponent(baseOptions as any)\n}\n\nscopedSlotCreator = createWevuScopedSlotComponent\nensureScopedSlotComponentGlobal()\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,IAAI;AAEJ,SAAS,kCAAkC;CACzC,MAAM,eAAe,8BAA8B;CACnD,IAAI,CAAC,cACH;CAEF,MAAM,eAAe;CACrB,IAAI,qBAAqB,aAAa,kCAAkC,mBACtE,aAAa,gCAAgC;AAEjD;AAEA,SAAS,0BAA0B,YAAqB,SAAwC;CAC9F,MAAM,UAAmC,EAAE,GAAI,mDAAW,CAAC,EAAG;CAC9D,IAAI,CAAC,cAAc,OAAO,eAAe,UACvC,OAAO;CAET,KAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,UAAU,GACxD,IAAI,cAAc,OAAO,eAAe,YAAY,OAAO,YAAY,OAAO,GAC5E,QAAQ,QAAS,WAAuC;CAG5D,OAAO;AACT;AAEA,SAAS,4BACP,WACA,SACA;CACA,OAAO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;EAChB,gBAAgB;CAGF;AAOlB;;;;;;;AAQA,SAAgB,oBAMd,SACM;;CACN,gCAAgC;CAChC,MAAM,EACJ,YACA,OACA,GAAG,gBACD;CAEJ,MAAM,cAAc;EAClB,GAAG;EACH,2CAAqB,YAAoB,uFAAsB;EAC/D,2BAA2B;CAC7B;CAKA,gBAFqB,eAAe,aAAa,OAAO,UAE7B,CAAC;AAC9B;;;;;AAMA,SAAgB,8BACd,WAKM;CAEN,oBADoB,wBAAwB,SACd,CAAQ;AACxC;AAEA,oBAAoB;AACpB,gCAAgC"}
@@ -0,0 +1,177 @@
1
+ import { WEVU_JSX_ISLAND_HANDLER_MAP_KEY } from "@weapp-core/constants";
2
+
3
+ //#region src/runtime/jsxIsland.ts
4
+ const Fragment = Symbol.for("wevu.jsx.fragment");
5
+ function createVNode(type, props, children) {
6
+ return {
7
+ type,
8
+ props,
9
+ children
10
+ };
11
+ }
12
+ function createTextVNode(text) {
13
+ return {
14
+ type: "text",
15
+ props: null,
16
+ children: String(text !== null && text !== void 0 ? text : "")
17
+ };
18
+ }
19
+ function isVNode(value) {
20
+ return !!value && typeof value === "object" && "type" in value;
21
+ }
22
+ function mergeProps(...sources) {
23
+ const output = {};
24
+ for (const source of sources) {
25
+ if (!source) continue;
26
+ for (const [key, value] of Object.entries(source)) if (key === "class" && output.class) output.class = [output.class, value];
27
+ else if (key === "style" && output.style) output.style = [output.style, value];
28
+ else output[key] = value;
29
+ }
30
+ return output;
31
+ }
32
+ function transformOn(events) {
33
+ const output = {};
34
+ for (const [name, handler] of Object.entries(events)) output[`on${name.charAt(0).toUpperCase()}${name.slice(1)}`] = handler;
35
+ return output;
36
+ }
37
+ function resolveComponent(name) {
38
+ return name;
39
+ }
40
+ const vShow = "show";
41
+ const vModelText = "model-text";
42
+ const vModelCheckbox = "model-checkbox";
43
+ const vModelRadio = "model-radio";
44
+ const vModelSelect = "model-select";
45
+ function withDirectives(vnode, directives) {
46
+ var _vnode$props;
47
+ const props = { ...(_vnode$props = vnode.props) !== null && _vnode$props !== void 0 ? _vnode$props : {} };
48
+ for (const raw of directives) {
49
+ if (!Array.isArray(raw)) continue;
50
+ const [directive, value, argument] = raw;
51
+ if (directive === "show") {
52
+ props.hidden = !value;
53
+ continue;
54
+ }
55
+ if (directive === "model-text" || directive === "model-checkbox" || directive === "model-radio" || directive === "model-select") {
56
+ const modelName = typeof argument === "string" && argument ? argument : "modelValue";
57
+ const updater = props[`onUpdate:${modelName}`];
58
+ props[modelName === "modelValue" ? "value" : modelName] = value;
59
+ if (typeof updater === "function") {
60
+ const eventName = directive === "model-text" ? "onInput" : "onChange";
61
+ props[eventName] = (event) => {
62
+ var _event$detail$value, _event$detail;
63
+ return updater((_event$detail$value = event === null || event === void 0 || (_event$detail = event.detail) === null || _event$detail === void 0 ? void 0 : _event$detail.value) !== null && _event$detail$value !== void 0 ? _event$detail$value : event === null || event === void 0 ? void 0 : event.detail);
64
+ };
65
+ }
66
+ }
67
+ }
68
+ return {
69
+ ...vnode,
70
+ props
71
+ };
72
+ }
73
+ function resolveDirective(name) {
74
+ return name;
75
+ }
76
+ function eventNameFromProp(name) {
77
+ if (!/^on[A-Z]/.test(name)) return;
78
+ return name.slice(2).toLowerCase();
79
+ }
80
+ function getHandlerMap(target) {
81
+ const existing = target === null || target === void 0 ? void 0 : target[WEVU_JSX_ISLAND_HANDLER_MAP_KEY];
82
+ if (existing && typeof existing === "object") return existing;
83
+ const next = Object.create(null);
84
+ if (target && (typeof target === "object" || typeof target === "function")) Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {
85
+ value: next,
86
+ configurable: true,
87
+ writable: true
88
+ });
89
+ return next;
90
+ }
91
+ function normalizeChildren(value, target, islandId, seed, adapters) {
92
+ const resolved = typeof value === "function" ? value() : value;
93
+ if (resolved == null || resolved === false || resolved === true) return [];
94
+ if (Array.isArray(resolved)) return resolved.flatMap((item) => normalizeChildren(item, target, islandId, seed, adapters));
95
+ if (typeof resolved === "object" && !isVNode(resolved)) return normalizeChildren(resolved.default, target, islandId, seed, adapters);
96
+ const node = normalizeNode(resolved, target, islandId, seed, adapters);
97
+ return node ? [node] : [];
98
+ }
99
+ function normalizeNode(value, target, islandId, seed, adapters) {
100
+ var _value$props3;
101
+ if (value == null || value === false || value === true) return;
102
+ if (Array.isArray(value)) return {
103
+ kind: "fragment",
104
+ children: normalizeChildren(value, target, islandId, seed, adapters)
105
+ };
106
+ if (typeof value === "string" || typeof value === "number") return {
107
+ kind: "text",
108
+ text: String(value)
109
+ };
110
+ if (!isVNode(value)) return {
111
+ kind: "text",
112
+ text: String(value)
113
+ };
114
+ if (value.type === Fragment) return {
115
+ kind: "fragment",
116
+ children: normalizeChildren(value.children, target, islandId, seed, adapters)
117
+ };
118
+ if (value.type === "text") {
119
+ var _value$children;
120
+ return {
121
+ kind: "text",
122
+ text: String((_value$children = value.children) !== null && _value$children !== void 0 ? _value$children : "")
123
+ };
124
+ }
125
+ if (typeof value.type === "function") {
126
+ var _value$props;
127
+ return normalizeNode(value.type((_value$props = value.props) !== null && _value$props !== void 0 ? _value$props : {}, value.children), target, islandId, seed, adapters);
128
+ }
129
+ if (value.type && typeof value.type === "object" && typeof value.type.render === "function") {
130
+ var _value$props2;
131
+ return normalizeNode(value.type.render.call((_value$props2 = value.props) !== null && _value$props2 !== void 0 ? _value$props2 : {}), target, islandId, seed, adapters);
132
+ }
133
+ const tag = typeof value.type === "string" ? value.type : void 0;
134
+ if (!tag) return;
135
+ const props = {};
136
+ const events = {};
137
+ const handlers = getHandlerMap(target);
138
+ for (const [name, raw] of Object.entries((_value$props3 = value.props) !== null && _value$props3 !== void 0 ? _value$props3 : {})) {
139
+ const eventName = eventNameFromProp(name);
140
+ if (eventName && typeof raw === "function") {
141
+ const handlerId = `${islandId}:${seed.value++}`;
142
+ handlers[handlerId] = raw;
143
+ events[eventName] = handlerId;
144
+ continue;
145
+ }
146
+ if (typeof raw === "function" || raw === void 0) continue;
147
+ if (name === "class" || name === "className") props.class = adapters.normalizeClass(raw);
148
+ else if (name === "style") props.style = adapters.normalizeStyle(raw);
149
+ else props[name] = raw;
150
+ }
151
+ return {
152
+ kind: "element",
153
+ tag,
154
+ props,
155
+ events,
156
+ children: normalizeChildren(value.children, target, islandId, seed, adapters)
157
+ };
158
+ }
159
+ function normalizeJsxIsland(value, islandId, adapters) {
160
+ var _normalizeNode;
161
+ const handlers = getHandlerMap(this);
162
+ for (const key of Object.keys(handlers)) if (key.startsWith(`${islandId}:`)) delete handlers[key];
163
+ return (_normalizeNode = normalizeNode(value, this, islandId, { value: 0 }, adapters)) !== null && _normalizeNode !== void 0 ? _normalizeNode : null;
164
+ }
165
+ function runJsxIslandHandler(target, event) {
166
+ var _event$currentTarget$, _event$currentTarget, _event$target, _target$WEVU_JSX_ISLA, _runtime$proxy, _runtime$proxy2;
167
+ const handlerId = (_event$currentTarget$ = event === null || event === void 0 || (_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || (_event$currentTarget = _event$currentTarget.dataset) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.wvJsxHandler) !== null && _event$currentTarget$ !== void 0 ? _event$currentTarget$ : event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 || (_event$target = _event$target.dataset) === null || _event$target === void 0 ? void 0 : _event$target.wvJsxHandler;
168
+ if (typeof handlerId !== "string" || !handlerId) return;
169
+ const runtime = target === null || target === void 0 ? void 0 : target.__wevu;
170
+ const handlers = (_target$WEVU_JSX_ISLA = target === null || target === void 0 ? void 0 : target[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]) !== null && _target$WEVU_JSX_ISLA !== void 0 ? _target$WEVU_JSX_ISLA : runtime === null || runtime === void 0 || (_runtime$proxy = runtime.proxy) === null || _runtime$proxy === void 0 ? void 0 : _runtime$proxy[WEVU_JSX_ISLAND_HANDLER_MAP_KEY];
171
+ const handler = handlers === null || handlers === void 0 ? void 0 : handlers[handlerId];
172
+ return typeof handler === "function" ? handler.call((_runtime$proxy2 = runtime === null || runtime === void 0 ? void 0 : runtime.proxy) !== null && _runtime$proxy2 !== void 0 ? _runtime$proxy2 : target, event) : void 0;
173
+ }
174
+
175
+ //#endregion
176
+ export { Fragment, createTextVNode, createVNode, isVNode, mergeProps, normalizeJsxIsland, resolveComponent, resolveDirective, runJsxIslandHandler, transformOn, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, withDirectives };
177
+ //# sourceMappingURL=jsxIsland.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsxIsland.mjs","names":["slots"],"sources":["../../../src/runtime/jsxIsland.ts"],"sourcesContent":["import { WEVU_JSX_ISLAND_HANDLER_MAP_KEY } from '@weapp-core/constants'\n\nexport const Fragment = Symbol.for('wevu.jsx.fragment')\n\nexport interface WevuJsxVNode {\n children?: unknown\n props?: Record<string, any> | null\n type: unknown\n}\n\nexport interface WevuJsxIslandNode {\n children?: WevuJsxIslandNode[]\n events?: Record<string, string>\n kind: 'element' | 'fragment' | 'text'\n props?: Record<string, any>\n tag?: string\n text?: string\n}\n\nexport interface WevuJsxIslandAdapters {\n normalizeClass: (value: unknown) => string\n normalizeStyle: (value: unknown) => string\n}\n\nexport function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode {\n return { type, props, children }\n}\n\nexport function createTextVNode(text: unknown): WevuJsxVNode {\n return { type: 'text', props: null, children: String(text ?? '') }\n}\n\nexport function isVNode(value: unknown): value is WevuJsxVNode {\n return !!value && typeof value === 'object' && 'type' in value\n}\n\nexport function mergeProps(...sources: Array<Record<string, any> | null | undefined>) {\n const output: Record<string, any> = {}\n for (const source of sources) {\n if (!source) {\n continue\n }\n for (const [key, value] of Object.entries(source)) {\n if (key === 'class' && output.class) {\n output.class = [output.class, value]\n }\n else if (key === 'style' && output.style) {\n output.style = [output.style, value]\n }\n else {\n output[key] = value\n }\n }\n }\n return output\n}\n\nexport function transformOn(events: Record<string, unknown>) {\n const output: Record<string, unknown> = {}\n for (const [name, handler] of Object.entries(events)) {\n output[`on${name.charAt(0).toUpperCase()}${name.slice(1)}`] = handler\n }\n return output\n}\n\nexport function resolveComponent(name: string) {\n return name\n}\n\nexport const vShow = 'show'\nexport const vModelText = 'model-text'\nexport const vModelCheckbox = 'model-checkbox'\nexport const vModelRadio = 'model-radio'\nexport const vModelSelect = 'model-select'\n\nexport function withDirectives(vnode: WevuJsxVNode, directives: unknown[]) {\n const props = { ...(vnode.props ?? {}) }\n for (const raw of directives) {\n if (!Array.isArray(raw)) {\n continue\n }\n const [directive, value, argument] = raw\n if (directive === vShow) {\n props.hidden = !value\n continue\n }\n if (\n directive === vModelText\n || directive === vModelCheckbox\n || directive === vModelRadio\n || directive === vModelSelect\n ) {\n const modelName = typeof argument === 'string' && argument ? argument : 'modelValue'\n const updater = props[`onUpdate:${modelName}`]\n props[modelName === 'modelValue' ? 'value' : modelName] = value\n if (typeof updater === 'function') {\n const eventName = directive === vModelText ? 'onInput' : 'onChange'\n props[eventName] = (event: any) => updater(event?.detail?.value ?? event?.detail)\n }\n }\n }\n return { ...vnode, props }\n}\n\nexport function resolveDirective(name: string) {\n return name\n}\n\nfunction eventNameFromProp(name: string) {\n if (!/^on[A-Z]/.test(name)) {\n return undefined\n }\n return name.slice(2).toLowerCase()\n}\n\nfunction getHandlerMap(target: any): Record<string, (...args: any[]) => any> {\n const existing = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n if (existing && typeof existing === 'object') {\n return existing\n }\n const next: Record<string, (...args: any[]) => any> = Object.create(null)\n if (target && (typeof target === 'object' || typeof target === 'function')) {\n Object.defineProperty(target, WEVU_JSX_ISLAND_HANDLER_MAP_KEY, {\n value: next,\n configurable: true,\n writable: true,\n })\n }\n return next\n}\n\nfunction normalizeChildren(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode[] {\n const resolved = typeof value === 'function' ? value() : value\n if (resolved == null || resolved === false || resolved === true) {\n return []\n }\n if (Array.isArray(resolved)) {\n return resolved.flatMap(item => normalizeChildren(item, target, islandId, seed, adapters))\n }\n if (typeof resolved === 'object' && !isVNode(resolved)) {\n const slots = resolved as Record<string, unknown>\n return normalizeChildren(slots.default, target, islandId, seed, adapters)\n }\n // eslint-disable-next-line ts/no-use-before-define\n const node = normalizeNode(resolved, target, islandId, seed, adapters)\n return node ? [node] : []\n}\n\nfunction normalizeNode(\n value: unknown,\n target: any,\n islandId: string,\n seed: { value: number },\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | undefined {\n if (value == null || value === false || value === true) {\n return undefined\n }\n if (Array.isArray(value)) {\n return { kind: 'fragment', children: normalizeChildren(value, target, islandId, seed, adapters) }\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return { kind: 'text', text: String(value) }\n }\n if (!isVNode(value)) {\n return { kind: 'text', text: String(value) }\n }\n if (value.type === Fragment) {\n return { kind: 'fragment', children: normalizeChildren(value.children, target, islandId, seed, adapters) }\n }\n if (value.type === 'text') {\n return { kind: 'text', text: String(value.children ?? '') }\n }\n if (typeof value.type === 'function') {\n return normalizeNode(value.type(value.props ?? {}, value.children), target, islandId, seed, adapters)\n }\n if (value.type && typeof value.type === 'object' && typeof (value.type as any).render === 'function') {\n return normalizeNode((value.type as any).render.call(value.props ?? {}), target, islandId, seed, adapters)\n }\n const tag = typeof value.type === 'string' ? value.type : undefined\n if (!tag) {\n return undefined\n }\n\n const props: Record<string, any> = {}\n const events: Record<string, string> = {}\n const handlers = getHandlerMap(target)\n for (const [name, raw] of Object.entries(value.props ?? {})) {\n const eventName = eventNameFromProp(name)\n if (eventName && typeof raw === 'function') {\n const handlerId = `${islandId}:${seed.value++}`\n handlers[handlerId] = raw\n events[eventName] = handlerId\n continue\n }\n if (typeof raw === 'function' || raw === undefined) {\n continue\n }\n if (name === 'class' || name === 'className') {\n props.class = adapters.normalizeClass(raw)\n }\n else if (name === 'style') {\n props.style = adapters.normalizeStyle(raw)\n }\n else {\n props[name] = raw\n }\n }\n return {\n kind: 'element',\n tag,\n props,\n events,\n children: normalizeChildren(value.children, target, islandId, seed, adapters),\n }\n}\n\nexport function normalizeJsxIsland(\n this: any,\n value: unknown,\n islandId: string,\n adapters: WevuJsxIslandAdapters,\n): WevuJsxIslandNode | null {\n const handlers = getHandlerMap(this)\n for (const key of Object.keys(handlers)) {\n if (key.startsWith(`${islandId}:`)) {\n delete handlers[key]\n }\n }\n return normalizeNode(value, this, islandId, { value: 0 }, adapters) ?? null\n}\n\nexport function runJsxIslandHandler(target: any, event: any) {\n const handlerId = event?.currentTarget?.dataset?.wvJsxHandler ?? event?.target?.dataset?.wvJsxHandler\n if (typeof handlerId !== 'string' || !handlerId) {\n return undefined\n }\n const runtime = target?.__wevu\n const handlers = target?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n ?? runtime?.proxy?.[WEVU_JSX_ISLAND_HANDLER_MAP_KEY]\n const handler = handlers?.[handlerId]\n return typeof handler === 'function' ? handler.call(runtime?.proxy ?? target, event) : undefined\n}\n"],"mappings":";;;AAEA,MAAa,WAAW,OAAO,IAAI,mBAAmB;AAsBtD,SAAgB,YAAY,MAAe,OAAoC,UAAkC;CAC/G,OAAO;EAAE;EAAM;EAAO;CAAS;AACjC;AAEA,SAAgB,gBAAgB,MAA6B;CAC3D,OAAO;EAAE,MAAM;EAAQ,OAAO;EAAM,UAAU,OAAO,0CAAQ,EAAE;CAAE;AACnE;AAEA,SAAgB,QAAQ,OAAuC;CAC7D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,UAAU;AAC3D;AAEA,SAAgB,WAAW,GAAG,SAAwD;CACpF,MAAM,SAA8B,CAAC;CACrC,KAAK,MAAM,UAAU,SAAS;EAC5B,IAAI,CAAC,QACH;EAEF,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,QAAQ,WAAW,OAAO,OAC5B,OAAO,QAAQ,CAAC,OAAO,OAAO,KAAK;OAEhC,IAAI,QAAQ,WAAW,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I;CACnC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,IAAI,IAAI,WAAW,GAAG,SAAS,EAAE,GAC/B,OAAO,SAAS;CAGpB,yBAAO,cAAc,OAAO,MAAM,UAAU,EAAE,OAAO,EAAE,GAAG,QAAQ,4DAAK;AACzE;AAEA,SAAgB,oBAAoB,QAAa,OAAY;;CAC3D,MAAM,mGAAY,MAAO,2GAAe,qFAAS,4IAAgB,MAAO,+EAAQ,uEAAS;CACzF,IAAI,OAAO,cAAc,YAAY,CAAC,WACpC;CAEF,MAAM,0DAAU,OAAQ;CACxB,MAAM,oFAAW,OAAS,qKACrB,QAAS,uEAAQ;CACtB,MAAM,8DAAU,SAAW;CAC3B,OAAO,OAAO,YAAY,aAAa,QAAQ,0EAAK,QAAS,kEAAS,QAAQ,KAAK,IAAI;AACzF"}
@@ -1,6 +1,7 @@
1
1
  import { parseModelEventValue } from "../../internal.mjs";
2
2
  import { runInlineExpression } from "../inline.mjs";
3
- import { WEVU_INLINE_HANDLER, WEVU_INLINE_MAP_KEY, WEVU_MODEL_HANDLER, WEVU_NATIVE_INSTANCE_KEY, WEVU_OWNER_HANDLER, WEVU_RESERVED_METHOD_PREFIX, WEVU_RUNTIME_KEY } from "@weapp-core/constants";
3
+ import { runJsxIslandHandler } from "../../jsxIsland.mjs";
4
+ import { WEVU_INLINE_HANDLER, WEVU_INLINE_MAP_KEY, WEVU_JSX_ISLAND_HANDLER, WEVU_MODEL_HANDLER, WEVU_NATIVE_INSTANCE_KEY, WEVU_OWNER_HANDLER, WEVU_RESERVED_METHOD_PREFIX, WEVU_RUNTIME_KEY } from "@weapp-core/constants";
4
5
 
5
6
  //#region src/runtime/register/component/methods.ts
6
7
  function createComponentMethods(options) {
@@ -24,6 +25,9 @@ function createComponentMethods(options) {
24
25
  runtime.bindModel(path).update(value);
25
26
  } catch (_unused) {}
26
27
  };
28
+ if (!finalMethods[WEVU_JSX_ISLAND_HANDLER]) finalMethods[WEVU_JSX_ISLAND_HANDLER] = function __weapp_vite_jsx_island(event) {
29
+ return runJsxIslandHandler(this, event);
30
+ };
27
31
  if (!finalMethods[WEVU_OWNER_HANDLER] && typeof (runtimeMethods === null || runtimeMethods === void 0 ? void 0 : runtimeMethods[WEVU_OWNER_HANDLER]) === "function") finalMethods[WEVU_OWNER_HANDLER] = runtimeMethods[WEVU_OWNER_HANDLER];
28
32
  const methodNames = Object.keys(runtimeMethods !== null && runtimeMethods !== void 0 ? runtimeMethods : {});
29
33
  function resolveRuntime(instance) {
@@ -1 +1 @@
1
- {"version":3,"file":"methods.mjs","names":[],"sources":["../../../../../src/runtime/register/component/methods.ts"],"sourcesContent":["import type { InternalRuntimeState, MethodDefinitions } from '../../types'\nimport {\n WEVU_INLINE_HANDLER,\n WEVU_INLINE_MAP_KEY,\n WEVU_MODEL_HANDLER,\n WEVU_NATIVE_INSTANCE_KEY,\n WEVU_OWNER_HANDLER,\n WEVU_RESERVED_METHOD_PREFIX,\n WEVU_RUNTIME_KEY,\n} from '@weapp-core/constants'\nimport { parseModelEventValue } from '../../internal'\nimport { runInlineExpression } from '../inline'\n\nexport function createComponentMethods(options: {\n userMethods: Record<string, (...args: any[]) => any>\n runtimeMethods: MethodDefinitions\n}) {\n const { userMethods, runtimeMethods } = options\n const finalMethods: Record<string, (...args: any[]) => any> = {\n ...userMethods,\n }\n\n if (!finalMethods[WEVU_INLINE_HANDLER]) {\n finalMethods[WEVU_INLINE_HANDLER] = function __weapp_vite_inline(this: InternalRuntimeState, event: any) {\n const runtime = (this as any).__wevu\n const ctx = runtime?.proxy ?? this\n const inlineMap = runtime?.methods?.[WEVU_INLINE_MAP_KEY]\n return runInlineExpression(ctx, undefined, event, inlineMap)\n }\n }\n\n if (!finalMethods[WEVU_MODEL_HANDLER]) {\n finalMethods[WEVU_MODEL_HANDLER] = function __weapp_vite_model(this: InternalRuntimeState, event: any) {\n const path = event?.currentTarget?.dataset?.wvModel ?? event?.target?.dataset?.wvModel\n if (typeof path !== 'string' || !path) {\n return undefined\n }\n const runtime = (this as any).__wevu\n if (!runtime || typeof runtime.bindModel !== 'function') {\n return undefined\n }\n const value = parseModelEventValue(event)\n try {\n runtime.bindModel(path).update(value)\n }\n catch {\n // 忽略异常\n }\n return undefined\n }\n }\n\n if (!finalMethods[WEVU_OWNER_HANDLER] && typeof (runtimeMethods as any)?.[WEVU_OWNER_HANDLER] === 'function') {\n finalMethods[WEVU_OWNER_HANDLER] = (runtimeMethods as any)[WEVU_OWNER_HANDLER]\n }\n\n const methodNames = Object.keys(runtimeMethods ?? {})\n\n function resolveRuntime(instance: InternalRuntimeState) {\n const directRuntime = (instance as any).__wevu\n if (directRuntime) {\n return directRuntime\n }\n const runtimeState = (instance as any).$state\n if (runtimeState && typeof runtimeState === 'object') {\n return (runtimeState as any)[WEVU_RUNTIME_KEY]\n }\n return undefined\n }\n\n function syncRuntimeNativeInstance(runtime: any, instance: InternalRuntimeState) {\n if (runtime?.proxy === instance) {\n return\n }\n const runtimeProxy = runtime?.proxy as Record<string, any> | undefined\n const isBridgeMethod = (\n methodName: 'triggerEvent' | 'createSelectorQuery' | 'createIntersectionObserver' | 'setData',\n ) => {\n const instanceMethod = (instance as any)[methodName]\n if (typeof instanceMethod !== 'function') {\n return false\n }\n const proxyMethod = runtimeProxy?.[methodName]\n return typeof proxyMethod === 'function' && instanceMethod === proxyMethod\n }\n if (\n isBridgeMethod('triggerEvent')\n || isBridgeMethod('createSelectorQuery')\n || isBridgeMethod('createIntersectionObserver')\n || isBridgeMethod('setData')\n ) {\n return\n }\n const hasNativeApis = typeof (instance as any).triggerEvent === 'function'\n || typeof (instance as any).createSelectorQuery === 'function'\n || typeof (instance as any).createIntersectionObserver === 'function'\n || typeof (instance as any).setData === 'function'\n if (!hasNativeApis) {\n return\n }\n const runtimeState = runtime?.state\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n if ((instance as any).$state === runtimeState) {\n return\n }\n try {\n Object.defineProperty(runtimeState, WEVU_NATIVE_INSTANCE_KEY, {\n value: instance,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(runtimeState as any)[WEVU_NATIVE_INSTANCE_KEY] = instance\n }\n }\n\n for (const methodName of methodNames) {\n if (\n methodName === WEVU_INLINE_MAP_KEY\n || methodName.startsWith(WEVU_RESERVED_METHOD_PREFIX)\n ) {\n continue\n }\n const userMethod = finalMethods[methodName]\n finalMethods[methodName] = function componentMethod(this: InternalRuntimeState, ...args: any[]) {\n const runtime = resolveRuntime(this)\n // 事件/方法实际调用时 this 可能是 DevTools 或平台包装后的实例,\n // 这里实时同步,避免 mounted 时缓存的实例与当前调用实例不一致。\n syncRuntimeNativeInstance(runtime, this)\n let result: unknown\n const bound = runtime?.methods?.[methodName]\n if (bound) {\n result = bound.apply(runtime.proxy, args)\n }\n if (typeof userMethod === 'function') {\n const userResult = userMethod.apply(this, args)\n return userResult === undefined ? result : userResult\n }\n return result\n }\n }\n\n return {\n finalMethods,\n }\n}\n"],"mappings":";;;;;AAaA,SAAgB,uBAAuB,SAGpC;CACD,MAAM,EAAE,aAAa,mBAAmB;CACxC,MAAM,eAAwD,EAC5D,GAAG,YACL;CAEA,IAAI,CAAC,aAAa,sBAChB,aAAa,uBAAuB,SAAS,oBAAgD,OAAY;;EACvG,MAAM,UAAW,KAAa;EAC9B,MAAM,0EAAM,QAAS,gEAAS;EAC9B,MAAM,0EAAY,QAAS,6EAAU;EACrC,OAAO,oBAAoB,KAAK,QAAW,OAAO,SAAS;CAC7D;CAGF,IAAI,CAAC,aAAa,qBAChB,aAAa,sBAAsB,SAAS,mBAA+C,OAAY;;EACrG,MAAM,8FAAO,MAAO,2GAAe,qFAAS,uIAAW,MAAO,+EAAQ,uEAAS;EAC/E,IAAI,OAAO,SAAS,YAAY,CAAC,MAC/B;EAEF,MAAM,UAAW,KAAa;EAC9B,IAAI,CAAC,WAAW,OAAO,QAAQ,cAAc,YAC3C;EAEF,MAAM,QAAQ,qBAAqB,KAAK;EACxC,IAAI;GACF,QAAQ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AA4C,GAAG,MAAa;;GAC9F,MAAM,UAAU,eAAe,IAAI;GAGnC,0BAA0B,SAAS,IAAI;GACvC,IAAI;GACJ,MAAM,uEAAQ,QAAS,+EAAU;GACjC,IAAI,OACF,SAAS,MAAM,MAAM,QAAQ,OAAO,IAAI;GAE1C,IAAI,OAAO,eAAe,YAAY;IACpC,MAAM,aAAa,WAAW,MAAM,MAAM,IAAI;IAC9C,OAAO,eAAe,SAAY,SAAS;GAC7C;GACA,OAAO;EACT;CACF;CAEA,OAAO,EACL,aACF;AACF"}
1
+ {"version":3,"file":"methods.mjs","names":[],"sources":["../../../../../src/runtime/register/component/methods.ts"],"sourcesContent":["import type { InternalRuntimeState, MethodDefinitions } from '../../types'\nimport {\n WEVU_INLINE_HANDLER,\n WEVU_INLINE_MAP_KEY,\n WEVU_JSX_ISLAND_HANDLER,\n WEVU_MODEL_HANDLER,\n WEVU_NATIVE_INSTANCE_KEY,\n WEVU_OWNER_HANDLER,\n WEVU_RESERVED_METHOD_PREFIX,\n WEVU_RUNTIME_KEY,\n} from '@weapp-core/constants'\nimport { parseModelEventValue } from '../../internal'\nimport { runJsxIslandHandler } from '../../jsxIsland'\nimport { runInlineExpression } from '../inline'\n\nexport function createComponentMethods(options: {\n userMethods: Record<string, (...args: any[]) => any>\n runtimeMethods: MethodDefinitions\n}) {\n const { userMethods, runtimeMethods } = options\n const finalMethods: Record<string, (...args: any[]) => any> = {\n ...userMethods,\n }\n\n if (!finalMethods[WEVU_INLINE_HANDLER]) {\n finalMethods[WEVU_INLINE_HANDLER] = function __weapp_vite_inline(this: InternalRuntimeState, event: any) {\n const runtime = (this as any).__wevu\n const ctx = runtime?.proxy ?? this\n const inlineMap = runtime?.methods?.[WEVU_INLINE_MAP_KEY]\n return runInlineExpression(ctx, undefined, event, inlineMap)\n }\n }\n\n if (!finalMethods[WEVU_MODEL_HANDLER]) {\n finalMethods[WEVU_MODEL_HANDLER] = function __weapp_vite_model(this: InternalRuntimeState, event: any) {\n const path = event?.currentTarget?.dataset?.wvModel ?? event?.target?.dataset?.wvModel\n if (typeof path !== 'string' || !path) {\n return undefined\n }\n const runtime = (this as any).__wevu\n if (!runtime || typeof runtime.bindModel !== 'function') {\n return undefined\n }\n const value = parseModelEventValue(event)\n try {\n runtime.bindModel(path).update(value)\n }\n catch {\n // 忽略异常\n }\n return undefined\n }\n }\n\n if (!finalMethods[WEVU_JSX_ISLAND_HANDLER]) {\n finalMethods[WEVU_JSX_ISLAND_HANDLER] = function __weapp_vite_jsx_island(this: InternalRuntimeState, event: any) {\n return runJsxIslandHandler(this, event)\n }\n }\n\n if (!finalMethods[WEVU_OWNER_HANDLER] && typeof (runtimeMethods as any)?.[WEVU_OWNER_HANDLER] === 'function') {\n finalMethods[WEVU_OWNER_HANDLER] = (runtimeMethods as any)[WEVU_OWNER_HANDLER]\n }\n\n const methodNames = Object.keys(runtimeMethods ?? {})\n\n function resolveRuntime(instance: InternalRuntimeState) {\n const directRuntime = (instance as any).__wevu\n if (directRuntime) {\n return directRuntime\n }\n const runtimeState = (instance as any).$state\n if (runtimeState && typeof runtimeState === 'object') {\n return (runtimeState as any)[WEVU_RUNTIME_KEY]\n }\n return undefined\n }\n\n function syncRuntimeNativeInstance(runtime: any, instance: InternalRuntimeState) {\n if (runtime?.proxy === instance) {\n return\n }\n const runtimeProxy = runtime?.proxy as Record<string, any> | undefined\n const isBridgeMethod = (\n methodName: 'triggerEvent' | 'createSelectorQuery' | 'createIntersectionObserver' | 'setData',\n ) => {\n const instanceMethod = (instance as any)[methodName]\n if (typeof instanceMethod !== 'function') {\n return false\n }\n const proxyMethod = runtimeProxy?.[methodName]\n return typeof proxyMethod === 'function' && instanceMethod === proxyMethod\n }\n if (\n isBridgeMethod('triggerEvent')\n || isBridgeMethod('createSelectorQuery')\n || isBridgeMethod('createIntersectionObserver')\n || isBridgeMethod('setData')\n ) {\n return\n }\n const hasNativeApis = typeof (instance as any).triggerEvent === 'function'\n || typeof (instance as any).createSelectorQuery === 'function'\n || typeof (instance as any).createIntersectionObserver === 'function'\n || typeof (instance as any).setData === 'function'\n if (!hasNativeApis) {\n return\n }\n const runtimeState = runtime?.state\n if (!runtimeState || typeof runtimeState !== 'object') {\n return\n }\n if ((instance as any).$state === runtimeState) {\n return\n }\n try {\n Object.defineProperty(runtimeState, WEVU_NATIVE_INSTANCE_KEY, {\n value: instance,\n configurable: true,\n enumerable: false,\n writable: true,\n })\n }\n catch {\n ;(runtimeState as any)[WEVU_NATIVE_INSTANCE_KEY] = instance\n }\n }\n\n for (const methodName of methodNames) {\n if (\n methodName === WEVU_INLINE_MAP_KEY\n || methodName.startsWith(WEVU_RESERVED_METHOD_PREFIX)\n ) {\n continue\n }\n const userMethod = finalMethods[methodName]\n finalMethods[methodName] = function componentMethod(this: InternalRuntimeState, ...args: any[]) {\n const runtime = resolveRuntime(this)\n // 事件/方法实际调用时 this 可能是 DevTools 或平台包装后的实例,\n // 这里实时同步,避免 mounted 时缓存的实例与当前调用实例不一致。\n syncRuntimeNativeInstance(runtime, this)\n let result: unknown\n const bound = runtime?.methods?.[methodName]\n if (bound) {\n result = bound.apply(runtime.proxy, args)\n }\n if (typeof userMethod === 'function') {\n const userResult = userMethod.apply(this, args)\n return userResult === undefined ? result : userResult\n }\n return result\n }\n }\n\n return {\n finalMethods,\n }\n}\n"],"mappings":";;;;;;AAeA,SAAgB,uBAAuB,SAGpC;CACD,MAAM,EAAE,aAAa,mBAAmB;CACxC,MAAM,eAAwD,EAC5D,GAAG,YACL;CAEA,IAAI,CAAC,aAAa,sBAChB,aAAa,uBAAuB,SAAS,oBAAgD,OAAY;;EACvG,MAAM,UAAW,KAAa;EAC9B,MAAM,0EAAM,QAAS,gEAAS;EAC9B,MAAM,0EAAY,QAAS,6EAAU;EACrC,OAAO,oBAAoB,KAAK,QAAW,OAAO,SAAS;CAC7D;CAGF,IAAI,CAAC,aAAa,qBAChB,aAAa,sBAAsB,SAAS,mBAA+C,OAAY;;EACrG,MAAM,8FAAO,MAAO,2GAAe,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C;EAEF,IAAK,SAAiB,WAAW,cAC/B;EAEF,IAAI;GACF,OAAO,eAAe,cAAc,0BAA0B;IAC5D,OAAO;IACP,cAAc;IACd,YAAY;IACZ,UAAU;GACZ,CAAC;EACH,mBACM;GACH,AAAC,aAAqB,4BAA4B;EACrD;CACF;CAEA,KAAK,MAAM,cAAc,aAAa;EACpC,IACE,eAAe,uBACZ,WAAW,WAAW,2BAA2B,GAEpD;EAEF,MAAM,aAAa,aAAa;EAChC,aAAa,cAAc,SAAS,gBAA4C,GAAG,MAAa;;GAC9F,MAAM,UAAU,eAAe,IAAI;GAGnC,0BAA0B,SAAS,IAAI;GACvC,IAAI;GACJ,MAAM,uEAAQ,QAAS,+EAAU;GACjC,IAAI,OACF,SAAS,MAAM,MAAM,QAAQ,OAAO,IAAI;GAE1C,IAAI,OAAO,eAAe,YAAY;IACpC,MAAM,aAAa,WAAW,MAAM,MAAM,IAAI;IAC9C,OAAO,eAAe,SAAY,SAAS;GAC7C;GACA,OAAO;EACT;CACF;CAEA,OAAO,EACL,aACF;AACF"}
@@ -31,5 +31,6 @@ import { useTemplateRef } from "./runtime/vueCompat/templateRef.mjs";
31
31
  import "./runtime/vueCompat.mjs";
32
32
  import { version } from "./version.mjs";
33
33
  import { takePendingRuntimeAppRegistration } from "./runtime/app/pending.mjs";
34
+ import { Fragment, createTextVNode, createVNode, isVNode, mergeProps, normalizeJsxIsland, resolveComponent, resolveDirective, transformOn, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, withDirectives } from "./runtime/jsxIsland.mjs";
34
35
  import { createUniAppHost } from "./runtime/uniAppHost.mjs";
35
- export { callHookList, callHookReturn, createApp, createUniAppHost, createWevuComponent, createWevuScopedSlotComponent, defineAppSetup, defineComponent, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentSetupContext, getNavigationBarMetrics, hasInjectionContext, inject, injectGlobal, isNoSetData, markNoSetData, mergeModels, mountRuntimeInstance, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, provideGlobal, registerApp, registerComponent, resetWevuDefaults, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, takePendingRuntimeAppRegistration, teardownRuntimeInstance, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, version, waitForLayoutHost };
36
+ export { Fragment, callHookList, callHookReturn, createApp, createTextVNode, createUniAppHost, createVNode, createWevuComponent, createWevuScopedSlotComponent, defineAppSetup, defineComponent, getCurrentInstance, getCurrentPageStackSnapshot, getCurrentSetupContext, getNavigationBarMetrics, hasInjectionContext, inject, injectGlobal, isNoSetData, isVNode, markNoSetData, mergeModels, mergeProps, mountRuntimeInstance, normalizeJsxIsland, onActivated, onAddToFavorites, onAttached, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onDetached, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMemoryWarning, onMounted, onMoved, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onRouteDone, onSaveExitState, onServerPrefetch, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, provideGlobal, registerApp, registerComponent, resetWevuDefaults, resolveComponent, resolveDirective, resolveLayoutBridge, resolveLayoutHost, resolveRuntimePageLayoutName, runSetupFunction, setCurrentInstance, setCurrentSetupContext, setGlobalProvidedValue, setPageLayout, setRuntimeSetDataVisibility, setWevuDefaults, syncRuntimePageLayoutState, syncRuntimePageLayoutStateFromRuntime, takePendingRuntimeAppRegistration, teardownRuntimeInstance, transformOn, use, useAsyncPullDownRefresh, useAttrs, useBindModel, useBoundingClientRect, useChangeModel, useDisposables, useElementIntersectionObserver, useIntersectionObserver, useLayoutBridge, useLayoutHosts, useModel, useNativeInstance, useNativePageRouter, useNativeRouter, useNavigationBarMetrics, usePageLayout, usePageScrollThrottle, usePageStack, useScrollOffset, useSelectorFields, useSelectorQuery, useSlots, useTemplateRef, useUpdatePerformanceListener, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, version, waitForLayoutHost, withDirectives };
@@ -1 +1 @@
1
- import{callHookList as e,callHookReturn as t,getCurrentInstance as n,getCurrentSetupContext as r,setCurrentInstance as i,setCurrentSetupContext as a}from"./runtime/hooks/base.mjs";import{onAddToFavorites as o,onAttached as s,onDetached as c,onError as l,onHide as u,onLaunch as d,onLoad as f,onMemoryWarning as p,onMoved as m,onPageNotFound as h,onPageScroll as g,onPullDownRefresh as _,onReachBottom as v,onReady as y,onResize as b,onRouteDone as x,onSaveExitState as S,onShareAppMessage as C,onShareTimeline as w,onShow as T,onTabItemTap as E,onThemeChange as D,onUnhandledRejection as O,onUnload as k}from"./runtime/hooks/register.mjs";import{onActivated as A,onBeforeMount as j,onBeforeUnmount as M,onBeforeUpdate as N,onDeactivated as P,onErrorCaptured as F,onMounted as I,onServerPrefetch as L,onUnmounted as R,onUpdated as z}from"./runtime/hooks/vue.mjs";import{version as B}from"./version.mjs";import{isNoSetData as V,markNoSetData as H}from"./runtime/noSetData.mjs";import{takePendingRuntimeAppRegistration as U}from"./runtime/app/pending.mjs";import{resetWevuDefaults as W,setWevuDefaults as G}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as K}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as q,setPageLayout as J,syncRuntimePageLayoutState as Y,syncRuntimePageLayoutStateFromRuntime as X,usePageLayout as Z}from"./runtime/pageLayout.mjs";import{runSetupFunction as Q}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as $,setRuntimeSetDataVisibility as ee,teardownRuntimeInstance as te}from"./runtime/register/runtimeInstance.mjs";import{registerApp as ne}from"./runtime/register/app.mjs";import{resolveLayoutBridge as re,resolveLayoutHost as ie,useLayoutBridge as ae,useLayoutHosts as oe,waitForLayoutHost as se}from"./runtime/layoutBridge.mjs";import{registerComponent as ce}from"./runtime/register/component.mjs";import{createApp as le}from"./runtime/app.mjs";import{hasInjectionContext as ue,inject as de,injectGlobal as fe,provide as pe,provideGlobal as me}from"./runtime/provide.mjs";import{createWevuComponent as he,createWevuScopedSlotComponent as ge,defineComponent as _e}from"./runtime/define.mjs";import{useDisposables as ve}from"./runtime/disposables.mjs";import{useElementIntersectionObserver as ye}from"./runtime/elementIntersectionObserver.mjs";import{useIntersectionObserver as be}from"./runtime/intersectionObserver.mjs";import{getCurrentPageStackSnapshot as xe,getNavigationBarMetrics as Se,useNavigationBarMetrics as Ce,usePageStack as we}from"./runtime/pageEnvironment.mjs";import{usePageScrollThrottle as Te}from"./runtime/pageScroll.mjs";import{useAsyncPullDownRefresh as Ee}from"./runtime/pullDownRefresh.mjs";import{useBoundingClientRect as De,useScrollOffset as Oe,useSelectorFields as ke,useSelectorQuery as Ae}from"./runtime/selectorQuery.mjs";import{useUpdatePerformanceListener as je}from"./runtime/updatePerformance.mjs";import{defineAppSetup as Me,use as Ne}from"./runtime/use.mjs";import{useAttrs as Pe,useNativeInstance as Fe,useSlots as Ie}from"./runtime/vueCompat/context.mjs";import{mergeModels as Le,useBindModel as Re,useChangeModel as ze,useModel as Be}from"./runtime/vueCompat/model.mjs";import{useNativePageRouter as Ve,useNativeRouter as He}from"./runtime/vueCompat/router.mjs";import{useTemplateRef as Ue}from"./runtime/vueCompat/templateRef.mjs";import{createUniAppHost as We}from"./runtime/uniAppHost.mjs";export{e as callHookList,t as callHookReturn,le as createApp,We as createUniAppHost,he as createWevuComponent,ge as createWevuScopedSlotComponent,Me as defineAppSetup,_e as defineComponent,n as getCurrentInstance,xe as getCurrentPageStackSnapshot,r as getCurrentSetupContext,Se as getNavigationBarMetrics,ue as hasInjectionContext,de as inject,fe as injectGlobal,V as isNoSetData,H as markNoSetData,Le as mergeModels,$ as mountRuntimeInstance,A as onActivated,o as onAddToFavorites,s as onAttached,j as onBeforeMount,M as onBeforeUnmount,N as onBeforeUpdate,P as onDeactivated,c as onDetached,l as onError,F as onErrorCaptured,u as onHide,d as onLaunch,f as onLoad,p as onMemoryWarning,I as onMounted,m as onMoved,h as onPageNotFound,g as onPageScroll,_ as onPullDownRefresh,v as onReachBottom,y as onReady,b as onResize,x as onRouteDone,S as onSaveExitState,L as onServerPrefetch,C as onShareAppMessage,w as onShareTimeline,T as onShow,E as onTabItemTap,D as onThemeChange,O as onUnhandledRejection,k as onUnload,R as onUnmounted,z as onUpdated,pe as provide,me as provideGlobal,ne as registerApp,ce as registerComponent,W as resetWevuDefaults,re as resolveLayoutBridge,ie as resolveLayoutHost,q as resolveRuntimePageLayoutName,Q as runSetupFunction,i as setCurrentInstance,a as setCurrentSetupContext,K as setGlobalProvidedValue,J as setPageLayout,ee as setRuntimeSetDataVisibility,G as setWevuDefaults,Y as syncRuntimePageLayoutState,X as syncRuntimePageLayoutStateFromRuntime,U as takePendingRuntimeAppRegistration,te as teardownRuntimeInstance,Ne as use,Ee as useAsyncPullDownRefresh,Pe as useAttrs,Re as useBindModel,De as useBoundingClientRect,ze as useChangeModel,ve as useDisposables,ye as useElementIntersectionObserver,be as useIntersectionObserver,ae as useLayoutBridge,oe as useLayoutHosts,Be as useModel,Fe as useNativeInstance,Ve as useNativePageRouter,He as useNativeRouter,Ce as useNavigationBarMetrics,Z as usePageLayout,Te as usePageScrollThrottle,we as usePageStack,Oe as useScrollOffset,ke as useSelectorFields,Ae as useSelectorQuery,Ie as useSlots,Ue as useTemplateRef,je as useUpdatePerformanceListener,B as version,se as waitForLayoutHost};
1
+ import{callHookList as e,callHookReturn as t,getCurrentInstance as n,getCurrentSetupContext as r,setCurrentInstance as i,setCurrentSetupContext as a}from"./runtime/hooks/base.mjs";import{onAddToFavorites as o,onAttached as s,onDetached as c,onError as l,onHide as u,onLaunch as d,onLoad as f,onMemoryWarning as p,onMoved as m,onPageNotFound as h,onPageScroll as g,onPullDownRefresh as _,onReachBottom as v,onReady as y,onResize as b,onRouteDone as x,onSaveExitState as S,onShareAppMessage as C,onShareTimeline as w,onShow as T,onTabItemTap as E,onThemeChange as D,onUnhandledRejection as O,onUnload as k}from"./runtime/hooks/register.mjs";import{onActivated as A,onBeforeMount as j,onBeforeUnmount as M,onBeforeUpdate as N,onDeactivated as P,onErrorCaptured as F,onMounted as I,onServerPrefetch as L,onUnmounted as R,onUpdated as z}from"./runtime/hooks/vue.mjs";import{version as B}from"./version.mjs";import{isNoSetData as V,markNoSetData as H}from"./runtime/noSetData.mjs";import{takePendingRuntimeAppRegistration as U}from"./runtime/app/pending.mjs";import{resetWevuDefaults as W,setWevuDefaults as G}from"./runtime/defaults.mjs";import{setGlobalProvidedValue as K}from"./runtime/provideStore.mjs";import{resolveRuntimePageLayoutName as q,setPageLayout as J,syncRuntimePageLayoutState as Y,syncRuntimePageLayoutStateFromRuntime as X,usePageLayout as Z}from"./runtime/pageLayout.mjs";import{runSetupFunction as Q}from"./runtime/register/setup.mjs";import{mountRuntimeInstance as $,setRuntimeSetDataVisibility as ee,teardownRuntimeInstance as te}from"./runtime/register/runtimeInstance.mjs";import{registerApp as ne}from"./runtime/register/app.mjs";import{Fragment as re,createTextVNode as ie,createVNode as ae,isVNode as oe,mergeProps as se,normalizeJsxIsland as ce,resolveComponent as le,resolveDirective as ue,transformOn as de,vModelCheckbox as fe,vModelRadio as pe,vModelSelect as me,vModelText as he,vShow as ge,withDirectives as _e}from"./runtime/jsxIsland.mjs";import{resolveLayoutBridge as ve,resolveLayoutHost as ye,useLayoutBridge as be,useLayoutHosts as xe,waitForLayoutHost as Se}from"./runtime/layoutBridge.mjs";import{registerComponent as Ce}from"./runtime/register/component.mjs";import{createApp as we}from"./runtime/app.mjs";import{hasInjectionContext as Te,inject as Ee,injectGlobal as De,provide as Oe,provideGlobal as ke}from"./runtime/provide.mjs";import{createWevuComponent as Ae,createWevuScopedSlotComponent as je,defineComponent as Me}from"./runtime/define.mjs";import{useDisposables as Ne}from"./runtime/disposables.mjs";import{useElementIntersectionObserver as Pe}from"./runtime/elementIntersectionObserver.mjs";import{useIntersectionObserver as Fe}from"./runtime/intersectionObserver.mjs";import{getCurrentPageStackSnapshot as Ie,getNavigationBarMetrics as Le,useNavigationBarMetrics as Re,usePageStack as ze}from"./runtime/pageEnvironment.mjs";import{usePageScrollThrottle as Be}from"./runtime/pageScroll.mjs";import{useAsyncPullDownRefresh as Ve}from"./runtime/pullDownRefresh.mjs";import{useBoundingClientRect as He,useScrollOffset as Ue,useSelectorFields as We,useSelectorQuery as Ge}from"./runtime/selectorQuery.mjs";import{useUpdatePerformanceListener as Ke}from"./runtime/updatePerformance.mjs";import{defineAppSetup as qe,use as Je}from"./runtime/use.mjs";import{useAttrs as Ye,useNativeInstance as Xe,useSlots as Ze}from"./runtime/vueCompat/context.mjs";import{mergeModels as Qe,useBindModel as $e,useChangeModel as et,useModel as tt}from"./runtime/vueCompat/model.mjs";import{useNativePageRouter as nt,useNativeRouter as rt}from"./runtime/vueCompat/router.mjs";import{useTemplateRef as it}from"./runtime/vueCompat/templateRef.mjs";import{createUniAppHost as at}from"./runtime/uniAppHost.mjs";export{re as Fragment,e as callHookList,t as callHookReturn,we as createApp,ie as createTextVNode,at as createUniAppHost,ae as createVNode,Ae as createWevuComponent,je as createWevuScopedSlotComponent,qe as defineAppSetup,Me as defineComponent,n as getCurrentInstance,Ie as getCurrentPageStackSnapshot,r as getCurrentSetupContext,Le as getNavigationBarMetrics,Te as hasInjectionContext,Ee as inject,De as injectGlobal,V as isNoSetData,oe as isVNode,H as markNoSetData,Qe as mergeModels,se as mergeProps,$ as mountRuntimeInstance,ce as normalizeJsxIsland,A as onActivated,o as onAddToFavorites,s as onAttached,j as onBeforeMount,M as onBeforeUnmount,N as onBeforeUpdate,P as onDeactivated,c as onDetached,l as onError,F as onErrorCaptured,u as onHide,d as onLaunch,f as onLoad,p as onMemoryWarning,I as onMounted,m as onMoved,h as onPageNotFound,g as onPageScroll,_ as onPullDownRefresh,v as onReachBottom,y as onReady,b as onResize,x as onRouteDone,S as onSaveExitState,L as onServerPrefetch,C as onShareAppMessage,w as onShareTimeline,T as onShow,E as onTabItemTap,D as onThemeChange,O as onUnhandledRejection,k as onUnload,R as onUnmounted,z as onUpdated,Oe as provide,ke as provideGlobal,ne as registerApp,Ce as registerComponent,W as resetWevuDefaults,le as resolveComponent,ue as resolveDirective,ve as resolveLayoutBridge,ye as resolveLayoutHost,q as resolveRuntimePageLayoutName,Q as runSetupFunction,i as setCurrentInstance,a as setCurrentSetupContext,K as setGlobalProvidedValue,J as setPageLayout,ee as setRuntimeSetDataVisibility,G as setWevuDefaults,Y as syncRuntimePageLayoutState,X as syncRuntimePageLayoutStateFromRuntime,U as takePendingRuntimeAppRegistration,te as teardownRuntimeInstance,de as transformOn,Je as use,Ve as useAsyncPullDownRefresh,Ye as useAttrs,$e as useBindModel,He as useBoundingClientRect,et as useChangeModel,Ne as useDisposables,Pe as useElementIntersectionObserver,Fe as useIntersectionObserver,be as useLayoutBridge,xe as useLayoutHosts,tt as useModel,Xe as useNativeInstance,nt as useNativePageRouter,rt as useNativeRouter,Re as useNavigationBarMetrics,Z as usePageLayout,Be as usePageScrollThrottle,ze as usePageStack,Ue as useScrollOffset,We as useSelectorFields,Ge as useSelectorQuery,Ze as useSlots,it as useTemplateRef,Ke as useUpdatePerformanceListener,fe as vModelCheckbox,pe as vModelRadio,me as vModelSelect,he as vModelText,ge as vShow,B as version,Se as waitForLayoutHost,_e as withDirectives};
@@ -1,16 +1,21 @@
1
1
  import { MiniProgramIntrinsicElements } from "./weappIntrinsicElements.mjs";
2
+ import { WevuJsxVNode } from "./runtime/jsxIsland.mjs";
2
3
  import { GlobalComponents } from "wevu";
3
4
  //#region src/jsx-runtime.d.ts
5
+ type WevuJsxChild = WevuJsxElement | WevuJsxElement[];
6
+ type WevuJsxElement = WevuJsxVNode | boolean | null | number | string | undefined;
4
7
  declare namespace JSX {
5
- type Element = any;
8
+ type Element = WevuJsxElement;
6
9
  interface ElementClass {
7
10
  $props: Record<string, any>;
8
11
  }
9
12
  interface ElementAttributesProperty {
10
13
  $props: Record<string, any>;
11
14
  }
12
- interface IntrinsicAttributes {}
15
+ interface IntrinsicAttributes {
16
+ key?: number | string;
17
+ }
13
18
  interface IntrinsicElements extends GlobalComponents, MiniProgramIntrinsicElements {}
14
19
  }
15
20
  //#endregion
16
- export { JSX };
21
+ export { JSX, WevuJsxChild, WevuJsxElement };
package/dist/package.mjs CHANGED
@@ -1 +1 @@
1
- var e=`6.19.4`;export{e as version};
1
+ var e=`6.20.1`;export{e as version};
@@ -1 +1 @@
1
- import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e==null?void 0:e.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch(e){return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,n){let r=Array.isArray(n==null?void 0:n.pick)?n.pick:[];if(!r.length)return;let i=new Set(Array.isArray(n==null?void 0:n.omit)?n.omit:[]),a={};for(let n of r){if(i.has(n)||e(t,n))continue;let r=c(n);r!==void 0&&(a[n]=r)}return Object.keys(a).length?a:void 0}function u(r){let{data:c,computed:l,setData:u}=r,d=l?Object.keys(l):[];if(!d.length)return;let{includeComputed:f,shouldIncludeKey:p,toPlainMaxDepth:m,toPlainMaxKeys:h,includeFunctions:g,functionPaths:_}=n(u);if(!f)return;let v={},y=new Set,b,x=n=>{if(e(c,n)||!p(n))return{ok:!1};if(e(v,n))return{ok:!0,value:v[n]};if(y.has(n))return{ok:!1};let r=a(l[n]);if(!r)return{ok:!1};y.add(n);try{let e=r.call(b);if(e===void 0)return{ok:!1};let i=t(e,new WeakMap,{maxDepth:m,maxKeys:h,includeFunctions:g,functionPaths:_,_path:n});return i===void 0?{ok:!1}:(v[n]=i,{ok:!0,value:i})}catch(e){return{ok:!1}}finally{y.delete(n)}};b=new Proxy(c,{get(t,n,r){if(typeof n==`string`){if(n===`data`||n===`$state`)return c;if(n===`props`||n===`$props`||n===`$attrs`)throw new i;if(e(c,n))return Reflect.get(t,n,r);if(l&&e(l,n)){let e=x(n);if(e.ok)return e.value;throw new i}throw new i}return Reflect.get(t,n,r)},has(t,n){return Reflect.has(t,n)||typeof n==`string`&&!!(l&&e(l,n))}});for(let e of d){let t=a(l[e]);o(e)&&(!t||!s(e,t))||x(e)}return Object.keys(v).length?v:void 0}function d(e,t,n){if(!e||typeof e!=`object`)return e;let r=u({data:e,computed:t,setData:n}),i=l(e,n);return r||i?{...e,...i,...r}:e}export{u as resolveInitialComputedData,d as resolveNativeInitialData};
1
+ import{hasOwn as e}from"../../utils.mjs";import{toPlain as t}from"../diff.mjs";import{resolveSetDataOptions as n}from"../app/setDataOptions.mjs";import{WEVU_SLOT_OWNER_ID_KEY as r}from"@weapp-core/constants";var i=class extends Error{};function a(e){if(typeof e==`function`)return e;let t=e==null?void 0:e.get;return typeof t==`function`?t:void 0}function o(e){return e.startsWith(`__wv_bind_`)||e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`)}function s(e,t){if(!e.startsWith(`__wv_bind_`))return!1;try{return!/\bthis\b/.test(Function.prototype.toString.call(t))}catch(e){return!1}}function c(e){if(e===r)return``;if(e.startsWith(`__wv_bind_`))return null;if(e.startsWith(`__wv_cls_`)||e.startsWith(`__wv_style_`))return``}function l(t,n){let r=Array.isArray(n==null?void 0:n.pick)?n.pick:[];if(!r.length)return;let i=new Set(Array.isArray(n==null?void 0:n.omit)?n.omit:[]),a={};for(let n of r){if(i.has(n)||e(t,n))continue;let r=c(n);r!==void 0&&(a[n]=r)}return Object.keys(a).length?a:void 0}function u(r){let{data:c,computed:l,methods:u,setData:d}=r,f=l?Object.keys(l):[];if(!f.length)return;let{includeComputed:p,shouldIncludeKey:m,toPlainMaxDepth:h,toPlainMaxKeys:g,includeFunctions:_,functionPaths:v}=n(d);if(!p)return;let y={},b=new Set,x,S=n=>{if(e(c,n)||!m(n))return{ok:!1};if(e(y,n))return{ok:!0,value:y[n]};if(b.has(n))return{ok:!1};let r=a(l[n]);if(!r)return{ok:!1};b.add(n);try{let e=r.call(x);if(e===void 0)return{ok:!1};let i=t(e,new WeakMap,{maxDepth:h,maxKeys:g,includeFunctions:_,functionPaths:v,_path:n});return i===void 0?{ok:!1}:(y[n]=i,{ok:!0,value:i})}catch(e){return{ok:!1}}finally{b.delete(n)}};x=new Proxy(c,{get(t,n,r){if(typeof n==`string`){if(n===`data`||n===`$state`)return c;if(n===`props`||n===`$props`||n===`$attrs`)throw new i;if(e(c,n))return Reflect.get(t,n,r);if(u&&e(u,n)){let e=u[n];return typeof e==`function`?e.bind(x):e}if(l&&e(l,n)){let e=S(n);if(e.ok)return e.value;throw new i}throw new i}return Reflect.get(t,n,r)},has(t,n){return Reflect.has(t,n)||typeof n==`string`&&!!(l&&e(l,n))}});for(let e of f){let t=a(l[e]);o(e)&&(!t||!s(e,t))||S(e)}return Object.keys(y).length?y:void 0}function d(e,t,n,r){if(!e||typeof e!=`object`)return e;let i=u({data:e,computed:t,methods:r,setData:n}),a=l(e,n);return i||a?{...e,...a,...i}:e}export{u as resolveInitialComputedData,d as resolveNativeInitialData};
@@ -1 +1 @@
1
- import{getScopedSlotHostGlobalObject as e}from"./platform.mjs";import{hasOwn as t}from"../utils.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as n,applyWevuComponentDefaults as r}from"./defaults.mjs";import{allocateOwnerId as i}from"./scopedSlots.mjs";import{runSetupFunction as a}from"./register/setup.mjs";import{registerComponent as o}from"./register/component.mjs";import{createApp as s}from"./app.mjs";import{resolveNativeInitialData as c}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as l}from"./define/options.mjs";import{applyOptionsApiProvide as u,resolveOptionsApiInjections as d}from"./define/optionsApi.mjs";import{normalizeProps as f}from"./define/props.mjs";import{createScopedSlotOptions as p}from"./define/scopedSlotOptions.mjs";import{applySetupResult as m}from"./define/setupResult.mjs";import{WEVU_FUNCTION_PROP_PATHS_KEY as h,WEVU_SCOPED_SLOT_CREATOR_KEY as g,WEVU_SLOT_OWNER_ID_KEY as _,WEVU_SLOT_OWNER_ID_PROP as v,WEVU_SLOT_SCOPE_KEY as y}from"@weapp-core/constants";let b;function x(){let t=e();if(!t)return;let n=t;b&&n[g]!==b&&(n[g]=b)}function S(e,n){let r={...n==null?{}:n};if(!e||typeof e!=`object`)return r;for(let[n,i]of Object.entries(e))i&&typeof i==`object`&&t(i,`value`)&&(r[n]=i.value);return r}function C(e,t){return!!e.__wevu_isPage&&Array.isArray(t==null?void 0:t.pick)&&t.pick.includes(_)}function w(e){return Array.isArray(e==null?void 0:e.pick)&&e.pick.includes(_)}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(v in t||y in t))}function E(e,t){return(t==null?void 0:t.strategy)!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e){x();let{__typeProps:t,data:p,computed:g,methods:v,setData:y,watch:b,setup:T,props:D,inject:O,provide:k,allowFunctionProps:A,...j}=l(r(e)),M=j[h],N=Array.isArray(M)?[...new Set(M.filter(e=>typeof e==`string`&&e.length>0))]:[];delete j[h];let P=E(j,A===!0?{...y==null?{}:y,includeFunctions:!0,functionPaths:N}:A===!1?y:N.length?{...y==null?{}:y,functionPaths:N}:y),F=new Set(N.filter(e=>!e.includes(`.`))),I=f(j,D),L=S(I.properties,v),R=typeof p==`function`?()=>p.call(L):p,z=s({data:R,computed:g,methods:v,setData:P,[n]:`component`}),B=typeof T==`function`||O!=null||k!=null?((e,t)=>{var n,r;let i=(n=(r=t==null?void 0:t.proxy)==null?t==null?void 0:t.instance:r)==null?Object.create(null):n,o=d(O,i);k!=null&&u(k,i);let s=typeof T==`function`?a(T,e,t):void 0,c={...o,...s==null?{}:s};return t&&Object.keys(c).length&&m(t.runtime,t.instance,c,{includeFunctionsInState:A===!0,functionPropPaths:A===!1?void 0:F}),c}):void 0,V=typeof R==`function`?R():R,H=w(P)?{...V&&typeof V==`object`?V:{},[_]:C(j,P)?(V==null?void 0:V[_])||i():(V==null?void 0:V[_])||``}:V,U=c(H,g,P),W=U===void 0?I:{...I,data:U},G={data:R,computed:g,methods:v,setData:P,watch:b,setup:B,mpOptions:W};return o(z,v==null?{}:v,b,B,W),{__wevu_runtime:z,__wevu_options:G}}function O(e){var t;x();let{properties:n,props:r,...i}=e,a={...i,allowNullPropInput:(t=i.allowNullPropInput)==null||t,__wevu_allowNullPropInput:!0};D(f(a,r,n))}function k(e){O(p(e))}b=k,x();export{O as createWevuComponent,k as createWevuScopedSlotComponent,D as defineComponent};
1
+ import{getScopedSlotHostGlobalObject as e}from"./platform.mjs";import{hasOwn as t}from"../utils.mjs";import{INTERNAL_DEFAULTS_SCOPE_KEY as n,applyWevuComponentDefaults as r}from"./defaults.mjs";import{allocateOwnerId as i}from"./scopedSlots.mjs";import{runSetupFunction as a}from"./register/setup.mjs";import{registerComponent as o}from"./register/component.mjs";import{createApp as s}from"./app.mjs";import{resolveNativeInitialData as c}from"./define/initialComputed.mjs";import{resolveVueComponentOptions as l}from"./define/options.mjs";import{applyOptionsApiProvide as u,resolveOptionsApiInjections as d}from"./define/optionsApi.mjs";import{normalizeProps as f}from"./define/props.mjs";import{createScopedSlotOptions as p}from"./define/scopedSlotOptions.mjs";import{applySetupResult as m}from"./define/setupResult.mjs";import{WEVU_FUNCTION_PROP_PATHS_KEY as h,WEVU_SCOPED_SLOT_CREATOR_KEY as g,WEVU_SLOT_OWNER_ID_KEY as _,WEVU_SLOT_OWNER_ID_PROP as v,WEVU_SLOT_SCOPE_KEY as y}from"@weapp-core/constants";let b;function x(){let t=e();if(!t)return;let n=t;b&&n[g]!==b&&(n[g]=b)}function S(e,n){let r={...n==null?{}:n};if(!e||typeof e!=`object`)return r;for(let[n,i]of Object.entries(e))i&&typeof i==`object`&&t(i,`value`)&&(r[n]=i.value);return r}function C(e,t){return!!e.__wevu_isPage&&Array.isArray(t==null?void 0:t.pick)&&t.pick.includes(_)}function w(e){return Array.isArray(e==null?void 0:e.pick)&&e.pick.includes(_)}function T(e){let t=e.properties;return!!(t&&typeof t==`object`&&(v in t||y in t))}function E(e,t){return(t==null?void 0:t.strategy)!==`patch`||!T(e)?t:{...t,strategy:`diff`}}function D(e){x();let{__typeProps:t,data:p,computed:g,methods:v,setData:y,watch:b,setup:T,props:D,inject:O,provide:k,allowFunctionProps:A,...j}=l(r(e)),M=j[h],N=Array.isArray(M)?[...new Set(M.filter(e=>typeof e==`string`&&e.length>0))]:[];delete j[h];let P=E(j,A===!0?{...y==null?{}:y,includeFunctions:!0,functionPaths:N}:A===!1?y:N.length?{...y==null?{}:y,functionPaths:N}:y),F=new Set(N.filter(e=>!e.includes(`.`))),I=f(j,D),L=S(I.properties,v),R=typeof p==`function`?()=>p.call(L):p,z=s({data:R,computed:g,methods:v,setData:P,[n]:`component`}),B=typeof T==`function`||O!=null||k!=null?((e,t)=>{var n,r;let i=(n=(r=t==null?void 0:t.proxy)==null?t==null?void 0:t.instance:r)==null?Object.create(null):n,o=d(O,i);k!=null&&u(k,i);let s=typeof T==`function`?a(T,e,t):void 0,c={...o,...s==null?{}:s};return t&&Object.keys(c).length&&m(t.runtime,t.instance,c,{includeFunctionsInState:A===!0,functionPropPaths:A===!1?void 0:F}),c}):void 0,V=typeof R==`function`?R():R,H=w(P)?{...V&&typeof V==`object`?V:{},[_]:C(j,P)?(V==null?void 0:V[_])||i():(V==null?void 0:V[_])||``}:V,U=c(H,g,P,v),W=U===void 0?I:{...I,data:U},G={data:R,computed:g,methods:v,setData:P,watch:b,setup:B,mpOptions:W};return o(z,v==null?{}:v,b,B,W),{__wevu_runtime:z,__wevu_options:G}}function O(e){var t;x();let{properties:n,props:r,...i}=e,a={...i,allowNullPropInput:(t=i.allowNullPropInput)==null||t,__wevu_allowNullPropInput:!0};D(f(a,r,n))}function k(e){O(p(e))}b=k,x();export{O as createWevuComponent,k as createWevuScopedSlotComponent,D as defineComponent};
@@ -0,0 +1,41 @@
1
+ //#region src/runtime/jsxIsland.d.ts
2
+ declare const Fragment: unique symbol;
3
+ interface WevuJsxVNode {
4
+ children?: unknown;
5
+ props?: Record<string, any> | null;
6
+ type: unknown;
7
+ }
8
+ interface WevuJsxIslandNode {
9
+ children?: WevuJsxIslandNode[];
10
+ events?: Record<string, string>;
11
+ kind: 'element' | 'fragment' | 'text';
12
+ props?: Record<string, any>;
13
+ tag?: string;
14
+ text?: string;
15
+ }
16
+ interface WevuJsxIslandAdapters {
17
+ normalizeClass: (value: unknown) => string;
18
+ normalizeStyle: (value: unknown) => string;
19
+ }
20
+ declare function createVNode(type: unknown, props?: Record<string, any> | null, children?: unknown): WevuJsxVNode;
21
+ declare function createTextVNode(text: unknown): WevuJsxVNode;
22
+ declare function isVNode(value: unknown): value is WevuJsxVNode;
23
+ declare function mergeProps(...sources: Array<Record<string, any> | null | undefined>): Record<string, any>;
24
+ declare function transformOn(events: Record<string, unknown>): Record<string, unknown>;
25
+ declare function resolveComponent(name: string): string;
26
+ declare const vShow = "show";
27
+ declare const vModelText = "model-text";
28
+ declare const vModelCheckbox = "model-checkbox";
29
+ declare const vModelRadio = "model-radio";
30
+ declare const vModelSelect = "model-select";
31
+ declare function withDirectives(vnode: WevuJsxVNode, directives: unknown[]): {
32
+ props: {
33
+ [x: string]: any;
34
+ };
35
+ children?: unknown;
36
+ type: unknown;
37
+ };
38
+ declare function resolveDirective(name: string): string;
39
+ declare function normalizeJsxIsland(this: any, value: unknown, islandId: string, adapters: WevuJsxIslandAdapters): WevuJsxIslandNode | null;
40
+ //#endregion
41
+ export { Fragment, WevuJsxIslandAdapters, WevuJsxIslandNode, WevuJsxVNode, createTextVNode, createVNode, isVNode, mergeProps, normalizeJsxIsland, resolveComponent, resolveDirective, transformOn, vModelCheckbox, vModelRadio, vModelSelect, vModelText, vShow, withDirectives };
@@ -0,0 +1 @@
1
+ import{WEVU_JSX_ISLAND_HANDLER_MAP_KEY as e}from"@weapp-core/constants";const t=Symbol.for(`wevu.jsx.fragment`);function n(e,t,n){return{type:e,props:t,children:n}}function r(e){return{type:`text`,props:null,children:String(e==null?``:e)}}function i(e){return!!e&&typeof e==`object`&&`type`in e}function a(...e){let t={};for(let n of e)if(n)for(let[e,r]of Object.entries(n))e===`class`&&t.class?t.class=[t.class,r]:e===`style`&&t.style?t.style=[t.style,r]:t[e]=r;return t}function o(e){let t={};for(let[n,r]of Object.entries(e))t[`on${n.charAt(0).toUpperCase()}${n.slice(1)}`]=r;return t}function s(e){return e}const c=`show`,l=`model-text`,u=`model-checkbox`,d=`model-radio`,f=`model-select`;function p(e,t){var n;let r={...(n=e.props)==null?{}:n};for(let e of t){if(!Array.isArray(e))continue;let[t,n,i]=e;if(t===`show`){r.hidden=!n;continue}if(t===`model-text`||t===`model-checkbox`||t===`model-radio`||t===`model-select`){let e=typeof i==`string`&&i?i:`modelValue`,a=r[`onUpdate:${e}`];if(r[e===`modelValue`?`value`:e]=n,typeof a==`function`){let e=t===`model-text`?`onInput`:`onChange`;r[e]=e=>{var t,n;return a((t=e==null||(n=e.detail)==null?void 0:n.value)==null?e==null?void 0:e.detail:t)}}}}return{...e,props:r}}function m(e){return e}function h(e){if(/^on[A-Z]/.test(e))return e.slice(2).toLowerCase()}function g(t){let n=t==null?void 0:t[e];if(n&&typeof n==`object`)return n;let r=Object.create(null);return t&&(typeof t==`object`||typeof t==`function`)&&Object.defineProperty(t,e,{value:r,configurable:!0,writable:!0}),r}function _(e,t,n,r,a){let o=typeof e==`function`?e():e;if(o==null||o===!1||o===!0)return[];if(Array.isArray(o))return o.flatMap(e=>_(e,t,n,r,a));if(typeof o==`object`&&!i(o))return _(o.default,t,n,r,a);let s=v(o,t,n,r,a);return s?[s]:[]}function v(e,n,r,a,o){var s;if(e==null||e===!1||e===!0)return;if(Array.isArray(e))return{kind:`fragment`,children:_(e,n,r,a,o)};if(typeof e==`string`||typeof e==`number`||!i(e))return{kind:`text`,text:String(e)};if(e.type===t)return{kind:`fragment`,children:_(e.children,n,r,a,o)};if(e.type===`text`){var c;return{kind:`text`,text:String((c=e.children)==null?``:c)}}if(typeof e.type==`function`){var l;return v(e.type((l=e.props)==null?{}:l,e.children),n,r,a,o)}if(e.type&&typeof e.type==`object`&&typeof e.type.render==`function`){var u;return v(e.type.render.call((u=e.props)==null?{}:u),n,r,a,o)}let d=typeof e.type==`string`?e.type:void 0;if(!d)return;let f={},p={},m=g(n);for(let[t,n]of Object.entries((s=e.props)==null?{}:s)){let e=h(t);if(e&&typeof n==`function`){let t=`${r}:${a.value++}`;m[t]=n,p[e]=t;continue}typeof n!=`function`&&n!==void 0&&(t===`class`||t===`className`?f.class=o.normalizeClass(n):t===`style`?f.style=o.normalizeStyle(n):f[t]=n)}return{kind:`element`,tag:d,props:f,events:p,children:_(e.children,n,r,a,o)}}function y(e,t,n){var r;let i=g(this);for(let e of Object.keys(i))e.startsWith(`${t}:`)&&delete i[e];return(r=v(e,this,t,{value:0},n))==null?null:r}function b(t,n){var r,i,a,o,s,c;let l=(r=n==null||(i=n.currentTarget)==null||(i=i.dataset)==null?void 0:i.wvJsxHandler)==null?n==null||(a=n.target)==null||(a=a.dataset)==null?void 0:a.wvJsxHandler:r;if(typeof l!=`string`||!l)return;let u=t==null?void 0:t.__wevu,d=(o=t==null?void 0:t[e])==null?u==null||(s=u.proxy)==null?void 0:s[e]:o,f=d==null?void 0:d[l];return typeof f==`function`?f.call((c=u==null?void 0:u.proxy)==null?t:c,n):void 0}export{t as Fragment,r as createTextVNode,n as createVNode,i as isVNode,a as mergeProps,y as normalizeJsxIsland,s as resolveComponent,m as resolveDirective,b as runJsxIslandHandler,o as transformOn,u as vModelCheckbox,d as vModelRadio,f as vModelSelect,l as vModelText,c as vShow,p as withDirectives};
@@ -1 +1 @@
1
- import{parseModelEventValue as e}from"../../internal.mjs";import{runInlineExpression as t}from"../inline.mjs";import{WEVU_INLINE_HANDLER as n,WEVU_INLINE_MAP_KEY as r,WEVU_MODEL_HANDLER as i,WEVU_NATIVE_INSTANCE_KEY as a,WEVU_OWNER_HANDLER as o,WEVU_RESERVED_METHOD_PREFIX as s,WEVU_RUNTIME_KEY as c}from"@weapp-core/constants";function l(l){let{userMethods:u,runtimeMethods:d}=l,f={...u};f[n]||(f[n]=function(e){var n,i;let a=this.__wevu,o=(n=a==null?void 0:a.proxy)==null?this:n,s=a==null||(i=a.methods)==null?void 0:i[r];return t(o,void 0,e,s)}),f[i]||(f[i]=function(t){var n,r,i;let a=(n=t==null||(r=t.currentTarget)==null||(r=r.dataset)==null?void 0:r.wvModel)==null?t==null||(i=t.target)==null||(i=i.dataset)==null?void 0:i.wvModel:n;if(typeof a!=`string`||!a)return;let o=this.__wevu;if(!o||typeof o.bindModel!=`function`)return;let s=e(t);try{o.bindModel(a).update(s)}catch(e){}}),!f[o]&&typeof(d==null?void 0:d[o])==`function`&&(f[o]=d[o]);let p=Object.keys(d==null?{}:d);function m(e){let t=e.__wevu;if(t)return t;let n=e.$state;if(n&&typeof n==`object`)return n[c]}function h(e,t){if((e==null?void 0:e.proxy)===t)return;let n=e==null?void 0:e.proxy,r=e=>{let r=t[e];if(typeof r!=`function`)return!1;let i=n==null?void 0:n[e];return typeof i==`function`&&r===i};if(r(`triggerEvent`)||r(`createSelectorQuery`)||r(`createIntersectionObserver`)||r(`setData`)||typeof t.triggerEvent!=`function`&&typeof t.createSelectorQuery!=`function`&&typeof t.createIntersectionObserver!=`function`&&typeof t.setData!=`function`)return;let i=e==null?void 0:e.state;if(!(!i||typeof i!=`object`)&&t.$state!==i)try{Object.defineProperty(i,a,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(e){i[a]=t}}for(let e of p){if(e===r||e.startsWith(s))continue;let t=f[e];f[e]=function(...n){var r;let i=m(this);h(i,this);let a,o=i==null||(r=i.methods)==null?void 0:r[e];if(o&&(a=o.apply(i.proxy,n)),typeof t==`function`){let e=t.apply(this,n);return e===void 0?a:e}return a}}return{finalMethods:f}}export{l as createComponentMethods};
1
+ import{parseModelEventValue as e}from"../../internal.mjs";import{runInlineExpression as t}from"../inline.mjs";import{runJsxIslandHandler as n}from"../../jsxIsland.mjs";import{WEVU_INLINE_HANDLER as r,WEVU_INLINE_MAP_KEY as i,WEVU_JSX_ISLAND_HANDLER as a,WEVU_MODEL_HANDLER as o,WEVU_NATIVE_INSTANCE_KEY as s,WEVU_OWNER_HANDLER as c,WEVU_RESERVED_METHOD_PREFIX as l,WEVU_RUNTIME_KEY as u}from"@weapp-core/constants";function d(d){let{userMethods:f,runtimeMethods:p}=d,m={...f};m[r]||(m[r]=function(e){var n,r;let a=this.__wevu,o=(n=a==null?void 0:a.proxy)==null?this:n,s=a==null||(r=a.methods)==null?void 0:r[i];return t(o,void 0,e,s)}),m[o]||(m[o]=function(t){var n,r,i;let a=(n=t==null||(r=t.currentTarget)==null||(r=r.dataset)==null?void 0:r.wvModel)==null?t==null||(i=t.target)==null||(i=i.dataset)==null?void 0:i.wvModel:n;if(typeof a!=`string`||!a)return;let o=this.__wevu;if(!o||typeof o.bindModel!=`function`)return;let s=e(t);try{o.bindModel(a).update(s)}catch(e){}}),m[a]||(m[a]=function(e){return n(this,e)}),!m[c]&&typeof(p==null?void 0:p[c])==`function`&&(m[c]=p[c]);let h=Object.keys(p==null?{}:p);function g(e){let t=e.__wevu;if(t)return t;let n=e.$state;if(n&&typeof n==`object`)return n[u]}function _(e,t){if((e==null?void 0:e.proxy)===t)return;let n=e==null?void 0:e.proxy,r=e=>{let r=t[e];if(typeof r!=`function`)return!1;let i=n==null?void 0:n[e];return typeof i==`function`&&r===i};if(r(`triggerEvent`)||r(`createSelectorQuery`)||r(`createIntersectionObserver`)||r(`setData`)||typeof t.triggerEvent!=`function`&&typeof t.createSelectorQuery!=`function`&&typeof t.createIntersectionObserver!=`function`&&typeof t.setData!=`function`)return;let i=e==null?void 0:e.state;if(!(!i||typeof i!=`object`)&&t.$state!==i)try{Object.defineProperty(i,s,{value:t,configurable:!0,enumerable:!1,writable:!0})}catch(e){i[s]=t}}for(let e of h){if(e===i||e.startsWith(l))continue;let t=m[e];m[e]=function(...n){var r;let i=g(this);_(i,this);let a,o=i==null||(r=i.methods)==null?void 0:r[e];if(o&&(a=o.apply(i.proxy,n)),typeof t==`function`){let e=t.apply(this,n);return e===void 0?a:e}return a}}return{finalMethods:m}}export{d as createComponentMethods};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wevu",
3
3
  "type": "module",
4
- "version": "6.19.4",
4
+ "version": "6.20.1",
5
5
  "description": "Vue 3 风格的小程序运行时,包含响应式、diff+setData 与轻量状态管理",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -226,11 +226,11 @@
226
226
  },
227
227
  "dependencies": {
228
228
  "vue": "^3.5.41",
229
- "@weapp-core/constants": "0.1.16",
229
+ "@weapp-core/constants": "0.1.17",
230
230
  "@weapp-core/shared": "3.1.0",
231
231
  "@wevu/api": "0.2.15",
232
- "@wevu/compiler": "6.19.4",
233
- "@wevu/web-apis": "1.2.32"
232
+ "@wevu/compiler": "6.20.1",
233
+ "@wevu/web-apis": "1.2.33"
234
234
  },
235
235
  "scripts": {
236
236
  "dev": "tsdown -w",