@qikbar/qikbar 0.0.25 → 0.1.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 +92 -0
- package/dist/ai/agent.d.ts +42 -0
- package/dist/ai/byok.d.ts +29 -0
- package/dist/ai/index.d.ts +8 -0
- package/dist/ai/providers.d.ts +82 -0
- package/dist/ai/sse.d.ts +9 -0
- package/dist/ai.js +36 -0
- package/dist/ai.js.map +7 -0
- package/dist/chunks/bar-D5CSPT3U.js +2031 -0
- package/dist/chunks/bar-D5CSPT3U.js.map +7 -0
- package/dist/chunks/chunk-2ADXL7KQ.js +358 -0
- package/dist/chunks/chunk-2ADXL7KQ.js.map +7 -0
- package/dist/chunks/chunk-6TC6G2C5.js +107 -0
- package/dist/chunks/chunk-6TC6G2C5.js.map +7 -0
- package/dist/chunks/chunk-HBBSETRF.js +153 -0
- package/dist/chunks/chunk-HBBSETRF.js.map +7 -0
- package/dist/chunks/chunk-I77YSUJN.js +104 -0
- package/dist/chunks/chunk-I77YSUJN.js.map +7 -0
- package/dist/chunks/chunk-IJ3WUM3T.js +544 -0
- package/dist/chunks/chunk-IJ3WUM3T.js.map +7 -0
- package/dist/chunks/chunk-MPTP2EWW.js +8 -0
- package/dist/chunks/chunk-MPTP2EWW.js.map +7 -0
- package/dist/chunks/chunk-N4Y2Z6YD.js +69 -0
- package/dist/chunks/chunk-N4Y2Z6YD.js.map +7 -0
- package/dist/chunks/chunk-PQEHV3D4.js +124 -0
- package/dist/chunks/chunk-PQEHV3D4.js.map +7 -0
- package/dist/chunks/chunk-VXTYD56F.js +453 -0
- package/dist/chunks/chunk-VXTYD56F.js.map +7 -0
- package/dist/chunks/chunk-YCVJQ7U3.js +52 -0
- package/dist/chunks/chunk-YCVJQ7U3.js.map +7 -0
- package/dist/core/define.d.ts +40 -0
- package/dist/core/frecency.d.ts +16 -0
- package/dist/core/hotkeys.d.ts +39 -0
- package/dist/core/lazy.d.ts +48 -0
- package/dist/core/search.d.ts +42 -0
- package/dist/core/storage.d.ts +5 -0
- package/dist/core/types.d.ts +601 -0
- package/dist/extensions/index.d.ts +30 -0
- package/dist/extensions/math.d.ts +14 -0
- package/dist/extensions.js +476 -0
- package/dist/extensions.js.map +7 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +7 -0
- package/dist/qikbar.global.js +259 -0
- package/dist/qikbar.global.js.map +7 -0
- package/dist/react/index.d.ts +66 -0
- package/dist/react.js +119 -0
- package/dist/react.js.map +7 -0
- package/dist/server/index.d.ts +47 -0
- package/dist/server.js +93 -0
- package/dist/server.js.map +7 -0
- package/dist/styles.css +222 -0
- package/dist/theme.d.ts +5 -0
- package/dist/theme.js +20 -0
- package/dist/theme.js.map +7 -0
- package/dist/ui/bar.d.ts +252 -0
- package/dist/ui/dom.d.ts +21 -0
- package/dist/ui/icons.d.ts +88 -0
- package/dist/ui/markdown.d.ts +8 -0
- package/dist/ui/nav.d.ts +8 -0
- package/dist/ui/styles.d.ts +6 -0
- package/dist/ui/themes.d.ts +27 -0
- package/dist/ui/views.d.ts +148 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +50 -0
- package/dist/utils.js.map +7 -0
- package/package.json +88 -43
- package/dist/qikbar.es.js +0 -8748
- package/dist/qikbar.umd.js +0 -113
- package/dist/types/boot.d.ts +0 -72
- package/dist/types/index.d.ts +0 -1
- package/dist/types/init.d.ts +0 -2
- package/dist/types/main.d.ts +0 -4
- package/dist/types/shared/AsyncRoot.d.ts +0 -5
- package/dist/types/shared/CommandFooter.d.ts +0 -5
- package/dist/types/shared/Crumbs.d.ts +0 -6
- package/dist/types/shared/Details.d.ts +0 -3
- package/dist/types/shared/ErrorBoundary.d.ts +0 -15
- package/dist/types/shared/Icon.d.ts +0 -4
- package/dist/types/shared/List.d.ts +0 -30
- package/dist/types/shared/Qikbar.d.ts +0 -5
- package/dist/types/shared/Root.d.ts +0 -4
- package/dist/types/shared/Search.d.ts +0 -1
- package/dist/types/shared/commandContext.d.ts +0 -8
- package/dist/types/shared/useDebounce.d.ts +0 -1
- package/dist/types/utils/liquid.d.ts +0 -4
- package/dist/types/vite-env.d.ts +0 -1
package/dist/ui/bar.d.ts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Frecency } from '../core/frecency.js';
|
|
2
|
+
import type { Action, AIClient, AIMessage, AIOptions, ConfirmOptions, Context, Extension, FormView, Item, Preference, QikbarConfig, QikbarEvents, QikbarInstance, ScopedStorage, Source, ToastHandle, ToastOptions, View } from '../core/types.js';
|
|
3
|
+
export interface RootView {
|
|
4
|
+
type: 'root';
|
|
5
|
+
title?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
actions?: Action[];
|
|
8
|
+
}
|
|
9
|
+
export type AnyView = View | RootView;
|
|
10
|
+
export interface ExtRuntime {
|
|
11
|
+
ext: Extension;
|
|
12
|
+
provided: Record<string, any>;
|
|
13
|
+
storage: ScopedStorage;
|
|
14
|
+
prefs(): Record<string, any>;
|
|
15
|
+
missing(): Preference[];
|
|
16
|
+
}
|
|
17
|
+
export type Row = {
|
|
18
|
+
kind: 'section';
|
|
19
|
+
key: string;
|
|
20
|
+
title: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'item';
|
|
23
|
+
key: string;
|
|
24
|
+
item: Item;
|
|
25
|
+
positions?: number[];
|
|
26
|
+
index: number;
|
|
27
|
+
};
|
|
28
|
+
export interface ChatTurn {
|
|
29
|
+
role: 'user' | 'assistant';
|
|
30
|
+
text: string;
|
|
31
|
+
tools: {
|
|
32
|
+
label: string;
|
|
33
|
+
state: 'running' | 'done' | 'error';
|
|
34
|
+
}[];
|
|
35
|
+
error?: string;
|
|
36
|
+
streaming?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface Frame {
|
|
39
|
+
id: number;
|
|
40
|
+
view: AnyView;
|
|
41
|
+
query: string;
|
|
42
|
+
selected: number;
|
|
43
|
+
selectedKey?: string;
|
|
44
|
+
rows: Row[];
|
|
45
|
+
itemRows: Extract<Row, {
|
|
46
|
+
kind: 'item';
|
|
47
|
+
}>[];
|
|
48
|
+
loading: number;
|
|
49
|
+
controller: AbortController;
|
|
50
|
+
queryController?: AbortController;
|
|
51
|
+
ext?: ExtRuntime;
|
|
52
|
+
args?: Record<string, string>;
|
|
53
|
+
scrollTop?: number;
|
|
54
|
+
/** Items loaded by a list/grid loader. */
|
|
55
|
+
items?: Item[];
|
|
56
|
+
sourceResults?: Map<string, Item[]>;
|
|
57
|
+
detail?: {
|
|
58
|
+
text: string;
|
|
59
|
+
done: boolean;
|
|
60
|
+
error?: string;
|
|
61
|
+
};
|
|
62
|
+
form?: {
|
|
63
|
+
values: Record<string, any>;
|
|
64
|
+
errors: Record<string, string>;
|
|
65
|
+
};
|
|
66
|
+
chat?: {
|
|
67
|
+
messages: AIMessage[];
|
|
68
|
+
turns: ChatTurn[];
|
|
69
|
+
controller?: AbortController;
|
|
70
|
+
};
|
|
71
|
+
actionCache?: WeakMap<Item, Action[]>;
|
|
72
|
+
error?: string;
|
|
73
|
+
/** The user moved the selection since the last query change. */
|
|
74
|
+
userMoved?: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface Dom {
|
|
77
|
+
root: HTMLElement;
|
|
78
|
+
overlay: HTMLElement;
|
|
79
|
+
dialog: HTMLElement;
|
|
80
|
+
header: HTMLElement;
|
|
81
|
+
back: HTMLButtonElement;
|
|
82
|
+
crumb: HTMLElement;
|
|
83
|
+
searchIcon: HTMLElement;
|
|
84
|
+
input: HTMLInputElement;
|
|
85
|
+
args: HTMLElement;
|
|
86
|
+
title: HTMLElement;
|
|
87
|
+
hint: HTMLElement;
|
|
88
|
+
progress: HTMLElement;
|
|
89
|
+
body: HTMLElement;
|
|
90
|
+
footer: HTMLElement;
|
|
91
|
+
footerLeft: HTMLElement;
|
|
92
|
+
footerRight: HTMLElement;
|
|
93
|
+
layer: HTMLElement;
|
|
94
|
+
live: HTMLElement;
|
|
95
|
+
}
|
|
96
|
+
interface PanelState {
|
|
97
|
+
item: Item | undefined;
|
|
98
|
+
actions: Action[];
|
|
99
|
+
filter: string;
|
|
100
|
+
selected: number;
|
|
101
|
+
el?: HTMLElement;
|
|
102
|
+
input?: HTMLInputElement;
|
|
103
|
+
list?: HTMLElement;
|
|
104
|
+
}
|
|
105
|
+
export declare const isView: (x: unknown) => x is View;
|
|
106
|
+
export declare class Bar implements QikbarInstance {
|
|
107
|
+
config: QikbarConfig;
|
|
108
|
+
readonly instanceId: string;
|
|
109
|
+
private storageAdapter;
|
|
110
|
+
readonly storage: ScopedStorage;
|
|
111
|
+
readonly frecency: Frecency;
|
|
112
|
+
private registrations;
|
|
113
|
+
private regCounter;
|
|
114
|
+
private sources;
|
|
115
|
+
readonly sourceExt: WeakMap<Source, ExtRuntime>;
|
|
116
|
+
readonly itemExt: WeakMap<Item, ExtRuntime>;
|
|
117
|
+
private extensions;
|
|
118
|
+
private configExtensions;
|
|
119
|
+
private configSources;
|
|
120
|
+
private ids;
|
|
121
|
+
private listeners;
|
|
122
|
+
stack: Frame[];
|
|
123
|
+
private _open;
|
|
124
|
+
private rootCache;
|
|
125
|
+
private routeItems;
|
|
126
|
+
private autoItems;
|
|
127
|
+
private shortcutItems;
|
|
128
|
+
aiOptions?: AIOptions;
|
|
129
|
+
ai: AIClient | undefined;
|
|
130
|
+
dom?: Dom;
|
|
131
|
+
private renderer?;
|
|
132
|
+
panel?: PanelState;
|
|
133
|
+
private toastState?;
|
|
134
|
+
private toastTimer?;
|
|
135
|
+
private toastId;
|
|
136
|
+
private hud?;
|
|
137
|
+
private confirmState?;
|
|
138
|
+
argMode?: {
|
|
139
|
+
item: Item;
|
|
140
|
+
action: Action;
|
|
141
|
+
frame: Frame;
|
|
142
|
+
values: Record<string, string>;
|
|
143
|
+
};
|
|
144
|
+
private seq;
|
|
145
|
+
private prevFocus;
|
|
146
|
+
private teardown;
|
|
147
|
+
private appliedVars;
|
|
148
|
+
private scheduled;
|
|
149
|
+
private scrollLock?;
|
|
150
|
+
private closeTimer?;
|
|
151
|
+
private destroyed;
|
|
152
|
+
private styleEl?;
|
|
153
|
+
constructor(config?: QikbarConfig);
|
|
154
|
+
get isOpen(): boolean;
|
|
155
|
+
get query(): string;
|
|
156
|
+
get top(): Frame | undefined;
|
|
157
|
+
get isInline(): boolean;
|
|
158
|
+
get aiName(): string;
|
|
159
|
+
get actionsHotkey(): string;
|
|
160
|
+
open(options?: {
|
|
161
|
+
query?: string;
|
|
162
|
+
view?: View;
|
|
163
|
+
focus?: boolean;
|
|
164
|
+
}): void;
|
|
165
|
+
close(): void;
|
|
166
|
+
toggle(): void;
|
|
167
|
+
register(commands: Item | Item[]): () => void;
|
|
168
|
+
addSource(source: Source): () => void;
|
|
169
|
+
use(ext: Extension, provided?: Record<string, any>): () => void;
|
|
170
|
+
configure(partial: Partial<QikbarConfig>): void;
|
|
171
|
+
push(view: View, ext?: ExtRuntime): void;
|
|
172
|
+
pop(): void;
|
|
173
|
+
setQuery(query: string): void;
|
|
174
|
+
ask(prompt?: string): void;
|
|
175
|
+
commands(): Item[];
|
|
176
|
+
on<K extends keyof QikbarEvents>(event: K, handler: (payload: QikbarEvents[K]) => void): () => void;
|
|
177
|
+
preload(): Promise<void>;
|
|
178
|
+
destroy(): void;
|
|
179
|
+
private applyConfig;
|
|
180
|
+
private inlineTarget;
|
|
181
|
+
private emit;
|
|
182
|
+
private emitChange;
|
|
183
|
+
private listen;
|
|
184
|
+
idOf(item: Item): string;
|
|
185
|
+
private invalidateRoot;
|
|
186
|
+
rootItems(): Item[];
|
|
187
|
+
private autoIndex;
|
|
188
|
+
private createFrame;
|
|
189
|
+
private resetToRoot;
|
|
190
|
+
private destroyFrame;
|
|
191
|
+
/** Start async work for a freshly pushed frame. */
|
|
192
|
+
private startFrame;
|
|
193
|
+
private replaceFrame;
|
|
194
|
+
computeRows(frame: Frame): void;
|
|
195
|
+
private rootGroups;
|
|
196
|
+
private listGroups;
|
|
197
|
+
private onQueryChange;
|
|
198
|
+
private searchSources;
|
|
199
|
+
private loadItems;
|
|
200
|
+
private setItems;
|
|
201
|
+
private loadDetail;
|
|
202
|
+
makeContext(frame: Frame, extra?: {
|
|
203
|
+
ext?: ExtRuntime;
|
|
204
|
+
args?: Record<string, string>;
|
|
205
|
+
signal?: AbortSignal;
|
|
206
|
+
}): Context;
|
|
207
|
+
navigate(href: string, newTab?: boolean): void;
|
|
208
|
+
actionsFor(item: Item | undefined, frame: Frame): Action[];
|
|
209
|
+
selectedItem(frame?: Frame | undefined): Item | undefined;
|
|
210
|
+
runAction(frame: Frame, item: Item | undefined, act: Action, args?: Record<string, string>): Promise<void>;
|
|
211
|
+
runPrimary(frame?: Frame | undefined, index?: number): void;
|
|
212
|
+
preferencesForm(rt: ExtRuntime, then?: () => void): FormView;
|
|
213
|
+
private enterArgMode;
|
|
214
|
+
private submitArgs;
|
|
215
|
+
sendChat(frame: Frame, text: string): void;
|
|
216
|
+
stopChat(frame: Frame): boolean;
|
|
217
|
+
private systemPrompt;
|
|
218
|
+
private agentTools;
|
|
219
|
+
toast(options: ToastOptions | string): ToastHandle;
|
|
220
|
+
confirm(options: ConfirmOptions | string): Promise<boolean>;
|
|
221
|
+
private onGlobalKeyDown;
|
|
222
|
+
private onGlobalClick;
|
|
223
|
+
private onDialogKeyDown;
|
|
224
|
+
escape(): void;
|
|
225
|
+
openPanel(): void;
|
|
226
|
+
closePanel(): void;
|
|
227
|
+
private panelActions;
|
|
228
|
+
private onPanelKey;
|
|
229
|
+
private runFromPanel;
|
|
230
|
+
private renderPanel;
|
|
231
|
+
cls(base: string, slot: keyof NonNullable<QikbarConfig['classNames']>): string;
|
|
232
|
+
private injectStyles;
|
|
233
|
+
private mount;
|
|
234
|
+
private applyClassNames;
|
|
235
|
+
private resolveAppearance;
|
|
236
|
+
applyTheme(): void;
|
|
237
|
+
private watchAppearance;
|
|
238
|
+
private lockScroll;
|
|
239
|
+
private unlockScroll;
|
|
240
|
+
focusInput(): void;
|
|
241
|
+
invalidate(): void;
|
|
242
|
+
flush(): void;
|
|
243
|
+
private createRenderer;
|
|
244
|
+
private renderHeader;
|
|
245
|
+
private renderFooter;
|
|
246
|
+
private renderFooterLeft;
|
|
247
|
+
private footerButton;
|
|
248
|
+
private renderToast;
|
|
249
|
+
private renderLayer;
|
|
250
|
+
announce(text: string): void;
|
|
251
|
+
}
|
|
252
|
+
export {};
|
package/dist/ui/dom.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Accessory, Color, Icon } from '../core/types.js';
|
|
2
|
+
type Child = Node | string | number | null | undefined | false;
|
|
3
|
+
type Props = Record<string, unknown> & {
|
|
4
|
+
class?: string;
|
|
5
|
+
style?: string | Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
/** Tiny hyperscript helper. */
|
|
8
|
+
export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Props | null, ...children: (Child | Child[])[]): HTMLElementTagNameMap[K];
|
|
9
|
+
export declare function renderIcon(icon: Icon | undefined, size?: number): HTMLElement | null;
|
|
10
|
+
export declare function renderKbd(hotkey: string, className?: string): HTMLElement;
|
|
11
|
+
/** Render `text` with matched characters wrapped in `<mark>`. */
|
|
12
|
+
export declare function highlight(text: string, positions: number[] | undefined): DocumentFragment | string;
|
|
13
|
+
export declare function colorValue(color: Color | undefined): string;
|
|
14
|
+
export declare function renderTag(tag: string | {
|
|
15
|
+
value: string;
|
|
16
|
+
color?: Color;
|
|
17
|
+
}): HTMLElement;
|
|
18
|
+
export declare function relativeTime(date: Date | number | string): string;
|
|
19
|
+
export declare function renderAccessory(acc: Accessory): HTMLElement;
|
|
20
|
+
export declare function uid(prefix?: string): string;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in icon set (24×24, stroke based, Lucide-compatible geometry).
|
|
3
|
+
* Use by name: `icon: "settings"`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const icons: {
|
|
6
|
+
readonly search: "<circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.5-3.5\"/>";
|
|
7
|
+
readonly command: "<path d=\"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3\"/>";
|
|
8
|
+
readonly 'arrow-right': "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>";
|
|
9
|
+
readonly 'arrow-left': "<path d=\"M19 12H5\"/><path d=\"m12 19-7-7 7-7\"/>";
|
|
10
|
+
readonly 'arrow-up-right': "<path d=\"M7 17 17 7\"/><path d=\"M7 7h10v10\"/>";
|
|
11
|
+
readonly 'chevron-right': "<path d=\"m9 18 6-6-6-6\"/>";
|
|
12
|
+
readonly 'chevron-left': "<path d=\"m15 18-6-6 6-6\"/>";
|
|
13
|
+
readonly 'chevron-down': "<path d=\"m6 9 6 6 6-6\"/>";
|
|
14
|
+
readonly 'corner-down-left': "<path d=\"M20 4v7a4 4 0 0 1-4 4H4\"/><path d=\"m9 10-5 5 5 5\"/>";
|
|
15
|
+
readonly external: "<path d=\"M15 3h6v6\"/><path d=\"M10 14 21 3\"/><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/>";
|
|
16
|
+
readonly link: "<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>";
|
|
17
|
+
readonly copy: "<rect x=\"8\" y=\"8\" width=\"14\" height=\"14\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/>";
|
|
18
|
+
readonly check: "<path d=\"M20 6 9 17l-5-5\"/>";
|
|
19
|
+
readonly x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>";
|
|
20
|
+
readonly plus: "<path d=\"M5 12h14\"/><path d=\"M12 5v14\"/>";
|
|
21
|
+
readonly minus: "<path d=\"M5 12h14\"/>";
|
|
22
|
+
readonly home: "<path d=\"m3 10 9-7 9 7v10a2 2 0 0 1-2 2h-4v-7H9v7H5a2 2 0 0 1-2-2z\"/>";
|
|
23
|
+
readonly settings: "<path d=\"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>";
|
|
24
|
+
readonly user: "<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M20 21a8 8 0 0 0-16 0\"/>";
|
|
25
|
+
readonly users: "<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.87\"/><path d=\"M16 3.13a4 4 0 0 1 0 7.75\"/>";
|
|
26
|
+
readonly file: "<path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z\"/><path d=\"M14 2v6h6\"/>";
|
|
27
|
+
readonly 'file-text': "<path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z\"/><path d=\"M14 2v6h6\"/><path d=\"M16 13H8\"/><path d=\"M16 17H8\"/><path d=\"M10 9H8\"/>";
|
|
28
|
+
readonly folder: "<path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\"/>";
|
|
29
|
+
readonly book: "<path d=\"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20\"/>";
|
|
30
|
+
readonly bookmark: "<path d=\"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z\"/>";
|
|
31
|
+
readonly star: "<path d=\"m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z\"/>";
|
|
32
|
+
readonly heart: "<path d=\"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z\"/>";
|
|
33
|
+
readonly clock: "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 6v6l4 2\"/>";
|
|
34
|
+
readonly history: "<path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/><path d=\"M12 7v5l4 2\"/>";
|
|
35
|
+
readonly calendar: "<rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M16 2v4\"/><path d=\"M8 2v4\"/><path d=\"M3 10h18\"/>";
|
|
36
|
+
readonly calculator: "<rect x=\"4\" y=\"2\" width=\"16\" height=\"20\" rx=\"2\"/><path d=\"M8 6h8\"/><path d=\"M16 14v4\"/><path d=\"M16 10h.01\"/><path d=\"M12 10h.01\"/><path d=\"M8 10h.01\"/><path d=\"M12 14h.01\"/><path d=\"M8 14h.01\"/><path d=\"M12 18h.01\"/><path d=\"M8 18h.01\"/>";
|
|
37
|
+
readonly sun: "<circle cx=\"12\" cy=\"12\" r=\"4\"/><path d=\"M12 2v2\"/><path d=\"M12 20v2\"/><path d=\"m4.93 4.93 1.41 1.41\"/><path d=\"m17.66 17.66 1.41 1.41\"/><path d=\"M2 12h2\"/><path d=\"M20 12h2\"/><path d=\"m6.34 17.66-1.41 1.41\"/><path d=\"m19.07 4.93-1.41 1.41\"/>";
|
|
38
|
+
readonly moon: "<path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"/>";
|
|
39
|
+
readonly monitor: "<rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M8 21h8\"/><path d=\"M12 17v4\"/>";
|
|
40
|
+
readonly palette: "<circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><path d=\"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.56-2.5 5.56-5.55C21.97 6.01 17.46 2 12 2z\"/>";
|
|
41
|
+
readonly sparkles: "<path d=\"M9.94 15.5A2 2 0 0 0 8.5 14.06l-6.14-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0L14.06 8.5A2 2 0 0 0 15.5 9.94l6.14 1.58a.5.5 0 0 1 0 .96L15.5 14.06a2 2 0 0 0-1.44 1.44l-1.58 6.14a.5.5 0 0 1-.96 0z\"/><path d=\"M20 3v4\"/><path d=\"M22 5h-4\"/>";
|
|
42
|
+
readonly bot: "<path d=\"M12 8V4H8\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" rx=\"2\"/><path d=\"M2 14h2\"/><path d=\"M20 14h2\"/><path d=\"M15 13v2\"/><path d=\"M9 13v2\"/>";
|
|
43
|
+
readonly message: "<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>";
|
|
44
|
+
readonly send: "<path d=\"m22 2-7 20-4-9-9-4Z\"/><path d=\"M22 2 11 13\"/>";
|
|
45
|
+
readonly mail: "<rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"/><path d=\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\"/>";
|
|
46
|
+
readonly bell: "<path d=\"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9\"/><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\"/>";
|
|
47
|
+
readonly 'credit-card': "<rect x=\"2\" y=\"5\" width=\"20\" height=\"14\" rx=\"2\"/><path d=\"M2 10h20\"/>";
|
|
48
|
+
readonly key: "<circle cx=\"7.5\" cy=\"15.5\" r=\"5.5\"/><path d=\"m21 2-9.6 9.6\"/><path d=\"m15.5 7.5 3 3L22 7l-3-3\"/>";
|
|
49
|
+
readonly lock: "<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/>";
|
|
50
|
+
readonly 'log-out': "<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\"/><path d=\"m16 17 5-5-5-5\"/><path d=\"M21 12H9\"/>";
|
|
51
|
+
readonly trash: "<path d=\"M3 6h18\"/><path d=\"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6\"/><path d=\"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2\"/>";
|
|
52
|
+
readonly pencil: "<path d=\"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z\"/>";
|
|
53
|
+
readonly eye: "<path d=\"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>";
|
|
54
|
+
readonly download: "<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><path d=\"m7 10 5 5 5-5\"/><path d=\"M12 15V3\"/>";
|
|
55
|
+
readonly upload: "<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"/><path d=\"m17 8-5-5-5 5\"/><path d=\"M12 3v12\"/>";
|
|
56
|
+
readonly refresh: "<path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\"/><path d=\"M8 16H3v5\"/>";
|
|
57
|
+
readonly filter: "<path d=\"M22 3H2l8 9.46V19l4 2v-8.54z\"/>";
|
|
58
|
+
readonly globe: "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"/><path d=\"M2 12h20\"/>";
|
|
59
|
+
readonly code: "<path d=\"m16 18 6-6-6-6\"/><path d=\"m8 6-6 6 6 6\"/>";
|
|
60
|
+
readonly terminal: "<path d=\"m4 17 6-6-6-6\"/><path d=\"M12 19h8\"/>";
|
|
61
|
+
readonly hash: "<path d=\"M4 9h16\"/><path d=\"M4 15h16\"/><path d=\"M10 3 8 21\"/><path d=\"M16 3l-2 18\"/>";
|
|
62
|
+
readonly zap: "<path d=\"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\"/>";
|
|
63
|
+
readonly layers: "<path d=\"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z\"/><path d=\"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65\"/><path d=\"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65\"/>";
|
|
64
|
+
readonly grid: "<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>";
|
|
65
|
+
readonly list: "<path d=\"M8 6h13\"/><path d=\"M8 12h13\"/><path d=\"M8 18h13\"/><path d=\"M3 6h.01\"/><path d=\"M3 12h.01\"/><path d=\"M3 18h.01\"/>";
|
|
66
|
+
readonly image: "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21\"/>";
|
|
67
|
+
readonly 'git-branch': "<path d=\"M6 3v12\"/><circle cx=\"18\" cy=\"6\" r=\"3\"/><circle cx=\"6\" cy=\"18\" r=\"3\"/><path d=\"M18 9a9 9 0 0 1-9 9\"/>";
|
|
68
|
+
readonly package: "<path d=\"m7.5 4.27 9 5.15\"/><path d=\"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z\"/><path d=\"m3.3 7 8.7 5 8.7-5\"/><path d=\"M12 22V12\"/>";
|
|
69
|
+
readonly puzzle: "<path d=\"M19.44 7.85c-.05.38.09.76.36 1.02l1.57 1.57c.47.47.7 1.08.7 1.7s-.23 1.23-.7 1.7l-1.61 1.61a.98.98 0 0 1-.84.28c-.47-.07-.8-.48-.97-.92a2.5 2.5 0 1 0-3.21 3.21c.44.17.85.5.92.97a.98.98 0 0 1-.28.84l-1.61 1.61c-.47.47-1.08.7-1.7.7s-1.23-.23-1.7-.7l-1.57-1.57a1.2 1.2 0 0 0-1.02-.36c-.47.07-.8.48-.97.92a2.5 2.5 0 1 1-3.21-3.21c.44-.17.85-.5.92-.97a1.2 1.2 0 0 0-.36-1.02L2.7 13.7A2.4 2.4 0 0 1 2 12c0-.62.24-1.23.7-1.7l1.57-1.57c.26-.27.64-.4 1.02-.36.47.07.8.48.97.92a2.5 2.5 0 1 0 3.21-3.21c-.44-.17-.85-.5-.92-.97a1.2 1.2 0 0 1 .36-1.02L10.3 2.7c.47-.47 1.08-.7 1.7-.7s1.23.23 1.7.7l1.57 1.57c.26.27.64.4 1.02.36.47-.07.8-.48.97-.92a2.5 2.5 0 1 1 3.21 3.21c-.44.17-.85.5-.92.97Z\"/>";
|
|
70
|
+
readonly info: "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 16v-4\"/><path d=\"M12 8h.01\"/>";
|
|
71
|
+
readonly alert: "<path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\"/><path d=\"M12 9v4\"/><path d=\"M12 17h.01\"/>";
|
|
72
|
+
readonly 'check-circle': "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m9 12 2 2 4-4\"/>";
|
|
73
|
+
readonly 'x-circle': "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/>";
|
|
74
|
+
readonly loader: "<path d=\"M21 12a9 9 0 1 1-6.22-8.56\"/>";
|
|
75
|
+
readonly circle: "<circle cx=\"12\" cy=\"12\" r=\"9\"/>";
|
|
76
|
+
readonly dot: "<circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"currentColor\"/>";
|
|
77
|
+
readonly 'more-horizontal': "<circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/><circle cx=\"5\" cy=\"12\" r=\"1\"/>";
|
|
78
|
+
readonly 'layout-dashboard': "<rect x=\"3\" y=\"3\" width=\"7\" height=\"9\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"5\" rx=\"1\"/><rect x=\"14\" y=\"12\" width=\"7\" height=\"9\" rx=\"1\"/><rect x=\"3\" y=\"16\" width=\"7\" height=\"5\" rx=\"1\"/>";
|
|
79
|
+
readonly 'bar-chart': "<path d=\"M3 3v18h18\"/><path d=\"M18 17V9\"/><path d=\"M13 17V5\"/><path d=\"M8 17v-3\"/>";
|
|
80
|
+
readonly inbox: "<path d=\"M22 12h-6l-2 3h-4l-2-3H2\"/><path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\"/>";
|
|
81
|
+
readonly tag: "<path d=\"M12.59 2.59A2 2 0 0 0 11.17 2H4a2 2 0 0 0-2 2v7.17a2 2 0 0 0 .59 1.42l8.7 8.7a2.43 2.43 0 0 0 3.42 0l6.58-6.58a2.43 2.43 0 0 0 0-3.42z\"/><circle cx=\"7.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>";
|
|
82
|
+
readonly languages: "<path d=\"m5 8 6 6\"/><path d=\"m4 14 6-6 2-3\"/><path d=\"M2 5h12\"/><path d=\"M7 2h1\"/><path d=\"m22 22-5-10-5 10\"/><path d=\"M14 18h6\"/>";
|
|
83
|
+
readonly wand: "<path d=\"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72\"/><path d=\"m14 7 3 3\"/><path d=\"M5 6v4\"/><path d=\"M19 14v4\"/><path d=\"M10 2v2\"/><path d=\"M7 8H3\"/><path d=\"M21 16h-4\"/><path d=\"M11 3H9\"/>";
|
|
84
|
+
readonly keyboard: "<rect x=\"2\" y=\"4\" width=\"20\" height=\"16\" rx=\"2\"/><path d=\"M6 8h.01\"/><path d=\"M10 8h.01\"/><path d=\"M14 8h.01\"/><path d=\"M18 8h.01\"/><path d=\"M8 12h.01\"/><path d=\"M12 12h.01\"/><path d=\"M16 12h.01\"/><path d=\"M7 16h10\"/>";
|
|
85
|
+
readonly github: "<path d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\"/><path d=\"M9 18c-4.51 2-5-2-7-2\"/>";
|
|
86
|
+
};
|
|
87
|
+
export type IconName = keyof typeof icons;
|
|
88
|
+
export declare function iconSvg(name: string, size?: number): string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small, safe Markdown renderer for detail views and AI answers.
|
|
3
|
+
* All input is escaped; raw HTML is never passed through.
|
|
4
|
+
* Supports headings, paragraphs, emphasis, inline code, fenced code blocks,
|
|
5
|
+
* links, images, block quotes, ordered/unordered/task lists, tables and rules.
|
|
6
|
+
*/
|
|
7
|
+
export declare function escapeHtml(s: string): string;
|
|
8
|
+
export declare function renderMarkdown(md: string): string;
|
package/dist/ui/nav.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
2
|
+
/**
|
|
3
|
+
* Default router: click an existing link to the same href (so framework link
|
|
4
|
+
* handlers run), otherwise click a temporary anchor (picked up by routers that
|
|
5
|
+
* intercept anchor clicks, like SvelteKit, Astro, Nuxt, Turbo) or fall back to a
|
|
6
|
+
* normal navigation.
|
|
7
|
+
*/
|
|
8
|
+
export declare function defaultNavigate(href: string, newTab: boolean): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ThemePresetName, ThemeVars } from '../core/types.js';
|
|
2
|
+
export interface ThemePreset {
|
|
3
|
+
name: ThemePresetName;
|
|
4
|
+
label: string;
|
|
5
|
+
/** Used when only one appearance makes sense for the preset. */
|
|
6
|
+
only?: 'light' | 'dark';
|
|
7
|
+
light?: ThemeVars;
|
|
8
|
+
dark?: ThemeVars;
|
|
9
|
+
}
|
|
10
|
+
/** Defaults (also defined in CSS, repeated here for the theme builder). */
|
|
11
|
+
export declare const baseLight: ThemeVars;
|
|
12
|
+
export declare const baseDark: ThemeVars;
|
|
13
|
+
export declare const presets: Record<ThemePresetName, ThemePreset>;
|
|
14
|
+
/** Convert a camelCase var name to `--qb-kebab-case`. */
|
|
15
|
+
export declare function cssVarName(key: string): string;
|
|
16
|
+
/** Resolve the CSS variables for a theme + appearance. */
|
|
17
|
+
export declare function resolveThemeVars(theme: ThemePresetName | {
|
|
18
|
+
preset?: ThemePresetName;
|
|
19
|
+
vars?: ThemeVars;
|
|
20
|
+
light?: ThemeVars;
|
|
21
|
+
dark?: ThemeVars;
|
|
22
|
+
} | undefined, appearance: 'light' | 'dark'): {
|
|
23
|
+
vars: ThemeVars;
|
|
24
|
+
appearance: 'light' | 'dark';
|
|
25
|
+
};
|
|
26
|
+
/** Generate a CSS snippet for a theme, for copy/pasting into your stylesheet. */
|
|
27
|
+
export declare function themeToCss(vars: ThemeVars, selector?: string): string;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Action } from '../core/types.js';
|
|
2
|
+
import type { Bar, Frame, Row } from './bar.js';
|
|
3
|
+
export interface ViewRenderer {
|
|
4
|
+
readonly frame: Frame;
|
|
5
|
+
readonly el: HTMLElement;
|
|
6
|
+
/** Whether the header search input is shown. */
|
|
7
|
+
readonly hasInput: boolean;
|
|
8
|
+
update(): void;
|
|
9
|
+
/** Return true if the key was handled. */
|
|
10
|
+
onKey(e: KeyboardEvent): boolean;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
scrollTop(): number;
|
|
13
|
+
restoreScroll(top: number): void;
|
|
14
|
+
resetScroll?(): void;
|
|
15
|
+
ensureVisible?(): void;
|
|
16
|
+
focusTarget?(): HTMLElement | null;
|
|
17
|
+
placeholder?(): string | undefined;
|
|
18
|
+
footerPrimary?(): {
|
|
19
|
+
title: string;
|
|
20
|
+
hotkey: string;
|
|
21
|
+
run: () => void;
|
|
22
|
+
} | undefined;
|
|
23
|
+
viewActions?(): Action[];
|
|
24
|
+
}
|
|
25
|
+
export declare class ListRenderer implements ViewRenderer {
|
|
26
|
+
protected bar: Bar;
|
|
27
|
+
readonly frame: Frame;
|
|
28
|
+
readonly el: HTMLElement;
|
|
29
|
+
readonly hasInput = true;
|
|
30
|
+
protected scroller: HTMLElement;
|
|
31
|
+
protected inner: HTMLElement;
|
|
32
|
+
protected emptyEl: HTMLElement;
|
|
33
|
+
protected detailEl?: HTMLElement;
|
|
34
|
+
protected cache: Map<string, {
|
|
35
|
+
el: HTMLElement;
|
|
36
|
+
sig: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
protected renderedKeys: string[];
|
|
39
|
+
protected selectedEl?: HTMLElement;
|
|
40
|
+
protected virtual: boolean;
|
|
41
|
+
protected offsets: number[];
|
|
42
|
+
protected rowHeight: number;
|
|
43
|
+
protected sectionHeight: number;
|
|
44
|
+
private rafId;
|
|
45
|
+
private detailFor?;
|
|
46
|
+
constructor(bar: Bar, frame: Frame);
|
|
47
|
+
protected measure(): void;
|
|
48
|
+
update(): void;
|
|
49
|
+
protected prune(keep: Set<string>): void;
|
|
50
|
+
private renderWindow;
|
|
51
|
+
private onScroll;
|
|
52
|
+
protected rowSig(row: Row): unknown;
|
|
53
|
+
protected rowEl(row: Row): HTMLElement;
|
|
54
|
+
protected sectionEl(title: string): HTMLElement;
|
|
55
|
+
protected itemEl(row: Extract<Row, {
|
|
56
|
+
kind: 'item';
|
|
57
|
+
}>): HTMLElement;
|
|
58
|
+
private kindOf;
|
|
59
|
+
protected updateSelection(): void;
|
|
60
|
+
protected updateEmpty(): void;
|
|
61
|
+
protected updateDetail(): void;
|
|
62
|
+
private onPointerMove;
|
|
63
|
+
private onClick;
|
|
64
|
+
select(index: number, scroll?: boolean): void;
|
|
65
|
+
move(delta: number): void;
|
|
66
|
+
ensureVisible(): void;
|
|
67
|
+
onKey(e: KeyboardEvent): boolean;
|
|
68
|
+
scrollTop(): number;
|
|
69
|
+
restoreScroll(top: number): void;
|
|
70
|
+
resetScroll(): void;
|
|
71
|
+
destroy(): void;
|
|
72
|
+
}
|
|
73
|
+
export declare class GridRenderer extends ListRenderer {
|
|
74
|
+
constructor(bar: Bar, frame: Frame);
|
|
75
|
+
update(): void;
|
|
76
|
+
protected itemEl(row: Extract<Row, {
|
|
77
|
+
kind: 'item';
|
|
78
|
+
}>): HTMLElement;
|
|
79
|
+
ensureVisible(): void;
|
|
80
|
+
onKey(e: KeyboardEvent): boolean;
|
|
81
|
+
private step;
|
|
82
|
+
}
|
|
83
|
+
export declare class DetailRenderer implements ViewRenderer {
|
|
84
|
+
private bar;
|
|
85
|
+
readonly frame: Frame;
|
|
86
|
+
readonly el: HTMLElement;
|
|
87
|
+
readonly hasInput = false;
|
|
88
|
+
private body;
|
|
89
|
+
private rendered;
|
|
90
|
+
private raf;
|
|
91
|
+
constructor(bar: Bar, frame: Frame);
|
|
92
|
+
update(): void;
|
|
93
|
+
private render;
|
|
94
|
+
onKey(e: KeyboardEvent): boolean;
|
|
95
|
+
viewActions(): Action[];
|
|
96
|
+
focusTarget(): HTMLElement;
|
|
97
|
+
scrollTop(): number;
|
|
98
|
+
restoreScroll(top: number): void;
|
|
99
|
+
destroy(): void;
|
|
100
|
+
}
|
|
101
|
+
export declare class FormRenderer implements ViewRenderer {
|
|
102
|
+
private bar;
|
|
103
|
+
readonly frame: Frame;
|
|
104
|
+
readonly el: HTMLElement;
|
|
105
|
+
readonly hasInput = false;
|
|
106
|
+
private inputs;
|
|
107
|
+
private errors;
|
|
108
|
+
constructor(bar: Bar, frame: Frame);
|
|
109
|
+
private control;
|
|
110
|
+
private showErrors;
|
|
111
|
+
submit(): void;
|
|
112
|
+
update(): void;
|
|
113
|
+
onKey(e: KeyboardEvent): boolean;
|
|
114
|
+
footerPrimary(): {
|
|
115
|
+
title: string;
|
|
116
|
+
hotkey: string;
|
|
117
|
+
run: () => void;
|
|
118
|
+
};
|
|
119
|
+
focusTarget(): HTMLElement;
|
|
120
|
+
scrollTop(): number;
|
|
121
|
+
restoreScroll(top: number): void;
|
|
122
|
+
destroy(): void;
|
|
123
|
+
}
|
|
124
|
+
export declare class ChatRenderer implements ViewRenderer {
|
|
125
|
+
private bar;
|
|
126
|
+
readonly frame: Frame;
|
|
127
|
+
readonly el: HTMLElement;
|
|
128
|
+
readonly hasInput = true;
|
|
129
|
+
private turnEls;
|
|
130
|
+
private emptyEl?;
|
|
131
|
+
private raf;
|
|
132
|
+
constructor(bar: Bar, frame: Frame);
|
|
133
|
+
update(): void;
|
|
134
|
+
private render;
|
|
135
|
+
private empty;
|
|
136
|
+
private lastAnswer;
|
|
137
|
+
onKey(e: KeyboardEvent): boolean;
|
|
138
|
+
placeholder(): string;
|
|
139
|
+
footerPrimary(): {
|
|
140
|
+
title: string;
|
|
141
|
+
hotkey: string;
|
|
142
|
+
run: () => void;
|
|
143
|
+
};
|
|
144
|
+
viewActions(): Action[];
|
|
145
|
+
scrollTop(): number;
|
|
146
|
+
restoreScroll(top: number): void;
|
|
147
|
+
destroy(): void;
|
|
148
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Building blocks used by the bar, exported for your own UIs. */
|
|
2
|
+
export { fuzzyMatch, matchItem, normalize, rank } from './core/search.js';
|
|
3
|
+
export type { FuzzyMatch, ItemMatch, RankedItem, RankOptions } from './core/search.js';
|
|
4
|
+
export { formatHotkey, isEditable, isMac, matchesHotkey, parseHotkey, SequenceMatcher } from './core/hotkeys.js';
|
|
5
|
+
export { Frecency } from './core/frecency.js';
|
|
6
|
+
export { defaultStorage, memoryStorage, scopedStorage } from './core/storage.js';
|
|
7
|
+
export { renderMarkdown, escapeHtml } from './ui/markdown.js';
|
|
8
|
+
export { icons, iconSvg } from './ui/icons.js';
|
|
9
|
+
export type { IconName } from './ui/icons.js';
|
|
10
|
+
export { copyText, defaultNavigate } from './ui/nav.js';
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Frecency,
|
|
3
|
+
copyText,
|
|
4
|
+
defaultNavigate,
|
|
5
|
+
escapeHtml,
|
|
6
|
+
fuzzyMatch,
|
|
7
|
+
iconSvg,
|
|
8
|
+
icons,
|
|
9
|
+
matchItem,
|
|
10
|
+
normalize,
|
|
11
|
+
rank,
|
|
12
|
+
renderMarkdown
|
|
13
|
+
} from "./chunks/chunk-VXTYD56F.js";
|
|
14
|
+
import {
|
|
15
|
+
defaultStorage,
|
|
16
|
+
memoryStorage,
|
|
17
|
+
scopedStorage
|
|
18
|
+
} from "./chunks/chunk-YCVJQ7U3.js";
|
|
19
|
+
import {
|
|
20
|
+
SequenceMatcher,
|
|
21
|
+
formatHotkey,
|
|
22
|
+
isEditable,
|
|
23
|
+
isMac,
|
|
24
|
+
matchesHotkey,
|
|
25
|
+
parseHotkey
|
|
26
|
+
} from "./chunks/chunk-PQEHV3D4.js";
|
|
27
|
+
import "./chunks/chunk-MPTP2EWW.js";
|
|
28
|
+
export {
|
|
29
|
+
Frecency,
|
|
30
|
+
SequenceMatcher,
|
|
31
|
+
copyText,
|
|
32
|
+
defaultNavigate,
|
|
33
|
+
defaultStorage,
|
|
34
|
+
escapeHtml,
|
|
35
|
+
formatHotkey,
|
|
36
|
+
fuzzyMatch,
|
|
37
|
+
iconSvg,
|
|
38
|
+
icons,
|
|
39
|
+
isEditable,
|
|
40
|
+
isMac,
|
|
41
|
+
matchItem,
|
|
42
|
+
matchesHotkey,
|
|
43
|
+
memoryStorage,
|
|
44
|
+
normalize,
|
|
45
|
+
parseHotkey,
|
|
46
|
+
rank,
|
|
47
|
+
renderMarkdown,
|
|
48
|
+
scopedStorage
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=utils.js.map
|