@embedpdf/plugin-redaction 1.0.18
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 +21 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +418 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions.d.ts +47 -0
- package/dist/lib/handlers/index.d.ts +1 -0
- package/dist/lib/handlers/marquee-redact.handler.d.ts +9 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/manifest.d.ts +4 -0
- package/dist/lib/redaction-plugin.d.ts +33 -0
- package/dist/lib/reducer.d.ts +4 -0
- package/dist/lib/selectors.d.ts +3 -0
- package/dist/lib/types.d.ts +57 -0
- package/dist/preact/adapter.d.ts +10 -0
- package/dist/preact/core.d.ts +1 -0
- package/dist/preact/index.cjs +2 -0
- package/dist/preact/index.cjs.map +1 -0
- package/dist/preact/index.d.ts +1 -0
- package/dist/preact/index.js +265 -0
- package/dist/preact/index.js.map +1 -0
- package/dist/react/adapter.d.ts +2 -0
- package/dist/react/core.d.ts +1 -0
- package/dist/react/index.cjs +2 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +264 -0
- package/dist/react/index.js.map +1 -0
- package/dist/shared-preact/components/highlight.d.ts +14 -0
- package/dist/shared-preact/components/index.d.ts +1 -0
- package/dist/shared-preact/components/marquee-redact.d.ts +13 -0
- package/dist/shared-preact/components/pending-redactions.d.ts +11 -0
- package/dist/shared-preact/components/redaction-layer.d.ts +10 -0
- package/dist/shared-preact/components/selection-redact.d.ts +6 -0
- package/dist/shared-preact/components/types.d.ts +10 -0
- package/dist/shared-preact/hooks/index.d.ts +1 -0
- package/dist/shared-preact/hooks/use-redaction.d.ts +11 -0
- package/dist/shared-preact/index.d.ts +2 -0
- package/dist/shared-react/components/highlight.d.ts +14 -0
- package/dist/shared-react/components/index.d.ts +1 -0
- package/dist/shared-react/components/marquee-redact.d.ts +13 -0
- package/dist/shared-react/components/pending-redactions.d.ts +11 -0
- package/dist/shared-react/components/redaction-layer.d.ts +10 -0
- package/dist/shared-react/components/selection-redact.d.ts +6 -0
- package/dist/shared-react/components/types.d.ts +10 -0
- package/dist/shared-react/hooks/index.d.ts +1 -0
- package/dist/shared-react/hooks/use-redaction.d.ts +11 -0
- package/dist/shared-react/index.d.ts +2 -0
- package/dist/vue/hooks/index.d.ts +1 -0
- package/dist/vue/hooks/use-redaction.d.ts +3 -0
- package/dist/vue/index.cjs +2 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +9 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { usePlugin, useCapability, CounterRotate } from "@embedpdf/core/react";
|
|
2
|
+
import { RedactionPlugin } from "@embedpdf/plugin-redaction";
|
|
3
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useState, useEffect, useCallback, Fragment as Fragment$1 } from "react";
|
|
5
|
+
import { Rotation } from "@embedpdf/models";
|
|
6
|
+
const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
|
|
7
|
+
const useRedactionCapability = () => useCapability(RedactionPlugin.id);
|
|
8
|
+
const MarqueeRedact = ({
|
|
9
|
+
pageIndex,
|
|
10
|
+
scale,
|
|
11
|
+
className,
|
|
12
|
+
stroke = "red",
|
|
13
|
+
fill = "transparent"
|
|
14
|
+
}) => {
|
|
15
|
+
const { plugin: redactionPlugin } = useRedactionPlugin();
|
|
16
|
+
const [rect, setRect] = useState(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!redactionPlugin) return;
|
|
19
|
+
return redactionPlugin.registerMarqueeOnPage({
|
|
20
|
+
pageIndex,
|
|
21
|
+
scale,
|
|
22
|
+
callback: {
|
|
23
|
+
onPreview: setRect
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}, [redactionPlugin, pageIndex]);
|
|
27
|
+
if (!rect) return null;
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
style: {
|
|
32
|
+
position: "absolute",
|
|
33
|
+
pointerEvents: "none",
|
|
34
|
+
left: rect.origin.x * scale,
|
|
35
|
+
top: rect.origin.y * scale,
|
|
36
|
+
width: rect.size.width * scale,
|
|
37
|
+
height: rect.size.height * scale,
|
|
38
|
+
border: `1px solid ${stroke}`,
|
|
39
|
+
background: fill,
|
|
40
|
+
boxSizing: "border-box"
|
|
41
|
+
},
|
|
42
|
+
className
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
function Highlight({
|
|
47
|
+
color = "#FFFF00",
|
|
48
|
+
opacity = 0.5,
|
|
49
|
+
border = "1px solid red",
|
|
50
|
+
rects,
|
|
51
|
+
rect,
|
|
52
|
+
scale,
|
|
53
|
+
onClick,
|
|
54
|
+
style,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
return /* @__PURE__ */ jsx(Fragment, { children: rects.map((b, i) => /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
onPointerDown: onClick,
|
|
61
|
+
onTouchStart: onClick,
|
|
62
|
+
style: {
|
|
63
|
+
position: "absolute",
|
|
64
|
+
border,
|
|
65
|
+
left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,
|
|
66
|
+
top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,
|
|
67
|
+
width: b.size.width * scale,
|
|
68
|
+
height: b.size.height * scale,
|
|
69
|
+
background: color,
|
|
70
|
+
opacity,
|
|
71
|
+
pointerEvents: onClick ? "auto" : "none",
|
|
72
|
+
cursor: onClick ? "pointer" : "default",
|
|
73
|
+
zIndex: onClick ? 1 : void 0,
|
|
74
|
+
...style
|
|
75
|
+
},
|
|
76
|
+
...props
|
|
77
|
+
},
|
|
78
|
+
i
|
|
79
|
+
)) });
|
|
80
|
+
}
|
|
81
|
+
function SelectionRedact({ pageIndex, scale }) {
|
|
82
|
+
const { provides: redactionProvides } = useRedactionCapability();
|
|
83
|
+
const [rects, setRects] = useState([]);
|
|
84
|
+
const [boundingRect, setBoundingRect] = useState(null);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!redactionProvides) return;
|
|
87
|
+
return redactionProvides.onRedactionSelectionChange((formattedSelection) => {
|
|
88
|
+
const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);
|
|
89
|
+
setRects((selection == null ? void 0 : selection.segmentRects) ?? []);
|
|
90
|
+
setBoundingRect((selection == null ? void 0 : selection.rect) ?? null);
|
|
91
|
+
});
|
|
92
|
+
}, [redactionProvides, pageIndex]);
|
|
93
|
+
if (!boundingRect) return null;
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
style: {
|
|
98
|
+
mixBlendMode: "normal",
|
|
99
|
+
pointerEvents: "none",
|
|
100
|
+
position: "absolute",
|
|
101
|
+
inset: 0
|
|
102
|
+
},
|
|
103
|
+
children: /* @__PURE__ */ jsx(
|
|
104
|
+
Highlight,
|
|
105
|
+
{
|
|
106
|
+
color: "transparent",
|
|
107
|
+
opacity: 1,
|
|
108
|
+
rects,
|
|
109
|
+
scale,
|
|
110
|
+
border: "1px solid red"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
function PendingRedactions({
|
|
117
|
+
pageIndex,
|
|
118
|
+
scale,
|
|
119
|
+
bboxStroke = "rgba(0,0,0,0.8)",
|
|
120
|
+
rotation = Rotation.Degree0,
|
|
121
|
+
selectionMenu
|
|
122
|
+
}) {
|
|
123
|
+
const { provides: redaction } = useRedactionCapability();
|
|
124
|
+
const [items, setItems] = useState([]);
|
|
125
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (!redaction) return;
|
|
128
|
+
const off1 = redaction.onPendingChange((map) => setItems(map[pageIndex] ?? []));
|
|
129
|
+
const off2 = redaction.onSelectionChange((sel) => {
|
|
130
|
+
setSelectedId(sel && sel.page === pageIndex ? sel.id : null);
|
|
131
|
+
});
|
|
132
|
+
return () => {
|
|
133
|
+
off1 == null ? void 0 : off1();
|
|
134
|
+
off2 == null ? void 0 : off2();
|
|
135
|
+
};
|
|
136
|
+
}, [redaction, pageIndex]);
|
|
137
|
+
if (!items.length) return null;
|
|
138
|
+
const select = useCallback(
|
|
139
|
+
(e, id) => {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
if (!redaction) return;
|
|
142
|
+
redaction.selectPending(pageIndex, id);
|
|
143
|
+
},
|
|
144
|
+
[redaction, pageIndex]
|
|
145
|
+
);
|
|
146
|
+
return /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: items.map((it) => {
|
|
147
|
+
if (it.kind === "area") {
|
|
148
|
+
const r = it.rect;
|
|
149
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
style: {
|
|
154
|
+
position: "absolute",
|
|
155
|
+
left: r.origin.x * scale,
|
|
156
|
+
top: r.origin.y * scale,
|
|
157
|
+
width: r.size.width * scale,
|
|
158
|
+
height: r.size.height * scale,
|
|
159
|
+
background: "transparent",
|
|
160
|
+
outline: selectedId === it.id ? `1px solid ${bboxStroke}` : "none",
|
|
161
|
+
outlineOffset: "2px",
|
|
162
|
+
border: `1px solid red`,
|
|
163
|
+
pointerEvents: "auto",
|
|
164
|
+
cursor: "pointer"
|
|
165
|
+
},
|
|
166
|
+
onPointerDown: (e) => select(e, it.id),
|
|
167
|
+
onTouchStart: (e) => select(e, it.id)
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ jsx(
|
|
171
|
+
CounterRotate,
|
|
172
|
+
{
|
|
173
|
+
rect: {
|
|
174
|
+
origin: { x: r.origin.x * scale, y: r.origin.y * scale },
|
|
175
|
+
size: { width: r.size.width * scale, height: r.size.height * scale }
|
|
176
|
+
},
|
|
177
|
+
rotation,
|
|
178
|
+
children: ({ rect, menuWrapperProps }) => selectionMenu && selectionMenu({
|
|
179
|
+
item: it,
|
|
180
|
+
selected: selectedId === it.id,
|
|
181
|
+
pageIndex,
|
|
182
|
+
menuWrapperProps,
|
|
183
|
+
rect
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }, it.id);
|
|
188
|
+
}
|
|
189
|
+
const b = it.boundingRect;
|
|
190
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
style: {
|
|
195
|
+
position: "absolute",
|
|
196
|
+
left: b.origin.x * scale,
|
|
197
|
+
top: b.origin.y * scale,
|
|
198
|
+
width: b.size.width * scale,
|
|
199
|
+
height: b.size.height * scale,
|
|
200
|
+
background: "transparent",
|
|
201
|
+
outline: selectedId === it.id ? `1px solid ${bboxStroke}` : "none",
|
|
202
|
+
outlineOffset: "2px",
|
|
203
|
+
pointerEvents: "auto",
|
|
204
|
+
cursor: selectedId === it.id ? "pointer" : "default"
|
|
205
|
+
},
|
|
206
|
+
children: /* @__PURE__ */ jsx(
|
|
207
|
+
Highlight,
|
|
208
|
+
{
|
|
209
|
+
rect: b,
|
|
210
|
+
rects: it.rects,
|
|
211
|
+
color: "transparent",
|
|
212
|
+
border: "1px solid red",
|
|
213
|
+
scale,
|
|
214
|
+
onClick: (e) => select(e, it.id)
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
CounterRotate,
|
|
221
|
+
{
|
|
222
|
+
rect: {
|
|
223
|
+
origin: { x: b.origin.x * scale, y: b.origin.y * scale },
|
|
224
|
+
size: { width: b.size.width * scale, height: b.size.height * scale }
|
|
225
|
+
},
|
|
226
|
+
rotation,
|
|
227
|
+
children: ({ rect, menuWrapperProps }) => selectionMenu && selectionMenu({
|
|
228
|
+
item: it,
|
|
229
|
+
selected: selectedId === it.id,
|
|
230
|
+
pageIndex,
|
|
231
|
+
menuWrapperProps,
|
|
232
|
+
rect
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] }, it.id);
|
|
237
|
+
}) });
|
|
238
|
+
}
|
|
239
|
+
const RedactionLayer = ({
|
|
240
|
+
pageIndex,
|
|
241
|
+
scale,
|
|
242
|
+
rotation = Rotation.Degree0,
|
|
243
|
+
selectionMenu
|
|
244
|
+
}) => {
|
|
245
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
246
|
+
/* @__PURE__ */ jsx(
|
|
247
|
+
PendingRedactions,
|
|
248
|
+
{
|
|
249
|
+
pageIndex,
|
|
250
|
+
scale,
|
|
251
|
+
rotation,
|
|
252
|
+
selectionMenu
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ jsx(MarqueeRedact, { pageIndex, scale }),
|
|
256
|
+
/* @__PURE__ */ jsx(SelectionRedact, { pageIndex, scale })
|
|
257
|
+
] });
|
|
258
|
+
};
|
|
259
|
+
export {
|
|
260
|
+
RedactionLayer,
|
|
261
|
+
useRedactionCapability,
|
|
262
|
+
useRedactionPlugin
|
|
263
|
+
};
|
|
264
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 { RedactionPlugin } from '@embedpdf/plugin-redaction';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n","import { useEffect, useState } from '@framework';\nimport { Rect } from '@embedpdf/models';\n\nimport { useRedactionPlugin } from '../hooks/use-redaction';\n\ninterface MarqueeRedactProps {\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 pageIndex,\n scale,\n className,\n stroke = 'red',\n fill = 'transparent',\n}: MarqueeRedactProps) => {\n const { plugin: redactionPlugin } = useRedactionPlugin();\n\n const [rect, setRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!redactionPlugin) return;\n return redactionPlugin.registerMarqueeOnPage({\n pageIndex,\n scale,\n callback: {\n onPreview: setRect,\n },\n });\n }, [redactionPlugin, pageIndex]);\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 = 0.5,\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';\n\nimport { useEffect, useState } from '@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { Highlight } from './highlight';\n\ninterface SelectionRedactProps {\n pageIndex: number;\n scale: number;\n}\n\nexport function SelectionRedact({ pageIndex, scale }: SelectionRedactProps) {\n const { provides: redactionProvides } = useRedactionCapability();\n const [rects, setRects] = useState<Array<Rect>>([]);\n const [boundingRect, setBoundingRect] = useState<Rect | null>(null);\n\n useEffect(() => {\n if (!redactionProvides) return;\n\n return redactionProvides.onRedactionSelectionChange((formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n setRects(selection?.segmentRects ?? []);\n setBoundingRect(selection?.rect ?? null);\n });\n }, [redactionProvides, 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/core/@framework';\nimport { useRedactionCapability } from '../hooks';\nimport { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { Highlight } from './highlight';\nimport { SelectionMenuProps } from './types';\nimport { Rotation } from '@embedpdf/models';\n\ninterface PendingRedactionsProps {\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n bboxStroke?: string;\n selectionMenu?: (props: SelectionMenuProps) => JSX.Element;\n}\n\nexport function PendingRedactions({\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 const off1 = redaction.onPendingChange((map) => setItems(map[pageIndex] ?? []));\n const off2 = redaction.onSelectionChange((sel) => {\n setSelectedId(sel && sel.page === pageIndex ? sel.id : null);\n });\n return () => {\n off1?.();\n off2?.();\n };\n }, [redaction, pageIndex]);\n\n if (!items.length) return null;\n\n const select = useCallback(\n (e: MouseEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n if (!redaction) return;\n redaction.selectPending(pageIndex, id);\n },\n [redaction, pageIndex],\n );\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 <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 {({ rect, menuWrapperProps }) =>\n selectionMenu &&\n selectionMenu({\n item: it,\n selected: selectedId === it.id,\n pageIndex,\n menuWrapperProps,\n rect,\n })\n }\n </CounterRotate>\n </Fragment>\n );\n }\n // kind === 'text' → draw bounding box; inner rects are not drawn here to avoid clutter.\n const b = it.boundingRect;\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 <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 {({ rect, menuWrapperProps }) =>\n selectionMenu &&\n selectionMenu({\n item: it,\n selected: selectedId === it.id,\n pageIndex,\n menuWrapperProps,\n rect,\n })\n }\n </CounterRotate>\n </Fragment>\n );\n })}\n </div>\n );\n}\n","import { Fragment } from '@framework';\nimport { MarqueeRedact } from './marquee-redact';\nimport { SelectionRedact } from './selection-redact';\nimport { PendingRedactions } from './pending-redactions';\nimport { Rotation } from '@embedpdf/models';\nimport { SelectionMenuProps } from './types';\n\ninterface RedactionLayerProps {\n pageIndex: number;\n scale: number;\n rotation: Rotation;\n selectionMenu?: (props: SelectionMenuProps) => JSX.Element;\n}\n\nexport const RedactionLayer = ({\n pageIndex,\n scale,\n rotation = Rotation.Degree0,\n selectionMenu,\n}: RedactionLayerProps) => {\n return (\n <Fragment>\n <PendingRedactions\n pageIndex={pageIndex}\n scale={scale}\n rotation={rotation}\n selectionMenu={selectionMenu}\n />\n <MarqueeRedact pageIndex={pageIndex} scale={scale} />\n <SelectionRedact pageIndex={pageIndex} scale={scale} />\n </Fragment>\n );\n};\n"],"names":["Fragment"],"mappings":";;;;;AAGO,MAAM,qBAAqB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M;AAAA,cACN,OAAO,GAAG;AAAA,cACV,OAAM;AAAA,cACN,QAAO;AAAA,cACP;AAAA,cACA,SAAS,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;AAAA,YAAA;AAAA,UAAA;AAAA,QACjC;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,YACJ,QAAQ,EAAE,GAAG,EAAE,OAAO,IAAI,OAAO,GAAG,EAAE,OAAO,IAAI,MAAM;AAAA,YACvD,MAAM,EAAE,OAAO,EAAE,KAAK,QAAQ,OAAO,QAAQ,EAAE,KAAK,SAAS,MAAM;AAAA,UACrE;AAAA,UACA;AAAA,UAEC,WAAC,EAAE,MAAM,iBAAiB,MACzB,iBACA,cAAc;AAAA,YACZ,MAAM;AAAA,YACN,UAAU,eAAe,GAAG;AAAA,YAC5B;AAAA,YACA;AAAA,YACA;AAAA,UACD,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEL,EAAA,GAzCa,GAAG,EA0ClB;AAAA,EAEH,CAAA,GACH;AAEJ;ACnIO,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,WAAW,SAAS;AAAA,EACpB;AACF,MAA2B;AACzB,8BACGA,YACC,EAAA,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,IACA,oBAAC,eAAc,EAAA,WAAsB,MAAc,CAAA;AAAA,IACnD,oBAAC,iBAAgB,EAAA,WAAsB,MAAc,CAAA;AAAA,EAAA,GACvD;AAEJ;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../preact/adapter.ts';
|
|
2
|
+
import { Rect } from '@embedpdf/models';
|
|
3
|
+
type HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
|
+
color?: string;
|
|
5
|
+
opacity?: number;
|
|
6
|
+
border?: string;
|
|
7
|
+
rects: Rect[];
|
|
8
|
+
rect?: Rect;
|
|
9
|
+
scale: number;
|
|
10
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
export declare function Highlight({ color, opacity, border, rects, rect, scale, onClick, style, ...props }: HighlightProps): import("preact").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './redaction-layer';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface MarqueeRedactProps {
|
|
2
|
+
/** Index of the page this layer lives on */
|
|
3
|
+
pageIndex: number;
|
|
4
|
+
/** Scale of the page */
|
|
5
|
+
scale: number;
|
|
6
|
+
/** Optional CSS class applied to the marquee rectangle */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Stroke / fill colours (defaults below) */
|
|
9
|
+
stroke?: string;
|
|
10
|
+
fill?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const MarqueeRedact: ({ pageIndex, scale, className, stroke, fill, }: MarqueeRedactProps) => import("preact").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectionMenuProps } from './types';
|
|
2
|
+
import { Rotation } from '@embedpdf/models';
|
|
3
|
+
interface PendingRedactionsProps {
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
scale: number;
|
|
6
|
+
rotation: Rotation;
|
|
7
|
+
bboxStroke?: string;
|
|
8
|
+
selectionMenu?: (props: SelectionMenuProps) => JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare function PendingRedactions({ pageIndex, scale, bboxStroke, rotation, selectionMenu, }: PendingRedactionsProps): import("preact").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Rotation } from '@embedpdf/models';
|
|
2
|
+
import { SelectionMenuProps } from './types';
|
|
3
|
+
interface RedactionLayerProps {
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
scale: number;
|
|
6
|
+
rotation: Rotation;
|
|
7
|
+
selectionMenu?: (props: SelectionMenuProps) => JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export declare const RedactionLayer: ({ pageIndex, scale, rotation, selectionMenu, }: RedactionLayerProps) => import("preact").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MenuWrapperProps } from '../../preact/core.ts';
|
|
2
|
+
import { Rect } from '@embedpdf/models';
|
|
3
|
+
import { RedactionItem } from '../../lib/index.ts';
|
|
4
|
+
export interface SelectionMenuProps {
|
|
5
|
+
menuWrapperProps: MenuWrapperProps;
|
|
6
|
+
pageIndex: number;
|
|
7
|
+
item: RedactionItem;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
rect: Rect;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-redaction';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RedactionPlugin } from '../../lib/index.ts';
|
|
2
|
+
export declare const useRedactionPlugin: () => {
|
|
3
|
+
plugin: RedactionPlugin | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useRedactionCapability: () => {
|
|
8
|
+
provides: Readonly<import('../../lib/index.ts').RedactionCapability> | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
ready: Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../react/adapter.ts';
|
|
2
|
+
import { Rect } from '@embedpdf/models';
|
|
3
|
+
type HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
|
+
color?: string;
|
|
5
|
+
opacity?: number;
|
|
6
|
+
border?: string;
|
|
7
|
+
rects: Rect[];
|
|
8
|
+
rect?: Rect;
|
|
9
|
+
scale: number;
|
|
10
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
export declare function Highlight({ color, opacity, border, rects, rect, scale, onClick, style, ...props }: HighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './redaction-layer';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface MarqueeRedactProps {
|
|
2
|
+
/** Index of the page this layer lives on */
|
|
3
|
+
pageIndex: number;
|
|
4
|
+
/** Scale of the page */
|
|
5
|
+
scale: number;
|
|
6
|
+
/** Optional CSS class applied to the marquee rectangle */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Stroke / fill colours (defaults below) */
|
|
9
|
+
stroke?: string;
|
|
10
|
+
fill?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const MarqueeRedact: ({ pageIndex, scale, className, stroke, fill, }: MarqueeRedactProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectionMenuProps } from './types';
|
|
2
|
+
import { Rotation } from '@embedpdf/models';
|
|
3
|
+
interface PendingRedactionsProps {
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
scale: number;
|
|
6
|
+
rotation: Rotation;
|
|
7
|
+
bboxStroke?: string;
|
|
8
|
+
selectionMenu?: (props: SelectionMenuProps) => JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare function PendingRedactions({ pageIndex, scale, bboxStroke, rotation, selectionMenu, }: PendingRedactionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Rotation } from '@embedpdf/models';
|
|
2
|
+
import { SelectionMenuProps } from './types';
|
|
3
|
+
interface RedactionLayerProps {
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
scale: number;
|
|
6
|
+
rotation: Rotation;
|
|
7
|
+
selectionMenu?: (props: SelectionMenuProps) => JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export declare const RedactionLayer: ({ pageIndex, scale, rotation, selectionMenu, }: RedactionLayerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MenuWrapperProps } from '../../react/core.ts';
|
|
2
|
+
import { Rect } from '@embedpdf/models';
|
|
3
|
+
import { RedactionItem } from '../../lib/index.ts';
|
|
4
|
+
export interface SelectionMenuProps {
|
|
5
|
+
menuWrapperProps: MenuWrapperProps;
|
|
6
|
+
pageIndex: number;
|
|
7
|
+
item: RedactionItem;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
rect: Rect;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-redaction';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RedactionPlugin } from '../../lib/index.ts';
|
|
2
|
+
export declare const useRedactionPlugin: () => {
|
|
3
|
+
plugin: RedactionPlugin | null;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useRedactionCapability: () => {
|
|
8
|
+
provides: Readonly<import('../../lib/index.ts').RedactionCapability> | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
ready: Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-redaction';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RedactionPlugin } from '../../lib/index.ts';
|
|
2
|
+
export declare const useRedactionPlugin: () => import('@embedpdf/core/vue').PluginState<RedactionPlugin>;
|
|
3
|
+
export declare const useRedactionCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib/index.ts').RedactionCapability>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core/vue"),i=require("@embedpdf/plugin-redaction");exports.useRedactionCapability=()=>e.useCapability(i.RedactionPlugin.id),exports.useRedactionPlugin=()=>e.usePlugin(i.RedactionPlugin.id);
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/vue/hooks/use-redaction.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { RedactionPlugin } from '@embedpdf/plugin-redaction';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n"],"names":["useCapability","RedactionPlugin","id","usePlugin"],"mappings":"6LAIsC,IAAMA,gBAA+BC,EAAAA,gBAAgBC,+BADzD,IAAMC,YAA2BF,EAAAA,gBAAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { usePlugin, useCapability } from "@embedpdf/core/vue";
|
|
2
|
+
import { RedactionPlugin } from "@embedpdf/plugin-redaction";
|
|
3
|
+
const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
|
|
4
|
+
const useRedactionCapability = () => useCapability(RedactionPlugin.id);
|
|
5
|
+
export {
|
|
6
|
+
useRedactionCapability,
|
|
7
|
+
useRedactionPlugin
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-redaction.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { RedactionPlugin } from '@embedpdf/plugin-redaction';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n"],"names":[],"mappings":";;AAGO,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;AAC9E,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@embedpdf/plugin-redaction",
|
|
3
|
+
"version": "1.0.18",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./preact": {
|
|
15
|
+
"types": "./dist/preact/index.d.ts",
|
|
16
|
+
"import": "./dist/preact/index.js",
|
|
17
|
+
"require": "./dist/preact/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./react": {
|
|
20
|
+
"types": "./dist/react/index.d.ts",
|
|
21
|
+
"import": "./dist/react/index.js",
|
|
22
|
+
"require": "./dist/react/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@embedpdf/models": "1.0.18"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/react": "^18.2.0",
|
|
30
|
+
"typescript": "^5.0.0",
|
|
31
|
+
"@embedpdf/build": "1.0.0",
|
|
32
|
+
"@embedpdf/plugin-selection": "1.0.18",
|
|
33
|
+
"@embedpdf/core": "1.0.18",
|
|
34
|
+
"@embedpdf/plugin-interaction-manager": "1.0.18"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"preact": "^10.26.4",
|
|
38
|
+
"react": ">=16.8.0",
|
|
39
|
+
"react-dom": ">=16.8.0",
|
|
40
|
+
"vue": ">=3.2.0",
|
|
41
|
+
"@embedpdf/core": "1.0.18",
|
|
42
|
+
"@embedpdf/plugin-interaction-manager": "1.0.18",
|
|
43
|
+
"@embedpdf/plugin-selection": "1.0.18"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"README.md"
|
|
48
|
+
],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/embedpdf/embed-pdf-viewer",
|
|
52
|
+
"directory": "packages/plugin-render"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://www.embedpdf.com/docs",
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/embedpdf/embed-pdf-viewer/issues"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build:base": "vite build --mode base",
|
|
63
|
+
"build:react": "vite build --mode react",
|
|
64
|
+
"build:preact": "vite build --mode preact",
|
|
65
|
+
"build:vue": "vite build --mode vue",
|
|
66
|
+
"build": "pnpm run clean && concurrently -c auto -n base,react,preact,vue \"vite build --mode base\" \"vite build --mode react\" \"vite build --mode preact\" \"vite build --mode vue\"",
|
|
67
|
+
"clean": "rimraf dist",
|
|
68
|
+
"lint": "eslint src --color",
|
|
69
|
+
"lint:fix": "eslint src --color --fix"
|
|
70
|
+
}
|
|
71
|
+
}
|