@embedpdf/plugin-redaction 1.0.19 → 1.0.21

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/vue/index.js CHANGED
@@ -1,8 +1,318 @@
1
1
  import { usePlugin, useCapability } from "@embedpdf/core/vue";
2
2
  import { RedactionPlugin } from "@embedpdf/plugin-redaction";
3
+ export * from "@embedpdf/plugin-redaction";
4
+ import { defineComponent, createElementBlock, openBlock, Fragment, renderList, mergeProps, unref, ref, onMounted, onUnmounted, createCommentVNode, normalizeClass, normalizeStyle, createVNode, createElementVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps } from "vue";
5
+ import { CounterRotate } from "@embedpdf/utils/vue";
3
6
  const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
4
7
  const useRedactionCapability = () => useCapability(RedactionPlugin.id);
8
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9
+ __name: "highlight",
10
+ props: {
11
+ color: { default: "#FFFF00" },
12
+ opacity: { default: 0.5 },
13
+ border: { default: "1px solid red" },
14
+ rects: {},
15
+ rect: {},
16
+ scale: {},
17
+ onClick: {}
18
+ },
19
+ setup(__props) {
20
+ const props = __props;
21
+ const boundingRect = props.rect;
22
+ return (_ctx, _cache) => {
23
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rects, (rect, i) => {
24
+ return openBlock(), createElementBlock("div", mergeProps({
25
+ key: i,
26
+ onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
27
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
28
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
29
+ (...args) => _ctx.onClick && _ctx.onClick(...args)),
30
+ style: {
31
+ position: "absolute",
32
+ border: _ctx.border,
33
+ left: `${(unref(boundingRect) ? rect.origin.x - unref(boundingRect).origin.x : rect.origin.x) * _ctx.scale}px`,
34
+ top: `${(unref(boundingRect) ? rect.origin.y - unref(boundingRect).origin.y : rect.origin.y) * _ctx.scale}px`,
35
+ width: `${rect.size.width * _ctx.scale}px`,
36
+ height: `${rect.size.height * _ctx.scale}px`,
37
+ background: _ctx.color,
38
+ opacity: _ctx.opacity,
39
+ pointerEvents: _ctx.onClick ? "auto" : "none",
40
+ cursor: _ctx.onClick ? "pointer" : "default",
41
+ zIndex: _ctx.onClick ? 1 : void 0
42
+ }
43
+ }, { ref_for: true }, _ctx.$attrs), null, 16);
44
+ }), 128);
45
+ };
46
+ }
47
+ });
48
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
49
+ __name: "marquee-redact",
50
+ props: {
51
+ pageIndex: {},
52
+ scale: {},
53
+ className: {},
54
+ stroke: { default: "red" },
55
+ fill: { default: "transparent" }
56
+ },
57
+ setup(__props) {
58
+ const props = __props;
59
+ const { plugin: redactionPlugin } = useRedactionPlugin();
60
+ const rect = ref(null);
61
+ let unregister;
62
+ onMounted(() => {
63
+ if (!redactionPlugin.value) return;
64
+ unregister = redactionPlugin.value.registerMarqueeOnPage({
65
+ pageIndex: props.pageIndex,
66
+ scale: props.scale,
67
+ callback: {
68
+ onPreview: (newRect) => {
69
+ rect.value = newRect;
70
+ }
71
+ }
72
+ });
73
+ });
74
+ onUnmounted(() => {
75
+ unregister == null ? void 0 : unregister();
76
+ });
77
+ return (_ctx, _cache) => {
78
+ return rect.value ? (openBlock(), createElementBlock("div", {
79
+ key: 0,
80
+ style: normalizeStyle({
81
+ position: "absolute",
82
+ pointerEvents: "none",
83
+ left: `${rect.value.origin.x * _ctx.scale}px`,
84
+ top: `${rect.value.origin.y * _ctx.scale}px`,
85
+ width: `${rect.value.size.width * _ctx.scale}px`,
86
+ height: `${rect.value.size.height * _ctx.scale}px`,
87
+ border: `1px solid ${_ctx.stroke}`,
88
+ background: _ctx.fill,
89
+ boxSizing: "border-box"
90
+ }),
91
+ class: normalizeClass(_ctx.className)
92
+ }, null, 6)) : createCommentVNode("", true);
93
+ };
94
+ }
95
+ });
96
+ const _hoisted_1$1 = {
97
+ key: 0,
98
+ style: {
99
+ mixBlendMode: "normal",
100
+ pointerEvents: "none",
101
+ position: "absolute",
102
+ inset: 0
103
+ }
104
+ };
105
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
106
+ __name: "selection-redact",
107
+ props: {
108
+ pageIndex: {},
109
+ scale: {}
110
+ },
111
+ setup(__props) {
112
+ const props = __props;
113
+ const { provides: redactionProvides } = useRedactionCapability();
114
+ const rects = ref([]);
115
+ const boundingRect = ref(null);
116
+ let unsubscribe;
117
+ onMounted(() => {
118
+ if (!redactionProvides.value) return;
119
+ unsubscribe = redactionProvides.value.onRedactionSelectionChange((formattedSelection) => {
120
+ const selection = formattedSelection.find((s) => s.pageIndex === props.pageIndex);
121
+ rects.value = (selection == null ? void 0 : selection.segmentRects) ?? [];
122
+ boundingRect.value = (selection == null ? void 0 : selection.rect) ?? null;
123
+ });
124
+ });
125
+ onUnmounted(() => {
126
+ unsubscribe == null ? void 0 : unsubscribe();
127
+ });
128
+ return (_ctx, _cache) => {
129
+ return boundingRect.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
130
+ createVNode(_sfc_main$4, {
131
+ color: "transparent",
132
+ opacity: 1,
133
+ rects: rects.value,
134
+ scale: _ctx.scale,
135
+ border: "1px solid red"
136
+ }, null, 8, ["rects", "scale"])
137
+ ])) : createCommentVNode("", true);
138
+ };
139
+ }
140
+ });
141
+ const _hoisted_1 = {
142
+ key: 0,
143
+ style: { position: "absolute", inset: 0, pointerEvents: "none" }
144
+ };
145
+ const _hoisted_2 = ["onPointerdown", "onTouchstart"];
146
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
147
+ __name: "pending-redactions",
148
+ props: {
149
+ pageIndex: {},
150
+ scale: {},
151
+ rotation: { default: 0 },
152
+ bboxStroke: { default: "rgba(0,0,0,0.8)" }
153
+ },
154
+ setup(__props) {
155
+ const props = __props;
156
+ const { provides: redaction } = useRedactionCapability();
157
+ const items = ref([]);
158
+ const selectedId = ref(null);
159
+ const select = (e, id) => {
160
+ e.stopPropagation();
161
+ if (!redaction.value) return;
162
+ redaction.value.selectPending(props.pageIndex, id);
163
+ };
164
+ let unsubscribePending;
165
+ let unsubscribeSelection;
166
+ onMounted(() => {
167
+ if (!redaction.value) return;
168
+ unsubscribePending = redaction.value.onPendingChange((map) => {
169
+ items.value = map[props.pageIndex] ?? [];
170
+ });
171
+ unsubscribeSelection = redaction.value.onSelectionChange((sel) => {
172
+ selectedId.value = sel && sel.page === props.pageIndex ? sel.id : null;
173
+ });
174
+ });
175
+ onUnmounted(() => {
176
+ unsubscribePending == null ? void 0 : unsubscribePending();
177
+ unsubscribeSelection == null ? void 0 : unsubscribeSelection();
178
+ });
179
+ return (_ctx, _cache) => {
180
+ return items.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
181
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
182
+ return openBlock(), createElementBlock(Fragment, {
183
+ key: item.id
184
+ }, [
185
+ item.kind === "area" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
186
+ createElementVNode("div", {
187
+ style: normalizeStyle({
188
+ position: "absolute",
189
+ left: `${item.rect.origin.x * _ctx.scale}px`,
190
+ top: `${item.rect.origin.y * _ctx.scale}px`,
191
+ width: `${item.rect.size.width * _ctx.scale}px`,
192
+ height: `${item.rect.size.height * _ctx.scale}px`,
193
+ background: "transparent",
194
+ outline: selectedId.value === item.id ? `1px solid ${_ctx.bboxStroke}` : "none",
195
+ outlineOffset: "2px",
196
+ border: `1px solid red`,
197
+ pointerEvents: "auto",
198
+ cursor: "pointer"
199
+ }),
200
+ onPointerdown: (e) => select(e, item.id),
201
+ onTouchstart: (e) => select(e, item.id)
202
+ }, null, 44, _hoisted_2),
203
+ createVNode(unref(CounterRotate), {
204
+ rect: {
205
+ origin: { x: item.rect.origin.x * _ctx.scale, y: item.rect.origin.y * _ctx.scale },
206
+ size: { width: item.rect.size.width * _ctx.scale, height: item.rect.size.height * _ctx.scale }
207
+ },
208
+ rotation: _ctx.rotation
209
+ }, {
210
+ default: withCtx(({ rect, menuWrapperProps }) => [
211
+ renderSlot(_ctx.$slots, "selection-menu", {
212
+ item,
213
+ selected: selectedId.value === item.id,
214
+ pageIndex: _ctx.pageIndex,
215
+ menuWrapperProps,
216
+ rect
217
+ })
218
+ ]),
219
+ _: 2
220
+ }, 1032, ["rect", "rotation"])
221
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
222
+ createElementVNode("div", {
223
+ style: normalizeStyle({
224
+ position: "absolute",
225
+ left: `${item.boundingRect.origin.x * _ctx.scale}px`,
226
+ top: `${item.boundingRect.origin.y * _ctx.scale}px`,
227
+ width: `${item.boundingRect.size.width * _ctx.scale}px`,
228
+ height: `${item.boundingRect.size.height * _ctx.scale}px`,
229
+ background: "transparent",
230
+ outline: selectedId.value === item.id ? `1px solid ${_ctx.bboxStroke}` : "none",
231
+ outlineOffset: "2px",
232
+ pointerEvents: "auto",
233
+ cursor: selectedId.value === item.id ? "pointer" : "default"
234
+ })
235
+ }, [
236
+ createVNode(_sfc_main$4, {
237
+ rect: item.boundingRect,
238
+ rects: item.rects,
239
+ color: "transparent",
240
+ border: "1px solid red",
241
+ scale: _ctx.scale,
242
+ "on-click": (e) => select(e, item.id)
243
+ }, null, 8, ["rect", "rects", "scale", "on-click"])
244
+ ], 4),
245
+ createVNode(unref(CounterRotate), {
246
+ rect: {
247
+ origin: {
248
+ x: item.boundingRect.origin.x * _ctx.scale,
249
+ y: item.boundingRect.origin.y * _ctx.scale
250
+ },
251
+ size: {
252
+ width: item.boundingRect.size.width * _ctx.scale,
253
+ height: item.boundingRect.size.height * _ctx.scale
254
+ }
255
+ },
256
+ rotation: _ctx.rotation
257
+ }, {
258
+ default: withCtx(({ rect, menuWrapperProps }) => [
259
+ renderSlot(_ctx.$slots, "selection-menu", {
260
+ item,
261
+ selected: selectedId.value === item.id,
262
+ pageIndex: _ctx.pageIndex,
263
+ menuWrapperProps,
264
+ rect
265
+ })
266
+ ]),
267
+ _: 2
268
+ }, 1032, ["rect", "rotation"])
269
+ ], 64))
270
+ ], 64);
271
+ }), 128))
272
+ ])) : createCommentVNode("", true);
273
+ };
274
+ }
275
+ });
276
+ const _sfc_main = /* @__PURE__ */ defineComponent({
277
+ __name: "redaction-layer",
278
+ props: {
279
+ pageIndex: {},
280
+ scale: {},
281
+ rotation: { default: 0 },
282
+ bboxStroke: { default: "rgba(0,0,0,0.8)" }
283
+ },
284
+ setup(__props) {
285
+ return (_ctx, _cache) => {
286
+ return openBlock(), createElementBlock(Fragment, null, [
287
+ createVNode(_sfc_main$1, {
288
+ "page-index": _ctx.pageIndex,
289
+ scale: _ctx.scale,
290
+ rotation: _ctx.rotation,
291
+ "bbox-stroke": _ctx.bboxStroke
292
+ }, {
293
+ "selection-menu": withCtx((slotProps) => [
294
+ renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(slotProps)))
295
+ ]),
296
+ _: 3
297
+ }, 8, ["page-index", "scale", "rotation", "bbox-stroke"]),
298
+ createVNode(_sfc_main$3, {
299
+ "page-index": _ctx.pageIndex,
300
+ scale: _ctx.scale
301
+ }, null, 8, ["page-index", "scale"]),
302
+ createVNode(_sfc_main$2, {
303
+ "page-index": _ctx.pageIndex,
304
+ scale: _ctx.scale
305
+ }, null, 8, ["page-index", "scale"])
306
+ ], 64);
307
+ };
308
+ }
309
+ });
5
310
  export {
311
+ _sfc_main$4 as Highlight,
312
+ _sfc_main$3 as MarqueeRedact,
313
+ _sfc_main$1 as PendingRedactions,
314
+ _sfc_main as RedactionLayer,
315
+ _sfc_main$2 as SelectionRedact,
6
316
  useRedactionCapability,
7
317
  useRedactionPlugin
8
318
  };
@@ -1 +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;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-redaction.ts","../../src/vue/components/highlight.vue","../../src/vue/components/marquee-redact.vue","../../src/vue/components/selection-redact.vue","../../src/vue/components/pending-redactions.vue","../../src/vue/components/redaction-layer.vue"],"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","<template>\n <div\n v-for=\"(rect, i) in rects\"\n :key=\"i\"\n @pointerdown=\"onClick\"\n @touchstart=\"onClick\"\n :style=\"{\n position: 'absolute',\n border,\n left: `${(boundingRect ? rect.origin.x - boundingRect.origin.x : rect.origin.x) * scale}px`,\n top: `${(boundingRect ? rect.origin.y - boundingRect.origin.y : rect.origin.y) * scale}px`,\n width: `${rect.size.width * scale}px`,\n height: `${rect.size.height * scale}px`,\n background: color,\n opacity: opacity,\n pointerEvents: onClick ? 'auto' : 'none',\n cursor: onClick ? 'pointer' : 'default',\n zIndex: onClick ? 1 : undefined,\n }\"\n v-bind=\"$attrs\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport type { Rect } from '@embedpdf/models';\n\ninterface HighlightProps {\n color?: string;\n opacity?: number;\n border?: string;\n rects: Rect[];\n rect?: Rect;\n scale: number;\n onClick?: (e: PointerEvent | TouchEvent) => void;\n}\n\nconst props = withDefaults(defineProps<HighlightProps>(), {\n color: '#FFFF00',\n opacity: 0.5,\n border: '1px solid red',\n});\n\n// Rename rect to boundingRect for clarity in template\nconst boundingRect = props.rect;\n</script>\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * scale}px`,\n top: `${rect.origin.y * scale}px`,\n width: `${rect.size.width * scale}px`,\n height: `${rect.size.height * scale}px`,\n border: `1px solid ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport type { Rect } from '@embedpdf/models';\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\nconst props = withDefaults(defineProps<MarqueeRedactProps>(), {\n stroke: 'red',\n fill: 'transparent',\n});\n\nconst { plugin: redactionPlugin } = useRedactionPlugin();\nconst rect = ref<Rect | null>(null);\n\nlet unregister: (() => void) | undefined;\n\nonMounted(() => {\n if (!redactionPlugin.value) return;\n\n unregister = redactionPlugin.value.registerMarqueeOnPage({\n pageIndex: props.pageIndex,\n scale: props.scale,\n callback: {\n onPreview: (newRect) => {\n rect.value = newRect;\n },\n },\n });\n});\n\nonUnmounted(() => {\n unregister?.();\n});\n</script>\n","<template>\n <div\n v-if=\"boundingRect\"\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</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useRedactionCapability } from '../hooks/use-redaction';\nimport Highlight from './highlight.vue';\n\ninterface SelectionRedactProps {\n pageIndex: number;\n scale: number;\n}\n\nconst props = defineProps<SelectionRedactProps>();\n\nconst { provides: redactionProvides } = useRedactionCapability();\nconst rects = ref<Rect[]>([]);\nconst boundingRect = ref<Rect | null>(null);\n\nlet unsubscribe: (() => void) | undefined;\n\nonMounted(() => {\n if (!redactionProvides.value) return;\n\n unsubscribe = redactionProvides.value.onRedactionSelectionChange((formattedSelection) => {\n const selection = formattedSelection.find((s) => s.pageIndex === props.pageIndex);\n rects.value = selection?.segmentRects ?? [];\n boundingRect.value = selection?.rect ?? null;\n });\n});\n\nonUnmounted(() => {\n unsubscribe?.();\n});\n</script>\n","<template>\n <div v-if=\"items.length\" :style=\"{ position: 'absolute', inset: 0, pointerEvents: 'none' }\">\n <template v-for=\"item in items\" :key=\"item.id\">\n <!-- Area redaction -->\n <template v-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 outlineOffset: '2px',\n border: `1px solid red`,\n pointerEvents: 'auto',\n cursor: 'pointer',\n }\"\n @pointerdown=\"(e: PointerEvent) => select(e, item.id)\"\n @touchstart=\"(e: TouchEvent) => select(e, item.id)\"\n />\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=\"rotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <slot\n name=\"selection-menu\"\n :item=\"item\"\n :selected=\"selectedId === item.id\"\n :page-index=\"pageIndex\"\n :menu-wrapper-props=\"menuWrapperProps\"\n :rect=\"rect\"\n />\n </template>\n </CounterRotate>\n </template>\n\n <!-- Text redaction -->\n <template v-else>\n <div\n :style=\"{\n position: 'absolute',\n left: `${item.boundingRect.origin.x * scale}px`,\n top: `${item.boundingRect.origin.y * scale}px`,\n width: `${item.boundingRect.size.width * scale}px`,\n height: `${item.boundingRect.size.height * scale}px`,\n background: 'transparent',\n outline: selectedId === item.id ? `1px solid ${bboxStroke}` : 'none',\n outlineOffset: '2px',\n pointerEvents: 'auto',\n cursor: selectedId === item.id ? 'pointer' : 'default',\n }\"\n >\n <Highlight\n :rect=\"item.boundingRect\"\n :rects=\"item.rects\"\n color=\"transparent\"\n border=\"1px solid red\"\n :scale=\"scale\"\n :on-click=\"(e: PointerEvent | TouchEvent) => select(e, item.id)\"\n />\n </div>\n <CounterRotate\n :rect=\"{\n origin: {\n x: item.boundingRect.origin.x * scale,\n y: item.boundingRect.origin.y * scale,\n },\n size: {\n width: item.boundingRect.size.width * scale,\n height: item.boundingRect.size.height * scale,\n },\n }\"\n :rotation=\"rotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <slot\n name=\"selection-menu\"\n :item=\"item\"\n :selected=\"selectedId === item.id\"\n :page-index=\"pageIndex\"\n :menu-wrapper-props=\"menuWrapperProps\"\n :rect=\"rect\"\n />\n </template>\n </CounterRotate>\n </template>\n </template>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport { CounterRotate } from '@embedpdf/utils/vue';\nimport type { Rotation } from '@embedpdf/models';\nimport type { RedactionItem } from '@embedpdf/plugin-redaction';\nimport { useRedactionCapability } from '../hooks/use-redaction';\nimport Highlight from './highlight.vue';\n\ninterface PendingRedactionsProps {\n pageIndex: number;\n scale: number;\n rotation?: Rotation;\n bboxStroke?: string;\n}\n\nconst props = withDefaults(defineProps<PendingRedactionsProps>(), {\n rotation: 0,\n bboxStroke: 'rgba(0,0,0,0.8)',\n});\n\nconst { provides: redaction } = useRedactionCapability();\nconst items = ref<RedactionItem[]>([]);\nconst selectedId = ref<string | null>(null);\n\nconst select = (e: PointerEvent | TouchEvent, id: string) => {\n e.stopPropagation();\n if (!redaction.value) return;\n redaction.value.selectPending(props.pageIndex, id);\n};\n\nlet unsubscribePending: (() => void) | undefined;\nlet unsubscribeSelection: (() => void) | undefined;\n\nonMounted(() => {\n if (!redaction.value) return;\n\n unsubscribePending = redaction.value.onPendingChange((map) => {\n items.value = map[props.pageIndex] ?? [];\n });\n\n unsubscribeSelection = redaction.value.onSelectionChange((sel) => {\n selectedId.value = sel && sel.page === props.pageIndex ? sel.id : null;\n });\n});\n\nonUnmounted(() => {\n unsubscribePending?.();\n unsubscribeSelection?.();\n});\n</script>\n","<template>\n <PendingRedactions\n :page-index=\"pageIndex\"\n :scale=\"scale\"\n :rotation=\"rotation\"\n :bbox-stroke=\"bboxStroke\"\n >\n <template #selection-menu=\"slotProps\">\n <slot name=\"selection-menu\" v-bind=\"slotProps\" />\n </template>\n </PendingRedactions>\n <MarqueeRedact :page-index=\"pageIndex\" :scale=\"scale\" />\n <SelectionRedact :page-index=\"pageIndex\" :scale=\"scale\" />\n</template>\n\n<script setup lang=\"ts\">\nimport type { Rotation } from '@embedpdf/models';\nimport PendingRedactions from './pending-redactions.vue';\nimport MarqueeRedact from './marquee-redact.vue';\nimport SelectionRedact from './selection-redact.vue';\n\ninterface RedactionLayerProps {\n pageIndex: number;\n scale: number;\n rotation?: Rotation;\n bboxStroke?: string;\n}\n\nwithDefaults(defineProps<RedactionLayerProps>(), {\n rotation: 0,\n bboxStroke: 'rgba(0,0,0,0.8)',\n});\n</script>\n"],"names":["_openBlock","_createElementBlock","_Fragment","rects","_mergeProps","border","_unref","scale","color","opacity","onClick","$attrs","_normalizeStyle","stroke","fill","className","_hoisted_1","_createVNode","Highlight","_renderList","_createElementVNode","bboxStroke","rotation","_withCtx","_renderSlot","pageIndex","PendingRedactions","MarqueeRedact","SelectionRedact"],"mappings":";;;;;AAGO,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;AAC9E,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;;;;;;;;;;;;;ACgC7F,UAAM,QAAQ;AAOd,UAAM,eAAe,MAAM;;AA1CzB,aAAAA,UAAA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
6
  "module": "./dist/index.js",
@@ -23,24 +23,25 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@embedpdf/models": "1.0.19"
26
+ "@embedpdf/models": "1.0.21",
27
+ "@embedpdf/utils": "1.0.20"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/react": "^18.2.0",
30
31
  "typescript": "^5.0.0",
31
32
  "@embedpdf/build": "1.0.0",
32
- "@embedpdf/core": "1.0.19",
33
- "@embedpdf/plugin-selection": "1.0.19",
34
- "@embedpdf/plugin-interaction-manager": "1.0.19"
33
+ "@embedpdf/plugin-selection": "1.0.21",
34
+ "@embedpdf/plugin-interaction-manager": "1.0.21",
35
+ "@embedpdf/core": "1.0.21"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "preact": "^10.26.4",
38
39
  "react": ">=16.8.0",
39
40
  "react-dom": ">=16.8.0",
40
41
  "vue": ">=3.2.0",
41
- "@embedpdf/core": "1.0.19",
42
- "@embedpdf/plugin-selection": "1.0.19",
43
- "@embedpdf/plugin-interaction-manager": "1.0.19"
42
+ "@embedpdf/plugin-selection": "1.0.21",
43
+ "@embedpdf/core": "1.0.21",
44
+ "@embedpdf/plugin-interaction-manager": "1.0.21"
44
45
  },
45
46
  "files": [
46
47
  "dist",
@@ -49,7 +50,7 @@
49
50
  "repository": {
50
51
  "type": "git",
51
52
  "url": "https://github.com/embedpdf/embed-pdf-viewer",
52
- "directory": "packages/plugin-render"
53
+ "directory": "packages/plugin-redaction"
53
54
  },
54
55
  "homepage": "https://www.embedpdf.com/docs",
55
56
  "bugs": {