@leavepulse/ui 0.20.2 → 0.20.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.
@@ -6,7 +6,7 @@ import { _ as _sfc_main$3 } from "./LpButton-5VXXCjwF.js";
6
6
  import { _ as _sfc_main$1 } from "./LpFormField-Bn-ZwC6z.js";
7
7
  import { _ as _sfc_main$4 } from "./LpIcon-CCnX5_2j.js";
8
8
  import { _ as _sfc_main$5 } from "./LpInput-BauZRyzm.js";
9
- import { _ as _sfc_main$7 } from "./LpModal-g2dGpF7l.js";
9
+ import { _ as _sfc_main$7 } from "./LpModal-DLgOAP4p.js";
10
10
  import { _ as _sfc_main$6 } from "./LpSelect-D5mU4cZO.js";
11
11
  const _hoisted_1 = { class: "flex flex-col gap-3" };
12
12
  const _hoisted_2 = { class: "flex items-stretch gap-2" };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, openBlock, createBlock, withCtx, renderSlot, createVNode, createTextVNode, toDisplayString } from "vue";
2
2
  import { _ as _sfc_main$2 } from "./LpButton-5VXXCjwF.js";
3
- import { _ as _sfc_main$1 } from "./LpModal-g2dGpF7l.js";
3
+ import { _ as _sfc_main$1 } from "./LpModal-DLgOAP4p.js";
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "LpConfirmDialog",
6
6
  props: {
@@ -57,21 +57,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
57
  let mo;
58
58
  let raf = 0;
59
59
  let settleTimer;
60
+ let lastHeight = 0;
61
+ let inFlight = false;
60
62
  const retune = (el) => {
61
- const from = el.offsetHeight;
63
+ if (inFlight) return;
64
+ const from = lastHeight;
62
65
  el.style.height = "";
63
66
  el.style.maxHeight = "none";
64
67
  const to = el.offsetHeight;
65
68
  el.style.maxHeight = "";
66
- if (to === 0 || to === from) return;
69
+ lastHeight = to;
70
+ if (to === 0 || from === 0 || to === from) return;
67
71
  el.style.height = `${from}px`;
68
72
  void el.offsetHeight;
69
73
  el.style.height = `${to}px`;
74
+ inFlight = true;
70
75
  resizing.value = true;
71
76
  clearTimeout(settleTimer);
72
77
  settleTimer = setTimeout(() => {
78
+ inFlight = false;
73
79
  resizing.value = false;
74
80
  el.style.height = "";
81
+ lastHeight = el.offsetHeight;
75
82
  }, TWEEN_MS);
76
83
  };
77
84
  watch(
@@ -85,8 +92,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
85
92
  clearTimeout(settleTimer);
86
93
  tweening.value = false;
87
94
  resizing.value = false;
95
+ lastHeight = 0;
96
+ inFlight = false;
88
97
  const el = panelRef.value?.$el;
89
98
  if (!isOpen || !(el instanceof HTMLElement)) return;
99
+ lastHeight = el.offsetHeight;
90
100
  el.style.height = `${el.offsetHeight}px`;
91
101
  raf = requestAnimationFrame(() => {
92
102
  tweening.value = true;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpAddressInput-CCtskgfZ.js";
1
+ import { _ as _sfc_main } from "../chunks/LpAddressInput-DZxdRaVk.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpConfirmDialog-Z9hsfm2D.js";
1
+ import { _ as _sfc_main } from "../chunks/LpConfirmDialog-JEbhyY_y.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpModal-g2dGpF7l.js";
1
+ import { _ as _sfc_main } from "../chunks/LpModal-DLgOAP4p.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ } from "./chunks/LayoutCanvas-Dd20boUG.js";
2
- import { _ as _2 } from "./chunks/LpAddressInput-CCtskgfZ.js";
2
+ import { _ as _2 } from "./chunks/LpAddressInput-DZxdRaVk.js";
3
3
  import { _ as _3 } from "./chunks/LpMapPicker-DFKrd1Ne.js";
4
4
  import { OSM_TILES, createNominatimProvider, emptyAddress, formatAddress, project, tileUrl, unproject } from "./components/address.js";
5
5
  import { _ as _4 } from "./chunks/LpAlert-BAYHDSS1.js";
@@ -14,7 +14,7 @@ import { _ as _12 } from "./chunks/LpCard-BmrTvWOe.js";
14
14
  import { _ as _13 } from "./chunks/LpCheckbox-BO0zuuPh.js";
15
15
  import { _ as _14 } from "./chunks/LpCodeBlock-CSiOSPs8.js";
16
16
  import { default as default2 } from "./components/LpCommandPalette.vue.js";
17
- import { _ as _15 } from "./chunks/LpConfirmDialog-Z9hsfm2D.js";
17
+ import { _ as _15 } from "./chunks/LpConfirmDialog-JEbhyY_y.js";
18
18
  import { _ as _16 } from "./chunks/LpContextMenu-D0mzXqA7.js";
19
19
  import { _ as _17 } from "./chunks/LpDatePicker-dY2q4dr4.js";
20
20
  import { _ as _18 } from "./chunks/LpDisclosure-DP6yfgfM.js";
@@ -32,7 +32,7 @@ import { _ as _28 } from "./chunks/LpLightbox-CzhFe9wZ.js";
32
32
  import { fileNameOf } from "./components/lightbox.js";
33
33
  import { _ as _29 } from "./chunks/LpLink-DHwOEp4e.js";
34
34
  import { _ as _30 } from "./chunks/LpLogViewer-tmKPNTuU.js";
35
- import { _ as _31 } from "./chunks/LpModal-g2dGpF7l.js";
35
+ import { _ as _31 } from "./chunks/LpModal-DLgOAP4p.js";
36
36
  import { _ as _32 } from "./chunks/LpNotificationBell-DHze8wYN.js";
37
37
  import { _ as _33 } from "./chunks/LpNumberField-C5ar-OwE.js";
38
38
  import { _ as _34 } from "./chunks/LpOtpInput-DqaT0Z75.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavepulse/ui",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "type": "module",
5
5
  "description": "LeavePulse token-driven Vue component kit.",
6
6
  "repository": {
@@ -99,6 +99,10 @@ let ro: ResizeObserver | undefined
99
99
  let mo: MutationObserver | undefined
100
100
  let raf = 0
101
101
  let settleTimer: ReturnType<typeof setTimeout> | undefined
102
+ /** Where the panel last settled, so a retune has a height to ease FROM. */
103
+ let lastHeight = 0
104
+ /** True while a tween owns the height, so observers don't cancel it midway. */
105
+ let inFlight = false
102
106
 
103
107
  // The height is driven imperatively rather than through a style binding. By the
104
108
  // time replacement content is in the DOM the panel has already reflowed to its
@@ -106,7 +110,12 @@ let settleTimer: ReturnType<typeof setTimeout> | undefined
106
110
  // height for the transition to start from. Writing the OLD height, forcing a
107
111
  // reflow, then writing the new one gives the transition both ends.
108
112
  const retune = (el: HTMLElement) => {
109
- const from = el.offsetHeight
113
+ // One swap wakes both observers — the mutation as content lands, the resize as
114
+ // it reflows — and the second call would clear the pin the first just wrote.
115
+ if (inFlight) return
116
+ // Remembered, not measured: by the time either observer fires the panel has
117
+ // already reflowed, so the element can only report where it is going.
118
+ const from = lastHeight
110
119
  el.style.height = ""
111
120
  // `max-h` comes from a class, so the panel already reports the clipped figure
112
121
  // once the cap bites. Pinning that would leave a short panel sitting over
@@ -115,24 +124,30 @@ const retune = (el: HTMLElement) => {
115
124
  el.style.maxHeight = "none"
116
125
  const to = el.offsetHeight
117
126
  el.style.maxHeight = ""
127
+ lastHeight = to
118
128
  // Nothing moved, so there is nothing to ease — and leaving the height unset
119
129
  // keeps the panel free to size itself.
120
- if (to === 0 || to === from) return
130
+ if (to === 0 || from === 0 || to === from) return
121
131
  el.style.height = `${from}px`
122
132
  void el.offsetHeight
123
133
  el.style.height = `${to}px`
124
134
 
135
+ inFlight = true
125
136
  // While the panel is still catching up, the body is shorter than the content
126
137
  // it already holds, so the scroll area would flash a bar for an overflow that
127
138
  // resolves itself the moment the transition lands.
128
139
  resizing.value = true
129
140
  clearTimeout(settleTimer)
130
141
  settleTimer = setTimeout(() => {
142
+ inFlight = false
131
143
  resizing.value = false
132
144
  // Released once the panel has arrived. A height left pinned in pixels stops
133
145
  // being a starting point and becomes a cap: content that grows afterwards
134
146
  // is clipped, and `max-h` can no longer size the panel itself.
135
147
  el.style.height = ""
148
+ // Re-read rather than trusting `to`: `max-h` may have clamped the panel
149
+ // short of it, and the next tween has to start from where it really sits.
150
+ lastHeight = el.offsetHeight
136
151
  }, TWEEN_MS)
137
152
  }
138
153
 
@@ -150,9 +165,13 @@ watch(
150
165
  tweening.value = false
151
166
  resizing.value = false
152
167
 
168
+ lastHeight = 0
169
+ inFlight = false
170
+
153
171
  const el = panelRef.value?.$el
154
172
  if (!isOpen || !(el instanceof HTMLElement)) return
155
173
 
174
+ lastHeight = el.offsetHeight
156
175
  el.style.height = `${el.offsetHeight}px`
157
176
  // The opening panel must not animate its height in from the pre-content box,
158
177
  // so the transition only arms once that first pin has painted. The pin is