diff --git a/build/index.d.ts b/build/index.d.ts new file mode 100644 index 0000000..9b4fcdc --- /dev/null +++ b/build/index.d.ts @@ -0,0 +1,19 @@ +declare module 'use-viewport-sizes' { + /** + * Hook which observes viewport dimensions. Returns [width, height] of + * current visible viewport of app. + * + * If no input specified, returns the [width, height] when the window changes. + * + * If input is specified as a number, it interprets this as the number of + * miliseconds to debounce before updates. + * + * If the input is specified as a function, it accepts a callback + * with the viewport width and height passed in the first arg as + * { vpW, vpH }, and will only return a new value and update when + * the hash-value returned changes. + */ + export default function( + input:number | (({ vpW: number, vpH: number }) => String) + ):[vpW: number, vpH: number]; +} \ No newline at end of file diff --git a/build/index.js b/build/index.js index 3a0a180..e0539d0 100644 --- a/build/index.js +++ b/build/index.js @@ -1 +1 @@ -module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";r.r(t);var n=r(0);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,u=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw u}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>y});const r=require("react");function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r String) + ):[vpW: number, vpH: number]; +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 0dff6b1..f7dc14a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,5 @@ const path = require('path'); +const CopyPlugin = require('copy-webpack-plugin') module.exports = { entry: './src/index.js', @@ -19,7 +20,15 @@ module.exports = { } ] }, + plugins: [ + new CopyPlugin({ + patterns: [{ + from: path.join(__dirname, 'src', 'index.d.ts'), + to: path.join(__dirname, 'build', 'index.d.ts') + }] + }) + ], externals: { - 'react': 'commonjs react' + 'react': 'commonjs react' } }; \ No newline at end of file