Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capsizecss/core

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capsizecss/core - npm Package Compare versions

Comparing version 0.0.0-createfontstack-20221108001254 to 0.0.0-createfontstack-20221110224822

24

dist/capsizecss-core.browser.cjs.js

@@ -210,8 +210,10 @@ 'use strict';

if (sizeAdjustStrategy) {
const preferredFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const preferredFontAvgWidth = metrics[sizeAdjustStrategy];
metrics[sizeAdjustStrategy] / metrics.unitsPerEm;
const fallbackFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy];
if (preferredFontAvgWidth && fallbackFontAvgWidth) {
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth;
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm;
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) {
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio;
}

@@ -272,16 +274,2 @@ }

const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name;
// TODO: test cases for later
// ✅ Goudy Bookletter 1911
// ✅ Red/Black
// ✅ "Lucida" Grande
// ✅ Ahem!
// ✅ test@foo
// ✅ #POUND
// ✅ Hawaii 5-0
// ❌ sans-serif
// ❌ asdasdasd
// ✅ "Lucide Grande"
// ✅ "Lucide
// ✅ 'Sasd asdasd'
function createFontStack(_ref3) {

@@ -288,0 +276,0 @@ let [metrics, ...fallbacks] = _ref3;

@@ -206,8 +206,10 @@ function normaliseOptions(options) {

if (sizeAdjustStrategy) {
const preferredFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const preferredFontAvgWidth = metrics[sizeAdjustStrategy];
metrics[sizeAdjustStrategy] / metrics.unitsPerEm;
const fallbackFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy];
if (preferredFontAvgWidth && fallbackFontAvgWidth) {
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth;
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm;
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) {
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio;
}

@@ -268,16 +270,2 @@ }

const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name;
// TODO: test cases for later
// ✅ Goudy Bookletter 1911
// ✅ Red/Black
// ✅ "Lucida" Grande
// ✅ Ahem!
// ✅ test@foo
// ✅ #POUND
// ✅ Hawaii 5-0
// ❌ sans-serif
// ❌ asdasdasd
// ✅ "Lucide Grande"
// ✅ "Lucide
// ✅ 'Sasd asdasd'
function createFontStack(_ref3) {

@@ -284,0 +272,0 @@ let [metrics, ...fallbacks] = _ref3;

@@ -210,8 +210,10 @@ 'use strict';

if (sizeAdjustStrategy) {
const preferredFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const preferredFontAvgWidth = metrics[sizeAdjustStrategy];
metrics[sizeAdjustStrategy] / metrics.unitsPerEm;
const fallbackFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy];
if (preferredFontAvgWidth && fallbackFontAvgWidth) {
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth;
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm;
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) {
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio;
}

@@ -272,16 +274,2 @@ }

const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name;
// TODO: test cases for later
// ✅ Goudy Bookletter 1911
// ✅ Red/Black
// ✅ "Lucida" Grande
// ✅ Ahem!
// ✅ test@foo
// ✅ #POUND
// ✅ Hawaii 5-0
// ❌ sans-serif
// ❌ asdasdasd
// ✅ "Lucide Grande"
// ✅ "Lucide
// ✅ 'Sasd asdasd'
function createFontStack(_ref3) {

@@ -288,0 +276,0 @@ let [metrics, ...fallbacks] = _ref3;

@@ -210,8 +210,10 @@ 'use strict';

if (sizeAdjustStrategy) {
const preferredFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const preferredFontAvgWidth = metrics[sizeAdjustStrategy];
metrics[sizeAdjustStrategy] / metrics.unitsPerEm;
const fallbackFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy];
if (preferredFontAvgWidth && fallbackFontAvgWidth) {
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth;
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm;
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) {
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio;
}

@@ -272,16 +274,2 @@ }

const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name;
// TODO: test cases for later
// ✅ Goudy Bookletter 1911
// ✅ Red/Black
// ✅ "Lucida" Grande
// ✅ Ahem!
// ✅ test@foo
// ✅ #POUND
// ✅ Hawaii 5-0
// ❌ sans-serif
// ❌ asdasdasd
// ✅ "Lucide Grande"
// ✅ "Lucide
// ✅ 'Sasd asdasd'
function createFontStack(_ref3) {

@@ -288,0 +276,0 @@ let [metrics, ...fallbacks] = _ref3;

@@ -206,8 +206,10 @@ function normaliseOptions(options) {

if (sizeAdjustStrategy) {
const preferredFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const preferredFontAvgWidth = metrics[sizeAdjustStrategy];
metrics[sizeAdjustStrategy] / metrics.unitsPerEm;
const fallbackFontXAvgRatio =
// @ts-expect-error TODO Don't ignore when final metric naming is released
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy];
if (preferredFontAvgWidth && fallbackFontAvgWidth) {
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth;
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm;
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) {
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio;
}

@@ -268,16 +270,2 @@ }

const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name;
// TODO: test cases for later
// ✅ Goudy Bookletter 1911
// ✅ Red/Black
// ✅ "Lucida" Grande
// ✅ Ahem!
// ✅ test@foo
// ✅ #POUND
// ✅ Hawaii 5-0
// ❌ sans-serif
// ❌ asdasdasd
// ✅ "Lucide Grande"
// ✅ "Lucide
// ✅ 'Sasd asdasd'
function createFontStack(_ref3) {

@@ -284,0 +272,0 @@ let [metrics, ...fallbacks] = _ref3;

@@ -1,14 +0,12 @@

import { FontMetrics } from './types';
import { Font } from '@capsizecss/unpack';
import { AtRule } from 'csstype';
declare type SizeAdjustStrategy = 'xAvgCharWidth' | 'xAvgLowercase' | 'xAvgWeightedOs2' | 'xAvgWeightedWiki' | 'xAvgLetterFrequency';
interface UnpackedMetrics extends FontMetrics {
familyName: string;
}
declare type FontFace = {
'@font-face': AtRule.FontFace;
};
export declare const quoteIfNeeded: (name: string) => string;
interface CreateFontStackOptions {
sizeAdjust?: SizeAdjustStrategy;
}
export declare function createFontStack([metrics, ...fallbacks]: UnpackedMetrics[], options?: CreateFontStackOptions): {
export declare function createFontStack([metrics, ...fallbacks]: Font[], options?: CreateFontStackOptions): {
fontFamily: string;

@@ -15,0 +13,0 @@ fontFaces: FontFace[];

{
"name": "@capsizecss/core",
"version": "0.0.0-createfontstack-20221108001254",
"version": "0.0.0-createfontstack-20221110224822",
"description": "Flipping how we define typography",

@@ -42,2 +42,3 @@ "main": "dist/capsizecss-core.cjs.js",

"devDependencies": {
"@capsizecss/unpack": "0.0.0-createfontstack-20221110224822",
"@emotion/css": "^11.1.3",

@@ -44,0 +45,0 @@ "csstype": "^3.1.1"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc