typography
Advanced tools
Comparing version 0.16.21 to 0.16.24
@@ -1,2 +0,2 @@ | ||
import t from"object-assign";import e from"compass-vertical-rhythm";import o from"modularscale";import i from"gray-percentage";import r from"lodash/set";import n from"lodash/forEach";import a from"lodash/isNumber";import l from"lodash/isString";import m from"lodash/isFunction";import d from"lodash/isArray";import s from"lodash/merge";import h from"lodash/reduce";import g from"typography-normalize";import c from"decamelize";import f from"lodash/isObject";function p(){return(p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t}).apply(this,arguments)}var u=function(t,e,o){var i;return void 0===t&&(t={}),i=d(e)?e:[e],n(i,function(e){n(o,function(o,i){r(t,e+"."+i,o)})}),t},y=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],b=function(t){return-1!==y.indexOf(t)?t:"'"+t+"'"},S=function t(e){return h(e,function(e,o,i){return e+=i+"{",n(o,function(o,i){if(f(o)){var r={};r[i]=o,e+=t(r)}else{var n=c(i,"-")+":"+o+";";["Webkit","ms","Moz","O"].forEach(function(t){i.slice(0,t.length)===t&&(n="-"+n)}),e+=n}}),e+="}"},"")},F=function(t,e,o){var i=S(o);return e.includeNormalize&&(i=""+g+i),i};export default function(g){var c=t({},{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},g),f=e(c);return f.scale=function(t){var e=parseInt(c.baseFontSize,10),i=o(t,c.scaleRatio)*e+"px";return f.adjustFontSizeTo(i)},p({options:c},f,{createStyles:function(){return this.toString()},toJSON:function(){return function(t,e){var o,g={},c=t.establishBaseline();g=u(g,"html",{font:c.fontSize+"/"+c.lineHeight+" "+e.bodyFontFamily.map(b).join(","),boxSizing:"border-box",overflowY:"scroll"}),g=u(g,["*","*:before","*:after"],{boxSizing:"inherit"}),g=u(g,"body",{color:e.bodyColor,fontFamily:e.bodyFontFamily.map(b).join(","),fontWeight:e.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),g=u(g,"img",{maxWidth:"100%"}),o=a(e.blockMarginBottom)?t.rhythm(e.blockMarginBottom):l(e.blockMarginBottom)?e.blockMarginBottom:t.rhythm(1),g=u(g,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:o}),g=u(g,"blockquote",{marginRight:t.rhythm(1),marginBottom:o,marginLeft:t.rhythm(1)}),g=u(g,["b","strong","dt","th"],{fontWeight:e.boldWeight}),g=u(g,"hr",{background:i(80),border:"none",height:"1px",marginBottom:"calc("+o+" - 1px)"}),g=u(g,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:t.rhythm(1)}),g=u(g,"li",{marginBottom:"calc("+o+" / 2)"}),g=u(g,["ol li","ul li"],{paddingLeft:0}),g=u(g,["li > ol","li > ul"],{marginLeft:t.rhythm(1),marginBottom:"calc("+o+" / 2)",marginTop:"calc("+o+" / 2)"}),g=u(g,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),g=u(g,["li > p"],{marginBottom:"calc("+o+" / 2)"}),g=u(g,["code","kbd","pre","samp"],p({},t.adjustFontSizeTo("85%"))),(g=u(g,["abbr","acronym"],{borderBottom:"1px dotted "+i(50),cursor:"help"}))["abbr[title]"]={borderBottom:"1px dotted "+i(50),cursor:"help",textDecoration:"none"},g=u(g,["table"],p({},t.adjustFontSizeTo(e.baseFontSize),{borderCollapse:"collapse",width:"100%"})),g=u(g,["thead"],{textAlign:"left"}),g=u(g,["td,th"],{textAlign:"left",borderBottom:"1px solid "+i(88),fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:t.rhythm(2/3),paddingRight:t.rhythm(2/3),paddingTop:t.rhythm(.5),paddingBottom:"calc("+t.rhythm(.5)+" - 1px)"}),g=u(g,"th:first-child,td:first-child",{paddingLeft:0}),g=u(g,"th:last-child,td:last-child",{paddingRight:0}),g=u(g,["h1","h2","h3","h4","h5","h6"],{color:e.headerColor,fontFamily:e.headerFontFamily.map(b).join(","),fontWeight:e.headerWeight,textRendering:"optimizeLegibility"});var f=t.scale(1),y=t.scale(.6),S=t.scale(.4),F=t.scale(0),v=t.scale(-.2),B=t.scale(-.3);return n([f,y,S,F,v,B],function(t,o){g=r(g,"h"+(o+1)+".fontSize",t.fontSize),g=r(g,"h"+(o+1)+".lineHeight",e.headerLineHeight)}),d(e.plugins)&&(g=h(e.plugins,function(o,i){return s(o,i(t,e,o))},g)),e.overrideStyles&&m(e.overrideStyles)&&(g=s(g,e.overrideStyles(t,e,g))),e.overrideThemeStyles&&m(e.overrideThemeStyles)&&(g=s(g,e.overrideThemeStyles(t,e,g))),g}(f,c)},toString:function(){return F(0,c,this.toJSON())},injectStyles:function(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{var t=document.createElement("style");t.id="typography.js",t.innerHTML=this.toString();var e=document.head;e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}})} | ||
import t from"object-assign";import e from"compass-vertical-rhythm";import o from"modularscale";import i from"gray-percentage";import r from"lodash/set";import n from"lodash/forEach";import a from"lodash/isNumber";import l from"lodash/isString";import s from"lodash/isFunction";import m from"lodash/isArray";import d from"lodash/merge";import h from"lodash/reduce";import g from"typography-normalize";import c from"decamelize";import f from"lodash/isObject";function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t},p.apply(this,arguments)}var u=function(t,e,o){var i;return void 0===t&&(t={}),i=m(e)?e:[e],n(i,function(e){n(o,function(o,i){r(t,e+"."+i,o)})}),t},y=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],b=function(t){return-1!==y.indexOf(t)||t.startsWith("var(")?t:"'"+t+"'"},S=function t(e){return h(e,function(e,o,i){return e+=i+"{",n(o,function(o,i){if(f(o)){var r={};r[i]=o,e+=t(r)}else{var n=c(i,"-")+":"+o+";";["Webkit","ms","Moz","O"].forEach(function(t){i.slice(0,t.length)===t&&(n="-"+n)}),e+=n}}),e+="}"},"")},F=function(t,e,o){var i=S(o);return e.includeNormalize&&(i=""+g+i),i},v=function(g){var c=t({},{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},g),f=e(c);return f.scale=function(t){var e=parseInt(c.baseFontSize,10),i=o(t,c.scaleRatio)*e+"px";return f.adjustFontSizeTo(i)},p({options:c},f,{createStyles:function(){return this.toString()},toJSON:function(){return function(t,e){var o,g={},c=t.establishBaseline();g=u(g,"html",{font:c.fontSize+"/"+c.lineHeight+" "+e.bodyFontFamily.map(b).join(","),boxSizing:"border-box",overflowY:"scroll"}),g=u(g,["*","*:before","*:after"],{boxSizing:"inherit"}),g=u(g,"body",{color:e.bodyColor,fontFamily:e.bodyFontFamily.map(b).join(","),fontWeight:e.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),g=u(g,"img",{maxWidth:"100%"}),o=a(e.blockMarginBottom)?t.rhythm(e.blockMarginBottom):l(e.blockMarginBottom)?e.blockMarginBottom:t.rhythm(1),g=u(g,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:o}),g=u(g,"blockquote",{marginRight:t.rhythm(1),marginBottom:o,marginLeft:t.rhythm(1)}),g=u(g,["b","strong","dt","th"],{fontWeight:e.boldWeight}),g=u(g,"hr",{background:i(80),border:"none",height:"1px",marginBottom:"calc("+o+" - 1px)"}),g=u(g,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:t.rhythm(1)}),g=u(g,"li",{marginBottom:"calc("+o+" / 2)"}),g=u(g,["ol li","ul li"],{paddingLeft:0}),g=u(g,["li > ol","li > ul"],{marginLeft:t.rhythm(1),marginBottom:"calc("+o+" / 2)",marginTop:"calc("+o+" / 2)"}),g=u(g,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),g=u(g,["li > p"],{marginBottom:"calc("+o+" / 2)"}),g=u(g,["code","kbd","pre","samp"],p({},t.adjustFontSizeTo("85%"))),(g=u(g,["abbr","acronym"],{borderBottom:"1px dotted "+i(50),cursor:"help"}))["abbr[title]"]={borderBottom:"1px dotted "+i(50),cursor:"help",textDecoration:"none"},g=u(g,["table"],p({},t.adjustFontSizeTo(e.baseFontSize),{borderCollapse:"collapse",width:"100%"})),g=u(g,["thead"],{textAlign:"left"}),g=u(g,["td,th"],{textAlign:"left",borderBottom:"1px solid "+i(88),fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:t.rhythm(2/3),paddingRight:t.rhythm(2/3),paddingTop:t.rhythm(.5),paddingBottom:"calc("+t.rhythm(.5)+" - 1px)"}),g=u(g,"th:first-child,td:first-child",{paddingLeft:0}),g=u(g,"th:last-child,td:last-child",{paddingRight:0}),g=u(g,["h1","h2","h3","h4","h5","h6"],{color:e.headerColor,fontFamily:e.headerFontFamily.map(b).join(","),fontWeight:e.headerWeight,textRendering:"optimizeLegibility"});var f=t.scale(1),y=t.scale(.6),S=t.scale(.4),F=t.scale(0),v=t.scale(-.2),B=t.scale(-.3);return n([f,y,S,F,v,B],function(t,o){g=r(g,"h"+(o+1)+".fontSize",t.fontSize),g=r(g,"h"+(o+1)+".lineHeight",e.headerLineHeight)}),m(e.plugins)&&(g=h(e.plugins,function(o,i){return d(o,i(t,e,o))},g)),e.overrideStyles&&s(e.overrideStyles)&&(g=d(g,e.overrideStyles(t,e,g))),e.overrideThemeStyles&&s(e.overrideThemeStyles)&&(g=d(g,e.overrideThemeStyles(t,e,g))),g}(f,c)},toString:function(){return F(0,c,this.toJSON())},injectStyles:function(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{var t=document.createElement("style");t.id="typography.js",t.innerHTML=this.toString();var e=document.head;e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}})};export{v as default}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var e=require("object-assign"),t=require("compass-vertical-rhythm"),i=require("modularscale"),o=require("gray-percentage"),r=require("lodash/set"),n=require("lodash/forEach"),a=require("lodash/isNumber"),l=require("lodash/isString"),d=require("lodash/isFunction"),u=require("lodash/isArray"),s=require("lodash/merge"),h=require("lodash/reduce"),g=require("typography-normalize"),c=require("decamelize"),f=require("lodash/isObject");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(e),y=m(t),b=m(i),S=m(o),F=m(r),v=m(n),B=m(a),k=m(l),x=m(d),z=m(u),q=m(s),j=m(h),L=m(g),W=m(c),T=m(f);function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e}).apply(this,arguments)}var C=function(e,t,i){var o;return void 0===e&&(e={}),o=z.default(t)?t:[t],v.default(o,function(t){v.default(i,function(i,o){F.default(e,t+"."+o,i)})}),e},O=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],R=function(e){return-1!==O.indexOf(e)?e:"'"+e+"'"},H=function e(t){return j.default(t,function(t,i,o){return t+=o+"{",v.default(i,function(i,o){if(T.default(i)){var r={};r[o]=i,t+=e(r)}else{var n=W.default(o,"-")+":"+i+";";["Webkit","ms","Moz","O"].forEach(function(e){o.slice(0,e.length)===e&&(n="-"+n)}),t+=n}}),t+="}"},"")},N=function(e,t,i){var o=H(i);return t.includeNormalize&&(o=""+L.default+o),o};module.exports=function(e){var t=p.default({},{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),i=y.default(t);return i.scale=function(e){var o=parseInt(t.baseFontSize,10),r=b.default(e,t.scaleRatio)*o+"px";return i.adjustFontSizeTo(r)},M({options:t},i,{createStyles:function(){return this.toString()},toJSON:function(){return function(e,t){var i,o={},r=e.establishBaseline();o=C(o,"html",{font:r.fontSize+"/"+r.lineHeight+" "+t.bodyFontFamily.map(R).join(","),boxSizing:"border-box",overflowY:"scroll"}),o=C(o,["*","*:before","*:after"],{boxSizing:"inherit"}),o=C(o,"body",{color:t.bodyColor,fontFamily:t.bodyFontFamily.map(R).join(","),fontWeight:t.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),o=C(o,"img",{maxWidth:"100%"}),i=B.default(t.blockMarginBottom)?e.rhythm(t.blockMarginBottom):k.default(t.blockMarginBottom)?t.blockMarginBottom:e.rhythm(1),o=C(o,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:i}),o=C(o,"blockquote",{marginRight:e.rhythm(1),marginBottom:i,marginLeft:e.rhythm(1)}),o=C(o,["b","strong","dt","th"],{fontWeight:t.boldWeight}),o=C(o,"hr",{background:S.default(80),border:"none",height:"1px",marginBottom:"calc("+i+" - 1px)"}),o=C(o,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:e.rhythm(1)}),o=C(o,"li",{marginBottom:"calc("+i+" / 2)"}),o=C(o,["ol li","ul li"],{paddingLeft:0}),o=C(o,["li > ol","li > ul"],{marginLeft:e.rhythm(1),marginBottom:"calc("+i+" / 2)",marginTop:"calc("+i+" / 2)"}),o=C(o,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),o=C(o,["li > p"],{marginBottom:"calc("+i+" / 2)"}),o=C(o,["code","kbd","pre","samp"],M({},e.adjustFontSizeTo("85%"))),(o=C(o,["abbr","acronym"],{borderBottom:"1px dotted "+S.default(50),cursor:"help"}))["abbr[title]"]={borderBottom:"1px dotted "+S.default(50),cursor:"help",textDecoration:"none"},o=C(o,["table"],M({},e.adjustFontSizeTo(t.baseFontSize),{borderCollapse:"collapse",width:"100%"})),o=C(o,["thead"],{textAlign:"left"}),o=C(o,["td,th"],{textAlign:"left",borderBottom:"1px solid "+S.default(88),fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:e.rhythm(2/3),paddingRight:e.rhythm(2/3),paddingTop:e.rhythm(.5),paddingBottom:"calc("+e.rhythm(.5)+" - 1px)"}),o=C(o,"th:first-child,td:first-child",{paddingLeft:0}),o=C(o,"th:last-child,td:last-child",{paddingRight:0}),o=C(o,["h1","h2","h3","h4","h5","h6"],{color:t.headerColor,fontFamily:t.headerFontFamily.map(R).join(","),fontWeight:t.headerWeight,textRendering:"optimizeLegibility"});var n=e.scale(1),a=e.scale(.6),l=e.scale(.4),d=e.scale(0),u=e.scale(-.2),s=e.scale(-.3);return v.default([n,a,l,d,u,s],function(e,i){o=F.default(o,"h"+(i+1)+".fontSize",e.fontSize),o=F.default(o,"h"+(i+1)+".lineHeight",t.headerLineHeight)}),z.default(t.plugins)&&(o=j.default(t.plugins,function(i,o){return q.default(i,o(e,t,i))},o)),t.overrideStyles&&x.default(t.overrideStyles)&&(o=q.default(o,t.overrideStyles(e,t,o))),t.overrideThemeStyles&&x.default(t.overrideThemeStyles)&&(o=q.default(o,t.overrideThemeStyles(e,t,o))),o}(i,t)},toString:function(){return N(0,t,this.toJSON())},injectStyles:function(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{var e=document.createElement("style");e.id="typography.js",e.innerHTML=this.toString();var t=document.head;t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}}})}; | ||
var e=require("object-assign"),t=require("compass-vertical-rhythm"),i=require("modularscale"),o=require("gray-percentage"),r=require("lodash/set"),n=require("lodash/forEach"),a=require("lodash/isNumber"),l=require("lodash/isString"),d=require("lodash/isFunction"),u=require("lodash/isArray"),s=require("lodash/merge"),h=require("lodash/reduce"),g=require("typography-normalize"),c=require("decamelize"),f=require("lodash/isObject");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(e),y=m(t),b=m(i),S=m(o),F=m(r),v=m(n),B=m(a),k=m(l),x=m(d),z=m(u),q=m(s),j=m(h),W=m(g),L=m(c),T=m(f);function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},M.apply(this,arguments)}var O=function(e,t,i){var o;return void 0===e&&(e={}),o=z.default(t)?t:[t],v.default(o,function(t){v.default(i,function(i,o){F.default(e,t+"."+o,i)})}),e},C=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],R=function(e){return-1!==C.indexOf(e)||e.startsWith("var(")?e:"'"+e+"'"},H=function e(t){return j.default(t,function(t,i,o){return t+=o+"{",v.default(i,function(i,o){if(T.default(i)){var r={};r[o]=i,t+=e(r)}else{var n=L.default(o,"-")+":"+i+";";["Webkit","ms","Moz","O"].forEach(function(e){o.slice(0,e.length)===e&&(n="-"+n)}),t+=n}}),t+="}"},"")},N=function(e,t,i){var o=H(i);return t.includeNormalize&&(o=""+W.default+o),o};module.exports=function(e){var t=p.default({},{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),i=y.default(t);return i.scale=function(e){var o=parseInt(t.baseFontSize,10),r=b.default(e,t.scaleRatio)*o+"px";return i.adjustFontSizeTo(r)},M({options:t},i,{createStyles:function(){return this.toString()},toJSON:function(){return function(e,t){var i,o={},r=e.establishBaseline();o=O(o,"html",{font:r.fontSize+"/"+r.lineHeight+" "+t.bodyFontFamily.map(R).join(","),boxSizing:"border-box",overflowY:"scroll"}),o=O(o,["*","*:before","*:after"],{boxSizing:"inherit"}),o=O(o,"body",{color:t.bodyColor,fontFamily:t.bodyFontFamily.map(R).join(","),fontWeight:t.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),o=O(o,"img",{maxWidth:"100%"}),i=B.default(t.blockMarginBottom)?e.rhythm(t.blockMarginBottom):k.default(t.blockMarginBottom)?t.blockMarginBottom:e.rhythm(1),o=O(o,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:i}),o=O(o,"blockquote",{marginRight:e.rhythm(1),marginBottom:i,marginLeft:e.rhythm(1)}),o=O(o,["b","strong","dt","th"],{fontWeight:t.boldWeight}),o=O(o,"hr",{background:S.default(80),border:"none",height:"1px",marginBottom:"calc("+i+" - 1px)"}),o=O(o,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:e.rhythm(1)}),o=O(o,"li",{marginBottom:"calc("+i+" / 2)"}),o=O(o,["ol li","ul li"],{paddingLeft:0}),o=O(o,["li > ol","li > ul"],{marginLeft:e.rhythm(1),marginBottom:"calc("+i+" / 2)",marginTop:"calc("+i+" / 2)"}),o=O(o,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),o=O(o,["li > p"],{marginBottom:"calc("+i+" / 2)"}),o=O(o,["code","kbd","pre","samp"],M({},e.adjustFontSizeTo("85%"))),(o=O(o,["abbr","acronym"],{borderBottom:"1px dotted "+S.default(50),cursor:"help"}))["abbr[title]"]={borderBottom:"1px dotted "+S.default(50),cursor:"help",textDecoration:"none"},o=O(o,["table"],M({},e.adjustFontSizeTo(t.baseFontSize),{borderCollapse:"collapse",width:"100%"})),o=O(o,["thead"],{textAlign:"left"}),o=O(o,["td,th"],{textAlign:"left",borderBottom:"1px solid "+S.default(88),fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:e.rhythm(2/3),paddingRight:e.rhythm(2/3),paddingTop:e.rhythm(.5),paddingBottom:"calc("+e.rhythm(.5)+" - 1px)"}),o=O(o,"th:first-child,td:first-child",{paddingLeft:0}),o=O(o,"th:last-child,td:last-child",{paddingRight:0}),o=O(o,["h1","h2","h3","h4","h5","h6"],{color:t.headerColor,fontFamily:t.headerFontFamily.map(R).join(","),fontWeight:t.headerWeight,textRendering:"optimizeLegibility"});var n=e.scale(1),a=e.scale(.6),l=e.scale(.4),d=e.scale(0),u=e.scale(-.2),s=e.scale(-.3);return v.default([n,a,l,d,u,s],function(e,i){o=F.default(o,"h"+(i+1)+".fontSize",e.fontSize),o=F.default(o,"h"+(i+1)+".lineHeight",t.headerLineHeight)}),z.default(t.plugins)&&(o=j.default(t.plugins,function(i,o){return q.default(i,o(e,t,i))},o)),t.overrideStyles&&x.default(t.overrideStyles)&&(o=q.default(o,t.overrideStyles(e,t,o))),t.overrideThemeStyles&&x.default(t.overrideThemeStyles)&&(o=q.default(o,t.overrideThemeStyles(e,t,o))),o}(i,t)},toString:function(){return N(0,t,this.toJSON())},injectStyles:function(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{var e=document.createElement("style");e.id="typography.js",e.innerHTML=this.toString();var t=document.head;t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}}})}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"object-assign";import e from"compass-vertical-rhythm";import o from"modularscale";import i from"gray-percentage";import r from"lodash/set";import n from"lodash/forEach";import a from"lodash/isNumber";import l from"lodash/isString";import s from"lodash/isFunction";import m from"lodash/isArray";import d from"lodash/merge";import h from"lodash/reduce";import g from"typography-normalize";import c from"decamelize";import p from"lodash/isObject";function f(){return(f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t}).apply(this,arguments)}const u=(t={},e,o)=>{let i;return i=m(e)?e:[e],n(i,e=>{n(o,(o,i)=>{r(t,`${e}.${i}`,o)})}),t},y=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],b=t=>-1!==y.indexOf(t)?t:`'${t}'`,S=t=>h(t,(t,e,o)=>(t+=`${o}{`,n(e,(e,o)=>{if(p(e)){const i={};i[o]=e,t+=S(i)}else{let i=`${c(o,"-")}:${e};`;["Webkit","ms","Moz","O"].forEach(t=>{o.slice(0,t.length)===t&&(i=`-${i}`)}),t+=i}}),t+="}"),"");export default function(c){const p=t({},{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},c),y=e(p);return y.scale=t=>{const e=parseInt(p.baseFontSize,10),i=o(t,p.scaleRatio)*e+"px";return y.adjustFontSizeTo(i)},f({options:p},y,{createStyles(){return this.toString()},toJSON:()=>((t,e)=>{let o={};const{fontSize:g,lineHeight:c}=t.establishBaseline();o=u(o,"html",{font:`${g}/${c} ${e.bodyFontFamily.map(b).join(",")}`,boxSizing:"border-box",overflowY:"scroll"}),o=u(o,["*","*:before","*:after"],{boxSizing:"inherit"}),o=u(o,"body",{color:e.bodyColor,fontFamily:e.bodyFontFamily.map(b).join(","),fontWeight:e.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),o=u(o,"img",{maxWidth:"100%"});let p="";p=a(e.blockMarginBottom)?t.rhythm(e.blockMarginBottom):l(e.blockMarginBottom)?e.blockMarginBottom:t.rhythm(1),o=u(o,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:p}),o=u(o,"blockquote",{marginRight:t.rhythm(1),marginBottom:p,marginLeft:t.rhythm(1)}),o=u(o,["b","strong","dt","th"],{fontWeight:e.boldWeight}),o=u(o,"hr",{background:i(80),border:"none",height:"1px",marginBottom:`calc(${p} - 1px)`}),o=u(o,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:t.rhythm(1)}),o=u(o,"li",{marginBottom:`calc(${p} / 2)`}),o=u(o,["ol li","ul li"],{paddingLeft:0}),o=u(o,["li > ol","li > ul"],{marginLeft:t.rhythm(1),marginBottom:`calc(${p} / 2)`,marginTop:`calc(${p} / 2)`}),o=u(o,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),o=u(o,["li > p"],{marginBottom:`calc(${p} / 2)`}),o=u(o,["code","kbd","pre","samp"],f({},t.adjustFontSizeTo("85%"))),o=u(o,["abbr","acronym"],{borderBottom:`1px dotted ${i(50)}`,cursor:"help"}),o["abbr[title]"]={borderBottom:`1px dotted ${i(50)}`,cursor:"help",textDecoration:"none"},o=u(o,["table"],f({},t.adjustFontSizeTo(e.baseFontSize),{borderCollapse:"collapse",width:"100%"})),o=u(o,["thead"],{textAlign:"left"}),o=u(o,["td,th"],{textAlign:"left",borderBottom:`1px solid ${i(88)}`,fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:t.rhythm(2/3),paddingRight:t.rhythm(2/3),paddingTop:t.rhythm(.5),paddingBottom:`calc(${t.rhythm(.5)} - 1px)`}),o=u(o,"th:first-child,td:first-child",{paddingLeft:0}),o=u(o,"th:last-child,td:last-child",{paddingRight:0}),o=u(o,["h1","h2","h3","h4","h5","h6"],{color:e.headerColor,fontFamily:e.headerFontFamily.map(b).join(","),fontWeight:e.headerWeight,textRendering:"optimizeLegibility"});const y=t.scale(1),S=t.scale(.6),F=t.scale(.4),$=t.scale(0),B=t.scale(-.2),k=t.scale(-.3);return n([y,S,F,$,B,k],(t,i)=>{o=r(o,`h${i+1}.fontSize`,t.fontSize),o=r(o,`h${i+1}.lineHeight`,e.headerLineHeight)}),m(e.plugins)&&(o=h(e.plugins,(o,i)=>d(o,i(t,e,o)),o)),e.overrideStyles&&s(e.overrideStyles)&&(o=d(o,e.overrideStyles(t,e,o))),e.overrideThemeStyles&&s(e.overrideThemeStyles)&&(o=d(o,e.overrideThemeStyles(t,e,o))),o})(y,p),toString(){return((t,e,o)=>{let i=S(o);return e.includeNormalize&&(i=`${g}${i}`),i})(0,p,this.toJSON())},injectStyles(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{const t=document.createElement("style");t.id="typography.js",t.innerHTML=this.toString();const e=document.head;e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}})} | ||
import t from"object-assign";import e from"compass-vertical-rhythm";import o from"modularscale";import i from"gray-percentage";import r from"lodash/set";import n from"lodash/forEach";import a from"lodash/isNumber";import l from"lodash/isString";import s from"lodash/isFunction";import m from"lodash/isArray";import d from"lodash/merge";import h from"lodash/reduce";import g from"typography-normalize";import c from"decamelize";import p from"lodash/isObject";function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(t[i]=o[i])}return t},f.apply(this,arguments)}const u=(t={},e,o)=>{let i;return i=m(e)?e:[e],n(i,e=>{n(o,(o,i)=>{r(t,`${e}.${i}`,o)})}),t},y=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],b=t=>-1!==y.indexOf(t)||t.startsWith("var(")?t:`'${t}'`,S=t=>h(t,(t,e,o)=>(t+=`${o}{`,n(e,(e,o)=>{if(p(e)){const i={};i[o]=e,t+=S(i)}else{let i=`${c(o,"-")}:${e};`;["Webkit","ms","Moz","O"].forEach(t=>{o.slice(0,t.length)===t&&(i=`-${i}`)}),t+=i}}),t+="}"),""),F=function(c){const p=t({},{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},c),y=e(p);return y.scale=t=>{const e=parseInt(p.baseFontSize,10),i=o(t,p.scaleRatio)*e+"px";return y.adjustFontSizeTo(i)},f({options:p},y,{createStyles(){return this.toString()},toJSON:()=>((t,e)=>{let o={};const{fontSize:g,lineHeight:c}=t.establishBaseline();o=u(o,"html",{font:`${g}/${c} ${e.bodyFontFamily.map(b).join(",")}`,boxSizing:"border-box",overflowY:"scroll"}),o=u(o,["*","*:before","*:after"],{boxSizing:"inherit"}),o=u(o,"body",{color:e.bodyColor,fontFamily:e.bodyFontFamily.map(b).join(","),fontWeight:e.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),o=u(o,"img",{maxWidth:"100%"});let p="";p=a(e.blockMarginBottom)?t.rhythm(e.blockMarginBottom):l(e.blockMarginBottom)?e.blockMarginBottom:t.rhythm(1),o=u(o,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:p}),o=u(o,"blockquote",{marginRight:t.rhythm(1),marginBottom:p,marginLeft:t.rhythm(1)}),o=u(o,["b","strong","dt","th"],{fontWeight:e.boldWeight}),o=u(o,"hr",{background:i(80),border:"none",height:"1px",marginBottom:`calc(${p} - 1px)`}),o=u(o,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:t.rhythm(1)}),o=u(o,"li",{marginBottom:`calc(${p} / 2)`}),o=u(o,["ol li","ul li"],{paddingLeft:0}),o=u(o,["li > ol","li > ul"],{marginLeft:t.rhythm(1),marginBottom:`calc(${p} / 2)`,marginTop:`calc(${p} / 2)`}),o=u(o,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),o=u(o,["li > p"],{marginBottom:`calc(${p} / 2)`}),o=u(o,["code","kbd","pre","samp"],f({},t.adjustFontSizeTo("85%"))),o=u(o,["abbr","acronym"],{borderBottom:`1px dotted ${i(50)}`,cursor:"help"}),o["abbr[title]"]={borderBottom:`1px dotted ${i(50)}`,cursor:"help",textDecoration:"none"},o=u(o,["table"],f({},t.adjustFontSizeTo(e.baseFontSize),{borderCollapse:"collapse",width:"100%"})),o=u(o,["thead"],{textAlign:"left"}),o=u(o,["td,th"],{textAlign:"left",borderBottom:`1px solid ${i(88)}`,fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:t.rhythm(2/3),paddingRight:t.rhythm(2/3),paddingTop:t.rhythm(.5),paddingBottom:`calc(${t.rhythm(.5)} - 1px)`}),o=u(o,"th:first-child,td:first-child",{paddingLeft:0}),o=u(o,"th:last-child,td:last-child",{paddingRight:0}),o=u(o,["h1","h2","h3","h4","h5","h6"],{color:e.headerColor,fontFamily:e.headerFontFamily.map(b).join(","),fontWeight:e.headerWeight,textRendering:"optimizeLegibility"});const y=t.scale(1),S=t.scale(.6),F=t.scale(.4),$=t.scale(0),B=t.scale(-.2),k=t.scale(-.3);return n([y,S,F,$,B,k],(t,i)=>{o=r(o,`h${i+1}.fontSize`,t.fontSize),o=r(o,`h${i+1}.lineHeight`,e.headerLineHeight)}),m(e.plugins)&&(o=h(e.plugins,(o,i)=>d(o,i(t,e,o)),o)),e.overrideStyles&&s(e.overrideStyles)&&(o=d(o,e.overrideStyles(t,e,o))),e.overrideThemeStyles&&s(e.overrideThemeStyles)&&(o=d(o,e.overrideThemeStyles(t,e,o))),o})(y,p),toString(){return((t,e,o)=>{let i=S(o);return e.includeNormalize&&(i=`${g}${i}`),i})(0,p,this.toJSON())},injectStyles(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{const t=document.createElement("style");t.id="typography.js",t.innerHTML=this.toString();const e=document.head;e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}})};export{F as default}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("object-assign"),require("compass-vertical-rhythm"),require("modularscale"),require("gray-percentage"),require("lodash/set"),require("lodash/forEach"),require("lodash/isNumber"),require("lodash/isString"),require("lodash/isFunction"),require("lodash/isArray"),require("lodash/merge"),require("lodash/reduce"),require("typography-normalize"),require("decamelize"),require("lodash/isObject")):"function"==typeof define&&define.amd?define(["object-assign","compass-vertical-rhythm","modularscale","gray-percentage","lodash/set","lodash/forEach","lodash/isNumber","lodash/isString","lodash/isFunction","lodash/isArray","lodash/merge","lodash/reduce","typography-normalize","decamelize","lodash/isObject"],t):(e||self).typography=t(e.objectAssign,e.compassVerticalRhythm,e.modularscale,e.grayPercentage,e.set,e.each,e.isNumber,e.isString,e.isFunction,e.isArray,e.merge,e.reduce,e.typographyNormalize,e.decamelize,e.isObject)}(this,function(e,t,i,o,r,a,n,l,d,s,u,h,c,g,f){function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(e),y=m(t),b=m(i),S=m(o),F=m(r),v=m(a),z=m(n),B=m(l),j=m(d),x=m(s),k=m(u),q=m(h),L=m(c),T=m(g),W=m(f);function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e}).apply(this,arguments)}var O=function(e,t,i){var o;return void 0===e&&(e={}),o=x.default(t)?t:[t],v.default(o,function(t){v.default(i,function(i,o){F.default(e,t+"."+o,i)})}),e},R=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],C=function(e){return-1!==R.indexOf(e)?e:"'"+e+"'"},N=function e(t){return q.default(t,function(t,i,o){return t+=o+"{",v.default(i,function(i,o){if(W.default(i)){var r={};r[o]=i,t+=e(r)}else{var a=T.default(o,"-")+":"+i+";";["Webkit","ms","Moz","O"].forEach(function(e){o.slice(0,e.length)===e&&(a="-"+a)}),t+=a}}),t+="}"},"")},H=function(e,t,i){var o=N(i);return t.includeNormalize&&(o=""+L.default+o),o};return function(e){var t=p.default({},{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),i=y.default(t);return i.scale=function(e){var o=parseInt(t.baseFontSize,10),r=b.default(e,t.scaleRatio)*o+"px";return i.adjustFontSizeTo(r)},M({options:t},i,{createStyles:function(){return this.toString()},toJSON:function(){return function(e,t){var i,o={},r=e.establishBaseline();o=O(o,"html",{font:r.fontSize+"/"+r.lineHeight+" "+t.bodyFontFamily.map(C).join(","),boxSizing:"border-box",overflowY:"scroll"}),o=O(o,["*","*:before","*:after"],{boxSizing:"inherit"}),o=O(o,"body",{color:t.bodyColor,fontFamily:t.bodyFontFamily.map(C).join(","),fontWeight:t.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),o=O(o,"img",{maxWidth:"100%"}),i=z.default(t.blockMarginBottom)?e.rhythm(t.blockMarginBottom):B.default(t.blockMarginBottom)?t.blockMarginBottom:e.rhythm(1),o=O(o,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:i}),o=O(o,"blockquote",{marginRight:e.rhythm(1),marginBottom:i,marginLeft:e.rhythm(1)}),o=O(o,["b","strong","dt","th"],{fontWeight:t.boldWeight}),o=O(o,"hr",{background:S.default(80),border:"none",height:"1px",marginBottom:"calc("+i+" - 1px)"}),o=O(o,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:e.rhythm(1)}),o=O(o,"li",{marginBottom:"calc("+i+" / 2)"}),o=O(o,["ol li","ul li"],{paddingLeft:0}),o=O(o,["li > ol","li > ul"],{marginLeft:e.rhythm(1),marginBottom:"calc("+i+" / 2)",marginTop:"calc("+i+" / 2)"}),o=O(o,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),o=O(o,["li > p"],{marginBottom:"calc("+i+" / 2)"}),o=O(o,["code","kbd","pre","samp"],M({},e.adjustFontSizeTo("85%"))),(o=O(o,["abbr","acronym"],{borderBottom:"1px dotted "+S.default(50),cursor:"help"}))["abbr[title]"]={borderBottom:"1px dotted "+S.default(50),cursor:"help",textDecoration:"none"},o=O(o,["table"],M({},e.adjustFontSizeTo(t.baseFontSize),{borderCollapse:"collapse",width:"100%"})),o=O(o,["thead"],{textAlign:"left"}),o=O(o,["td,th"],{textAlign:"left",borderBottom:"1px solid "+S.default(88),fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:e.rhythm(2/3),paddingRight:e.rhythm(2/3),paddingTop:e.rhythm(.5),paddingBottom:"calc("+e.rhythm(.5)+" - 1px)"}),o=O(o,"th:first-child,td:first-child",{paddingLeft:0}),o=O(o,"th:last-child,td:last-child",{paddingRight:0}),o=O(o,["h1","h2","h3","h4","h5","h6"],{color:t.headerColor,fontFamily:t.headerFontFamily.map(C).join(","),fontWeight:t.headerWeight,textRendering:"optimizeLegibility"});var a=e.scale(1),n=e.scale(.6),l=e.scale(.4),d=e.scale(0),s=e.scale(-.2),u=e.scale(-.3);return v.default([a,n,l,d,s,u],function(e,i){o=F.default(o,"h"+(i+1)+".fontSize",e.fontSize),o=F.default(o,"h"+(i+1)+".lineHeight",t.headerLineHeight)}),x.default(t.plugins)&&(o=q.default(t.plugins,function(i,o){return k.default(i,o(e,t,i))},o)),t.overrideStyles&&j.default(t.overrideStyles)&&(o=k.default(o,t.overrideStyles(e,t,o))),t.overrideThemeStyles&&j.default(t.overrideThemeStyles)&&(o=k.default(o,t.overrideThemeStyles(e,t,o))),o}(i,t)},toString:function(){return H(0,t,this.toJSON())},injectStyles:function(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{var e=document.createElement("style");e.id="typography.js",e.innerHTML=this.toString();var t=document.head;t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}}})}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("object-assign"),require("compass-vertical-rhythm"),require("modularscale"),require("gray-percentage"),require("lodash/set"),require("lodash/forEach"),require("lodash/isNumber"),require("lodash/isString"),require("lodash/isFunction"),require("lodash/isArray"),require("lodash/merge"),require("lodash/reduce"),require("typography-normalize"),require("decamelize"),require("lodash/isObject")):"function"==typeof define&&define.amd?define(["object-assign","compass-vertical-rhythm","modularscale","gray-percentage","lodash/set","lodash/forEach","lodash/isNumber","lodash/isString","lodash/isFunction","lodash/isArray","lodash/merge","lodash/reduce","typography-normalize","decamelize","lodash/isObject"],t):(e||self).typography=t(e.objectAssign,e.compassVerticalRhythm,e.modularscale,e.grayPercentage,e.set,e.each,e.isNumber,e.isString,e.isFunction,e.isArray,e.merge,e.reduce,e.typographyNormalize,e.decamelize,e.isObject)}(this,function(e,t,i,o,r,a,n,l,d,s,u,h,c,g,f){function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(e),y=m(t),b=m(i),S=m(o),F=m(r),v=m(a),z=m(n),B=m(l),j=m(d),x=m(s),k=m(u),q=m(h),W=m(c),L=m(g),T=m(f);function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},O.apply(this,arguments)}var M=function(e,t,i){var o;return void 0===e&&(e={}),o=x.default(t)?t:[t],v.default(o,function(t){v.default(i,function(i,o){F.default(e,t+"."+o,i)})}),e},R=["inherit","default","serif","sans-serif","monospace","fantasy","cursive","-apple-system"],C=function(e){return-1!==R.indexOf(e)||e.startsWith("var(")?e:"'"+e+"'"},N=function e(t){return q.default(t,function(t,i,o){return t+=o+"{",v.default(i,function(i,o){if(T.default(i)){var r={};r[o]=i,t+=e(r)}else{var a=L.default(o,"-")+":"+i+";";["Webkit","ms","Moz","O"].forEach(function(e){o.slice(0,e.length)===e&&(a="-"+a)}),t+=a}}),t+="}"},"")},H=function(e,t,i){var o=N(i);return t.includeNormalize&&(o=""+W.default+o),o};return function(e){var t=p.default({},{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),i=y.default(t);return i.scale=function(e){var o=parseInt(t.baseFontSize,10),r=b.default(e,t.scaleRatio)*o+"px";return i.adjustFontSizeTo(r)},O({options:t},i,{createStyles:function(){return this.toString()},toJSON:function(){return function(e,t){var i,o={},r=e.establishBaseline();o=M(o,"html",{font:r.fontSize+"/"+r.lineHeight+" "+t.bodyFontFamily.map(C).join(","),boxSizing:"border-box",overflowY:"scroll"}),o=M(o,["*","*:before","*:after"],{boxSizing:"inherit"}),o=M(o,"body",{color:t.bodyColor,fontFamily:t.bodyFontFamily.map(C).join(","),fontWeight:t.bodyWeight,wordWrap:"break-word",fontKerning:"normal",MozFontFeatureSettings:'"kern", "liga", "clig", "calt"',msFontFeatureSettings:'"kern", "liga", "clig", "calt"',WebkitFontFeatureSettings:'"kern", "liga", "clig", "calt"',fontFeatureSettings:'"kern", "liga", "clig", "calt"'}),o=M(o,"img",{maxWidth:"100%"}),i=z.default(t.blockMarginBottom)?e.rhythm(t.blockMarginBottom):B.default(t.blockMarginBottom)?t.blockMarginBottom:e.rhythm(1),o=M(o,["h1","h2","h3","h4","h5","h6","hgroup","ul","ol","dl","dd","p","figure","pre","table","fieldset","blockquote","form","noscript","iframe","img","hr","address"],{marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,marginBottom:i}),o=M(o,"blockquote",{marginRight:e.rhythm(1),marginBottom:i,marginLeft:e.rhythm(1)}),o=M(o,["b","strong","dt","th"],{fontWeight:t.boldWeight}),o=M(o,"hr",{background:S.default(80),border:"none",height:"1px",marginBottom:"calc("+i+" - 1px)"}),o=M(o,["ol","ul"],{listStylePosition:"outside",listStyleImage:"none",marginLeft:e.rhythm(1)}),o=M(o,"li",{marginBottom:"calc("+i+" / 2)"}),o=M(o,["ol li","ul li"],{paddingLeft:0}),o=M(o,["li > ol","li > ul"],{marginLeft:e.rhythm(1),marginBottom:"calc("+i+" / 2)",marginTop:"calc("+i+" / 2)"}),o=M(o,["blockquote *:last-child","li *:last-child","p *:last-child"],{marginBottom:0}),o=M(o,["li > p"],{marginBottom:"calc("+i+" / 2)"}),o=M(o,["code","kbd","pre","samp"],O({},e.adjustFontSizeTo("85%"))),(o=M(o,["abbr","acronym"],{borderBottom:"1px dotted "+S.default(50),cursor:"help"}))["abbr[title]"]={borderBottom:"1px dotted "+S.default(50),cursor:"help",textDecoration:"none"},o=M(o,["table"],O({},e.adjustFontSizeTo(t.baseFontSize),{borderCollapse:"collapse",width:"100%"})),o=M(o,["thead"],{textAlign:"left"}),o=M(o,["td,th"],{textAlign:"left",borderBottom:"1px solid "+S.default(88),fontFeatureSettings:'"tnum"',MozFontFeatureSettings:'"tnum"',msFontFeatureSettings:'"tnum"',WebkitFontFeatureSettings:'"tnum"',paddingLeft:e.rhythm(2/3),paddingRight:e.rhythm(2/3),paddingTop:e.rhythm(.5),paddingBottom:"calc("+e.rhythm(.5)+" - 1px)"}),o=M(o,"th:first-child,td:first-child",{paddingLeft:0}),o=M(o,"th:last-child,td:last-child",{paddingRight:0}),o=M(o,["h1","h2","h3","h4","h5","h6"],{color:t.headerColor,fontFamily:t.headerFontFamily.map(C).join(","),fontWeight:t.headerWeight,textRendering:"optimizeLegibility"});var a=e.scale(1),n=e.scale(.6),l=e.scale(.4),d=e.scale(0),s=e.scale(-.2),u=e.scale(-.3);return v.default([a,n,l,d,s,u],function(e,i){o=F.default(o,"h"+(i+1)+".fontSize",e.fontSize),o=F.default(o,"h"+(i+1)+".lineHeight",t.headerLineHeight)}),x.default(t.plugins)&&(o=q.default(t.plugins,function(i,o){return k.default(i,o(e,t,i))},o)),t.overrideStyles&&j.default(t.overrideStyles)&&(o=k.default(o,t.overrideStyles(e,t,o))),t.overrideThemeStyles&&j.default(t.overrideThemeStyles)&&(o=k.default(o,t.overrideThemeStyles(e,t,o))),o}(i,t)},toString:function(){return H(0,t,this.toJSON())},injectStyles:function(){if("undefined"!=typeof document)if(document.getElementById("typography.js"))document.getElementById("typography.js").innerHTML=this.toString();else{var e=document.createElement("style");e.id="typography.js",e.innerHTML=this.toString();var t=document.head;t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}}})}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "typography", | ||
"description": "Opinionated toolkit for building websites with beautiful typography", | ||
"version": "0.16.21", | ||
"version": "0.16.24", | ||
"author": "Kyle Mathews <mathews.kyle@gmail.com>", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -46,3 +46,3 @@ // @flow | ||
const wrapFontFamily = fontFamily => | ||
genericFontFamilies.indexOf(fontFamily) !== -1 | ||
genericFontFamilies.indexOf(fontFamily) !== -1 || fontFamily.startsWith('var(') | ||
? fontFamily | ||
@@ -49,0 +49,0 @@ : `'${fontFamily}'` |
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
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
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
137989