@whitesev/pops 3.1.0 → 3.1.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.
@@ -1,27 +1,19 @@
1
- interface PopsCoreOption {
1
+ declare const PopsCoreDefaultEnv: {
2
2
  document: Document;
3
- window: Window;
3
+ window: Window & typeof globalThis;
4
4
  globalThis: typeof globalThis;
5
- self: typeof globalThis;
6
- setTimeout: Window["setTimeout"];
7
- setInterval: Window["setInterval"];
8
- clearTimeout: Window["clearTimeout"];
9
- clearInterval: Window["clearInterval"];
10
- }
5
+ self: Window & typeof globalThis;
6
+ };
11
7
  declare const PopsCore: {
12
- init(option?: PopsCoreOption): void;
8
+ init(option?: typeof PopsCoreDefaultEnv): void;
13
9
  readonly document: Document;
14
- readonly window: Window;
10
+ readonly window: Window & typeof globalThis;
15
11
  readonly globalThis: typeof globalThis;
16
- readonly self: typeof globalThis;
17
- readonly setTimeout: (handler: TimerHandler, timeout?: number, ...arguments: any[]) => number;
18
- readonly setInterval: (handler: TimerHandler, timeout?: number, ...arguments: any[]) => number;
19
- readonly clearTimeout: (id: number | undefined) => void;
20
- readonly clearInterval: (id: number | undefined) => void;
12
+ readonly self: Window & typeof globalThis;
21
13
  };
22
14
  declare const OriginPrototype: {
23
15
  Object: {
24
16
  defineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
25
17
  };
26
18
  };
27
- export { PopsCoreOption, PopsCore, OriginPrototype };
19
+ export { PopsCore, OriginPrototype };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "弹窗库,包含了alert、confirm、prompt、drawer、loading、iframe、rightClickMenu等组件",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
package/src/PopsCore.ts CHANGED
@@ -1,29 +1,14 @@
1
- interface PopsCoreOption {
2
- document: Document;
3
- window: Window;
4
- globalThis: typeof globalThis;
5
- self: typeof globalThis;
6
- setTimeout: Window["setTimeout"];
7
- setInterval: Window["setInterval"];
8
- clearTimeout: Window["clearTimeout"];
9
- clearInterval: Window["clearInterval"];
10
- }
11
-
12
- const PopsCoreDefaultEnv: PopsCoreOption = {
1
+ const PopsCoreDefaultEnv = {
13
2
  document: document,
14
3
  window: window,
15
4
  globalThis: globalThis,
16
5
  self: self,
17
- setTimeout: globalThis.setTimeout.bind(globalThis),
18
- setInterval: globalThis.setInterval.bind(globalThis),
19
- clearTimeout: globalThis.clearTimeout.bind(globalThis),
20
- clearInterval: globalThis.clearInterval.bind(globalThis),
21
6
  };
22
7
 
23
- const PopsCoreEnv: PopsCoreOption = Object.assign({}, PopsCoreDefaultEnv);
8
+ const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
24
9
 
25
10
  const PopsCore = {
26
- init(option?: PopsCoreOption) {
11
+ init(option?: typeof PopsCoreDefaultEnv) {
27
12
  if (!option) {
28
13
  option = Object.assign({}, PopsCoreDefaultEnv);
29
14
  }
@@ -41,18 +26,6 @@ const PopsCore = {
41
26
  get self() {
42
27
  return PopsCoreEnv.self;
43
28
  },
44
- get setTimeout() {
45
- return PopsCoreEnv.setTimeout;
46
- },
47
- get setInterval() {
48
- return PopsCoreEnv.setInterval;
49
- },
50
- get clearTimeout() {
51
- return PopsCoreEnv.clearTimeout;
52
- },
53
- get clearInterval() {
54
- return PopsCoreEnv.clearInterval;
55
- },
56
29
  };
57
30
 
58
31
  const OriginPrototype = {
@@ -61,4 +34,4 @@ const OriginPrototype = {
61
34
  },
62
35
  };
63
36
 
64
- export { PopsCoreOption, PopsCore, OriginPrototype };
37
+ export { PopsCore, OriginPrototype };
@@ -907,6 +907,7 @@ section.pops-panel-container .pops-panel-slider input[type="range"]::-moz-range-
907
907
  border: 0;
908
908
  }
909
909
  .pops-panel-select select {
910
+ width: 100%;
910
911
  height: 32px;
911
912
  line-height: normal;
912
913
  align-content: center;
@@ -359,7 +359,7 @@ class PopsUtils {
359
359
  try {
360
360
  return WorkerSetTimeout(callback, timeout);
361
361
  } catch {
362
- return PopsCore.setTimeout(callback, timeout);
362
+ return setTimeout(callback, timeout);
363
363
  }
364
364
  }
365
365
  /**
@@ -373,7 +373,7 @@ class PopsUtils {
373
373
  } catch {
374
374
  // TODO
375
375
  } finally {
376
- PopsCore.clearTimeout(timeId);
376
+ clearTimeout(timeId);
377
377
  }
378
378
  }
379
379
  /**
@@ -383,7 +383,7 @@ class PopsUtils {
383
383
  try {
384
384
  return WorkerSetInterval(callback, timeout);
385
385
  } catch {
386
- return PopsCore.setInterval(callback, timeout);
386
+ return setInterval(callback, timeout);
387
387
  }
388
388
  }
389
389
  /**
@@ -397,7 +397,7 @@ class PopsUtils {
397
397
  } catch {
398
398
  // 忽略
399
399
  } finally {
400
- PopsCore.clearInterval(timeId);
400
+ clearInterval(timeId);
401
401
  }
402
402
  }
403
403
  /**