typography
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
@@ -6,2 +6,11 @@ # Change Log | ||
<a name="1.0.0-alpha.2"></a> | ||
# [1.0.0-alpha.2](https://github.com/KyleAMathews/typography.js/compare/typography@1.0.0-alpha.1...typography@1.0.0-alpha.2) (2018-09-01) | ||
**Note:** Version bump only for package typography | ||
<a name="1.0.0-alpha.1"></a> | ||
@@ -8,0 +17,0 @@ # [1.0.0-alpha.1](https://github.com/KyleAMathews/typography.js/compare/typography@1.0.0-alpha.0...typography@1.0.0-alpha.1) (2018-09-01) |
@@ -1,2 +0,2 @@ | ||
var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;var r,i,o=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,i){for(var o,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),s=1;s<arguments.length;s++){for(var u in o=Object(arguments[s]))t.call(o,u)&&(l[u]=o[u]);if(e){a=e(o);for(var c=0;c<a.length;c++)n.call(o,a[c])&&(l[a[c]]=o[a[c]])}}return l},a=function(e,t){t||(t=[0,""]),e=String(e);var n=parseFloat(e,10);return t[0]=n,t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},l=function(e){return a(e)[0]},s=function(e){return null==e&&(e=e),function(t,n,r,i){null==r&&(r=e),null==i&&(i=r);var o=a(t)[1];if(o===n)return t;var s=l(t);if("px"!==o)if("em"===o)s=l(t)*l(r);else if("rem"===o)s=l(t)*l(e);else{if("ex"!==o)return t;s=l(t)*l(r)*2}var u=s;if("px"!==n)if("em"===n)u=s/l(i);else if("rem"===n)u=s/l(e);else{if("ex"!==n)return t;u=s/l(i)/2}return parseFloat(u.toFixed(5))+n}},u=a,c=function(e){return u(e)[1]},h=function(e){return u(e)[0]},f={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},b=function(e,t){var n,r=s(t.baseFontSize),i=h(r(e,"px")),o=h(t.baseLineHeightInPx),a=h(r(t.minLinePadding,"px"));return(n=t.roundToNearestHalfLine?Math.ceil(2*i/o)/2:Math.ceil(i/o))*o-i<2*a&&(n+=t.roundToNearestHalfLine?.5:1),n},d=function(e){var t=s(e.baseFontSize);return function(n,r,i){null==n&&(n=1),null==r&&(r=e.baseFontSize),null==i&&(i=0);var o=n*h(e.baseLineHeightInPx)-i+"px",a=t(o,e.rhythmUnit,r);return"px"===c(a)&&(a=Math.floor(h(a))+c(a)),parseFloat(h(a).toFixed(5))+c(a)}},p="[object Number]",g=Object.prototype.toString;r=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&g.call(e)==p},i={"minor second":16/15,"major second":9/8,"minor third":1.2,"major third":4/3,"diminished fourth":Math.sqrt(2),"perfect fifth":1.5,"minor sixth":1.6,golden:1.61803398875,phi:1.61803398875,"major sixth":5/3,"minor seventh":16/9,"major seventh":15/8,octave:2,"major tenth":2.5,"major eleventh":8/3,"major twelfth":3,"double octave":4};module.exports=function(e){var t,n,a,l,u=o({},{baseFontSize:"16px",baseLineHeight:1.45,headerLineHeight:1.1,scaleRatio:2,googleFonts:[],headerFontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","sans-serif"],bodyFontFamily:["georgia","serif"],headerColor:"inherit",bodyColor:"hsla(0,0%,0%,0.8)",headerWeight:"bold",bodyWeight:"normal",boldWeight:"bold",includeNormalize:!0,blockMarginBottom:1},e),p=(t=u,n=JSON.parse(JSON.stringify(f)),a=Object.assign({},n,t),l=s(a.baseFontSize),c(a.baseLineHeight)?(h(l(a.baseFontSize,"px")),a.baseLineHeightInPx=l(a.baseLineHeight,"px")):a.baseLineHeightInPx=h(a.baseFontSize)*a.baseLineHeight+"px",{rhythm:d(a),establishBaseline:function(){return s((e=a).baseFontSize),{fontSize:h(e.baseFontSize)/16*100+"%",lineHeight:e.baseLineHeight.toString()};var e},linesForFontSize:function(e){return b(e,a)},adjustFontSizeTo:function(e,t,n){return null==t&&(t="auto"),function(e,t,n,r){null==n&&(n=r.baseFontSize),"%"===c(e)&&(e=h(r.baseFontSize)*(h(e)/100)+"px");var i=s(r.baseFontSize);e=i(e,"px",n=i(n,"px"));var o=d(r);return"auto"===t&&(t=b(e,r)),{fontSize:i(e,r.rhythmUnit,n),lineHeight:o(t,n)}}(e,t,n,a)}});return p.scale=function(e){var t=parseInt(u.baseFontSize,10),n=function(e,t){var n;return null==e&&(e=0),null==t&&(t="golden"),n=r(t)?t:null!=i[t]?i[t]:i.golden,Math.pow(n,e)}(e,u.scaleRatio)*t+"px";return p.adjustFontSizeTo(n)},Object.assign({},{options:u},p)}; | ||
var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;var r,i,o=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,i){for(var o,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),s=1;s<arguments.length;s++){for(var u in o=Object(arguments[s]))t.call(o,u)&&(l[u]=o[u]);if(e){a=e(o);for(var c=0;c<a.length;c++)n.call(o,a[c])&&(l[a[c]]=o[a[c]])}}return l},a=function(e,t){t||(t=[0,""]),e=String(e);var n=parseFloat(e,10);return t[0]=n,t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},l=function(e){return a(e)[0]},s=function(e){return null==e&&(e=e),function(t,n,r,i){null==r&&(r=e),null==i&&(i=r);var o=a(t)[1];if(o===n)return t;var s=l(t);if("px"!==o)if("em"===o)s=l(t)*l(r);else if("rem"===o)s=l(t)*l(e);else{if("ex"!==o)return t;s=l(t)*l(r)*2}var u=s;if("px"!==n)if("em"===n)u=s/l(i);else if("rem"===n)u=s/l(e);else{if("ex"!==n)return t;u=s/l(i)/2}return parseFloat(u.toFixed(5))+n}},u=a,c=function(e){return u(e)[1]},h=function(e){return u(e)[0]},f={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},b=function(e,t){var n,r=s(t.baseFontSize),i=h(r(e,"px")),o=h(t.baseLineHeightInPx),a=h(r(t.minLinePadding,"px"));return(n=t.roundToNearestHalfLine?Math.ceil(2*i/o)/2:Math.ceil(i/o))*o-i<2*a&&(n+=t.roundToNearestHalfLine?.5:1),n},d=function(e){var t=s(e.baseFontSize);return function(n,r,i){null==n&&(n=1),null==r&&(r=e.baseFontSize),null==i&&(i=0);var o=n*h(e.baseLineHeightInPx)-i+"px",a=t(o,e.rhythmUnit,r);return"px"===c(a)&&(a=Math.floor(h(a))+c(a)),parseFloat(h(a).toFixed(5))+c(a)}},g="[object Number]",p=Object.prototype.toString;r=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==g},i={"minor second":16/15,"major second":9/8,"minor third":1.2,"major third":4/3,"diminished fourth":Math.sqrt(2),"perfect fifth":1.5,"minor sixth":1.6,golden:1.61803398875,phi:1.61803398875,"major sixth":5/3,"minor seventh":16/9,"major seventh":15/8,octave:2,"major tenth":2.5,"major eleventh":8/3,"major twelfth":3,"double octave":4};module.exports=function(e){var t,n,a,l,u=o({},{baseFontSize:"16px",baseLineHeight:1.45,headerLineHeight:1.1,scaleRatio:2,googleFonts:[],headerFontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","sans-serif"],bodyFontFamily:["georgia","serif"],headerColor:"inherit",bodyColor:"hsla(0,0%,0%,0.8)",headerWeight:"bold",bodyWeight:"normal",boldWeight:"bold",includeNormalize:!0,blockMarginBottom:1},e),g=(t=u,n=JSON.parse(JSON.stringify(f)),a=Object.assign({},n,t),l=s(a.baseFontSize),c(a.baseLineHeight)?(h(l(a.baseFontSize,"px")),a.baseLineHeightInPx=l(a.baseLineHeight,"px")):a.baseLineHeightInPx=h(a.baseFontSize)*a.baseLineHeight+"px",{rhythm:d(a),establishBaseline:function(){return s((e=a).baseFontSize),{fontSize:h(e.baseFontSize)/16*100+"%",lineHeight:e.baseLineHeight.toString()};var e},linesForFontSize:function(e){return b(e,a)},adjustFontSizeTo:function(e,t,n){return null==t&&(t="auto"),function(e,t,n,r){null==n&&(n=r.baseFontSize),"%"===c(e)&&(e=h(r.baseFontSize)*(h(e)/100)+"px");var i=s(r.baseFontSize);e=i(e,"px",n=i(n,"px"));var o=d(r);return"auto"===t&&(t=b(e,r)),{fontSize:i(e,r.rhythmUnit,n),lineHeight:o(t,n)}}(e,t,n,a)}});return g.scale=function(e){var t=u.baseFontSize.slice(0,-2),n=function(e,t){var n;return null==e&&(e=0),null==t&&(t="golden"),n=r(t)?t:null!=i[t]?i[t]:i.golden,Math.pow(n,e)}(e,u.scaleRatio)*t+"px";return g.adjustFontSizeTo(n)},Object.assign({},{options:u},g)}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;var r=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,i){for(var o,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),s=1;s<arguments.length;s++){for(var u in o=Object(arguments[s]))t.call(o,u)&&(l[u]=o[u]);if(e){a=e(o);for(var f=0;f<a.length;f++)n.call(o,a[f])&&(l[a[f]]=o[a[f]])}}return l},i=function(e,t){t||(t=[0,""]),e=String(e);var n=parseFloat(e,10);return t[0]=n,t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},o={default:i,__moduleExports:i},a=o&&i||o,l=function(e){return a(e)[0]},s=function(e){return null==e&&(e=e),function(t,n,r,i){null==r&&(r=e),null==i&&(i=r);var o=a(t)[1];if(o===n)return t;var s=l(t);if("px"!==o)if("em"===o)s=l(t)*l(r);else if("rem"===o)s=l(t)*l(e);else{if("ex"!==o)return t;s=l(t)*l(r)*2}var u=s;if("px"!==n)if("em"===n)u=s/l(i);else if("rem"===n)u=s/l(e);else{if("ex"!==n)return t;u=s/l(i)/2}return parseFloat(u.toFixed(5))+n}},u={default:s,__moduleExports:s},f=u&&s||u,c=a,h=function(e){return c(e)[1]},b=function(e){return c(e)[0]},d={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},p=function(e,t){var n,r=f(t.baseFontSize),i=b(r(e,"px")),o=b(t.baseLineHeightInPx),a=b(r(t.minLinePadding,"px"));return(n=t.roundToNearestHalfLine?Math.ceil(2*i/o)/2:Math.ceil(i/o))*o-i<2*a&&(n+=t.roundToNearestHalfLine?.5:1),n},g=function(e){var t=f(e.baseFontSize);return function(n,r,i){null==n&&(n=1),null==r&&(r=e.baseFontSize),null==i&&(i=0);var o=n*b(e.baseLineHeightInPx)-i+"px",a=t(o,e.rhythmUnit,r);return"px"===h(a)&&(a=Math.floor(b(a))+h(a)),parseFloat(b(a).toFixed(5))+h(a)}},m="[object Number]",x=Object.prototype.toString;var S,j,y=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&x.call(e)==m},F={default:y,__moduleExports:y};S=F&&y||F,j={"minor second":16/15,"major second":9/8,"minor third":1.2,"major third":4/3,"diminished fourth":Math.sqrt(2),"perfect fifth":1.5,"minor sixth":1.6,golden:1.61803398875,phi:1.61803398875,"major sixth":5/3,"minor seventh":16/9,"major seventh":15/8,octave:2,"major tenth":2.5,"major eleventh":8/3,"major twelfth":3,"double octave":4};export default function(e){var t,n,i,o,a=r({},{baseFontSize:"16px",baseLineHeight:1.45,headerLineHeight:1.1,scaleRatio:2,googleFonts:[],headerFontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","sans-serif"],bodyFontFamily:["georgia","serif"],headerColor:"inherit",bodyColor:"hsla(0,0%,0%,0.8)",headerWeight:"bold",bodyWeight:"normal",boldWeight:"bold",includeNormalize:!0,blockMarginBottom:1},e),l=(t=a,n=JSON.parse(JSON.stringify(d)),i=Object.assign({},n,t),o=f(i.baseFontSize),h(i.baseLineHeight)?(b(o(i.baseFontSize,"px")),i.baseLineHeightInPx=o(i.baseLineHeight,"px")):i.baseLineHeightInPx=b(i.baseFontSize)*i.baseLineHeight+"px",{rhythm:g(i),establishBaseline:function(){return f((e=i).baseFontSize),{fontSize:b(e.baseFontSize)/16*100+"%",lineHeight:e.baseLineHeight.toString()};var e},linesForFontSize:function(e){return p(e,i)},adjustFontSizeTo:function(e,t,n){return null==t&&(t="auto"),function(e,t,n,r){null==n&&(n=r.baseFontSize),"%"===h(e)&&(e=b(r.baseFontSize)*(b(e)/100)+"px");var i=f(r.baseFontSize);e=i(e,"px",n=i(n,"px"));var o=g(r);return"auto"===t&&(t=p(e,r)),{fontSize:i(e,r.rhythmUnit,n),lineHeight:o(t,n)}}(e,t,n,i)}});return l.scale=function(e){var t=parseInt(a.baseFontSize,10),n=function(e,t){var n;return null==e&&(e=0),null==t&&(t="golden"),n=S(t)?t:null!=j[t]?j[t]:j.golden,Math.pow(n,e)}(e,a.scaleRatio)*t+"px";return l.adjustFontSizeTo(n)},Object.assign({},{options:a},l)}; | ||
var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;var r=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,i){for(var o,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),s=1;s<arguments.length;s++){for(var u in o=Object(arguments[s]))t.call(o,u)&&(l[u]=o[u]);if(e){a=e(o);for(var c=0;c<a.length;c++)n.call(o,a[c])&&(l[a[c]]=o[a[c]])}}return l},i=function(e,t){t||(t=[0,""]),e=String(e);var n=parseFloat(e,10);return t[0]=n,t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},o={default:i,__moduleExports:i},a=o&&i||o,l=function(e){return a(e)[0]},s=function(e){return null==e&&(e=e),function(t,n,r,i){null==r&&(r=e),null==i&&(i=r);var o=a(t)[1];if(o===n)return t;var s=l(t);if("px"!==o)if("em"===o)s=l(t)*l(r);else if("rem"===o)s=l(t)*l(e);else{if("ex"!==o)return t;s=l(t)*l(r)*2}var u=s;if("px"!==n)if("em"===n)u=s/l(i);else if("rem"===n)u=s/l(e);else{if("ex"!==n)return t;u=s/l(i)/2}return parseFloat(u.toFixed(5))+n}},u={default:s,__moduleExports:s},c=u&&s||u,f=a,h=function(e){return f(e)[1]},b=function(e){return f(e)[0]},d={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},p=function(e,t){var n,r=c(t.baseFontSize),i=b(r(e,"px")),o=b(t.baseLineHeightInPx),a=b(r(t.minLinePadding,"px"));return(n=t.roundToNearestHalfLine?Math.ceil(2*i/o)/2:Math.ceil(i/o))*o-i<2*a&&(n+=t.roundToNearestHalfLine?.5:1),n},g=function(e){var t=c(e.baseFontSize);return function(n,r,i){null==n&&(n=1),null==r&&(r=e.baseFontSize),null==i&&(i=0);var o=n*b(e.baseLineHeightInPx)-i+"px",a=t(o,e.rhythmUnit,r);return"px"===h(a)&&(a=Math.floor(b(a))+h(a)),parseFloat(b(a).toFixed(5))+h(a)}},m="[object Number]",x=Object.prototype.toString;var S,j,y=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&x.call(e)==m},F={default:y,__moduleExports:y};S=F&&y||F,j={"minor second":16/15,"major second":9/8,"minor third":1.2,"major third":4/3,"diminished fourth":Math.sqrt(2),"perfect fifth":1.5,"minor sixth":1.6,golden:1.61803398875,phi:1.61803398875,"major sixth":5/3,"minor seventh":16/9,"major seventh":15/8,octave:2,"major tenth":2.5,"major eleventh":8/3,"major twelfth":3,"double octave":4};module.exports=function(e){var t,n,i,o,a=r({},{baseFontSize:"16px",baseLineHeight:1.45,headerLineHeight:1.1,scaleRatio:2,googleFonts:[],headerFontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","sans-serif"],bodyFontFamily:["georgia","serif"],headerColor:"inherit",bodyColor:"hsla(0,0%,0%,0.8)",headerWeight:"bold",bodyWeight:"normal",boldWeight:"bold",includeNormalize:!0,blockMarginBottom:1},e),l=(t=a,n=JSON.parse(JSON.stringify(d)),i=Object.assign({},n,t),o=c(i.baseFontSize),h(i.baseLineHeight)?(b(o(i.baseFontSize,"px")),i.baseLineHeightInPx=o(i.baseLineHeight,"px")):i.baseLineHeightInPx=b(i.baseFontSize)*i.baseLineHeight+"px",{rhythm:g(i),establishBaseline:function(){return c((e=i).baseFontSize),{fontSize:b(e.baseFontSize)/16*100+"%",lineHeight:e.baseLineHeight.toString()};var e},linesForFontSize:function(e){return p(e,i)},adjustFontSizeTo:function(e,t,n){return null==t&&(t="auto"),function(e,t,n,r){null==n&&(n=r.baseFontSize),"%"===h(e)&&(e=b(r.baseFontSize)*(b(e)/100)+"px");var i=c(r.baseFontSize);e=i(e,"px",n=i(n,"px"));var o=g(r);return"auto"===t&&(t=p(e,r)),{fontSize:i(e,r.rhythmUnit,n),lineHeight:o(t,n)}}(e,t,n,i)}});return l.scale=function(e){var t=a.baseFontSize.slice(0,-2),n=function(e,t){var n;return null==e&&(e=0),null==t&&(t="golden"),n=S(t)?t:null!=j[t]?j[t]:j.golden,Math.pow(n,e)}(e,a.scaleRatio)*t+"px";return l.adjustFontSizeTo(n)},Object.assign({},{options:a},l)}; | ||
//# sourceMappingURL=index.m.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.typography=t()}(this,function(){var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;var r=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),u=1;u<arguments.length;u++){for(var s in i=Object(arguments[u]))t.call(i,s)&&(l[s]=i[s]);if(e){a=e(i);for(var f=0;f<a.length;f++)n.call(i,a[f])&&(l[a[f]]=i[a[f]])}}return l},o=function(e,t){t||(t=[0,""]),e=String(e);var n=parseFloat(e,10);return t[0]=n,t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},i={default:o,__moduleExports:o},a=i&&o||i,l=function(e){return a(e)[0]},u=function(e){return null==e&&(e=e),function(t,n,r,o){null==r&&(r=e),null==o&&(o=r);var i=a(t)[1];if(i===n)return t;var u=l(t);if("px"!==i)if("em"===i)u=l(t)*l(r);else if("rem"===i)u=l(t)*l(e);else{if("ex"!==i)return t;u=l(t)*l(r)*2}var s=u;if("px"!==n)if("em"===n)s=u/l(o);else if("rem"===n)s=u/l(e);else{if("ex"!==n)return t;s=u/l(o)/2}return parseFloat(s.toFixed(5))+n}},s={default:u,__moduleExports:u},f=s&&u||s,c=a,h=function(e){return c(e)[1]},d=function(e){return c(e)[0]},b={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},p=function(e,t){var n,r=f(t.baseFontSize),o=d(r(e,"px")),i=d(t.baseLineHeightInPx),a=d(r(t.minLinePadding,"px"));return(n=t.roundToNearestHalfLine?Math.ceil(2*o/i)/2:Math.ceil(o/i))*i-o<2*a&&(n+=t.roundToNearestHalfLine?.5:1),n},m=function(e){var t=f(e.baseFontSize);return function(n,r,o){null==n&&(n=1),null==r&&(r=e.baseFontSize),null==o&&(o=0);var i=n*d(e.baseLineHeightInPx)-o+"px",a=t(i,e.rhythmUnit,r);return"px"===h(a)&&(a=Math.floor(d(a))+h(a)),parseFloat(d(a).toFixed(5))+h(a)}},g="[object Number]",y=Object.prototype.toString;var x,S,j=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&y.call(e)==g},F={default:j,__moduleExports:j};x=F&&j||F,S={"minor second":16/15,"major second":9/8,"minor third":1.2,"major third":4/3,"diminished fourth":Math.sqrt(2),"perfect fifth":1.5,"minor sixth":1.6,golden:1.61803398875,phi:1.61803398875,"major sixth":5/3,"minor seventh":16/9,"major seventh":15/8,octave:2,"major tenth":2.5,"major eleventh":8/3,"major twelfth":3,"double octave":4};return function(e){var t,n,o,i,a=r({},{baseFontSize:"16px",baseLineHeight:1.45,headerLineHeight:1.1,scaleRatio:2,googleFonts:[],headerFontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","sans-serif"],bodyFontFamily:["georgia","serif"],headerColor:"inherit",bodyColor:"hsla(0,0%,0%,0.8)",headerWeight:"bold",bodyWeight:"normal",boldWeight:"bold",includeNormalize:!0,blockMarginBottom:1},e),l=(t=a,n=JSON.parse(JSON.stringify(b)),o=Object.assign({},n,t),i=f(o.baseFontSize),h(o.baseLineHeight)?(d(i(o.baseFontSize,"px")),o.baseLineHeightInPx=i(o.baseLineHeight,"px")):o.baseLineHeightInPx=d(o.baseFontSize)*o.baseLineHeight+"px",{rhythm:m(o),establishBaseline:function(){return f((e=o).baseFontSize),{fontSize:d(e.baseFontSize)/16*100+"%",lineHeight:e.baseLineHeight.toString()};var e},linesForFontSize:function(e){return p(e,o)},adjustFontSizeTo:function(e,t,n){return null==t&&(t="auto"),function(e,t,n,r){null==n&&(n=r.baseFontSize),"%"===h(e)&&(e=d(r.baseFontSize)*(d(e)/100)+"px");var o=f(r.baseFontSize);e=o(e,"px",n=o(n,"px"));var i=m(r);return"auto"===t&&(t=p(e,r)),{fontSize:o(e,r.rhythmUnit,n),lineHeight:i(t,n)}}(e,t,n,o)}});return l.scale=function(e){var t=parseInt(a.baseFontSize,10),n=function(e,t){var n;return null==e&&(e=0),null==t&&(t="golden"),n=x(t)?t:null!=S[t]?S[t]:S.golden,Math.pow(n,e)}(e,a.scaleRatio)*t+"px";return l.adjustFontSizeTo(n)},Object.assign({},{options:a},l)}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;var r=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,i){for(var o,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),u=1;u<arguments.length;u++){for(var s in o=Object(arguments[u]))t.call(o,s)&&(l[s]=o[s]);if(e){a=e(o);for(var f=0;f<a.length;f++)n.call(o,a[f])&&(l[a[f]]=o[a[f]])}}return l},i=function(e,t){t||(t=[0,""]),e=String(e);var n=parseFloat(e,10);return t[0]=n,t[1]=e.match(/[\d.\-\+]*\s*(.*)/)[1]||"",t},o={default:i,__moduleExports:i},a=o&&i||o,l=function(e){return a(e)[0]},u=function(e){return null==e&&(e=e),function(t,n,r,i){null==r&&(r=e),null==i&&(i=r);var o=a(t)[1];if(o===n)return t;var u=l(t);if("px"!==o)if("em"===o)u=l(t)*l(r);else if("rem"===o)u=l(t)*l(e);else{if("ex"!==o)return t;u=l(t)*l(r)*2}var s=u;if("px"!==n)if("em"===n)s=u/l(i);else if("rem"===n)s=u/l(e);else{if("ex"!==n)return t;s=u/l(i)/2}return parseFloat(s.toFixed(5))+n}},s={default:u,__moduleExports:u},f=s&&u||s,c=a,h=function(e){return c(e)[1]},d=function(e){return c(e)[0]},b={baseFontSize:"16px",baseLineHeight:1.5,rhythmUnit:"rem",defaultRhythmBorderWidth:"1px",defaultRhythmBorderStyle:"solid",roundToNearestHalfLine:!0,minLinePadding:"2px"},p=function(e,t){var n,r=f(t.baseFontSize),i=d(r(e,"px")),o=d(t.baseLineHeightInPx),a=d(r(t.minLinePadding,"px"));return(n=t.roundToNearestHalfLine?Math.ceil(2*i/o)/2:Math.ceil(i/o))*o-i<2*a&&(n+=t.roundToNearestHalfLine?.5:1),n},m=function(e){var t=f(e.baseFontSize);return function(n,r,i){null==n&&(n=1),null==r&&(r=e.baseFontSize),null==i&&(i=0);var o=n*d(e.baseLineHeightInPx)-i+"px",a=t(o,e.rhythmUnit,r);return"px"===h(a)&&(a=Math.floor(d(a))+h(a)),parseFloat(d(a).toFixed(5))+h(a)}},g="[object Number]",x=Object.prototype.toString;var y,S,j=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&x.call(e)==g},F={default:j,__moduleExports:j};y=F&&j||F,S={"minor second":16/15,"major second":9/8,"minor third":1.2,"major third":4/3,"diminished fourth":Math.sqrt(2),"perfect fifth":1.5,"minor sixth":1.6,golden:1.61803398875,phi:1.61803398875,"major sixth":5/3,"minor seventh":16/9,"major seventh":15/8,octave:2,"major tenth":2.5,"major eleventh":8/3,"major twelfth":3,"double octave":4};module.exports=function(e){var t,n,i,o,a=r({},{baseFontSize:"16px",baseLineHeight:1.45,headerLineHeight:1.1,scaleRatio:2,googleFonts:[],headerFontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","sans-serif"],bodyFontFamily:["georgia","serif"],headerColor:"inherit",bodyColor:"hsla(0,0%,0%,0.8)",headerWeight:"bold",bodyWeight:"normal",boldWeight:"bold",includeNormalize:!0,blockMarginBottom:1},e),l=(t=a,n=JSON.parse(JSON.stringify(b)),i=Object.assign({},n,t),o=f(i.baseFontSize),h(i.baseLineHeight)?(d(o(i.baseFontSize,"px")),i.baseLineHeightInPx=o(i.baseLineHeight,"px")):i.baseLineHeightInPx=d(i.baseFontSize)*i.baseLineHeight+"px",{rhythm:m(i),establishBaseline:function(){return f((e=i).baseFontSize),{fontSize:d(e.baseFontSize)/16*100+"%",lineHeight:e.baseLineHeight.toString()};var e},linesForFontSize:function(e){return p(e,i)},adjustFontSizeTo:function(e,t,n){return null==t&&(t="auto"),function(e,t,n,r){null==n&&(n=r.baseFontSize),"%"===h(e)&&(e=d(r.baseFontSize)*(d(e)/100)+"px");var i=f(r.baseFontSize);e=i(e,"px",n=i(n,"px"));var o=m(r);return"auto"===t&&(t=p(e,r)),{fontSize:i(e,r.rhythmUnit,n),lineHeight:o(t,n)}}(e,t,n,i)}});return l.scale=function(e){var t=a.baseFontSize.slice(0,-2),n=function(e,t){var n;return null==e&&(e=0),null==t&&(t="golden"),n=y(t)?t:null!=S[t]?S[t]:S.golden,Math.pow(n,e)}(e,a.scaleRatio)*t+"px";return l.adjustFontSizeTo(n)},Object.assign({},{options:a},l)}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "typography", | ||
"description": "Opinionated toolkit for building websites with beautiful typography", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"author": "Kyle Mathews <mathews.kyle@gmail.com>", | ||
@@ -35,4 +35,4 @@ "dependencies": { | ||
"build": "npm-run-all build-client build-server", | ||
"build-server": "microbundle", | ||
"build-client": "microbundle --entry src/server.js --output dist/server.js", | ||
"build-server": "microbundle --entry src/server.js --output dist/server.js", | ||
"build-client": "microbundle", | ||
"flow": "../../node_modules/.bin/flow", | ||
@@ -46,3 +46,3 @@ "lint": "../../node_modules/.bin/eslint --ext .js,.jsx --ignore-path ../../.gitignore .", | ||
}, | ||
"gitHead": "77a13fc0eecc468b15feb8b10de02edde2df99d5" | ||
"gitHead": "6ec12c760d900b79e555904fde4b377fe378bb21" | ||
} |
@@ -49,3 +49,3 @@ // @flow | ||
// for this width. Tricky part is maxWidth could be set in non-pixels. | ||
const baseFont = parseInt(options.baseFontSize, 10) | ||
const baseFont = options.baseFontSize.slice(0, -2) | ||
const newFontSize = `${ms(value, options.scaleRatio) * baseFont}px` | ||
@@ -61,2 +61,2 @@ return vr.adjustFontSizeTo(newFontSize) | ||
export default typography | ||
module.exports = typography |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
821071
22
902
1