From d3756003f373663398ea1590e534cbf003144bf9 Mon Sep 17 00:00:00 2001 From: Bhargav Ponnapalli Date: Thu, 26 Dec 2019 15:55:08 +0530 Subject: [PATCH] Use fullscreen bug fixes (#196) * Update readme * v3.6.0 --- lerna.json | 2 +- packages/boundingclientrect-ref/package.json | 2 +- packages/boundingclientrect/package.json | 2 +- packages/countdown/package.json | 2 +- packages/counter/package.json | 2 +- packages/debounce/package.json | 2 +- packages/did-mount/package.json | 2 +- packages/did-update/package.json | 2 +- packages/docusaurus/package.json | 2 +- packages/eslint-config/package.json | 2 +- packages/fork-ref/package.json | 2 +- packages/fullscreen/README.md | 174 ++++++++++++++++-- packages/fullscreen/package.json | 2 +- packages/geolocation/package.json | 2 +- packages/input/package.json | 2 +- .../intersection-observer-ref/package.json | 2 +- packages/interval/package.json | 2 +- packages/isomorphic-effect/package.json | 2 +- packages/key/package.json | 2 +- packages/keys/package.json | 2 +- packages/localstorage/package.json | 2 +- packages/mouse/package.json | 2 +- packages/mutation-observer-ref/package.json | 2 +- packages/mutation-observer/package.json | 2 +- packages/navigator-language/package.json | 2 +- packages/on-window-resize/package.json | 2 +- packages/on-window-scroll/package.json | 2 +- packages/online/package.json | 2 +- packages/outside-click-ref/package.json | 2 +- packages/outside-click/package.json | 2 +- packages/previous/package.json | 2 +- packages/raf/package.json | 2 +- packages/rooks/package.json | 2 +- packages/select/package.json | 2 +- packages/sessionstorage/package.json | 2 +- packages/shared/package.json | 2 +- packages/storybook/package.json | 2 +- packages/storybook/src/fullscreen.js | 4 +- packages/throttle/package.json | 2 +- packages/time-ago/package.json | 2 +- packages/timeout/package.json | 2 +- packages/toggle/package.json | 2 +- packages/visibility-sensor/package.json | 2 +- packages/will-unmount/package.json | 2 +- packages/window-size/package.json | 2 +- packages/worker/package.json | 2 +- 46 files changed, 209 insertions(+), 57 deletions(-) diff --git a/lerna.json b/lerna.json index d7d7a34062..f636a5df33 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,7 @@ "packages/*" ], "useWorkspaces": true, - "version": "3.6.0-canary.0", + "version": "3.6.0", "changelog": { "repo": "imbhargav5/rooks", "cacheDir": ".changelog", diff --git a/packages/boundingclientrect-ref/package.json b/packages/boundingclientrect-ref/package.json index fafff8e649..63dff988c7 100644 --- a/packages/boundingclientrect-ref/package.json +++ b/packages/boundingclientrect-ref/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-boundingclientrect-ref@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/boundingclientrect/package.json b/packages/boundingclientrect/package.json index f31a705cde..72ca1e7188 100644 --- a/packages/boundingclientrect/package.json +++ b/packages/boundingclientrect/package.json @@ -29,7 +29,7 @@ "rooks", "react-hooks.org" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-boundingclientrect@", "publishConfig": { "access": "public" diff --git a/packages/countdown/package.json b/packages/countdown/package.json index f66419f81a..66fb15845d 100644 --- a/packages/countdown/package.json +++ b/packages/countdown/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-countdown@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/counter/package.json b/packages/counter/package.json index 848afc80b6..409af3903d 100644 --- a/packages/counter/package.json +++ b/packages/counter/package.json @@ -29,7 +29,7 @@ "react-hooks.org", "counter hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "publishConfig": { "access": "public" }, diff --git a/packages/debounce/package.json b/packages/debounce/package.json index fb8120891b..3f2f5f6e5f 100644 --- a/packages/debounce/package.json +++ b/packages/debounce/package.json @@ -29,7 +29,7 @@ "rooks", "react-hooks.org" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-debounce@", "publishConfig": { "access": "public" diff --git a/packages/did-mount/package.json b/packages/did-mount/package.json index f58b39c577..424fe02257 100644 --- a/packages/did-mount/package.json +++ b/packages/did-mount/package.json @@ -30,7 +30,7 @@ "componentDidMount", "lifecycle" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-did-mount@", "publishConfig": { "access": "public" diff --git a/packages/did-update/package.json b/packages/did-update/package.json index 1b6c0bd128..e31676c221 100644 --- a/packages/did-update/package.json +++ b/packages/did-update/package.json @@ -27,7 +27,7 @@ "rooks", "react-hooks.org" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-did-update@", "publishConfig": { "access": "public" diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index 56f0ba9910..2f3de620f2 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -1,6 +1,6 @@ { "name": "docusaurus", - "version": "3.6.0-canary.0", + "version": "3.6.0", "private": true, "scripts": { "examples": "docusaurus-examples", diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index e9f423e528..06b010c1a3 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-rooks", - "version": "3.6.0-canary.0", + "version": "3.6.0", "description": "Eslint config for rooks.", "keywords": [ "eslint", diff --git a/packages/fork-ref/package.json b/packages/fork-ref/package.json index cb4c7d57db..53f194755f 100644 --- a/packages/fork-ref/package.json +++ b/packages/fork-ref/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-fork-ref@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/fullscreen/README.md b/packages/fullscreen/README.md index 065b42f5ef..097b5fa0dc 100644 --- a/packages/fullscreen/README.md +++ b/packages/fullscreen/README.md @@ -21,19 +21,171 @@ import useFullscreen from "@rooks/use-fullscreen" ### Usage ```jsx +import React, { useState, useRef } from "react"; +import ReactDOM from "react-dom"; +import { useFullscreen } from "rooks"; + +const styles = { + html: { + fontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif", + padding: "30px 10px 0 0", + fontSize: "20px", + lineHeight: "1.4", + color: "#737373", + background: "#f0f0f0", + WebkitFontSmoothing: "antialiased" + }, + hr: { + border: "none", + borderTop: "1px solid #e6e6e6", + margin: "20px 0" + }, + a: { + color: "#666" + }, + h1: { + margin: "0", + fontSize: "40px", + textAlign: "center" + }, + ul: { + padding: "0 0 0 40px", + margin: "1em 0", + padding: "0", + margin: "40px 0 0 0", + listStyle: "none" + }, + button: { + fontSize: "13px" + }, + container: { + width: "500px", + padding: "30px 20px", + margin: "0 auto 50px auto", + background: "#fcfcfc", + textAlign: "center", + border: "1px solid #b3b3b3", + borderRadius: "4px", + boxShadow: "0 1px 10px #a7a7a7, inset 0 1px 0 #fff" + }, + demo_img: { + cursor: "pointer" + }, + header_p: { + fontSize: "17px" + } +}; + function Demo() { - const {isEnabled, toggle} = useFullscreen(); - return ( - { - if(isEnabled) { - toggle(e.target)} - } - } - /> - ) + const container = useRef(); + const { + isEnabled, + toggle, + onChange, + onError, + request, + exit, + isFullscreen, + element + } = useFullscreen(); + const [changeCount, setChangeCount] = useState(0); + const [errorCount, setErrorCount] = useState(0); + + onChange(() => { + setChangeCount(changeCount + 1); + }); + onError(() => { + setErrorCount(errorCount + 1); + }); + + return ( +
+
+
+

useFullscreen

+

+ Simple react hook for cross-browser usage of the JavaScript{" "} + + Fullscreen API + + , which lets you bring the page or any element into fullscreen. + Smoothens out the browser implementation differences, so you don't + have too. +

+
+
+
+

Try out the Fullscreen API

+ + + + +
+
+
    +
  • + Supported/allowed: {JSON.stringify(isEnabled)} +
  • +
  • Is fullscreen: {JSON.stringify(isFullscreen)}
  • +
  • + Changed {changeCount} {changeCount !== 1 ? "times" : "time"} +
  • +
  • + {errorCount} {errorCount !== 1 ? "errors" : "error"} +
  • +
  • + Element:{" "} + {element + ? `${element.tagName.toLowerCase()} ${element.id}` + : "null"} +
  • +
+
+ +
+
+

Click the image to make it fullscreen

+ { + toggle(e.target); + }} + /> +
+
+
+ ); } + render() ``` diff --git a/packages/fullscreen/package.json b/packages/fullscreen/package.json index 82fd77d796..b27ded9c1d 100644 --- a/packages/fullscreen/package.json +++ b/packages/fullscreen/package.json @@ -35,7 +35,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-fullscreen@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/geolocation/package.json b/packages/geolocation/package.json index 6b3458c1c4..570fabf1a1 100644 --- a/packages/geolocation/package.json +++ b/packages/geolocation/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-geolocation@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/input/package.json b/packages/input/package.json index 86246f9fb6..4335bef9ca 100644 --- a/packages/input/package.json +++ b/packages/input/package.json @@ -28,7 +28,7 @@ "rooks", "input hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-input@", "publishConfig": { "access": "public" diff --git a/packages/intersection-observer-ref/package.json b/packages/intersection-observer-ref/package.json index 50fa6b7579..8c5140481a 100644 --- a/packages/intersection-observer-ref/package.json +++ b/packages/intersection-observer-ref/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-intersection-observer-ref@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/interval/package.json b/packages/interval/package.json index 40ea4979ac..459d81ecdc 100644 --- a/packages/interval/package.json +++ b/packages/interval/package.json @@ -29,7 +29,7 @@ "setInterval", "interval" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-interval@", "publishConfig": { "access": "public" diff --git a/packages/isomorphic-effect/package.json b/packages/isomorphic-effect/package.json index cec5bc2497..461fc42cc5 100644 --- a/packages/isomorphic-effect/package.json +++ b/packages/isomorphic-effect/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-isomorphic-effect@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/key/package.json b/packages/key/package.json index da029495a4..70bdd58c40 100644 --- a/packages/key/package.json +++ b/packages/key/package.json @@ -29,7 +29,7 @@ "keyboard event", "key" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-key@", "publishConfig": { "access": "public" diff --git a/packages/keys/package.json b/packages/keys/package.json index 6efe6f90c1..9ef51d8842 100644 --- a/packages/keys/package.json +++ b/packages/keys/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-keys@", "publishConfig": { "access": "public" diff --git a/packages/localstorage/package.json b/packages/localstorage/package.json index aa38de2f15..5f365ad622 100644 --- a/packages/localstorage/package.json +++ b/packages/localstorage/package.json @@ -28,7 +28,7 @@ "rooks", "hooks" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-localstorage@", "publishConfig": { "access": "public" diff --git a/packages/mouse/package.json b/packages/mouse/package.json index e43dff3fc1..fa2c82bd82 100644 --- a/packages/mouse/package.json +++ b/packages/mouse/package.json @@ -29,7 +29,7 @@ "mouse", "mouse hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-mouse@", "publishConfig": { "access": "public" diff --git a/packages/mutation-observer-ref/package.json b/packages/mutation-observer-ref/package.json index ea03b5272b..796692133d 100644 --- a/packages/mutation-observer-ref/package.json +++ b/packages/mutation-observer-ref/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-mutation-observer-ref@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/mutation-observer/package.json b/packages/mutation-observer/package.json index d219007871..8fb18e0f4d 100644 --- a/packages/mutation-observer/package.json +++ b/packages/mutation-observer/package.json @@ -31,7 +31,7 @@ "mutation observer", "mutation observer hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-mutation-observer@", "publishConfig": { "access": "public" diff --git a/packages/navigator-language/package.json b/packages/navigator-language/package.json index 910c9ff734..a11be5558b 100644 --- a/packages/navigator-language/package.json +++ b/packages/navigator-language/package.json @@ -29,7 +29,7 @@ "navigator language", "navigator language hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-navigator-language@", "publishConfig": { "access": "public" diff --git a/packages/on-window-resize/package.json b/packages/on-window-resize/package.json index f3ccc355a7..1a3b618a00 100644 --- a/packages/on-window-resize/package.json +++ b/packages/on-window-resize/package.json @@ -29,7 +29,7 @@ "window", "resize" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "publishConfig": { "access": "public" }, diff --git a/packages/on-window-scroll/package.json b/packages/on-window-scroll/package.json index 4c4d2fa519..a9e62628f5 100644 --- a/packages/on-window-scroll/package.json +++ b/packages/on-window-scroll/package.json @@ -29,7 +29,7 @@ "window", "scroll" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "publishConfig": { "access": "public" }, diff --git a/packages/online/package.json b/packages/online/package.json index 8b6187a60e..ad3308385a 100644 --- a/packages/online/package.json +++ b/packages/online/package.json @@ -29,7 +29,7 @@ "online status", "online status hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-online@", "publishConfig": { "access": "public" diff --git a/packages/outside-click-ref/package.json b/packages/outside-click-ref/package.json index 0814c52ad5..3a37db6edf 100644 --- a/packages/outside-click-ref/package.json +++ b/packages/outside-click-ref/package.json @@ -31,7 +31,7 @@ "peerDependencies": { "react": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-outside-click-ref@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/outside-click/package.json b/packages/outside-click/package.json index 9789b0614d..790da42d15 100644 --- a/packages/outside-click/package.json +++ b/packages/outside-click/package.json @@ -29,7 +29,7 @@ "hooks", "ref outside click" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-outside-click@", "publishConfig": { "access": "public" diff --git a/packages/previous/package.json b/packages/previous/package.json index f06d19570a..ad01cef976 100644 --- a/packages/previous/package.json +++ b/packages/previous/package.json @@ -27,7 +27,7 @@ "rooks", "react-hooks.org" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-previous@", "publishConfig": { "access": "public" diff --git a/packages/raf/package.json b/packages/raf/package.json index 1608768f58..077b0ded98 100644 --- a/packages/raf/package.json +++ b/packages/raf/package.json @@ -29,7 +29,7 @@ "hooks", "raf" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-raf@", "publishConfig": { "access": "public" diff --git a/packages/rooks/package.json b/packages/rooks/package.json index 98d1af3b98..442d8d5bff 100644 --- a/packages/rooks/package.json +++ b/packages/rooks/package.json @@ -1,6 +1,6 @@ { "name": "rooks", - "version": "3.6.0-canary.0", + "version": "3.6.0", "description": "Useful React hooks for everyone.", "author": "Bhargav Ponnapalli (https://github.com/imbhargav5)", "homepage": "https://github.com/react-hooks-org/rooks#readme", diff --git a/packages/select/package.json b/packages/select/package.json index 398c6df302..627561c9e9 100644 --- a/packages/select/package.json +++ b/packages/select/package.json @@ -29,7 +29,7 @@ "hooks", "list" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-select@", "publishConfig": { "access": "public" diff --git a/packages/sessionstorage/package.json b/packages/sessionstorage/package.json index 863a0706bb..c4188891d7 100644 --- a/packages/sessionstorage/package.json +++ b/packages/sessionstorage/package.json @@ -28,7 +28,7 @@ "hooks", "session storage" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-sessionstorage@", "publishConfig": { "access": "public" diff --git a/packages/shared/package.json b/packages/shared/package.json index 99af691cf6..3101696b04 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "shared", - "version": "3.6.0-canary.0", + "version": "3.6.0", "description": "Shared package with all utils", "author": "Bhargav Ponnapalli (https://github.com/imbhargav5)", "homepage": "https://github.com/imbhargav5/rooks#readme", diff --git a/packages/storybook/package.json b/packages/storybook/package.json index d34d9541c7..2e1e788e30 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -1,6 +1,6 @@ { "name": "storybook", - "version": "3.6.0-canary.0", + "version": "3.6.0", "private": true, "description": "Storybook for hooks", "main": "index.js", diff --git a/packages/storybook/src/fullscreen.js b/packages/storybook/src/fullscreen.js index 197da84d50..d57842a78a 100644 --- a/packages/storybook/src/fullscreen.js +++ b/packages/storybook/src/fullscreen.js @@ -64,7 +64,7 @@ storiesOf("useFullscreen", module) function FullscreenDemo() { const container = useRef(); - const [ + const { isEnabled, toggle, onChange, @@ -73,7 +73,7 @@ function FullscreenDemo() { exit, isFullscreen, element - ] = useFullscreen(); + } = useFullscreen(); const [changeCount, setChangeCount] = useState(0); const [errorCount, setErrorCount] = useState(0); diff --git a/packages/throttle/package.json b/packages/throttle/package.json index 7530e5b310..6e2a2dee33 100644 --- a/packages/throttle/package.json +++ b/packages/throttle/package.json @@ -32,7 +32,7 @@ "react": ">=16.8.0", "react-dom": ">=16.8.0" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-throttle@", "readme": "ERROR: No README data found!", "publishConfig": { diff --git a/packages/time-ago/package.json b/packages/time-ago/package.json index 39d8b300fe..e142c8fb4a 100644 --- a/packages/time-ago/package.json +++ b/packages/time-ago/package.json @@ -29,7 +29,7 @@ "timeago.js", "timeago hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-time-ago@", "publishConfig": { "access": "public" diff --git a/packages/timeout/package.json b/packages/timeout/package.json index 80062be1c7..8aeb1db529 100644 --- a/packages/timeout/package.json +++ b/packages/timeout/package.json @@ -29,7 +29,7 @@ "timeout", "timeout hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-timeout@", "publishConfig": { "access": "public" diff --git a/packages/toggle/package.json b/packages/toggle/package.json index a8d9640df7..8fc743782e 100644 --- a/packages/toggle/package.json +++ b/packages/toggle/package.json @@ -29,7 +29,7 @@ "rooks", "toggle hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-toggle@", "publishConfig": { "access": "public" diff --git a/packages/visibility-sensor/package.json b/packages/visibility-sensor/package.json index 85dfdd54a2..f6c161cee5 100644 --- a/packages/visibility-sensor/package.json +++ b/packages/visibility-sensor/package.json @@ -29,7 +29,7 @@ "rooks", "visibility sensor hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-visibility-sensor@", "publishConfig": { "access": "public" diff --git a/packages/will-unmount/package.json b/packages/will-unmount/package.json index 09872b7f7a..779b916876 100644 --- a/packages/will-unmount/package.json +++ b/packages/will-unmount/package.json @@ -30,7 +30,7 @@ "unmount", "unmount hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-will-unmount@", "publishConfig": { "access": "public" diff --git a/packages/window-size/package.json b/packages/window-size/package.json index cc979639ee..f6479ea76a 100644 --- a/packages/window-size/package.json +++ b/packages/window-size/package.json @@ -30,7 +30,7 @@ "window size", "window size hook" ], - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-window-size@", "private": false, "jest": { diff --git a/packages/worker/package.json b/packages/worker/package.json index cac496ca27..10f5763547 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -20,7 +20,7 @@ "pregenerate:types": "rimraf index.d.ts", "generate:types": "tsc" }, - "version": "3.6.0-canary.0", + "version": "3.6.0", "_id": "@rooks/use-worker@", "keywords": [ "react-hooks.org",