@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.
- package/LICENSE +62 -0
- package/README.md +63 -2
- package/dist/components/AccessibilityHintsPanel.d.ts +142 -0
- package/dist/components/AccessibilityHintsPanel.d.ts.map +1 -0
- package/dist/components/AccessibilityHintsPanel.js +158 -0
- package/dist/components/AccessibilityHintsPanel.js.map +1 -0
- package/dist/components/AnnotationOverlay.d.ts +142 -0
- package/dist/components/AnnotationOverlay.d.ts.map +1 -0
- package/dist/components/AnnotationOverlay.js +141 -0
- package/dist/components/AnnotationOverlay.js.map +1 -0
- package/dist/components/AnnotationsSidebar.d.ts +98 -0
- package/dist/components/AnnotationsSidebar.d.ts.map +1 -0
- package/dist/components/AnnotationsSidebar.js +100 -0
- package/dist/components/AnnotationsSidebar.js.map +1 -0
- package/dist/components/BarcodeGeneratorPanel.d.ts +58 -0
- package/dist/components/BarcodeGeneratorPanel.d.ts.map +1 -0
- package/dist/components/BarcodeGeneratorPanel.js +91 -0
- package/dist/components/BarcodeGeneratorPanel.js.map +1 -0
- package/dist/components/BraillePanel.d.ts +99 -0
- package/dist/components/BraillePanel.d.ts.map +1 -0
- package/dist/components/BraillePanel.js +221 -0
- package/dist/components/BraillePanel.js.map +1 -0
- package/dist/components/BrandAssetsPanel.d.ts +130 -0
- package/dist/components/BrandAssetsPanel.d.ts.map +1 -0
- package/dist/components/BrandAssetsPanel.js +125 -0
- package/dist/components/BrandAssetsPanel.js.map +1 -0
- package/dist/components/BrandConsistencyPanel.d.ts +140 -0
- package/dist/components/BrandConsistencyPanel.d.ts.map +1 -0
- package/dist/components/BrandConsistencyPanel.js +158 -0
- package/dist/components/BrandConsistencyPanel.js.map +1 -0
- package/dist/components/ComplianceFindingsPanel.d.ts +62 -0
- package/dist/components/ComplianceFindingsPanel.d.ts.map +1 -0
- package/dist/components/ComplianceFindingsPanel.js +118 -0
- package/dist/components/ComplianceFindingsPanel.js.map +1 -0
- package/dist/components/DesignSuggestionsPanel.d.ts +148 -0
- package/dist/components/DesignSuggestionsPanel.d.ts.map +1 -0
- package/dist/components/DesignSuggestionsPanel.js +154 -0
- package/dist/components/DesignSuggestionsPanel.js.map +1 -0
- package/dist/components/DielineParametersPanel.d.ts +62 -0
- package/dist/components/DielineParametersPanel.d.ts.map +1 -0
- package/dist/components/DielineParametersPanel.js +170 -0
- package/dist/components/DielineParametersPanel.js.map +1 -0
- package/dist/components/DielinePreview.d.ts +150 -0
- package/dist/components/DielinePreview.d.ts.map +1 -0
- package/dist/components/DielinePreview.js +146 -0
- package/dist/components/DielinePreview.js.map +1 -0
- package/dist/components/EditorApp.d.ts +39 -5
- package/dist/components/EditorApp.d.ts.map +1 -1
- package/dist/components/EditorApp.js +110 -5
- package/dist/components/EditorApp.js.map +1 -1
- package/dist/components/EditorCanvas.d.ts +51 -2
- package/dist/components/EditorCanvas.d.ts.map +1 -1
- package/dist/components/EditorCanvas.js +117 -48
- package/dist/components/EditorCanvas.js.map +1 -1
- package/dist/components/EmailNotifyPanel.d.ts +165 -0
- package/dist/components/EmailNotifyPanel.d.ts.map +1 -0
- package/dist/components/EmailNotifyPanel.js +211 -0
- package/dist/components/EmailNotifyPanel.js.map +1 -0
- package/dist/components/FileDropZone.d.ts +9 -1
- package/dist/components/FileDropZone.d.ts.map +1 -1
- package/dist/components/FileDropZone.js +53 -5
- package/dist/components/FileDropZone.js.map +1 -1
- package/dist/components/FoldEditorPanel.d.ts +68 -0
- package/dist/components/FoldEditorPanel.d.ts.map +1 -0
- package/dist/components/FoldEditorPanel.js +65 -0
- package/dist/components/FoldEditorPanel.js.map +1 -0
- package/dist/components/FoldPreviewOverlay.d.ts +48 -0
- package/dist/components/FoldPreviewOverlay.d.ts.map +1 -0
- package/dist/components/FoldPreviewOverlay.js +182 -0
- package/dist/components/FoldPreviewOverlay.js.map +1 -0
- package/dist/components/Gs1DigitalLinkPanel.d.ts +103 -0
- package/dist/components/Gs1DigitalLinkPanel.d.ts.map +1 -0
- package/dist/components/Gs1DigitalLinkPanel.js +199 -0
- package/dist/components/Gs1DigitalLinkPanel.js.map +1 -0
- package/dist/components/HistoryPanel.d.ts +39 -0
- package/dist/components/HistoryPanel.d.ts.map +1 -0
- package/dist/components/HistoryPanel.js +72 -0
- package/dist/components/HistoryPanel.js.map +1 -0
- package/dist/components/IccSoftProofOverlay.d.ts +67 -0
- package/dist/components/IccSoftProofOverlay.d.ts.map +1 -0
- package/dist/components/IccSoftProofOverlay.js +119 -0
- package/dist/components/IccSoftProofOverlay.js.map +1 -0
- package/dist/components/ImposePanel.d.ts +71 -0
- package/dist/components/ImposePanel.d.ts.map +1 -0
- package/dist/components/ImposePanel.js +127 -0
- package/dist/components/ImposePanel.js.map +1 -0
- package/dist/components/InksPanel.d.ts +61 -0
- package/dist/components/InksPanel.d.ts.map +1 -0
- package/dist/components/InksPanel.js +84 -0
- package/dist/components/InksPanel.js.map +1 -0
- package/dist/components/JobSetupPanel.d.ts +118 -0
- package/dist/components/JobSetupPanel.d.ts.map +1 -0
- package/dist/components/JobSetupPanel.js +169 -0
- package/dist/components/JobSetupPanel.js.map +1 -0
- package/dist/components/LayersPanel.d.ts.map +1 -1
- package/dist/components/LayersPanel.js +1 -0
- package/dist/components/LayersPanel.js.map +1 -1
- package/dist/components/MarkLibraryPanel.d.ts +131 -0
- package/dist/components/MarkLibraryPanel.d.ts.map +1 -0
- package/dist/components/MarkLibraryPanel.js +184 -0
- package/dist/components/MarkLibraryPanel.js.map +1 -0
- package/dist/components/MisEstimateButton.d.ts +73 -0
- package/dist/components/MisEstimateButton.d.ts.map +1 -0
- package/dist/components/MisEstimateButton.js +57 -0
- package/dist/components/MisEstimateButton.js.map +1 -0
- package/dist/components/NutritionPanel.d.ts +118 -0
- package/dist/components/NutritionPanel.d.ts.map +1 -0
- package/dist/components/NutritionPanel.js +169 -0
- package/dist/components/NutritionPanel.js.map +1 -0
- package/dist/components/PageNavigator.d.ts +26 -0
- package/dist/components/PageNavigator.d.ts.map +1 -0
- package/dist/components/PageNavigator.js +96 -0
- package/dist/components/PageNavigator.js.map +1 -0
- package/dist/components/PaletteManager.d.ts +32 -0
- package/dist/components/PaletteManager.d.ts.map +1 -0
- package/dist/components/PaletteManager.js +89 -0
- package/dist/components/PaletteManager.js.map +1 -0
- package/dist/components/PaletteToSpotPanel.d.ts +122 -0
- package/dist/components/PaletteToSpotPanel.d.ts.map +1 -0
- package/dist/components/PaletteToSpotPanel.js +160 -0
- package/dist/components/PaletteToSpotPanel.js.map +1 -0
- package/dist/components/PreflightAutoFixPanel.d.ts +110 -0
- package/dist/components/PreflightAutoFixPanel.d.ts.map +1 -0
- package/dist/components/PreflightAutoFixPanel.js +119 -0
- package/dist/components/PreflightAutoFixPanel.js.map +1 -0
- package/dist/components/PreflightDiffPanel.d.ts +127 -0
- package/dist/components/PreflightDiffPanel.d.ts.map +1 -0
- package/dist/components/PreflightDiffPanel.js +0 -0
- package/dist/components/PreflightDiffPanel.js.map +1 -0
- package/dist/components/ProcessRulesPanel.d.ts +81 -0
- package/dist/components/ProcessRulesPanel.d.ts.map +1 -0
- package/dist/components/ProcessRulesPanel.js +143 -0
- package/dist/components/ProcessRulesPanel.js.map +1 -0
- package/dist/components/SlackNotifyPanel.d.ts +139 -0
- package/dist/components/SlackNotifyPanel.d.ts.map +1 -0
- package/dist/components/SlackNotifyPanel.js +133 -0
- package/dist/components/SlackNotifyPanel.js.map +1 -0
- package/dist/components/SmartSpotMatchPanel.d.ts +143 -0
- package/dist/components/SmartSpotMatchPanel.d.ts.map +1 -0
- package/dist/components/SmartSpotMatchPanel.js +159 -0
- package/dist/components/SmartSpotMatchPanel.js.map +1 -0
- package/dist/components/SwatchesPicker.d.ts +83 -0
- package/dist/components/SwatchesPicker.d.ts.map +1 -0
- package/dist/components/SwatchesPicker.js +151 -0
- package/dist/components/SwatchesPicker.js.map +1 -0
- package/dist/components/TacOverlay.d.ts +47 -0
- package/dist/components/TacOverlay.d.ts.map +1 -0
- package/dist/components/TacOverlay.js +116 -0
- package/dist/components/TacOverlay.js.map +1 -0
- package/dist/components/TrapEditorPanel.d.ts +52 -0
- package/dist/components/TrapEditorPanel.d.ts.map +1 -0
- package/dist/components/TrapEditorPanel.js +64 -0
- package/dist/components/TrapEditorPanel.js.map +1 -0
- package/dist/components/TrapPreviewOverlay.d.ts +64 -0
- package/dist/components/TrapPreviewOverlay.d.ts.map +1 -0
- package/dist/components/TrapPreviewOverlay.js +120 -0
- package/dist/components/TrapPreviewOverlay.js.map +1 -0
- package/dist/components/VariantMatrixPanel.d.ts +61 -0
- package/dist/components/VariantMatrixPanel.d.ts.map +1 -0
- package/dist/components/VariantMatrixPanel.js +97 -0
- package/dist/components/VariantMatrixPanel.js.map +1 -0
- package/dist/components/VariantMatrixVersionPanel.d.ts +122 -0
- package/dist/components/VariantMatrixVersionPanel.d.ts.map +1 -0
- package/dist/components/VariantMatrixVersionPanel.js +162 -0
- package/dist/components/VariantMatrixVersionPanel.js.map +1 -0
- package/dist/components/WebhookNotifyPanel.d.ts +160 -0
- package/dist/components/WebhookNotifyPanel.d.ts.map +1 -0
- package/dist/components/WebhookNotifyPanel.js +100 -0
- package/dist/components/WebhookNotifyPanel.js.map +1 -0
- package/dist/components/WhiteUnderbasePanel.d.ts +107 -0
- package/dist/components/WhiteUnderbasePanel.d.ts.map +1 -0
- package/dist/components/WhiteUnderbasePanel.js +104 -0
- package/dist/components/WhiteUnderbasePanel.js.map +1 -0
- package/dist/data/dielines.json +35 -0
- package/dist/hooks/useEditorMode.d.ts +25 -5
- package/dist/hooks/useEditorMode.d.ts.map +1 -1
- package/dist/hooks/useEditorMode.js +18 -5
- package/dist/hooks/useEditorMode.js.map +1 -1
- package/dist/index.d.ts +49 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -2
- package/dist/index.js.map +1 -1
- package/dist/lens/dieline-overlay.d.ts +25 -0
- package/dist/lens/dieline-overlay.d.ts.map +1 -0
- package/dist/lens/dieline-overlay.js +50 -0
- package/dist/lens/dieline-overlay.js.map +1 -0
- package/dist/lens/index.d.ts +27 -0
- package/dist/lens/index.d.ts.map +1 -0
- package/dist/lens/index.js +28 -0
- package/dist/lens/index.js.map +1 -0
- package/dist/lens/preflight-findings.d.ts +21 -0
- package/dist/lens/preflight-findings.d.ts.map +1 -0
- package/dist/lens/preflight-findings.js +82 -0
- package/dist/lens/preflight-findings.js.map +1 -0
- package/dist/lib/barcode-scan.d.ts +154 -0
- package/dist/lib/barcode-scan.d.ts.map +1 -0
- package/dist/lib/barcode-scan.js +152 -0
- package/dist/lib/barcode-scan.js.map +1 -0
- package/dist/lib/color-math.d.ts +76 -0
- package/dist/lib/color-math.d.ts.map +1 -0
- package/dist/lib/color-math.js +96 -0
- package/dist/lib/color-math.js.map +1 -0
- package/dist/lib/dieline-template.d.ts +169 -0
- package/dist/lib/dieline-template.d.ts.map +1 -1
- package/dist/lib/dieline-template.js +229 -1
- package/dist/lib/dieline-template.js.map +1 -1
- package/dist/lib/editor-config.d.ts +384 -1
- package/dist/lib/editor-config.d.ts.map +1 -1
- package/dist/lib/editor-config.js +89 -2
- package/dist/lib/editor-config.js.map +1 -1
- package/dist/lib/fold-geometry.d.ts +144 -0
- package/dist/lib/fold-geometry.d.ts.map +1 -0
- package/dist/lib/fold-geometry.js +138 -0
- package/dist/lib/fold-geometry.js.map +1 -0
- package/dist/lib/merge-tokens.d.ts +81 -0
- package/dist/lib/merge-tokens.d.ts.map +1 -0
- package/dist/lib/merge-tokens.js +88 -0
- package/dist/lib/merge-tokens.js.map +1 -0
- package/dist/lib/palette-registry.d.ts +40 -0
- package/dist/lib/palette-registry.d.ts.map +1 -0
- package/dist/lib/palette-registry.js +49 -0
- package/dist/lib/palette-registry.js.map +1 -0
- package/dist/lib/panel-anchor.d.ts +101 -0
- package/dist/lib/panel-anchor.d.ts.map +1 -0
- package/dist/lib/panel-anchor.js +68 -0
- package/dist/lib/panel-anchor.js.map +1 -0
- package/dist/lib/preflight/checks.d.ts.map +1 -1
- package/dist/lib/preflight/checks.js +71 -0
- package/dist/lib/preflight/checks.js.map +1 -1
- package/dist/lib/preflight/types.d.ts.map +1 -1
- package/dist/lib/preflight/types.js +11 -0
- package/dist/lib/preflight/types.js.map +1 -1
- package/dist/lib/rasterize.d.ts +93 -0
- package/dist/lib/rasterize.d.ts.map +1 -0
- package/dist/lib/rasterize.js +117 -0
- package/dist/lib/rasterize.js.map +1 -0
- package/dist/lib/separations-registry.d.ts +99 -0
- package/dist/lib/separations-registry.d.ts.map +1 -0
- package/dist/lib/separations-registry.js +59 -0
- package/dist/lib/separations-registry.js.map +1 -0
- package/dist/lib/unwired.d.ts +29 -0
- package/dist/lib/unwired.d.ts.map +1 -0
- package/dist/lib/unwired.js +58 -0
- package/dist/lib/unwired.js.map +1 -0
- package/package.json +29 -11
- package/dist/components/SeparationsPanel.d.ts +0 -9
- package/dist/components/SeparationsPanel.d.ts.map +0 -1
- package/dist/components/SeparationsPanel.js +0 -168
- package/dist/components/SeparationsPanel.js.map +0 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wave 4 I3 — Slack-notify panel.
|
|
3
|
+
*
|
|
4
|
+
* A small panel that lets the user emit a Slack notification keyed
|
|
5
|
+
* to a typed editor event (preflight cleared, job submitted, variant
|
|
6
|
+
* approved, …). The panel handles the UI; the actual webhook POST
|
|
7
|
+
* is host-wired via a {@link SlackNotifyFn} adapter so the editor
|
|
8
|
+
* stays runtime-free of any Slack SDK / fetch wrapper.
|
|
9
|
+
*
|
|
10
|
+
* Pairs with the synergy `slack.notify` workflow node when one is
|
|
11
|
+
* deployed — the host typically wires `notify` to that node so the
|
|
12
|
+
* webhook URL stays server-side. Hosts without a synergy bridge can
|
|
13
|
+
* also POST straight to a Slack incoming-webhook URL from their own
|
|
14
|
+
* client code; the adapter shape is intentionally agnostic.
|
|
15
|
+
*
|
|
16
|
+
* Designed around the same loader/adapter pattern as
|
|
17
|
+
* {@link MisEstimateButton}, {@link SwatchesPicker}, etc.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
import type { ReactElement } from "react";
|
|
22
|
+
/**
|
|
23
|
+
* The set of editor events that map to canonical Slack message
|
|
24
|
+
* templates. `"custom"` is the escape hatch — when the user wants to
|
|
25
|
+
* send a free-form message that isn't tied to an event,
|
|
26
|
+
* {@link composeSlackMessage} renders just `context.text` and ignores
|
|
27
|
+
* the rest of the context.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export type SlackNotificationEventKind = "preflight-blocked" | "preflight-cleared" | "job-submitted" | "variant-approved" | "approval-requested" | "custom";
|
|
32
|
+
/**
|
|
33
|
+
* Context passed to {@link composeSlackMessage}. Most fields are
|
|
34
|
+
* optional and only render when the chosen event template references
|
|
35
|
+
* them — e.g. `findingCount` is consulted by `"preflight-blocked"` and
|
|
36
|
+
* `"preflight-cleared"` and ignored otherwise.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export type SlackNotificationContext = {
|
|
41
|
+
/** Human-readable document name surfaced as the message subject. */
|
|
42
|
+
documentName?: string;
|
|
43
|
+
/** Stable identifier the host uses to link back to the document. */
|
|
44
|
+
documentId?: string;
|
|
45
|
+
/** Optional clickable URL — Slack renders this as a link below the
|
|
46
|
+
* subject line so reviewers can jump straight into the editor. */
|
|
47
|
+
documentUrl?: string;
|
|
48
|
+
/** Preflight finding count (errors only for `"preflight-blocked"`,
|
|
49
|
+
* total resolved for `"preflight-cleared"`). */
|
|
50
|
+
findingCount?: number;
|
|
51
|
+
/** Variant id for `"variant-approved"`. */
|
|
52
|
+
variantId?: string;
|
|
53
|
+
/** Reviewer / submitter display name surfaced as the message
|
|
54
|
+
* byline. */
|
|
55
|
+
actor?: string;
|
|
56
|
+
/** Free-form additional text appended to the canonical template
|
|
57
|
+
* (or, for `"custom"`, used as the entire body). */
|
|
58
|
+
text?: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Canonical Slack incoming-webhook payload shape (subset: only the
|
|
62
|
+
* fields the panel emits). Hosts that need richer payloads (`blocks`,
|
|
63
|
+
* `attachments`, threading) wrap their own adapter that augments the
|
|
64
|
+
* panel output before POSTing.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export type SlackNotificationPayload = {
|
|
69
|
+
/** Optional channel override (e.g. `"#preflight"`). When absent the
|
|
70
|
+
* host's webhook URL determines the channel. */
|
|
71
|
+
channel?: string;
|
|
72
|
+
/** Message text. Slack's webhook treats this as the fallback /
|
|
73
|
+
* notification text and the main body when no `blocks` are
|
|
74
|
+
* supplied. */
|
|
75
|
+
text: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Pure helper — renders a {@link SlackNotificationContext} into a
|
|
79
|
+
* canonical Slack message payload. The mapping is intentionally
|
|
80
|
+
* simple (one short line per event template) so hosts that want
|
|
81
|
+
* richer messages can post-process the output. Pure function; no I/O.
|
|
82
|
+
*
|
|
83
|
+
* `"custom"` returns `context.text` verbatim (or a placeholder when
|
|
84
|
+
* empty) — the helper never silently drops the message.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export declare function composeSlackMessage(kind: SlackNotificationEventKind, context: SlackNotificationContext): SlackNotificationPayload;
|
|
89
|
+
/**
|
|
90
|
+
* Host adapter — POSTs the composed payload to Slack (typically via
|
|
91
|
+
* a server-side proxy or the synergy `slack.notify` node). Resolves
|
|
92
|
+
* on accept; rejects on transport / validation errors and the panel
|
|
93
|
+
* surfaces the message inline.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export type SlackNotifyFn = (payload: SlackNotificationPayload) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Human-readable labels for each event kind, in the order they
|
|
100
|
+
* appear in the dropdown. Exported so hosts that re-use the picker
|
|
101
|
+
* shape (e.g. in a settings page) stay in lockstep with the panel.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export declare const SLACK_NOTIFICATION_EVENT_LABELS: Readonly<Record<SlackNotificationEventKind, string>>;
|
|
106
|
+
/**
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
export type SlackNotifyPanelProps = {
|
|
110
|
+
/** Host adapter, see {@link SlackNotifyFn}. */
|
|
111
|
+
notify: SlackNotifyFn;
|
|
112
|
+
/** Context the panel renders into the chosen event template. The
|
|
113
|
+
* host typically wires this to the active document. */
|
|
114
|
+
context: SlackNotificationContext;
|
|
115
|
+
/** Optional initial event selection. Defaults to
|
|
116
|
+
* `"preflight-blocked"` — the most common trigger. */
|
|
117
|
+
defaultEvent?: SlackNotificationEventKind;
|
|
118
|
+
/** Optional channel override. When absent, the panel's "Channel"
|
|
119
|
+
* input is empty and the host's webhook URL decides routing. */
|
|
120
|
+
defaultChannel?: string;
|
|
121
|
+
/** Optional mapper that turns a notify error into a user-facing
|
|
122
|
+
* message. The default avoids leaking internal `Error.message`
|
|
123
|
+
* strings; hosts that want richer surfaces (e.g. validation-error
|
|
124
|
+
* toasts) pass their own mapper. The original error is still
|
|
125
|
+
* passed in so hosts can log it. */
|
|
126
|
+
errorMessage?: (err: unknown) => string;
|
|
127
|
+
/** Optional callback fired on successful notify so the host can
|
|
128
|
+
* show a confirmation toast / log analytics. */
|
|
129
|
+
onSuccess?: (payload: SlackNotificationPayload) => void;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Stateful panel — picks an event template, lets the user override
|
|
133
|
+
* channel + append a custom note, composes the payload via
|
|
134
|
+
* {@link composeSlackMessage}, and POSTs through the host adapter.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export declare function SlackNotifyPanel({ notify, context, defaultEvent, defaultChannel, errorMessage, onSuccess, }: SlackNotifyPanelProps): ReactElement;
|
|
139
|
+
//# sourceMappingURL=SlackNotifyPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackNotifyPanel.d.ts","sourceRoot":"","sources":["../../src/components/SlackNotifyPanel.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAClC,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,GACf,kBAAkB,GAClB,oBAAoB,GACpB,QAAQ,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;uEACmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;qDACiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;kBACc;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;yDACqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;qDACiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;oBAEgB;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,0BAA0B,EAChC,OAAO,EAAE,wBAAwB,GAChC,wBAAwB,CAyC1B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,MAAM,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAQ9F,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,+CAA+C;IAC/C,MAAM,EAAE,aAAa,CAAC;IACtB;4DACwD;IACxD,OAAO,EAAE,wBAAwB,CAAC;IAClC;2DACuD;IACvD,YAAY,CAAC,EAAE,0BAA0B,CAAC;IAC1C;qEACiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;yCAIqC;IACrC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC;IACxC;qDACiD;IACjD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACzD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,SAAS,GACV,EAAE,qBAAqB,GAAG,YAAY,CAuHtC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
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 { useState } from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Pure helper — renders a {@link SlackNotificationContext} into a
|
|
7
|
+
* canonical Slack message payload. The mapping is intentionally
|
|
8
|
+
* simple (one short line per event template) so hosts that want
|
|
9
|
+
* richer messages can post-process the output. Pure function; no I/O.
|
|
10
|
+
*
|
|
11
|
+
* `"custom"` returns `context.text` verbatim (or a placeholder when
|
|
12
|
+
* empty) — the helper never silently drops the message.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function composeSlackMessage(kind, context) {
|
|
17
|
+
const subject = context.documentName ?? context.documentId ?? "an artwork document";
|
|
18
|
+
const actor = context.actor ? ` by ${context.actor}` : "";
|
|
19
|
+
const link = context.documentUrl ? ` <${context.documentUrl}|open>` : "";
|
|
20
|
+
const trailer = context.text ? ` — ${context.text}` : "";
|
|
21
|
+
switch (kind) {
|
|
22
|
+
case "preflight-blocked": {
|
|
23
|
+
// Treat undefined / unknown counts as "no number to show" rather
|
|
24
|
+
// than "0" — "Preflight blocked: 0 findings" reads as a
|
|
25
|
+
// contradiction even though it's how a number-less template
|
|
26
|
+
// would default.
|
|
27
|
+
const n = context.findingCount;
|
|
28
|
+
const findingsFragment = typeof n === "number" ? `: ${n} finding${n === 1 ? "" : "s"}` : "";
|
|
29
|
+
return {
|
|
30
|
+
text: `Preflight blocked on ${subject}${actor}${findingsFragment}${link}${trailer}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
case "preflight-cleared":
|
|
34
|
+
return {
|
|
35
|
+
text: `Preflight cleared on ${subject}${actor}${link}${trailer}`,
|
|
36
|
+
};
|
|
37
|
+
case "job-submitted":
|
|
38
|
+
return {
|
|
39
|
+
text: `Job submitted for ${subject}${actor}${link}${trailer}`,
|
|
40
|
+
};
|
|
41
|
+
case "variant-approved": {
|
|
42
|
+
const v = context.variantId ? ` (${context.variantId})` : "";
|
|
43
|
+
return {
|
|
44
|
+
text: `Variant approved on ${subject}${v}${actor}${link}${trailer}`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
case "approval-requested":
|
|
48
|
+
return {
|
|
49
|
+
text: `Approval requested on ${subject}${actor}${link}${trailer}`,
|
|
50
|
+
};
|
|
51
|
+
case "custom":
|
|
52
|
+
return {
|
|
53
|
+
text: context.text?.trim() ? context.text : `Update on ${subject}${actor}${link}`,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Human-readable labels for each event kind, in the order they
|
|
59
|
+
* appear in the dropdown. Exported so hosts that re-use the picker
|
|
60
|
+
* shape (e.g. in a settings page) stay in lockstep with the panel.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export const SLACK_NOTIFICATION_EVENT_LABELS = {
|
|
65
|
+
"preflight-blocked": "Preflight blocked",
|
|
66
|
+
"preflight-cleared": "Preflight cleared",
|
|
67
|
+
"job-submitted": "Job submitted",
|
|
68
|
+
"variant-approved": "Variant approved",
|
|
69
|
+
"approval-requested": "Approval requested",
|
|
70
|
+
custom: "Custom message",
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Stateful panel — picks an event template, lets the user override
|
|
74
|
+
* channel + append a custom note, composes the payload via
|
|
75
|
+
* {@link composeSlackMessage}, and POSTs through the host adapter.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export function SlackNotifyPanel({ notify, context, defaultEvent, defaultChannel, errorMessage, onSuccess, }) {
|
|
80
|
+
const [event, setEvent] = useState(defaultEvent ?? "preflight-blocked");
|
|
81
|
+
const [channel, setChannel] = useState(defaultChannel ?? "");
|
|
82
|
+
const [note, setNote] = useState("");
|
|
83
|
+
const [state, setState] = useState({ kind: "idle" });
|
|
84
|
+
// Clear the success / error chip when the user edits any input —
|
|
85
|
+
// a "Sent" indicator next to an unsent payload reads as a lie. The
|
|
86
|
+
// wrapper keeps the original setter ergonomic at every call site.
|
|
87
|
+
const resetOutcome = () => {
|
|
88
|
+
setState((prev) => (prev.kind === "ok" || prev.kind === "error" ? { kind: "idle" } : prev));
|
|
89
|
+
};
|
|
90
|
+
const onClick = async () => {
|
|
91
|
+
setState({ kind: "sending" });
|
|
92
|
+
const composed = composeSlackMessage(event, {
|
|
93
|
+
...context,
|
|
94
|
+
...(note.trim() && { text: note }),
|
|
95
|
+
});
|
|
96
|
+
const payload = {
|
|
97
|
+
...composed,
|
|
98
|
+
...(channel.trim() && { channel: channel.trim() }),
|
|
99
|
+
};
|
|
100
|
+
try {
|
|
101
|
+
await notify(payload);
|
|
102
|
+
setState({ kind: "ok" });
|
|
103
|
+
onSuccess?.(payload);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// Guard against a host-supplied errorMessage that throws (e.g.
|
|
107
|
+
// makes assumptions about `err`'s shape) — without the inner
|
|
108
|
+
// try/catch the panel would silently swallow the failure and
|
|
109
|
+
// never enter the `error` state.
|
|
110
|
+
let message = "Couldn't send Slack notification.";
|
|
111
|
+
if (errorMessage) {
|
|
112
|
+
try {
|
|
113
|
+
message = errorMessage(err);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// fall back to the default message
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
setState({ kind: "error", message });
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
return (_jsxs("div", { "data-testid": "slack-notify-panel", style: { padding: "0.5rem" }, children: [_jsx("header", { style: { marginBottom: "0.5rem" }, children: _jsx("h3", { style: { margin: 0, fontSize: "0.875rem" }, children: "Slack notify" }) }), _jsxs("label", { style: { display: "block", fontSize: "0.75rem", marginBottom: "0.5rem" }, children: ["Event", _jsx("select", { "aria-label": "Event", value: event, onChange: (e) => {
|
|
123
|
+
setEvent(e.target.value);
|
|
124
|
+
resetOutcome();
|
|
125
|
+
}, style: { display: "block", marginTop: "0.125rem", width: "100%" }, children: Object.entries(SLACK_NOTIFICATION_EVENT_LABELS).map(([k, label]) => (_jsx("option", { value: k, children: label }, k))) })] }), _jsxs("label", { style: { display: "block", fontSize: "0.75rem", marginBottom: "0.5rem" }, children: ["Channel", _jsx("input", { type: "text", "aria-label": "Channel", placeholder: "#preflight (optional)", value: channel, onChange: (e) => {
|
|
126
|
+
setChannel(e.target.value);
|
|
127
|
+
resetOutcome();
|
|
128
|
+
}, style: { display: "block", marginTop: "0.125rem", width: "100%" } })] }), _jsxs("label", { style: { display: "block", fontSize: "0.75rem", marginBottom: "0.5rem" }, children: ["Note", _jsx("textarea", { "aria-label": "Note", placeholder: "Optional \u2014 appended to the message", value: note, onChange: (e) => {
|
|
129
|
+
setNote(e.target.value);
|
|
130
|
+
resetOutcome();
|
|
131
|
+
}, rows: 2, style: { display: "block", marginTop: "0.125rem", width: "100%" } })] }), _jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [_jsx("button", { type: "button", onClick: onClick, disabled: state.kind === "sending", "aria-busy": state.kind === "sending", children: state.kind === "sending" ? "Sending…" : "Notify Slack" }), state.kind === "ok" && (_jsx("output", { style: { color: "#080", fontSize: "0.75rem" }, children: "Sent" })), state.kind === "error" && (_jsx("span", { role: "alert", style: { color: "#a00", fontSize: "0.75rem" }, children: state.message }))] })] }));
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=SlackNotifyPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlackNotifyPanel.js","sourceRoot":"","sources":["../../src/components/SlackNotifyPanel.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAwBb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAkEjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAgC,EAChC,OAAiC;IAEjC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,UAAU,IAAI,qBAAqB,CAAC;IACpF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,WAAW,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEzD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACzB,iEAAiE;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AAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GACjE,IACI,EACR,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,aAClE,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,KAAK,CAAC,IAAI,KAAK,SAAS,eACvB,KAAK,CAAC,IAAI,KAAK,SAAS,YAElC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,GAChD,EACR,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,CACtB,iBAAQ,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,qBAAe,CACrE,EACA,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CACzB,eAAM,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,YAC7D,KAAK,CAAC,OAAO,GACT,CACR,IACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wave 4 AI2 — Smart spot-match panel.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a user-picked CMYK / Lab / hex color to a ranked list of
|
|
5
|
+
* nearest-PANTONE candidates via a host-supplied loader (typically
|
|
6
|
+
* fronting compile-pdf's `/v1/spots/match` endpoint or a tenant-local
|
|
7
|
+
* ΔE engine). Each match carries the canonical {@link Spot} entry +
|
|
8
|
+
* its ΔE distance from the query so the picker can render
|
|
9
|
+
* "good / borderline / poor" cues without the editor doing color
|
|
10
|
+
* math itself.
|
|
11
|
+
*
|
|
12
|
+
* Sibling of {@link SwatchesPicker} — that one searches the PANTONE
|
|
13
|
+
* catalogue by name, this one searches it by color value. Pairs with
|
|
14
|
+
* the AI4 `registerSpot` flow (Wave 1) — clicking a match feeds the
|
|
15
|
+
* selected `Spot` into the host's separations registry.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
import type { ReactElement } from "react";
|
|
20
|
+
import type { Spot } from "./SwatchesPicker";
|
|
21
|
+
/**
|
|
22
|
+
* One color-space query the loader recognizes. At least one of
|
|
23
|
+
* `cmyk` / `lab` / `hex` must be present. The host's loader picks
|
|
24
|
+
* the most accurate space available (Lab > CMYK > hex) when more
|
|
25
|
+
* than one is supplied.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export type SpotMatchQuery = {
|
|
30
|
+
/** Percent CMYK in `[0, 100]` per channel. */
|
|
31
|
+
cmyk?: readonly [number, number, number, number];
|
|
32
|
+
/** CIE Lab — L in `[0, 100]`, a/b roughly `[-128, 128]`. */
|
|
33
|
+
lab?: readonly [number, number, number];
|
|
34
|
+
/** 7-char sRGB hex including the leading `#` (e.g. `"#ff5102"`). */
|
|
35
|
+
hex?: string;
|
|
36
|
+
/** Optional cap on the number of returned matches; loaders that
|
|
37
|
+
* ignore it must still return a stable ordering. */
|
|
38
|
+
limit?: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* One ranked match — the canonical PANTONE entry + its ΔE distance
|
|
42
|
+
* from the query. The panel sorts matches ascending on `deltaE`
|
|
43
|
+
* (best first) via {@link sortMatchesByDeltaE}.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export type SpotMatch = {
|
|
48
|
+
spot: Spot;
|
|
49
|
+
/** CIE ΔE distance. Smaller is better; under ~1 is "imperceptible",
|
|
50
|
+
* 1–3 is "noticeable", >5 is "poor". */
|
|
51
|
+
deltaE: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Host adapter — resolves a {@link SpotMatchQuery} to a ranked list
|
|
55
|
+
* of {@link SpotMatch} candidates. Rejects on transport / validation
|
|
56
|
+
* errors and the panel surfaces the message inline. Hosts should
|
|
57
|
+
* memoize the function with `useCallback` so an unrelated parent
|
|
58
|
+
* re-render doesn't trigger a spurious refetch.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export type SpotMatchLoaderFn = (query: SpotMatchQuery) => Promise<readonly SpotMatch[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Configuration for the {@link SmartSpotMatchPanel}. The host always
|
|
65
|
+
* supplies the {@link SpotMatchLoaderFn}; the other three props are
|
|
66
|
+
* optional and shape the panel's initial state and selection
|
|
67
|
+
* behaviour. Hosts that want to drive the query from outside the
|
|
68
|
+
* panel (e.g. wire the active fill colour straight in) flow that
|
|
69
|
+
* through `initialQuery`; the panel re-derives its query whenever
|
|
70
|
+
* `initialQuery`'s content changes.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export type SmartSpotMatchPanelProps = {
|
|
75
|
+
/** Host adapter, see {@link SpotMatchLoaderFn}. */
|
|
76
|
+
loader: SpotMatchLoaderFn;
|
|
77
|
+
/** Optional initial query — pre-fills the form. Hosts wire this to
|
|
78
|
+
* the active object's fill / stroke color when the user opens the
|
|
79
|
+
* panel from a swatch chip. */
|
|
80
|
+
initialQuery?: SpotMatchQuery;
|
|
81
|
+
/** Optional cap on returned matches. Defaults to 12 — enough to
|
|
82
|
+
* cover the standard `5 ΔE` neighborhood without overwhelming the
|
|
83
|
+
* scroll surface. */
|
|
84
|
+
limit?: number;
|
|
85
|
+
/** Click callback. Receives the full {@link SpotMatch} so hosts
|
|
86
|
+
* can wire it into a separations registry / fill picker. */
|
|
87
|
+
onSelect?: (match: SpotMatch) => void;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Pure helper — sorts a `SpotMatch` list ascending on `deltaE`
|
|
91
|
+
* (best-first). Stable on ties: input order preserved. Returns a
|
|
92
|
+
* new array.
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare function sortMatchesByDeltaE(matches: readonly SpotMatch[]): readonly SpotMatch[];
|
|
97
|
+
/**
|
|
98
|
+
* Pure helper — classifies a ΔE distance into the conventional
|
|
99
|
+
* print-industry quality band so renderers can color-code matches
|
|
100
|
+
* consistently. Thresholds are the standard CIE-1994 perceptual cut
|
|
101
|
+
* points; the panel uses them for the result-row severity chip.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export type DeltaEQuality = "imperceptible" | "noticeable" | "fair" | "poor";
|
|
106
|
+
/**
|
|
107
|
+
* Pure helper — maps a ΔE distance to a {@link DeltaEQuality} band
|
|
108
|
+
* using the CIE-1994 perceptual cut points (under 1 is
|
|
109
|
+
* imperceptible, 1–3 is noticeable, 3–5 is fair, ≥5 is poor). Used
|
|
110
|
+
* by the panel for the per-row severity chip; exported so hosts can
|
|
111
|
+
* surface the same banding outside the panel (e.g. in a print-proof
|
|
112
|
+
* audit). Returns `"poor"` for non-finite or negative inputs by
|
|
113
|
+
* threshold ordering — callers should pre-validate if they care.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export declare function deltaEQuality(deltaE: number): DeltaEQuality;
|
|
118
|
+
/**
|
|
119
|
+
* Pure helper — formats ΔE for chip / row display (e.g. `"ΔE 1.2"`).
|
|
120
|
+
* Two-decimal precision matches what most ΔE engines emit and what
|
|
121
|
+
* print shops quote.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export declare function formatDeltaE(deltaE: number): string;
|
|
126
|
+
/**
|
|
127
|
+
* Pure helper — quickly checks whether a query has at least one
|
|
128
|
+
* color-space populated. Exported so hosts that drive the loader
|
|
129
|
+
* from outside the panel can gate their fetch on the same predicate.
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
export declare function isQueryReady(query: SpotMatchQuery): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Stateful panel — accepts a CMYK or hex input, calls the host
|
|
136
|
+
* loader, and surfaces ranked matches with ΔE chips. Hosts wire
|
|
137
|
+
* `onSelect` to push the picked spot into the active object's fill
|
|
138
|
+
* / stroke or into the separations registry.
|
|
139
|
+
*
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
export declare function SmartSpotMatchPanel({ loader, initialQuery, limit, onSelect, }: SmartSpotMatchPanelProps): ReactElement;
|
|
143
|
+
//# sourceMappingURL=SmartSpotMatchPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartSpotMatchPanel.d.ts","sourceRoot":"","sources":["../../src/components/SmartSpotMatchPanel.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,8CAA8C;IAC9C,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,4DAA4D;IAC5D,GAAG,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;yDACqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC;IACX;6CACyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,mDAAmD;IACnD,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;oCAEgC;IAChC,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B;;0BAEsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;iEAC6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,SAAS,EAAE,CAKvF;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAM3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAE3D;AASD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE,wBAAwB,GAAG,YAAY,CAqGzC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Pure helper — sorts a `SpotMatch` list ascending on `deltaE`
|
|
7
|
+
* (best-first). Stable on ties: input order preserved. Returns a
|
|
8
|
+
* new array.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export function sortMatchesByDeltaE(matches) {
|
|
13
|
+
return [...matches]
|
|
14
|
+
.map((m, i) => ({ m, i }))
|
|
15
|
+
.sort((a, b) => a.m.deltaE - b.m.deltaE || a.i - b.i)
|
|
16
|
+
.map((x) => x.m);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Pure helper — maps a ΔE distance to a {@link DeltaEQuality} band
|
|
20
|
+
* using the CIE-1994 perceptual cut points (under 1 is
|
|
21
|
+
* imperceptible, 1–3 is noticeable, 3–5 is fair, ≥5 is poor). Used
|
|
22
|
+
* by the panel for the per-row severity chip; exported so hosts can
|
|
23
|
+
* surface the same banding outside the panel (e.g. in a print-proof
|
|
24
|
+
* audit). Returns `"poor"` for non-finite or negative inputs by
|
|
25
|
+
* threshold ordering — callers should pre-validate if they care.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export function deltaEQuality(deltaE) {
|
|
30
|
+
if (!Number.isFinite(deltaE) || deltaE < 0)
|
|
31
|
+
return "poor";
|
|
32
|
+
if (deltaE < 1)
|
|
33
|
+
return "imperceptible";
|
|
34
|
+
if (deltaE < 3)
|
|
35
|
+
return "noticeable";
|
|
36
|
+
if (deltaE < 5)
|
|
37
|
+
return "fair";
|
|
38
|
+
return "poor";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Pure helper — formats ΔE for chip / row display (e.g. `"ΔE 1.2"`).
|
|
42
|
+
* Two-decimal precision matches what most ΔE engines emit and what
|
|
43
|
+
* print shops quote.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export function formatDeltaE(deltaE) {
|
|
48
|
+
return `ΔE ${deltaE.toFixed(2)}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Pure helper — quickly checks whether a query has at least one
|
|
52
|
+
* color-space populated. Exported so hosts that drive the loader
|
|
53
|
+
* from outside the panel can gate their fetch on the same predicate.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export function isQueryReady(query) {
|
|
58
|
+
return Boolean(query.cmyk || query.lab || query.hex?.trim());
|
|
59
|
+
}
|
|
60
|
+
const DELTA_E_COLORS = {
|
|
61
|
+
imperceptible: "#080",
|
|
62
|
+
noticeable: "#0a8",
|
|
63
|
+
fair: "#a60",
|
|
64
|
+
poor: "#a00",
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Stateful panel — accepts a CMYK or hex input, calls the host
|
|
68
|
+
* loader, and surfaces ranked matches with ΔE chips. Hosts wire
|
|
69
|
+
* `onSelect` to push the picked spot into the active object's fill
|
|
70
|
+
* / stroke or into the separations registry.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export function SmartSpotMatchPanel({ loader, initialQuery, limit, onSelect, }) {
|
|
75
|
+
const [hex, setHex] = useState(initialQuery?.hex ?? "");
|
|
76
|
+
const [matches, setMatches] = useState(null);
|
|
77
|
+
const [error, setError] = useState(null);
|
|
78
|
+
const [loading, setLoading] = useState(false);
|
|
79
|
+
// Keep the hex input in lockstep with `initialQuery.hex` when the
|
|
80
|
+
// host swaps the active selection — without this, a panel reused
|
|
81
|
+
// for a different object would mix new cmyk / lab with the old
|
|
82
|
+
// hex value in the input.
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
setHex(initialQuery?.hex ?? "");
|
|
85
|
+
}, [initialQuery?.hex]);
|
|
86
|
+
// Stable query object — re-derived only when content changes, not
|
|
87
|
+
// when a parent re-render hands back a referentially-different
|
|
88
|
+
// but content-identical `initialQuery`. The join'd keys identity-
|
|
89
|
+
// compare on content; the raw refs are read inside but excluded
|
|
90
|
+
// from the dep list intentionally.
|
|
91
|
+
const cmykKey = initialQuery?.cmyk?.join(",") ?? "";
|
|
92
|
+
const labKey = initialQuery?.lab?.join(",") ?? "";
|
|
93
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: cmyk / lab are content-keyed via cmykKey / labKey
|
|
94
|
+
const query = useMemo(() => ({
|
|
95
|
+
...(hex.trim() && { hex: hex.trim() }),
|
|
96
|
+
...(initialQuery?.cmyk && { cmyk: initialQuery.cmyk }),
|
|
97
|
+
...(initialQuery?.lab && { lab: initialQuery.lab }),
|
|
98
|
+
...(limit !== undefined && { limit }),
|
|
99
|
+
}), [hex, cmykKey, labKey, limit]);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (!isQueryReady(query)) {
|
|
102
|
+
setMatches(null);
|
|
103
|
+
setError(null);
|
|
104
|
+
setLoading(false);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
let disposed = false;
|
|
108
|
+
setLoading(true);
|
|
109
|
+
setError(null);
|
|
110
|
+
// Drop the previous result eagerly so stale rows can't be
|
|
111
|
+
// selected for a query that's no longer current.
|
|
112
|
+
setMatches(null);
|
|
113
|
+
void (async () => {
|
|
114
|
+
try {
|
|
115
|
+
const next = await loader(query);
|
|
116
|
+
if (disposed)
|
|
117
|
+
return;
|
|
118
|
+
setMatches(sortMatchesByDeltaE(next));
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
if (disposed)
|
|
122
|
+
return;
|
|
123
|
+
setMatches(null);
|
|
124
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
if (!disposed)
|
|
128
|
+
setLoading(false);
|
|
129
|
+
}
|
|
130
|
+
})();
|
|
131
|
+
return () => {
|
|
132
|
+
disposed = true;
|
|
133
|
+
};
|
|
134
|
+
}, [loader, query]);
|
|
135
|
+
return (_jsxs("div", { "data-testid": "smart-spot-match-panel", style: { padding: "0.5rem" }, children: [_jsx("header", { style: { marginBottom: "0.5rem" }, children: _jsx("h3", { style: { margin: 0, fontSize: "0.875rem" }, children: "Find PANTONE match" }) }), _jsxs("label", { style: { display: "block", fontSize: "0.75rem", marginBottom: "0.5rem" }, children: ["sRGB hex", _jsx("input", { type: "text", "aria-label": "sRGB hex", placeholder: "#ff5102", value: hex, onChange: (e) => setHex(e.target.value), style: { display: "block", marginTop: "0.125rem", width: "100%" } })] }), loading && _jsx("div", { style: { opacity: 0.6, fontSize: "0.75rem" }, children: "Searching\u2026" }), error && (_jsxs("div", { role: "alert", style: { color: "#a00", fontSize: "0.75rem" }, children: ["Couldn't fetch matches: ", error] })), matches && matches.length === 0 && !loading && !error && (_jsx("div", { style: { opacity: 0.6, fontSize: "0.75rem" }, children: "No matches." })), matches && matches.length > 0 && (_jsx("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: matches.map((match) => (_jsx(SmartSpotMatchRow, { match: match, onSelect: onSelect }, `${match.spot.library ?? "-"}|${match.spot.name}`))) }))] }));
|
|
136
|
+
}
|
|
137
|
+
function SmartSpotMatchRow({ match, onSelect, }) {
|
|
138
|
+
const quality = deltaEQuality(match.deltaE);
|
|
139
|
+
const chipColor = DELTA_E_COLORS[quality];
|
|
140
|
+
const rowContents = (_jsxs(_Fragment, { children: [_jsx("span", { style: { flex: 1, fontSize: "0.8125rem" }, children: match.spot.name }), _jsx("span", { "aria-label": `${formatDeltaE(match.deltaE)} — ${quality}`, style: {
|
|
141
|
+
fontSize: "0.6875rem",
|
|
142
|
+
padding: "0.0625rem 0.375rem",
|
|
143
|
+
borderRadius: 999,
|
|
144
|
+
background: chipColor,
|
|
145
|
+
color: "#fff",
|
|
146
|
+
}, children: formatDeltaE(match.deltaE) })] }));
|
|
147
|
+
const rowStyle = {
|
|
148
|
+
display: "flex",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
gap: "0.5rem",
|
|
151
|
+
width: "100%",
|
|
152
|
+
padding: "0.25rem 0.5rem",
|
|
153
|
+
border: "1px solid transparent",
|
|
154
|
+
borderRadius: 4,
|
|
155
|
+
textAlign: "left",
|
|
156
|
+
};
|
|
157
|
+
return (_jsx("li", { children: onSelect ? (_jsx("button", { type: "button", onClick: () => onSelect(match), style: { ...rowStyle, cursor: "pointer", background: "transparent" }, "aria-label": match.spot.name, children: rowContents })) : (_jsx("div", { style: rowStyle, children: rowContents })) }));
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=SmartSpotMatchPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartSpotMatchPanel.js","sourceRoot":"","sources":["../../src/components/SmartSpotMatchPanel.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAsBb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA2ErD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,OAAO,CAAC,GAAG,OAAO,CAAC;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SACzB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACpD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAYD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1D,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,eAAe,CAAC;IACvC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,YAAY,CAAC;IACpC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9B,OAAO,MA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