@zag-js/tooltip 0.1.10 → 0.1.13
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/LICENSE +21 -0
- package/dist/index.d.ts +93 -3
- package/dist/index.js +217 -254
- package/dist/index.mjs +213 -258
- package/package.json +13 -12
- package/dist/tooltip.connect.d.ts +0 -18
- package/dist/tooltip.dom.d.ts +0 -31
- package/dist/tooltip.machine.d.ts +0 -2
- package/dist/tooltip.store.d.ts +0 -8
- package/dist/tooltip.types.d.ts +0 -82
package/dist/index.js
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
6
|
var __export = (target, all) => {
|
|
24
7
|
for (var name in all)
|
|
25
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -43,22 +26,6 @@ __export(src_exports, {
|
|
|
43
26
|
module.exports = __toCommonJS(src_exports);
|
|
44
27
|
|
|
45
28
|
// ../../utilities/dom/dist/index.mjs
|
|
46
|
-
var __defProp2 = Object.defineProperty;
|
|
47
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
48
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
49
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
50
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
51
|
-
var __spreadValues2 = (a, b) => {
|
|
52
|
-
for (var prop in b || (b = {}))
|
|
53
|
-
if (__hasOwnProp2.call(b, prop))
|
|
54
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
55
|
-
if (__getOwnPropSymbols2)
|
|
56
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
|
57
|
-
if (__propIsEnum2.call(b, prop))
|
|
58
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
59
|
-
}
|
|
60
|
-
return a;
|
|
61
|
-
};
|
|
62
29
|
var dataAttr = (guard) => {
|
|
63
30
|
return guard ? "" : void 0;
|
|
64
31
|
};
|
|
@@ -68,13 +35,12 @@ function getCache() {
|
|
|
68
35
|
return g.__styleCache;
|
|
69
36
|
}
|
|
70
37
|
function getComputedStyle(el) {
|
|
71
|
-
var _a;
|
|
72
38
|
if (!el)
|
|
73
39
|
return {};
|
|
74
40
|
const cache = getCache();
|
|
75
41
|
let style = cache.get(el);
|
|
76
42
|
if (!style) {
|
|
77
|
-
const win = (
|
|
43
|
+
const win = (el == null ? void 0 : el.ownerDocument.defaultView) ?? window;
|
|
78
44
|
style = win.getComputedStyle(el);
|
|
79
45
|
cache.set(el, style);
|
|
80
46
|
}
|
|
@@ -82,16 +48,15 @@ function getComputedStyle(el) {
|
|
|
82
48
|
}
|
|
83
49
|
var runIfFn = (v, ...a) => {
|
|
84
50
|
const res = typeof v === "function" ? v(...a) : v;
|
|
85
|
-
return res
|
|
51
|
+
return res ?? void 0;
|
|
86
52
|
};
|
|
87
53
|
var isArray = (v) => Array.isArray(v);
|
|
88
54
|
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
89
55
|
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
90
56
|
var isDom = () => typeof window !== "undefined";
|
|
91
57
|
function getPlatform() {
|
|
92
|
-
var _a;
|
|
93
58
|
const agent = navigator.userAgentData;
|
|
94
|
-
return (
|
|
59
|
+
return (agent == null ? void 0 : agent.platform) ?? navigator.platform;
|
|
95
60
|
}
|
|
96
61
|
var pt = (v) => isDom() && v.test(getPlatform());
|
|
97
62
|
var vn = (v) => isDom() && v.test(navigator.vendor);
|
|
@@ -104,20 +69,17 @@ function isWindow(value) {
|
|
|
104
69
|
return (value == null ? void 0 : value.toString()) === "[object Window]";
|
|
105
70
|
}
|
|
106
71
|
function getDocument(el) {
|
|
107
|
-
var _a;
|
|
108
72
|
if (isWindow(el))
|
|
109
73
|
return el.document;
|
|
110
74
|
if (isDocument(el))
|
|
111
75
|
return el;
|
|
112
|
-
return (
|
|
76
|
+
return (el == null ? void 0 : el.ownerDocument) ?? document;
|
|
113
77
|
}
|
|
114
78
|
function getWindow(el) {
|
|
115
|
-
|
|
116
|
-
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
79
|
+
return (el == null ? void 0 : el.ownerDocument.defaultView) ?? window;
|
|
117
80
|
}
|
|
118
81
|
function getNodeName(node) {
|
|
119
|
-
|
|
120
|
-
return isWindow(node) ? "" : (_a = node == null ? void 0 : node.localName) != null ? _a : "";
|
|
82
|
+
return isWindow(node) ? "" : (node == null ? void 0 : node.localName) ?? "";
|
|
121
83
|
}
|
|
122
84
|
function getParent(el) {
|
|
123
85
|
const doc = getDocument(el);
|
|
@@ -128,18 +90,18 @@ function getParent(el) {
|
|
|
128
90
|
function defineDomHelpers(helpers) {
|
|
129
91
|
const dom2 = {
|
|
130
92
|
getRootNode: (ctx) => {
|
|
131
|
-
var _a, _b;
|
|
132
|
-
return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
|
|
133
|
-
},
|
|
134
|
-
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
135
|
-
getWin: (ctx) => {
|
|
136
93
|
var _a;
|
|
137
|
-
return (_a =
|
|
94
|
+
return ((_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) ?? document;
|
|
138
95
|
},
|
|
96
|
+
getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
|
|
97
|
+
getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
|
|
139
98
|
getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
|
|
140
99
|
getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
|
|
141
100
|
};
|
|
142
|
-
return
|
|
101
|
+
return {
|
|
102
|
+
...dom2,
|
|
103
|
+
...helpers
|
|
104
|
+
};
|
|
143
105
|
}
|
|
144
106
|
function isHTMLElement(v) {
|
|
145
107
|
return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
|
|
@@ -167,8 +129,7 @@ function addDomEvent(target, eventName, handler, options) {
|
|
|
167
129
|
};
|
|
168
130
|
}
|
|
169
131
|
function addPointerEvent(target, event, listener, options) {
|
|
170
|
-
|
|
171
|
-
const type = (_a = getEventName(event)) != null ? _a : event;
|
|
132
|
+
const type = getEventName(event) ?? event;
|
|
172
133
|
return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
|
|
173
134
|
}
|
|
174
135
|
function wrapHandler(fn, filter = false) {
|
|
@@ -179,8 +140,7 @@ function wrapHandler(fn, filter = false) {
|
|
|
179
140
|
}
|
|
180
141
|
function filterPrimaryPointer(fn) {
|
|
181
142
|
return (event) => {
|
|
182
|
-
|
|
183
|
-
const win = (_a = event.view) != null ? _a : window;
|
|
143
|
+
const win = event.view ?? window;
|
|
184
144
|
const isMouseEvent2 = event instanceof win.MouseEvent;
|
|
185
145
|
const isPrimary = !isMouseEvent2 || isMouseEvent2 && event.button === 0;
|
|
186
146
|
if (isPrimary)
|
|
@@ -263,12 +223,12 @@ var import_popper = require("@zag-js/popper");
|
|
|
263
223
|
// src/tooltip.dom.ts
|
|
264
224
|
var dom = defineDomHelpers({
|
|
265
225
|
getTriggerId: (ctx) => {
|
|
266
|
-
var _a
|
|
267
|
-
return (
|
|
226
|
+
var _a;
|
|
227
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.trigger) ?? `tooltip:${ctx.id}:trigger`;
|
|
268
228
|
},
|
|
269
229
|
getContentId: (ctx) => {
|
|
270
|
-
var _a
|
|
271
|
-
return (
|
|
230
|
+
var _a;
|
|
231
|
+
return ((_a = ctx.ids) == null ? void 0 : _a.content) ?? `tooltip:${ctx.id}:content`;
|
|
272
232
|
},
|
|
273
233
|
getArrowId: (ctx) => `tooltip:${ctx.id}:arrow`,
|
|
274
234
|
getPositionerId: (ctx) => `tooltip:${ctx.id}:popper`,
|
|
@@ -405,219 +365,222 @@ function connect(state, send, normalize) {
|
|
|
405
365
|
var import_core2 = require("@zag-js/core");
|
|
406
366
|
var import_popper2 = require("@zag-js/popper");
|
|
407
367
|
function machine(ctx) {
|
|
408
|
-
return (0, import_core2.createMachine)(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
computed: {
|
|
424
|
-
hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
|
|
425
|
-
},
|
|
426
|
-
on: {
|
|
427
|
-
OPEN: "open",
|
|
428
|
-
CLOSE: "closed"
|
|
429
|
-
},
|
|
430
|
-
states: {
|
|
431
|
-
unknown: {
|
|
432
|
-
on: {
|
|
433
|
-
SETUP: "closed"
|
|
368
|
+
return (0, import_core2.createMachine)(
|
|
369
|
+
{
|
|
370
|
+
id: "tooltip",
|
|
371
|
+
initial: "unknown",
|
|
372
|
+
context: {
|
|
373
|
+
openDelay: 1e3,
|
|
374
|
+
closeDelay: 500,
|
|
375
|
+
closeOnPointerDown: true,
|
|
376
|
+
closeOnEsc: true,
|
|
377
|
+
interactive: true,
|
|
378
|
+
currentPlacement: void 0,
|
|
379
|
+
...ctx,
|
|
380
|
+
positioning: {
|
|
381
|
+
placement: "bottom",
|
|
382
|
+
...ctx.positioning
|
|
434
383
|
}
|
|
435
384
|
},
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
entry: ["clearGlobalId", "invokeOnClose"],
|
|
439
|
-
on: {
|
|
440
|
-
FOCUS: "open",
|
|
441
|
-
POINTER_ENTER: [
|
|
442
|
-
{
|
|
443
|
-
guard: "noVisibleTooltip",
|
|
444
|
-
target: "opening"
|
|
445
|
-
},
|
|
446
|
-
{ target: "open" }
|
|
447
|
-
]
|
|
448
|
-
}
|
|
385
|
+
computed: {
|
|
386
|
+
hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
|
|
449
387
|
},
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
388
|
+
on: {
|
|
389
|
+
OPEN: "open",
|
|
390
|
+
CLOSE: "closed"
|
|
391
|
+
},
|
|
392
|
+
states: {
|
|
393
|
+
unknown: {
|
|
394
|
+
on: {
|
|
395
|
+
SETUP: "closed"
|
|
396
|
+
}
|
|
455
397
|
},
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
398
|
+
closed: {
|
|
399
|
+
tags: ["closed"],
|
|
400
|
+
entry: ["clearGlobalId", "invokeOnClose"],
|
|
401
|
+
on: {
|
|
402
|
+
FOCUS: "open",
|
|
403
|
+
POINTER_ENTER: [
|
|
404
|
+
{
|
|
405
|
+
guard: "noVisibleTooltip",
|
|
406
|
+
target: "opening"
|
|
407
|
+
},
|
|
408
|
+
{ target: "open" }
|
|
409
|
+
]
|
|
464
410
|
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
411
|
+
},
|
|
412
|
+
opening: {
|
|
413
|
+
tags: ["closed"],
|
|
414
|
+
activities: ["trackScroll", "trackPointerlockChange"],
|
|
415
|
+
after: {
|
|
416
|
+
OPEN_DELAY: "open"
|
|
417
|
+
},
|
|
418
|
+
on: {
|
|
419
|
+
POINTER_LEAVE: "closed",
|
|
420
|
+
BLUR: "closed",
|
|
421
|
+
SCROLL: "closed",
|
|
422
|
+
POINTER_LOCK_CHANGE: "closed",
|
|
423
|
+
POINTER_DOWN: {
|
|
424
|
+
guard: "closeOnPointerDown",
|
|
425
|
+
target: "closed"
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
open: {
|
|
430
|
+
tags: ["open"],
|
|
431
|
+
activities: [
|
|
432
|
+
"trackEscapeKey",
|
|
433
|
+
"trackDisabledTriggerOnSafari",
|
|
434
|
+
"trackScroll",
|
|
435
|
+
"trackPointerlockChange",
|
|
436
|
+
"computePlacement"
|
|
437
|
+
],
|
|
438
|
+
entry: ["setGlobalId", "invokeOnOpen"],
|
|
439
|
+
on: {
|
|
440
|
+
POINTER_LEAVE: [
|
|
441
|
+
{
|
|
442
|
+
guard: "isVisible",
|
|
443
|
+
target: "closing"
|
|
444
|
+
},
|
|
445
|
+
{ target: "closed" }
|
|
446
|
+
],
|
|
447
|
+
BLUR: "closed",
|
|
448
|
+
ESCAPE: "closed",
|
|
449
|
+
SCROLL: "closed",
|
|
450
|
+
POINTER_LOCK_CHANGE: "closed",
|
|
451
|
+
TOOLTIP_POINTER_LEAVE: {
|
|
452
|
+
guard: "isInteractive",
|
|
481
453
|
target: "closing"
|
|
482
454
|
},
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
TOOLTIP_POINTER_LEAVE: {
|
|
490
|
-
guard: "isInteractive",
|
|
491
|
-
target: "closing"
|
|
492
|
-
},
|
|
493
|
-
POINTER_DOWN: {
|
|
494
|
-
guard: "closeOnPointerDown",
|
|
495
|
-
target: "closed"
|
|
496
|
-
},
|
|
497
|
-
CLICK: "closed"
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
closing: {
|
|
501
|
-
tags: ["open"],
|
|
502
|
-
activities: ["trackStore", "computePlacement"],
|
|
503
|
-
after: {
|
|
504
|
-
CLOSE_DELAY: "closed"
|
|
455
|
+
POINTER_DOWN: {
|
|
456
|
+
guard: "closeOnPointerDown",
|
|
457
|
+
target: "closed"
|
|
458
|
+
},
|
|
459
|
+
CLICK: "closed"
|
|
460
|
+
}
|
|
505
461
|
},
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
462
|
+
closing: {
|
|
463
|
+
tags: ["open"],
|
|
464
|
+
activities: ["trackStore", "computePlacement"],
|
|
465
|
+
after: {
|
|
466
|
+
CLOSE_DELAY: "closed"
|
|
467
|
+
},
|
|
468
|
+
on: {
|
|
469
|
+
FORCE_CLOSE: "closed",
|
|
470
|
+
POINTER_ENTER: "open",
|
|
471
|
+
TOOLTIP_POINTER_ENTER: {
|
|
472
|
+
guard: "isInteractive",
|
|
473
|
+
target: "open"
|
|
474
|
+
}
|
|
512
475
|
}
|
|
513
476
|
}
|
|
514
477
|
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
activities: {
|
|
481
|
+
computePlacement(ctx2) {
|
|
482
|
+
ctx2.currentPlacement = ctx2.positioning.placement;
|
|
483
|
+
let cleanup;
|
|
484
|
+
raf(() => {
|
|
485
|
+
cleanup = (0, import_popper2.getPlacement)(dom.getTriggerEl(ctx2), dom.getPositionerEl(ctx2), {
|
|
486
|
+
...ctx2.positioning,
|
|
487
|
+
onComplete(data) {
|
|
488
|
+
ctx2.currentPlacement = data.placement;
|
|
489
|
+
ctx2.isPlacementComplete = true;
|
|
490
|
+
},
|
|
491
|
+
onCleanup() {
|
|
492
|
+
ctx2.currentPlacement = void 0;
|
|
493
|
+
ctx2.isPlacementComplete = false;
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
return cleanup;
|
|
498
|
+
},
|
|
499
|
+
trackPointerlockChange(ctx2, _evt, { send }) {
|
|
500
|
+
return addPointerlockChangeListener(dom.getDoc(ctx2), () => {
|
|
501
|
+
send("POINTER_LOCK_CHANGE");
|
|
502
|
+
});
|
|
503
|
+
},
|
|
504
|
+
trackScroll(ctx2, _evt, { send }) {
|
|
505
|
+
const trigger = dom.getTriggerEl(ctx2);
|
|
506
|
+
if (!trigger)
|
|
507
|
+
return;
|
|
508
|
+
const cleanups = getScrollParents(trigger).map((el) => {
|
|
509
|
+
const opts = { passive: true, capture: true };
|
|
510
|
+
return addDomEvent(el, "scroll", () => send("SCROLL"), opts);
|
|
511
|
+
});
|
|
512
|
+
return () => {
|
|
513
|
+
cleanups.forEach((fn) => fn == null ? void 0 : fn());
|
|
514
|
+
};
|
|
515
|
+
},
|
|
516
|
+
trackStore(ctx2, _evt, { send }) {
|
|
517
|
+
return (0, import_core2.subscribe)(store, () => {
|
|
518
|
+
if (store.id !== ctx2.id) {
|
|
519
|
+
send("FORCE_CLOSE");
|
|
530
520
|
}
|
|
531
|
-
})
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return addDomEvent(el, "scroll", () => send("SCROLL"), opts);
|
|
547
|
-
});
|
|
548
|
-
return () => {
|
|
549
|
-
cleanups.forEach((fn) => fn == null ? void 0 : fn());
|
|
550
|
-
};
|
|
551
|
-
},
|
|
552
|
-
trackStore(ctx2, _evt, { send }) {
|
|
553
|
-
return (0, import_core2.subscribe)(store, () => {
|
|
554
|
-
if (store.id !== ctx2.id) {
|
|
555
|
-
send("FORCE_CLOSE");
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
},
|
|
559
|
-
trackDisabledTriggerOnSafari(ctx2, _evt, { send }) {
|
|
560
|
-
if (!isSafari())
|
|
561
|
-
return;
|
|
562
|
-
const doc = dom.getDoc(ctx2);
|
|
563
|
-
return addPointerEvent(doc, "pointermove", (event) => {
|
|
564
|
-
const selector = "[data-part=trigger][data-expanded]";
|
|
565
|
-
if (isHTMLElement(event.target) && event.target.closest(selector))
|
|
521
|
+
});
|
|
522
|
+
},
|
|
523
|
+
trackDisabledTriggerOnSafari(ctx2, _evt, { send }) {
|
|
524
|
+
if (!isSafari())
|
|
525
|
+
return;
|
|
526
|
+
const doc = dom.getDoc(ctx2);
|
|
527
|
+
return addPointerEvent(doc, "pointermove", (event) => {
|
|
528
|
+
const selector = "[data-part=trigger][data-expanded]";
|
|
529
|
+
if (isHTMLElement(event.target) && event.target.closest(selector))
|
|
530
|
+
return;
|
|
531
|
+
send("POINTER_LEAVE");
|
|
532
|
+
});
|
|
533
|
+
},
|
|
534
|
+
trackEscapeKey(ctx2, _evt, { send }) {
|
|
535
|
+
if (!ctx2.closeOnEsc)
|
|
566
536
|
return;
|
|
567
|
-
|
|
568
|
-
|
|
537
|
+
const doc = dom.getDoc(ctx2);
|
|
538
|
+
return addDomEvent(doc, "keydown", (event) => {
|
|
539
|
+
if (event.key === "Escape") {
|
|
540
|
+
send("ESCAPE");
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
569
544
|
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (
|
|
576
|
-
|
|
545
|
+
actions: {
|
|
546
|
+
setGlobalId(ctx2) {
|
|
547
|
+
store.setId(ctx2.id);
|
|
548
|
+
},
|
|
549
|
+
clearGlobalId(ctx2) {
|
|
550
|
+
if (ctx2.id === store.id) {
|
|
551
|
+
store.setId(null);
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
invokeOnOpen(ctx2, evt) {
|
|
555
|
+
var _a;
|
|
556
|
+
const omit = ["TOOLTIP_POINTER_ENTER", "POINTER_ENTER"];
|
|
557
|
+
if (!omit.includes(evt.type)) {
|
|
558
|
+
(_a = ctx2.onOpen) == null ? void 0 : _a.call(ctx2);
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
invokeOnClose(ctx2, evt) {
|
|
562
|
+
var _a;
|
|
563
|
+
const omit = ["SETUP"];
|
|
564
|
+
if (!omit.includes(evt.type)) {
|
|
565
|
+
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
577
566
|
}
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
actions: {
|
|
582
|
-
setupDocument(ctx2, evt) {
|
|
583
|
-
ctx2.id = evt.id;
|
|
584
|
-
if (evt.doc)
|
|
585
|
-
ctx2.doc = (0, import_core2.ref)(evt.doc);
|
|
586
|
-
if (evt.root)
|
|
587
|
-
ctx2.rootNode = (0, import_core2.ref)(evt.root);
|
|
588
|
-
},
|
|
589
|
-
setGlobalId(ctx2) {
|
|
590
|
-
store.setId(ctx2.id);
|
|
591
|
-
},
|
|
592
|
-
clearGlobalId(ctx2) {
|
|
593
|
-
if (ctx2.id === store.id) {
|
|
594
|
-
store.setId(null);
|
|
595
567
|
}
|
|
596
568
|
},
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}
|
|
569
|
+
guards: {
|
|
570
|
+
closeOnPointerDown: (ctx2) => ctx2.closeOnPointerDown,
|
|
571
|
+
noVisibleTooltip: () => store.id === null,
|
|
572
|
+
isVisible: (ctx2) => ctx2.id === store.id,
|
|
573
|
+
isInteractive: (ctx2) => ctx2.interactive
|
|
603
574
|
},
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
if (!omit.includes(evt.type)) {
|
|
608
|
-
(_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
|
|
609
|
-
}
|
|
575
|
+
delays: {
|
|
576
|
+
OPEN_DELAY: (ctx2) => ctx2.openDelay,
|
|
577
|
+
CLOSE_DELAY: (ctx2) => ctx2.closeDelay
|
|
610
578
|
}
|
|
611
|
-
},
|
|
612
|
-
guards: {
|
|
613
|
-
closeOnPointerDown: (ctx2) => ctx2.closeOnPointerDown,
|
|
614
|
-
noVisibleTooltip: () => store.id === null,
|
|
615
|
-
isVisible: (ctx2) => ctx2.id === store.id,
|
|
616
|
-
isInteractive: (ctx2) => ctx2.interactive
|
|
617
|
-
},
|
|
618
|
-
delays: {
|
|
619
|
-
OPEN_DELAY: (ctx2) => ctx2.openDelay,
|
|
620
|
-
CLOSE_DELAY: (ctx2) => ctx2.closeDelay
|
|
621
579
|
}
|
|
622
|
-
|
|
580
|
+
);
|
|
623
581
|
}
|
|
582
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
583
|
+
0 && (module.exports = {
|
|
584
|
+
connect,
|
|
585
|
+
machine
|
|
586
|
+
});
|