@weapp-vite/web 1.3.37 → 1.4.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 (321) hide show
  1. package/README.md +144 -5
  2. package/dist/_virtual/_rolldown/runtime.mjs +19 -1
  3. package/dist/compiler/wxml/attributes.mjs +1 -1
  4. package/dist/compiler/wxml/attributes.mjs.map +1 -1
  5. package/dist/compiler/wxml/compile.mjs +6 -3
  6. package/dist/compiler/wxml/compile.mjs.map +1 -1
  7. package/dist/compiler/wxml/interpolation.mjs +1 -2
  8. package/dist/compiler/wxml/interpolation.mjs.map +1 -1
  9. package/dist/compiler/wxml/navigation.mjs +5 -7
  10. package/dist/compiler/wxml/navigation.mjs.map +1 -1
  11. package/dist/compiler/wxml/parser.mjs +5 -5
  12. package/dist/compiler/wxml/parser.mjs.map +1 -1
  13. package/dist/compiler/wxml/renderer.mjs +13 -12
  14. package/dist/compiler/wxml/renderer.mjs.map +1 -1
  15. package/dist/compiler/wxml/specialNodes.mjs +6 -1
  16. package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
  17. package/dist/compiler/wxml/types.d.mts +12 -0
  18. package/dist/compiler/wxs.mjs +5 -5
  19. package/dist/compiler/wxs.mjs.map +1 -1
  20. package/dist/css/wxss.d.mts +1 -0
  21. package/dist/css/wxss.mjs +110 -9
  22. package/dist/css/wxss.mjs.map +1 -1
  23. package/dist/index.d.mts +29 -6
  24. package/dist/index.mjs +197 -4
  25. package/dist/index.mjs.map +1 -0
  26. package/dist/plugin/assets.d.mts +7 -0
  27. package/dist/plugin/assets.mjs +122 -0
  28. package/dist/plugin/assets.mjs.map +1 -0
  29. package/dist/plugin/constants.mjs +10 -1
  30. package/dist/plugin/constants.mjs.map +1 -1
  31. package/dist/plugin/dependencyScan.mjs +41 -0
  32. package/dist/plugin/dependencyScan.mjs.map +1 -0
  33. package/dist/plugin/entry.mjs +55 -6
  34. package/dist/plugin/entry.mjs.map +1 -1
  35. package/dist/plugin/files.mjs +1 -1
  36. package/dist/plugin/files.mjs.map +1 -1
  37. package/dist/plugin/index.d.mts +37 -3
  38. package/dist/plugin/index.mjs +240 -73
  39. package/dist/plugin/index.mjs.map +1 -1
  40. package/dist/plugin/layout.mjs +24 -0
  41. package/dist/plugin/layout.mjs.map +1 -0
  42. package/dist/plugin/path.mjs +4 -1
  43. package/dist/plugin/path.mjs.map +1 -1
  44. package/dist/plugin/register.mjs +45 -33
  45. package/dist/plugin/register.mjs.map +1 -1
  46. package/dist/plugin/scan.mjs +206 -94
  47. package/dist/plugin/scan.mjs.map +1 -1
  48. package/dist/plugin/scanSfc.mjs +65 -0
  49. package/dist/plugin/scanSfc.mjs.map +1 -0
  50. package/dist/plugin/state.mjs +3 -2
  51. package/dist/plugin/state.mjs.map +1 -1
  52. package/dist/plugin/styleModule.mjs +52 -0
  53. package/dist/plugin/styleModule.mjs.map +1 -0
  54. package/dist/plugin/types.d.mts +37 -1
  55. package/dist/plugin/vueSfc.mjs +149 -0
  56. package/dist/plugin/vueSfc.mjs.map +1 -0
  57. package/dist/runtime/appShell/container.mjs +25 -0
  58. package/dist/runtime/appShell/container.mjs.map +1 -0
  59. package/dist/runtime/appShell/tabBar/index.mjs +192 -0
  60. package/dist/runtime/appShell/tabBar/index.mjs.map +1 -0
  61. package/dist/runtime/appShell/tabBar/style.mjs +127 -0
  62. package/dist/runtime/appShell/tabBar/style.mjs.map +1 -0
  63. package/dist/runtime/button/helpers.mjs +1 -58
  64. package/dist/runtime/button/helpers.mjs.map +1 -1
  65. package/dist/runtime/button/index.d.mts +4 -5
  66. package/dist/runtime/button/index.mjs +6 -28
  67. package/dist/runtime/button/index.mjs.map +1 -1
  68. package/dist/runtime/button/style.mjs +53 -28
  69. package/dist/runtime/button/style.mjs.map +1 -1
  70. package/dist/runtime/component/behavior.mjs +26 -2
  71. package/dist/runtime/component/behavior.mjs.map +1 -1
  72. package/dist/runtime/component/element.mjs +107 -31
  73. package/dist/runtime/component/element.mjs.map +1 -1
  74. package/dist/runtime/component/observers.mjs +36 -0
  75. package/dist/runtime/component/observers.mjs.map +1 -0
  76. package/dist/runtime/component/publicInstance.mjs +48 -0
  77. package/dist/runtime/component/publicInstance.mjs.map +1 -0
  78. package/dist/runtime/component/relations.mjs +35 -0
  79. package/dist/runtime/component/relations.mjs.map +1 -0
  80. package/dist/runtime/component/slots.mjs +24 -0
  81. package/dist/runtime/component/slots.mjs.map +1 -0
  82. package/dist/runtime/component/state.mjs +13 -3
  83. package/dist/runtime/component/state.mjs.map +1 -1
  84. package/dist/runtime/component/types.d.mts +29 -4
  85. package/dist/runtime/component/virtualHost.mjs +83 -0
  86. package/dist/runtime/component/virtualHost.mjs.map +1 -0
  87. package/dist/runtime/host/index.d.mts +13 -0
  88. package/dist/runtime/host/index.mjs +47 -0
  89. package/dist/runtime/host/index.mjs.map +1 -0
  90. package/dist/runtime/host/types.d.mts +28 -0
  91. package/dist/runtime/hostGlobals.d.mts +9 -0
  92. package/dist/runtime/hostGlobals.mjs +39 -0
  93. package/dist/runtime/hostGlobals.mjs.map +1 -0
  94. package/dist/runtime/index.d.mts +21 -3
  95. package/dist/runtime/index.mjs +26 -4
  96. package/dist/runtime/index.mjs.map +1 -0
  97. package/dist/runtime/legacyTemplate/dom.mjs +3 -3
  98. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
  99. package/dist/runtime/legacyTemplate/expression.mjs +9 -9
  100. package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
  101. package/dist/runtime/legacyTemplate/index.mjs +6 -6
  102. package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
  103. package/dist/runtime/nativeComponents/canvas/index.mjs +53 -0
  104. package/dist/runtime/nativeComponents/canvas/index.mjs.map +1 -0
  105. package/dist/runtime/nativeComponents/checkbox.mjs +137 -0
  106. package/dist/runtime/nativeComponents/checkbox.mjs.map +1 -0
  107. package/dist/runtime/nativeComponents/cover/index.mjs +23 -0
  108. package/dist/runtime/nativeComponents/cover/index.mjs.map +1 -0
  109. package/dist/runtime/nativeComponents/form.d.mts +7 -0
  110. package/dist/runtime/nativeComponents/form.mjs +50 -0
  111. package/dist/runtime/nativeComponents/form.mjs.map +1 -0
  112. package/dist/runtime/nativeComponents/formControl.mjs +61 -0
  113. package/dist/runtime/nativeComponents/formControl.mjs.map +1 -0
  114. package/dist/runtime/nativeComponents/helpers.mjs +25 -0
  115. package/dist/runtime/nativeComponents/helpers.mjs.map +1 -0
  116. package/dist/runtime/nativeComponents/icon/helpers.mjs +42 -0
  117. package/dist/runtime/nativeComponents/icon/helpers.mjs.map +1 -0
  118. package/dist/runtime/nativeComponents/icon/index.mjs +45 -0
  119. package/dist/runtime/nativeComponents/icon/index.mjs.map +1 -0
  120. package/dist/runtime/nativeComponents/icon/style.mjs +176 -0
  121. package/dist/runtime/nativeComponents/icon/style.mjs.map +1 -0
  122. package/dist/runtime/nativeComponents/image.d.mts +8 -0
  123. package/dist/runtime/nativeComponents/image.mjs +121 -0
  124. package/dist/runtime/nativeComponents/image.mjs.map +1 -0
  125. package/dist/runtime/nativeComponents/index.d.mts +11 -0
  126. package/dist/runtime/nativeComponents/index.mjs +83 -0
  127. package/dist/runtime/nativeComponents/index.mjs.map +1 -0
  128. package/dist/runtime/nativeComponents/input.d.mts +8 -0
  129. package/dist/runtime/nativeComponents/input.mjs +131 -0
  130. package/dist/runtime/nativeComponents/input.mjs.map +1 -0
  131. package/dist/runtime/nativeComponents/label.mjs +36 -0
  132. package/dist/runtime/nativeComponents/label.mjs.map +1 -0
  133. package/dist/runtime/nativeComponents/mediaRegistry.mjs +47 -0
  134. package/dist/runtime/nativeComponents/mediaRegistry.mjs.map +1 -0
  135. package/dist/runtime/nativeComponents/movable/helpers.mjs +23 -0
  136. package/dist/runtime/nativeComponents/movable/helpers.mjs.map +1 -0
  137. package/dist/runtime/nativeComponents/movable/index.mjs +117 -0
  138. package/dist/runtime/nativeComponents/movable/index.mjs.map +1 -0
  139. package/dist/runtime/nativeComponents/navigator.mjs +200 -0
  140. package/dist/runtime/nativeComponents/navigator.mjs.map +1 -0
  141. package/dist/runtime/nativeComponents/picker/editors.mjs +74 -0
  142. package/dist/runtime/nativeComponents/picker/editors.mjs.map +1 -0
  143. package/dist/runtime/nativeComponents/picker/helpers.mjs +57 -0
  144. package/dist/runtime/nativeComponents/picker/helpers.mjs.map +1 -0
  145. package/dist/runtime/nativeComponents/picker/index.mjs +210 -0
  146. package/dist/runtime/nativeComponents/picker/index.mjs.map +1 -0
  147. package/dist/runtime/nativeComponents/picker/style.mjs +71 -0
  148. package/dist/runtime/nativeComponents/picker/style.mjs.map +1 -0
  149. package/dist/runtime/nativeComponents/pickerView/column.mjs +134 -0
  150. package/dist/runtime/nativeComponents/pickerView/column.mjs.map +1 -0
  151. package/dist/runtime/nativeComponents/pickerView/helpers.mjs +17 -0
  152. package/dist/runtime/nativeComponents/pickerView/helpers.mjs.map +1 -0
  153. package/dist/runtime/nativeComponents/pickerView/index.mjs +128 -0
  154. package/dist/runtime/nativeComponents/pickerView/index.mjs.map +1 -0
  155. package/dist/runtime/nativeComponents/pickerView/style.mjs +58 -0
  156. package/dist/runtime/nativeComponents/pickerView/style.mjs.map +1 -0
  157. package/dist/runtime/nativeComponents/primitives.mjs +16 -0
  158. package/dist/runtime/nativeComponents/primitives.mjs.map +1 -0
  159. package/dist/runtime/nativeComponents/progress/helpers.mjs +29 -0
  160. package/dist/runtime/nativeComponents/progress/helpers.mjs.map +1 -0
  161. package/dist/runtime/nativeComponents/progress/index.mjs +130 -0
  162. package/dist/runtime/nativeComponents/progress/index.mjs.map +1 -0
  163. package/dist/runtime/nativeComponents/progress/style.mjs +40 -0
  164. package/dist/runtime/nativeComponents/progress/style.mjs.map +1 -0
  165. package/dist/runtime/nativeComponents/radio.mjs +147 -0
  166. package/dist/runtime/nativeComponents/radio.mjs.map +1 -0
  167. package/dist/runtime/nativeComponents/richText/helpers.mjs +230 -0
  168. package/dist/runtime/nativeComponents/richText/helpers.mjs.map +1 -0
  169. package/dist/runtime/nativeComponents/richText/index.mjs +74 -0
  170. package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -0
  171. package/dist/runtime/nativeComponents/scrollView.d.mts +15 -0
  172. package/dist/runtime/nativeComponents/scrollView.mjs +79 -0
  173. package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -0
  174. package/dist/runtime/nativeComponents/slider/helpers.mjs +28 -0
  175. package/dist/runtime/nativeComponents/slider/helpers.mjs.map +1 -0
  176. package/dist/runtime/nativeComponents/slider/index.mjs +120 -0
  177. package/dist/runtime/nativeComponents/slider/index.mjs.map +1 -0
  178. package/dist/runtime/nativeComponents/slider/style.mjs +60 -0
  179. package/dist/runtime/nativeComponents/slider/style.mjs.map +1 -0
  180. package/dist/runtime/nativeComponents/style.mjs +41 -0
  181. package/dist/runtime/nativeComponents/style.mjs.map +1 -0
  182. package/dist/runtime/nativeComponents/swiper/helpers.mjs +52 -0
  183. package/dist/runtime/nativeComponents/swiper/helpers.mjs.map +1 -0
  184. package/dist/runtime/nativeComponents/swiper/index.mjs +235 -0
  185. package/dist/runtime/nativeComponents/swiper/index.mjs.map +1 -0
  186. package/dist/runtime/nativeComponents/swiper/item.mjs +14 -0
  187. package/dist/runtime/nativeComponents/swiper/item.mjs.map +1 -0
  188. package/dist/runtime/nativeComponents/swiper/style.mjs +20 -0
  189. package/dist/runtime/nativeComponents/swiper/style.mjs.map +1 -0
  190. package/dist/runtime/nativeComponents/switch.d.mts +7 -0
  191. package/dist/runtime/nativeComponents/switch.mjs +132 -0
  192. package/dist/runtime/nativeComponents/switch.mjs.map +1 -0
  193. package/dist/runtime/nativeComponents/textarea.d.mts +9 -0
  194. package/dist/runtime/nativeComponents/textarea.mjs +144 -0
  195. package/dist/runtime/nativeComponents/textarea.mjs.map +1 -0
  196. package/dist/runtime/nativeComponents/video/helpers.d.mts +12 -0
  197. package/dist/runtime/nativeComponents/video/helpers.mjs +21 -0
  198. package/dist/runtime/nativeComponents/video/helpers.mjs.map +1 -0
  199. package/dist/runtime/nativeComponents/video/index.mjs +124 -0
  200. package/dist/runtime/nativeComponents/video/index.mjs.map +1 -0
  201. package/dist/runtime/nativeComponents/video/style.mjs +14 -0
  202. package/dist/runtime/nativeComponents/video/style.mjs.map +1 -0
  203. package/dist/runtime/navigationBar/index.mjs +1 -3
  204. package/dist/runtime/navigationBar/index.mjs.map +1 -1
  205. package/dist/runtime/pageLayout.d.mts +9 -0
  206. package/dist/runtime/pageLayout.mjs +16 -0
  207. package/dist/runtime/pageLayout.mjs.map +1 -0
  208. package/dist/runtime/polyfill/animation.mjs +120 -0
  209. package/dist/runtime/polyfill/animation.mjs.map +1 -0
  210. package/dist/runtime/polyfill/appState.mjs +1 -1
  211. package/dist/runtime/polyfill/appState.mjs.map +1 -1
  212. package/dist/runtime/polyfill/async.d.mts +7 -0
  213. package/dist/runtime/polyfill/async.mjs.map +1 -1
  214. package/dist/runtime/polyfill/canvasContext.mjs +41 -0
  215. package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
  216. package/dist/runtime/polyfill/device.mjs +1 -1
  217. package/dist/runtime/polyfill/device.mjs.map +1 -1
  218. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +8 -2
  219. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
  220. package/dist/runtime/polyfill/eventBus.mjs +56 -0
  221. package/dist/runtime/polyfill/eventBus.mjs.map +1 -0
  222. package/dist/runtime/polyfill/fileSystemManager.mjs +5 -2
  223. package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
  224. package/dist/runtime/polyfill/files.mjs +10 -10
  225. package/dist/runtime/polyfill/files.mjs.map +1 -1
  226. package/dist/runtime/polyfill/font.mjs +32 -0
  227. package/dist/runtime/polyfill/font.mjs.map +1 -0
  228. package/dist/runtime/polyfill/index.d.mts +2 -2
  229. package/dist/runtime/polyfill/index.mjs +49 -45
  230. package/dist/runtime/polyfill/index.mjs.map +1 -1
  231. package/dist/runtime/polyfill/interaction.mjs +7 -6
  232. package/dist/runtime/polyfill/interaction.mjs.map +1 -1
  233. package/dist/runtime/polyfill/interactionApi.mjs +3 -2
  234. package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
  235. package/dist/runtime/polyfill/intersectionObserver.mjs +106 -0
  236. package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -0
  237. package/dist/runtime/polyfill/locale.mjs +14 -0
  238. package/dist/runtime/polyfill/locale.mjs.map +1 -0
  239. package/dist/runtime/polyfill/locationApi.mjs +7 -4
  240. package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
  241. package/dist/runtime/polyfill/mediaActions.mjs +2 -2
  242. package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
  243. package/dist/runtime/polyfill/mediaApi/file.mjs +1 -1
  244. package/dist/runtime/polyfill/mediaApi/info.mjs +6 -4
  245. package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
  246. package/dist/runtime/polyfill/menuApi.mjs +38 -4
  247. package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
  248. package/dist/runtime/polyfill/navigationBarRuntime.mjs +6 -1
  249. package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
  250. package/dist/runtime/polyfill/network/request.mjs +2 -2
  251. package/dist/runtime/polyfill/network/request.mjs.map +1 -1
  252. package/dist/runtime/polyfill/platformApi.mjs +1 -1
  253. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +88 -0
  254. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -0
  255. package/dist/runtime/polyfill/routeRuntime/dom.mjs +44 -15
  256. package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
  257. package/dist/runtime/polyfill/routeRuntime/history.d.mts +30 -0
  258. package/dist/runtime/polyfill/routeRuntime/history.mjs +148 -0
  259. package/dist/runtime/polyfill/routeRuntime/history.mjs.map +1 -0
  260. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +39 -8
  261. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
  262. package/dist/runtime/polyfill/routeRuntime/options.d.mts +11 -1
  263. package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -1
  264. package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
  265. package/dist/runtime/polyfill/routeRuntime/result.mjs +12 -0
  266. package/dist/runtime/polyfill/routeRuntime/result.mjs.map +1 -0
  267. package/dist/runtime/polyfill/routeRuntime/scroll.mjs +39 -0
  268. package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -0
  269. package/dist/runtime/polyfill/routeRuntime/stack.mjs +122 -0
  270. package/dist/runtime/polyfill/routeRuntime/stack.mjs.map +1 -0
  271. package/dist/runtime/polyfill/routeRuntime.d.mts +26 -17
  272. package/dist/runtime/polyfill/routeRuntime.mjs +121 -96
  273. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
  274. package/dist/runtime/polyfill/runtimeDataApi.mjs +8 -3
  275. package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
  276. package/dist/runtime/polyfill/runtimeOps.mjs +10 -6
  277. package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
  278. package/dist/runtime/polyfill/selectorQuery.mjs +70 -14
  279. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
  280. package/dist/runtime/polyfill/storage.mjs +5 -2
  281. package/dist/runtime/polyfill/storage.mjs.map +1 -1
  282. package/dist/runtime/polyfill/system.mjs +30 -3
  283. package/dist/runtime/polyfill/system.mjs.map +1 -1
  284. package/dist/runtime/polyfill/types/locationRuntime.d.mts +1 -4
  285. package/dist/runtime/polyfill/types/platformRuntime.d.mts +9 -0
  286. package/dist/runtime/polyfill/types/systemAuth.d.mts +20 -9
  287. package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +25 -0
  288. package/dist/runtime/polyfill/ui.mjs +2 -6
  289. package/dist/runtime/polyfill/ui.mjs.map +1 -1
  290. package/dist/runtime/polyfill/uiMediaApi.d.mts +11 -10
  291. package/dist/runtime/polyfill/uiMediaApi.mjs +26 -2
  292. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
  293. package/dist/runtime/polyfill/videoContext.mjs +4 -0
  294. package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
  295. package/dist/runtime/polyfill/vkSession.mjs +4 -14
  296. package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
  297. package/dist/runtime/polyfill.d.mts +2 -2
  298. package/dist/runtime/renderContext.mjs +1 -1
  299. package/dist/runtime/renderContext.mjs.map +1 -1
  300. package/dist/runtime/rpx.mjs +17 -8
  301. package/dist/runtime/rpx.mjs.map +1 -1
  302. package/dist/runtime/seo/index.d.mts +31 -0
  303. package/dist/runtime/seo/index.mjs +94 -0
  304. package/dist/runtime/seo/index.mjs.map +1 -0
  305. package/dist/runtime/viewport/index.d.mts +12 -0
  306. package/dist/runtime/viewport/index.mjs +44 -0
  307. package/dist/runtime/viewport/index.mjs.map +1 -0
  308. package/dist/runtime/viewport/style.mjs +62 -0
  309. package/dist/runtime/viewport/style.mjs.map +1 -0
  310. package/dist/runtime/viewport/types.d.mts +14 -0
  311. package/dist/runtime/wevu.d.mts +20 -0
  312. package/dist/runtime/wevu.mjs +73 -0
  313. package/dist/runtime/wevu.mjs.map +1 -0
  314. package/dist/shared/nativeComponents.mjs +401 -0
  315. package/dist/shared/nativeComponents.mjs.map +1 -0
  316. package/dist/shared/tabBar.d.mts +19 -0
  317. package/dist/shared/tabBar.mjs +37 -0
  318. package/dist/shared/tabBar.mjs.map +1 -0
  319. package/dist/shared/wxml.mjs +3 -20
  320. package/dist/shared/wxml.mjs.map +1 -1
  321. package/package.json +13 -5
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.mjs","names":[],"sources":["../../../src/compiler/wxml/renderer.ts"],"sourcesContent":["import type { RenderElementNode, RenderNode } from './types'\nimport {\n hasControlAttribute,\n normalizeTagName,\n resolveControlAttributeValue,\n SELF_CLOSING_TAGS,\n} from '../../shared/wxml'\nimport {\n extractFor,\n isConditionalElement,\n renderAttributes,\n resolveComponentTagName,\n stripControlAttributes,\n} from './attributes'\nimport { buildExpression, buildTemplateDataExpression, parseInterpolations } from './interpolation'\n\ninterface RenderElementOptions {\n skipFor?: boolean\n overrideAttribs?: Record<string, string>\n}\n\nexport class Renderer {\n renderNodes(\n nodes: RenderNode[],\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n ): string {\n const parts: string[] = []\n for (let index = 0; index < nodes.length; index += 1) {\n const node = nodes[index]\n if (isConditionalElement(node)) {\n const { rendered, endIndex } = this.renderConditionalSequence(\n nodes,\n index,\n scopeVar,\n wxsVar,\n componentTags,\n )\n parts.push(rendered)\n index = endIndex\n continue\n }\n parts.push(this.renderNode(node, scopeVar, wxsVar, componentTags))\n }\n if (parts.length === 0) {\n return '\"\"'\n }\n if (parts.length === 1) {\n return parts[0]!\n }\n return `[${parts.join(', ')}]`\n }\n\n private renderConditionalSequence(\n nodes: RenderNode[],\n startIndex: number,\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n ): { rendered: string, endIndex: number } {\n const branches: Array<{ node: RenderElementNode, attribs: Record<string, string> }> = []\n let cursor = startIndex\n while (cursor < nodes.length) {\n const candidate = nodes[cursor]\n if (!isConditionalElement(candidate)) {\n break\n }\n const attribs = candidate.attribs ?? {}\n if (branches.length === 0 && !hasControlAttribute(attribs, 'if')) {\n break\n }\n if (branches.length > 0 && !hasControlAttribute(attribs, 'elif') && !hasControlAttribute(attribs, 'else')) {\n break\n }\n branches.push({ node: candidate, attribs })\n cursor += 1\n if (hasControlAttribute(attribs, 'else')) {\n break\n }\n }\n if (!branches.length) {\n const node = nodes[startIndex]\n if (!node) {\n return { rendered: '\"\"', endIndex: startIndex }\n }\n return { rendered: this.renderNode(node, scopeVar, wxsVar, componentTags), endIndex: startIndex }\n }\n let expr = '\"\"'\n for (let index = branches.length - 1; index >= 0; index -= 1) {\n const { node, attribs } = branches[index]!\n const cleanedAttribs = stripControlAttributes(attribs)\n if (hasControlAttribute(attribs, 'else')) {\n expr = this.renderElement(node, scopeVar, wxsVar, componentTags, { overrideAttribs: cleanedAttribs })\n continue\n }\n const conditionExpr = resolveControlAttributeValue(attribs, 'if')\n ?? resolveControlAttributeValue(attribs, 'elif')\n ?? ''\n const rendered = this.renderElement(node, scopeVar, wxsVar, componentTags, { overrideAttribs: cleanedAttribs })\n const condition = buildExpression(parseInterpolations(conditionExpr), scopeVar, wxsVar)\n expr = `(${condition} ? ${rendered} : ${expr})`\n }\n return { rendered: expr, endIndex: startIndex + branches.length - 1 }\n }\n\n private renderNode(\n node: RenderNode,\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n ): string {\n if (node.type === 'text') {\n const parts = parseInterpolations(node.data ?? '')\n return buildExpression(parts, scopeVar, wxsVar)\n }\n if (node.type === 'element') {\n if (node.name === 'template' && node.attribs?.is) {\n return this.renderTemplateInvoke(node, scopeVar, wxsVar)\n }\n return this.renderElement(node, scopeVar, wxsVar, componentTags)\n }\n return '\"\"'\n }\n\n private renderTemplateInvoke(\n node: RenderElementNode,\n scopeVar: string,\n wxsVar: string,\n ): string {\n const attribs = node.attribs ?? {}\n const isExpr = buildExpression(parseInterpolations(attribs.is ?? ''), scopeVar, wxsVar)\n const dataExpr = attribs.data\n ? buildTemplateDataExpression(attribs.data, scopeVar, wxsVar)\n : undefined\n const scopeExpr = dataExpr\n ? `ctx.mergeScope(${scopeVar}, ${dataExpr})`\n : scopeVar\n return `ctx.renderTemplate(__templates, ${isExpr}, ${scopeExpr}, ctx)`\n }\n\n private renderElement(\n node: RenderElementNode,\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n options: RenderElementOptions = {},\n ): string {\n const attribs = options.overrideAttribs ?? node.attribs ?? {}\n if (!options.skipFor) {\n const forInfo = extractFor(node.attribs ?? {})\n if (forInfo.expr) {\n const listExpression = buildExpression(parseInterpolations(forInfo.expr), scopeVar, wxsVar)\n const listExpr = `ctx.normalizeList(${listExpression})`\n const itemVar = forInfo.itemName\n const indexVar = forInfo.indexName\n const scopeExpr = `ctx.createScope(${scopeVar}, { ${itemVar}: ${itemVar}, ${indexVar}: ${indexVar} })`\n const itemRender = this.renderElement(\n node,\n '__scope',\n wxsVar,\n componentTags,\n { skipFor: true, overrideAttribs: forInfo.restAttribs },\n )\n const keyExpr = `ctx.key(${JSON.stringify(forInfo.key ?? '')}, ${itemVar}, ${indexVar}, ${scopeExpr}, ${wxsVar})`\n return `repeat(${listExpr}, (${itemVar}, ${indexVar}) => ${keyExpr}, (${itemVar}, ${indexVar}) => { const __scope = ${scopeExpr}; return ${itemRender}; })`\n }\n }\n\n const customTag = resolveComponentTagName(node.name ?? '', componentTags)\n const tagName = customTag ?? normalizeTagName(node.name ?? '')\n if (tagName === '#fragment') {\n return this.renderNodes(node.children ?? [], scopeVar, wxsVar, componentTags)\n }\n\n const attrs = renderAttributes(attribs, scopeVar, wxsVar, {\n skipControl: true,\n preferProperty: Boolean(customTag),\n })\n const childNodes = node.children ?? []\n const children = childNodes\n .map(child => `\\${${this.renderNode(child, scopeVar, wxsVar, componentTags)}}`)\n .join('')\n if (SELF_CLOSING_TAGS.has(tagName) && childNodes.length === 0) {\n return `html\\`<${tagName}${attrs} />\\``\n }\n return `html\\`<${tagName}${attrs}>${children}</${tagName}>\\``\n }\n}\n\nexport const renderer = new Renderer()\n"],"mappings":";;;;;AAqBA,IAAa,WAAb,MAAsB;CACpB,YACE,OACA,UACA,QACA,eACQ;EACR,MAAM,QAAkB,CAAC;EACzB,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;GACpD,MAAM,OAAO,MAAM;GACnB,IAAI,qBAAqB,IAAI,GAAG;IAC9B,MAAM,EAAE,UAAU,aAAa,KAAK,0BAClC,OACA,OACA,UACA,QACA,aACF;IACA,MAAM,KAAK,QAAQ;IACnB,QAAQ;IACR;GACF;GACA,MAAM,KAAK,KAAK,WAAW,MAAM,UAAU,QAAQ,aAAa,CAAC;EACnE;EAC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Aa,KAAK,cACtB,MACA,WACA,QACA,eACA;KAAE,SAAS;KAAM,iBAAiB,QAAQ;IAAY,CACxD;IAEA,OAAO,UAAU,SAAS,KAAK,QAAQ,IAAI,SAAS,OAAO,WADhC,KAAK,UAAU,QAAQ,OAAO,EAAE,EAAE,IAAI,QAAQ,IAAI,SAAS,IAAI,UAAU,IAAI,OAAO,GAC5C,KAAK,QAAQ,IAAI,SAAS,yBAAyB,UAAU,WAAW,WAAW;GACxJ;EACF;EAEA,MAAM,YAAY,wBAAwB,KAAK,QAAQ,IAAI,aAAa;EACxE,MAAM,UAAU,aAAa,iBAAiB,KAAK,QAAQ,EAAE;EAC7D,IAAI,YAAY,aACd,OAAO,KAAK,YAAY,KAAK,YAAY,CAAC,GAAG,UAAU,QAAQ,aAAa;EAG9E,MAAM,QAAQ,iBAAiB,SAAS,UAAU,QAAQ;GACxD,aAAa;GACb,gBAAgB,QAAQ,SAAS;EACnC,CAAC;EACD,MAAM,aAAa,KAAK,YAAY,CAAC;EACrC,MAAM,WAAW,WACd,KAAI,UAAS,MAAM,KAAK,WAAW,OAAO,UAAU,QAAQ,aAAa,EAAE,EAAE,CAAC,CAC9E,KAAK,EAAE;EACV,IAAI,kBAAkB,IAAI,OAAO,KAAK,WAAW,WAAW,GAC1D,OAAO,UAAU,UAAU,MAAM;EAEnC,OAAO,UAAU,UAAU,MAAM,GAAG,SAAS,IAAI,QAAQ;CAC3D;AACF;AAEA,MAAa,WAAW,IAAI,SAAS"}
1
+ {"version":3,"file":"renderer.mjs","names":[],"sources":["../../../src/compiler/wxml/renderer.ts"],"sourcesContent":["import type { RenderElementNode, RenderNode } from './types'\nimport { resolveNativeComponentPropertyAttributes } from '../../shared/nativeComponents'\nimport {\n hasControlAttribute,\n normalizeTagName,\n resolveControlAttributeValue,\n SELF_CLOSING_TAGS,\n} from '../../shared/wxml'\nimport {\n extractFor,\n isConditionalElement,\n renderAttributes,\n resolveComponentTagName,\n stripControlAttributes,\n} from './attributes'\nimport { buildExpression, buildTemplateDataExpression, parseInterpolations } from './interpolation'\n\ninterface RenderElementOptions {\n skipFor?: boolean\n overrideAttribs?: Record<string, string>\n}\n\nexport class Renderer {\n renderNodes(\n nodes: RenderNode[],\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n ): string {\n const parts: string[] = []\n for (let index = 0; index < nodes.length; index += 1) {\n const node = nodes[index]\n if (isConditionalElement(node)) {\n const { rendered, endIndex } = this.renderConditionalSequence(\n nodes,\n index,\n scopeVar,\n wxsVar,\n componentTags,\n )\n parts.push(rendered)\n index = endIndex\n continue\n }\n parts.push(this.renderNode(node, scopeVar, wxsVar, componentTags))\n }\n if (parts.length === 0) {\n return '\"\"'\n }\n if (parts.length === 1) {\n return parts[0]!\n }\n return `[${parts.join(', ')}]`\n }\n\n private renderConditionalSequence(\n nodes: RenderNode[],\n startIndex: number,\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n ): { rendered: string, endIndex: number } {\n const branches: Array<{ node: RenderElementNode, attribs: Record<string, string> }> = []\n let cursor = startIndex\n while (cursor < nodes.length) {\n const candidate = nodes[cursor]\n if (!isConditionalElement(candidate)) {\n break\n }\n const attribs = candidate.attribs!\n if (branches.length === 0 && !hasControlAttribute(attribs, 'if')) {\n break\n }\n if (branches.length > 0 && !hasControlAttribute(attribs, 'elif') && !hasControlAttribute(attribs, 'else')) {\n break\n }\n branches.push({ node: candidate, attribs })\n cursor += 1\n if (hasControlAttribute(attribs, 'else')) {\n break\n }\n }\n if (!branches.length) {\n const node = nodes[startIndex]\n if (!node) {\n return { rendered: '\"\"', endIndex: startIndex }\n }\n return { rendered: this.renderNode(node, scopeVar, wxsVar, componentTags), endIndex: startIndex }\n }\n let expr = '\"\"'\n for (let index = branches.length - 1; index >= 0; index -= 1) {\n const { node, attribs } = branches[index]!\n const cleanedAttribs = stripControlAttributes(attribs)\n if (hasControlAttribute(attribs, 'else')) {\n expr = this.renderElement(node, scopeVar, wxsVar, componentTags, { overrideAttribs: cleanedAttribs })\n continue\n }\n const conditionExpr = resolveControlAttributeValue(attribs, 'if')\n ?? resolveControlAttributeValue(attribs, 'elif')!\n const rendered = this.renderElement(node, scopeVar, wxsVar, componentTags, { overrideAttribs: cleanedAttribs })\n const condition = buildExpression(parseInterpolations(conditionExpr), scopeVar, wxsVar)\n expr = `(${condition} ? ${rendered} : ${expr})`\n }\n return { rendered: expr, endIndex: startIndex + branches.length - 1 }\n }\n\n private renderNode(\n node: RenderNode,\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n ): string {\n if (node.type === 'text') {\n const parts = parseInterpolations(node.data ?? '')\n return buildExpression(parts, scopeVar, wxsVar)\n }\n if (node.type === 'element') {\n return this.renderElement(node, scopeVar, wxsVar, componentTags)\n }\n return '\"\"'\n }\n\n private renderTemplateInvoke(\n node: RenderElementNode,\n scopeVar: string,\n wxsVar: string,\n overrideAttribs?: Record<string, string>,\n ): string {\n const attribs = overrideAttribs ?? node.attribs ?? {}\n const isExpr = buildExpression(parseInterpolations(attribs.is ?? ''), scopeVar, wxsVar)\n const dataExpr = attribs.data\n ? buildTemplateDataExpression(attribs.data, scopeVar, wxsVar)\n : undefined\n const scopeExpr = dataExpr\n ? `ctx.mergeScope(${scopeVar}, ${dataExpr})`\n : scopeVar\n return `ctx.renderTemplate(__templates, ${isExpr}, ${scopeExpr}, ctx)`\n }\n\n private renderElement(\n node: RenderElementNode,\n scopeVar: string,\n wxsVar: string,\n componentTags?: Record<string, string>,\n options: RenderElementOptions = {},\n ): string {\n const attribs = options.overrideAttribs ?? node.attribs ?? {}\n if (!options.skipFor) {\n const forInfo = extractFor(node.attribs ?? {})\n if (forInfo.expr) {\n const listExpression = buildExpression(parseInterpolations(forInfo.expr), scopeVar, wxsVar)\n const listExpr = `ctx.normalizeList(${listExpression})`\n const itemVar = forInfo.itemName\n const indexVar = forInfo.indexName\n const nestedScopeVar = scopeVar === 'scope'\n ? '__scope'\n : `${scopeVar}_nested`\n const scopeExpr = `ctx.createScope(${scopeVar}, { ${itemVar}: ${itemVar}, ${indexVar}: ${indexVar} })`\n const itemRender = this.renderElement(\n node,\n nestedScopeVar,\n wxsVar,\n componentTags,\n { skipFor: true, overrideAttribs: forInfo.restAttribs },\n )\n const keyExpr = `ctx.key(${JSON.stringify(forInfo.key ?? '')}, ${itemVar}, ${indexVar}, ${scopeExpr}, ${wxsVar})`\n return `repeat(${listExpr}, (${itemVar}, ${indexVar}) => ${keyExpr}, (${itemVar}, ${indexVar}) => { const ${nestedScopeVar} = ${scopeExpr}; return ${itemRender}; })`\n }\n }\n\n if (node.name === 'template' && attribs.is) {\n return this.renderTemplateInvoke(node, scopeVar, wxsVar, attribs)\n }\n\n const customTag = resolveComponentTagName(node.name ?? '', componentTags)\n const tagName = customTag ?? normalizeTagName(node.name ?? '')\n if (tagName === '#fragment') {\n return this.renderNodes(node.children ?? [], scopeVar, wxsVar, componentTags)\n }\n\n const attrs = renderAttributes(attribs, scopeVar, wxsVar, {\n skipControl: true,\n preferProperty: Boolean(customTag),\n propertyAttributes: customTag\n ? undefined\n : resolveNativeComponentPropertyAttributes(node.name ?? ''),\n })\n const childNodes = node.children ?? []\n const children = childNodes.length > 0\n ? `\\${${this.renderNodes(childNodes, scopeVar, wxsVar, componentTags)}}`\n : ''\n if (SELF_CLOSING_TAGS.has(tagName) && childNodes.length === 0) {\n return `html\\`<${tagName}${attrs} />\\``\n }\n return `html\\`<${tagName}${attrs}>${children}</${tagName}>\\``\n }\n}\n\nexport const renderer = new Renderer()\n"],"mappings":";;;;;;AAsBA,IAAa,WAAb,MAAsB;CACpB,YACE,OACA,UACA,QACA,eACQ;EACR,MAAM,QAAkB,CAAC;EACzB,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;GACpD,MAAM,OAAO,MAAM;GACnB,IAAI,qBAAqB,IAAI,GAAG;IAC9B,MAAM,EAAE,UAAU,aAAa,KAAK,0BAClC,OACA,OACA,UACA,QACA,aACF;IACA,M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AG_NAMES } from "../../shared/wxml.mjs";
2
3
  import { dirname, relative } from "pathe";
3
4
 
@@ -12,6 +13,10 @@ function collectSpecialNodes(nodes, context) {
12
13
  for (const node of nodes) {
13
14
  if (node.type === "element") {
14
15
  const name = node.name ?? "";
16
+ if (isKnownUnsupportedNativeComponent(name)) {
17
+ const warning = `[web] 小程序组件 <${name}> 尚未提供完整 Web 语义,当前使用兼容 DOM 降级 (from ${context.sourceId})`;
18
+ if (!context.warnings.includes(warning)) context.warnings.push(warning);
19
+ }
15
20
  if (name === "template" && node.attribs?.name) {
16
21
  context.templates.push({
17
22
  name: node.attribs.name,
@@ -74,7 +79,7 @@ function normalizeTemplatePath(pathname) {
74
79
  function toRelativeImport(from, target) {
75
80
  const rel = relative(dirname(from), target);
76
81
  if (!rel || rel.startsWith(".")) {
77
- const fallback = normalizeTemplatePath(target).split("/").pop() ?? "";
82
+ const fallback = normalizeTemplatePath(target).split("/").pop();
78
83
  return rel || `./${fallback}`;
79
84
  }
80
85
  return `./${rel}`;
@@ -1 +1 @@
1
- {"version":3,"file":"specialNodes.mjs","names":[],"sources":["../../../src/compiler/wxml/specialNodes.ts"],"sourcesContent":["import type {\n ImportEntry,\n IncludeEntry,\n RenderNode,\n TemplateDefinition,\n WxsEntry,\n} from './types'\n\nimport { dirname, relative } from 'pathe'\nimport { TEMPLATE_IMPORT_TAG_NAMES, TEMPLATE_INCLUDE_TAG_NAMES } from '../../shared/wxml'\n\nexport function shouldMarkWxsImport(pathname: string) {\n const lower = pathname.toLowerCase()\n if (lower.endsWith('.wxs') || lower.endsWith('.wxs.ts') || lower.endsWith('.wxs.js')) {\n return false\n }\n return lower.endsWith('.ts') || lower.endsWith('.js')\n}\n\ninterface CollectSpecialNodesContext {\n templates: TemplateDefinition[]\n includes: IncludeEntry[]\n imports: ImportEntry[]\n wxs: WxsEntry[]\n wxsModules: Map<string, string>\n warnings: string[]\n sourceId: string\n resolveTemplate: (raw: string) => string | undefined\n resolveWxs: (raw: string) => string | undefined\n}\n\nexport function collectSpecialNodes(nodes: RenderNode[], context: CollectSpecialNodesContext) {\n const renderable: RenderNode[] = []\n for (const node of nodes) {\n if (node.type === 'element') {\n const name = node.name ?? ''\n if (name === 'template' && node.attribs?.name) {\n context.templates.push({\n name: node.attribs.name,\n nodes: collectSpecialNodes(node.children ?? [], context),\n })\n continue\n }\n if (TEMPLATE_IMPORT_TAG_NAMES.includes(name) && node.attribs?.src) {\n const resolved = context.resolveTemplate(node.attribs.src)\n if (resolved) {\n context.imports.push({\n id: resolved,\n importName: `__wxml_import_${context.imports.length}`,\n })\n }\n else {\n context.warnings.push(`[web] 无法解析模板依赖: ${node.attribs.src} (from ${context.sourceId})`)\n }\n continue\n }\n if (TEMPLATE_INCLUDE_TAG_NAMES.includes(name) && node.attribs?.src) {\n const resolved = context.resolveTemplate(node.attribs.src)\n if (resolved) {\n context.includes.push({\n id: resolved,\n importName: `__wxml_include_${context.includes.length}`,\n })\n }\n else {\n context.warnings.push(`[web] 无法解析模板依赖: ${node.attribs.src} (from ${context.sourceId})`)\n }\n continue\n }\n if (name === 'wxs') {\n const moduleName = node.attribs?.module?.trim()\n if (moduleName) {\n const previousSource = context.wxsModules.get(moduleName)\n if (previousSource) {\n context.warnings.push(`[web] WXS 模块名重复: ${moduleName} (from ${context.sourceId})`)\n }\n context.wxsModules.set(moduleName, context.sourceId)\n if (node.attribs?.src) {\n const resolved = context.resolveWxs(node.attribs.src)\n if (resolved) {\n context.wxs.push({\n module: moduleName,\n kind: 'src',\n importName: `__wxs_${context.wxs.length}`,\n value: resolved,\n })\n }\n }\n else {\n const inlineCode = (node.children ?? [])\n .filter(child => child.type === 'text')\n .map(child => child.data ?? '')\n .join('')\n context.wxs.push({\n module: moduleName,\n kind: 'inline',\n importName: `__wxs_${context.wxs.length}`,\n value: inlineCode,\n })\n }\n }\n continue\n }\n if (node.children?.length) {\n node.children = collectSpecialNodes(node.children, context)\n }\n }\n renderable.push(node)\n }\n return renderable\n}\n\nexport function normalizeTemplatePath(pathname: string) {\n return pathname.split('\\\\').join('/')\n}\n\nexport function toRelativeImport(from: string, target: string) {\n const fromDir = dirname(from)\n const rel = relative(fromDir, target)\n if (!rel || rel.startsWith('.')) {\n const fallback = normalizeTemplatePath(target).split('/').pop() ?? ''\n return rel || `./${fallback}`\n }\n return `./${rel}`\n}\n"],"mappings":";;;;AAWA,SAAgB,oBAAoB,UAAkB;CACpD,MAAM,QAAQ,SAAS,YAAY;CACnC,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,SAAS,KAAK,MAAM,SAAS,SAAS,GACjF,OAAO;CAET,OAAO,MAAM,SAAS,KAAK,KAAK,MAAM,SAAS,KAAK;AACtD;AAcA,SAAgB,oBAAoB,OAAqB,SAAqC;CAC5F,MAAM,aAA2B,CAAC;CAClC,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,SAAS,WAAW;GAC3B,MAAM,OAAO,KAAK,QAAQ;GAC1B,IAAI,SAAS,cAAc,KAAK,SAAS,MAAM;IAC7C,QAAQ,UAAU,KAAK;KACrB,MAAM,KAAK,QAAQ;KACnB,OAAO,oBAAoB,KAAK,YAAY,CAAC,GAAG,OAAO;IACzD,CAAC;IACD;GACF;GACA,IAAI,0BAA0B,SAAS,IAAI,KAAK,KAAK,SAAS,KAAK;IACjE,MAAM,WAAW,QAAQ,gBAAgB,KAAK,QAAQ,GAAG;IACzD,IAAI,UACF,QAAQ,QAAQ,KAAK;KACnB,IAAI;KACJ,YAAY,iBAAiB,QAAQ,QAAQ;IAC/C,CAAC;SAGD,QAAQ,SAAS,KAAK,mBAAmB,KAAK,QAAQ,IAAI,SAAS,QAAQ,SAAS,EAAE;IAExF;GACF;GACA,IAAI,2BAA2B,SAAS,IAAI,KAAK,KAAK,SAAS,KAAK;IAClE,MAAM,WAAW,QAAQ,gBAAgB,KAAK,QAAQ,GAAG;IACzD,IAAI,UACF,QAAQ,SAAS,KAAK;KACpB,IAAI;KACJ,YAAY,kBAAkB,QAAQ,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ACnE,OAAO,OAAO,KAAK;CACrB;CACA,OAAO,KAAK;AACd"}
1
+ {"version":3,"file":"specialNodes.mjs","names":[],"sources":["../../../src/compiler/wxml/specialNodes.ts"],"sourcesContent":["import type {\n ImportEntry,\n IncludeEntry,\n RenderNode,\n TemplateDefinition,\n WxsEntry,\n} from './types'\n\nimport { dirname, relative } from 'pathe'\nimport { isKnownUnsupportedNativeComponent } from '../../shared/nativeComponents'\nimport { TEMPLATE_IMPORT_TAG_NAMES, TEMPLATE_INCLUDE_TAG_NAMES } from '../../shared/wxml'\n\nexport function shouldMarkWxsImport(pathname: string) {\n const lower = pathname.toLowerCase()\n if (lower.endsWith('.wxs') || lower.endsWith('.wxs.ts') || lower.endsWith('.wxs.js')) {\n return false\n }\n return lower.endsWith('.ts') || lower.endsWith('.js')\n}\n\ninterface CollectSpecialNodesContext {\n templates: TemplateDefinition[]\n includes: IncludeEntry[]\n imports: ImportEntry[]\n wxs: WxsEntry[]\n wxsModules: Map<string, string>\n warnings: string[]\n sourceId: string\n resolveTemplate: (raw: string) => string | undefined\n resolveWxs: (raw: string) => string | undefined\n}\n\nexport function collectSpecialNodes(nodes: RenderNode[], context: CollectSpecialNodesContext) {\n const renderable: RenderNode[] = []\n for (const node of nodes) {\n if (node.type === 'element') {\n const name = node.name ?? ''\n if (isKnownUnsupportedNativeComponent(name)) {\n const warning = `[web] 小程序组件 <${name}> 尚未提供完整 Web 语义,当前使用兼容 DOM 降级 (from ${context.sourceId})`\n if (!context.warnings.includes(warning)) {\n context.warnings.push(warning)\n }\n }\n if (name === 'template' && node.attribs?.name) {\n context.templates.push({\n name: node.attribs.name,\n nodes: collectSpecialNodes(node.children ?? [], context),\n })\n continue\n }\n if (TEMPLATE_IMPORT_TAG_NAMES.includes(name) && node.attribs?.src) {\n const resolved = context.resolveTemplate(node.attribs.src)\n if (resolved) {\n context.imports.push({\n id: resolved,\n importName: `__wxml_import_${context.imports.length}`,\n })\n }\n else {\n context.warnings.push(`[web] 无法解析模板依赖: ${node.attribs.src} (from ${context.sourceId})`)\n }\n continue\n }\n if (TEMPLATE_INCLUDE_TAG_NAMES.includes(name) && node.attribs?.src) {\n const resolved = context.resolveTemplate(node.attribs.src)\n if (resolved) {\n context.includes.push({\n id: resolved,\n importName: `__wxml_include_${context.includes.length}`,\n })\n }\n else {\n context.warnings.push(`[web] 无法解析模板依赖: ${node.attribs.src} (from ${context.sourceId})`)\n }\n continue\n }\n if (name === 'wxs') {\n const moduleName = node.attribs?.module?.trim()\n if (moduleName) {\n const previousSource = context.wxsModules.get(moduleName)\n if (previousSource) {\n context.warnings.push(`[web] WXS 模块名重复: ${moduleName} (from ${context.sourceId})`)\n }\n context.wxsModules.set(moduleName, context.sourceId)\n if (node.attribs?.src) {\n const resolved = context.resolveWxs(node.attribs.src)\n if (resolved) {\n context.wxs.push({\n module: moduleName,\n kind: 'src',\n importName: `__wxs_${context.wxs.length}`,\n value: resolved,\n })\n }\n }\n else {\n const inlineCode = (node.children ?? [])\n .filter(child => child.type === 'text')\n .map(child => child.data ?? '')\n .join('')\n context.wxs.push({\n module: moduleName,\n kind: 'inline',\n importName: `__wxs_${context.wxs.length}`,\n value: inlineCode,\n })\n }\n }\n continue\n }\n if (node.children?.length) {\n node.children = collectSpecialNodes(node.children, context)\n }\n }\n renderable.push(node)\n }\n return renderable\n}\n\nexport function normalizeTemplatePath(pathname: string) {\n return pathname.split('\\\\').join('/')\n}\n\nexport function toRelativeImport(from: string, target: string) {\n const fromDir = dirname(from)\n const rel = relative(fromDir, target)\n if (!rel || rel.startsWith('.')) {\n const fallback = normalizeTemplatePath(target).split('/').pop()!\n return rel || `./${fallback}`\n }\n return `./${rel}`\n}\n"],"mappings":";;;;;AAYA,SAAgB,oBAAoB,UAAkB;CACpD,MAAM,QAAQ,SAAS,YAAY;CACnC,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,SAAS,KAAK,MAAM,SAAS,SAAS,GACjF,OAAO;CAET,OAAO,MAAM,SAAS,KAAK,K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GACf,QAAQ,SAAS,KAAK,oBAAoB,WAAW,SAAS,QAAQ,SAAS,EAAE;KAEnF,QAAQ,WAAW,IAAI,YAAY,QAAQ,QAAQ;KACnD,IAAI,KAAK,SAAS,KAAK;MACrB,MAAM,WAAW,QAAQ,WAAW,KAAK,QAAQ,GAAG;MACpD,IAAI,UACF,QAAQ,IAAI,KAAK;OACf,QAAQ;OACR,MAAM;OACN,YAAY,SAAS,QAAQ,IAAI;OACjC,OAAO;MACT,CAAC;KAEL,OACK;MACH,MAAM,cAAc,KAAK,YAAY,CAAC,EAAC,CACpC,QAAO,UAAS,MAAM,SAAS,MAAM,CAAC,CACtC,KAAI,UAAS,MAAM,QAAQ,EAAE,CAAC,CAC9B,KAAK,EAAE;MACV,QAAQ,IAAI,KAAK;OACf,QAAQ;OACR,MAAM;OACN,YAAY,SAAS,QAAQ,IAAI;OACjC,OAAO;MACT,CAAC;KACH;IACF;IACA;GACF;GACA,IAAI,KAAK,UAAU,QACjB,KAAK,WAAW,oBAAoB,KAAK,UAAU,OAAO;EAE9D;EACA,WAAW,KAAK,IAAI;CACtB;CACA,OAAO;AACT;AAEA,SAAgB,sBAAsB,UAAkB;CACtD,OAAO,SAAS,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG;AACtC;AAEA,SAAgB,iBAAiB,MAAc,QAAgB;CAE7D,MAAM,MAAM,SADI,QAAQ,IACG,GAAG,MAAM;CACpC,IAAI,CAAC,OAAO,IAAI,WAAW,GAAG,GAAG;EAC/B,MAAM,WAAW,sBAAsB,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI;EAC9D,OAAO,OAAO,KAAK;CACrB;CACA,OAAO,KAAK;AACd"}
@@ -0,0 +1,12 @@
1
+ //#region src/compiler/wxml/types.d.ts
2
+ interface NavigationBarConfig {
3
+ title?: string;
4
+ backgroundColor?: string;
5
+ textStyle?: string;
6
+ frontColor?: string;
7
+ loading?: boolean;
8
+ navigationStyle?: string;
9
+ }
10
+ //#endregion
11
+ export { NavigationBarConfig };
12
+ //# sourceMappingURL=types.d.mts.map
@@ -1,7 +1,7 @@
1
1
  //#region src/compiler/wxs.ts
2
2
  const REQUIRE_RE = /require\(\s*['"]([^'"]+)['"]\s*\)/g;
3
3
  function normalizePath(p) {
4
- return p.split("\\\\").join("/");
4
+ return p.replace(/\\/g, "/");
5
5
  }
6
6
  function isPlainWxsScript(pathname) {
7
7
  const lower = pathname.toLowerCase();
@@ -60,9 +60,9 @@ function transformWxsToEsm(code, id, options) {
60
60
  ` }`,
61
61
  ` return undefined`,
62
62
  `}`
63
- ].join("\\n");
64
- const moduleInit = `const module = { exports: {} }\\nconst exports = module.exports`;
65
- const helpers = `const getRegExp = (pattern, flags) => new RegExp(pattern, flags)\\nconst getDate = (value) => (value == null ? new Date() : new Date(value))`;
63
+ ].join("\n");
64
+ const moduleInit = `const module = { exports: {} }\nconst exports = module.exports`;
65
+ const helpers = `const getRegExp = (pattern, flags) => new RegExp(pattern, flags)\nconst getDate = (value) => (value == null ? new Date() : new Date(value))`;
66
66
  return {
67
67
  code: [
68
68
  ...importLines,
@@ -72,7 +72,7 @@ function transformWxsToEsm(code, id, options) {
72
72
  helpers,
73
73
  code,
74
74
  `export default module.exports`
75
- ].join("\\n"),
75
+ ].join("\n"),
76
76
  dependencies,
77
77
  warnings: warnings.length > 0 ? warnings : void 0
78
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"wxs.mjs","names":[],"sources":["../../src/compiler/wxs.ts"],"sourcesContent":["export interface WxsTransformResult {\n code: string\n dependencies: string[]\n warnings?: string[]\n}\n\nexport interface WxsTransformOptions {\n resolvePath: (request: string, importer: string) => string | undefined\n toImportPath?: (resolved: string, importer: string) => string\n}\n\nconst REQUIRE_RE = /require\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g\n\nfunction normalizePath(p: string) {\n return p.split('\\\\\\\\').join('/')\n}\n\nfunction isPlainWxsScript(pathname: string) {\n const lower = pathname.toLowerCase()\n if (lower.endsWith('.wxs') || lower.endsWith('.wxs.ts') || lower.endsWith('.wxs.js')) {\n return false\n }\n return lower.endsWith('.ts') || lower.endsWith('.js')\n}\n\nfunction appendWxsQuery(pathname: string) {\n if (pathname.includes('?wxs') || pathname.includes('&wxs')) {\n return pathname\n }\n return `${pathname}${pathname.includes('?') ? '&' : '?'}wxs`\n}\n\nfunction isSupportedRequirePath(request: string) {\n const normalized = request.replace(/\\\\/g, '/')\n return normalized.startsWith('.') || normalized.startsWith('/')\n}\n\nexport function transformWxsToEsm(code: string, id: string, options: WxsTransformOptions): WxsTransformResult {\n const dependencies: string[] = []\n const importLines: string[] = []\n const mapEntries: string[] = []\n const warnings: string[] = []\n\n const seen = new Set<string>()\n while (true) {\n const match = REQUIRE_RE.exec(code)\n if (!match) {\n break\n }\n const request = match[1]\n if (!request || seen.has(request)) {\n continue\n }\n seen.add(request)\n if (!isSupportedRequirePath(request)) {\n warnings.push(`[@weapp-vite/web] WXS require 仅支持相对或绝对路径: ${request} (from ${id})`)\n continue\n }\n const normalizedRequest = request.replace(/\\\\/g, '/')\n const resolved = options.resolvePath(normalizedRequest, id)\n if (!resolved) {\n warnings.push(`[@weapp-vite/web] 无法解析 WXS require: ${request} (from ${id})`)\n continue\n }\n let importPath = normalizePath(options.toImportPath?.(resolved, id) ?? resolved)\n if (isPlainWxsScript(resolved)) {\n importPath = appendWxsQuery(importPath)\n }\n const importName = `__wxs_dep_${dependencies.length}`\n importLines.push(`import ${importName} from '${importPath}'`)\n mapEntries.push(`[${JSON.stringify(request)}, ${importName}]`)\n dependencies.push(resolved)\n }\n\n const requireMap = `const __wxs_require_map = new Map([${mapEntries.join(', ')}])`\n const requireFn = [\n `const __wxs_require_warned = new Set()`,\n `function require(id) {`,\n ` if (__wxs_require_map.has(id)) {`,\n ` return __wxs_require_map.get(id)`,\n ` }`,\n ` if (!__wxs_require_warned.has(id)) {`,\n ` __wxs_require_warned.add(id)`,\n ` if (typeof console !== 'undefined' && typeof console.warn === 'function') {`,\n ` console.warn(\\`[@weapp-vite/web] WXS require 未解析: \\${id}\\`)`,\n ` }`,\n ` }`,\n ` return undefined`,\n `}`,\n ].join('\\\\n')\n const moduleInit = `const module = { exports: {} }\\\\nconst exports = module.exports`\n const helpers = `const getRegExp = (pattern, flags) => new RegExp(pattern, flags)\\\\nconst getDate = (value) => (value == null ? new Date() : new Date(value))`\n\n const body = [\n ...importLines,\n requireMap,\n requireFn,\n moduleInit,\n helpers,\n code,\n `export default module.exports`,\n ].join('\\\\n')\n\n return {\n code: body,\n dependencies,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n}\n"],"mappings":";AAWA,MAAM,aAAa;AAEnB,SAAS,cAAc,GAAW;CAChC,OAAO,EAAE,MAAM,MAAM,CAAC,CAAC,KAAK,GAAG;AACjC;AAEA,SAAS,iBAAiB,UAAkB;CAC1C,MAAM,QAAQ,SAAS,YAAY;CACnC,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,SAAS,KAAK,MAAM,SAAS,SAAS,GACjF,OAAO;CAET,OAAO,MAAM,SAAS,KAAK,KAAK,MAAM,SAAS,KAAK;AACtD;AAEA,SAAS,eAAe,UAAkB;CACxC,IAAI,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GACvD,OAAO;CAET,OAAO,GAAG,WAAW,SAAS,SAAS,GAAG,IAAI,MAAM,IAAI;AAC1D;AAEA,SAAS,uBAAuB,SAAiB;CAC/C,MAAM,aAAa,QAAQ,QAAQ,OAAO,GAAG;CAC7C,OAAO,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG;AAChE;AAEA,SAAgB,kBAAkB,MAAc,IAAY,SAAkD;CAC5G,MAAM,eAAyB,CAAC;CAChC,MAAM,cAAwB,CAAC;CAC/B,MAAM,aAAuB,CAAC;CAC9B,MAAM,WAAqB,CAAC;CAE5B,MAAM,uBAAO,IAAI,IAAY;CAC7B,OAAO,MAAM;EACX,MAAM,QAAQ,WAAW,KAAK,IAAI;EAClC,IAAI,CAAC,OACH;EAEF,MAAM,UAAU,MAAM;EACtB,IAAI,CAAC,WAAW,KAAK,IAAI,OAAO,GAC9B;EAEF,KAAK,IAAI,OAAO;EAChB,IAAI,CAAC,uBAAuB,OAAO,GAAG;GACpC,SAAS,KAAK,6CAA6C,QAAQ,SAAS,GAAG,EAAE;GACjF;EACF;EACA,MAAM,oBAAoB,QAAQ,QAAQ,OAAO,GAAG;EACpD,MAAM,WAAW,QAAQ,YAAY,mBAAmB,EAAE;EAC1D,IAAI,CAAC,UAAU;GACb,SAAS,KAAK,uCAAuC,QAAQ,SAAS,GAAG,EAAE;GAC3E;EACF;EACA,IAAI,aAAa,cAAc,QAAQ,eAAe,UAAU,EAAE,KAAK,QAAQ;EAC/E,IAAI,iBAAiB,QAAQ,GAC3B,aAAa,eAAe,UAAU;EAExC,MAAM,aAAa,aAAa,aAAa;EAC7C,YAAY,KAAK,UAAU,WAAW,SAAS,WAAW,EAAE;EAC5D,WAAW,KAAK,IAAI,KAAK,UAAU,OAAO,EAAE,IAAI,WAAW,EAAE;EAC7D,aAAa,KAAK,QAAQ;CAC5B;CAEA,MAAM,aAAa,sCAAsC,WAAW,KAAK,IAAI,EAAE;CAC/E,MAAM,YAAY;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,KAAK;CACZ,MAAM,aAAa;CACnB,MAAM,UAAU;CAYhB,OAAO;EACL,MAXW;GACX,GAAG;GACH;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,CAAC,KAAK,KAGI;EACT;EACA,UAAU,SAAS,SAAS,IAAI,WAAW;CAC7C;AACF"}
1
+ {"version":3,"file":"wxs.mjs","names":[],"sources":["../../src/compiler/wxs.ts"],"sourcesContent":["export interface WxsTransformResult {\n code: string\n dependencies: string[]\n warnings?: string[]\n}\n\nexport interface WxsTransformOptions {\n resolvePath: (request: string, importer: string) => string | undefined\n toImportPath?: (resolved: string, importer: string) => string\n}\n\nconst REQUIRE_RE = /require\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g\n\nfunction normalizePath(p: string) {\n return p.replace(/\\\\/g, '/')\n}\n\nfunction isPlainWxsScript(pathname: string) {\n const lower = pathname.toLowerCase()\n if (lower.endsWith('.wxs') || lower.endsWith('.wxs.ts') || lower.endsWith('.wxs.js')) {\n return false\n }\n return lower.endsWith('.ts') || lower.endsWith('.js')\n}\n\nfunction appendWxsQuery(pathname: string) {\n if (pathname.includes('?wxs') || pathname.includes('&wxs')) {\n return pathname\n }\n return `${pathname}${pathname.includes('?') ? '&' : '?'}wxs`\n}\n\nfunction isSupportedRequirePath(request: string) {\n const normalized = request.replace(/\\\\/g, '/')\n return normalized.startsWith('.') || normalized.startsWith('/')\n}\n\nexport function transformWxsToEsm(code: string, id: string, options: WxsTransformOptions): WxsTransformResult {\n const dependencies: string[] = []\n const importLines: string[] = []\n const mapEntries: string[] = []\n const warnings: string[] = []\n\n const seen = new Set<string>()\n while (true) {\n const match = REQUIRE_RE.exec(code)\n if (!match) {\n break\n }\n const request = match[1]\n if (!request || seen.has(request)) {\n continue\n }\n seen.add(request)\n if (!isSupportedRequirePath(request)) {\n warnings.push(`[@weapp-vite/web] WXS require 仅支持相对或绝对路径: ${request} (from ${id})`)\n continue\n }\n const normalizedRequest = request.replace(/\\\\/g, '/')\n const resolved = options.resolvePath(normalizedRequest, id)\n if (!resolved) {\n warnings.push(`[@weapp-vite/web] 无法解析 WXS require: ${request} (from ${id})`)\n continue\n }\n let importPath = normalizePath(options.toImportPath?.(resolved, id) ?? resolved)\n if (isPlainWxsScript(resolved)) {\n importPath = appendWxsQuery(importPath)\n }\n const importName = `__wxs_dep_${dependencies.length}`\n importLines.push(`import ${importName} from '${importPath}'`)\n mapEntries.push(`[${JSON.stringify(request)}, ${importName}]`)\n dependencies.push(resolved)\n }\n\n const requireMap = `const __wxs_require_map = new Map([${mapEntries.join(', ')}])`\n const requireFn = [\n `const __wxs_require_warned = new Set()`,\n `function require(id) {`,\n ` if (__wxs_require_map.has(id)) {`,\n ` return __wxs_require_map.get(id)`,\n ` }`,\n ` if (!__wxs_require_warned.has(id)) {`,\n ` __wxs_require_warned.add(id)`,\n ` if (typeof console !== 'undefined' && typeof console.warn === 'function') {`,\n ` console.warn(\\`[@weapp-vite/web] WXS require 未解析: \\${id}\\`)`,\n ` }`,\n ` }`,\n ` return undefined`,\n `}`,\n ].join('\\n')\n const moduleInit = `const module = { exports: {} }\\nconst exports = module.exports`\n const helpers = `const getRegExp = (pattern, flags) => new RegExp(pattern, flags)\\nconst getDate = (value) => (value == null ? new Date() : new Date(value))`\n\n const body = [\n ...importLines,\n requireMap,\n requireFn,\n moduleInit,\n helpers,\n code,\n `export default module.exports`,\n ].join('\\n')\n\n return {\n code: body,\n dependencies,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n}\n"],"mappings":";AAWA,MAAM,aAAa;AAEnB,SAAS,cAAc,GAAW;CAChC,OAAO,EAAE,QAAQ,OAAO,GAAG;AAC7B;AAEA,SAAS,iBAAiB,UAAkB;CAC1C,MAAM,QAAQ,SAAS,YAAY;CACnC,IAAI,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,SAAS,KAAK,MAAM,SAAS,SAAS,GACjF,OAAO;CAET,OAAO,MAAM,SAAS,KAAK,KAAK,MAAM,SAAS,KAAK;AACtD;AAEA,SAAS,eAAe,UAAkB;CACxC,IAAI,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GACvD,OAAO;CAET,OAAO,GAAG,WAAW,SAAS,SAAS,GAAG,IAAI,MAAM,IAAI;AAC1D;AAEA,SAAS,uBAAuB,SAAiB;CAC/C,MAAM,aAAa,QAAQ,QAAQ,OAAO,GAAG;CAC7C,OAAO,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG;AAChE;AAEA,SAAgB,kBAAkB,MAAc,IAAY,SAAkD;CAC5G,MAAM,eAAyB,CAAC;CAChC,MAAM,cAAwB,CAAC;CAC/B,MAAM,aAA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  interface WxssTransformOptions {
3
4
  /**
package/dist/css/wxss.mjs CHANGED
@@ -1,17 +1,118 @@
1
+ import { resolveNativeComponentWebTag } from "../shared/nativeComponents.mjs";
2
+ import postcss from "postcss";
3
+ import selectorParser from "postcss-selector-parser";
4
+
1
5
  //#region src/css/wxss.ts
2
6
  const RPX_RE = /(-?(?:\d+(?:\.\d+)?|\.\d+))rpx/gi;
3
- function transformWxssToCss(source, options) {
7
+ const SAFE_AREA_ENV_RE = /env\(\s*safe-area-inset-(top|right|bottom|left)(?:\s*,[^)]*)?\)/gi;
8
+ function isDeepPseudo(pseudo) {
9
+ return pseudo.value === ":deep" || pseudo.value === "::v-deep";
10
+ }
11
+ function flattenDeepPseudos(selector) {
12
+ selector.walkPseudos((pseudo) => {
13
+ if (!isDeepPseudo(pseudo)) return;
14
+ const nestedSelector = pseudo.nodes?.[0];
15
+ if (nestedSelector && nestedSelector.nodes.length > 0) {
16
+ pseudo.replaceWith(...nestedSelector.nodes.map((node) => node.clone()));
17
+ return;
18
+ }
19
+ pseudo.remove();
20
+ });
21
+ }
22
+ function transformNativeTags(selector) {
23
+ selector.walkTags((tag) => {
24
+ if (tag.parent?.type === "selector" && tag.parent.parent?.type === "pseudo" && tag.parent.parent.value === "::part") return;
25
+ if (tag.value === "page") {
26
+ tag.replaceWith(selectorParser.pseudo({ value: ":host" }));
27
+ return;
28
+ }
29
+ const webTag = resolveNativeComponentWebTag(tag.value);
30
+ if (webTag) tag.value = webTag;
31
+ });
32
+ }
33
+ function createPartPseudo(className) {
34
+ return selectorParser.pseudo({
35
+ value: "::part",
36
+ nodes: [selectorParser.selector({
37
+ value: "",
38
+ nodes: [selectorParser.tag({ value: className })]
39
+ })]
40
+ });
41
+ }
42
+ function createVirtualHostPartSelector(source) {
43
+ const selector = source.clone();
44
+ let deepPseudo;
45
+ selector.walkPseudos((pseudo) => {
46
+ if (!deepPseudo && isDeepPseudo(pseudo)) deepPseudo = pseudo;
47
+ });
48
+ if (!deepPseudo || deepPseudo.parent?.type !== "selector") return;
49
+ const parent = deepPseudo.parent;
50
+ const pseudoIndex = parent.nodes.indexOf(deepPseudo);
51
+ const nestedNodes = deepPseudo.nodes?.[0]?.nodes ?? [];
52
+ const nestedTargetClass = nestedNodes.find((node) => node.type === "class")?.value;
53
+ let targetStart = pseudoIndex;
54
+ if (nestedNodes.length > 0) deepPseudo.replaceWith(...nestedNodes.map((node) => node.clone()));
55
+ else {
56
+ deepPseudo.remove();
57
+ while (parent.nodes[targetStart]?.type === "combinator") targetStart += 1;
58
+ }
59
+ let targetEnd = targetStart;
60
+ while (targetEnd + 1 < parent.nodes.length && parent.nodes[targetEnd + 1]?.type !== "combinator") targetEnd += 1;
61
+ if (targetStart >= parent.nodes.length || targetEnd < parent.nodes.length - 1) return;
62
+ const targetNodes = parent.nodes.slice(targetStart, targetEnd + 1);
63
+ const targetClass = nestedTargetClass ?? targetNodes.find((node) => node.type === "class")?.value;
64
+ const targetNode = parent.nodes[targetEnd];
65
+ if (!targetClass) return;
66
+ const firstTargetPseudo = targetNodes.find((node) => node.type === "pseudo");
67
+ if (firstTargetPseudo?.value.startsWith(":") && !firstTargetPseudo.value.startsWith("::")) return;
68
+ if (firstTargetPseudo) parent.insertBefore(firstTargetPseudo, createPartPseudo(targetClass));
69
+ else parent.insertAfter(targetNode, createPartPseudo(targetClass));
70
+ flattenDeepPseudos(selector);
71
+ transformNativeTags(selector);
72
+ return selector;
73
+ }
74
+ function transformWxssSelector(selector) {
75
+ const root = selectorParser().astSync(selector);
76
+ const output = [];
77
+ for (const sourceSelector of root.nodes) {
78
+ const partSelector = createVirtualHostPartSelector(sourceSelector);
79
+ const flatSelector = sourceSelector.clone();
80
+ flattenDeepPseudos(flatSelector);
81
+ transformNativeTags(flatSelector);
82
+ output.push(flatSelector.toString());
83
+ if (partSelector) output.push(partSelector.toString());
84
+ }
85
+ return output.join(",\n");
86
+ }
87
+ function transformWxssRoot(root, options) {
4
88
  const rpxVar = options?.rpxVar ?? "--rpx";
5
- const useVariable = typeof options?.designWidth === "number" && Number.isFinite(options.designWidth);
89
+ const useVariable = options?.pxPerRpx === void 0 || typeof options.designWidth === "number" && Number.isFinite(options.designWidth);
6
90
  const ratio = options?.pxPerRpx ?? .5;
7
- return { css: source.replace(RPX_RE, (_, value) => {
8
- const numeric = Number.parseFloat(value);
9
- if (Number.isNaN(numeric)) return `${value}px`;
10
- if (useVariable) return `calc(var(${rpxVar}) * ${numeric})`;
11
- return `${Math.round(numeric * ratio * 1e3) / 1e3}px`;
12
- }) };
91
+ root.walkRules((rule) => {
92
+ if (rule.selector) rule.selector = transformWxssSelector(rule.selector);
93
+ });
94
+ root.walkDecls((declaration) => {
95
+ declaration.value = declaration.value.replace(SAFE_AREA_ENV_RE, (_, side) => `var(--weapp-safe-area-inset-${side})`).replace(RPX_RE, (_, value) => {
96
+ const numeric = Number.parseFloat(value);
97
+ if (useVariable) return `calc(var(${rpxVar}) * ${numeric})`;
98
+ return `${Math.round(numeric * ratio * 1e3) / 1e3}px`;
99
+ });
100
+ });
101
+ }
102
+ function createWxssPostcssPlugin(options) {
103
+ return {
104
+ postcssPlugin: "weapp-vite-web-wxss",
105
+ Once(root) {
106
+ transformWxssRoot(root, options);
107
+ }
108
+ };
109
+ }
110
+ function transformWxssToCss(source, options) {
111
+ const root = postcss.parse(source);
112
+ transformWxssRoot(root, options);
113
+ return { css: root.toString() };
13
114
  }
14
115
 
15
116
  //#endregion
16
- export { transformWxssToCss };
117
+ export { createWxssPostcssPlugin, transformWxssToCss };
17
118
  //# sourceMappingURL=wxss.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"wxss.mjs","names":[],"sources":["../../src/css/wxss.ts"],"sourcesContent":["export interface WxssTransformOptions {\n /**\n * 1rpx 对应的 CSS 像素数。\n * 默认值近似于 750rpx 设计稿在 375px 屏幕上的换算。\n */\n pxPerRpx?: number\n /**\n * rpx 换算的设计宽度。传入后会把 rpx 转为\n * `calc(var(--rpx) * N)` 以实现响应式缩放。\n */\n designWidth?: number\n /**\n * 用于存储运行时 rpx 大小的 CSS 变量名。\n * @default \"--rpx\"\n */\n rpxVar?: string\n}\n\nexport interface WxssTransformResult {\n css: string\n}\n\nconst RPX_RE = /(-?(?:\\d+(?:\\.\\d+)?|\\.\\d+))rpx/gi\n\nexport function transformWxssToCss(source: string, options?: WxssTransformOptions): WxssTransformResult {\n const rpxVar = options?.rpxVar ?? '--rpx'\n const useVariable = typeof options?.designWidth === 'number' && Number.isFinite(options.designWidth)\n const ratio = options?.pxPerRpx ?? 0.5\n const css = source.replace(RPX_RE, (_, value: string) => {\n const numeric = Number.parseFloat(value)\n if (Number.isNaN(numeric)) {\n return `${value}px`\n }\n if (useVariable) {\n return `calc(var(${rpxVar}) * ${numeric})`\n }\n const converted = Math.round(numeric * ratio * 1000) / 1000\n return `${converted}px`\n })\n return {\n css,\n }\n}\n"],"mappings":";AAsBA,MAAM,SAAS;AAEf,SAAgB,mBAAmB,QAAgB,SAAqD;CACtG,MAAM,SAAS,SAAS,UAAU;CAClC,MAAM,cAAc,OAAO,SAAS,gBAAgB,YAAY,OAAO,SAAS,QAAQ,WAAW;CACnG,MAAM,QAAQ,SAAS,YAAY;CAYnC,OAAO,EACL,KAZU,OAAO,QAAQ,SAAS,GAAG,UAAkB;EACvD,MAAM,UAAU,OAAO,WAAW,KAAK;EACvC,IAAI,OAAO,MAAM,OAAO,GACtB,OAAO,GAAG,MAAM;EAElB,IAAI,aACF,OAAO,YAAY,OAAO,MAAM,QAAQ;EAG1C,OAAO,GADW,KAAK,MAAM,UAAU,QAAQ,GAAI,IAAI,IACnC;CACtB,CAEI,EACJ;AACF"}
1
+ {"version":3,"file":"wxss.mjs","names":[],"sources":["../../src/css/wxss.ts"],"sourcesContent":["import postcss from 'postcss'\nimport selectorParser from 'postcss-selector-parser'\nimport { resolveNativeComponentWebTag } from '../shared/nativeComponents'\n\nexport interface WxssTransformOptions {\n /**\n * 1rpx 对应的 CSS 像素数。\n * 默认值近似于 750rpx 设计稿在 375px 屏幕上的换算。\n */\n pxPerRpx?: number\n /**\n * rpx 换算的设计宽度。传入后会把 rpx 转为\n * `calc(var(--rpx) * N)` 以实现响应式缩放。\n */\n designWidth?: number\n /**\n * 用于存储运行时 rpx 大小的 CSS 变量名。\n * @default \"--rpx\"\n */\n rpxVar?: string\n}\n\nexport interface WxssTransformResult {\n css: string\n}\n\nconst RPX_RE = /(-?(?:\\d+(?:\\.\\d+)?|\\.\\d+))rpx/gi\nconst SAFE_AREA_ENV_RE = /env\\(\\s*safe-area-inset-(top|right|bottom|left)(?:\\s*,[^)]*)?\\)/gi\n\nfunction isDeepPseudo(pseudo: selectorParser.Pseudo) {\n return pseudo.value === ':deep' || pseudo.value === '::v-deep'\n}\n\nfunction flattenDeepPseudos(selector: selectorParser.Selector) {\n selector.walkPseudos((pseudo) => {\n if (!isDeepPseudo(pseudo)) {\n return\n }\n const nestedSelector = pseudo.nodes?.[0]\n if (nestedSelector && nestedSelector.nodes.length > 0) {\n pseudo.replaceWith(...nestedSelector.nodes.map(node => node.clone()))\n return\n }\n pseudo.remove()\n })\n}\n\nfunction transformNativeTags(selector: selectorParser.Selector) {\n selector.walkTags((tag) => {\n if (tag.parent?.type === 'selector' && tag.parent.parent?.type === 'pseudo' && tag.parent.parent.value === '::part') {\n return\n }\n if (tag.value === 'page') {\n tag.replaceWith(selectorParser.pseudo({ value: ':host' }))\n return\n }\n const webTag = resolveNativeComponentWebTag(tag.value)\n if (webTag) {\n tag.value = webTag\n }\n })\n}\n\nfunction createPartPseudo(className: string) {\n return selectorParser.pseudo({\n value: '::part',\n nodes: [selectorParser.selector({\n value: '',\n nodes: [selectorParser.tag({ value: className })],\n })],\n })\n}\n\nfunction createVirtualHostPartSelector(source: selectorParser.Selector) {\n const selector = source.clone()\n let deepPseudo: selectorParser.Pseudo | undefined\n selector.walkPseudos((pseudo) => {\n if (!deepPseudo && isDeepPseudo(pseudo)) {\n deepPseudo = pseudo\n }\n })\n if (!deepPseudo || deepPseudo.parent?.type !== 'selector') {\n return undefined\n }\n\n const parent = deepPseudo.parent\n const pseudoIndex = parent.nodes.indexOf(deepPseudo)\n const nestedNodes = deepPseudo.nodes?.[0]?.nodes ?? []\n const nestedTargetClass = nestedNodes.find(node => node.type === 'class')?.value\n let targetStart = pseudoIndex\n if (nestedNodes.length > 0) {\n deepPseudo.replaceWith(...nestedNodes.map(node => node.clone()))\n }\n else {\n deepPseudo.remove()\n while (parent.nodes[targetStart]?.type === 'combinator') {\n targetStart += 1\n }\n }\n\n let targetEnd = targetStart\n while (targetEnd + 1 < parent.nodes.length && parent.nodes[targetEnd + 1]?.type !== 'combinator') {\n targetEnd += 1\n }\n if (targetStart >= parent.nodes.length || targetEnd < parent.nodes.length - 1) {\n return undefined\n }\n\n const targetNodes = parent.nodes.slice(targetStart, targetEnd + 1)\n const targetClass = nestedTargetClass\n ?? targetNodes.find(node => node.type === 'class')?.value\n const targetNode = parent.nodes[targetEnd]!\n if (!targetClass) {\n return undefined\n }\n\n const firstTargetPseudo = targetNodes.find(node => node.type === 'pseudo')\n if (firstTargetPseudo?.value.startsWith(':') && !firstTargetPseudo.value.startsWith('::')) {\n return undefined\n }\n if (firstTargetPseudo) {\n parent.insertBefore(firstTargetPseudo, createPartPseudo(targetClass))\n }\n else {\n parent.insertAfter(targetNode, createPartPseudo(targetClass))\n }\n flattenDeepPseudos(selector)\n transformNativeTags(selector)\n return selector\n}\n\nfunction transformWxssSelector(selector: string) {\n const root = selectorParser().astSync(selector)\n const output: string[] = []\n for (const sourceSelector of root.nodes) {\n const partSelector = createVirtualHostPartSelector(sourceSelector)\n const flatSelector = sourceSelector.clone()\n flattenDeepPseudos(flatSelector)\n transformNativeTags(flatSelector)\n output.push(flatSelector.toString())\n if (partSelector) {\n output.push(partSelector.toString())\n }\n }\n return output.join(',\\n')\n}\n\nfunction transformWxssRoot(root: postcss.Root, options?: WxssTransformOptions) {\n const rpxVar = options?.rpxVar ?? '--rpx'\n const useVariable = options?.pxPerRpx === undefined\n || (typeof options.designWidth === 'number' && Number.isFinite(options.designWidth))\n const ratio = options?.pxPerRpx ?? 0.5\n root.walkRules((rule) => {\n if (rule.selector) {\n rule.selector = transformWxssSelector(rule.selector)\n }\n })\n root.walkDecls((declaration) => {\n declaration.value = declaration.value\n .replace(\n SAFE_AREA_ENV_RE,\n (_, side: string) => `var(--weapp-safe-area-inset-${side})`,\n )\n .replace(RPX_RE, (_, value: string) => {\n const numeric = Number.parseFloat(value)\n if (useVariable) {\n return `calc(var(${rpxVar}) * ${numeric})`\n }\n const converted = Math.round(numeric * ratio * 1000) / 1000\n return `${converted}px`\n })\n })\n}\n\nexport function createWxssPostcssPlugin(options?: WxssTransformOptions) {\n return {\n postcssPlugin: 'weapp-vite-web-wxss',\n Once(root: postcss.Root) {\n transformWxssRoot(root, options)\n },\n }\n}\n\nexport function transformWxssToCss(source: string, options?: WxssTransformOptions): WxssTransformResult {\n const root = postcss.parse(source)\n transformWxssRoot(root, options)\n return {\n css: root.toString(),\n }\n}\n"],"mappings":";;;;;AA0BA,MAAM,SAAS;AACf,MAAM,mBAAmB;AAEzB,SAAS,aAAa,QAA+B;CACnD,OAAO,OAAO,UAAU,WAAW,OAAO,UAAU;AACtD;AAEA,SAAS,mBAAmB,UAAmC;CAC7D,SAAS,aAAa,WAAW;EAC/B,IAAI,CAAC,aAAa,MAAM,GACtB;EAEF,MAAM,iBAAiB,OAAO,QAAQ;EACtC,IAAI,kBAAkB,eAAe,MAAM,SAAS,GAAG;GACrD,OAAO,YAAY,GAAG,eAAe,MAAM,KAAI,SAAQ,KAAK,MAAM,CAAC,CAAC;GACpE;EACF;EACA,OAAO,OAAO;CAChB,CAAC;AACH;AAEA,SAAS,oBAAoB,UAAmC;CAC9D,SAAS,UAAU,QAAQ;EACzB,IAAI,IAAI,QAAQ,SAAS,cAAc,IAAI,OAAO,QAAQ,SAAS,YAAY,IAAI,OAAO,OAAO,UAAU,UACzG;EAEF,IAAI,IAAI,UAAU,QAAQ;GACxB,IAAI,YAAY,e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AAY,OAAO,MAAM,QAAQ;GAG1C,OAAO,GADW,KAAK,MAAM,UAAU,QAAQ,GAAI,IAAI,IACnC;EACtB,CAAC;CACL,CAAC;AACH;AAEA,SAAgB,wBAAwB,SAAgC;CACtE,OAAO;EACL,eAAe;EACf,KAAK,MAAoB;GACvB,kBAAkB,MAAM,OAAO;EACjC;CACF;AACF;AAEA,SAAgB,mBAAmB,QAAgB,SAAqD;CACtG,MAAM,OAAO,QAAQ,MAAM,MAAM;CACjC,kBAAkB,MAAM,OAAO;CAC/B,OAAO,EACL,KAAK,KAAK,SAAS,EACrB;AACF"}
package/dist/index.d.mts CHANGED
@@ -1,21 +1,44 @@
1
1
  import { transformWxssToCss } from "./css/wxss.mjs";
2
- import { WeappWebPluginOptions } from "./plugin/types.mjs";
3
- import { weappWebPlugin } from "./plugin/index.mjs";
4
- import "./plugin.mjs";
5
- import { ButtonFormConfig, ensureButtonDefined, setButtonFormConfig } from "./runtime/button/index.mjs";
6
2
  import { RenderContext, createRenderContext } from "./runtime/renderContext.mjs";
7
3
  import { createTemplate, renderTemplate } from "./runtime/legacyTemplate/index.mjs";
8
4
  import { TemplateRenderer, TemplateScope } from "./runtime/template.mjs";
9
5
  import { defineComponent } from "./runtime/component/index.mjs";
6
+ import { ResolvedWebRoutingConfig, WebRouteHistoryState, WebRouteTarget, WebRoutingConfig, WebRoutingMode, disposeWebRouting, getWebRoutingConfig, resolveWebRoutingConfig } from "./runtime/polyfill/routeRuntime/history.mjs";
7
+ import { WebPageHead, WebResourceHint, WebResourceHintRelation, WebResourceHintsConfig, WebRuntimeSeoConfig as WebSeoConfig, configureWebSeo, resetWebDocumentHead, setupWebResourceHints, syncWebDocumentHead, updateWebDocumentTitle } from "./runtime/seo/index.mjs";
8
+ import { WebTabBarConfig, WebTabBarItem } from "./shared/tabBar.mjs";
9
+ import { WeappWebPluginOptions } from "./plugin/types.mjs";
10
+ import { weappWebPlugin } from "./plugin/index.mjs";
11
+ import "./plugin.mjs";
12
+ import { ButtonFormConfig, ensureButtonDefined, setButtonFormConfig } from "./runtime/button/index.mjs";
10
13
  import { getRuntimeExecutionMode, setRuntimeExecutionMode } from "./runtime/execution.mjs";
14
+ import { WebRuntimeClipboard, WebRuntimeDialogs, WebRuntimeHost, WebRuntimeStorage } from "./runtime/host/types.mjs";
15
+ import { getRuntimeClipboard, getRuntimeDialogs, getRuntimeFetch, getRuntimeStorage, getWebRuntimeHost, openRuntimeUrl, resetWebRuntimeHost, setWebRuntimeHost } from "./runtime/host/index.mjs";
16
+ import { installWebHostGlobals } from "./runtime/hostGlobals.mjs";
17
+ import { resolveImageModeStyle } from "./runtime/nativeComponents/image.mjs";
18
+ import { createInputEventDetail } from "./runtime/nativeComponents/input.mjs";
19
+ import { createScrollEventDetail } from "./runtime/nativeComponents/scrollView.mjs";
20
+ import { createSwitchEventDetail } from "./runtime/nativeComponents/switch.mjs";
21
+ import { createTextareaLineChangeDetail } from "./runtime/nativeComponents/textarea.mjs";
22
+ import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./runtime/nativeComponents/video/helpers.mjs";
23
+ import { ensureNativeComponentsDefined } from "./runtime/nativeComponents/index.mjs";
11
24
  import { NavigationBarMetrics, setNavigationBarMetrics } from "./runtime/navigationBar/index.mjs";
25
+ import { setPageLayout } from "./runtime/pageLayout.mjs";
12
26
  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 "./runtime/polyfill/deviceAuthSystemApi.mjs";
27
+ import { ResolvedWebViewportConfig, WebViewportConfig } from "./runtime/viewport/types.mjs";
28
+ import { getWebViewportWidth, resolveWebViewportConfig, setupWebViewport } from "./runtime/viewport/index.mjs";
13
29
  import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./runtime/polyfill/routeRuntime.mjs";
14
30
  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 "./runtime/polyfill/runtimeDataApi.mjs";
15
- import { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showToast, updateShareMenu } from "./runtime/polyfill/uiMediaApi.mjs";
31
+ 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 "./runtime/polyfill/uiMediaApi.mjs";
16
32
  import { canIUse, createInterstitialAd, createRewardedVideoAd, getExtConfig, getExtConfigSync, getLogManager, getUpdateManager, hideNavigationBarLoading, reportAnalytics, setBackgroundColor, setBackgroundTextStyle, setNavigationBarColor, setNavigationBarTitle, showNavigationBarLoading } from "./runtime/polyfill/index.mjs";
17
33
  import { RpxConfig, setupRpx } from "./runtime/rpx.mjs";
18
34
  import { injectStyle, removeStyle } from "./runtime/style.mjs";
19
35
  import { RuntimeWarningLevel, RuntimeWarningOptions, setRuntimeWarningOptions } from "./runtime/warning.mjs";
36
+ import { installWebModuleRegistration, registerWebWevuApp, registerWebWevuComponent } from "./runtime/wevu.mjs";
20
37
  import "./runtime/index.mjs";
21
- export { type ButtonFormConfig, type NavigationBarMetrics, type RenderContext, type RpxConfig, type RuntimeWarningLevel, type RuntimeWarningOptions, type TemplateRenderer, type TemplateScope, type WeappWebPluginOptions, authorize, canIUse, checkSession, chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, clearStorage, clearStorageSync, compressImage, compressVideo, createCanvasContext, createInterstitialAd, createRenderContext, createRewardedVideoAd, createSelectorQuery, createTemplate, createVKSession, createVideoContext, createWorker, defineComponent, downloadFile, ensureButtonDefined, exitMiniProgram, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getClipboardData, getDeviceInfo, getEnterOptionsSync, getExtConfig, getExtConfigSync, getFileSystemManager, getFuzzyLocation, getImageInfo, getLaunchOptionsSync, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNetworkType, getRuntimeExecutionMode, getSetting, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserInfo, getUserProfile, getVideoInfo, getWindowInfo, hideKeyboard, hideLoading, hideNavigationBarLoading, hideTabBar, initializePageRoutes, injectStyle, loadSubPackage, login, makePhoneCall, navigateBack, navigateTo, navigateToMiniProgram, nextTick, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, removeStorage, removeStorageSync, removeStyle, renderTemplate, reportAnalytics, request, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setBackgroundColor, setBackgroundTextStyle, setButtonFormConfig, setClipboardData, setNavigationBarColor, setNavigationBarMetrics, setNavigationBarTitle, setRuntimeExecutionMode, setRuntimeWarningOptions, setStorage, setStorageSync, setupRpx, showActionSheet, showLoading, showModal, showNavigationBarLoading, showShareMenu, showTabBar, showToast, startPullDownRefresh, stopPullDownRefresh, switchTab, transformWxssToCss, updateShareMenu, uploadFile, vibrateShort, weappWebPlugin };
38
+ export * from "wevu/internal-runtime";
39
+ declare namespace index_d_exports {
40
+ export { ButtonFormConfig, NavigationBarMetrics, RenderContext, ResolvedWebRoutingConfig, ResolvedWebViewportConfig, RpxConfig, RuntimeWarningLevel, RuntimeWarningOptions, TemplateRenderer, TemplateScope, WeappWebPluginOptions, WebPageHead, WebResourceHint, WebResourceHintRelation, WebResourceHintsConfig, WebRouteHistoryState, WebRouteTarget, WebRoutingConfig, WebRoutingMode, WebRuntimeClipboard, WebRuntimeDialogs, WebRuntimeHost, WebRuntimeStorage, WebSeoConfig, WebTabBarConfig, WebTabBarItem, WebViewportConfig, authorize, 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, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openRuntimeUrl, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, registerWebWevuApp, registerWebWevuComponent, 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, transformWxssToCss, updateShareMenu, updateWebDocumentTitle, uploadFile, vibrateShort, weappWebPlugin };
41
+ }
42
+ //#endregion
43
+ export { type ButtonFormConfig, type NavigationBarMetrics, type RenderContext, type ResolvedWebRoutingConfig, type ResolvedWebViewportConfig, type RpxConfig, type RuntimeWarningLevel, type RuntimeWarningOptions, type TemplateRenderer, type TemplateScope, type WeappWebPluginOptions, 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, 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, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openCustomerServiceChat, openDocument, openLocation, openRuntimeUrl, openSetting, openVideoEditor, pageScrollTo, preloadSubpackage, previewImage, previewMedia, reLaunch, redirectTo, registerApp, registerComponent, registerPage, registerWebWevuApp, registerWebWevuComponent, 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, transformWxssToCss, updateShareMenu, updateWebDocumentTitle, uploadFile, vibrateShort, weappWebPlugin };
44
+ //# sourceMappingURL=index.d.mts.map