@presentation-md/export 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/color.d.ts +13 -0
- package/dist/color.js +75 -0
- package/dist/color.js.map +1 -0
- package/dist/context.d.ts +38 -0
- package/dist/context.js +42 -0
- package/dist/context.js.map +1 -0
- package/dist/deck-types.d.ts +59 -0
- package/dist/deck-types.js +10 -0
- package/dist/deck-types.js.map +1 -0
- package/dist/font.d.ts +11 -0
- package/dist/font.js +33 -0
- package/dist/font.js.map +1 -0
- package/dist/import/extract.d.ts +5 -0
- package/dist/import/extract.js +414 -0
- package/dist/import/extract.js.map +1 -0
- package/dist/import/index.d.ts +9 -0
- package/dist/import/index.js +16 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/map.d.ts +6 -0
- package/dist/import/map.js +189 -0
- package/dist/import/map.js.map +1 -0
- package/dist/import/types.d.ts +38 -0
- package/dist/import/types.js +6 -0
- package/dist/import/types.js.map +1 -0
- package/dist/import/zip-limits.d.ts +9 -0
- package/dist/import/zip-limits.js +15 -0
- package/dist/import/zip-limits.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.d.ts +10 -0
- package/dist/layouts.js +433 -0
- package/dist/layouts.js.map +1 -0
- package/dist/pptx.d.ts +23 -0
- package/dist/pptx.js +17 -0
- package/dist/pptx.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Timur Isachenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/color.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color utilities for PPTX export.
|
|
3
|
+
*
|
|
4
|
+
* pptxgenjs wants solid 6-digit hex (no leading `#`). Theme palettes mix plain
|
|
5
|
+
* hex (`#0e0e12`) with `rgba(...)` tokens (e.g. cardBg/border layered over the
|
|
6
|
+
* slide background). We resolve everything to an opaque hex by compositing any
|
|
7
|
+
* alpha over a known background color.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a CSS color token to opaque 6-digit hex (uppercase, no `#`).
|
|
11
|
+
* Translucent colors are composited over `background` so cards/borders stay visible.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveColor(value: string, background?: string): string;
|
package/dist/color.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color utilities for PPTX export.
|
|
3
|
+
*
|
|
4
|
+
* pptxgenjs wants solid 6-digit hex (no leading `#`). Theme palettes mix plain
|
|
5
|
+
* hex (`#0e0e12`) with `rgba(...)` tokens (e.g. cardBg/border layered over the
|
|
6
|
+
* slide background). We resolve everything to an opaque hex by compositing any
|
|
7
|
+
* alpha over a known background color.
|
|
8
|
+
*/
|
|
9
|
+
function clamp255(n) {
|
|
10
|
+
return Math.max(0, Math.min(255, Math.round(n)));
|
|
11
|
+
}
|
|
12
|
+
function toHex2(n) {
|
|
13
|
+
return clamp255(n).toString(16).padStart(2, "0");
|
|
14
|
+
}
|
|
15
|
+
/** Parse `#rgb`, `#rrggbb`, `rgb(...)`, or `rgba(...)`. Returns null if unknown. */
|
|
16
|
+
function parseColor(value) {
|
|
17
|
+
const v = value.trim();
|
|
18
|
+
if (v.startsWith("#")) {
|
|
19
|
+
const hex = v.slice(1);
|
|
20
|
+
if (hex.length === 3) {
|
|
21
|
+
const r = parseInt(hex[0] + hex[0], 16);
|
|
22
|
+
const g = parseInt(hex[1] + hex[1], 16);
|
|
23
|
+
const b = parseInt(hex[2] + hex[2], 16);
|
|
24
|
+
return { r, g, b, a: 1 };
|
|
25
|
+
}
|
|
26
|
+
if (hex.length === 6) {
|
|
27
|
+
return {
|
|
28
|
+
r: parseInt(hex.slice(0, 2), 16),
|
|
29
|
+
g: parseInt(hex.slice(2, 4), 16),
|
|
30
|
+
b: parseInt(hex.slice(4, 6), 16),
|
|
31
|
+
a: 1,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const m = v.match(/^rgba?\(([^)]+)\)$/i);
|
|
37
|
+
if (m) {
|
|
38
|
+
const parts = m[1].split(",").map((p) => p.trim());
|
|
39
|
+
if (parts.length >= 3) {
|
|
40
|
+
return {
|
|
41
|
+
r: parseFloat(parts[0]),
|
|
42
|
+
g: parseFloat(parts[1]),
|
|
43
|
+
b: parseFloat(parts[2]),
|
|
44
|
+
a: parts.length >= 4 ? parseFloat(parts[3]) : 1,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
/** Alpha-composite `fg` over `bg` (both Rgba), returning an opaque Rgba. */
|
|
51
|
+
function composite(fg, bg) {
|
|
52
|
+
const a = fg.a;
|
|
53
|
+
return {
|
|
54
|
+
r: fg.r * a + bg.r * (1 - a),
|
|
55
|
+
g: fg.g * a + bg.g * (1 - a),
|
|
56
|
+
b: fg.b * a + bg.b * (1 - a),
|
|
57
|
+
a: 1,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const FALLBACK_BG = { r: 14, g: 14, b: 18, a: 1 };
|
|
61
|
+
/**
|
|
62
|
+
* Resolve a CSS color token to opaque 6-digit hex (uppercase, no `#`).
|
|
63
|
+
* Translucent colors are composited over `background` so cards/borders stay visible.
|
|
64
|
+
*/
|
|
65
|
+
export function resolveColor(value, background = "#0e0e12") {
|
|
66
|
+
const parsed = parseColor(value);
|
|
67
|
+
if (!parsed) {
|
|
68
|
+
// Unknown (named color, gradient, etc.) — fall back to a neutral light gray.
|
|
69
|
+
return "AAAAAA";
|
|
70
|
+
}
|
|
71
|
+
const bg = parseColor(background) ?? FALLBACK_BG;
|
|
72
|
+
const solid = parsed.a < 1 ? composite(parsed, bg) : parsed;
|
|
73
|
+
return (toHex2(solid.r) + toHex2(solid.g) + toHex2(solid.b)).toUpperCase();
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,QAAQ,CAAC,CAA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,CAAC;AAED,MAAM,WAAW,GAAS,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAExD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,UAAU,GAAG,SAAS;IAChE,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,6EAA6E;QAC7E,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,WAAW,CAAC;IACjD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ResolvedTheme } from "@presentation-md/core";
|
|
2
|
+
import type { PptxShapeArg } from "./pptx.js";
|
|
3
|
+
/**
|
|
4
|
+
* Derived, PPTX-ready values for a theme: dimensions in inches, opaque hex
|
|
5
|
+
* colors, and font faces. Built once per deck and shared by every layout mapper.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExportContext {
|
|
8
|
+
/** Slide width in inches (from theme geometry.slideWidth, default 13.333"). */
|
|
9
|
+
width: number;
|
|
10
|
+
/** Slide height in inches (16:9 of width). */
|
|
11
|
+
height: number;
|
|
12
|
+
/** Outer content margin in inches. */
|
|
13
|
+
margin: number;
|
|
14
|
+
colors: {
|
|
15
|
+
bg: string;
|
|
16
|
+
bg2: string;
|
|
17
|
+
text: string;
|
|
18
|
+
muted: string;
|
|
19
|
+
accent: string;
|
|
20
|
+
accent2: string;
|
|
21
|
+
cardBg: string;
|
|
22
|
+
border: string;
|
|
23
|
+
};
|
|
24
|
+
fonts: {
|
|
25
|
+
heading: string;
|
|
26
|
+
body: string;
|
|
27
|
+
headingBold: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** pptxgenjs ShapeType handles, supplied from the presentation instance. */
|
|
30
|
+
shapeRoundRect: PptxShapeArg;
|
|
31
|
+
shapeOval: PptxShapeArg;
|
|
32
|
+
warn: (msg: string) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface ContextShapes {
|
|
35
|
+
roundRect: PptxShapeArg;
|
|
36
|
+
oval: PptxShapeArg;
|
|
37
|
+
}
|
|
38
|
+
export declare function buildContext(theme: ResolvedTheme, shapes: ContextShapes, warn: (msg: string) => void): ExportContext;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { resolveColor } from "./color.js";
|
|
2
|
+
import { parseFontFamily, isBoldWeight } from "./font.js";
|
|
3
|
+
const PX_PER_INCH = 96;
|
|
4
|
+
function parsePxToInches(value, fallback) {
|
|
5
|
+
const m = value.match(/([\d.]+)\s*px/i);
|
|
6
|
+
if (m) {
|
|
7
|
+
const px = parseFloat(m[1]);
|
|
8
|
+
if (Number.isFinite(px) && px > 0)
|
|
9
|
+
return px / PX_PER_INCH;
|
|
10
|
+
}
|
|
11
|
+
const n = parseFloat(value);
|
|
12
|
+
return Number.isFinite(n) && n > 0 ? n / PX_PER_INCH : fallback;
|
|
13
|
+
}
|
|
14
|
+
export function buildContext(theme, shapes, warn) {
|
|
15
|
+
const width = parsePxToInches(theme.geometry.slideWidth, 13.333);
|
|
16
|
+
const height = (width * 9) / 16;
|
|
17
|
+
const bg = resolveColor(theme.palette.bg);
|
|
18
|
+
return {
|
|
19
|
+
width,
|
|
20
|
+
height,
|
|
21
|
+
margin: Math.min(0.6, width * 0.05),
|
|
22
|
+
colors: {
|
|
23
|
+
bg,
|
|
24
|
+
bg2: resolveColor(theme.palette.bg2, theme.palette.bg),
|
|
25
|
+
text: resolveColor(theme.palette.text, theme.palette.bg),
|
|
26
|
+
muted: resolveColor(theme.palette.muted, theme.palette.bg),
|
|
27
|
+
accent: resolveColor(theme.palette.accent, theme.palette.bg),
|
|
28
|
+
accent2: resolveColor(theme.palette.accent2, theme.palette.bg),
|
|
29
|
+
cardBg: resolveColor(theme.palette.cardBg, theme.palette.bg),
|
|
30
|
+
border: resolveColor(theme.palette.border, theme.palette.bg),
|
|
31
|
+
},
|
|
32
|
+
fonts: {
|
|
33
|
+
heading: parseFontFamily(theme.typography.headingFont),
|
|
34
|
+
body: parseFontFamily(theme.typography.bodyFont),
|
|
35
|
+
headingBold: isBoldWeight(theme.typography.headingWeight),
|
|
36
|
+
},
|
|
37
|
+
shapeRoundRect: shapes.roundRect,
|
|
38
|
+
shapeOval: shapes.oval,
|
|
39
|
+
warn,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAuC1D,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,SAAS,eAAe,CAAC,KAAa,EAAE,QAAgB;IACtD,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,CAAC;QACN,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;QAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;YAAE,OAAO,EAAE,GAAG,WAAW,CAAC;I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C,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5D,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;SAC7D;QACD,KAAK,EAAE;YACL,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;YACtD,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChD,WAAW,EAAE,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;SAC1D;QACD,cAAc,EAAE,MAAM,CAAC,SAAS;QAChC,SAAS,EAAE,MAAM,CAAC,IAAI;QACtB,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deck/slide shape, mirroring `packages/core/deck.schema.json`.
|
|
3
|
+
*
|
|
4
|
+
* The schema in core is the single source of truth for *validation*; these
|
|
5
|
+
* types describe the same shape for the exporter so it can map fields to
|
|
6
|
+
* native slide shapes without re-parsing JSON. Validation stays in core
|
|
7
|
+
* (`validateDeckJson`) and is run by callers (CLI / MCP / studio) before export.
|
|
8
|
+
*/
|
|
9
|
+
export type LayoutType = "title" | "two-column" | "feature-grid" | "quote" | "data-table" | "stat-row" | "timeline" | "section" | "closing";
|
|
10
|
+
export interface Card {
|
|
11
|
+
icon?: string;
|
|
12
|
+
title: string;
|
|
13
|
+
body?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Stat {
|
|
16
|
+
value: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
export interface Step {
|
|
20
|
+
title: string;
|
|
21
|
+
body?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Cta {
|
|
24
|
+
label?: string;
|
|
25
|
+
href?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Slide {
|
|
28
|
+
layout: LayoutType | string;
|
|
29
|
+
eyebrow?: string;
|
|
30
|
+
heading?: string;
|
|
31
|
+
lead?: string;
|
|
32
|
+
body?: string;
|
|
33
|
+
image?: string;
|
|
34
|
+
imageAlt?: string;
|
|
35
|
+
quote?: string;
|
|
36
|
+
by?: string;
|
|
37
|
+
number?: string;
|
|
38
|
+
/** feature-grid: column count (2-4). data-table: header labels. */
|
|
39
|
+
columns?: number | string[];
|
|
40
|
+
cards?: Card[];
|
|
41
|
+
rows?: string[][];
|
|
42
|
+
stats?: Stat[];
|
|
43
|
+
steps?: Step[];
|
|
44
|
+
cta?: Cta;
|
|
45
|
+
/** Speaker notes (e.g. from PPTX import); not rendered on the slide. */
|
|
46
|
+
notes?: string;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
export interface DeckMeta {
|
|
50
|
+
title?: string;
|
|
51
|
+
company?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
theme?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DeckJson {
|
|
56
|
+
type: "deck";
|
|
57
|
+
meta?: DeckMeta;
|
|
58
|
+
slides: Slide[];
|
|
59
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deck/slide shape, mirroring `packages/core/deck.schema.json`.
|
|
3
|
+
*
|
|
4
|
+
* The schema in core is the single source of truth for *validation*; these
|
|
5
|
+
* types describe the same shape for the exporter so it can map fields to
|
|
6
|
+
* native slide shapes without re-parsing JSON. Validation stays in core
|
|
7
|
+
* (`validateDeckJson`) and is run by callers (CLI / MCP / studio) before export.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=deck-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deck-types.js","sourceRoot":"","sources":["../src/deck-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/dist/font.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Font utilities.
|
|
3
|
+
*
|
|
4
|
+
* Theme typography stores CSS font stacks like `'Montserrat', system-ui, sans-serif`.
|
|
5
|
+
* PowerPoint wants a single face name; it substitutes a local font if the named
|
|
6
|
+
* family isn't installed. We extract the first concrete family from the stack.
|
|
7
|
+
* (Fidelity note: web fonts won't render identically in Office unless installed —
|
|
8
|
+
* documented in references/pptx-fidelity.md.)
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseFontFamily(cssFont: string): string;
|
|
11
|
+
export declare function isBoldWeight(weight: string | number): boolean;
|
package/dist/font.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Font utilities.
|
|
3
|
+
*
|
|
4
|
+
* Theme typography stores CSS font stacks like `'Montserrat', system-ui, sans-serif`.
|
|
5
|
+
* PowerPoint wants a single face name; it substitutes a local font if the named
|
|
6
|
+
* family isn't installed. We extract the first concrete family from the stack.
|
|
7
|
+
* (Fidelity note: web fonts won't render identically in Office unless installed —
|
|
8
|
+
* documented in references/pptx-fidelity.md.)
|
|
9
|
+
*/
|
|
10
|
+
export function parseFontFamily(cssFont) {
|
|
11
|
+
const first = cssFont.split(",")[0]?.trim() ?? "";
|
|
12
|
+
const unquoted = first.replace(/^['"]|['"]$/g, "").trim();
|
|
13
|
+
// Skip generic/system keywords if they somehow lead the stack.
|
|
14
|
+
const generic = new Set([
|
|
15
|
+
"system-ui",
|
|
16
|
+
"sans-serif",
|
|
17
|
+
"serif",
|
|
18
|
+
"monospace",
|
|
19
|
+
"ui-sans-serif",
|
|
20
|
+
"ui-serif",
|
|
21
|
+
"ui-monospace",
|
|
22
|
+
"-apple-system",
|
|
23
|
+
]);
|
|
24
|
+
if (!unquoted || generic.has(unquoted.toLowerCase())) {
|
|
25
|
+
return "Arial";
|
|
26
|
+
}
|
|
27
|
+
return unquoted;
|
|
28
|
+
}
|
|
29
|
+
export function isBoldWeight(weight) {
|
|
30
|
+
const n = typeof weight === "number" ? weight : parseInt(weight, 10);
|
|
31
|
+
return Number.isFinite(n) ? n >= 600 : false;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=font.js.map
|
package/dist/font.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font.js","sourceRoot":"","sources":["../src/font.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,+DAA+D;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC;QACtB,WAAW;QACX,YAAY;QACZ,OAAO;QACP,WAAW;QACX,eAAe;QACf,UAAU;QACV,cAAc;QACd,eAAe;KAChB,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACrD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAuB;IAClD,MAAM,CAAC,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/C,CAAC"}
|