@cloud-app-dev/vidc 4.0.17 → 4.1.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 (299) hide show
  1. package/.dumirc.ts +1 -1
  2. package/.eslintrc.js +3 -0
  3. package/.fatherrc.ts +0 -6
  4. package/es/AppContext/Sync.d.ts +7 -0
  5. package/es/AppContext/Sync.js +44 -0
  6. package/es/AppContext/index.d.ts +17 -0
  7. package/es/AppContext/index.js +154 -0
  8. package/es/AppContext/interface.d.ts +42 -0
  9. package/es/AppContext/static.d.ts +8 -0
  10. package/es/AppContext/static.js +9 -0
  11. package/es/CheckGroupFixed/demo.d.ts +2 -0
  12. package/es/CheckGroupFixed/demo.js +20 -0
  13. package/es/CheckGroupFixed/index.d.ts +22 -0
  14. package/es/CheckGroupFixed/index.js +150 -0
  15. package/es/CheckGroupFixed/style.d.ts +6 -0
  16. package/es/CheckGroupFixed/style.js +9 -0
  17. package/es/Config/index.d.ts +4 -0
  18. package/es/Config/index.js +77 -0
  19. package/es/Config/interface.d.ts +65 -0
  20. package/es/Config/utils.d.ts +4 -0
  21. package/es/Config/utils.js +33 -0
  22. package/es/CustomRenderSelect/index.d.ts +13 -0
  23. package/es/CustomRenderSelect/index.js +86 -0
  24. package/es/DBTools/index.d.ts +25 -0
  25. package/es/DBTools/index.js +336 -0
  26. package/es/DisableMark/index.d.ts +8 -0
  27. package/es/DisableMark/index.js +25 -0
  28. package/es/DomMove/demo.d.ts +1 -0
  29. package/es/DomMove/demo.js +19 -0
  30. package/es/DomMove/index.d.ts +16 -0
  31. package/es/DomMove/index.js +148 -0
  32. package/es/DomMove/utils.d.ts +8 -0
  33. package/es/DomMove/utils.js +33 -0
  34. package/es/Drag/DragAndDropItem.d.ts +4 -0
  35. package/es/Drag/DragAndDropItem.js +133 -0
  36. package/es/Drag/DropItem.d.ts +4 -0
  37. package/es/Drag/DropItem.js +50 -0
  38. package/es/Drag/index.d.ts +7 -0
  39. package/es/Drag/index.js +7 -0
  40. package/es/Drag/interface.d.ts +16 -0
  41. package/es/DynamicGridList/demo.d.ts +2 -0
  42. package/es/DynamicGridList/demo.js +86 -0
  43. package/es/DynamicGridList/index.d.ts +27 -0
  44. package/es/DynamicGridList/index.js +71 -0
  45. package/es/DynamicList/demo.d.ts +1 -0
  46. package/es/DynamicList/demo.js +45 -0
  47. package/es/DynamicList/index.d.ts +30 -0
  48. package/es/DynamicList/index.js +98 -0
  49. package/es/DynamicList/interface.d.ts +19 -0
  50. package/es/DynamicList/utils.d.ts +4 -0
  51. package/es/DynamicList/utils.js +6 -0
  52. package/es/ErrorFallback/index.d.ts +8 -0
  53. package/es/ErrorFallback/index.js +38 -0
  54. package/es/ErrorFallback/inerface.d.ts +48 -0
  55. package/es/EventTools/index.d.ts +3 -0
  56. package/es/EventTools/index.js +12 -0
  57. package/es/FrontendPlayer/index.d.ts +4 -0
  58. package/es/FrontendPlayer/index.js +2 -0
  59. package/es/GridList/data.d.ts +16 -0
  60. package/es/GridList/data.js +609 -0
  61. package/es/GridList/demo.d.ts +2 -0
  62. package/es/GridList/demo.js +89 -0
  63. package/es/GridList/hook.d.ts +13 -0
  64. package/es/GridList/hook.js +270 -0
  65. package/es/GridList/index.d.ts +14 -0
  66. package/es/GridList/index.js +51 -0
  67. package/es/GridList/interface.d.ts +59 -0
  68. package/es/GridList/utils.d.ts +9 -0
  69. package/es/GridList/utils.js +42 -0
  70. package/es/HightLevel/index.d.ts +8 -0
  71. package/es/HightLevel/index.js +20 -0
  72. package/es/IconFont/index.d.ts +12 -0
  73. package/es/IconFont/index.js +63 -0
  74. package/es/InstanceHistory/index.d.ts +3 -0
  75. package/es/InstanceHistory/index.js +7 -0
  76. package/es/LabelValue/index.d.ts +14 -0
  77. package/es/LabelValue/index.js +35 -0
  78. package/es/List/demo.d.ts +2 -0
  79. package/es/List/demo.js +25 -0
  80. package/es/List/index.d.ts +27 -0
  81. package/es/List/index.js +38 -0
  82. package/es/ListWithSizeAnimate/demo.d.ts +1 -0
  83. package/es/ListWithSizeAnimate/demo.js +128 -0
  84. package/es/ListWithSizeAnimate/index.d.ts +13 -0
  85. package/es/ListWithSizeAnimate/index.js +106 -0
  86. package/es/LoaderScript/index.d.ts +47 -0
  87. package/es/LoaderScript/index.js +38 -0
  88. package/es/LoaderScript/utils.d.ts +13 -0
  89. package/es/LoaderScript/utils.js +179 -0
  90. package/es/Picture/component/DefaultRects/RectInfo.d.ts +7 -0
  91. package/es/Picture/component/DefaultRects/RectInfo.js +90 -0
  92. package/es/Picture/component/DefaultRects/index.d.ts +11 -0
  93. package/es/Picture/component/DefaultRects/index.js +58 -0
  94. package/es/Picture/component/DefaultRects/style.d.ts +10 -0
  95. package/es/Picture/component/DefaultRects/style.js +28 -0
  96. package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
  97. package/es/Picture/component/DefaultRects/utils.js +11 -0
  98. package/es/Picture/component/DrawRect/index.d.ts +11 -0
  99. package/es/Picture/component/DrawRect/index.js +54 -0
  100. package/es/Picture/component/RectMenu/index.d.ts +10 -0
  101. package/es/Picture/component/RectMenu/index.js +84 -0
  102. package/es/Picture/component/RectMenu/utils.d.ts +12 -0
  103. package/es/Picture/component/RectMenu/utils.js +19 -0
  104. package/es/Picture/component/Tools/index.d.ts +11 -0
  105. package/es/Picture/component/Tools/index.js +105 -0
  106. package/es/Picture/component/Tools/style.d.ts +2 -0
  107. package/es/Picture/component/Tools/style.js +5 -0
  108. package/es/Picture/component/WheelScale/index.d.ts +6 -0
  109. package/es/Picture/component/WheelScale/index.js +29 -0
  110. package/es/Picture/demo.d.ts +1 -0
  111. package/es/Picture/demo.js +114 -0
  112. package/es/Picture/index.d.ts +17 -0
  113. package/es/Picture/index.js +356 -0
  114. package/es/Picture/interface.d.ts +196 -0
  115. package/es/Picture/loadCaptureRectImage.d.ts +3 -0
  116. package/es/Picture/loadCaptureRectImage.js +99 -0
  117. package/es/Picture/useDraw.d.ts +1 -0
  118. package/es/Picture/useDraw.js +103 -0
  119. package/es/Picture/utils.d.ts +26 -0
  120. package/es/Picture/utils.js +143 -0
  121. package/es/Player/api/index.d.ts +68 -0
  122. package/es/Player/api/index.js +309 -0
  123. package/es/Player/context.d.ts +21 -0
  124. package/es/Player/context.js +25 -0
  125. package/es/Player/contraller_bar/bar.d.ts +8 -0
  126. package/es/Player/contraller_bar/bar.js +32 -0
  127. package/es/Player/contraller_bar/contraller_event.d.ts +6 -0
  128. package/es/Player/contraller_bar/contraller_event.js +52 -0
  129. package/es/Player/contraller_bar/index.d.ts +13 -0
  130. package/es/Player/contraller_bar/index.js +39 -0
  131. package/es/Player/contraller_bar/left_bar.d.ts +10 -0
  132. package/es/Player/contraller_bar/left_bar.js +97 -0
  133. package/es/Player/contraller_bar/right_bar.d.ts +8 -0
  134. package/es/Player/contraller_bar/right_bar.js +36 -0
  135. package/es/Player/contraller_bar/time.d.ts +2 -0
  136. package/es/Player/contraller_bar/time.js +24 -0
  137. package/es/Player/contraller_bar/useBarStatus.d.ts +2 -0
  138. package/es/Player/contraller_bar/useBarStatus.js +43 -0
  139. package/es/Player/contraller_bar/volume.d.ts +8 -0
  140. package/es/Player/contraller_bar/volume.js +70 -0
  141. package/es/Player/demo.d.ts +2 -0
  142. package/es/Player/demo.js +289 -0
  143. package/es/Player/empty.d.ts +1 -0
  144. package/es/Player/empty.js +5 -0
  145. package/es/Player/event/errorEvent.d.ts +14 -0
  146. package/es/Player/event/errorEvent.js +88 -0
  147. package/es/Player/event/eventName.d.ts +18 -0
  148. package/es/Player/event/eventName.js +30 -0
  149. package/es/Player/event/index.d.ts +24 -0
  150. package/es/Player/event/index.js +205 -0
  151. package/es/Player/fps_play.d.ts +10 -0
  152. package/es/Player/fps_play.js +88 -0
  153. package/es/Player/frontend_player.d.ts +7 -0
  154. package/es/Player/frontend_player.js +71 -0
  155. package/es/Player/frontend_timeline.d.ts +8 -0
  156. package/es/Player/frontend_timeline.js +153 -0
  157. package/es/Player/iconfont.d.ts +4 -0
  158. package/es/Player/iconfont.js +21 -0
  159. package/es/Player/index.d.ts +2 -0
  160. package/es/Player/index.js +2 -0
  161. package/es/Player/live_heart.d.ts +8 -0
  162. package/es/Player/live_heart.js +45 -0
  163. package/es/Player/message.d.ts +3 -0
  164. package/es/Player/message.js +147 -0
  165. package/es/Player/player.d.ts +233 -0
  166. package/es/Player/segment_player.d.ts +8 -0
  167. package/es/Player/segment_player.js +229 -0
  168. package/es/Player/segment_timeline.d.ts +10 -0
  169. package/es/Player/segment_timeline.js +200 -0
  170. package/es/Player/single_player.d.ts +4 -0
  171. package/es/Player/single_player.js +278 -0
  172. package/es/Player/style/iconfont.js +43 -0
  173. package/es/Player/timeline.d.ts +7 -0
  174. package/es/Player/timeline.js +104 -0
  175. package/es/Player/util.d.ts +43 -0
  176. package/es/Player/util.js +189 -0
  177. package/es/PlayerExt/demo.d.ts +2 -0
  178. package/es/PlayerExt/demo.js +170 -0
  179. package/es/PlayerExt/index.d.ts +47 -0
  180. package/es/PlayerExt/index.js +212 -0
  181. package/es/Progress/index.d.ts +10 -0
  182. package/es/Progress/index.js +60 -0
  183. package/es/ROI/demo.d.ts +2 -0
  184. package/es/ROI/demo.js +17 -0
  185. package/es/ROI/index.d.ts +32 -0
  186. package/es/ROI/index.js +67 -0
  187. package/es/RefDrawer/Footer.d.ts +9 -0
  188. package/es/RefDrawer/Footer.js +27 -0
  189. package/es/RefDrawer/demo.d.ts +3 -0
  190. package/es/RefDrawer/demo.js +32 -0
  191. package/es/RefDrawer/index.d.ts +26 -0
  192. package/es/RefDrawer/index.js +73 -0
  193. package/es/RefModal/demo.d.ts +2 -0
  194. package/es/RefModal/demo.js +32 -0
  195. package/es/RefModal/index.d.ts +17 -0
  196. package/es/RefModal/index.js +71 -0
  197. package/es/ScreenPlayer/Live.d.ts +8 -0
  198. package/es/ScreenPlayer/Live.js +219 -0
  199. package/es/ScreenPlayer/LiveTools.d.ts +33 -0
  200. package/es/ScreenPlayer/LiveTools.js +172 -0
  201. package/es/ScreenPlayer/PlayerWithExt.d.ts +34 -0
  202. package/es/ScreenPlayer/PlayerWithExt.js +241 -0
  203. package/es/ScreenPlayer/RatePick.d.ts +7 -0
  204. package/es/ScreenPlayer/RatePick.js +35 -0
  205. package/es/ScreenPlayer/Record.d.ts +8 -0
  206. package/es/ScreenPlayer/Record.js +452 -0
  207. package/es/ScreenPlayer/RecordTools.d.ts +38 -0
  208. package/es/ScreenPlayer/RecordTools.js +214 -0
  209. package/es/ScreenPlayer/ScreenSelect.d.ts +6 -0
  210. package/es/ScreenPlayer/ScreenSelect.js +59 -0
  211. package/es/ScreenPlayer/SegmentTimeLine.d.ts +16 -0
  212. package/es/ScreenPlayer/SegmentTimeLine.js +44 -0
  213. package/es/ScreenPlayer/TimeMode.d.ts +6 -0
  214. package/es/ScreenPlayer/TimeMode.js +34 -0
  215. package/es/ScreenPlayer/TimeSelect.d.ts +6 -0
  216. package/es/ScreenPlayer/TimeSelect.js +99 -0
  217. package/es/ScreenPlayer/containerStyle.d.ts +13 -0
  218. package/es/ScreenPlayer/containerStyle.js +32 -0
  219. package/es/ScreenPlayer/demo.d.ts +1 -0
  220. package/es/ScreenPlayer/demo.js +19 -0
  221. package/es/ScreenPlayer/demo2.d.ts +1 -0
  222. package/es/ScreenPlayer/demo2.js +196 -0
  223. package/es/ScreenPlayer/index.d.ts +6 -0
  224. package/es/ScreenPlayer/index.js +9 -0
  225. package/es/ScreenPlayer/interface.d.ts +216 -0
  226. package/es/ScreenPlayer/useTimeSlider.d.ts +25 -0
  227. package/es/ScreenPlayer/useTimeSlider.js +451 -0
  228. package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
  229. package/es/ScreenPlayer/useVideoFit.js +35 -0
  230. package/es/ScreenPlayer/utils.d.ts +17 -0
  231. package/es/ScreenPlayer/utils.js +85 -0
  232. package/es/SegmentPlayer/index.d.ts +2 -0
  233. package/es/SegmentPlayer/index.js +2 -0
  234. package/es/Service/http.d.ts +6 -0
  235. package/es/Service/http.js +125 -0
  236. package/es/Service/index.d.ts +3 -0
  237. package/es/Service/index.js +10 -0
  238. package/es/Service/interface.d.ts +22 -0
  239. package/es/Service/middleware.d.ts +5 -0
  240. package/es/Service/middleware.js +15 -0
  241. package/es/SocketEmitter/eventEmitter.d.ts +27 -0
  242. package/es/SocketEmitter/eventEmitter.js +88 -0
  243. package/es/SocketEmitter/index.d.ts +24 -0
  244. package/es/SocketEmitter/index.js +125 -0
  245. package/es/SocketEmitter/interface.d.ts +4 -0
  246. package/es/TableLayout/index.d.ts +9 -0
  247. package/es/TableLayout/index.js +32 -0
  248. package/es/Timeout/index.d.ts +31 -0
  249. package/es/Timeout/index.js +69 -0
  250. package/es/cache/index.d.ts +34 -0
  251. package/es/cache/index.js +94 -0
  252. package/es/copy/index.d.ts +1 -0
  253. package/es/copy/index.js +9 -0
  254. package/es/core.d.ts +0 -0
  255. package/es/getThemeStyle/index.d.ts +2 -0
  256. package/es/getThemeStyle/index.js +5 -0
  257. package/es/index.d.ts +52 -0
  258. package/es/index.js +52 -0
  259. package/es/likeGo/index.d.ts +2 -0
  260. package/es/likeGo/index.js +31 -0
  261. package/es/likeGoSync/index.d.ts +2 -0
  262. package/es/likeGoSync/index.js +10 -0
  263. package/es/logger/index.d.ts +7 -0
  264. package/es/logger/index.js +30 -0
  265. package/es/nextTick/index.d.ts +1 -0
  266. package/es/nextTick/index.js +3 -0
  267. package/es/recorder/demo.d.ts +2 -0
  268. package/es/recorder/demo.js +200 -0
  269. package/es/recorder/index.d.ts +294 -0
  270. package/es/recorder/index.js +991 -0
  271. package/es/submidstr/index.d.ts +5 -0
  272. package/es/submidstr/index.js +14 -0
  273. package/es/treeHelper/index.d.ts +11 -0
  274. package/es/treeHelper/index.js +189 -0
  275. package/es/typings.d.ts +2 -0
  276. package/es/useDrawROI/index.d.ts +16 -0
  277. package/es/useDrawROI/index.js +318 -0
  278. package/es/useEventEmitterHandle/index.d.ts +2 -0
  279. package/es/useEventEmitterHandle/index.js +17 -0
  280. package/es/useHistory/index.d.ts +3 -0
  281. package/es/useHistory/index.js +9 -0
  282. package/es/useHistory/interface.d.ts +3 -0
  283. package/es/useInfiniteScroll/index.d.ts +16 -0
  284. package/es/useInfiniteScroll/index.js +102 -0
  285. package/es/useRafInterval/index.d.ts +5 -0
  286. package/es/useRafInterval/index.js +70 -0
  287. package/es/useSimpleState/index.d.ts +3 -0
  288. package/es/useSimpleState/index.js +35 -0
  289. package/es/useVirtualList/index.d.ts +13 -0
  290. package/es/useVirtualList/index.js +136 -0
  291. package/es/utils.d.ts +14 -0
  292. package/es/utils.js +46 -0
  293. package/es/uuid/index.d.ts +5 -0
  294. package/es/uuid/index.js +6 -0
  295. package/package.json +16 -21
  296. package/release-build.sh +2 -0
  297. package/scripts/{entry.js → entry.mjs} +4 -6
  298. package/{icon-fix.js → scripts/icon-fix.mjs} +4 -3
  299. package/tsconfig.json +1 -1
@@ -0,0 +1,94 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ 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); }
4
+ 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; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import Cookie from 'js-cookie';
8
+ import likeGoSync from "../likeGoSync";
9
+ /**
10
+ * 获取缓存数据
11
+ * @param {string} key
12
+ * @param {string} type: 缓存类型 'local'(默认) / cookie / session;
13
+ */
14
+ function getCache(key) {
15
+ var _Cookie$get, _sessionStorage$getIt, _localStorage$getItem;
16
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'local';
17
+ var str;
18
+ switch (type) {
19
+ case 'cookie':
20
+ str = (_Cookie$get = Cookie.get(key)) !== null && _Cookie$get !== void 0 ? _Cookie$get : '';
21
+ break;
22
+ case 'session':
23
+ str = (_sessionStorage$getIt = sessionStorage.getItem(key)) !== null && _sessionStorage$getIt !== void 0 ? _sessionStorage$getIt : '';
24
+ break;
25
+ default:
26
+ str = (_localStorage$getItem = localStorage.getItem(key)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '';
27
+ }
28
+ var _likeGoSync = likeGoSync(function () {
29
+ return JSON.parse(str);
30
+ }),
31
+ _likeGoSync2 = _slicedToArray(_likeGoSync, 2),
32
+ res = _likeGoSync2[0],
33
+ err = _likeGoSync2[1];
34
+ return err ? str : res;
35
+ }
36
+
37
+ /**
38
+ * 获取缓存数据
39
+ * @param {string} key
40
+ * @param {any} value
41
+ * @param {string} type: 缓存类型 'local'(默认) / cookie / session;
42
+ */
43
+ function setCache(key, value) {
44
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
45
+ switch (type) {
46
+ case 'cookie':
47
+ Cookie.set(key, value, {
48
+ expires: 7
49
+ });
50
+ break;
51
+ case 'session':
52
+ sessionStorage.setItem(key, JSON.stringify(value));
53
+ break;
54
+ default:
55
+ localStorage.setItem(key, JSON.stringify(value));
56
+ }
57
+ }
58
+
59
+ /**
60
+ * 获取用户缓存
61
+ * @param {*} key
62
+ * @param {*} type
63
+ */
64
+ function getUserCache(key) {
65
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'local';
66
+ var id = getCache('userId', 'session');
67
+ if (!id) {
68
+ console.error('无法获取用户信息!,缓存获取失败!');
69
+ return;
70
+ }
71
+ return getCache("".concat(id, "-").concat(key), type);
72
+ }
73
+
74
+ /**
75
+ * 设置用户缓存
76
+ * @param {*} key
77
+ * @param {*} value
78
+ * @param {*} type
79
+ */
80
+ function setUserCache(key, value) {
81
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
82
+ var id = getCache('userId', 'session');
83
+ if (!id) {
84
+ console.error('无法获取用户信息!,缓存设置失败!');
85
+ return;
86
+ }
87
+ return setCache("".concat(id, "-").concat(key), value, type);
88
+ }
89
+ export default {
90
+ getCache: getCache,
91
+ setCache: setCache,
92
+ getUserCache: getUserCache,
93
+ setUserCache: setUserCache
94
+ };
@@ -0,0 +1 @@
1
+ export default function copy(text: string): void;
@@ -0,0 +1,9 @@
1
+ export default function copy(text) {
2
+ var input = document.createElement('input');
3
+ input.type = 'text';
4
+ input.value = text;
5
+ document.body.appendChild(input);
6
+ input.select();
7
+ document.execCommand('copy');
8
+ input.remove();
9
+ }
package/es/core.d.ts ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ declare function getThemeStyle(name: string, ele?: Element): string | undefined;
2
+ export default getThemeStyle;
@@ -0,0 +1,5 @@
1
+ function getThemeStyle(name, ele) {
2
+ var dom = ele || document.querySelector(':root');
3
+ return getComputedStyle(dom).getPropertyValue("--".concat(name));
4
+ }
5
+ export default getThemeStyle;
package/es/index.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ export { default as AppContext } from './AppContext';
2
+ export { default as CheckGroupFixed } from './CheckGroupFixed';
3
+ export { default as Config } from './Config';
4
+ export { default as CustomRenderSelect } from './CustomRenderSelect';
5
+ export { default as DBTools } from './DBTools';
6
+ export { default as DisableMark } from './DisableMark';
7
+ export { default as DomMove } from './DomMove';
8
+ export { default as Drag } from './Drag';
9
+ export { default as DynamicGridList } from './DynamicGridList';
10
+ export { default as DynamicList } from './DynamicList';
11
+ export { default as ErrorFallback } from './ErrorFallback';
12
+ export { default as EventTools } from './EventTools';
13
+ export { default as FrontendPlayer } from './FrontendPlayer';
14
+ export { default as GridList } from './GridList';
15
+ export { default as HightLevel } from './HightLevel';
16
+ export { default as IconFont } from './IconFont';
17
+ export { default as InstanceHistory } from './InstanceHistory';
18
+ export { default as LabelValue } from './LabelValue';
19
+ export { default as List } from './List';
20
+ export { default as ListWithSizeAnimate } from './ListWithSizeAnimate';
21
+ export { default as LoaderScript } from './LoaderScript';
22
+ export { default as Picture } from './Picture';
23
+ export { default as Player } from './Player';
24
+ export { default as PlayerExt } from './PlayerExt';
25
+ export { default as Progress } from './Progress';
26
+ export { default as ROI } from './ROI';
27
+ export { default as RefDrawer } from './RefDrawer';
28
+ export { default as RefModal } from './RefModal';
29
+ export { default as ScreenPlayer } from './ScreenPlayer';
30
+ export { default as SegmentPlayer } from './SegmentPlayer';
31
+ export { default as Service } from './Service';
32
+ export { default as SocketEmitter } from './SocketEmitter';
33
+ export { default as TableLayout } from './TableLayout';
34
+ export { default as Timeout } from './Timeout';
35
+ export { default as cache } from './cache';
36
+ export { default as copy } from './copy';
37
+ export { default as getThemeStyle } from './getThemeStyle';
38
+ export { default as likeGo } from './likeGo';
39
+ export { default as likeGoSync } from './likeGoSync';
40
+ export { default as logger } from './logger';
41
+ export { default as nextTick } from './nextTick';
42
+ export { default as recorder } from './recorder';
43
+ export { default as submidstr } from './submidstr';
44
+ export { default as treeHelper } from './treeHelper';
45
+ export { default as useDrawROI } from './useDrawROI';
46
+ export { default as useEventEmitterHandle } from './useEventEmitterHandle';
47
+ export { default as useHistory } from './useHistory';
48
+ export { default as useInfiniteScroll } from './useInfiniteScroll';
49
+ export { default as useRafInterval } from './useRafInterval';
50
+ export { default as useSimpleState } from './useSimpleState';
51
+ export { default as useVirtualList } from './useVirtualList';
52
+ export { default as uuid } from './uuid';
package/es/index.js ADDED
@@ -0,0 +1,52 @@
1
+ export { default as AppContext } from "./AppContext";
2
+ export { default as CheckGroupFixed } from "./CheckGroupFixed";
3
+ export { default as Config } from "./Config";
4
+ export { default as CustomRenderSelect } from "./CustomRenderSelect";
5
+ export { default as DBTools } from "./DBTools";
6
+ export { default as DisableMark } from "./DisableMark";
7
+ export { default as DomMove } from "./DomMove";
8
+ export { default as Drag } from "./Drag";
9
+ export { default as DynamicGridList } from "./DynamicGridList";
10
+ export { default as DynamicList } from "./DynamicList";
11
+ export { default as ErrorFallback } from "./ErrorFallback";
12
+ export { default as EventTools } from "./EventTools";
13
+ export { default as FrontendPlayer } from "./FrontendPlayer";
14
+ export { default as GridList } from "./GridList";
15
+ export { default as HightLevel } from "./HightLevel";
16
+ export { default as IconFont } from "./IconFont";
17
+ export { default as InstanceHistory } from "./InstanceHistory";
18
+ export { default as LabelValue } from "./LabelValue";
19
+ export { default as List } from "./List";
20
+ export { default as ListWithSizeAnimate } from "./ListWithSizeAnimate";
21
+ export { default as LoaderScript } from "./LoaderScript";
22
+ export { default as Picture } from "./Picture";
23
+ export { default as Player } from "./Player";
24
+ export { default as PlayerExt } from "./PlayerExt";
25
+ export { default as Progress } from "./Progress";
26
+ export { default as ROI } from "./ROI";
27
+ export { default as RefDrawer } from "./RefDrawer";
28
+ export { default as RefModal } from "./RefModal";
29
+ export { default as ScreenPlayer } from "./ScreenPlayer";
30
+ export { default as SegmentPlayer } from "./SegmentPlayer";
31
+ export { default as Service } from "./Service";
32
+ export { default as SocketEmitter } from "./SocketEmitter";
33
+ export { default as TableLayout } from "./TableLayout";
34
+ export { default as Timeout } from "./Timeout";
35
+ export { default as cache } from "./cache";
36
+ export { default as copy } from "./copy";
37
+ export { default as getThemeStyle } from "./getThemeStyle";
38
+ export { default as likeGo } from "./likeGo";
39
+ export { default as likeGoSync } from "./likeGoSync";
40
+ export { default as logger } from "./logger";
41
+ export { default as nextTick } from "./nextTick";
42
+ export { default as recorder } from "./recorder";
43
+ export { default as submidstr } from "./submidstr";
44
+ export { default as treeHelper } from "./treeHelper";
45
+ export { default as useDrawROI } from "./useDrawROI";
46
+ export { default as useEventEmitterHandle } from "./useEventEmitterHandle";
47
+ export { default as useHistory } from "./useHistory";
48
+ export { default as useInfiniteScroll } from "./useInfiniteScroll";
49
+ export { default as useRafInterval } from "./useRafInterval";
50
+ export { default as useSimpleState } from "./useSimpleState";
51
+ export { default as useVirtualList } from "./useVirtualList";
52
+ export { default as uuid } from "./uuid";
@@ -0,0 +1,2 @@
1
+ declare function likeGo<T, S>(fn: () => Promise<T>): Promise<[T, S]>;
2
+ export default likeGo;
@@ -0,0 +1,31 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
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 likeGo(_x) {
6
+ return _likeGo.apply(this, arguments);
7
+ }
8
+ function _likeGo() {
9
+ _likeGo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fn) {
10
+ var result;
11
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12
+ while (1) switch (_context.prev = _context.next) {
13
+ case 0:
14
+ result = [];
15
+ _context.next = 3;
16
+ return fn().then(function (res) {
17
+ result[0] = res;
18
+ }).catch(function (err) {
19
+ result[1] = err;
20
+ });
21
+ case 3:
22
+ return _context.abrupt("return", result);
23
+ case 4:
24
+ case "end":
25
+ return _context.stop();
26
+ }
27
+ }, _callee);
28
+ }));
29
+ return _likeGo.apply(this, arguments);
30
+ }
31
+ export default likeGo;
@@ -0,0 +1,2 @@
1
+ declare function likeGoSync<T, S>(fn: () => T): [T, S];
2
+ export default likeGoSync;
@@ -0,0 +1,10 @@
1
+ function likeGoSync(fn) {
2
+ var result = [];
3
+ try {
4
+ result[0] = fn();
5
+ } catch (err) {
6
+ result[1] = err;
7
+ }
8
+ return result;
9
+ }
10
+ export default likeGoSync;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ debug(title: string, ...args: any[]): void;
3
+ success(title: string, ...args: any[]): void;
4
+ error(title: string, ...args: any[]): void;
5
+ warn(title: string, ...args: any[]): void;
6
+ };
7
+ export default _default;
@@ -0,0 +1,30 @@
1
+ export default {
2
+ debug: function debug(title) {
3
+ var _console;
4
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5
+ args[_key - 1] = arguments[_key];
6
+ }
7
+ (_console = console).debug.apply(_console, ["%c[DEBUG] -> ".concat(title), 'color:white;background-color:blue'].concat(args));
8
+ },
9
+ success: function success(title) {
10
+ var _console2;
11
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
12
+ args[_key2 - 1] = arguments[_key2];
13
+ }
14
+ (_console2 = console).debug.apply(_console2, ["%c[SUCCESS] -> ".concat(title), 'color:white;background-color:green'].concat(args));
15
+ },
16
+ error: function error(title) {
17
+ var _console3;
18
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
19
+ args[_key3 - 1] = arguments[_key3];
20
+ }
21
+ (_console3 = console).error.apply(_console3, ["%c[ERROR] -> ".concat(title), 'color:white;background-color:red'].concat(args));
22
+ },
23
+ warn: function warn(title) {
24
+ var _console4;
25
+ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
26
+ args[_key4 - 1] = arguments[_key4];
27
+ }
28
+ (_console4 = console).error.apply(_console4, ["%c[WARN] -> ".concat(title), 'color:white;background-color:yellow'].concat(args));
29
+ }
30
+ };
@@ -0,0 +1 @@
1
+ export default function nextTick(fn: () => void): void;
@@ -0,0 +1,3 @@
1
+ export default function nextTick(fn) {
2
+ setTimeout(fn, 10);
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const App: () => import("react/jsx-runtime").JSX.Element;
2
+ export default App;
@@ -0,0 +1,200 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ 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); }
8
+ 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; }
9
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ /* eslint-disable react/button-has-type */
12
+ import { useCreation } from 'ahooks';
13
+ import React, { useEffect, useState } from 'react';
14
+ import io from 'socket.io-client';
15
+ import Recorder from "./index";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ var recorder = new Recorder({
19
+ sampleBits: 16,
20
+ // 采样位数,支持 8 或 16,默认是16
21
+ sampleRate: 16000,
22
+ // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
23
+ numChannels: 1,
24
+ // 声道,支持 1 或 2, 默认是1
25
+ compiling: true //(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false
26
+ });
27
+
28
+ var recorder2 = new Recorder({
29
+ sampleBits: 16,
30
+ // 采样位数,支持 8 或 16,默认是16
31
+ sampleRate: 16000,
32
+ // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
33
+ numChannels: 1,
34
+ // 声道,支持 1 或 2, 默认是1
35
+ compiling: true //(0.x版本中生效,1.x增加中) // 是否边录边转换,默认是false
36
+ });
37
+
38
+ var App = function App() {
39
+ var _useState = useState(false),
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ state = _useState2[0],
42
+ setState = _useState2[1];
43
+ var sokect = useCreation(function () {
44
+ return io('ws://192.168.101.89:9614', {
45
+ path: '/socket.io',
46
+ query: {
47
+ sn: '110110110110',
48
+ meetingNo: '54325432543',
49
+ manufacturer: 'speech',
50
+ audioType: 'wav',
51
+ sampleBytes: '16',
52
+ sampleRate: '16000',
53
+ channel: '1',
54
+ language: 'cn',
55
+ authorization: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InNlcnZpY2VJZCI6IjE2NTU1NDAwMjI5ODQ3NzMiLCJlbmFibGVkIjp0cnVlLCJzZXJ2aWNlVHlwZSI6Miwic2VydmljZU5hbWUiOiLnu4Tku7bljJbmtYvor5XlubPlj7Bf5Yu_5YqoIiwic2VydmljZU5vIjoiMjAyMzA1MDUwMDEiLCJzaWduSW5UeXBlIjoic2VydmljZSIsImF1dGhvcml0eVR5cGUiOjIsIm1lZXRpbmdBY2Nlc3NJZCI6MTY0MTY5MjI3NDQ5MTQ2MSwidm9pY2VBY2Nlc3NJZCI6MTY1NTUzODM1NDQwNTQ0NSwiYXV0aG9yaXRpZXMiOm51bGx9LCJzY29wZSI6WyJzZXJ2aWNlIl0sImV4cCI6MTY4MzcyOTA0MSwianRpIjoiMjc1YjM2ZmMtY2FjNS00MjgyLWFlYzYtM2YxNWRlOTBkZjFkIiwiY2xpZW50X2lkIjoic2VydmljZTo5YzJiMTdjMGNmZjE0MDgzYmRiNmYyN2NhNzYzY2ZmOSJ9.FdWyBmWF-hmC16wNohViLbHJf4qiEzIqSk9shqGLCPs'
56
+ },
57
+ autoConnect: false,
58
+ transports: ['websocket']
59
+ });
60
+ }, []);
61
+ useEffect(function () {
62
+ sokect.on('connect', function () {
63
+ console.log('connect');
64
+ });
65
+ sokect.on('message', function (event) {
66
+ console.log(event);
67
+ });
68
+ }, []);
69
+ var onstart = /*#__PURE__*/function () {
70
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
71
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
72
+ while (1) switch (_context.prev = _context.next) {
73
+ case 0:
74
+ _context.next = 2;
75
+ return recorder.start();
76
+ case 2:
77
+ setState(true);
78
+ case 3:
79
+ case "end":
80
+ return _context.stop();
81
+ }
82
+ }, _callee);
83
+ }));
84
+ return function onstart() {
85
+ return _ref.apply(this, arguments);
86
+ };
87
+ }();
88
+ var oncanect = function oncanect() {
89
+ if (!sokect.connected) {
90
+ sokect.connect();
91
+ }
92
+ };
93
+ var onstop = function onstop() {
94
+ recorder.stop();
95
+ setState(false);
96
+ if (sokect.connected) {
97
+ sokect.disconnect();
98
+ }
99
+ };
100
+ useEffect(function () {
101
+ if (state) {
102
+ var timer = setInterval(function () {
103
+ var voice = recorder.getNextData();
104
+ if (!voice) {
105
+ return;
106
+ }
107
+ sokect.emit('message', {
108
+ sendTime: Date.now(),
109
+ voice: voice
110
+ });
111
+ }, 40);
112
+ return function () {
113
+ return clearInterval(timer);
114
+ };
115
+ }
116
+ }, [state]);
117
+ var onstart2 = /*#__PURE__*/function () {
118
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
119
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
120
+ while (1) switch (_context2.prev = _context2.next) {
121
+ case 0:
122
+ _context2.next = 2;
123
+ return recorder2.start();
124
+ case 2:
125
+ setState(true);
126
+ case 3:
127
+ case "end":
128
+ return _context2.stop();
129
+ }
130
+ }, _callee2);
131
+ }));
132
+ return function onstart2() {
133
+ return _ref2.apply(this, arguments);
134
+ };
135
+ }();
136
+ var onstop2 = /*#__PURE__*/function () {
137
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
138
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
139
+ while (1) switch (_context3.prev = _context3.next) {
140
+ case 0:
141
+ recorder2.stop();
142
+ setState(true);
143
+ case 2:
144
+ case "end":
145
+ return _context3.stop();
146
+ }
147
+ }, _callee3);
148
+ }));
149
+ return function onstop2() {
150
+ return _ref3.apply(this, arguments);
151
+ };
152
+ }();
153
+ var onplay2 = /*#__PURE__*/function () {
154
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
155
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
156
+ while (1) switch (_context4.prev = _context4.next) {
157
+ case 0:
158
+ recorder2.play();
159
+ case 1:
160
+ case "end":
161
+ return _context4.stop();
162
+ }
163
+ }, _callee4);
164
+ }));
165
+ return function onplay2() {
166
+ return _ref4.apply(this, arguments);
167
+ };
168
+ }();
169
+ return /*#__PURE__*/_jsxs("div", {
170
+ className: "App",
171
+ children: [/*#__PURE__*/_jsxs("div", {
172
+ children: [/*#__PURE__*/_jsx("h4", {
173
+ children: "\u5B9E\u65F6\u8BED\u97F3\u8F6C\u5199"
174
+ }), /*#__PURE__*/_jsx("button", {
175
+ onClick: oncanect,
176
+ children: "\u8FDE\u63A5"
177
+ }), /*#__PURE__*/_jsx("button", {
178
+ onClick: onstart,
179
+ children: "\u5F00\u59CB"
180
+ }), /*#__PURE__*/_jsx("button", {
181
+ onClick: onstop,
182
+ children: "\u505C\u6B62"
183
+ })]
184
+ }), /*#__PURE__*/_jsxs("div", {
185
+ children: [/*#__PURE__*/_jsx("h4", {
186
+ children: "\u97F3\u9891\u5F55\u5236"
187
+ }), /*#__PURE__*/_jsx("button", {
188
+ onClick: onstart2,
189
+ children: "\u5F00\u59CB"
190
+ }), /*#__PURE__*/_jsx("button", {
191
+ onClick: onstop2,
192
+ children: "\u505C\u6B62"
193
+ }), /*#__PURE__*/_jsx("button", {
194
+ onClick: onplay2,
195
+ children: "\u64AD\u653E"
196
+ })]
197
+ })]
198
+ });
199
+ };
200
+ export default App;