@micromag/core 0.3.824 → 0.4.4

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 (64) hide show
  1. package/assets/css/styles.css +31 -31
  2. package/assets/css/vendor.css +4 -3
  3. package/es/components.d.ts +628 -0
  4. package/es/components.js +947 -2301
  5. package/es/contexts.d.ts +297 -0
  6. package/es/contexts.js +154 -341
  7. package/es/hooks.d.ts +333 -0
  8. package/es/hooks.js +22 -17
  9. package/es/index.d.ts +665 -0
  10. package/es/index.js +2 -772
  11. package/es/styles.css +35 -0
  12. package/es/utils.d.ts +214 -0
  13. package/lib/components.js +955 -2309
  14. package/lib/contexts.js +153 -340
  15. package/lib/hooks.js +21 -16
  16. package/lib/index.js +0 -771
  17. package/lib/styles.css +35 -0
  18. package/package.json +39 -46
  19. package/styles/bootstrap-overrides.css +111 -0
  20. package/styles/bootstrap-patches.css +486 -0
  21. package/styles/breadcrumb.module.css +5 -0
  22. package/styles/button.module.css +82 -0
  23. package/styles/buttons.module.css +3 -0
  24. package/styles/clear.module.css +23 -0
  25. package/styles/collapsable-panel.module.css +31 -0
  26. package/styles/conversation.module.css +37 -0
  27. package/styles/dialog.module.css +13 -0
  28. package/styles/empty.module.css +22 -0
  29. package/styles/form-panel.module.css +3 -0
  30. package/styles/form.module.css +22 -0
  31. package/styles/link.module.css +9 -0
  32. package/styles/map.module.css +43 -0
  33. package/styles/media.module.css +3 -0
  34. package/styles/modal.module.css +22 -0
  35. package/styles/modals.module.css +12 -0
  36. package/styles/navbar.module.css +9 -0
  37. package/styles/pagination.module.css +3 -0
  38. package/styles/panel.module.css +3 -0
  39. package/styles/panels.module.css +3 -0
  40. package/styles/placeholder-block.module.css +29 -0
  41. package/styles/placeholder-text.module.css +17 -0
  42. package/styles/placeholders.module.css +3 -0
  43. package/styles/preview.module.css +34 -0
  44. package/styles/quiz-answer.module.css +29 -0
  45. package/styles/screen-placeholder.module.css +5 -0
  46. package/styles/screen-sizer.module.css +14 -0
  47. package/styles/screen.module.css +52 -0
  48. package/styles/screens.module.css +16 -0
  49. package/styles/share-options.module.css +27 -0
  50. package/{scss/_placeholders.scss → styles/shared.module.css} +103 -97
  51. package/styles/slideshow.module.css +28 -0
  52. package/styles/spinner.module.css +43 -0
  53. package/styles/styles.css +1 -0
  54. package/styles/survey-answer.module.css +18 -0
  55. package/styles/tabs.module.css +4 -0
  56. package/styles/theme.css +84 -0
  57. package/styles/transition.module.css +9 -0
  58. package/{scss/vendor.scss → styles/vendor.css} +16 -30
  59. package/styles/video-360.module.css +15 -0
  60. package/scss/_mixins.scss +0 -34
  61. package/scss/_theme.scss +0 -114
  62. package/scss/_variables.scss +0 -12
  63. package/scss/styles.scss +0 -1
  64. package/scss/upload.scss +0 -1
package/lib/hooks.js CHANGED
@@ -228,16 +228,21 @@ function useDragProgress() {
228
228
  _useState4 = _slicedToArray(_useState3, 2),
229
229
  direction = _useState4[0],
230
230
  setDirection = _useState4[1];
231
- var spring = react.useCallback(function () {
232
- return _objectSpread({
233
- progress: wantedProgress,
234
- immediate: dragging || disabled,
235
- onResolve: function onResolve() {
236
- setDirection(0);
237
- }
238
- }, springParams);
239
- }, [wantedProgress, disabled]);
240
- var _useSpring = core$1.useSpring(spring),
231
+
232
+ // In react-spring v10, useSpring(fn) without deps stores the initial update and
233
+ // re-applies it via ctrl.start() in a layout effect on EVERY render, resetting the
234
+ // spring to its initial value. To prevent this, we pass a dummy SpringRef as `ref`
235
+ // in the props — when ctrl.ref is set, the layout effect queues updates instead of
236
+ // starting them, so our imperative api.start() calls are not overridden.
237
+ var imperativeRef = core$1.useSpringRef();
238
+ var _useSpring = core$1.useSpring(function () {
239
+ return _objectSpread({
240
+ ref: imperativeRef,
241
+ from: {
242
+ progress: wantedProgress
243
+ }
244
+ }, springParams);
245
+ }),
241
246
  _useSpring2 = _slicedToArray(_useSpring, 2),
242
247
  progress = _useSpring2[0].progress,
243
248
  api = _useSpring2[1];
@@ -264,13 +269,13 @@ function useDragProgress() {
264
269
  if (active !== dragging) {
265
270
  setDragging(active);
266
271
  }
267
- api.start({
272
+ api.start(_objectSpread({
268
273
  progress: newProgress,
269
274
  immediate: active,
270
275
  onResolve: !active ? function () {
271
276
  setDirection(0);
272
277
  } : function () {}
273
- });
278
+ }, springParams));
274
279
  if (onProgress !== null) {
275
280
  onProgress(newProgress, gestureState);
276
281
  }
@@ -286,15 +291,15 @@ function useDragProgress() {
286
291
  if (!refDragging.current && wantedProgress !== refProgress.current) {
287
292
  setDirection(wantedProgress < refProgress.current ? -1 : 1);
288
293
  refProgress.current = wantedProgress;
289
- api.start({
294
+ api.start(_objectSpread({
290
295
  progress: wantedProgress,
291
- immediate: false,
296
+ immediate: disabled,
292
297
  onResolve: function onResolve() {
293
298
  setDirection(0);
294
299
  }
295
- });
300
+ }, springParams));
296
301
  }
297
- }, [wantedProgress]);
302
+ }, [wantedProgress, disabled]);
298
303
  var transitioning = react.useMemo(function () {
299
304
  return wantedProgress !== progress.get() || progress.isAnimating || dragging;
300
305
  }, [wantedProgress, progress.isAnimating, dragging]);