@whitesev/pops 3.1.2 → 3.1.3
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 +108 -118
- 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 +108 -118
- 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 +108 -118
- 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 +108 -118
- 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 +108 -118
- 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 +108 -118
- 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/package.json +8 -8
- package/src/components/tooltip/index.ts +12 -6
package/dist/index.amd.js
CHANGED
|
@@ -261,47 +261,7 @@ define((function () { 'use strict';
|
|
|
261
261
|
const cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
262
262
|
const generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
263
263
|
|
|
264
|
-
const
|
|
265
|
-
return typeof sender.start === 'function';
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const PORT_MAP = new WeakMap();
|
|
269
|
-
|
|
270
|
-
const extendBrokerImplementation = (partialBrokerImplementation) => ({
|
|
271
|
-
...partialBrokerImplementation,
|
|
272
|
-
connect: ({ call }) => {
|
|
273
|
-
return async () => {
|
|
274
|
-
const { port1, port2 } = new MessageChannel();
|
|
275
|
-
const portId = await call('connect', { port: port1 }, [port1]);
|
|
276
|
-
PORT_MAP.set(port2, portId);
|
|
277
|
-
return port2;
|
|
278
|
-
};
|
|
279
|
-
},
|
|
280
|
-
disconnect: ({ call }) => {
|
|
281
|
-
return async (port) => {
|
|
282
|
-
const portId = PORT_MAP.get(port);
|
|
283
|
-
if (portId === undefined) {
|
|
284
|
-
throw new Error('The given port is not connected.');
|
|
285
|
-
}
|
|
286
|
-
await call('disconnect', { portId });
|
|
287
|
-
};
|
|
288
|
-
},
|
|
289
|
-
isSupported: ({ call }) => {
|
|
290
|
-
return () => call('isSupported');
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const ONGOING_REQUESTS = new WeakMap();
|
|
295
|
-
const createOrGetOngoingRequests = (sender) => {
|
|
296
|
-
if (ONGOING_REQUESTS.has(sender)) {
|
|
297
|
-
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
298
|
-
return ONGOING_REQUESTS.get(sender);
|
|
299
|
-
}
|
|
300
|
-
const ongoingRequests = new Map();
|
|
301
|
-
ONGOING_REQUESTS.set(sender, ongoingRequests);
|
|
302
|
-
return ongoingRequests;
|
|
303
|
-
};
|
|
304
|
-
const createBroker = (brokerImplementation) => {
|
|
264
|
+
const createBrokerFactory = (createOrGetOngoingRequests, extendBrokerImplementation, generateUniqueNumber, isMessagePort) => (brokerImplementation) => {
|
|
305
265
|
const fullBrokerImplementation = extendBrokerImplementation(brokerImplementation);
|
|
306
266
|
return (sender) => {
|
|
307
267
|
const ongoingRequests = createOrGetOngoingRequests(sender);
|
|
@@ -344,81 +304,115 @@ define((function () { 'use strict';
|
|
|
344
304
|
};
|
|
345
305
|
};
|
|
346
306
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
307
|
+
const createCreateOrGetOngoingRequests = (ongoingRequestsMap) => (sender) => {
|
|
308
|
+
if (ongoingRequestsMap.has(sender)) {
|
|
309
|
+
// @todo TypeScript needs to be convinced that has() works as expected.
|
|
310
|
+
return ongoingRequestsMap.get(sender);
|
|
311
|
+
}
|
|
312
|
+
const ongoingRequests = new Map();
|
|
313
|
+
ongoingRequestsMap.set(sender, ongoingRequests);
|
|
314
|
+
return ongoingRequests;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const createExtendBrokerImplementation = (portMap) => (partialBrokerImplementation) => ({
|
|
318
|
+
...partialBrokerImplementation,
|
|
319
|
+
connect: ({ call }) => {
|
|
320
|
+
return async () => {
|
|
321
|
+
const { port1, port2 } = new MessageChannel();
|
|
322
|
+
const portId = await call('connect', { port: port1 }, [port1]);
|
|
323
|
+
portMap.set(port2, portId);
|
|
324
|
+
return port2;
|
|
359
325
|
};
|
|
360
326
|
},
|
|
361
|
-
|
|
362
|
-
return (
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
scheduledTimeoutsState.delete(timerId);
|
|
367
|
-
});
|
|
327
|
+
disconnect: ({ call }) => {
|
|
328
|
+
return async (port) => {
|
|
329
|
+
const portId = portMap.get(port);
|
|
330
|
+
if (portId === undefined) {
|
|
331
|
+
throw new Error('The given port is not connected.');
|
|
368
332
|
}
|
|
333
|
+
await call('disconnect', { portId });
|
|
369
334
|
};
|
|
370
335
|
},
|
|
371
|
-
|
|
372
|
-
return (
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
};
|
|
397
|
-
},
|
|
398
|
-
setTimeout: ({ call }) => {
|
|
399
|
-
return (func, delay = 0, ...args) => {
|
|
400
|
-
const symbol = Symbol();
|
|
401
|
-
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
402
|
-
scheduledTimeoutsState.set(timerId, symbol);
|
|
403
|
-
call('set', {
|
|
404
|
-
delay,
|
|
405
|
-
now: performance.timeOrigin + performance.now(),
|
|
406
|
-
timerId,
|
|
407
|
-
timerType: 'timeout'
|
|
408
|
-
}).then(() => {
|
|
409
|
-
const state = scheduledTimeoutsState.get(timerId);
|
|
410
|
-
if (state === undefined) {
|
|
411
|
-
throw new Error('The timer is in an undefined state.');
|
|
412
|
-
}
|
|
413
|
-
if (state === symbol) {
|
|
414
|
-
// A timeout can be savely deleted because it is only called once.
|
|
415
|
-
scheduledTimeoutsState.delete(timerId);
|
|
416
|
-
func(...args);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
return timerId;
|
|
420
|
-
};
|
|
336
|
+
isSupported: ({ call }) => {
|
|
337
|
+
return () => call('isSupported');
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
const isMessagePort = (sender) => {
|
|
342
|
+
return typeof sender.start === 'function';
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
const createBroker = createBrokerFactory(createCreateOrGetOngoingRequests(new WeakMap()), createExtendBrokerImplementation(new WeakMap()), generateUniqueNumber, isMessagePort);
|
|
346
|
+
|
|
347
|
+
const createClearIntervalFactory = (scheduledIntervalsState) => (clear) => (timerId) => {
|
|
348
|
+
if (typeof scheduledIntervalsState.get(timerId) === 'symbol') {
|
|
349
|
+
scheduledIntervalsState.set(timerId, null);
|
|
350
|
+
clear(timerId).then(() => {
|
|
351
|
+
scheduledIntervalsState.delete(timerId);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
const createClearTimeoutFactory = (scheduledTimeoutsState) => (clear) => (timerId) => {
|
|
357
|
+
if (typeof scheduledTimeoutsState.get(timerId) === 'symbol') {
|
|
358
|
+
scheduledTimeoutsState.set(timerId, null);
|
|
359
|
+
clear(timerId).then(() => {
|
|
360
|
+
scheduledTimeoutsState.delete(timerId);
|
|
361
|
+
});
|
|
421
362
|
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
const createSetIntervalFactory = (generateUniqueNumber, scheduledIntervalsState) => (set) => (func, delay = 0, ...args) => {
|
|
366
|
+
const symbol = Symbol();
|
|
367
|
+
const timerId = generateUniqueNumber(scheduledIntervalsState);
|
|
368
|
+
scheduledIntervalsState.set(timerId, symbol);
|
|
369
|
+
const schedule = () => set(delay, timerId).then(() => {
|
|
370
|
+
const state = scheduledIntervalsState.get(timerId);
|
|
371
|
+
if (state === undefined) {
|
|
372
|
+
throw new Error('The timer is in an undefined state.');
|
|
373
|
+
}
|
|
374
|
+
if (state === symbol) {
|
|
375
|
+
func(...args);
|
|
376
|
+
// Doublecheck if the interval should still be rescheduled because it could have been cleared inside of func().
|
|
377
|
+
if (scheduledIntervalsState.get(timerId) === symbol) {
|
|
378
|
+
schedule();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
schedule();
|
|
383
|
+
return timerId;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const createSetTimeoutFactory = (generateUniqueNumber, scheduledTimeoutsState) => (set) => (func, delay = 0, ...args) => {
|
|
387
|
+
const symbol = Symbol();
|
|
388
|
+
const timerId = generateUniqueNumber(scheduledTimeoutsState);
|
|
389
|
+
scheduledTimeoutsState.set(timerId, symbol);
|
|
390
|
+
set(delay, timerId).then(() => {
|
|
391
|
+
const state = scheduledTimeoutsState.get(timerId);
|
|
392
|
+
if (state === undefined) {
|
|
393
|
+
throw new Error('The timer is in an undefined state.');
|
|
394
|
+
}
|
|
395
|
+
if (state === symbol) {
|
|
396
|
+
// A timeout can be savely deleted because it is only called once.
|
|
397
|
+
scheduledTimeoutsState.delete(timerId);
|
|
398
|
+
func(...args);
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
return timerId;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.
|
|
405
|
+
const scheduledIntervalsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
406
|
+
const scheduledTimeoutsState = new Map([[0, null]]); // tslint:disable-line no-empty
|
|
407
|
+
const createClearInterval = createClearIntervalFactory(scheduledIntervalsState);
|
|
408
|
+
const createClearTimeout = createClearTimeoutFactory(scheduledTimeoutsState);
|
|
409
|
+
const createSetInterval = createSetIntervalFactory(generateUniqueNumber, scheduledIntervalsState);
|
|
410
|
+
const createSetTimeout = createSetTimeoutFactory(generateUniqueNumber, scheduledTimeoutsState);
|
|
411
|
+
const wrap = createBroker({
|
|
412
|
+
clearInterval: ({ call }) => createClearInterval((timerId) => call('clear', { timerId, timerType: 'interval' })),
|
|
413
|
+
clearTimeout: ({ call }) => createClearTimeout((timerId) => call('clear', { timerId, timerType: 'timeout' })),
|
|
414
|
+
setInterval: ({ call }) => createSetInterval((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'interval' })),
|
|
415
|
+
setTimeout: ({ call }) => createSetTimeout((delay, timerId) => call('set', { delay, now: performance.timeOrigin + performance.now(), timerId, timerType: 'timeout' }))
|
|
422
416
|
});
|
|
423
417
|
const load = (url) => {
|
|
424
418
|
const worker = new Worker(url);
|
|
@@ -441,7 +435,7 @@ define((function () { 'use strict';
|
|
|
441
435
|
};
|
|
442
436
|
|
|
443
437
|
// This is the minified and stringified code of the worker-timers-worker package.
|
|
444
|
-
const worker = `(()=>{var e={455
|
|
438
|
+
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
|
|
445
439
|
|
|
446
440
|
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
447
441
|
const clearInterval$1 = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
@@ -7389,9 +7383,7 @@ define((function () { 'use strict';
|
|
|
7389
7383
|
* 取消绑定 显示事件
|
|
7390
7384
|
*/
|
|
7391
7385
|
offShowEvent() {
|
|
7392
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show,
|
|
7393
|
-
capture: true,
|
|
7394
|
-
});
|
|
7386
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onShowEventName, this.show, this.$data.config.eventOption);
|
|
7395
7387
|
}
|
|
7396
7388
|
/**
|
|
7397
7389
|
* 关闭提示框
|
|
@@ -7450,9 +7442,7 @@ define((function () { 'use strict';
|
|
|
7450
7442
|
* 取消绑定 关闭事件
|
|
7451
7443
|
*/
|
|
7452
7444
|
offCloseEvent() {
|
|
7453
|
-
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close,
|
|
7454
|
-
capture: true,
|
|
7455
|
-
});
|
|
7445
|
+
popsDOMUtils.off(this.$data.config.$target, this.$data.config.onCloseEventName, this.close, this.$data.config.eventOption);
|
|
7456
7446
|
}
|
|
7457
7447
|
/**
|
|
7458
7448
|
* 销毁元素
|
|
@@ -13339,7 +13329,7 @@ define((function () { 'use strict';
|
|
|
13339
13329
|
},
|
|
13340
13330
|
};
|
|
13341
13331
|
|
|
13342
|
-
const version = "3.1.
|
|
13332
|
+
const version = "3.1.3";
|
|
13343
13333
|
|
|
13344
13334
|
class Pops {
|
|
13345
13335
|
/** 配置 */
|