font-picker
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -176,5 +176,3 @@ (function (global, factory) { | ||
var activeFontStylesheet = document.createElement("style"); | ||
var previewFontsStylesheet = document.createElement("style"); | ||
document.head.appendChild(activeFontStylesheet); | ||
document.head.appendChild(previewFontsStylesheet); | ||
@@ -186,11 +184,16 @@ function applyFontPreview(previewFont, selectorSuffix) { | ||
} | ||
function getActiveFontStylesheet(selectorSuffix) { | ||
var stylesheetId = "active-font-" + selectorSuffix; | ||
var activeFontStylesheet = document.getElementById(stylesheetId); | ||
if (!activeFontStylesheet) { | ||
activeFontStylesheet = document.createElement("style"); | ||
activeFontStylesheet.id = stylesheetId; | ||
document.head.appendChild(activeFontStylesheet); | ||
} | ||
return activeFontStylesheet; | ||
} | ||
function applyActiveFont(activeFont, previousFontFamily, selectorSuffix) { | ||
var style = "\n\t\t.apply-font" + selectorSuffix + " {\n\t\t\tfont-family: \"" + activeFont.family + "\"" + (previousFontFamily ? ", \"" + previousFontFamily + "\"" : "") + ";\n\t\t}\n\t"; | ||
var styleNode = document.createTextNode(style); | ||
if (activeFontStylesheet.childNodes.length === 0) { | ||
activeFontStylesheet.appendChild(styleNode); | ||
} | ||
else { | ||
activeFontStylesheet.replaceChild(styleNode, activeFontStylesheet.childNodes[0]); | ||
} | ||
var activeFontStylesheet = getActiveFontStylesheet(selectorSuffix); | ||
activeFontStylesheet.innerHTML = style; | ||
} | ||
@@ -197,0 +200,0 @@ |
@@ -176,5 +176,3 @@ (function (global, factory) { | ||
var activeFontStylesheet = document.createElement("style"); | ||
var previewFontsStylesheet = document.createElement("style"); | ||
document.head.appendChild(activeFontStylesheet); | ||
document.head.appendChild(previewFontsStylesheet); | ||
@@ -186,11 +184,16 @@ function applyFontPreview(previewFont, selectorSuffix) { | ||
} | ||
function getActiveFontStylesheet(selectorSuffix) { | ||
var stylesheetId = "active-font-" + selectorSuffix; | ||
var activeFontStylesheet = document.getElementById(stylesheetId); | ||
if (!activeFontStylesheet) { | ||
activeFontStylesheet = document.createElement("style"); | ||
activeFontStylesheet.id = stylesheetId; | ||
document.head.appendChild(activeFontStylesheet); | ||
} | ||
return activeFontStylesheet; | ||
} | ||
function applyActiveFont(activeFont, previousFontFamily, selectorSuffix) { | ||
var style = "\n\t\t.apply-font" + selectorSuffix + " {\n\t\t\tfont-family: \"" + activeFont.family + "\"" + (previousFontFamily ? ", \"" + previousFontFamily + "\"" : "") + ";\n\t\t}\n\t"; | ||
var styleNode = document.createTextNode(style); | ||
if (activeFontStylesheet.childNodes.length === 0) { | ||
activeFontStylesheet.appendChild(styleNode); | ||
} | ||
else { | ||
activeFontStylesheet.replaceChild(styleNode, activeFontStylesheet.childNodes[0]); | ||
} | ||
var activeFontStylesheet = getActiveFontStylesheet(selectorSuffix); | ||
activeFontStylesheet.innerHTML = style; | ||
} | ||
@@ -197,0 +200,0 @@ |
{ | ||
"name": "font-picker", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Font selector component for Google Fonts", | ||
@@ -18,5 +18,5 @@ "author": "Samuel Meuli <me@samuelmeuli.com>", | ||
], | ||
"main": "dist/font-picker/FontPicker.js", | ||
"module": "dist/font-picker/FontPicker.es.js", | ||
"types": "dist/font-picker/index.d.ts", | ||
"main": "dist/font-picker/font-picker/FontPicker.js", | ||
"module": "dist/font-picker/font-picker/FontPicker.es.js", | ||
"types": "dist/font-picker/font-picker/index.d.ts", | ||
"files": [ | ||
@@ -45,7 +45,7 @@ "dist/" | ||
"autoprefixer": "^9.5.0", | ||
"eslint": "5.15.2", | ||
"eslint": "5.16.0", | ||
"eslint-config-airbnb-base": "13.1.0", | ||
"eslint-config-prettier": "^4.0.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"husky": "^1.1.4", | ||
"husky": "^2.2.0", | ||
"lint-staged": "^8.1.3", | ||
@@ -58,5 +58,5 @@ "node-sass": "^4.10.0", | ||
"rollup-plugin-postcss": "^2.0.3", | ||
"rollup-plugin-typescript2": "^0.20.1", | ||
"serve": "^10.1.2", | ||
"stylelint": "^9.10.1", | ||
"rollup-plugin-typescript2": "^0.21.0", | ||
"serve": "^11.0.0", | ||
"stylelint": "^10.0.1", | ||
"typescript": "^3.3.3333" | ||
@@ -63,0 +63,0 @@ }, |
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
125045
1942