oipage 1.3.1 → 1.4.0-alpha.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.
Files changed (46) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +83 -76
  4. package/LICENSE +20 -20
  5. package/README.md +80 -80
  6. package/bin/data/mineTypes.json +104 -104
  7. package/bin/disk.js +31 -31
  8. package/bin/help.js +24 -24
  9. package/bin/intercept.js +15 -15
  10. package/bin/run +96 -96
  11. package/bin/serve.d.ts +55 -0
  12. package/bin/serve.js +131 -128
  13. package/bin/template/404.html +171 -171
  14. package/bin/tools/format.js +75 -75
  15. package/bin/tools/network.js +42 -42
  16. package/bin/tools/resolve404.js +83 -83
  17. package/bin/tools/resolveImport.js +88 -88
  18. package/nodejs/animation/index.d.ts +19 -19
  19. package/nodejs/animation/index.js +104 -104
  20. package/nodejs/cmdlog/index.d.ts +20 -20
  21. package/nodejs/cmdlog/index.js +75 -75
  22. package/nodejs/disk/index.d.ts +16 -16
  23. package/nodejs/disk/index.js +78 -78
  24. package/nodejs/json/index.d.ts +9 -9
  25. package/nodejs/json/index.js +206 -206
  26. package/nodejs/logform/index.d.ts +18 -18
  27. package/nodejs/logform/index.js +94 -94
  28. package/nodejs/reader/index.d.ts +32 -32
  29. package/nodejs/reader/index.js +20 -20
  30. package/nodejs/throttle/index.d.ts +30 -30
  31. package/nodejs/throttle/index.js +50 -50
  32. package/package.json +40 -40
  33. package/web/animation/index.d.ts +19 -19
  34. package/web/animation/index.js +104 -104
  35. package/web/json/index.d.ts +9 -9
  36. package/web/json/index.js +206 -206
  37. package/web/onReady/index.d.ts +7 -7
  38. package/web/onReady/index.js +8 -8
  39. package/web/performChunk/index.d.ts +4 -4
  40. package/web/performChunk/index.js +19 -19
  41. package/web/reader/index.d.ts +32 -32
  42. package/web/reader/index.js +20 -20
  43. package/web/style/index.d.ts +21 -21
  44. package/web/style/index.js +19 -19
  45. package/web/throttle/index.d.ts +30 -30
  46. package/web/throttle/index.js +50 -50
@@ -1,24 +1,24 @@
1
1
  /*!
2
- * style of OIPage v1.3.1
2
+ * style of OIPage v1.4.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
6
- export function setStyle(el, styles) {
7
- for (var key in styles) {
8
- el.style[key] = styles[key];
9
- }
10
- }
11
-
12
- export function getStyle(el, name) {
13
-
14
- // 获取结点的全部样式
15
- var allStyle = document.defaultView && document.defaultView.getComputedStyle ?
16
- document.defaultView.getComputedStyle(el, null) :
17
- el.currentStyle;
18
-
19
- // 如果没有指定属性名称,返回全部样式
20
- return typeof name === 'string' ?
21
- allStyle.getPropertyValue(name) :
22
- allStyle;
23
-
6
+ export function setStyle(el, styles) {
7
+ for (var key in styles) {
8
+ el.style[key] = styles[key];
9
+ }
10
+ }
11
+
12
+ export function getStyle(el, name) {
13
+
14
+ // 获取结点的全部样式
15
+ var allStyle = document.defaultView && document.defaultView.getComputedStyle ?
16
+ document.defaultView.getComputedStyle(el, null) :
17
+ el.currentStyle;
18
+
19
+ // 如果没有指定属性名称,返回全部样式
20
+ return typeof name === 'string' ?
21
+ allStyle.getPropertyValue(name) :
22
+ allStyle;
23
+
24
24
  }
@@ -1,31 +1,31 @@
1
- export type throttleOpportunityType = "begin" | "end" | "wide"
2
-
3
- export interface throttleOptionType {
4
-
5
- /**
6
- * 节流时长
7
- */
8
- time?: number
9
-
10
- /**
11
- * 是否持续节流
12
- */
13
- keep?: boolean
14
-
15
- /**
16
- * 执行时机
17
- *
18
- * begin(开始触发)、end(结束触发)、wide(第一次开始触发,其余结束触发)
19
- */
20
- opportunity?: throttleOpportunityType
21
-
22
- }
23
-
24
- /**
25
- * 节流函数
26
- */
27
- export interface throttleType {
28
- (callback: Function, option?: throttleOptionType): Function
29
- }
30
-
1
+ export type throttleOpportunityType = "begin" | "end" | "wide"
2
+
3
+ export interface throttleOptionType {
4
+
5
+ /**
6
+ * 节流时长
7
+ */
8
+ time?: number
9
+
10
+ /**
11
+ * 是否持续节流
12
+ */
13
+ keep?: boolean
14
+
15
+ /**
16
+ * 执行时机
17
+ *
18
+ * begin(开始触发)、end(结束触发)、wide(第一次开始触发,其余结束触发)
19
+ */
20
+ opportunity?: throttleOpportunityType
21
+
22
+ }
23
+
24
+ /**
25
+ * 节流函数
26
+ */
27
+ export interface throttleType {
28
+ (callback: Function, option?: throttleOptionType): Function
29
+ }
30
+
31
31
  export let throttle: throttleType
@@ -1,55 +1,55 @@
1
1
  /*!
2
- * throttle of OIPage v1.3.1
2
+ * throttle of OIPage v1.4.0-alpha.0
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
6
- export function throttle(callback, _option) {
7
-
8
- // 缺省值
9
- var option = {
10
- time: 200,
11
- keep: false,
12
- opportunity: "end"
13
- };
14
-
15
- // 校对
16
- if (_option) {
17
- for (var key in _option) {
18
- option[key] = _option[key];
19
- }
20
- }
21
-
22
- var hadInterval = false, hadClick = false, oneClick = false, arg;
23
- return function () {
24
- const _this = this;
25
- arg = arguments;
26
-
27
- // 如果前置任务都完成了
28
- if (!hadInterval) {
29
- if (option.opportunity != 'end') {
30
- callback.apply(_this, arg);
31
- }
32
- hadInterval = true;
33
-
34
- var interval = setInterval(() => {
35
- if (hadClick) {
36
- if (!option.keep) {
37
- callback.apply(_this, arg);
38
- }
39
- } else {
40
- if (option.opportunity != 'begin') {
41
- if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
42
- }
43
- hadInterval = false;
44
- oneClick = false;
45
- clearInterval(interval);
46
- }
47
- hadClick = false;
48
- }, option.time);
49
- } else {
50
- hadClick = true;
51
- oneClick = true;
52
- }
53
-
54
- };
6
+ export function throttle(callback, _option) {
7
+
8
+ // 缺省值
9
+ var option = {
10
+ time: 200,
11
+ keep: false,
12
+ opportunity: "end"
13
+ };
14
+
15
+ // 校对
16
+ if (_option) {
17
+ for (var key in _option) {
18
+ option[key] = _option[key];
19
+ }
20
+ }
21
+
22
+ var hadInterval = false, hadClick = false, oneClick = false, arg;
23
+ return function () {
24
+ const _this = this;
25
+ arg = arguments;
26
+
27
+ // 如果前置任务都完成了
28
+ if (!hadInterval) {
29
+ if (option.opportunity != 'end') {
30
+ callback.apply(_this, arg);
31
+ }
32
+ hadInterval = true;
33
+
34
+ var interval = setInterval(() => {
35
+ if (hadClick) {
36
+ if (!option.keep) {
37
+ callback.apply(_this, arg);
38
+ }
39
+ } else {
40
+ if (option.opportunity != 'begin') {
41
+ if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
42
+ }
43
+ hadInterval = false;
44
+ oneClick = false;
45
+ clearInterval(interval);
46
+ }
47
+ hadClick = false;
48
+ }, option.time);
49
+ } else {
50
+ hadClick = true;
51
+ oneClick = true;
52
+ }
53
+
54
+ };
55
55
  }