@weapp-vite/web 1.3.37 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/README.md +144 -5
  2. package/dist/_virtual/_rolldown/runtime.mjs +19 -1
  3. package/dist/compiler/wxml/attributes.mjs +1 -1
  4. package/dist/compiler/wxml/attributes.mjs.map +1 -1
  5. package/dist/compiler/wxml/compile.mjs +6 -3
  6. package/dist/compiler/wxml/compile.mjs.map +1 -1
  7. package/dist/compiler/wxml/interpolation.mjs +1 -2
  8. package/dist/compiler/wxml/interpolation.mjs.map +1 -1
  9. package/dist/compiler/wxml/navigation.mjs +5 -7
  10. package/dist/compiler/wxml/navigation.mjs.map +1 -1
  11. package/dist/compiler/wxml/parser.mjs +5 -5
  12. package/dist/compiler/wxml/parser.mjs.map +1 -1
  13. package/dist/compiler/wxml/renderer.mjs +13 -12
  14. package/dist/compiler/wxml/renderer.mjs.map +1 -1
  15. package/dist/compiler/wxml/specialNodes.mjs +6 -1
  16. package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
  17. package/dist/compiler/wxml/types.d.mts +12 -0
  18. package/dist/compiler/wxs.mjs +5 -5
  19. package/dist/compiler/wxs.mjs.map +1 -1
  20. package/dist/css/wxss.d.mts +1 -0
  21. package/dist/css/wxss.mjs +110 -9
  22. package/dist/css/wxss.mjs.map +1 -1
  23. package/dist/index.d.mts +29 -6
  24. package/dist/index.mjs +197 -4
  25. package/dist/index.mjs.map +1 -0
  26. package/dist/plugin/assets.d.mts +7 -0
  27. package/dist/plugin/assets.mjs +122 -0
  28. package/dist/plugin/assets.mjs.map +1 -0
  29. package/dist/plugin/constants.mjs +10 -1
  30. package/dist/plugin/constants.mjs.map +1 -1
  31. package/dist/plugin/dependencyScan.mjs +41 -0
  32. package/dist/plugin/dependencyScan.mjs.map +1 -0
  33. package/dist/plugin/entry.mjs +55 -6
  34. package/dist/plugin/entry.mjs.map +1 -1
  35. package/dist/plugin/files.mjs +1 -1
  36. package/dist/plugin/files.mjs.map +1 -1
  37. package/dist/plugin/index.d.mts +37 -3
  38. package/dist/plugin/index.mjs +240 -73
  39. package/dist/plugin/index.mjs.map +1 -1
  40. package/dist/plugin/layout.mjs +24 -0
  41. package/dist/plugin/layout.mjs.map +1 -0
  42. package/dist/plugin/path.mjs +4 -1
  43. package/dist/plugin/path.mjs.map +1 -1
  44. package/dist/plugin/register.mjs +45 -33
  45. package/dist/plugin/register.mjs.map +1 -1
  46. package/dist/plugin/scan.mjs +206 -94
  47. package/dist/plugin/scan.mjs.map +1 -1
  48. package/dist/plugin/scanSfc.mjs +65 -0
  49. package/dist/plugin/scanSfc.mjs.map +1 -0
  50. package/dist/plugin/state.mjs +3 -2
  51. package/dist/plugin/state.mjs.map +1 -1
  52. package/dist/plugin/styleModule.mjs +52 -0
  53. package/dist/plugin/styleModule.mjs.map +1 -0
  54. package/dist/plugin/types.d.mts +37 -1
  55. package/dist/plugin/vueSfc.mjs +149 -0
  56. package/dist/plugin/vueSfc.mjs.map +1 -0
  57. package/dist/runtime/appShell/container.mjs +25 -0
  58. package/dist/runtime/appShell/container.mjs.map +1 -0
  59. package/dist/runtime/appShell/tabBar/index.mjs +192 -0
  60. package/dist/runtime/appShell/tabBar/index.mjs.map +1 -0
  61. package/dist/runtime/appShell/tabBar/style.mjs +127 -0
  62. package/dist/runtime/appShell/tabBar/style.mjs.map +1 -0
  63. package/dist/runtime/button/helpers.mjs +1 -58
  64. package/dist/runtime/button/helpers.mjs.map +1 -1
  65. package/dist/runtime/button/index.d.mts +4 -5
  66. package/dist/runtime/button/index.mjs +6 -28
  67. package/dist/runtime/button/index.mjs.map +1 -1
  68. package/dist/runtime/button/style.mjs +53 -28
  69. package/dist/runtime/button/style.mjs.map +1 -1
  70. package/dist/runtime/component/behavior.mjs +26 -2
  71. package/dist/runtime/component/behavior.mjs.map +1 -1
  72. package/dist/runtime/component/element.mjs +107 -31
  73. package/dist/runtime/component/element.mjs.map +1 -1
  74. package/dist/runtime/component/observers.mjs +36 -0
  75. package/dist/runtime/component/observers.mjs.map +1 -0
  76. package/dist/runtime/component/publicInstance.mjs +48 -0
  77. package/dist/runtime/component/publicInstance.mjs.map +1 -0
  78. package/dist/runtime/component/relations.mjs +35 -0
  79. package/dist/runtime/component/relations.mjs.map +1 -0
  80. package/dist/runtime/component/slots.mjs +24 -0
  81. package/dist/runtime/component/slots.mjs.map +1 -0
  82. package/dist/runtime/component/state.mjs +13 -3
  83. package/dist/runtime/component/state.mjs.map +1 -1
  84. package/dist/runtime/component/types.d.mts +29 -4
  85. package/dist/runtime/component/virtualHost.mjs +83 -0
  86. package/dist/runtime/component/virtualHost.mjs.map +1 -0
  87. package/dist/runtime/host/index.d.mts +13 -0
  88. package/dist/runtime/host/index.mjs +47 -0
  89. package/dist/runtime/host/index.mjs.map +1 -0
  90. package/dist/runtime/host/types.d.mts +28 -0
  91. package/dist/runtime/hostGlobals.d.mts +9 -0
  92. package/dist/runtime/hostGlobals.mjs +39 -0
  93. package/dist/runtime/hostGlobals.mjs.map +1 -0
  94. package/dist/runtime/index.d.mts +21 -3
  95. package/dist/runtime/index.mjs +26 -4
  96. package/dist/runtime/index.mjs.map +1 -0
  97. package/dist/runtime/legacyTemplate/dom.mjs +3 -3
  98. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
  99. package/dist/runtime/legacyTemplate/expression.mjs +9 -9
  100. package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
  101. package/dist/runtime/legacyTemplate/index.mjs +6 -6
  102. package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
  103. package/dist/runtime/nativeComponents/canvas/index.mjs +53 -0
  104. package/dist/runtime/nativeComponents/canvas/index.mjs.map +1 -0
  105. package/dist/runtime/nativeComponents/checkbox.mjs +137 -0
  106. package/dist/runtime/nativeComponents/checkbox.mjs.map +1 -0
  107. package/dist/runtime/nativeComponents/cover/index.mjs +23 -0
  108. package/dist/runtime/nativeComponents/cover/index.mjs.map +1 -0
  109. package/dist/runtime/nativeComponents/form.d.mts +7 -0
  110. package/dist/runtime/nativeComponents/form.mjs +50 -0
  111. package/dist/runtime/nativeComponents/form.mjs.map +1 -0
  112. package/dist/runtime/nativeComponents/formControl.mjs +61 -0
  113. package/dist/runtime/nativeComponents/formControl.mjs.map +1 -0
  114. package/dist/runtime/nativeComponents/helpers.mjs +25 -0
  115. package/dist/runtime/nativeComponents/helpers.mjs.map +1 -0
  116. package/dist/runtime/nativeComponents/icon/helpers.mjs +42 -0
  117. package/dist/runtime/nativeComponents/icon/helpers.mjs.map +1 -0
  118. package/dist/runtime/nativeComponents/icon/index.mjs +45 -0
  119. package/dist/runtime/nativeComponents/icon/index.mjs.map +1 -0
  120. package/dist/runtime/nativeComponents/icon/style.mjs +176 -0
  121. package/dist/runtime/nativeComponents/icon/style.mjs.map +1 -0
  122. package/dist/runtime/nativeComponents/image.d.mts +8 -0
  123. package/dist/runtime/nativeComponents/image.mjs +121 -0
  124. package/dist/runtime/nativeComponents/image.mjs.map +1 -0
  125. package/dist/runtime/nativeComponents/index.d.mts +11 -0
  126. package/dist/runtime/nativeComponents/index.mjs +83 -0
  127. package/dist/runtime/nativeComponents/index.mjs.map +1 -0
  128. package/dist/runtime/nativeComponents/input.d.mts +8 -0
  129. package/dist/runtime/nativeComponents/input.mjs +131 -0
  130. package/dist/runtime/nativeComponents/input.mjs.map +1 -0
  131. package/dist/runtime/nativeComponents/label.mjs +36 -0
  132. package/dist/runtime/nativeComponents/label.mjs.map +1 -0
  133. package/dist/runtime/nativeComponents/mediaRegistry.mjs +47 -0
  134. package/dist/runtime/nativeComponents/mediaRegistry.mjs.map +1 -0
  135. package/dist/runtime/nativeComponents/movable/helpers.mjs +23 -0
  136. package/dist/runtime/nativeComponents/movable/helpers.mjs.map +1 -0
  137. package/dist/runtime/nativeComponents/movable/index.mjs +117 -0
  138. package/dist/runtime/nativeComponents/movable/index.mjs.map +1 -0
  139. package/dist/runtime/nativeComponents/navigator.mjs +200 -0
  140. package/dist/runtime/nativeComponents/navigator.mjs.map +1 -0
  141. package/dist/runtime/nativeComponents/picker/editors.mjs +74 -0
  142. package/dist/runtime/nativeComponents/picker/editors.mjs.map +1 -0
  143. package/dist/runtime/nativeComponents/picker/helpers.mjs +57 -0
  144. package/dist/runtime/nativeComponents/picker/helpers.mjs.map +1 -0
  145. package/dist/runtime/nativeComponents/picker/index.mjs +210 -0
  146. package/dist/runtime/nativeComponents/picker/index.mjs.map +1 -0
  147. package/dist/runtime/nativeComponents/picker/style.mjs +71 -0
  148. package/dist/runtime/nativeComponents/picker/style.mjs.map +1 -0
  149. package/dist/runtime/nativeComponents/pickerView/column.mjs +134 -0
  150. package/dist/runtime/nativeComponents/pickerView/column.mjs.map +1 -0
  151. package/dist/runtime/nativeComponents/pickerView/helpers.mjs +17 -0
  152. package/dist/runtime/nativeComponents/pickerView/helpers.mjs.map +1 -0
  153. package/dist/runtime/nativeComponents/pickerView/index.mjs +128 -0
  154. package/dist/runtime/nativeComponents/pickerView/index.mjs.map +1 -0
  155. package/dist/runtime/nativeComponents/pickerView/style.mjs +58 -0
  156. package/dist/runtime/nativeComponents/pickerView/style.mjs.map +1 -0
  157. package/dist/runtime/nativeComponents/primitives.mjs +16 -0
  158. package/dist/runtime/nativeComponents/primitives.mjs.map +1 -0
  159. package/dist/runtime/nativeComponents/progress/helpers.mjs +29 -0
  160. package/dist/runtime/nativeComponents/progress/helpers.mjs.map +1 -0
  161. package/dist/runtime/nativeComponents/progress/index.mjs +130 -0
  162. package/dist/runtime/nativeComponents/progress/index.mjs.map +1 -0
  163. package/dist/runtime/nativeComponents/progress/style.mjs +40 -0
  164. package/dist/runtime/nativeComponents/progress/style.mjs.map +1 -0
  165. package/dist/runtime/nativeComponents/radio.mjs +147 -0
  166. package/dist/runtime/nativeComponents/radio.mjs.map +1 -0
  167. package/dist/runtime/nativeComponents/richText/helpers.mjs +230 -0
  168. package/dist/runtime/nativeComponents/richText/helpers.mjs.map +1 -0
  169. package/dist/runtime/nativeComponents/richText/index.mjs +74 -0
  170. package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -0
  171. package/dist/runtime/nativeComponents/scrollView.d.mts +15 -0
  172. package/dist/runtime/nativeComponents/scrollView.mjs +79 -0
  173. package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -0
  174. package/dist/runtime/nativeComponents/slider/helpers.mjs +28 -0
  175. package/dist/runtime/nativeComponents/slider/helpers.mjs.map +1 -0
  176. package/dist/runtime/nativeComponents/slider/index.mjs +120 -0
  177. package/dist/runtime/nativeComponents/slider/index.mjs.map +1 -0
  178. package/dist/runtime/nativeComponents/slider/style.mjs +60 -0
  179. package/dist/runtime/nativeComponents/slider/style.mjs.map +1 -0
  180. package/dist/runtime/nativeComponents/style.mjs +41 -0
  181. package/dist/runtime/nativeComponents/style.mjs.map +1 -0
  182. package/dist/runtime/nativeComponents/swiper/helpers.mjs +52 -0
  183. package/dist/runtime/nativeComponents/swiper/helpers.mjs.map +1 -0
  184. package/dist/runtime/nativeComponents/swiper/index.mjs +235 -0
  185. package/dist/runtime/nativeComponents/swiper/index.mjs.map +1 -0
  186. package/dist/runtime/nativeComponents/swiper/item.mjs +14 -0
  187. package/dist/runtime/nativeComponents/swiper/item.mjs.map +1 -0
  188. package/dist/runtime/nativeComponents/swiper/style.mjs +20 -0
  189. package/dist/runtime/nativeComponents/swiper/style.mjs.map +1 -0
  190. package/dist/runtime/nativeComponents/switch.d.mts +7 -0
  191. package/dist/runtime/nativeComponents/switch.mjs +132 -0
  192. package/dist/runtime/nativeComponents/switch.mjs.map +1 -0
  193. package/dist/runtime/nativeComponents/textarea.d.mts +9 -0
  194. package/dist/runtime/nativeComponents/textarea.mjs +144 -0
  195. package/dist/runtime/nativeComponents/textarea.mjs.map +1 -0
  196. package/dist/runtime/nativeComponents/video/helpers.d.mts +12 -0
  197. package/dist/runtime/nativeComponents/video/helpers.mjs +21 -0
  198. package/dist/runtime/nativeComponents/video/helpers.mjs.map +1 -0
  199. package/dist/runtime/nativeComponents/video/index.mjs +124 -0
  200. package/dist/runtime/nativeComponents/video/index.mjs.map +1 -0
  201. package/dist/runtime/nativeComponents/video/style.mjs +14 -0
  202. package/dist/runtime/nativeComponents/video/style.mjs.map +1 -0
  203. package/dist/runtime/navigationBar/index.mjs +1 -3
  204. package/dist/runtime/navigationBar/index.mjs.map +1 -1
  205. package/dist/runtime/pageLayout.d.mts +9 -0
  206. package/dist/runtime/pageLayout.mjs +16 -0
  207. package/dist/runtime/pageLayout.mjs.map +1 -0
  208. package/dist/runtime/polyfill/animation.mjs +120 -0
  209. package/dist/runtime/polyfill/animation.mjs.map +1 -0
  210. package/dist/runtime/polyfill/appState.mjs +1 -1
  211. package/dist/runtime/polyfill/appState.mjs.map +1 -1
  212. package/dist/runtime/polyfill/async.d.mts +7 -0
  213. package/dist/runtime/polyfill/async.mjs.map +1 -1
  214. package/dist/runtime/polyfill/canvasContext.mjs +41 -0
  215. package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
  216. package/dist/runtime/polyfill/device.mjs +1 -1
  217. package/dist/runtime/polyfill/device.mjs.map +1 -1
  218. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +8 -2
  219. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
  220. package/dist/runtime/polyfill/eventBus.mjs +56 -0
  221. package/dist/runtime/polyfill/eventBus.mjs.map +1 -0
  222. package/dist/runtime/polyfill/fileSystemManager.mjs +5 -2
  223. package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
  224. package/dist/runtime/polyfill/files.mjs +10 -10
  225. package/dist/runtime/polyfill/files.mjs.map +1 -1
  226. package/dist/runtime/polyfill/font.mjs +32 -0
  227. package/dist/runtime/polyfill/font.mjs.map +1 -0
  228. package/dist/runtime/polyfill/index.d.mts +2 -2
  229. package/dist/runtime/polyfill/index.mjs +49 -45
  230. package/dist/runtime/polyfill/index.mjs.map +1 -1
  231. package/dist/runtime/polyfill/interaction.mjs +7 -6
  232. package/dist/runtime/polyfill/interaction.mjs.map +1 -1
  233. package/dist/runtime/polyfill/interactionApi.mjs +3 -2
  234. package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
  235. package/dist/runtime/polyfill/intersectionObserver.mjs +106 -0
  236. package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -0
  237. package/dist/runtime/polyfill/locale.mjs +14 -0
  238. package/dist/runtime/polyfill/locale.mjs.map +1 -0
  239. package/dist/runtime/polyfill/locationApi.mjs +7 -4
  240. package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
  241. package/dist/runtime/polyfill/mediaActions.mjs +2 -2
  242. package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
  243. package/dist/runtime/polyfill/mediaApi/file.mjs +1 -1
  244. package/dist/runtime/polyfill/mediaApi/info.mjs +6 -4
  245. package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
  246. package/dist/runtime/polyfill/menuApi.mjs +38 -4
  247. package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
  248. package/dist/runtime/polyfill/navigationBarRuntime.mjs +6 -1
  249. package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
  250. package/dist/runtime/polyfill/network/request.mjs +2 -2
  251. package/dist/runtime/polyfill/network/request.mjs.map +1 -1
  252. package/dist/runtime/polyfill/platformApi.mjs +1 -1
  253. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +88 -0
  254. package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -0
  255. package/dist/runtime/polyfill/routeRuntime/dom.mjs +44 -15
  256. package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
  257. package/dist/runtime/polyfill/routeRuntime/history.d.mts +30 -0
  258. package/dist/runtime/polyfill/routeRuntime/history.mjs +148 -0
  259. package/dist/runtime/polyfill/routeRuntime/history.mjs.map +1 -0
  260. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +39 -8
  261. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
  262. package/dist/runtime/polyfill/routeRuntime/options.d.mts +11 -1
  263. package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -1
  264. package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
  265. package/dist/runtime/polyfill/routeRuntime/result.mjs +12 -0
  266. package/dist/runtime/polyfill/routeRuntime/result.mjs.map +1 -0
  267. package/dist/runtime/polyfill/routeRuntime/scroll.mjs +39 -0
  268. package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -0
  269. package/dist/runtime/polyfill/routeRuntime/stack.mjs +122 -0
  270. package/dist/runtime/polyfill/routeRuntime/stack.mjs.map +1 -0
  271. package/dist/runtime/polyfill/routeRuntime.d.mts +26 -17
  272. package/dist/runtime/polyfill/routeRuntime.mjs +121 -96
  273. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
  274. package/dist/runtime/polyfill/runtimeDataApi.mjs +8 -3
  275. package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
  276. package/dist/runtime/polyfill/runtimeOps.mjs +10 -6
  277. package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
  278. package/dist/runtime/polyfill/selectorQuery.mjs +70 -14
  279. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
  280. package/dist/runtime/polyfill/storage.mjs +5 -2
  281. package/dist/runtime/polyfill/storage.mjs.map +1 -1
  282. package/dist/runtime/polyfill/system.mjs +30 -3
  283. package/dist/runtime/polyfill/system.mjs.map +1 -1
  284. package/dist/runtime/polyfill/types/locationRuntime.d.mts +1 -4
  285. package/dist/runtime/polyfill/types/platformRuntime.d.mts +9 -0
  286. package/dist/runtime/polyfill/types/systemAuth.d.mts +20 -9
  287. package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +25 -0
  288. package/dist/runtime/polyfill/ui.mjs +2 -6
  289. package/dist/runtime/polyfill/ui.mjs.map +1 -1
  290. package/dist/runtime/polyfill/uiMediaApi.d.mts +11 -10
  291. package/dist/runtime/polyfill/uiMediaApi.mjs +26 -2
  292. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
  293. package/dist/runtime/polyfill/videoContext.mjs +4 -0
  294. package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
  295. package/dist/runtime/polyfill/vkSession.mjs +4 -14
  296. package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
  297. package/dist/runtime/polyfill.d.mts +2 -2
  298. package/dist/runtime/renderContext.mjs +1 -1
  299. package/dist/runtime/renderContext.mjs.map +1 -1
  300. package/dist/runtime/rpx.mjs +17 -8
  301. package/dist/runtime/rpx.mjs.map +1 -1
  302. package/dist/runtime/seo/index.d.mts +31 -0
  303. package/dist/runtime/seo/index.mjs +94 -0
  304. package/dist/runtime/seo/index.mjs.map +1 -0
  305. package/dist/runtime/viewport/index.d.mts +12 -0
  306. package/dist/runtime/viewport/index.mjs +44 -0
  307. package/dist/runtime/viewport/index.mjs.map +1 -0
  308. package/dist/runtime/viewport/style.mjs +62 -0
  309. package/dist/runtime/viewport/style.mjs.map +1 -0
  310. package/dist/runtime/viewport/types.d.mts +14 -0
  311. package/dist/runtime/wevu.d.mts +20 -0
  312. package/dist/runtime/wevu.mjs +73 -0
  313. package/dist/runtime/wevu.mjs.map +1 -0
  314. package/dist/shared/nativeComponents.mjs +401 -0
  315. package/dist/shared/nativeComponents.mjs.map +1 -0
  316. package/dist/shared/tabBar.d.mts +19 -0
  317. package/dist/shared/tabBar.mjs +37 -0
  318. package/dist/shared/tabBar.mjs.map +1 -0
  319. package/dist/shared/wxml.mjs +3 -20
  320. package/dist/shared/wxml.mjs.map +1 -1
  321. package/package.json +13 -5
@@ -1 +1 @@
1
- {"version":3,"file":"selectorQuery.mjs","names":[],"sources":["../../../src/runtime/polyfill/selectorQuery.ts"],"sourcesContent":["import type {\n SelectorQuery,\n SelectorQueryNodeCallback,\n SelectorQueryNodeFields,\n SelectorQueryNodesRef,\n SelectorQueryTask,\n SelectorTargetDescriptor,\n} from './selectorQueryTypes'\n\nfunction isQueryRoot(value: unknown): value is ParentNode {\n if (!value || typeof value !== 'object') {\n return false\n }\n const target = value as {\n querySelector?: (selector: string) => unknown\n querySelectorAll?: (selector: string) => ArrayLike<unknown>\n }\n return typeof target.querySelector === 'function' && typeof target.querySelectorAll === 'function'\n}\n\nfunction resolveQueryRoot(scope: unknown): ParentNode | undefined {\n const scoped = scope as {\n renderRoot?: unknown\n shadowRoot?: unknown\n $el?: unknown\n } | undefined\n if (isQueryRoot(scoped?.renderRoot)) {\n return scoped?.renderRoot\n }\n if (isQueryRoot(scoped?.shadowRoot)) {\n return scoped?.shadowRoot\n }\n if (isQueryRoot(scoped?.$el)) {\n return scoped?.$el\n }\n if (isQueryRoot(scope)) {\n return scope\n }\n if (typeof document !== 'undefined' && isQueryRoot(document)) {\n return document\n }\n return undefined\n}\n\nfunction resolveViewportTarget() {\n if (typeof window !== 'undefined') {\n return window\n }\n return undefined\n}\n\nfunction resolveQueryTargets(scope: unknown, target: SelectorTargetDescriptor): unknown[] {\n if (target.type === 'viewport') {\n const viewport = resolveViewportTarget()\n return viewport ? [viewport] : []\n }\n const root = resolveQueryRoot(scope)\n if (!root || !target.selector) {\n return []\n }\n if (target.multiple) {\n return Array.from(root.querySelectorAll(target.selector))\n }\n const node = root.querySelector(target.selector)\n return node ? [node] : []\n}\n\nfunction normalizeRectValue(value: unknown) {\n if (typeof value !== 'number' || Number.isNaN(value)) {\n return 0\n }\n return value\n}\n\nfunction getViewportRect() {\n const runtimeWindow = typeof window !== 'undefined' ? window : undefined\n const width = normalizeRectValue(runtimeWindow?.innerWidth)\n const height = normalizeRectValue(runtimeWindow?.innerHeight)\n return {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height,\n }\n}\n\nfunction readNodeRect(node: unknown) {\n if (!node) {\n return null\n }\n if ((typeof window !== 'undefined' && node === window) || node === globalThis) {\n return getViewportRect()\n }\n const target = node as {\n getBoundingClientRect?: () => {\n left?: number\n top?: number\n right?: number\n bottom?: number\n width?: number\n height?: number\n }\n }\n if (typeof target.getBoundingClientRect !== 'function') {\n return null\n }\n const rect = target.getBoundingClientRect()\n const left = normalizeRectValue(rect.left)\n const top = normalizeRectValue(rect.top)\n const width = normalizeRectValue(rect.width)\n const height = normalizeRectValue(rect.height)\n const right = rect.right == null ? left + width : normalizeRectValue(rect.right)\n const bottom = rect.bottom == null ? top + height : normalizeRectValue(rect.bottom)\n return { left, top, right, bottom, width, height }\n}\n\nfunction readNodeScrollOffset(node: unknown) {\n if ((typeof window !== 'undefined' && node === window) || node === globalThis) {\n const runtimeWindow = (typeof window !== 'undefined'\n ? (window as unknown as Record<string, unknown>)\n : (globalThis as Record<string, unknown>))\n return {\n scrollLeft: normalizeRectValue(\n (runtimeWindow.pageXOffset as number | undefined) ?? (runtimeWindow.scrollX as number | undefined),\n ),\n scrollTop: normalizeRectValue(\n (runtimeWindow.pageYOffset as number | undefined) ?? (runtimeWindow.scrollY as number | undefined),\n ),\n }\n }\n const target = node as {\n scrollLeft?: number\n scrollTop?: number\n }\n return {\n scrollLeft: normalizeRectValue(target?.scrollLeft),\n scrollTop: normalizeRectValue(target?.scrollTop),\n }\n}\n\nfunction readNodeFields(node: unknown, fields: SelectorQueryNodeFields) {\n if (!node) {\n return null\n }\n const result: Record<string, any> = {}\n const element = node as HTMLElement\n\n if (fields.id) {\n const elementWithId = element as { id?: string, getAttribute?: (name: string) => string | null }\n result.id = elementWithId.id ?? elementWithId.getAttribute?.('id') ?? ''\n }\n if (fields.dataset) {\n result.dataset = { ...(element.dataset ?? {}) }\n }\n if (fields.rect || fields.size) {\n const rect = readNodeRect(node)\n if (rect) {\n if (fields.rect) {\n result.left = rect.left\n result.top = rect.top\n result.right = rect.right\n result.bottom = rect.bottom\n }\n if (fields.size) {\n result.width = rect.width\n result.height = rect.height\n }\n }\n }\n if (fields.scrollOffset) {\n Object.assign(result, readNodeScrollOffset(node))\n }\n if (fields.properties?.length) {\n for (const key of fields.properties) {\n result[key] = (node as Record<string, unknown>)[key]\n }\n }\n if (fields.computedStyle?.length && typeof getComputedStyle === 'function' && node instanceof HTMLElement) {\n const style = getComputedStyle(node)\n for (const key of fields.computedStyle) {\n result[key] = style.getPropertyValue(key)\n }\n }\n if (fields.node) {\n result.node = node\n }\n if (fields.context) {\n result.context = node\n }\n return result\n}\n\nfunction mapQueryResult(target: SelectorTargetDescriptor, items: unknown[], mapper: (node: unknown) => any) {\n if (target.type === 'node' && target.multiple) {\n return items.map(item => mapper(item))\n }\n const first = items[0]\n if (!first) {\n return null\n }\n return mapper(first)\n}\n\nfunction runQueryTask(scope: unknown, task: SelectorQueryTask) {\n const targets = resolveQueryTargets(scope, task.target)\n if (task.type === 'boundingClientRect') {\n return mapQueryResult(task.target, targets, node => readNodeRect(node))\n }\n if (task.type === 'scrollOffset') {\n return mapQueryResult(task.target, targets, node => readNodeScrollOffset(node))\n }\n if (task.type === 'fields') {\n return mapQueryResult(task.target, targets, node => readNodeFields(node, task.fields))\n }\n return mapQueryResult(task.target, targets, node => ({ node }))\n}\n\nfunction createNodesRef(\n tasks: SelectorQueryTask[],\n queryApi: SelectorQuery,\n target: SelectorTargetDescriptor,\n): SelectorQueryNodesRef {\n return {\n boundingClientRect(callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'boundingClientRect', target, callback })\n return queryApi\n },\n scrollOffset(callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'scrollOffset', target, callback })\n return queryApi\n },\n fields(fields: SelectorQueryNodeFields, callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'fields', target, fields, callback })\n return queryApi\n },\n node(callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'node', target, callback })\n return queryApi\n },\n }\n}\n\nexport function createSelectorQueryBridge() {\n let scope: unknown\n const tasks: SelectorQueryTask[] = []\n\n const queryApi: SelectorQuery = {\n in(context?: unknown) {\n scope = context\n return queryApi\n },\n select(selector: string) {\n return createNodesRef(tasks, queryApi, { type: 'node', selector, multiple: false })\n },\n selectAll(selector: string) {\n return createNodesRef(tasks, queryApi, { type: 'node', selector, multiple: true })\n },\n selectViewport() {\n return createNodesRef(tasks, queryApi, { type: 'viewport' })\n },\n exec(callback?: (result: any[]) => void) {\n const result = tasks.map((task) => {\n const value = runQueryTask(scope, task)\n task.callback?.(value)\n return value\n })\n callback?.(result)\n tasks.length = 0\n return queryApi\n },\n }\n\n return queryApi\n}\n"],"mappings":";AASA,SAAS,YAAY,OAAqC;CACxD,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAET,MAAM,SAAS;CAIf,OAAO,OAAO,OAAO,kBAAkB,cAAc,OAAO,OAAO,qBAAqB;AAC1F;AAEA,SAAS,iBAAiB,OAAwC;CAChE,MAAM,SAAS;CAKf,IAAI,YAAY,QAAQ,UAAU,GAChC,OAAO,QAAQ;CAEjB,IAAI,YAAY,QAAQ,UAAU,GAChC,OAAO,QAAQ;CAEjB,IAAI,YAAY,QAAQ,GAAG,GACzB,OAAO,QAAQ;CAEjB,IAAI,YAAY,KAAK,GACnB,OAAO;CAET,IAAI,OAAO,aAAa,eAAe,YAAY,QAAQ,GACzD,OAAO;AAGX;AAEA,SAAS,wBAAwB;CAC/B,IAAI,OAAO,WAAW,aACpB,OAAO;AAGX;AAEA,SAAS,oBAAoB,OAAgB,QAA6C;CACxF,IAAI,OAAO,SAAS,YAAY;EAC9B,MAAM,WAAW,sBAAsB;EACvC,OAAO,WAAW,CAAC,QAAQ,IAAI,CAAC;CAClC;CACA,MAAM,OAAO,iBAAiB,KAAK;CACnC,IAAI,CAAC,QAAQ,CAAC,OAAO,UACnB,OAAO,CAAC;CAEV,IAAI,OAAO,UACT,OAAO,MAAM,KAAK,KAAK,iBAAiB,OAAO,QAAQ,CAAC;CAE1D,MAAM,OAAO,KAAK,cAAc,OAAO,QAAQ;CAC/C,OAAO,OAAO,CAAC,IAAI,IAAI,CAAC;AAC1B;AAEA,SAAS,mBAAmB,OAAgB;CAC1C,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,GAC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K,WAAW,KAAK;IACrB,OAAO;GACT,CAAC;GACD,WAAW,MAAM;GACjB,MAAM,SAAS;GACf,OAAO;EACT;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"selectorQuery.mjs","names":[],"sources":["../../../src/runtime/polyfill/selectorQuery.ts"],"sourcesContent":["import type {\n SelectorQuery,\n SelectorQueryNodeCallback,\n SelectorQueryNodeFields,\n SelectorQueryNodesRef,\n SelectorQueryTask,\n SelectorTargetDescriptor,\n} from './selectorQueryTypes'\nimport { resolveComponentPublicInstanceTarget } from '../component/publicInstance'\n\nfunction isQueryRoot(value: unknown): value is ParentNode {\n if (!value || typeof value !== 'object') {\n return false\n }\n const target = value as {\n querySelector?: (selector: string) => unknown\n querySelectorAll?: (selector: string) => ArrayLike<unknown>\n }\n return typeof target.querySelector === 'function' && typeof target.querySelectorAll === 'function'\n}\n\nfunction resolveScopedQueryRoot(scope: unknown): ParentNode | undefined {\n const normalizedScope = resolveComponentPublicInstanceTarget(scope) ?? scope\n const scoped = normalizedScope as {\n renderRoot?: unknown\n shadowRoot?: unknown\n $el?: unknown\n } | undefined\n if (isQueryRoot(scoped?.renderRoot)) {\n return scoped?.renderRoot\n }\n if (isQueryRoot(scoped?.shadowRoot)) {\n return scoped?.shadowRoot\n }\n const publicElement = (resolveComponentPublicInstanceTarget(scoped?.$el) ?? scoped?.$el) as {\n renderRoot?: unknown\n shadowRoot?: unknown\n } | undefined\n if (isQueryRoot(publicElement?.renderRoot)) {\n return publicElement.renderRoot\n }\n if (isQueryRoot(publicElement?.shadowRoot)) {\n return publicElement.shadowRoot\n }\n if (isQueryRoot(scoped?.$el)) {\n return scoped?.$el\n }\n if (isQueryRoot(normalizedScope)) {\n return normalizedScope\n }\n return undefined\n}\n\nfunction resolveCurrentPageQueryRoot() {\n const getCurrentPages = (globalThis as {\n getCurrentPages?: () => unknown[]\n }).getCurrentPages\n const pages = typeof getCurrentPages === 'function' ? getCurrentPages() : []\n return resolveScopedQueryRoot(pages[pages.length - 1])\n}\n\nfunction resolveQueryRoot(scope: unknown): ParentNode | undefined {\n const scopedRoot = resolveScopedQueryRoot(scope)\n if (scopedRoot) {\n return scopedRoot\n }\n if (scope == null) {\n const currentPageRoot = resolveCurrentPageQueryRoot()\n if (currentPageRoot) {\n return currentPageRoot\n }\n }\n if (typeof document !== 'undefined' && isQueryRoot(document)) {\n return document\n }\n return undefined\n}\n\nfunction resolveViewportTarget() {\n if (typeof window !== 'undefined') {\n return window\n }\n return undefined\n}\n\nfunction resolveUpdateComplete(scope: unknown): PromiseLike<unknown> | undefined {\n const normalizedScope = resolveComponentPublicInstanceTarget(scope) ?? scope\n const scoped = normalizedScope as {\n updateComplete?: unknown\n $el?: unknown\n } | undefined\n const publicElement = (resolveComponentPublicInstanceTarget(scoped?.$el) ?? scoped?.$el) as {\n updateComplete?: unknown\n } | undefined\n const candidate = publicElement?.updateComplete ?? scoped?.updateComplete\n if (\n candidate\n && typeof candidate === 'object'\n && typeof (candidate as PromiseLike<unknown>).then === 'function'\n ) {\n return candidate as PromiseLike<unknown>\n }\n return undefined\n}\n\nfunction resolveQueryTargets(scope: unknown, target: SelectorTargetDescriptor): unknown[] {\n if (target.type === 'viewport') {\n const viewport = resolveViewportTarget()\n return viewport ? [viewport] : []\n }\n const root = resolveQueryRoot(scope)\n if (!root || !target.selector) {\n return []\n }\n const query = (queryRoot: ParentNode) => {\n if (target.multiple) {\n return Array.from(queryRoot.querySelectorAll(target.selector!))\n }\n const node = queryRoot.querySelector(target.selector!)\n return node ? [node] : []\n }\n const scopedTargets = query(root)\n if (scopedTargets.length > 0) {\n return scopedTargets\n }\n\n const scopedPublicElement = (scope as { $?: unknown, $el?: unknown } | undefined)?.$el\n const publicElement = (resolveComponentPublicInstanceTarget(scopedPublicElement) ?? scopedPublicElement) as {\n getRootNode?: () => unknown\n } | undefined\n if (!(scope && typeof scope === 'object' && '$' in scope)) {\n return []\n }\n\n if (typeof publicElement?.getRootNode === 'function') {\n let ancestorRoot = publicElement.getRootNode()\n const visited = new Set<unknown>()\n while (isQueryRoot(ancestorRoot) && !visited.has(ancestorRoot)) {\n visited.add(ancestorRoot)\n const ancestorTargets = query(ancestorRoot)\n if (ancestorTargets.length > 0) {\n return ancestorTargets\n }\n const host = (ancestorRoot as { host?: { getRootNode?: () => unknown } }).host\n ancestorRoot = host?.getRootNode?.()\n }\n }\n\n const currentPageRoot = resolveCurrentPageQueryRoot()\n if (currentPageRoot && currentPageRoot !== root) {\n return query(currentPageRoot)\n }\n return []\n}\n\nexport function resolveSelectorTargets(scope: unknown, selector: string, multiple = false) {\n return resolveQueryTargets(scope, { type: 'node', selector, multiple })\n}\n\nfunction normalizeRectValue(value: unknown) {\n if (typeof value !== 'number' || Number.isNaN(value)) {\n return 0\n }\n return value\n}\n\nfunction getViewportRect() {\n const runtimeWindow = typeof window !== 'undefined' ? window : undefined\n const width = normalizeRectValue(runtimeWindow?.innerWidth)\n const height = normalizeRectValue(runtimeWindow?.innerHeight)\n return {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height,\n }\n}\n\nfunction readNodeRect(node: unknown) {\n if (!node) {\n return null\n }\n if ((typeof window !== 'undefined' && node === window) || node === globalThis) {\n return getViewportRect()\n }\n const target = node as {\n getBoundingClientRect?: () => {\n left?: number\n top?: number\n right?: number\n bottom?: number\n width?: number\n height?: number\n }\n }\n if (typeof target.getBoundingClientRect !== 'function') {\n return null\n }\n const rect = target.getBoundingClientRect()\n const left = normalizeRectValue(rect.left)\n const top = normalizeRectValue(rect.top)\n const width = normalizeRectValue(rect.width)\n const height = normalizeRectValue(rect.height)\n const right = rect.right == null ? left + width : normalizeRectValue(rect.right)\n const bottom = rect.bottom == null ? top + height : normalizeRectValue(rect.bottom)\n return { left, top, right, bottom, width, height }\n}\n\nfunction readNodeScrollOffset(node: unknown) {\n if ((typeof window !== 'undefined' && node === window) || node === globalThis) {\n const runtimeWindow = (typeof window !== 'undefined'\n ? (window as unknown as Record<string, unknown>)\n : (globalThis as Record<string, unknown>))\n return {\n scrollLeft: normalizeRectValue(\n (runtimeWindow.pageXOffset as number | undefined) ?? (runtimeWindow.scrollX as number | undefined),\n ),\n scrollTop: normalizeRectValue(\n (runtimeWindow.pageYOffset as number | undefined) ?? (runtimeWindow.scrollY as number | undefined),\n ),\n }\n }\n const target = node as {\n scrollLeft?: number\n scrollTop?: number\n }\n return {\n scrollLeft: normalizeRectValue(target?.scrollLeft),\n scrollTop: normalizeRectValue(target?.scrollTop),\n }\n}\n\nfunction readNodeFields(node: unknown, fields: SelectorQueryNodeFields) {\n if (!node) {\n return null\n }\n const result: Record<string, any> = {}\n const element = node as HTMLElement\n\n if (fields.id) {\n const elementWithId = element as { id?: string, getAttribute?: (name: string) => string | null }\n result.id = elementWithId.id ?? elementWithId.getAttribute?.('id') ?? ''\n }\n if (fields.dataset) {\n result.dataset = { ...(element.dataset ?? {}) }\n }\n if (fields.rect || fields.size) {\n const rect = readNodeRect(node)\n if (rect) {\n if (fields.rect) {\n result.left = rect.left\n result.top = rect.top\n result.right = rect.right\n result.bottom = rect.bottom\n }\n if (fields.size) {\n result.width = rect.width\n result.height = rect.height\n }\n }\n }\n if (fields.scrollOffset) {\n Object.assign(result, readNodeScrollOffset(node))\n }\n if (fields.properties?.length) {\n for (const key of fields.properties) {\n result[key] = (node as Record<string, unknown>)[key]\n }\n }\n if (fields.computedStyle?.length && typeof getComputedStyle === 'function' && node instanceof HTMLElement) {\n const style = getComputedStyle(node)\n for (const key of fields.computedStyle) {\n result[key] = style.getPropertyValue(key)\n }\n }\n if (fields.node) {\n result.node = node\n }\n if (fields.context) {\n result.context = node\n }\n return result\n}\n\nfunction mapQueryResult(target: SelectorTargetDescriptor, items: unknown[], mapper: (node: unknown) => any) {\n if (target.type === 'node' && target.multiple) {\n return items.map(item => mapper(item))\n }\n const first = items[0]\n if (!first) {\n return null\n }\n return mapper(first)\n}\n\nfunction runQueryTask(scope: unknown, task: SelectorQueryTask) {\n const targets = resolveQueryTargets(scope, task.target)\n if (task.type === 'boundingClientRect') {\n return mapQueryResult(task.target, targets, node => readNodeRect(node))\n }\n if (task.type === 'scrollOffset') {\n return mapQueryResult(task.target, targets, node => readNodeScrollOffset(node))\n }\n if (task.type === 'fields') {\n return mapQueryResult(task.target, targets, node => readNodeFields(node, task.fields))\n }\n return mapQueryResult(task.target, targets, node => ({ node }))\n}\n\nfunction createNodesRef(\n tasks: SelectorQueryTask[],\n queryApi: SelectorQuery,\n target: SelectorTargetDescriptor,\n): SelectorQueryNodesRef {\n return {\n boundingClientRect(callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'boundingClientRect', target, callback })\n return queryApi\n },\n scrollOffset(callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'scrollOffset', target, callback })\n return queryApi\n },\n fields(fields: SelectorQueryNodeFields, callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'fields', target, fields, callback })\n return queryApi\n },\n node(callback?: SelectorQueryNodeCallback) {\n tasks.push({ type: 'node', target, callback })\n return queryApi\n },\n }\n}\n\nexport function createSelectorQueryBridge() {\n let scope: unknown\n const tasks: SelectorQueryTask[] = []\n\n const queryApi: SelectorQuery = {\n in(context?: unknown) {\n scope = context\n return queryApi\n },\n select(selector: string) {\n return createNodesRef(tasks, queryApi, { type: 'node', selector, multiple: false })\n },\n selectAll(selector: string) {\n return createNodesRef(tasks, queryApi, { type: 'node', selector, multiple: true })\n },\n selectViewport() {\n return createNodesRef(tasks, queryApi, { type: 'viewport' })\n },\n exec(callback?: (result: any[]) => void) {\n const pendingTasks = tasks.splice(0)\n const run = () => {\n const result = pendingTasks.map((task) => {\n const value = runQueryTask(scope, task)\n task.callback?.(value)\n return value\n })\n callback?.(result)\n }\n const updateComplete = resolveUpdateComplete(scope)\n if (updateComplete) {\n void Promise.resolve(updateComplete).then(run)\n }\n else {\n run()\n }\n return queryApi\n },\n }\n\n return queryApi\n}\n"],"mappings":";;;AAUA,SAAS,YAAY,OAAqC;CACxD,IAAI,CAAC,SAAS,OAAO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MAAM,QAAQ,aAAa,OAAO,IAAI;KACtC,KAAK,WAAW,KAAK;KACrB,OAAO;IACT,CAAC;IACD,WAAW,MAAM;GACnB;GACA,MAAM,iBAAiB,sBAAsB,KAAK;GAClD,IAAI,gBACF,AAAK,QAAQ,QAAQ,cAAc,CAAC,CAAC,KAAK,GAAG;QAG7C,IAAI;GAEN,OAAO;EACT;CACF;CAEA,OAAO;AACT"}
@@ -1,3 +1,5 @@
1
+ import { getRuntimeStorage as getRuntimeStorage$1 } from "../host/index.mjs";
2
+
1
3
  //#region src/runtime/polyfill/storage.ts
2
4
  const WEB_STORAGE_PREFIX = "__weapp_vite_web_storage__:";
3
5
  const WEB_STORAGE_LIMIT_SIZE_KB = 10240;
@@ -6,8 +8,9 @@ function isRuntimeStorageLike(value) {
6
8
  return !!value && typeof value === "object" && typeof value.getItem === "function" && typeof value.setItem === "function" && typeof value.removeItem === "function" && typeof value.key === "function";
7
9
  }
8
10
  function getRuntimeStorage() {
9
- if (typeof localStorage === "undefined" || !isRuntimeStorageLike(localStorage)) return;
10
- return localStorage;
11
+ const storage = getRuntimeStorage$1();
12
+ if (!isRuntimeStorageLike(storage)) return;
13
+ return storage;
11
14
  }
12
15
  function storageKeyWithPrefix(key) {
13
16
  return `${WEB_STORAGE_PREFIX}${key}`;
@@ -1 +1 @@
1
- {"version":3,"file":"storage.mjs","names":[],"sources":["../../../src/runtime/polyfill/storage.ts"],"sourcesContent":["const WEB_STORAGE_PREFIX = '__weapp_vite_web_storage__:'\nconst WEB_STORAGE_LIMIT_SIZE_KB = 10240\nconst memoryStorage = new Map<string, any>()\n\nfunction isRuntimeStorageLike(value: unknown): value is Storage {\n return !!value\n && typeof value === 'object'\n && typeof (value as Storage).getItem === 'function'\n && typeof (value as Storage).setItem === 'function'\n && typeof (value as Storage).removeItem === 'function'\n && typeof (value as Storage).key === 'function'\n}\n\nfunction getRuntimeStorage() {\n if (typeof localStorage === 'undefined' || !isRuntimeStorageLike(localStorage)) {\n return undefined\n }\n return localStorage\n}\n\nfunction storageKeyWithPrefix(key: string) {\n return `${WEB_STORAGE_PREFIX}${key}`\n}\n\nfunction encodeStorageValue(value: any) {\n if (value === undefined) {\n return JSON.stringify({ type: 'undefined' })\n }\n return JSON.stringify({ type: 'json', value })\n}\n\nfunction decodeStorageValue(value: string) {\n try {\n const parsed = JSON.parse(value) as { type?: string, value?: any }\n if (parsed?.type === 'undefined') {\n return undefined\n }\n if (parsed?.type === 'json') {\n return parsed.value\n }\n return parsed\n }\n catch {\n return value\n }\n}\n\nexport function normalizeStorageKey(key: unknown) {\n if (typeof key !== 'string') {\n return ''\n }\n return key.trim()\n}\n\nexport function hasStorageKey(key: string) {\n if (memoryStorage.has(key)) {\n return true\n }\n const storage = getRuntimeStorage()\n if (!storage) {\n return false\n }\n return storage.getItem(storageKeyWithPrefix(key)) !== null\n}\n\nfunction listStorageKeys() {\n const keySet = new Set<string>(memoryStorage.keys())\n const storage = getRuntimeStorage()\n if (!storage) {\n return Array.from(keySet)\n }\n for (let index = 0; index < storage.length; index += 1) {\n const key = storage.key(index)\n if (key?.startsWith(WEB_STORAGE_PREFIX)) {\n keySet.add(key.slice(WEB_STORAGE_PREFIX.length))\n }\n }\n return Array.from(keySet)\n}\n\nexport function setStorageSyncInternal(key: string, data: any) {\n memoryStorage.set(key, data)\n const storage = getRuntimeStorage()\n if (storage) {\n storage.setItem(storageKeyWithPrefix(key), encodeStorageValue(data))\n }\n}\n\nexport function getStorageSyncInternal(key: string) {\n if (memoryStorage.has(key)) {\n return memoryStorage.get(key)\n }\n const storage = getRuntimeStorage()\n if (!storage) {\n return ''\n }\n const raw = storage.getItem(storageKeyWithPrefix(key))\n if (raw == null) {\n return ''\n }\n const decoded = decodeStorageValue(raw)\n memoryStorage.set(key, decoded)\n return decoded\n}\n\nexport function removeStorageSyncInternal(key: string) {\n memoryStorage.delete(key)\n const storage = getRuntimeStorage()\n if (storage) {\n storage.removeItem(storageKeyWithPrefix(key))\n }\n}\n\nexport function clearStorageSyncInternal() {\n memoryStorage.clear()\n const storage = getRuntimeStorage()\n if (!storage) {\n return\n }\n const removeKeys: string[] = []\n for (let index = 0; index < storage.length; index += 1) {\n const key = storage.key(index)\n if (key?.startsWith(WEB_STORAGE_PREFIX)) {\n removeKeys.push(key)\n }\n }\n for (const key of removeKeys) {\n storage.removeItem(key)\n }\n}\n\nfunction calculateStorageCurrentSize(keys: string[]) {\n let bytes = 0\n for (const key of keys) {\n const value = getStorageSyncInternal(key)\n const encoded = encodeStorageValue(value)\n bytes += encoded.length\n }\n return Math.ceil(bytes / 1024)\n}\n\nexport function getStorageInfoSyncInternal() {\n const keys = listStorageKeys()\n return {\n errMsg: 'getStorageInfoSync:ok',\n keys,\n currentSize: calculateStorageCurrentSize(keys),\n limitSize: WEB_STORAGE_LIMIT_SIZE_KB,\n }\n}\n"],"mappings":";AAAA,MAAM,qBAAqB;AAC3B,MAAM,4BAA4B;AAClC,MAAM,gCAAgB,IAAI,IAAiB;AAE3C,SAAS,qBAAqB,OAAkC;CAC9D,OAAO,CAAC,CAAC,SACJ,OAAO,UAAU,YACjB,OAAQ,MAAkB,YAAY,cACtC,OAAQ,MAAkB,YAAY,cACtC,OAAQ,MAAkB,eAAe,cACzC,OAAQ,MAAkB,QAAQ;AACzC;AAEA,SAAS,oBAAoB;CAC3B,IAAI,OAAO,iBAAiB,eAAe,CAAC,qBAAqB,YAAY,GAC3E;CAEF,OAAO;AACT;AAEA,SAAS,qBAAqB,KAAa;CACzC,OAAO,GAAG,qBAAqB;AACjC;AAEA,SAAS,mBAAmB,OAAY;CACtC,IAAI,UAAU,QACZ,OAAO,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;CAE7C,OAAO,KAAK,UAAU;EAAE,MAAM;EAAQ;CAAM,CAAC;AAC/C;AAEA,SAAS,mBAAmB,OAAe;CACzC,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,KAAK;EAC/B,IAAI,QAAQ,SAAS,aACnB;EAEF,IAAI,QAAQ,SAAS,Q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B,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,QAAQ,WAAW,qBAAqB,GAAG,CAAC;AAEhD;AAEA,SAAgB,2BAA2B;CACzC,cAAc,MAAM;CACpB,MAAM,UAAU,kBAAkB;CAClC,IAAI,CAAC,SACH;CAEF,MAAM,aAAuB,CAAC;CAC9B,KAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS,GAAG;EACtD,MAAM,MAAM,QAAQ,IAAI,KAAK;EAC7B,IAAI,KAAK,WAAW,kBAAkB,GACpC,WAAW,KAAK,GAAG;CAEvB;CACA,KAAK,MAAM,OAAO,YAChB,QAAQ,WAAW,GAAG;AAE1B;AAEA,SAAS,4BAA4B,MAAgB;CACnD,IAAI,QAAQ;CACZ,KAAK,MAAM,OAAO,MAAM;EAEtB,MAAM,UAAU,mBADF,uBAAuB,GACE,CAAC;EACxC,SAAS,QAAQ;CACnB;CACA,OAAO,KAAK,KAAK,QAAQ,IAAI;AAC/B;AAEA,SAAgB,6BAA6B;CAC3C,MAAM,OAAO,gBAAgB;CAC7B,OAAO;EACL,QAAQ;EACR;EACA,aAAa,4BAA4B,IAAI;EAC7C,WAAW;CACb;AACF"}
1
+ {"version":3,"file":"storage.mjs","names":["getHostRuntimeStorage"],"sources":["../../../src/runtime/polyfill/storage.ts"],"sourcesContent":["import { getRuntimeStorage as getHostRuntimeStorage } from '../host'\n\nconst WEB_STORAGE_PREFIX = '__weapp_vite_web_storage__:'\nconst WEB_STORAGE_LIMIT_SIZE_KB = 10240\nconst memoryStorage = new Map<string, any>()\n\nfunction isRuntimeStorageLike(value: unknown): value is Storage {\n return !!value\n && typeof value === 'object'\n && typeof (value as Storage).getItem === 'function'\n && typeof (value as Storage).setItem === 'function'\n && typeof (value as Storage).removeItem === 'function'\n && typeof (value as Storage).key === 'function'\n}\n\nfunction getRuntimeStorage() {\n const storage = getHostRuntimeStorage()\n if (!isRuntimeStorageLike(storage)) {\n return undefined\n }\n return storage\n}\n\nfunction storageKeyWithPrefix(key: string) {\n return `${WEB_STORAGE_PREFIX}${key}`\n}\n\nfunction encodeStorageValue(value: any) {\n if (value === undefined) {\n return JSON.stringify({ type: 'undefined' })\n }\n return JSON.stringify({ type: 'json', value })\n}\n\nfunction decodeStorageValue(value: string) {\n try {\n const parsed = JSON.parse(value) as { type?: string, value?: any }\n if (parsed?.type === 'undefined') {\n return undefined\n }\n if (parsed?.type === 'json') {\n return parsed.value\n }\n return parsed\n }\n catch {\n return value\n }\n}\n\nexport function normalizeStorageKey(key: unknown) {\n if (typeof key !== 'string') {\n return ''\n }\n return key.trim()\n}\n\nexport function hasStorageKey(key: string) {\n if (memoryStorage.has(key)) {\n return true\n }\n const storage = getRuntimeStorage()\n if (!storage) {\n return false\n }\n return storage.getItem(storageKeyWithPrefix(key)) !== null\n}\n\nfunction listStorageKeys() {\n const keySet = new Set<string>(memoryStorage.keys())\n const storage = getRuntimeStorage()\n if (!storage) {\n return Array.from(keySet)\n }\n for (let index = 0; index < storage.length; index += 1) {\n const key = storage.key(index)\n if (key?.startsWith(WEB_STORAGE_PREFIX)) {\n keySet.add(key.slice(WEB_STORAGE_PREFIX.length))\n }\n }\n return Array.from(keySet)\n}\n\nexport function setStorageSyncInternal(key: string, data: any) {\n memoryStorage.set(key, data)\n const storage = getRuntimeStorage()\n if (storage) {\n storage.setItem(storageKeyWithPrefix(key), encodeStorageValue(data))\n }\n}\n\nexport function getStorageSyncInternal(key: string) {\n if (memoryStorage.has(key)) {\n return memoryStorage.get(key)\n }\n const storage = getRuntimeStorage()\n if (!storage) {\n return ''\n }\n const raw = storage.getItem(storageKeyWithPrefix(key))\n if (raw == null) {\n return ''\n }\n const decoded = decodeStorageValue(raw)\n memoryStorage.set(key, decoded)\n return decoded\n}\n\nexport function removeStorageSyncInternal(key: string) {\n memoryStorage.delete(key)\n const storage = getRuntimeStorage()\n if (storage) {\n storage.removeItem(storageKeyWithPrefix(key))\n }\n}\n\nexport function clearStorageSyncInternal() {\n memoryStorage.clear()\n const storage = getRuntimeStorage()\n if (!storage) {\n return\n }\n const removeKeys: string[] = []\n for (let index = 0; index < storage.length; index += 1) {\n const key = storage.key(index)\n if (key?.startsWith(WEB_STORAGE_PREFIX)) {\n removeKeys.push(key)\n }\n }\n for (const key of removeKeys) {\n storage.removeItem(key)\n }\n}\n\nfunction calculateStorageCurrentSize(keys: string[]) {\n let bytes = 0\n for (const key of keys) {\n const value = getStorageSyncInternal(key)\n const encoded = encodeStorageValue(value)\n bytes += encoded.length\n }\n return Math.ceil(bytes / 1024)\n}\n\nexport function getStorageInfoSyncInternal() {\n const keys = listStorageKeys()\n return {\n errMsg: 'getStorageInfoSync:ok',\n keys,\n currentSize: calculateStorageCurrentSize(keys),\n limitSize: WEB_STORAGE_LIMIT_SIZE_KB,\n }\n}\n"],"mappings":";;;AAEA,MAAM,qBAAqB;AAC3B,MAAM,4BAA4B;AAClC,MAAM,gCAAgB,IAAI,IAAiB;AAE3C,SAAS,qBAAqB,OAAkC;CAC9D,OAAO,CAAC,CAAC,SACJ,OAAO,UAAU,YACjB,OAAQ,MAAkB,YAAY,cACtC,OAAQ,MAAkB,YAAY,cACtC,OAAQ,MAAkB,eAAe,cACzC,OAAQ,MAAkB,QAAQ;AACzC;AAEA,SAAS,oBAAoB;CAC3B,MAAM,UAAUA,oBAAsB;CACtC,IAAI,CAAC,qBAAqB,OAAO,GAC/B;CAEF,OAAO;AACT;AAEA,SAAS,qBAAqB,KAAa;CACzC,OAAO,GAAG,qBAAqB;AACjC;AAEA,SAAS,mBAAmB,OAAY;CACtC,IAAI,UAAU,QACZ,OAAO,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;CAE7C,OAAO,KAAK,UAAU;EAAE,MAAM;EAAQ;CAAM,CAAC;AAC/C;AAEA,SAAS,mBAAmB,OAAe;CACzC,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,KAAK;EAC/B,IAAI,QAAQ,SAAS,aACnB;EAEF,IAAI,QAAQ,SAAS,QACnB,OAAO,OAA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kBAAkB;CAClC,IAAI,SACF,QAAQ,WAAW,qBAAqB,GAAG,CAAC;AAEhD;AAEA,SAAgB,2BAA2B;CACzC,cAAc,MAAM;CACpB,MAAM,UAAU,kBAAkB;CAClC,IAAI,CAAC,SACH;CAEF,MAAM,aAAuB,CAAC;CAC9B,KAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS,GAAG;EACtD,MAAM,MAAM,QAAQ,IAAI,KAAK;EAC7B,IAAI,KAAK,WAAW,kBAAkB,GACpC,WAAW,KAAK,GAAG;CAEvB;CACA,KAAK,MAAM,OAAO,YAChB,QAAQ,WAAW,GAAG;AAE1B;AAEA,SAAS,4BAA4B,MAAgB;CACnD,IAAI,QAAQ;CACZ,KAAK,MAAM,OAAO,MAAM;EAEtB,MAAM,UAAU,mBADF,uBAAuB,GACE,CAAC;EACxC,SAAS,QAAQ;CACnB;CACA,OAAO,KAAK,KAAK,QAAQ,IAAI;AAC/B;AAEA,SAAgB,6BAA6B;CAC3C,MAAM,OAAO,gBAAgB;CAC7B,OAAO;EACL,QAAQ;EACR;EACA,aAAa,4BAA4B,IAAI;EAC7C,WAAW;CACb;AACF"}
@@ -39,8 +39,12 @@ function resolveRuntimeTheme() {
39
39
  return "light";
40
40
  }
41
41
  }
42
+ function resolveRuntimeWindow() {
43
+ if (typeof window === "undefined") return globalThis;
44
+ return window;
45
+ }
42
46
  function readSystemInfoSnapshot() {
43
- const runtimeWindow = typeof window !== "undefined" ? window : globalThis;
47
+ const runtimeWindow = resolveRuntimeWindow();
44
48
  const runtimeScreen = typeof screen !== "undefined" ? screen : globalThis;
45
49
  const runtimeNavigator = typeof navigator !== "undefined" ? navigator : void 0;
46
50
  const userAgent = runtimeNavigator?.userAgent ?? "";
@@ -48,6 +52,15 @@ function readSystemInfoSnapshot() {
48
52
  const windowHeight = normalizePositiveNumber(runtimeWindow.innerHeight, normalizePositiveNumber(runtimeScreen.height, 0));
49
53
  const screenWidth = normalizePositiveNumber(runtimeScreen.width, windowWidth);
50
54
  const screenHeight = normalizePositiveNumber(runtimeScreen.height, windowHeight);
55
+ const statusBarHeight = 0;
56
+ const safeArea = {
57
+ left: 0,
58
+ right: windowWidth,
59
+ top: statusBarHeight,
60
+ bottom: windowHeight,
61
+ width: windowWidth,
62
+ height: Math.max(0, windowHeight - statusBarHeight)
63
+ };
51
64
  return {
52
65
  brand: "web",
53
66
  model: runtimeNavigator?.platform ?? "web",
@@ -56,13 +69,27 @@ function readSystemInfoSnapshot() {
56
69
  screenHeight,
57
70
  windowWidth,
58
71
  windowHeight,
59
- statusBarHeight: 0,
72
+ statusBarHeight,
73
+ safeArea,
74
+ safeAreaInsets: {
75
+ left: safeArea.left,
76
+ right: Math.max(0, windowWidth - safeArea.right),
77
+ top: safeArea.top,
78
+ bottom: Math.max(0, windowHeight - safeArea.bottom)
79
+ },
80
+ windowTop: 0,
81
+ windowBottom: 0,
60
82
  language: runtimeNavigator?.language ?? "en",
61
83
  version: runtimeNavigator?.appVersion ?? userAgent,
62
84
  system: resolveSystemName(userAgent),
63
85
  platform: resolvePlatformName(userAgent, runtimeNavigator)
64
86
  };
65
87
  }
88
+ function rpx2px(value) {
89
+ const width = readSystemInfoSnapshot().windowWidth;
90
+ if (!Number.isFinite(value) || width <= 0) return 0;
91
+ return value * width / 750;
92
+ }
66
93
  function buildWindowInfoSnapshot(systemInfo) {
67
94
  const safeArea = {
68
95
  left: 0,
@@ -107,5 +134,5 @@ function buildMenuButtonRect(windowWidth, statusBarHeight) {
107
134
  }
108
135
 
109
136
  //#endregion
110
- export { buildMenuButtonRect, buildWindowInfoSnapshot, normalizeMemorySize, normalizePositiveNumber, readDeviceMemorySize, readSystemInfoSnapshot, resolveAccountAppId, resolveDeviceOrientation, resolvePlatformName, resolveRuntimeTheme, resolveSystemName };
137
+ export { buildMenuButtonRect, buildWindowInfoSnapshot, normalizeMemorySize, normalizePositiveNumber, readDeviceMemorySize, readSystemInfoSnapshot, resolveAccountAppId, resolveDeviceOrientation, resolvePlatformName, resolveRuntimeTheme, resolveSystemName, rpx2px };
111
138
  //# sourceMappingURL=system.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.mjs","names":["navigatorWithUAData"],"sources":["../../../src/runtime/polyfill/system.ts"],"sourcesContent":["export function resolveSystemName(userAgent: string) {\n if (/android/i.test(userAgent)) {\n return 'Android'\n }\n if (/iphone|ipad|ipod/i.test(userAgent)) {\n return 'iOS'\n }\n if (/windows/i.test(userAgent)) {\n return 'Windows'\n }\n if (/mac os x/i.test(userAgent)) {\n return 'macOS'\n }\n if (/linux/i.test(userAgent)) {\n return 'Linux'\n }\n return 'Unknown'\n}\n\nexport function resolvePlatformName(\n userAgent: string,\n runtimeNavigator: Navigator | undefined,\n) {\n const navigatorWithUAData = runtimeNavigator as Navigator & {\n userAgentData?: { platform?: string }\n }\n const raw = navigatorWithUAData?.userAgentData?.platform\n ?? runtimeNavigator?.platform\n ?? resolveSystemName(userAgent)\n const normalized = raw.toLowerCase()\n if (normalized.includes('android')) {\n return 'android'\n }\n if (normalized.includes('iphone') || normalized.includes('ipad') || normalized.includes('ios')) {\n return 'ios'\n }\n if (normalized.includes('win')) {\n return 'windows'\n }\n if (normalized.includes('mac')) {\n return 'mac'\n }\n if (normalized.includes('linux')) {\n return 'linux'\n }\n return normalized || 'web'\n}\n\nexport function normalizePositiveNumber(value: number | undefined, fallback: number) {\n if (typeof value !== 'number' || Number.isNaN(value) || value <= 0) {\n return fallback\n }\n return value\n}\n\nexport function resolveDeviceOrientation(): 'portrait' | 'landscape' {\n const runtimeWindow = (typeof window !== 'undefined'\n ? window\n : globalThis) as {\n innerWidth?: number\n innerHeight?: number\n }\n const width = normalizePositiveNumber(runtimeWindow.innerWidth, 0)\n const height = normalizePositiveNumber(runtimeWindow.innerHeight, 0)\n if (width > 0 && height > 0 && width > height) {\n return 'landscape'\n }\n return 'portrait'\n}\n\nexport function normalizeMemorySize(memory: unknown) {\n if (typeof memory !== 'number' || Number.isNaN(memory) || memory <= 0) {\n return 0\n }\n return Math.round(memory * 1024)\n}\n\nexport function resolveRuntimeTheme(): 'light' | 'dark' {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return 'light'\n }\n try {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n }\n catch {\n return 'light'\n }\n}\n\nexport function readSystemInfoSnapshot() {\n const runtimeWindow = (typeof window !== 'undefined'\n ? window\n : globalThis) as {\n innerWidth?: number\n innerHeight?: number\n devicePixelRatio?: number\n }\n const runtimeScreen = (typeof screen !== 'undefined'\n ? screen\n : globalThis) as {\n width?: number\n height?: number\n }\n const runtimeNavigator = typeof navigator !== 'undefined' ? navigator : undefined\n const userAgent = runtimeNavigator?.userAgent ?? ''\n const windowWidth = normalizePositiveNumber(\n runtimeWindow.innerWidth,\n normalizePositiveNumber(runtimeScreen.width, 0),\n )\n const windowHeight = normalizePositiveNumber(\n runtimeWindow.innerHeight,\n normalizePositiveNumber(runtimeScreen.height, 0),\n )\n const screenWidth = normalizePositiveNumber(runtimeScreen.width, windowWidth)\n const screenHeight = normalizePositiveNumber(runtimeScreen.height, windowHeight)\n\n return {\n brand: 'web',\n model: runtimeNavigator?.platform ?? 'web',\n pixelRatio: normalizePositiveNumber(runtimeWindow.devicePixelRatio, 1),\n screenWidth,\n screenHeight,\n windowWidth,\n windowHeight,\n statusBarHeight: 0,\n language: runtimeNavigator?.language ?? 'en',\n version: runtimeNavigator?.appVersion ?? userAgent,\n system: resolveSystemName(userAgent),\n platform: resolvePlatformName(userAgent, runtimeNavigator),\n }\n}\n\nexport function buildWindowInfoSnapshot(systemInfo: {\n pixelRatio: number\n screenWidth: number\n screenHeight: number\n windowWidth: number\n windowHeight: number\n statusBarHeight: number\n}) {\n const safeArea = {\n left: 0,\n right: systemInfo.windowWidth,\n top: systemInfo.statusBarHeight,\n bottom: systemInfo.windowHeight,\n width: systemInfo.windowWidth,\n height: Math.max(0, systemInfo.windowHeight - systemInfo.statusBarHeight),\n }\n return {\n pixelRatio: systemInfo.pixelRatio,\n screenWidth: systemInfo.screenWidth,\n screenHeight: systemInfo.screenHeight,\n windowWidth: systemInfo.windowWidth,\n windowHeight: systemInfo.windowHeight,\n statusBarHeight: systemInfo.statusBarHeight,\n screenTop: systemInfo.statusBarHeight,\n safeArea,\n }\n}\n\nexport function readDeviceMemorySize() {\n const runtimeNavigator = (typeof navigator !== 'undefined' ? navigator : undefined) as (Navigator & {\n deviceMemory?: number\n }) | undefined\n return normalizeMemorySize(runtimeNavigator?.deviceMemory)\n}\n\nexport function resolveAccountAppId() {\n const runtimeLocation = (typeof location !== 'undefined' ? location : undefined) as {\n hostname?: string\n } | undefined\n const host = runtimeLocation?.hostname?.trim()\n return host ? `web:${host}` : 'web'\n}\n\nexport function buildMenuButtonRect(windowWidth: number, statusBarHeight: number) {\n const width = 88\n const height = 32\n const right = Math.max(width, windowWidth - 8)\n const top = Math.max(0, statusBarHeight + (44 - height) / 2)\n const left = Math.max(0, right - width)\n return {\n width,\n height,\n top,\n right,\n bottom: top + height,\n left,\n }\n}\n"],"mappings":";AAAA,SAAgB,kBAAkB,WAAmB;CACnD,IAAI,WAAW,KAAK,SAAS,GAC3B,OAAO;CAET,IAAI,oBAAoB,KAAK,SAAS,GACpC,OAAO;CAET,IAAI,WAAW,KAAK,SAAS,GAC3B,OAAO;CAET,IAAI,YAAY,KAAK,SAAS,GAC5B,OAAO;CAET,IAAI,SAAS,KAAK,SAAS,GACzB,OAAO;CAET,OAAO;AACT;AAEA,SAAgB,oBACd,WACA,kBACA;CAOA,MAAM,cAHMA,kBAAqB,eAAe,YAC3C,kBAAkB,YAClB,kBAAkB,SAAS,EACV,CAAC,YAAY;CACnC,IAAI,WAAW,SAAS,SAAS,GAC/B,OAAO;CAET,IAAI,WAAW,SAAS,QAAQ,KAAK,WAAW,SAAS,MAAM,KAAK,WAAW,SAAS,KAAK,GAC3F,OAAO;CAET,IAAI,WAAW,SAAS,KAAK,GAC3B,OAAO;CAET,IAAI,WAAW,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EACrC,YAAY,wBAAwB,cAAc,kBAAkB,CAAC;EACrE;EACA;EACA;EACA;EACA,iBAAiB;EACjB,UAAU,kBAAkB,YAAY;EACxC,SAAS,kBAAkB,cAAc;EACzC,QAAQ,kBAAkB,SAAS;EACnC,UAAU,oBAAoB,WAAW,gBAAgB;CAC3D;AACF;AAEA,SAAgB,wBAAwB,YAOrC;CACD,MAAM,WAAW;EACf,MAAM;EACN,OAAO,WAAW;EAClB,KAAK,WAAW;EAChB,QAAQ,WAAW;EACnB,OAAO,WAAW;EAClB,QAAQ,KAAK,IAAI,GAAG,WAAW,eAAe,WAAW,eAAe;CAC1E;CACA,OAAO;EACL,YAAY,WAAW;EACvB,aAAa,WAAW;EACxB,cAAc,WAAW;EACzB,aAAa,WAAW;EACxB,cAAc,WAAW;EACzB,iBAAiB,WAAW;EAC5B,WAAW,WAAW;EACtB;CACF;AACF;AAEA,SAAgB,uBAAuB;CAIrC,OAAO,qBAHmB,OAAO,cAAc,cAAc,YAAY,OAG9B,EAAE,YAAY;AAC3D;AAEA,SAAgB,sBAAsB;CAIpC,MAAM,QAHmB,OAAO,aAAa,cAAc,WAAW,OAG1C,EAAE,UAAU,KAAK;CAC7C,OAAO,OAAO,OAAO,SAAS;AAChC;AAEA,SAAgB,oBAAoB,aAAqB,iBAAyB;CAChF,MAAM,QAAQ;CACd,MAAM,SAAS;CACf,MAAM,QAAQ,KAAK,IAAI,OAAO,cAAc,CAAC;CAC7C,MAAM,MAAM,KAAK,IAAI,GAAG,mBAAmB,KAAK,UAAU,CAAC;CAC3D,MAAM,OAAO,KAAK,IAAI,GAAG,QAAQ,KAAK;CACtC,OAAO;EACL;EACA;EACA;EACA;EACA,QAAQ,MAAM;EACd;CACF;AACF"}
1
+ {"version":3,"file":"system.mjs","names":["navigatorWithUAData"],"sources":["../../../src/runtime/polyfill/system.ts"],"sourcesContent":["export function resolveSystemName(userAgent: string) {\n if (/android/i.test(userAgent)) {\n return 'Android'\n }\n if (/iphone|ipad|ipod/i.test(userAgent)) {\n return 'iOS'\n }\n if (/windows/i.test(userAgent)) {\n return 'Windows'\n }\n if (/mac os x/i.test(userAgent)) {\n return 'macOS'\n }\n if (/linux/i.test(userAgent)) {\n return 'Linux'\n }\n return 'Unknown'\n}\n\nexport function resolvePlatformName(\n userAgent: string,\n runtimeNavigator: Navigator | undefined,\n) {\n const navigatorWithUAData = runtimeNavigator as Navigator & {\n userAgentData?: { platform?: string }\n }\n const raw = navigatorWithUAData?.userAgentData?.platform\n ?? runtimeNavigator?.platform\n ?? resolveSystemName(userAgent)\n const normalized = raw.toLowerCase()\n if (normalized.includes('android')) {\n return 'android'\n }\n if (normalized.includes('iphone') || normalized.includes('ipad') || normalized.includes('ios')) {\n return 'ios'\n }\n if (normalized.includes('win')) {\n return 'windows'\n }\n if (normalized.includes('mac')) {\n return 'mac'\n }\n if (normalized.includes('linux')) {\n return 'linux'\n }\n return normalized || 'web'\n}\n\nexport function normalizePositiveNumber(value: number | undefined, fallback: number) {\n if (typeof value !== 'number' || Number.isNaN(value) || value <= 0) {\n return fallback\n }\n return value\n}\n\nexport function resolveDeviceOrientation(): 'portrait' | 'landscape' {\n const runtimeWindow = (typeof window !== 'undefined'\n ? window\n : globalThis) as {\n innerWidth?: number\n innerHeight?: number\n }\n const width = normalizePositiveNumber(runtimeWindow.innerWidth, 0)\n const height = normalizePositiveNumber(runtimeWindow.innerHeight, 0)\n if (width > 0 && height > 0 && width > height) {\n return 'landscape'\n }\n return 'portrait'\n}\n\nexport function normalizeMemorySize(memory: unknown) {\n if (typeof memory !== 'number' || Number.isNaN(memory) || memory <= 0) {\n return 0\n }\n return Math.round(memory * 1024)\n}\n\nexport function resolveRuntimeTheme(): 'light' | 'dark' {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return 'light'\n }\n try {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n }\n catch {\n return 'light'\n }\n}\n\nfunction resolveRuntimeWindow() {\n if (typeof window === 'undefined') {\n return globalThis\n }\n return window\n}\n\nexport function readSystemInfoSnapshot() {\n const runtimeWindow = resolveRuntimeWindow() as {\n innerWidth?: number\n innerHeight?: number\n devicePixelRatio?: number\n }\n const runtimeScreen = (typeof screen !== 'undefined'\n ? screen\n : globalThis) as {\n width?: number\n height?: number\n }\n const runtimeNavigator = typeof navigator !== 'undefined' ? navigator : undefined\n const userAgent = runtimeNavigator?.userAgent ?? ''\n const windowWidth = normalizePositiveNumber(\n runtimeWindow.innerWidth,\n normalizePositiveNumber(runtimeScreen.width, 0),\n )\n const windowHeight = normalizePositiveNumber(\n runtimeWindow.innerHeight,\n normalizePositiveNumber(runtimeScreen.height, 0),\n )\n const screenWidth = normalizePositiveNumber(runtimeScreen.width, windowWidth)\n const screenHeight = normalizePositiveNumber(runtimeScreen.height, windowHeight)\n\n const statusBarHeight = 0\n const safeArea = {\n left: 0,\n right: windowWidth,\n top: statusBarHeight,\n bottom: windowHeight,\n width: windowWidth,\n height: Math.max(0, windowHeight - statusBarHeight),\n }\n return {\n brand: 'web',\n model: runtimeNavigator?.platform ?? 'web',\n pixelRatio: normalizePositiveNumber(runtimeWindow.devicePixelRatio, 1),\n screenWidth,\n screenHeight,\n windowWidth,\n windowHeight,\n statusBarHeight,\n safeArea,\n safeAreaInsets: {\n left: safeArea.left,\n right: Math.max(0, windowWidth - safeArea.right),\n top: safeArea.top,\n bottom: Math.max(0, windowHeight - safeArea.bottom),\n },\n windowTop: 0,\n windowBottom: 0,\n language: runtimeNavigator?.language ?? 'en',\n version: runtimeNavigator?.appVersion ?? userAgent,\n system: resolveSystemName(userAgent),\n platform: resolvePlatformName(userAgent, runtimeNavigator),\n }\n}\n\nexport function rpx2px(value: number) {\n const width = readSystemInfoSnapshot().windowWidth\n if (!Number.isFinite(value) || width <= 0) {\n return 0\n }\n return value * width / 750\n}\n\nexport function buildWindowInfoSnapshot(systemInfo: {\n pixelRatio: number\n screenWidth: number\n screenHeight: number\n windowWidth: number\n windowHeight: number\n statusBarHeight: number\n}) {\n const safeArea = {\n left: 0,\n right: systemInfo.windowWidth,\n top: systemInfo.statusBarHeight,\n bottom: systemInfo.windowHeight,\n width: systemInfo.windowWidth,\n height: Math.max(0, systemInfo.windowHeight - systemInfo.statusBarHeight),\n }\n return {\n pixelRatio: systemInfo.pixelRatio,\n screenWidth: systemInfo.screenWidth,\n screenHeight: systemInfo.screenHeight,\n windowWidth: systemInfo.windowWidth,\n windowHeight: systemInfo.windowHeight,\n statusBarHeight: systemInfo.statusBarHeight,\n screenTop: systemInfo.statusBarHeight,\n safeArea,\n }\n}\n\nexport function readDeviceMemorySize() {\n const runtimeNavigator = (typeof navigator !== 'undefined' ? navigator : undefined) as (Navigator & {\n deviceMemory?: number\n }) | undefined\n return normalizeMemorySize(runtimeNavigator?.deviceMemory)\n}\n\nexport function resolveAccountAppId() {\n const runtimeLocation = (typeof location !== 'undefined' ? location : undefined) as {\n hostname?: string\n } | undefined\n const host = runtimeLocation?.hostname?.trim()\n return host ? `web:${host}` : 'web'\n}\n\nexport function buildMenuButtonRect(windowWidth: number, statusBarHeight: number) {\n const width = 88\n const height = 32\n const right = Math.max(width, windowWidth - 8)\n const top = Math.max(0, statusBarHeight + (44 - height) / 2)\n const left = Math.max(0, right - width)\n return {\n width,\n height,\n top,\n right,\n bottom: top + height,\n left,\n }\n}\n"],"mappings":";AAAA,SAAgB,kBAAkB,WAAmB;CACnD,IAAI,WAAW,KAAK,SAAS,GAC3B,OAAO;CAET,IAAI,oBAAoB,KAAK,SAAS,GACpC,OAAO;CAET,IAAI,WAAW,KAAK,SAAS,GAC3B,OAAO;CAET,IAAI,YAAY,KAAK,SAAS,GAC5B,OAAO;CAET,IAAI,SAAS,KAAK,SAAS,GACzB,OAAO;CAET,OAAO;AACT;AAEA,SAAgB,oBACd,WACA,kBACA;CAOA,MAAM,cAHMA,kBAAqB,eAAe,YAC3C,kBAAkB,YAClB,kBAAkB,SAAS,EACV,CAAC,YAAY;CACnC,IAAI,WAAW,SAAS,SAAS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AACF;AAEA,SAAgB,uBAAuB;CAIrC,OAAO,qBAHmB,OAAO,cAAc,cAAc,YAAY,OAG9B,EAAE,YAAY;AAC3D;AAEA,SAAgB,sBAAsB;CAIpC,MAAM,QAHmB,OAAO,aAAa,cAAc,WAAW,OAG1C,EAAE,UAAU,KAAK;CAC7C,OAAO,OAAO,OAAO,SAAS;AAChC;AAEA,SAAgB,oBAAoB,aAAqB,iBAAyB;CAChF,MAAM,QAAQ;CACd,MAAM,SAAS;CACf,MAAM,QAAQ,KAAK,IAAI,OAAO,cAAc,CAAC;CAC7C,MAAM,MAAM,KAAK,IAAI,GAAG,mBAAmB,KAAK,UAAU,CAAC;CAC3D,MAAM,OAAO,KAAK,IAAI,GAAG,QAAQ,KAAK;CACtC,OAAO;EACL;EACA;EACA;EACA;EACA,QAAQ,MAAM;EACd;CACF;AACF"}
@@ -124,9 +124,6 @@ interface OpenLocationOptions extends MiniProgramAsyncOptions<MiniProgramBaseRes
124
124
  name?: string;
125
125
  address?: string;
126
126
  }
127
- interface TabBarOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
128
- animation?: boolean;
129
- }
130
127
  interface OpenCustomerServiceChatOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
131
128
  corpId?: string;
132
129
  extInfo?: Record<string, any>;
@@ -146,5 +143,5 @@ interface RequestSubscribeMessageOptions extends MiniProgramAsyncOptions<Request
146
143
  tmplIds?: string[];
147
144
  }
148
145
  //#endregion
149
- export { ChooseAddressOptions, ChooseAddressSuccessResult, ChooseLocationOptions, ChooseLocationSuccessResult, GetFuzzyLocationOptions, GetFuzzyLocationSuccessResult, GetImageInfoOptions, GetImageInfoSuccessResult, GetLocationOptions, GetLocationSuccessResult, GetNetworkTypeOptions, GetNetworkTypeSuccessResult, LoadSubPackageOptions, LogManager, LogManagerOptions, MakePhoneCallOptions, NavigateToMiniProgramOptions, NetworkStatusChangeCallback, NetworkStatusResult, NetworkType, OpenCustomerServiceChatOptions, OpenLocationOptions, PreloadSubpackageOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, SetBackgroundColorOptions, SetBackgroundTextStyleOptions, ShareMenuOptions, ShowLoadingOptions, TabBarOptions, UpdateManager, UpdateManagerCheckResult, WindowResizeCallback, WindowResizeResult };
146
+ export { ChooseAddressOptions, ChooseAddressSuccessResult, ChooseLocationOptions, ChooseLocationSuccessResult, GetFuzzyLocationOptions, GetFuzzyLocationSuccessResult, GetImageInfoOptions, GetImageInfoSuccessResult, GetLocationOptions, GetLocationSuccessResult, GetNetworkTypeOptions, GetNetworkTypeSuccessResult, LoadSubPackageOptions, LogManager, LogManagerOptions, MakePhoneCallOptions, NavigateToMiniProgramOptions, NetworkStatusChangeCallback, NetworkStatusResult, NetworkType, OpenCustomerServiceChatOptions, OpenLocationOptions, PreloadSubpackageOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, SetBackgroundColorOptions, SetBackgroundTextStyleOptions, ShareMenuOptions, ShowLoadingOptions, UpdateManager, UpdateManagerCheckResult, WindowResizeCallback, WindowResizeResult };
150
147
  //# sourceMappingURL=locationRuntime.d.mts.map
@@ -69,6 +69,7 @@ interface CanvasContext {
69
69
  setFillStyle: (color: string) => void;
70
70
  setStrokeStyle: (color: string) => void;
71
71
  setLineWidth: (width: number) => void;
72
+ setLineCap: (lineCap: CanvasLineCap) => void;
72
73
  setFontSize: (size: number) => void;
73
74
  fillRect: (x: number, y: number, width: number, height: number) => void;
74
75
  strokeRect: (x: number, y: number, width: number, height: number) => void;
@@ -79,6 +80,14 @@ interface CanvasContext {
79
80
  moveTo: (x: number, y: number) => void;
80
81
  lineTo: (x: number, y: number) => void;
81
82
  stroke: () => void;
83
+ fill: () => void;
84
+ rect: (x: number, y: number, width: number, height: number) => void;
85
+ arc: (x: number, y: number, radius: number, startAngle: number, endAngle: number, counterClockwise?: boolean) => void;
86
+ save: () => void;
87
+ restore: () => void;
88
+ translate: (x: number, y: number) => void;
89
+ rotate: (angle: number) => void;
90
+ scale: (scaleWidth: number, scaleHeight: number) => void;
82
91
  draw: (reserve?: boolean | (() => void), callback?: () => void) => void;
83
92
  }
84
93
  interface VideoContext {
@@ -1,5 +1,19 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
2
  //#region src/runtime/polyfill/types/systemAuth.d.ts
3
+ interface SafeArea {
4
+ left: number;
5
+ right: number;
6
+ top: number;
7
+ bottom: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ interface SafeAreaInsets {
12
+ left: number;
13
+ right: number;
14
+ top: number;
15
+ bottom: number;
16
+ }
3
17
  interface SystemInfo {
4
18
  brand: string;
5
19
  model: string;
@@ -9,6 +23,10 @@ interface SystemInfo {
9
23
  windowWidth: number;
10
24
  windowHeight: number;
11
25
  statusBarHeight: number;
26
+ safeArea: SafeArea;
27
+ safeAreaInsets: SafeAreaInsets;
28
+ windowTop: number;
29
+ windowBottom: number;
12
30
  language: string;
13
31
  version: string;
14
32
  system: string;
@@ -38,14 +56,7 @@ interface WindowInfo {
38
56
  windowHeight: number;
39
57
  statusBarHeight: number;
40
58
  screenTop: number;
41
- safeArea: {
42
- left: number;
43
- right: number;
44
- top: number;
45
- bottom: number;
46
- width: number;
47
- height: number;
48
- };
59
+ safeArea: SafeArea;
49
60
  }
50
61
  interface DeviceInfo {
51
62
  brand: string;
@@ -117,5 +128,5 @@ interface AccountInfoSync {
117
128
  interface GetSystemInfoSuccessResult extends MiniProgramBaseResult, SystemInfo {}
118
129
  interface GetSystemInfoOptions extends MiniProgramAsyncOptions<GetSystemInfoSuccessResult> {}
119
130
  //#endregion
120
- export { AccountInfoSync, AppAuthorizeSetting, AppAuthorizeStatus, AppBaseInfo, CheckSessionOptions, DeviceInfo, GetSystemInfoOptions, GetSystemInfoSuccessResult, GetUserInfoOptions, GetUserProfileOptions, LoginOptions, LoginSuccessResult, MenuButtonBoundingClientRect, OpenAppAuthorizeSettingOptions, OpenAppAuthorizeSettingSuccessResult, SystemInfo, SystemSetting, UserInfo, UserProfileSuccessResult, WindowInfo };
131
+ export { AccountInfoSync, AppAuthorizeSetting, AppAuthorizeStatus, AppBaseInfo, CheckSessionOptions, DeviceInfo, GetSystemInfoOptions, GetSystemInfoSuccessResult, GetUserInfoOptions, GetUserProfileOptions, LoginOptions, LoginSuccessResult, MenuButtonBoundingClientRect, OpenAppAuthorizeSettingOptions, OpenAppAuthorizeSettingSuccessResult, SafeArea, SafeAreaInsets, SystemInfo, SystemSetting, UserInfo, UserProfileSuccessResult, WindowInfo };
121
132
  //# sourceMappingURL=systemAuth.d.mts.map
@@ -0,0 +1,25 @@
1
+ import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
+ //#region src/runtime/polyfill/types/tabBarRuntime.d.ts
3
+ interface TabBarOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
4
+ animation?: boolean;
5
+ }
6
+ interface TabBarIndexOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
7
+ index: number;
8
+ }
9
+ interface SetTabBarItemOptions extends TabBarIndexOptions {
10
+ text?: string;
11
+ iconPath?: string;
12
+ selectedIconPath?: string;
13
+ }
14
+ interface SetTabBarStyleOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
15
+ color?: string;
16
+ selectedColor?: string;
17
+ backgroundColor?: string;
18
+ borderStyle?: 'black' | 'white';
19
+ }
20
+ interface SetTabBarBadgeOptions extends TabBarIndexOptions {
21
+ text: string;
22
+ }
23
+ //#endregion
24
+ export { SetTabBarBadgeOptions, SetTabBarItemOptions, SetTabBarStyleOptions, TabBarIndexOptions, TabBarOptions };
25
+ //# sourceMappingURL=tabBarRuntime.d.mts.map
@@ -1,3 +1,4 @@
1
+ import { getRuntimeDialogs } from "../host/index.mjs";
1
2
  import { WEAPP_VITE_WEB_ACTION_SHEET_SELECT_INDEX_KEY } from "@weapp-core/constants";
2
3
 
3
4
  //#region src/runtime/polyfill/ui.ts
@@ -6,12 +7,7 @@ const TOAST_SELECTOR = `#${TOAST_ID}`;
6
7
  const LOADING_ID = "__weapp_vite_web_loading__";
7
8
  const LOADING_SELECTOR = `#${LOADING_ID}`;
8
9
  function getGlobalDialogHandlers() {
9
- const runtimeGlobal = globalThis;
10
- return {
11
- confirm: runtimeGlobal.confirm,
12
- alert: runtimeGlobal.alert,
13
- prompt: runtimeGlobal.prompt
14
- };
10
+ return getRuntimeDialogs();
15
11
  }
16
12
  function getToastElement() {
17
13
  if (typeof document === "undefined") return;
@@ -1 +1 @@
1
- {"version":3,"file":"ui.mjs","names":["runtimeGlobal"],"sources":["../../../src/runtime/polyfill/ui.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_ACTION_SHEET_SELECT_INDEX_KEY } from '@weapp-core/constants'\n\nconst TOAST_ID = '__weapp_vite_web_toast__'\nconst TOAST_SELECTOR = `#${TOAST_ID}`\nconst LOADING_ID = '__weapp_vite_web_loading__'\nconst LOADING_SELECTOR = `#${LOADING_ID}`\n\nexport function getGlobalDialogHandlers() {\n const runtimeGlobal = globalThis as Record<string, unknown>\n return {\n confirm: runtimeGlobal.confirm as ((message?: string) => boolean) | undefined,\n alert: runtimeGlobal.alert as ((message?: string) => void) | undefined,\n prompt: runtimeGlobal.prompt as ((message?: string, defaultValue?: string) => string | null) | undefined,\n }\n}\n\nexport function getToastElement() {\n if (typeof document === 'undefined') {\n return undefined\n }\n const existing = document.querySelector(TOAST_SELECTOR) as HTMLElement | null\n if (existing) {\n return existing\n }\n const toast = document.createElement('div')\n toast.setAttribute('id', TOAST_ID)\n toast.setAttribute('data-weapp-web-toast', 'true')\n toast.setAttribute('hidden', 'true')\n toast.setAttribute('role', 'status')\n toast.setAttribute('aria-live', 'polite')\n if (!document.body) {\n return undefined\n }\n document.body.append(toast)\n return toast\n}\n\nexport function setToastVisible(toast: HTMLElement, visible: boolean) {\n if (visible) {\n toast.removeAttribute('hidden')\n }\n else {\n toast.setAttribute('hidden', 'true')\n }\n toast.setAttribute('style', [\n 'position: fixed',\n 'left: 50%',\n 'top: 15%',\n 'transform: translate(-50%, 0)',\n 'max-width: min(560px, 90vw)',\n 'padding: 10px 14px',\n 'border-radius: 8px',\n 'background: rgba(17, 24, 39, 0.9)',\n 'color: #ffffff',\n 'font-size: 14px',\n 'line-height: 1.5',\n 'text-align: center',\n 'pointer-events: none',\n 'z-index: 2147483646',\n `opacity: ${visible ? '1' : '0'}`,\n ].join(';'))\n}\n\nexport function hideToastElement() {\n const toast = getToastElement()\n if (!toast) {\n return\n }\n setToastVisible(toast, false)\n}\n\nexport function resolveToastPrefix(icon: 'success' | 'error' | 'none' | undefined) {\n if (icon === 'none') {\n return ''\n }\n if (icon === 'error') {\n return '[error] '\n }\n return '[ok] '\n}\n\nexport function getLoadingElement() {\n if (typeof document === 'undefined') {\n return undefined\n }\n const existing = document.querySelector(LOADING_SELECTOR) as HTMLElement | null\n if (existing) {\n return existing\n }\n if (!document.body) {\n return undefined\n }\n const loading = document.createElement('div')\n loading.setAttribute('id', LOADING_ID)\n loading.setAttribute('data-weapp-web-loading', 'true')\n loading.setAttribute('hidden', 'true')\n loading.setAttribute('role', 'status')\n loading.setAttribute('aria-live', 'polite')\n document.body.append(loading)\n return loading\n}\n\nexport function setLoadingVisible(\n loading: HTMLElement,\n visible: boolean,\n title: string,\n mask: boolean,\n) {\n if (visible) {\n loading.removeAttribute('hidden')\n }\n else {\n loading.setAttribute('hidden', 'true')\n }\n loading.textContent = title\n loading.setAttribute('style', [\n 'position: fixed',\n 'left: 50%',\n 'top: 45%',\n 'transform: translate(-50%, -50%)',\n 'min-width: 120px',\n 'max-width: min(560px, 90vw)',\n 'padding: 14px 18px',\n 'border-radius: 10px',\n 'background: rgba(17, 24, 39, 0.92)',\n 'color: #ffffff',\n 'font-size: 14px',\n 'line-height: 1.5',\n 'text-align: center',\n `pointer-events: ${mask ? 'auto' : 'none'}`,\n 'z-index: 2147483647',\n `opacity: ${visible ? '1' : '0'}`,\n `box-shadow: ${mask ? '0 0 0 99999px rgba(0, 0, 0, 0.28)' : 'none'}`,\n ].join(';'))\n}\n\nexport function resolveActionSheetSelection(itemList: string[]) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_ACTION_SHEET_SELECT_INDEX_KEY]\n if (typeof preset === 'function') {\n const result = preset(itemList)\n if (Number.isInteger(result) && result >= 0 && result < itemList.length) {\n return result\n }\n }\n if (Number.isInteger(preset) && (preset as number) >= 0 && (preset as number) < itemList.length) {\n return preset as number\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const lines = itemList.map((item, index) => `[${index}] ${item}`)\n const input = prompt(['请选择操作:', ...lines].join('\\n'), '0')\n if (input === null) {\n return null\n }\n const parsed = Number.parseInt(String(input), 10)\n if (Number.isInteger(parsed) && parsed >= 0 && parsed < itemList.length) {\n return parsed\n }\n }\n return 0\n}\n\nexport function resolveModalSelection(options?: {\n title?: string\n content?: string\n showCancel?: boolean\n}) {\n const title = options?.title?.trim() ?? ''\n const content = options?.content?.trim() ?? ''\n const message = [title, content].filter(Boolean).join('\\n\\n') || ' '\n const showCancel = options?.showCancel !== false\n const { confirm, alert } = getGlobalDialogHandlers()\n\n let confirmed = true\n if (showCancel) {\n if (typeof confirm === 'function') {\n confirmed = confirm(message)\n }\n }\n else if (typeof alert === 'function') {\n alert(message)\n }\n\n return {\n confirm: confirmed,\n cancel: !confirmed,\n }\n}\n\nexport function normalizeActionSheetItems(itemList: unknown) {\n if (!Array.isArray(itemList)) {\n return []\n }\n return itemList.map(item => String(item ?? '').trim()).filter(Boolean)\n}\n"],"mappings":";;;AAEA,MAAM,WAAW;AACjB,MAAM,iBAAiB,IAAI;AAC3B,MAAM,aAAa;AACnB,MAAM,mBAAmB,IAAI;AAE7B,SAAgB,0BAA0B;CACxC,MAAM,gBAAgB;CACtB,OAAO;EACL,SAAS,cAAc;EACvB,OAAO,cAAc;EACrB,QAAQ,cAAc;CACxB;AACF;AAEA,SAAg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EnD,IAAI,YAAY;CAChB,IAAI,YACF;MAAI,OAAO,YAAY,YACrB,YAAY,QAAQ,OAAO;CAC7B,OAEG,IAAI,OAAO,UAAU,YACxB,MAAM,OAAO;CAGf,OAAO;EACL,SAAS;EACT,QAAQ,CAAC;CACX;AACF;AAEA,SAAgB,0BAA0B,UAAmB;CAC3D,IAAI,CAAC,MAAM,QAAQ,QAAQ,GACzB,OAAO,CAAC;CAEV,OAAO,SAAS,KAAI,SAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO;AACvE"}
1
+ {"version":3,"file":"ui.mjs","names":["runtimeGlobal"],"sources":["../../../src/runtime/polyfill/ui.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_ACTION_SHEET_SELECT_INDEX_KEY } from '@weapp-core/constants'\nimport { getRuntimeDialogs } from '../host'\n\nconst TOAST_ID = '__weapp_vite_web_toast__'\nconst TOAST_SELECTOR = `#${TOAST_ID}`\nconst LOADING_ID = '__weapp_vite_web_loading__'\nconst LOADING_SELECTOR = `#${LOADING_ID}`\n\nexport function getGlobalDialogHandlers() {\n return getRuntimeDialogs()\n}\n\nexport function getToastElement() {\n if (typeof document === 'undefined') {\n return undefined\n }\n const existing = document.querySelector(TOAST_SELECTOR) as HTMLElement | null\n if (existing) {\n return existing\n }\n const toast = document.createElement('div')\n toast.setAttribute('id', TOAST_ID)\n toast.setAttribute('data-weapp-web-toast', 'true')\n toast.setAttribute('hidden', 'true')\n toast.setAttribute('role', 'status')\n toast.setAttribute('aria-live', 'polite')\n if (!document.body) {\n return undefined\n }\n document.body.append(toast)\n return toast\n}\n\nexport function setToastVisible(toast: HTMLElement, visible: boolean) {\n if (visible) {\n toast.removeAttribute('hidden')\n }\n else {\n toast.setAttribute('hidden', 'true')\n }\n toast.setAttribute('style', [\n 'position: fixed',\n 'left: 50%',\n 'top: 15%',\n 'transform: translate(-50%, 0)',\n 'max-width: min(560px, 90vw)',\n 'padding: 10px 14px',\n 'border-radius: 8px',\n 'background: rgba(17, 24, 39, 0.9)',\n 'color: #ffffff',\n 'font-size: 14px',\n 'line-height: 1.5',\n 'text-align: center',\n 'pointer-events: none',\n 'z-index: 2147483646',\n `opacity: ${visible ? '1' : '0'}`,\n ].join(';'))\n}\n\nexport function hideToastElement() {\n const toast = getToastElement()\n if (!toast) {\n return\n }\n setToastVisible(toast, false)\n}\n\nexport function resolveToastPrefix(icon: 'success' | 'error' | 'none' | undefined) {\n if (icon === 'none') {\n return ''\n }\n if (icon === 'error') {\n return '[error] '\n }\n return '[ok] '\n}\n\nexport function getLoadingElement() {\n if (typeof document === 'undefined') {\n return undefined\n }\n const existing = document.querySelector(LOADING_SELECTOR) as HTMLElement | null\n if (existing) {\n return existing\n }\n if (!document.body) {\n return undefined\n }\n const loading = document.createElement('div')\n loading.setAttribute('id', LOADING_ID)\n loading.setAttribute('data-weapp-web-loading', 'true')\n loading.setAttribute('hidden', 'true')\n loading.setAttribute('role', 'status')\n loading.setAttribute('aria-live', 'polite')\n document.body.append(loading)\n return loading\n}\n\nexport function setLoadingVisible(\n loading: HTMLElement,\n visible: boolean,\n title: string,\n mask: boolean,\n) {\n if (visible) {\n loading.removeAttribute('hidden')\n }\n else {\n loading.setAttribute('hidden', 'true')\n }\n loading.textContent = title\n loading.setAttribute('style', [\n 'position: fixed',\n 'left: 50%',\n 'top: 45%',\n 'transform: translate(-50%, -50%)',\n 'min-width: 120px',\n 'max-width: min(560px, 90vw)',\n 'padding: 14px 18px',\n 'border-radius: 10px',\n 'background: rgba(17, 24, 39, 0.92)',\n 'color: #ffffff',\n 'font-size: 14px',\n 'line-height: 1.5',\n 'text-align: center',\n `pointer-events: ${mask ? 'auto' : 'none'}`,\n 'z-index: 2147483647',\n `opacity: ${visible ? '1' : '0'}`,\n `box-shadow: ${mask ? '0 0 0 99999px rgba(0, 0, 0, 0.28)' : 'none'}`,\n ].join(';'))\n}\n\nexport function resolveActionSheetSelection(itemList: string[]) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_ACTION_SHEET_SELECT_INDEX_KEY]\n if (typeof preset === 'function') {\n const result = preset(itemList)\n if (Number.isInteger(result) && result >= 0 && result < itemList.length) {\n return result\n }\n }\n if (Number.isInteger(preset) && (preset as number) >= 0 && (preset as number) < itemList.length) {\n return preset as number\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const lines = itemList.map((item, index) => `[${index}] ${item}`)\n const input = prompt(['请选择操作:', ...lines].join('\\n'), '0')\n if (input === null) {\n return null\n }\n const parsed = Number.parseInt(String(input), 10)\n if (Number.isInteger(parsed) && parsed >= 0 && parsed < itemList.length) {\n return parsed\n }\n }\n return 0\n}\n\nexport function resolveModalSelection(options?: {\n title?: string\n content?: string\n showCancel?: boolean\n}) {\n const title = options?.title?.trim() ?? ''\n const content = options?.content?.trim() ?? ''\n const message = [title, content].filter(Boolean).join('\\n\\n') || ' '\n const showCancel = options?.showCancel !== false\n const { confirm, alert } = getGlobalDialogHandlers()\n\n let confirmed = true\n if (showCancel) {\n if (typeof confirm === 'function') {\n confirmed = confirm(message)\n }\n }\n else if (typeof alert === 'function') {\n alert(message)\n }\n\n return {\n confirm: confirmed,\n cancel: !confirmed,\n }\n}\n\nexport function normalizeActionSheetItems(itemList: unknown) {\n if (!Array.isArray(itemList)) {\n return []\n }\n return itemList.map(item => String(item ?? '').trim()).filter(Boolean)\n}\n"],"mappings":";;;;AAGA,MAAM,WAAW;AACjB,MAAM,iBAAiB,IAAI;AAC3B,MAAM,aAAa;AACnB,MAAM,mBAAmB,IAAI;AAE7B,SAAgB,0BAA0B;CACxC,OAAO,kBAAkB;AAC3B;AAEA,SAAgB,kBAAkB;CAChC,IAAI,OAAO,aAAa,aACtB;CAEF,MAAM,WAAW,SAAS,cAAc,cAAc;CACtD,IAAI,UACF,OAAO;CAET,MAAM,QAAQ,SAAS,cAAc,KAAK;CAC1C,MAAM,aAAa,MAAM,QAAQ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;CACX;AACF;AAEA,SAAgB,0BAA0B,UAAmB;CAC3D,IAAI,CAAC,MAAM,QAAQ,QAAQ,GACzB,OAAO,CAAC;CAEV,OAAO,SAAS,KAAI,SAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO;AACvE"}
@@ -1,8 +1,10 @@
1
1
  import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./types/base.mjs";
2
2
  import { ChooseImageOptions, GetClipboardDataOptions, PreviewImageOptions, SetClipboardDataOptions, ShowToastOptions } from "./types/common.mjs";
3
- import { ChooseAddressOptions, ChooseLocationOptions, GetImageInfoOptions, MakePhoneCallOptions, OpenCustomerServiceChatOptions, OpenLocationOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, ShareMenuOptions, ShowLoadingOptions, TabBarOptions } from "./types/locationRuntime.mjs";
3
+ import { ChooseAddressOptions, ChooseLocationOptions, GetImageInfoOptions, MakePhoneCallOptions, OpenCustomerServiceChatOptions, OpenLocationOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, ShareMenuOptions, ShowLoadingOptions } from "./types/locationRuntime.mjs";
4
4
  import { ChooseFileOptions, ChooseMediaOptions, ChooseMessageFileOptions, ChooseVideoOptions, CompressImageOptions, CompressVideoOptions, GetVideoInfoOptions, OpenVideoEditorOptions, PreviewMediaOptions, SaveFileOptions, SaveFileToDiskOptions, SaveImageToPhotosAlbumOptions, SaveVideoToPhotosAlbumOptions, ScanCodeOptions } from "./types/mediaAuth.mjs";
5
5
  import { OpenDocumentOptions, ShowActionSheetOptions, ShowModalOptions } from "./types/platformRuntime.mjs";
6
+ import { SetTabBarBadgeOptions, SetTabBarItemOptions, SetTabBarStyleOptions, TabBarIndexOptions, TabBarOptions } from "./types/tabBarRuntime.mjs";
7
+ import { MiniProgramBaseResultLike } from "./async.mjs";
6
8
  //#region src/runtime/polyfill/uiMediaApi.d.ts
7
9
  declare function showToast(options?: ShowToastOptions): Promise<any>;
8
10
  declare function showLoading(options?: ShowLoadingOptions): Promise<any>;
@@ -36,14 +38,7 @@ declare function chooseLocation(options?: ChooseLocationOptions): Promise<{
36
38
  declare function openLocation(options?: OpenLocationOptions): Promise<{
37
39
  errMsg: string;
38
40
  }>;
39
- declare function getImageInfo(options?: GetImageInfoOptions): Promise<{
40
- errMsg: string;
41
- width: number;
42
- height: number;
43
- path: any;
44
- type: string;
45
- orientation: string;
46
- }>;
41
+ declare function getImageInfo(options?: GetImageInfoOptions): Promise<MiniProgramBaseResultLike>;
47
42
  declare function getVideoInfo(options?: GetVideoInfoOptions): Promise<{
48
43
  errMsg: string;
49
44
  orientation: string;
@@ -57,6 +52,12 @@ declare function getVideoInfo(options?: GetVideoInfoOptions): Promise<{
57
52
  }>;
58
53
  declare function showTabBar(options?: TabBarOptions): Promise<any>;
59
54
  declare function hideTabBar(options?: TabBarOptions): Promise<any>;
55
+ declare function setTabBarItem(options: SetTabBarItemOptions): Promise<any>;
56
+ declare function setTabBarStyle(options: SetTabBarStyleOptions): Promise<any>;
57
+ declare function setTabBarBadge(options: SetTabBarBadgeOptions): Promise<any>;
58
+ declare function removeTabBarBadge(options: TabBarIndexOptions): Promise<any>;
59
+ declare function showTabBarRedDot(options: TabBarIndexOptions): Promise<any>;
60
+ declare function hideTabBarRedDot(options: TabBarIndexOptions): Promise<any>;
60
61
  declare function requestPayment(options?: RequestPaymentOptions): Promise<any>;
61
62
  declare function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult>;
62
63
  declare function showModal(options?: ShowModalOptions): Promise<any>;
@@ -167,5 +168,5 @@ declare function getClipboardData(options?: GetClipboardDataOptions): Promise<{
167
168
  data: string;
168
169
  }>;
169
170
  //#endregion
170
- export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showToast, updateShareMenu };
171
+ export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, hideTabBarRedDot, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, updateShareMenu };
171
172
  //# sourceMappingURL=uiMediaApi.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
2
2
  import { chooseAddressBridge, chooseLocationBridge, makePhoneCallBridge, openLocationBridge } from "./locationApi.mjs";
3
- import { hideTabBarBridge, requestPaymentBridge, requestSubscribeMessageBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, updateShareMenuBridge } from "./menuApi.mjs";
3
+ import { hideTabBarBridge, hideTabBarRedDotBridge, removeTabBarBadgeBridge, requestPaymentBridge, requestSubscribeMessageBridge, setTabBarBadgeBridge, setTabBarItemBridge, setTabBarStyleBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, showTabBarRedDotBridge, updateShareMenuBridge } from "./menuApi.mjs";
4
4
  import { getClipboardDataBridge, openCustomerServiceChatBridge, scanCodeBridge, setClipboardDataBridge } from "./interactionApi.mjs";
5
5
  import { openDocumentBridge, saveFileBridge, saveFileToDiskBridge, saveImageToPhotosAlbumBridge, saveVideoToPhotosAlbumBridge } from "./mediaApi/file.mjs";
6
6
  import { getImageInfoBridge, getVideoInfoBridge } from "./mediaApi/info.mjs";
@@ -25,6 +25,7 @@ var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
25
25
  getVideoInfo: () => getVideoInfo,
26
26
  hideLoading: () => hideLoading,
27
27
  hideTabBar: () => hideTabBar,
28
+ hideTabBarRedDot: () => hideTabBarRedDot,
28
29
  makePhoneCall: () => makePhoneCall,
29
30
  openCustomerServiceChat: () => openCustomerServiceChat,
30
31
  openDocument: () => openDocument,
@@ -32,6 +33,7 @@ var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
32
33
  openVideoEditor: () => openVideoEditor,
33
34
  previewImage: () => previewImage,
34
35
  previewMedia: () => previewMedia,
36
+ removeTabBarBadge: () => removeTabBarBadge,
35
37
  requestPayment: () => requestPayment,
36
38
  requestSubscribeMessage: () => requestSubscribeMessage,
37
39
  saveFile: () => saveFile,
@@ -40,11 +42,15 @@ var uiMediaApi_exports = /* @__PURE__ */ __exportAll({
40
42
  saveVideoToPhotosAlbum: () => saveVideoToPhotosAlbum,
41
43
  scanCode: () => scanCode,
42
44
  setClipboardData: () => setClipboardData,
45
+ setTabBarBadge: () => setTabBarBadge,
46
+ setTabBarItem: () => setTabBarItem,
47
+ setTabBarStyle: () => setTabBarStyle,
43
48
  showActionSheet: () => showActionSheet,
44
49
  showLoading: () => showLoading,
45
50
  showModal: () => showModal,
46
51
  showShareMenu: () => showShareMenu,
47
52
  showTabBar: () => showTabBar,
53
+ showTabBarRedDot: () => showTabBarRedDot,
48
54
  showToast: () => showToast,
49
55
  updateShareMenu: () => updateShareMenu
50
56
  });
@@ -90,6 +96,24 @@ function showTabBar(options) {
90
96
  function hideTabBar(options) {
91
97
  return hideTabBarBridge(options);
92
98
  }
99
+ function setTabBarItem(options) {
100
+ return setTabBarItemBridge(options);
101
+ }
102
+ function setTabBarStyle(options) {
103
+ return setTabBarStyleBridge(options);
104
+ }
105
+ function setTabBarBadge(options) {
106
+ return setTabBarBadgeBridge(options);
107
+ }
108
+ function removeTabBarBadge(options) {
109
+ return removeTabBarBadgeBridge(options);
110
+ }
111
+ function showTabBarRedDot(options) {
112
+ return showTabBarRedDotBridge(options);
113
+ }
114
+ function hideTabBarRedDot(options) {
115
+ return hideTabBarRedDotBridge(options);
116
+ }
93
117
  function requestPayment(options) {
94
118
  return requestPaymentBridge(options);
95
119
  }
@@ -158,5 +182,5 @@ async function getClipboardData(options) {
158
182
  }
159
183
 
160
184
  //#endregion
161
- export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showToast, uiMediaApi_exports, updateShareMenu };
185
+ export { chooseAddress, chooseFile, chooseImage, chooseLocation, chooseMedia, chooseMessageFile, chooseVideo, compressImage, compressVideo, getClipboardData, getImageInfo, getVideoInfo, hideLoading, hideTabBar, hideTabBarRedDot, makePhoneCall, openCustomerServiceChat, openDocument, openLocation, openVideoEditor, previewImage, previewMedia, removeTabBarBadge, requestPayment, requestSubscribeMessage, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, setClipboardData, setTabBarBadge, setTabBarItem, setTabBarStyle, showActionSheet, showLoading, showModal, showShareMenu, showTabBar, showTabBarRedDot, showToast, uiMediaApi_exports, updateShareMenu };
162
186
  //# sourceMappingURL=uiMediaApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarOptions,\n} from './types'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideTabBarBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,UAAU,SAA4B;CACpD,OAAO,gBAAgB,OAAO;AAChC;AAEA,SAAgB,YAAY,SAA8B;CACxD,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,YAAY,SAA0D;CACpF,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,cAAc,SAA4B;CACxD,OAAO,oBAAoB,OAAO;AACpC;AAEA,SAAgB,gBAAgB,SAA4B;CAC1D,OAAO,sBAAsB,OAAO;AACtC;AAE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AC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,gBAAgB,SAAkC;CAChE,OAAO,sBAAsB,OAAO;AACtC;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,SAAgB,eAAe,SAAiC;CAC9D,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC"}
1
+ {"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n SetTabBarBadgeOptions,\n SetTabBarItemOptions,\n SetTabBarStyleOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarIndexOptions,\n TabBarOptions,\n} from './types'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideTabBarBridge,\n hideTabBarRedDotBridge,\n removeTabBarBadgeBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n setTabBarBadgeBridge,\n setTabBarItemBridge,\n setTabBarStyleBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n showTabBarRedDotBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function setTabBarItem(options: SetTabBarItemOptions) {\n return setTabBarItemBridge(options)\n}\n\nexport function setTabBarStyle(options: SetTabBarStyleOptions) {\n return setTabBarStyleBridge(options)\n}\n\nexport function setTabBarBadge(options: SetTabBarBadgeOptions) {\n return setTabBarBadgeBridge(options)\n}\n\nexport function removeTabBarBadge(options: TabBarIndexOptions) {\n return removeTabBarBadgeBridge(options)\n}\n\nexport function showTabBarRedDot(options: TabBarIndexOptions) {\n return showTabBarRedDotBridge(options)\n}\n\nexport function hideTabBarRedDot(options: TabBarIndexOptions) {\n return hideTabBarRedDotBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,SAAgB,UAAU,SAA4B;CACpD,OAAO,gBAAgB,OAAO;AAChC;AAEA,SAAgB,YAAY,SAA8B;CACxD,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,YAAY,SAA0D;CACpF,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,cAAc,SAA4B;CAC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B,OAAO;AACtC;AAEA,eAAsB,YAAY,SAA8B;CAC9D,OAAO,kBAAkB,OAAO;AAClC;AAEA,eAAsB,YAAY,SAA8B;CAC9D,OAAO,kBAAkB,OAAO;AAClC;AAEA,eAAsB,cAAc,SAAgC;CAClE,OAAO,oBAAoB,OAAO;AACpC;AAEA,SAAgB,cAAc,SAAgC;CAC5D,OAAO,oBAAoB,OAAO;AACpC;AAEA,eAAsB,YAAY,SAA8B;CAC9D,OAAO,kBAAkB,OAAO;AAClC;AAEA,eAAsB,kBAAkB,SAAoC;CAC1E,OAAO,wBAAwB,OAAO;AACxC;AAEA,eAAsB,WAAW,SAA6B;CAC5D,OAAO,iBAAiB,OAAO;AACjC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,gBAAgB,SAAkC;CAChE,OAAO,sBAAsB,OAAO;AACtC;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,SAAgB,eAAe,SAAiC;CAC9D,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC"}
@@ -1,8 +1,12 @@
1
+ import { resolveNativeMediaElement } from "../nativeComponents/mediaRegistry.mjs";
2
+
1
3
  //#region src/runtime/polyfill/videoContext.ts
2
4
  function resolveVideoElementById(videoId) {
3
5
  if (typeof document === "undefined") return;
4
6
  const normalized = String(videoId ?? "").trim();
5
7
  if (!normalized) return;
8
+ const registered = resolveNativeMediaElement("video", normalized);
9
+ if (registered) return registered;
6
10
  const fromId = document.getElementById(normalized);
7
11
  if (fromId && "play" in fromId && "pause" in fromId) return fromId;
8
12
  const escaped = typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(normalized) : normalized.replace(/"/g, "\\\"");