@embedpdf/viewer-chrome 3.0.0-next.13 → 3.0.0-next.15
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/README.md +175 -132
- package/dist/annotation-fonts-BqoLZ4Mp.js +80 -0
- package/dist/annotation-fonts-BqoLZ4Mp.js.map +1 -0
- package/dist/annotation-fonts-Dt0IQXhz.cjs +91 -0
- package/dist/annotation-fonts-Dt0IQXhz.cjs.map +1 -0
- package/dist/annotation-style--rPIZsuP.js +879 -0
- package/dist/annotation-style--rPIZsuP.js.map +1 -0
- package/dist/annotation-style-Bzvvp8-N.cjs +879 -0
- package/dist/annotation-style-Bzvvp8-N.cjs.map +1 -0
- package/dist/ar-D9XKAmDx.js +567 -0
- package/dist/ar-D9XKAmDx.js.map +1 -0
- package/dist/ar-DnEj5vbP.cjs +567 -0
- package/dist/ar-DnEj5vbP.cjs.map +1 -0
- package/dist/chrome.cjs +378 -221
- package/dist/chrome.cjs.map +1 -1
- package/dist/chrome.d.cts +5 -34
- package/dist/chrome.d.ts +5 -34
- package/dist/chrome.js +377 -218
- package/dist/chrome.js.map +1 -1
- package/dist/commands-BmgxhJ8B.js +953 -0
- package/dist/commands-BmgxhJ8B.js.map +1 -0
- package/dist/commands-CYt4SFUX.cjs +1060 -0
- package/dist/commands-CYt4SFUX.cjs.map +1 -0
- package/dist/commands.cjs +12 -595
- package/dist/commands.d.cts +29 -4
- package/dist/commands.d.ts +29 -4
- package/dist/commands.js +2 -593
- package/dist/comments-panel-MUVgLCBI.js +514 -0
- package/dist/comments-panel-MUVgLCBI.js.map +1 -0
- package/dist/comments-panel-pEcQg4Vs.cjs +514 -0
- package/dist/comments-panel-pEcQg4Vs.cjs.map +1 -0
- package/dist/de-Bdr4aWzm.js +566 -0
- package/dist/de-Bdr4aWzm.js.map +1 -0
- package/dist/de-Dv6zvbnd.cjs +566 -0
- package/dist/de-Dv6zvbnd.cjs.map +1 -0
- package/dist/dialog-B5GBisKv.js +55 -0
- package/dist/dialog-B5GBisKv.js.map +1 -0
- package/dist/dialog-t8F13BL_.cjs +60 -0
- package/dist/dialog-t8F13BL_.cjs.map +1 -0
- package/dist/es-BP09DR9w.cjs +566 -0
- package/dist/es-BP09DR9w.cjs.map +1 -0
- package/dist/es-BSXz5tBv.js +566 -0
- package/dist/es-BSXz5tBv.js.map +1 -0
- package/dist/form-design-panel-B5MXTZ96.cjs +418 -0
- package/dist/form-design-panel-B5MXTZ96.cjs.map +1 -0
- package/dist/form-design-panel-vWWU9uB-.js +418 -0
- package/dist/form-design-panel-vWWU9uB-.js.map +1 -0
- package/dist/fr-BBQQn7tJ.cjs +566 -0
- package/dist/fr-BBQQn7tJ.cjs.map +1 -0
- package/dist/fr-Ckn3K9v1.js +566 -0
- package/dist/fr-Ckn3K9v1.js.map +1 -0
- package/dist/he-DRsG7bH7.cjs +567 -0
- package/dist/he-DRsG7bH7.cjs.map +1 -0
- package/dist/he-wdGU5PkU.js +567 -0
- package/dist/he-wdGU5PkU.js.map +1 -0
- package/dist/icons-BrK5iVL8.js +856 -0
- package/dist/icons-BrK5iVL8.js.map +1 -0
- package/dist/icons-x0Tc05bs.cjs +1010 -0
- package/dist/icons-x0Tc05bs.cjs.map +1 -0
- package/dist/index.cjs +3162 -5106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +636 -143
- package/dist/index.d.ts +636 -143
- package/dist/index.js +3083 -4975
- package/dist/index.js.map +1 -1
- package/dist/it-BuP4o0xQ.cjs +566 -0
- package/dist/it-BuP4o0xQ.cjs.map +1 -0
- package/dist/it-Us-VmvIu.js +566 -0
- package/dist/it-Us-VmvIu.js.map +1 -0
- package/dist/ja-Cizj0-5O.js +566 -0
- package/dist/ja-Cizj0-5O.js.map +1 -0
- package/dist/ja-DovEd6ts.cjs +566 -0
- package/dist/ja-DovEd6ts.cjs.map +1 -0
- package/dist/ko-B-qJEol2.cjs +566 -0
- package/dist/ko-B-qJEol2.cjs.map +1 -0
- package/dist/ko-DlrXliE1.js +566 -0
- package/dist/ko-DlrXliE1.js.map +1 -0
- package/dist/labels-BiM9wp9K.cjs +21 -0
- package/dist/labels-BiM9wp9K.cjs.map +1 -0
- package/dist/labels-C6_i87Oj.js +16 -0
- package/dist/labels-C6_i87Oj.js.map +1 -0
- package/dist/link-editor-CSjqPnj1.cjs +125 -0
- package/dist/link-editor-CSjqPnj1.cjs.map +1 -0
- package/dist/link-editor-SxM1nnJU.js +125 -0
- package/dist/link-editor-SxM1nnJU.js.map +1 -0
- package/dist/measurement-Bs61XWbJ.js +325 -0
- package/dist/measurement-Bs61XWbJ.js.map +1 -0
- package/dist/measurement-CcCsHPOX.cjs +326 -0
- package/dist/measurement-CcCsHPOX.cjs.map +1 -0
- package/dist/nl-0aF7M_0h.js +566 -0
- package/dist/nl-0aF7M_0h.js.map +1 -0
- package/dist/nl-D3KZDDiJ.cjs +566 -0
- package/dist/nl-D3KZDDiJ.cjs.map +1 -0
- package/dist/pl-BW--AaCI.js +566 -0
- package/dist/pl-BW--AaCI.js.map +1 -0
- package/dist/pl-DSFhAUqx.cjs +566 -0
- package/dist/pl-DSFhAUqx.cjs.map +1 -0
- package/dist/pt-C5S-8MC5.cjs +566 -0
- package/dist/pt-C5S-8MC5.cjs.map +1 -0
- package/dist/pt-DIhpU5pT.js +566 -0
- package/dist/pt-DIhpU5pT.js.map +1 -0
- package/dist/redact-confirm-B6j36TPw.js +83 -0
- package/dist/redact-confirm-B6j36TPw.js.map +1 -0
- package/dist/redact-confirm-CX_SY2ZN.cjs +83 -0
- package/dist/redact-confirm-CX_SY2ZN.cjs.map +1 -0
- package/dist/redaction-panel-BmoIl-Ll.cjs +96 -0
- package/dist/redaction-panel-BmoIl-Ll.cjs.map +1 -0
- package/dist/redaction-panel-IJDshSJI.js +96 -0
- package/dist/redaction-panel-IJDshSJI.js.map +1 -0
- package/dist/search-panel-HfIhJm1M.js +249 -0
- package/dist/search-panel-HfIhJm1M.js.map +1 -0
- package/dist/search-panel-s9IoiOtv.cjs +249 -0
- package/dist/search-panel-s9IoiOtv.cjs.map +1 -0
- package/dist/sheet-BDsa_Sup.cjs +442 -0
- package/dist/sheet-BDsa_Sup.cjs.map +1 -0
- package/dist/sheet-R6XDgyEf.js +365 -0
- package/dist/sheet-R6XDgyEf.js.map +1 -0
- package/dist/sign-dialog-CgnR7akj.cjs +155 -0
- package/dist/sign-dialog-CgnR7akj.cjs.map +1 -0
- package/dist/sign-dialog-GDqCoQhA.js +155 -0
- package/dist/sign-dialog-GDqCoQhA.js.map +1 -0
- package/dist/signature-inspector-DyO313Qf.cjs +166 -0
- package/dist/signature-inspector-DyO313Qf.cjs.map +1 -0
- package/dist/signature-inspector-okFz8do6.js +166 -0
- package/dist/signature-inspector-okFz8do6.js.map +1 -0
- package/dist/signature-maker-BhCmYyHD.js +393 -0
- package/dist/signature-maker-BhCmYyHD.js.map +1 -0
- package/dist/signature-maker-BoYa8vgA.cjs +393 -0
- package/dist/signature-maker-BoYa8vgA.cjs.map +1 -0
- package/dist/signatures-panel-B56PC6d9.cjs +300 -0
- package/dist/signatures-panel-B56PC6d9.cjs.map +1 -0
- package/dist/signatures-panel-CgnFfhFm.js +300 -0
- package/dist/signatures-panel-CgnFfhFm.js.map +1 -0
- package/dist/stamp-store-BHvRs-Do.cjs +147 -0
- package/dist/stamp-store-BHvRs-Do.cjs.map +1 -0
- package/dist/stamp-store-WuF-L3Jj.js +112 -0
- package/dist/stamp-store-WuF-L3Jj.js.map +1 -0
- package/dist/stamps-panel-B9NYGayn.cjs +231 -0
- package/dist/stamps-panel-B9NYGayn.cjs.map +1 -0
- package/dist/stamps-panel-CDO0FPyK.js +231 -0
- package/dist/stamps-panel-CDO0FPyK.js.map +1 -0
- package/dist/toolbar-CJu2wKTU.cjs +1659 -0
- package/dist/toolbar-CJu2wKTU.cjs.map +1 -0
- package/dist/toolbar-z9od3tKl.js +1564 -0
- package/dist/toolbar-z9od3tKl.js.map +1 -0
- package/dist/zh-cn-3tmMeHqv.cjs +566 -0
- package/dist/zh-cn-3tmMeHqv.cjs.map +1 -0
- package/dist/zh-cn-CxkUUBct.js +566 -0
- package/dist/zh-cn-CxkUUBct.js.map +1 -0
- package/package.json +6 -4
- package/src/styles.css +153 -89
- package/dist/commands.cjs.map +0 -1
- package/dist/commands.js.map +0 -1
- package/dist/es-DYwzfxyt.cjs +0 -293
- package/dist/es-DYwzfxyt.cjs.map +0 -1
- package/dist/es-sN6uqBgD.js +0 -293
- package/dist/es-sN6uqBgD.js.map +0 -1
package/dist/commands.cjs
CHANGED
|
@@ -1,596 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let _embedpdf_react_i18n = require("@embedpdf/react/i18n");
|
|
15
|
-
let _embedpdf_react_shell = require("@embedpdf/react/shell");
|
|
16
|
-
//#region src/config/commands.ts
|
|
17
|
-
/** Where selection-made stamps go: the user's own library, persisted. */
|
|
18
|
-
const CUSTOM_LIBRARY_ID = "embedpdf-custom";
|
|
19
|
-
const stage = (c) => c.tryGet(_embedpdf_react_stage.StageToken);
|
|
20
|
-
const interaction = (c) => c.tryGet(_embedpdf_react_interaction.InteractionToken);
|
|
21
|
-
const anno = (c) => c.tryGet(_embedpdf_react_annotation.AnnotationToken);
|
|
22
|
-
const textSelection = (c) => c.tryGet(_embedpdf_react_selection.SelectionToken);
|
|
23
|
-
const sameTextRange = (a, b) => a === b || !!a && !!b && a.start.pon === b.start.pon && a.start.index === b.start.index && a.end.pon === b.end.pon && a.end.index === b.end.index;
|
|
24
|
-
const hasAnnotationSelection = (c) => (anno(c)?.selection().length ?? 0) > 0;
|
|
25
|
-
/** v2 gated strip items per subtype (comment hidden on links/widgets) — here
|
|
26
|
-
* it's one derivation over the selected DTOs instead of per-command lookups. */
|
|
27
|
-
const selectionSubtypes = (c) => new Set((anno(c)?.getSelected() ?? []).map((a) => a.subtype));
|
|
28
|
-
/**
|
|
29
|
-
* The selection's `link` value: a target, `null` (linkable but none set), or
|
|
30
|
-
* `undefined` when the selection cannot carry a link at all (widgets, mixed
|
|
31
|
-
* link states) — the schema decides, never a subtype blocklist.
|
|
32
|
-
*/
|
|
33
|
-
const selectionLink = (c) => {
|
|
34
|
-
const p = anno(c)?.getSelectionProps();
|
|
35
|
-
if (!p || !p.specs.some((s) => s.key === "link") || p.mixed.includes("link")) return void 0;
|
|
36
|
-
return p.values.link ?? null;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* toolId → the SAME icon + accent definition its toolbar button uses, recorded
|
|
40
|
-
* as a side effect of the `tool()` command definitions below — ONE source of
|
|
41
|
-
* truth, so the tool cursor (ui/tool-cursor.tsx) and the button can never
|
|
42
|
-
* drift apart.
|
|
43
|
-
*/
|
|
44
|
-
const TOOL_ICONS = {};
|
|
45
|
-
TOOL_ICONS["stamp"] = { icon: "rubberStamp" };
|
|
46
|
-
const toolAccent = (c, toolId, accent) => {
|
|
47
|
-
if (!accent) return null;
|
|
48
|
-
const anno = c.tryGet(_embedpdf_react_annotation.AnnotationToken);
|
|
49
|
-
if (!anno) return null;
|
|
50
|
-
const d = anno.currentDefaults(toolId);
|
|
51
|
-
return {
|
|
52
|
-
primary: d[accent.primary] ?? void 0,
|
|
53
|
-
secondary: accent.secondary ? d[accent.secondary] ?? void 0 : void 0
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
/** A tool command: activates a real interaction tool; active = it's the tool.
|
|
57
|
-
* The icon previews the tool's current defaults — keyed by the SAME toolId
|
|
58
|
-
* as run/active, so the accent can't drift to another tool's colors. */
|
|
59
|
-
const tool = (id, toolId, labelKey, icon, accent) => {
|
|
60
|
-
TOOL_ICONS[toolId] = {
|
|
61
|
-
icon,
|
|
62
|
-
...accent ? { accent } : {}
|
|
63
|
-
};
|
|
64
|
-
const authority = id.startsWith("annotation:add") || id.startsWith("insert:add") ? (c) => anno(c)?.canCreate() ?? true : id.startsWith("form:add") ? (c) => c.tryGet(_embedpdf_react_form.FormToken)?.canDesign() ?? true : id === "redaction:redact" ? (c) => c.tryGet(_embedpdf_react_redaction.RedactionToken)?.canMark() ?? true : null;
|
|
65
|
-
return {
|
|
66
|
-
id,
|
|
67
|
-
labelKey,
|
|
68
|
-
icon,
|
|
69
|
-
categories: ["tool"],
|
|
70
|
-
run: (c) => interaction(c)?.activateTool(toolId),
|
|
71
|
-
active: (c) => interaction(c)?.activeToolId() === toolId,
|
|
72
|
-
enabled: (c) => interaction(c) != null && (authority?.(c) ?? true),
|
|
73
|
-
iconAccent: (c) => toolAccent(c, toolId, accent)
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
/** A fixed zoom level (fraction), e.g. 1 = 100%. */
|
|
77
|
-
const zoomLevel = (id, level, label) => ({
|
|
78
|
-
id,
|
|
79
|
-
labelKey: label,
|
|
80
|
-
categories: ["zoom", "zoom-level"],
|
|
81
|
-
run: (c) => stage(c)?.zoomTo({ level }),
|
|
82
|
-
enabled: (c) => stage(c) != null
|
|
83
|
-
});
|
|
84
|
-
const spread = (id, mode, labelKey, icon) => ({
|
|
85
|
-
id,
|
|
86
|
-
labelKey,
|
|
87
|
-
icon,
|
|
88
|
-
categories: ["page", "spread"],
|
|
89
|
-
run: (c) => stage(c)?.setSpread(mode),
|
|
90
|
-
active: (c) => stage(c)?.spread() === mode,
|
|
91
|
-
enabled: (c) => stage(c) != null
|
|
92
|
-
});
|
|
93
|
-
const defaultCommands = [
|
|
94
|
-
{
|
|
95
|
-
id: "zoom:in",
|
|
96
|
-
labelKey: "commands.zoom.in",
|
|
97
|
-
icon: "zoomIn",
|
|
98
|
-
shortcut: ["Mod+=", "Mod+NumpadAdd"],
|
|
99
|
-
categories: ["zoom"],
|
|
100
|
-
run: (c) => stage(c)?.zoomIn(),
|
|
101
|
-
enabled: (c) => stage(c) != null
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: "zoom:out",
|
|
105
|
-
labelKey: "commands.zoom.out",
|
|
106
|
-
icon: "zoomOut",
|
|
107
|
-
shortcut: ["Mod+-", "Mod+NumpadSubtract"],
|
|
108
|
-
categories: ["zoom"],
|
|
109
|
-
run: (c) => stage(c)?.zoomOut(),
|
|
110
|
-
enabled: (c) => stage(c) != null
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: "zoom:fit-page",
|
|
114
|
-
labelKey: "commands.zoom.fitPage",
|
|
115
|
-
icon: "fitToPage",
|
|
116
|
-
shortcut: "Mod+0",
|
|
117
|
-
categories: ["zoom"],
|
|
118
|
-
run: (c) => stage(c)?.fitPage(),
|
|
119
|
-
active: (c) => stage(c)?.zoomMode() === _embedpdf_react_stage.ZoomMode.FitPage,
|
|
120
|
-
enabled: (c) => stage(c) != null
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: "zoom:fit-width",
|
|
124
|
-
labelKey: "commands.zoom.fitWidth",
|
|
125
|
-
icon: "fitToWidth",
|
|
126
|
-
shortcut: "Mod+1",
|
|
127
|
-
categories: ["zoom"],
|
|
128
|
-
run: (c) => stage(c)?.fitWidth(),
|
|
129
|
-
active: (c) => stage(c)?.zoomMode() === _embedpdf_react_stage.ZoomMode.FitWidth,
|
|
130
|
-
enabled: (c) => stage(c) != null
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
id: "zoom:automatic",
|
|
134
|
-
labelKey: "commands.zoom.automatic",
|
|
135
|
-
categories: ["zoom"],
|
|
136
|
-
run: (c) => stage(c)?.automatic(),
|
|
137
|
-
active: (c) => stage(c)?.zoomMode() === _embedpdf_react_stage.ZoomMode.Automatic,
|
|
138
|
-
enabled: (c) => stage(c) != null
|
|
139
|
-
},
|
|
140
|
-
zoomLevel("zoom:50", .5, "commands.zoom.p50"),
|
|
141
|
-
zoomLevel("zoom:100", 1, "commands.zoom.p100"),
|
|
142
|
-
zoomLevel("zoom:150", 1.5, "commands.zoom.p150"),
|
|
143
|
-
zoomLevel("zoom:200", 2, "commands.zoom.p200"),
|
|
144
|
-
zoomLevel("zoom:400", 4, "commands.zoom.p400"),
|
|
145
|
-
{
|
|
146
|
-
id: "zoom:menu",
|
|
147
|
-
labelKey: "commands.zoom.menu",
|
|
148
|
-
icon: "zoomIn",
|
|
149
|
-
categories: ["zoom"],
|
|
150
|
-
menu: "zoom"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: "pan:toggle",
|
|
154
|
-
labelKey: "commands.pan",
|
|
155
|
-
icon: "hand",
|
|
156
|
-
categories: ["tools"],
|
|
157
|
-
run: (c) => interaction(c)?.activateTool("pan"),
|
|
158
|
-
active: (c) => interaction(c)?.activeToolId() === "pan",
|
|
159
|
-
enabled: (c) => interaction(c) != null
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
id: "pointer:toggle",
|
|
163
|
-
labelKey: "commands.pointer",
|
|
164
|
-
icon: "pointer",
|
|
165
|
-
categories: ["tools"],
|
|
166
|
-
run: (c) => interaction(c)?.activateTool("pointer"),
|
|
167
|
-
active: (c) => interaction(c)?.activeToolId() === "pointer",
|
|
168
|
-
enabled: (c) => interaction(c) != null
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: "panel:sidebar",
|
|
172
|
-
labelKey: "commands.sidebar",
|
|
173
|
-
icon: "sidebar",
|
|
174
|
-
categories: ["panel"],
|
|
175
|
-
panel: {
|
|
176
|
-
id: "sidebar",
|
|
177
|
-
exclusive: "left"
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
id: "panel:search",
|
|
182
|
-
labelKey: "commands.search",
|
|
183
|
-
icon: "search",
|
|
184
|
-
visible: (c) => c.tryGet(_embedpdf_react_search.SearchToken)?.canSearch() ?? true,
|
|
185
|
-
categories: ["panel"],
|
|
186
|
-
panel: {
|
|
187
|
-
id: "search",
|
|
188
|
-
exclusive: "right"
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
id: "panel:comment",
|
|
193
|
-
labelKey: "commands.comment",
|
|
194
|
-
icon: "comment",
|
|
195
|
-
visible: (c) => anno(c)?.canRead() ?? true,
|
|
196
|
-
categories: ["panel"],
|
|
197
|
-
panel: {
|
|
198
|
-
id: "comment",
|
|
199
|
-
exclusive: "right"
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
id: "panel:annotation-style",
|
|
204
|
-
labelKey: "commands.style",
|
|
205
|
-
icon: "palette",
|
|
206
|
-
categories: ["panel"],
|
|
207
|
-
panel: {
|
|
208
|
-
id: "annotation-style",
|
|
209
|
-
exclusive: "right"
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: "document:menu",
|
|
214
|
-
labelKey: "commands.menu",
|
|
215
|
-
icon: "menu",
|
|
216
|
-
categories: ["document"],
|
|
217
|
-
menu: "document"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
id: "page:settings",
|
|
221
|
-
labelKey: "commands.viewControls",
|
|
222
|
-
icon: "viewSettings",
|
|
223
|
-
categories: ["page"],
|
|
224
|
-
menu: "page-settings"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
id: "document:download",
|
|
228
|
-
labelKey: "commands.download",
|
|
229
|
-
icon: "download",
|
|
230
|
-
categories: ["document"],
|
|
231
|
-
run: (c) => {
|
|
232
|
-
const id = c.documentId ?? void 0;
|
|
233
|
-
const documents = c.tryGet(_embedpdf_react_runtime.DocumentsToken);
|
|
234
|
-
if (!documents) return;
|
|
235
|
-
const pull = () => documents.download(id);
|
|
236
|
-
const actions = c.tryGet(_embedpdf_react_actions.ActionsToken);
|
|
237
|
-
(actions ? actions.runDocumentVerb("save", pull) : pull()).then((bytes) => {
|
|
238
|
-
const blob = new Blob([bytes], { type: "application/pdf" });
|
|
239
|
-
const url = URL.createObjectURL(blob);
|
|
240
|
-
const a = document.createElement("a");
|
|
241
|
-
a.href = url;
|
|
242
|
-
a.download = "document.pdf";
|
|
243
|
-
a.click();
|
|
244
|
-
URL.revokeObjectURL(url);
|
|
245
|
-
}).catch((e) => console.warn("[snippet-react] download failed", e));
|
|
246
|
-
},
|
|
247
|
-
enabled: (c) => c.documentId != null && (c.tryGet(_embedpdf_react_runtime.DocumentsToken)?.allows("doc.download") ?? false)
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
id: "document:print",
|
|
251
|
-
labelKey: "commands.print",
|
|
252
|
-
icon: "print",
|
|
253
|
-
shortcut: "Mod+p",
|
|
254
|
-
categories: ["document"],
|
|
255
|
-
run: (c) => {
|
|
256
|
-
const actions = c.documentId != null ? c.tryGet(_embedpdf_react_actions.ActionsToken) : null;
|
|
257
|
-
if (actions) actions.runDocumentVerb("print", () => window.print());
|
|
258
|
-
else window.print();
|
|
259
|
-
},
|
|
260
|
-
enabled: (c) => c.documentId == null || (c.tryGet(_embedpdf_react_runtime.DocumentsToken)?.allows("doc.print") ?? true)
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
id: "document:fullscreen",
|
|
264
|
-
labelKey: "commands.fullscreen",
|
|
265
|
-
icon: "externalLink",
|
|
266
|
-
categories: ["document"],
|
|
267
|
-
run: () => {
|
|
268
|
-
if (document.fullscreenElement) document.exitFullscreen();
|
|
269
|
-
else document.documentElement.requestFullscreen().catch(() => {});
|
|
270
|
-
},
|
|
271
|
-
active: () => Boolean(document.fullscreenElement)
|
|
272
|
-
},
|
|
273
|
-
spread("spread:none", "none", "commands.spread.none", "singlePage"),
|
|
274
|
-
spread("spread:odd", "odd", "commands.spread.odd", "doublePage"),
|
|
275
|
-
spread("spread:even", "even", "commands.spread.even", "book2"),
|
|
276
|
-
{
|
|
277
|
-
id: "scroll:vertical",
|
|
278
|
-
labelKey: "commands.scroll.vertical",
|
|
279
|
-
icon: "vertical",
|
|
280
|
-
categories: ["page", "scroll"],
|
|
281
|
-
run: (c) => stage(c)?.setLayout("vertical"),
|
|
282
|
-
active: (c) => stage(c)?.layout() === "vertical",
|
|
283
|
-
enabled: (c) => stage(c) != null
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
id: "scroll:horizontal",
|
|
287
|
-
labelKey: "commands.scroll.horizontal",
|
|
288
|
-
icon: "horizontal",
|
|
289
|
-
categories: ["page", "scroll"],
|
|
290
|
-
run: (c) => stage(c)?.setLayout("horizontal"),
|
|
291
|
-
active: (c) => stage(c)?.layout() === "horizontal",
|
|
292
|
-
enabled: (c) => stage(c) != null
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
id: "rotate:clockwise",
|
|
296
|
-
labelKey: "commands.rotate.clockwise",
|
|
297
|
-
icon: "rotateClockwise",
|
|
298
|
-
categories: ["page", "rotate"],
|
|
299
|
-
run: (c) => stage(c)?.rotateView(90),
|
|
300
|
-
enabled: (c) => stage(c) != null
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
id: "rotate:counter-clockwise",
|
|
304
|
-
labelKey: "commands.rotate.counterclockwise",
|
|
305
|
-
icon: "rotateCounterClockwise",
|
|
306
|
-
categories: ["page", "rotate"],
|
|
307
|
-
run: (c) => stage(c)?.rotateView(-90),
|
|
308
|
-
enabled: (c) => stage(c) != null
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
id: "mode:view",
|
|
312
|
-
labelKey: "commands.mode.view",
|
|
313
|
-
categories: ["mode"],
|
|
314
|
-
run: (c) => {
|
|
315
|
-
const shell = c.tryGet(_embedpdf_react_shell.ShellToken);
|
|
316
|
-
for (const m of MODE_SURFACES) shell?.close(m);
|
|
317
|
-
interaction(c)?.activateTool("pointer");
|
|
318
|
-
},
|
|
319
|
-
active: (c) => {
|
|
320
|
-
const shell = c.tryGet(_embedpdf_react_shell.ShellToken);
|
|
321
|
-
return shell ? MODE_SURFACES.every((m) => !shell.isOpen(m)) : true;
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
modeCommand("mode:annotate", "commands.mode.annotate"),
|
|
325
|
-
modeCommand("mode:shapes", "commands.mode.shapes"),
|
|
326
|
-
modeCommand("mode:insert", "commands.mode.insert"),
|
|
327
|
-
modeCommand("mode:form", "commands.mode.form", "form-edit"),
|
|
328
|
-
modeCommand("mode:redact", "commands.mode.redact"),
|
|
329
|
-
tool("annotation:add-highlight", "highlight", "commands.annotate.highlight", "highlight", { primary: "color" }),
|
|
330
|
-
tool("annotation:add-strikeout", "strikeout", "commands.annotate.strikeout", "strikethrough", { primary: "color" }),
|
|
331
|
-
tool("annotation:add-underline", "underline", "commands.annotate.underline", "underline", { primary: "color" }),
|
|
332
|
-
tool("annotation:add-squiggly", "squiggly", "commands.annotate.squiggly", "squiggly", { primary: "color" }),
|
|
333
|
-
tool("annotation:add-ink", "ink", "commands.annotate.ink", "pencilMarker", { primary: "color" }),
|
|
334
|
-
tool("annotation:add-ink-highlight", "ink-highlight", "commands.annotate.inkHighlight", "inkHighlighter", { primary: "color" }),
|
|
335
|
-
tool("annotation:add-text", "free-text", "commands.annotate.text", "freeText", { primary: "fontColor" }),
|
|
336
|
-
tool("annotation:add-insert-text", "insert-text", "commands.annotate.insertText", "insertText", { primary: "color" }),
|
|
337
|
-
tool("annotation:add-replace-text", "replace-text", "commands.annotate.replaceText", "replaceText", { primary: "color" }),
|
|
338
|
-
tool("annotation:add-callout", "free-text-callout", "commands.annotate.callout", "callout", {
|
|
339
|
-
primary: "color",
|
|
340
|
-
secondary: "interiorColor"
|
|
341
|
-
}),
|
|
342
|
-
tool("annotation:add-note", "note", "commands.annotate.note", "message"),
|
|
343
|
-
tool("annotation:add-link", "link", "commands.annotate.link", "link"),
|
|
344
|
-
tool("annotation:add-rectangle", "square", "commands.shapes.rectangle", "square", {
|
|
345
|
-
primary: "color",
|
|
346
|
-
secondary: "interiorColor"
|
|
347
|
-
}),
|
|
348
|
-
tool("annotation:add-circle", "circle", "commands.shapes.circle", "circle", {
|
|
349
|
-
primary: "color",
|
|
350
|
-
secondary: "interiorColor"
|
|
351
|
-
}),
|
|
352
|
-
tool("annotation:add-line", "line", "commands.shapes.line", "line", { primary: "color" }),
|
|
353
|
-
tool("annotation:add-arrow", "arrow", "commands.shapes.arrow", "lineArrow", { primary: "color" }),
|
|
354
|
-
tool("annotation:add-polygon", "polygon", "commands.shapes.polygon", "polygon", {
|
|
355
|
-
primary: "color",
|
|
356
|
-
secondary: "interiorColor"
|
|
357
|
-
}),
|
|
358
|
-
tool("annotation:add-polyline", "polyline", "commands.shapes.polyline", "zigzag", { primary: "color" }),
|
|
359
|
-
{
|
|
360
|
-
id: "insert:add-stamp",
|
|
361
|
-
labelKey: "commands.insert.stamp",
|
|
362
|
-
icon: "rubberStamp",
|
|
363
|
-
visible: (c) => c.tryGet(_embedpdf_react_stamp.StampToken) != null,
|
|
364
|
-
enabled: (c) => anno(c)?.canCreate() ?? true,
|
|
365
|
-
categories: ["panel"],
|
|
366
|
-
panel: {
|
|
367
|
-
id: "stamps",
|
|
368
|
-
exclusive: "right"
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
tool("insert:add-attachment", "attachment", "commands.insert.attachment", "paperclip"),
|
|
372
|
-
{
|
|
373
|
-
id: "insert:add-signature",
|
|
374
|
-
labelKey: "commands.insert.signature",
|
|
375
|
-
icon: "signature",
|
|
376
|
-
visible: (c) => c.tryGet(_embedpdf_react_stamp.StampToken) != null && c.tryGet(_embedpdf_react_signature.SignatureToken) != null,
|
|
377
|
-
enabled: (c) => anno(c)?.canCreate() ?? true,
|
|
378
|
-
categories: ["panel"],
|
|
379
|
-
panel: {
|
|
380
|
-
id: "signatures",
|
|
381
|
-
exclusive: "right"
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
tool("insert:add-image", "image", "commands.insert.image", "photo"),
|
|
385
|
-
tool("form:add-textfield", "form-text", "commands.form.textfield", "formTextfield"),
|
|
386
|
-
tool("form:add-checkbox", "form-checkbox", "commands.form.checkbox", "formCheckbox"),
|
|
387
|
-
tool("form:add-radio", "form-radio", "commands.form.radio", "formRadio"),
|
|
388
|
-
tool("form:add-select", "form-combobox", "commands.form.select", "formSelect"),
|
|
389
|
-
tool("form:add-listbox", "form-listbox", "commands.form.listbox", "formListbox"),
|
|
390
|
-
tool("form:add-signature", "form-signature", "commands.form.signature", "signature"),
|
|
391
|
-
tool("redaction:redact", "redact", "commands.redact.mark", "redactArea"),
|
|
392
|
-
{
|
|
393
|
-
id: "panel:redaction",
|
|
394
|
-
labelKey: "commands.redact.panel",
|
|
395
|
-
icon: "redactionSidebar",
|
|
396
|
-
visible: (c) => {
|
|
397
|
-
const r = c.tryGet(_embedpdf_react_redaction.RedactionToken);
|
|
398
|
-
return r ? r.canMark() || r.canApply() : true;
|
|
399
|
-
},
|
|
400
|
-
categories: ["panel"],
|
|
401
|
-
panel: {
|
|
402
|
-
id: "redaction",
|
|
403
|
-
exclusive: "right"
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
id: "annotation:delete",
|
|
408
|
-
labelKey: "commands.annotate.delete",
|
|
409
|
-
icon: "trash",
|
|
410
|
-
categories: ["annotation"],
|
|
411
|
-
run: (c) => {
|
|
412
|
-
const a = anno(c);
|
|
413
|
-
if (!a) return;
|
|
414
|
-
const form = c.tryGet(_embedpdf_react_form.FormToken);
|
|
415
|
-
const dtos = a.getSelected();
|
|
416
|
-
const widgets = form ? dtos.filter((d) => d.subtype === "widget") : [];
|
|
417
|
-
if (widgets.length === 0) {
|
|
418
|
-
a.deleteSelection();
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const keys = /* @__PURE__ */ new Set();
|
|
422
|
-
for (const w of widgets) {
|
|
423
|
-
const objnum = w.ref.kind === "objectNumber" ? w.ref.annotObjectNumber : 0;
|
|
424
|
-
const field = objnum > 0 ? form.fieldForWidget(objnum) : null;
|
|
425
|
-
if (field) keys.add((0, _embedpdf_react_form.fieldKeyOf)(field));
|
|
426
|
-
}
|
|
427
|
-
for (const key of keys) form.deleteField(key);
|
|
428
|
-
for (const d of dtos) if (d.subtype !== "widget") a.delete(d.ref);
|
|
429
|
-
a.deselect();
|
|
430
|
-
},
|
|
431
|
-
visible: hasAnnotationSelection,
|
|
432
|
-
enabled: (c) => {
|
|
433
|
-
const a = anno(c);
|
|
434
|
-
const refs = a?.getSelection() ?? [];
|
|
435
|
-
return refs.length > 0 && refs.every((r) => a.canDelete(r));
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
id: "annotation:comment",
|
|
440
|
-
labelKey: "commands.comment",
|
|
441
|
-
icon: "comment",
|
|
442
|
-
categories: ["annotation"],
|
|
443
|
-
panel: {
|
|
444
|
-
id: "comment",
|
|
445
|
-
exclusive: "right"
|
|
446
|
-
},
|
|
447
|
-
visible: (c) => hasAnnotationSelection(c) && !selectionSubtypes(c).has("widget")
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
id: "annotation:style",
|
|
451
|
-
labelKey: "commands.style",
|
|
452
|
-
icon: "palette",
|
|
453
|
-
categories: ["annotation"],
|
|
454
|
-
panel: {
|
|
455
|
-
id: "annotation-style",
|
|
456
|
-
exclusive: "right"
|
|
457
|
-
},
|
|
458
|
-
visible: (c) => (anno(c)?.getSelectionProps().specs.length ?? 0) > 0
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
id: "annotation:stamp-from-selection",
|
|
462
|
-
labelKey: "commands.annotate.stampFromSelection",
|
|
463
|
-
icon: "rubberStampPlus",
|
|
464
|
-
categories: ["annotation"],
|
|
465
|
-
run: (c) => {
|
|
466
|
-
const a = anno(c);
|
|
467
|
-
const stamp = c.tryGet(_embedpdf_react_stamp.StampToken);
|
|
468
|
-
const documentId = c.documentId;
|
|
469
|
-
if (!a || !stamp || documentId == null) return;
|
|
470
|
-
const dtos = a.getSelected();
|
|
471
|
-
const pon = dtos[0]?.ref.pageObjectNumber;
|
|
472
|
-
if (pon === void 0) return;
|
|
473
|
-
const i18n = c.tryGet(_embedpdf_react_i18n.I18nToken);
|
|
474
|
-
const label = i18n?.t("demo.stampsCustomLabel") ?? "Custom stamp";
|
|
475
|
-
const libraryName = i18n?.t("demo.stampsCustomLibrary") ?? "My stamps";
|
|
476
|
-
const libraryId = CUSTOM_LIBRARY_ID;
|
|
477
|
-
(stamp.library(libraryId) ? Promise.resolve(libraryId) : stamp.createLibrary(libraryName, {
|
|
478
|
-
id: libraryId,
|
|
479
|
-
categories: ["custom"]
|
|
480
|
-
})).then((id) => stamp.addAssetFromAnnotations(documentId, pon, dtos.map((d) => d.ref), {
|
|
481
|
-
libraryId: id,
|
|
482
|
-
label: `${label} ${stamp.assets(id).length + 1}`
|
|
483
|
-
})).then(() => c.tryGet(_embedpdf_react_shell.ShellToken)?.open("stamps", {
|
|
484
|
-
exclusive: "right",
|
|
485
|
-
props: { libraryId }
|
|
486
|
-
})).catch((e) => console.warn("[embedpdf] stamp from selection failed", e));
|
|
487
|
-
},
|
|
488
|
-
visible: (c) => c.tryGet(_embedpdf_react_stamp.StampToken) != null && hasAnnotationSelection(c) && !selectionSubtypes(c).has("widget") && !selectionSubtypes(c).has("redact") && new Set((anno(c)?.getSelected() ?? []).map((d) => d.ref.pageObjectNumber)).size === 1,
|
|
489
|
-
enabled: (c) => c.tryGet(_embedpdf_react_runtime.DocumentsToken)?.allows("doc.download") ?? true
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
id: "annotation:group",
|
|
493
|
-
labelKey: "commands.annotate.group",
|
|
494
|
-
icon: "group",
|
|
495
|
-
categories: ["annotation"],
|
|
496
|
-
run: (c) => void anno(c)?.group(),
|
|
497
|
-
visible: (c) => anno(c)?.canGroup() ?? false
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
id: "annotation:ungroup",
|
|
501
|
-
labelKey: "commands.annotate.ungroup",
|
|
502
|
-
icon: "ungroup",
|
|
503
|
-
categories: ["annotation"],
|
|
504
|
-
run: (c) => void anno(c)?.ungroup(),
|
|
505
|
-
visible: (c) => anno(c)?.canUngroup() ?? false
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
id: "selection:copy",
|
|
509
|
-
labelKey: "commands.selection.copy",
|
|
510
|
-
icon: "copy",
|
|
511
|
-
categories: ["selection"],
|
|
512
|
-
visible: (c) => {
|
|
513
|
-
const s = textSelection(c);
|
|
514
|
-
return !!s && s.hasSelection() && s.canCopy();
|
|
515
|
-
},
|
|
516
|
-
run: (c) => {
|
|
517
|
-
const s = textSelection(c);
|
|
518
|
-
if (!s) return;
|
|
519
|
-
const copiedRange = s.snapshot().range;
|
|
520
|
-
(0, _embedpdf_react_selection.copySelection)(s).then((text) => {
|
|
521
|
-
if (text !== "" && sameTextRange(s.snapshot().range, copiedRange)) s.clear();
|
|
522
|
-
}, () => {});
|
|
523
|
-
}
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
id: "annotation:link",
|
|
527
|
-
labelKey: "commands.annotate.link",
|
|
528
|
-
icon: "link",
|
|
529
|
-
categories: ["annotation"],
|
|
530
|
-
run: (c) => c.tryGet(_embedpdf_react_shell.ShellToken)?.toggle("link-editor"),
|
|
531
|
-
active: (c) => c.tryGet(_embedpdf_react_shell.ShellToken)?.isOpen("link-editor") ?? false,
|
|
532
|
-
visible: (c) => selectionLink(c) === null
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
id: "annotation:goto-link",
|
|
536
|
-
labelKey: "commands.annotate.gotoLink",
|
|
537
|
-
icon: "externalLink",
|
|
538
|
-
categories: ["annotation"],
|
|
539
|
-
run: (c) => {
|
|
540
|
-
const target = selectionLink(c);
|
|
541
|
-
const link = c.tryGet(_embedpdf_react_link.LinkToken);
|
|
542
|
-
if (target && link) (0, _embedpdf_react_link.openLinkTarget)(link, target);
|
|
543
|
-
},
|
|
544
|
-
visible: (c) => selectionLink(c) != null
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
id: "annotation:remove-link",
|
|
548
|
-
labelKey: "commands.annotate.removeLink",
|
|
549
|
-
icon: "linkOff",
|
|
550
|
-
categories: ["annotation"],
|
|
551
|
-
run: (c) => anno(c)?.updateSelection({ link: null }),
|
|
552
|
-
visible: (c) => selectionLink(c) != null
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
id: "history:undo",
|
|
556
|
-
labelKey: "commands.undo",
|
|
557
|
-
icon: "arrowBackUp",
|
|
558
|
-
categories: ["history"],
|
|
559
|
-
run: () => {},
|
|
560
|
-
enabled: () => false
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
id: "history:redo",
|
|
564
|
-
labelKey: "commands.redo",
|
|
565
|
-
icon: "arrowForwardUp",
|
|
566
|
-
categories: ["history"],
|
|
567
|
-
run: () => {},
|
|
568
|
-
enabled: () => false
|
|
569
|
-
}
|
|
570
|
-
];
|
|
571
|
-
const MODE_SURFACES = [
|
|
572
|
-
"mode:annotate",
|
|
573
|
-
"mode:shapes",
|
|
574
|
-
"mode:insert",
|
|
575
|
-
"mode:form",
|
|
576
|
-
"mode:redact"
|
|
577
|
-
];
|
|
578
|
-
function modeCommand(id, labelKey, toolId = "pointer") {
|
|
579
|
-
return {
|
|
580
|
-
id,
|
|
581
|
-
labelKey,
|
|
582
|
-
categories: ["mode"],
|
|
583
|
-
run: (c) => {
|
|
584
|
-
const shell = c.tryGet(_embedpdf_react_shell.ShellToken);
|
|
585
|
-
shell?.toggle(id, { exclusive: "mode" });
|
|
586
|
-
interaction(c)?.activateTool(shell?.isOpen(id) ? toolId : "pointer");
|
|
587
|
-
},
|
|
588
|
-
active: (c) => c.tryGet(_embedpdf_react_shell.ShellToken)?.isOpen(id) ?? false
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
//#endregion
|
|
592
|
-
exports.MODE_SURFACES = MODE_SURFACES;
|
|
593
|
-
exports.TOOL_ICONS = TOOL_ICONS;
|
|
594
|
-
exports.defaultCommands = defaultCommands;
|
|
595
|
-
|
|
596
|
-
//# sourceMappingURL=commands.cjs.map
|
|
2
|
+
const require_commands = require("./commands-CYt4SFUX.cjs");
|
|
3
|
+
exports.FORM_DESIGN_PANEL = require_commands.FORM_DESIGN_PANEL;
|
|
4
|
+
exports.FORM_DESIGN_TOOL = require_commands.FORM_DESIGN_TOOL;
|
|
5
|
+
exports.GO_TO_PAGE_DIALOG = require_commands.GO_TO_PAGE_DIALOG;
|
|
6
|
+
exports.MODE_SURFACES = require_commands.MODE_SURFACES;
|
|
7
|
+
exports.REDACT_CONFIRM_DIALOG = require_commands.REDACT_CONFIRM_DIALOG;
|
|
8
|
+
exports.SHORTCUTS_DIALOG = require_commands.SHORTCUTS_DIALOG;
|
|
9
|
+
exports.TOOL_ICONS = require_commands.TOOL_ICONS;
|
|
10
|
+
exports.defaultCommands = require_commands.defaultCommands;
|
|
11
|
+
exports.isDesigningForm = require_commands.isDesigningForm;
|
|
12
|
+
exports.isFormDesignTool = require_commands.isFormDesignTool;
|
|
13
|
+
exports.toolCommandsFor = require_commands.toolCommandsFor;
|
package/dist/commands.d.cts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
+
import { AnnotationToolInput } from "@embedpdf/react/annotation";
|
|
1
2
|
import { CommandDef } from "@embedpdf/react/commands";
|
|
2
3
|
//#region src/config/commands.d.ts
|
|
4
|
+
type Ctx = Parameters<NonNullable<CommandDef['run']>>[0];
|
|
5
|
+
/** The dialog the Go to Page command opens without a page to go to (ui/go-to-page.tsx). */
|
|
6
|
+
declare const GO_TO_PAGE_DIALOG = "go-to-page";
|
|
7
|
+
/** The keyboard shortcuts sheet, which `?` opens (ui/shortcuts-sheet.tsx). */
|
|
8
|
+
declare const SHORTCUTS_DIALOG = "shortcuts";
|
|
9
|
+
/** The confirmation before marked areas are removed for good (ui/redact-confirm.tsx). */
|
|
10
|
+
declare const REDACT_CONFIRM_DIALOG = "redact-confirm";
|
|
11
|
+
/** The form designer's sidebar (ui/form-design-panel.tsx), which `form:design` opens. */
|
|
12
|
+
declare const FORM_DESIGN_PANEL = "form-design";
|
|
13
|
+
/** Form design's resting tool, the form plugin's: widgets select, move and resize there. */
|
|
14
|
+
declare const FORM_DESIGN_TOOL = "form-edit";
|
|
15
|
+
/**
|
|
16
|
+
* Whether a tool designs a form: design's resting tool, or a field tool. Neither fills, so the
|
|
17
|
+
* form lends its widgets to be selected, moved and resized.
|
|
18
|
+
*/
|
|
19
|
+
declare const isFormDesignTool: (tool: string | null | undefined) => boolean;
|
|
20
|
+
/** Whether a form is being designed: the active tool designs it. */
|
|
21
|
+
declare const isDesigningForm: (commandContext: Pick<Ctx, "tryGet">) => boolean;
|
|
3
22
|
type ColorKey = 'color' | 'interiorColor' | 'fontColor';
|
|
4
23
|
interface ToolAccentDefinition {
|
|
5
24
|
primary: ColorKey;
|
|
6
25
|
secondary?: ColorKey;
|
|
7
26
|
}
|
|
8
27
|
/**
|
|
9
|
-
* toolId → the
|
|
10
|
-
* as a side effect of the `tool()` command definitions below —
|
|
28
|
+
* toolId → the same icon + accent definition its toolbar button uses, recorded
|
|
29
|
+
* as a side effect of the `tool()` command definitions below — one source of
|
|
11
30
|
* truth, so the tool cursor (ui/tool-cursor.tsx) and the button can never
|
|
12
31
|
* drift apart.
|
|
13
32
|
*/
|
|
@@ -16,7 +35,13 @@ declare const TOOL_ICONS: Record<string, {
|
|
|
16
35
|
accent?: ToolAccentDefinition;
|
|
17
36
|
}>;
|
|
18
37
|
declare const defaultCommands: CommandDef[];
|
|
19
|
-
declare const MODE_SURFACES: readonly ["mode:annotate", "mode:shapes", "mode:insert", "mode:form", "mode:redact"];
|
|
38
|
+
declare const MODE_SURFACES: readonly ["mode:annotate", "mode:shapes", "mode:insert", "mode:form", "mode:redact", "mode:measure"];
|
|
39
|
+
/**
|
|
40
|
+
* A `tool:<id>` command for each tool of yours (`plugins.annotation.tools`) that no command has
|
|
41
|
+
* (`isTaken` says which ids do): labelled by its `meta.label`, else its id; drawn with its
|
|
42
|
+
* `meta.icon`, else the icon of the tool it extends; in that tool's feature, else `annotations`.
|
|
43
|
+
*/
|
|
44
|
+
declare function toolCommandsFor(tools: readonly AnnotationToolInput[], isTaken: (id: string) => boolean): CommandDef[];
|
|
20
45
|
//#endregion
|
|
21
|
-
export { MODE_SURFACES, TOOL_ICONS, ToolAccentDefinition, defaultCommands };
|
|
46
|
+
export { FORM_DESIGN_PANEL, FORM_DESIGN_TOOL, GO_TO_PAGE_DIALOG, MODE_SURFACES, REDACT_CONFIRM_DIALOG, SHORTCUTS_DIALOG, TOOL_ICONS, ToolAccentDefinition, defaultCommands, isDesigningForm, isFormDesignTool, toolCommandsFor };
|
|
22
47
|
//# sourceMappingURL=commands.d.cts.map
|