@jsenv/navi 0.30.13 → 0.30.15
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/dev/jsenv_navi.js +96 -29
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +96 -29
- package/dist/jsenv_navi.js.map +4 -4
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -17086,7 +17086,91 @@ PSEUDO_CLASSES[":-navi-has-value"] = {
|
|
|
17086
17086
|
},
|
|
17087
17087
|
};
|
|
17088
17088
|
{
|
|
17089
|
-
|
|
17089
|
+
// How long a press stays drawn, at least, from the frame that first painted
|
|
17090
|
+
// it (Android's PRESSED_STATE_DURATION). An ordinary tap lasts 30 to 80ms,
|
|
17091
|
+
// and its pointerup can be handled right after its pointerdown when the main
|
|
17092
|
+
// thread was busy: released at once, a press shows on 0 to 3 frames, which
|
|
17093
|
+
// is no press at all to the eye.
|
|
17094
|
+
const PRESS_SHOWN_AT_LEAST = 64;
|
|
17095
|
+
// element → the press going on there, until the element stops being drawn
|
|
17096
|
+
// pressed. Keyed by the element, not held by its tracker: Box re-runs its
|
|
17097
|
+
// tracking whenever the element's state changes, which is what pressing it
|
|
17098
|
+
// often does (a nav entry becoming current), and the press, finger down or
|
|
17099
|
+
// held on screen, goes on across that re-run.
|
|
17100
|
+
const pressWeakMap = new WeakMap();
|
|
17101
|
+
const startPress = (el) => {
|
|
17102
|
+
const pressBefore = pressWeakMap.get(el);
|
|
17103
|
+
if (pressBefore) {
|
|
17104
|
+
// Released, still held on screen: the new press takes over the drawing.
|
|
17105
|
+
pressBefore.abandon();
|
|
17106
|
+
}
|
|
17107
|
+
// When the frame painting the press began.
|
|
17108
|
+
let shownAt = null;
|
|
17109
|
+
let released = false;
|
|
17110
|
+
let timeout = null;
|
|
17111
|
+
let frame = requestAnimationFrame(() => {
|
|
17112
|
+
frame = null;
|
|
17113
|
+
shownAt = performance.now();
|
|
17114
|
+
if (released) {
|
|
17115
|
+
endOnceShown();
|
|
17116
|
+
}
|
|
17117
|
+
});
|
|
17118
|
+
const end = () => {
|
|
17119
|
+
pressWeakMap.delete(el);
|
|
17120
|
+
// Asked of the element rather than of the tracker that saw the press go
|
|
17121
|
+
// down: that one may have been torn down since.
|
|
17122
|
+
dispatchInternalCustomEvent(el, "navi_pseudo_state_request_check");
|
|
17123
|
+
};
|
|
17124
|
+
const endOnceShown = () => {
|
|
17125
|
+
const remaining = shownAt + PRESS_SHOWN_AT_LEAST - performance.now();
|
|
17126
|
+
if (remaining <= 0) {
|
|
17127
|
+
end();
|
|
17128
|
+
return;
|
|
17129
|
+
}
|
|
17130
|
+
timeout = setTimeout(end, remaining);
|
|
17131
|
+
};
|
|
17132
|
+
const stopListening = () => {
|
|
17133
|
+
document.removeEventListener("pointercancel", onCancel, true);
|
|
17134
|
+
document.removeEventListener("pointerup", onRelease, true);
|
|
17135
|
+
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
17136
|
+
};
|
|
17137
|
+
const onRelease = () => {
|
|
17138
|
+
stopListening();
|
|
17139
|
+
released = true;
|
|
17140
|
+
if (shownAt === null) {
|
|
17141
|
+
// No frame has painted it yet: the first one ends it.
|
|
17142
|
+
return;
|
|
17143
|
+
}
|
|
17144
|
+
endOnceShown();
|
|
17145
|
+
};
|
|
17146
|
+
// Not an activation (a scroll took the touch, a context menu opened): no
|
|
17147
|
+
// press to make seen, it ends at once.
|
|
17148
|
+
const onCancel = () => {
|
|
17149
|
+
stopListening();
|
|
17150
|
+
cancelAnimationFrame(frame);
|
|
17151
|
+
end();
|
|
17152
|
+
};
|
|
17153
|
+
const onContextMenu = (e) => {
|
|
17154
|
+
// On touch devices, a long-press triggers the context menu.
|
|
17155
|
+
// If the context menu is not prevented, it means it will open and the
|
|
17156
|
+
// pointer events (pointerup, lostpointercapture) won't fire normally,
|
|
17157
|
+
// leaving the element stuck in pressed state. We clear it manually.
|
|
17158
|
+
// e.button === -1 means the event was synthesized from a long-press (not a real mouse click).
|
|
17159
|
+
if (e.button === -1 && !e.defaultPrevented) {
|
|
17160
|
+
onCancel();
|
|
17161
|
+
}
|
|
17162
|
+
};
|
|
17163
|
+
document.addEventListener("pointercancel", onCancel, true);
|
|
17164
|
+
document.addEventListener("pointerup", onRelease, true);
|
|
17165
|
+
document.addEventListener("contextmenu", onContextMenu, true);
|
|
17166
|
+
pressWeakMap.set(el, {
|
|
17167
|
+
abandon: () => {
|
|
17168
|
+
stopListening();
|
|
17169
|
+
cancelAnimationFrame(frame);
|
|
17170
|
+
clearTimeout(timeout);
|
|
17171
|
+
},
|
|
17172
|
+
});
|
|
17173
|
+
};
|
|
17090
17174
|
PSEUDO_CLASSES[":-navi-pressed"] = {
|
|
17091
17175
|
attribute: "data-pressed",
|
|
17092
17176
|
setup: (el, callback) => {
|
|
@@ -17113,40 +17197,15 @@ PSEUDO_CLASSES[":-navi-has-value"] = {
|
|
|
17113
17197
|
// only left pointer (mouse left click, touch, pen)
|
|
17114
17198
|
return;
|
|
17115
17199
|
}
|
|
17116
|
-
|
|
17117
|
-
const onRelease = () => {
|
|
17118
|
-
pressedElements.delete(el);
|
|
17119
|
-
document.removeEventListener("pointercancel", onRelease, true);
|
|
17120
|
-
document.removeEventListener("pointerup", onRelease, true);
|
|
17121
|
-
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
17122
|
-
callback();
|
|
17123
|
-
};
|
|
17124
|
-
const onContextMenu = (e) => {
|
|
17125
|
-
// On touch devices, a long-press triggers the context menu.
|
|
17126
|
-
// If the context menu is not prevented, it means it will open and the
|
|
17127
|
-
// pointer events (pointerup, lostpointercapture) won't fire normally,
|
|
17128
|
-
// leaving the element stuck in pressed state. We clear it manually.
|
|
17129
|
-
// e.button === -1 means the event was synthesized from a long-press (not a real mouse click).
|
|
17130
|
-
if (e.button === -1 && !e.defaultPrevented) {
|
|
17131
|
-
pressedElements.delete(el);
|
|
17132
|
-
document.removeEventListener("pointercancel", onRelease, true);
|
|
17133
|
-
document.removeEventListener("pointerup", onRelease, true);
|
|
17134
|
-
document.removeEventListener("contextmenu", onContextMenu, true);
|
|
17135
|
-
callback();
|
|
17136
|
-
}
|
|
17137
|
-
};
|
|
17138
|
-
document.addEventListener("pointercancel", onRelease, true);
|
|
17139
|
-
document.addEventListener("pointerup", onRelease, true);
|
|
17140
|
-
document.addEventListener("contextmenu", onContextMenu, true);
|
|
17200
|
+
startPress(el);
|
|
17141
17201
|
callback();
|
|
17142
17202
|
};
|
|
17143
17203
|
el.addEventListener("pointerdown", onPointerDown);
|
|
17144
17204
|
return () => {
|
|
17145
17205
|
el.removeEventListener("pointerdown", onPointerDown);
|
|
17146
|
-
pressedElements.delete(el);
|
|
17147
17206
|
};
|
|
17148
17207
|
},
|
|
17149
|
-
test: (el) =>
|
|
17208
|
+
test: (el) => pressWeakMap.has(el),
|
|
17150
17209
|
};
|
|
17151
17210
|
}
|
|
17152
17211
|
|
|
@@ -63180,6 +63239,7 @@ a.navi_button {
|
|
|
63180
63239
|
|
|
63181
63240
|
&[data-pressed] {
|
|
63182
63241
|
& .navi_button_content {
|
|
63242
|
+
transition-duration: 0s;
|
|
63183
63243
|
transform: scale(.9);
|
|
63184
63244
|
}
|
|
63185
63245
|
}
|
|
@@ -85935,7 +85995,7 @@ const css$w = /* css */`@property --list-group-label-height {
|
|
|
85935
85995
|
scroll-margin-top: var(--x-list-scroll-spacing-top);
|
|
85936
85996
|
}
|
|
85937
85997
|
|
|
85938
|
-
|
|
85998
|
+
&:not([data-continued]) .navi_list_item_group_list > .navi_list_item:first-child {
|
|
85939
85999
|
scroll-margin-top: calc(var(--x-list-scroll-spacing-top) + var(--list-group-label-height));
|
|
85940
86000
|
}
|
|
85941
86001
|
|
|
@@ -91096,6 +91156,13 @@ const useRunItems = (store, {
|
|
|
91096
91156
|
if (askEnd > runEnd - 1) {
|
|
91097
91157
|
askEnd = runEnd - 1;
|
|
91098
91158
|
}
|
|
91159
|
+
// Only the item before the window's first one says whether that one opens
|
|
91160
|
+
// its group (see whereGroupContinues). Asked for with it, the first item
|
|
91161
|
+
// lands with its group known, not guessed: a wrong guess changes the room
|
|
91162
|
+
// above it, label and scroll inset, once the item before comes.
|
|
91163
|
+
if (groupBy && askStart === windowFrom && windowFrom > runStart && !store.holds(rankOf(windowFrom - 1)) && (!groupOfMissing || groupOfMissing(windowFrom - 1) === undefined)) {
|
|
91164
|
+
askStart = windowFrom - 1;
|
|
91165
|
+
}
|
|
91099
91166
|
}
|
|
91100
91167
|
// The item the missing ones hang from, when there is one: a source paginating
|
|
91101
91168
|
// by cursor ("the 50 before this one") needs an item to count from, and an
|