forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttons.d.ts
More file actions
251 lines (250 loc) · 9.93 KB
/
Copy pathbuttons.d.ts
File metadata and controls
251 lines (250 loc) · 9.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
import { IndexedFormula, NamedNode } from 'rdflib';
export type StatusAreaContext = {
statusArea?: HTMLElement;
div?: HTMLElement;
dom?: HTMLDocument;
};
export type ButtonType = 'Primary' | 'Secondary';
export type ButtonWidgetOptions = {
buttonColor?: ButtonType;
needsBorder?: boolean;
};
export type RenderAsDivOptions = {
image?: HTMLImageElement;
title?: string;
deleteFunction?: () => void;
link?: boolean;
noun?: string;
draggable?: boolean;
clickable?: boolean;
onClickFunction?: () => void;
wrapInATR?: boolean;
};
/**
* Display an error message block
*/
export declare function complain(context?: StatusAreaContext, err?: string): void;
/**
* Remove all the children of an HTML element
*/
export declare function clearElement(ele: HTMLElement): HTMLElement;
/**
* To figure out the log URI from the full URI used to invoke the reasoner
*/
export declare function extractLogURI(fullURI: any): any;
/**
* By default, converts e.g. '2020-02-19T19:35:28.557Z' to '19:35'
* if today is 19 Feb 2020, and to 'Feb 19' if not.
* @@@ TODO This needs to be changed to local time
* @param noTime Return a string like 'Feb 19' even if it's today.
*/
export declare function shortDate(str?: string, noTime?: boolean): string;
/**
* Format a date and time
* @param date for instance `new Date()`
* @param format for instance '{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}'
* @returns for instance '2000-01-15T23:14:23.002'
*/
export declare function formatDateTime(date: Date, format: string): string;
/**
* Get a string representation of the current time
* @returns for instance '2000-01-15T23:14:23.002'
*/
export declare function timestamp(): string;
/**
* Get a short string representation of the current time
* @returns for instance '23:14:23.002'
*/
export declare function shortTime(): string;
/**
* Sets the best name we have and looks up a better one
*/
export declare function setName(element: HTMLElement, x: NamedNode): void;
/**
* Set of suitable images
* See also [[findImage]]
* @param x The thing for which we want to find an image
* @param kb The RDF store to look in
* @returns It goes looking for triples in `kb`,
* `(subject: x), (predicate: see list below) (object: image-url)`
* to find any image linked from the thing with one of the following
* predicates (in order):
* * ns.sioc('avatar')
* * ns.foaf('img')
* * ns.vcard('logo')
* * ns.vcard('hasPhoto')
* * ns.vcard('photo')
* * ns.foaf('depiction')
*/
export declare function imagesOf(x: NamedNode | null, kb: IndexedFormula): any[];
/**
* Best logo or avatar or photo etc to represent someone or some group etc
*/
export declare const iconForClass: {
'solid:AppProviderClass': string;
'solid:AppProvider': string;
'solid:Pod': string;
'vcard:Group': string;
'vcard:Organization': string;
'vcard:Individual': string;
'schema:Person': string;
'foaf:Person': string;
'foaf:Agent': string;
'acl:AuthenticatedAgent': string;
'prov:SoftwareAgent': string;
'vcard:AddressBook': string;
'trip:Trip': string;
'meeting:LongChat': string;
'meeting:Meeting': string;
'meeting:Project': string;
'ui:Form': string;
'rdfs:Class': string;
'rdf:Property': string;
'owl:Ontology': string;
'wf:Tracker': string;
'wf:Task': string;
'wf:Open': string;
'wf:Closed': string;
};
/**
* Find an image for this thing as a class
*/
export declare function findImageFromURI(x: NamedNode | string): string | null;
/**
* Find something we have as explicit image data for the thing
* See also [[imagesOf]]
* @param thing The thing for which we want to find an image
* @returns The URL of a globe icon if thing equals `ns.foaf('Agent')`
* or `ns.rdf('Resource')`. Otherwise, it goes looking for
* triples in `store`,
* `(subject: thing), (predicate: see list below) (object: image-url)`
* to find any image linked from the thing with one of the following
* predicates (in order):
* * ns.sioc('avatar')
* * ns.foaf('img')
* * ns.vcard('logo')
* * ns.vcard('hasPhoto')
* * ns.vcard('photo')
* * ns.foaf('depiction')
*/
export declare function findImage(thing: NamedNode): string;
/**
* ToDo: Also add icons for *properties* like home, work, email, range, domain, comment,
*/
export declare function setImage(element: HTMLElement, thing: NamedNode): void;
export declare function faviconOrDefault(dom: HTMLDocument, x: NamedNode): HTMLObjectElement | HTMLImageElement;
/**
* Delete button with a check you really mean it
* @@ Supress check if command key held down?
*/
export declare function deleteButtonWithCheck(dom: HTMLDocument, container: HTMLElement, noun: string, deleteFunction: () => any): HTMLImageElement;
export declare function button(dom: HTMLDocument, iconURI: string | undefined, text: string, handler?: (_event: any) => void, options?: ButtonWidgetOptions): HTMLButtonElement;
export declare function cancelButton(dom: HTMLDocument, handler: (_event?: any) => void): HTMLButtonElement;
export declare function continueButton(dom: HTMLDocument, handler: (_event: any) => void): HTMLButtonElement;
export declare function askName(dom: HTMLDocument, kb: IndexedFormula, container: HTMLDivElement, predicate?: NamedNode, theClass?: NamedNode, noun?: string): Promise<unknown>;
/**
* A TR to represent a draggable person, etc in a list
*
* pred is unused param at the moment
*/
export declare const personTR: typeof renderAsRow;
export declare function renderAsRow(dom: HTMLDocument, pred: NamedNode, obj: NamedNode, options: any): HTMLTableRowElement;
export declare function createNameDiv(dom: HTMLDocument, div: HTMLDivElement, title: string | undefined, obj: NamedNode): void;
export declare function createLinkDiv(dom: HTMLDocument, div: HTMLDivElement, obj: NamedNode, options: RenderAsDivOptions): void;
/**
* A Div to represent a draggable person, etc in a list
* configurable to add an onClick listener
*/
export declare function renderAsDiv(dom: HTMLDocument, obj: NamedNode, options: RenderAsDivOptions): HTMLElement;
/**
* Refresh a DOM tree recursively
*/
export declare function refreshTree(root: any): void;
/**
* Options argument for [[attachmentList]] function
*/
export type attachmentListOptions = {
doc?: NamedNode;
modify?: boolean;
promptIcon?: string;
predicate?: NamedNode;
uploadFolder?: NamedNode;
noun?: string;
};
/**
* Component that displays a list of resources, for instance
* the attachments of a message, or the various documents related
* to a meeting.
* Accepts dropping URLs onto it to add attachments to it.
*/
export declare function attachmentList(dom: HTMLDocument, subject: NamedNode, div: HTMLElement, options?: attachmentListOptions): HTMLTableElement;
/**
* Event Handler for links within solid apps.
*
* Note that native links have constraints in Firefox, they
* don't work with local files for instance (2011)
*/
export declare function openHrefInOutlineMode(e: Event): void;
/**
* Make a URI in the Tabulator.org annotation store out of the URI of the thing to be annotated.
*
* @@ Todo: make it a personal preference.
*/
export declare function defaultAnnotationStore(subject: NamedNode): NamedNode | undefined;
/**
* Retrieve all RDF class URIs from solid-ui's RDF store
* @returns an object `ret` such that `Object.keys(ret)` is
* the list of all class URIs.
*/
export declare function allClassURIs(): {
[uri: string]: boolean;
};
/**
* Figuring which properties we know about
*
* When the user inputs an RDF property, like for a form field
* or when specifying the relationship between two arbitrary things,
* then er can prompt them with properties the session knows about
*
* TODO: Look again by catching this somewhere. (On the kb?)
* TODO: move to diff module? Not really a button.
* @param {Store} kb The quadstore to be searched.
*/
export declare function propertyTriage(kb: IndexedFormula): any;
/**
* General purpose widgets
*/
/**
* A button for jumping
*/
export declare function linkButton(dom: HTMLDocument, object: NamedNode): HTMLElement;
/**
* A button to remove some other element from the page
*/
export declare function removeButton(dom: HTMLDocument, element: HTMLElement): HTMLButtonElement;
export declare function selectorPanel(dom: HTMLDocument, kb: IndexedFormula, type: NamedNode, predicate: NamedNode, inverse: boolean, possible: NamedNode[], options: {
connectIcon?: string;
}, callbackFunction: (_x: NamedNode, _e: Event, _selected: boolean) => void, linkCallback: (_x: NamedNode, _e: Event, _inverse: boolean, _setStyleFunction: () => void) => void): HTMLElement;
export declare function selectorPanelRefresh(list: HTMLElement, dom: HTMLDocument, kb: IndexedFormula, type: NamedNode, predicate: NamedNode, inverse: boolean, possible: NamedNode[], options: {
connectIcon?: string;
}, callbackFunction: (_x: NamedNode, _e: Event, _selected: boolean) => void, linkCallback: (_x: NamedNode, _e: Event, _inverse: boolean, _setStyleFunction: () => void) => void): HTMLElement;
export declare let index: any;
/**
* Stick a stylesheet link the document if not already there
*/
export declare function addStyleSheet(dom: HTMLDocument, href: string): void;
export declare function isAudio(file?: NamedNode): boolean;
export declare function isVideo(file?: NamedNode): boolean;
/**
*
*/
export declare function isImage(file?: NamedNode, kind?: string): boolean;
/**
* File upload button
* @param dom The DOM aka document
* @param droppedFileHandler Same handler function as drop, takes array of file objects
* @returns {Element} - a div with a button and a inout in it
* The input is hidden, as it is uglky - the user clicks on the nice icons and fires the input.
*/
export declare function fileUploadButtonDiv(dom: HTMLDocument, droppedFileHandler: (_files: FileList) => void): HTMLDivElement;
//# sourceMappingURL=buttons.d.ts.map