@cloud-app-dev/vidc 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/.umirc.ts +2 -2
  2. package/es/Config/interface.d.ts +2 -1
  3. package/es/DomMove/demo.d.ts +2 -0
  4. package/es/DomMove/demo.js +16 -0
  5. package/es/DomMove/index.d.ts +16 -0
  6. package/es/DomMove/index.js +145 -0
  7. package/es/DomMove/utils.d.ts +8 -0
  8. package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
  9. package/es/Drawer/index.d.ts +2 -2
  10. package/es/Drawer/interface.d.ts +4 -174
  11. package/es/ErrorBoundary/index.d.ts +18 -0
  12. package/es/ErrorBoundary/index.js +84 -0
  13. package/es/List/DynamicGridList/Demo.js +40 -27
  14. package/es/List/DynamicGridList/index.d.ts +20 -29
  15. package/es/List/DynamicGridList/index.js +40 -63
  16. package/es/List/DynamicList/index.css +15 -0
  17. package/es/List/DynamicList/index.d.ts +14 -0
  18. package/es/List/DynamicList/index.js +105 -0
  19. package/es/List/DynamicList/interface.d.ts +19 -0
  20. package/es/List/DynamicList/utils.d.ts +4 -0
  21. package/es/List/DynamicList/utils.js +6 -0
  22. package/es/List/GridList/Demo.js +27 -4
  23. package/es/List/GridList/index.css +1 -0
  24. package/es/List/GridList/index.d.ts +2 -2
  25. package/es/List/GridList/index.js +8 -12
  26. package/es/List/GridList/interface.d.ts +1 -1
  27. package/es/List/VList/index.js +2 -3
  28. package/es/List/index.css +2 -54
  29. package/es/List/index.d.ts +6 -7
  30. package/es/List/index.js +14 -153
  31. package/es/List/interface.d.ts +3 -61
  32. package/es/LoaderApp/index.d.ts +1 -1
  33. package/es/LoaderApp/index.js +27 -46
  34. package/es/LoaderApp/interface.d.ts +3 -0
  35. package/es/LoaderApp/loader.d.ts +6 -7
  36. package/es/LoaderApp/loader.js +20 -30
  37. package/es/LoaderApp/sandbox.back.d.ts +18 -0
  38. package/es/LoaderApp/sandbox.back.js +356 -0
  39. package/es/LoaderApp/sandbox.d.ts +12 -0
  40. package/es/LoaderApp/sandbox.js +110 -0
  41. package/es/LoaderApp/utils.d.ts +5 -1
  42. package/es/LoaderApp/utils.js +98 -2
  43. package/es/Map/AMap.d.ts +1572 -0
  44. package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
  45. package/es/Map/BasicMap/AMapInstance.js +66 -0
  46. package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
  47. package/es/Map/BasicMap/LeafletInstance.js +98 -0
  48. package/es/Map/BasicMap/index.css +24 -0
  49. package/es/Map/BasicMap/index.d.ts +9 -0
  50. package/es/Map/BasicMap/index.js +108 -0
  51. package/es/Map/ClusterLayer/hook.d.ts +5 -0
  52. package/es/Map/ClusterLayer/hook.js +144 -0
  53. package/es/Map/ClusterLayer/index.css +26 -0
  54. package/es/Map/ClusterLayer/index.d.ts +5 -0
  55. package/es/Map/ClusterLayer/index.js +31 -0
  56. package/es/Map/ClusterLayer/props.d.ts +8 -0
  57. package/es/Map/Config/index.d.ts +7 -0
  58. package/es/{InitialConfig → Map/Config}/index.js +35 -36
  59. package/es/Map/Config/utils.d.ts +2 -0
  60. package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
  61. package/es/Map/Context/index.d.ts +11 -0
  62. package/es/Map/Context/index.js +66 -0
  63. package/es/Map/FindPio/index.css +7 -0
  64. package/es/Map/FindPio/index.d.ts +4 -0
  65. package/es/Map/FindPio/index.js +16 -0
  66. package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
  67. package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
  68. package/es/Map/InfoWindow/index.d.ts +8 -0
  69. package/es/Map/InfoWindow/index.js +74 -0
  70. package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
  71. package/es/Map/LevelCenter/DragMarker/index.js +48 -0
  72. package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
  73. package/es/Map/LevelCenter/index.d.ts +13 -0
  74. package/es/Map/LevelCenter/index.js +42 -0
  75. package/es/Map/LoaderMap/index.d.ts +12 -0
  76. package/es/Map/LoaderMap/index.js +58 -0
  77. package/es/Map/ResetTools/index.css +32 -0
  78. package/es/Map/ResetTools/index.d.ts +9 -0
  79. package/es/Map/ResetTools/index.js +61 -0
  80. package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
  81. package/es/Map/SinglePoint/Marker/index.js +29 -0
  82. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
  83. package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
  84. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
  85. package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
  86. package/es/Map/SinglePoint/index.css +29 -0
  87. package/es/Map/SinglePoint/index.d.ts +7 -0
  88. package/es/Map/SinglePoint/index.js +32 -0
  89. package/es/Map/hook/useMapType.d.ts +4 -0
  90. package/es/Map/hook/useMapType.js +13 -0
  91. package/es/Map/icon.d.ts +2 -0
  92. package/es/Map/icon.js +10 -0
  93. package/es/Map/index.d.ts +23 -0
  94. package/es/Map/index.js +25 -0
  95. package/es/Map/interface.d.ts +55 -0
  96. package/es/Map/points.json +61247 -0
  97. package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
  98. package/es/Map/useMarker/index.d.ts +11 -0
  99. package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
  100. package/es/Map/withMap/index.d.ts +2 -0
  101. package/es/Map/withMap/index.js +12 -0
  102. package/es/Picture/index.d.ts +1 -1
  103. package/es/Picture/index.js +2 -2
  104. package/es/Player/api/index.d.ts +1 -0
  105. package/es/Player/api/index.js +7 -1
  106. package/es/Player/demo.js +13 -21
  107. package/es/Player/event/index.js +5 -1
  108. package/es/Player/frontend_player.d.ts +1 -1
  109. package/es/Player/frontend_player.js +20 -13
  110. package/es/Player/frontend_timeline.d.ts +1 -1
  111. package/es/Player/live_heart.js +45 -12
  112. package/es/Player/message.js +23 -12
  113. package/es/Player/player.d.ts +31 -7
  114. package/es/Player/segment_player.d.ts +1 -1
  115. package/es/Player/segment_player.js +30 -18
  116. package/es/Player/segment_timeline.js +6 -6
  117. package/es/Player/single_player.js +50 -9
  118. package/es/Player/timeline.js +8 -6
  119. package/es/Player/util.d.ts +2 -1
  120. package/es/Player/util.js +4 -1
  121. package/es/PlayerExt/index.css +2 -2
  122. package/es/PlayerExt/index.d.ts +3 -1
  123. package/es/PlayerExt/index.js +19 -5
  124. package/es/ScreenPlayer/Live.d.ts +5 -0
  125. package/es/ScreenPlayer/Live.js +109 -0
  126. package/es/ScreenPlayer/LiveTools.d.ts +15 -0
  127. package/es/ScreenPlayer/LiveTools.js +95 -0
  128. package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
  129. package/es/ScreenPlayer/PlayerWithExt.js +169 -0
  130. package/es/ScreenPlayer/Record.d.ts +5 -0
  131. package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +290 -273
  132. package/es/ScreenPlayer/RecordTools.d.ts +17 -0
  133. package/es/ScreenPlayer/RecordTools.js +102 -0
  134. package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
  135. package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
  136. package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
  137. package/es/ScreenPlayer/TimeSlider.js +528 -0
  138. package/es/ScreenPlayer/demo.d.ts +2 -0
  139. package/es/ScreenPlayer/demo.js +25 -0
  140. package/es/ScreenPlayer/demo2.d.ts +2 -0
  141. package/es/ScreenPlayer/demo2.js +153 -0
  142. package/es/ScreenPlayer/index.css +50 -0
  143. package/es/ScreenPlayer/index.d.ts +6 -0
  144. package/es/ScreenPlayer/index.js +7 -0
  145. package/es/ScreenPlayer/interface.d.ts +81 -0
  146. package/es/ScreenPlayer/useRecordList.d.ts +3 -0
  147. package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
  148. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  149. package/es/ScreenPlayer/useVideoFit.js +46 -0
  150. package/es/ScreenPlayer/utils.d.ts +25 -0
  151. package/es/ScreenPlayer/utils.js +84 -0
  152. package/es/Tree/demo.js +9 -12
  153. package/es/Tree/index.css +55 -29
  154. package/es/Tree/index.d.ts +20 -19
  155. package/es/Tree/index.js +70 -185
  156. package/es/index.d.ts +7 -9
  157. package/es/index.js +7 -9
  158. package/es/useInfiniteScroll/index.d.ts +16 -0
  159. package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
  160. package/es/useVirtualList/index.d.ts +13 -0
  161. package/es/useVirtualList/index.js +175 -0
  162. package/es/withErrorBoundary/index.d.ts +8 -0
  163. package/es/withErrorBoundary/index.js +43 -0
  164. package/package.json +18 -21
  165. package/test.js +48 -0
  166. package/es/DeviceIcon/icon.d.ts +0 -9
  167. package/es/DeviceIcon/icon.js +0 -138
  168. package/es/DeviceIcon/index.css +0 -8
  169. package/es/DeviceIcon/index.d.ts +0 -14
  170. package/es/DeviceIcon/index.js +0 -37
  171. package/es/DeviceSelect/TreeType.d.ts +0 -7
  172. package/es/DeviceSelect/TreeType.js +0 -36
  173. package/es/DeviceSelect/demo.d.ts +0 -3
  174. package/es/DeviceSelect/demo.js +0 -22
  175. package/es/DeviceSelect/index.css +0 -11
  176. package/es/DeviceSelect/index.d.ts +0 -13
  177. package/es/DeviceSelect/index.js +0 -191
  178. package/es/Dict/cache.d.ts +0 -3
  179. package/es/Dict/cache.js +0 -21
  180. package/es/Dict/device.d.ts +0 -28
  181. package/es/Dict/device.js +0 -117
  182. package/es/Dict/hook.d.ts +0 -3
  183. package/es/Dict/hook.js +0 -98
  184. package/es/Dict/index.d.ts +0 -9
  185. package/es/Dict/index.js +0 -10
  186. package/es/Dict/interface.d.ts +0 -16
  187. package/es/Dict/utils.d.ts +0 -10
  188. package/es/Dict/utils.js +0 -44
  189. package/es/InitialConfig/index.d.ts +0 -8
  190. package/es/InitialConfig/utils.d.ts +0 -20
  191. package/es/InitialConfig/utils.js +0 -110
  192. package/es/InitialRequest/index.d.ts +0 -9
  193. package/es/InitialRequest/index.js +0 -97
  194. package/es/InitialRequest/utils.d.ts +0 -10
  195. package/es/InitialRequest/utils.js +0 -116
  196. package/es/List/CheckExt.d.ts +0 -9
  197. package/es/List/CheckExt.js +0 -36
  198. package/es/List/DeviceList/index.d.ts +0 -11
  199. package/es/List/DeviceList/index.js +0 -50
  200. package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
  201. package/es/List/DynamicDeviceList/index.css +0 -39
  202. package/es/List/DynamicDeviceList/index.d.ts +0 -12
  203. package/es/List/DynamicDeviceList/index.js +0 -205
  204. package/es/List/DynamicDeviceList/interface.d.ts +0 -37
  205. package/es/List/DynamicDeviceList/utils.d.ts +0 -16
  206. package/es/List/ListExt/index.css +0 -3
  207. package/es/List/ListExt/index.d.ts +0 -19
  208. package/es/List/ListExt/index.js +0 -44
  209. package/es/Picture/component/MoveContent/index.d.ts +0 -39
  210. package/es/Picture/component/MoveContent/index.js +0 -244
  211. package/es/Picture/component/MoveContent/utils.d.ts +0 -4
  212. package/es/Title/index.css +0 -25
  213. package/es/Title/index.d.ts +0 -12
  214. package/es/Title/index.js +0 -30
  215. package/es/Tree/BaseTree/index.css +0 -64
  216. package/es/Tree/BaseTree/index.d.ts +0 -24
  217. package/es/Tree/BaseTree/index.js +0 -83
  218. package/es/UserSelect/demo.d.ts +0 -3
  219. package/es/UserSelect/demo.js +0 -21
  220. package/es/UserSelect/index.css +0 -16
  221. package/es/UserSelect/index.d.ts +0 -18
  222. package/es/UserSelect/index.js +0 -194
  223. package/es/WorkerFlow/Demo.js +0 -57
  224. package/es/WorkerFlow/Form/Approver.d.ts +0 -10
  225. package/es/WorkerFlow/Form/Approver.js +0 -33
  226. package/es/WorkerFlow/Form/Condition.d.ts +0 -11
  227. package/es/WorkerFlow/Form/Condition.js +0 -235
  228. package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
  229. package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
  230. package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
  231. package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
  232. package/es/WorkerFlow/Form/GroupList.js +0 -44
  233. package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
  234. package/es/WorkerFlow/Form/GroupSelect.js +0 -167
  235. package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
  236. package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
  237. package/es/WorkerFlow/Form/Handle.d.ts +0 -10
  238. package/es/WorkerFlow/Form/Handle.js +0 -33
  239. package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
  240. package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
  241. package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
  242. package/es/WorkerFlow/Form/Notifier.js +0 -16
  243. package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
  244. package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
  245. package/es/WorkerFlow/Form/UserSelect.js +0 -150
  246. package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
  247. package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
  248. package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
  249. package/es/WorkerFlow/Form/UserSet.js +0 -308
  250. package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
  251. package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
  252. package/es/WorkerFlow/Form/utils.d.ts +0 -3
  253. package/es/WorkerFlow/Form/utils.js +0 -47
  254. package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
  255. package/es/WorkerFlow/Nodes/Add.js +0 -98
  256. package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
  257. package/es/WorkerFlow/Nodes/AddOption.js +0 -23
  258. package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
  259. package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
  260. package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
  261. package/es/WorkerFlow/Nodes/Approver.js +0 -53
  262. package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
  263. package/es/WorkerFlow/Nodes/Condition.js +0 -140
  264. package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
  265. package/es/WorkerFlow/Nodes/Constants.js +0 -150
  266. package/es/WorkerFlow/Nodes/End.d.ts +0 -7
  267. package/es/WorkerFlow/Nodes/End.js +0 -16
  268. package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
  269. package/es/WorkerFlow/Nodes/Handle.js +0 -52
  270. package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
  271. package/es/WorkerFlow/Nodes/Node.js +0 -26
  272. package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
  273. package/es/WorkerFlow/Nodes/Notifier.js +0 -52
  274. package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
  275. package/es/WorkerFlow/Nodes/Render.js +0 -16
  276. package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
  277. package/es/WorkerFlow/Nodes/Start.js +0 -26
  278. package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
  279. package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
  280. package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
  281. package/es/WorkerFlow/Nodes/Wrap.js +0 -35
  282. package/es/WorkerFlow/OperatorContext.d.ts +0 -4
  283. package/es/WorkerFlow/OperatorContext.js +0 -3
  284. package/es/WorkerFlow/Tools.d.ts +0 -8
  285. package/es/WorkerFlow/Tools.js +0 -78
  286. package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
  287. package/es/WorkerFlow/XML/CanvasTag.js +0 -142
  288. package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
  289. package/es/WorkerFlow/XML/EndEvent.js +0 -14
  290. package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
  291. package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
  292. package/es/WorkerFlow/XML/Root.d.ts +0 -1
  293. package/es/WorkerFlow/XML/Root.js +0 -5
  294. package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
  295. package/es/WorkerFlow/XML/StartEvent.js +0 -28
  296. package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
  297. package/es/WorkerFlow/XML/UserTask.js +0 -93
  298. package/es/WorkerFlow/XML/index.d.ts +0 -4
  299. package/es/WorkerFlow/XML/index.js +0 -100
  300. package/es/WorkerFlow/XML/utils.d.ts +0 -6
  301. package/es/WorkerFlow/XML/utils.js +0 -97
  302. package/es/WorkerFlow/data.json +0 -83
  303. package/es/WorkerFlow/index.css +0 -779
  304. package/es/WorkerFlow/index.d.ts +0 -13
  305. package/es/WorkerFlow/interface.d.ts +0 -93
  306. package/es/WorkerFlow/template.d.ts +0 -2
  307. package/es/WorkerFlow/template.js +0 -17
  308. package/es/WorkerFlow/utils.d.ts +0 -14
  309. package/es/WorkerFlow/utils.js +0 -212
  310. package/es/useHttp/index.d.ts +0 -8
@@ -0,0 +1,356 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+
15
+ 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, descriptor.key, descriptor); } }
16
+
17
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
+
19
+ /**
20
+ * @file 全局window沙盒,隔离变量环境
21
+ */
22
+ var originWindow = window;
23
+ var constructableMap = new WeakMap();
24
+
25
+ function isConstructable(fn) {
26
+ if (constructableMap.has(fn)) {
27
+ return constructableMap.get(fn);
28
+ }
29
+
30
+ var constructableFunctionRegex = /^function\b\s[A-Z].*/;
31
+ var classRegex = /^class\b/;
32
+ var constructable = fn.prototype && fn.prototype.constructor === fn && Object.getOwnPropertyNames(fn.prototype).length > 1 || constructableFunctionRegex.test(fn.toString()) || classRegex.test(fn.toString());
33
+ constructableMap.set(fn, constructable);
34
+ return constructable;
35
+ }
36
+
37
+ var naughtySafari = typeof document.all === 'function' && typeof document.all === 'undefined';
38
+ var isCallable = naughtySafari ? function (fn) {
39
+ return typeof fn === 'function' && typeof fn !== 'undefined';
40
+ } : function (fn) {
41
+ return typeof fn === 'function';
42
+ };
43
+ var boundedMap = new WeakMap();
44
+
45
+ function isBoundedFunction(fn) {
46
+ if (boundedMap.has(fn)) {
47
+ return boundedMap.get(fn);
48
+ }
49
+
50
+ var bounded = fn.name.indexOf('bound ') === 0 && !fn.hasOwnProperty('prototype');
51
+ boundedMap.set(fn, bounded);
52
+ return bounded;
53
+ }
54
+
55
+ var functionBoundedValueMap = new WeakMap();
56
+
57
+ function getTargetValue(target, value) {
58
+ var cachedBoundFunction = functionBoundedValueMap.get(value);
59
+
60
+ if (cachedBoundFunction) {
61
+ return cachedBoundFunction;
62
+ }
63
+
64
+ if (isCallable(value) && !isBoundedFunction(value) && !isConstructable(value)) {
65
+ var boundValue = Function.prototype.bind.call(value, target);
66
+
67
+ for (var key in value) {
68
+ boundValue[key] = value[key];
69
+ }
70
+
71
+ if (value.hasOwnProperty('prototype') && !boundValue.hasOwnProperty('prototype')) boundValue.prototype = value.prototype;
72
+ functionBoundedValueMap.set(value, boundValue);
73
+ return boundValue;
74
+ }
75
+
76
+ return value;
77
+ }
78
+
79
+ function getScript(scriptText) {
80
+ return '(function(window){with(window){;'.concat(scriptText, '\n').concat('}}).bind(window.proxy)(window.proxy);');
81
+ }
82
+
83
+ var rawAddEventListener = window.addEventListener;
84
+ var rawRemoveEventListener = window.removeEventListener;
85
+ var rawWindowInterval = window.setInterval;
86
+ var rawWindowClearInterval = window.clearInterval;
87
+ var rawWindowTimeout = window.setTimeout;
88
+ var rawWindowClearTimeout = window.clearTimeout;
89
+ var unscopables = {
90
+ undefined: true,
91
+ Array: true,
92
+ Object: true,
93
+ String: true,
94
+ Boolean: true,
95
+ Math: true,
96
+ Number: true,
97
+ Symbol: true,
98
+ parseFloat: true,
99
+ Float32Array: true
100
+ };
101
+
102
+ function createFakeWindow() {
103
+ var fakeWindow = {};
104
+ Object.getOwnPropertyNames(originWindow).forEach(function (key) {
105
+ var descriptor = Object.getOwnPropertyDescriptor(originWindow, key);
106
+
107
+ if (descriptor && !descriptor.configurable) {
108
+ var hasGetter = Object.prototype.hasOwnProperty.call(descriptor, 'get');
109
+
110
+ if (key === 'top' || key === 'parent' || key === 'self' || key === 'window') {
111
+ descriptor.configurable = true;
112
+
113
+ if (!hasGetter) {
114
+ descriptor.writable = true;
115
+ }
116
+ }
117
+
118
+ Object.defineProperty(fakeWindow, key, Object.freeze(descriptor));
119
+ }
120
+ });
121
+ return fakeWindow;
122
+ }
123
+
124
+ var Sandbox = /*#__PURE__*/function () {
125
+ function Sandbox(showlog) {
126
+ var _this = this;
127
+
128
+ _classCallCheck(this, Sandbox);
129
+
130
+ this.fakeWindow = createFakeWindow();
131
+ this.updateKeys = new Set();
132
+ this.listenerMap = new Map();
133
+ this.timeoutList = [];
134
+ this.intervalList = [];
135
+ this.originKeys = [];
136
+ this.showlog = false;
137
+ this.hasDisposed = false;
138
+ this.showlog = showlog;
139
+ this.proxy = new Proxy(window, {
140
+ set: function set(target, key, value) {
141
+ if (!_this.hasDisposed) {
142
+ _this.updateKeys.add(key);
143
+
144
+ try {
145
+ if (!_this.fakeWindow.hasOwnProperty(key) && target.hasOwnProperty(key)) {
146
+ // @ts-ignore
147
+ target[key] = value;
148
+ } else {
149
+ // @ts-ignore
150
+ _this.fakeWindow[key] = value;
151
+ }
152
+ } catch (error) {
153
+ console.error('set-key-error', key, error);
154
+ throw error;
155
+ }
156
+ }
157
+
158
+ return true;
159
+ },
160
+ get: function get(target, key) {
161
+ if (key === Symbol.unscopables) {
162
+ return unscopables;
163
+ } // @ts-ignore
164
+
165
+
166
+ if (key === 'window' || key === 'self' || key === 'global' || key === 'globalThis') {
167
+ return _this.proxy;
168
+ }
169
+
170
+ if (key === 'document') {
171
+ return target.document;
172
+ }
173
+
174
+ if (key === 'hasOwnProperty') {
175
+ return target.hasOwnProperty;
176
+ }
177
+
178
+ if (key === 'eval') {
179
+ return target.eval;
180
+ }
181
+
182
+ try {
183
+ console.log(key, target); // @ts-ignore
184
+
185
+ var value = key in target ? target[key] : _this.fakeWindow[key]; // @ts-ignore
186
+
187
+ if (isCallable(value) && !isBoundedFunction(value) && !isConstructable(value)) {
188
+ // @ts-ignore
189
+ // return target.matchMedia
190
+ value = Function.prototype.bind.call(value, target);
191
+ }
192
+
193
+ return getTargetValue(window, value);
194
+ } catch (error) {
195
+ console.error('get-key-error', key, error);
196
+ throw error;
197
+ }
198
+ },
199
+ has: function has(target, key) {
200
+ return key in unscopables || key in target || key in _this.fakeWindow; // return this.fakeWindow.hasOwnProperty(key)
201
+ }
202
+ }); // 事件
203
+
204
+ this.proxy.addEventListener = function (type, listener, options) {
205
+ if (!_this.hasDisposed) {
206
+ var listeners = _this.listenerMap.get(type) || [];
207
+
208
+ _this.listenerMap.set(type, [].concat(_toConsumableArray(listeners), [listener]));
209
+
210
+ return rawAddEventListener.call(window, type, listener, options);
211
+ }
212
+ };
213
+
214
+ this.proxy.removeEventListener = function (type, listener, options) {
215
+ var listeners = _this.listenerMap.get(type);
216
+
217
+ if (listeners && listeners.length) {
218
+ var listenerIndex = listeners.indexOf(listener);
219
+
220
+ if (listenerIndex !== -1) {
221
+ listeners.splice(listeners.indexOf(listener), 1);
222
+ }
223
+ }
224
+
225
+ return rawRemoveEventListener.call(window, type, listener, options);
226
+ }; // 定时器
227
+
228
+
229
+ this.proxy.setInterval = function (handler, timeout) {
230
+ if (!_this.hasDisposed) {
231
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
232
+ args[_key - 2] = arguments[_key];
233
+ }
234
+
235
+ var intervalId = rawWindowInterval.apply(void 0, [handler, timeout].concat(args));
236
+
237
+ _this.intervalList.push(intervalId);
238
+
239
+ return intervalId;
240
+ } else {
241
+ return 0;
242
+ }
243
+ };
244
+
245
+ this.proxy.clearInterval = function (intervalId) {
246
+ var intervalIndex = _this.intervalList.indexOf(intervalId);
247
+
248
+ if (intervalIndex !== -1) {
249
+ _this.intervalList.splice(intervalIndex, 1);
250
+ }
251
+
252
+ return rawWindowClearInterval(intervalId);
253
+ };
254
+
255
+ this.proxy.setTimeout = function (handler, timeout) {
256
+ if (!_this.hasDisposed) {
257
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
258
+ args[_key2 - 2] = arguments[_key2];
259
+ }
260
+
261
+ var timeoutId = rawWindowTimeout.apply(void 0, [handler, timeout].concat(args));
262
+
263
+ _this.timeoutList.push(timeoutId);
264
+
265
+ return timeoutId;
266
+ } else {
267
+ return 0;
268
+ }
269
+ };
270
+
271
+ this.proxy.clearTimeout = function (timeoutId) {
272
+ var timeoutIndex = _this.timeoutList.indexOf(timeoutId);
273
+
274
+ if (timeoutIndex !== -1) {
275
+ _this.timeoutList.splice(timeoutIndex, 1);
276
+ }
277
+
278
+ return rawWindowClearTimeout(timeoutId);
279
+ };
280
+
281
+ this.originKeys = this.showWindowKeys(); // @ts-ignore
282
+
283
+ originWindow.proxy = this.proxy;
284
+ }
285
+
286
+ _createClass(Sandbox, [{
287
+ key: "execScript",
288
+ value: function execScript(scriptText) {
289
+ if (this.hasDisposed) {
290
+ throw new Error('sandbox has been destroyed');
291
+ }
292
+
293
+ var scriptTextWithSandbox = getScript(scriptText);
294
+ originWindow.eval(scriptTextWithSandbox);
295
+ }
296
+ }, {
297
+ key: "showWindowKeys",
298
+ value: function showWindowKeys() {
299
+ var originKeys = Object.keys(originWindow);
300
+
301
+ if (this.showlog === true) {
302
+ console.log('originWindow', originWindow);
303
+ console.log('updateKeys', this.updateKeys);
304
+ console.log('windowKeysLength', originKeys.length);
305
+ }
306
+
307
+ return originKeys;
308
+ }
309
+ }, {
310
+ key: "preview",
311
+ value: function preview() {
312
+ if (this.showlog === true) {
313
+ window.console.log('updateKeys', this.updateKeys);
314
+ window.console.log('listenerMap', this.listenerMap);
315
+ window.console.log('intervalList', this.intervalList);
316
+ window.console.log('timeoutList', this.timeoutList);
317
+ }
318
+ }
319
+ }, {
320
+ key: "dispose",
321
+ value: function dispose() {
322
+ this.listenerMap.forEach(function (listeners, type) {
323
+ return _toConsumableArray(listeners).forEach(function (listener) {
324
+ return rawRemoveEventListener.call(window, type, listener);
325
+ });
326
+ });
327
+ this.listenerMap.clear();
328
+ this.intervalList.forEach(function (intervalId) {
329
+ return rawWindowClearInterval(intervalId);
330
+ });
331
+ this.intervalList = [];
332
+ this.timeoutList.forEach(function (timeoutId) {
333
+ return rawWindowClearTimeout(timeoutId);
334
+ });
335
+ this.timeoutList = [];
336
+ this.fakeWindow = createFakeWindow(); // const originKeys = this.showWindowKeys()
337
+ // const newKeys = []
338
+ // for (var i = 0; i < originKeys.length; i++) {
339
+ // if (this.originKeys.indexOf(originKeys[i]) === -1) {
340
+ // newKeys.push(originKeys)
341
+ // }
342
+ // }
343
+ // @ts-ignore
344
+ // originWindow.newKeys = newKeys
345
+ // @ts-ignore
346
+
347
+ delete originWindow.proxy;
348
+ this.hasDisposed = true;
349
+ console.log('Sandbox was successfully destroyed');
350
+ }
351
+ }]);
352
+
353
+ return Sandbox;
354
+ }();
355
+
356
+ export default Sandbox;
@@ -0,0 +1,12 @@
1
+ interface OPTIONS {
2
+ inheritGlobal?: boolean;
3
+ blacklist?: string[];
4
+ docMap?: {
5
+ [key: string]: any;
6
+ };
7
+ }
8
+ declare class SandBox {
9
+ private updatedValueSet;
10
+ constructor(context?: Window & typeof globalThis, { blacklist, docMap }?: OPTIONS);
11
+ }
12
+ export default SandBox;
@@ -0,0 +1,110 @@
1
+ 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, descriptor.key, descriptor); } }
2
+
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ // 懒加载的脚本暂时没法拦截
8
+ var SandBox = /*#__PURE__*/_createClass(function SandBox() {
9
+ var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
10
+
11
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
12
+ _ref$blacklist = _ref.blacklist,
13
+ blacklist = _ref$blacklist === void 0 ? [] : _ref$blacklist,
14
+ _ref$docMap = _ref.docMap,
15
+ docMap = _ref$docMap === void 0 ? {} : _ref$docMap;
16
+
17
+ _classCallCheck(this, SandBox);
18
+
19
+ this.updatedValueSet = new Map();
20
+ var blackmap = {};
21
+
22
+ for (var i = 0; i < blacklist.length; i++) {
23
+ var name = blacklist[i];
24
+ blackmap[name] = true;
25
+ }
26
+
27
+ var updatedValueSet = this.updatedValueSet; // const proxyDocoment = createSandBoxDocument(docMap);
28
+
29
+ var proxy = new Proxy(context, {
30
+ set: function set(target, name, value) {
31
+ if (!target[name]) {
32
+ updatedValueSet.set(name, value);
33
+ } else {
34
+ target[name] = value;
35
+ }
36
+
37
+ return true;
38
+ },
39
+ get: function get(target, name) {
40
+ if (blackmap.hasOwnProperty(name)) {
41
+ console.error("Can't assess property: ".concat(name, " in blacklist"));
42
+ return undefined;
43
+ }
44
+
45
+ if (updatedValueSet.has(name)) {
46
+ return updatedValueSet.get(name);
47
+ } // if (
48
+ // name === 'Object' ||
49
+ // name === 'Symbol' ||
50
+ // typeof name === 'symbol' ||
51
+ // name === 'parseFloat' ||
52
+ // name === 'parseInt' ||
53
+ // name === 'Array' ||
54
+ // name === 'Number' ||
55
+ // name === 'Math' ||
56
+ // name === 'String'||
57
+ // name === 'Reflect'||
58
+ // name === 'Boolean'||
59
+ // name === 'isNaN'
60
+ // ) {
61
+ // } else {
62
+ // console.log(name);
63
+ // }
64
+
65
+
66
+ switch (name) {
67
+ case 'window':
68
+ case 'global':
69
+ case 'self':
70
+ case 'globalThis':
71
+ return proxy;
72
+
73
+ case 'document':
74
+ return document;
75
+ // return proxyDocoment;
76
+ }
77
+
78
+ if (typeof target[name] === 'function' && /^[a-z]/.test(name)) {
79
+ return target[name].bind && target[name].bind(target);
80
+ } else {
81
+ return target[name];
82
+ }
83
+ }
84
+ });
85
+ return proxy;
86
+ }); // function createSandBoxDocument(proxyMap: { [key: string]: any } = {}) {
87
+ // return new Proxy(document, {
88
+ // get(target: any, p: string): any {
89
+ // if (proxyMap.hasOwnProperty(p)) {
90
+ // return proxyMap[p];
91
+ // }
92
+ // if (typeof target[p] === 'function' && /^[a-z]/.test(p)) {
93
+ // return target[p].bind && target[p].bind(target);
94
+ // } else {
95
+ // return target[p];
96
+ // }
97
+ // },
98
+ // });
99
+ // }
100
+ // function text() {
101
+ // (function (global: any) {
102
+ // const s = global.document.createElement('span');
103
+ // s.innerHTML = '1111';
104
+ // console.log(global.document.head.appendChild(s));
105
+ // })(new SandBox(window, { docMap: { head: document.body } }));
106
+ // }
107
+ // text();
108
+
109
+
110
+ export default SandBox;
@@ -1,4 +1,4 @@
1
- import { AppItemType } from '../Config/interface';
1
+ import { AppItemType } from '@cloud-app-dev/vidc/es/Config/interface';
2
2
  export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, container: HTMLDivElement) => {
3
3
  title: string;
4
4
  routerPrefix: string;
@@ -13,3 +13,7 @@ export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, con
13
13
  export declare function fetchStyle(style: string): Promise<string>;
14
14
  export declare const arrayify: <T>(list: CSSRuleList | any[]) => T[];
15
15
  export declare function rewrite(rules: CSSRule[], prefix?: string): string;
16
+ export declare function importHTML(url: string): Promise<{
17
+ cssTexts: string[];
18
+ appInstance: any;
19
+ }>;
@@ -155,11 +155,107 @@ function ruleStyle(rule, prefix) {
155
155
  function ruleMedia(rule, prefix) {
156
156
  var css = rewrite(arrayify(rule.cssRules), prefix);
157
157
  return "@media ".concat(rule.conditionText, " {").concat(css, "}");
158
- } // handle case:
159
- // @supports (display: grid) {}
158
+ }
160
159
 
160
+ var _global = window; // handle case:
161
+ // @supports (display: grid) {}
161
162
 
162
163
  function ruleSupport(rule, prefix) {
163
164
  var css = rewrite(arrayify(rule.cssRules), prefix);
164
165
  return "@supports ".concat(rule.conditionText, " {").concat(css, "}");
166
+ }
167
+
168
+ var cache = {};
169
+ export function importHTML(url) {
170
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
171
+ var html, doc, scripts, srcs, entryIndex, index, entry, appInstance, res, links, cssHref, cssTexts, styles;
172
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
173
+ while (1) {
174
+ switch (_context2.prev = _context2.next) {
175
+ case 0:
176
+ if (!cache[url]) {
177
+ _context2.next = 4;
178
+ break;
179
+ }
180
+
181
+ _context2.t0 = cache[url];
182
+ _context2.next = 7;
183
+ break;
184
+
185
+ case 4:
186
+ _context2.next = 6;
187
+ return fetch(url).then(function (res) {
188
+ return res.text();
189
+ });
190
+
191
+ case 6:
192
+ _context2.t0 = _context2.sent;
193
+
194
+ case 7:
195
+ html = _context2.t0;
196
+
197
+ if (!cache[url]) {
198
+ cache[url] = html;
199
+ }
200
+
201
+ doc = new DOMParser().parseFromString(html, 'text/html');
202
+ scripts = Array.from(doc.querySelectorAll('script')).filter(function (v) {
203
+ return v.attributes.getNamedItem('src');
204
+ });
205
+ srcs = scripts.map(function (v) {
206
+ return v.getAttribute('src');
207
+ });
208
+ entryIndex = scripts.findIndex(function (v) {
209
+ return v.attributes.getNamedItem('entry');
210
+ });
211
+ index = entryIndex === -1 ? 0 : entryIndex;
212
+ entry = scripts[index];
213
+
214
+ if (entry) {
215
+ _context2.next = 17;
216
+ break;
217
+ }
218
+
219
+ throw new Error('微应用没有入口脚本!');
220
+
221
+ case 17:
222
+ _context2.next = 19;
223
+ return Promise.all(srcs.map(function (v) {
224
+ return _global.System.import(v);
225
+ }));
226
+
227
+ case 19:
228
+ res = _context2.sent;
229
+ appInstance = res[index]; // 处理样式 link
230
+
231
+ links = Array.from(doc.querySelectorAll('link')).filter(function (v) {
232
+ return v.getAttribute('rel') === 'stylesheet';
233
+ });
234
+ cssHref = links.map(function (v) {
235
+ return v.getAttribute('href');
236
+ });
237
+ _context2.next = 25;
238
+ return Promise.all(cssHref.map(function (v) {
239
+ return fetchStyle(v);
240
+ }));
241
+
242
+ case 25:
243
+ cssTexts = _context2.sent;
244
+ // 处理样式style
245
+ styles = Array.from(doc.querySelectorAll('style'));
246
+ styles.forEach(function (style) {
247
+ return cssTexts.push(style.textContent || '');
248
+ });
249
+ return _context2.abrupt("return", {
250
+ cssTexts: cssTexts,
251
+ appInstance: appInstance
252
+ });
253
+
254
+ case 29:
255
+ case "end":
256
+ return _context2.stop();
257
+ }
258
+ }
259
+ }, _callee2);
260
+ }));
165
261
  }