webfont 12.0.0 → 12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/NOTICE.md +14 -2
  2. package/README.md +199 -20
  3. package/dist/browser.js +4 -0
  4. package/dist/cli.mjs +850 -495
  5. package/dist/index.js +1 -1
  6. package/dist/index.mjs +513 -0
  7. package/dist/parseTemplateOption-BmH_pcQh.js +1 -0
  8. package/dist/parseTemplateOption-Bvbie1SQ.mjs +19 -0
  9. package/dist/parseTemplateOption-DLNu6PPx.mjs +38 -0
  10. package/dist/renderTemplates-Biyrk6t-.mjs +92 -0
  11. package/dist/renderTemplates-CXVKq3Op.mjs +102 -0
  12. package/dist/renderTemplates-zCYCzeOt.js +1 -0
  13. package/dist/src/browser.d.mts +2 -0
  14. package/dist/src/browser.d.ts +2 -0
  15. package/dist/src/index.d.mts +5 -0
  16. package/dist/src/index.d.ts +2 -0
  17. package/dist/src/lib/applyOptimizeSvgToGlyphs.d.mts +3 -0
  18. package/dist/src/lib/applyOptimizeSvgToGlyphs.d.ts +3 -0
  19. package/dist/src/lib/evenoddFillRule.d.mts +2 -0
  20. package/dist/src/lib/evenoddFillRule.d.ts +2 -0
  21. package/dist/src/lib/execCLI/index.d.mts +24 -0
  22. package/dist/src/lib/inputSource.d.mts +2 -0
  23. package/dist/src/lib/inputSource.d.ts +1 -4
  24. package/dist/src/lib/inputSourceUtils.d.mts +4 -0
  25. package/dist/src/lib/inputSourceUtils.d.ts +4 -0
  26. package/dist/src/lib/largeFontLigatures.d.mts +4 -0
  27. package/dist/src/lib/largeFontLigatures.d.ts +4 -0
  28. package/dist/src/lib/optimizeSvgGlyphs.d.mts +4 -0
  29. package/dist/src/lib/optimizeSvgGlyphs.d.ts +4 -0
  30. package/dist/src/lib/p-limit/index.d.mts +2 -0
  31. package/dist/src/lib/parseFormats.d.mts +4 -0
  32. package/dist/src/lib/parseFormats.d.ts +4 -0
  33. package/dist/src/lib/parseTemplateOption.d.mts +2 -0
  34. package/dist/src/lib/parseTemplateOption.d.ts +2 -0
  35. package/dist/src/lib/runtimeEnvironment.d.mts +4 -0
  36. package/dist/src/lib/runtimeEnvironment.d.ts +4 -0
  37. package/dist/src/lib/sfnt/flavor.d.mts +2 -0
  38. package/dist/src/lib/svgDiagnostics/diagnoseSvgContents.d.mts +13 -0
  39. package/dist/src/lib/svgDiagnostics/diagnoseSvgContents.d.ts +13 -0
  40. package/dist/src/lib/svgFontOutput/emptyGlyphPaths.d.mts +3 -0
  41. package/dist/src/lib/svgFontOutput/emptyGlyphPaths.d.ts +3 -0
  42. package/dist/src/lib/svgTools/applySvgDiagnostics.d.mts +13 -0
  43. package/dist/src/lib/svgTools/applySvgDiagnostics.d.ts +13 -0
  44. package/dist/src/lib/svgTools/applySvgTools.d.mts +14 -0
  45. package/dist/src/lib/svgTools/applySvgTools.d.ts +14 -0
  46. package/dist/src/lib/svgTools/normalizeSvgToolsOptions.d.mts +2 -0
  47. package/dist/src/lib/svgTools/normalizeSvgToolsOptions.d.ts +2 -0
  48. package/dist/src/lib/svgicons2svgfont/index.d.mts +14 -0
  49. package/dist/src/lib/svgicons2svgfont/index.d.ts +5 -0
  50. package/dist/src/lib/svgicons2svgfont/metadataFromSrcPath.d.mts +11 -0
  51. package/dist/src/lib/svgicons2svgfont/metadataFromSrcPath.d.ts +11 -0
  52. package/dist/src/lib/templateUnicodeRange.d.mts +4 -0
  53. package/dist/src/lib/templateUnicodeRange.d.ts +4 -0
  54. package/dist/src/lib/ttf2eot/index.d.mts +2 -0
  55. package/dist/src/lib/ttfEncode.d.mts +5 -0
  56. package/dist/src/lib/ttfEncode.d.ts +5 -0
  57. package/dist/src/standalone/convertTtfInput.d.mts +3 -0
  58. package/dist/src/standalone/convertTtfInput.d.ts +3 -0
  59. package/dist/src/standalone/convertWebfontInput.d.mts +3 -0
  60. package/dist/src/standalone/defaultOptions.d.mts +3 -0
  61. package/dist/src/standalone/defaultOptions.d.ts +3 -0
  62. package/dist/src/standalone/fetchWebfontUrl.d.mts +1 -0
  63. package/dist/src/standalone/generateSvgFont.d.mts +2 -0
  64. package/dist/src/standalone/generateSvgFont.d.ts +2 -0
  65. package/dist/src/standalone/getGlyphsDataFromInputs.d.mts +3 -0
  66. package/dist/src/standalone/getGlyphsDataFromInputs.d.ts +3 -0
  67. package/dist/src/standalone/glyphsData.d.mts +4 -0
  68. package/dist/src/standalone/glyphsData.d.ts +1 -1
  69. package/dist/src/standalone/index.d.mts +10 -0
  70. package/dist/src/standalone/index.d.ts +5 -0
  71. package/dist/src/standalone/inputMode.d.mts +9 -0
  72. package/dist/src/standalone/inputMode.d.ts +3 -1
  73. package/dist/src/standalone/options.d.mts +5 -0
  74. package/dist/src/standalone/optionsFromGlyphs.d.mts +3 -0
  75. package/dist/src/standalone/optionsFromGlyphs.d.ts +3 -0
  76. package/dist/src/standalone/renderTemplates.d.mts +10 -0
  77. package/dist/src/standalone/renderTemplates.d.ts +10 -0
  78. package/dist/src/standalone/runSvgPipeline.d.mts +3 -0
  79. package/dist/src/standalone/runSvgPipeline.d.ts +3 -0
  80. package/dist/src/standalone/templateFonts.d.mts +3 -0
  81. package/dist/src/standalone/toTtf.d.mts +4 -0
  82. package/dist/src/standalone/validateWebfontOptions.d.mts +6 -0
  83. package/dist/src/standalone/validateWebfontOptions.d.ts +6 -0
  84. package/dist/src/standalone/webfontFromGlyphs.d.mts +3 -0
  85. package/dist/src/standalone/webfontFromGlyphs.d.ts +3 -0
  86. package/dist/src/types/DecompressedFont.d.mts +5 -0
  87. package/dist/src/types/Format.d.mts +9 -0
  88. package/dist/src/types/GlyphContentTransformFn.d.mts +2 -0
  89. package/dist/src/types/GlyphContentTransformFn.d.ts +2 -0
  90. package/dist/src/types/GlyphData.d.mts +6 -0
  91. package/dist/src/types/GlyphInput.d.mts +6 -0
  92. package/dist/src/types/GlyphInput.d.ts +6 -0
  93. package/dist/src/types/GlyphMetadata.d.mts +10 -0
  94. package/dist/src/types/GlyphTransformFn.d.mts +2 -0
  95. package/dist/src/types/InitialOptions.d.mts +10 -0
  96. package/dist/src/types/InitialOptions.d.ts +2 -0
  97. package/dist/src/types/MetadataProvider.d.mts +5 -0
  98. package/dist/src/types/OptionsBase.d.mts +39 -0
  99. package/dist/src/types/OptionsBase.d.ts +9 -1
  100. package/dist/src/types/RenderedTemplate.d.mts +7 -0
  101. package/dist/src/types/RenderedTemplate.d.ts +7 -0
  102. package/dist/src/types/Result.d.mts +26 -0
  103. package/dist/src/types/Result.d.ts +8 -0
  104. package/dist/src/types/ResultConfig.d.mts +4 -0
  105. package/dist/src/types/SvgToolsOptions.d.mts +13 -0
  106. package/dist/src/types/SvgToolsOptions.d.ts +13 -0
  107. package/dist/src/types/TranscodedFont.d.mts +7 -0
  108. package/dist/src/types/TranscodedFont.d.ts +7 -0
  109. package/dist/src/types/WebfontFromGlyphsOptions.d.mts +11 -0
  110. package/dist/src/types/WebfontFromGlyphsOptions.d.ts +11 -0
  111. package/dist/src/types/WebfontOptions.d.mts +43 -0
  112. package/dist/src/types/WebfontOptions.d.ts +12 -2
  113. package/dist/src/types/index.d.mts +8 -0
  114. package/dist/src/types/index.d.ts +2 -1
  115. package/dist/templates/index.d.mts +19 -0
  116. package/package.json +42 -11
  117. package/templates/template.css.njk +6 -3
  118. package/templates/template.html.njk +15 -4
  119. package/templates/template.scss.njk +6 -3
  120. package/templates/template.styl.njk +6 -3
@@ -1,5 +1,10 @@
1
+ import { cosmiconfig } from 'cosmiconfig';
1
2
  import { InitialOptions } from '../types';
2
3
  import { Result } from '../types/Result';
4
+ type CosmiconfigLoaded = NonNullable<Awaited<ReturnType<ReturnType<typeof cosmiconfig>["search"]>>>;
5
+ export declare const loadWebfontConfig: (options: {
6
+ configFile?: string;
7
+ }) => Promise<CosmiconfigLoaded | Record<string, never>>;
3
8
  type Webfont = (_initialOptions?: InitialOptions) => Promise<Result>;
4
9
  export declare const webfont: Webfont;
5
10
  export default webfont;
@@ -0,0 +1,9 @@
1
+ import { Format } from '../types/Format.mjs';
2
+ export type InputMode = "empty" | "mixed" | "svg" | "ttf" | "webfont";
3
+ export declare const classifyInputFiles: (filePaths: readonly string[]) => InputMode;
4
+ export declare const assertSvgPipelineFormats: (formats: readonly Format[]) => void;
5
+ export declare const filterInputFilesByMode: (filePaths: readonly string[], mode: InputMode) => string[];
6
+ export type ConversionFormat = "otf" | "ttf";
7
+ export type TtfEncodeFormat = "eot" | "ttf" | "woff" | "woff2";
8
+ export declare const resolveTtfConversionFormats: (formats: readonly Format[]) => TtfEncodeFormat[];
9
+ export declare const resolveWebfontConversionFormats: (formats: readonly Format[]) => ConversionFormat[];
@@ -1,7 +1,9 @@
1
1
  import { Format } from '../types/Format';
2
- export type InputMode = "empty" | "mixed" | "svg" | "webfont";
2
+ export type InputMode = "empty" | "mixed" | "svg" | "ttf" | "webfont";
3
3
  export declare const classifyInputFiles: (filePaths: readonly string[]) => InputMode;
4
4
  export declare const assertSvgPipelineFormats: (formats: readonly Format[]) => void;
5
5
  export declare const filterInputFilesByMode: (filePaths: readonly string[], mode: InputMode) => string[];
6
6
  export type ConversionFormat = "otf" | "ttf";
7
+ export type TtfEncodeFormat = "eot" | "ttf" | "woff" | "woff2";
8
+ export declare const resolveTtfConversionFormats: (formats: readonly Format[]) => TtfEncodeFormat[];
7
9
  export declare const resolveWebfontConversionFormats: (formats: readonly Format[]) => ConversionFormat[];
@@ -0,0 +1,5 @@
1
+ import { InitialOptions } from '../types/InitialOptions.mjs';
2
+ import { WebfontOptions } from '../types/WebfontOptions.mjs';
3
+ type OptionsGetter = (_initialOptions?: InitialOptions) => WebfontOptions;
4
+ export declare const getOptions: OptionsGetter;
5
+ export {};
@@ -0,0 +1,3 @@
1
+ import { WebfontFromGlyphsOptions } from '../types/WebfontFromGlyphsOptions.mjs';
2
+ import { WebfontOptions } from '../types/WebfontOptions.mjs';
3
+ export declare const getOptionsFromGlyphs: (initialOptions: WebfontFromGlyphsOptions) => WebfontOptions;
@@ -0,0 +1,3 @@
1
+ import { WebfontFromGlyphsOptions } from '../types/WebfontFromGlyphsOptions';
2
+ import { WebfontOptions } from '../types/WebfontOptions';
3
+ export declare const getOptionsFromGlyphs: (initialOptions: WebfontFromGlyphsOptions) => WebfontOptions;
@@ -0,0 +1,10 @@
1
+ import { Format } from '../types/Format.mjs';
2
+ import { RenderedTemplate } from '../types/RenderedTemplate.mjs';
3
+ import { Result } from '../types/Result.mjs';
4
+ import { WebfontOptions } from '../types/WebfontOptions.mjs';
5
+ type RenderTemplatesResult = {
6
+ templates: RenderedTemplate[];
7
+ usedBuildInTemplate: boolean;
8
+ };
9
+ export declare const renderTemplates: (options: WebfontOptions, result: Pick<Result, "glyphsData" | "hash"> & Partial<Result>, formats: readonly Format[]) => RenderTemplatesResult;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import { Format } from '../types/Format';
2
+ import { RenderedTemplate } from '../types/RenderedTemplate';
3
+ import { Result } from '../types/Result';
4
+ import { WebfontOptions } from '../types/WebfontOptions';
5
+ type RenderTemplatesResult = {
6
+ templates: RenderedTemplate[];
7
+ usedBuildInTemplate: boolean;
8
+ };
9
+ export declare const renderTemplates: (options: WebfontOptions, result: Pick<Result, "glyphsData" | "hash"> & Partial<Result>, formats: readonly Format[]) => RenderTemplatesResult;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ import { GlyphData, WebfontOptions } from '../types/index.mjs';
2
+ import { Result } from '../types/Result.mjs';
3
+ export declare const runSvgPipeline: (glyphsData: GlyphData[], options: WebfontOptions) => Promise<Result>;
@@ -0,0 +1,3 @@
1
+ import { GlyphData, WebfontOptions } from '../types';
2
+ import { Result } from '../types/Result';
3
+ export declare const runSvgPipeline: (glyphsData: GlyphData[], options: WebfontOptions) => Promise<Result>;
@@ -0,0 +1,3 @@
1
+ import { Format } from '../types/Format.mjs';
2
+ import { Result } from '../types/Result.mjs';
3
+ export declare const getTemplateFontBase64: (format: Format, result: Result) => string;
@@ -0,0 +1,4 @@
1
+ import { default as svg2ttf } from 'svg2ttf';
2
+ export type ToTtfOptions = Parameters<typeof svg2ttf>[1];
3
+ declare const toTtf: (svgFontString: string, options?: ToTtfOptions) => Buffer;
4
+ export default toTtf;
@@ -0,0 +1,6 @@
1
+ import { WebfontOptions } from '../types/WebfontOptions.mjs';
2
+ /**
3
+ * Runtime validation for merged webfont options (API, cosmiconfig, CLI).
4
+ * Rejects mis-typed or unknown format names before running a pipeline (#133).
5
+ */
6
+ export declare const validateWebfontOptions: (options: WebfontOptions) => WebfontOptions;
@@ -0,0 +1,6 @@
1
+ import { WebfontOptions } from '../types/WebfontOptions';
2
+ /**
3
+ * Runtime validation for merged webfont options (API, cosmiconfig, CLI).
4
+ * Rejects mis-typed or unknown format names before running a pipeline (#133).
5
+ */
6
+ export declare const validateWebfontOptions: (options: WebfontOptions) => WebfontOptions;
@@ -0,0 +1,3 @@
1
+ import { Result } from '../types/Result.mjs';
2
+ import { WebfontFromGlyphsOptions } from '../types/WebfontFromGlyphsOptions.mjs';
3
+ export declare const webfontFromGlyphs: (initialOptions: WebfontFromGlyphsOptions) => Promise<Result>;
@@ -0,0 +1,3 @@
1
+ import { Result } from '../types/Result';
2
+ import { WebfontFromGlyphsOptions } from '../types/WebfontFromGlyphsOptions';
3
+ export declare const webfontFromGlyphs: (initialOptions: WebfontFromGlyphsOptions) => Promise<Result>;
@@ -0,0 +1,5 @@
1
+ export type DecompressedFont = {
2
+ source: string;
3
+ ttf?: Buffer;
4
+ otf?: Buffer;
5
+ };
@@ -0,0 +1,9 @@
1
+ export type Format = "eot" | "otf" | "woff" | "woff2" | "svg" | "ttf";
2
+ export type Formats = Array<Format>;
3
+ type FormatOption = {
4
+ copyright: null;
5
+ ts: null;
6
+ version: null;
7
+ };
8
+ export type FormatsOptions = Partial<Record<Format, FormatOption>>;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import { GlyphData } from './GlyphData.mjs';
2
+ export type GlyphContentTransformFn = (_glyph: GlyphData) => string | Promise<string>;
@@ -0,0 +1,2 @@
1
+ import { GlyphData } from './GlyphData';
2
+ export type GlyphContentTransformFn = (_glyph: GlyphData) => string | Promise<string>;
@@ -0,0 +1,6 @@
1
+ import { GlyphMetadata } from './GlyphMetadata.mjs';
2
+ export type GlyphData = {
3
+ contents: string;
4
+ metadata?: GlyphMetadata;
5
+ srcPath: string;
6
+ };
@@ -0,0 +1,6 @@
1
+ export type GlyphInput = {
2
+ /** SVG source text. */
3
+ contents: string;
4
+ /** Logical path or filename used for metadata (defaults to `icon.svg`). */
5
+ srcPath?: string;
6
+ };
@@ -0,0 +1,6 @@
1
+ export type GlyphInput = {
2
+ /** SVG source text. */
3
+ contents: string;
4
+ /** Logical path or filename used for metadata (defaults to `icon.svg`). */
5
+ srcPath?: string;
6
+ };
@@ -0,0 +1,10 @@
1
+ export type GlyphMetadata = {
2
+ name: string;
3
+ /**
4
+ * @example
5
+ * ```
6
+ * obj.unicode = ["\u0001"]
7
+ * ```
8
+ */
9
+ unicode?: string[];
10
+ };
@@ -0,0 +1,2 @@
1
+ import { GlyphMetadata } from './GlyphMetadata.mjs';
2
+ export type GlyphTransformFn = (_obj: GlyphMetadata) => GlyphMetadata | Promise<GlyphMetadata>;
@@ -0,0 +1,10 @@
1
+ import { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
2
+ import { GlyphTransformFn } from './GlyphTransformFn.mjs';
3
+ import { MetadataProvider } from './MetadataProvider.mjs';
4
+ import { OptionsBase } from './OptionsBase.mjs';
5
+ export type InitialOptions = OptionsBase & {
6
+ files: string | Array<string>;
7
+ glyphContentTransformFn?: GlyphContentTransformFn;
8
+ glyphTransformFn?: GlyphTransformFn;
9
+ metadataProvider?: MetadataProvider;
10
+ };
@@ -1,8 +1,10 @@
1
+ import { GlyphContentTransformFn } from './GlyphContentTransformFn';
1
2
  import { GlyphTransformFn } from './GlyphTransformFn';
2
3
  import { MetadataProvider } from './MetadataProvider';
3
4
  import { OptionsBase } from './OptionsBase';
4
5
  export type InitialOptions = OptionsBase & {
5
6
  files: string | Array<string>;
7
+ glyphContentTransformFn?: GlyphContentTransformFn;
6
8
  glyphTransformFn?: GlyphTransformFn;
7
9
  metadataProvider?: MetadataProvider;
8
10
  };
@@ -0,0 +1,5 @@
1
+ export type FileMetadata = {
2
+ name: string;
3
+ unicode?: string | string[];
4
+ };
5
+ export type MetadataProvider = (srcPath: string, callback: (error: Error | null, metadata?: FileMetadata) => void) => void;
@@ -0,0 +1,39 @@
1
+ import { TemplateOption } from '../lib/parseTemplateOption.mjs';
2
+ import { Formats } from './Format.mjs';
3
+ import { SvgToolsOptions } from './SvgToolsOptions.mjs';
4
+ export type OptionsBase = {
5
+ configFile?: string;
6
+ dest?: string;
7
+ destCreate?: boolean;
8
+ fontName?: string | unknown;
9
+ formats?: Formats;
10
+ template?: TemplateOption;
11
+ templateClassName?: string | unknown;
12
+ templateFontPath?: string;
13
+ templateFontName?: string | unknown;
14
+ templateCacheString?: string | unknown;
15
+ destTemplate?: string | unknown;
16
+ verbose?: boolean;
17
+ fontId?: string | unknown;
18
+ fontStyle?: string | unknown;
19
+ fontWeight?: string | unknown;
20
+ fixedWidth?: string | unknown;
21
+ centerHorizontally?: boolean | unknown;
22
+ normalize?: boolean;
23
+ fontHeight?: string | unknown;
24
+ round?: string | number;
25
+ descent?: string | number;
26
+ ascent?: string;
27
+ startUnicode?: string | unknown;
28
+ prependUnicode?: boolean | unknown;
29
+ metadata?: unknown;
30
+ sort?: boolean;
31
+ ligatures?: boolean;
32
+ addHashInFontUrl?: boolean | unknown;
33
+ unicodeRange?: boolean | string | unknown;
34
+ optimizeSvg?: boolean | unknown;
35
+ svgoConfig?: unknown;
36
+ templateFontLigatures?: boolean | unknown;
37
+ /** Alpha. SVG diagnostics and optional pre-conversion fixes. */
38
+ svgTools?: SvgToolsOptions;
39
+ };
@@ -1,11 +1,13 @@
1
+ import { TemplateOption } from '../lib/parseTemplateOption';
1
2
  import { Formats } from './Format';
3
+ import { SvgToolsOptions } from './SvgToolsOptions';
2
4
  export type OptionsBase = {
3
5
  configFile?: string;
4
6
  dest?: string;
5
7
  destCreate?: boolean;
6
8
  fontName?: string | unknown;
7
9
  formats?: Formats;
8
- template?: "css" | string;
10
+ template?: TemplateOption;
9
11
  templateClassName?: string | unknown;
10
12
  templateFontPath?: string;
11
13
  templateFontName?: string | unknown;
@@ -28,4 +30,10 @@ export type OptionsBase = {
28
30
  sort?: boolean;
29
31
  ligatures?: boolean;
30
32
  addHashInFontUrl?: boolean | unknown;
33
+ unicodeRange?: boolean | string | unknown;
34
+ optimizeSvg?: boolean | unknown;
35
+ svgoConfig?: unknown;
36
+ templateFontLigatures?: boolean | unknown;
37
+ /** Alpha. SVG diagnostics and optional pre-conversion fixes. */
38
+ svgTools?: SvgToolsOptions;
31
39
  };
@@ -0,0 +1,7 @@
1
+ export type RenderedTemplate = {
2
+ /** Original template option (built-in name or custom path). */
3
+ template: string;
4
+ content: string;
5
+ /** Built-in template id when applicable (css, html, scss, …). */
6
+ builtIn?: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ export type RenderedTemplate = {
2
+ /** Original template option (built-in name or custom path). */
3
+ template: string;
4
+ content: string;
5
+ /** Built-in template id when applicable (css, html, scss, …). */
6
+ builtIn?: string;
7
+ };
@@ -0,0 +1,26 @@
1
+ import { DecompressedFont } from './DecompressedFont.mjs';
2
+ import { GlyphData } from './GlyphData.mjs';
3
+ import { RenderedTemplate } from './RenderedTemplate.mjs';
4
+ import { ResultConfig } from './ResultConfig.mjs';
5
+ import { SvgGlyphDiagnostic } from './SvgToolsOptions.mjs';
6
+ import { TranscodedFont } from './TranscodedFont.mjs';
7
+ export type { DecompressedFont } from './DecompressedFont.mjs';
8
+ export type { TranscodedFont } from './TranscodedFont.mjs';
9
+ export type Result = {
10
+ config?: ResultConfig;
11
+ decompressedFonts?: DecompressedFont[];
12
+ transcodedFonts?: TranscodedFont[];
13
+ eot?: Buffer;
14
+ glyphsData?: Array<GlyphData>;
15
+ hash?: string;
16
+ otf?: Buffer;
17
+ svg?: string | Buffer;
18
+ template?: string;
19
+ templates?: RenderedTemplate[];
20
+ ttf?: Buffer;
21
+ usedBuildInTemplate?: boolean;
22
+ woff?: Buffer;
23
+ woff2?: Buffer;
24
+ /** Alpha. Populated when `svgTools.diagnose` is enabled. */
25
+ svgDiagnostics?: SvgGlyphDiagnostic[];
26
+ };
@@ -1,18 +1,26 @@
1
1
  import { DecompressedFont } from './DecompressedFont';
2
2
  import { GlyphData } from './GlyphData';
3
+ import { RenderedTemplate } from './RenderedTemplate';
3
4
  import { ResultConfig } from './ResultConfig';
5
+ import { SvgGlyphDiagnostic } from './SvgToolsOptions';
6
+ import { TranscodedFont } from './TranscodedFont';
4
7
  export type { DecompressedFont } from './DecompressedFont';
8
+ export type { TranscodedFont } from './TranscodedFont';
5
9
  export type Result = {
6
10
  config?: ResultConfig;
7
11
  decompressedFonts?: DecompressedFont[];
12
+ transcodedFonts?: TranscodedFont[];
8
13
  eot?: Buffer;
9
14
  glyphsData?: Array<GlyphData>;
10
15
  hash?: string;
11
16
  otf?: Buffer;
12
17
  svg?: string | Buffer;
13
18
  template?: string;
19
+ templates?: RenderedTemplate[];
14
20
  ttf?: Buffer;
15
21
  usedBuildInTemplate?: boolean;
16
22
  woff?: Buffer;
17
23
  woff2?: Buffer;
24
+ /** Alpha. Populated when `svgTools.diagnose` is enabled. */
25
+ svgDiagnostics?: SvgGlyphDiagnostic[];
18
26
  };
@@ -0,0 +1,4 @@
1
+ import { WebfontOptions } from './WebfontOptions.mjs';
2
+ export type ResultConfig = WebfontOptions & {
3
+ filePath?: string;
4
+ };
@@ -0,0 +1,13 @@
1
+ export type SvgDiagnosticCode = "evenodd-fill-rule" | "stroke-only" | "unsupported-element" | "use-reference";
2
+ export type SvgGlyphDiagnostic = {
3
+ code: SvgDiagnosticCode;
4
+ message: string;
5
+ srcPath: string;
6
+ };
7
+ /** Alpha. SVG diagnostics for the icon-font pipeline (see ADR 0011 — no bundled stroke-to-fill fixes). */
8
+ export type SvgToolsOptions = {
9
+ /** Scan source SVGs for known icon-font incompatibilities and report warnings. */
10
+ diagnose?: boolean;
11
+ /** Optional sink for diagnostic log lines (for example a web worker or test spy). */
12
+ onMessage?: (message: string) => void;
13
+ };
@@ -0,0 +1,13 @@
1
+ export type SvgDiagnosticCode = "evenodd-fill-rule" | "stroke-only" | "unsupported-element" | "use-reference";
2
+ export type SvgGlyphDiagnostic = {
3
+ code: SvgDiagnosticCode;
4
+ message: string;
5
+ srcPath: string;
6
+ };
7
+ /** Alpha. SVG diagnostics for the icon-font pipeline (see ADR 0011 — no bundled stroke-to-fill fixes). */
8
+ export type SvgToolsOptions = {
9
+ /** Scan source SVGs for known icon-font incompatibilities and report warnings. */
10
+ diagnose?: boolean;
11
+ /** Optional sink for diagnostic log lines (for example a web worker or test spy). */
12
+ onMessage?: (message: string) => void;
13
+ };
@@ -0,0 +1,7 @@
1
+ export type TranscodedFont = {
2
+ source: string;
3
+ eot?: Buffer;
4
+ ttf?: Buffer;
5
+ woff?: Buffer;
6
+ woff2?: Buffer;
7
+ };
@@ -0,0 +1,7 @@
1
+ export type TranscodedFont = {
2
+ source: string;
3
+ eot?: Buffer;
4
+ ttf?: Buffer;
5
+ woff?: Buffer;
6
+ woff2?: Buffer;
7
+ };
@@ -0,0 +1,11 @@
1
+ import { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
2
+ import { GlyphInput } from './GlyphInput.mjs';
3
+ import { GlyphTransformFn } from './GlyphTransformFn.mjs';
4
+ import { MetadataProvider } from './MetadataProvider.mjs';
5
+ import { OptionsBase } from './OptionsBase.mjs';
6
+ export type WebfontFromGlyphsOptions = OptionsBase & {
7
+ glyphs: GlyphInput[];
8
+ glyphContentTransformFn?: GlyphContentTransformFn;
9
+ glyphTransformFn?: GlyphTransformFn;
10
+ metadataProvider?: MetadataProvider;
11
+ };
@@ -0,0 +1,11 @@
1
+ import { GlyphContentTransformFn } from './GlyphContentTransformFn';
2
+ import { GlyphInput } from './GlyphInput';
3
+ import { GlyphTransformFn } from './GlyphTransformFn';
4
+ import { MetadataProvider } from './MetadataProvider';
5
+ import { OptionsBase } from './OptionsBase';
6
+ export type WebfontFromGlyphsOptions = OptionsBase & {
7
+ glyphs: GlyphInput[];
8
+ glyphContentTransformFn?: GlyphContentTransformFn;
9
+ glyphTransformFn?: GlyphTransformFn;
10
+ metadataProvider?: MetadataProvider;
11
+ };
@@ -0,0 +1,43 @@
1
+ import { Config as SvgoConfig } from 'svgo';
2
+ import { TemplateOption } from '../lib/parseTemplateOption.mjs';
3
+ import { Formats, FormatsOptions } from './Format.mjs';
4
+ import { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
5
+ import { GlyphTransformFn } from './GlyphTransformFn.mjs';
6
+ import { InitialOptions } from './InitialOptions.mjs';
7
+ import { MetadataProvider } from './MetadataProvider.mjs';
8
+ import { SvgToolsOptions } from './SvgToolsOptions.mjs';
9
+ export interface WebfontOptions extends InitialOptions {
10
+ centerHorizontally: boolean;
11
+ descent: number;
12
+ fixedWidth: boolean;
13
+ fontHeight: unknown;
14
+ fontId: unknown;
15
+ fontName: string;
16
+ fontStyle: string;
17
+ fontWeight: string;
18
+ formats: Formats;
19
+ formatsOptions: FormatsOptions;
20
+ glyphTransformFn?: GlyphTransformFn;
21
+ glyphContentTransformFn?: GlyphContentTransformFn;
22
+ ligatures: boolean;
23
+ maxConcurrency: number;
24
+ metadata: unknown;
25
+ metadataProvider?: MetadataProvider;
26
+ normalize: boolean;
27
+ prependUnicode: boolean;
28
+ round: string | number;
29
+ sort: boolean;
30
+ startUnicode: number;
31
+ template?: TemplateOption;
32
+ templateCacheString?: unknown;
33
+ templateClassName?: unknown;
34
+ templateFontName?: unknown;
35
+ templateFontPath: string;
36
+ verbose: boolean;
37
+ addHashInFontUrl?: boolean;
38
+ unicodeRange?: boolean | string;
39
+ optimizeSvg?: boolean;
40
+ svgoConfig?: SvgoConfig;
41
+ templateFontLigatures?: boolean;
42
+ svgTools?: SvgToolsOptions;
43
+ }
@@ -1,7 +1,11 @@
1
+ import { Config as SvgoConfig } from 'svgo';
2
+ import { TemplateOption } from '../lib/parseTemplateOption';
1
3
  import { Formats, FormatsOptions } from './Format';
4
+ import { GlyphContentTransformFn } from './GlyphContentTransformFn';
2
5
  import { GlyphTransformFn } from './GlyphTransformFn';
3
6
  import { InitialOptions } from './InitialOptions';
4
7
  import { MetadataProvider } from './MetadataProvider';
8
+ import { SvgToolsOptions } from './SvgToolsOptions';
5
9
  export interface WebfontOptions extends InitialOptions {
6
10
  centerHorizontally: boolean;
7
11
  descent: number;
@@ -14,20 +18,26 @@ export interface WebfontOptions extends InitialOptions {
14
18
  formats: Formats;
15
19
  formatsOptions: FormatsOptions;
16
20
  glyphTransformFn?: GlyphTransformFn;
21
+ glyphContentTransformFn?: GlyphContentTransformFn;
17
22
  ligatures: boolean;
18
23
  maxConcurrency: number;
19
24
  metadata: unknown;
20
25
  metadataProvider?: MetadataProvider;
21
26
  normalize: boolean;
22
27
  prependUnicode: boolean;
23
- round: number;
28
+ round: string | number;
24
29
  sort: boolean;
25
30
  startUnicode: number;
26
- template?: string;
31
+ template?: TemplateOption;
27
32
  templateCacheString?: unknown;
28
33
  templateClassName?: unknown;
29
34
  templateFontName?: unknown;
30
35
  templateFontPath: string;
31
36
  verbose: boolean;
32
37
  addHashInFontUrl?: boolean;
38
+ unicodeRange?: boolean | string;
39
+ optimizeSvg?: boolean;
40
+ svgoConfig?: SvgoConfig;
41
+ templateFontLigatures?: boolean;
42
+ svgTools?: SvgToolsOptions;
33
43
  }
@@ -0,0 +1,8 @@
1
+ export type { Format, FormatsOptions } from '../types/Format.mjs';
2
+ export type { GlyphContentTransformFn } from './GlyphContentTransformFn.mjs';
3
+ export type { GlyphData } from './GlyphData.mjs';
4
+ export type { GlyphMetadata } from './GlyphMetadata.mjs';
5
+ export type { GlyphTransformFn } from './GlyphTransformFn.mjs';
6
+ export type { InitialOptions } from './InitialOptions.mjs';
7
+ export type { MetadataProvider } from './MetadataProvider.mjs';
8
+ export type { WebfontOptions } from './WebfontOptions.mjs';
@@ -1,4 +1,5 @@
1
- export type { Format } from '../types/Format';
1
+ export type { Format, FormatsOptions } from '../types/Format';
2
+ export type { GlyphContentTransformFn } from './GlyphContentTransformFn';
2
3
  export type { GlyphData } from './GlyphData';
3
4
  export type { GlyphMetadata } from './GlyphMetadata';
4
5
  export type { GlyphTransformFn } from './GlyphTransformFn';
@@ -0,0 +1,19 @@
1
+ export declare const getTemplateDirectory: () => string;
2
+ export declare const getTemplateFilePath: (template: string) => string;
3
+ export declare const getBuiltInTemplates: () => {
4
+ css: {
5
+ path: string;
6
+ };
7
+ html: {
8
+ path: string;
9
+ };
10
+ json: {
11
+ path: string;
12
+ };
13
+ scss: {
14
+ path: string;
15
+ };
16
+ styl: {
17
+ path: string;
18
+ };
19
+ };