Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ReactTraining/react-media
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.8.0
Choose a base ref
...
head repository: ReactTraining/react-media
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 1,302 additions and 3,892 deletions.
  1. +17 −0 .editorconfig
  2. +21 −0 .eslintrc
  3. +5 −4 .gitignore
  4. +2 −0 .npmrc
  5. +1 −0 .prettierignore
  6. +26 −0 .size-snapshot.json
  7. +23 −18 .travis.yml
  8. +24 −0 CHANGES.md
  9. +217 −31 README.md
  10. +69 −0 index.d.ts
  11. +7 −0 index.js
  12. +23 −0 jest.config.js
  13. +13 −1 modules/.babelrc
  14. +0 −15 modules/.eslintrc
  15. +186 −49 modules/Media.js
  16. +23 −0 modules/MediaQueryListener.js
  17. +106 −0 modules/__tests__/Media-ssr-test.js
  18. +323 −77 modules/__tests__/Media-test.js
  19. +19 −0 modules/__tests__/utils.js
  20. +1 −1 modules/index.js
  21. +39 −27 package.json
  22. +125 −0 rollup.config.js
  23. +0 −47 scripts/build.js
  24. +0 −52 scripts/config.js
  25. +32 −0 typeTest.tsx
  26. +0 −3,570 yarn.lock
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": ["import", "react", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
],
"globals": {
"__DEV__": true
},
"settings": {
"react": {
"version": "16"
}
}
}
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
/node_modules/

cjs
esm
umd
/cjs/
/esm/
/umd/
package-lock.json
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
message="Version %s"
package-lock=false
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package.json
26 changes: 26 additions & 0 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"esm/react-media.js": {
"bundled": 7913,
"minified": 3466,
"gzipped": 1246,
"treeshaked": {
"rollup": {
"code": 364,
"import_statements": 187
},
"webpack": {
"code": 3689
}
}
},
"umd/react-media.js": {
"bundled": 38897,
"minified": 11948,
"gzipped": 4235
},
"umd/react-media.min.js": {
"bundled": 15270,
"minified": 5110,
"gzipped": 2190
}
}
41 changes: 23 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
language: node_js
node_js: node
cache:
directories:
- "$HOME/.cache/yarn"
- node_modules
cache: yarn
env:
global:
- secure: J/xT+f4cyBtvmi1rNbwNOQcP/dnheS6Ydi0pHlf7PaEPYVauHWVOYt/aANwdkW4mZP/dlTpvG+J56DkDypvj6U7Q8xL+66PCWpP7geFkwz0kAzD0Els+zSdzpjSoAf4b7d+k8m+3hcjO+BePsDashnx4kLXtRAMbfPMsEaKyAyhMhod/dpBV69vXOTIeJMjPDoScl9LMDOoYGmwAYGRwqRmnH8twGfCknvqfns937r8bHXp6CwMVNhFi82nbGFcO5YDwQNjsp0yg0tzK1xXcIRwG86IABAIBlxvahmi6lsLeGnn21VwoAbYuc6zMj4jlhwjnj0Ko4faV1cQrUVAg5H2C6EdLHij/ufdcG9dwdNGpj9oEiUY97lZrBrmj9RDqGSN/ajA+CZqfjM0ohWXXytieMaCM6ldNF2alYRFaEcoGmHAOUW0Vw5NtUtpvA+cWwwGbxwWhEM+ZBL1/McdWJbH9M6FRj0M6LEB2AzjbtVpU7e74uRcgiwa5BeZYrZ+De9PpTK5XIS5yUTO6xxQ1hH1R6mtslfZTG9hQW/f4gmC/jUEn2OHJ+ZUTXU436zM8g7Q/Iz3DSADhvMFZ3G7ppCOF9csqYMm70lcH3vvMw4uWh/cyVCW70PFou7OMZju11rXxA2C+rzAmmiTqqjEoyDI1dSKi2fImIX2wMZaTOJY=
- NPM_TAG=$([[ "$TRAVIS_TAG" == *-* ]] && echo "next" || echo "latest")
- TEST_ENV=cjs BUILD_ENV=cjs
- TEST_ENV=umd BUILD_ENV=umd
- TEST_ENV=source
before_script:
- ([[ -z "$BUILD_ENV" ]] || npm run build)
script:
- npm run lint
- npm test
deploy:
provider: npm
email: npm@mjackson.me
api_key: "$NPM_TOKEN"
tag: "$NPM_TAG"
skip_cleanup: true
on:
all_branches: true
condition: '"$TRAVIS_TAG" =~ ^v[0-9]'
- yarn run lint
- yarn test
- yarn run testTypes
jobs:
include:
- stage: Release
if: tag =~ ^v[0-9]
env: NPM_TAG=$([[ "$TRAVIS_TAG" == *-* ]] && echo "next" || echo "latest")
script: echo "Releasing $TRAVIS_TAG to npm with tag \"$NPM_TAG\" ..."
deploy:
provider: npm
skip_cleanup: true
tag: "$NPM_TAG"
email: npm@mjackson.me
api_key: "$NPM_TOKEN"
on:
tags: true
24 changes: 24 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## [v1.9.0]
> Dec 12, 2018
- Add Typescript definitions [#76](https://github.com/ReactTraining/react-media/pull/76)
- Add `onChange` callback [#95](https://github.com/ReactTraining/react-media/pull/95)
- Add workaround for Safari not clearing up event handlers properly [#101](https://github.com/ReactTraining/react-media/pull/101)

[v1.9.0]: https://github.com/ReactTraining/react-media/compare/v1.7.0...v1.9.0

## [v1.7.0]
> Feb 1, 2018
- Add optional `targetWindow` prop [#78](https://github.com/ReactTraining/react-media/pull/78)

[v1.7.0]: https://github.com/ReactTraining/react-media/compare/v1.6.0...v1.7.0

## [v1.6.0]
> Jul 11, 2017
- Add support for multiple queries [#39](https://github.com/ReactTraining/react-media/pull/39)
- Add optional `defaultMatches` prop [#50](https://github.com/ReactTraining/react-media/pull/50)

[v1.6.0]: https://github.com/ReactTraining/react-media/compare/v1.5.0...v1.6.0

## [v1.5.0]
> Feb 17, 2017
Loading