@leavepulse/ui 0.42.0 → 0.43.1
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-Esv0a-gS.css → LpCommandPalette-s_kKuCRf.css} +21 -21
- package/dist/chunks/{LpAddressInput-CMjaPQVw.js → LpAddressInput-B-Zvxsn7.js} +1 -1
- package/dist/chunks/{LpAppShell-Bcv6EhqU.js → LpAppShell-BGQVIY-3.js} +1 -1
- package/dist/chunks/{LpConfirmDialog-BNAvOR24.js → LpConfirmDialog-Q-bxff8z.js} +1 -1
- package/dist/chunks/{LpDrawer-DgaS2s2i.js → LpDrawer-BZ6k3hvo.js} +3 -3
- package/dist/chunks/{LpLightbox-oLqyjOln.js → LpLightbox-2sYVMY-S.js} +12 -4
- package/dist/chunks/{LpMediaGallery-Cid7PGYx.js → LpMediaGallery-FF-NquIo.js} +1 -1
- package/dist/chunks/{LpModal-8bja5bWS.js → LpModal-Bt0pQCI_.js} +2 -2
- package/dist/chunks/{LpModalNav-w9kfwHqO.js → LpModalNav-YaifHrXC.js} +2 -2
- package/dist/chunks/{LpSidebar-DlTn5nXc.js → LpSidebar-ClBUwoEz.js} +1 -1
- package/dist/components/LpAddressInput.vue.js +1 -1
- package/dist/components/LpAppShell.vue.js +1 -1
- package/dist/components/LpCommandPalette.vue.js +19 -72
- package/dist/components/LpConfirmDialog.vue.js +1 -1
- package/dist/components/LpDrawer.vue.js +1 -1
- package/dist/components/LpLightbox.vue.js +1 -1
- package/dist/components/LpMediaGallery.vue.js +1 -1
- package/dist/components/LpModal.vue.js +1 -1
- package/dist/components/LpModalNav.vue.js +1 -1
- package/dist/components/LpShortcutsDialog.vue.js +1 -1
- package/dist/components/LpSidebar.vue.js +1 -1
- package/dist/components/commandSearch.js +66 -0
- package/dist/components/modalDepth.js +2 -1
- package/dist/index.js +13 -9
- package/package.json +3 -3
- package/src/components/LpCommandPalette.vue +18 -110
- package/src/components/LpDrawer.vue +3 -3
- package/src/components/LpLightbox.vue +11 -5
- package/src/components/LpModal.vue +2 -2
- package/src/components/commandSearch.ts +92 -0
- package/src/components/modalDepth.ts +2 -46
- package/src/index.ts +2 -0
- package/src/tokens/tokens.css +13 -19
- package/dist/component-names.d.ts +0 -1
- package/dist/components/LayoutCanvas.vue.d.ts +0 -28
- package/dist/components/LayoutNode.vue.d.ts +0 -40
- package/dist/components/LpActionBar.vue.d.ts +0 -84
- package/dist/components/LpAddressInput.vue.d.ts +0 -70
- package/dist/components/LpAlert.vue.d.ts +0 -44
- package/dist/components/LpAppShell.vue.d.ts +0 -123
- package/dist/components/LpAutocomplete.vue.d.ts +0 -50
- package/dist/components/LpAvatar.vue.d.ts +0 -34
- package/dist/components/LpBadge.vue.d.ts +0 -20
- package/dist/components/LpBreadcrumbs.vue.d.ts +0 -32
- package/dist/components/LpButton.vue.d.ts +0 -113
- package/dist/components/LpCalendar.vue.d.ts +0 -29
- package/dist/components/LpCard.vue.d.ts +0 -60
- package/dist/components/LpChart.vue.d.ts +0 -130
- package/dist/components/LpCheckbox.vue.d.ts +0 -32
- package/dist/components/LpCodeBlock.vue.d.ts +0 -58
- package/dist/components/LpColorPicker.vue.d.ts +0 -124
- package/dist/components/LpCommandPalette.vue.d.ts +0 -206
- package/dist/components/LpConfirmDialog.vue.d.ts +0 -59
- package/dist/components/LpContextMenu.vue.d.ts +0 -44
- package/dist/components/LpDatePicker.vue.d.ts +0 -33
- package/dist/components/LpDisclosure.vue.d.ts +0 -47
- package/dist/components/LpDivider.vue.d.ts +0 -17
- package/dist/components/LpDrawer.vue.d.ts +0 -170
- package/dist/components/LpDropdownMenu.vue.d.ts +0 -23
- package/dist/components/LpDropzone.vue.d.ts +0 -90
- package/dist/components/LpEmptyState.vue.d.ts +0 -28
- package/dist/components/LpFileTree.vue.d.ts +0 -126
- package/dist/components/LpFileTreeNode.vue.d.ts +0 -62
- package/dist/components/LpFormField.vue.d.ts +0 -24
- package/dist/components/LpIcon.vue.d.ts +0 -8
- package/dist/components/LpImageEditor.vue.d.ts +0 -106
- package/dist/components/LpInfraNode.vue.d.ts +0 -65
- package/dist/components/LpInput.vue.d.ts +0 -80
- package/dist/components/LpLaneNode.vue.d.ts +0 -24
- package/dist/components/LpLightbox.vue.d.ts +0 -62
- package/dist/components/LpLink.vue.d.ts +0 -93
- package/dist/components/LpLogViewer.vue.d.ts +0 -153
- package/dist/components/LpMapPicker.vue.d.ts +0 -59
- package/dist/components/LpMediaGallery.vue.d.ts +0 -80
- package/dist/components/LpModal.vue.d.ts +0 -66
- package/dist/components/LpModalNav.vue.d.ts +0 -66
- package/dist/components/LpNotificationBell.vue.d.ts +0 -85
- package/dist/components/LpNumberField.vue.d.ts +0 -21
- package/dist/components/LpNumberFlow.vue.d.ts +0 -35
- package/dist/components/LpOtpInput.vue.d.ts +0 -39
- package/dist/components/LpPagination.vue.d.ts +0 -35
- package/dist/components/LpPasswordInput.vue.d.ts +0 -36
- package/dist/components/LpPhoneInput.vue.d.ts +0 -49
- package/dist/components/LpPie.vue.d.ts +0 -196
- package/dist/components/LpPopover.vue.d.ts +0 -34
- package/dist/components/LpProgress.vue.d.ts +0 -66
- package/dist/components/LpRadio.vue.d.ts +0 -18
- package/dist/components/LpRadioGroup.vue.d.ts +0 -26
- package/dist/components/LpRollingText.vue.d.ts +0 -33
- package/dist/components/LpScrollArea.vue.d.ts +0 -28
- package/dist/components/LpSection.vue.d.ts +0 -120
- package/dist/components/LpSegmented.vue.d.ts +0 -30
- package/dist/components/LpSelect.vue.d.ts +0 -47
- package/dist/components/LpServiceNode.vue.d.ts +0 -14
- package/dist/components/LpShift.vue.d.ts +0 -36
- package/dist/components/LpShortcutsDialog.vue.d.ts +0 -24
- package/dist/components/LpSidebar.vue.d.ts +0 -146
- package/dist/components/LpSidebarNav.vue.d.ts +0 -54
- package/dist/components/LpSkeleton.vue.d.ts +0 -16
- package/dist/components/LpSlider.vue.d.ts +0 -30
- package/dist/components/LpSparkline.vue.d.ts +0 -48
- package/dist/components/LpStat.vue.d.ts +0 -69
- package/dist/components/LpStepper.vue.d.ts +0 -36
- package/dist/components/LpSwitch.vue.d.ts +0 -42
- package/dist/components/LpTable.vue.d.ts +0 -124
- package/dist/components/LpTableOfContents.vue.d.ts +0 -19
- package/dist/components/LpTabs.vue.d.ts +0 -47
- package/dist/components/LpTextarea.vue.d.ts +0 -22
- package/dist/components/LpThemeSwitcher.vue.d.ts +0 -47
- package/dist/components/LpTilt.vue.d.ts +0 -31
- package/dist/components/LpTimeField.vue.d.ts +0 -24
- package/dist/components/LpToaster.vue.d.ts +0 -3
- package/dist/components/LpTooltip.vue.d.ts +0 -58
- package/dist/components/LpTopologyCanvas.vue.d.ts +0 -205
- package/dist/components/LpUptimeBar.vue.d.ts +0 -46
- package/dist/components/LpWaypointEdge.vue.d.ts +0 -21
- package/dist/components/actionBar.d.ts +0 -19
- package/dist/components/address.d.ts +0 -107
- package/dist/components/chart.d.ts +0 -180
- package/dist/components/codeHighlight.d.ts +0 -8
- package/dist/components/color.d.ts +0 -65
- package/dist/components/countries-data.d.ts +0 -2
- package/dist/components/countries.d.ts +0 -20
- package/dist/components/dropdown.d.ts +0 -29
- package/dist/components/fileTree.d.ts +0 -79
- package/dist/components/lightbox.d.ts +0 -24
- package/dist/components/modalDepth.d.ts +0 -15
- package/dist/components/sidebar.d.ts +0 -42
- package/dist/composables/easing.d.ts +0 -46
- package/dist/composables/useAsyncTask.d.ts +0 -18
- package/dist/composables/useClipboard.d.ts +0 -46
- package/dist/composables/useFormDraft.d.ts +0 -67
- package/dist/composables/useGlass.d.ts +0 -9
- package/dist/composables/useHotkeys.d.ts +0 -101
- package/dist/composables/useInputFilter.d.ts +0 -14
- package/dist/composables/useMergedClass.d.ts +0 -42
- package/dist/composables/usePillTransition.d.ts +0 -21
- package/dist/composables/useReveal.d.ts +0 -26
- package/dist/composables/useRovingFocus.d.ts +0 -49
- package/dist/composables/useSettled.d.ts +0 -26
- package/dist/composables/useShift.d.ts +0 -35
- package/dist/composables/useTilt.d.ts +0 -23
- package/dist/composables/useToast.d.ts +0 -41
- package/dist/composables/useZoomPan.d.ts +0 -58
- package/dist/icons.d.ts +0 -1
- package/dist/index.d.ts +0 -160
- package/dist/layout/registry.d.ts +0 -26
- package/dist/layout/tree.d.ts +0 -75
- package/dist/layout/useLayout.d.ts +0 -39
- package/dist/theme/backdrop.d.ts +0 -9
- package/dist/theme/config.d.ts +0 -16
- package/dist/theme/define.d.ts +0 -12
- package/dist/theme/presets.d.ts +0 -20
- package/dist/theme/tokens.d.ts +0 -75
- package/dist/theme/useTheme.d.ts +0 -46
|
@@ -5,81 +5,81 @@
|
|
|
5
5
|
* pane from its right edge as it grows. Animating the columns themselves made
|
|
6
6
|
* every line of the list and the pane re-wrap on every frame.
|
|
7
7
|
*/
|
|
8
|
-
.lp-cmd-dialog[data-v-
|
|
8
|
+
.lp-cmd-dialog[data-v-10500f32] {
|
|
9
9
|
--lp-cmd-list: min(92vw, 40rem);
|
|
10
10
|
--lp-cmd-pane: max(0px, min(26rem, 96vw - var(--lp-cmd-list)));
|
|
11
11
|
width: var(--lp-cmd-list);
|
|
12
12
|
}
|
|
13
|
-
.lp-cmd-split[data-v-
|
|
13
|
+
.lp-cmd-split[data-v-10500f32] {
|
|
14
14
|
transition:
|
|
15
15
|
width 300ms var(--ease-emphasized, ease),
|
|
16
16
|
min-height 300ms var(--ease-emphasized, ease);
|
|
17
17
|
}
|
|
18
18
|
@media (min-width: 768px) {
|
|
19
|
-
.lp-cmd-split .lp-cmd-list[data-v-
|
|
19
|
+
.lp-cmd-split .lp-cmd-list[data-v-10500f32] {
|
|
20
20
|
flex: 0 0 auto;
|
|
21
21
|
/* the dialog's 1px border on each side */
|
|
22
22
|
width: calc(var(--lp-cmd-list) - 2px);
|
|
23
23
|
}
|
|
24
|
-
.lp-cmd-dialog[data-pane="open"][data-v-
|
|
24
|
+
.lp-cmd-dialog[data-pane="open"][data-v-10500f32] {
|
|
25
25
|
width: calc(var(--lp-cmd-list) + var(--lp-cmd-pane));
|
|
26
26
|
min-height: min(76vh, 36rem);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
.lp-cmd-pane[data-v-
|
|
29
|
+
.lp-cmd-pane[data-v-10500f32] {
|
|
30
30
|
width: var(--lp-cmd-pane);
|
|
31
31
|
}
|
|
32
32
|
/*
|
|
33
33
|
* The pane rides in from the right edge while the dialog opens up to it, and
|
|
34
34
|
* leaves the same way, for as long as the dialog takes to close over it.
|
|
35
35
|
*/
|
|
36
|
-
.lp-cmd-pane-enter-active[data-v-
|
|
37
|
-
.lp-cmd-pane-leave-active[data-v-
|
|
36
|
+
.lp-cmd-pane-enter-active[data-v-10500f32],
|
|
37
|
+
.lp-cmd-pane-leave-active[data-v-10500f32] {
|
|
38
38
|
transition:
|
|
39
39
|
transform 300ms var(--ease-emphasized, ease),
|
|
40
40
|
opacity 300ms ease;
|
|
41
41
|
}
|
|
42
|
-
.lp-cmd-pane-enter-from[data-v-
|
|
43
|
-
.lp-cmd-pane-leave-to[data-v-
|
|
42
|
+
.lp-cmd-pane-enter-from[data-v-10500f32],
|
|
43
|
+
.lp-cmd-pane-leave-to[data-v-10500f32] {
|
|
44
44
|
opacity: 0;
|
|
45
45
|
transform: translateX(40%);
|
|
46
46
|
}
|
|
47
|
-
.lp-cmd-para[data-v-
|
|
48
|
-
animation: lp-cmd-para-in-
|
|
47
|
+
.lp-cmd-para[data-v-10500f32] {
|
|
48
|
+
animation: lp-cmd-para-in-10500f32 260ms ease-out both;
|
|
49
49
|
}
|
|
50
|
-
@keyframes lp-cmd-para-in-
|
|
50
|
+
@keyframes lp-cmd-para-in-10500f32 {
|
|
51
51
|
from {
|
|
52
52
|
opacity: 0;
|
|
53
53
|
transform: translateY(4px);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
@media (prefers-reduced-motion: reduce) {
|
|
57
|
-
.lp-cmd-split[data-v-
|
|
58
|
-
.lp-cmd-pane-enter-active[data-v-
|
|
59
|
-
.lp-cmd-pane-leave-active[data-v-
|
|
57
|
+
.lp-cmd-split[data-v-10500f32],
|
|
58
|
+
.lp-cmd-pane-enter-active[data-v-10500f32],
|
|
59
|
+
.lp-cmd-pane-leave-active[data-v-10500f32] {
|
|
60
60
|
transition: none;
|
|
61
61
|
}
|
|
62
|
-
.lp-cmd-para[data-v-
|
|
62
|
+
.lp-cmd-para[data-v-10500f32] {
|
|
63
63
|
animation: none;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
.lp-cmd-excerpt[data-v-
|
|
66
|
+
.lp-cmd-excerpt[data-v-10500f32] {
|
|
67
67
|
display: -webkit-box;
|
|
68
68
|
-webkit-box-orient: vertical;
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
}
|
|
71
71
|
/* Each result eases in; honours reduced motion. */
|
|
72
|
-
.lp-cmd-item[data-v-
|
|
73
|
-
animation: lp-cmd-in-
|
|
72
|
+
.lp-cmd-item[data-v-10500f32] {
|
|
73
|
+
animation: lp-cmd-in-10500f32 140ms ease-out both;
|
|
74
74
|
}
|
|
75
|
-
@keyframes lp-cmd-in-
|
|
75
|
+
@keyframes lp-cmd-in-10500f32 {
|
|
76
76
|
from {
|
|
77
77
|
opacity: 0;
|
|
78
78
|
transform: translateY(3px);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
@media (prefers-reduced-motion: reduce) {
|
|
82
|
-
.lp-cmd-item[data-v-
|
|
82
|
+
.lp-cmd-item[data-v-10500f32] {
|
|
83
83
|
animation: none;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -6,7 +6,7 @@ import { _ as _sfc_main$3 } from "./LpButton-5VXXCjwF.js";
|
|
|
6
6
|
import { _ as _sfc_main$1 } from "./LpFormField-CazBc2-a.js";
|
|
7
7
|
import { _ as _sfc_main$4 } from "./LpIcon-CCnX5_2j.js";
|
|
8
8
|
import { _ as _sfc_main$5 } from "./LpInput-9EXWUM9B.js";
|
|
9
|
-
import { _ as _sfc_main$7 } from "./LpModal-
|
|
9
|
+
import { _ as _sfc_main$7 } from "./LpModal-Bt0pQCI_.js";
|
|
10
10
|
import { _ as _sfc_main$6 } from "./LpSelect-ANIVtrpM.js";
|
|
11
11
|
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
12
12
|
const _hoisted_1 = { class: "flex items-stretch gap-2" };
|
|
@@ -3,7 +3,7 @@ import { _ as _sfc_main$2 } from "./LpButton-5VXXCjwF.js";
|
|
|
3
3
|
import { _ as _sfc_main$3 } from "./LpIcon-CCnX5_2j.js";
|
|
4
4
|
import { _ as _sfc_main$5 } from "./LpScrollArea-D8xyKXcF.js";
|
|
5
5
|
import { _ as _sfc_main$4 } from "./LpShift-DXNsauQZ.js";
|
|
6
|
-
import { _ as _sfc_main$1 } from "./LpSidebar-
|
|
6
|
+
import { _ as _sfc_main$1 } from "./LpSidebar-ClBUwoEz.js";
|
|
7
7
|
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
8
8
|
const _hoisted_1 = { class: "flex min-w-0 flex-1 flex-col" };
|
|
9
9
|
const _hoisted_2 = { class: "relative flex h-16 shrink-0 items-center gap-3 border-b border-line bg-surface px-4 md:px-6" };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createBlock, createSlots, withCtx, renderSlot, createVNode, createTextVNode, toDisplayString, createElementVNode, normalizeClass } from "vue";
|
|
2
2
|
import { _ as _sfc_main$2 } from "./LpButton-5VXXCjwF.js";
|
|
3
3
|
import { _ as _sfc_main$3 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
-
import { _ as _sfc_main$1 } from "./LpModal-
|
|
4
|
+
import { _ as _sfc_main$1 } from "./LpModal-Bt0pQCI_.js";
|
|
5
5
|
const _hoisted_1 = { class: "inline-flex items-center gap-2.5" };
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
7
|
__name: "LpConfirmDialog",
|
|
@@ -54,7 +54,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
54
54
|
watch(() => props.open, (open) => open ? claim() : release(), { immediate: true });
|
|
55
55
|
onBeforeUnmount(release);
|
|
56
56
|
const contentClass = computed(() => {
|
|
57
|
-
const surface = frosted.value ? "lp-glass-overlay" : "bg-surface-raised";
|
|
57
|
+
const surface = frosted.value ? layer.value.nested ? "lp-glass-overlay--nested" : "lp-glass-overlay" : "bg-surface-raised";
|
|
58
58
|
const base = `fixed z-(--z-modal) flex flex-col border-line ${surface} shadow-panel outline-none`;
|
|
59
59
|
const map = {
|
|
60
60
|
left: "inset-y-0 left-0 border-r rounded-r-card",
|
|
@@ -270,7 +270,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
270
270
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
271
271
|
__props.edgeOpen && isHorizontal.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
272
272
|
withDirectives(createElementVNode("div", {
|
|
273
|
-
class: normalizeClass(["lp-scrim pointer-events-none fixed inset-0", { "lp-scrim--light": unref(frosted) }]),
|
|
273
|
+
class: normalizeClass(["lp-scrim pointer-events-none fixed inset-0", { "lp-scrim--light": unref(frosted), "lp-scrim--nested": unref(layer).nested }]),
|
|
274
274
|
style: normalizeStyle({ zIndex: unref(layer).scrim, opacity: peek.value, transition: peeking.value || reducedMotion() ? "none" : "opacity 0.18s ease-out" })
|
|
275
275
|
}, null, 6), [
|
|
276
276
|
[vShow, peeking.value || peek.value > 0]
|
|
@@ -311,7 +311,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
311
311
|
default: withCtx(() => [
|
|
312
312
|
createVNode(unref(DrawerOverlay), {
|
|
313
313
|
style: normalizeStyle({ zIndex: unref(layer).scrim }),
|
|
314
|
-
class: normalizeClass(["lp-scrim fixed inset-0 z-(--z-overlay) data-[state=open]:animate-[fade-in_150ms_ease] data-[state=closed]:animate-[fade-out_130ms_ease]", { "lp-scrim--light": unref(frosted) }])
|
|
314
|
+
class: normalizeClass(["lp-scrim fixed inset-0 z-(--z-overlay) data-[state=open]:animate-[fade-in_150ms_ease] data-[state=closed]:animate-[fade-out_130ms_ease]", { "lp-scrim--light": unref(frosted), "lp-scrim--nested": unref(layer).nested }])
|
|
315
315
|
}, null, 8, ["style", "class"]),
|
|
316
316
|
createVNode(unref(DrawerContent), {
|
|
317
317
|
class: normalizeClass(contentClass.value),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, computed, ref,
|
|
1
|
+
import { defineComponent, watch, onBeforeUnmount, computed, ref, nextTick, openBlock, createBlock, unref, withCtx, createVNode, normalizeStyle, normalizeClass, createTextVNode, toDisplayString, createElementVNode, createElementBlock, createCommentVNode, renderSlot, withModifiers, Fragment, renderList } from "vue";
|
|
2
2
|
import { DialogRoot, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription } from "reka-ui";
|
|
3
3
|
import { useZoomPan } from "../composables/useZoomPan.js";
|
|
4
4
|
import { fileNameOf } from "../components/lightbox.js";
|
|
5
5
|
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
6
|
+
import { useModalLayer } from "../components/modalDepth.js";
|
|
6
7
|
const _hoisted_1 = { class: "flex shrink-0 items-center gap-1 p-3 text-sm text-white/70 [--chrome-from:-8px] animate-[lightbox-chrome-in_var(--duration-medium)_var(--ease-emphasized)_60ms_both] motion-reduce:animate-none" };
|
|
7
8
|
const _hoisted_2 = {
|
|
8
9
|
key: 0,
|
|
@@ -55,6 +56,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
55
56
|
setup(__props, { emit: __emit }) {
|
|
56
57
|
const props = __props;
|
|
57
58
|
const emit = __emit;
|
|
59
|
+
const { claim, release, layer } = useModalLayer();
|
|
60
|
+
watch(() => props.open, (open) => open ? claim() : release(), { immediate: true });
|
|
61
|
+
onBeforeUnmount(release);
|
|
58
62
|
const zoom = useZoomPan({ max: props.maxZoom });
|
|
59
63
|
const scale = computed(() => zoom.scale.value);
|
|
60
64
|
const isZoomed = computed(() => zoom.zoomed.value);
|
|
@@ -234,9 +238,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
234
238
|
default: withCtx(() => [
|
|
235
239
|
createVNode(unref(DialogPortal), null, {
|
|
236
240
|
default: withCtx(() => [
|
|
237
|
-
createVNode(unref(DialogOverlay), {
|
|
241
|
+
createVNode(unref(DialogOverlay), {
|
|
242
|
+
class: normalizeClass(["lp-scrim fixed inset-0 data-[state=open]:animate-[fade-in_var(--duration-medium)_var(--ease-emphasized)] data-[state=closed]:animate-[fade-out_120ms_ease]", { "lp-scrim--nested": unref(layer).nested }]),
|
|
243
|
+
style: normalizeStyle({ zIndex: unref(layer).scrim })
|
|
244
|
+
}, null, 8, ["class", "style"]),
|
|
238
245
|
createVNode(unref(DialogContent), {
|
|
239
|
-
class: "fixed inset-0
|
|
246
|
+
class: "fixed inset-0 flex flex-col outline-none data-[state=open]:animate-[lightbox-in_var(--duration-medium)_var(--ease-emphasized)] data-[state=closed]:animate-[lightbox-out_140ms_cubic-bezier(0.4,0,1,1)] motion-reduce:animate-none",
|
|
247
|
+
style: normalizeStyle({ zIndex: unref(layer).panel }),
|
|
240
248
|
onKeydown
|
|
241
249
|
}, {
|
|
242
250
|
default: withCtx(() => [
|
|
@@ -432,7 +440,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
432
440
|
])
|
|
433
441
|
]),
|
|
434
442
|
_: 3
|
|
435
|
-
})
|
|
443
|
+
}, 8, ["style"])
|
|
436
444
|
]),
|
|
437
445
|
_: 3
|
|
438
446
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, openBlock, createElementBlock, renderSlot, mergeProps, unref, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createVNode, createCommentVNode, createBlock } from "vue";
|
|
2
2
|
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
3
3
|
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
-
import { _ as _sfc_main$2 } from "./LpLightbox-
|
|
4
|
+
import { _ as _sfc_main$2 } from "./LpLightbox-2sYVMY-S.js";
|
|
5
5
|
const _hoisted_1 = { key: 0 };
|
|
6
6
|
const _hoisted_2 = ["aria-label"];
|
|
7
7
|
const _hoisted_3 = ["aria-label", "onClick"];
|
|
@@ -126,7 +126,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
126
126
|
createVNode(unref(DialogPortal), null, {
|
|
127
127
|
default: withCtx(() => [
|
|
128
128
|
createVNode(unref(DialogOverlay), {
|
|
129
|
-
class: normalizeClass([{ "lp-scrim--light": unref(frosted) }, "lp-scrim fixed inset-0 data-[state=open]:animate-[fade-in_var(--duration-medium)_var(--ease-emphasized)] data-[state=closed]:animate-[fade-out_120ms_ease]"]),
|
|
129
|
+
class: normalizeClass([{ "lp-scrim--light": unref(frosted), "lp-scrim--nested": unref(layer).nested }, "lp-scrim fixed inset-0 data-[state=open]:animate-[fade-in_var(--duration-medium)_var(--ease-emphasized)] data-[state=closed]:animate-[fade-out_120ms_ease]"]),
|
|
130
130
|
style: normalizeStyle({ zIndex: unref(layer).scrim })
|
|
131
131
|
}, null, 8, ["class", "style"]),
|
|
132
132
|
createElementVNode("div", {
|
|
@@ -148,7 +148,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
148
148
|
createElementVNode("div", {
|
|
149
149
|
ref_key: "panelRef",
|
|
150
150
|
ref: panelRef,
|
|
151
|
-
class: normalizeClass(["flex max-h-[min(90vh,calc(100dvh-2rem))] min-h-0 flex-col overflow-hidden rounded-card border border-line shadow-panel", [unref(frosted) ? "lp-glass-overlay" : "bg-surface-raised", widthClass.value, unref(tweening) ? "transition-[height] duration-fast ease-[var(--ease-emphasized)] motion-reduce:transition-none" : ""]]),
|
|
151
|
+
class: normalizeClass(["flex max-h-[min(90vh,calc(100dvh-2rem))] min-h-0 flex-col overflow-hidden rounded-card border border-line shadow-panel", [unref(frosted) ? unref(layer).nested ? "lp-glass-overlay--nested" : "lp-glass-overlay" : "bg-surface-raised", widthClass.value, unref(tweening) ? "transition-[height] duration-fast ease-[var(--ease-emphasized)] motion-reduce:transition-none" : ""]]),
|
|
152
152
|
style: normalizeStyle({ ...__props.width ? { width: __props.width } : {}, ...hasAside.value ? { alignSelf: "stretch" } : {} })
|
|
153
153
|
}, [
|
|
154
154
|
__props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("header", _hoisted_2, [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, openBlock, createBlock, createSlots, withCtx, renderSlot, createElementVNode, normalizeClass, createVNode, createCommentVNode, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { _ as _sfc_main$2 } from "./LpButton-5VXXCjwF.js";
|
|
3
3
|
import { _ as _sfc_main$3 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
-
import { _ as _sfc_main$1 } from "./LpModal-
|
|
5
|
-
import { _ as _sfc_main$4 } from "./LpSidebar-
|
|
4
|
+
import { _ as _sfc_main$1 } from "./LpModal-Bt0pQCI_.js";
|
|
5
|
+
import { _ as _sfc_main$4 } from "./LpSidebar-ClBUwoEz.js";
|
|
6
6
|
const _hoisted_1 = { class: "flex items-center gap-2" };
|
|
7
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
8
|
__name: "LpModalNav",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, useId, openBlock, createElementBlock, Fragment, createElementVNode, mergeProps, normalizeClass, renderSlot, createCommentVNode, createBlock, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
-
import { _ as _sfc_main$3 } from "./LpDrawer-
|
|
2
|
+
import { _ as _sfc_main$3 } from "./LpDrawer-BZ6k3hvo.js";
|
|
3
3
|
import { _ as _sfc_main$1 } from "./LpInput-9EXWUM9B.js";
|
|
4
4
|
import { _ as _sfc_main$2 } from "./LpSidebarNav-llOcs_Fn.js";
|
|
5
5
|
const _hoisted_1 = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, useId, shallowRef, useSlots, watch, nextTick, openBlock, createBlock, unref, withCtx, createVNode, normalizeClass, withModifiers, createTextVNode, createElementVNode, createElementBlock, Fragment, renderList, createCommentVNode, toDisplayString, withDirectives, withKeys, vModelText, resolveDynamicComponent,
|
|
1
|
+
import { defineComponent, computed, ref, useId, shallowRef, useSlots, watch, nextTick, onBeforeUnmount, openBlock, createBlock, unref, withCtx, createVNode, normalizeStyle, normalizeClass, withModifiers, createTextVNode, createElementVNode, createElementBlock, Fragment, renderList, createCommentVNode, toDisplayString, withDirectives, withKeys, vModelText, resolveDynamicComponent, Transition, renderSlot } from "vue";
|
|
2
2
|
import { DialogRoot, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription } from "reka-ui";
|
|
3
3
|
import { _ as _sfc_main$1 } from "../chunks/LpIcon-CCnX5_2j.js";
|
|
4
4
|
import { _ as _sfc_main$2 } from "../chunks/LpScrollArea-D8xyKXcF.js";
|
|
@@ -6,8 +6,10 @@ import { useAsyncTask } from "../composables/useAsyncTask.js";
|
|
|
6
6
|
import { useGlass } from "../composables/useGlass.js";
|
|
7
7
|
import { useClipboard } from "../composables/useClipboard.js";
|
|
8
8
|
import { useHotkeys } from "../composables/useHotkeys.js";
|
|
9
|
+
import { useModalLayer } from "./modalDepth.js";
|
|
10
|
+
import { parseCommandQuery, rankCommandItems, swapCommandTerms } from "./commandSearch.js";
|
|
9
11
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper-1tPrXgE0.js";
|
|
10
|
-
import '../assets/LpCommandPalette-
|
|
12
|
+
import '../assets/LpCommandPalette-s_kKuCRf.css';const _hoisted_1 = { class: "flex shrink-0 items-center gap-2.5 border-b border-line px-4" };
|
|
11
13
|
const _hoisted_2 = ["title", "onClick"];
|
|
12
14
|
const _hoisted_3 = ["aria-activedescendant", "placeholder", "onKeydown"];
|
|
13
15
|
const _hoisted_4 = {
|
|
@@ -64,9 +66,6 @@ const _hoisted_23 = {
|
|
|
64
66
|
class: "flex items-center gap-1"
|
|
65
67
|
};
|
|
66
68
|
const _hoisted_24 = { class: "ml-auto flex items-center gap-1" };
|
|
67
|
-
const LATIN = "qwertyuiop[]asdfghjkl;'zxcvbnm,.`";
|
|
68
|
-
const CYRILLIC = "йцукенгшщзхъфывапролджэячсмитьбюё";
|
|
69
|
-
const TYPO_MIN = 5;
|
|
70
69
|
const STAGGER_MS = 45;
|
|
71
70
|
const STAGGER_MAX = 10;
|
|
72
71
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -95,6 +94,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
95
94
|
setup(__props, { emit: __emit }) {
|
|
96
95
|
const props = __props;
|
|
97
96
|
const frosted = useGlass(() => props.glass);
|
|
97
|
+
const { claim, release, layer } = useModalLayer();
|
|
98
98
|
const DEFAULT_LABELS = {
|
|
99
99
|
navigate: "navigate",
|
|
100
100
|
select: "select",
|
|
@@ -222,72 +222,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
const source = computed(() => mode.value ? modeItems.value : props.commands);
|
|
225
|
-
const SWAP = /* @__PURE__ */ new Map();
|
|
226
|
-
for (let i = 0; i < LATIN.length; i++) {
|
|
227
|
-
SWAP.set(LATIN[i], CYRILLIC[i]);
|
|
228
|
-
SWAP.set(CYRILLIC[i], LATIN[i]);
|
|
229
|
-
}
|
|
230
|
-
function swapLayout(term) {
|
|
231
|
-
return [...term].map((ch) => SWAP.get(ch) ?? ch).join("");
|
|
232
|
-
}
|
|
233
|
-
function withinOne(a, b) {
|
|
234
|
-
if (Math.abs(a.length - b.length) > 1) return false;
|
|
235
|
-
let i = 0;
|
|
236
|
-
while (i < a.length && i < b.length && a[i] === b[i]) i++;
|
|
237
|
-
if (i === a.length || i === b.length) return true;
|
|
238
|
-
const rest = (x, y) => a.slice(i + x) === b.slice(i + y);
|
|
239
|
-
return rest(1, 1) || rest(1, 0) || rest(0, 1) || a[i] === b[i + 1] && a[i + 1] === b[i] && rest(2, 2);
|
|
240
|
-
}
|
|
241
|
-
function nearWord(term, label) {
|
|
242
|
-
if (term.length < TYPO_MIN) return false;
|
|
243
|
-
return label.split(/[^\p{L}\p{N}]+/u).some((word) => withinOne(term, word) || word.length > term.length && withinOne(term, word.slice(0, term.length)));
|
|
244
|
-
}
|
|
245
|
-
const QUERY_TOKEN = /(-?)(?:(in):)?(?:"([^"]*)"|(\S+))/giu;
|
|
246
|
-
function searchTerms(value) {
|
|
247
|
-
const out = { include: [], exclude: [], groups: [] };
|
|
248
|
-
QUERY_TOKEN.lastIndex = 0;
|
|
249
|
-
for (let match; match = QUERY_TOKEN.exec(value); ) {
|
|
250
|
-
const text2 = (match[3] ?? match[4] ?? "").trim().toLowerCase();
|
|
251
|
-
if (!text2) continue;
|
|
252
|
-
if (match[2] && !match[1]) out.groups.push(text2);
|
|
253
|
-
else if (match[1]) out.exclude.push(text2);
|
|
254
|
-
else out.include.push(text2);
|
|
255
|
-
}
|
|
256
|
-
return out;
|
|
257
|
-
}
|
|
258
|
-
function matches(c, term) {
|
|
259
|
-
return c.label.toLowerCase().includes(term) || (c.keywords ?? []).some((keyword) => keyword.toLowerCase().includes(term)) || (c.description?.toLowerCase().includes(term) ?? false);
|
|
260
|
-
}
|
|
261
|
-
function score(c, terms) {
|
|
262
|
-
const label = c.label.toLowerCase();
|
|
263
|
-
const keywords = (c.keywords ?? []).map((k) => k.toLowerCase());
|
|
264
|
-
const description = c.description?.toLowerCase() ?? "";
|
|
265
|
-
const group = c.group?.toLowerCase() ?? "";
|
|
266
|
-
if (terms.exclude.some((term) => matches(c, term)) || terms.groups.some((term) => !group.includes(term))) return 0;
|
|
267
|
-
let total = terms.include.length ? 0 : 1;
|
|
268
|
-
for (const term of terms.include) {
|
|
269
|
-
let hit = (label.includes(term) ? 4 : 0) + (keywords.some((k) => k.includes(term)) ? 3 : 0) + (description.includes(term) ? 2 : 0);
|
|
270
|
-
if (!hit && nearWord(term, label)) hit = 1;
|
|
271
|
-
if (!hit) return 0;
|
|
272
|
-
total += hit;
|
|
273
|
-
}
|
|
274
|
-
return total;
|
|
275
|
-
}
|
|
276
|
-
function rank(items, terms) {
|
|
277
|
-
return items.map((c) => ({ c, score: score(c, terms) })).filter((e) => e.score > 0).sort((a, b) => b.score - a.score || a.c.label.localeCompare(b.c.label)).map((e) => e.c);
|
|
278
|
-
}
|
|
279
225
|
const local = computed(() => {
|
|
280
|
-
const terms =
|
|
226
|
+
const terms = parseCommandQuery(query.value);
|
|
281
227
|
const filtered = query.value.trim() ? source.value : source.value.filter((c) => !c.hidden);
|
|
282
228
|
if (!terms.include.length && !terms.exclude.length && !terms.groups.length) return { items: filtered, terms: [] };
|
|
283
|
-
const items =
|
|
229
|
+
const items = rankCommandItems(filtered, terms);
|
|
284
230
|
if (items.length || !props.layoutFallback) return { items, terms: terms.include };
|
|
285
|
-
const swapped =
|
|
286
|
-
|
|
287
|
-
exclude: terms.exclude.map(swapLayout),
|
|
288
|
-
groups: terms.groups.map(swapLayout)
|
|
289
|
-
};
|
|
290
|
-
const other = rank(filtered, swapped);
|
|
231
|
+
const swapped = swapCommandTerms(terms);
|
|
232
|
+
const other = rankCommandItems(filtered, swapped);
|
|
291
233
|
return other.length ? { items: other, terms: swapped.include } : { items, terms: terms.include };
|
|
292
234
|
});
|
|
293
235
|
const ranked = computed(() => local.value.items);
|
|
@@ -508,6 +450,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
508
450
|
watch(
|
|
509
451
|
() => props.open,
|
|
510
452
|
async (o) => {
|
|
453
|
+
if (o) claim();
|
|
454
|
+
else release();
|
|
511
455
|
cancel();
|
|
512
456
|
query.value = "";
|
|
513
457
|
select(0);
|
|
@@ -524,6 +468,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
524
468
|
},
|
|
525
469
|
{ immediate: true }
|
|
526
470
|
);
|
|
471
|
+
onBeforeUnmount(release);
|
|
527
472
|
useHotkeys(
|
|
528
473
|
() => props.hotkey ? [
|
|
529
474
|
{
|
|
@@ -544,10 +489,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
544
489
|
createVNode(unref(DialogPortal), null, {
|
|
545
490
|
default: withCtx(() => [
|
|
546
491
|
createVNode(unref(DialogOverlay), {
|
|
547
|
-
class: normalizeClass([{ "lp-scrim--light": unref(frosted) }, "lp-scrim fixed inset-0
|
|
548
|
-
|
|
492
|
+
class: normalizeClass([{ "lp-scrim--light": unref(frosted), "lp-scrim--nested": unref(layer).nested }, "lp-scrim fixed inset-0 data-[state=open]:animate-[fade-in_150ms_ease] data-[state=closed]:animate-[fade-out_130ms_ease]"]),
|
|
493
|
+
style: normalizeStyle({ zIndex: unref(layer).scrim })
|
|
494
|
+
}, null, 8, ["class", "style"]),
|
|
549
495
|
createVNode(unref(DialogContent), {
|
|
550
|
-
class: normalizeClass(["lp-cmd-dialog fixed left-1/2 top-[12vh]
|
|
496
|
+
class: normalizeClass(["lp-cmd-dialog fixed left-1/2 top-[12vh] flex max-h-[76vh] -translate-x-1/2 flex-col overflow-hidden rounded-card border border-line shadow-panel outline-none data-[state=open]:animate-[pop-in_160ms_var(--ease-emphasized)] data-[state=closed]:animate-[pop-out_130ms_ease]", [unref(frosted) ? unref(layer).nested ? "lp-glass-overlay--nested" : "lp-glass-overlay" : "bg-surface-raised", __props.previewPane && "lp-cmd-split"]]),
|
|
497
|
+
style: normalizeStyle({ zIndex: unref(layer).panel }),
|
|
551
498
|
"data-pane": paneOpen.value ? "open" : void 0,
|
|
552
499
|
onOpenAutoFocus: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
553
500
|
}, ["prevent"])),
|
|
@@ -826,7 +773,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
826
773
|
])
|
|
827
774
|
]),
|
|
828
775
|
_: 3
|
|
829
|
-
}, 8, ["class", "data-pane"])
|
|
776
|
+
}, 8, ["class", "style", "data-pane"])
|
|
830
777
|
]),
|
|
831
778
|
_: 3
|
|
832
779
|
})
|
|
@@ -836,7 +783,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
836
783
|
};
|
|
837
784
|
}
|
|
838
785
|
});
|
|
839
|
-
const LpCommandPalette = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
786
|
+
const LpCommandPalette = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-10500f32"]]);
|
|
840
787
|
export {
|
|
841
788
|
LpCommandPalette as default
|
|
842
789
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString, unref } from "vue";
|
|
2
|
-
import { _ as _sfc_main$1 } from "../chunks/LpModal-
|
|
2
|
+
import { _ as _sfc_main$1 } from "../chunks/LpModal-Bt0pQCI_.js";
|
|
3
3
|
import { mergeShortcutGroups, activeShortcuts, appleModifierLabel } from "../composables/useHotkeys.js";
|
|
4
4
|
import { _ as _export_sfc } from "../chunks/_plugin-vue_export-helper-1tPrXgE0.js";
|
|
5
5
|
import '../assets/LpShortcutsDialog-C6YoQ8_M.css';const _hoisted_1 = { class: "shortcut-groups" };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const QUERY_TOKEN = /(-?)(?:(in):)?(?:"([^"]*)"|(\S+))/giu;
|
|
2
|
+
const LATIN = "qwertyuiop[]asdfghjkl;'zxcvbnm,.`";
|
|
3
|
+
const CYRILLIC = "йцукенгшщзхъфывапролджэячсмитьбюё";
|
|
4
|
+
const SWAP = /* @__PURE__ */ new Map();
|
|
5
|
+
for (let i = 0; i < LATIN.length; i++) {
|
|
6
|
+
SWAP.set(LATIN[i], CYRILLIC[i]);
|
|
7
|
+
SWAP.set(CYRILLIC[i], LATIN[i]);
|
|
8
|
+
}
|
|
9
|
+
function parseCommandQuery(value) {
|
|
10
|
+
const out = { include: [], exclude: [], groups: [] };
|
|
11
|
+
QUERY_TOKEN.lastIndex = 0;
|
|
12
|
+
for (let match; match = QUERY_TOKEN.exec(value); ) {
|
|
13
|
+
const text = (match[3] ?? match[4] ?? "").trim().toLowerCase();
|
|
14
|
+
if (!text) continue;
|
|
15
|
+
if (match[2] && !match[1]) out.groups.push(text);
|
|
16
|
+
else if (match[1]) out.exclude.push(text);
|
|
17
|
+
else out.include.push(text);
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
function swapCommandTerms(terms) {
|
|
22
|
+
const swap = (term) => [...term].map((ch) => SWAP.get(ch) ?? ch).join("");
|
|
23
|
+
return {
|
|
24
|
+
include: terms.include.map(swap),
|
|
25
|
+
exclude: terms.exclude.map(swap),
|
|
26
|
+
groups: terms.groups.map(swap)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function matches(command, term) {
|
|
30
|
+
return command.label.toLowerCase().includes(term) || (command.keywords ?? []).some((keyword) => keyword.toLowerCase().includes(term)) || (command.description?.toLowerCase().includes(term) ?? false);
|
|
31
|
+
}
|
|
32
|
+
function withinOne(a, b) {
|
|
33
|
+
if (Math.abs(a.length - b.length) > 1) return false;
|
|
34
|
+
let i = 0;
|
|
35
|
+
while (i < a.length && i < b.length && a[i] === b[i]) i++;
|
|
36
|
+
if (i === a.length || i === b.length) return true;
|
|
37
|
+
const rest = (x, y) => a.slice(i + x) === b.slice(i + y);
|
|
38
|
+
return rest(1, 1) || rest(1, 0) || rest(0, 1) || a[i] === b[i + 1] && a[i + 1] === b[i] && rest(2, 2);
|
|
39
|
+
}
|
|
40
|
+
function nearWord(term, label) {
|
|
41
|
+
if (term.length < 5) return false;
|
|
42
|
+
return label.split(/[^\p{L}\p{N}]+/u).some((word) => withinOne(term, word) || word.length > term.length && withinOne(term, word.slice(0, term.length)));
|
|
43
|
+
}
|
|
44
|
+
function score(command, terms) {
|
|
45
|
+
const label = command.label.toLowerCase();
|
|
46
|
+
const keywords = (command.keywords ?? []).map((keyword) => keyword.toLowerCase());
|
|
47
|
+
const description = command.description?.toLowerCase() ?? "";
|
|
48
|
+
const group = command.group?.toLowerCase() ?? "";
|
|
49
|
+
if (terms.exclude.some((term) => matches(command, term)) || terms.groups.some((term) => !group.includes(term))) return 0;
|
|
50
|
+
let total = terms.include.length ? 0 : 1;
|
|
51
|
+
for (const term of terms.include) {
|
|
52
|
+
let hit = (label.includes(term) ? 4 : 0) + (keywords.some((keyword) => keyword.includes(term)) ? 3 : 0) + (description.includes(term) ? 2 : 0);
|
|
53
|
+
if (!hit && nearWord(term, label)) hit = 1;
|
|
54
|
+
if (!hit) return 0;
|
|
55
|
+
total += hit;
|
|
56
|
+
}
|
|
57
|
+
return total;
|
|
58
|
+
}
|
|
59
|
+
function rankCommandItems(items, terms) {
|
|
60
|
+
return items.map((command) => ({ command, score: score(command, terms) })).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score || a.command.label.localeCompare(b.command.label)).map((entry) => entry.command);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
parseCommandQuery,
|
|
64
|
+
rankCommandItems,
|
|
65
|
+
swapCommandTerms
|
|
66
|
+
};
|
|
@@ -19,7 +19,8 @@ function useModalLayer() {
|
|
|
19
19
|
const drop = fromTop.value * STEP;
|
|
20
20
|
return {
|
|
21
21
|
scrim: `calc(var(--z-overlay) - ${drop})`,
|
|
22
|
-
panel: `calc(var(--z-modal) - ${drop})
|
|
22
|
+
panel: `calc(var(--z-modal) - ${drop})`,
|
|
23
|
+
nested: stack.value.indexOf(id) > 0
|
|
23
24
|
};
|
|
24
25
|
})
|
|
25
26
|
};
|