@kiiimatz/fontrum 0.1.1 → 0.1.2

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.
@@ -0,0 +1,2 @@
1
+ 'use strict';var l=({event:o,resolve:s})=>s(o,{transformPageChunk:({html:t})=>{return t}});exports.handle=l;//# sourceMappingURL=hooks.server.cjs.map
2
+ //# sourceMappingURL=hooks.server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks.server.ts"],"names":["handle","event","resolve","html"],"mappings":"aA+BO,IAAMA,EAAiB,CAAC,CAAE,MAAAC,CAAAA,CAAO,OAAA,CAAAC,CAAQ,CAAA,GACvCA,CAAAA,CAAQD,EAAO,CACpB,kBAAA,CAAoB,CAAC,CAAE,KAAAE,CAAK,CAAA,GAAM,CAEhC,OAAiBA,CAEnB,CACF,CAAC","file":"hooks.server.cjs","sourcesContent":["import { getCSS } from \"./index.js\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\ninterface RequestEvent {\n [key: string]: unknown;\n}\n\ninterface ResolveOptions {\n transformPageChunk?: (opts: { html: string; done: boolean }) => MaybePromise<string | undefined>;\n}\n\ntype Handle = (params: {\n event: RequestEvent;\n resolve(event: RequestEvent, opts?: ResolveOptions): Promise<Response>;\n}) => MaybePromise<Response>;\n\n/**\n * SvelteKit `handle` hook that injects fontrum styles into the SSR/SSG HTML.\n *\n * @example\n * ```ts\n * // hooks.server.ts\n * export { handle } from \"@kiiimatz/fontrum/hooks\";\n *\n * // or compose with your own handle:\n * import { handle as fontrumHandle } from \"@kiiimatz/fontrum/hooks\";\n * import { sequence } from \"@sveltejs/kit/hooks\";\n * export const handle = sequence(fontrumHandle, myHandle);\n * ```\n */\nexport const handle: Handle = ({ event, resolve }) => {\n return resolve(event, {\n transformPageChunk: ({ html }) => {\n const css = getCSS();\n if (!css) return html;\n return html.replace(\"</head>\", `<style id=\"fontrum\">${css}</style></head>`);\n },\n });\n};\n"]}
@@ -0,0 +1,31 @@
1
+ type MaybePromise<T> = T | Promise<T>;
2
+ interface RequestEvent {
3
+ [key: string]: unknown;
4
+ }
5
+ interface ResolveOptions {
6
+ transformPageChunk?: (opts: {
7
+ html: string;
8
+ done: boolean;
9
+ }) => MaybePromise<string | undefined>;
10
+ }
11
+ type Handle = (params: {
12
+ event: RequestEvent;
13
+ resolve(event: RequestEvent, opts?: ResolveOptions): Promise<Response>;
14
+ }) => MaybePromise<Response>;
15
+ /**
16
+ * SvelteKit `handle` hook that injects fontrum styles into the SSR/SSG HTML.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // hooks.server.ts
21
+ * export { handle } from "@kiiimatz/fontrum/hooks";
22
+ *
23
+ * // or compose with your own handle:
24
+ * import { handle as fontrumHandle } from "@kiiimatz/fontrum/hooks";
25
+ * import { sequence } from "@sveltejs/kit/hooks";
26
+ * export const handle = sequence(fontrumHandle, myHandle);
27
+ * ```
28
+ */
29
+ declare const handle: Handle;
30
+
31
+ export { handle };
@@ -0,0 +1,31 @@
1
+ type MaybePromise<T> = T | Promise<T>;
2
+ interface RequestEvent {
3
+ [key: string]: unknown;
4
+ }
5
+ interface ResolveOptions {
6
+ transformPageChunk?: (opts: {
7
+ html: string;
8
+ done: boolean;
9
+ }) => MaybePromise<string | undefined>;
10
+ }
11
+ type Handle = (params: {
12
+ event: RequestEvent;
13
+ resolve(event: RequestEvent, opts?: ResolveOptions): Promise<Response>;
14
+ }) => MaybePromise<Response>;
15
+ /**
16
+ * SvelteKit `handle` hook that injects fontrum styles into the SSR/SSG HTML.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // hooks.server.ts
21
+ * export { handle } from "@kiiimatz/fontrum/hooks";
22
+ *
23
+ * // or compose with your own handle:
24
+ * import { handle as fontrumHandle } from "@kiiimatz/fontrum/hooks";
25
+ * import { sequence } from "@sveltejs/kit/hooks";
26
+ * export const handle = sequence(fontrumHandle, myHandle);
27
+ * ```
28
+ */
29
+ declare const handle: Handle;
30
+
31
+ export { handle };
@@ -0,0 +1,2 @@
1
+ var l=({event:o,resolve:s})=>s(o,{transformPageChunk:({html:t})=>{return t}});export{l as handle};//# sourceMappingURL=hooks.server.js.map
2
+ //# sourceMappingURL=hooks.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks.server.ts"],"names":["handle","event","resolve","html"],"mappings":"AA+BO,IAAMA,EAAiB,CAAC,CAAE,MAAAC,CAAAA,CAAO,OAAA,CAAAC,CAAQ,CAAA,GACvCA,CAAAA,CAAQD,EAAO,CACpB,kBAAA,CAAoB,CAAC,CAAE,KAAAE,CAAK,CAAA,GAAM,CAEhC,OAAiBA,CAEnB,CACF,CAAC","file":"hooks.server.js","sourcesContent":["import { getCSS } from \"./index.js\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\ninterface RequestEvent {\n [key: string]: unknown;\n}\n\ninterface ResolveOptions {\n transformPageChunk?: (opts: { html: string; done: boolean }) => MaybePromise<string | undefined>;\n}\n\ntype Handle = (params: {\n event: RequestEvent;\n resolve(event: RequestEvent, opts?: ResolveOptions): Promise<Response>;\n}) => MaybePromise<Response>;\n\n/**\n * SvelteKit `handle` hook that injects fontrum styles into the SSR/SSG HTML.\n *\n * @example\n * ```ts\n * // hooks.server.ts\n * export { handle } from \"@kiiimatz/fontrum/hooks\";\n *\n * // or compose with your own handle:\n * import { handle as fontrumHandle } from \"@kiiimatz/fontrum/hooks\";\n * import { sequence } from \"@sveltejs/kit/hooks\";\n * export const handle = sequence(fontrumHandle, myHandle);\n * ```\n */\nexport const handle: Handle = ({ event, resolve }) => {\n return resolve(event, {\n transformPageChunk: ({ html }) => {\n const css = getCSS();\n if (!css) return html;\n return html.replace(\"</head>\", `<style id=\"fontrum\">${css}</style></head>`);\n },\n });\n};\n"]}
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var c={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",eot:"embedded-opentype",svg:"svg",svgz:"svg"};function y(o){let n=o.split("?")[0].split(".").pop()?.toLowerCase()??"";return c[n]??n}function g(o){return o.map(n=>`url('${n}') format('${y(n)}')`).join(`,
2
- `)}function u(o){return `<style>${o.map(t=>{let s=t.class,r=Array.isArray(t.font)?t.font:[t.font],e=t.weight??"normal",i=t.style??"normal",a=t.display??"swap",l=t.fallback??"sans-serif",f=["@font-face{",`font-family:'${s}';`,`src:${g(r)};`,`font-weight:${e};`,`font-style:${i};`,`font-display:${a};`,"}"].join(""),p=`.${s}{font-family:'${s}',${l};}`;return `${f}${p}`}).join("")}</style>`}var $=u;exports.default=$;exports.fontrum=u;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var u={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",eot:"embedded-opentype",svg:"svg",svgz:"svg"};function d(n){let t=n.split("?")[0].split(".").pop()?.toLowerCase()??"";return u[t]??t}function y(n){return n.map(t=>`url('${t}') format('${d(t)}')`).join(`,
2
+ `)}function m(n){return n.map((t,o)=>{let s=t.class??`fontrum-${o}`,r=Array.isArray(t.font)?t.font:[t.font],i=t.weight??"normal",l=t.style??"normal",a=t.display??"swap",f=t.fallback??"sans-serif",c=["@font-face{",`font-family:'${s}';`,`src:${y(r)};`,`font-weight:${i};`,`font-style:${l};`,`font-display:${a};`,"}"].join(""),p=`${t.class?`.${t.class}`:"body"}{font-family:'${s}',${f};}`;return `${c}${p}`}).join("")}var e="";function w(){return e}function g(n){if(e=m(n),typeof document<"u"){let t="fontrum",o=document.getElementById(t);o||(o=document.createElement("style"),o.id=t,document.head.appendChild(o)),o.textContent=e;}}var b=g;exports.default=b;exports.fontrum=g;exports.getCSS=w;//# sourceMappingURL=index.cjs.map
3
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["FORMAT_MAP","getFormat","path","ext","buildSrc","fonts","f","fontrum","cfg","family","sources","weight","style","display","fallback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CACtB,CAAA,IAAA,EAAOL,EAASM,CAAO,CAAC,IACxB,CAAA,YAAA,EAAeC,CAAM,IACrB,CAAA,WAAA,EAAcC,CAAK,IACnB,CAAA,aAAA,EAAgBC,CAAO,IACvB,GACF,CAAA,CAAE,KAAK,EAAE,CAAA,CAEHG,EAAM,CAAA,CAAA,EAAIP,CAAM,iBAAiBA,CAAM,CAAA,EAAA,EAAKK,CAAQ,CAAA,EAAA,CAAA,CAE1D,OAAO,GAAGC,CAAI,CAAA,EAAGC,CAAG,CAAA,CACtB,CAAC,EAEsB,IAAA,CAAK,EAAE,CAAC,CAAA,QAAA,CACjC,KAEOC,CAAAA,CAAQV","file":"index.cjs","sourcesContent":["export type FontDisplay = \"auto\" | \"block\" | \"swap\" | \"fallback\" | \"optional\";\n\nexport interface FontConfig {\n /** CSS class name to apply this font (e.g. \"inter\") */\n class: string;\n /**\n * Path(s) to the font file(s). Supports ttf, otf, woff, woff2, eot, svg.\n * Paths are relative to your public directory (e.g. \"/fonts/inter.woff2\").\n * Pass an array to provide multiple sources for the same font.\n */\n font: string | string[];\n /** Font weight. Defaults to \"normal\". */\n weight?: string | number;\n /** Font style. Defaults to \"normal\". */\n style?: string;\n /**\n * Controls how the font is displayed while loading.\n * \"swap\" (default) shows fallback font immediately then swaps — best for\n * most use cases and avoids invisible text during load.\n */\n display?: FontDisplay;\n /** Fallback font families appended after the custom font. Defaults to \"sans-serif\". */\n fallback?: string;\n}\n\nconst FORMAT_MAP: Record<string, string> = {\n woff2: \"woff2\",\n woff: \"woff\",\n ttf: \"truetype\",\n otf: \"opentype\",\n eot: \"embedded-opentype\",\n svg: \"svg\",\n svgz: \"svg\",\n};\n\nfunction getFormat(path: string): string {\n const ext = path.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? \"\";\n return FORMAT_MAP[ext] ?? ext;\n}\n\nfunction buildSrc(fonts: string[]): string {\n return fonts\n .map((f) => `url('${f}') format('${getFormat(f)}')`)\n .join(\",\\n \");\n}\n\n/**\n * Generate CSS for the given font configurations.\n *\n * Returns a `<style>` tag string ready to be injected via `{@html}` in a\n * `<svelte:head>` block. Works on both server (SSR/SSG) and client.\n *\n * @example\n * ```svelte\n * <script lang=\"ts\">\n * import fontrum from \"@kiiimatz/fontrum\";\n * const styles = fontrum([\n * { class: \"inter\", font: \"/fonts/inter.woff2\" },\n * { class: \"mono\", font: [\"/fonts/mono.woff2\", \"/fonts/mono.ttf\"] },\n * ]);\n * </script>\n *\n * <svelte:head>\n * {@html styles}\n * </svelte:head>\n * ```\n */\nexport function fontrum(fonts: FontConfig[]): string {\n const rules = fonts.map((cfg) => {\n const family = cfg.class;\n const sources = Array.isArray(cfg.font) ? cfg.font : [cfg.font];\n const weight = cfg.weight ?? \"normal\";\n const style = cfg.style ?? \"normal\";\n const display = cfg.display ?? \"swap\";\n const fallback = cfg.fallback ?? \"sans-serif\";\n\n const face = [\n `@font-face{`,\n `font-family:'${family}';`,\n `src:${buildSrc(sources)};`,\n `font-weight:${weight};`,\n `font-style:${style};`,\n `font-display:${display};`,\n `}`,\n ].join(\"\");\n\n const cls = `.${family}{font-family:'${family}',${fallback};}`;\n\n return `${face}${cls}`;\n });\n\n return `<style>${rules.join(\"\")}</style>`;\n}\n\nexport default fontrum;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["FORMAT_MAP","getFormat","path","ext","buildSrc","fonts","f","buildCSS","cfg","i","family","sources","weight","style","display","fallback","face","rule","_css","getCSS","fontrum","id","el","index_default"],"mappings":"sEA2BA,IAAMA,CAAAA,CAAqC,CACzC,KAAA,CAAO,OAAA,CACP,IAAA,CAAM,MAAA,CACN,GAAA,CAAK,UAAA,CACL,GAAA,CAAK,UAAA,CACL,GAAA,CAAK,mBAAA,CACL,GAAA,CAAK,KAAA,CACL,IAAA,CAAM,KACR,CAAA,CAEA,SAASC,CAAAA,CAAUC,CAAAA,CAAsB,CACvC,IAAMC,CAAAA,CAAMD,CAAAA,CAAK,KAAA,CAAM,GAAG,CAAA,CAA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CAAO,CAAA,EADIT,CAAAA,CAAI,KAAA,CAAQ,CAAA,CAAA,EAAIA,CAAAA,CAAI,KAAK,GAAK,MACvB,CAAA,cAAA,EAAiBE,CAAM,CAAA,EAAA,EAAKK,CAAQ,CAAA,EAAA,CAAA,CAE5D,OAAO,CAAA,EAAGC,CAAI,GAAGC,CAAI,CAAA,CACvB,CAAC,CAAA,CACA,IAAA,CAAK,EAAE,CACZ,CAGA,IAAIC,CAAAA,CAAO,EAAA,CAGJ,SAASC,CAAAA,EAAiB,CAC/B,OAAOD,CACT,CAwBO,SAASE,EAAQf,CAAAA,CAA2B,CAGjD,GAFAa,CAAAA,CAAOX,CAAAA,CAASF,CAAK,CAAA,CAEjB,OAAO,SAAa,GAAA,CAAa,CACnC,IAAMgB,CAAAA,CAAK,UACPC,CAAAA,CAAK,QAAA,CAAS,cAAA,CAAeD,CAAE,EAC9BC,CAAAA,GACHA,CAAAA,CAAK,QAAA,CAAS,aAAA,CAAc,OAAO,CAAA,CACnCA,CAAAA,CAAG,EAAA,CAAKD,CAAAA,CACR,SAAS,IAAA,CAAK,WAAA,CAAYC,CAAE,CAAA,CAAA,CAE9BA,EAAG,WAAA,CAAcJ,EACnB,CACF,KAEOK,CAAAA,CAAQH","file":"index.cjs","sourcesContent":["export type FontDisplay = \"auto\" | \"block\" | \"swap\" | \"fallback\" | \"optional\";\n\nexport interface FontConfig {\n /**\n * CSS class name to apply this font (e.g. \"inter\").\n * Omit to apply the font globally to `body`.\n */\n class?: string;\n /**\n * Path(s) to the font file(s). Supports ttf, otf, woff, woff2, eot, svg.\n * Paths are relative to your public directory (e.g. \"/fonts/inter.woff2\").\n * Pass an array to provide multiple sources for the same font.\n */\n font: string | string[];\n /** Font weight. Defaults to \"normal\". */\n weight?: string | number;\n /** Font style. Defaults to \"normal\". */\n style?: string;\n /**\n * Controls how the font is displayed while loading.\n * \"swap\" (default) shows fallback font immediately then swaps.\n */\n display?: FontDisplay;\n /** Fallback font families appended after the custom font. Defaults to \"sans-serif\". */\n fallback?: string;\n}\n\nconst FORMAT_MAP: Record<string, string> = {\n woff2: \"woff2\",\n woff: \"woff\",\n ttf: \"truetype\",\n otf: \"opentype\",\n eot: \"embedded-opentype\",\n svg: \"svg\",\n svgz: \"svg\",\n};\n\nfunction getFormat(path: string): string {\n const ext = path.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? \"\";\n return FORMAT_MAP[ext] ?? ext;\n}\n\nfunction buildSrc(fonts: string[]): string {\n return fonts\n .map((f) => `url('${f}') format('${getFormat(f)}')`)\n .join(\",\\n \");\n}\n\nfunction buildCSS(fonts: FontConfig[]): string {\n return fonts\n .map((cfg, i) => {\n const family = cfg.class ?? `fontrum-${i}`;\n const sources = Array.isArray(cfg.font) ? cfg.font : [cfg.font];\n const weight = cfg.weight ?? \"normal\";\n const style = cfg.style ?? \"normal\";\n const display = cfg.display ?? \"swap\";\n const fallback = cfg.fallback ?? \"sans-serif\";\n\n const face = [\n `@font-face{`,\n `font-family:'${family}';`,\n `src:${buildSrc(sources)};`,\n `font-weight:${weight};`,\n `font-style:${style};`,\n `font-display:${display};`,\n `}`,\n ].join(\"\");\n\n const selector = cfg.class ? `.${cfg.class}` : \"body\";\n const rule = `${selector}{font-family:'${family}',${fallback};}`;\n\n return `${face}${rule}`;\n })\n .join(\"\");\n}\n\n// Module-level CSS store (font configs are static, same for all requests)\nlet _css = \"\";\n\n/** @internal Used by hooks.server.ts */\nexport function getCSS(): string {\n return _css;\n}\n\n/**\n * Register fonts and inject styles automatically.\n *\n * - **SSR / SSG**: add the fontrum `handle` hook to `hooks.server.ts` once (see below).\n * - **Browser**: injects a `<style>` tag into `document.head` automatically.\n *\n * Call once in your root `+layout.svelte` — no `{@html}` or `<svelte:head>` needed.\n *\n * @example\n * ```svelte\n * <!-- +layout.svelte -->\n * <script>\n * import { fontrum } from \"@kiiimatz/fontrum\";\n * fontrum([{ class: \"inter\", font: \"/fonts/inter.woff2\" }]);\n * </script>\n * ```\n *\n * ```ts\n * // hooks.server.ts\n * export { handle } from \"@kiiimatz/fontrum/hooks\";\n * ```\n */\nexport function fontrum(fonts: FontConfig[]): void {\n _css = buildCSS(fonts);\n\n if (typeof document !== \"undefined\") {\n const id = \"fontrum\";\n let el = document.getElementById(id) as HTMLStyleElement | null;\n if (!el) {\n el = document.createElement(\"style\");\n el.id = id;\n document.head.appendChild(el);\n }\n el.textContent = _css;\n }\n}\n\nexport default fontrum;\n"]}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,10 @@
1
1
  type FontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
2
2
  interface FontConfig {
3
- /** CSS class name to apply this font (e.g. "inter") */
4
- class: string;
3
+ /**
4
+ * CSS class name to apply this font (e.g. "inter").
5
+ * Omit to apply the font globally to `body`.
6
+ */
7
+ class?: string;
5
8
  /**
6
9
  * Path(s) to the font file(s). Supports ttf, otf, woff, woff2, eot, svg.
7
10
  * Paths are relative to your public directory (e.g. "/fonts/inter.woff2").
@@ -14,36 +17,38 @@ interface FontConfig {
14
17
  style?: string;
15
18
  /**
16
19
  * Controls how the font is displayed while loading.
17
- * "swap" (default) shows fallback font immediately then swaps — best for
18
- * most use cases and avoids invisible text during load.
20
+ * "swap" (default) shows fallback font immediately then swaps.
19
21
  */
20
22
  display?: FontDisplay;
21
23
  /** Fallback font families appended after the custom font. Defaults to "sans-serif". */
22
24
  fallback?: string;
23
25
  }
26
+ /** @internal Used by hooks.server.ts */
27
+ declare function getCSS(): string;
24
28
  /**
25
- * Generate CSS for the given font configurations.
29
+ * Register fonts and inject styles automatically.
26
30
  *
27
- * Returns a `<style>` tag string ready to be injected via `{@html}` in a
28
- * `<svelte:head>` block. Works on both server (SSR/SSG) and client.
31
+ * - **SSR / SSG**: add the fontrum `handle` hook to `hooks.server.ts` once (see below).
32
+ * - **Browser**: injects a `<style>` tag into `document.head` automatically.
33
+ *
34
+ * Call once in your root `+layout.svelte` — no `{@html}` or `<svelte:head>` needed.
29
35
  *
30
36
  * @example
31
37
  * ```svelte
32
- * <script lang="ts">
33
- * import fontrum from "@kiiimatz/fontrum";
34
- * const styles = fontrum([
35
- * { class: "inter", font: "/fonts/inter.woff2" },
36
- * { class: "mono", font: ["/fonts/mono.woff2", "/fonts/mono.ttf"] },
37
- * ]);
38
+ * <!-- +layout.svelte -->
39
+ * <script>
40
+ * import { fontrum } from "@kiiimatz/fontrum";
41
+ * fontrum([{ class: "inter", font: "/fonts/inter.woff2" }]);
38
42
  * </script>
43
+ * ```
39
44
  *
40
- * <svelte:head>
41
- * {@html styles}
42
- * </svelte:head>
45
+ * ```ts
46
+ * // hooks.server.ts
47
+ * export { handle } from "@kiiimatz/fontrum/hooks";
43
48
  * ```
44
49
  */
45
- declare function fontrum(fonts: FontConfig[]): string;
50
+ declare function fontrum(fonts: FontConfig[]): void;
46
51
 
47
52
  // @ts-ignore
48
53
  export = fontrum;
49
- export { type FontConfig, type FontDisplay, fontrum };
54
+ export { type FontConfig, type FontDisplay, fontrum, getCSS };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  type FontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
2
2
  interface FontConfig {
3
- /** CSS class name to apply this font (e.g. "inter") */
4
- class: string;
3
+ /**
4
+ * CSS class name to apply this font (e.g. "inter").
5
+ * Omit to apply the font globally to `body`.
6
+ */
7
+ class?: string;
5
8
  /**
6
9
  * Path(s) to the font file(s). Supports ttf, otf, woff, woff2, eot, svg.
7
10
  * Paths are relative to your public directory (e.g. "/fonts/inter.woff2").
@@ -14,34 +17,36 @@ interface FontConfig {
14
17
  style?: string;
15
18
  /**
16
19
  * Controls how the font is displayed while loading.
17
- * "swap" (default) shows fallback font immediately then swaps — best for
18
- * most use cases and avoids invisible text during load.
20
+ * "swap" (default) shows fallback font immediately then swaps.
19
21
  */
20
22
  display?: FontDisplay;
21
23
  /** Fallback font families appended after the custom font. Defaults to "sans-serif". */
22
24
  fallback?: string;
23
25
  }
26
+ /** @internal Used by hooks.server.ts */
27
+ declare function getCSS(): string;
24
28
  /**
25
- * Generate CSS for the given font configurations.
29
+ * Register fonts and inject styles automatically.
26
30
  *
27
- * Returns a `<style>` tag string ready to be injected via `{@html}` in a
28
- * `<svelte:head>` block. Works on both server (SSR/SSG) and client.
31
+ * - **SSR / SSG**: add the fontrum `handle` hook to `hooks.server.ts` once (see below).
32
+ * - **Browser**: injects a `<style>` tag into `document.head` automatically.
33
+ *
34
+ * Call once in your root `+layout.svelte` — no `{@html}` or `<svelte:head>` needed.
29
35
  *
30
36
  * @example
31
37
  * ```svelte
32
- * <script lang="ts">
33
- * import fontrum from "@kiiimatz/fontrum";
34
- * const styles = fontrum([
35
- * { class: "inter", font: "/fonts/inter.woff2" },
36
- * { class: "mono", font: ["/fonts/mono.woff2", "/fonts/mono.ttf"] },
37
- * ]);
38
+ * <!-- +layout.svelte -->
39
+ * <script>
40
+ * import { fontrum } from "@kiiimatz/fontrum";
41
+ * fontrum([{ class: "inter", font: "/fonts/inter.woff2" }]);
38
42
  * </script>
43
+ * ```
39
44
  *
40
- * <svelte:head>
41
- * {@html styles}
42
- * </svelte:head>
45
+ * ```ts
46
+ * // hooks.server.ts
47
+ * export { handle } from "@kiiimatz/fontrum/hooks";
43
48
  * ```
44
49
  */
45
- declare function fontrum(fonts: FontConfig[]): string;
50
+ declare function fontrum(fonts: FontConfig[]): void;
46
51
 
47
- export { type FontConfig, type FontDisplay, fontrum as default, fontrum };
52
+ export { type FontConfig, type FontDisplay, fontrum as default, fontrum, getCSS };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var c={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",eot:"embedded-opentype",svg:"svg",svgz:"svg"};function y(o){let n=o.split("?")[0].split(".").pop()?.toLowerCase()??"";return c[n]??n}function g(o){return o.map(n=>`url('${n}') format('${y(n)}')`).join(`,
2
- `)}function u(o){return `<style>${o.map(t=>{let s=t.class,r=Array.isArray(t.font)?t.font:[t.font],e=t.weight??"normal",i=t.style??"normal",a=t.display??"swap",l=t.fallback??"sans-serif",f=["@font-face{",`font-family:'${s}';`,`src:${g(r)};`,`font-weight:${e};`,`font-style:${i};`,`font-display:${a};`,"}"].join(""),p=`.${s}{font-family:'${s}',${l};}`;return `${f}${p}`}).join("")}</style>`}var $=u;export{$ as default,u as fontrum};//# sourceMappingURL=index.js.map
1
+ var u={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",eot:"embedded-opentype",svg:"svg",svgz:"svg"};function d(n){let t=n.split("?")[0].split(".").pop()?.toLowerCase()??"";return u[t]??t}function y(n){return n.map(t=>`url('${t}') format('${d(t)}')`).join(`,
2
+ `)}function m(n){return n.map((t,o)=>{let s=t.class??`fontrum-${o}`,r=Array.isArray(t.font)?t.font:[t.font],i=t.weight??"normal",l=t.style??"normal",a=t.display??"swap",f=t.fallback??"sans-serif",c=["@font-face{",`font-family:'${s}';`,`src:${y(r)};`,`font-weight:${i};`,`font-style:${l};`,`font-display:${a};`,"}"].join(""),p=`${t.class?`.${t.class}`:"body"}{font-family:'${s}',${f};}`;return `${c}${p}`}).join("")}var e="";function w(){return e}function g(n){if(e=m(n),typeof document<"u"){let t="fontrum",o=document.getElementById(t);o||(o=document.createElement("style"),o.id=t,document.head.appendChild(o)),o.textContent=e;}}var b=g;export{b as default,g as fontrum,w as getCSS};//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["FORMAT_MAP","getFormat","path","ext","buildSrc","fonts","f","fontrum","cfg","family","sources","weight","style","display","fallback","face","cls","index_default"],"mappings":"AAyBA,IAAMA,CAAAA,CAAqC,CACzC,KAAA,CAAO,OAAA,CACP,IAAA,CAAM,MAAA,CACN,GAAA,CAAK,UAAA,CACL,GAAA,CAAK,UAAA,CACL,GAAA,CAAK,mBAAA,CACL,GAAA,CAAK,KAAA,CACL,IAAA,CAAM,KACR,CAAA,CAEA,SAASC,CAAAA,CA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EAAA,EAAKK,CAAQ,CAAA,EAAA,CAAA,CAE1D,OAAO,GAAGC,CAAI,CAAA,EAAGC,CAAG,CAAA,CACtB,CAAC,EAEsB,IAAA,CAAK,EAAE,CAAC,CAAA,QAAA,CACjC,KAEOC,CAAAA,CAAQV","file":"index.js","sourcesContent":["export type FontDisplay = \"auto\" | \"block\" | \"swap\" | \"fallback\" | \"optional\";\n\nexport interface FontConfig {\n /** CSS class name to apply this font (e.g. \"inter\") */\n class: string;\n /**\n * Path(s) to the font file(s). Supports ttf, otf, woff, woff2, eot, svg.\n * Paths are relative to your public directory (e.g. \"/fonts/inter.woff2\").\n * Pass an array to provide multiple sources for the same font.\n */\n font: string | string[];\n /** Font weight. Defaults to \"normal\". */\n weight?: string | number;\n /** Font style. Defaults to \"normal\". */\n style?: string;\n /**\n * Controls how the font is displayed while loading.\n * \"swap\" (default) shows fallback font immediately then swaps — best for\n * most use cases and avoids invisible text during load.\n */\n display?: FontDisplay;\n /** Fallback font families appended after the custom font. Defaults to \"sans-serif\". */\n fallback?: string;\n}\n\nconst FORMAT_MAP: Record<string, string> = {\n woff2: \"woff2\",\n woff: \"woff\",\n ttf: \"truetype\",\n otf: \"opentype\",\n eot: \"embedded-opentype\",\n svg: \"svg\",\n svgz: \"svg\",\n};\n\nfunction getFormat(path: string): string {\n const ext = path.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? \"\";\n return FORMAT_MAP[ext] ?? ext;\n}\n\nfunction buildSrc(fonts: string[]): string {\n return fonts\n .map((f) => `url('${f}') format('${getFormat(f)}')`)\n .join(\",\\n \");\n}\n\n/**\n * Generate CSS for the given font configurations.\n *\n * Returns a `<style>` tag string ready to be injected via `{@html}` in a\n * `<svelte:head>` block. Works on both server (SSR/SSG) and client.\n *\n * @example\n * ```svelte\n * <script lang=\"ts\">\n * import fontrum from \"@kiiimatz/fontrum\";\n * const styles = fontrum([\n * { class: \"inter\", font: \"/fonts/inter.woff2\" },\n * { class: \"mono\", font: [\"/fonts/mono.woff2\", \"/fonts/mono.ttf\"] },\n * ]);\n * </script>\n *\n * <svelte:head>\n * {@html styles}\n * </svelte:head>\n * ```\n */\nexport function fontrum(fonts: FontConfig[]): string {\n const rules = fonts.map((cfg) => {\n const family = cfg.class;\n const sources = Array.isArray(cfg.font) ? cfg.font : [cfg.font];\n const weight = cfg.weight ?? \"normal\";\n const style = cfg.style ?? \"normal\";\n const display = cfg.display ?? \"swap\";\n const fallback = cfg.fallback ?? \"sans-serif\";\n\n const face = [\n `@font-face{`,\n `font-family:'${family}';`,\n `src:${buildSrc(sources)};`,\n `font-weight:${weight};`,\n `font-style:${style};`,\n `font-display:${display};`,\n `}`,\n ].join(\"\");\n\n const cls = `.${family}{font-family:'${family}',${fallback};}`;\n\n return `${face}${cls}`;\n });\n\n return `<style>${rules.join(\"\")}</style>`;\n}\n\nexport default fontrum;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["FORMAT_MAP","getFormat","path","ext","buildSrc","fonts","f","buildCSS","cfg","i","family","sources","weight","style","display","fallback","face","rule","_css","getCSS","fontrum","id","el","index_default"],"mappings":"AA2BA,IAAMA,CAAAA,CAAqC,CACzC,KAAA,CAAO,OAAA,CACP,IAAA,CAAM,MAAA,CACN,GAAA,CAAK,UAAA,CACL,GAAA,CAAK,UAAA,CACL,GAAA,CAAK,mBAAA,CACL,GAAA,CAAK,KAAA,CACL,IAAA,CAAM,KACR,CAAA,CAEA,SAASC,CAAAA,CAAUC,CAAAA,CAAsB,CACvC,IAAMC,CAAAA,CAAMD,CAAAA,CAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,CAAE,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,EAAI,EAAG,WAAA,EAAY,EAAK,EAAA,CAClE,OAAOF,CAAAA,CAAWG,CAAG,CAAA,EAAKA,CAC5B,CAEA,SAASC,CAAAA,CAASC,CAAAA,CAAyB,CACzC,OAAOA,CAAAA,CACJ,GAAA,CAAKC,CAAAA,EAAM,CAA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AA,CAAK,EAAE,CACZ,CAGA,IAAIC,CAAAA,CAAO,EAAA,CAGJ,SAASC,CAAAA,EAAiB,CAC/B,OAAOD,CACT,CAwBO,SAASE,EAAQf,CAAAA,CAA2B,CAGjD,GAFAa,CAAAA,CAAOX,CAAAA,CAASF,CAAK,CAAA,CAEjB,OAAO,SAAa,GAAA,CAAa,CACnC,IAAMgB,CAAAA,CAAK,UACPC,CAAAA,CAAK,QAAA,CAAS,cAAA,CAAeD,CAAE,EAC9BC,CAAAA,GACHA,CAAAA,CAAK,QAAA,CAAS,aAAA,CAAc,OAAO,CAAA,CACnCA,CAAAA,CAAG,EAAA,CAAKD,CAAAA,CACR,SAAS,IAAA,CAAK,WAAA,CAAYC,CAAE,CAAA,CAAA,CAE9BA,EAAG,WAAA,CAAcJ,EACnB,CACF,KAEOK,CAAAA,CAAQH","file":"index.js","sourcesContent":["export type FontDisplay = \"auto\" | \"block\" | \"swap\" | \"fallback\" | \"optional\";\n\nexport interface FontConfig {\n /**\n * CSS class name to apply this font (e.g. \"inter\").\n * Omit to apply the font globally to `body`.\n */\n class?: string;\n /**\n * Path(s) to the font file(s). Supports ttf, otf, woff, woff2, eot, svg.\n * Paths are relative to your public directory (e.g. \"/fonts/inter.woff2\").\n * Pass an array to provide multiple sources for the same font.\n */\n font: string | string[];\n /** Font weight. Defaults to \"normal\". */\n weight?: string | number;\n /** Font style. Defaults to \"normal\". */\n style?: string;\n /**\n * Controls how the font is displayed while loading.\n * \"swap\" (default) shows fallback font immediately then swaps.\n */\n display?: FontDisplay;\n /** Fallback font families appended after the custom font. Defaults to \"sans-serif\". */\n fallback?: string;\n}\n\nconst FORMAT_MAP: Record<string, string> = {\n woff2: \"woff2\",\n woff: \"woff\",\n ttf: \"truetype\",\n otf: \"opentype\",\n eot: \"embedded-opentype\",\n svg: \"svg\",\n svgz: \"svg\",\n};\n\nfunction getFormat(path: string): string {\n const ext = path.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? \"\";\n return FORMAT_MAP[ext] ?? ext;\n}\n\nfunction buildSrc(fonts: string[]): string {\n return fonts\n .map((f) => `url('${f}') format('${getFormat(f)}')`)\n .join(\",\\n \");\n}\n\nfunction buildCSS(fonts: FontConfig[]): string {\n return fonts\n .map((cfg, i) => {\n const family = cfg.class ?? `fontrum-${i}`;\n const sources = Array.isArray(cfg.font) ? cfg.font : [cfg.font];\n const weight = cfg.weight ?? \"normal\";\n const style = cfg.style ?? \"normal\";\n const display = cfg.display ?? \"swap\";\n const fallback = cfg.fallback ?? \"sans-serif\";\n\n const face = [\n `@font-face{`,\n `font-family:'${family}';`,\n `src:${buildSrc(sources)};`,\n `font-weight:${weight};`,\n `font-style:${style};`,\n `font-display:${display};`,\n `}`,\n ].join(\"\");\n\n const selector = cfg.class ? `.${cfg.class}` : \"body\";\n const rule = `${selector}{font-family:'${family}',${fallback};}`;\n\n return `${face}${rule}`;\n })\n .join(\"\");\n}\n\n// Module-level CSS store (font configs are static, same for all requests)\nlet _css = \"\";\n\n/** @internal Used by hooks.server.ts */\nexport function getCSS(): string {\n return _css;\n}\n\n/**\n * Register fonts and inject styles automatically.\n *\n * - **SSR / SSG**: add the fontrum `handle` hook to `hooks.server.ts` once (see below).\n * - **Browser**: injects a `<style>` tag into `document.head` automatically.\n *\n * Call once in your root `+layout.svelte` — no `{@html}` or `<svelte:head>` needed.\n *\n * @example\n * ```svelte\n * <!-- +layout.svelte -->\n * <script>\n * import { fontrum } from \"@kiiimatz/fontrum\";\n * fontrum([{ class: \"inter\", font: \"/fonts/inter.woff2\" }]);\n * </script>\n * ```\n *\n * ```ts\n * // hooks.server.ts\n * export { handle } from \"@kiiimatz/fontrum/hooks\";\n * ```\n */\nexport function fontrum(fonts: FontConfig[]): void {\n _css = buildCSS(fonts);\n\n if (typeof document !== \"undefined\") {\n const id = \"fontrum\";\n let el = document.getElementById(id) as HTMLStyleElement | null;\n if (!el) {\n el = document.createElement(\"style\");\n el.id = id;\n document.head.appendChild(el);\n }\n el.textContent = _css;\n }\n}\n\nexport default fontrum;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiiimatz/fontrum",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Lightweight font management library for SvelteKit and beyond",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -16,6 +16,16 @@
16
16
  "types": "./dist/index.d.cts",
17
17
  "default": "./dist/index.cjs"
18
18
  }
19
+ },
20
+ "./hooks": {
21
+ "import": {
22
+ "types": "./dist/hooks.server.d.ts",
23
+ "default": "./dist/hooks.server.mjs"
24
+ },
25
+ "require": {
26
+ "types": "./dist/hooks.server.d.cts",
27
+ "default": "./dist/hooks.server.cjs"
28
+ }
19
29
  }
20
30
  },
21
31
  "files": [