@pisell/materials 2.2.41 → 2.2.43

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 (137) hide show
  1. package/es/components/TimeResourceSelector/index.d.ts +21 -0
  2. package/es/components/TimeResourceSelector/index.js +115 -0
  3. package/es/components/TimeResourceSelector/index.less +59 -0
  4. package/es/components/pisellAnchor/index.d.ts +15 -0
  5. package/es/components/pisellAnchor/index.js +126 -0
  6. package/es/components/pisellAnchor/index.less +177 -0
  7. package/es/components/pisellAvatar/index.d.ts +19 -0
  8. package/es/components/pisellAvatar/index.js +90 -0
  9. package/es/components/pisellAvatar/index.less +26 -0
  10. package/es/components/pisellCard/index.d.ts +8 -0
  11. package/es/components/pisellCard/index.js +34 -5
  12. package/es/components/pisellCard/index.less +31 -4
  13. package/es/components/pisellCustomCheckboxGroup/index.d.ts +16 -0
  14. package/es/components/pisellCustomCheckboxGroup/index.js +72 -0
  15. package/es/components/pisellCustomCheckboxGroup/index.less +0 -0
  16. package/es/components/pisellDropdown/index.d.ts +20 -0
  17. package/es/components/pisellDropdown/index.js +51 -0
  18. package/es/components/pisellDropdown/index.less +44 -0
  19. package/es/components/pisellEmpty/index.d.ts +2 -1
  20. package/es/components/pisellHeaderProgressBar/index.d.ts +29 -0
  21. package/es/components/pisellHeaderProgressBar/index.js +76 -0
  22. package/es/components/pisellHeaderProgressBar/index.less +18 -0
  23. package/es/components/pisellImageCarousels/index.d.ts +18 -0
  24. package/es/components/pisellImageCarousels/index.js +108 -0
  25. package/es/components/pisellImageCarousels/index.less +92 -0
  26. package/es/components/pisellList01/index.d.ts +17 -0
  27. package/es/components/pisellList01/index.js +105 -0
  28. package/es/components/pisellList01/index.less +53 -0
  29. package/es/components/pisellSectionHeaders/index.d.ts +21 -0
  30. package/es/components/pisellSectionHeaders/index.js +35 -0
  31. package/es/components/pisellSectionHeaders/index.less +46 -0
  32. package/es/components/pisellViewGrid/index.d.ts +16 -0
  33. package/es/components/pisellViewGrid/index.js +66 -0
  34. package/es/components/pisellViewGrid/index.less +31 -0
  35. package/es/components/productCard/components/Header/index.js +3 -2
  36. package/es/components/productCard/hooks/useOpenNote.js +3 -2
  37. package/es/components/productCard/index.js +7 -3
  38. package/es/components/productCard/index.less +6 -2
  39. package/es/components/productCard/status.js +3 -1
  40. package/es/components/productCard/types.d.ts +2 -0
  41. package/es/components/productCard/utils.js +17 -1
  42. package/es/components/section-footers/index.d.ts +9 -0
  43. package/es/components/section-footers/index.js +17 -0
  44. package/es/components/section-footers/index.less +5 -0
  45. package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
  46. package/es/components/table/Actions/component/ExportImport/utils/index.js +11 -0
  47. package/es/index.d.ts +10 -0
  48. package/es/index.js +11 -1
  49. package/lib/components/TimeResourceSelector/index.d.ts +21 -0
  50. package/lib/components/TimeResourceSelector/index.js +109 -0
  51. package/lib/components/TimeResourceSelector/index.less +59 -0
  52. package/lib/components/pisellAnchor/index.d.ts +15 -0
  53. package/lib/components/pisellAnchor/index.js +120 -0
  54. package/lib/components/pisellAnchor/index.less +177 -0
  55. package/lib/components/pisellAvatar/index.d.ts +19 -0
  56. package/lib/components/pisellAvatar/index.js +108 -0
  57. package/lib/components/pisellAvatar/index.less +26 -0
  58. package/lib/components/pisellCard/index.d.ts +8 -0
  59. package/lib/components/pisellCard/index.js +30 -7
  60. package/lib/components/pisellCard/index.less +31 -4
  61. package/lib/components/pisellCustomCheckboxGroup/index.d.ts +16 -0
  62. package/lib/components/pisellCustomCheckboxGroup/index.js +71 -0
  63. package/lib/components/pisellCustomCheckboxGroup/index.less +0 -0
  64. package/lib/components/pisellDropdown/index.d.ts +20 -0
  65. package/lib/components/pisellDropdown/index.js +72 -0
  66. package/lib/components/pisellDropdown/index.less +44 -0
  67. package/lib/components/pisellEmpty/index.d.ts +2 -1
  68. package/lib/components/pisellHeaderProgressBar/index.d.ts +29 -0
  69. package/lib/components/pisellHeaderProgressBar/index.js +88 -0
  70. package/lib/components/pisellHeaderProgressBar/index.less +18 -0
  71. package/lib/components/pisellImageCarousels/index.d.ts +18 -0
  72. package/lib/components/pisellImageCarousels/index.js +108 -0
  73. package/lib/components/pisellImageCarousels/index.less +92 -0
  74. package/lib/components/pisellList01/index.d.ts +17 -0
  75. package/lib/components/pisellList01/index.js +113 -0
  76. package/lib/components/pisellList01/index.less +53 -0
  77. package/lib/components/pisellSectionHeaders/index.d.ts +21 -0
  78. package/lib/components/pisellSectionHeaders/index.js +52 -0
  79. package/lib/components/pisellSectionHeaders/index.less +46 -0
  80. package/lib/components/pisellViewGrid/index.d.ts +16 -0
  81. package/lib/components/pisellViewGrid/index.js +98 -0
  82. package/lib/components/pisellViewGrid/index.less +31 -0
  83. package/lib/components/productCard/components/Header/index.js +3 -2
  84. package/lib/components/productCard/hooks/useOpenNote.js +2 -1
  85. package/lib/components/productCard/index.js +9 -4
  86. package/lib/components/productCard/index.less +6 -2
  87. package/lib/components/productCard/status.js +3 -1
  88. package/lib/components/productCard/types.d.ts +2 -0
  89. package/lib/components/productCard/utils.js +15 -4
  90. package/lib/components/section-footers/index.d.ts +9 -0
  91. package/lib/components/section-footers/index.js +44 -0
  92. package/lib/components/section-footers/index.less +5 -0
  93. package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
  94. package/lib/components/table/Actions/component/ExportImport/utils/index.js +31 -0
  95. package/lib/index.d.ts +10 -0
  96. package/lib/index.js +30 -0
  97. package/lowcode/pisell-anchor/meta.ts +118 -0
  98. package/lowcode/pisell-anchor/snippets.ts +26 -0
  99. package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
  100. package/lowcode/pisell-avatar/meta.ts +111 -0
  101. package/lowcode/pisell-avatar/snippets.ts +14 -0
  102. package/lowcode/pisell-card/meta.ts +62 -27
  103. package/lowcode/pisell-card/snippets.ts +6 -0
  104. package/lowcode/pisell-custom-checkbox-group/__screenshots__/card-1.png +0 -0
  105. package/lowcode/pisell-custom-checkbox-group/meta.ts +204 -0
  106. package/lowcode/pisell-custom-checkbox-group/snippets.ts +56 -0
  107. package/lowcode/pisell-dropdown/__screenshots__/dropdown-1.png +0 -0
  108. package/lowcode/pisell-dropdown/meta.ts +180 -0
  109. package/lowcode/pisell-dropdown/snippets.ts +69 -0
  110. package/lowcode/pisell-header-progress-bar/meta.ts +116 -0
  111. package/lowcode/pisell-header-progress-bar/snippets.ts +24 -0
  112. package/lowcode/pisell-image-carousels/meta.ts +143 -0
  113. package/lowcode/pisell-image-carousels/snippets.ts +20 -0
  114. package/lowcode/pisell-list01/meta.ts +74 -0
  115. package/lowcode/pisell-list01/snippets.ts +35 -0
  116. package/lowcode/pisell-section-headers/meta.ts +91 -0
  117. package/lowcode/pisell-section-headers/snippets.ts +22 -0
  118. package/lowcode/pisell-view-grid/__screenshots__/card-1.png +0 -0
  119. package/lowcode/pisell-view-grid/meta.ts +167 -0
  120. package/lowcode/pisell-view-grid/snippets.ts +54 -0
  121. package/lowcode/section-footers/meta.ts +66 -0
  122. package/lowcode/section-footers/snippe.ts +21 -0
  123. package/package.json +4 -3
  124. package/build/lowcode/assets-daily.json +0 -93
  125. package/build/lowcode/assets-dev.json +0 -93
  126. package/build/lowcode/assets-prod.json +0 -93
  127. package/build/lowcode/designer.html +0 -303
  128. package/build/lowcode/index.html +0 -305
  129. package/build/lowcode/index.js +0 -1
  130. package/build/lowcode/meta.js +0 -9
  131. package/build/lowcode/preview.css +0 -1
  132. package/build/lowcode/preview.html +0 -35
  133. package/build/lowcode/preview.js +0 -304
  134. package/build/lowcode/render/default/view.css +0 -1
  135. package/build/lowcode/render/default/view.js +0 -232
  136. package/build/lowcode/view.css +0 -1
  137. package/build/lowcode/view.js +0 -232
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "2.2.41",
3
+ "version": "2.2.43",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -63,9 +63,10 @@
63
63
  "react-virtualized-auto-sizer": "^1.0.20",
64
64
  "crypto-js": "^4.2.0",
65
65
  "@zxing/library": "0.21.2",
66
- "@pisell/date-picker": "1.0.101",
66
+ "swiper": "^8.4.7",
67
+ "@pisell/utils": "2.0.1",
67
68
  "@pisell/icon": "0.0.11",
68
- "@pisell/utils": "2.0.1"
69
+ "@pisell/date-picker": "1.0.101"
69
70
  },
70
71
  "peerDependencies": {
71
72
  "react": "^18.0.0",
@@ -1,93 +0,0 @@
1
- {
2
- "packages": [
3
- {
4
- "package": "dayjs",
5
- "version": "1.11.7",
6
- "urls": "https://g.alicdn.com/code/lib/dayjs/1.11.7/dayjs.min.js",
7
- "library": "dayjs"
8
- },
9
- {
10
- "package": "iconfont-icons",
11
- "urls": "//at.alicdn.com/t/font_2369445_ukrtsovd92r.js"
12
- },
13
- {
14
- "package": "@ant-design/icons",
15
- "version": "4.7.0",
16
- "urls": [
17
- "//g.alicdn.com/code/npm/@ali/ant-design-icons-cdn/4.5.0/index.umd.min.js"
18
- ],
19
- "library": "icons"
20
- },
21
- {
22
- "package": "antd",
23
- "version": "5.12.8",
24
- "urls": [
25
- "https://g.alicdn.com/code/lib/antd/5.12.8/antd.min.js"
26
- ],
27
- "library": "antd"
28
- },
29
- {
30
- "package": "@pisell/materials",
31
- "version": "2.2.40",
32
- "library": "BaseMaterials",
33
- "urls": [
34
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.js",
35
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.css"
36
- ],
37
- "editUrls": [
38
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/view.js",
39
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/view.css"
40
- ],
41
- "advancedUrls": {
42
- "default": [
43
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.js",
44
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.css"
45
- ]
46
- },
47
- "advancedEditUrls": {}
48
- }
49
- ],
50
- "components": [
51
- {
52
- "exportName": "PisellMaterialsMeta",
53
- "npm": {
54
- "package": "@pisell/materials",
55
- "version": "2.2.40"
56
- },
57
- "url": "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/meta.js",
58
- "urls": {
59
- "default": "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/meta.js"
60
- },
61
- "advancedUrls": {
62
- "default": [
63
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/meta.js"
64
- ]
65
- }
66
- }
67
- ],
68
- "sort": {
69
- "groupList": [
70
- "精选组件",
71
- "原子组件"
72
- ],
73
- "categoryList": [
74
- "基础元素",
75
- "布局容器类",
76
- "表格类",
77
- "表单详情类",
78
- "帮助类",
79
- "对话框类",
80
- "业务类",
81
- "通用",
82
- "引导",
83
- "信息输入",
84
- "信息展示",
85
- "信息反馈"
86
- ]
87
- },
88
- "groupList": [
89
- "精选组件",
90
- "原子组件"
91
- ],
92
- "ignoreComponents": {}
93
- }
@@ -1,93 +0,0 @@
1
- {
2
- "packages": [
3
- {
4
- "package": "dayjs",
5
- "version": "1.11.7",
6
- "urls": "https://g.alicdn.com/code/lib/dayjs/1.11.7/dayjs.min.js",
7
- "library": "dayjs"
8
- },
9
- {
10
- "package": "iconfont-icons",
11
- "urls": "//at.alicdn.com/t/font_2369445_ukrtsovd92r.js"
12
- },
13
- {
14
- "package": "@ant-design/icons",
15
- "version": "4.7.0",
16
- "urls": [
17
- "//g.alicdn.com/code/npm/@ali/ant-design-icons-cdn/4.5.0/index.umd.min.js"
18
- ],
19
- "library": "icons"
20
- },
21
- {
22
- "package": "antd",
23
- "version": "5.12.8",
24
- "urls": [
25
- "https://g.alicdn.com/code/lib/antd/5.12.8/antd.min.js"
26
- ],
27
- "library": "antd"
28
- },
29
- {
30
- "package": "@pisell/materials",
31
- "version": "2.2.40",
32
- "library": "BaseMaterials",
33
- "urls": [
34
- "./render/default/view.js",
35
- "./render/default/view.css"
36
- ],
37
- "editUrls": [
38
- "./view.js",
39
- "./view.css"
40
- ],
41
- "advancedUrls": {
42
- "default": [
43
- "./render/default/view.js",
44
- "./render/default/view.css"
45
- ]
46
- },
47
- "advancedEditUrls": {}
48
- }
49
- ],
50
- "components": [
51
- {
52
- "exportName": "PisellMaterialsMeta",
53
- "npm": {
54
- "package": "@pisell/materials",
55
- "version": "2.2.40"
56
- },
57
- "url": "./meta.js",
58
- "urls": {
59
- "default": "./meta.js"
60
- },
61
- "advancedUrls": {
62
- "default": [
63
- "./meta.js"
64
- ]
65
- }
66
- }
67
- ],
68
- "sort": {
69
- "groupList": [
70
- "精选组件",
71
- "原子组件"
72
- ],
73
- "categoryList": [
74
- "基础元素",
75
- "布局容器类",
76
- "表格类",
77
- "表单详情类",
78
- "帮助类",
79
- "对话框类",
80
- "业务类",
81
- "通用",
82
- "引导",
83
- "信息输入",
84
- "信息展示",
85
- "信息反馈"
86
- ]
87
- },
88
- "groupList": [
89
- "精选组件",
90
- "原子组件"
91
- ],
92
- "ignoreComponents": {}
93
- }
@@ -1,93 +0,0 @@
1
- {
2
- "packages": [
3
- {
4
- "package": "dayjs",
5
- "version": "1.11.7",
6
- "urls": "https://g.alicdn.com/code/lib/dayjs/1.11.7/dayjs.min.js",
7
- "library": "dayjs"
8
- },
9
- {
10
- "package": "iconfont-icons",
11
- "urls": "//at.alicdn.com/t/font_2369445_ukrtsovd92r.js"
12
- },
13
- {
14
- "package": "@ant-design/icons",
15
- "version": "4.7.0",
16
- "urls": [
17
- "//g.alicdn.com/code/npm/@ali/ant-design-icons-cdn/4.5.0/index.umd.min.js"
18
- ],
19
- "library": "icons"
20
- },
21
- {
22
- "package": "antd",
23
- "version": "5.12.8",
24
- "urls": [
25
- "https://g.alicdn.com/code/lib/antd/5.12.8/antd.min.js"
26
- ],
27
- "library": "antd"
28
- },
29
- {
30
- "package": "@pisell/materials",
31
- "version": "2.2.40",
32
- "library": "BaseMaterials",
33
- "urls": [
34
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.js",
35
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.css"
36
- ],
37
- "editUrls": [
38
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/view.js",
39
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/view.css"
40
- ],
41
- "advancedUrls": {
42
- "default": [
43
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.js",
44
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/render/default/view.css"
45
- ]
46
- },
47
- "advancedEditUrls": {}
48
- }
49
- ],
50
- "components": [
51
- {
52
- "exportName": "PisellMaterialsMeta",
53
- "npm": {
54
- "package": "@pisell/materials",
55
- "version": "2.2.40"
56
- },
57
- "url": "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/meta.js",
58
- "urls": {
59
- "default": "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/meta.js"
60
- },
61
- "advancedUrls": {
62
- "default": [
63
- "https://unpkg.com/@pisell/materials@2.2.40/build/lowcode/meta.js"
64
- ]
65
- }
66
- }
67
- ],
68
- "sort": {
69
- "groupList": [
70
- "精选组件",
71
- "原子组件"
72
- ],
73
- "categoryList": [
74
- "基础元素",
75
- "布局容器类",
76
- "表格类",
77
- "表单详情类",
78
- "帮助类",
79
- "对话框类",
80
- "业务类",
81
- "通用",
82
- "引导",
83
- "信息输入",
84
- "信息展示",
85
- "信息反馈"
86
- ]
87
- },
88
- "groupList": [
89
- "精选组件",
90
- "原子组件"
91
- ],
92
- "ignoreComponents": {}
93
- }
@@ -1,303 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta http-equiv="X-UA-Compatible" content="ie=edge" />
7
- <title>DEMO 预览</title>
8
- <style>
9
- body {
10
- font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial,
11
- PingFang SC-Light, Microsoft YaHei;
12
- font-size: 12px;
13
-
14
- * {
15
- box-sizing: border-box;
16
- }
17
- }
18
-
19
- body,
20
- #lce-container {
21
- position: fixed;
22
- left: 0;
23
- right: 0;
24
- bottom: 0;
25
- top: 0;
26
- box-sizing: border-box;
27
- padding: 0;
28
- margin: 0;
29
- overflow: hidden;
30
- text-rendering: optimizeLegibility;
31
- -webkit-user-select: none;
32
- -webkit-user-drag: none;
33
- -webkit-text-size-adjust: none;
34
- -webkit-touch-callout: none;
35
- -webkit-font-smoothing: antialiased;
36
- }
37
-
38
- html {
39
- min-width: 1024px;
40
- }
41
- </style>
42
- </head>
43
-
44
- <body>
45
- <link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/css/engine-core.css" />
46
- <link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6-beta.25/dist/css/engine-ext.css" />
47
- <link rel="stylesheet" href="https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.css" />
48
- <link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
49
- <link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
50
- <div id="lce-container"></div>
51
- <script src="https://g.alicdn.com/code/lib/rax/1.1.0/rax.umd.min.js"></script>
52
- <script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
53
- <script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
54
- <script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
55
- <script>
56
- React.PropTypes = PropTypes;
57
- </script>
58
- <script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js,immutable/3.7.6/dist/immutable.min.js,natty-storage/2.0.2/dist/natty-storage.min.js,natty-fetch/2.6.0/dist/natty-fetch.pc.min.js,tinymce/4.2.5/tinymce-full.js"></script>
59
- <script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
60
- <script src="https://g.alicdn.com/code/lib/dayjs/1.11.7/dayjs.min.js"></script>
61
- <script src="https://g.alicdn.com/code/lib/alifd__next/1.23.20/next-with-locales.min.js"></script>
62
- <script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/js/engine-core.js"></script>
63
- <script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6-beta.25/dist/js/engine-ext.js"></script>
64
- <script>
65
- if (!window.AliLowCodeEngine.common) {
66
- window.AliLowCodeEngine.common = {
67
- designerCabin: window.AliLowCodeEngine.designerCabin,
68
- editorCabin: window.AliLowCodeEngine.editorCabin,
69
- skeletonCabin: window.AliLowCodeEngine.skeletonCabin,
70
- utils: window.AliLowCodeEngine.utils,
71
- };
72
- }
73
- </script>
74
- <script src="https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.js"></script>
75
- <script type="text/javascript" charset="utf-8" src="./index.js"></script>
76
- <script>
77
- (function (factory) {
78
- if (typeof define === 'function' && define.amd) {
79
- define([], factory);
80
- } else if (typeof module === 'object' && module.exports) {
81
- module.exports = factory();
82
- } else {
83
- window.idleCallbackShim = factory();
84
- }
85
- })(function () {
86
- 'use strict';
87
- var scheduleStart, throttleDelay, lazytimer, lazyraf;
88
- var root =
89
- typeof window != 'undefined' ? window : typeof global != undefined ? global : this || {};
90
- var requestAnimationFrame =
91
- (root.cancelRequestAnimationFrame && root.requestAnimationFrame) || setTimeout;
92
- var cancelRequestAnimationFrame = root.cancelRequestAnimationFrame || clearTimeout;
93
- var tasks = [];
94
- var runAttempts = 0;
95
- var isRunning = false;
96
- var remainingTime = 7;
97
- var minThrottle = 35;
98
- var throttle = 125;
99
- var index = 0;
100
- var taskStart = 0;
101
- var tasklength = 0;
102
- var IdleDeadline = {
103
- get didTimeout() {
104
- return false;
105
- },
106
- timeRemaining: function () {
107
- var timeRemaining = remainingTime - (Date.now() - taskStart);
108
- return Math.max(0, timeRemaining);
109
- },
110
- };
111
- var setInactive = debounce(function () {
112
- remainingTime = 22;
113
- throttle = 66;
114
- minThrottle = 0;
115
- });
116
-
117
- function debounce(fn) {
118
- var id, timestamp;
119
- var wait = 99;
120
- var check = function () {
121
- var last = Date.now() - timestamp;
122
-
123
- if (last < wait) {
124
- id = setTimeout(check, wait - last);
125
- } else {
126
- id = null;
127
- fn();
128
- }
129
- };
130
- return function () {
131
- timestamp = Date.now();
132
- if (!id) {
133
- id = setTimeout(check, wait);
134
- }
135
- };
136
- }
137
-
138
- function abortRunning() {
139
- if (isRunning) {
140
- if (lazyraf) {
141
- cancelRequestAnimationFrame(lazyraf);
142
- }
143
- if (lazytimer) {
144
- clearTimeout(lazytimer);
145
- }
146
- isRunning = false;
147
- }
148
- }
149
-
150
- function onInputorMutation() {
151
- if (throttle != 125) {
152
- remainingTime = 7;
153
- throttle = 125;
154
- minThrottle = 35;
155
-
156
- if (isRunning) {
157
- abortRunning();
158
- scheduleLazy();
159
- }
160
- }
161
- setInactive();
162
- }
163
-
164
- function scheduleAfterRaf() {
165
- lazyraf = null;
166
- lazytimer = setTimeout(runTasks, 0);
167
- }
168
-
169
- function scheduleRaf() {
170
- lazytimer = null;
171
- requestAnimationFrame(scheduleAfterRaf);
172
- }
173
-
174
- function scheduleLazy() {
175
- if (isRunning) {
176
- return;
177
- }
178
- throttleDelay = throttle - (Date.now() - taskStart);
179
-
180
- scheduleStart = Date.now();
181
-
182
- isRunning = true;
183
-
184
- if (minThrottle && throttleDelay < minThrottle) {
185
- throttleDelay = minThrottle;
186
- }
187
-
188
- if (throttleDelay > 9) {
189
- lazytimer = setTimeout(scheduleRaf, throttleDelay);
190
- } else {
191
- throttleDelay = 0;
192
- scheduleRaf();
193
- }
194
- }
195
-
196
- function runTasks() {
197
- var task, i, len;
198
- var timeThreshold = remainingTime > 9 ? 9 : 1;
199
- taskStart = Date.now();
200
- isRunning = false;
201
-
202
- lazytimer = null;
203
-
204
- if (runAttempts > 2 || taskStart - throttleDelay - 50 < scheduleStart) {
205
- for (
206
- i = 0, len = tasks.length;
207
- i < len && IdleDeadline.timeRemaining() > timeThreshold;
208
- i++
209
- ) {
210
- task = tasks.shift();
211
- tasklength++;
212
- if (task) {
213
- task(IdleDeadline);
214
- }
215
- }
216
- }
217
-
218
- if (tasks.length) {
219
- scheduleLazy();
220
- } else {
221
- runAttempts = 0;
222
- }
223
- }
224
-
225
- function requestIdleCallbackShim(task) {
226
- index++;
227
- tasks.push(task);
228
- scheduleLazy();
229
- return index;
230
- }
231
-
232
- function cancelIdleCallbackShim(id) {
233
- var index = id - 1 - tasklength;
234
- if (tasks[index]) {
235
- tasks[index] = null;
236
- }
237
- }
238
-
239
- if (!root.requestIdleCallback || !root.cancelIdleCallback) {
240
- root.requestIdleCallback = requestIdleCallbackShim;
241
- root.cancelIdleCallback = cancelIdleCallbackShim;
242
-
243
- if (root.document && document.addEventListener) {
244
- root.addEventListener('scroll', onInputorMutation, true);
245
- root.addEventListener('resize', onInputorMutation);
246
-
247
- document.addEventListener('focus', onInputorMutation, true);
248
- document.addEventListener('mouseover', onInputorMutation, true);
249
- ['click', 'keypress', 'touchstart', 'mousedown'].forEach(function (name) {
250
- document.addEventListener(name, onInputorMutation, { capture: true, passive: true });
251
- });
252
-
253
- if (root.MutationObserver) {
254
- new MutationObserver(onInputorMutation).observe(document.documentElement, {
255
- childList: true,
256
- subtree: true,
257
- attributes: true,
258
- });
259
- }
260
- }
261
- } else {
262
- try {
263
- root.requestIdleCallback(function () {}, { timeout: 0 });
264
- } catch (e) {
265
- (function (rIC) {
266
- var timeRemainingProto, timeRemaining;
267
- root.requestIdleCallback = function (fn, timeout) {
268
- if (timeout && typeof timeout.timeout == 'number') {
269
- return rIC(fn, timeout.timeout);
270
- }
271
- return rIC(fn);
272
- };
273
- if (
274
- root.IdleCallbackDeadline &&
275
- (timeRemainingProto = IdleCallbackDeadline.prototype)
276
- ) {
277
- timeRemaining = Object.getOwnPropertyDescriptor(
278
- timeRemainingProto,
279
- 'timeRemaining',
280
- );
281
- if (!timeRemaining || !timeRemaining.configurable || !timeRemaining.get) {
282
- return;
283
- }
284
- Object.defineProperty(timeRemainingProto, 'timeRemaining', {
285
- value: function () {
286
- return timeRemaining.get.call(this);
287
- },
288
- enumerable: true,
289
- configurable: true,
290
- });
291
- }
292
- })(root.requestIdleCallback);
293
- }
294
- }
295
-
296
- return {
297
- request: requestIdleCallbackShim,
298
- cancel: cancelIdleCallbackShim,
299
- };
300
- });
301
- </script>
302
- </body>
303
- </html>