@razorwind/core 0.0.46 → 0.0.48

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.
Files changed (84) hide show
  1. package/dist/{config-25eDAKIq.d.cts → config-BtscEr7S.d.cts} +17 -5
  2. package/dist/config-BtscEr7S.d.cts.map +1 -0
  3. package/dist/{config-rgbP9zhp.d.mts → config-CNTGHrST.d.mts} +16 -4
  4. package/dist/config-CNTGHrST.d.mts.map +1 -0
  5. package/dist/flatten-tokens-CMlVe_J6.d.cts +54 -0
  6. package/dist/flatten-tokens-CMlVe_J6.d.cts.map +1 -0
  7. package/dist/flatten-tokens-DgTPHEhI.d.mts +54 -0
  8. package/dist/flatten-tokens-DgTPHEhI.d.mts.map +1 -0
  9. package/dist/fonts-B0ESWBBC.mjs +2 -0
  10. package/dist/fonts-B0ESWBBC.mjs.map +1 -0
  11. package/dist/fonts-BiuIJVev.mjs +10 -0
  12. package/dist/fonts-BiuIJVev.mjs.map +1 -0
  13. package/dist/fonts-CkBPEFie.cjs +9 -0
  14. package/dist/fonts-vhz5FAsy.cjs +1 -0
  15. package/dist/{index-D1ayVOTE.d.mts → index-B7MsziQp.d.cts} +4 -4
  16. package/dist/{index-Dk-i27fI.d.cts.map → index-B7MsziQp.d.cts.map} +1 -1
  17. package/dist/{index-BjSOzDOH.d.cts → index-CwN0c1Q4.d.cts} +1 -1
  18. package/dist/index-CzbZzpnz.d.mts +100 -0
  19. package/dist/index-CzbZzpnz.d.mts.map +1 -0
  20. package/dist/{index-Dk-i27fI.d.cts → index-CzjDptav.d.mts} +5 -5
  21. package/dist/{index-D1ayVOTE.d.mts.map → index-CzjDptav.d.mts.map} +1 -1
  22. package/dist/{index-DM8vit-J.d.mts → index-D5L2WXYk.d.mts} +1 -1
  23. package/dist/index-Di7vqmsi.d.cts +100 -0
  24. package/dist/index-Di7vqmsi.d.cts.map +1 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +82 -15
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +82 -15
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +1 -1
  31. package/dist/lib/fonts/index.cjs +1 -0
  32. package/dist/lib/fonts/index.d.cts +2 -0
  33. package/dist/lib/fonts/index.d.mts +2 -0
  34. package/dist/lib/fonts/index.mjs +1 -0
  35. package/dist/lib/tokens/index.cjs +1 -1
  36. package/dist/lib/tokens/index.d.cts +1 -1
  37. package/dist/lib/tokens/index.d.mts +1 -1
  38. package/dist/lib/tokens/index.mjs +1 -1
  39. package/dist/{plugin-CAoFfyMa.d.mts → plugin-0UYp_yIy.d.cts} +2 -2
  40. package/dist/{plugin-m5Bm4WrK.d.cts.map → plugin-0UYp_yIy.d.cts.map} +1 -1
  41. package/dist/{plugin-m5Bm4WrK.d.cts → plugin-CH6vFnxu.d.mts} +2 -2
  42. package/dist/plugin-CH6vFnxu.d.mts.map +1 -0
  43. package/dist/plugin.d.cts +2 -2
  44. package/dist/plugin.d.mts +2 -2
  45. package/dist/schema/index.cjs +1 -1
  46. package/dist/schema/index.d.cts +3 -3
  47. package/dist/schema/index.d.mts +3 -3
  48. package/dist/schema/index.mjs +1 -1
  49. package/dist/schema-BCofDJWf.cjs +1 -0
  50. package/dist/schema-BwOBgJIM.d.cts +545 -0
  51. package/dist/schema-BwOBgJIM.d.cts.map +1 -0
  52. package/dist/schema-BwOBgJIM.d.mts +545 -0
  53. package/dist/schema-BwOBgJIM.d.mts.map +1 -0
  54. package/dist/schema-CXK5pVmJ.mjs +2 -0
  55. package/dist/schema-CXK5pVmJ.mjs.map +1 -0
  56. package/dist/tokens-By75va9Y.cjs +7 -0
  57. package/dist/tokens-DFYNBFFR.mjs +8 -0
  58. package/dist/tokens-DFYNBFFR.mjs.map +1 -0
  59. package/dist/utils/index.cjs +1 -1
  60. package/dist/utils/index.d.cts +78 -92
  61. package/dist/utils/index.d.cts.map +1 -1
  62. package/dist/utils/index.d.mts +78 -92
  63. package/dist/utils/index.d.mts.map +1 -1
  64. package/dist/utils/index.mjs +1 -1
  65. package/dist/utils-CDYdsyyW.mjs +2 -0
  66. package/dist/utils-CDYdsyyW.mjs.map +1 -0
  67. package/dist/utils-DyK4l_bT.cjs +1 -0
  68. package/package.json +16 -2
  69. package/dist/config-25eDAKIq.d.cts.map +0 -1
  70. package/dist/config-rgbP9zhp.d.mts.map +0 -1
  71. package/dist/plugin-CAoFfyMa.d.mts.map +0 -1
  72. package/dist/schema-93daQRSN.cjs +0 -1
  73. package/dist/schema-CsbyELyn.d.cts +0 -263
  74. package/dist/schema-CsbyELyn.d.cts.map +0 -1
  75. package/dist/schema-CsbyELyn.d.mts +0 -263
  76. package/dist/schema-CsbyELyn.d.mts.map +0 -1
  77. package/dist/schema-buR6a6IP.mjs +0 -2
  78. package/dist/schema-buR6a6IP.mjs.map +0 -1
  79. package/dist/tokens-CFh9AQab.mjs +0 -2
  80. package/dist/tokens-CFh9AQab.mjs.map +0 -1
  81. package/dist/tokens-pHmukPOW.cjs +0 -1
  82. package/dist/utils-B5uabOd5.mjs +0 -2
  83. package/dist/utils-B5uabOd5.mjs.map +0 -1
  84. package/dist/utils-BiL8zQzg.cjs +0 -1
@@ -1,9 +1,9 @@
1
- import { a as Icons, f as Components, t as Schema } from "./schema-CsbyELyn.cjs";
1
+ import { O as Components, a as Icons, m as Fonts, t as Schema } from "./schema-BwOBgJIM.cjs";
2
2
  import { PreprocessedTokens } from "style-dictionary";
3
+ import { GeneratedDocument } from "@power-plant/core";
3
4
  import { Tokens } from "@power-plant/dtcg-schema";
4
5
  import { EnvPaths } from "@stryke/env/get-env-paths";
5
6
  import { MaybePromise, RequiredKeys } from "@stryke/types/base";
6
- import { GeneratedDocument } from "@power-plant/core";
7
7
  import { DesignTokens } from "style-dictionary/types";
8
8
  //#region src/types/plugin.d.ts
9
9
  /**
@@ -113,6 +113,12 @@ interface Options {
113
113
  * @defaultValue "assets/icons"
114
114
  */
115
115
  iconsPath?: string | string[];
116
+ /**
117
+ * The path(s) to directories containing font files or font directories.
118
+ *
119
+ * @defaultValue "assets/fonts"
120
+ */
121
+ fontsPath?: string | string[];
116
122
  /**
117
123
  * Token source path(s): file, directory, Style Dictionary config, or glob.
118
124
  *
@@ -173,7 +179,7 @@ interface Options {
173
179
  *
174
180
  * The basename is optionally followed by a suffix separated by `.`, `_`, or `-` (for example `light.json`, `dark-mode.tokens.json`, `theme.custom.yaml`).
175
181
  *
176
- * Files that match are grouped under that theme key. Non-theme files are merged into a shared `base` entry when at least two distinct themes are detected. If fewer than two themes are found, all sources are merged into a single {@link Tokens} object instead of a record.
182
+ * Files that match are grouped under that theme key. Non-theme files are merged into a shared `base` entry when at least two distinct themes are detected, and are also included when resolving each theme so references into shared primitives succeed. If fewer than two themes are found, all sources are merged into a single {@link Tokens} object instead of a record.
177
183
  *
178
184
  * When `false`, every source file is merged into one flat {@link Tokens} object regardless of filename.
179
185
  *
@@ -198,6 +204,7 @@ interface UserConfig extends Options {
198
204
  tokens?: Tokens | Record<string, Tokens>;
199
205
  components?: Components;
200
206
  icons?: Icons;
207
+ fonts?: Fonts;
201
208
  plugins?: Plugin[];
202
209
  }
203
210
  interface UserConfigParams {
@@ -207,8 +214,13 @@ interface UserConfigParams {
207
214
  type UserConfigFnObject = (config: UserConfig) => UserConfig;
208
215
  type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
209
216
  type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
217
+ /**
218
+ * Config file export. An array of {@link UserConfig} objects is treated as
219
+ * independent generation runs (load tokens, extract, validate, generate
220
+ * for each item).
221
+ */
210
222
  type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
211
- type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "plugins"> & {
223
+ type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "fontsPath" | "plugins"> & {
212
224
  cwd: string;
213
225
  envPaths: EnvPaths & {
214
226
  home: string;
@@ -216,4 +228,4 @@ type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "plugins
216
228
  };
217
229
  //#endregion
218
230
  export { UserConfigFn as a, UserConfigParams as c, TokensPreprocessor as d, UserConfigExport as i, Plugin as l, Options as n, UserConfigFnObject as o, UserConfig as r, UserConfigFnPromise as s, Config as t, TokensParser as u };
219
- //# sourceMappingURL=config-25eDAKIq.d.cts.map
231
+ //# sourceMappingURL=config-BtscEr7S.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-BtscEr7S.d.cts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts"],"mappings":";;;;;;;;;;;;;;;UAgCiB;EACf;EACA,SAAS;EACT,SAAS,qBAAqB;;;;;;;;;KAUpB;EAEN;EACA,eAAe,YAAY,uBAAuB;MAElD,YAAY,uBAAuB;;;;;;;;;UAUxB;;;;;;;EAOf;;;;;;EAOA,UAAU;;;;;;EAOV,gBAAgB;;;;;;;;EAShB,WAAW,MAAM,QAAQ,QAAQ,WAAW,aAAa;;;;;;;;EASzD,YACE,MAAM,QACN,QAAQ,WACL,aAAa,eAAe;;;;;;;;EASjC,YAAY,MAAM,QAAQ,QAAQ,WAAW;;;;UCrF9B;;;;;;;;;;;;;;;;;;EAkBf;;;;EAKA;;;;;;EAOA;;;;;;EAOA;;;;;;;;;;;EAYA;;;;;;EAOA;;;;;;;;;;;;EAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCA;;UAGe,mBAAmB;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA,SAAS,SAAS,eAAe;EACjC,aAAa;EACb,QAAQ;EACR,QAAQ;EACR,UAAU;;UAGK;EACf;EACA;;KAGU,sBAAsB,QAAQ,eAAe;KAC7C,uBACV,QAAQ,qBACL,QAAQ,aAAa;KACd,gBACV,QAAQ,qBACL,aAAa,eAAe,QAAQ,aAAa;;;;;;KAM1C,mBACR,aACA,eACA,QAAQ,aAAa,gBACrB,qBACA,sBACA;KAEQ,SAAS,aACnB;EAGA;EACA,UAAU;IACR"}
@@ -1,4 +1,4 @@
1
- import { a as Icons, f as Components, t as Schema } from "./schema-CsbyELyn.mjs";
1
+ import { O as Components, a as Icons, m as Fonts, t as Schema } from "./schema-BwOBgJIM.mjs";
2
2
  import { GeneratedDocument } from "@power-plant/core";
3
3
  import { EnvPaths } from "@stryke/env/get-env-paths";
4
4
  import { PreprocessedTokens } from "style-dictionary";
@@ -113,6 +113,12 @@ interface Options {
113
113
  * @defaultValue "assets/icons"
114
114
  */
115
115
  iconsPath?: string | string[];
116
+ /**
117
+ * The path(s) to directories containing font files or font directories.
118
+ *
119
+ * @defaultValue "assets/fonts"
120
+ */
121
+ fontsPath?: string | string[];
116
122
  /**
117
123
  * Token source path(s): file, directory, Style Dictionary config, or glob.
118
124
  *
@@ -173,7 +179,7 @@ interface Options {
173
179
  *
174
180
  * The basename is optionally followed by a suffix separated by `.`, `_`, or `-` (for example `light.json`, `dark-mode.tokens.json`, `theme.custom.yaml`).
175
181
  *
176
- * Files that match are grouped under that theme key. Non-theme files are merged into a shared `base` entry when at least two distinct themes are detected. If fewer than two themes are found, all sources are merged into a single {@link Tokens} object instead of a record.
182
+ * Files that match are grouped under that theme key. Non-theme files are merged into a shared `base` entry when at least two distinct themes are detected, and are also included when resolving each theme so references into shared primitives succeed. If fewer than two themes are found, all sources are merged into a single {@link Tokens} object instead of a record.
177
183
  *
178
184
  * When `false`, every source file is merged into one flat {@link Tokens} object regardless of filename.
179
185
  *
@@ -198,6 +204,7 @@ interface UserConfig extends Options {
198
204
  tokens?: Tokens | Record<string, Tokens>;
199
205
  components?: Components;
200
206
  icons?: Icons;
207
+ fonts?: Fonts;
201
208
  plugins?: Plugin[];
202
209
  }
203
210
  interface UserConfigParams {
@@ -207,8 +214,13 @@ interface UserConfigParams {
207
214
  type UserConfigFnObject = (config: UserConfig) => UserConfig;
208
215
  type UserConfigFnPromise = (params: UserConfigParams) => Promise<UserConfig | UserConfig[]>;
209
216
  type UserConfigFn = (params: UserConfigParams) => UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]>;
217
+ /**
218
+ * Config file export. An array of {@link UserConfig} objects is treated as
219
+ * independent generation runs (load tokens, extract, validate, generate
220
+ * for each item).
221
+ */
210
222
  type UserConfigExport = UserConfig | UserConfig[] | Promise<UserConfig | UserConfig[]> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
211
- type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "plugins"> & {
223
+ type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "fontsPath" | "plugins"> & {
212
224
  cwd: string;
213
225
  envPaths: EnvPaths & {
214
226
  home: string;
@@ -216,4 +228,4 @@ type Config = RequiredKeys<UserConfig, "componentsPath" | "iconsPath" | "plugins
216
228
  };
217
229
  //#endregion
218
230
  export { UserConfigFn as a, UserConfigParams as c, TokensPreprocessor as d, UserConfigExport as i, Plugin as l, Options as n, UserConfigFnObject as o, UserConfig as r, UserConfigFnPromise as s, Config as t, TokensParser as u };
219
- //# sourceMappingURL=config-rgbP9zhp.d.mts.map
231
+ //# sourceMappingURL=config-CNTGHrST.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CNTGHrST.d.mts","names":[],"sources":["../src/types/plugin.ts","../src/types/config.ts"],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import { n as Tokens } from "./index-CwN0c1Q4.cjs";
2
+ //#region src/utils/flatten-tokens.d.ts
3
+ /**
4
+ * A flattened design token row produced by {@link flattenTokens}.
5
+ */
6
+ interface BaseFlatToken {
7
+ /** Dot-separated token path (e.g. `color.primary`). */
8
+ path: string;
9
+ /** DTCG `$type`, when known. */
10
+ type?: string;
11
+ /** Raw `$value` from the token document. */
12
+ value: unknown;
13
+ /** CSS-friendly string form of {@link value}. */
14
+ cssValue: string;
15
+ /** Optional DTCG `$description`. */
16
+ description?: string;
17
+ /** Theme / set id when tokens are a `Record<string, Tokens>`. */
18
+ theme?: string;
19
+ }
20
+ interface TokenSet {
21
+ id: string;
22
+ tokens: Tokens;
23
+ }
24
+ /**
25
+ * Theme-like keys for splitting multi-theme token records.
26
+ *
27
+ * Extends core {@link ../lib/tokens/constants#THEME_BASENAME_PATTERN} with
28
+ * camelCase suffixes from `@razorwind/color-variants` (e.g. `darkHighContrast`).
29
+ */
30
+ declare const TOKEN_SET_THEME_PATTERN: RegExp;
31
+ /**
32
+ * True when `node` is a DTCG token leaf rather than a nested group.
33
+ */
34
+ declare function isTokenLeaf(node: Record<string, unknown>): boolean;
35
+ /**
36
+ * Split `Schema.tokens` into one or more named token sets.
37
+ *
38
+ * A record whose keys all look like themes (`light`, `dark`, …) is treated as
39
+ * multi-theme input; otherwise the whole document is a single set.
40
+ */
41
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
42
+ interface FlattenTokensOptions<T extends BaseFlatToken = BaseFlatToken> {
43
+ /** When set, only tokens whose `$type` is listed are returned. */
44
+ includeTypes?: readonly string[];
45
+ /** Map each base row before it is appended (e.g. add `cssVar`). */
46
+ enrichToken?: (token: BaseFlatToken) => T;
47
+ }
48
+ /**
49
+ * Flatten DTCG token trees into rows for theme mapping or documentation.
50
+ */
51
+ declare function flattenTokens<T extends BaseFlatToken = BaseFlatToken>(tokens: Tokens | Record<string, Tokens>, options?: FlattenTokensOptions<T>): T[];
52
+ //#endregion
53
+ export { flattenTokens as a, TokenSet as i, FlattenTokensOptions as n, isTokenLeaf as o, TOKEN_SET_THEME_PATTERN as r, resolveTokenSets as s, BaseFlatToken as t };
54
+ //# sourceMappingURL=flatten-tokens-CMlVe_J6.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flatten-tokens-CMlVe_J6.d.cts","names":[],"sources":["../src/utils/flatten-tokens.ts"],"mappings":";;;;;UA6BiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;EACf;EACA,QAAQ;;;;;;;;cASG,yBAAuB;;;;iBAMpB,YAAY,MAAM;;;;;;;iBAqFlB,iBACd,QAAQ,SAAS,eAAe,UAC/B;UAqBc,qBAAqB,UAAU,gBAAgB;;EAE9D;;EAEA,eAAe,OAAO,kBAAkB;;;;;iBAM1B,cAAc,UAAU,gBAAgB,eACtD,QAAQ,SAAS,eAAe,SAChC,UAAS,qBAAqB,KAC7B"}
@@ -0,0 +1,54 @@
1
+ import { n as Tokens } from "./index-D5L2WXYk.mjs";
2
+ //#region src/utils/flatten-tokens.d.ts
3
+ /**
4
+ * A flattened design token row produced by {@link flattenTokens}.
5
+ */
6
+ interface BaseFlatToken {
7
+ /** Dot-separated token path (e.g. `color.primary`). */
8
+ path: string;
9
+ /** DTCG `$type`, when known. */
10
+ type?: string;
11
+ /** Raw `$value` from the token document. */
12
+ value: unknown;
13
+ /** CSS-friendly string form of {@link value}. */
14
+ cssValue: string;
15
+ /** Optional DTCG `$description`. */
16
+ description?: string;
17
+ /** Theme / set id when tokens are a `Record<string, Tokens>`. */
18
+ theme?: string;
19
+ }
20
+ interface TokenSet {
21
+ id: string;
22
+ tokens: Tokens;
23
+ }
24
+ /**
25
+ * Theme-like keys for splitting multi-theme token records.
26
+ *
27
+ * Extends core {@link ../lib/tokens/constants#THEME_BASENAME_PATTERN} with
28
+ * camelCase suffixes from `@razorwind/color-variants` (e.g. `darkHighContrast`).
29
+ */
30
+ declare const TOKEN_SET_THEME_PATTERN: RegExp;
31
+ /**
32
+ * True when `node` is a DTCG token leaf rather than a nested group.
33
+ */
34
+ declare function isTokenLeaf(node: Record<string, unknown>): boolean;
35
+ /**
36
+ * Split `Schema.tokens` into one or more named token sets.
37
+ *
38
+ * A record whose keys all look like themes (`light`, `dark`, …) is treated as
39
+ * multi-theme input; otherwise the whole document is a single set.
40
+ */
41
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
42
+ interface FlattenTokensOptions<T extends BaseFlatToken = BaseFlatToken> {
43
+ /** When set, only tokens whose `$type` is listed are returned. */
44
+ includeTypes?: readonly string[];
45
+ /** Map each base row before it is appended (e.g. add `cssVar`). */
46
+ enrichToken?: (token: BaseFlatToken) => T;
47
+ }
48
+ /**
49
+ * Flatten DTCG token trees into rows for theme mapping or documentation.
50
+ */
51
+ declare function flattenTokens<T extends BaseFlatToken = BaseFlatToken>(tokens: Tokens | Record<string, Tokens>, options?: FlattenTokensOptions<T>): T[];
52
+ //#endregion
53
+ export { flattenTokens as a, TokenSet as i, FlattenTokensOptions as n, isTokenLeaf as o, TOKEN_SET_THEME_PATTERN as r, resolveTokenSets as s, BaseFlatToken as t };
54
+ //# sourceMappingURL=flatten-tokens-DgTPHEhI.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flatten-tokens-DgTPHEhI.d.mts","names":[],"sources":["../src/utils/flatten-tokens.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{z as e}from"zod";const t=e.enum([`sans`,`serif`,`mono`,`display`,`heading`,`body`,`code`]),n=e.enum([`auto`,`block`,`swap`,`fallback`,`optional`]),r=e.enum([`woff2`,`woff`,`truetype`,`opentype`,`svg`]),i=e.object({path:e.string(),format:r.optional(),weight:e.union([e.number(),e.string()]).optional(),style:e.enum([`normal`,`italic`,`oblique`]).optional(),unicodeRange:e.string().optional()}),a=e.object({name:e.string(),title:e.string(),family:e.string().optional().describe(`CSS font-family name. Defaults to title or name.`),role:t.optional(),fallbacks:e.array(e.string()).optional(),display:n.optional(),category:e.string().optional(),description:e.string().optional(),tags:e.array(e.string()).optional()}),o=a.extend({source:e.literal(`google`),weights:e.array(e.union([e.number(),e.string()])).optional(),styles:e.array(e.enum([`normal`,`italic`])).optional(),subsets:e.array(e.string()).optional(),variable:e.boolean().optional()}),s=a.extend({source:e.literal(`local`),files:e.array(i).min(1)}),c=e.discriminatedUnion(`source`,[o,s]),l=e.record(e.string(),c);export{c as a,s as c,t as i,r as n,l as o,i as r,o as s,n as t};
2
+ //# sourceMappingURL=fonts-B0ESWBBC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts-B0ESWBBC.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import{a as e,c as t,r as n,s as r}from"./fonts-B0ESWBBC.mjs";import{createDefu as i}from"defu";import{basename as a,isAbsolute as o,join as s,resolve as c}from"node:path";import{titleCase as l}from"@stryke/string-format/title-case";import{existsSync as u}from"@stryke/fs/exists";import{isDirectory as d}from"@stryke/fs/is-file";import{readJsonFile as f}from"@stryke/fs/json";import{appendPath as p}from"@stryke/path/append";import{findFileExtensionSafe as m,findFileName as h,findFolderName as ee}from"@stryke/path/file-path-fns";import{joinPaths as g}from"@stryke/path/join";import{isSetObject as _}from"@stryke/type-checks/is-set-object";import{isSetString as v}from"@stryke/type-checks/is-set-string";import{copyFile as y,mkdir as b,readdir as x}from"node:fs/promises";const S=new Set([`woff2`,`woff`,`ttf`,`otf`,`otc`,`svg`]),C={woff2:`woff2`,woff:`woff`,ttf:`truetype`,otf:`opentype`,otc:`opentype`,svg:`svg`},w={thin:100,hairline:100,extralight:200,ultralight:200,light:300,regular:400,normal:400,book:400,roman:400,medium:500,semibold:600,demibold:600,bold:700,extrabold:800,ultrabold:800,black:900,heavy:900},T={sans:`sans-serif`,serif:`serif`,mono:`monospace`,display:`sans-serif`,heading:`sans-serif`,body:`sans-serif`,code:`monospace`},te=[`sans`,`body`,`heading`,`display`],ne=[`mono`,`code`];async function E(e,t){if(!e)return[];let n=[];for(let r of Object.values(e))if(r.source===`local`){await b(t,{recursive:!0});for(let e of r.files){if(!e.path||!u(e.path))continue;let r=s(t,a(e.path));await y(e.path,r),n.push(r)}}return n}function D(e){let t=e.trim();return!t||/^[a-z-]+$/i.test(t)&&!/\s/.test(t)?t:`"${t.replaceAll(`"`,`\\"`)}"`}function O(e){return e.family?.trim()||e.title?.trim()||e.name}function k(e){let t=[D(O(e))];for(let n of e.fallbacks??[]){let e=D(n);e&&!t.includes(e)&&t.push(e)}if(e.role){let n=T[e.role];n&&!t.includes(n)&&t.push(n)}return t.filter(Boolean).join(`, `)}function A(e){let t=O(e).replaceAll(` `,`+`),n=e.display??`swap`,r=(e.weights??[]).map(String),i=(e.styles??[`normal`]).includes(`italic`),a=t;if(e.variable){let e=r.length===2?`${r[0]}..${r[1]}`:`100..900`;a=i?`${t}:ital,wght@0,${e};1,${e}`:`${t}:wght@${e}`}else if(r.length>0){if(i){let e=[];for(let t of r)e.push(`0,${t}`);for(let t of r)e.push(`1,${t}`);a=`${t}:ital,wght@${e.join(`;`)}`}else a=`${t}:wght@${r.join(`;`)}`}return`https://fonts.googleapis.com/css2?family=${a}&display=${n}`}function j(e){return e.format}function M(e,t){let n=a(e.path),r=`${t.endsWith(`/`)?t:`${t}/`}${n}`,i=j(e);return i?`url("${r}") format("${i}")`:`url("${r}")`}function re(e,t){let n=O(e),r=e.display??`swap`;return e.files.map(e=>{let i=[`@font-face {`,` font-family: ${D(n)};`,` src: ${M(e,t)};`];return e.weight!==void 0&&i.push(` font-weight: ${e.weight};`),e.style&&i.push(` font-style: ${e.style};`),e.unicodeRange&&i.push(` unicode-range: ${e.unicodeRange};`),i.push(` font-display: ${r};`,`}`),i.join(`
2
+ `)}).join(`
3
+
4
+ `)}function N(e){return Object.values(e).filter(e=>e.source===`google`).map(e=>`@import url("${A(e)}");`).join(`
5
+ `)}function P(e,t={}){let n=t.urlPrefix??`./fonts/`;return Object.values(e).filter(e=>e.source===`local`).map(e=>re(e,n)).join(`
6
+
7
+ `)}function F(e,t={}){return[N(e),P(e,t)].filter(Boolean).join(`
8
+
9
+ `)}function I(e,t,n={}){if(!t||Object.keys(t).length===0)return e;let r=F(t,n);return r?e?`${r}\n\n${e}`:`${r}\n`:e}const L=i((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function R(e,t){return o(t)?t:c(e,t)}function z(e){return Array.isArray(e)?e.filter(v):v(e)?[e]:[]}function B(e){let t=m(e)?.toLowerCase();return!!(t&&S.has(t))}function V(e){let t=m(e)?.toLowerCase();return t?C[t]:void 0}async function H(e){try{return(await x(e,{withFileTypes:!0})).filter(e=>e.isFile()&&B(e.name)).map(e=>e.name)}catch{return[]}}const U=Object.keys(w).sort((e,t)=>t.length-e.length);function W(e){let t=V(e),n=h(e,{withExtension:!1})??e,r,i=/(?:[-_ ](italic|oblique|it)|Italic|Oblique)$/.exec(n);i&&(r=(i[1]??i[0]).toLowerCase()===`oblique`?`oblique`:`italic`,n=n.slice(0,i.index));let a,o=/[-_ ]([^_-]+)$/.exec(n),s=(o?.[1]??n).toLowerCase().replaceAll(/[\s_]/g,``);for(let e of U)if(s===e||s.endsWith(e)){if(a=w[e],o)n=n.slice(0,o.index);else{let t=n.toLowerCase().lastIndexOf(e);n=t>0?n.slice(0,t):n}break}return{family:n.replaceAll(/[-_]+$/g,``).trim()||n,...a===void 0?{}:{weight:a},...r?{style:r}:{},...t?{format:t}:{}}}function G(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function K(e){if(!e)return;let t=n.safeParse(e);if(t.success)return[t.data];if(!Array.isArray(e))return;let r=[];for(let t of e){let e=n.safeParse(t);e.success&&r.push(e.data)}return r.length>0?r:void 0}function q(e,t){if(e.source===`google`||e.source===`local`)return e.source;if(t&&t.length>0)return`local`;if(`weights`in e||`subsets`in e||`variable`in e||`styles`in e||v(e.family)&&!t)return`google`}function J(n){if(!_(n))return;let i=`files`in n?K(n.files):void 0,a=q(n,i);if(!a){let t=e.safeParse(n);return t.success?t.data:void 0}let o={...n,source:a,...i?{files:i}:{}},s=a===`google`?r.partial().safeParse({...o,source:`google`}):t.partial().safeParse({...o,source:`local`});if(s.success)return Object.keys(s.data).length>0?s.data:void 0}function Y(e){return _(e)&&`path`in e}async function X(e){let t=g(e,`package.json`);if(!u(t))return;let n;try{n=await f(t)}catch{return}let r={};if(v(n.name)&&(r.name=n.name,r.title=n.name),v(n.description)&&(r.description=n.description),Array.isArray(n.keywords)){let e=n.keywords.filter(v);e.length>0&&(r.tags=e)}let i=n.razorwind,a;if(Y(i)||Array.isArray(i)){let e=K(i);e&&(a={source:`local`,files:e})}else _(i)&&(a=J(i));let o=L(a??{},r);return Object.keys(o).length>0?o:void 0}async function ie(e){let t=g(e,`font.json`);if(!u(t))return;let n;try{n=await f(t)}catch{return}if(Y(n)||Array.isArray(n)){let e=K(n);if(e)return{source:`local`,files:e}}return J(n)}function ae(e,t,n){return t?.length?t.map(t=>{let n=p(t.path,e);return{...t,path:n,format:t.format??V(t.path)}}):n.map(t=>{let n=W(t);return{path:p(t,e),format:n.format,...n.weight===void 0?{}:{weight:n.weight},...n.style?{style:n.style}:{}}})}async function oe(t){let n=await X(t),r=await ie(t),i=await H(t);if(!n&&!r&&i.length===0)return;let a=L(r??{},n??{}),o=ee(t),s=v(a.name)?a.name:o,c=v(a.title)?a.title:l(s),u=ae(t,a.source===`local`?a.files:void 0,i),d=(a.source??(u.length>0?`local`:`google`))===`google`?{...a,source:`google`,name:s,title:c,family:a.family??c}:{...a,source:`local`,name:s,title:c,family:a.family??c,files:u.length>0?u:a.source===`local`?a.files:u},f=e.safeParse(d);return f.success?f.data:void 0}function se(e,t,n){let r=G(t)||`font`,i=e[r];if(i?.source===`local`){let t=[...i.files],a=t.findIndex(e=>e.path===n.path);a>=0?t[a]=n:t.push(n),e[r]={...i,files:t};return}i||(e[r]={source:`local`,name:r,title:l(t),family:t,files:[n]})}async function ce(e){let t={},n=z(e.options.fontsPath);for(let r of n){let n=R(e.cwd,r);if(!(!u(n)||!d(n)))try{let e=await x(n,{withFileTypes:!0});for(let r of e){if(r.name.startsWith(`.`))continue;let e=g(n,r.name);if(r.isDirectory()){let n=await oe(e);if(n){let e=t[n.name];t[n.name]=e?L(n,e):n}continue}if(r.isFile()&&B(r.name)){let n=W(r.name);se(t,n.family,{path:e,format:n.format,...n.weight===void 0?{}:{weight:n.weight},...n.style?{style:n.style}:{}})}}}catch{continue}}return t}const le=/@font-face\s*\{([^{}]*)\}/gi,ue=/@import\s+(?:url\()?['"]?(https:\/\/fonts\.googleapis\.com\/css2?\?[^)'"\s]+)['"]?\)?\s*;/gi,de=/url\(\s*['"]?(https:\/\/fonts\.googleapis\.com\/css2?\?[^)'"\s]+)['"]?\s*\)/gi,fe=/font-family\s*:\s*([^;]+);/i,pe=/font-weight\s*:\s*([^;]+);/i,me=/font-style\s*:\s*(normal|italic|oblique)/i,he=/font-display\s*:\s*(auto|block|swap|fallback|optional)/i,ge=/unicode-range\s*:\s*([^;]+);/i,_e=/url\(\s*['"]?([^)'"]+)['"]?\s*\)(?:\s*format\(\s*['"]?([\w-]+)['"]?\s*\))?/i;function Z(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function ve(e){return e.trim().replaceAll(/^['"]|['"]$/g,``).trim()}function Q(e){if(!e)return;let t=e.trim(),n=Number.parseInt(t,10);return Number.isNaN(n)?t||void 0:n}function ye(e,t){if(e){let t=e.toLowerCase();if(t===`woff2`||t===`woff`||t===`truetype`||t===`opentype`||t===`svg`)return t}let n=t.split(`.`).pop()?.split(`?`)[0]?.toLowerCase();return n?C[n]:void 0}function be(e,t,n,r){let i=Z(t)||`font`,a=e[i];if(a?.source===`local`){let t=[...a.files],r=t.findIndex(e=>e.path===n.path);r>=0?t[r]=n:t.push(n),e[i]={...a,files:t};return}a||(e[i]={source:`local`,name:i,title:l(t),family:t,...r?{display:r}:{},files:[n]})}function $(e){let t;try{t=new URL(e)}catch{return[]}let n=t.searchParams.get(`display`),r=n===`auto`||n===`block`||n===`swap`||n===`fallback`||n===`optional`?n:void 0,i=t.searchParams.getAll(`family`),a=[];for(let e of i){let[t,n]=e.split(`:`),i=(t??``).replaceAll(`+`,` `).trim();if(!i)continue;let o=Z(i),s=[],c=new Set,u=!1;if(n){let[e,t]=n.split(`@`),r=(e??``).split(`,`),i=r.indexOf(`ital`),a=r.indexOf(`wght`),o=(t??``).split(`;`).filter(Boolean);for(let e of o){let t=e.split(`,`);i>=0&&t[i]===`1`?c.add(`italic`):c.add(`normal`);let n=a>=0?t[a]:t[0];if(n?.includes(`..`)){u=!0;let[e,t]=n.split(`..`);e&&s.push(e),t&&s.push(t)}else{let e=Q(n);e!==void 0&&!s.includes(e)&&s.push(e)}}}a.push({source:`google`,name:o||`font`,title:l(i),family:i,...r?{display:r}:{},...s.length>0?{weights:s}:{},...c.size>0?{styles:[...c]}:{},...u?{variable:!0}:{}})}return a}function xe(e){let t=new Set;for(let n of e.matchAll(ue))n[1]&&t.add(n[1]);for(let n of e.matchAll(de))n[1]&&t.add(n[1]);return[...t]}function Se(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,``),n={};for(let e of xe(t))for(let t of $(e))n[t.name]??=t;for(let e of t.matchAll(le)){let t=e[1]??``,r=ve(fe.exec(t)?.[1]??``);if(!r)continue;let i=_e.exec(t),a=i?.[1];if(!a||a.includes(`fonts.googleapis.com`))continue;let o={path:a,format:ye(i?.[2],a),weight:Q(pe.exec(t)?.[1]),style:me.exec(t)?.[1],unicodeRange:ge.exec(t)?.[1]?.trim()},s=he.exec(t)?.[1];be(n,r,o,s)}return n}function Ce(e){return!e||Object.keys(e).length===0}function we(e,t){let n={...e??{}};for(let[e,r]of Object.entries(t??{}))n[e]??=r;return n}function Te(e,t){if(!e)return;let n=Array.isArray(t)?t:[t];for(let t of n){let n=Object.values(e).find(e=>e.role===t);if(n)return n}}export{T as _,ce as a,w as b,O as c,N as d,P as f,C as g,S as h,Te as i,I as l,E as m,we as n,W as o,A as p,Se as r,k as s,Ce as t,F as u,ne as v,te as y};
10
+ //# sourceMappingURL=fonts-BiuIJVev.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts-BiuIJVev.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ const e=require("./fonts-vhz5FAsy.cjs");let t=require("defu"),n=require("node:path"),r=require("@stryke/string-format/title-case"),i=require("@stryke/fs/exists"),a=require("@stryke/fs/is-file"),o=require("@stryke/fs/json"),s=require("@stryke/path/append"),c=require("@stryke/path/file-path-fns"),l=require("@stryke/path/join"),u=require("@stryke/type-checks/is-set-object"),d=require("@stryke/type-checks/is-set-string"),f=require("node:fs/promises");const p=new Set([`woff2`,`woff`,`ttf`,`otf`,`otc`,`svg`]),m={woff2:`woff2`,woff:`woff`,ttf:`truetype`,otf:`opentype`,otc:`opentype`,svg:`svg`},h={thin:100,hairline:100,extralight:200,ultralight:200,light:300,regular:400,normal:400,book:400,roman:400,medium:500,semibold:600,demibold:600,bold:700,extrabold:800,ultrabold:800,black:900,heavy:900},g={sans:`sans-serif`,serif:`serif`,mono:`monospace`,display:`sans-serif`,heading:`sans-serif`,body:`sans-serif`,code:`monospace`},_=[`sans`,`body`,`heading`,`display`],v=[`mono`,`code`];async function ee(e,t){if(!e)return[];let r=[];for(let a of Object.values(e))if(a.source===`local`){await(0,f.mkdir)(t,{recursive:!0});for(let e of a.files){if(!e.path||!(0,i.existsSync)(e.path))continue;let a=(0,n.join)(t,(0,n.basename)(e.path));await(0,f.copyFile)(e.path,a),r.push(a)}}return r}function y(e){let t=e.trim();return!t||/^[a-z-]+$/i.test(t)&&!/\s/.test(t)?t:`"${t.replaceAll(`"`,`\\"`)}"`}function b(e){return e.family?.trim()||e.title?.trim()||e.name}function x(e){let t=[y(b(e))];for(let n of e.fallbacks??[]){let e=y(n);e&&!t.includes(e)&&t.push(e)}if(e.role){let n=g[e.role];n&&!t.includes(n)&&t.push(n)}return t.filter(Boolean).join(`, `)}function S(e){let t=b(e).replaceAll(` `,`+`),n=e.display??`swap`,r=(e.weights??[]).map(String),i=(e.styles??[`normal`]).includes(`italic`),a=t;if(e.variable){let e=r.length===2?`${r[0]}..${r[1]}`:`100..900`;a=i?`${t}:ital,wght@0,${e};1,${e}`:`${t}:wght@${e}`}else if(r.length>0){if(i){let e=[];for(let t of r)e.push(`0,${t}`);for(let t of r)e.push(`1,${t}`);a=`${t}:ital,wght@${e.join(`;`)}`}else a=`${t}:wght@${r.join(`;`)}`}return`https://fonts.googleapis.com/css2?family=${a}&display=${n}`}function C(e){return e.format}function w(e,t){let r=(0,n.basename)(e.path),i=`${t.endsWith(`/`)?t:`${t}/`}${r}`,a=C(e);return a?`url("${i}") format("${a}")`:`url("${i}")`}function T(e,t){let n=b(e),r=e.display??`swap`;return e.files.map(e=>{let i=[`@font-face {`,` font-family: ${y(n)};`,` src: ${w(e,t)};`];return e.weight!==void 0&&i.push(` font-weight: ${e.weight};`),e.style&&i.push(` font-style: ${e.style};`),e.unicodeRange&&i.push(` unicode-range: ${e.unicodeRange};`),i.push(` font-display: ${r};`,`}`),i.join(`
2
+ `)}).join(`
3
+
4
+ `)}function E(e){return Object.values(e).filter(e=>e.source===`google`).map(e=>`@import url("${S(e)}");`).join(`
5
+ `)}function D(e,t={}){let n=t.urlPrefix??`./fonts/`;return Object.values(e).filter(e=>e.source===`local`).map(e=>T(e,n)).join(`
6
+
7
+ `)}function O(e,t={}){return[E(e),D(e,t)].filter(Boolean).join(`
8
+
9
+ `)}function te(e,t,n={}){if(!t||Object.keys(t).length===0)return e;let r=O(t,n);return r?e?`${r}\n\n${e}`:`${r}\n`:e}const k=(0,t.createDefu)((e,t,n)=>Array.isArray(n)?(e[t]=n,!0):!1);function ne(e,t){return(0,n.isAbsolute)(t)?t:(0,n.resolve)(e,t)}function A(e){return Array.isArray(e)?e.filter(d.isSetString):(0,d.isSetString)(e)?[e]:[]}function j(e){let t=(0,c.findFileExtensionSafe)(e)?.toLowerCase();return!!(t&&p.has(t))}function M(e){let t=(0,c.findFileExtensionSafe)(e)?.toLowerCase();return t?m[t]:void 0}async function N(e){try{return(await(0,f.readdir)(e,{withFileTypes:!0})).filter(e=>e.isFile()&&j(e.name)).map(e=>e.name)}catch{return[]}}const P=Object.keys(h).sort((e,t)=>t.length-e.length);function F(e){let t=M(e),n=(0,c.findFileName)(e,{withExtension:!1})??e,r,i=/(?:[-_ ](italic|oblique|it)|Italic|Oblique)$/.exec(n);i&&(r=(i[1]??i[0]).toLowerCase()===`oblique`?`oblique`:`italic`,n=n.slice(0,i.index));let a,o=/[-_ ]([^_-]+)$/.exec(n),s=(o?.[1]??n).toLowerCase().replaceAll(/[\s_]/g,``);for(let e of P)if(s===e||s.endsWith(e)){if(a=h[e],o)n=n.slice(0,o.index);else{let t=n.toLowerCase().lastIndexOf(e);n=t>0?n.slice(0,t):n}break}return{family:n.replaceAll(/[-_]+$/g,``).trim()||n,...a===void 0?{}:{weight:a},...r?{style:r}:{},...t?{format:t}:{}}}function I(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function L(t){if(!t)return;let n=e.r.safeParse(t);if(n.success)return[n.data];if(!Array.isArray(t))return;let r=[];for(let n of t){let t=e.r.safeParse(n);t.success&&r.push(t.data)}return r.length>0?r:void 0}function R(e,t){if(e.source===`google`||e.source===`local`)return e.source;if(t&&t.length>0)return`local`;if(`weights`in e||`subsets`in e||`variable`in e||`styles`in e||(0,d.isSetString)(e.family)&&!t)return`google`}function z(t){if(!(0,u.isSetObject)(t))return;let n=`files`in t?L(t.files):void 0,r=R(t,n);if(!r){let n=e.a.safeParse(t);return n.success?n.data:void 0}let i={...t,source:r,...n?{files:n}:{}},a=r===`google`?e.s.partial().safeParse({...i,source:`google`}):e.c.partial().safeParse({...i,source:`local`});if(a.success)return Object.keys(a.data).length>0?a.data:void 0}function B(e){return(0,u.isSetObject)(e)&&`path`in e}async function V(e){let t=(0,l.joinPaths)(e,`package.json`);if(!(0,i.existsSync)(t))return;let n;try{n=await(0,o.readJsonFile)(t)}catch{return}let r={};if((0,d.isSetString)(n.name)&&(r.name=n.name,r.title=n.name),(0,d.isSetString)(n.description)&&(r.description=n.description),Array.isArray(n.keywords)){let e=n.keywords.filter(d.isSetString);e.length>0&&(r.tags=e)}let a=n.razorwind,s;if(B(a)||Array.isArray(a)){let e=L(a);e&&(s={source:`local`,files:e})}else(0,u.isSetObject)(a)&&(s=z(a));let c=k(s??{},r);return Object.keys(c).length>0?c:void 0}async function H(e){let t=(0,l.joinPaths)(e,`font.json`);if(!(0,i.existsSync)(t))return;let n;try{n=await(0,o.readJsonFile)(t)}catch{return}if(B(n)||Array.isArray(n)){let e=L(n);if(e)return{source:`local`,files:e}}return z(n)}function U(e,t,n){return t?.length?t.map(t=>{let n=(0,s.appendPath)(t.path,e);return{...t,path:n,format:t.format??M(t.path)}}):n.map(t=>{let n=F(t);return{path:(0,s.appendPath)(t,e),format:n.format,...n.weight===void 0?{}:{weight:n.weight},...n.style?{style:n.style}:{}}})}async function W(t){let n=await V(t),i=await H(t),a=await N(t);if(!n&&!i&&a.length===0)return;let o=k(i??{},n??{}),s=(0,c.findFolderName)(t),l=(0,d.isSetString)(o.name)?o.name:s,u=(0,d.isSetString)(o.title)?o.title:(0,r.titleCase)(l),f=U(t,o.source===`local`?o.files:void 0,a),p=(o.source??(f.length>0?`local`:`google`))===`google`?{...o,source:`google`,name:l,title:u,family:o.family??u}:{...o,source:`local`,name:l,title:u,family:o.family??u,files:f.length>0?f:o.source===`local`?o.files:f},m=e.a.safeParse(p);return m.success?m.data:void 0}function G(e,t,n){let i=I(t)||`font`,a=e[i];if(a?.source===`local`){let t=[...a.files],r=t.findIndex(e=>e.path===n.path);r>=0?t[r]=n:t.push(n),e[i]={...a,files:t};return}a||(e[i]={source:`local`,name:i,title:(0,r.titleCase)(t),family:t,files:[n]})}async function re(e){let t={},n=A(e.options.fontsPath);for(let r of n){let n=ne(e.cwd,r);if(!(!(0,i.existsSync)(n)||!(0,a.isDirectory)(n)))try{let e=await(0,f.readdir)(n,{withFileTypes:!0});for(let r of e){if(r.name.startsWith(`.`))continue;let e=(0,l.joinPaths)(n,r.name);if(r.isDirectory()){let n=await W(e);if(n){let e=t[n.name];t[n.name]=e?k(n,e):n}continue}if(r.isFile()&&j(r.name)){let n=F(r.name);G(t,n.family,{path:e,format:n.format,...n.weight===void 0?{}:{weight:n.weight},...n.style?{style:n.style}:{}})}}}catch{continue}}return t}const K=/@font-face\s*\{([^{}]*)\}/gi,q=/@import\s+(?:url\()?['"]?(https:\/\/fonts\.googleapis\.com\/css2?\?[^)'"\s]+)['"]?\)?\s*;/gi,J=/url\(\s*['"]?(https:\/\/fonts\.googleapis\.com\/css2?\?[^)'"\s]+)['"]?\s*\)/gi,Y=/font-family\s*:\s*([^;]+);/i,X=/font-weight\s*:\s*([^;]+);/i,ie=/font-style\s*:\s*(normal|italic|oblique)/i,ae=/font-display\s*:\s*(auto|block|swap|fallback|optional)/i,oe=/unicode-range\s*:\s*([^;]+);/i,se=/url\(\s*['"]?([^)'"]+)['"]?\s*\)(?:\s*format\(\s*['"]?([\w-]+)['"]?\s*\))?/i;function Z(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function Q(e){return e.trim().replaceAll(/^['"]|['"]$/g,``).trim()}function $(e){if(!e)return;let t=e.trim(),n=Number.parseInt(t,10);return Number.isNaN(n)?t||void 0:n}function ce(e,t){if(e){let t=e.toLowerCase();if(t===`woff2`||t===`woff`||t===`truetype`||t===`opentype`||t===`svg`)return t}let n=t.split(`.`).pop()?.split(`?`)[0]?.toLowerCase();return n?m[n]:void 0}function le(e,t,n,i){let a=Z(t)||`font`,o=e[a];if(o?.source===`local`){let t=[...o.files],r=t.findIndex(e=>e.path===n.path);r>=0?t[r]=n:t.push(n),e[a]={...o,files:t};return}o||(e[a]={source:`local`,name:a,title:(0,r.titleCase)(t),family:t,...i?{display:i}:{},files:[n]})}function ue(e){let t;try{t=new URL(e)}catch{return[]}let n=t.searchParams.get(`display`),i=n===`auto`||n===`block`||n===`swap`||n===`fallback`||n===`optional`?n:void 0,a=t.searchParams.getAll(`family`),o=[];for(let e of a){let[t,n]=e.split(`:`),a=(t??``).replaceAll(`+`,` `).trim();if(!a)continue;let s=Z(a),c=[],l=new Set,u=!1;if(n){let[e,t]=n.split(`@`),r=(e??``).split(`,`),i=r.indexOf(`ital`),a=r.indexOf(`wght`),o=(t??``).split(`;`).filter(Boolean);for(let e of o){let t=e.split(`,`);i>=0&&t[i]===`1`?l.add(`italic`):l.add(`normal`);let n=a>=0?t[a]:t[0];if(n?.includes(`..`)){u=!0;let[e,t]=n.split(`..`);e&&c.push(e),t&&c.push(t)}else{let e=$(n);e!==void 0&&!c.includes(e)&&c.push(e)}}}o.push({source:`google`,name:s||`font`,title:(0,r.titleCase)(a),family:a,...i?{display:i}:{},...c.length>0?{weights:c}:{},...l.size>0?{styles:[...l]}:{},...u?{variable:!0}:{}})}return o}function de(e){let t=new Set;for(let n of e.matchAll(q))n[1]&&t.add(n[1]);for(let n of e.matchAll(J))n[1]&&t.add(n[1]);return[...t]}function fe(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,``),n={};for(let e of de(t))for(let t of ue(e))n[t.name]??=t;for(let e of t.matchAll(K)){let t=e[1]??``,r=Q(Y.exec(t)?.[1]??``);if(!r)continue;let i=se.exec(t),a=i?.[1];if(!a||a.includes(`fonts.googleapis.com`))continue;let o={path:a,format:ce(i?.[2],a),weight:$(X.exec(t)?.[1]),style:ie.exec(t)?.[1],unicodeRange:oe.exec(t)?.[1]?.trim()},s=ae.exec(t)?.[1];le(n,r,o,s)}return n}function pe(e){return!e||Object.keys(e).length===0}function me(e,t){let n={...e??{}};for(let[e,r]of Object.entries(t??{}))n[e]??=r;return n}function he(e,t){if(!e)return;let n=Array.isArray(t)?t:[t];for(let t of n){let n=Object.values(e).find(e=>e.role===t);if(n)return n}}Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return _}});
@@ -0,0 +1 @@
1
+ let e=require("zod");const t=e.z.enum([`sans`,`serif`,`mono`,`display`,`heading`,`body`,`code`]),n=e.z.enum([`auto`,`block`,`swap`,`fallback`,`optional`]),r=e.z.enum([`woff2`,`woff`,`truetype`,`opentype`,`svg`]),i=e.z.object({path:e.z.string(),format:r.optional(),weight:e.z.union([e.z.number(),e.z.string()]).optional(),style:e.z.enum([`normal`,`italic`,`oblique`]).optional(),unicodeRange:e.z.string().optional()}),a=e.z.object({name:e.z.string(),title:e.z.string(),family:e.z.string().optional().describe(`CSS font-family name. Defaults to title or name.`),role:t.optional(),fallbacks:e.z.array(e.z.string()).optional(),display:n.optional(),category:e.z.string().optional(),description:e.z.string().optional(),tags:e.z.array(e.z.string()).optional()}),o=a.extend({source:e.z.literal(`google`),weights:e.z.array(e.z.union([e.z.number(),e.z.string()])).optional(),styles:e.z.array(e.z.enum([`normal`,`italic`])).optional(),subsets:e.z.array(e.z.string()).optional(),variable:e.z.boolean().optional()}),s=a.extend({source:e.z.literal(`local`),files:e.z.array(i).min(1)}),c=e.z.discriminatedUnion(`source`,[o,s]),l=e.z.record(e.z.string(),c);Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
@@ -1,6 +1,6 @@
1
- import { t as Schema } from "./schema-CsbyELyn.mjs";
2
- import "./index-DM8vit-J.mjs";
3
- import { l as Plugin, t as Config } from "./config-rgbP9zhp.mjs";
1
+ import { t as Schema } from "./schema-BwOBgJIM.cjs";
2
+ import "./index-CwN0c1Q4.cjs";
3
+ import { l as Plugin, t as Config } from "./config-BtscEr7S.cjs";
4
4
  import { ExecutionContext } from "@power-plant/core";
5
5
  import { Tokens } from "@power-plant/dtcg-schema";
6
6
  import { Hooks, LogConfig, Parser, PreprocessedTokens } from "style-dictionary/types";
@@ -200,4 +200,4 @@ declare function registerRazorwindHooks(plugins?: Plugin[], target?: StyleDictio
200
200
  declare const registerRazorwindParsers: typeof registerRazorwindHooks;
201
201
  //#endregion
202
202
  export { TOKEN_FILE_EXTENSIONS as A, nestFlatTokens as C, RazorwindParserName as D, DEFAULT_TOKEN_PATH_CANDIDATES as E, TYPE_PATH_HINTS as M, THEME_BASENAME_PATTERN as O, inferValue as S, parseCssCustomProperties as T, ResolvedTokensSource as _, getRazorwindParserHooks as a, InferredTokenType as b, registerRazorwindHooks as c, LoadTokensOptions as d, LoadedTokens as f, ResolveTokensPathOptions as g, loadTokensOrThrow as h, getExtractionHooks as i, TOKEN_PARSER_NAMES as j, TOKEN_DIRECTORY_GLOB as k, registerRazorwindParsers as l, loadTokens as m, RAZORWIND_INFER_PREPROCESSOR as n, getRazorwindPreprocessorHooks as o, isEmptyTokens as p, StyleDictionaryRegisterTarget as r, razorwindInferPreprocessor as s, ExtractionHooks as t, styleDictionaryLogOptions as u, resolveTokensSource as v, normalizeTokenTree as w, inferTypeFromPath as x, themeKeyFromPath as y };
203
- //# sourceMappingURL=index-D1ayVOTE.d.mts.map
203
+ //# sourceMappingURL=index-B7MsziQp.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Dk-i27fI.d.cts","names":[],"sources":["../src/lib/tokens/constants.ts","../src/lib/tokens/css.ts","../src/lib/tokens/infer.ts","../src/lib/tokens/resolve-path.ts","../src/lib/tokens/load.ts","../src/lib/tokens/logging.ts","../src/lib/tokens/parsers.ts"],"mappings":";;;;;;;;cAmBa;KAOD,8BAA8B;;cAG7B;;;;;cAsBA;;cAyBA;;cAGA,wBAAsB;;cAItB,iBAAiB;;;;;;;iBCvDd,yBACd,mBACC;;;KCgCS;;;;iBAmEI,kBACd,iBACC;;;;iBAiBa,WACd,cACA;EACG;EAAgB,OAAO;;;;;iBAsPZ,mBACd,gBACA;;;;;;;;iBA2Cc,eACd,MAAM,0BACL;;;UC9Zc;;;;EAIf;;;;EAKA;;;;EAKA,gBAAgB;;UAGD;;;;;;;EAOf;;;;EAKA;;;;EAKA;;;;;;;;;iBAyHc,oBACd,SAAS,2BACR;;;;iBAqFa,iBAAiB;;;UCrNhB,0BAA0B;;;;;;EAMzC;;KAGU,eAAe,SAAS,eAAe;iBAEnC,cAAc;;;;;;;;;iBA2IR,WACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;;;;;iBAsCW,kBACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;;;;;;;;iBC5NK,0BAA0B;EACxC,YAAY;;;;;cCGD;;UAGI;EACf,kBAAkB,QAAQ;EAC1B,wBAAwB;IACtB;IACA,cAAc,YAAY;;;;UAKb;EACf,SAAS,YAAY;EACrB,eAAe,YAAY;EAC3B;EACA;;;iBAwEc,2BAA2B,YAAY;;;;;iBAavC,2BACd,YAAY,qBACX;;iBAKa,iCAAiC,YAC/C;;;;;;;iBAac,mBAAmB,UAAS,WAAgB;;;;;;;;;;;;;;iBA0D5C,uBACd,UAAS,UACT,SAAQ,gCACP;;;;cAqBU,iCAAwB"}
1
+ {"version":3,"file":"index-B7MsziQp.d.cts","names":[],"sources":["../src/lib/tokens/constants.ts","../src/lib/tokens/css.ts","../src/lib/tokens/infer.ts","../src/lib/tokens/resolve-path.ts","../src/lib/tokens/load.ts","../src/lib/tokens/logging.ts","../src/lib/tokens/parsers.ts"],"mappings":";;;;;;;;cAmBa;KAOD,8BAA8B;;cAG7B;;;;;cAsBA;;cAyBA;;cAGA,wBAAsB;;cAItB,iBAAiB;;;;;;;iBCvDd,yBACd,mBACC;;;KCgCS;;;;iBA+DI,kBACd,iBACC;;;;iBAiBa,WACd,cACA;EACG;EAAgB,OAAO;;;;;iBAsPZ,mBACd,gBACA;;;;;;;;iBA2Cc,eACd,MAAM,0BACL;;;UC1Zc;;;;EAIf;;;;EAKA;;;;EAKA,gBAAgB;;UAGD;;;;;;;EAOf;;;;EAKA;;;;EAKA;;;;;;;;;iBAyHc,oBACd,SAAS,2BACR;;;;iBAqFa,iBAAiB;;;UCrNhB,0BAA0B;;;;;;EAMzC;;KAGU,eAAe,SAAS,eAAe;iBAEnC,cAAc;;;;;;;;;iBA6IR,WACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;;;;;iBAsCW,kBACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;;;;;;;;iBC9NK,0BAA0B;EACxC,YAAY;;;;;cCGD;;UAGI;EACf,kBAAkB,QAAQ;EAC1B,wBAAwB;IACtB;IACA,cAAc,YAAY;;;;UAKb;EACf,SAAS,YAAY;EACrB,eAAe,YAAY;EAC3B;EACA;;;iBAwEc,2BAA2B,YAAY;;;;;iBAavC,2BACd,YAAY,qBACX;;iBAKa,iCAAiC,YAC/C;;;;;;;iBAac,mBAAmB,UAAS,WAAgB;;;;;;;;;;;;;;iBA0D5C,uBACd,UAAS,UACT,SAAQ,gCACP;;;;cAqBU,iCAAwB"}
@@ -1,3 +1,3 @@
1
- import "./schema-CsbyELyn.cjs";
1
+ import "./schema-BwOBgJIM.cjs";
2
2
  import { Token, Tokens as Tokens$1, tokenSchema, tokensSchema } from "@power-plant/dtcg-schema";
3
3
  export { tokensSchema as i, Tokens$1 as n, tokenSchema as r, Token as t };
@@ -0,0 +1,100 @@
1
+ import { d as FontFile, f as FontFileFormat, h as GoogleFont, l as Font, m as Fonts, p as FontRole, t as Schema } from "./schema-BwOBgJIM.mjs";
2
+ import "./index-D5L2WXYk.mjs";
3
+ import { t as Config } from "./config-CNTGHrST.mjs";
4
+ import { ExecutionContext } from "@power-plant/core";
5
+ //#region src/lib/fonts/constants.d.ts
6
+ declare const FONT_EXTENSIONS: Set<string>;
7
+ declare const FONT_FORMAT_FROM_EXTENSION: Record<string, FontFileFormat>;
8
+ declare const WEIGHT_FROM_SUFFIX: Record<string, number>;
9
+ declare const GENERIC_FALLBACK_FROM_ROLE: Record<FontRole, string>;
10
+ declare const SANS_ROLES: FontRole[];
11
+ declare const MONO_ROLES: FontRole[];
12
+ //#endregion
13
+ //#region src/lib/fonts/copy.d.ts
14
+ /**
15
+ * Copy local font files into `destDir`. Google Fonts entries are skipped.
16
+ *
17
+ * @returns Destination paths that were written.
18
+ */
19
+ declare function copyFontFiles(fonts: Fonts | undefined, destDir: string): Promise<string[]>;
20
+ //#endregion
21
+ //#region src/lib/fonts/css.d.ts
22
+ interface RenderFontCssOptions {
23
+ /**
24
+ * Directory prefix used in `url()` for local font files.
25
+ *
26
+ * @defaultValue `"./fonts/"`
27
+ */
28
+ urlPrefix?: string;
29
+ }
30
+ /**
31
+ * Resolve the CSS `font-family` name for a font entry.
32
+ */
33
+ declare function fontFamilyName(font: Font): string;
34
+ /**
35
+ * Build a CSS `font-family` stack: quoted family, configured fallbacks, then
36
+ * a generic fallback from `role`.
37
+ */
38
+ declare function cssFontFamily(font: Font): string;
39
+ /**
40
+ * Build a Google Fonts CSS2 stylesheet URL.
41
+ *
42
+ * @example
43
+ * `https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,700&display=swap`
44
+ */
45
+ declare function toGoogleFontsCssUrl(font: GoogleFont): string;
46
+ /**
47
+ * Google Fonts `@import` rules. Must stay ahead of other CSS except `@charset`.
48
+ */
49
+ declare function renderGoogleFontImports(fonts: Fonts): string;
50
+ /**
51
+ * Local `@font-face` rules.
52
+ */
53
+ declare function renderLocalFontFaces(fonts: Fonts, options?: RenderFontCssOptions): string;
54
+ /**
55
+ * Emit `@import` (Google Fonts) and `@font-face` (local files) CSS.
56
+ */
57
+ declare function renderFontCss(fonts: Fonts, options?: RenderFontCssOptions): string;
58
+ /**
59
+ * Prepend font loading CSS ahead of an existing stylesheet.
60
+ */
61
+ declare function prependFontCss(css: string, fonts: Fonts | undefined, options?: RenderFontCssOptions): string;
62
+ //#endregion
63
+ //#region src/lib/fonts/load.d.ts
64
+ interface ParsedFontFilename {
65
+ family: string;
66
+ weight?: number;
67
+ style?: FontFile["style"];
68
+ format?: FontFileFormat;
69
+ }
70
+ /**
71
+ * Infer family / weight / style from a font filename such as
72
+ * `Inter-BoldItalic.woff2`.
73
+ */
74
+ declare function parseFontFilename(filename: string): ParsedFontFilename;
75
+ /**
76
+ * Load fonts from `fontsPath` directories.
77
+ *
78
+ * Supports:
79
+ * 1. Per-font directories with `package.json` / `font.json` metadata
80
+ * 2. Flat font files at the fonts path root, grouped by family prefix
81
+ */
82
+ declare function loadFonts(context: ExecutionContext<Schema, Config, void>): Promise<Fonts>;
83
+ //#endregion
84
+ //#region src/lib/fonts/parse.d.ts
85
+ /**
86
+ * Parse `@font-face` rules and Google Fonts CSS URLs into a {@link Fonts} record.
87
+ */
88
+ declare function parseCssFonts(contents: string): Fonts;
89
+ declare function isEmptyFonts(fonts: Fonts | undefined): boolean;
90
+ /**
91
+ * Merge `extra` into `base` without overwriting existing keys.
92
+ */
93
+ declare function mergeFonts(base: Fonts | undefined, extra: Fonts | undefined): Fonts;
94
+ /**
95
+ * Find the first font whose `role` matches one of `roles`, in order.
96
+ */
97
+ declare function pickFontByRole(fonts: Fonts | undefined, roles: Font["role"] | Array<NonNullable<Font["role"]>>): Font | undefined;
98
+ //#endregion
99
+ export { WEIGHT_FROM_SUFFIX as S, FONT_EXTENSIONS as _, ParsedFontFilename as a, MONO_ROLES as b, RenderFontCssOptions as c, prependFontCss as d, renderFontCss as f, copyFontFiles as g, toGoogleFontsCssUrl as h, pickFontByRole as i, cssFontFamily as l, renderLocalFontFaces as m, mergeFonts as n, loadFonts as o, renderGoogleFontImports as p, parseCssFonts as r, parseFontFilename as s, isEmptyFonts as t, fontFamilyName as u, FONT_FORMAT_FROM_EXTENSION as v, SANS_ROLES as x, GENERIC_FALLBACK_FROM_ROLE as y };
100
+ //# sourceMappingURL=index-CzbZzpnz.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CzbZzpnz.d.mts","names":[],"sources":["../src/lib/fonts/constants.ts","../src/lib/fonts/copy.ts","../src/lib/fonts/css.ts","../src/lib/fonts/load.ts","../src/lib/fonts/parse.ts"],"mappings":""}
@@ -1,8 +1,8 @@
1
- import { t as Schema } from "./schema-CsbyELyn.cjs";
2
- import "./index-BjSOzDOH.cjs";
3
- import { l as Plugin, t as Config } from "./config-25eDAKIq.cjs";
4
- import { Tokens } from "@power-plant/dtcg-schema";
1
+ import { t as Schema } from "./schema-BwOBgJIM.mjs";
2
+ import "./index-D5L2WXYk.mjs";
3
+ import { l as Plugin, t as Config } from "./config-CNTGHrST.mjs";
5
4
  import { ExecutionContext } from "@power-plant/core";
5
+ import { Tokens } from "@power-plant/dtcg-schema";
6
6
  import { Hooks, LogConfig, Parser, PreprocessedTokens } from "style-dictionary/types";
7
7
  //#region src/lib/tokens/constants.d.ts
8
8
  /** Style Dictionary parser hook names registered by Razorwind. */
@@ -200,4 +200,4 @@ declare function registerRazorwindHooks(plugins?: Plugin[], target?: StyleDictio
200
200
  declare const registerRazorwindParsers: typeof registerRazorwindHooks;
201
201
  //#endregion
202
202
  export { TOKEN_FILE_EXTENSIONS as A, nestFlatTokens as C, RazorwindParserName as D, DEFAULT_TOKEN_PATH_CANDIDATES as E, TYPE_PATH_HINTS as M, THEME_BASENAME_PATTERN as O, inferValue as S, parseCssCustomProperties as T, ResolvedTokensSource as _, getRazorwindParserHooks as a, InferredTokenType as b, registerRazorwindHooks as c, LoadTokensOptions as d, LoadedTokens as f, ResolveTokensPathOptions as g, loadTokensOrThrow as h, getExtractionHooks as i, TOKEN_PARSER_NAMES as j, TOKEN_DIRECTORY_GLOB as k, registerRazorwindParsers as l, loadTokens as m, RAZORWIND_INFER_PREPROCESSOR as n, getRazorwindPreprocessorHooks as o, isEmptyTokens as p, StyleDictionaryRegisterTarget as r, razorwindInferPreprocessor as s, ExtractionHooks as t, styleDictionaryLogOptions as u, resolveTokensSource as v, normalizeTokenTree as w, inferTypeFromPath as x, themeKeyFromPath as y };
203
- //# sourceMappingURL=index-Dk-i27fI.d.cts.map
203
+ //# sourceMappingURL=index-CzjDptav.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-D1ayVOTE.d.mts","names":[],"sources":["../src/lib/tokens/constants.ts","../src/lib/tokens/css.ts","../src/lib/tokens/infer.ts","../src/lib/tokens/resolve-path.ts","../src/lib/tokens/load.ts","../src/lib/tokens/logging.ts","../src/lib/tokens/parsers.ts"],"mappings":""}
1
+ {"version":3,"file":"index-CzjDptav.d.mts","names":[],"sources":["../src/lib/tokens/constants.ts","../src/lib/tokens/css.ts","../src/lib/tokens/infer.ts","../src/lib/tokens/resolve-path.ts","../src/lib/tokens/load.ts","../src/lib/tokens/logging.ts","../src/lib/tokens/parsers.ts"],"mappings":""}
@@ -1,3 +1,3 @@
1
- import "./schema-CsbyELyn.mjs";
1
+ import "./schema-BwOBgJIM.mjs";
2
2
  import { Token, Tokens as Tokens$1, tokenSchema, tokensSchema as tokensSchema$1 } from "@power-plant/dtcg-schema";
3
3
  export { tokensSchema$1 as i, Tokens$1 as n, tokenSchema as r, Token as t };
@@ -0,0 +1,100 @@
1
+ import { d as FontFile, f as FontFileFormat, h as GoogleFont, l as Font, m as Fonts, p as FontRole, t as Schema } from "./schema-BwOBgJIM.cjs";
2
+ import "./index-CwN0c1Q4.cjs";
3
+ import { t as Config } from "./config-BtscEr7S.cjs";
4
+ import { ExecutionContext } from "@power-plant/core";
5
+ //#region src/lib/fonts/constants.d.ts
6
+ declare const FONT_EXTENSIONS: Set<string>;
7
+ declare const FONT_FORMAT_FROM_EXTENSION: Record<string, FontFileFormat>;
8
+ declare const WEIGHT_FROM_SUFFIX: Record<string, number>;
9
+ declare const GENERIC_FALLBACK_FROM_ROLE: Record<FontRole, string>;
10
+ declare const SANS_ROLES: FontRole[];
11
+ declare const MONO_ROLES: FontRole[];
12
+ //#endregion
13
+ //#region src/lib/fonts/copy.d.ts
14
+ /**
15
+ * Copy local font files into `destDir`. Google Fonts entries are skipped.
16
+ *
17
+ * @returns Destination paths that were written.
18
+ */
19
+ declare function copyFontFiles(fonts: Fonts | undefined, destDir: string): Promise<string[]>;
20
+ //#endregion
21
+ //#region src/lib/fonts/css.d.ts
22
+ interface RenderFontCssOptions {
23
+ /**
24
+ * Directory prefix used in `url()` for local font files.
25
+ *
26
+ * @defaultValue `"./fonts/"`
27
+ */
28
+ urlPrefix?: string;
29
+ }
30
+ /**
31
+ * Resolve the CSS `font-family` name for a font entry.
32
+ */
33
+ declare function fontFamilyName(font: Font): string;
34
+ /**
35
+ * Build a CSS `font-family` stack: quoted family, configured fallbacks, then
36
+ * a generic fallback from `role`.
37
+ */
38
+ declare function cssFontFamily(font: Font): string;
39
+ /**
40
+ * Build a Google Fonts CSS2 stylesheet URL.
41
+ *
42
+ * @example
43
+ * `https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,700&display=swap`
44
+ */
45
+ declare function toGoogleFontsCssUrl(font: GoogleFont): string;
46
+ /**
47
+ * Google Fonts `@import` rules. Must stay ahead of other CSS except `@charset`.
48
+ */
49
+ declare function renderGoogleFontImports(fonts: Fonts): string;
50
+ /**
51
+ * Local `@font-face` rules.
52
+ */
53
+ declare function renderLocalFontFaces(fonts: Fonts, options?: RenderFontCssOptions): string;
54
+ /**
55
+ * Emit `@import` (Google Fonts) and `@font-face` (local files) CSS.
56
+ */
57
+ declare function renderFontCss(fonts: Fonts, options?: RenderFontCssOptions): string;
58
+ /**
59
+ * Prepend font loading CSS ahead of an existing stylesheet.
60
+ */
61
+ declare function prependFontCss(css: string, fonts: Fonts | undefined, options?: RenderFontCssOptions): string;
62
+ //#endregion
63
+ //#region src/lib/fonts/load.d.ts
64
+ interface ParsedFontFilename {
65
+ family: string;
66
+ weight?: number;
67
+ style?: FontFile["style"];
68
+ format?: FontFileFormat;
69
+ }
70
+ /**
71
+ * Infer family / weight / style from a font filename such as
72
+ * `Inter-BoldItalic.woff2`.
73
+ */
74
+ declare function parseFontFilename(filename: string): ParsedFontFilename;
75
+ /**
76
+ * Load fonts from `fontsPath` directories.
77
+ *
78
+ * Supports:
79
+ * 1. Per-font directories with `package.json` / `font.json` metadata
80
+ * 2. Flat font files at the fonts path root, grouped by family prefix
81
+ */
82
+ declare function loadFonts(context: ExecutionContext<Schema, Config, void>): Promise<Fonts>;
83
+ //#endregion
84
+ //#region src/lib/fonts/parse.d.ts
85
+ /**
86
+ * Parse `@font-face` rules and Google Fonts CSS URLs into a {@link Fonts} record.
87
+ */
88
+ declare function parseCssFonts(contents: string): Fonts;
89
+ declare function isEmptyFonts(fonts: Fonts | undefined): boolean;
90
+ /**
91
+ * Merge `extra` into `base` without overwriting existing keys.
92
+ */
93
+ declare function mergeFonts(base: Fonts | undefined, extra: Fonts | undefined): Fonts;
94
+ /**
95
+ * Find the first font whose `role` matches one of `roles`, in order.
96
+ */
97
+ declare function pickFontByRole(fonts: Fonts | undefined, roles: Font["role"] | Array<NonNullable<Font["role"]>>): Font | undefined;
98
+ //#endregion
99
+ export { WEIGHT_FROM_SUFFIX as S, FONT_EXTENSIONS as _, ParsedFontFilename as a, MONO_ROLES as b, RenderFontCssOptions as c, prependFontCss as d, renderFontCss as f, copyFontFiles as g, toGoogleFontsCssUrl as h, pickFontByRole as i, cssFontFamily as l, renderLocalFontFaces as m, mergeFonts as n, loadFonts as o, renderGoogleFontImports as p, parseCssFonts as r, parseFontFilename as s, isEmptyFonts as t, fontFamilyName as u, FONT_FORMAT_FROM_EXTENSION as v, SANS_ROLES as x, GENERIC_FALLBACK_FROM_ROLE as y };
100
+ //# sourceMappingURL=index-Di7vqmsi.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Di7vqmsi.d.cts","names":[],"sources":["../src/lib/fonts/constants.ts","../src/lib/fonts/copy.ts","../src/lib/fonts/css.ts","../src/lib/fonts/load.ts","../src/lib/fonts/parse.ts"],"mappings":";;;;;cAoBa,iBAAe;cASf,4BAA4B,eAAe;cAS3C,oBAAoB;cAoBpB,4BAA4B,OAAO;cAUnC,YAAY;cACZ,YAAY;;;;;;;;iBCzCH,cACpB,OAAO,mBACP,kBACC;;;UCDc;;;;;;EAMf;;;;;iBAmBc,eAAe,MAAM;;;;;iBAQrB,cAAc,MAAM;;;;;;;iBA0BpB,oBAAoB,MAAM;;;;iBAmF1B,wBAAwB,OAAO;;;;iBAU/B,qBACd,OAAO,OACP,UAAS;;;;iBAaK,cACd,OAAO,OACP,UAAS;;;;iBAUK,eACd,aACA,OAAO,mBACP,UAAS;;;UCxGM;EACf;EACA;EACA,QAAQ;EACR,SAAS;;;;;;iBAOK,kBAAkB,mBAAmB;;;;;;;;iBA0U/B,UACpB,SAAS,iBAAiB,QAAQ,gBACjC,QAAQ;;;;;;iBCnNK,cAAc,mBAAmB;iBAuCjC,aAAa,OAAO;;;;iBAOpB,WACd,MAAM,mBACN,OAAO,oBACN;;;;iBAaa,eACd,OAAO,mBACP,OAAO,eAAe,MAAM,YAAY,iBACvC"}