@micromag/core 0.4.40 → 0.4.41

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/es/components.js CHANGED
@@ -673,9 +673,7 @@ function Card(_ref) {
673
673
  }, /*#__PURE__*/React.createElement(Label, null, footer)) : /*#__PURE__*/React.createElement("div", {
674
674
  className: classNames(['card-footer', footerClassName])
675
675
  }, /*#__PURE__*/React.createElement(Label, null, footer)) : null);
676
- var cardClassName = classNames(['card', _defineProperty(_defineProperty(_defineProperty(_defineProperty({
677
- className: className
678
- }, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), 'bg-dark', imageOverlay || theme === 'dark'), 'text-dark', theme === 'light'), 'text-light', imageOverlay || theme === 'dark' || theme === 'primary')]);
676
+ var cardClassName = classNames(['card', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), 'bg-dark', imageOverlay || theme === 'dark'), 'text-dark', theme === 'light'), 'text-light', imageOverlay || theme === 'dark' || theme === 'primary'), className]);
679
677
  if (href !== null) {
680
678
  return /*#__PURE__*/React.createElement(Link, {
681
679
  href: href,
@@ -1011,9 +1009,7 @@ function Dropdown(_ref) {
1011
1009
  };
1012
1010
  }, [visible, setEnabled]);
1013
1011
  return /*#__PURE__*/React.createElement("div", {
1014
- className: classNames(['dropdown-menu', _defineProperty(_defineProperty({
1015
- className: className
1016
- }, "dropdown-menu-".concat(align), align !== null), "show", visible)]),
1012
+ className: classNames(['dropdown-menu', _defineProperty(_defineProperty({}, "dropdown-menu-".concat(align), align !== null), "show", visible), className]),
1017
1013
  ref: refContainer
1018
1014
  }, children !== null ? children : items.map(function (it, index) {
1019
1015
  var _it$type = it.type,
@@ -1221,7 +1217,7 @@ function Navbar(_ref) {
1221
1217
  return setMenuVisible(!menuVisible);
1222
1218
  }, [setMenuVisible, menuVisible]);
1223
1219
  return /*#__PURE__*/React.createElement("nav", {
1224
- className: classNames(['navbar', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), theme !== null), "navbar-".concat(theme === 'light' ? 'light' : 'dark'), theme !== null), "text-".concat(theme === 'light' ? 'dark' : 'light'), theme !== null), "className", className), "navbar-expand-".concat(size), !withoutCollapse), 'navbar-expand', withoutCollapse), 'py-2', compact), 'px-2', compact), 'flex-nowrap', noWrap)])
1220
+ className: classNames(['navbar', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), theme !== null), "navbar-".concat(theme === 'light' ? 'light' : 'dark'), theme !== null), "text-".concat(theme === 'light' ? 'dark' : 'light'), theme !== null), "navbar-expand-".concat(size), !withoutCollapse), 'navbar-expand', withoutCollapse), 'py-2', compact), 'px-2', compact), 'flex-nowrap', noWrap), className])
1225
1221
  }, /*#__PURE__*/React.createElement("div", {
1226
1222
  className: classNames(['container-fluid', {
1227
1223
  'px-0': compact
package/es/contexts.js CHANGED
@@ -1023,23 +1023,45 @@ var usePlaybackMediaRef = function usePlaybackMediaRef() {
1023
1023
  // Cleanup: clear media registration when this screen deactivates or unmounts.
1024
1024
  // Note: we cannot check mediaRef.current here because React clears callback refs
1025
1025
  // before running effect cleanups, so mediaRef.current is always null at this point.
1026
+
1026
1027
  useEffect(function () {
1027
1028
  return function () {
1028
1029
  if (active) {
1030
+ console.log('clear media');
1029
1031
  setMedia(null);
1030
1032
  setIsBackground(false);
1031
1033
  }
1032
1034
  };
1033
- }, [active, setMedia, setIsBackground]);
1035
+ }, [active, setMedia, setIsBackground, updateKey]);
1036
+
1037
+ // useEffect(() => {
1038
+ // if (!active) {
1039
+ // console.log('unset media');
1040
+ // setMedia(null);
1041
+ // setIsBackground(false);
1042
+ // }
1043
+ // return () => {
1044
+ // if (active) {
1045
+ // console.log('clear media');
1046
+ // setMedia(null);
1047
+ // setIsBackground(false);
1048
+ // }
1049
+ // };
1050
+ // }, [active, setMedia, setIsBackground]);
1034
1051
 
1035
1052
  // Register media with context when active and no media is registered
1036
1053
  useEffect(function () {
1054
+ console.log('try to register media');
1037
1055
  if (!active || mediaRef.current === null || media !== null) {
1038
1056
  return;
1039
1057
  }
1058
+ console.log('register media');
1040
1059
  setIsBackground(background);
1041
1060
  setMedia(mediaRef.current);
1042
1061
  }, [active, background, media, updateKey, setMedia, setIsBackground]);
1062
+
1063
+ // console.log('playback', mediaRef.current, media);
1064
+
1043
1065
  return {
1044
1066
  ref: mediaRef,
1045
1067
  isCurrent: mediaRef.current === media
package/lib/components.js CHANGED
@@ -675,9 +675,7 @@ function Card(_ref) {
675
675
  }, /*#__PURE__*/React.createElement(Label, null, footer)) : /*#__PURE__*/React.createElement("div", {
676
676
  className: classNames(['card-footer', footerClassName])
677
677
  }, /*#__PURE__*/React.createElement(Label, null, footer)) : null);
678
- var cardClassName = classNames(['card', _defineProperty(_defineProperty(_defineProperty(_defineProperty({
679
- className: className
680
- }, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), 'bg-dark', imageOverlay || theme === 'dark'), 'text-dark', theme === 'light'), 'text-light', imageOverlay || theme === 'dark' || theme === 'primary')]);
678
+ var cardClassName = classNames(['card', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), 'bg-dark', imageOverlay || theme === 'dark'), 'text-dark', theme === 'light'), 'text-light', imageOverlay || theme === 'dark' || theme === 'primary'), className]);
681
679
  if (href !== null) {
682
680
  return /*#__PURE__*/React.createElement(Link, {
683
681
  href: href,
@@ -1013,9 +1011,7 @@ function Dropdown(_ref) {
1013
1011
  };
1014
1012
  }, [visible, setEnabled]);
1015
1013
  return /*#__PURE__*/React.createElement("div", {
1016
- className: classNames(['dropdown-menu', _defineProperty(_defineProperty({
1017
- className: className
1018
- }, "dropdown-menu-".concat(align), align !== null), "show", visible)]),
1014
+ className: classNames(['dropdown-menu', _defineProperty(_defineProperty({}, "dropdown-menu-".concat(align), align !== null), "show", visible), className]),
1019
1015
  ref: refContainer
1020
1016
  }, children !== null ? children : items.map(function (it, index) {
1021
1017
  var _it$type = it.type,
@@ -1223,7 +1219,7 @@ function Navbar(_ref) {
1223
1219
  return setMenuVisible(!menuVisible);
1224
1220
  }, [setMenuVisible, menuVisible]);
1225
1221
  return /*#__PURE__*/React.createElement("nav", {
1226
- className: classNames(['navbar', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), theme !== null), "navbar-".concat(theme === 'light' ? 'light' : 'dark'), theme !== null), "text-".concat(theme === 'light' ? 'dark' : 'light'), theme !== null), "className", className), "navbar-expand-".concat(size), !withoutCollapse), 'navbar-expand', withoutCollapse), 'py-2', compact), 'px-2', compact), 'flex-nowrap', noWrap)])
1222
+ className: classNames(['navbar', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(theme), theme !== null), "navbar-".concat(theme === 'light' ? 'light' : 'dark'), theme !== null), "text-".concat(theme === 'light' ? 'dark' : 'light'), theme !== null), "navbar-expand-".concat(size), !withoutCollapse), 'navbar-expand', withoutCollapse), 'py-2', compact), 'px-2', compact), 'flex-nowrap', noWrap), className])
1227
1223
  }, /*#__PURE__*/React.createElement("div", {
1228
1224
  className: classNames(['container-fluid', {
1229
1225
  'px-0': compact
package/lib/contexts.js CHANGED
@@ -1023,23 +1023,45 @@ var usePlaybackMediaRef = function usePlaybackMediaRef() {
1023
1023
  // Cleanup: clear media registration when this screen deactivates or unmounts.
1024
1024
  // Note: we cannot check mediaRef.current here because React clears callback refs
1025
1025
  // before running effect cleanups, so mediaRef.current is always null at this point.
1026
+
1026
1027
  React.useEffect(function () {
1027
1028
  return function () {
1028
1029
  if (active) {
1030
+ console.log('clear media');
1029
1031
  setMedia(null);
1030
1032
  setIsBackground(false);
1031
1033
  }
1032
1034
  };
1033
- }, [active, setMedia, setIsBackground]);
1035
+ }, [active, setMedia, setIsBackground, updateKey]);
1036
+
1037
+ // useEffect(() => {
1038
+ // if (!active) {
1039
+ // console.log('unset media');
1040
+ // setMedia(null);
1041
+ // setIsBackground(false);
1042
+ // }
1043
+ // return () => {
1044
+ // if (active) {
1045
+ // console.log('clear media');
1046
+ // setMedia(null);
1047
+ // setIsBackground(false);
1048
+ // }
1049
+ // };
1050
+ // }, [active, setMedia, setIsBackground]);
1034
1051
 
1035
1052
  // Register media with context when active and no media is registered
1036
1053
  React.useEffect(function () {
1054
+ console.log('try to register media');
1037
1055
  if (!active || mediaRef.current === null || media !== null) {
1038
1056
  return;
1039
1057
  }
1058
+ console.log('register media');
1040
1059
  setIsBackground(background);
1041
1060
  setMedia(mediaRef.current);
1042
1061
  }, [active, background, media, updateKey, setMedia, setIsBackground]);
1062
+
1063
+ // console.log('playback', mediaRef.current, media);
1064
+
1043
1065
  return {
1044
1066
  ref: mediaRef,
1045
1067
  isCurrent: mediaRef.current === media
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.4.40",
3
+ "version": "0.4.41",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -161,6 +161,6 @@
161
161
  "access": "public",
162
162
  "registry": "https://registry.npmjs.org/"
163
163
  },
164
- "gitHead": "6a9ff6e196a972abfd617f49353862cf445b0e83",
164
+ "gitHead": "c7856a747ba0a4466f4b63bc29e31003275ac6e0",
165
165
  "types": "es/index.d.ts"
166
166
  }