@fuzdev/fuz_ui 0.201.0 → 0.203.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/dist/ApiIndex.svelte +6 -3
- package/dist/ApiIndex.svelte.d.ts +1 -1
- package/dist/ApiIndex.svelte.d.ts.map +1 -1
- package/dist/ApiModule.svelte +72 -21
- package/dist/ApiModule.svelte.d.ts +1 -1
- package/dist/ApiModule.svelte.d.ts.map +1 -1
- package/dist/ContextmenuEntry.svelte +11 -10
- package/dist/ContextmenuEntry.svelte.d.ts +1 -1
- package/dist/ContextmenuEntry.svelte.d.ts.map +1 -1
- package/dist/ContextmenuLinkEntry.svelte +30 -12
- package/dist/ContextmenuLinkEntry.svelte.d.ts +2 -1
- package/dist/ContextmenuLinkEntry.svelte.d.ts.map +1 -1
- package/dist/ContextmenuMenu.svelte +207 -0
- package/dist/ContextmenuMenu.svelte.d.ts +41 -0
- package/dist/ContextmenuMenu.svelte.d.ts.map +1 -0
- package/dist/ContextmenuRoot.svelte +58 -260
- package/dist/ContextmenuRoot.svelte.d.ts +2 -60
- package/dist/ContextmenuRoot.svelte.d.ts.map +1 -1
- package/dist/ContextmenuRootForSafariCompatibility.svelte +72 -283
- package/dist/ContextmenuRootForSafariCompatibility.svelte.d.ts +2 -58
- package/dist/ContextmenuRootForSafariCompatibility.svelte.d.ts.map +1 -1
- package/dist/ContextmenuSeparator.svelte +2 -1
- package/dist/ContextmenuSeparator.svelte.d.ts.map +1 -1
- package/dist/ContextmenuSubmenu.svelte +27 -23
- package/dist/ContextmenuSubmenu.svelte.d.ts +1 -1
- package/dist/ContextmenuSubmenu.svelte.d.ts.map +1 -1
- package/dist/ContextmenuTextEntry.svelte +7 -3
- package/dist/ContextmenuTextEntry.svelte.d.ts +2 -1
- package/dist/ContextmenuTextEntry.svelte.d.ts.map +1 -1
- package/dist/CopyToClipboard.svelte +5 -2
- package/dist/CopyToClipboard.svelte.d.ts.map +1 -1
- package/dist/DeclarationLink.svelte +15 -2
- package/dist/DeclarationLink.svelte.d.ts +7 -0
- package/dist/DeclarationLink.svelte.d.ts.map +1 -1
- package/dist/DialogContent.svelte +3 -1
- package/dist/DialogContent.svelte.d.ts.map +1 -1
- package/dist/Docs.svelte +11 -8
- package/dist/Docs.svelte.d.ts.map +1 -1
- package/dist/DocsLink.svelte +3 -1
- package/dist/DocsLink.svelte.d.ts.map +1 -1
- package/dist/DocsSearch.svelte +4 -1
- package/dist/DocsSearch.svelte.d.ts.map +1 -1
- package/dist/DocsTertiaryNav.svelte +2 -1
- package/dist/DocsTertiaryNav.svelte.d.ts.map +1 -1
- package/dist/LibraryDetail.svelte +9 -3
- package/dist/LibraryDetail.svelte.d.ts +1 -1
- package/dist/LibraryDetail.svelte.d.ts.map +1 -1
- package/dist/ModuleLink.svelte +2 -1
- package/dist/ModuleLink.svelte.d.ts.map +1 -1
- package/dist/Svg.svelte +46 -9
- package/dist/Svg.svelte.d.ts.map +1 -1
- package/dist/TypeLink.svelte +2 -1
- package/dist/TypeLink.svelte.d.ts.map +1 -1
- package/dist/contextmenu_helpers.d.ts +324 -1
- package/dist/contextmenu_helpers.d.ts.map +1 -1
- package/dist/contextmenu_helpers.js +403 -2
- package/dist/contextmenu_state.svelte.d.ts +61 -15
- package/dist/contextmenu_state.svelte.d.ts.map +1 -1
- package/dist/contextmenu_state.svelte.js +206 -119
- package/dist/declaration.svelte.d.ts +1 -0
- package/dist/declaration.svelte.d.ts.map +1 -1
- package/dist/declaration.svelte.js +2 -1
- package/dist/icons.d.ts +469 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +578 -0
- package/dist/library.svelte.d.ts +30 -3
- package/dist/library.svelte.d.ts.map +1 -1
- package/dist/library.svelte.js +38 -0
- package/dist/logos.d.ts +1 -3
- package/dist/logos.d.ts.map +1 -1
- package/dist/logos.js +1 -1
- package/dist/module.svelte.d.ts +62 -1
- package/dist/module.svelte.d.ts.map +1 -1
- package/dist/module.svelte.js +71 -1
- package/dist/svg.d.ts +69 -10
- package/dist/svg.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/lib/contextmenu_helpers.ts +546 -3
- package/src/lib/contextmenu_state.svelte.ts +219 -119
- package/src/lib/declaration.svelte.ts +2 -1
- package/src/lib/icons.ts +671 -0
- package/src/lib/library.svelte.ts +43 -1
- package/src/lib/logos.ts +1 -1
- package/src/lib/module.svelte.ts +97 -2
- package/src/lib/svg.ts +70 -9
|
@@ -1,16 +1,339 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Attachment } from 'svelte/attachments';
|
|
2
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
3
|
+
import { type ContextmenuOpenOptions, type ContextmenuState } from './contextmenu_state.svelte.js';
|
|
4
|
+
import type ContextmenuLinkEntry from './ContextmenuLinkEntry.svelte';
|
|
5
|
+
import type ContextmenuTextEntry from './ContextmenuTextEntry.svelte';
|
|
6
|
+
import type ContextmenuSeparator from './ContextmenuSeparator.svelte';
|
|
2
7
|
export declare const CONTEXTMENU_DEFAULT_OPEN_OFFSET_X = -2;
|
|
3
8
|
export declare const CONTEXTMENU_DEFAULT_OPEN_OFFSET_Y = -2;
|
|
4
9
|
export declare const CONTEXTMENU_DEFAULT_BYPASS_WINDOW = 750;
|
|
5
10
|
export declare const CONTEXTMENU_DEFAULT_BYPASS_MOVE_TOLERANCE = 11;
|
|
6
11
|
export declare const CONTEXTMENU_DEFAULT_LONGPRESS_DURATION = 633;
|
|
7
12
|
export declare const CONTEXTMENU_DEFAULT_LONGPRESS_MOVE_TOLERANCE = 21;
|
|
13
|
+
/**
|
|
14
|
+
* Props shared by `ContextmenuRoot.svelte` and `ContextmenuRootForSafariCompatibility.svelte`.
|
|
15
|
+
* Defaults are applied identically by both roots.
|
|
16
|
+
*/
|
|
17
|
+
export interface ContextmenuRootBaseProps {
|
|
18
|
+
/**
|
|
19
|
+
* The contextmenu state. Each root defaults to its own new instance -
|
|
20
|
+
* pass one to control or observe the menu externally.
|
|
21
|
+
*/
|
|
22
|
+
contextmenu?: ContextmenuState;
|
|
23
|
+
/**
|
|
24
|
+
* The number of pixels to offset from the pointer X position when opened.
|
|
25
|
+
* Useful to ensure the first menu item is immediately under the pointer.
|
|
26
|
+
*/
|
|
27
|
+
open_offset_x?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The number of pixels to offset from the pointer Y position when opened.
|
|
30
|
+
* Useful to ensure the first menu item is immediately under the pointer.
|
|
31
|
+
*/
|
|
32
|
+
open_offset_y?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to detect tap-then-longpress to bypass the Fuz contextmenu.
|
|
35
|
+
* This allows access to the system contextmenu by tapping once then rightclicking/long-pressing.
|
|
36
|
+
* Setting to `false` disables the gesture.
|
|
37
|
+
*/
|
|
38
|
+
bypass_with_tap_then_longpress?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The number of milliseconds between taps to detect a gesture that bypasses the Fuz contextmenu.
|
|
41
|
+
* Used only when `bypass_with_tap_then_longpress` is true.
|
|
42
|
+
* If the duration is too long, it'll detect more false positives and interrupt normal usage,
|
|
43
|
+
* but too short and some people will have difficulty performing the gesture.
|
|
44
|
+
*/
|
|
45
|
+
bypass_window?: number;
|
|
46
|
+
/**
|
|
47
|
+
* The number of pixels the pointer can be moved between taps to detect a tap-then-longpress.
|
|
48
|
+
* Used only when `bypass_with_tap_then_longpress` is true.
|
|
49
|
+
*/
|
|
50
|
+
bypass_move_tolerance?: number;
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, wraps `children` with a div and listens to events on it instead of the window.
|
|
53
|
+
*/
|
|
54
|
+
scoped?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Snippet for rendering link entries.
|
|
57
|
+
* Set to `null` to disable automatic link detection.
|
|
58
|
+
* Defaults to `link_entry_default` which renders `ContextmenuLinkEntry`.
|
|
59
|
+
*/
|
|
60
|
+
link_entry?: Snippet<[ComponentProps<typeof ContextmenuLinkEntry>]> | null;
|
|
61
|
+
/**
|
|
62
|
+
* Snippet for rendering copy text entries.
|
|
63
|
+
* Set to `null` to disable automatic copy text detection.
|
|
64
|
+
* Defaults to `text_entry_default` which renders `ContextmenuTextEntry`.
|
|
65
|
+
*/
|
|
66
|
+
text_entry?: Snippet<[ComponentProps<typeof ContextmenuTextEntry>]> | null;
|
|
67
|
+
/**
|
|
68
|
+
* Snippet for rendering separator entries.
|
|
69
|
+
* Set to `null` to disable automatic separator rendering.
|
|
70
|
+
* Defaults to `separator_entry_default` which renders `ContextmenuSeparator`.
|
|
71
|
+
*/
|
|
72
|
+
separator_entry?: Snippet<[ComponentProps<typeof ContextmenuSeparator>]> | null;
|
|
73
|
+
/**
|
|
74
|
+
* The content the root listens over for contextmenu gestures.
|
|
75
|
+
*/
|
|
76
|
+
children: Snippet;
|
|
77
|
+
}
|
|
8
78
|
/**
|
|
9
79
|
* Returns true if valid and narrows the type to HTMLElement | SVGElement.
|
|
10
80
|
*/
|
|
11
81
|
export declare const contextmenu_is_valid_target: (target: EventTarget | null, shiftKey: boolean) => target is HTMLElement | SVGElement;
|
|
12
82
|
export declare const contextmenu_create_keyboard_handlers: (contextmenu: ContextmenuState) => Map<string, () => void>;
|
|
13
83
|
export declare const contextmenu_create_keydown_handler: (keyboard_handlers: Map<string, () => void>) => ((e: KeyboardEvent) => void);
|
|
84
|
+
/**
|
|
85
|
+
* Constrains the menu's x coordinate to the layout, shifting left to fit the right edge.
|
|
86
|
+
* Clamps at `0` so a menu wider than the layout pins its left edge - the start of each
|
|
87
|
+
* item stays visible.
|
|
88
|
+
*/
|
|
14
89
|
export declare const contextmenu_calculate_constrained_x: (menu_x: number, menu_width: number, layout_width: number) => number;
|
|
90
|
+
/**
|
|
91
|
+
* Constrains the menu's y coordinate to the layout, shifting up to fit the bottom edge.
|
|
92
|
+
* Clamps at `0` so a menu taller than the layout pins its top edge - the first
|
|
93
|
+
* items stay visible.
|
|
94
|
+
*/
|
|
15
95
|
export declare const contextmenu_calculate_constrained_y: (menu_y: number, menu_height: number, layout_height: number) => number;
|
|
96
|
+
export interface ContextmenuSubmenuTranslateOptions {
|
|
97
|
+
/** The submenu's untranslated viewport x - the parent menu's left edge. */
|
|
98
|
+
base_x: number;
|
|
99
|
+
/** The submenu's untranslated viewport y. */
|
|
100
|
+
base_y: number;
|
|
101
|
+
/** The submenu's width. */
|
|
102
|
+
width: number;
|
|
103
|
+
/** The submenu's height. */
|
|
104
|
+
height: number;
|
|
105
|
+
/** The parent menu's width. */
|
|
106
|
+
parent_width: number;
|
|
107
|
+
/** The layout's width. */
|
|
108
|
+
layout_width: number;
|
|
109
|
+
/** The layout's height. */
|
|
110
|
+
layout_height: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Calculates a submenu flyout's translation so it fits the layout.
|
|
114
|
+
*
|
|
115
|
+
* Preference order on the x axis: fly out to the right of the parent menu,
|
|
116
|
+
* else flip fully to the left of it, else shift to pin whichever side
|
|
117
|
+
* overflows less. The y axis shifts up only as far as needed to fit the
|
|
118
|
+
* bottom edge.
|
|
119
|
+
*
|
|
120
|
+
* Used by `ContextmenuSubmenu.svelte`.
|
|
121
|
+
*/
|
|
122
|
+
export declare const contextmenu_calculate_submenu_translate: (options: ContextmenuSubmenuTranslateOptions) => {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
};
|
|
126
|
+
export interface ContextmenuOpenFromEventOptions extends ContextmenuOpenOptions {
|
|
127
|
+
/**
|
|
128
|
+
* The number of pixels to offset from the pointer X position when opened.
|
|
129
|
+
*/
|
|
130
|
+
open_offset_x?: number;
|
|
131
|
+
/**
|
|
132
|
+
* The number of pixels to offset from the pointer Y position when opened.
|
|
133
|
+
*/
|
|
134
|
+
open_offset_y?: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Handles a `contextmenu` event by opening the contextmenu from the event target,
|
|
138
|
+
* unless the target is invalid or inside the open menu element.
|
|
139
|
+
* Swallows the event when the menu opens.
|
|
140
|
+
*
|
|
141
|
+
* @param e - the `contextmenu` event
|
|
142
|
+
* @param contextmenu - the contextmenu state
|
|
143
|
+
* @param menu_el - the open menu element, if any, so events inside it are ignored
|
|
144
|
+
* @param options - offsets and entry filtering forwarded to `contextmenu_open`
|
|
145
|
+
* @returns whether the contextmenu was opened
|
|
146
|
+
*/
|
|
147
|
+
export declare const contextmenu_open_from_event: (e: MouseEvent, contextmenu: ContextmenuState, menu_el: HTMLElement | undefined, options?: ContextmenuOpenFromEventOptions) => boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Resolves a `contextmenu` event: opens the menu from the event target when possible
|
|
150
|
+
* (arming `open_guard` against the gesture's residual events), otherwise lets the
|
|
151
|
+
* native contextmenu show - closing ours unless the press was on the menu itself.
|
|
152
|
+
*
|
|
153
|
+
* Shared by `ContextmenuRoot.svelte` and `ContextmenuRootForSafariCompatibility.svelte`,
|
|
154
|
+
* after their root-specific bypass and longpress handling.
|
|
155
|
+
*
|
|
156
|
+
* @param e - the `contextmenu` event
|
|
157
|
+
* @param contextmenu - the contextmenu state
|
|
158
|
+
* @param menu_el - the open menu element, if any
|
|
159
|
+
* @param open_guard - guard that identifies presses belonging to the gesture that opened the menu
|
|
160
|
+
* @param options - offsets and entry filtering forwarded to `contextmenu_open`
|
|
161
|
+
* @returns whether the contextmenu was opened
|
|
162
|
+
*/
|
|
163
|
+
export declare const contextmenu_resolve_contextmenu_event: (e: MouseEvent, contextmenu: ContextmenuState, menu_el: HTMLElement | undefined, open_guard: ContextmenuOpenGuard, options?: ContextmenuOpenFromEventOptions) => boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Creates a `mousedown` handler that closes the contextmenu when pressing outside of
|
|
166
|
+
* the menu element, deferring to `open_guard` for presses that belong to the gesture
|
|
167
|
+
* that opened the menu: gesture presses outside don't close, and gesture presses on the
|
|
168
|
+
* menu arm the click blocker instead of activating the entry under the pointer.
|
|
169
|
+
*
|
|
170
|
+
* Secondary-button presses outside the menu never close here - their own `contextmenu`
|
|
171
|
+
* event resolves the menu in the roots' handlers (reopening it elsewhere, or closing it
|
|
172
|
+
* when there's nothing to open) - with one exception: shift+rightclick, an explicit
|
|
173
|
+
* native-menu request whose `contextmenu` event Firefox suppresses entirely, closes on
|
|
174
|
+
* the press itself.
|
|
175
|
+
*
|
|
176
|
+
* Registered on the window during the bubble phase deliberately -
|
|
177
|
+
* consumers keep the menu open through a press by swallowing the event
|
|
178
|
+
* (e.g. menu controller buttons that use `onmousedowncapture` + `swallow`).
|
|
179
|
+
*
|
|
180
|
+
* @param contextmenu - the contextmenu state
|
|
181
|
+
* @param get_menu_el - getter for the open menu element, if any
|
|
182
|
+
* @param open_guard - guard that identifies presses belonging to the gesture that opened the menu
|
|
183
|
+
*/
|
|
184
|
+
export declare const contextmenu_create_mousedown_handler: (contextmenu: ContextmenuState, get_menu_el: () => HTMLElement | undefined, open_guard?: ContextmenuOpenGuard) => (e: MouseEvent) => void;
|
|
185
|
+
/**
|
|
186
|
+
* Resolves the element that must host the contextmenu popover for it to stay
|
|
187
|
+
* interactive: the modal `<dialog>` containing `target`, if any.
|
|
188
|
+
*
|
|
189
|
+
* A modal dialog makes every element outside its subtree inert, and the top layer
|
|
190
|
+
* fixes painting order, not inertness - so a popover shown from outside the dialog
|
|
191
|
+
* paints above it but receives no pointer or focus events (hit-testing skips inert
|
|
192
|
+
* elements). Only the topmost modal dialog's subtree is interactive, so the dialog
|
|
193
|
+
* containing the menu's open target is by construction the one the menu must join.
|
|
194
|
+
*
|
|
195
|
+
* @param target - the element the menu was opened from
|
|
196
|
+
* @returns the modal dialog to reparent the menu into, or `null` when the menu
|
|
197
|
+
* doesn't need a host
|
|
198
|
+
*/
|
|
199
|
+
export declare const contextmenu_resolve_popover_host: (target: HTMLElement | SVGElement | undefined) => HTMLDialogElement | null;
|
|
200
|
+
/**
|
|
201
|
+
* Creates an attachment that shows the contextmenu element as a manual popover,
|
|
202
|
+
* promoting it into the top layer so it paints above modal `<dialog>` elements
|
|
203
|
+
* (e.g. `Dialog.svelte`) - top-layer elements paint in insertion order.
|
|
204
|
+
*
|
|
205
|
+
* Painting is only half of it: a modal dialog also makes everything outside its
|
|
206
|
+
* subtree inert. When the menu opens from inside a modal dialog, the menu element
|
|
207
|
+
* is reparented into that dialog (see `contextmenu_resolve_popover_host`) so it
|
|
208
|
+
* escapes the inert-ness and stays interactive - top-layer positioning is relative
|
|
209
|
+
* to the viewport regardless of ancestors, so the menu's fixed coordinates are
|
|
210
|
+
* unaffected. The host dialog's `close` also closes the menu, since the menu's DOM
|
|
211
|
+
* node vanishes with the dialog.
|
|
212
|
+
*
|
|
213
|
+
* No-ops where the Popover API is unavailable (older browsers, jsdom),
|
|
214
|
+
* falling back to `--contextmenu_z_index` stacking - the menu then renders
|
|
215
|
+
* beneath and inert to any open modal dialog.
|
|
216
|
+
*
|
|
217
|
+
* Used with the `popover="manual"` attribute - `"manual"` rather than `"auto"`
|
|
218
|
+
* so opening, closing, and keyboard handling stay fully owned by `ContextmenuState`.
|
|
219
|
+
*/
|
|
220
|
+
export declare const contextmenu_popover_attachment: (contextmenu: ContextmenuState) => Attachment<HTMLElement>;
|
|
221
|
+
/**
|
|
222
|
+
* Guards the menu from the residual events of the gesture that opened it,
|
|
223
|
+
* using exact gesture causality - no timing heuristics or tunable windows.
|
|
224
|
+
*
|
|
225
|
+
* Touch: when the menu opens during a touch (the native longpress `contextmenu` event,
|
|
226
|
+
* or the Safari-compat custom longpress), the release of that same gesture must not
|
|
227
|
+
* interact with the menu - an unprevented `touchend` lets the browser synthesize
|
|
228
|
+
* compatibility mouse events (`mousedown`/`mouseup`/`click`) at the touch point, and the
|
|
229
|
+
* open offsets place the first menu item exactly there, activating it immediately.
|
|
230
|
+
* `touchend` swallows the release to stop the synthesis, and `consume_blocked_click`
|
|
231
|
+
* blocks the next click on the menu as belt and braces (iOS can synthesize the click
|
|
232
|
+
* regardless).
|
|
233
|
+
*
|
|
234
|
+
* Mouse: tap-style input devices (e.g. some touchpads) can register an overlapping
|
|
235
|
+
* primary-button press during the right-click gesture that opened the menu - the
|
|
236
|
+
* compositor serializes the event stream, but the press's hardware `timeStamp` falls
|
|
237
|
+
* inside the gesture, and its delivery can lag long after the menu opened. Because the
|
|
238
|
+
* open offsets place the first menu item under the pointer, that press's `click` would
|
|
239
|
+
* activate the entry. `press_belongs_to_open_gesture` identifies overlap presses
|
|
240
|
+
* exactly: the press's own `buttons` bitmask shows the secondary button still down
|
|
241
|
+
* at generation time, or its `timeStamp` predates the release tracked by
|
|
242
|
+
* `track_mouseup`. No pressed-state is tracked across events deliberately: the native
|
|
243
|
+
* contextmenu's pointer grab swallows the secondary `mouseup` whenever it opens
|
|
244
|
+
* (right-click on our menu, shift+rightclick - which in Firefox doesn't even fire
|
|
245
|
+
* the `contextmenu` event), so a tracked flag wedges stuck, while the judged press's
|
|
246
|
+
* own `buttons` self-corrects. A deliberate right-then-left click - however fast -
|
|
247
|
+
* is sequential in hardware time and is never blocked.
|
|
248
|
+
*
|
|
249
|
+
* Plain DOM-event bookkeeping with no reactive state - used only inside event handlers
|
|
250
|
+
* by `ContextmenuRoot.svelte` and `ContextmenuRootForSafariCompatibility.svelte`.
|
|
251
|
+
*/
|
|
252
|
+
export declare class ContextmenuOpenGuard {
|
|
253
|
+
#private;
|
|
254
|
+
/**
|
|
255
|
+
* Begins a new gesture on `touchstart`, clearing stale flags from the previous one.
|
|
256
|
+
*/
|
|
257
|
+
touchstart(): void;
|
|
258
|
+
/**
|
|
259
|
+
* Arms the touch release guard for the gesture that just opened the menu.
|
|
260
|
+
* Call after a successful open.
|
|
261
|
+
*/
|
|
262
|
+
opened(): void;
|
|
263
|
+
/**
|
|
264
|
+
* Tracks the physical secondary button's release - call from an always-on
|
|
265
|
+
* window `mouseup` capture listener. The release may never be delivered
|
|
266
|
+
* (the native contextmenu's pointer grab eats it), which is why
|
|
267
|
+
* `press_belongs_to_open_gesture` never depends on it alone.
|
|
268
|
+
*/
|
|
269
|
+
track_mouseup(e: MouseEvent): void;
|
|
270
|
+
/**
|
|
271
|
+
* Returns `true` when a press belongs to the gesture that opened the menu
|
|
272
|
+
* rather than being a deliberate response to it:
|
|
273
|
+
* secondary-button presses (their own `contextmenu` event resolves them),
|
|
274
|
+
* presses during or predating an active touch (synthesized compatibility events),
|
|
275
|
+
* and presses overlapping the secondary button in hardware time - the press's
|
|
276
|
+
* own `buttons` bitmask shows the secondary button still down at generation
|
|
277
|
+
* time, or its `timeStamp` predates the release tracked by `track_mouseup`.
|
|
278
|
+
*/
|
|
279
|
+
press_belongs_to_open_gesture(e: MouseEvent): boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Handles a `mousedown` that landed on the menu element: when a primary-button
|
|
282
|
+
* press belongs to the opening gesture, its `click` is blocked from activating the
|
|
283
|
+
* entry that the open offsets placed under the pointer. Non-primary presses never
|
|
284
|
+
* arm the blocker - they produce no `click`, so an armed blocker would linger and
|
|
285
|
+
* eat the next deliberate click on the menu.
|
|
286
|
+
*/
|
|
287
|
+
mousedown_on_menu(e: MouseEvent): void;
|
|
288
|
+
/**
|
|
289
|
+
* Handles `touchend`: when the release belongs to the gesture that opened the menu,
|
|
290
|
+
* swallows it (stopping mouse event synthesis) and arms the click blocker,
|
|
291
|
+
* returning `true`.
|
|
292
|
+
*/
|
|
293
|
+
touchend(e: TouchEvent): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Clears gesture state, including any armed click blocker. Call on `touchcancel`.
|
|
296
|
+
* The secondary release timestamp persists - it mirrors hardware history,
|
|
297
|
+
* not gesture state.
|
|
298
|
+
*/
|
|
299
|
+
reset(): void;
|
|
300
|
+
/**
|
|
301
|
+
* Consumes an armed click blocker, returning `true` if the click should be swallowed.
|
|
302
|
+
* Call from the menu element's `click` capture handler.
|
|
303
|
+
*/
|
|
304
|
+
consume_blocked_click(): boolean;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Tracks the tap-then-longpress gesture that bypasses the Fuz contextmenu,
|
|
308
|
+
* letting users reach the system contextmenu by tapping once
|
|
309
|
+
* then longpressing/rightclicking within a time window.
|
|
310
|
+
*
|
|
311
|
+
* Plain DOM-event bookkeeping with no reactive state - used only inside event handlers
|
|
312
|
+
* by `ContextmenuRoot.svelte` and `ContextmenuRootForSafariCompatibility.svelte`.
|
|
313
|
+
*/
|
|
314
|
+
export declare class ContextmenuBypassTracker {
|
|
315
|
+
#private;
|
|
316
|
+
/**
|
|
317
|
+
* Set when a tap-then-longpress is detected,
|
|
318
|
+
* telling the next `contextmenu` event handler to let the system contextmenu through.
|
|
319
|
+
*/
|
|
320
|
+
bypassed: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Records a single-touch `touchstart` at the given coordinates.
|
|
323
|
+
* Detects a tap-then-longpress when the previous tap happened within `bypass_window`
|
|
324
|
+
* milliseconds and moved less than `bypass_move_tolerance` pixels,
|
|
325
|
+
* setting `bypassed` and returning `true`.
|
|
326
|
+
* Otherwise records the tap for future detection and returns `false`.
|
|
327
|
+
*/
|
|
328
|
+
track(x: number, y: number, bypass_window: number, bypass_move_tolerance: number): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Consumes a pending bypass, returning `true` and resetting all state if `bypassed` was set,
|
|
331
|
+
* otherwise returning `false` with no effect so tap tracking is preserved.
|
|
332
|
+
*/
|
|
333
|
+
consume(): boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Clears all tracking state including any pending bypass.
|
|
336
|
+
*/
|
|
337
|
+
reset(): void;
|
|
338
|
+
}
|
|
16
339
|
//# sourceMappingURL=contextmenu_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextmenu_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/contextmenu_helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"contextmenu_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/contextmenu_helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,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