@embedpdf/plugin-redaction 2.4.0 → 2.5.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/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +6 -2
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +6 -2
- package/dist/react/index.js.map +1 -1
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +9 -2
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +8 -2
- package/dist/vue/index.js.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","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/index.ts","../../src/svelte/components/redaction-layer.svelte"],"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","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","<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":["isHovered","$","state","object","segmentRects","derived","get","rect","strokeColor","color","opacity","textColor","fontColor","overlayColor","overlayText","overlayTextRepeat","fontSize","fontFamily","PdfStandardFont","Helvetica","textAlign","PdfTextAlignment","Center","renderOverlayText","Array","fill","join","justifyContent","Left","Right","div","root","position","inset","index","$$anchor","b","left","origin","x","$$props","scale","top","y","width","size","height","scaledFontSize","Math","min","div_1","root_1","__pointerdown","$$args","__touchstart","span","root_2","styles_1","$0","standardFontCss","textAlignmentToCss","$$render","consequent","styles","set","e","cursor","isSelected","redactRenderers","createRenderer","id","matches","a","type","PdfAnnotationSubtype","REDACT","_a","length","component","RedactHighlight","RedactArea","registry","getRendererRegistry","onMount","register","useRedactionPlugin","usePlugin","RedactionPlugin","useRedactionCapability","useCapability","border","style","boundingRect","template_effect","set_style","onClick","className","redactionPlugin","documentState","useDocumentState","documentId","actualScale","current","plugin","getPreviewStrokeColor","user_effect","registerMarqueeOnPage","pageIndex","callback","onPreview","newRect","set_class","rotation","prop","Rotation","Degree0","bboxStroke","redactionCapability","items","proxy","selectedId","select","stopPropagation","provides","forDocument","selectPending","shouldShowMenu","itemId","selectionMenu","selectionMenuSnippet","buildContext","item","redactionValue","scoped","currentState","getState","pending","filter","it","source","selected","page","off1","onPendingChange","map","off2","onSelectedChange","sel","menuPlacement","suggestTop","spaceAbove","spaceBelow","buildMenuProps","menuWrapperProps","context","placement","first_child","fragment_2","children","$$arg0","menuProps","result","result_component","spread_props","props","CounterRotate","consequent_3","div_2","fragment_9","Highlight","rects","result_component_1","consequent_5","consequent_8","kind","consequent_4","alternate_2","consequent_9","onRedactionSelectionChange","formattedSelection","selection","find","s","node_1","RedactionPluginPackage","createPluginPackage","BaseRedactionPackage","addUtility","RedactRendererRegistration","build","actualRotation","PendingRedactions","node","MarqueeRedact","SelectionRedact","getDocumentId","capability","initialDocumentState","scopedProvides","docId","scope","onStateChange","newState"],"mappings":"21BAYMA,EAAYC,EAAAC,OAAO,GAEjB,MAAAC,6BAA6BA,QAE7BC,EAAYH,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOC,cAAY,IAC3CG,EAAIN,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOI,MAGvBC,EAAWP,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOK,aAAe,WAE7CC,EAAKR,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOM,OAAS,WAEjCC,EAAOT,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOO,SAAW,GAErCC,EAASV,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOS,iBAAaT,GAAOU,cAAgB,WAEhEC,EAAWb,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOW,aAC9BC,EAAiBd,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOY,oBAAqB,GACzDC,EAAQf,EAAAI,QAAA,IAAAJ,EAAAK,IAAYH,GAAOa,UAAY,IACvCC,sBAAsBd,GAAOc,YAAcC,EAAAA,gBAAgBC,WAC3DC,sBAAq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5I,cAAAA,qBADE8D,MAAY9B,0BAFT,oCCxBD,MAAM0H,EAAyBC,EAAAA,oBAAoBC,EAAAA,wBACvDC,WAAWC,GACXC,sNCsBK,MAAA3F,EAAgBC,EAAAA,iBAAgB,IAAA3D,EAAA4D,YAEhCC,EAAWpG,EAAAI,QAAA,WAAA,YAAsB,IAAtBmC,EAAAC,MAA+BD,EAAAC,OAAY,OAAAmC,EAAAsB,EAAcI,kBAAS7D,QAAS,IAEtFqJ,8DACiC,OAAAlH,IAAc0B,cAAd,EAAA1B,EAAuBoC,WAAYE,EAAAA,SAASC,uCAIpF4E,EAAgBC,EAAA,oGAGR3F,gCACGyF,iIAIXG,EAAaV,EAAA,oGAAiClF,MAC9C6F,iBAAe,oGAAiC7F,2BAXzC,4GNnBqB8F,IACrB,MAAAC,EAAa5G,QAEftF,EAAQD,EAAAC,cAA+BmM,EAAAA,uBAGrC,MAAAjG,YAAsB+F,GAGtBG,EAAArM,EAAAI,QAAA,IACJ+L,EAAWzE,gBAAYvB,GAAagG,EAAWzE,SAASC,kBAAYxB,IAAc,aAGpFnG,EAAAwG,uBACQkB,EAAWyE,EAAWzE,SACtB4E,QAAQnG,OAETuB,IAAa4E,cAChBtM,EAAA+D,IAAA9D,EAAQmM,EAAAA,sBAAA,GAIJ,MAAAG,EAAQ7E,EAASC,YAAY2E,aAIjCrM,EAAQsM,EAAMjE,YAAA,EAChB,OAAStE,GAEPhE,EAAA+D,IAAA9D,EAAQmM,EAAAA,sBAAA,EACV,CAGO,OAAAG,EAAMC,cAAeC,IAC1BzM,EAAA+D,IAAA9D,EAAQwM,GAAA,QAKN,YAAA/E,gBACK2E,EACT,EACI,SAAApM,gBACKA,EACT"}
|
|
1
|
+
{"version":3,"file":"index.cjs","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/index.ts","../../src/svelte/components/redaction-layer.svelte"],"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","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","<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 const page = $derived(documentState.current?.document?.pages?.[pageIndex]);\n\n const actualScale = $derived(scale !== undefined ? scale : (documentState.current?.scale ?? 1));\n\n const actualRotation = $derived.by(() => {\n if (rotation !== undefined) return rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page?.rotation ?? 0;\n const docRotation = documentState.current?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\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":["isHovered","$","state","object","segmentRects","derived","get","rect","strokeColor","color","opacity","textColor","fontColor","overlayColor","overlayText","overlayTextRepeat","fontSize","fontFamily","PdfStandardFont","Helvetica","textAlign","PdfTextAlignment","Center","renderOverlayText","Array","fill","join","justifyContent","Left","Right","div","root","position","inset","index","$$anchor","b","left","origin","x","$$props","scale","top","y","width","size","height","scaledFontSize","Math","min","div_1","root_1","__pointerdown","$$args","__touchstart","span","root_2","styles_1","$0","standardFontCss","textAlignmentToCss","$$render","consequent","styles","set","e","cursor","isSelected","redactRenderers","createRenderer","id","matches","a","type","PdfAnnotationSubtype","REDACT","_a","length","component","RedactHighlight","RedactArea","registry","getRendererRegistry","onMount","register","useRedactionPlugin","usePlugin","RedactionPlugin","useRedactionCapability","useCapability","border","style","boundingRect","template_effect","set_style","onClick","className","redactionPlugin","documentState","useDocumentState","documentId","actualScale","current","plugin","getPreviewStrokeColor","user_effect","registerMarqueeOnPage","pageIndex","callback","onPreview","newRect","set_class","rotation","prop","Rotation","Degree0","bboxStroke","redactionCapability","items","proxy","selectedId","select","stopPropagation","provides","forDocument","selectPending","shouldShowMenu","itemId","selectionMenu","selectionMenuSnippet","buildContext","item","redactionValue","scoped","currentState","getState","pending","filter","it","source","selected","page","off1","onPendingChange","map","off2","onSelectedChange","sel","menuPlacement","suggestTop","spaceAbove","spaceBelow","buildMenuProps","menuWrapperProps","context","placement","first_child","fragment_2","children","$$arg0","menuProps","result","result_component","spread_props","props","CounterRotate","consequent_3","div_2","fragment_9","Highlight","rects","result_component_1","consequent_5","consequent_8","kind","consequent_4","alternate_2","consequent_9","onRedactionSelectionChange","formattedSelection","selection","find","s","node_1","RedactionPluginPackage","createPluginPackage","BaseRedactionPackage","addUtility","RedactRendererRegistration","build","_c","_b","document","pages","actualRotation","PendingRedactions","node","MarqueeRedact","SelectionRedact","getDocumentId","capability","initialDocumentState","scopedProvides","docId","scope","onStateChange","newState"],"mappings":"21BAYMA,EAAYC,EAAAC,OAAO,GAEjB,MAAAC,6BAA6B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EAAAyF,EAAuB/E,WAAY,IAChB,iCAI1CmF,EAAgBC,EAAA,oGAGR/F,gCACG6F,iIAIXG,EAAad,EAAA,oGAAiClF,MAC9CiG,iBAAe,oGAAiCjG,2BAXzC,4GNxBqBkG,IACrB,MAAAC,EAAahH,QAEftF,EAAQD,EAAAC,cAA+BuM,EAAAA,uBAGrC,MAAArG,YAAsBmG,GAGtBG,EAAAzM,EAAAI,QAAA,IACJmM,EAAW7E,gBAAYvB,GAAaoG,EAAW7E,SAASC,kBAAYxB,IAAc,aAGpFnG,EAAAwG,uBACQkB,EAAW6E,EAAW7E,SACtBgF,QAAQvG,OAETuB,IAAagF,cAChB1M,EAAA+D,IAAA9D,EAAQuM,EAAAA,sBAAA,GAIJ,MAAAG,EAAQjF,EAASC,YAAY+E,aAIjCzM,EAAQ0M,EAAMrE,YAAA,EAChB,OAAStE,GAEPhE,EAAA+D,IAAA9D,EAAQuM,EAAAA,sBAAA,EACV,CAGO,OAAAG,EAAMC,cAAeC,IAC1B7M,EAAA+D,IAAA9D,EAAQ4M,GAAA,QAKN,YAAAnF,gBACK+E,EACT,EACI,SAAAxM,gBACKA,EACT"}
|
package/dist/svelte/index.js
CHANGED
|
@@ -726,13 +726,20 @@ var root = $.from_html(`<!> <!> <!>`, 1);
|
|
|
726
726
|
function Redaction_layer($$anchor, $$props) {
|
|
727
727
|
$.push($$props, true);
|
|
728
728
|
const documentState = useDocumentState(() => $$props.documentId);
|
|
729
|
+
const page = $.derived(() => {
|
|
730
|
+
var _a, _b, _c;
|
|
731
|
+
return (_c = (_b = (_a = documentState.current) == null ? void 0 : _a.document) == null ? void 0 : _b.pages) == null ? void 0 : _c[$$props.pageIndex];
|
|
732
|
+
});
|
|
729
733
|
const actualScale = $.derived(() => {
|
|
730
734
|
var _a;
|
|
731
735
|
return $$props.scale !== void 0 ? $$props.scale : ((_a = documentState.current) == null ? void 0 : _a.scale) ?? 1;
|
|
732
736
|
});
|
|
733
737
|
const actualRotation = $.derived(() => {
|
|
734
|
-
var _a;
|
|
735
|
-
|
|
738
|
+
var _a, _b;
|
|
739
|
+
if ($$props.rotation !== void 0) return $$props.rotation;
|
|
740
|
+
const pageRotation = ((_a = $.get(page)) == null ? void 0 : _a.rotation) ?? 0;
|
|
741
|
+
const docRotation = ((_b = documentState.current) == null ? void 0 : _b.rotation) ?? 0;
|
|
742
|
+
return (pageRotation + docRotation) % 4;
|
|
736
743
|
});
|
|
737
744
|
var fragment = root();
|
|
738
745
|
var node = $.first_child(fragment);
|
package/dist/svelte/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,IAAY,MAAM,EAAC,SAAS,SAAS;AAE1C,QAAA,UAAO,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,WAAW,CAAC;QAEtC,YAAS,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,mBAAa,MAAM,EAAC,gBAAgB,SAAS;QAEzE,cAAW,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,WAAW;AACzC,QAAA,oBAAiB,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,qBAAqB,KAAK;AAC9D,QAAA,WAAQ,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,YAAY,EAAE;AACzC,QAAA,mCAAsB,MAAM,E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;AAErF,IAAA,YAAO,MAAO;SACP,gBAAgB,QAAQ;YAC3B,OAAK,CAAA,GAAA,IAAA;AACL,QAAA,IAAA,cAAe,IAAI;;IAErB;AAEO,WAAA,gBAAgB,OAAO,2BAA0B,QAAA,YAAA,CAAc,uBAAuB;YACrF,YAAY,mBAAmB,MAAM,MAAM,EAAE,cAAS,QAAA,SAAA;YAC5D,QAAQ,uCAAW,iBAAY,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;;oDAWsB,WAAW,CAAA,EAAA;AALjC,kBAAQ,QAAA;AAAA;mBAEE;AAAA;yBACR,KAAK;AAAA;;;;;;;;;cATT,GAAE;0BAAF,GAAE;AAAA;;gBADA,YAAY,EAAA,UAAA,UAAA;AAAA;;;;AAFT;;4CCjCR;;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;;;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;"}
|
|
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 const page = $derived(documentState.current?.document?.pages?.[pageIndex]);\n\n const actualScale = $derived(scale !== undefined ? scale : (documentState.current?.scale ?? 1));\n\n const actualRotation = $derived.by(() => {\n if (rotation !== undefined) return rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page?.rotation ?? 0;\n const docRotation = documentState.current?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\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,IAAY,MAAM,EAAC,SAAS,SAAS;AAE1C,QAAA,UAAO,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,WAAW,CAAC;QAEtC,YAAS,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,mBAAa,MAAM,EAAC,gBAAgB,SAAS;QAEzE,cAAW,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,WAAW;AACzC,QAAA,oBAAiB,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,qBAAqB,KAAK;AAC9D,QAAA,WAAQ,EAAA,QAAA,MAAA,EAAA,IAAY,MAAM,EAAC,YAAY,EAAE;AACzC,QAAA,mCAAsB,MAAM,EAAC,cAAc,gBAAgB,SAAS;AACpE,QAAA,kCAAqB,MAAM,EAAC,aAAa,iBAAiB,MAAM;AAG7D,WAAA,oBAAmC;AACrC,QAAA,CAAA,EAAA,IAAA,WAAW,UAAS;AACpB,QAAA,CAAA,EAAA,IAAA,iBAAiB,gBAAS,WAAW;AAEpC,UAAA,OAAO;WACN,MAAM,IAAI,EAAE,WAAK,WAAW,CAAA,EAAE,KAAK,GAAG;AAAA,EAC/C;AAEM,QAAA,iBAAc,EAAA,QAAA,MA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AAI,IAAA;AAAA,IACxC,CAAC;AAAA,EACH,CAAC;;;;;UAIA,MAAE,OAAA;kBAAF,KAAE,IAAA,CAAA,GAAA;AAAA;;;;;2BAAF,GAAE;;oDAWsB,WAAW,CAAA,EAAA;AALjC,kBAAQ,QAAA;AAAA;mBAEE;AAAA;yBACR,KAAK;AAAA;;;;;;;;;cATT,GAAE;0BAAF,GAAE;AAAA;;gBADA,YAAY,EAAA,UAAA,UAAA;AAAA;;;;AAFT;;4CCjCR;;AAiCQ,QAAA,gBAAgB,iBAAgB,MAAA,QAAA,UAAA;AAChC,QAAA;;AAAgB,2CAAc,YAAd,mBAAuB,aAAvB,mBAAiC,UAAjC,mBAAsC,QAAA;AAAA,GAAA;QAEtD,cAAW,EAAA,QAAA,MAAA;;AAAA,mBAAA,UAAsB,SAAS,QAAA,UAAY,mBAAc,YAAd,mBAAuB,UAAS;AAAA,GAAC;AAEvF,QAAA,iBAAc,EAAA,QAAA,MAAqB;;6BACtB,OAAS,QAAA,QAAA;AAEpB,UAAA,iBAAY,OAAA,IAAG,IAAI,MAAP,mBAAS,aAAY;AACjC,UAAA,gBAAc,mBAAc,YAAd,mBAAuB,aAAY;YAC9C,eAAe,eAAe;AAAA,EACzC,CAAC;;;AAGFE,qBAAgB,MAAA;AAAA;;;;;;;mBAGR,WAAW;AAAA;;mBACR,cAAc;AAAA;;;;;;;;;AAIzBC,iBAAa,QAAA;AAAA;;;;;;;mBAAiC,WAAW;AAAA;;;AACzDC,mBAAe,QAAA;AAAA;;;;;;;mBAAiC,WAAW;AAAA;;;;AAXpD;ACpCD,MAAM,yBAAyB,oBAAoBC,wBAAoB,EAC3E,WAAW,0BAA0B,EACrC,MAAA;"}
|
package/dist/vue/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-redaction"),o=require("vue"),n=require("@embedpdf/core/vue"),a=require("@embedpdf/models"),l=require("@embedpdf/utils/vue"),r=require("@embedpdf/plugin-annotation/vue"),i=o.defineComponent({__name:"highlight",props:{color:{default:"#FFFF00"},opacity:{default:1},border:{default:"1px solid red"},rects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e.rect;return(n,a)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.rects,(l,r)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:r,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:{position:"absolute",border:e.border,left:(o.unref(t)?l.origin.x-o.unref(t).origin.x:l.origin.x)*e.scale+"px",top:(o.unref(t)?l.origin.y-o.unref(t).origin.y:l.origin.y)*e.scale+"px",width:l.size.width*e.scale+"px",height:l.size.height*e.scale+"px",background:e.color,opacity:e.opacity,pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:void 0}},{ref_for:!0},n.$attrs),null,16))),128))}}),c=()=>n.usePlugin(t.RedactionPlugin.id),u=()=>n.useCapability(t.RedactionPlugin.id),d=o.defineComponent({__name:"marquee-redact",props:{documentId:{},pageIndex:{},scale:{},className:{},stroke:{default:"red"},fill:{default:"transparent"}},setup(e){const t=e,{plugin:a}=c(),l=n.useDocumentState(()=>t.documentId),r=o.ref(null),i=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=l.value)?void 0:e.scale)??1}),u=o.computed(()=>{var e;return t.stroke??(null==(e=a.value)?void 0:e.getPreviewStrokeColor())??"red"});return o.watch([a,()=>t.documentId,()=>t.pageIndex,i],([e,t,o,n],a,l)=>{if(!e||!t)return;l(e.registerMarqueeOnPage({documentId:t,pageIndex:o,scale:n,callback:{onPreview:e=>{r.value=e}}}))},{immediate:!0}),(t,n)=>r.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({position:"absolute",pointerEvents:"none",left:r.value.origin.x*i.value+"px",top:r.value.origin.y*i.value+"px",width:r.value.size.width*i.value+"px",height:r.value.size.height*i.value+"px",border:`1px solid ${u.value}`,background:e.fill,boxSizing:"border-box"}),class:o.normalizeClass(e.className)},null,6)):o.createCommentVNode("",!0)}}),s={key:0,style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0}},p=o.defineComponent({__name:"selection-redact",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{plugin:n}=c(),a=o.ref([]),l=o.ref(null),r=o.computed(()=>{var e;return(null==(e=n.value)?void 0:e.getPreviewStrokeColor())??"red"});return o.watch([n,()=>t.documentId,()=>t.pageIndex],([e,t,o],n,r)=>{if(!e)return a.value=[],void(l.value=null);r(e.onRedactionSelectionChange(t,e=>{const t=e.find(e=>e.pageIndex===o);a.value=(null==t?void 0:t.segmentRects)??[],l.value=(null==t?void 0:t.rect)??null}))},{immediate:!0}),(t,n)=>l.value?(o.openBlock(),o.createElementBlock("div",s,[o.createVNode(i,{color:"transparent",opacity:1,rects:a.value,scale:e.scale,border:`1px solid ${r.value}`},null,8,["rects","scale","border"])])):o.createCommentVNode("",!0)}}),m={key:0,style:{position:"absolute",inset:0,pointerEvents:"none"}},v=["onPointerdown","onTouchstart"],g=o.defineComponent({__name:"pending-redactions",props:{documentId:{},pageIndex:{},scale:{},rotation:{default:a.Rotation.Degree0},bboxStroke:{default:"rgba(0,0,0,0.8)"},selectionMenu:{}},setup(e){const t=e,n=o.useSlots(),{provides:a}=u(),r=o.ref([]),c=o.ref(null);o.watch([a,()=>t.documentId,()=>t.pageIndex],([e,t,o],n,a)=>{if(!e)return r.value=[],void(c.value=null);const l=e.forDocument(t),i=l.getState();r.value=(i.pending[o]??[]).filter(e=>"legacy"===e.source),c.value=i.selected&&i.selected.page===o?i.selected.id:null;const u=l.onPendingChange(e=>{r.value=(e[o]??[]).filter(e=>"legacy"===e.source)}),d=l.onSelectedChange(e=>{c.value=e&&e.page===o?e.id:null});a(()=>{null==u||u(),null==d||d()})},{immediate:!0});const d=(e,o)=>{e.stopPropagation();const n=a.value;n&&n.forDocument(t.documentId).selectPending(t.pageIndex,o)},s=e=>c.value===e&&(!!t.selectionMenu||!!n["selection-menu"]),p=e=>({type:"redaction",item:e,pageIndex:t.pageIndex}),g={suggestTop:!1,spaceAbove:0,spaceBelow:0},x=(e,o,n)=>t.selectionMenu?t.selectionMenu({rect:o,menuWrapperProps:n,selected:c.value===e.id,placement:g,context:p(e)}):null;return(t,n)=>r.value.length?(o.openBlock(),o.createElementBlock("div",m,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,n=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:n.id},["area"===n.kind?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:n.rect.origin.x*e.scale+"px",top:n.rect.origin.y*e.scale+"px",width:n.rect.size.width*e.scale+"px",height:n.rect.size.height*e.scale+"px",background:"transparent",outline:c.value===n.id?`1px solid ${e.bboxStroke}`:"none",outlineOffset:"2px",border:"1px solid red",pointerEvents:"auto",cursor:"pointer"}),onPointerdown:e=>d(e,n.id),onTouchstart:e=>d(e,n.id)},null,44,v),s(n.id)?(o.openBlock(),o.createBlock(o.unref(l.CounterRotate),{key:0,rect:{origin:{x:n.rect.origin.x*e.scale,y:n.rect.origin.y*e.scale},size:{width:n.rect.size.width*e.scale,height:n.rect.size.height*e.scale}},rotation:e.rotation},{default:o.withCtx(({rect:a,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x(n,a,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:p(n),selected:c.value===n.id,rect:a,placement:g,menuWrapperProps:l})]),_:2},1032,["rect","rotation"])):o.createCommentVNode("",!0)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:n.rect.origin.x*e.scale+"px",top:n.rect.origin.y*e.scale+"px",width:n.rect.size.width*e.scale+"px",height:n.rect.size.height*e.scale+"px",background:"transparent",outline:c.value===n.id?`1px solid ${e.bboxStroke}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:c.value===n.id?"pointer":"default"})},[o.createVNode(i,{rect:n.rect,rects:n.rects,color:"transparent",border:"1px solid red",scale:e.scale,"on-click":e=>d(e,n.id)},null,8,["rect","rects","scale","on-click"])],4),s(n.id)?(o.openBlock(),o.createBlock(o.unref(l.CounterRotate),{key:0,rect:{origin:{x:n.rect.origin.x*e.scale,y:n.rect.origin.y*e.scale},size:{width:n.rect.size.width*e.scale,height:n.rect.size.height*e.scale}},rotation:e.rotation},{default:o.withCtx(({rect:a,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x(n,a,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:p(n),selected:c.value===n.id,rect:a,placement:g,menuWrapperProps:l})]),_:2},1032,["rect","rotation"])):o.createCommentVNode("",!0)],64))],64))),128))])):o.createCommentVNode("",!0)}}),x=o.defineComponent({__name:"redaction-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},bboxStroke:{default:"rgba(0,0,0,0.8)"},selectionMenu:{}},setup(e){const t=e,l=n.useDocumentState(()=>t.documentId),r=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=l.value)?void 0:e.scale)??1}),i=o.computed(()=>{var e;return void 0!==t.rotation?t.rotation:(null==(e=l.value)?void 0:e.rotation)??a.Rotation.Degree0});return(t,n)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(g,{"document-id":e.documentId,"page-index":e.pageIndex,scale:r.value,rotation:i.value,"bbox-stroke":e.bboxStroke,"selection-menu":e.selectionMenu},{"selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["document-id","page-index","scale","rotation","bbox-stroke","selection-menu"]),o.createVNode(d,{"document-id":e.documentId,"page-index":e.pageIndex,scale:r.value},null,8,["document-id","page-index","scale"]),o.createVNode(p,{"document-id":e.documentId,"page-index":e.pageIndex,scale:r.value},null,8,["document-id","page-index","scale"])],64))}}),f=o.defineComponent({__name:"redact-highlight",props:{annotation:{},isSelected:{type:Boolean},scale:{},pageIndex:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(!1),l=o.computed(()=>t.annotation.object.segmentRects??[]),r=o.computed(()=>t.annotation.object.rect),i=o.computed(()=>t.annotation.object.strokeColor??"#FF0000"),c=o.computed(()=>t.annotation.object.color??"#000000"),u=o.computed(()=>t.annotation.object.opacity??1),d=o.computed(()=>t.annotation.object.fontColor??t.annotation.object.overlayColor??"#FFFFFF"),s=o.computed(()=>t.annotation.object.overlayText),p=o.computed(()=>t.annotation.object.overlayTextRepeat??!1),m=o.computed(()=>t.annotation.object.fontSize??12),v=o.computed(()=>t.annotation.object.fontFamily??a.PdfStandardFont.Helvetica),g=o.computed(()=>t.annotation.object.textAlign??a.PdfTextAlignment.Center),x=o.computed(()=>{if(!s.value)return"";if(!p.value)return s.value;return Array(10).fill(s.value).join(" ")}),f=e=>({position:"absolute",left:(r.value?e.origin.x-r.value.origin.x:e.origin.x)*t.scale+"px",top:(r.value?e.origin.y-r.value.origin.y:e.origin.y)*t.scale+"px",width:e.size.width*t.scale+"px",height:e.size.height*t.scale+"px",background:n.value?c.value:"transparent",border:n.value?"none":`2px solid ${i.value}`,opacity:n.value?u.value:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:g.value===a.PdfTextAlignment.Left?"flex-start":g.value===a.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden"}),k=e=>({color:d.value,fontSize:`${Math.min(m.value*t.scale,e.size.height*t.scale*.8)}px`,fontFamily:a.standardFontCss(v.value),textAlign:a.textAlignmentToCss(g.value),whiteSpace:p.value?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1});return(t,a)=>(o.openBlock(),o.createElementBlock("div",{onMouseenter:a[2]||(a[2]=e=>n.value=!0),onMouseleave:a[3]||(a[3]=e=>n.value=!1),style:{position:"absolute",inset:0}},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(t,l)=>(o.openBlock(),o.createElementBlock("div",{key:l,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(f(t))},[n.value&&s.value?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle(k(t))},o.toDisplayString(x.value),5)):o.createCommentVNode("",!0)],36))),128))],32))}}),k=o.defineComponent({__name:"redact-area",props:{annotation:{},isSelected:{type:Boolean},scale:{},pageIndex:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(!1),l=o.computed(()=>t.annotation.object.strokeColor??"#FF0000"),r=o.computed(()=>t.annotation.object.color??"#000000"),i=o.computed(()=>t.annotation.object.opacity??1),c=o.computed(()=>t.annotation.object.fontColor??t.annotation.object.overlayColor??"#FFFFFF"),u=o.computed(()=>t.annotation.object.overlayText),d=o.computed(()=>t.annotation.object.overlayTextRepeat??!1),s=o.computed(()=>t.annotation.object.fontSize??12),p=o.computed(()=>t.annotation.object.fontFamily??a.PdfStandardFont.Helvetica),m=o.computed(()=>t.annotation.object.textAlign??a.PdfTextAlignment.Center),v=o.computed(()=>{if(!u.value)return"";if(!d.value)return u.value;return Array(10).fill(u.value).join(" ")}),g=o.computed(()=>({position:"absolute",inset:0,background:n.value?r.value:"transparent",border:n.value?"none":`2px solid ${l.value}`,opacity:n.value?i.value:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t.isSelected?"move":"pointer",display:"flex",alignItems:"center",justifyContent:m.value===a.PdfTextAlignment.Left?"flex-start":m.value===a.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden"})),x=o.computed(()=>({color:c.value,fontSize:s.value*t.scale+"px",fontFamily:a.standardFontCss(p.value),textAlign:a.textAlignmentToCss(m.value),whiteSpace:d.value?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"}));return(t,a)=>(o.openBlock(),o.createElementBlock("div",{onPointerdown:a[0]||(a[0]=t=>{e.isSelected||e.onClick(t)}),onTouchstart:a[1]||(a[1]=t=>{e.isSelected||e.onClick(t)}),onMouseenter:a[2]||(a[2]=e=>n.value=!0),onMouseleave:a[3]||(a[3]=e=>n.value=!1),style:o.normalizeStyle(g.value)},[n.value&&u.value?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle(x.value)},o.toDisplayString(v.value),5)):o.createCommentVNode("",!0)],36))}}),y=[r.createRenderer({id:"redactHighlight",matches:e=>{var t;return e.type===a.PdfAnnotationSubtype.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},component:f}),r.createRenderer({id:"redactArea",matches:e=>{var t;return!(e.type!==a.PdfAnnotationSubtype.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},component:k})],b=o.defineComponent({__name:"redact-renderer-registration",setup:e=>(r.useRegisterRenderers(y),(e,t)=>o.renderSlot(e.$slots,"default"))}),h=e.createPluginPackage(t.RedactionPluginPackage).addUtility(b).build();exports.Highlight=i,exports.MarqueeRedact=d,exports.PendingRedactions=g,exports.RedactArea=k,exports.RedactHighlight=f,exports.RedactRendererRegistration=b,exports.RedactionLayer=x,exports.RedactionPluginPackage=h,exports.SelectionRedact=p,exports.redactRenderers=y,exports.useRedaction=e=>{const{provides:n}=u(),a=o.ref(t.initialDocumentState);o.watch([n,()=>o.toValue(e)],([e,o],n,l)=>{if(!e)return void(a.value=t.initialDocumentState);const r=e.forDocument(o);try{a.value=r.getState()}catch(i){a.value=t.initialDocumentState}l(r.onStateChange(e=>{a.value=e}))},{immediate:!0});const l=o.computed(()=>{var t;const a=o.toValue(e);return(null==(t=n.value)?void 0:t.forDocument(a))??null});return{state:a,provides:l}},exports.useRedactionCapability=u,exports.useRedactionPlugin=c,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@embedpdf/core"),t=require("@embedpdf/plugin-redaction"),o=require("vue"),n=require("@embedpdf/core/vue"),a=require("@embedpdf/models"),l=require("@embedpdf/utils/vue"),r=require("@embedpdf/plugin-annotation/vue"),i=o.defineComponent({__name:"highlight",props:{color:{default:"#FFFF00"},opacity:{default:1},border:{default:"1px solid red"},rects:{},rect:{},scale:{},onClick:{}},setup(e){const t=e.rect;return(n,a)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.rects,(l,r)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({key:r,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:{position:"absolute",border:e.border,left:(o.unref(t)?l.origin.x-o.unref(t).origin.x:l.origin.x)*e.scale+"px",top:(o.unref(t)?l.origin.y-o.unref(t).origin.y:l.origin.y)*e.scale+"px",width:l.size.width*e.scale+"px",height:l.size.height*e.scale+"px",background:e.color,opacity:e.opacity,pointerEvents:e.onClick?"auto":"none",cursor:e.onClick?"pointer":"default",zIndex:e.onClick?1:void 0}},{ref_for:!0},n.$attrs),null,16))),128))}}),c=()=>n.usePlugin(t.RedactionPlugin.id),u=()=>n.useCapability(t.RedactionPlugin.id),d=o.defineComponent({__name:"marquee-redact",props:{documentId:{},pageIndex:{},scale:{},className:{},stroke:{default:"red"},fill:{default:"transparent"}},setup(e){const t=e,{plugin:a}=c(),l=n.useDocumentState(()=>t.documentId),r=o.ref(null),i=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=l.value)?void 0:e.scale)??1}),u=o.computed(()=>{var e;return t.stroke??(null==(e=a.value)?void 0:e.getPreviewStrokeColor())??"red"});return o.watch([a,()=>t.documentId,()=>t.pageIndex,i],([e,t,o,n],a,l)=>{if(!e||!t)return;l(e.registerMarqueeOnPage({documentId:t,pageIndex:o,scale:n,callback:{onPreview:e=>{r.value=e}}}))},{immediate:!0}),(t,n)=>r.value?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({position:"absolute",pointerEvents:"none",left:r.value.origin.x*i.value+"px",top:r.value.origin.y*i.value+"px",width:r.value.size.width*i.value+"px",height:r.value.size.height*i.value+"px",border:`1px solid ${u.value}`,background:e.fill,boxSizing:"border-box"}),class:o.normalizeClass(e.className)},null,6)):o.createCommentVNode("",!0)}}),s={key:0,style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0}},p=o.defineComponent({__name:"selection-redact",props:{documentId:{},pageIndex:{},scale:{}},setup(e){const t=e,{plugin:n}=c(),a=o.ref([]),l=o.ref(null),r=o.computed(()=>{var e;return(null==(e=n.value)?void 0:e.getPreviewStrokeColor())??"red"});return o.watch([n,()=>t.documentId,()=>t.pageIndex],([e,t,o],n,r)=>{if(!e)return a.value=[],void(l.value=null);r(e.onRedactionSelectionChange(t,e=>{const t=e.find(e=>e.pageIndex===o);a.value=(null==t?void 0:t.segmentRects)??[],l.value=(null==t?void 0:t.rect)??null}))},{immediate:!0}),(t,n)=>l.value?(o.openBlock(),o.createElementBlock("div",s,[o.createVNode(i,{color:"transparent",opacity:1,rects:a.value,scale:e.scale,border:`1px solid ${r.value}`},null,8,["rects","scale","border"])])):o.createCommentVNode("",!0)}}),m={key:0,style:{position:"absolute",inset:0,pointerEvents:"none"}},v=["onPointerdown","onTouchstart"],g=o.defineComponent({__name:"pending-redactions",props:{documentId:{},pageIndex:{},scale:{},rotation:{default:a.Rotation.Degree0},bboxStroke:{default:"rgba(0,0,0,0.8)"},selectionMenu:{}},setup(e){const t=e,n=o.useSlots(),{provides:a}=u(),r=o.ref([]),c=o.ref(null);o.watch([a,()=>t.documentId,()=>t.pageIndex],([e,t,o],n,a)=>{if(!e)return r.value=[],void(c.value=null);const l=e.forDocument(t),i=l.getState();r.value=(i.pending[o]??[]).filter(e=>"legacy"===e.source),c.value=i.selected&&i.selected.page===o?i.selected.id:null;const u=l.onPendingChange(e=>{r.value=(e[o]??[]).filter(e=>"legacy"===e.source)}),d=l.onSelectedChange(e=>{c.value=e&&e.page===o?e.id:null});a(()=>{null==u||u(),null==d||d()})},{immediate:!0});const d=(e,o)=>{e.stopPropagation();const n=a.value;n&&n.forDocument(t.documentId).selectPending(t.pageIndex,o)},s=e=>c.value===e&&(!!t.selectionMenu||!!n["selection-menu"]),p=e=>({type:"redaction",item:e,pageIndex:t.pageIndex}),g={suggestTop:!1,spaceAbove:0,spaceBelow:0},x=(e,o,n)=>t.selectionMenu?t.selectionMenu({rect:o,menuWrapperProps:n,selected:c.value===e.id,placement:g,context:p(e)}):null;return(t,n)=>r.value.length?(o.openBlock(),o.createElementBlock("div",m,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,n=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:n.id},["area"===n.kind?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:n.rect.origin.x*e.scale+"px",top:n.rect.origin.y*e.scale+"px",width:n.rect.size.width*e.scale+"px",height:n.rect.size.height*e.scale+"px",background:"transparent",outline:c.value===n.id?`1px solid ${e.bboxStroke}`:"none",outlineOffset:"2px",border:"1px solid red",pointerEvents:"auto",cursor:"pointer"}),onPointerdown:e=>d(e,n.id),onTouchstart:e=>d(e,n.id)},null,44,v),s(n.id)?(o.openBlock(),o.createBlock(o.unref(l.CounterRotate),{key:0,rect:{origin:{x:n.rect.origin.x*e.scale,y:n.rect.origin.y*e.scale},size:{width:n.rect.size.width*e.scale,height:n.rect.size.height*e.scale}},rotation:e.rotation},{default:o.withCtx(({rect:a,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x(n,a,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:p(n),selected:c.value===n.id,rect:a,placement:g,menuWrapperProps:l})]),_:2},1032,["rect","rotation"])):o.createCommentVNode("",!0)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",{style:o.normalizeStyle({position:"absolute",left:n.rect.origin.x*e.scale+"px",top:n.rect.origin.y*e.scale+"px",width:n.rect.size.width*e.scale+"px",height:n.rect.size.height*e.scale+"px",background:"transparent",outline:c.value===n.id?`1px solid ${e.bboxStroke}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:c.value===n.id?"pointer":"default"})},[o.createVNode(i,{rect:n.rect,rects:n.rects,color:"transparent",border:"1px solid red",scale:e.scale,"on-click":e=>d(e,n.id)},null,8,["rect","rects","scale","on-click"])],4),s(n.id)?(o.openBlock(),o.createBlock(o.unref(l.CounterRotate),{key:0,rect:{origin:{x:n.rect.origin.x*e.scale,y:n.rect.origin.y*e.scale},size:{width:n.rect.size.width*e.scale,height:n.rect.size.height*e.scale}},rotation:e.rotation},{default:o.withCtx(({rect:a,menuWrapperProps:l})=>[e.selectionMenu?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x(n,a,l)),{key:0})):o.renderSlot(t.$slots,"selection-menu",{key:1,context:p(n),selected:c.value===n.id,rect:a,placement:g,menuWrapperProps:l})]),_:2},1032,["rect","rotation"])):o.createCommentVNode("",!0)],64))],64))),128))])):o.createCommentVNode("",!0)}}),x=o.defineComponent({__name:"redaction-layer",props:{documentId:{},pageIndex:{},scale:{},rotation:{},bboxStroke:{default:"rgba(0,0,0,0.8)"},selectionMenu:{}},setup(e){const t=e,a=n.useDocumentState(()=>t.documentId),l=o.computed(()=>{var e,o,n;return null==(n=null==(o=null==(e=a.value)?void 0:e.document)?void 0:o.pages)?void 0:n[t.pageIndex]}),r=o.computed(()=>{var e;return void 0!==t.scale?t.scale:(null==(e=a.value)?void 0:e.scale)??1}),i=o.computed(()=>{var e,o;if(void 0!==t.rotation)return t.rotation;return(((null==(e=l.value)?void 0:e.rotation)??0)+((null==(o=a.value)?void 0:o.rotation)??0))%4});return(t,n)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(g,{"document-id":e.documentId,"page-index":e.pageIndex,scale:r.value,rotation:i.value,"bbox-stroke":e.bboxStroke,"selection-menu":e.selectionMenu},{"selection-menu":o.withCtx(e=>[o.renderSlot(t.$slots,"selection-menu",o.normalizeProps(o.guardReactiveProps(e)))]),_:3},8,["document-id","page-index","scale","rotation","bbox-stroke","selection-menu"]),o.createVNode(d,{"document-id":e.documentId,"page-index":e.pageIndex,scale:r.value},null,8,["document-id","page-index","scale"]),o.createVNode(p,{"document-id":e.documentId,"page-index":e.pageIndex,scale:r.value},null,8,["document-id","page-index","scale"])],64))}}),f=o.defineComponent({__name:"redact-highlight",props:{annotation:{},isSelected:{type:Boolean},scale:{},pageIndex:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(!1),l=o.computed(()=>t.annotation.object.segmentRects??[]),r=o.computed(()=>t.annotation.object.rect),i=o.computed(()=>t.annotation.object.strokeColor??"#FF0000"),c=o.computed(()=>t.annotation.object.color??"#000000"),u=o.computed(()=>t.annotation.object.opacity??1),d=o.computed(()=>t.annotation.object.fontColor??t.annotation.object.overlayColor??"#FFFFFF"),s=o.computed(()=>t.annotation.object.overlayText),p=o.computed(()=>t.annotation.object.overlayTextRepeat??!1),m=o.computed(()=>t.annotation.object.fontSize??12),v=o.computed(()=>t.annotation.object.fontFamily??a.PdfStandardFont.Helvetica),g=o.computed(()=>t.annotation.object.textAlign??a.PdfTextAlignment.Center),x=o.computed(()=>{if(!s.value)return"";if(!p.value)return s.value;return Array(10).fill(s.value).join(" ")}),f=e=>({position:"absolute",left:(r.value?e.origin.x-r.value.origin.x:e.origin.x)*t.scale+"px",top:(r.value?e.origin.y-r.value.origin.y:e.origin.y)*t.scale+"px",width:e.size.width*t.scale+"px",height:e.size.height*t.scale+"px",background:n.value?c.value:"transparent",border:n.value?"none":`2px solid ${i.value}`,opacity:n.value?u.value:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:g.value===a.PdfTextAlignment.Left?"flex-start":g.value===a.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden"}),k=e=>({color:d.value,fontSize:`${Math.min(m.value*t.scale,e.size.height*t.scale*.8)}px`,fontFamily:a.standardFontCss(v.value),textAlign:a.textAlignmentToCss(g.value),whiteSpace:p.value?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1});return(t,a)=>(o.openBlock(),o.createElementBlock("div",{onMouseenter:a[2]||(a[2]=e=>n.value=!0),onMouseleave:a[3]||(a[3]=e=>n.value=!1),style:{position:"absolute",inset:0}},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(t,l)=>(o.openBlock(),o.createElementBlock("div",{key:l,onPointerdown:a[0]||(a[0]=(...t)=>e.onClick&&e.onClick(...t)),onTouchstart:a[1]||(a[1]=(...t)=>e.onClick&&e.onClick(...t)),style:o.normalizeStyle(f(t))},[n.value&&s.value?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle(k(t))},o.toDisplayString(x.value),5)):o.createCommentVNode("",!0)],36))),128))],32))}}),k=o.defineComponent({__name:"redact-area",props:{annotation:{},isSelected:{type:Boolean},scale:{},pageIndex:{},onClick:{type:Function}},setup(e){const t=e,n=o.ref(!1),l=o.computed(()=>t.annotation.object.strokeColor??"#FF0000"),r=o.computed(()=>t.annotation.object.color??"#000000"),i=o.computed(()=>t.annotation.object.opacity??1),c=o.computed(()=>t.annotation.object.fontColor??t.annotation.object.overlayColor??"#FFFFFF"),u=o.computed(()=>t.annotation.object.overlayText),d=o.computed(()=>t.annotation.object.overlayTextRepeat??!1),s=o.computed(()=>t.annotation.object.fontSize??12),p=o.computed(()=>t.annotation.object.fontFamily??a.PdfStandardFont.Helvetica),m=o.computed(()=>t.annotation.object.textAlign??a.PdfTextAlignment.Center),v=o.computed(()=>{if(!u.value)return"";if(!d.value)return u.value;return Array(10).fill(u.value).join(" ")}),g=o.computed(()=>({position:"absolute",inset:0,background:n.value?r.value:"transparent",border:n.value?"none":`2px solid ${l.value}`,opacity:n.value?i.value:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t.isSelected?"move":"pointer",display:"flex",alignItems:"center",justifyContent:m.value===a.PdfTextAlignment.Left?"flex-start":m.value===a.PdfTextAlignment.Right?"flex-end":"center",overflow:"hidden"})),x=o.computed(()=>({color:c.value,fontSize:s.value*t.scale+"px",fontFamily:a.standardFontCss(p.value),textAlign:a.textAlignmentToCss(m.value),whiteSpace:d.value?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"}));return(t,a)=>(o.openBlock(),o.createElementBlock("div",{onPointerdown:a[0]||(a[0]=t=>{e.isSelected||e.onClick(t)}),onTouchstart:a[1]||(a[1]=t=>{e.isSelected||e.onClick(t)}),onMouseenter:a[2]||(a[2]=e=>n.value=!0),onMouseleave:a[3]||(a[3]=e=>n.value=!1),style:o.normalizeStyle(g.value)},[n.value&&u.value?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle(x.value)},o.toDisplayString(v.value),5)):o.createCommentVNode("",!0)],36))}}),y=[r.createRenderer({id:"redactHighlight",matches:e=>{var t;return e.type===a.PdfAnnotationSubtype.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},component:f}),r.createRenderer({id:"redactArea",matches:e=>{var t;return!(e.type!==a.PdfAnnotationSubtype.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},component:k})],b=o.defineComponent({__name:"redact-renderer-registration",setup:e=>(r.useRegisterRenderers(y),(e,t)=>o.renderSlot(e.$slots,"default"))}),h=e.createPluginPackage(t.RedactionPluginPackage).addUtility(b).build();exports.Highlight=i,exports.MarqueeRedact=d,exports.PendingRedactions=g,exports.RedactArea=k,exports.RedactHighlight=f,exports.RedactRendererRegistration=b,exports.RedactionLayer=x,exports.RedactionPluginPackage=h,exports.SelectionRedact=p,exports.redactRenderers=y,exports.useRedaction=e=>{const{provides:n}=u(),a=o.ref(t.initialDocumentState);o.watch([n,()=>o.toValue(e)],([e,o],n,l)=>{if(!e)return void(a.value=t.initialDocumentState);const r=e.forDocument(o);try{a.value=r.getState()}catch(i){a.value=t.initialDocumentState}l(r.onStateChange(e=>{a.value=e}))},{immediate:!0});const l=o.computed(()=>{var t;const a=o.toValue(e);return(null==(t=n.value)?void 0:t.forDocument(a))??null});return{state:a,provides:l}},exports.useRedactionCapability=u,exports.useRedactionPlugin=c,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|