@leavepulse/ui 0.60.0 → 0.61.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 (62) hide show
  1. package/README.md +8 -0
  2. package/dist/assets/{LpTable-BZZf_rrt.css → LpTable-DpXyPzs8.css} +19 -19
  3. package/dist/chunks/{LpAddressInput-DD4zTN4P.js → LpAddressInput-CzdZguBo.js} +1 -1
  4. package/dist/chunks/{LpAppShell-Cv-Y9qNA.js → LpAppShell-BXMNDEpF.js} +1 -1
  5. package/dist/chunks/{LpAutocomplete-PnL2ntKl.js → LpAutocomplete-D9mY5Tqk.js} +101 -36
  6. package/dist/chunks/{LpAvatar-CwGs1JCQ.js → LpAvatar-K6MOMfgn.js} +1 -1
  7. package/dist/chunks/{LpCard-B2D0GIUU.js → LpCard-D9HVgX8Y.js} +1 -1
  8. package/dist/chunks/{LpColorPicker-CvBF8TeL.js → LpColorPicker-BO1ZTY51.js} +1 -1
  9. package/dist/chunks/{LpContextMenu-BnN1k7ga.js → LpContextMenu-Cv_F2iCG.js} +6 -3
  10. package/dist/chunks/{LpFileTree-DEqh2ySW.js → LpFileTree-DTwUj0L-.js} +1 -1
  11. package/dist/chunks/{LpFileTreeNode-DCZA7sQ-.js → LpFileTreeNode-D-XLPZ6T.js} +1 -1
  12. package/dist/chunks/{LpLogViewer-BuPe23sZ.js → LpLogViewer-D9UgNz2m.js} +1 -1
  13. package/dist/chunks/{LpModalNav-Cw7m-eks.js → LpModalNav-D4rmflQn.js} +1 -1
  14. package/dist/chunks/{LpNotificationBell-xH_JphpS.js → LpNotificationBell-CyylOlZR.js} +1 -1
  15. package/dist/chunks/{LpPie-BD5Lsh-2.js → LpPie-B2deu8CI.js} +1 -1
  16. package/dist/chunks/{LpSidebar-B3E_iViL.js → LpSidebar-D8tub3bt.js} +1 -1
  17. package/dist/chunks/{LpSidebarNav-32sAXNM-.js → LpSidebarNav-BBSRg34G.js} +1 -1
  18. package/dist/chunks/LpSwap-D82jiecV.js +38 -0
  19. package/dist/chunks/{LpThemeSwitcher-CeBG0e_D.js → LpThemeSwitcher-ZFFftBQn.js} +1 -1
  20. package/dist/chunks/{LpToaster-BcKs7vX7.js → LpToaster-D3OisETH.js} +1 -1
  21. package/dist/component-names.d.ts +1 -1
  22. package/dist/components/LpAddressInput.vue.js +1 -1
  23. package/dist/components/LpAppShell.vue.js +1 -1
  24. package/dist/components/LpAutocomplete.vue.d.ts +24 -0
  25. package/dist/components/LpAutocomplete.vue.js +1 -1
  26. package/dist/components/LpAvatar.vue.js +1 -1
  27. package/dist/components/LpCard.vue.js +1 -1
  28. package/dist/components/LpChart.vue.js +1 -1
  29. package/dist/components/LpColorPicker.vue.js +1 -1
  30. package/dist/components/LpCommandPalette.vue.js +1 -1
  31. package/dist/components/LpContextMenu.vue.js +1 -1
  32. package/dist/components/LpFileTree.vue.js +1 -1
  33. package/dist/components/LpFileTreeNode.vue.js +1 -1
  34. package/dist/components/LpLogViewer.vue.js +1 -1
  35. package/dist/components/LpModalNav.vue.js +1 -1
  36. package/dist/components/LpNotificationBell.vue.js +1 -1
  37. package/dist/components/LpPaletteHeader.vue.js +1 -1
  38. package/dist/components/LpPie.vue.js +1 -1
  39. package/dist/components/LpSidebar.vue.js +1 -1
  40. package/dist/components/LpSidebarNav.vue.js +1 -1
  41. package/dist/components/LpSwap.vue.d.ts +19 -0
  42. package/dist/components/LpSwap.vue.js +4 -0
  43. package/dist/components/LpTable.vue.js +5 -4
  44. package/dist/components/LpThemeSwitcher.vue.js +1 -1
  45. package/dist/components/LpToaster.vue.js +1 -1
  46. package/dist/composables/useHintSystem.d.ts +2 -0
  47. package/dist/composables/useHintSystem.js +16 -4
  48. package/dist/composables/useToast.d.ts +13 -4
  49. package/dist/composables/useToast.js +13 -2
  50. package/dist/index.d.ts +3 -2
  51. package/dist/index.js +62 -60
  52. package/package.json +2 -1
  53. package/src/component-names.ts +1 -0
  54. package/src/components/LpAutocomplete.vue +110 -24
  55. package/src/components/LpContextMenu.vue +6 -3
  56. package/src/components/LpSwap.vue +45 -0
  57. package/src/components/LpTable.vue +1 -0
  58. package/src/components/LpToaster.vue +1 -1
  59. package/src/composables/useHintSystem.ts +26 -4
  60. package/src/composables/useToast.ts +32 -5
  61. package/src/index.ts +3 -1
  62. package/src/tokens/selection.css +20 -0
@@ -25,7 +25,7 @@ import {
25
25
  ComboboxRoot,
26
26
  ComboboxViewport,
27
27
  } from "reka-ui"
28
- import { computed, ref, useAttrs, watch } from "vue"
28
+ import { computed, nextTick, ref, useAttrs, watch } from "vue"
29
29
  import { useFieldControl } from "../composables/useField"
30
30
  import { useInputFilter } from "../composables/useInputFilter"
31
31
  import { useLabels } from "../composables/useLpConfig"
@@ -36,6 +36,15 @@ export interface AutocompleteOption {
36
36
  value: string
37
37
  label?: string
38
38
  description?: string
39
+ /** A picture beside the option: an avatar, an icon of a server. */
40
+ image?: string
41
+ }
42
+
43
+ /** What the field's value stands for: a name for an id, with an optional muted hint and picture. */
44
+ export interface AutocompleteSelection {
45
+ label: string
46
+ hint?: string
47
+ image?: string
39
48
  }
40
49
 
41
50
  const props = withDefaults(
@@ -65,6 +74,14 @@ const props = withDefaults(
65
74
  pattern?: RegExp | string
66
75
  /** Allowed-character RegExp; hard-blocks other input (see LpInput). */
67
76
  restrict?: RegExp
77
+ /**
78
+ * What the current value stands for, shown in the field itself while it is
79
+ * not being edited: a picked id reads as a person (avatar in place of the
80
+ * icon, name, muted hint) instead of digits nobody recognises, and nothing
81
+ * appears or jumps below the field. Focusing it brings the raw text back.
82
+ * When room runs short the hint gives way first; the name stays.
83
+ */
84
+ selected?: AutocompleteSelection | null
68
85
  }>(),
69
86
  {
70
87
  placeholder: "Type…",
@@ -136,6 +153,12 @@ const filtered = computed(() => {
136
153
 
137
154
  const open = ref(false)
138
155
  const focused = ref(false)
156
+ const showSelected = computed(() => !!props.selected?.label && !focused.value)
157
+ // Focusing a picked value starts a new search from its name, not from the raw
158
+ // value: the name is put in the box selected, so typing replaces it, and
159
+ // leaving without typing keeps the pick as it was.
160
+ const draft = ref<string | null>(null)
161
+ const showImage = computed(() => !!props.selected?.image && (!focused.value || draft.value !== null))
139
162
 
140
163
  // Threshold met AND something to show → the list is allowed to open.
141
164
  const canOpen = computed(
@@ -174,19 +197,31 @@ const anchorSize = {
174
197
  function onInput(event: Event) {
175
198
  filterInput(event)
176
199
  typing.value = true
200
+ draft.value = null
177
201
  text.value = (event.target as HTMLInputElement).value
178
202
  }
179
203
 
180
- function onFocus() {
204
+ function onFocus(event: FocusEvent) {
181
205
  // Arriving at a field that already holds a value shows every option, not just
182
206
  // the one it currently holds.
183
207
  typing.value = false
184
208
  focused.value = true
209
+ if (props.selected?.label) {
210
+ draft.value = props.selected.label
211
+ const input = event.target as HTMLInputElement
212
+ void nextTick(() => input.select())
213
+ }
185
214
  if (canOpen.value) open.value = true
186
215
  }
187
216
 
217
+ function onBlur() {
218
+ focused.value = false
219
+ draft.value = null
220
+ }
221
+
188
222
  function choose(opt: AutocompleteOption) {
189
223
  typing.value = false
224
+ draft.value = null
190
225
  emit("update:modelValue", opt.value)
191
226
  emit("select", opt.value)
192
227
  open.value = false
@@ -194,6 +229,7 @@ function choose(opt: AutocompleteOption) {
194
229
 
195
230
  function clear() {
196
231
  typing.value = false
232
+ draft.value = null
197
233
  emit("update:modelValue", "")
198
234
  open.value = false
199
235
  }
@@ -220,7 +256,28 @@ function clear() {
220
256
  : 'border-line focus-within:border-brand',
221
257
  ]"
222
258
  >
223
- <LpIcon v-if="icon" :name="icon" :size="16" class="shrink-0 text-muted" />
259
+ <!-- Picture and icon share one fixed box and cross-fade, so the text
260
+ beside them never moves when one gives way to the other. -->
261
+ <span
262
+ v-if="icon || selected?.image"
263
+ class="relative grid shrink-0 place-items-center"
264
+ :class="selected?.image ? 'size-5' : 'size-4'"
265
+ >
266
+ <LpIcon
267
+ v-if="icon"
268
+ :name="icon"
269
+ :size="16"
270
+ class="col-start-1 row-start-1 text-muted transition-[opacity,scale] duration-[var(--duration-fast)] motion-reduce:transition-none"
271
+ :class="showImage ? 'scale-75 opacity-0' : 'opacity-100'"
272
+ />
273
+ <img
274
+ v-if="selected?.image"
275
+ :src="selected.image"
276
+ alt=""
277
+ class="col-start-1 row-start-1 size-5 rounded-full object-cover transition-[opacity,scale] duration-[var(--duration-fast)] motion-reduce:transition-none"
278
+ :class="showImage ? 'opacity-100' : 'scale-75 opacity-0'"
279
+ />
280
+ </span>
224
281
  <!--
225
282
  Bind value one-way and update from the raw DOM event, NOT via reka's
226
283
  ComboboxInput v-model: reka defers the value/search update to nextTick
@@ -228,23 +285,49 @@ function clear() {
228
285
  keystroke lag by one char. Reading event.target.value here is synchronous
229
286
  so `text` (and the reactive `open`) track the field exactly.
230
287
  -->
231
- <ComboboxInput
232
- v-bind="inputAttrs"
233
- :id="field.id"
234
- :model-value="text"
235
- :placeholder="placeholder"
236
- :disabled="field.disabled"
237
- :required="field.required || undefined"
238
- :aria-invalid="isInvalidState || undefined"
239
- :aria-describedby="field.describedBy"
240
- class="lp-autofill min-w-0 flex-1 self-stretch bg-transparent outline-none placeholder:text-muted"
241
- @beforeinput="onBeforeInput"
242
- @paste="onPaste"
243
- @compositionend="onCompositionEnd"
244
- @input="onInput"
245
- @focus="onFocus"
246
- @blur="focused = false"
247
- />
288
+ <div class="relative flex min-w-0 flex-1 self-stretch">
289
+ <ComboboxInput
290
+ v-bind="inputAttrs"
291
+ :id="field.id"
292
+ :model-value="draft ?? text"
293
+ :placeholder="placeholder"
294
+ :disabled="field.disabled"
295
+ :required="field.required || undefined"
296
+ :aria-invalid="isInvalidState || undefined"
297
+ :aria-describedby="field.describedBy"
298
+ class="lp-autofill min-w-0 flex-1 self-stretch bg-transparent outline-none placeholder:text-muted"
299
+ :class="showSelected && 'text-transparent placeholder:text-transparent'"
300
+ @beforeinput="onBeforeInput"
301
+ @paste="onPaste"
302
+ @compositionend="onCompositionEnd"
303
+ @input="onInput"
304
+ @focus="onFocus"
305
+ @blur="onBlur"
306
+ />
307
+ <!-- Focus and blur do not animate the name: it sits exactly where the
308
+ input's own text sits, so that swap cannot be seen. The hint, which
309
+ exists in one state alone, eases in and out beside it, and the
310
+ whole line fades when a pick appears or is cleared. -->
311
+ <Transition
312
+ enter-active-class="transition-opacity duration-[var(--duration-fast)] motion-reduce:transition-none"
313
+ leave-active-class="transition-opacity duration-[var(--duration-fast)] motion-reduce:transition-none"
314
+ enter-from-class="opacity-0"
315
+ leave-to-class="opacity-0"
316
+ >
317
+ <span
318
+ v-if="selected?.label"
319
+ class="pointer-events-none absolute inset-0 flex min-w-0 items-center gap-1.5"
320
+ aria-hidden="true"
321
+ >
322
+ <span class="max-w-full shrink-0 truncate" :class="showSelected ? '' : 'invisible'">{{ selected.label }}</span>
323
+ <span
324
+ v-if="selected.hint"
325
+ class="min-w-0 truncate text-sm text-muted transition-[opacity,translate] duration-[var(--duration-fast)] motion-reduce:transition-none"
326
+ :class="showSelected ? 'opacity-100' : '-translate-x-1 opacity-0'"
327
+ >{{ selected.hint }}</span>
328
+ </span>
329
+ </Transition>
330
+ </div>
248
331
  <button
249
332
  v-if="clearable && hasValue"
250
333
  type="button"
@@ -285,10 +368,13 @@ function clear() {
285
368
  :class="[OPTION_ITEM, 'justify-between']"
286
369
  @select.prevent="choose(opt)"
287
370
  >
288
- <span class="flex min-w-0 flex-col">
289
- <span class="truncate">{{ opt.label ?? opt.value }}</span>
290
- <span v-if="opt.description" class="truncate text-xs text-muted">
291
- {{ opt.description }}
371
+ <span class="flex min-w-0 items-center gap-2.5">
372
+ <img v-if="opt.image" :src="opt.image" alt="" class="size-6 shrink-0 rounded-full object-cover" />
373
+ <span class="flex min-w-0 flex-col">
374
+ <span class="truncate">{{ opt.label ?? opt.value }}</span>
375
+ <span v-if="opt.description" class="truncate text-xs text-muted">
376
+ {{ opt.description }}
377
+ </span>
292
378
  </span>
293
379
  </span>
294
380
  </ComboboxItem>
@@ -9,7 +9,7 @@
9
9
  import { ContextMenuContent, ContextMenuPortal, ContextMenuRoot, ContextMenuTrigger } from "reka-ui"
10
10
  import { computed } from "vue"
11
11
  import { hints } from "../composables/useHints"
12
- import { HINT_SIGNALS } from "../composables/useHintSystem"
12
+ import { HINT_SIGNALS, noteContextTarget } from "../composables/useHintSystem"
13
13
  import ContextMenuItems from "./ContextMenuItems.vue"
14
14
  import MenuTitle from "./MenuTitle.vue"
15
15
  import { POPOVER_PANEL } from "./dropdown"
@@ -103,8 +103,11 @@ function opened(open: boolean) {
103
103
  if (open) hints.use(HINT_SIGNALS.contextMenu)
104
104
  }
105
105
 
106
- function leftClick() {
107
- if (hinted.value) hints.use(HINT_SIGNALS.contextTarget)
106
+ function leftClick(event: MouseEvent) {
107
+ if (!hinted.value) return
108
+ hints.use(HINT_SIGNALS.contextTarget)
109
+ const el = event.currentTarget as Element
110
+ noteContextTarget((event.target as Element).closest?.("[data-lp-context-row]") ?? el)
108
111
  }
109
112
 
110
113
  function returnFocus(event: Event) {
@@ -0,0 +1,45 @@
1
+ <script setup lang="ts">
2
+ /*
3
+ * One piece of content standing in for another: the section picked in a side
4
+ * nav, the step of a wizard, the view chosen in a segmented control. Without
5
+ * it the old content vanishes and the new one appears in the same frame, and
6
+ * everything below jumps to the new height.
7
+ *
8
+ * <LpSidebar v-model="section" :items="items" />
9
+ * <LpSwap :swap-key="section">
10
+ * <SectionBody :name="section" />
11
+ * </LpSwap>
12
+ *
13
+ * The outgoing content fades out quickly, the incoming one rises in the way
14
+ * LpTabs panels do (`tab-in`), and the box eases between the two heights
15
+ * through LpShift, so what sits under it glides instead of jolting.
16
+ *
17
+ * `swapKey` is what decides that the content is "another one". Change it per
18
+ * section, not per record: a key that changes on every reload replays the
19
+ * entrance for data that merely refreshed.
20
+ */
21
+ import LpShift from "./LpShift.vue"
22
+
23
+ defineProps<{
24
+ /** Identity of the current content; a new value plays the swap. */
25
+ swapKey: string | number
26
+ /** Turn the motion off (the content still swaps). */
27
+ disabled?: boolean
28
+ }>()
29
+ </script>
30
+
31
+ <template>
32
+ <LpShift axis="height" :disabled="disabled">
33
+ <Transition
34
+ mode="out-in"
35
+ :css="!disabled"
36
+ enter-active-class="animate-[tab-in_220ms_var(--ease-emphasized)] motion-reduce:animate-none"
37
+ leave-active-class="transition-opacity duration-[var(--duration-fast)] ease-out motion-reduce:transition-none"
38
+ leave-to-class="opacity-0"
39
+ >
40
+ <div :key="swapKey">
41
+ <slot />
42
+ </div>
43
+ </Transition>
44
+ </LpShift>
45
+ </template>
@@ -1293,6 +1293,7 @@ const barInsetTop = computed(() =>
1293
1293
  :class="selectedSet.has(keyFor(row, index)) ? 'bg-brand-soft/40' : ''"
1294
1294
  v-bind="roving.itemProps(String(keyFor(row, index)))"
1295
1295
  :data-paint-key="selectable ? String(keyFor(row, index)) : undefined"
1296
+ :data-lp-context-row="rowMenu ? '' : undefined"
1296
1297
  @click="onRowClick(row, keyFor(row, index))"
1297
1298
  @pointerdown="onRowPointerDown($event, keyFor(row, index))"
1298
1299
  @keydown="onRowKeydown"
@@ -225,7 +225,7 @@ let copiedTimer: ReturnType<typeof setTimeout> | undefined
225
225
  const copyable = (t: ToastItem) => t.variant === "error" || t.variant === "warning"
226
226
 
227
227
  async function copyToast(t: ToastItem) {
228
- if (!(await copy([t.title, t.message].filter(Boolean).join("\n")))) return
228
+ if (!(await copy([t.title, t.message, t.details].filter(Boolean).join("\n")))) return
229
229
  copiedId.value = tag(t)
230
230
  clearTimeout(copiedTimer)
231
231
  copiedTimer = setTimeout(() => (copiedId.value = null), 1500)
@@ -109,6 +109,31 @@ export const HINT_SIGNALS = {
109
109
  paletteActions: "lp.palette-actions",
110
110
  } as const
111
111
 
112
+ let lastContextTarget: WeakRef<Element> | null = null
113
+
114
+ /** The element a left click just landed on that also has a right-click menu (a table row rather than the table). */
115
+ export function noteContextTarget(el: Element): void {
116
+ lastContextTarget = new WeakRef(el)
117
+ }
118
+
119
+ const onScreen = (el: Element) => {
120
+ const box = el.getBoundingClientRect()
121
+ return el.isConnected && box.width > 0 && box.bottom > 0 && box.top < window.innerHeight
122
+ }
123
+
124
+ /*
125
+ * What the tip lights up: the thing the user keeps clicking, while it is still
126
+ * on screen; otherwise a row with a menu, then any menu target. Rows first,
127
+ * because a page's first target in document order is usually chrome (a
128
+ * sidebar account card), not the content the habit is about.
129
+ */
130
+ function rightClickTarget(): Element | null {
131
+ const last = lastContextTarget?.deref()
132
+ if (last && onScreen(last)) return last
133
+ const visible = (selector: string) => [...document.querySelectorAll(selector)].find(onScreen) ?? null
134
+ return visible("[data-lp-context-row]") ?? visible("main [data-lp-context-menu]") ?? visible("[data-lp-context-menu]")
135
+ }
136
+
112
137
  /** Right click instead of the "…" button. */
113
138
  export function contextMenuTip(text: Partial<Pick<HintTip, "title" | "text"> & { stepText: string }> = {}): HintTip {
114
139
  return {
@@ -119,10 +144,7 @@ export function contextMenuTip(text: Partial<Pick<HintTip, "title" | "text"> & {
119
144
  count(HINT_SIGNALS.contextMenu) === 0
120
145
  && (count(HINT_SIGNALS.menuButton) >= 5 || count(HINT_SIGNALS.contextTarget) >= 25),
121
146
  step: () => {
122
- const target = [...document.querySelectorAll("[data-lp-context-menu]")].find((el) => {
123
- const box = el.getBoundingClientRect()
124
- return box.width > 0 && box.bottom > 0 && box.top < window.innerHeight
125
- })
147
+ const target = rightClickTarget()
126
148
  return target ? { target, title: text.title ?? "Right-click works here", text: text.stepText ?? "Right-click this to see what it can do.", try: true } : null
127
149
  },
128
150
  }
@@ -23,6 +23,8 @@ export interface ToastItem {
23
23
  actions?: ToastAction[]
24
24
  /** Whole-toast click handler (UAProject-style clickable toast). */
25
25
  onClick?: () => void | Promise<void>
26
+ /** Copied with the message, not shown: what a bug report needs (request, status, ids). */
27
+ details?: string
26
28
  }
27
29
 
28
30
  export interface ToastOptions {
@@ -36,6 +38,29 @@ export interface ToastOptions {
36
38
  duration?: number
37
39
  actions?: ToastAction[]
38
40
  onClick?: () => void | Promise<void>
41
+ /** Copied with the message, not shown. An Error passed to `error()` brings its own `details`. */
42
+ details?: string
43
+ /** The error behind a hand-written message ("Not saved: " + e.message): its `details` ride along. */
44
+ cause?: unknown
45
+ }
46
+
47
+ /*
48
+ * What a toast can be made from. An Error shows its message; a `details`
49
+ * string on it (an API error's request, status and ids) rides along to the
50
+ * copy button, so "copy" yields something worth pasting into a bug report
51
+ * instead of the same one line the user already sees.
52
+ */
53
+ export type ToastMessage = string | (Error & { details?: string })
54
+
55
+ function detailsOf(source: unknown): string | undefined {
56
+ const details = (source as { details?: unknown } | null | undefined)?.details
57
+ return typeof details === "string" && details ? details : undefined
58
+ }
59
+
60
+ function split(message: ToastMessage, options: ToastOptions): [string, ToastOptions] {
61
+ const text = typeof message === "string" ? message : message.message
62
+ const details = options.details ?? (typeof message === "string" ? undefined : detailsOf(message)) ?? detailsOf(options.cause)
63
+ return [text, { ...options, details }]
39
64
  }
40
65
 
41
66
  const DEFAULT_DURATION = 4500
@@ -54,9 +79,10 @@ const queue = state.queue
54
79
 
55
80
  function push(
56
81
  variant: ToastVariant,
57
- message: string,
58
- options: ToastOptions = {},
82
+ input: ToastMessage,
83
+ given: ToastOptions = {},
59
84
  ): number {
85
+ const [message, options] = split(input, given)
60
86
  // A server render has no one to show it to, and the queue would outlive the
61
87
  // request and surface in the next visitor's page.
62
88
  if (typeof window === "undefined") return -1
@@ -70,6 +96,7 @@ function push(
70
96
  dismissAt: duration > 0 ? Date.now() + duration : null,
71
97
  actions: options.actions,
72
98
  onClick: options.onClick,
99
+ details: options.details,
73
100
  }
74
101
 
75
102
  const same = options.key === undefined ? -1 : queue.findIndex((t) => t.key === options.key)
@@ -91,7 +118,7 @@ function push(
91
118
  export interface ToastPromiseMessages<T> {
92
119
  loading: string
93
120
  success: string | ((value: T) => string)
94
- error: string | ((error: unknown) => string)
121
+ error: string | ((error: unknown) => ToastMessage)
95
122
  }
96
123
 
97
124
  let promiseKey = 0
@@ -135,8 +162,8 @@ export function useToast() {
135
162
  toast: (message: string, o?: ToastOptions) => push("info", message, o),
136
163
  info: (message: string, o?: ToastOptions) => push("info", message, o),
137
164
  success: (message: string, o?: ToastOptions) => push("success", message, o),
138
- warning: (message: string, o?: ToastOptions) => push("warning", message, o),
139
- error: (message: string, o?: ToastOptions) => push("error", message, o),
165
+ warning: (message: ToastMessage, o?: ToastOptions) => push("warning", message, o),
166
+ error: (message: ToastMessage, o?: ToastOptions) => push("error", message, o),
140
167
  promise,
141
168
  /** Low-level push for bridges (e.g. @leavepulse/ui-sdk apiError). */
142
169
  push,
package/src/index.ts CHANGED
@@ -26,7 +26,7 @@ export type { ActionBarAction } from "./components/LpActionBar.vue"
26
26
  export { default as LpAlert } from "./components/LpAlert.vue"
27
27
  export { default as LpAppShell } from "./components/LpAppShell.vue"
28
28
  export { default as LpAutocomplete } from "./components/LpAutocomplete.vue"
29
- export type { AutocompleteOption } from "./components/LpAutocomplete.vue"
29
+ export type { AutocompleteOption, AutocompleteSelection } from "./components/LpAutocomplete.vue"
30
30
  export { default as LpAvatar } from "./components/LpAvatar.vue"
31
31
  export { default as LpBadge } from "./components/LpBadge.vue"
32
32
  export { default as LpBreadcrumbs } from "./components/LpBreadcrumbs.vue"
@@ -175,6 +175,7 @@ export type { SelectOption, SelectValue } from "./components/LpSelect.vue"
175
175
  export { default as LpServiceNode } from "./components/LpServiceNode.vue"
176
176
  export type { ServiceNodeData } from "./components/LpServiceNode.vue"
177
177
  export { default as LpShift } from "./components/LpShift.vue"
178
+ export { default as LpSwap } from "./components/LpSwap.vue"
178
179
  export { default as LpShortcutsDialog } from "./components/LpShortcutsDialog.vue"
179
180
  export { default as LpSidebar } from "./components/LpSidebar.vue"
180
181
  export type { SidebarItem, SidebarSection } from "./components/LpSidebar.vue"
@@ -364,6 +365,7 @@ export { useToast } from "./composables/useToast"
364
365
  export type {
365
366
  ToastAction,
366
367
  ToastItem,
368
+ ToastMessage,
367
369
  ToastOptions,
368
370
  ToastVariant,
369
371
  } from "./composables/useToast"
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Text selection in the theme's colours — opt-in, like scrollbar.css. Without
3
+ * it the browser paints selected text with the operating system's accent
4
+ * (red, green, whatever the desktop theme picked), which clashes with the kit
5
+ * palette and changes from machine to machine; WebKitGTK and Chromium on Linux
6
+ * both read it from the GTK theme.
7
+ *
8
+ * Global on purpose, so it lives outside tokens.css (which stays embeddable).
9
+ * Reads --color-brand, so import it AFTER the tokens:
10
+ * @import "@leavepulse/ui";
11
+ * @import "@leavepulse/ui/selection.css";
12
+ *
13
+ * In `@layer base`, so any rule of the app's own wins over it.
14
+ */
15
+ @layer base {
16
+ ::selection {
17
+ background-color: color-mix(in oklab, var(--color-brand, #7a8a84) 38%, transparent);
18
+ color: inherit;
19
+ }
20
+ }