@embedpdf/plugin-redaction 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +752 -105
- package/dist/index.js.map +1 -1
- package/dist/lib/actions.d.ts +25 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/redaction-plugin.d.ts +98 -2
- package/dist/lib/tools.d.ts +28 -0
- package/dist/lib/types.d.ts +38 -11
- package/dist/preact/adapter.d.ts +4 -4
- package/dist/preact/annotation.d.ts +1 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +187 -11
- package/dist/preact/index.js.map +1 -1
- package/dist/react/annotation.d.ts +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +187 -11
- package/dist/react/index.js.map +1 -1
- package/dist/shared/components/annotations/index.d.ts +2 -0
- package/dist/shared/components/annotations/redact-area.d.ts +18 -0
- package/dist/shared/components/annotations/redact-highlight.d.ts +18 -0
- package/dist/shared/components/index.d.ts +3 -0
- package/dist/shared/components/redact-renderer-registration.d.ts +5 -0
- package/dist/shared/components/redact-renderers.d.ts +7 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared-preact/components/annotations/index.d.ts +2 -0
- package/dist/shared-preact/components/annotations/redact-area.d.ts +18 -0
- package/dist/shared-preact/components/annotations/redact-highlight.d.ts +18 -0
- package/dist/shared-preact/components/index.d.ts +3 -0
- package/dist/shared-preact/components/redact-renderer-registration.d.ts +5 -0
- package/dist/shared-preact/components/redact-renderers.d.ts +7 -0
- package/dist/shared-preact/index.d.ts +1 -0
- package/dist/shared-react/components/annotations/index.d.ts +2 -0
- package/dist/shared-react/components/annotations/redact-area.d.ts +18 -0
- package/dist/shared-react/components/annotations/redact-highlight.d.ts +18 -0
- package/dist/shared-react/components/index.d.ts +3 -0
- package/dist/shared-react/components/redact-renderer-registration.d.ts +5 -0
- package/dist/shared-react/components/redact-renderers.d.ts +7 -0
- package/dist/shared-react/index.d.ts +1 -0
- package/dist/svelte/components/RedactRendererRegistration.svelte.d.ts +7 -0
- package/dist/svelte/components/annotations/RedactArea.svelte.d.ts +5 -0
- package/dist/svelte/components/annotations/RedactHighlight.svelte.d.ts +5 -0
- package/dist/svelte/components/annotations/index.d.ts +2 -0
- package/dist/svelte/components/index.d.ts +3 -0
- package/dist/svelte/components/redact-renderers.d.ts +7 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +270 -22
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/annotations/index.d.ts +2 -0
- package/dist/vue/components/annotations/redact-area.vue.d.ts +6 -0
- package/dist/vue/components/annotations/redact-highlight.vue.d.ts +6 -0
- package/dist/vue/components/index.d.ts +3 -0
- package/dist/vue/components/redact-renderer-registration.vue.d.ts +13 -0
- package/dist/vue/components/redact-renderers.d.ts +7 -0
- package/dist/vue/components/types.d.ts +1 -1
- package/dist/vue/hooks/use-redaction.d.ts +2 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.ts +2 -1
- package/dist/vue/index.js +264 -59
- package/dist/vue/index.js.map +1 -1
- package/package.json +13 -9
package/dist/svelte/index.js
CHANGED
|
@@ -1,10 +1,239 @@
|
|
|
1
|
-
import
|
|
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 { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/svelte";
|
|
5
4
|
import "svelte/internal/disclose-version";
|
|
6
|
-
import
|
|
5
|
+
import * as $ from "svelte/internal/client";
|
|
6
|
+
import { onMount } from "svelte";
|
|
7
|
+
import { createRenderer, getRendererRegistry } from "@embedpdf/plugin-annotation/svelte";
|
|
8
|
+
import { PdfStandardFont, PdfTextAlignment, textAlignmentToCss, standardFontCss, PdfAnnotationSubtype, Rotation } from "@embedpdf/models";
|
|
9
|
+
import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/svelte";
|
|
7
10
|
import { CounterRotate } from "@embedpdf/utils/svelte";
|
|
11
|
+
var root_2 = $.from_html(`<span> </span>`);
|
|
12
|
+
var root_1$5 = $.from_html(`<div role="button" tabindex="0"><!></div>`);
|
|
13
|
+
var root$2 = $.from_html(`<div role="group"></div>`);
|
|
14
|
+
function RedactHighlight($$anchor, $$props) {
|
|
15
|
+
$.push($$props, true);
|
|
16
|
+
let isHovered = $.state(false);
|
|
17
|
+
const object = $.derived(() => $$props.annotation.object);
|
|
18
|
+
const segmentRects = $.derived(() => $.get(object).segmentRects ?? []);
|
|
19
|
+
const rect = $.derived(() => $.get(object).rect);
|
|
20
|
+
const strokeColor = $.derived(() => $.get(object).strokeColor ?? "#FF0000");
|
|
21
|
+
const color = $.derived(() => $.get(object).color ?? "#000000");
|
|
22
|
+
const opacity = $.derived(() => $.get(object).opacity ?? 1);
|
|
23
|
+
const textColor = $.derived(() => $.get(object).fontColor ?? $.get(object).overlayColor ?? "#FFFFFF");
|
|
24
|
+
const overlayText = $.derived(() => $.get(object).overlayText);
|
|
25
|
+
const overlayTextRepeat = $.derived(() => $.get(object).overlayTextRepeat ?? false);
|
|
26
|
+
const fontSize = $.derived(() => $.get(object).fontSize ?? 12);
|
|
27
|
+
const fontFamily = $.derived(() => $.get(object).fontFamily ?? PdfStandardFont.Helvetica);
|
|
28
|
+
const textAlign = $.derived(() => $.get(object).textAlign ?? PdfTextAlignment.Center);
|
|
29
|
+
function renderOverlayText() {
|
|
30
|
+
if (!$.get(overlayText)) return null;
|
|
31
|
+
if (!$.get(overlayTextRepeat)) return $.get(overlayText);
|
|
32
|
+
const reps = 10;
|
|
33
|
+
return Array(reps).fill($.get(overlayText)).join(" ");
|
|
34
|
+
}
|
|
35
|
+
const justifyContent = $.derived(() => $.get(textAlign) === PdfTextAlignment.Left ? "flex-start" : $.get(textAlign) === PdfTextAlignment.Right ? "flex-end" : "center");
|
|
36
|
+
var div = root$2();
|
|
37
|
+
$.set_style(div, "", {}, { position: "absolute", inset: "0" });
|
|
38
|
+
$.each(div, 21, () => $.get(segmentRects), $.index, ($$anchor2, b) => {
|
|
39
|
+
const left = $.derived(() => ($.get(rect) ? $.get(b).origin.x - $.get(rect).origin.x : $.get(b).origin.x) * $$props.scale);
|
|
40
|
+
const top = $.derived(() => ($.get(rect) ? $.get(b).origin.y - $.get(rect).origin.y : $.get(b).origin.y) * $$props.scale);
|
|
41
|
+
const width = $.derived(() => $.get(b).size.width * $$props.scale);
|
|
42
|
+
const height = $.derived(() => $.get(b).size.height * $$props.scale);
|
|
43
|
+
const scaledFontSize = $.derived(() => Math.min($.get(fontSize) * $$props.scale, $.get(height) * 0.8));
|
|
44
|
+
var div_1 = root_1$5();
|
|
45
|
+
div_1.__pointerdown = function(...$$args) {
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
|
|
48
|
+
};
|
|
49
|
+
div_1.__touchstart = function(...$$args) {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = $$props.onClick) == null ? void 0 : _a.apply(this, $$args);
|
|
52
|
+
};
|
|
53
|
+
let styles;
|
|
54
|
+
var node = $.child(div_1);
|
|
55
|
+
{
|
|
56
|
+
var consequent = ($$anchor3) => {
|
|
57
|
+
var span = root_2();
|
|
58
|
+
let styles_1;
|
|
59
|
+
var text = $.child(span, true);
|
|
60
|
+
$.reset(span);
|
|
61
|
+
$.template_effect(
|
|
62
|
+
($0, $1) => {
|
|
63
|
+
styles_1 = $.set_style(span, "", styles_1, $0);
|
|
64
|
+
$.set_text(text, $1);
|
|
65
|
+
},
|
|
66
|
+
[
|
|
67
|
+
() => ({
|
|
68
|
+
color: $.get(textColor),
|
|
69
|
+
"font-size": `${$.get(scaledFontSize) ?? ""}px`,
|
|
70
|
+
"font-family": standardFontCss($.get(fontFamily)),
|
|
71
|
+
"text-align": textAlignmentToCss($.get(textAlign)),
|
|
72
|
+
"white-space": $.get(overlayTextRepeat) ? "normal" : "nowrap",
|
|
73
|
+
overflow: "hidden",
|
|
74
|
+
"text-overflow": "ellipsis",
|
|
75
|
+
"line-height": "1"
|
|
76
|
+
}),
|
|
77
|
+
renderOverlayText
|
|
78
|
+
]
|
|
79
|
+
);
|
|
80
|
+
$.append($$anchor3, span);
|
|
81
|
+
};
|
|
82
|
+
$.if(node, ($$render) => {
|
|
83
|
+
if ($.get(isHovered) && $.get(overlayText)) $$render(consequent);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
$.reset(div_1);
|
|
87
|
+
$.template_effect(() => styles = $.set_style(div_1, "", styles, {
|
|
88
|
+
position: "absolute",
|
|
89
|
+
left: `${$.get(left) ?? ""}px`,
|
|
90
|
+
top: `${$.get(top) ?? ""}px`,
|
|
91
|
+
width: `${$.get(width) ?? ""}px`,
|
|
92
|
+
height: `${$.get(height) ?? ""}px`,
|
|
93
|
+
background: $.get(isHovered) ? $.get(color) : "transparent",
|
|
94
|
+
border: !$.get(isHovered) ? `2px solid ${$.get(strokeColor)}` : "none",
|
|
95
|
+
opacity: $.get(isHovered) ? $.get(opacity) : 1,
|
|
96
|
+
"box-sizing": "border-box",
|
|
97
|
+
"pointer-events": "auto",
|
|
98
|
+
cursor: "pointer",
|
|
99
|
+
display: "flex",
|
|
100
|
+
"align-items": "center",
|
|
101
|
+
"justify-content": $.get(justifyContent),
|
|
102
|
+
overflow: "hidden"
|
|
103
|
+
}));
|
|
104
|
+
$.append($$anchor2, div_1);
|
|
105
|
+
});
|
|
106
|
+
$.reset(div);
|
|
107
|
+
$.event("mouseenter", div, () => $.set(isHovered, true));
|
|
108
|
+
$.event("mouseleave", div, () => $.set(isHovered, false));
|
|
109
|
+
$.append($$anchor, div);
|
|
110
|
+
$.pop();
|
|
111
|
+
}
|
|
112
|
+
$.delegate(["pointerdown", "touchstart"]);
|
|
113
|
+
var root_1$4 = $.from_html(`<span> </span>`);
|
|
114
|
+
var root$1 = $.from_html(`<div role="button" tabindex="0"><!></div>`);
|
|
115
|
+
function RedactArea($$anchor, $$props) {
|
|
116
|
+
$.push($$props, true);
|
|
117
|
+
let isHovered = $.state(false);
|
|
118
|
+
const object = $.derived(() => $$props.annotation.object);
|
|
119
|
+
const strokeColor = $.derived(() => $.get(object).strokeColor ?? "#FF0000");
|
|
120
|
+
const color = $.derived(() => $.get(object).color ?? "#000000");
|
|
121
|
+
const opacity = $.derived(() => $.get(object).opacity ?? 1);
|
|
122
|
+
const textColor = $.derived(() => $.get(object).fontColor ?? $.get(object).overlayColor ?? "#FFFFFF");
|
|
123
|
+
const overlayText = $.derived(() => $.get(object).overlayText);
|
|
124
|
+
const overlayTextRepeat = $.derived(() => $.get(object).overlayTextRepeat ?? false);
|
|
125
|
+
const fontSize = $.derived(() => $.get(object).fontSize ?? 12);
|
|
126
|
+
const fontFamily = $.derived(() => $.get(object).fontFamily ?? PdfStandardFont.Helvetica);
|
|
127
|
+
const textAlign = $.derived(() => $.get(object).textAlign ?? PdfTextAlignment.Center);
|
|
128
|
+
function renderOverlayText() {
|
|
129
|
+
if (!$.get(overlayText)) return null;
|
|
130
|
+
if (!$.get(overlayTextRepeat)) return $.get(overlayText);
|
|
131
|
+
const reps = 10;
|
|
132
|
+
return Array(reps).fill($.get(overlayText)).join(" ");
|
|
133
|
+
}
|
|
134
|
+
const justifyContent = $.derived(() => $.get(textAlign) === PdfTextAlignment.Left ? "flex-start" : $.get(textAlign) === PdfTextAlignment.Right ? "flex-end" : "center");
|
|
135
|
+
var div = root$1();
|
|
136
|
+
div.__pointerdown = (e) => {
|
|
137
|
+
if (!$$props.isSelected) $$props.onClick(e);
|
|
138
|
+
};
|
|
139
|
+
div.__touchstart = (e) => {
|
|
140
|
+
if (!$$props.isSelected) $$props.onClick(e);
|
|
141
|
+
};
|
|
142
|
+
let styles;
|
|
143
|
+
var node = $.child(div);
|
|
144
|
+
{
|
|
145
|
+
var consequent = ($$anchor2) => {
|
|
146
|
+
var span = root_1$4();
|
|
147
|
+
let styles_1;
|
|
148
|
+
var text = $.child(span, true);
|
|
149
|
+
$.reset(span);
|
|
150
|
+
$.template_effect(
|
|
151
|
+
($0, $1) => {
|
|
152
|
+
styles_1 = $.set_style(span, "", styles_1, $0);
|
|
153
|
+
$.set_text(text, $1);
|
|
154
|
+
},
|
|
155
|
+
[
|
|
156
|
+
() => ({
|
|
157
|
+
color: $.get(textColor),
|
|
158
|
+
"font-size": `${$.get(fontSize) * $$props.scale}px`,
|
|
159
|
+
"font-family": standardFontCss($.get(fontFamily)),
|
|
160
|
+
"text-align": textAlignmentToCss($.get(textAlign)),
|
|
161
|
+
"white-space": $.get(overlayTextRepeat) ? "normal" : "nowrap",
|
|
162
|
+
overflow: "hidden",
|
|
163
|
+
"text-overflow": "ellipsis",
|
|
164
|
+
padding: "4px"
|
|
165
|
+
}),
|
|
166
|
+
renderOverlayText
|
|
167
|
+
]
|
|
168
|
+
);
|
|
169
|
+
$.append($$anchor2, span);
|
|
170
|
+
};
|
|
171
|
+
$.if(node, ($$render) => {
|
|
172
|
+
if ($.get(isHovered) && $.get(overlayText)) $$render(consequent);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
$.reset(div);
|
|
176
|
+
$.template_effect(() => styles = $.set_style(div, "", styles, {
|
|
177
|
+
position: "absolute",
|
|
178
|
+
inset: "0",
|
|
179
|
+
background: $.get(isHovered) ? $.get(color) : "transparent",
|
|
180
|
+
border: !$.get(isHovered) ? `2px solid ${$.get(strokeColor)}` : "none",
|
|
181
|
+
opacity: $.get(isHovered) ? $.get(opacity) : 1,
|
|
182
|
+
"box-sizing": "border-box",
|
|
183
|
+
"pointer-events": "auto",
|
|
184
|
+
cursor: $$props.isSelected ? "move" : "pointer",
|
|
185
|
+
display: "flex",
|
|
186
|
+
"align-items": "center",
|
|
187
|
+
"justify-content": $.get(justifyContent),
|
|
188
|
+
overflow: "hidden"
|
|
189
|
+
}));
|
|
190
|
+
$.event("mouseenter", div, () => $.set(isHovered, true));
|
|
191
|
+
$.event("mouseleave", div, () => $.set(isHovered, false));
|
|
192
|
+
$.append($$anchor, div);
|
|
193
|
+
$.pop();
|
|
194
|
+
}
|
|
195
|
+
$.delegate(["pointerdown", "touchstart"]);
|
|
196
|
+
const redactRenderers = [
|
|
197
|
+
createRenderer({
|
|
198
|
+
id: "redactHighlight",
|
|
199
|
+
matches: (a) => {
|
|
200
|
+
var _a;
|
|
201
|
+
return a.type === PdfAnnotationSubtype.REDACT && "segmentRects" in a && (((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
202
|
+
},
|
|
203
|
+
component: RedactHighlight
|
|
204
|
+
}),
|
|
205
|
+
createRenderer({
|
|
206
|
+
id: "redactArea",
|
|
207
|
+
matches: (a) => {
|
|
208
|
+
var _a;
|
|
209
|
+
return a.type === PdfAnnotationSubtype.REDACT && (!("segmentRects" in a) || !(((_a = a.segmentRects) == null ? void 0 : _a.length) ?? 0));
|
|
210
|
+
},
|
|
211
|
+
component: RedactArea
|
|
212
|
+
})
|
|
213
|
+
];
|
|
214
|
+
function RedactRendererRegistration($$anchor, $$props) {
|
|
215
|
+
$.push($$props, true);
|
|
216
|
+
const registry = getRendererRegistry();
|
|
217
|
+
onMount(() => {
|
|
218
|
+
if (!registry) return;
|
|
219
|
+
return registry.register(redactRenderers);
|
|
220
|
+
});
|
|
221
|
+
var fragment = $.comment();
|
|
222
|
+
var node = $.first_child(fragment);
|
|
223
|
+
{
|
|
224
|
+
var consequent = ($$anchor2) => {
|
|
225
|
+
var fragment_1 = $.comment();
|
|
226
|
+
var node_1 = $.first_child(fragment_1);
|
|
227
|
+
$.snippet(node_1, () => $$props.children);
|
|
228
|
+
$.append($$anchor2, fragment_1);
|
|
229
|
+
};
|
|
230
|
+
$.if(node, ($$render) => {
|
|
231
|
+
if ($$props.children) $$render(consequent);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
$.append($$anchor, fragment);
|
|
235
|
+
$.pop();
|
|
236
|
+
}
|
|
8
237
|
const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
|
|
9
238
|
const useRedactionCapability = () => useCapability(RedactionPlugin.id);
|
|
10
239
|
const useRedaction = (getDocumentId) => {
|
|
@@ -41,7 +270,7 @@ const useRedaction = (getDocumentId) => {
|
|
|
41
270
|
var root_1$3 = $.from_html(`<div></div>`);
|
|
42
271
|
function Highlight($$anchor, $$props) {
|
|
43
272
|
let color = $.prop($$props, "color", 3, "#FFFF00"), opacity = $.prop($$props, "opacity", 3, 1), border = $.prop($$props, "border", 3, "1px solid red"), style = $.prop($$props, "style", 3, "");
|
|
44
|
-
const boundingRect = $$props.rect;
|
|
273
|
+
const boundingRect = $.derived(() => $$props.rect);
|
|
45
274
|
var fragment = $.comment();
|
|
46
275
|
var node = $.first_child(fragment);
|
|
47
276
|
$.each(node, 17, () => $$props.rects, $.index, ($$anchor2, b) => {
|
|
@@ -58,8 +287,8 @@ function Highlight($$anchor, $$props) {
|
|
|
58
287
|
$.template_effect(() => styles = $.set_style(div, style(), styles, {
|
|
59
288
|
position: "absolute",
|
|
60
289
|
border: border(),
|
|
61
|
-
left: `${(boundingRect ? $.get(b).origin.x - boundingRect.origin.x : $.get(b).origin.x) * $$props.scale}px`,
|
|
62
|
-
top: `${(boundingRect ? $.get(b).origin.y - boundingRect.origin.y : $.get(b).origin.y) * $$props.scale}px`,
|
|
290
|
+
left: `${($.get(boundingRect) ? $.get(b).origin.x - $.get(boundingRect).origin.x : $.get(b).origin.x) * $$props.scale}px`,
|
|
291
|
+
top: `${($.get(boundingRect) ? $.get(b).origin.y - $.get(boundingRect).origin.y : $.get(b).origin.y) * $$props.scale}px`,
|
|
63
292
|
width: `${$.get(b).size.width * $$props.scale}px`,
|
|
64
293
|
height: `${$.get(b).size.height * $$props.scale}px`,
|
|
65
294
|
background: color(),
|
|
@@ -76,7 +305,7 @@ $.delegate(["pointerdown", "touchstart"]);
|
|
|
76
305
|
var root_1$2 = $.from_html(`<div></div>`);
|
|
77
306
|
function Marquee_redact($$anchor, $$props) {
|
|
78
307
|
$.push($$props, true);
|
|
79
|
-
let className = $.prop($$props, "className", 3, ""),
|
|
308
|
+
let className = $.prop($$props, "className", 3, ""), fill = $.prop($$props, "fill", 3, "transparent");
|
|
80
309
|
const redactionPlugin = useRedactionPlugin();
|
|
81
310
|
const documentState = useDocumentState(() => $$props.documentId);
|
|
82
311
|
let rect = $.state(null);
|
|
@@ -84,6 +313,10 @@ function Marquee_redact($$anchor, $$props) {
|
|
|
84
313
|
var _a;
|
|
85
314
|
return $$props.scale !== void 0 ? $$props.scale : ((_a = documentState.current) == null ? void 0 : _a.scale) ?? 1;
|
|
86
315
|
});
|
|
316
|
+
const strokeColor = $.derived(() => {
|
|
317
|
+
var _a;
|
|
318
|
+
return $$props.stroke ?? ((_a = redactionPlugin.plugin) == null ? void 0 : _a.getPreviewStrokeColor()) ?? "red";
|
|
319
|
+
});
|
|
87
320
|
$.user_effect(() => {
|
|
88
321
|
if (!redactionPlugin.plugin || !$$props.documentId) {
|
|
89
322
|
$.set(rect, null);
|
|
@@ -115,7 +348,7 @@ function Marquee_redact($$anchor, $$props) {
|
|
|
115
348
|
top: `${$.get(rect).origin.y * $.get(actualScale)}px`,
|
|
116
349
|
width: `${$.get(rect).size.width * $.get(actualScale)}px`,
|
|
117
350
|
height: `${$.get(rect).size.height * $.get(actualScale)}px`,
|
|
118
|
-
border: `1px solid ${
|
|
351
|
+
border: `1px solid ${$.get(strokeColor)}`,
|
|
119
352
|
background: fill(),
|
|
120
353
|
"box-sizing": "border-box"
|
|
121
354
|
});
|
|
@@ -148,10 +381,10 @@ function Pending_redactions($$anchor, $$props) {
|
|
|
148
381
|
}
|
|
149
382
|
const scoped = redactionValue.forDocument($$props.documentId);
|
|
150
383
|
const currentState = scoped.getState();
|
|
151
|
-
$.set(items, currentState.pending[$$props.pageIndex] ?? [], true);
|
|
384
|
+
$.set(items, (currentState.pending[$$props.pageIndex] ?? []).filter((it) => it.source === "legacy"), true);
|
|
152
385
|
$.set(selectedId, ((_a = currentState.selected) == null ? void 0 : _a.page) === $$props.pageIndex ? currentState.selected.id : null, true);
|
|
153
386
|
const off1 = scoped.onPendingChange((map) => {
|
|
154
|
-
$.set(items, map[$$props.pageIndex] ?? [], true);
|
|
387
|
+
$.set(items, (map[$$props.pageIndex] ?? []).filter((it) => it.source === "legacy"), true);
|
|
155
388
|
});
|
|
156
389
|
const off2 = scoped.onSelectedChange((sel) => {
|
|
157
390
|
$.set(selectedId, (sel == null ? void 0 : sel.page) === $$props.pageIndex ? sel.id : null, true);
|
|
@@ -435,6 +668,10 @@ function Selection_redact($$anchor, $$props) {
|
|
|
435
668
|
const redactionPlugin = useRedactionPlugin();
|
|
436
669
|
let rects = $.state($.proxy([]));
|
|
437
670
|
let boundingRect = $.state(null);
|
|
671
|
+
const strokeColor = $.derived(() => {
|
|
672
|
+
var _a;
|
|
673
|
+
return ((_a = redactionPlugin.plugin) == null ? void 0 : _a.getPreviewStrokeColor()) ?? "red";
|
|
674
|
+
});
|
|
438
675
|
$.user_effect(() => {
|
|
439
676
|
if (!redactionPlugin.plugin) {
|
|
440
677
|
$.set(rects, [], true);
|
|
@@ -459,17 +696,22 @@ function Selection_redact($$anchor, $$props) {
|
|
|
459
696
|
inset: "0"
|
|
460
697
|
});
|
|
461
698
|
var node_1 = $.child(div);
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
699
|
+
{
|
|
700
|
+
let $0 = $.derived(() => `1px solid ${$.get(strokeColor)}`);
|
|
701
|
+
Highlight(node_1, {
|
|
702
|
+
color: "transparent",
|
|
703
|
+
opacity: 1,
|
|
704
|
+
get rects() {
|
|
705
|
+
return $.get(rects);
|
|
706
|
+
},
|
|
707
|
+
get scale() {
|
|
708
|
+
return $$props.scale;
|
|
709
|
+
},
|
|
710
|
+
get border() {
|
|
711
|
+
return $.get($0);
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
}
|
|
473
715
|
$.reset(div);
|
|
474
716
|
$.append($$anchor2, div);
|
|
475
717
|
};
|
|
@@ -541,12 +783,18 @@ function Redaction_layer($$anchor, $$props) {
|
|
|
541
783
|
$.append($$anchor, fragment);
|
|
542
784
|
$.pop();
|
|
543
785
|
}
|
|
786
|
+
const RedactionPluginPackage = createPluginPackage(RedactionPluginPackage$1).addUtility(RedactRendererRegistration).build();
|
|
544
787
|
export {
|
|
545
788
|
Highlight,
|
|
546
789
|
Marquee_redact as MarqueeRedact,
|
|
547
790
|
Pending_redactions as PendingRedactions,
|
|
791
|
+
RedactArea,
|
|
792
|
+
RedactHighlight,
|
|
793
|
+
RedactRendererRegistration,
|
|
548
794
|
Redaction_layer as RedactionLayer,
|
|
795
|
+
RedactionPluginPackage,
|
|
549
796
|
Selection_redact as SelectionRedact,
|
|
797
|
+
redactRenderers,
|
|
550
798
|
useRedaction,
|
|
551
799
|
useRedactionCapability,
|
|
552
800
|
useRedactionPlugin
|
package/dist/svelte/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/svelte/hooks/use-redaction.svelte.ts","../../src/svelte/components/highlight.svelte","../../src/svelte/components/marquee-redact.svelte","../../src/svelte/components/pending-redactions.svelte","../../src/svelte/components/selection-redact.svelte","../../src/svelte/components/redaction-layer.svelte"],"sourcesContent":["import {\n RedactionPlugin,\n initialDocumentState,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useCapability, usePlugin } from '@embedpdf/core/svelte';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseRedactionReturn {\n provides: RedactionScope | null;\n state: RedactionDocumentState;\n}\n\n/**\n * Hook for redaction state for a specific document\n * @param getDocumentId Document ID getter function\n */\nexport const useRedaction = (getDocumentId: () => string | null): UseRedactionReturn => {\n const capability = useRedactionCapability();\n\n let state = $state<RedactionDocumentState>(initialDocumentState);\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state = initialDocumentState;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Get initial state\n try {\n state = scope.getState();\n } catch (e) {\n // Handle case where state might not be ready\n state = initialDocumentState;\n }\n\n // Subscribe to state changes for THIS docId\n return scope.onStateChange((newState) => {\n state = newState;\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","<script lang=\"ts\">\n import type { Rect } from '@embedpdf/models';\n\n interface HighlightProps {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent | TouchEvent) => void;\n style?: string;\n }\n\n let {\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style = '',\n }: HighlightProps = $props();\n\n // Rename rect to boundingRect for clarity\n const boundingRect = rect;\n</script>\n\n{#each rects as b, i (i)}\n <div\n onpointerdown={onClick}\n ontouchstart={onClick}\n style:position=\"absolute\"\n style:border\n style:left={`${(boundingRect ? b.origin.x - boundingRect.origin.x : b.origin.x) * scale}px`}\n style:top={`${(boundingRect ? b.origin.y - boundingRect.origin.y : b.origin.y) * scale}px`}\n style:width={`${b.size.width * scale}px`}\n style:height={`${b.size.height * scale}px`}\n style:background={color}\n style:opacity\n style:pointer-events={onClick ? 'auto' : 'none'}\n style:cursor={onClick ? 'pointer' : 'default'}\n style:z-index={onClick ? '1' : undefined}\n {style}\n ></div>\n{/each}\n","<script lang=\"ts\">\n import { useDocumentState } from '@embedpdf/core/svelte';\n import type { Rect } from '@embedpdf/models';\n import { useRedactionPlugin } from '../hooks/use-redaction.svelte';\n\n interface 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\n let {\n documentId,\n pageIndex,\n scale: scaleOverride,\n className = '',\n stroke = 'red',\n fill = 'transparent',\n }: MarqueeRedactProps = $props();\n\n const redactionPlugin = useRedactionPlugin();\n const documentState = useDocumentState(() => documentId);\n let rect = $state<Rect | null>(null);\n\n const actualScale = $derived(\n scaleOverride !== undefined ? scaleOverride : (documentState.current?.scale ?? 1),\n );\n\n $effect(() => {\n if (!redactionPlugin.plugin || !documentId) {\n rect = null;\n return;\n }\n\n return redactionPlugin.plugin.registerMarqueeOnPage({\n documentId,\n pageIndex,\n scale: actualScale,\n callback: {\n onPreview: (newRect) => {\n rect = newRect;\n },\n },\n });\n });\n</script>\n\n{#if rect}\n <div\n class={className}\n style:position=\"absolute\"\n style:pointer-events=\"none\"\n style:left={`${rect.origin.x * actualScale}px`}\n style:top={`${rect.origin.y * actualScale}px`}\n style:width={`${rect.size.width * actualScale}px`}\n style:height={`${rect.size.height * actualScale}px`}\n style:border={`1px solid ${stroke}`}\n style:background={fill}\n style:box-sizing=\"border-box\"\n ></div>\n{/if}\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import type { Rect } from '@embedpdf/models';\n import { Rotation } from '@embedpdf/models';\n import { CounterRotate } from '@embedpdf/utils/svelte';\n import type { MenuWrapperProps, SelectionMenuPlacement } from '@embedpdf/utils/svelte';\n import type { RedactionItem } from '@embedpdf/plugin-redaction';\n import { useRedactionCapability } from '../hooks/use-redaction.svelte';\n import Highlight from './highlight.svelte';\n import type {\n RedactionSelectionContext,\n RedactionSelectionMenuRenderFn,\n RedactionSelectionMenuProps,\n } from '../types';\n\n interface Props {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation?: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n selectionMenuSnippet?: Snippet<[RedactionSelectionMenuProps]>;\n }\n\n let {\n documentId,\n pageIndex,\n scale,\n rotation = Rotation.Degree0,\n bboxStroke = 'rgba(0,0,0,0.8)',\n selectionMenu,\n selectionMenuSnippet,\n }: Props = $props();\n\n const redactionCapability = useRedactionCapability();\n\n let items = $state<RedactionItem[]>([]);\n let selectedId = $state<string | null>(null);\n\n $effect(() => {\n const redactionValue = redactionCapability.provides;\n if (!redactionValue) {\n items = [];\n selectedId = null;\n return;\n }\n\n const scoped = redactionValue.forDocument(documentId);\n const currentState = scoped.getState();\n items = currentState.pending[pageIndex] ?? [];\n selectedId = currentState.selected?.page === pageIndex ? currentState.selected.id : null;\n\n const off1 = scoped.onPendingChange((map) => {\n items = map[pageIndex] ?? [];\n });\n\n const off2 = scoped.onSelectedChange((sel) => {\n selectedId = sel?.page === pageIndex ? sel.id : null;\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n });\n\n function select(e: MouseEvent | TouchEvent, id: string) {\n e.stopPropagation();\n if (!redactionCapability.provides) return;\n redactionCapability.provides.forDocument(documentId).selectPending(pageIndex, id);\n }\n\n function shouldShowMenu(itemId: string): boolean {\n const isSelected = selectedId === itemId;\n return isSelected && (!!selectionMenu || !!selectionMenuSnippet);\n }\n\n function buildContext(item: RedactionItem): RedactionSelectionContext {\n return { type: 'redaction', item, pageIndex };\n }\n\n const menuPlacement: SelectionMenuPlacement = {\n suggestTop: false,\n spaceAbove: 0,\n spaceBelow: 0,\n };\n\n function buildMenuProps(\n item: RedactionItem,\n rect: Rect,\n menuWrapperProps: MenuWrapperProps,\n ): RedactionSelectionMenuProps {\n return {\n context: buildContext(item),\n selected: selectedId === item.id,\n rect,\n placement: menuPlacement,\n menuWrapperProps,\n };\n }\n</script>\n\n{#if items.length}\n <div style=\"position: absolute; inset: 0; pointer-events: none;\">\n {#each items as item (item.id)}\n {#if item.kind === 'area'}\n <div\n style=\"\n position: absolute;\n left: {item.rect.origin.x * scale}px;\n top: {item.rect.origin.y * scale}px;\n width: {item.rect.size.width * scale}px;\n height: {item.rect.size.height * scale}px;\n background: transparent;\n outline: {selectedId === item.id ? `1px solid ${bboxStroke}` : 'none'};\n outline-offset: 2px;\n border: 1px solid red;\n pointer-events: auto;\n cursor: pointer;\n \"\n onpointerdown={(e) => select(e, item.id)}\n ontouchstart={(e) => select(e, item.id)}\n ></div>\n\n {#if shouldShowMenu(item.id)}\n <CounterRotate\n rect={{\n origin: { x: item.rect.origin.x * scale, y: item.rect.origin.y * scale },\n size: { width: item.rect.size.width * scale, height: item.rect.size.height * scale },\n }}\n {rotation}\n >\n {#snippet children({ rect, menuWrapperProps })}\n {@const menuProps = buildMenuProps(item, rect, menuWrapperProps)}\n {#if selectionMenu}\n {@const result = selectionMenu(menuProps)}\n {#if result}\n <result.component {...result.props} />\n {/if}\n {:else if selectionMenuSnippet}\n {@render selectionMenuSnippet(menuProps)}\n {/if}\n {/snippet}\n </CounterRotate>\n {/if}\n {:else}\n <div\n style=\"\n position: absolute;\n left: {item.rect.origin.x * scale}px;\n top: {item.rect.origin.y * scale}px;\n width: {item.rect.size.width * scale}px;\n height: {item.rect.size.height * scale}px;\n background: transparent;\n outline: {selectedId === item.id ? `1px solid ${bboxStroke}` : 'none'};\n outline-offset: 2px;\n pointer-events: auto;\n cursor: {selectedId === item.id ? 'pointer' : 'default'};\n \"\n >\n <Highlight\n rect={item.rect}\n rects={item.rects}\n color=\"transparent\"\n border=\"1px solid red\"\n {scale}\n onClick={(e) => select(e, item.id)}\n />\n </div>\n\n {#if shouldShowMenu(item.id)}\n <CounterRotate\n rect={{\n origin: { x: item.rect.origin.x * scale, y: item.rect.origin.y * scale },\n size: { width: item.rect.size.width * scale, height: item.rect.size.height * scale },\n }}\n {rotation}\n >\n {#snippet children({ rect, menuWrapperProps })}\n {@const menuProps = buildMenuProps(item, rect, menuWrapperProps)}\n {#if selectionMenu}\n {@const result = selectionMenu(menuProps)}\n {#if result}\n <result.component {...result.props} />\n {/if}\n {:else if selectionMenuSnippet}\n {@render selectionMenuSnippet(menuProps)}\n {/if}\n {/snippet}\n </CounterRotate>\n {/if}\n {/if}\n {/each}\n </div>\n{/if}\n","<script lang=\"ts\">\n import type { Rect } from '@embedpdf/models';\n import { useRedactionPlugin } from '../hooks/use-redaction.svelte';\n import Highlight from './highlight.svelte';\n\n interface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n }\n\n let { documentId, pageIndex, scale }: SelectionRedactProps = $props();\n\n const redactionPlugin = useRedactionPlugin();\n let rects = $state<Rect[]>([]);\n let boundingRect = $state<Rect | null>(null);\n\n $effect(() => {\n if (!redactionPlugin.plugin) {\n rects = [];\n boundingRect = null;\n return;\n }\n\n return redactionPlugin.plugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n rects = selection?.segmentRects ?? [];\n boundingRect = selection?.rect ?? null;\n });\n });\n</script>\n\n{#if boundingRect}\n <div\n style:mix-blend-mode=\"normal\"\n style:pointer-events=\"none\"\n style:position=\"absolute\"\n style:inset=\"0\"\n >\n <Highlight color=\"transparent\" opacity={1} {rects} {scale} border=\"1px solid red\" />\n </div>\n{/if}\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { useDocumentState } from '@embedpdf/core/svelte';\n import { Rotation } from '@embedpdf/models';\n import PendingRedactions from './pending-redactions.svelte';\n import MarqueeRedact from './marquee-redact.svelte';\n import SelectionRedact from './selection-redact.svelte';\n import type { RedactionSelectionMenuRenderFn, RedactionSelectionMenuProps } from '../types';\n\n interface 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 /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n /** Snippet for custom selection menu (slot-based approach) */\n selectionMenuSnippet?: Snippet<[RedactionSelectionMenuProps]>;\n }\n\n let {\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n selectionMenuSnippet,\n }: RedactionLayerProps = $props();\n\n const documentState = useDocumentState(() => documentId);\n\n const actualScale = $derived(scale !== undefined ? scale : (documentState.current?.scale ?? 1));\n\n const actualRotation = $derived(\n rotation !== undefined ? rotation : (documentState.current?.rotation ?? Rotation.Degree0),\n );\n</script>\n\n<PendingRedactions\n {documentId}\n {pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n {selectionMenu}\n {selectionMenuSnippet}\n/>\n<MarqueeRedact {documentId} {pageIndex} scale={actualScale} />\n<SelectionRedact {documentId} {pageIndex} scale={actualScale} />\n"],"names":["root_1","$$anchor","PendingRedactions","MarqueeRedact","SelectionRedact"],"mappings":";;;;;;;AAQa,MAAA,qBAAA,MAA2B,UAA2B,gBAAgB,EAAE;AACxE,MAAA,yBAAA,MAA+B,cAA+B,gBAAgB,EAAE;MAYhF,eAAA,CAAgB,kBAA2D;AAChF,QAAA,aAAa,uBAAA;MAEf,QAAQ,EAAA,cAA+B,oBAAoB,CAAA;AAGzD,QAAA,uBAAsB,aAAA;AAGtB,QAAA,iBAAA,EAAA,QAAA,MACJ,WAAW,kBAAY,UAAA,IAAa,WAAW,SAAS,kBAAY,UAAU,CAAA,IAAI,IAAA;AAGpF,IAAA,kBAAc;UACN,WAAW,WAAW;AACtB,UAAA,cAAQ,UAAA;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AAY,CAAA,GAAA,IAAA;AAC/B,QAAA,IAAA,eAAe,uCAAW,SAAQ,MAAI,IAAA;AAAA,IACxC,CAAC;AAAA,EACH,CAAC;;;;;UAIA,MAAE,OAAA;kBAAF,KAAE,IAAA,CAAA,GAAA;AAAA;;;;;2BAAF,GAAE;AAMA,gBAAS,QAAA;AAAA;iBAA8B;AAAA;uBAAI,KAAK;AAAA;;;;;;cANlD,GAAE;0BAAF,GAAE;AAAA;;gBADA,YAAY,EAAA,UAAA,UAAA;AAAA;;;;AAFjB;;4CC9BA;;AAiCQ,QAAA,gBAAgB,iBAAgB,MAAA,QAAA,UAAA;QAEhC,cAAW,EAAA,QAAA,MAAA;;AAAA,mBAAA,UAAsB,SAAS,QAAA,UAAY,mBAAc,YAAd,mBAAuB,UAAS;AAAA,GAAC;AAEvF,QAAA;;gCACS,8BAAwB,mBAAc,YAAd,mBAAuB,aAAY,SAAS;AAAA,GAAO;;;AAI3FC,qBAAgB,MAAA;AAAA;;;;;;;mBAGR,WAAW;AAAA;;mBACR,cAAc;AAAA;;;;;;;;;AAIzBC,iBAAa,QAAA;AAAA;;;;;;;mBAAiC,WAAW;AAAA;;;AACzDC,mBAAe,QAAA;AAAA;;;;;;;mBAAiC,WAAW;AAAA;;;;AAX5D;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/svelte/components/annotations/RedactHighlight.svelte","../../src/svelte/components/annotations/RedactArea.svelte","../../src/svelte/components/redact-renderers.ts","../../src/svelte/components/RedactRendererRegistration.svelte","../../src/svelte/hooks/use-redaction.svelte.ts","../../src/svelte/components/highlight.svelte","../../src/svelte/components/marquee-redact.svelte","../../src/svelte/components/pending-redactions.svelte","../../src/svelte/components/selection-redact.svelte","../../src/svelte/components/redaction-layer.svelte","../../src/svelte/index.ts"],"sourcesContent":["<script lang=\"ts\">\n import type { AnnotationRendererProps } from '@embedpdf/plugin-annotation/svelte';\n import type { PdfRedactAnnoObject } from '@embedpdf/models';\n import {\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCss,\n textAlignmentToCss,\n } from '@embedpdf/models';\n\n let { annotation, isSelected, scale, onClick }: AnnotationRendererProps<PdfRedactAnnoObject> =\n $props();\n let isHovered = $state(false);\n\n const object = $derived(annotation.object);\n\n const segmentRects = $derived(object.segmentRects ?? []);\n const rect = $derived(object.rect);\n\n // C - Border/stroke color\n const strokeColor = $derived(object.strokeColor ?? '#FF0000');\n // IC - Interior color (background fill when redaction is applied)\n const color = $derived(object.color ?? '#000000');\n // CA - Opacity (0-1)\n const opacity = $derived(object.opacity ?? 1);\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = $derived(object.fontColor ?? object.overlayColor ?? '#FFFFFF');\n // Overlay text properties\n const overlayText = $derived(object.overlayText);\n const overlayTextRepeat = $derived(object.overlayTextRepeat ?? false);\n const fontSize = $derived(object.fontSize ?? 12);\n const fontFamily = $derived(object.fontFamily ?? PdfStandardFont.Helvetica);\n const textAlign = $derived(object.textAlign ?? PdfTextAlignment.Center);\n\n // Calculate how many times to repeat text (approximate)\n function renderOverlayText(): string | null {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10;\n return Array(reps).fill(overlayText).join(' ');\n }\n\n const justifyContent = $derived(\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n );\n</script>\n\n<div\n role=\"group\"\n onmouseenter={() => (isHovered = true)}\n onmouseleave={() => (isHovered = false)}\n style:position=\"absolute\"\n style:inset=\"0\"\n>\n {#each segmentRects as b, i (i)}\n {@const left = (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale}\n {@const top = (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale}\n {@const width = b.size.width * scale}\n {@const height = b.size.height * scale}\n {@const scaledFontSize = Math.min(fontSize * scale, height * 0.8)}\n <div\n role=\"button\"\n tabindex=\"0\"\n onpointerdown={onClick}\n ontouchstart={onClick}\n style:position=\"absolute\"\n style:left=\"{left}px\"\n style:top=\"{top}px\"\n style:width=\"{width}px\"\n style:height=\"{height}px\"\n style:background={isHovered ? color : 'transparent'}\n style:border={!isHovered ? `2px solid ${strokeColor}` : 'none'}\n style:opacity={isHovered ? opacity : 1}\n style:box-sizing=\"border-box\"\n style:pointer-events=\"auto\"\n style:cursor=\"pointer\"\n style:display=\"flex\"\n style:align-items=\"center\"\n style:justify-content={justifyContent}\n style:overflow=\"hidden\"\n >\n {#if isHovered && overlayText}\n <span\n style:color={textColor}\n style:font-size=\"{scaledFontSize}px\"\n style:font-family={standardFontCss(fontFamily)}\n style:text-align={textAlignmentToCss(textAlign)}\n style:white-space={overlayTextRepeat ? 'normal' : 'nowrap'}\n style:overflow=\"hidden\"\n style:text-overflow=\"ellipsis\"\n style:line-height=\"1\"\n >\n {renderOverlayText()}\n </span>\n {/if}\n </div>\n {/each}\n</div>\n","<script lang=\"ts\">\n import type { AnnotationRendererProps } from '@embedpdf/plugin-annotation/svelte';\n import type { PdfRedactAnnoObject } from '@embedpdf/models';\n import {\n PdfStandardFont,\n PdfTextAlignment,\n standardFontCss,\n textAlignmentToCss,\n } from '@embedpdf/models';\n\n let { annotation, isSelected, scale, onClick }: AnnotationRendererProps<PdfRedactAnnoObject> =\n $props();\n let isHovered = $state(false);\n\n const object = $derived(annotation.object);\n\n // C - Border/stroke color\n const strokeColor = $derived(object.strokeColor ?? '#FF0000');\n // IC - Interior color (background fill when redaction is applied)\n const color = $derived(object.color ?? '#000000');\n // CA - Opacity (0-1)\n const opacity = $derived(object.opacity ?? 1);\n // OC - Overlay text color (Adobe extension), fallback to fontColor\n const textColor = $derived(object.fontColor ?? object.overlayColor ?? '#FFFFFF');\n // Overlay text properties\n const overlayText = $derived(object.overlayText);\n const overlayTextRepeat = $derived(object.overlayTextRepeat ?? false);\n const fontSize = $derived(object.fontSize ?? 12);\n const fontFamily = $derived(object.fontFamily ?? PdfStandardFont.Helvetica);\n const textAlign = $derived(object.textAlign ?? PdfTextAlignment.Center);\n\n // Calculate how many times to repeat text (approximate)\n function renderOverlayText(): string | null {\n if (!overlayText) return null;\n if (!overlayTextRepeat) return overlayText;\n // Repeat text multiple times to fill the space\n const reps = 10;\n return Array(reps).fill(overlayText).join(' ');\n }\n\n const justifyContent = $derived(\n textAlign === PdfTextAlignment.Left\n ? 'flex-start'\n : textAlign === PdfTextAlignment.Right\n ? 'flex-end'\n : 'center',\n );\n</script>\n\n<div\n role=\"button\"\n tabindex=\"0\"\n onpointerdown={(e) => {\n if (!isSelected) onClick(e);\n }}\n ontouchstart={(e) => {\n if (!isSelected) onClick(e);\n }}\n onmouseenter={() => (isHovered = true)}\n onmouseleave={() => (isHovered = false)}\n style:position=\"absolute\"\n style:inset=\"0\"\n style:background={isHovered ? color : 'transparent'}\n style:border={!isHovered ? `2px solid ${strokeColor}` : 'none'}\n style:opacity={isHovered ? opacity : 1}\n style:box-sizing=\"border-box\"\n style:pointer-events=\"auto\"\n style:cursor={isSelected ? 'move' : 'pointer'}\n style:display=\"flex\"\n style:align-items=\"center\"\n style:justify-content={justifyContent}\n style:overflow=\"hidden\"\n>\n {#if isHovered && overlayText}\n <span\n style:color={textColor}\n style:font-size=\"{fontSize * scale}px\"\n style:font-family={standardFontCss(fontFamily)}\n style:text-align={textAlignmentToCss(textAlign)}\n style:white-space={overlayTextRepeat ? 'normal' : 'nowrap'}\n style:overflow=\"hidden\"\n style:text-overflow=\"ellipsis\"\n style:padding=\"4px\"\n >\n {renderOverlayText()}\n </span>\n {/if}\n</div>\n","import { createRenderer, type BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/svelte';\nimport { PdfAnnotationSubtype, type PdfRedactAnnoObject } from '@embedpdf/models';\nimport RedactHighlight from './annotations/RedactHighlight.svelte';\nimport RedactArea from './annotations/RedactArea.svelte';\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 component: RedactHighlight,\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 component: RedactArea,\n }),\n];\n","<script lang=\"ts\">\n import { onMount } from 'svelte';\n import { getRendererRegistry } from '@embedpdf/plugin-annotation/svelte';\n import { redactRenderers } from './redact-renderers';\n import type { Snippet } from 'svelte';\n\n let { children }: { children?: Snippet } = $props();\n\n const registry = getRendererRegistry();\n\n onMount(() => {\n if (!registry) return;\n return registry.register(redactRenderers);\n });\n</script>\n\n{#if children}\n {@render children()}\n{/if}\n","import {\n RedactionPlugin,\n initialDocumentState,\n RedactionDocumentState,\n RedactionScope,\n} from '@embedpdf/plugin-redaction';\nimport { useCapability, usePlugin } from '@embedpdf/core/svelte';\n\nexport const useRedactionPlugin = () => usePlugin<RedactionPlugin>(RedactionPlugin.id);\nexport const useRedactionCapability = () => useCapability<RedactionPlugin>(RedactionPlugin.id);\n\n// Define the return type explicitly to maintain type safety\ninterface UseRedactionReturn {\n provides: RedactionScope | null;\n state: RedactionDocumentState;\n}\n\n/**\n * Hook for redaction state for a specific document\n * @param getDocumentId Document ID getter function\n */\nexport const useRedaction = (getDocumentId: () => string | null): UseRedactionReturn => {\n const capability = useRedactionCapability();\n\n let state = $state<RedactionDocumentState>(initialDocumentState);\n\n // Reactive documentId\n const documentId = $derived(getDocumentId());\n\n // Scoped capability for current docId\n const scopedProvides = $derived(\n capability.provides && documentId ? capability.provides.forDocument(documentId) : null,\n );\n\n $effect(() => {\n const provides = capability.provides;\n const docId = documentId;\n\n if (!provides || !docId) {\n state = initialDocumentState;\n return;\n }\n\n const scope = provides.forDocument(docId);\n\n // Get initial state\n try {\n state = scope.getState();\n } catch (e) {\n // Handle case where state might not be ready\n state = initialDocumentState;\n }\n\n // Subscribe to state changes for THIS docId\n return scope.onStateChange((newState) => {\n state = newState;\n });\n });\n\n return {\n get provides() {\n return scopedProvides;\n },\n get state() {\n return state;\n },\n };\n};\n","<script lang=\"ts\">\n import type { Rect } from '@embedpdf/models';\n\n interface HighlightProps {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: MouseEvent | TouchEvent) => void;\n style?: string;\n }\n\n let {\n color = '#FFFF00',\n opacity = 1,\n border = '1px solid red',\n rects,\n rect,\n scale,\n onClick,\n style = '',\n }: HighlightProps = $props();\n\n // Rename rect to boundingRect for clarity\n const boundingRect = $derived(rect);\n</script>\n\n{#each rects as b, i (i)}\n <div\n onpointerdown={onClick}\n ontouchstart={onClick}\n style:position=\"absolute\"\n style:border\n style:left={`${(boundingRect ? b.origin.x - boundingRect.origin.x : b.origin.x) * scale}px`}\n style:top={`${(boundingRect ? b.origin.y - boundingRect.origin.y : b.origin.y) * scale}px`}\n style:width={`${b.size.width * scale}px`}\n style:height={`${b.size.height * scale}px`}\n style:background={color}\n style:opacity\n style:pointer-events={onClick ? 'auto' : 'none'}\n style:cursor={onClick ? 'pointer' : 'default'}\n style:z-index={onClick ? '1' : undefined}\n {style}\n ></div>\n{/each}\n","<script lang=\"ts\">\n import { useDocumentState } from '@embedpdf/core/svelte';\n import type { Rect } from '@embedpdf/models';\n import { useRedactionPlugin } from '../hooks/use-redaction.svelte';\n\n interface 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\n let {\n documentId,\n pageIndex,\n scale: scaleOverride,\n className = '',\n stroke,\n fill = 'transparent',\n }: MarqueeRedactProps = $props();\n\n const redactionPlugin = useRedactionPlugin();\n const documentState = useDocumentState(() => documentId);\n let rect = $state<Rect | null>(null);\n\n const actualScale = $derived(\n scaleOverride !== undefined ? scaleOverride : (documentState.current?.scale ?? 1),\n );\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 = $derived(stroke ?? redactionPlugin.plugin?.getPreviewStrokeColor() ?? 'red');\n\n $effect(() => {\n if (!redactionPlugin.plugin || !documentId) {\n rect = null;\n return;\n }\n\n return redactionPlugin.plugin.registerMarqueeOnPage({\n documentId,\n pageIndex,\n scale: actualScale,\n callback: {\n onPreview: (newRect) => {\n rect = newRect;\n },\n },\n });\n });\n</script>\n\n{#if rect}\n <div\n class={className}\n style:position=\"absolute\"\n style:pointer-events=\"none\"\n style:left={`${rect.origin.x * actualScale}px`}\n style:top={`${rect.origin.y * actualScale}px`}\n style:width={`${rect.size.width * actualScale}px`}\n style:height={`${rect.size.height * actualScale}px`}\n style:border={`1px solid ${strokeColor}`}\n style:background={fill}\n style:box-sizing=\"border-box\"\n ></div>\n{/if}\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import type { Rect } from '@embedpdf/models';\n import { Rotation } from '@embedpdf/models';\n import { CounterRotate } from '@embedpdf/utils/svelte';\n import type { MenuWrapperProps, SelectionMenuPlacement } from '@embedpdf/utils/svelte';\n import type { RedactionItem } from '@embedpdf/plugin-redaction';\n import { useRedactionCapability } from '../hooks/use-redaction.svelte';\n import Highlight from './highlight.svelte';\n import type {\n RedactionSelectionContext,\n RedactionSelectionMenuRenderFn,\n RedactionSelectionMenuProps,\n } from '../types';\n\n interface Props {\n documentId: string;\n pageIndex: number;\n scale: number;\n rotation?: Rotation;\n bboxStroke?: string;\n selectionMenu?: RedactionSelectionMenuRenderFn;\n selectionMenuSnippet?: Snippet<[RedactionSelectionMenuProps]>;\n }\n\n let {\n documentId,\n pageIndex,\n scale,\n rotation = Rotation.Degree0,\n bboxStroke = 'rgba(0,0,0,0.8)',\n selectionMenu,\n selectionMenuSnippet,\n }: Props = $props();\n\n const redactionCapability = useRedactionCapability();\n\n let items = $state<RedactionItem[]>([]);\n let selectedId = $state<string | null>(null);\n\n $effect(() => {\n const redactionValue = redactionCapability.provides;\n if (!redactionValue) {\n items = [];\n selectedId = null;\n return;\n }\n\n const scoped = redactionValue.forDocument(documentId);\n const currentState = scoped.getState();\n // Only show legacy mode items (not annotation-based redactions)\n items = (currentState.pending[pageIndex] ?? []).filter((it) => it.source === 'legacy');\n selectedId = currentState.selected?.page === pageIndex ? currentState.selected.id : null;\n\n const off1 = scoped.onPendingChange((map) => {\n // Only show legacy mode items (not annotation-based redactions)\n items = (map[pageIndex] ?? []).filter((it) => it.source === 'legacy');\n });\n\n const off2 = scoped.onSelectedChange((sel) => {\n selectedId = sel?.page === pageIndex ? sel.id : null;\n });\n\n return () => {\n off1?.();\n off2?.();\n };\n });\n\n function select(e: MouseEvent | TouchEvent, id: string) {\n e.stopPropagation();\n if (!redactionCapability.provides) return;\n redactionCapability.provides.forDocument(documentId).selectPending(pageIndex, id);\n }\n\n function shouldShowMenu(itemId: string): boolean {\n const isSelected = selectedId === itemId;\n return isSelected && (!!selectionMenu || !!selectionMenuSnippet);\n }\n\n function buildContext(item: RedactionItem): RedactionSelectionContext {\n return { type: 'redaction', item, pageIndex };\n }\n\n const menuPlacement: SelectionMenuPlacement = {\n suggestTop: false,\n spaceAbove: 0,\n spaceBelow: 0,\n };\n\n function buildMenuProps(\n item: RedactionItem,\n rect: Rect,\n menuWrapperProps: MenuWrapperProps,\n ): RedactionSelectionMenuProps {\n return {\n context: buildContext(item),\n selected: selectedId === item.id,\n rect,\n placement: menuPlacement,\n menuWrapperProps,\n };\n }\n</script>\n\n{#if items.length}\n <div style=\"position: absolute; inset: 0; pointer-events: none;\">\n {#each items as item (item.id)}\n {#if item.kind === 'area'}\n <div\n style=\"\n position: absolute;\n left: {item.rect.origin.x * scale}px;\n top: {item.rect.origin.y * scale}px;\n width: {item.rect.size.width * scale}px;\n height: {item.rect.size.height * scale}px;\n background: transparent;\n outline: {selectedId === item.id ? `1px solid ${bboxStroke}` : 'none'};\n outline-offset: 2px;\n border: 1px solid red;\n pointer-events: auto;\n cursor: pointer;\n \"\n onpointerdown={(e) => select(e, item.id)}\n ontouchstart={(e) => select(e, item.id)}\n ></div>\n\n {#if shouldShowMenu(item.id)}\n <CounterRotate\n rect={{\n origin: { x: item.rect.origin.x * scale, y: item.rect.origin.y * scale },\n size: { width: item.rect.size.width * scale, height: item.rect.size.height * scale },\n }}\n {rotation}\n >\n {#snippet children({ rect, menuWrapperProps })}\n {@const menuProps = buildMenuProps(item, rect, menuWrapperProps)}\n {#if selectionMenu}\n {@const result = selectionMenu(menuProps)}\n {#if result}\n <result.component {...result.props} />\n {/if}\n {:else if selectionMenuSnippet}\n {@render selectionMenuSnippet(menuProps)}\n {/if}\n {/snippet}\n </CounterRotate>\n {/if}\n {:else}\n <div\n style=\"\n position: absolute;\n left: {item.rect.origin.x * scale}px;\n top: {item.rect.origin.y * scale}px;\n width: {item.rect.size.width * scale}px;\n height: {item.rect.size.height * scale}px;\n background: transparent;\n outline: {selectedId === item.id ? `1px solid ${bboxStroke}` : 'none'};\n outline-offset: 2px;\n pointer-events: auto;\n cursor: {selectedId === item.id ? 'pointer' : 'default'};\n \"\n >\n <Highlight\n rect={item.rect}\n rects={item.rects}\n color=\"transparent\"\n border=\"1px solid red\"\n {scale}\n onClick={(e) => select(e, item.id)}\n />\n </div>\n\n {#if shouldShowMenu(item.id)}\n <CounterRotate\n rect={{\n origin: { x: item.rect.origin.x * scale, y: item.rect.origin.y * scale },\n size: { width: item.rect.size.width * scale, height: item.rect.size.height * scale },\n }}\n {rotation}\n >\n {#snippet children({ rect, menuWrapperProps })}\n {@const menuProps = buildMenuProps(item, rect, menuWrapperProps)}\n {#if selectionMenu}\n {@const result = selectionMenu(menuProps)}\n {#if result}\n <result.component {...result.props} />\n {/if}\n {:else if selectionMenuSnippet}\n {@render selectionMenuSnippet(menuProps)}\n {/if}\n {/snippet}\n </CounterRotate>\n {/if}\n {/if}\n {/each}\n </div>\n{/if}\n","<script lang=\"ts\">\n import type { Rect } from '@embedpdf/models';\n import { useRedactionPlugin } from '../hooks/use-redaction.svelte';\n import Highlight from './highlight.svelte';\n\n interface SelectionRedactProps {\n documentId: string;\n pageIndex: number;\n scale: number;\n }\n\n let { documentId, pageIndex, scale }: SelectionRedactProps = $props();\n\n const redactionPlugin = useRedactionPlugin();\n let rects = $state<Rect[]>([]);\n let boundingRect = $state<Rect | null>(null);\n\n // Get stroke color from plugin (annotation mode uses tool defaults, legacy uses red)\n const strokeColor = $derived(redactionPlugin.plugin?.getPreviewStrokeColor() ?? 'red');\n\n $effect(() => {\n if (!redactionPlugin.plugin) {\n rects = [];\n boundingRect = null;\n return;\n }\n\n return redactionPlugin.plugin.onRedactionSelectionChange(documentId, (formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);\n rects = selection?.segmentRects ?? [];\n boundingRect = selection?.rect ?? null;\n });\n });\n</script>\n\n{#if boundingRect}\n <div\n style:mix-blend-mode=\"normal\"\n style:pointer-events=\"none\"\n style:position=\"absolute\"\n style:inset=\"0\"\n >\n <Highlight\n color=\"transparent\"\n opacity={1}\n {rects}\n {scale}\n border={`1px solid ${strokeColor}`}\n />\n </div>\n{/if}\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { useDocumentState } from '@embedpdf/core/svelte';\n import { Rotation } from '@embedpdf/models';\n import PendingRedactions from './pending-redactions.svelte';\n import MarqueeRedact from './marquee-redact.svelte';\n import SelectionRedact from './selection-redact.svelte';\n import type { RedactionSelectionMenuRenderFn, RedactionSelectionMenuProps } from '../types';\n\n interface 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 /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: RedactionSelectionMenuRenderFn;\n /** Snippet for custom selection menu (slot-based approach) */\n selectionMenuSnippet?: Snippet<[RedactionSelectionMenuProps]>;\n }\n\n let {\n documentId,\n pageIndex,\n scale,\n rotation,\n selectionMenu,\n selectionMenuSnippet,\n }: RedactionLayerProps = $props();\n\n const documentState = useDocumentState(() => documentId);\n\n const actualScale = $derived(scale !== undefined ? scale : (documentState.current?.scale ?? 1));\n\n const actualRotation = $derived(\n rotation !== undefined ? rotation : (documentState.current?.rotation ?? Rotation.Degree0),\n );\n</script>\n\n<PendingRedactions\n {documentId}\n {pageIndex}\n scale={actualScale}\n rotation={actualRotation}\n {selectionMenu}\n {selectionMenuSnippet}\n/>\n<MarqueeRedact {documentId} {pageIndex} scale={actualScale} />\n<SelectionRedact {documentId} {pageIndex} scale={actualScale} />\n","import { createPluginPackage } from '@embedpdf/core';\nimport { RedactionPluginPackage as BaseRedactionPackage } from '@embedpdf/plugin-redaction';\nimport RedactRendererRegistration from './components/RedactRendererRegistration.svelte';\n\nexport * from './hooks';\nexport * from './components';\nexport * from './types';\nexport * from '@embedpdf/plugin-redaction';\n\nexport const RedactionPluginPackage = createPluginPackage(BaseRedactionPackage)\n .addUtility(RedactRendererRegistration)\n .build();\n"],"names":["root","$$anchor","root_1","PendingRedactions","MarqueeRedact","SelectionRedact","BaseRedactionPackage"],"mappings":";;;;;;;;;;;;;4CAAA;;MAYM,YAAY,EAAA,MAAO,KAAK;AAEtB,QAAA,4CAA6B,MAAM;QAEnC,eAAY,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,gBAAY,EAAA;QAC3C,OAAI,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,IAAI;AAG3B,QAAA,cAAW,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,eAAe,SAAS;AAEtD,QAAA,QAAK,EAAA,QAAA,MAAA,EAAA,IA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CACS,8BAAwB,mBAAc,YAAd,mBAAuB,aAAY,SAAS;AAAA,GAAO;;;AAI3FE,qBAAgB,MAAA;AAAA;;;;;;;mBAGR,WAAW;AAAA;;mBACR,cAAc;AAAA;;;;;;;;;AAIzBC,iBAAa,QAAA;AAAA;;;;;;;mBAAiC,WAAW;AAAA;;;AACzDC,mBAAe,QAAA;AAAA;;;;;;;mBAAiC,WAAW;AAAA;;;;AAXpD;AC/BD,MAAM,yBAAyB,oBAAoBC,wBAAoB,EAC3E,WAAW,0BAA0B,EACrC,MAAA;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnnotationRendererProps } from '@embedpdf/plugin-annotation/vue';
|
|
2
|
+
import { PdfRedactAnnoObject } from '@embedpdf/models';
|
|
3
|
+
type __VLS_Props = AnnotationRendererProps<PdfRedactAnnoObject>;
|
|
4
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnnotationRendererProps } from '@embedpdf/plugin-annotation/vue';
|
|
2
|
+
import { PdfRedactAnnoObject } from '@embedpdf/models';
|
|
3
|
+
type __VLS_Props = AnnotationRendererProps<PdfRedactAnnoObject>;
|
|
4
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -3,3 +3,6 @@ export { default as MarqueeRedact } from './marquee-redact.vue';
|
|
|
3
3
|
export { default as SelectionRedact } from './selection-redact.vue';
|
|
4
4
|
export { default as PendingRedactions } from './pending-redactions.vue';
|
|
5
5
|
export { default as RedactionLayer } from './redaction-layer.vue';
|
|
6
|
+
export { default as RedactRendererRegistration } from './redact-renderer-registration.vue';
|
|
7
|
+
export { redactRenderers } from './redact-renderers';
|
|
8
|
+
export * from './annotations';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoxedAnnotationRenderer } from '@embedpdf/plugin-annotation/vue';
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { SelectionMenuPropsBase, SelectionMenuRenderFn } from '@embedpdf/utils/vue';
|
|
2
|
-
import { RedactionItem } from '../../lib
|
|
2
|
+
import { RedactionItem } from '../../lib';
|
|
3
3
|
export interface RedactionSelectionContext {
|
|
4
4
|
type: 'redaction';
|
|
5
5
|
item: RedactionItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
|
|
2
|
-
import { RedactionPlugin, RedactionDocumentState, RedactionScope } from '../../lib
|
|
2
|
+
import { RedactionPlugin, RedactionDocumentState, RedactionScope } from '../../lib';
|
|
3
3
|
export declare const useRedactionPlugin: () => import('@embedpdf/core/vue').PluginState<RedactionPlugin>;
|
|
4
|
-
export declare const useRedactionCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib
|
|
4
|
+
export declare const useRedactionCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib').RedactionCapability>>;
|
|
5
5
|
/**
|
|
6
6
|
* Hook for redaction state for a specific document
|
|
7
7
|
* @param documentId Document ID (can be ref, computed, getter, or plain value)
|