@whitesev/pops 3.2.2 → 3.3.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.
- package/dist/index.amd.js +35 -282
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +35 -282
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +35 -282
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +35 -282
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +35 -282
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +35 -282
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/PopsCore.d.ts +15 -7
- package/package.json +3 -4
- package/src/PopsCore.ts +30 -14
- package/src/utils/PopsUtils.ts +4 -34
package/dist/index.esm.js
CHANGED
|
@@ -175,272 +175,55 @@ const PopsIcon = {
|
|
|
175
175
|
*/
|
|
176
176
|
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
177
177
|
|
|
178
|
-
const
|
|
178
|
+
const OriginPrototype = {
|
|
179
|
+
Object: {
|
|
180
|
+
defineProperty: Object.defineProperty,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
const PopsCoreDefaultApi = {
|
|
179
184
|
document: document,
|
|
180
185
|
window: window,
|
|
181
186
|
globalThis: globalThis,
|
|
182
187
|
self: self,
|
|
188
|
+
setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
189
|
+
setInterval: globalThis.setInterval.bind(globalThis),
|
|
190
|
+
clearTimeout: globalThis.clearTimeout.bind(globalThis),
|
|
191
|
+
clearInterval: globalThis.clearInterval.bind(globalThis),
|
|
183
192
|
};
|
|
184
|
-
const
|
|
193
|
+
const PopsCoreApi = Object.assign({}, PopsCoreDefaultApi);
|
|
185
194
|
const PopsCore = {
|
|
195
|
+
init(option) {
|
|
196
|
+
if (!option) {
|
|
197
|
+
option = Object.assign({}, PopsCoreDefaultApi);
|
|
198
|
+
}
|
|
199
|
+
Object.assign(PopsCoreApi, option);
|
|
200
|
+
},
|
|
186
201
|
get document() {
|
|
187
|
-
return
|
|
202
|
+
return PopsCoreApi.document;
|
|
188
203
|
},
|
|
189
204
|
get window() {
|
|
190
|
-
return
|
|
205
|
+
return PopsCoreApi.window;
|
|
191
206
|
},
|
|
192
207
|
get globalThis() {
|
|
193
|
-
return
|
|
208
|
+
return PopsCoreApi.globalThis;
|
|
194
209
|
},
|
|
195
210
|
get self() {
|
|
196
|
-
return
|
|
211
|
+
return PopsCoreApi.self;
|
|
197
212
|
},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Object: {
|
|
201
|
-
defineProperty: Object.defineProperty,
|
|
213
|
+
get setTimeout() {
|
|
214
|
+
return PopsCoreApi.setTimeout;
|
|
202
215
|
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const createCache = (lastNumberWeakMap) => {
|
|
206
|
-
return (collection, nextNumber) => {
|
|
207
|
-
lastNumberWeakMap.set(collection, nextNumber);
|
|
208
|
-
return nextNumber;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
/*
|
|
213
|
-
* The value of the constant Number.MAX_SAFE_INTEGER equals (2 ** 53 - 1) but it
|
|
214
|
-
* is fairly new.
|
|
215
|
-
*/
|
|
216
|
-
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === undefined ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
|
|
217
|
-
const TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
|
|
218
|
-
const TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
|
|
219
|
-
const createGenerateUniqueNumber = (cache, lastNumberWeakMap) => {
|
|
220
|
-
return (collection) => {
|
|
221
|
-
const lastNumber = lastNumberWeakMap.get(collection);
|
|
222
|
-
/*
|
|
223
|
-
* Let's try the cheapest algorithm first. It might fail to produce a new
|
|
224
|
-
* number, but it is so cheap that it is okay to take the risk. Just
|
|
225
|
-
* increase the last number by one or reset it to 0 if we reached the upper
|
|
226
|
-
* bound of SMIs (which stands for small integers). When the last number is
|
|
227
|
-
* unknown it is assumed that the collection contains zero based consecutive
|
|
228
|
-
* numbers.
|
|
229
|
-
*/
|
|
230
|
-
let nextNumber = lastNumber === undefined ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
|
|
231
|
-
if (!collection.has(nextNumber)) {
|
|
232
|
-
return cache(collection, nextNumber);
|
|
233
|
-
}
|
|
234
|
-
/*
|
|
235
|
-
* If there are less than half of 2 ** 30 numbers stored in the collection,
|
|
236
|
-
* the chance to generate a new random number in the range from 0 to 2 ** 30
|
|
237
|
-
* is at least 50%. It's benifitial to use only SMIs because they perform
|
|
238
|
-
* much better in any environment based on V8.
|
|
239
|
-
*/
|
|
240
|
-
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
|
|
241
|
-
while (collection.has(nextNumber)) {
|
|
242
|
-
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
|
|
243
|
-
}
|
|
244
|
-
return cache(collection, nextNumber);
|
|
245
|
-
}
|
|
246
|
-
// Quickly check if there is a theoretical chance to generate a new number.
|
|
247
|
-
if (collection.size > MAX_SAFE_INTEGER) {
|
|
248
|
-
throw new Error('Congratulations, you created a collection of unique numbers which uses all available integers!');
|
|
249
|
-
}
|
|
250
|
-
// Otherwise use the full scale of safely usable integers.
|
|
251
|
-
while (collection.has(nextNumber)) {
|
|
252
|
-
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
|
|
253
|
-
}
|
|
254
|
-
return cache(collection, nextNumber);
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const LAST_NUMBER_WEAK_MAP = new WeakMap();
|
|
259
|
-
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
260
|
-
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
261
|
-
|
|
262
|
-
const createBrokerFactory = (createOrGetOngoingRequests, extendBrokerImplementation, generateUniqueNumber, isMessagePort) => (brokerImplementation) => {
|
|
263
|
-
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
264
|
-
return (sender) => {
|
|
265
|
-
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
266
|
-
sender.addEventListener('message', (({ data: message }) => {
|
|
267
|
-
const { id } = message;
|
|
268
|
-
if (id !== null && ongoingRequests.has(id)) {
|
|
269
|
-
const { reject, resolve } = ongoingRequests.get(id);
|
|
270
|
-
ongoingRequests.delete(id);
|
|
271
|
-
if (message.error === undefined) {
|
|
272
|
-
resolve(message.result);
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
reject(new Error(message.error.message));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}));
|
|
279
|
-
if (isMessagePort(sender)) {
|
|
280
|
-
sender.start();
|
|
281
|
-
}
|
|
282
|
-
const call = (method, params = null, transferables = []) => {
|
|
283
|
-
return new Promise((resolve, reject) => {
|
|
284
|
-
const id = generateUniqueNumber(ongoingRequests);
|
|
285
|
-
ongoingRequests.set(id, { reject, resolve });
|
|
286
|
-
if (params === null) {
|
|
287
|
-
sender.postMessage({ id, method }, transferables);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
sender.postMessage({ id, method, params }, transferables);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
const notify = (method, params, transferables = []) => {
|
|
295
|
-
sender.postMessage({ id: null, method, params }, transferables);
|
|
296
|
-
};
|
|
297
|
-
let functions = {};
|
|
298
|
-
for (const [key, handler] of Object.entries(fullBrokerImplementation)) {
|
|
299
|
-
functions = { ...functions, [key]: handler({ call, notify }) };
|
|
300
|
-
}
|
|
301
|
-
return { ...functions };
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
const createCreateOrGetOngoingRequests = (ongoingRequestsMap) => (sender) => {
|
|
306
|
-
if (ongoingRequestsMap.has(sender)) {
|
|
307
|
-
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
308
|
-
return ongoingRequestsMap.get(sender);
|
|
309
|
-
}
|
|
310
|
-
const ongoingRequests = new Map();
|
|
311
|
-
ongoingRequestsMap.set(sender, ongoingRequests);
|
|
312
|
-
return ongoingRequests;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
const createExtendBrokerImplementation = (portMap) => (partialBrokerImplementation) => ({
|
|
316
|
-
...partialBrokerImplementation,
|
|
317
|
-
connect: ({ call }) => {
|
|
318
|
-
return async () => {
|
|
319
|
-
const { port1, port2 } = new MessageChannel();
|
|
320
|
-
const portId = await call('connect', { port: port1 }, [port1]);
|
|
321
|
-
portMap.set(port2, portId);
|
|
322
|
-
return port2;
|
|
323
|
-
};
|
|
216
|
+
get setInterval() {
|
|
217
|
+
return PopsCoreApi.setInterval;
|
|
324
218
|
},
|
|
325
|
-
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
await call('disconnect', { portId });
|
|
332
|
-
};
|
|
219
|
+
get clearTimeout() {
|
|
220
|
+
return PopsCoreApi.clearTimeout;
|
|
221
|
+
},
|
|
222
|
+
get clearInterval() {
|
|
223
|
+
return PopsCoreApi.clearInterval;
|
|
333
224
|
},
|
|
334
|
-
isSupported: ({ call }) => {
|
|
335
|
-
return () => call('isSupported');
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
const isMessagePort = (sender) => {
|
|
340
|
-
return typeof sender.start === 'function';
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
const createBroker = createBrokerFactory(createCreateOrGetOngoingRequests(new WeakMap()), createExtendBrokerImplementation(new WeakMap()), generateUniqueNumber, isMessagePort);
|
|
344
|
-
|
|
345
|
-
const createClearIntervalFactory = (scheduledIntervalsState) => (clear) => (timerId) => {
|
|
346
|
-
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
347
|
-
scheduledIntervalsState.set(timerId, null);
|
|
348
|
-
clear(timerId).then(() => {
|
|
349
|
-
scheduledIntervalsState.delete(timerId);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
const createClearTimeoutFactory = (scheduledTimeoutsState) => (clear) => (timerId) => {
|
|
355
|
-
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
356
|
-
scheduledTimeoutsState.set(timerId, null);
|
|
357
|
-
clear(timerId).then(() => {
|
|
358
|
-
scheduledTimeoutsState.delete(timerId);
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
const createSetIntervalFactory = (generateUniqueNumber, scheduledIntervalsState) => (set) => (func, delay = 0, ...args) => {
|
|
364
|
-
const symbol = Symbol();
|
|
365
|
-
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
366
|
-
scheduledIntervalsState.set(timerId, symbol);
|
|
367
|
-
const schedule = () => set(delay, timerId).then(() => {
|
|
368
|
-
const state = scheduledIntervalsState.get(timerId);
|
|
369
|
-
if (state === undefined) {
|
|
370
|
-
throw new Error('The timer is in an undefined state.');
|
|
371
|
-
}
|
|
372
|
-
if (state === symbol) {
|
|
373
|
-
func(...args);
|
|
374
|
-
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
375
|
-
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
376
|
-
schedule();
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
schedule();
|
|
381
|
-
return timerId;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
const createSetTimeoutFactory = (generateUniqueNumber, scheduledTimeoutsState) => (set) => (func, delay = 0, ...args) => {
|
|
385
|
-
const symbol = Symbol();
|
|
386
|
-
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
387
|
-
scheduledTimeoutsState.set(timerId, symbol);
|
|
388
|
-
set(delay, timerId).then(() => {
|
|
389
|
-
const state = scheduledTimeoutsState.get(timerId);
|
|
390
|
-
if (state === undefined) {
|
|
391
|
-
throw new Error('The timer is in an undefined state.');
|
|
392
|
-
}
|
|
393
|
-
if (state === symbol) {
|
|
394
|
-
// A timeout can be savely deleted because it is only called once.
|
|
395
|
-
scheduledTimeoutsState.delete(timerId);
|
|
396
|
-
func(...args);
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
return timerId;
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
403
|
-
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
404
|
-
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
405
|
-
const createClearInterval = createClearIntervalFactory(scheduledIntervalsState);
|
|
406
|
-
const createClearTimeout = createClearTimeoutFactory(scheduledTimeoutsState);
|
|
407
|
-
const createSetInterval = createSetIntervalFactory(generateUniqueNumber, scheduledIntervalsState);
|
|
408
|
-
const createSetTimeout = createSetTimeoutFactory(generateUniqueNumber, scheduledTimeoutsState);
|
|
409
|
-
const wrap = createBroker({
|
|
410
|
-
clearInterval: ({ call }) => createClearInterval((timerId) => call('clear', { timerId, timerType: 'interval' })),
|
|
411
|
-
clearTimeout: ({ call }) => createClearTimeout((timerId) => call('clear', { timerId, timerType: 'timeout' })),
|
|
412
|
-
setInterval: ({ call }) => createSetInterval((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'interval' })),
|
|
413
|
-
setTimeout: ({ call }) => createSetTimeout((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'timeout' }))
|
|
414
|
-
});
|
|
415
|
-
const load = (url) => {
|
|
416
|
-
const worker = new Worker(url);
|
|
417
|
-
return wrap(worker);
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
const createLoadOrReturnBroker = (loadBroker, worker) => {
|
|
421
|
-
let broker = null;
|
|
422
|
-
return () => {
|
|
423
|
-
if (broker !== null) {
|
|
424
|
-
return broker;
|
|
425
|
-
}
|
|
426
|
-
const blob = new Blob([worker], { type: 'application/javascript; charset=utf-8' });
|
|
427
|
-
const url = URL.createObjectURL(blob);
|
|
428
|
-
broker = loadBroker(url);
|
|
429
|
-
// Bug #1: Edge up until v18 didn't like the URL to be revoked directly.
|
|
430
|
-
setTimeout(() => URL.revokeObjectURL(url));
|
|
431
|
-
return broker;
|
|
432
|
-
};
|
|
433
225
|
};
|
|
434
226
|
|
|
435
|
-
// This is the minified and stringified code of the worker-timers-worker package.
|
|
436
|
-
const worker = `(()=>{var e={455(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},m=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},f=new Map,h=d(globalThis.clearTimeout,f),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=m(f,performance,globalThis.setTimeout,w),T=m(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`; // tslint:disable-line:max-line-length
|
|
437
|
-
|
|
438
|
-
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
439
|
-
const clearInterval$1 = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
440
|
-
const clearTimeout$1 = (timerId) => loadOrReturnBroker().clearTimeout(timerId);
|
|
441
|
-
const setInterval$1 = (...args) => loadOrReturnBroker().setInterval(...args);
|
|
442
|
-
const setTimeout$1 = (...args) => loadOrReturnBroker().setTimeout(...args);
|
|
443
|
-
|
|
444
227
|
let t$1 = class t{constructor(){this.__map={};}beforeEach(t){this.__interceptor=t;}on(t,i){const s=Array.isArray(t)?t:[t];for(const t of s){this.__map[t]=this.__map[t]||[];const s=this.__map[t];s&&s.push(i);}return this}emit(t,i,s){ void 0!==this.__interceptor?this.__interceptor(t,(()=>{this.__emit(t,i),s&&s();})):(this.__emit(t,i),s&&s());}__emit(t,i){const s=this.__map[t];if(Array.isArray(s)&&(null==s?void 0:s.length))for(const _ of s)_(i,t);this.event=i;}off(t,i){const s=this.__map[t];if(void 0!==s)if(void 0===i)delete this.__map[t];else {const t=s.findIndex((t=>t===i));s.splice(t,1);}}destroy(){this.__map={};}};
|
|
445
228
|
|
|
446
229
|
const n$1="clientX",e$2="clientY",t=16,c$3="start",o$1="move",s$1="cancel",u$3="end",a$2="left",i$3="right",r$4="up",d$1="down",m$2={4:"start",5:"move",1:"end",3:"cancel"};function v$1(n){return m$2[n]}function b(n,e,t){const c={1:{0:{move:4},4:{move:5,end:1,cancel:3},5:{move:5,end:1,cancel:3}},0:{4:{move:2,end:1,cancel:3},5:{start:2,move:2,end:1,cancel:3}}}[Number(n)][e];return void 0!==c&&c[t]||0}function g$1(n){[1,3,2].includes(n.state)&&(n.state=0);}function h$3(n){return [5,1,3].includes(n)}function j(n){if(n.disabled)return n.state=0,true}function O(n,e){return Object.assign(Object.assign(Object.assign({},n),e),{state:0,disabled:false})}function p$3(n){return Math.round(100*n)/100}
|
|
@@ -706,55 +489,25 @@ class PopsUtils {
|
|
|
706
489
|
* 自动使用 Worker 执行 setTimeout
|
|
707
490
|
*/
|
|
708
491
|
setTimeout(callback, timeout = 0) {
|
|
709
|
-
|
|
710
|
-
return setTimeout$1(callback, timeout);
|
|
711
|
-
}
|
|
712
|
-
catch {
|
|
713
|
-
return setTimeout(callback, timeout);
|
|
714
|
-
}
|
|
492
|
+
return PopsCore.setTimeout(callback, timeout);
|
|
715
493
|
}
|
|
716
494
|
/**
|
|
717
495
|
* 配合 .setTimeout 使用
|
|
718
496
|
*/
|
|
719
497
|
clearTimeout(timeId) {
|
|
720
|
-
|
|
721
|
-
if (timeId != null) {
|
|
722
|
-
clearTimeout$1(timeId);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
catch {
|
|
726
|
-
// TODO
|
|
727
|
-
}
|
|
728
|
-
finally {
|
|
729
|
-
clearTimeout(timeId);
|
|
730
|
-
}
|
|
498
|
+
return PopsCore.clearTimeout(timeId);
|
|
731
499
|
}
|
|
732
500
|
/**
|
|
733
501
|
* 自动使用 Worker 执行 setInterval
|
|
734
502
|
*/
|
|
735
503
|
setInterval(callback, timeout = 0) {
|
|
736
|
-
|
|
737
|
-
return setInterval$1(callback, timeout);
|
|
738
|
-
}
|
|
739
|
-
catch {
|
|
740
|
-
return setInterval(callback, timeout);
|
|
741
|
-
}
|
|
504
|
+
return PopsCore.setInterval(callback, timeout);
|
|
742
505
|
}
|
|
743
506
|
/**
|
|
744
507
|
* 配合 .setInterval 使用
|
|
745
508
|
*/
|
|
746
509
|
clearInterval(timeId) {
|
|
747
|
-
|
|
748
|
-
if (timeId != null) {
|
|
749
|
-
clearInterval$1(timeId);
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
catch {
|
|
753
|
-
// 忽略
|
|
754
|
-
}
|
|
755
|
-
finally {
|
|
756
|
-
clearInterval(timeId);
|
|
757
|
-
}
|
|
510
|
+
return PopsCore.clearInterval(timeId);
|
|
758
511
|
}
|
|
759
512
|
/**
|
|
760
513
|
* 覆盖对象中的数组新值
|
|
@@ -13459,7 +13212,7 @@ const PopsSearchSuggestion = {
|
|
|
13459
13212
|
},
|
|
13460
13213
|
};
|
|
13461
13214
|
|
|
13462
|
-
const version = "3.
|
|
13215
|
+
const version = "3.3.0";
|
|
13463
13216
|
|
|
13464
13217
|
class Pops {
|
|
13465
13218
|
/** 配置 */
|