@tuya-sat/micro-dev-component 2.0.0-rc.5 → 2.0.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.
- package/dist/index.js +123 -104
- package/package.json +19 -20
package/dist/index.js
CHANGED
|
@@ -2,101 +2,106 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
5
|
+
/**
|
|
6
|
+
* List of known SVG tag names.
|
|
7
|
+
*
|
|
8
|
+
* @type {Array<string>}
|
|
9
|
+
*/
|
|
10
|
+
const svgTagNames = [
|
|
11
|
+
'a',
|
|
12
|
+
'altGlyph',
|
|
13
|
+
'altGlyphDef',
|
|
14
|
+
'altGlyphItem',
|
|
15
|
+
'animate',
|
|
16
|
+
'animateColor',
|
|
17
|
+
'animateMotion',
|
|
18
|
+
'animateTransform',
|
|
19
|
+
'animation',
|
|
20
|
+
'audio',
|
|
21
|
+
'canvas',
|
|
22
|
+
'circle',
|
|
23
|
+
'clipPath',
|
|
24
|
+
'color-profile',
|
|
25
|
+
'cursor',
|
|
26
|
+
'defs',
|
|
27
|
+
'desc',
|
|
28
|
+
'discard',
|
|
29
|
+
'ellipse',
|
|
30
|
+
'feBlend',
|
|
31
|
+
'feColorMatrix',
|
|
32
|
+
'feComponentTransfer',
|
|
33
|
+
'feComposite',
|
|
34
|
+
'feConvolveMatrix',
|
|
35
|
+
'feDiffuseLighting',
|
|
36
|
+
'feDisplacementMap',
|
|
37
|
+
'feDistantLight',
|
|
38
|
+
'feDropShadow',
|
|
39
|
+
'feFlood',
|
|
40
|
+
'feFuncA',
|
|
41
|
+
'feFuncB',
|
|
42
|
+
'feFuncG',
|
|
43
|
+
'feFuncR',
|
|
44
|
+
'feGaussianBlur',
|
|
45
|
+
'feImage',
|
|
46
|
+
'feMerge',
|
|
47
|
+
'feMergeNode',
|
|
48
|
+
'feMorphology',
|
|
49
|
+
'feOffset',
|
|
50
|
+
'fePointLight',
|
|
51
|
+
'feSpecularLighting',
|
|
52
|
+
'feSpotLight',
|
|
53
|
+
'feTile',
|
|
54
|
+
'feTurbulence',
|
|
55
|
+
'filter',
|
|
56
|
+
'font',
|
|
57
|
+
'font-face',
|
|
58
|
+
'font-face-format',
|
|
59
|
+
'font-face-name',
|
|
60
|
+
'font-face-src',
|
|
61
|
+
'font-face-uri',
|
|
62
|
+
'foreignObject',
|
|
63
|
+
'g',
|
|
64
|
+
'glyph',
|
|
65
|
+
'glyphRef',
|
|
66
|
+
'handler',
|
|
67
|
+
'hkern',
|
|
68
|
+
'iframe',
|
|
69
|
+
'image',
|
|
70
|
+
'line',
|
|
71
|
+
'linearGradient',
|
|
72
|
+
'listener',
|
|
73
|
+
'marker',
|
|
74
|
+
'mask',
|
|
75
|
+
'metadata',
|
|
76
|
+
'missing-glyph',
|
|
77
|
+
'mpath',
|
|
78
|
+
'path',
|
|
79
|
+
'pattern',
|
|
80
|
+
'polygon',
|
|
81
|
+
'polyline',
|
|
82
|
+
'prefetch',
|
|
83
|
+
'radialGradient',
|
|
84
|
+
'rect',
|
|
85
|
+
'script',
|
|
86
|
+
'set',
|
|
87
|
+
'solidColor',
|
|
88
|
+
'stop',
|
|
89
|
+
'style',
|
|
90
|
+
'svg',
|
|
91
|
+
'switch',
|
|
92
|
+
'symbol',
|
|
93
|
+
'tbreak',
|
|
94
|
+
'text',
|
|
95
|
+
'textArea',
|
|
96
|
+
'textPath',
|
|
97
|
+
'title',
|
|
98
|
+
'tref',
|
|
99
|
+
'tspan',
|
|
100
|
+
'unknown',
|
|
101
|
+
'use',
|
|
102
|
+
'video',
|
|
103
|
+
'view',
|
|
104
|
+
'vkern'
|
|
100
105
|
];
|
|
101
106
|
|
|
102
107
|
const svgTags = new Set(svgTagNames);
|
|
@@ -107,10 +112,9 @@ svgTags.delete('iframe');
|
|
|
107
112
|
svgTags.delete('script');
|
|
108
113
|
svgTags.delete('video');
|
|
109
114
|
// Copied from Preact
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
};
|
|
115
|
+
// https://github.com/preactjs/preact/blob/1bbd687c13c1fd16f0d6393e79ea6232f55fbec4/src/constants.js#L3
|
|
116
|
+
const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
117
|
+
const isFragment = (type) => type === DocumentFragment;
|
|
114
118
|
const setCSSProps = (element, style) => {
|
|
115
119
|
for (const [name, value] of Object.entries(style)) {
|
|
116
120
|
if (name.startsWith('-')) {
|
|
@@ -157,13 +161,27 @@ const addChildren = (parent, children) => {
|
|
|
157
161
|
else if (Array.isArray(child)) {
|
|
158
162
|
addChildren(parent, child);
|
|
159
163
|
}
|
|
160
|
-
else if (typeof child !== 'boolean'
|
|
161
|
-
typeof child !== 'undefined'
|
|
162
|
-
child !== null) {
|
|
164
|
+
else if (typeof child !== 'boolean'
|
|
165
|
+
&& typeof child !== 'undefined'
|
|
166
|
+
&& child !== null) {
|
|
163
167
|
parent.appendChild(document.createTextNode(child));
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
};
|
|
171
|
+
// These attributes allow "false" as a valid value
|
|
172
|
+
// https://github.com/facebook/react/blob/3f8990898309c61c817fbf663f5221d9a00d0eaa/packages/react-dom/src/shared/DOMProperty.js#L288-L322
|
|
173
|
+
const booleanishAttributes = new Set([
|
|
174
|
+
// These attributes allow "false" as a valid value
|
|
175
|
+
'contentEditable',
|
|
176
|
+
'draggable',
|
|
177
|
+
'spellCheck',
|
|
178
|
+
'value',
|
|
179
|
+
// SVG-specific
|
|
180
|
+
'autoReverse',
|
|
181
|
+
'externalResourcesRequired',
|
|
182
|
+
'focusable',
|
|
183
|
+
'preserveAlpha',
|
|
184
|
+
]);
|
|
167
185
|
const h = (type, attributes, ...children) => {
|
|
168
186
|
var _a;
|
|
169
187
|
const element = create(type);
|
|
@@ -190,18 +208,19 @@ const h = (type, attributes, ...children) => {
|
|
|
190
208
|
else if (name === 'dangerouslySetInnerHTML' && '__html' in value) {
|
|
191
209
|
element.innerHTML = value.__html;
|
|
192
210
|
}
|
|
193
|
-
else if (name !== 'key' && value !== false) {
|
|
211
|
+
else if (name !== 'key' && (booleanishAttributes.has(name) || value !== false)) {
|
|
194
212
|
setAttribute(element, name, value === true ? '' : value);
|
|
195
213
|
}
|
|
196
214
|
}
|
|
197
215
|
return element;
|
|
198
216
|
};
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- Ur rong.
|
|
199
218
|
const Fragment = (typeof DocumentFragment === 'function' ? DocumentFragment : () => { });
|
|
200
219
|
// Improve TypeScript support for DocumentFragment
|
|
201
220
|
// https://github.com/Microsoft/TypeScript/issues/20469
|
|
202
221
|
const React = {
|
|
203
222
|
createElement: h,
|
|
204
|
-
Fragment
|
|
223
|
+
Fragment,
|
|
205
224
|
};
|
|
206
225
|
|
|
207
226
|
function styleInject(css, ref) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-dev-component",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -9,23 +9,23 @@
|
|
|
9
9
|
"prepublish": "yarn build"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@rollup/plugin-babel": "
|
|
13
|
-
"@rollup/plugin-commonjs": "
|
|
14
|
-
"@rollup/plugin-node-resolve": "
|
|
15
|
-
"@types/react": "
|
|
16
|
-
"antd": "
|
|
17
|
-
"axios": "
|
|
18
|
-
"dom-chef": "
|
|
19
|
-
"less": "
|
|
20
|
-
"postcss": "
|
|
21
|
-
"react": "
|
|
22
|
-
"react-dom": "
|
|
23
|
-
"rollup": "
|
|
24
|
-
"rollup-plugin-delete": "
|
|
25
|
-
"rollup-plugin-peer-deps-external": "
|
|
26
|
-
"rollup-plugin-postcss": "
|
|
27
|
-
"rollup-plugin-typescript2": "
|
|
28
|
-
"typescript": "
|
|
12
|
+
"@rollup/plugin-babel": "5.3.1",
|
|
13
|
+
"@rollup/plugin-commonjs": "21.0.2",
|
|
14
|
+
"@rollup/plugin-node-resolve": "13.1.3",
|
|
15
|
+
"@types/react": "17.0.42",
|
|
16
|
+
"antd": "4.19.3",
|
|
17
|
+
"axios": "0.26.1",
|
|
18
|
+
"dom-chef": "5.1.0",
|
|
19
|
+
"less": "4.1.2",
|
|
20
|
+
"postcss": "8.4.12",
|
|
21
|
+
"react": "17.0.2",
|
|
22
|
+
"react-dom": "17.0.2",
|
|
23
|
+
"rollup": "2.70.1",
|
|
24
|
+
"rollup-plugin-delete": "2.0.0",
|
|
25
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
26
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
27
|
+
"rollup-plugin-typescript2": "0.31.2",
|
|
28
|
+
"typescript": "4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"saturn-project",
|
|
@@ -35,6 +35,5 @@
|
|
|
35
35
|
"saas",
|
|
36
36
|
"cloud",
|
|
37
37
|
"tuya"
|
|
38
|
-
]
|
|
39
|
-
"stableVersion": "1.1.4"
|
|
38
|
+
]
|
|
40
39
|
}
|