@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,47 @@
|
|
|
1
|
+
import { Action } from '@embedpdf/core';
|
|
2
|
+
import { RedactionItem } from './types';
|
|
3
|
+
export declare const START_REDACTION = "START_REDACTION";
|
|
4
|
+
export declare const END_REDACTION = "END_REDACTION";
|
|
5
|
+
export declare const ADD_PENDING = "ADD_PENDING";
|
|
6
|
+
export declare const REMOVE_PENDING = "REMOVE_PENDING";
|
|
7
|
+
export declare const CLEAR_PENDING = "CLEAR_PENDING";
|
|
8
|
+
export declare const SELECT_PENDING = "SELECT_PENDING";
|
|
9
|
+
export declare const DESELECT_PENDING = "DESELECT_PENDING";
|
|
10
|
+
export interface StartRedactionAction extends Action {
|
|
11
|
+
type: typeof START_REDACTION;
|
|
12
|
+
}
|
|
13
|
+
export interface EndRedactionAction extends Action {
|
|
14
|
+
type: typeof END_REDACTION;
|
|
15
|
+
}
|
|
16
|
+
export interface AddPendingAction extends Action {
|
|
17
|
+
type: typeof ADD_PENDING;
|
|
18
|
+
payload: RedactionItem[];
|
|
19
|
+
}
|
|
20
|
+
export interface RemovePendingAction extends Action {
|
|
21
|
+
type: typeof REMOVE_PENDING;
|
|
22
|
+
payload: {
|
|
23
|
+
page: number;
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface ClearPendingAction extends Action {
|
|
28
|
+
type: typeof CLEAR_PENDING;
|
|
29
|
+
}
|
|
30
|
+
export interface SelectPendingAction extends Action {
|
|
31
|
+
type: typeof SELECT_PENDING;
|
|
32
|
+
payload: {
|
|
33
|
+
page: number;
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface DeselectPendingAction extends Action {
|
|
38
|
+
type: typeof DESELECT_PENDING;
|
|
39
|
+
}
|
|
40
|
+
export type RedactionAction = StartRedactionAction | EndRedactionAction | AddPendingAction | RemovePendingAction | ClearPendingAction | SelectPendingAction | DeselectPendingAction;
|
|
41
|
+
export declare const addPending: (items: RedactionItem[]) => AddPendingAction;
|
|
42
|
+
export declare const removePending: (page: number, id: string) => RemovePendingAction;
|
|
43
|
+
export declare const clearPending: () => ClearPendingAction;
|
|
44
|
+
export declare const startRedaction: () => StartRedactionAction;
|
|
45
|
+
export declare const endRedaction: () => EndRedactionAction;
|
|
46
|
+
export declare const selectPending: (page: number, id: string) => SelectPendingAction;
|
|
47
|
+
export declare const deselectPending: () => DeselectPendingAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './marquee-redact.handler';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Rect, Size } from '@embedpdf/models';
|
|
2
|
+
import { EmbedPdfPointerEvent, PointerEventHandlersWithLifecycle } from '@embedpdf/plugin-interaction-manager';
|
|
3
|
+
export declare function createMarqueeHandler(opts: {
|
|
4
|
+
pageSize: Size;
|
|
5
|
+
scale: number;
|
|
6
|
+
minDragPx?: number;
|
|
7
|
+
onPreview?: (rect: Rect | null) => void;
|
|
8
|
+
onCommit?: (rect: Rect) => void;
|
|
9
|
+
}): PointerEventHandlersWithLifecycle<EmbedPdfPointerEvent>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginPackage } from '@embedpdf/core';
|
|
2
|
+
import { RedactionPluginConfig, RedactionState } from './types';
|
|
3
|
+
import { RedactionPlugin } from './redaction-plugin';
|
|
4
|
+
import { RedactionAction } from './actions';
|
|
5
|
+
export declare const RedactionPluginPackage: PluginPackage<RedactionPlugin, RedactionPluginConfig, RedactionState, RedactionAction>;
|
|
6
|
+
export * from './redaction-plugin';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './manifest';
|
|
9
|
+
export * from './selectors';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RedactionPluginConfig, RedactionCapability, RedactionState, RegisterMarqueeOnPageOptions } from './types';
|
|
2
|
+
import { BasePlugin, PluginRegistry } from '@embedpdf/core';
|
|
3
|
+
import { PdfEngine } from '@embedpdf/models';
|
|
4
|
+
export declare class RedactionPlugin extends BasePlugin<RedactionPluginConfig, RedactionCapability, RedactionState> {
|
|
5
|
+
static readonly id: "redaction";
|
|
6
|
+
private engine;
|
|
7
|
+
private config;
|
|
8
|
+
private selectionCapability;
|
|
9
|
+
private interactionManagerCapability;
|
|
10
|
+
private readonly redactionSelection$;
|
|
11
|
+
private readonly pending$;
|
|
12
|
+
private readonly selected$;
|
|
13
|
+
private readonly unsubscribeSelectionChange;
|
|
14
|
+
private readonly unsubscribeEndSelection;
|
|
15
|
+
private readonly unsubscribeModeChange;
|
|
16
|
+
constructor(id: string, registry: PluginRegistry, engine: PdfEngine, config: RedactionPluginConfig);
|
|
17
|
+
initialize(_config: RedactionPluginConfig): Promise<void>;
|
|
18
|
+
protected buildCapability(): RedactionCapability;
|
|
19
|
+
private selectPending;
|
|
20
|
+
private deselectPending;
|
|
21
|
+
private enableRedactSelection;
|
|
22
|
+
private toggleRedactSelection;
|
|
23
|
+
private enableMarqueeRedact;
|
|
24
|
+
private toggleMarqueeRedact;
|
|
25
|
+
private startRedaction;
|
|
26
|
+
private endRedaction;
|
|
27
|
+
registerMarqueeOnPage(opts: RegisterMarqueeOnPageOptions): () => void;
|
|
28
|
+
private queueCurrentSelectionAsPending;
|
|
29
|
+
private commitPendingOne;
|
|
30
|
+
private commitAllPending;
|
|
31
|
+
onStoreUpdated(_: RedactionState, newState: RedactionState): void;
|
|
32
|
+
destroy(): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BasePluginConfig, EventHook } from '@embedpdf/core';
|
|
2
|
+
import { PdfErrorReason, Rect, Task } from '@embedpdf/models';
|
|
3
|
+
import { FormattedSelection } from '@embedpdf/plugin-selection';
|
|
4
|
+
export interface SelectedRedaction {
|
|
5
|
+
page: number;
|
|
6
|
+
id: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface RedactionState {
|
|
9
|
+
isRedacting: boolean;
|
|
10
|
+
pending: Record<number, RedactionItem[]>;
|
|
11
|
+
selected: SelectedRedaction | null;
|
|
12
|
+
}
|
|
13
|
+
export type RedactionItem = {
|
|
14
|
+
id: string;
|
|
15
|
+
kind: 'text';
|
|
16
|
+
page: number;
|
|
17
|
+
boundingRect: Rect;
|
|
18
|
+
rects: Rect[];
|
|
19
|
+
} | {
|
|
20
|
+
id: string;
|
|
21
|
+
kind: 'area';
|
|
22
|
+
page: number;
|
|
23
|
+
rect: Rect;
|
|
24
|
+
};
|
|
25
|
+
export interface MarqueeRedactCallback {
|
|
26
|
+
onPreview?: (rect: Rect | null) => void;
|
|
27
|
+
onCommit?: (rect: Rect) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface RegisterMarqueeOnPageOptions {
|
|
30
|
+
pageIndex: number;
|
|
31
|
+
scale: number;
|
|
32
|
+
callback: MarqueeRedactCallback;
|
|
33
|
+
}
|
|
34
|
+
export interface RedactionPluginConfig extends BasePluginConfig {
|
|
35
|
+
blackbox: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface RedactionCapability {
|
|
38
|
+
queueCurrentSelectionAsPending: () => Task<boolean, PdfErrorReason>;
|
|
39
|
+
enableMarqueeRedact: () => void;
|
|
40
|
+
toggleMarqueeRedact: () => void;
|
|
41
|
+
isMarqueeRedactActive: () => boolean;
|
|
42
|
+
enableRedactSelection: () => void;
|
|
43
|
+
toggleRedactSelection: () => void;
|
|
44
|
+
isRedactSelectionActive: () => boolean;
|
|
45
|
+
onRedactionSelectionChange: EventHook<FormattedSelection[]>;
|
|
46
|
+
onPendingChange: EventHook<Record<number, RedactionItem[]>>;
|
|
47
|
+
removePending: (page: number, id: string) => void;
|
|
48
|
+
clearPending: () => void;
|
|
49
|
+
commitAllPending: () => Task<boolean, PdfErrorReason>;
|
|
50
|
+
commitPending: (page: number, id: string) => Task<boolean, PdfErrorReason>;
|
|
51
|
+
endRedaction: () => void;
|
|
52
|
+
startRedaction: () => void;
|
|
53
|
+
onSelectionChange: EventHook<SelectedRedaction | null>;
|
|
54
|
+
selectPending: (page: number, id: string) => void;
|
|
55
|
+
deselectPending: () => void;
|
|
56
|
+
registerMarqueeOnPage(opts: RegisterMarqueeOnPageOptions): () => void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSX } from 'preact';
|
|
2
|
+
export { Fragment } from 'preact';
|
|
3
|
+
export { useEffect, useRef, useState, useMemo, useCallback } from 'preact/hooks';
|
|
4
|
+
export type { ComponentChildren as ReactNode } from 'preact';
|
|
5
|
+
export type HTMLAttributes<T = any> = import('preact').JSX.HTMLAttributes<T extends EventTarget ? T : never>;
|
|
6
|
+
export type CSSProperties = import('preact').JSX.CSSProperties;
|
|
7
|
+
export type MouseEvent<T = Element> = JSX.TargetedMouseEvent<T extends EventTarget ? T : never>;
|
|
8
|
+
export type PointerEvent<T = Element> = JSX.TargetedPointerEvent<T extends EventTarget ? T : never>;
|
|
9
|
+
export type ChangeEvent<T = Element> = JSX.TargetedInputEvent<T extends EventTarget ? T : never>;
|
|
10
|
+
export type TouchEvent<T = Element> = JSX.TargetedTouchEvent<T extends EventTarget ? T : never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@embedpdf/core/preact';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core/preact"),t=require("@embedpdf/plugin-redaction"),i=require("preact/jsx-runtime"),n=require("preact"),r=require("preact/hooks"),o=require("@embedpdf/models"),s=()=>e.usePlugin(t.RedactionPlugin.id),a=()=>e.useCapability(t.RedactionPlugin.id),l=({pageIndex:e,scale:t,className:n,stroke:o="red",fill:a="transparent"})=>{const{plugin:l}=s(),[d,c]=r.useState(null);return r.useEffect((()=>{if(l)return l.registerMarqueeOnPage({pageIndex:e,scale:t,callback:{onPreview:c}})}),[l,e]),d?i.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:d.origin.x*t,top:d.origin.y*t,width:d.size.width*t,height:d.size.height*t,border:`1px solid ${o}`,background:a,boxSizing:"border-box"},className:n}):null};function d({color:e="#FFFF00",opacity:t=.5,border:n="1px solid red",rects:r,rect:o,scale:s,onClick:a,style:l,...d}){return i.jsx(i.Fragment,{children:r.map(((r,c)=>i.jsx("div",{onPointerDown:a,onTouchStart:a,style:{position:"absolute",border:n,left:(o?r.origin.x-o.origin.x:r.origin.x)*s,top:(o?r.origin.y-o.origin.y:r.origin.y)*s,width:r.size.width*s,height:r.size.height*s,background:e,opacity:t,pointerEvents:a?"auto":"none",cursor:a?"pointer":"default",zIndex:a?1:void 0,...l},...d},c)))})}function c({pageIndex:e,scale:t}){const{provides:n}=a(),[o,s]=r.useState([]),[l,c]=r.useState(null);return r.useEffect((()=>{if(n)return n.onRedactionSelectionChange((t=>{const i=t.find((t=>t.pageIndex===e));s((null==i?void 0:i.segmentRects)??[]),c((null==i?void 0:i.rect)??null)}))}),[n,e]),l?i.jsx("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:i.jsx(d,{color:"transparent",opacity:1,rects:o,scale:t,border:"1px solid red"})}):null}function u({pageIndex:t,scale:s,bboxStroke:l="rgba(0,0,0,0.8)",rotation:c=o.Rotation.Degree0,selectionMenu:u}){const{provides:p}=a(),[g,x]=r.useState([]),[h,b]=r.useState(null);if(r.useEffect((()=>{if(!p)return;const e=p.onPendingChange((e=>x(e[t]??[]))),i=p.onSelectionChange((e=>{b(e&&e.page===t?e.id:null)}));return()=>{null==e||e(),null==i||i()}}),[p,t]),!g.length)return null;const f=r.useCallback(((e,i)=>{e.stopPropagation(),p&&p.selectPending(t,i)}),[p,t]);return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:g.map((r=>{if("area"===r.kind){const o=r.rect;return i.jsxs(n.Fragment,{children:[i.jsx("div",{style:{position:"absolute",left:o.origin.x*s,top:o.origin.y*s,width:o.size.width*s,height:o.size.height*s,background:"transparent",outline:h===r.id?`1px solid ${l}`:"none",outlineOffset:"2px",border:"1px solid red",pointerEvents:"auto",cursor:"pointer"},onPointerDown:e=>f(e,r.id),onTouchStart:e=>f(e,r.id)}),i.jsx(e.CounterRotate,{rect:{origin:{x:o.origin.x*s,y:o.origin.y*s},size:{width:o.size.width*s,height:o.size.height*s}},rotation:c,children:({rect:e,menuWrapperProps:i})=>u&&u({item:r,selected:h===r.id,pageIndex:t,menuWrapperProps:i,rect:e})})]},r.id)}const o=r.boundingRect;return i.jsxs(n.Fragment,{children:[i.jsx("div",{style:{position:"absolute",left:o.origin.x*s,top:o.origin.y*s,width:o.size.width*s,height:o.size.height*s,background:"transparent",outline:h===r.id?`1px solid ${l}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:h===r.id?"pointer":"default"},children:i.jsx(d,{rect:o,rects:r.rects,color:"transparent",border:"1px solid red",scale:s,onClick:e=>f(e,r.id)})}),i.jsx(e.CounterRotate,{rect:{origin:{x:o.origin.x*s,y:o.origin.y*s},size:{width:o.size.width*s,height:o.size.height*s}},rotation:c,children:({rect:e,menuWrapperProps:i})=>u&&u({item:r,selected:h===r.id,pageIndex:t,menuWrapperProps:i,rect:e})})]},r.id)}))})}exports.RedactionLayer=({pageIndex:e,scale:t,rotation:r=o.Rotation.Degree0,selectionMenu:s})=>i.jsxs(n.Fragment,{children:[i.jsx(u,{pageIndex:e,scale:t,rotation:r,selectionMenu:s}),i.jsx(l,{pageIndex:e,scale:t}),i.jsx(c,{pageIndex:e,scale:t})]}),exports.useRedactionCapability=a,exports.useRedactionPlugin=s;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","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":["useRedactionPlugin","usePlugin","RedactionPlugin","id","useRedactionCapability","useCapability","MarqueeRedact","pageIndex","scale","className","stroke","fill","plugin","redactionPlugin","rect","setRect","useState","useEffect","registerMarqueeOnPage","callback","onPreview","jsxRuntime","jsx","style","position","pointerEvents","left","origin","x","top","y","width","size","height","border","background","boxSizing","Highlight","color","opacity","rects","onClick","props","Fragment","children","map","b","i","onPointerDown","onTouchStart","cursor","zIndex","SelectionRedact","provides","redactionProvides","setRects","boundingRect","setBoundingRect","onRedactionSelectionChange","formattedSelection","selection","find","s","segmentRects","mixBlendMode","inset","PendingRedactions","bboxStroke","rotation","Rotation","Degree0","selectionMenu","redaction","items","setItems","selectedId","setSelectedId","off1","onPendingChange","off2","onSelectionChange","sel","page","length","select","useCallback","e","stopPropagation","selectPending","it","kind","r","outline","outlineOffset","CounterRotate","menuWrapperProps","item","selected"],"mappings":"6QAGaA,EAAqB,IAAMC,YAA2BC,EAAAA,gBAAgBC,IACtEC,EAAyB,IAAMC,gBAA+BH,EAAAA,gBAAgBC,ICa9EG,EAAgB,EAC3BC,YACAC,QACAC,YACAC,SAAS,MACTC,OAAO,kBAEP,MAAQC,OAAQC,GAAoBb,KAE7Bc,EAAMC,GAAWC,EAAAA,SAAsB,MAa1C,OAXJC,EAAAA,WAAU,KACR,GAAKJ,EACL,OAAOA,EAAgBK,sBAAsB,CAC3CX,YACAC,QACAW,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tF,GAAK,aAAagE,IAAe,OAC5D0B,cAAe,MACfpE,cAAe,OACfyB,OAAQyB,IAAec,EAAGtF,GAAK,UAAY,WAG7CyC,SAAAvB,EAAAC,IAACe,EAAA,CACCvB,KAAMgC,EACNN,MAAOiD,EAAGjD,MACVF,MAAM,cACNJ,OAAO,gBACP1B,QACAiC,QAAU6C,GAAMF,EAAOE,EAAGG,EAAGtF,QAGjCkB,EAAAC,IAACwE,EAAAA,cAAA,CACChF,KAAM,CACJa,OAAQ,CAAEC,EAAGkB,EAAEnB,OAAOC,EAAIpB,EAAOsB,EAAGgB,EAAEnB,OAAOG,EAAItB,GACjDwB,KAAM,CAAED,MAAOe,EAAEd,KAAKD,MAAQvB,EAAOyB,OAAQa,EAAEd,KAAKC,OAASzB,IAE/D4D,WAECxB,WAAG9B,OAAMiF,sBACRxB,GACAA,EAAc,CACZyB,KAAMP,EACNQ,SAAUtB,IAAec,EAAGtF,GAC5BI,YACAwF,mBACAjF,aAtCO2E,EAAGtF,GA0ClB,KAKV,wBCnI8B,EAC5BI,YACAC,QACA4D,WAAWC,EAASA,SAAAC,QACpBC,0BAGG5B,WACC,CAAAC,SAAA,CAAAvB,EAAAC,IAAC4C,EAAA,CACC3D,YACAC,QACA4D,WACAG,oBAEFjD,IAAChB,EAAc,CAAAC,YAAsBC,YACrCc,IAAC8B,EAAgB,CAAA7C,YAAsBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../shared-preact';
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { usePlugin, useCapability, CounterRotate } from "@embedpdf/core/preact";
|
|
2
|
+
import { RedactionPlugin } from "@embedpdf/plugin-redaction";
|
|
3
|
+
import { jsx, Fragment, jsxs } from "preact/jsx-runtime";
|
|
4
|
+
import { Fragment as Fragment$1 } from "preact";
|
|
5
|
+
import { useState, useEffect, useCallback } from "preact/hooks";
|
|
6
|
+
import { Rotation } from "@embedpdf/models";
|
|
7
|
+
const useRedactionPlugin = () => usePlugin(RedactionPlugin.id);
|
|
8
|
+
const useRedactionCapability = () => useCapability(RedactionPlugin.id);
|
|
9
|
+
const MarqueeRedact = ({
|
|
10
|
+
pageIndex,
|
|
11
|
+
scale,
|
|
12
|
+
className,
|
|
13
|
+
stroke = "red",
|
|
14
|
+
fill = "transparent"
|
|
15
|
+
}) => {
|
|
16
|
+
const { plugin: redactionPlugin } = useRedactionPlugin();
|
|
17
|
+
const [rect, setRect] = useState(null);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!redactionPlugin) return;
|
|
20
|
+
return redactionPlugin.registerMarqueeOnPage({
|
|
21
|
+
pageIndex,
|
|
22
|
+
scale,
|
|
23
|
+
callback: {
|
|
24
|
+
onPreview: setRect
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}, [redactionPlugin, pageIndex]);
|
|
28
|
+
if (!rect) return null;
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
style: {
|
|
33
|
+
position: "absolute",
|
|
34
|
+
pointerEvents: "none",
|
|
35
|
+
left: rect.origin.x * scale,
|
|
36
|
+
top: rect.origin.y * scale,
|
|
37
|
+
width: rect.size.width * scale,
|
|
38
|
+
height: rect.size.height * scale,
|
|
39
|
+
border: `1px solid ${stroke}`,
|
|
40
|
+
background: fill,
|
|
41
|
+
boxSizing: "border-box"
|
|
42
|
+
},
|
|
43
|
+
className
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
function Highlight({
|
|
48
|
+
color = "#FFFF00",
|
|
49
|
+
opacity = 0.5,
|
|
50
|
+
border = "1px solid red",
|
|
51
|
+
rects,
|
|
52
|
+
rect,
|
|
53
|
+
scale,
|
|
54
|
+
onClick,
|
|
55
|
+
style,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Fragment, { children: rects.map((b, i) => /* @__PURE__ */ jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
onPointerDown: onClick,
|
|
62
|
+
onTouchStart: onClick,
|
|
63
|
+
style: {
|
|
64
|
+
position: "absolute",
|
|
65
|
+
border,
|
|
66
|
+
left: (rect ? b.origin.x - rect.origin.x : b.origin.x) * scale,
|
|
67
|
+
top: (rect ? b.origin.y - rect.origin.y : b.origin.y) * scale,
|
|
68
|
+
width: b.size.width * scale,
|
|
69
|
+
height: b.size.height * scale,
|
|
70
|
+
background: color,
|
|
71
|
+
opacity,
|
|
72
|
+
pointerEvents: onClick ? "auto" : "none",
|
|
73
|
+
cursor: onClick ? "pointer" : "default",
|
|
74
|
+
zIndex: onClick ? 1 : void 0,
|
|
75
|
+
...style
|
|
76
|
+
},
|
|
77
|
+
...props
|
|
78
|
+
},
|
|
79
|
+
i
|
|
80
|
+
)) });
|
|
81
|
+
}
|
|
82
|
+
function SelectionRedact({ pageIndex, scale }) {
|
|
83
|
+
const { provides: redactionProvides } = useRedactionCapability();
|
|
84
|
+
const [rects, setRects] = useState([]);
|
|
85
|
+
const [boundingRect, setBoundingRect] = useState(null);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!redactionProvides) return;
|
|
88
|
+
return redactionProvides.onRedactionSelectionChange((formattedSelection) => {
|
|
89
|
+
const selection = formattedSelection.find((s) => s.pageIndex === pageIndex);
|
|
90
|
+
setRects((selection == null ? void 0 : selection.segmentRects) ?? []);
|
|
91
|
+
setBoundingRect((selection == null ? void 0 : selection.rect) ?? null);
|
|
92
|
+
});
|
|
93
|
+
}, [redactionProvides, pageIndex]);
|
|
94
|
+
if (!boundingRect) return null;
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
style: {
|
|
99
|
+
mixBlendMode: "normal",
|
|
100
|
+
pointerEvents: "none",
|
|
101
|
+
position: "absolute",
|
|
102
|
+
inset: 0
|
|
103
|
+
},
|
|
104
|
+
children: /* @__PURE__ */ jsx(
|
|
105
|
+
Highlight,
|
|
106
|
+
{
|
|
107
|
+
color: "transparent",
|
|
108
|
+
opacity: 1,
|
|
109
|
+
rects,
|
|
110
|
+
scale,
|
|
111
|
+
border: "1px solid red"
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
function PendingRedactions({
|
|
118
|
+
pageIndex,
|
|
119
|
+
scale,
|
|
120
|
+
bboxStroke = "rgba(0,0,0,0.8)",
|
|
121
|
+
rotation = Rotation.Degree0,
|
|
122
|
+
selectionMenu
|
|
123
|
+
}) {
|
|
124
|
+
const { provides: redaction } = useRedactionCapability();
|
|
125
|
+
const [items, setItems] = useState([]);
|
|
126
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (!redaction) return;
|
|
129
|
+
const off1 = redaction.onPendingChange((map) => setItems(map[pageIndex] ?? []));
|
|
130
|
+
const off2 = redaction.onSelectionChange((sel) => {
|
|
131
|
+
setSelectedId(sel && sel.page === pageIndex ? sel.id : null);
|
|
132
|
+
});
|
|
133
|
+
return () => {
|
|
134
|
+
off1 == null ? void 0 : off1();
|
|
135
|
+
off2 == null ? void 0 : off2();
|
|
136
|
+
};
|
|
137
|
+
}, [redaction, pageIndex]);
|
|
138
|
+
if (!items.length) return null;
|
|
139
|
+
const select = useCallback(
|
|
140
|
+
(e, id) => {
|
|
141
|
+
e.stopPropagation();
|
|
142
|
+
if (!redaction) return;
|
|
143
|
+
redaction.selectPending(pageIndex, id);
|
|
144
|
+
},
|
|
145
|
+
[redaction, pageIndex]
|
|
146
|
+
);
|
|
147
|
+
return /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: items.map((it) => {
|
|
148
|
+
if (it.kind === "area") {
|
|
149
|
+
const r = it.rect;
|
|
150
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
style: {
|
|
155
|
+
position: "absolute",
|
|
156
|
+
left: r.origin.x * scale,
|
|
157
|
+
top: r.origin.y * scale,
|
|
158
|
+
width: r.size.width * scale,
|
|
159
|
+
height: r.size.height * scale,
|
|
160
|
+
background: "transparent",
|
|
161
|
+
outline: selectedId === it.id ? `1px solid ${bboxStroke}` : "none",
|
|
162
|
+
outlineOffset: "2px",
|
|
163
|
+
border: `1px solid red`,
|
|
164
|
+
pointerEvents: "auto",
|
|
165
|
+
cursor: "pointer"
|
|
166
|
+
},
|
|
167
|
+
onPointerDown: (e) => select(e, it.id),
|
|
168
|
+
onTouchStart: (e) => select(e, it.id)
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ jsx(
|
|
172
|
+
CounterRotate,
|
|
173
|
+
{
|
|
174
|
+
rect: {
|
|
175
|
+
origin: { x: r.origin.x * scale, y: r.origin.y * scale },
|
|
176
|
+
size: { width: r.size.width * scale, height: r.size.height * scale }
|
|
177
|
+
},
|
|
178
|
+
rotation,
|
|
179
|
+
children: ({ rect, menuWrapperProps }) => selectionMenu && selectionMenu({
|
|
180
|
+
item: it,
|
|
181
|
+
selected: selectedId === it.id,
|
|
182
|
+
pageIndex,
|
|
183
|
+
menuWrapperProps,
|
|
184
|
+
rect
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] }, it.id);
|
|
189
|
+
}
|
|
190
|
+
const b = it.boundingRect;
|
|
191
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
style: {
|
|
196
|
+
position: "absolute",
|
|
197
|
+
left: b.origin.x * scale,
|
|
198
|
+
top: b.origin.y * scale,
|
|
199
|
+
width: b.size.width * scale,
|
|
200
|
+
height: b.size.height * scale,
|
|
201
|
+
background: "transparent",
|
|
202
|
+
outline: selectedId === it.id ? `1px solid ${bboxStroke}` : "none",
|
|
203
|
+
outlineOffset: "2px",
|
|
204
|
+
pointerEvents: "auto",
|
|
205
|
+
cursor: selectedId === it.id ? "pointer" : "default"
|
|
206
|
+
},
|
|
207
|
+
children: /* @__PURE__ */ jsx(
|
|
208
|
+
Highlight,
|
|
209
|
+
{
|
|
210
|
+
rect: b,
|
|
211
|
+
rects: it.rects,
|
|
212
|
+
color: "transparent",
|
|
213
|
+
border: "1px solid red",
|
|
214
|
+
scale,
|
|
215
|
+
onClick: (e) => select(e, it.id)
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
CounterRotate,
|
|
222
|
+
{
|
|
223
|
+
rect: {
|
|
224
|
+
origin: { x: b.origin.x * scale, y: b.origin.y * scale },
|
|
225
|
+
size: { width: b.size.width * scale, height: b.size.height * scale }
|
|
226
|
+
},
|
|
227
|
+
rotation,
|
|
228
|
+
children: ({ rect, menuWrapperProps }) => selectionMenu && selectionMenu({
|
|
229
|
+
item: it,
|
|
230
|
+
selected: selectedId === it.id,
|
|
231
|
+
pageIndex,
|
|
232
|
+
menuWrapperProps,
|
|
233
|
+
rect
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
] }, it.id);
|
|
238
|
+
}) });
|
|
239
|
+
}
|
|
240
|
+
const RedactionLayer = ({
|
|
241
|
+
pageIndex,
|
|
242
|
+
scale,
|
|
243
|
+
rotation = Rotation.Degree0,
|
|
244
|
+
selectionMenu
|
|
245
|
+
}) => {
|
|
246
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
247
|
+
/* @__PURE__ */ jsx(
|
|
248
|
+
PendingRedactions,
|
|
249
|
+
{
|
|
250
|
+
pageIndex,
|
|
251
|
+
scale,
|
|
252
|
+
rotation,
|
|
253
|
+
selectionMenu
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ jsx(MarqueeRedact, { pageIndex, scale }),
|
|
257
|
+
/* @__PURE__ */ jsx(SelectionRedact, { pageIndex, scale })
|
|
258
|
+
] });
|
|
259
|
+
};
|
|
260
|
+
export {
|
|
261
|
+
RedactionLayer,
|
|
262
|
+
useRedactionCapability,
|
|
263
|
+
useRedactionPlugin
|
|
264
|
+
};
|
|
265
|
+
//# 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,MAAM,UAA2B,gBAAgB,EAAE;AAC9E,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;ACatF,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,OAAO;AACT,MAA0B;AACxB,QAAM,EAAE,QAAQ,gBAAgB,IAAI,mBAAmB;AAEvD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAsB,IAAI;AAElD,YAAU,MAAM;AACd,QAAI,CAAC,gBAAiB;AACtB,WAAO,gBAAgB,sBAAsB;AAAA,MAC3C;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,WAAW;AAAA,MAAA;AAAA,IACb,CACD;AAAA,EAAA,GACA,CAAC,iBAAiB,SAAS,CAAC;AAE3B,MAAA,CAAC,KAAa,QAAA;AAGhB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,eAAe;AAAA,QACf,MAAM,KAAK,OAAO,IAAI;AAAA,QACtB,KAAK,KAAK,OAAO,IAAI;AAAA,QACrB,OAAO,KAAK,KAAK,QAAQ;AAAA,QACzB,QAAQ,KAAK,KAAK,SAAS;AAAA,QAC3B,QAAQ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,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 @@
|
|
|
1
|
+
export * from '@embedpdf/core/react';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core/react"),t=require("@embedpdf/plugin-redaction"),i=require("react/jsx-runtime"),n=require("react"),o=require("@embedpdf/models"),r=()=>e.usePlugin(t.RedactionPlugin.id),s=()=>e.useCapability(t.RedactionPlugin.id),a=({pageIndex:e,scale:t,className:o,stroke:s="red",fill:a="transparent"})=>{const{plugin:l}=r(),[d,c]=n.useState(null);return n.useEffect((()=>{if(l)return l.registerMarqueeOnPage({pageIndex:e,scale:t,callback:{onPreview:c}})}),[l,e]),d?i.jsx("div",{style:{position:"absolute",pointerEvents:"none",left:d.origin.x*t,top:d.origin.y*t,width:d.size.width*t,height:d.size.height*t,border:`1px solid ${s}`,background:a,boxSizing:"border-box"},className:o}):null};function l({color:e="#FFFF00",opacity:t=.5,border:n="1px solid red",rects:o,rect:r,scale:s,onClick:a,style:l,...d}){return i.jsx(i.Fragment,{children:o.map(((o,c)=>i.jsx("div",{onPointerDown:a,onTouchStart:a,style:{position:"absolute",border:n,left:(r?o.origin.x-r.origin.x:o.origin.x)*s,top:(r?o.origin.y-r.origin.y:o.origin.y)*s,width:o.size.width*s,height:o.size.height*s,background:e,opacity:t,pointerEvents:a?"auto":"none",cursor:a?"pointer":"default",zIndex:a?1:void 0,...l},...d},c)))})}function d({pageIndex:e,scale:t}){const{provides:o}=s(),[r,a]=n.useState([]),[d,c]=n.useState(null);return n.useEffect((()=>{if(o)return o.onRedactionSelectionChange((t=>{const i=t.find((t=>t.pageIndex===e));a((null==i?void 0:i.segmentRects)??[]),c((null==i?void 0:i.rect)??null)}))}),[o,e]),d?i.jsx("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:i.jsx(l,{color:"transparent",opacity:1,rects:r,scale:t,border:"1px solid red"})}):null}function c({pageIndex:t,scale:r,bboxStroke:a="rgba(0,0,0,0.8)",rotation:d=o.Rotation.Degree0,selectionMenu:c}){const{provides:u}=s(),[p,g]=n.useState([]),[x,h]=n.useState(null);if(n.useEffect((()=>{if(!u)return;const e=u.onPendingChange((e=>g(e[t]??[]))),i=u.onSelectionChange((e=>{h(e&&e.page===t?e.id:null)}));return()=>{null==e||e(),null==i||i()}}),[u,t]),!p.length)return null;const b=n.useCallback(((e,i)=>{e.stopPropagation(),u&&u.selectPending(t,i)}),[u,t]);return i.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:p.map((o=>{if("area"===o.kind){const s=o.rect;return i.jsxs(n.Fragment,{children:[i.jsx("div",{style:{position:"absolute",left:s.origin.x*r,top:s.origin.y*r,width:s.size.width*r,height:s.size.height*r,background:"transparent",outline:x===o.id?`1px solid ${a}`:"none",outlineOffset:"2px",border:"1px solid red",pointerEvents:"auto",cursor:"pointer"},onPointerDown:e=>b(e,o.id),onTouchStart:e=>b(e,o.id)}),i.jsx(e.CounterRotate,{rect:{origin:{x:s.origin.x*r,y:s.origin.y*r},size:{width:s.size.width*r,height:s.size.height*r}},rotation:d,children:({rect:e,menuWrapperProps:i})=>c&&c({item:o,selected:x===o.id,pageIndex:t,menuWrapperProps:i,rect:e})})]},o.id)}const s=o.boundingRect;return i.jsxs(n.Fragment,{children:[i.jsx("div",{style:{position:"absolute",left:s.origin.x*r,top:s.origin.y*r,width:s.size.width*r,height:s.size.height*r,background:"transparent",outline:x===o.id?`1px solid ${a}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:x===o.id?"pointer":"default"},children:i.jsx(l,{rect:s,rects:o.rects,color:"transparent",border:"1px solid red",scale:r,onClick:e=>b(e,o.id)})}),i.jsx(e.CounterRotate,{rect:{origin:{x:s.origin.x*r,y:s.origin.y*r},size:{width:s.size.width*r,height:s.size.height*r}},rotation:d,children:({rect:e,menuWrapperProps:i})=>c&&c({item:o,selected:x===o.id,pageIndex:t,menuWrapperProps:i,rect:e})})]},o.id)}))})}exports.RedactionLayer=({pageIndex:e,scale:t,rotation:r=o.Rotation.Degree0,selectionMenu:s})=>i.jsxs(n.Fragment,{children:[i.jsx(c,{pageIndex:e,scale:t,rotation:r,selectionMenu:s}),i.jsx(a,{pageIndex:e,scale:t}),i.jsx(d,{pageIndex:e,scale:t})]}),exports.useRedactionCapability=s,exports.useRedactionPlugin=r;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","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":["useRedactionPlugin","usePlugin","RedactionPlugin","id","useRedactionCapability","useCapability","MarqueeRedact","pageIndex","scale","className","stroke","fill","plugin","redactionPlugin","rect","setRect","useState","useEffect","registerMarqueeOnPage","callback","onPreview","jsxRuntime","jsx","style","position","pointerEvents","left","origin","x","top","y","width","size","height","border","background","boxSizing","Highlight","color","opacity","rects","onClick","props","Fragment","children","map","b","i","onPointerDown","onTouchStart","cursor","zIndex","SelectionRedact","provides","redactionProvides","setRects","boundingRect","setBoundingRect","onRedactionSelectionChange","formattedSelection","selection","find","s","segmentRects","mixBlendMode","inset","PendingRedactions","bboxStroke","rotation","Rotation","Degree0","selectionMenu","redaction","items","setItems","selectedId","setSelectedId","off1","onPendingChange","off2","onSelectionChange","sel","page","length","select","useCallback","e","stopPropagation","selectPending","it","kind","r","outline","outlineOffset","CounterRotate","menuWrapperProps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