@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.
Files changed (213) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +344 -0
  3. package/dist/browser/codexOverlay.d.ts +109 -0
  4. package/dist/browser/codexOverlay.d.ts.map +1 -0
  5. package/dist/browser/codexOverlay.js +256 -0
  6. package/dist/browser/codexOverlay.js.map +1 -0
  7. package/dist/browser/constants.d.ts +13 -0
  8. package/dist/browser/constants.d.ts.map +1 -0
  9. package/dist/browser/constants.js +13 -0
  10. package/dist/browser/constants.js.map +1 -0
  11. package/dist/browser/index.d.ts +211 -0
  12. package/dist/browser/index.d.ts.map +1 -0
  13. package/dist/browser/index.js +1190 -0
  14. package/dist/browser/index.js.map +1 -0
  15. package/dist/browser/pantone-gold.d.ts +59 -0
  16. package/dist/browser/pantone-gold.d.ts.map +1 -0
  17. package/dist/browser/pantone-gold.js +237 -0
  18. package/dist/browser/pantone-gold.js.map +1 -0
  19. package/dist/components/AnnotationCanvas.d.ts +27 -0
  20. package/dist/components/AnnotationCanvas.d.ts.map +1 -0
  21. package/dist/components/AnnotationCanvas.js +401 -0
  22. package/dist/components/AnnotationCanvas.js.map +1 -0
  23. package/dist/components/AnnotationNotesPanel.d.ts +15 -0
  24. package/dist/components/AnnotationNotesPanel.d.ts.map +1 -0
  25. package/dist/components/AnnotationNotesPanel.js +235 -0
  26. package/dist/components/AnnotationNotesPanel.js.map +1 -0
  27. package/dist/components/AnnotationThread.d.ts +18 -0
  28. package/dist/components/AnnotationThread.d.ts.map +1 -0
  29. package/dist/components/AnnotationThread.js +163 -0
  30. package/dist/components/AnnotationThread.js.map +1 -0
  31. package/dist/components/AnnotationToolbar.d.ts +39 -0
  32. package/dist/components/AnnotationToolbar.d.ts.map +1 -0
  33. package/dist/components/AnnotationToolbar.js +258 -0
  34. package/dist/components/AnnotationToolbar.js.map +1 -0
  35. package/dist/components/BoxOverlay.d.ts +20 -0
  36. package/dist/components/BoxOverlay.d.ts.map +1 -0
  37. package/dist/components/BoxOverlay.js +107 -0
  38. package/dist/components/BoxOverlay.js.map +1 -0
  39. package/dist/components/ColorPickerTool.d.ts +11 -0
  40. package/dist/components/ColorPickerTool.d.ts.map +1 -0
  41. package/dist/components/ColorPickerTool.js +220 -0
  42. package/dist/components/ColorPickerTool.js.map +1 -0
  43. package/dist/components/DensitometerTool.d.ts +25 -0
  44. package/dist/components/DensitometerTool.d.ts.map +1 -0
  45. package/dist/components/DensitometerTool.js +246 -0
  46. package/dist/components/DensitometerTool.js.map +1 -0
  47. package/dist/components/DielineInfoPanel.d.ts +27 -0
  48. package/dist/components/DielineInfoPanel.d.ts.map +1 -0
  49. package/dist/components/DielineInfoPanel.js +23 -0
  50. package/dist/components/DielineInfoPanel.js.map +1 -0
  51. package/dist/components/DielineOverlay.d.ts +10 -0
  52. package/dist/components/DielineOverlay.d.ts.map +1 -0
  53. package/dist/components/DielineOverlay.js +57 -0
  54. package/dist/components/DielineOverlay.js.map +1 -0
  55. package/dist/components/FindingsSidebar.d.ts +50 -0
  56. package/dist/components/FindingsSidebar.d.ts.map +1 -0
  57. package/dist/components/FindingsSidebar.js +78 -0
  58. package/dist/components/FindingsSidebar.js.map +1 -0
  59. package/dist/components/LayerCanvas.d.ts +30 -0
  60. package/dist/components/LayerCanvas.d.ts.map +1 -0
  61. package/dist/components/LayerCanvas.js +84 -0
  62. package/dist/components/LayerCanvas.js.map +1 -0
  63. package/dist/components/LayerPanel.d.ts +9 -0
  64. package/dist/components/LayerPanel.d.ts.map +1 -0
  65. package/dist/components/LayerPanel.js +144 -0
  66. package/dist/components/LayerPanel.js.map +1 -0
  67. package/dist/components/LensPDF.d.ts +61 -0
  68. package/dist/components/LensPDF.d.ts.map +1 -0
  69. package/dist/components/LensPDF.js +49 -0
  70. package/dist/components/LensPDF.js.map +1 -0
  71. package/dist/components/LensPDFDemo.d.ts +160 -0
  72. package/dist/components/LensPDFDemo.d.ts.map +1 -0
  73. package/dist/components/LensPDFDemo.js +1060 -0
  74. package/dist/components/LensPDFDemo.js.map +1 -0
  75. package/dist/components/LensPDFDemo.styles.d.ts +38 -0
  76. package/dist/components/LensPDFDemo.styles.d.ts.map +1 -0
  77. package/dist/components/LensPDFDemo.styles.js +282 -0
  78. package/dist/components/LensPDFDemo.styles.js.map +1 -0
  79. package/dist/components/LensPDFViewer.d.ts +79 -0
  80. package/dist/components/LensPDFViewer.d.ts.map +1 -0
  81. package/dist/components/LensPDFViewer.js +254 -0
  82. package/dist/components/LensPDFViewer.js.map +1 -0
  83. package/dist/components/MeasureTool.d.ts +16 -0
  84. package/dist/components/MeasureTool.d.ts.map +1 -0
  85. package/dist/components/MeasureTool.js +137 -0
  86. package/dist/components/MeasureTool.js.map +1 -0
  87. package/dist/components/MobileBottomSheet.d.ts +12 -0
  88. package/dist/components/MobileBottomSheet.d.ts.map +1 -0
  89. package/dist/components/MobileBottomSheet.js +113 -0
  90. package/dist/components/MobileBottomSheet.js.map +1 -0
  91. package/dist/components/MobileDrawer.d.ts +31 -0
  92. package/dist/components/MobileDrawer.d.ts.map +1 -0
  93. package/dist/components/MobileDrawer.js +67 -0
  94. package/dist/components/MobileDrawer.js.map +1 -0
  95. package/dist/components/PageCanvas.d.ts +33 -0
  96. package/dist/components/PageCanvas.d.ts.map +1 -0
  97. package/dist/components/PageCanvas.js +385 -0
  98. package/dist/components/PageCanvas.js.map +1 -0
  99. package/dist/components/PageNavigator.d.ts +18 -0
  100. package/dist/components/PageNavigator.d.ts.map +1 -0
  101. package/dist/components/PageNavigator.js +44 -0
  102. package/dist/components/PageNavigator.js.map +1 -0
  103. package/dist/components/SeparationCanvas.d.ts +12 -0
  104. package/dist/components/SeparationCanvas.d.ts.map +1 -0
  105. package/dist/components/SeparationCanvas.js +174 -0
  106. package/dist/components/SeparationCanvas.js.map +1 -0
  107. package/dist/components/TACHeatmapOverlay.d.ts +17 -0
  108. package/dist/components/TACHeatmapOverlay.d.ts.map +1 -0
  109. package/dist/components/TACHeatmapOverlay.js +119 -0
  110. package/dist/components/TACHeatmapOverlay.js.map +1 -0
  111. package/dist/components/ZoomControls.d.ts +11 -0
  112. package/dist/components/ZoomControls.d.ts.map +1 -0
  113. package/dist/components/ZoomControls.js +26 -0
  114. package/dist/components/ZoomControls.js.map +1 -0
  115. package/dist/components/defaultShellPlugins.d.ts +3 -0
  116. package/dist/components/defaultShellPlugins.d.ts.map +1 -0
  117. package/dist/components/defaultShellPlugins.js +273 -0
  118. package/dist/components/defaultShellPlugins.js.map +1 -0
  119. package/dist/components/index.d.ts +32 -0
  120. package/dist/components/index.d.ts.map +1 -0
  121. package/dist/components/index.js +32 -0
  122. package/dist/components/index.js.map +1 -0
  123. package/dist/components/presets.d.ts +8 -0
  124. package/dist/components/presets.d.ts.map +1 -0
  125. package/dist/components/presets.js +14 -0
  126. package/dist/components/presets.js.map +1 -0
  127. package/dist/components/shellPlugins.d.ts +105 -0
  128. package/dist/components/shellPlugins.d.ts.map +1 -0
  129. package/dist/components/shellPlugins.js +52 -0
  130. package/dist/components/shellPlugins.js.map +1 -0
  131. package/dist/components/useIsMobile.d.ts +16 -0
  132. package/dist/components/useIsMobile.d.ts.map +1 -0
  133. package/dist/components/useIsMobile.js +30 -0
  134. package/dist/components/useIsMobile.js.map +1 -0
  135. package/dist/fallback-pdfjs/index.d.ts +60 -0
  136. package/dist/fallback-pdfjs/index.d.ts.map +1 -0
  137. package/dist/fallback-pdfjs/index.js +163 -0
  138. package/dist/fallback-pdfjs/index.js.map +1 -0
  139. package/dist/host/LensPDFProvider.d.ts +36 -0
  140. package/dist/host/LensPDFProvider.d.ts.map +1 -0
  141. package/dist/host/LensPDFProvider.js +12 -0
  142. package/dist/host/LensPDFProvider.js.map +1 -0
  143. package/dist/host/index.d.ts +167 -0
  144. package/dist/host/index.d.ts.map +1 -0
  145. package/dist/host/index.js +173 -0
  146. package/dist/host/index.js.map +1 -0
  147. package/dist/host/pdfFallback.d.ts +50 -0
  148. package/dist/host/pdfFallback.d.ts.map +1 -0
  149. package/dist/host/pdfFallback.js +171 -0
  150. package/dist/host/pdfFallback.js.map +1 -0
  151. package/dist/host/pdfValidation.d.ts +45 -0
  152. package/dist/host/pdfValidation.d.ts.map +1 -0
  153. package/dist/host/pdfValidation.js +78 -0
  154. package/dist/host/pdfValidation.js.map +1 -0
  155. package/dist/host/shareLink.d.ts +80 -0
  156. package/dist/host/shareLink.d.ts.map +1 -0
  157. package/dist/host/shareLink.js +114 -0
  158. package/dist/host/shareLink.js.map +1 -0
  159. package/dist/host/useLensPDF.d.ts +73 -0
  160. package/dist/host/useLensPDF.d.ts.map +1 -0
  161. package/dist/host/useLensPDF.js +213 -0
  162. package/dist/host/useLensPDF.js.map +1 -0
  163. package/dist/index.d.ts +68 -0
  164. package/dist/index.d.ts.map +1 -0
  165. package/dist/index.js +62 -0
  166. package/dist/index.js.map +1 -0
  167. package/dist/plugin/context.d.ts +70 -0
  168. package/dist/plugin/context.d.ts.map +1 -0
  169. package/dist/plugin/context.js +16 -0
  170. package/dist/plugin/context.js.map +1 -0
  171. package/dist/plugin/findings-location.d.ts +53 -0
  172. package/dist/plugin/findings-location.d.ts.map +1 -0
  173. package/dist/plugin/findings-location.js +72 -0
  174. package/dist/plugin/findings-location.js.map +1 -0
  175. package/dist/plugin/index.d.ts +19 -0
  176. package/dist/plugin/index.d.ts.map +1 -0
  177. package/dist/plugin/index.js +16 -0
  178. package/dist/plugin/index.js.map +1 -0
  179. package/dist/plugin/registry.d.ts +61 -0
  180. package/dist/plugin/registry.d.ts.map +1 -0
  181. package/dist/plugin/registry.js +102 -0
  182. package/dist/plugin/registry.js.map +1 -0
  183. package/dist/plugin/services.d.ts +380 -0
  184. package/dist/plugin/services.d.ts.map +1 -0
  185. package/dist/plugin/services.js +104 -0
  186. package/dist/plugin/services.js.map +1 -0
  187. package/dist/plugin/types.d.ts +198 -0
  188. package/dist/plugin/types.d.ts.map +1 -0
  189. package/dist/plugin/types.js +24 -0
  190. package/dist/plugin/types.js.map +1 -0
  191. package/dist/types/index.d.ts +191 -0
  192. package/dist/types/index.d.ts.map +1 -0
  193. package/dist/types/index.js +95 -0
  194. package/dist/types/index.js.map +1 -0
  195. package/dist/units/index.d.ts +64 -0
  196. package/dist/units/index.d.ts.map +1 -0
  197. package/dist/units/index.js +98 -0
  198. package/dist/units/index.js.map +1 -0
  199. package/docs/architecture.md +90 -0
  200. package/docs/components.md +569 -0
  201. package/docs/contributing.md +78 -0
  202. package/docs/fallback.md +174 -0
  203. package/docs/lens-pdf-viewer.md +128 -0
  204. package/docs/licensing.md +78 -0
  205. package/docs/measurement-units.md +87 -0
  206. package/docs/plugins.md +256 -0
  207. package/docs/security.md +69 -0
  208. package/docs/server.md +212 -0
  209. package/docs/services.md +210 -0
  210. package/docs/share-links.md +111 -0
  211. package/docs/theming.md +164 -0
  212. package/docs/validation.md +83 -0
  213. package/package.json +139 -0
@@ -0,0 +1,256 @@
1
+ /**
2
+ * Codex accuracy overlay for `<LensPDFDemo>`.
3
+ *
4
+ * When a host passes a `codex` client, `LensPDFDemo` fires
5
+ * `extractStream` in the background. This module wraps the codex
6
+ * render APIs (renderSeparations, renderHeatmap, renderLayer) into
7
+ * the `ViewerServices` slot interface so the viewer can swap in
8
+ * Ghostscript-accurate renders silently once they arrive.
9
+ *
10
+ * This module has **no import of `@printwithsynergy/codex-client`**.
11
+ * It defines a minimal structural interface — any object whose shape
12
+ * matches `MinimalCodexClient` (including `HttpClient` from
13
+ * `@printwithsynergy/codex-client`) satisfies it.
14
+ *
15
+ * @public
16
+ */
17
+ import { PROCESS_CHANNELS } from "./constants.js";
18
+ // ---------------------------------------------------------------------------
19
+ // Ink / layer extraction helpers
20
+ // ---------------------------------------------------------------------------
21
+ /**
22
+ * Extract a `DetectedInk[]` from the `color_world` SSE event payload.
23
+ * Returns the 4 CMYK process channels plus any spot colorants the
24
+ * PDF declares (accurate — from pikepdf, not regex scanning).
25
+ *
26
+ * @public
27
+ */
28
+ export function extractInksFromColorWorld(colorWorld) {
29
+ const process = PROCESS_CHANNELS.map((name) => ({
30
+ name,
31
+ type: "process",
32
+ altRgb: _PROCESS_INK_RGB[name.toLowerCase()] ?? [0, 0, 0],
33
+ }));
34
+ const spots = [];
35
+ const colorants = colorWorld["spot_colorants"];
36
+ if (Array.isArray(colorants)) {
37
+ for (const c of colorants) {
38
+ if (!c || typeof c !== "object")
39
+ continue;
40
+ const name = String(c["name"] ?? "");
41
+ if (!name)
42
+ continue;
43
+ const rgb = c["rgb"];
44
+ let altRgb = [128, 128, 128];
45
+ if (Array.isArray(rgb) && rgb.length >= 3) {
46
+ altRgb = [
47
+ Math.round(Number(rgb[0]) * 255),
48
+ Math.round(Number(rgb[1]) * 255),
49
+ Math.round(Number(rgb[2]) * 255),
50
+ ];
51
+ }
52
+ spots.push({ name, type: "spot", altRgb });
53
+ }
54
+ }
55
+ return [...process, ...spots];
56
+ }
57
+ /** @internal */
58
+ const _PROCESS_INK_RGB = {
59
+ cyan: [0, 174, 239],
60
+ magenta: [236, 0, 140],
61
+ yellow: [255, 242, 0],
62
+ black: [35, 31, 32],
63
+ };
64
+ /**
65
+ * Extract a layer list from the `ocgs` SSE event payload.
66
+ *
67
+ * @public
68
+ */
69
+ export function extractLayersFromOcgs(ocgs) {
70
+ const list = ocgs["ocgs"];
71
+ if (!Array.isArray(list))
72
+ return [];
73
+ const result = [];
74
+ for (let i = 0; i < list.length; i++) {
75
+ const item = list[i];
76
+ if (!item || typeof item !== "object")
77
+ continue;
78
+ const name = String(item["name"] ?? `Layer ${i + 1}`);
79
+ const defaultOn = item["default_on"];
80
+ result.push({
81
+ name,
82
+ ocg_index: i,
83
+ default_on: defaultOn !== false,
84
+ });
85
+ }
86
+ return result;
87
+ }
88
+ /**
89
+ * Build `separations`, `tacHeatmap`, and `layers` service slots backed
90
+ * by the codex render APIs. Lazy: each page's renders are fetched the
91
+ * first time they're requested, then cached as blob URLs.
92
+ *
93
+ * Hosts swap these into `ViewerServices` after `phase2_complete` fires
94
+ * so pdfjs approximations are replaced by Ghostscript renders.
95
+ *
96
+ * @public
97
+ */
98
+ export function createCodexOverlayServices(client, sha256, tacLimit, layerData) {
99
+ const pdfRef = { sha256 };
100
+ // Blob URL caches
101
+ // Separations: keyed `${pageNum}|${channelName}` → url
102
+ const channelUrls = new Map();
103
+ const channelBuilds = new Map();
104
+ // Heatmaps: keyed `${pageNum}|${limit}` → url
105
+ const heatmapUrls = new Map();
106
+ const heatmapBuilds = new Map();
107
+ // Layers: keyed `${pageNum}|${layerIndex}` → url
108
+ const layerUrlMap = new Map();
109
+ const layerBuilds = new Map();
110
+ const blobs = [];
111
+ const subscribers = new Set();
112
+ function notify() {
113
+ for (const cb of subscribers)
114
+ cb();
115
+ }
116
+ function makeBlobUrl(bytes, type = "image/png") {
117
+ // Copy into a plain ArrayBuffer to satisfy Blob's type constraints
118
+ // (TypeScript requires ArrayBuffer, not SharedArrayBuffer).
119
+ const ab = bytes.buffer instanceof ArrayBuffer
120
+ ? bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)
121
+ : new Uint8Array(bytes).buffer;
122
+ const blob = new Blob([ab], { type });
123
+ const url = URL.createObjectURL(blob);
124
+ blobs.push(url);
125
+ return url;
126
+ }
127
+ function base64ToUint8Array(b64) {
128
+ const raw = atob(b64);
129
+ const out = new Uint8Array(raw.length);
130
+ for (let i = 0; i < raw.length; i++)
131
+ out[i] = raw.charCodeAt(i);
132
+ return out;
133
+ }
134
+ // Fetch all channels for a page in one call, cache each individually.
135
+ function ensureChannelsForPage(pageNum) {
136
+ const buildKey = `page:${pageNum}`;
137
+ if (channelBuilds.has(buildKey))
138
+ return;
139
+ const promise = client
140
+ .renderSeparations(pdfRef, { page: pageNum })
141
+ .then((result) => {
142
+ for (const ch of result.channels) {
143
+ const key = `${pageNum}|${ch.name}`;
144
+ if (channelUrls.has(key))
145
+ continue;
146
+ try {
147
+ const bytes = base64ToUint8Array(ch.png_b64);
148
+ channelUrls.set(key, makeBlobUrl(bytes));
149
+ }
150
+ catch {
151
+ // Skip bad channel silently.
152
+ }
153
+ }
154
+ channelBuilds.delete(buildKey);
155
+ notify();
156
+ })
157
+ .catch(() => {
158
+ channelBuilds.delete(buildKey);
159
+ });
160
+ channelBuilds.set(buildKey, promise);
161
+ }
162
+ function ensureHeatmap(pageNum, limit) {
163
+ const key = `${pageNum}|${limit}`;
164
+ if (heatmapUrls.has(key) || heatmapBuilds.has(key))
165
+ return;
166
+ const promise = client
167
+ .renderHeatmap(pdfRef, { page: pageNum, tacLimit: limit })
168
+ .then((result) => {
169
+ const url = makeBlobUrl(result.png);
170
+ heatmapUrls.set(key, url);
171
+ heatmapBuilds.delete(key);
172
+ notify();
173
+ return url;
174
+ })
175
+ .catch(() => {
176
+ heatmapBuilds.delete(key);
177
+ return "";
178
+ });
179
+ heatmapBuilds.set(key, promise);
180
+ }
181
+ const allLayerIndices = layerData.map((l) => l.ocg_index);
182
+ function ensureLayer(pageNum, layerIndex) {
183
+ const key = `${pageNum}|${layerIndex}`;
184
+ if (layerUrlMap.has(key) || layerBuilds.has(key))
185
+ return;
186
+ const promise = client
187
+ .renderLayer(pdfRef, { page: pageNum, layerIndex, allLayerIndices })
188
+ .then((bytes) => {
189
+ const url = makeBlobUrl(bytes);
190
+ layerUrlMap.set(key, url);
191
+ layerBuilds.delete(key);
192
+ notify();
193
+ return url;
194
+ })
195
+ .catch(() => {
196
+ layerBuilds.delete(key);
197
+ return "";
198
+ });
199
+ layerBuilds.set(key, promise);
200
+ }
201
+ const separations = {
202
+ getChannelImageUrl({ pageNum, channelName }) {
203
+ const key = `${pageNum}|${channelName}`;
204
+ const cached = channelUrls.get(key);
205
+ if (cached)
206
+ return cached;
207
+ ensureChannelsForPage(pageNum);
208
+ return "";
209
+ },
210
+ };
211
+ const tacHeatmap = {
212
+ getHeatmapImageUrl({ pageNum, tacLimit: tl }) {
213
+ const limit = tl ?? tacLimit;
214
+ const key = `${pageNum}|${limit}`;
215
+ const cached = heatmapUrls.get(key);
216
+ if (cached)
217
+ return cached;
218
+ ensureHeatmap(pageNum, limit);
219
+ return "";
220
+ },
221
+ listRuns: async (_args) => [],
222
+ };
223
+ const layers = {
224
+ getLayerImageUrl({ pageNum, layerIndex }) {
225
+ const key = `${pageNum}|${layerIndex}`;
226
+ const cached = layerUrlMap.get(key);
227
+ if (cached)
228
+ return cached;
229
+ ensureLayer(pageNum, layerIndex);
230
+ return "";
231
+ },
232
+ listLayers: async () => layerData,
233
+ };
234
+ return {
235
+ separations,
236
+ tacHeatmap,
237
+ layers,
238
+ subscribe(listener) {
239
+ subscribers.add(listener);
240
+ return () => subscribers.delete(listener);
241
+ },
242
+ dispose() {
243
+ for (const url of blobs)
244
+ URL.revokeObjectURL(url);
245
+ blobs.length = 0;
246
+ channelUrls.clear();
247
+ channelBuilds.clear();
248
+ heatmapUrls.clear();
249
+ heatmapBuilds.clear();
250
+ layerUrlMap.clear();
251
+ layerBuilds.clear();
252
+ subscribers.clear();
253
+ },
254
+ };
255
+ }
256
+ //# sourceMappingURL=codexOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codexOverlay.js","sourceRoot":"","sources":["../../browser/codexOverlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAqC/C,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAmC;IAEnC,MAAM,OAAO,GAAmB,gBAAsC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpF,IAAI;QACJ,IAAI,EAAE,SAAkB;QACxB,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAA8B;KACxF,CAAC,CAAC,CAAC;IAEJ,MAAM,KAAK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;YACtC,MAAM,GAAG,GAAG,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAC;YAC1B,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,SAA4E;KACrG,CAAC;IAEF,OAAO;QACL,WAAW;QACX,UAAU;QACV,MAAM;QACN,SAAS,CAAC,QAAQ;YAChB,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC1B,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO;YACL,KAAK,MAAM,GAAG,IAAI,KAAK;gBAAE,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAClD,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACjB,WAAW,CAAC,KAAK,EAAE,CAAC;YACpB,aAAa,CAAC,KAAK,EAAE,CAAC;YACtB,WAAW,CAAC,KAAK,EAAE,CAAC;YACpB,aAAa,CAAC,KAAK,EAAE,CAAC;YACtB,WAAW,CAAC,KAAK,EAAE,CAAC;YACpB,WAAW,CAAC,KAAK,EAAE,CAAC;YACpB,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Module-local constants extracted to break a circular import between
3
+ * `browser/index.ts` and `browser/codexOverlay.ts`. Astro / Node SSR
4
+ * evaluates ESM modules in a strict order, and re-exporting
5
+ * `codexOverlay` from `index` while `codexOverlay` reads
6
+ * `PROCESS_CHANNELS` back from `index` triggered a TDZ
7
+ * `Cannot access '_CHANNELS' before initialization` at request time.
8
+ *
9
+ * Keep this file dependency-free.
10
+ */
11
+ /** Process inks the demo synthesises from RGB. */
12
+ export declare const PROCESS_CHANNELS: readonly ["Cyan", "Magenta", "Yellow", "Black"];
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../browser/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kDAAkD;AAClD,eAAO,MAAM,gBAAgB,iDAAkD,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Module-local constants extracted to break a circular import between
3
+ * `browser/index.ts` and `browser/codexOverlay.ts`. Astro / Node SSR
4
+ * evaluates ESM modules in a strict order, and re-exporting
5
+ * `codexOverlay` from `index` while `codexOverlay` reads
6
+ * `PROCESS_CHANNELS` back from `index` triggered a TDZ
7
+ * `Cannot access '_CHANNELS' before initialization` at request time.
8
+ *
9
+ * Keep this file dependency-free.
10
+ */
11
+ /** Process inks the demo synthesises from RGB. */
12
+ export const PROCESS_CHANNELS = ["Cyan", "Magenta", "Yellow", "Black"];
13
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../browser/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kDAAkD;AAClD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC"}
@@ -0,0 +1,211 @@
1
+ /**
2
+ * `@printwithsynergy/lens-pdf/browser`
3
+ *
4
+ * Browser-only ViewerServices factory. One call gives you a fully
5
+ * wired {@link ViewerServices} instance backed by pdf.js — every
6
+ * tool the package ships (page raster, layers, separations, TAC
7
+ * heatmap, color picker, densitometer, in-browser annotations)
8
+ * works against any PDF the browser can fetch, without a server
9
+ * backend.
10
+ *
11
+ * ```ts
12
+ * import { createBrowserViewerServices } from "@printwithsynergy/lens-pdf/browser";
13
+ * const services = createBrowserViewerServices({ pdfUrl: "/proofs/abc.pdf" });
14
+ * await services.prepare(1); // pre-warm separations + heatmap + layers for page 1
15
+ * // <ViewerServicesContext.Provider value={services}> ... </Provider>
16
+ * services.dispose(); // free blob URLs / pdf.js doc on unmount
17
+ * ```
18
+ *
19
+ * Server-only features (true ICC separations, preflight findings,
20
+ * server-persisted annotations, PDF report exports) are explicitly
21
+ * left as `markUnwired` no-ops; their components self-hide.
22
+ *
23
+ * The CMYK numbers here are **rich-black approximations**, not ICC.
24
+ * Solid black RGB(0,0,0) reads as C=100, M=100, Y=100, K=80, TAC≈380%
25
+ * — close enough to a press CMYK rich-black to make the TAC heatmap
26
+ * and densitometer behave like their real backends. Production
27
+ * hosts wire a Ghostscript / MuPDF backend for ICC-correct readings.
28
+ *
29
+ * **Security**: this factory fetches whatever URL the host hands it.
30
+ * Sign / scope / expire the URL the same way you would any other PDF
31
+ * download — the viewer is a pure renderer and trusts the host to
32
+ * enforce access control upstream.
33
+ *
34
+ * @public
35
+ */
36
+ export type { MinimalCodexClient, CodexOverlayServices } from "./codexOverlay";
37
+ export { createCodexOverlayServices, extractInksFromColorWorld, extractLayersFromOcgs } from "./codexOverlay";
38
+ import { type ThemeTokens, type ViewerServices } from "../plugin/services";
39
+ export { PROCESS_CHANNELS } from "./constants";
40
+ export { pantoneGoldLookup, processPlateLookup, resolveSpotSwatch, rgbToHex, } from "./pantone-gold";
41
+ /**
42
+ * A single ink reported by the densitometer / color picker.
43
+ *
44
+ * @public
45
+ */
46
+ export interface DetectedInk {
47
+ /** Display name — `"Cyan"`, `"PANTONE 185 C"`, `"Reflex Blue"` … */
48
+ name: string;
49
+ /** `process` for CMYK plates pdf.js composites in RGB; `spot` for
50
+ * Separation / DeviceN colorants the host PDF declares. */
51
+ type: "process" | "spot";
52
+ /** Synthetic alternate sRGB triplet used to estimate coverage from
53
+ * the rasterised RGB pixel. For process inks this is the canonical
54
+ * CMYK→sRGB primary; for spots it's parsed from the PDF when
55
+ * available, otherwise hash-derived from the spot name so each
56
+ * spot still gets a stable, distinct hue. */
57
+ altRgb: [number, number, number];
58
+ }
59
+ /**
60
+ * Default URL for the pdf.js worker, served via unpkg pinned to the
61
+ * exact `pdfjs-dist` version this package was built against. Hosts
62
+ * that don't want a runtime CDN dep can override via the
63
+ * `workerSrc` option, set `pdfjs.GlobalWorkerOptions.workerSrc`
64
+ * directly before constructing the services, or self-host the file.
65
+ *
66
+ * @public
67
+ */
68
+ export declare const defaultBrowserWorkerSrc: string;
69
+ /**
70
+ * Convert an sRGB triplet to a CMYK approximation. Uses an additive
71
+ * decomposition with a "rich-black" K plate:
72
+ *
73
+ * C = 1 - R/255
74
+ * M = 1 - G/255
75
+ * Y = 1 - B/255
76
+ * K = min(C, M, Y) × {@link K_FACTOR}
77
+ * TAC = (C + M + Y + K) × 100 // [0, 380]
78
+ *
79
+ * Returns each ink in [0, 1] and total area coverage as a percentage
80
+ * in [0, 380].
81
+ *
82
+ * This is intentionally NOT a GCR substitution — keeping the full
83
+ * C/M/Y values lets the TAC heatmap actually trip on solid-black
84
+ * artwork instead of bottoming out at 100 % from K alone, which is
85
+ * the behaviour print-prepress reviewers expect.
86
+ *
87
+ * @public
88
+ */
89
+ export declare function rgbToCmyk(r: number, g: number, b: number): {
90
+ c: number;
91
+ m: number;
92
+ y: number;
93
+ k: number;
94
+ tac: number;
95
+ };
96
+ /**
97
+ * Best-effort spot-ink detector. Scans the raw PDF bytes (latin-1
98
+ * decoded) for `/Separation /Name …` and `/DeviceN [/N1 /N2 …]`
99
+ * declarations. Misses spots inside compressed object streams — for
100
+ * those the densitometer falls back to "process only" with no harm
101
+ * done. Hosts that need 100 % accurate ink lists wire a backend.
102
+ *
103
+ * @public
104
+ */
105
+ export declare function detectSpotInksFromPdfBytes(bytes: Uint8Array): DetectedInk[];
106
+ /**
107
+ * Options for {@link createBrowserViewerServices}.
108
+ *
109
+ * @public
110
+ */
111
+ export interface BrowserViewerServicesOptions {
112
+ /** Raw PDF URL the browser can fetch. */
113
+ pdfUrl: string;
114
+ /**
115
+ * Optional override for the pdf.js worker URL. Default:
116
+ * {@link defaultBrowserWorkerSrc}.
117
+ */
118
+ workerSrc?: string;
119
+ /**
120
+ * Theme tokens to expose on `services.tokens`. Defaults to the
121
+ * package's neutral light palette.
122
+ */
123
+ tokens?: ThemeTokens;
124
+ /**
125
+ * Default TAC limit (in percent) used when the host doesn't specify
126
+ * one explicitly. The TAC heatmap and densitometer both respect the
127
+ * per-call value first; this is only used when the call site omits
128
+ * it. Default 300 — typical sheet-fed press limit.
129
+ */
130
+ tacLimit?: number;
131
+ /**
132
+ * Email used as the synthetic author for the in-browser annotation
133
+ * service. Default: `"you@browser.local"`.
134
+ */
135
+ annotationAuthorEmail?: string;
136
+ }
137
+ /**
138
+ * Augmented `ViewerServices` returned by {@link createBrowserViewerServices}.
139
+ * Extends the wire protocol with lifecycle helpers, a subscription
140
+ * hook that fires whenever a lazily-built tile URL becomes available,
141
+ * and a `prepare()` method that pre-warms the analysis raster, every
142
+ * channel, the TAC heatmap, and (if the PDF has OCGs) every layer
143
+ * for a given page.
144
+ *
145
+ * @public
146
+ */
147
+ export interface BrowserViewerServices extends ViewerServices {
148
+ /** How many pages the underlying PDF has (resolves once parsed). */
149
+ getPageCount(): Promise<number>;
150
+ /** Page dimensions in PDF points for `pageNum` (1-indexed). */
151
+ getPageDimensions(pageNum: number): Promise<{
152
+ widthPts: number;
153
+ heightPts: number;
154
+ }>;
155
+ /**
156
+ * Inks the densitometer + color picker will report on. Always
157
+ * includes the four CMYK process plates pdf.js composites in RGB,
158
+ * plus any spot inks we could extract from the raw PDF bytes
159
+ * (Separation / DeviceN declarations outside compressed streams).
160
+ * Resolves once the PDF has been parsed.
161
+ */
162
+ getInks(): Promise<DetectedInk[]>;
163
+ /**
164
+ * Pre-build analysis raster + every CMYK channel image + the TAC
165
+ * heatmap + every layer image for `pageNum`. Resolves once they're
166
+ * all cached so the synchronous URL builders return real blob URLs
167
+ * rather than placeholders. Hosts mounting `<SeparationCanvas>`,
168
+ * `<TACHeatmapOverlay>`, or `<LayerCanvas>` should `await` this
169
+ * before mounting the canvas — those components cache the first
170
+ * loaded image and never retry on URL change.
171
+ */
172
+ prepare(pageNum: number, opts?: {
173
+ tacLimit?: number;
174
+ }): Promise<{
175
+ widthPts: number;
176
+ heightPts: number;
177
+ layerCount: number;
178
+ }>;
179
+ /**
180
+ * Subscribe to "URL available" notifications. Components that read
181
+ * synchronous URL builders (`pageImages.getPageImageUrl` in
182
+ * particular) should re-render on each event so the next builder
183
+ * call returns the freshly-cached blob URL instead of the
184
+ * placeholder.
185
+ */
186
+ subscribe(listener: () => void): () => void;
187
+ /** Free every blob URL the services minted. Call on unmount. */
188
+ dispose(): void;
189
+ }
190
+ /**
191
+ * Build a fully-wired {@link ViewerServices} backed by pdf.js. Every
192
+ * service the package consumes is implemented; consumers can drop the
193
+ * returned object straight into a `<ViewerServicesContext.Provider>`
194
+ * and every viewer-only feature works.
195
+ *
196
+ * @public
197
+ */
198
+ export declare function createBrowserViewerServices(opts: BrowserViewerServicesOptions): BrowserViewerServices;
199
+ /**
200
+ * React hook that re-renders whenever a {@link BrowserViewerServices}
201
+ * instance fires a `subscribe` event (i.e. a lazily-built page tile,
202
+ * channel image, heatmap, or annotation has become available).
203
+ *
204
+ * Use this in the top-level component that holds the services instance
205
+ * so children re-read the synchronous URL builders and pick up freshly-
206
+ * cached blob URLs.
207
+ *
208
+ * @public
209
+ */
210
+ export declare function useBrowserViewerServicesVersion(services: BrowserViewerServices | null | undefined): number;
211
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB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