@leavepulse/ui 0.96.2 → 0.96.3
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/chunks/{LpHints-wsawHZCP.js → LpHints-lGLsGxOx.js} +1 -1
- package/dist/chunks/{LpTour-iZNl_vdy.js → LpTour-DUzpkD8W.js} +7 -1
- package/dist/components/LpHints.vue.js +1 -1
- package/dist/components/LpTour.vue.js +1 -1
- package/dist/composables/scroll.d.ts +6 -1
- package/dist/composables/scroll.js +2 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/components/LpTour.vue +11 -1
- package/src/composables/scroll.ts +8 -1
|
@@ -4,7 +4,7 @@ import { useAppleKeyboard, appleModifierLabel } from "../composables/useHotkeys.
|
|
|
4
4
|
import { useLabels } from "../composables/useLpConfig.js";
|
|
5
5
|
import { _ as _sfc_main$3 } from "./LpActionBar-DuwBawji.js";
|
|
6
6
|
import { _ as _sfc_main$2 } from "./LpHintLayer-rD3BTMfK.js";
|
|
7
|
-
import { _ as _sfc_main$1 } from "./LpTour-
|
|
7
|
+
import { _ as _sfc_main$1 } from "./LpTour-DUzpkD8W.js";
|
|
8
8
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
9
|
__name: "LpHints",
|
|
10
10
|
props: {
|
|
@@ -149,6 +149,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
149
149
|
clearTimeout(glide);
|
|
150
150
|
glide = window.setTimeout(() => gliding.value = false, durationToken("duration-medium", void 0, doc()) + 40);
|
|
151
151
|
}
|
|
152
|
+
let shownRaw = void 0;
|
|
152
153
|
function measure() {
|
|
153
154
|
viewport.value = { width: win().innerWidth, height: win().innerHeight };
|
|
154
155
|
const el = target.value;
|
|
@@ -156,7 +157,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
156
157
|
box.value = null;
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
159
|
-
if (!el.isConnected)
|
|
160
|
+
if (!el.isConnected) {
|
|
161
|
+
const again = resolve(shownRaw);
|
|
162
|
+
glideTo(again && again.getClientRects().length ? again : null);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
160
165
|
const r = el.getBoundingClientRect();
|
|
161
166
|
const prev = box.value;
|
|
162
167
|
if (!prev || prev.x !== r.x || prev.y !== r.y || prev.width !== r.width || prev.height !== r.height) {
|
|
@@ -193,6 +198,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
193
198
|
}
|
|
194
199
|
const el = current.enter || sampled.value ? await waitFor(raw, mine) : resolve(raw);
|
|
195
200
|
if (mine !== token) return;
|
|
201
|
+
shownRaw = raw;
|
|
196
202
|
if (!el || !el.getClientRects().length) return skip();
|
|
197
203
|
await settled(el);
|
|
198
204
|
if (mine !== token) return;
|
|
@@ -12,7 +12,12 @@ export declare function scrollParent(el: Element | null | undefined, { axis, sel
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function atScrollEnd(el: Element | null | undefined, slack?: number): boolean;
|
|
14
14
|
export interface ScrollToElementOptions {
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* `nearest` scrolls only when the element is out of view. An element taller
|
|
17
|
+
* than the scroller is brought in by its start whatever the block: centring
|
|
18
|
+
* or meeting its far edge would show its middle or end, and a list that
|
|
19
|
+
* loads more at its end would start loading.
|
|
20
|
+
*/
|
|
16
21
|
block?: "nearest" | "center" | "start";
|
|
17
22
|
behavior?: ScrollBehavior;
|
|
18
23
|
/** Room kept between the element and the scroller's edge. */
|
|
@@ -35,8 +35,10 @@ function scrollToElement(el, { block = "nearest", behavior = "auto", margin = 0,
|
|
|
35
35
|
const lo = x ? inner.left - outer.left : inner.top - outer.top;
|
|
36
36
|
const hi = x ? inner.right - outer.right : inner.bottom - outer.bottom;
|
|
37
37
|
const at = lo + from;
|
|
38
|
+
const fits = size + 2 * margin <= view;
|
|
38
39
|
let target = from;
|
|
39
40
|
if (block === "start") target = at - margin;
|
|
41
|
+
else if (!fits) target = lo < margin || lo > view - margin || block === "center" ? at - margin : from;
|
|
40
42
|
else if (block === "center") target = at - (view - size) / 2;
|
|
41
43
|
else if (lo < margin) target = at - margin;
|
|
42
44
|
else if (hi > -margin) target = at - view + size + margin;
|
package/dist/index.js
CHANGED
|
@@ -127,10 +127,10 @@ import { _ as _83 } from "./chunks/LpThemeSwitcher-CnkIH76z.js";
|
|
|
127
127
|
import { _ as _84 } from "./chunks/LpTilt-B7KHX1zH.js";
|
|
128
128
|
import { _ as _85 } from "./chunks/LpToaster-CGHXxCie.js";
|
|
129
129
|
import { _ as _86 } from "./chunks/LpTooltip-CzIfznts.js";
|
|
130
|
-
import { _ as _87 } from "./chunks/LpTour-
|
|
130
|
+
import { _ as _87 } from "./chunks/LpTour-DUzpkD8W.js";
|
|
131
131
|
import { holeOf, openContextMenu, panelsAround } from "./components/tour.js";
|
|
132
132
|
import { _ as _88 } from "./chunks/LpHintLayer-rD3BTMfK.js";
|
|
133
|
-
import { _ as _89 } from "./chunks/LpHints-
|
|
133
|
+
import { _ as _89 } from "./chunks/LpHints-lGLsGxOx.js";
|
|
134
134
|
import { HINT_SIGNALS, contextMenuTip, createHintSystem, dropzoneTip, hintKey, hintSummary, hotkeyTip, localHintStorage, noteDropzone, noteHotkeyTarget, paletteTip, provideHintSystem, runningHintSystem, useHintSystem } from "./composables/useHintSystem.js";
|
|
135
135
|
import { _ as _90 } from "./chunks/LpTooltipProvider-CftjV7Xc.js";
|
|
136
136
|
import { _ as _91 } from "./chunks/LpTopologyCanvas-DKn0Xcz4.js";
|
package/package.json
CHANGED
|
@@ -256,6 +256,11 @@ function glideTo(el: Element | null) {
|
|
|
256
256
|
glide = window.setTimeout(() => (gliding.value = false), durationToken("duration-medium", undefined, doc()) + 40)
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
// What the shown step points at, kept to find it again: a list that re-renders
|
|
260
|
+
// replaces the element, and a card anchored to the old one would hang over
|
|
261
|
+
// nothing (or nowhere) with the page dimmed under it.
|
|
262
|
+
let shownRaw: TourStep["target"] = undefined
|
|
263
|
+
|
|
259
264
|
function measure() {
|
|
260
265
|
viewport.value = { width: win().innerWidth, height: win().innerHeight }
|
|
261
266
|
const el = target.value
|
|
@@ -263,7 +268,11 @@ function measure() {
|
|
|
263
268
|
box.value = null
|
|
264
269
|
return
|
|
265
270
|
}
|
|
266
|
-
if (!el.isConnected)
|
|
271
|
+
if (!el.isConnected) {
|
|
272
|
+
const again = resolve(shownRaw)
|
|
273
|
+
glideTo(again && again.getClientRects().length ? again : null)
|
|
274
|
+
return
|
|
275
|
+
}
|
|
267
276
|
const r = el.getBoundingClientRect()
|
|
268
277
|
const prev = box.value
|
|
269
278
|
if (!prev || prev.x !== r.x || prev.y !== r.y || prev.width !== r.width || prev.height !== r.height) {
|
|
@@ -302,6 +311,7 @@ async function show(): Promise<void> {
|
|
|
302
311
|
}
|
|
303
312
|
const el = current.enter || sampled.value ? await waitFor(raw, mine) : resolve(raw)
|
|
304
313
|
if (mine !== token) return
|
|
314
|
+
shownRaw = raw
|
|
305
315
|
if (!el || !el.getClientRects().length) return skip()
|
|
306
316
|
await settled(el)
|
|
307
317
|
if (mine !== token) return
|
|
@@ -40,7 +40,12 @@ export function atScrollEnd(el: Element | null | undefined, slack = 2): boolean
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export interface ScrollToElementOptions {
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* `nearest` scrolls only when the element is out of view. An element taller
|
|
45
|
+
* than the scroller is brought in by its start whatever the block: centring
|
|
46
|
+
* or meeting its far edge would show its middle or end, and a list that
|
|
47
|
+
* loads more at its end would start loading.
|
|
48
|
+
*/
|
|
44
49
|
block?: "nearest" | "center" | "start"
|
|
45
50
|
behavior?: ScrollBehavior
|
|
46
51
|
/** Room kept between the element and the scroller's edge. */
|
|
@@ -76,8 +81,10 @@ export function scrollToElement(
|
|
|
76
81
|
const lo = x ? inner.left - outer.left : inner.top - outer.top
|
|
77
82
|
const hi = x ? inner.right - outer.right : inner.bottom - outer.bottom
|
|
78
83
|
const at = lo + from
|
|
84
|
+
const fits = size + 2 * margin <= view
|
|
79
85
|
let target = from
|
|
80
86
|
if (block === "start") target = at - margin
|
|
87
|
+
else if (!fits) target = lo < margin || lo > view - margin || block === "center" ? at - margin : from
|
|
81
88
|
else if (block === "center") target = at - (view - size) / 2
|
|
82
89
|
else if (lo < margin) target = at - margin
|
|
83
90
|
else if (hi > -margin) target = at - view + size + margin
|