@kopjra/pdf-sentinel 1.11.2 → 1.11.4
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/pdf-sentinel.js +2481 -2523
- package/dist/preact/pdf-sentinel.js.map +1 -1
- package/dist/preact/src/__tests__/annotationUtils.test.d.ts +1 -0
- package/dist/preact/src/__tests__/annotations.test.d.ts +1 -0
- package/dist/preact/src/__tests__/frameworkExports.test.d.ts +1 -0
- package/dist/preact/src/__tests__/readAnnotationFields.test.d.ts +1 -0
- package/dist/preact/src/__tests__/renderers.test.d.ts +1 -0
- package/dist/preact/src/__tests__/renderersRender.test.d.ts +1 -0
- package/dist/preact/src/__tests__/shared.test.d.ts +1 -0
- package/dist/preact/src/__tests__/signatureColors.test.d.ts +1 -0
- package/dist/preact/src/__tests__/textRendererReadonly.test.d.ts +1 -0
- package/dist/preact/src/__tests__/toolbar.test.d.ts +1 -0
- package/dist/preact/src/__tests__/tools.test.d.ts +1 -0
- package/dist/preact/src/__tests__/toolsAdvanced.test.d.ts +1 -0
- package/dist/preact/src/__tests__/translations.test.d.ts +1 -0
- package/dist/preact/src/__tests__/useDeepMemo.test.d.ts +1 -0
- package/dist/preact/src/__tests__/usePdfSentinel.test.d.ts +1 -0
- package/dist/preact/src/components/PdfSToolbar.d.ts +2 -1
- package/dist/preact/src/framework/index.d.ts +2 -0
- package/dist/preact/src/framework/preact.d.ts +2 -0
- package/dist/preact/src/plugins/forms/hooks/usePdfForms.d.ts +2 -3
- package/dist/preact/src/plugins/forms/shared.d.ts +17 -2
- package/dist/react/pdf-sentinel.js +3131 -3173
- package/dist/react/pdf-sentinel.js.map +1 -1
- package/dist/react/src/__tests__/annotationUtils.test.d.ts +1 -0
- package/dist/react/src/__tests__/annotations.test.d.ts +1 -0
- package/dist/react/src/__tests__/frameworkExports.test.d.ts +1 -0
- package/dist/react/src/__tests__/readAnnotationFields.test.d.ts +1 -0
- package/dist/react/src/__tests__/renderers.test.d.ts +1 -0
- package/dist/react/src/__tests__/renderersRender.test.d.ts +1 -0
- package/dist/react/src/__tests__/shared.test.d.ts +1 -0
- package/dist/react/src/__tests__/signatureColors.test.d.ts +1 -0
- package/dist/react/src/__tests__/textRendererReadonly.test.d.ts +1 -0
- package/dist/react/src/__tests__/toolbar.test.d.ts +1 -0
- package/dist/react/src/__tests__/tools.test.d.ts +1 -0
- package/dist/react/src/__tests__/toolsAdvanced.test.d.ts +1 -0
- package/dist/react/src/__tests__/translations.test.d.ts +1 -0
- package/dist/react/src/__tests__/useDeepMemo.test.d.ts +1 -0
- package/dist/react/src/__tests__/usePdfSentinel.test.d.ts +1 -0
- package/dist/react/src/components/PdfSToolbar.d.ts +2 -1
- package/dist/react/src/framework/index.d.ts +2 -0
- package/dist/react/src/framework/preact.d.ts +2 -0
- package/dist/react/src/plugins/forms/hooks/usePdfForms.d.ts +2 -3
- package/dist/react/src/plugins/forms/shared.d.ts +17 -2
- package/package.json +28 -20
- package/dist/preact/src/utils/raper.d.ts +0 -8
- package/dist/react/src/utils/raper.d.ts +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,5 +13,6 @@ export interface PdfSToolbarProps {
|
|
|
13
13
|
totalPages?: number | null;
|
|
14
14
|
historyCapability?: HistoryCapability | null;
|
|
15
15
|
annotationsApi?: AnnotationsApi | null;
|
|
16
|
+
usageType: "form" | "annotation" | "plain";
|
|
16
17
|
}
|
|
17
|
-
export declare function PdfSToolbar({ buttons, currentPage, zoomCapability, scrollCapability, exportCapability, totalPages, removeButtons, historyCapability, annotationsApi }: PdfSToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function PdfSToolbar({ buttons, currentPage, zoomCapability, scrollCapability, exportCapability, totalPages, removeButtons, historyCapability, annotationsApi, usageType, }: PdfSToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -37,3 +37,5 @@ export { HistoryPluginPackage, useHistoryCapability } from '@embedpdf/plugin-his
|
|
|
37
37
|
export type { HistoryCapability } from '@embedpdf/plugin-history/react';
|
|
38
38
|
export { AnnotationPluginPackage, AnnotationLayer, useAnnotation, AnnotationPlugin, useAnnotationCapability, } from '@embedpdf/plugin-annotation/react';
|
|
39
39
|
export type { CustomAnnotationRenderer, CustomAnnotationRendererProps, AnnotationCapability, AnnotationSelectionMenuProps } from '@embedpdf/plugin-annotation/react';
|
|
40
|
+
export { FormPluginPackage, useFormCapability } from '@embedpdf/plugin-form/react';
|
|
41
|
+
export type { FormCapability, FormScope, FormFieldInfo } from '@embedpdf/plugin-form/react';
|
|
@@ -38,3 +38,5 @@ export { HistoryPluginPackage, useHistoryCapability } from '@embedpdf/plugin-his
|
|
|
38
38
|
export type { HistoryCapability } from '@embedpdf/plugin-history/preact';
|
|
39
39
|
export { AnnotationPluginPackage, AnnotationLayer, useAnnotation, AnnotationPlugin, useAnnotationCapability } from '@embedpdf/plugin-annotation/preact';
|
|
40
40
|
export type { CustomAnnotationRenderer, CustomAnnotationRendererProps, AnnotationCapability, AnnotationSelectionMenuProps } from '@embedpdf/plugin-annotation/preact';
|
|
41
|
+
export { FormPluginPackage, useFormCapability } from '@embedpdf/plugin-form/preact';
|
|
42
|
+
export type { FormCapability, FormScope, FormFieldInfo } from '@embedpdf/plugin-form/preact';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Field as SharedField } from '../shared.ts';
|
|
2
|
-
import { DocumentManagerCapability, ScrollCapability, ViewportCapability } from '../../../framework/index.ts';
|
|
3
|
-
import { PdfEngine } from '@embedpdf/models';
|
|
2
|
+
import { DocumentManagerCapability, FormCapability, ScrollCapability, ViewportCapability } from '../../../framework/index.ts';
|
|
4
3
|
import { ConditionalSignature, InitialValuesType } from '../../../hooks/usePdfSentinel.tsx';
|
|
5
4
|
type Field = SharedField;
|
|
6
5
|
export type UsePdfFormsResult = {
|
|
@@ -16,5 +15,5 @@ export type UsePdfFormsResult = {
|
|
|
16
15
|
showErrors: boolean;
|
|
17
16
|
scrollToConditionalSignature: (index: string) => Generator;
|
|
18
17
|
};
|
|
19
|
-
export declare function usePdfForms(documentId: string, initialValues: InitialValuesType, conditionalSignatures: ConditionalSignature[] | undefined, signatureFieldNames: string[] | undefined,
|
|
18
|
+
export declare function usePdfForms(documentId: string, initialValues: InitialValuesType, conditionalSignatures: ConditionalSignature[] | undefined, signatureFieldNames: string[] | undefined, formCapability: FormCapability | null, loader: DocumentManagerCapability | null, scrollCapability: ScrollCapability | null, viewportCapability: ViewportCapability | null): UsePdfFormsResult;
|
|
20
19
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PdfAnnotationObject, PdfDocumentObject, PdfEngine } from '@embedpdf/models';
|
|
2
|
-
import { DocumentManagerCapability } from '../../framework/index.ts';
|
|
2
|
+
import { DocumentManagerCapability, FormCapability } from '../../framework/index.ts';
|
|
3
3
|
import { ConditionalSignature, InitialValuesType } from '../../hooks/usePdfSentinel.tsx';
|
|
4
4
|
export type Field = {
|
|
5
5
|
name: string;
|
|
@@ -16,13 +16,28 @@ export type Field = {
|
|
|
16
16
|
required?: boolean;
|
|
17
17
|
conditionalIndex?: string;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Extracts form fields from a PDF document using the raw engine API.
|
|
21
|
+
*
|
|
22
|
+
* Kept for use-cases that operate outside the EmbedPDF component tree
|
|
23
|
+
* (e.g. readAnnotationFieldsAndClean in tools.ts).
|
|
24
|
+
*/
|
|
19
25
|
export declare function getFormFieldsFromDocument(document: PdfDocumentObject, engine: PdfEngine<Blob>, initialValues?: InitialValuesType, conditionalSignatures?: ConditionalSignature[], signatureFieldNames?: string[], readAllFields?: boolean): AsyncGenerator<{
|
|
20
26
|
field: Field;
|
|
21
27
|
annotation: PdfAnnotationObject;
|
|
22
28
|
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Checks whether a PDF annotation (widget) currently holds a value.
|
|
31
|
+
* Uses native `isWidgetChecked` for toggle fields (2.14.0+).
|
|
32
|
+
*/
|
|
23
33
|
export declare function hasValue(annotation: PdfAnnotationObject): boolean;
|
|
24
34
|
export declare function makeReadOnlyAndNotRequired(annotation: PdfAnnotationObject): PdfAnnotationObject;
|
|
25
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Collects form fields and their values using the `@embedpdf/plugin-form`
|
|
37
|
+
* capability. This replaces the old engine-level annotation scanning for the
|
|
38
|
+
* interactive form-usage path.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getFormFieldsViaCapability(documentId: string, initialValues: InitialValuesType, conditionalSignatures: ConditionalSignature[], signatureFieldNames: string[] | undefined, formCapability: FormCapability | null, loader: DocumentManagerCapability | null): Promise<{
|
|
26
41
|
fields: Field[];
|
|
27
42
|
values: Record<string, string | boolean>;
|
|
28
43
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kopjra/pdf-sentinel",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.4",
|
|
4
4
|
"description": "A React and Preact component library for embedding and interacting with PDF documents using EmbedPDF.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"config": {
|
|
38
|
-
"embedpdf": "2.
|
|
38
|
+
"embedpdf": "2.14.0"
|
|
39
39
|
},
|
|
40
40
|
"author": "",
|
|
41
41
|
"license": "ISC",
|
|
@@ -46,14 +46,18 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@preact/preset-vite": "^2.10.2",
|
|
49
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
50
|
+
"@testing-library/react": "^16.3.2",
|
|
49
51
|
"@types/jquery": "^3.5.33",
|
|
50
52
|
"@types/lodash": "^4.17.21",
|
|
51
53
|
"@types/node": "^24.10.4",
|
|
52
54
|
"@types/react": "^18.3.12",
|
|
53
55
|
"@types/react-dom": "^18.3.2",
|
|
54
56
|
"@vitejs/plugin-react": "^4.3.4",
|
|
57
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
55
58
|
"cross-env": "^7.0.3",
|
|
56
59
|
"jquery": "^3.7.1",
|
|
60
|
+
"jsdom": "^29.0.2",
|
|
57
61
|
"preact": "^10.28.3",
|
|
58
62
|
"react": "^18.3.1",
|
|
59
63
|
"react-dom": "^18.3.1",
|
|
@@ -61,25 +65,27 @@
|
|
|
61
65
|
"ts-node": "^10.9.2",
|
|
62
66
|
"typescript": "^5.9.3",
|
|
63
67
|
"vite": "^5.4.9",
|
|
64
|
-
"vite-plugin-dts": "^4.2.1"
|
|
68
|
+
"vite-plugin-dts": "^4.2.1",
|
|
69
|
+
"vitest": "^4.0.18"
|
|
65
70
|
},
|
|
66
71
|
"dependencies": {
|
|
67
|
-
"@embedpdf/core": "2.
|
|
68
|
-
"@embedpdf/engines": "2.
|
|
69
|
-
"@embedpdf/models": "2.
|
|
70
|
-
"@embedpdf/pdfium": "2.
|
|
71
|
-
"@embedpdf/plugin-annotation": "2.
|
|
72
|
-
"@embedpdf/plugin-document-manager": "2.
|
|
73
|
-
"@embedpdf/plugin-export": "2.
|
|
74
|
-
"@embedpdf/plugin-
|
|
75
|
-
"@embedpdf/plugin-
|
|
76
|
-
"@embedpdf/plugin-
|
|
77
|
-
"@embedpdf/plugin-
|
|
78
|
-
"@embedpdf/plugin-
|
|
79
|
-
"@embedpdf/plugin-
|
|
80
|
-
"@embedpdf/plugin-
|
|
81
|
-
"@embedpdf/plugin-
|
|
82
|
-
"@embedpdf/plugin-
|
|
72
|
+
"@embedpdf/core": "2.14.0",
|
|
73
|
+
"@embedpdf/engines": "2.14.0",
|
|
74
|
+
"@embedpdf/models": "2.14.0",
|
|
75
|
+
"@embedpdf/pdfium": "2.14.0",
|
|
76
|
+
"@embedpdf/plugin-annotation": "2.14.0",
|
|
77
|
+
"@embedpdf/plugin-document-manager": "2.14.0",
|
|
78
|
+
"@embedpdf/plugin-export": "2.14.0",
|
|
79
|
+
"@embedpdf/plugin-form": "2.14.0",
|
|
80
|
+
"@embedpdf/plugin-history": "2.14.0",
|
|
81
|
+
"@embedpdf/plugin-interaction-manager": "2.14.0",
|
|
82
|
+
"@embedpdf/plugin-pan": "2.14.0",
|
|
83
|
+
"@embedpdf/plugin-render": "2.14.0",
|
|
84
|
+
"@embedpdf/plugin-scroll": "2.14.0",
|
|
85
|
+
"@embedpdf/plugin-selection": "2.14.0",
|
|
86
|
+
"@embedpdf/plugin-spread": "2.14.0",
|
|
87
|
+
"@embedpdf/plugin-viewport": "2.14.0",
|
|
88
|
+
"@embedpdf/plugin-zoom": "2.14.0",
|
|
83
89
|
"lodash": "^4.17.21"
|
|
84
90
|
},
|
|
85
91
|
"scripts": {
|
|
@@ -89,7 +95,9 @@
|
|
|
89
95
|
"build:react": "cross-env FRAMEWORK_VARIANT=react vite build",
|
|
90
96
|
"build:preact": "cross-env FRAMEWORK_VARIANT=preact vite build",
|
|
91
97
|
"typecheck": "tsc --noEmit",
|
|
92
|
-
"test": "
|
|
98
|
+
"test": "vitest run",
|
|
99
|
+
"test:watch": "vitest",
|
|
100
|
+
"coverage": "vitest run --coverage",
|
|
93
101
|
"copy-wasm-s3": "aws s3 cp ./node_modules/@embedpdf/pdfium/dist/pdfium.wasm s3://kopjra-public/wias/pdfium/pdfium-$npm_package_config_embedpdf.wasm --acl public-read --cache-control max-age=31536000",
|
|
94
102
|
"wasm-hash": "shasum -a 256 ./node_modules/@embedpdf/pdfium/dist/pdfium.wasm | awk '{ print $1 }' > ./pdfium-$npm_package_config_embedpdf.wasm.hash.txt",
|
|
95
103
|
"sign-wasm-hash": "curl -k -X POST -H \"Content-Type: application/octet-stream\" -H \"Authorization: Basic ${WEBTRUST_API_KEY}\" --data-binary \"@./pdfium-$npm_package_config_embedpdf.wasm.hash.txt\" \"https://api.webtrust.kopjra.com/v1/timestamps?sync=true&trusted=true&fileName=pdfium-$npm_package_config_embedpdf.wasm.hash.txt\" > ./pdfium-$npm_package_config_embedpdf.wasm.hash.txt.tsd",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PdfEngine, PdfWidgetAnnoField as OriginalPdfWidgetAnnoField } from '@embedpdf/models';
|
|
2
|
-
declare module "@embedpdf/models" {
|
|
3
|
-
interface PdfWidgetAnnoField extends OriginalPdfWidgetAnnoField {
|
|
4
|
-
exportValue?: string;
|
|
5
|
-
signed?: boolean;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function rapeEngine(engine: PdfEngine | null): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PdfEngine, PdfWidgetAnnoField as OriginalPdfWidgetAnnoField } from '@embedpdf/models';
|
|
2
|
-
declare module "@embedpdf/models" {
|
|
3
|
-
interface PdfWidgetAnnoField extends OriginalPdfWidgetAnnoField {
|
|
4
|
-
exportValue?: string;
|
|
5
|
-
signed?: boolean;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function rapeEngine(engine: PdfEngine | null): void;
|