@leavepulse/ui 0.46.0 → 0.47.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 (64) hide show
  1. package/dist/assets/HighlightText-BwC5xbqn.css +6 -0
  2. package/dist/assets/{LpCommandPalette-5miKYsb-.css → LpCommandPalette-DmQUsJqA.css} +21 -21
  3. package/dist/assets/LpKeys-BxRhfQda.css +36 -0
  4. package/dist/assets/LpPaletteFacts-B9FdVmIO.css +93 -0
  5. package/dist/assets/LpPaletteHeader-BVOu1UX5.css +70 -0
  6. package/dist/assets/LpPalettePreview-CJmAKgYW.css +43 -0
  7. package/dist/assets/LpPaletteStats-ClE-37MK.css +33 -0
  8. package/dist/assets/LpPaletteSwatches-CA0B8y2E.css +21 -0
  9. package/dist/assets/{LpShortcutsDialog-CqYX3yy6.css → LpShortcutsDialog-BUp_BX4s.css} +7 -28
  10. package/dist/assets/{LpTable-BoeA_TgK.css → LpTable-xWwI4KPZ.css} +17 -17
  11. package/dist/chunks/HighlightText-BvnYZkhi.js +27 -0
  12. package/dist/chunks/{LpAvatar-DeSb6H0c.js → LpAvatar-Cb1jtOVv.js} +21 -3
  13. package/dist/chunks/{LpLightbox-DSDahF23.js → LpLightbox-EVXzAq62.js} +3 -3
  14. package/dist/chunks/{LpMediaGallery-YKr-cQPN.js → LpMediaGallery-BnlkN_1f.js} +1 -1
  15. package/dist/chunks/LpPalettePreview-CFav_7co.js +19 -0
  16. package/dist/component-names.d.ts +1 -1
  17. package/dist/components/HighlightText.vue.d.ts +7 -0
  18. package/dist/components/HighlightText.vue.js +4 -0
  19. package/dist/components/LpAvatar.vue.d.ts +12 -0
  20. package/dist/components/LpAvatar.vue.js +1 -1
  21. package/dist/components/LpCommandPalette.vue.d.ts +152 -15
  22. package/dist/components/LpCommandPalette.vue.js +178 -92
  23. package/dist/components/LpKeys.vue.d.ts +22 -0
  24. package/dist/components/LpKeys.vue.js +52 -0
  25. package/dist/components/LpLightbox.vue.js +1 -1
  26. package/dist/components/LpMediaGallery.vue.js +1 -1
  27. package/dist/components/LpPaletteFacts.vue.d.ts +25 -0
  28. package/dist/components/LpPaletteFacts.vue.js +85 -0
  29. package/dist/components/LpPaletteHeader.vue.d.ts +32 -0
  30. package/dist/components/LpPaletteHeader.vue.js +103 -0
  31. package/dist/components/LpPalettePreview.vue.d.ts +19 -0
  32. package/dist/components/LpPalettePreview.vue.js +4 -0
  33. package/dist/components/LpPaletteStats.vue.d.ts +11 -0
  34. package/dist/components/LpPaletteStats.vue.js +47 -0
  35. package/dist/components/LpPaletteSwatches.vue.d.ts +10 -0
  36. package/dist/components/LpPaletteSwatches.vue.js +34 -0
  37. package/dist/components/LpShortcutsDialog.vue.js +8 -28
  38. package/dist/components/LpTable.vue.js +5 -3
  39. package/dist/components/commandPalette.d.ts +157 -0
  40. package/dist/components/commandPalette.js +103 -0
  41. package/dist/components/commandSearch.d.ts +32 -0
  42. package/dist/components/commandSearch.js +48 -0
  43. package/dist/components/keys.d.ts +2 -0
  44. package/dist/components/keys.js +11 -0
  45. package/dist/index.d.ts +12 -3
  46. package/dist/index.js +157 -134
  47. package/package.json +1 -1
  48. package/src/component-names.ts +6 -0
  49. package/src/components/HighlightText.vue +28 -0
  50. package/src/components/LpAvatar.vue +21 -2
  51. package/src/components/LpCommandPalette.vue +387 -87
  52. package/src/components/LpKeys.vue +79 -0
  53. package/src/components/LpLightbox.vue +4 -1
  54. package/src/components/LpPaletteFacts.vue +165 -0
  55. package/src/components/LpPaletteHeader.vue +155 -0
  56. package/src/components/LpPalettePreview.vue +77 -0
  57. package/src/components/LpPaletteStats.vue +81 -0
  58. package/src/components/LpPaletteSwatches.vue +56 -0
  59. package/src/components/LpShortcutsDialog.vue +2 -45
  60. package/src/components/LpTable.vue +6 -1
  61. package/src/components/commandPalette.ts +264 -0
  62. package/src/components/commandSearch.ts +79 -0
  63. package/src/components/keys.ts +13 -0
  64. package/src/index.ts +12 -3
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ /*
3
+ * Text that may arrive already split into matched and unmatched runs (the
4
+ * palette preview slot's `highlight(text)`), drawn with the same <mark> the
5
+ * palette's rows use. A plain string is drawn as is.
6
+ */
7
+ import type { HighlightPart } from "./commandSearch"
8
+
9
+ defineProps<{ text: string | HighlightPart[] }>()
10
+ </script>
11
+
12
+ <template>
13
+ <template v-if="typeof text === 'string'">{{ text }}</template>
14
+ <template v-else>
15
+ <template v-for="(part, index) in text" :key="index">
16
+ <mark v-if="part.hit" class="lp-highlight">{{ part.text }}</mark>
17
+ <template v-else>{{ part.text }}</template>
18
+ </template>
19
+ </template>
20
+ </template>
21
+
22
+ <style>
23
+ .lp-highlight {
24
+ border-radius: 2px;
25
+ background: color-mix(in srgb, var(--color-brand) 25%, transparent);
26
+ color: var(--color-ink);
27
+ }
28
+ </style>
@@ -10,6 +10,7 @@ import { AvatarFallback, AvatarImage, AvatarRoot } from "reka-ui"
10
10
  import { tv, type VariantProps } from "tailwind-variants"
11
11
  import { computed, onMounted, ref } from "vue"
12
12
  import LpContextMenu, { type ContextMenuItemDef } from "./LpContextMenu.vue"
13
+ import LpIcon from "./LpIcon.vue"
13
14
  import { useMergedAttrs } from "../composables/useMergedClass"
14
15
 
15
16
  const avatar = tv({
@@ -41,6 +42,12 @@ const props = withDefaults(
41
42
  src?: string
42
43
  alt?: string
43
44
  fallback?: string
45
+ /**
46
+ * An icon shown while there is no picture, instead of initials. For things
47
+ * that have no name worth abbreviating (a world, a mod, a file), where two
48
+ * letters read as noise. `fallback` text still wins when both are given.
49
+ */
50
+ icon?: string
44
51
  size?: AvatarVariants["size"]
45
52
  /** Explicit pixel size, wins over `size` — for avatars keyed to a layout. */
46
53
  pixelSize?: number
@@ -54,6 +61,12 @@ const props = withDefaults(
54
61
  { size: "md", shape: "circle", ring: false },
55
62
  )
56
63
 
64
+ // The icon follows the box the way the initials do: about half of it.
65
+ const ICON_SIZE = { xs: 11, sm: 14, md: 18, lg: 24, xl: 30 } as const
66
+ const iconSize = computed(() =>
67
+ props.pixelSize ? Math.max(10, Math.round(props.pixelSize * 0.55)) : ICON_SIZE[props.size ?? "md"],
68
+ )
69
+
57
70
  // A pixel size drives both box and glyph, so the initials keep their
58
71
  // proportion instead of staying at the preset's step.
59
72
  const sizeStyle = computed(() =>
@@ -99,11 +112,17 @@ onMounted(() => {
99
112
  <LpContextMenu v-if="menuItems?.length" :items="menuItems">
100
113
  <AvatarRoot :class="rootClass" :style="sizeStyle" v-bind="rest">
101
114
  <AvatarImage v-if="src && mounted" :src="src" :alt="alt" class="size-full object-cover animate-[fade-in_var(--duration-medium)_ease] motion-reduce:animate-none" />
102
- <AvatarFallback>{{ initials }}</AvatarFallback>
115
+ <AvatarFallback>
116
+ <LpIcon v-if="icon && !fallback" :name="icon" :size="iconSize" />
117
+ <template v-else>{{ initials }}</template>
118
+ </AvatarFallback>
103
119
  </AvatarRoot>
104
120
  </LpContextMenu>
105
121
  <AvatarRoot v-else :class="rootClass" :style="sizeStyle" v-bind="rest">
106
122
  <AvatarImage v-if="src && mounted" :src="src" :alt="alt" class="size-full object-cover animate-[fade-in_var(--duration-medium)_ease] motion-reduce:animate-none" />
107
- <AvatarFallback>{{ initials }}</AvatarFallback>
123
+ <AvatarFallback>
124
+ <LpIcon v-if="icon && !fallback" :name="icon" :size="iconSize" />
125
+ <template v-else>{{ initials }}</template>
126
+ </AvatarFallback>
108
127
  </AvatarRoot>
109
128
  </template>