@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.
- package/LICENSE +62 -0
- 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 +18 -3
- package/dist/components/EditorApp.d.ts.map +1 -1
- package/dist/components/EditorApp.js +42 -7
- package/dist/components/EditorApp.js.map +1 -1
- package/dist/components/EditorCanvas.d.ts +31 -2
- package/dist/components/EditorCanvas.d.ts.map +1 -1
- package/dist/components/EditorCanvas.js +97 -16
- 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.map +1 -1
- package/dist/components/PageNavigator.js +6 -1
- package/dist/components/PageNavigator.js.map +1 -1
- 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/StreamingRenderProgress.d.ts +60 -0
- package/dist/components/StreamingRenderProgress.d.ts.map +1 -0
- package/dist/components/StreamingRenderProgress.js +99 -0
- package/dist/components/StreamingRenderProgress.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/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 +51 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/dist/lens/preflight-findings.d.ts.map +1 -1
- package/dist/lens/preflight-findings.js.map +1 -1
- 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 +87 -0
- package/dist/lib/dieline-template.d.ts.map +1 -1
- package/dist/lib/dieline-template.js +163 -0
- package/dist/lib/dieline-template.js.map +1 -1
- package/dist/lib/editor-config.d.ts +390 -0
- package/dist/lib/editor-config.d.ts.map +1 -1
- package/dist/lib/editor-config.js +90 -0
- 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 +50 -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/streaming-render.d.ts +100 -0
- package/dist/lib/streaming-render.d.ts.map +1 -0
- package/dist/lib/streaming-render.js +132 -0
- package/dist/lib/streaming-render.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 +20 -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 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationOverlay.js","sourceRoot":"","sources":["../../src/components/AnnotationOverlay.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AA+Gb;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;4BAE4B;AAC5B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,SAAS;IACzB,cAAc,EAAE,SAAS;CACjB,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAuC;IACxE,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UA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C,CAAC,CAAC,CAAC,CAAC,CAAC,EAC7B,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,GACxD,GACA,CACL,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC;IAC9C,OAAO,CACL,4BACe,cAAc,UAAU,CAAC,EAAE,EAAE,EAC1C,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,EACxC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,KAChB,gBAAgB,aAEpB,iBACE,EAAE,EAAE,UAAU,CAAC,CAAC,EAChB,EAAE,EAAE,UAAU,CAAC,CAAC,EAChB,CAAC,EAAE,gBAAgB,EACnB,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,EAChD,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC7B,EAKD,UAAU,IAAI;YACb,uSAAuS;YACvS,eACE,CAAC,EAAE,UAAU,CAAC,CAAC,EACf,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,EACnB,UAAU,EAAC,QAAQ,EACnB,QAAQ,EAAC,GAAG,EACZ,UAAU,EAAC,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,cAAc,iBACf,MAAM,kBAGb,CACR,IACC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wave 4 X1 — Annotations sidebar.
|
|
3
|
+
*
|
|
4
|
+
* Companion list view to the X3 {@link AnnotationOverlay} (Wave 4
|
|
5
|
+
* PR-7). The overlay renders annotation anchors on top of the canvas;
|
|
6
|
+
* this sidebar surfaces the same {@link AnnotationOverlayAnnotation}
|
|
7
|
+
* stream as a scrollable, filterable list so reviewers can read the
|
|
8
|
+
* thread without hunting for pins.
|
|
9
|
+
*
|
|
10
|
+
* Controlled component: hosts pass `annotations` + the active id (the
|
|
11
|
+
* same one wired into the overlay's `activeAnnotationId`), the sidebar
|
|
12
|
+
* emits selection / resolve / delete callbacks. The host is the source
|
|
13
|
+
* of truth — the sidebar never mutates the array.
|
|
14
|
+
*
|
|
15
|
+
* Two pure helpers ship alongside:
|
|
16
|
+
* - {@link filterAnnotationsForSidebar} — status / author predicates.
|
|
17
|
+
* - {@link sortAnnotationsByDate} — chronological / reverse-chronological.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
import type { ReactElement } from "react";
|
|
22
|
+
import type { AnnotationOverlayAnnotation } from "./AnnotationOverlay";
|
|
23
|
+
/**
|
|
24
|
+
* Status filter the sidebar pivots on. `"all"` shows both open and
|
|
25
|
+
* resolved annotations; the other two narrow to a single set.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export type AnnotationStatusFilter = "open" | "resolved" | "all";
|
|
30
|
+
/**
|
|
31
|
+
* Filter spec accepted by {@link filterAnnotationsForSidebar}.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export type AnnotationsSidebarFilter = {
|
|
36
|
+
/** Status to keep — see {@link AnnotationStatusFilter}. Absent →
|
|
37
|
+
* treated as `"all"`. */
|
|
38
|
+
status?: AnnotationStatusFilter;
|
|
39
|
+
/** Case-insensitive substring filter on `author`. Whitespace-only
|
|
40
|
+
* values are treated as absent so a stray space doesn't blank the
|
|
41
|
+
* list. */
|
|
42
|
+
author?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Configuration for the {@link AnnotationsSidebar}. The host owns
|
|
46
|
+
* the annotation store and the active-id state; the sidebar only
|
|
47
|
+
* renders and emits user intents (select / resolve-toggle / delete)
|
|
48
|
+
* through the optional callbacks. The `annotations` array is treated
|
|
49
|
+
* as immutable — the sidebar never writes back to it.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export type AnnotationsSidebarProps = {
|
|
54
|
+
/** Annotations to render. Typically `PageV3.annotations ?? []`. The
|
|
55
|
+
* sidebar never mutates this array. */
|
|
56
|
+
annotations: readonly AnnotationOverlayAnnotation[];
|
|
57
|
+
/** Id of the active annotation — the matching row renders in the
|
|
58
|
+
* "active" style. Hosts typically wire this from the overlay's
|
|
59
|
+
* `activeAnnotationId` so the two surfaces stay in lockstep. */
|
|
60
|
+
activeAnnotationId?: string;
|
|
61
|
+
/** Optional initial status filter. Defaults to `"open"` so the
|
|
62
|
+
* sidebar opens on actionable comments. */
|
|
63
|
+
defaultStatus?: AnnotationStatusFilter;
|
|
64
|
+
/** Fired when the user clicks a row. */
|
|
65
|
+
onSelect?: (annotation: AnnotationOverlayAnnotation) => void;
|
|
66
|
+
/** Fired when the user clicks the "Resolve" / "Reopen" toggle on
|
|
67
|
+
* a row. The host writes the flipped `resolved` flag back to its
|
|
68
|
+
* annotation store. */
|
|
69
|
+
onToggleResolved?: (annotation: AnnotationOverlayAnnotation) => void;
|
|
70
|
+
/** Fired when the user clicks the "Delete" affordance. The host
|
|
71
|
+
* decides whether to remove the annotation or move it to a trash
|
|
72
|
+
* bucket. */
|
|
73
|
+
onDelete?: (annotation: AnnotationOverlayAnnotation) => void;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Pure helper — filters annotations by status / author. Returns a
|
|
77
|
+
* new array; preserves input order. Pure function.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export declare function filterAnnotationsForSidebar(annotations: readonly AnnotationOverlayAnnotation[], filter: AnnotationsSidebarFilter): readonly AnnotationOverlayAnnotation[];
|
|
82
|
+
/**
|
|
83
|
+
* Pure helper — sorts annotations by `createdAt` (ISO 8601 strings
|
|
84
|
+
* compare lexicographically). Returns a new array; non-mutating.
|
|
85
|
+
* `"desc"` (newest first) is the convention for review surfaces.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
export declare function sortAnnotationsByDate(annotations: readonly AnnotationOverlayAnnotation[], direction?: "asc" | "desc"): readonly AnnotationOverlayAnnotation[];
|
|
90
|
+
/**
|
|
91
|
+
* Stateful panel — surfaces a status dropdown + an author search and
|
|
92
|
+
* renders the filtered, date-sorted annotation list. Emits the host
|
|
93
|
+
* callbacks on row select / resolve-toggle / delete.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export declare function AnnotationsSidebar({ annotations, activeAnnotationId, defaultStatus, onSelect, onToggleResolved, onDelete, }: AnnotationsSidebarProps): ReactElement;
|
|
98
|
+
//# sourceMappingURL=AnnotationsSidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationsSidebar.d.ts","sourceRoot":"","sources":["../../src/components/AnnotationsSidebar.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAGvE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;8BAC0B;IAC1B,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC;;gBAEY;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;4CACwC;IACxC,WAAW,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACpD;;qEAEiE;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;gDAC4C;IAC5C,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,IAAI,CAAC;IAC7D;;4BAEwB;IACxB,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACrE;;kBAEc;IACd,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,SAAS,2BAA2B,EAAE,EACnD,MAAM,EAAE,wBAAwB,GAC/B,SAAS,2BAA2B,EAAE,CAYxC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,SAAS,2BAA2B,EAAE,EACnD,SAAS,GAAE,KAAK,GAAG,MAAe,GACjC,SAAS,2BAA2B,EAAE,CAsBxC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,QAAQ,GACT,EAAE,uBAAuB,GAAG,YAAY,CA4DxC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
import { describeAnnotation } from "./AnnotationOverlay";
|
|
6
|
+
/**
|
|
7
|
+
* Pure helper — filters annotations by status / author. Returns a
|
|
8
|
+
* new array; preserves input order. Pure function.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export function filterAnnotationsForSidebar(annotations, filter) {
|
|
13
|
+
const status = filter.status ?? "all";
|
|
14
|
+
const trimmedAuthor = filter.author?.trim().toLowerCase() ?? "";
|
|
15
|
+
return annotations.filter((a) => {
|
|
16
|
+
if (status === "open" && a.resolved === true)
|
|
17
|
+
return false;
|
|
18
|
+
if (status === "resolved" && a.resolved !== true)
|
|
19
|
+
return false;
|
|
20
|
+
if (trimmedAuthor) {
|
|
21
|
+
const author = (a.author ?? "").toLowerCase();
|
|
22
|
+
if (!author.includes(trimmedAuthor))
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Pure helper — sorts annotations by `createdAt` (ISO 8601 strings
|
|
30
|
+
* compare lexicographically). Returns a new array; non-mutating.
|
|
31
|
+
* `"desc"` (newest first) is the convention for review surfaces.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export function sortAnnotationsByDate(annotations, direction = "desc") {
|
|
36
|
+
// Empty / missing createdAt is treated as sorting *after* anything
|
|
37
|
+
// valid in descending mode (and *before* anything valid in ascending
|
|
38
|
+
// mode) so a malformed entry surfaces at the tail of the review
|
|
39
|
+
// pile rather than silently breaking the sort.
|
|
40
|
+
const out = [...annotations];
|
|
41
|
+
out.sort((a, b) => {
|
|
42
|
+
const aHas = typeof a.createdAt === "string" && a.createdAt.length > 0;
|
|
43
|
+
const bHas = typeof b.createdAt === "string" && b.createdAt.length > 0;
|
|
44
|
+
if (!aHas && !bHas)
|
|
45
|
+
return 0;
|
|
46
|
+
if (!aHas)
|
|
47
|
+
return direction === "desc" ? 1 : -1;
|
|
48
|
+
if (!bHas)
|
|
49
|
+
return direction === "desc" ? -1 : 1;
|
|
50
|
+
if (a.createdAt === b.createdAt)
|
|
51
|
+
return 0;
|
|
52
|
+
return direction === "desc"
|
|
53
|
+
? a.createdAt < b.createdAt
|
|
54
|
+
? 1
|
|
55
|
+
: -1
|
|
56
|
+
: a.createdAt < b.createdAt
|
|
57
|
+
? -1
|
|
58
|
+
: 1;
|
|
59
|
+
});
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Stateful panel — surfaces a status dropdown + an author search and
|
|
64
|
+
* renders the filtered, date-sorted annotation list. Emits the host
|
|
65
|
+
* callbacks on row select / resolve-toggle / delete.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export function AnnotationsSidebar({ annotations, activeAnnotationId, defaultStatus, onSelect, onToggleResolved, onDelete, }) {
|
|
70
|
+
const [status, setStatus] = useState(defaultStatus ?? "open");
|
|
71
|
+
const [authorQuery, setAuthorQuery] = useState("");
|
|
72
|
+
const visible = useMemo(() => {
|
|
73
|
+
const filtered = filterAnnotationsForSidebar(annotations, {
|
|
74
|
+
status,
|
|
75
|
+
author: authorQuery,
|
|
76
|
+
});
|
|
77
|
+
return sortAnnotationsByDate(filtered, "desc");
|
|
78
|
+
}, [annotations, status, authorQuery]);
|
|
79
|
+
return (_jsxs("div", { "data-testid": "annotations-sidebar", style: { padding: "0.5rem" }, children: [_jsxs("header", { style: { marginBottom: "0.5rem" }, children: [_jsxs("h3", { style: { margin: 0, fontSize: "0.875rem" }, children: ["Annotations (", visible.length, ")"] }), _jsxs("div", { style: { display: "flex", gap: "0.5rem", marginTop: "0.25rem", alignItems: "center" }, children: [_jsxs("label", { style: { fontSize: "0.75rem" }, children: ["Status", _jsxs("select", { "aria-label": "Status", value: status, onChange: (e) => setStatus(e.target.value), style: { marginLeft: "0.25rem", fontSize: "0.75rem" }, children: [_jsx("option", { value: "open", children: "Open" }), _jsx("option", { value: "resolved", children: "Resolved" }), _jsx("option", { value: "all", children: "All" })] })] }), _jsx("input", { type: "search", "aria-label": "Author", placeholder: "Filter by author", value: authorQuery, onChange: (e) => setAuthorQuery(e.target.value), style: { flex: 1, fontSize: "0.75rem", padding: "0.125rem 0.25rem" } })] })] }), visible.length === 0 ? (_jsx("div", { "data-testid": "annotations-sidebar-empty", style: { opacity: 0.6, fontSize: "0.875rem" }, children: "No annotations match the current filter." })) : (_jsx("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: visible.map((annotation) => (_jsx(AnnotationRow, { annotation: annotation, isActive: annotation.id === activeAnnotationId, onSelect: onSelect, onToggleResolved: onToggleResolved, onDelete: onDelete }, annotation.id))) }))] }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Renders one annotation row. Intra-package helper — the row's
|
|
83
|
+
* surface (kind badge + author + body + resolve / delete buttons) is
|
|
84
|
+
* intentionally minimal so {@link AnnotationsSidebar} can swap it
|
|
85
|
+
* without downstream consumers depending on the shape.
|
|
86
|
+
*/
|
|
87
|
+
function AnnotationRow({ annotation, isActive, onSelect, onToggleResolved, onDelete, }) {
|
|
88
|
+
const resolved = annotation.resolved === true;
|
|
89
|
+
return (_jsx("li", { "data-testid": `annotations-sidebar-row-${annotation.id}`, style: {
|
|
90
|
+
padding: "0.375rem 0.5rem",
|
|
91
|
+
border: `1px solid ${isActive ? "#2563eb" : "#ddd"}`,
|
|
92
|
+
borderRadius: 4,
|
|
93
|
+
background: isActive ? "#e0ecff" : "transparent",
|
|
94
|
+
marginBottom: "0.25rem",
|
|
95
|
+
opacity: resolved ? 0.6 : 1,
|
|
96
|
+
}, children: _jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "flex-start" }, children: [_jsxs("div", { style: { flex: 1 }, children: [_jsx("div", { style: { fontSize: "0.8125rem", fontWeight: 500 }, children: describeAnnotation(annotation) }), _jsx("div", { style: { fontSize: "0.6875rem", color: "#595959", marginTop: "0.125rem" }, children: annotation.author
|
|
97
|
+
? `${annotation.author} · ${annotation.createdAt}`
|
|
98
|
+
: annotation.createdAt })] }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.125rem" }, children: [onSelect && (_jsx("button", { type: "button", onClick: () => onSelect(annotation), style: { fontSize: "0.6875rem", padding: "0.0625rem 0.375rem" }, children: "Focus" })), onToggleResolved && (_jsx("button", { type: "button", onClick: () => onToggleResolved(annotation), style: { fontSize: "0.6875rem", padding: "0.0625rem 0.375rem" }, children: resolved ? "Reopen" : "Resolve" })), onDelete && (_jsx("button", { type: "button", onClick: () => onDelete(annotation), style: { fontSize: "0.6875rem", padding: "0.0625rem 0.375rem", color: "#a00" }, children: "Delete" }))] })] }) }));
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=AnnotationsSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationsSidebar.js","sourceRoot":"","sources":["../../src/components/AnnotationsSidebar.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAwBb,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAyDzD;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,WAAmD,EACnD,MAAgC;IAEhC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC;IACtC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAChE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9B,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC3D,IAAI,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC/D,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;YAC9C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC;gBAAE,OAAO,KAAK,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,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AAC,EAC3C,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,YAE9D,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GACzB,CACV,EACA,QAAQ,IAAI,CACX,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EACnC,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,EAAE,uBAGvE,CACV,IACG,IACF,GACH,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type BarcodeFormat } from "../lib/barcode-scan";
|
|
2
|
+
/**
|
|
3
|
+
* Result returned by a {@link BarcodeRenderFn}. `bitmap` is an
|
|
4
|
+
* ImageData the host paints onto the canvas; `widthMm` / `heightMm`
|
|
5
|
+
* tell the host how big to place it.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type BarcodeRenderResult = {
|
|
10
|
+
bitmap: ImageData;
|
|
11
|
+
widthMm: number;
|
|
12
|
+
heightMm: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Host-supplied renderer. Takes a format + payload + optional
|
|
16
|
+
* sizing hints and returns the bitmap. Rejects on invalid payload
|
|
17
|
+
* (host-side check-digit / GS1 AI sequence validation) or
|
|
18
|
+
* transport errors when the renderer is server-backed; the panel
|
|
19
|
+
* surfaces the message inline.
|
|
20
|
+
*
|
|
21
|
+
* **Identity matters.** The panel does not memoize `renderer`; if
|
|
22
|
+
* the host builds the adapter inline it should wrap with
|
|
23
|
+
* `useCallback` so the panel doesn't refire the renderer on every
|
|
24
|
+
* parent re-render.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export type BarcodeRenderFn = (input: {
|
|
29
|
+
format: BarcodeFormat;
|
|
30
|
+
payload: string;
|
|
31
|
+
widthMm?: number;
|
|
32
|
+
heightMm?: number;
|
|
33
|
+
}) => Promise<BarcodeRenderResult>;
|
|
34
|
+
/**
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export type BarcodeGeneratorPanelProps = {
|
|
38
|
+
/** Renderer the panel calls on "Generate". */
|
|
39
|
+
renderer: BarcodeRenderFn;
|
|
40
|
+
/** Fired with the rendered bitmap so the host can place it on the canvas. */
|
|
41
|
+
onRendered: (result: BarcodeRenderResult) => void;
|
|
42
|
+
/** Restrict the format dropdown to a subset; defaults to every
|
|
43
|
+
* format supported by {@link BarcodeFormat}. */
|
|
44
|
+
allowedFormats?: readonly BarcodeFormat[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Interactive barcode generation panel. Users pick a format from the
|
|
48
|
+
* dropdown, type the payload, optionally constrain the physical
|
|
49
|
+
* dimensions in millimetres, and click **Generate**. The panel calls
|
|
50
|
+
* the host-supplied `renderer` adapter and emits the resulting
|
|
51
|
+
* bitmap via `onRendered`; the host then places it on the canvas as
|
|
52
|
+
* a `CanvasObj`. Renderer rejections surface inline in an `alert`
|
|
53
|
+
* region — the panel never throws to the host.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export declare function BarcodeGeneratorPanel({ renderer, onRendered, allowedFormats, }: BarcodeGeneratorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
//# sourceMappingURL=BarcodeGeneratorPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarcodeGeneratorPanel.d.ts","sourceRoot":"","sources":["../../src/components/BarcodeGeneratorPanel.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,8CAA8C;IAC9C,QAAQ,EAAE,eAAe,CAAC;IAC1B,6EAA6E;IAC7E,UAAU,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD;qDACiD;IACjD,cAAc,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,UAAU,EACV,cAAc,GACf,EAAE,0BAA0B,2CAqH5B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Wave 3 G2g — Barcode generator panel.
|
|
6
|
+
*
|
|
7
|
+
* Companion to the Wave 1 G2v {@link import("../lib/barcode-scan").scanBarcodes}
|
|
8
|
+
* + {@link import("../lib/barcode-scan").validateBarcode} surface. G2v
|
|
9
|
+
* inspects barcodes the user has already placed on the canvas; G2g
|
|
10
|
+
* lets the user *generate* a new one — they pick a format, type the
|
|
11
|
+
* payload, and the host's `renderer` adapter resolves the bitmap.
|
|
12
|
+
* The panel emits the rendered bitmap via `onRendered` so the host
|
|
13
|
+
* places it as a `CanvasObj`.
|
|
14
|
+
*
|
|
15
|
+
* Adapter pattern (matches Wave 2 PR-6 / PR-8 components): hosts
|
|
16
|
+
* wire the rendering backend themselves. This keeps the editor
|
|
17
|
+
* package free of a runtime dep on a specific barcode library and
|
|
18
|
+
* lets server-side renderers (compile-pdf, codex-pdf) be the
|
|
19
|
+
* canonical source of truth when the host prefers PDF/X-4 exact
|
|
20
|
+
* vector output over a client-rendered raster.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
import { useState } from "react";
|
|
25
|
+
import { ALL_BARCODE_FORMATS } from "../lib/barcode-scan";
|
|
26
|
+
/**
|
|
27
|
+
* Interactive barcode generation panel. Users pick a format from the
|
|
28
|
+
* dropdown, type the payload, optionally constrain the physical
|
|
29
|
+
* dimensions in millimetres, and click **Generate**. The panel calls
|
|
30
|
+
* the host-supplied `renderer` adapter and emits the resulting
|
|
31
|
+
* bitmap via `onRendered`; the host then places it on the canvas as
|
|
32
|
+
* a `CanvasObj`. Renderer rejections surface inline in an `alert`
|
|
33
|
+
* region — the panel never throws to the host.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export function BarcodeGeneratorPanel({ renderer, onRendered, allowedFormats, }) {
|
|
38
|
+
// Fall back to the full format list when the host passes `undefined`
|
|
39
|
+
// *or* an empty array. An empty array would otherwise render a
|
|
40
|
+
// select with no options against a still-valid `format` state, which
|
|
41
|
+
// confuses both keyboard users and the host's `onRendered` flow.
|
|
42
|
+
const formats = allowedFormats && allowedFormats.length > 0 ? allowedFormats : ALL_BARCODE_FORMATS;
|
|
43
|
+
const [format, setFormat] = useState(formats[0] ?? "EAN-13");
|
|
44
|
+
const [payload, setPayload] = useState("");
|
|
45
|
+
const [widthMm, setWidthMm] = useState(undefined);
|
|
46
|
+
const [heightMm, setHeightMm] = useState(undefined);
|
|
47
|
+
const [busy, setBusy] = useState(false);
|
|
48
|
+
const [error, setError] = useState(null);
|
|
49
|
+
async function handleGenerate() {
|
|
50
|
+
if (!payload.trim()) {
|
|
51
|
+
setError("Payload is required.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setBusy(true);
|
|
55
|
+
setError(null);
|
|
56
|
+
try {
|
|
57
|
+
const result = await renderer({
|
|
58
|
+
format,
|
|
59
|
+
payload: payload.trim(),
|
|
60
|
+
...(widthMm !== undefined && { widthMm }),
|
|
61
|
+
...(heightMm !== undefined && { heightMm }),
|
|
62
|
+
});
|
|
63
|
+
onRendered(result);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
setBusy(false);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return (_jsxs("div", { "data-testid": "barcode-generator-panel", style: { padding: "0.5rem" }, children: [_jsx("h3", { style: { margin: "0 0 0.5rem 0" }, children: "Generate barcode" }), _jsxs("label", { style: { display: "block", marginBottom: "0.5rem" }, children: ["Format", _jsx("select", { value: format, onChange: (e) => setFormat(e.target.value), style: { marginLeft: "0.5rem" }, children: formats.map((f) => (_jsx("option", { value: f, children: f }, f))) })] }), _jsxs("label", { style: { display: "block", marginBottom: "0.5rem" }, children: ["Payload", _jsx("input", { type: "text", value: payload, onChange: (e) => setPayload(e.target.value), "aria-label": "Barcode payload", style: { marginLeft: "0.5rem", width: "20em" } })] }), _jsxs("label", { style: { display: "block", marginBottom: "0.5rem" }, children: ["Width (mm, optional)", _jsx("input", { type: "number", min: "0", step: "0.1", value: widthMm ?? "", onChange: (e) => {
|
|
73
|
+
// Empty input clears the hint — the renderer falls back
|
|
74
|
+
// to its default sizing, which is format-dependent (EAN-13
|
|
75
|
+
// = 37.29 × 25.93 mm at 100% magnification, GS1-128 is
|
|
76
|
+
// payload-length-dependent, etc.). Don't pin a number
|
|
77
|
+
// here because the panel doesn't know which renderer
|
|
78
|
+
// backend is wired. The NaN guard catches paste / a11y
|
|
79
|
+
// tool / programmatic-DOM cases where `type="number"`
|
|
80
|
+
// browser validation is bypassed and a non-numeric string
|
|
81
|
+
// reaches `Number()`.
|
|
82
|
+
const v = e.target.value;
|
|
83
|
+
const num = Number(v);
|
|
84
|
+
setWidthMm(v === "" || Number.isNaN(num) ? undefined : num);
|
|
85
|
+
}, style: { marginLeft: "0.5rem" } })] }), _jsxs("label", { style: { display: "block", marginBottom: "0.5rem" }, children: ["Height (mm, optional)", _jsx("input", { type: "number", min: "0", step: "0.1", value: heightMm ?? "", onChange: (e) => {
|
|
86
|
+
const v = e.target.value;
|
|
87
|
+
const num = Number(v);
|
|
88
|
+
setHeightMm(v === "" || Number.isNaN(num) ? undefined : num);
|
|
89
|
+
}, style: { marginLeft: "0.5rem" } })] }), _jsx("button", { type: "button", onClick: handleGenerate, disabled: busy, style: { padding: "0.4rem 0.8rem" }, children: busy ? "Generating…" : "Generate" }), error && (_jsx("div", { role: "alert", style: { marginTop: "0.5rem", color: "#a00" }, children: error }))] }));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=BarcodeGeneratorPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarcodeGeneratorPanel.js","sourceRoot":"","sources":["../../src/components/BarcodeGeneratorPanel.tsx"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;;AAEb;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAsB,MAAM,qBAAqB,CAAC;AAiD9E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,UAAU,EACV,cAAc,GACa;IAC3B,qEAAqE;IACrE,+DAA+D;IAC/D,qEAAqE;IACrE,iEAAiE;IACjE,MAAM,OAAO,GACX,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC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K,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,YAC5D,KAAK,GACF,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marburg Medium dot-geometry defaults (EN 15823). Re-exported so
|
|
3
|
+
* server-side renderers can use the same constants for compliance
|
|
4
|
+
* checks. Values are in millimetres.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const MARBURG_MEDIUM: {
|
|
9
|
+
readonly dotHeightMm: 0.2;
|
|
10
|
+
readonly dotBaseDiameterMm: 1.44;
|
|
11
|
+
readonly dotSpacingMm: 2.5;
|
|
12
|
+
readonly cellWidthMm: 6;
|
|
13
|
+
readonly charSpacingMm: 5;
|
|
14
|
+
readonly lineSpacingMm: 10;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* One Braille cell — six (or eight) dot booleans plus its x/y
|
|
18
|
+
* position in millimetres (relative to the panel's origin). Hosts
|
|
19
|
+
* render each dot as a vector ellipse / dome at the configured
|
|
20
|
+
* height + base diameter.
|
|
21
|
+
*
|
|
22
|
+
* Dot indices follow the canonical numbering:
|
|
23
|
+
* ```
|
|
24
|
+
* 1 4
|
|
25
|
+
* 2 5
|
|
26
|
+
* 3 6
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export type BrailleCell = {
|
|
32
|
+
char: string;
|
|
33
|
+
xMm: number;
|
|
34
|
+
yMm: number;
|
|
35
|
+
dots: readonly [boolean, boolean, boolean, boolean, boolean, boolean];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Result returned by {@link composeBraille}. `cells` is the placed
|
|
39
|
+
* cell list; `unicode` is the equivalent Unicode Braille string
|
|
40
|
+
* (U+28xx codepoints), useful for accessibility tools that already
|
|
41
|
+
* speak Braille; `unsupportedChars` lists any source characters the
|
|
42
|
+
* transliterator dropped so the host can warn the user.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export type BrailleComposeResult = {
|
|
47
|
+
cells: BrailleCell[];
|
|
48
|
+
unicode: string;
|
|
49
|
+
unsupportedChars: string[];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Transliterate a Grade 1 English string into placed Braille cells.
|
|
53
|
+
* The function only covers letters, digits, and a small set of
|
|
54
|
+
* common punctuation; unsupported characters are dropped and
|
|
55
|
+
* surfaced via `unsupportedChars` so the host can warn the user.
|
|
56
|
+
*
|
|
57
|
+
* Cells are laid out left-to-right at `charSpacingMm` intervals on
|
|
58
|
+
* a single line, all at `y = 0`. Multi-line layout is the host's
|
|
59
|
+
* responsibility (it can chunk the input on `\n` and translate each
|
|
60
|
+
* line separately).
|
|
61
|
+
*
|
|
62
|
+
* Pure function — exported so RSC / Astro-frontmatter callers can
|
|
63
|
+
* pre-compute placement.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export declare function composeBraille(input: {
|
|
68
|
+
text: string;
|
|
69
|
+
charSpacingMm?: number;
|
|
70
|
+
}): BrailleComposeResult;
|
|
71
|
+
/**
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export type BraillePanelProps = {
|
|
75
|
+
/** Fired when the user clicks "Compose" with the placed cells +
|
|
76
|
+
* Unicode + unsupported-char report. The host renders the cells
|
|
77
|
+
* as vector ellipses on the canvas. */
|
|
78
|
+
onCompose: (result: BrailleComposeResult) => void;
|
|
79
|
+
/** Initial text seeded into the form. Defaults to the empty
|
|
80
|
+
* string. */
|
|
81
|
+
initialText?: string;
|
|
82
|
+
/** Initial character-spacing override; defaults to the Marburg
|
|
83
|
+
* Medium constant. */
|
|
84
|
+
initialCharSpacingMm?: number;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Braille layout panel. The user types the source text, optionally
|
|
88
|
+
* tweaks character spacing for non-standard substrates, and clicks
|
|
89
|
+
* **Compose**; the host receives the placed cells.
|
|
90
|
+
*
|
|
91
|
+
* The panel does not render the Braille itself — preview is the
|
|
92
|
+
* host's responsibility because the dot geometry (ellipse vs.
|
|
93
|
+
* spherical dome) and the production process (foil-emboss vs. ink
|
|
94
|
+
* + spot-UV) drive how it should be visualised.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare function BraillePanel({ onCompose, initialText, initialCharSpacingMm, }: BraillePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
99
|
+
//# sourceMappingURL=BraillePanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BraillePanel.d.ts","sourceRoot":"","sources":["../../src/components/BraillePanel.tsx"],"names":[],"mappings":"AAwBA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;CACvE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAoFF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,oBAAoB,CAkEvB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;4CAEwC;IACxC,SAAS,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAClD;kBACc;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;2BACuB;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,WAAgB,EAChB,oBAAmD,GACpD,EAAE,iBAAiB,2CAsDnB"}
|