@folklore/hooks 0.0.57 → 0.0.59

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 (3) hide show
  1. package/dist/cjs.js +15 -27
  2. package/dist/es.js +15 -27
  3. package/package.json +2 -2
package/dist/cjs.js CHANGED
@@ -76,15 +76,8 @@ function useDailymotionPlayer() {
76
76
  width = 0,
77
77
  height = 0,
78
78
  duration = 0,
79
- autoplay = false,
80
79
  muted: initialMuted = false,
81
80
  start = 0,
82
- controls = true,
83
- queueAutoplayNext = false,
84
- queueEnable = false,
85
- sharingEnable = false,
86
- uiLogo = false,
87
- uiStartScreenInfo = true,
88
81
  embedPlayerId = null,
89
82
  onTimeUpdate: customOnTimeUpdate = null,
90
83
  getVideoId = url => {
@@ -168,16 +161,8 @@ function useDailymotionPlayer() {
168
161
  return;
169
162
  }
170
163
  const playerParams = {
171
- 'autoplay-d': autoplay,
172
- // muted,
173
164
  startTime: start,
174
- controls,
175
- aspectRatio: 'inherit',
176
- 'queue-autoplay-next': queueAutoplayNext,
177
- 'queue-enable': queueEnable,
178
- 'sharing-enable': sharingEnable,
179
- 'ui-logo': uiLogo,
180
- 'ui-start-screen-info': uiStartScreenInfo
165
+ aspectRatio: 'inherit'
181
166
  };
182
167
  let player = currentPlayer;
183
168
  if (player !== null) {
@@ -200,7 +185,7 @@ function useDailymotionPlayer() {
200
185
  debug('Create player [ID: %s]', videoId);
201
186
  }
202
187
  playerElementRef.current = element;
203
- }, [apiLoaded, elementHasChanged, videoId, width, height, autoplay, start, controls, queueAutoplayNext, queueEnable, sharingEnable, uiLogo, uiStartScreenInfo]);
188
+ }, [apiLoaded, elementHasChanged, videoId, width, height, start]);
204
189
  react.useEffect(() => {
205
190
  const {
206
191
  current: player = null
@@ -1781,7 +1766,6 @@ function useWindowSize() {
1781
1766
  return size;
1782
1767
  }
1783
1768
 
1784
- const hasViewport = typeof window !== 'undefined' && (window.visualViewport || null) !== null;
1785
1769
  const useVisualViewportSize = () => {
1786
1770
  const {
1787
1771
  width: windowWidth,
@@ -1794,22 +1778,26 @@ const useVisualViewportSize = () => {
1794
1778
  width: windowWidth,
1795
1779
  height: windowHeight
1796
1780
  });
1797
- const onResize = react.useCallback(e => {
1798
- const viewport = e.target;
1799
- setViewportSize({
1800
- width: viewport.width,
1801
- height: viewport.height
1802
- });
1803
- }, [setViewportSize]);
1804
1781
  react.useEffect(() => {
1805
- if (!hasViewport) {
1782
+ if (!typeof window !== 'undefined' && (window.visualViewport || null) !== null) {
1806
1783
  return () => {};
1807
1784
  }
1785
+ function onResize(e) {
1786
+ const viewport = e.target;
1787
+ setViewportSize({
1788
+ width: viewport.width,
1789
+ height: viewport.height
1790
+ });
1791
+ }
1792
+ setViewportSize({
1793
+ width: window.visualViewport.width,
1794
+ height: window.visualViewport.height
1795
+ });
1808
1796
  window.visualViewport.addEventListener('resize', onResize);
1809
1797
  return () => {
1810
1798
  window.visualViewport.removeEventListener('resize', onResize);
1811
1799
  };
1812
- }, [onResize]);
1800
+ }, [setViewportSize]);
1813
1801
  return {
1814
1802
  width: viewportWidth || windowWidth,
1815
1803
  height: viewportHeight || windowHeight
package/dist/es.js CHANGED
@@ -65,15 +65,8 @@ function useDailymotionPlayer() {
65
65
  width = 0,
66
66
  height = 0,
67
67
  duration = 0,
68
- autoplay = false,
69
68
  muted: initialMuted = false,
70
69
  start = 0,
71
- controls = true,
72
- queueAutoplayNext = false,
73
- queueEnable = false,
74
- sharingEnable = false,
75
- uiLogo = false,
76
- uiStartScreenInfo = true,
77
70
  embedPlayerId = null,
78
71
  onTimeUpdate: customOnTimeUpdate = null,
79
72
  getVideoId = url => {
@@ -157,16 +150,8 @@ function useDailymotionPlayer() {
157
150
  return;
158
151
  }
159
152
  const playerParams = {
160
- 'autoplay-d': autoplay,
161
- // muted,
162
153
  startTime: start,
163
- controls,
164
- aspectRatio: 'inherit',
165
- 'queue-autoplay-next': queueAutoplayNext,
166
- 'queue-enable': queueEnable,
167
- 'sharing-enable': sharingEnable,
168
- 'ui-logo': uiLogo,
169
- 'ui-start-screen-info': uiStartScreenInfo
154
+ aspectRatio: 'inherit'
170
155
  };
171
156
  let player = currentPlayer;
172
157
  if (player !== null) {
@@ -189,7 +174,7 @@ function useDailymotionPlayer() {
189
174
  debug('Create player [ID: %s]', videoId);
190
175
  }
191
176
  playerElementRef.current = element;
192
- }, [apiLoaded, elementHasChanged, videoId, width, height, autoplay, start, controls, queueAutoplayNext, queueEnable, sharingEnable, uiLogo, uiStartScreenInfo]);
177
+ }, [apiLoaded, elementHasChanged, videoId, width, height, start]);
193
178
  useEffect(() => {
194
179
  const {
195
180
  current: player = null
@@ -1770,7 +1755,6 @@ function useWindowSize() {
1770
1755
  return size;
1771
1756
  }
1772
1757
 
1773
- const hasViewport = typeof window !== 'undefined' && (window.visualViewport || null) !== null;
1774
1758
  const useVisualViewportSize = () => {
1775
1759
  const {
1776
1760
  width: windowWidth,
@@ -1783,22 +1767,26 @@ const useVisualViewportSize = () => {
1783
1767
  width: windowWidth,
1784
1768
  height: windowHeight
1785
1769
  });
1786
- const onResize = useCallback(e => {
1787
- const viewport = e.target;
1788
- setViewportSize({
1789
- width: viewport.width,
1790
- height: viewport.height
1791
- });
1792
- }, [setViewportSize]);
1793
1770
  useEffect(() => {
1794
- if (!hasViewport) {
1771
+ if (!typeof window !== 'undefined' && (window.visualViewport || null) !== null) {
1795
1772
  return () => {};
1796
1773
  }
1774
+ function onResize(e) {
1775
+ const viewport = e.target;
1776
+ setViewportSize({
1777
+ width: viewport.width,
1778
+ height: viewport.height
1779
+ });
1780
+ }
1781
+ setViewportSize({
1782
+ width: window.visualViewport.width,
1783
+ height: window.visualViewport.height
1784
+ });
1797
1785
  window.visualViewport.addEventListener('resize', onResize);
1798
1786
  return () => {
1799
1787
  window.visualViewport.removeEventListener('resize', onResize);
1800
1788
  };
1801
- }, [onResize]);
1789
+ }, [setViewportSize]);
1802
1790
  return {
1803
1791
  width: viewportWidth || windowWidth,
1804
1792
  height: viewportHeight || windowHeight
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/hooks",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "description": "React hooks",
5
5
  "keywords": [
6
6
  "javascript",
@@ -49,7 +49,7 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "0afeed292591d823f72f5611a078f94c21321d2e",
52
+ "gitHead": "c054f8aebebb312df15dbd87158516bbc750855f",
53
53
  "dependencies": {
54
54
  "@folklore/events": "^0.0.5",
55
55
  "@folklore/services": "^0.1.40",