@printwithsynergy/artwork-pdf-editor 0.1.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/LICENSE +62 -0
  2. package/README.md +63 -2
  3. package/dist/components/AccessibilityHintsPanel.d.ts +142 -0
  4. package/dist/components/AccessibilityHintsPanel.d.ts.map +1 -0
  5. package/dist/components/AccessibilityHintsPanel.js +158 -0
  6. package/dist/components/AccessibilityHintsPanel.js.map +1 -0
  7. package/dist/components/AnnotationOverlay.d.ts +142 -0
  8. package/dist/components/AnnotationOverlay.d.ts.map +1 -0
  9. package/dist/components/AnnotationOverlay.js +141 -0
  10. package/dist/components/AnnotationOverlay.js.map +1 -0
  11. package/dist/components/AnnotationsSidebar.d.ts +98 -0
  12. package/dist/components/AnnotationsSidebar.d.ts.map +1 -0
  13. package/dist/components/AnnotationsSidebar.js +100 -0
  14. package/dist/components/AnnotationsSidebar.js.map +1 -0
  15. package/dist/components/BarcodeGeneratorPanel.d.ts +58 -0
  16. package/dist/components/BarcodeGeneratorPanel.d.ts.map +1 -0
  17. package/dist/components/BarcodeGeneratorPanel.js +91 -0
  18. package/dist/components/BarcodeGeneratorPanel.js.map +1 -0
  19. package/dist/components/BraillePanel.d.ts +99 -0
  20. package/dist/components/BraillePanel.d.ts.map +1 -0
  21. package/dist/components/BraillePanel.js +221 -0
  22. package/dist/components/BraillePanel.js.map +1 -0
  23. package/dist/components/BrandAssetsPanel.d.ts +130 -0
  24. package/dist/components/BrandAssetsPanel.d.ts.map +1 -0
  25. package/dist/components/BrandAssetsPanel.js +125 -0
  26. package/dist/components/BrandAssetsPanel.js.map +1 -0
  27. package/dist/components/BrandConsistencyPanel.d.ts +140 -0
  28. package/dist/components/BrandConsistencyPanel.d.ts.map +1 -0
  29. package/dist/components/BrandConsistencyPanel.js +158 -0
  30. package/dist/components/BrandConsistencyPanel.js.map +1 -0
  31. package/dist/components/ComplianceFindingsPanel.d.ts +62 -0
  32. package/dist/components/ComplianceFindingsPanel.d.ts.map +1 -0
  33. package/dist/components/ComplianceFindingsPanel.js +118 -0
  34. package/dist/components/ComplianceFindingsPanel.js.map +1 -0
  35. package/dist/components/DesignSuggestionsPanel.d.ts +148 -0
  36. package/dist/components/DesignSuggestionsPanel.d.ts.map +1 -0
  37. package/dist/components/DesignSuggestionsPanel.js +154 -0
  38. package/dist/components/DesignSuggestionsPanel.js.map +1 -0
  39. package/dist/components/DielineParametersPanel.d.ts +62 -0
  40. package/dist/components/DielineParametersPanel.d.ts.map +1 -0
  41. package/dist/components/DielineParametersPanel.js +170 -0
  42. package/dist/components/DielineParametersPanel.js.map +1 -0
  43. package/dist/components/DielinePreview.d.ts +150 -0
  44. package/dist/components/DielinePreview.d.ts.map +1 -0
  45. package/dist/components/DielinePreview.js +146 -0
  46. package/dist/components/DielinePreview.js.map +1 -0
  47. package/dist/components/EditorApp.d.ts +39 -5
  48. package/dist/components/EditorApp.d.ts.map +1 -1
  49. package/dist/components/EditorApp.js +110 -5
  50. package/dist/components/EditorApp.js.map +1 -1
  51. package/dist/components/EditorCanvas.d.ts +51 -2
  52. package/dist/components/EditorCanvas.d.ts.map +1 -1
  53. package/dist/components/EditorCanvas.js +117 -48
  54. package/dist/components/EditorCanvas.js.map +1 -1
  55. package/dist/components/EmailNotifyPanel.d.ts +165 -0
  56. package/dist/components/EmailNotifyPanel.d.ts.map +1 -0
  57. package/dist/components/EmailNotifyPanel.js +211 -0
  58. package/dist/components/EmailNotifyPanel.js.map +1 -0
  59. package/dist/components/FileDropZone.d.ts +9 -1
  60. package/dist/components/FileDropZone.d.ts.map +1 -1
  61. package/dist/components/FileDropZone.js +53 -5
  62. package/dist/components/FileDropZone.js.map +1 -1
  63. package/dist/components/FoldEditorPanel.d.ts +68 -0
  64. package/dist/components/FoldEditorPanel.d.ts.map +1 -0
  65. package/dist/components/FoldEditorPanel.js +65 -0
  66. package/dist/components/FoldEditorPanel.js.map +1 -0
  67. package/dist/components/FoldPreviewOverlay.d.ts +48 -0
  68. package/dist/components/FoldPreviewOverlay.d.ts.map +1 -0
  69. package/dist/components/FoldPreviewOverlay.js +182 -0
  70. package/dist/components/FoldPreviewOverlay.js.map +1 -0
  71. package/dist/components/Gs1DigitalLinkPanel.d.ts +103 -0
  72. package/dist/components/Gs1DigitalLinkPanel.d.ts.map +1 -0
  73. package/dist/components/Gs1DigitalLinkPanel.js +199 -0
  74. package/dist/components/Gs1DigitalLinkPanel.js.map +1 -0
  75. package/dist/components/HistoryPanel.d.ts +39 -0
  76. package/dist/components/HistoryPanel.d.ts.map +1 -0
  77. package/dist/components/HistoryPanel.js +72 -0
  78. package/dist/components/HistoryPanel.js.map +1 -0
  79. package/dist/components/IccSoftProofOverlay.d.ts +67 -0
  80. package/dist/components/IccSoftProofOverlay.d.ts.map +1 -0
  81. package/dist/components/IccSoftProofOverlay.js +119 -0
  82. package/dist/components/IccSoftProofOverlay.js.map +1 -0
  83. package/dist/components/ImposePanel.d.ts +71 -0
  84. package/dist/components/ImposePanel.d.ts.map +1 -0
  85. package/dist/components/ImposePanel.js +127 -0
  86. package/dist/components/ImposePanel.js.map +1 -0
  87. package/dist/components/InksPanel.d.ts +61 -0
  88. package/dist/components/InksPanel.d.ts.map +1 -0
  89. package/dist/components/InksPanel.js +84 -0
  90. package/dist/components/InksPanel.js.map +1 -0
  91. package/dist/components/JobSetupPanel.d.ts +118 -0
  92. package/dist/components/JobSetupPanel.d.ts.map +1 -0
  93. package/dist/components/JobSetupPanel.js +169 -0
  94. package/dist/components/JobSetupPanel.js.map +1 -0
  95. package/dist/components/LayersPanel.d.ts.map +1 -1
  96. package/dist/components/LayersPanel.js +1 -0
  97. package/dist/components/LayersPanel.js.map +1 -1
  98. package/dist/components/MarkLibraryPanel.d.ts +131 -0
  99. package/dist/components/MarkLibraryPanel.d.ts.map +1 -0
  100. package/dist/components/MarkLibraryPanel.js +184 -0
  101. package/dist/components/MarkLibraryPanel.js.map +1 -0
  102. package/dist/components/MisEstimateButton.d.ts +73 -0
  103. package/dist/components/MisEstimateButton.d.ts.map +1 -0
  104. package/dist/components/MisEstimateButton.js +57 -0
  105. package/dist/components/MisEstimateButton.js.map +1 -0
  106. package/dist/components/NutritionPanel.d.ts +118 -0
  107. package/dist/components/NutritionPanel.d.ts.map +1 -0
  108. package/dist/components/NutritionPanel.js +169 -0
  109. package/dist/components/NutritionPanel.js.map +1 -0
  110. package/dist/components/PageNavigator.d.ts +26 -0
  111. package/dist/components/PageNavigator.d.ts.map +1 -0
  112. package/dist/components/PageNavigator.js +96 -0
  113. package/dist/components/PageNavigator.js.map +1 -0
  114. package/dist/components/PaletteManager.d.ts +32 -0
  115. package/dist/components/PaletteManager.d.ts.map +1 -0
  116. package/dist/components/PaletteManager.js +89 -0
  117. package/dist/components/PaletteManager.js.map +1 -0
  118. package/dist/components/PaletteToSpotPanel.d.ts +122 -0
  119. package/dist/components/PaletteToSpotPanel.d.ts.map +1 -0
  120. package/dist/components/PaletteToSpotPanel.js +160 -0
  121. package/dist/components/PaletteToSpotPanel.js.map +1 -0
  122. package/dist/components/PreflightAutoFixPanel.d.ts +110 -0
  123. package/dist/components/PreflightAutoFixPanel.d.ts.map +1 -0
  124. package/dist/components/PreflightAutoFixPanel.js +119 -0
  125. package/dist/components/PreflightAutoFixPanel.js.map +1 -0
  126. package/dist/components/PreflightDiffPanel.d.ts +127 -0
  127. package/dist/components/PreflightDiffPanel.d.ts.map +1 -0
  128. package/dist/components/PreflightDiffPanel.js +0 -0
  129. package/dist/components/PreflightDiffPanel.js.map +1 -0
  130. package/dist/components/ProcessRulesPanel.d.ts +81 -0
  131. package/dist/components/ProcessRulesPanel.d.ts.map +1 -0
  132. package/dist/components/ProcessRulesPanel.js +143 -0
  133. package/dist/components/ProcessRulesPanel.js.map +1 -0
  134. package/dist/components/SlackNotifyPanel.d.ts +139 -0
  135. package/dist/components/SlackNotifyPanel.d.ts.map +1 -0
  136. package/dist/components/SlackNotifyPanel.js +133 -0
  137. package/dist/components/SlackNotifyPanel.js.map +1 -0
  138. package/dist/components/SmartSpotMatchPanel.d.ts +143 -0
  139. package/dist/components/SmartSpotMatchPanel.d.ts.map +1 -0
  140. package/dist/components/SmartSpotMatchPanel.js +159 -0
  141. package/dist/components/SmartSpotMatchPanel.js.map +1 -0
  142. package/dist/components/SwatchesPicker.d.ts +83 -0
  143. package/dist/components/SwatchesPicker.d.ts.map +1 -0
  144. package/dist/components/SwatchesPicker.js +151 -0
  145. package/dist/components/SwatchesPicker.js.map +1 -0
  146. package/dist/components/TacOverlay.d.ts +47 -0
  147. package/dist/components/TacOverlay.d.ts.map +1 -0
  148. package/dist/components/TacOverlay.js +116 -0
  149. package/dist/components/TacOverlay.js.map +1 -0
  150. package/dist/components/TrapEditorPanel.d.ts +52 -0
  151. package/dist/components/TrapEditorPanel.d.ts.map +1 -0
  152. package/dist/components/TrapEditorPanel.js +64 -0
  153. package/dist/components/TrapEditorPanel.js.map +1 -0
  154. package/dist/components/TrapPreviewOverlay.d.ts +64 -0
  155. package/dist/components/TrapPreviewOverlay.d.ts.map +1 -0
  156. package/dist/components/TrapPreviewOverlay.js +120 -0
  157. package/dist/components/TrapPreviewOverlay.js.map +1 -0
  158. package/dist/components/VariantMatrixPanel.d.ts +61 -0
  159. package/dist/components/VariantMatrixPanel.d.ts.map +1 -0
  160. package/dist/components/VariantMatrixPanel.js +97 -0
  161. package/dist/components/VariantMatrixPanel.js.map +1 -0
  162. package/dist/components/VariantMatrixVersionPanel.d.ts +122 -0
  163. package/dist/components/VariantMatrixVersionPanel.d.ts.map +1 -0
  164. package/dist/components/VariantMatrixVersionPanel.js +162 -0
  165. package/dist/components/VariantMatrixVersionPanel.js.map +1 -0
  166. package/dist/components/WebhookNotifyPanel.d.ts +160 -0
  167. package/dist/components/WebhookNotifyPanel.d.ts.map +1 -0
  168. package/dist/components/WebhookNotifyPanel.js +100 -0
  169. package/dist/components/WebhookNotifyPanel.js.map +1 -0
  170. package/dist/components/WhiteUnderbasePanel.d.ts +107 -0
  171. package/dist/components/WhiteUnderbasePanel.d.ts.map +1 -0
  172. package/dist/components/WhiteUnderbasePanel.js +104 -0
  173. package/dist/components/WhiteUnderbasePanel.js.map +1 -0
  174. package/dist/data/dielines.json +35 -0
  175. package/dist/hooks/useEditorMode.d.ts +25 -5
  176. package/dist/hooks/useEditorMode.d.ts.map +1 -1
  177. package/dist/hooks/useEditorMode.js +18 -5
  178. package/dist/hooks/useEditorMode.js.map +1 -1
  179. package/dist/index.d.ts +49 -2
  180. package/dist/index.d.ts.map +1 -1
  181. package/dist/index.js +49 -2
  182. package/dist/index.js.map +1 -1
  183. package/dist/lens/dieline-overlay.d.ts +25 -0
  184. package/dist/lens/dieline-overlay.d.ts.map +1 -0
  185. package/dist/lens/dieline-overlay.js +50 -0
  186. package/dist/lens/dieline-overlay.js.map +1 -0
  187. package/dist/lens/index.d.ts +27 -0
  188. package/dist/lens/index.d.ts.map +1 -0
  189. package/dist/lens/index.js +28 -0
  190. package/dist/lens/index.js.map +1 -0
  191. package/dist/lens/preflight-findings.d.ts +21 -0
  192. package/dist/lens/preflight-findings.d.ts.map +1 -0
  193. package/dist/lens/preflight-findings.js +82 -0
  194. package/dist/lens/preflight-findings.js.map +1 -0
  195. package/dist/lib/barcode-scan.d.ts +154 -0
  196. package/dist/lib/barcode-scan.d.ts.map +1 -0
  197. package/dist/lib/barcode-scan.js +152 -0
  198. package/dist/lib/barcode-scan.js.map +1 -0
  199. package/dist/lib/color-math.d.ts +76 -0
  200. package/dist/lib/color-math.d.ts.map +1 -0
  201. package/dist/lib/color-math.js +96 -0
  202. package/dist/lib/color-math.js.map +1 -0
  203. package/dist/lib/dieline-template.d.ts +169 -0
  204. package/dist/lib/dieline-template.d.ts.map +1 -1
  205. package/dist/lib/dieline-template.js +229 -1
  206. package/dist/lib/dieline-template.js.map +1 -1
  207. package/dist/lib/editor-config.d.ts +384 -1
  208. package/dist/lib/editor-config.d.ts.map +1 -1
  209. package/dist/lib/editor-config.js +89 -2
  210. package/dist/lib/editor-config.js.map +1 -1
  211. package/dist/lib/fold-geometry.d.ts +144 -0
  212. package/dist/lib/fold-geometry.d.ts.map +1 -0
  213. package/dist/lib/fold-geometry.js +138 -0
  214. package/dist/lib/fold-geometry.js.map +1 -0
  215. package/dist/lib/merge-tokens.d.ts +81 -0
  216. package/dist/lib/merge-tokens.d.ts.map +1 -0
  217. package/dist/lib/merge-tokens.js +88 -0
  218. package/dist/lib/merge-tokens.js.map +1 -0
  219. package/dist/lib/palette-registry.d.ts +40 -0
  220. package/dist/lib/palette-registry.d.ts.map +1 -0
  221. package/dist/lib/palette-registry.js +49 -0
  222. package/dist/lib/palette-registry.js.map +1 -0
  223. package/dist/lib/panel-anchor.d.ts +101 -0
  224. package/dist/lib/panel-anchor.d.ts.map +1 -0
  225. package/dist/lib/panel-anchor.js +68 -0
  226. package/dist/lib/panel-anchor.js.map +1 -0
  227. package/dist/lib/preflight/checks.d.ts.map +1 -1
  228. package/dist/lib/preflight/checks.js +71 -0
  229. package/dist/lib/preflight/checks.js.map +1 -1
  230. package/dist/lib/preflight/types.d.ts.map +1 -1
  231. package/dist/lib/preflight/types.js +11 -0
  232. package/dist/lib/preflight/types.js.map +1 -1
  233. package/dist/lib/rasterize.d.ts +93 -0
  234. package/dist/lib/rasterize.d.ts.map +1 -0
  235. package/dist/lib/rasterize.js +117 -0
  236. package/dist/lib/rasterize.js.map +1 -0
  237. package/dist/lib/separations-registry.d.ts +99 -0
  238. package/dist/lib/separations-registry.d.ts.map +1 -0
  239. package/dist/lib/separations-registry.js +59 -0
  240. package/dist/lib/separations-registry.js.map +1 -0
  241. package/dist/lib/unwired.d.ts +29 -0
  242. package/dist/lib/unwired.d.ts.map +1 -0
  243. package/dist/lib/unwired.js +58 -0
  244. package/dist/lib/unwired.js.map +1 -0
  245. package/package.json +29 -11
  246. package/dist/components/SeparationsPanel.d.ts +0 -9
  247. package/dist/components/SeparationsPanel.d.ts.map +0 -1
  248. package/dist/components/SeparationsPanel.js +0 -168
  249. package/dist/components/SeparationsPanel.js.map +0 -1
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Wave 4 AI3 — Preflight auto-fix suggestions panel.
3
+ *
4
+ * Surfaces host-loader-supplied fix suggestions next to each live
5
+ * preflight finding so a designer can act on a hint without leaving
6
+ * the editor. Typical suggestion sources: a synergy `preflight.fix`
7
+ * AI node, a tenant-trained model behind the host's auth, or a
8
+ * rules-engine that maps `ruleId` → canned remediation.
9
+ *
10
+ * Loader-adapter shape (batched: one call resolves suggestions for
11
+ * every visible finding) matches the rest of the Wave 4 panel family
12
+ * — `ComplianceFindingsPanel`, `MarkLibraryPanel`, etc. — so hosts
13
+ * wire one fetch per mount, not one per row.
14
+ *
15
+ * Hosts wire `onApply` to apply the `applyHint` (e.g. update a fill,
16
+ * adjust TAC, swap a font) — the editor stays runtime-free of the
17
+ * remediation logic.
18
+ *
19
+ * @public
20
+ */
21
+ import type { ReactElement } from "react";
22
+ import type { PreflightFinding } from "./PreflightDiffPanel";
23
+ /**
24
+ * One AI / rules-engine-suggested fix for a preflight finding.
25
+ *
26
+ * `applyHint` is an opaque bag forwarded to `onApply` — its shape is
27
+ * a contract between the host's loader and its `onApply` handler.
28
+ * The panel never inspects it.
29
+ *
30
+ * @public
31
+ */
32
+ export type PreflightFixSuggestion = {
33
+ /** Stable identifier — the panel uses it as the React key for the
34
+ * suggestion row and exposes it through `onApply`. */
35
+ id: string;
36
+ /** One-line headline shown in the row (e.g. "Lower TAC by
37
+ * switching rich black to B=100 K=100"). */
38
+ summary: string;
39
+ /** Optional long-form rationale rendered under the summary. */
40
+ description?: string;
41
+ /** Optional opaque bag describing the change to apply. */
42
+ applyHint?: Record<string, unknown>;
43
+ };
44
+ /**
45
+ * One batched loader result row — pairs a finding's stable
46
+ * {@link findingKey} with the suggestions the loader returned for it.
47
+ * Keyed (rather than indexed) so loaders can re-order findings
48
+ * defensively without the panel mis-pairing rows.
49
+ *
50
+ * @public
51
+ */
52
+ export type PreflightFixSet = {
53
+ findingKey: string;
54
+ suggestions: readonly PreflightFixSuggestion[];
55
+ };
56
+ /**
57
+ * Host adapter — batched: the panel calls it once with every visible
58
+ * finding and the loader resolves a fix set per finding (or an empty
59
+ * set for findings the host can't help with). Hosts should memoize
60
+ * the function with `useCallback` so an unrelated parent re-render
61
+ * doesn't trigger a spurious refetch.
62
+ *
63
+ * @public
64
+ */
65
+ export type PreflightFixLoaderFn = (findings: readonly PreflightFinding[]) => Promise<readonly PreflightFixSet[]>;
66
+ /**
67
+ * Pure helper — derives the stable key the diff and the panel pivot
68
+ * findings on. Matches `PreflightDiffPanel`'s internal keying so the
69
+ * two panels can be wired to a shared `Set<string>` of focused
70
+ * findings.
71
+ *
72
+ * Pure function.
73
+ *
74
+ * @public
75
+ */
76
+ export declare function findingKey(finding: PreflightFinding): string;
77
+ /**
78
+ * Pure helper — flattens a {@link PreflightFixSet} list into a
79
+ * `Map<findingKey, suggestions>` for O(1) row lookup. Returns a fresh
80
+ * `Map` (safe to mutate downstream).
81
+ *
82
+ * @public
83
+ */
84
+ export declare function indexFixSetsByFinding(sets: readonly PreflightFixSet[]): Map<string, readonly PreflightFixSuggestion[]>;
85
+ /**
86
+ * @public
87
+ */
88
+ export type PreflightAutoFixPanelProps = {
89
+ /** The live preflight findings the panel surfaces. Empty array →
90
+ * "preflight is clean" empty state. */
91
+ findings: readonly PreflightFinding[];
92
+ /** Host adapter, see {@link PreflightFixLoaderFn}. */
93
+ loader: PreflightFixLoaderFn;
94
+ /** Fired when the user clicks "Apply" on a suggestion. The host
95
+ * inspects `suggestion.applyHint` and mutates the document. */
96
+ onApply?: (suggestion: PreflightFixSuggestion, finding: PreflightFinding) => void;
97
+ /** Optional active-finding highlight — the matching row renders in
98
+ * the "active" style so hosts can sync the panel selection with
99
+ * the canvas / preflight banner. */
100
+ activeFindingKey?: string;
101
+ };
102
+ /**
103
+ * Stateful panel — loads the suggestion catalogue on mount, surfaces
104
+ * each finding with the matching suggestions, and emits `onApply`.
105
+ * Handles loading / error / empty states inline.
106
+ *
107
+ * @public
108
+ */
109
+ export declare function PreflightAutoFixPanel({ findings, loader, onApply, activeFindingKey, }: PreflightAutoFixPanelProps): ReactElement;
110
+ //# sourceMappingURL=PreflightAutoFixPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreflightAutoFixPanel.d.ts","sourceRoot":"","sources":["../../src/components/PreflightAutoFixPanel.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;2DACuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX;iDAC6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAChD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,KAClC,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;AAEzC;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,eAAe,EAAE,GAC/B,GAAG,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC,CAIhD;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;4CACwC;IACxC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACtC,sDAAsD;IACtD,MAAM,EAAE,oBAAoB,CAAC;IAC7B;oEACgE;IAChE,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,sBAAsB,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClF;;yCAEqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,MAAM,EACN,OAAO,EACP,gBAAgB,GACjB,EAAE,0BAA0B,GAAG,YAAY,CAuH3C"}
@@ -0,0 +1,119 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useEffect, useMemo, useState } from "react";
5
+ /**
6
+ * Pure helper — derives the stable key the diff and the panel pivot
7
+ * findings on. Matches `PreflightDiffPanel`'s internal keying so the
8
+ * two panels can be wired to a shared `Set<string>` of focused
9
+ * findings.
10
+ *
11
+ * Pure function.
12
+ *
13
+ * @public
14
+ */
15
+ export function findingKey(finding) {
16
+ return `${finding.ruleId}|${finding.severity}|${finding.pageIndex ?? "-"}`;
17
+ }
18
+ /**
19
+ * Pure helper — flattens a {@link PreflightFixSet} list into a
20
+ * `Map<findingKey, suggestions>` for O(1) row lookup. Returns a fresh
21
+ * `Map` (safe to mutate downstream).
22
+ *
23
+ * @public
24
+ */
25
+ export function indexFixSetsByFinding(sets) {
26
+ const out = new Map();
27
+ for (const s of sets)
28
+ out.set(s.findingKey, s.suggestions);
29
+ return out;
30
+ }
31
+ /**
32
+ * Stateful panel — loads the suggestion catalogue on mount, surfaces
33
+ * each finding with the matching suggestions, and emits `onApply`.
34
+ * Handles loading / error / empty states inline.
35
+ *
36
+ * @public
37
+ */
38
+ export function PreflightAutoFixPanel({ findings, loader, onApply, activeFindingKey, }) {
39
+ const [sets, setSets] = useState(null);
40
+ const [error, setError] = useState(null);
41
+ const [loading, setLoading] = useState(false);
42
+ useEffect(() => {
43
+ let disposed = false;
44
+ setLoading(true);
45
+ setError(null);
46
+ setSets(null);
47
+ if (findings.length === 0) {
48
+ setLoading(false);
49
+ setSets([]);
50
+ return () => {
51
+ disposed = true;
52
+ };
53
+ }
54
+ void (async () => {
55
+ try {
56
+ const next = await loader(findings);
57
+ if (disposed)
58
+ return;
59
+ setSets(next);
60
+ }
61
+ catch (err) {
62
+ if (disposed)
63
+ return;
64
+ setError(err instanceof Error ? err.message : String(err));
65
+ }
66
+ finally {
67
+ if (!disposed)
68
+ setLoading(false);
69
+ }
70
+ })();
71
+ return () => {
72
+ disposed = true;
73
+ };
74
+ }, [loader, findings]);
75
+ const index = useMemo(() => (sets ? indexFixSetsByFinding(sets) : null), [sets]);
76
+ if (loading) {
77
+ return (_jsx("div", { "data-testid": "preflight-autofix-panel", style: { padding: "0.5rem", opacity: 0.6 }, children: "Loading suggestions\u2026" }));
78
+ }
79
+ if (error) {
80
+ return (_jsxs("div", { "data-testid": "preflight-autofix-panel", role: "alert", style: { padding: "0.5rem", color: "#a00" }, children: ["Couldn't load suggestions: ", error] }));
81
+ }
82
+ if (!index)
83
+ return _jsx("div", { "data-testid": "preflight-autofix-panel" });
84
+ if (findings.length === 0) {
85
+ return (_jsx("div", { "data-testid": "preflight-autofix-panel", style: { padding: "0.5rem", fontSize: "0.875rem", opacity: 0.6 }, children: "Preflight is clean \u2014 no findings to fix." }));
86
+ }
87
+ return (_jsxs("div", { "data-testid": "preflight-autofix-panel", style: { padding: "0.5rem" }, children: [_jsx("header", { style: { marginBottom: "0.5rem" }, children: _jsxs("h3", { style: { margin: 0, fontSize: "0.875rem" }, children: ["Auto-fix (", findings.length, " finding", findings.length === 1 ? "" : "s", ")"] }) }), _jsx("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: findings.map((f) => {
88
+ const key = findingKey(f);
89
+ const suggestions = index.get(key) ?? [];
90
+ const isActive = key === activeFindingKey;
91
+ return (_jsxs("li", { "data-testid": `preflight-autofix-finding-${key}`, style: {
92
+ marginBottom: "0.5rem",
93
+ padding: "0.375rem 0.5rem",
94
+ border: `1px solid ${isActive ? "#2563eb" : "#ddd"}`,
95
+ borderRadius: 4,
96
+ background: isActive ? "#e0ecff" : "transparent",
97
+ }, children: [_jsxs("div", { style: { fontSize: "0.8125rem", fontWeight: 500 }, children: [f.ruleId, " ", _jsxs("span", { style: { color: severityColor(f.severity) }, children: ["(", f.severity, ")"] }), typeof f.pageIndex === "number" && (_jsxs("span", { style: { color: "#666" }, children: [" \u00B7 page ", f.pageIndex + 1] }))] }), suggestions.length === 0 ? (_jsx("div", { style: { fontSize: "0.75rem", color: "#666", marginTop: "0.25rem" }, children: "No suggestions available." })) : (_jsx("ul", { style: { listStyle: "none", padding: 0, margin: "0.25rem 0 0 0" }, children: suggestions.map((s) => (_jsx(PreflightAutoFixSuggestionRow, { suggestion: s, finding: f, onApply: onApply }, s.id))) }))] }, key));
98
+ }) })] }));
99
+ }
100
+ function severityColor(severity) {
101
+ switch (severity) {
102
+ case "error":
103
+ return "#a00";
104
+ case "warn":
105
+ return "#a60";
106
+ case "info":
107
+ return "#06a";
108
+ }
109
+ }
110
+ function PreflightAutoFixSuggestionRow({ suggestion, finding, onApply, }) {
111
+ return (_jsxs("li", { style: {
112
+ display: "flex",
113
+ gap: "0.5rem",
114
+ alignItems: "flex-start",
115
+ padding: "0.25rem 0",
116
+ borderTop: "1px dashed #eee",
117
+ }, children: [_jsxs("div", { style: { flex: 1 }, children: [_jsx("div", { style: { fontSize: "0.8125rem" }, children: suggestion.summary }), suggestion.description && (_jsx("div", { style: { fontSize: "0.75rem", color: "#666", marginTop: "0.125rem" }, children: suggestion.description }))] }), onApply && (_jsx("button", { type: "button", onClick: () => onApply(suggestion, finding), style: { fontSize: "0.75rem", padding: "0.125rem 0.5rem" }, children: "Apply" }))] }));
118
+ }
119
+ //# sourceMappingURL=PreflightAutoFixPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreflightAutoFixPanel.js","sourceRoot":"","sources":["../../src/components/PreflightAutoFixPanel.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAwBb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAmDrD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,OAAyB;IAClD,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,SAAS,IAAI,GAAG,EAAE,CAAC;AAC7E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAgC;IAEhC,MAAM,GAAG,GAAG,IAAI,GAAG,EAA6C,CAAC;IACjE,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC;AACb,CAAC;AAoBD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,MAAM,EACN,OAAO,EACP,gBAAgB,GACW;IAC3B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAoC,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,CAA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QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,MAAM,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,6BAA6B,CAAC,EACrC,UAAU,EACV,OAAO,EACP,OAAO,GAKR;IACC,OAAO,CACL,cACE,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,GAAG,EAAE,QAAQ;YACb,UAAU,EAAE,YAAY;YACxB,OAAO,EAAE,WAAW;YACpB,SAAS,EAAE,iBAAiB;SAC7B,aAED,eAAK,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aACrB,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAG,UAAU,CAAC,OAAO,GAAO,EAChE,UAAU,CAAC,WAAW,IAAI,CACzB,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,YACtE,UAAU,CAAC,WAAW,GACnB,CACP,IACG,EACL,OAAO,IAAI,CACV,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAC3C,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,sBAGnD,CACV,IACE,CACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Wave 4 P4 — Preflight diff panel.
3
+ *
4
+ * Compares the current preflight findings against a previous
5
+ * {@link PreflightSnapshotInput} from the document's `preflightHistory`
6
+ * and surfaces what changed: which rules cleared, which are still
7
+ * firing, and which are new since the baseline. Lets a designer answer
8
+ * "did my last edit actually fix anything?" without rereading the full
9
+ * preflight list.
10
+ *
11
+ * Pure controlled component: hosts pass `currentFindings` (typically
12
+ * derived from the live preflight engine) plus the snapshot
13
+ * `history` (typically `DocumentV3.preflightHistory`) and optionally
14
+ * the `baselineSnapshotId` to compare against. Absent baseline →
15
+ * uses the most-recent snapshot. Hosts wire `onBaselineChange` to a
16
+ * dropdown to flip between historical baselines.
17
+ *
18
+ * The diff function {@link diffPreflightFindings} is exported as a
19
+ * pure helper so hosts can drive a custom rendering (sparkline,
20
+ * MIS-side audit log, etc.) over the same algorithm.
21
+ *
22
+ * @public
23
+ */
24
+ import type { ReactElement } from "react";
25
+ /**
26
+ * One preflight finding — the subset of fields the diff cares about.
27
+ * Structurally compatible with `PreflightSnapshot.findings[number]`
28
+ * from `@artworkpdf/document-model`. The panel intentionally ignores
29
+ * rule messages / severity-detail strings: the diff is keyed by the
30
+ * stable (`ruleId`, `severity`, `pageIndex`) tuple so a rule
31
+ * downgraded from `error` → `warn` between snapshots is detected as
32
+ * a real change, not a no-op.
33
+ *
34
+ * @public
35
+ */
36
+ export type PreflightFinding = {
37
+ ruleId: string;
38
+ severity: "error" | "warn" | "info";
39
+ pageIndex?: number;
40
+ };
41
+ /**
42
+ * One historical preflight snapshot. Structurally compatible with
43
+ * `PreflightSnapshot` from `@artworkpdf/document-model` — the panel
44
+ * accepts the wider doc-model shape unchanged.
45
+ *
46
+ * @public
47
+ */
48
+ export type PreflightSnapshotInput = {
49
+ id: string;
50
+ timestamp: string;
51
+ triggeredBy: "user" | "auto" | "export";
52
+ findings: readonly PreflightFinding[];
53
+ };
54
+ /**
55
+ * Result of {@link diffPreflightFindings}.
56
+ *
57
+ * - `added` — findings present in `current` but not in `baseline`
58
+ * (typically: regressions introduced by the latest edits).
59
+ * - `removed` — findings in `baseline` but not in `current`
60
+ * (typically: rules cleared by the latest edits — the happy case).
61
+ * - `persisted` — findings present in both (the things the user
62
+ * *thought* they fixed but didn't, or known-acceptable warnings).
63
+ *
64
+ * @public
65
+ */
66
+ export type PreflightDiffResult = {
67
+ added: readonly PreflightFinding[];
68
+ removed: readonly PreflightFinding[];
69
+ persisted: readonly PreflightFinding[];
70
+ };
71
+ /**
72
+ * @public
73
+ */
74
+ export type PreflightDiffPanelProps = {
75
+ /** Current live preflight findings. Empty array is treated as
76
+ * "preflight ran and found nothing" — the panel renders an
77
+ * all-green state when both `currentFindings` and the baseline's
78
+ * findings are empty. */
79
+ currentFindings: readonly PreflightFinding[];
80
+ /** Snapshot history, oldest → newest. Typically
81
+ * `DocumentV3.preflightHistory`. Empty array surfaces a
82
+ * "no history yet — run preflight to capture the first snapshot"
83
+ * hint. */
84
+ history: readonly PreflightSnapshotInput[];
85
+ /** Id of the snapshot to compare against. Absent → the latest
86
+ * snapshot (`history[history.length - 1]`). */
87
+ baselineSnapshotId?: string;
88
+ /** Fired when the user picks a different baseline from the
89
+ * in-panel dropdown. */
90
+ onBaselineChange?: (snapshotId: string) => void;
91
+ };
92
+ /**
93
+ * Compute the added / removed / persisted partition between two
94
+ * finding lists. Pure function — no React, no DOM.
95
+ *
96
+ * The diff is keyed by the `(ruleId, severity, pageIndex)` tuple:
97
+ * two findings collapse only when all three match. This catches
98
+ * severity downgrades (warn→error counts as a change) and
99
+ * per-page rule fires (same rule on different pages stays
100
+ * distinct) which a naive `ruleId`-only diff would mis-classify.
101
+ *
102
+ * @public
103
+ */
104
+ export declare function diffPreflightFindings(baseline: readonly PreflightFinding[], current: readonly PreflightFinding[]): PreflightDiffResult;
105
+ /**
106
+ * Resolve which snapshot the panel should diff against.
107
+ *
108
+ * Returns the entry in `history` whose `id` matches `baselineSnapshotId`
109
+ * when present; otherwise the most-recent snapshot
110
+ * (`history[history.length - 1]`). Returns `undefined` only when
111
+ * `history` is empty. Falling back when the explicit id misses keeps
112
+ * the panel useful after a host trims history (e.g. cap of 10
113
+ * snapshots) and the user's previously-saved baseline drops off the
114
+ * tail.
115
+ *
116
+ * Pure function; exposed so hosts that need to mirror the panel's
117
+ * selection in their own chrome (e.g. an MIS audit log) can call it
118
+ * without re-implementing the fallback rule.
119
+ *
120
+ * @public
121
+ */
122
+ export declare function resolveBaselineSnapshot(history: readonly PreflightSnapshotInput[], baselineSnapshotId: string | undefined): PreflightSnapshotInput | undefined;
123
+ /**
124
+ * @public
125
+ */
126
+ export declare function PreflightDiffPanel({ currentFindings, history, baselineSnapshotId, onBaselineChange, }: PreflightDiffPanelProps): ReactElement;
127
+ //# sourceMappingURL=PreflightDiffPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreflightDiffPanel.d.ts","sourceRoot":"","sources":["../../src/components/PreflightDiffPanel.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACxC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;8BAG0B;IAC1B,eAAe,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC7C;;;gBAGY;IACZ,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C;oDACgD;IAChD,kBAAkB,C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1B,aAEA,KAAK,QAAI,QAAQ,CAAC,MAAM,SACtB,EACL,aAAI,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,YACpD,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;oBACrB,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;oBACrE,OAAO,CACL,cAEE,KAAK,EAAE;4BACL,OAAO,EAAE,MAAM;4BACf,UAAU,EAAE,UAAU;4BACtB,GAAG,EAAE,QAAQ;4BACb,OAAO,EAAE,iBAAiB;yBAC3B,aAED,8BACc,MAAM,EAClB,KAAK,EAAE;oCACL,OAAO,EAAE,cAAc;oCACvB,KAAK,EAAE,QAAQ;oCACf,MAAM,EAAE,QAAQ;oCAChB,YAAY,EAAE,KAAK;oCACnB,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC;oCACvC,UAAU,EAAE,CAAC;iCACd,GACD,EACF,eAAM,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,YACrE,CAAC,CAAC,MAAM,GACJ,EACN,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAC5B,iBAAO,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAI,CAAC,CAAC,SAAS,GAAG,CAAC,IAAS,CAC3D,KAxBI,GAAG,CAyBL,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,IACG,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * One process-specific preflight finding — mirrors lint-pdf's
3
+ * `Finding` wire shape with an explicit `process` discriminator the
4
+ * panel groups by. Duplicated here so the editor stays consumable
5
+ * without the lint-pdf SDK (same pattern as `ComplianceFinding`).
6
+ *
7
+ * @public
8
+ */
9
+ export type ProcessRule = {
10
+ ruleId: string;
11
+ severity: "error" | "warn" | "info";
12
+ message: string;
13
+ /** The process class this rule fires under — matches the
14
+ * `process_is` matcher in lint-pdf's conditional rule engine. */
15
+ process: string;
16
+ /** 0-indexed page reference, if the finding is scoped to one. */
17
+ pageIndex?: number;
18
+ /** Optional id of the offending object on `pageIndex`. */
19
+ objectId?: string;
20
+ };
21
+ /**
22
+ * Host-supplied adapter. Receives the document + active process and
23
+ * returns the process-physics findings. Rejects on transport errors;
24
+ * the panel surfaces the message inline.
25
+ *
26
+ * **Identity matters.** The panel re-fetches whenever the `loader`
27
+ * reference changes — hosts that build the adapter inline should
28
+ * memoize it with `useCallback` so an unrelated parent re-render
29
+ * doesn't trigger a spurious round-trip.
30
+ *
31
+ * @public
32
+ */
33
+ export type ProcessRulesLoaderFn = (input: {
34
+ documentB64: string;
35
+ process: string;
36
+ }) => Promise<readonly ProcessRule[]>;
37
+ /**
38
+ * Result row from {@link groupRulesByProcess}. The panel renders one
39
+ * heading per group when `groupByProcess` is set.
40
+ *
41
+ * @public
42
+ */
43
+ export type ProcessRuleGroup = {
44
+ process: string;
45
+ rules: readonly ProcessRule[];
46
+ };
47
+ /**
48
+ * @public
49
+ */
50
+ export type ProcessRulesPanelProps = {
51
+ /** Latest rendered document — base64 PDF or `undefined` for an
52
+ * "export first" affordance. */
53
+ documentB64: string | undefined;
54
+ /** Active process class from `PrintContext.process`. Drives the
55
+ * `process_is` matcher in lint-pdf's conditional rule engine. */
56
+ process: string | undefined;
57
+ /** Adapter that resolves to the process-physics findings. */
58
+ loader: ProcessRulesLoaderFn;
59
+ /** Optional callback fired when a finding row is clicked — hosts
60
+ * wire this to highlight the offending object on canvas. */
61
+ onSelect?: (rule: ProcessRule) => void;
62
+ /** When `true`, the panel renders one collapsible group per
63
+ * process class (useful when the loader is allowed to surface
64
+ * findings for *adjacent* processes — e.g. an offset job with
65
+ * flexo-compatible warnings for downstream re-printing). Absent
66
+ * or `false`: flat list. */
67
+ groupByProcess?: boolean;
68
+ };
69
+ /**
70
+ * Group a flat list of findings by `process` key in first-occurrence
71
+ * order. Pure function; exposed for hosts that want their own
72
+ * rendering on top of the same grouping.
73
+ *
74
+ * @public
75
+ */
76
+ export declare function groupRulesByProcess(rules: readonly ProcessRule[]): readonly ProcessRuleGroup[];
77
+ /**
78
+ * @public
79
+ */
80
+ export declare function ProcessRulesPanel({ documentB64, process, loader, onSelect, groupByProcess, }: ProcessRulesPanelProps): import("react/jsx-runtime").JSX.Element;
81
+ //# sourceMappingURL=ProcessRulesPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessRulesPanel.d.ts","sourceRoot":"","sources":["../../src/components/ProcessRulesPanel.tsx"],"names":[],"mappings":"AA0BA;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB;sEACkE;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,KAAK,OAAO,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;qCACiC;IACjC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;sEACkE;IAClE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,6DAA6D;IAC7D,MAAM,EAAE,oBAAoB,CAAC;IAC7B;iEAC6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC;;;;iCAI6B;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,gBAAgB,EAAE,CAa9F;AAQD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,GACf,EAAE,sBAAsB,2CA+FxB"}
@@ -0,0 +1,143 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ /**
5
+ * Wave 4 P2 — Process-specific preflight panel.
6
+ *
7
+ * Surfaces process-physics findings — flexo white-knockout, gravure
8
+ * max line frequency, screen-print halftone limits, offset overprint
9
+ * traps — separately from generic preflight (which covers
10
+ * "does this PDF parse / render") and from {@link ComplianceFindingsPanel}
11
+ * (which covers "is this artwork *allowed* on the chosen substrate /
12
+ * market"). The three-way split keeps the audiences focused: a press
13
+ * operator wants the physics, a brand lead wants the compliance, a
14
+ * support engineer wants the parse errors.
15
+ *
16
+ * Adapter pattern: hosts wire an async function that POSTs the
17
+ * document + active process to lint-pdf's `/v1/preflight/process`
18
+ * endpoint and filters to process-physics rules. The editor stays
19
+ * free of any runtime dep on lint-pdf's HTTP client; same approach
20
+ * as {@link ComplianceFindingsPanel}, {@link InksPanel}, etc.
21
+ *
22
+ * @public
23
+ */
24
+ import { useEffect, useState } from "react";
25
+ /**
26
+ * Group a flat list of findings by `process` key in first-occurrence
27
+ * order. Pure function; exposed for hosts that want their own
28
+ * rendering on top of the same grouping.
29
+ *
30
+ * @public
31
+ */
32
+ export function groupRulesByProcess(rules) {
33
+ const order = [];
34
+ const buckets = new Map();
35
+ for (const r of rules) {
36
+ let bucket = buckets.get(r.process);
37
+ if (!bucket) {
38
+ bucket = [];
39
+ buckets.set(r.process, bucket);
40
+ order.push(r.process);
41
+ }
42
+ bucket.push(r);
43
+ }
44
+ return order.map((process) => ({ process, rules: buckets.get(process) ?? [] }));
45
+ }
46
+ const SEVERITY_COLORS = {
47
+ error: "#a00",
48
+ warn: "#a60",
49
+ info: "#06a",
50
+ };
51
+ /**
52
+ * @public
53
+ */
54
+ export function ProcessRulesPanel({ documentB64, process, loader, onSelect, groupByProcess, }) {
55
+ const [rules, setRules] = useState(null);
56
+ const [error, setError] = useState(null);
57
+ const [loading, setLoading] = useState(false);
58
+ useEffect(() => {
59
+ if (!documentB64 || !process) {
60
+ setRules(null);
61
+ setError(null);
62
+ return;
63
+ }
64
+ let disposed = false;
65
+ setLoading(true);
66
+ setError(null);
67
+ // Clear stale findings while the next fetch is in flight — if a
68
+ // caller ever bypasses the `loading` guard, we don't want the
69
+ // previous process's rules to flash through.
70
+ setRules(null);
71
+ // Wrap in an async IIFE so a *synchronous* throw from the adapter
72
+ // (e.g. a host validating inputs before constructing fetch) flows
73
+ // through the same `setError` path as a rejected Promise.
74
+ void (async () => {
75
+ try {
76
+ const next = await loader({ documentB64, process });
77
+ if (disposed)
78
+ return;
79
+ setRules(next);
80
+ }
81
+ catch (err) {
82
+ if (disposed)
83
+ return;
84
+ setError(err instanceof Error ? err.message : String(err));
85
+ }
86
+ finally {
87
+ if (!disposed)
88
+ setLoading(false);
89
+ }
90
+ })();
91
+ return () => {
92
+ disposed = true;
93
+ };
94
+ }, [documentB64, process, loader]);
95
+ if (!documentB64 || !process) {
96
+ return (_jsx("div", { "data-testid": "process-rules-panel", style: { padding: "0.5rem", opacity: 0.6 }, children: "Set process in Job Setup, then export to see process-specific findings." }));
97
+ }
98
+ if (loading) {
99
+ return (_jsx("div", { "data-testid": "process-rules-panel", style: { padding: "0.5rem", opacity: 0.6 }, children: "Checking process rules\u2026" }));
100
+ }
101
+ if (error) {
102
+ return (_jsxs("div", { "data-testid": "process-rules-panel", role: "alert", style: { padding: "0.5rem", color: "#a00" }, children: ["Couldn't load process rules: ", error] }));
103
+ }
104
+ if (!rules || rules.length === 0) {
105
+ return (_jsxs("div", { "data-testid": "process-rules-panel", style: { padding: "0.5rem", opacity: 0.6 }, children: ["No process-specific issues for ", process, "."] }));
106
+ }
107
+ const groups = groupByProcess ? groupRulesByProcess(rules) : null;
108
+ return (_jsxs("div", { "data-testid": "process-rules-panel", style: { padding: "0.5rem" }, children: [_jsxs("h3", { style: { margin: "0 0 0.5rem 0" }, children: ["Process rules (", rules.length, ")"] }), groups ? (groups.map((g) => (_jsxs("section", { style: { marginBottom: "0.75rem" }, children: [_jsxs("h4", { style: {
109
+ margin: "0 0 0.25rem 0",
110
+ fontSize: "0.875rem",
111
+ textTransform: "capitalize",
112
+ }, children: [g.process, " (", g.rules.length, ")"] }), _jsx(ProcessRulesList, { rules: g.rules, onSelect: onSelect })] }, g.process)))) : (_jsx(ProcessRulesList, { rules: rules, onSelect: onSelect }))] }));
113
+ }
114
+ function ProcessRulesList({ rules, onSelect, }) {
115
+ return (_jsx("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: rules.map((r, i) => {
116
+ // Append the array index so duplicate (ruleId, pageIndex,
117
+ // objectId, process) tuples still get unique React keys.
118
+ const key = `${r.ruleId}-${r.process}-${r.pageIndex ?? "doc"}-${r.objectId ?? ""}-${i}`;
119
+ const rowContents = (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", style: {
120
+ display: "inline-block",
121
+ width: "0.5rem",
122
+ height: "0.5rem",
123
+ borderRadius: "50%",
124
+ background: SEVERITY_COLORS[r.severity],
125
+ flexShrink: 0,
126
+ } }), _jsx("span", { style: { flex: 1 }, children: r.message }), _jsxs("small", { style: { opacity: 0.6, fontFamily: "monospace" }, children: [r.ruleId, r.pageIndex !== undefined ? ` · p${r.pageIndex + 1}` : ""] })] }));
127
+ const rowStyle = {
128
+ display: "flex",
129
+ alignItems: "baseline",
130
+ gap: "0.5rem",
131
+ width: "100%",
132
+ padding: "0.25rem 0.5rem",
133
+ };
134
+ return (_jsx("li", { children: onSelect ? (_jsx("button", { type: "button", onClick: () => onSelect(r), "aria-label": `Process rule: ${r.message} (${r.ruleId}${r.pageIndex !== undefined ? `, page ${r.pageIndex + 1}` : ""})`, style: {
135
+ ...rowStyle,
136
+ background: "transparent",
137
+ border: "none",
138
+ cursor: "pointer",
139
+ textAlign: "left",
140
+ }, children: rowContents })) : (_jsx("div", { style: rowStyle, children: rowContents })) }, key));
141
+ }) }));
142
+ }
143
+ //# sourceMappingURL=ProcessRulesPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessRulesPanel.js","sourceRoot":"","sources":["../../src/components/ProcessRulesPanel.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAEb;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA0E5C;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA6B;IAC/D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;IACjD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,CAAC,CAA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