fontaine 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{metrics-CS5CISMK.cjs → metrics-DjL28VHB.cjs} +4 -4
- package/dist/{metrics-BfrxJdKT.mjs → metrics-R5FQ6W30.mjs} +4 -4
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.mjs +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ import { defineConfig } from 'astro/config'
|
|
|
53
53
|
|
|
54
54
|
const options = {
|
|
55
55
|
// You can specify fallbacks as an array (applies to all fonts)
|
|
56
|
-
fallbacks: ['
|
|
56
|
+
fallbacks: ['Segoe UI', 'Helvetica Neue', 'Arial', 'Noto Sans'],
|
|
57
57
|
|
|
58
58
|
// Or as an object to configure specific fallbacks per font family
|
|
59
59
|
// fallbacks: {
|
|
@@ -146,7 +146,7 @@ For these setups, use the PostCSS plugin instead. It runs over fully-compiled CS
|
|
|
146
146
|
module.exports = {
|
|
147
147
|
plugins: [
|
|
148
148
|
require('fontaine/postcss')({
|
|
149
|
-
fallbacks: ['
|
|
149
|
+
fallbacks: ['Segoe UI', 'Helvetica Neue', 'Arial', 'Noto Sans'],
|
|
150
150
|
}),
|
|
151
151
|
// ...any other plugins, such as autoprefixer or cssnano
|
|
152
152
|
],
|
|
@@ -183,7 +183,7 @@ const options = {
|
|
|
183
183
|
|
|
184
184
|
### Default Category Fallbacks
|
|
185
185
|
|
|
186
|
-
- **sans-serif**: `
|
|
186
|
+
- **sans-serif**: `Segoe UI`, `Helvetica Neue`, `Arial`, `Noto Sans`
|
|
187
187
|
- **serif**: `Times New Roman`, `Georgia`, `Noto Serif`
|
|
188
188
|
- **monospace**: `Courier New`, `Roboto Mono`, `Noto Sans Mono`
|
|
189
189
|
- **display** & **handwriting**: Same as sans-serif
|
|
@@ -229,8 +229,8 @@ Example:
|
|
|
229
229
|
/* This additional font-face declaration will be added to your CSS. */
|
|
230
230
|
@font-face {
|
|
231
231
|
font-family: 'Roboto fallback';
|
|
232
|
-
src: local('
|
|
233
|
-
local('
|
|
232
|
+
src: local('Segoe UI'), local('Helvetica Neue'), local('Arial'),
|
|
233
|
+
local('Noto Sans');
|
|
234
234
|
ascent-override: 92.7734375%;
|
|
235
235
|
descent-override: 24.4140625%;
|
|
236
236
|
line-gap-override: 0%;
|
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_metrics = require("./metrics-
|
|
24
|
+
const require_metrics = require("./metrics-DjL28VHB.cjs");
|
|
25
25
|
let css_tree = require("css-tree");
|
|
26
26
|
let node_path = require("node:path");
|
|
27
27
|
let node_url = require("node:url");
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveCategoryFallbacks, c as generateFontFace, d as withoutQueryOrFragment, f as withoutQuotes, i as DEFAULT_CATEGORY_FALLBACKS, l as genericCSSFamilies, n as readMetrics, o as cssWideKeywords, r as readMetricsForSource, s as generateFallbackName, t as getMetricsForFamily, u as parseFontFace } from "./metrics-
|
|
1
|
+
import { a as resolveCategoryFallbacks, c as generateFontFace, d as withoutQueryOrFragment, f as withoutQuotes, i as DEFAULT_CATEGORY_FALLBACKS, l as genericCSSFamilies, n as readMetrics, o as cssWideKeywords, r as readMetricsForSource, s as generateFallbackName, t as getMetricsForFamily, u as parseFontFace } from "./metrics-R5FQ6W30.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { parse, walk } from "css-tree";
|
|
4
4
|
import { isAbsolute } from "node:path";
|
|
@@ -207,7 +207,6 @@ function renderLocalSrc(font) {
|
|
|
207
207
|
*/
|
|
208
208
|
const DEFAULT_CATEGORY_FALLBACKS = {
|
|
209
209
|
"sans-serif": [
|
|
210
|
-
"BlinkMacSystemFont",
|
|
211
210
|
"Segoe UI",
|
|
212
211
|
"Helvetica Neue",
|
|
213
212
|
"Arial",
|
|
@@ -224,14 +223,12 @@ const DEFAULT_CATEGORY_FALLBACKS = {
|
|
|
224
223
|
"Noto Sans Mono"
|
|
225
224
|
],
|
|
226
225
|
"display": [
|
|
227
|
-
"BlinkMacSystemFont",
|
|
228
226
|
"Segoe UI",
|
|
229
227
|
"Helvetica Neue",
|
|
230
228
|
"Arial",
|
|
231
229
|
"Noto Sans"
|
|
232
230
|
],
|
|
233
231
|
"handwriting": [
|
|
234
|
-
"BlinkMacSystemFont",
|
|
235
232
|
"Segoe UI",
|
|
236
233
|
"Helvetica Neue",
|
|
237
234
|
"Arial",
|
|
@@ -324,7 +321,10 @@ async function readMetrics(_source) {
|
|
|
324
321
|
if (url.protocol === "file:") metrics = await (0, _capsizecss_unpack_fs.fromFile)((0, node_url.fileURLToPath)(source));
|
|
325
322
|
else if (urlRequestCache.has(source)) metrics = await urlRequestCache.get(source);
|
|
326
323
|
else {
|
|
327
|
-
const requestPromise = (0, _capsizecss_unpack.fromUrl)(source)
|
|
324
|
+
const requestPromise = (0, _capsizecss_unpack.fromUrl)(source).catch((error) => {
|
|
325
|
+
urlRequestCache.delete(source);
|
|
326
|
+
throw error;
|
|
327
|
+
});
|
|
328
328
|
urlRequestCache.set(source, requestPromise);
|
|
329
329
|
metrics = await requestPromise;
|
|
330
330
|
}
|
|
@@ -207,7 +207,6 @@ function renderLocalSrc(font) {
|
|
|
207
207
|
*/
|
|
208
208
|
const DEFAULT_CATEGORY_FALLBACKS = {
|
|
209
209
|
"sans-serif": [
|
|
210
|
-
"BlinkMacSystemFont",
|
|
211
210
|
"Segoe UI",
|
|
212
211
|
"Helvetica Neue",
|
|
213
212
|
"Arial",
|
|
@@ -224,14 +223,12 @@ const DEFAULT_CATEGORY_FALLBACKS = {
|
|
|
224
223
|
"Noto Sans Mono"
|
|
225
224
|
],
|
|
226
225
|
"display": [
|
|
227
|
-
"BlinkMacSystemFont",
|
|
228
226
|
"Segoe UI",
|
|
229
227
|
"Helvetica Neue",
|
|
230
228
|
"Arial",
|
|
231
229
|
"Noto Sans"
|
|
232
230
|
],
|
|
233
231
|
"handwriting": [
|
|
234
|
-
"BlinkMacSystemFont",
|
|
235
232
|
"Segoe UI",
|
|
236
233
|
"Helvetica Neue",
|
|
237
234
|
"Arial",
|
|
@@ -324,7 +321,10 @@ async function readMetrics(_source) {
|
|
|
324
321
|
if (url.protocol === "file:") metrics = await fromFile(fileURLToPath(source));
|
|
325
322
|
else if (urlRequestCache.has(source)) metrics = await urlRequestCache.get(source);
|
|
326
323
|
else {
|
|
327
|
-
const requestPromise = fromUrl(source)
|
|
324
|
+
const requestPromise = fromUrl(source).catch((error) => {
|
|
325
|
+
urlRequestCache.delete(source);
|
|
326
|
+
throw error;
|
|
327
|
+
});
|
|
328
328
|
urlRequestCache.set(source, requestPromise);
|
|
329
329
|
metrics = await requestPromise;
|
|
330
330
|
}
|
package/dist/postcss.cjs
CHANGED
package/dist/postcss.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveCategoryFallbacks, c as generateFontFace, d as withoutQueryOrFragment, f as withoutQuotes, l as genericCSSFamilies, o as cssWideKeywords, r as readMetricsForSource, s as generateFallbackName, t as getMetricsForFamily, u as parseFontFace } from "./metrics-
|
|
1
|
+
import { a as resolveCategoryFallbacks, c as generateFontFace, d as withoutQueryOrFragment, f as withoutQuotes, l as genericCSSFamilies, o as cssWideKeywords, r as readMetricsForSource, s as generateFallbackName, t as getMetricsForFamily, u as parseFontFace } from "./metrics-R5FQ6W30.mjs";
|
|
2
2
|
import { parse } from "css-tree";
|
|
3
3
|
//#region src/postcss.ts
|
|
4
4
|
const supportedExtensions = [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fontaine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "Automatic font fallback based on font metrics",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Daniel Roe",
|
|
@@ -66,18 +66,18 @@
|
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@capsizecss/metrics": "4.3.0",
|
|
68
68
|
"@types/css-tree": "3.2.0",
|
|
69
|
-
"@types/node": "24.
|
|
69
|
+
"@types/node": "24.19.1",
|
|
70
70
|
"@types/serve-handler": "6.1.4",
|
|
71
|
-
"@vitest/coverage-v8": "5.0.
|
|
72
|
-
"eslint": "10.
|
|
71
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
72
|
+
"eslint": "10.12.0",
|
|
73
73
|
"get-port-please": "3.2.0",
|
|
74
|
-
"magic-regexp": "0.11.
|
|
75
|
-
"postcss": "8.5.
|
|
74
|
+
"magic-regexp": "0.11.2",
|
|
75
|
+
"postcss": "8.5.29",
|
|
76
76
|
"serve-handler": "6.1.7",
|
|
77
77
|
"tsdown": "0.23.0",
|
|
78
78
|
"typescript": "6.0.3",
|
|
79
|
-
"vite": "8.3.
|
|
80
|
-
"vitest": "5.0.
|
|
79
|
+
"vite": "8.3.2",
|
|
80
|
+
"vitest": "5.0.3"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "tsdown",
|