@inkbar/core 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -2
- package/dist/dom.d.mts +600 -5
- package/dist/dom.d.mts.map +1 -1
- package/dist/dom.mjs +4423 -1581
- package/dist/dom.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{sign-FuwcsNkA.d.mts → sign-BTbtPHbM.d.mts} +50 -6
- package/dist/sign-BTbtPHbM.d.mts.map +1 -0
- package/dist/{sign-DIhqyOV6.mjs → sign-DZVDJhqT.mjs} +57 -5
- package/dist/sign-DZVDJhqT.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/sign-DIhqyOV6.mjs.map +0 -1
- package/dist/sign-FuwcsNkA.d.mts.map +0 -1
package/dist/dom.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DocumentSource, Bn as
|
|
1
|
+
import { A as DocumentSource, Bn as Matrix, Cn as FormAction, D as InkStatus, E as InkDocument, Gt as LineEnding, Hn as Quad, L as FormController, Ln as PageInfo, Mn as Readable, Nt as FreeTextAnnotation, O as OpenOptions, Ot as AnnotationType, P as isBlankQuery, Qt as NoteAnnotation, Sn as FieldsMode, Un as Rect, Vn as Point, X as AnnotationEdit, Z as AnnotationStore, _ as ScopedToolStyle, _t as AnnotationDefaults, a as SignatureOptions, b as StyleProps, h as CurrentStyle, hn as TextMarkupAnnotation, i as SignatureLibrary, it as RecordStore, j as SearchHit, nt as RecordBase, o as SignatureStore, q as PluginHistory, rt as RecordChange, s as SignatureTemplate, t as signField, v as StyleGroup, vt as cssVariableDefaults, wt as AnnotationInput, x as ToolStyle, xt as Annotation, y as StyleKey, z as InkError, zn as PdfAssets } from "./sign-BTbtPHbM.mjs";
|
|
2
2
|
import { IconNode } from "@inkbar/icons";
|
|
3
3
|
//#region src/dom/transform.d.ts
|
|
4
4
|
type ViewRotation = 0 | 90 | 180 | 270;
|
|
@@ -108,6 +108,11 @@ interface ViewportOptions {
|
|
|
108
108
|
minZoom?: number;
|
|
109
109
|
/** Default 8. */
|
|
110
110
|
maxZoom?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Zoom the document when two fingers pinch over the container. Default `true`. When false the
|
|
113
|
+
* viewport leaves `touch-action` alone and the browser zooms the page as it would anyway.
|
|
114
|
+
*/
|
|
115
|
+
pinchZoom?: boolean;
|
|
111
116
|
onMount(page: number, host: HTMLElement, transform: PageTransform): void;
|
|
112
117
|
onUpdate(page: number, host: HTMLElement, transform: PageTransform): void;
|
|
113
118
|
onUnmount(page: number, host: HTMLElement): void;
|
|
@@ -162,6 +167,124 @@ interface ViewportKeysOptions {
|
|
|
162
167
|
*/
|
|
163
168
|
export declare function attachViewportKeys(el: HTMLElement, opts: ViewportKeysOptions): () => void;
|
|
164
169
|
//#endregion
|
|
170
|
+
//#region src/dom/pinch.d.ts
|
|
171
|
+
interface PinchFrame {
|
|
172
|
+
/** The zoom the pinch has reached, clamped to the viewport's limits. */
|
|
173
|
+
zoom: number;
|
|
174
|
+
/** `zoom` over the zoom the pinch started at. */
|
|
175
|
+
factor: number;
|
|
176
|
+
/** The midpoint between the fingers when the pinch started. */
|
|
177
|
+
anchor: Point;
|
|
178
|
+
/** How far that midpoint has moved since. */
|
|
179
|
+
pan: Point;
|
|
180
|
+
}
|
|
181
|
+
export declare function pinchFrame(start: readonly [Point, Point], now: readonly [Point, Point], startScale: number, minZoom: number, maxZoom: number): PinchFrame;
|
|
182
|
+
interface ZoomPreview {
|
|
183
|
+
/** Scales the pages by `factor` around `anchor`, then moves them by `pan`. */
|
|
184
|
+
show(factor: number, anchor: Point, pan: Point): void;
|
|
185
|
+
clear(): void;
|
|
186
|
+
/** Shifts the pages by `offset`, then eases them back to where the layout puts them. */
|
|
187
|
+
settle(offset: Point): void;
|
|
188
|
+
destroy(): void;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The pinch preview: a transform on the pages element, which the browser composites without
|
|
192
|
+
* laying anything out. `settle` covers what a preview can show but the committed layout
|
|
193
|
+
* cannot reach (mainly scroll clamped at the content edges): the pages start where the fingers
|
|
194
|
+
* left them and slide into place.
|
|
195
|
+
*/
|
|
196
|
+
export declare function createZoomPreview(container: HTMLElement, pagesEl: HTMLElement): ZoomPreview;
|
|
197
|
+
interface TouchPinchOptions {
|
|
198
|
+
container: HTMLElement;
|
|
199
|
+
preview: ZoomPreview;
|
|
200
|
+
/** The effective zoom when a pinch starts. */
|
|
201
|
+
scale(): number;
|
|
202
|
+
minZoom: number;
|
|
203
|
+
maxZoom: number;
|
|
204
|
+
/**
|
|
205
|
+
* Scrolls the container so the content moves by `delta`, and returns how much of it the
|
|
206
|
+
* scroll took: less than `delta` where the scroll stops at the content edges.
|
|
207
|
+
*/
|
|
208
|
+
scrollBy(delta: Point): Point;
|
|
209
|
+
/**
|
|
210
|
+
* Called once per pinch, when either finger lifts or is cancelled, after the preview clears.
|
|
211
|
+
* The frame's `anchor` is where the point that started between the fingers sits now, after
|
|
212
|
+
* the scrolling, and its `pan` is only the travel the scroll could not take.
|
|
213
|
+
*/
|
|
214
|
+
commit(frame: PinchFrame): void;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Tracks touches on the container with touch events, which every touch browser sends as one
|
|
218
|
+
* stream (pointer events may be cancelled once the browser decides to pan). The first two
|
|
219
|
+
* fingers down start a pinch; a third is ignored. The pinch ends when either of its fingers
|
|
220
|
+
* lifts or is cancelled, and any finger still down then starts nothing until every finger has
|
|
221
|
+
* lifted. While two fingers are down their moves are prevented, so the browser neither pans
|
|
222
|
+
* nor zooms underneath; one finger's moves never are, so a one-finger scroll stays native. A
|
|
223
|
+
* move the browser will not let us cancel means it is scrolling natively already: that travel
|
|
224
|
+
* is left to it, and only what the fingers do after it is scrolled here.
|
|
225
|
+
* The viewport claims pinch on the container (`touch-action: pan-x pan-y`), which keeps the
|
|
226
|
+
* page from zooming as well; the tool controller turns off one-finger panning on the pages
|
|
227
|
+
* element while a drag tool is ready, and two fingers still land here. A finger
|
|
228
|
+
* that lands alone starts afresh, so an end the browser never sent leaves nothing behind.
|
|
229
|
+
*/
|
|
230
|
+
export declare function attachTouchPinch(opts: TouchPinchOptions): {
|
|
231
|
+
destroy(): void;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* The zoom factor one wheel event stands for. A trackpad pinch arrives as ctrl+wheel events
|
|
235
|
+
* with small pixel deltas, which zoom smoothly. A mouse wheel notch with ctrl held arrives in
|
|
236
|
+
* line or page mode, or as one large pixel delta, and is one small step, whatever its size.
|
|
237
|
+
*/
|
|
238
|
+
export declare function wheelFactor(e: {
|
|
239
|
+
deltaY: number;
|
|
240
|
+
deltaMode: number;
|
|
241
|
+
}): number;
|
|
242
|
+
interface TrackpadPinchOptions {
|
|
243
|
+
container: HTMLElement;
|
|
244
|
+
preview: ZoomPreview;
|
|
245
|
+
/** The effective zoom when a pinch starts. */
|
|
246
|
+
scale(): number;
|
|
247
|
+
minZoom: number;
|
|
248
|
+
maxZoom: number;
|
|
249
|
+
/** Called once per pinch, after the preview clears. */
|
|
250
|
+
commit(frame: PinchFrame): void;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* A trackpad pinch over the container. Browsers report it as ctrl+wheel events, which are
|
|
254
|
+
* taken over so the page does not zoom; a run of them is one pinch, anchored at the pointer
|
|
255
|
+
* where it began and committed once the events stop, or as soon as the container scrolls (a
|
|
256
|
+
* plain wheel, a scroll bar), so the scroll moves the committed layout and not the preview.
|
|
257
|
+
* Safari also has gesture events, which give the scale directly; while one of those runs,
|
|
258
|
+
* ctrl+wheel is ignored so nothing counts twice. Safari on a touch screen sends gesture events
|
|
259
|
+
* for a touch pinch too, which `attachTouchPinch` already handles: while a finger is down on
|
|
260
|
+
* the container they are prevented and otherwise ignored. The wheel listener is non-passive
|
|
261
|
+
* because it has to call `preventDefault`.
|
|
262
|
+
*/
|
|
263
|
+
export declare function attachTrackpadPinch(opts: TrackpadPinchOptions): {
|
|
264
|
+
destroy(): void;
|
|
265
|
+
};
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/dom/file-actions.d.ts
|
|
268
|
+
interface DownloadOptions {
|
|
269
|
+
/** The name to save under. Default: the document's `fileName`. */
|
|
270
|
+
filename?: string;
|
|
271
|
+
}
|
|
272
|
+
/** Saves the document's file through the browser's download. */
|
|
273
|
+
export declare function downloadDocument(doc: InkDocument, opts?: DownloadOptions): Promise<void>;
|
|
274
|
+
/**
|
|
275
|
+
* Prints the document's file: it loads into a hidden frame and the browser's own PDF viewer
|
|
276
|
+
* prints it, so text stays sharp. Where a frame cannot print (iOS), the PDF opens in a new tab.
|
|
277
|
+
* Resolves once the print dialog has been asked for.
|
|
278
|
+
*/
|
|
279
|
+
export declare function printDocument(doc: InkDocument): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* Ctrl or Cmd+P prints and Ctrl or Cmd+S downloads, for keys pressed anywhere inside `el`,
|
|
282
|
+
* while `doc()` gives a ready document. Then the key is taken from the browser, which would
|
|
283
|
+
* print or save the web page; otherwise it is left alone. Returns a function that removes the
|
|
284
|
+
* listener.
|
|
285
|
+
*/
|
|
286
|
+
export declare function attachFileKeys(el: HTMLElement, doc: () => InkDocument | null | undefined): () => void;
|
|
287
|
+
//#endregion
|
|
165
288
|
//#region src/dom/history-keys.d.ts
|
|
166
289
|
/** A flag as a plain value, or as a readable such as core's `History.canUndo`. */
|
|
167
290
|
type Flag = boolean | {
|
|
@@ -385,6 +508,8 @@ interface AnnotationLink<T extends RecordBase> {
|
|
|
385
508
|
//#endregion
|
|
386
509
|
//#region src/dom/plugins/api/records.d.ts
|
|
387
510
|
interface Records<T extends RecordBase> {
|
|
511
|
+
/** The store's key, `<plugin>.<name>`. */
|
|
512
|
+
readonly key: string;
|
|
388
513
|
/** The open document's records; `[]` while none is open. Emits when the document changes. */
|
|
389
514
|
readonly list: Readable<readonly T[]>;
|
|
390
515
|
all(): readonly T[];
|
|
@@ -432,6 +557,12 @@ interface CardSpec {
|
|
|
432
557
|
swatch?: string;
|
|
433
558
|
/** Text under the meta line (`.ink-card-body`). */
|
|
434
559
|
body?: string;
|
|
560
|
+
/** A line of context with the match marked, after `body` (`.ink-card-excerpt`). */
|
|
561
|
+
excerpt?: {
|
|
562
|
+
before: string;
|
|
563
|
+
match: string;
|
|
564
|
+
after: string;
|
|
565
|
+
};
|
|
435
566
|
/**
|
|
436
567
|
* One button per key, in order (`.ink-card-actions`). The first takes focus on open and is
|
|
437
568
|
* styled as the primary action. Each action runs synchronously in one undo step: writes after
|
|
@@ -463,9 +594,9 @@ interface MarksOptions<T extends RecordBase & {
|
|
|
463
594
|
/** Classes every mark gets. */
|
|
464
595
|
className?: string;
|
|
465
596
|
/**
|
|
466
|
-
* More attributes (`data-*`, `aria-*`). `data-record`, `data-plugin
|
|
467
|
-
* core's, and so do `aria-haspopup` and `aria-expanded` on a mark with a
|
|
468
|
-
* `class` and `type` are skipped (use `style` and `className`).
|
|
597
|
+
* More attributes (`data-*`, `aria-*`). `data-record`, `data-plugin`, `data-selected` and
|
|
598
|
+
* `aria-label` stay core's, and so do `aria-haspopup` and `aria-expanded` on a mark with a
|
|
599
|
+
* card; `style`, `class` and `type` are skipped (use `style` and `className`).
|
|
469
600
|
*/
|
|
470
601
|
attrs?(record: T): Record<string, string>;
|
|
471
602
|
/**
|
|
@@ -541,6 +672,8 @@ interface ViewerSearch {
|
|
|
541
672
|
setMatchCase(on: boolean): void;
|
|
542
673
|
next(): void;
|
|
543
674
|
previous(): void;
|
|
675
|
+
/** Makes hit `index` current and scrolls to it as `next()` does. Out of range or non-integer does nothing. */
|
|
676
|
+
select(index: number): void;
|
|
544
677
|
/** Hides the bar and clears the hits; the query and match case are kept. */
|
|
545
678
|
close(): void;
|
|
546
679
|
}
|
|
@@ -579,6 +712,17 @@ interface ToolOptions {
|
|
|
579
712
|
}
|
|
580
713
|
export declare function createToolOptions(tools?: readonly Tool[]): ToolOptions;
|
|
581
714
|
//#endregion
|
|
715
|
+
//#region src/dom/tools/press.d.ts
|
|
716
|
+
type PressKind = 'press' | 'long-press';
|
|
717
|
+
/** A press on a page that nothing in Inkbar acted on. */
|
|
718
|
+
interface PagePress {
|
|
719
|
+
/** Zero-based page index. */
|
|
720
|
+
page: number;
|
|
721
|
+
/** PDF user space on that page, points, origin bottom-left, before /Rotate. */
|
|
722
|
+
point: Point;
|
|
723
|
+
pointerType: 'mouse' | 'touch' | 'pen';
|
|
724
|
+
}
|
|
725
|
+
//#endregion
|
|
582
726
|
//#region src/dom/tools/controller.d.ts
|
|
583
727
|
/** The tools every viewer has. Creation tools are the host's to pass. */
|
|
584
728
|
type CoreToolId = 'select-text' | 'select';
|
|
@@ -634,6 +778,12 @@ interface Tool<O extends object = object> {
|
|
|
634
778
|
/** Default sticky. */
|
|
635
779
|
kind?: ToolKind;
|
|
636
780
|
cursor: string;
|
|
781
|
+
/**
|
|
782
|
+
* When true, one finger drags with the tool over the document instead of scrolling it,
|
|
783
|
+
* while the tool is active (and, for a one-shot tool, until it has made something). Two
|
|
784
|
+
* fingers still scroll and zoom.
|
|
785
|
+
*/
|
|
786
|
+
claimsTouch?: boolean;
|
|
637
787
|
/** Style group the tool creates into; select tools have none. */
|
|
638
788
|
styleGroup?: StyleGroup;
|
|
639
789
|
/** Option defaults. Options persist per tool for the viewer's life. */
|
|
@@ -684,6 +834,11 @@ interface ToolControllerOptions {
|
|
|
684
834
|
* rebuild) so options persist; by default the controller keeps its own.
|
|
685
835
|
*/
|
|
686
836
|
options?: ToolOptions;
|
|
837
|
+
/**
|
|
838
|
+
* A press or long press on a page that nothing in Inkbar acted on (see the top of
|
|
839
|
+
* controller.ts for which presses count).
|
|
840
|
+
*/
|
|
841
|
+
onPress?(kind: PressKind, press: PagePress): void;
|
|
687
842
|
}
|
|
688
843
|
/** The mounted page under a client point, with the point in CSS px and user space. */
|
|
689
844
|
export declare function hitFor(ctx: ToolContext, e: {
|
|
@@ -802,6 +957,16 @@ interface PluginContext {
|
|
|
802
957
|
* hits) when the host has no search.
|
|
803
958
|
*/
|
|
804
959
|
readonly search: ViewerSearch;
|
|
960
|
+
/**
|
|
961
|
+
* A press on a page that nothing in Inkbar acted on. Returns a function that stops listening.
|
|
962
|
+
* Fires only under the text and rectangle select tools.
|
|
963
|
+
*/
|
|
964
|
+
onPress(fn: (press: PagePress) => void): () => void;
|
|
965
|
+
/**
|
|
966
|
+
* A touch or pen held still on a page that nothing in Inkbar acted on. Returns a function that
|
|
967
|
+
* stops listening. Fires only under the text and rectangle select tools.
|
|
968
|
+
*/
|
|
969
|
+
onLongPress(fn: (press: PagePress) => void): () => void;
|
|
805
970
|
}
|
|
806
971
|
/** A factory's parameters: its options, optional only when `O` has no required field. */
|
|
807
972
|
type PluginFactoryArgs<O> = {} extends O ? [options?: O & PluginOptions] : [options: O & PluginOptions];
|
|
@@ -876,6 +1041,47 @@ interface PluginLayers {
|
|
|
876
1041
|
*/
|
|
877
1042
|
export declare function createPluginLayers(source: LayerSource): PluginLayers;
|
|
878
1043
|
//#endregion
|
|
1044
|
+
//#region src/dom/plugins/registry.d.ts
|
|
1045
|
+
/** What one `plugin.marks` call drew its records with. */
|
|
1046
|
+
interface MarksRegistration<T extends RecordBase & {
|
|
1047
|
+
page: number;
|
|
1048
|
+
} = any> {
|
|
1049
|
+
/** The id of the plugin that called `marks`. */
|
|
1050
|
+
plugin: string;
|
|
1051
|
+
/** Whether `record` gets a mark from this call. */
|
|
1052
|
+
where(record: T): boolean;
|
|
1053
|
+
label(record: T): string;
|
|
1054
|
+
rect(record: T): Rect;
|
|
1055
|
+
card?(record: T): CardSpec;
|
|
1056
|
+
className?: string;
|
|
1057
|
+
style?: MarksOptions<T>['style'];
|
|
1058
|
+
/** The plugin's `history.batch`: everything `fn` changes is one undo step. */
|
|
1059
|
+
batch(fn: () => void): void;
|
|
1060
|
+
}
|
|
1061
|
+
interface MarksRegistry {
|
|
1062
|
+
/** Registers `reg` under `key`; returns a function that removes it. */
|
|
1063
|
+
add(key: string, reg: MarksRegistration): () => void;
|
|
1064
|
+
/** Registrations for `key`, in call order. */
|
|
1065
|
+
of(key: string): readonly MarksRegistration[];
|
|
1066
|
+
/** The first registration whose `where` passes, or undefined. */
|
|
1067
|
+
resolve<T extends RecordBase & {
|
|
1068
|
+
page: number;
|
|
1069
|
+
}>(key: string, record: T): MarksRegistration<T> | undefined;
|
|
1070
|
+
/** Keys that have registrations. */
|
|
1071
|
+
keys(): readonly string[];
|
|
1072
|
+
/** Calls `listener` after every add and remove; returns a stop function. */
|
|
1073
|
+
watch(listener: () => void): () => void;
|
|
1074
|
+
}
|
|
1075
|
+
interface RecordSelection {
|
|
1076
|
+
/** The selected record's id, or null. */
|
|
1077
|
+
readonly selected: Readable<string | null>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Selects the record with `id`, or clears with null. An id the open document's store lacks,
|
|
1080
|
+
* or whose record resolves to no registration, changes nothing.
|
|
1081
|
+
*/
|
|
1082
|
+
select(id: string | null): void;
|
|
1083
|
+
}
|
|
1084
|
+
//#endregion
|
|
879
1085
|
//#region src/dom/plugins/host.d.ts
|
|
880
1086
|
interface PluginHostOptions {
|
|
881
1087
|
plugins: readonly InkPlugin[];
|
|
@@ -892,7 +1098,31 @@ interface PluginHostOptions {
|
|
|
892
1098
|
/** The viewer's search; without one, `ctx.search` is inert. */
|
|
893
1099
|
search?: ViewerSearch;
|
|
894
1100
|
}
|
|
1101
|
+
/**
|
|
1102
|
+
* A plugin's records as the host app sees them: the plugin's own handle without `annotates`
|
|
1103
|
+
* (a plugin links its records to marks in `setup`), plus `batch` to make several writes one
|
|
1104
|
+
* undo step. `in(doc)` gives a host handle too.
|
|
1105
|
+
*/
|
|
1106
|
+
type HostRecords<T extends RecordBase> = Omit<Records<T>, 'annotates' | 'in'> & {
|
|
1107
|
+
/** The same handle bound to `doc`'s store, as `Records.in` binds it. */
|
|
1108
|
+
in(doc: InkDocument): HostRecords<T>;
|
|
1109
|
+
/** Makes everything `fn` changes one undo step. */
|
|
1110
|
+
batch(fn: () => void): void;
|
|
1111
|
+
};
|
|
895
1112
|
interface PluginHost extends LayerSource {
|
|
1113
|
+
/**
|
|
1114
|
+
* The records a plugin keeps under `key` (`<plugin>.<name>`), following the open document.
|
|
1115
|
+
* The same handle on each call. An unknown key gives an empty handle that ignores writes, and
|
|
1116
|
+
* logs a warning once.
|
|
1117
|
+
*/
|
|
1118
|
+
records<T extends RecordBase>(key: string): HostRecords<T>;
|
|
1119
|
+
/** What each `plugin.marks` call drew, by records key. */
|
|
1120
|
+
readonly marks: MarksRegistry;
|
|
1121
|
+
/**
|
|
1122
|
+
* The selected record under `key`, shared by the marks, every list and the host app. The
|
|
1123
|
+
* same object on each call.
|
|
1124
|
+
*/
|
|
1125
|
+
selection(key: string): RecordSelection;
|
|
896
1126
|
readonly commands: ReadonlyMap<string, Command>;
|
|
897
1127
|
command(id: string): Command | undefined;
|
|
898
1128
|
readonly tools: readonly Tool[];
|
|
@@ -902,6 +1132,14 @@ interface PluginHost extends LayerSource {
|
|
|
902
1132
|
readonly layers: readonly PluginLayer[];
|
|
903
1133
|
/** Calls `listener` on every `ctx.redecorate()`; returns a stop function. */
|
|
904
1134
|
watchRedecorate(listener: () => void): () => void;
|
|
1135
|
+
/**
|
|
1136
|
+
* Tells every `onPress` (or, for a long press, `onLongPress`) listener, in the order the
|
|
1137
|
+
* listeners were added, across plugins. A listener that throws is logged and the rest still
|
|
1138
|
+
* run.
|
|
1139
|
+
*
|
|
1140
|
+
* @internal For the viewer engine, which passes the tool controller's presses on.
|
|
1141
|
+
*/
|
|
1142
|
+
emitPress(kind: PressKind, press: PagePress): void;
|
|
905
1143
|
destroy(): void;
|
|
906
1144
|
}
|
|
907
1145
|
/**
|
|
@@ -1612,6 +1850,8 @@ interface MountViewerOptions {
|
|
|
1612
1850
|
rotation?: ViewRotation;
|
|
1613
1851
|
gap?: number;
|
|
1614
1852
|
buffer?: number;
|
|
1853
|
+
/** Zoom the document on a two-finger pinch. Default `true`; see `ViewportOptions.pinchZoom`. */
|
|
1854
|
+
pinchZoom?: boolean;
|
|
1615
1855
|
tool?: ToolId;
|
|
1616
1856
|
/**
|
|
1617
1857
|
* The creation tools (`allTools()`, or the ones the host imports); `select-text` and `select`
|
|
@@ -1747,6 +1987,7 @@ interface ViewerEngine {
|
|
|
1747
1987
|
rebuild(opts: {
|
|
1748
1988
|
gap?: number;
|
|
1749
1989
|
buffer?: number;
|
|
1990
|
+
pinchZoom?: boolean;
|
|
1750
1991
|
customAnnotations?: boolean;
|
|
1751
1992
|
}): void;
|
|
1752
1993
|
/**
|
|
@@ -1850,6 +2091,11 @@ interface Viewer {
|
|
|
1850
2091
|
* `open()` runs the search and draws the highlights even when no find bar is mounted.
|
|
1851
2092
|
*/
|
|
1852
2093
|
readonly search: ViewerSearch;
|
|
2094
|
+
/**
|
|
2095
|
+
* The records a plugin keeps under `key` (`<plugin>.<name>`), following the open document;
|
|
2096
|
+
* the same handle on each call. An unknown key gives an empty handle and logs a warning once.
|
|
2097
|
+
*/
|
|
2098
|
+
records<T extends RecordBase>(key: string): HostRecords<T>;
|
|
1853
2099
|
/**
|
|
1854
2100
|
* Opens another document in place; the previous one is destroyed. Latest call wins.
|
|
1855
2101
|
* `password` is used for this load only; without it, the constructor's `password` applies.
|
|
@@ -1857,6 +2103,18 @@ interface Viewer {
|
|
|
1857
2103
|
open(source: DocumentSource, opts?: {
|
|
1858
2104
|
password?: string;
|
|
1859
2105
|
}): void;
|
|
2106
|
+
/**
|
|
2107
|
+
* Saves the open document's file through the browser's download, under its `fileName` or
|
|
2108
|
+
* `opts.filename`. Today that is the file as it was opened, without this session's
|
|
2109
|
+
* annotations. Does nothing while no document is open.
|
|
2110
|
+
*/
|
|
2111
|
+
download(opts?: DownloadOptions): Promise<void>;
|
|
2112
|
+
/**
|
|
2113
|
+
* Prints the open document's file with the browser's own PDF viewer; on iOS the PDF opens
|
|
2114
|
+
* in a new tab instead. As with `download`, today that is the file as it was opened. Does
|
|
2115
|
+
* nothing while no document is open.
|
|
2116
|
+
*/
|
|
2117
|
+
print(): Promise<void>;
|
|
1860
2118
|
destroy(): void;
|
|
1861
2119
|
}
|
|
1862
2120
|
export declare function createViewer(el: HTMLElement, opts: CreateViewerOptions): Viewer;
|
|
@@ -1885,6 +2143,14 @@ export declare function pageSelectionText(root: HTMLElement): string;
|
|
|
1885
2143
|
* @internal Shared with the framework bindings.
|
|
1886
2144
|
*/
|
|
1887
2145
|
export declare function handleFindKey(e: KeyboardEvent, controller: SearchController, selection: () => string): boolean;
|
|
2146
|
+
/**
|
|
2147
|
+
* Enter in a search field other than the find bar's (the search results' own): steps to the
|
|
2148
|
+
* next match, Shift+Enter to the previous, as in the find bar. Returns whether it handled the
|
|
2149
|
+
* key; when it did, the default is prevented.
|
|
2150
|
+
*
|
|
2151
|
+
* @internal Shared with the framework bindings.
|
|
2152
|
+
*/
|
|
2153
|
+
export declare function handleResultsFieldKey(e: KeyboardEvent, search: Pick<ViewerSearch, 'next' | 'previous'>): boolean;
|
|
1888
2154
|
//#endregion
|
|
1889
2155
|
//#region src/dom/search/find-text.d.ts
|
|
1890
2156
|
/**
|
|
@@ -1905,6 +2171,325 @@ export declare function findCountText(s: SearchState): string;
|
|
|
1905
2171
|
*/
|
|
1906
2172
|
export declare function findAnnouncer(): (s: SearchState) => string;
|
|
1907
2173
|
//#endregion
|
|
2174
|
+
//#region src/dom/records/source.d.ts
|
|
2175
|
+
/** One thing a list shows: an id unique in the list, its 0-based page, and where on it. */
|
|
2176
|
+
interface ListItem {
|
|
2177
|
+
id: string;
|
|
2178
|
+
page: number;
|
|
2179
|
+
/** In user space. */
|
|
2180
|
+
rect?: Rect;
|
|
2181
|
+
}
|
|
2182
|
+
interface RecordListSource<I extends ListItem = ListItem> {
|
|
2183
|
+
/** What is listed, filtered and in order. */
|
|
2184
|
+
readonly items: Readable<readonly I[]>;
|
|
2185
|
+
/** The card `item` shows, or null for none. */
|
|
2186
|
+
card(item: I): CardSpec | null;
|
|
2187
|
+
/** The selected item's id, or null. */
|
|
2188
|
+
readonly selected: Readable<string | null>;
|
|
2189
|
+
select(id: string | null): void;
|
|
2190
|
+
/** Scrolls the viewport to the item; for records, to its mark's rect. */
|
|
2191
|
+
reveal(item: I): void;
|
|
2192
|
+
/** Runs an action as one undo step. */
|
|
2193
|
+
run(item: I, fn: () => void): void;
|
|
2194
|
+
/**
|
|
2195
|
+
* Whether the change to `items` being emitted came from undo or redo, or from another
|
|
2196
|
+
* document opening: a change nobody made from the list, which the list does not announce.
|
|
2197
|
+
*/
|
|
2198
|
+
readonly replaying: () => boolean;
|
|
2199
|
+
/**
|
|
2200
|
+
* Polite text to announce, in place of the list's own "N items". A source whose items change
|
|
2201
|
+
* as a scan runs announces once it settles.
|
|
2202
|
+
*/
|
|
2203
|
+
readonly announcement?: Readable<string>;
|
|
2204
|
+
}
|
|
2205
|
+
interface RecordsSourceOptions<T> {
|
|
2206
|
+
/** The card each record shows. Default: its mark's card, else its mark's label (or id) and no actions. */
|
|
2207
|
+
card?(record: T): CardSpec;
|
|
2208
|
+
/** Which records to list. Default: those that have a mark, or every record when no `marks` call covers them. */
|
|
2209
|
+
where?(record: T): boolean;
|
|
2210
|
+
/** The order. Default: page, then top to bottom and left to right by the mark's rect. */
|
|
2211
|
+
sort?(a: T, b: T): number;
|
|
2212
|
+
}
|
|
2213
|
+
interface RecordsSourceDeps {
|
|
2214
|
+
pluginHost: PluginHost;
|
|
2215
|
+
/** The viewport `reveal` scrolls; null while none is mounted. */
|
|
2216
|
+
viewport: Readable<Viewport | null>;
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* The records a plugin keeps under `key` (`<plugin>.<name>`), as its marks show them: each
|
|
2220
|
+
* record takes its card, label and rect from the first `marks` registration whose `where` it
|
|
2221
|
+
* passes, and its actions run in that plugin's undo step. Follows the open document. The
|
|
2222
|
+
* selection is the host's for `key`, shared with the marks and every other list.
|
|
2223
|
+
*/
|
|
2224
|
+
export declare function recordsSource<T extends RecordBase & {
|
|
2225
|
+
page: number;
|
|
2226
|
+
}>(deps: RecordsSourceDeps, key: string, opts?: RecordsSourceOptions<T>): RecordListSource<T>;
|
|
2227
|
+
export declare function searchSource(search: ViewerSearch): RecordListSource;
|
|
2228
|
+
//#endregion
|
|
2229
|
+
//#region src/dom/records/list.d.ts
|
|
2230
|
+
interface RecordListRow {
|
|
2231
|
+
item: ListItem;
|
|
2232
|
+
card: CardSpec | null;
|
|
2233
|
+
selected: boolean;
|
|
2234
|
+
}
|
|
2235
|
+
interface RecordListController {
|
|
2236
|
+
/** One per listed item, in order. */
|
|
2237
|
+
readonly rows: Readable<readonly RecordListRow[]>;
|
|
2238
|
+
readonly count: Readable<number>;
|
|
2239
|
+
/** Polite live-region text: "3 items" when a change made from the app adds or removes rows. */
|
|
2240
|
+
readonly announcement: Readable<string>;
|
|
2241
|
+
/**
|
|
2242
|
+
* Binds the element holding the rows: each row is an element with `data-ink-record` set to
|
|
2243
|
+
* its item's id. Handles clicks, arrow keys, Home and End, Enter and Escape inside it, keeps
|
|
2244
|
+
* one row as the Tab stop (it sets the rows' `tabindex`: don't render one), and scrolls the
|
|
2245
|
+
* selected row into view. `el` is where focus goes when the last row goes; it gets
|
|
2246
|
+
* `tabindex="-1"` unless it has one. Attaching another element unbinds the previous one.
|
|
2247
|
+
* Returns the unbind.
|
|
2248
|
+
*/
|
|
2249
|
+
attach(el: HTMLElement): () => void;
|
|
2250
|
+
/** Selects the item and scrolls the viewport to it; focus stays where it is. */
|
|
2251
|
+
choose(id: string): void;
|
|
2252
|
+
/** Runs the card action named `action` of item `id` as one undo step. */
|
|
2253
|
+
act(id: string, action: string): void;
|
|
2254
|
+
destroy(): void;
|
|
2255
|
+
}
|
|
2256
|
+
export declare function createRecordListController(source: RecordListSource): RecordListController;
|
|
2257
|
+
/**
|
|
2258
|
+
* The records a plugin keeps under `records` (`<plugin>.<name>`) as a list of cards, the same
|
|
2259
|
+
* cards its marks open, with their actions. Selecting a card selects the record's mark and
|
|
2260
|
+
* scrolls the viewer to it; activating a mark selects its card. Give it a height (it fills its
|
|
2261
|
+
* parent's) and place it anywhere, a sidebar panel for instance. It stops when the viewer is
|
|
2262
|
+
* destroyed.
|
|
2263
|
+
*/
|
|
2264
|
+
export declare function createRecordList(viewer: Viewer, opts: {
|
|
2265
|
+
records: string;
|
|
2266
|
+
} & RecordsSourceOptions<any>): HTMLElement;
|
|
2267
|
+
//#endregion
|
|
2268
|
+
//#region src/dom/records/search-results.d.ts
|
|
2269
|
+
interface SearchResultsOptions {
|
|
2270
|
+
/** Show a query field above the results. Default true; turn it off when a find bar is on the page. */
|
|
2271
|
+
field?: boolean;
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* One card per search hit: its page, its place on that page and the text around it. Choosing
|
|
2275
|
+
* a card makes its hit current, as the find bar's next and previous do, and the find bar's
|
|
2276
|
+
* current hit is the selected card. The count shows the scan's progress and "No results". It stops when the
|
|
2277
|
+
* viewer is destroyed.
|
|
2278
|
+
*/
|
|
2279
|
+
export declare function createSearchResults(viewer: Viewer, opts?: SearchResultsOptions): HTMLElement;
|
|
2280
|
+
//#endregion
|
|
2281
|
+
//#region src/dom/sidebar/controller.d.ts
|
|
2282
|
+
type SidebarLayout = 'rail' | 'tabs' | 'stack';
|
|
2283
|
+
type SidebarSide = 'left' | 'right';
|
|
2284
|
+
interface SidebarPanelInfo {
|
|
2285
|
+
id: string;
|
|
2286
|
+
label: string;
|
|
2287
|
+
icon?: IconNode;
|
|
2288
|
+
/** Hidden when empty or 0. */
|
|
2289
|
+
badge?: string | number;
|
|
2290
|
+
}
|
|
2291
|
+
/** rail/tabs: the open id or null; stack: the expanded ids. */
|
|
2292
|
+
type SidebarOpen = string | null | readonly string[];
|
|
2293
|
+
interface SidebarControllerOptions {
|
|
2294
|
+
/** Default `'rail'`. */
|
|
2295
|
+
layout?: SidebarLayout;
|
|
2296
|
+
/** Default `'left'`. */
|
|
2297
|
+
side?: SidebarSide;
|
|
2298
|
+
panels: readonly SidebarPanelInfo[];
|
|
2299
|
+
/** Controlled when given: `toggle` only reports through `onOpenChange`. */
|
|
2300
|
+
open?: SidebarOpen;
|
|
2301
|
+
onOpenChange?(open: SidebarOpen): void;
|
|
2302
|
+
/**
|
|
2303
|
+
* Default true. False hides the whole sidebar (the root gets `hidden`) and keeps its open
|
|
2304
|
+
* panels, their content and scroll, for when it shows again. Your code decides: a results
|
|
2305
|
+
* sidebar shown only while there are results, for instance.
|
|
2306
|
+
*/
|
|
2307
|
+
visible?: boolean;
|
|
2308
|
+
/**
|
|
2309
|
+
* True while a binding's panels are still registering, one by one, before it has mounted.
|
|
2310
|
+
* Meanwhile a controlled `open` id not in `panels` yet is kept rather than taken for a
|
|
2311
|
+
* removed panel, and `rootAttrs()` reports the open state expected once they are all in.
|
|
2312
|
+
* Set it back to false (through `update`) once the panels are in: an id still missing then
|
|
2313
|
+
* falls back as a removed one does.
|
|
2314
|
+
*/
|
|
2315
|
+
pending?: boolean;
|
|
2316
|
+
/**
|
|
2317
|
+
* Makes the ids `<idPrefix>-trigger-<id>` and `<idPrefix>-panel-<id>`, the same on the server
|
|
2318
|
+
* and the client. Without it they come from a counter.
|
|
2319
|
+
*/
|
|
2320
|
+
idPrefix?: string;
|
|
2321
|
+
}
|
|
2322
|
+
interface SidebarState {
|
|
2323
|
+
layout: SidebarLayout;
|
|
2324
|
+
side: SidebarSide;
|
|
2325
|
+
panels: readonly SidebarPanelInfo[];
|
|
2326
|
+
/** The open panels' ids, in panel order: at most one for rail and tabs. */
|
|
2327
|
+
open: readonly string[];
|
|
2328
|
+
visible: boolean;
|
|
2329
|
+
}
|
|
2330
|
+
interface SidebarController {
|
|
2331
|
+
readonly state: Readable<SidebarState>;
|
|
2332
|
+
/**
|
|
2333
|
+
* Takes new options. `open` given makes the sidebar controlled. When the panels no longer
|
|
2334
|
+
* hold an open one, rail and tabs open the first remaining and stack drops it; the new value
|
|
2335
|
+
* goes to `onOpenChange`, controlled or not.
|
|
2336
|
+
*/
|
|
2337
|
+
update(opts: Partial<SidebarControllerOptions>): void;
|
|
2338
|
+
/** What activating `id`'s trigger does: rail opens or closes, tabs switch, stack expands or collapses. */
|
|
2339
|
+
toggle(id: string): void;
|
|
2340
|
+
isOpen(id: string): boolean;
|
|
2341
|
+
/**
|
|
2342
|
+
* `data-ink-sidebar`, `data-layout`, `data-side` and `data-state` (`open` while any panel is,
|
|
2343
|
+
* and while pending and uncontrolled, as the first panel will open) for the root, and
|
|
2344
|
+
* `hidden` while it is not `visible`.
|
|
2345
|
+
*/
|
|
2346
|
+
rootAttrs(): Record<string, string>;
|
|
2347
|
+
/** ARIA for the element holding the triggers: a tablist for rail and tabs. */
|
|
2348
|
+
tablistAttrs(): Record<string, string>;
|
|
2349
|
+
/** ARIA for the rail button / tab / stack header of `id`. */
|
|
2350
|
+
triggerAttrs(id: string): Record<string, string>;
|
|
2351
|
+
/**
|
|
2352
|
+
* ARIA for `id`'s panel, including `hidden` when closed, and its sidebar's `data-layout`: the
|
|
2353
|
+
* theme shows the panel's title (`.ink-sidebar-panel-title`) in the rail only.
|
|
2354
|
+
*/
|
|
2355
|
+
panelAttrs(id: string): Record<string, string>;
|
|
2356
|
+
/**
|
|
2357
|
+
* Roving tabindex, arrow keys, Home and End, and clicks over `[data-ink-sidebar-trigger]`
|
|
2358
|
+
* inside `el`, looked up at event time so re-rendered triggers keep working. Returns the
|
|
2359
|
+
* function that unbinds.
|
|
2360
|
+
*/
|
|
2361
|
+
bindTriggers(el: HTMLElement): () => void;
|
|
2362
|
+
destroy(): void;
|
|
2363
|
+
}
|
|
2364
|
+
/** The text a badge shows, or null when it is hidden (empty or 0). */
|
|
2365
|
+
export declare function sidebarBadge(badge: string | number | undefined): string | null;
|
|
2366
|
+
export declare function createSidebarController(opts: SidebarControllerOptions): SidebarController;
|
|
2367
|
+
//#endregion
|
|
2368
|
+
//#region src/dom/sidebar/sidebar.d.ts
|
|
2369
|
+
/**
|
|
2370
|
+
* A sidebar of `opts.panels` in `opts.layout` (`'rail'` by default) on `opts.side`, showing
|
|
2371
|
+
* `opts.content[id]` in each panel. Returns the root element and its controller, which opens
|
|
2372
|
+
* panels from code (`toggle`, `update({ open })`) and takes new panels or a new layout.
|
|
2373
|
+
*/
|
|
2374
|
+
export declare function createSidebar(opts: SidebarControllerOptions & {
|
|
2375
|
+
content: Record<string, HTMLElement>;
|
|
2376
|
+
}): {
|
|
2377
|
+
element: HTMLElement;
|
|
2378
|
+
controller: SidebarController;
|
|
2379
|
+
};
|
|
2380
|
+
//#endregion
|
|
2381
|
+
//#region src/dom/thumbnails/thumbnail.d.ts
|
|
2382
|
+
/** Width in CSS pixels when neither `width` nor `height` is given; the theme's `--ink-thumbnail-width`. */
|
|
2383
|
+
export declare const THUMBNAIL_WIDTH = 120;
|
|
2384
|
+
interface ThumbnailDeps {
|
|
2385
|
+
document: Readable<InkDocument | null>;
|
|
2386
|
+
/** Where plugin marks come from. Without it, the thumbnail draws no marks. */
|
|
2387
|
+
pluginHost?: Readable<PluginHost | null>;
|
|
2388
|
+
}
|
|
2389
|
+
interface ThumbnailOptions {
|
|
2390
|
+
/** Zero-based page index. */
|
|
2391
|
+
page: number;
|
|
2392
|
+
/** Width in CSS pixels; the height follows the page's shape. Wins over `height`. */
|
|
2393
|
+
width?: number | undefined;
|
|
2394
|
+
/** Height in CSS pixels, used when `width` is absent; the width follows the page's shape. */
|
|
2395
|
+
height?: number | undefined;
|
|
2396
|
+
/** Draw the page's annotations. Default true. */
|
|
2397
|
+
annotations?: boolean | undefined;
|
|
2398
|
+
/** Draw plugin marks. Default true. */
|
|
2399
|
+
marks?: boolean | undefined;
|
|
2400
|
+
/** The accessible name. Default "Page N", N being `page + 1`. */
|
|
2401
|
+
label?: string | undefined;
|
|
2402
|
+
}
|
|
2403
|
+
interface ThumbnailPainter {
|
|
2404
|
+
/** Applies changed options; the others stay as they were. An option given as `undefined` goes back to its default. */
|
|
2405
|
+
update(opts: Partial<ThumbnailOptions>): void;
|
|
2406
|
+
/** Stops painting and removes everything the painter added to the element. */
|
|
2407
|
+
destroy(): void;
|
|
2408
|
+
}
|
|
2409
|
+
/** CSS size and zoom for `page` fitted to width or height (width wins when both), /Rotate applied. */
|
|
2410
|
+
export declare function thumbnailSize(page: PageInfo, size: {
|
|
2411
|
+
width?: number | undefined;
|
|
2412
|
+
height?: number | undefined;
|
|
2413
|
+
}): {
|
|
2414
|
+
width: number;
|
|
2415
|
+
height: number;
|
|
2416
|
+
zoom: number;
|
|
2417
|
+
};
|
|
2418
|
+
/**
|
|
2419
|
+
* Paints page `opts.page` of the open document into `el`. The element keeps its own children
|
|
2420
|
+
* and classes; the painter appends its layers after them.
|
|
2421
|
+
*/
|
|
2422
|
+
export declare function createThumbnailPainter(el: HTMLElement, deps: ThumbnailDeps, initial: ThumbnailOptions): ThumbnailPainter;
|
|
2423
|
+
/**
|
|
2424
|
+
* A thumbnail of page `opts.page` of `viewer`'s open document, with its annotations and plugin
|
|
2425
|
+
* marks. Place it anywhere; it stops when the viewer is destroyed.
|
|
2426
|
+
*/
|
|
2427
|
+
export declare function createThumbnail(viewer: Viewer, opts: ThumbnailOptions): HTMLElement;
|
|
2428
|
+
//#endregion
|
|
2429
|
+
//#region src/dom/thumbnails/list.d.ts
|
|
2430
|
+
interface ThumbnailsDeps extends ThumbnailDeps {
|
|
2431
|
+
/** The viewport whose current page the list follows; null while none is mounted. */
|
|
2432
|
+
viewport: Readable<Viewport | null>;
|
|
2433
|
+
}
|
|
2434
|
+
interface ThumbnailsOptions {
|
|
2435
|
+
/** Zero-based pages to list, in this order. Default: every page. Missing pages and repeats are dropped. */
|
|
2436
|
+
pages?: readonly number[] | undefined;
|
|
2437
|
+
/**
|
|
2438
|
+
* Thumbnail width in CSS pixels. Default: the list's width less a 16px gutter on each side,
|
|
2439
|
+
* following the list as it resizes (`THUMBNAIL_WIDTH` until the list is attached and shown).
|
|
2440
|
+
*/
|
|
2441
|
+
width?: number | undefined;
|
|
2442
|
+
/** Draw each page's annotations. Default true. */
|
|
2443
|
+
annotations?: boolean | undefined;
|
|
2444
|
+
/** Draw plugin marks. Default true. */
|
|
2445
|
+
marks?: boolean | undefined;
|
|
2446
|
+
}
|
|
2447
|
+
interface ThumbnailsState {
|
|
2448
|
+
/** What is listed: zero-based pages, in list order. */
|
|
2449
|
+
pages: readonly number[];
|
|
2450
|
+
/** The viewport's current page, -1 with no viewport. */
|
|
2451
|
+
current: number;
|
|
2452
|
+
/** Indexes into `pages` to mount, `end` exclusive. Empty until `attach`. */
|
|
2453
|
+
window: {
|
|
2454
|
+
start: number;
|
|
2455
|
+
end: number;
|
|
2456
|
+
};
|
|
2457
|
+
/** Top of each item in CSS px from the top of the list; the last entry is the total height. */
|
|
2458
|
+
offsets: readonly number[];
|
|
2459
|
+
/** The width each thumbnail is drawn at, in CSS px: `width`, else the measured fit. */
|
|
2460
|
+
width: number;
|
|
2461
|
+
}
|
|
2462
|
+
interface ThumbnailsController {
|
|
2463
|
+
readonly state: Readable<ThumbnailsState>;
|
|
2464
|
+
/** Applies changed options; the others stay as they were. */
|
|
2465
|
+
update(opts: Partial<ThumbnailsOptions>): void;
|
|
2466
|
+
/**
|
|
2467
|
+
* Binds the list's scroll element: the element that scrolls, with item `i` positioned at
|
|
2468
|
+
* `offsets[i]` from the top of its content. Follows its scrolling and size to move the
|
|
2469
|
+
* window, and handles clicks, keys and the Tab stop over `[data-ink-thumbnail-item]` buttons
|
|
2470
|
+
* inside it (`data-ink-thumbnail-item` is the page). It sets the items' `tabindex`: don't
|
|
2471
|
+
* render one. Attaching another element unbinds the previous one. Returns the unbind.
|
|
2472
|
+
*/
|
|
2473
|
+
attach(scroller: HTMLElement): () => void;
|
|
2474
|
+
/**
|
|
2475
|
+
* The attributes of the list item wrapping item `index` (into `pages`): `role="listitem"`
|
|
2476
|
+
* and, as only the window is mounted, `aria-setsize` and `aria-posinset` for its place in
|
|
2477
|
+
* the whole list.
|
|
2478
|
+
*/
|
|
2479
|
+
itemAttrs(index: number): Record<string, string>;
|
|
2480
|
+
/** Scrolls the viewport to `page`. */
|
|
2481
|
+
activate(page: number): void;
|
|
2482
|
+
destroy(): void;
|
|
2483
|
+
}
|
|
2484
|
+
export declare function createThumbnailsController(deps: ThumbnailsDeps, initial?: ThumbnailsOptions): ThumbnailsController;
|
|
2485
|
+
/**
|
|
2486
|
+
* A scrolling list of `viewer`'s pages as thumbnails. Give it a height (it fills its parent's)
|
|
2487
|
+
* and place it anywhere, a sidebar panel for instance. Each item is a button that scrolls the
|
|
2488
|
+
* viewer to its page; the current page is marked and kept in view. It stops when the viewer
|
|
2489
|
+
* is destroyed.
|
|
2490
|
+
*/
|
|
2491
|
+
export declare function createThumbnails(viewer: Viewer, opts?: ThumbnailsOptions): HTMLElement;
|
|
2492
|
+
//#endregion
|
|
1908
2493
|
//#region src/dom/viewer/controls.d.ts
|
|
1909
2494
|
/**
|
|
1910
2495
|
* An `<svg>` drawing `icon` from `@inkbar/icons`, hidden from assistive technology: the
|
|
@@ -1926,6 +2511,16 @@ export declare function createToolbar(opts?: {
|
|
|
1926
2511
|
}): HTMLElement;
|
|
1927
2512
|
/** A divider between groups of controls in a horizontal toolbar. Not focusable. */
|
|
1928
2513
|
export declare function createToolbarSeparator(): HTMLDivElement;
|
|
2514
|
+
/**
|
|
2515
|
+
* Saves the document's file (`viewer.download()`); disabled until a document is ready. Today
|
|
2516
|
+
* that is the file as it was opened, without this session's annotations.
|
|
2517
|
+
*/
|
|
2518
|
+
export declare function createDownloadButton(viewer: Viewer, opts?: DownloadOptions): HTMLButtonElement;
|
|
2519
|
+
/**
|
|
2520
|
+
* Prints the document's file (`viewer.print()`); disabled until a document is ready. Today
|
|
2521
|
+
* that is the file as it was opened, without this session's annotations.
|
|
2522
|
+
*/
|
|
2523
|
+
export declare function createPrintButton(viewer: Viewer): HTMLButtonElement;
|
|
1929
2524
|
/** Undoes the last change to the document's annotations; disabled when there is none. */
|
|
1930
2525
|
export declare function createUndo(viewer: Viewer): HTMLButtonElement;
|
|
1931
2526
|
/** Redoes the last undone change; disabled when there is none. */
|
|
@@ -2203,5 +2798,5 @@ interface FormAlert {
|
|
|
2203
2798
|
*/
|
|
2204
2799
|
export declare function createFormAlert(root: HTMLElement): FormAlert;
|
|
2205
2800
|
//#endregion
|
|
2206
|
-
export { type AnnotationDecoration, type AnnotationInputOf, type AnnotationLink, type AnnotationLinkSpec, type AnnotationSlotProps, type AnnotationState, type ArrowheadChoice, type CardSpec, type ColorMenuModel, type ColorMenuOptions, type ColorMenuSwatch, type ColorProperty, type ColorTrigger, type Command, type CommandOptions, type CommandRun, type CommandSpec, type CoreToolId, type CreateViewerOptions, type CssLayout, type CssLayoutInput, type CssPageBox, type CssRect, type CurrentStyle, type DecorateAnnotation, type EditorCloseReason, type FocusReturn, type FocusReturnOptions, type FormAlert, type FormLayer, type FreeTextEditor, type FreeTextEditorOptions, type HighlightMenuItem, type HighlightMenuModel, type HighlightOptions, type HistoryKeysTarget, type InkPlugin, type LayerEvent, type LayerSource, type LayerSpec, type LayoutMode, type LineStyleMenuItem, type LineStyleMenuModel, type LineStyleMenuSection, type MarksHandle, type MarksOptions, type MarkupKind, type Menu, type MenuOptions, type MountViewerOptions, type Overlay, type OverlayOptions, type PageHit, type PageLayer, type PageLayers, type PageMount, type PageMountOptions, type PageRenderer, type PageRendererOptions, type PageTransform, type Palette, type PluginApi, type PluginContext, type PluginHost, type PluginHostOptions, type PluginLayer, type PluginLayerHandle, type PluginLayers, type PluginOptions, type PluginStoreOptions, type Popover, type PopoverOptions, type Records, type ScopedToolStyle, type SearchController, type SearchControllerOptions, type SearchState, type SelectionQuads, type ShapeKind, type ShapeMenuItem, type ShapeMenuModel, type ShapeOptions, type SignFieldMenu, type SignFieldMenuOptions, type SignFieldRequest, type SignatureDialog, type SignatureDialogOptions, type SignatureDraft, type SignatureDraftState, type SignatureMenuItem, type SignatureMenuModel, type SignatureOptions, type SignaturePad, type SignatureTab, type StyleGroup, type StyleKey, type StyleProps, type TextAlignChoice, type TextAlignKey, type TextLayerHandle, type TextLayerOptions, type TextStyleMenuModel, type TextStyleToggle, type TextToggleKey, type ThreadPopoverSlotProps, type Tool, type ToolContext, type ToolController, type ToolControllerOptions, type ToolId, type ToolKind, type ToolOptions, type ToolStyle, type ToolStyleTracker, type TypedSignatureOptions, type ViewRotation, type Viewer, type ViewerEngine, type ViewerSearch, type Viewport, type ViewportHit, type ViewportKeysOptions, type ViewportOptions, type ZoomValue, cssVariableDefaults, signField };
|
|
2801
|
+
export { type AnnotationDecoration, type AnnotationInputOf, type AnnotationLink, type AnnotationLinkSpec, type AnnotationSlotProps, type AnnotationState, type ArrowheadChoice, type CardSpec, type ColorMenuModel, type ColorMenuOptions, type ColorMenuSwatch, type ColorProperty, type ColorTrigger, type Command, type CommandOptions, type CommandRun, type CommandSpec, type CoreToolId, type CreateViewerOptions, type CssLayout, type CssLayoutInput, type CssPageBox, type CssRect, type CurrentStyle, type DecorateAnnotation, type DownloadOptions, type EditorCloseReason, type FocusReturn, type FocusReturnOptions, type FormAlert, type FormLayer, type FreeTextEditor, type FreeTextEditorOptions, type HighlightMenuItem, type HighlightMenuModel, type HighlightOptions, type HistoryKeysTarget, type HostRecords, type InkPlugin, type LayerEvent, type LayerSource, type LayerSpec, type LayoutMode, type LineStyleMenuItem, type LineStyleMenuModel, type LineStyleMenuSection, type ListItem, type MarksHandle, type MarksOptions, type MarksRegistration, type MarksRegistry, type MarkupKind, type Menu, type MenuOptions, type MountViewerOptions, type Overlay, type OverlayOptions, type PageHit, type PageLayer, type PageLayers, type PageMount, type PageMountOptions, type PagePress, type PageRenderer, type PageRendererOptions, type PageTransform, type Palette, type PinchFrame, type PluginApi, type PluginContext, type PluginHost, type PluginHostOptions, type PluginLayer, type PluginLayerHandle, type PluginLayers, type PluginOptions, type PluginStoreOptions, type Popover, type PopoverOptions, type PressKind, type RecordListController, type RecordListRow, type RecordListSource, type RecordSelection, type Records, type RecordsSourceDeps, type RecordsSourceOptions, type ScopedToolStyle, type SearchController, type SearchControllerOptions, type SearchResultsOptions, type SearchState, type SelectionQuads, type ShapeKind, type ShapeMenuItem, type ShapeMenuModel, type ShapeOptions, type SidebarController, type SidebarControllerOptions, type SidebarLayout, type SidebarOpen, type SidebarPanelInfo, type SidebarSide, type SidebarState, type SignFieldMenu, type SignFieldMenuOptions, type SignFieldRequest, type SignatureDialog, type SignatureDialogOptions, type SignatureDraft, type SignatureDraftState, type SignatureMenuItem, type SignatureMenuModel, type SignatureOptions, type SignaturePad, type SignatureTab, type StyleGroup, type StyleKey, type StyleProps, type TextAlignChoice, type TextAlignKey, type TextLayerHandle, type TextLayerOptions, type TextStyleMenuModel, type TextStyleToggle, type TextToggleKey, type ThreadPopoverSlotProps, type ThumbnailDeps, type ThumbnailOptions, type ThumbnailPainter, type ThumbnailsController, type ThumbnailsDeps, type ThumbnailsOptions, type ThumbnailsState, type Tool, type ToolContext, type ToolController, type ToolControllerOptions, type ToolId, type ToolKind, type ToolOptions, type ToolStyle, type ToolStyleTracker, type TouchPinchOptions, type TrackpadPinchOptions, type TypedSignatureOptions, type ViewRotation, type Viewer, type ViewerEngine, type ViewerSearch, type Viewport, type ViewportHit, type ViewportKeysOptions, type ViewportOptions, type ZoomPreview, type ZoomValue, cssVariableDefaults, isBlankQuery, signField };
|
|
2207
2802
|
//# sourceMappingURL=dom.d.mts.map
|