@printwithsynergy/artwork-pdf-editor 0.2.0 → 0.4.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 (244) hide show
  1. package/LICENSE +62 -0
  2. package/dist/components/AccessibilityHintsPanel.d.ts +142 -0
  3. package/dist/components/AccessibilityHintsPanel.d.ts.map +1 -0
  4. package/dist/components/AccessibilityHintsPanel.js +158 -0
  5. package/dist/components/AccessibilityHintsPanel.js.map +1 -0
  6. package/dist/components/AnnotationOverlay.d.ts +142 -0
  7. package/dist/components/AnnotationOverlay.d.ts.map +1 -0
  8. package/dist/components/AnnotationOverlay.js +141 -0
  9. package/dist/components/AnnotationOverlay.js.map +1 -0
  10. package/dist/components/AnnotationsSidebar.d.ts +98 -0
  11. package/dist/components/AnnotationsSidebar.d.ts.map +1 -0
  12. package/dist/components/AnnotationsSidebar.js +100 -0
  13. package/dist/components/AnnotationsSidebar.js.map +1 -0
  14. package/dist/components/BarcodeGeneratorPanel.d.ts +58 -0
  15. package/dist/components/BarcodeGeneratorPanel.d.ts.map +1 -0
  16. package/dist/components/BarcodeGeneratorPanel.js +91 -0
  17. package/dist/components/BarcodeGeneratorPanel.js.map +1 -0
  18. package/dist/components/BraillePanel.d.ts +99 -0
  19. package/dist/components/BraillePanel.d.ts.map +1 -0
  20. package/dist/components/BraillePanel.js +221 -0
  21. package/dist/components/BraillePanel.js.map +1 -0
  22. package/dist/components/BrandAssetsPanel.d.ts +130 -0
  23. package/dist/components/BrandAssetsPanel.d.ts.map +1 -0
  24. package/dist/components/BrandAssetsPanel.js +125 -0
  25. package/dist/components/BrandAssetsPanel.js.map +1 -0
  26. package/dist/components/BrandConsistencyPanel.d.ts +140 -0
  27. package/dist/components/BrandConsistencyPanel.d.ts.map +1 -0
  28. package/dist/components/BrandConsistencyPanel.js +158 -0
  29. package/dist/components/BrandConsistencyPanel.js.map +1 -0
  30. package/dist/components/ComplianceFindingsPanel.d.ts +62 -0
  31. package/dist/components/ComplianceFindingsPanel.d.ts.map +1 -0
  32. package/dist/components/ComplianceFindingsPanel.js +118 -0
  33. package/dist/components/ComplianceFindingsPanel.js.map +1 -0
  34. package/dist/components/DesignSuggestionsPanel.d.ts +148 -0
  35. package/dist/components/DesignSuggestionsPanel.d.ts.map +1 -0
  36. package/dist/components/DesignSuggestionsPanel.js +154 -0
  37. package/dist/components/DesignSuggestionsPanel.js.map +1 -0
  38. package/dist/components/DielineParametersPanel.d.ts +62 -0
  39. package/dist/components/DielineParametersPanel.d.ts.map +1 -0
  40. package/dist/components/DielineParametersPanel.js +170 -0
  41. package/dist/components/DielineParametersPanel.js.map +1 -0
  42. package/dist/components/DielinePreview.d.ts +150 -0
  43. package/dist/components/DielinePreview.d.ts.map +1 -0
  44. package/dist/components/DielinePreview.js +146 -0
  45. package/dist/components/DielinePreview.js.map +1 -0
  46. package/dist/components/EditorApp.d.ts +18 -3
  47. package/dist/components/EditorApp.d.ts.map +1 -1
  48. package/dist/components/EditorApp.js +42 -7
  49. package/dist/components/EditorApp.js.map +1 -1
  50. package/dist/components/EditorCanvas.d.ts +31 -2
  51. package/dist/components/EditorCanvas.d.ts.map +1 -1
  52. package/dist/components/EditorCanvas.js +97 -16
  53. package/dist/components/EditorCanvas.js.map +1 -1
  54. package/dist/components/EmailNotifyPanel.d.ts +165 -0
  55. package/dist/components/EmailNotifyPanel.d.ts.map +1 -0
  56. package/dist/components/EmailNotifyPanel.js +211 -0
  57. package/dist/components/EmailNotifyPanel.js.map +1 -0
  58. package/dist/components/FileDropZone.d.ts +9 -1
  59. package/dist/components/FileDropZone.d.ts.map +1 -1
  60. package/dist/components/FileDropZone.js +53 -5
  61. package/dist/components/FileDropZone.js.map +1 -1
  62. package/dist/components/FoldEditorPanel.d.ts +68 -0
  63. package/dist/components/FoldEditorPanel.d.ts.map +1 -0
  64. package/dist/components/FoldEditorPanel.js +65 -0
  65. package/dist/components/FoldEditorPanel.js.map +1 -0
  66. package/dist/components/FoldPreviewOverlay.d.ts +48 -0
  67. package/dist/components/FoldPreviewOverlay.d.ts.map +1 -0
  68. package/dist/components/FoldPreviewOverlay.js +182 -0
  69. package/dist/components/FoldPreviewOverlay.js.map +1 -0
  70. package/dist/components/Gs1DigitalLinkPanel.d.ts +103 -0
  71. package/dist/components/Gs1DigitalLinkPanel.d.ts.map +1 -0
  72. package/dist/components/Gs1DigitalLinkPanel.js +199 -0
  73. package/dist/components/Gs1DigitalLinkPanel.js.map +1 -0
  74. package/dist/components/HistoryPanel.d.ts +39 -0
  75. package/dist/components/HistoryPanel.d.ts.map +1 -0
  76. package/dist/components/HistoryPanel.js +72 -0
  77. package/dist/components/HistoryPanel.js.map +1 -0
  78. package/dist/components/IccSoftProofOverlay.d.ts +67 -0
  79. package/dist/components/IccSoftProofOverlay.d.ts.map +1 -0
  80. package/dist/components/IccSoftProofOverlay.js +119 -0
  81. package/dist/components/IccSoftProofOverlay.js.map +1 -0
  82. package/dist/components/ImposePanel.d.ts +71 -0
  83. package/dist/components/ImposePanel.d.ts.map +1 -0
  84. package/dist/components/ImposePanel.js +127 -0
  85. package/dist/components/ImposePanel.js.map +1 -0
  86. package/dist/components/InksPanel.d.ts +61 -0
  87. package/dist/components/InksPanel.d.ts.map +1 -0
  88. package/dist/components/InksPanel.js +84 -0
  89. package/dist/components/InksPanel.js.map +1 -0
  90. package/dist/components/JobSetupPanel.d.ts +118 -0
  91. package/dist/components/JobSetupPanel.d.ts.map +1 -0
  92. package/dist/components/JobSetupPanel.js +169 -0
  93. package/dist/components/JobSetupPanel.js.map +1 -0
  94. package/dist/components/LayersPanel.d.ts.map +1 -1
  95. package/dist/components/LayersPanel.js +1 -0
  96. package/dist/components/LayersPanel.js.map +1 -1
  97. package/dist/components/MarkLibraryPanel.d.ts +131 -0
  98. package/dist/components/MarkLibraryPanel.d.ts.map +1 -0
  99. package/dist/components/MarkLibraryPanel.js +184 -0
  100. package/dist/components/MarkLibraryPanel.js.map +1 -0
  101. package/dist/components/MisEstimateButton.d.ts +73 -0
  102. package/dist/components/MisEstimateButton.d.ts.map +1 -0
  103. package/dist/components/MisEstimateButton.js +57 -0
  104. package/dist/components/MisEstimateButton.js.map +1 -0
  105. package/dist/components/NutritionPanel.d.ts +118 -0
  106. package/dist/components/NutritionPanel.d.ts.map +1 -0
  107. package/dist/components/NutritionPanel.js +169 -0
  108. package/dist/components/NutritionPanel.js.map +1 -0
  109. package/dist/components/PageNavigator.d.ts.map +1 -1
  110. package/dist/components/PageNavigator.js +6 -1
  111. package/dist/components/PageNavigator.js.map +1 -1
  112. package/dist/components/PaletteManager.d.ts +32 -0
  113. package/dist/components/PaletteManager.d.ts.map +1 -0
  114. package/dist/components/PaletteManager.js +89 -0
  115. package/dist/components/PaletteManager.js.map +1 -0
  116. package/dist/components/PaletteToSpotPanel.d.ts +122 -0
  117. package/dist/components/PaletteToSpotPanel.d.ts.map +1 -0
  118. package/dist/components/PaletteToSpotPanel.js +160 -0
  119. package/dist/components/PaletteToSpotPanel.js.map +1 -0
  120. package/dist/components/PreflightAutoFixPanel.d.ts +110 -0
  121. package/dist/components/PreflightAutoFixPanel.d.ts.map +1 -0
  122. package/dist/components/PreflightAutoFixPanel.js +119 -0
  123. package/dist/components/PreflightAutoFixPanel.js.map +1 -0
  124. package/dist/components/PreflightDiffPanel.d.ts +127 -0
  125. package/dist/components/PreflightDiffPanel.d.ts.map +1 -0
  126. package/dist/components/PreflightDiffPanel.js +0 -0
  127. package/dist/components/PreflightDiffPanel.js.map +1 -0
  128. package/dist/components/ProcessRulesPanel.d.ts +81 -0
  129. package/dist/components/ProcessRulesPanel.d.ts.map +1 -0
  130. package/dist/components/ProcessRulesPanel.js +143 -0
  131. package/dist/components/ProcessRulesPanel.js.map +1 -0
  132. package/dist/components/SlackNotifyPanel.d.ts +139 -0
  133. package/dist/components/SlackNotifyPanel.d.ts.map +1 -0
  134. package/dist/components/SlackNotifyPanel.js +133 -0
  135. package/dist/components/SlackNotifyPanel.js.map +1 -0
  136. package/dist/components/SmartSpotMatchPanel.d.ts +143 -0
  137. package/dist/components/SmartSpotMatchPanel.d.ts.map +1 -0
  138. package/dist/components/SmartSpotMatchPanel.js +159 -0
  139. package/dist/components/SmartSpotMatchPanel.js.map +1 -0
  140. package/dist/components/StreamingRenderProgress.d.ts +60 -0
  141. package/dist/components/StreamingRenderProgress.d.ts.map +1 -0
  142. package/dist/components/StreamingRenderProgress.js +99 -0
  143. package/dist/components/StreamingRenderProgress.js.map +1 -0
  144. package/dist/components/SwatchesPicker.d.ts +83 -0
  145. package/dist/components/SwatchesPicker.d.ts.map +1 -0
  146. package/dist/components/SwatchesPicker.js +151 -0
  147. package/dist/components/SwatchesPicker.js.map +1 -0
  148. package/dist/components/TacOverlay.d.ts +47 -0
  149. package/dist/components/TacOverlay.d.ts.map +1 -0
  150. package/dist/components/TacOverlay.js +116 -0
  151. package/dist/components/TacOverlay.js.map +1 -0
  152. package/dist/components/TrapEditorPanel.d.ts +52 -0
  153. package/dist/components/TrapEditorPanel.d.ts.map +1 -0
  154. package/dist/components/TrapEditorPanel.js +64 -0
  155. package/dist/components/TrapEditorPanel.js.map +1 -0
  156. package/dist/components/TrapPreviewOverlay.d.ts +64 -0
  157. package/dist/components/TrapPreviewOverlay.d.ts.map +1 -0
  158. package/dist/components/TrapPreviewOverlay.js +120 -0
  159. package/dist/components/TrapPreviewOverlay.js.map +1 -0
  160. package/dist/components/VariantMatrixPanel.d.ts +61 -0
  161. package/dist/components/VariantMatrixPanel.d.ts.map +1 -0
  162. package/dist/components/VariantMatrixPanel.js +97 -0
  163. package/dist/components/VariantMatrixPanel.js.map +1 -0
  164. package/dist/components/VariantMatrixVersionPanel.d.ts +122 -0
  165. package/dist/components/VariantMatrixVersionPanel.d.ts.map +1 -0
  166. package/dist/components/VariantMatrixVersionPanel.js +162 -0
  167. package/dist/components/VariantMatrixVersionPanel.js.map +1 -0
  168. package/dist/components/WebhookNotifyPanel.d.ts +160 -0
  169. package/dist/components/WebhookNotifyPanel.d.ts.map +1 -0
  170. package/dist/components/WebhookNotifyPanel.js +100 -0
  171. package/dist/components/WebhookNotifyPanel.js.map +1 -0
  172. package/dist/components/WhiteUnderbasePanel.d.ts +107 -0
  173. package/dist/components/WhiteUnderbasePanel.d.ts.map +1 -0
  174. package/dist/components/WhiteUnderbasePanel.js +104 -0
  175. package/dist/components/WhiteUnderbasePanel.js.map +1 -0
  176. package/dist/hooks/useEditorMode.d.ts +25 -5
  177. package/dist/hooks/useEditorMode.d.ts.map +1 -1
  178. package/dist/hooks/useEditorMode.js +18 -5
  179. package/dist/hooks/useEditorMode.js.map +1 -1
  180. package/dist/index.d.ts +51 -2
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +51 -2
  183. package/dist/index.js.map +1 -1
  184. package/dist/lens/preflight-findings.d.ts.map +1 -1
  185. package/dist/lens/preflight-findings.js.map +1 -1
  186. package/dist/lib/barcode-scan.d.ts +154 -0
  187. package/dist/lib/barcode-scan.d.ts.map +1 -0
  188. package/dist/lib/barcode-scan.js +152 -0
  189. package/dist/lib/barcode-scan.js.map +1 -0
  190. package/dist/lib/color-math.d.ts +76 -0
  191. package/dist/lib/color-math.d.ts.map +1 -0
  192. package/dist/lib/color-math.js +96 -0
  193. package/dist/lib/color-math.js.map +1 -0
  194. package/dist/lib/dieline-template.d.ts +87 -0
  195. package/dist/lib/dieline-template.d.ts.map +1 -1
  196. package/dist/lib/dieline-template.js +163 -0
  197. package/dist/lib/dieline-template.js.map +1 -1
  198. package/dist/lib/editor-config.d.ts +390 -0
  199. package/dist/lib/editor-config.d.ts.map +1 -1
  200. package/dist/lib/editor-config.js +90 -0
  201. package/dist/lib/editor-config.js.map +1 -1
  202. package/dist/lib/fold-geometry.d.ts +144 -0
  203. package/dist/lib/fold-geometry.d.ts.map +1 -0
  204. package/dist/lib/fold-geometry.js +138 -0
  205. package/dist/lib/fold-geometry.js.map +1 -0
  206. package/dist/lib/merge-tokens.d.ts +81 -0
  207. package/dist/lib/merge-tokens.d.ts.map +1 -0
  208. package/dist/lib/merge-tokens.js +88 -0
  209. package/dist/lib/merge-tokens.js.map +1 -0
  210. package/dist/lib/palette-registry.d.ts +40 -0
  211. package/dist/lib/palette-registry.d.ts.map +1 -0
  212. package/dist/lib/palette-registry.js +50 -0
  213. package/dist/lib/palette-registry.js.map +1 -0
  214. package/dist/lib/panel-anchor.d.ts +101 -0
  215. package/dist/lib/panel-anchor.d.ts.map +1 -0
  216. package/dist/lib/panel-anchor.js +68 -0
  217. package/dist/lib/panel-anchor.js.map +1 -0
  218. package/dist/lib/preflight/checks.d.ts.map +1 -1
  219. package/dist/lib/preflight/checks.js +71 -0
  220. package/dist/lib/preflight/checks.js.map +1 -1
  221. package/dist/lib/preflight/types.d.ts.map +1 -1
  222. package/dist/lib/preflight/types.js +11 -0
  223. package/dist/lib/preflight/types.js.map +1 -1
  224. package/dist/lib/rasterize.d.ts +93 -0
  225. package/dist/lib/rasterize.d.ts.map +1 -0
  226. package/dist/lib/rasterize.js +117 -0
  227. package/dist/lib/rasterize.js.map +1 -0
  228. package/dist/lib/separations-registry.d.ts +99 -0
  229. package/dist/lib/separations-registry.d.ts.map +1 -0
  230. package/dist/lib/separations-registry.js +59 -0
  231. package/dist/lib/separations-registry.js.map +1 -0
  232. package/dist/lib/streaming-render.d.ts +100 -0
  233. package/dist/lib/streaming-render.d.ts.map +1 -0
  234. package/dist/lib/streaming-render.js +132 -0
  235. package/dist/lib/streaming-render.js.map +1 -0
  236. package/dist/lib/unwired.d.ts +29 -0
  237. package/dist/lib/unwired.d.ts.map +1 -0
  238. package/dist/lib/unwired.js +58 -0
  239. package/dist/lib/unwired.js.map +1 -0
  240. package/package.json +20 -11
  241. package/dist/components/SeparationsPanel.d.ts +0 -9
  242. package/dist/components/SeparationsPanel.d.ts.map +0 -1
  243. package/dist/components/SeparationsPanel.js +0 -168
  244. package/dist/components/SeparationsPanel.js.map +0 -1
@@ -0,0 +1,160 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ "use client";
3
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
+ import { sortMatchesByDeltaE } from "./SmartSpotMatchPanel";
6
+ /**
7
+ * Pure helper — summarizes a list of conversion rows. Pure function;
8
+ * no I/O.
9
+ *
10
+ * @public
11
+ */
12
+ export function summarizePaletteCoverage(rows) {
13
+ let matched = 0;
14
+ let sum = 0;
15
+ let worst = 0;
16
+ for (const row of rows) {
17
+ if (row.status === "matched" && row.bestMatch) {
18
+ matched++;
19
+ sum += row.bestMatch.deltaE;
20
+ if (row.bestMatch.deltaE > worst)
21
+ worst = row.bestMatch.deltaE;
22
+ }
23
+ }
24
+ return {
25
+ totalColors: rows.length,
26
+ matched,
27
+ unmatched: rows.length - matched,
28
+ averageDeltaE: matched > 0 ? sum / matched : null,
29
+ worstDeltaE: matched > 0 ? worst : null,
30
+ };
31
+ }
32
+ /**
33
+ * Stateful panel — renders the palette as a table, dispatches the
34
+ * host matcher per row (lazily on "Match" click or eagerly via the
35
+ * "Match all" affordance), and surfaces coverage metrics in the
36
+ * footer.
37
+ *
38
+ * @public
39
+ */
40
+ export function PaletteToSpotPanel({ colors, matchLoader, onCommit, errorMessage, }) {
41
+ const initialRows = useMemo(() => colors.map((color) => ({ color, status: "idle" })), [colors]);
42
+ const [rows, setRows] = useState(initialRows);
43
+ // Re-seed the row state when the input palette changes.
44
+ useEffect(() => {
45
+ setRows(initialRows);
46
+ }, [initialRows]);
47
+ const matchOne = useCallback(async (color) => {
48
+ setRows((prev) => prev.map((r) => (r.color.id === color.id ? { ...r, status: "loading" } : r)));
49
+ try {
50
+ const matches = await matchLoader({ hex: color.hex });
51
+ const sorted = sortMatchesByDeltaE(matches);
52
+ const best = sorted[0];
53
+ if (!best) {
54
+ // Loader returned zero matches — surface as a distinct
55
+ // "no match found" error row rather than a confusing
56
+ // matched-but-empty state (which would render no match
57
+ // line, hide Convert, and still flip the button to
58
+ // "Re-match" as if a match landed).
59
+ setRows((prev) => prev.map((r) => r.color.id === color.id
60
+ ? { color, status: "error", errorMessage: "No match found." }
61
+ : r));
62
+ return;
63
+ }
64
+ setRows((prev) => prev.map((r) => r.color.id === color.id
65
+ ? {
66
+ color,
67
+ status: "matched",
68
+ bestMatch: best,
69
+ alternates: sorted,
70
+ }
71
+ : r));
72
+ }
73
+ catch (err) {
74
+ let message = "Couldn't fetch matches.";
75
+ if (errorMessage) {
76
+ try {
77
+ const candidate = errorMessage(err);
78
+ if (candidate)
79
+ message = candidate;
80
+ }
81
+ catch {
82
+ // fall back to default
83
+ }
84
+ }
85
+ setRows((prev) => prev.map((r) => r.color.id === color.id ? { color, status: "error", errorMessage: message } : r));
86
+ }
87
+ }, [matchLoader, errorMessage]);
88
+ const matchAll = useCallback(async () => {
89
+ // Skip rows that are already loading (in-flight) or already matched
90
+ // (no point re-paying the matcher cost — host can use the per-row
91
+ // "Re-match" button if they want to refresh a single entry).
92
+ await Promise.all(rows
93
+ .filter((r) => r.status !== "loading" && r.status !== "matched")
94
+ .map((r) => matchOne(r.color)));
95
+ }, [rows, matchOne]);
96
+ const commit = useCallback(async (row) => {
97
+ if (!onCommit || !row.bestMatch)
98
+ return;
99
+ try {
100
+ await onCommit(row.color, row.bestMatch);
101
+ }
102
+ catch (err) {
103
+ // Surface commit failures the same way match failures land
104
+ // (per-row error state). Without this branch a failed write
105
+ // would leave the row showing the matched state, suggesting
106
+ // the spot was committed when it wasn't.
107
+ let message = "Couldn't commit spot to registry.";
108
+ if (errorMessage) {
109
+ try {
110
+ const candidate = errorMessage(err);
111
+ if (candidate)
112
+ message = candidate;
113
+ }
114
+ catch {
115
+ // fall back to default
116
+ }
117
+ }
118
+ setRows((prev) => prev.map((r) => r.color.id === row.color.id
119
+ ? { color: row.color, status: "error", errorMessage: message }
120
+ : r));
121
+ }
122
+ }, [onCommit, errorMessage]);
123
+ const summary = useMemo(() => summarizePaletteCoverage(rows), [rows]);
124
+ return (_jsxs("div", { "data-testid": "palette-to-spot-panel", style: { padding: "0.5rem" }, children: [_jsxs("header", { style: {
125
+ display: "flex",
126
+ alignItems: "center",
127
+ justifyContent: "space-between",
128
+ marginBottom: "0.5rem",
129
+ }, children: [_jsxs("h3", { style: { margin: 0, fontSize: "0.875rem" }, children: ["Palette \u2192 spot (", rows.length, ")"] }), _jsx("button", { type: "button", onClick: matchAll, disabled: rows.length === 0 || rows.every((r) => r.status === "loading"), style: { fontSize: "0.75rem", padding: "0.125rem 0.5rem" }, children: "Match all" })] }), rows.length === 0 ? (_jsx("div", { "data-testid": "palette-to-spot-panel-empty", style: { opacity: 0.6, fontSize: "0.875rem" }, children: "The active page has no palette colors yet." })) : (_jsx("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: rows.map((row) => (_jsx(PaletteRow, { row: row, onMatch: () => matchOne(row.color), onCommit: onCommit ? () => commit(row) : undefined }, row.color.id))) })), _jsxs("footer", { style: {
130
+ marginTop: "0.5rem",
131
+ fontSize: "0.75rem",
132
+ color: "#595959",
133
+ borderTop: "1px solid #eee",
134
+ paddingTop: "0.375rem",
135
+ }, children: ["Matched ", summary.matched, "/", summary.totalColors, summary.averageDeltaE !== null && (_jsxs(_Fragment, { children: [" ", "\u00B7 avg \u0394E ", summary.averageDeltaE.toFixed(2), " \u00B7 worst \u0394E", " ", (summary.worstDeltaE ?? 0).toFixed(2)] }))] })] }));
136
+ }
137
+ /**
138
+ * Renders one palette row. Intra-package helper — surface
139
+ * (color swatch + hex + status + match controls) is intentionally
140
+ * minimal so {@link PaletteToSpotPanel} can swap it without
141
+ * downstream consumers depending on the shape.
142
+ */
143
+ function PaletteRow({ row, onMatch, onCommit, }) {
144
+ return (_jsxs("li", { "data-testid": `palette-to-spot-row-${row.color.id}`, style: {
145
+ display: "flex",
146
+ alignItems: "center",
147
+ gap: "0.5rem",
148
+ padding: "0.375rem 0.5rem",
149
+ borderBottom: "1px solid #eee",
150
+ }, children: [_jsx("span", { "aria-hidden": "true", style: {
151
+ display: "inline-block",
152
+ width: 18,
153
+ height: 18,
154
+ borderRadius: 3,
155
+ border: "1px solid #ccc",
156
+ background: row.color.hex,
157
+ flexShrink: 0,
158
+ } }), _jsxs("div", { style: { flex: 1, fontSize: "0.8125rem" }, children: [_jsxs("div", { style: { fontWeight: 500 }, children: [row.color.name ?? row.color.hex, row.color.usageCount !== undefined && (_jsxs("span", { style: { color: "#595959", fontWeight: 400 }, children: [" \u00B7 ", row.color.usageCount, "\u00D7"] }))] }), row.status === "matched" && row.bestMatch && (_jsxs("div", { style: { fontSize: "0.75rem", color: "#595959" }, children: [row.bestMatch.spot.name, " \u00B7 \u0394E ", row.bestMatch.deltaE.toFixed(2)] })), row.status === "error" && (_jsx("div", { role: "alert", style: { fontSize: "0.75rem", color: "#a00" }, children: row.errorMessage }))] }), row.status === "loading" ? (_jsx("output", { style: { fontSize: "0.75rem", color: "#595959" }, children: "\u2026" })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: onMatch, style: { fontSize: "0.6875rem", padding: "0.0625rem 0.375rem" }, children: row.status === "matched" ? "Re-match" : "Match" }), onCommit && row.status === "matched" && row.bestMatch && (_jsx("button", { type: "button", onClick: onCommit, style: { fontSize: "0.6875rem", padding: "0.0625rem 0.375rem" }, children: "Convert" }))] }))] }));
159
+ }
160
+ //# sourceMappingURL=PaletteToSpotPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaletteToSpotPanel.js","sourceRoot":"","sources":["../../src/components/PaletteToSpotPanel.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAwBb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAyD5D;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAiC;IAEjC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,G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AC,SAAS,IAAI,CAC5C,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,aAClD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,sBAAQ,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAC3D,CACP,EACA,GAAG,CAAC,MAAM,KAAK,OAAO,IAAI,CACzB,cAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAC5D,GAAG,CAAC,YAAY,GACb,CACP,IACG,EACL,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1B,iBAAQ,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,uBAAY,CACrE,CAAC,CAAC,CAAC,CACF,8BACE,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,YAE9D,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,GACzC,EACR,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,SAAS,IAAI,CACxD,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,wBAGxD,CACV,IACA,CACJ,IACE,CACN,CAAC;AACJ,CAAC"}
@@ -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":"PreflightAutoFixP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AAE,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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O,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=PreflightDiffPan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AAE;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