@weapp-vite/web 1.3.15 → 1.3.17

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 (243) hide show
  1. package/README.md +2 -2
  2. package/dist/_virtual/_rolldown/runtime.mjs +18 -0
  3. package/dist/compiler/wxml/attributes.mjs +93 -0
  4. package/dist/compiler/wxml/attributes.mjs.map +1 -0
  5. package/dist/compiler/wxml/compile.mjs +158 -0
  6. package/dist/compiler/wxml/compile.mjs.map +1 -0
  7. package/dist/compiler/wxml/dependency.mjs +31 -0
  8. package/dist/compiler/wxml/dependency.mjs.map +1 -0
  9. package/dist/compiler/wxml/interpolation.mjs +142 -0
  10. package/dist/compiler/wxml/interpolation.mjs.map +1 -0
  11. package/dist/compiler/wxml/navigation.mjs +85 -0
  12. package/dist/compiler/wxml/navigation.mjs.map +1 -0
  13. package/dist/compiler/wxml/parser.mjs +41 -0
  14. package/dist/compiler/wxml/parser.mjs.map +1 -0
  15. package/dist/compiler/wxml/renderer.mjs +114 -0
  16. package/dist/compiler/wxml/renderer.mjs.map +1 -0
  17. package/dist/compiler/wxml/specialNodes.mjs +85 -0
  18. package/dist/compiler/wxml/specialNodes.mjs.map +1 -0
  19. package/dist/compiler/wxs.mjs +83 -0
  20. package/dist/compiler/wxs.mjs.map +1 -0
  21. package/dist/css/wxss.d.mts +25 -0
  22. package/dist/css/wxss.mjs +17 -0
  23. package/dist/css/wxss.mjs.map +1 -0
  24. package/dist/index.d.mts +18 -2
  25. package/dist/index.mjs +18 -3
  26. package/dist/plugin/constants.mjs +43 -0
  27. package/dist/plugin/constants.mjs.map +1 -0
  28. package/dist/plugin/entry.mjs +29 -0
  29. package/dist/plugin/entry.mjs.map +1 -0
  30. package/dist/plugin/files.mjs +58 -0
  31. package/dist/plugin/files.mjs.map +1 -0
  32. package/dist/plugin/index.d.mts +33 -0
  33. package/dist/plugin/index.mjs +188 -0
  34. package/dist/plugin/index.mjs.map +1 -0
  35. package/dist/plugin/navigation.mjs +20 -0
  36. package/dist/plugin/navigation.mjs.map +1 -0
  37. package/dist/plugin/path.mjs +85 -0
  38. package/dist/plugin/path.mjs.map +1 -0
  39. package/dist/plugin/register.mjs +83 -0
  40. package/dist/plugin/register.mjs.map +1 -0
  41. package/dist/plugin/scan.mjs +195 -0
  42. package/dist/plugin/scan.mjs.map +1 -0
  43. package/dist/plugin/scanConfig.mjs +45 -0
  44. package/dist/plugin/scanConfig.mjs.map +1 -0
  45. package/dist/plugin/state.mjs +22 -0
  46. package/dist/plugin/state.mjs.map +1 -0
  47. package/dist/plugin/types.d.mts +46 -0
  48. package/dist/plugin.d.mts +3 -2
  49. package/dist/plugin.mjs +3 -2
  50. package/dist/runtime/button/helpers.mjs +92 -0
  51. package/dist/runtime/button/helpers.mjs.map +1 -0
  52. package/dist/runtime/button/index.d.mts +9 -0
  53. package/dist/runtime/button/index.mjs +198 -0
  54. package/dist/runtime/button/index.mjs.map +1 -0
  55. package/dist/runtime/button/style.mjs +168 -0
  56. package/dist/runtime/button/style.mjs.map +1 -0
  57. package/dist/runtime/component/behavior.mjs +98 -0
  58. package/dist/runtime/component/behavior.mjs.map +1 -0
  59. package/dist/runtime/component/constants.mjs +13 -0
  60. package/dist/runtime/component/constants.mjs.map +1 -0
  61. package/dist/runtime/component/dom.mjs +32 -0
  62. package/dist/runtime/component/dom.mjs.map +1 -0
  63. package/dist/runtime/component/element.mjs +208 -0
  64. package/dist/runtime/component/element.mjs.map +1 -0
  65. package/dist/runtime/component/events.mjs +49 -0
  66. package/dist/runtime/component/events.mjs.map +1 -0
  67. package/dist/runtime/component/index.d.mts +7 -0
  68. package/dist/runtime/component/index.mjs +44 -0
  69. package/dist/runtime/component/index.mjs.map +1 -0
  70. package/dist/runtime/component/state.mjs +63 -0
  71. package/dist/runtime/component/state.mjs.map +1 -0
  72. package/dist/runtime/component/types.d.mts +49 -0
  73. package/dist/runtime/component/utils.mjs +39 -0
  74. package/dist/runtime/component/utils.mjs.map +1 -0
  75. package/dist/runtime/execution.d.mts +7 -0
  76. package/dist/runtime/execution.mjs +37 -0
  77. package/dist/runtime/execution.mjs.map +1 -0
  78. package/dist/runtime/index.d.mts +16 -2
  79. package/dist/runtime/index.mjs +16 -2
  80. package/dist/runtime/legacyTemplate/dom.mjs +76 -0
  81. package/dist/runtime/legacyTemplate/dom.mjs.map +1 -0
  82. package/dist/runtime/legacyTemplate/expression.mjs +113 -0
  83. package/dist/runtime/legacyTemplate/expression.mjs.map +1 -0
  84. package/dist/runtime/legacyTemplate/index.d.mts +9 -0
  85. package/dist/runtime/legacyTemplate/index.mjs +132 -0
  86. package/dist/runtime/legacyTemplate/index.mjs.map +1 -0
  87. package/dist/runtime/legacyTemplate/types.d.mts +6 -0
  88. package/dist/runtime/navigationBar/index.d.mts +10 -0
  89. package/dist/runtime/navigationBar/index.mjs +162 -0
  90. package/dist/runtime/navigationBar/index.mjs.map +1 -0
  91. package/dist/runtime/navigationBar/style.mjs +108 -0
  92. package/dist/runtime/navigationBar/style.mjs.map +1 -0
  93. package/dist/runtime/polyfill/ad.mjs +150 -0
  94. package/dist/runtime/polyfill/ad.mjs.map +1 -0
  95. package/dist/runtime/polyfill/appState.mjs +31 -0
  96. package/dist/runtime/polyfill/appState.mjs.map +1 -0
  97. package/dist/runtime/polyfill/async.mjs +31 -0
  98. package/dist/runtime/polyfill/async.mjs.map +1 -0
  99. package/dist/runtime/polyfill/auth.mjs +120 -0
  100. package/dist/runtime/polyfill/auth.mjs.map +1 -0
  101. package/dist/runtime/polyfill/authApi.mjs +101 -0
  102. package/dist/runtime/polyfill/authApi.mjs.map +1 -0
  103. package/dist/runtime/polyfill/background.mjs +31 -0
  104. package/dist/runtime/polyfill/background.mjs.map +1 -0
  105. package/dist/runtime/polyfill/canvasContext.mjs +115 -0
  106. package/dist/runtime/polyfill/canvasContext.mjs.map +1 -0
  107. package/dist/runtime/polyfill/capability.mjs +20 -0
  108. package/dist/runtime/polyfill/capability.mjs.map +1 -0
  109. package/dist/runtime/polyfill/cloud.mjs +39 -0
  110. package/dist/runtime/polyfill/cloud.mjs.map +1 -0
  111. package/dist/runtime/polyfill/device.mjs +44 -0
  112. package/dist/runtime/polyfill/device.mjs.map +1 -0
  113. package/dist/runtime/polyfill/deviceApi.mjs +31 -0
  114. package/dist/runtime/polyfill/deviceApi.mjs.map +1 -0
  115. package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +102 -0
  116. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +144 -0
  117. package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -0
  118. package/dist/runtime/polyfill/filePicker.mjs +158 -0
  119. package/dist/runtime/polyfill/filePicker.mjs.map +1 -0
  120. package/dist/runtime/polyfill/fileSystemManager.mjs +45 -0
  121. package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -0
  122. package/dist/runtime/polyfill/files.mjs +118 -0
  123. package/dist/runtime/polyfill/files.mjs.map +1 -0
  124. package/dist/runtime/polyfill/index.d.mts +40 -0
  125. package/dist/runtime/polyfill/index.mjs +110 -0
  126. package/dist/runtime/polyfill/index.mjs.map +1 -0
  127. package/dist/runtime/polyfill/interaction.mjs +38 -0
  128. package/dist/runtime/polyfill/interaction.mjs.map +1 -0
  129. package/dist/runtime/polyfill/interactionApi.mjs +54 -0
  130. package/dist/runtime/polyfill/interactionApi.mjs.map +1 -0
  131. package/dist/runtime/polyfill/location.mjs +106 -0
  132. package/dist/runtime/polyfill/location.mjs.map +1 -0
  133. package/dist/runtime/polyfill/locationApi.mjs +120 -0
  134. package/dist/runtime/polyfill/locationApi.mjs.map +1 -0
  135. package/dist/runtime/polyfill/mediaActions.mjs +52 -0
  136. package/dist/runtime/polyfill/mediaActions.mjs.map +1 -0
  137. package/dist/runtime/polyfill/mediaApi/file.mjs +63 -0
  138. package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -0
  139. package/dist/runtime/polyfill/mediaApi/info.mjs +59 -0
  140. package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -0
  141. package/dist/runtime/polyfill/mediaApi/picker.mjs +82 -0
  142. package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -0
  143. package/dist/runtime/polyfill/mediaApi/preview.mjs +39 -0
  144. package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -0
  145. package/dist/runtime/polyfill/mediaApi/process.mjs +46 -0
  146. package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -0
  147. package/dist/runtime/polyfill/mediaInfo.mjs +136 -0
  148. package/dist/runtime/polyfill/mediaInfo.mjs.map +1 -0
  149. package/dist/runtime/polyfill/mediaPicker.mjs +213 -0
  150. package/dist/runtime/polyfill/mediaPicker.mjs.map +1 -0
  151. package/dist/runtime/polyfill/mediaProcess.mjs +65 -0
  152. package/dist/runtime/polyfill/mediaProcess.mjs.map +1 -0
  153. package/dist/runtime/polyfill/menuApi.mjs +70 -0
  154. package/dist/runtime/polyfill/menuApi.mjs.map +1 -0
  155. package/dist/runtime/polyfill/navigationBarRuntime.mjs +66 -0
  156. package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -0
  157. package/dist/runtime/polyfill/network/request.mjs +162 -0
  158. package/dist/runtime/polyfill/network/request.mjs.map +1 -0
  159. package/dist/runtime/polyfill/network/requestBridge.mjs +49 -0
  160. package/dist/runtime/polyfill/network/requestBridge.mjs.map +1 -0
  161. package/dist/runtime/polyfill/network/status.mjs +55 -0
  162. package/dist/runtime/polyfill/network/status.mjs.map +1 -0
  163. package/dist/runtime/polyfill/platformApi.mjs +33 -0
  164. package/dist/runtime/polyfill/platformApi.mjs.map +1 -0
  165. package/dist/runtime/polyfill/platformRuntime.mjs +120 -0
  166. package/dist/runtime/polyfill/platformRuntime.mjs.map +1 -0
  167. package/dist/runtime/polyfill/routeRuntime/dom.mjs +36 -0
  168. package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -0
  169. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +83 -0
  170. package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -0
  171. package/dist/runtime/polyfill/routeRuntime/options.d.mts +33 -0
  172. package/dist/runtime/polyfill/routeRuntime/options.mjs +76 -0
  173. package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -0
  174. package/dist/runtime/polyfill/routeRuntime/url.mjs +35 -0
  175. package/dist/runtime/polyfill/routeRuntime/url.mjs.map +1 -0
  176. package/dist/runtime/polyfill/routeRuntime.d.mts +43 -0
  177. package/dist/runtime/polyfill/routeRuntime.mjs +202 -0
  178. package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -0
  179. package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +26 -0
  180. package/dist/runtime/polyfill/runtimeCapabilityApi.mjs.map +1 -0
  181. package/dist/runtime/polyfill/runtimeDataApi.d.mts +79 -0
  182. package/dist/runtime/polyfill/runtimeDataApi.mjs +134 -0
  183. package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -0
  184. package/dist/runtime/polyfill/runtimeInfra.mjs +40 -0
  185. package/dist/runtime/polyfill/runtimeInfra.mjs.map +1 -0
  186. package/dist/runtime/polyfill/runtimeOps.mjs +62 -0
  187. package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -0
  188. package/dist/runtime/polyfill/selectorQuery.mjs +204 -0
  189. package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -0
  190. package/dist/runtime/polyfill/storage.mjs +103 -0
  191. package/dist/runtime/polyfill/storage.mjs.map +1 -0
  192. package/dist/runtime/polyfill/storageAsync.mjs +62 -0
  193. package/dist/runtime/polyfill/storageAsync.mjs.map +1 -0
  194. package/dist/runtime/polyfill/subscribe.mjs +30 -0
  195. package/dist/runtime/polyfill/subscribe.mjs.map +1 -0
  196. package/dist/runtime/polyfill/system.mjs +111 -0
  197. package/dist/runtime/polyfill/system.mjs.map +1 -0
  198. package/dist/runtime/polyfill/systemApi.mjs +65 -0
  199. package/dist/runtime/polyfill/systemApi.mjs.map +1 -0
  200. package/dist/runtime/polyfill/types/base.d.mts +12 -0
  201. package/dist/runtime/polyfill/types/common.d.mts +126 -0
  202. package/dist/runtime/polyfill/types/locationRuntime.d.mts +151 -0
  203. package/dist/runtime/polyfill/types/mediaAuth.d.mts +152 -0
  204. package/dist/runtime/polyfill/types/platformRuntime.d.mts +141 -0
  205. package/dist/runtime/polyfill/types/systemAuth.d.mts +122 -0
  206. package/dist/runtime/polyfill/ui.mjs +135 -0
  207. package/dist/runtime/polyfill/ui.mjs.map +1 -0
  208. package/dist/runtime/polyfill/uiFeedback.mjs +35 -0
  209. package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -0
  210. package/dist/runtime/polyfill/uiMediaApi.d.mts +172 -0
  211. package/dist/runtime/polyfill/uiMediaApi.mjs +162 -0
  212. package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -0
  213. package/dist/runtime/polyfill/videoContext.mjs +56 -0
  214. package/dist/runtime/polyfill/videoContext.mjs.map +1 -0
  215. package/dist/runtime/polyfill/vkSession.mjs +58 -0
  216. package/dist/runtime/polyfill/vkSession.mjs.map +1 -0
  217. package/dist/runtime/polyfill/windowResize.mjs +39 -0
  218. package/dist/runtime/polyfill/windowResize.mjs.map +1 -0
  219. package/dist/runtime/polyfill/worker.mjs +77 -0
  220. package/dist/runtime/polyfill/worker.mjs.map +1 -0
  221. package/dist/runtime/polyfill.d.mts +5 -0
  222. package/dist/runtime/renderContext.d.mts +21 -0
  223. package/dist/runtime/renderContext.mjs +147 -0
  224. package/dist/runtime/renderContext.mjs.map +1 -0
  225. package/dist/runtime/rpx.d.mts +9 -0
  226. package/dist/runtime/rpx.mjs +27 -0
  227. package/dist/runtime/rpx.mjs.map +1 -0
  228. package/dist/runtime/style.d.mts +6 -0
  229. package/dist/runtime/style.mjs +37 -0
  230. package/dist/runtime/style.mjs.map +1 -0
  231. package/dist/runtime/template.d.mts +10 -0
  232. package/dist/runtime/warning.d.mts +10 -0
  233. package/dist/runtime/warning.mjs +43 -0
  234. package/dist/runtime/warning.mjs.map +1 -0
  235. package/dist/{slugify-B4l45KNs.mjs → shared/slugify.mjs} +3 -1
  236. package/dist/shared/slugify.mjs.map +1 -0
  237. package/dist/shared/wxml.mjs +83 -0
  238. package/dist/shared/wxml.mjs.map +1 -0
  239. package/package.json +2 -2
  240. package/dist/index-w9xxIH-l.d.mts +0 -1229
  241. package/dist/plugin-BARxSPO8.mjs +0 -1567
  242. package/dist/plugin-DP2iPVmw.d.mts +0 -96
  243. package/dist/runtime-D6j2_x_N.mjs +0 -6251
@@ -0,0 +1,54 @@
1
+ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
+ import { getGlobalDialogHandlers } from "./ui.mjs";
3
+ import { readClipboardData, resolveScanCodeResult, writeClipboardData } from "./interaction.mjs";
4
+
5
+ //#region src/runtime/polyfill/interactionApi.ts
6
+ function openCustomerServiceChatBridge(options) {
7
+ const url = options?.url?.trim() ?? "";
8
+ if (url && typeof window !== "undefined" && typeof window.open === "function") try {
9
+ window.open(url, "_blank", "noopener,noreferrer");
10
+ } catch {}
11
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "openCustomerServiceChat:ok" }));
12
+ }
13
+ function scanCodeBridge(options) {
14
+ const { prompt } = getGlobalDialogHandlers();
15
+ const resultText = resolveScanCodeResult(prompt);
16
+ if (resultText == null) {
17
+ const failure = callMiniProgramAsyncFailure(options, "scanCode:fail cancel");
18
+ return Promise.reject(failure);
19
+ }
20
+ const result = callMiniProgramAsyncSuccess(options, {
21
+ errMsg: "scanCode:ok",
22
+ result: resultText,
23
+ scanType: "QR_CODE",
24
+ charSet: "utf-8",
25
+ path: resultText,
26
+ rawData: resultText
27
+ });
28
+ return Promise.resolve(result);
29
+ }
30
+ async function setClipboardDataBridge(options) {
31
+ const data = String(options?.data ?? "");
32
+ try {
33
+ await writeClipboardData(data);
34
+ } catch (error) {
35
+ const failure = callMiniProgramAsyncFailure(options, `setClipboardData:fail ${error instanceof Error ? error.message : String(error)}`);
36
+ return Promise.reject(failure);
37
+ }
38
+ return callMiniProgramAsyncSuccess(options, { errMsg: "setClipboardData:ok" });
39
+ }
40
+ async function getClipboardDataBridge(options) {
41
+ try {
42
+ return callMiniProgramAsyncSuccess(options, {
43
+ errMsg: "getClipboardData:ok",
44
+ data: await readClipboardData()
45
+ });
46
+ } catch (error) {
47
+ const failure = callMiniProgramAsyncFailure(options, `getClipboardData:fail ${error instanceof Error ? error.message : String(error)}`);
48
+ return Promise.reject(failure);
49
+ }
50
+ }
51
+
52
+ //#endregion
53
+ export { getClipboardDataBridge, openCustomerServiceChatBridge, scanCodeBridge, setClipboardDataBridge };
54
+ //# sourceMappingURL=interactionApi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactionApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/interactionApi.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n readClipboardData,\n resolveScanCodeResult,\n writeClipboardData,\n} from './interaction'\nimport { getGlobalDialogHandlers } from './ui'\n\nexport function openCustomerServiceChatBridge(options?: any) {\n const url = options?.url?.trim() ?? ''\n if (url && typeof window !== 'undefined' && typeof window.open === 'function') {\n try {\n window.open(url, '_blank', 'noopener,noreferrer')\n }\n catch {\n // ignore browser popup restrictions\n }\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openCustomerServiceChat:ok' }))\n}\n\nexport function scanCodeBridge(options?: any) {\n const { prompt } = getGlobalDialogHandlers()\n const resultText = resolveScanCodeResult(prompt)\n if (resultText == null) {\n const failure = callMiniProgramAsyncFailure(options, 'scanCode:fail cancel')\n return Promise.reject(failure)\n }\n const result = callMiniProgramAsyncSuccess(options, {\n errMsg: 'scanCode:ok',\n result: resultText,\n scanType: 'QR_CODE',\n charSet: 'utf-8',\n path: resultText,\n rawData: resultText,\n })\n return Promise.resolve(result)\n}\n\nexport async function setClipboardDataBridge(options?: any) {\n const data = String(options?.data ?? '')\n try {\n await writeClipboardData(data)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `setClipboardData:fail ${message}`)\n return Promise.reject(failure)\n }\n return callMiniProgramAsyncSuccess(options, { errMsg: 'setClipboardData:ok' })\n}\n\nexport async function getClipboardDataBridge(options?: any) {\n try {\n const data = await readClipboardData()\n return callMiniProgramAsyncSuccess(options, { errMsg: 'getClipboardData:ok', data })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getClipboardData:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;AAWA,SAAgB,8BAA8B,SAAe;CAC3D,MAAM,MAAM,SAAS,KAAK,MAAM,IAAI;AACpC,KAAI,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,SAAS,WACjE,KAAI;AACF,SAAO,KAAK,KAAK,UAAU,sBAAsB;SAE7C;AAIR,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,8BAA8B,CAAC,CAAC;;AAGxG,SAAgB,eAAe,SAAe;CAC5C,MAAM,EAAE,WAAW,yBAAyB;CAC5C,MAAM,aAAa,sBAAsB,OAAO;AAChD,KAAI,cAAc,MAAM;EACtB,MAAM,UAAU,4BAA4B,SAAS,uBAAuB;AAC5E,SAAO,QAAQ,OAAO,QAAQ;;CAEhC,MAAM,SAAS,4BAA4B,SAAS;EAClD,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,SAAS;EACT,MAAM;EACN,SAAS;EACV,CAAC;AACF,QAAO,QAAQ,QAAQ,OAAO;;AAGhC,eAAsB,uBAAuB,SAAe;CAC1D,MAAM,OAAO,OAAO,SAAS,QAAQ,GAAG;AACxC,KAAI;AACF,QAAM,mBAAmB,KAAK;UAEzB,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,yBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACkB;AACxF,SAAO,QAAQ,OAAO,QAAQ;;AAEhC,QAAO,4BAA4B,SAAS,EAAE,QAAQ,uBAAuB,CAAC;;AAGhF,eAAsB,uBAAuB,SAAe;AAC1D,KAAI;AAEF,SAAO,4BAA4B,SAAS;GAAE,QAAQ;GAAuB,MADhE,MAAM,mBAAmB;GAC6C,CAAC;UAE/E,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,yBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACkB;AACxF,SAAO,QAAQ,OAAO,QAAQ"}
@@ -0,0 +1,106 @@
1
+ import { WEAPP_VITE_WEB_CHOOSE_ADDRESS_KEY, WEAPP_VITE_WEB_CHOOSE_LOCATION_KEY, WEAPP_VITE_WEB_FUZZY_LOCATION_KEY } from "@weapp-core/constants";
2
+
3
+ //#region src/runtime/polyfill/location.ts
4
+ const ADDRESS_PROMPT_SPLIT_RE = /[,,]/;
5
+ function normalizeGeoNumber(value, fallback = 0) {
6
+ if (typeof value !== "number" || Number.isNaN(value)) return fallback;
7
+ return value;
8
+ }
9
+ function readCurrentLocation(options) {
10
+ const geolocation = (typeof navigator !== "undefined" ? navigator : void 0)?.geolocation;
11
+ if (!geolocation || typeof geolocation.getCurrentPosition !== "function") throw new Error("geolocation is unavailable");
12
+ const timeout = typeof options?.highAccuracyExpireTime === "number" && options.highAccuracyExpireTime > 0 ? options.highAccuracyExpireTime : void 0;
13
+ return new Promise((resolve, reject) => {
14
+ geolocation.getCurrentPosition((position) => {
15
+ const coords = position.coords ?? {};
16
+ const accuracy = normalizeGeoNumber(coords.accuracy, 0);
17
+ resolve({
18
+ latitude: normalizeGeoNumber(coords.latitude, 0),
19
+ longitude: normalizeGeoNumber(coords.longitude, 0),
20
+ speed: normalizeGeoNumber(coords.speed, -1),
21
+ accuracy,
22
+ altitude: normalizeGeoNumber(coords.altitude, 0),
23
+ verticalAccuracy: normalizeGeoNumber(coords.altitudeAccuracy, 0),
24
+ horizontalAccuracy: accuracy
25
+ });
26
+ }, (error) => {
27
+ reject(new Error(error?.message ?? "unknown error"));
28
+ }, {
29
+ enableHighAccuracy: Boolean(options?.isHighAccuracy || options?.altitude),
30
+ timeout
31
+ });
32
+ });
33
+ }
34
+ function normalizeFuzzyCoordinate(value) {
35
+ return Number(value.toFixed(2));
36
+ }
37
+ function readPresetFuzzyLocation() {
38
+ const preset = globalThis[WEAPP_VITE_WEB_FUZZY_LOCATION_KEY];
39
+ if (!preset || typeof preset !== "object") return null;
40
+ const value = preset;
41
+ const latitude = Number(value.latitude);
42
+ const longitude = Number(value.longitude);
43
+ if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) return null;
44
+ return {
45
+ latitude: normalizeFuzzyCoordinate(latitude),
46
+ longitude: normalizeFuzzyCoordinate(longitude),
47
+ accuracy: Math.max(1e3, normalizeGeoNumber(value.accuracy, 1e3))
48
+ };
49
+ }
50
+ function readPresetChooseLocation() {
51
+ const preset = globalThis[WEAPP_VITE_WEB_CHOOSE_LOCATION_KEY];
52
+ if (!preset || typeof preset !== "object") return null;
53
+ const value = preset;
54
+ const latitude = Number(value.latitude);
55
+ const longitude = Number(value.longitude);
56
+ if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) return null;
57
+ return {
58
+ name: typeof value.name === "string" ? value.name : "",
59
+ address: typeof value.address === "string" ? value.address : "",
60
+ latitude,
61
+ longitude
62
+ };
63
+ }
64
+ function readPresetChooseAddress() {
65
+ const preset = globalThis[WEAPP_VITE_WEB_CHOOSE_ADDRESS_KEY];
66
+ if (!preset || typeof preset !== "object") return null;
67
+ const value = preset;
68
+ return {
69
+ userName: typeof value.userName === "string" ? value.userName : "",
70
+ postalCode: typeof value.postalCode === "string" ? value.postalCode : "",
71
+ provinceName: typeof value.provinceName === "string" ? value.provinceName : "",
72
+ cityName: typeof value.cityName === "string" ? value.cityName : "",
73
+ countyName: typeof value.countyName === "string" ? value.countyName : "",
74
+ detailInfo: typeof value.detailInfo === "string" ? value.detailInfo : "",
75
+ nationalCode: typeof value.nationalCode === "string" ? value.nationalCode : "",
76
+ telNumber: typeof value.telNumber === "string" ? value.telNumber : ""
77
+ };
78
+ }
79
+ function parseChooseAddressPromptInput(input) {
80
+ const [provinceName = "", cityName = "", countyName = "", detailInfo = "", userName = "", telNumber = ""] = String(input).split(ADDRESS_PROMPT_SPLIT_RE).map((item) => item.trim());
81
+ if (!provinceName || !cityName || !countyName || !detailInfo) return null;
82
+ return {
83
+ userName,
84
+ postalCode: "",
85
+ provinceName,
86
+ cityName,
87
+ countyName,
88
+ detailInfo,
89
+ nationalCode: "",
90
+ telNumber
91
+ };
92
+ }
93
+ function parseChooseLocationPromptInput(input) {
94
+ const [latText = "", lonText = ""] = String(input).split(",").map((item) => item.trim());
95
+ const latitude = Number(latText);
96
+ const longitude = Number(lonText);
97
+ if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) return null;
98
+ return {
99
+ latitude,
100
+ longitude
101
+ };
102
+ }
103
+
104
+ //#endregion
105
+ export { normalizeFuzzyCoordinate, normalizeGeoNumber, parseChooseAddressPromptInput, parseChooseLocationPromptInput, readCurrentLocation, readPresetChooseAddress, readPresetChooseLocation, readPresetFuzzyLocation };
106
+ //# sourceMappingURL=location.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.mjs","names":[],"sources":["../../../src/runtime/polyfill/location.ts"],"sourcesContent":["import {\n WEAPP_VITE_WEB_CHOOSE_ADDRESS_KEY,\n WEAPP_VITE_WEB_CHOOSE_LOCATION_KEY,\n WEAPP_VITE_WEB_FUZZY_LOCATION_KEY,\n} from '@weapp-core/constants'\n\nconst ADDRESS_PROMPT_SPLIT_RE = /[,,]/\n\nexport function normalizeGeoNumber(value: unknown, fallback = 0) {\n if (typeof value !== 'number' || Number.isNaN(value)) {\n return fallback\n }\n return value\n}\n\ninterface ReadCurrentLocationOptions {\n isHighAccuracy?: boolean\n altitude?: boolean\n highAccuracyExpireTime?: number\n}\n\ninterface LocationCoordinatesSnapshot {\n latitude: number\n longitude: number\n speed: number\n accuracy: number\n altitude: number\n verticalAccuracy: number\n horizontalAccuracy: number\n}\n\nexport function readCurrentLocation(options?: ReadCurrentLocationOptions) {\n const runtimeNavigator = (typeof navigator !== 'undefined' ? navigator : undefined) as (Navigator & {\n geolocation?: {\n getCurrentPosition?: (\n success: (position: {\n coords: {\n latitude?: number\n longitude?: number\n speed?: number | null\n accuracy?: number\n altitude?: number | null\n altitudeAccuracy?: number | null\n }\n }) => void,\n error?: (err: { message?: string }) => void,\n opts?: {\n enableHighAccuracy?: boolean\n timeout?: number\n },\n ) => void\n }\n }) | undefined\n const geolocation = runtimeNavigator?.geolocation\n if (!geolocation || typeof geolocation.getCurrentPosition !== 'function') {\n throw new Error('geolocation is unavailable')\n }\n const timeout = typeof options?.highAccuracyExpireTime === 'number' && options.highAccuracyExpireTime > 0\n ? options.highAccuracyExpireTime\n : undefined\n return new Promise<LocationCoordinatesSnapshot>((resolve, reject) => {\n geolocation.getCurrentPosition(\n (position) => {\n const coords = position.coords ?? {}\n const accuracy = normalizeGeoNumber(coords.accuracy, 0)\n resolve({\n latitude: normalizeGeoNumber(coords.latitude, 0),\n longitude: normalizeGeoNumber(coords.longitude, 0),\n speed: normalizeGeoNumber(coords.speed, -1),\n accuracy,\n altitude: normalizeGeoNumber(coords.altitude, 0),\n verticalAccuracy: normalizeGeoNumber(coords.altitudeAccuracy, 0),\n horizontalAccuracy: accuracy,\n })\n },\n (error) => {\n reject(new Error(error?.message ?? 'unknown error'))\n },\n {\n enableHighAccuracy: Boolean(options?.isHighAccuracy || options?.altitude),\n timeout,\n },\n )\n })\n}\n\nexport function normalizeFuzzyCoordinate(value: number) {\n return Number(value.toFixed(2))\n}\n\nexport function readPresetFuzzyLocation() {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_FUZZY_LOCATION_KEY]\n if (!preset || typeof preset !== 'object') {\n return null\n }\n const value = preset as Record<string, unknown>\n const latitude = Number(value.latitude)\n const longitude = Number(value.longitude)\n if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) {\n return null\n }\n return {\n latitude: normalizeFuzzyCoordinate(latitude),\n longitude: normalizeFuzzyCoordinate(longitude),\n accuracy: Math.max(1000, normalizeGeoNumber(value.accuracy, 1000)),\n }\n}\n\nexport function readPresetChooseLocation() {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_CHOOSE_LOCATION_KEY]\n if (!preset || typeof preset !== 'object') {\n return null\n }\n const value = preset as Record<string, unknown>\n const latitude = Number(value.latitude)\n const longitude = Number(value.longitude)\n if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) {\n return null\n }\n return {\n name: typeof value.name === 'string' ? value.name : '',\n address: typeof value.address === 'string' ? value.address : '',\n latitude,\n longitude,\n }\n}\n\nexport function readPresetChooseAddress() {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_CHOOSE_ADDRESS_KEY]\n if (!preset || typeof preset !== 'object') {\n return null\n }\n const value = preset as Record<string, unknown>\n return {\n userName: typeof value.userName === 'string' ? value.userName : '',\n postalCode: typeof value.postalCode === 'string' ? value.postalCode : '',\n provinceName: typeof value.provinceName === 'string' ? value.provinceName : '',\n cityName: typeof value.cityName === 'string' ? value.cityName : '',\n countyName: typeof value.countyName === 'string' ? value.countyName : '',\n detailInfo: typeof value.detailInfo === 'string' ? value.detailInfo : '',\n nationalCode: typeof value.nationalCode === 'string' ? value.nationalCode : '',\n telNumber: typeof value.telNumber === 'string' ? value.telNumber : '',\n }\n}\n\nexport function parseChooseAddressPromptInput(input: unknown) {\n const [provinceName = '', cityName = '', countyName = '', detailInfo = '', userName = '', telNumber = '']\n = String(input).split(ADDRESS_PROMPT_SPLIT_RE).map(item => item.trim())\n if (!provinceName || !cityName || !countyName || !detailInfo) {\n return null\n }\n return {\n userName,\n postalCode: '',\n provinceName,\n cityName,\n countyName,\n detailInfo,\n nationalCode: '',\n telNumber,\n }\n}\n\nexport function parseChooseLocationPromptInput(input: unknown) {\n const [latText = '', lonText = ''] = String(input).split(',').map(item => item.trim())\n const latitude = Number(latText)\n const longitude = Number(lonText)\n if (!Number.isFinite(latitude) || !Number.isFinite(longitude)) {\n return null\n }\n return {\n latitude,\n longitude,\n }\n}\n"],"mappings":";;;AAMA,MAAM,0BAA0B;AAEhC,SAAgB,mBAAmB,OAAgB,WAAW,GAAG;AAC/D,KAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CAClD,QAAO;AAET,QAAO;;AAmBT,SAAgB,oBAAoB,SAAsC;CAsBxE,MAAM,eArBoB,OAAO,cAAc,cAAc,YAAY,SAqBnC;AACtC,KAAI,CAAC,eAAe,OAAO,YAAY,uBAAuB,WAC5D,OAAM,IAAI,MAAM,6BAA6B;CAE/C,MAAM,UAAU,OAAO,SAAS,2BAA2B,YAAY,QAAQ,yBAAyB,IACpG,QAAQ,yBACR;AACJ,QAAO,IAAI,SAAsC,SAAS,WAAW;AACnE,cAAY,oBACT,aAAa;GACZ,MAAM,SAAS,SAAS,UAAU,EAAE;GACpC,MAAM,WAAW,mBAAmB,OAAO,UAAU,EAAE;AACvD,WAAQ;IACN,UAAU,mBAAmB,OAAO,UAAU,EAAE;IAChD,WAAW,mBAAmB,OAAO,WAAW,EAAE;IAClD,OAAO,mBAAmB,OAAO,OAAO,GAAG;IAC3C;IACA,UAAU,mBAAmB,OAAO,UAAU,EAAE;IAChD,kBAAkB,mBAAmB,OAAO,kBAAkB,EAAE;IAChE,oBAAoB;IACrB,CAAC;MAEH,UAAU;AACT,UAAO,IAAI,MAAM,OAAO,WAAW,gBAAgB,CAAC;KAEtD;GACE,oBAAoB,QAAQ,SAAS,kBAAkB,SAAS,SAAS;GACzE;GACD,CACF;GACD;;AAGJ,SAAgB,yBAAyB,OAAe;AACtD,QAAO,OAAO,MAAM,QAAQ,EAAE,CAAC;;AAGjC,SAAgB,0BAA0B;CAExC,MAAM,SADgB,WACO;AAC7B,KAAI,CAAC,UAAU,OAAO,WAAW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H,SAAgB,8BAA8B,OAAgB;CAC5D,MAAM,CAAC,eAAe,IAAI,WAAW,IAAI,aAAa,IAAI,aAAa,IAAI,WAAW,IAAI,YAAY,MAClG,OAAO,MAAM,CAAC,MAAM,wBAAwB,CAAC,KAAI,SAAQ,KAAK,MAAM,CAAC;AACzE,KAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,cAAc,CAAC,WAChD,QAAO;AAET,QAAO;EACL;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA,cAAc;EACd;EACD;;AAGH,SAAgB,+BAA+B,OAAgB;CAC7D,MAAM,CAAC,UAAU,IAAI,UAAU,MAAM,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,KAAI,SAAQ,KAAK,MAAM,CAAC;CACtF,MAAM,WAAW,OAAO,QAAQ;CAChC,MAAM,YAAY,OAAO,QAAQ;AACjC,KAAI,CAAC,OAAO,SAAS,SAAS,IAAI,CAAC,OAAO,SAAS,UAAU,CAC3D,QAAO;AAET,QAAO;EACL;EACA;EACD"}
@@ -0,0 +1,120 @@
1
+ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
+ import { normalizeFuzzyCoordinate, normalizeGeoNumber, parseChooseAddressPromptInput, parseChooseLocationPromptInput, readCurrentLocation, readPresetChooseAddress, readPresetChooseLocation, readPresetFuzzyLocation } from "./location.mjs";
3
+ import { openTargetInNewWindow } from "./mediaActions.mjs";
4
+ import { getGlobalDialogHandlers } from "./ui.mjs";
5
+
6
+ //#region src/runtime/polyfill/locationApi.ts
7
+ function makePhoneCallBridge(options) {
8
+ const phoneNumber = typeof options?.phoneNumber === "string" ? options.phoneNumber.trim() : "";
9
+ if (!phoneNumber) {
10
+ const failure = callMiniProgramAsyncFailure(options, "makePhoneCall:fail invalid phoneNumber");
11
+ return Promise.reject(failure);
12
+ }
13
+ if (typeof window !== "undefined" && typeof window.open === "function") try {
14
+ window.open(`tel:${encodeURIComponent(phoneNumber)}`, "_self");
15
+ } catch {}
16
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "makePhoneCall:ok" }));
17
+ }
18
+ function chooseAddressBridge(options) {
19
+ const preset = readPresetChooseAddress();
20
+ if (preset) return Promise.resolve(callMiniProgramAsyncSuccess(options, {
21
+ errMsg: "chooseAddress:ok",
22
+ ...preset
23
+ }));
24
+ const { prompt } = getGlobalDialogHandlers();
25
+ if (typeof prompt === "function") {
26
+ const input = prompt("请输入地址(格式:省,市,区,详细地址,姓名,电话)", "");
27
+ if (input == null) {
28
+ const failure = callMiniProgramAsyncFailure(options, "chooseAddress:fail cancel");
29
+ return Promise.reject(failure);
30
+ }
31
+ const parsed = parseChooseAddressPromptInput(input);
32
+ if (!parsed) {
33
+ const failure = callMiniProgramAsyncFailure(options, "chooseAddress:fail invalid input");
34
+ return Promise.reject(failure);
35
+ }
36
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, {
37
+ errMsg: "chooseAddress:ok",
38
+ ...parsed
39
+ }));
40
+ }
41
+ const failure = callMiniProgramAsyncFailure(options, "chooseAddress:fail address picker is unavailable");
42
+ return Promise.reject(failure);
43
+ }
44
+ function chooseLocationBridge(options) {
45
+ const preset = readPresetChooseLocation();
46
+ if (preset) return Promise.resolve(callMiniProgramAsyncSuccess(options, {
47
+ errMsg: "chooseLocation:ok",
48
+ ...preset
49
+ }));
50
+ const { prompt } = getGlobalDialogHandlers();
51
+ if (typeof prompt === "function") {
52
+ const input = prompt("请输入坐标(格式:latitude,longitude)", "");
53
+ if (input == null) {
54
+ const failure = callMiniProgramAsyncFailure(options, "chooseLocation:fail cancel");
55
+ return Promise.reject(failure);
56
+ }
57
+ const parsed = parseChooseLocationPromptInput(input);
58
+ if (!parsed) {
59
+ const failure = callMiniProgramAsyncFailure(options, "chooseLocation:fail invalid latitude/longitude");
60
+ return Promise.reject(failure);
61
+ }
62
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, {
63
+ errMsg: "chooseLocation:ok",
64
+ name: "",
65
+ address: "",
66
+ latitude: parsed.latitude,
67
+ longitude: parsed.longitude
68
+ }));
69
+ }
70
+ const failure = callMiniProgramAsyncFailure(options, "chooseLocation:fail location picker is unavailable");
71
+ return Promise.reject(failure);
72
+ }
73
+ function openLocationBridge(options) {
74
+ const latitude = options?.latitude;
75
+ const longitude = options?.longitude;
76
+ if (typeof latitude !== "number" || Number.isNaN(latitude) || typeof longitude !== "number" || Number.isNaN(longitude)) {
77
+ const failure = callMiniProgramAsyncFailure(options, "openLocation:fail invalid latitude/longitude");
78
+ return Promise.reject(failure);
79
+ }
80
+ const query = `${latitude},${longitude}`;
81
+ openTargetInNewWindow(`https://maps.google.com/?q=${encodeURIComponent(query)}`);
82
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "openLocation:ok" }));
83
+ }
84
+ function getLocationBridge(options) {
85
+ try {
86
+ return readCurrentLocation(options).then((location) => callMiniProgramAsyncSuccess(options, {
87
+ errMsg: "getLocation:ok",
88
+ ...location
89
+ })).catch((error) => {
90
+ const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${error instanceof Error ? error.message : String(error)}`);
91
+ return Promise.reject(failure);
92
+ });
93
+ } catch (error) {
94
+ const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${error instanceof Error ? error.message : String(error)}`);
95
+ return Promise.reject(failure);
96
+ }
97
+ }
98
+ async function getFuzzyLocationBridge(options) {
99
+ const preset = readPresetFuzzyLocation();
100
+ if (preset) return callMiniProgramAsyncSuccess(options, {
101
+ errMsg: "getFuzzyLocation:ok",
102
+ ...preset
103
+ });
104
+ try {
105
+ const location = await getLocationBridge();
106
+ return callMiniProgramAsyncSuccess(options, {
107
+ errMsg: "getFuzzyLocation:ok",
108
+ latitude: normalizeFuzzyCoordinate(location.latitude),
109
+ longitude: normalizeFuzzyCoordinate(location.longitude),
110
+ accuracy: Math.max(1e3, normalizeGeoNumber(location.accuracy, 1e3))
111
+ });
112
+ } catch (error) {
113
+ const failure = callMiniProgramAsyncFailure(options, `getFuzzyLocation:fail ${typeof error?.errMsg === "string" ? error.errMsg : error instanceof Error ? error.message : String(error)}`);
114
+ return Promise.reject(failure);
115
+ }
116
+ }
117
+
118
+ //#endregion
119
+ export { chooseAddressBridge, chooseLocationBridge, getFuzzyLocationBridge, getLocationBridge, makePhoneCallBridge, openLocationBridge };
120
+ //# sourceMappingURL=locationApi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locationApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/locationApi.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n normalizeFuzzyCoordinate,\n normalizeGeoNumber,\n parseChooseAddressPromptInput,\n parseChooseLocationPromptInput,\n readCurrentLocation,\n readPresetChooseAddress,\n readPresetChooseLocation,\n readPresetFuzzyLocation,\n} from './location'\nimport { openTargetInNewWindow } from './mediaActions'\nimport { getGlobalDialogHandlers } from './ui'\n\nexport function makePhoneCallBridge(options?: any) {\n const phoneNumber = typeof options?.phoneNumber === 'string' ? options.phoneNumber.trim() : ''\n if (!phoneNumber) {\n const failure = callMiniProgramAsyncFailure(options, 'makePhoneCall:fail invalid phoneNumber')\n return Promise.reject(failure)\n }\n if (typeof window !== 'undefined' && typeof window.open === 'function') {\n try {\n window.open(`tel:${encodeURIComponent(phoneNumber)}`, '_self')\n }\n catch {\n // ignore browser restrictions and keep API-level success semantics\n }\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'makePhoneCall:ok' }))\n}\n\nexport function chooseAddressBridge(options?: any) {\n const preset = readPresetChooseAddress()\n if (preset) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseAddress:ok',\n ...preset,\n }))\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const input = prompt('请输入地址(格式:省,市,区,详细地址,姓名,电话)', '')\n if (input == null) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail cancel')\n return Promise.reject(failure)\n }\n const parsed = parseChooseAddressPromptInput(input)\n if (!parsed) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail invalid input')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseAddress:ok',\n ...parsed,\n }))\n }\n const failure = callMiniProgramAsyncFailure(options, 'chooseAddress:fail address picker is unavailable')\n return Promise.reject(failure)\n}\n\nexport function chooseLocationBridge(options?: any) {\n const preset = readPresetChooseLocation()\n if (preset) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseLocation:ok',\n ...preset,\n }))\n }\n const { prompt } = getGlobalDialogHandlers()\n if (typeof prompt === 'function') {\n const input = prompt('请输入坐标(格式:latitude,longitude)', '')\n if (input == null) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail cancel')\n return Promise.reject(failure)\n }\n const parsed = parseChooseLocationPromptInput(input)\n if (!parsed) {\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail invalid latitude/longitude')\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseLocation:ok',\n name: '',\n address: '',\n latitude: parsed.latitude,\n longitude: parsed.longitude,\n }))\n }\n const failure = callMiniProgramAsyncFailure(options, 'chooseLocation:fail location picker is unavailable')\n return Promise.reject(failure)\n}\n\nexport function openLocationBridge(options?: any) {\n const latitude = options?.latitude\n const longitude = options?.longitude\n if (typeof latitude !== 'number' || Number.isNaN(latitude) || typeof longitude !== 'number' || Number.isNaN(longitude)) {\n const failure = callMiniProgramAsyncFailure(options, 'openLocation:fail invalid latitude/longitude')\n return Promise.reject(failure)\n }\n const query = `${latitude},${longitude}`\n const target = `https://maps.google.com/?q=${encodeURIComponent(query)}`\n openTargetInNewWindow(target)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openLocation:ok' }))\n}\n\nexport function getLocationBridge(options?: any) {\n try {\n return readCurrentLocation(options)\n .then(location => callMiniProgramAsyncSuccess(options, {\n errMsg: 'getLocation:ok',\n ...location,\n }))\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`)\n return Promise.reject(failure)\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getLocation:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function getFuzzyLocationBridge(options?: any) {\n const preset = readPresetFuzzyLocation()\n if (preset) {\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getFuzzyLocation:ok',\n ...preset,\n })\n }\n try {\n const location = await getLocationBridge()\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getFuzzyLocation:ok',\n latitude: normalizeFuzzyCoordinate(location.latitude),\n longitude: normalizeFuzzyCoordinate(location.longitude),\n accuracy: Math.max(1000, normalizeGeoNumber(location.accuracy, 1000)),\n })\n }\n catch (error) {\n const message = typeof (error as { errMsg?: unknown })?.errMsg === 'string'\n ? (error as { errMsg: string }).errMsg\n : error instanceof Error\n ? error.message\n : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getFuzzyLocation:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,oBAAoB,SAAe;CACjD,MAAM,cAAc,OAAO,SAAS,gBAAgB,WAAW,QAAQ,YAAY,MAAM,GAAG;AAC5F,KAAI,CAAC,aAAa;EAChB,MAAM,UAAU,4BAA4B,SAAS,yCAAyC;AAC9F,SAAO,QAAQ,OAAO,QAAQ;;AAEhC,KAAI,OAAO,WAAW,eAAe,OAAO,OAAO,SAAS,WAC1D,KAAI;AACF,SAAO,KAAK,OAAO,mBAAmB,YAAY,IAAI,QAAQ;SAE1D;AAIR,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,oBAAoB,CAAC,CAAC;;AAG9F,SAAgB,oBAAoB,SAAe;CACjD,MAAM,S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C;GACtE,CAAC;UAEG,OAAO;EAMZ,MAAM,UAAU,4BAA4B,SAAS,yBALrC,OAAQ,OAAgC,WAAW,WAC9D,MAA6B,SAC9B,iBAAiB,QACf,MAAM,UACN,OAAO,MAAM,GACqE;AACxF,SAAO,QAAQ,OAAO,QAAQ"}
@@ -0,0 +1,52 @@
1
+ import { WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY } from "@weapp-core/constants";
2
+
3
+ //#region src/runtime/polyfill/mediaActions.ts
4
+ function openTargetInNewWindow(target) {
5
+ if (typeof window === "undefined" || typeof window.open !== "function") return;
6
+ try {
7
+ window.open(target, "_blank", "noopener,noreferrer");
8
+ } catch {}
9
+ }
10
+ function normalizePreviewMediaSources(sources) {
11
+ if (!Array.isArray(sources)) return [];
12
+ return sources.map((source) => {
13
+ if (!source || typeof source !== "object") return null;
14
+ const sourceRecord = source;
15
+ const url = typeof sourceRecord.url === "string" ? sourceRecord.url.trim() : "";
16
+ if (!url) return null;
17
+ return {
18
+ url,
19
+ type: sourceRecord.type === "video" ? "video" : "image",
20
+ poster: typeof sourceRecord.poster === "string" ? sourceRecord.poster : ""
21
+ };
22
+ }).filter((item) => Boolean(item));
23
+ }
24
+ function readOpenVideoEditorPreset(src) {
25
+ const preset = globalThis[WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY];
26
+ if (typeof preset === "function") {
27
+ const value = preset(src);
28
+ return typeof value === "string" && value.trim() ? value.trim() : "";
29
+ }
30
+ if (typeof preset === "string" && preset.trim()) return preset.trim();
31
+ if (preset && typeof preset === "object") {
32
+ const value = preset[src];
33
+ return typeof value === "string" && value.trim() ? value.trim() : "";
34
+ }
35
+ return "";
36
+ }
37
+ function triggerDownload(filePath, fileName = "") {
38
+ if (typeof document === "undefined" || !document.body) return;
39
+ try {
40
+ const link = document.createElement("a");
41
+ link.setAttribute("href", filePath);
42
+ link.setAttribute("download", fileName);
43
+ link.setAttribute("style", "display:none");
44
+ document.body.append(link);
45
+ link.click?.();
46
+ if (link.parentNode) link.parentNode.removeChild(link);
47
+ } catch {}
48
+ }
49
+
50
+ //#endregion
51
+ export { normalizePreviewMediaSources, openTargetInNewWindow, readOpenVideoEditorPreset, triggerDownload };
52
+ //# sourceMappingURL=mediaActions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaActions.mjs","names":[],"sources":["../../../src/runtime/polyfill/mediaActions.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY } from '@weapp-core/constants'\n\ninterface PreviewMediaSourceRecord {\n url: string\n type: 'image' | 'video'\n poster: string\n}\n\nexport function openTargetInNewWindow(target: string) {\n if (typeof window === 'undefined' || typeof window.open !== 'function') {\n return\n }\n try {\n window.open(target, '_blank', 'noopener,noreferrer')\n }\n catch {\n // ignore browser popup restrictions and keep API-level success semantics\n }\n}\n\nexport function normalizePreviewMediaSources(sources: unknown): PreviewMediaSourceRecord[] {\n if (!Array.isArray(sources)) {\n return []\n }\n return sources\n .map((source) => {\n if (!source || typeof source !== 'object') {\n return null\n }\n const sourceRecord = source as Record<string, unknown>\n const url = typeof sourceRecord.url === 'string' ? sourceRecord.url.trim() : ''\n if (!url) {\n return null\n }\n return {\n url,\n type: sourceRecord.type === 'video' ? 'video' : 'image',\n poster: typeof sourceRecord.poster === 'string' ? sourceRecord.poster : '',\n }\n })\n .filter((item): item is PreviewMediaSourceRecord => Boolean(item))\n}\n\nexport function readOpenVideoEditorPreset(src: string) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_OPEN_VIDEO_EDITOR_KEY]\n if (typeof preset === 'function') {\n const value = (preset as (value: string) => unknown)(src)\n return typeof value === 'string' && value.trim() ? value.trim() : ''\n }\n if (typeof preset === 'string' && preset.trim()) {\n return preset.trim()\n }\n if (preset && typeof preset === 'object') {\n const value = (preset as Record<string, unknown>)[src]\n return typeof value === 'string' && value.trim() ? value.trim() : ''\n }\n return ''\n}\n\nexport function triggerDownload(filePath: string, fileName = '') {\n if (typeof document === 'undefined' || !document.body) {\n return\n }\n try {\n const link = document.createElement('a')\n link.setAttribute('href', filePath)\n link.setAttribute('download', fileName)\n link.setAttribute('style', 'display:none')\n document.body.append(link)\n link.click?.()\n if (link.parentNode) {\n link.parentNode.removeChild(link)\n }\n }\n catch {\n // keep API-level success semantics for browser restrictions\n }\n}\n"],"mappings":";;;AAQA,SAAgB,sBAAsB,QAAgB;AACpD,KAAI,OAAO,WAAW,eAAe,OAAO,OAAO,SAAS,WAC1D;AAEF,KAAI;AACF,SAAO,KAAK,QAAQ,UAAU,sBAAsB;SAEhD;;AAKR,SAAgB,6BAA6B,SAA8C;AACzF,KAAI,CAAC,MAAM,QAAQ,QAAQ,CACzB,QAAO,EAAE;AAEX,QAAO,QACJ,KAAK,WAAW;AACf,MAAI,CAAC,UAAU,OAAO,WAAW,SAC/B,QAAO;EAET,MAAM,eAAe;EACrB,MAAM,MAAM,OAAO,aAAa,QAAQ,WAAW,aAAa,IAAI,MAAM,GAAG;AAC7E,MAAI,CAAC,IACH,QAAO;AAET,SAAO;GACL;GACA,MAAM,aAAa,SAAS,UAAU,UAAU;GAChD,QAAQ,OAAO,aAAa,WAAW,WAAW,aAAa,SAAS;GACzE;GACD,CACD,QAAQ,SAA2C,QAAQ,KAAK,CAAC;;AAGtE,SAAgB,0BAA0B,KAAa;CAErD,MAAM,SADgB,WACO;AAC7B,KAAI,OAAO,WAAW,YAAY;EAChC,MAAM,QAAS,OAAsC,IAAI;AACzD,SAAO,OAAO,UAAU,YAAY,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG;;AAEpE,KAAI,OAAO,WAAW,YAAY,OAAO,MAAM,CAC7C,QAAO,OAAO,MAAM;AAEtB,KAAI,UAAU,OAAO,WAAW,UAAU;EACxC,MAAM,QAAS,OAAmC;AAClD,SAAO,OAAO,UAAU,YAAY,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG;;AAEpE,QAAO;;AAGT,SAAgB,gBAAgB,UAAkB,WAAW,IAAI;AAC/D,KAAI,OAAO,aAAa,eAAe,CAAC,SAAS,KAC/C;AAEF,KAAI;EACF,MAAM,OAAO,SAAS,cAAc,IAAI;AACxC,OAAK,aAAa,QAAQ,SAAS;AACnC,OAAK,aAAa,YAAY,SAAS;AACvC,OAAK,aAAa,SAAS,eAAe;AAC1C,WAAS,KAAK,OAAO,KAAK;AAC1B,OAAK,SAAS;AACd,MAAI,KAAK,WACP,MAAK,WAAW,YAAY,KAAK;SAG/B"}
@@ -0,0 +1,63 @@
1
+ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
2
+ import { openTargetInNewWindow, triggerDownload } from "../mediaActions.mjs";
3
+ import { normalizeFilePath, resolveOpenDocumentUrl, resolveSaveFilePath, saveMemoryFile } from "../files.mjs";
4
+
5
+ //#region src/runtime/polyfill/mediaApi/file.ts
6
+ function saveImageToPhotosAlbumBridge(options) {
7
+ const filePath = typeof options?.filePath === "string" ? options.filePath.trim() : "";
8
+ if (!filePath) {
9
+ const failure = callMiniProgramAsyncFailure(options, "saveImageToPhotosAlbum:fail invalid filePath");
10
+ return Promise.reject(failure);
11
+ }
12
+ triggerDownload(filePath);
13
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "saveImageToPhotosAlbum:ok" }));
14
+ }
15
+ function saveVideoToPhotosAlbumBridge(options) {
16
+ const filePath = typeof options?.filePath === "string" ? options.filePath.trim() : "";
17
+ if (!filePath) {
18
+ const failure = callMiniProgramAsyncFailure(options, "saveVideoToPhotosAlbum:fail invalid filePath");
19
+ return Promise.reject(failure);
20
+ }
21
+ triggerDownload(filePath);
22
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "saveVideoToPhotosAlbum:ok" }));
23
+ }
24
+ function saveFileBridge(options) {
25
+ const tempFilePath = typeof options?.tempFilePath === "string" ? options.tempFilePath.trim() : "";
26
+ if (!tempFilePath) {
27
+ const failure = callMiniProgramAsyncFailure(options, "saveFile:fail invalid tempFilePath");
28
+ return Promise.reject(failure);
29
+ }
30
+ const savedFilePath = resolveSaveFilePath(tempFilePath, options?.filePath);
31
+ saveMemoryFile(tempFilePath, savedFilePath);
32
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, {
33
+ errMsg: "saveFile:ok",
34
+ savedFilePath
35
+ }));
36
+ }
37
+ function saveFileToDiskBridge(options) {
38
+ const filePath = typeof options?.filePath === "string" ? options.filePath.trim() : "";
39
+ if (!filePath) {
40
+ const failure = callMiniProgramAsyncFailure(options, "saveFileToDisk:fail invalid filePath");
41
+ return Promise.reject(failure);
42
+ }
43
+ triggerDownload(filePath, typeof options?.fileName === "string" ? options.fileName.trim() : "");
44
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "saveFileToDisk:ok" }));
45
+ }
46
+ function openDocumentBridge(options) {
47
+ const filePath = normalizeFilePath(options?.filePath);
48
+ if (!filePath) {
49
+ const failure = callMiniProgramAsyncFailure(options, "openDocument:fail invalid filePath");
50
+ return Promise.reject(failure);
51
+ }
52
+ const target = resolveOpenDocumentUrl(filePath);
53
+ if (!target) {
54
+ const failure = callMiniProgramAsyncFailure(options, "openDocument:fail document url is unavailable");
55
+ return Promise.reject(failure);
56
+ }
57
+ openTargetInNewWindow(target);
58
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "openDocument:ok" }));
59
+ }
60
+
61
+ //#endregion
62
+ export { openDocumentBridge, saveFileBridge, saveFileToDiskBridge, saveImageToPhotosAlbumBridge, saveVideoToPhotosAlbumBridge };
63
+ //# sourceMappingURL=file.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/file.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport {\n normalizeFilePath,\n resolveOpenDocumentUrl,\n resolveSaveFilePath,\n saveMemoryFile,\n} from '../files'\nimport {\n openTargetInNewWindow,\n triggerDownload,\n} from '../mediaActions'\n\nexport function saveImageToPhotosAlbumBridge(options?: any) {\n const filePath = typeof options?.filePath === 'string' ? options.filePath.trim() : ''\n if (!filePath) {\n const failure = callMiniProgramAsyncFailure(options, 'saveImageToPhotosAlbum:fail invalid filePath')\n return Promise.reject(failure)\n }\n triggerDownload(filePath)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'saveImageToPhotosAlbum:ok' }))\n}\n\nexport function saveVideoToPhotosAlbumBridge(options?: any) {\n const filePath = typeof options?.filePath === 'string' ? options.filePath.trim() : ''\n if (!filePath) {\n const failure = callMiniProgramAsyncFailure(options, 'saveVideoToPhotosAlbum:fail invalid filePath')\n return Promise.reject(failure)\n }\n triggerDownload(filePath)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'saveVideoToPhotosAlbum:ok' }))\n}\n\nexport function saveFileBridge(options?: any) {\n const tempFilePath = typeof options?.tempFilePath === 'string' ? options.tempFilePath.trim() : ''\n if (!tempFilePath) {\n const failure = callMiniProgramAsyncFailure(options, 'saveFile:fail invalid tempFilePath')\n return Promise.reject(failure)\n }\n const savedFilePath = resolveSaveFilePath(tempFilePath, options?.filePath)\n saveMemoryFile(tempFilePath, savedFilePath)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'saveFile:ok',\n savedFilePath,\n }))\n}\n\nexport function saveFileToDiskBridge(options?: any) {\n const filePath = typeof options?.filePath === 'string' ? options.filePath.trim() : ''\n if (!filePath) {\n const failure = callMiniProgramAsyncFailure(options, 'saveFileToDisk:fail invalid filePath')\n return Promise.reject(failure)\n }\n const fileName = typeof options?.fileName === 'string' ? options.fileName.trim() : ''\n triggerDownload(filePath, fileName)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'saveFileToDisk:ok' }))\n}\n\nexport function openDocumentBridge(options?: any) {\n const filePath = normalizeFilePath(options?.filePath)\n if (!filePath) {\n const failure = callMiniProgramAsyncFailure(options, 'openDocument:fail invalid filePath')\n return Promise.reject(failure)\n }\n const target = resolveOpenDocumentUrl(filePath)\n if (!target) {\n const failure = callMiniProgramAsyncFailure(options, 'openDocument:fail document url is unavailable')\n return Promise.reject(failure)\n }\n openTargetInNewWindow(target)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'openDocument:ok' }))\n}\n"],"mappings":";;;;;AAeA,SAAgB,6BAA6B,SAAe;CAC1D,MAAM,WAAW,OAAO,SAAS,aAAa,WAAW,QAAQ,SAAS,MAAM,GAAG;AACnF,KAAI,CAAC,UAAU;EACb,MAAM,UAAU,4BAA4B,SAAS,+CAA+C;AACpG,SAAO,QAAQ,OAAO,QAAQ;;AAEhC,iBAAgB,SAAS;AACzB,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,6BAA6B,CAAC,CAAC;;AAGvG,SAAgB,6BAA6B,SAAe;CAC1D,MAAM,WAAW,OAAO,SAAS,aAAa,WAAW,QAAQ,SAAS,MAAM,GAAG;AACnF,KAAI,CAAC,UAAU;EACb,MAAM,UAAU,4BAA4B,SAAS,+CAA+C;AACpG,SAAO,QAAQ,OAAO,QAAQ;;AAEhC,iBAAgB,SAAS;AACzB,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,6BAA6B,CAAC,CAAC;;AAGvG,SAAgB,eAAe,SAAe;CAC5C,MAAM,eAAe,OAAO,SAAS,iBAAiB,WAAW,QAAQ,aAAa,MAAM,GAAG;AAC/F,KAAI,CAAC,cAAc;EACjB,MAAM,UAAU,4BAA4B,SAAS,qCAAqC;AAC1F,SAAO,QAAQ,OAAO,QAAQ;;CAEhC,MAAM,gBAAgB,oBAAoB,cAAc,SAAS,SAAS;AAC1E,gBAAe,cAAc,cAAc;AAC3C,QAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,QAAQ;EACR;EACD,CAAC,CAAC;;AAGL,SAAgB,qBAAqB,SAAe;CAClD,MAAM,WAAW,OAAO,SAAS,aAAa,WAAW,QAAQ,SAAS,MAAM,GAAG;AACnF,KAAI,CAAC,UAAU;EACb,MAAM,UAAU,4BAA4B,SAAS,uCAAuC;AAC5F,SAAO,QAAQ,OAAO,QAAQ;;AAGhC,iBAAgB,UADC,OAAO,SAAS,aAAa,WAAW,QAAQ,SAAS,MAAM,GAAG,GAChD;AACnC,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,qBAAqB,CAAC,CAAC;;AAG/F,SAAgB,mBAAmB,SAAe;CAChD,MAAM,WAAW,kBAAkB,SAAS,SAAS;AACrD,KAAI,CAAC,UAAU;EACb,MAAM,UAAU,4BAA4B,SAAS,qCAAqC;AAC1F,SAAO,QAAQ,OAAO,QAAQ;;CAEhC,MAAM,SAAS,uBAAuB,SAAS;AAC/C,KAAI,CAAC,QAAQ;EACX,MAAM,UAAU,4BAA4B,SAAS,gDAAgD;AACrG,SAAO,QAAQ,OAAO,QAAQ;;AAEhC,uBAAsB,OAAO;AAC7B,QAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "../async.mjs";
2
+ import { inferImageTypeFromPath, inferVideoTypeFromPath, normalizeVideoInfoNumber, readImageInfoFromSource, readPresetVideoInfo, readVideoInfoFromSource } from "../mediaInfo.mjs";
3
+
4
+ //#region src/runtime/polyfill/mediaApi/info.ts
5
+ function getImageInfoBridge(options) {
6
+ const src = typeof options?.src === "string" ? options.src.trim() : "";
7
+ if (!src) {
8
+ const failure = callMiniProgramAsyncFailure(options, "getImageInfo:fail invalid src");
9
+ return Promise.reject(failure);
10
+ }
11
+ return readImageInfoFromSource(src).then(({ width, height }) => callMiniProgramAsyncSuccess(options, {
12
+ errMsg: "getImageInfo:ok",
13
+ width,
14
+ height,
15
+ path: src,
16
+ type: inferImageTypeFromPath(src),
17
+ orientation: "up"
18
+ })).catch((error) => {
19
+ const failure = callMiniProgramAsyncFailure(options, `getImageInfo:fail ${error instanceof Error ? error.message : String(error)}`);
20
+ return Promise.reject(failure);
21
+ });
22
+ }
23
+ function getVideoInfoBridge(options) {
24
+ const src = typeof options?.src === "string" ? options.src.trim() : "";
25
+ if (!src) {
26
+ const failure = callMiniProgramAsyncFailure(options, "getVideoInfo:fail invalid src");
27
+ return Promise.reject(failure);
28
+ }
29
+ const preset = readPresetVideoInfo(src);
30
+ const resolveResult = async () => {
31
+ if (preset) return preset;
32
+ return readVideoInfoFromSource(src);
33
+ };
34
+ return resolveResult().then((result) => {
35
+ const duration = normalizeVideoInfoNumber(result.duration);
36
+ const width = normalizeVideoInfoNumber(result.width);
37
+ const height = normalizeVideoInfoNumber(result.height);
38
+ const bitrate = normalizeVideoInfoNumber(result.bitrate);
39
+ const fps = normalizeVideoInfoNumber(result.fps);
40
+ return callMiniProgramAsyncSuccess(options, {
41
+ errMsg: "getVideoInfo:ok",
42
+ orientation: "up",
43
+ type: inferVideoTypeFromPath(src),
44
+ duration,
45
+ size: normalizeVideoInfoNumber(result.size),
46
+ width,
47
+ height,
48
+ bitrate,
49
+ fps
50
+ });
51
+ }).catch((error) => {
52
+ const failure = callMiniProgramAsyncFailure(options, `getVideoInfo:fail ${error instanceof Error ? error.message : String(error)}`);
53
+ return Promise.reject(failure);
54
+ });
55
+ }
56
+
57
+ //#endregion
58
+ export { getImageInfoBridge, getVideoInfoBridge };
59
+ //# sourceMappingURL=info.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/info.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport {\n inferImageTypeFromPath,\n inferVideoTypeFromPath,\n normalizeVideoInfoNumber,\n readImageInfoFromSource,\n readPresetVideoInfo,\n readVideoInfoFromSource,\n} from '../mediaInfo'\n\nexport function getImageInfoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'getImageInfo:fail invalid src')\n return Promise.reject(failure)\n }\n return readImageInfoFromSource(src)\n .then(({ width, height }) => callMiniProgramAsyncSuccess(options, {\n errMsg: 'getImageInfo:ok',\n width,\n height,\n path: src,\n type: inferImageTypeFromPath(src),\n orientation: 'up',\n }))\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getImageInfo:fail ${message}`)\n return Promise.reject(failure)\n })\n}\n\nexport function getVideoInfoBridge(options?: any) {\n const src = typeof options?.src === 'string' ? options.src.trim() : ''\n if (!src) {\n const failure = callMiniProgramAsyncFailure(options, 'getVideoInfo:fail invalid src')\n return Promise.reject(failure)\n }\n const preset = readPresetVideoInfo(src)\n const resolveResult = async () => {\n if (preset) {\n return preset\n }\n return readVideoInfoFromSource(src)\n }\n return resolveResult()\n .then((result) => {\n const duration = normalizeVideoInfoNumber(result.duration)\n const width = normalizeVideoInfoNumber(result.width)\n const height = normalizeVideoInfoNumber(result.height)\n const bitrate = normalizeVideoInfoNumber((result as Record<string, unknown>).bitrate)\n const fps = normalizeVideoInfoNumber((result as Record<string, unknown>).fps)\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'getVideoInfo:ok',\n orientation: 'up',\n type: inferVideoTypeFromPath(src),\n duration,\n size: normalizeVideoInfoNumber((result as Record<string, unknown>).size),\n width,\n height,\n bitrate,\n fps,\n })\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getVideoInfo:fail ${message}`)\n return Promise.reject(failure)\n })\n}\n"],"mappings":";;;;AAaA,SAAgB,mBAAmB,SAAe;CAChD,MAAM,MAAM,OAAO,SAAS,QAAQ,WAAW,QAAQ,IAAI,MAAM,GAAG;AACpE,KAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,gCAAgC;AACrF,SAAO,QAAQ,OAAO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alizeChooseImageCount, normalizeChooseImageFile, normalizeChooseMediaCount, normalizeChooseMediaFile, normalizeChooseMediaTypes, pickChooseImageFiles, pickChooseMediaFiles } from "../mediaPicker.mjs";
3
+ import { normalizeChooseFileExtensions, normalizeChooseMessageFile, normalizeChooseMessageFileCount, normalizeChooseMessageFileType, pickChooseFileFiles, pickChooseMessageFiles } from "../filePicker.mjs";
4
+ import { normalizeChooseVideoFile, pickChooseVideoFile } from "../mediaProcess.mjs";
5
+
6
+ //#region src/runtime/polyfill/mediaApi/picker.ts
7
+ async function chooseImageBridge(options) {
8
+ const count = normalizeChooseImageCount(options?.count);
9
+ try {
10
+ const tempFiles = (await pickChooseImageFiles(count)).map((file) => normalizeChooseImageFile(file));
11
+ return callMiniProgramAsyncSuccess(options, {
12
+ errMsg: "chooseImage:ok",
13
+ tempFilePaths: tempFiles.map((item) => item.path),
14
+ tempFiles
15
+ });
16
+ } catch (error) {
17
+ const failure = callMiniProgramAsyncFailure(options, `chooseImage:fail ${error instanceof Error ? error.message : String(error)}`);
18
+ return Promise.reject(failure);
19
+ }
20
+ }
21
+ async function chooseMediaBridge(options) {
22
+ const count = normalizeChooseMediaCount(options?.count);
23
+ const types = normalizeChooseMediaTypes(options?.mediaType);
24
+ try {
25
+ const tempFiles = (await pickChooseMediaFiles(count, types)).map((file) => normalizeChooseMediaFile(file));
26
+ const defaultType = types.has("video") && !types.has("image") ? "video" : "image";
27
+ return callMiniProgramAsyncSuccess(options, {
28
+ errMsg: "chooseMedia:ok",
29
+ type: tempFiles[0]?.fileType ?? defaultType,
30
+ tempFiles
31
+ });
32
+ } catch (error) {
33
+ const failure = callMiniProgramAsyncFailure(options, `chooseMedia:fail ${error instanceof Error ? error.message : String(error)}`);
34
+ return Promise.reject(failure);
35
+ }
36
+ }
37
+ async function chooseVideoBridge(options) {
38
+ try {
39
+ const file = await pickChooseVideoFile();
40
+ if (!file) throw new TypeError("no file selected");
41
+ const normalized = normalizeChooseVideoFile(file);
42
+ if (!normalized) throw new TypeError("selected file is not a video");
43
+ return callMiniProgramAsyncSuccess(options, {
44
+ errMsg: "chooseVideo:ok",
45
+ ...normalized
46
+ });
47
+ } catch (error) {
48
+ const failure = callMiniProgramAsyncFailure(options, `chooseVideo:fail ${error instanceof Error ? error.message : String(error)}`);
49
+ return Promise.reject(failure);
50
+ }
51
+ }
52
+ async function chooseMessageFileBridge(options) {
53
+ const count = normalizeChooseMessageFileCount(options?.count);
54
+ const type = normalizeChooseMessageFileType(options?.type);
55
+ try {
56
+ return callMiniProgramAsyncSuccess(options, {
57
+ errMsg: "chooseMessageFile:ok",
58
+ tempFiles: (await pickChooseMessageFiles(count, type)).map((file) => normalizeChooseMessageFile(file))
59
+ });
60
+ } catch (error) {
61
+ const failure = callMiniProgramAsyncFailure(options, `chooseMessageFile:fail ${error instanceof Error ? error.message : String(error)}`);
62
+ return Promise.reject(failure);
63
+ }
64
+ }
65
+ async function chooseFileBridge(options) {
66
+ const count = normalizeChooseMessageFileCount(options?.count);
67
+ const type = normalizeChooseMessageFileType(options?.type);
68
+ const extensions = normalizeChooseFileExtensions(options?.extension);
69
+ try {
70
+ return callMiniProgramAsyncSuccess(options, {
71
+ errMsg: "chooseFile:ok",
72
+ tempFiles: (await pickChooseFileFiles(count, type, extensions)).map((file) => normalizeChooseMessageFile(file))
73
+ });
74
+ } catch (error) {
75
+ const failure = callMiniProgramAsyncFailure(options, `chooseFile:fail ${error instanceof Error ? error.message : String(error)}`);
76
+ return Promise.reject(failure);
77
+ }
78
+ }
79
+
80
+ //#endregion
81
+ export { chooseFileBridge, chooseImageBridge, chooseMediaBridge, chooseMessageFileBridge, chooseVideoBridge };
82
+ //# sourceMappingURL=picker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"picker.mjs","names":[],"sources":["../../../../src/runtime/polyfill/mediaApi/picker.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from '../async'\nimport {\n normalizeChooseFileExtensions,\n normalizeChooseMessageFile,\n normalizeChooseMessageFileCount,\n normalizeChooseMessageFileType,\n pickChooseFileFiles,\n pickChooseMessageFiles,\n} from '../filePicker'\nimport {\n normalizeChooseImageCount,\n normalizeChooseImageFile,\n normalizeChooseMediaCount,\n normalizeChooseMediaFile,\n normalizeChooseMediaTypes,\n pickChooseImageFiles,\n pickChooseMediaFiles,\n} from '../mediaPicker'\nimport {\n normalizeChooseVideoFile,\n pickChooseVideoFile,\n} from '../mediaProcess'\n\nexport async function chooseImageBridge(options?: any) {\n const count = normalizeChooseImageCount(options?.count)\n try {\n const files = await pickChooseImageFiles(count)\n const tempFiles = files.map(file => normalizeChooseImageFile(file))\n const tempFilePaths = tempFiles.map(item => item.path)\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseImage:ok',\n tempFilePaths,\n tempFiles,\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `chooseImage:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function chooseMediaBridge(options?: any) {\n const count = normalizeChooseMediaCount(options?.count)\n const types = normalizeChooseMediaTypes(options?.mediaType)\n try {\n const files = await pickChooseMediaFiles(count, types)\n const tempFiles = files.map(file => normalizeChooseMediaFile(file))\n const defaultType = types.has('video') && !types.has('image') ? 'video' : 'image'\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseMedia:ok',\n type: tempFiles[0]?.fileType ?? defaultType,\n tempFiles,\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `chooseMedia:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function chooseVideoBridge(options?: any) {\n try {\n const file = await pickChooseVideoFile()\n if (!file) {\n throw new TypeError('no file selected')\n }\n const normalized = normalizeChooseVideoFile(file)\n if (!normalized) {\n throw new TypeError('selected file is not a video')\n }\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseVideo:ok',\n ...normalized,\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `chooseVideo:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function chooseMessageFileBridge(options?: any) {\n const count = normalizeChooseMessageFileCount(options?.count)\n const type = normalizeChooseMessageFileType(options?.type)\n try {\n const files = await pickChooseMessageFiles(count, type)\n const tempFiles = files.map(file => normalizeChooseMessageFile(file))\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseMessageFile:ok',\n tempFiles,\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `chooseMessageFile:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport async function chooseFileBridge(options?: any) {\n const count = normalizeChooseMessageFileCount(options?.count)\n const type = normalizeChooseMessageFileType(options?.type)\n const extensions = normalizeChooseFileExtensions(options?.extension)\n try {\n const files = await pickChooseFileFiles(count, type, extensions)\n const tempFiles = files.map(file => normalizeChooseMessageFile(file))\n return callMiniProgramAsyncSuccess(options, {\n errMsg: 'chooseFile:ok',\n tempFiles,\n })\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `chooseFile:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n"],"mappings":";;;;;;AA0BA,eAAsB,kBAAkB,SAAe;CACrD,MAAM,QAAQ,0BAA0B,SAAS,MAAM;AACvD,KAAI;EAEF,MAAM,aADQ,MAAM,qBAAqB,MAAM,EACvB,KAAI,SAAQ,yBAAyB,KAAK,CAAC;AAEnE,SAAO,4BAA4B,SAAS;GAC1C,QAAQ;GACR,eAHoB,UAAU,KAAI,SAAQ,KAAK,KAAK;GAIpD;GACD,CAAC;UAEG,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,oBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACa;AACnF,SAAO,QAAQ,OAAO,QAAQ;;;AAIlC,eAAsB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