@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.
- package/dist/assets/HighlightText-BwC5xbqn.css +6 -0
- package/dist/assets/{LpCommandPalette-5miKYsb-.css → LpCommandPalette-DmQUsJqA.css} +21 -21
- package/dist/assets/LpKeys-BxRhfQda.css +36 -0
- package/dist/assets/LpPaletteFacts-B9FdVmIO.css +93 -0
- package/dist/assets/LpPaletteHeader-BVOu1UX5.css +70 -0
- package/dist/assets/LpPalettePreview-CJmAKgYW.css +43 -0
- package/dist/assets/LpPaletteStats-ClE-37MK.css +33 -0
- package/dist/assets/LpPaletteSwatches-CA0B8y2E.css +21 -0
- package/dist/assets/{LpShortcutsDialog-CqYX3yy6.css → LpShortcutsDialog-BUp_BX4s.css} +7 -28
- package/dist/assets/{LpTable-BoeA_TgK.css → LpTable-xWwI4KPZ.css} +17 -17
- package/dist/chunks/HighlightText-BvnYZkhi.js +27 -0
- package/dist/chunks/{LpAvatar-DeSb6H0c.js → LpAvatar-Cb1jtOVv.js} +21 -3
- package/dist/chunks/{LpLightbox-DSDahF23.js → LpLightbox-EVXzAq62.js} +3 -3
- package/dist/chunks/{LpMediaGallery-YKr-cQPN.js → LpMediaGallery-BnlkN_1f.js} +1 -1
- package/dist/chunks/LpPalettePreview-CFav_7co.js +19 -0
- package/dist/component-names.d.ts +1 -1
- package/dist/components/HighlightText.vue.d.ts +7 -0
- package/dist/components/HighlightText.vue.js +4 -0
- package/dist/components/LpAvatar.vue.d.ts +12 -0
- package/dist/components/LpAvatar.vue.js +1 -1
- package/dist/components/LpCommandPalette.vue.d.ts +152 -15
- package/dist/components/LpCommandPalette.vue.js +178 -92
- package/dist/components/LpKeys.vue.d.ts +22 -0
- package/dist/components/LpKeys.vue.js +52 -0
- package/dist/components/LpLightbox.vue.js +1 -1
- package/dist/components/LpMediaGallery.vue.js +1 -1
- package/dist/components/LpPaletteFacts.vue.d.ts +25 -0
- package/dist/components/LpPaletteFacts.vue.js +85 -0
- package/dist/components/LpPaletteHeader.vue.d.ts +32 -0
- package/dist/components/LpPaletteHeader.vue.js +103 -0
- package/dist/components/LpPalettePreview.vue.d.ts +19 -0
- package/dist/components/LpPalettePreview.vue.js +4 -0
- package/dist/components/LpPaletteStats.vue.d.ts +11 -0
- package/dist/components/LpPaletteStats.vue.js +47 -0
- package/dist/components/LpPaletteSwatches.vue.d.ts +10 -0
- package/dist/components/LpPaletteSwatches.vue.js +34 -0
- package/dist/components/LpShortcutsDialog.vue.js +8 -28
- package/dist/components/LpTable.vue.js +5 -3
- package/dist/components/commandPalette.d.ts +157 -0
- package/dist/components/commandPalette.js +103 -0
- package/dist/components/commandSearch.d.ts +32 -0
- package/dist/components/commandSearch.js +48 -0
- package/dist/components/keys.d.ts +2 -0
- package/dist/components/keys.js +11 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.js +157 -134
- package/package.json +1 -1
- package/src/component-names.ts +6 -0
- package/src/components/HighlightText.vue +28 -0
- package/src/components/LpAvatar.vue +21 -2
- package/src/components/LpCommandPalette.vue +387 -87
- package/src/components/LpKeys.vue +79 -0
- package/src/components/LpLightbox.vue +4 -1
- package/src/components/LpPaletteFacts.vue +165 -0
- package/src/components/LpPaletteHeader.vue +155 -0
- package/src/components/LpPalettePreview.vue +77 -0
- package/src/components/LpPaletteStats.vue +81 -0
- package/src/components/LpPaletteSwatches.vue +56 -0
- package/src/components/LpShortcutsDialog.vue +2 -45
- package/src/components/LpTable.vue +6 -1
- package/src/components/commandPalette.ts +264 -0
- package/src/components/commandSearch.ts +79 -0
- package/src/components/keys.ts +13 -0
- 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>
|
|
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>
|
|
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>
|