@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,4 @@
1
- //#region src/runtime/host/index.ts
1
+ // src/runtime/host/index.ts
2
2
  let runtimeHost = {};
3
3
  function getWebRuntimeHost() {
4
4
  return runtimeHost;
@@ -42,6 +42,5 @@ function openRuntimeUrl(url, target, features) {
42
42
  return runtimeOpen?.(url, target, features);
43
43
  }
44
44
 
45
- //#endregion
46
45
  export { getRuntimeClipboard, getRuntimeDialogs, getRuntimeFetch, getRuntimeStorage, getWebRuntimeHost, openRuntimeUrl, resetWebRuntimeHost, setWebRuntimeHost };
47
46
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,3 @@
1
- //#region src/runtime/host/types.d.ts
2
1
  export interface WebRuntimeStorage {
3
2
  readonly length: number;
4
3
  clear: () => void;
@@ -23,5 +22,4 @@ export interface WebRuntimeHost {
23
22
  open?: (url?: string, target?: string, features?: string) => unknown;
24
23
  storage?: WebRuntimeStorage;
25
24
  }
26
- //#endregion
27
25
  //# sourceMappingURL=types.d.mts.map
@@ -1,8 +1,7 @@
1
- //#region src/runtime/hostGlobals.d.ts
2
1
  type HostGlobalsTarget = Record<PropertyKey, any>;
3
2
  /**
4
3
  * 安装第三方库在模块求值阶段可能读取的小程序宿主全局。
5
4
  */
6
5
  export declare function installWebHostGlobals(target?: HostGlobalsTarget): void;
7
- //#endregion
6
+ export {};
8
7
  //# sourceMappingURL=hostGlobals.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { emitRuntimeWarning } from "./warning.mjs";
2
2
 
3
- //#region src/runtime/hostGlobals.ts
3
+ // src/runtime/hostGlobals.ts
4
4
  const IDENTITY_CONSTRUCTORS = [
5
5
  "App",
6
6
  "Page",
@@ -34,6 +34,5 @@ function installWebHostGlobals(target = globalThis) {
34
34
  };
35
35
  }
36
36
 
37
- //#endregion
38
37
  export { installWebHostGlobals };
39
38
  //# sourceMappingURL=hostGlobals.mjs.map
@@ -1,3 +1,4 @@
1
+ import { ResolvedStyleUnitOptions } from "../shared/styleUnits/options.mjs";
1
2
  import { RenderContext, createRenderContext } from "./renderContext.mjs";
2
3
  import { createTemplate, renderTemplate } from "./legacyTemplate/index.mjs";
3
4
  import { TemplateRenderer, TemplateScope } from "./template.mjs";
@@ -7,14 +8,16 @@ import { ResolvedWebRoutingConfig, WebRouteHistoryState, WebRouteTarget, WebRout
7
8
  import { WebPageHead, WebResourceHint, WebResourceHintRelation, WebResourceHintsConfig, WebRuntimeSeoConfig as WebSeoConfig, configureWebSeo, resetWebDocumentHead, setupWebResourceHints, syncWebDocumentHead, updateWebDocumentTitle } from "./seo/index.mjs";
8
9
  import { WebTabBarConfig, WebTabBarItem } from "../shared/tabBar.mjs";
9
10
  import { ButtonFormConfig, ensureButtonDefined, setButtonFormConfig } from "./button/index.mjs";
11
+ import { bindRuntimeDataset } from "./datasetBinding.mjs";
10
12
  import { bindRuntimeEvent } from "./eventBinding.mjs";
11
13
  import { getRuntimeExecutionMode, setRuntimeExecutionMode } from "./execution.mjs";
12
14
  import { WebRuntimeClipboard, WebRuntimeDialogs, WebRuntimeHost, WebRuntimeStorage } from "./host/types.mjs";
13
15
  import { getRuntimeClipboard, getRuntimeDialogs, getRuntimeFetch, getRuntimeStorage, getWebRuntimeHost, openRuntimeUrl, resetWebRuntimeHost, setWebRuntimeHost } from "./host/index.mjs";
14
16
  import { installWebHostGlobals } from "./hostGlobals.mjs";
17
+ import { transformInlineStyleValue } from "./inlineStyle.mjs";
15
18
  import { resolveImageModeStyle } from "./nativeComponents/image.mjs";
16
19
  import { createInputEventDetail } from "./nativeComponents/input.mjs";
17
- import { createScrollEventDetail } from "./nativeComponents/scrollView.mjs";
20
+ import { createScrollEventDetail } from "./nativeComponents/scrollView/helpers.mjs";
18
21
  import { createSwitchEventDetail } from "./nativeComponents/switch.mjs";
19
22
  import { createTextareaLineChangeDetail } from "./nativeComponents/textarea.mjs";
20
23
  import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./nativeComponents/video/helpers.mjs";
@@ -22,12 +25,14 @@ import { ensureNativeComponentsDefined } from "./nativeComponents/index.mjs";
22
25
  import { NavigationBarMetrics, setNavigationBarMetrics } from "./navigationBar/index.mjs";
23
26
  import { setPageLayout } from "./pageLayout.mjs";
24
27
  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";
28
+ import { MiniProgramErrorCallback, ThemeChangeCallback, ThemeChangeEvent, UnhandledRejectionCallback, UnhandledRejectionEvent } from "./polyfill/types/lifecycle.mjs";
29
+ import { offError, offThemeChange, offUnhandledRejection, onError, onThemeChange, onUnhandledRejection, reportEvent } from "./polyfill/lifecycleEvents.mjs";
25
30
  import { ResolvedWebViewportConfig, WebViewportConfig } from "./viewport/types.mjs";
26
31
  import { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport } from "./viewport/index.mjs";
27
32
  import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, offAppHide, offAppShow, onAppHide, onAppShow, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./polyfill/routeRuntime.mjs";
28
33
  import { AppRouteCallback, AppRouteEvent, AppRouteOpenType, BeforePageUnloadCallback, BeforePageUnloadEvent, offAppRoute, offAppRouteDone, offBeforeAppRoute, offBeforePageUnload, onAppRoute, onAppRouteDone, onBeforeAppRoute, onBeforePageUnload } from "./polyfill/routeRuntime/events.mjs";
29
34
  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";
30
- 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";
35
+ 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";
31
36
  import { canIUse, createInterstitialAd, createRewardedVideoAd, getExtConfig, getExtConfigSync, getLogManager, getUpdateManager, hideNavigationBarLoading, reportAnalytics, setBackgroundColor, setBackgroundTextStyle, setNavigationBarColor, setNavigationBarTitle, showNavigationBarLoading } from "./polyfill/index.mjs";
32
37
  import "./polyfill.mjs";
33
38
  import { RpxConfig, setupRpx } from "./rpx.mjs";
@@ -35,4 +40,4 @@ import { injectStyle, removeStyle } from "./style.mjs";
35
40
  import { RuntimeWarningLevel, RuntimeWarningOptions, setRuntimeWarningOptions } from "./warning.mjs";
36
41
  import { installWebModuleRegistration, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory } from "./wevu.mjs";
37
42
  export * from "wevu/internal-runtime";
38
- export { type AppHideCallback, type AppHideOptions, type AppLaunchOptions, type AppRouteCallback, type AppRouteEvent, type AppRouteOpenType, type AppShowCallback, type BeforePageUnloadCallback, type BeforePageUnloadEvent, type ButtonFormConfig, type NavigationBarMetrics, type RenderContext, type ResolvedWebRoutingConfig, type ResolvedWebViewportConfig, type RpxConfig, type RuntimeWarningLevel, type RuntimeWarningOptions, type TemplateRenderer, type TemplateScope, type WebPageHead, type WebResourceHint, type WebResourceHintRelation, type WebResourceHintsConfig, type WebRouteHistoryState, type WebRouteTarget, type WebRoutingConfig, type WebRoutingMode, type WebRuntimeClipboard, type WebRuntimeDialogs, type WebRuntimeHost, type WebRuntimeStorage, type WebSeoConfig, type WebTabBarConfig, type WebTabBarItem, type WebViewportConfig, authorize, bindRuntimeEvent, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, configureWebSeo, createCanvasContext, createInputEventDetail, createInterstitialAd, createRenderContext, createRewardedVideoAd, createScrollEventDetail, createSelectorQuery, createSwitchEventDetail, createTemplate, createTextareaLineChangeDetail, createVKSession, createVideoContext, createVideoProgressDetail, createVideoTimeUpdateDetail, createWorker, defineComponent, disposeWebRouting, downloadFile, ensureButtonDefined, ensureNativeComponentsDefined, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getRuntimeClipboard, getRuntimeDialogs, getRuntimeExecutionMode, getRuntimeFetch, getRuntimeStorage, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWebRoutingConfig, getWebRuntimeHost, getWebViewportWidth, getWindowInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, initializePageRoutes, injectStyle, installWebHostGlobals, installWebModuleRegistration, 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, openRuntimeUrl, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory, removeStorage, removeStorageSync, removeStyle, removeTabBarBadge, renderTemplate, reportAnalytics, request, requestPayment, requestSubscribeMessage, resetWebDocumentHead, resetWebRuntimeHost, resolveImageModeStyle, resolveVideoObjectFit, resolveWebRoutingConfig, resolveWebViewportConfig, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setButtonFormConfig, setClipboardData, setNavigationBarColor, setNavigationBarMetrics, setNavigationBarTitle, setPageLayout, setRuntimeExecutionMode, setRuntimeWarningOptions, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setWebRuntimeHost, setupRpx, setupWebResourceHints, setupWebViewport, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, syncWebDocumentHead, updateShareMenu, updateWebDocumentTitle, uploadFile, vibrateShort };
43
+ export { type AppHideCallback, type AppHideOptions, type AppLaunchOptions, type AppRouteCallback, type AppRouteEvent, type AppRouteOpenType, type AppShowCallback, type BeforePageUnloadCallback, type BeforePageUnloadEvent, type ButtonFormConfig, type MiniProgramErrorCallback, type NavigationBarMetrics, type RenderContext, type ResolvedStyleUnitOptions, type ResolvedWebRoutingConfig, type ResolvedWebViewportConfig, type RpxConfig, type RuntimeWarningLevel, type RuntimeWarningOptions, type TemplateRenderer, type TemplateScope, type ThemeChangeCallback, type ThemeChangeEvent, type UnhandledRejectionCallback, type UnhandledRejectionEvent, type WebPageHead, type WebResourceHint, type WebResourceHintRelation, type WebResourceHintsConfig, type WebRouteHistoryState, type WebRouteTarget, type WebRoutingConfig, type WebRoutingMode, type WebRuntimeClipboard, type WebRuntimeDialogs, type WebRuntimeHost, type WebRuntimeStorage, type WebSeoConfig, type WebTabBarConfig, type WebTabBarItem, type WebViewportConfig, authorize, bindRuntimeDataset, bindRuntimeEvent, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, configureWebSeo, createCanvasContext, createInputEventDetail, createInterstitialAd, createRenderContext, createRewardedVideoAd, createScrollEventDetail, createSelectorQuery, createSwitchEventDetail, createTemplate, createTextareaLineChangeDetail, createVKSession, createVideoContext, createVideoProgressDetail, createVideoTimeUpdateDetail, createWorker, defineComponent, disposeWebRouting, downloadFile, ensureButtonDefined, ensureNativeComponentsDefined, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getRuntimeClipboard, getRuntimeDialogs, getRuntimeExecutionMode, getRuntimeFetch, getRuntimeStorage, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWebRoutingConfig, getWebRuntimeHost, getWebViewportWidth, getWindowInfo, hideHomeButton, hideKeyboard, hideLoading, hideNavigationBarLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, initializePageRoutes, injectStyle, installWebHostGlobals, installWebModuleRegistration, 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, openRuntimeUrl, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory, removeStorage, removeStorageSync, removeStyle, removeTabBarBadge, renderTemplate, reportAnalytics, reportEvent, request, requestPayment, requestSubscribeMessage, resetWebDocumentHead, resetWebRuntimeHost, resolveImageModeStyle, resolveVideoObjectFit, resolveWebRoutingConfig, resolveWebViewportConfig, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setButtonFormConfig, setClipboardData, setNavigationBarColor, setNavigationBarMetrics, setNavigationBarTitle, setPageLayout, setRuntimeExecutionMode, setRuntimeWarningOptions, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setWebRuntimeHost, setupRpx, setupWebResourceHints, setupWebViewport, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, syncWebDocumentHead, transformInlineStyleValue, updateShareMenu, updateWebDocumentTitle, uploadFile, vibrateShort };
@@ -3,28 +3,31 @@ import { setRuntimeWarningOptions } from "./warning.mjs";
3
3
  import { installWebHostGlobals } from "./hostGlobals.mjs";
4
4
  import { getRuntimeClipboard, getRuntimeDialogs, getRuntimeFetch, getRuntimeStorage, getWebRuntimeHost, openRuntimeUrl, resetWebRuntimeHost, setWebRuntimeHost } from "./host/index.mjs";
5
5
  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";
6
+ import { offError, offThemeChange, offUnhandledRejection, onError, onThemeChange, onUnhandledRejection, reportEvent } from "./polyfill/lifecycleEvents.mjs";
6
7
  import { configureWebSeo, resetWebDocumentHead, setupWebResourceHints, syncWebDocumentHead, updateWebDocumentTitle } from "./seo/index.mjs";
7
8
  import { injectStyle, removeStyle } from "./style.mjs";
8
9
  import { ensureButtonDefined, setButtonFormConfig } from "./button/index.mjs";
9
10
  import { getRuntimeExecutionMode, setRuntimeExecutionMode } from "./execution.mjs";
10
11
  import { createRenderContext } from "./renderContext.mjs";
11
12
  import { defineComponent } from "./component/index.mjs";
13
+ import { transformInlineStyleValue } from "./inlineStyle.mjs";
12
14
  import { resolveImageModeStyle } from "./nativeComponents/image.mjs";
13
15
  import { createInputEventDetail } from "./nativeComponents/input.mjs";
14
16
  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";
15
- import { createScrollEventDetail } from "./nativeComponents/scrollView.mjs";
17
+ import { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport } from "./viewport/index.mjs";
18
+ import { setupRpx } from "./rpx.mjs";
19
+ import { createScrollEventDetail } from "./nativeComponents/scrollView/helpers.mjs";
16
20
  import { createSwitchEventDetail } from "./nativeComponents/switch.mjs";
17
21
  import { createTextareaLineChangeDetail } from "./nativeComponents/textarea.mjs";
18
22
  import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./nativeComponents/video/helpers.mjs";
19
23
  import { ensureNativeComponentsDefined } from "./nativeComponents/index.mjs";
20
24
  import { setNavigationBarMetrics } from "./navigationBar/index.mjs";
21
- import { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport } from "./viewport/index.mjs";
22
- import { setupRpx } from "./rpx.mjs";
23
25
  import { offAppRoute, offAppRouteDone, offBeforeAppRoute, offBeforePageUnload, onAppRoute, onAppRouteDone, onBeforeAppRoute, onBeforePageUnload } from "./polyfill/routeRuntime/events.mjs";
24
26
  import { disposeWebRouting, getWebRoutingConfig, resolveWebRoutingConfig } from "./polyfill/routeRuntime/history.mjs";
25
27
  import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, offAppHide, offAppShow, onAppHide, onAppShow, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./polyfill/routeRuntime.mjs";
26
- 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";
28
+ 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";
27
29
  import { canIUse, createInterstitialAd, createRewardedVideoAd, getExtConfig, getExtConfigSync, getLogManager, getUpdateManager, hideNavigationBarLoading, installMiniProgramGlobals, reportAnalytics, setBackgroundColor, setBackgroundTextStyle, setNavigationBarColor, setNavigationBarTitle, showNavigationBarLoading } from "./polyfill/index.mjs";
30
+ import { bindRuntimeDataset } from "./datasetBinding.mjs";
28
31
  import { bindRuntimeEvent } from "./eventBinding.mjs";
29
32
  import { setPageLayout } from "./pageLayout.mjs";
30
33
  import { createTemplate, renderTemplate } from "./legacyTemplate/index.mjs";
@@ -32,10 +35,9 @@ import { installWebModuleRegistration, registerWebWevuApp, registerWebWevuCompon
32
35
 
33
36
  export * from "wevu/internal-runtime"
34
37
 
35
- //#region src/runtime/index.ts
38
+ // src/runtime/index.ts
36
39
  installWebHostGlobals();
37
40
  installMiniProgramGlobals();
38
41
 
39
- //#endregion
40
- export { authorize, bindRuntimeEvent, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, configureWebSeo, createCanvasContext, createInputEventDetail, createInterstitialAd, createRenderContext, createRewardedVideoAd, createScrollEventDetail, createSelectorQuery, createSwitchEventDetail, createTemplate, createTextareaLineChangeDetail, createVKSession, createVideoContext, createVideoProgressDetail, createVideoTimeUpdateDetail, createWorker, defineComponent, disposeWebRouting, downloadFile, ensureButtonDefined, ensureNativeComponentsDefined, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getRuntimeClipboard, getRuntimeDialogs, getRuntimeExecutionMode, getRuntimeFetch, getRuntimeStorage, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWebRoutingConfig, getWebRuntimeHost, getWebViewportWidth, getWindowInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, hideTabBarRedDot, initializePageRoutes, injectStyle, installWebHostGlobals, installWebModuleRegistration, 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, openRuntimeUrl, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory, removeStorage, removeStorageSync, removeStyle, removeTabBarBadge, renderTemplate, reportAnalytics, request, requestPayment, requestSubscribeMessage, resetWebDocumentHead, resetWebRuntimeHost, resolveImageModeStyle, resolveVideoObjectFit, resolveWebRoutingConfig, resolveWebViewportConfig, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setButtonFormConfig, setClipboardData, setNavigationBarColor, setNavigationBarMetrics, setNavigationBarTitle, setPageLayout, setRuntimeExecutionMode, setRuntimeWarningOptions, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setWebRuntimeHost, setupRpx, setupWebResourceHints, setupWebViewport, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, syncWebDocumentHead, updateShareMenu, updateWebDocumentTitle, uploadFile, vibrateShort };
42
+ export { authorize, bindRuntimeDataset, bindRuntimeEvent, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, configureWebSeo, createCanvasContext, createInputEventDetail, createInterstitialAd, createRenderContext, createRewardedVideoAd, createScrollEventDetail, createSelectorQuery, createSwitchEventDetail, createTemplate, createTextareaLineChangeDetail, createVKSession, createVideoContext, createVideoProgressDetail, createVideoTimeUpdateDetail, createWorker, defineComponent, disposeWebRouting, downloadFile, ensureButtonDefined, ensureNativeComponentsDefined, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getRuntimeClipboard, getRuntimeDialogs, getRuntimeExecutionMode, getRuntimeFetch, getRuntimeStorage, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWebRoutingConfig, getWebRuntimeHost, getWebViewportWidth, getWindowInfo, hideHomeButton, hideKeyboard, hideLoading, hideNavigationBarLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, initializePageRoutes, injectStyle, installWebHostGlobals, installWebModuleRegistration, 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, openRuntimeUrl, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, registerWebWevuApp, registerWebWevuComponent, registerWebWevuComponentFactory, removeStorage, removeStorageSync, removeStyle, removeTabBarBadge, renderTemplate, reportAnalytics, reportEvent, request, requestPayment, requestSubscribeMessage, resetWebDocumentHead, resetWebRuntimeHost, resolveImageModeStyle, resolveVideoObjectFit, resolveWebRoutingConfig, resolveWebViewportConfig, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setButtonFormConfig, setClipboardData, setNavigationBarColor, setNavigationBarMetrics, setNavigationBarTitle, setPageLayout, setRuntimeExecutionMode, setRuntimeWarningOptions, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setWebRuntimeHost, setupRpx, setupWebResourceHints, setupWebViewport, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showTabBarRedDot, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, syncWebDocumentHead, transformInlineStyleValue, updateShareMenu, updateWebDocumentTitle, uploadFile, vibrateShort };
41
43
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/runtime/index.ts"],"sourcesContent":["import { installWebHostGlobals } from './hostGlobals'\nimport { installMiniProgramGlobals } from './polyfill'\n\ninstallWebHostGlobals()\ninstallMiniProgramGlobals()\n\nexport type { WebTabBarConfig, WebTabBarItem } from './appShell/tabBar'\nexport { ensureButtonDefined, setButtonFormConfig } from './button'\nexport type { ButtonFormConfig } from './button'\nexport { defineComponent } from './component'\nexport { bindRuntimeEvent } from './eventBinding'\nexport { getRuntimeExecutionMode, setRuntimeExecutionMode } from './execution'\nexport {\n getRuntimeClipboard,\n getRuntimeDialogs,\n getRuntimeFetch,\n getRuntimeStorage,\n getWebRuntimeHost,\n openRuntimeUrl,\n resetWebRuntimeHost,\n setWebRuntimeHost,\n} from './host'\nexport type { WebRuntimeClipboard, WebRuntimeDialogs, WebRuntimeHost, WebRuntimeStorage } from './host'\nexport { installWebHostGlobals } from './hostGlobals'\nexport {\n createInputEventDetail,\n createScrollEventDetail,\n createSwitchEventDetail,\n createTextareaLineChangeDetail,\n createVideoProgressDetail,\n createVideoTimeUpdateDetail,\n ensureNativeComponentsDefined,\n resolveImageModeStyle,\n resolveVideoObjectFit,\n} from './nativeComponents'\nexport { setNavigationBarMetrics } from './navigationBar'\nexport type { NavigationBarMetrics } from './navigationBar'\nexport { setPageLayout } from './pageLayout'\nexport {\n authorize,\n canIUse,\n checkSession,\n chooseAddress,\n chooseFile,\n chooseImage,\n chooseLocation,\n chooseMedia,\n chooseMessageFile,\n chooseVideo,\n clearStorage,\n clearStorageSync,\n compressImage,\n compressVideo,\n createCanvasContext,\n createInterstitialAd,\n createRewardedVideoAd,\n createSelectorQuery,\n createVideoContext,\n createVKSession,\n createWorker,\n downloadFile,\n exitMiniProgram,\n getAccountInfoSync,\n getAppAuthorizeSetting,\n getAppBaseInfo,\n getBatteryInfo,\n getBatteryInfoSync,\n getClipboardData,\n getDeviceInfo,\n getEnterOptionsSync,\n getExtConfig,\n getExtConfigSync,\n getFileSystemManager,\n getFuzzyLocation,\n getImageInfo,\n getLaunchOptionsSync,\n getLocation,\n getLogManager,\n getMenuButtonBoundingClientRect,\n getNetworkType,\n getSetting,\n getStorage,\n getStorageInfo,\n getStorageInfoSync,\n getStorageSync,\n getSystemInfo,\n getSystemInfoSync,\n getSystemSetting,\n getUpdateManager,\n getUserInfo,\n getUserProfile,\n getVideoInfo,\n getWindowInfo,\n hideKeyboard,\n hideLoading,\n hideNavigationBarLoading,\n hideTabBar,\n hideTabBarRedDot,\n initializePageRoutes,\n loadSubPackage,\n login,\n makePhoneCall,\n navigateBack,\n navigateTo,\n navigateToMiniProgram,\n nextTick,\n offAppHide,\n offAppRoute,\n offAppRouteDone,\n offAppShow,\n offBeforeAppRoute,\n offBeforePageUnload,\n offNetworkStatusChange,\n offWindowResize,\n onAppHide,\n onAppRoute,\n onAppRouteDone,\n onAppShow,\n onBeforeAppRoute,\n onBeforePageUnload,\n onNetworkStatusChange,\n onWindowResize,\n openAppAuthorizeSetting,\n openCustomerServiceChat,\n openDocument,\n openLocation,\n openSetting,\n openVideoEditor,\n pageScrollTo,\n preloadSubpackage,\n previewImage,\n previewMedia,\n redirectTo,\n registerApp,\n registerComponent,\n registerPage,\n reLaunch,\n removeStorage,\n removeStorageSync,\n removeTabBarBadge,\n reportAnalytics,\n request,\n requestPayment,\n requestSubscribeMessage,\n saveFile,\n saveFileToDisk,\n saveImageToPhotosAlbum,\n saveVideoToPhotosAlbum,\n scanCode,\n setBackgroundColor,\n setBackgroundTextStyle,\n setClipboardData,\n setNavigationBarColor,\n setNavigationBarTitle,\n setStorage,\n setStorageSync,\n setTabBarBadge,\n setTabBarItem,\n setTabBarStyle,\n showActionSheet,\n showLoading,\n showModal,\n showNavigationBarLoading,\n showShareMenu,\n showTabBar,\n showTabBarRedDot,\n showToast,\n startPullDownRefresh,\n stopPullDownRefresh,\n switchTab,\n updateShareMenu,\n uploadFile,\n vibrateShort,\n} from './polyfill'\nexport type { AppHideCallback, AppHideOptions, AppLaunchOptions, AppShowCallback } from './polyfill'\nexport type { AppRouteCallback, AppRouteEvent, AppRouteOpenType, BeforePageUnloadCallback, BeforePageUnloadEvent } from './polyfill'\nexport {\n disposeWebRouting,\n getWebRoutingConfig,\n resolveWebRoutingConfig,\n} from './polyfill/routeRuntime/history'\nexport type {\n ResolvedWebRoutingConfig,\n WebRouteHistoryState,\n WebRouteTarget,\n WebRoutingConfig,\n WebRoutingMode,\n} from './polyfill/routeRuntime/history'\nexport { createRenderContext } from './renderContext'\nexport type { RenderContext } from './renderContext'\nexport { setupRpx } from './rpx'\nexport type { RpxConfig } from './rpx'\nexport {\n configureWebSeo,\n resetWebDocumentHead,\n setupWebResourceHints,\n syncWebDocumentHead,\n updateWebDocumentTitle,\n} from './seo'\nexport type { WebPageHead, WebResourceHint, WebResourceHintRelation, WebResourceHintsConfig, WebSeoConfig } from './seo'\nexport { injectStyle, removeStyle } from './style'\nexport { createTemplate, renderTemplate } from './template'\nexport type { TemplateRenderer, TemplateScope } from './template'\nexport { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport } from './viewport'\nexport type { ResolvedWebViewportConfig, WebViewportConfig } from './viewport'\nexport { setRuntimeWarningOptions } from './warning'\nexport type { RuntimeWarningLevel, RuntimeWarningOptions } from './warning'\nexport {\n installWebModuleRegistration,\n registerWebWevuApp,\n registerWebWevuComponent,\n registerWebWevuComponentFactory,\n} from './wevu'\nexport * from 'wevu/internal-runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAsB;AACtB,0BAA0B"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/runtime/index.ts"],"sourcesContent":["import { installWebHostGlobals } from './hostGlobals'\nimport { installMiniProgramGlobals } from './polyfill'\n\ninstallWebHostGlobals()\ninstallMiniProgramGlobals()\n\nexport type { ResolvedStyleUnitOptions } from '../shared/styleUnits/options'\nexport type { WebTabBarConfig, WebTabBarItem } from './appShell/tabBar'\nexport { ensureButtonDefined, setButtonFormConfig } from './button'\nexport type { ButtonFormConfig } from './button'\nexport { defineComponent } from './component'\nexport { bindRuntimeDataset } from './datasetBinding'\nexport { bindRuntimeEvent } from './eventBinding'\nexport { getRuntimeExecutionMode, setRuntimeExecutionMode } from './execution'\nexport {\n getRuntimeClipboard,\n getRuntimeDialogs,\n getRuntimeFetch,\n getRuntimeStorage,\n getWebRuntimeHost,\n openRuntimeUrl,\n resetWebRuntimeHost,\n setWebRuntimeHost,\n} from './host'\nexport type { WebRuntimeClipboard, WebRuntimeDialogs, WebRuntimeHost, WebRuntimeStorage } from './host'\nexport { installWebHostGlobals } from './hostGlobals'\nexport { transformInlineStyleValue } from './inlineStyle'\nexport {\n createInputEventDetail,\n createScrollEventDetail,\n createSwitchEventDetail,\n createTextareaLineChangeDetail,\n createVideoProgressDetail,\n createVideoTimeUpdateDetail,\n ensureNativeComponentsDefined,\n resolveImageModeStyle,\n resolveVideoObjectFit,\n} from './nativeComponents'\nexport { setNavigationBarMetrics } from './navigationBar'\nexport type { NavigationBarMetrics } from './navigationBar'\nexport { setPageLayout } from './pageLayout'\nexport {\n authorize,\n canIUse,\n checkSession,\n chooseAddress,\n chooseFile,\n chooseImage,\n chooseLocation,\n chooseMedia,\n chooseMessageFile,\n chooseVideo,\n clearStorage,\n clearStorageSync,\n compressImage,\n compressVideo,\n createCanvasContext,\n createInterstitialAd,\n createRewardedVideoAd,\n createSelectorQuery,\n createVideoContext,\n createVKSession,\n createWorker,\n downloadFile,\n exitMiniProgram,\n getAccountInfoSync,\n getAppAuthorizeSetting,\n getAppBaseInfo,\n getBatteryInfo,\n getBatteryInfoSync,\n getClipboardData,\n getDeviceInfo,\n getEnterOptionsSync,\n getExtConfig,\n getExtConfigSync,\n getFileSystemManager,\n getFuzzyLocation,\n getImageInfo,\n getLaunchOptionsSync,\n getLocation,\n getLogManager,\n getMenuButtonBoundingClientRect,\n getNetworkType,\n getSetting,\n getStorage,\n getStorageInfo,\n getStorageInfoSync,\n getStorageSync,\n getSystemInfo,\n getSystemInfoSync,\n getSystemSetting,\n getUpdateManager,\n getUserInfo,\n getUserProfile,\n getVideoInfo,\n getWindowInfo,\n hideHomeButton,\n hideKeyboard,\n hideLoading,\n hideNavigationBarLoading,\n hideShareMenu,\n hideTabBar,\n hideTabBarRedDot,\n hideToast,\n initializePageRoutes,\n loadSubPackage,\n login,\n makePhoneCall,\n navigateBack,\n navigateTo,\n navigateToMiniProgram,\n nextTick,\n offAppHide,\n offAppRoute,\n offAppRouteDone,\n offAppShow,\n offBeforeAppRoute,\n offBeforePageUnload,\n offError,\n offNetworkStatusChange,\n offThemeChange,\n offUnhandledRejection,\n offWindowResize,\n onAppHide,\n onAppRoute,\n onAppRouteDone,\n onAppShow,\n onBeforeAppRoute,\n onBeforePageUnload,\n onError,\n onNetworkStatusChange,\n onThemeChange,\n onUnhandledRejection,\n onWindowResize,\n openAppAuthorizeSetting,\n openCustomerServiceChat,\n openDocument,\n openLocation,\n openSetting,\n openVideoEditor,\n pageScrollTo,\n preloadSubpackage,\n previewImage,\n previewMedia,\n redirectTo,\n registerApp,\n registerComponent,\n registerPage,\n reLaunch,\n removeStorage,\n removeStorageSync,\n removeTabBarBadge,\n reportAnalytics,\n reportEvent,\n request,\n requestPayment,\n requestSubscribeMessage,\n saveFile,\n saveFileToDisk,\n saveImageToPhotosAlbum,\n saveVideoToPhotosAlbum,\n scanCode,\n setBackgroundColor,\n setBackgroundTextStyle,\n setClipboardData,\n setNavigationBarColor,\n setNavigationBarTitle,\n setStorage,\n setStorageSync,\n setTabBarBadge,\n setTabBarItem,\n setTabBarStyle,\n showActionSheet,\n showLoading,\n showModal,\n showNavigationBarLoading,\n showShareMenu,\n showTabBar,\n showTabBarRedDot,\n showToast,\n startPullDownRefresh,\n stopPullDownRefresh,\n switchTab,\n updateShareMenu,\n uploadFile,\n vibrateShort,\n} from './polyfill'\nexport type { AppHideCallback, AppHideOptions, AppLaunchOptions, AppShowCallback } from './polyfill'\nexport type { MiniProgramErrorCallback, ThemeChangeCallback, ThemeChangeEvent, UnhandledRejectionCallback, UnhandledRejectionEvent } from './polyfill'\nexport type { AppRouteCallback, AppRouteEvent, AppRouteOpenType, BeforePageUnloadCallback, BeforePageUnloadEvent } from './polyfill'\nexport {\n disposeWebRouting,\n getWebRoutingConfig,\n resolveWebRoutingConfig,\n} from './polyfill/routeRuntime/history'\nexport type {\n ResolvedWebRoutingConfig,\n WebRouteHistoryState,\n WebRouteTarget,\n WebRoutingConfig,\n WebRoutingMode,\n} from './polyfill/routeRuntime/history'\nexport { createRenderContext } from './renderContext'\nexport type { RenderContext } from './renderContext'\nexport { setupRpx } from './rpx'\nexport type { RpxConfig } from './rpx'\nexport {\n configureWebSeo,\n resetWebDocumentHead,\n setupWebResourceHints,\n syncWebDocumentHead,\n updateWebDocumentTitle,\n} from './seo'\nexport type { WebPageHead, WebResourceHint, WebResourceHintRelation, WebResourceHintsConfig, WebSeoConfig } from './seo'\nexport { injectStyle, removeStyle } from './style'\nexport { createTemplate, renderTemplate } from './template'\nexport type { TemplateRenderer, TemplateScope } from './template'\nexport { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport } from './viewport'\nexport type { ResolvedWebViewportConfig, WebViewportConfig } from './viewport'\nexport { setRuntimeWarningOptions } from './warning'\nexport type { RuntimeWarningLevel, RuntimeWarningOptions } from './warning'\nexport {\n installWebModuleRegistration,\n registerWebWevuApp,\n registerWebWevuComponent,\n registerWebWevuComponentFactory,\n} from './wevu'\nexport * from 'wevu/internal-runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAsB;AACtB,0BAA0B"}
@@ -0,0 +1,5 @@
1
+ /** 对象和数组复用模板样式归一化,其他值原样交给 Lit 保留空值和移除语义。 */
2
+ export declare function transformInlineStyleValue<Value extends string | object>(value: Value): string;
3
+ export declare function transformInlineStyleValue<Value extends null | undefined | boolean | number | bigint | symbol>(value: Value): Value;
4
+ export declare function transformInlineStyleValue(value: unknown): unknown;
5
+ //# sourceMappingURL=inlineStyle.d.mts.map
@@ -0,0 +1,21 @@
1
+ import { resolveStyleUnitOptions } from "../shared/styleUnits/options.mjs";
2
+ import { transformStyleValue } from "../shared/styleUnits/value.mjs";
3
+ import { normalizeStyle } from "wevu/internal-template";
4
+
5
+ // src/runtime/inlineStyle.ts
6
+ let activeOptions = resolveStyleUnitOptions();
7
+ /** 配置由生成入口显式传入,与 WXSS 使用同一份已解析的单位选项。 */
8
+ function configureInlineStyleUnits(options) {
9
+ activeOptions = options ? { ...options } : resolveStyleUnitOptions();
10
+ }
11
+ /** 只转换 CSS 单位 token,不探测 DOM 变量或缓存视口尺寸。 */
12
+ function transformInlineStyle(value) {
13
+ return transformStyleValue(value, activeOptions);
14
+ }
15
+ function transformInlineStyleValue(value) {
16
+ if (typeof value === "string" || value !== null && typeof value === "object") return transformInlineStyle(normalizeStyle(value));
17
+ return value;
18
+ }
19
+
20
+ export { configureInlineStyleUnits, transformInlineStyle, transformInlineStyleValue };
21
+ //# sourceMappingURL=inlineStyle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlineStyle.mjs","names":[],"sources":["../../src/runtime/inlineStyle.ts"],"sourcesContent":["import type { ResolvedStyleUnitOptions } from '../shared/styleUnits/options'\nimport { normalizeStyle } from 'wevu/internal-template'\nimport { resolveStyleUnitOptions } from '../shared/styleUnits/options'\nimport { transformStyleValue } from '../shared/styleUnits/value'\n\nlet activeOptions = resolveStyleUnitOptions()\n\n/** 配置由生成入口显式传入,与 WXSS 使用同一份已解析的单位选项。 */\nexport function configureInlineStyleUnits(options?: ResolvedStyleUnitOptions) {\n activeOptions = options ? { ...options } : resolveStyleUnitOptions()\n}\n\n/** 只转换 CSS 单位 token,不探测 DOM 变量或缓存视口尺寸。 */\nexport function transformInlineStyle(value: string) {\n return transformStyleValue(value, activeOptions)\n}\n\n/** 对象和数组复用模板样式归一化,其他值原样交给 Lit 保留空值和移除语义。 */\nexport function transformInlineStyleValue<Value extends string | object>(value: Value): string\nexport function transformInlineStyleValue<Value extends null | undefined | boolean | number | bigint | symbol>(value: Value): Value\nexport function transformInlineStyleValue(value: unknown): unknown\nexport function transformInlineStyleValue(value: unknown): unknown {\n if (typeof value === 'string' || (value !== null && typeof value === 'object')) {\n return transformInlineStyle(normalizeStyle(value))\n }\n return value\n}\n"],"mappings":";;;;;AAKA,IAAI,gBAAgB,wBAAwB;;AAG5C,SAAgB,0BAA0B,SAAoC;CAC5E,gBAAgB,UAAU,EAAE,GAAG,QAAQ,IAAI,wBAAwB;AACrE;;AAGA,SAAgB,qBAAqB,OAAe;CAClD,OAAO,oBAAoB,OAAO,aAAa;AACjD;AAMA,SAAgB,0BAA0B,OAAyB;CACjE,IAAI,OAAO,UAAU,YAAa,UAAU,QAAQ,OAAO,UAAU,UACnE,OAAO,qBAAqB,eAAe,KAAK,CAAC;CAEnD,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- //#region src/runtime/inputHandlerResult.ts
1
+ // src/runtime/inputHandlerResult.ts
2
2
  const nativeInputEventStates = /* @__PURE__ */ new WeakMap();
3
3
  function dispatchNativeInputEvent(target, detail) {
4
4
  const event = new CustomEvent("input", {
@@ -17,6 +17,5 @@ function invokeMiniProgramEventHandler(handler, instance, syntheticEvent, native
17
17
  if (state?.target === nativeEvent.currentTarget && typeof result === "string") state.value = result;
18
18
  }
19
19
 
20
- //#endregion
21
20
  export { dispatchNativeInputEvent, invokeMiniProgramEventHandler };
22
21
  //# sourceMappingURL=inputHandlerResult.mjs.map
@@ -0,0 +1,53 @@
1
+ import { clearRuntimeDataset, storeRuntimeDataset } from "../dataset.mjs";
2
+ import { WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX } from "@weapp-core/constants";
3
+
4
+ // src/runtime/legacyTemplate/dataset.ts
5
+ const commits = /* @__PURE__ */ new WeakMap();
6
+ /** 每次渲染只收集当前组件的值,提交前仍由旧一轮绑定负责读取。 */
7
+ function resetLegacyDatasetRender(context) {
8
+ const commit = commits.get(context);
9
+ if (commit) commit.values = [];
10
+ }
11
+ function recordLegacyDatasetRender(context, values) {
12
+ const commit = commits.get(context) ?? {
13
+ values,
14
+ bound: []
15
+ };
16
+ commit.values = values;
17
+ commits.set(context, commit);
18
+ }
19
+ function createLegacyDatasetAnchor(values, dataset) {
20
+ const index = values.push(dataset) - 1;
21
+ return `<!--${WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX}${index}-->`;
22
+ }
23
+ /** 释放本组件提交过的绑定;重复调用不影响其他组件或同一元素的其他属性。 */
24
+ function releaseLegacyDatasetBindings(context) {
25
+ const commit = commits.get(context);
26
+ if (!commit) return;
27
+ for (const { element, attributes } of commit.bound) for (const attribute of attributes) clearRuntimeDataset(element, attribute);
28
+ commit.bound = [];
29
+ }
30
+ /** HTML 字符串相同也重新提交值,避免相同字符串化结果遮蔽新对象。 */
31
+ function commitLegacyDatasetBindings(root, context) {
32
+ const commit = commits.get(context);
33
+ if (!commit) return;
34
+ releaseLegacyDatasetBindings(context);
35
+ if (commit.values.length === 0) return;
36
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
37
+ while (walker.nextNode()) {
38
+ const comment = walker.currentNode;
39
+ if (!comment.data.startsWith(WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX)) continue;
40
+ const index = comment.data.slice(WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX.length);
41
+ const values = /^\d+$/.test(index) ? commit.values[Number(index)] : void 0;
42
+ const element = comment.nextSibling;
43
+ if (!values || element?.nodeType !== Node.ELEMENT_NODE) continue;
44
+ for (const [attribute, value] of values) storeRuntimeDataset(element, attribute, value);
45
+ commit.bound.push({
46
+ element,
47
+ attributes: [...values.keys()]
48
+ });
49
+ }
50
+ }
51
+
52
+ export { commitLegacyDatasetBindings, createLegacyDatasetAnchor, recordLegacyDatasetRender, releaseLegacyDatasetBindings, resetLegacyDatasetRender };
53
+ //# sourceMappingURL=dataset.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset.mjs","names":[],"sources":["../../../src/runtime/legacyTemplate/dataset.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX } from '@weapp-core/constants'\nimport { clearRuntimeDataset, storeRuntimeDataset } from '../dataset'\n\nexport type LegacyDatasetValues = Array<Map<string, unknown>>\n\ninterface LegacyDatasetCommit {\n values: LegacyDatasetValues\n bound: Array<{ element: Element, attributes: string[] }>\n}\n\nconst commits = new WeakMap<object, LegacyDatasetCommit>()\n\n/** 每次渲染只收集当前组件的值,提交前仍由旧一轮绑定负责读取。 */\nexport function resetLegacyDatasetRender(context: object) {\n const commit = commits.get(context)\n if (commit) {\n commit.values = []\n }\n}\n\nexport function recordLegacyDatasetRender(context: object, values: LegacyDatasetValues) {\n const commit = commits.get(context) ?? { values, bound: [] }\n commit.values = values\n commits.set(context, commit)\n}\n\nexport function createLegacyDatasetAnchor(values: LegacyDatasetValues, dataset: Map<string, unknown>) {\n const index = values.push(dataset) - 1\n return `<!--${WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX}${index}-->`\n}\n\n/** 释放本组件提交过的绑定;重复调用不影响其他组件或同一元素的其他属性。 */\nexport function releaseLegacyDatasetBindings(context: object) {\n const commit = commits.get(context)\n if (!commit) {\n return\n }\n for (const { element, attributes } of commit.bound) {\n for (const attribute of attributes) {\n clearRuntimeDataset(element, attribute)\n }\n }\n commit.bound = []\n}\n\n/** HTML 字符串相同也重新提交值,避免相同字符串化结果遮蔽新对象。 */\nexport function commitLegacyDatasetBindings(root: HTMLElement | ShadowRoot, context: object) {\n const commit = commits.get(context)\n if (!commit) {\n return\n }\n releaseLegacyDatasetBindings(context)\n if (commit.values.length === 0) {\n return\n }\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT)\n while (walker.nextNode()) {\n const comment = walker.currentNode as Comment\n if (!comment.data.startsWith(WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX)) {\n continue\n }\n const index = comment.data.slice(WEAPP_VITE_WEB_LEGACY_DATASET_COMMENT_PREFIX.length)\n const values = /^\\d+$/.test(index) ? commit.values[Number(index)] : undefined\n const element = comment.nextSibling\n if (!values || element?.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n for (const [attribute, value] of values) {\n storeRuntimeDataset(element as Element, attribute, value)\n }\n commit.bound.push({ element: element as Element, attributes: [...values.keys()] })\n }\n}\n"],"mappings":";;;;AAUA,MAAM,0BAAU,IAAI,QAAqC;;AAGzD,SAAgB,yBAAyB,SAAiB;CACxD,MAAM,SAAS,QAAQ,IAAI,OAAO;CAClC,IAAI,QACF,OAAO,SAAS,CAAC;AAErB;AAEA,SAAgB,0BAA0B,SAAiB,QAA6B;CACtF,MAAM,SAAS,QAAQ,IAAI,OAAO,KAAK;EAAE;EAAQ,OAAO,CAAC;CAAE;CAC3D,OAAO,SAAS;CAChB,QAAQ,IAAI,SAAS,MAAM;AAC7B;AAEA,SAAgB,0BAA0B,QAA6B,SAA+B;CACpG,MAAM,QAAQ,OAAO,KAAK,OAAO,IAAI;CACrC,OAAO,OAAO,+CAA+C,MAAM;AACrE;;AAGA,SAAgB,6BAA6B,SAAiB;CAC5D,MAAM,SAAS,QAAQ,IAAI,OAAO;CAClC,IAAI,CAAC,QACH;CAEF,KAAK,MAAM,EAAE,SAAS,gBAAgB,OAAO,OAC3C,KAAK,MAAM,aAAa,YACtB,oBAAoB,SAAS,SAAS;CAG1C,OAAO,QAAQ,CAAC;AAClB;;AAGA,SAAgB,4BAA4B,MAAgC,SAAiB;CAC3F,MAAM,SAAS,QAAQ,IAAI,OAAO;CAClC,IAAI,CAAC,QACH;CAEF,6BAA6B,OAAO;CACpC,IAAI,OAAO,OAAO,WAAW,GAC3B;CAEF,MAAM,SAAS,SAAS,iBAAiB,MAAM,WAAW,YAAY;CACtE,OAAO,OAAO,SAAS,GAAG;EACxB,MAAM,UAAU,OAAO;EACvB,IAAI,CAAC,QAAQ,KAAK,WAAW,4CAA4C,GACvE;EAEF,MAAM,QAAQ,QAAQ,KAAK,MAAM,6CAA6C,MAAM;EACpF,MAAM,SAAS,QAAQ,KAAK,KAAK,IAAI,OAAO,OAAO,OAAO,KAAK,KAAK;EACpE,MAAM,UAAU,QAAQ;EACxB,IAAI,CAAC,UAAU,SAAS,aAAa,KAAK,cACxC;EAEF,KAAK,MAAM,CAAC,WAAW,UAAU,QAC/B,oBAAoB,SAAoB,WAAW,KAAK;EAE1D,OAAO,MAAM,KAAK;GAAW;GAAoB,YAAY,CAAC,GAAG,OAAO,KAAK,CAAC;EAAE,CAAC;CACnF;AACF"}
@@ -1,8 +1,9 @@
1
1
  import { CONTROL_ATTRS, EVENT_KIND_ALIAS, hasControlAttribute, normalizeAttributeName, resolveControlAttributeValue } from "../../shared/wxml.mjs";
2
2
  import { MINI_PROGRAM_EVENT_ATTRIBUTE_PREFIX, MINI_PROGRAM_EVENT_FLAG_ATTRIBUTE_PREFIX, encodeEventAttributeName } from "../component/constants.mjs";
3
- import { escapeAttribute, resolveAttributeValue } from "./expression.mjs";
3
+ import { transformInlineStyleValue } from "../inlineStyle.mjs";
4
+ import { escapeAttribute, evaluateExpression, resolveAttributeValue } from "./expression.mjs";
4
5
 
5
- //#region src/runtime/legacyTemplate/dom.ts
6
+ // src/runtime/legacyTemplate/dom.ts
6
7
  const EVENT_PREFIX_RE = /^(bind|catch|mut-bind|capture-bind|capture-catch)([\w-]+)$/;
7
8
  const EVENT_PREFIX_FLAGS = {
8
9
  "bind": {},
@@ -49,7 +50,7 @@ function extractFor(attribs) {
49
50
  restAttribs
50
51
  };
51
52
  }
52
- function buildAttributeString(attribs, scope) {
53
+ function buildAttributeString(attribs, scope, dataset) {
53
54
  let result = "";
54
55
  for (const [name, rawValue] of Object.entries(attribs)) {
55
56
  if (CONTROL_ATTRS.has(name)) continue;
@@ -66,9 +67,24 @@ function buildAttributeString(attribs, scope) {
66
67
  if (flagTokens.length) result += ` ${MINI_PROGRAM_EVENT_FLAG_ATTRIBUTE_PREFIX}${encodedEvent}="${flagTokens.join(",")}"`;
67
68
  continue;
68
69
  }
70
+ const normalizedName = normalizeAttributeName(name);
71
+ if (normalizedName.startsWith("data-")) {
72
+ const trimmed = rawValue.trim();
73
+ const expression = /^\{\{((?:(?!\}\})[\s\S])*)\}\}$/.exec(trimmed);
74
+ const value = expression ? evaluateExpression(expression[1], scope) : rawValue.replace(/\{\{([\s\S]*?)\}\}/g, (_, source) => String(evaluateExpression(source, scope) ?? ""));
75
+ dataset?.set(normalizedName, value);
76
+ result += ` ${normalizedName}="${escapeAttribute(String(value ?? ""))}"`;
77
+ continue;
78
+ }
79
+ if (normalizedName === "style") {
80
+ const expression = /^\{\{((?:(?!\}\})[\s\S])*)\}\}$/.exec(rawValue.trim());
81
+ const rawStyle = expression ? evaluateExpression(expression[1], scope) : resolveAttributeValue(rawValue, scope);
82
+ const style = transformInlineStyleValue(rawStyle);
83
+ if (style != null && style !== "") result += ` style="${escapeAttribute(String(style))}"`;
84
+ continue;
85
+ }
69
86
  const value = resolveAttributeValue(rawValue, scope);
70
87
  if (value === "") continue;
71
- const normalizedName = normalizeAttributeName(name);
72
88
  result += ` ${normalizedName}="${escapeAttribute(value)}"`;
73
89
  }
74
90
  return result;
@@ -84,6 +100,5 @@ function isConditionalElement(node) {
84
100
  return hasControlAttribute(attribs, "if") || hasControlAttribute(attribs, "elif") || hasControlAttribute(attribs, "else");
85
101
  }
86
102
 
87
- //#endregion
88
103
  export { buildAttributeString, extractFor, isConditionalElement, stripControlAttributes };
89
104
  //# sourceMappingURL=dom.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.mjs","names":[],"sources":["../../../src/runtime/legacyTemplate/dom.ts"],"sourcesContent":["import type { Element, Node } from 'domhandler'\nimport type { ExtractForResult, LegacyTemplateScope } from './types'\nimport {\n CONTROL_ATTRS,\n EVENT_KIND_ALIAS,\n hasControlAttribute,\n normalizeAttributeName,\n resolveControlAttributeValue,\n} from '../../shared/wxml'\nimport {\n encodeEventAttributeName,\n MINI_PROGRAM_EVENT_ATTRIBUTE_PREFIX,\n MINI_PROGRAM_EVENT_FLAG_ATTRIBUTE_PREFIX,\n} from '../component/constants'\nimport { escapeAttribute, resolveAttributeValue } from './expression'\n\nconst EVENT_PREFIX_RE = /^(bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nconst EVENT_PREFIX_FLAGS: Record<string, { catch?: boolean, capture?: boolean }> = {\n 'bind': {},\n 'catch': { catch: true },\n 'mut-bind': {},\n 'capture-bind': { capture: true },\n 'capture-catch': { capture: true, catch: true },\n}\n\nfunction parseEventAttribute(name: string) {\n const separatorIndex = name.indexOf(':')\n if (separatorIndex >= 0) {\n const prefix = name.slice(0, separatorIndex)\n const rawEvent = name.slice(separatorIndex + 1)\n if (rawEvent && prefix in EVENT_PREFIX_FLAGS) {\n return { prefix, rawEvent }\n }\n return undefined\n }\n const match = EVENT_PREFIX_RE.exec(name)\n if (!match) {\n return undefined\n }\n return { prefix: match[1]!, rawEvent: match[2]! }\n}\n\nexport function extractFor(attribs: Record<string, string>): ExtractForResult {\n const expr = resolveControlAttributeValue(attribs, 'for')\n const restAttribs: Record<string, string> = {}\n const itemName = resolveControlAttributeValue(attribs, 'for-item')?.trim() || 'item'\n let indexName = resolveControlAttributeValue(attribs, 'for-index')?.trim() || 'index'\n\n for (const [key, val] of Object.entries(attribs)) {\n if (CONTROL_ATTRS.has(key)) {\n continue\n }\n restAttribs[key] = val\n }\n\n if (itemName === indexName) {\n indexName = `${indexName}Index`\n }\n\n return {\n expr,\n itemName,\n indexName,\n restAttribs,\n }\n}\n\nexport function buildAttributeString(\n attribs: Record<string, string>,\n scope: LegacyTemplateScope,\n) {\n let result = ''\n for (const [name, rawValue] of Object.entries(attribs)) {\n if (CONTROL_ATTRS.has(name)) {\n continue\n }\n\n const eventInfo = parseEventAttribute(name)\n if (eventInfo) {\n const normalizedEvent = eventInfo.rawEvent.toLowerCase()\n const aliasedEvent = EVENT_KIND_ALIAS[normalizedEvent]\n const runtimeEvent = aliasedEvent ? normalizedEvent : eventInfo.rawEvent\n const encodedEvent = encodeEventAttributeName(runtimeEvent)\n const handlerName = resolveAttributeValue(rawValue, scope).trim()\n if (!handlerName) {\n continue\n }\n const flags = EVENT_PREFIX_FLAGS[eventInfo.prefix]!\n result += ` ${MINI_PROGRAM_EVENT_ATTRIBUTE_PREFIX}${encodedEvent}=\"${escapeAttribute(handlerName)}\"`\n const flagTokens = [\n flags.capture ? 'capture' : '',\n flags.catch ? 'catch' : '',\n ].filter(Boolean)\n if (flagTokens.length) {\n result += ` ${MINI_PROGRAM_EVENT_FLAG_ATTRIBUTE_PREFIX}${encodedEvent}=\"${flagTokens.join(',')}\"`\n }\n continue\n }\n\n const value = resolveAttributeValue(rawValue, scope)\n if (value === '') {\n continue\n }\n const normalizedName = normalizeAttributeName(name)\n result += ` ${normalizedName}=\"${escapeAttribute(value)}\"`\n }\n return result\n}\n\nexport function stripControlAttributes(attribs: Record<string, string>) {\n const result: Record<string, string> = {}\n for (const [name, value] of Object.entries(attribs)) {\n if (!CONTROL_ATTRS.has(name)) {\n result[name] = value\n }\n }\n return result\n}\n\nexport function isConditionalElement(node: Node): node is Element {\n if (node.type !== 'tag') {\n return false\n }\n const attribs = (node as Element).attribs\n return hasControlAttribute(attribs, 'if')\n || hasControlAttribute(attribs, 'elif')\n || hasControlAttribute(attribs, 'else')\n}\n"],"mappings":";;;;;AAgBA,MAAM,kBAAkB;AACxB,MAAM,qBAA6E;CACjF,QAAQ,CAAC;CACT,SAAS,EAAE,OAAO,KAAK;CACvB,YAAY,CAAC;CACb,gBAAgB,EAAE,SAAS,KAAK;CAChC,iBAAiB;EAAE,SAAS;EAAM,OAAO;CAAK;AAChD;AAEA,SAAS,oBAAoB,MAAc;CACzC,MAAM,iBAAiB,KAAK,QAAQ,GAAG;CACvC,IAAI,kBAAkB,GAAG;EACvB,MAAM,SAAS,KAAK,MAAM,GAAG,cAAc;EAC3C,MAAM,WAAW,KAAK,MAAM,iBAAiB,CAAC;EAC9C,IAAI,YAAY,UAAU,oBACxB,OAAO;GAAE;GAAQ;EAAS;EAE5B;CACF;CACA,MAAM,QAAQ,gBAAgB,KAAK,IAAI;CACvC,IAAI,CAAC,OACH;CAEF,OAAO;EAAE,QAAQ,MAAM;EAAK,UAAU,MAAM;CAAI;AAClD;AAEA,SAAgB,WAAW,SAAmD;CAC5E,MAAM,OAAO,6BAA6B,SAAS,KAAK;CACxD,MAAM,cAAsC,CAAC;CAC7C,MAAM,WAAW,6BAA6B,SAAS,UAAU,CAAC,EAAE,KAAK,KAAK;CAC9E,IAAI,YAAY,6BAA6B,SAAS,WAAW,CAAC,EAAE,KAAK,KAAK;CAE9E,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,OAAO,GAAG;EAChD,IAAI,cAAc,IAAI,GAAG,GACvB;EAEF,YAAY,OAAO;CACrB;CAEA,IAAI,aAAa,WACf,YAAY,GAAG,UAAU;CAG3B,OAAO;EACL;EACA;EACA;EACA;CACF;AACF;AAEA,SAAgB,qBACd,SACA,OACA;CACA,IAAI,SAAS;CACb,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,OAAO,GAAG;EACtD,IAAI,cAAc,IAAI,IAAI,GACxB;EAGF,MAAM,YAAY,oBAAoB,IAAI;EAC1C,IAAI,WAAW;GACb,MAAM,kBAAkB,UAAU,SAAS,YAAY;GAEvD,MAAM,eADe,iBAAiB,mBACF,kBAAkB,UAAU;GAChE,MAAM,eAAe,yBAAyB,YAAY;GAC1D,MAAM,cAAc,sBAAsB,UAAU,KAAK,CAAC,CAAC,KAAK;GAChE,IAAI,CAAC,aACH;GAEF,MAAM,QAAQ,mBAAmB,UAAU;GAC3C,UAAU,IAAI,sCAAsC,aAAa,IAAI,gBAAgB,WAAW,EAAE;GAClG,MAAM,aAAa,CACjB,MAAM,UAAU,YAAY,IAC5B,MAAM,QAAQ,UAAU,EAC1B,CAAC,CAAC,OAAO,OAAO;GAChB,IAAI,WAAW,QACb,UAAU,IAAI,2CAA2C,aAAa,IAAI,WAAW,KAAK,GAAG,EAAE;GAEjG;EACF;EAEA,MAAM,QAAQ,sBAAsB,UAAU,KAAK;EACnD,IAAI,UAAU,IACZ;EAEF,MAAM,iBAAiB,uBAAuB,IAAI;EAClD,UAAU,IAAI,eAAe,IAAI,gBAAgB,KAAK,EAAE;CAC1D;CACA,OAAO;AACT;AAEA,SAAgB,uBAAuB,SAAiC;CACtE,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,OAAO,GAChD,IAAI,CAAC,cAAc,IAAI,IAAI,GACzB,OAAO,QAAQ;CAGnB,OAAO;AACT;AAEA,SAAgB,qBAAqB,MAA6B;CAChE,IAAI,KAAK,SAAS,OAChB,OAAO;CAET,MAAM,UAAW,KAAiB;CAClC,OAAO,oBAAoB,SAAS,IAAI,KACnC,oBAAoB,SAAS,MAAM,KACnC,oBAAoB,SAAS,MAAM;AAC1C"}
1
+ {"version":3,"file":"dom.mjs","names":[],"sources":["../../../src/runtime/legacyTemplate/dom.ts"],"sourcesContent":["import type { Element, Node } from 'domhandler'\nimport type { ExtractForResult, LegacyTemplateScope } from './types'\nimport {\n CONTROL_ATTRS,\n EVENT_KIND_ALIAS,\n hasControlAttribute,\n normalizeAttributeName,\n resolveControlAttributeValue,\n} from '../../shared/wxml'\nimport {\n encodeEventAttributeName,\n MINI_PROGRAM_EVENT_ATTRIBUTE_PREFIX,\n MINI_PROGRAM_EVENT_FLAG_ATTRIBUTE_PREFIX,\n} from '../component/constants'\nimport { transformInlineStyleValue } from '../inlineStyle'\nimport { escapeAttribute, evaluateExpression, resolveAttributeValue } from './expression'\n\nconst EVENT_PREFIX_RE = /^(bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nconst EVENT_PREFIX_FLAGS: Record<string, { catch?: boolean, capture?: boolean }> = {\n 'bind': {},\n 'catch': { catch: true },\n 'mut-bind': {},\n 'capture-bind': { capture: true },\n 'capture-catch': { capture: true, catch: true },\n}\n\nfunction parseEventAttribute(name: string) {\n const separatorIndex = name.indexOf(':')\n if (separatorIndex >= 0) {\n const prefix = name.slice(0, separatorIndex)\n const rawEvent = name.slice(separatorIndex + 1)\n if (rawEvent && prefix in EVENT_PREFIX_FLAGS) {\n return { prefix, rawEvent }\n }\n return undefined\n }\n const match = EVENT_PREFIX_RE.exec(name)\n if (!match) {\n return undefined\n }\n return { prefix: match[1]!, rawEvent: match[2]! }\n}\n\nexport function extractFor(attribs: Record<string, string>): ExtractForResult {\n const expr = resolveControlAttributeValue(attribs, 'for')\n const restAttribs: Record<string, string> = {}\n const itemName = resolveControlAttributeValue(attribs, 'for-item')?.trim() || 'item'\n let indexName = resolveControlAttributeValue(attribs, 'for-index')?.trim() || 'index'\n\n for (const [key, val] of Object.entries(attribs)) {\n if (CONTROL_ATTRS.has(key)) {\n continue\n }\n restAttribs[key] = val\n }\n\n if (itemName === indexName) {\n indexName = `${indexName}Index`\n }\n\n return {\n expr,\n itemName,\n indexName,\n restAttribs,\n }\n}\n\nexport function buildAttributeString(\n attribs: Record<string, string>,\n scope: LegacyTemplateScope,\n dataset?: Map<string, unknown>,\n) {\n let result = ''\n for (const [name, rawValue] of Object.entries(attribs)) {\n if (CONTROL_ATTRS.has(name)) {\n continue\n }\n\n const eventInfo = parseEventAttribute(name)\n if (eventInfo) {\n const normalizedEvent = eventInfo.rawEvent.toLowerCase()\n const aliasedEvent = EVENT_KIND_ALIAS[normalizedEvent]\n const runtimeEvent = aliasedEvent ? normalizedEvent : eventInfo.rawEvent\n const encodedEvent = encodeEventAttributeName(runtimeEvent)\n const handlerName = resolveAttributeValue(rawValue, scope).trim()\n if (!handlerName) {\n continue\n }\n const flags = EVENT_PREFIX_FLAGS[eventInfo.prefix]!\n result += ` ${MINI_PROGRAM_EVENT_ATTRIBUTE_PREFIX}${encodedEvent}=\"${escapeAttribute(handlerName)}\"`\n const flagTokens = [\n flags.capture ? 'capture' : '',\n flags.catch ? 'catch' : '',\n ].filter(Boolean)\n if (flagTokens.length) {\n result += ` ${MINI_PROGRAM_EVENT_FLAG_ATTRIBUTE_PREFIX}${encodedEvent}=\"${flagTokens.join(',')}\"`\n }\n continue\n }\n\n const normalizedName = normalizeAttributeName(name)\n if (normalizedName.startsWith('data-')) {\n const trimmed = rawValue.trim()\n const expression = /^\\{\\{((?:(?!\\}\\})[\\s\\S])*)\\}\\}$/.exec(trimmed)\n const value: unknown = expression\n ? evaluateExpression(expression[1]!, scope)\n : rawValue.replace(/\\{\\{([\\s\\S]*?)\\}\\}/g, (_, source: string) => String(evaluateExpression(source, scope) ?? ''))\n dataset?.set(normalizedName, value)\n result += ` ${normalizedName}=\"${escapeAttribute(String(value ?? ''))}\"`\n continue\n }\n if (normalizedName === 'style') {\n const expression = /^\\{\\{((?:(?!\\}\\})[\\s\\S])*)\\}\\}$/.exec(rawValue.trim())\n const rawStyle: unknown = expression\n ? evaluateExpression(expression[1]!, scope)\n : resolveAttributeValue(rawValue, scope)\n const style = transformInlineStyleValue(rawStyle)\n if (style != null && style !== '') {\n result += ` style=\"${escapeAttribute(String(style))}\"`\n }\n continue\n }\n const value = resolveAttributeValue(rawValue, scope)\n if (value === '') {\n continue\n }\n result += ` ${normalizedName}=\"${escapeAttribute(value)}\"`\n }\n return result\n}\n\nexport function stripControlAttributes(attribs: Record<string, string>) {\n const result: Record<string, string> = {}\n for (const [name, value] of Object.entries(attribs)) {\n if (!CONTROL_ATTRS.has(name)) {\n result[name] = value\n }\n }\n return result\n}\n\nexport function isConditionalElement(node: Node): node is Element {\n if (node.type !== 'tag') {\n return false\n }\n const attribs = (node as Element).attribs\n return hasControlAttribute(attribs, 'if')\n || hasControlAttribute(attribs, 'elif')\n || hasControlAttribute(attribs, 'else')\n}\n"],"mappings":";;;;;;AAiBA,MAAM,kBAAkB;AACxB,MAAM,qBAA6E;CACjF,QAAQ,CAAC;CACT,SAAS,EAAE,OAAO,KAAK;CACvB,YAAY,CAAC;CACb,gBAAgB,EAAE,SAAS,KAAK;CAChC,iBAAiB;EAAE,SAAS;EAAM,OAAO;CAAK;AAChD;AAEA,SAAS,oBAAoB,MAAc;CACzC,MAAM,iBAAiB,KAAK,QAAQ,GAAG;CACvC,IAAI,kBAAkB,GAAG;EACvB,MAAM,SAAS,KAAK,MAAM,GAAG,cAAc;EAC3C,MAAM,WAAW,KAAK,MAAM,iBAAiB,CAAC;EAC9C,IAAI,YAAY,UAAU,oBACxB,OAAO;GAAE;GAAQ;EAAS;EAE5B;CACF;CACA,MAAM,QAAQ,gBAAgB,KAAK,IAAI;CACvC,IAAI,CAAC,OACH;CAEF,OAAO;EAAE,QAAQ,MAAM;EAAK,UAAU,MAAM;CAAI;AAClD;AAEA,SAAgB,WAAW,SAAmD;CAC5E,MAAM,OAAO,6BAA6B,SAAS,KAAK;CACxD,MAAM,cAAsC,CAAC;CAC7C,MAAM,WAAW,6BAA6B,SAAS,UAAU,CAAC,EAAE,KAAK,KAAK;CAC9E,IAAI,YAAY,6BAA6B,SAAS,WAAW,CAAC,EAAE,KAAK,KAAK;CAE9E,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,OAAO,GAAG;EAChD,IAAI,cAAc,IAAI,GAAG,GACvB;EAEF,YAAY,OAAO;CACrB;CAEA,IAAI,aAAa,WACf,YAAY,GAAG,UAAU;CAG3B,OAAO;EACL;EACA;EACA;EACA;CACF;AACF;AAEA,SAAgB,qBACd,SACA,OACA,SACA;CACA,IAAI,SAAS;CACb,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,OAAO,GAAG;EACtD,IAAI,cAAc,IAAI,IAAI,GACxB;EAGF,MAAM,YAAY,oBAAoB,IAAI;EAC1C,IAAI,WAAW;GACb,MAAM,kBAAkB,UAAU,SAAS,YAAY;GAEvD,MAAM,eADe,iBAAiB,mBACF,kBAAkB,UAAU;GAChE,MAAM,eAAe,yBAAyB,YAAY;GAC1D,MAAM,cAAc,sBAAsB,UAAU,KAAK,CAAC,CAAC,KAAK;GAChE,IAAI,CAAC,aACH;GAEF,MAAM,QAAQ,mBAAmB,UAAU;GAC3C,UAAU,IAAI,sCAAsC,aAAa,IAAI,gBAAgB,WAAW,EAAE;GAClG,MAAM,aAAa,CACjB,MAAM,UAAU,YAAY,IAC5B,MAAM,QAAQ,UAAU,EAC1B,CAAC,CAAC,OAAO,OAAO;GAChB,IAAI,WAAW,QACb,UAAU,IAAI,2CAA2C,aAAa,IAAI,WAAW,KAAK,GAAG,EAAE;GAEjG;EACF;EAEA,MAAM,iBAAiB,uBAAuB,IAAI;EAClD,IAAI,eAAe,WAAW,OAAO,GAAG;GACtC,MAAM,UAAU,SAAS,KAAK;GAC9B,MAAM,aAAa,kCAAkC,KAAK,OAAO;GACjE,MAAM,QAAiB,aACnB,mBAAmB,WAAW,IAAK,KAAK,IACxC,SAAS,QAAQ,wBAAwB,GAAG,WAAmB,OAAO,mBAAmB,QAAQ,KAAK,KAAK,EAAE,CAAC;GAClH,SAAS,IAAI,gBAAgB,KAAK;GAClC,UAAU,IAAI,eAAe,IAAI,gBAAgB,OAAO,SAAS,EAAE,CAAC,EAAE;GACtE;EACF;EACA,IAAI,mBAAmB,SAAS;GAC9B,MAAM,aAAa,kCAAkC,KAAK,SAAS,KAAK,CAAC;GACzE,MAAM,WAAoB,aACtB,mBAAmB,WAAW,IAAK,KAAK,IACxC,sBAAsB,UAAU,KAAK;GACzC,MAAM,QAAQ,0BAA0B,QAAQ;GAChD,IAAI,SAAS,QAAQ,UAAU,IAC7B,UAAU,WAAW,gBAAgB,OAAO,KAAK,CAAC,EAAE;GAEtD;EACF;EACA,MAAM,QAAQ,sBAAsB,UAAU,KAAK;EACnD,IAAI,UAAU,IACZ;EAEF,UAAU,IAAI,eAAe,IAAI,gBAAgB,KAAK,EAAE;CAC1D;CACA,OAAO;AACT;AAEA,SAAgB,uBAAuB,SAAiC;CACtE,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,OAAO,GAChD,IAAI,CAAC,cAAc,IAAI,IAAI,GACzB,OAAO,QAAQ;CAGnB,OAAO;AACT;AAEA,SAAgB,qBAAqB,MAA6B;CAChE,IAAI,KAAK,SAAS,OAChB,OAAO;CAET,MAAM,UAAW,KAAiB;CAClC,OAAO,oBAAoB,SAAS,IAAI,KACnC,oBAAoB,SAAS,MAAM,KACnC,oBAAoB,SAAS,MAAM;AAC1C"}
@@ -1,6 +1,6 @@
1
1
  import { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from "../execution.mjs";
2
2
 
3
- //#region src/runtime/legacyTemplate/expression.ts
3
+ // src/runtime/legacyTemplate/expression.ts
4
4
  const expressionCache = /* @__PURE__ */ new Map();
5
5
  function createScope(initial) {
6
6
  return Object.assign(Object.create(null), initial ?? {});
@@ -108,6 +108,5 @@ function resolveAttributeValue(value, scope) {
108
108
  return interpolateText(value ?? "", scope, false);
109
109
  }
110
110
 
111
- //#endregion
112
111
  export { createChildScope, createScope, escapeAttribute, escapeHtml, evaluateExpression, interpolateText, normalizeList, resolveAttributeValue };
113
112
  //# sourceMappingURL=expression.mjs.map
@@ -1,7 +1,5 @@
1
1
  import { LegacyTemplateRenderer, LegacyTemplateScope } from "./types.mjs";
2
2
  import { ChildNode } from "domhandler";
3
- //#region src/runtime/legacyTemplate/index.d.ts
4
3
  export declare function renderTemplate(nodes: ChildNode[], scope?: LegacyTemplateScope): string;
5
4
  export declare function createTemplate(source: string): LegacyTemplateRenderer;
6
- //#endregion
7
5
  //# sourceMappingURL=index.d.mts.map
@@ -1,9 +1,10 @@
1
1
  import { SELF_CLOSING_TAGS, hasControlAttribute, normalizeTagName, resolveControlAttributeValue } from "../../shared/wxml.mjs";
2
+ import { createLegacyDatasetAnchor, recordLegacyDatasetRender } from "./dataset.mjs";
2
3
  import { createChildScope, createScope, evaluateExpression, interpolateText, normalizeList } from "./expression.mjs";
3
4
  import { buildAttributeString, extractFor, isConditionalElement, stripControlAttributes } from "./dom.mjs";
4
5
  import { parseDocument } from "htmlparser2";
5
6
 
6
- //#region src/runtime/legacyTemplate/index.ts
7
+ // src/runtime/legacyTemplate/index.ts
7
8
  const templateCache = /* @__PURE__ */ new Map();
8
9
  function filterRenderableNode(node) {
9
10
  if (node.type === "directive" || node.type === "comment") return false;
@@ -22,7 +23,7 @@ function getOrParseTemplate(source) {
22
23
  }
23
24
  return cached;
24
25
  }
25
- function renderConditionalSequence(nodes, startIndex, scope, renderChildren) {
26
+ function renderConditionalSequence(nodes, startIndex, scope, renderChildren, datasets) {
26
27
  const branches = [];
27
28
  let cursor = startIndex;
28
29
  while (cursor < nodes.length) {
@@ -48,13 +49,13 @@ function renderConditionalSequence(nodes, startIndex, scope, renderChildren) {
48
49
  }
49
50
  for (const { node, attribs } of branches) {
50
51
  if (hasControlAttribute(attribs, "else")) return {
51
- rendered: renderElement(node, scope, renderChildren, { overrideAttribs: stripControlAttributes(attribs) }),
52
+ rendered: renderElement(node, scope, renderChildren, { overrideAttribs: stripControlAttributes(attribs) }, datasets),
52
53
  endIndex: startIndex + branches.length - 1
53
54
  };
54
55
  const conditionExpr = resolveControlAttributeValue(attribs, "if") ?? resolveControlAttributeValue(attribs, "elif");
55
56
  if (!conditionExpr) continue;
56
57
  if (evaluateExpression(conditionExpr, scope)) return {
57
- rendered: renderElement(node, scope, renderChildren, { overrideAttribs: stripControlAttributes(attribs) }),
58
+ rendered: renderElement(node, scope, renderChildren, { overrideAttribs: stripControlAttributes(attribs) }, datasets),
58
59
  endIndex: startIndex + branches.length - 1
59
60
  };
60
61
  }
@@ -63,7 +64,7 @@ function renderConditionalSequence(nodes, startIndex, scope, renderChildren) {
63
64
  endIndex: startIndex + branches.length - 1
64
65
  };
65
66
  }
66
- function renderElement(node, scope, renderChildren, options = {}) {
67
+ function renderElement(node, scope, renderChildren, options = {}, datasets) {
67
68
  const attribs = node.attribs;
68
69
  if (!options.skipFor) {
69
70
  const forExtract = extractFor(attribs);
@@ -79,7 +80,7 @@ function renderElement(node, scope, renderChildren, options = {}) {
79
80
  buffer += renderElement(node, childScope, renderChildren, {
80
81
  skipFor: true,
81
82
  overrideAttribs: forExtract.restAttribs
82
- });
83
+ }, datasets);
83
84
  }
84
85
  return buffer;
85
86
  }
@@ -87,36 +88,38 @@ function renderElement(node, scope, renderChildren, options = {}) {
87
88
  const effectiveAttribs = options.overrideAttribs ?? attribs;
88
89
  const normalizedTag = normalizeTagName(node.name);
89
90
  if (normalizedTag === "#fragment") return renderChildren(node.children, scope);
90
- const attrs = buildAttributeString(effectiveAttribs, scope);
91
+ const dataset = datasets ? /* @__PURE__ */ new Map() : void 0;
92
+ const attrs = buildAttributeString(effectiveAttribs, scope, dataset);
93
+ const anchor = dataset?.size && datasets ? createLegacyDatasetAnchor(datasets, dataset) : "";
91
94
  const children = renderChildren(node.children, scope);
92
- if (SELF_CLOSING_TAGS.has(normalizedTag) && !children) return `<${normalizedTag}${attrs} />`;
93
- return `<${normalizedTag}${attrs}>${children}</${normalizedTag}>`;
95
+ if (SELF_CLOSING_TAGS.has(normalizedTag) && !children) return `${anchor}<${normalizedTag}${attrs} />`;
96
+ return `${anchor}<${normalizedTag}${attrs}>${children}</${normalizedTag}>`;
94
97
  }
95
98
  function renderTextNode(node, scope) {
96
99
  const value = node.data;
97
100
  if (!value.trim()) return "";
98
101
  return interpolateText(value, scope, true);
99
102
  }
100
- function renderTree(input, scope) {
103
+ function renderTree(input, scope, datasets) {
101
104
  if (!input) return "";
102
105
  if (Array.isArray(input)) {
103
106
  let buffer = "";
104
107
  for (let index = 0; index < input.length; index++) {
105
108
  const node = input[index];
106
109
  if (isConditionalElement(node)) {
107
- const { rendered, endIndex } = renderConditionalSequence(input, index, scope, renderTree);
110
+ const { rendered, endIndex } = renderConditionalSequence(input, index, scope, (nodes, childScope) => renderTree(nodes, childScope, datasets), datasets);
108
111
  buffer += rendered;
109
112
  index = endIndex;
110
113
  continue;
111
114
  }
112
- buffer += renderTree(node, scope);
115
+ buffer += renderTree(node, scope, datasets);
113
116
  }
114
117
  return buffer;
115
118
  }
116
119
  const node = input;
117
120
  if (node.type === "text") return renderTextNode(node, scope);
118
- if (node.type === "tag" || node.type === "script" || node.type === "style") return renderElement(node, scope, renderTree);
119
- if ("children" in node && node.children?.length) return renderTree(node.children, scope);
121
+ if (node.type === "tag" || node.type === "script" || node.type === "style") return renderElement(node, scope, (nodes, childScope) => renderTree(nodes, childScope, datasets), {}, datasets);
122
+ if ("children" in node && node.children?.length) return renderTree(node.children, scope, datasets);
120
123
  return "";
121
124
  }
122
125
  function renderTemplate(nodes, scope) {
@@ -124,9 +127,13 @@ function renderTemplate(nodes, scope) {
124
127
  }
125
128
  function createTemplate(source) {
126
129
  const nodes = getOrParseTemplate(source);
127
- return (scope) => renderTemplate(nodes, scope);
130
+ return (scope, context) => {
131
+ const datasets = context ? [] : void 0;
132
+ const result = renderTree(nodes, createScope(scope), datasets);
133
+ if (context && datasets) recordLegacyDatasetRender(context, datasets);
134
+ return result;
135
+ };
128
136
  }
129
137
 
130
- //#endregion
131
138
  export { createTemplate, renderTemplate };
132
139
  //# sourceMappingURL=index.mjs.map