@embedpdf/plugin-selection 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +159 -81
- package/dist/index.js.map +1 -1
- package/dist/lib/handlers/marquee-selection.handler.d.ts +9 -7
- package/dist/lib/handlers/text-selection.handler.d.ts +8 -6
- package/dist/lib/selection-plugin.d.ts +7 -4
- package/dist/lib/types.d.ts +71 -2
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +59 -16
- 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 +59 -16
- package/dist/react/index.js.map +1 -1
- package/dist/shared/components/index.d.ts +1 -0
- package/dist/shared/components/marquee-selection.d.ts +18 -5
- package/dist/shared/components/selection-layer.d.ts +18 -1
- package/dist/shared/components/text-selection.d.ts +21 -0
- package/dist/shared-preact/components/index.d.ts +1 -0
- package/dist/shared-preact/components/marquee-selection.d.ts +18 -5
- package/dist/shared-preact/components/selection-layer.d.ts +18 -1
- package/dist/shared-preact/components/text-selection.d.ts +21 -0
- package/dist/shared-react/components/index.d.ts +1 -0
- package/dist/shared-react/components/marquee-selection.d.ts +18 -5
- package/dist/shared-react/components/selection-layer.d.ts +18 -1
- package/dist/shared-react/components/text-selection.d.ts +21 -0
- package/dist/svelte/components/MarqueeSelection.svelte.d.ts +12 -2
- package/dist/svelte/components/SelectionLayer.svelte.d.ts +11 -1
- package/dist/svelte/components/TextSelection.svelte.d.ts +22 -0
- package/dist/svelte/components/index.d.ts +1 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.cjs.map +1 -1
- package/dist/svelte/index.js +93 -17
- package/dist/svelte/index.js.map +1 -1
- package/dist/vue/components/index.d.ts +1 -0
- package/dist/vue/components/marquee-selection.vue.d.ts +13 -4
- package/dist/vue/components/selection-layer.vue.d.ts +15 -5
- package/dist/vue/components/text-selection.vue.d.ts +51 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +89 -32
- package/dist/vue/index.js.map +1 -1
- package/package.json +9 -9
package/dist/vue/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createPluginPackage } from "@embedpdf/core";
|
|
2
2
|
import { SelectionPlugin, SelectionPluginPackage as SelectionPluginPackage$1 } from "@embedpdf/plugin-selection";
|
|
3
3
|
export * from "@embedpdf/plugin-selection";
|
|
4
|
-
import { defineComponent, useSlots, computed, ref, watch,
|
|
5
|
-
import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/vue";
|
|
4
|
+
import { defineComponent, useSlots, computed, ref, watch, openBlock, createElementBlock, Fragment, createElementVNode, normalizeStyle, renderList, createBlock, unref, withCtx, resolveDynamicComponent, renderSlot, createCommentVNode, normalizeClass, createVNode, normalizeProps, guardReactiveProps, watchEffect } from "vue";
|
|
6
5
|
import { Rotation } from "@embedpdf/models";
|
|
6
|
+
import { usePlugin, useCapability, useDocumentState } from "@embedpdf/core/vue";
|
|
7
7
|
import { CounterRotate } from "@embedpdf/utils/vue";
|
|
8
8
|
const useSelectionCapability = () => useCapability(SelectionPlugin.id);
|
|
9
9
|
const useSelectionPlugin = () => usePlugin(SelectionPlugin.id);
|
|
10
|
-
const _sfc_main$
|
|
11
|
-
__name: "selection
|
|
10
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "text-selection",
|
|
12
12
|
props: {
|
|
13
13
|
documentId: {},
|
|
14
14
|
pageIndex: {},
|
|
@@ -162,37 +162,26 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
|
-
const _sfc_main$
|
|
166
|
-
__name: "copy-to-clipboard",
|
|
167
|
-
setup(__props) {
|
|
168
|
-
const { provides: sel } = useSelectionCapability();
|
|
169
|
-
watchEffect((onCleanup) => {
|
|
170
|
-
if (sel.value) {
|
|
171
|
-
const unsubscribe = sel.value.onCopyToClipboard(({ text }) => {
|
|
172
|
-
navigator.clipboard.writeText(text).catch((err) => {
|
|
173
|
-
console.error("Failed to copy text to clipboard:", err);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
onCleanup(unsubscribe);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
return (_ctx, _cache) => {
|
|
180
|
-
return null;
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
165
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
185
166
|
__name: "marquee-selection",
|
|
186
167
|
props: {
|
|
187
168
|
documentId: {},
|
|
188
169
|
pageIndex: {},
|
|
189
170
|
scale: {},
|
|
190
171
|
className: {},
|
|
191
|
-
|
|
192
|
-
|
|
172
|
+
background: {},
|
|
173
|
+
borderColor: {},
|
|
174
|
+
borderStyle: { default: "dashed" },
|
|
175
|
+
stroke: {},
|
|
176
|
+
fill: {}
|
|
193
177
|
},
|
|
194
178
|
setup(__props) {
|
|
195
179
|
const props = __props;
|
|
180
|
+
const resolvedBorderColor = computed(
|
|
181
|
+
() => props.borderColor ?? props.stroke ?? "rgba(0,122,204,0.8)"
|
|
182
|
+
);
|
|
183
|
+
const resolvedBackground = computed(() => props.background ?? props.fill ?? "rgba(0,122,204,0.15)");
|
|
184
|
+
const resolvedBorderStyle = computed(() => props.borderStyle);
|
|
196
185
|
const { plugin: selPlugin } = useSelectionPlugin();
|
|
197
186
|
const documentState = useDocumentState(() => props.documentId);
|
|
198
187
|
const rect = ref(null);
|
|
@@ -232,8 +221,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
232
221
|
top: `${rect.value.origin.y * actualScale.value}px`,
|
|
233
222
|
width: `${rect.value.size.width * actualScale.value}px`,
|
|
234
223
|
height: `${rect.value.size.height * actualScale.value}px`,
|
|
235
|
-
border: `1px
|
|
236
|
-
background:
|
|
224
|
+
border: `1px ${resolvedBorderStyle.value} ${resolvedBorderColor.value}`,
|
|
225
|
+
background: resolvedBackground.value,
|
|
237
226
|
boxSizing: "border-box",
|
|
238
227
|
zIndex: 1e3
|
|
239
228
|
}),
|
|
@@ -242,12 +231,80 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
242
231
|
};
|
|
243
232
|
}
|
|
244
233
|
});
|
|
245
|
-
const
|
|
234
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
235
|
+
__name: "selection-layer",
|
|
236
|
+
props: {
|
|
237
|
+
documentId: {},
|
|
238
|
+
pageIndex: {},
|
|
239
|
+
scale: {},
|
|
240
|
+
rotation: { default: Rotation.Degree0 },
|
|
241
|
+
background: {},
|
|
242
|
+
textStyle: {},
|
|
243
|
+
marqueeStyle: {},
|
|
244
|
+
marqueeClassName: {},
|
|
245
|
+
selectionMenu: {}
|
|
246
|
+
},
|
|
247
|
+
setup(__props) {
|
|
248
|
+
const props = __props;
|
|
249
|
+
const resolvedTextBackground = computed(() => {
|
|
250
|
+
var _a;
|
|
251
|
+
return ((_a = props.textStyle) == null ? void 0 : _a.background) ?? props.background;
|
|
252
|
+
});
|
|
253
|
+
return (_ctx, _cache) => {
|
|
254
|
+
var _a, _b, _c;
|
|
255
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
256
|
+
createVNode(_sfc_main$3, {
|
|
257
|
+
"document-id": __props.documentId,
|
|
258
|
+
"page-index": __props.pageIndex,
|
|
259
|
+
scale: __props.scale,
|
|
260
|
+
rotation: __props.rotation,
|
|
261
|
+
background: resolvedTextBackground.value,
|
|
262
|
+
"selection-menu": __props.selectionMenu
|
|
263
|
+
}, {
|
|
264
|
+
"selection-menu": withCtx((menuProps) => [
|
|
265
|
+
renderSlot(_ctx.$slots, "selection-menu", normalizeProps(guardReactiveProps(menuProps)))
|
|
266
|
+
]),
|
|
267
|
+
_: 3
|
|
268
|
+
}, 8, ["document-id", "page-index", "scale", "rotation", "background", "selection-menu"]),
|
|
269
|
+
createVNode(_sfc_main$2, {
|
|
270
|
+
"document-id": __props.documentId,
|
|
271
|
+
"page-index": __props.pageIndex,
|
|
272
|
+
scale: __props.scale,
|
|
273
|
+
background: (_a = __props.marqueeStyle) == null ? void 0 : _a.background,
|
|
274
|
+
"border-color": (_b = __props.marqueeStyle) == null ? void 0 : _b.borderColor,
|
|
275
|
+
"border-style": (_c = __props.marqueeStyle) == null ? void 0 : _c.borderStyle,
|
|
276
|
+
"class-name": __props.marqueeClassName
|
|
277
|
+
}, null, 8, ["document-id", "page-index", "scale", "background", "border-color", "border-style", "class-name"])
|
|
278
|
+
], 64);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
283
|
+
__name: "copy-to-clipboard",
|
|
284
|
+
setup(__props) {
|
|
285
|
+
const { provides: sel } = useSelectionCapability();
|
|
286
|
+
watchEffect((onCleanup) => {
|
|
287
|
+
if (sel.value) {
|
|
288
|
+
const unsubscribe = sel.value.onCopyToClipboard(({ text }) => {
|
|
289
|
+
navigator.clipboard.writeText(text).catch((err) => {
|
|
290
|
+
console.error("Failed to copy text to clipboard:", err);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
onCleanup(unsubscribe);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
return (_ctx, _cache) => {
|
|
297
|
+
return null;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
const SelectionPluginPackage = createPluginPackage(SelectionPluginPackage$1).addUtility(_sfc_main).build();
|
|
246
302
|
export {
|
|
247
|
-
_sfc_main
|
|
248
|
-
_sfc_main as MarqueeSelection,
|
|
249
|
-
_sfc_main$
|
|
303
|
+
_sfc_main as CopyToClipboard,
|
|
304
|
+
_sfc_main$2 as MarqueeSelection,
|
|
305
|
+
_sfc_main$1 as SelectionLayer,
|
|
250
306
|
SelectionPluginPackage,
|
|
307
|
+
_sfc_main$3 as TextSelection,
|
|
251
308
|
useSelectionCapability,
|
|
252
309
|
useSelectionPlugin
|
|
253
310
|
};
|
package/dist/vue/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-selection.ts","../../src/vue/components/selection-layer.vue","../../src/vue/components/copy-to-clipboard.vue","../../src/vue/components/marquee-selection.vue","../../src/vue/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { SelectionPlugin } from '@embedpdf/plugin-selection';\n\n/**\n * Hook to get the selection plugin's capability API.\n * This provides methods for controlling and listening to selection events.\n */\nexport const useSelectionCapability = () => useCapability<SelectionPlugin>(SelectionPlugin.id);\n\n/**\n * Hook to get the raw selection plugin instance.\n * Useful for accessing plugin-specific properties or methods not exposed in the capability.\n */\nexport const useSelectionPlugin = () => usePlugin<SelectionPlugin>(SelectionPlugin.id);\n","<script setup lang=\"ts\">\nimport { ref, watch, computed, useSlots, type VNode } from 'vue';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { Rotation, type Rect } from '@embedpdf/models';\nimport type { SelectionMenuPlacement } from '@embedpdf/plugin-selection';\nimport { CounterRotate, type MenuWrapperProps } from '@embedpdf/utils/vue';\nimport { useSelectionPlugin } from '../hooks/use-selection';\nimport type { SelectionSelectionContext, SelectionSelectionMenuRenderFn } from '../types';\n\ninterface SelectionLayerProps {\n documentId: string;\n pageIndex: number;\n scale?: number;\n rotation?: Rotation;\n background?: string;\n /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: SelectionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<SelectionLayerProps>(), {\n background: 'rgba(33,150,243)',\n rotation: Rotation.Degree0,\n});\n\nconst slots = useSlots();\nconst { plugin: selPlugin } = useSelectionPlugin();\nconst documentState = useDocumentState(() => props.documentId);\nconst page = computed(() => documentState.value?.document?.pages?.[props.pageIndex]);\nconst rects = ref<Rect[]>([]);\nconst boundingRect = ref<Rect | null>(null);\nconst placement = ref<SelectionMenuPlacement | null>(null);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nconst actualRotation = computed(() => {\n if (props.rotation !== undefined) return props.rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page.value?.rotation ?? 0;\n const docRotation = documentState.value?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\n});\n\n// Check if menu should render: placement is valid AND (render fn OR slot exists)\nconst shouldRenderMenu = computed(() => {\n if (!placement.value) return false;\n if (placement.value.pageIndex !== props.pageIndex) return false;\n if (!placement.value.isVisible) return false;\n\n // Must have either render function or slot\n return !!props.selectionMenu || !!slots['selection-menu'];\n});\n\nwatch(\n [() => selPlugin.value, () => props.documentId, () => props.pageIndex],\n ([plugin, docId, pageIdx], _, onCleanup) => {\n if (!plugin || !docId) {\n rects.value = [];\n boundingRect.value = null;\n return;\n }\n\n const unregister = plugin.registerSelectionOnPage({\n documentId: docId,\n pageIndex: pageIdx,\n onRectsChange: ({ rects: newRects, boundingRect: newBoundingRect }) => {\n rects.value = newRects;\n boundingRect.value = newBoundingRect;\n },\n });\n\n onCleanup(unregister);\n },\n { immediate: true },\n);\n\nwatch(\n [() => selPlugin.value, () => props.documentId],\n ([plugin, docId], _, onCleanup) => {\n if (!plugin || !docId) {\n placement.value = null;\n return;\n }\n\n const unsubscribe = plugin.onMenuPlacement(docId, (newPlacement) => {\n placement.value = newPlacement;\n });\n\n onCleanup(unsubscribe);\n },\n { immediate: true },\n);\n\n// --- Selection Menu Logic ---\n\n// Build context object for selection menu\nconst buildContext = (): SelectionSelectionContext => ({\n type: 'selection',\n pageIndex: props.pageIndex,\n});\n\n// Build placement hints from plugin placement data\nconst buildMenuPlacement = () => ({\n suggestTop: placement.value?.suggestTop ?? false,\n spaceAbove: placement.value?.spaceAbove ?? 0,\n spaceBelow: placement.value?.spaceBelow ?? 0,\n});\n\n// Render via function (for schema-driven approach)\nconst renderSelectionMenu = (rect: Rect, menuWrapperProps: MenuWrapperProps): VNode | null => {\n if (!props.selectionMenu) return null;\n\n return props.selectionMenu({\n rect,\n menuWrapperProps,\n selected: true, // Selection is always \"selected\" when visible\n placement: buildMenuPlacement(),\n context: buildContext(),\n });\n};\n</script>\n\n<template>\n <template v-if=\"boundingRect\">\n <div\n :style=\"{\n position: 'absolute',\n left: `${boundingRect.origin.x * actualScale}px`,\n top: `${boundingRect.origin.y * actualScale}px`,\n width: `${boundingRect.size.width * actualScale}px`,\n height: `${boundingRect.size.height * actualScale}px`,\n mixBlendMode: 'multiply',\n isolation: 'isolate',\n pointerEvents: 'none',\n }\"\n >\n <div\n v-for=\"(rect, i) in rects\"\n :key=\"i\"\n :style=\"{\n position: 'absolute',\n left: `${(rect.origin.x - boundingRect.origin.x) * actualScale}px`,\n top: `${(rect.origin.y - boundingRect.origin.y) * actualScale}px`,\n width: `${rect.size.width * actualScale}px`,\n height: `${rect.size.height * actualScale}px`,\n background: background,\n }\"\n />\n </div>\n\n <!-- Selection Menu: Supports BOTH render function and slot -->\n <CounterRotate\n v-if=\"shouldRenderMenu\"\n :rect=\"{\n origin: {\n x: placement!.rect.origin.x * actualScale,\n y: placement!.rect.origin.y * actualScale,\n },\n size: {\n width: placement!.rect.size.width * actualScale,\n height: placement!.rect.size.height * actualScale,\n },\n }\"\n :rotation=\"actualRotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <!-- Priority 1: Render function prop (schema-driven) -->\n <component v-if=\"selectionMenu\" :is=\"renderSelectionMenu(rect, menuWrapperProps)\" />\n\n <!-- Priority 2: Slot (manual customization) -->\n <slot\n v-else\n name=\"selection-menu\"\n :context=\"buildContext()\"\n :selected=\"true\"\n :rect=\"rect\"\n :placement=\"buildMenuPlacement()\"\n :menuWrapperProps=\"menuWrapperProps\"\n />\n </template>\n </CounterRotate>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport { watchEffect } from 'vue';\nimport { useSelectionCapability } from '../hooks';\n\nconst { provides: sel } = useSelectionCapability();\n\n// This effect runs when the component is mounted and the capability is available.\n// It automatically handles unsubscribing when the component is unmounted.\nwatchEffect((onCleanup) => {\n if (sel.value) {\n const unsubscribe = sel.value.onCopyToClipboard(({ text }) => {\n // Use the Clipboard API to write the text\n navigator.clipboard.writeText(text).catch((err) => {\n console.error('Failed to copy text to clipboard:', err);\n });\n });\n\n // Register the cleanup function to run on unmount or re-run\n onCleanup(unsubscribe);\n }\n});\n</script>\n\n<template>\n <!-- This component renders nothing to the DOM -->\n</template>\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * actualScale}px`,\n top: `${rect.origin.y * actualScale}px`,\n width: `${rect.size.width * actualScale}px`,\n height: `${rect.size.height * actualScale}px`,\n border: `1px dashed ${stroke}`,\n background: fill,\n boxSizing: 'border-box',\n zIndex: 1000,\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { useSelectionPlugin } from '../hooks';\n\ninterface MarqueeSelectionProps {\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 (optional, defaults to document scale) */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Stroke colour (default: 'rgba(0,122,204,0.8)') */\n stroke?: string;\n /** Fill colour (default: 'rgba(0,122,204,0.15)') */\n fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeSelectionProps>(), {\n stroke: 'rgba(0,122,204,0.8)',\n fill: 'rgba(0,122,204,0.15)',\n});\n\nconst { plugin: selPlugin } = useSelectionPlugin();\nconst documentState = useDocumentState(() => props.documentId);\nconst rect = ref<Rect | null>(null);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nwatch(\n [selPlugin, () => props.documentId, () => props.pageIndex, actualScale],\n ([plugin, docId, pageIdx, scale], _, onCleanup) => {\n rect.value = null;\n\n if (!plugin) {\n return;\n }\n\n const unregister = plugin.registerMarqueeOnPage({\n documentId: docId,\n pageIndex: pageIdx,\n scale,\n onRectChange: (newRect) => {\n rect.value = newRect;\n },\n });\n\n onCleanup(() => {\n unregister?.();\n });\n },\n { immediate: true },\n);\n</script>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { SelectionPluginPackage as BaseSelectionPluginPackage } from '@embedpdf/plugin-selection';\n\nimport { CopyToClipboard } from './components';\n\nexport * from './hooks';\nexport * from './components';\nexport * from './types';\nexport * from '@embedpdf/plugin-selection';\n\nexport const SelectionPluginPackage = createPluginPackage(BaseSelectionPluginPackage)\n .addUtility(CopyToClipboard)\n .build();\n"],"names":["_createElementBlock","_Fragment","_createElementVNode","_normalizeStyle","_openBlock","_renderList","_createBlock","_unref","_withCtx","_resolveDynamicComponent","_renderSlot","BaseSelectionPluginPackage","CopyToClipboard"],"mappings":";;;;;;;AAOO,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;AAMtF,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;;;;;;;;;;;;ACMrF,UAAM,QAAQ;AAKd,UAAM,QAAQ,SAAA;AACd,UAAM,EAAE,QAAQ,UAAA,IAAc,mBAAA;AAC9B,UAAM,gBAAgB,iBAAiB,MAAM,MAAM,UAAU;AAC7D,UAAM,OAAO,SAAS,MAAA;;AAAM,6CAAc,UAAd,mBAAqB,aAArB,mBAA+B,UAA/B,mBAAuC,MAAM;AAAA,KAAU;AACnF,UAAM,QAAQ,IAAY,EAAE;AAC5B,UAAM,eAAe,IAAiB,IAAI;AAC1C,UAAM,YAAY,IAAmC,IAAI;AAEzD,UAAM,cAAc,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EAC1B,MAAA;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/hooks/use-selection.ts","../../src/vue/components/text-selection.vue","../../src/vue/components/marquee-selection.vue","../../src/vue/components/selection-layer.vue","../../src/vue/components/copy-to-clipboard.vue","../../src/vue/index.ts"],"sourcesContent":["import { useCapability, usePlugin } from '@embedpdf/core/vue';\nimport { SelectionPlugin } from '@embedpdf/plugin-selection';\n\n/**\n * Hook to get the selection plugin's capability API.\n * This provides methods for controlling and listening to selection events.\n */\nexport const useSelectionCapability = () => useCapability<SelectionPlugin>(SelectionPlugin.id);\n\n/**\n * Hook to get the raw selection plugin instance.\n * Useful for accessing plugin-specific properties or methods not exposed in the capability.\n */\nexport const useSelectionPlugin = () => usePlugin<SelectionPlugin>(SelectionPlugin.id);\n","<script setup lang=\"ts\">\nimport { ref, watch, computed, useSlots, type VNode } from 'vue';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { Rotation, type Rect } from '@embedpdf/models';\nimport type { SelectionMenuPlacement } from '@embedpdf/plugin-selection';\nimport { CounterRotate, type MenuWrapperProps } from '@embedpdf/utils/vue';\nimport { useSelectionPlugin } from '../hooks/use-selection';\nimport type { SelectionSelectionContext, SelectionSelectionMenuRenderFn } from '../types';\n\ninterface TextSelectionProps {\n documentId: string;\n pageIndex: number;\n scale?: number;\n rotation?: Rotation;\n /** Background color for text selection highlights. Default: 'rgba(33,150,243)' */\n background?: string;\n /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: SelectionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<TextSelectionProps>(), {\n background: 'rgba(33,150,243)',\n rotation: Rotation.Degree0,\n});\n\nconst slots = useSlots();\nconst { plugin: selPlugin } = useSelectionPlugin();\nconst documentState = useDocumentState(() => props.documentId);\nconst page = computed(() => documentState.value?.document?.pages?.[props.pageIndex]);\nconst rects = ref<Rect[]>([]);\nconst boundingRect = ref<Rect | null>(null);\nconst placement = ref<SelectionMenuPlacement | null>(null);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nconst actualRotation = computed(() => {\n if (props.rotation !== undefined) return props.rotation;\n // Combine page intrinsic rotation with document rotation\n const pageRotation = page.value?.rotation ?? 0;\n const docRotation = documentState.value?.rotation ?? 0;\n return ((pageRotation + docRotation) % 4) as Rotation;\n});\n\n// Check if menu should render: placement is valid AND (render fn OR slot exists)\nconst shouldRenderMenu = computed(() => {\n if (!placement.value) return false;\n if (placement.value.pageIndex !== props.pageIndex) return false;\n if (!placement.value.isVisible) return false;\n\n // Must have either render function or slot\n return !!props.selectionMenu || !!slots['selection-menu'];\n});\n\nwatch(\n [() => selPlugin.value, () => props.documentId, () => props.pageIndex],\n ([plugin, docId, pageIdx], _, onCleanup) => {\n if (!plugin || !docId) {\n rects.value = [];\n boundingRect.value = null;\n return;\n }\n\n const unregister = plugin.registerSelectionOnPage({\n documentId: docId,\n pageIndex: pageIdx,\n onRectsChange: ({ rects: newRects, boundingRect: newBoundingRect }) => {\n rects.value = newRects;\n boundingRect.value = newBoundingRect;\n },\n });\n\n onCleanup(unregister);\n },\n { immediate: true },\n);\n\nwatch(\n [() => selPlugin.value, () => props.documentId],\n ([plugin, docId], _, onCleanup) => {\n if (!plugin || !docId) {\n placement.value = null;\n return;\n }\n\n const unsubscribe = plugin.onMenuPlacement(docId, (newPlacement) => {\n placement.value = newPlacement;\n });\n\n onCleanup(unsubscribe);\n },\n { immediate: true },\n);\n\n// --- Selection Menu Logic ---\n\n// Build context object for selection menu\nconst buildContext = (): SelectionSelectionContext => ({\n type: 'selection',\n pageIndex: props.pageIndex,\n});\n\n// Build placement hints from plugin placement data\nconst buildMenuPlacement = () => ({\n suggestTop: placement.value?.suggestTop ?? false,\n spaceAbove: placement.value?.spaceAbove ?? 0,\n spaceBelow: placement.value?.spaceBelow ?? 0,\n});\n\n// Render via function (for schema-driven approach)\nconst renderSelectionMenu = (rect: Rect, menuWrapperProps: MenuWrapperProps): VNode | null => {\n if (!props.selectionMenu) return null;\n\n return props.selectionMenu({\n rect,\n menuWrapperProps,\n selected: true, // Selection is always \"selected\" when visible\n placement: buildMenuPlacement(),\n context: buildContext(),\n });\n};\n</script>\n\n<template>\n <template v-if=\"boundingRect\">\n <div\n :style=\"{\n position: 'absolute',\n left: `${boundingRect.origin.x * actualScale}px`,\n top: `${boundingRect.origin.y * actualScale}px`,\n width: `${boundingRect.size.width * actualScale}px`,\n height: `${boundingRect.size.height * actualScale}px`,\n mixBlendMode: 'multiply',\n isolation: 'isolate',\n pointerEvents: 'none',\n }\"\n >\n <div\n v-for=\"(rect, i) in rects\"\n :key=\"i\"\n :style=\"{\n position: 'absolute',\n left: `${(rect.origin.x - boundingRect.origin.x) * actualScale}px`,\n top: `${(rect.origin.y - boundingRect.origin.y) * actualScale}px`,\n width: `${rect.size.width * actualScale}px`,\n height: `${rect.size.height * actualScale}px`,\n background: background,\n }\"\n />\n </div>\n\n <!-- Selection Menu: Supports BOTH render function and slot -->\n <CounterRotate\n v-if=\"shouldRenderMenu\"\n :rect=\"{\n origin: {\n x: placement!.rect.origin.x * actualScale,\n y: placement!.rect.origin.y * actualScale,\n },\n size: {\n width: placement!.rect.size.width * actualScale,\n height: placement!.rect.size.height * actualScale,\n },\n }\"\n :rotation=\"actualRotation\"\n >\n <template #default=\"{ rect, menuWrapperProps }\">\n <!-- Priority 1: Render function prop (schema-driven) -->\n <component v-if=\"selectionMenu\" :is=\"renderSelectionMenu(rect, menuWrapperProps)\" />\n\n <!-- Priority 2: Slot (manual customization) -->\n <slot\n v-else\n name=\"selection-menu\"\n :context=\"buildContext()\"\n :selected=\"true\"\n :rect=\"rect\"\n :placement=\"buildMenuPlacement()\"\n :menuWrapperProps=\"menuWrapperProps\"\n />\n </template>\n </CounterRotate>\n </template>\n</template>\n","<template>\n <div\n v-if=\"rect\"\n :style=\"{\n position: 'absolute',\n pointerEvents: 'none',\n left: `${rect.origin.x * actualScale}px`,\n top: `${rect.origin.y * actualScale}px`,\n width: `${rect.size.width * actualScale}px`,\n height: `${rect.size.height * actualScale}px`,\n border: `1px ${resolvedBorderStyle} ${resolvedBorderColor}`,\n background: resolvedBackground,\n boxSizing: 'border-box',\n zIndex: 1000,\n }\"\n :class=\"className\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch } from 'vue';\nimport type { Rect } from '@embedpdf/models';\nimport { useDocumentState } from '@embedpdf/core/vue';\nimport { useSelectionPlugin } from '../hooks';\n\ninterface MarqueeSelectionProps {\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 (optional, defaults to document scale) */\n scale?: number;\n /** Optional CSS class applied to the marquee rectangle */\n className?: string;\n /** Fill/background color inside the marquee rectangle. Default: 'rgba(0,122,204,0.15)' */\n background?: string;\n /** Border color of the marquee rectangle. Default: 'rgba(0,122,204,0.8)' */\n borderColor?: string;\n /** Border style. Default: 'dashed' */\n borderStyle?: 'solid' | 'dashed' | 'dotted';\n /**\n * @deprecated Use `borderColor` instead.\n */\n stroke?: string;\n /**\n * @deprecated Use `background` instead.\n */\n fill?: string;\n}\n\nconst props = withDefaults(defineProps<MarqueeSelectionProps>(), {\n borderStyle: 'dashed',\n});\n\n// Resolve deprecated props: new CSS-standard props take precedence\nconst resolvedBorderColor = computed(\n () => props.borderColor ?? props.stroke ?? 'rgba(0,122,204,0.8)',\n);\nconst resolvedBackground = computed(() => props.background ?? props.fill ?? 'rgba(0,122,204,0.15)');\nconst resolvedBorderStyle = computed(() => props.borderStyle);\n\nconst { plugin: selPlugin } = useSelectionPlugin();\nconst documentState = useDocumentState(() => props.documentId);\nconst rect = ref<Rect | null>(null);\n\nconst actualScale = computed(() => {\n if (props.scale !== undefined) return props.scale;\n return documentState.value?.scale ?? 1;\n});\n\nwatch(\n [selPlugin, () => props.documentId, () => props.pageIndex, actualScale],\n ([plugin, docId, pageIdx, scale], _, onCleanup) => {\n rect.value = null;\n\n if (!plugin) {\n return;\n }\n\n const unregister = plugin.registerMarqueeOnPage({\n documentId: docId,\n pageIndex: pageIdx,\n scale,\n onRectChange: (newRect) => {\n rect.value = newRect;\n },\n });\n\n onCleanup(() => {\n unregister?.();\n });\n },\n { immediate: true },\n);\n</script>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { Rotation } from '@embedpdf/models';\nimport type { TextSelectionStyle, MarqueeSelectionStyle } from '@embedpdf/plugin-selection';\nimport type { SelectionSelectionMenuRenderFn } from '../types';\nimport TextSelection from './text-selection.vue';\nimport MarqueeSelection from './marquee-selection.vue';\n\ninterface SelectionLayerProps {\n documentId: string;\n pageIndex: number;\n scale?: number;\n rotation?: Rotation;\n /**\n * @deprecated Use `textStyle.background` instead.\n * Background color for selection rectangles.\n */\n background?: string;\n /** Styling options for text selection highlights */\n textStyle?: TextSelectionStyle;\n /** Styling options for the marquee selection rectangle */\n marqueeStyle?: MarqueeSelectionStyle;\n /** Optional CSS class applied to the marquee rectangle */\n marqueeClassName?: string;\n /** Render function for selection menu (schema-driven approach) */\n selectionMenu?: SelectionSelectionMenuRenderFn;\n}\n\nconst props = withDefaults(defineProps<SelectionLayerProps>(), {\n rotation: Rotation.Degree0,\n});\n\nconst resolvedTextBackground = computed(() => props.textStyle?.background ?? props.background);\n</script>\n\n<template>\n <TextSelection\n :document-id=\"documentId\"\n :page-index=\"pageIndex\"\n :scale=\"scale\"\n :rotation=\"rotation\"\n :background=\"resolvedTextBackground\"\n :selection-menu=\"selectionMenu\"\n >\n <template #selection-menu=\"menuProps\">\n <slot name=\"selection-menu\" v-bind=\"menuProps\" />\n </template>\n </TextSelection>\n <MarqueeSelection\n :document-id=\"documentId\"\n :page-index=\"pageIndex\"\n :scale=\"scale\"\n :background=\"marqueeStyle?.background\"\n :border-color=\"marqueeStyle?.borderColor\"\n :border-style=\"marqueeStyle?.borderStyle\"\n :class-name=\"marqueeClassName\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport { watchEffect } from 'vue';\nimport { useSelectionCapability } from '../hooks';\n\nconst { provides: sel } = useSelectionCapability();\n\n// This effect runs when the component is mounted and the capability is available.\n// It automatically handles unsubscribing when the component is unmounted.\nwatchEffect((onCleanup) => {\n if (sel.value) {\n const unsubscribe = sel.value.onCopyToClipboard(({ text }) => {\n // Use the Clipboard API to write the text\n navigator.clipboard.writeText(text).catch((err) => {\n console.error('Failed to copy text to clipboard:', err);\n });\n });\n\n // Register the cleanup function to run on unmount or re-run\n onCleanup(unsubscribe);\n }\n});\n</script>\n\n<template>\n <!-- This component renders nothing to the DOM -->\n</template>\n","import { createPluginPackage } from '@embedpdf/core';\nimport { SelectionPluginPackage as BaseSelectionPluginPackage } from '@embedpdf/plugin-selection';\n\nimport { CopyToClipboard } from './components';\n\nexport * from './hooks';\nexport * from './components';\nexport * from './types';\nexport * from '@embedpdf/plugin-selection';\n\nexport const SelectionPluginPackage = createPluginPackage(BaseSelectionPluginPackage)\n .addUtility(CopyToClipboard)\n .build();\n"],"names":["_createElementBlock","_Fragment","_createElementVNode","_normalizeStyle","_openBlock","_renderList","_createBlock","_unref","_withCtx","_resolveDynamicComponent","_renderSlot","_createVNode","TextSelection","MarqueeSelection","BaseSelectionPluginPackage","CopyToClipboard"],"mappings":";;;;;;;AAOO,MAAM,yBAAyB,MAAM,cAA+B,gBAAgB,EAAE;AAMtF,MAAM,qBAAqB,MAAM,UAA2B,gBAAgB,EAAE;;;;;;;;;;;;ACOrF,UAAM,QAAQ;AAKd,UAAM,QAAQ,SAAA;AACd,UAAM,EAAE,QAAQ,UAAA,IAAc,mBAAA;AAC9B,UAAM,gBAAgB,iBAAiB,MAAM,MAAM,UAAU;AAC7D,UAAM,OAAO,SAAS,MAAA;;AAAM,6CAAc,UAAd,mBAAqB,aAArB,mBAA+B,UAA/B,mBAAuC,MAAM;AAAA,KAAU;AACnF,UAAM,QAAQ,IAAY,EAAE;AAC5B,UAAM,eAAe,IAAiB,IAAI;AAC1C,UAAM,YAAY,IAAmC,IAAI;AAEzD,UAAM,cAA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AAA;AAAA,UACb,cAAY,QAAA;AAAA,UACZ,OAAO,QAAA;AAAA,UACP,UAAU,QAAA;AAAA,UACV,YAAY,uBAAA;AAAA,UACZ,kBAAgB,QAAA;AAAA,QAAA;UAEN,kBAAcJ,QACvB,CAAiD,cADf;AAAA,YAClCE,WAAiD,iEAAb,SAAS,CAAA,CAAA;AAAA,UAAA;;;QAGjDC,YAQEE,aAAA;AAAA,UAPC,eAAa,QAAA;AAAA,UACb,cAAY,QAAA;AAAA,UACZ,OAAO,QAAA;AAAA,UACP,aAAY,aAAA,iBAAA,mBAAc;AAAA,UAC1B,iBAAc,aAAA,iBAAA,mBAAc;AAAA,UAC5B,iBAAc,aAAA,iBAAA,mBAAc;AAAA,UAC5B,cAAY,QAAA;AAAA,QAAA;;;;;;;;ACnDjB,UAAM,EAAE,UAAU,IAAA,IAAQ,uBAAA;AAI1B,gBAAY,CAAC,cAAc;AACzB,UAAI,IAAI,OAAO;AACb,cAAM,cAAc,IAAI,MAAM,kBAAkB,CAAC,EAAE,WAAW;AAE5D,oBAAU,UAAU,UAAU,IAAI,EAAE,MAAM,CAAC,QAAQ;AACjD,oBAAQ,MAAM,qCAAqC,GAAG;AAAA,UACxD,CAAC;AAAA,QACH,CAAC;AAGD,kBAAU,WAAW;AAAA,MACvB;AAAA,IACF,CAAC;;;;;;ACVM,MAAM,yBAAyB,oBAAoBC,wBAA0B,EACjF,WAAWC,SAAe,EAC1B,MAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-selection",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@embedpdf/models": "2.
|
|
38
|
-
"@embedpdf/utils": "2.
|
|
37
|
+
"@embedpdf/models": "2.6.1",
|
|
38
|
+
"@embedpdf/utils": "2.6.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react": "^18.2.0",
|
|
42
42
|
"typescript": "^5.0.0",
|
|
43
43
|
"@embedpdf/build": "1.1.0",
|
|
44
|
-
"@embedpdf/
|
|
45
|
-
"@embedpdf/
|
|
46
|
-
"@embedpdf/plugin-
|
|
47
|
-
"@embedpdf/plugin-
|
|
44
|
+
"@embedpdf/plugin-viewport": "2.6.1",
|
|
45
|
+
"@embedpdf/core": "2.6.1",
|
|
46
|
+
"@embedpdf/plugin-scroll": "2.6.1",
|
|
47
|
+
"@embedpdf/plugin-interaction-manager": "2.6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": ">=16.8.0",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"preact": "^10.26.4",
|
|
53
53
|
"vue": ">=3.2.0",
|
|
54
54
|
"svelte": ">=5 <6",
|
|
55
|
-
"@embedpdf/core": "2.
|
|
56
|
-
"@embedpdf/plugin-interaction-manager": "2.
|
|
55
|
+
"@embedpdf/core": "2.6.1",
|
|
56
|
+
"@embedpdf/plugin-interaction-manager": "2.6.1"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
59
59
|
"dist",
|