@leavepulse/ui 0.37.10 → 0.38.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/LpCommandPalette-C0yStVNy.css +21 -0
- package/dist/chunks/LpSwitch-Blizvqyt.js +94 -0
- package/dist/components/LpCommandPalette.vue.d.ts +87 -1
- package/dist/components/LpCommandPalette.vue.js +410 -121
- package/dist/components/LpSwitch.vue.d.ts +31 -2
- package/dist/components/LpSwitch.vue.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/LpCommandPalette.vue +492 -76
- package/src/components/LpSwitch.vue +55 -10
- package/src/tokens/tokens.css +21 -0
- package/dist/assets/LpCommandPalette-B-g1fa8r.css +0 -16
- package/dist/chunks/LpSwitch-xgnRU2k0.js +0 -35
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
.lp-cmd-excerpt[data-v-2a5d3558] {
|
|
3
|
+
display: -webkit-box;
|
|
4
|
+
-webkit-box-orient: vertical;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
/* Each result eases in; honours reduced motion. */
|
|
8
|
+
.lp-cmd-item[data-v-2a5d3558] {
|
|
9
|
+
animation: lp-cmd-in-2a5d3558 140ms ease-out both;
|
|
10
|
+
}
|
|
11
|
+
@keyframes lp-cmd-in-2a5d3558 {
|
|
12
|
+
from {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
transform: translateY(3px);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
@media (prefers-reduced-motion: reduce) {
|
|
18
|
+
.lp-cmd-item[data-v-2a5d3558] {
|
|
19
|
+
animation: none;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineComponent, useSlots, computed, openBlock, createElementBlock, mergeProps, unref, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, normalizeClass, withCtx, createBlock } from "vue";
|
|
2
|
+
import { SwitchRoot, SwitchThumb } from "reka-ui";
|
|
3
|
+
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "flex min-w-0 flex-col"
|
|
7
|
+
};
|
|
8
|
+
const _hoisted_2 = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "text-xs text-muted"
|
|
11
|
+
};
|
|
12
|
+
const _hoisted_3 = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "flex min-w-0 flex-col"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_4 = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "text-xs text-muted"
|
|
19
|
+
};
|
|
20
|
+
const __default__ = { inheritAttrs: false };
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
+
...__default__,
|
|
23
|
+
__name: "LpSwitch",
|
|
24
|
+
props: {
|
|
25
|
+
modelValue: { type: Boolean },
|
|
26
|
+
disabled: { type: Boolean },
|
|
27
|
+
label: {},
|
|
28
|
+
description: {},
|
|
29
|
+
labelPosition: { default: "end" }
|
|
30
|
+
},
|
|
31
|
+
emits: ["update:modelValue"],
|
|
32
|
+
setup(__props, { emit: __emit }) {
|
|
33
|
+
const props = __props;
|
|
34
|
+
const emit = __emit;
|
|
35
|
+
const slots = useSlots();
|
|
36
|
+
const labelled = computed(() => Boolean(props.label || props.description || slots.default));
|
|
37
|
+
const TRACK = "group inline-flex h-5 w-9 shrink-0 items-center rounded-pill border border-line bg-surface-soft px-0.5 outline-none transition-colors duration-[var(--duration-fast)] focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-transparent data-[state=checked]:bg-brand disabled:cursor-not-allowed disabled:opacity-55";
|
|
38
|
+
const THUMB = "h-3.5 w-3.5 rounded-full bg-ink shadow transition-[translate,width,background-color] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:w-5 group-data-[state=checked]:translate-x-4 group-data-[state=checked]:bg-ink-inverse group-data-[state=checked]:group-active:-translate-x-1 motion-reduce:group-active:w-3.5";
|
|
39
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs(() => {
|
|
40
|
+
if (!labelled.value) return TRACK;
|
|
41
|
+
return props.labelPosition === "start" ? "flex w-full cursor-pointer items-center justify-between gap-3 text-sm text-ink" : "inline-flex cursor-pointer items-center gap-2 text-sm text-ink";
|
|
42
|
+
});
|
|
43
|
+
function onUpdate(value) {
|
|
44
|
+
emit("update:modelValue", value);
|
|
45
|
+
}
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
return labelled.value ? (openBlock(), createElementBlock("label", mergeProps({
|
|
48
|
+
key: 0,
|
|
49
|
+
class: [unref(rootClass), __props.disabled && "cursor-not-allowed"]
|
|
50
|
+
}, unref(rest)), [
|
|
51
|
+
__props.labelPosition === "start" ? (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
52
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
53
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
54
|
+
]),
|
|
55
|
+
__props.description ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.description), 1)) : createCommentVNode("", true)
|
|
56
|
+
])) : createCommentVNode("", true),
|
|
57
|
+
createVNode(unref(SwitchRoot), {
|
|
58
|
+
"model-value": __props.modelValue,
|
|
59
|
+
disabled: __props.disabled,
|
|
60
|
+
class: normalizeClass(TRACK),
|
|
61
|
+
"onUpdate:modelValue": onUpdate
|
|
62
|
+
}, {
|
|
63
|
+
default: withCtx(() => [
|
|
64
|
+
createVNode(unref(SwitchThumb), {
|
|
65
|
+
class: normalizeClass(THUMB)
|
|
66
|
+
})
|
|
67
|
+
]),
|
|
68
|
+
_: 1
|
|
69
|
+
}, 8, ["model-value", "disabled"]),
|
|
70
|
+
__props.labelPosition === "end" ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
|
71
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
72
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
73
|
+
]),
|
|
74
|
+
__props.description ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.description), 1)) : createCommentVNode("", true)
|
|
75
|
+
])) : createCommentVNode("", true)
|
|
76
|
+
], 16)) : (openBlock(), createBlock(unref(SwitchRoot), mergeProps({
|
|
77
|
+
key: 1,
|
|
78
|
+
"model-value": __props.modelValue,
|
|
79
|
+
disabled: __props.disabled,
|
|
80
|
+
class: unref(rootClass)
|
|
81
|
+
}, unref(rest), { "onUpdate:modelValue": onUpdate }), {
|
|
82
|
+
default: withCtx(() => [
|
|
83
|
+
createVNode(unref(SwitchThumb), {
|
|
84
|
+
class: normalizeClass(THUMB)
|
|
85
|
+
})
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
}, 16, ["model-value", "disabled", "class"]));
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
export {
|
|
93
|
+
_sfc_main as _
|
|
94
|
+
};
|
|
@@ -3,6 +3,19 @@ export interface Command {
|
|
|
3
3
|
label: string;
|
|
4
4
|
/** Second line under the label. */
|
|
5
5
|
description?: string;
|
|
6
|
+
/**
|
|
7
|
+
* A passage of the matched text, wrapped over several lines (clamped by
|
|
8
|
+
* `excerptLines`) instead of truncated to one. For results a server found
|
|
9
|
+
* inside long text — a docs section, a ticket, a message — where the reason
|
|
10
|
+
* the row matched is the part worth reading before opening it.
|
|
11
|
+
*/
|
|
12
|
+
excerpt?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Extra words to highlight besides the typed query. A server that matches
|
|
15
|
+
* word forms or typos knows which words actually matched; the query alone
|
|
16
|
+
* would leave those unmarked.
|
|
17
|
+
*/
|
|
18
|
+
highlight?: string[];
|
|
6
19
|
icon?: string;
|
|
7
20
|
/** Right-aligned hint, e.g. "⌘P". */
|
|
8
21
|
shortcut?: string;
|
|
@@ -35,6 +48,27 @@ export interface Command {
|
|
|
35
48
|
* reopening and retyping.
|
|
36
49
|
*/
|
|
37
50
|
keepOpen?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Where the command leads. The row renders as a real link, so Ctrl/⌘-click,
|
|
53
|
+
* Shift-click and middle-click open it the way the browser opens any link,
|
|
54
|
+
* and Ctrl/⌘+Enter opens it in a new tab from the keyboard. A plain pick
|
|
55
|
+
* still runs `onSelect` (a router push, say); without one it follows the
|
|
56
|
+
* link.
|
|
57
|
+
*/
|
|
58
|
+
href?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Further things to do with this result besides opening it — copy its id,
|
|
61
|
+
* open it elsewhere, share it. Tab on the highlighted row lists them as a
|
|
62
|
+
* mode named after the row. A command with `href` gets "open in new tab"
|
|
63
|
+
* and "copy link" after its own.
|
|
64
|
+
*/
|
|
65
|
+
actions?: Command[];
|
|
66
|
+
/**
|
|
67
|
+
* The whole text behind this result, for the preview pane (`previewPane`):
|
|
68
|
+
* the section a docs hit points into, the ticket body, the message. Line
|
|
69
|
+
* breaks are kept. Without it the pane shows the `excerpt`.
|
|
70
|
+
*/
|
|
71
|
+
preview?: string;
|
|
38
72
|
onSelect?: () => void;
|
|
39
73
|
}
|
|
40
74
|
/** Footer hints and the mode chip, spelled out so an app can translate them. */
|
|
@@ -45,6 +79,19 @@ export interface PaletteLabels {
|
|
|
45
79
|
/** Hint for leaving a mode, shown only while inside one. */
|
|
46
80
|
back: string;
|
|
47
81
|
searching: string;
|
|
82
|
+
/** Shown when `search` (or a fetching mode) threw. */
|
|
83
|
+
searchFailed: string;
|
|
84
|
+
retry: string;
|
|
85
|
+
/** The row that unfolds a group cut by `groupLimit`; `{count}` is how many are hidden. */
|
|
86
|
+
showMore: string;
|
|
87
|
+
/** Footer hint for Tab while the highlighted row has actions. */
|
|
88
|
+
actions: string;
|
|
89
|
+
openInNewTab: string;
|
|
90
|
+
copyLink: string;
|
|
91
|
+
/** Toast after "copy link"; empty for none. */
|
|
92
|
+
linkCopied: string;
|
|
93
|
+
/** The preview pane when the highlighted row has nothing to show. */
|
|
94
|
+
noPreview: string;
|
|
48
95
|
}
|
|
49
96
|
type __VLS_Props = {
|
|
50
97
|
open?: boolean;
|
|
@@ -81,8 +128,37 @@ type __VLS_Props = {
|
|
|
81
128
|
resultsLabel?: string;
|
|
82
129
|
/** Footer hints and the mode chip, spelled out for translation. */
|
|
83
130
|
labels?: Partial<PaletteLabels>;
|
|
131
|
+
/** Lines an `excerpt` may wrap to before it is clamped. */
|
|
132
|
+
excerptLines?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Rows a group shows before folding the rest behind a "Show N more" row.
|
|
135
|
+
* One provider answering with thirty people would otherwise push every
|
|
136
|
+
* other group off the screen. 0 shows everything.
|
|
137
|
+
*/
|
|
138
|
+
groupLimit?: number;
|
|
139
|
+
/**
|
|
140
|
+
* When the query matches nothing, retry it as if typed in the other
|
|
141
|
+
* keyboard layout (QWERTY ↔ ЙЦУКЕН). Off for an app whose commands are
|
|
142
|
+
* meant to be typed in one layout only.
|
|
143
|
+
*/
|
|
144
|
+
layoutFallback?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* A pane beside the list showing the highlighted result in full — its
|
|
147
|
+
* `preview` text, or the `preview` slot. For palettes that search
|
|
148
|
+
* content rather than commands: the excerpt says why a row matched, the
|
|
149
|
+
* pane lets it be read without leaving the page. Opt-in and fixed while
|
|
150
|
+
* open, so the dialog does not change width as results come and go.
|
|
151
|
+
* Hidden below the md breakpoint, where there is no room beside the list.
|
|
152
|
+
*/
|
|
153
|
+
previewPane?: boolean;
|
|
84
154
|
};
|
|
85
|
-
|
|
155
|
+
type __VLS_Slots = {
|
|
156
|
+
/** Body of the preview pane for the highlighted command. */
|
|
157
|
+
preview?: (props: {
|
|
158
|
+
command: Command;
|
|
159
|
+
}) => unknown;
|
|
160
|
+
};
|
|
161
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
86
162
|
select: (command: Command) => any;
|
|
87
163
|
"update:open": (value: boolean) => any;
|
|
88
164
|
run: (id: string, command: Command) => any;
|
|
@@ -99,6 +175,16 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {
|
|
|
99
175
|
hotkey: boolean;
|
|
100
176
|
recentLabel: string;
|
|
101
177
|
resultsLabel: string;
|
|
178
|
+
excerptLines: number;
|
|
179
|
+
groupLimit: number;
|
|
180
|
+
layoutFallback: boolean;
|
|
181
|
+
previewPane: boolean;
|
|
102
182
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
183
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
103
184
|
declare const _default: typeof __VLS_export;
|
|
104
185
|
export default _default;
|
|
186
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
187
|
+
new (): {
|
|
188
|
+
$slots: S;
|
|
189
|
+
};
|
|
190
|
+
};
|