You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@financial-times/o-typography

Package Overview
Dependencies
Maintainers
18
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.0-beta.2 to 6.0.0-beta.3

23

dist/js/typography.js

@@ -13,4 +13,10 @@ "use strict";

class Typography {
/**
* Class constructor.
* @param {HTMLElement} [typographyEl] - The root element to apply typography classes.
* @param {Object} [opts={loadOnInit: true, rejectOnFontLoadFailure: false, fontLoadedCookieName: 'o-typography-fonts-loaded'}] - An options object for configuring o-typography.
*/
constructor(typographyEl, opts) {
this.typographyEl = typographyEl;
this.fontLoadingPrefix = 'o-typography--loading-';
this.opts = opts || Typography.getOptions(typographyEl);

@@ -85,9 +91,4 @@

static checkOptions(opts) {
if (!opts.fontLoadingPrefix) {
opts.fontLoadingPrefix = 'o-typography--loading-';
}
if (!opts.fontLoadedCookieName) {
// backwards compatibility with old local storage implementation
opts.fontLoadedCookieName = opts.fontLoadedStorageName || 'o-typography-fonts-loaded';
opts.fontLoadedCookieName = 'o-typography-fonts-loaded';
}

@@ -111,3 +112,3 @@

this.fontConfigs.forEach(config => {
this.typographyEl.classList.remove("".concat(this.opts.fontLoadingPrefix).concat(config.label));
this.typographyEl.classList.remove("".concat(this.fontLoadingPrefix).concat(config.label));
});

@@ -132,3 +133,3 @@ }

}).load().then(() => {
this.typographyEl.classList.remove("".concat(this.opts.fontLoadingPrefix).concat(fontConfig.label));
this.typographyEl.classList.remove("".concat(this.fontLoadingPrefix).concat(fontConfig.label));
});

@@ -146,3 +147,9 @@ });

}
/**
* Initialise o-typography.
* @param {(HTMLElement|String)} rootElement - The root element to intialise o-typography on, or a CSS selector for the root element
* @param {Object} [options={}] - An options object for configuring o-typography
*/
static init(rootEl, opts) {

@@ -149,0 +156,0 @@ if (!rootEl) {

@@ -28,7 +28,7 @@ {

"name": "@financial-times/o-typography",
"version": "6.0.0-beta.2",
"version": "6.0.0-beta.3",
"dependencies": {
"fontfaceobserver": "^2.0.9",
"superstore-sync": "^2.1.0",
"@financial-times/o-colors": "5.0.0-beta.1",
"@financial-times/o-colors": "5.0.0-beta.2",
"@financial-times/o-fonts": "4.0.0-beta.1",

@@ -38,3 +38,3 @@ "@financial-times/o-grid": "5.0.0-beta.2",

"@financial-times/o-spacing": "^2.0.0",
"@financial-times/o-normalise": "2.0.0-beta.3"
"@financial-times/o-normalise": "2.0.0-beta.4"
},

@@ -41,0 +41,0 @@ "component": "o-typography",

@@ -5,5 +5,12 @@ import FontFaceObserver from 'fontfaceobserver/fontfaceobserver.standalone.js';

/**
* Class constructor.
* @param {HTMLElement} [typographyEl] - The root element to apply typography classes.
* @param {Object} [opts={loadOnInit: true, rejectOnFontLoadFailure: false, fontLoadedCookieName: 'o-typography-fonts-loaded'}] - An options object for configuring o-typography.
*/
constructor (typographyEl, opts) {
this.typographyEl = typographyEl;
this.fontLoadingPrefix = 'o-typography--loading-';
this.opts = opts || Typography.getOptions(typographyEl);

@@ -77,9 +84,4 @@ if (typeof this.opts.loadOnInit === 'undefined') {

if (!opts.fontLoadingPrefix) {
opts.fontLoadingPrefix = 'o-typography--loading-';
}
if (!opts.fontLoadedCookieName) {
// backwards compatibility with old local storage implementation
opts.fontLoadedCookieName = opts.fontLoadedStorageName || 'o-typography-fonts-loaded';
opts.fontLoadedCookieName = 'o-typography-fonts-loaded';
}

@@ -103,3 +105,3 @@

this.fontConfigs.forEach((config) => {
this.typographyEl.classList.remove(`${this.opts.fontLoadingPrefix}${config.label}`);
this.typographyEl.classList.remove(`${this.fontLoadingPrefix}${config.label}`);
});

@@ -123,3 +125,3 @@ }

.then(() => {
this.typographyEl.classList.remove(`${this.opts.fontLoadingPrefix}${fontConfig.label}`);
this.typographyEl.classList.remove(`${this.fontLoadingPrefix}${fontConfig.label}`);
});

@@ -141,2 +143,7 @@ });

/**
* Initialise o-typography.
* @param {(HTMLElement|String)} rootElement - The root element to intialise o-typography on, or a CSS selector for the root element
* @param {Object} [options={}] - An options object for configuring o-typography
*/
static init (rootEl, opts) {

@@ -143,0 +150,0 @@ if (!rootEl) {

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc