@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.
Files changed (2) hide show
  1. package/dist/index.js +123 -104
  2. 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
- var svgTagNames = [
6
- "a",
7
- "altGlyph",
8
- "altGlyphDef",
9
- "altGlyphItem",
10
- "animate",
11
- "animateColor",
12
- "animateMotion",
13
- "animateTransform",
14
- "animation",
15
- "audio",
16
- "canvas",
17
- "circle",
18
- "clipPath",
19
- "color-profile",
20
- "cursor",
21
- "defs",
22
- "desc",
23
- "discard",
24
- "ellipse",
25
- "feBlend",
26
- "feColorMatrix",
27
- "feComponentTransfer",
28
- "feComposite",
29
- "feConvolveMatrix",
30
- "feDiffuseLighting",
31
- "feDisplacementMap",
32
- "feDistantLight",
33
- "feDropShadow",
34
- "feFlood",
35
- "feFuncA",
36
- "feFuncB",
37
- "feFuncG",
38
- "feFuncR",
39
- "feGaussianBlur",
40
- "feImage",
41
- "feMerge",
42
- "feMergeNode",
43
- "feMorphology",
44
- "feOffset",
45
- "fePointLight",
46
- "feSpecularLighting",
47
- "feSpotLight",
48
- "feTile",
49
- "feTurbulence",
50
- "filter",
51
- "font",
52
- "font-face",
53
- "font-face-format",
54
- "font-face-name",
55
- "font-face-src",
56
- "font-face-uri",
57
- "foreignObject",
58
- "g",
59
- "glyph",
60
- "glyphRef",
61
- "handler",
62
- "hkern",
63
- "iframe",
64
- "image",
65
- "line",
66
- "linearGradient",
67
- "listener",
68
- "marker",
69
- "mask",
70
- "metadata",
71
- "missing-glyph",
72
- "mpath",
73
- "path",
74
- "pattern",
75
- "polygon",
76
- "polyline",
77
- "prefetch",
78
- "radialGradient",
79
- "rect",
80
- "script",
81
- "set",
82
- "solidColor",
83
- "stop",
84
- "style",
85
- "svg",
86
- "switch",
87
- "symbol",
88
- "tbreak",
89
- "text",
90
- "textArea",
91
- "textPath",
92
- "title",
93
- "tref",
94
- "tspan",
95
- "unknown",
96
- "use",
97
- "video",
98
- "view",
99
- "vkern"
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
- const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
111
- const isFragment = (type) => {
112
- return type === DocumentFragment;
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-rc.5",
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": "^5.3.0",
13
- "@rollup/plugin-commonjs": "^21.0.0",
14
- "@rollup/plugin-node-resolve": "^13.0.5",
15
- "@types/react": "^17.0.27",
16
- "antd": "^4.16.13",
17
- "axios": "^0.22.0",
18
- "dom-chef": "^5.0.0",
19
- "less": "^4.1.2",
20
- "postcss": "^8.3.9",
21
- "react": "^17.0.2",
22
- "react-dom": "^17.0.2",
23
- "rollup": "^2.58.0",
24
- "rollup-plugin-delete": "^2.0.0",
25
- "rollup-plugin-peer-deps-external": "^2.2.4",
26
- "rollup-plugin-postcss": "^4.0.1",
27
- "rollup-plugin-typescript2": "^0.31.1",
28
- "typescript": "^4.4.4"
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
  }