@douyinfe/semi-ui 2.2.0-beta.0 → 2.2.0-beta.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/empty/index.tsx CHANGED
@@ -60,7 +60,7 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
60
60
  this.observer && this.observer.disconnect();
61
61
  }
62
62
 
63
- observe(mutationsList: any): void {
63
+ observe = (mutationsList: any): void => {
64
64
  for (const mutation of mutationsList) {
65
65
  if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
66
66
  this.updateMode();
@@ -68,7 +68,7 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
68
68
  }
69
69
  }
70
70
 
71
- updateMode(): void {
71
+ updateMode = (): void => {
72
72
  const val = this.body.getAttribute('theme-mode');
73
73
  if (val !== this.state.mode) {
74
74
  this.setState({ mode: val });
package/gulpfile.js CHANGED
@@ -81,7 +81,8 @@ gulp.task('compileScss', function compileScss() {
81
81
  realUrl = url.replace(/~@douyinfe\/semi-foundation/, semiUIPath);
82
82
  }
83
83
  return { url: realUrl };
84
- }
84
+ },
85
+ charset: false
85
86
  }).on('error', sass.logError))
86
87
  .pipe(gulp.dest('lib/es'))
87
88
  .pipe(gulp.dest('lib/cjs'));
@@ -174,11 +174,17 @@ const registerMediaQuery = (media, _ref2) => {
174
174
  }
175
175
 
176
176
  callInInit && handlerMediaChange(mediaQueryList);
177
- mediaQueryList.addEventListener('change', handlerMediaChange);
178
- return () => mediaQueryList.removeEventListener('change', handlerMediaChange);
177
+
178
+ if (Object.prototype.hasOwnProperty.call(mediaQueryList, 'addEventListener')) {
179
+ mediaQueryList.addEventListener('change', handlerMediaChange);
180
+ return () => mediaQueryList.removeEventListener('change', handlerMediaChange);
181
+ }
182
+
183
+ mediaQueryList.addListener(handlerMediaChange);
184
+ return () => mediaQueryList.removeListener(handlerMediaChange);
179
185
  }
180
186
 
181
- return null;
187
+ return () => undefined;
182
188
  };
183
189
  /**
184
190
  * Determine whether the incoming element is a built-in icon
@@ -31,8 +31,8 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
31
31
  constructor(props: EmptyProps);
32
32
  componentDidMount(): void;
33
33
  componentWillUnmount(): void;
34
- observe(mutationsList: any): void;
35
- updateMode(): void;
34
+ observe: (mutationsList: any) => void;
35
+ updateMode: () => void;
36
36
  render(): JSX.Element;
37
37
  }
38
38
  export {};
@@ -31,6 +31,25 @@ const prefixCls = _constants.cssClasses.PREFIX;
31
31
  class Empty extends _baseComponent.default {
32
32
  constructor(props) {
33
33
  super(props);
34
+
35
+ this.observe = mutationsList => {
36
+ for (const mutation of mutationsList) {
37
+ if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
38
+ this.updateMode();
39
+ }
40
+ }
41
+ };
42
+
43
+ this.updateMode = () => {
44
+ const val = this.body.getAttribute('theme-mode');
45
+
46
+ if (val !== this.state.mode) {
47
+ this.setState({
48
+ mode: val
49
+ });
50
+ }
51
+ };
52
+
34
53
  this.state = {
35
54
  mode: null
36
55
  };
@@ -54,24 +73,6 @@ class Empty extends _baseComponent.default {
54
73
  this.observer && this.observer.disconnect();
55
74
  }
56
75
 
57
- observe(mutationsList) {
58
- for (const mutation of mutationsList) {
59
- if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
60
- this.updateMode();
61
- }
62
- }
63
- }
64
-
65
- updateMode() {
66
- const val = this.body.getAttribute('theme-mode');
67
-
68
- if (val !== this.state.mode) {
69
- this.setState({
70
- mode: val
71
- });
72
- }
73
- }
74
-
75
76
  render() {
76
77
  var _context;
77
78
 
@@ -147,11 +147,17 @@ export const registerMediaQuery = (media, _ref2) => {
147
147
  }
148
148
 
149
149
  callInInit && handlerMediaChange(mediaQueryList);
150
- mediaQueryList.addEventListener('change', handlerMediaChange);
151
- return () => mediaQueryList.removeEventListener('change', handlerMediaChange);
150
+
151
+ if (Object.prototype.hasOwnProperty.call(mediaQueryList, 'addEventListener')) {
152
+ mediaQueryList.addEventListener('change', handlerMediaChange);
153
+ return () => mediaQueryList.removeEventListener('change', handlerMediaChange);
154
+ }
155
+
156
+ mediaQueryList.addListener(handlerMediaChange);
157
+ return () => mediaQueryList.removeListener(handlerMediaChange);
152
158
  }
153
159
 
154
- return null;
160
+ return () => undefined;
155
161
  };
156
162
  /**
157
163
  * Determine whether the incoming element is a built-in icon
@@ -31,8 +31,8 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
31
31
  constructor(props: EmptyProps);
32
32
  componentDidMount(): void;
33
33
  componentWillUnmount(): void;
34
- observe(mutationsList: any): void;
35
- updateMode(): void;
34
+ observe: (mutationsList: any) => void;
35
+ updateMode: () => void;
36
36
  render(): JSX.Element;
37
37
  }
38
38
  export {};
@@ -10,6 +10,25 @@ const prefixCls = cssClasses.PREFIX;
10
10
  export default class Empty extends BaseComponent {
11
11
  constructor(props) {
12
12
  super(props);
13
+
14
+ this.observe = mutationsList => {
15
+ for (const mutation of mutationsList) {
16
+ if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
17
+ this.updateMode();
18
+ }
19
+ }
20
+ };
21
+
22
+ this.updateMode = () => {
23
+ const val = this.body.getAttribute('theme-mode');
24
+
25
+ if (val !== this.state.mode) {
26
+ this.setState({
27
+ mode: val
28
+ });
29
+ }
30
+ };
31
+
13
32
  this.state = {
14
33
  mode: null
15
34
  };
@@ -33,24 +52,6 @@ export default class Empty extends BaseComponent {
33
52
  this.observer && this.observer.disconnect();
34
53
  }
35
54
 
36
- observe(mutationsList) {
37
- for (const mutation of mutationsList) {
38
- if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
39
- this.updateMode();
40
- }
41
- }
42
- }
43
-
44
- updateMode() {
45
- const val = this.body.getAttribute('theme-mode');
46
-
47
- if (val !== this.state.mode) {
48
- this.setState({
49
- mode: val
50
- });
51
- }
52
- }
53
-
54
55
  render() {
55
56
  var _context;
56
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.2.0-beta.0",
3
+ "version": "2.2.0-beta.1",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
- "@douyinfe/semi-animation-react": "2.2.0-beta.0",
18
- "@douyinfe/semi-foundation": "2.2.0-beta.0",
19
- "@douyinfe/semi-icons": "2.2.0-beta.0",
20
- "@douyinfe/semi-illustrations": "2.2.0-beta.0",
21
- "@douyinfe/semi-theme-default": "2.2.0-beta.0",
17
+ "@douyinfe/semi-animation-react": "2.2.0-beta.1",
18
+ "@douyinfe/semi-foundation": "2.2.0-beta.1",
19
+ "@douyinfe/semi-icons": "2.2.0-beta.1",
20
+ "@douyinfe/semi-illustrations": "2.2.0-beta.1",
21
+ "@douyinfe/semi-theme-default": "2.2.0-beta.1",
22
22
  "@types/react-window": "^1.8.2",
23
23
  "async-validator": "^3.5.0",
24
24
  "classnames": "^2.2.6",
@@ -68,13 +68,13 @@
68
68
  ],
69
69
  "author": "",
70
70
  "license": "MIT",
71
- "gitHead": "e8ea6a96a5ddd73a178a797548497cd6a64eb14b",
71
+ "gitHead": "b380360d4f966a59369dc1ab895cb23bb9903751",
72
72
  "devDependencies": {
73
73
  "@babel/plugin-proposal-decorators": "^7.15.8",
74
74
  "@babel/plugin-transform-runtime": "^7.15.8",
75
75
  "@babel/preset-env": "^7.15.8",
76
76
  "@babel/preset-react": "^7.14.5",
77
- "@douyinfe/semi-scss-compile": "2.2.0-beta.0",
77
+ "@douyinfe/semi-scss-compile": "2.2.0-beta.1",
78
78
  "@storybook/addon-knobs": "^6.3.1",
79
79
  "@types/lodash": "^4.14.176",
80
80
  "babel-loader": "^8.2.2",
@@ -99,7 +99,7 @@
99
99
  "react-storybook-addon-props-combinations": "^1.1.0",
100
100
  "react-virtualized": "^9.22.3",
101
101
  "rimraf": "^3.0.2",
102
- "sass": "1.32.13",
102
+ "sass": "1.45.0",
103
103
  "sinon": "^6.3.5",
104
104
  "terser-webpack-plugin": "^4.2.3",
105
105
  "through2": "^4.0.2",