@shival99/z-ui-svelte 0.1.1 → 0.1.3
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.
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
|
|
240
240
|
<div
|
|
241
241
|
class={zMergeClasses(
|
|
242
|
-
'z-chat-navigator-viewport focus-visible:outline-ring pointer-events-auto absolute inset-y-0 left-0 w-12 touch-none overflow-hidden outline-none focus-visible:rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2',
|
|
242
|
+
'z-chat-navigator-viewport focus-visible:outline-ring pointer-events-auto absolute inset-y-0 left-0 w-full max-w-12 touch-none overflow-hidden outline-none focus-visible:rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2',
|
|
243
243
|
maxOffset > 0 && 'z-chat-navigator-viewport--overflowing'
|
|
244
244
|
)}
|
|
245
245
|
role="slider"
|
|
@@ -106,6 +106,8 @@
|
|
|
106
106
|
let indicator = $state<{ top: number; left: number; width: number; height: number } | null>(null);
|
|
107
107
|
let activeIndex = $state(0);
|
|
108
108
|
let listEl = $state<HTMLElement | null>(null);
|
|
109
|
+
// Bumped when a sub-page finishes sliding in: its rows moved while it slid, so the highlight is measured again.
|
|
110
|
+
let settled = $state(0);
|
|
109
111
|
|
|
110
112
|
// Items with `children` open a sub-page; `path` is the way down to it.
|
|
111
113
|
let path = $state<ZCommandItem<T>[]>([]);
|
|
@@ -145,10 +147,14 @@
|
|
|
145
147
|
void flat;
|
|
146
148
|
void contentHeight;
|
|
147
149
|
void path.length;
|
|
150
|
+
void settled;
|
|
148
151
|
const index = current;
|
|
149
152
|
const row = index >= 0 ? listEl?.querySelector<HTMLElement>(`#${CSS.escape(optionId(index))}`) : null;
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
// Measured against the list itself, not offsetParent: a page that is sliding in carries a transform and
|
|
154
|
+
// would otherwise become the reference, leaving the highlight offset once it stops.
|
|
155
|
+
const box = row && content ? { row: row.getBoundingClientRect(), list: content.getBoundingClientRect() } : null;
|
|
156
|
+
indicator = box
|
|
157
|
+
? { top: box.row.top - box.list.top, left: box.row.left - box.list.left, width: box.row.width, height: box.row.height }
|
|
152
158
|
: null;
|
|
153
159
|
});
|
|
154
160
|
|
|
@@ -349,7 +355,7 @@
|
|
|
349
355
|
></div>
|
|
350
356
|
{/if}
|
|
351
357
|
{#key path.length}
|
|
352
|
-
<div class="space-y-1" in:fly={{ x: direction * 16, duration: ms(Z_COMMAND_PAGE_MS), opacity: 0 }}>
|
|
358
|
+
<div class="space-y-1" in:fly={{ x: direction * 16, duration: ms(Z_COMMAND_PAGE_MS), opacity: 0 }} onintroend={() => settled++}>
|
|
353
359
|
{#if flat.length === 0}
|
|
354
360
|
<div class="text-muted-foreground py-6 text-center text-sm" role="presentation">
|
|
355
361
|
{#if empty}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cva } from 'class-variance-authority';
|
|
2
2
|
/** Same palette as core-ui's z-tooltip; enter/exit motion lives in the Svelte transition instead of classes. */
|
|
3
|
-
export const zTooltipVariants = cva('z-tooltip relative rounded-
|
|
3
|
+
export const zTooltipVariants = cva('z-tooltip relative rounded-md shadow-lg', {
|
|
4
4
|
variants: {
|
|
5
5
|
zType: {
|
|
6
|
-
default: 'bg-
|
|
6
|
+
default: 'bg-popover text-popover-foreground border border-border!',
|
|
7
7
|
dark: 'bg-slate-900 text-white border border-slate-700!',
|
|
8
8
|
light: 'bg-white text-slate-900 border border-slate-200!',
|
|
9
9
|
primary: 'bg-primary text-primary-foreground border border-primary!',
|
|
@@ -26,7 +26,7 @@ export const zTooltipVariants = cva('z-tooltip relative rounded-sm shadow-md', {
|
|
|
26
26
|
export const zTooltipContentVariants = cva('relative z-10 rounded-xs font-medium p-1.5 break-words leading-[1.7]', {
|
|
27
27
|
variants: {
|
|
28
28
|
zType: {
|
|
29
|
-
default: 'bg-
|
|
29
|
+
default: 'bg-popover',
|
|
30
30
|
dark: 'bg-slate-900',
|
|
31
31
|
light: 'bg-white',
|
|
32
32
|
primary: 'bg-primary',
|
|
@@ -57,7 +57,7 @@ export const zTooltipArrowVariants = cva('absolute z-0 size-2.5 rotate-45 rounde
|
|
|
57
57
|
'right-bottom': 'bottom-2 -left-1 border-b border-l',
|
|
58
58
|
},
|
|
59
59
|
zType: {
|
|
60
|
-
default: 'bg-
|
|
60
|
+
default: 'bg-popover border-border!',
|
|
61
61
|
dark: 'bg-slate-900 border-slate-700!',
|
|
62
62
|
light: 'bg-white border-slate-200!',
|
|
63
63
|
primary: 'bg-primary border-primary!',
|