@gecko-ui-kit/vue 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +2052 -2
- package/index.d.ts +13 -0
- package/index.js +16 -0
- package/package.json +48 -4
- package/src/actions.d.ts +186 -0
- package/src/actions.js +329 -0
- package/src/basics.d.ts +315 -0
- package/src/basics.js +475 -0
- package/src/charts.d.ts +219 -0
- package/src/charts.js +93 -0
- package/src/controls.d.ts +149 -0
- package/src/controls.js +354 -0
- package/src/core.d.ts +109 -0
- package/src/core.js +414 -0
- package/src/data.d.ts +754 -0
- package/src/data.js +718 -0
- package/src/effects.d.ts +407 -0
- package/src/effects.js +699 -0
- package/src/forms.d.ts +757 -0
- package/src/forms.js +481 -0
- package/src/motion.d.ts +127 -0
- package/src/motion.js +216 -0
- package/src/overlays.d.ts +467 -0
- package/src/overlays.js +710 -0
- package/src/plugin.d.ts +6 -0
- package/src/plugin.js +27 -0
- package/src/shell.d.ts +210 -0
- package/src/shell.js +716 -0
- package/src/text.d.ts +309 -0
- package/src/text.js +383 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import type { VNodeChild, Ref, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { GeckoComponent, DefaultSlot, EnhancerProps } from './core.js';
|
|
3
|
+
|
|
4
|
+
/** An element, a template ref to one, or a component (its element is used). */
|
|
5
|
+
export type AnchorLike = Element | Ref<Element | null | undefined> | { $el: Element } | null | undefined;
|
|
6
|
+
|
|
7
|
+
/* ---------------- Modal ---------------- */
|
|
8
|
+
export interface ModalProps {
|
|
9
|
+
/** Labels: { close } is the ✕ button's accessible name (default 'Close'). */
|
|
10
|
+
words?: { close?: string };
|
|
11
|
+
/** Open (true) or closed (false); use v-model:open. It opens and closes with its animation. */
|
|
12
|
+
open?: boolean;
|
|
13
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
14
|
+
/** Called when the modal closes itself (✕, scrim, Esc), after v-model:open turned false. */
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
/** The heading (or the #title slot). May change while open. */
|
|
17
|
+
title?: string;
|
|
18
|
+
/** A smaller line under the heading (or the #sub slot). */
|
|
19
|
+
sub?: string;
|
|
20
|
+
/** '' (540px), 'sm' (420px) or 'lg' (760px). */
|
|
21
|
+
size?: '' | 'sm' | 'lg';
|
|
22
|
+
/** The element it zooms out of. */
|
|
23
|
+
anchor?: AnchorLike;
|
|
24
|
+
}
|
|
25
|
+
/** <Modal v-model:open="open" title="Edit">…<template #footer>…</template></Modal> — bottom sheet on phones. */
|
|
26
|
+
export const Modal: GeckoComponent<ModalProps, { default?: () => VNodeChild; title?: () => VNodeChild; sub?: () => VNodeChild; footer?: () => VNodeChild }>;
|
|
27
|
+
|
|
28
|
+
/* ---------------- Drawer ---------------- */
|
|
29
|
+
export interface DrawerProps {
|
|
30
|
+
/** Labels: { close } is the ✕ button's accessible name (default 'Close'). */
|
|
31
|
+
words?: { close?: string };
|
|
32
|
+
/** Open (true) or closed (false); use v-model:open. */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
35
|
+
/** Called when the drawer closes itself (✕, scrim, Esc, another drawer opening). */
|
|
36
|
+
onClose?: () => void;
|
|
37
|
+
/** The heading (or the #title slot). */
|
|
38
|
+
title?: string;
|
|
39
|
+
/** A smaller line under the heading (or the #sub slot). */
|
|
40
|
+
sub?: string;
|
|
41
|
+
/** Something before the heading, e.g. initials (or the #head slot, e.g. an avatar). */
|
|
42
|
+
head?: string;
|
|
43
|
+
/** Which side it slides in from (phones: always a bottom sheet). Default 'right'. */
|
|
44
|
+
side?: 'right' | 'left';
|
|
45
|
+
}
|
|
46
|
+
/** <Drawer v-model:open="open" title="Somchai K.">…<template #footer>…</template></Drawer> — its content drifts up as it lands. */
|
|
47
|
+
export const Drawer: GeckoComponent<DrawerProps, { default?: () => VNodeChild; title?: () => VNodeChild; sub?: () => VNodeChild; head?: () => VNodeChild; footer?: () => VNodeChild }>;
|
|
48
|
+
|
|
49
|
+
/* ---------------- confirm ---------------- */
|
|
50
|
+
export interface ConfirmOptions {
|
|
51
|
+
/** The question. Plain text. Default 'Are you sure?'. */
|
|
52
|
+
title?: string;
|
|
53
|
+
/** More detail under it. Plain text. */
|
|
54
|
+
body?: string;
|
|
55
|
+
/** The OK button's text. Default 'Confirm'. */
|
|
56
|
+
ok?: string;
|
|
57
|
+
/** The cancel button's text. Default 'Cancel'. */
|
|
58
|
+
cancel?: string;
|
|
59
|
+
/** A red OK button (for deleting). */
|
|
60
|
+
danger?: boolean;
|
|
61
|
+
/** The element it zooms out of. */
|
|
62
|
+
anchor?: AnchorLike;
|
|
63
|
+
}
|
|
64
|
+
/** const ok = await confirm({ title, body, ok: 'Delete', danger: true }) — true for OK, false otherwise. Text only (safe). */
|
|
65
|
+
export function confirm(options?: ConfirmOptions): Promise<boolean>;
|
|
66
|
+
/** const confirm = useConfirm() in setup — the same, and a dialog still open when the component unmounts is closed. */
|
|
67
|
+
export function useConfirm(): (options?: ConfirmOptions) => Promise<boolean>;
|
|
68
|
+
|
|
69
|
+
/* ---------------- Popover ---------------- */
|
|
70
|
+
export interface PopoverHandle {
|
|
71
|
+
open(): void;
|
|
72
|
+
close(): void;
|
|
73
|
+
/** True while it is open. */
|
|
74
|
+
readonly isOpen: boolean;
|
|
75
|
+
/** The open panel (.gk-pop), or null. */
|
|
76
|
+
readonly el: HTMLElement | null;
|
|
77
|
+
}
|
|
78
|
+
export interface PopoverProps {
|
|
79
|
+
/** Open or not; use v-model:open. Leave it out to let a click on the trigger toggle it. */
|
|
80
|
+
open?: boolean;
|
|
81
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
82
|
+
/** Without v-model: start open. */
|
|
83
|
+
defaultOpen?: boolean;
|
|
84
|
+
/** Called with the new state when the trigger is clicked or it closes itself (click outside, Esc, resize). */
|
|
85
|
+
onOpenChange?: (open: boolean) => void;
|
|
86
|
+
/** Text inside (or the #content slot, which gets { close }). */
|
|
87
|
+
content?: string;
|
|
88
|
+
/** Line it up with the trigger's start, center or end. Default 'start'. */
|
|
89
|
+
align?: 'start' | 'center' | 'end';
|
|
90
|
+
/** Extra class on the panel, e.g. 'pop--wide' (380px). */
|
|
91
|
+
className?: string;
|
|
92
|
+
/** Read out by screen readers. */
|
|
93
|
+
label?: string;
|
|
94
|
+
}
|
|
95
|
+
/** <Popover><Button>Share</Button><template #content="{ close }">…</template></Popover> — template ref → PopoverHandle. */
|
|
96
|
+
export const Popover: GeckoComponent<PopoverProps, { default?: () => VNodeChild; content?: (props: { close: () => void }) => VNodeChild }>;
|
|
97
|
+
|
|
98
|
+
/* ---------------- Menu ---------------- */
|
|
99
|
+
/** A menu row: '-' is a line, { section } a small heading, anything else an action. */
|
|
100
|
+
export type MenuItem = '-' | { section: string } | MenuAction;
|
|
101
|
+
export interface MenuAction {
|
|
102
|
+
/** Text of the row. */
|
|
103
|
+
label: string;
|
|
104
|
+
/** An icon name from @gecko-ui-kit/icons. */
|
|
105
|
+
icon?: string;
|
|
106
|
+
/** A shortcut hint shown on the right (bind the key yourself). */
|
|
107
|
+
kbd?: string;
|
|
108
|
+
/** Red text, for deleting. */
|
|
109
|
+
danger?: boolean;
|
|
110
|
+
/** Runs after the menu closed, with the trigger element. */
|
|
111
|
+
run?: (trigger: HTMLElement) => void;
|
|
112
|
+
/** Anything else you need back in onSelect. */
|
|
113
|
+
[key: string]: unknown;
|
|
114
|
+
}
|
|
115
|
+
export interface MenuHandle {
|
|
116
|
+
open(): void;
|
|
117
|
+
close(): void;
|
|
118
|
+
readonly isOpen: boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface MenuProps {
|
|
121
|
+
/** The rows. */
|
|
122
|
+
items: MenuItem[];
|
|
123
|
+
/** Called after an action row is picked (after its run), with the item and its index in items. */
|
|
124
|
+
onSelect?: (item: MenuAction, index: number) => void;
|
|
125
|
+
/** Line it up with the trigger's start, center or end. Default 'start'. */
|
|
126
|
+
align?: 'start' | 'center' | 'end';
|
|
127
|
+
/** Extra class on the panel. */
|
|
128
|
+
className?: string;
|
|
129
|
+
/** Read out by screen readers. */
|
|
130
|
+
label?: string;
|
|
131
|
+
}
|
|
132
|
+
/** <Menu :items="[…]" @select="…"><IconButton icon="more" label="More" /></Menu> — template ref → MenuHandle. */
|
|
133
|
+
export const Menu: GeckoComponent<MenuProps, DefaultSlot>;
|
|
134
|
+
|
|
135
|
+
/* ---------------- ContextMenu ---------------- */
|
|
136
|
+
/** A context-menu row: '-' / { sep: true } a line, { section } a heading, { items } a submenu, { checked } a tick. */
|
|
137
|
+
export type ContextMenuItem = '-' | { sep: true } | { section: string } | ContextMenuAction;
|
|
138
|
+
export interface ContextMenuAction {
|
|
139
|
+
/** Text of the row. */
|
|
140
|
+
label: string;
|
|
141
|
+
/** An icon name from @gecko-ui-kit/icons. */
|
|
142
|
+
icon?: string;
|
|
143
|
+
/** A shortcut hint shown on the right (bind the key yourself). */
|
|
144
|
+
kbd?: string;
|
|
145
|
+
/** A second, smaller line. */
|
|
146
|
+
hint?: string;
|
|
147
|
+
/** Greyed out; it shakes when clicked. */
|
|
148
|
+
disabled?: boolean;
|
|
149
|
+
/** Red text, for deleting. */
|
|
150
|
+
danger?: boolean;
|
|
151
|
+
/** A tick column; picking flips it (on a copy) before run / onSelect get the item. */
|
|
152
|
+
checked?: boolean;
|
|
153
|
+
/** A submenu. */
|
|
154
|
+
items?: ContextMenuItem[];
|
|
155
|
+
/** Runs after the menu closed, with the element that was right-clicked and the (copied) item. */
|
|
156
|
+
run?: (el: HTMLElement, item: any) => void;
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
}
|
|
159
|
+
export interface ContextMenuHandle {
|
|
160
|
+
/** Open it at a point (viewport px), for the element el (default: the wrapper). */
|
|
161
|
+
open(x: number, y: number, el?: HTMLElement): boolean | undefined;
|
|
162
|
+
close(): void;
|
|
163
|
+
readonly isOpen: boolean;
|
|
164
|
+
/** The open menu, or null. */
|
|
165
|
+
readonly menu: HTMLElement | null;
|
|
166
|
+
/** The wrapper element. */
|
|
167
|
+
readonly el: HTMLElement | null;
|
|
168
|
+
}
|
|
169
|
+
export interface ContextMenuProps {
|
|
170
|
+
/** The rows, or (event, el) => rows on every open (event is null for ref.open()). Return [] for the browser's own menu. */
|
|
171
|
+
items: ContextMenuItem[] | ((event: Event | null, el: HTMLElement) => ContextMenuItem[] | null | undefined);
|
|
172
|
+
/** Called after a row is picked (after its run), with the (copied) item and the element. */
|
|
173
|
+
onSelect?: (item: any, el: HTMLElement) => void;
|
|
174
|
+
/** Called when it opens, with the element. */
|
|
175
|
+
onOpen?: (el: HTMLElement) => void;
|
|
176
|
+
/** Called when it closes, with the element. */
|
|
177
|
+
onClose?: (el: HTMLElement) => void;
|
|
178
|
+
/** Only elements inside that match open the menu (el = that element). */
|
|
179
|
+
selector?: string;
|
|
180
|
+
/** ms a finger must rest to open it on touch (0 = off). Default 500. */
|
|
181
|
+
longPress?: number;
|
|
182
|
+
/** Shift + right-click shows the browser's own menu. Default true. */
|
|
183
|
+
nativeOnShift?: boolean;
|
|
184
|
+
/** Show item icons. Default true. */
|
|
185
|
+
icons?: boolean;
|
|
186
|
+
/** Show kbd hints. Default true. */
|
|
187
|
+
shortcuts?: boolean;
|
|
188
|
+
/** label: the menu's name for screen readers (text or (el) => text). */
|
|
189
|
+
words?: { label?: string | ((el: HTMLElement) => string) };
|
|
190
|
+
/** The wrapper element. Default 'div'. */
|
|
191
|
+
as?: string;
|
|
192
|
+
}
|
|
193
|
+
/** <ContextMenu :items="…">…</ContextMenu> — right-click / long-press / Shift+F10 menu. Template ref → ContextMenuHandle. */
|
|
194
|
+
export const ContextMenu: GeckoComponent<ContextMenuProps, DefaultSlot>;
|
|
195
|
+
|
|
196
|
+
/* ---------------- Tooltip ---------------- */
|
|
197
|
+
export interface TooltipProps {
|
|
198
|
+
/** The label (a line break makes a second line), or the #text slot. Empty = no tooltip. */
|
|
199
|
+
text?: string;
|
|
200
|
+
/** 'below' (default) or 'right' (beside it, as in a collapsed sidebar). */
|
|
201
|
+
side?: 'below' | 'right';
|
|
202
|
+
/** Turn it off for now. */
|
|
203
|
+
disabled?: boolean;
|
|
204
|
+
}
|
|
205
|
+
/** <Tooltip text="Edit"><IconButton icon="edit" label="Edit" /></Tooltip> — on hover / focus; hidden on phones. */
|
|
206
|
+
export const Tooltip: GeckoComponent<TooltipProps, { default?: () => VNodeChild; text?: () => VNodeChild }>;
|
|
207
|
+
|
|
208
|
+
/* ---------------- toast ---------------- */
|
|
209
|
+
export interface ToastOptions {
|
|
210
|
+
/** Shows an Undo button that calls this. */
|
|
211
|
+
undo?: () => void;
|
|
212
|
+
/** Colour of the icon: '' | 'good' | 'warn' | 'bad'. */
|
|
213
|
+
tone?: '' | 'good' | 'warn' | 'bad';
|
|
214
|
+
/** Old shortcut for tone: 'warn'. */
|
|
215
|
+
warn?: boolean;
|
|
216
|
+
/** An icon name. Default 'check' ('alert' for warn). */
|
|
217
|
+
icon?: string;
|
|
218
|
+
/** ms before it goes. Default 4200. */
|
|
219
|
+
duration?: number;
|
|
220
|
+
/** Text of the Undo button. Default 'Undo'. */
|
|
221
|
+
undoLabel?: string;
|
|
222
|
+
/** Toast shown after Undo. Default 'Undone'. */
|
|
223
|
+
undoneText?: string;
|
|
224
|
+
}
|
|
225
|
+
/** toast('Booking saved', { tone: 'good' }) → close(). Call it from anywhere in the browser. Plain text (safe). */
|
|
226
|
+
export function toast(text: string, options?: ToastOptions): () => void;
|
|
227
|
+
|
|
228
|
+
/* ---------------- CookieBanner ---------------- */
|
|
229
|
+
export interface CookieCategory {
|
|
230
|
+
/** Key in the choices object. */
|
|
231
|
+
id: string;
|
|
232
|
+
/** Name shown. */
|
|
233
|
+
label?: string;
|
|
234
|
+
/** A line about it. */
|
|
235
|
+
text?: string;
|
|
236
|
+
/** Always on and locked (e.g. necessary). */
|
|
237
|
+
required?: boolean;
|
|
238
|
+
}
|
|
239
|
+
export type CookieChoices = Record<string, boolean>;
|
|
240
|
+
export interface CookieBannerHandle {
|
|
241
|
+
/** The saved choice, or null if none yet. */
|
|
242
|
+
readonly choices: CookieChoices | null;
|
|
243
|
+
/** True while it is on screen. */
|
|
244
|
+
readonly visible: boolean;
|
|
245
|
+
/** The banner element. */
|
|
246
|
+
readonly el: HTMLElement | null;
|
|
247
|
+
/** True when that type is allowed (required ones always are). */
|
|
248
|
+
allowed(id: string): boolean;
|
|
249
|
+
/** Bring it back (e.g. from a "Cookie settings" link). settings: open the switches too. */
|
|
250
|
+
open(options?: { settings?: boolean; focus?: boolean }): void;
|
|
251
|
+
close(): void;
|
|
252
|
+
/** Forget the saved choice. */
|
|
253
|
+
reset(): void;
|
|
254
|
+
}
|
|
255
|
+
export interface CookieBannerProps {
|
|
256
|
+
/** The cookie types. Default: necessary (locked on), analytics, marketing. */
|
|
257
|
+
categories?: CookieCategory[];
|
|
258
|
+
/** Where the choice is saved in localStorage ('' = not saved). Default 'gecko:consent'. */
|
|
259
|
+
storageKey?: string;
|
|
260
|
+
/** Raise it when the categories change: everyone is asked again. Default 1. */
|
|
261
|
+
version?: number;
|
|
262
|
+
/** 'auto' = show when there is no saved choice; false = only on ref.open(). */
|
|
263
|
+
show?: 'auto' | false;
|
|
264
|
+
/** 'bottom' (full-width bar) or 'start' / 'end' (a card in a bottom corner). */
|
|
265
|
+
position?: 'bottom' | 'start' | 'end';
|
|
266
|
+
/** Show it along the bottom of this element (element, template ref or selector) instead of the window. */
|
|
267
|
+
mount?: AnchorLike | string;
|
|
268
|
+
/** Link to your privacy policy. */
|
|
269
|
+
policy?: string;
|
|
270
|
+
/** Texts: label, title, text, accept, reject, settings, save, always, policy. */
|
|
271
|
+
words?: Partial<Record<'label' | 'title' | 'text' | 'accept' | 'reject' | 'settings' | 'save' | 'always' | 'policy', string>>;
|
|
272
|
+
/** Called after a choice, with every type → allowed, and { action: 'accept' | 'reject' | 'save', at }. */
|
|
273
|
+
onChange?: (choices: CookieChoices, info: { action: 'accept' | 'reject' | 'save'; at: number }) => void;
|
|
274
|
+
}
|
|
275
|
+
/** <CookieBanner policy="/privacy" @change="…" /> — asks once which cookies are allowed. Template ref → CookieBannerHandle. */
|
|
276
|
+
export const CookieBanner: GeckoComponent<CookieBannerProps>;
|
|
277
|
+
|
|
278
|
+
/* ---------------- LoadingBar ---------------- */
|
|
279
|
+
export interface LoadingBarOptions {
|
|
280
|
+
/** Element (or template ref / selector) to run along the top of. Default: the window. */
|
|
281
|
+
mount?: AnchorLike | string;
|
|
282
|
+
/** Height in px (or any CSS length). Default 3. */
|
|
283
|
+
height?: number | string;
|
|
284
|
+
/** Any CSS colour. Default var(--gk-accent). */
|
|
285
|
+
color?: string;
|
|
286
|
+
/** Creep forward on its own: true, a speed (0.5 slower, 2 faster) or false. */
|
|
287
|
+
trickle?: boolean | number;
|
|
288
|
+
/** ms to wait before showing; loads done sooner never show it. Default 150. */
|
|
289
|
+
delay?: number;
|
|
290
|
+
/** The progress bar's name for screen readers. */
|
|
291
|
+
label?: string;
|
|
292
|
+
/** Texts: label, and loading / done / failed (announced politely; '' = say nothing). */
|
|
293
|
+
words?: Partial<Record<'label' | 'loading' | 'done' | 'failed', string>>;
|
|
294
|
+
}
|
|
295
|
+
export interface LoadingBarHandle {
|
|
296
|
+
/** Start a load (every start needs its done). */
|
|
297
|
+
start(): LoadingBarHandle;
|
|
298
|
+
/** Finish a load; done(true) finishes even if other loads still run. */
|
|
299
|
+
done(all?: boolean): LoadingBarHandle;
|
|
300
|
+
/** Turn red, run to the end, fade. */
|
|
301
|
+
fail(): LoadingBarHandle;
|
|
302
|
+
/** Jump to 0..1 (starts it if it isn't running). */
|
|
303
|
+
set(value: number): LoadingBarHandle;
|
|
304
|
+
/** Move forward by n (starts it if it isn't running). */
|
|
305
|
+
inc(n?: number): LoadingBarHandle;
|
|
306
|
+
readonly value: number;
|
|
307
|
+
readonly loads: number;
|
|
308
|
+
readonly active: boolean;
|
|
309
|
+
readonly el: HTMLElement | null;
|
|
310
|
+
}
|
|
311
|
+
/** const bar = useLoadingBar() in setup; bar.start(); … bar.done() — options: an object, a ref or a getter. Removed on unmount. */
|
|
312
|
+
export function useLoadingBar(options?: MaybeRefOrGetter<LoadingBarOptions>): LoadingBarHandle;
|
|
313
|
+
export interface LoadingBarProps extends LoadingBarOptions {
|
|
314
|
+
/** Starts the bar when it turns true, finishes it when it turns false. */
|
|
315
|
+
active?: boolean;
|
|
316
|
+
}
|
|
317
|
+
/** <LoadingBar :active="saving" /> — the thin loading line along the top. Template ref → LoadingBarHandle. */
|
|
318
|
+
export const LoadingBar: GeckoComponent<LoadingBarProps>;
|
|
319
|
+
|
|
320
|
+
/* ---------------- CommandPalette ---------------- */
|
|
321
|
+
export interface PaletteItem {
|
|
322
|
+
/** Main text. */
|
|
323
|
+
title: string;
|
|
324
|
+
/** Smaller line. */
|
|
325
|
+
sub?: string;
|
|
326
|
+
/** An icon name. Default 'arrowR'. */
|
|
327
|
+
icon?: string;
|
|
328
|
+
/** Runs after the palette closed. */
|
|
329
|
+
run?: () => void;
|
|
330
|
+
[key: string]: unknown;
|
|
331
|
+
}
|
|
332
|
+
export interface PaletteGroup {
|
|
333
|
+
/** Small heading over the group. */
|
|
334
|
+
label: string;
|
|
335
|
+
items: PaletteItem[];
|
|
336
|
+
}
|
|
337
|
+
export interface CommandPaletteProps {
|
|
338
|
+
/** Open (true) or closed (false); use v-model:open. */
|
|
339
|
+
open?: boolean;
|
|
340
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
341
|
+
/** Called when it closes itself (Esc, scrim, an item picked), after v-model:open turned false. */
|
|
342
|
+
onClose?: () => void;
|
|
343
|
+
/** Called after an item is picked (after its run). */
|
|
344
|
+
onSelect?: (item: PaletteItem) => void;
|
|
345
|
+
/** (q) → groups, called on every key with the trimmed, lowercased text ('' at first). */
|
|
346
|
+
search: (query: string) => PaletteGroup[];
|
|
347
|
+
/** Text in the empty field. Default 'Search…'. */
|
|
348
|
+
placeholder?: string;
|
|
349
|
+
/** Shown when nothing matches. */
|
|
350
|
+
emptyTitle?: string;
|
|
351
|
+
/** The line under emptyTitle. */
|
|
352
|
+
emptyBody?: string;
|
|
353
|
+
}
|
|
354
|
+
/** <CommandPalette v-model:open="open" :search="(q) => groups" /> — the ⌘K search window. */
|
|
355
|
+
export const CommandPalette: GeckoComponent<CommandPaletteProps>;
|
|
356
|
+
|
|
357
|
+
/* ---------------- Tour ---------------- */
|
|
358
|
+
export interface TourStep {
|
|
359
|
+
/** What to point at: a template ref, an element, a component or a selector. Not on the page → skipped. Left out → bubble in the middle. */
|
|
360
|
+
target?: string | AnchorLike;
|
|
361
|
+
/** Heading of the bubble. */
|
|
362
|
+
title?: string;
|
|
363
|
+
/** Text of the bubble. */
|
|
364
|
+
text?: string;
|
|
365
|
+
/** Name of a Tour slot to show instead of text (the slot gets { step, index }). */
|
|
366
|
+
slot?: string;
|
|
367
|
+
/** Side for this step's bubble. */
|
|
368
|
+
placement?: 'auto' | 'top' | 'bottom' | 'left' | 'right';
|
|
369
|
+
/** px between the target and the spotlight's edge. */
|
|
370
|
+
padding?: number;
|
|
371
|
+
/** Spotlight corners in px. */
|
|
372
|
+
radius?: number | null;
|
|
373
|
+
}
|
|
374
|
+
export interface TourHandle {
|
|
375
|
+
/** Open on step i (default: the start prop). False when there is nothing to show. */
|
|
376
|
+
start(index?: number): boolean;
|
|
377
|
+
next(): void;
|
|
378
|
+
prev(): void;
|
|
379
|
+
go(index: number): void;
|
|
380
|
+
/** End it (onEnd(false)). */
|
|
381
|
+
stop(): void;
|
|
382
|
+
/** The step on screen, -1 when closed. */
|
|
383
|
+
readonly index: number;
|
|
384
|
+
readonly active: boolean;
|
|
385
|
+
}
|
|
386
|
+
export interface TourProps {
|
|
387
|
+
/** The stops. */
|
|
388
|
+
steps: TourStep[];
|
|
389
|
+
/** Running (true) or not; use v-model:open. Setting it to false ends the tour without calling onEnd. */
|
|
390
|
+
open?: boolean;
|
|
391
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
392
|
+
/** The step it opens on. Default 0. */
|
|
393
|
+
start?: number;
|
|
394
|
+
/** After each step is shown. */
|
|
395
|
+
onStep?: (index: number, step: TourStep) => void;
|
|
396
|
+
/** When it ends by itself (after v-model:open turned false): finished = true when Done was pressed on the last step. */
|
|
397
|
+
onEnd?: (finished: boolean) => void;
|
|
398
|
+
/** Default side for the bubble. Default 'auto'. */
|
|
399
|
+
placement?: 'auto' | 'top' | 'bottom' | 'left' | 'right';
|
|
400
|
+
/** px between the target and the spotlight's edge. Default 8. */
|
|
401
|
+
padding?: number;
|
|
402
|
+
/** Spotlight corners in px; null = the target's own + padding. */
|
|
403
|
+
radius?: number | null;
|
|
404
|
+
/** Dim the page and block clicks on it (default true); false = only a ring. */
|
|
405
|
+
backdrop?: boolean;
|
|
406
|
+
/** Scroll each target into view. Default true. */
|
|
407
|
+
scroll?: boolean;
|
|
408
|
+
/** Texts: label, next, back, skip, done, stepOf ('Step {n} of {total}' or (n, total) => text). */
|
|
409
|
+
words?: Partial<Record<'label' | 'next' | 'back' | 'skip' | 'done', string>> & { stepOf?: string | ((n: number, total: number) => string) };
|
|
410
|
+
}
|
|
411
|
+
/** <Tour v-model:open="touring" :steps="[…]"><template #drag>…</template></Tour> — spotlight walk-through. Template ref → TourHandle. */
|
|
412
|
+
export const Tour: GeckoComponent<TourProps, Record<string, ((props: { step: TourStep; index: number }) => VNodeChild) | undefined>>;
|
|
413
|
+
|
|
414
|
+
/* ---------------- Lightbox ---------------- */
|
|
415
|
+
export interface LightboxImage {
|
|
416
|
+
/** The big image. */
|
|
417
|
+
src: string;
|
|
418
|
+
alt?: string;
|
|
419
|
+
caption?: string;
|
|
420
|
+
/** Its width, if known (sharper opening animation). */
|
|
421
|
+
w?: number;
|
|
422
|
+
/** Its height, if known. */
|
|
423
|
+
h?: number;
|
|
424
|
+
/** The thumbnail it grows out of: an element, a template ref or a selector. */
|
|
425
|
+
from?: string | AnchorLike;
|
|
426
|
+
}
|
|
427
|
+
export interface LightboxProps {
|
|
428
|
+
/** Image addresses or image objects. */
|
|
429
|
+
items: Array<string | LightboxImage>;
|
|
430
|
+
/** Open (true) or closed (false); use v-model:open. */
|
|
431
|
+
open?: boolean;
|
|
432
|
+
'onUpdate:open'?: (open: boolean) => void;
|
|
433
|
+
/** The image shown; use v-model:index. Changing it while open moves there. Default 0. */
|
|
434
|
+
index?: number;
|
|
435
|
+
'onUpdate:index'?: (index: number) => void;
|
|
436
|
+
/** Called when it closes itself (✕, Esc, drag down, a tap outside), with the last index. */
|
|
437
|
+
onClose?: (index: number) => void;
|
|
438
|
+
/** Called when another image comes on screen. */
|
|
439
|
+
onChange?: (index: number) => void;
|
|
440
|
+
/** Double-tap zoom. Default 2.5. */
|
|
441
|
+
zoom?: number;
|
|
442
|
+
/** The most a pinch may reach. Default 4. */
|
|
443
|
+
maxZoom?: number;
|
|
444
|
+
/** Texts: label, close, prev, next, zoomIn, zoomOut, count(i, n), image(i, n, caption). */
|
|
445
|
+
words?: Record<string, string | ((...a: any[]) => string)>;
|
|
446
|
+
}
|
|
447
|
+
/** <Lightbox v-model:open="shown" v-model:index="i" :items="…" /> — full-screen images. */
|
|
448
|
+
export const Lightbox: GeckoComponent<LightboxProps>;
|
|
449
|
+
|
|
450
|
+
export interface LightboxGalleryOptions {
|
|
451
|
+
/** Which elements open it. Default '[data-lightbox]'. */
|
|
452
|
+
selector?: string;
|
|
453
|
+
/** Double-tap zoom. Default 2.5. */
|
|
454
|
+
zoom?: number;
|
|
455
|
+
/** The most a pinch may reach. Default 4. */
|
|
456
|
+
maxZoom?: number;
|
|
457
|
+
/** Texts, as in Lightbox. */
|
|
458
|
+
words?: LightboxProps['words'];
|
|
459
|
+
/** Called when another image comes on screen. */
|
|
460
|
+
onChange?: (index: number) => void;
|
|
461
|
+
/** Called when it closes, with the last index. */
|
|
462
|
+
onClose?: (index: number) => void;
|
|
463
|
+
}
|
|
464
|
+
/** <LightboxGallery>…<a href="big.jpg" data-lightbox="bikes"><img …/></a>…</LightboxGallery> */
|
|
465
|
+
export const LightboxGallery: GeckoComponent<EnhancerProps<LightboxGalleryOptions>, DefaultSlot>;
|
|
466
|
+
|
|
467
|
+
export {};
|