@weapp-vite/web 2.0.0 → 2.1.0

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.
Files changed (310) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +1 -2
  2. package/dist/compiler/wxml/attributes.mjs +12 -4
  3. package/dist/compiler/wxml/attributes.mjs.map +1 -1
  4. package/dist/compiler/wxml/compile.mjs +33 -39
  5. package/dist/compiler/wxml/compile.mjs.map +1 -1
  6. package/dist/compiler/wxml/dependency.mjs +10 -3
  7. package/dist/compiler/wxml/dependency.mjs.map +1 -1
  8. package/dist/compiler/wxml/interpolation.mjs +13 -3
  9. package/dist/compiler/wxml/interpolation.mjs.map +1 -1
  10. package/dist/compiler/wxml/nativeTags.mjs +60 -0
  11. package/dist/compiler/wxml/nativeTags.mjs.map +1 -0
  12. package/dist/compiler/wxml/navigation.mjs +1 -2
  13. package/dist/compiler/wxml/parser.mjs +1 -2
  14. package/dist/compiler/wxml/prepare.mjs +42 -0
  15. package/dist/compiler/wxml/prepare.mjs.map +1 -0
  16. package/dist/compiler/wxml/renderer.mjs +1 -2
  17. package/dist/compiler/wxml/specialNodes.mjs +1 -2
  18. package/dist/compiler/wxml/types.d.mts +0 -2
  19. package/dist/compiler/wxml/unknownTags.mjs +33 -0
  20. package/dist/compiler/wxml/unknownTags.mjs.map +1 -0
  21. package/dist/compiler/wxs.mjs +1 -2
  22. package/dist/css/wxss.d.mts +2 -19
  23. package/dist/css/wxss.mjs +5 -12
  24. package/dist/css/wxss.mjs.map +1 -1
  25. package/dist/index.d.mts +8 -3
  26. package/dist/index.mjs +8 -5
  27. package/dist/plugin/assets.d.mts +1 -2
  28. package/dist/plugin/assets.mjs +1 -2
  29. package/dist/plugin/constants.mjs +5 -4
  30. package/dist/plugin/constants.mjs.map +1 -1
  31. package/dist/plugin/dependencyScan.mjs +1 -2
  32. package/dist/plugin/entry.mjs +6 -4
  33. package/dist/plugin/entry.mjs.map +1 -1
  34. package/dist/plugin/files.mjs +1 -2
  35. package/dist/plugin/hostTypes.d.mts +1 -2
  36. package/dist/plugin/index.d.mts +0 -2
  37. package/dist/plugin/index.mjs +29 -24
  38. package/dist/plugin/index.mjs.map +1 -1
  39. package/dist/plugin/layout.mjs +1 -2
  40. package/dist/plugin/navigation.mjs +1 -2
  41. package/dist/plugin/packageResolution.mjs +1 -2
  42. package/dist/plugin/path.mjs +1 -2
  43. package/dist/plugin/register.mjs +1 -2
  44. package/dist/plugin/scan.mjs +1 -2
  45. package/dist/plugin/scanConfig.mjs +1 -2
  46. package/dist/plugin/scanSfc.mjs +1 -2
  47. package/dist/plugin/sfcHmr.mjs +28 -10
  48. package/dist/plugin/sfcHmr.mjs.map +1 -1
  49. package/dist/plugin/state.mjs +1 -2
  50. package/dist/plugin/styleModule.mjs +1 -2
  51. package/dist/plugin/types.d.mts +2 -3
  52. package/dist/plugin/vueSfc.mjs +1 -2
  53. package/dist/runtime/appShell/container.mjs +1 -2
  54. package/dist/runtime/appShell/tabBar/index.mjs +1 -2
  55. package/dist/runtime/appShell/tabBar/style.mjs +1 -2
  56. package/dist/runtime/appStyle.mjs +1 -2
  57. package/dist/runtime/button/helpers.mjs +1 -2
  58. package/dist/runtime/button/index.d.mts +0 -2
  59. package/dist/runtime/button/index.mjs +1 -2
  60. package/dist/runtime/button/style.mjs +1 -2
  61. package/dist/runtime/component/behavior.mjs +1 -2
  62. package/dist/runtime/component/constants.mjs +1 -2
  63. package/dist/runtime/component/dom.mjs +1 -2
  64. package/dist/runtime/component/element.mjs +9 -2
  65. package/dist/runtime/component/element.mjs.map +1 -1
  66. package/dist/runtime/component/events.mjs +4 -4
  67. package/dist/runtime/component/events.mjs.map +1 -1
  68. package/dist/runtime/component/index.d.mts +0 -2
  69. package/dist/runtime/component/index.mjs +1 -2
  70. package/dist/runtime/component/observers.mjs +1 -2
  71. package/dist/runtime/component/publicInstance.mjs +1 -2
  72. package/dist/runtime/component/relations.mjs +1 -2
  73. package/dist/runtime/component/slots.mjs +1 -2
  74. package/dist/runtime/component/state.mjs +1 -2
  75. package/dist/runtime/component/types.d.mts +0 -2
  76. package/dist/runtime/component/utils.mjs +1 -2
  77. package/dist/runtime/component/virtualHost.mjs +1 -2
  78. package/dist/runtime/componentEvents.mjs +1 -2
  79. package/dist/runtime/dataset.mjs +49 -0
  80. package/dist/runtime/dataset.mjs.map +1 -0
  81. package/dist/runtime/datasetBinding.d.mts +13 -0
  82. package/dist/runtime/datasetBinding.mjs +40 -0
  83. package/dist/runtime/datasetBinding.mjs.map +1 -0
  84. package/dist/runtime/eventBinding.d.mts +1 -2
  85. package/dist/runtime/eventBinding.mjs +1 -2
  86. package/dist/runtime/execution.d.mts +0 -2
  87. package/dist/runtime/execution.mjs +1 -2
  88. package/dist/runtime/host/index.d.mts +0 -2
  89. package/dist/runtime/host/index.mjs +1 -2
  90. package/dist/runtime/host/types.d.mts +0 -2
  91. package/dist/runtime/hostGlobals.d.mts +1 -2
  92. package/dist/runtime/hostGlobals.mjs +1 -2
  93. package/dist/runtime/index.d.mts +8 -3
  94. package/dist/runtime/index.mjs +9 -7
  95. package/dist/runtime/index.mjs.map +1 -1
  96. package/dist/runtime/inlineStyle.d.mts +5 -0
  97. package/dist/runtime/inlineStyle.mjs +21 -0
  98. package/dist/runtime/inlineStyle.mjs.map +1 -0
  99. package/dist/runtime/inputHandlerResult.mjs +1 -2
  100. package/dist/runtime/legacyTemplate/dataset.mjs +53 -0
  101. package/dist/runtime/legacyTemplate/dataset.mjs.map +1 -0
  102. package/dist/runtime/legacyTemplate/dom.mjs +20 -5
  103. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
  104. package/dist/runtime/legacyTemplate/expression.mjs +1 -2
  105. package/dist/runtime/legacyTemplate/index.d.mts +0 -2
  106. package/dist/runtime/legacyTemplate/index.mjs +23 -16
  107. package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
  108. package/dist/runtime/legacyTemplate/types.d.mts +0 -2
  109. package/dist/runtime/nativeComponents/canvas/index.mjs +1 -2
  110. package/dist/runtime/nativeComponents/checkbox.mjs +1 -2
  111. package/dist/runtime/nativeComponents/cover/index.mjs +1 -2
  112. package/dist/runtime/nativeComponents/form.d.mts +0 -2
  113. package/dist/runtime/nativeComponents/form.mjs +1 -2
  114. package/dist/runtime/nativeComponents/formControl.mjs +1 -2
  115. package/dist/runtime/nativeComponents/helpers.mjs +1 -2
  116. package/dist/runtime/nativeComponents/icon/helpers.mjs +1 -2
  117. package/dist/runtime/nativeComponents/icon/index.mjs +1 -2
  118. package/dist/runtime/nativeComponents/icon/style.mjs +1 -2
  119. package/dist/runtime/nativeComponents/image.d.mts +0 -2
  120. package/dist/runtime/nativeComponents/image.mjs +1 -2
  121. package/dist/runtime/nativeComponents/index.d.mts +1 -3
  122. package/dist/runtime/nativeComponents/index.mjs +3 -4
  123. package/dist/runtime/nativeComponents/index.mjs.map +1 -1
  124. package/dist/runtime/nativeComponents/input.d.mts +0 -2
  125. package/dist/runtime/nativeComponents/input.mjs +1 -2
  126. package/dist/runtime/nativeComponents/label.mjs +1 -2
  127. package/dist/runtime/nativeComponents/mediaRegistry.mjs +1 -2
  128. package/dist/runtime/nativeComponents/movable/helpers.mjs +1 -2
  129. package/dist/runtime/nativeComponents/movable/index.mjs +1 -2
  130. package/dist/runtime/nativeComponents/navigator.mjs +1 -2
  131. package/dist/runtime/nativeComponents/picker/editors.mjs +1 -2
  132. package/dist/runtime/nativeComponents/picker/helpers.mjs +1 -2
  133. package/dist/runtime/nativeComponents/picker/index.mjs +1 -2
  134. package/dist/runtime/nativeComponents/picker/style.mjs +1 -2
  135. package/dist/runtime/nativeComponents/pickerView/column.mjs +1 -2
  136. package/dist/runtime/nativeComponents/pickerView/helpers.mjs +1 -2
  137. package/dist/runtime/nativeComponents/pickerView/index.mjs +1 -2
  138. package/dist/runtime/nativeComponents/pickerView/style.mjs +1 -2
  139. package/dist/runtime/nativeComponents/primitives.mjs +1 -2
  140. package/dist/runtime/nativeComponents/progress/helpers.mjs +1 -2
  141. package/dist/runtime/nativeComponents/progress/index.mjs +1 -2
  142. package/dist/runtime/nativeComponents/progress/style.mjs +1 -2
  143. package/dist/runtime/nativeComponents/radio.mjs +1 -2
  144. package/dist/runtime/nativeComponents/richText/index.mjs +3 -4
  145. package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -1
  146. package/dist/runtime/nativeComponents/scrollView/boundaries.mjs +62 -0
  147. package/dist/runtime/nativeComponents/scrollView/boundaries.mjs.map +1 -0
  148. package/dist/runtime/nativeComponents/{scrollView.d.mts → scrollView/helpers.d.mts} +4 -5
  149. package/dist/runtime/nativeComponents/scrollView/helpers.mjs +14 -0
  150. package/dist/runtime/nativeComponents/scrollView/helpers.mjs.map +1 -0
  151. package/dist/runtime/nativeComponents/scrollView/index.mjs +193 -0
  152. package/dist/runtime/nativeComponents/scrollView/index.mjs.map +1 -0
  153. package/dist/runtime/nativeComponents/scrollView/position.mjs +43 -0
  154. package/dist/runtime/nativeComponents/scrollView/position.mjs.map +1 -0
  155. package/dist/runtime/nativeComponents/slider/helpers.mjs +1 -2
  156. package/dist/runtime/nativeComponents/slider/index.mjs +1 -2
  157. package/dist/runtime/nativeComponents/slider/style.mjs +1 -2
  158. package/dist/runtime/nativeComponents/style.mjs +1 -2
  159. package/dist/runtime/nativeComponents/swiper/helpers.mjs +1 -2
  160. package/dist/runtime/nativeComponents/swiper/index.mjs +1 -2
  161. package/dist/runtime/nativeComponents/swiper/item.mjs +1 -2
  162. package/dist/runtime/nativeComponents/swiper/style.mjs +1 -2
  163. package/dist/runtime/nativeComponents/switch.d.mts +0 -2
  164. package/dist/runtime/nativeComponents/switch.mjs +1 -2
  165. package/dist/runtime/nativeComponents/textarea.d.mts +0 -2
  166. package/dist/runtime/nativeComponents/textarea.mjs +1 -2
  167. package/dist/runtime/nativeComponents/video/helpers.d.mts +0 -2
  168. package/dist/runtime/nativeComponents/video/helpers.mjs +1 -2
  169. package/dist/runtime/nativeComponents/video/index.mjs +1 -2
  170. package/dist/runtime/nativeComponents/video/style.mjs +1 -2
  171. package/dist/runtime/navigationBar/index.d.mts +0 -2
  172. package/dist/runtime/navigationBar/index.mjs +1 -2
  173. package/dist/runtime/navigationBar/style.mjs +1 -2
  174. package/dist/runtime/pageLayout.d.mts +1 -2
  175. package/dist/runtime/pageLayout.mjs +1 -2
  176. package/dist/runtime/polyfill/ad.mjs +1 -2
  177. package/dist/runtime/polyfill/animation.mjs +1 -2
  178. package/dist/runtime/polyfill/appState.mjs +1 -2
  179. package/dist/runtime/polyfill/async.d.mts +0 -2
  180. package/dist/runtime/polyfill/async.mjs +1 -2
  181. package/dist/runtime/polyfill/auth.mjs +1 -2
  182. package/dist/runtime/polyfill/authApi.mjs +1 -2
  183. package/dist/runtime/polyfill/background.mjs +1 -2
  184. package/dist/runtime/polyfill/canvasContext.mjs +1 -2
  185. package/dist/runtime/polyfill/capability.mjs +1 -2
  186. package/dist/runtime/polyfill/cloud.mjs +1 -2
  187. package/dist/runtime/polyfill/device.mjs +1 -2
  188. package/dist/runtime/polyfill/deviceApi.mjs +1 -2
  189. package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +0 -2
  190. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +1 -2
  191. package/dist/runtime/polyfill/eventBus.mjs +1 -2
  192. package/dist/runtime/polyfill/filePicker.mjs +1 -2
  193. package/dist/runtime/polyfill/fileSystemManager.mjs +1 -2
  194. package/dist/runtime/polyfill/files.mjs +1 -2
  195. package/dist/runtime/polyfill/font.mjs +1 -2
  196. package/dist/runtime/polyfill/index.d.mts +4 -4
  197. package/dist/runtime/polyfill/index.mjs +12 -5
  198. package/dist/runtime/polyfill/index.mjs.map +1 -1
  199. package/dist/runtime/polyfill/interaction.mjs +1 -2
  200. package/dist/runtime/polyfill/interactionApi.mjs +1 -2
  201. package/dist/runtime/polyfill/intersectionObserver.mjs +4 -4
  202. package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -1
  203. package/dist/runtime/polyfill/lifecycleEvents.d.mts +12 -0
  204. package/dist/runtime/polyfill/lifecycleEvents.mjs +67 -0
  205. package/dist/runtime/polyfill/lifecycleEvents.mjs.map +1 -0
  206. package/dist/runtime/polyfill/locale.mjs +1 -2
  207. package/dist/runtime/polyfill/location.mjs +1 -2
  208. package/dist/runtime/polyfill/locationApi.mjs +1 -2
  209. package/dist/runtime/polyfill/mediaActions.mjs +1 -2
  210. package/dist/runtime/polyfill/mediaApi/file.mjs +1 -2
  211. package/dist/runtime/polyfill/mediaApi/info.mjs +1 -2
  212. package/dist/runtime/polyfill/mediaApi/picker.mjs +1 -2
  213. package/dist/runtime/polyfill/mediaApi/preview.mjs +1 -2
  214. package/dist/runtime/polyfill/mediaApi/process.mjs +1 -2
  215. package/dist/runtime/polyfill/mediaInfo.mjs +1 -2
  216. package/dist/runtime/polyfill/mediaPicker.mjs +1 -2
  217. package/dist/runtime/polyfill/mediaProcess.mjs +1 -2
  218. package/dist/runtime/polyfill/menuApi.mjs +5 -3
  219. package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
  220. package/dist/runtime/polyfill/navigationBarRuntime.mjs +1 -2
  221. package/dist/runtime/polyfill/network/request.mjs +1 -2
  222. package/dist/runtime/polyfill/network/requestBridge.mjs +1 -2
  223. package/dist/runtime/polyfill/network/status.mjs +1 -2
  224. package/dist/runtime/polyfill/platformApi.mjs +1 -2
  225. package/dist/runtime/polyfill/platformRuntime.mjs +1 -2
  226. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +1 -2
  227. package/dist/runtime/polyfill/routeRuntime/dom.mjs +1 -2
  228. package/dist/runtime/polyfill/routeRuntime/events.d.mts +0 -2
  229. package/dist/runtime/polyfill/routeRuntime/events.mjs +1 -2
  230. package/dist/runtime/polyfill/routeRuntime/history.d.mts +0 -2
  231. package/dist/runtime/polyfill/routeRuntime/history.mjs +1 -2
  232. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +1 -2
  233. package/dist/runtime/polyfill/routeRuntime/options.d.mts +1 -2
  234. package/dist/runtime/polyfill/routeRuntime/options.mjs +1 -2
  235. package/dist/runtime/polyfill/routeRuntime/result.mjs +1 -2
  236. package/dist/runtime/polyfill/routeRuntime/scroll.mjs +37 -6
  237. package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -1
  238. package/dist/runtime/polyfill/routeRuntime/stack.mjs +1 -2
  239. package/dist/runtime/polyfill/routeRuntime/url.mjs +1 -2
  240. package/dist/runtime/polyfill/routeRuntime.d.mts +2 -2
  241. package/dist/runtime/polyfill/routeRuntime.mjs +14 -5
  242. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
  243. package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +1 -2
  244. package/dist/runtime/polyfill/runtimeDataApi.d.mts +0 -2
  245. package/dist/runtime/polyfill/runtimeDataApi.mjs +1 -2
  246. package/dist/runtime/polyfill/runtimeInfra.mjs +1 -2
  247. package/dist/runtime/polyfill/runtimeOps.mjs +1 -2
  248. package/dist/runtime/polyfill/selectorQuery.mjs +3 -3
  249. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
  250. package/dist/runtime/polyfill/storage.mjs +1 -2
  251. package/dist/runtime/polyfill/storageAsync.mjs +1 -2
  252. package/dist/runtime/polyfill/subscribe.mjs +1 -2
  253. package/dist/runtime/polyfill/system.mjs +1 -2
  254. package/dist/runtime/polyfill/systemApi.mjs +1 -2
  255. package/dist/runtime/polyfill/types/base.d.mts +0 -2
  256. package/dist/runtime/polyfill/types/common.d.mts +0 -2
  257. package/dist/runtime/polyfill/types/lifecycle.d.mts +12 -0
  258. package/dist/runtime/polyfill/types/locationRuntime.d.mts +0 -2
  259. package/dist/runtime/polyfill/types/mediaAuth.d.mts +0 -2
  260. package/dist/runtime/polyfill/types/platformRuntime.d.mts +0 -2
  261. package/dist/runtime/polyfill/types/systemAuth.d.mts +0 -2
  262. package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +0 -2
  263. package/dist/runtime/polyfill/ui.mjs +1 -2
  264. package/dist/runtime/polyfill/uiFeedback.mjs +19 -5
  265. package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -1
  266. package/dist/runtime/polyfill/uiMediaApi.d.mts +8 -2
  267. package/dist/runtime/polyfill/uiMediaApi.mjs +20 -5
  268. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
  269. package/dist/runtime/polyfill/videoContext.mjs +1 -2
  270. package/dist/runtime/polyfill/vkSession.mjs +1 -2
  271. package/dist/runtime/polyfill/windowResize.mjs +1 -2
  272. package/dist/runtime/polyfill/worker.mjs +1 -2
  273. package/dist/runtime/polyfill.d.mts +4 -2
  274. package/dist/runtime/renderContext.d.mts +0 -2
  275. package/dist/runtime/renderContext.mjs +5 -4
  276. package/dist/runtime/renderContext.mjs.map +1 -1
  277. package/dist/runtime/rpx.d.mts +0 -2
  278. package/dist/runtime/rpx.mjs +6 -6
  279. package/dist/runtime/rpx.mjs.map +1 -1
  280. package/dist/runtime/seo/index.d.mts +0 -2
  281. package/dist/runtime/seo/index.mjs +1 -2
  282. package/dist/runtime/style.d.mts +0 -2
  283. package/dist/runtime/style.mjs +1 -2
  284. package/dist/runtime/template.d.mts +0 -2
  285. package/dist/runtime/utils/object.mjs +1 -2
  286. package/dist/runtime/viewport/index.d.mts +0 -2
  287. package/dist/runtime/viewport/index.mjs +1 -2
  288. package/dist/runtime/viewport/style.mjs +2 -2
  289. package/dist/runtime/viewport/style.mjs.map +1 -1
  290. package/dist/runtime/viewport/types.d.mts +0 -2
  291. package/dist/runtime/warning.d.mts +0 -2
  292. package/dist/runtime/warning.mjs +1 -2
  293. package/dist/runtime/wevu.d.mts +1 -2
  294. package/dist/runtime/wevu.mjs +1 -2
  295. package/dist/shared/nativeComponents.mjs +10 -3
  296. package/dist/shared/nativeComponents.mjs.map +1 -1
  297. package/dist/shared/slugify.mjs +1 -2
  298. package/dist/shared/styleUnits/options.d.mts +24 -0
  299. package/dist/shared/styleUnits/options.mjs +13 -0
  300. package/dist/shared/styleUnits/options.mjs.map +1 -0
  301. package/dist/shared/styleUnits/value.mjs +63 -0
  302. package/dist/shared/styleUnits/value.mjs.map +1 -0
  303. package/dist/shared/tabBar.d.mts +0 -2
  304. package/dist/shared/tabBar.mjs +1 -2
  305. package/dist/shared/wxml.mjs +1 -2
  306. package/package.json +15 -13
  307. package/dist/runtime/nativeComponents/richText/helpers.mjs +0 -230
  308. package/dist/runtime/nativeComponents/richText/helpers.mjs.map +0 -1
  309. package/dist/runtime/nativeComponents/scrollView.mjs +0 -88
  310. package/dist/runtime/nativeComponents/scrollView.mjs.map +0 -1
@@ -1,4 +1,3 @@
1
- //#region src/runtime/polyfill/types/base.d.ts
2
1
  export interface MiniProgramBaseResult {
3
2
  errMsg: string;
4
3
  }
@@ -7,5 +6,4 @@ export interface MiniProgramAsyncOptions<SuccessResult extends MiniProgramBaseRe
7
6
  fail?: (result: MiniProgramBaseResult) => void;
8
7
  complete?: (result: SuccessResult | MiniProgramBaseResult) => void;
9
8
  }
10
- //#endregion
11
9
  //# sourceMappingURL=base.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
- //#region src/runtime/polyfill/types/common.d.ts
3
2
  export interface ShowToastOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
4
3
  title?: string;
5
4
  icon?: 'success' | 'error' | 'none';
@@ -120,5 +119,4 @@ export interface ChooseImageOptions extends MiniProgramAsyncOptions<ChooseImageS
120
119
  sizeType?: Array<'original' | 'compressed'>;
121
120
  sourceType?: Array<'album' | 'camera'>;
122
121
  }
123
- //#endregion
124
122
  //# sourceMappingURL=common.d.mts.map
@@ -0,0 +1,12 @@
1
+ /** 小程序脚本错误信息,包含可用的浏览器堆栈。 */
2
+ export type MiniProgramErrorCallback = (error: string) => void;
3
+ export interface UnhandledRejectionEvent {
4
+ promise: Promise<unknown>;
5
+ reason: unknown;
6
+ }
7
+ export type UnhandledRejectionCallback = (event: UnhandledRejectionEvent) => void;
8
+ export interface ThemeChangeEvent {
9
+ theme: 'dark' | 'light';
10
+ }
11
+ export type ThemeChangeCallback = (event: ThemeChangeEvent) => void;
12
+ //# sourceMappingURL=lifecycle.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
- //#region src/runtime/polyfill/types/locationRuntime.d.ts
3
2
  export interface GetLocationSuccessResult extends MiniProgramBaseResult {
4
3
  latitude: number;
5
4
  longitude: number;
@@ -142,5 +141,4 @@ export interface RequestSubscribeMessageSuccessResult extends MiniProgramBaseRes
142
141
  export interface RequestSubscribeMessageOptions extends MiniProgramAsyncOptions<RequestSubscribeMessageSuccessResult> {
143
142
  tmplIds?: string[];
144
143
  }
145
- //#endregion
146
144
  //# sourceMappingURL=locationRuntime.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
- //#region src/runtime/polyfill/types/mediaAuth.d.ts
3
2
  export interface AuthSettingResult {
4
3
  authSetting: Record<string, boolean>;
5
4
  }
@@ -146,5 +145,4 @@ export interface ScanCodeOptions extends MiniProgramAsyncOptions<ScanCodeSuccess
146
145
  onlyFromCamera?: boolean;
147
146
  scanType?: string[];
148
147
  }
149
- //#endregion
150
148
  //# sourceMappingURL=mediaAuth.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
- //#region src/runtime/polyfill/types/platformRuntime.d.ts
3
2
  export interface VibrateShortOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
4
3
  type?: 'heavy' | 'medium' | 'light';
5
4
  }
@@ -144,5 +143,4 @@ export interface VkSession {
144
143
  on: (eventName: string, callback: (payload: unknown) => void) => void;
145
144
  off: (eventName?: string, callback?: (payload: unknown) => void) => void;
146
145
  }
147
- //#endregion
148
146
  //# sourceMappingURL=platformRuntime.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
- //#region src/runtime/polyfill/types/systemAuth.d.ts
3
2
  export interface SafeArea {
4
3
  left: number;
5
4
  right: number;
@@ -127,5 +126,4 @@ export interface AccountInfoSync {
127
126
  }
128
127
  export interface GetSystemInfoSuccessResult extends MiniProgramBaseResult, SystemInfo {}
129
128
  export interface GetSystemInfoOptions extends MiniProgramAsyncOptions<GetSystemInfoSuccessResult> {}
130
- //#endregion
131
129
  //# sourceMappingURL=systemAuth.d.mts.map
@@ -1,5 +1,4 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
- //#region src/runtime/polyfill/types/tabBarRuntime.d.ts
3
2
  export interface TabBarOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
4
3
  animation?: boolean;
5
4
  }
@@ -20,5 +19,4 @@ export interface SetTabBarStyleOptions extends MiniProgramAsyncOptions<MiniProgr
20
19
  export interface SetTabBarBadgeOptions extends TabBarIndexOptions {
21
20
  text: string;
22
21
  }
23
- //#endregion
24
22
  //# sourceMappingURL=tabBarRuntime.d.mts.map
@@ -1,7 +1,7 @@
1
1
  import { getRuntimeDialogs } from "../host/index.mjs";
2
2
  import { WEAPP_VITE_WEB_ACTION_SHEET_SELECT_INDEX_KEY } from "@weapp-core/constants";
3
3
 
4
- //#region src/runtime/polyfill/ui.ts
4
+ // src/runtime/polyfill/ui.ts
5
5
  const TOAST_ID = "__weapp_vite_web_toast__";
6
6
  const TOAST_SELECTOR = `#${TOAST_ID}`;
7
7
  const LOADING_ID = "__weapp_vite_web_loading__";
@@ -126,6 +126,5 @@ function normalizeActionSheetItems(itemList) {
126
126
  return itemList.map((item) => String(item ?? "").trim()).filter(Boolean);
127
127
  }
128
128
 
129
- //#endregion
130
129
  export { getGlobalDialogHandlers, getLoadingElement, getToastElement, hideToastElement, normalizeActionSheetItems, resolveActionSheetSelection, resolveModalSelection, resolveToastPrefix, setLoadingVisible, setToastVisible };
131
130
  //# sourceMappingURL=ui.mjs.map
@@ -1,24 +1,39 @@
1
1
  import { callMiniProgramAsyncSuccess, normalizeDuration } from "./async.mjs";
2
2
  import { getLoadingElement, getToastElement, hideToastElement, resolveToastPrefix, setLoadingVisible, setToastVisible } from "./ui.mjs";
3
3
 
4
- //#region src/runtime/polyfill/uiFeedback.ts
4
+ // src/runtime/polyfill/uiFeedback.ts
5
5
  let toastHideTimer;
6
+ let toastGeneration = 0;
7
+ function cancelToastTimer() {
8
+ toastGeneration += 1;
9
+ if (toastHideTimer !== void 0) {
10
+ clearTimeout(toastHideTimer);
11
+ toastHideTimer = void 0;
12
+ }
13
+ }
6
14
  function showToastBridge(options) {
15
+ cancelToastTimer();
7
16
  const toast = getToastElement();
8
17
  const content = `${resolveToastPrefix(options?.icon)}${options?.title ?? ""}`.trim();
9
18
  if (toast) {
10
19
  toast.textContent = content;
11
20
  setToastVisible(toast, true);
12
- if (toastHideTimer) clearTimeout(toastHideTimer);
21
+ const generation = toastGeneration;
13
22
  const duration = normalizeDuration(options?.duration, 1500);
14
23
  toastHideTimer = setTimeout(() => {
15
- hideToastElement();
24
+ if (generation !== toastGeneration) return;
25
+ setToastVisible(toast, false);
16
26
  toastHideTimer = void 0;
17
27
  }, duration);
18
28
  }
19
29
  const result = callMiniProgramAsyncSuccess(options, { errMsg: "showToast:ok" });
20
30
  return Promise.resolve(result);
21
31
  }
32
+ function hideToastBridge(options) {
33
+ cancelToastTimer();
34
+ hideToastElement();
35
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideToast:ok" }));
36
+ }
22
37
  function showLoadingBridge(options) {
23
38
  const loading = getLoadingElement();
24
39
  if (loading) setLoadingVisible(loading, true, options?.title?.trim() || "加载中", Boolean(options?.mask));
@@ -30,6 +45,5 @@ function hideLoadingBridge(options) {
30
45
  return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideLoading:ok" }));
31
46
  }
32
47
 
33
- //#endregion
34
- export { hideLoadingBridge, showLoadingBridge, showToastBridge };
48
+ export { hideLoadingBridge, hideToastBridge, showLoadingBridge, showToastBridge };
35
49
  //# sourceMappingURL=uiFeedback.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"uiFeedback.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiFeedback.ts"],"sourcesContent":["import {\n callMiniProgramAsyncSuccess,\n normalizeDuration,\n} from './async'\nimport {\n getLoadingElement,\n getToastElement,\n hideToastElement,\n resolveToastPrefix,\n setLoadingVisible,\n setToastVisible,\n} from './ui'\n\nlet toastHideTimer: ReturnType<typeof setTimeout> | undefined\n\nexport function showToastBridge(options?: any): Promise<any> {\n const toast = getToastElement()\n const content = `${resolveToastPrefix(options?.icon)}${options?.title ?? ''}`.trim()\n if (toast) {\n toast.textContent = content\n setToastVisible(toast, true)\n if (toastHideTimer) {\n clearTimeout(toastHideTimer)\n }\n const duration = normalizeDuration(options?.duration, 1500)\n toastHideTimer = setTimeout(() => {\n hideToastElement()\n toastHideTimer = undefined\n }, duration)\n }\n const result = callMiniProgramAsyncSuccess(options, { errMsg: 'showToast:ok' })\n return Promise.resolve(result)\n}\n\nexport function showLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(\n loading,\n true,\n options?.title?.trim() || '加载中',\n Boolean(options?.mask),\n )\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showLoading:ok' }))\n}\n\nexport function hideLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(loading, false, loading.textContent ?? '', false)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideLoading:ok' }))\n}\n"],"mappings":";;;;AAaA,IAAI;AAEJ,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,UAAU,GAAG,mBAAmB,SAAS,IAAI,IAAI,SAAS,SAAS,KAAK,KAAK;CACnF,IAAI,OAAO;EACT,MAAM,cAAc;EACpB,gBAAgB,OAAO,IAAI;EAC3B,IAAI,gBACF,aAAa,cAAc;EAE7B,MAAM,WAAW,kBAAkB,SAAS,UAAU,IAAI;EAC1D,iBAAiB,iBAAiB;GAChC,iBAAiB;GACjB,iBAAiB;EACnB,GAAG,QAAQ;CACb;CACA,MAAM,SAAS,4BAA4B,SAAS,EAAE,QAAQ,eAAe,CAAC;CAC9E,OAAO,QAAQ,QAAQ,MAAM;AAC/B;AAEA,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,kBACE,SACA,MACA,SAAS,OAAO,KAAK,KAAK,OAC1B,QAAQ,SAAS,IAAI,CACvB;CAEF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,iBAAiB,CAAC,CAAC;AAC3F;AAEA,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,kBAAkB,SAAS,OAAO,QAAQ,eAAe,IAAI,KAAK;CAEpE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,iBAAiB,CAAC,CAAC;AAC3F"}
1
+ {"version":3,"file":"uiFeedback.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiFeedback.ts"],"sourcesContent":["import type { MiniProgramAsyncOptions, MiniProgramBaseResult } from './types'\nimport {\n callMiniProgramAsyncSuccess,\n normalizeDuration,\n} from './async'\nimport {\n getLoadingElement,\n getToastElement,\n hideToastElement,\n resolveToastPrefix,\n setLoadingVisible,\n setToastVisible,\n} from './ui'\n\nlet toastHideTimer: ReturnType<typeof setTimeout> | undefined\nlet toastGeneration = 0\n\nfunction cancelToastTimer() {\n toastGeneration += 1\n if (toastHideTimer !== undefined) {\n clearTimeout(toastHideTimer)\n toastHideTimer = undefined\n }\n}\n\nexport function showToastBridge(options?: any): Promise<any> {\n cancelToastTimer()\n const toast = getToastElement()\n const content = `${resolveToastPrefix(options?.icon)}${options?.title ?? ''}`.trim()\n if (toast) {\n toast.textContent = content\n setToastVisible(toast, true)\n const generation = toastGeneration\n const duration = normalizeDuration(options?.duration, 1500)\n toastHideTimer = setTimeout(() => {\n if (generation !== toastGeneration) {\n return\n }\n setToastVisible(toast, false)\n toastHideTimer = undefined\n }, duration)\n }\n const result = callMiniProgramAsyncSuccess(options, { errMsg: 'showToast:ok' })\n return Promise.resolve(result)\n}\n\nexport function hideToastBridge(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>): Promise<MiniProgramBaseResult> {\n cancelToastTimer()\n hideToastElement()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideToast:ok' }))\n}\n\nexport function showLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(\n loading,\n true,\n options?.title?.trim() || '加载中',\n Boolean(options?.mask),\n )\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showLoading:ok' }))\n}\n\nexport function hideLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(loading, false, loading.textContent ?? '', false)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideLoading:ok' }))\n}\n"],"mappings":";;;;AAcA,IAAI;AACJ,IAAI,kBAAkB;AAEtB,SAAS,mBAAmB;CAC1B,mBAAmB;CACnB,IAAI,mBAAmB,QAAW;EAChC,aAAa,cAAc;EAC3B,iBAAiB;CACnB;AACF;AAEA,SAAgB,gBAAgB,SAA6B;CAC3D,iBAAiB;CACjB,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,UAAU,GAAG,mBAAmB,SAAS,IAAI,IAAI,SAAS,SAAS,KAAK,KAAK;CACnF,IAAI,OAAO;EACT,MAAM,cAAc;EACpB,gBAAgB,OAAO,IAAI;EAC3B,MAAM,aAAa;EACnB,MAAM,WAAW,kBAAkB,SAAS,UAAU,IAAI;EAC1D,iBAAiB,iBAAiB;GAChC,IAAI,eAAe,iBACjB;GAEF,gBAAgB,OAAO,KAAK;GAC5B,iBAAiB;EACnB,GAAG,QAAQ;CACb;CACA,MAAM,SAAS,4BAA4B,SAAS,EAAE,QAAQ,eAAe,CAAC;CAC9E,OAAO,QAAQ,QAAQ,MAAM;AAC/B;AAEA,SAAgB,gBAAgB,SAA0F;CACxH,iBAAiB;CACjB,iBAAiB;CACjB,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,eAAe,CAAC,CAAC;AACzF;AAEA,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,kBACE,SACA,MACA,SAAS,OAAO,KAAK,KAAK,OAC1B,QAAQ,SAAS,IAAI,CACvB;CAEF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,iBAAiB,CAAC,CAAC;AAC3F;AAEA,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,kBAAkB,SAAS,OAAO,QAAQ,eAAe,IAAI,KAAK;CAEpE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,iBAAiB,CAAC,CAAC;AAC3F"}
@@ -5,12 +5,19 @@ import { ChooseFileOptions, ChooseMediaOptions, ChooseMessageFileOptions, Choose
5
5
  import { OpenDocumentOptions, ShowActionSheetOptions, ShowModalOptions } from "./types/platformRuntime.mjs";
6
6
  import { SetTabBarBadgeOptions, SetTabBarItemOptions, SetTabBarStyleOptions, TabBarIndexOptions, TabBarOptions } from "./types/tabBarRuntime.mjs";
7
7
  import { MiniProgramBaseResultLike } from "./async.mjs";
8
- //#region src/runtime/polyfill/uiMediaApi.d.ts
9
8
  export declare function showToast(options?: ShowToastOptions): Promise<any>;
9
+ export declare function hideToast(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>): Promise<MiniProgramBaseResult>;
10
10
  export declare function showLoading(options?: ShowLoadingOptions): Promise<any>;
11
11
  export declare function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>): Promise<any>;
12
12
  export declare function showShareMenu(options?: ShareMenuOptions): Promise<any>;
13
13
  export declare function updateShareMenu(options?: ShareMenuOptions): Promise<any>;
14
+ export declare function hideShareMenu(options?: ShareMenuOptions): Promise<MiniProgramBaseResult>;
15
+ /**
16
+ * Web 没有小程序的返回首页按钮,保留成功回调兼容调用。
17
+ */
18
+ export declare function hideHomeButton(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>): Promise<{
19
+ errMsg: string;
20
+ }>;
14
21
  export declare function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions): Promise<{
15
22
  errMsg: string;
16
23
  }>;
@@ -167,5 +174,4 @@ export declare function getClipboardData(options?: GetClipboardDataOptions): Pro
167
174
  errMsg: string;
168
175
  data: string;
169
176
  }>;
170
- //#endregion
171
177
  //# sourceMappingURL=uiMediaApi.d.mts.map
@@ -1,15 +1,16 @@
1
1
  import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
2
+ import { callMiniProgramAsyncSuccess } from "./async.mjs";
2
3
  import { chooseAddressBridge, chooseLocationBridge, makePhoneCallBridge, openLocationBridge } from "./locationApi.mjs";
3
- import { hideTabBarBridge, hideTabBarRedDotBridge, removeTabBarBadgeBridge, requestPaymentBridge, requestSubscribeMessageBridge, setTabBarBadgeBridge, setTabBarItemBridge, setTabBarStyleBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, showTabBarRedDotBridge, updateShareMenuBridge } from "./menuApi.mjs";
4
+ import { hideShareMenuBridge, hideTabBarBridge, hideTabBarRedDotBridge, removeTabBarBadgeBridge, requestPaymentBridge, requestSubscribeMessageBridge, setTabBarBadgeBridge, setTabBarItemBridge, setTabBarStyleBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, showTabBarRedDotBridge, updateShareMenuBridge } from "./menuApi.mjs";
4
5
  import { getClipboardDataBridge, openCustomerServiceChatBridge, scanCodeBridge, setClipboardDataBridge } from "./interactionApi.mjs";
5
6
  import { openDocumentBridge, saveFileBridge, saveFileToDiskBridge, saveImageToPhotosAlbumBridge, saveVideoToPhotosAlbumBridge } from "./mediaApi/file.mjs";
6
7
  import { getImageInfoBridge, getVideoInfoBridge } from "./mediaApi/info.mjs";
7
8
  import { chooseFileBridge, chooseImageBridge, chooseMediaBridge, chooseMessageFileBridge, chooseVideoBridge } from "./mediaApi/picker.mjs";
8
9
  import { openVideoEditorBridge, previewImageBridge, previewMediaBridge } from "./mediaApi/preview.mjs";
9
10
  import { compressImageBridge, compressVideoBridge } from "./mediaApi/process.mjs";
10
- import { hideLoadingBridge, showLoadingBridge, showToastBridge } from "./uiFeedback.mjs";
11
+ import { hideLoadingBridge, hideToastBridge, showLoadingBridge, showToastBridge } from "./uiFeedback.mjs";
11
12
 
12
- //#region src/runtime/polyfill/uiMediaApi.ts
13
+ // src/runtime/polyfill/uiMediaApi.ts
13
14
  var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
14
15
  chooseAddress: () => chooseAddress,
15
16
  chooseFile: () => chooseFile,
@@ -23,9 +24,12 @@ var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
23
24
  getClipboardData: () => getClipboardData,
24
25
  getImageInfo: () => getImageInfo,
25
26
  getVideoInfo: () => getVideoInfo,
27
+ hideHomeButton: () => hideHomeButton,
26
28
  hideLoading: () => hideLoading,
29
+ hideShareMenu: () => hideShareMenu,
27
30
  hideTabBar: () => hideTabBar,
28
31
  hideTabBarRedDot: () => hideTabBarRedDot,
32
+ hideToast: () => hideToast,
29
33
  makePhoneCall: () => makePhoneCall,
30
34
  openCustomerServiceChat: () => openCustomerServiceChat,
31
35
  openDocument: () => openDocument,
@@ -57,6 +61,9 @@ var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
57
61
  function showToast(options) {
58
62
  return showToastBridge(options);
59
63
  }
64
+ function hideToast(options) {
65
+ return hideToastBridge(options);
66
+ }
60
67
  function showLoading(options) {
61
68
  return showLoadingBridge(options);
62
69
  }
@@ -69,6 +76,15 @@ function showShareMenu(options) {
69
76
  function updateShareMenu(options) {
70
77
  return updateShareMenuBridge(options);
71
78
  }
79
+ function hideShareMenu(options) {
80
+ return hideShareMenuBridge(options);
81
+ }
82
+ /**
83
+ * Web 没有小程序的返回首页按钮,保留成功回调兼容调用。
84
+ */
85
+ function hideHomeButton(options) {
86
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "hideHomeButton:ok" }));
87
+ }
72
88
  function openCustomerServiceChat(options) {
73
89
  return openCustomerServiceChatBridge(options);
74
90
  }
@@ -181,6 +197,5 @@ async function getClipboardData(options) {
181
197
  return getClipboardDataBridge(options);
182
198
  }
183
199
 
184
- //#endregion
185
- export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, hideTabBarRedDot, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, uiMediaApi_exports, updateShareMenu };
200
+ export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideHomeButton, hideLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, uiMediaApi_exports, updateShareMenu };
186
201
  //# sourceMappingURL=uiMediaApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n SetTabBarBadgeOptions,\n SetTabBarItemOptions,\n SetTabBarStyleOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarIndexOptions,\n TabBarOptions,\n} from './types'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideTabBarBridge,\n hideTabBarRedDotBridge,\n removeTabBarBadgeBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n setTabBarBadgeBridge,\n setTabBarItemBridge,\n setTabBarStyleBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n showTabBarRedDotBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function setTabBarItem(options: SetTabBarItemOptions) {\n return setTabBarItemBridge(options)\n}\n\nexport function setTabBarStyle(options: SetTabBarStyleOptions) {\n return setTabBarStyleBridge(options)\n}\n\nexport function setTabBarBadge(options: SetTabBarBadgeOptions) {\n return setTabBarBadgeBridge(options)\n}\n\nexport function removeTabBarBadge(options: TabBarIndexOptions) {\n return removeTabBarBadgeBridge(options)\n}\n\nexport function showTabBarRedDot(options: TabBarIndexOptions) {\n return showTabBarRedDotBridge(options)\n}\n\nexport function hideTabBarRedDot(options: TabBarIndexOptions) {\n return hideTabBarRedDotBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAgB,UAAU,SAA4B;CACpD,OAAO,gBAAgB,OAAO;AAChC;AAEA,SAAgB,YAAY,SAA8B;CACxD,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,YAAY,SAA0D;CACpF,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,cAAc,SAA4B;CACxD,OAAO,oBAAoB,OAAO;AACpC;AAEA,SAAgB,gBAAgB,SAA4B;CAC1D,OAAO,sBAAsB,OAAO;AACtC;AAEA,SAAgB,wBAAwB,SAA0C;CAChF,OAAO,8BAA8B,OAAO;AAC9C;AAEA,SAAgB,cAAc,SAAgC;CAC5D,OAAO,oBAAoB,OAAO;AACpC;AAEA,SAAgB,cAAc,SAAgC;CAC5D,OAAO,oBAAoB,OAAO;AACpC;AAEA,SAAgB,eAAe,SAAiC;CAC9D,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,WAAW,SAAyB;CAClD,OAAO,iBAAiB,OAAO;AACj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AAgB,SAAkC;CAChE,OAAO,sBAAsB,OAAO;AACtC;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,SAAgB,eAAe,SAAiC;CAC9D,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC"}
1
+ {"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n SetTabBarBadgeOptions,\n SetTabBarItemOptions,\n SetTabBarStyleOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarIndexOptions,\n TabBarOptions,\n} from './types'\nimport { callMiniProgramAsyncSuccess } from './async'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideShareMenuBridge,\n hideTabBarBridge,\n hideTabBarRedDotBridge,\n removeTabBarBadgeBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n setTabBarBadgeBridge,\n setTabBarItemBridge,\n setTabBarStyleBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n showTabBarRedDotBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n hideToastBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function hideToast(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function hideShareMenu(options?: ShareMenuOptions) {\n return hideShareMenuBridge(options)\n}\n\n/**\n * Web 没有小程序的返回首页按钮,保留成功回调兼容调用。\n */\nexport function hideHomeButton(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideHomeButton:ok' }))\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function setTabBarItem(options: SetTabBarItemOptions) {\n return setTabBarItemBridge(options)\n}\n\nexport function setTabBarStyle(options: SetTabBarStyleOptions) {\n return setTabBarStyleBridge(options)\n}\n\nexport function setTabBarBadge(options: SetTabBarBadgeOptions) {\n return setTabBarBadgeBridge(options)\n}\n\nexport function removeTabBarBadge(options: TabBarIndexOptions) {\n return removeTabBarBadgeBridge(options)\n}\n\nexport function showTabBarRedDot(options: TabBarIndexOptions) {\n return showTabBarRedDotBridge(options)\n}\n\nexport function hideTabBarRedDot(options: TabBarIndexOptions) {\n return hideTabBarRedDotBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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AAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,SAAgB,eAAe,SAAiC;CAC9D,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC"}
@@ -1,6 +1,6 @@
1
1
  import { resolveNativeMediaElement } from "../nativeComponents/mediaRegistry.mjs";
2
2
 
3
- //#region src/runtime/polyfill/videoContext.ts
3
+ // src/runtime/polyfill/videoContext.ts
4
4
  function resolveVideoElementById(videoId) {
5
5
  if (typeof document === "undefined") return;
6
6
  const normalized = String(videoId ?? "").trim();
@@ -55,6 +55,5 @@ function createVideoContextBridge(videoId) {
55
55
  };
56
56
  }
57
57
 
58
- //#endregion
59
58
  export { createVideoContextBridge };
60
59
  //# sourceMappingURL=videoContext.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/runtime/polyfill/vkSession.ts
1
+ // src/runtime/polyfill/vkSession.ts
2
2
  function createVkSessionBridge() {
3
3
  let destroyed = false;
4
4
  const listeners = /* @__PURE__ */ new Map();
@@ -43,6 +43,5 @@ function createVkSessionBridge() {
43
43
  };
44
44
  }
45
45
 
46
- //#endregion
47
46
  export { createVkSessionBridge };
48
47
  //# sourceMappingURL=vkSession.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/runtime/polyfill/windowResize.ts
1
+ // src/runtime/polyfill/windowResize.ts
2
2
  const windowResizeCallbacks = /* @__PURE__ */ new Set();
3
3
  let windowResizeBridgeBound = false;
4
4
  function readWindowResizeResult(getWindowInfo) {
@@ -34,6 +34,5 @@ function removeWindowResizeCallback(callback) {
34
34
  windowResizeCallbacks.delete(callback);
35
35
  }
36
36
 
37
- //#endregion
38
37
  export { addWindowResizeCallback, removeWindowResizeCallback };
39
38
  //# sourceMappingURL=windowResize.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/runtime/polyfill/worker.ts
1
+ // src/runtime/polyfill/worker.ts
2
2
  function resolveWorkerPath(path) {
3
3
  const normalized = typeof path === "string" ? path.trim() : "";
4
4
  if (!normalized) throw new TypeError("createWorker:fail invalid scriptPath");
@@ -72,6 +72,5 @@ function createWorkerBridge(path) {
72
72
  };
73
73
  }
74
74
 
75
- //#endregion
76
75
  export { createWorkerBridge };
77
76
  //# sourceMappingURL=worker.mjs.map
@@ -1,8 +1,10 @@
1
1
  import { AppHideCallback, AppHideOptions, AppLaunchOptions, AppShowCallback } from "./polyfill/routeRuntime/options.mjs";
2
2
  import { authorize, checkSession, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getDeviceInfo, getFuzzyLocation, getLocation, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getSystemInfo, getSystemInfoSync, getSystemSetting, getUserInfo, getUserProfile, getWindowInfo, login, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openSetting, vibrateShort } from "./polyfill/deviceAuthSystemApi.mjs";
3
+ import { MiniProgramErrorCallback, ThemeChangeCallback, ThemeChangeEvent, UnhandledRejectionCallback, UnhandledRejectionEvent } from "./polyfill/types/lifecycle.mjs";
4
+ import { offError, offThemeChange, offUnhandledRejection, onError, onThemeChange, onUnhandledRejection, reportEvent } from "./polyfill/lifecycleEvents.mjs";
3
5
  import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, offAppHide, offAppShow, onAppHide, onAppShow, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./polyfill/routeRuntime.mjs";
4
6
  import { AppRouteCallback, AppRouteEvent, AppRouteOpenType, BeforePageUnloadCallback, BeforePageUnloadEvent, offAppRoute, offAppRouteDone, offBeforeAppRoute, offBeforePageUnload, onAppRoute, onAppRouteDone, onBeforeAppRoute, onBeforePageUnload } from "./polyfill/routeRuntime/events.mjs";
5
7
  import { clearStorage, clearStorageSync, createCanvasContext, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getFileSystemManager, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, hideKeyboard, loadSubPackage, navigateToMiniProgram, nextTick, pageScrollTo, preloadSubpackage, removeStorage, removeStorageSync, request, setStorage, setStorageSync, startPullDownRefresh, stopPullDownRefresh, uploadFile } from "./polyfill/runtimeDataApi.mjs";
6
- import { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, hideTabBarRedDot, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, updateShareMenu } from "./polyfill/uiMediaApi.mjs";
8
+ import { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideHomeButton, hideLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, updateShareMenu } from "./polyfill/uiMediaApi.mjs";
7
9
  import { canIUse, createInterstitialAd, createRewardedVideoAd, getExtConfig, getExtConfigSync, getLogManager, getUpdateManager, hideNavigationBarLoading, reportAnalytics, setBackgroundColor, setBackgroundTextStyle, setNavigationBarColor, setNavigationBarTitle, showNavigationBarLoading } from "./polyfill/index.mjs";
8
- export { type AppHideCallback, type AppHideOptions, type AppLaunchOptions, type AppRouteCallback, type AppRouteEvent, type AppRouteOpenType, type AppShowCallback, type BeforePageUnloadCallback, type BeforePageUnloadEvent, authorize, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, createCanvasContext, createInterstitialAd, createRewardedVideoAd, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWindowInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, initializePageRoutes, loadSubPackage, login, makePhoneCall, navigateBack, navigateTo, navigateToMiniProgram, nextTick, offAppHide, offAppRoute, offAppRouteDone, offAppShow, offBeforeAppRoute, offBeforePageUnload, offNetworkStatusChange, offWindowResize, onAppHide, onAppRoute, onAppRouteDone, onAppShow, onBeforeAppRoute, onBeforePageUnload, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, removeStorage, removeStorageSync, removeTabBarBadge, reportAnalytics, request, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setClipboardData, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, updateShareMenu, uploadFile, vibrateShort };
10
+ export { type AppHideCallback, type AppHideOptions, type AppLaunchOptions, type AppRouteCallback, type AppRouteEvent, type AppRouteOpenType, type AppShowCallback, type BeforePageUnloadCallback, type BeforePageUnloadEvent, type MiniProgramErrorCallback, type ThemeChangeCallback, type ThemeChangeEvent, type UnhandledRejectionCallback, type UnhandledRejectionEvent, authorize, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, createCanvasContext, createInterstitialAd, createRewardedVideoAd, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWindowInfo, hideHomeButton, hideKeyboard, hideLoading, hideNavigationBarLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, initializePageRoutes, loadSubPackage, login, makePhoneCall, navigateBack, navigateTo, navigateToMiniProgram, nextTick, offAppHide, offAppRoute, offAppRouteDone, offAppShow, offBeforeAppRoute, offBeforePageUnload, offError, offNetworkStatusChange, offThemeChange, offUnhandledRejection, offWindowResize, onAppHide, onAppRoute, onAppRouteDone, onAppShow, onBeforeAppRoute, onBeforePageUnload, onError, onNetworkStatusChange, onThemeChange, onUnhandledRejection, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, removeStorage, removeStorageSync, removeTabBarBadge, reportAnalytics, reportEvent, request, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setClipboardData, setNavigationBarColor, setNavigationBarTitle, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, updateShareMenu, uploadFile, vibrateShort };
@@ -1,7 +1,6 @@
1
1
  import { TemplateScope } from "./template.mjs";
2
2
  import { ComponentPublicInstance } from "./component/types.mjs";
3
3
  import "./component/index.mjs";
4
- //#region src/runtime/renderContext.d.ts
5
4
  export interface RenderContext {
6
5
  instance: ComponentPublicInstance;
7
6
  eval: (expression: string, scope: TemplateScope, wxs?: Record<string, any>) => any;
@@ -17,5 +16,4 @@ export interface RenderContext {
17
16
  createWxsModule: (code: string, id: string, requireMap?: Record<string, any>) => Record<string, any>;
18
17
  }
19
18
  export declare function createRenderContext(instance: ComponentPublicInstance, methods: Record<string, (event: any) => any>): RenderContext;
20
- //#endregion
21
19
  //# sourceMappingURL=renderContext.d.mts.map
@@ -1,9 +1,10 @@
1
1
  import { emitRuntimeWarning } from "./warning.mjs";
2
2
  import { nameRuntimeEventHandler } from "./componentEvents.mjs";
3
+ import { readRuntimeDataset } from "./dataset.mjs";
3
4
  import { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from "./execution.mjs";
4
5
  import { invokeMiniProgramEventHandler } from "./inputHandlerResult.mjs";
5
6
 
6
- //#region src/runtime/renderContext.ts
7
+ // src/runtime/renderContext.ts
7
8
  const expressionCache = /* @__PURE__ */ new Map();
8
9
  const MUSTACHE_PREFIX_RE = /^\{\{\s*/;
9
10
  const MUSTACHE_SUFFIX_RE = /\s*\}\}$/;
@@ -73,12 +74,13 @@ function createEventHandler(instance, methods, eventName, handlerRef, flags) {
73
74
  return nameRuntimeEventHandler((nativeEvent) => {
74
75
  if (flags?.catch) nativeEvent.stopPropagation();
75
76
  const target = nativeEvent.target;
76
- const dataset = nativeEvent.currentTarget?.dataset ?? {};
77
+ const currentTarget = nativeEvent.currentTarget;
78
+ const dataset = readRuntimeDataset(currentTarget);
77
79
  const syntheticEvent = {
78
80
  type: eventName,
79
81
  timeStamp: nativeEvent.timeStamp,
80
82
  detail: nativeEvent.detail ?? nativeEvent.data ?? void 0,
81
- target: { dataset: target?.dataset ?? dataset },
83
+ target: { dataset: target?.dataset ? readRuntimeDataset(target) : dataset },
82
84
  currentTarget: { dataset },
83
85
  originalEvent: nativeEvent
84
86
  };
@@ -144,6 +146,5 @@ function createRenderContext(instance, methods) {
144
146
  };
145
147
  }
146
148
 
147
- //#endregion
148
149
  export { createChildScope, createRenderContext, createScope, evaluateExpression };
149
150
  //# sourceMappingURL=renderContext.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderContext.mjs","names":[],"sources":["../../src/runtime/renderContext.ts"],"sourcesContent":["import type { ComponentPublicInstance } from './component'\nimport type { TemplateScope } from './template'\nimport { nameRuntimeEventHandler } from './componentEvents'\nimport { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from './execution'\nimport { invokeMiniProgramEventHandler } from './inputHandlerResult'\nimport { emitRuntimeWarning } from './warning'\n\nexport interface RenderContext {\n instance: ComponentPublicInstance\n eval: (expression: string, scope: TemplateScope, wxs?: Record<string, any>) => any\n createScope: (parent: TemplateScope, locals?: Record<string, any>) => TemplateScope\n mergeScope: (parent: TemplateScope, data?: any) => TemplateScope\n normalizeList: (value: any) => any[]\n key: (rawKey: string, item: any, index: number, scope: TemplateScope, wxs?: Record<string, any>) => any\n renderTemplate: (templates: Record<string, any>, name: any, scope: TemplateScope, ctx: RenderContext) => any\n event: (eventName: string, handlerName: any, scope: TemplateScope, wxs?: Record<string, any>, flags?: { catch?: boolean, capture?: boolean }) => (event: Event) => void\n createWxsModule: (code: string, id: string, requireMap?: Record<string, any>) => Record<string, any>\n}\n\nconst expressionCache = new Map<string, (scope: TemplateScope) => any>()\nconst MUSTACHE_PREFIX_RE = /^\\{\\{\\s*/\nconst MUSTACHE_SUFFIX_RE = /\\s*\\}\\}$/\nconst SIMPLE_KEY_PATH_RE = /[.[()]/\n\nfunction createScope(initial?: TemplateScope): TemplateScope {\n return Object.assign(Object.create(null), initial ?? {})\n}\n\nfunction createChildScope(parent: TemplateScope, locals?: Record<string, any>): TemplateScope {\n return Object.assign(Object.create(parent), locals ?? {})\n}\n\nfunction evaluateExpression(expression: string, scope: TemplateScope): any {\n if (!expression) {\n return undefined\n }\n const trimmed = expression.trim()\n if (!trimmed) {\n return undefined\n }\n let evaluator = expressionCache.get(trimmed)\n if (!evaluator) {\n try {\n // eslint-disable-next-line no-new-func -- dynamic expressions are required for template evaluation\n evaluator = new Function('scope', `with(scope){ return (${trimmed}); }`) as (scope: TemplateScope) => any\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-expression-parse:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式解析错误 \"${trimmed}\": ${reason}`,\n )\n evaluator = () => undefined\n }\n else {\n throw new SyntaxError(`[@weapp-vite/web] 无法解析表达式 \"${trimmed}\": ${reason}`)\n }\n }\n expressionCache.set(trimmed, evaluator)\n }\n try {\n return evaluator?.(scope)\n }\n catch (error) {\n const mode = getRuntimeExecutionMode()\n if (mode === 'strict') {\n const reason = error instanceof Error ? error.message : String(error)\n throw new Error(`[@weapp-vite/web] strict 模式下表达式执行失败 \"${trimmed}\": ${reason}`)\n }\n if (mode === 'safe') {\n const reason = error instanceof Error ? error.message : String(error)\n warnRuntimeExecutionOnce(\n `safe-expression-runtime:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式执行错误 \"${trimmed}\": ${reason}`,\n )\n }\n return undefined\n }\n}\n\nfunction normalizeList(value: any): any[] {\n if (Array.isArray(value)) {\n return value\n }\n if (value == null) {\n return []\n }\n if (typeof value === 'number' && Number.isFinite(value)) {\n const length = Math.max(0, Math.floor(value))\n return Array.from({ length }, (_, index) => index)\n }\n if (typeof value === 'object') {\n return Object.values(value)\n }\n return []\n}\n\nfunction normalizeKey(rawKey: string, item: any, index: number, scope: TemplateScope): any {\n const key = rawKey?.trim()\n if (!key) {\n if (item != null && (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean')) {\n return item\n }\n return index\n }\n if (key === '*this') {\n return item\n }\n if (key.includes('{{') && key.includes('}}')) {\n const expr = key.replace(MUSTACHE_PREFIX_RE, '').replace(MUSTACHE_SUFFIX_RE, '')\n return evaluateExpression(expr, scope)\n }\n if (!SIMPLE_KEY_PATH_RE.test(key) && item && typeof item === 'object' && key in item) {\n return (item as Record<string, any>)[key]\n }\n return evaluateExpression(key, scope)\n}\n\nfunction createEventHandler(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n eventName: string,\n handlerRef: string | ((event: any) => any),\n flags?: { catch?: boolean },\n) {\n const handler = typeof handlerRef === 'function'\n ? handlerRef\n : methods[handlerRef] ?? (instance as Record<string, any>)[handlerRef]\n if (typeof handler !== 'function') {\n return () => {}\n }\n return nameRuntimeEventHandler((nativeEvent: Event) => {\n if (flags?.catch) {\n nativeEvent.stopPropagation()\n }\n const target = nativeEvent.target as HTMLElement | null\n const currentTarget = nativeEvent.currentTarget as HTMLElement | null\n const dataset = currentTarget?.dataset ?? {}\n const syntheticEvent = {\n type: eventName,\n timeStamp: nativeEvent.timeStamp,\n detail: (nativeEvent as CustomEvent).detail ?? (nativeEvent as InputEvent).data ?? undefined,\n target: {\n dataset: target?.dataset ?? dataset,\n },\n currentTarget: {\n dataset,\n },\n originalEvent: nativeEvent,\n }\n invokeMiniProgramEventHandler(handler, instance, syntheticEvent, nativeEvent)\n }, eventName)\n}\n\nfunction createWxsModule(code: string, id: string, requireMap?: Record<string, any>) {\n const module = { exports: {} as Record<string, any> }\n const exports = module.exports\n const getRegExp = (pattern: string, flags?: string) => new RegExp(pattern, flags)\n const getDate = (value?: string | number | Date) => (value == null ? new Date() : new Date(value))\n const require = (request: string) => requireMap?.[request]\n try {\n // eslint-disable-next-line no-new-func -- run in isolated module scope\n const runner = new Function('module', 'exports', 'require', 'getRegExp', 'getDate', code)\n runner(module, exports, require, getRegExp, getDate)\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-wxs-runtime:${id}`,\n `[@weapp-vite/web] safe 模式下忽略 WXS 执行错误: ${id} ${reason}`,\n )\n return {}\n }\n throw new Error(`[@weapp-vite/web] WXS 执行失败: ${id} ${reason}`)\n }\n return module.exports\n}\n\nexport function createRenderContext(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n): RenderContext {\n const warnMissingTemplate = (name: string) => {\n emitRuntimeWarning(`[@weapp-vite/web] 未找到模板: ${name}`, {\n key: `template-missing:${name}`,\n context: 'runtime:template',\n })\n }\n\n return {\n instance,\n eval: (expression, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return evaluateExpression(expression, renderScope)\n },\n createScope: (parent, locals) => createChildScope(parent, locals),\n mergeScope: (parent, data) => {\n const baseScope = parent ?? createScope()\n if (!data || typeof data !== 'object') {\n return baseScope\n }\n return createChildScope(baseScope, data as Record<string, any>)\n },\n normalizeList,\n key: (rawKey, item, index, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return normalizeKey(rawKey, item, index, renderScope)\n },\n renderTemplate: (templates, name, scope, ctx) => {\n const resolvedName = typeof name === 'string' ? name : String(name)\n const template = templates?.[resolvedName]\n if (typeof template !== 'function') {\n warnMissingTemplate(resolvedName)\n return ''\n }\n return template(scope, ctx)\n },\n event: (eventName, handlerName, _scope, _wxs, flags) => {\n if (typeof handlerName === 'function') {\n return createEventHandler(instance, methods, eventName, handlerName, flags)\n }\n const resolvedHandler = String(handlerName ?? '')\n return createEventHandler(instance, methods, eventName, resolvedHandler, flags)\n },\n createWxsModule,\n }\n}\n\nexport { createChildScope, createScope, evaluateExpression }\n"],"mappings":";;;;;;AAmBA,MAAM,kCAAkB,IAAI,IAA2C;AACvE,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAE3B,SAAS,YAAY,SAAwC;CAC3D,OAAO,OAAO,OAAO,OAAO,OAAO,IAAI,GAAG,WAAW,CAAC,CAAC;AACzD;AAEA,SAAS,iBAAiB,QAAuB,QAA6C;CAC5F,OAAO,OAAO,OAAO,OAAO,OAAO,MAAM,GAAG,UAAU,CAAC,CAAC;AAC1D;AAEA,SAAS,mBAAmB,YAAoB,OAA2B;CACzE,IAAI,CAAC,YACH;CAEF,MAAM,UAAU,WAAW,KAAK;CAChC,IAAI,CAAC,SACH;CAEF,IAAI,YAAY,gBAAgB,IAAI,OAAO;CAC3C,IAAI,CAAC,WAAW;EACd,IAAI;GAEF,YAAY,IAAI,SAAS,SAAS,wBAAwB,QAAQ,KAAK;EACzE,SACO,OAAO;GACZ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAEpE,IADa,wBACN,MAAM,QAAQ;IACnB,yBACE,yBAAyB,WACzB,wCAAwC,QAAQ,KAAK,QACvD;IACA,kBAAkB;GACpB,OAEE,MAAM,IAAI,Y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;CACA,OAAO,OAAO;AAChB;AAEA,SAAgB,oBACd,UACA,SACe;CACf,MAAM,uBAAuB,SAAiB;EAC5C,mBAAmB,4BAA4B,QAAQ;GACrD,KAAK,oBAAoB;GACzB,SAAS;EACX,CAAC;CACH;CAEA,OAAO;EACL;EACA,OAAO,YAAY,OAAO,QAAQ;GAChC,MAAM,YAAY,SAAS,YAAY;GAEvC,OAAO,mBAAmB,YADN,MAAM,iBAAiB,WAAW,GAAG,IAAI,SACZ;EACnD;EACA,cAAc,QAAQ,WAAW,iBAAiB,QAAQ,MAAM;EAChE,aAAa,QAAQ,SAAS;GAC5B,MAAM,YAAY,UAAU,YAAY;GACxC,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B,OAAO;GAET,OAAO,iBAAiB,WAAW,IAA2B;EAChE;EACA;EACA,MAAM,QAAQ,MAAM,OAAO,OAAO,QAAQ;GACxC,MAAM,YAAY,SAAS,YAAY;GAEvC,OAAO,aAAa,QAAQ,MAAM,OADd,MAAM,iBAAiB,WAAW,GAAG,IAAI,SACT;EACtD;EACA,iBAAiB,WAAW,MAAM,OAAO,QAAQ;GAC/C,MAAM,eAAe,OAAO,SAAS,WAAW,OAAO,OAAO,IAAI;GAClE,MAAM,WAAW,YAAY;GAC7B,IAAI,OAAO,aAAa,YAAY;IAClC,oBAAoB,YAAY;IAChC,OAAO;GACT;GACA,OAAO,SAAS,OAAO,GAAG;EAC5B;EACA,QAAQ,WAAW,aAAa,QAAQ,MAAM,UAAU;GACtD,IAAI,OAAO,gBAAgB,YACzB,OAAO,mBAAmB,UAAU,SAAS,WAAW,aAAa,KAAK;GAG5E,OAAO,mBAAmB,UAAU,SAAS,WADrB,OAAO,eAAe,EACwB,GAAG,KAAK;EAChF;EACA;CACF;AACF"}
1
+ {"version":3,"file":"renderContext.mjs","names":[],"sources":["../../src/runtime/renderContext.ts"],"sourcesContent":["import type { ComponentPublicInstance } from './component'\nimport type { TemplateScope } from './template'\nimport { nameRuntimeEventHandler } from './componentEvents'\nimport { readRuntimeDataset } from './dataset'\nimport { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from './execution'\nimport { invokeMiniProgramEventHandler } from './inputHandlerResult'\nimport { emitRuntimeWarning } from './warning'\n\nexport interface RenderContext {\n instance: ComponentPublicInstance\n eval: (expression: string, scope: TemplateScope, wxs?: Record<string, any>) => any\n createScope: (parent: TemplateScope, locals?: Record<string, any>) => TemplateScope\n mergeScope: (parent: TemplateScope, data?: any) => TemplateScope\n normalizeList: (value: any) => any[]\n key: (rawKey: string, item: any, index: number, scope: TemplateScope, wxs?: Record<string, any>) => any\n renderTemplate: (templates: Record<string, any>, name: any, scope: TemplateScope, ctx: RenderContext) => any\n event: (eventName: string, handlerName: any, scope: TemplateScope, wxs?: Record<string, any>, flags?: { catch?: boolean, capture?: boolean }) => (event: Event) => void\n createWxsModule: (code: string, id: string, requireMap?: Record<string, any>) => Record<string, any>\n}\n\nconst expressionCache = new Map<string, (scope: TemplateScope) => any>()\nconst MUSTACHE_PREFIX_RE = /^\\{\\{\\s*/\nconst MUSTACHE_SUFFIX_RE = /\\s*\\}\\}$/\nconst SIMPLE_KEY_PATH_RE = /[.[()]/\n\nfunction createScope(initial?: TemplateScope): TemplateScope {\n return Object.assign(Object.create(null), initial ?? {})\n}\n\nfunction createChildScope(parent: TemplateScope, locals?: Record<string, any>): TemplateScope {\n return Object.assign(Object.create(parent), locals ?? {})\n}\n\nfunction evaluateExpression(expression: string, scope: TemplateScope): any {\n if (!expression) {\n return undefined\n }\n const trimmed = expression.trim()\n if (!trimmed) {\n return undefined\n }\n let evaluator = expressionCache.get(trimmed)\n if (!evaluator) {\n try {\n // eslint-disable-next-line no-new-func -- dynamic expressions are required for template evaluation\n evaluator = new Function('scope', `with(scope){ return (${trimmed}); }`) as (scope: TemplateScope) => any\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-expression-parse:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式解析错误 \"${trimmed}\": ${reason}`,\n )\n evaluator = () => undefined\n }\n else {\n throw new SyntaxError(`[@weapp-vite/web] 无法解析表达式 \"${trimmed}\": ${reason}`)\n }\n }\n expressionCache.set(trimmed, evaluator)\n }\n try {\n return evaluator?.(scope)\n }\n catch (error) {\n const mode = getRuntimeExecutionMode()\n if (mode === 'strict') {\n const reason = error instanceof Error ? error.message : String(error)\n throw new Error(`[@weapp-vite/web] strict 模式下表达式执行失败 \"${trimmed}\": ${reason}`)\n }\n if (mode === 'safe') {\n const reason = error instanceof Error ? error.message : String(error)\n warnRuntimeExecutionOnce(\n `safe-expression-runtime:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式执行错误 \"${trimmed}\": ${reason}`,\n )\n }\n return undefined\n }\n}\n\nfunction normalizeList(value: any): any[] {\n if (Array.isArray(value)) {\n return value\n }\n if (value == null) {\n return []\n }\n if (typeof value === 'number' && Number.isFinite(value)) {\n const length = Math.max(0, Math.floor(value))\n return Array.from({ length }, (_, index) => index)\n }\n if (typeof value === 'object') {\n return Object.values(value)\n }\n return []\n}\n\nfunction normalizeKey(rawKey: string, item: any, index: number, scope: TemplateScope): any {\n const key = rawKey?.trim()\n if (!key) {\n if (item != null && (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean')) {\n return item\n }\n return index\n }\n if (key === '*this') {\n return item\n }\n if (key.includes('{{') && key.includes('}}')) {\n const expr = key.replace(MUSTACHE_PREFIX_RE, '').replace(MUSTACHE_SUFFIX_RE, '')\n return evaluateExpression(expr, scope)\n }\n if (!SIMPLE_KEY_PATH_RE.test(key) && item && typeof item === 'object' && key in item) {\n return (item as Record<string, any>)[key]\n }\n return evaluateExpression(key, scope)\n}\n\nfunction createEventHandler(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n eventName: string,\n handlerRef: string | ((event: any) => any),\n flags?: { catch?: boolean },\n) {\n const handler = typeof handlerRef === 'function'\n ? handlerRef\n : methods[handlerRef] ?? (instance as Record<string, any>)[handlerRef]\n if (typeof handler !== 'function') {\n return () => {}\n }\n return nameRuntimeEventHandler((nativeEvent: Event) => {\n if (flags?.catch) {\n nativeEvent.stopPropagation()\n }\n const target = nativeEvent.target as HTMLElement | null\n const currentTarget = nativeEvent.currentTarget as HTMLElement | null\n const dataset = readRuntimeDataset(currentTarget)\n const syntheticEvent = {\n type: eventName,\n timeStamp: nativeEvent.timeStamp,\n detail: (nativeEvent as CustomEvent).detail ?? (nativeEvent as InputEvent).data ?? undefined,\n target: {\n dataset: (target as HTMLElement | null)?.dataset ? readRuntimeDataset(target) : dataset,\n },\n currentTarget: {\n dataset,\n },\n originalEvent: nativeEvent,\n }\n invokeMiniProgramEventHandler(handler, instance, syntheticEvent, nativeEvent)\n }, eventName)\n}\n\nfunction createWxsModule(code: string, id: string, requireMap?: Record<string, any>) {\n const module = { exports: {} as Record<string, any> }\n const exports = module.exports\n const getRegExp = (pattern: string, flags?: string) => new RegExp(pattern, flags)\n const getDate = (value?: string | number | Date) => (value == null ? new Date() : new Date(value))\n const require = (request: string) => requireMap?.[request]\n try {\n // eslint-disable-next-line no-new-func -- run in isolated module scope\n const runner = new Function('module', 'exports', 'require', 'getRegExp', 'getDate', code)\n runner(module, exports, require, getRegExp, getDate)\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-wxs-runtime:${id}`,\n `[@weapp-vite/web] safe 模式下忽略 WXS 执行错误: ${id} ${reason}`,\n )\n return {}\n }\n throw new Error(`[@weapp-vite/web] WXS 执行失败: ${id} ${reason}`)\n }\n return module.exports\n}\n\nexport function createRenderContext(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n): RenderContext {\n const warnMissingTemplate = (name: string) => {\n emitRuntimeWarning(`[@weapp-vite/web] 未找到模板: ${name}`, {\n key: `template-missing:${name}`,\n context: 'runtime:template',\n })\n }\n\n return {\n instance,\n eval: (expression, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return evaluateExpression(expression, renderScope)\n },\n createScope: (parent, locals) => createChildScope(parent, locals),\n mergeScope: (parent, data) => {\n const baseScope = parent ?? createScope()\n if (!data || typeof data !== 'object') {\n return baseScope\n }\n return createChildScope(baseScope, data as Record<string, any>)\n },\n normalizeList,\n key: (rawKey, item, index, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return normalizeKey(rawKey, item, index, renderScope)\n },\n renderTemplate: (templates, name, scope, ctx) => {\n const resolvedName = typeof name === 'string' ? name : String(name)\n const template = templates?.[resolvedName]\n if (typeof template !== 'function') {\n warnMissingTemplate(resolvedName)\n return ''\n }\n return template(scope, ctx)\n },\n event: (eventName, handlerName, _scope, _wxs, flags) => {\n if (typeof handlerName === 'function') {\n return createEventHandler(instance, methods, eventName, handlerName, flags)\n }\n const resolvedHandler = String(handlerName ?? '')\n return createEventHandler(instance, methods, eventName, resolvedHandler, flags)\n },\n createWxsModule,\n }\n}\n\nexport { createChildScope, createScope, evaluateExpression }\n"],"mappings":";;;;;;;AAoBA,MAAM,kCAAkB,IAAI,IAA2C;AACvE,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAE3B,SAAS,YAAY,SAAwC;CAC3D,OAAO,OAAO,OAAO,OAAO,OAAO,IAAI,GAAG,WAAW,CAAC,CAAC;AACzD;AAEA,SAAS,iBAAiB,QAAuB,QAA6C;CAC5F,OAAO,OAAO,OAAO,OAAO,OAAO,MAAM,GAAG,UAAU,CAAC,CAAC;AAC1D;AAEA,SAAS,mBAAmB,YAAoB,OAA2B;CACzE,IAAI,CAAC,YACH;CAEF,MAAM,UAAU,WAAW,KAAK;CAChC,IAAI,CAAC,SACH;CAEF,IAAI,YAAY,gBAAgB,IAAI,OAA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Q,MAAM,UAAU;GACtD,IAAI,OAAO,gBAAgB,YACzB,OAAO,mBAAmB,UAAU,SAAS,WAAW,aAAa,KAAK;GAG5E,OAAO,mBAAmB,UAAU,SAAS,WADrB,OAAO,eAAe,EACwB,GAAG,KAAK;EAChF;EACA;CACF;AACF"}
@@ -1,8 +1,6 @@
1
- //#region src/runtime/rpx.d.ts
2
1
  export interface RpxConfig {
3
2
  designWidth?: number;
4
3
  varName?: string;
5
4
  }
6
5
  export declare function setupRpx(config?: RpxConfig): void;
7
- //#endregion
8
6
  //# sourceMappingURL=rpx.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { getWebViewportWidth } from "./viewport/index.mjs";
2
2
 
3
- //#region src/runtime/rpx.ts
3
+ // src/runtime/rpx.ts
4
4
  const DEFAULT_DESIGN_WIDTH = 750;
5
5
  const DEFAULT_VAR_NAME = "--rpx";
6
6
  let initialized = false;
@@ -8,13 +8,14 @@ let activeConfig = {
8
8
  designWidth: DEFAULT_DESIGN_WIDTH,
9
9
  varName: DEFAULT_VAR_NAME
10
10
  };
11
- function computeRpx(designWidth) {
11
+ function getRuntimeRpxSize() {
12
12
  if (typeof window === "undefined") return 0;
13
- return getWebViewportWidth() / designWidth;
13
+ return getWebViewportWidth() / activeConfig.designWidth;
14
14
  }
15
15
  function applyRpx() {
16
16
  const root = document.documentElement;
17
- const value = computeRpx(activeConfig.designWidth);
17
+ if (!root) return;
18
+ const value = getRuntimeRpxSize();
18
19
  root.style.setProperty(activeConfig.varName, `${value}px`);
19
20
  }
20
21
  function setupRpx(config) {
@@ -31,6 +32,5 @@ function setupRpx(config) {
31
32
  }
32
33
  }
33
34
 
34
- //#endregion
35
- export { setupRpx };
35
+ export { getRuntimeRpxSize, setupRpx };
36
36
  //# sourceMappingURL=rpx.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpx.mjs","names":[],"sources":["../../src/runtime/rpx.ts"],"sourcesContent":["import { getWebViewportWidth } from './viewport'\n\nexport interface RpxConfig {\n designWidth?: number\n varName?: string\n}\n\nconst DEFAULT_DESIGN_WIDTH = 750\nconst DEFAULT_VAR_NAME = '--rpx'\nlet initialized = false\nlet activeConfig = {\n designWidth: DEFAULT_DESIGN_WIDTH,\n varName: DEFAULT_VAR_NAME,\n}\n\nfunction computeRpx(designWidth: number) {\n if (typeof window === 'undefined') {\n return 0\n }\n const width = getWebViewportWidth()\n return width / designWidth\n}\n\nfunction applyRpx() {\n const root = document.documentElement\n const value = computeRpx(activeConfig.designWidth)\n root.style.setProperty(activeConfig.varName, `${value}px`)\n}\n\nexport function setupRpx(config?: RpxConfig) {\n if (typeof document === 'undefined') {\n return\n }\n activeConfig = {\n designWidth: config?.designWidth ?? DEFAULT_DESIGN_WIDTH,\n varName: config?.varName ?? DEFAULT_VAR_NAME,\n }\n const apply = () => applyRpx()\n apply()\n if (!initialized && typeof window !== 'undefined') {\n initialized = true\n window.addEventListener('resize', apply)\n }\n}\n"],"mappings":";;;AAOA,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;AACzB,IAAI,cAAc;AAClB,IAAI,eAAe;CACjB,aAAa;CACb,SAAS;AACX;AAEA,SAAS,WAAW,aAAqB;CACvC,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,OADc,oBACH,IAAI;AACjB;AAEA,SAAS,WAAW;CAClB,MAAM,OAAO,SAAS;CACtB,MAAM,QAAQ,WAAW,aAAa,WAAW;CACjD,KAAK,MAAM,YAAY,aAAa,SAAS,GAAG,MAAM,GAAG;AAC3D;AAEA,SAAgB,SAAS,QAAoB;CAC3C,IAAI,OAAO,aAAa,aACtB;CAEF,eAAe;EACb,aAAa,QAAQ,eAAe;EACpC,SAAS,QAAQ,WAAW;CAC9B;CACA,MAAM,cAAc,SAAS;CAC7B,MAAM;CACN,IAAI,CAAC,eAAe,OAAO,WAAW,aAAa;EACjD,cAAc;EACd,OAAO,iBAAiB,UAAU,KAAK;CACzC;AACF"}
1
+ {"version":3,"file":"rpx.mjs","names":[],"sources":["../../src/runtime/rpx.ts"],"sourcesContent":["import { getWebViewportWidth } from './viewport'\n\nexport interface RpxConfig {\n designWidth?: number\n varName?: string\n}\n\nconst DEFAULT_DESIGN_WIDTH = 750\nconst DEFAULT_VAR_NAME = '--rpx'\nlet initialized = false\nlet activeConfig = {\n designWidth: DEFAULT_DESIGN_WIDTH,\n varName: DEFAULT_VAR_NAME,\n}\n\nexport function getRuntimeRpxSize() {\n if (typeof window === 'undefined') {\n return 0\n }\n const width = getWebViewportWidth()\n return width / activeConfig.designWidth\n}\n\nfunction applyRpx() {\n const root = document.documentElement\n if (!root) {\n return\n }\n const value = getRuntimeRpxSize()\n root.style.setProperty(activeConfig.varName, `${value}px`)\n}\n\nexport function setupRpx(config?: RpxConfig) {\n if (typeof document === 'undefined') {\n return\n }\n activeConfig = {\n designWidth: config?.designWidth ?? DEFAULT_DESIGN_WIDTH,\n varName: config?.varName ?? DEFAULT_VAR_NAME,\n }\n const apply = () => applyRpx()\n apply()\n if (!initialized && typeof window !== 'undefined') {\n initialized = true\n window.addEventListener('resize', apply)\n }\n}\n"],"mappings":";;;AAOA,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;AACzB,IAAI,cAAc;AAClB,IAAI,eAAe;CACjB,aAAa;CACb,SAAS;AACX;AAEA,SAAgB,oBAAoB;CAClC,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,OADc,oBACH,IAAI,aAAa;AAC9B;AAEA,SAAS,WAAW;CAClB,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,MACH;CAEF,MAAM,QAAQ,kBAAkB;CAChC,KAAK,MAAM,YAAY,aAAa,SAAS,GAAG,MAAM,GAAG;AAC3D;AAEA,SAAgB,SAAS,QAAoB;CAC3C,IAAI,OAAO,aAAa,aACtB;CAEF,eAAe;EACb,aAAa,QAAQ,eAAe;EACpC,SAAS,QAAQ,WAAW;CAC9B;CACA,MAAM,cAAc,SAAS;CAC7B,MAAM;CACN,IAAI,CAAC,eAAe,OAAO,WAAW,aAAa;EACjD,cAAc;EACd,OAAO,iBAAiB,UAAU,KAAK;CACzC;AACF"}
@@ -1,4 +1,3 @@
1
- //#region src/runtime/seo/index.d.ts
2
1
  export type WebResourceHintRelation = 'preconnect' | 'dns-prefetch' | 'prefetch' | 'preload';
3
2
  export interface WebResourceHint {
4
3
  href: string;
@@ -26,6 +25,5 @@ export declare function syncWebDocumentHead(head: WebPageHead): void;
26
25
  export declare function updateWebDocumentTitle(title: string): void;
27
26
  export declare function setupWebResourceHints(config?: WebResourceHintsConfig): void;
28
27
  export declare function resetWebDocumentHead(): void;
29
- //#endregion
30
28
  export type { WebSeoConfig as WebRuntimeSeoConfig };
31
29
  //# sourceMappingURL=index.d.mts.map
@@ -1,4 +1,4 @@
1
- //#region src/runtime/seo/index.ts
1
+ // src/runtime/seo/index.ts
2
2
  const HEAD_MARKER = "data-weapp-web-head";
3
3
  const HEAD_OWNER = "weapp-web-runtime";
4
4
  let seoConfig = { enabled: false };
@@ -89,6 +89,5 @@ function resetWebDocumentHead() {
89
89
  seoConfig = { enabled: false };
90
90
  }
91
91
 
92
- //#endregion
93
92
  export { configureWebSeo, resetWebDocumentHead, setupWebResourceHints, syncWebDocumentHead, updateWebDocumentTitle };
94
93
  //# sourceMappingURL=index.mjs.map