@openpresentation/opf-render 0.14.0 → 0.16.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/README.md +145 -22
- package/dist/annotations.js +1 -1
- package/dist/charts.js +8 -12
- package/dist/converters.js +41 -0
- package/dist/deck-runtime.js +6 -3
- package/dist/element.d.ts +6 -0
- package/dist/element.js +31 -8
- package/dist/export-browser.d.ts +6 -0
- package/dist/export-browser.js +16 -2
- package/dist/font-registry.js +3 -3
- package/dist/fonts-node.js +24 -5
- package/dist/fonts.d.ts +3 -3
- package/dist/index.d.ts +21 -34
- package/dist/pdf-vector.js +2 -0
- package/dist/pdf.d.ts +2 -0
- package/dist/pdf.js +4 -0
- package/dist/player.d.ts +2 -1
- package/dist/png.d.ts +2 -0
- package/dist/png.js +4 -0
- package/dist/preview-fonts-node.js +2 -2
- package/dist/raster-images.js +3 -1
- package/dist/raster.js +4 -20
- package/dist/script-font-pack.js +9 -8
- package/dist/svg.d.ts +21 -34
- package/dist/svg.js +215 -179
- package/package.json +70 -17
package/dist/svg.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RenderFonts, ScriptFonts } from "./fonts.js";
|
|
2
|
-
import type { Finding } from "@openpresentation/opf";
|
|
2
|
+
import type { Catalog, Finding, UnresolvedReferenceDiagnostic } from "@openpresentation/opf";
|
|
3
3
|
import type { SlideComposition, LayoutDiagnostic, TextMeasurement } from "@openpresentation/opf/composition";
|
|
4
4
|
export declare const packageName = "@openpresentation/opf-render";
|
|
5
5
|
|
|
@@ -17,19 +17,12 @@ export declare const runtimePolicy: Readonly<{
|
|
|
17
17
|
deterministicLocalExecution: true;
|
|
18
18
|
}>;
|
|
19
19
|
|
|
20
|
+
/** What draws when nothing resolves: core's engine defaults (OPF 0.15 ships no catalog records), and the chart type a chart without `type` previews as. */
|
|
20
21
|
export declare const engineDefaults: Readonly<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
narrative: "classic-story";
|
|
26
|
-
tone: "formal";
|
|
27
|
-
audience: "executives";
|
|
28
|
-
fontScheme: Readonly<{
|
|
29
|
-
pptx: Readonly<{ latin: "aptos"; ea: "microsoft-yahei"; cs: "nirmala-ui" }>;
|
|
30
|
-
google: Readonly<{ latin: "roboto"; ea: "noto-sans-sc"; cs: "noto-sans" }>;
|
|
31
|
-
}>;
|
|
32
|
-
chartTypes: readonly ["stacked-column", "stacked-area", "line-with-markers"];
|
|
22
|
+
theme: typeof import("@openpresentation/opf/composition").ENGINE_DEFAULT_THEME;
|
|
23
|
+
colorScheme: typeof import("@openpresentation/opf/composition").ENGINE_DEFAULT_COLOR_SCHEME;
|
|
24
|
+
fontScheme: typeof import("@openpresentation/opf/composition").ENGINE_DEFAULT_FONT_SCHEME;
|
|
25
|
+
chartType: string;
|
|
33
26
|
}>;
|
|
34
27
|
|
|
35
28
|
export type RenderDiagnostic = LayoutDiagnostic | {
|
|
@@ -45,20 +38,7 @@ export type RenderDiagnostic = LayoutDiagnostic | {
|
|
|
45
38
|
code: "unsupported-pattern" | "variable-example-used" | "variable-builtin-missing" | "date-needs-value" | "language-preview-unresolved";
|
|
46
39
|
path: string;
|
|
47
40
|
message: string;
|
|
48
|
-
} | {
|
|
49
|
-
/** A font-scheme id matched no record; the default font scheme (`aptos`) was used as the base. */
|
|
50
|
-
code: "unresolved-font-scheme";
|
|
51
|
-
path: string;
|
|
52
|
-
message: string;
|
|
53
|
-
id: string;
|
|
54
|
-
fallback: string;
|
|
55
|
-
} | {
|
|
56
|
-
/** A layout, theme or colour-scheme id matched no record: the slide composed with no layout record, the `minimal` theme or the `cool-horizon` colour scheme. Never an error. */
|
|
57
|
-
code: "unresolved-layout" | "unresolved-theme" | "unresolved-color-scheme";
|
|
58
|
-
path: string;
|
|
59
|
-
message: string;
|
|
60
|
-
id: string;
|
|
61
|
-
} | {
|
|
41
|
+
} | UnresolvedReferenceDiagnostic | {
|
|
62
42
|
code: "unresolved-asset";
|
|
63
43
|
path: string;
|
|
64
44
|
message: string;
|
|
@@ -74,10 +54,12 @@ export interface RenderSvgOptions {
|
|
|
74
54
|
skipHidden?: boolean;
|
|
75
55
|
/**
|
|
76
56
|
* The fonts the deck is laid out and drawn with: the handle `loadFonts()` returns (from `@openpresentation/opf-render/fonts-node` or
|
|
77
|
-
* `/fonts-browser`), or any object with a `textMeasurement` and, to embed faces
|
|
57
|
+
* `/fonts-browser`), or any object with a `textMeasurement` and, to embed faces, an `embeddedFonts` list (each SVG carries only the faces its text draws). Without it layout uses
|
|
78
58
|
* core's portable width estimate and the SVG names the design fonts without embedding them.
|
|
79
59
|
*/
|
|
80
60
|
fonts?: RenderFonts;
|
|
61
|
+
/** `false` writes no `@font-face` data into the SVG (RR-61): the fonts handle still measures and the SVG still names the families, for a host whose page already has the faces (a browser `loadFonts` handle adds them to the document). Default true: each SVG embeds the faces of `fonts.embeddedFonts` its own text draws. */
|
|
62
|
+
embedFonts?: boolean;
|
|
81
63
|
/** `"chain"` (default): a character the resolved face lacks is drawn with the first bundled face that has it, and reported as `font-glyph-fallback`. `"none"`: exact faces, a missing glyph raises `missing-glyph`. */
|
|
82
64
|
glyphFallback?: "chain" | "none";
|
|
83
65
|
/** Unscaled reference-pixel clearance around supplied vector text outlines; default 1. */
|
|
@@ -101,13 +83,18 @@ export interface RenderSvgOptions {
|
|
|
101
83
|
*/
|
|
102
84
|
date?: string;
|
|
103
85
|
trace?: boolean;
|
|
104
|
-
catalogs?: Record<string, { records?: unknown[] } | unknown[]>;
|
|
105
86
|
/**
|
|
106
|
-
*
|
|
107
|
-
* `
|
|
108
|
-
*
|
|
87
|
+
* Catalogs the host registered (core `Catalog[]`), passed unchanged to core resolution: a reference the document does not
|
|
88
|
+
* embed resolves against the catalog whose `source` its group names, and the first entry is the default catalog for bare ids
|
|
89
|
+
* when the document omits `catalogs.default`. The renderer bundles and fetches no catalog; register the gallery snapshot with
|
|
90
|
+
* `import { defaultCatalog } from "@openpresentation/opf/catalog"` and `catalogs: [defaultCatalog]`. Omitted: only embedded
|
|
91
|
+
* records resolve, and anything else draws with core's engine defaults (reported as `unresolved-reference`).
|
|
92
|
+
* A malformed value throws core's `OPFCatalogsOptionError` (`code: "invalid-catalogs"`); a reference with an undeclared prefix
|
|
93
|
+
* (`foo:id` without `catalogs.foo`) fails the boundary check (`invalid-opf`, finding `opf/undeclared-catalog`).
|
|
109
94
|
*/
|
|
110
|
-
|
|
95
|
+
catalogs?: readonly Catalog[];
|
|
96
|
+
/** Fail with `unresolved-reference` (an OPFRenderError whose `details.diagnostics` list the references) instead of falling back when a reference resolves nowhere. Default false. */
|
|
97
|
+
strictReferences?: boolean;
|
|
111
98
|
}
|
|
112
99
|
|
|
113
100
|
export interface SvgToPngOptions {
|
|
@@ -140,7 +127,7 @@ export interface ResolvedSlide {
|
|
|
140
127
|
index: number;
|
|
141
128
|
path: string;
|
|
142
129
|
slide: unknown;
|
|
143
|
-
/** The layout record the slide names; absent when it names none or
|
|
130
|
+
/** The layout record the slide names; absent when it names none or a reference that resolves nowhere (the slide then composes automatically). */
|
|
144
131
|
layout?: unknown;
|
|
145
132
|
design: {
|
|
146
133
|
theme: unknown;
|