ydb-components-material 0.1.1
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/README.md +17 -0
- package/build/docs/404.html +47 -0
- package/build/docs/_demos/:uuid +47 -0
- package/build/docs/colorful-button.html +48 -0
- package/build/docs/colorful-input.html +48 -0
- package/build/docs/index.html +48 -0
- package/build/docs/umi.5f9a7940.css +8 -0
- package/build/docs/umi.6a874444.js +1 -0
- package/build/docs/~demos/:uuid.html +47 -0
- package/build/docs/~demos/colorful-button-demo.html +47 -0
- package/build/docs/~demos/colorful-input-demo.html +47 -0
- package/build/index.css +2 -0
- package/build/index.html +1 -0
- package/build/index.js +53 -0
- package/build/lowcode/assets-daily.json +67 -0
- package/build/lowcode/assets-dev.json +67 -0
- package/build/lowcode/assets-prod.json +67 -0
- package/build/lowcode/designer.html +302 -0
- package/build/lowcode/index.html +304 -0
- package/build/lowcode/index.js +1 -0
- package/build/lowcode/meta.js +1 -0
- package/build/lowcode/preview.css +1 -0
- package/build/lowcode/preview.html +33 -0
- package/build/lowcode/preview.js +309 -0
- package/build/lowcode/render/default/view.css +1 -0
- package/build/lowcode/render/default/view.js +1 -0
- package/build/lowcode/view.css +1 -0
- package/build/lowcode/view.js +1 -0
- package/dist/BizComps.css +1 -0
- package/dist/BizComps.js +2 -0
- package/dist/BizComps.js.map +1 -0
- package/es/components/colorful-button/colorful-button.d.ts +12 -0
- package/es/components/colorful-button/colorful-button.js +25 -0
- package/es/components/colorful-button/index.d.ts +3 -0
- package/es/components/colorful-button/index.js +2 -0
- package/es/components/colorful-button/index.scss +5 -0
- package/es/components/colorful-input/colorful-input.d.ts +8 -0
- package/es/components/colorful-input/colorful-input.js +19 -0
- package/es/components/colorful-input/index.d.ts +3 -0
- package/es/components/colorful-input/index.js +2 -0
- package/es/components/colorful-input/index.scss +5 -0
- package/es/index.d.ts +6 -0
- package/es/index.js +4 -0
- package/es/index.scss +2 -0
- package/es/style.js +3 -0
- package/es/variables.d.ts +2 -0
- package/es/variables.js +2 -0
- package/es/variables.scss +3 -0
- package/lib/components/colorful-button/colorful-button.d.ts +12 -0
- package/lib/components/colorful-button/colorful-button.js +31 -0
- package/lib/components/colorful-button/index.d.ts +3 -0
- package/lib/components/colorful-button/index.js +7 -0
- package/lib/components/colorful-button/index.scss +5 -0
- package/lib/components/colorful-input/colorful-input.d.ts +8 -0
- package/lib/components/colorful-input/colorful-input.js +25 -0
- package/lib/components/colorful-input/index.d.ts +3 -0
- package/lib/components/colorful-input/index.js +7 -0
- package/lib/components/colorful-input/index.scss +5 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +10 -0
- package/lib/index.scss +2 -0
- package/lib/style.js +3 -0
- package/lib/variables.d.ts +2 -0
- package/lib/variables.js +5 -0
- package/lib/variables.scss +3 -0
- package/lowcode/colorful-button/meta.ts +102 -0
- package/lowcode/colorful-input/meta.ts +56 -0
- package/lowcode_es/colorful-button/meta.d.ts +22 -0
- package/lowcode_es/colorful-button/meta.js +85 -0
- package/lowcode_es/colorful-input/meta.d.ts +22 -0
- package/lowcode_es/colorful-input/meta.js +48 -0
- package/lowcode_es/meta.js +165 -0
- package/lowcode_es/view.js +18 -0
- package/lowcode_lib/colorful-button/meta.d.ts +22 -0
- package/lowcode_lib/colorful-button/meta.js +90 -0
- package/lowcode_lib/colorful-input/meta.d.ts +22 -0
- package/lowcode_lib/colorful-input/meta.js +53 -0
- package/lowcode_lib/meta.js +169 -0
- package/lowcode_lib/view.js +28 -0
- package/package.json +103 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packages": [
|
|
3
|
+
{
|
|
4
|
+
"package": "ydb-components-material",
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"library": "BizComps",
|
|
7
|
+
"urls": [
|
|
8
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.js",
|
|
9
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.css"
|
|
10
|
+
],
|
|
11
|
+
"editUrls": [
|
|
12
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/view.js",
|
|
13
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/view.css"
|
|
14
|
+
],
|
|
15
|
+
"advancedUrls": {
|
|
16
|
+
"default": [
|
|
17
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.js",
|
|
18
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.css"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"advancedEditUrls": {}
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"components": [
|
|
25
|
+
{
|
|
26
|
+
"exportName": "YdbComponentsMaterialMeta",
|
|
27
|
+
"npm": {
|
|
28
|
+
"package": "ydb-components-material",
|
|
29
|
+
"version": "0.1.1"
|
|
30
|
+
},
|
|
31
|
+
"url": "https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/meta.js",
|
|
32
|
+
"urls": {
|
|
33
|
+
"default": "https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/meta.js"
|
|
34
|
+
},
|
|
35
|
+
"advancedUrls": {
|
|
36
|
+
"default": [
|
|
37
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/meta.js"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"sort": {
|
|
43
|
+
"groupList": [
|
|
44
|
+
"精选组件",
|
|
45
|
+
"原子组件"
|
|
46
|
+
],
|
|
47
|
+
"categoryList": [
|
|
48
|
+
"基础元素",
|
|
49
|
+
"布局容器类",
|
|
50
|
+
"表格类",
|
|
51
|
+
"表单详情类",
|
|
52
|
+
"帮助类",
|
|
53
|
+
"对话框类",
|
|
54
|
+
"业务类",
|
|
55
|
+
"通用",
|
|
56
|
+
"引导",
|
|
57
|
+
"信息输入",
|
|
58
|
+
"信息展示",
|
|
59
|
+
"信息反馈"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"groupList": [
|
|
63
|
+
"精选组件",
|
|
64
|
+
"原子组件"
|
|
65
|
+
],
|
|
66
|
+
"ignoreComponents": {}
|
|
67
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packages": [
|
|
3
|
+
{
|
|
4
|
+
"package": "ydb-components-material",
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"library": "BizComps",
|
|
7
|
+
"urls": [
|
|
8
|
+
"./render/default/view.js",
|
|
9
|
+
"./render/default/view.css"
|
|
10
|
+
],
|
|
11
|
+
"editUrls": [
|
|
12
|
+
"./view.js",
|
|
13
|
+
"./view.css"
|
|
14
|
+
],
|
|
15
|
+
"advancedUrls": {
|
|
16
|
+
"default": [
|
|
17
|
+
"./render/default/view.js",
|
|
18
|
+
"./render/default/view.css"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"advancedEditUrls": {}
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"components": [
|
|
25
|
+
{
|
|
26
|
+
"exportName": "YdbComponentsMaterialMeta",
|
|
27
|
+
"npm": {
|
|
28
|
+
"package": "ydb-components-material",
|
|
29
|
+
"version": "0.1.1"
|
|
30
|
+
},
|
|
31
|
+
"url": "./meta.js",
|
|
32
|
+
"urls": {
|
|
33
|
+
"default": "./meta.js"
|
|
34
|
+
},
|
|
35
|
+
"advancedUrls": {
|
|
36
|
+
"default": [
|
|
37
|
+
"./meta.js"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"sort": {
|
|
43
|
+
"groupList": [
|
|
44
|
+
"精选组件",
|
|
45
|
+
"原子组件"
|
|
46
|
+
],
|
|
47
|
+
"categoryList": [
|
|
48
|
+
"基础元素",
|
|
49
|
+
"布局容器类",
|
|
50
|
+
"表格类",
|
|
51
|
+
"表单详情类",
|
|
52
|
+
"帮助类",
|
|
53
|
+
"对话框类",
|
|
54
|
+
"业务类",
|
|
55
|
+
"通用",
|
|
56
|
+
"引导",
|
|
57
|
+
"信息输入",
|
|
58
|
+
"信息展示",
|
|
59
|
+
"信息反馈"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"groupList": [
|
|
63
|
+
"精选组件",
|
|
64
|
+
"原子组件"
|
|
65
|
+
],
|
|
66
|
+
"ignoreComponents": {}
|
|
67
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packages": [
|
|
3
|
+
{
|
|
4
|
+
"package": "ydb-components-material",
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"library": "BizComps",
|
|
7
|
+
"urls": [
|
|
8
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.js",
|
|
9
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.css"
|
|
10
|
+
],
|
|
11
|
+
"editUrls": [
|
|
12
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/view.js",
|
|
13
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/view.css"
|
|
14
|
+
],
|
|
15
|
+
"advancedUrls": {
|
|
16
|
+
"default": [
|
|
17
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.js",
|
|
18
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/render/default/view.css"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"advancedEditUrls": {}
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"components": [
|
|
25
|
+
{
|
|
26
|
+
"exportName": "YdbComponentsMaterialMeta",
|
|
27
|
+
"npm": {
|
|
28
|
+
"package": "ydb-components-material",
|
|
29
|
+
"version": "0.1.1"
|
|
30
|
+
},
|
|
31
|
+
"url": "https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/meta.js",
|
|
32
|
+
"urls": {
|
|
33
|
+
"default": "https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/meta.js"
|
|
34
|
+
},
|
|
35
|
+
"advancedUrls": {
|
|
36
|
+
"default": [
|
|
37
|
+
"https://unpkg.com/ydb-components-material@0.1.1/build/lowcode/meta.js"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"sort": {
|
|
43
|
+
"groupList": [
|
|
44
|
+
"精选组件",
|
|
45
|
+
"原子组件"
|
|
46
|
+
],
|
|
47
|
+
"categoryList": [
|
|
48
|
+
"基础元素",
|
|
49
|
+
"布局容器类",
|
|
50
|
+
"表格类",
|
|
51
|
+
"表单详情类",
|
|
52
|
+
"帮助类",
|
|
53
|
+
"对话框类",
|
|
54
|
+
"业务类",
|
|
55
|
+
"通用",
|
|
56
|
+
"引导",
|
|
57
|
+
"信息输入",
|
|
58
|
+
"信息展示",
|
|
59
|
+
"信息反馈"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"groupList": [
|
|
63
|
+
"精选组件",
|
|
64
|
+
"原子组件"
|
|
65
|
+
],
|
|
66
|
+
"ignoreComponents": {}
|
|
67
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
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/alifd__next/1.23.20/next-with-locales.min.js"></script>
|
|
61
|
+
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.7-beta.11/dist/js/engine-core.js"></script>
|
|
62
|
+
<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>
|
|
63
|
+
<script>
|
|
64
|
+
if (!window.AliLowCodeEngine.common) {
|
|
65
|
+
window.AliLowCodeEngine.common = {
|
|
66
|
+
designerCabin: window.AliLowCodeEngine.designerCabin,
|
|
67
|
+
editorCabin: window.AliLowCodeEngine.editorCabin,
|
|
68
|
+
skeletonCabin: window.AliLowCodeEngine.skeletonCabin,
|
|
69
|
+
utils: window.AliLowCodeEngine.utils,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
<script src="https://alifd.alicdn.com/npm/@alilc/lowcode-preset-plugin@0.1.2/dist/lowcode-preset-plugin.js"></script>
|
|
74
|
+
<script type="text/javascript" charset="utf-8" src="./index.js"></script>
|
|
75
|
+
<script>
|
|
76
|
+
(function (factory) {
|
|
77
|
+
if (typeof define === 'function' && define.amd) {
|
|
78
|
+
define([], factory);
|
|
79
|
+
} else if (typeof module === 'object' && module.exports) {
|
|
80
|
+
module.exports = factory();
|
|
81
|
+
} else {
|
|
82
|
+
window.idleCallbackShim = factory();
|
|
83
|
+
}
|
|
84
|
+
})(function () {
|
|
85
|
+
'use strict';
|
|
86
|
+
var scheduleStart, throttleDelay, lazytimer, lazyraf;
|
|
87
|
+
var root =
|
|
88
|
+
typeof window != 'undefined' ? window : typeof global != undefined ? global : this || {};
|
|
89
|
+
var requestAnimationFrame =
|
|
90
|
+
(root.cancelRequestAnimationFrame && root.requestAnimationFrame) || setTimeout;
|
|
91
|
+
var cancelRequestAnimationFrame = root.cancelRequestAnimationFrame || clearTimeout;
|
|
92
|
+
var tasks = [];
|
|
93
|
+
var runAttempts = 0;
|
|
94
|
+
var isRunning = false;
|
|
95
|
+
var remainingTime = 7;
|
|
96
|
+
var minThrottle = 35;
|
|
97
|
+
var throttle = 125;
|
|
98
|
+
var index = 0;
|
|
99
|
+
var taskStart = 0;
|
|
100
|
+
var tasklength = 0;
|
|
101
|
+
var IdleDeadline = {
|
|
102
|
+
get didTimeout() {
|
|
103
|
+
return false;
|
|
104
|
+
},
|
|
105
|
+
timeRemaining: function () {
|
|
106
|
+
var timeRemaining = remainingTime - (Date.now() - taskStart);
|
|
107
|
+
return Math.max(0, timeRemaining);
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
var setInactive = debounce(function () {
|
|
111
|
+
remainingTime = 22;
|
|
112
|
+
throttle = 66;
|
|
113
|
+
minThrottle = 0;
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
function debounce(fn) {
|
|
117
|
+
var id, timestamp;
|
|
118
|
+
var wait = 99;
|
|
119
|
+
var check = function () {
|
|
120
|
+
var last = Date.now() - timestamp;
|
|
121
|
+
|
|
122
|
+
if (last < wait) {
|
|
123
|
+
id = setTimeout(check, wait - last);
|
|
124
|
+
} else {
|
|
125
|
+
id = null;
|
|
126
|
+
fn();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
return function () {
|
|
130
|
+
timestamp = Date.now();
|
|
131
|
+
if (!id) {
|
|
132
|
+
id = setTimeout(check, wait);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function abortRunning() {
|
|
138
|
+
if (isRunning) {
|
|
139
|
+
if (lazyraf) {
|
|
140
|
+
cancelRequestAnimationFrame(lazyraf);
|
|
141
|
+
}
|
|
142
|
+
if (lazytimer) {
|
|
143
|
+
clearTimeout(lazytimer);
|
|
144
|
+
}
|
|
145
|
+
isRunning = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function onInputorMutation() {
|
|
150
|
+
if (throttle != 125) {
|
|
151
|
+
remainingTime = 7;
|
|
152
|
+
throttle = 125;
|
|
153
|
+
minThrottle = 35;
|
|
154
|
+
|
|
155
|
+
if (isRunning) {
|
|
156
|
+
abortRunning();
|
|
157
|
+
scheduleLazy();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
setInactive();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function scheduleAfterRaf() {
|
|
164
|
+
lazyraf = null;
|
|
165
|
+
lazytimer = setTimeout(runTasks, 0);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function scheduleRaf() {
|
|
169
|
+
lazytimer = null;
|
|
170
|
+
requestAnimationFrame(scheduleAfterRaf);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function scheduleLazy() {
|
|
174
|
+
if (isRunning) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
throttleDelay = throttle - (Date.now() - taskStart);
|
|
178
|
+
|
|
179
|
+
scheduleStart = Date.now();
|
|
180
|
+
|
|
181
|
+
isRunning = true;
|
|
182
|
+
|
|
183
|
+
if (minThrottle && throttleDelay < minThrottle) {
|
|
184
|
+
throttleDelay = minThrottle;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (throttleDelay > 9) {
|
|
188
|
+
lazytimer = setTimeout(scheduleRaf, throttleDelay);
|
|
189
|
+
} else {
|
|
190
|
+
throttleDelay = 0;
|
|
191
|
+
scheduleRaf();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function runTasks() {
|
|
196
|
+
var task, i, len;
|
|
197
|
+
var timeThreshold = remainingTime > 9 ? 9 : 1;
|
|
198
|
+
taskStart = Date.now();
|
|
199
|
+
isRunning = false;
|
|
200
|
+
|
|
201
|
+
lazytimer = null;
|
|
202
|
+
|
|
203
|
+
if (runAttempts > 2 || taskStart - throttleDelay - 50 < scheduleStart) {
|
|
204
|
+
for (
|
|
205
|
+
i = 0, len = tasks.length;
|
|
206
|
+
i < len && IdleDeadline.timeRemaining() > timeThreshold;
|
|
207
|
+
i++
|
|
208
|
+
) {
|
|
209
|
+
task = tasks.shift();
|
|
210
|
+
tasklength++;
|
|
211
|
+
if (task) {
|
|
212
|
+
task(IdleDeadline);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (tasks.length) {
|
|
218
|
+
scheduleLazy();
|
|
219
|
+
} else {
|
|
220
|
+
runAttempts = 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function requestIdleCallbackShim(task) {
|
|
225
|
+
index++;
|
|
226
|
+
tasks.push(task);
|
|
227
|
+
scheduleLazy();
|
|
228
|
+
return index;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function cancelIdleCallbackShim(id) {
|
|
232
|
+
var index = id - 1 - tasklength;
|
|
233
|
+
if (tasks[index]) {
|
|
234
|
+
tasks[index] = null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (!root.requestIdleCallback || !root.cancelIdleCallback) {
|
|
239
|
+
root.requestIdleCallback = requestIdleCallbackShim;
|
|
240
|
+
root.cancelIdleCallback = cancelIdleCallbackShim;
|
|
241
|
+
|
|
242
|
+
if (root.document && document.addEventListener) {
|
|
243
|
+
root.addEventListener('scroll', onInputorMutation, true);
|
|
244
|
+
root.addEventListener('resize', onInputorMutation);
|
|
245
|
+
|
|
246
|
+
document.addEventListener('focus', onInputorMutation, true);
|
|
247
|
+
document.addEventListener('mouseover', onInputorMutation, true);
|
|
248
|
+
['click', 'keypress', 'touchstart', 'mousedown'].forEach(function (name) {
|
|
249
|
+
document.addEventListener(name, onInputorMutation, { capture: true, passive: true });
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
if (root.MutationObserver) {
|
|
253
|
+
new MutationObserver(onInputorMutation).observe(document.documentElement, {
|
|
254
|
+
childList: true,
|
|
255
|
+
subtree: true,
|
|
256
|
+
attributes: true,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
try {
|
|
262
|
+
root.requestIdleCallback(function () {}, { timeout: 0 });
|
|
263
|
+
} catch (e) {
|
|
264
|
+
(function (rIC) {
|
|
265
|
+
var timeRemainingProto, timeRemaining;
|
|
266
|
+
root.requestIdleCallback = function (fn, timeout) {
|
|
267
|
+
if (timeout && typeof timeout.timeout == 'number') {
|
|
268
|
+
return rIC(fn, timeout.timeout);
|
|
269
|
+
}
|
|
270
|
+
return rIC(fn);
|
|
271
|
+
};
|
|
272
|
+
if (
|
|
273
|
+
root.IdleCallbackDeadline &&
|
|
274
|
+
(timeRemainingProto = IdleCallbackDeadline.prototype)
|
|
275
|
+
) {
|
|
276
|
+
timeRemaining = Object.getOwnPropertyDescriptor(
|
|
277
|
+
timeRemainingProto,
|
|
278
|
+
'timeRemaining',
|
|
279
|
+
);
|
|
280
|
+
if (!timeRemaining || !timeRemaining.configurable || !timeRemaining.get) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
Object.defineProperty(timeRemainingProto, 'timeRemaining', {
|
|
284
|
+
value: function () {
|
|
285
|
+
return timeRemaining.get.call(this);
|
|
286
|
+
},
|
|
287
|
+
enumerable: true,
|
|
288
|
+
configurable: true,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
})(root.requestIdleCallback);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
request: requestIdleCallbackShim,
|
|
297
|
+
cancel: cancelIdleCallbackShim,
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
</script>
|
|
301
|
+
</body>
|
|
302
|
+
</html>
|