@weapp-vite/web 1.3.37 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) 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 +16 -12
  14. package/dist/compiler/wxml/renderer.mjs.map +1 -1
  15. package/dist/compiler/wxml/specialNodes.mjs +8 -2
  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 +24 -6
  24. package/dist/index.mjs +21 -4
  25. package/dist/plugin/assets.d.mts +7 -0
  26. package/dist/plugin/assets.mjs +122 -0
  27. package/dist/plugin/assets.mjs.map +1 -0
  28. package/dist/plugin/constants.mjs +10 -1
  29. package/dist/plugin/constants.mjs.map +1 -1
  30. package/dist/plugin/dependencyScan.mjs +41 -0
  31. package/dist/plugin/dependencyScan.mjs.map +1 -0
  32. package/dist/plugin/entry.mjs +55 -6
  33. package/dist/plugin/entry.mjs.map +1 -1
  34. package/dist/plugin/files.mjs +1 -1
  35. package/dist/plugin/files.mjs.map +1 -1
  36. package/dist/plugin/index.d.mts +37 -3
  37. package/dist/plugin/index.mjs +244 -73
  38. package/dist/plugin/index.mjs.map +1 -1
  39. package/dist/plugin/layout.mjs +24 -0
  40. package/dist/plugin/layout.mjs.map +1 -0
  41. package/dist/plugin/path.mjs +6 -2
  42. package/dist/plugin/path.mjs.map +1 -1
  43. package/dist/plugin/register.mjs +45 -33
  44. package/dist/plugin/register.mjs.map +1 -1
  45. package/dist/plugin/scan.mjs +211 -92
  46. package/dist/plugin/scan.mjs.map +1 -1
  47. package/dist/plugin/scanSfc.mjs +65 -0
  48. package/dist/plugin/scanSfc.mjs.map +1 -0
  49. package/dist/plugin/state.mjs +3 -2
  50. package/dist/plugin/state.mjs.map +1 -1
  51. package/dist/plugin/styleModule.mjs +52 -0
  52. package/dist/plugin/styleModule.mjs.map +1 -0
  53. package/dist/plugin/types.d.mts +37 -1
  54. package/dist/plugin/vueSfc.mjs +150 -0
  55. package/dist/plugin/vueSfc.mjs.map +1 -0
  56. package/dist/runtime/appShell/container.mjs +25 -0
  57. package/dist/runtime/appShell/container.mjs.map +1 -0
  58. package/dist/runtime/appShell/tabBar/index.mjs +192 -0
  59. package/dist/runtime/appShell/tabBar/index.mjs.map +1 -0
  60. package/dist/runtime/appShell/tabBar/style.mjs +127 -0
  61. package/dist/runtime/appShell/tabBar/style.mjs.map +1 -0
  62. package/dist/runtime/button/helpers.mjs +1 -58
  63. package/dist/runtime/button/helpers.mjs.map +1 -1
  64. package/dist/runtime/button/index.d.mts +4 -5
  65. package/dist/runtime/button/index.mjs +6 -28
  66. package/dist/runtime/button/index.mjs.map +1 -1
  67. package/dist/runtime/button/style.mjs +53 -28
  68. package/dist/runtime/button/style.mjs.map +1 -1
  69. package/dist/runtime/component/behavior.mjs +26 -2
  70. package/dist/runtime/component/behavior.mjs.map +1 -1
  71. package/dist/runtime/component/element.mjs +107 -31
  72. package/dist/runtime/component/element.mjs.map +1 -1
  73. package/dist/runtime/component/observers.mjs +36 -0
  74. package/dist/runtime/component/observers.mjs.map +1 -0
  75. package/dist/runtime/component/publicInstance.mjs +48 -0
  76. package/dist/runtime/component/publicInstance.mjs.map +1 -0
  77. package/dist/runtime/component/relations.mjs +36 -0
  78. package/dist/runtime/component/relations.mjs.map +1 -0
  79. package/dist/runtime/component/slots.mjs +24 -0
  80. package/dist/runtime/component/slots.mjs.map +1 -0
  81. package/dist/runtime/component/state.mjs +13 -3
  82. package/dist/runtime/component/state.mjs.map +1 -1
  83. package/dist/runtime/component/types.d.mts +29 -4
  84. package/dist/runtime/component/virtualHost.mjs +83 -0
  85. package/dist/runtime/component/virtualHost.mjs.map +1 -0
  86. package/dist/runtime/host/index.d.mts +13 -0
  87. package/dist/runtime/host/index.mjs +47 -0
  88. package/dist/runtime/host/index.mjs.map +1 -0
  89. package/dist/runtime/host/types.d.mts +28 -0
  90. package/dist/runtime/hostGlobals.d.mts +9 -0
  91. package/dist/runtime/hostGlobals.mjs +39 -0
  92. package/dist/runtime/hostGlobals.mjs.map +1 -0
  93. package/dist/runtime/index.d.mts +21 -3
  94. package/dist/runtime/index.mjs +26 -4
  95. package/dist/runtime/index.mjs.map +1 -0
  96. package/dist/runtime/legacyTemplate/dom.mjs +3 -3
  97. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
  98. package/dist/runtime/legacyTemplate/expression.mjs +9 -9
  99. package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
  100. package/dist/runtime/legacyTemplate/index.mjs +6 -6
  101. package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
  102. package/dist/runtime/nativeComponents/canvas/index.mjs +53 -0
  103. package/dist/runtime/nativeComponents/canvas/index.mjs.map +1 -0
  104. package/dist/runtime/nativeComponents/checkbox.mjs +137 -0
  105. package/dist/runtime/nativeComponents/checkbox.mjs.map +1 -0
  106. package/dist/runtime/nativeComponents/cover/index.mjs +23 -0
  107. package/dist/runtime/nativeComponents/cover/index.mjs.map +1 -0
  108. package/dist/runtime/nativeComponents/form.d.mts +7 -0
  109. package/dist/runtime/nativeComponents/form.mjs +50 -0
  110. package/dist/runtime/nativeComponents/form.mjs.map +1 -0
  111. package/dist/runtime/nativeComponents/formControl.mjs +61 -0
  112. package/dist/runtime/nativeComponents/formControl.mjs.map +1 -0
  113. package/dist/runtime/nativeComponents/helpers.mjs +25 -0
  114. package/dist/runtime/nativeComponents/helpers.mjs.map +1 -0
  115. package/dist/runtime/nativeComponents/icon/helpers.mjs +42 -0
  116. package/dist/runtime/nativeComponents/icon/helpers.mjs.map +1 -0
  117. package/dist/runtime/nativeComponents/icon/index.mjs +45 -0
  118. package/dist/runtime/nativeComponents/icon/index.mjs.map +1 -0
  119. package/dist/runtime/nativeComponents/icon/style.mjs +176 -0
  120. package/dist/runtime/nativeComponents/icon/style.mjs.map +1 -0
  121. package/dist/runtime/nativeComponents/image.d.mts +8 -0
  122. package/dist/runtime/nativeComponents/image.mjs +121 -0
  123. package/dist/runtime/nativeComponents/image.mjs.map +1 -0
  124. package/dist/runtime/nativeComponents/index.d.mts +11 -0
  125. package/dist/runtime/nativeComponents/index.mjs +83 -0
  126. package/dist/runtime/nativeComponents/index.mjs.map +1 -0
  127. package/dist/runtime/nativeComponents/input.d.mts +8 -0
  128. package/dist/runtime/nativeComponents/input.mjs +131 -0
  129. package/dist/runtime/nativeComponents/input.mjs.map +1 -0
  130. package/dist/runtime/nativeComponents/label.mjs +36 -0
  131. package/dist/runtime/nativeComponents/label.mjs.map +1 -0
  132. package/dist/runtime/nativeComponents/mediaRegistry.mjs +47 -0
  133. package/dist/runtime/nativeComponents/mediaRegistry.mjs.map +1 -0
  134. package/dist/runtime/nativeComponents/movable/helpers.mjs +23 -0
  135. package/dist/runtime/nativeComponents/movable/helpers.mjs.map +1 -0
  136. package/dist/runtime/nativeComponents/movable/index.mjs +117 -0
  137. package/dist/runtime/nativeComponents/movable/index.mjs.map +1 -0
  138. package/dist/runtime/nativeComponents/navigator.mjs +200 -0
  139. package/dist/runtime/nativeComponents/navigator.mjs.map +1 -0
  140. package/dist/runtime/nativeComponents/picker/editors.mjs +74 -0
  141. package/dist/runtime/nativeComponents/picker/editors.mjs.map +1 -0
  142. package/dist/runtime/nativeComponents/picker/helpers.mjs +57 -0
  143. package/dist/runtime/nativeComponents/picker/helpers.mjs.map +1 -0
  144. package/dist/runtime/nativeComponents/picker/index.mjs +210 -0
  145. package/dist/runtime/nativeComponents/picker/index.mjs.map +1 -0
  146. package/dist/runtime/nativeComponents/picker/style.mjs +71 -0
  147. package/dist/runtime/nativeComponents/picker/style.mjs.map +1 -0
  148. package/dist/runtime/nativeComponents/pickerView/column.mjs +134 -0
  149. package/dist/runtime/nativeComponents/pickerView/column.mjs.map +1 -0
  150. package/dist/runtime/nativeComponents/pickerView/helpers.mjs +17 -0
  151. package/dist/runtime/nativeComponents/pickerView/helpers.mjs.map +1 -0
  152. package/dist/runtime/nativeComponents/pickerView/index.mjs +128 -0
  153. package/dist/runtime/nativeComponents/pickerView/index.mjs.map +1 -0
  154. package/dist/runtime/nativeComponents/pickerView/style.mjs +58 -0
  155. package/dist/runtime/nativeComponents/pickerView/style.mjs.map +1 -0
  156. package/dist/runtime/nativeComponents/primitives.mjs +16 -0
  157. package/dist/runtime/nativeComponents/primitives.mjs.map +1 -0
  158. package/dist/runtime/nativeComponents/progress/helpers.mjs +29 -0
  159. package/dist/runtime/nativeComponents/progress/helpers.mjs.map +1 -0
  160. package/dist/runtime/nativeComponents/progress/index.mjs +130 -0
  161. package/dist/runtime/nativeComponents/progress/index.mjs.map +1 -0
  162. package/dist/runtime/nativeComponents/progress/style.mjs +40 -0
  163. package/dist/runtime/nativeComponents/progress/style.mjs.map +1 -0
  164. package/dist/runtime/nativeComponents/radio.mjs +147 -0
  165. package/dist/runtime/nativeComponents/radio.mjs.map +1 -0
  166. package/dist/runtime/nativeComponents/richText/helpers.mjs +230 -0
  167. package/dist/runtime/nativeComponents/richText/helpers.mjs.map +1 -0
  168. package/dist/runtime/nativeComponents/richText/index.mjs +74 -0
  169. package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -0
  170. package/dist/runtime/nativeComponents/scrollView.d.mts +15 -0
  171. package/dist/runtime/nativeComponents/scrollView.mjs +79 -0
  172. package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -0
  173. package/dist/runtime/nativeComponents/slider/helpers.mjs +28 -0
  174. package/dist/runtime/nativeComponents/slider/helpers.mjs.map +1 -0
  175. package/dist/runtime/nativeComponents/slider/index.mjs +120 -0
  176. package/dist/runtime/nativeComponents/slider/index.mjs.map +1 -0
  177. package/dist/runtime/nativeComponents/slider/style.mjs +60 -0
  178. package/dist/runtime/nativeComponents/slider/style.mjs.map +1 -0
  179. package/dist/runtime/nativeComponents/style.mjs +41 -0
  180. package/dist/runtime/nativeComponents/style.mjs.map +1 -0
  181. package/dist/runtime/nativeComponents/swiper/helpers.mjs +52 -0
  182. package/dist/runtime/nativeComponents/swiper/helpers.mjs.map +1 -0
  183. package/dist/runtime/nativeComponents/swiper/index.mjs +235 -0
  184. package/dist/runtime/nativeComponents/swiper/index.mjs.map +1 -0
  185. package/dist/runtime/nativeComponents/swiper/item.mjs +14 -0
  186. package/dist/runtime/nativeComponents/swiper/item.mjs.map +1 -0
  187. package/dist/runtime/nativeComponents/swiper/style.mjs +20 -0
  188. package/dist/runtime/nativeComponents/swiper/style.mjs.map +1 -0
  189. package/dist/runtime/nativeComponents/switch.d.mts +7 -0
  190. package/dist/runtime/nativeComponents/switch.mjs +132 -0
  191. package/dist/runtime/nativeComponents/switch.mjs.map +1 -0
  192. package/dist/runtime/nativeComponents/textarea.d.mts +9 -0
  193. package/dist/runtime/nativeComponents/textarea.mjs +144 -0
  194. package/dist/runtime/nativeComponents/textarea.mjs.map +1 -0
  195. package/dist/runtime/nativeComponents/video/helpers.d.mts +12 -0
  196. package/dist/runtime/nativeComponents/video/helpers.mjs +21 -0
  197. package/dist/runtime/nativeComponents/video/helpers.mjs.map +1 -0
  198. package/dist/runtime/nativeComponents/video/index.mjs +124 -0
  199. package/dist/runtime/nativeComponents/video/index.mjs.map +1 -0
  200. package/dist/runtime/nativeComponents/video/style.mjs +14 -0
  201. package/dist/runtime/nativeComponents/video/style.mjs.map +1 -0
  202. package/dist/runtime/navigationBar/index.mjs +1 -3
  203. package/dist/runtime/navigationBar/index.mjs.map +1 -1
  204. package/dist/runtime/pageLayout.d.mts +9 -0
  205. package/dist/runtime/pageLayout.mjs +16 -0
  206. package/dist/runtime/pageLayout.mjs.map +1 -0
  207. package/dist/runtime/polyfill/animation.mjs +120 -0
  208. package/dist/runtime/polyfill/animation.mjs.map +1 -0
  209. package/dist/runtime/polyfill/appState.mjs +1 -1
  210. package/dist/runtime/polyfill/appState.mjs.map +1 -1
  211. package/dist/runtime/polyfill/async.d.mts +7 -0
  212. package/dist/runtime/polyfill/async.mjs.map +1 -1
  213. package/dist/runtime/polyfill/canvasContext.mjs +41 -0
  214. package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
  215. package/dist/runtime/polyfill/device.mjs +1 -1
  216. package/dist/runtime/polyfill/device.mjs.map +1 -1
  217. package/dist/runtime/polyfill/deviceApi.mjs +6 -3
  218. package/dist/runtime/polyfill/deviceApi.mjs.map +1 -1
  219. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +8 -2
  220. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
  221. package/dist/runtime/polyfill/eventBus.mjs +56 -0
  222. package/dist/runtime/polyfill/eventBus.mjs.map +1 -0
  223. package/dist/runtime/polyfill/fileSystemManager.mjs +5 -2
  224. package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
  225. package/dist/runtime/polyfill/files.mjs +10 -10
  226. package/dist/runtime/polyfill/files.mjs.map +1 -1
  227. package/dist/runtime/polyfill/font.mjs +33 -0
  228. package/dist/runtime/polyfill/font.mjs.map +1 -0
  229. package/dist/runtime/polyfill/index.d.mts +2 -2
  230. package/dist/runtime/polyfill/index.mjs +49 -45
  231. package/dist/runtime/polyfill/index.mjs.map +1 -1
  232. package/dist/runtime/polyfill/interaction.mjs +7 -6
  233. package/dist/runtime/polyfill/interaction.mjs.map +1 -1
  234. package/dist/runtime/polyfill/interactionApi.mjs +9 -5
  235. package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
  236. package/dist/runtime/polyfill/intersectionObserver.mjs +106 -0
  237. package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -0
  238. package/dist/runtime/polyfill/locale.mjs +14 -0
  239. package/dist/runtime/polyfill/locale.mjs.map +1 -0
  240. package/dist/runtime/polyfill/locationApi.mjs +11 -6
  241. package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
  242. package/dist/runtime/polyfill/mediaActions.mjs +2 -2
  243. package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
  244. package/dist/runtime/polyfill/mediaApi/file.mjs +3 -2
  245. package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -1
  246. package/dist/runtime/polyfill/mediaApi/info.mjs +6 -4
  247. package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
  248. package/dist/runtime/polyfill/mediaApi/picker.mjs +16 -8
  249. package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -1
  250. package/dist/runtime/polyfill/mediaApi/preview.mjs +4 -2
  251. package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -1
  252. package/dist/runtime/polyfill/mediaApi/process.mjs +4 -2
  253. package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -1
  254. package/dist/runtime/polyfill/menuApi.mjs +39 -4
  255. package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
  256. package/dist/runtime/polyfill/navigationBarRuntime.mjs +6 -1
  257. package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
  258. package/dist/runtime/polyfill/network/request.mjs +2 -2
  259. package/dist/runtime/polyfill/network/request.mjs.map +1 -1
  260. package/dist/runtime/polyfill/platformApi.mjs +3 -2
  261. package/dist/runtime/polyfill/platformApi.mjs.map +1 -1
  262. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +88 -0
  263. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -0
  264. package/dist/runtime/polyfill/routeRuntime/dom.mjs +44 -15
  265. package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
  266. package/dist/runtime/polyfill/routeRuntime/history.d.mts +30 -0
  267. package/dist/runtime/polyfill/routeRuntime/history.mjs +148 -0
  268. package/dist/runtime/polyfill/routeRuntime/history.mjs.map +1 -0
  269. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +39 -8
  270. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
  271. package/dist/runtime/polyfill/routeRuntime/options.d.mts +11 -1
  272. package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -1
  273. package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
  274. package/dist/runtime/polyfill/routeRuntime/result.mjs +12 -0
  275. package/dist/runtime/polyfill/routeRuntime/result.mjs.map +1 -0
  276. package/dist/runtime/polyfill/routeRuntime/scroll.mjs +39 -0
  277. package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -0
  278. package/dist/runtime/polyfill/routeRuntime/stack.mjs +122 -0
  279. package/dist/runtime/polyfill/routeRuntime/stack.mjs.map +1 -0
  280. package/dist/runtime/polyfill/routeRuntime.d.mts +26 -17
  281. package/dist/runtime/polyfill/routeRuntime.mjs +121 -96
  282. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
  283. package/dist/runtime/polyfill/runtimeDataApi.mjs +8 -3
  284. package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
  285. package/dist/runtime/polyfill/runtimeOps.mjs +10 -6
  286. package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
  287. package/dist/runtime/polyfill/selectorQuery.mjs +70 -14
  288. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
  289. package/dist/runtime/polyfill/storage.mjs +5 -2
  290. package/dist/runtime/polyfill/storage.mjs.map +1 -1
  291. package/dist/runtime/polyfill/storageAsync.mjs +4 -2
  292. package/dist/runtime/polyfill/storageAsync.mjs.map +1 -1
  293. package/dist/runtime/polyfill/system.mjs +31 -4
  294. package/dist/runtime/polyfill/system.mjs.map +1 -1
  295. package/dist/runtime/polyfill/systemApi.mjs +2 -1
  296. package/dist/runtime/polyfill/systemApi.mjs.map +1 -1
  297. package/dist/runtime/polyfill/types/locationRuntime.d.mts +1 -4
  298. package/dist/runtime/polyfill/types/platformRuntime.d.mts +9 -0
  299. package/dist/runtime/polyfill/types/systemAuth.d.mts +20 -9
  300. package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +25 -0
  301. package/dist/runtime/polyfill/ui.mjs +2 -6
  302. package/dist/runtime/polyfill/ui.mjs.map +1 -1
  303. package/dist/runtime/polyfill/uiMediaApi.d.mts +11 -10
  304. package/dist/runtime/polyfill/uiMediaApi.mjs +26 -2
  305. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
  306. package/dist/runtime/polyfill/videoContext.mjs +4 -0
  307. package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
  308. package/dist/runtime/polyfill/vkSession.mjs +4 -14
  309. package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
  310. package/dist/runtime/polyfill.d.mts +2 -2
  311. package/dist/runtime/renderContext.mjs +1 -1
  312. package/dist/runtime/renderContext.mjs.map +1 -1
  313. package/dist/runtime/rpx.mjs +17 -8
  314. package/dist/runtime/rpx.mjs.map +1 -1
  315. package/dist/runtime/seo/index.d.mts +31 -0
  316. package/dist/runtime/seo/index.mjs +94 -0
  317. package/dist/runtime/seo/index.mjs.map +1 -0
  318. package/dist/runtime/viewport/index.d.mts +12 -0
  319. package/dist/runtime/viewport/index.mjs +44 -0
  320. package/dist/runtime/viewport/index.mjs.map +1 -0
  321. package/dist/runtime/viewport/style.mjs +62 -0
  322. package/dist/runtime/viewport/style.mjs.map +1 -0
  323. package/dist/runtime/viewport/types.d.mts +14 -0
  324. package/dist/runtime/wevu.d.mts +20 -0
  325. package/dist/runtime/wevu.mjs +73 -0
  326. package/dist/runtime/wevu.mjs.map +1 -0
  327. package/dist/shared/nativeComponents.mjs +401 -0
  328. package/dist/shared/nativeComponents.mjs.map +1 -0
  329. package/dist/shared/tabBar.d.mts +19 -0
  330. package/dist/shared/tabBar.mjs +37 -0
  331. package/dist/shared/tabBar.mjs.map +1 -0
  332. package/dist/shared/wxml.mjs +3 -20
  333. package/dist/shared/wxml.mjs.map +1 -1
  334. package/package.json +14 -6
@@ -0,0 +1,65 @@
1
+ import { SCRIPT_EXTS } from "./constants.mjs";
2
+ import { isRecord, resolveTemplateFile } from "./files.mjs";
3
+ import { compileWebVueSfc } from "./vueSfc.mjs";
4
+ import { readFile, readdir } from "node:fs/promises";
5
+ import path from "pathe";
6
+
7
+ //#region src/plugin/scanSfc.ts
8
+ const PAGE_SEGMENT = "pages";
9
+ const EXCLUDED_PAGE_SEGMENTS = /* @__PURE__ */ new Set([
10
+ "components",
11
+ "custom-tab-bar",
12
+ "layouts"
13
+ ]);
14
+ function parseSfcJsonConfig(source) {
15
+ if (!source) return;
16
+ try {
17
+ const parsed = JSON.parse(source);
18
+ return isRecord(parsed) ? parsed : void 0;
19
+ } catch {
20
+ return;
21
+ }
22
+ }
23
+ async function compileScannedSfc(options) {
24
+ const source = await readFile(options.filename, "utf8");
25
+ const result = await compileWebVueSfc({
26
+ ...options,
27
+ source
28
+ });
29
+ return {
30
+ result,
31
+ config: parseSfcJsonConfig(result.config)
32
+ };
33
+ }
34
+ function isPageCandidate(relativePath) {
35
+ const segments = relativePath.split("/");
36
+ const pagesIndex = segments.indexOf(PAGE_SEGMENT);
37
+ if (pagesIndex < 0) return false;
38
+ return !segments.slice(pagesIndex + 1, -1).some((segment) => EXCLUDED_PAGE_SEGMENTS.has(segment));
39
+ }
40
+ async function walk(current, files) {
41
+ const entries = await readdir(current, { withFileTypes: true });
42
+ for (const entry of entries) {
43
+ const pathname = path.join(current, entry.name);
44
+ if (entry.isDirectory()) await walk(pathname, files);
45
+ else files.push(pathname);
46
+ }
47
+ }
48
+ async function discoverWebPageIds(srcRoot) {
49
+ const files = [];
50
+ await walk(srcRoot, files);
51
+ const pageIds = /* @__PURE__ */ new Set();
52
+ for (const filename of files.sort()) {
53
+ const extension = path.extname(filename);
54
+ if (!SCRIPT_EXTS.includes(extension)) continue;
55
+ const relativePath = path.relative(srcRoot, filename).replaceAll("\\", "/");
56
+ if (!isPageCandidate(relativePath)) continue;
57
+ if (extension !== ".vue" && !await resolveTemplateFile(filename)) continue;
58
+ pageIds.add(relativePath.slice(0, -extension.length));
59
+ }
60
+ return [...pageIds];
61
+ }
62
+
63
+ //#endregion
64
+ export { compileScannedSfc, discoverWebPageIds, parseSfcJsonConfig };
65
+ //# sourceMappingURL=scanSfc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanSfc.mjs","names":[],"sources":["../../src/plugin/scanSfc.ts"],"sourcesContent":["import type { ModuleMeta, ResolveWebAutoImportTag, ResolveWebModuleId, ScanState } from './types'\nimport { readdir, readFile } from 'node:fs/promises'\nimport path from 'pathe'\nimport { SCRIPT_EXTS } from './constants'\nimport { isRecord, resolveTemplateFile } from './files'\nimport { compileWebVueSfc } from './vueSfc'\n\nconst PAGE_SEGMENT = 'pages'\nconst EXCLUDED_PAGE_SEGMENTS = new Set(['components', 'custom-tab-bar', 'layouts'])\n\nexport function parseSfcJsonConfig(source?: string) {\n if (!source) {\n return undefined\n }\n try {\n const parsed = JSON.parse(source) as unknown\n return isRecord(parsed) ? parsed : undefined\n }\n catch {\n return undefined\n }\n}\n\nexport async function compileScannedSfc(options: {\n filename: string\n meta: ModuleMeta\n srcRoot: string\n state: ScanState\n resolveId?: ResolveWebModuleId\n resolveAutoImportTag?: ResolveWebAutoImportTag\n uniApp?: { include: string[] }\n}) {\n const source = await readFile(options.filename, 'utf8')\n const result = await compileWebVueSfc({ ...options, source })\n return {\n result,\n config: parseSfcJsonConfig(result.config),\n }\n}\n\nfunction isPageCandidate(relativePath: string) {\n const segments = relativePath.split('/')\n const pagesIndex = segments.indexOf(PAGE_SEGMENT)\n if (pagesIndex < 0) {\n return false\n }\n const routeSegments = segments.slice(pagesIndex + 1, -1)\n return !routeSegments.some(segment => EXCLUDED_PAGE_SEGMENTS.has(segment))\n}\n\nasync function walk(current: string, files: string[]) {\n const entries = await readdir(current, { withFileTypes: true })\n for (const entry of entries) {\n const pathname = path.join(current, entry.name)\n if (entry.isDirectory()) {\n await walk(pathname, files)\n }\n else {\n files.push(pathname)\n }\n }\n}\n\nexport async function discoverWebPageIds(srcRoot: string) {\n const files: string[] = []\n await walk(srcRoot, files)\n const pageIds = new Set<string>()\n for (const filename of files.sort()) {\n const extension = path.extname(filename)\n if (!SCRIPT_EXTS.includes(extension)) {\n continue\n }\n const relativePath = path.relative(srcRoot, filename).replaceAll('\\\\', '/')\n if (!isPageCandidate(relativePath)) {\n continue\n }\n if (extension !== '.vue' && !(await resolveTemplateFile(filename))) {\n continue\n }\n pageIds.add(relativePath.slice(0, -extension.length))\n }\n return [...pageIds]\n}\n"],"mappings":";;;;;;;AAOA,MAAM,eAAe;AACrB,MAAM,yCAAyB,IAAI,IAAI;CAAC;CAAc;CAAkB;AAAS,CAAC;AAElF,SAAgB,mBAAmB,QAAiB;CAClD,IAAI,CAAC,QACH;CAEF,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,MAAM;EAChC,OAAO,SAAS,MAAM,IAAI,SAAS;CACrC,QACM;EACJ;CACF;AACF;AAEA,eAAsB,kBAAkB,SAQrC;CACD,MAAM,SAAS,MAAM,SAAS,QAAQ,UAAU,MAAM;CACtD,MAAM,SAAS,MAAM,iBAAiB;EAAE,GAAG;EAAS;CAAO,CAAC;CAC5D,OAAO;EACL;EACA,QAAQ,mBAAmB,OAAO,MAAM;CAC1C;AACF;AAEA,SAAS,gBAAgB,cAAsB;CAC7C,MAAM,WAAW,aAAa,MAAM,GAAG;CACvC,MAAM,aAAa,SAAS,QAAQ,YAAY;CAChD,IAAI,aAAa,GACf,OAAO;CAGT,OAAO,CADe,SAAS,MAAM,aAAa,GAAG,EACjC,CAAC,CAAC,MAAK,YAAW,uBAAuB,IAAI,OAAO,CAAC;AAC3E;AAEA,eAAe,KAAK,SAAiB,OAAiB;CACpD,MAAM,UAAU,MAAM,QAAQ,SAAS,EAAE,eAAe,KAAK,CAAC;CAC9D,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,WAAW,KAAK,KAAK,SAAS,MAAM,IAAI;EAC9C,IAAI,MAAM,YAAY,GACpB,MAAM,KAAK,UAAU,KAAK;OAG1B,MAAM,KAAK,QAAQ;CAEvB;AACF;AAEA,eAAsB,mBAAmB,SAAiB;CACxD,MAAM,QAAkB,CAAC;CACzB,MAAM,KAAK,SAAS,KAAK;CACzB,MAAM,0BAAU,IAAI,IAAY;CAChC,KAAK,MAAM,YAAY,MAAM,KAAK,GAAG;EACnC,MAAM,YAAY,KAAK,QAAQ,QAAQ;EACvC,IAAI,CAAC,YAAY,SAAS,SAAS,GACjC;EAEF,MAAM,eAAe,KAAK,SAAS,SAAS,QAAQ,CAAC,CAAC,WAAW,MAAM,GAAG;EAC1E,IAAI,CAAC,gBAAgB,YAAY,GAC/B;EAEF,IAAI,cAAc,UAAU,CAAE,MAAM,oBAAoB,QAAQ,GAC9D;EAEF,QAAQ,IAAI,aAAa,MAAM,GAAG,CAAC,UAAU,MAAM,CAAC;CACtD;CACA,OAAO,CAAC,GAAG,OAAO;AACpB"}
@@ -6,13 +6,14 @@ function createEmptyScanState() {
6
6
  templateComponentMap: /* @__PURE__ */ new Map(),
7
7
  templatePathSet: /* @__PURE__ */ new Set(),
8
8
  componentTagMap: /* @__PURE__ */ new Map(),
9
- componentIdMap: /* @__PURE__ */ new Map(),
10
9
  appNavigationDefaults: {},
11
10
  appComponentTags: {},
11
+ sfcResults: /* @__PURE__ */ new Map(),
12
12
  scanResult: {
13
13
  app: void 0,
14
14
  pages: [],
15
- components: []
15
+ components: [],
16
+ layouts: []
16
17
  }
17
18
  };
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"state.mjs","names":[],"sources":["../../src/plugin/state.ts"],"sourcesContent":["import type { ScanState } from './types'\n\nexport function createEmptyScanState(): ScanState {\n return {\n moduleMeta: new Map(),\n pageNavigationMap: new Map(),\n templateComponentMap: new Map(),\n templatePathSet: new Set(),\n componentTagMap: new Map(),\n componentIdMap: new Map(),\n appNavigationDefaults: {},\n appComponentTags: {},\n scanResult: {\n app: undefined,\n pages: [],\n components: [],\n },\n }\n}\n"],"mappings":";AAEA,SAAgB,uBAAkC;CAChD,OAAO;EACL,4BAAY,IAAI,IAAI;EACpB,mCAAmB,IAAI,IAAI;EAC3B,sCAAsB,IAAI,IAAI;EAC9B,iCAAiB,IAAI,IAAI;EACzB,iCAAiB,IAAI,IAAI;EACzB,gCAAgB,IAAI,IAAI;EACxB,uBAAuB,CAAC;EACxB,kBAAkB,CAAC;EACnB,YAAY;GACV,KAAK;GACL,OAAO,CAAC;GACR,YAAY,CAAC;EACf;CACF;AACF"}
1
+ {"version":3,"file":"state.mjs","names":[],"sources":["../../src/plugin/state.ts"],"sourcesContent":["import type { ScanState } from './types'\n\nexport function createEmptyScanState(): ScanState {\n return {\n moduleMeta: new Map(),\n pageNavigationMap: new Map(),\n templateComponentMap: new Map(),\n templatePathSet: new Set(),\n componentTagMap: new Map(),\n appNavigationDefaults: {},\n appComponentTags: {},\n sfcResults: new Map(),\n scanResult: {\n app: undefined,\n pages: [],\n components: [],\n layouts: [],\n },\n }\n}\n"],"mappings":";AAEA,SAAgB,uBAAkC;CAChD,OAAO;EACL,4BAAY,IAAI,IAAI;EACpB,mCAAmB,IAAI,IAAI;EAC3B,sCAAsB,IAAI,IAAI;EAC9B,iCAAiB,IAAI,IAAI;EACzB,iCAAiB,IAAI,IAAI;EACzB,uBAAuB,CAAC;EACxB,kBAAkB,CAAC;EACnB,4BAAY,IAAI,IAAI;EACpB,YAAY;GACV,KAAK;GACL,OAAO,CAAC;GACR,YAAY,CAAC;GACb,SAAS,CAAC;EACZ;CACF;AACF"}
@@ -0,0 +1,52 @@
1
+ //#region src/plugin/styleModule.ts
2
+ function createInlineStyleModule(css) {
3
+ return [
4
+ `const __weapp_injected_styles__ = new Map()`,
5
+ `function __weapp_createStyleId__(css) {`,
6
+ ` let hash = 2166136261`,
7
+ ` for (let i = 0; i < css.length; i++) {`,
8
+ ` hash ^= css.charCodeAt(i)`,
9
+ ` hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)`,
10
+ ` }`,
11
+ ` return 'weapp-web-style-' + (hash >>> 0).toString(36)`,
12
+ `}`,
13
+ `function __weapp_removeStyle__(id) {`,
14
+ ` if (typeof document === 'undefined') {`,
15
+ ` return`,
16
+ ` }`,
17
+ ` const style = __weapp_injected_styles__.get(id)`,
18
+ ` if (style) {`,
19
+ ` style.remove()`,
20
+ ` __weapp_injected_styles__.delete(id)`,
21
+ ` }`,
22
+ `}`,
23
+ `function injectStyle(css, id) {`,
24
+ ` if (typeof document === 'undefined') {`,
25
+ ` return () => {}`,
26
+ ` }`,
27
+ ` const styleId = id ?? __weapp_createStyleId__(css)`,
28
+ ` const existing = __weapp_injected_styles__.get(styleId)`,
29
+ ` if (existing) {`,
30
+ ` if (existing.textContent !== css) {`,
31
+ ` existing.textContent = css`,
32
+ ` }`,
33
+ ` return () => __weapp_removeStyle__(styleId)`,
34
+ ` }`,
35
+ ` const style = document.createElement('style')`,
36
+ ` style.id = styleId`,
37
+ ` style.textContent = css`,
38
+ ` document.head.append(style)`,
39
+ ` __weapp_injected_styles__.set(styleId, style)`,
40
+ ` return () => __weapp_removeStyle__(styleId)`,
41
+ `}`,
42
+ `const css = ${JSON.stringify(css)}`,
43
+ `export default css`,
44
+ `export function useStyle(id) {`,
45
+ ` return injectStyle(css, id)`,
46
+ `}`
47
+ ].join("\n");
48
+ }
49
+
50
+ //#endregion
51
+ export { createInlineStyleModule };
52
+ //# sourceMappingURL=styleModule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styleModule.mjs","names":[],"sources":["../../src/plugin/styleModule.ts"],"sourcesContent":["export function createInlineStyleModule(css: string) {\n const serialized = JSON.stringify(css)\n return [\n `const __weapp_injected_styles__ = new Map()`,\n `function __weapp_createStyleId__(css) {`,\n ` let hash = 2166136261`,\n ` for (let i = 0; i < css.length; i++) {`,\n ` hash ^= css.charCodeAt(i)`,\n ` hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)`,\n ` }`,\n ` return 'weapp-web-style-' + (hash >>> 0).toString(36)`,\n `}`,\n `function __weapp_removeStyle__(id) {`,\n ` if (typeof document === 'undefined') {`,\n ` return`,\n ` }`,\n ` const style = __weapp_injected_styles__.get(id)`,\n ` if (style) {`,\n ` style.remove()`,\n ` __weapp_injected_styles__.delete(id)`,\n ` }`,\n `}`,\n `function injectStyle(css, id) {`,\n ` if (typeof document === 'undefined') {`,\n ` return () => {}`,\n ` }`,\n ` const styleId = id ?? __weapp_createStyleId__(css)`,\n ` const existing = __weapp_injected_styles__.get(styleId)`,\n ` if (existing) {`,\n ` if (existing.textContent !== css) {`,\n ` existing.textContent = css`,\n ` }`,\n ` return () => __weapp_removeStyle__(styleId)`,\n ` }`,\n ` const style = document.createElement('style')`,\n ` style.id = styleId`,\n ` style.textContent = css`,\n ` document.head.append(style)`,\n ` __weapp_injected_styles__.set(styleId, style)`,\n ` return () => __weapp_removeStyle__(styleId)`,\n `}`,\n `const css = ${serialized}`,\n `export default css`,\n `export function useStyle(id) {`,\n ` return injectStyle(css, id)`,\n `}`,\n ].join('\\n')\n}\n"],"mappings":";AAAA,SAAgB,wBAAwB,KAAa;CAEnD,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAxCiB,KAAK,UAAU,GAwCR;EACxB;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb"}
@@ -1,4 +1,7 @@
1
1
  import { WxssTransformOptions } from "../css/wxss.mjs";
2
+ import { WebRoutingConfig } from "../runtime/polyfill/routeRuntime/history.mjs";
3
+ import { WebResourceHintsConfig, WebRuntimeSeoConfig as WebSeoConfig } from "../runtime/seo/index.mjs";
4
+ import "wevu/compiler";
2
5
  //#region src/plugin/types.d.ts
3
6
  interface WeappWebPluginOptions {
4
7
  wxss?: WxssTransformOptions;
@@ -38,6 +41,20 @@ interface WeappWebPluginOptions {
38
41
  level?: 'off' | 'warn' | 'error';
39
42
  dedupe?: boolean;
40
43
  };
44
+ /**
45
+ * Web 页面视口表现。默认使用小程序设备容器,宽屏下居中显示。
46
+ */
47
+ viewport?: {
48
+ mode?: 'mini-program' | 'responsive';
49
+ maxWidth?: number;
50
+ desktopBreakpoint?: number;
51
+ };
52
+ /** Web 路由与浏览器地址栏同步策略。 */
53
+ routing?: WebRoutingConfig;
54
+ /** 页面切换时同步浏览器 Head 的 SEO 配置。 */
55
+ seo?: WebSeoConfig;
56
+ /** 首屏或关键资源的浏览器 Resource Hints。 */
57
+ resourceHints?: WebResourceHintsConfig;
41
58
  };
42
59
  /**
43
60
  * weapp-vite runtime provider 注入的内部绑定。
@@ -48,7 +65,26 @@ interface WeappWebPluginOptions {
48
65
  moduleId: string;
49
66
  hmrAcceptCode?: string;
50
67
  };
68
+ /** @internal */
69
+ __uniApp?: {
70
+ include: string[];
71
+ };
72
+ /** @internal */
73
+ __autoImportResolvers?: WebComponentResolver[];
74
+ /** @internal */
75
+ __resolveAppConfig?: (appConfigPath: string) => Promise<Record<string, unknown> | undefined>;
76
+ }
77
+ interface WebResolvedComponent {
78
+ name: string;
79
+ from: string;
80
+ resolvedId?: string;
81
+ sourceType?: 'wevu-sfc' | 'native';
51
82
  }
83
+ type WebComponentResolver = {
84
+ components?: Record<string, string>;
85
+ resolve?: (componentName: string, baseName: string) => WebResolvedComponent | void;
86
+ } | ((componentName: string, baseName: string) => WebResolvedComponent | void);
87
+ type ResolveWebModuleId = (source: string, importer?: string) => Promise<string | undefined>;
52
88
  //#endregion
53
- export { WeappWebPluginOptions };
89
+ export { ResolveWebModuleId, WeappWebPluginOptions, WebComponentResolver, WebResolvedComponent };
54
90
  //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1,150 @@
1
+ import { compileWxml } from "../compiler/wxml/compile.mjs";
2
+ import { appendInlineQuery, resolveTemplatePathSync, resolveWxsPathSync, toRelativeImport } from "./path.mjs";
3
+ import { resolveScriptFile } from "./files.mjs";
4
+ import path from "pathe";
5
+ import { compileVueFile, isUniAppCompatibilityFile, transformUniAppSource } from "wevu/compiler";
6
+ import { transform } from "esbuild";
7
+ import { parse } from "@babel/parser";
8
+ import _babelTraverse from "@babel/traverse";
9
+ import * as t from "@babel/types";
10
+ import MagicString from "magic-string";
11
+ import { fs } from "@weapp-core/shared/fs";
12
+
13
+ //#region src/plugin/vueSfc.ts
14
+ const traverse = _babelTraverse;
15
+ async function resolveSfcSrc(request, importer, srcRoot, resolveId) {
16
+ if (request.startsWith("@/")) return path.resolve(srcRoot, request.slice(2));
17
+ if (request.startsWith(".")) return path.resolve(path.dirname(importer), request);
18
+ if (request.startsWith("/")) return path.resolve(srcRoot, request.slice(1));
19
+ return await resolveId?.(request, importer);
20
+ }
21
+ async function compileWebVueSfc(options) {
22
+ const { filename, meta, srcRoot, state, resolveId, resolveAutoImportTag, uniApp } = options;
23
+ const source = uniApp && isUniAppCompatibilityFile(filename, srcRoot, uniApp.include) ? transformUniAppSource(options.source, {
24
+ filename,
25
+ target: "h5"
26
+ }).code : options.source;
27
+ const result = await compileVueFile(source, filename, {
28
+ isApp: meta.kind === "app",
29
+ isPage: meta.kind === "page",
30
+ sourceMap: false,
31
+ style: {
32
+ preserveDeepSelectors: true,
33
+ transformScoped: false
34
+ },
35
+ json: { kind: meta.kind },
36
+ autoUsingComponents: {
37
+ enabled: true,
38
+ resolveUsingComponentPath: async (request, importer) => {
39
+ const base = request.startsWith("@/") ? path.resolve(srcRoot, request.slice(2)) : request.startsWith(".") ? path.resolve(path.dirname(importer), request) : request.startsWith("/") ? path.resolve(srcRoot, request.slice(1)) : void 0;
40
+ if (!base) return;
41
+ const resolvedId = await resolveScriptFile(base);
42
+ if (!resolvedId) return;
43
+ return {
44
+ from: request,
45
+ resolvedId,
46
+ sourceType: resolvedId.endsWith(".vue") ? "wevu-sfc" : "native"
47
+ };
48
+ }
49
+ },
50
+ autoImportTags: {
51
+ enabled: Boolean(resolveAutoImportTag),
52
+ resolveUsingComponent: async (tag, importer) => resolveAutoImportTag?.(tag, importer)
53
+ },
54
+ sfcSrc: { resolveId: async (request, importer) => {
55
+ return resolveSfcSrc(request, importer, srcRoot, resolveId);
56
+ } }
57
+ });
58
+ state.sfcResults.set(filename, result);
59
+ for (const dependency of result.meta?.sfcSrcDeps ?? []) state.templatePathSet.add(dependency);
60
+ return result;
61
+ }
62
+ async function ensureWebVueSfcResult(options) {
63
+ const cached = options.state.sfcResults.get(options.filename);
64
+ if (cached) return cached;
65
+ const source = options.source ?? await fs.readFile(options.filename, "utf8");
66
+ return await compileWebVueSfc({
67
+ ...options,
68
+ source
69
+ });
70
+ }
71
+ function getSfcRegisterName(kind) {
72
+ return kind === "app" ? "registerWebWevuApp" : "registerWebWevuComponent";
73
+ }
74
+ function getSfcFactoryName(kind) {
75
+ return kind === "app" ? "createApp" : "createWevuComponent";
76
+ }
77
+ function createRegisterMetaCode(meta, templateIdent, styleIdent) {
78
+ const parts = [`id: ${JSON.stringify(meta.id)}`, `kind: ${JSON.stringify(meta.kind)}`];
79
+ if (templateIdent) parts.push(`template: ${templateIdent}`);
80
+ if (styleIdent) parts.push(`style: ${styleIdent}`);
81
+ if (meta.navigationBar) parts.push(`navigationBar: ${JSON.stringify(meta.navigationBar)}`);
82
+ return `{ ${parts.join(", ")} }`;
83
+ }
84
+ async function transformWebVueSfcScript(options) {
85
+ const { code, filename, meta, runtimeModuleId, styleLanguage, enableHmr, hmrAcceptCode } = options;
86
+ const ast = parse(code, {
87
+ sourceType: "module",
88
+ plugins: ["typescript", "jsx"],
89
+ ranges: true
90
+ });
91
+ const s = new MagicString(code);
92
+ const templateIdent = meta.kind === "app" ? void 0 : "__weapp_sfc_template__";
93
+ const styleIdent = meta.kind === "app" ? void 0 : "__weapp_sfc_style__";
94
+ const registerName = getSfcRegisterName(meta.kind);
95
+ const factoryName = getSfcFactoryName(meta.kind);
96
+ const registerMetaCode = createRegisterMetaCode(meta, templateIdent, styleIdent);
97
+ let transformed = false;
98
+ traverse(ast, { CallExpression(nodePath) {
99
+ const callee = nodePath.node.callee;
100
+ if (!t.isIdentifier(callee, { name: factoryName })) return;
101
+ s.overwrite(callee.start, callee.end, registerName);
102
+ s.appendLeft(nodePath.node.end - 1, `, ${registerMetaCode}`);
103
+ transformed = true;
104
+ } });
105
+ if (!transformed) throw new Error(`[@weapp-vite/web] Vue SFC 未生成 ${factoryName} 注册调用: ${filename}`);
106
+ const imports = [`import { ${registerName} } from '${runtimeModuleId}'`];
107
+ if (templateIdent) imports.push(`import ${templateIdent} from '${toRelativeImport(filename, filename)}?weapp-web-sfc-template'`);
108
+ if (styleIdent) {
109
+ const styleFilename = `${filename}.${styleLanguage}`;
110
+ imports.push(`import ${styleIdent} from '${appendInlineQuery(`${toRelativeImport(filename, styleFilename)}?weapp-web-sfc-style`)}'`);
111
+ }
112
+ s.prepend(`${imports.join("\n")}\n`);
113
+ if (enableHmr && hmrAcceptCode) s.append(`\n${hmrAcceptCode}\n`);
114
+ const transpiled = await transform(s.toString(), {
115
+ format: "esm",
116
+ legalComments: "inline",
117
+ loader: "ts",
118
+ sourcefile: filename,
119
+ sourcemap: "external",
120
+ target: "es2022"
121
+ });
122
+ return {
123
+ code: transpiled.code,
124
+ map: JSON.parse(transpiled.map)
125
+ };
126
+ }
127
+ function generateWebVueSfcTemplate(result, meta, filename, srcRoot) {
128
+ return compileWxml({
129
+ id: filename,
130
+ source: result.template ?? "",
131
+ navigationBar: meta.navigationBar ? { config: meta.navigationBar } : void 0,
132
+ componentTags: meta.componentTags,
133
+ resolveTemplatePath: (request, importer) => resolveTemplatePathSync(request, importer, srcRoot),
134
+ resolveWxsPath: (request, importer) => resolveWxsPathSync(request, importer, srcRoot)
135
+ });
136
+ }
137
+ function resolveWebVueSfcStyleLanguage(result, filename) {
138
+ const languages = new Set((result.meta?.styleBlocks ?? []).map((style) => style.lang?.trim() || "css"));
139
+ for (const language of languages) if (!/^[a-z][a-z0-9-]*$/i.test(language)) throw new Error(`[@weapp-vite/web] Vue SFC 样式语言无效: ${filename} -> ${language}`);
140
+ const preprocessLanguages = [...languages].filter((language) => language !== "css");
141
+ if (preprocessLanguages.length > 1) throw new Error(`[@weapp-vite/web] Vue SFC 暂不支持混合样式语言: ${filename}`);
142
+ return preprocessLanguages[0] ?? "css";
143
+ }
144
+ function generateWebVueSfcStyle(result) {
145
+ return result.style ?? "";
146
+ }
147
+
148
+ //#endregion
149
+ export { compileWebVueSfc, ensureWebVueSfcResult, generateWebVueSfcStyle, generateWebVueSfcTemplate, resolveWebVueSfcStyleLanguage, transformWebVueSfcScript };
150
+ //# sourceMappingURL=vueSfc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vueSfc.mjs","names":[],"sources":["../../src/plugin/vueSfc.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse'\nimport type { CallExpression } from '@babel/types'\nimport type { VueTransformResult } from 'wevu/compiler'\nimport type { ModuleMeta, ResolveWebAutoImportTag, ResolveWebModuleId, ScanState } from './types'\nimport { parse } from '@babel/parser'\nimport _babelTraverse from '@babel/traverse'\nimport * as t from '@babel/types'\nimport { fs } from '@weapp-core/shared/fs'\nimport { transform } from 'esbuild'\nimport MagicString from 'magic-string'\nimport path from 'pathe'\nimport { compileVueFile, isUniAppCompatibilityFile, transformUniAppSource } from 'wevu/compiler'\nimport { compileWxml } from '../compiler/wxml'\nimport { resolveScriptFile } from './files'\nimport { appendInlineQuery, resolveTemplatePathSync, resolveWxsPathSync, toRelativeImport } from './path'\n\nconst traverse = _babelTraverse\n\nasync function resolveSfcSrc(\n request: string,\n importer: string,\n srcRoot: string,\n resolveId?: ResolveWebModuleId,\n) {\n if (request.startsWith('@/')) {\n return path.resolve(srcRoot, request.slice(2))\n }\n if (request.startsWith('.')) {\n return path.resolve(path.dirname(importer), request)\n }\n if (request.startsWith('/')) {\n return path.resolve(srcRoot, request.slice(1))\n }\n return await resolveId?.(request, importer)\n}\n\nexport async function compileWebVueSfc(options: {\n source: string\n filename: string\n meta: ModuleMeta\n srcRoot: string\n state: ScanState\n resolveId?: ResolveWebModuleId\n resolveAutoImportTag?: ResolveWebAutoImportTag\n uniApp?: { include: string[] }\n}) {\n const { filename, meta, srcRoot, state, resolveId, resolveAutoImportTag, uniApp } = options\n const source = uniApp && isUniAppCompatibilityFile(filename, srcRoot, uniApp.include)\n ? transformUniAppSource(options.source, { filename, target: 'h5' }).code\n : options.source\n const result = await compileVueFile(source, filename, {\n isApp: meta.kind === 'app',\n isPage: meta.kind === 'page',\n sourceMap: false,\n style: {\n preserveDeepSelectors: true,\n transformScoped: false,\n },\n json: { kind: meta.kind },\n autoUsingComponents: {\n enabled: true,\n resolveUsingComponentPath: async (request, importer) => {\n const base = request.startsWith('@/')\n ? path.resolve(srcRoot, request.slice(2))\n : request.startsWith('.')\n ? path.resolve(path.dirname(importer), request)\n : request.startsWith('/')\n ? path.resolve(srcRoot, request.slice(1))\n : undefined\n if (!base) {\n return undefined\n }\n const resolvedId = await resolveScriptFile(base)\n if (!resolvedId) {\n return undefined\n }\n return {\n from: request,\n resolvedId,\n sourceType: resolvedId.endsWith('.vue') ? 'wevu-sfc' : 'native',\n }\n },\n },\n autoImportTags: {\n enabled: Boolean(resolveAutoImportTag),\n resolveUsingComponent: async (tag, importer) => resolveAutoImportTag?.(tag, importer),\n },\n sfcSrc: {\n resolveId: async (request, importer) => {\n return resolveSfcSrc(request, importer!, srcRoot, resolveId)\n },\n },\n })\n state.sfcResults.set(filename, result)\n for (const dependency of result.meta?.sfcSrcDeps ?? []) {\n state.templatePathSet.add(dependency)\n }\n return result\n}\n\nexport async function ensureWebVueSfcResult(options: {\n filename: string\n meta: ModuleMeta\n srcRoot: string\n state: ScanState\n source?: string\n resolveId?: ResolveWebModuleId\n resolveAutoImportTag?: ResolveWebAutoImportTag\n uniApp?: { include: string[] }\n}) {\n const cached = options.state.sfcResults.get(options.filename)\n if (cached) {\n return cached\n }\n const source = options.source ?? await fs.readFile(options.filename, 'utf8')\n return await compileWebVueSfc({ ...options, source })\n}\n\nfunction getSfcRegisterName(kind: ModuleMeta['kind']) {\n return kind === 'app' ? 'registerWebWevuApp' : 'registerWebWevuComponent'\n}\n\nfunction getSfcFactoryName(kind: ModuleMeta['kind']) {\n return kind === 'app' ? 'createApp' : 'createWevuComponent'\n}\n\nfunction createRegisterMetaCode(meta: ModuleMeta, templateIdent?: string, styleIdent?: string) {\n const parts = [`id: ${JSON.stringify(meta.id)}`, `kind: ${JSON.stringify(meta.kind)}`]\n if (templateIdent) {\n parts.push(`template: ${templateIdent}`)\n }\n if (styleIdent) {\n parts.push(`style: ${styleIdent}`)\n }\n if (meta.navigationBar) {\n parts.push(`navigationBar: ${JSON.stringify(meta.navigationBar)}`)\n }\n return `{ ${parts.join(', ')} }`\n}\n\nexport async function transformWebVueSfcScript(options: {\n code: string\n filename: string\n meta: ModuleMeta\n runtimeModuleId: string\n styleLanguage: string\n enableHmr: boolean\n hmrAcceptCode?: string\n}) {\n const { code, filename, meta, runtimeModuleId, styleLanguage, enableHmr, hmrAcceptCode } = options\n const ast = parse(code, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n ranges: true,\n })\n const s = new MagicString(code)\n const templateIdent = meta.kind === 'app' ? undefined : '__weapp_sfc_template__'\n const styleIdent = meta.kind === 'app' ? undefined : '__weapp_sfc_style__'\n const registerName = getSfcRegisterName(meta.kind)\n const factoryName = getSfcFactoryName(meta.kind)\n const registerMetaCode = createRegisterMetaCode(meta, templateIdent, styleIdent)\n let transformed = false\n\n traverse(ast, {\n CallExpression(nodePath: NodePath<CallExpression>) {\n const callee = nodePath.node.callee\n if (!t.isIdentifier(callee, { name: factoryName })) {\n return\n }\n s.overwrite(callee.start!, callee.end!, registerName)\n s.appendLeft(nodePath.node.end! - 1, `, ${registerMetaCode}`)\n transformed = true\n },\n })\n\n if (!transformed) {\n throw new Error(`[@weapp-vite/web] Vue SFC 未生成 ${factoryName} 注册调用: ${filename}`)\n }\n\n const imports = [`import { ${registerName} } from '${runtimeModuleId}'`]\n if (templateIdent) {\n imports.push(`import ${templateIdent} from '${toRelativeImport(filename, filename)}?weapp-web-sfc-template'`)\n }\n if (styleIdent) {\n const styleFilename = `${filename}.${styleLanguage}`\n imports.push(`import ${styleIdent} from '${appendInlineQuery(`${toRelativeImport(filename, styleFilename)}?weapp-web-sfc-style`)}'`)\n }\n s.prepend(`${imports.join('\\n')}\\n`)\n if (enableHmr && hmrAcceptCode) {\n s.append(`\\n${hmrAcceptCode}\\n`)\n }\n const transpiled = await transform(s.toString(), {\n format: 'esm',\n legalComments: 'inline',\n loader: 'ts',\n sourcefile: filename,\n sourcemap: 'external',\n target: 'es2022',\n })\n return {\n code: transpiled.code,\n map: JSON.parse(transpiled.map),\n }\n}\n\nexport function generateWebVueSfcTemplate(\n result: VueTransformResult,\n meta: ModuleMeta,\n filename: string,\n srcRoot: string,\n) {\n const compiled = compileWxml({\n id: filename,\n source: result.template ?? '',\n navigationBar: meta.navigationBar ? { config: meta.navigationBar } : undefined,\n componentTags: meta.componentTags,\n resolveTemplatePath: (request, importer) => resolveTemplatePathSync(request, importer, srcRoot),\n resolveWxsPath: (request, importer) => resolveWxsPathSync(request, importer, srcRoot),\n })\n return compiled\n}\n\nexport function resolveWebVueSfcStyleLanguage(result: VueTransformResult, filename: string) {\n const languages = new Set(\n (result.meta?.styleBlocks ?? []).map(style => style.lang?.trim() || 'css'),\n )\n for (const language of languages) {\n if (!/^[a-z][a-z0-9-]*$/i.test(language)) {\n throw new Error(`[@weapp-vite/web] Vue SFC 样式语言无效: ${filename} -> ${language}`)\n }\n }\n const preprocessLanguages = [...languages].filter(language => language !== 'css')\n if (preprocessLanguages.length > 1) {\n throw new Error(`[@weapp-vite/web] Vue SFC 暂不支持混合样式语言: ${filename}`)\n }\n return preprocessLanguages[0] ?? 'css'\n}\n\nexport function generateWebVueSfcStyle(result: VueTransformResult) {\n return result.style ?? ''\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,WAAW;AAEjB,eAAe,cACb,SACA,UACA,SACA,WACA;CACA,IAAI,QAAQ,WAAW,IAAI,GACzB,OAAO,KAAK,QAAQ,SAAS,QAAQ,MAAM,CAAC,CAAC;CAE/C,IAAI,QAAQ,WAAW,GAAG,GACxB,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ,GAAG,OAAO;CAErD,IAAI,QAAQ,WAAW,GAAG,GACxB,OAAO,KAAK,QAAQ,SAAS,QAAQ,MAAM,CAAC,CAAC;CAE/C,OAAO,MAAM,YAAY,SAAS,QAAQ;AAC5C;AAEA,eAAsB,iBAAiB,SASpC;CACD,MAAM,EAAE,UAAU,MAAM,SAAS,OAAO,WAAW,sBAAsB,WAAW;CACpF,MAAM,SAAS,UAAU,0BAA0B,UAAU,SAAS,OAAO,OAAO,IAChF,sBAAsB,QAAQ,QAAQ;EAAE;EAAU,QAAQ;CAAK,CAAC,CAAC,CAAC,OAClE,QAAQ;CACZ,MAAM,SAAS,MAAM,eAAe,QAAQ,UAAU;EACpD,OAAO,KAAK,SAAS;EACrB,QAAQ,KAAK,SAAS;EACtB,WAAW;EACX,OAAO;GACL,uBAAuB;GACvB,iBAAiB;EACnB;EACA,MAAM,EAAE,MAAM,KAAK,KAAK;EACxB,qBAAqB;GACnB,SAAS;GACT,2BAA2B,OAAO,SAAS,aAAa;IACtD,MAAM,OAAO,QAAQ,WAAW,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appShell/container.ts
2
+ function onDocumentReady(callback) {
3
+ if (typeof document === "undefined") return;
4
+ if (document.readyState === "loading") {
5
+ document.addEventListener("DOMContentLoaded", callback, { once: true });
6
+ return;
7
+ }
8
+ callback();
9
+ }
10
+ function getAppContainer() {
11
+ if (typeof document === "undefined") return;
12
+ return document.querySelector("#app") ?? void 0;
13
+ }
14
+ function ensureAppContainer() {
15
+ const existing = getAppContainer();
16
+ if (existing || typeof document === "undefined" || !document.body) return existing;
17
+ const container = document.createElement("div");
18
+ container.setAttribute("id", "app");
19
+ document.body.append(container);
20
+ return container;
21
+ }
22
+
23
+ //#endregion
24
+ export { ensureAppContainer, getAppContainer, onDocumentReady };
25
+ //# sourceMappingURL=container.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.mjs","names":[],"sources":["../../../src/runtime/appShell/container.ts"],"sourcesContent":["export function onDocumentReady(callback: () => void) {\n if (typeof document === 'undefined') {\n return\n }\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', callback, { once: true })\n return\n }\n callback()\n}\n\nexport function getAppContainer() {\n if (typeof document === 'undefined') {\n return undefined\n }\n return document.querySelector('#app') as HTMLElement | null ?? undefined\n}\n\nexport function ensureAppContainer() {\n const existing = getAppContainer()\n if (existing || typeof document === 'undefined' || !document.body) {\n return existing\n }\n const container = document.createElement('div')\n container.setAttribute('id', 'app')\n document.body.append(container)\n return container\n}\n"],"mappings":";AAAA,SAAgB,gBAAgB,UAAsB;CACpD,IAAI,OAAO,aAAa,aACtB;CAEF,IAAI,SAAS,eAAe,WAAW;EACrC,SAAS,iBAAiB,oBAAoB,UAAU,EAAE,MAAM,KAAK,CAAC;EACtE;CACF;CACA,SAAS;AACX;AAEA,SAAgB,kBAAkB;CAChC,IAAI,OAAO,aAAa,aACtB;CAEF,OAAO,SAAS,cAAc,MAAM,KAA2B;AACjE;AAEA,SAAgB,qBAAqB;CACnC,MAAM,WAAW,gBAAgB;CACjC,IAAI,YAAY,OAAO,aAAa,eAAe,CAAC,SAAS,MAC3D,OAAO;CAET,MAAM,YAAY,SAAS,cAAc,KAAK;CAC9C,UAAU,aAAa,MAAM,KAAK;CAClC,SAAS,KAAK,OAAO,SAAS;CAC9B,OAAO;AACT"}
@@ -0,0 +1,192 @@
1
+ import { ensureAppContainer, getAppContainer, onDocumentReady } from "../container.mjs";
2
+ import { TAB_BAR_STYLE } from "./style.mjs";
3
+
4
+ //#region src/runtime/appShell/tabBar/index.ts
5
+ const TAB_BAR_TAG = "weapp-tab-bar";
6
+ const TAB_BAR_HEIGHT = "50px";
7
+ const BaseElement = globalThis.HTMLElement ?? class {};
8
+ let tabBarConfig;
9
+ let activeRoute = "";
10
+ let requestedVisible = true;
11
+ let animationEnabled = false;
12
+ let switchTabHandler;
13
+ let itemStates = [];
14
+ const instances = /* @__PURE__ */ new Set();
15
+ function resolveAssetUrl(value) {
16
+ if (!value || /^(?:data:|blob:|https?:\/\/|\/)/.test(value)) return value;
17
+ return `/${value.replace(/^\.\//, "")}`;
18
+ }
19
+ function isNativeTabBarVisible() {
20
+ return Boolean(tabBarConfig && !tabBarConfig.custom && requestedVisible && tabBarConfig.list.some((item) => item.pagePath === activeRoute));
21
+ }
22
+ function syncContainerInsets() {
23
+ const container = getAppContainer();
24
+ if (!container) return;
25
+ const bottomVisible = isNativeTabBarVisible() && tabBarConfig?.position !== "top";
26
+ const topVisible = isNativeTabBarVisible() && tabBarConfig?.position === "top";
27
+ container.style?.setProperty("--weapp-tab-bar-inset", bottomVisible ? `calc(${TAB_BAR_HEIGHT} + var(--weapp-safe-area-inset-bottom, 0px))` : "0px");
28
+ container.style?.setProperty("--weapp-tab-bar-top-inset", topVisible ? TAB_BAR_HEIGHT : "0px");
29
+ }
30
+ function updateInstances() {
31
+ syncContainerInsets();
32
+ for (const instance of instances) instance.renderTabBar();
33
+ }
34
+ function ensureTabBarMounted() {
35
+ onDocumentReady(() => {
36
+ const container = ensureAppContainer();
37
+ if (!container || tabBarConfig?.custom || !tabBarConfig) {
38
+ container?.querySelector(TAB_BAR_TAG)?.remove();
39
+ syncContainerInsets();
40
+ return;
41
+ }
42
+ let element = container.querySelector(TAB_BAR_TAG);
43
+ if (!element) {
44
+ element = document.createElement(TAB_BAR_TAG);
45
+ container.append(element);
46
+ }
47
+ element.renderTabBar();
48
+ });
49
+ }
50
+ function resolveItem(index) {
51
+ if (!Number.isInteger(index) || index < 0 || !tabBarConfig?.list[index]) return;
52
+ return tabBarConfig.list[index];
53
+ }
54
+ var WeappTabBar = class extends BaseElement {
55
+ connectedCallback() {
56
+ if (!this.shadowRoot) this.attachShadow({ mode: "open" });
57
+ instances.add(this);
58
+ this.renderTabBar();
59
+ }
60
+ disconnectedCallback() {
61
+ instances.delete(this);
62
+ }
63
+ renderTabBar() {
64
+ const root = this.shadowRoot;
65
+ const config = tabBarConfig;
66
+ if (!root || !config || config.custom) return;
67
+ this.toggleAttribute("hidden", !isNativeTabBarVisible());
68
+ this.setAttribute("position", config.position);
69
+ this.toggleAttribute("data-animation", animationEnabled);
70
+ this.style.setProperty("--weapp-tab-bar-color", config.color);
71
+ this.style.setProperty("--weapp-tab-bar-selected-color", config.selectedColor);
72
+ this.style.setProperty("--weapp-tab-bar-background", config.backgroundColor);
73
+ this.style.setProperty("--weapp-tab-bar-border-color", config.borderStyle === "white" ? "rgba(255, 255, 255, 0.33)" : "rgba(0, 0, 0, 0.33)");
74
+ root.replaceChildren(this.#createStyle(), this.#createBar(config));
75
+ }
76
+ #createStyle() {
77
+ const style = document.createElement("style");
78
+ style.textContent = TAB_BAR_STYLE;
79
+ return style;
80
+ }
81
+ #createBar(config) {
82
+ const bar = document.createElement("nav");
83
+ bar.className = "weapp-tab-bar";
84
+ bar.setAttribute("aria-label", "Tab bar");
85
+ for (const [index, item] of config.list.entries()) bar.append(this.#createItem(item, index));
86
+ return bar;
87
+ }
88
+ #createItem(item, index) {
89
+ const selected = item.pagePath === activeRoute;
90
+ const button = document.createElement("button");
91
+ button.type = "button";
92
+ button.className = "weapp-tab-bar__item";
93
+ button.dataset.index = String(index);
94
+ button.dataset.pagePath = item.pagePath;
95
+ if (selected) button.setAttribute("aria-current", "page");
96
+ const iconPath = resolveAssetUrl(selected ? item.selectedIconPath ?? item.iconPath : item.iconPath);
97
+ const state = itemStates[index];
98
+ if (iconPath || state?.badge || state?.redDot) {
99
+ const iconWrap = document.createElement("span");
100
+ iconWrap.className = "weapp-tab-bar__icon-wrap";
101
+ if (iconPath) {
102
+ const icon = document.createElement("img");
103
+ icon.className = "weapp-tab-bar__icon";
104
+ icon.src = iconPath;
105
+ icon.alt = "";
106
+ iconWrap.append(icon);
107
+ }
108
+ if (state?.badge || state?.redDot) {
109
+ const badge = document.createElement("span");
110
+ badge.className = state.redDot ? "weapp-tab-bar__badge weapp-tab-bar__badge--dot" : "weapp-tab-bar__badge";
111
+ badge.textContent = state.redDot ? "" : state.badge;
112
+ iconWrap.append(badge);
113
+ }
114
+ button.append(iconWrap);
115
+ }
116
+ const label = document.createElement("span");
117
+ label.className = "weapp-tab-bar__label";
118
+ label.textContent = item.text;
119
+ button.append(label);
120
+ button.addEventListener("click", () => {
121
+ if (selected || !switchTabHandler) return;
122
+ switchTabHandler(`/${item.pagePath}`).catch(() => {});
123
+ });
124
+ return button;
125
+ }
126
+ };
127
+ function ensureTabBarDefined() {
128
+ if (typeof customElements === "undefined" || customElements.get(TAB_BAR_TAG)) return;
129
+ customElements.define(TAB_BAR_TAG, WeappTabBar);
130
+ }
131
+ function configureTabBar(config, onSwitchTab) {
132
+ ensureTabBarDefined();
133
+ tabBarConfig = config ? {
134
+ ...config,
135
+ list: config.list.map((item) => ({ ...item }))
136
+ } : void 0;
137
+ switchTabHandler = onSwitchTab;
138
+ itemStates = config?.list.map(() => ({})) ?? [];
139
+ requestedVisible = true;
140
+ animationEnabled = false;
141
+ ensureTabBarMounted();
142
+ updateInstances();
143
+ }
144
+ function getTabBarPagePaths() {
145
+ return new Set(tabBarConfig?.list.map((item) => item.pagePath) ?? []);
146
+ }
147
+ function syncTabBarRoute(route) {
148
+ activeRoute = route;
149
+ ensureTabBarMounted();
150
+ updateInstances();
151
+ }
152
+ function setTabBarVisible(visible, animation = false) {
153
+ requestedVisible = visible;
154
+ animationEnabled = animation;
155
+ updateInstances();
156
+ return true;
157
+ }
158
+ function updateTabBarItem(index, patch) {
159
+ const item = resolveItem(index);
160
+ if (!item) return false;
161
+ Object.assign(item, patch);
162
+ updateInstances();
163
+ return true;
164
+ }
165
+ function updateTabBarStyle(patch) {
166
+ if (!tabBarConfig) return false;
167
+ Object.assign(tabBarConfig, patch);
168
+ updateInstances();
169
+ return true;
170
+ }
171
+ function setTabBarBadgeState(index, badge) {
172
+ if (!resolveItem(index)) return false;
173
+ itemStates[index] = {
174
+ badge,
175
+ redDot: false
176
+ };
177
+ updateInstances();
178
+ return true;
179
+ }
180
+ function setTabBarRedDotState(index, redDot) {
181
+ if (!resolveItem(index)) return false;
182
+ itemStates[index] = {
183
+ redDot,
184
+ badge: void 0
185
+ };
186
+ updateInstances();
187
+ return true;
188
+ }
189
+
190
+ //#endregion
191
+ export { configureTabBar, ensureTabBarDefined, getTabBarPagePaths, setTabBarBadgeState, setTabBarRedDotState, setTabBarVisible, syncTabBarRoute, updateTabBarItem, updateTabBarStyle };
192
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["#createStyle","#createBar","#createItem"],"sources":["../../../../src/runtime/appShell/tabBar/index.ts"],"sourcesContent":["import type { WebTabBarConfig, WebTabBarItem } from '../../../shared/tabBar'\nimport { ensureAppContainer, getAppContainer, onDocumentReady } from '../container'\nimport { TAB_BAR_STYLE } from './style'\n\ninterface TabBarItemState {\n badge?: string\n redDot?: boolean\n}\n\ntype SwitchTabHandler = (url: string) => Promise<unknown>\n\nconst TAB_BAR_TAG = 'weapp-tab-bar'\nconst TAB_BAR_HEIGHT = '50px'\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\n\nlet tabBarConfig: WebTabBarConfig | undefined\nlet activeRoute = ''\nlet requestedVisible = true\nlet animationEnabled = false\nlet switchTabHandler: SwitchTabHandler | undefined\nlet itemStates: TabBarItemState[] = []\nconst instances = new Set<WeappTabBar>()\n\nfunction resolveAssetUrl(value: string | undefined) {\n if (!value || /^(?:data:|blob:|https?:\\/\\/|\\/)/.test(value)) {\n return value\n }\n return `/${value.replace(/^\\.\\//, '')}`\n}\n\nfunction isNativeTabBarVisible() {\n return Boolean(\n tabBarConfig\n && !tabBarConfig.custom\n && requestedVisible\n && tabBarConfig.list.some(item => item.pagePath === activeRoute),\n )\n}\n\nfunction syncContainerInsets() {\n const container = getAppContainer()\n if (!container) {\n return\n }\n const bottomVisible = isNativeTabBarVisible() && tabBarConfig?.position !== 'top'\n const topVisible = isNativeTabBarVisible() && tabBarConfig?.position === 'top'\n container.style?.setProperty(\n '--weapp-tab-bar-inset',\n bottomVisible ? `calc(${TAB_BAR_HEIGHT} + var(--weapp-safe-area-inset-bottom, 0px))` : '0px',\n )\n container.style?.setProperty('--weapp-tab-bar-top-inset', topVisible ? TAB_BAR_HEIGHT : '0px')\n}\n\nfunction updateInstances() {\n syncContainerInsets()\n for (const instance of instances) {\n instance.renderTabBar()\n }\n}\n\nfunction ensureTabBarMounted() {\n onDocumentReady(() => {\n const container = ensureAppContainer()\n if (!container || tabBarConfig?.custom || !tabBarConfig) {\n container?.querySelector(TAB_BAR_TAG)?.remove()\n syncContainerInsets()\n return\n }\n let element = container.querySelector(TAB_BAR_TAG) as WeappTabBar | null\n if (!element) {\n element = document.createElement(TAB_BAR_TAG) as WeappTabBar\n container.append(element)\n }\n element.renderTabBar()\n })\n}\n\nfunction resolveItem(index: number) {\n if (!Number.isInteger(index) || index < 0 || !tabBarConfig?.list[index]) {\n return undefined\n }\n return tabBarConfig.list[index]\n}\n\nclass WeappTabBar extends BaseElement {\n connectedCallback() {\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' })\n }\n instances.add(this)\n this.renderTabBar()\n }\n\n disconnectedCallback() {\n instances.delete(this)\n }\n\n renderTabBar() {\n const root = this.shadowRoot\n const config = tabBarConfig\n if (!root || !config || config.custom) {\n return\n }\n this.toggleAttribute('hidden', !isNativeTabBarVisible())\n this.setAttribute('position', config.position)\n this.toggleAttribute('data-animation', animationEnabled)\n this.style.setProperty('--weapp-tab-bar-color', config.color)\n this.style.setProperty('--weapp-tab-bar-selected-color', config.selectedColor)\n this.style.setProperty('--weapp-tab-bar-background', config.backgroundColor)\n this.style.setProperty(\n '--weapp-tab-bar-border-color',\n config.borderStyle === 'white' ? 'rgba(255, 255, 255, 0.33)' : 'rgba(0, 0, 0, 0.33)',\n )\n root.replaceChildren(this.#createStyle(), this.#createBar(config))\n }\n\n #createStyle() {\n const style = document.createElement('style')\n style.textContent = TAB_BAR_STYLE\n return style\n }\n\n #createBar(config: WebTabBarConfig) {\n const bar = document.createElement('nav')\n bar.className = 'weapp-tab-bar'\n bar.setAttribute('aria-label', 'Tab bar')\n for (const [index, item] of config.list.entries()) {\n bar.append(this.#createItem(item, index))\n }\n return bar\n }\n\n #createItem(item: WebTabBarItem, index: number) {\n const selected = item.pagePath === activeRoute\n const button = document.createElement('button')\n button.type = 'button'\n button.className = 'weapp-tab-bar__item'\n button.dataset.index = String(index)\n button.dataset.pagePath = item.pagePath\n if (selected) {\n button.setAttribute('aria-current', 'page')\n }\n const iconPath = resolveAssetUrl(selected ? (item.selectedIconPath ?? item.iconPath) : item.iconPath)\n const state = itemStates[index]\n if (iconPath || state?.badge || state?.redDot) {\n const iconWrap = document.createElement('span')\n iconWrap.className = 'weapp-tab-bar__icon-wrap'\n if (iconPath) {\n const icon = document.createElement('img')\n icon.className = 'weapp-tab-bar__icon'\n icon.src = iconPath\n icon.alt = ''\n iconWrap.append(icon)\n }\n if (state?.badge || state?.redDot) {\n const badge = document.createElement('span')\n badge.className = state.redDot\n ? 'weapp-tab-bar__badge weapp-tab-bar__badge--dot'\n : 'weapp-tab-bar__badge'\n badge.textContent = state.redDot ? '' : state.badge!\n iconWrap.append(badge)\n }\n button.append(iconWrap)\n }\n const label = document.createElement('span')\n label.className = 'weapp-tab-bar__label'\n label.textContent = item.text\n button.append(label)\n button.addEventListener('click', () => {\n if (selected || !switchTabHandler) {\n return\n }\n void switchTabHandler(`/${item.pagePath}`).catch(() => {})\n })\n return button\n }\n}\n\nexport function ensureTabBarDefined() {\n if (typeof customElements === 'undefined' || customElements.get(TAB_BAR_TAG)) {\n return\n }\n customElements.define(TAB_BAR_TAG, WeappTabBar)\n}\n\nexport function configureTabBar(config: WebTabBarConfig | undefined, onSwitchTab: SwitchTabHandler) {\n ensureTabBarDefined()\n tabBarConfig = config\n ? {\n ...config,\n list: config.list.map(item => ({ ...item })),\n }\n : undefined\n switchTabHandler = onSwitchTab\n itemStates = config?.list.map(() => ({})) ?? []\n requestedVisible = true\n animationEnabled = false\n ensureTabBarMounted()\n updateInstances()\n}\n\nexport function getTabBarPagePaths() {\n return new Set(tabBarConfig?.list.map(item => item.pagePath) ?? [])\n}\n\nexport function syncTabBarRoute(route: string) {\n activeRoute = route\n ensureTabBarMounted()\n updateInstances()\n}\n\nexport function setTabBarVisible(visible: boolean, animation = false) {\n requestedVisible = visible\n animationEnabled = animation\n updateInstances()\n return true\n}\n\nexport function updateTabBarItem(index: number, patch: Partial<Omit<WebTabBarItem, 'pagePath'>>) {\n const item = resolveItem(index)\n if (!item) {\n return false\n }\n Object.assign(item, patch)\n updateInstances()\n return true\n}\n\nexport function updateTabBarStyle(patch: Partial<Pick<WebTabBarConfig, 'color' | 'selectedColor' | 'backgroundColor' | 'borderStyle'>>) {\n if (!tabBarConfig) {\n return false\n }\n Object.assign(tabBarConfig, patch)\n updateInstances()\n return true\n}\n\nexport function setTabBarBadgeState(index: number, badge: string | undefined) {\n if (!resolveItem(index)) {\n return false\n }\n itemStates[index] = { badge, redDot: false }\n updateInstances()\n return true\n}\n\nexport function setTabBarRedDotState(index: number, redDot: boolean) {\n if (!resolveItem(index)) {\n return false\n }\n itemStates[index] = { redDot, badge: undefined }\n updateInstances()\n return true\n}\n\nexport type { WebTabBarConfig, WebTabBarItem } from '../../../shared/tabBar'\n"],"mappings":";;;;AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AAEtD,IAAI;AACJ,IAAI,cAAc;AAClB,IAAI,mBAAmB;AACvB,IAAI,mBAAmB;AACvB,IAAI;AACJ,IAAI,aAAgC,CAAC;AACrC,MAAM,4BAAY,IAAI,IAAiB;AAEvC,SAAS,gBAAgB,OAA2B;CAClD,IAAI,CAAC,SAAS,kCAAkC,KAAK,KAAK,GACxD,OAAO;CAET,OAAO,IAAI,MAAM,QAAQ,SAAS,EAAE;AACtC;AAEA,SAAS,wBAAwB;CAC/B,OAAO,QACL,gBACG,CAAC,aAAa,UACd,oBACA,aAAa,KAAK,MAAK,SAAQ,KAAK,aAAa,WAAW,CACjE;AACF;AAEA,SAAS,sBAAsB;CAC7B,MAAM,YAAY,gBAAgB;CAClC,IAAI,CAAC,WACH;CAEF,MAAM,gBAAgB,sBAAsB,KAAK,cAAc,aAAa;CAC5E,MAAM,aAAa,sBAAsB,KAAK,cAAc,aAAa;CACzE,UAAU,OAAO,YACf,yBACA,gBAAgB,QAAQ,eAAe,gDAAgD,KACzF;CACA,UAAU,OAAO,YAAY,6BAA6B,aAAa,iBAAiB,KAAK;AAC/F;AAEA,SAAS,kBAAkB;CACzB,oBAAoB;CACpB,KAAK,MAAM,YAAY,WACrB,SAAS,aAAa;AAE1B;AAEA,SAAS,sBAAsB;CAC7B,sBAAsB;EACpB,MAAM,YAAY,mBAAmB;EACrC,IAAI,CAAC,aAAa,cAAc,UAAU,CAAC,cAAc;GACvD,WAAW,cAAc,WAAW,CAAC,EAAE,OAAO;GAC9C,oBAAoB;GACpB;EACF;EACA,IAAI,UAAU,UAAU,cAAc,WAAW;EACjD,IAAI,CAAC,SAAS;GACZ,UAAU,SAAS,cAAc,WAAW;GAC5C,UAA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