your personal website on atproto - mirror blento.app
at hide-friends 75 lines 1.9 kB view raw
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 ContentComponentProps = { 17 item: Item; 18 isEditing?: boolean; 19}; 20 21export type CardDefinition = { 22 type: string; // should be unique 23 contentComponent: Component<ContentComponentProps>; // content of card 24 editingContentComponent?: Component<ContentComponentProps>; // optional content of card in editing mode 25 26 createNew?: (item: Item) => void; // set some custom cardData stuff here (or custom default sizes) 27 28 creationModalComponent?: Component<CreationModalComponentProps>; 29 30 upload?: (item: Item) => Promise<Item>; // optionally upload some other data needed for this card 31 32 // if this component exists, a settings button with a popover will be shown containing this component 33 settingsComponent?: Component<SettingsComponentProps>; 34 35 // optionally load some extra data 36 loadData?: ( 37 // all cards of that type 38 items: Item[], 39 { did, handle, cache }: { did: Did; handle: string; cache?: UserCache } 40 ) => Promise<unknown>; 41 42 // show color selection popup 43 allowSetColor?: boolean; 44 45 // default card background color one of 'base', 'accent', 'transparent', or one of the tailwind colors 46 // (actual colors only, without 'gray', 'neutral', 'stone', etc) 47 defaultColor?: string; 48 49 // for resizing: 50 minW?: number; 51 maxW?: number; 52 53 minH?: number; 54 maxH?: number; 55 56 canResize?: boolean; 57 58 onUrlHandler?: (url: string, item: Item) => Item | null; 59 urlHandlerPriority?: number; 60 61 canChange?: (item: Item) => boolean; 62 change?: (item: Item) => Item; 63 64 name?: string; 65 66 canHaveLabel?: boolean; 67 68 migrate?: (item: Item) => void; 69 70 groups?: string[]; 71 72 keywords?: string[]; 73 74 icon?: string; 75};