your personal website on atproto - mirror
blento.app
1import type { Component } from 'svelte';
2import type { Item, UserCache } from '$lib/types';
3import type { Did } from '@atcute/lexicons';
4
5export type CreationModalComponentProps = {
6 item: Item;
7 oncreate: () => void;
8 oncancel: () => void;
9};
10
11export type SettingsComponentProps = {
12 item: Item;
13 onclose: () => void;
14};
15
16export type SidebarComponentProps = {
17 onclick: () => void;
18};
19
20export type ContentComponentProps = {
21 item: Item;
22 isEditing?: boolean;
23};
24
25export type CardDefinition = {
26 type: string; // should be unique
27 contentComponent: Component<ContentComponentProps>; // content of card
28 editingContentComponent?: Component<ContentComponentProps>; // optional content of card in editing mode
29
30 createNew?: (item: Item) => void; // set some custom cardData stuff here (or custom default sizes)
31
32 creationModalComponent?: Component<CreationModalComponentProps>;
33
34 upload?: (item: Item) => Promise<Item>; // optionally upload some other data needed for this card
35
36 // has to be set for a card to appear in the sidebar
37 sidebarButtonText?: string;
38
39 // if this component exists, a settings button with a popover will be shown containing this component
40 settingsComponent?: Component<SettingsComponentProps>;
41
42 // optionally load some extra data
43 loadData?: (
44 // all cards of that type
45 items: Item[],
46 { did, handle, cache }: { did: Did; handle: string; cache?: UserCache }
47 ) => Promise<unknown>;
48
49 // show color selection popup
50 allowSetColor?: boolean;
51
52 // default card background color one of 'base', 'accent', 'transparent', or one of the tailwind colors
53 // (actual colors only, without 'gray', 'neutral', 'stone', etc)
54 defaultColor?: string;
55
56 // for resizing:
57 minW?: number;
58 maxW?: number;
59
60 minH?: number;
61 maxH?: number;
62
63 canResize?: boolean;
64
65 onUrlHandler?: (url: string, item: Item) => Item | null;
66 urlHandlerPriority?: number;
67
68 canChange?: (item: Item) => boolean;
69 change?: (item: Item) => Item;
70
71 name?: string;
72
73 canHaveLabel?: boolean;
74
75 migrate?: (item: Item) => void;
76
77 groups?: string[];
78
79 keywords?: string[];
80
81 icon?: string;
82};