@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,62 @@
1
+ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
+ import { clearStorageSyncInternal, getStorageInfoSyncInternal, getStorageSyncInternal, hasStorageKey, normalizeStorageKey, removeStorageSyncInternal, setStorageSyncInternal } from "./storage.mjs";
3
+
4
+ //#region src/runtime/polyfill/storageAsync.ts
5
+ function setStorageBridge(options) {
6
+ const key = normalizeStorageKey(options?.key);
7
+ if (!key) {
8
+ const failure = callMiniProgramAsyncFailure(options, "setStorage:fail invalid key");
9
+ return Promise.reject(failure);
10
+ }
11
+ try {
12
+ setStorageSyncInternal(key, options?.data);
13
+ } catch (error) {
14
+ const failure = callMiniProgramAsyncFailure(options, `setStorage:fail ${error instanceof Error ? error.message : String(error)}`);
15
+ return Promise.reject(failure);
16
+ }
17
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "setStorage:ok" }));
18
+ }
19
+ function getStorageBridge(options) {
20
+ const key = normalizeStorageKey(options?.key);
21
+ if (!key) {
22
+ const failure = callMiniProgramAsyncFailure(options, "getStorage:fail invalid key");
23
+ return Promise.reject(failure);
24
+ }
25
+ if (!hasStorageKey(key)) {
26
+ const failure = callMiniProgramAsyncFailure(options, `getStorage:fail data not found for key ${key}`);
27
+ return Promise.reject(failure);
28
+ }
29
+ const data = getStorageSyncInternal(key);
30
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, {
31
+ errMsg: "getStorage:ok",
32
+ data
33
+ }));
34
+ }
35
+ function removeStorageBridge(options) {
36
+ const key = normalizeStorageKey(options?.key);
37
+ if (!key) {
38
+ const failure = callMiniProgramAsyncFailure(options, "removeStorage:fail invalid key");
39
+ return Promise.reject(failure);
40
+ }
41
+ try {
42
+ removeStorageSyncInternal(key);
43
+ } catch (error) {
44
+ const failure = callMiniProgramAsyncFailure(options, `removeStorage:fail ${error instanceof Error ? error.message : String(error)}`);
45
+ return Promise.reject(failure);
46
+ }
47
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "removeStorage:ok" }));
48
+ }
49
+ function clearStorageBridge(options) {
50
+ clearStorageSyncInternal();
51
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: "clearStorage:ok" }));
52
+ }
53
+ function getStorageInfoBridge(options) {
54
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, {
55
+ ...getStorageInfoSyncInternal(),
56
+ errMsg: "getStorageInfo:ok"
57
+ }));
58
+ }
59
+
60
+ //#endregion
61
+ export { clearStorageBridge, getStorageBridge, getStorageInfoBridge, removeStorageBridge, setStorageBridge };
62
+ //# sourceMappingURL=storageAsync.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storageAsync.mjs","names":[],"sources":["../../../src/runtime/polyfill/storageAsync.ts"],"sourcesContent":["import type { MiniProgramAsyncOptions, MiniProgramBaseResult } from './types/base'\nimport type { GetStorageOptions, RemoveStorageOptions, SetStorageOptions, StorageInfoResult } from './types/common'\nimport {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n clearStorageSyncInternal,\n getStorageInfoSyncInternal,\n getStorageSyncInternal,\n hasStorageKey,\n normalizeStorageKey,\n removeStorageSyncInternal,\n setStorageSyncInternal,\n} from './storage'\n\nexport function setStorageBridge(options?: SetStorageOptions) {\n const key = normalizeStorageKey(options?.key)\n if (!key) {\n const failure = callMiniProgramAsyncFailure(options, 'setStorage:fail invalid key')\n return Promise.reject(failure)\n }\n try {\n setStorageSyncInternal(key, options?.data)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `setStorage:fail ${message}`)\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'setStorage:ok' }))\n}\n\nexport function getStorageBridge(options?: GetStorageOptions) {\n const key = normalizeStorageKey(options?.key)\n if (!key) {\n const failure = callMiniProgramAsyncFailure(options, 'getStorage:fail invalid key')\n return Promise.reject(failure)\n }\n if (!hasStorageKey(key)) {\n const failure = callMiniProgramAsyncFailure(options, `getStorage:fail data not found for key ${key}`)\n return Promise.reject(failure)\n }\n const data = getStorageSyncInternal(key)\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'getStorage:ok', data }))\n}\n\nexport function removeStorageBridge(options?: RemoveStorageOptions) {\n const key = normalizeStorageKey(options?.key)\n if (!key) {\n const failure = callMiniProgramAsyncFailure(options, 'removeStorage:fail invalid key')\n return Promise.reject(failure)\n }\n try {\n removeStorageSyncInternal(key)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `removeStorage:fail ${message}`)\n return Promise.reject(failure)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'removeStorage:ok' }))\n}\n\nexport function clearStorageBridge(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n clearStorageSyncInternal()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'clearStorage:ok' }))\n}\n\nexport function getStorageInfoBridge(options?: MiniProgramAsyncOptions<StorageInfoResult>) {\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n ...getStorageInfoSyncInternal(),\n errMsg: 'getStorageInfo:ok',\n }))\n}\n"],"mappings":";;;;AAgBA,SAAgB,iBAAiB,SAA6B;CAC5D,MAAM,MAAM,oBAAoB,SAAS,IAAI;AAC7C,KAAI,CAAC,KAAK;EACR,MAAM,UAAU,4BAA4B,SAAS,8BAA8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gB,qBAAqB,SAAsD;AACzF,QAAO,QAAQ,QAAQ,4BAA4B,SAAS;EAC1D,GAAG,4BAA4B;EAC/B,QAAQ;EACT,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { WEAPP_VITE_WEB_REQUEST_SUBSCRIBE_MESSAGE_KEY } from "@weapp-core/constants";
2
+
3
+ //#region src/runtime/polyfill/subscribe.ts
4
+ function normalizeSubscribeDecision(value) {
5
+ if (value === "accept" || value === "reject" || value === "ban" || value === "filter") return value;
6
+ return "accept";
7
+ }
8
+ function normalizeSubscribeTemplateIds(value) {
9
+ if (!Array.isArray(value)) return [];
10
+ return value.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
11
+ }
12
+ function resolveSubscribeDecisionMap(tmplIds) {
13
+ const preset = globalThis[WEAPP_VITE_WEB_REQUEST_SUBSCRIBE_MESSAGE_KEY];
14
+ const presetValue = typeof preset === "function" ? preset(tmplIds) : preset;
15
+ if (presetValue && typeof presetValue === "object") {
16
+ const output = {};
17
+ const source = presetValue;
18
+ for (const tmplId of tmplIds) output[tmplId] = normalizeSubscribeDecision(source[tmplId]);
19
+ return output;
20
+ }
21
+ const sharedDecision = normalizeSubscribeDecision(presetValue);
22
+ return tmplIds.reduce((result, tmplId) => {
23
+ result[tmplId] = sharedDecision;
24
+ return result;
25
+ }, {});
26
+ }
27
+
28
+ //#endregion
29
+ export { normalizeSubscribeTemplateIds, resolveSubscribeDecisionMap };
30
+ //# sourceMappingURL=subscribe.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribe.mjs","names":[],"sources":["../../../src/runtime/polyfill/subscribe.ts"],"sourcesContent":["import { WEAPP_VITE_WEB_REQUEST_SUBSCRIBE_MESSAGE_KEY } from '@weapp-core/constants'\n\nexport type SubscribeMessageDecision = 'accept' | 'reject' | 'ban' | 'filter'\n\nexport function normalizeSubscribeDecision(value: unknown): SubscribeMessageDecision {\n if (value === 'accept' || value === 'reject' || value === 'ban' || value === 'filter') {\n return value\n }\n return 'accept'\n}\n\nexport function normalizeSubscribeTemplateIds(value: unknown) {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .filter((item): item is string => typeof item === 'string')\n .map(item => item.trim())\n .filter(Boolean)\n}\n\nexport function resolveSubscribeDecisionMap(tmplIds: string[]) {\n const runtimeGlobal = globalThis as Record<string, unknown>\n const preset = runtimeGlobal[WEAPP_VITE_WEB_REQUEST_SUBSCRIBE_MESSAGE_KEY]\n const presetValue = typeof preset === 'function'\n ? (preset as (ids: string[]) => unknown)(tmplIds)\n : preset\n if (presetValue && typeof presetValue === 'object') {\n const output: Record<string, SubscribeMessageDecision> = {}\n const source = presetValue as Record<string, unknown>\n for (const tmplId of tmplIds) {\n output[tmplId] = normalizeSubscribeDecision(source[tmplId])\n }\n return output\n }\n const sharedDecision = normalizeSubscribeDecision(presetValue)\n return tmplIds.reduce<Record<string, SubscribeMessageDecision>>((result, tmplId) => {\n result[tmplId] = sharedDecision\n return result\n }, {})\n}\n"],"mappings":";;;AAIA,SAAgB,2BAA2B,OAA0C;AACnF,KAAI,UAAU,YAAY,UAAU,YAAY,UAAU,SAAS,UAAU,SAC3E,QAAO;AAET,QAAO;;AAGT,SAAgB,8BAA8B,OAAgB;AAC5D,KAAI,CAAC,MAAM,QAAQ,MAAM,CACvB,QAAO,EAAE;AAEX,QAAO,MACJ,QAAQ,SAAyB,OAAO,SAAS,SAAS,CAC1D,KAAI,SAAQ,KAAK,MAAM,CAAC,CACxB,OAAO,QAAQ;;AAGpB,SAAgB,4BAA4B,SAAmB;CAE7D,MAAM,SADgB,WACO;CAC7B,MAAM,cAAc,OAAO,WAAW,aACjC,OAAsC,QAAQ,GAC/C;AACJ,KAAI,eAAe,OAAO,gBAAgB,UAAU;EAClD,MAAM,SAAmD,EAAE;EAC3D,MAAM,SAAS;AACf,OAAK,MAAM,UAAU,QACnB,QAAO,UAAU,2BAA2B,OAAO,QAAQ;AAE7D,SAAO;;CAET,MAAM,iBAAiB,2BAA2B,YAAY;AAC9D,QAAO,QAAQ,QAAkD,QAAQ,WAAW;AAClF,SAAO,UAAU;AACjB,SAAO;IACN,EAAE,CAAC"}
@@ -0,0 +1,111 @@
1
+ //#region src/runtime/polyfill/system.ts
2
+ function resolveSystemName(userAgent) {
3
+ if (/android/i.test(userAgent)) return "Android";
4
+ if (/iphone|ipad|ipod/i.test(userAgent)) return "iOS";
5
+ if (/windows/i.test(userAgent)) return "Windows";
6
+ if (/mac os x/i.test(userAgent)) return "macOS";
7
+ if (/linux/i.test(userAgent)) return "Linux";
8
+ return "Unknown";
9
+ }
10
+ function resolvePlatformName(userAgent, runtimeNavigator) {
11
+ const normalized = (runtimeNavigator?.userAgentData?.platform ?? runtimeNavigator?.platform ?? resolveSystemName(userAgent)).toLowerCase();
12
+ if (normalized.includes("android")) return "android";
13
+ if (normalized.includes("iphone") || normalized.includes("ipad") || normalized.includes("ios")) return "ios";
14
+ if (normalized.includes("win")) return "windows";
15
+ if (normalized.includes("mac")) return "mac";
16
+ if (normalized.includes("linux")) return "linux";
17
+ return normalized || "web";
18
+ }
19
+ function normalizePositiveNumber(value, fallback) {
20
+ if (typeof value !== "number" || Number.isNaN(value) || value <= 0) return fallback;
21
+ return value;
22
+ }
23
+ function resolveDeviceOrientation() {
24
+ const runtimeWindow = typeof window !== "undefined" ? window : globalThis;
25
+ const width = normalizePositiveNumber(runtimeWindow.innerWidth, 0);
26
+ const height = normalizePositiveNumber(runtimeWindow.innerHeight, 0);
27
+ if (width > 0 && height > 0 && width > height) return "landscape";
28
+ return "portrait";
29
+ }
30
+ function normalizeMemorySize(memory) {
31
+ if (typeof memory !== "number" || Number.isNaN(memory) || memory <= 0) return 0;
32
+ return Math.round(memory * 1024);
33
+ }
34
+ function resolveRuntimeTheme() {
35
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return "light";
36
+ try {
37
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
38
+ } catch {
39
+ return "light";
40
+ }
41
+ }
42
+ function readSystemInfoSnapshot() {
43
+ const runtimeWindow = typeof window !== "undefined" ? window : globalThis;
44
+ const runtimeScreen = typeof screen !== "undefined" ? screen : globalThis;
45
+ const runtimeNavigator = typeof navigator !== "undefined" ? navigator : void 0;
46
+ const userAgent = runtimeNavigator?.userAgent ?? "";
47
+ const windowWidth = normalizePositiveNumber(runtimeWindow.innerWidth, normalizePositiveNumber(runtimeScreen.width, 0));
48
+ const windowHeight = normalizePositiveNumber(runtimeWindow.innerHeight, normalizePositiveNumber(runtimeScreen.height, 0));
49
+ const screenWidth = normalizePositiveNumber(runtimeScreen.width, windowWidth);
50
+ const screenHeight = normalizePositiveNumber(runtimeScreen.height, windowHeight);
51
+ return {
52
+ brand: "web",
53
+ model: runtimeNavigator?.platform ?? "web",
54
+ pixelRatio: normalizePositiveNumber(runtimeWindow.devicePixelRatio, 1),
55
+ screenWidth,
56
+ screenHeight,
57
+ windowWidth,
58
+ windowHeight,
59
+ statusBarHeight: 0,
60
+ language: runtimeNavigator?.language ?? "en",
61
+ version: runtimeNavigator?.appVersion ?? userAgent,
62
+ system: resolveSystemName(userAgent),
63
+ platform: resolvePlatformName(userAgent, runtimeNavigator)
64
+ };
65
+ }
66
+ function buildWindowInfoSnapshot(systemInfo) {
67
+ const safeArea = {
68
+ left: 0,
69
+ right: systemInfo.windowWidth,
70
+ top: systemInfo.statusBarHeight,
71
+ bottom: systemInfo.windowHeight,
72
+ width: systemInfo.windowWidth,
73
+ height: Math.max(0, systemInfo.windowHeight - systemInfo.statusBarHeight)
74
+ };
75
+ return {
76
+ pixelRatio: systemInfo.pixelRatio,
77
+ screenWidth: systemInfo.screenWidth,
78
+ screenHeight: systemInfo.screenHeight,
79
+ windowWidth: systemInfo.windowWidth,
80
+ windowHeight: systemInfo.windowHeight,
81
+ statusBarHeight: systemInfo.statusBarHeight,
82
+ screenTop: systemInfo.statusBarHeight,
83
+ safeArea
84
+ };
85
+ }
86
+ function readDeviceMemorySize() {
87
+ return normalizeMemorySize((typeof navigator !== "undefined" ? navigator : void 0)?.deviceMemory);
88
+ }
89
+ function resolveAccountAppId() {
90
+ const host = (typeof location !== "undefined" ? location : void 0)?.hostname?.trim();
91
+ return host ? `web:${host}` : "web";
92
+ }
93
+ function buildMenuButtonRect(windowWidth, statusBarHeight) {
94
+ const width = 88;
95
+ const height = 32;
96
+ const right = Math.max(width, windowWidth - 8);
97
+ const top = Math.max(0, statusBarHeight + (44 - height) / 2);
98
+ const left = Math.max(0, right - width);
99
+ return {
100
+ width,
101
+ height,
102
+ top,
103
+ right,
104
+ bottom: top + height,
105
+ left
106
+ };
107
+ }
108
+
109
+ //#endregion
110
+ export { buildMenuButtonRect, buildWindowInfoSnapshot, readDeviceMemorySize, readSystemInfoSnapshot, resolveAccountAppId, resolveDeviceOrientation, resolveRuntimeTheme };
111
+ //# sourceMappingURL=system.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.mjs","names":[],"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;AACnD,KAAI,WAAW,KAAK,UAAU,CAC5B,QAAO;AAET,KAAI,oBAAoB,KAAK,UAAU,CACrC,QAAO;A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M,QAAQ,KAAK,IAAI,OAAO,cAAc,EAAE;CAC9C,MAAM,MAAM,KAAK,IAAI,GAAG,mBAAmB,KAAK,UAAU,EAAE;CAC5D,MAAM,OAAO,KAAK,IAAI,GAAG,QAAQ,MAAM;AACvC,QAAO;EACL;EACA;EACA;EACA;EACA,QAAQ,MAAM;EACd;EACD"}
@@ -0,0 +1,65 @@
1
+ import { callMiniProgramAsyncFailure, callMiniProgramAsyncSuccess } from "./async.mjs";
2
+ import { buildMenuButtonRect, buildWindowInfoSnapshot, readDeviceMemorySize, readSystemInfoSnapshot, resolveAccountAppId, resolveDeviceOrientation, resolveRuntimeTheme } from "./system.mjs";
3
+
4
+ //#region src/runtime/polyfill/systemApi.ts
5
+ function getSystemInfoSyncBridge() {
6
+ return readSystemInfoSnapshot();
7
+ }
8
+ function getSystemInfoBridge(options) {
9
+ try {
10
+ const info = getSystemInfoSyncBridge();
11
+ return Promise.resolve(callMiniProgramAsyncSuccess(options, {
12
+ errMsg: "getSystemInfo:ok",
13
+ ...info
14
+ }));
15
+ } catch (error) {
16
+ const failure = callMiniProgramAsyncFailure(options, `getSystemInfo:fail ${error instanceof Error ? error.message : String(error)}`);
17
+ return Promise.reject(failure);
18
+ }
19
+ }
20
+ function getWindowInfoBridge() {
21
+ return buildWindowInfoSnapshot(getSystemInfoSyncBridge());
22
+ }
23
+ function getDeviceInfoBridge() {
24
+ const systemInfo = getSystemInfoSyncBridge();
25
+ return {
26
+ brand: systemInfo.brand,
27
+ model: systemInfo.model,
28
+ system: systemInfo.system,
29
+ platform: systemInfo.platform,
30
+ memorySize: readDeviceMemorySize(),
31
+ benchmarkLevel: -1,
32
+ abi: "web",
33
+ deviceOrientation: resolveDeviceOrientation()
34
+ };
35
+ }
36
+ function getAccountInfoSyncBridge() {
37
+ return {
38
+ miniProgram: {
39
+ appId: resolveAccountAppId(),
40
+ envVersion: "develop",
41
+ version: "0.0.0-web"
42
+ },
43
+ plugin: {}
44
+ };
45
+ }
46
+ function getAppBaseInfoBridge() {
47
+ const systemInfo = getSystemInfoSyncBridge();
48
+ const runtimeNavigator = typeof navigator !== "undefined" ? navigator : void 0;
49
+ return {
50
+ SDKVersion: "web",
51
+ language: runtimeNavigator?.language ?? "en",
52
+ version: runtimeNavigator?.appVersion ?? runtimeNavigator?.userAgent ?? "web",
53
+ platform: systemInfo.platform,
54
+ enableDebug: false,
55
+ theme: resolveRuntimeTheme()
56
+ };
57
+ }
58
+ function getMenuButtonBoundingClientRectBridge() {
59
+ const { windowWidth, statusBarHeight } = getSystemInfoSyncBridge();
60
+ return buildMenuButtonRect(windowWidth, statusBarHeight);
61
+ }
62
+
63
+ //#endregion
64
+ export { getAccountInfoSyncBridge, getAppBaseInfoBridge, getDeviceInfoBridge, getMenuButtonBoundingClientRectBridge, getSystemInfoBridge, getSystemInfoSyncBridge, getWindowInfoBridge };
65
+ //# sourceMappingURL=systemApi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/systemApi.ts"],"sourcesContent":["import {\n callMiniProgramAsyncFailure,\n callMiniProgramAsyncSuccess,\n} from './async'\nimport {\n buildMenuButtonRect,\n buildWindowInfoSnapshot,\n readDeviceMemorySize,\n readSystemInfoSnapshot,\n resolveAccountAppId,\n resolveDeviceOrientation,\n resolveRuntimeTheme,\n} from './system'\n\nexport function getSystemInfoSyncBridge() {\n return readSystemInfoSnapshot()\n}\n\nexport function getSystemInfoBridge(options?: any): Promise<any> {\n try {\n const info = getSystemInfoSyncBridge()\n return Promise.resolve(callMiniProgramAsyncSuccess(options, {\n errMsg: 'getSystemInfo:ok',\n ...info,\n }))\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n const failure = callMiniProgramAsyncFailure(options, `getSystemInfo:fail ${message}`)\n return Promise.reject(failure)\n }\n}\n\nexport function getWindowInfoBridge() {\n return buildWindowInfoSnapshot(getSystemInfoSyncBridge())\n}\n\nexport function getDeviceInfoBridge() {\n const systemInfo = getSystemInfoSyncBridge()\n return {\n brand: systemInfo.brand,\n model: systemInfo.model,\n system: systemInfo.system,\n platform: systemInfo.platform,\n memorySize: readDeviceMemorySize(),\n benchmarkLevel: -1,\n abi: 'web',\n deviceOrientation: resolveDeviceOrientation(),\n }\n}\n\nexport function getAccountInfoSyncBridge() {\n const appId = resolveAccountAppId()\n return {\n miniProgram: {\n appId,\n envVersion: 'develop',\n version: '0.0.0-web',\n },\n plugin: {},\n }\n}\n\nexport function getAppBaseInfoBridge() {\n const systemInfo = getSystemInfoSyncBridge()\n const runtimeNavigator = typeof navigator !== 'undefined' ? navigator : undefined\n return {\n SDKVersion: 'web',\n language: runtimeNavigator?.language ?? 'en',\n version: runtimeNavigator?.appVersion ?? runtimeNavigator?.userAgent ?? 'web',\n platform: systemInfo.platform,\n enableDebug: false,\n theme: resolveRuntimeTheme(),\n }\n}\n\nexport function getMenuButtonBoundingClientRectBridge() {\n const { windowWidth, statusBarHeight } = getSystemInfoSyncBridge()\n return buildMenuButtonRect(windowWidth, statusBarHeight)\n}\n"],"mappings":";;;;AAcA,SAAgB,0BAA0B;AACxC,QAAO,wBAAwB;;AAGjC,SAAgB,oBAAoB,SAA6B;AAC/D,KAAI;EACF,MAAM,OAAO,yBAAyB;AACtC,SAAO,QAAQ,QAAQ,4BAA4B,SAAS;GAC1D,QAAQ;GACR,GAAG;GACJ,CAAC,CAAC;UAEE,OAAO;EAEZ,MAAM,UAAU,4BAA4B,SAAS,sBADrC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACe;AACrF,SAAO,QAAQ,OAAO,QAAQ;;;AAIlC,SAAgB,sBAAsB;AACpC,QAAO,wBAAwB,yBAAyB,CAAC;;AAG3D,SAAgB,sBAAsB;CACpC,MAAM,aAAa,yBAAyB;AAC5C,QAAO;EACL,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,QAAQ,WAAW;EACnB,UAAU,WAAW;EACrB,YAAY,sBAAsB;EAClC,gBAAgB;EAChB,KAAK;EACL,mBAAmB,0BAA0B;EAC9C;;AAGH,SAAgB,2BAA2B;AAEzC,QAAO;EACL,aAAa;GACX,OAHU,qBAAqB;GAI/B,YAAY;GACZ,SAAS;GACV;EACD,QAAQ,EAAE;EACX;;AAGH,SAAgB,uBAAuB;CACrC,MAAM,aAAa,yBAAyB;CAC5C,MAAM,mBAAmB,OAAO,cAAc,cAAc,YAAY;AACxE,QAAO;EACL,YAAY;EACZ,UAAU,kBAAkB,YAAY;EACxC,SAAS,kBAAkB,cAAc,kBAAkB,aAAa;EACxE,UAAU,WAAW;EACrB,aAAa;EACb,OAAO,qBAAqB;EAC7B;;AAGH,SAAgB,wCAAwC;CACtD,MAAM,EAAE,aAAa,oBAAoB,yBAAyB;AAClE,QAAO,oBAAoB,aAAa,gBAAgB"}
@@ -0,0 +1,12 @@
1
+ //#region src/runtime/polyfill/types/base.d.ts
2
+ interface MiniProgramBaseResult {
3
+ errMsg: string;
4
+ }
5
+ interface MiniProgramAsyncOptions<SuccessResult extends MiniProgramBaseResult> {
6
+ success?: (result: SuccessResult) => void;
7
+ fail?: (result: MiniProgramBaseResult) => void;
8
+ complete?: (result: SuccessResult | MiniProgramBaseResult) => void;
9
+ }
10
+ //#endregion
11
+ export { MiniProgramAsyncOptions, MiniProgramBaseResult };
12
+ //# sourceMappingURL=base.d.mts.map
@@ -0,0 +1,126 @@
1
+ import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
+
3
+ //#region src/runtime/polyfill/types/common.d.ts
4
+ interface ShowToastOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
5
+ title?: string;
6
+ icon?: 'success' | 'error' | 'none';
7
+ duration?: number;
8
+ }
9
+ interface SetClipboardDataOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
10
+ data?: string;
11
+ }
12
+ interface GetClipboardDataSuccessResult extends MiniProgramBaseResult {
13
+ data: string;
14
+ }
15
+ interface GetClipboardDataOptions extends MiniProgramAsyncOptions<GetClipboardDataSuccessResult> {}
16
+ interface SetStorageOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
17
+ key?: string;
18
+ data?: any;
19
+ }
20
+ interface GetStorageSuccessResult extends MiniProgramBaseResult {
21
+ data: any;
22
+ }
23
+ interface GetStorageOptions extends MiniProgramAsyncOptions<GetStorageSuccessResult> {
24
+ key?: string;
25
+ }
26
+ interface RemoveStorageOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
27
+ key?: string;
28
+ }
29
+ interface StorageInfoResult extends MiniProgramBaseResult {
30
+ keys: string[];
31
+ currentSize: number;
32
+ limitSize: number;
33
+ }
34
+ interface FileReadResult extends MiniProgramBaseResult {
35
+ data: string | ArrayBuffer;
36
+ }
37
+ interface FileWriteOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
38
+ filePath?: string;
39
+ data?: string | ArrayBuffer | ArrayBufferView;
40
+ encoding?: string;
41
+ }
42
+ interface FileReadOptions extends MiniProgramAsyncOptions<FileReadResult> {
43
+ filePath?: string;
44
+ encoding?: string;
45
+ }
46
+ interface FileSystemManager {
47
+ writeFile: (options?: FileWriteOptions) => void;
48
+ readFile: (options?: FileReadOptions) => void;
49
+ writeFileSync: (filePath: string, data: string | ArrayBuffer | ArrayBufferView, encoding?: string) => void;
50
+ readFileSync: (filePath: string, encoding?: string) => string | ArrayBuffer;
51
+ }
52
+ type WorkerMessageCallback = (result: {
53
+ data: unknown;
54
+ }) => void;
55
+ type WorkerErrorCallback = (result: {
56
+ message: string;
57
+ filename?: string;
58
+ lineno?: number;
59
+ colno?: number;
60
+ }) => void;
61
+ interface WorkerBridge {
62
+ postMessage: (data: unknown) => void;
63
+ terminate: () => void;
64
+ onMessage: (callback: WorkerMessageCallback) => void;
65
+ offMessage: (callback?: WorkerMessageCallback) => void;
66
+ onError: (callback: WorkerErrorCallback) => void;
67
+ offError: (callback?: WorkerErrorCallback) => void;
68
+ }
69
+ interface RequestSuccessResult extends MiniProgramBaseResult {
70
+ data: any;
71
+ statusCode: number;
72
+ header: Record<string, string>;
73
+ }
74
+ interface RequestOptions extends MiniProgramAsyncOptions<RequestSuccessResult> {
75
+ url?: string;
76
+ method?: string;
77
+ data?: any;
78
+ header?: Record<string, string>;
79
+ timeout?: number;
80
+ dataType?: 'json' | 'text';
81
+ responseType?: 'text' | 'arraybuffer';
82
+ }
83
+ interface DownloadFileSuccessResult extends MiniProgramBaseResult {
84
+ tempFilePath: string;
85
+ statusCode: number;
86
+ }
87
+ interface DownloadFileOptions extends MiniProgramAsyncOptions<DownloadFileSuccessResult> {
88
+ url?: string;
89
+ header?: Record<string, string>;
90
+ timeout?: number;
91
+ }
92
+ interface UploadFileSuccessResult extends MiniProgramBaseResult {
93
+ data: string;
94
+ statusCode: number;
95
+ header: Record<string, string>;
96
+ }
97
+ interface UploadFileOptions extends MiniProgramAsyncOptions<UploadFileSuccessResult> {
98
+ url?: string;
99
+ filePath?: string;
100
+ name?: string;
101
+ header?: Record<string, string>;
102
+ formData?: Record<string, unknown>;
103
+ timeout?: number;
104
+ }
105
+ interface PreviewImageOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
106
+ current?: string;
107
+ urls?: string[];
108
+ }
109
+ interface ChooseImageTempFile {
110
+ path: string;
111
+ size: number;
112
+ type: string;
113
+ name: string;
114
+ }
115
+ interface ChooseImageSuccessResult extends MiniProgramBaseResult {
116
+ tempFilePaths: string[];
117
+ tempFiles: ChooseImageTempFile[];
118
+ }
119
+ interface ChooseImageOptions extends MiniProgramAsyncOptions<ChooseImageSuccessResult> {
120
+ count?: number;
121
+ sizeType?: Array<'original' | 'compressed'>;
122
+ sourceType?: Array<'album' | 'camera'>;
123
+ }
124
+ //#endregion
125
+ export { ChooseImageOptions, DownloadFileOptions, FileSystemManager, GetClipboardDataOptions, GetStorageOptions, PreviewImageOptions, RemoveStorageOptions, RequestOptions, SetClipboardDataOptions, SetStorageOptions, ShowToastOptions, StorageInfoResult, UploadFileOptions, WorkerBridge };
126
+ //# sourceMappingURL=common.d.mts.map
@@ -0,0 +1,151 @@
1
+ import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./base.mjs";
2
+
3
+ //#region src/runtime/polyfill/types/locationRuntime.d.ts
4
+ interface GetLocationSuccessResult extends MiniProgramBaseResult {
5
+ latitude: number;
6
+ longitude: number;
7
+ speed: number;
8
+ accuracy: number;
9
+ altitude: number;
10
+ verticalAccuracy: number;
11
+ horizontalAccuracy: number;
12
+ }
13
+ interface GetLocationOptions extends MiniProgramAsyncOptions<GetLocationSuccessResult> {
14
+ type?: 'wgs84' | 'gcj02';
15
+ altitude?: boolean;
16
+ isHighAccuracy?: boolean;
17
+ highAccuracyExpireTime?: number;
18
+ }
19
+ interface GetFuzzyLocationSuccessResult extends MiniProgramBaseResult {
20
+ latitude: number;
21
+ longitude: number;
22
+ accuracy: number;
23
+ }
24
+ interface GetFuzzyLocationOptions extends MiniProgramAsyncOptions<GetFuzzyLocationSuccessResult> {}
25
+ type NetworkType = 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none';
26
+ interface NetworkStatusResult {
27
+ isConnected: boolean;
28
+ networkType: NetworkType;
29
+ }
30
+ interface GetNetworkTypeSuccessResult extends MiniProgramBaseResult, NetworkStatusResult {}
31
+ interface GetNetworkTypeOptions extends MiniProgramAsyncOptions<GetNetworkTypeSuccessResult> {}
32
+ type NetworkStatusChangeCallback = (result: NetworkStatusResult) => void;
33
+ interface WindowResizeResult {
34
+ size: {
35
+ windowWidth: number;
36
+ windowHeight: number;
37
+ };
38
+ windowWidth: number;
39
+ windowHeight: number;
40
+ }
41
+ type WindowResizeCallback = (result: WindowResizeResult) => void;
42
+ interface ShowLoadingOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
43
+ title?: string;
44
+ mask?: boolean;
45
+ }
46
+ interface SetBackgroundColorOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
47
+ backgroundColor?: string;
48
+ backgroundColorTop?: string;
49
+ backgroundColorBottom?: string;
50
+ }
51
+ interface SetBackgroundTextStyleOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
52
+ textStyle?: 'dark' | 'light';
53
+ }
54
+ interface ShareMenuOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
55
+ withShareTicket?: boolean;
56
+ menus?: string[];
57
+ }
58
+ interface NavigateToMiniProgramOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
59
+ appId?: string;
60
+ path?: string;
61
+ extraData?: Record<string, any>;
62
+ envVersion?: 'develop' | 'trial' | 'release';
63
+ }
64
+ interface LoadSubPackageOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
65
+ name?: string;
66
+ root?: string;
67
+ }
68
+ interface PreloadSubpackageOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
69
+ name?: string;
70
+ root?: string;
71
+ }
72
+ interface UpdateManagerCheckResult {
73
+ hasUpdate: boolean;
74
+ }
75
+ interface UpdateManager {
76
+ applyUpdate: () => void;
77
+ onCheckForUpdate: (callback: (result: UpdateManagerCheckResult) => void) => void;
78
+ onUpdateReady: (callback: () => void) => void;
79
+ onUpdateFailed: (callback: () => void) => void;
80
+ }
81
+ interface LogManagerOptions {
82
+ level?: 0 | 1;
83
+ }
84
+ interface LogManager {
85
+ debug: (...args: unknown[]) => void;
86
+ info: (...args: unknown[]) => void;
87
+ log: (...args: unknown[]) => void;
88
+ warn: (...args: unknown[]) => void;
89
+ }
90
+ interface ChooseLocationSuccessResult extends MiniProgramBaseResult {
91
+ name: string;
92
+ address: string;
93
+ latitude: number;
94
+ longitude: number;
95
+ }
96
+ interface ChooseLocationOptions extends MiniProgramAsyncOptions<ChooseLocationSuccessResult> {}
97
+ interface ChooseAddressSuccessResult extends MiniProgramBaseResult {
98
+ userName: string;
99
+ postalCode: string;
100
+ provinceName: string;
101
+ cityName: string;
102
+ countyName: string;
103
+ detailInfo: string;
104
+ nationalCode: string;
105
+ telNumber: string;
106
+ }
107
+ interface ChooseAddressOptions extends MiniProgramAsyncOptions<ChooseAddressSuccessResult> {}
108
+ interface GetImageInfoSuccessResult extends MiniProgramBaseResult {
109
+ width: number;
110
+ height: number;
111
+ path: string;
112
+ type: string;
113
+ orientation: 'up';
114
+ }
115
+ interface GetImageInfoOptions extends MiniProgramAsyncOptions<GetImageInfoSuccessResult> {
116
+ src?: string;
117
+ }
118
+ interface MakePhoneCallOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
119
+ phoneNumber?: string;
120
+ }
121
+ interface OpenLocationOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
122
+ latitude?: number;
123
+ longitude?: number;
124
+ scale?: number;
125
+ name?: string;
126
+ address?: string;
127
+ }
128
+ interface TabBarOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
129
+ animation?: boolean;
130
+ }
131
+ interface OpenCustomerServiceChatOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
132
+ corpId?: string;
133
+ extInfo?: Record<string, any>;
134
+ url?: string;
135
+ }
136
+ interface RequestPaymentOptions extends MiniProgramAsyncOptions<MiniProgramBaseResult> {
137
+ timeStamp?: string;
138
+ nonceStr?: string;
139
+ package?: string;
140
+ signType?: string;
141
+ paySign?: string;
142
+ }
143
+ interface RequestSubscribeMessageSuccessResult extends MiniProgramBaseResult {
144
+ [tmplId: string]: string;
145
+ }
146
+ interface RequestSubscribeMessageOptions extends MiniProgramAsyncOptions<RequestSubscribeMessageSuccessResult> {
147
+ tmplIds?: string[];
148
+ }
149
+ //#endregion
150
+ export { ChooseAddressOptions, ChooseLocationOptions, GetFuzzyLocationOptions, GetImageInfoOptions, GetLocationOptions, GetNetworkTypeOptions, LoadSubPackageOptions, LogManager, LogManagerOptions, MakePhoneCallOptions, NavigateToMiniProgramOptions, NetworkStatusChangeCallback, OpenCustomerServiceChatOptions, OpenLocationOptions, PreloadSubpackageOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, SetBackgroundColorOptions, SetBackgroundTextStyleOptions, ShareMenuOptions, ShowLoadingOptions, TabBarOptions, UpdateManager, WindowResizeCallback };
151
+ //# sourceMappingURL=locationRuntime.d.mts.map