@weapp-vite/web 2.0.1 → 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 (303) 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 +26 -8
  5. package/dist/compiler/wxml/compile.mjs.map +1 -1
  6. package/dist/compiler/wxml/dependency.mjs +1 -2
  7. package/dist/compiler/wxml/interpolation.mjs +13 -3
  8. package/dist/compiler/wxml/interpolation.mjs.map +1 -1
  9. package/dist/compiler/wxml/nativeTags.mjs +60 -0
  10. package/dist/compiler/wxml/nativeTags.mjs.map +1 -0
  11. package/dist/compiler/wxml/navigation.mjs +1 -2
  12. package/dist/compiler/wxml/parser.mjs +1 -2
  13. package/dist/compiler/wxml/prepare.mjs +1 -2
  14. package/dist/compiler/wxml/renderer.mjs +1 -2
  15. package/dist/compiler/wxml/specialNodes.mjs +1 -2
  16. package/dist/compiler/wxml/types.d.mts +0 -2
  17. package/dist/compiler/wxml/unknownTags.mjs +33 -0
  18. package/dist/compiler/wxml/unknownTags.mjs.map +1 -0
  19. package/dist/compiler/wxs.mjs +1 -2
  20. package/dist/css/wxss.d.mts +2 -19
  21. package/dist/css/wxss.mjs +5 -12
  22. package/dist/css/wxss.mjs.map +1 -1
  23. package/dist/index.d.mts +8 -3
  24. package/dist/index.mjs +8 -5
  25. package/dist/plugin/assets.d.mts +0 -2
  26. package/dist/plugin/assets.mjs +1 -2
  27. package/dist/plugin/constants.mjs +1 -2
  28. package/dist/plugin/dependencyScan.mjs +1 -2
  29. package/dist/plugin/entry.mjs +6 -4
  30. package/dist/plugin/entry.mjs.map +1 -1
  31. package/dist/plugin/files.mjs +1 -2
  32. package/dist/plugin/hostTypes.d.mts +0 -2
  33. package/dist/plugin/index.d.mts +0 -2
  34. package/dist/plugin/index.mjs +5 -5
  35. package/dist/plugin/index.mjs.map +1 -1
  36. package/dist/plugin/layout.mjs +1 -2
  37. package/dist/plugin/navigation.mjs +1 -2
  38. package/dist/plugin/packageResolution.mjs +1 -2
  39. package/dist/plugin/path.mjs +1 -2
  40. package/dist/plugin/register.mjs +1 -2
  41. package/dist/plugin/scan.mjs +1 -2
  42. package/dist/plugin/scanConfig.mjs +1 -2
  43. package/dist/plugin/scanSfc.mjs +1 -2
  44. package/dist/plugin/sfcHmr.mjs +1 -2
  45. package/dist/plugin/state.mjs +1 -2
  46. package/dist/plugin/styleModule.mjs +1 -2
  47. package/dist/plugin/types.d.mts +2 -3
  48. package/dist/plugin/vueSfc.mjs +1 -2
  49. package/dist/runtime/appShell/container.mjs +1 -2
  50. package/dist/runtime/appShell/tabBar/index.mjs +1 -2
  51. package/dist/runtime/appShell/tabBar/style.mjs +1 -2
  52. package/dist/runtime/appStyle.mjs +1 -2
  53. package/dist/runtime/button/helpers.mjs +1 -2
  54. package/dist/runtime/button/index.d.mts +0 -2
  55. package/dist/runtime/button/index.mjs +1 -2
  56. package/dist/runtime/button/style.mjs +1 -2
  57. package/dist/runtime/component/behavior.mjs +1 -2
  58. package/dist/runtime/component/constants.mjs +1 -2
  59. package/dist/runtime/component/dom.mjs +1 -2
  60. package/dist/runtime/component/element.mjs +9 -2
  61. package/dist/runtime/component/element.mjs.map +1 -1
  62. package/dist/runtime/component/events.mjs +4 -4
  63. package/dist/runtime/component/events.mjs.map +1 -1
  64. package/dist/runtime/component/index.d.mts +0 -2
  65. package/dist/runtime/component/index.mjs +1 -2
  66. package/dist/runtime/component/observers.mjs +1 -2
  67. package/dist/runtime/component/publicInstance.mjs +1 -2
  68. package/dist/runtime/component/relations.mjs +1 -2
  69. package/dist/runtime/component/slots.mjs +1 -2
  70. package/dist/runtime/component/state.mjs +1 -2
  71. package/dist/runtime/component/types.d.mts +0 -2
  72. package/dist/runtime/component/utils.mjs +1 -2
  73. package/dist/runtime/component/virtualHost.mjs +1 -2
  74. package/dist/runtime/componentEvents.mjs +1 -2
  75. package/dist/runtime/dataset.mjs +49 -0
  76. package/dist/runtime/dataset.mjs.map +1 -0
  77. package/dist/runtime/datasetBinding.d.mts +13 -0
  78. package/dist/runtime/datasetBinding.mjs +40 -0
  79. package/dist/runtime/datasetBinding.mjs.map +1 -0
  80. package/dist/runtime/eventBinding.d.mts +0 -2
  81. package/dist/runtime/eventBinding.mjs +1 -2
  82. package/dist/runtime/execution.d.mts +0 -2
  83. package/dist/runtime/execution.mjs +1 -2
  84. package/dist/runtime/host/index.d.mts +0 -2
  85. package/dist/runtime/host/index.mjs +1 -2
  86. package/dist/runtime/host/types.d.mts +0 -2
  87. package/dist/runtime/hostGlobals.d.mts +0 -2
  88. package/dist/runtime/hostGlobals.mjs +1 -2
  89. package/dist/runtime/index.d.mts +8 -3
  90. package/dist/runtime/index.mjs +9 -7
  91. package/dist/runtime/index.mjs.map +1 -1
  92. package/dist/runtime/inlineStyle.d.mts +5 -0
  93. package/dist/runtime/inlineStyle.mjs +21 -0
  94. package/dist/runtime/inlineStyle.mjs.map +1 -0
  95. package/dist/runtime/inputHandlerResult.mjs +1 -2
  96. package/dist/runtime/legacyTemplate/dataset.mjs +53 -0
  97. package/dist/runtime/legacyTemplate/dataset.mjs.map +1 -0
  98. package/dist/runtime/legacyTemplate/dom.mjs +20 -5
  99. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
  100. package/dist/runtime/legacyTemplate/expression.mjs +1 -2
  101. package/dist/runtime/legacyTemplate/index.d.mts +0 -2
  102. package/dist/runtime/legacyTemplate/index.mjs +23 -16
  103. package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
  104. package/dist/runtime/legacyTemplate/types.d.mts +0 -2
  105. package/dist/runtime/nativeComponents/canvas/index.mjs +1 -2
  106. package/dist/runtime/nativeComponents/checkbox.mjs +1 -2
  107. package/dist/runtime/nativeComponents/cover/index.mjs +1 -2
  108. package/dist/runtime/nativeComponents/form.d.mts +0 -2
  109. package/dist/runtime/nativeComponents/form.mjs +1 -2
  110. package/dist/runtime/nativeComponents/formControl.mjs +1 -2
  111. package/dist/runtime/nativeComponents/helpers.mjs +1 -2
  112. package/dist/runtime/nativeComponents/icon/helpers.mjs +1 -2
  113. package/dist/runtime/nativeComponents/icon/index.mjs +1 -2
  114. package/dist/runtime/nativeComponents/icon/style.mjs +1 -2
  115. package/dist/runtime/nativeComponents/image.d.mts +0 -2
  116. package/dist/runtime/nativeComponents/image.mjs +1 -2
  117. package/dist/runtime/nativeComponents/index.d.mts +1 -3
  118. package/dist/runtime/nativeComponents/index.mjs +3 -3
  119. package/dist/runtime/nativeComponents/index.mjs.map +1 -1
  120. package/dist/runtime/nativeComponents/input.d.mts +0 -2
  121. package/dist/runtime/nativeComponents/input.mjs +1 -2
  122. package/dist/runtime/nativeComponents/label.mjs +1 -2
  123. package/dist/runtime/nativeComponents/mediaRegistry.mjs +1 -2
  124. package/dist/runtime/nativeComponents/movable/helpers.mjs +1 -2
  125. package/dist/runtime/nativeComponents/movable/index.mjs +1 -2
  126. package/dist/runtime/nativeComponents/navigator.mjs +1 -2
  127. package/dist/runtime/nativeComponents/picker/editors.mjs +1 -2
  128. package/dist/runtime/nativeComponents/picker/helpers.mjs +1 -2
  129. package/dist/runtime/nativeComponents/picker/index.mjs +1 -2
  130. package/dist/runtime/nativeComponents/picker/style.mjs +1 -2
  131. package/dist/runtime/nativeComponents/pickerView/column.mjs +1 -2
  132. package/dist/runtime/nativeComponents/pickerView/helpers.mjs +1 -2
  133. package/dist/runtime/nativeComponents/pickerView/index.mjs +1 -2
  134. package/dist/runtime/nativeComponents/pickerView/style.mjs +1 -2
  135. package/dist/runtime/nativeComponents/primitives.mjs +1 -2
  136. package/dist/runtime/nativeComponents/progress/helpers.mjs +1 -2
  137. package/dist/runtime/nativeComponents/progress/index.mjs +1 -2
  138. package/dist/runtime/nativeComponents/progress/style.mjs +1 -2
  139. package/dist/runtime/nativeComponents/radio.mjs +1 -2
  140. package/dist/runtime/nativeComponents/richText/index.mjs +1 -2
  141. package/dist/runtime/nativeComponents/scrollView/boundaries.mjs +62 -0
  142. package/dist/runtime/nativeComponents/scrollView/boundaries.mjs.map +1 -0
  143. package/dist/runtime/nativeComponents/{scrollView.d.mts → scrollView/helpers.d.mts} +4 -5
  144. package/dist/runtime/nativeComponents/scrollView/helpers.mjs +14 -0
  145. package/dist/runtime/nativeComponents/scrollView/helpers.mjs.map +1 -0
  146. package/dist/runtime/nativeComponents/scrollView/index.mjs +193 -0
  147. package/dist/runtime/nativeComponents/scrollView/index.mjs.map +1 -0
  148. package/dist/runtime/nativeComponents/scrollView/position.mjs +43 -0
  149. package/dist/runtime/nativeComponents/scrollView/position.mjs.map +1 -0
  150. package/dist/runtime/nativeComponents/slider/helpers.mjs +1 -2
  151. package/dist/runtime/nativeComponents/slider/index.mjs +1 -2
  152. package/dist/runtime/nativeComponents/slider/style.mjs +1 -2
  153. package/dist/runtime/nativeComponents/style.mjs +1 -2
  154. package/dist/runtime/nativeComponents/swiper/helpers.mjs +1 -2
  155. package/dist/runtime/nativeComponents/swiper/index.mjs +1 -2
  156. package/dist/runtime/nativeComponents/swiper/item.mjs +1 -2
  157. package/dist/runtime/nativeComponents/swiper/style.mjs +1 -2
  158. package/dist/runtime/nativeComponents/switch.d.mts +0 -2
  159. package/dist/runtime/nativeComponents/switch.mjs +1 -2
  160. package/dist/runtime/nativeComponents/textarea.d.mts +0 -2
  161. package/dist/runtime/nativeComponents/textarea.mjs +1 -2
  162. package/dist/runtime/nativeComponents/video/helpers.d.mts +0 -2
  163. package/dist/runtime/nativeComponents/video/helpers.mjs +1 -2
  164. package/dist/runtime/nativeComponents/video/index.mjs +1 -2
  165. package/dist/runtime/nativeComponents/video/style.mjs +1 -2
  166. package/dist/runtime/navigationBar/index.d.mts +0 -2
  167. package/dist/runtime/navigationBar/index.mjs +1 -2
  168. package/dist/runtime/navigationBar/style.mjs +1 -2
  169. package/dist/runtime/pageLayout.d.mts +0 -2
  170. package/dist/runtime/pageLayout.mjs +1 -2
  171. package/dist/runtime/polyfill/ad.mjs +1 -2
  172. package/dist/runtime/polyfill/animation.mjs +1 -2
  173. package/dist/runtime/polyfill/appState.mjs +1 -2
  174. package/dist/runtime/polyfill/async.d.mts +0 -2
  175. package/dist/runtime/polyfill/async.mjs +1 -2
  176. package/dist/runtime/polyfill/auth.mjs +1 -2
  177. package/dist/runtime/polyfill/authApi.mjs +1 -2
  178. package/dist/runtime/polyfill/background.mjs +1 -2
  179. package/dist/runtime/polyfill/canvasContext.mjs +1 -2
  180. package/dist/runtime/polyfill/capability.mjs +1 -2
  181. package/dist/runtime/polyfill/cloud.mjs +1 -2
  182. package/dist/runtime/polyfill/device.mjs +1 -2
  183. package/dist/runtime/polyfill/deviceApi.mjs +1 -2
  184. package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +0 -2
  185. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +1 -2
  186. package/dist/runtime/polyfill/eventBus.mjs +1 -2
  187. package/dist/runtime/polyfill/filePicker.mjs +1 -2
  188. package/dist/runtime/polyfill/fileSystemManager.mjs +1 -2
  189. package/dist/runtime/polyfill/files.mjs +1 -2
  190. package/dist/runtime/polyfill/font.mjs +1 -2
  191. package/dist/runtime/polyfill/index.d.mts +4 -4
  192. package/dist/runtime/polyfill/index.mjs +11 -4
  193. package/dist/runtime/polyfill/index.mjs.map +1 -1
  194. package/dist/runtime/polyfill/interaction.mjs +1 -2
  195. package/dist/runtime/polyfill/interactionApi.mjs +1 -2
  196. package/dist/runtime/polyfill/intersectionObserver.mjs +4 -4
  197. package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -1
  198. package/dist/runtime/polyfill/lifecycleEvents.d.mts +12 -0
  199. package/dist/runtime/polyfill/lifecycleEvents.mjs +67 -0
  200. package/dist/runtime/polyfill/lifecycleEvents.mjs.map +1 -0
  201. package/dist/runtime/polyfill/locale.mjs +1 -2
  202. package/dist/runtime/polyfill/location.mjs +1 -2
  203. package/dist/runtime/polyfill/locationApi.mjs +1 -2
  204. package/dist/runtime/polyfill/mediaActions.mjs +1 -2
  205. package/dist/runtime/polyfill/mediaApi/file.mjs +1 -2
  206. package/dist/runtime/polyfill/mediaApi/info.mjs +1 -2
  207. package/dist/runtime/polyfill/mediaApi/picker.mjs +1 -2
  208. package/dist/runtime/polyfill/mediaApi/preview.mjs +1 -2
  209. package/dist/runtime/polyfill/mediaApi/process.mjs +1 -2
  210. package/dist/runtime/polyfill/mediaInfo.mjs +1 -2
  211. package/dist/runtime/polyfill/mediaPicker.mjs +1 -2
  212. package/dist/runtime/polyfill/mediaProcess.mjs +1 -2
  213. package/dist/runtime/polyfill/menuApi.mjs +5 -3
  214. package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
  215. package/dist/runtime/polyfill/navigationBarRuntime.mjs +1 -2
  216. package/dist/runtime/polyfill/network/request.mjs +1 -2
  217. package/dist/runtime/polyfill/network/requestBridge.mjs +1 -2
  218. package/dist/runtime/polyfill/network/status.mjs +1 -2
  219. package/dist/runtime/polyfill/platformApi.mjs +1 -2
  220. package/dist/runtime/polyfill/platformRuntime.mjs +1 -2
  221. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +1 -2
  222. package/dist/runtime/polyfill/routeRuntime/dom.mjs +1 -2
  223. package/dist/runtime/polyfill/routeRuntime/events.d.mts +0 -2
  224. package/dist/runtime/polyfill/routeRuntime/events.mjs +1 -2
  225. package/dist/runtime/polyfill/routeRuntime/history.d.mts +0 -2
  226. package/dist/runtime/polyfill/routeRuntime/history.mjs +1 -2
  227. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +1 -2
  228. package/dist/runtime/polyfill/routeRuntime/options.d.mts +0 -2
  229. package/dist/runtime/polyfill/routeRuntime/options.mjs +1 -2
  230. package/dist/runtime/polyfill/routeRuntime/result.mjs +1 -2
  231. package/dist/runtime/polyfill/routeRuntime/scroll.mjs +37 -6
  232. package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -1
  233. package/dist/runtime/polyfill/routeRuntime/stack.mjs +1 -2
  234. package/dist/runtime/polyfill/routeRuntime/url.mjs +1 -2
  235. package/dist/runtime/polyfill/routeRuntime.d.mts +2 -2
  236. package/dist/runtime/polyfill/routeRuntime.mjs +14 -5
  237. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
  238. package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +1 -2
  239. package/dist/runtime/polyfill/runtimeDataApi.d.mts +0 -2
  240. package/dist/runtime/polyfill/runtimeDataApi.mjs +1 -2
  241. package/dist/runtime/polyfill/runtimeInfra.mjs +1 -2
  242. package/dist/runtime/polyfill/runtimeOps.mjs +1 -2
  243. package/dist/runtime/polyfill/selectorQuery.mjs +3 -3
  244. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
  245. package/dist/runtime/polyfill/storage.mjs +1 -2
  246. package/dist/runtime/polyfill/storageAsync.mjs +1 -2
  247. package/dist/runtime/polyfill/subscribe.mjs +1 -2
  248. package/dist/runtime/polyfill/system.mjs +1 -2
  249. package/dist/runtime/polyfill/systemApi.mjs +1 -2
  250. package/dist/runtime/polyfill/types/base.d.mts +0 -2
  251. package/dist/runtime/polyfill/types/common.d.mts +0 -2
  252. package/dist/runtime/polyfill/types/lifecycle.d.mts +12 -0
  253. package/dist/runtime/polyfill/types/locationRuntime.d.mts +0 -2
  254. package/dist/runtime/polyfill/types/mediaAuth.d.mts +0 -2
  255. package/dist/runtime/polyfill/types/platformRuntime.d.mts +0 -2
  256. package/dist/runtime/polyfill/types/systemAuth.d.mts +0 -2
  257. package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +0 -2
  258. package/dist/runtime/polyfill/ui.mjs +1 -2
  259. package/dist/runtime/polyfill/uiFeedback.mjs +19 -5
  260. package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -1
  261. package/dist/runtime/polyfill/uiMediaApi.d.mts +8 -2
  262. package/dist/runtime/polyfill/uiMediaApi.mjs +20 -5
  263. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
  264. package/dist/runtime/polyfill/videoContext.mjs +1 -2
  265. package/dist/runtime/polyfill/vkSession.mjs +1 -2
  266. package/dist/runtime/polyfill/windowResize.mjs +1 -2
  267. package/dist/runtime/polyfill/worker.mjs +1 -2
  268. package/dist/runtime/polyfill.d.mts +4 -2
  269. package/dist/runtime/renderContext.d.mts +0 -2
  270. package/dist/runtime/renderContext.mjs +5 -4
  271. package/dist/runtime/renderContext.mjs.map +1 -1
  272. package/dist/runtime/rpx.d.mts +0 -2
  273. package/dist/runtime/rpx.mjs +6 -6
  274. package/dist/runtime/rpx.mjs.map +1 -1
  275. package/dist/runtime/seo/index.d.mts +0 -2
  276. package/dist/runtime/seo/index.mjs +1 -2
  277. package/dist/runtime/style.d.mts +0 -2
  278. package/dist/runtime/style.mjs +1 -2
  279. package/dist/runtime/template.d.mts +0 -2
  280. package/dist/runtime/utils/object.mjs +1 -2
  281. package/dist/runtime/viewport/index.d.mts +0 -2
  282. package/dist/runtime/viewport/index.mjs +1 -2
  283. package/dist/runtime/viewport/style.mjs +2 -2
  284. package/dist/runtime/viewport/style.mjs.map +1 -1
  285. package/dist/runtime/viewport/types.d.mts +0 -2
  286. package/dist/runtime/warning.d.mts +0 -2
  287. package/dist/runtime/warning.mjs +1 -2
  288. package/dist/runtime/wevu.d.mts +0 -2
  289. package/dist/runtime/wevu.mjs +1 -2
  290. package/dist/shared/nativeComponents.mjs +10 -3
  291. package/dist/shared/nativeComponents.mjs.map +1 -1
  292. package/dist/shared/slugify.mjs +1 -2
  293. package/dist/shared/styleUnits/options.d.mts +24 -0
  294. package/dist/shared/styleUnits/options.mjs +13 -0
  295. package/dist/shared/styleUnits/options.mjs.map +1 -0
  296. package/dist/shared/styleUnits/value.mjs +63 -0
  297. package/dist/shared/styleUnits/value.mjs.map +1 -0
  298. package/dist/shared/tabBar.d.mts +0 -2
  299. package/dist/shared/tabBar.mjs +1 -2
  300. package/dist/shared/wxml.mjs +1 -2
  301. package/package.json +15 -13
  302. package/dist/runtime/nativeComponents/scrollView.mjs +0 -88
  303. package/dist/runtime/nativeComponents/scrollView.mjs.map +0 -1
@@ -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,YAA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AAM,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,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,YAAY,8BAA8B,QAAQ,KAAK,QAAQ;EAE7E;EACA,gBAAgB,IAAI,SAAS,SAAS;CACxC;CACA,IAAI;EACF,OAAO,YAAY,KAAK;CAC1B,SACO,OAAO;EACZ,MAAM,OAAO,wBAAwB;EACrC,IAAI,SAAS,UAAU;GACrB,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACpE,MAAM,IAAI,MAAM,wCAAwC,QAAQ,KAAK,QAAQ;EAC/E;EACA,IAAI,SAAS,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AW,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,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
@@ -1,5 +1,3 @@
1
- //#region src/runtime/style.d.ts
2
1
  export declare function removeStyle(id: string): void;
3
2
  export declare function injectStyle(css: string, id?: string): () => void;
4
- //#endregion
5
3
  //# sourceMappingURL=style.d.mts.map
@@ -1,4 +1,4 @@
1
- //#region src/runtime/style.ts
1
+ // src/runtime/style.ts
2
2
  const injected = /* @__PURE__ */ new Map();
3
3
  function createStyleId(css) {
4
4
  let hash = 2166136261;
@@ -32,6 +32,5 @@ function injectStyle(css, id) {
32
32
  return () => removeStyle(styleId);
33
33
  }
34
34
 
35
- //#endregion
36
35
  export { injectStyle, removeStyle };
37
36
  //# sourceMappingURL=style.mjs.map
@@ -1,9 +1,7 @@
1
1
  import { RenderContext } from "./renderContext.mjs";
2
2
  import { createTemplate, renderTemplate } from "./legacyTemplate/index.mjs";
3
3
  import { TemplateResult } from "lit";
4
- //#region src/runtime/template.d.ts
5
4
  export type TemplateScope = Record<string, any>;
6
5
  export type TemplateRenderer = (scope: TemplateScope, ctx: RenderContext) => TemplateResult | string | unknown;
7
- //#endregion
8
6
  export { createTemplate, renderTemplate };
9
7
  //# sourceMappingURL=template.d.mts.map
@@ -1,8 +1,7 @@
1
- //#region src/runtime/utils/object.ts
1
+ // src/runtime/utils/object.ts
2
2
  function hasOwn(source, key) {
3
3
  return Object.prototype.hasOwnProperty.call(source, key);
4
4
  }
5
5
 
6
- //#endregion
7
6
  export { hasOwn };
8
7
  //# sourceMappingURL=object.mjs.map
@@ -1,5 +1,4 @@
1
1
  import { ResolvedWebViewportConfig, WebViewportConfig } from "./types.mjs";
2
- //#region src/runtime/viewport/index.d.ts
3
2
  export declare function resolveWebViewportConfig(config?: WebViewportConfig): ResolvedWebViewportConfig;
4
3
  export declare function setupWebViewport(config?: WebViewportConfig): {
5
4
  mode: "mini-program" | "responsive";
@@ -7,6 +6,5 @@ export declare function setupWebViewport(config?: WebViewportConfig): {
7
6
  desktopBreakpoint: number;
8
7
  };
9
8
  export declare function getWebViewportWidth(): number;
10
- //#endregion
11
9
  export type { ResolvedWebViewportConfig, WebViewportConfig };
12
10
  //# sourceMappingURL=index.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { WEB_VIEWPORT_STYLE_ID, createWebViewportStyle } from "./style.mjs";
2
2
 
3
- //#region src/runtime/viewport/index.ts
3
+ // src/runtime/viewport/index.ts
4
4
  const DEFAULT_VIEWPORT_CONFIG = {
5
5
  mode: "mini-program",
6
6
  maxWidth: 375,
@@ -39,6 +39,5 @@ function getWebViewportWidth() {
39
39
  return documentWidth || (typeof window !== "undefined" ? window.innerWidth : 0);
40
40
  }
41
41
 
42
- //#endregion
43
42
  export { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport };
44
43
  //# sourceMappingURL=index.mjs.map
@@ -1,10 +1,11 @@
1
- //#region src/runtime/viewport/style.ts
1
+ // src/runtime/viewport/style.ts
2
2
  const WEB_VIEWPORT_STYLE_ID = "weapp-web-viewport-style";
3
3
  function createWebViewportStyle(config) {
4
4
  const maxWidth = `${config.maxWidth}px`;
5
5
  return `
6
6
  :root {
7
7
  --weapp-viewport-width: 100vw;
8
+ --weapp-viewport-height: 100dvh;
8
9
  --weapp-viewport-max-width: ${maxWidth};
9
10
  --weapp-viewport-left: 0px;
10
11
  --weapp-viewport-right: 0px;
@@ -57,6 +58,5 @@ body {
57
58
  `;
58
59
  }
59
60
 
60
- //#endregion
61
61
  export { WEB_VIEWPORT_STYLE_ID, createWebViewportStyle };
62
62
  //# sourceMappingURL=style.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":[],"sources":["../../../src/runtime/viewport/style.ts"],"sourcesContent":["import type { ResolvedWebViewportConfig } from './types'\n\nexport const WEB_VIEWPORT_STYLE_ID = 'weapp-web-viewport-style'\n\nexport function createWebViewportStyle(config: ResolvedWebViewportConfig) {\n const maxWidth = `${config.maxWidth}px`\n const breakpoint = `${config.desktopBreakpoint}px`\n return `\n:root {\n --weapp-viewport-width: 100vw;\n --weapp-viewport-max-width: ${maxWidth};\n --weapp-viewport-left: 0px;\n --weapp-viewport-right: 0px;\n --weapp-safe-area-inset-top: env(safe-area-inset-top, 0px);\n --weapp-safe-area-inset-right: env(safe-area-inset-right, 0px);\n --weapp-safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);\n --weapp-safe-area-inset-left: env(safe-area-inset-left, 0px);\n}\n\nhtml,\nbody {\n min-width: 0;\n height: 100%;\n margin: 0;\n overflow: hidden;\n}\n\nbody {\n background: #f2f2f2;\n font-family: Helvetica, -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n}\n\n#app {\n --weapp-tab-bar-inset: 0px;\n --weapp-tab-bar-top-inset: 0px;\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 100dvh;\n min-height: 0;\n margin: 0 auto;\n overflow: auto;\n overscroll-behavior: contain;\n background: #ffffff;\n contain: layout paint;\n transform: translateZ(0);\n}\n\n@media (min-width: ${breakpoint}) {\n html[data-weapp-viewport-mode=\"mini-program\"] {\n --weapp-viewport-width: ${maxWidth};\n --weapp-viewport-left: calc((100vw - ${maxWidth}) / 2);\n --weapp-viewport-right: calc((100vw - ${maxWidth}) / 2);\n }\n\n html[data-weapp-viewport-mode=\"mini-program\"] #app {\n width: ${maxWidth};\n }\n}\n`\n}\n"],"mappings":";AAEA,MAAa,wBAAwB;AAErC,SAAgB,uBAAuB,QAAmC;CACxE,MAAM,WAAW,GAAG,OAAO,SAAS;CAEpC,OAAO;;;gCAGuB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsCpB,GA1CG,OAAO,kBAAkB,IA0CjB;;8BAEF,SAAS;2CACI,SAAS;4CACR,SAAS;;;;aAIxC,SAAS;;;;AAItB"}
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../../src/runtime/viewport/style.ts"],"sourcesContent":["import type { ResolvedWebViewportConfig } from './types'\n\nexport const WEB_VIEWPORT_STYLE_ID = 'weapp-web-viewport-style'\n\nexport function createWebViewportStyle(config: ResolvedWebViewportConfig) {\n const maxWidth = `${config.maxWidth}px`\n const breakpoint = `${config.desktopBreakpoint}px`\n return `\n:root {\n --weapp-viewport-width: 100vw;\n --weapp-viewport-height: 100dvh;\n --weapp-viewport-max-width: ${maxWidth};\n --weapp-viewport-left: 0px;\n --weapp-viewport-right: 0px;\n --weapp-safe-area-inset-top: env(safe-area-inset-top, 0px);\n --weapp-safe-area-inset-right: env(safe-area-inset-right, 0px);\n --weapp-safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);\n --weapp-safe-area-inset-left: env(safe-area-inset-left, 0px);\n}\n\nhtml,\nbody {\n min-width: 0;\n height: 100%;\n margin: 0;\n overflow: hidden;\n}\n\nbody {\n background: #f2f2f2;\n font-family: Helvetica, -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n}\n\n#app {\n --weapp-tab-bar-inset: 0px;\n --weapp-tab-bar-top-inset: 0px;\n position: relative;\n box-sizing: border-box;\n width: 100%;\n height: 100dvh;\n min-height: 0;\n margin: 0 auto;\n overflow: auto;\n overscroll-behavior: contain;\n background: #ffffff;\n contain: layout paint;\n transform: translateZ(0);\n}\n\n@media (min-width: ${breakpoint}) {\n html[data-weapp-viewport-mode=\"mini-program\"] {\n --weapp-viewport-width: ${maxWidth};\n --weapp-viewport-left: calc((100vw - ${maxWidth}) / 2);\n --weapp-viewport-right: calc((100vw - ${maxWidth}) / 2);\n }\n\n html[data-weapp-viewport-mode=\"mini-program\"] #app {\n width: ${maxWidth};\n }\n}\n`\n}\n"],"mappings":";AAEA,MAAa,wBAAwB;AAErC,SAAgB,uBAAuB,QAAmC;CACxE,MAAM,WAAW,GAAG,OAAO,SAAS;CAEpC,OAAO;;;;gCAIuB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsCpB,GA3CG,OAAO,kBAAkB,IA2CjB;;8BAEF,SAAS;2CACI,SAAS;4CACR,SAAS;;;;aAIxC,SAAS;;;;AAItB"}
@@ -1,4 +1,3 @@
1
- //#region src/runtime/viewport/types.d.ts
2
1
  export interface WebViewportConfig {
3
2
  mode?: 'mini-program' | 'responsive';
4
3
  maxWidth?: number;
@@ -9,5 +8,4 @@ export interface ResolvedWebViewportConfig {
9
8
  maxWidth: number;
10
9
  desktopBreakpoint: number;
11
10
  }
12
- //#endregion
13
11
  //# sourceMappingURL=types.d.mts.map
@@ -1,9 +1,7 @@
1
- //#region src/runtime/warning.d.ts
2
1
  export type RuntimeWarningLevel = 'off' | 'warn' | 'error';
3
2
  export interface RuntimeWarningOptions {
4
3
  level?: RuntimeWarningLevel;
5
4
  dedupe?: boolean;
6
5
  }
7
6
  export declare function setRuntimeWarningOptions(options?: RuntimeWarningOptions): void;
8
- //#endregion
9
7
  //# sourceMappingURL=warning.d.mts.map
@@ -1,4 +1,4 @@
1
- //#region src/runtime/warning.ts
1
+ // src/runtime/warning.ts
2
2
  const defaultWarningOptions = {
3
3
  level: "warn",
4
4
  dedupe: true
@@ -38,6 +38,5 @@ function emitRuntimeWarning(message, options = {}) {
38
38
  if (typeof logger.warn === "function") logger.warn(normalized);
39
39
  }
40
40
 
41
- //#endregion
42
41
  export { emitRuntimeWarning, setRuntimeWarningOptions };
43
42
  //# sourceMappingURL=warning.mjs.map
@@ -1,5 +1,4 @@
1
1
  import { RegisterMeta } from "./polyfill/routeRuntime/options.mjs";
2
- //#region src/runtime/wevu.d.ts
3
2
  interface WevuRegisterMeta extends RegisterMeta {
4
3
  kind: 'app' | 'page' | 'component';
5
4
  }
@@ -19,6 +18,5 @@ export declare function registerWebWevuComponentFactory<TArgs extends unknown[],
19
18
  * 在原生模块同步求值期间安装带页面元数据的宿主注册函数。
20
19
  */
21
20
  export declare function installWebModuleRegistration(meta: WevuRegisterMeta, target?: Record<string, any>): () => void;
22
- //#endregion
23
21
  export {};
24
22
  //# sourceMappingURL=wevu.d.mts.map
@@ -2,7 +2,7 @@ import { setAppStyle } from "./appStyle.mjs";
2
2
  import { registerApp, registerComponent, registerPage } from "./polyfill/routeRuntime.mjs";
3
3
  import { createApp, createWevuComponent, takePendingRuntimeAppRegistration } from "wevu/internal-runtime";
4
4
 
5
- //#region src/runtime/wevu.ts
5
+ // src/runtime/wevu.ts
6
6
  function createRuntimeConstructor(meta, name) {
7
7
  return (definition) => {
8
8
  if (name === "App") registerApp(definition, meta);
@@ -81,6 +81,5 @@ function installWebModuleRegistration(meta, target = globalThis) {
81
81
  };
82
82
  }
83
83
 
84
- //#endregion
85
84
  export { installWebModuleRegistration, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory };
86
85
  //# sourceMappingURL=wevu.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/shared/nativeComponents.ts
1
+ // src/shared/nativeComponents.ts
2
2
  const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([
3
3
  {
4
4
  name: "view",
@@ -238,7 +238,15 @@ const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([
238
238
  "scroll-x",
239
239
  "scroll-y",
240
240
  "scroll-top",
241
- "scroll-left"
241
+ "scroll-left",
242
+ "upper-threshold",
243
+ "lower-threshold",
244
+ "scroll-into-view",
245
+ "scroll-into-view-offset",
246
+ "scroll-into-view-alignment",
247
+ "enable-flex",
248
+ "enhanced",
249
+ "show-scrollbar"
242
250
  ],
243
251
  defaultStyle: "display: block; box-sizing: border-box;"
244
252
  },
@@ -396,6 +404,5 @@ function isKnownUnsupportedNativeComponent(name) {
396
404
  return KNOWN_UNSUPPORTED_NATIVE_COMPONENTS.has(name.toLowerCase());
397
405
  }
398
406
 
399
- //#endregion
400
407
  export { NATIVE_COMPONENT_DESCRIPTORS, getNativeComponentDescriptor, isKnownUnsupportedNativeComponent, resolveNativeComponentPropertyAttributes, resolveNativeComponentWebTag };
401
408
  //# sourceMappingURL=nativeComponents.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeComponents.mjs","names":[],"sources":["../../src/shared/nativeComponents.ts"],"sourcesContent":["export interface NativeComponentDescriptor {\n name: string\n webTag: string\n attributes: readonly string[]\n propertyAttributes?: readonly string[]\n defaultStyle: string\n}\n\nexport const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([\n {\n name: 'view',\n webTag: 'weapp-view',\n attributes: [],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'text',\n webTag: 'weapp-text',\n attributes: ['selectable', 'user-select', 'space', 'decode'],\n defaultStyle: 'display: inline; box-sizing: border-box; white-space: pre-wrap;',\n },\n {\n name: 'image',\n webTag: 'weapp-image',\n attributes: ['src', 'mode', 'lazy-load', 'alt'],\n defaultStyle: 'display: inline-block; box-sizing: border-box; width: 320px; height: 240px; overflow: hidden; vertical-align: middle;',\n },\n {\n name: 'button',\n webTag: 'weapp-button',\n attributes: ['type', 'size', 'plain', 'disabled', 'loading', 'form-type', 'open-type'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'input',\n webTag: 'weapp-input',\n attributes: ['name', 'value', 'type', 'password', 'placeholder', 'disabled', 'maxlength', 'confirm-type', 'focus'],\n defaultStyle: 'display: block; box-sizing: border-box; min-height: 1.4em;',\n },\n {\n name: 'textarea',\n webTag: 'weapp-textarea',\n attributes: ['name', 'value', 'placeholder', 'disabled', 'maxlength', 'confirm-type', 'auto-focus', 'focus', 'auto-height'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 150px;',\n },\n {\n name: 'form',\n webTag: 'weapp-form',\n attributes: [],\n defaultStyle: 'display: inline; box-sizing: border-box;',\n },\n {\n name: 'label',\n webTag: 'weapp-label',\n attributes: ['for'],\n defaultStyle: 'display: inline; box-sizing: border-box; cursor: pointer;',\n },\n {\n name: 'checkbox-group',\n webTag: 'weapp-checkbox-group',\n attributes: ['name'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'checkbox',\n webTag: 'weapp-checkbox',\n attributes: ['value', 'checked', 'disabled', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'radio-group',\n webTag: 'weapp-radio-group',\n attributes: ['name'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'radio',\n webTag: 'weapp-radio',\n attributes: ['value', 'checked', 'disabled', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'switch',\n webTag: 'weapp-switch',\n attributes: ['name', 'checked', 'disabled', 'type', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'picker',\n webTag: 'weapp-picker',\n attributes: ['name', 'header-text', 'mode', 'range', 'range-key', 'value', 'start', 'end', 'fields', 'custom-item', 'level', 'disabled'],\n propertyAttributes: ['range', 'value'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'picker-view',\n webTag: 'weapp-picker-view',\n attributes: ['value', 'mask-class', 'indicator-style', 'indicator-class', 'mask-style', 'immediate-change'],\n propertyAttributes: ['value'],\n defaultStyle: 'position: relative; display: flex; box-sizing: border-box; height: 225px; overflow: hidden;',\n },\n {\n name: 'picker-view-column',\n webTag: 'weapp-picker-view-column',\n attributes: ['indicator-style'],\n defaultStyle: 'display: block; box-sizing: border-box; min-width: 0; height: 100%; flex: 1;',\n },\n {\n name: 'slider',\n webTag: 'weapp-slider',\n attributes: ['name', 'min', 'max', 'step', 'disabled', 'value', 'color', 'selected-color', 'active-color', 'background-color', 'block-size', 'block-color', 'show-value'],\n defaultStyle: 'display: block; box-sizing: border-box; margin: 10px 18px;',\n },\n {\n name: 'icon',\n webTag: 'weapp-icon',\n attributes: ['type', 'size', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; justify-content: center; vertical-align: middle;',\n },\n {\n name: 'progress',\n webTag: 'weapp-progress',\n attributes: ['percent', 'show-info', 'stroke-width', 'color', 'active-color', 'background-color', 'active', 'active-mode', 'duration', 'border-radius', 'font-size'],\n defaultStyle: 'display: flex; box-sizing: border-box; align-items: center;',\n },\n {\n name: 'rich-text',\n webTag: 'weapp-rich-text',\n attributes: ['nodes', 'space', 'user-select'],\n propertyAttributes: ['nodes'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'scroll-view',\n webTag: 'weapp-scroll-view',\n attributes: ['scroll-x', 'scroll-y', 'scroll-top', 'scroll-left'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'navigator',\n webTag: 'weapp-navigator',\n attributes: [\n 'url',\n 'open-type',\n 'delta',\n 'target',\n 'app-id',\n 'path',\n 'extra-data',\n 'version',\n 'short-link',\n 'aria-label',\n 'hover-class',\n 'hover-start-time',\n 'hover-stay-time',\n 'hover-stop-propagation',\n ],\n propertyAttributes: ['extra-data'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'swiper',\n webTag: 'weapp-swiper',\n attributes: [\n 'current',\n 'current-item-id',\n 'autoplay',\n 'interval',\n 'duration',\n 'circular',\n 'vertical',\n 'indicator-dots',\n 'indicator-color',\n 'indicator-active-color',\n 'display-multiple-items',\n 'previous-margin',\n 'next-margin',\n 'disable-touch',\n 'easing-function',\n ],\n defaultStyle: 'display: block; box-sizing: border-box; height: 150px; overflow: hidden;',\n },\n {\n name: 'swiper-item',\n webTag: 'weapp-swiper-item',\n attributes: ['item-id'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden;',\n },\n {\n name: 'canvas',\n webTag: 'weapp-canvas',\n attributes: ['id', 'canvas-id', 'type', 'disable-scroll', 'width', 'height'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 150px; overflow: hidden;',\n },\n {\n name: 'video',\n webTag: 'weapp-video',\n attributes: ['id', 'src', 'poster', 'autoplay', 'loop', 'muted', 'controls', 'initial-time', 'object-fit'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 225px; overflow: hidden;',\n },\n {\n name: 'cover-view',\n webTag: 'weapp-cover-view',\n attributes: [],\n defaultStyle: 'position: absolute; z-index: 2; display: block; box-sizing: border-box; pointer-events: auto;',\n },\n {\n name: 'cover-image',\n webTag: 'weapp-cover-image',\n attributes: ['src', 'mode', 'lazy-load', 'alt'],\n defaultStyle: 'position: absolute; z-index: 2; display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden; pointer-events: auto;',\n },\n {\n name: 'movable-area',\n webTag: 'weapp-movable-area',\n attributes: [],\n defaultStyle: 'position: relative; display: block; box-sizing: border-box; overflow: hidden;',\n },\n {\n name: 'movable-view',\n webTag: 'weapp-movable-view',\n attributes: ['direction', 'inertia', 'out-of-bounds', 'x', 'y', 'damping', 'friction', 'disabled', 'scale', 'scale-min', 'scale-max', 'scale-value', 'animation'],\n defaultStyle: 'position: absolute; top: 0; left: 0; display: block; box-sizing: border-box; width: 10px; height: 10px; touch-action: none; user-select: none;',\n },\n] as const satisfies readonly NativeComponentDescriptor[])\n\nexport type SupportedNativeComponentName = typeof NATIVE_COMPONENT_DESCRIPTORS[number]['name']\nexport type NativeComponentWebTag = typeof NATIVE_COMPONENT_DESCRIPTORS[number]['webTag']\n\nconst descriptorMap = new Map<string, NativeComponentDescriptor>(\n NATIVE_COMPONENT_DESCRIPTORS.map(descriptor => [descriptor.name, descriptor]),\n)\n\nconst KNOWN_UNSUPPORTED_NATIVE_COMPONENTS = new Set([\n 'editor',\n 'keyboard-accessory',\n 'match-media',\n 'root-portal',\n 'page-container',\n 'share-element',\n 'audio',\n 'camera',\n 'live-player',\n 'live-pusher',\n 'map',\n 'web-view',\n 'ad',\n 'official-account',\n 'open-data',\n])\n\nexport function getNativeComponentDescriptor(name: string) {\n return descriptorMap.get(name.toLowerCase())\n}\n\nexport function resolveNativeComponentWebTag(name: string) {\n return getNativeComponentDescriptor(name)?.webTag\n}\n\nexport function resolveNativeComponentPropertyAttributes(name: string) {\n return getNativeComponentDescriptor(name)?.propertyAttributes ?? []\n}\n\nexport function isKnownUnsupportedNativeComponent(name: string) {\n return KNOWN_UNSUPPORTED_NATIVE_COMPONENTS.has(name.toLowerCase())\n}\n"],"mappings":";AAQA,MAAa,+BAA+B,OAAO,OAAO;CACxD;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAc;GAAe;GAAS;EAAQ;EAC3D,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAO;GAAQ;GAAa;EAAK;EAC9C,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAQ;GAAS;GAAY;GAAW;GAAa;EAAW;EACrF,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAS;GAAQ;GAAY;GAAe;GAAY;GAAa;GAAgB;EAAO;EACjH,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAS;GAAe;GAAY;GAAa;GAAgB;GAAc;GAAS;EAAa;EAC1H,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,KAAK;EAClB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,MAAM;EACnB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAS;GAAW;GAAY;EAAO;EACpD,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,MAAM;EACnB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAA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E;AAEA,SAAgB,kCAAkC,MAAc;CAC9D,OAAO,oCAAoC,IAAI,KAAK,YAAY,CAAC;AACnE"}
1
+ {"version":3,"file":"nativeComponents.mjs","names":[],"sources":["../../src/shared/nativeComponents.ts"],"sourcesContent":["export interface NativeComponentDescriptor {\n name: string\n webTag: string\n attributes: readonly string[]\n propertyAttributes?: readonly string[]\n defaultStyle: string\n}\n\nexport const NATIVE_COMPONENT_DESCRIPTORS = Object.freeze([\n {\n name: 'view',\n webTag: 'weapp-view',\n attributes: [],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'text',\n webTag: 'weapp-text',\n attributes: ['selectable', 'user-select', 'space', 'decode'],\n defaultStyle: 'display: inline; box-sizing: border-box; white-space: pre-wrap;',\n },\n {\n name: 'image',\n webTag: 'weapp-image',\n attributes: ['src', 'mode', 'lazy-load', 'alt'],\n defaultStyle: 'display: inline-block; box-sizing: border-box; width: 320px; height: 240px; overflow: hidden; vertical-align: middle;',\n },\n {\n name: 'button',\n webTag: 'weapp-button',\n attributes: ['type', 'size', 'plain', 'disabled', 'loading', 'form-type', 'open-type'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'input',\n webTag: 'weapp-input',\n attributes: ['name', 'value', 'type', 'password', 'placeholder', 'disabled', 'maxlength', 'confirm-type', 'focus'],\n defaultStyle: 'display: block; box-sizing: border-box; min-height: 1.4em;',\n },\n {\n name: 'textarea',\n webTag: 'weapp-textarea',\n attributes: ['name', 'value', 'placeholder', 'disabled', 'maxlength', 'confirm-type', 'auto-focus', 'focus', 'auto-height'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 150px;',\n },\n {\n name: 'form',\n webTag: 'weapp-form',\n attributes: [],\n defaultStyle: 'display: inline; box-sizing: border-box;',\n },\n {\n name: 'label',\n webTag: 'weapp-label',\n attributes: ['for'],\n defaultStyle: 'display: inline; box-sizing: border-box; cursor: pointer;',\n },\n {\n name: 'checkbox-group',\n webTag: 'weapp-checkbox-group',\n attributes: ['name'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'checkbox',\n webTag: 'weapp-checkbox',\n attributes: ['value', 'checked', 'disabled', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'radio-group',\n webTag: 'weapp-radio-group',\n attributes: ['name'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'radio',\n webTag: 'weapp-radio',\n attributes: ['value', 'checked', 'disabled', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'switch',\n webTag: 'weapp-switch',\n attributes: ['name', 'checked', 'disabled', 'type', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; vertical-align: middle;',\n },\n {\n name: 'picker',\n webTag: 'weapp-picker',\n attributes: ['name', 'header-text', 'mode', 'range', 'range-key', 'value', 'start', 'end', 'fields', 'custom-item', 'level', 'disabled'],\n propertyAttributes: ['range', 'value'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'picker-view',\n webTag: 'weapp-picker-view',\n attributes: ['value', 'mask-class', 'indicator-style', 'indicator-class', 'mask-style', 'immediate-change'],\n propertyAttributes: ['value'],\n defaultStyle: 'position: relative; display: flex; box-sizing: border-box; height: 225px; overflow: hidden;',\n },\n {\n name: 'picker-view-column',\n webTag: 'weapp-picker-view-column',\n attributes: ['indicator-style'],\n defaultStyle: 'display: block; box-sizing: border-box; min-width: 0; height: 100%; flex: 1;',\n },\n {\n name: 'slider',\n webTag: 'weapp-slider',\n attributes: ['name', 'min', 'max', 'step', 'disabled', 'value', 'color', 'selected-color', 'active-color', 'background-color', 'block-size', 'block-color', 'show-value'],\n defaultStyle: 'display: block; box-sizing: border-box; margin: 10px 18px;',\n },\n {\n name: 'icon',\n webTag: 'weapp-icon',\n attributes: ['type', 'size', 'color'],\n defaultStyle: 'display: inline-flex; box-sizing: border-box; align-items: center; justify-content: center; vertical-align: middle;',\n },\n {\n name: 'progress',\n webTag: 'weapp-progress',\n attributes: ['percent', 'show-info', 'stroke-width', 'color', 'active-color', 'background-color', 'active', 'active-mode', 'duration', 'border-radius', 'font-size'],\n defaultStyle: 'display: flex; box-sizing: border-box; align-items: center;',\n },\n {\n name: 'rich-text',\n webTag: 'weapp-rich-text',\n attributes: ['nodes', 'space', 'user-select'],\n propertyAttributes: ['nodes'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'scroll-view',\n webTag: 'weapp-scroll-view',\n attributes: [\n 'scroll-x',\n 'scroll-y',\n 'scroll-top',\n 'scroll-left',\n 'upper-threshold',\n 'lower-threshold',\n 'scroll-into-view',\n 'scroll-into-view-offset',\n 'scroll-into-view-alignment',\n 'enable-flex',\n 'enhanced',\n 'show-scrollbar',\n ],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'navigator',\n webTag: 'weapp-navigator',\n attributes: [\n 'url',\n 'open-type',\n 'delta',\n 'target',\n 'app-id',\n 'path',\n 'extra-data',\n 'version',\n 'short-link',\n 'aria-label',\n 'hover-class',\n 'hover-start-time',\n 'hover-stay-time',\n 'hover-stop-propagation',\n ],\n propertyAttributes: ['extra-data'],\n defaultStyle: 'display: block; box-sizing: border-box;',\n },\n {\n name: 'swiper',\n webTag: 'weapp-swiper',\n attributes: [\n 'current',\n 'current-item-id',\n 'autoplay',\n 'interval',\n 'duration',\n 'circular',\n 'vertical',\n 'indicator-dots',\n 'indicator-color',\n 'indicator-active-color',\n 'display-multiple-items',\n 'previous-margin',\n 'next-margin',\n 'disable-touch',\n 'easing-function',\n ],\n defaultStyle: 'display: block; box-sizing: border-box; height: 150px; overflow: hidden;',\n },\n {\n name: 'swiper-item',\n webTag: 'weapp-swiper-item',\n attributes: ['item-id'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden;',\n },\n {\n name: 'canvas',\n webTag: 'weapp-canvas',\n attributes: ['id', 'canvas-id', 'type', 'disable-scroll', 'width', 'height'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 150px; overflow: hidden;',\n },\n {\n name: 'video',\n webTag: 'weapp-video',\n attributes: ['id', 'src', 'poster', 'autoplay', 'loop', 'muted', 'controls', 'initial-time', 'object-fit'],\n defaultStyle: 'display: block; box-sizing: border-box; width: 300px; height: 225px; overflow: hidden;',\n },\n {\n name: 'cover-view',\n webTag: 'weapp-cover-view',\n attributes: [],\n defaultStyle: 'position: absolute; z-index: 2; display: block; box-sizing: border-box; pointer-events: auto;',\n },\n {\n name: 'cover-image',\n webTag: 'weapp-cover-image',\n attributes: ['src', 'mode', 'lazy-load', 'alt'],\n defaultStyle: 'position: absolute; z-index: 2; display: block; box-sizing: border-box; width: 100%; height: 100%; overflow: hidden; pointer-events: auto;',\n },\n {\n name: 'movable-area',\n webTag: 'weapp-movable-area',\n attributes: [],\n defaultStyle: 'position: relative; display: block; box-sizing: border-box; overflow: hidden;',\n },\n {\n name: 'movable-view',\n webTag: 'weapp-movable-view',\n attributes: ['direction', 'inertia', 'out-of-bounds', 'x', 'y', 'damping', 'friction', 'disabled', 'scale', 'scale-min', 'scale-max', 'scale-value', 'animation'],\n defaultStyle: 'position: absolute; top: 0; left: 0; display: block; box-sizing: border-box; width: 10px; height: 10px; touch-action: none; user-select: none;',\n },\n] as const satisfies readonly NativeComponentDescriptor[])\n\nexport type SupportedNativeComponentName = typeof NATIVE_COMPONENT_DESCRIPTORS[number]['name']\nexport type NativeComponentWebTag = typeof NATIVE_COMPONENT_DESCRIPTORS[number]['webTag']\n\nconst descriptorMap = new Map<string, NativeComponentDescriptor>(\n NATIVE_COMPONENT_DESCRIPTORS.map(descriptor => [descriptor.name, descriptor]),\n)\n\nconst KNOWN_UNSUPPORTED_NATIVE_COMPONENTS = new Set([\n 'editor',\n 'keyboard-accessory',\n 'match-media',\n 'root-portal',\n 'page-container',\n 'share-element',\n 'audio',\n 'camera',\n 'live-player',\n 'live-pusher',\n 'map',\n 'web-view',\n 'ad',\n 'official-account',\n 'open-data',\n])\n\nexport function getNativeComponentDescriptor(name: string) {\n return descriptorMap.get(name.toLowerCase())\n}\n\nexport function resolveNativeComponentWebTag(name: string) {\n return getNativeComponentDescriptor(name)?.webTag\n}\n\nexport function resolveNativeComponentPropertyAttributes(name: string) {\n return getNativeComponentDescriptor(name)?.propertyAttributes ?? []\n}\n\nexport function isKnownUnsupportedNativeComponent(name: string) {\n return KNOWN_UNSUPPORTED_NATIVE_COMPONENTS.has(name.toLowerCase())\n}\n"],"mappings":";AAQA,MAAa,+BAA+B,OAAO,OAAO;CACxD;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAc;GAAe;GAAS;EAAQ;EAC3D,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAO;GAAQ;GAAa;EAAK;EAC9C,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAQ;GAAS;GAAY;GAAW;GAAa;EAAW;EACrF,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAS;GAAQ;GAAY;GAAe;GAAY;GAAa;GAAgB;EAAO;EACjH,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAQ;GAAS;GAAe;GAAY;GAAa;GAAgB;GAAc;GAAS;EAAa;EAC1H,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC;EACb,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,KAAK;EAClB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY,CAAC,MAAM;EACnB,cAAc;CAChB;CACA;EACE,MAAM;EACN,QAAQ;EACR,YAAY;GAAC;GAAS;GA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AAC;AAC7C;AAEA,SAAgB,6BAA6B,MAAc;CACzD,OAAO,6BAA6B,IAAI,CAAC,EAAE;AAC7C;AAEA,SAAgB,yCAAyC,MAAc;CACrE,OAAO,6BAA6B,IAAI,CAAC,EAAE,sBAAsB,CAAC;AACpE;AAEA,SAAgB,kCAAkC,MAAc;CAC9D,OAAO,oCAAoC,IAAI,KAAK,YAAY,CAAC;AACnE"}
@@ -1,8 +1,7 @@
1
- //#region src/shared/slugify.ts
1
+ // src/shared/slugify.ts
2
2
  function slugify(id, prefix) {
3
3
  return `${prefix}-${id.replace(/[^a-z0-9]+/gi, "-").replace(/^-+|-+$/g, "").toLowerCase() || "index"}`;
4
4
  }
5
5
 
6
- //#endregion
7
6
  export { slugify };
8
7
  //# sourceMappingURL=slugify.mjs.map
@@ -0,0 +1,24 @@
1
+ export interface WxssTransformOptions {
2
+ /**
3
+ * 1rpx 对应的 CSS 像素数。
4
+ * 默认值近似于 750rpx 设计稿在 375px 屏幕上的换算。
5
+ */
6
+ pxPerRpx?: number;
7
+ /**
8
+ * rpx 换算的设计宽度。传入后会把 rpx 转为
9
+ * `calc(var(--rpx) * N)` 以实现响应式缩放。
10
+ */
11
+ designWidth?: number;
12
+ /**
13
+ * 用于存储运行时 rpx 大小的 CSS 变量名。
14
+ * @default "--rpx"
15
+ */
16
+ rpxVar?: string;
17
+ }
18
+ export interface ResolvedStyleUnitOptions {
19
+ useVariable: boolean;
20
+ rpxVar: string;
21
+ ratio: number;
22
+ designWidth: number;
23
+ }
24
+ //# sourceMappingURL=options.d.mts.map
@@ -0,0 +1,13 @@
1
+ // src/shared/styleUnits/options.ts
2
+ /** 编译端与运行时共用显式配置;有限设计宽度优先启用变量模式。 */
3
+ function resolveStyleUnitOptions(options) {
4
+ return {
5
+ useVariable: options?.pxPerRpx === void 0 || typeof options.designWidth === "number" && Number.isFinite(options.designWidth),
6
+ rpxVar: options?.rpxVar ?? "--rpx",
7
+ ratio: options?.pxPerRpx ?? .5,
8
+ designWidth: options?.designWidth ?? 750
9
+ };
10
+ }
11
+
12
+ export { resolveStyleUnitOptions };
13
+ //# sourceMappingURL=options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.mjs","names":[],"sources":["../../../src/shared/styleUnits/options.ts"],"sourcesContent":["export interface WxssTransformOptions {\n /**\n * 1rpx 对应的 CSS 像素数。\n * 默认值近似于 750rpx 设计稿在 375px 屏幕上的换算。\n */\n pxPerRpx?: number\n /**\n * rpx 换算的设计宽度。传入后会把 rpx 转为\n * `calc(var(--rpx) * N)` 以实现响应式缩放。\n */\n designWidth?: number\n /**\n * 用于存储运行时 rpx 大小的 CSS 变量名。\n * @default \"--rpx\"\n */\n rpxVar?: string\n}\n\nexport interface ResolvedStyleUnitOptions {\n useVariable: boolean\n rpxVar: string\n ratio: number\n designWidth: number\n}\n\n/** 编译端与运行时共用显式配置;有限设计宽度优先启用变量模式。 */\nexport function resolveStyleUnitOptions(options?: WxssTransformOptions): ResolvedStyleUnitOptions {\n return {\n useVariable: options?.pxPerRpx === undefined\n || (typeof options.designWidth === 'number' && Number.isFinite(options.designWidth)),\n rpxVar: options?.rpxVar ?? '--rpx',\n ratio: options?.pxPerRpx ?? 0.5,\n designWidth: options?.designWidth ?? 750,\n }\n}\n"],"mappings":";;AA0BA,SAAgB,wBAAwB,SAA0D;CAChG,OAAO;EACL,aAAa,SAAS,aAAa,UAC7B,OAAO,QAAQ,gBAAgB,YAAY,OAAO,SAAS,QAAQ,WAAW;EACpF,QAAQ,SAAS,UAAU;EAC3B,OAAO,SAAS,YAAY;EAC5B,aAAa,SAAS,eAAe;CACvC;AACF"}