@lofcz/embedpdf-plugin-actions 3.0.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,192 @@
1
+ Copyright 2026 CloudPDF LTD
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use files in this distribution except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ https://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+ -----------------------------------------------------------------------
16
+
17
+ Apache License
18
+ Version 2.0, January 2004
19
+ http://www.apache.org/licenses/
20
+
21
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
22
+
23
+ 1. Definitions.
24
+
25
+ "License" shall mean the terms and conditions for use, reproduction,
26
+ and distribution as defined by Sections 1 through 9 of this document.
27
+
28
+ "Licensor" shall mean the copyright owner or entity authorized by
29
+ the copyright owner that is granting the License.
30
+
31
+ "Legal Entity" shall mean the union of the acting entity and all
32
+ other entities that control, are controlled by, or are under common
33
+ control with that entity. For the purposes of this definition,
34
+ "control" means (i) the power, direct or indirect, to cause the
35
+ direction or management of such entity, whether by contract or
36
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
37
+ outstanding shares, or (iii) beneficial ownership of such entity.
38
+
39
+ "You" (or "Your") shall mean an individual or Legal Entity
40
+ exercising permissions granted by this License.
41
+
42
+ "Source" form shall mean the preferred form for making modifications,
43
+ including but not limited to software source code, documentation
44
+ source, and configuration files.
45
+
46
+ "Object" form shall mean any form resulting from mechanical
47
+ transformation or translation of a Source form, including but
48
+ not limited to compiled object code, generated documentation,
49
+ and conversions to other media types.
50
+
51
+ "Work" shall mean the work of authorship, whether in Source or
52
+ Object form, made available under the License, as indicated by a
53
+ copyright notice that is included in or attached to the work
54
+ (an example is provided in the Appendix below).
55
+
56
+ "Derivative Works" shall mean any work, whether in Source or Object
57
+ form, that is based on (or derived from) the Work and for which the
58
+ editorial revisions, annotations, elaborations, or other modifications
59
+ represent, as a whole, an original work of authorship. For the purposes
60
+ of this License, Derivative Works shall not include works that remain
61
+ separable from, or merely link (or bind by name) to the interfaces of,
62
+ the Work and Derivative Works thereof.
63
+
64
+ "Contribution" shall mean any work of authorship, including
65
+ the original version of the Work and any modifications or additions
66
+ to that Work or Derivative Works thereof, that is intentionally
67
+ submitted to Licensor for inclusion in the Work by the copyright owner
68
+ or by an individual or Legal Entity authorized to submit on behalf of
69
+ the copyright owner. For the purposes of this definition, "submitted"
70
+ means any form of electronic, verbal, or written communication sent
71
+ to the Licensor or its representatives, including but not limited to
72
+ communication on electronic mailing lists, source code control systems,
73
+ and issue tracking systems that are managed by, or on behalf of, the
74
+ Licensor for the purpose of discussing and improving the Work, but
75
+ excluding communication that is conspicuously marked or otherwise
76
+ designated in writing by the copyright owner as "Not a Contribution."
77
+
78
+ "Contributor" shall mean Licensor and any individual or Legal Entity
79
+ on behalf of whom a Contribution has been received by Licensor and
80
+ subsequently incorporated within the Work.
81
+
82
+ 2. Grant of Copyright License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ copyright license to reproduce, prepare Derivative Works of,
86
+ publicly display, publicly perform, sublicense, and distribute the
87
+ Work and such Derivative Works in Source or Object form.
88
+
89
+ 3. Grant of Patent License. Subject to the terms and conditions of
90
+ this License, each Contributor hereby grants to You a perpetual,
91
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
92
+ (except as stated in this section) patent license to make, have made,
93
+ use, offer to sell, sell, import, and otherwise transfer the Work,
94
+ where such license applies only to those patent claims licensable
95
+ by such Contributor that are necessarily infringed by their
96
+ Contribution(s) alone or by combination of their Contribution(s)
97
+ with the Work to which such Contribution(s) was submitted. If You
98
+ institute patent litigation against any entity (including a
99
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
100
+ or a Contribution incorporated within the Work constitutes direct
101
+ or contributory patent infringement, then any patent licenses
102
+ granted to You under this License for that Work shall terminate
103
+ as of the date such litigation is filed.
104
+
105
+ 4. Redistribution. You may reproduce and distribute copies of the
106
+ Work or Derivative Works thereof in any medium, with or without
107
+ modifications, and in Source or Object form, provided that You
108
+ meet the following conditions:
109
+
110
+ (a) You must give any other recipients of the Work or
111
+ Derivative Works a copy of this License; and
112
+
113
+ (b) You must cause any modified files to carry prominent notices
114
+ stating that You changed the files; and
115
+
116
+ (c) You must retain, in the Source form of any Derivative Works
117
+ that You distribute, all copyright, patent, trademark, and
118
+ attribution notices from the Source form of the Work,
119
+ excluding those notices that do not pertain to any part of
120
+ the Derivative Works; and
121
+
122
+ (d) If the Work includes a "NOTICE" text file as part of its
123
+ distribution, then any Derivative Works that You distribute must
124
+ include a readable copy of the attribution notices contained
125
+ within such NOTICE file, excluding those notices that do not
126
+ pertain to any part of the Derivative Works, in at least one
127
+ of the following places: within a NOTICE text file distributed
128
+ as part of the Derivative Works; within the Source form or
129
+ documentation, if provided along with the Derivative Works; or,
130
+ within a display generated by the Derivative Works, if and
131
+ wherever such third-party notices normally appear. The contents
132
+ of the NOTICE file are for informational purposes only and
133
+ do not modify the License. You may add Your own attribution
134
+ notices within Derivative Works that You distribute, alongside
135
+ or as an addendum to the NOTICE text from the Work, provided
136
+ that such additional attribution notices cannot be construed
137
+ as modifying the License.
138
+
139
+ You may add Your own copyright statement to Your modifications and
140
+ may provide additional or different license terms and conditions
141
+ for use, reproduction, or distribution of Your modifications, or
142
+ for any such Derivative Works as a whole, provided Your use,
143
+ reproduction, and distribution of the Work otherwise complies with
144
+ the conditions stated in this License.
145
+
146
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
147
+ any Contribution intentionally submitted for inclusion in the Work
148
+ by You to the Licensor shall be under the terms and conditions of
149
+ this License, without any additional terms or conditions.
150
+ Notwithstanding the above, nothing herein shall supersede or modify
151
+ the terms of any separate license agreement you may have executed
152
+ with Licensor regarding such Contributions.
153
+
154
+ 6. Trademarks. This License does not grant permission to use the trade
155
+ names, trademarks, service marks, or product names of the Licensor,
156
+ except as required for reasonable and customary use in describing the
157
+ origin of the Work and reproducing the content of the NOTICE file.
158
+
159
+ 7. Disclaimer of Warranty. Unless required by applicable law or
160
+ agreed to in writing, Licensor provides the Work (and each
161
+ Contributor provides its Contributions) on an "AS IS" BASIS,
162
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
163
+ implied, including, without limitation, any warranties or conditions
164
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
165
+ PARTICULAR PURPOSE. You are solely responsible for determining the
166
+ appropriateness of using or redistributing the Work and assume any
167
+ risks associated with Your exercise of permissions under this License.
168
+
169
+ 8. Limitation of Liability. In no event and under no legal theory,
170
+ whether in tort (including negligence), contract, or otherwise,
171
+ unless required by applicable law (such as deliberate and grossly
172
+ negligent acts) or agreed to in writing, shall any Contributor be
173
+ liable to You for damages, including any direct, indirect, special,
174
+ incidental, or consequential damages of any character arising as a
175
+ result of this License or out of the use or inability to use the
176
+ Work (including but not limited to damages for loss of goodwill,
177
+ work stoppage, computer failure or malfunction, or any and all
178
+ other commercial damages or losses), even if such Contributor
179
+ has been advised of the possibility of such damages.
180
+
181
+ 9. Accepting Warranty or Additional Liability. While redistributing
182
+ the Work or Derivative Works thereof, You may choose to offer,
183
+ and charge a fee for, acceptance of support, warranty, indemnity,
184
+ or other liability obligations and/or rights consistent with this
185
+ License. However, in accepting such obligations, You may act only
186
+ on Your own behalf and on Your sole responsibility, not on behalf
187
+ of any other Contributor, and only if You agree to indemnify,
188
+ defend, and hold each Contributor harmless for any liability
189
+ incurred by, or claims asserted against, such Contributor by reason
190
+ of your accepting any such warranty or additional liability.
191
+
192
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/host-contract.ts
3
+ const ActionsToken = require("../types-BXJLAKXi.cjs").ActionsToken;
4
+ //#endregion
5
+ exports.ActionsToken = ActionsToken;
6
+
7
+ //# sourceMappingURL=host.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.cjs","names":["PublicActionsToken"],"sources":["../../src/host-contract.ts"],"sourcesContent":["/** Host-typed actions token and registration protocol for sibling plugins. */\nimport type { CapabilityToken } from '@embedpdf/core';\n\nimport { ActionsToken as PublicActionsToken } from './types';\nimport type { ActionsHostCapability } from './types';\n\nexport const ActionsToken = PublicActionsToken as CapabilityToken<ActionsHostCapability>;\nexport type {\n ActionExecutor,\n ActionExecutorResult,\n ActionsHostCapability,\n ActionSubmitRequest,\n AnnotCommitEntry,\n AnnotCommitResult,\n AnnotCommitSink,\n FormCommitSink,\n PageStateReport,\n ScriptSurfaceResult,\n SubmitIntent,\n SubmitResolver,\n} from './types';\n"],"mappings":";;AAMA,MAAa,8CAAeA,CAAAA,CAAAA"}
@@ -0,0 +1,7 @@
1
+ import { C as ActionsHostCapability, D as AnnotCommitEntry, F as SubmitIntent, I as SubmitResolver, M as PageStateReport, O as AnnotCommitResult, P as ScriptSurfaceResult, a as ActionExecutor, g as ActionSubmitRequest, j as FormCommitSink, k as AnnotCommitSink, o as ActionExecutorResult } from "../types-DRQReAuO.cjs";
2
+ import { CapabilityToken } from "@embedpdf/core";
3
+ //#region src/host-contract.d.ts
4
+ declare const ActionsToken: CapabilityToken<ActionsHostCapability>;
5
+ //#endregion
6
+ export { type ActionExecutor, type ActionExecutorResult, type ActionSubmitRequest, type ActionsHostCapability, ActionsToken, type AnnotCommitEntry, type AnnotCommitResult, type AnnotCommitSink, type FormCommitSink, type PageStateReport, type ScriptSurfaceResult, type SubmitIntent, type SubmitResolver };
7
+ //# sourceMappingURL=host.d.cts.map
@@ -0,0 +1,7 @@
1
+ import { C as ActionsHostCapability, D as AnnotCommitEntry, F as SubmitIntent, I as SubmitResolver, M as PageStateReport, O as AnnotCommitResult, P as ScriptSurfaceResult, a as ActionExecutor, g as ActionSubmitRequest, j as FormCommitSink, k as AnnotCommitSink, o as ActionExecutorResult } from "../types-DRQReAuO.js";
2
+ import { CapabilityToken } from "@embedpdf/core";
3
+ //#region src/host-contract.d.ts
4
+ declare const ActionsToken: CapabilityToken<ActionsHostCapability>;
5
+ //#endregion
6
+ export { type ActionExecutor, type ActionExecutorResult, type ActionSubmitRequest, type ActionsHostCapability, ActionsToken, type AnnotCommitEntry, type AnnotCommitResult, type AnnotCommitSink, type FormCommitSink, type PageStateReport, type ScriptSurfaceResult, type SubmitIntent, type SubmitResolver };
7
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { t as ActionsToken$1 } from "../types-DgBMy5nE.js";
2
+ //#region src/host-contract.ts
3
+ const ActionsToken = ActionsToken$1;
4
+ //#endregion
5
+ export { ActionsToken };
6
+
7
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","names":["PublicActionsToken"],"sources":["../../src/host-contract.ts"],"sourcesContent":["/** Host-typed actions token and registration protocol for sibling plugins. */\nimport type { CapabilityToken } from '@embedpdf/core';\n\nimport { ActionsToken as PublicActionsToken } from './types';\nimport type { ActionsHostCapability } from './types';\n\nexport const ActionsToken = PublicActionsToken as CapabilityToken<ActionsHostCapability>;\nexport type {\n ActionExecutor,\n ActionExecutorResult,\n ActionsHostCapability,\n ActionSubmitRequest,\n AnnotCommitEntry,\n AnnotCommitResult,\n AnnotCommitSink,\n FormCommitSink,\n PageStateReport,\n ScriptSurfaceResult,\n SubmitIntent,\n SubmitResolver,\n} from './types';\n"],"mappings":";;AAMA,MAAa,eAAeA"}
@@ -0,0 +1,89 @@
1
+ //#region src/hover-pump.ts
2
+ const sameTarget = (a, b) => {
3
+ if (a === null || b === null) return a === b;
4
+ if (a.ref.kind !== b.ref.kind || a.pon !== b.pon) return false;
5
+ if (a.ref.kind === "objectNumber" && b.ref.kind === "objectNumber") return a.ref.annotObjectNumber === b.ref.annotObjectNumber;
6
+ if (a.ref.kind === "nm" && b.ref.kind === "nm") return a.ref.nm === b.ref.nm;
7
+ if (a.ref.kind === "index" && b.ref.kind === "index") return a.ref.index === b.ref.index && a.ref.revision === b.ref.revision;
8
+ return false;
9
+ };
10
+ /**
11
+ * The ONE hover state machine every event plane shares (D8): per pointer
12
+ * feed, `{ delivered, desired, inFlight }`. On each settle it delivers the
13
+ * transition `delivered → desired` as `Exit(delivered)` then
14
+ * `Enter(desired)`, SUBMITTED BACK-TO-BACK SYNCHRONOUSLY — dispatch takes
15
+ * its queue slot before returning, so the ordered pair can never be split by
16
+ * a slow resolution (the per-annotation-tail reordering the review caught).
17
+ * Under pressure intermediate targets are skipped by design: the pointer
18
+ * sweeping A→B→C while A's exit is in flight delivers `Exit(A) → Enter(C)`,
19
+ * never a stale `Enter(B)`.
20
+ */
21
+ function createHoverPump(dispatch) {
22
+ let delivered = null;
23
+ let desired = null;
24
+ let inFlight = false;
25
+ const pump = () => {
26
+ if (inFlight || sameTarget(delivered, desired)) return;
27
+ inFlight = true;
28
+ const from = delivered;
29
+ const to = desired;
30
+ delivered = to;
31
+ const submissions = [];
32
+ if (from && from.events?.exit !== false) submissions.push(dispatch({
33
+ scope: "annotation",
34
+ event: "cursorExit",
35
+ ref: from.ref,
36
+ pon: from.pon,
37
+ ...from.source ? { source: from.source } : {}
38
+ }));
39
+ if (to && to.events?.enter !== false) submissions.push(dispatch({
40
+ scope: "annotation",
41
+ event: "cursorEnter",
42
+ ref: to.ref,
43
+ pon: to.pon,
44
+ ...to.source ? { source: to.source } : {}
45
+ }));
46
+ Promise.allSettled(submissions).then(() => {
47
+ inFlight = false;
48
+ pump();
49
+ });
50
+ };
51
+ return {
52
+ hover(target) {
53
+ desired = target;
54
+ pump();
55
+ },
56
+ reset() {
57
+ delivered = null;
58
+ desired = null;
59
+ }
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region src/submit-encoding.ts
64
+ /**
65
+ * Encode a resolved submission dataset as `application/x-www-form-urlencoded`
66
+ * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than
67
+ * utf-8 is the handler's problem). A name-only entry (`value === null`, the
68
+ * IncludeNoValueFields shape) encodes as a bare name; a multi-select list
69
+ * box repeats the name per value, the HTML-form convention.
70
+ *
71
+ * Pure and dependency-free on purpose: a convenience for embedder handlers,
72
+ * never called by the plugin itself (the plugin never touches a network).
73
+ */
74
+ const submitEntriesToUrlEncoded = (entries) => entries.flatMap(({ name, value }) => value === null ? [encodeURIComponent(name)] : Array.isArray(value) ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`) : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`]).join("&");
75
+ //#endregion
76
+ Object.defineProperty(exports, "createHoverPump", {
77
+ enumerable: true,
78
+ get: function() {
79
+ return createHoverPump;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "submitEntriesToUrlEncoded", {
83
+ enumerable: true,
84
+ get: function() {
85
+ return submitEntriesToUrlEncoded;
86
+ }
87
+ });
88
+
89
+ //# sourceMappingURL=contract-C1K3H4RP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-C1K3H4RP.cjs","names":[],"sources":["../src/hover-pump.ts","../src/submit-encoding.ts"],"sourcesContent":["import type { AnnotationRef, PageObjectNumber } from '@embedpdf/engine-core/runtime';\n\nimport type { ActionSource, ActionTrigger, ActionTriggerResult } from './types';\n\n/** One hoverable target, as a feed sees it. `events` lets a feed that KNOWS\n * tree presence (folded model, fill item) skip the inert half of a pair —\n * omitted flags default to true. */\nexport interface HoverTarget {\n ref: AnnotationRef;\n pon: PageObjectNumber;\n /** Optional provenance hint forwarded on the trigger (widget/link feeds). */\n source?: ActionSource;\n events?: { enter?: boolean; exit?: boolean };\n}\n\nexport interface HoverPump {\n /** Report where the pointer is now (null = nowhere interesting). */\n hover(target: HoverTarget | null): void;\n /** Forget everything without dispatching (teardown; document switch). */\n reset(): void;\n}\n\nconst sameTarget = (a: HoverTarget | null, b: HoverTarget | null): boolean => {\n if (a === null || b === null) return a === b;\n if (a.ref.kind !== b.ref.kind || a.pon !== b.pon) return false;\n if (a.ref.kind === 'objectNumber' && b.ref.kind === 'objectNumber') {\n return a.ref.annotObjectNumber === b.ref.annotObjectNumber;\n }\n if (a.ref.kind === 'nm' && b.ref.kind === 'nm') return a.ref.nm === b.ref.nm;\n if (a.ref.kind === 'index' && b.ref.kind === 'index') {\n return a.ref.index === b.ref.index && a.ref.revision === b.ref.revision;\n }\n return false;\n};\n\n/**\n * The ONE hover state machine every event plane shares (D8): per pointer\n * feed, `{ delivered, desired, inFlight }`. On each settle it delivers the\n * transition `delivered → desired` as `Exit(delivered)` then\n * `Enter(desired)`, SUBMITTED BACK-TO-BACK SYNCHRONOUSLY — dispatch takes\n * its queue slot before returning, so the ordered pair can never be split by\n * a slow resolution (the per-annotation-tail reordering the review caught).\n * Under pressure intermediate targets are skipped by design: the pointer\n * sweeping A→B→C while A's exit is in flight delivers `Exit(A) → Enter(C)`,\n * never a stale `Enter(B)`.\n */\nexport function createHoverPump(\n dispatch: (trigger: ActionTrigger) => Promise<ActionTriggerResult>,\n): HoverPump {\n let delivered: HoverTarget | null = null;\n let desired: HoverTarget | null = null;\n let inFlight = false;\n\n const pump = (): void => {\n if (inFlight || sameTarget(delivered, desired)) return;\n inFlight = true;\n const from = delivered;\n const to = desired;\n delivered = to;\n const submissions: Array<Promise<unknown>> = [];\n if (from && from.events?.exit !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorExit',\n ref: from.ref,\n pon: from.pon,\n ...(from.source ? { source: from.source } : {}),\n }),\n );\n }\n if (to && to.events?.enter !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorEnter',\n ref: to.ref,\n pon: to.pon,\n ...(to.source ? { source: to.source } : {}),\n }),\n );\n }\n void Promise.allSettled(submissions).then(() => {\n inFlight = false;\n pump(); // the pointer may have moved on — deliver the latest transition\n });\n };\n\n return {\n hover(target) {\n desired = target;\n pump();\n },\n reset() {\n delivered = null;\n desired = null;\n },\n };\n}\n","import type { FormSubmissionEntry } from '@embedpdf/engine-core/runtime';\n\n/**\n * Encode a resolved submission dataset as `application/x-www-form-urlencoded`\n * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than\n * utf-8 is the handler's problem). A name-only entry (`value === null`, the\n * IncludeNoValueFields shape) encodes as a bare name; a multi-select list\n * box repeats the name per value, the HTML-form convention.\n *\n * Pure and dependency-free on purpose: a convenience for embedder handlers,\n * never called by the plugin itself (the plugin never touches a network).\n */\nexport const submitEntriesToUrlEncoded = (entries: FormSubmissionEntry[]): string =>\n entries\n .flatMap(({ name, value }) =>\n value === null\n ? [encodeURIComponent(name)]\n : Array.isArray(value)\n ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`)\n : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`],\n )\n .join('&');\n"],"mappings":";AAsBA,MAAM,cAAc,GAAuB,MAAmC;CAC5E,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO,MAAM;CAC3C,IAAI,EAAE,IAAI,SAAS,EAAE,IAAI,QAAQ,EAAE,QAAQ,EAAE,KAAK,OAAO;CACzD,IAAI,EAAE,IAAI,SAAS,kBAAkB,EAAE,IAAI,SAAS,gBAClD,OAAO,EAAE,IAAI,sBAAsB,EAAE,IAAI;CAE3C,IAAI,EAAE,IAAI,SAAS,QAAQ,EAAE,IAAI,SAAS,MAAM,OAAO,EAAE,IAAI,OAAO,EAAE,IAAI;CAC1E,IAAI,EAAE,IAAI,SAAS,WAAW,EAAE,IAAI,SAAS,SAC3C,OAAO,EAAE,IAAI,UAAU,EAAE,IAAI,SAAS,EAAE,IAAI,aAAa,EAAE,IAAI;CAEjE,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBACd,UACW;CACX,IAAI,YAAgC;CACpC,IAAI,UAA8B;CAClC,IAAI,WAAW;CAEf,MAAM,aAAmB;EACvB,IAAI,YAAY,WAAW,WAAW,OAAO,GAAG;EAChD,WAAW;EACX,MAAM,OAAO;EACb,MAAM,KAAK;EACX,YAAY;EACZ,MAAM,cAAuC,CAAC;EAC9C,IAAI,QAAQ,KAAK,QAAQ,SAAS,OAChC,YAAY,KACV,SAAS;GACP,OAAO;GACP,OAAO;GACP,KAAK,KAAK;GACV,KAAK,KAAK;GACV,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;EAC/C,CAAC,CACH;EAEF,IAAI,MAAM,GAAG,QAAQ,UAAU,OAC7B,YAAY,KACV,SAAS;GACP,OAAO;GACP,OAAO;GACP,KAAK,GAAG;GACR,KAAK,GAAG;GACR,GAAI,GAAG,SAAS,EAAE,QAAQ,GAAG,OAAO,IAAI,CAAC;EAC3C,CAAC,CACH;EAEF,QAAa,WAAW,WAAW,CAAC,CAAC,WAAW;GAC9C,WAAW;GACX,KAAK;EACP,CAAC;CACH;CAEA,OAAO;EACL,MAAM,QAAQ;GACZ,UAAU;GACV,KAAK;EACP;EACA,QAAQ;GACN,YAAY;GACZ,UAAU;EACZ;CACF;AACF;;;;;;;;;;;;;ACtFA,MAAa,6BAA6B,YACxC,QACG,SAAS,EAAE,MAAM,YAChB,UAAU,OACN,CAAC,mBAAmB,IAAI,CAAC,IACzB,MAAM,QAAQ,KAAK,IACjB,MAAM,KAAK,SAAS,GAAG,mBAAmB,IAAI,EAAE,GAAG,mBAAmB,IAAI,GAAG,IAC7E,CAAC,GAAG,mBAAmB,IAAI,EAAE,GAAG,mBAAmB,KAAK,GAAG,CACnE,CAAC,CACA,KAAK,GAAG"}
@@ -0,0 +1,50 @@
1
+ import { _ as ActionTrigger, p as ActionSource, v as ActionTriggerResult } from "./types-DRQReAuO.js";
2
+ import { AnnotationRef, FormSubmissionEntry, PageObjectNumber } from "@embedpdf/engine-core/runtime";
3
+ //#region src/hover-pump.d.ts
4
+ /** One hoverable target, as a feed sees it. `events` lets a feed that KNOWS
5
+ * tree presence (folded model, fill item) skip the inert half of a pair —
6
+ * omitted flags default to true. */
7
+ interface HoverTarget {
8
+ ref: AnnotationRef;
9
+ pon: PageObjectNumber;
10
+ /** Optional provenance hint forwarded on the trigger (widget/link feeds). */
11
+ source?: ActionSource;
12
+ events?: {
13
+ enter?: boolean;
14
+ exit?: boolean;
15
+ };
16
+ }
17
+ interface HoverPump {
18
+ /** Report where the pointer is now (null = nowhere interesting). */
19
+ hover(target: HoverTarget | null): void;
20
+ /** Forget everything without dispatching (teardown; document switch). */
21
+ reset(): void;
22
+ }
23
+ /**
24
+ * The ONE hover state machine every event plane shares (D8): per pointer
25
+ * feed, `{ delivered, desired, inFlight }`. On each settle it delivers the
26
+ * transition `delivered → desired` as `Exit(delivered)` then
27
+ * `Enter(desired)`, SUBMITTED BACK-TO-BACK SYNCHRONOUSLY — dispatch takes
28
+ * its queue slot before returning, so the ordered pair can never be split by
29
+ * a slow resolution (the per-annotation-tail reordering the review caught).
30
+ * Under pressure intermediate targets are skipped by design: the pointer
31
+ * sweeping A→B→C while A's exit is in flight delivers `Exit(A) → Enter(C)`,
32
+ * never a stale `Enter(B)`.
33
+ */
34
+ declare function createHoverPump(dispatch: (trigger: ActionTrigger) => Promise<ActionTriggerResult>): HoverPump;
35
+ //#endregion
36
+ //#region src/submit-encoding.d.ts
37
+ /**
38
+ * Encode a resolved submission dataset as `application/x-www-form-urlencoded`
39
+ * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than
40
+ * utf-8 is the handler's problem). A name-only entry (`value === null`, the
41
+ * IncludeNoValueFields shape) encodes as a bare name; a multi-select list
42
+ * box repeats the name per value, the HTML-form convention.
43
+ *
44
+ * Pure and dependency-free on purpose: a convenience for embedder handlers,
45
+ * never called by the plugin itself (the plugin never touches a network).
46
+ */
47
+ declare const submitEntriesToUrlEncoded: (entries: FormSubmissionEntry[]) => string;
48
+ //#endregion
49
+ export { createHoverPump as i, HoverPump as n, HoverTarget as r, submitEntriesToUrlEncoded as t };
50
+ //# sourceMappingURL=contract-Cl-f3d61.d.ts.map
@@ -0,0 +1,78 @@
1
+ //#region src/hover-pump.ts
2
+ const sameTarget = (a, b) => {
3
+ if (a === null || b === null) return a === b;
4
+ if (a.ref.kind !== b.ref.kind || a.pon !== b.pon) return false;
5
+ if (a.ref.kind === "objectNumber" && b.ref.kind === "objectNumber") return a.ref.annotObjectNumber === b.ref.annotObjectNumber;
6
+ if (a.ref.kind === "nm" && b.ref.kind === "nm") return a.ref.nm === b.ref.nm;
7
+ if (a.ref.kind === "index" && b.ref.kind === "index") return a.ref.index === b.ref.index && a.ref.revision === b.ref.revision;
8
+ return false;
9
+ };
10
+ /**
11
+ * The ONE hover state machine every event plane shares (D8): per pointer
12
+ * feed, `{ delivered, desired, inFlight }`. On each settle it delivers the
13
+ * transition `delivered → desired` as `Exit(delivered)` then
14
+ * `Enter(desired)`, SUBMITTED BACK-TO-BACK SYNCHRONOUSLY — dispatch takes
15
+ * its queue slot before returning, so the ordered pair can never be split by
16
+ * a slow resolution (the per-annotation-tail reordering the review caught).
17
+ * Under pressure intermediate targets are skipped by design: the pointer
18
+ * sweeping A→B→C while A's exit is in flight delivers `Exit(A) → Enter(C)`,
19
+ * never a stale `Enter(B)`.
20
+ */
21
+ function createHoverPump(dispatch) {
22
+ let delivered = null;
23
+ let desired = null;
24
+ let inFlight = false;
25
+ const pump = () => {
26
+ if (inFlight || sameTarget(delivered, desired)) return;
27
+ inFlight = true;
28
+ const from = delivered;
29
+ const to = desired;
30
+ delivered = to;
31
+ const submissions = [];
32
+ if (from && from.events?.exit !== false) submissions.push(dispatch({
33
+ scope: "annotation",
34
+ event: "cursorExit",
35
+ ref: from.ref,
36
+ pon: from.pon,
37
+ ...from.source ? { source: from.source } : {}
38
+ }));
39
+ if (to && to.events?.enter !== false) submissions.push(dispatch({
40
+ scope: "annotation",
41
+ event: "cursorEnter",
42
+ ref: to.ref,
43
+ pon: to.pon,
44
+ ...to.source ? { source: to.source } : {}
45
+ }));
46
+ Promise.allSettled(submissions).then(() => {
47
+ inFlight = false;
48
+ pump();
49
+ });
50
+ };
51
+ return {
52
+ hover(target) {
53
+ desired = target;
54
+ pump();
55
+ },
56
+ reset() {
57
+ delivered = null;
58
+ desired = null;
59
+ }
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region src/submit-encoding.ts
64
+ /**
65
+ * Encode a resolved submission dataset as `application/x-www-form-urlencoded`
66
+ * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than
67
+ * utf-8 is the handler's problem). A name-only entry (`value === null`, the
68
+ * IncludeNoValueFields shape) encodes as a bare name; a multi-select list
69
+ * box repeats the name per value, the HTML-form convention.
70
+ *
71
+ * Pure and dependency-free on purpose: a convenience for embedder handlers,
72
+ * never called by the plugin itself (the plugin never touches a network).
73
+ */
74
+ const submitEntriesToUrlEncoded = (entries) => entries.flatMap(({ name, value }) => value === null ? [encodeURIComponent(name)] : Array.isArray(value) ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`) : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`]).join("&");
75
+ //#endregion
76
+ export { createHoverPump as n, submitEntriesToUrlEncoded as t };
77
+
78
+ //# sourceMappingURL=contract-DAem-EST.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-DAem-EST.js","names":[],"sources":["../src/hover-pump.ts","../src/submit-encoding.ts"],"sourcesContent":["import type { AnnotationRef, PageObjectNumber } from '@embedpdf/engine-core/runtime';\n\nimport type { ActionSource, ActionTrigger, ActionTriggerResult } from './types';\n\n/** One hoverable target, as a feed sees it. `events` lets a feed that KNOWS\n * tree presence (folded model, fill item) skip the inert half of a pair —\n * omitted flags default to true. */\nexport interface HoverTarget {\n ref: AnnotationRef;\n pon: PageObjectNumber;\n /** Optional provenance hint forwarded on the trigger (widget/link feeds). */\n source?: ActionSource;\n events?: { enter?: boolean; exit?: boolean };\n}\n\nexport interface HoverPump {\n /** Report where the pointer is now (null = nowhere interesting). */\n hover(target: HoverTarget | null): void;\n /** Forget everything without dispatching (teardown; document switch). */\n reset(): void;\n}\n\nconst sameTarget = (a: HoverTarget | null, b: HoverTarget | null): boolean => {\n if (a === null || b === null) return a === b;\n if (a.ref.kind !== b.ref.kind || a.pon !== b.pon) return false;\n if (a.ref.kind === 'objectNumber' && b.ref.kind === 'objectNumber') {\n return a.ref.annotObjectNumber === b.ref.annotObjectNumber;\n }\n if (a.ref.kind === 'nm' && b.ref.kind === 'nm') return a.ref.nm === b.ref.nm;\n if (a.ref.kind === 'index' && b.ref.kind === 'index') {\n return a.ref.index === b.ref.index && a.ref.revision === b.ref.revision;\n }\n return false;\n};\n\n/**\n * The ONE hover state machine every event plane shares (D8): per pointer\n * feed, `{ delivered, desired, inFlight }`. On each settle it delivers the\n * transition `delivered → desired` as `Exit(delivered)` then\n * `Enter(desired)`, SUBMITTED BACK-TO-BACK SYNCHRONOUSLY — dispatch takes\n * its queue slot before returning, so the ordered pair can never be split by\n * a slow resolution (the per-annotation-tail reordering the review caught).\n * Under pressure intermediate targets are skipped by design: the pointer\n * sweeping A→B→C while A's exit is in flight delivers `Exit(A) → Enter(C)`,\n * never a stale `Enter(B)`.\n */\nexport function createHoverPump(\n dispatch: (trigger: ActionTrigger) => Promise<ActionTriggerResult>,\n): HoverPump {\n let delivered: HoverTarget | null = null;\n let desired: HoverTarget | null = null;\n let inFlight = false;\n\n const pump = (): void => {\n if (inFlight || sameTarget(delivered, desired)) return;\n inFlight = true;\n const from = delivered;\n const to = desired;\n delivered = to;\n const submissions: Array<Promise<unknown>> = [];\n if (from && from.events?.exit !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorExit',\n ref: from.ref,\n pon: from.pon,\n ...(from.source ? { source: from.source } : {}),\n }),\n );\n }\n if (to && to.events?.enter !== false) {\n submissions.push(\n dispatch({\n scope: 'annotation',\n event: 'cursorEnter',\n ref: to.ref,\n pon: to.pon,\n ...(to.source ? { source: to.source } : {}),\n }),\n );\n }\n void Promise.allSettled(submissions).then(() => {\n inFlight = false;\n pump(); // the pointer may have moved on — deliver the latest transition\n });\n };\n\n return {\n hover(target) {\n desired = target;\n pump();\n },\n reset() {\n delivered = null;\n desired = null;\n },\n };\n}\n","import type { FormSubmissionEntry } from '@embedpdf/engine-core/runtime';\n\n/**\n * Encode a resolved submission dataset as `application/x-www-form-urlencoded`\n * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than\n * utf-8 is the handler's problem). A name-only entry (`value === null`, the\n * IncludeNoValueFields shape) encodes as a bare name; a multi-select list\n * box repeats the name per value, the HTML-form convention.\n *\n * Pure and dependency-free on purpose: a convenience for embedder handlers,\n * never called by the plugin itself (the plugin never touches a network).\n */\nexport const submitEntriesToUrlEncoded = (entries: FormSubmissionEntry[]): string =>\n entries\n .flatMap(({ name, value }) =>\n value === null\n ? [encodeURIComponent(name)]\n : Array.isArray(value)\n ? value.map((item) => `${encodeURIComponent(name)}=${encodeURIComponent(item)}`)\n : [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`],\n )\n .join('&');\n"],"mappings":";AAsBA,MAAM,cAAc,GAAuB,MAAmC;CAC5E,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO,MAAM;CAC3C,IAAI,EAAE,IAAI,SAAS,EAAE,IAAI,QAAQ,EAAE,QAAQ,EAAE,KAAK,OAAO;CACzD,IAAI,EAAE,IAAI,SAAS,kBAAkB,EAAE,IAAI,SAAS,gBAClD,OAAO,EAAE,IAAI,sBAAsB,EAAE,IAAI;CAE3C,IAAI,EAAE,IAAI,SAAS,QAAQ,EAAE,IAAI,SAAS,MAAM,OAAO,EAAE,IAAI,OAAO,EAAE,IAAI;CAC1E,IAAI,EAAE,IAAI,SAAS,WAAW,EAAE,IAAI,SAAS,SAC3C,OAAO,EAAE,IAAI,UAAU,EAAE,IAAI,SAAS,EAAE,IAAI,aAAa,EAAE,IAAI;CAEjE,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBACd,UACW;CACX,IAAI,YAAgC;CACpC,IAAI,UAA8B;CAClC,IAAI,WAAW;CAEf,MAAM,aAAmB;EACvB,IAAI,YAAY,WAAW,WAAW,OAAO,GAAG;EAChD,WAAW;EACX,MAAM,OAAO;EACb,MAAM,KAAK;EACX,YAAY;EACZ,MAAM,cAAuC,CAAC;EAC9C,IAAI,QAAQ,KAAK,QAAQ,SAAS,OAChC,YAAY,KACV,SAAS;GACP,OAAO;GACP,OAAO;GACP,KAAK,KAAK;GACV,KAAK,KAAK;GACV,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;EAC/C,CAAC,CACH;EAEF,IAAI,MAAM,GAAG,QAAQ,UAAU,OAC7B,YAAY,KACV,SAAS;GACP,OAAO;GACP,OAAO;GACP,KAAK,GAAG;GACR,KAAK,GAAG;GACR,GAAI,GAAG,SAAS,EAAE,QAAQ,GAAG,OAAO,IAAI,CAAC;EAC3C,CAAC,CACH;EAEF,QAAa,WAAW,WAAW,CAAC,CAAC,WAAW;GAC9C,WAAW;GACX,KAAK;EACP,CAAC;CACH;CAEA,OAAO;EACL,MAAM,QAAQ;GACZ,UAAU;GACV,KAAK;EACP;EACA,QAAQ;GACN,YAAY;GACZ,UAAU;EACZ;CACF;AACF;;;;;;;;;;;;;ACtFA,MAAa,6BAA6B,YACxC,QACG,SAAS,EAAE,MAAM,YAChB,UAAU,OACN,CAAC,mBAAmB,IAAI,CAAC,IACzB,MAAM,QAAQ,KAAK,IACjB,MAAM,KAAK,SAAS,GAAG,mBAAmB,IAAI,EAAE,GAAG,mBAAmB,IAAI,GAAG,IAC7E,CAAC,GAAG,mBAAmB,IAAI,EAAE,GAAG,mBAAmB,KAAK,GAAG,CACnE,CAAC,CACA,KAAK,GAAG"}
@@ -0,0 +1,50 @@
1
+ import { _ as ActionTrigger, p as ActionSource, v as ActionTriggerResult } from "./types-DRQReAuO.cjs";
2
+ import { AnnotationRef, FormSubmissionEntry, PageObjectNumber } from "@embedpdf/engine-core/runtime";
3
+ //#region src/hover-pump.d.ts
4
+ /** One hoverable target, as a feed sees it. `events` lets a feed that KNOWS
5
+ * tree presence (folded model, fill item) skip the inert half of a pair —
6
+ * omitted flags default to true. */
7
+ interface HoverTarget {
8
+ ref: AnnotationRef;
9
+ pon: PageObjectNumber;
10
+ /** Optional provenance hint forwarded on the trigger (widget/link feeds). */
11
+ source?: ActionSource;
12
+ events?: {
13
+ enter?: boolean;
14
+ exit?: boolean;
15
+ };
16
+ }
17
+ interface HoverPump {
18
+ /** Report where the pointer is now (null = nowhere interesting). */
19
+ hover(target: HoverTarget | null): void;
20
+ /** Forget everything without dispatching (teardown; document switch). */
21
+ reset(): void;
22
+ }
23
+ /**
24
+ * The ONE hover state machine every event plane shares (D8): per pointer
25
+ * feed, `{ delivered, desired, inFlight }`. On each settle it delivers the
26
+ * transition `delivered → desired` as `Exit(delivered)` then
27
+ * `Enter(desired)`, SUBMITTED BACK-TO-BACK SYNCHRONOUSLY — dispatch takes
28
+ * its queue slot before returning, so the ordered pair can never be split by
29
+ * a slow resolution (the per-annotation-tail reordering the review caught).
30
+ * Under pressure intermediate targets are skipped by design: the pointer
31
+ * sweeping A→B→C while A's exit is in flight delivers `Exit(A) → Enter(C)`,
32
+ * never a stale `Enter(B)`.
33
+ */
34
+ declare function createHoverPump(dispatch: (trigger: ActionTrigger) => Promise<ActionTriggerResult>): HoverPump;
35
+ //#endregion
36
+ //#region src/submit-encoding.d.ts
37
+ /**
38
+ * Encode a resolved submission dataset as `application/x-www-form-urlencoded`
39
+ * (UTF-8 — the one encoding this helper speaks; a `/CharSet` other than
40
+ * utf-8 is the handler's problem). A name-only entry (`value === null`, the
41
+ * IncludeNoValueFields shape) encodes as a bare name; a multi-select list
42
+ * box repeats the name per value, the HTML-form convention.
43
+ *
44
+ * Pure and dependency-free on purpose: a convenience for embedder handlers,
45
+ * never called by the plugin itself (the plugin never touches a network).
46
+ */
47
+ declare const submitEntriesToUrlEncoded: (entries: FormSubmissionEntry[]) => string;
48
+ //#endregion
49
+ export { createHoverPump as i, HoverPump as n, HoverTarget as r, submitEntriesToUrlEncoded as t };
50
+ //# sourceMappingURL=contract-KaJQWh67.d.cts.map
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("./types-BXJLAKXi.cjs");
3
+ const require_contract = require("./contract-C1K3H4RP.cjs");
4
+ exports.ActionsToken = require_types.ActionsToken;
5
+ exports.createHoverPump = require_contract.createHoverPump;
6
+ exports.originOf = require_types.originOf;
7
+ exports.submitEntriesToUrlEncoded = require_contract.submitEntriesToUrlEncoded;
@@ -0,0 +1,3 @@
1
+ import { A as DocumentTriggerEvent, E as ActionsToken, F as SubmitIntent, L as originOf, N as PdfAnnotationEventKind, S as ActionsCapability, _ as ActionTrigger, b as ActionUiContext, c as ActionNodeStatus, d as ActionPolicyDecision, f as ActionPolicyRow, g as ActionSubmitRequest, h as ActionSubmitHandler, i as ActionDispatchResult, l as ActionOrigin, m as ActionStepResult, n as ActionDiagnostic, p as ActionSource, r as ActionDispatchEvent, s as ActionNodeResult, t as ActionContext, u as ActionPolicy, v as ActionTriggerResult, w as ActionsPluginConfig, y as ActionUiAdapter } from "./types-DRQReAuO.cjs";
2
+ import { i as createHoverPump, n as HoverPump, r as HoverTarget, t as submitEntriesToUrlEncoded } from "./contract-KaJQWh67.cjs";
3
+ export { type ActionContext, type ActionDiagnostic, type ActionDispatchEvent, type ActionDispatchResult, type ActionNodeResult, type ActionNodeStatus, type ActionOrigin, type ActionPolicy, type ActionPolicyDecision, type ActionPolicyRow, type ActionSource, type ActionStepResult, type ActionSubmitHandler, type ActionSubmitRequest, type ActionTrigger, type ActionTriggerResult, type ActionUiAdapter, type ActionUiContext, type ActionsCapability, type ActionsPluginConfig, ActionsToken, type DocumentTriggerEvent, type HoverPump, type HoverTarget, type PdfAnnotationEventKind, type SubmitIntent, createHoverPump, originOf, submitEntriesToUrlEncoded };
@@ -0,0 +1,3 @@
1
+ import { A as DocumentTriggerEvent, E as ActionsToken, F as SubmitIntent, L as originOf, N as PdfAnnotationEventKind, S as ActionsCapability, _ as ActionTrigger, b as ActionUiContext, c as ActionNodeStatus, d as ActionPolicyDecision, f as ActionPolicyRow, g as ActionSubmitRequest, h as ActionSubmitHandler, i as ActionDispatchResult, l as ActionOrigin, m as ActionStepResult, n as ActionDiagnostic, p as ActionSource, r as ActionDispatchEvent, s as ActionNodeResult, t as ActionContext, u as ActionPolicy, v as ActionTriggerResult, w as ActionsPluginConfig, y as ActionUiAdapter } from "./types-DRQReAuO.js";
2
+ import { i as createHoverPump, n as HoverPump, r as HoverTarget, t as submitEntriesToUrlEncoded } from "./contract-Cl-f3d61.js";
3
+ export { type ActionContext, type ActionDiagnostic, type ActionDispatchEvent, type ActionDispatchResult, type ActionNodeResult, type ActionNodeStatus, type ActionOrigin, type ActionPolicy, type ActionPolicyDecision, type ActionPolicyRow, type ActionSource, type ActionStepResult, type ActionSubmitHandler, type ActionSubmitRequest, type ActionTrigger, type ActionTriggerResult, type ActionUiAdapter, type ActionUiContext, type ActionsCapability, type ActionsPluginConfig, ActionsToken, type DocumentTriggerEvent, type HoverPump, type HoverTarget, type PdfAnnotationEventKind, type SubmitIntent, createHoverPump, originOf, submitEntriesToUrlEncoded };
@@ -0,0 +1,3 @@
1
+ import { r as originOf, t as ActionsToken } from "./types-DgBMy5nE.js";
2
+ import { n as createHoverPump, t as submitEntriesToUrlEncoded } from "./contract-DAem-EST.js";
3
+ export { ActionsToken, createHoverPump, originOf, submitEntriesToUrlEncoded };