@vizejs/ui 0.345.0 → 0.350.2

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.
Files changed (96) hide show
  1. package/dist/{button-D7sM9Xmj.d.mts → button-CVX8UBXj.d.mts} +6 -7
  2. package/dist/{button-8BOlFJNu.mjs → button-DT8AKlds.mjs} +2 -2
  3. package/dist/button.d.mts +1 -1
  4. package/dist/button.mjs +1 -1
  5. package/dist/catalog.d.mts +541 -0
  6. package/dist/catalog.mjs +784 -0
  7. package/dist/{checkbox-B4y9GUen.mjs → checkbox-BgIvwjyC.mjs} +2 -2
  8. package/dist/{checkbox-DkwZFC80.d.mts → checkbox-DP3_ko7D.d.mts} +7 -8
  9. package/dist/checkbox.d.mts +1 -1
  10. package/dist/checkbox.mjs +1 -1
  11. package/dist/collection-B_dFZOHO.d.mts +185 -0
  12. package/dist/collection-eHN150dT.mjs +453 -0
  13. package/dist/collection.d.mts +2 -0
  14. package/dist/collection.mjs +2 -0
  15. package/dist/composite-navigation-QINW9GLy.d.mts +115 -0
  16. package/dist/composite-navigation-Skx3LZsv.mjs +354 -0
  17. package/dist/composite-navigation.d.mts +2 -0
  18. package/dist/composite-navigation.mjs +2 -0
  19. package/dist/controllable-state.d.mts +1 -1
  20. package/dist/dismissable-layer-4icKahVs.d.mts +119 -0
  21. package/dist/dismissable-layer-CwG1gtdz.mjs +488 -0
  22. package/dist/dismissable-layer.d.mts +2 -0
  23. package/dist/dismissable-layer.mjs +2 -0
  24. package/dist/focus-CAWi_I-0.mjs +318 -0
  25. package/dist/focus-K6dOifoZ.d.mts +112 -0
  26. package/dist/focus-guards-Bt0C-0qS.d.mts +81 -0
  27. package/dist/focus-guards-DhMPQAT8.mjs +299 -0
  28. package/dist/focus-guards.d.mts +2 -0
  29. package/dist/focus-guards.mjs +2 -0
  30. package/dist/focus-scope-CavhKWx0.d.mts +100 -0
  31. package/dist/focus-scope-D9U1aj67.mjs +340 -0
  32. package/dist/focus-scope-dom-DBwNEWxG.mjs +264 -0
  33. package/dist/focus-scope.d.mts +2 -0
  34. package/dist/focus-scope.mjs +2 -0
  35. package/dist/focus.d.mts +2 -0
  36. package/dist/focus.mjs +2 -0
  37. package/dist/hover-BXwwbSaO.d.mts +80 -0
  38. package/dist/hover.d.mts +2 -0
  39. package/dist/hover.mjs +197 -0
  40. package/dist/id-5OAUyVPd.d.mts +126 -0
  41. package/dist/id-mziSyAse.mjs +137 -0
  42. package/dist/id.d.mts +2 -0
  43. package/dist/id.mjs +2 -0
  44. package/dist/index.d.mts +23 -6
  45. package/dist/index.mjs +21 -5
  46. package/dist/inert-outside-CyqtoKQ4.mjs +346 -0
  47. package/dist/inert-outside-tuHRmaqJ.d.mts +43 -0
  48. package/dist/inert-outside.d.mts +2 -0
  49. package/dist/inert-outside.mjs +2 -0
  50. package/dist/interaction-modality-DOZK0BpZ.mjs +304 -0
  51. package/dist/interaction-modality-jgHKjPFB.d.mts +89 -0
  52. package/dist/interaction-modality.d.mts +2 -0
  53. package/dist/interaction-modality.mjs +2 -0
  54. package/dist/long-press-Dsul69gk.mjs +340 -0
  55. package/dist/long-press-cll6z2K9.d.mts +105 -0
  56. package/dist/long-press.d.mts +2 -0
  57. package/dist/long-press.mjs +2 -0
  58. package/dist/media-pdf.d.mts +1 -1
  59. package/dist/media-pdf.mjs +1 -1
  60. package/dist/media.d.mts +1 -1
  61. package/dist/media.mjs +1 -1
  62. package/dist/move-BOmXDYbh.d.mts +103 -0
  63. package/dist/move-BVvMHzxr.mjs +386 -0
  64. package/dist/move.d.mts +2 -0
  65. package/dist/move.mjs +2 -0
  66. package/dist/press-N_mE3Mgx.mjs +469 -0
  67. package/dist/press-event-Cd2OPpmw.mjs +149 -0
  68. package/dist/press-types-CNqStzJf.d.mts +112 -0
  69. package/dist/press.d.mts +14 -0
  70. package/dist/press.mjs +2 -0
  71. package/dist/{primitive-DJB7pOf3.mjs → primitive-BX31dogp.mjs} +2 -2
  72. package/dist/{primitive-BtvwikH1.d.mts → primitive-C8jW7DLd.d.mts} +3 -4
  73. package/dist/primitive.d.mts +1 -1
  74. package/dist/primitive.mjs +1 -1
  75. package/dist/scroll-lock-BgVtX4wT.d.mts +49 -0
  76. package/dist/scroll-lock-Ckbmm0-J.mjs +313 -0
  77. package/dist/scroll-lock.d.mts +2 -0
  78. package/dist/scroll-lock.mjs +2 -0
  79. package/dist/spatial-navigation-CHj9mDZH.d.mts +106 -0
  80. package/dist/spatial-navigation-D6-UDavU.mjs +301 -0
  81. package/dist/spatial-navigation.d.mts +2 -0
  82. package/dist/spatial-navigation.mjs +2 -0
  83. package/dist/typeahead-B7KDxE_u.mjs +175 -0
  84. package/dist/typeahead-BbgUB2Bj.d.mts +71 -0
  85. package/dist/typeahead.d.mts +2 -0
  86. package/dist/typeahead.mjs +2 -0
  87. package/dist/visually-hidden-BOqfqBFt.d.mts +17 -0
  88. package/dist/{visually-hidden-QENRapzW.mjs → visually-hidden-BwDOx5yf.mjs} +2 -2
  89. package/dist/visually-hidden.d.mts +1 -1
  90. package/dist/visually-hidden.mjs +1 -1
  91. package/package.json +99 -11
  92. package/dist/visually-hidden-BegtnMng.d.mts +0 -19
  93. /package/dist/{_plugin-vue_export-helper-BVN2DL-U.mjs → _plugin-vue_export-helper-BOaGB7Aw.mjs} +0 -0
  94. /package/dist/{controllable-state-DXsYJ3yl.d.mts → controllable-state-BtoxKahh.d.mts} +0 -0
  95. /package/dist/{pdf-source-COxN3A1l.d.mts → pdf-source-BYFK2Pks.d.mts} +0 -0
  96. /package/dist/{pdf-source-C52YE8tp.mjs → pdf-source-zu1LkCeE.mjs} +0 -0
@@ -0,0 +1,89 @@
1
+ import { ComputedRef, MaybeRefOrGetter, ShallowRef } from "vue";
2
+
3
+ //#region src/interaction-modality-types.d.ts
4
+ /**
5
+ * Input family that most recently expressed user intent.
6
+ *
7
+ * Pens and unknown pointing hardware intentionally map to `pointer`; consumers
8
+ * that need device-specific geometry should inspect the original pointer event.
9
+ */
10
+ type InteractionModality = "keyboard" | "pointer" | "touch" | "virtual";
11
+ /** Why an {@link InteractionModalityTracker} changed. */
12
+ type InteractionModalityChangeReason = InteractionModality | "document" | "manual";
13
+ /** Immutable notification emitted after a distinct modality change. */
14
+ interface InteractionModalityChange {
15
+ /** New modality, or `null` when a consumer explicitly resets detection. */
16
+ readonly modality: InteractionModality | null;
17
+ /** Value observed immediately before this change. */
18
+ readonly previousModality: InteractionModality | null;
19
+ /** Event classification or lifecycle operation responsible for the change. */
20
+ readonly reason: InteractionModalityChangeReason;
21
+ /** Native event when the change came from document input. */
22
+ readonly originalEvent: Event | null;
23
+ /** Document whose state produced the change, if the tracker is attached. */
24
+ readonly document: Document | null;
25
+ }
26
+ /** Options for {@link createInteractionModalityTracker}. */
27
+ interface InteractionModalityOptions {
28
+ /**
29
+ * Reactive document to observe. Pass `null` for SSR or deferred attachment.
30
+ *
31
+ * When omitted, the current global document is resolved lazily. No DOM global
32
+ * is read while the module is evaluated.
33
+ *
34
+ * @default globalThis.document when available
35
+ */
36
+ readonly document?: MaybeRefOrGetter<Document | null | undefined>;
37
+ /**
38
+ * Value used before the first qualifying input event.
39
+ *
40
+ * @default null
41
+ */
42
+ readonly initialModality?: InteractionModality | null;
43
+ /** Called synchronously after each distinct change. */
44
+ readonly onChange?: (change: InteractionModalityChange) => void;
45
+ }
46
+ /** Reactive, explicitly disposable input-modality observer. */
47
+ interface InteractionModalityTracker {
48
+ /** Document currently observed by this tracker. */
49
+ readonly document: Readonly<ShallowRef<Document | null>>;
50
+ /** Most recently detected input family. */
51
+ readonly modality: Readonly<ShallowRef<InteractionModality | null>>;
52
+ /** Whether global focus treatment should currently be keyboard-visible. */
53
+ readonly isFocusVisible: ComputedRef<boolean>;
54
+ /** Attach to another document, retaining the current value until synchronized. */
55
+ readonly attach: (document: Document | null) => boolean;
56
+ /** Stop observing the current document without clearing the current value. */
57
+ readonly detach: () => boolean;
58
+ /** Explicitly set or reset modality and synchronize peers on the same document. */
59
+ readonly setModality: (modality: InteractionModality | null) => boolean;
60
+ /** Release reactive observation and native listeners. Safe to call repeatedly. */
61
+ readonly dispose: () => void;
62
+ }
63
+ //#endregion
64
+ //#region src/interaction-modality.d.ts
65
+ /**
66
+ * Create an SSR-safe, document-scoped interaction-modality observer.
67
+ *
68
+ * Trackers in one document share native capture listeners and state. Separate
69
+ * documents, including iframes, remain isolated. Call {@link InteractionModalityTracker.dispose}
70
+ * when using this factory outside a Vue effect scope.
71
+ */
72
+ declare function createInteractionModalityTracker(options?: InteractionModalityOptions): InteractionModalityTracker;
73
+ /**
74
+ * Create a tracker owned by the current Vue effect scope.
75
+ *
76
+ * The tracker is disposed automatically when its component or effect scope is
77
+ * destroyed, preventing document-listener leaks.
78
+ */
79
+ declare function useInteractionModality(options?: InteractionModalityOptions): InteractionModalityTracker;
80
+ /**
81
+ * Determine whether a focused element should expose its focus indicator.
82
+ *
83
+ * Native `:focus-visible` semantics take precedence. The modality fallback is
84
+ * used only when the selector is unsupported, preserving text-input and
85
+ * platform heuristics implemented by the browser.
86
+ */
87
+ declare function isElementFocusVisible(element: Element | null | undefined, modality: InteractionModality | null): boolean;
88
+ //#endregion
89
+ export { InteractionModalityChange as a, InteractionModalityTracker as c, InteractionModality as i, isElementFocusVisible as n, InteractionModalityChangeReason as o, useInteractionModality as r, InteractionModalityOptions as s, createInteractionModalityTracker as t };
@@ -0,0 +1,2 @@
1
+ import { a as InteractionModalityChange, c as InteractionModalityTracker, i as InteractionModality, n as isElementFocusVisible, o as InteractionModalityChangeReason, r as useInteractionModality, s as InteractionModalityOptions, t as createInteractionModalityTracker } from "./interaction-modality-jgHKjPFB.mjs";
2
+ export { type InteractionModality, type InteractionModalityChange, type InteractionModalityChangeReason, type InteractionModalityOptions, type InteractionModalityTracker, createInteractionModalityTracker, isElementFocusVisible, useInteractionModality };
@@ -0,0 +1,2 @@
1
+ import { n as isElementFocusVisible, r as useInteractionModality, t as createInteractionModalityTracker } from "./interaction-modality-DOZK0BpZ.mjs";
2
+ export { createInteractionModalityTracker, isElementFocusVisible, useInteractionModality };
@@ -0,0 +1,340 @@
1
+ import { n as disableTextSelection, t as createPressEvent } from "./press-event-Cd2OPpmw.mjs";
2
+ import { t as createPress } from "./press-N_mE3Mgx.mjs";
3
+ import { getCurrentScope, onScopeDispose, shallowReadonly, shallowRef, toValue } from "vue";
4
+ //#region src/long-press-internal.ts
5
+ const defaultThreshold = 500;
6
+ const invalidOptionDiagnostic = "VIZE_UI_LONG_PRESS_OPTION";
7
+ const hardwarePointers = new Set([
8
+ "mouse",
9
+ "pen",
10
+ "pointer",
11
+ "touch"
12
+ ]);
13
+ function isHardwarePointer(value) {
14
+ return hardwarePointers.has(value);
15
+ }
16
+ function ownerOf(event) {
17
+ const original = event.originalEvent;
18
+ if (original && "pointerId" in original) return {
19
+ id: Number(original.pointerId),
20
+ source: "pointer"
21
+ };
22
+ if (original && "changedTouches" in original) {
23
+ const id = original.changedTouches.item(0)?.identifier;
24
+ if (id !== void 0) return {
25
+ id,
26
+ source: "touch"
27
+ };
28
+ }
29
+ return { source: "mouse" };
30
+ }
31
+ function ownerMatches(owner, event) {
32
+ const original = event.originalEvent;
33
+ if (owner.source === "pointer") return Boolean(original && "pointerId" in original && Number(original.pointerId) === owner.id);
34
+ if (owner.source === "touch") return Boolean(original && "changedTouches" in original && Array.from(original.changedTouches).some(({ identifier }) => identifier === owner.id));
35
+ return Boolean(original && !("pointerId" in original) && !("changedTouches" in original));
36
+ }
37
+ function captureError(errors, callback) {
38
+ try {
39
+ callback();
40
+ } catch (error) {
41
+ errors.push(error);
42
+ }
43
+ }
44
+ function surfaceErrors(errors, message) {
45
+ if (errors.length === 1) throw errors[0];
46
+ if (errors.length < 2) return;
47
+ const Aggregate = globalThis.AggregateError;
48
+ if (typeof Aggregate === "function") throw new Aggregate(errors, message);
49
+ const fallback = Object.assign(new Error(message), { errors: [...errors] });
50
+ fallback.name = "AggregateError";
51
+ throw fallback;
52
+ }
53
+ function readBoolean(value, name) {
54
+ const resolved = toValue(value);
55
+ if (resolved === void 0) return false;
56
+ if (typeof resolved !== "boolean") throw new TypeError(`${invalidOptionDiagnostic}: ${name} must resolve to a boolean`);
57
+ return resolved;
58
+ }
59
+ function readPointerType(value) {
60
+ const resolved = toValue(value) ?? null;
61
+ if (resolved !== null && !hardwarePointers.has(resolved)) throw new TypeError(`${invalidOptionDiagnostic}: pointerType must resolve to mouse, pen, pointer, or touch`);
62
+ return resolved;
63
+ }
64
+ function readThreshold(value) {
65
+ const resolved = toValue(value) ?? defaultThreshold;
66
+ if (typeof resolved !== "number" || !Number.isFinite(resolved) || resolved < 0) throw new TypeError(`${invalidOptionDiagnostic}: threshold must resolve to a finite number >= 0`);
67
+ return resolved;
68
+ }
69
+ function readText(value, name) {
70
+ const resolved = toValue(value);
71
+ if (resolved === void 0 || resolved === "") return void 0;
72
+ if (typeof resolved !== "string") throw new TypeError(`${invalidOptionDiagnostic}: ${name} must resolve to a string`);
73
+ return resolved;
74
+ }
75
+ function toLongPressEvent(type, event, originalEvent = event.originalEvent, isCanceled = event.isCanceled, touchIdentifier = null) {
76
+ const snapshot = createPressEvent("pressend", event.target, event.pointerType, originalEvent, isCanceled, touchIdentifier);
77
+ return Object.freeze({
78
+ ...snapshot,
79
+ type
80
+ });
81
+ }
82
+ function validateOptions(options) {
83
+ for (const name of [
84
+ "onLongPress",
85
+ "onLongPressEnd",
86
+ "onLongPressStart",
87
+ "onPress"
88
+ ]) {
89
+ const callback = options[name];
90
+ if (callback !== void 0 && typeof callback !== "function") throw new TypeError(`${invalidOptionDiagnostic}: ${name} must be a function`);
91
+ }
92
+ if (typeof options.threshold !== "function") readThreshold(options.threshold);
93
+ if (typeof options.pointerType !== "function") readPointerType(options.pointerType);
94
+ }
95
+ /** Install physical-release listeners for an already triggered attempt. */
96
+ function installTriggeredRelease(current, finish) {
97
+ const removals = [];
98
+ const document = current.target.ownerDocument;
99
+ const listen = (owner, type, callback, capture = true) => {
100
+ owner.addEventListener(type, callback, capture);
101
+ removals.push(() => owner.removeEventListener(type, callback, capture));
102
+ };
103
+ try {
104
+ if (current.owner.source === "pointer") {
105
+ const id = current.owner.id;
106
+ listen(document, "pointerup", ((event) => {
107
+ if (event.pointerId === id) finish(event);
108
+ }));
109
+ listen(document, "pointercancel", ((event) => {
110
+ if (event.pointerId === id) finish(event, true);
111
+ }));
112
+ } else if (current.owner.source === "touch") {
113
+ const id = current.owner.id;
114
+ const ownsTouch = (event) => Array.from(event.changedTouches).some((touch) => touch.identifier === id);
115
+ listen(document, "touchend", ((event) => {
116
+ if (ownsTouch(event)) finish(event);
117
+ }));
118
+ listen(document, "touchcancel", ((event) => {
119
+ if (ownsTouch(event)) finish(event, true);
120
+ }));
121
+ } else listen(document, "mouseup", ((event) => {
122
+ if (event.button === 0) finish(event);
123
+ }));
124
+ listen(document, "dragstart", (event) => finish(event, true));
125
+ listen(document, "visibilitychange", (() => {
126
+ if (document.visibilityState === "hidden") finish(null, true);
127
+ }));
128
+ if (document.defaultView) listen(document.defaultView, "blur", (event) => finish(event, true), false);
129
+ } catch (error) {
130
+ const errors = [error];
131
+ for (const remove of removals.reverse()) captureError(errors, remove);
132
+ surfaceErrors(errors, "Long-press listener setup failed");
133
+ throw error;
134
+ }
135
+ return () => {
136
+ const errors = [];
137
+ for (const remove of removals.splice(0)) captureError(errors, remove);
138
+ surfaceErrors(errors, "Long-press listener cleanup failed");
139
+ };
140
+ }
141
+ //#endregion
142
+ //#region src/long-press.ts
143
+ const contextMenuLingerMs = 50;
144
+ const disposedDiagnostic = "VIZE_UI_LONG_PRESS_DISPOSED";
145
+ const setupDiagnostic = "VIZE_UI_LONG_PRESS_SETUP";
146
+ /** Create an SSR-safe long-press recognizer for one host element. */
147
+ function createLongPress(options = {}) {
148
+ validateOptions(options);
149
+ const isPressed = shallowRef(false);
150
+ const isLongPressed = shallowRef(false);
151
+ let attempt = null;
152
+ let releaseTriggered = null;
153
+ let restoreTriggeredSelection = null;
154
+ let contextMenuPointer = null;
155
+ let contextMenuTimer = null;
156
+ let endingAtThreshold = false;
157
+ let disposed = false;
158
+ const clearContextMenuTimer = () => {
159
+ if (contextMenuTimer !== null) clearTimeout(contextMenuTimer);
160
+ contextMenuTimer = null;
161
+ };
162
+ const lingerContextMenuSuppression = () => {
163
+ clearContextMenuTimer();
164
+ contextMenuTimer = setTimeout(() => {
165
+ contextMenuPointer = null;
166
+ contextMenuTimer = null;
167
+ }, contextMenuLingerMs);
168
+ };
169
+ const clearRelease = () => {
170
+ const release = releaseTriggered;
171
+ const restore = restoreTriggeredSelection;
172
+ releaseTriggered = null;
173
+ restoreTriggeredSelection = null;
174
+ const errors = [];
175
+ try {
176
+ captureError(errors, () => release?.());
177
+ } finally {
178
+ captureError(errors, () => restore?.());
179
+ }
180
+ surfaceErrors(errors, "Long-press release cleanup failed");
181
+ };
182
+ const clearAttempt = (owner = attempt) => {
183
+ if (!owner || attempt !== owner) return false;
184
+ const timer = owner.timer;
185
+ if (timer != null) clearTimeout(timer);
186
+ attempt = null;
187
+ return true;
188
+ };
189
+ const finishTriggered = (owner, originalEvent, isCanceled) => {
190
+ if (!isLongPressed.value || attempt !== owner) return false;
191
+ const errors = [];
192
+ captureError(errors, clearRelease);
193
+ clearAttempt(owner);
194
+ isPressed.value = false;
195
+ isLongPressed.value = false;
196
+ captureError(errors, lingerContextMenuSuppression);
197
+ let canceled = isCanceled;
198
+ try {
199
+ canceled ||= readBoolean(options.isDisabled, "isDisabled");
200
+ } catch (error) {
201
+ canceled = true;
202
+ errors.push(error);
203
+ }
204
+ captureError(errors, () => options.onLongPressEnd?.(toLongPressEvent("longpressend", owner.event, originalEvent, canceled, owner.touchIdentifier)));
205
+ surfaceErrors(errors, "Long-press completion failed");
206
+ return true;
207
+ };
208
+ let press;
209
+ const trigger = (current) => {
210
+ if (disposed || attempt !== current) return;
211
+ current.timer = null;
212
+ if (readBoolean(options.isDisabled, "isDisabled")) {
213
+ press.cancel();
214
+ return;
215
+ }
216
+ isLongPressed.value = true;
217
+ try {
218
+ releaseTriggered = installTriggeredRelease(current, (event, canceled = false) => finishTriggered(current, event, canceled));
219
+ } catch (error) {
220
+ const errors = [error];
221
+ clearAttempt(current);
222
+ isPressed.value = false;
223
+ isLongPressed.value = false;
224
+ contextMenuPointer = null;
225
+ endingAtThreshold = true;
226
+ try {
227
+ captureError(errors, press.cancel);
228
+ } finally {
229
+ endingAtThreshold = false;
230
+ }
231
+ surfaceErrors(errors, "Long-press trigger setup failed");
232
+ return;
233
+ }
234
+ endingAtThreshold = true;
235
+ try {
236
+ press.cancel();
237
+ } finally {
238
+ endingAtThreshold = false;
239
+ }
240
+ const focusable = current.target;
241
+ if ((current.pointerType === "touch" || current.pointerType === "pen") && current.target.ownerDocument.activeElement !== current.target && typeof focusable.focus === "function") try {
242
+ focusable.focus({ preventScroll: true });
243
+ } catch {
244
+ focusable.focus();
245
+ }
246
+ if (!readBoolean(options.allowTextSelectionOnPress, "allowTextSelectionOnPress")) restoreTriggeredSelection = disableTextSelection(current.target);
247
+ options.onLongPress?.(toLongPressEvent("longpress", current.event, current.event.originalEvent, current.event.isCanceled, current.touchIdentifier));
248
+ };
249
+ press = createPress({
250
+ ...options.isDisabled === void 0 ? {} : { isDisabled: options.isDisabled },
251
+ ...options.allowTextSelectionOnPress === void 0 ? {} : { allowTextSelectionOnPress: options.allowTextSelectionOnPress },
252
+ ...options.preventFocusOnPress === void 0 ? {} : { preventFocusOnPress: options.preventFocusOnPress },
253
+ shouldCancelOnPointerExit: true,
254
+ onPressStart(event) {
255
+ if (!isHardwarePointer(event.pointerType)) return;
256
+ const pointerType = event.pointerType;
257
+ const filter = readPointerType(options.pointerType);
258
+ if (filter && filter !== pointerType) return;
259
+ if (attempt) {
260
+ press.cancel();
261
+ return;
262
+ }
263
+ contextMenuPointer = pointerType;
264
+ clearContextMenuTimer();
265
+ const owner = ownerOf(event);
266
+ const touchIdentifier = owner.source === "touch" ? owner.id : null;
267
+ const start = toLongPressEvent("longpressstart", event, event.originalEvent, event.isCanceled, touchIdentifier);
268
+ const current = {
269
+ event: start,
270
+ owner,
271
+ pointerType,
272
+ target: event.target,
273
+ touchIdentifier,
274
+ timer: null
275
+ };
276
+ attempt = current;
277
+ isPressed.value = true;
278
+ current.timer = setTimeout(() => trigger(current), readThreshold(options.threshold));
279
+ options.onLongPressStart?.(start);
280
+ },
281
+ onPressEnd(event) {
282
+ if (!attempt || endingAtThreshold) return;
283
+ const current = attempt;
284
+ if (!ownerMatches(current.owner, event)) return;
285
+ clearAttempt(current);
286
+ isPressed.value = false;
287
+ if (current.pointerType === "touch" || current.pointerType === "pen") lingerContextMenuSuppression();
288
+ else contextMenuPointer = null;
289
+ options.onLongPressEnd?.(toLongPressEvent("longpressend", current.event, event.originalEvent, event.isCanceled, current.touchIdentifier));
290
+ },
291
+ ...options.onPress ? { onPress: options.onPress } : {}
292
+ });
293
+ const attributes = {
294
+ ...press.pressProps,
295
+ get "aria-describedby"() {
296
+ if (readBoolean(options.isDisabled, "isDisabled") || !options.onLongPress) return void 0;
297
+ return readText(options.accessibilityDescriptionId, "accessibilityDescriptionId");
298
+ },
299
+ get "aria-description"() {
300
+ if (readBoolean(options.isDisabled, "isDisabled") || !options.onLongPress) return void 0;
301
+ if (readText(options.accessibilityDescriptionId, "accessibilityDescriptionId")) return void 0;
302
+ return readText(options.accessibilityDescription, "accessibilityDescription");
303
+ },
304
+ onContextmenu(event) {
305
+ if (contextMenuPointer === "touch" || contextMenuPointer === "pen") event.preventDefault();
306
+ }
307
+ };
308
+ return Object.freeze({
309
+ isPressed: shallowReadonly(isPressed),
310
+ isLongPressed: shallowReadonly(isLongPressed),
311
+ longPressProps: Object.freeze(attributes),
312
+ cancel: () => {
313
+ if (disposed) throw new Error(`${disposedDiagnostic}: the controller has been disposed`);
314
+ if (attempt && finishTriggered(attempt, null, true)) return true;
315
+ return press.cancel();
316
+ },
317
+ dispose: () => {
318
+ if (disposed) return;
319
+ disposed = true;
320
+ const errors = [];
321
+ captureError(errors, clearRelease);
322
+ captureError(errors, () => clearAttempt());
323
+ captureError(errors, clearContextMenuTimer);
324
+ contextMenuPointer = null;
325
+ isPressed.value = false;
326
+ isLongPressed.value = false;
327
+ captureError(errors, press.dispose);
328
+ surfaceErrors(errors, "Long-press disposal failed");
329
+ }
330
+ });
331
+ }
332
+ /** Create a long-press recognizer disposed with the current Vue effect scope. */
333
+ function useLongPress(options = {}) {
334
+ if (!getCurrentScope()) throw new Error(`${setupDiagnostic}: use inside component setup or an active effect scope`);
335
+ const controller = createLongPress(options);
336
+ onScopeDispose(controller.dispose);
337
+ return controller;
338
+ }
339
+ //#endregion
340
+ export { useLongPress as n, createLongPress as t };
@@ -0,0 +1,105 @@
1
+ import { n as PressEvent, o as PressPointerType, s as PressProps } from "./press-types-CNqStzJf.mjs";
2
+ import { MaybeRefOrGetter, ShallowRef } from "vue";
3
+
4
+ //#region src/long-press-types.d.ts
5
+ /** Pointing-device families eligible to start a long press. */
6
+ type LongPressPointerType = Extract<PressPointerType, "mouse" | "pen" | "pointer" | "touch">;
7
+ /** Lifecycle notification emitted by a long-press controller. */
8
+ type LongPressEventType = "longpress" | "longpressend" | "longpressstart";
9
+ /** Immutable snapshot of one long-press lifecycle event. */
10
+ interface LongPressEvent extends Omit<PressEvent, "type" | "pointerType"> {
11
+ /** Long-press lifecycle phase represented by this snapshot. */
12
+ readonly type: LongPressEventType;
13
+ /** Pointing-device family that initiated the interaction. */
14
+ readonly pointerType: LongPressPointerType;
15
+ }
16
+ /** Options shared by {@link createLongPress} and {@link useLongPress}. */
17
+ interface LongPressOptions {
18
+ /**
19
+ * Suppress long and short activation while retaining the bound props.
20
+ * Reactive values are checked at start and again when the threshold elapses.
21
+ *
22
+ * @default false
23
+ */
24
+ readonly isDisabled?: MaybeRefOrGetter<boolean | undefined>;
25
+ /**
26
+ * Restrict long-press recognition to one pointing-device family.
27
+ * Keyboard and virtual activation remain available through `onPress`.
28
+ *
29
+ * @default undefined
30
+ */
31
+ readonly pointerType?: MaybeRefOrGetter<LongPressPointerType | undefined>;
32
+ /**
33
+ * Time in milliseconds that the primary pointer must remain down.
34
+ * The value is resolved once per attempt and must be finite and non-negative.
35
+ *
36
+ * @default 500
37
+ */
38
+ readonly threshold?: MaybeRefOrGetter<number | undefined>;
39
+ /**
40
+ * Accessible explanation of the long action, for example
41
+ * "Long press to open actions". Used as `aria-description` unless
42
+ * `accessibilityDescriptionId` is supplied.
43
+ */
44
+ readonly accessibilityDescription?: MaybeRefOrGetter<string | undefined>;
45
+ /**
46
+ * ID of consumer-rendered descriptive content. When supplied, the host uses
47
+ * `aria-describedby` and the inline accessibility description is omitted.
48
+ */
49
+ readonly accessibilityDescriptionId?: MaybeRefOrGetter<string | undefined>;
50
+ /**
51
+ * Preserve selectable text during the pointer attempt.
52
+ *
53
+ * @default false
54
+ */
55
+ readonly allowTextSelectionOnPress?: MaybeRefOrGetter<boolean | undefined>;
56
+ /**
57
+ * Prevent the compatibility mousedown default that normally moves focus.
58
+ *
59
+ * @default false
60
+ */
61
+ readonly preventFocusOnPress?: MaybeRefOrGetter<boolean | undefined>;
62
+ /** Called after a qualifying primary pointer starts. */
63
+ readonly onLongPressStart?: (event: LongPressEvent) => void;
64
+ /** Called when an attempt ends, whether before or after the threshold. */
65
+ readonly onLongPressEnd?: (event: LongPressEvent) => void;
66
+ /** Called exactly once when the configured threshold is reached. */
67
+ readonly onLongPress?: (event: LongPressEvent) => void;
68
+ /**
69
+ * Called for an ordinary short, keyboard, or virtual activation.
70
+ * Use this as the keyboard-accessible alternative to a long-only action.
71
+ */
72
+ readonly onPress?: (event: PressEvent) => void;
73
+ }
74
+ /** Attributes and native handlers to spread onto one long-press host. */
75
+ interface LongPressProps extends PressProps {
76
+ readonly "aria-describedby": string | undefined;
77
+ readonly "aria-description": string | undefined;
78
+ readonly onContextmenu: (event: MouseEvent) => void;
79
+ }
80
+ /** Stateful long-press recognizer with explicit lifecycle ownership. */
81
+ interface LongPressController {
82
+ /** Whether an eligible pointer attempt is currently active. */
83
+ readonly isPressed: Readonly<ShallowRef<boolean>>;
84
+ /** Whether the active attempt has crossed the configured threshold. */
85
+ readonly isLongPressed: Readonly<ShallowRef<boolean>>;
86
+ /** Stable handlers and accessibility attributes for exactly one host. */
87
+ readonly longPressProps: Readonly<LongPressProps>;
88
+ /**
89
+ * Cancel the current pending or triggered interaction.
90
+ * Returns `true` when an interaction was canceled.
91
+ *
92
+ * @throws Error with `VIZE_UI_LONG_PRESS_DISPOSED` after disposal.
93
+ */
94
+ readonly cancel: () => boolean;
95
+ /** Release timers, listeners, selection guards, and reactive state. */
96
+ readonly dispose: () => void;
97
+ }
98
+ //#endregion
99
+ //#region src/long-press.d.ts
100
+ /** Create an SSR-safe long-press recognizer for one host element. */
101
+ declare function createLongPress(options?: LongPressOptions): LongPressController;
102
+ /** Create a long-press recognizer disposed with the current Vue effect scope. */
103
+ declare function useLongPress(options?: LongPressOptions): LongPressController;
104
+ //#endregion
105
+ export { LongPressEventType as a, LongPressProps as c, LongPressEvent as i, useLongPress as n, LongPressOptions as o, LongPressController as r, LongPressPointerType as s, createLongPress as t };
@@ -0,0 +1,2 @@
1
+ import { a as LongPressEventType, c as LongPressProps, i as LongPressEvent, n as useLongPress, o as LongPressOptions, r as LongPressController, s as LongPressPointerType, t as createLongPress } from "./long-press-cll6z2K9.mjs";
2
+ export { type LongPressController, type LongPressEvent, type LongPressEventType, type LongPressOptions, type LongPressPointerType, type LongPressProps, createLongPress, useLongPress };
@@ -0,0 +1,2 @@
1
+ import { n as useLongPress, t as createLongPress } from "./long-press-Dsul69gk.mjs";
2
+ export { createLongPress, useLongPress };
@@ -1,2 +1,2 @@
1
- import { n as createPDFSource, t as CreatePDFSourceOptions } from "./pdf-source-COxN3A1l.mjs";
1
+ import { n as createPDFSource, t as CreatePDFSourceOptions } from "./pdf-source-BYFK2Pks.mjs";
2
2
  export { type CreatePDFSourceOptions, createPDFSource };
@@ -1,2 +1,2 @@
1
- import { t as createPDFSource } from "./pdf-source-C52YE8tp.mjs";
1
+ import { t as createPDFSource } from "./pdf-source-zu1LkCeE.mjs";
2
2
  export { createPDFSource };
package/dist/media.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { MediaSourceKind, NormalizeMediaSourceOptions, normalizeMediaSource } from "./media-source.mjs";
2
- import { n as createPDFSource, t as CreatePDFSourceOptions } from "./pdf-source-COxN3A1l.mjs";
2
+ import { n as createPDFSource, t as CreatePDFSourceOptions } from "./pdf-source-BYFK2Pks.mjs";
3
3
  export { type CreatePDFSourceOptions, type MediaSourceKind, type NormalizeMediaSourceOptions, createPDFSource, normalizeMediaSource };
package/dist/media.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { normalizeMediaSource } from "./media-source.mjs";
2
- import { t as createPDFSource } from "./pdf-source-C52YE8tp.mjs";
2
+ import { t as createPDFSource } from "./pdf-source-zu1LkCeE.mjs";
3
3
  export { createPDFSource, normalizeMediaSource };
@@ -0,0 +1,103 @@
1
+ import { MaybeRefOrGetter, ShallowRef } from "vue";
2
+
3
+ //#region src/move-types.d.ts
4
+ /** Input families normalized by the move interaction. */
5
+ type MovePointerType = "keyboard" | "mouse" | "pen" | "pointer" | "touch";
6
+ /** Lifecycle phases emitted by a move controller. */
7
+ type MoveEventType = "move" | "moveend" | "movestart";
8
+ interface MoveEventBase<Type extends MoveEventType> {
9
+ /** Move lifecycle phase represented by this immutable snapshot. */
10
+ readonly type: Type;
11
+ /** Input family that owns this movement. */
12
+ readonly pointerType: MovePointerType;
13
+ /** Element whose bound props own the interaction. */
14
+ readonly target: Element;
15
+ /** Native event responsible for this phase, or `null` for manual cancellation. */
16
+ readonly originalEvent: Event | null;
17
+ /** Page coordinates when supplied by pointing hardware. */
18
+ readonly x: number | null;
19
+ readonly y: number | null;
20
+ /** Modifier-key snapshots captured from the native event. */
21
+ readonly altKey: boolean;
22
+ readonly ctrlKey: boolean;
23
+ readonly metaKey: boolean;
24
+ readonly shiftKey: boolean;
25
+ }
26
+ /** Snapshot emitted immediately before the first non-zero movement. */
27
+ interface MoveStartEvent extends MoveEventBase<"movestart"> {
28
+ readonly deltaX: 0;
29
+ readonly deltaY: 0;
30
+ readonly isCanceled: false;
31
+ }
32
+ /** Snapshot of one non-zero movement since the preceding native event. */
33
+ interface MoveUpdateEvent extends MoveEventBase<"move"> {
34
+ readonly deltaX: number;
35
+ readonly deltaY: number;
36
+ readonly isCanceled: false;
37
+ }
38
+ /** Snapshot emitted after a movement completes or is canceled. */
39
+ interface MoveEndEvent extends MoveEventBase<"moveend"> {
40
+ readonly deltaX: 0;
41
+ readonly deltaY: 0;
42
+ readonly isCanceled: boolean;
43
+ }
44
+ /** Discriminated lifecycle event union for exhaustive consumer handling. */
45
+ type MoveEvent = MoveEndEvent | MoveStartEvent | MoveUpdateEvent;
46
+ /** Options shared by {@link createMove} and {@link useMove}. */
47
+ interface MoveOptions {
48
+ /**
49
+ * Suppress new movement and cancel an active pointer movement on its next event.
50
+ *
51
+ * @default false
52
+ */
53
+ readonly isDisabled?: MaybeRefOrGetter<boolean | undefined>;
54
+ /**
55
+ * Distance contributed by each physical arrow-key press, including repeat events.
56
+ * The resolved value must be finite and greater than zero.
57
+ *
58
+ * @default 1
59
+ */
60
+ readonly keyboardStep?: MaybeRefOrGetter<number | undefined>;
61
+ /** Called exactly once before the first non-zero delta in an interaction. */
62
+ readonly onMoveStart?: (event: MoveStartEvent) => void;
63
+ /** Called for every non-zero pointer or keyboard delta. */
64
+ readonly onMove?: (event: MoveUpdateEvent) => void;
65
+ /** Called after an interaction that emitted at least one move finishes. */
66
+ readonly onMoveEnd?: (event: MoveEndEvent) => void;
67
+ }
68
+ /** Native handlers to spread onto exactly one move host. */
69
+ interface MoveProps {
70
+ readonly onDragstart: (event: DragEvent) => void;
71
+ readonly onKeydown: (event: KeyboardEvent) => void;
72
+ readonly onMousedown: (event: MouseEvent) => void;
73
+ readonly onPointercancel: (event: PointerEvent) => void;
74
+ readonly onPointerdown: (event: PointerEvent) => void;
75
+ readonly onTouchcancel: (event: TouchEvent) => void;
76
+ readonly onTouchend: (event: TouchEvent) => void;
77
+ readonly onTouchmove: (event: TouchEvent) => void;
78
+ readonly onTouchstart: (event: TouchEvent) => void;
79
+ }
80
+ /** Stateful move normalizer with explicit listener and selection ownership. */
81
+ interface MoveController {
82
+ /** Whether a pointer or ephemeral keyboard movement is currently being emitted. */
83
+ readonly isMoving: Readonly<ShallowRef<boolean>>;
84
+ /** Stable native handlers to spread or merge onto one host. */
85
+ readonly moveProps: Readonly<MoveProps>;
86
+ /**
87
+ * Cancel the current pointer attempt, including one that has not moved yet.
88
+ *
89
+ * @returns `true` when an owned pointer or keyboard transaction was settled.
90
+ * @throws An error carrying `VIZE_UI_MOVE_DISPOSED` after disposal.
91
+ */
92
+ readonly cancel: () => boolean;
93
+ /** Release listeners, selection guards, and reactive state without callbacks. */
94
+ readonly dispose: () => void;
95
+ }
96
+ //#endregion
97
+ //#region src/move.d.ts
98
+ /** Create an SSR-safe mouse, pen, touch, and keyboard move normalizer. */
99
+ declare function createMove(options?: MoveOptions): MoveController;
100
+ /** Create a move normalizer disposed with the current Vue effect scope. */
101
+ declare function useMove(options?: MoveOptions): MoveController;
102
+ //#endregion
103
+ export { MoveEvent as a, MovePointerType as c, MoveUpdateEvent as d, MoveEndEvent as i, MoveProps as l, useMove as n, MoveEventType as o, MoveController as r, MoveOptions as s, createMove as t, MoveStartEvent as u };