goblin-gadgets 4.2.0 → 4.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goblin-gadgets",
3
- "version": "4.2.0",
3
+ "version": "4.3.1",
4
4
  "description": "Gadgets library",
5
5
  "main": "./builders/builders.js",
6
6
  "scripts": {
@@ -150,11 +150,14 @@ export default function styles(theme, props) {
150
150
  inset: '0',
151
151
  overflow: 'hidden',
152
152
  backgroundColor: showed ? screenBackground : null,
153
- transition: theme.transitions.openClosePopup,
154
153
  opacity: showed ? 1 : 0,
155
154
  pointerEvents: showed ? 'auto' : 'none',
156
155
  };
157
156
 
157
+ const popupContainerTransition = {
158
+ transition: theme.transitions.openClosePopup,
159
+ };
160
+
158
161
  const window = {
159
162
  position: 'absolute',
160
163
  left,
@@ -175,10 +178,13 @@ export default function styles(theme, props) {
175
178
  flexDirection: 'column',
176
179
  overflow: 'hidden',
177
180
  transformOrigin: origin || 'bottom',
178
- transition: `${transitionScope} ${theme.transitions.openClosePopup}`,
179
181
  transform: showed ? null : 'scale(0.5)', // (*)
180
182
  };
181
183
 
184
+ const windowTransition = {
185
+ transition: `${transitionScope} ${theme.transitions.openClosePopup}`,
186
+ };
187
+
182
188
  // (*) Ne pas faire:
183
189
  // transform: showed ? 'scale(1)' : 'scale(0.5)',
184
190
  // Cela génère un bug étrange lors du drag dans ColorPicker et AnalogClock !
@@ -239,7 +245,9 @@ export default function styles(theme, props) {
239
245
 
240
246
  return {
241
247
  popupContainer,
248
+ popupContainerTransition,
242
249
  window,
250
+ windowTransition,
243
251
  windowTriangle,
244
252
  triangle: triangleStyle,
245
253
  };
@@ -21,6 +21,16 @@ export default class PopupContainer extends Widget {
21
21
  super(...arguments);
22
22
  this.styles = styles;
23
23
  this.onBackgroundClick = this.onBackgroundClick.bind(this);
24
+ this.state = {
25
+ mounted: false,
26
+ };
27
+ }
28
+
29
+ componentDidMount() {
30
+ // Use setTimeout to wait for React completes the render cycle
31
+ setTimeout(() => {
32
+ this.setState({mounted: true});
33
+ }, 0);
24
34
  }
25
35
 
26
36
  onBackgroundClick(e) {
@@ -48,15 +58,22 @@ export default class PopupContainer extends Widget {
48
58
  }
49
59
 
50
60
  render() {
61
+ let containerClassName = this.styles.classNames.popupContainer;
62
+ let windowClassName = this.styles.classNames.window;
63
+ if (this.state.mounted) {
64
+ containerClassName = `${this.styles.classNames.popupContainer} ${this.styles.classNames.popupContainerTransition}`;
65
+ windowClassName = `${this.styles.classNames.window} ${this.styles.classNames.windowTransition}`;
66
+ }
67
+
51
68
  return (
52
69
  <div
53
- className={this.styles.classNames.popupContainer}
70
+ className={containerClassName}
54
71
  onMouseDown={this.onBackgroundClick}
55
72
  onTouchStart={this.onBackgroundClick}
56
73
  >
57
74
  <div
58
75
  ref={(node) => (this.divWindow = node)}
59
- className={this.styles.classNames.window}
76
+ className={windowClassName}
60
77
  >
61
78
  {this.props.children}
62
79
  </div>
@@ -71,7 +71,6 @@ class TabNavigation extends Elf {
71
71
  * @returns {Promise<this>}
72
72
  */
73
73
  async create(id, desktopId, views) {
74
- this.desktopId = desktopId;
75
74
  this.views = views;
76
75
  this.logic.create(id);
77
76
  const firstTab = Object.keys(views)[0];
@@ -98,7 +97,7 @@ class TabNavigation extends Elf {
98
97
  const serviceArgs = view.serviceArgs || [];
99
98
  await new ServiceClass(this).create(
100
99
  serviceId,
101
- this.desktopId,
100
+ await this.winDesktopId(),
102
101
  ...serviceArgs
103
102
  );
104
103
  this.loadedServices.set(tab, serviceId);