full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -0,0 +1,2 @@
import { providers } from 'unifont';
export declare const provider: typeof providers.adobe;

View File

@@ -0,0 +1,5 @@
import { providers } from "unifont";
const provider = providers.adobe;
export {
provider
};

View File

@@ -0,0 +1 @@
export declare const provider: () => import("unifont").Provider;

View File

@@ -0,0 +1,5 @@
import { providers } from "unifont";
const provider = providers.bunny;
export {
provider
};

View File

@@ -0,0 +1 @@
export declare const provider: () => import("unifont").Provider;

View File

@@ -0,0 +1,5 @@
import { providers } from "unifont";
const provider = providers.fontshare;
export {
provider
};

View File

@@ -0,0 +1 @@
export declare const provider: () => import("unifont").Provider;

View File

@@ -0,0 +1,5 @@
import { providers } from "unifont";
const provider = providers.fontsource;
export {
provider
};

View File

@@ -0,0 +1,2 @@
import { providers } from 'unifont';
export declare const provider: typeof providers.google;

View File

@@ -0,0 +1,5 @@
import { providers } from "unifont";
const provider = providers.google;
export {
provider
};

View File

@@ -0,0 +1,48 @@
import type { providers } from 'unifont';
import type { AstroFontProvider } from '../types.js';
/** [Adobe](https://fonts.adobe.com/) */
declare function adobe(config: Parameters<typeof providers.adobe>[0]): {
entrypoint: string | URL;
config?: Record<string, any> | undefined;
};
/** [Bunny](https://fonts.bunny.net/) */
declare function bunny(): {
entrypoint: string | URL;
config?: Record<string, any> | undefined;
};
/** [Fontshare](https://www.fontshare.com/) */
declare function fontshare(): {
entrypoint: string | URL;
config?: Record<string, any> | undefined;
};
/** [Fontsource](https://fontsource.org/) */
declare function fontsource(): {
entrypoint: string | URL;
config?: Record<string, any> | undefined;
};
/** [Google](https://fonts.google.com/) */
declare function google(config?: Parameters<typeof providers.google>[0]): {
entrypoint: string | URL;
config?: Record<string, any> | undefined;
};
/**
* Astro re-exports most [unifont](https://github.com/unjs/unifont/) providers:
* - [Adobe](https://fonts.adobe.com/)
* - [Bunny](https://fonts.bunny.net/)
* - [Fontshare](https://www.fontshare.com/)
* - [Fontsource](https://fontsource.org/)
* - [Google](https://fonts.google.com/)
*/
export declare const fontProviders: {
adobe: typeof adobe;
bunny: typeof bunny;
fontshare: typeof fontshare;
fontsource: typeof fontsource;
google: typeof google;
};
/** A type helper for defining Astro font providers config objects */
export declare function defineAstroFontProvider(provider: AstroFontProvider): {
entrypoint: string | URL;
config?: Record<string, any> | undefined;
};
export {};

View File

@@ -0,0 +1,41 @@
function adobe(config) {
return defineAstroFontProvider({
entrypoint: "astro/assets/fonts/providers/adobe",
config
});
}
function bunny() {
return defineAstroFontProvider({
entrypoint: "astro/assets/fonts/providers/bunny"
});
}
function fontshare() {
return defineAstroFontProvider({
entrypoint: "astro/assets/fonts/providers/fontshare"
});
}
function fontsource() {
return defineAstroFontProvider({
entrypoint: "astro/assets/fonts/providers/fontsource"
});
}
function google(config) {
return defineAstroFontProvider({
entrypoint: "astro/assets/fonts/providers/google",
config
});
}
const fontProviders = {
adobe,
bunny,
fontshare,
fontsource,
google
};
function defineAstroFontProvider(provider) {
return provider;
}
export {
defineAstroFontProvider,
fontProviders
};

View File

@@ -0,0 +1,13 @@
import type * as unifont from 'unifont';
import type { FontFileReader, FontTypeExtractor, UrlProxy } from '../definitions.js';
import type { ResolvedLocalFontFamily } from '../types.js';
interface Options {
family: ResolvedLocalFontFamily;
urlProxy: UrlProxy;
fontTypeExtractor: FontTypeExtractor;
fontFileReader: FontFileReader;
}
export declare function resolveLocalFont({ family, urlProxy, fontTypeExtractor, fontFileReader, }: Options): {
fonts: Array<unifont.FontFaceData>;
};
export {};

View File

@@ -0,0 +1,53 @@
import { FONT_FORMATS } from "../constants.js";
function resolveLocalFont({
family,
urlProxy,
fontTypeExtractor,
fontFileReader
}) {
return {
fonts: family.variants.map((variant) => {
const shouldInfer = variant.weight === void 0 || variant.style === void 0;
const data = {
// If it should be inferred, we don't want to set the value
weight: variant.weight,
style: variant.style,
src: [],
unicodeRange: variant.unicodeRange,
display: variant.display,
stretch: variant.stretch,
featureSettings: variant.featureSettings,
variationSettings: variant.variationSettings
};
data.src = variant.src.map((source, index) => {
if (shouldInfer && index === 0) {
const result = fontFileReader.extract({ family: family.name, url: source.url });
if (variant.weight === void 0) data.weight = result.weight;
if (variant.style === void 0) data.style = result.style;
}
const type = fontTypeExtractor.extract(source.url);
return {
originalURL: source.url,
url: urlProxy.proxy({
url: source.url,
type,
// We only use the first source for preloading. For example if woff2 and woff
// are available, we only keep woff2.
collectPreload: index === 0,
data: {
weight: data.weight,
style: data.style
},
init: null
}),
format: FONT_FORMATS.find((e) => e.type === type)?.format,
tech: source.tech
};
});
return data;
})
};
}
export {
resolveLocalFont
};