@cloud-app-dev/vidc 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AppContext/index.js +20 -61
- package/es/AutoExit/index.js +5 -9
- package/es/Config/index.js +0 -5
- package/es/Config/utils.js +7 -27
- package/es/ConfigContext/index.d.ts +1 -1
- package/es/ConfigContext/index.js +1 -3
- package/es/CustomRenderSelect/index.js +19 -39
- package/es/DynamicGridList/index.js +16 -28
- package/es/FullScreen/index.js +10 -22
- package/es/GridList/hook.js +36 -67
- package/es/GridList/index.d.ts +1 -1
- package/es/GridList/index.js +1 -1
- package/es/ImageView/index.js +16 -31
- package/es/LabelValue/index.d.ts +0 -8
- package/es/LabelValue/index.js +11 -16
- package/es/List/index.js +5 -7
- package/es/ListWithSizeAnimate/demo.js +3 -15
- package/es/LoaderScript/utils.js +100 -153
- package/es/Map/InfoWindow/MakerLikeWindow.js +35 -29
- package/es/Map/InfoWindow/demo.js +17 -29
- package/es/Picture/component/Tools/index.js +5 -7
- package/es/Picture/demo.js +15 -19
- package/es/Picture/index.js +70 -104
- package/es/Picture/utils.js +14 -28
- package/es/Player/api/index.d.ts +4 -4
- package/es/Player/api/index.js +47 -92
- package/es/Player/contraller_bar/right_bar.js +12 -23
- package/es/Player/demo.js +47 -62
- package/es/Player/event/errorEvent.d.ts +1 -1
- package/es/Player/event/errorEvent.js +16 -41
- package/es/Player/fps_play.js +15 -33
- package/es/Player/frontend_timeline.js +28 -48
- package/es/Player/player.d.ts +3 -2
- package/es/Player/segment_timeline.js +45 -69
- package/es/Player/single_player.js +111 -117
- package/es/Player/util.d.ts +1 -1
- package/es/Player/util.js +9 -28
- package/es/Progress/index.js +5 -16
- package/es/ROI/index.d.ts +0 -6
- package/es/ROI/index.js +17 -26
- package/es/RefDrawer/Footer.js +3 -5
- package/es/RefDrawer/demo.js +0 -3
- package/es/RefDrawer/index.js +17 -27
- package/es/RefModal/demo.js +0 -3
- package/es/RefModal/index.js +27 -27
- package/es/ScreenPlayer/Live.d.ts +1 -1
- package/es/ScreenPlayer/Live.js +36 -70
- package/es/ScreenPlayer/LiveTools.js +20 -39
- package/es/ScreenPlayer/PlayerWithExt.js +48 -85
- package/es/ScreenPlayer/RecordTools.d.ts +1 -1
- package/es/ScreenPlayer/RecordTools.js +27 -53
- package/es/ScreenPlayer/SegmentTimeLine.js +8 -13
- package/es/ScreenPlayer/TimeSelect.js +9 -24
- package/es/ScreenPlayer/demo.js +3 -2
- package/es/ScreenPlayer/demo2.js +76 -108
- package/es/ScreenPlayer/useTimeSlider.js +63 -141
- package/es/Service/http.js +14 -34
- package/es/TableLayout/index.js +6 -10
- package/es/ThemeAntd/index.js +0 -1
- package/es/Timeout/index.js +16 -31
- package/es/VList/index.d.ts +1 -9
- package/es/VList/index.js +18 -30
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/typings.d.ts +1 -0
- package/es/useDrawROI/index.js +61 -115
- package/es/useInfiniteScroll/index.js +24 -45
- package/es/utils.js +18 -42
- package/package.json +5 -6
- package/es/LoaderApp/index.d.ts +0 -31
- package/es/LoaderApp/index.js +0 -138
- package/es/LoaderApp/index.less +0 -3
- package/es/LoaderApp/interface.d.ts +0 -9
- package/es/LoaderApp/loader.d.ts +0 -19
- package/es/LoaderApp/loader.js +0 -85
- package/es/LoaderApp/sandbox.back.d.ts +0 -18
- package/es/LoaderApp/sandbox.back.js +0 -368
- package/es/LoaderApp/sandbox.d.ts +0 -12
- package/es/LoaderApp/sandbox.js +0 -113
- package/es/LoaderApp/utils.d.ts +0 -19
- package/es/LoaderApp/utils.js +0 -275
- package/es/ROI/utils.d.ts +0 -1
- package/es/ROI/utils.js +0 -1
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
-
|
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
|
|
15
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
16
|
-
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @file 全局window沙盒,隔离变量环境
|
|
23
|
-
*/
|
|
24
|
-
var originWindow = window;
|
|
25
|
-
var constructableMap = new WeakMap();
|
|
26
|
-
|
|
27
|
-
function isConstructable(fn) {
|
|
28
|
-
if (constructableMap.has(fn)) {
|
|
29
|
-
return constructableMap.get(fn);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var constructableFunctionRegex = /^function\b\s[A-Z].*/;
|
|
33
|
-
var classRegex = /^class\b/;
|
|
34
|
-
var constructable = fn.prototype && fn.prototype.constructor === fn && Object.getOwnPropertyNames(fn.prototype).length > 1 || constructableFunctionRegex.test(fn.toString()) || classRegex.test(fn.toString());
|
|
35
|
-
constructableMap.set(fn, constructable);
|
|
36
|
-
return constructable;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var naughtySafari = typeof document.all === 'function' && typeof document.all === 'undefined';
|
|
40
|
-
var isCallable = naughtySafari ? function (fn) {
|
|
41
|
-
return typeof fn === 'function' && typeof fn !== 'undefined';
|
|
42
|
-
} : function (fn) {
|
|
43
|
-
return typeof fn === 'function';
|
|
44
|
-
};
|
|
45
|
-
var boundedMap = new WeakMap();
|
|
46
|
-
|
|
47
|
-
function isBoundedFunction(fn) {
|
|
48
|
-
if (boundedMap.has(fn)) {
|
|
49
|
-
return boundedMap.get(fn);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var bounded = fn.name.indexOf('bound ') === 0 && !fn.hasOwnProperty('prototype');
|
|
53
|
-
boundedMap.set(fn, bounded);
|
|
54
|
-
return bounded;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var functionBoundedValueMap = new WeakMap();
|
|
58
|
-
|
|
59
|
-
function getTargetValue(target, value) {
|
|
60
|
-
var cachedBoundFunction = functionBoundedValueMap.get(value);
|
|
61
|
-
|
|
62
|
-
if (cachedBoundFunction) {
|
|
63
|
-
return cachedBoundFunction;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (isCallable(value) && !isBoundedFunction(value) && !isConstructable(value)) {
|
|
67
|
-
var boundValue = Function.prototype.bind.call(value, target);
|
|
68
|
-
|
|
69
|
-
for (var key in value) {
|
|
70
|
-
boundValue[key] = value[key];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (value.hasOwnProperty('prototype') && !boundValue.hasOwnProperty('prototype')) boundValue.prototype = value.prototype;
|
|
74
|
-
functionBoundedValueMap.set(value, boundValue);
|
|
75
|
-
return boundValue;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return value;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function getScript(scriptText) {
|
|
82
|
-
return '(function(window){with(window){;'.concat(scriptText, '\n').concat('}}).bind(window.proxy)(window.proxy);');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var rawAddEventListener = window.addEventListener;
|
|
86
|
-
var rawRemoveEventListener = window.removeEventListener;
|
|
87
|
-
var rawWindowInterval = window.setInterval;
|
|
88
|
-
var rawWindowClearInterval = window.clearInterval;
|
|
89
|
-
var rawWindowTimeout = window.setTimeout;
|
|
90
|
-
var rawWindowClearTimeout = window.clearTimeout;
|
|
91
|
-
var unscopables = {
|
|
92
|
-
undefined: true,
|
|
93
|
-
Array: true,
|
|
94
|
-
Object: true,
|
|
95
|
-
String: true,
|
|
96
|
-
Boolean: true,
|
|
97
|
-
Math: true,
|
|
98
|
-
Number: true,
|
|
99
|
-
Symbol: true,
|
|
100
|
-
parseFloat: true,
|
|
101
|
-
Float32Array: true
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
function createFakeWindow() {
|
|
105
|
-
var fakeWindow = {};
|
|
106
|
-
Object.getOwnPropertyNames(originWindow).forEach(function (key) {
|
|
107
|
-
var descriptor = Object.getOwnPropertyDescriptor(originWindow, key);
|
|
108
|
-
|
|
109
|
-
if (descriptor && !descriptor.configurable) {
|
|
110
|
-
var hasGetter = Object.prototype.hasOwnProperty.call(descriptor, 'get');
|
|
111
|
-
|
|
112
|
-
if (key === 'top' || key === 'parent' || key === 'self' || key === 'window') {
|
|
113
|
-
descriptor.configurable = true;
|
|
114
|
-
|
|
115
|
-
if (!hasGetter) {
|
|
116
|
-
descriptor.writable = true;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
Object.defineProperty(fakeWindow, key, Object.freeze(descriptor));
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return fakeWindow;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
var Sandbox = /*#__PURE__*/function () {
|
|
127
|
-
function Sandbox(showlog) {
|
|
128
|
-
var _this = this;
|
|
129
|
-
|
|
130
|
-
_classCallCheck(this, Sandbox);
|
|
131
|
-
|
|
132
|
-
_defineProperty(this, "fakeWindow", createFakeWindow());
|
|
133
|
-
|
|
134
|
-
_defineProperty(this, "proxy", void 0);
|
|
135
|
-
|
|
136
|
-
_defineProperty(this, "updateKeys", new Set());
|
|
137
|
-
|
|
138
|
-
_defineProperty(this, "listenerMap", new Map());
|
|
139
|
-
|
|
140
|
-
_defineProperty(this, "timeoutList", []);
|
|
141
|
-
|
|
142
|
-
_defineProperty(this, "intervalList", []);
|
|
143
|
-
|
|
144
|
-
_defineProperty(this, "originKeys", []);
|
|
145
|
-
|
|
146
|
-
_defineProperty(this, "showlog", false);
|
|
147
|
-
|
|
148
|
-
_defineProperty(this, "hasDisposed", false);
|
|
149
|
-
|
|
150
|
-
this.showlog = showlog;
|
|
151
|
-
this.proxy = new Proxy(window, {
|
|
152
|
-
set: function set(target, key, value) {
|
|
153
|
-
if (!_this.hasDisposed) {
|
|
154
|
-
_this.updateKeys.add(key);
|
|
155
|
-
|
|
156
|
-
try {
|
|
157
|
-
if (!_this.fakeWindow.hasOwnProperty(key) && target.hasOwnProperty(key)) {
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
target[key] = value;
|
|
160
|
-
} else {
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
_this.fakeWindow[key] = value;
|
|
163
|
-
}
|
|
164
|
-
} catch (error) {
|
|
165
|
-
console.error('set-key-error', key, error);
|
|
166
|
-
throw error;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return true;
|
|
171
|
-
},
|
|
172
|
-
get: function get(target, key) {
|
|
173
|
-
if (key === Symbol.unscopables) {
|
|
174
|
-
return unscopables;
|
|
175
|
-
} // @ts-ignore
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (key === 'window' || key === 'self' || key === 'global' || key === 'globalThis') {
|
|
179
|
-
return _this.proxy;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (key === 'document') {
|
|
183
|
-
return target.document;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (key === 'hasOwnProperty') {
|
|
187
|
-
return target.hasOwnProperty;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (key === 'eval') {
|
|
191
|
-
return target.eval;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
console.log(key, target); // @ts-ignore
|
|
196
|
-
|
|
197
|
-
var value = key in target ? target[key] : _this.fakeWindow[key]; // @ts-ignore
|
|
198
|
-
|
|
199
|
-
if (isCallable(value) && !isBoundedFunction(value) && !isConstructable(value)) {
|
|
200
|
-
// @ts-ignore
|
|
201
|
-
// return target.matchMedia
|
|
202
|
-
value = Function.prototype.bind.call(value, target);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return getTargetValue(window, value);
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.error('get-key-error', key, error);
|
|
208
|
-
throw error;
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
has: function has(target, key) {
|
|
212
|
-
return key in unscopables || key in target || key in _this.fakeWindow; // return this.fakeWindow.hasOwnProperty(key)
|
|
213
|
-
}
|
|
214
|
-
}); // 事件
|
|
215
|
-
|
|
216
|
-
this.proxy.addEventListener = function (type, listener, options) {
|
|
217
|
-
if (!_this.hasDisposed) {
|
|
218
|
-
var listeners = _this.listenerMap.get(type) || [];
|
|
219
|
-
|
|
220
|
-
_this.listenerMap.set(type, [].concat(_toConsumableArray(listeners), [listener]));
|
|
221
|
-
|
|
222
|
-
return rawAddEventListener.call(window, type, listener, options);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
this.proxy.removeEventListener = function (type, listener, options) {
|
|
227
|
-
var listeners = _this.listenerMap.get(type);
|
|
228
|
-
|
|
229
|
-
if (listeners && listeners.length) {
|
|
230
|
-
var listenerIndex = listeners.indexOf(listener);
|
|
231
|
-
|
|
232
|
-
if (listenerIndex !== -1) {
|
|
233
|
-
listeners.splice(listeners.indexOf(listener), 1);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return rawRemoveEventListener.call(window, type, listener, options);
|
|
238
|
-
}; // 定时器
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.proxy.setInterval = function (handler, timeout) {
|
|
242
|
-
if (!_this.hasDisposed) {
|
|
243
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
244
|
-
args[_key - 2] = arguments[_key];
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
var intervalId = rawWindowInterval.apply(void 0, [handler, timeout].concat(args));
|
|
248
|
-
|
|
249
|
-
_this.intervalList.push(intervalId);
|
|
250
|
-
|
|
251
|
-
return intervalId;
|
|
252
|
-
} else {
|
|
253
|
-
return 0;
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
this.proxy.clearInterval = function (intervalId) {
|
|
258
|
-
var intervalIndex = _this.intervalList.indexOf(intervalId);
|
|
259
|
-
|
|
260
|
-
if (intervalIndex !== -1) {
|
|
261
|
-
_this.intervalList.splice(intervalIndex, 1);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return rawWindowClearInterval(intervalId);
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
this.proxy.setTimeout = function (handler, timeout) {
|
|
268
|
-
if (!_this.hasDisposed) {
|
|
269
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
270
|
-
args[_key2 - 2] = arguments[_key2];
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
var timeoutId = rawWindowTimeout.apply(void 0, [handler, timeout].concat(args));
|
|
274
|
-
|
|
275
|
-
_this.timeoutList.push(timeoutId);
|
|
276
|
-
|
|
277
|
-
return timeoutId;
|
|
278
|
-
} else {
|
|
279
|
-
return 0;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
this.proxy.clearTimeout = function (timeoutId) {
|
|
284
|
-
var timeoutIndex = _this.timeoutList.indexOf(timeoutId);
|
|
285
|
-
|
|
286
|
-
if (timeoutIndex !== -1) {
|
|
287
|
-
_this.timeoutList.splice(timeoutIndex, 1);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return rawWindowClearTimeout(timeoutId);
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
this.originKeys = this.showWindowKeys(); // @ts-ignore
|
|
294
|
-
|
|
295
|
-
originWindow.proxy = this.proxy;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
_createClass(Sandbox, [{
|
|
299
|
-
key: "execScript",
|
|
300
|
-
value: function execScript(scriptText) {
|
|
301
|
-
if (this.hasDisposed) {
|
|
302
|
-
throw new Error('sandbox has been destroyed');
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
var scriptTextWithSandbox = getScript(scriptText);
|
|
306
|
-
originWindow.eval(scriptTextWithSandbox);
|
|
307
|
-
}
|
|
308
|
-
}, {
|
|
309
|
-
key: "showWindowKeys",
|
|
310
|
-
value: function showWindowKeys() {
|
|
311
|
-
var originKeys = Object.keys(originWindow);
|
|
312
|
-
|
|
313
|
-
if (this.showlog === true) {
|
|
314
|
-
console.log('originWindow', originWindow);
|
|
315
|
-
console.log('updateKeys', this.updateKeys);
|
|
316
|
-
console.log('windowKeysLength', originKeys.length);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return originKeys;
|
|
320
|
-
}
|
|
321
|
-
}, {
|
|
322
|
-
key: "preview",
|
|
323
|
-
value: function preview() {
|
|
324
|
-
if (this.showlog === true) {
|
|
325
|
-
window.console.log('updateKeys', this.updateKeys);
|
|
326
|
-
window.console.log('listenerMap', this.listenerMap);
|
|
327
|
-
window.console.log('intervalList', this.intervalList);
|
|
328
|
-
window.console.log('timeoutList', this.timeoutList);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}, {
|
|
332
|
-
key: "dispose",
|
|
333
|
-
value: function dispose() {
|
|
334
|
-
this.listenerMap.forEach(function (listeners, type) {
|
|
335
|
-
return _toConsumableArray(listeners).forEach(function (listener) {
|
|
336
|
-
return rawRemoveEventListener.call(window, type, listener);
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
this.listenerMap.clear();
|
|
340
|
-
this.intervalList.forEach(function (intervalId) {
|
|
341
|
-
return rawWindowClearInterval(intervalId);
|
|
342
|
-
});
|
|
343
|
-
this.intervalList = [];
|
|
344
|
-
this.timeoutList.forEach(function (timeoutId) {
|
|
345
|
-
return rawWindowClearTimeout(timeoutId);
|
|
346
|
-
});
|
|
347
|
-
this.timeoutList = [];
|
|
348
|
-
this.fakeWindow = createFakeWindow(); // const originKeys = this.showWindowKeys()
|
|
349
|
-
// const newKeys = []
|
|
350
|
-
// for (var i = 0; i < originKeys.length; i++) {
|
|
351
|
-
// if (this.originKeys.indexOf(originKeys[i]) === -1) {
|
|
352
|
-
// newKeys.push(originKeys)
|
|
353
|
-
// }
|
|
354
|
-
// }
|
|
355
|
-
// @ts-ignore
|
|
356
|
-
// originWindow.newKeys = newKeys
|
|
357
|
-
// @ts-ignore
|
|
358
|
-
|
|
359
|
-
delete originWindow.proxy;
|
|
360
|
-
this.hasDisposed = true;
|
|
361
|
-
console.log('Sandbox was successfully destroyed');
|
|
362
|
-
}
|
|
363
|
-
}]);
|
|
364
|
-
|
|
365
|
-
return Sandbox;
|
|
366
|
-
}();
|
|
367
|
-
|
|
368
|
-
export default Sandbox;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface OPTIONS {
|
|
2
|
-
inheritGlobal?: boolean;
|
|
3
|
-
blacklist?: string[];
|
|
4
|
-
docMap?: {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
declare class SandBox {
|
|
9
|
-
private updatedValueSet;
|
|
10
|
-
constructor(context?: Window & typeof globalThis, { blacklist, docMap }?: OPTIONS);
|
|
11
|
-
}
|
|
12
|
-
export default SandBox;
|
package/es/LoaderApp/sandbox.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2
|
-
|
|
3
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
-
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
|
-
// 懒加载的脚本暂时没法拦截
|
|
10
|
-
var SandBox = /*#__PURE__*/_createClass(function SandBox() {
|
|
11
|
-
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
|
|
12
|
-
|
|
13
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
14
|
-
_ref$blacklist = _ref.blacklist,
|
|
15
|
-
blacklist = _ref$blacklist === void 0 ? [] : _ref$blacklist,
|
|
16
|
-
_ref$docMap = _ref.docMap,
|
|
17
|
-
docMap = _ref$docMap === void 0 ? {} : _ref$docMap;
|
|
18
|
-
|
|
19
|
-
_classCallCheck(this, SandBox);
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "updatedValueSet", new Map());
|
|
22
|
-
|
|
23
|
-
var blackmap = {};
|
|
24
|
-
|
|
25
|
-
for (var i = 0; i < blacklist.length; i++) {
|
|
26
|
-
var name = blacklist[i];
|
|
27
|
-
blackmap[name] = true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var updatedValueSet = this.updatedValueSet; // const proxyDocoment = createSandBoxDocument(docMap);
|
|
31
|
-
|
|
32
|
-
var proxy = new Proxy(context, {
|
|
33
|
-
set: function set(target, name, value) {
|
|
34
|
-
if (!target[name]) {
|
|
35
|
-
updatedValueSet.set(name, value);
|
|
36
|
-
} else {
|
|
37
|
-
target[name] = value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return true;
|
|
41
|
-
},
|
|
42
|
-
get: function get(target, name) {
|
|
43
|
-
if (blackmap.hasOwnProperty(name)) {
|
|
44
|
-
console.error("Can't assess property: ".concat(name, " in blacklist"));
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (updatedValueSet.has(name)) {
|
|
49
|
-
return updatedValueSet.get(name);
|
|
50
|
-
} // if (
|
|
51
|
-
// name === 'Object' ||
|
|
52
|
-
// name === 'Symbol' ||
|
|
53
|
-
// typeof name === 'symbol' ||
|
|
54
|
-
// name === 'parseFloat' ||
|
|
55
|
-
// name === 'parseInt' ||
|
|
56
|
-
// name === 'Array' ||
|
|
57
|
-
// name === 'Number' ||
|
|
58
|
-
// name === 'Math' ||
|
|
59
|
-
// name === 'String'||
|
|
60
|
-
// name === 'Reflect'||
|
|
61
|
-
// name === 'Boolean'||
|
|
62
|
-
// name === 'isNaN'
|
|
63
|
-
// ) {
|
|
64
|
-
// } else {
|
|
65
|
-
// console.log(name);
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
switch (name) {
|
|
70
|
-
case 'window':
|
|
71
|
-
case 'global':
|
|
72
|
-
case 'self':
|
|
73
|
-
case 'globalThis':
|
|
74
|
-
return proxy;
|
|
75
|
-
|
|
76
|
-
case 'document':
|
|
77
|
-
return document;
|
|
78
|
-
// return proxyDocoment;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (typeof target[name] === 'function' && /^[a-z]/.test(name)) {
|
|
82
|
-
return target[name].bind && target[name].bind(target);
|
|
83
|
-
} else {
|
|
84
|
-
return target[name];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return proxy;
|
|
89
|
-
}); // function createSandBoxDocument(proxyMap: { [key: string]: any } = {}) {
|
|
90
|
-
// return new Proxy(document, {
|
|
91
|
-
// get(target: any, p: string): any {
|
|
92
|
-
// if (proxyMap.hasOwnProperty(p)) {
|
|
93
|
-
// return proxyMap[p];
|
|
94
|
-
// }
|
|
95
|
-
// if (typeof target[p] === 'function' && /^[a-z]/.test(p)) {
|
|
96
|
-
// return target[p].bind && target[p].bind(target);
|
|
97
|
-
// } else {
|
|
98
|
-
// return target[p];
|
|
99
|
-
// }
|
|
100
|
-
// },
|
|
101
|
-
// });
|
|
102
|
-
// }
|
|
103
|
-
// function text() {
|
|
104
|
-
// (function (global: any) {
|
|
105
|
-
// const s = global.document.createElement('span');
|
|
106
|
-
// s.innerHTML = '1111';
|
|
107
|
-
// console.log(global.document.head.appendChild(s));
|
|
108
|
-
// })(new SandBox(window, { docMap: { head: document.body } }));
|
|
109
|
-
// }
|
|
110
|
-
// text();
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
export default SandBox;
|
package/es/LoaderApp/utils.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AppItemType } from '../Config/interface';
|
|
2
|
-
export declare const getMicroConfig: (appConfig: AppItemType | undefined, appProps: any, container: HTMLDivElement) => {
|
|
3
|
-
title: string;
|
|
4
|
-
routerPrefix: string;
|
|
5
|
-
container: HTMLDivElement;
|
|
6
|
-
props: any;
|
|
7
|
-
entry: {
|
|
8
|
-
scripts: string[];
|
|
9
|
-
styles: string[];
|
|
10
|
-
html: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare function fetchStyle(style: string): Promise<string>;
|
|
14
|
-
export declare const arrayify: <T>(list: CSSRuleList | any[]) => T[];
|
|
15
|
-
export declare function rewrite(rules: CSSRule[], prefix?: string): string;
|
|
16
|
-
export declare function importHTML(url: string): Promise<{
|
|
17
|
-
cssTexts: string[];
|
|
18
|
-
appInstance: any;
|
|
19
|
-
}>;
|