@printwithsynergy/lens-pdf 0.3.0-beta.81
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 +661 -0
- package/README.md +344 -0
- package/dist/browser/codexOverlay.d.ts +109 -0
- package/dist/browser/codexOverlay.d.ts.map +1 -0
- package/dist/browser/codexOverlay.js +256 -0
- package/dist/browser/codexOverlay.js.map +1 -0
- package/dist/browser/constants.d.ts +13 -0
- package/dist/browser/constants.d.ts.map +1 -0
- package/dist/browser/constants.js +13 -0
- package/dist/browser/constants.js.map +1 -0
- package/dist/browser/index.d.ts +211 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +1190 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/pantone-gold.d.ts +59 -0
- package/dist/browser/pantone-gold.d.ts.map +1 -0
- package/dist/browser/pantone-gold.js +237 -0
- package/dist/browser/pantone-gold.js.map +1 -0
- package/dist/components/AnnotationCanvas.d.ts +27 -0
- package/dist/components/AnnotationCanvas.d.ts.map +1 -0
- package/dist/components/AnnotationCanvas.js +401 -0
- package/dist/components/AnnotationCanvas.js.map +1 -0
- package/dist/components/AnnotationNotesPanel.d.ts +15 -0
- package/dist/components/AnnotationNotesPanel.d.ts.map +1 -0
- package/dist/components/AnnotationNotesPanel.js +235 -0
- package/dist/components/AnnotationNotesPanel.js.map +1 -0
- package/dist/components/AnnotationThread.d.ts +18 -0
- package/dist/components/AnnotationThread.d.ts.map +1 -0
- package/dist/components/AnnotationThread.js +163 -0
- package/dist/components/AnnotationThread.js.map +1 -0
- package/dist/components/AnnotationToolbar.d.ts +39 -0
- package/dist/components/AnnotationToolbar.d.ts.map +1 -0
- package/dist/components/AnnotationToolbar.js +258 -0
- package/dist/components/AnnotationToolbar.js.map +1 -0
- package/dist/components/BoxOverlay.d.ts +20 -0
- package/dist/components/BoxOverlay.d.ts.map +1 -0
- package/dist/components/BoxOverlay.js +107 -0
- package/dist/components/BoxOverlay.js.map +1 -0
- package/dist/components/ColorPickerTool.d.ts +11 -0
- package/dist/components/ColorPickerTool.d.ts.map +1 -0
- package/dist/components/ColorPickerTool.js +220 -0
- package/dist/components/ColorPickerTool.js.map +1 -0
- package/dist/components/DensitometerTool.d.ts +25 -0
- package/dist/components/DensitometerTool.d.ts.map +1 -0
- package/dist/components/DensitometerTool.js +246 -0
- package/dist/components/DensitometerTool.js.map +1 -0
- package/dist/components/DielineInfoPanel.d.ts +27 -0
- package/dist/components/DielineInfoPanel.d.ts.map +1 -0
- package/dist/components/DielineInfoPanel.js +23 -0
- package/dist/components/DielineInfoPanel.js.map +1 -0
- package/dist/components/DielineOverlay.d.ts +10 -0
- package/dist/components/DielineOverlay.d.ts.map +1 -0
- package/dist/components/DielineOverlay.js +57 -0
- package/dist/components/DielineOverlay.js.map +1 -0
- package/dist/components/FindingsSidebar.d.ts +50 -0
- package/dist/components/FindingsSidebar.d.ts.map +1 -0
- package/dist/components/FindingsSidebar.js +78 -0
- package/dist/components/FindingsSidebar.js.map +1 -0
- package/dist/components/LayerCanvas.d.ts +30 -0
- package/dist/components/LayerCanvas.d.ts.map +1 -0
- package/dist/components/LayerCanvas.js +84 -0
- package/dist/components/LayerCanvas.js.map +1 -0
- package/dist/components/LayerPanel.d.ts +9 -0
- package/dist/components/LayerPanel.d.ts.map +1 -0
- package/dist/components/LayerPanel.js +144 -0
- package/dist/components/LayerPanel.js.map +1 -0
- package/dist/components/LensPDF.d.ts +61 -0
- package/dist/components/LensPDF.d.ts.map +1 -0
- package/dist/components/LensPDF.js +49 -0
- package/dist/components/LensPDF.js.map +1 -0
- package/dist/components/LensPDFDemo.d.ts +160 -0
- package/dist/components/LensPDFDemo.d.ts.map +1 -0
- package/dist/components/LensPDFDemo.js +1060 -0
- package/dist/components/LensPDFDemo.js.map +1 -0
- package/dist/components/LensPDFDemo.styles.d.ts +38 -0
- package/dist/components/LensPDFDemo.styles.d.ts.map +1 -0
- package/dist/components/LensPDFDemo.styles.js +282 -0
- package/dist/components/LensPDFDemo.styles.js.map +1 -0
- package/dist/components/LensPDFViewer.d.ts +79 -0
- package/dist/components/LensPDFViewer.d.ts.map +1 -0
- package/dist/components/LensPDFViewer.js +254 -0
- package/dist/components/LensPDFViewer.js.map +1 -0
- package/dist/components/MeasureTool.d.ts +16 -0
- package/dist/components/MeasureTool.d.ts.map +1 -0
- package/dist/components/MeasureTool.js +137 -0
- package/dist/components/MeasureTool.js.map +1 -0
- package/dist/components/MobileBottomSheet.d.ts +12 -0
- package/dist/components/MobileBottomSheet.d.ts.map +1 -0
- package/dist/components/MobileBottomSheet.js +113 -0
- package/dist/components/MobileBottomSheet.js.map +1 -0
- package/dist/components/MobileDrawer.d.ts +31 -0
- package/dist/components/MobileDrawer.d.ts.map +1 -0
- package/dist/components/MobileDrawer.js +67 -0
- package/dist/components/MobileDrawer.js.map +1 -0
- package/dist/components/PageCanvas.d.ts +33 -0
- package/dist/components/PageCanvas.d.ts.map +1 -0
- package/dist/components/PageCanvas.js +385 -0
- package/dist/components/PageCanvas.js.map +1 -0
- package/dist/components/PageNavigator.d.ts +18 -0
- package/dist/components/PageNavigator.d.ts.map +1 -0
- package/dist/components/PageNavigator.js +44 -0
- package/dist/components/PageNavigator.js.map +1 -0
- package/dist/components/SeparationCanvas.d.ts +12 -0
- package/dist/components/SeparationCanvas.d.ts.map +1 -0
- package/dist/components/SeparationCanvas.js +174 -0
- package/dist/components/SeparationCanvas.js.map +1 -0
- package/dist/components/TACHeatmapOverlay.d.ts +17 -0
- package/dist/components/TACHeatmapOverlay.d.ts.map +1 -0
- package/dist/components/TACHeatmapOverlay.js +119 -0
- package/dist/components/TACHeatmapOverlay.js.map +1 -0
- package/dist/components/ZoomControls.d.ts +11 -0
- package/dist/components/ZoomControls.d.ts.map +1 -0
- package/dist/components/ZoomControls.js +26 -0
- package/dist/components/ZoomControls.js.map +1 -0
- package/dist/components/defaultShellPlugins.d.ts +3 -0
- package/dist/components/defaultShellPlugins.d.ts.map +1 -0
- package/dist/components/defaultShellPlugins.js +273 -0
- package/dist/components/defaultShellPlugins.js.map +1 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +32 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/presets.d.ts +8 -0
- package/dist/components/presets.d.ts.map +1 -0
- package/dist/components/presets.js +14 -0
- package/dist/components/presets.js.map +1 -0
- package/dist/components/shellPlugins.d.ts +105 -0
- package/dist/components/shellPlugins.d.ts.map +1 -0
- package/dist/components/shellPlugins.js +52 -0
- package/dist/components/shellPlugins.js.map +1 -0
- package/dist/components/useIsMobile.d.ts +16 -0
- package/dist/components/useIsMobile.d.ts.map +1 -0
- package/dist/components/useIsMobile.js +30 -0
- package/dist/components/useIsMobile.js.map +1 -0
- package/dist/fallback-pdfjs/index.d.ts +60 -0
- package/dist/fallback-pdfjs/index.d.ts.map +1 -0
- package/dist/fallback-pdfjs/index.js +163 -0
- package/dist/fallback-pdfjs/index.js.map +1 -0
- package/dist/host/LensPDFProvider.d.ts +36 -0
- package/dist/host/LensPDFProvider.d.ts.map +1 -0
- package/dist/host/LensPDFProvider.js +12 -0
- package/dist/host/LensPDFProvider.js.map +1 -0
- package/dist/host/index.d.ts +167 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +173 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/pdfFallback.d.ts +50 -0
- package/dist/host/pdfFallback.d.ts.map +1 -0
- package/dist/host/pdfFallback.js +171 -0
- package/dist/host/pdfFallback.js.map +1 -0
- package/dist/host/pdfValidation.d.ts +45 -0
- package/dist/host/pdfValidation.d.ts.map +1 -0
- package/dist/host/pdfValidation.js +78 -0
- package/dist/host/pdfValidation.js.map +1 -0
- package/dist/host/shareLink.d.ts +80 -0
- package/dist/host/shareLink.d.ts.map +1 -0
- package/dist/host/shareLink.js +114 -0
- package/dist/host/shareLink.js.map +1 -0
- package/dist/host/useLensPDF.d.ts +73 -0
- package/dist/host/useLensPDF.d.ts.map +1 -0
- package/dist/host/useLensPDF.js +213 -0
- package/dist/host/useLensPDF.js.map +1 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/context.d.ts +70 -0
- package/dist/plugin/context.d.ts.map +1 -0
- package/dist/plugin/context.js +16 -0
- package/dist/plugin/context.js.map +1 -0
- package/dist/plugin/findings-location.d.ts +53 -0
- package/dist/plugin/findings-location.d.ts.map +1 -0
- package/dist/plugin/findings-location.js +72 -0
- package/dist/plugin/findings-location.js.map +1 -0
- package/dist/plugin/index.d.ts +19 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +16 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/registry.d.ts +61 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/registry.js +102 -0
- package/dist/plugin/registry.js.map +1 -0
- package/dist/plugin/services.d.ts +380 -0
- package/dist/plugin/services.d.ts.map +1 -0
- package/dist/plugin/services.js +104 -0
- package/dist/plugin/services.js.map +1 -0
- package/dist/plugin/types.d.ts +198 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin/types.js +24 -0
- package/dist/plugin/types.js.map +1 -0
- package/dist/types/index.d.ts +191 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +95 -0
- package/dist/types/index.js.map +1 -0
- package/dist/units/index.d.ts +64 -0
- package/dist/units/index.d.ts.map +1 -0
- package/dist/units/index.js +98 -0
- package/dist/units/index.js.map +1 -0
- package/docs/architecture.md +90 -0
- package/docs/components.md +569 -0
- package/docs/contributing.md +78 -0
- package/docs/fallback.md +174 -0
- package/docs/lens-pdf-viewer.md +128 -0
- package/docs/licensing.md +78 -0
- package/docs/measurement-units.md +87 -0
- package/docs/plugins.md +256 -0
- package/docs/security.md +69 -0
- package/docs/server.md +212 -0
- package/docs/services.md +210 -0
- package/docs/share-links.md +111 -0
- package/docs/theming.md +164 -0
- package/docs/validation.md +83 -0
- package/package.json +139 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useLensPDF` — React hook that manages all viewer state.
|
|
3
|
+
*
|
|
4
|
+
* Returns everything a consumer needs to render a viewer: context
|
|
5
|
+
* values, fallback adapter, page/zoom/layer/tool state, and
|
|
6
|
+
* computed canvas dimensions. Pass the return value to
|
|
7
|
+
* {@link LensPDFProvider} (or spread into `<LensPDFViewer>`) and
|
|
8
|
+
* you're done — no manual context wiring required.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
13
|
+
import { defaultThemeTokens, markUnwired, noopI18n, noopTelemetry } from "../plugin/services.js";
|
|
14
|
+
import { pageInfoFromDimensions } from "../types/index.js";
|
|
15
|
+
import { createPdfJsFallback } from "../fallback-pdfjs/index.js";
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Default values
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
const DEFAULT_PAGE = pageInfoFromDimensions(1, 612, 792);
|
|
20
|
+
const PTS_TO_PX = 96 / 72;
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Hook
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/**
|
|
25
|
+
* Manages all LensPDF viewer state. Pair with `<LensPDFProvider>`
|
|
26
|
+
* or `<LensPDFViewer>` for rendering.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const viewer = useLensPDF("https://cdn.example.com/proof.pdf");
|
|
30
|
+
* return (
|
|
31
|
+
* <LensPDFProvider value={viewer}>
|
|
32
|
+
* <PageCanvas page={viewer.currentPageInfo} zoom={viewer.zoom} ... />
|
|
33
|
+
* </LensPDFProvider>
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export function useLensPDF(pdfUrl, opts = {}) {
|
|
40
|
+
const { tokens: tokenOverrides, services: serviceOverrides, initialZoom = 100, workerSrc, initialPage = 1, } = opts;
|
|
41
|
+
// -----------------------------------------------------------------------
|
|
42
|
+
// Tokens
|
|
43
|
+
// -----------------------------------------------------------------------
|
|
44
|
+
const tokens = useMemo(() => ({ ...defaultThemeTokens, ...tokenOverrides }),
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
[JSON.stringify(tokenOverrides)]);
|
|
47
|
+
// -----------------------------------------------------------------------
|
|
48
|
+
// Fallback adapter (recreated when pdfUrl changes)
|
|
49
|
+
// -----------------------------------------------------------------------
|
|
50
|
+
const fallback = useMemo(() => (pdfUrl ? createPdfJsFallback({ pdfUrl, workerSrc }) : undefined), [pdfUrl, workerSrc]);
|
|
51
|
+
// -----------------------------------------------------------------------
|
|
52
|
+
// Services
|
|
53
|
+
// -----------------------------------------------------------------------
|
|
54
|
+
const servicesValue = useMemo(() => {
|
|
55
|
+
const base = {
|
|
56
|
+
pageImages: markUnwired({ getPageImageUrl: () => "" }),
|
|
57
|
+
layers: markUnwired({ getLayerImageUrl: () => "", listLayers: async () => [] }),
|
|
58
|
+
separations: markUnwired({ getChannelImageUrl: () => "" }),
|
|
59
|
+
tacHeatmap: markUnwired({ getHeatmapImageUrl: () => "", listRuns: async () => [] }),
|
|
60
|
+
colorSample: markUnwired({ sampleAt: async () => null }),
|
|
61
|
+
densitometer: markUnwired({
|
|
62
|
+
sampleAt: async () => { throw new Error("No separations available for this page."); },
|
|
63
|
+
}),
|
|
64
|
+
annotations: markUnwired({
|
|
65
|
+
list: async () => [],
|
|
66
|
+
getForPage: async () => null,
|
|
67
|
+
saveForPage: async () => { },
|
|
68
|
+
remove: async () => { },
|
|
69
|
+
}),
|
|
70
|
+
reports: markUnwired({ getHtmlReportUrl: () => "", getPdfDownloadUrl: () => "" }),
|
|
71
|
+
telemetry: noopTelemetry,
|
|
72
|
+
i18n: noopI18n,
|
|
73
|
+
tokens,
|
|
74
|
+
};
|
|
75
|
+
if (!serviceOverrides)
|
|
76
|
+
return base;
|
|
77
|
+
return { ...base, ...serviceOverrides, tokens };
|
|
78
|
+
}, [tokens, serviceOverrides]);
|
|
79
|
+
// -----------------------------------------------------------------------
|
|
80
|
+
// Host context
|
|
81
|
+
// -----------------------------------------------------------------------
|
|
82
|
+
const hostValue = useMemo(() => ({
|
|
83
|
+
apiBase: "",
|
|
84
|
+
jobApiBase: "",
|
|
85
|
+
readOnly: true,
|
|
86
|
+
pdfUrl,
|
|
87
|
+
pdfFallback: fallback,
|
|
88
|
+
}), [pdfUrl, fallback]);
|
|
89
|
+
// -----------------------------------------------------------------------
|
|
90
|
+
// State
|
|
91
|
+
// -----------------------------------------------------------------------
|
|
92
|
+
const [pageCount, setPageCount] = useState(null);
|
|
93
|
+
const [pageDims, setPageDims] = useState(new Map());
|
|
94
|
+
const [zoom, setZoom] = useState(initialZoom);
|
|
95
|
+
const [currentPage, setCurrentPage] = useState(initialPage);
|
|
96
|
+
const [enabledLayers, setEnabledLayers] = useState(new Set());
|
|
97
|
+
const [hasLayers, setHasLayers] = useState(false);
|
|
98
|
+
const [activeTool, setActiveTool] = useState("none");
|
|
99
|
+
const [error, setError] = useState(null);
|
|
100
|
+
// Track fallback identity to reset state on URL change.
|
|
101
|
+
const prevFallbackRef = useRef(fallback);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (prevFallbackRef.current !== fallback) {
|
|
104
|
+
prevFallbackRef.current = fallback;
|
|
105
|
+
setPageCount(null);
|
|
106
|
+
setPageDims(new Map());
|
|
107
|
+
setCurrentPage(initialPage);
|
|
108
|
+
setEnabledLayers(new Set());
|
|
109
|
+
setHasLayers(false);
|
|
110
|
+
setError(null);
|
|
111
|
+
}
|
|
112
|
+
}, [fallback, initialPage]);
|
|
113
|
+
// -----------------------------------------------------------------------
|
|
114
|
+
// Load page count + layers from fallback
|
|
115
|
+
// -----------------------------------------------------------------------
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!fallback)
|
|
118
|
+
return;
|
|
119
|
+
let cancelled = false;
|
|
120
|
+
fallback
|
|
121
|
+
.getPageCount()
|
|
122
|
+
.then((n) => { if (!cancelled)
|
|
123
|
+
setPageCount(n); })
|
|
124
|
+
.catch((err) => { if (!cancelled)
|
|
125
|
+
setError(err.message); });
|
|
126
|
+
return () => { cancelled = true; };
|
|
127
|
+
}, [fallback]);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!fallback)
|
|
130
|
+
return;
|
|
131
|
+
let cancelled = false;
|
|
132
|
+
fallback.listLayers().then((layers) => {
|
|
133
|
+
if (cancelled)
|
|
134
|
+
return;
|
|
135
|
+
setHasLayers(layers.length > 0);
|
|
136
|
+
setEnabledLayers(new Set(layers.filter((l) => l.default_on).map((l) => l.ocg_index)));
|
|
137
|
+
});
|
|
138
|
+
return () => { cancelled = true; };
|
|
139
|
+
}, [fallback]);
|
|
140
|
+
// -----------------------------------------------------------------------
|
|
141
|
+
// Derived page info
|
|
142
|
+
// -----------------------------------------------------------------------
|
|
143
|
+
const currentDims = pageDims.get(currentPage);
|
|
144
|
+
const currentPageInfo = currentDims
|
|
145
|
+
? pageInfoFromDimensions(currentPage, currentDims.widthPts, currentDims.heightPts)
|
|
146
|
+
: { ...DEFAULT_PAGE, page_num: currentPage };
|
|
147
|
+
const pages = useMemo(() => {
|
|
148
|
+
if (pageCount === null)
|
|
149
|
+
return [];
|
|
150
|
+
return Array.from({ length: pageCount }, (_, i) => {
|
|
151
|
+
const num = i + 1;
|
|
152
|
+
const dims = pageDims.get(num);
|
|
153
|
+
return dims
|
|
154
|
+
? pageInfoFromDimensions(num, dims.widthPts, dims.heightPts)
|
|
155
|
+
: { ...DEFAULT_PAGE, page_num: num };
|
|
156
|
+
});
|
|
157
|
+
}, [pageCount, pageDims]);
|
|
158
|
+
// -----------------------------------------------------------------------
|
|
159
|
+
// Canvas dimensions
|
|
160
|
+
// -----------------------------------------------------------------------
|
|
161
|
+
const scale = zoom / 100;
|
|
162
|
+
const canvasWidth = Math.round(currentPageInfo.width_pts * PTS_TO_PX * scale);
|
|
163
|
+
const canvasHeight = Math.round(currentPageInfo.height_pts * PTS_TO_PX * scale);
|
|
164
|
+
// -----------------------------------------------------------------------
|
|
165
|
+
// Layer callbacks
|
|
166
|
+
// -----------------------------------------------------------------------
|
|
167
|
+
const toggleLayer = useCallback((ocgIndex) => {
|
|
168
|
+
setEnabledLayers((prev) => {
|
|
169
|
+
const next = new Set(prev);
|
|
170
|
+
if (next.has(ocgIndex))
|
|
171
|
+
next.delete(ocgIndex);
|
|
172
|
+
else
|
|
173
|
+
next.add(ocgIndex);
|
|
174
|
+
return next;
|
|
175
|
+
});
|
|
176
|
+
}, []);
|
|
177
|
+
const setAllLayers = useCallback((enabled) => {
|
|
178
|
+
if (!fallback)
|
|
179
|
+
return;
|
|
180
|
+
if (enabled) {
|
|
181
|
+
fallback.listLayers().then((layers) => {
|
|
182
|
+
setEnabledLayers(new Set(layers.map((l) => l.ocg_index)));
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
setEnabledLayers(new Set());
|
|
187
|
+
}
|
|
188
|
+
}, [fallback]);
|
|
189
|
+
return {
|
|
190
|
+
hostValue,
|
|
191
|
+
servicesValue,
|
|
192
|
+
fallback,
|
|
193
|
+
pageCount,
|
|
194
|
+
currentPage,
|
|
195
|
+
setCurrentPage,
|
|
196
|
+
currentPageInfo,
|
|
197
|
+
pages,
|
|
198
|
+
pageDims,
|
|
199
|
+
zoom,
|
|
200
|
+
setZoom,
|
|
201
|
+
canvasWidth,
|
|
202
|
+
canvasHeight,
|
|
203
|
+
enabledLayers,
|
|
204
|
+
toggleLayer,
|
|
205
|
+
setAllLayers,
|
|
206
|
+
hasLayers,
|
|
207
|
+
activeTool,
|
|
208
|
+
setActiveTool,
|
|
209
|
+
error,
|
|
210
|
+
setError,
|
|
211
|
+
};
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C,gBAAgB,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO;QACL,SAAS;QACT,aAAa;QACb,QAAQ;QACR,SAAS;QACT,WAAW;QACX,cAAc;QACd,eAAe;QACf,KAAK;QACL,QAAQ;QACR,IAAI;QACJ,OAAO;QACP,WAAW;QACX,YAAY;QACZ,aAAa;QACb,WAAW;QACX,YAAY;QACZ,SAAS;QACT,UAAU;QACV,aAAa;QACb,KAAK;QACL,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@printwithsynergy/lens-pdf` — root barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports every public protocol, component, and unit. Host
|
|
5
|
+
* applications usually import directly from a sub-path (`/host`,
|
|
6
|
+
* `/components`, `/plugin`, `/units`, `/types`) so their bundler
|
|
7
|
+
* only pulls what they use; this convenience barrel exists for
|
|
8
|
+
* smaller embeds that want the whole surface in one import.
|
|
9
|
+
*
|
|
10
|
+
* The viewer is host-agnostic — no SaaS-specific imports, no
|
|
11
|
+
* hardcoded backend paths. Hosts wire their own concrete
|
|
12
|
+
* `ViewerServices` and supply their own host context. See the
|
|
13
|
+
* `core/`-scoped ESLint rule (mirrored in `docs/contributing.md`)
|
|
14
|
+
* for the boundary that keeps it that way.
|
|
15
|
+
*
|
|
16
|
+
* Distributed under AGPL-3.0-or-later.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export * from "./plugin";
|
|
21
|
+
export { defaultUnwiredServices, ViewerHostContext, ViewerServicesContext, useViewerHost, useViewerServices, useFallbackMode, } from "./host";
|
|
22
|
+
export type { ViewerHostContextValue } from "./host";
|
|
23
|
+
export { validatePdfFile, validatePdfUrl } from "./host/pdfValidation";
|
|
24
|
+
export type { PdfValidationResult } from "./host/pdfValidation";
|
|
25
|
+
export { generateShareLink, parseShareParams } from "./host/shareLink";
|
|
26
|
+
export type { ShareLinkOptions, ParsedShareParams } from "./host/shareLink";
|
|
27
|
+
export { useLensPDF } from "./host/useLensPDF";
|
|
28
|
+
export type { UseLensPDFOptions, UseLensPDFReturn } from "./host/useLensPDF";
|
|
29
|
+
export { LensPDFProvider } from "./host/LensPDFProvider";
|
|
30
|
+
export type { LensPDFProviderProps } from "./host/LensPDFProvider";
|
|
31
|
+
export { pageInfoFromDimensions } from "./types";
|
|
32
|
+
export { LensPDFDemo } from "./components/LensPDFDemo";
|
|
33
|
+
export { FindingsSidebar } from "./components/FindingsSidebar";
|
|
34
|
+
export type { FindingsSidebarProps } from "./components/FindingsSidebar";
|
|
35
|
+
export { DielineInfoPanel } from "./components/DielineInfoPanel";
|
|
36
|
+
export type { DielineInfoPanelProps } from "./components/DielineInfoPanel";
|
|
37
|
+
export type { LensPDFDemoProps, LensPDFDemoTool, } from "./components/LensPDFDemo";
|
|
38
|
+
export { LensPDF } from "./components/LensPDF";
|
|
39
|
+
export type { LensPDFProps } from "./components/LensPDF";
|
|
40
|
+
export { createBrowserViewerServices, defaultBrowserWorkerSrc, detectSpotInksFromPdfBytes, rgbToCmyk, useBrowserViewerServicesVersion, PROCESS_CHANNELS, } from "./browser";
|
|
41
|
+
export type { BrowserViewerServices, BrowserViewerServicesOptions, DetectedInk, } from "./browser";
|
|
42
|
+
export { AnnotationCanvas } from "./components/AnnotationCanvas";
|
|
43
|
+
export { AnnotationNotesPanel } from "./components/AnnotationNotesPanel";
|
|
44
|
+
export { AnnotationThread } from "./components/AnnotationThread";
|
|
45
|
+
export { AnnotationToolbar } from "./components/AnnotationToolbar";
|
|
46
|
+
export { BoxOverlay } from "./components/BoxOverlay";
|
|
47
|
+
export { ColorPickerTool } from "./components/ColorPickerTool";
|
|
48
|
+
export { DensitometerTool } from "./components/DensitometerTool";
|
|
49
|
+
export { DielineOverlay } from "./components/DielineOverlay";
|
|
50
|
+
export { LayerCanvas } from "./components/LayerCanvas";
|
|
51
|
+
export { LayerPanel } from "./components/LayerPanel";
|
|
52
|
+
export { LensPDFViewer } from "./components/LensPDFViewer";
|
|
53
|
+
export type { LensPDFViewerProps, LensPDFViewerState, LensPDFViewerTool, } from "./components/LensPDFViewer";
|
|
54
|
+
export { MeasureTool } from "./components/MeasureTool";
|
|
55
|
+
export { createDefaultShellPlugins } from "./components/defaultShellPlugins";
|
|
56
|
+
export { MobileBottomSheet } from "./components/MobileBottomSheet";
|
|
57
|
+
export { MobileDrawer } from "./components/MobileDrawer";
|
|
58
|
+
export { PageCanvas } from "./components/PageCanvas";
|
|
59
|
+
export { PageNavigator } from "./components/PageNavigator";
|
|
60
|
+
export { SeparationCanvas } from "./components/SeparationCanvas";
|
|
61
|
+
export { TACHeatmapOverlay } from "./components/TACHeatmapOverlay";
|
|
62
|
+
export { ZoomControls } from "./components/ZoomControls";
|
|
63
|
+
export { pluginsForPreset } from "./components/presets";
|
|
64
|
+
export type { LensPDFPresetKind } from "./components/presets";
|
|
65
|
+
export { computeFeatureAvailability, pluginsForSlot, resolveShellPlugins, } from "./components/shellPlugins";
|
|
66
|
+
export type { LensPDFFeatureAvailability, LensPDFShellPlugin, LensPDFShellPluginContext, LensPDFShellSlot, } from "./components/shellPlugins";
|
|
67
|
+
export { agateUnit, allMeasurementUnits, defaultMeasurementUnits, inchUnit, mmUnit, picaUnit, pointUnit, } from "./units";
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GA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A2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@printwithsynergy/lens-pdf` — root barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports every public protocol, component, and unit. Host
|
|
5
|
+
* applications usually import directly from a sub-path (`/host`,
|
|
6
|
+
* `/components`, `/plugin`, `/units`, `/types`) so their bundler
|
|
7
|
+
* only pulls what they use; this convenience barrel exists for
|
|
8
|
+
* smaller embeds that want the whole surface in one import.
|
|
9
|
+
*
|
|
10
|
+
* The viewer is host-agnostic — no SaaS-specific imports, no
|
|
11
|
+
* hardcoded backend paths. Hosts wire their own concrete
|
|
12
|
+
* `ViewerServices` and supply their own host context. See the
|
|
13
|
+
* `core/`-scoped ESLint rule (mirrored in `docs/contributing.md`)
|
|
14
|
+
* for the boundary that keeps it that way.
|
|
15
|
+
*
|
|
16
|
+
* Distributed under AGPL-3.0-or-later.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export * from "./plugin/index.js";
|
|
21
|
+
// Host-level utilities re-exported for convenience.
|
|
22
|
+
export { defaultUnwiredServices, ViewerHostContext, ViewerServicesContext, useViewerHost, useViewerServices, useFallbackMode, } from "./host/index.js";
|
|
23
|
+
export { validatePdfFile, validatePdfUrl } from "./host/pdfValidation.js";
|
|
24
|
+
export { generateShareLink, parseShareParams } from "./host/shareLink.js";
|
|
25
|
+
export { useLensPDF } from "./host/useLensPDF.js";
|
|
26
|
+
export { LensPDFProvider } from "./host/LensPDFProvider.js";
|
|
27
|
+
export { pageInfoFromDimensions } from "./types/index.js";
|
|
28
|
+
export { LensPDFDemo } from "./components/LensPDFDemo.js";
|
|
29
|
+
export { FindingsSidebar } from "./components/FindingsSidebar.js";
|
|
30
|
+
export { DielineInfoPanel } from "./components/DielineInfoPanel.js";
|
|
31
|
+
// Drop-in production viewer — same feature surface as <LensPDFDemo>
|
|
32
|
+
// without the upload chrome. The recommended single-component entry
|
|
33
|
+
// point for hosts integrating LensPDF.
|
|
34
|
+
export { LensPDF } from "./components/LensPDF.js";
|
|
35
|
+
// Browser-only ViewerServices factory — gives consumers a one-liner
|
|
36
|
+
// path to a fully wired viewer without a server backend.
|
|
37
|
+
export { createBrowserViewerServices, defaultBrowserWorkerSrc, detectSpotInksFromPdfBytes, rgbToCmyk, useBrowserViewerServicesVersion, PROCESS_CHANNELS, } from "./browser/index.js";
|
|
38
|
+
export { AnnotationCanvas } from "./components/AnnotationCanvas.js";
|
|
39
|
+
export { AnnotationNotesPanel } from "./components/AnnotationNotesPanel.js";
|
|
40
|
+
export { AnnotationThread } from "./components/AnnotationThread.js";
|
|
41
|
+
export { AnnotationToolbar } from "./components/AnnotationToolbar.js";
|
|
42
|
+
export { BoxOverlay } from "./components/BoxOverlay.js";
|
|
43
|
+
export { ColorPickerTool } from "./components/ColorPickerTool.js";
|
|
44
|
+
export { DensitometerTool } from "./components/DensitometerTool.js";
|
|
45
|
+
export { DielineOverlay } from "./components/DielineOverlay.js";
|
|
46
|
+
export { LayerCanvas } from "./components/LayerCanvas.js";
|
|
47
|
+
export { LayerPanel } from "./components/LayerPanel.js";
|
|
48
|
+
export { LensPDFViewer } from "./components/LensPDFViewer.js";
|
|
49
|
+
export { MeasureTool } from "./components/MeasureTool.js";
|
|
50
|
+
export { createDefaultShellPlugins } from "./components/defaultShellPlugins.js";
|
|
51
|
+
export { MobileBottomSheet } from "./components/MobileBottomSheet.js";
|
|
52
|
+
export { MobileDrawer } from "./components/MobileDrawer.js";
|
|
53
|
+
export { PageCanvas } from "./components/PageCanvas.js";
|
|
54
|
+
export { PageNavigator } from "./components/PageNavigator.js";
|
|
55
|
+
export { SeparationCanvas } from "./components/SeparationCanvas.js";
|
|
56
|
+
export { TACHeatmapOverlay } from "./components/TACHeatmapOverlay.js";
|
|
57
|
+
export { ZoomControls } from "./components/ZoomControls.js";
|
|
58
|
+
export { pluginsForPreset } from "./components/presets.js";
|
|
59
|
+
export { computeFeatureAvailability, pluginsForSlot, resolveShellPlugins, } from "./components/shellPlugins.js";
|
|
60
|
+
// Built-in MeasurementUnit definitions consumed by MeasureTool.
|
|
61
|
+
export { agateUnit, allMeasurementUnits, defaultMeasurementUnits, inchUnit, mmUnit, picaUnit, pointUnit, } from "./units/index.js";
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,UAAU,CAAC;AAEzB,oDAAoD;AACpD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,eAAe,GAChB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BA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AA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAQnC,gEAAgE;AAChE,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer context — single argument passed to every plugin's `mount` /
|
|
3
|
+
* `subscribe` call.
|
|
4
|
+
*
|
|
5
|
+
* The context is intentionally narrow: viewer state only (page,
|
|
6
|
+
* zoom, pan, viewport, selection) plus the `services` surface for
|
|
7
|
+
* data sources. No host- or domain-shaped types live here — those
|
|
8
|
+
* belong in plugin packs.
|
|
9
|
+
*
|
|
10
|
+
* Plugins that need richer data subscribe to it via the relevant
|
|
11
|
+
* service (`services.annotations`, `services.pageImages`, etc.).
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
import type { ViewerServices } from "./services";
|
|
16
|
+
/**
|
|
17
|
+
* Read-only viewport state.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface ViewerViewport {
|
|
22
|
+
/** Width in CSS pixels. */
|
|
23
|
+
readonly width: number;
|
|
24
|
+
/** Height in CSS pixels. */
|
|
25
|
+
readonly height: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read-only document metadata. Anything host- or domain-specific
|
|
29
|
+
* (job id, brand spec, finding catalog, audit verdict) is exposed
|
|
30
|
+
* via services or plugin payloads, not here.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface ViewerDocumentMetadata {
|
|
35
|
+
/** Total page count. */
|
|
36
|
+
readonly pageCount: number;
|
|
37
|
+
/** Per-page width/height in PDF points. */
|
|
38
|
+
readonly pageDimensions: ReadonlyArray<{
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Single argument bundle passed to plugins.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export interface ViewerContext {
|
|
49
|
+
/** 1-indexed current page. */
|
|
50
|
+
readonly page: number;
|
|
51
|
+
/** Zoom factor: 1.0 = 100%. */
|
|
52
|
+
readonly zoom: number;
|
|
53
|
+
/** Pan offset in CSS pixels (relative to viewport top-left). */
|
|
54
|
+
readonly pan: {
|
|
55
|
+
readonly x: number;
|
|
56
|
+
readonly y: number;
|
|
57
|
+
};
|
|
58
|
+
/** Current viewport size. */
|
|
59
|
+
readonly viewport: ViewerViewport;
|
|
60
|
+
/**
|
|
61
|
+
* Bounding box (in PDF points) of the user's current selection,
|
|
62
|
+
* or `null` if nothing is selected.
|
|
63
|
+
*/
|
|
64
|
+
readonly selectionBbox: readonly [number, number, number, number] | null;
|
|
65
|
+
/** Document metadata. */
|
|
66
|
+
readonly document: ViewerDocumentMetadata;
|
|
67
|
+
/** Host-supplied data-source services. */
|
|
68
|
+
readonly services: ViewerServices;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../plugin/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;QACrC,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACzE,yBAAyB;IACzB,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC1C,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer context — single argument passed to every plugin's `mount` /
|
|
3
|
+
* `subscribe` call.
|
|
4
|
+
*
|
|
5
|
+
* The context is intentionally narrow: viewer state only (page,
|
|
6
|
+
* zoom, pan, viewport, selection) plus the `services` surface for
|
|
7
|
+
* data sources. No host- or domain-shaped types live here — those
|
|
8
|
+
* belong in plugin packs.
|
|
9
|
+
*
|
|
10
|
+
* Plugins that need richer data subscribe to it via the relevant
|
|
11
|
+
* service (`services.annotations`, `services.pageImages`, etc.).
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../plugin/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Findings location helpers — split OverlayItems into "located in
|
|
3
|
+
* viewer" (those with a position the canvas can highlight + click)
|
|
4
|
+
* and "informational" (page-level metadata that's still surfaced
|
|
5
|
+
* to consumers, just not as a clickable overlay).
|
|
6
|
+
*
|
|
7
|
+
* Adapter authors moving findings from other preflight engines
|
|
8
|
+
* (callas pdfToolbox, PitStop, Acrobat, lint-pdf, custom rule
|
|
9
|
+
* engines) into Lens's contract should rely on these helpers to
|
|
10
|
+
* categorise each finding the same way Lens's canvas does — there
|
|
11
|
+
* is one source of truth for "can the viewer locate this?".
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import type { OverlayItem } from "./types";
|
|
16
|
+
/**
|
|
17
|
+
* Decide whether an OverlayItem can be located on the page.
|
|
18
|
+
*
|
|
19
|
+
* Returns ``true`` when the item carries a bbox the canvas can
|
|
20
|
+
* draw + tooltip + jump to, or a non-empty ``regions`` array for
|
|
21
|
+
* multi-rect findings. Returns ``false`` for page-level items
|
|
22
|
+
* (whole-page metadata, classification labels, document-scoped
|
|
23
|
+
* advisories, etc.) — those should be surfaced separately and
|
|
24
|
+
* NOT made clickable, since the click has nowhere to go.
|
|
25
|
+
*
|
|
26
|
+
* Hosts MUST use this predicate (not a bare ``item.bbox != null``
|
|
27
|
+
* check) so future overlay kinds (regions, polygons, masks) stay
|
|
28
|
+
* supported without each consumer growing its own duplicated
|
|
29
|
+
* heuristic.
|
|
30
|
+
*/
|
|
31
|
+
export declare function hasViewerLocation(item: OverlayItem): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Split OverlayItems into ``{ located, informational }``.
|
|
34
|
+
*
|
|
35
|
+
* Order within each bucket is preserved — useful when the host
|
|
36
|
+
* sorts findings by tier / page / severity before passing them
|
|
37
|
+
* in and wants the sidebar to render in the same order.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { splitFindingsByLocation } from "@printwithsynergy/lens-pdf";
|
|
42
|
+
*
|
|
43
|
+
* const { located, informational } = splitFindingsByLocation(items);
|
|
44
|
+
* // Pass `located` to <LensPDF items={...}> so only locatable
|
|
45
|
+
* // findings draw on the canvas; render `informational` in a
|
|
46
|
+
* // separate non-clickable section of your sidebar.
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function splitFindingsByLocation<T extends OverlayItem>(items: readonly T[]): {
|
|
50
|
+
located: T[];
|
|
51
|
+
informational: T[];
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=findings-location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings-location.d.ts","sourceRoot":"","sources":["../../plugin/findings-location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAS5D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,WAAW,EAC3D,KAAK,EAAE,SAAS,CAAC,EAAE,GAClB;IAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAAC,aAAa,EAAE,CAAC,EAAE,CAAA;CAAE,CAWtC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Findings location helpers — split OverlayItems into "located in
|
|
3
|
+
* viewer" (those with a position the canvas can highlight + click)
|
|
4
|
+
* and "informational" (page-level metadata that's still surfaced
|
|
5
|
+
* to consumers, just not as a clickable overlay).
|
|
6
|
+
*
|
|
7
|
+
* Adapter authors moving findings from other preflight engines
|
|
8
|
+
* (callas pdfToolbox, PitStop, Acrobat, lint-pdf, custom rule
|
|
9
|
+
* engines) into Lens's contract should rely on these helpers to
|
|
10
|
+
* categorise each finding the same way Lens's canvas does — there
|
|
11
|
+
* is one source of truth for "can the viewer locate this?".
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Decide whether an OverlayItem can be located on the page.
|
|
17
|
+
*
|
|
18
|
+
* Returns ``true`` when the item carries a bbox the canvas can
|
|
19
|
+
* draw + tooltip + jump to, or a non-empty ``regions`` array for
|
|
20
|
+
* multi-rect findings. Returns ``false`` for page-level items
|
|
21
|
+
* (whole-page metadata, classification labels, document-scoped
|
|
22
|
+
* advisories, etc.) — those should be surfaced separately and
|
|
23
|
+
* NOT made clickable, since the click has nowhere to go.
|
|
24
|
+
*
|
|
25
|
+
* Hosts MUST use this predicate (not a bare ``item.bbox != null``
|
|
26
|
+
* check) so future overlay kinds (regions, polygons, masks) stay
|
|
27
|
+
* supported without each consumer growing its own duplicated
|
|
28
|
+
* heuristic.
|
|
29
|
+
*/
|
|
30
|
+
export function hasViewerLocation(item) {
|
|
31
|
+
if (Array.isArray(item.bbox) && item.bbox.length === 4)
|
|
32
|
+
return true;
|
|
33
|
+
// Future overlay shapes — polygons / regions — are still under
|
|
34
|
+
// the same predicate. Adapter authors that emit ``regions`` on
|
|
35
|
+
// an OverlayItem don't need to also set ``bbox`` for the canvas
|
|
36
|
+
// to consider the item located.
|
|
37
|
+
const maybe = item;
|
|
38
|
+
if (Array.isArray(maybe.regions) && maybe.regions.length > 0)
|
|
39
|
+
return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Split OverlayItems into ``{ located, informational }``.
|
|
44
|
+
*
|
|
45
|
+
* Order within each bucket is preserved — useful when the host
|
|
46
|
+
* sorts findings by tier / page / severity before passing them
|
|
47
|
+
* in and wants the sidebar to render in the same order.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { splitFindingsByLocation } from "@printwithsynergy/lens-pdf";
|
|
52
|
+
*
|
|
53
|
+
* const { located, informational } = splitFindingsByLocation(items);
|
|
54
|
+
* // Pass `located` to <LensPDF items={...}> so only locatable
|
|
55
|
+
* // findings draw on the canvas; render `informational` in a
|
|
56
|
+
* // separate non-clickable section of your sidebar.
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function splitFindingsByLocation(items) {
|
|
60
|
+
const located = [];
|
|
61
|
+
const informational = [];
|
|
62
|
+
for (const item of items) {
|
|
63
|
+
if (hasViewerLocation(item)) {
|
|
64
|
+
located.push(item);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
informational.push(item);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { located, informational };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=findings-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings-location.js","sourceRoot":"","sources":["../../plugin/findings-location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpE,+DAA+D;IAC/D,+DAA+D;IAC/D,gEAAgE;IAChE,gCAAgC;IAChC,MAAM,KAAK,GAAG,IAAwC,CAAC;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1E,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAmB;IAEnB,MAAM,OAAO,GAAQ,EAAE,CAAC;IACxB,MAAM,aAAa,GAAQ,EAAE,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer plugin protocol — public surface.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type { AnnotationSourceProvider, DialogPlugin, MeasurementUnit, OverlayItem, OverlayPlugin, PanelPlugin, ToolbarPlugin, ViewerPlugin, ViewerPluginManifest, ViewerSlot, } from "./types";
|
|
7
|
+
export type { ViewerContext, ViewerDocumentMetadata, ViewerViewport, } from "./context";
|
|
8
|
+
export type { AnnotationEntry, AnnotationService, ColorSampleService, DensitometerService, I18nService, LayerService, PageImageService, PdfFallbackAdapter, ReportsService, SeparationService, TACHeatmapService, TelemetryService, ThemeTokens, ViewerServices, } from "./services";
|
|
9
|
+
export { darkThemeTokens, defaultThemeTokens, isUnwired, markUnwired, noopI18n, noopTelemetry, } from "./services";
|
|
10
|
+
export { _resetRegistryForTesting, getPluginsForSlot, listAll, register, unregister, } from "./registry";
|
|
11
|
+
/**
|
|
12
|
+
* Findings-location helpers — shared logic for adapter authors
|
|
13
|
+
* (lint-pdf, callas, PitStop, Acrobat, custom rule engines) that
|
|
14
|
+
* map their findings into ``OverlayItem``s. Use these to split
|
|
15
|
+
* located findings (the viewer can highlight + click) from
|
|
16
|
+
* informational findings (page-level metadata).
|
|
17
|
+
*/
|
|
18
|
+
export { hasViewerLocation, splitFindingsByLocation } from "./findings-location";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../plugin/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer plugin protocol — public surface.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export { darkThemeTokens, defaultThemeTokens, isUnwired, markUnwired, noopI18n, noopTelemetry, } from "./services.js";
|
|
7
|
+
export { _resetRegistryForTesting, getPluginsForSlot, listAll, register, unregister, } from "./registry.js";
|
|
8
|
+
/**
|
|
9
|
+
* Findings-location helpers — shared logic for adapter authors
|
|
10
|
+
* (lint-pdf, callas, PitStop, Acrobat, custom rule engines) that
|
|
11
|
+
* map their findings into ``OverlayItem``s. Use these to split
|
|
12
|
+
* located findings (the viewer can highlight + click) from
|
|
13
|
+
* informational findings (page-level metadata).
|
|
14
|
+
*/
|
|
15
|
+
export { hasViewerLocation, splitFindingsByLocation } from "./findings-location.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../plugin/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsCH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
|