@cloud-app-dev/vidc 3.1.16 → 3.1.18
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.
- package/es/Api/index.js +0 -23
- package/es/AppContext/Sync.js +1 -15
- package/es/AppContext/index.js +21 -52
- package/es/AppContext/static.js +0 -7
- package/es/Auth/index.js +2 -5
- package/es/AutoExit/index.js +1 -5
- package/es/Box/BetweenBox/index.js +6 -8
- package/es/Box/InfoBox/index.js +6 -8
- package/es/Box/TwoColumnBox/index.js +8 -18
- package/es/Box/deps/grid-factory.js +0 -12
- package/es/Box/index.js +4 -6
- package/es/CheckGroupFixed/index.js +19 -34
- package/es/Config/index.js +0 -4
- package/es/Config/utils.js +3 -18
- package/es/ConfigContext/index.js +1 -3
- package/es/CustomRenderSelect/index.js +13 -29
- package/es/DisableMark/index.js +2 -2
- package/es/DomMove/index.js +24 -37
- package/es/DomMove/utils.js +3 -8
- package/es/Drag/DragAndDropItem.js +19 -37
- package/es/Drag/DropItem.js +5 -15
- package/es/Drawer/Demo.js +3 -17
- package/es/Drawer/Footer.js +3 -5
- package/es/Drawer/index.js +28 -50
- package/es/ErrorFallback/index.js +1 -3
- package/es/FullScreen/index.js +8 -18
- package/es/HightLevel/index.js +1 -5
- package/es/IconFont/index.js +5 -11
- package/es/ImageView/index.js +8 -20
- package/es/Input/index.js +14 -27
- package/es/InstanceHistory/index.js +0 -2
- package/es/LabelValue/index.js +8 -10
- package/es/List/DynamicGridList/Demo.js +0 -11
- package/es/List/DynamicGridList/index.js +16 -25
- package/es/List/DynamicList/index.js +23 -38
- package/es/List/GridList/Demo.js +3 -16
- package/es/List/GridList/hook.js +34 -65
- package/es/List/GridList/utils.js +0 -1
- package/es/List/VList/index.js +10 -20
- package/es/List/VList/utils.js +2 -3
- package/es/List/index.js +5 -7
- package/es/LoaderApp/index.js +5 -22
- package/es/LoaderApp/loader.js +5 -13
- package/es/LoaderApp/sandbox.back.js +16 -81
- package/es/LoaderApp/sandbox.js +8 -22
- package/es/LoaderApp/utils.js +20 -49
- package/es/LoaderScript/index.js +8 -19
- package/es/LoaderScript/utils.js +0 -51
- package/es/Map/BasicMap/AMapInstance.js +0 -10
- package/es/Map/BasicMap/LeafletInstance.js +11 -20
- package/es/Map/BasicMap/index.js +6 -28
- package/es/Map/ClusterLayer/hook.js +10 -32
- package/es/Map/ClusterLayer/index.js +2 -6
- package/es/Map/Config/index.js +8 -21
- package/es/Map/Config/utils.js +0 -6
- package/es/Map/Context/index.js +2 -22
- package/es/Map/FindPio/index.js +0 -2
- package/es/Map/InfoWindow/MakerLikeWindow.js +9 -28
- package/es/Map/InfoWindow/demo.js +5 -22
- package/es/Map/InfoWindow/index.js +13 -29
- package/es/Map/LevelCenter/DragMarker/index.js +5 -9
- package/es/Map/LevelCenter/demo.js +6 -16
- package/es/Map/LevelCenter/index.js +8 -15
- package/es/Map/LoaderMap/index.js +10 -10
- package/es/Map/MapDrawSelect/demo.js +12 -23
- package/es/Map/MapDrawSelect/index.js +14 -21
- package/es/Map/MouseTool/index.js +16 -26
- package/es/Map/MouseTool/useMouseTools.js +6 -29
- package/es/Map/ResetTools/index.js +4 -8
- package/es/Map/SinglePoint/index.js +6 -13
- package/es/Map/hook/useMapEvent.js +3 -7
- package/es/Map/hook/useMapType.js +1 -2
- package/es/Map/useMarker/index.js +10 -24
- package/es/Map/withMap/index.js +0 -2
- package/es/Modal/index.d.ts +1 -1
- package/es/Modal/index.js +29 -50
- package/es/Picture/component/DefaultRects/RectInfo.js +11 -25
- package/es/Picture/component/DefaultRects/index.js +3 -5
- package/es/Picture/component/DrawRect/index.js +6 -8
- package/es/Picture/component/RectMenu/index.js +10 -16
- package/es/Picture/component/RectMenu/utils.js +3 -6
- package/es/Picture/component/Tools/index.js +6 -8
- package/es/Picture/component/WheelScale/index.js +3 -6
- package/es/Picture/dragBound.js +4 -17
- package/es/Picture/index.js +46 -87
- package/es/Picture/loadCaptureRectImage.js +10 -26
- package/es/Picture/useDraw.js +20 -39
- package/es/Picture/utils.js +2 -11
- package/es/Player/api/index.js +14 -78
- package/es/Player/context.js +1 -2
- package/es/Player/contraller_bar/bar.js +5 -9
- package/es/Player/contraller_bar/contraller_event.js +5 -23
- package/es/Player/contraller_bar/index.js +7 -9
- package/es/Player/contraller_bar/left_bar.js +15 -27
- package/es/Player/contraller_bar/right_bar.js +7 -18
- package/es/Player/contraller_bar/time.js +6 -16
- package/es/Player/contraller_bar/useBarStatus.js +5 -16
- package/es/Player/contraller_bar/volume.js +6 -26
- package/es/Player/demo.js +59 -75
- package/es/Player/event/errorEvent.js +14 -39
- package/es/Player/event/eventName.js +1 -1
- package/es/Player/event/index.js +19 -53
- package/es/Player/fps_play.js +10 -27
- package/es/Player/frontend_player.js +10 -19
- package/es/Player/frontend_timeline.js +25 -47
- package/es/Player/iconfont.js +2 -5
- package/es/Player/live_heart.js +2 -14
- package/es/Player/message.js +9 -29
- package/es/Player/segment_player.js +39 -77
- package/es/Player/segment_timeline.js +42 -68
- package/es/Player/single_player.js +64 -87
- package/es/Player/style/iconfont.js +10 -17
- package/es/Player/timeline.js +11 -28
- package/es/Player/util.js +0 -21
- package/es/PlayerExt/demo.js +11 -21
- package/es/PlayerExt/index.js +18 -43
- package/es/Progress/index.js +3 -15
- package/es/ROI/demo.js +0 -2
- package/es/ROI/index.js +15 -22
- package/es/ScreenPlayer/Live.js +34 -67
- package/es/ScreenPlayer/LiveTools.js +21 -38
- package/es/ScreenPlayer/PlayerWithExt.js +43 -78
- package/es/ScreenPlayer/RatePick.js +1 -3
- package/es/ScreenPlayer/Record.js +50 -121
- package/es/ScreenPlayer/RecordTools.js +32 -54
- package/es/ScreenPlayer/ScreenSelect.js +1 -3
- package/es/ScreenPlayer/SegmentTimeLine.js +8 -12
- package/es/ScreenPlayer/TimeMode.js +1 -3
- package/es/ScreenPlayer/TimeSelect.js +11 -26
- package/es/ScreenPlayer/demo.js +3 -1
- package/es/ScreenPlayer/demo2.js +9 -24
- package/es/ScreenPlayer/useRecordList.js +7 -72
- package/es/ScreenPlayer/useTimeSlider.js +40 -132
- package/es/ScreenPlayer/useVideoFit.js +5 -18
- package/es/ScreenPlayer/utils.js +0 -8
- package/es/Service/fetch-adapter.js +2 -37
- package/es/Service/http.js +8 -27
- package/es/TableLayout/index.js +3 -7
- package/es/ThemeAntd/demo.js +0 -2
- package/es/ThemeAntd/index.css +15 -0
- package/es/ThemeAntd/style/select.css +15 -0
- package/es/Timeout/index.js +10 -26
- package/es/Tree/demo.js +0 -2
- package/es/Tree/index.js +14 -21
- package/es/useDrawROI/index.js +51 -105
- package/es/useEventEmitterHandle/index.js +2 -6
- package/es/useFullscreen/demo.js +6 -16
- package/es/useFullscreen/index.js +5 -25
- package/es/useHistory/index.js +0 -2
- package/es/useInfiniteScroll/index.js +14 -39
- package/es/useRafInterval/index.js +2 -26
- package/es/useSimpleState/index.js +5 -16
- package/es/useVirtualList/index.js +19 -57
- package/es/utils.js +0 -28
- package/package.json +14 -14
package/es/LoaderApp/utils.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
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
|
-
|
|
3
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, $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 generator._invoke = function (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); } }; }(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; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return 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, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), 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 (object) { var 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; }
|
|
4
|
-
|
|
5
3
|
import { __awaiter } from "tslib";
|
|
6
4
|
export var getMicroConfig = function getMicroConfig() {
|
|
7
5
|
var appConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
6
|
var appProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9
7
|
var container = arguments.length > 2 ? arguments[2] : undefined;
|
|
10
8
|
var routerPrefix = appConfig.routerPrefix,
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
resource = appConfig.resource,
|
|
10
|
+
name = appConfig.name;
|
|
13
11
|
var microAppEntry = {
|
|
14
12
|
scripts: [resource[0]],
|
|
15
13
|
styles: [resource[1]],
|
|
@@ -35,9 +33,7 @@ export function fetchStyle(style) {
|
|
|
35
33
|
_context.next = 2;
|
|
36
34
|
break;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
return _context.abrupt("return", styleCache[style]);
|
|
40
|
-
|
|
41
37
|
case 2:
|
|
42
38
|
_context.next = 4;
|
|
43
39
|
return fetch(style).then(function (r) {
|
|
@@ -45,12 +41,10 @@ export function fetchStyle(style) {
|
|
|
45
41
|
}).catch(function () {
|
|
46
42
|
return '';
|
|
47
43
|
});
|
|
48
|
-
|
|
49
44
|
case 4:
|
|
50
45
|
cssText = _context.sent;
|
|
51
46
|
styleCache[style] = cssText;
|
|
52
47
|
return _context.abrupt("return", cssText);
|
|
53
|
-
|
|
54
48
|
case 7:
|
|
55
49
|
case "end":
|
|
56
50
|
return _context.stop();
|
|
@@ -82,51 +76,46 @@ export function rewrite(rules) {
|
|
|
82
76
|
case RuleType.STYLE:
|
|
83
77
|
css += ruleStyle(rule, prefix);
|
|
84
78
|
break;
|
|
85
|
-
|
|
86
79
|
case RuleType.MEDIA:
|
|
87
80
|
css += ruleMedia(rule, prefix);
|
|
88
81
|
break;
|
|
89
|
-
|
|
90
82
|
case RuleType.SUPPORTS:
|
|
91
83
|
css += ruleSupport(rule, prefix);
|
|
92
84
|
break;
|
|
93
|
-
|
|
94
85
|
default:
|
|
95
86
|
css += "".concat(rule.cssText);
|
|
96
87
|
break;
|
|
97
88
|
}
|
|
98
89
|
});
|
|
99
90
|
return css;
|
|
100
|
-
}
|
|
91
|
+
}
|
|
92
|
+
// handle case:
|
|
101
93
|
// .app-main {}
|
|
102
94
|
// html, body {}
|
|
103
95
|
// eslint-disable-next-line class-methods-use-this
|
|
104
|
-
|
|
105
96
|
function ruleStyle(rule, prefix) {
|
|
106
97
|
var rootSelectorRE = /((?:[^\w\-.#]|^)(body|html|:root))/gm;
|
|
107
98
|
var rootCombinationRE = /(html[^\w{[]+)/gm;
|
|
108
99
|
var selector = rule.selectorText.trim();
|
|
109
|
-
var cssText = rule.cssText;
|
|
100
|
+
var cssText = rule.cssText;
|
|
101
|
+
// handle html { ... }
|
|
110
102
|
// handle body { ... }
|
|
111
103
|
// handle :root { ... }
|
|
112
|
-
|
|
113
104
|
if (selector === 'html' || selector === 'body' || selector === ':root') {
|
|
114
105
|
return ''; //微应用模式下清楚顶层样式
|
|
115
106
|
// return cssText.replace(rootSelectorRE, prefix);
|
|
116
|
-
}
|
|
107
|
+
}
|
|
108
|
+
// handle html body { ... }
|
|
117
109
|
// handle html > body { ... }
|
|
118
|
-
|
|
119
|
-
|
|
120
110
|
if (rootCombinationRE.test(rule.selectorText)) {
|
|
121
|
-
var siblingSelectorRE = /(html[^\w{]+)(\+|~)/gm;
|
|
111
|
+
var siblingSelectorRE = /(html[^\w{]+)(\+|~)/gm;
|
|
112
|
+
// since html + body is a non-standard rule for html
|
|
122
113
|
// transformer will ignore it
|
|
123
|
-
|
|
124
114
|
if (!siblingSelectorRE.test(rule.selectorText)) {
|
|
125
115
|
cssText = cssText.replace(rootCombinationRE, '');
|
|
126
116
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
117
|
+
}
|
|
118
|
+
// handle grouping selector, a,span,p,div { ... }
|
|
130
119
|
cssText = cssText.replace(/^[\s\S]+{/, function (selectors) {
|
|
131
120
|
return selectors.replace(/(^|,\n?)([^,]+)/g, function (item, p, s) {
|
|
132
121
|
// handle div,body,span { ... }
|
|
@@ -134,37 +123,31 @@ function ruleStyle(rule, prefix) {
|
|
|
134
123
|
return item.replace(rootSelectorRE, function (m) {
|
|
135
124
|
// do not discard valid previous character, such as body,html or *:not(:root)
|
|
136
125
|
var whitePrevChars = [',', '('];
|
|
137
|
-
|
|
138
126
|
if (m && whitePrevChars.includes(m[0])) {
|
|
139
127
|
return "".concat(m[0]).concat(prefix);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
}
|
|
129
|
+
// replace root selector with prefix
|
|
143
130
|
return prefix;
|
|
144
131
|
});
|
|
145
132
|
}
|
|
146
|
-
|
|
147
133
|
return "".concat(p).concat(prefix, " ").concat(s.replace(/^ */, ''));
|
|
148
134
|
});
|
|
149
135
|
});
|
|
150
136
|
return cssText;
|
|
151
|
-
}
|
|
137
|
+
}
|
|
138
|
+
// handle case:
|
|
152
139
|
// @media screen and (max-width: 300px) {}
|
|
153
|
-
|
|
154
|
-
|
|
155
140
|
function ruleMedia(rule, prefix) {
|
|
156
141
|
var css = rewrite(arrayify(rule.cssRules), prefix);
|
|
157
142
|
return "@media ".concat(rule.conditionText, " {").concat(css, "}");
|
|
158
143
|
}
|
|
159
|
-
|
|
160
|
-
|
|
144
|
+
var _global = window;
|
|
145
|
+
// handle case:
|
|
161
146
|
// @supports (display: grid) {}
|
|
162
|
-
|
|
163
147
|
function ruleSupport(rule, prefix) {
|
|
164
148
|
var css = rewrite(arrayify(rule.cssRules), prefix);
|
|
165
149
|
return "@supports ".concat(rule.conditionText, " {").concat(css, "}");
|
|
166
150
|
}
|
|
167
|
-
|
|
168
151
|
var cache = {};
|
|
169
152
|
export function importHTML(url) {
|
|
170
153
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
@@ -177,27 +160,21 @@ export function importHTML(url) {
|
|
|
177
160
|
_context2.next = 4;
|
|
178
161
|
break;
|
|
179
162
|
}
|
|
180
|
-
|
|
181
163
|
_context2.t0 = cache[url];
|
|
182
164
|
_context2.next = 7;
|
|
183
165
|
break;
|
|
184
|
-
|
|
185
166
|
case 4:
|
|
186
167
|
_context2.next = 6;
|
|
187
168
|
return fetch(url).then(function (res) {
|
|
188
169
|
return res.text();
|
|
189
170
|
});
|
|
190
|
-
|
|
191
171
|
case 6:
|
|
192
172
|
_context2.t0 = _context2.sent;
|
|
193
|
-
|
|
194
173
|
case 7:
|
|
195
174
|
html = _context2.t0;
|
|
196
|
-
|
|
197
175
|
if (!cache[url]) {
|
|
198
176
|
cache[url] = html;
|
|
199
177
|
}
|
|
200
|
-
|
|
201
178
|
doc = new DOMParser().parseFromString(html, 'text/html');
|
|
202
179
|
scripts = Array.from(doc.querySelectorAll('script')).filter(function (v) {
|
|
203
180
|
return v.attributes.getNamedItem('src');
|
|
@@ -210,24 +187,20 @@ export function importHTML(url) {
|
|
|
210
187
|
});
|
|
211
188
|
index = entryIndex === -1 ? 0 : entryIndex;
|
|
212
189
|
entry = scripts[index];
|
|
213
|
-
|
|
214
190
|
if (entry) {
|
|
215
191
|
_context2.next = 17;
|
|
216
192
|
break;
|
|
217
193
|
}
|
|
218
|
-
|
|
219
194
|
throw new Error('微应用没有入口脚本!');
|
|
220
|
-
|
|
221
195
|
case 17:
|
|
222
196
|
_context2.next = 19;
|
|
223
197
|
return Promise.all(srcs.map(function (v) {
|
|
224
198
|
return _global.System.import(v);
|
|
225
199
|
}));
|
|
226
|
-
|
|
227
200
|
case 19:
|
|
228
201
|
res = _context2.sent;
|
|
229
|
-
appInstance = res[index];
|
|
230
|
-
|
|
202
|
+
appInstance = res[index];
|
|
203
|
+
// 处理样式 link
|
|
231
204
|
links = Array.from(doc.querySelectorAll('link')).filter(function (v) {
|
|
232
205
|
return v.getAttribute('rel') === 'stylesheet';
|
|
233
206
|
});
|
|
@@ -238,7 +211,6 @@ export function importHTML(url) {
|
|
|
238
211
|
return Promise.all(cssHref.map(function (v) {
|
|
239
212
|
return fetchStyle(v);
|
|
240
213
|
}));
|
|
241
|
-
|
|
242
214
|
case 25:
|
|
243
215
|
cssTexts = _context2.sent;
|
|
244
216
|
// 处理样式style
|
|
@@ -250,7 +222,6 @@ export function importHTML(url) {
|
|
|
250
222
|
cssTexts: cssTexts,
|
|
251
223
|
appInstance: appInstance
|
|
252
224
|
});
|
|
253
|
-
|
|
254
225
|
case 29:
|
|
255
226
|
case "end":
|
|
256
227
|
return _context2.stop();
|
package/es/LoaderScript/index.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
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."); }
|
|
4
|
-
|
|
5
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); }
|
|
6
|
-
|
|
7
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; }
|
|
8
|
-
|
|
9
5
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useEffect, useState } from 'react';
|
|
14
8
|
import { createAsyncIterable, runAsyncIterable } from './utils';
|
|
15
|
-
|
|
16
9
|
function LoaderScripts(_ref) {
|
|
17
10
|
var _ref$options = _ref.options,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
_ref$Spin = _ref.Spin,
|
|
14
|
+
Spin = _ref$Spin === void 0 ? null : _ref$Spin,
|
|
15
|
+
onLoadEnd = _ref.onLoadEnd;
|
|
24
16
|
var _useState = useState(false),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
initStatus = _useState2[0],
|
|
19
|
+
setInitStatus = _useState2[1];
|
|
29
20
|
useEffect(function () {
|
|
30
21
|
if (options.length === 0) {
|
|
31
22
|
return setInitStatus(true);
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
runAsyncIterable(createAsyncIterable(options), function (index) {
|
|
35
25
|
return console.debug('LoaderScript -> Iterable加载完成!', options[index]);
|
|
36
26
|
}, function () {
|
|
@@ -41,5 +31,4 @@ function LoaderScripts(_ref) {
|
|
|
41
31
|
}, [onLoadEnd, options]);
|
|
42
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !initStatus ? Spin : children);
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
export default LoaderScripts;
|
package/es/LoaderScript/utils.js
CHANGED
|
@@ -1,49 +1,33 @@
|
|
|
1
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
|
-
|
|
3
2
|
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
4
|
-
|
|
5
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
4
|
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, $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 generator._invoke = function (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); } }; }(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; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return 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, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), 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 (object) { var 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; }
|
|
8
|
-
|
|
9
5
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
-
|
|
11
6
|
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."); }
|
|
12
|
-
|
|
13
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); }
|
|
14
|
-
|
|
15
8
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
|
-
|
|
17
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
18
|
-
|
|
19
10
|
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; }
|
|
20
|
-
|
|
21
11
|
import { __asyncValues, __awaiter } from "tslib";
|
|
22
12
|
var global = window;
|
|
23
|
-
|
|
24
13
|
if (!global._LOADER_SCRIPT_URL) {
|
|
25
14
|
global._LOADER_SCRIPT_URL = {};
|
|
26
15
|
}
|
|
27
|
-
|
|
28
16
|
export var loadScript = function loadScript(url) {
|
|
29
17
|
console.log(url);
|
|
30
18
|
return new Promise(function (resolve, reject) {
|
|
31
19
|
if (global._LOADER_SCRIPT_URL[url]) {
|
|
32
20
|
resolve(null);
|
|
33
21
|
}
|
|
34
|
-
|
|
35
22
|
var script = document.createElement('script');
|
|
36
23
|
script.type = 'text/javascript';
|
|
37
|
-
|
|
38
24
|
script.onload = function () {
|
|
39
25
|
global._LOADER_SCRIPT_URL[url] = true;
|
|
40
26
|
resolve(null);
|
|
41
27
|
};
|
|
42
|
-
|
|
43
28
|
script.onerror = function (err) {
|
|
44
29
|
reject(err);
|
|
45
30
|
};
|
|
46
|
-
|
|
47
31
|
script.src = url;
|
|
48
32
|
document.head.appendChild(script);
|
|
49
33
|
});
|
|
@@ -53,20 +37,16 @@ export var loaderCss = function loaderCss(href) {
|
|
|
53
37
|
if (global._LOADER_SCRIPT_URL[href]) {
|
|
54
38
|
resolve(null);
|
|
55
39
|
}
|
|
56
|
-
|
|
57
40
|
var link = document.createElement('link');
|
|
58
41
|
link.rel = 'stylesheet';
|
|
59
42
|
link.href = href;
|
|
60
|
-
|
|
61
43
|
link.onload = function () {
|
|
62
44
|
global._LOADER_SCRIPT_URL[href] = true;
|
|
63
45
|
resolve(null);
|
|
64
46
|
};
|
|
65
|
-
|
|
66
47
|
link.onerror = function (err) {
|
|
67
48
|
reject(err);
|
|
68
49
|
};
|
|
69
|
-
|
|
70
50
|
document.head.appendChild(link);
|
|
71
51
|
});
|
|
72
52
|
};
|
|
@@ -85,48 +65,39 @@ export function createAsyncIterable(options) {
|
|
|
85
65
|
_context.next = 12;
|
|
86
66
|
break;
|
|
87
67
|
}
|
|
88
|
-
|
|
89
68
|
param = options[this.i];
|
|
90
69
|
arr = [];
|
|
91
|
-
|
|
92
70
|
if (param.scripts && param.scripts.length > 0) {
|
|
93
71
|
arr.push.apply(arr, _toConsumableArray(param.scripts.map(function (v) {
|
|
94
72
|
return loadScript(v);
|
|
95
73
|
})));
|
|
96
74
|
}
|
|
97
|
-
|
|
98
75
|
if (param.styles && param.styles.length > 0) {
|
|
99
76
|
arr.push.apply(arr, _toConsumableArray(param.styles.map(function (v) {
|
|
100
77
|
return loaderCss(v);
|
|
101
78
|
})));
|
|
102
79
|
}
|
|
103
|
-
|
|
104
80
|
if (!(arr.length > 0)) {
|
|
105
81
|
_context.next = 11;
|
|
106
82
|
break;
|
|
107
83
|
}
|
|
108
|
-
|
|
109
84
|
_context.next = 8;
|
|
110
85
|
return Promise.all(arr);
|
|
111
|
-
|
|
112
86
|
case 8:
|
|
113
87
|
return _context.abrupt("return", {
|
|
114
88
|
value: this.i++,
|
|
115
89
|
done: false
|
|
116
90
|
});
|
|
117
|
-
|
|
118
91
|
case 11:
|
|
119
92
|
return _context.abrupt("return", Promise.resolve({
|
|
120
93
|
value: this.i++,
|
|
121
94
|
done: false
|
|
122
95
|
}));
|
|
123
|
-
|
|
124
96
|
case 12:
|
|
125
97
|
return _context.abrupt("return", Promise.resolve({
|
|
126
98
|
value: this.i,
|
|
127
99
|
done: true
|
|
128
100
|
}));
|
|
129
|
-
|
|
130
101
|
case 13:
|
|
131
102
|
case "end":
|
|
132
103
|
return _context.stop();
|
|
@@ -148,16 +119,13 @@ export function tryCatch(resolveFn) {
|
|
|
148
119
|
_context2.prev = 0;
|
|
149
120
|
_context2.next = 3;
|
|
150
121
|
return resolveFn();
|
|
151
|
-
|
|
152
122
|
case 3:
|
|
153
123
|
_context2.next = 8;
|
|
154
124
|
break;
|
|
155
|
-
|
|
156
125
|
case 5:
|
|
157
126
|
_context2.prev = 5;
|
|
158
127
|
_context2.t0 = _context2["catch"](0);
|
|
159
128
|
rejectFn(_context2.t0);
|
|
160
|
-
|
|
161
129
|
case 8:
|
|
162
130
|
case "end":
|
|
163
131
|
return _context2.stop();
|
|
@@ -168,81 +136,62 @@ export function tryCatch(resolveFn) {
|
|
|
168
136
|
}
|
|
169
137
|
export function runAsyncIterable(Iterables, runtime, callback) {
|
|
170
138
|
var _this = this;
|
|
171
|
-
|
|
172
139
|
tryCatch(function () {
|
|
173
140
|
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
174
141
|
var e_1, _a, Iterables_1, Iterables_1_1, x;
|
|
175
|
-
|
|
176
142
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
177
143
|
while (1) {
|
|
178
144
|
switch (_context3.prev = _context3.next) {
|
|
179
145
|
case 0:
|
|
180
146
|
_context3.prev = 0;
|
|
181
147
|
Iterables_1 = __asyncValues(Iterables);
|
|
182
|
-
|
|
183
148
|
case 2:
|
|
184
149
|
_context3.next = 4;
|
|
185
150
|
return Iterables_1.next();
|
|
186
|
-
|
|
187
151
|
case 4:
|
|
188
152
|
Iterables_1_1 = _context3.sent;
|
|
189
|
-
|
|
190
153
|
if (Iterables_1_1.done) {
|
|
191
154
|
_context3.next = 10;
|
|
192
155
|
break;
|
|
193
156
|
}
|
|
194
|
-
|
|
195
157
|
x = Iterables_1_1.value;
|
|
196
158
|
runtime === null || runtime === void 0 ? void 0 : runtime(x);
|
|
197
|
-
|
|
198
159
|
case 8:
|
|
199
160
|
_context3.next = 2;
|
|
200
161
|
break;
|
|
201
|
-
|
|
202
162
|
case 10:
|
|
203
163
|
_context3.next = 15;
|
|
204
164
|
break;
|
|
205
|
-
|
|
206
165
|
case 12:
|
|
207
166
|
_context3.prev = 12;
|
|
208
167
|
_context3.t0 = _context3["catch"](0);
|
|
209
168
|
e_1 = {
|
|
210
169
|
error: _context3.t0
|
|
211
170
|
};
|
|
212
|
-
|
|
213
171
|
case 15:
|
|
214
172
|
_context3.prev = 15;
|
|
215
173
|
_context3.prev = 16;
|
|
216
|
-
|
|
217
174
|
if (!(Iterables_1_1 && !Iterables_1_1.done && (_a = Iterables_1.return))) {
|
|
218
175
|
_context3.next = 20;
|
|
219
176
|
break;
|
|
220
177
|
}
|
|
221
|
-
|
|
222
178
|
_context3.next = 20;
|
|
223
179
|
return _a.call(Iterables_1);
|
|
224
|
-
|
|
225
180
|
case 20:
|
|
226
181
|
_context3.prev = 20;
|
|
227
|
-
|
|
228
182
|
if (!e_1) {
|
|
229
183
|
_context3.next = 23;
|
|
230
184
|
break;
|
|
231
185
|
}
|
|
232
|
-
|
|
233
186
|
throw e_1.error;
|
|
234
|
-
|
|
235
187
|
case 23:
|
|
236
188
|
return _context3.finish(20);
|
|
237
|
-
|
|
238
189
|
case 24:
|
|
239
190
|
return _context3.finish(15);
|
|
240
|
-
|
|
241
191
|
case 25:
|
|
242
192
|
_nextTick(function () {
|
|
243
193
|
return callback === null || callback === void 0 ? void 0 : callback();
|
|
244
194
|
});
|
|
245
|
-
|
|
246
195
|
case 26:
|
|
247
196
|
case "end":
|
|
248
197
|
return _context3.stop();
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
-
|
|
3
2
|
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); } }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
4
|
var AMapInstance = /*#__PURE__*/function () {
|
|
8
5
|
function AMapInstance(ele, config) {
|
|
9
6
|
_classCallCheck(this, AMapInstance);
|
|
10
|
-
|
|
11
7
|
this.mapContainer = ele;
|
|
12
8
|
this.config = config;
|
|
13
9
|
this.createMap();
|
|
14
10
|
}
|
|
15
|
-
|
|
16
11
|
_createClass(AMapInstance, [{
|
|
17
12
|
key: "createMap",
|
|
18
13
|
value: function createMap() {
|
|
19
14
|
var _this = this;
|
|
20
|
-
|
|
21
15
|
var _a;
|
|
22
|
-
|
|
23
16
|
this.map = new AMap.Map(this.mapContainer, {
|
|
24
17
|
viewMode: '3D',
|
|
25
18
|
zoom: this.config.zoom,
|
|
@@ -39,7 +32,6 @@ var AMapInstance = /*#__PURE__*/function () {
|
|
|
39
32
|
top: '10px'
|
|
40
33
|
}
|
|
41
34
|
});
|
|
42
|
-
|
|
43
35
|
_this.map.addControl(controlBar);
|
|
44
36
|
});
|
|
45
37
|
}
|
|
@@ -89,8 +81,6 @@ var AMapInstance = /*#__PURE__*/function () {
|
|
|
89
81
|
this.map.setDefaultCursor(cursor);
|
|
90
82
|
}
|
|
91
83
|
}]);
|
|
92
|
-
|
|
93
84
|
return AMapInstance;
|
|
94
85
|
}();
|
|
95
|
-
|
|
96
86
|
export default AMapInstance;
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
-
|
|
3
2
|
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); } }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
4
|
var LeafletInstance = /*#__PURE__*/function () {
|
|
8
5
|
function LeafletInstance(ele, config) {
|
|
9
6
|
_classCallCheck(this, LeafletInstance);
|
|
10
|
-
|
|
11
7
|
this.mapContainer = ele;
|
|
12
8
|
this.config = config;
|
|
13
9
|
}
|
|
14
|
-
|
|
15
10
|
_createClass(LeafletInstance, [{
|
|
16
11
|
key: "createMap",
|
|
17
12
|
value: function createMap() {
|
|
18
13
|
var L = window.L;
|
|
19
14
|
var _this$config = this.config,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
bounds = _this$config.maxBounds,
|
|
16
|
+
maxZoom = _this$config.maxZoom,
|
|
17
|
+
minZoom = _this$config.minZoom,
|
|
18
|
+
crsStr = _this$config.crs,
|
|
19
|
+
url = _this$config.url,
|
|
20
|
+
zoomOffset = _this$config.zoomOffset,
|
|
21
|
+
center = _this$config.center,
|
|
22
|
+
zoom = _this$config.zoom,
|
|
23
|
+
subdomains = _this$config.subdomains;
|
|
29
24
|
var layers = [L.tileLayer(url, {
|
|
30
25
|
maxZoom: maxZoom,
|
|
31
26
|
minZoom: minZoom,
|
|
@@ -58,21 +53,19 @@ var LeafletInstance = /*#__PURE__*/function () {
|
|
|
58
53
|
value: function setZoomAndCenter(zoom, center) {
|
|
59
54
|
var L = window.L;
|
|
60
55
|
var latlng;
|
|
61
|
-
|
|
62
56
|
if (Array.isArray(center)) {
|
|
63
57
|
latlng = center[1] < center[0] ? L.latLng(center[1], center[0]) : L.latLng(center);
|
|
64
58
|
} else {
|
|
65
59
|
latlng = center;
|
|
66
60
|
}
|
|
67
|
-
|
|
68
61
|
this.map.setView(latlng, zoom);
|
|
69
62
|
}
|
|
70
63
|
}, {
|
|
71
64
|
key: "mapReset",
|
|
72
65
|
value: function mapReset() {
|
|
73
66
|
var _this$config2 = this.config,
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
center = _this$config2.center,
|
|
68
|
+
zoom = _this$config2.zoom;
|
|
76
69
|
this.setZoomAndCenter(zoom, center);
|
|
77
70
|
}
|
|
78
71
|
}, {
|
|
@@ -106,8 +99,6 @@ var LeafletInstance = /*#__PURE__*/function () {
|
|
|
106
99
|
this.map.setDefaultCursor(cursor);
|
|
107
100
|
}
|
|
108
101
|
}]);
|
|
109
|
-
|
|
110
102
|
return LeafletInstance;
|
|
111
103
|
}();
|
|
112
|
-
|
|
113
104
|
export default LeafletInstance;
|