@micromag/viewer 0.4.87 → 0.4.89

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/es/index.js +125 -113
  2. package/package.json +10 -10
package/es/index.js CHANGED
@@ -123,7 +123,7 @@ function checkClickable(el, options = {}, parentDistance = 1) {
123
123
  }
124
124
 
125
125
  function useScreenInteraction(t0) {
126
- const $ = c(27);
126
+ const $ = c(29);
127
127
  const {
128
128
  screens,
129
129
  screenIndex,
@@ -161,56 +161,75 @@ function useScreenInteraction(t0) {
161
161
  id: screenId
162
162
  } = t7;
163
163
  const currentScreenInteractionEnabled = screenId ? screensInteractionEnabled[screenId] ?? true : true;
164
+ const screenIdRef = useRef(screenId);
164
165
  let t8;
165
- if ($[5] !== screenId || $[6] !== screens) {
166
- t8 = newValue => {
166
+ let t9;
167
+ if ($[5] !== screenId) {
168
+ t8 = () => {
169
+ screenIdRef.current = screenId;
170
+ };
171
+ t9 = [screenId];
172
+ $[5] = screenId;
173
+ $[6] = t8;
174
+ $[7] = t9;
175
+ } else {
176
+ t8 = $[6];
177
+ t9 = $[7];
178
+ }
179
+ useEffect(t8, t9);
180
+ let t10;
181
+ if ($[8] !== screens) {
182
+ t10 = newValue => {
167
183
  setScreensInteractionEnabled(prev => {
168
- const currentValue = prev?.[screenId] ?? true;
184
+ const currentValue = prev?.[screenIdRef.current] ?? true;
169
185
  if (currentValue === newValue) {
170
186
  return prev;
171
187
  }
172
- return screens.reduce((map_0, t9) => {
188
+ return screens.reduce((map_0, t11) => {
173
189
  const {
174
190
  id: id_0
175
- } = t9;
176
- return screenId === id_0 ? {
191
+ } = t11;
192
+ return screenIdRef.current === id_0 ? {
177
193
  ...map_0,
178
194
  [id_0]: newValue
179
195
  } : {
180
196
  ...map_0,
181
- [id_0]: typeof prev[id_0] === "undefined" || prev[id_0] === true
197
+ [id_0]: prev?.[id_0] ?? true
182
198
  };
183
199
  }, {});
184
200
  });
185
201
  };
186
- $[5] = screenId;
187
- $[6] = screens;
188
- $[7] = t8;
189
- } else {
190
- t8 = $[7];
191
- }
192
- const updateInteraction = t8;
193
- let t9;
194
- if ($[8] !== updateInteraction) {
195
- t9 = () => updateInteraction(true);
196
- $[8] = updateInteraction;
197
- $[9] = t9;
202
+ $[8] = screens;
203
+ $[9] = t10;
198
204
  } else {
199
- t9 = $[9];
205
+ t10 = $[9];
200
206
  }
201
- const enableInteraction = t9;
202
- let t10;
207
+ const updateInteraction = t10;
208
+ let t11;
203
209
  if ($[10] !== updateInteraction) {
204
- t10 = () => updateInteraction(false);
210
+ t11 = () => {
211
+ updateInteraction(true);
212
+ };
205
213
  $[10] = updateInteraction;
206
- $[11] = t10;
214
+ $[11] = t11;
207
215
  } else {
208
- t10 = $[11];
216
+ t11 = $[11];
209
217
  }
210
- const disableInteraction = t10;
211
- let t11;
212
- if ($[12] !== clickOnSiblings || $[13] !== currentScreenInteractionEnabled || $[14] !== disableCurrentScreenNavigation || $[15] !== nextScreenWidthPercent || $[16] !== onInteract || $[17] !== onNavigate || $[18] !== screenIndex || $[19] !== screenWidth || $[20] !== screens.length) {
213
- t11 = t12 => {
218
+ const enableInteraction = t11;
219
+ let t12;
220
+ if ($[12] !== updateInteraction) {
221
+ t12 = () => {
222
+ updateInteraction(false);
223
+ };
224
+ $[12] = updateInteraction;
225
+ $[13] = t12;
226
+ } else {
227
+ t12 = $[13];
228
+ }
229
+ const disableInteraction = t12;
230
+ let t13;
231
+ if ($[14] !== clickOnSiblings || $[15] !== currentScreenInteractionEnabled || $[16] !== disableCurrentScreenNavigation || $[17] !== nextScreenWidthPercent || $[18] !== onInteract || $[19] !== onNavigate || $[20] !== screenIndex || $[21] !== screenWidth || $[22] !== screens.length) {
232
+ t13 = t14 => {
214
233
  const {
215
234
  event,
216
235
  target,
@@ -218,7 +237,7 @@ function useScreenInteraction(t0) {
218
237
  x,
219
238
  y,
220
239
  index
221
- } = t12;
240
+ } = t14;
222
241
  if (onInteract !== null) {
223
242
  onInteract({
224
243
  event,
@@ -259,37 +278,37 @@ function useScreenInteraction(t0) {
259
278
  });
260
279
  }
261
280
  };
262
- $[12] = clickOnSiblings;
263
- $[13] = currentScreenInteractionEnabled;
264
- $[14] = disableCurrentScreenNavigation;
265
- $[15] = nextScreenWidthPercent;
266
- $[16] = onInteract;
267
- $[17] = onNavigate;
268
- $[18] = screenIndex;
269
- $[19] = screenWidth;
270
- $[20] = screens.length;
271
- $[21] = t11;
272
- } else {
273
- t11 = $[21];
274
- }
275
- const interact = t11;
276
- let t12;
277
- if ($[22] !== currentScreenInteractionEnabled || $[23] !== disableInteraction || $[24] !== enableInteraction || $[25] !== interact) {
278
- t12 = {
281
+ $[14] = clickOnSiblings;
282
+ $[15] = currentScreenInteractionEnabled;
283
+ $[16] = disableCurrentScreenNavigation;
284
+ $[17] = nextScreenWidthPercent;
285
+ $[18] = onInteract;
286
+ $[19] = onNavigate;
287
+ $[20] = screenIndex;
288
+ $[21] = screenWidth;
289
+ $[22] = screens.length;
290
+ $[23] = t13;
291
+ } else {
292
+ t13 = $[23];
293
+ }
294
+ const interact = t13;
295
+ let t14;
296
+ if ($[24] !== currentScreenInteractionEnabled || $[25] !== disableInteraction || $[26] !== enableInteraction || $[27] !== interact) {
297
+ t14 = {
279
298
  interact,
280
299
  currentScreenInteractionEnabled,
281
300
  enableInteraction,
282
301
  disableInteraction
283
302
  };
284
- $[22] = currentScreenInteractionEnabled;
285
- $[23] = disableInteraction;
286
- $[24] = enableInteraction;
287
- $[25] = interact;
288
- $[26] = t12;
303
+ $[24] = currentScreenInteractionEnabled;
304
+ $[25] = disableInteraction;
305
+ $[26] = enableInteraction;
306
+ $[27] = interact;
307
+ $[28] = t14;
289
308
  } else {
290
- t12 = $[26];
309
+ t14 = $[28];
291
310
  }
292
- return t12;
311
+ return t14;
293
312
  }
294
313
  function _temp$7(map, t0) {
295
314
  const {
@@ -4965,7 +4984,7 @@ function PlaybackControls(t0) {
4965
4984
  var styles = {"container":"micromag-viewer-partials-web-view-container","opened":"micromag-viewer-partials-web-view-opened","webView":"micromag-viewer-partials-web-view-webView"};
4966
4985
 
4967
4986
  function WebViewContainer(t0) {
4968
- const $ = c(58);
4987
+ const $ = c(51);
4969
4988
  const {
4970
4989
  onChange: t1,
4971
4990
  trackingEnabled: t2,
@@ -5081,23 +5100,16 @@ function WebViewContainer(t0) {
5081
5100
  t9 = $[17];
5082
5101
  }
5083
5102
  let t10;
5084
- if ($[18] !== disableInteraction || $[19] !== enableInteraction || $[20] !== hideControls || $[21] !== opened || $[22] !== playing || $[23] !== setPlaying || $[24] !== showControls || $[25] !== trackEvent) {
5085
- t10 = [opened, trackEvent, disableInteraction, enableInteraction, hideControls, showControls, playing, setPlaying];
5086
- $[18] = disableInteraction;
5087
- $[19] = enableInteraction;
5088
- $[20] = hideControls;
5089
- $[21] = opened;
5090
- $[22] = playing;
5091
- $[23] = setPlaying;
5092
- $[24] = showControls;
5093
- $[25] = trackEvent;
5094
- $[26] = t10;
5103
+ if ($[18] !== opened) {
5104
+ t10 = [opened];
5105
+ $[18] = opened;
5106
+ $[19] = t10;
5095
5107
  } else {
5096
- t10 = $[26];
5108
+ t10 = $[19];
5097
5109
  }
5098
5110
  useEffect(t9, t10);
5099
5111
  let t11;
5100
- if ($[27] !== currentUrl || $[28] !== opened || $[29] !== source || $[30] !== trackEvent || $[31] !== trackingEnabled) {
5112
+ if ($[20] !== currentUrl || $[21] !== opened || $[22] !== source || $[23] !== trackEvent || $[24] !== trackingEnabled) {
5101
5113
  t11 = () => {
5102
5114
  if (!trackingEnabled || currentUrl === null) {
5103
5115
  return;
@@ -5106,42 +5118,42 @@ function WebViewContainer(t0) {
5106
5118
  source
5107
5119
  });
5108
5120
  };
5109
- $[27] = currentUrl;
5110
- $[28] = opened;
5111
- $[29] = source;
5112
- $[30] = trackEvent;
5113
- $[31] = trackingEnabled;
5114
- $[32] = t11;
5121
+ $[20] = currentUrl;
5122
+ $[21] = opened;
5123
+ $[22] = source;
5124
+ $[23] = trackEvent;
5125
+ $[24] = trackingEnabled;
5126
+ $[25] = t11;
5115
5127
  } else {
5116
- t11 = $[32];
5128
+ t11 = $[25];
5117
5129
  }
5118
5130
  let t12;
5119
- if ($[33] !== currentUrl || $[34] !== opened || $[35] !== trackingEnabled) {
5131
+ if ($[26] !== currentUrl || $[27] !== opened || $[28] !== trackingEnabled) {
5120
5132
  t12 = [trackingEnabled, currentUrl, opened];
5121
- $[33] = currentUrl;
5122
- $[34] = opened;
5123
- $[35] = trackingEnabled;
5124
- $[36] = t12;
5133
+ $[26] = currentUrl;
5134
+ $[27] = opened;
5135
+ $[28] = trackingEnabled;
5136
+ $[29] = t12;
5125
5137
  } else {
5126
- t12 = $[36];
5138
+ t12 = $[29];
5127
5139
  }
5128
5140
  useEffect(t11, t12);
5129
5141
  let t13;
5130
- if ($[37] !== close) {
5142
+ if ($[30] !== close) {
5131
5143
  t13 = {
5132
5144
  escape: () => {
5133
5145
  close();
5134
5146
  }
5135
5147
  };
5136
- $[37] = close;
5137
- $[38] = t13;
5148
+ $[30] = close;
5149
+ $[31] = t13;
5138
5150
  } else {
5139
- t13 = $[38];
5151
+ t13 = $[31];
5140
5152
  }
5141
5153
  useKeyboardShortcuts(t13);
5142
5154
  const webViewUrl = url || currentUrl;
5143
5155
  let t14;
5144
- if ($[39] !== source || $[40] !== storyTitle || $[41] !== url || $[42] !== webViewUrl) {
5156
+ if ($[32] !== source || $[33] !== storyTitle || $[34] !== url || $[35] !== webViewUrl) {
5145
5157
  const currentQueryString = queryString.parse(webViewUrl !== null && webViewUrl.indexOf("?") !== -1 ? webViewUrl.split("?")[1] : "");
5146
5158
  t14 = webViewUrl !== null ? `${webViewUrl.split("?")[0]}?${queryString.stringify({
5147
5159
  utm_source: "Micromag",
@@ -5149,28 +5161,28 @@ function WebViewContainer(t0) {
5149
5161
  utm_campaign: storyTitle,
5150
5162
  ...currentQueryString
5151
5163
  })}` : url;
5152
- $[39] = source;
5153
- $[40] = storyTitle;
5154
- $[41] = url;
5155
- $[42] = webViewUrl;
5156
- $[43] = t14;
5164
+ $[32] = source;
5165
+ $[33] = storyTitle;
5166
+ $[34] = url;
5167
+ $[35] = webViewUrl;
5168
+ $[36] = t14;
5157
5169
  } else {
5158
- t14 = $[43];
5170
+ t14 = $[36];
5159
5171
  }
5160
5172
  const finalUrl = t14;
5161
5173
  let t15;
5162
- if ($[44] !== className || $[45] !== opened) {
5174
+ if ($[37] !== className || $[38] !== opened) {
5163
5175
  t15 = classNames([styles.container, className, {
5164
5176
  [styles.opened]: opened
5165
5177
  }]);
5166
- $[44] = className;
5167
- $[45] = opened;
5168
- $[46] = t15;
5178
+ $[37] = className;
5179
+ $[38] = opened;
5180
+ $[39] = t15;
5169
5181
  } else {
5170
- t15 = $[46];
5182
+ t15 = $[39];
5171
5183
  }
5172
5184
  let t16;
5173
- if ($[47] !== close || $[48] !== finalUrl || $[49] !== opened || $[50] !== source || $[51] !== webViewProps) {
5185
+ if ($[40] !== close || $[41] !== finalUrl || $[42] !== opened || $[43] !== source || $[44] !== webViewProps) {
5174
5186
  t16 = /*#__PURE__*/jsx(WebView, {
5175
5187
  url: finalUrl,
5176
5188
  source: source,
@@ -5180,17 +5192,17 @@ function WebViewContainer(t0) {
5180
5192
  className: styles.webView,
5181
5193
  onClose: close
5182
5194
  });
5183
- $[47] = close;
5184
- $[48] = finalUrl;
5185
- $[49] = opened;
5186
- $[50] = source;
5187
- $[51] = webViewProps;
5188
- $[52] = t16;
5195
+ $[40] = close;
5196
+ $[41] = finalUrl;
5197
+ $[42] = opened;
5198
+ $[43] = source;
5199
+ $[44] = webViewProps;
5200
+ $[45] = t16;
5189
5201
  } else {
5190
- t16 = $[52];
5202
+ t16 = $[45];
5191
5203
  }
5192
5204
  let t17;
5193
- if ($[53] !== onTransitionEnd || $[54] !== style || $[55] !== t15 || $[56] !== t16) {
5205
+ if ($[46] !== onTransitionEnd || $[47] !== style || $[48] !== t15 || $[49] !== t16) {
5194
5206
  t17 = /*#__PURE__*/jsx("div", {
5195
5207
  className: t15,
5196
5208
  style: style,
@@ -5198,13 +5210,13 @@ function WebViewContainer(t0) {
5198
5210
  ref: ref,
5199
5211
  children: t16
5200
5212
  });
5201
- $[53] = onTransitionEnd;
5202
- $[54] = style;
5203
- $[55] = t15;
5204
- $[56] = t16;
5205
- $[57] = t17;
5213
+ $[46] = onTransitionEnd;
5214
+ $[47] = style;
5215
+ $[48] = t15;
5216
+ $[49] = t16;
5217
+ $[50] = t17;
5206
5218
  } else {
5207
- t17 = $[57];
5219
+ t17 = $[50];
5208
5220
  }
5209
5221
  return t17;
5210
5222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/viewer",
3
- "version": "0.4.87",
3
+ "version": "0.4.89",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -64,14 +64,14 @@
64
64
  "dependencies": {
65
65
  "@babel/runtime": "^7.28.6",
66
66
  "@folklore/routes": "^0.4.4",
67
- "@micromag/core": "^0.4.86",
68
- "@micromag/element-badge": "^0.4.86",
69
- "@micromag/element-scroll": "^0.4.86",
70
- "@micromag/element-share-options": "^0.4.86",
71
- "@micromag/element-webview": "^0.4.86",
72
- "@micromag/elements": "^0.4.86",
73
- "@micromag/intl": "^0.4.86",
74
- "@micromag/screens": "^0.4.87",
67
+ "@micromag/core": "^0.4.88",
68
+ "@micromag/element-badge": "^0.4.88",
69
+ "@micromag/element-scroll": "^0.4.89",
70
+ "@micromag/element-share-options": "^0.4.88",
71
+ "@micromag/element-webview": "^0.4.89",
72
+ "@micromag/elements": "^0.4.89",
73
+ "@micromag/intl": "^0.4.88",
74
+ "@micromag/screens": "^0.4.89",
75
75
  "@react-spring/core": "^10.0.3",
76
76
  "@react-spring/web": "^10.0.3",
77
77
  "@use-gesture/react": "^10.3.0",
@@ -90,6 +90,6 @@
90
90
  "access": "public",
91
91
  "registry": "https://registry.npmjs.org/"
92
92
  },
93
- "gitHead": "2d1f40fa6f172c05d88ae59d4d356140f849edc4",
93
+ "gitHead": "b22ccb83a7c0679970a453b09e2be779ed68f839",
94
94
  "types": "es/index.d.ts"
95
95
  }