@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,176 @@
1
+ //#region src/runtime/nativeComponents/icon/style.ts
2
+ const ICON_SHADOW_STYLE = `
3
+ :host {
4
+ width: var(--weapp-icon-size);
5
+ height: var(--weapp-icon-size);
6
+ color: var(--weapp-icon-color);
7
+ line-height: 1;
8
+ }
9
+
10
+ .icon {
11
+ position: relative;
12
+ display: block;
13
+ box-sizing: border-box;
14
+ width: 100%;
15
+ height: 100%;
16
+ color: inherit;
17
+ }
18
+
19
+ .icon::before,
20
+ .icon::after {
21
+ position: absolute;
22
+ box-sizing: border-box;
23
+ content: '';
24
+ }
25
+
26
+ .success,
27
+ .info,
28
+ .warn,
29
+ .cancel,
30
+ .clear {
31
+ background: currentColor;
32
+ border-radius: 50%;
33
+ }
34
+
35
+ .success::before,
36
+ .success_no_circle::before {
37
+ top: 24%;
38
+ left: 27%;
39
+ width: 47%;
40
+ height: 29%;
41
+ border-bottom: max(1px, calc(var(--weapp-icon-size) * 0.09)) solid currentColor;
42
+ border-left: max(1px, calc(var(--weapp-icon-size) * 0.09)) solid currentColor;
43
+ transform: rotate(-45deg);
44
+ }
45
+
46
+ .success::before {
47
+ color: #fff;
48
+ }
49
+
50
+ .info::before {
51
+ top: 20%;
52
+ left: 46%;
53
+ width: 8%;
54
+ height: 13%;
55
+ background: #fff;
56
+ border-radius: 50%;
57
+ }
58
+
59
+ .info::after {
60
+ top: 39%;
61
+ left: 46%;
62
+ width: 8%;
63
+ height: 40%;
64
+ background: #fff;
65
+ border-radius: 999px;
66
+ }
67
+
68
+ .warn::before {
69
+ top: 18%;
70
+ left: 46%;
71
+ width: 8%;
72
+ height: 43%;
73
+ background: #fff;
74
+ border-radius: 999px;
75
+ }
76
+
77
+ .warn::after {
78
+ bottom: 19%;
79
+ left: 46%;
80
+ width: 8%;
81
+ height: 8%;
82
+ background: #fff;
83
+ border-radius: 50%;
84
+ }
85
+
86
+ .waiting {
87
+ border: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;
88
+ border-radius: 50%;
89
+ }
90
+
91
+ .waiting::before {
92
+ top: 20%;
93
+ left: 46%;
94
+ width: max(1px, calc(var(--weapp-icon-size) * 0.07));
95
+ height: 33%;
96
+ background: currentColor;
97
+ border-radius: 999px;
98
+ transform-origin: 50% 90%;
99
+ }
100
+
101
+ .waiting::after {
102
+ top: 47%;
103
+ left: 48%;
104
+ width: 29%;
105
+ height: max(1px, calc(var(--weapp-icon-size) * 0.07));
106
+ background: currentColor;
107
+ border-radius: 999px;
108
+ transform: rotate(28deg);
109
+ transform-origin: 0 50%;
110
+ }
111
+
112
+ .cancel::before,
113
+ .cancel::after,
114
+ .clear::before,
115
+ .clear::after {
116
+ top: 46%;
117
+ left: 24%;
118
+ width: 52%;
119
+ height: max(1px, calc(var(--weapp-icon-size) * 0.08));
120
+ background: #fff;
121
+ border-radius: 999px;
122
+ }
123
+
124
+ .cancel::before,
125
+ .clear::before {
126
+ transform: rotate(45deg);
127
+ }
128
+
129
+ .cancel::after,
130
+ .clear::after {
131
+ transform: rotate(-45deg);
132
+ }
133
+
134
+ .download::before {
135
+ top: 7%;
136
+ left: 46%;
137
+ width: 8%;
138
+ height: 59%;
139
+ background: currentColor;
140
+ border-radius: 999px;
141
+ }
142
+
143
+ .download::after {
144
+ top: 38%;
145
+ left: 27%;
146
+ width: 46%;
147
+ height: 46%;
148
+ border-right: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;
149
+ border-bottom: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;
150
+ transform: rotate(45deg);
151
+ }
152
+
153
+ .search::before {
154
+ top: 8%;
155
+ left: 8%;
156
+ width: 64%;
157
+ height: 64%;
158
+ border: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;
159
+ border-radius: 50%;
160
+ }
161
+
162
+ .search::after {
163
+ right: 5%;
164
+ bottom: 10%;
165
+ width: 37%;
166
+ height: max(1px, calc(var(--weapp-icon-size) * 0.08));
167
+ background: currentColor;
168
+ border-radius: 999px;
169
+ transform: rotate(45deg);
170
+ transform-origin: 100% 50%;
171
+ }
172
+ `;
173
+
174
+ //#endregion
175
+ export { ICON_SHADOW_STYLE };
176
+ //# sourceMappingURL=style.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../../../src/runtime/nativeComponents/icon/style.ts"],"sourcesContent":["export const ICON_SHADOW_STYLE = `\n :host {\n width: var(--weapp-icon-size);\n height: var(--weapp-icon-size);\n color: var(--weapp-icon-color);\n line-height: 1;\n }\n\n .icon {\n position: relative;\n display: block;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n color: inherit;\n }\n\n .icon::before,\n .icon::after {\n position: absolute;\n box-sizing: border-box;\n content: '';\n }\n\n .success,\n .info,\n .warn,\n .cancel,\n .clear {\n background: currentColor;\n border-radius: 50%;\n }\n\n .success::before,\n .success_no_circle::before {\n top: 24%;\n left: 27%;\n width: 47%;\n height: 29%;\n border-bottom: max(1px, calc(var(--weapp-icon-size) * 0.09)) solid currentColor;\n border-left: max(1px, calc(var(--weapp-icon-size) * 0.09)) solid currentColor;\n transform: rotate(-45deg);\n }\n\n .success::before {\n color: #fff;\n }\n\n .info::before {\n top: 20%;\n left: 46%;\n width: 8%;\n height: 13%;\n background: #fff;\n border-radius: 50%;\n }\n\n .info::after {\n top: 39%;\n left: 46%;\n width: 8%;\n height: 40%;\n background: #fff;\n border-radius: 999px;\n }\n\n .warn::before {\n top: 18%;\n left: 46%;\n width: 8%;\n height: 43%;\n background: #fff;\n border-radius: 999px;\n }\n\n .warn::after {\n bottom: 19%;\n left: 46%;\n width: 8%;\n height: 8%;\n background: #fff;\n border-radius: 50%;\n }\n\n .waiting {\n border: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;\n border-radius: 50%;\n }\n\n .waiting::before {\n top: 20%;\n left: 46%;\n width: max(1px, calc(var(--weapp-icon-size) * 0.07));\n height: 33%;\n background: currentColor;\n border-radius: 999px;\n transform-origin: 50% 90%;\n }\n\n .waiting::after {\n top: 47%;\n left: 48%;\n width: 29%;\n height: max(1px, calc(var(--weapp-icon-size) * 0.07));\n background: currentColor;\n border-radius: 999px;\n transform: rotate(28deg);\n transform-origin: 0 50%;\n }\n\n .cancel::before,\n .cancel::after,\n .clear::before,\n .clear::after {\n top: 46%;\n left: 24%;\n width: 52%;\n height: max(1px, calc(var(--weapp-icon-size) * 0.08));\n background: #fff;\n border-radius: 999px;\n }\n\n .cancel::before,\n .clear::before {\n transform: rotate(45deg);\n }\n\n .cancel::after,\n .clear::after {\n transform: rotate(-45deg);\n }\n\n .download::before {\n top: 7%;\n left: 46%;\n width: 8%;\n height: 59%;\n background: currentColor;\n border-radius: 999px;\n }\n\n .download::after {\n top: 38%;\n left: 27%;\n width: 46%;\n height: 46%;\n border-right: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;\n border-bottom: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;\n transform: rotate(45deg);\n }\n\n .search::before {\n top: 8%;\n left: 8%;\n width: 64%;\n height: 64%;\n border: max(1px, calc(var(--weapp-icon-size) * 0.08)) solid currentColor;\n border-radius: 50%;\n }\n\n .search::after {\n right: 5%;\n bottom: 10%;\n width: 37%;\n height: max(1px, calc(var(--weapp-icon-size) * 0.08));\n background: currentColor;\n border-radius: 999px;\n transform: rotate(45deg);\n transform-origin: 100% 50%;\n }\n`\n"],"mappings":";AAAA,MAAa,oBAAoB"}
@@ -0,0 +1,8 @@
1
+ //#region src/runtime/nativeComponents/image.d.ts
2
+ declare function resolveImageModeStyle(mode: string | null): {
3
+ fit: string;
4
+ position: string;
5
+ };
6
+ //#endregion
7
+ export { resolveImageModeStyle };
8
+ //# sourceMappingURL=image.d.mts.map
@@ -0,0 +1,121 @@
1
+ import { getNativeComponentDescriptor } from "../../shared/nativeComponents.mjs";
2
+ import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from "./helpers.mjs";
3
+ import { ensureNativeComponentStyle } from "./style.mjs";
4
+
5
+ //#region src/runtime/nativeComponents/image.ts
6
+ const BaseElement = globalThis.HTMLElement ?? class {};
7
+ const IMAGE_MODE_STYLES = {
8
+ "scaleToFill": {
9
+ fit: "fill",
10
+ position: "center"
11
+ },
12
+ "aspectFit": {
13
+ fit: "contain",
14
+ position: "center"
15
+ },
16
+ "aspectFill": {
17
+ fit: "cover",
18
+ position: "center"
19
+ },
20
+ "top": {
21
+ fit: "none",
22
+ position: "top"
23
+ },
24
+ "bottom": {
25
+ fit: "none",
26
+ position: "bottom"
27
+ },
28
+ "center": {
29
+ fit: "none",
30
+ position: "center"
31
+ },
32
+ "left": {
33
+ fit: "none",
34
+ position: "left"
35
+ },
36
+ "right": {
37
+ fit: "none",
38
+ position: "right"
39
+ },
40
+ "top left": {
41
+ fit: "none",
42
+ position: "left top"
43
+ },
44
+ "top right": {
45
+ fit: "none",
46
+ position: "right top"
47
+ },
48
+ "bottom left": {
49
+ fit: "none",
50
+ position: "left bottom"
51
+ },
52
+ "bottom right": {
53
+ fit: "none",
54
+ position: "right bottom"
55
+ }
56
+ };
57
+ function resolveImageModeStyle(mode) {
58
+ return IMAGE_MODE_STYLES[mode ?? "scaleToFill"] ?? IMAGE_MODE_STYLES.scaleToFill;
59
+ }
60
+ var WeappImage = class extends BaseElement {
61
+ static observedAttributes = [...getNativeComponentDescriptor("image").attributes];
62
+ #image;
63
+ connectedCallback() {
64
+ ensureNativeComponentStyle(resolveContainingShadowRoot(this));
65
+ this.#ensureStructure();
66
+ this.#syncAttributes();
67
+ }
68
+ attributeChangedCallback() {
69
+ this.#syncAttributes();
70
+ }
71
+ #ensureStructure() {
72
+ if (this.#image || typeof document === "undefined") return;
73
+ const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
74
+ const style = document.createElement("style");
75
+ style.textContent = `
76
+ :host { position: relative; }
77
+ img { display: block; width: 100%; height: 100%; }
78
+ `;
79
+ const image = document.createElement("img");
80
+ image.addEventListener("load", () => {
81
+ dispatchMiniProgramEvent(this, "load", {
82
+ width: image.naturalWidth,
83
+ height: image.naturalHeight
84
+ });
85
+ });
86
+ image.addEventListener("error", () => {
87
+ dispatchMiniProgramEvent(this, "error", { errMsg: "image load failed" }, {
88
+ bubbles: false,
89
+ composed: false
90
+ });
91
+ });
92
+ root.append(style, image);
93
+ this.#image = image;
94
+ }
95
+ #syncAttributes() {
96
+ if (!this.#image) return;
97
+ this.#image.src = this.getAttribute("src") ?? "";
98
+ this.#image.alt = this.getAttribute("alt") ?? "";
99
+ this.#image.loading = readBooleanAttribute(this, "lazy-load") ? "lazy" : "eager";
100
+ const mode = this.getAttribute("mode") ?? "scaleToFill";
101
+ const modeStyle = resolveImageModeStyle(mode);
102
+ this.#image.style.objectFit = modeStyle.fit;
103
+ this.#image.style.objectPosition = modeStyle.position;
104
+ this.toggleAttribute("data-width-fix", mode === "widthFix");
105
+ this.toggleAttribute("data-height-fix", mode === "heightFix");
106
+ if (mode === "widthFix") {
107
+ this.#image.style.height = "auto";
108
+ this.style.height = "auto";
109
+ } else if (mode === "heightFix") {
110
+ this.#image.style.width = "auto";
111
+ this.style.width = "auto";
112
+ } else {
113
+ this.#image.style.width = "100%";
114
+ this.#image.style.height = "100%";
115
+ }
116
+ }
117
+ };
118
+
119
+ //#endregion
120
+ export { WeappImage, resolveImageModeStyle };
121
+ //# sourceMappingURL=image.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.mjs","names":["#ensureStructure","#syncAttributes","#image"],"sources":["../../../src/runtime/nativeComponents/image.ts"],"sourcesContent":["import { getNativeComponentDescriptor } from '../../shared/nativeComponents'\nimport { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot } from './helpers'\nimport { ensureNativeComponentStyle } from './style'\n\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\n\nconst IMAGE_MODE_STYLES: Record<string, { fit: string, position: string }> = {\n 'scaleToFill': { fit: 'fill', position: 'center' },\n 'aspectFit': { fit: 'contain', position: 'center' },\n 'aspectFill': { fit: 'cover', position: 'center' },\n 'top': { fit: 'none', position: 'top' },\n 'bottom': { fit: 'none', position: 'bottom' },\n 'center': { fit: 'none', position: 'center' },\n 'left': { fit: 'none', position: 'left' },\n 'right': { fit: 'none', position: 'right' },\n 'top left': { fit: 'none', position: 'left top' },\n 'top right': { fit: 'none', position: 'right top' },\n 'bottom left': { fit: 'none', position: 'left bottom' },\n 'bottom right': { fit: 'none', position: 'right bottom' },\n}\n\nexport function resolveImageModeStyle(mode: string | null) {\n return IMAGE_MODE_STYLES[mode ?? 'scaleToFill'] ?? IMAGE_MODE_STYLES.scaleToFill!\n}\n\nexport class WeappImage extends BaseElement {\n static observedAttributes = [...getNativeComponentDescriptor('image')!.attributes]\n\n #image?: HTMLImageElement\n\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n this.#ensureStructure()\n this.#syncAttributes()\n }\n\n attributeChangedCallback() {\n this.#syncAttributes()\n }\n\n #ensureStructure() {\n if (this.#image || typeof document === 'undefined') {\n return\n }\n const root = this.shadowRoot ?? this.attachShadow({ mode: 'open' })\n const style = document.createElement('style')\n style.textContent = `\n :host { position: relative; }\n img { display: block; width: 100%; height: 100%; }\n `\n const image = document.createElement('img')\n image.addEventListener('load', () => {\n dispatchMiniProgramEvent(this, 'load', {\n width: image.naturalWidth,\n height: image.naturalHeight,\n })\n })\n image.addEventListener('error', () => {\n dispatchMiniProgramEvent(this, 'error', { errMsg: 'image load failed' }, {\n bubbles: false,\n composed: false,\n })\n })\n root.append(style, image)\n this.#image = image\n }\n\n #syncAttributes() {\n if (!this.#image) {\n return\n }\n this.#image.src = this.getAttribute('src') ?? ''\n this.#image.alt = this.getAttribute('alt') ?? ''\n this.#image.loading = readBooleanAttribute(this, 'lazy-load') ? 'lazy' : 'eager'\n const mode = this.getAttribute('mode') ?? 'scaleToFill'\n const modeStyle = resolveImageModeStyle(mode)\n this.#image.style.objectFit = modeStyle.fit\n this.#image.style.objectPosition = modeStyle.position\n this.toggleAttribute('data-width-fix', mode === 'widthFix')\n this.toggleAttribute('data-height-fix', mode === 'heightFix')\n if (mode === 'widthFix') {\n this.#image.style.height = 'auto'\n this.style.height = 'auto'\n }\n else if (mode === 'heightFix') {\n this.#image.style.width = 'auto'\n this.style.width = 'auto'\n }\n else {\n this.#image.style.width = '100%'\n this.#image.style.height = '100%'\n }\n }\n}\n"],"mappings":";;;;;AAIA,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AAEtD,MAAM,oBAAuE;CAC3E,eAAe;EAAE,KAAK;EAAQ,UAAU;CAAS;CACjD,aAAa;EAAE,KAAK;EAAW,UAAU;CAAS;CAClD,cAAc;EAAE,KAAK;EAAS,UAAU;CAAS;CACjD,OAAO;EAAE,KAAK;EAAQ,UAAU;CAAM;CACtC,UAAU;EAAE,KAAK;EAAQ,UAAU;CAAS;CAC5C,UAAU;EAAE,KAAK;EAAQ,UAAU;CAAS;CAC5C,QAAQ;EAAE,KAAK;EAAQ,UAAU;CAAO;CACxC,SAAS;EAAE,KAAK;EAAQ,UAAU;CAAQ;CAC1C,YAAY;EAAE,KAAK;EAAQ,UAAU;CAAW;CAChD,aAAa;EAAE,KAAK;EAAQ,UAAU;CAAY;CAClD,eAAe;EAAE,KAAK;EAAQ,UAAU;CAAc;CACtD,gBAAgB;EAAE,KAAK;EAAQ,UAAU;CAAe;AAC1D;AAEA,SAAgB,sBAAsB,MAAqB;CACzD,OAAO,kBAAkB,QAAQ,kBAAkB,kBAAkB;AACvE;AAEA,IAAa,aAAb,cAAgC,YAAY;CAC1C,OAAO,qBAAqB,CAAC,GAAG,6BAA6B,OAAO,CAAC,CAAE,UAAU;CAEjF;CAEA,oBAAoB;EAClB,2BAA2B,4BAA4B,IAAI,CAAC;EAC5D,KAAKA,iBAAiB;EACtB,KAAKC,gBAAgB;CACvB;CAEA,2BAA2B;EACzB,KAAKA,gBAAgB;CACvB;CAEA,mBAAmB;EACjB,IAAI,KAAKC,UAAU,OAAO,aAAa,aACrC;EAEF,MAAM,OAAO,KAAK,cAAc,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;EAClE,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,cAAc;;;;EAIpB,MAAM,QAAQ,SAAS,cAAc,KAAK;EAC1C,MAAM,iBAAiB,cAAc;GACnC,yBAAyB,MAAM,QAAQ;IACrC,OAAO,MAAM;IACb,QAAQ,MAAM;GAChB,CAAC;EACH,CAAC;EACD,MAAM,iBAAiB,eAAe;GACpC,yBAAyB,MAAM,SAAS,EAAE,QAAQ,oBAAoB,GAAG;IACvE,SAAS;IACT,UAAU;GACZ,CAAC;EACH,CAAC;EACD,KAAK,OAAO,OAAO,KAAK;EACxB,KAAKA,SAAS;CAChB;CAEA,kBAAkB;EAChB,IAAI,CAAC,KAAKA,QACR;EAEF,KAAKA,OAAO,MAAM,KAAK,aAAa,KAAK,KAAK;EAC9C,KAAKA,OAAO,MAAM,KAAK,aAAa,KAAK,KAAK;EAC9C,KAAKA,OAAO,UAAU,qBAAqB,MAAM,WAAW,IAAI,SAAS;EACzE,MAAM,OAAO,KAAK,aAAa,MAAM,KAAK;EAC1C,MAAM,YAAY,sBAAsB,IAAI;EAC5C,KAAKA,OAAO,MAAM,YAAY,UAAU;EACxC,KAAKA,OAAO,MAAM,iBAAiB,UAAU;EAC7C,KAAK,gBAAgB,kBAAkB,SAAS,UAAU;EAC1D,KAAK,gBAAgB,mBAAmB,SAAS,WAAW;EAC5D,IAAI,SAAS,YAAY;GACvB,KAAKA,OAAO,MAAM,SAAS;GAC3B,KAAK,MAAM,SAAS;EACtB,OACK,IAAI,SAAS,aAAa;GAC7B,KAAKA,OAAO,MAAM,QAAQ;GAC1B,KAAK,MAAM,QAAQ;EACrB,OACK;GACH,KAAKA,OAAO,MAAM,QAAQ;GAC1B,KAAKA,OAAO,MAAM,SAAS;EAC7B;CACF;AACF"}
@@ -0,0 +1,11 @@
1
+ import { resolveImageModeStyle } from "./image.mjs";
2
+ import { createInputEventDetail } from "./input.mjs";
3
+ import { createScrollEventDetail } from "./scrollView.mjs";
4
+ import { createSwitchEventDetail } from "./switch.mjs";
5
+ import { createTextareaLineChangeDetail } from "./textarea.mjs";
6
+ import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./video/helpers.mjs";
7
+ //#region src/runtime/nativeComponents/index.d.ts
8
+ declare function ensureNativeComponentsDefined(): void;
9
+ //#endregion
10
+ export { createInputEventDetail, createScrollEventDetail, createSwitchEventDetail, createTextareaLineChangeDetail, createVideoProgressDetail, createVideoTimeUpdateDetail, ensureNativeComponentsDefined, resolveImageModeStyle, resolveVideoObjectFit };
11
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,83 @@
1
+ import { NATIVE_COMPONENT_DESCRIPTORS } from "../../shared/nativeComponents.mjs";
2
+ import { collectFormControlValues } from "./formControl.mjs";
3
+ import { NATIVE_COMPONENT_STYLE } from "./style.mjs";
4
+ import { WeappForm } from "./form.mjs";
5
+ import { WeappButton } from "../button/index.mjs";
6
+ import { WeappCanvas } from "./canvas/index.mjs";
7
+ import { WeappCheckbox, WeappCheckboxGroup, collectCheckboxGroupValue } from "./checkbox.mjs";
8
+ import { WeappImage, resolveImageModeStyle } from "./image.mjs";
9
+ import { WeappText, WeappView } from "./primitives.mjs";
10
+ import { WeappCoverImage, WeappCoverView } from "./cover/index.mjs";
11
+ import { resolveIconColor, resolveIconSize, resolveIconType } from "./icon/helpers.mjs";
12
+ import { WeappIcon } from "./icon/index.mjs";
13
+ import { WeappInput, createInputEventDetail } from "./input.mjs";
14
+ import { WeappLabel } from "./label.mjs";
15
+ import { clampMovablePosition, resolveMovableDirection } from "./movable/helpers.mjs";
16
+ import { WeappMovableArea, WeappMovableView } from "./movable/index.mjs";
17
+ import { WeappNavigator } from "./navigator.mjs";
18
+ import { createPickerChangeDetail, normalizePickerIndexes, resolvePickerColumns, resolvePickerMode } from "./picker/helpers.mjs";
19
+ import { WeappPicker } from "./picker/index.mjs";
20
+ import { normalizePickerViewValue } from "./pickerView/helpers.mjs";
21
+ import { WeappPickerViewColumn } from "./pickerView/column.mjs";
22
+ import { WeappPickerView } from "./pickerView/index.mjs";
23
+ import { createProgressActiveEndDetail, resolveProgressAnimationDuration, resolveProgressConfig } from "./progress/helpers.mjs";
24
+ import { WeappProgress } from "./progress/index.mjs";
25
+ import { WeappRadio, WeappRadioGroup, collectRadioGroupValue } from "./radio.mjs";
26
+ import { normalizeRichTextNodes, sanitizeRichTextAttributes, sanitizeRichTextStyle } from "./richText/helpers.mjs";
27
+ import { WeappRichText } from "./richText/index.mjs";
28
+ import { WeappScrollView, createScrollEventDetail } from "./scrollView.mjs";
29
+ import { createSliderEventDetail, resolveSliderConfig } from "./slider/helpers.mjs";
30
+ import { WeappSlider } from "./slider/index.mjs";
31
+ import { createSwiperChangeDetail, resolveSwipeTarget, resolveSwiperIndex, resolveSwiperNumber } from "./swiper/helpers.mjs";
32
+ import { WeappSwiper } from "./swiper/index.mjs";
33
+ import { WeappSwiperItem } from "./swiper/item.mjs";
34
+ import { WeappSwitch, createSwitchEventDetail } from "./switch.mjs";
35
+ import { WeappTextarea, createTextareaLineChangeDetail } from "./textarea.mjs";
36
+ import { createVideoProgressDetail, createVideoTimeUpdateDetail, resolveVideoObjectFit } from "./video/helpers.mjs";
37
+ import { WeappVideo } from "./video/index.mjs";
38
+
39
+ //#region src/runtime/nativeComponents/index.ts
40
+ const constructors = {
41
+ "weapp-view": WeappView,
42
+ "weapp-text": WeappText,
43
+ "weapp-image": WeappImage,
44
+ "weapp-button": WeappButton,
45
+ "weapp-input": WeappInput,
46
+ "weapp-textarea": WeappTextarea,
47
+ "weapp-form": WeappForm,
48
+ "weapp-label": WeappLabel,
49
+ "weapp-checkbox-group": WeappCheckboxGroup,
50
+ "weapp-checkbox": WeappCheckbox,
51
+ "weapp-radio-group": WeappRadioGroup,
52
+ "weapp-radio": WeappRadio,
53
+ "weapp-switch": WeappSwitch,
54
+ "weapp-picker": WeappPicker,
55
+ "weapp-picker-view": WeappPickerView,
56
+ "weapp-picker-view-column": WeappPickerViewColumn,
57
+ "weapp-slider": WeappSlider,
58
+ "weapp-icon": WeappIcon,
59
+ "weapp-progress": WeappProgress,
60
+ "weapp-rich-text": WeappRichText,
61
+ "weapp-scroll-view": WeappScrollView,
62
+ "weapp-navigator": WeappNavigator,
63
+ "weapp-swiper": WeappSwiper,
64
+ "weapp-swiper-item": WeappSwiperItem,
65
+ "weapp-canvas": WeappCanvas,
66
+ "weapp-video": WeappVideo,
67
+ "weapp-cover-view": WeappCoverView,
68
+ "weapp-cover-image": WeappCoverImage,
69
+ "weapp-movable-area": WeappMovableArea,
70
+ "weapp-movable-view": WeappMovableView
71
+ };
72
+ function ensureNativeComponentsDefined() {
73
+ if (typeof customElements === "undefined") return;
74
+ for (const descriptor of NATIVE_COMPONENT_DESCRIPTORS) {
75
+ if (customElements.get(descriptor.webTag)) continue;
76
+ const constructor = constructors[descriptor.webTag];
77
+ customElements.define(descriptor.webTag, constructor);
78
+ }
79
+ }
80
+
81
+ //#endregion
82
+ export { createInputEventDetail, createScrollEventDetail, createSwitchEventDetail, createTextareaLineChangeDetail, createVideoProgressDetail, createVideoTimeUpdateDetail, ensureNativeComponentsDefined, resolveImageModeStyle, resolveVideoObjectFit };
83
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/runtime/nativeComponents/index.ts"],"sourcesContent":["import type { NativeComponentWebTag } from '../../shared/nativeComponents'\nimport { NATIVE_COMPONENT_DESCRIPTORS } from '../../shared/nativeComponents'\nimport { WeappButton } from '../button'\nimport { WeappCanvas } from './canvas'\nimport { WeappCheckbox, WeappCheckboxGroup } from './checkbox'\nimport { WeappCoverImage, WeappCoverView } from './cover'\nimport { WeappForm } from './form'\nimport { WeappIcon } from './icon'\nimport { WeappImage } from './image'\nimport { WeappInput } from './input'\nimport { WeappLabel } from './label'\nimport { WeappMovableArea, WeappMovableView } from './movable'\nimport { WeappNavigator } from './navigator'\nimport { WeappPicker } from './picker'\nimport { WeappPickerView, WeappPickerViewColumn } from './pickerView'\nimport { WeappText, WeappView } from './primitives'\nimport { WeappProgress } from './progress'\nimport { WeappRadio, WeappRadioGroup } from './radio'\nimport { WeappRichText } from './richText'\nimport { WeappScrollView } from './scrollView'\nimport { WeappSlider } from './slider'\nimport { WeappSwiper } from './swiper'\nimport { WeappSwiperItem } from './swiper/item'\nimport { WeappSwitch } from './switch'\nimport { WeappTextarea } from './textarea'\nimport { WeappVideo } from './video'\n\nconst constructors = {\n 'weapp-view': WeappView,\n 'weapp-text': WeappText,\n 'weapp-image': WeappImage,\n 'weapp-button': WeappButton,\n 'weapp-input': WeappInput,\n 'weapp-textarea': WeappTextarea,\n 'weapp-form': WeappForm,\n 'weapp-label': WeappLabel,\n 'weapp-checkbox-group': WeappCheckboxGroup,\n 'weapp-checkbox': WeappCheckbox,\n 'weapp-radio-group': WeappRadioGroup,\n 'weapp-radio': WeappRadio,\n 'weapp-switch': WeappSwitch,\n 'weapp-picker': WeappPicker,\n 'weapp-picker-view': WeappPickerView,\n 'weapp-picker-view-column': WeappPickerViewColumn,\n 'weapp-slider': WeappSlider,\n 'weapp-icon': WeappIcon,\n 'weapp-progress': WeappProgress,\n 'weapp-rich-text': WeappRichText,\n 'weapp-scroll-view': WeappScrollView,\n 'weapp-navigator': WeappNavigator,\n 'weapp-swiper': WeappSwiper,\n 'weapp-swiper-item': WeappSwiperItem,\n 'weapp-canvas': WeappCanvas,\n 'weapp-video': WeappVideo,\n 'weapp-cover-view': WeappCoverView,\n 'weapp-cover-image': WeappCoverImage,\n 'weapp-movable-area': WeappMovableArea,\n 'weapp-movable-view': WeappMovableView,\n} satisfies Record<NativeComponentWebTag, CustomElementConstructor>\n\nexport function ensureNativeComponentsDefined() {\n if (typeof customElements === 'undefined') {\n return\n }\n for (const descriptor of NATIVE_COMPONENT_DESCRIPTORS) {\n if (customElements.get(descriptor.webTag)) {\n continue\n }\n const constructor = constructors[descriptor.webTag]\n customElements.define(descriptor.webTag, constructor)\n }\n}\n\nexport { collectCheckboxGroupValue } from './checkbox'\nexport { collectFormControlValues } from './formControl'\nexport { resolveIconColor, resolveIconSize, resolveIconType } from './icon/helpers'\nexport { resolveImageModeStyle } from './image'\nexport { createInputEventDetail } from './input'\nexport { clampMovablePosition, resolveMovableDirection } from './movable/helpers'\nexport {\n createPickerChangeDetail,\n normalizePickerIndexes,\n resolvePickerColumns,\n resolvePickerMode,\n} from './picker/helpers'\nexport { normalizePickerViewValue } from './pickerView/helpers'\nexport {\n createProgressActiveEndDetail,\n resolveProgressAnimationDuration,\n resolveProgressConfig,\n} from './progress/helpers'\nexport { collectRadioGroupValue } from './radio'\nexport {\n normalizeRichTextNodes,\n sanitizeRichTextAttributes,\n sanitizeRichTextStyle,\n} from './richText/helpers'\nexport { createScrollEventDetail } from './scrollView'\nexport { createSliderEventDetail, resolveSliderConfig } from './slider/helpers'\nexport { NATIVE_COMPONENT_STYLE } from './style'\nexport {\n createSwiperChangeDetail,\n resolveSwiperIndex,\n resolveSwiperNumber,\n resolveSwipeTarget,\n} from './swiper/helpers'\nexport { createSwitchEventDetail } from './switch'\nexport { createTextareaLineChangeDetail } from './textarea'\nexport {\n createVideoProgressDetail,\n createVideoTimeUpdateDetail,\n resolveVideoObjectFit,\n} from './video/helpers'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,eAAe;CACnB,cAAc;CACd,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,eAAe;CACf,kBAAkB;CAClB,cAAc;CACd,eAAe;CACf,wBAAwB;CACxB,kBAAkB;CAClB,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,gBAAgB;CAChB,qBAAqB;CACrB,4BAA4B;CAC5B,gBAAgB;CAChB,cAAc;CACd,kBAAkB;CAClB,mBAAmB;CACnB,qBAAqB;CACrB,mBAAmB;CACnB,gBAAgB;CAChB,qBAAqB;CACrB,gBAAgB;CAChB,eAAe;CACf,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,sBAAsB;AACxB;AAEA,SAAgB,gCAAgC;CAC9C,IAAI,OAAO,mBAAmB,aAC5B;CAEF,KAAK,MAAM,cAAc,8BAA8B;EACrD,IAAI,eAAe,IAAI,WAAW,MAAM,GACtC;EAEF,MAAM,cAAc,aAAa,WAAW;EAC5C,eAAe,OAAO,WAAW,QAAQ,WAAW;CACtD;AACF"}
@@ -0,0 +1,8 @@
1
+ //#region src/runtime/nativeComponents/input.d.ts
2
+ declare function createInputEventDetail(input: Pick<HTMLInputElement, 'selectionStart' | 'value'>): {
3
+ value: string;
4
+ cursor: number;
5
+ };
6
+ //#endregion
7
+ export { createInputEventDetail };
8
+ //# sourceMappingURL=input.d.mts.map
@@ -0,0 +1,131 @@
1
+ import { getNativeComponentDescriptor } from "../../shared/nativeComponents.mjs";
2
+ import { connectFormControl, disconnectFormControl } from "./formControl.mjs";
3
+ import { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot, resolveMaxLength } from "./helpers.mjs";
4
+ import { ensureNativeComponentStyle } from "./style.mjs";
5
+
6
+ //#region src/runtime/nativeComponents/input.ts
7
+ const BaseElement = globalThis.HTMLElement ?? class {};
8
+ function resolveInputType(element) {
9
+ if (readBooleanAttribute(element, "password")) return "password";
10
+ const type = element.getAttribute("type");
11
+ return type === "number" || type === "digit" || type === "idcard" ? "text" : type ?? "text";
12
+ }
13
+ function createInputEventDetail(input) {
14
+ return {
15
+ value: input.value,
16
+ cursor: input.selectionStart ?? input.value.length
17
+ };
18
+ }
19
+ var WeappInput = class extends BaseElement {
20
+ static observedAttributes = [...getNativeComponentDescriptor("input").attributes];
21
+ #input;
22
+ #initialValue = "";
23
+ #initialValueCaptured = false;
24
+ get formControlName() {
25
+ return this.getAttribute("name") ?? "";
26
+ }
27
+ get formControlValue() {
28
+ return this.value;
29
+ }
30
+ get formControlDisabled() {
31
+ return readBooleanAttribute(this, "disabled");
32
+ }
33
+ get value() {
34
+ return this.#input?.value ?? this.getAttribute("value") ?? "";
35
+ }
36
+ set value(value) {
37
+ this.setAttribute("value", value ?? "");
38
+ }
39
+ connectedCallback() {
40
+ ensureNativeComponentStyle(resolveContainingShadowRoot(this));
41
+ if (!this.#initialValueCaptured) {
42
+ this.#initialValue = this.getAttribute("value") ?? "";
43
+ this.#initialValueCaptured = true;
44
+ }
45
+ this.#ensureStructure();
46
+ this.#syncAttributes();
47
+ connectFormControl(this);
48
+ this.#syncFocus();
49
+ }
50
+ disconnectedCallback() {
51
+ disconnectFormControl(this);
52
+ }
53
+ attributeChangedCallback(name) {
54
+ this.#syncAttributes();
55
+ if (name === "focus") this.#syncFocus();
56
+ }
57
+ focus(options) {
58
+ this.#input?.focus(options);
59
+ }
60
+ blur() {
61
+ this.#input?.blur();
62
+ }
63
+ formReset() {
64
+ if (this.#input) this.#input.value = this.#initialValue;
65
+ }
66
+ formActivate() {
67
+ this.focus();
68
+ }
69
+ #ensureStructure() {
70
+ if (this.#input || typeof document === "undefined") return;
71
+ const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
72
+ const style = document.createElement("style");
73
+ style.textContent = `
74
+ :host { cursor: text; }
75
+ input {
76
+ display: block;
77
+ box-sizing: border-box;
78
+ width: 100%;
79
+ min-width: 0;
80
+ height: 100%;
81
+ padding: 0;
82
+ border: 0;
83
+ outline: 0;
84
+ color: inherit;
85
+ background: transparent;
86
+ font: inherit;
87
+ line-height: inherit;
88
+ }
89
+ `;
90
+ const input = document.createElement("input");
91
+ input.addEventListener("input", (event) => {
92
+ event.stopPropagation();
93
+ dispatchMiniProgramEvent(this, "input", createInputEventDetail(input));
94
+ });
95
+ input.addEventListener("focus", () => {
96
+ dispatchMiniProgramEvent(this, "focus", {
97
+ value: input.value,
98
+ height: 0
99
+ });
100
+ });
101
+ input.addEventListener("blur", () => {
102
+ dispatchMiniProgramEvent(this, "blur", createInputEventDetail(input));
103
+ });
104
+ input.addEventListener("keydown", (event) => {
105
+ if (event.key === "Enter") dispatchMiniProgramEvent(this, "confirm", { value: input.value });
106
+ });
107
+ root.append(style, input);
108
+ this.#input = input;
109
+ }
110
+ #syncAttributes() {
111
+ if (!this.#input) return;
112
+ const value = this.getAttribute("value") ?? "";
113
+ if (this.#input.value !== value) this.#input.value = value;
114
+ this.#input.type = resolveInputType(this);
115
+ this.#input.placeholder = this.getAttribute("placeholder") ?? "";
116
+ this.#input.disabled = readBooleanAttribute(this, "disabled");
117
+ const maxlength = resolveMaxLength(this.getAttribute("maxlength"));
118
+ if (maxlength === void 0) this.#input.removeAttribute("maxlength");
119
+ else this.#input.maxLength = maxlength;
120
+ const confirmType = this.getAttribute("confirm-type");
121
+ if (confirmType) this.#input.enterKeyHint = confirmType === "send" ? "send" : confirmType;
122
+ }
123
+ #syncFocus() {
124
+ if (!readBooleanAttribute(this, "focus")) return;
125
+ queueMicrotask(() => this.focus());
126
+ }
127
+ };
128
+
129
+ //#endregion
130
+ export { WeappInput, createInputEventDetail };
131
+ //# sourceMappingURL=input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.mjs","names":["#input","#initialValueCaptured","#initialValue","#ensureStructure","#syncAttributes","#syncFocus"],"sources":["../../../src/runtime/nativeComponents/input.ts"],"sourcesContent":["import { getNativeComponentDescriptor } from '../../shared/nativeComponents'\nimport { connectFormControl, disconnectFormControl } from './formControl'\nimport { dispatchMiniProgramEvent, readBooleanAttribute, resolveContainingShadowRoot, resolveMaxLength } from './helpers'\nimport { ensureNativeComponentStyle } from './style'\n\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\n\nfunction resolveInputType(element: Element) {\n if (readBooleanAttribute(element, 'password')) {\n return 'password'\n }\n const type = element.getAttribute('type')\n return type === 'number' || type === 'digit' || type === 'idcard' ? 'text' : (type ?? 'text')\n}\n\nexport function createInputEventDetail(input: Pick<HTMLInputElement, 'selectionStart' | 'value'>) {\n return {\n value: input.value,\n cursor: input.selectionStart ?? input.value.length,\n }\n}\n\nexport class WeappInput extends BaseElement {\n static observedAttributes = [...getNativeComponentDescriptor('input')!.attributes]\n\n #input?: HTMLInputElement\n #initialValue = ''\n #initialValueCaptured = false\n\n get formControlName() {\n return this.getAttribute('name') ?? ''\n }\n\n get formControlValue() {\n return this.value\n }\n\n get formControlDisabled() {\n return readBooleanAttribute(this, 'disabled')\n }\n\n get value() {\n return this.#input?.value ?? this.getAttribute('value') ?? ''\n }\n\n set value(value: string) {\n this.setAttribute('value', value ?? '')\n }\n\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n if (!this.#initialValueCaptured) {\n this.#initialValue = this.getAttribute('value') ?? ''\n this.#initialValueCaptured = true\n }\n this.#ensureStructure()\n this.#syncAttributes()\n connectFormControl(this)\n this.#syncFocus()\n }\n\n disconnectedCallback() {\n disconnectFormControl(this)\n }\n\n attributeChangedCallback(name: string) {\n this.#syncAttributes()\n if (name === 'focus') {\n this.#syncFocus()\n }\n }\n\n focus(options?: FocusOptions) {\n this.#input?.focus(options)\n }\n\n blur() {\n this.#input?.blur()\n }\n\n formReset() {\n if (this.#input) {\n this.#input.value = this.#initialValue\n }\n }\n\n formActivate() {\n this.focus()\n }\n\n #ensureStructure() {\n if (this.#input || typeof document === 'undefined') {\n return\n }\n const root = this.shadowRoot ?? this.attachShadow({ mode: 'open' })\n const style = document.createElement('style')\n style.textContent = `\n :host { cursor: text; }\n input {\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 100%;\n padding: 0;\n border: 0;\n outline: 0;\n color: inherit;\n background: transparent;\n font: inherit;\n line-height: inherit;\n }\n `\n const input = document.createElement('input')\n input.addEventListener('input', (event) => {\n event.stopPropagation()\n dispatchMiniProgramEvent(this, 'input', createInputEventDetail(input))\n })\n input.addEventListener('focus', () => {\n dispatchMiniProgramEvent(this, 'focus', { value: input.value, height: 0 })\n })\n input.addEventListener('blur', () => {\n dispatchMiniProgramEvent(this, 'blur', createInputEventDetail(input))\n })\n input.addEventListener('keydown', (event) => {\n if (event.key === 'Enter') {\n dispatchMiniProgramEvent(this, 'confirm', { value: input.value })\n }\n })\n root.append(style, input)\n this.#input = input\n }\n\n #syncAttributes() {\n if (!this.#input) {\n return\n }\n const value = this.getAttribute('value') ?? ''\n if (this.#input.value !== value) {\n this.#input.value = value\n }\n this.#input.type = resolveInputType(this)\n this.#input.placeholder = this.getAttribute('placeholder') ?? ''\n this.#input.disabled = readBooleanAttribute(this, 'disabled')\n const maxlength = resolveMaxLength(this.getAttribute('maxlength'))\n if (maxlength === undefined) {\n this.#input.removeAttribute('maxlength')\n }\n else {\n this.#input.maxLength = maxlength\n }\n const confirmType = this.getAttribute('confirm-type')\n if (confirmType) {\n this.#input.enterKeyHint = confirmType === 'send' ? 'send' : confirmType as HTMLInputElement['enterKeyHint']\n }\n }\n\n #syncFocus() {\n if (!readBooleanAttribute(this, 'focus')) {\n return\n }\n queueMicrotask(() => this.focus())\n }\n}\n"],"mappings":";;;;;;AAKA,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AAEtD,SAAS,iBAAiB,SAAkB;CAC1C,IAAI,qBAAqB,SAAS,UAAU,GAC1C,OAAO;CAET,MAAM,OAAO,QAAQ,aAAa,MAAM;CACxC,OAAO,SAAS,YAAY,SAAS,WAAW,SAAS,WAAW,SAAU,QAAQ;AACxF;AAEA,SAAgB,uBAAuB,OAA2D;CAChG,OAAO;EACL,OAAO,MAAM;EACb,QAAQ,MAAM,kBAAkB,MAAM,MAAM;CAC9C;AACF;AAEA,IAAa,aAAb,cAAgC,YAAY;CAC1C,OAAO,qBAAqB,CAAC,GAAG,6BAA6B,OAAO,CAAC,CAAE,UAAU;CAEjF;CACA,gBAAgB;CAChB,wBAAwB;CAExB,IAAI,kBAAkB;EACpB,OAAO,KAAK,aAAa,MAAM,KAAK;CACtC;CAEA,IAAI,mBAAmB;EACrB,OAAO,KAAK;CACd;CAEA,IAAI,sBAAsB;EACxB,OAAO,qBAAqB,MAAM,UAAU;CAC9C;CAEA,IAAI,QAAQ;EACV,OAAO,KAAKA,QAAQ,SAAS,KAAK,aAAa,OAAO,KAAK;CAC7D;CAEA,IAAI,MAAM,OAAe;EACvB,KAAK,aAAa,SAAS,SAAS,EAAE;CACxC;CAEA,oBAAoB;EAClB,2BAA2B,4BAA4B,IAAI,CAAC;EAC5D,IAAI,CAAC,KAAKC,uBAAuB;GAC/B,KAAKC,gBAAgB,KAAK,aAAa,OAAO,KAAK;GACnD,KAAKD,wBAAwB;EAC/B;EACA,KAAKE,iBAAiB;EACtB,KAAKC,gBAAgB;EACrB,mBAAmB,IAAI;EACvB,KAAKC,WAAW;CAClB;CAEA,uBAAuB;EACrB,sBAAsB,IAAI;CAC5B;CAEA,yBAAyB,MAAc;EACrC,KAAKD,gBAAgB;EACrB,IAAI,SAAS,SACX,KAAKC,WAAW;CAEpB;CAEA,MAAM,SAAwB;EAC5B,KAAKL,QAAQ,MAAM,OAAO;CAC5B;CAEA,OAAO;EACL,KAAKA,QAAQ,KAAK;CACpB;CAEA,YAAY;EACV,IAAI,KAAKA,QACP,KAAKA,OAAO,QAAQ,KAAKE;CAE7B;CAEA,eAAe;EACb,KAAK,MAAM;CACb;CAEA,mBAAmB;EACjB,IAAI,KAAKF,UAAU,OAAO,aAAa,aACrC;EAEF,MAAM,OAAO,KAAK,cAAc,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;EAClE,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,cAAc;;;;;;;;;;;;;;;;;EAiBpB,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,iBAAiB,UAAU,UAAU;GACzC,MAAM,gBAAgB;GACtB,yBAAyB,MAAM,SAAS,uBAAuB,KAAK,CAAC;EACvE,CAAC;EACD,MAAM,iBAAiB,eAAe;GACpC,yBAAyB,MAAM,SAAS;IAAE,OAAO,MAAM;IAAO,QAAQ;GAAE,CAAC;EAC3E,CAAC;EACD,MAAM,iBAAiB,cAAc;GACnC,yBAAyB,MAAM,QAAQ,uBAAuB,KAAK,CAAC;EACtE,CAAC;EACD,MAAM,iBAAiB,YAAY,UAAU;GAC3C,IAAI,MAAM,QAAQ,SAChB,yBAAyB,MAAM,WAAW,EAAE,OAAO,MAAM,MAAM,CAAC;EAEpE,CAAC;EACD,KAAK,OAAO,OAAO,KAAK;EACxB,KAAKA,SAAS;CAChB;CAEA,kBAAkB;EAChB,IAAI,CAAC,KAAKA,QACR;EAEF,MAAM,QAAQ,KAAK,aAAa,OAAO,KAAK;EAC5C,IAAI,KAAKA,OAAO,UAAU,OACxB,KAAKA,OAAO,QAAQ;EAEtB,KAAKA,OAAO,OAAO,iBAAiB,IAAI;EACxC,KAAKA,OAAO,cAAc,KAAK,aAAa,aAAa,KAAK;EAC9D,KAAKA,OAAO,WAAW,qBAAqB,MAAM,UAAU;EAC5D,MAAM,YAAY,iBAAiB,KAAK,aAAa,WAAW,CAAC;EACjE,IAAI,cAAc,QAChB,KAAKA,OAAO,gBAAgB,WAAW;OAGvC,KAAKA,OAAO,YAAY;EAE1B,MAAM,cAAc,KAAK,aAAa,cAAc;EACpD,IAAI,aACF,KAAKA,OAAO,eAAe,gBAAgB,SAAS,SAAS;CAEjE;CAEA,aAAa;EACX,IAAI,CAAC,qBAAqB,MAAM,OAAO,GACrC;EAEF,qBAAqB,KAAK,MAAM,CAAC;CACnC;AACF"}
@@ -0,0 +1,36 @@
1
+ import { getNativeComponentDescriptor } from "../../shared/nativeComponents.mjs";
2
+ import { isFormActivatable } from "./formControl.mjs";
3
+ import { resolveContainingShadowRoot } from "./helpers.mjs";
4
+ import { ensureNativeComponentStyle } from "./style.mjs";
5
+
6
+ //#region src/runtime/nativeComponents/label.ts
7
+ const BaseElement = globalThis.HTMLElement ?? class {};
8
+ const FORM_CONTROL_SELECTOR = "weapp-input, weapp-textarea, weapp-checkbox, weapp-radio, weapp-switch";
9
+ function findElementById(root, id) {
10
+ if (!("querySelectorAll" in root)) return null;
11
+ return Array.from(root.querySelectorAll("[id]")).find((element) => element.id === id) ?? null;
12
+ }
13
+ var WeappLabel = class extends BaseElement {
14
+ static observedAttributes = [...getNativeComponentDescriptor("label").attributes];
15
+ #bound = false;
16
+ connectedCallback() {
17
+ ensureNativeComponentStyle(resolveContainingShadowRoot(this));
18
+ if (!this.#bound) {
19
+ this.#bound = true;
20
+ this.addEventListener("click", this.#handleClick);
21
+ }
22
+ }
23
+ #handleClick = (event) => {
24
+ if (event.defaultPrevented) return;
25
+ const path = event.composedPath();
26
+ const selfIndex = path.indexOf(this);
27
+ if (path.slice(0, selfIndex).some((node) => node instanceof Element && isFormActivatable(node))) return;
28
+ const forId = this.getAttribute("for")?.trim();
29
+ const target = forId ? findElementById(this.getRootNode(), forId) : this.querySelector(FORM_CONTROL_SELECTOR);
30
+ if (target && isFormActivatable(target)) target.formActivate?.();
31
+ };
32
+ };
33
+
34
+ //#endregion
35
+ export { WeappLabel };
36
+ //# sourceMappingURL=label.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.mjs","names":["#bound","#handleClick"],"sources":["../../../src/runtime/nativeComponents/label.ts"],"sourcesContent":["import { getNativeComponentDescriptor } from '../../shared/nativeComponents'\nimport { isFormActivatable } from './formControl'\nimport { resolveContainingShadowRoot } from './helpers'\nimport { ensureNativeComponentStyle } from './style'\n\nconst BaseElement = (globalThis.HTMLElement ?? class {}) as typeof HTMLElement\nconst FORM_CONTROL_SELECTOR = 'weapp-input, weapp-textarea, weapp-checkbox, weapp-radio, weapp-switch'\n\nfunction findElementById(root: Node, id: string) {\n if (!('querySelectorAll' in root)) {\n return null\n }\n return Array.from((root as ParentNode).querySelectorAll<HTMLElement>('[id]'))\n .find(element => element.id === id) ?? null\n}\n\nexport class WeappLabel extends BaseElement {\n static observedAttributes = [...getNativeComponentDescriptor('label')!.attributes]\n\n #bound = false\n\n connectedCallback() {\n ensureNativeComponentStyle(resolveContainingShadowRoot(this))\n if (!this.#bound) {\n this.#bound = true\n this.addEventListener('click', this.#handleClick)\n }\n }\n\n #handleClick = (event: Event) => {\n if (event.defaultPrevented) {\n return\n }\n const path = event.composedPath()\n const selfIndex = path.indexOf(this)\n if (path.slice(0, selfIndex).some(node => node instanceof Element && isFormActivatable(node))) {\n return\n }\n const forId = this.getAttribute('for')?.trim()\n const target = forId\n ? findElementById(this.getRootNode(), forId)\n : this.querySelector<HTMLElement>(FORM_CONTROL_SELECTOR)\n if (target && isFormActivatable(target)) {\n target.formActivate?.()\n }\n }\n}\n"],"mappings":";;;;;;AAKA,MAAM,cAAe,WAAW,eAAe,MAAM,CAAC;AACtD,MAAM,wBAAwB;AAE9B,SAAS,gBAAgB,MAAY,IAAY;CAC/C,IAAI,EAAE,sBAAsB,OAC1B,OAAO;CAET,OAAO,MAAM,KAAM,KAAoB,iBAA8B,MAAM,CAAC,CAAC,CAC1E,MAAK,YAAW,QAAQ,OAAO,EAAE,KAAK;AAC3C;AAEA,IAAa,aAAb,cAAgC,YAAY;CAC1C,OAAO,qBAAqB,CAAC,GAAG,6BAA6B,OAAO,CAAC,CAAE,UAAU;CAEjF,SAAS;CAET,oBAAoB;EAClB,2BAA2B,4BAA4B,IAAI,CAAC;EAC5D,IAAI,CAAC,KAAKA,QAAQ;GAChB,KAAKA,SAAS;GACd,KAAK,iBAAiB,SAAS,KAAKC,YAAY;EAClD;CACF;CAEA,gBAAgB,UAAiB;EAC/B,IAAI,MAAM,kBACR;EAEF,MAAM,OAAO,MAAM,aAAa;EAChC,MAAM,YAAY,KAAK,QAAQ,IAAI;EACnC,IAAI,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC,MAAK,SAAQ,gBAAgB,WAAW,kBAAkB,IAAI,CAAC,GAC1F;EAEF,MAAM,QAAQ,KAAK,aAAa,KAAK,CAAC,EAAE,KAAK;EAC7C,MAAM,SAAS,QACX,gBAAgB,KAAK,YAAY,GAAG,KAAK,IACzC,KAAK,cAA2B,qBAAqB;EACzD,IAAI,UAAU,kBAAkB,MAAM,GACpC,OAAO,eAAe;CAE1B;AACF"}