html-flip-book-vanilla 0.0.0-alpha.52 → 0.0.0-alpha.53

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.
@@ -2,6 +2,7 @@ type Edge = "top" | "right" | "bottom" | "left";
2
2
  export declare class BookmarkPreview {
3
3
  private readonly storage;
4
4
  private readonly element;
5
+ private readonly clipBoundary;
5
6
  private source;
6
7
  private content;
7
8
  private placeholder;
@@ -22,12 +23,15 @@ export declare class BookmarkPreview {
22
23
  leave(target: EventTarget | null): void;
23
24
  close(immediate?: boolean): void;
24
25
  destroy(): void;
26
+ private readonly escapeKey;
25
27
  private resume;
26
28
  private pointerLeave;
27
29
  private restore;
28
30
  private reserveSlot;
29
31
  private setBounds;
30
32
  private setPosition;
33
+ private protectPage;
34
+ private edgeInset;
31
35
  private clip;
32
36
  private place;
33
37
  private outsideFriends;
@@ -1 +1 @@
1
- {"version":3,"file":"bookmark-preview.d.ts","sourceRoot":"","sources":["../src/bookmark-preview.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAIhD,qBAAa,eAAe;IAkB1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAjBzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,QAAQ,C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MAAM,eAAe,EAAE,iBAAiB,EAS9C,CAAC"}
1
+ {"version":3,"file":"default-commands.d.ts","sourceRoot":"","sources":["../../src/commands/default-commands.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKjD,eAAO,MAAM,eAAe,EAAE,iBAAiB,EAU9C,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const fullscreenStateEvents: readonly string[];
2
+ export declare function getFullscreenElement(): Element | null;
3
+ export declare function canUseFullscreen(target?: HTMLElement | null): boolean;
4
+ export declare function requestFullscreen(target: HTMLElement): Promise<void>;
5
+ export declare function exitFullscreen(): Promise<void>;
6
+ //# sourceMappingURL=fullscreen-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullscreen-utils.d.ts","sourceRoot":"","sources":["../../src/commands/fullscreen-utils.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAKlD,CAAC;AAGF,wBAAgB,oBAAoB,IAAI,OAAO,GAAG,IAAI,CAGrD;AAQD,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAMrE;AAGD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAW1E;AAGD,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CASpD"}
@@ -0,0 +1,12 @@
1
+ import type { CommandContext, CommandRegistry, HotkeyBinding, ToggleCommandDefinition } from "./types";
2
+ export declare class HoldHotkeyController {
3
+ private held;
4
+ has(commandId: string): boolean;
5
+ press(command: ToggleCommandDefinition, binding: HotkeyBinding, context: CommandContext): boolean;
6
+ release(event: KeyboardEvent, direction: "ltr" | "rtl"): boolean;
7
+ reconcile(registry: CommandRegistry, disabled: boolean): boolean;
8
+ private isRegistered;
9
+ clear(): boolean;
10
+ private removeBindings;
11
+ }
12
+ //# sourceMappingURL=hold-hotkeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hold-hotkeys.d.ts","sourceRoot":"","sources":["../../src/commands/hold-hotkeys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,cAAc,EACd,eAAe,EACf,aAAa,EACb,uBAAuB,EACvB,MAAM,SAAS,CAAC;AA8BjB,qBAAa,oBAAoB;IAChC,OAAO,CAAC,IAAI,CAAiC;IAE7C,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI/B,KAAK,CACJ,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,cAAc,GACrB,OAAO;IAeV,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO;IAKhE,SAAS,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO;IAKhE,OAAO,CAAC,YAAY;IAWpB,KAAK,IAAI,OAAO;IAIhB,OAAO,CAAC,cAAc;CAiBtB"}
@@ -1,4 +1,5 @@
1
1
  import type { HotkeyBinding } from "./types";
2
2
  export declare function getEffectiveKey(key: string, direction: "ltr" | "rtl"): string;
3
3
  export declare function hotkeyMatches(binding: HotkeyBinding, event: KeyboardEvent, direction: "ltr" | "rtl"): boolean;
4
+ export declare function hotkeyReleased(binding: HotkeyBinding, event: KeyboardEvent, direction: "ltr" | "rtl"): boolean;
4
5
  //# sourceMappingURL=hotkey-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hotkey-utils.d.ts","sourceRoot":"","sources":["../../src/commands/hotkey-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAK7E;AAMD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,KAAK,GAAG,KAAK,GACtB,OAAO,CAWT"}
1
+ {"version":3,"file":"hotkey-utils.d.ts","sourceRoot":"","sources":["../../src/commands/hotkey-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAK7E;AAMD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,KAAK,GAAG,KAAK,GACtB,OAAO,CAWT;AAaD,wBAAgB,cAAc,CAC7B,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,KAAK,GAAG,KAAK,GACtB,OAAO,CAMT"}
@@ -2,11 +2,14 @@ export { defaultCommands } from "./default-commands";
2
2
  export { downloadCommand } from "./download-command";
3
3
  export { flipNextCommand } from "./flip-next-command";
4
4
  export { flipPrevCommand } from "./flip-prev-command";
5
+ export { canUseFullscreen, exitFullscreen, fullscreenStateEvents, getFullscreenElement, requestFullscreen, } from "./fullscreen-utils";
5
6
  export { goToFirstCommand } from "./go-to-first-command";
6
7
  export { goToLastCommand } from "./go-to-last-command";
7
8
  export { goToTocCommand } from "./go-to-toc-command";
8
- export { getEffectiveKey, hotkeyMatches } from "./hotkey-utils";
9
+ export { HoldHotkeyController } from "./hold-hotkeys";
10
+ export { getEffectiveKey, hotkeyMatches, hotkeyReleased } from "./hotkey-utils";
9
11
  export { toggleDebugCommand } from "./toggle-debug-command";
10
12
  export { toggleFullscreenCommand } from "./toggle-fullscreen-command";
11
- export type { Command, CommandContext, CommandData, CommandDefinition, CommandOptions, CommandRegistry, FlipBookHandleLike, FlipNavCommand, HotkeyBinding, JumpNavCommand, NavCommand, } from "./types";
13
+ export { toggleTextSelectionCommand } from "./toggle-text-selection-command";
14
+ export type { ActionCommandDefinition, Command, CommandContext, CommandData, CommandDefinition, CommandOptions, CommandRegistry, FlipBookHandleLike, FlipNavCommand, HotkeyBinding, JumpNavCommand, NavCommand, ToggleCommandDefinition, } from "./types";
12
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,YAAY,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,GACV,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,YAAY,EACX,uBAAuB,EACvB,OAAO,EACP,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACV,uBAAuB,GACvB,MAAM,SAAS,CAAC"}
@@ -1,5 +1,5 @@
1
- import { getTocPageIndex as a } from "../store/index.js";
2
- const r = {
1
+ import { getTocPageIndex as u } from "../store/index.js";
2
+ const y = {
3
3
  id: "download",
4
4
  enName: "Download",
5
5
  enDescription: "Download entire book or page range",
@@ -12,124 +12,265 @@ const r = {
12
12
  );
13
13
  },
14
14
  canExecute: (e) => typeof e.data?.onDownload == "function"
15
- }, c = [
15
+ }, p = [
16
16
  { key: "ArrowRight" },
17
17
  { key: "PageDown" },
18
18
  { key: " " }
19
19
  // Space
20
- ], d = {
20
+ ], k = {
21
21
  id: "flipNext",
22
22
  navKind: "flip",
23
23
  enName: "Next Page",
24
24
  enDescription: "Flip to the next page",
25
25
  nameKey: "command.jumpToNextPage",
26
- hotkeys: c,
26
+ hotkeys: p,
27
27
  execute: (e) => {
28
28
  e.handle?.flipNext();
29
29
  },
30
30
  canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) < (e.handle?.getTotalPages() ?? 0) - 1
31
- }, l = [{ key: "ArrowLeft" }, { key: "PageUp" }], s = {
31
+ }, v = [{ key: "ArrowLeft" }, { key: "PageUp" }], w = {
32
32
  id: "flipPrev",
33
33
  navKind: "flip",
34
34
  enName: "Previous Page",
35
35
  enDescription: "Flip to the previous page",
36
36
  nameKey: "command.jumpToPrevPage",
37
- hotkeys: l,
37
+ hotkeys: v,
38
38
  execute: (e) => {
39
39
  e.handle?.flipPrev();
40
40
  },
41
41
  canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
42
- }, i = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], u = {
42
+ }, x = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], T = {
43
43
  id: "goToFirst",
44
44
  navKind: "jump",
45
45
  enName: "First Page",
46
46
  enDescription: "Jump to the first page",
47
47
  nameKey: "command.jumpToFirstPage",
48
- hotkeys: i,
48
+ hotkeys: x,
49
49
  execute: (e) => {
50
50
  e.handle?.jumpToPage(0);
51
51
  },
52
52
  canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
53
- }, m = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], g = {
53
+ }, F = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], P = {
54
54
  id: "goToLast",
55
55
  navKind: "jump",
56
56
  enName: "Last Page",
57
57
  enDescription: "Jump to the last page",
58
58
  nameKey: "command.jumpToLastPage",
59
- hotkeys: m,
59
+ hotkeys: F,
60
60
  execute: (e) => {
61
61
  const t = e.handle?.getTotalPages() ?? 0;
62
62
  e.handle?.jumpToPage(t - 1);
63
63
  },
64
64
  canExecute: (e) => {
65
- const t = e.handle?.getCurrentPageIndex() ?? 0, o = e.handle?.getTotalPages() ?? 0;
66
- return t !== o - 1;
65
+ const t = e.handle?.getCurrentPageIndex() ?? 0, n = e.handle?.getTotalPages() ?? 0;
66
+ return t !== n - 1;
67
67
  }
68
- }, f = [{ key: "t" }], h = {
68
+ }, K = [{ key: "t" }], A = {
69
69
  id: "goToToc",
70
70
  navKind: "jump",
71
71
  enName: "Table of Contents",
72
72
  enDescription: "Jump to the table of contents",
73
73
  nameKey: "command.jumpToToc",
74
- hotkeys: f,
74
+ hotkeys: K,
75
75
  execute: (e) => {
76
- const t = e.handle?.getTocPageIndex?.() ?? a();
76
+ const t = e.handle?.getTocPageIndex?.() ?? u();
77
77
  e.handle?.jumpToPage(t);
78
78
  },
79
79
  canExecute: (e) => {
80
- const t = e.handle?.getTocPageIndex?.() ?? a();
80
+ const t = e.handle?.getTocPageIndex?.() ?? u();
81
81
  return e.handle?.getCurrentPageIndex() !== t;
82
82
  }
83
- }, p = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], y = {
83
+ }, C = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], D = {
84
84
  id: "toggleDebug",
85
85
  enName: "Toggle Debug Toolbar",
86
86
  enDescription: "Show or hide the debug toolbar (Ctrl+Alt+D)",
87
87
  nameKey: "command.toggleDebug",
88
88
  descriptionKey: "command.toggleDebugDesc",
89
- hotkeys: p,
89
+ hotkeys: C,
90
90
  execute: (e) => {
91
91
  e.handle?.toggleDebugBar?.();
92
92
  }
93
- }, P = [{ key: "F11" }], T = {
93
+ }, i = () => document, L = [
94
+ "fullscreenchange",
95
+ "webkitfullscreenchange",
96
+ "fullscreenerror",
97
+ "webkitfullscreenerror"
98
+ ];
99
+ function d() {
100
+ return typeof document > "u" ? null : i().fullscreenElement ?? i().webkitFullscreenElement ?? null;
101
+ }
102
+ function m(e) {
103
+ if (typeof document > "u") return !1;
104
+ const t = e ?? i().documentElement;
105
+ return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != "function" ? !1 : (i().fullscreenEnabled ?? i().webkitFullscreenEnabled) !== !1;
106
+ }
107
+ async function b(e) {
108
+ const t = e;
109
+ if (t.requestFullscreen) {
110
+ await t.requestFullscreen();
111
+ return;
112
+ }
113
+ if (t.webkitRequestFullscreen) {
114
+ t.webkitRequestFullscreen();
115
+ return;
116
+ }
117
+ throw new Error("Fullscreen API is not available");
118
+ }
119
+ async function E() {
120
+ const e = i();
121
+ if (e.exitFullscreen) {
122
+ await e.exitFullscreen();
123
+ return;
124
+ }
125
+ e.webkitExitFullscreen && e.webkitExitFullscreen();
126
+ }
127
+ const M = [{ key: "F11" }], a = {
94
128
  id: "toggleFullscreen",
129
+ kind: "toggle",
95
130
  enName: "Toggle Fullscreen",
96
131
  enDescription: "Enter or exit fullscreen mode",
97
132
  nameKey: "command.toggleFullscreen",
98
133
  descriptionKey: "command.toggleFullscreenDesc",
99
- hotkeys: P,
134
+ hotkeys: M,
135
+ canExecute: (e) => m(e.data?.getFullscreenTarget?.()),
136
+ isActive: () => d() !== null,
137
+ setActive: (e, t) => {
138
+ const n = d();
139
+ if (t) {
140
+ if (n) return;
141
+ const o = e.data?.getFullscreenTarget?.() ?? document.documentElement;
142
+ if (!m(o)) return !1;
143
+ b(o).catch(console.warn);
144
+ return;
145
+ }
146
+ n && E().catch(console.warn);
147
+ },
148
+ execute: (e) => a.setActive(e, !a.isActive(e))
149
+ }, c = {
150
+ id: "toggleTextSelection",
151
+ kind: "toggle",
152
+ enName: "Select Text",
153
+ enDescription: "Toggle text selection; hold Ctrl to temporarily turn pages instead",
154
+ hotkeys: [{ key: "Control", mode: "hold", active: !1 }],
155
+ canExecute: (e) => !!(e.handle?.getMouseMode && e.handle?.setMouseMode),
156
+ isActive: (e) => e.handle?.getMouseMode?.() === "select",
157
+ setActive: (e, t) => {
158
+ if (!e.handle?.setMouseMode) return !1;
159
+ const n = t ? "select" : "turn";
160
+ e.transient ? e.handle.setMouseMode(n, { persist: !1 }) : e.handle.setMouseMode(n);
161
+ },
100
162
  execute: (e) => {
101
- const t = e.data;
102
- document.fullscreenElement ? document.exitFullscreen().catch(console.warn) : (t?.getFullscreenTarget?.() ?? document.documentElement).requestFullscreen().catch(console.warn);
163
+ const t = c.setActive(
164
+ e,
165
+ !c.isActive(e)
166
+ );
167
+ return t !== !1 && window.getSelection()?.removeAllRanges(), t;
103
168
  }
104
- }, K = [
105
- d,
106
- s,
107
- u,
108
- g,
109
- h,
169
+ }, q = [
170
+ k,
171
+ w,
110
172
  T,
111
- y,
112
- r
173
+ P,
174
+ A,
175
+ a,
176
+ D,
177
+ c,
178
+ y
113
179
  ];
114
- function k(e, t) {
180
+ function g(e, t) {
115
181
  return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
116
182
  }
117
- function w(e, t, o) {
118
- if (k(t.key, o) !== e.key) return !1;
183
+ function B(e, t, n) {
184
+ if (g(t.key, n) !== e.key) return !1;
185
+ const r = e.modifiers ?? {};
186
+ return !(e.key !== "Control" && !!r.ctrl !== t.ctrlKey || e.key !== "Shift" && !!r.shift !== t.shiftKey || e.key !== "Alt" && !!r.alt !== t.altKey || e.key !== "Meta" && !!r.meta !== t.metaKey);
187
+ }
188
+ function N(e, t) {
119
189
  const n = e.modifiers ?? {};
120
- return !(!!n.ctrl !== t.ctrlKey || !!n.shift !== t.shiftKey || !!n.alt !== t.altKey || !!n.meta !== t.metaKey);
190
+ return [
191
+ n.ctrl && !t.ctrlKey,
192
+ n.shift && !t.shiftKey,
193
+ n.alt && !t.altKey,
194
+ n.meta && !t.metaKey
195
+ ].some(Boolean);
196
+ }
197
+ function I(e, t, n) {
198
+ const o = g(t.key, n);
199
+ return o === e.key || o.length === 1 && o.toLowerCase() === e.key.toLowerCase() ? !0 : N(e, t);
200
+ }
201
+ function R(e, t) {
202
+ const n = e.modifiers ?? {}, o = t.modifiers ?? {};
203
+ return [
204
+ !!n.ctrl == !!o.ctrl,
205
+ !!n.shift == !!o.shift,
206
+ !!n.alt == !!o.alt,
207
+ !!n.meta == !!o.meta
208
+ ].every(Boolean);
209
+ }
210
+ function f(e, t) {
211
+ return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) && R(e, t);
212
+ }
213
+ class S {
214
+ held = /* @__PURE__ */ new Map();
215
+ has(t) {
216
+ return this.held.has(t);
217
+ }
218
+ press(t, n, o) {
219
+ const r = this.held.get(t.id);
220
+ if (r?.bindings.some((l) => f(l, n))) return !1;
221
+ const s = r ?? {
222
+ command: t,
223
+ context: { ...o, transient: !0 },
224
+ initial: t.isActive(o),
225
+ bindings: []
226
+ };
227
+ return t.setActive(s.context, n.active ?? !0) === !1 ? !1 : (s.bindings.push(n), this.held.set(t.id, s), !0);
228
+ }
229
+ release(t, n) {
230
+ return this.removeBindings((o) => I(o, t, n));
231
+ }
232
+ /** Restore removed/disabled bindings without interrupting holds on ordinary rerenders. */
233
+ reconcile(t, n) {
234
+ return n ? this.clear() : this.removeBindings((o, r) => !this.isRegistered(o, r, t));
235
+ }
236
+ isRegistered(t, n, o) {
237
+ const r = o[n.command.id];
238
+ return !r || r.options.disableHotkeys || r.command !== n.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((l) => f(l, t));
239
+ }
240
+ clear() {
241
+ return this.removeBindings(() => !0);
242
+ }
243
+ removeBindings(t) {
244
+ let n = !1;
245
+ for (const [o, r] of this.held) {
246
+ const s = r.bindings.filter((h) => !t(h, r));
247
+ if (s.length === r.bindings.length) continue;
248
+ n = !0, r.bindings = s;
249
+ const l = s.length ? s[s.length - 1].active ?? !0 : r.initial;
250
+ r.command.setActive(r.context, l), s.length || this.held.delete(o);
251
+ }
252
+ return n;
253
+ }
121
254
  }
122
255
  export {
123
- K as defaultCommands,
124
- r as downloadCommand,
125
- d as flipNextCommand,
126
- s as flipPrevCommand,
127
- k as getEffectiveKey,
128
- u as goToFirstCommand,
129
- g as goToLastCommand,
130
- h as goToTocCommand,
131
- w as hotkeyMatches,
132
- y as toggleDebugCommand,
133
- T as toggleFullscreenCommand
256
+ S as HoldHotkeyController,
257
+ m as canUseFullscreen,
258
+ q as defaultCommands,
259
+ y as downloadCommand,
260
+ E as exitFullscreen,
261
+ k as flipNextCommand,
262
+ w as flipPrevCommand,
263
+ L as fullscreenStateEvents,
264
+ g as getEffectiveKey,
265
+ d as getFullscreenElement,
266
+ T as goToFirstCommand,
267
+ P as goToLastCommand,
268
+ A as goToTocCommand,
269
+ B as hotkeyMatches,
270
+ I as hotkeyReleased,
271
+ b as requestFullscreen,
272
+ D as toggleDebugCommand,
273
+ a as toggleFullscreenCommand,
274
+ c as toggleTextSelectionCommand
134
275
  };
135
276
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/commands/download-command.ts","../../src/commands/flip-next-command.ts","../../src/commands/flip-prev-command.ts","../../src/commands/go-to-first-command.ts","../../src/commands/go-to-last-command.ts","../../src/commands/go-to-toc-command.ts","../../src/commands/toggle-debug-command.ts","../../src/commands/toggle-fullscreen-command.ts","../../src/commands/default-commands.ts","../../src/commands/hotkey-utils.ts"],"sourcesContent":["import type { CommandDefinition } from \"./types\";\n\n/**\n * Download command: the dropdown (or other UI) can call it with nothing or with from/to.\n * Execute invokes data.onDownload(from, to); actual behavior is wired by the upper layer (e.g. React).\n * No hotkeys here; \"open download menu\" (e.g. Ctrl+S) is implemented in the upper layer.\n */\nexport const downloadCommand: CommandDefinition = {\n\tid: \"download\",\n\tenName: \"Download\",\n\tenDescription: \"Download entire book or page range\",\n\tnameKey: \"toolbarItem.download\",\n\thotkeys: [],\n\texecute: (ctx) => {\n\t\tctx.data?.onDownload?.(\n\t\t\tctx.data?.from as number | undefined,\n\t\t\tctx.data?.to as number | undefined,\n\t\t);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => typeof ctx.data?.onDownload === \"function\",\n};\n","import type { FlipNavCommand, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [\n\t{ key: \"ArrowRight\" },\n\t{ key: \"PageDown\" },\n\t{ key: \" \" }, // Space\n];\n\nexport const flipNextCommand: FlipNavCommand = {\n\tid: \"flipNext\",\n\tnavKind: \"flip\",\n\tenName: \"Next Page\",\n\tenDescription: \"Flip to the next page\",\n\tnameKey: \"command.jumpToNextPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.flipNext();\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) =>\n\t\t(ctx.handle?.getCurrentPageIndex() ?? 0) < (ctx.handle?.getTotalPages() ?? 0) - 1,\n};\n","import type { FlipNavCommand, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"ArrowLeft\" }, { key: \"PageUp\" }];\n\nexport const flipPrevCommand: FlipNavCommand = {\n\tid: \"flipPrev\",\n\tnavKind: \"flip\",\n\tenName: \"Previous Page\",\n\tenDescription: \"Flip to the previous page\",\n\tnameKey: \"command.jumpToPrevPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.flipPrev();\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => (ctx.handle?.getCurrentPageIndex() ?? 0) > 0,\n};\n","import type { HotkeyBinding, JumpNavCommand } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"Home\" }, { key: \"ArrowLeft\", modifiers: { ctrl: true } }];\n\nexport const goToFirstCommand: JumpNavCommand = {\n\tid: \"goToFirst\",\n\tnavKind: \"jump\",\n\tenName: \"First Page\",\n\tenDescription: \"Jump to the first page\",\n\tnameKey: \"command.jumpToFirstPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.jumpToPage(0);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => ctx.handle?.getCurrentPageIndex() !== 0,\n};\n","import type { HotkeyBinding, JumpNavCommand } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"End\" }, { key: \"ArrowRight\", modifiers: { ctrl: true } }];\n\nexport const goToLastCommand: JumpNavCommand = {\n\tid: \"goToLast\",\n\tnavKind: \"jump\",\n\tenName: \"Last Page\",\n\tenDescription: \"Jump to the last page\",\n\tnameKey: \"command.jumpToLastPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tconst total = ctx.handle?.getTotalPages() ?? 0;\n\t\tctx.handle?.jumpToPage(total - 1);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => {\n\t\tconst current = ctx.handle?.getCurrentPageIndex() ?? 0;\n\t\tconst total = ctx.handle?.getTotalPages() ?? 0;\n\t\treturn current !== total - 1;\n\t},\n};\n","import { getTocPageIndex } from \"../store\";\nimport type { HotkeyBinding, JumpNavCommand } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"t\" }];\n\nexport const goToTocCommand: JumpNavCommand = {\n\tid: \"goToToc\",\n\tnavKind: \"jump\",\n\tenName: \"Table of Contents\",\n\tenDescription: \"Jump to the table of contents\",\n\tnameKey: \"command.jumpToToc\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tconst tocIndex = ctx.handle?.getTocPageIndex?.() ?? getTocPageIndex();\n\t\tctx.handle?.jumpToPage(tocIndex);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => {\n\t\tconst tocIndex = ctx.handle?.getTocPageIndex?.() ?? getTocPageIndex();\n\t\treturn ctx.handle?.getCurrentPageIndex() !== tocIndex;\n\t},\n};\n","import type { CommandDefinition, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"d\", modifiers: { ctrl: true, alt: true } }];\n\nexport const toggleDebugCommand: CommandDefinition = {\n\tid: \"toggleDebug\",\n\tenName: \"Toggle Debug Toolbar\",\n\tenDescription: \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n\tnameKey: \"command.toggleDebug\",\n\tdescriptionKey: \"command.toggleDebugDesc\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.toggleDebugBar?.();\n\t\treturn undefined;\n\t},\n};\n","import type { CommandDefinition, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"F11\" }];\n\nexport const toggleFullscreenCommand: CommandDefinition = {\n\tid: \"toggleFullscreen\",\n\tenName: \"Toggle Fullscreen\",\n\tenDescription: \"Enter or exit fullscreen mode\",\n\tnameKey: \"command.toggleFullscreen\",\n\tdescriptionKey: \"command.toggleFullscreenDesc\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tconst data = ctx.data;\n\t\tif (document.fullscreenElement) {\n\t\t\tdocument.exitFullscreen().catch(console.warn);\n\t\t} else {\n\t\t\tconst target = data?.getFullscreenTarget?.() ?? document.documentElement;\n\t\t\ttarget.requestFullscreen().catch(console.warn);\n\t\t}\n\t\treturn undefined;\n\t},\n};\n","import { downloadCommand } from \"./download-command\";\nimport { flipNextCommand } from \"./flip-next-command\";\nimport { flipPrevCommand } from \"./flip-prev-command\";\nimport { goToFirstCommand } from \"./go-to-first-command\";\nimport { goToLastCommand } from \"./go-to-last-command\";\nimport { goToTocCommand } from \"./go-to-toc-command\";\nimport { toggleDebugCommand } from \"./toggle-debug-command\";\nimport { toggleFullscreenCommand } from \"./toggle-fullscreen-command\";\nimport type { CommandDefinition } from \"./types\";\n\n/**\n * Built-in commands (definitions). Hotkeys are 1:1 with each command (see command.hotkeys).\n */\nexport const defaultCommands: CommandDefinition[] = [\n\tflipNextCommand,\n\tflipPrevCommand,\n\tgoToFirstCommand,\n\tgoToLastCommand,\n\tgoToTocCommand,\n\ttoggleFullscreenCommand,\n\ttoggleDebugCommand,\n\tdownloadCommand,\n];\n","import type { HotkeyBinding } from \"./types\";\n\n/**\n * For RTL: arrow keys perform the opposite (ArrowLeft -> next, ArrowRight -> prev).\n * Returns the key to use when matching against command bindings.\n */\nexport function getEffectiveKey(key: string, direction: \"ltr\" | \"rtl\"): string {\n\tif (direction !== \"rtl\") return key;\n\tif (key === \"ArrowLeft\") return \"ArrowRight\";\n\tif (key === \"ArrowRight\") return \"ArrowLeft\";\n\treturn key;\n}\n\n/**\n * Check if a hotkey binding matches a keyboard event.\n * When direction is rtl, ArrowLeft/Right are matched as their opposite for flip prev/next.\n */\nexport function hotkeyMatches(\n\tbinding: HotkeyBinding,\n\tevent: KeyboardEvent,\n\tdirection: \"ltr\" | \"rtl\",\n): boolean {\n\tconst effectiveKey = getEffectiveKey(event.key, direction);\n\tif (effectiveKey !== binding.key) return false;\n\n\tconst modifiers = binding.modifiers ?? {};\n\tif (!!modifiers.ctrl !== event.ctrlKey) return false;\n\tif (!!modifiers.shift !== event.shiftKey) return false;\n\tif (!!modifiers.alt !== event.altKey) return false;\n\tif (!!modifiers.meta !== event.metaKey) return false;\n\n\treturn true;\n}\n"],"names":["downloadCommand","ctx","hotkeys","flipNextCommand","flipPrevCommand","goToFirstCommand","goToLastCommand","total","current","goToTocCommand","tocIndex","getTocPageIndex","toggleDebugCommand","toggleFullscreenCommand","data","defaultCommands","getEffectiveKey","key","direction","hotkeyMatches","binding","event","modifiers"],"mappings":";AAOO,MAAMA,IAAqC;AAAA,EACjD,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,SAAS;AAAA,EACT,SAAS,CAAA;AAAA,EACT,SAAS,CAACC,MAAQ;AACjB,IAAAA,EAAI,MAAM;AAAA,MACTA,EAAI,MAAM;AAAA,MACVA,EAAI,MAAM;AAAA,IAAA;AAAA,EAGZ;AAAA,EACA,YAAY,CAACA,MAAQ,OAAOA,EAAI,MAAM,cAAe;AACtD,GCnBMC,IAA2B;AAAA,EAChC,EAAE,KAAK,aAAA;AAAA,EACP,EAAE,KAAK,WAAA;AAAA,EACP,EAAE,KAAK,IAAA;AAAA;AACR,GAEaC,IAAkC;AAAA,EAC9C,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,SAAS;AAAA,EAAA,SACTD;AAAAA,EACA,SAAS,CAACD,MAAQ;AACjB,IAAAA,EAAI,QAAQ,SAAA;AAAA,EAEb;AAAA,EACA,YAAY,CAACA,OACXA,EAAI,QA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AAA,EACAD;AAAA,EACAZ;AACD;AChBO,SAASgB,EAAgBC,GAAaC,GAAkC;AAC9E,SAAIA,MAAc,QAAcD,IAC5BA,MAAQ,cAAoB,eAC5BA,MAAQ,eAAqB,cAC1BA;AACR;AAMO,SAASE,EACfC,GACAC,GACAH,GACU;AAEV,MADqBF,EAAgBK,EAAM,KAAKH,CAAS,MACpCE,EAAQ,IAAK,QAAO;AAEzC,QAAME,IAAYF,EAAQ,aAAa,CAAA;AAIvC,SAHI,GAAC,CAACE,EAAU,SAASD,EAAM,WAC3B,CAAC,CAACC,EAAU,UAAUD,EAAM,YAC5B,CAAC,CAACC,EAAU,QAAQD,EAAM,UAC1B,CAAC,CAACC,EAAU,SAASD,EAAM;AAGhC;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/commands/download-command.ts","../../src/commands/flip-next-command.ts","../../src/commands/flip-prev-command.ts","../../src/commands/go-to-first-command.ts","../../src/commands/go-to-last-command.ts","../../src/commands/go-to-toc-command.ts","../../src/commands/toggle-debug-command.ts","../../src/commands/fullscreen-utils.ts","../../src/commands/toggle-fullscreen-command.ts","../../src/commands/toggle-text-selection-command.ts","../../src/commands/default-commands.ts","../../src/commands/hotkey-utils.ts","../../src/commands/hold-hotkeys.ts"],"sourcesContent":["import type { CommandDefinition } from \"./types\";\n\n/**\n * Download command: the dropdown (or other UI) can call it with nothing or with from/to.\n * Execute invokes data.onDownload(from, to); actual behavior is wired by the upper layer (e.g. React).\n * No hotkeys here; \"open download menu\" (e.g. Ctrl+S) is implemented in the upper layer.\n */\nexport const downloadCommand: CommandDefinition = {\n\tid: \"download\",\n\tenName: \"Download\",\n\tenDescription: \"Download entire book or page range\",\n\tnameKey: \"toolbarItem.download\",\n\thotkeys: [],\n\texecute: (ctx) => {\n\t\tctx.data?.onDownload?.(\n\t\t\tctx.data?.from as number | undefined,\n\t\t\tctx.data?.to as number | undefined,\n\t\t);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => typeof ctx.data?.onDownload === \"function\",\n};\n","import type { FlipNavCommand, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [\n\t{ key: \"ArrowRight\" },\n\t{ key: \"PageDown\" },\n\t{ key: \" \" }, // Space\n];\n\nexport const flipNextCommand: FlipNavCommand = {\n\tid: \"flipNext\",\n\tnavKind: \"flip\",\n\tenName: \"Next Page\",\n\tenDescription: \"Flip to the next page\",\n\tnameKey: \"command.jumpToNextPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.flipNext();\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) =>\n\t\t(ctx.handle?.getCurrentPageIndex() ?? 0) < (ctx.handle?.getTotalPages() ?? 0) - 1,\n};\n","import type { FlipNavCommand, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"ArrowLeft\" }, { key: \"PageUp\" }];\n\nexport const flipPrevCommand: FlipNavCommand = {\n\tid: \"flipPrev\",\n\tnavKind: \"flip\",\n\tenName: \"Previous Page\",\n\tenDescription: \"Flip to the previous page\",\n\tnameKey: \"command.jumpToPrevPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.flipPrev();\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => (ctx.handle?.getCurrentPageIndex() ?? 0) > 0,\n};\n","import type { HotkeyBinding, JumpNavCommand } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"Home\" }, { key: \"ArrowLeft\", modifiers: { ctrl: true } }];\n\nexport const goToFirstCommand: JumpNavCommand = {\n\tid: \"goToFirst\",\n\tnavKind: \"jump\",\n\tenName: \"First Page\",\n\tenDescription: \"Jump to the first page\",\n\tnameKey: \"command.jumpToFirstPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.jumpToPage(0);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => ctx.handle?.getCurrentPageIndex() !== 0,\n};\n","import type { HotkeyBinding, JumpNavCommand } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"End\" }, { key: \"ArrowRight\", modifiers: { ctrl: true } }];\n\nexport const goToLastCommand: JumpNavCommand = {\n\tid: \"goToLast\",\n\tnavKind: \"jump\",\n\tenName: \"Last Page\",\n\tenDescription: \"Jump to the last page\",\n\tnameKey: \"command.jumpToLastPage\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tconst total = ctx.handle?.getTotalPages() ?? 0;\n\t\tctx.handle?.jumpToPage(total - 1);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => {\n\t\tconst current = ctx.handle?.getCurrentPageIndex() ?? 0;\n\t\tconst total = ctx.handle?.getTotalPages() ?? 0;\n\t\treturn current !== total - 1;\n\t},\n};\n","import { getTocPageIndex } from \"../store\";\nimport type { HotkeyBinding, JumpNavCommand } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"t\" }];\n\nexport const goToTocCommand: JumpNavCommand = {\n\tid: \"goToToc\",\n\tnavKind: \"jump\",\n\tenName: \"Table of Contents\",\n\tenDescription: \"Jump to the table of contents\",\n\tnameKey: \"command.jumpToToc\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tconst tocIndex = ctx.handle?.getTocPageIndex?.() ?? getTocPageIndex();\n\t\tctx.handle?.jumpToPage(tocIndex);\n\t\treturn undefined;\n\t},\n\tcanExecute: (ctx) => {\n\t\tconst tocIndex = ctx.handle?.getTocPageIndex?.() ?? getTocPageIndex();\n\t\treturn ctx.handle?.getCurrentPageIndex() !== tocIndex;\n\t},\n};\n","import type { CommandDefinition, HotkeyBinding } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"d\", modifiers: { ctrl: true, alt: true } }];\n\nexport const toggleDebugCommand: CommandDefinition = {\n\tid: \"toggleDebug\",\n\tenName: \"Toggle Debug Toolbar\",\n\tenDescription: \"Show or hide the debug toolbar (Ctrl+Alt+D)\",\n\tnameKey: \"command.toggleDebug\",\n\tdescriptionKey: \"command.toggleDebugDesc\",\n\thotkeys,\n\texecute: (ctx) => {\n\t\tctx.handle?.toggleDebugBar?.();\n\t\treturn undefined;\n\t},\n};\n","/**\n * Fullscreen API helpers with vendor-prefix fallbacks (webkit/Safari).\n * Some engines (iOS Safari on iPhone) expose no element fullscreen API at all —\n * use canUseFullscreen to detect that and degrade gracefully.\n */\n\ninterface FullscreenDocument extends Document {\n\twebkitFullscreenEnabled?: boolean;\n\twebkitFullscreenElement?: Element | null;\n\twebkitExitFullscreen?: () => void;\n}\n\ninterface FullscreenElement extends HTMLElement {\n\twebkitRequestFullscreen?: () => void;\n}\n\nconst doc = (): FullscreenDocument => document as FullscreenDocument;\n\n/** Events that may change fullscreen state: standard + webkit, changes and rejected requests. */\nexport const fullscreenStateEvents: readonly string[] = [\n\t\"fullscreenchange\",\n\t\"webkitfullscreenchange\",\n\t\"fullscreenerror\",\n\t\"webkitfullscreenerror\",\n];\n\n/** Element currently in fullscreen (standard or vendor-prefixed), if any. SSR-safe. */\nexport function getFullscreenElement(): Element | null {\n\tif (typeof document === \"undefined\") return null;\n\treturn doc().fullscreenElement ?? doc().webkitFullscreenElement ?? null;\n}\n\n/**\n * Whether the target (default: the page root) can be made fullscreen.\n * Honors the standard/webkit fullscreenEnabled flag; where no flag exists the\n * capability check alone decides. False without a DOM (SSR) or on engines\n * lacking an element fullscreen request (e.g. iOS Safari).\n */\nexport function canUseFullscreen(target?: HTMLElement | null): boolean {\n\tif (typeof document === \"undefined\") return false;\n\tconst element = (target ?? doc().documentElement) as FullscreenElement;\n\tconst request = element.requestFullscreen ?? element.webkitRequestFullscreen;\n\tif (typeof request !== \"function\") return false;\n\treturn (doc().fullscreenEnabled ?? doc().webkitFullscreenEnabled) !== false;\n}\n\n/** Request fullscreen on the target via the standard or vendor-prefixed API. */\nexport async function requestFullscreen(target: HTMLElement): Promise<void> {\n\tconst el = target as FullscreenElement;\n\tif (el.requestFullscreen) {\n\t\tawait el.requestFullscreen();\n\t\treturn;\n\t}\n\tif (el.webkitRequestFullscreen) {\n\t\tel.webkitRequestFullscreen();\n\t\treturn;\n\t}\n\tthrow new Error(\"Fullscreen API is not available\");\n}\n\n/** Exit fullscreen via the standard or vendor-prefixed API. No-op when unsupported. */\nexport async function exitFullscreen(): Promise<void> {\n\tconst d = doc();\n\tif (d.exitFullscreen) {\n\t\tawait d.exitFullscreen();\n\t\treturn;\n\t}\n\tif (d.webkitExitFullscreen) {\n\t\td.webkitExitFullscreen();\n\t}\n}\n","import {\n\tcanUseFullscreen,\n\texitFullscreen,\n\tgetFullscreenElement,\n\trequestFullscreen,\n} from \"./fullscreen-utils\";\nimport type { HotkeyBinding, ToggleCommandDefinition } from \"./types\";\n\nconst hotkeys: HotkeyBinding[] = [{ key: \"F11\" }];\n\n/** Enter or exit fullscreen. Reports state so toolbar toggles and hold hotkeys stay in sync. */\nexport const toggleFullscreenCommand: ToggleCommandDefinition = {\n\tid: \"toggleFullscreen\",\n\tkind: \"toggle\",\n\tenName: \"Toggle Fullscreen\",\n\tenDescription: \"Enter or exit fullscreen mode\",\n\tnameKey: \"command.toggleFullscreen\",\n\tdescriptionKey: \"command.toggleFullscreenDesc\",\n\thotkeys,\n\tcanExecute: (ctx) => canUseFullscreen(ctx.data?.getFullscreenTarget?.()),\n\tisActive: () => getFullscreenElement() !== null,\n\tsetActive: (ctx, active) => {\n\t\tconst element = getFullscreenElement();\n\t\tif (active) {\n\t\t\tif (element) return undefined;\n\t\t\tconst target = ctx.data?.getFullscreenTarget?.() ?? document.documentElement;\n\t\t\tif (!canUseFullscreen(target)) return false;\n\t\t\trequestFullscreen(target).catch(console.warn);\n\t\t\treturn undefined;\n\t\t}\n\t\tif (!element) return undefined;\n\t\texitFullscreen().catch(console.warn);\n\t\treturn undefined;\n\t},\n\texecute: (ctx) => toggleFullscreenCommand.setActive(ctx, !toggleFullscreenCommand.isActive(ctx)),\n};\n","import type { ToggleCommandDefinition } from \"./types\";\n\n/** Select text normally; hold Ctrl to temporarily return to page turning. */\nexport const toggleTextSelectionCommand: ToggleCommandDefinition = {\n\tid: \"toggleTextSelection\",\n\tkind: \"toggle\",\n\tenName: \"Select Text\",\n\tenDescription: \"Toggle text selection; hold Ctrl to temporarily turn pages instead\",\n\thotkeys: [{ key: \"Control\", mode: \"hold\", active: false }],\n\tcanExecute: (ctx) => !!(ctx.handle?.getMouseMode && ctx.handle?.setMouseMode),\n\tisActive: (ctx) => ctx.handle?.getMouseMode?.() === \"select\",\n\tsetActive: (ctx, active) => {\n\t\tif (!ctx.handle?.setMouseMode) return false;\n\t\tconst mode = active ? \"select\" : \"turn\";\n\t\tif (ctx.transient) ctx.handle.setMouseMode(mode, { persist: false });\n\t\telse ctx.handle.setMouseMode(mode);\n\t\treturn undefined;\n\t},\n\texecute: (ctx) => {\n\t\tconst result = toggleTextSelectionCommand.setActive(\n\t\t\tctx,\n\t\t\t!toggleTextSelectionCommand.isActive(ctx),\n\t\t);\n\t\tif (result !== false) window.getSelection()?.removeAllRanges();\n\t\treturn result;\n\t},\n};\n","import { downloadCommand } from \"./download-command\";\nimport { flipNextCommand } from \"./flip-next-command\";\nimport { flipPrevCommand } from \"./flip-prev-command\";\nimport { goToFirstCommand } from \"./go-to-first-command\";\nimport { goToLastCommand } from \"./go-to-last-command\";\nimport { goToTocCommand } from \"./go-to-toc-command\";\nimport { toggleDebugCommand } from \"./toggle-debug-command\";\nimport { toggleFullscreenCommand } from \"./toggle-fullscreen-command\";\nimport { toggleTextSelectionCommand } from \"./toggle-text-selection-command\";\nimport type { CommandDefinition } from \"./types\";\n\n/**\n * Built-in commands (definitions). Hotkeys are 1:1 with each command (see command.hotkeys).\n */\nexport const defaultCommands: CommandDefinition[] = [\n\tflipNextCommand,\n\tflipPrevCommand,\n\tgoToFirstCommand,\n\tgoToLastCommand,\n\tgoToTocCommand,\n\ttoggleFullscreenCommand,\n\ttoggleDebugCommand,\n\ttoggleTextSelectionCommand,\n\tdownloadCommand,\n];\n","import type { HotkeyBinding } from \"./types\";\n\n/**\n * For RTL: arrow keys perform the opposite (ArrowLeft -> next, ArrowRight -> prev).\n * Returns the key to use when matching against command bindings.\n */\nexport function getEffectiveKey(key: string, direction: \"ltr\" | \"rtl\"): string {\n\tif (direction !== \"rtl\") return key;\n\tif (key === \"ArrowLeft\") return \"ArrowRight\";\n\tif (key === \"ArrowRight\") return \"ArrowLeft\";\n\treturn key;\n}\n\n/**\n * Check if a hotkey binding matches a keyboard event.\n * When direction is rtl, ArrowLeft/Right are matched as their opposite for flip prev/next.\n */\nexport function hotkeyMatches(\n\tbinding: HotkeyBinding,\n\tevent: KeyboardEvent,\n\tdirection: \"ltr\" | \"rtl\",\n): boolean {\n\tconst effectiveKey = getEffectiveKey(event.key, direction);\n\tif (effectiveKey !== binding.key) return false;\n\n\tconst modifiers = binding.modifiers ?? {};\n\tif (binding.key !== \"Control\" && !!modifiers.ctrl !== event.ctrlKey) return false;\n\tif (binding.key !== \"Shift\" && !!modifiers.shift !== event.shiftKey) return false;\n\tif (binding.key !== \"Alt\" && !!modifiers.alt !== event.altKey) return false;\n\tif (binding.key !== \"Meta\" && !!modifiers.meta !== event.metaKey) return false;\n\n\treturn true;\n}\n\nfunction hasReleasedModifier(binding: HotkeyBinding, event: KeyboardEvent): boolean {\n\tconst modifiers = binding.modifiers ?? {};\n\treturn [\n\t\tmodifiers.ctrl && !event.ctrlKey,\n\t\tmodifiers.shift && !event.shiftKey,\n\t\tmodifiers.alt && !event.altKey,\n\t\tmodifiers.meta && !event.metaKey,\n\t].some(Boolean);\n}\n\n/** Whether a keyup releases the primary key or any modifier required by a hold. */\nexport function hotkeyReleased(\n\tbinding: HotkeyBinding,\n\tevent: KeyboardEvent,\n\tdirection: \"ltr\" | \"rtl\",\n): boolean {\n\tconst key = getEffectiveKey(event.key, direction);\n\tif (key === binding.key) return true;\n\t// Shift may change a printable key's case before it is released.\n\tif (key.length === 1 && key.toLowerCase() === binding.key.toLowerCase()) return true;\n\treturn hasReleasedModifier(binding, event);\n}\n","import { hotkeyReleased } from \"./hotkey-utils\";\nimport type {\n\tCommandContext,\n\tCommandRegistry,\n\tHotkeyBinding,\n\tToggleCommandDefinition,\n} from \"./types\";\n\nfunction sameModifiers(a: HotkeyBinding, b: HotkeyBinding): boolean {\n\tconst left = a.modifiers ?? {};\n\tconst right = b.modifiers ?? {};\n\treturn [\n\t\t!!left.ctrl === !!right.ctrl,\n\t\t!!left.shift === !!right.shift,\n\t\t!!left.alt === !!right.alt,\n\t\t!!left.meta === !!right.meta,\n\t].every(Boolean);\n}\n\nfunction sameBinding(a: HotkeyBinding, b: HotkeyBinding): boolean {\n\treturn (\n\t\ta.key === b.key &&\n\t\ta.mode === b.mode &&\n\t\t(a.active ?? true) === (b.active ?? true) &&\n\t\tsameModifiers(a, b)\n\t);\n}\n\ninterface HeldToggle {\n\tcommand: ToggleCommandDefinition;\n\tcontext: CommandContext;\n\tinitial: boolean;\n\tbindings: HotkeyBinding[];\n}\n\n/** Tracks temporary toggle overrides independently of UI renders and keyboard repeat. */\nexport class HoldHotkeyController {\n\tprivate held = new Map<string, HeldToggle>();\n\n\thas(commandId: string): boolean {\n\t\treturn this.held.has(commandId);\n\t}\n\n\tpress(\n\t\tcommand: ToggleCommandDefinition,\n\t\tbinding: HotkeyBinding,\n\t\tcontext: CommandContext,\n\t): boolean {\n\t\tconst current = this.held.get(command.id);\n\t\tif (current?.bindings.some((b) => sameBinding(b, binding))) return false;\n\t\tconst held = current ?? {\n\t\t\tcommand,\n\t\t\tcontext: { ...context, transient: true },\n\t\t\tinitial: command.isActive(context),\n\t\t\tbindings: [],\n\t\t};\n\t\tif (command.setActive(held.context, binding.active ?? true) === false) return false;\n\t\theld.bindings.push(binding);\n\t\tthis.held.set(command.id, held);\n\t\treturn true;\n\t}\n\n\trelease(event: KeyboardEvent, direction: \"ltr\" | \"rtl\"): boolean {\n\t\treturn this.removeBindings((binding) => hotkeyReleased(binding, event, direction));\n\t}\n\n\t/** Restore removed/disabled bindings without interrupting holds on ordinary rerenders. */\n\treconcile(registry: CommandRegistry, disabled: boolean): boolean {\n\t\tif (disabled) return this.clear();\n\t\treturn this.removeBindings((binding, held) => !this.isRegistered(binding, held, registry));\n\t}\n\n\tprivate isRegistered(\n\t\tbinding: HotkeyBinding,\n\t\theld: HeldToggle,\n\t\tregistry: CommandRegistry,\n\t): boolean {\n\t\tconst entry = registry[held.command.id];\n\t\tif (!entry || entry.options.disableHotkeys || entry.command !== held.command) return false;\n\t\tconst bindings = entry.options.hotkeys ?? entry.command.hotkeys ?? [];\n\t\treturn bindings.some((b) => sameBinding(b, binding));\n\t}\n\n\tclear(): boolean {\n\t\treturn this.removeBindings(() => true);\n\t}\n\n\tprivate removeBindings(\n\t\tshouldRemove: (binding: HotkeyBinding, held: HeldToggle) => boolean,\n\t): boolean {\n\t\tlet changed = false;\n\t\tfor (const [id, held] of this.held) {\n\t\t\tconst remaining = held.bindings.filter((binding) => !shouldRemove(binding, held));\n\t\t\tif (remaining.length === held.bindings.length) continue;\n\t\t\tchanged = true;\n\t\t\theld.bindings = remaining;\n\t\t\tconst active = remaining.length\n\t\t\t\t? (remaining[remaining.length - 1].active ?? true)\n\t\t\t\t: held.initial;\n\t\t\theld.command.setActive(held.context, active);\n\t\t\tif (!remaining.length) this.held.delete(id);\n\t\t}\n\t\treturn changed;\n\t}\n}\n"],"names":["downloadCommand","ctx","hotkeys","flipNextCommand","flipPrevCommand","goToFirstCommand","goToLastCommand","total","current","goToTocCommand","tocIndex","getTocPageIndex","toggleDebugCommand","doc","fullscreenStateEvents","getFullscreenElement","canUseFullscreen","target","element","requestFullscreen","el","exitFullscreen","d","toggleFullscreenCommand","active","toggleTextSelectionCommand","mode","result","defaultCommands","getEffectiveKey","key","direction","hotkeyMatches","binding","event","modifiers","hasReleasedModifier","hotkeyReleased","sameModifiers","a","b","left","right","sameBinding","HoldHotkeyController","commandId","command","context","held","registry","disabled","entry","shouldRemove","changed","id","remaining"],"mappings":";AAOO,MAAMA,IAAqC;AAAA,EACjD,IAAI;AAAA,EACJ,QAAQ;AA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ASe,GAAMC,CAAQ,CAAC;AAAA,EAC1F;AAAA,EAEQ,aACPhB,GACAe,GACAC,GACU;AACV,UAAME,IAAQF,EAASD,EAAK,QAAQ,EAAE;AACtC,WAAI,CAACG,KAASA,EAAM,QAAQ,kBAAkBA,EAAM,YAAYH,EAAK,UAAgB,MACpEG,EAAM,QAAQ,WAAWA,EAAM,QAAQ,WAAW,CAAA,GACnD,KAAK,CAACX,MAAMG,EAAYH,GAAGP,CAAO,CAAC;AAAA,EACpD;AAAA,EAEA,QAAiB;AAChB,WAAO,KAAK,eAAe,MAAM,EAAI;AAAA,EACtC;AAAA,EAEQ,eACPmB,GACU;AACV,QAAIC,IAAU;AACd,eAAW,CAACC,GAAIN,CAAI,KAAK,KAAK,MAAM;AACnC,YAAMO,IAAYP,EAAK,SAAS,OAAO,CAACf,MAAY,CAACmB,EAAanB,GAASe,CAAI,CAAC;AAChF,UAAIO,EAAU,WAAWP,EAAK,SAAS,OAAQ;AAC/C,MAAAK,IAAU,IACVL,EAAK,WAAWO;AAChB,YAAM/B,IAAS+B,EAAU,SACrBA,EAAUA,EAAU,SAAS,CAAC,EAAE,UAAU,KAC3CP,EAAK;AACR,MAAAA,EAAK,QAAQ,UAAUA,EAAK,SAASxB,CAAM,GACtC+B,EAAU,UAAQ,KAAK,KAAK,OAAOD,CAAE;AAAA,IAC3C;AACA,WAAOD;AAAA,EACR;AACD;"}
@@ -1,3 +1,3 @@
1
- import type { CommandDefinition } from "./types";
2
- export declare const toggleFullscreenCommand: CommandDefinition;
1
+ import type { ToggleCommandDefinition } from "./types";
2
+ export declare const toggleFullscreenCommand: ToggleCommandDefinition;
3
3
  //# sourceMappingURL=toggle-fullscreen-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-fullscreen-command.d.ts","sourceRoot":"","sources":["../../src/commands/toggle-fullscreen-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,SAAS,CAAC;AAIhE,eAAO,MAAM,uBAAuB,EAAE,iBAiBrC,CAAC"}
1
+ {"version":3,"file":"toggle-fullscreen-command.d.ts","sourceRoot":"","sources":["../../src/commands/toggle-fullscreen-command.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAKtE,eAAO,MAAM,uBAAuB,EAAE,uBAwBrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToggleCommandDefinition } from "./types";
2
+ export declare const toggleTextSelectionCommand: ToggleCommandDefinition;
3
+ //# sourceMappingURL=toggle-text-selection-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-text-selection-command.d.ts","sourceRoot":"","sources":["../../src/commands/toggle-text-selection-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAGvD,eAAO,MAAM,0BAA0B,EAAE,uBAuBxC,CAAC"}
@@ -11,9 +11,15 @@ export interface FlipBookHandleLike {
11
11
  isLastPage: () => boolean;
12
12
  getDownloadConfig?: () => import("../download/types").DownloadConfig | undefined;
13
13
  getTocPageIndex?: () => number;
14
+ getMouseMode?: () => "turn" | "select";
15
+ setMouseMode?: (mode: "turn" | "select", options?: {
16
+ persist?: boolean;
17
+ }) => void;
14
18
  }
15
19
  export interface HotkeyBinding {
16
20
  key: string;
21
+ mode?: "press" | "hold";
22
+ active?: boolean;
17
23
  modifiers?: {
18
24
  ctrl?: boolean;
19
25
  shift?: boolean;
@@ -29,8 +35,9 @@ export interface CommandData {
29
35
  export interface CommandContext {
30
36
  handle: FlipBookHandleLike | null;
31
37
  data?: CommandData;
38
+ transient?: boolean;
32
39
  }
33
- export interface CommandDefinition {
40
+ interface CommandDefinitionBase {
34
41
  id: string;
35
42
  enName: string;
36
43
  enDescription?: string;
@@ -42,8 +49,17 @@ export interface CommandDefinition {
42
49
  execute: (context: CommandContext) => boolean | undefined;
43
50
  canExecute?: (context: CommandContext) => boolean;
44
51
  }
52
+ export interface ActionCommandDefinition extends CommandDefinitionBase {
53
+ kind?: "action";
54
+ }
55
+ export interface ToggleCommandDefinition extends CommandDefinitionBase {
56
+ kind: "toggle";
57
+ isActive: (context: CommandContext) => boolean;
58
+ setActive: (context: CommandContext, active: boolean) => boolean | undefined;
59
+ }
60
+ export type CommandDefinition = ActionCommandDefinition | ToggleCommandDefinition;
45
61
  export type Command = CommandDefinition & (() => void);
46
- export interface NavCommand extends CommandDefinition {
62
+ export interface NavCommand extends ActionCommandDefinition {
47
63
  navKind?: "jump" | "flip";
48
64
  }
49
65
  export interface JumpNavCommand extends NavCommand {
@@ -63,4 +79,5 @@ export interface CommandRegistry {
63
79
  options: CommandOptions;
64
80
  };
65
81
  }
82
+ export {};
66
83
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,mBAAmB,EAAE,MAAM,MAAM,CAAC;IAClC,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,UAAU,EAAE,MAAM,OAAO,CAAC;IAE1B,iBAAiB,CAAC,EAAE,MAAM,OAAO,mBAAmB,EAAE,cAAc,GAAG,SAAS,CAAC;IAEjF,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/B;AA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