@pisell/core 0.0.2

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 (296) hide show
  1. package/README.md +1 -0
  2. package/es/app/app.d.ts +101 -0
  3. package/es/app/app.js +177 -0
  4. package/es/app/const.d.ts +4 -0
  5. package/es/app/const.js +6 -0
  6. package/es/app/index.d.ts +14 -0
  7. package/es/app/index.js +52 -0
  8. package/es/applicationManager/application.d.ts +197 -0
  9. package/es/applicationManager/application.js +469 -0
  10. package/es/applicationManager/index.d.ts +19 -0
  11. package/es/applicationManager/index.js +206 -0
  12. package/es/aws/index.d.ts +16 -0
  13. package/es/aws/index.js +76 -0
  14. package/es/cmd/const.d.ts +11 -0
  15. package/es/cmd/const.js +13 -0
  16. package/es/cmd/index.d.ts +13 -0
  17. package/es/cmd/index.js +91 -0
  18. package/es/cmd/type.d.ts +5 -0
  19. package/es/cmd/type.js +1 -0
  20. package/es/communicationManager/index.d.ts +59 -0
  21. package/es/communicationManager/index.js +174 -0
  22. package/es/config.d.ts +3 -0
  23. package/es/config.js +14 -0
  24. package/es/cookie/index.d.ts +13 -0
  25. package/es/cookie/index.js +47 -0
  26. package/es/css/global.less +73 -0
  27. package/es/css/index.less +31 -0
  28. package/es/css/variables.css +84 -0
  29. package/es/data/index.d.ts +8 -0
  30. package/es/data/index.js +16 -0
  31. package/es/history/config.d.ts +24 -0
  32. package/es/history/config.js +43 -0
  33. package/es/history/index.d.ts +26 -0
  34. package/es/history/index.js +80 -0
  35. package/es/history/type.d.ts +2 -0
  36. package/es/history/type.js +1 -0
  37. package/es/hooks/index.d.ts +12 -0
  38. package/es/hooks/index.js +13 -0
  39. package/es/hooks/useDelayedValue/index.d.ts +2 -0
  40. package/es/hooks/useDelayedValue/index.js +26 -0
  41. package/es/hooks/useDispatch/index.d.ts +2 -0
  42. package/es/hooks/useDispatch/index.js +2 -0
  43. package/es/hooks/useLowCode/index.d.ts +13 -0
  44. package/es/hooks/useLowCode/index.js +74 -0
  45. package/es/hooks/useStore/index.d.ts +6 -0
  46. package/es/hooks/useStore/index.js +11 -0
  47. package/es/index.d.ts +8 -0
  48. package/es/index.js +10 -0
  49. package/es/indexDB/index.d.ts +296 -0
  50. package/es/indexDB/index.js +1619 -0
  51. package/es/locales/en.d.ts +3 -0
  52. package/es/locales/en.js +5 -0
  53. package/es/locales/index.d.ts +39 -0
  54. package/es/locales/index.js +199 -0
  55. package/es/locales/original.d.ts +3 -0
  56. package/es/locales/original.js +7 -0
  57. package/es/locales/type.d.ts +19 -0
  58. package/es/locales/type.js +1 -0
  59. package/es/locales/zh-CN.d.ts +3 -0
  60. package/es/locales/zh-CN.js +5 -0
  61. package/es/locales/zh-HK.d.ts +3 -0
  62. package/es/locales/zh-HK.js +5 -0
  63. package/es/logger/feishu.d.ts +11 -0
  64. package/es/logger/feishu.js +50 -0
  65. package/es/logger/index.d.ts +135 -0
  66. package/es/logger/index.js +870 -0
  67. package/es/menuManager/hooks.d.ts +17 -0
  68. package/es/menuManager/hooks.js +136 -0
  69. package/es/menuManager/index.d.ts +28 -0
  70. package/es/menuManager/index.js +165 -0
  71. package/es/models/global.d.ts +32 -0
  72. package/es/models/global.js +66 -0
  73. package/es/models/index.d.ts +45 -0
  74. package/es/models/index.js +65 -0
  75. package/es/models/type.d.ts +2 -0
  76. package/es/models/type.js +1 -0
  77. package/es/plugin/index.d.ts +0 -0
  78. package/es/plugin/index.js +0 -0
  79. package/es/pubsub/example.d.ts +5 -0
  80. package/es/pubsub/example.js +92 -0
  81. package/es/pubsub/index.d.ts +73 -0
  82. package/es/pubsub/index.js +166 -0
  83. package/es/render/index.d.ts +0 -0
  84. package/es/render/index.js +0 -0
  85. package/es/request/cache.d.ts +46 -0
  86. package/es/request/cache.js +372 -0
  87. package/es/request/cancelToken.d.ts +38 -0
  88. package/es/request/cancelToken.js +59 -0
  89. package/es/request/config.d.ts +3 -0
  90. package/es/request/config.js +63 -0
  91. package/es/request/constants.d.ts +2 -0
  92. package/es/request/constants.js +6 -0
  93. package/es/request/index.d.ts +24 -0
  94. package/es/request/index.js +267 -0
  95. package/es/request/pisell2Request.d.ts +6 -0
  96. package/es/request/pisell2Request.js +62 -0
  97. package/es/request/type.d.ts +57 -0
  98. package/es/request/type.js +10 -0
  99. package/es/request/utils.d.ts +46 -0
  100. package/es/request/utils.js +147 -0
  101. package/es/routes/config.d.ts +7 -0
  102. package/es/routes/config.js +17 -0
  103. package/es/routes/index.d.ts +28 -0
  104. package/es/routes/index.js +151 -0
  105. package/es/socket/components/SocketMonitorPage.d.ts +6 -0
  106. package/es/socket/components/SocketMonitorPage.js +485 -0
  107. package/es/socket/components/index.d.ts +2 -0
  108. package/es/socket/components/index.js +2 -0
  109. package/es/socket/constants.d.ts +33 -0
  110. package/es/socket/constants.js +39 -0
  111. package/es/socket/events.d.ts +31 -0
  112. package/es/socket/events.js +19 -0
  113. package/es/socket/heartbeat.d.ts +66 -0
  114. package/es/socket/heartbeat.js +184 -0
  115. package/es/socket/index.d.ts +61 -0
  116. package/es/socket/index.js +246 -0
  117. package/es/socket/monitor.d.ts +169 -0
  118. package/es/socket/monitor.js +448 -0
  119. package/es/socket/reconnect.d.ts +61 -0
  120. package/es/socket/reconnect.js +199 -0
  121. package/es/socket/socket.d.ts +130 -0
  122. package/es/socket/socket.js +613 -0
  123. package/es/socket/types.d.ts +85 -0
  124. package/es/socket/types.js +35 -0
  125. package/es/storage/index.d.ts +17 -0
  126. package/es/storage/index.js +46 -0
  127. package/es/tasks/index.d.ts +127 -0
  128. package/es/tasks/index.js +1119 -0
  129. package/es/tasks/scheduledTasksExample.d.ts +61 -0
  130. package/es/tasks/scheduledTasksExample.js +351 -0
  131. package/es/tasks/type.d.ts +100 -0
  132. package/es/tasks/type.js +1 -0
  133. package/es/tasks/useTasks.d.ts +5 -0
  134. package/es/tasks/useTasks.js +25 -0
  135. package/es/type.d.ts +2 -0
  136. package/es/type.js +1 -0
  137. package/es/utils/adaptiveThrottle/index.d.ts +36 -0
  138. package/es/utils/adaptiveThrottle/index.js +136 -0
  139. package/es/variables/VariablesProvider.d.ts +7 -0
  140. package/es/variables/VariablesProvider.js +12 -0
  141. package/es/variables/config.d.ts +3 -0
  142. package/es/variables/config.js +16 -0
  143. package/es/variables/index.d.ts +6 -0
  144. package/es/variables/index.js +5 -0
  145. package/es/variables/type.d.ts +2 -0
  146. package/es/variables/type.js +1 -0
  147. package/es/website/index.d.ts +6 -0
  148. package/es/website/index.js +65 -0
  149. package/lib/app/app.d.ts +101 -0
  150. package/lib/app/app.js +171 -0
  151. package/lib/app/const.d.ts +4 -0
  152. package/lib/app/const.js +33 -0
  153. package/lib/app/index.d.ts +14 -0
  154. package/lib/app/index.js +76 -0
  155. package/lib/applicationManager/application.d.ts +197 -0
  156. package/lib/applicationManager/application.js +280 -0
  157. package/lib/applicationManager/index.d.ts +19 -0
  158. package/lib/applicationManager/index.js +88 -0
  159. package/lib/aws/index.d.ts +16 -0
  160. package/lib/aws/index.js +67 -0
  161. package/lib/cmd/const.d.ts +11 -0
  162. package/lib/cmd/const.js +39 -0
  163. package/lib/cmd/index.d.ts +13 -0
  164. package/lib/cmd/index.js +96 -0
  165. package/lib/cmd/type.d.ts +5 -0
  166. package/lib/cmd/type.js +17 -0
  167. package/lib/communicationManager/index.d.ts +59 -0
  168. package/lib/communicationManager/index.js +102 -0
  169. package/lib/config.d.ts +3 -0
  170. package/lib/config.js +36 -0
  171. package/lib/cookie/index.d.ts +13 -0
  172. package/lib/cookie/index.js +62 -0
  173. package/lib/css/global.less +73 -0
  174. package/lib/css/index.less +31 -0
  175. package/lib/css/variables.css +84 -0
  176. package/lib/data/index.d.ts +8 -0
  177. package/lib/data/index.js +38 -0
  178. package/lib/history/config.d.ts +24 -0
  179. package/lib/history/config.js +41 -0
  180. package/lib/history/index.d.ts +26 -0
  181. package/lib/history/index.js +99 -0
  182. package/lib/history/type.d.ts +2 -0
  183. package/lib/history/type.js +17 -0
  184. package/lib/hooks/index.d.ts +12 -0
  185. package/lib/hooks/index.js +44 -0
  186. package/lib/hooks/useDelayedValue/index.d.ts +2 -0
  187. package/lib/hooks/useDelayedValue/index.js +36 -0
  188. package/lib/hooks/useDispatch/index.d.ts +2 -0
  189. package/lib/hooks/useDispatch/index.js +26 -0
  190. package/lib/hooks/useLowCode/index.d.ts +13 -0
  191. package/lib/hooks/useLowCode/index.js +75 -0
  192. package/lib/hooks/useStore/index.d.ts +6 -0
  193. package/lib/hooks/useStore/index.js +33 -0
  194. package/lib/index.d.ts +8 -0
  195. package/lib/index.js +58 -0
  196. package/lib/indexDB/index.d.ts +296 -0
  197. package/lib/indexDB/index.js +767 -0
  198. package/lib/locales/en.d.ts +3 -0
  199. package/lib/locales/en.js +29 -0
  200. package/lib/locales/index.d.ts +39 -0
  201. package/lib/locales/index.js +159 -0
  202. package/lib/locales/original.d.ts +3 -0
  203. package/lib/locales/original.js +31 -0
  204. package/lib/locales/type.d.ts +19 -0
  205. package/lib/locales/type.js +17 -0
  206. package/lib/locales/zh-CN.d.ts +3 -0
  207. package/lib/locales/zh-CN.js +29 -0
  208. package/lib/locales/zh-HK.d.ts +3 -0
  209. package/lib/locales/zh-HK.js +29 -0
  210. package/lib/logger/feishu.d.ts +11 -0
  211. package/lib/logger/feishu.js +52 -0
  212. package/lib/logger/index.d.ts +135 -0
  213. package/lib/logger/index.js +476 -0
  214. package/lib/menuManager/hooks.d.ts +17 -0
  215. package/lib/menuManager/hooks.js +135 -0
  216. package/lib/menuManager/index.d.ts +28 -0
  217. package/lib/menuManager/index.js +125 -0
  218. package/lib/models/global.d.ts +32 -0
  219. package/lib/models/global.js +62 -0
  220. package/lib/models/index.d.ts +45 -0
  221. package/lib/models/index.js +69 -0
  222. package/lib/models/type.d.ts +2 -0
  223. package/lib/models/type.js +17 -0
  224. package/lib/plugin/index.d.ts +0 -0
  225. package/lib/plugin/index.js +0 -0
  226. package/lib/pubsub/example.d.ts +5 -0
  227. package/lib/pubsub/example.js +61 -0
  228. package/lib/pubsub/index.d.ts +73 -0
  229. package/lib/pubsub/index.js +141 -0
  230. package/lib/render/index.d.ts +0 -0
  231. package/lib/render/index.js +0 -0
  232. package/lib/request/cache.d.ts +46 -0
  233. package/lib/request/cache.js +195 -0
  234. package/lib/request/cancelToken.d.ts +38 -0
  235. package/lib/request/cancelToken.js +59 -0
  236. package/lib/request/config.d.ts +3 -0
  237. package/lib/request/config.js +69 -0
  238. package/lib/request/constants.d.ts +2 -0
  239. package/lib/request/constants.js +34 -0
  240. package/lib/request/index.d.ts +24 -0
  241. package/lib/request/index.js +210 -0
  242. package/lib/request/pisell2Request.d.ts +6 -0
  243. package/lib/request/pisell2Request.js +75 -0
  244. package/lib/request/type.d.ts +57 -0
  245. package/lib/request/type.js +36 -0
  246. package/lib/request/utils.d.ts +46 -0
  247. package/lib/request/utils.js +113 -0
  248. package/lib/routes/config.d.ts +7 -0
  249. package/lib/routes/config.js +50 -0
  250. package/lib/routes/index.d.ts +28 -0
  251. package/lib/routes/index.js +121 -0
  252. package/lib/socket/components/SocketMonitorPage.d.ts +6 -0
  253. package/lib/socket/components/SocketMonitorPage.js +340 -0
  254. package/lib/socket/components/index.d.ts +2 -0
  255. package/lib/socket/components/index.js +39 -0
  256. package/lib/socket/constants.d.ts +33 -0
  257. package/lib/socket/constants.js +62 -0
  258. package/lib/socket/events.d.ts +31 -0
  259. package/lib/socket/events.js +44 -0
  260. package/lib/socket/heartbeat.d.ts +66 -0
  261. package/lib/socket/heartbeat.js +157 -0
  262. package/lib/socket/index.d.ts +61 -0
  263. package/lib/socket/index.js +198 -0
  264. package/lib/socket/monitor.d.ts +169 -0
  265. package/lib/socket/monitor.js +350 -0
  266. package/lib/socket/reconnect.d.ts +61 -0
  267. package/lib/socket/reconnect.js +157 -0
  268. package/lib/socket/socket.d.ts +130 -0
  269. package/lib/socket/socket.js +426 -0
  270. package/lib/socket/types.d.ts +85 -0
  271. package/lib/socket/types.js +36 -0
  272. package/lib/storage/index.d.ts +17 -0
  273. package/lib/storage/index.js +64 -0
  274. package/lib/tasks/index.d.ts +127 -0
  275. package/lib/tasks/index.js +710 -0
  276. package/lib/tasks/scheduledTasksExample.d.ts +61 -0
  277. package/lib/tasks/scheduledTasksExample.js +267 -0
  278. package/lib/tasks/type.d.ts +100 -0
  279. package/lib/tasks/type.js +17 -0
  280. package/lib/tasks/useTasks.d.ts +5 -0
  281. package/lib/tasks/useTasks.js +37 -0
  282. package/lib/type.d.ts +2 -0
  283. package/lib/type.js +17 -0
  284. package/lib/utils/adaptiveThrottle/index.d.ts +36 -0
  285. package/lib/utils/adaptiveThrottle/index.js +121 -0
  286. package/lib/variables/VariablesProvider.d.ts +7 -0
  287. package/lib/variables/VariablesProvider.js +51 -0
  288. package/lib/variables/config.d.ts +3 -0
  289. package/lib/variables/config.js +38 -0
  290. package/lib/variables/index.d.ts +6 -0
  291. package/lib/variables/index.js +29 -0
  292. package/lib/variables/type.d.ts +2 -0
  293. package/lib/variables/type.js +17 -0
  294. package/lib/website/index.d.ts +6 -0
  295. package/lib/website/index.js +75 -0
  296. package/package.json +49 -0
@@ -0,0 +1,136 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ export var DEFAULT_THROTTLE_INTERVALS = [5 * 60 * 1000,
12
+ // 5分钟
13
+ 30 * 60 * 1000,
14
+ // 30分钟
15
+ 60 * 60 * 1000,
16
+ // 1小时
17
+ 6 * 60 * 60 * 1000,
18
+ // 6小时
19
+ 24 * 60 * 60 * 1000 // 1天
20
+ ];
21
+ export var AdaptiveThrottle = /*#__PURE__*/function () {
22
+ function AdaptiveThrottle() {
23
+ var intervals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THROTTLE_INTERVALS;
24
+ _classCallCheck(this, AdaptiveThrottle);
25
+ _defineProperty(this, "store", new Map());
26
+ _defineProperty(this, "intervals", void 0);
27
+ this.intervals = intervals;
28
+ }
29
+
30
+ /**
31
+ * 触发事务
32
+ */
33
+ _createClass(AdaptiveThrottle, [{
34
+ key: "trigger",
35
+ value: function trigger(key, handler) {
36
+ var now = Date.now();
37
+ var record = this.store.get(key);
38
+
39
+ // ① 首次调用:立即执行
40
+ if (!record) {
41
+ handler({
42
+ key: key,
43
+ count: 1,
44
+ isFirst: true,
45
+ level: 0,
46
+ lastExecuteTime: now
47
+ });
48
+ record = {
49
+ key: key,
50
+ count: 0,
51
+ level: 0,
52
+ lastExecuteTime: now
53
+ };
54
+ this.store.set(key, record);
55
+ this.schedule(key, handler, record);
56
+ return;
57
+ }
58
+
59
+ // ② 同 key 事务:累计次数
60
+ record.count++;
61
+ }
62
+
63
+ /**
64
+ * 调度下一次节流执行
65
+ */
66
+ }, {
67
+ key: "schedule",
68
+ value: function schedule(key, handler, record) {
69
+ var _this = this;
70
+ var interval = this.intervals[record.level];
71
+ record.timer = setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
72
+ var count;
73
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
74
+ while (1) switch (_context.prev = _context.next) {
75
+ case 0:
76
+ count = record.count;
77
+ if (!(count > 0)) {
78
+ _context.next = 4;
79
+ break;
80
+ }
81
+ _context.next = 4;
82
+ return handler({
83
+ key: key,
84
+ count: count,
85
+ isFirst: false,
86
+ level: record.level,
87
+ lastExecuteTime: record.lastExecuteTime
88
+ });
89
+ case 4:
90
+ // 自适应升级节流等级
91
+ if (count > 0 && record.level < _this.intervals.length - 1) {
92
+ record.level++;
93
+ }
94
+ record.count = 0;
95
+ record.lastExecuteTime = Date.now();
96
+
97
+ // 继续下一轮
98
+ _this.schedule(key, handler, record);
99
+ case 8:
100
+ case "end":
101
+ return _context.stop();
102
+ }
103
+ }, _callee);
104
+ })), interval);
105
+ }
106
+
107
+ /**
108
+ * 主动清理某个事务
109
+ */
110
+ }, {
111
+ key: "clear",
112
+ value: function clear(key) {
113
+ var record = this.store.get(key);
114
+ if (!record) return;
115
+ if (record.timer) {
116
+ clearTimeout(record.timer);
117
+ }
118
+ this.store.delete(key);
119
+ }
120
+
121
+ /**
122
+ * 清空所有事务
123
+ */
124
+ }, {
125
+ key: "clearAll",
126
+ value: function clearAll() {
127
+ this.store.forEach(function (record) {
128
+ if (record.timer) {
129
+ clearTimeout(record.timer);
130
+ }
131
+ });
132
+ this.store.clear();
133
+ }
134
+ }]);
135
+ return AdaptiveThrottle;
136
+ }();
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export declare const useVariablesContext: () => any;
3
+ interface VariablesProviderProps {
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const VariablesProvider: React.FC<VariablesProviderProps>;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import React, { createContext } from "react";
2
+ var VariablesContext = /*#__PURE__*/createContext({});
3
+ VariablesContext.displayName = "VariablesContext";
4
+ export var useVariablesContext = function useVariablesContext() {
5
+ return React.useContext(VariablesContext);
6
+ };
7
+ export var VariablesProvider = function VariablesProvider(_ref) {
8
+ var children = _ref.children;
9
+ return /*#__PURE__*/React.createElement(VariablesContext.Provider, {
10
+ value: {}
11
+ }, children);
12
+ };
@@ -0,0 +1,3 @@
1
+ import { VariablesConfig } from './type';
2
+ export declare const setConfig: (newConfig: Partial<VariablesConfig>) => void;
3
+ export declare const getConfig: () => VariablesConfig;
@@ -0,0 +1,16 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ var defaultConfig = {
8
+ globalVariableMap: {}
9
+ };
10
+ var config = _objectSpread({}, defaultConfig);
11
+ export var setConfig = function setConfig(newConfig) {
12
+ config = _objectSpread(_objectSpread({}, config), newConfig);
13
+ };
14
+ export var getConfig = function getConfig() {
15
+ return config;
16
+ };
@@ -0,0 +1,6 @@
1
+ export declare type VariableMap = Record<string, string>;
2
+ declare const _default: {
3
+ setConfig: (newConfig: Partial<import("./type").VariablesConfig>) => void;
4
+ getConfig: () => import("./type").VariablesConfig;
5
+ };
6
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { setConfig, getConfig } from "./config";
2
+ export default {
3
+ setConfig: setConfig,
4
+ getConfig: getConfig
5
+ };
@@ -0,0 +1,2 @@
1
+ export interface VariablesConfig {
2
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ setTitle: (title: string) => void;
3
+ setIcon: (paramsIcon: string) => void;
4
+ setAppleWebAppTitle: (title: string) => void;
5
+ };
6
+ export default _default;
@@ -0,0 +1,65 @@
1
+ import { getApp } from "../app";
2
+ var setTitle = function setTitle(title) {
3
+ document.title = title;
4
+ };
5
+ var setIcon = function setIcon(paramsIcon) {
6
+ var app = getApp();
7
+ app.storage.setStorage('favicon', paramsIcon);
8
+ var icon = "".concat(paramsIcon, "?v=").concat(new Date().getTime());
9
+ var existingLink = document.head.querySelector('link[rel="shortcut icon"]');
10
+ if (existingLink) {
11
+ document.head.removeChild(existingLink);
12
+ }
13
+
14
+ // 创建新的 shortcut icon 标签
15
+ var link = document.createElement('link');
16
+ link.rel = 'shortcut icon';
17
+ link.href = icon;
18
+ document.head.appendChild(link);
19
+
20
+ // 同时设置标准 favicon
21
+ var faviconLink = document.head.querySelector('link[rel="icon"]');
22
+ if (faviconLink) {
23
+ document.head.removeChild(faviconLink);
24
+ }
25
+ var newFaviconLink = document.createElement('link');
26
+ newFaviconLink.rel = 'icon';
27
+ newFaviconLink.href = icon;
28
+ document.head.appendChild(newFaviconLink);
29
+ setAppleTouchIcon(icon);
30
+ };
31
+
32
+ // 设置 Safari 添加到主屏幕的图标
33
+ var setAppleTouchIcon = function setAppleTouchIcon(iconUrl) {
34
+ // 移除已有的 apple-touch-icon 标签
35
+ var existingLink = document.head.querySelector('link[rel="apple-touch-icon"]');
36
+ if (existingLink) {
37
+ document.head.removeChild(existingLink);
38
+ }
39
+
40
+ // 创建新的 apple-touch-icon 标签
41
+ var link = document.createElement('link');
42
+ link.rel = 'apple-touch-icon';
43
+ link.href = iconUrl;
44
+ document.head.appendChild(link);
45
+ };
46
+
47
+ // 设置 Safari 添加到主屏幕的标题
48
+ var setAppleWebAppTitle = function setAppleWebAppTitle(title) {
49
+ // 移除已有的 apple-mobile-web-app-title 标签
50
+ var existingMeta = document.head.querySelector('meta[name="apple-mobile-web-app-title"]');
51
+ if (existingMeta) {
52
+ document.head.removeChild(existingMeta);
53
+ }
54
+
55
+ // 创建新的 apple-mobile-web-app-title 标签
56
+ var meta = document.createElement('meta');
57
+ meta.name = 'apple-mobile-web-app-title';
58
+ meta.content = title;
59
+ document.head.appendChild(meta);
60
+ };
61
+ export default {
62
+ setTitle: setTitle,
63
+ setIcon: setIcon,
64
+ setAppleWebAppTitle: setAppleWebAppTitle
65
+ };
@@ -0,0 +1,101 @@
1
+ import { RouterManager } from '../routes';
2
+ import { ApplicationManager } from '../applicationManager';
3
+ import { History, HistoryOptions } from '../history';
4
+ import { Data } from '../data';
5
+ import { Locales, LocalesOptions } from '../locales';
6
+ import { Storage, StorageOptions } from '../storage';
7
+ import { MenuManager } from '../menuManager';
8
+ import LoggerManager, { LoggerOptions } from '../logger';
9
+ import { TasksManager } from '../tasks';
10
+ import IndexDBManager, { DBOptions } from '../indexDB';
11
+ import CMD, { CMDOptions } from "../cmd";
12
+ import AWS, { AWSOptions } from "../aws";
13
+ import CommunicationManager from '../communicationManager';
14
+ declare global {
15
+ interface Window {
16
+ app: App;
17
+ }
18
+ }
19
+ export interface Bootstrap {
20
+ hooks: {
21
+ [key: string]: () => Promise<void>;
22
+ };
23
+ }
24
+ export interface AppOptions {
25
+ logger?: LoggerOptions;
26
+ db?: DBOptions;
27
+ constants?: any;
28
+ history?: HistoryOptions;
29
+ storage?: StorageOptions;
30
+ locales?: LocalesOptions;
31
+ cmd?: CMDOptions;
32
+ aws?: AWSOptions;
33
+ getPisellos?: () => any;
34
+ }
35
+ declare class App {
36
+ private static instance;
37
+ private plugins;
38
+ globalData: any;
39
+ router: RouterManager;
40
+ applicationManager: ApplicationManager;
41
+ history: History;
42
+ data: Data;
43
+ hooks: import("../hooks").HooksExport;
44
+ locales: Locales;
45
+ models: {
46
+ getStore: () => import("../models").Store;
47
+ StoreProvider: typeof import("react-redux").Provider;
48
+ setConfig: (models: any[]) => void;
49
+ };
50
+ request: {
51
+ get: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
52
+ post: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
53
+ put: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
54
+ remove: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
55
+ custom: (url: string, config: import("../request").RequestSetting | undefined) => any;
56
+ setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
57
+ getConfig: () => import("../request").RequestConfig;
58
+ };
59
+ storage: Storage;
60
+ menuManager: MenuManager;
61
+ cookie: {
62
+ setCookie: (name: string, value: string, domain?: string | undefined) => void;
63
+ getCookie: (name: string) => string | null;
64
+ deleteCookie: (name: string, domain?: string | undefined) => void;
65
+ checkCookie: (name: string) => boolean;
66
+ updateCookie: (name: string, value: string, domain?: string | undefined) => void;
67
+ };
68
+ website: {
69
+ setTitle: (title: string) => void;
70
+ setIcon: (paramsIcon: string) => void;
71
+ setAppleWebAppTitle: (title: string) => void;
72
+ };
73
+ logger: LoggerManager;
74
+ pubsub: import("../pubsub").PubSub;
75
+ cmd: CMD;
76
+ aws: AWS;
77
+ tasksManager: TasksManager;
78
+ getPisellos: any;
79
+ bootstrap?: Bootstrap;
80
+ dbManager: IndexDBManager | null;
81
+ constants: {
82
+ channel: string;
83
+ [key: string]: string;
84
+ };
85
+ comm: CommunicationManager;
86
+ private constructor();
87
+ static getInstance(options?: AppOptions): App;
88
+ setGlobalData(globalData: any): void;
89
+ usePlugin(name: string, plugin: any): void;
90
+ usePlugins(plugins: {
91
+ name: string;
92
+ plugin: any;
93
+ }[]): void;
94
+ getPlugin(name: string): any;
95
+ getGlobalData(): any;
96
+ install(): void;
97
+ unInstall(): void;
98
+ setBootstrap(bootstrap: Bootstrap): void;
99
+ getBootstrap(): Bootstrap | undefined;
100
+ }
101
+ export default App;
package/lib/app/app.js ADDED
@@ -0,0 +1,171 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/app/app.ts
30
+ var app_exports = {};
31
+ __export(app_exports, {
32
+ default: () => app_default
33
+ });
34
+ module.exports = __toCommonJS(app_exports);
35
+ var import_routes = require("../routes");
36
+ var import_applicationManager = require("../applicationManager");
37
+ var import_history = require("../history");
38
+ var import_data = require("../data");
39
+ var import_hooks = __toESM(require("../hooks"));
40
+ var import_locales = require("../locales");
41
+ var import_models = __toESM(require("../models"));
42
+ var import_request = __toESM(require("../request"));
43
+ var import_storage = require("../storage");
44
+ var import_menuManager = require("../menuManager");
45
+ var import_cookie = __toESM(require("../cookie"));
46
+ var import_website = __toESM(require("../website"));
47
+ var import_logger = __toESM(require("../logger"));
48
+ var import_tasks = require("../tasks");
49
+ var import_indexDB = __toESM(require("../indexDB"));
50
+ var import_pubsub = __toESM(require("../pubsub"));
51
+ var import_const = require("./const");
52
+ var import_cmd = __toESM(require("../cmd"));
53
+ var import_aws = __toESM(require("../aws"));
54
+ var import_communicationManager = __toESM(require("../communicationManager"));
55
+ var App = class _App {
56
+ // 实例
57
+ static instance;
58
+ // 插件管理
59
+ plugins;
60
+ // 全局数据
61
+ globalData;
62
+ // 路由管理
63
+ router;
64
+ // 应用管理
65
+ applicationManager;
66
+ // History
67
+ history;
68
+ // 数据存储
69
+ data;
70
+ // hooks
71
+ hooks = import_hooks.default;
72
+ // 多语言
73
+ locales;
74
+ // dva
75
+ models = import_models.default;
76
+ // 请求
77
+ request = import_request.default;
78
+ // 存储
79
+ storage;
80
+ // 菜单管理
81
+ menuManager;
82
+ // cookie
83
+ cookie = import_cookie.default;
84
+ // 网站信息
85
+ website = import_website.default;
86
+ // 日志
87
+ logger;
88
+ // 发布订阅
89
+ pubsub = import_pubsub.default;
90
+ // cmd
91
+ cmd;
92
+ // aws
93
+ aws;
94
+ // 任务管理
95
+ tasksManager;
96
+ // getPisellos
97
+ getPisellos;
98
+ bootstrap;
99
+ dbManager = null;
100
+ constants = {
101
+ channel: ""
102
+ };
103
+ // 通信管理
104
+ comm;
105
+ constructor(options) {
106
+ this.plugins = /* @__PURE__ */ new Map();
107
+ this.globalData = {};
108
+ this.router = new import_routes.RouterManager({}, this);
109
+ this.menuManager = new import_menuManager.MenuManager([], this);
110
+ this.applicationManager = new import_applicationManager.ApplicationManager([], this);
111
+ this.history = new import_history.History(this, options == null ? void 0 : options.history);
112
+ this.storage = new import_storage.Storage(this, options == null ? void 0 : options.storage);
113
+ this.data = new import_data.Data(this);
114
+ this.locales = new import_locales.Locales(this, options == null ? void 0 : options.locales);
115
+ if (options == null ? void 0 : options.db) {
116
+ this.dbManager = new import_indexDB.default(this, options == null ? void 0 : options.db);
117
+ }
118
+ this.logger = new import_logger.default(this, options == null ? void 0 : options.logger);
119
+ this.tasksManager = new import_tasks.TasksManager(this);
120
+ this.cmd = new import_cmd.default(this, options == null ? void 0 : options.cmd);
121
+ this.aws = new import_aws.default(this, options == null ? void 0 : options.aws);
122
+ this.getPisellos = options == null ? void 0 : options.getPisellos;
123
+ if (options == null ? void 0 : options.constants) {
124
+ this.constants = options.constants || {};
125
+ }
126
+ this.comm = new import_communicationManager.default(this);
127
+ }
128
+ // 单例模式
129
+ static getInstance(options) {
130
+ if (!_App.instance) {
131
+ _App.instance = new _App(options);
132
+ window.app = _App.instance;
133
+ }
134
+ return _App.instance;
135
+ }
136
+ // 初始化配置
137
+ setGlobalData(globalData) {
138
+ this.globalData = { ...this.globalData, ...globalData };
139
+ }
140
+ // 注册插件
141
+ usePlugin(name, plugin) {
142
+ this.plugins.set(name, plugin);
143
+ }
144
+ // 注册插件列表
145
+ usePlugins(plugins) {
146
+ plugins.forEach(({ name, plugin }) => {
147
+ this.plugins.set(name, plugin);
148
+ });
149
+ }
150
+ // 获取应用
151
+ getPlugin(name) {
152
+ return this.plugins.get(name);
153
+ }
154
+ // 获取配置
155
+ getGlobalData() {
156
+ return this.globalData;
157
+ }
158
+ install() {
159
+ this.pubsub.publish(import_const.APPEvent.APP_INSTALL, this);
160
+ }
161
+ unInstall() {
162
+ this.pubsub.publish(import_const.APPEvent.APP_UNINSTALL, this);
163
+ }
164
+ setBootstrap(bootstrap) {
165
+ this.bootstrap = bootstrap;
166
+ }
167
+ getBootstrap() {
168
+ return this.bootstrap;
169
+ }
170
+ };
171
+ var app_default = App;
@@ -0,0 +1,4 @@
1
+ export declare enum APPEvent {
2
+ APP_INSTALL = "app.install",
3
+ APP_UNINSTALL = "app.uninstall"
4
+ }
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/app/const.ts
20
+ var const_exports = {};
21
+ __export(const_exports, {
22
+ APPEvent: () => APPEvent
23
+ });
24
+ module.exports = __toCommonJS(const_exports);
25
+ var APPEvent = /* @__PURE__ */ ((APPEvent2) => {
26
+ APPEvent2["APP_INSTALL"] = `app.install`;
27
+ APPEvent2["APP_UNINSTALL"] = `app.uninstall`;
28
+ return APPEvent2;
29
+ })(APPEvent || {});
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ APPEvent
33
+ });
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import App, { AppOptions } from "./app";
3
+ declare type AppContextType = {
4
+ globalData: any;
5
+ setGlobalData: React.Dispatch<React.SetStateAction<any>>;
6
+ app: App;
7
+ };
8
+ export declare const AppProvider: React.FC<{
9
+ children: React.ReactNode;
10
+ options: AppOptions;
11
+ }>;
12
+ export declare const useApp: () => AppContextType;
13
+ export declare const getApp: typeof App.getInstance;
14
+ export default App;