@leavepulse/ui 0.33.0 → 0.34.0

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 (56) hide show
  1. package/dist/assets/{LpCommandPalette-CEY-pajO.css → LpCommandPalette-BERCHiev.css} +4 -4
  2. package/dist/chunks/{LpAddressInput-C35TsJXt.js → LpAddressInput-FZXfljWV.js} +1 -1
  3. package/dist/chunks/{LpConfirmDialog-CjOGcj1e.js → LpConfirmDialog-CQBVaLpo.js} +1 -1
  4. package/dist/chunks/{LpDisclosure-y7wDBgLa.js → LpDisclosure-ChQYmjlR.js} +1 -1
  5. package/dist/chunks/{LpModal-D_o-56To.js → LpModal-DAqXzsm-.js} +20 -11
  6. package/dist/components/LpActionBar.vue.d.ts +1 -1
  7. package/dist/components/LpAddressInput.vue.d.ts +3 -3
  8. package/dist/components/LpAddressInput.vue.js +1 -1
  9. package/dist/components/LpAppShell.vue.d.ts +1 -4
  10. package/dist/components/LpAutocomplete.vue.d.ts +1 -1
  11. package/dist/components/LpBadge.vue.d.ts +2 -2
  12. package/dist/components/LpCodeBlock.vue.d.ts +1 -1
  13. package/dist/components/LpColorPicker.vue.d.ts +4 -9
  14. package/dist/components/LpCommandPalette.vue.d.ts +62 -0
  15. package/dist/components/LpCommandPalette.vue.js +237 -56
  16. package/dist/components/LpConfirmDialog.vue.js +1 -1
  17. package/dist/components/LpDisclosure.vue.js +1 -1
  18. package/dist/components/LpDropzone.vue.d.ts +4 -4
  19. package/dist/components/LpFileTree.vue.d.ts +4 -4
  20. package/dist/components/LpFormField.vue.d.ts +1 -1
  21. package/dist/components/LpLaneNode.vue.d.ts +0 -11
  22. package/dist/components/LpLightbox.vue.d.ts +2 -2
  23. package/dist/components/LpLogViewer.vue.d.ts +1 -1
  24. package/dist/components/LpMapPicker.vue.d.ts +1 -1
  25. package/dist/components/LpMediaGallery.vue.d.ts +1 -1
  26. package/dist/components/LpModal.vue.js +1 -1
  27. package/dist/components/LpPie.vue.d.ts +4 -22
  28. package/dist/components/LpPopover.vue.d.ts +1 -1
  29. package/dist/components/LpProgress.vue.d.ts +2 -2
  30. package/dist/components/LpRollingText.vue.d.ts +3 -3
  31. package/dist/components/LpSelect.vue.d.ts +6 -6
  32. package/dist/components/LpShift.vue.d.ts +1 -1
  33. package/dist/components/LpShortcutsDialog.vue.d.ts +1 -1
  34. package/dist/components/LpShortcutsDialog.vue.js +1 -1
  35. package/dist/components/LpSidebar.vue.d.ts +1 -7
  36. package/dist/components/LpSidebarNav.vue.d.ts +2 -2
  37. package/dist/components/LpSlider.vue.d.ts +2 -2
  38. package/dist/components/LpSparkline.vue.d.ts +2 -2
  39. package/dist/components/LpTable.vue.d.ts +9 -9
  40. package/dist/components/LpTabs.vue.d.ts +1 -1
  41. package/dist/components/LpThemeSwitcher.vue.d.ts +1 -1
  42. package/dist/components/LpTilt.vue.d.ts +1 -1
  43. package/dist/components/LpTooltip.vue.d.ts +1 -1
  44. package/dist/components/LpTopologyCanvas.vue.d.ts +1 -1
  45. package/dist/components/modalDepth.d.ts +13 -0
  46. package/dist/components/modalDepth.js +29 -0
  47. package/dist/composables/useShift.js +9 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +4 -4
  50. package/package.json +1 -1
  51. package/src/components/LpCommandPalette.vue +369 -21
  52. package/src/components/LpDisclosure.vue +16 -1
  53. package/src/components/LpModal.vue +38 -3
  54. package/src/components/modalDepth.ts +72 -0
  55. package/src/composables/useShift.ts +34 -3
  56. package/src/index.ts +1 -1
@@ -65,6 +65,14 @@ export interface UseShift {
65
65
  /** Kept in step with the `duration-fast` token the transition utilities use. */
66
66
  const TWEEN_MS = 160
67
67
 
68
+ /*
69
+ * How long after a tween starts a second observer call still counts as the same
70
+ * move rather than a new one. Both observers report one swap within a frame or
71
+ * two; anything later is content that is still changing size and has to be
72
+ * followed. Two frames at 60Hz, with room to spare for a slow one.
73
+ */
74
+ const RETARGET_AFTER_MS = 40
75
+
68
76
  export function useShift(
69
77
  options: UseShiftOptions = {},
70
78
  ): UseShift {
@@ -81,6 +89,8 @@ export function useShift(
81
89
  let lastWidth = 0
82
90
  /** True while a tween owns the size, so observers don't cancel it midway. */
83
91
  let inFlight = false
92
+ /** When the in-flight tween started, to tell a duplicate from a follow-up. */
93
+ let tweenStart = 0
84
94
 
85
95
  const axisOf = () => toValue(options.axis) ?? "height"
86
96
  const wantsHeight = () => axisOf() !== "width"
@@ -96,9 +106,29 @@ export function useShift(
96
106
  function retune() {
97
107
  const node = el.value
98
108
  if (!node) return
99
- // One swap wakes both observers — the mutation as content lands, the resize
100
- // as it reflows — and the second call would clear the pin the first wrote.
101
- if (inFlight) return
109
+
110
+ /*
111
+ * A tween already owns the size. Where it came from decides what to do:
112
+ *
113
+ * - One swap wakes both observers — the mutation as content lands, the
114
+ * resize as it reflows — and the second call arrives within a frame or
115
+ * two of the first, describing the same move. Re-running it would clear
116
+ * the pin the first one wrote, so it is dropped.
117
+ * - Content that animates its OWN height keeps reporting new sizes for as
118
+ * long as it runs. A collapsible body opening inside a dialog fires the
119
+ * observer every frame for 260ms, and dropping all of those pinned the
120
+ * panel at the size the body happened to have one frame in — measured,
121
+ * 212px held for 170ms and then 135px arriving in a single frame, which
122
+ * is the "modal snaps open" report. Those retunes must RETARGET the
123
+ * tween instead: start from where the box is painted right now and ease
124
+ * on to the new figure.
125
+ */
126
+ if (inFlight) {
127
+ if (performance.now() - tweenStart < RETARGET_AFTER_MS) return
128
+ const live = node.getBoundingClientRect()
129
+ lastHeight = Math.round(live.height)
130
+ lastWidth = Math.round(live.width)
131
+ }
102
132
 
103
133
  // Remembered, not measured: by the time either observer fires the box has
104
134
  // already reflowed, so the element can only report where it is going.
@@ -145,6 +175,7 @@ export function useShift(
145
175
  if (movesWidth) node.style.width = `${toWidth}px`
146
176
 
147
177
  inFlight = true
178
+ tweenStart = performance.now()
148
179
  resizing.value = true
149
180
  clearTimeout(settleTimer)
150
181
  const wait = prefersReducedMotion() ? 0 : (toValue(options.duration) ?? TWEEN_MS)
package/src/index.ts CHANGED
@@ -64,7 +64,7 @@ export {
64
64
  } from "./components/color"
65
65
  export type { ColorFormat, Hsv, Rgb } from "./components/color"
66
66
  export { default as LpCommandPalette } from "./components/LpCommandPalette.vue"
67
- export type { Command } from "./components/LpCommandPalette.vue"
67
+ export type { Command, PaletteLabels } from "./components/LpCommandPalette.vue"
68
68
  export { default as LpConfirmDialog } from "./components/LpConfirmDialog.vue"
69
69
  export { default as LpContextMenu } from "./components/LpContextMenu.vue"
70
70
  export type { ContextMenuItemDef } from "./components/LpContextMenu.vue"