@developer.krd/discord-dashboard 0.1.2 → 0.1.5
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/README.md +178 -557
- package/dist/index.cjs +2270 -2232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +374 -136
- package/dist/index.d.ts +374 -136
- package/dist/index.js +2266 -2228
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Elysia, Static } from 'elysia';
|
|
2
|
+
import express, { Express } from 'express';
|
|
3
|
+
import { FastifyInstance } from 'fastify';
|
|
4
|
+
import { Client } from 'discord.js';
|
|
5
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
6
|
|
|
7
|
+
type DashboardScope = "setup" | "user" | "guild";
|
|
8
|
+
type DashboardBoxWidth = 100 | 50 | 33 | 20;
|
|
3
9
|
type CardIntent = "neutral" | "success" | "warning" | "danger" | "info";
|
|
10
|
+
|
|
4
11
|
interface DashboardCard {
|
|
5
12
|
id: string;
|
|
6
13
|
title: string;
|
|
@@ -12,7 +19,6 @@ interface DashboardCard {
|
|
|
12
19
|
direction: "up" | "down" | "flat";
|
|
13
20
|
};
|
|
14
21
|
}
|
|
15
|
-
type DashboardBoxWidth = 100 | 50 | 33 | 20;
|
|
16
22
|
interface DashboardDesignConfig {
|
|
17
23
|
bg?: string;
|
|
18
24
|
rail?: string;
|
|
@@ -27,6 +33,13 @@ interface DashboardDesignConfig {
|
|
|
27
33
|
danger?: string;
|
|
28
34
|
info?: string;
|
|
29
35
|
border?: string;
|
|
36
|
+
customCss?: string;
|
|
37
|
+
surface?: string;
|
|
38
|
+
card?: string;
|
|
39
|
+
card2?: string;
|
|
40
|
+
accent?: string;
|
|
41
|
+
radiusLg?: string;
|
|
42
|
+
radiusMd?: string;
|
|
30
43
|
}
|
|
31
44
|
interface DashboardTemplateRenderContext {
|
|
32
45
|
dashboardName: string;
|
|
@@ -34,36 +47,24 @@ interface DashboardTemplateRenderContext {
|
|
|
34
47
|
setupDesign?: DashboardDesignConfig;
|
|
35
48
|
}
|
|
36
49
|
type DashboardTemplateRenderer = (context: DashboardTemplateRenderContext) => string;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
label: string;
|
|
40
|
-
value: string | number | boolean | string[] | Record<string, unknown>;
|
|
41
|
-
type?: HomeFieldType | "url";
|
|
42
|
-
editable?: boolean;
|
|
43
|
-
placeholder?: string;
|
|
44
|
-
required?: boolean;
|
|
45
|
-
options?: HomeFieldOption[];
|
|
46
|
-
lookup?: HomeLookupConfig;
|
|
47
|
-
}
|
|
48
|
-
interface PluginPanelAction {
|
|
50
|
+
|
|
51
|
+
interface DashboardUser {
|
|
49
52
|
id: string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
username: string;
|
|
54
|
+
discriminator: string;
|
|
55
|
+
avatar: string | null;
|
|
56
|
+
global_name?: string | null;
|
|
57
|
+
avatarUrl?: string | null;
|
|
53
58
|
}
|
|
54
|
-
interface
|
|
59
|
+
interface DashboardGuild {
|
|
55
60
|
id: string;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ok: boolean;
|
|
64
|
-
message?: string;
|
|
65
|
-
refresh?: boolean;
|
|
66
|
-
data?: unknown;
|
|
61
|
+
name: string;
|
|
62
|
+
icon: string | null;
|
|
63
|
+
owner: boolean;
|
|
64
|
+
permissions: string;
|
|
65
|
+
iconUrl?: string | null;
|
|
66
|
+
botInGuild?: boolean;
|
|
67
|
+
inviteUrl?: string;
|
|
67
68
|
}
|
|
68
69
|
interface DiscordChannel {
|
|
69
70
|
id: string;
|
|
@@ -113,13 +114,55 @@ interface DashboardDiscordHelpers {
|
|
|
113
114
|
}) => Promise<DiscordMember[]>;
|
|
114
115
|
getGuildMember: (guildId: string, userId: string) => Promise<DiscordMember | null>;
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
interface DashboardContext {
|
|
118
|
+
user: DashboardUser;
|
|
119
|
+
guilds: DashboardGuild[];
|
|
120
|
+
accessToken: string;
|
|
121
|
+
selectedGuildId?: string;
|
|
122
|
+
helpers: DashboardDiscordHelpers;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface PluginActionResult {
|
|
126
|
+
ok: boolean;
|
|
127
|
+
message?: string;
|
|
128
|
+
refresh?: boolean;
|
|
129
|
+
data?: unknown;
|
|
130
|
+
}
|
|
131
|
+
interface PluginPanelField {
|
|
132
|
+
id?: string;
|
|
133
|
+
label: string;
|
|
134
|
+
value: string | number | boolean | string[] | Record<string, unknown>;
|
|
135
|
+
type?: HomeFieldType | "url";
|
|
136
|
+
editable?: boolean;
|
|
137
|
+
placeholder?: string;
|
|
138
|
+
required?: boolean;
|
|
139
|
+
options?: HomeFieldOption[];
|
|
140
|
+
lookup?: HomeLookupConfig;
|
|
141
|
+
}
|
|
142
|
+
interface PluginPanelAction {
|
|
118
143
|
id: string;
|
|
119
144
|
label: string;
|
|
120
|
-
|
|
145
|
+
variant?: "primary" | "secondary" | "danger";
|
|
146
|
+
collectFields?: boolean;
|
|
147
|
+
}
|
|
148
|
+
interface PluginPanel {
|
|
149
|
+
id: string;
|
|
150
|
+
title: string;
|
|
121
151
|
description?: string;
|
|
152
|
+
width?: DashboardBoxWidth;
|
|
153
|
+
fields?: PluginPanelField[];
|
|
154
|
+
actions?: PluginPanelAction[];
|
|
122
155
|
}
|
|
156
|
+
interface DashboardPlugin {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
description?: string;
|
|
160
|
+
scope?: DashboardScope | "both";
|
|
161
|
+
panels?: PluginPanel[];
|
|
162
|
+
getPanels?: (context: DashboardContext) => Promise<PluginPanel[]> | PluginPanel[];
|
|
163
|
+
actions?: Record<string, (context: DashboardContext, body: unknown) => Promise<PluginActionResult> | PluginActionResult>;
|
|
164
|
+
}
|
|
165
|
+
|
|
123
166
|
type HomeFieldType = "text" | "textarea" | "number" | "select" | "boolean" | "role-search" | "channel-search" | "member-search" | "string-list";
|
|
124
167
|
interface HomeLookupConfig {
|
|
125
168
|
limit?: number;
|
|
@@ -132,6 +175,12 @@ interface HomeFieldOption {
|
|
|
132
175
|
label: string;
|
|
133
176
|
value: string;
|
|
134
177
|
}
|
|
178
|
+
interface HomeCategory {
|
|
179
|
+
id: string;
|
|
180
|
+
label: string;
|
|
181
|
+
scope: DashboardScope;
|
|
182
|
+
description?: string;
|
|
183
|
+
}
|
|
135
184
|
interface HomeSectionField {
|
|
136
185
|
id: string;
|
|
137
186
|
label: string;
|
|
@@ -168,49 +217,148 @@ interface DashboardHomeBuilder {
|
|
|
168
217
|
getSections?: (context: DashboardContext) => Promise<HomeSection[]> | HomeSection[];
|
|
169
218
|
actions?: Record<string, (context: DashboardContext, payload: HomeActionPayload) => Promise<PluginActionResult> | PluginActionResult>;
|
|
170
219
|
}
|
|
171
|
-
|
|
220
|
+
|
|
221
|
+
interface DashboardOverviewCard {
|
|
222
|
+
title: string;
|
|
223
|
+
value: string;
|
|
224
|
+
subtitle?: string;
|
|
225
|
+
}
|
|
226
|
+
interface DashboardCategory {
|
|
172
227
|
id: string;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
avatar: string | null;
|
|
176
|
-
global_name?: string | null;
|
|
228
|
+
label: string;
|
|
229
|
+
description?: string;
|
|
177
230
|
}
|
|
178
|
-
interface
|
|
231
|
+
interface DashboardAction {
|
|
179
232
|
id: string;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
233
|
+
label: string;
|
|
234
|
+
variant?: "primary" | "danger" | "default";
|
|
235
|
+
collectFields?: boolean;
|
|
236
|
+
handler?: (context: unknown, values: Record<string, unknown>) => Promise<{
|
|
237
|
+
message?: string;
|
|
238
|
+
refresh?: boolean;
|
|
239
|
+
}> | {
|
|
240
|
+
message?: string;
|
|
241
|
+
refresh?: boolean;
|
|
242
|
+
};
|
|
187
243
|
}
|
|
188
|
-
interface
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
244
|
+
interface DashboardField {
|
|
245
|
+
id: string;
|
|
246
|
+
label: string;
|
|
247
|
+
type: "text" | "number" | "boolean" | "textarea" | "select" | "string-list" | "role-search" | "channel-search" | "member-search" | "url";
|
|
248
|
+
value?: unknown;
|
|
249
|
+
placeholder?: string;
|
|
250
|
+
required?: boolean;
|
|
251
|
+
readOnly?: boolean;
|
|
252
|
+
editable?: boolean;
|
|
253
|
+
options?: {
|
|
254
|
+
label: string;
|
|
255
|
+
value: string;
|
|
256
|
+
}[];
|
|
257
|
+
lookup?: {
|
|
258
|
+
minQueryLength?: number;
|
|
259
|
+
limit?: number;
|
|
260
|
+
includeManaged?: boolean;
|
|
261
|
+
nsfw?: boolean;
|
|
262
|
+
channelTypes?: number[];
|
|
263
|
+
};
|
|
194
264
|
}
|
|
195
|
-
interface
|
|
265
|
+
interface DashboardSection {
|
|
266
|
+
id: string;
|
|
267
|
+
categoryId: string;
|
|
268
|
+
title: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
width: 20 | 33 | 50 | 100;
|
|
271
|
+
fields: DashboardField[];
|
|
272
|
+
actions: DashboardAction[];
|
|
273
|
+
}
|
|
274
|
+
interface DashboardPanel {
|
|
275
|
+
id: string;
|
|
276
|
+
title: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
fields: DashboardField[];
|
|
279
|
+
actions: DashboardAction[];
|
|
280
|
+
}
|
|
281
|
+
interface DashboardPluginData {
|
|
196
282
|
id: string;
|
|
197
283
|
name: string;
|
|
198
284
|
description?: string;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
285
|
+
panels: DashboardPanel[];
|
|
286
|
+
}
|
|
287
|
+
interface DashboardData {
|
|
288
|
+
categories: DashboardCategory[];
|
|
289
|
+
sections: DashboardSection[];
|
|
290
|
+
plugins: DashboardPluginData[];
|
|
291
|
+
overviewCards: DashboardOverviewCard[];
|
|
202
292
|
}
|
|
293
|
+
|
|
294
|
+
declare function renderCompactLayout(context: DashboardTemplateRenderContext): string;
|
|
295
|
+
|
|
296
|
+
declare function renderDefaultLayout(context: DashboardTemplateRenderContext): string;
|
|
297
|
+
|
|
298
|
+
declare function renderShadcnMagicLayout(context: DashboardTemplateRenderContext): string;
|
|
299
|
+
|
|
300
|
+
declare const BuiltinLayouts: {
|
|
301
|
+
default: typeof renderDefaultLayout;
|
|
302
|
+
compact: typeof renderCompactLayout;
|
|
303
|
+
"shadcn-magic": typeof renderShadcnMagicLayout;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
declare const BuiltinThemes: {
|
|
307
|
+
default: {
|
|
308
|
+
bg: string;
|
|
309
|
+
rail: string;
|
|
310
|
+
contentBg: string;
|
|
311
|
+
panel: string;
|
|
312
|
+
panel2: string;
|
|
313
|
+
text: string;
|
|
314
|
+
muted: string;
|
|
315
|
+
primary: string;
|
|
316
|
+
success: string;
|
|
317
|
+
warning: string;
|
|
318
|
+
danger: string;
|
|
319
|
+
border: string;
|
|
320
|
+
};
|
|
321
|
+
compact: {
|
|
322
|
+
bg: string;
|
|
323
|
+
rail: string;
|
|
324
|
+
contentBg: string;
|
|
325
|
+
panel: string;
|
|
326
|
+
panel2: string;
|
|
327
|
+
text: string;
|
|
328
|
+
muted: string;
|
|
329
|
+
primary: string;
|
|
330
|
+
success: string;
|
|
331
|
+
warning: string;
|
|
332
|
+
danger: string;
|
|
333
|
+
info: string;
|
|
334
|
+
border: string;
|
|
335
|
+
};
|
|
336
|
+
"shadcn-magic": {
|
|
337
|
+
bg: string;
|
|
338
|
+
surface: string;
|
|
339
|
+
card: string;
|
|
340
|
+
card2: string;
|
|
341
|
+
text: string;
|
|
342
|
+
muted: string;
|
|
343
|
+
primary: string;
|
|
344
|
+
accent: string;
|
|
345
|
+
border: string;
|
|
346
|
+
radiusLg: string;
|
|
347
|
+
radiusMd: string;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
type BuiltinLayoutNames = keyof typeof BuiltinLayouts;
|
|
352
|
+
type BuiltinThemeNames = keyof typeof BuiltinThemes;
|
|
203
353
|
interface DashboardOptions {
|
|
204
|
-
app?: Express;
|
|
354
|
+
app?: Express | Elysia | FastifyInstance;
|
|
205
355
|
port?: number;
|
|
206
356
|
host?: string;
|
|
207
357
|
trustProxy?: boolean | number;
|
|
208
358
|
basePath?: string;
|
|
209
359
|
dashboardName?: string;
|
|
210
|
-
setupDesign?: DashboardDesignConfig;
|
|
211
|
-
uiTemplate?: string;
|
|
212
|
-
uiTemplates?: Record<string, DashboardTemplateRenderer>;
|
|
213
360
|
botToken: string;
|
|
361
|
+
client: Client;
|
|
214
362
|
clientId: string;
|
|
215
363
|
clientSecret: string;
|
|
216
364
|
redirectUri: string;
|
|
@@ -225,93 +373,183 @@ interface DashboardOptions {
|
|
|
225
373
|
getOverviewCards?: (context: DashboardContext) => Promise<DashboardCard[]> | DashboardCard[];
|
|
226
374
|
home?: DashboardHomeBuilder;
|
|
227
375
|
plugins?: DashboardPlugin[];
|
|
376
|
+
uiTemplate?: BuiltinLayoutNames | DashboardTemplateRenderer;
|
|
377
|
+
uiTheme?: BuiltinThemeNames | DashboardDesignConfig;
|
|
378
|
+
setupDesign?: DashboardDesignConfig;
|
|
379
|
+
uiTemplates?: Record<string, DashboardTemplateRenderer>;
|
|
380
|
+
dashboardData?: DashboardData;
|
|
228
381
|
}
|
|
229
382
|
interface DashboardInstance {
|
|
230
|
-
app: Express;
|
|
383
|
+
app: Express | Elysia | FastifyInstance;
|
|
231
384
|
start: () => Promise<void>;
|
|
232
385
|
stop: () => Promise<void>;
|
|
233
386
|
}
|
|
234
387
|
|
|
235
|
-
declare
|
|
388
|
+
declare const SessionSchema: _sinclair_typebox.TObject<{
|
|
389
|
+
oauthState: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
390
|
+
discordAuth: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
|
|
391
|
+
accessToken: _sinclair_typebox.TString;
|
|
392
|
+
user: _sinclair_typebox.TObject<{
|
|
393
|
+
id: _sinclair_typebox.TString;
|
|
394
|
+
username: _sinclair_typebox.TString;
|
|
395
|
+
discriminator: _sinclair_typebox.TString;
|
|
396
|
+
avatar: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNull]>;
|
|
397
|
+
global_name: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNull]>>;
|
|
398
|
+
}>;
|
|
399
|
+
guilds: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
400
|
+
id: _sinclair_typebox.TString;
|
|
401
|
+
name: _sinclair_typebox.TString;
|
|
402
|
+
icon: _sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNull]>;
|
|
403
|
+
owner: _sinclair_typebox.TBoolean;
|
|
404
|
+
permissions: _sinclair_typebox.TString;
|
|
405
|
+
iconUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNull]>>;
|
|
406
|
+
botInGuild: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>>;
|
|
407
|
+
inviteUrl: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TString, _sinclair_typebox.TNull]>>;
|
|
408
|
+
}>>;
|
|
409
|
+
}>>;
|
|
410
|
+
}>;
|
|
411
|
+
type SessionData = Static<typeof SessionSchema>;
|
|
412
|
+
|
|
413
|
+
declare class DiscordHelpers implements DashboardDiscordHelpers {
|
|
414
|
+
private readonly botToken;
|
|
415
|
+
private readonly DISCORD_API;
|
|
416
|
+
constructor(botToken: string);
|
|
417
|
+
private fetchDiscordWithBot;
|
|
418
|
+
getChannel(channelId: string): Promise<DiscordChannel | null>;
|
|
419
|
+
getGuildChannels(guildId: string): Promise<DiscordChannel[]>;
|
|
420
|
+
searchGuildChannels(guildId: string, query: string, options?: {
|
|
421
|
+
limit?: number;
|
|
422
|
+
nsfw?: boolean;
|
|
423
|
+
channelTypes?: number[];
|
|
424
|
+
}): Promise<DiscordChannel[]>;
|
|
425
|
+
getRole(guildId: string, roleId: string): Promise<DiscordRole | null>;
|
|
426
|
+
getGuildRoles(guildId: string): Promise<DiscordRole[]>;
|
|
427
|
+
searchGuildRoles(guildId: string, query: string, options?: {
|
|
428
|
+
limit?: number;
|
|
429
|
+
includeManaged?: boolean;
|
|
430
|
+
}): Promise<DiscordRole[]>;
|
|
431
|
+
searchGuildMembers(guildId: string, query: string, options?: {
|
|
432
|
+
limit?: number;
|
|
433
|
+
}): Promise<DiscordMember[]>;
|
|
434
|
+
getGuildMember(guildId: string, userId: string): Promise<DiscordMember | null>;
|
|
435
|
+
getGuildIconUrl(guildId: string, iconHash: string | null): string | null;
|
|
436
|
+
getUserAvatarUrl(userId: string, avatarHash: string | null): string | null;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare class DashboardEngine {
|
|
440
|
+
options: DashboardOptions;
|
|
441
|
+
helpers: DiscordHelpers;
|
|
442
|
+
private templateManager;
|
|
443
|
+
private DISCORD_API;
|
|
444
|
+
constructor(options: DashboardOptions);
|
|
445
|
+
getAuthUrl(state: string): string;
|
|
446
|
+
exchangeCode(code: string): Promise<{
|
|
447
|
+
access_token: string;
|
|
448
|
+
refresh_token?: string;
|
|
449
|
+
expires_in?: number;
|
|
450
|
+
}>;
|
|
451
|
+
fetchUser(token: string): Promise<DashboardUser>;
|
|
452
|
+
fetchGuilds(token: string): Promise<DashboardGuild[]>;
|
|
453
|
+
render(basePath: string): string;
|
|
454
|
+
}
|
|
236
455
|
|
|
237
|
-
type HomeActionHandler = (context: DashboardContext, payload: HomeActionPayload) => Promise<PluginActionResult> | PluginActionResult;
|
|
238
|
-
type HomeLoadHandler = (context: DashboardContext, section: HomeSection) => Promise<Partial<HomeSection> | HomeSection | void> | Partial<HomeSection> | HomeSection | void;
|
|
239
456
|
declare class CategoryBuilder {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
457
|
+
data: DashboardCategory;
|
|
458
|
+
constructor(id: string, label: string);
|
|
459
|
+
setDescription(description: string): this;
|
|
460
|
+
}
|
|
461
|
+
declare class SectionBuilder {
|
|
462
|
+
id: string;
|
|
463
|
+
categoryId: string;
|
|
464
|
+
title: string;
|
|
465
|
+
data: any;
|
|
466
|
+
constructor(id: string, categoryId: string, title: string);
|
|
467
|
+
setDescription(description: string): this;
|
|
468
|
+
setWidth(width: 20 | 33 | 50 | 100): this;
|
|
469
|
+
addField(field: DashboardField): this;
|
|
470
|
+
addAction(id: string, label: string, options?: {
|
|
471
|
+
variant?: "primary" | "danger" | "default";
|
|
472
|
+
collectFields?: boolean;
|
|
473
|
+
}, handler?: DashboardAction["handler"]): this;
|
|
474
|
+
}
|
|
475
|
+
declare class PanelBuilder {
|
|
476
|
+
id: string;
|
|
477
|
+
title: string;
|
|
478
|
+
data: any;
|
|
479
|
+
constructor(id: string, title: string);
|
|
480
|
+
setDescription(description: string): this;
|
|
481
|
+
addField(field: DashboardField): this;
|
|
482
|
+
addAction(id: string, label: string, options?: {
|
|
483
|
+
variant?: "primary" | "danger" | "default";
|
|
484
|
+
collectFields?: boolean;
|
|
485
|
+
}, handler?: DashboardAction["handler"]): this;
|
|
486
|
+
}
|
|
487
|
+
declare class PluginBuilder {
|
|
488
|
+
id: string;
|
|
489
|
+
name: string;
|
|
490
|
+
data: any;
|
|
491
|
+
constructor(id: string, name: string);
|
|
492
|
+
setDescription(description: string): this;
|
|
493
|
+
addPanel(panel: PanelBuilder): this;
|
|
255
494
|
}
|
|
256
495
|
declare class DashboardDesigner {
|
|
257
|
-
private
|
|
258
|
-
private
|
|
259
|
-
private
|
|
260
|
-
private
|
|
261
|
-
private
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
panel2?: string;
|
|
280
|
-
text?: string;
|
|
281
|
-
muted?: string;
|
|
282
|
-
primary?: string;
|
|
283
|
-
success?: string;
|
|
284
|
-
warning?: string;
|
|
285
|
-
danger?: string;
|
|
286
|
-
info?: string;
|
|
287
|
-
border?: string;
|
|
288
|
-
}): this;
|
|
289
|
-
userCategory(categoryId: string, categoryLabel: string, build: (builder: CategoryBuilder) => void): this;
|
|
290
|
-
guildCategory(categoryId: string, categoryLabel: string, build: (builder: CategoryBuilder) => void): this;
|
|
291
|
-
setupCategory(categoryId: string, categoryLabel: string, build: (builder: CategoryBuilder) => void): this;
|
|
292
|
-
setupPage(input: {
|
|
293
|
-
id: string;
|
|
294
|
-
title: string;
|
|
295
|
-
label?: string;
|
|
296
|
-
scope?: DashboardScope;
|
|
297
|
-
categoryId?: string;
|
|
298
|
-
description?: string;
|
|
299
|
-
width?: 100 | 50 | 33 | 20;
|
|
300
|
-
fields?: HomeSectionField[];
|
|
301
|
-
actions?: HomeSectionAction[];
|
|
302
|
-
}): this;
|
|
303
|
-
onHomeAction(actionId: string, handler: HomeActionHandler): this;
|
|
304
|
-
onLoad(pageId: string, handler: HomeLoadHandler): this;
|
|
305
|
-
onload(pageId: string, handler: HomeLoadHandler): this;
|
|
306
|
-
onSave(pageId: string, handler: HomeActionHandler): this;
|
|
307
|
-
onsave(pageId: string, handler: HomeActionHandler): this;
|
|
308
|
-
build(): DashboardOptions;
|
|
309
|
-
}
|
|
310
|
-
declare function createDashboardDesigner(baseOptions: Omit<DashboardOptions, "home">): DashboardDesigner;
|
|
496
|
+
private config;
|
|
497
|
+
private categories;
|
|
498
|
+
private sections;
|
|
499
|
+
private plugins;
|
|
500
|
+
private overviewCards;
|
|
501
|
+
constructor(dashboardName?: string);
|
|
502
|
+
setLayout(template: DashboardOptions["uiTemplate"]): this;
|
|
503
|
+
setTheme(theme: DashboardOptions["uiTheme"]): this;
|
|
504
|
+
setColors(colors: DashboardDesignConfig): this;
|
|
505
|
+
setCustomCss(css: string): this;
|
|
506
|
+
registerCustomLayout(name: string, renderer: DashboardTemplateRenderer): this;
|
|
507
|
+
addOverviewCard(title: string, value: string, subtitle?: string): this;
|
|
508
|
+
addCategory(category: CategoryBuilder): this;
|
|
509
|
+
addSection(section: SectionBuilder): this;
|
|
510
|
+
addPlugin(plugin: PluginBuilder): this;
|
|
511
|
+
build(): Partial<DashboardOptions>;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
declare function createExpressAdapter(options: DashboardOptions): {
|
|
515
|
+
app: express.Express;
|
|
516
|
+
engine: DashboardEngine;
|
|
517
|
+
};
|
|
311
518
|
|
|
312
|
-
declare function
|
|
519
|
+
declare function createElysiaAdapter(options: DashboardOptions): {
|
|
520
|
+
app: Elysia<"", {
|
|
521
|
+
decorator: {};
|
|
522
|
+
store: {};
|
|
523
|
+
derive: {};
|
|
524
|
+
resolve: {};
|
|
525
|
+
}, {
|
|
526
|
+
typebox: {};
|
|
527
|
+
error: {};
|
|
528
|
+
}, {
|
|
529
|
+
schema: {};
|
|
530
|
+
standaloneSchema: {};
|
|
531
|
+
macro: {};
|
|
532
|
+
macroFn: {};
|
|
533
|
+
parser: {};
|
|
534
|
+
response: {};
|
|
535
|
+
}, {}, {
|
|
536
|
+
derive: {};
|
|
537
|
+
resolve: {};
|
|
538
|
+
schema: {};
|
|
539
|
+
standaloneSchema: {};
|
|
540
|
+
response: {};
|
|
541
|
+
}, {
|
|
542
|
+
derive: {};
|
|
543
|
+
resolve: {};
|
|
544
|
+
schema: {};
|
|
545
|
+
standaloneSchema: {};
|
|
546
|
+
response: {};
|
|
547
|
+
}>;
|
|
548
|
+
engine: DashboardEngine;
|
|
549
|
+
};
|
|
313
550
|
|
|
314
|
-
declare
|
|
315
|
-
|
|
551
|
+
declare function createFastifyAdapter(fastify: FastifyInstance, options: DashboardOptions): {
|
|
552
|
+
engine: DashboardEngine;
|
|
553
|
+
};
|
|
316
554
|
|
|
317
|
-
export { type CardIntent, type DashboardBoxWidth, type DashboardCard, type DashboardContext, type DashboardDesignConfig, DashboardDesigner, type DashboardDiscordHelpers, type DashboardGuild, type DashboardHomeBuilder, type DashboardInstance, type DashboardOptions, type DashboardPlugin, type DashboardScope, type DashboardTemplateRenderContext, type DashboardTemplateRenderer, type DashboardUser, type DiscordChannel, type DiscordMember, type DiscordRole, type HomeActionPayload, type HomeCategory, type HomeFieldOption, type HomeFieldType, type HomeLookupConfig, type HomeSection, type HomeSectionAction, type HomeSectionField, type PluginActionResult, type PluginPanel, type PluginPanelAction, type PluginPanelField,
|
|
555
|
+
export { type CardIntent, type DashboardAction, type DashboardBoxWidth, type DashboardCard, type DashboardCategory, type DashboardContext, type DashboardData, type DashboardDesignConfig, DashboardDesigner, type DashboardDiscordHelpers, DashboardEngine, type DashboardField, type DashboardGuild, type DashboardHomeBuilder, type DashboardInstance, type DashboardOptions, type DashboardOverviewCard, type DashboardPanel, type DashboardPlugin, type DashboardPluginData, type DashboardScope, type DashboardSection, type DashboardTemplateRenderContext, type DashboardTemplateRenderer, type DashboardUser, type DiscordChannel, type DiscordMember, type DiscordRole, type HomeActionPayload, type HomeCategory, type HomeFieldOption, type HomeFieldType, type HomeLookupConfig, type HomeSection, type HomeSectionAction, type HomeSectionField, type PluginActionResult, type PluginPanel, type PluginPanelAction, type PluginPanelField, type SessionData, SessionSchema, createElysiaAdapter, createExpressAdapter, createFastifyAdapter };
|