@embedpdf/core 2.1.2 → 2.2.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.
Files changed (43) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +165 -7
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/base/base-plugin.d.ts +24 -1
  6. package/dist/lib/index.d.ts +1 -0
  7. package/dist/lib/store/actions.d.ts +15 -3
  8. package/dist/lib/store/initial-state.d.ts +4 -0
  9. package/dist/lib/store/selectors.d.ts +20 -0
  10. package/dist/lib/types/permissions.d.ts +55 -0
  11. package/dist/lib/types/plugin.d.ts +6 -0
  12. package/dist/preact/index.cjs +1 -1
  13. package/dist/preact/index.cjs.map +1 -1
  14. package/dist/preact/index.js +113 -1
  15. package/dist/preact/index.js.map +1 -1
  16. package/dist/react/index.cjs +1 -1
  17. package/dist/react/index.cjs.map +1 -1
  18. package/dist/react/index.js +113 -1
  19. package/dist/react/index.js.map +1 -1
  20. package/dist/shared/components/embed-pdf.d.ts +7 -3
  21. package/dist/shared/hooks/index.d.ts +1 -0
  22. package/dist/shared/hooks/use-document-permissions.d.ts +35 -0
  23. package/dist/shared-preact/components/embed-pdf.d.ts +7 -3
  24. package/dist/shared-preact/hooks/index.d.ts +1 -0
  25. package/dist/shared-preact/hooks/use-document-permissions.d.ts +35 -0
  26. package/dist/shared-react/components/embed-pdf.d.ts +7 -3
  27. package/dist/shared-react/hooks/index.d.ts +1 -0
  28. package/dist/shared-react/hooks/use-document-permissions.d.ts +35 -0
  29. package/dist/svelte/components/EmbedPDF.svelte.d.ts +6 -2
  30. package/dist/svelte/hooks/index.d.ts +1 -0
  31. package/dist/svelte/hooks/use-document-permissions.svelte.d.ts +35 -0
  32. package/dist/svelte/index.cjs +1 -1
  33. package/dist/svelte/index.cjs.map +1 -1
  34. package/dist/svelte/index.js +118 -1
  35. package/dist/svelte/index.js.map +1 -1
  36. package/dist/vue/components/embed-pdf.vue.d.ts +48 -1
  37. package/dist/vue/composables/index.d.ts +1 -0
  38. package/dist/vue/composables/use-document-permissions.d.ts +36 -0
  39. package/dist/vue/index.cjs +1 -1
  40. package/dist/vue/index.cjs.map +1 -1
  41. package/dist/vue/index.js +116 -3
  42. package/dist/vue/index.js.map +1 -1
  43. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/vue/context.ts","../../src/vue/composables/use-registry.ts","../../src/vue/composables/use-core-state.ts","../../src/vue/composables/use-document-state.ts","../../src/vue/composables/use-plugin.ts","../../src/vue/composables/use-capability.ts","../../src/vue/composables/use-store-state.ts","../../src/vue/components/nested-wrapper.vue","../../src/vue/components/auto-mount.vue","../../src/vue/components/embed-pdf.vue"],"sourcesContent":["import { InjectionKey, Ref, ShallowRef } from 'vue';\nimport type { PluginRegistry, CoreState, DocumentState } from '@embedpdf/core';\n\nexport interface PDFContextState {\n registry: ShallowRef<PluginRegistry | null>;\n coreState: Ref<CoreState | null>;\n isInitializing: Ref<boolean>;\n pluginsReady: Ref<boolean>;\n\n // Convenience accessors (always safe to use)\n activeDocumentId: Ref<string | null>;\n activeDocument: Ref<DocumentState | null>;\n documents: Ref<Record<string, DocumentState>>;\n documentStates: Ref<DocumentState[]>;\n}\n\nexport const pdfKey: InjectionKey<PDFContextState> = Symbol('pdfKey');\n","import { inject } from 'vue';\nimport { pdfKey } from '../context';\n\nexport function useRegistry() {\n const ctx = inject(pdfKey);\n if (!ctx) throw new Error('useRegistry must be used inside <EmbedPDF>');\n return ctx;\n}\n","import { Ref } from 'vue';\nimport { type CoreState } from '@embedpdf/core';\nimport { useRegistry } from './use-registry';\n\n/**\n * Hook that provides access to the current core state.\n *\n * Note: This reads from the context which is already subscribed to core state changes\n * in the EmbedPDF component, so there's no additional subscription overhead.\n */\nexport function useCoreState(): Ref<CoreState | null> {\n const { coreState } = useRegistry();\n return coreState;\n}\n","import { computed, toValue, type MaybeRefOrGetter } from 'vue';\nimport { useCoreState } from './use-core-state';\n\n/**\n * Hook that provides reactive access to a specific document's state from the core store.\n *\n * @param documentId The ID of the document to retrieve (can be ref, computed, getter, or plain value).\n * @returns A computed ref containing the DocumentState object or null if not found.\n */\nexport function useDocumentState(documentId: MaybeRefOrGetter<string | null>) {\n const coreState = useCoreState();\n\n const documentState = computed(() => {\n const core = coreState.value;\n const docId = toValue(documentId);\n\n if (!core || !docId) return null;\n return core.documents[docId] ?? null;\n });\n\n return documentState;\n}\n","import { shallowRef, ref, onMounted, watch, type ShallowRef, type Ref } from 'vue';\nimport type { BasePlugin } from '@embedpdf/core';\nimport { useRegistry } from './use-registry';\n\nexport interface PluginState<T extends BasePlugin> {\n plugin: ShallowRef<T | null>;\n isLoading: Ref<boolean>;\n ready: Ref<Promise<void>>;\n}\n\nexport function usePlugin<T extends BasePlugin>(pluginId: T['id']): PluginState<T> {\n const { registry } = useRegistry();\n\n const plugin = shallowRef(null) as ShallowRef<T | null>;\n\n const isLoading = ref(true);\n const ready = ref<Promise<void>>(new Promise(() => {}));\n\n const load = () => {\n if (!registry.value) return;\n\n const p = registry.value.getPlugin<T>(pluginId);\n if (!p) throw new Error(`Plugin ${pluginId} not found`);\n\n plugin.value = p;\n isLoading.value = false;\n ready.value = p.ready?.() ?? Promise.resolve();\n };\n\n onMounted(load);\n watch(registry, load);\n\n return { plugin, isLoading, ready };\n}\n","import type { BasePlugin } from '@embedpdf/core';\nimport { computed, type Ref } from 'vue';\nimport { usePlugin } from './use-plugin';\n\nexport interface CapabilityState<C> {\n provides: Ref<C | null>;\n isLoading: Ref<boolean>;\n ready: Ref<Promise<void>>;\n}\n\n/**\n * Access the public capability exposed by a plugin.\n *\n * @example\n * const { provides: zoom } = useCapability<ZoomPlugin>(ZoomPlugin.id);\n * zoom.value?.zoomIn();\n */\nexport function useCapability<T extends BasePlugin>(\n pluginId: T['id'],\n): CapabilityState<ReturnType<NonNullable<T['provides']>>> {\n const { plugin, isLoading, ready } = usePlugin<T>(pluginId);\n\n const provides = computed(() => {\n if (!plugin.value) return null;\n if (!plugin.value.provides) {\n throw new Error(`Plugin ${pluginId} does not implement provides()`);\n }\n return plugin.value.provides() as ReturnType<NonNullable<T['provides']>>;\n });\n\n return { provides, isLoading, ready };\n}\n","import { ref, onMounted, onBeforeUnmount, watch } from 'vue';\nimport type { CoreState, StoreState } from '@embedpdf/core';\nimport { useRegistry } from './use-registry';\n\n/**\n * Reactive getter for the *entire* global store.\n * Re‑emits whenever any slice changes.\n *\n * @example\n * const state = useStoreState(); // Ref<StoreState<CoreState>>\n * console.log(state.value.core.scale);\n */\nexport function useStoreState<T = CoreState>() {\n const { registry } = useRegistry();\n const state = ref<StoreState<T>>();\n\n function attach() {\n if (!registry.value) return () => {};\n\n // initial snapshot\n state.value = registry.value.getStore().getState() as StoreState<T>;\n\n // live updates\n return registry.value\n .getStore()\n .subscribe((_action, newState) => (state.value = newState as StoreState<T>));\n }\n\n /* attach now and re‑attach if registry instance ever changes */\n let unsubscribe = attach();\n watch(registry, () => {\n unsubscribe?.();\n unsubscribe = attach();\n });\n\n onBeforeUnmount(() => unsubscribe?.());\n\n return state;\n}\n","<script setup lang=\"ts\">\ndefineProps<{\n wrappers: any[];\n}>();\n</script>\n\n<template>\n <component :is=\"wrappers[0]\">\n <NestedWrapper v-if=\"wrappers.length > 1\" :wrappers=\"wrappers.slice(1)\">\n <slot />\n </NestedWrapper>\n <slot v-else />\n </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { hasAutoMountElements, type PluginBatchRegistration, type IPlugin } from '@embedpdf/core';\nimport NestedWrapper from './nested-wrapper.vue';\n\nconst props = defineProps<{\n plugins: PluginBatchRegistration<IPlugin<any>, any>[];\n}>();\n\nconst elements = computed(() => {\n const utilities: any[] = [];\n const wrappers: any[] = [];\n\n for (const reg of props.plugins) {\n const pkg = reg.package;\n if (hasAutoMountElements(pkg)) {\n const elements = pkg.autoMountElements() || [];\n\n for (const element of elements) {\n if (element.type === 'utility') {\n utilities.push(element.component);\n } else if (element.type === 'wrapper') {\n wrappers.push(element.component);\n }\n }\n }\n }\n\n return { utilities, wrappers };\n});\n</script>\n\n<template>\n <NestedWrapper v-if=\"elements.wrappers.length > 0\" :wrappers=\"elements.wrappers\">\n <slot />\n </NestedWrapper>\n <slot v-else />\n\n <component\n v-for=\"(utility, index) in elements.utilities\"\n :key=\"`utility-${index}`\"\n :is=\"utility\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport { ref, provide, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue';\nimport { PluginRegistry, PluginBatchRegistrations, CoreState, DocumentState } from '@embedpdf/core';\nimport { Logger, PdfEngine } from '@embedpdf/models';\nimport { pdfKey, PDFContextState } from '../context';\nimport AutoMount from './auto-mount.vue';\n\nexport type { PluginBatchRegistrations };\n\nconst props = withDefaults(\n defineProps<{\n engine: PdfEngine;\n logger?: Logger;\n plugins: PluginBatchRegistrations;\n onInitialized?: (registry: PluginRegistry) => Promise<void>;\n autoMountDomElements?: boolean;\n }>(),\n {\n autoMountDomElements: true,\n },\n);\n\n/* reactive state */\nconst registry = shallowRef<PluginRegistry | null>(null);\nconst coreState = ref<CoreState | null>(null);\nconst isInit = ref(true);\nconst pluginsOk = ref(false);\n\n// Compute convenience accessors\nconst activeDocumentId = computed(() => coreState.value?.activeDocumentId ?? null);\nconst documents = computed(() => coreState.value?.documents ?? {});\nconst documentOrder = computed(() => coreState.value?.documentOrder ?? []);\n\nconst activeDocument = computed(() => {\n const docId = activeDocumentId.value;\n const docs = documents.value;\n return docId && docs[docId] ? docs[docId] : null;\n});\n\nconst documentStates = computed(() => {\n const docs = documents.value;\n const order = documentOrder.value;\n return order\n .map((docId) => docs[docId])\n .filter((doc): doc is DocumentState => doc !== null && doc !== undefined);\n});\n\n/* expose to children */\nprovide<PDFContextState>(pdfKey, {\n registry,\n coreState,\n isInitializing: isInit,\n pluginsReady: pluginsOk,\n activeDocumentId,\n activeDocument,\n documents,\n documentStates,\n});\n\nonMounted(async () => {\n const reg = new PluginRegistry(props.engine, { logger: props.logger });\n reg.registerPluginBatch(props.plugins);\n await reg.initialize();\n\n if (reg.isDestroyed()) {\n return;\n }\n\n const store = reg.getStore();\n coreState.value = store.getState().core;\n\n const unsubscribe = store.subscribe((action, newState, oldState) => {\n // Only update if it's a core action and the core state changed\n if (store.isCoreAction(action) && newState.core !== oldState.core) {\n coreState.value = newState.core;\n }\n });\n\n await props.onInitialized?.(reg);\n\n if (reg.isDestroyed()) {\n unsubscribe();\n return;\n }\n\n registry.value = reg;\n isInit.value = false;\n\n reg.pluginsReady().then(() => {\n if (!reg.isDestroyed()) {\n pluginsOk.value = true;\n }\n });\n\n onBeforeUnmount(() => {\n unsubscribe();\n registry.value?.destroy();\n });\n});\n</script>\n\n<template>\n <AutoMount v-if=\"pluginsOk && autoMountDomElements\" :plugins=\"plugins\">\n <!-- scoped slot keeps API parity with React version -->\n <slot\n :registry=\"registry\"\n :coreState=\"coreState\"\n :isInitializing=\"isInit\"\n :pluginsReady=\"pluginsOk\"\n :activeDocumentId=\"activeDocumentId\"\n :activeDocument=\"activeDocument\"\n :documents=\"documents\"\n :documentStates=\"documentStates\"\n />\n </AutoMount>\n\n <!-- No auto-mount or not ready yet -->\n <slot\n v-else\n :registry=\"registry\"\n :coreState=\"coreState\"\n :isInitializing=\"isInit\"\n :pluginsReady=\"pluginsOk\"\n :activeDocumentId=\"activeDocumentId\"\n :activeDocument=\"activeDocument\"\n :documents=\"documents\"\n :documentStates=\"documentStates\"\n />\n</template>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_renderSlot","elements","NestedWrapper","_createElementBlock","_Fragment","_a","AutoMount"],"mappings":";;AAgBO,MAAM,SAAwC,OAAO,QAAQ;ACb7D,SAAS,cAAc;AAC5B,QAAM,MAAM,OAAO,MAAM;AACzB,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAO;AACT;ACGO,SAAS,eAAsC;AACpD,QAAM,EAAE,U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,UAAU,SAAA;AAAA,QACV,WAAW,UAAA;AAAA,QACX,gBAAgB,OAAA;AAAA,QAChB,cAAc,UAAA;AAAA,QACd,kBAAkB,iBAAA;AAAA,QAClB,gBAAgB,eAAA;AAAA,QAChB,WAAW,UAAA;AAAA,QACX,gBAAgB,eAAA;AAAA,MAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/vue/context.ts","../../src/vue/composables/use-registry.ts","../../src/vue/composables/use-core-state.ts","../../src/vue/composables/use-document-state.ts","../../src/lib/types/permissions.ts","../../src/lib/store/selectors.ts","../../src/vue/composables/use-document-permissions.ts","../../src/vue/composables/use-plugin.ts","../../src/vue/composables/use-capability.ts","../../src/vue/composables/use-store-state.ts","../../src/vue/components/nested-wrapper.vue","../../src/vue/components/auto-mount.vue","../../src/vue/components/embed-pdf.vue"],"sourcesContent":["import { InjectionKey, Ref, ShallowRef } from 'vue';\nimport type { PluginRegistry, CoreState, DocumentState } from '@embedpdf/core';\n\nexport interface PDFContextState {\n registry: ShallowRef<PluginRegistry | null>;\n coreState: Ref<CoreState | null>;\n isInitializing: Ref<boolean>;\n pluginsReady: Ref<boolean>;\n\n // Convenience accessors (always safe to use)\n activeDocumentId: Ref<string | null>;\n activeDocument: Ref<DocumentState | null>;\n documents: Ref<Record<string, DocumentState>>;\n documentStates: Ref<DocumentState[]>;\n}\n\nexport const pdfKey: InjectionKey<PDFContextState> = Symbol('pdfKey');\n","import { inject } from 'vue';\nimport { pdfKey } from '../context';\n\nexport function useRegistry() {\n const ctx = inject(pdfKey);\n if (!ctx) throw new Error('useRegistry must be used inside <EmbedPDF>');\n return ctx;\n}\n","import { Ref } from 'vue';\nimport { type CoreState } from '@embedpdf/core';\nimport { useRegistry } from './use-registry';\n\n/**\n * Hook that provides access to the current core state.\n *\n * Note: This reads from the context which is already subscribed to core state changes\n * in the EmbedPDF component, so there's no additional subscription overhead.\n */\nexport function useCoreState(): Ref<CoreState | null> {\n const { coreState } = useRegistry();\n return coreState;\n}\n","import { computed, toValue, type MaybeRefOrGetter } from 'vue';\nimport { useCoreState } from './use-core-state';\n\n/**\n * Hook that provides reactive access to a specific document's state from the core store.\n *\n * @param documentId The ID of the document to retrieve (can be ref, computed, getter, or plain value).\n * @returns A computed ref containing the DocumentState object or null if not found.\n */\nexport function useDocumentState(documentId: MaybeRefOrGetter<string | null>) {\n const coreState = useCoreState();\n\n const documentState = computed(() => {\n const core = coreState.value;\n const docId = toValue(documentId);\n\n if (!core || !docId) return null;\n return core.documents[docId] ?? null;\n });\n\n return documentState;\n}\n","import { PdfPermissionFlag } from '@embedpdf/models';\n\n/**\n * Human-readable permission names for use in configuration.\n */\nexport type PermissionName =\n | 'print'\n | 'modifyContents'\n | 'copyContents'\n | 'modifyAnnotations'\n | 'fillForms'\n | 'extractForAccessibility'\n | 'assembleDocument'\n | 'printHighQuality';\n\n/**\n * Map from human-readable names to PdfPermissionFlag values.\n */\nexport const PERMISSION_NAME_TO_FLAG: Record<PermissionName, PdfPermissionFlag> = {\n print: PdfPermissionFlag.Print,\n modifyContents: PdfPermissionFlag.ModifyContents,\n copyContents: PdfPermissionFlag.CopyContents,\n modifyAnnotations: PdfPermissionFlag.ModifyAnnotations,\n fillForms: PdfPermissionFlag.FillForms,\n extractForAccessibility: PdfPermissionFlag.ExtractForAccessibility,\n assembleDocument: PdfPermissionFlag.AssembleDocument,\n printHighQuality: PdfPermissionFlag.PrintHighQuality,\n};\n\n/**\n * Permission overrides can use either numeric flags or human-readable string names.\n */\nexport type PermissionOverrides = Partial<\n Record<PdfPermissionFlag, boolean> & Record<PermissionName, boolean>\n>;\n\n/**\n * Configuration for overriding document permissions.\n * Can be applied globally (at PluginRegistry level) or per-document (when opening).\n */\nexport interface PermissionConfig {\n /**\n * When true (default): use PDF's permissions as the base, then apply overrides.\n * When false: treat document as having all permissions allowed, then apply overrides.\n */\n enforceDocumentPermissions?: boolean;\n\n /**\n * Explicit per-flag overrides. Supports both numeric flags and string names.\n * - true = force allow (even if PDF denies)\n * - false = force deny (even if PDF allows)\n * - undefined = use base permissions\n *\n * @example\n * // Using string names (recommended)\n * overrides: { print: false, modifyAnnotations: true }\n *\n * @example\n * // Using numeric flags\n * overrides: { [PdfPermissionFlag.Print]: false }\n */\n overrides?: PermissionOverrides;\n}\n\n/**\n * All permission flags for iteration when computing effective permissions.\n */\nexport const ALL_PERMISSION_FLAGS: PdfPermissionFlag[] = [\n PdfPermissionFlag.Print,\n PdfPermissionFlag.ModifyContents,\n PdfPermissionFlag.CopyContents,\n PdfPermissionFlag.ModifyAnnotations,\n PdfPermissionFlag.FillForms,\n PdfPermissionFlag.ExtractForAccessibility,\n PdfPermissionFlag.AssembleDocument,\n PdfPermissionFlag.PrintHighQuality,\n];\n\n/**\n * All permission names for iteration.\n */\nexport const ALL_PERMISSION_NAMES: PermissionName[] = [\n 'print',\n 'modifyContents',\n 'copyContents',\n 'modifyAnnotations',\n 'fillForms',\n 'extractForAccessibility',\n 'assembleDocument',\n 'printHighQuality',\n];\n\n/**\n * Map from PdfPermissionFlag to human-readable name.\n */\nexport const PERMISSION_FLAG_TO_NAME: Record<PdfPermissionFlag, PermissionName> = {\n [PdfPermissionFlag.Print]: 'print',\n [PdfPermissionFlag.ModifyContents]: 'modifyContents',\n [PdfPermissionFlag.CopyContents]: 'copyContents',\n [PdfPermissionFlag.ModifyAnnotations]: 'modifyAnnotations',\n [PdfPermissionFlag.FillForms]: 'fillForms',\n [PdfPermissionFlag.ExtractForAccessibility]: 'extractForAccessibility',\n [PdfPermissionFlag.AssembleDocument]: 'assembleDocument',\n [PdfPermissionFlag.PrintHighQuality]: 'printHighQuality',\n};\n\n/**\n * Helper to get the override value for a permission flag, checking both numeric and string keys.\n */\nexport function getPermissionOverride(\n overrides: PermissionOverrides | undefined,\n flag: PdfPermissionFlag,\n): boolean | undefined {\n if (!overrides) return undefined;\n\n // Check numeric key first\n if (flag in overrides) {\n return (overrides as Record<PdfPermissionFlag, boolean>)[flag];\n }\n\n // Check string key\n const name = PERMISSION_FLAG_TO_NAME[flag];\n if (name && name in overrides) {\n return (overrides as Record<PermissionName, boolean>)[name];\n }\n\n return undefined;\n}\n","import { PdfPermissionFlag } from '@embedpdf/models';\nimport { CoreState, DocumentState } from './initial-state';\nimport { ALL_PERMISSION_FLAGS, getPermissionOverride } from '../types/permissions';\n\n/**\n * Get the active document state\n */\nexport const getActiveDocumentState = (state: CoreState): DocumentState | null => {\n if (!state.activeDocumentId) return null;\n return state.documents[state.activeDocumentId] ?? null;\n};\n\n/**\n * Get document state by ID\n */\nexport const getDocumentState = (state: CoreState, documentId: string): DocumentState | null => {\n return state.documents[documentId] ?? null;\n};\n\n/**\n * Get all document IDs\n */\nexport const getDocumentIds = (state: CoreState): string[] => {\n return Object.keys(state.documents);\n};\n\n/**\n * Check if a document is loaded\n */\nexport const isDocumentLoaded = (state: CoreState, documentId: string): boolean => {\n return !!state.documents[documentId];\n};\n\n/**\n * Get the number of open documents\n */\nexport const getDocumentCount = (state: CoreState): number => {\n return Object.keys(state.documents).length;\n};\n\n// ─────────────────────────────────────────────────────────\n// Permission Selectors\n// ─────────────────────────────────────────────────────────\n\n/**\n * Check if a specific permission flag is effectively allowed for a document.\n * Applies layered resolution: per-document override → global override → enforceDocumentPermissions → PDF permission.\n *\n * @param state - The core state\n * @param documentId - The document ID to check permissions for\n * @param flag - The permission flag to check\n * @returns true if the permission is allowed, false otherwise\n */\nexport function getEffectivePermission(\n state: CoreState,\n documentId: string,\n flag: PdfPermissionFlag,\n): boolean {\n const docState = state.documents[documentId];\n const docConfig = docState?.permissions;\n const globalConfig = state.globalPermissions;\n const pdfPermissions = docState?.document?.permissions ?? PdfPermissionFlag.AllowAll;\n\n // 1. Per-document override wins (supports both numeric and string keys)\n const docOverride = getPermissionOverride(docConfig?.overrides, flag);\n if (docOverride !== undefined) {\n return docOverride;\n }\n\n // 2. Global override (supports both numeric and string keys)\n const globalOverride = getPermissionOverride(globalConfig?.overrides, flag);\n if (globalOverride !== undefined) {\n return globalOverride;\n }\n\n // 3. Check enforce setting (per-doc takes precedence over global)\n const enforce =\n docConfig?.enforceDocumentPermissions ?? globalConfig?.enforceDocumentPermissions ?? true;\n\n if (!enforce) return true; // Not enforcing = allow all\n\n // 4. Use PDF permission\n return (pdfPermissions & flag) !== 0;\n}\n\n/**\n * Get all effective permissions as a bitmask for a document.\n * Combines all individual permission checks into a single bitmask.\n *\n * @param state - The core state\n * @param documentId - The document ID to get permissions for\n * @returns A bitmask of all effective permissions\n */\nexport function getEffectivePermissions(state: CoreState, documentId: string): number {\n return ALL_PERMISSION_FLAGS.reduce((acc, flag) => {\n return getEffectivePermission(state, documentId, flag) ? acc | flag : acc;\n }, 0);\n}\n","import { computed, toValue, type MaybeRefOrGetter, ComputedRef } from 'vue';\nimport { PdfPermissionFlag } from '@embedpdf/models';\nimport { useCoreState } from './use-core-state';\nimport { getEffectivePermission, getEffectivePermissions } from '../../lib/store/selectors';\n\nexport interface DocumentPermissions {\n /** Effective permission flags after applying overrides */\n permissions: number;\n /** Raw PDF permission flags (before overrides) */\n pdfPermissions: number;\n /** Check if a specific permission flag is effectively allowed */\n hasPermission: (flag: PdfPermissionFlag) => boolean;\n /** Check if all specified flags are effectively allowed */\n hasAllPermissions: (...flags: PdfPermissionFlag[]) => boolean;\n\n // Shorthand booleans for all permission flags (using effective permissions):\n /** Can print (possibly degraded quality) */\n canPrint: boolean;\n /** Can modify document contents */\n canModifyContents: boolean;\n /** Can copy/extract text and graphics */\n canCopyContents: boolean;\n /** Can add/modify annotations and fill forms */\n canModifyAnnotations: boolean;\n /** Can fill in existing form fields */\n canFillForms: boolean;\n /** Can extract for accessibility */\n canExtractForAccessibility: boolean;\n /** Can assemble document (insert, rotate, delete pages) */\n canAssembleDocument: boolean;\n /** Can print high quality */\n canPrintHighQuality: boolean;\n}\n\n/**\n * Composable that provides reactive access to a document's effective permission flags.\n * Applies layered resolution: per-document override → global override → PDF permission.\n *\n * @param documentId The ID of the document to check permissions for (can be ref, computed, getter, or plain value).\n * @returns A computed ref with the permission object.\n */\nexport function useDocumentPermissions(\n documentId: MaybeRefOrGetter<string>,\n): ComputedRef<DocumentPermissions> {\n const coreState = useCoreState();\n\n return computed(() => {\n const docId = toValue(documentId);\n const state = coreState.value;\n\n if (!state) {\n return {\n permissions: PdfPermissionFlag.AllowAll,\n pdfPermissions: PdfPermissionFlag.AllowAll,\n hasPermission: () => true,\n hasAllPermissions: () => true,\n canPrint: true,\n canModifyContents: true,\n canCopyContents: true,\n canModifyAnnotations: true,\n canFillForms: true,\n canExtractForAccessibility: true,\n canAssembleDocument: true,\n canPrintHighQuality: true,\n };\n }\n\n const effectivePermissions = getEffectivePermissions(state, docId);\n const pdfPermissions =\n state.documents[docId]?.document?.permissions ?? PdfPermissionFlag.AllowAll;\n\n const hasPermission = (flag: PdfPermissionFlag) => getEffectivePermission(state, docId, flag);\n const hasAllPermissions = (...flags: PdfPermissionFlag[]) =>\n flags.every((flag) => getEffectivePermission(state, docId, flag));\n\n return {\n permissions: effectivePermissions,\n pdfPermissions,\n hasPermission,\n hasAllPermissions,\n canPrint: hasPermission(PdfPermissionFlag.Print),\n canModifyContents: hasPermission(PdfPermissionFlag.ModifyContents),\n canCopyContents: hasPermission(PdfPermissionFlag.CopyContents),\n canModifyAnnotations: hasPermission(PdfPermissionFlag.ModifyAnnotations),\n canFillForms: hasPermission(PdfPermissionFlag.FillForms),\n canExtractForAccessibility: hasPermission(PdfPermissionFlag.ExtractForAccessibility),\n canAssembleDocument: hasPermission(PdfPermissionFlag.AssembleDocument),\n canPrintHighQuality: hasPermission(PdfPermissionFlag.PrintHighQuality),\n };\n });\n}\n","import { shallowRef, ref, onMounted, watch, type ShallowRef, type Ref } from 'vue';\nimport type { BasePlugin } from '@embedpdf/core';\nimport { useRegistry } from './use-registry';\n\nexport interface PluginState<T extends BasePlugin> {\n plugin: ShallowRef<T | null>;\n isLoading: Ref<boolean>;\n ready: Ref<Promise<void>>;\n}\n\nexport function usePlugin<T extends BasePlugin>(pluginId: T['id']): PluginState<T> {\n const { registry } = useRegistry();\n\n const plugin = shallowRef(null) as ShallowRef<T | null>;\n\n const isLoading = ref(true);\n const ready = ref<Promise<void>>(new Promise(() => {}));\n\n const load = () => {\n if (!registry.value) return;\n\n const p = registry.value.getPlugin<T>(pluginId);\n if (!p) throw new Error(`Plugin ${pluginId} not found`);\n\n plugin.value = p;\n isLoading.value = false;\n ready.value = p.ready?.() ?? Promise.resolve();\n };\n\n onMounted(load);\n watch(registry, load);\n\n return { plugin, isLoading, ready };\n}\n","import type { BasePlugin } from '@embedpdf/core';\nimport { computed, type Ref } from 'vue';\nimport { usePlugin } from './use-plugin';\n\nexport interface CapabilityState<C> {\n provides: Ref<C | null>;\n isLoading: Ref<boolean>;\n ready: Ref<Promise<void>>;\n}\n\n/**\n * Access the public capability exposed by a plugin.\n *\n * @example\n * const { provides: zoom } = useCapability<ZoomPlugin>(ZoomPlugin.id);\n * zoom.value?.zoomIn();\n */\nexport function useCapability<T extends BasePlugin>(\n pluginId: T['id'],\n): CapabilityState<ReturnType<NonNullable<T['provides']>>> {\n const { plugin, isLoading, ready } = usePlugin<T>(pluginId);\n\n const provides = computed(() => {\n if (!plugin.value) return null;\n if (!plugin.value.provides) {\n throw new Error(`Plugin ${pluginId} does not implement provides()`);\n }\n return plugin.value.provides() as ReturnType<NonNullable<T['provides']>>;\n });\n\n return { provides, isLoading, ready };\n}\n","import { ref, onMounted, onBeforeUnmount, watch } from 'vue';\nimport type { CoreState, StoreState } from '@embedpdf/core';\nimport { useRegistry } from './use-registry';\n\n/**\n * Reactive getter for the *entire* global store.\n * Re‑emits whenever any slice changes.\n *\n * @example\n * const state = useStoreState(); // Ref<StoreState<CoreState>>\n * console.log(state.value.core.scale);\n */\nexport function useStoreState<T = CoreState>() {\n const { registry } = useRegistry();\n const state = ref<StoreState<T>>();\n\n function attach() {\n if (!registry.value) return () => {};\n\n // initial snapshot\n state.value = registry.value.getStore().getState() as StoreState<T>;\n\n // live updates\n return registry.value\n .getStore()\n .subscribe((_action, newState) => (state.value = newState as StoreState<T>));\n }\n\n /* attach now and re‑attach if registry instance ever changes */\n let unsubscribe = attach();\n watch(registry, () => {\n unsubscribe?.();\n unsubscribe = attach();\n });\n\n onBeforeUnmount(() => unsubscribe?.());\n\n return state;\n}\n","<script setup lang=\"ts\">\ndefineProps<{\n wrappers: any[];\n}>();\n</script>\n\n<template>\n <component :is=\"wrappers[0]\">\n <NestedWrapper v-if=\"wrappers.length > 1\" :wrappers=\"wrappers.slice(1)\">\n <slot />\n </NestedWrapper>\n <slot v-else />\n </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { hasAutoMountElements, type PluginBatchRegistration, type IPlugin } from '@embedpdf/core';\nimport NestedWrapper from './nested-wrapper.vue';\n\nconst props = defineProps<{\n plugins: PluginBatchRegistration<IPlugin<any>, any>[];\n}>();\n\nconst elements = computed(() => {\n const utilities: any[] = [];\n const wrappers: any[] = [];\n\n for (const reg of props.plugins) {\n const pkg = reg.package;\n if (hasAutoMountElements(pkg)) {\n const elements = pkg.autoMountElements() || [];\n\n for (const element of elements) {\n if (element.type === 'utility') {\n utilities.push(element.component);\n } else if (element.type === 'wrapper') {\n wrappers.push(element.component);\n }\n }\n }\n }\n\n return { utilities, wrappers };\n});\n</script>\n\n<template>\n <NestedWrapper v-if=\"elements.wrappers.length > 0\" :wrappers=\"elements.wrappers\">\n <slot />\n </NestedWrapper>\n <slot v-else />\n\n <component\n v-for=\"(utility, index) in elements.utilities\"\n :key=\"`utility-${index}`\"\n :is=\"utility\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport { ref, provide, onMounted, onBeforeUnmount, shallowRef, computed } from 'vue';\nimport {\n PluginRegistry,\n PluginBatchRegistrations,\n PluginRegistryConfig,\n CoreState,\n DocumentState,\n} from '@embedpdf/core';\nimport { Logger, PdfEngine } from '@embedpdf/models';\nimport { pdfKey, PDFContextState } from '../context';\nimport AutoMount from './auto-mount.vue';\n\nexport type { PluginBatchRegistrations };\n\nconst props = withDefaults(\n defineProps<{\n engine: PdfEngine;\n /** Registry configuration including logger, permissions, and defaults. */\n config?: PluginRegistryConfig;\n /** @deprecated Use config.logger instead. Will be removed in next major version. */\n logger?: Logger;\n plugins: PluginBatchRegistrations;\n onInitialized?: (registry: PluginRegistry) => Promise<void>;\n autoMountDomElements?: boolean;\n }>(),\n {\n autoMountDomElements: true,\n },\n);\n\n/* reactive state */\nconst registry = shallowRef<PluginRegistry | null>(null);\nconst coreState = ref<CoreState | null>(null);\nconst isInit = ref(true);\nconst pluginsOk = ref(false);\n\n// Compute convenience accessors\nconst activeDocumentId = computed(() => coreState.value?.activeDocumentId ?? null);\nconst documents = computed(() => coreState.value?.documents ?? {});\nconst documentOrder = computed(() => coreState.value?.documentOrder ?? []);\n\nconst activeDocument = computed(() => {\n const docId = activeDocumentId.value;\n const docs = documents.value;\n return docId && docs[docId] ? docs[docId] : null;\n});\n\nconst documentStates = computed(() => {\n const docs = documents.value;\n const order = documentOrder.value;\n return order\n .map((docId) => docs[docId])\n .filter((doc): doc is DocumentState => doc !== null && doc !== undefined);\n});\n\n/* expose to children */\nprovide<PDFContextState>(pdfKey, {\n registry,\n coreState,\n isInitializing: isInit,\n pluginsReady: pluginsOk,\n activeDocumentId,\n activeDocument,\n documents,\n documentStates,\n});\n\nonMounted(async () => {\n // Merge deprecated logger prop into config (config.logger takes precedence)\n const finalConfig: PluginRegistryConfig = {\n ...props.config,\n logger: props.config?.logger ?? props.logger,\n };\n const reg = new PluginRegistry(props.engine, finalConfig);\n reg.registerPluginBatch(props.plugins);\n await reg.initialize();\n\n if (reg.isDestroyed()) {\n return;\n }\n\n const store = reg.getStore();\n coreState.value = store.getState().core;\n\n const unsubscribe = store.subscribe((action, newState, oldState) => {\n // Only update if it's a core action and the core state changed\n if (store.isCoreAction(action) && newState.core !== oldState.core) {\n coreState.value = newState.core;\n }\n });\n\n await props.onInitialized?.(reg);\n\n if (reg.isDestroyed()) {\n unsubscribe();\n return;\n }\n\n registry.value = reg;\n isInit.value = false;\n\n reg.pluginsReady().then(() => {\n if (!reg.isDestroyed()) {\n pluginsOk.value = true;\n }\n });\n\n onBeforeUnmount(() => {\n unsubscribe();\n registry.value?.destroy();\n });\n});\n</script>\n\n<template>\n <AutoMount v-if=\"pluginsOk && autoMountDomElements\" :plugins=\"plugins\">\n <!-- scoped slot keeps API parity with React version -->\n <slot\n :registry=\"registry\"\n :coreState=\"coreState\"\n :isInitializing=\"isInit\"\n :pluginsReady=\"pluginsOk\"\n :activeDocumentId=\"activeDocumentId\"\n :activeDocument=\"activeDocument\"\n :documents=\"documents\"\n :documentStates=\"documentStates\"\n />\n </AutoMount>\n\n <!-- No auto-mount or not ready yet -->\n <slot\n v-else\n :registry=\"registry\"\n :coreState=\"coreState\"\n :isInitializing=\"isInit\"\n :pluginsReady=\"pluginsOk\"\n :activeDocumentId=\"activeDocumentId\"\n :activeDocument=\"activeDocument\"\n :documents=\"documents\"\n :documentStates=\"documentStates\"\n />\n</template>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_renderSlot","elements","NestedWrapper","_createElementBlock","_Fragment","_a","AutoMount"],"mappings":";;;AAgBO,MAAM,SAAwC,OAAO,QAAQ;ACb7D,SAAS,cAAc;AAC5B,QAAM,MAAM,OAAO,MAAM;AACzB,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAO;AACT;ACGO,SAAS,eAAsC;AACpD,QAAM,EAAE,UAAA,IAAc,YAAA;AACtB,SAAO;AACT;ACJO,SAAS,iBAAiB,YAA6C;AAC5E,QAAM,YAAY,aAAA;AAElB,QAAM,gBAAgB,SAAS,MAAM;AACnC,UAAM,OAAO,UAAU;AACvB,UAAM,QAAQ,QAAQ,UAAU;AAEhC,QAAI,CAAC,QAAQ,CAAC,MAAO,QAAO;AAC5B,WAAO,KAAK,UAAU,KAAK,KAAK;AAAA,EAClC,CAAC;AAED,SAAO;AACT;AAAA,CCHkF;AAAA,EAChF,OAAO,kBAAkB;AAAA,E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BAAA;AAAA,YAClB,gBAAgB,eAAA;AAAA,YAChB,WAAW,UAAA;AAAA,YACX,gBAAgB,eAAA;AAAA,UAAA;;;4BAKrBA,WAUE,KAAA,QAAA,WAAA;AAAA;QARC,UAAU,SAAA;AAAA,QACV,WAAW,UAAA;AAAA,QACX,gBAAgB,OAAA;AAAA,QAChB,cAAc,UAAA;AAAA,QACd,kBAAkB,iBAAA;AAAA,QAClB,gBAAgB,eAAA;AAAA,QAChB,WAAW,UAAA;AAAA,QACX,gBAAgB,eAAA;AAAA,MAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/core",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",
@@ -40,8 +40,8 @@
40
40
  "@embedpdf/build": "1.1.0"
41
41
  },
42
42
  "dependencies": {
43
- "@embedpdf/engines": "2.1.2",
44
- "@embedpdf/models": "2.1.2"
43
+ "@embedpdf/engines": "2.2.0",
44
+ "@embedpdf/models": "2.2.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "preact": "^10.26.4",