athena-ui-js 2.3.0 → 2.4.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.
@@ -0,0 +1,58 @@
1
+ /** Registers a language (and its aliases). */
2
+ export function registerLanguage(language: any): void;
3
+ /**
4
+ * Splits text into tokens: [{ type, text }]. `type` is null for plain text. Concatenating the texts gives the input back.
5
+ * An unknown language, or a text that is too long, gives one plain token.
6
+ */
7
+ export function tokenize(text: any, language: any): any[];
8
+ export function getLanguage(name: any): any;
9
+ export function getLanguages(): any[];
10
+ /** The token types the default theme gives a colour to: the classes are `tok-<type>`. */
11
+ export const TOKEN_TYPES: string[];
12
+ /**
13
+ * A language: an ordered list of rules. The text is scanned once; at every position the first rule that matches wins.
14
+ */
15
+ export type CodeLanguage = {
16
+ name: string;
17
+ /**
18
+ * shown in the label of a code block (default: the name)
19
+ */
20
+ label?: string;
21
+ /**
22
+ * other names ("js" for "javascript")
23
+ */
24
+ aliases?: string[];
25
+ /**
26
+ * `type` becomes the class `tok-<type>`;
27
+ * the pattern must use non-capturing groups only; `inner` splits a match into smaller tokens (a tag into name and attributes)
28
+ */
29
+ rules: {
30
+ type: string;
31
+ pattern: RegExp;
32
+ inner?: (text: string) => {
33
+ type: string | null;
34
+ text: string;
35
+ }[];
36
+ }[];
37
+ /**
38
+ * the rules are case-insensitive (SQL)
39
+ */
40
+ ignoreCase?: boolean;
41
+ /**
42
+ * ^ and $ match at every line (YAML, C# preprocessor lines)
43
+ */
44
+ multiline?: boolean;
45
+ /**
46
+ * used by the editor to comment lines ("//")
47
+ */
48
+ lineComment?: string;
49
+ blockComment?: [string, string];
50
+ /**
51
+ * characters the editor closes: ["()", "[]", "{}", "\"\"", "''"]
52
+ */
53
+ pairs?: string[];
54
+ /**
55
+ * a line that matches this makes the next line one level deeper (/[{(\[:]\s*$/)
56
+ */
57
+ indentAfter?: RegExp;
58
+ };
@@ -1,45 +1,45 @@
1
- /** Puts an item inside the columns and inside its size limits ({ min: {w, h}, max: {w, h} }). */
2
- export function clampItem(item: any, columns: any, { min, max }?: {
3
- min?: {};
4
- max?: {};
5
- }): any;
6
- /**
7
- * Gravity: every item that is not locked moves up as far as it can (locked items stay where they are).
8
- * @returns {object[]} new items, in the order of the argument
9
- */
10
- export function compact(items: any): object[];
11
- /**
12
- * Sets the place of one item (clamped), pushes the others out of its way and, unless `compactItems` is false, lets everything fall upwards.
13
- * @param {object[]} items
14
- * @param {string} id
15
- * @param {{x?: number, y?: number, w?: number, h?: number}} place the new place; missing values stay as they are
16
- * @param {number} columns
17
- * @param {object} [options]
18
- * @param {{min?: object, max?: object}} [options.limits] size limits of this item
19
- * @param {boolean} [options.compactItems=true]
20
- * @returns {object[]|null} the new layout, or null when it is not possible (a locked item is in the way, or the item is locked)
21
- */
22
- export function placeItem(items: object[], id: string, place: {
23
- x?: number;
24
- y?: number;
25
- w?: number;
26
- h?: number;
27
- }, columns: number, { limits, compactItems }?: {
28
- limits?: {
29
- min?: object;
30
- max?: object;
31
- };
32
- compactItems?: boolean;
33
- }): object[] | null;
34
- /** The first free place of the size w x h (rows grow without end). */
35
- export function findFreeSpot(items: any, w: any, h: any, columns: any): {
36
- x: number;
37
- y: number;
38
- };
39
- /**
40
- * Makes any list of items a valid layout for `columns`: inside the columns, without overlaps, compact. Items keep their order of reading
41
- * (top to bottom, left to right). Used for loaded layouts and for a breakpoint that has no layout of its own.
42
- */
43
- export function normalize(items: any, columns: any, limitsOf?: () => {}): any[];
44
- export function collides(a: any, b: any): boolean;
45
- export function rowsOf(items: any): any;
1
+ /** Puts an item inside the columns and inside its size limits ({ min: {w, h}, max: {w, h} }). */
2
+ export function clampItem(item: any, columns: any, { min, max }?: {
3
+ min?: {};
4
+ max?: {};
5
+ }): any;
6
+ /**
7
+ * Gravity: every item that is not locked moves up as far as it can (locked items stay where they are).
8
+ * @returns {object[]} new items, in the order of the argument
9
+ */
10
+ export function compact(items: any): object[];
11
+ /**
12
+ * Sets the place of one item (clamped), pushes the others out of its way and, unless `compactItems` is false, lets everything fall upwards.
13
+ * @param {object[]} items
14
+ * @param {string} id
15
+ * @param {{x?: number, y?: number, w?: number, h?: number}} place the new place; missing values stay as they are
16
+ * @param {number} columns
17
+ * @param {object} [options]
18
+ * @param {{min?: object, max?: object}} [options.limits] size limits of this item
19
+ * @param {boolean} [options.compactItems=true]
20
+ * @returns {object[]|null} the new layout, or null when it is not possible (a locked item is in the way, or the item is locked)
21
+ */
22
+ export function placeItem(items: object[], id: string, place: {
23
+ x?: number;
24
+ y?: number;
25
+ w?: number;
26
+ h?: number;
27
+ }, columns: number, { limits, compactItems }?: {
28
+ limits?: {
29
+ min?: object;
30
+ max?: object;
31
+ };
32
+ compactItems?: boolean;
33
+ }): object[] | null;
34
+ /** The first free place of the size w x h (rows grow without end). */
35
+ export function findFreeSpot(items: any, w: any, h: any, columns: any): {
36
+ x: number;
37
+ y: number;
38
+ };
39
+ /**
40
+ * Makes any list of items a valid layout for `columns`: inside the columns, without overlaps, compact. Items keep their order of reading
41
+ * (top to bottom, left to right). Used for loaded layouts and for a breakpoint that has no layout of its own.
42
+ */
43
+ export function normalize(items: any, columns: any, limitsOf?: () => {}): any[];
44
+ export function collides(a: any, b: any): boolean;
45
+ export function rowsOf(items: any): any;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * A code editor.
3
+ *
4
+ * @param {object} options
5
+ * @param {string|HTMLElement} options.element the container
6
+ * @param {string} [options.value]
7
+ * @param {string|object} [options.language] "js", "json", ... or a language object (see registerLanguage)
8
+ * @param {boolean} [options.readOnly=false]
9
+ * @param {boolean} [options.lineNumbers=true]
10
+ * @param {boolean} [options.wrap=false] soft wrap
11
+ * @param {number} [options.tabSize=4]
12
+ * @param {boolean} [options.insertSpaces=true] Tab inserts spaces (false: a tab character)
13
+ * @param {boolean} [options.statusBar=true] line and column, and the message of a marker
14
+ * @param {string} [options.label] accessible name of the editor
15
+ * @param {number} [options.maxHighlightLength=300000] longer texts are shown without highlighting (and without line numbers) to stay fast
16
+ * @param {{line: number, message: string, level?: "error"|"warning"|"info"}[]} [options.markers] lint markers (lines count from 1)
17
+ * @param {{from: number, to: number}[]} [options.readOnlyRanges] lines (1-based, inclusive) that cannot be changed
18
+ * @param {(context: {value: string, position: number, line: number, lineText: string, prefix: string, explicit: boolean, language: string}) => (Array<{label: string, insert?: string, detail?: string}>|Promise<Array>)} [options.provideCompletions]
19
+ * @param {boolean} [options.autoComplete=true] with provideCompletions: suggest while typing (otherwise only with Ctrl+Space)
20
+ * @param {(value: string, reason: string) => void} [options.onChange] after every change made by typing, undo, redo, replace ... (not after setValue)
21
+ * @returns the handle: { element, textarea, getValue, setValue, focus, getSelection, setSelection, insertText, setLanguage, setReadOnly, setWrap, setMarkers,
22
+ * setReadOnlyRanges, undo, redo, canUndo, canRedo, openFind, closeFind, toggleComment, destroy }
23
+ */
24
+ export function createCodeEditor(options?: {
25
+ element: string | HTMLElement;
26
+ value?: string;
27
+ language?: string | object;
28
+ readOnly?: boolean;
29
+ lineNumbers?: boolean;
30
+ wrap?: boolean;
31
+ tabSize?: number;
32
+ insertSpaces?: boolean;
33
+ statusBar?: boolean;
34
+ label?: string;
35
+ maxHighlightLength?: number;
36
+ markers?: {
37
+ line: number;
38
+ message: string;
39
+ level?: "error" | "warning" | "info";
40
+ }[];
41
+ readOnlyRanges?: {
42
+ from: number;
43
+ to: number;
44
+ }[];
45
+ provideCompletions?: (context: {
46
+ value: string;
47
+ position: number;
48
+ line: number;
49
+ lineText: string;
50
+ prefix: string;
51
+ explicit: boolean;
52
+ language: string;
53
+ }) => (Array<{
54
+ label: string;
55
+ insert?: string;
56
+ detail?: string;
57
+ }> | Promise<any[]>);
58
+ autoComplete?: boolean;
59
+ onChange?: (value: string, reason: string) => void;
60
+ }): any;
@@ -0,0 +1,99 @@
1
+ /** Splits tokens at the line breaks: an array (one entry per line) of arrays of { type, text }. */
2
+ export function tokensToLines(tokens: any): any[][];
3
+ /** The nodes of one line: text nodes and <span class="tok-..."> (a span has one class and one text node). */
4
+ export function lineNodes(tokens: any): any;
5
+ /**
6
+ * Writes the highlighted lines of a text into a <code> element (replacing what is there). The editor uses it too.
7
+ *
8
+ * @param {HTMLElement} code
9
+ * @param {string} text
10
+ * @param {string|object} [language] a name or alias ("js"), or a language object; unknown: plain text
11
+ * @param {object} [options]
12
+ * @param {Array<number|string>} [options.highlightLines] line numbers (1-based) or ranges ("5-8") that get a background
13
+ * @returns {number} the number of lines
14
+ */
15
+ export function renderCode(code: HTMLElement, text: string, language?: string | object, { highlightLines }?: {
16
+ highlightLines?: Array<number | string>;
17
+ }): number;
18
+ /**
19
+ * Highlights read-only code: a `<pre class="athena-code"><code>` element.
20
+ *
21
+ * @param {string} text
22
+ * @param {string|object} [language] "js", "ts", "json", "html", "css", "sql", "sh", "yaml", "c#", "python" or a language you registered
23
+ * @param {object} [options]
24
+ * @param {boolean} [options.lineNumbers=false]
25
+ * @param {Array<number|string>} [options.highlightLines]
26
+ * @param {boolean} [options.wrap=false] long lines wrap instead of scrolling
27
+ * @param {string} [options.label] accessible name of the code
28
+ * @returns {HTMLPreElement}
29
+ */
30
+ export function highlightCode(text: string, language?: string | object, { lineNumbers, highlightLines, wrap, label }?: {
31
+ lineNumbers?: boolean;
32
+ highlightLines?: Array<number | string>;
33
+ wrap?: boolean;
34
+ label?: string;
35
+ }): HTMLPreElement;
36
+ /**
37
+ * A code block: a label with the language, a copy button and the highlighted code.
38
+ *
39
+ * @param {object} options
40
+ * @param {string|HTMLElement} [options.parent]
41
+ * @param {string} options.code
42
+ * @param {string|object} [options.language]
43
+ * @param {string} [options.title] shown in the header instead of the language
44
+ * @param {boolean} [options.lineNumbers=false]
45
+ * @param {Array<number|string>} [options.highlightLines]
46
+ * @param {boolean} [options.copy=true] the copy button
47
+ * @param {boolean} [options.wrap=false]
48
+ * @param {string} [options.id]
49
+ * @returns {{element: HTMLElement, getCode: () => string, setCode: (code: string, language?: string|object) => void, copy: () => Promise<boolean>, destroy: Function}}
50
+ */
51
+ export function generateCodeBlock({ parent, code, language, title, lineNumbers, highlightLines, copy, wrap, id }?: {
52
+ parent?: string | HTMLElement;
53
+ code: string;
54
+ language?: string | object;
55
+ title?: string;
56
+ lineNumbers?: boolean;
57
+ highlightLines?: Array<number | string>;
58
+ copy?: boolean;
59
+ wrap?: boolean;
60
+ id?: string;
61
+ }): {
62
+ element: HTMLElement;
63
+ getCode: () => string;
64
+ setCode: (code: string, language?: string | object) => void;
65
+ copy: () => Promise<boolean>;
66
+ destroy: Function;
67
+ };
68
+ /**
69
+ * A view of the difference between two texts, with highlighted code on both sides.
70
+ *
71
+ * @param {object} options
72
+ * @param {string|HTMLElement} [options.parent]
73
+ * @param {string} [options.original]
74
+ * @param {string} [options.modified]
75
+ * @param {string|object} [options.language]
76
+ * @param {"unified"|"split"} [options.mode="unified"]
77
+ * @param {number} [options.context=3] unchanged lines kept around a change (Infinity: all of them); a button shows the rest
78
+ * @param {string} [options.originalLabel]
79
+ * @param {string} [options.modifiedLabel]
80
+ * @returns {{element: HTMLElement, setTexts: (original: string, modified: string) => void, setMode: (mode: string) => void, getStats: () => {added: number, removed: number}}}
81
+ */
82
+ export function createDiffView({ parent, original, modified, language, mode, context, originalLabel, modifiedLabel }?: {
83
+ parent?: string | HTMLElement;
84
+ original?: string;
85
+ modified?: string;
86
+ language?: string | object;
87
+ mode?: "unified" | "split";
88
+ context?: number;
89
+ originalLabel?: string;
90
+ modifiedLabel?: string;
91
+ }): {
92
+ element: HTMLElement;
93
+ setTexts: (original: string, modified: string) => void;
94
+ setMode: (mode: string) => void;
95
+ getStats: () => {
96
+ added: number;
97
+ removed: number;
98
+ };
99
+ };
@@ -1,117 +1,117 @@
1
- /**
2
- * Registers a type of widget, so grids can create it, load it from a saved layout and show its settings.
3
- *
4
- * @param {string} type name of the type, for example "stat" (it is saved in layouts)
5
- * @param {object} definition
6
- * @param {(context: WidgetContext) => (void|Function|{update?: Function, destroy?: Function})} definition.render builds the widget into `context.element`;
7
- * it may return a function (called when the widget goes away) or an object with `update(context)` and `destroy(context)`
8
- * @param {(context: WidgetContext) => void} [definition.update] called (throttled) when the config or the title changed; without it the widget is rendered again
9
- * @param {(context: WidgetContext, size: {width: number, height: number}) => void} [definition.resize] called (throttled) when the body changes its size
10
- * @param {(context: WidgetContext) => void} [definition.destroy] called when the widget is removed or the grid is destroyed
11
- * @param {object[]|((widget: object) => object[])} [definition.configForm] field definitions (see generateField) of the settings dialog; the field `name` is the key in the config
12
- * @param {object} [definition.defaultConfig] config of a new widget
13
- * @param {string} [definition.title] title of a new widget
14
- * @param {{w: number, h: number}} [definition.defaultSize={w: 3, h: 2}] size in grid cells
15
- * @param {{w?: number, h?: number}} [definition.minSize]
16
- * @param {{w?: number, h?: number}} [definition.maxSize]
17
- *
18
- * @typedef {object} WidgetContext
19
- * @property {string} id
20
- * @property {string} type
21
- * @property {HTMLElement} element the body of the widget: build into it
22
- * @property {object} config the current config (read it again in update())
23
- * @property {string} title
24
- * @property {{width: number, height: number}} size
25
- * @property {(title: string) => void} setTitle
26
- */
27
- export function registerWidget(type: string, definition: {
28
- render: (context: WidgetContext) => (void | Function | {
29
- update?: Function;
30
- destroy?: Function;
31
- });
32
- update?: (context: WidgetContext) => void;
33
- resize?: (context: WidgetContext, size: {
34
- width: number;
35
- height: number;
36
- }) => void;
37
- destroy?: (context: WidgetContext) => void;
38
- configForm?: object[] | ((widget: object) => object[]);
39
- defaultConfig?: object;
40
- title?: string;
41
- defaultSize?: {
42
- w: number;
43
- h: number;
44
- };
45
- minSize?: {
46
- w?: number;
47
- h?: number;
48
- };
49
- maxSize?: {
50
- w?: number;
51
- h?: number;
52
- };
53
- }): void;
54
- /** Forgets a widget type. Widgets of it that are in grids stay and are shown as unknown. */
55
- export function unregisterWidget(type: any): boolean;
56
- /** The names of the registered widget types. */
57
- export function getWidgetTypes(): any[];
58
- /**
59
- * A grid of widgets.
60
- *
61
- * @param {object} options
62
- * @param {string|HTMLElement} options.element the container
63
- * @param {number} [options.columns=12] columns when there are no breakpoints
64
- * @param {number} [options.rowHeight=80] height of a row in px
65
- * @param {number} [options.gap=12] gap between widgets in px
66
- * @param {Record<string, {minWidth?: number, columns: number}>} [options.breakpoints] layouts by the width of the container, for example
67
- * `{ large: { minWidth: 900, columns: 12 }, small: { minWidth: 0, columns: 4 } }`. A breakpoint without a layout of its own is derived from the widest one.
68
- * @param {object[]} [options.widgets] first widgets: `{ type, title?, config?, x?, y?, w?, h?, locked?, id? }`
69
- * @param {object} [options.layout] a saved layout (getLayout()), used instead of `widgets`
70
- * @param {boolean} [options.editable=false] edit mode: move, resize, settings, duplicate, remove
71
- * @param {boolean} [options.compact=true] widgets fall upwards when there is room (false: they stay where they are put)
72
- * @param {boolean} [options.animate=true] widgets slide to their new places (never under reduced motion)
73
- * @param {string} [options.label] accessible name of the dashboard
74
- * @param {number} [options.maxWidgets=200]
75
- * @param {(layout: object, reason: string) => void} [options.onChange] called after a change made by the person or by add/remove/...: "move", "resize", "add", "remove", "duplicate", "settings", "lock", "undo", "redo"
76
- * @returns the handle: { element, addWidget, removeWidget, duplicateWidget, configureWidget, updateWidget, getWidget, getWidgets, lockWidget, setEditable, isEditable,
77
- * getLayout, setLayout, undo, redo, canUndo, canRedo, getBreakpoint, destroy }
78
- */
79
- export function createWidgetGrid(options?: {
80
- element: string | HTMLElement;
81
- columns?: number;
82
- rowHeight?: number;
83
- gap?: number;
84
- breakpoints?: Record<string, {
85
- minWidth?: number;
86
- columns: number;
87
- }>;
88
- widgets?: object[];
89
- layout?: object;
90
- editable?: boolean;
91
- compact?: boolean;
92
- animate?: boolean;
93
- label?: string;
94
- maxWidgets?: number;
95
- onChange?: (layout: object, reason: string) => void;
96
- }): any;
97
- /**
98
- * Registers a type of widget, so grids can create it, load it from a saved layout and show its settings.
99
- */
100
- export type WidgetContext = {
101
- id: string;
102
- type: string;
103
- /**
104
- * the body of the widget: build into it
105
- */
106
- element: HTMLElement;
107
- /**
108
- * the current config (read it again in update())
109
- */
110
- config: object;
111
- title: string;
112
- size: {
113
- width: number;
114
- height: number;
115
- };
116
- setTitle: (title: string) => void;
117
- };
1
+ /**
2
+ * Registers a type of widget, so grids can create it, load it from a saved layout and show its settings.
3
+ *
4
+ * @param {string} type name of the type, for example "stat" (it is saved in layouts)
5
+ * @param {object} definition
6
+ * @param {(context: WidgetContext) => (void|Function|{update?: Function, destroy?: Function})} definition.render builds the widget into `context.element`;
7
+ * it may return a function (called when the widget goes away) or an object with `update(context)` and `destroy(context)`
8
+ * @param {(context: WidgetContext) => void} [definition.update] called (throttled) when the config or the title changed; without it the widget is rendered again
9
+ * @param {(context: WidgetContext, size: {width: number, height: number}) => void} [definition.resize] called (throttled) when the body changes its size
10
+ * @param {(context: WidgetContext) => void} [definition.destroy] called when the widget is removed or the grid is destroyed
11
+ * @param {object[]|((widget: object) => object[])} [definition.configForm] field definitions (see generateField) of the settings dialog; the field `name` is the key in the config
12
+ * @param {object} [definition.defaultConfig] config of a new widget
13
+ * @param {string} [definition.title] title of a new widget
14
+ * @param {{w: number, h: number}} [definition.defaultSize={w: 3, h: 2}] size in grid cells
15
+ * @param {{w?: number, h?: number}} [definition.minSize]
16
+ * @param {{w?: number, h?: number}} [definition.maxSize]
17
+ *
18
+ * @typedef {object} WidgetContext
19
+ * @property {string} id
20
+ * @property {string} type
21
+ * @property {HTMLElement} element the body of the widget: build into it
22
+ * @property {object} config the current config (read it again in update())
23
+ * @property {string} title
24
+ * @property {{width: number, height: number}} size
25
+ * @property {(title: string) => void} setTitle
26
+ */
27
+ export function registerWidget(type: string, definition: {
28
+ render: (context: WidgetContext) => (void | Function | {
29
+ update?: Function;
30
+ destroy?: Function;
31
+ });
32
+ update?: (context: WidgetContext) => void;
33
+ resize?: (context: WidgetContext, size: {
34
+ width: number;
35
+ height: number;
36
+ }) => void;
37
+ destroy?: (context: WidgetContext) => void;
38
+ configForm?: object[] | ((widget: object) => object[]);
39
+ defaultConfig?: object;
40
+ title?: string;
41
+ defaultSize?: {
42
+ w: number;
43
+ h: number;
44
+ };
45
+ minSize?: {
46
+ w?: number;
47
+ h?: number;
48
+ };
49
+ maxSize?: {
50
+ w?: number;
51
+ h?: number;
52
+ };
53
+ }): void;
54
+ /** Forgets a widget type. Widgets of it that are in grids stay and are shown as unknown. */
55
+ export function unregisterWidget(type: any): boolean;
56
+ /** The names of the registered widget types. */
57
+ export function getWidgetTypes(): any[];
58
+ /**
59
+ * A grid of widgets.
60
+ *
61
+ * @param {object} options
62
+ * @param {string|HTMLElement} options.element the container
63
+ * @param {number} [options.columns=12] columns when there are no breakpoints
64
+ * @param {number} [options.rowHeight=80] height of a row in px
65
+ * @param {number} [options.gap=12] gap between widgets in px
66
+ * @param {Record<string, {minWidth?: number, columns: number}>} [options.breakpoints] layouts by the width of the container, for example
67
+ * `{ large: { minWidth: 900, columns: 12 }, small: { minWidth: 0, columns: 4 } }`. A breakpoint without a layout of its own is derived from the widest one.
68
+ * @param {object[]} [options.widgets] first widgets: `{ type, title?, config?, x?, y?, w?, h?, locked?, id? }`
69
+ * @param {object} [options.layout] a saved layout (getLayout()), used instead of `widgets`
70
+ * @param {boolean} [options.editable=false] edit mode: move, resize, settings, duplicate, remove
71
+ * @param {boolean} [options.compact=true] widgets fall upwards when there is room (false: they stay where they are put)
72
+ * @param {boolean} [options.animate=true] widgets slide to their new places (never under reduced motion)
73
+ * @param {string} [options.label] accessible name of the dashboard
74
+ * @param {number} [options.maxWidgets=200]
75
+ * @param {(layout: object, reason: string) => void} [options.onChange] called after a change made by the person or by add/remove/...: "move", "resize", "add", "remove", "duplicate", "settings", "lock", "undo", "redo"
76
+ * @returns the handle: { element, addWidget, removeWidget, duplicateWidget, configureWidget, updateWidget, getWidget, getWidgets, lockWidget, setEditable, isEditable,
77
+ * getLayout, setLayout, undo, redo, canUndo, canRedo, getBreakpoint, destroy }
78
+ */
79
+ export function createWidgetGrid(options?: {
80
+ element: string | HTMLElement;
81
+ columns?: number;
82
+ rowHeight?: number;
83
+ gap?: number;
84
+ breakpoints?: Record<string, {
85
+ minWidth?: number;
86
+ columns: number;
87
+ }>;
88
+ widgets?: object[];
89
+ layout?: object;
90
+ editable?: boolean;
91
+ compact?: boolean;
92
+ animate?: boolean;
93
+ label?: string;
94
+ maxWidgets?: number;
95
+ onChange?: (layout: object, reason: string) => void;
96
+ }): any;
97
+ /**
98
+ * Registers a type of widget, so grids can create it, load it from a saved layout and show its settings.
99
+ */
100
+ export type WidgetContext = {
101
+ id: string;
102
+ type: string;
103
+ /**
104
+ * the body of the widget: build into it
105
+ */
106
+ element: HTMLElement;
107
+ /**
108
+ * the current config (read it again in update())
109
+ */
110
+ config: object;
111
+ title: string;
112
+ size: {
113
+ width: number;
114
+ height: number;
115
+ };
116
+ setTitle: (title: string) => void;
117
+ };
@@ -1,2 +1,2 @@
1
- export * from "./libs/hephaestus/widgetGrid/widgetGrid.js";
2
- export * from "./libs/core/gridLayout.js";
1
+ export * from "./libs/hephaestus/widgetGrid/widgetGrid.js";
2
+ export * from "./libs/core/gridLayout.js";