@inkbar/core 0.5.0 → 0.7.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 +111 -1
- package/dist/dom.d.mts +597 -40
- package/dist/dom.d.mts.map +1 -1
- package/dist/dom.mjs +2154 -436
- package/dist/dom.mjs.map +1 -1
- package/dist/index.d.mts +16 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +181 -25
- package/dist/index.mjs.map +1 -1
- package/dist/{signatures-BwaXi7C8.d.mts → signatures-CalOktkf.d.mts} +148 -13
- package/dist/signatures-CalOktkf.d.mts.map +1 -0
- package/dist/{signatures-CMapTKrC.mjs → signatures-Do_l2IlM.mjs} +882 -56
- package/dist/signatures-Do_l2IlM.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/signatures-BwaXi7C8.d.mts.map +0 -1
- package/dist/signatures-CMapTKrC.mjs.map +0 -1
package/dist/dom.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as OpenOptions, E as InkStatus,
|
|
1
|
+
import { $ as RecordChange, A as SearchHit, Cn as Quad, D as OpenOptions, E as InkStatus, F as InkError, Jt as NoteAnnotation, K as AnnotationEdit, Q as RecordBase, Sn as Point, T as InkDocument, U as PluginHistory, Vt as LineEnding, _ as StyleGroup, _t as Annotation, a as SignatureStore, b as ToolStyle, bn as PdfAssets, bt as AnnotationInput, dn as TextMarkupAnnotation, et as RecordStore, g as ScopedToolStyle, i as SignatureOptions, k as DocumentSource, kt as FreeTextAnnotation, m as CurrentStyle, mt as cssVariableDefaults, o as SignatureTemplate, pn as Readable, pt as AnnotationDefaults, q as AnnotationStore, r as SignatureLibrary, v as StyleKey, vn as PageInfo, wn as Rect, wt as AnnotationType, xn as Matrix, y as StyleProps } from "./signatures-CalOktkf.mjs";
|
|
2
2
|
import { IconNode } from "@inkbar/icons";
|
|
3
3
|
//#region src/dom/transform.d.ts
|
|
4
4
|
type ViewRotation = 0 | 90 | 180 | 270;
|
|
@@ -136,7 +136,9 @@ interface Viewport {
|
|
|
136
136
|
behavior?: ScrollBehavior;
|
|
137
137
|
}): void;
|
|
138
138
|
/** Scrolls so `rect` (user space on `page`) is visible, centring it when it was not. */
|
|
139
|
-
scrollToRect(page: number, rect: Rect
|
|
139
|
+
scrollToRect(page: number, rect: Rect, opts?: {
|
|
140
|
+
behavior?: ScrollBehavior;
|
|
141
|
+
}): void;
|
|
140
142
|
transformFor(page: number): PageTransform;
|
|
141
143
|
hostFor(page: number): HTMLElement | undefined;
|
|
142
144
|
/** The mounted page under a viewport (client) point, if any. */
|
|
@@ -298,43 +300,229 @@ export declare function createOverlay(opts: OverlayOptions): Overlay;
|
|
|
298
300
|
*/
|
|
299
301
|
export declare function renderAnnotationContent(el: HTMLElement, a: Annotation, t: PageTransform): void;
|
|
300
302
|
//#endregion
|
|
301
|
-
//#region src/dom/
|
|
302
|
-
interface
|
|
303
|
-
|
|
304
|
-
/**
|
|
303
|
+
//#region src/dom/plugins/api/command.d.ts
|
|
304
|
+
interface CommandOptions {
|
|
305
|
+
icon?: IconNode;
|
|
306
|
+
/** Default: a document is open and ready. */
|
|
307
|
+
enabled?: Readable<boolean>;
|
|
308
|
+
/** The status after a failure. Default: "Something went wrong." */
|
|
309
|
+
errorStatus?: string;
|
|
310
|
+
}
|
|
311
|
+
type CommandRun = (run: {
|
|
312
|
+
/** The document open when the command started. */
|
|
313
|
+
doc: InkDocument;
|
|
314
|
+
/** Aborts when that document closes or another opens. */
|
|
315
|
+
signal: AbortSignal;
|
|
316
|
+
}) => string | void | Promise<string | void>;
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/dom/plugins/api/links.d.ts
|
|
319
|
+
/** What `add` takes for annotations of type `K`. */
|
|
320
|
+
type AnnotationInputOf<K extends AnnotationType> = AnnotationInput extends (infer I) ? I extends {
|
|
321
|
+
type: infer U;
|
|
322
|
+
} ? K extends U ? I & {
|
|
323
|
+
type: K;
|
|
324
|
+
} : never : never : never;
|
|
325
|
+
type OmitEach<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
326
|
+
interface AnnotationLinkSpec<T extends RecordBase, K extends AnnotationType> {
|
|
327
|
+
/** The annotation's fields for `record`. Without a colour it gets the type's default. */
|
|
328
|
+
from(record: T): OmitEach<AnnotationInputOf<K>, 'type' | 'color'> & {
|
|
329
|
+
color?: string;
|
|
330
|
+
};
|
|
331
|
+
/** Runs once per linked annotation the user removes, inside that edit's undo step. */
|
|
332
|
+
onRemoved?(record: T, annotation: Annotation): void;
|
|
333
|
+
/** Runs for each user update of a linked annotation, inside that edit's undo step. */
|
|
334
|
+
onChanged?(record: T, annotation: Annotation): void;
|
|
335
|
+
}
|
|
336
|
+
interface AnnotationLink<T extends RecordBase> {
|
|
337
|
+
/** Adds an annotation made from `record` and linked to it; `undefined` with no document open. */
|
|
338
|
+
add(record: T): Annotation | undefined;
|
|
339
|
+
/** The annotations of this link's type linked to `record`, in document order. */
|
|
340
|
+
of(record: T): Annotation[];
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/dom/plugins/api/records.d.ts
|
|
344
|
+
interface Records<T extends RecordBase> {
|
|
345
|
+
/** The open document's records; `[]` while none is open. Emits when the document changes. */
|
|
346
|
+
readonly list: Readable<readonly T[]>;
|
|
347
|
+
all(): readonly T[];
|
|
348
|
+
find(id: string): T | undefined;
|
|
349
|
+
has(id: string): boolean;
|
|
350
|
+
/** Records whose fields equal (===) every field of `match`, or that pass it. */
|
|
351
|
+
where(match: Partial<T> | ((record: T) => boolean)): T[];
|
|
352
|
+
/**
|
|
353
|
+
* Returns the stored record, or `undefined` with no document open. Throws
|
|
354
|
+
* `InkError('DuplicateId')` when the id is taken; `addMissing` skips taken ids.
|
|
355
|
+
*
|
|
356
|
+
* Every write is one undo step, and `plugin.batch` makes several one step. A write after an
|
|
357
|
+
* `await` goes to whatever document is open then: inside a command, write through `in(doc)`.
|
|
358
|
+
*/
|
|
359
|
+
add(record: T): T | undefined;
|
|
360
|
+
/** Adds the records whose ids are not present yet, in one undo step; returns those added. */
|
|
361
|
+
addMissing(records: readonly T[]): T[];
|
|
362
|
+
update(id: string, patch: Partial<Omit<T, 'id'>>): T | undefined;
|
|
363
|
+
remove(id: string): T | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* The same handle bound to `doc`'s store, as it is when called. Empty and inert once `doc`
|
|
366
|
+
* closes, and from the start when `doc` is not the open document.
|
|
367
|
+
*/
|
|
368
|
+
in(doc: InkDocument): Records<T>;
|
|
369
|
+
/** The underlying store, or null; for anything the handle lacks. */
|
|
370
|
+
store(): RecordStore<T> | null;
|
|
371
|
+
/**
|
|
372
|
+
* Links these records to the `type` annotations made from them, as
|
|
373
|
+
* `custom.<plugin>.<records name> = <record id>`. A record may have several. Each call listens
|
|
374
|
+
* for annotation edits for the viewer's lifetime: call it in `setup`.
|
|
375
|
+
*/
|
|
376
|
+
annotates<K extends AnnotationType>(type: K, spec: AnnotationLinkSpec<T, K>): AnnotationLink<T>;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/dom/plugins/api/card.d.ts
|
|
380
|
+
/** What a mark's card shows. The theme styles it; `className` adds a class of your own. */
|
|
381
|
+
interface CardSpec {
|
|
382
|
+
/** The card's heading (`.ink-card-title`). */
|
|
383
|
+
title: string;
|
|
384
|
+
/** The dialog's accessible name. Default: `title`. */
|
|
385
|
+
label?: string;
|
|
386
|
+
/** A short line under the title (`.ink-card-meta`). */
|
|
387
|
+
meta?: string;
|
|
388
|
+
/** A CSS colour for a dot before `meta` (`.ink-card-swatch`). */
|
|
389
|
+
swatch?: string;
|
|
390
|
+
/** Text under the meta line (`.ink-card-body`). */
|
|
391
|
+
body?: string;
|
|
392
|
+
/**
|
|
393
|
+
* One button per key, in order (`.ink-card-actions`). The first takes focus on open and is
|
|
394
|
+
* styled as the primary action. Each action runs synchronously in one undo step: writes after
|
|
395
|
+
* an `await` fall outside it. When an action removes the mark, focus moves to the next of this
|
|
396
|
+
* `marks()` handle's marks, else the previous, else the viewport.
|
|
397
|
+
*/
|
|
398
|
+
actions: Record<string, () => void>;
|
|
399
|
+
/** Classes added to the card. */
|
|
400
|
+
className?: string;
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/dom/plugins/api/marks.d.ts
|
|
404
|
+
interface MarksOptions<T extends RecordBase & {
|
|
305
405
|
page: number;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
decorate?: DecorateAnnotation;
|
|
314
|
-
/** Defaults to `window.devicePixelRatio`. */
|
|
315
|
-
devicePixelRatio?: number;
|
|
406
|
+
}> {
|
|
407
|
+
/** Where the record's mark goes on its page, in user space. */
|
|
408
|
+
rect(record: T): Rect;
|
|
409
|
+
/** The mark's accessible name. */
|
|
410
|
+
label(record: T): string;
|
|
411
|
+
/** Only records that pass get a mark. Default: all. */
|
|
412
|
+
where?(record: T): boolean;
|
|
316
413
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
414
|
+
* Inline style for the mark, camel-case properties and `--custom` properties alike. Core draws
|
|
415
|
+
* nothing else: the look is the plugin's CSS.
|
|
319
416
|
*/
|
|
320
|
-
|
|
417
|
+
style?(record: T): Partial<CSSStyleDeclaration> & {
|
|
418
|
+
[property: `--${string}`]: string;
|
|
419
|
+
};
|
|
420
|
+
/** Classes every mark gets. */
|
|
421
|
+
className?: string;
|
|
321
422
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
423
|
+
* More attributes (`data-*`, `aria-*`). `data-record`, `data-plugin` and `aria-label` stay
|
|
424
|
+
* core's, and so do `aria-haspopup` and `aria-expanded` on a mark with a card; `style`,
|
|
425
|
+
* `class` and `type` are skipped (use `style` and `className`).
|
|
324
426
|
*/
|
|
325
|
-
|
|
427
|
+
attrs?(record: T): Record<string, string>;
|
|
428
|
+
/**
|
|
429
|
+
* The card a mark opens when activated: a popover next to it, styled by the theme. Each
|
|
430
|
+
* action is one undo step. The mark gets `aria-haspopup="dialog"`, and `aria-expanded` true
|
|
431
|
+
* while its card is open.
|
|
432
|
+
*/
|
|
433
|
+
card?(record: T): CardSpec;
|
|
434
|
+
/** Runs when the mark is clicked, or activated with Enter or Space, after `card` opens. */
|
|
435
|
+
onActivate?(record: T, mark: HTMLButtonElement): void;
|
|
326
436
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
437
|
+
interface MarksHandle {
|
|
438
|
+
/** Redraws every mark, for marks that read state outside the records. */
|
|
439
|
+
refresh(): void;
|
|
440
|
+
/**
|
|
441
|
+
* From now on, when records start to get a mark (added, or changed to pass `where`), the
|
|
442
|
+
* viewer scrolls to the first of them in reading order, unless it is in view already. Records
|
|
443
|
+
* a document opens with, and undo and redo, never scroll. Focus stays where it is. Returns
|
|
444
|
+
* the handle.
|
|
445
|
+
*/
|
|
446
|
+
scrollToFirst(): MarksHandle;
|
|
447
|
+
}
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/dom/plugins/api/api.d.ts
|
|
450
|
+
interface PluginOptions {
|
|
451
|
+
/** Store options by records name; `plugin.records(name)` picks them up. */
|
|
452
|
+
records?: Record<string, PluginStoreOptions<any>>;
|
|
453
|
+
}
|
|
454
|
+
interface PluginApi extends PluginContext {
|
|
455
|
+
/**
|
|
456
|
+
* A handle on the store `<plugin>.<name>` that follows the open document. Its options are
|
|
457
|
+
* `opts` when given, else the host's `options.records[name]`. Call it once per name in
|
|
458
|
+
* setup and keep the handle: a second call for the same name throws `InkError('DuplicateId')`.
|
|
459
|
+
*/
|
|
460
|
+
records<T extends RecordBase>(name: string, opts?: PluginStoreOptions<T>): Records<T>;
|
|
461
|
+
/** Makes everything `fn` changes one undo step: `history.batch`. */
|
|
462
|
+
batch(fn: () => void): void;
|
|
463
|
+
/**
|
|
464
|
+
* Registers `<plugin>.<id>`. `run` gets the document open when it started and a signal that
|
|
465
|
+
* aborts when that document closes or another opens. A returned string becomes the command's
|
|
466
|
+
* status and `undefined` clears it; a failure is logged once and sets `errorStatus` (default
|
|
467
|
+
* "Something went wrong."). The status clears when the document changes.
|
|
468
|
+
*
|
|
469
|
+
* Inside a command, write through `records.in(doc)`.
|
|
470
|
+
*/
|
|
471
|
+
command(id: string, label: string, run: CommandRun, opts?: CommandOptions): Command;
|
|
472
|
+
/**
|
|
473
|
+
* Draws a `<button>` for each record that passes `where`, on page `record.page` at
|
|
474
|
+
* `rect(record)`, in a layer of its own. The marks redraw when the records change; call
|
|
475
|
+
* `refresh()` when they read state of your own that changed.
|
|
476
|
+
*/
|
|
477
|
+
marks<T extends RecordBase & {
|
|
478
|
+
page: number;
|
|
479
|
+
}>(records: Records<T>, opts: MarksOptions<T>): MarksHandle;
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/dom/search/controller.d.ts
|
|
483
|
+
interface SearchState {
|
|
484
|
+
open: boolean;
|
|
485
|
+
query: string;
|
|
486
|
+
matchCase: boolean;
|
|
487
|
+
/** Found so far, in `(page, start)` order. */
|
|
488
|
+
hits: readonly SearchHit[];
|
|
489
|
+
/** Index into `hits`, -1 when none. */
|
|
490
|
+
current: number;
|
|
491
|
+
scanning: boolean;
|
|
492
|
+
}
|
|
493
|
+
interface ViewerSearch {
|
|
494
|
+
readonly state: Readable<SearchState>;
|
|
495
|
+
/** Shows the bar, optionally with a query. */
|
|
496
|
+
open(query?: string): void;
|
|
497
|
+
setQuery(query: string): void;
|
|
498
|
+
setMatchCase(on: boolean): void;
|
|
499
|
+
next(): void;
|
|
500
|
+
previous(): void;
|
|
501
|
+
/** Hides the bar and clears the hits; the query and match case are kept. */
|
|
502
|
+
close(): void;
|
|
503
|
+
}
|
|
504
|
+
interface SearchController extends ViewerSearch {
|
|
505
|
+
/** @internal Registers a mounted find bar; returns the function that unregisters it. */
|
|
506
|
+
attachBar(): () => void;
|
|
507
|
+
/** Whether any find bar is mounted for this viewer. */
|
|
508
|
+
readonly barAttached: Readable<boolean>;
|
|
334
509
|
destroy(): void;
|
|
335
510
|
}
|
|
336
|
-
|
|
337
|
-
|
|
511
|
+
interface SearchControllerOptions {
|
|
512
|
+
document: Readable<InkDocument | null>;
|
|
513
|
+
/** The viewer's viewport, read on each call. */
|
|
514
|
+
viewport: () => Viewport | null | undefined;
|
|
515
|
+
/** Default 150. */
|
|
516
|
+
debounceMs?: number;
|
|
517
|
+
}
|
|
518
|
+
export declare function createSearchController(opts: SearchControllerOptions): SearchController;
|
|
519
|
+
/**
|
|
520
|
+
* The actions and state of `controller` without the bar registration: what callers of a viewer
|
|
521
|
+
* or a plugin get.
|
|
522
|
+
*
|
|
523
|
+
* @internal Shared with the framework bindings.
|
|
524
|
+
*/
|
|
525
|
+
export declare function viewerSearchOf(controller: SearchController): ViewerSearch;
|
|
338
526
|
//#endregion
|
|
339
527
|
//#region src/dom/tools/options.d.ts
|
|
340
528
|
interface ToolOptions {
|
|
@@ -395,6 +583,10 @@ interface ToolContext {
|
|
|
395
583
|
}
|
|
396
584
|
interface Tool<O extends object = object> {
|
|
397
585
|
id: ToolId;
|
|
586
|
+
/** The accessible name a toolbar button shows for a tool core has no label for. */
|
|
587
|
+
label?: string;
|
|
588
|
+
/** The icon a toolbar button shows for a tool core has no icon for. */
|
|
589
|
+
icon?: IconNode;
|
|
398
590
|
/** Default sticky. */
|
|
399
591
|
kind?: ToolKind;
|
|
400
592
|
cursor: string;
|
|
@@ -455,6 +647,278 @@ export declare function hitFor(ctx: ToolContext, e: {
|
|
|
455
647
|
clientY: number;
|
|
456
648
|
}): PageHit | undefined;
|
|
457
649
|
//#endregion
|
|
650
|
+
//#region src/dom/plugins/define.d.ts
|
|
651
|
+
interface InkPlugin {
|
|
652
|
+
/** Lower-case kebab (/^[a-z][a-z0-9-]*$/); the namespace for everything the plugin adds. */
|
|
653
|
+
readonly id: string;
|
|
654
|
+
/** Runs once per viewer. The returned function runs when the viewer is destroyed. */
|
|
655
|
+
setup(ctx: PluginContext): void | (() => void);
|
|
656
|
+
}
|
|
657
|
+
interface CommandSpec {
|
|
658
|
+
/** Namespaced to `<plugin>.<id>`. */
|
|
659
|
+
id: string;
|
|
660
|
+
/** Names the command's button; must not be empty (`InkError('InvalidCommandLabel')`). */
|
|
661
|
+
label: string;
|
|
662
|
+
icon?: IconNode;
|
|
663
|
+
/** Default: a document is open and ready. */
|
|
664
|
+
enabled?: Readable<boolean>;
|
|
665
|
+
/** A short progress or result message, announced in a live region by the command button. */
|
|
666
|
+
status?: Readable<string>;
|
|
667
|
+
/** May be async: the command is busy until the promise settles. */
|
|
668
|
+
run(): void | Promise<void>;
|
|
669
|
+
}
|
|
670
|
+
interface Command {
|
|
671
|
+
/** `<plugin>.<spec id>`. */
|
|
672
|
+
readonly id: string;
|
|
673
|
+
readonly label: string;
|
|
674
|
+
readonly icon: IconNode | undefined;
|
|
675
|
+
/** The spec's `enabled` (or a ready document), and not busy. */
|
|
676
|
+
readonly enabled: Readable<boolean>;
|
|
677
|
+
/** True while the promise `run` returned is pending. */
|
|
678
|
+
readonly busy: Readable<boolean>;
|
|
679
|
+
/** The spec's status, or `''` without one. */
|
|
680
|
+
readonly status: Readable<string>;
|
|
681
|
+
/**
|
|
682
|
+
* Does nothing while busy or disabled. Never rejects: a failure is logged, and one caused by
|
|
683
|
+
* the document closing mid-run (`DocumentDestroyed`) is dropped silently.
|
|
684
|
+
*/
|
|
685
|
+
run(): Promise<void>;
|
|
686
|
+
}
|
|
687
|
+
interface LayerSpec {
|
|
688
|
+
/** Draw into `el` for `page`. Called on mount, on every transform change and on invalidate. */
|
|
689
|
+
render(el: HTMLElement, page: number, transform: PageTransform): void;
|
|
690
|
+
/** Optional teardown when the page unmounts. */
|
|
691
|
+
destroy?(el: HTMLElement, page: number): void;
|
|
692
|
+
}
|
|
693
|
+
interface PluginLayerHandle {
|
|
694
|
+
/** Redraws `page`, or every mounted page without one. */
|
|
695
|
+
invalidate(page?: number): void;
|
|
696
|
+
}
|
|
697
|
+
interface PluginStoreOptions<T extends RecordBase> {
|
|
698
|
+
/** The records a store starts with, called once for each document that opens. */
|
|
699
|
+
initial?: (doc: InkDocument) => readonly T[];
|
|
700
|
+
/** Called after every change with the list as it now stands. */
|
|
701
|
+
onChange?: (list: readonly T[], change: RecordChange<T>) => void;
|
|
702
|
+
}
|
|
703
|
+
interface PluginContext {
|
|
704
|
+
/** The plugin's id. */
|
|
705
|
+
readonly id: string;
|
|
706
|
+
readonly document: Readable<InkDocument | null>;
|
|
707
|
+
/**
|
|
708
|
+
* The viewer's active history. `batch` makes everything `fn` changes, annotations and plugin
|
|
709
|
+
* records alike, one undo step. Stores from `store` are tracked for you, and `onAnnotationEdit`
|
|
710
|
+
* runs inside the edit's step.
|
|
711
|
+
*/
|
|
712
|
+
readonly history: {
|
|
713
|
+
batch(fn: () => void): void;
|
|
714
|
+
};
|
|
715
|
+
/** The id of the activated annotation, or null. */
|
|
716
|
+
readonly activated: Readable<string | null>;
|
|
717
|
+
setActivated(id: string | null): void;
|
|
718
|
+
/** The viewport container, or null while none is mounted. */
|
|
719
|
+
readonly root: Readable<HTMLElement | null>;
|
|
720
|
+
commands: {
|
|
721
|
+
add(spec: CommandSpec): Command;
|
|
722
|
+
};
|
|
723
|
+
/** The tool's id becomes `<plugin>.<id>`. */
|
|
724
|
+
tools: {
|
|
725
|
+
add(tool: Tool): void;
|
|
726
|
+
};
|
|
727
|
+
/** Composed after the host's own decoration and earlier plugins'; earlier ones win per key. */
|
|
728
|
+
decorate(fn: DecorateAnnotation): void;
|
|
729
|
+
/**
|
|
730
|
+
* Runs every decoration again for the open document's annotations. Decorations re-apply when
|
|
731
|
+
* the annotations change; call this when one reads state of your own that changed instead.
|
|
732
|
+
*/
|
|
733
|
+
redecorate(): void;
|
|
734
|
+
/**
|
|
735
|
+
* A record store keyed `<plugin>.<name>`, created for each document that opens and tracked by
|
|
736
|
+
* its history; null while no document is open. Inkbar keeps no plugin data: pass `initial`
|
|
737
|
+
* and `onChange` to load and save it.
|
|
738
|
+
*/
|
|
739
|
+
store<T extends RecordBase>(name: string, opts?: PluginStoreOptions<T>): Readable<RecordStore<T> | null>;
|
|
740
|
+
/** Runs for each document that opens; the returned function runs when it closes. */
|
|
741
|
+
onDocument(fn: (doc: InkDocument) => void | (() => void)): void;
|
|
742
|
+
/**
|
|
743
|
+
* Runs for every user add, update and remove of an annotation, inside that edit's undo step,
|
|
744
|
+
* so store changes made here undo with it. Never runs for undo and redo.
|
|
745
|
+
*/
|
|
746
|
+
onAnnotationEdit(fn: (edit: AnnotationEdit) => void): void;
|
|
747
|
+
/** Adds a layer drawn on every mounted page, above the annotations. */
|
|
748
|
+
layer(spec: LayerSpec): PluginLayerHandle;
|
|
749
|
+
/**
|
|
750
|
+
* Scrolls the viewer so `rect` (user space on `page`) is in view, centring it when it was
|
|
751
|
+
* not. Moves no focus. Does nothing while no document is shown.
|
|
752
|
+
*/
|
|
753
|
+
scrollTo(page: number, rect: Rect, opts?: {
|
|
754
|
+
behavior?: ScrollBehavior;
|
|
755
|
+
}): void;
|
|
756
|
+
/**
|
|
757
|
+
* The viewer's search state and actions, shared with the find bar. Inert (always closed, no
|
|
758
|
+
* hits) when the host has no search.
|
|
759
|
+
*/
|
|
760
|
+
readonly search: ViewerSearch;
|
|
761
|
+
}
|
|
762
|
+
/** A factory's parameters: its options, optional only when `O` has no required field. */
|
|
763
|
+
type PluginFactoryArgs<O> = {} extends O ? [options?: O & PluginOptions] : [options: O & PluginOptions];
|
|
764
|
+
/**
|
|
765
|
+
* Checks the plugin's id and returns the plugin unchanged. Throws `InkError('InvalidPluginId')`
|
|
766
|
+
* for an id that is not lower-case kebab.
|
|
767
|
+
*/
|
|
768
|
+
export declare function definePlugin(plugin: InkPlugin): InkPlugin;
|
|
769
|
+
/**
|
|
770
|
+
* Checks the id now and returns a factory: `factory(options)` is a plugin whose setup receives
|
|
771
|
+
* the plugin API and those options. Each call makes an independent plugin. The options may be
|
|
772
|
+
* left out only when every field of `O` is optional.
|
|
773
|
+
*/
|
|
774
|
+
export declare function definePlugin<O extends object = object>(id: string, setup: (plugin: PluginApi, options: O & PluginOptions) => void | (() => void)): (...args: PluginFactoryArgs<O>) => InkPlugin;
|
|
775
|
+
//#endregion
|
|
776
|
+
//#region src/dom/plugins/commands.d.ts
|
|
777
|
+
/**
|
|
778
|
+
* The error for a command id no plugin registered, naming the ids that were. Bindings log it
|
|
779
|
+
* rather than throw, and show the control as it is before the plugins are set up.
|
|
780
|
+
*/
|
|
781
|
+
export declare function unknownCommand(id: string, registered: readonly string[]): InkError;
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/dom/plugins/layer.d.ts
|
|
784
|
+
/** A layer as the host keeps it: the plugin's spec and the id of the plugin that added it. */
|
|
785
|
+
type PluginLayer = LayerSpec & {
|
|
786
|
+
readonly plugin: string;
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* What a layer source reports: a layer was added, or one asked to redraw.
|
|
790
|
+
*
|
|
791
|
+
* @internal For bindings, which mount plugin layers; not for plugin authors.
|
|
792
|
+
*/
|
|
793
|
+
type LayerEvent = {
|
|
794
|
+
type: 'add';
|
|
795
|
+
layer: PluginLayer;
|
|
796
|
+
} | {
|
|
797
|
+
type: 'invalidate';
|
|
798
|
+
layer: PluginLayer;
|
|
799
|
+
page?: number | undefined;
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Where page layers come from: a plugin host.
|
|
803
|
+
*
|
|
804
|
+
* @internal For bindings, which mount plugin layers; not for plugin authors.
|
|
805
|
+
*/
|
|
806
|
+
interface LayerSource {
|
|
807
|
+
readonly layers: readonly PluginLayer[];
|
|
808
|
+
/** Calls `listener` for every layer added and every invalidate; returns a stop function. */
|
|
809
|
+
watchLayers(listener: (event: LayerEvent) => void): () => void;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* One page's plugin layers, made by `PluginLayers.mount`.
|
|
813
|
+
*
|
|
814
|
+
* @internal For bindings, which mount plugin layers; not for plugin authors.
|
|
815
|
+
*/
|
|
816
|
+
interface PageLayers {
|
|
817
|
+
update(transform: PageTransform): void;
|
|
818
|
+
destroy(): void;
|
|
819
|
+
}
|
|
820
|
+
/** The plugin layers of one viewer's pages; see `createPluginLayers`. */
|
|
821
|
+
interface PluginLayers {
|
|
822
|
+
mount(page: number, host: HTMLElement, transform: PageTransform): PageLayers;
|
|
823
|
+
/** Stops following the source. Pages still mounted keep their layers until they unmount. */
|
|
824
|
+
destroy(): void;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Mounts `source`'s layers on the pages the engine mounts, and follows it: a layer added later
|
|
828
|
+
* is drawn on every mounted page, and an invalidate redraws its page, or all of them.
|
|
829
|
+
*
|
|
830
|
+
* @internal For bindings, which mount plugin layers; plugin authors add a layer with
|
|
831
|
+
* `ctx.layer`.
|
|
832
|
+
*/
|
|
833
|
+
export declare function createPluginLayers(source: LayerSource): PluginLayers;
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/dom/plugins/host.d.ts
|
|
836
|
+
interface PluginHostOptions {
|
|
837
|
+
plugins: readonly InkPlugin[];
|
|
838
|
+
document: Readable<InkDocument | null>;
|
|
839
|
+
/** The binding's active history, read when a document opens. */
|
|
840
|
+
history: () => PluginHistory;
|
|
841
|
+
activated: Readable<string | null>;
|
|
842
|
+
setActivated(id: string | null): void;
|
|
843
|
+
root: Readable<HTMLElement | null>;
|
|
844
|
+
/** The host's own decoration, read on each call. */
|
|
845
|
+
decorate?: () => DecorateAnnotation | undefined;
|
|
846
|
+
/** The viewer's viewport, read on each call; without one, `ctx.scrollTo` does nothing. */
|
|
847
|
+
viewport?: () => Viewport | null | undefined;
|
|
848
|
+
/** The viewer's search; without one, `ctx.search` is inert. */
|
|
849
|
+
search?: ViewerSearch;
|
|
850
|
+
}
|
|
851
|
+
interface PluginHost extends LayerSource {
|
|
852
|
+
readonly commands: ReadonlyMap<string, Command>;
|
|
853
|
+
command(id: string): Command | undefined;
|
|
854
|
+
readonly tools: readonly Tool[];
|
|
855
|
+
/** The host's decoration first, then each plugin's in order; earlier ones win per key. */
|
|
856
|
+
decorate: DecorateAnnotation;
|
|
857
|
+
/** Every layer added so far; `watchLayers` reports the ones added later and invalidates. */
|
|
858
|
+
readonly layers: readonly PluginLayer[];
|
|
859
|
+
/** Calls `listener` on every `ctx.redecorate()`; returns a stop function. */
|
|
860
|
+
watchRedecorate(listener: () => void): () => void;
|
|
861
|
+
destroy(): void;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* @internal For bindings and `createViewer`, which place a viewer's plugins; plugin authors use
|
|
865
|
+
* `definePlugin` and never call it.
|
|
866
|
+
*/
|
|
867
|
+
export declare function createPluginHost(opts: PluginHostOptions): PluginHost;
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/dom/search/highlights.d.ts
|
|
870
|
+
/** The highlights of one viewer's pages; see `createSearchHighlights`. */
|
|
871
|
+
interface SearchHighlights {
|
|
872
|
+
mount(page: number, host: HTMLElement, transform: PageTransform): PageLayers;
|
|
873
|
+
/** Stops following the controller. Pages still mounted keep their highlights until they unmount. */
|
|
874
|
+
destroy(): void;
|
|
875
|
+
}
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/dom/page-mount.d.ts
|
|
878
|
+
interface PageMountOptions {
|
|
879
|
+
document: InkDocument;
|
|
880
|
+
/** Zero-based page index. */
|
|
881
|
+
page: number;
|
|
882
|
+
/** The page host (`div.ink-page`) from the viewport's `onMount`. */
|
|
883
|
+
host: HTMLElement;
|
|
884
|
+
transform: PageTransform;
|
|
885
|
+
store: AnnotationStore;
|
|
886
|
+
onActivate?(id: string): void;
|
|
887
|
+
isCustom?(a: Annotation): boolean;
|
|
888
|
+
/** The app's data attributes and classes for each annotation element (see `OverlayOptions`). */
|
|
889
|
+
decorate?: DecorateAnnotation;
|
|
890
|
+
/** Defaults to `window.devicePixelRatio`. */
|
|
891
|
+
devicePixelRatio?: number;
|
|
892
|
+
/** Plugin layers, mounted above the overlay. The engine passes them for its pages only. */
|
|
893
|
+
layers?: PluginLayers;
|
|
894
|
+
/** Search match highlights, mounted below the overlay. */
|
|
895
|
+
highlights?: SearchHighlights;
|
|
896
|
+
/**
|
|
897
|
+
* Canvas and text layer failures, with the layer that failed (cancellations are not
|
|
898
|
+
* reported).
|
|
899
|
+
*/
|
|
900
|
+
onError?(error: unknown, layer: PageLayer): void;
|
|
901
|
+
/**
|
|
902
|
+
* A layer finished without error: the canvas painted, or the text layer mounted or applied
|
|
903
|
+
* an update. Pair it with `onError` to tell when a failed layer has recovered.
|
|
904
|
+
*/
|
|
905
|
+
onRendered?(layer: PageLayer): void;
|
|
906
|
+
}
|
|
907
|
+
/** The page layers that can fail and recover: the canvas and the text layer. */
|
|
908
|
+
type PageLayer = 'canvas' | 'text';
|
|
909
|
+
interface PageMount {
|
|
910
|
+
readonly renderer: PageRenderer;
|
|
911
|
+
readonly textLayer: TextLayerHandle;
|
|
912
|
+
readonly overlay: Overlay;
|
|
913
|
+
update(transform: PageTransform): void;
|
|
914
|
+
destroy(): void;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Canvas, text layer, annotation overlay and any plugin layers for one page, stacked in that
|
|
918
|
+
* order.
|
|
919
|
+
*/
|
|
920
|
+
export declare function createPageMount(opts: PageMountOptions): PageMount;
|
|
921
|
+
//#endregion
|
|
458
922
|
//#region src/dom/tools/freetext.d.ts
|
|
459
923
|
/** Width of a box placed with a click or Enter, user-space points. */
|
|
460
924
|
export declare const DEFAULT_FREETEXT_WIDTH = 144;
|
|
@@ -967,17 +1431,26 @@ interface PopoverOptions {
|
|
|
967
1431
|
*/
|
|
968
1432
|
onDismiss(): void;
|
|
969
1433
|
}
|
|
970
|
-
/** A panel anchored to one annotation at a time; see `createPopover`. */
|
|
1434
|
+
/** A panel anchored to one annotation, or one element, at a time; see `createPopover`. */
|
|
971
1435
|
interface Popover {
|
|
972
1436
|
/** The panel element, on `<body>`. Fill it with the card's content. */
|
|
973
1437
|
readonly panel: HTMLElement;
|
|
974
|
-
/**
|
|
1438
|
+
/**
|
|
1439
|
+
* The anchored annotation's element (or the element passed to `showAt`), or null while it is
|
|
1440
|
+
* not in the DOM (page unmounted).
|
|
1441
|
+
*/
|
|
975
1442
|
readonly anchor: HTMLElement | null;
|
|
976
1443
|
/**
|
|
977
1444
|
* Anchors the panel to annotation `id`. The panel shows whenever that annotation's element
|
|
978
1445
|
* is in the DOM, and follows it when it is replaced.
|
|
979
1446
|
*/
|
|
980
1447
|
show(id: string): void;
|
|
1448
|
+
/**
|
|
1449
|
+
* Anchors the panel to `el`, for anchors that are not annotations (a plugin layer's mark).
|
|
1450
|
+
* The panel shows while `el` is under the viewer root and hides while it is not. On hide,
|
|
1451
|
+
* focus returns to `el` when it is still connected, else through `focusReturn`.
|
|
1452
|
+
*/
|
|
1453
|
+
showAt(el: HTMLElement): void;
|
|
981
1454
|
/** Hides the panel, then returns focus through `focusReturn`. */
|
|
982
1455
|
hide(): void;
|
|
983
1456
|
/** Removes the panel and its listeners. */
|
|
@@ -991,7 +1464,7 @@ export declare function placePanel(panel: HTMLElement, anchor: DOMRect): void;
|
|
|
991
1464
|
/**
|
|
992
1465
|
* Creates a non-modal `role="dialog"` panel on `<body>`, marked `data-ink-popover` so the theme
|
|
993
1466
|
* gives it its tokens, that an app anchors to an annotation with `show(id)` (for instance on
|
|
994
|
-
* `viewer.activated`)
|
|
1467
|
+
* `viewer.activated`), or to any element in the viewer with `showAt(el)`. The panel follows the annotation's element as pages mount and unmount:
|
|
995
1468
|
* it hides while the element is gone and comes back with it. Tab loops inside the panel, and
|
|
996
1469
|
* Escape or a press outside calls `onDismiss`. Call `destroy` when done.
|
|
997
1470
|
*/
|
|
@@ -1065,6 +1538,17 @@ interface MountViewerOptions {
|
|
|
1065
1538
|
* classes cannot be overridden.
|
|
1066
1539
|
*/
|
|
1067
1540
|
decorateAnnotation?: DecorateAnnotation;
|
|
1541
|
+
/**
|
|
1542
|
+
* The viewer's plugins. Their tools join `tools`, their layers are drawn on every page the
|
|
1543
|
+
* engine mounts, and the host's `decorate` replaces `decorateAnnotation`: build the host with
|
|
1544
|
+
* the app's decoration (its `decorate` option) so the two compose.
|
|
1545
|
+
*/
|
|
1546
|
+
plugins?: PluginHost;
|
|
1547
|
+
/**
|
|
1548
|
+
* The viewer's search controller. Its matches are highlighted on every page the engine
|
|
1549
|
+
* mounts, below the annotations.
|
|
1550
|
+
*/
|
|
1551
|
+
search?: SearchController;
|
|
1068
1552
|
onActivate?(id: string): void;
|
|
1069
1553
|
/**
|
|
1070
1554
|
* After every (re)build: subscribe to the new viewport and controller here. It fires inside
|
|
@@ -1115,8 +1599,9 @@ interface ViewerEngine {
|
|
|
1115
1599
|
customAnnotations?: boolean;
|
|
1116
1600
|
}): void;
|
|
1117
1601
|
/**
|
|
1118
|
-
* Runs `decorateAnnotation` again for every mounted annotation
|
|
1119
|
-
* anything else. Call it when the decorations would change but
|
|
1602
|
+
* Runs `decorateAnnotation` (or the plugins' `decorate`) again for every mounted annotation
|
|
1603
|
+
* element, without re-rendering anything else. Call it when the decorations would change but
|
|
1604
|
+
* no annotation did.
|
|
1120
1605
|
*/
|
|
1121
1606
|
redecorate(): void;
|
|
1122
1607
|
destroy(): void;
|
|
@@ -1129,7 +1614,7 @@ export declare function mountViewer(opts: MountViewerOptions): ViewerEngine;
|
|
|
1129
1614
|
* (bound to one document's store, so each engine makes its own), and the tool options and
|
|
1130
1615
|
* signature library (one for the viewer's life).
|
|
1131
1616
|
*/
|
|
1132
|
-
interface CreateViewerOptions extends Omit<MountViewerOptions, 'container' | 'document' | 'toolStyle' | 'toolHistory' | 'toolOptions' | 'signatureLibrary'> {
|
|
1617
|
+
interface CreateViewerOptions extends Omit<MountViewerOptions, 'container' | 'document' | 'toolStyle' | 'toolHistory' | 'toolOptions' | 'signatureLibrary' | 'plugins' | 'search'> {
|
|
1133
1618
|
source: DocumentSource;
|
|
1134
1619
|
assets: PdfAssets;
|
|
1135
1620
|
/** User password for encrypted files. `open` can pass its own for one load. */
|
|
@@ -1137,6 +1622,12 @@ interface CreateViewerOptions extends Omit<MountViewerOptions, 'container' | 'do
|
|
|
1137
1622
|
/** Default: read from the theme's CSS variables on the viewer root. */
|
|
1138
1623
|
defaults?: AnnotationDefaults;
|
|
1139
1624
|
history?: OpenOptions['history'];
|
|
1625
|
+
/**
|
|
1626
|
+
* Plugins, set up once for the viewer's life. Their tools join the viewer's tools, their
|
|
1627
|
+
* decoration and page layers apply to every document, and their commands are placed with
|
|
1628
|
+
* `createCommandButton`.
|
|
1629
|
+
*/
|
|
1630
|
+
plugins?: readonly InkPlugin[];
|
|
1140
1631
|
/** The thread popover for notes and text markup. Default true. */
|
|
1141
1632
|
threads?: boolean;
|
|
1142
1633
|
onReady?(this: void, doc: InkDocument): void;
|
|
@@ -1167,6 +1658,15 @@ interface Viewer {
|
|
|
1167
1658
|
* not in the open document's annotations is ignored.
|
|
1168
1659
|
*/
|
|
1169
1660
|
setActivated(id: string | null): void;
|
|
1661
|
+
/** The plugins' commands by namespaced id (`sandbox.suggest`); place one with `createCommandButton`. */
|
|
1662
|
+
readonly commands: {
|
|
1663
|
+
get(id: string): Command | undefined;
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* The search state and its actions, shared by the find bar, the toolbar button and plugins.
|
|
1667
|
+
* `open()` runs the search and draws the highlights even when no find bar is mounted.
|
|
1668
|
+
*/
|
|
1669
|
+
readonly search: ViewerSearch;
|
|
1170
1670
|
/**
|
|
1171
1671
|
* Opens another document in place; the previous one is destroyed. Latest call wins.
|
|
1172
1672
|
* `password` is used for this load only; without it, the constructor's `password` applies.
|
|
@@ -1178,12 +1678,61 @@ interface Viewer {
|
|
|
1178
1678
|
}
|
|
1179
1679
|
export declare function createViewer(el: HTMLElement, opts: CreateViewerOptions): Viewer;
|
|
1180
1680
|
//#endregion
|
|
1681
|
+
//#region src/dom/search/find-bar.d.ts
|
|
1682
|
+
/**
|
|
1683
|
+
* The find bar for `viewer`: a field, the match count, previous and next, a match-case toggle
|
|
1684
|
+
* and close. Its buttons keep focus while used; Enter in the field steps to the next match,
|
|
1685
|
+
* Shift+Enter to the previous, Escape closes. Closing returns focus to where it was before the
|
|
1686
|
+
* bar opened, else to the document.
|
|
1687
|
+
*/
|
|
1688
|
+
export declare function createFindBar(viewer: Viewer): HTMLElement;
|
|
1689
|
+
//#endregion
|
|
1690
|
+
//#region src/dom/search/find-key.d.ts
|
|
1691
|
+
/**
|
|
1692
|
+
* The text selected on the page inside `root`, on one line and trimmed; '' when there is none,
|
|
1693
|
+
* when it is not in `root`, when it is in the find bar, or when it is too long to be a query.
|
|
1694
|
+
*/
|
|
1695
|
+
export declare function pageSelectionText(root: HTMLElement): string;
|
|
1696
|
+
/**
|
|
1697
|
+
* Ctrl/Cmd+F on a viewer's root. Call it from a `keydown` listener on that root (it reads
|
|
1698
|
+
* `currentTarget`). Takes the key only when a find bar is mounted for this viewer and the event
|
|
1699
|
+
* comes from inside the root; otherwise the browser keeps it. Opens the search with the page selection as
|
|
1700
|
+
* the query, if there is one, and focuses and selects the field. Returns whether it took the key.
|
|
1701
|
+
*
|
|
1702
|
+
* @internal Shared with the framework bindings.
|
|
1703
|
+
*/
|
|
1704
|
+
export declare function handleFindKey(e: KeyboardEvent, controller: SearchController, selection: () => string): boolean;
|
|
1705
|
+
//#endregion
|
|
1706
|
+
//#region src/dom/search/find-text.d.ts
|
|
1707
|
+
/**
|
|
1708
|
+
* The count beside the field: "3 of 17", "3 of 12…" while scanning, "No results".
|
|
1709
|
+
*
|
|
1710
|
+
* @internal Shared with the framework bindings.
|
|
1711
|
+
*/
|
|
1712
|
+
export declare function findCountText(s: SearchState): string;
|
|
1713
|
+
/**
|
|
1714
|
+
* Returns the function a bar calls with each search state for its live region's text.
|
|
1715
|
+
*
|
|
1716
|
+
* A settled scan reads "Match 3 of 17, page 2" or "No results". While a scan runs it says
|
|
1717
|
+
* nothing until a step moves the current hit, then "Match 3 of 12 so far, page 2", and keeps
|
|
1718
|
+
* that text as more hits arrive, so the region speaks once per step and once on settle rather
|
|
1719
|
+
* than once per hit.
|
|
1720
|
+
*
|
|
1721
|
+
* @internal Shared with the framework bindings; each bar keeps its own.
|
|
1722
|
+
*/
|
|
1723
|
+
export declare function findAnnouncer(): (s: SearchState) => string;
|
|
1724
|
+
//#endregion
|
|
1181
1725
|
//#region src/dom/viewer/controls.d.ts
|
|
1182
1726
|
/**
|
|
1183
1727
|
* An `<svg>` drawing `icon` from `@inkbar/icons`, hidden from assistive technology: the
|
|
1184
1728
|
* control it sits in carries the name. The theme sizes it with `--ink-icon-size`.
|
|
1185
1729
|
*/
|
|
1186
1730
|
export declare function createIcon(icon: IconNode): SVGSVGElement;
|
|
1731
|
+
/**
|
|
1732
|
+
* Opens the viewer's find bar; pressed while it is open. Pressing it again focuses the field.
|
|
1733
|
+
* The bar itself is `createFindBar`.
|
|
1734
|
+
*/
|
|
1735
|
+
export declare function createSearchButton(viewer: Viewer): HTMLButtonElement;
|
|
1187
1736
|
/**
|
|
1188
1737
|
* A toolbar following the WAI-ARIA toolbar pattern: its buttons share one Tab stop, with
|
|
1189
1738
|
* arrow keys, Home and End to move between them. Fields and selects are Tab stops of their
|
|
@@ -1199,12 +1748,20 @@ export declare function createUndo(viewer: Viewer): HTMLButtonElement;
|
|
|
1199
1748
|
/** Redoes the last undone change; disabled when there is none. */
|
|
1200
1749
|
export declare function createRedo(viewer: Viewer): HTMLButtonElement;
|
|
1201
1750
|
/**
|
|
1202
|
-
* Sets the tool; pressed while it is the active one. A host tool's button
|
|
1203
|
-
*
|
|
1751
|
+
* Sets the tool; pressed while it is the active one. A host or plugin tool's button takes the
|
|
1752
|
+
* tool's own `label` and `icon`; `opts.label` wins, and without either it is named by the tool id.
|
|
1204
1753
|
*/
|
|
1205
1754
|
export declare function createToolButton(viewer: Viewer, tool: ToolId, opts?: {
|
|
1206
1755
|
label?: string;
|
|
1207
1756
|
}): HTMLButtonElement;
|
|
1757
|
+
/**
|
|
1758
|
+
* A plugin command as a button with its status text beside it. The button is named by the
|
|
1759
|
+
* command's label and disabled while the command is, except while it runs: then it keeps focus,
|
|
1760
|
+
* with `aria-busy` and `aria-disabled`, and a press does nothing. The status is a live region. A command without an icon shows its label as the button's text. For an id no
|
|
1761
|
+
* plugin registered it logs `InkError('UnknownCommand')` to the console and returns the same
|
|
1762
|
+
* markup disabled, `aria-hidden` and unnamed.
|
|
1763
|
+
*/
|
|
1764
|
+
export declare function createCommandButton(viewer: Viewer, id: string): HTMLElement;
|
|
1208
1765
|
export declare function createZoomIn(viewer: Viewer): HTMLButtonElement;
|
|
1209
1766
|
export declare function createZoomOut(viewer: Viewer): HTMLButtonElement;
|
|
1210
1767
|
/** Fit width, fit page and the zoom levels; a zoom between levels gets an option of its own. */
|
|
@@ -1411,5 +1968,5 @@ export declare function createSignatureDialog(viewer: Viewer, opts?: SignatureDi
|
|
|
1411
1968
|
export declare function createSignaturePreview(t: SignatureTemplate): HTMLElement;
|
|
1412
1969
|
export declare function createSignatureMenu(viewer: Viewer, opts?: SignatureDialogOptions): HTMLElement;
|
|
1413
1970
|
//#endregion
|
|
1414
|
-
export { type AnnotationDecoration, type AnnotationSlotProps, type AnnotationState, type ArrowheadChoice, type BuiltinToolId, type ColorMenuModel, type ColorMenuOptions, type ColorMenuSwatch, type ColorProperty, type ColorTrigger, type CreateViewerOptions, type CssLayout, type CssLayoutInput, type CssPageBox, type CssRect, type CurrentStyle, type DecorateAnnotation, type EditorCloseReason, type FocusReturn, type FocusReturnOptions, type FreeTextEditor, type FreeTextEditorOptions, type HighlightMenuItem, type HighlightMenuModel, type HighlightOptions, type LayoutMode, type LineStyleMenuItem, type LineStyleMenuModel, type LineStyleMenuSection, type MarkupKind, type Menu, type MenuOptions, type MountViewerOptions, type Overlay, type OverlayOptions, type PageHit, type PageLayer, type PageMount, type PageMountOptions, type PageRenderer, type PageRendererOptions, type PageTransform, type Palette, type Popover, type PopoverOptions, type ScopedToolStyle, type SelectionQuads, type ShapeKind, type ShapeMenuItem, type ShapeMenuModel, type ShapeOptions, 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 Viewport, type ViewportHit, type ViewportKeysOptions, type ViewportOptions, type ZoomValue, cssVariableDefaults };
|
|
1971
|
+
export { type AnnotationDecoration, type AnnotationInputOf, type AnnotationLink, type AnnotationLinkSpec, type AnnotationSlotProps, type AnnotationState, type ArrowheadChoice, type BuiltinToolId, type CardSpec, type ColorMenuModel, type ColorMenuOptions, type ColorMenuSwatch, type ColorProperty, type ColorTrigger, type Command, type CommandOptions, type CommandRun, type CommandSpec, type CreateViewerOptions, type CssLayout, type CssLayoutInput, type CssPageBox, type CssRect, type CurrentStyle, type DecorateAnnotation, type EditorCloseReason, type FocusReturn, type FocusReturnOptions, type FreeTextEditor, type FreeTextEditorOptions, type HighlightMenuItem, type HighlightMenuModel, type HighlightOptions, 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 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 };
|
|
1415
1972
|
//# sourceMappingURL=dom.d.mts.map
|