@embedpdf/plugin-redaction 2.3.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +748 -105
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +25 -1
  6. package/dist/lib/index.d.ts +1 -0
  7. package/dist/lib/redaction-plugin.d.ts +98 -2
  8. package/dist/lib/tools.d.ts +28 -0
  9. package/dist/lib/types.d.ts +38 -11
  10. package/dist/preact/adapter.d.ts +4 -4
  11. package/dist/preact/annotation.d.ts +1 -0
  12. package/dist/preact/index.cjs +1 -1
  13. package/dist/preact/index.cjs.map +1 -1
  14. package/dist/preact/index.js +187 -11
  15. package/dist/preact/index.js.map +1 -1
  16. package/dist/react/annotation.d.ts +1 -0
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.cjs.map +1 -1
  19. package/dist/react/index.js +187 -11
  20. package/dist/react/index.js.map +1 -1
  21. package/dist/shared/components/annotations/index.d.ts +2 -0
  22. package/dist/shared/components/annotations/redact-area.d.ts +18 -0
  23. package/dist/shared/components/annotations/redact-highlight.d.ts +18 -0
  24. package/dist/shared/components/index.d.ts +3 -0
  25. package/dist/shared/components/redact-renderer-registration.d.ts +5 -0
  26. package/dist/shared/components/redact-renderers.d.ts +7 -0
  27. package/dist/shared/index.d.ts +1 -0
  28. package/dist/shared-preact/components/annotations/index.d.ts +2 -0
  29. package/dist/shared-preact/components/annotations/redact-area.d.ts +18 -0
  30. package/dist/shared-preact/components/annotations/redact-highlight.d.ts +18 -0
  31. package/dist/shared-preact/components/index.d.ts +3 -0
  32. package/dist/shared-preact/components/redact-renderer-registration.d.ts +5 -0
  33. package/dist/shared-preact/components/redact-renderers.d.ts +7 -0
  34. package/dist/shared-preact/index.d.ts +1 -0
  35. package/dist/shared-react/components/annotations/index.d.ts +2 -0
  36. package/dist/shared-react/components/annotations/redact-area.d.ts +18 -0
  37. package/dist/shared-react/components/annotations/redact-highlight.d.ts +18 -0
  38. package/dist/shared-react/components/index.d.ts +3 -0
  39. package/dist/shared-react/components/redact-renderer-registration.d.ts +5 -0
  40. package/dist/shared-react/components/redact-renderers.d.ts +7 -0
  41. package/dist/shared-react/index.d.ts +1 -0
  42. package/dist/svelte/components/RedactRendererRegistration.svelte.d.ts +7 -0
  43. package/dist/svelte/components/annotations/RedactArea.svelte.d.ts +5 -0
  44. package/dist/svelte/components/annotations/RedactHighlight.svelte.d.ts +5 -0
  45. package/dist/svelte/components/annotations/index.d.ts +2 -0
  46. package/dist/svelte/components/index.d.ts +3 -0
  47. package/dist/svelte/components/redact-renderers.d.ts +7 -0
  48. package/dist/svelte/index.cjs +1 -1
  49. package/dist/svelte/index.cjs.map +1 -1
  50. package/dist/svelte/index.d.ts +1 -0
  51. package/dist/svelte/index.js +270 -22
  52. package/dist/svelte/index.js.map +1 -1
  53. package/dist/vue/components/annotations/index.d.ts +2 -0
  54. package/dist/vue/components/annotations/redact-area.vue.d.ts +6 -0
  55. package/dist/vue/components/annotations/redact-highlight.vue.d.ts +6 -0
  56. package/dist/vue/components/index.d.ts +3 -0
  57. package/dist/vue/components/redact-renderer-registration.vue.d.ts +13 -0
  58. package/dist/vue/components/redact-renderers.d.ts +7 -0
  59. package/dist/vue/components/types.d.ts +1 -1
  60. package/dist/vue/hooks/use-redaction.d.ts +2 -2
  61. package/dist/vue/index.cjs +1 -1
  62. package/dist/vue/index.cjs.map +1 -1
  63. package/dist/vue/index.d.ts +2 -1
  64. package/dist/vue/index.js +264 -59
  65. package/dist/vue/index.js.map +1 -1
  66. package/package.json +13 -9
@@ -1,10 +1,176 @@
1
- import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/react";
2
- import { RedactionPlugin, initialDocumentState } from "@embedpdf/plugin-redaction";
1
+ import { createPluginPackage } from "@embedpdf/core";
2
+ import { RedactionPlugin, initialDocumentState, RedactionPluginPackage as RedactionPluginPackage$1 } from "@embedpdf/plugin-redaction";
3
3
  export * from "@embedpdf/plugin-redaction";
4
- import { useState, useMemo, useEffect, useCallback, Fragment as Fragment$1 } from "react";
4
+ import { createRenderer, useRegisterRenderers } from "@embedpdf/plugin-annotation/react";
5
5
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
6
+ import { PdfStandardFont, PdfTextAlignment, textAlignmentToCss, standardFontCss, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
7
+ import { useState, useMemo, useEffect, useCallback, Fragment as Fragment$1 } from "react";
8
+ import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/react";
6
9
  import { CounterRotate } from "@embedpdf/utils/react";
7
- import { Rotation } from "@embedpdf/models";
10
+ function RedactHighlight({
11
+ annotation,
12
+ isSelected,
13
+ scale,
14
+ onClick,
15
+ style
16
+ }) {
17
+ const [isHovered, setIsHovered] = useState(false);
18
+ const { object } = annotation;
19
+ const segmentRects = object.segmentRects ?? [];
20
+ const rect = object.rect;
21
+ const strokeColor = object.strokeColor ?? "#FF0000";
22
+ const color = object.color ?? "#000000";
23
+ const opacity = object.opacity ?? 1;
24
+ const textColor = object.fontColor ?? object.overlayColor ?? "#FFFFFF";
25
+ const overlayText = object.overlayText;
26
+ const overlayTextRepeat = object.overlayTextRepeat ?? false;
27
+ const fontSize = object.fontSize ?? 12;
28
+ const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;
29
+ const textAlign = object.textAlign ?? PdfTextAlignment.Center;
30
+ const renderOverlayText = () => {
31
+ if (!overlayText) return null;
32
+ if (!overlayTextRepeat) return overlayText;
33
+ const reps = 10;
34
+ return Array(reps).fill(overlayText).join(" ");
35
+ };
36
+ return /* @__PURE__ */ jsx(
37
+ "div",
38
+ {
39
+ onMouseEnter: () => setIsHovered(true),
40
+ onMouseLeave: () => setIsHovered(false),
41
+ style: { position: "absolute", inset: 0 },
42
+ children: segmentRects.map((b, i) => /* @__PURE__ */ jsx(
43
+ "div",
44
+ {
45
+ onPointerDown: onClick,
46
+ onTouchStart: onClick,
47
+ style: {
48
+ position: "absolute",
49
+ left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,
50
+ top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,
51
+ width: b.size.width * scale,
52
+ height: b.size.height * scale,
53
+ // Default: transparent background with strokeColor (C) border
54
+ // Hovered: color (IC) background fill, no border
55
+ // Selected: no border (container handles it)
56
+ background: isHovered ? color : "transparent",
57
+ border: !isHovered ? `2px solid ${strokeColor}` : "none",
58
+ opacity: isHovered ? opacity : 1,
59
+ boxSizing: "border-box",
60
+ pointerEvents: "auto",
61
+ cursor: "pointer",
62
+ display: "flex",
63
+ alignItems: "center",
64
+ justifyContent: textAlign === PdfTextAlignment.Left ? "flex-start" : textAlign === PdfTextAlignment.Right ? "flex-end" : "center",
65
+ overflow: "hidden",
66
+ ...style
67
+ },
68
+ children: isHovered && overlayText && /* @__PURE__ */ jsx(
69
+ "span",
70
+ {
71
+ style: {
72
+ color: textColor,
73
+ fontSize: Math.min(fontSize * scale, b.size.height * scale * 0.8),
74
+ fontFamily: standardFontCss(fontFamily),
75
+ textAlign: textAlignmentToCss(textAlign),
76
+ whiteSpace: overlayTextRepeat ? "normal" : "nowrap",
77
+ overflow: "hidden",
78
+ textOverflow: "ellipsis",
79
+ lineHeight: 1
80
+ },
81
+ children: renderOverlayText()
82
+ }
83
+ )
84
+ },
85
+ i
86
+ ))
87
+ }
88
+ );
89
+ }
90
+ function RedactArea({ annotation, isSelected, scale, onClick, style }) {
91
+ const [isHovered, setIsHovered] = useState(false);
92
+ const { object } = annotation;
93
+ const strokeColor = object.strokeColor ?? "#FF0000";
94
+ const color = object.color ?? "#000000";
95
+ const opacity = object.opacity ?? 1;
96
+ const textColor = object.fontColor ?? object.overlayColor ?? "#FFFFFF";
97
+ const overlayText = object.overlayText;
98
+ const overlayTextRepeat = object.overlayTextRepeat ?? false;
99
+ const fontSize = object.fontSize ?? 12;
100
+ const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;
101
+ const textAlign = object.textAlign ?? PdfTextAlignment.Center;
102
+ const renderOverlayText = () => {
103
+ if (!overlayText) return null;
104
+ if (!overlayTextRepeat) return overlayText;
105
+ const reps = 10;
106
+ return Array(reps).fill(overlayText).join(" ");
107
+ };
108
+ return /* @__PURE__ */ jsx(
109
+ "div",
110
+ {
111
+ onPointerDown: !isSelected ? onClick : void 0,
112
+ onTouchStart: !isSelected ? onClick : void 0,
113
+ onMouseEnter: () => setIsHovered(true),
114
+ onMouseLeave: () => setIsHovered(false),
115
+ style: {
116
+ position: "absolute",
117
+ inset: 0,
118
+ // Default: transparent background with strokeColor (C) border
119
+ // Hovered: color (IC) background fill, no border
120
+ // Selected: no border (container handles it)
121
+ background: isHovered ? color : "transparent",
122
+ border: !isHovered ? `2px solid ${strokeColor}` : "none",
123
+ opacity: isHovered ? opacity : 1,
124
+ boxSizing: "border-box",
125
+ pointerEvents: "auto",
126
+ cursor: isSelected ? "move" : "pointer",
127
+ display: "flex",
128
+ alignItems: "center",
129
+ justifyContent: textAlign === PdfTextAlignment.Left ? "flex-start" : textAlign === PdfTextAlignment.Right ? "flex-end" : "center",
130
+ overflow: "hidden",
131
+ ...style
132
+ },
133
+ children: isHovered && overlayText && /* @__PURE__ */ jsx(
134
+ "span",
135
+ {
136
+ style: {
137
+ color: textColor,
138
+ fontSize: fontSize * scale,
139
+ fontFamily: standardFontCss(fontFamily),
140
+ textAlign: textAlignmentToCss(textAlign),
141
+ whiteSpace: overlayTextRepeat ? "normal" : "nowrap",
142
+ overflow: "hidden",
143
+ textOverflow: "ellipsis",
144
+ padding: "4px"
145
+ },
146
+ children: renderOverlayText()
147
+ }
148
+ )
149
+ }
150
+ );
151
+ }
152
+ const redactRenderers = [
153
+ createRenderer({
154
+ id: "redactHighlight",
155
+ matches: (a) => {
156
+ var _a;
157
+ return a.type === PdfAnnotationSubtype.REDACT && "segmentRects" in a && (((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0) > 0;
158
+ },
159
+ render: (props) => /* @__PURE__ */ jsx(RedactHighlight, { ...props })
160
+ }),
161
+ createRenderer({
162
+ id: "redactArea",
163
+ matches: (a) => {
164
+ var _a;
165
+ return a.type === PdfAnnotationSubtype.REDACT && (!("segmentRects" in a) || !(((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0));
166
+ },
167
+ render: (props) => /* @__PURE__ */ jsx(RedactArea, { ...props })
168
+ })
169
+ ];
170
+ function RedactRendererRegistration() {
171
+ useRegisterRenderers(redactRenderers);
172
+ return null;
173
+ }
8
174
  const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
9
175
  const useRedactionCapability = () => useCapability(RedactionPlugin.id);
10
176
  const useRedaction = (documentId) => {
@@ -39,7 +205,7 @@ const MarqueeRedact = ({
39
205
  pageIndex,
40
206
  scale: scaleOverride,
41
207
  className,
42
- stroke = "red",
208
+ stroke,
43
209
  fill = "transparent"
44
210
  }) => {
45
211
  const { plugin: redactionPlugin } = useRedactionPlugin();
@@ -49,6 +215,7 @@ const MarqueeRedact = ({
49
215
  if (scaleOverride !== void 0) return scaleOverride;
50
216
  return (documentState == null ? void 0 : documentState.scale) ?? 1;
51
217
  }, [scaleOverride, documentState == null ? void 0 : documentState.scale]);
218
+ const strokeColor = stroke ?? (redactionPlugin == null ? void 0 : redactionPlugin.getPreviewStrokeColor()) ?? "red";
52
219
  useEffect(() => {
53
220
  if (!redactionPlugin || !documentId) return;
54
221
  return redactionPlugin.registerMarqueeOnPage({
@@ -71,7 +238,7 @@ const MarqueeRedact = ({
71
238
  top: rect.origin.y * scale,
72
239
  width: rect.size.width * scale,
73
240
  height: rect.size.height * scale,
74
- border: `1px solid ${stroke}`,
241
+ border: `1px solid ${strokeColor}`,
75
242
  background: fill,
76
243
  boxSizing: "border-box"
77
244
  },
@@ -118,6 +285,7 @@ function SelectionRedact({ documentId, pageIndex, scale }) {
118
285
  const { plugin: redactionPlugin } = useRedactionPlugin();
119
286
  const [rects, setRects] = useState([]);
120
287
  const [boundingRect, setBoundingRect] = useState(null);
288
+ const strokeColor = (redactionPlugin == null ? void 0 : redactionPlugin.getPreviewStrokeColor()) ?? "red";
121
289
  useEffect(() => {
122
290
  if (!redactionPlugin) return;
123
291
  return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {
@@ -143,7 +311,7 @@ function SelectionRedact({ documentId, pageIndex, scale }) {
143
311
  opacity: 1,
144
312
  rects,
145
313
  scale,
146
- border: "1px solid red"
314
+ border: `1px solid ${strokeColor}`
147
315
  }
148
316
  )
149
317
  }
@@ -164,11 +332,13 @@ function PendingRedactions({
164
332
  if (!redaction) return;
165
333
  const scoped = redaction.forDocument(documentId);
166
334
  const currentState = scoped.getState();
167
- setItems(currentState.pending[pageIndex] ?? []);
335
+ setItems((currentState.pending[pageIndex] ?? []).filter((it) => it.source === "legacy"));
168
336
  setSelectedId(
169
337
  currentState.selected && currentState.selected.page === pageIndex ? currentState.selected.id : null
170
338
  );
171
- const off1 = scoped.onPendingChange((map) => setItems(map[pageIndex] ?? []));
339
+ const off1 = scoped.onPendingChange((map) => {
340
+ setItems((map[pageIndex] ?? []).filter((it) => it.source === "legacy"));
341
+ });
172
342
  const off2 = scoped.onSelectedChange((sel) => {
173
343
  setSelectedId(sel && sel.page === pageIndex ? sel.id : null);
174
344
  });
@@ -202,7 +372,7 @@ function PendingRedactions({
202
372
  background: "transparent",
203
373
  outline: selectedId === it.id ? `1px solid ${bboxStroke}` : "none",
204
374
  outlineOffset: "2px",
205
- border: `1px solid red`,
375
+ border: `1px solid ${it.markColor}`,
206
376
  pointerEvents: "auto",
207
377
  cursor: "pointer"
208
378
  },
@@ -257,7 +427,7 @@ function PendingRedactions({
257
427
  rect: b,
258
428
  rects: it.rects,
259
429
  color: "transparent",
260
- border: "1px solid red",
430
+ border: `1px solid ${it.markColor}`,
261
431
  scale,
262
432
  onClick: (e) => select(e, it.id)
263
433
  }
@@ -320,8 +490,14 @@ const RedactionLayer = ({
320
490
  /* @__PURE__ */ jsx(SelectionRedact, { documentId, pageIndex, scale: actualScale })
321
491
  ] });
322
492
  };
493
+ const RedactionPluginPackage = createPluginPackage(RedactionPluginPackage$1).addUtility(RedactRendererRegistration).build();
323
494
  export {
495
+ RedactArea,
496
+ RedactHighlight,
497
+ RedactRendererRegistration,
324
498
  RedactionLayer,
499
+ RedactionPluginPackage,
500
+ redactRenderers,
325
501
  useRedaction,
326
502
  useRedactionCapability,
327
503
  useRedactionPlugin
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/shared/hooks/use-redaction.ts","../../src/shared/components/marquee-redact.tsx","../../src/shared/components/highlight.tsx","../../src/shared/components/selection-redact.tsx","../../src/shared/components/pending-redactions.tsx","../../src/shared/components/redaction-layer.tsx"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialDocumentState,\n RedactionPlugin,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useState, useEffect, useMemo } from '@framework';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\nexport const useRedaction = (\n documentId: string,\n): {\n state: RedactionDocumentState;\n provides: RedactionScope | null;\n} => {\n const { provides } = useRedactionCapability();\n const [state, setState] = useState<RedactionDocumentState>(initialDocumentState);\n\n const scope = useMemo(\n () => (provides ? provides.forDocument(documentId) : null),\n [provides, documentId],\n );\n\n useEffect(() => {\n if (!scope) {\n setState(initialDocumentState);\n return;\n }\n\n // Set initial state\n try {\n setState(scope.getState());\n } catch (e) {\n // Handle case where state might not be ready\n setState(initialDocumentState);\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n setState(newState);\n });\n\n return unsubscribe;\n }, [scope]);\n\n return {\n state,\n provides: scope,\n };\n};\n","import { useEffect, useMemo, useState } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeRedact = ({\n documentId,\n pageIndex,\n scale: scaleOverride,\n className,\n stroke = 'red',\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const documentState = useDocumentState(documentId);\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n const scale = useMemo(() => {\n if (scaleOverride !== undefined) return scaleOverride;\n return documentState?.scale ?? 1;\n }, [scaleOverride, documentState?.scale]);\n\n useEffect(() => {\n if (!redactionPlugin || !documentId) return;\n return redactionPlugin.registerMarqueeOnPage({\n documentId,\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [redactionPlugin, documentId, pageIndex, scale]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n","import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\ntype HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;\n style?: CSSProperties;\n};\n\nexport function Highlight({\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style,\n ...props\n}: HighlightProps) {\n return (\n <>\n {rects.map((b, i) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n border,\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n ...style,\n }}\n {...props}\n />\n ))}\n </>\n );\n}\n","import { Rect } from '@embedpdf/models';\nimport { useEffect, useState } from '@framework';\nimport { useRedactionPlugin } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ documentId, pageIndex, scale }: SelectionRedactProps) {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!boundingRect) return null;\n\n return (\n <div\n style={{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }}\n >\n <Highlight\n color={'transparent'}\n opacity={1}\n rects={rects}\n scale={scale}\n border=\"1px solid red\"\n />\n </div>\n );\n}\n","import { Fragment, useEffect, useState, useCallback, MouseEvent, TouchEvent } from '@framework';\nimport { CounterRotate } from '@embedpdf/utils/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { RedactionSelectionMenuRenderFn } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport function PendingRedactions({\n documentId,\n pageIndex,\n scale,\n bboxStroke = 'rgba(0,0,0,0.8)',\n rotation = Rotation.Degree0,\n selectionMenu,\n}: PendingRedactionsProps) {\n const { provides: redaction } = useRedactionCapability();\n const [items, setItems] = useState<RedactionItem[]>([]);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!redaction) return;\n\n // Use document-scoped hooks so we only receive events for this document\n const scoped = redaction.forDocument(documentId);\n\n // Initialize with current state\n const currentState = scoped.getState();\n setItems(currentState.pending[pageIndex] ?? []);\n setSelectedId(\n currentState.selected && currentState.selected.page === pageIndex\n ? currentState.selected.id\n : null,\n );\n\n // Subscribe to future changes\n const off1 = scoped.onPendingChange((map) => setItems(map[pageIndex] ?? []));\n const off2 = scoped.onSelectedChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, documentId, pageIndex]);\n\n const select = useCallback(\n (e: MouseEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.forDocument(documentId).selectPending(pageIndex, id);\n },\n [redaction, documentId, pageIndex],\n );\n\n if (!items.length) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {items.map((it) => {\n if (it.kind === 'area') {\n const r = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: r.origin.x * scale,\n top: r.origin.y * scale,\n width: r.size.width * scale,\n height: r.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid red`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }}\n onPointerDown={(e) => select(e, it.id)}\n onTouchStart={(e) => select(e, it.id)}\n />\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: r.origin.x * scale, y: r.origin.y * scale },\n size: { width: r.size.width * scale, height: r.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n }\n\n const b = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: b.origin.x * scale,\n top: b.origin.y * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === it.id ? 'pointer' : 'default',\n }}\n >\n <Highlight\n rect={b}\n rects={it.rects}\n color=\"transparent\"\n border=\"1px solid red\"\n scale={scale}\n onClick={(e) => select(e, it.id)}\n />\n </div>\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: b.origin.x * scale, y: b.origin.y * scale },\n size: { width: b.size.width * scale, height: b.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment, useMemo } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport const RedactionLayer = ({\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n}: RedactionLayerProps) => {\n const documentState = useDocumentState(documentId);\n\n const actualScale = useMemo(() => {\n if (scale !== undefined) return scale;\n return documentState?.scale ?? 1;\n }, [scale, documentState?.scale]);\n\n const actualRotation = useMemo(() => {\n if (rotation !== undefined) return rotation;\n return documentState?.rotation ?? Rotation.Degree0;\n }, [rotation, documentState?.rotation]);\n\n return (\n <Fragment>\n <PendingRedactions\n documentId={documentId}\n pageIndex={pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n <SelectionRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n </Fragment>\n );\n};\n"],"names":["Fragment"],"mappings":";;;;;;;AASO,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;AAC9E,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;AAEtF,MAAM,eAAe,CAC1B,eAIG;AACH,QAAM,EAAE,SAAA,IAAa,uBAAA;AACrB,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiC,oBAAoB;AAE/E,QAAM,QAAQ;AAAA,IACZ,MAAO,WAAW,SAAS,YAAY,UAAU,IAAI;AAAA,IACrD,CAAC,UAAU,UAAU;AAAA,EAAA;AAGvB,YAAU,MAAM;AACd,QAAI,CAAC,OAAO;AACV,eAAS,oBAAoB;AAC7B;AAAA,IACF;AAGA,QAAI;AACF,eAAS,MAAM,UAAU;AAAA,IAC3B,SAAS,GAAG;AAEV,eAAS,oBAAoB;AAAA,IAC/B;AAGA,UAAM,cAAc,MAAM,cAAc,CAAC,aAAa;AACpD,eAAS,QAAQ;AAAA,IACnB,CAAC;AAED,WAAO;AAAA,E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AA;AAAA,MAAA;AAAA,IAEL,EAAA,GA9CW,GAAG,EAgDlB;AAAA,EAEJ,CAAC,EAAA,CACH;AAEJ;ACzJO,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,QAAM,gBAAgB,iBAAiB,UAAU;AAEjD,QAAM,cAAc,QAAQ,MAAM;AAChC,QAAI,UAAU,OAAW,QAAO;AAChC,YAAO,+CAAe,UAAS;AAAA,EACjC,GAAG,CAAC,OAAO,+CAAe,KAAK,CAAC;AAEhC,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,aAAa,OAAW,QAAO;AACnC,YAAO,+CAAe,aAAY,SAAS;AAAA,EAC7C,GAAG,CAAC,UAAU,+CAAe,QAAQ,CAAC;AAEtC,8BACGA,YAAA,EACC,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,oBAAC,eAAA,EAAc,YAAwB,WAAsB,OAAO,aAAa;AAAA,IACjF,oBAAC,iBAAA,EAAgB,YAAwB,WAAsB,OAAO,YAAA,CAAa;AAAA,EAAA,GACrF;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/shared/components/annotations/redact-highlight.tsx","../../src/shared/components/annotations/redact-area.tsx","../../src/shared/components/redact-renderers.tsx","../../src/shared/components/redact-renderer-registration.tsx","../../src/shared/hooks/use-redaction.ts","../../src/shared/components/marquee-redact.tsx","../../src/shared/components/highlight.tsx","../../src/shared/components/selection-redact.tsx","../../src/shared/components/pending-redactions.tsx","../../src/shared/components/redaction-layer.tsx","../../src/shared/index.ts"],"sourcesContent":["import { CSSProperties, MouseEvent, TouchEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n Rect,\n standardFontCss,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactHighlightProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders a text-based redact annotation using QuadPoints/segmentRects.\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactHighlight({\n annotation,\n isSelected,\n scale,\n onClick,\n style,\n}: RedactHighlightProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n const segmentRects = object.segmentRects ?? [];\n const rect = object.rect;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ position: 'absolute', inset: 0 }}\n >\n {segmentRects.map((b: Rect, i: number) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: Math.min(fontSize * scale, b.size.height * scale * 0.8),\n fontFamily: standardFontCss(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n lineHeight: 1,\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n ))}\n </div>\n );\n}\n","import { CSSProperties, MouseEvent, TouchEvent, useState } from '@framework';\nimport {\n PdfRedactAnnoObject,\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCss,\n textAlignmentToCss,\n} from '@embedpdf/models';\nimport { TrackedAnnotation } from '@embedpdf/plugin-annotation';\n\nexport interface RedactAreaProps {\n annotation: TrackedAnnotation<PdfRedactAnnoObject>;\n isSelected: boolean;\n scale: number;\n pageIndex: number;\n onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;\n style?: CSSProperties;\n}\n\n/**\n * Renders an area-based redact annotation (marquee redaction).\n * Default: shows strokeColor (C) border only, no fill.\n * Hovered: shows redaction preview with color (IC) as background fill + overlayText.\n * Selected: no border (AnnotationContainer handles selection styling).\n */\nexport function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps) {\n const [isHovered, setIsHovered] = useState(false);\n const { object } = annotation;\n\n // C - Border/stroke color\n const strokeColor = object.strokeColor ?? '#FF0000';\n // IC - Interior color (background fill when redaction is applied)\n const color = object.color ?? '#000000';\n // CA - Opacity (0-1)\n const opacity = object.opacity ?? 1;\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = object.fontColor ?? object.overlayColor ?? '#FFFFFF';\n // Overlay text properties\n const overlayText = object.overlayText;\n const overlayTextRepeat = object.overlayTextRepeat ?? false;\n const fontSize = object.fontSize ?? 12;\n const fontFamily = object.fontFamily ?? PdfStandardFont.Helvetica;\n const textAlign = object.textAlign ?? PdfTextAlignment.Center;\n\n // Calculate how many times to repeat text (approximate)\n const renderOverlayText = () => {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10; // Enough repetitions to fill most containers\n return Array(reps).fill(overlayText).join(' ');\n };\n\n return (\n <div\n onPointerDown={!isSelected ? onClick : undefined}\n onTouchStart={!isSelected ? onClick : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n position: 'absolute',\n inset: 0,\n // Default: transparent background with strokeColor (C) border\n // Hovered: color (IC) background fill, no border\n // Selected: no border (container handles it)\n background: isHovered ? color : 'transparent',\n border: !isHovered ? `2px solid ${strokeColor}` : 'none',\n opacity: isHovered ? opacity : 1,\n boxSizing: 'border-box',\n pointerEvents: 'auto',\n cursor: isSelected ? 'move' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent:\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n overflow: 'hidden',\n ...style,\n }}\n >\n {isHovered && overlayText && (\n <span\n style={{\n color: textColor,\n fontSize: fontSize * scale,\n fontFamily: standardFontCss(fontFamily),\n textAlign: textAlignmentToCss(textAlign),\n whiteSpace: overlayTextRepeat ? 'normal' : 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n padding: '4px',\n }}\n >\n {renderOverlayText()}\n </span>\n )}\n </div>\n );\n}\n","import { PdfAnnotationSubtype, PdfRedactAnnoObject } from '@embedpdf/models';\nimport { createRenderer, BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/@framework';\nimport { RedactHighlight } from './annotations/redact-highlight';\nimport { RedactArea } from './annotations/redact-area';\n\n/**\n * Boxed annotation renderers for Redact annotations.\n * Type safety is enforced at definition time via createRenderer.\n * These are automatically registered with the annotation plugin via context.\n */\nexport const redactRenderers: BoxedAnnotationRenderer[] = [\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactHighlight',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n 'segmentRects' in a &&\n (a.segmentRects?.length ?? 0) > 0,\n render: (props) => <RedactHighlight {...props} />,\n }),\n createRenderer<PdfRedactAnnoObject>({\n id: 'redactArea',\n matches: (a): a is PdfRedactAnnoObject =>\n a.type === PdfAnnotationSubtype.REDACT &&\n (!('segmentRects' in a) || !(a.segmentRects?.length ?? 0)),\n render: (props) => <RedactArea {...props} />,\n }),\n];\n","import { useRegisterRenderers } from '@embedpdf/plugin-annotation/@framework';\nimport { redactRenderers } from '../components/redact-renderers';\n\n/**\n * Utility component that registers redact renderers once at app level.\n * Added via addUtility() so it mounts once, not per-page.\n */\nexport function RedactRendererRegistration() {\n useRegisterRenderers(redactRenderers);\n return null;\n}\n","import { useCapability, usePlugin } from '@embedpdf/core/@framework';\nimport {\n initialDocumentState,\n RedactionPlugin,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useState, useEffect, useMemo } from '@framework';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\nexport const useRedaction = (\n documentId: string,\n): {\n state: RedactionDocumentState;\n provides: RedactionScope | null;\n} => {\n const { provides } = useRedactionCapability();\n const [state, setState] = useState<RedactionDocumentState>(initialDocumentState);\n\n const scope = useMemo(\n () => (provides ? provides.forDocument(documentId) : null),\n [provides, documentId],\n );\n\n useEffect(() => {\n if (!scope) {\n setState(initialDocumentState);\n return;\n }\n\n // Set initial state\n try {\n setState(scope.getState());\n } catch (e) {\n // Handle case where state might not be ready\n setState(initialDocumentState);\n }\n\n // Subscribe to changes\n const unsubscribe = scope.onStateChange((newState) => {\n setState(newState);\n });\n\n return unsubscribe;\n }, [scope]);\n\n return {\n state,\n provides: scope,\n };\n};\n","import { useEffect, useMemo, useState } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\n /** The ID of the document */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Scale of the page */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke / fill colours (defaults below) */\n stroke?: string;\n fill?: string;\n}\n\nexport const MarqueeRedact = ({\n documentId,\n pageIndex,\n scale: scaleOverride,\n className,\n stroke,\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const documentState = useDocumentState(documentId);\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n const scale = useMemo(() => {\n if (scaleOverride !== undefined) return scaleOverride;\n return documentState?.scale ?? 1;\n }, [scaleOverride, documentState?.scale]);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n // Allow prop override for backwards compatibility\n const strokeColor = stroke ?? redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin || !documentId) return;\n return redactionPlugin.registerMarqueeOnPage({\n documentId,\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [redactionPlugin, documentId, pageIndex, scale]);\n\n if (!rect) return null;\n\n return (\n <div\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n left: rect.origin.x * scale,\n top: rect.origin.y * scale,\n width: rect.size.width * scale,\n height: rect.size.height * scale,\n border: `1px solid ${strokeColor}`,\n background: fill,\n boxSizing: 'border-box',\n }}\n className={className}\n />\n );\n};\n","import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\ntype HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;\n style?: CSSProperties;\n};\n\nexport function Highlight({\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style,\n ...props\n}: HighlightProps) {\n return (\n <>\n {rects.map((b, i) => (\n <div\n key={i}\n onPointerDown={onClick}\n onTouchStart={onClick}\n style={{\n position: 'absolute',\n border,\n left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,\n top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n ...style,\n }}\n {...props}\n />\n ))}\n </>\n );\n}\n","import { Rect } from '@embedpdf/models';\nimport { useEffect, useState } from '@framework';\nimport { useRedactionPlugin } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ documentId, pageIndex, scale }: SelectionRedactProps) {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n const strokeColor = redactionPlugin?.getPreviewStrokeColor() ?? 'red';\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionPlugin, documentId, pageIndex]);\n\n if (!boundingRect) return null;\n\n return (\n <div\n style={{\n mixBlendMode: 'normal',\n pointerEvents: 'none',\n position: 'absolute',\n inset: 0,\n }}\n >\n <Highlight\n color={'transparent'}\n opacity={1}\n rects={rects}\n scale={scale}\n border={`1px solid ${strokeColor}`}\n />\n </div>\n );\n}\n","import { Fragment, useEffect, useState, useCallback, MouseEvent, TouchEvent } from '@framework';\nimport { CounterRotate } from '@embedpdf/utils/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { RedactionSelectionMenuRenderFn } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport function PendingRedactions({\n documentId,\n pageIndex,\n scale,\n bboxStroke = 'rgba(0,0,0,0.8)',\n rotation = Rotation.Degree0,\n selectionMenu,\n}: PendingRedactionsProps) {\n const { provides: redaction } = useRedactionCapability();\n const [items, setItems] = useState<RedactionItem[]>([]);\n const [selectedId, setSelectedId] = useState<string | null>(null);\n\n useEffect(() => {\n if (!redaction) return;\n\n // Use document-scoped hooks so we only receive events for this document\n const scoped = redaction.forDocument(documentId);\n\n // Initialize with current state - only show legacy mode items\n const currentState = scoped.getState();\n setItems((currentState.pending[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n setSelectedId(\n currentState.selected && currentState.selected.page === pageIndex\n ? currentState.selected.id\n : null,\n );\n\n // Subscribe to future changes - only show legacy mode items\n const off1 = scoped.onPendingChange((map) => {\n setItems((map[pageIndex] ?? []).filter((it) => it.source === 'legacy'));\n });\n const off2 = scoped.onSelectedChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, documentId, pageIndex]);\n\n const select = useCallback(\n (e: MouseEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.forDocument(documentId).selectPending(pageIndex, id);\n },\n [redaction, documentId, pageIndex],\n );\n\n if (!items.length) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {items.map((it) => {\n if (it.kind === 'area') {\n const r = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: r.origin.x * scale,\n top: r.origin.y * scale,\n width: r.size.width * scale,\n height: r.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n border: `1px solid ${it.markColor}`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }}\n onPointerDown={(e) => select(e, it.id)}\n onTouchStart={(e) => select(e, it.id)}\n />\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: r.origin.x * scale, y: r.origin.y * scale },\n size: { width: r.size.width * scale, height: r.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n }\n\n const b = it.rect;\n return (\n <Fragment key={it.id}>\n <div\n style={{\n position: 'absolute',\n left: b.origin.x * scale,\n top: b.origin.y * scale,\n width: b.size.width * scale,\n height: b.size.height * scale,\n background: 'transparent',\n outline: selectedId === it.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === it.id ? 'pointer' : 'default',\n }}\n >\n <Highlight\n rect={b}\n rects={it.rects}\n color=\"transparent\"\n border={`1px solid ${it.markColor}`}\n scale={scale}\n onClick={(e) => select(e, it.id)}\n />\n </div>\n {selectionMenu && (\n <CounterRotate\n rect={{\n origin: { x: b.origin.x * scale, y: b.origin.y * scale },\n size: { width: b.size.width * scale, height: b.size.height * scale },\n }}\n rotation={rotation}\n >\n {(props) =>\n selectionMenu({\n ...props,\n context: {\n type: 'redaction',\n item: it,\n pageIndex,\n },\n selected: selectedId === it.id,\n placement: {\n suggestTop: false,\n },\n })\n }\n </CounterRotate>\n )}\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment, useMemo } from '@framework';\nimport { useDocumentState } from '@embedpdf/core/@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { RedactionSelectionMenuRenderFn } from './types';\n\ninterface RedactionLayerProps {\n /** The ID of the document this layer belongs to */\n documentId: string;\n /** Index of the page this layer lives on */\n pageIndex: number;\n /** Current render scale for this page */\n scale?: number;\n /** Page rotation (for counter-rotating menus, etc.) */\n rotation?: Rotation;\n /** Optional menu renderer for a selected redaction */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n}\n\nexport const RedactionLayer = ({\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n}: RedactionLayerProps) => {\n const documentState = useDocumentState(documentId);\n\n const actualScale = useMemo(() => {\n if (scale !== undefined) return scale;\n return documentState?.scale ?? 1;\n }, [scale, documentState?.scale]);\n\n const actualRotation = useMemo(() => {\n if (rotation !== undefined) return rotation;\n return documentState?.rotation ?? Rotation.Degree0;\n }, [rotation, documentState?.rotation]);\n\n return (\n <Fragment>\n <PendingRedactions\n documentId={documentId}\n pageIndex={pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n <SelectionRedact documentId={documentId} pageIndex={pageIndex} scale={actualScale} />\n </Fragment>\n );\n};\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport { RedactRendererRegistration } from './components/redact-renderer-registration';\n\nexport * from './hooks';\nexport * from './components';\nexport * from '@embedpdf/plugin-redaction';\n\n// Automatically register redact renderers when plugin is loaded\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["Fragment","BaseRedactionPackage"],"mappings":";;;;;;;;;AA0BO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,EAAE,WAAW;AAEnB,QAAM,eAAe,OAAO,gBAAgB,CAAA;AAC5C,QAAM,OAAO,OAAO;AAGpB,QAAM,cAAc,OAAO,eAAe;AAE1C,QAAM,QAAQ,OAAO,SAAS;AAE9B,QAAM,UAAU,OAAO,WAAW;AAElC,QAAM,YAAY,OAAO,aAAa,OAAO,gBAAgB;AAE7D,QAAM,cAAc,OAAO;AAC3B,QAAM,oBAAoB,OAAO,qBAAqB;AACtD,QAAM,WAAW,OAAO,YAAY;AACpC,QAAM,aAAa,OAAO,cAAc,gBAAgB;AACxD,QAAM,YAAY,OAAO,aAAa,iBAAiB;AAGvD,QAAM,oBAAoB,MAAM;AAC9B,QAAI,CAAC,YAAa,QAAO;AACzB,QAAI,CAAC,kBAAmB,QAAO;AAE/B,UAAM,OAAO;AACb,WAAO,MAAM,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG;AAAA,EAC/C;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAc,MAAM,aAAa,IAAI;AAAA,MACrC,cAAc,MAAM,aAAa,KAAK;AAAA,M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,OAAO,YAAA,CAAa;AAAA,EAAA,GACrF;AAEJ;AC5CO,MAAM,yBAAyB,oBAAoBC,wBAAoB,EAC3E,WAAW,0BAA0B,EACrC,MAAA;"}
@@ -0,0 +1,2 @@
1
+ export * from './redact-highlight';
2
+ export * from './redact-area';
@@ -0,0 +1,18 @@
1
+ import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
+ import { PdfRedactAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '@embedpdf/plugin-annotation';
4
+ export interface RedactAreaProps {
5
+ annotation: TrackedAnnotation<PdfRedactAnnoObject>;
6
+ isSelected: boolean;
7
+ scale: number;
8
+ pageIndex: number;
9
+ onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
10
+ style?: CSSProperties;
11
+ }
12
+ /**
13
+ * Renders an area-based redact annotation (marquee redaction).
14
+ * Default: shows strokeColor (C) border only, no fill.
15
+ * Hovered: shows redaction preview with color (IC) as background fill + overlayText.
16
+ * Selected: no border (AnnotationContainer handles selection styling).
17
+ */
18
+ export declare function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
+ import { PdfRedactAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '@embedpdf/plugin-annotation';
4
+ export interface RedactHighlightProps {
5
+ annotation: TrackedAnnotation<PdfRedactAnnoObject>;
6
+ isSelected: boolean;
7
+ scale: number;
8
+ pageIndex: number;
9
+ onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
10
+ style?: CSSProperties;
11
+ }
12
+ /**
13
+ * Renders a text-based redact annotation using QuadPoints/segmentRects.
14
+ * Default: shows strokeColor (C) border only, no fill.
15
+ * Hovered: shows redaction preview with color (IC) as background fill + overlayText.
16
+ * Selected: no border (AnnotationContainer handles selection styling).
17
+ */
18
+ export declare function RedactHighlight({ annotation, isSelected, scale, onClick, style, }: RedactHighlightProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  export * from './redaction-layer';
2
2
  export * from './types';
3
+ export * from './annotations';
4
+ export * from './redact-renderers';
5
+ export * from './redact-renderer-registration';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utility component that registers redact renderers once at app level.
3
+ * Added via addUtility() so it mounts once, not per-page.
4
+ */
5
+ export declare function RedactRendererRegistration(): null;
@@ -0,0 +1,7 @@
1
+ import { BoxedAnnotationRenderer } from '../../react/annotation.ts';
2
+ /**
3
+ * Boxed annotation renderers for Redact annotations.
4
+ * Type safety is enforced at definition time via createRenderer.
5
+ * These are automatically registered with the annotation plugin via context.
6
+ */
7
+ export declare const redactRenderers: BoxedAnnotationRenderer[];
@@ -1,3 +1,4 @@
1
1
  export * from './hooks';
2
2
  export * from './components';
3
3
  export * from '../index.ts';
4
+ export declare const RedactionPluginPackage: import('@embedpdf/core').WithAutoMount<import('@embedpdf/core').PluginPackage<import('../index.ts').RedactionPlugin, import('../index.ts').RedactionPluginConfig, import('../index.ts').RedactionState, import('../lib/actions').RedactionAction>>;
@@ -0,0 +1,2 @@
1
+ export * from './redact-highlight';
2
+ export * from './redact-area';
@@ -0,0 +1,18 @@
1
+ import { CSSProperties, MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
2
+ import { PdfRedactAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '@embedpdf/plugin-annotation';
4
+ export interface RedactAreaProps {
5
+ annotation: TrackedAnnotation<PdfRedactAnnoObject>;
6
+ isSelected: boolean;
7
+ scale: number;
8
+ pageIndex: number;
9
+ onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
10
+ style?: CSSProperties;
11
+ }
12
+ /**
13
+ * Renders an area-based redact annotation (marquee redaction).
14
+ * Default: shows strokeColor (C) border only, no fill.
15
+ * Hovered: shows redaction preview with color (IC) as background fill + overlayText.
16
+ * Selected: no border (AnnotationContainer handles selection styling).
17
+ */
18
+ export declare function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps): import("preact").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { CSSProperties, MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
2
+ import { PdfRedactAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '@embedpdf/plugin-annotation';
4
+ export interface RedactHighlightProps {
5
+ annotation: TrackedAnnotation<PdfRedactAnnoObject>;
6
+ isSelected: boolean;
7
+ scale: number;
8
+ pageIndex: number;
9
+ onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
10
+ style?: CSSProperties;
11
+ }
12
+ /**
13
+ * Renders a text-based redact annotation using QuadPoints/segmentRects.
14
+ * Default: shows strokeColor (C) border only, no fill.
15
+ * Hovered: shows redaction preview with color (IC) as background fill + overlayText.
16
+ * Selected: no border (AnnotationContainer handles selection styling).
17
+ */
18
+ export declare function RedactHighlight({ annotation, isSelected, scale, onClick, style, }: RedactHighlightProps): import("preact").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  export * from './redaction-layer';
2
2
  export * from './types';
3
+ export * from './annotations';
4
+ export * from './redact-renderers';
5
+ export * from './redact-renderer-registration';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utility component that registers redact renderers once at app level.
3
+ * Added via addUtility() so it mounts once, not per-page.
4
+ */
5
+ export declare function RedactRendererRegistration(): null;
@@ -0,0 +1,7 @@
1
+ import { BoxedAnnotationRenderer } from '../../preact/annotation.ts';
2
+ /**
3
+ * Boxed annotation renderers for Redact annotations.
4
+ * Type safety is enforced at definition time via createRenderer.
5
+ * These are automatically registered with the annotation plugin via context.
6
+ */
7
+ export declare const redactRenderers: BoxedAnnotationRenderer[];
@@ -1,3 +1,4 @@
1
1
  export * from './hooks';
2
2
  export * from './components';
3
3
  export * from '../lib/index.ts';
4
+ export declare const RedactionPluginPackage: import('@embedpdf/core').WithAutoMount<import('@embedpdf/core').PluginPackage<import('../lib/index.ts').RedactionPlugin, import('../lib/index.ts').RedactionPluginConfig, import('../lib/index.ts').RedactionState, import('../lib/actions').RedactionAction>>;
@@ -0,0 +1,2 @@
1
+ export * from './redact-highlight';
2
+ export * from './redact-area';
@@ -0,0 +1,18 @@
1
+ import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
+ import { PdfRedactAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '@embedpdf/plugin-annotation';
4
+ export interface RedactAreaProps {
5
+ annotation: TrackedAnnotation<PdfRedactAnnoObject>;
6
+ isSelected: boolean;
7
+ scale: number;
8
+ pageIndex: number;
9
+ onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
10
+ style?: CSSProperties;
11
+ }
12
+ /**
13
+ * Renders an area-based redact annotation (marquee redaction).
14
+ * Default: shows strokeColor (C) border only, no fill.
15
+ * Hovered: shows redaction preview with color (IC) as background fill + overlayText.
16
+ * Selected: no border (AnnotationContainer handles selection styling).
17
+ */
18
+ export declare function RedactArea({ annotation, isSelected, scale, onClick, style }: RedactAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
+ import { PdfRedactAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '@embedpdf/plugin-annotation';
4
+ export interface RedactHighlightProps {
5
+ annotation: TrackedAnnotation<PdfRedactAnnoObject>;
6
+ isSelected: boolean;
7
+ scale: number;
8
+ pageIndex: number;
9
+ onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
10
+ style?: CSSProperties;
11
+ }
12
+ /**
13
+ * Renders a text-based redact annotation using QuadPoints/segmentRects.
14
+ * Default: shows strokeColor (C) border only, no fill.
15
+ * Hovered: shows redaction preview with color (IC) as background fill + overlayText.
16
+ * Selected: no border (AnnotationContainer handles selection styling).
17
+ */
18
+ export declare function RedactHighlight({ annotation, isSelected, scale, onClick, style, }: RedactHighlightProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  export * from './redaction-layer';
2
2
  export * from './types';
3
+ export * from './annotations';
4
+ export * from './redact-renderers';
5
+ export * from './redact-renderer-registration';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Utility component that registers redact renderers once at app level.
3
+ * Added via addUtility() so it mounts once, not per-page.
4
+ */
5
+ export declare function RedactRendererRegistration(): null;
@@ -0,0 +1,7 @@
1
+ import { BoxedAnnotationRenderer } from '../../react/annotation.ts';
2
+ /**
3
+ * Boxed annotation renderers for Redact annotations.
4
+ * Type safety is enforced at definition time via createRenderer.
5
+ * These are automatically registered with the annotation plugin via context.
6
+ */
7
+ export declare const redactRenderers: BoxedAnnotationRenderer[];
@@ -1,3 +1,4 @@
1
1
  export * from './hooks';
2
2
  export * from './components';
3
3
  export * from '../lib/index.ts';
4
+ export declare const RedactionPluginPackage: import('@embedpdf/core').WithAutoMount<import('@embedpdf/core').PluginPackage<import('../lib/index.ts').RedactionPlugin, import('../lib/index.ts').RedactionPluginConfig, import('../lib/index.ts').RedactionState, import('../lib/actions').RedactionAction>>;
@@ -0,0 +1,7 @@
1
+ import { Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ children?: Snippet;
4
+ };
5
+ declare const RedactRendererRegistration: import('svelte', { with: { "resolution-mode": "import" } }).Component<$$ComponentProps, {}, "">;
6
+ type RedactRendererRegistration = ReturnType<typeof RedactRendererRegistration>;
7
+ export default RedactRendererRegistration;