@printwithsynergy/lens-pdf 0.3.0-beta.85 → 0.3.0-beta.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Adapters — pure TypeScript, no React. Map raw engine outputs
3
+ * (codex, lint-pdf, callas, pitstop) to the types lens-pdf accepts
4
+ * as props. Import from `@printwithsynergy/lens-pdf/adapters`.
5
+ *
6
+ * Zero custom glue code needed in demos: pass raw engine responses
7
+ * to `<LensPDF dataConfig={...}>` and lens handles the mapping.
8
+ */
9
+ import type { OverlayItem } from "../plugin/types";
10
+ import type { DielineResult } from "../types";
11
+ /**
12
+ * Raw engine outputs. Pass to `<LensPDF dataConfig={...}>` and lens
13
+ * maps them internally — no host-side adapter code required.
14
+ *
15
+ * @public
16
+ */
17
+ export interface LensPDFDataConfig {
18
+ /** Raw codex `ExtractResponse.summary` object. */
19
+ codexSummary?: Record<string, unknown> | null;
20
+ /** Raw codex `ExtractResponse.findings` array. */
21
+ codexFindings?: ReadonlyArray<Record<string, unknown>> | null;
22
+ /** Raw lint-pdf engine findings array. */
23
+ lintFindings?: ReadonlyArray<Record<string, unknown>> | null;
24
+ /** Raw callas PDF Toolbox / pdfaPilot hits array. */
25
+ callasFindings?: ReadonlyArray<Record<string, unknown>> | null;
26
+ /** Raw Enfocus PitStop results array. */
27
+ pitstopFindings?: ReadonlyArray<Record<string, unknown>> | null;
28
+ /** Raw artwork-pdf preflight issues array. */
29
+ artworkFindings?: ReadonlyArray<Record<string, unknown>> | null;
30
+ }
31
+ /**
32
+ * Map a raw codex `summary` object to a lens dieline result and spot
33
+ * palette. Backward-compatible: falls back to `(0, 0)` origin when the
34
+ * codex version predates the `x0_pt` / `y0_pt` fields.
35
+ *
36
+ * @public
37
+ */
38
+ export declare function fromCodexSummary(summary: Record<string, unknown>): {
39
+ dieline: DielineResult | null;
40
+ spotPalette: Record<string, string> | undefined;
41
+ };
42
+ /**
43
+ * Map raw codex `findings[]` to `OverlayItem[]`. Codex findings are
44
+ * already 1-indexed and use the same severity vocabulary as lens tiers,
45
+ * so this is a direct mapping.
46
+ *
47
+ * @public
48
+ */
49
+ export declare function fromCodexFindings(findings: ReadonlyArray<Record<string, unknown>>): OverlayItem[];
50
+ /**
51
+ * Map raw lint-pdf engine findings to `OverlayItem[]`. Lint engine
52
+ * emits 0-indexed `page_num`; OverlayItem expects 1-indexed.
53
+ *
54
+ * @public
55
+ */
56
+ export declare function fromLintFindings(findings: ReadonlyArray<Record<string, unknown>>): OverlayItem[];
57
+ /**
58
+ * Map raw callas PDF Toolbox / pdfaPilot hit objects to `OverlayItem[]`.
59
+ * Callas shape: `{ severity, message, page, rule, ... }` per hit.
60
+ *
61
+ * @public
62
+ */
63
+ export declare function fromCallasFindings(findings: ReadonlyArray<Record<string, unknown>>): OverlayItem[];
64
+ /**
65
+ * Map raw Enfocus PitStop result objects to `OverlayItem[]`.
66
+ * PitStop shape: `{ level, description, pageNumber, checkName, ... }`.
67
+ *
68
+ * @public
69
+ */
70
+ export declare function fromPitstopFindings(findings: ReadonlyArray<Record<string, unknown>>): OverlayItem[];
71
+ /**
72
+ * Map raw artwork-pdf `PreflightIssue[]` to `OverlayItem[]`.
73
+ * Remaps legacy severity vocab: `"block"` → `"error"`, `"warn"` →
74
+ * `"warning"`. Handles missing bbox gracefully (no canvas overlay).
75
+ *
76
+ * @public
77
+ */
78
+ export declare function fromArtworkFindings(findings: ReadonlyArray<Record<string, unknown>>): OverlayItem[];
79
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAM9C;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB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a,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC/C,WAAW,EAAE,CA8Bf;AAMD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC/C,WAAW,EAAE,CAgCf;AAMD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC/C,WAAW,EAAE,CAsCf"}
@@ -0,0 +1,307 @@
1
+ /**
2
+ * Adapters — pure TypeScript, no React. Map raw engine outputs
3
+ * (codex, lint-pdf, callas, pitstop) to the types lens-pdf accepts
4
+ * as props. Import from `@printwithsynergy/lens-pdf/adapters`.
5
+ *
6
+ * Zero custom glue code needed in demos: pass raw engine responses
7
+ * to `<LensPDF dataConfig={...}>` and lens handles the mapping.
8
+ */
9
+ // ---------------------------------------------------------------------------
10
+ // Internal helpers
11
+ // ---------------------------------------------------------------------------
12
+ const KNOWN_TIERS = new Set(["error", "warning", "advisory", "info", "neutral"]);
13
+ function pickTier(severity) {
14
+ const v = (typeof severity === "string" ? severity : "").toLowerCase();
15
+ if (KNOWN_TIERS.has(v))
16
+ return v;
17
+ if (v === "fail" || v === "blocker" || v === "critical")
18
+ return "error";
19
+ if (v === "warn")
20
+ return "warning";
21
+ return "info";
22
+ }
23
+ function truncate(s, n) {
24
+ return s.length > n ? `${s.slice(0, n - 1).trimEnd()}…` : s;
25
+ }
26
+ function asBbox(v) {
27
+ if (Array.isArray(v) &&
28
+ v.length === 4 &&
29
+ v.every((x) => typeof x === "number")) {
30
+ return [v[0], v[1], v[2], v[3]];
31
+ }
32
+ return undefined;
33
+ }
34
+ // ---------------------------------------------------------------------------
35
+ // fromCodexSummary
36
+ // ---------------------------------------------------------------------------
37
+ /**
38
+ * Map a raw codex `summary` object to a lens dieline result and spot
39
+ * palette. Backward-compatible: falls back to `(0, 0)` origin when the
40
+ * codex version predates the `x0_pt` / `y0_pt` fields.
41
+ *
42
+ * @public
43
+ */
44
+ export function fromCodexSummary(summary) {
45
+ // --- dieline ---
46
+ let dieline = null;
47
+ const die = summary.dieline;
48
+ if (die && typeof die === "object") {
49
+ const d = die;
50
+ const size = d.size && typeof d.size === "object"
51
+ ? d.size
52
+ : null;
53
+ if (size && size.available === true) {
54
+ const widthPt = typeof size.width_pt === "number" ? size.width_pt : 0;
55
+ const heightPt = typeof size.height_pt === "number" ? size.height_pt : 0;
56
+ const x0 = typeof size.x0_pt === "number" ? size.x0_pt : 0;
57
+ const y0 = typeof size.y0_pt === "number" ? size.y0_pt : 0;
58
+ const widthMm = typeof size.width_mm === "number"
59
+ ? size.width_mm
60
+ : (widthPt * 25.4) / 72;
61
+ const heightMm = typeof size.height_mm === "number"
62
+ ? size.height_mm
63
+ : (heightPt * 25.4) / 72;
64
+ const candidates = Array.isArray(d.candidates) ? d.candidates : [];
65
+ const firstNamed = candidates
66
+ .filter((c) => Boolean(c && typeof c === "object"))
67
+ .find((c) => typeof c.name === "string" &&
68
+ c.source !== "analysis_stroke_bbox");
69
+ const overallConf = typeof d.overall_confidence === "number" ? d.overall_confidence : 0;
70
+ const sizeConf = typeof size.confidence === "number" ? size.confidence : 0;
71
+ dieline = {
72
+ source: firstNamed ? "name" : "vision",
73
+ polylines: [],
74
+ spot_name: firstNamed && typeof firstNamed.name === "string"
75
+ ? firstNamed.name
76
+ : null,
77
+ confidence: Math.max(0, Math.min(1, overallConf || sizeConf)),
78
+ regions: [
79
+ {
80
+ x0,
81
+ y0,
82
+ x1: x0 + widthPt,
83
+ y1: y0 + heightPt,
84
+ width_mm: widthMm,
85
+ height_mm: heightMm,
86
+ },
87
+ ],
88
+ multi_color: false,
89
+ };
90
+ }
91
+ }
92
+ // --- spot palette ---
93
+ let spotPalette;
94
+ const sc = summary.spot_colors;
95
+ if (sc && typeof sc === "object") {
96
+ const colors = sc.colors;
97
+ if (Array.isArray(colors) && colors.length > 0) {
98
+ const out = {};
99
+ for (const entry of colors) {
100
+ if (!entry || typeof entry !== "object")
101
+ continue;
102
+ const e = entry;
103
+ const name = typeof e.name === "string" ? e.name.trim() : "";
104
+ const hex = typeof e.swatch_hex === "string" ? e.swatch_hex.trim() : "";
105
+ if (name && hex)
106
+ out[name] = hex;
107
+ }
108
+ if (Object.keys(out).length > 0)
109
+ spotPalette = out;
110
+ }
111
+ }
112
+ return { dieline, spotPalette };
113
+ }
114
+ // ---------------------------------------------------------------------------
115
+ // fromCodexFindings
116
+ // ---------------------------------------------------------------------------
117
+ /**
118
+ * Map raw codex `findings[]` to `OverlayItem[]`. Codex findings are
119
+ * already 1-indexed and use the same severity vocabulary as lens tiers,
120
+ * so this is a direct mapping.
121
+ *
122
+ * @public
123
+ */
124
+ export function fromCodexFindings(findings) {
125
+ return findings.map((f, i) => {
126
+ const id = typeof f.id === "string" && f.id
127
+ ? `codex-${f.id}`
128
+ : `codex-finding-${i}`;
129
+ const tier = pickTier(f.severity);
130
+ const page = typeof f.page === "number" && f.page > 0 ? f.page : 1;
131
+ const bbox = asBbox(f.bbox);
132
+ const message = typeof f.message === "string" && f.message
133
+ ? f.message
134
+ : String(f.type ?? "finding");
135
+ const code = typeof f.type === "string" ? f.type : undefined;
136
+ return {
137
+ id,
138
+ page,
139
+ bbox,
140
+ tier,
141
+ code,
142
+ label: truncate(message, 80),
143
+ description: message,
144
+ data: f,
145
+ };
146
+ });
147
+ }
148
+ // ---------------------------------------------------------------------------
149
+ // fromLintFindings
150
+ // ---------------------------------------------------------------------------
151
+ /**
152
+ * Map raw lint-pdf engine findings to `OverlayItem[]`. Lint engine
153
+ * emits 0-indexed `page_num`; OverlayItem expects 1-indexed.
154
+ *
155
+ * @public
156
+ */
157
+ export function fromLintFindings(findings) {
158
+ return findings.map((f, i) => {
159
+ const code = (typeof f.inspection_id === "string" && f.inspection_id) ||
160
+ (typeof f.rule_id === "string" && f.rule_id) ||
161
+ (typeof f.code === "string" && f.code) ||
162
+ "lintpdf";
163
+ const message = (typeof f.message === "string" && f.message) ||
164
+ (typeof f.description === "string" && f.description) ||
165
+ code;
166
+ const id = typeof f.id === "string" && f.id ? f.id : `lintpdf-${code}-${i}`;
167
+ const tier = pickTier((f.severity ?? f.level));
168
+ const page = typeof f.page_num === "number"
169
+ ? f.page_num + 1
170
+ : typeof f.page === "number"
171
+ ? f.page > 0
172
+ ? f.page
173
+ : 1
174
+ : 1;
175
+ const bbox = asBbox(f.bbox);
176
+ return {
177
+ id,
178
+ page,
179
+ bbox,
180
+ tier,
181
+ code,
182
+ label: truncate(message, 80),
183
+ description: message,
184
+ data: f,
185
+ };
186
+ });
187
+ }
188
+ // ---------------------------------------------------------------------------
189
+ // fromCallasFindings
190
+ // ---------------------------------------------------------------------------
191
+ /**
192
+ * Map raw callas PDF Toolbox / pdfaPilot hit objects to `OverlayItem[]`.
193
+ * Callas shape: `{ severity, message, page, rule, ... }` per hit.
194
+ *
195
+ * @public
196
+ */
197
+ export function fromCallasFindings(findings) {
198
+ return findings.map((f, i) => {
199
+ const severity = f.severity ?? f.level ?? f.type;
200
+ const tier = pickTier(severity);
201
+ const message = (typeof f.message === "string" && f.message) ||
202
+ (typeof f.description === "string" && f.description) ||
203
+ (typeof f.rule === "string" && f.rule) ||
204
+ `callas-${i}`;
205
+ const code = (typeof f.rule === "string" && f.rule) ||
206
+ (typeof f.checkName === "string" && f.checkName) ||
207
+ undefined;
208
+ const rawPage = f.page ?? f.pageNumber ?? f.page_num;
209
+ const page = typeof rawPage === "number" ? (rawPage > 0 ? rawPage : 1) : 1;
210
+ const id = typeof f.id === "string" && f.id ? f.id : `callas-${code ?? i}-${i}`;
211
+ const bbox = asBbox(f.bbox ?? f.rect);
212
+ return {
213
+ id,
214
+ page,
215
+ bbox,
216
+ tier,
217
+ code,
218
+ label: truncate(message, 80),
219
+ description: message,
220
+ data: f,
221
+ };
222
+ });
223
+ }
224
+ // ---------------------------------------------------------------------------
225
+ // fromPitstopFindings
226
+ // ---------------------------------------------------------------------------
227
+ /**
228
+ * Map raw Enfocus PitStop result objects to `OverlayItem[]`.
229
+ * PitStop shape: `{ level, description, pageNumber, checkName, ... }`.
230
+ *
231
+ * @public
232
+ */
233
+ export function fromPitstopFindings(findings) {
234
+ return findings.map((f, i) => {
235
+ const severity = f.level ?? f.severity ?? f.type;
236
+ const tier = pickTier(severity);
237
+ const message = (typeof f.description === "string" && f.description) ||
238
+ (typeof f.message === "string" && f.message) ||
239
+ (typeof f.checkName === "string" && f.checkName) ||
240
+ `pitstop-${i}`;
241
+ const code = (typeof f.checkName === "string" && f.checkName) ||
242
+ (typeof f.rule === "string" && f.rule) ||
243
+ undefined;
244
+ const rawPage = f.pageNumber ?? f.page_num ?? f.page;
245
+ const page = typeof rawPage === "number" ? (rawPage > 0 ? rawPage : 1) : 1;
246
+ const id = typeof f.id === "string" && f.id
247
+ ? f.id
248
+ : `pitstop-${code ?? i}-${i}`;
249
+ const bbox = asBbox(f.bbox ?? f.rect);
250
+ return {
251
+ id,
252
+ page,
253
+ bbox,
254
+ tier,
255
+ code,
256
+ label: truncate(message, 80),
257
+ description: message,
258
+ data: f,
259
+ };
260
+ });
261
+ }
262
+ // ---------------------------------------------------------------------------
263
+ // fromArtworkFindings
264
+ // ---------------------------------------------------------------------------
265
+ /**
266
+ * Map raw artwork-pdf `PreflightIssue[]` to `OverlayItem[]`.
267
+ * Remaps legacy severity vocab: `"block"` → `"error"`, `"warn"` →
268
+ * `"warning"`. Handles missing bbox gracefully (no canvas overlay).
269
+ *
270
+ * @public
271
+ */
272
+ export function fromArtworkFindings(findings) {
273
+ return findings.flatMap((f, i) => {
274
+ const rawSev = typeof f.severity === "string" ? f.severity : "";
275
+ const tier = rawSev === "block"
276
+ ? "error"
277
+ : rawSev === "warn"
278
+ ? "warning"
279
+ : (["error", "warning", "advisory", "info"].includes(rawSev)
280
+ ? rawSev
281
+ : "advisory");
282
+ const page = typeof f.page === "number" && f.page > 0 ? f.page : 1;
283
+ const bbox = asBbox(f.bbox);
284
+ const message = (typeof f.message === "string" && f.message) ||
285
+ (typeof f.checkName === "string" && f.checkName) ||
286
+ `artwork-${i}`;
287
+ const code = (typeof f.checkName === "string" && f.checkName) ||
288
+ (typeof f.type === "string" && f.type) ||
289
+ undefined;
290
+ const id = typeof f.id === "string" && f.id
291
+ ? f.id
292
+ : `artwork-${code ?? i}-${i}`;
293
+ return [
294
+ {
295
+ id,
296
+ page,
297
+ bbox,
298
+ tier,
299
+ code,
300
+ label: truncate(message, 80),
301
+ description: message,
302
+ data: f,
303
+ },
304
+ ];
305
+ });
306
+ }
307
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8BH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAEjF,SAAS,QAAQ,CAAC,QAAiB;IACjC,MAAM,CAAC,GAAG,CAAC,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACvE,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAAE,OAAO,CAAwB,CAAC;IACxD,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,UAAU;QAAE,OAAO,OAAO,CAAC;IACxE,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC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AAC,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,CAAC;YAChD,WAAW,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,GACR,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,CAAC;YAChD,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC;YACtC,SAAS,CAAC;QACZ,MAAM,EAAE,GACN,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC,EAAE;YAC9B,CAAC,CAAC,CAAC,CAAC,EAAE;YACN,CAAC,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,OAAO;YACL;gBACE,EAAE;gBACF,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;gBAC5B,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,CAAC;aACR;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,61 +1,171 @@
1
+ import type { ReactNode } from "react";
2
+ import { type MinimalCodexClient } from "../browser";
3
+ import type { ThemeTokens, ViewerServices } from "../plugin/services";
4
+ import type { OverlayItem } from "../plugin/types";
5
+ import type { DielineResult } from "../types";
6
+ import { type LensPDFPresetKind } from "./presets";
7
+ import { type LensPDFShellPlugin } from "./shellPlugins";
8
+ import type { LensPDFDataConfig } from "../adapters";
1
9
  /**
2
- * `<LensPDF>` drop-in production viewer.
3
- *
4
- * One mount, every viewer-only feature wired by default:
5
- *
6
- * ```tsx
7
- * import { LensPDF } from "@printwithsynergy/lens-pdf";
8
- * import pdfWorkerSrc from "pdfjs-dist/build/pdf.worker.mjs?url";
9
- *
10
- * <LensPDF pdfUrl="/proofs/abc.pdf" workerSrc={pdfWorkerSrc} />
11
- * ```
12
- *
13
- * Production hosts can plug in their own preflight engine without
14
- * forking the viewer:
15
- *
16
- * ```tsx
17
- * <LensPDF
18
- * pdfUrl="/proofs/abc.pdf"
19
- * workerSrc={pdfWorkerSrc}
20
- * items={findings} // OverlayItem[] from your engine
21
- * selectedItem={selected}
22
- * onItemSelect={setSelected}
23
- * dieline={dielineForCurrentPage}
24
- * showBoxOverlays // trim / bleed / crop popovers
25
- * tools={["color-picker", "annotate", "tac-heatmap", "separations"]}
26
- * onPageChange={setCurrentPage}
27
- * tokens={{ accent: "#e50c6a" }}
28
- * />
29
- * ```
30
- *
31
- * Identical to {@link LensPDFDemo} except the upload chrome (URL bar,
32
- * file picker, drag-and-drop, empty state) is hidden — `pdfUrl` is the
33
- * single required prop, and changing it swaps the loaded document.
10
+ * Tool ids the viewer's sidebar can show. The `tools` prop accepts any
11
+ * subset; default is every tool. Passing `[]` hides the entire tool
12
+ * column, giving consumers a "viewer only" mount.
34
13
  *
35
14
  * @public
36
15
  */
37
- import { type LensPDFDemoProps } from "./LensPDFDemo";
16
+ export type LensPDFTool = "color-picker" | "densitometer" | "measure" | "annotate" | "tac-heatmap" | "separations" | "layers";
38
17
  /**
39
- * Props for {@link LensPDF}. Identical to {@link LensPDFDemoProps}
40
- * except `pdfUrl` is required (replaces `initialPdfUrl`) and the
41
- * upload-chrome props (`maxFileSize`) are hidden.
18
+ * Props for {@link LensPDF}.
42
19
  *
43
20
  * @public
44
21
  */
45
- export interface LensPDFProps extends Omit<LensPDFDemoProps, "embedded" | "initialPdfUrl" | "maxFileSize"> {
22
+ export interface LensPDFProps {
46
23
  /**
47
- * URL of the PDF to load. Any URL the browser can fetch — your
48
- * own CDN, a signed link, a `blob:` URL from a `File` your app
49
- * uploaded, etc. Changing this swaps the document and resets to
50
- * `initialPage`.
24
+ * URL of the PDF to load. Any URL the browser can fetch — your own
25
+ * CDN, a signed link, a `blob:` URL from a `File` your app uploaded.
26
+ * Changing this swaps the document and resets to `initialPage`.
51
27
  */
52
28
  pdfUrl: string;
29
+ /** Theme tokens. Defaults to {@link darkThemeTokens}. */
30
+ tokens?: Partial<ThemeTokens>;
31
+ /** Brand label shown in the viewer footer. Default: "LensPDF". */
32
+ brand?: string;
33
+ /**
34
+ * Brand logo URL. Consumed by {@link LensPDFDemo}'s upload header;
35
+ * accepted here for prop parity so a shared config object can be
36
+ * spread onto either component.
37
+ */
38
+ brandLogoUrl?: string;
39
+ /** Optional className on the outermost div. */
40
+ className?: string;
41
+ /** Tools to show in the sidebar. Default: every tool. */
42
+ tools?: ReadonlyArray<LensPDFTool>;
43
+ /** Initial zoom percentage. Default: 80. */
44
+ initialZoom?: number;
45
+ /** TAC limit for the heatmap + densitometer. Default: 300. */
46
+ tacLimit?: number;
47
+ /** Override pdf.js worker URL (unpkg by default). */
48
+ workerSrc?: string;
49
+ /**
50
+ * Pre-built services. When provided, Lens uses them where wired and
51
+ * automatically falls back to in-browser RGB/pdf.js services for any
52
+ * unwired capability. This keeps LintPDF/backends optional.
53
+ */
54
+ services?: ViewerServices;
55
+ /** Optional footer content below the viewer. */
56
+ footer?: ReactNode;
57
+ /** When true, renders full-viewport with fixed positioning. */
58
+ fullscreen?: boolean;
59
+ /** Initial page number (1-indexed). Default: 1. */
60
+ initialPage?: number;
61
+ /**
62
+ * Findings to flag on the page raster. Hosts convert their domain
63
+ * records (engine findings, brand-spec violations, etc.) into
64
+ * `OverlayItem`s. PageCanvas draws the bbox tinted by `tier`,
65
+ * PageNavigator badges errors / warnings per page.
66
+ */
67
+ items?: readonly OverlayItem[];
68
+ /**
69
+ * Force the Inspection / Findings side-panel slot visible even when
70
+ * ``items`` is empty. Renders an empty "no findings yet" state so
71
+ * the slot stays in the layout. Defaults to ``false`` — hosts
72
+ * without preflight data don't see a placeholder panel.
73
+ *
74
+ * Useful for:
75
+ * - Demos that want the panel discoverable from the first frame.
76
+ * - Hosts with an in-flight preflight call (stable layout while it
77
+ * loads).
78
+ * - Adapters where the user explicitly toggles preflight on/off in
79
+ * the UI and you want to keep the slot mounted across that toggle.
80
+ */
81
+ forceInspectionPanel?: boolean;
82
+ /**
83
+ * Spot-color palette keyed by spot name (case insensitive). Wins
84
+ * over the Pantone Gold library + the PDF's ``altRgb`` fallback in
85
+ * the separations panel swatch render. Hosts that have richer
86
+ * sources of truth (codex's ``summary.spot_colors.colors[].swatch_hex``,
87
+ * a callas / PitStop / Acrobat preflight report, an internal
88
+ * swatch DB) pass values here.
89
+ *
90
+ * Example: ``{ "PANTONE 225 C": "#c6168d", "PANTONE 236 C": "#da1884" }``.
91
+ */
92
+ spotPalette?: Record<string, string>;
93
+ /** Currently-selected finding (controlled). Drives the canvas
94
+ * highlight + tooltip. */
95
+ selectedItem?: OverlayItem | null;
96
+ /** Fires when the user clicks a finding's bbox or the page background
97
+ * (in which case the argument is `null`). */
98
+ onItemSelect?: (item: OverlayItem | null) => void;
99
+ /**
100
+ * Dieline payload for the current page. When non-null, mounts
101
+ * `<DielineOverlay>` so each detected artwork region gets a
102
+ * size-popover info chip at its centroid (mm + inches).
103
+ */
104
+ dieline?: DielineResult | null;
105
+ /**
106
+ * When true, mounts `<BoxOverlay>` so trim / bleed / crop boxes
107
+ * defined in the PDF render with size popovers. Hosts that don't
108
+ * carry box geometry can leave this off (default).
109
+ */
110
+ showBoxOverlays?: boolean;
111
+ /**
112
+ * When true, the canvas is clipped to the page's TrimBox (falls
113
+ * back to BleedBox, then CropBox). Hides the white bleed strip
114
+ * outside the trim line. Default false.
115
+ */
116
+ cropToTrim?: boolean;
117
+ /** Fires after the active page changes (1-indexed). */
118
+ onPageChange?: (page: number) => void;
119
+ /** Fires after the zoom level changes (percentage). */
120
+ onZoomChange?: (zoom: number) => void;
121
+ /** Fires when the viewer raises a recoverable error. */
122
+ onError?: (message: string) => void;
123
+ /** First-party plugin preset used as the base composition. */
124
+ preset?: LensPDFPresetKind;
125
+ /**
126
+ * Additional shell plugins (or replacements) for panels and toolbar
127
+ * slots. Use `replaces` on your plugin to override a built-in one.
128
+ */
129
+ plugins?: ReadonlyArray<LensPDFShellPlugin>;
130
+ /**
131
+ * Zero-glue data config. Pass raw engine outputs here — lens maps
132
+ * them internally. Findings from all sources are shown together in
133
+ * the Inspection panel; dieline and spot palette from codex fill in
134
+ * as defaults when the explicit `dieline` / `spotPalette` props are
135
+ * absent.
136
+ *
137
+ * Supported engines: codex (`codexSummary` + `codexFindings`),
138
+ * lint-pdf (`lintFindings`), callas (`callasFindings`), PitStop
139
+ * (`pitstopFindings`).
140
+ */
141
+ dataConfig?: LensPDFDataConfig;
142
+ /**
143
+ * Optional codex client. When provided, `<LensPDFDemo>` fires
144
+ * `extractStream` in the background after each PDF loads. As codex
145
+ * events arrive the viewer silently upgrades:
146
+ *
147
+ * - `colorWorld` → separations panel shows pikepdf-accurate ink list
148
+ * (including spots inside compressed streams that the browser's
149
+ * regex parser misses).
150
+ * - `phase2_complete` → separations, TAC heatmap, and layers switch
151
+ * to Ghostscript-rendered plates (higher fidelity than the
152
+ * pdfjs RGB-approximated versions).
153
+ *
154
+ * Tools remain fully active on pdfjs throughout — there is no loading
155
+ * state or disabled period. Codex is a silent quality upgrade.
156
+ *
157
+ * Accepts any object satisfying {@link MinimalCodexClient} —
158
+ * including `HttpClient` from `@printwithsynergy/codex-client`.
159
+ */
160
+ codex?: MinimalCodexClient;
53
161
  }
54
162
  /**
55
- * Drop-in production viewer. See {@link LensPDFProps} for the full
56
- * prop surface.
163
+ * The complete interactive LensPDF viewer sidebar controls, theming,
164
+ * optional fullscreen mode. All viewer-only features (color picker,
165
+ * densitometer, measure, separations, TAC heatmap, layers, annotations)
166
+ * are wired out of the box. Pass a `pdfUrl` and you have a viewer.
57
167
  *
58
168
  * @public
59
169
  */
60
- export declare function LensPDF({ pdfUrl, ...rest }: LensPDFProps): import("react/jsx-runtime").JSX.Element;
170
+ export declare function LensPDF({ pdfUrl, tokens: tokenOverrides, brand, className, tools, initialZoom, tacLimit, workerSrc, services: serviceOverrides, footer, fullscreen: initialFullscreen, initialPage, items, forceInspectionPanel, spotPalette, selectedItem, onItemSelect, dieline, showBoxOverlays, cropToTrim, onPageChange: onPageChangeProp, onZoomChange: onZoomChangeProp, onError: onErrorProp, preset, plugins: customPlugins, codex, dataConfig, }: LensPDFProps): import("react/jsx-runtime").JSX.Element;
61
171
  //# sourceMappingURL=LensPDF.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LensPDF.d.ts","sourceRoot":"","sources":["../../components/LensPDF.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,eAAe,GAAG,aAAa,CAAC;IAC5E;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,2CAExD"}
1
+ {"version":3,"file":"LensPDF.d.ts","sourceRoot":"","sources":["../../components/LensPDF.tsx"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EASL,KAAK,kBAAkB,EAExB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,UAAU,CAAC;AA8BxD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAIL,KAAK,kBAAkB,EAGxB,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMrD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAC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