@ims360/svelte-ivory 0.0.6 → 0.0.7
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 +7 -0
- package/dist/components/ai/AiMessage.svelte.d.ts +1 -0
- package/dist/components/ai/AiMessage.svelte.d.ts.map +1 -0
- package/dist/components/ai/AttachedFile.svelte.d.ts +1 -0
- package/dist/components/ai/AttachedFile.svelte.d.ts.map +1 -0
- package/dist/components/ai/Chat.svelte.d.ts +1 -0
- package/dist/components/ai/Chat.svelte.d.ts.map +1 -0
- package/dist/components/ai/Markdown.svelte.d.ts +1 -0
- package/dist/components/ai/Markdown.svelte.d.ts.map +1 -0
- package/dist/components/ai/UserMessage.svelte.d.ts +1 -0
- package/dist/components/ai/UserMessage.svelte.d.ts.map +1 -0
- package/dist/components/ai/index.d.ts +1 -0
- package/dist/components/ai/index.d.ts.map +1 -0
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts +1 -0
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts.map +1 -0
- package/dist/components/basic/index.d.ts +1 -0
- package/dist/components/basic/index.d.ts.map +1 -0
- package/dist/components/basic/toggle/Toggle.svelte +5 -3
- package/dist/components/basic/toggle/Toggle.svelte.d.ts +1 -0
- package/dist/components/basic/toggle/Toggle.svelte.d.ts.map +1 -0
- package/dist/components/buttons/CopyToClipboardButton.svelte.d.ts +1 -0
- package/dist/components/buttons/CopyToClipboardButton.svelte.d.ts.map +1 -0
- package/dist/components/layout/drawer/Drawer.svelte.d.ts +1 -0
- package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -0
- package/dist/components/layout/heading/Heading.svelte +1 -1
- package/dist/components/layout/heading/Heading.svelte.d.ts +1 -0
- package/dist/components/layout/heading/Heading.svelte.d.ts.map +1 -0
- package/dist/components/layout/heading/index.d.ts +1 -0
- package/dist/components/layout/heading/index.d.ts.map +1 -0
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte +3 -3
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts +2 -1
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts.map +1 -0
- package/dist/components/layout/hiddenBackground/index.d.ts +7 -0
- package/dist/components/layout/hiddenBackground/index.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/layout/modal/Modal.svelte.d.ts +1 -0
- package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -0
- package/dist/components/layout/modal/ModalTest.svelte.d.ts +1 -0
- package/dist/components/layout/modal/ModalTest.svelte.d.ts.map +1 -0
- package/dist/components/layout/popover/Popover.svelte.d.ts +1 -0
- package/dist/components/layout/popover/Popover.svelte.d.ts.map +1 -0
- package/dist/components/layout/portal/Portal.svelte.d.ts +1 -0
- package/dist/components/layout/portal/Portal.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/Tab.svelte +3 -3
- package/dist/components/layout/tabs/Tab.svelte.d.ts +2 -1
- package/dist/components/layout/tabs/Tab.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/TabPanel.svelte.d.ts +1 -0
- package/dist/components/layout/tabs/TabPanel.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/Tabs.svelte.d.ts +1 -0
- package/dist/components/layout/tabs/Tabs.svelte.d.ts.map +1 -0
- package/dist/components/layout/tabs/index.d.ts +2 -1
- package/dist/components/layout/tabs/index.d.ts.map +1 -0
- package/dist/components/layout/tooltip/Tooltip.svelte +11 -10
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts +1 -0
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts.map +1 -0
- package/dist/components/table/index.d.ts +6 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +5 -0
- package/dist/components/table/plugins/expandAll.svelte.d.ts +7 -0
- package/dist/components/table/plugins/expandAll.svelte.d.ts.map +1 -0
- package/dist/components/table/plugins/expandAll.svelte.js +24 -0
- package/dist/components/table/plugins/search.svelte.d.ts +13 -0
- package/dist/components/table/plugins/search.svelte.d.ts.map +1 -0
- package/dist/components/table/plugins/search.svelte.js +52 -0
- package/dist/components/table/table/Column.svelte +78 -0
- package/dist/components/table/table/Column.svelte.d.ts +16 -0
- package/dist/components/table/table/Column.svelte.d.ts.map +1 -0
- package/dist/components/table/table/ColumnHead.svelte +73 -0
- package/dist/components/table/table/ColumnHead.svelte.d.ts +11 -0
- package/dist/components/table/table/ColumnHead.svelte.d.ts.map +1 -0
- package/dist/components/table/table/Row.svelte +67 -0
- package/dist/components/table/table/Row.svelte.d.ts +13 -0
- package/dist/components/table/table/Row.svelte.d.ts.map +1 -0
- package/dist/components/table/table/Table.svelte +137 -0
- package/dist/components/table/table/Table.svelte.d.ts +52 -0
- package/dist/components/table/table/Table.svelte.d.ts.map +1 -0
- package/dist/components/table/table/VirtualList.svelte +101 -0
- package/dist/components/table/table/VirtualList.svelte.d.ts +41 -0
- package/dist/components/table/table/VirtualList.svelte.d.ts.map +1 -0
- package/dist/components/table/table/column.svelte.d.ts +21 -0
- package/dist/components/table/table/column.svelte.d.ts.map +1 -0
- package/dist/components/table/table/column.svelte.js +47 -0
- package/dist/components/table/table/index.js +11 -0
- package/dist/components/table/table/table.svelte.d.ts +36 -0
- package/dist/components/table/table/table.svelte.d.ts.map +1 -0
- package/dist/components/table/table/table.svelte.js +92 -0
- package/dist/components/toast/Toast.svelte.d.ts +1 -0
- package/dist/components/toast/Toast.svelte.d.ts.map +1 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.d.ts.map +1 -0
- package/dist/components/toast/toasts.svelte.d.ts +1 -0
- package/dist/components/toast/toasts.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/utils/actions/clickOutside.d.ts +1 -0
- package/dist/utils/actions/clickOutside.d.ts.map +1 -0
- package/dist/utils/actions/focusTrap.d.ts +1 -0
- package/dist/utils/actions/focusTrap.d.ts.map +1 -0
- package/dist/utils/actions/index.d.ts +2 -0
- package/dist/utils/actions/index.d.ts.map +1 -0
- package/dist/utils/actions/index.js +1 -0
- package/dist/utils/actions/portal.d.ts +1 -0
- package/dist/utils/actions/portal.d.ts.map +1 -0
- package/dist/utils/actions/resize.d.ts +6 -0
- package/dist/utils/actions/resize.d.ts.map +1 -0
- package/dist/utils/actions/resize.js +25 -0
- package/dist/utils/actions/shortcut.d.ts +1 -0
- package/dist/utils/actions/shortcut.d.ts.map +1 -0
- package/dist/utils/actions/visible.d.ts +1 -0
- package/dist/utils/actions/visible.d.ts.map +1 -0
- package/dist/utils/functions/cookie.d.ts +1 -0
- package/dist/utils/functions/cookie.d.ts.map +1 -0
- package/dist/utils/functions/index.d.ts +1 -0
- package/dist/utils/functions/index.d.ts.map +1 -0
- package/dist/utils/functions/pseudoRandomId.d.ts +1 -0
- package/dist/utils/functions/pseudoRandomId.d.ts.map +1 -0
- package/dist/utils/functions/queryParams.d.ts +1 -0
- package/dist/utils/functions/queryParams.d.ts.map +1 -0
- package/package.json +9 -2
- package/src/lib/components/basic/toggle/Toggle.svelte +5 -3
- package/src/lib/components/layout/heading/Heading.svelte +1 -1
- package/src/lib/components/layout/hiddenBackground/HiddenBackground.svelte +3 -3
- package/src/lib/components/layout/tabs/Tab.svelte +3 -3
- package/src/lib/components/layout/tooltip/Tooltip.svelte +11 -10
- package/src/lib/components/table/index.ts +5 -0
- package/src/lib/components/table/plugins/expandAll.svelte.ts +34 -0
- package/src/lib/components/table/plugins/search.svelte.ts +75 -0
- package/src/lib/components/table/table/Column.svelte +78 -0
- package/src/lib/components/table/table/ColumnHead.svelte +73 -0
- package/src/lib/components/table/table/Row.svelte +67 -0
- package/src/lib/components/table/table/Table.svelte +137 -0
- package/src/lib/components/table/table/VirtualList.svelte +101 -0
- package/src/lib/components/table/table/column.svelte.ts +59 -0
- package/src/lib/components/table/table/index.ts +15 -0
- package/src/lib/components/table/table/table.svelte.ts +124 -0
- package/src/lib/utils/actions/index.ts +1 -0
- package/src/lib/utils/actions/resize.ts +35 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.js +0 -1
- package/src/lib/components/basic/checkbox/checkbox.svelte.spec.ts +0 -39
- package/src/lib/components/basic/toggle/toggle.svelte.spec.ts +0 -19
- package/src/lib/components/index.ts +0 -0
- package/src/lib/components/layout/modal/modal.svelte.spec.ts +0 -39
- package/src/lib/components/layout/tabs/Tabs.test.svelte +0 -5
- package/src/lib/utils/actions/clickOutside.svelte.spec.ts +0 -67
- package/src/lib/utils/actions/shortcut.svelte.spec.ts +0 -19
- package/src/lib/utils/functions/cookie.svelte.spec.ts +0 -55
- package/src/lib/utils/functions/pseudoRandomId.spec.ts +0 -19
- package/src/lib/utils/functions/queryParams.spec.ts +0 -25
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const DEFAULT_WIDTH = 250;
|
|
2
|
+
const MINIMAL_WIDTH_MULTIPLIER = 0.5;
|
|
3
|
+
export class Column {
|
|
4
|
+
id = $state('');
|
|
5
|
+
header = $state('');
|
|
6
|
+
// resizing
|
|
7
|
+
width = $state();
|
|
8
|
+
minimalWidth = $state(DEFAULT_WIDTH);
|
|
9
|
+
hovering = $state(false);
|
|
10
|
+
resizable = $state(false);
|
|
11
|
+
dragging = $state(false);
|
|
12
|
+
constructor(conf) {
|
|
13
|
+
this.id = conf.id;
|
|
14
|
+
this.updateConfig(conf);
|
|
15
|
+
$effect(() => {
|
|
16
|
+
this.updateConfig(conf);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
updateConfig(conf) {
|
|
20
|
+
if (conf.minWidth !== undefined) {
|
|
21
|
+
this.minimalWidth = conf.minWidth;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.minimalWidth = (conf.width ?? DEFAULT_WIDTH) * MINIMAL_WIDTH_MULTIPLIER;
|
|
25
|
+
}
|
|
26
|
+
if (this.width === undefined) {
|
|
27
|
+
const newWidth = conf.width ?? DEFAULT_WIDTH;
|
|
28
|
+
this.width = newWidth;
|
|
29
|
+
}
|
|
30
|
+
if (!this.header)
|
|
31
|
+
this.header = conf.header;
|
|
32
|
+
const newResizable = conf.resizable ?? false;
|
|
33
|
+
if (newResizable !== this.resizable) {
|
|
34
|
+
this.resizable = newResizable;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
resize(newWidth) {
|
|
38
|
+
if (newWidth === undefined)
|
|
39
|
+
return;
|
|
40
|
+
if (newWidth < this.minimalWidth) {
|
|
41
|
+
this.width = this.minimalWidth;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.width = newWidth;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Column from './Column.svelte';
|
|
2
|
+
import Row from './Row.svelte';
|
|
3
|
+
import TableComponent, { getTableContext } from './Table.svelte';
|
|
4
|
+
import { TableController } from './table.svelte';
|
|
5
|
+
const Table = Object.assign((TableComponent), {
|
|
6
|
+
Column,
|
|
7
|
+
Row,
|
|
8
|
+
getContext: getTableContext,
|
|
9
|
+
Controller: TableController
|
|
10
|
+
});
|
|
11
|
+
export default Table;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Column, type ColumnConfig } from './column.svelte';
|
|
2
|
+
export type TableRow<T> = {
|
|
3
|
+
id: string;
|
|
4
|
+
children?: T[];
|
|
5
|
+
};
|
|
6
|
+
export type TablePlugin<T extends TableRow<T>> = (state: TableState<T>) => TableState<T>;
|
|
7
|
+
export interface TableConfig<T extends TableRow<T>> {
|
|
8
|
+
data: T[];
|
|
9
|
+
plugins?: TablePlugin<T>[];
|
|
10
|
+
}
|
|
11
|
+
export interface TableState<T extends TableRow<T>> {
|
|
12
|
+
data: T[];
|
|
13
|
+
expanded: Set<string>;
|
|
14
|
+
}
|
|
15
|
+
interface TreeRow<T> {
|
|
16
|
+
node: T;
|
|
17
|
+
nestingLevel: number;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class TableController<T extends TableRow<T>> {
|
|
21
|
+
columns: Column[];
|
|
22
|
+
data: T[];
|
|
23
|
+
expanded: Set<string>;
|
|
24
|
+
scrollTop: number;
|
|
25
|
+
readonly results: {
|
|
26
|
+
entries: TreeRow<T>[];
|
|
27
|
+
someHaveChildren: boolean;
|
|
28
|
+
maxNestingLevel: number;
|
|
29
|
+
};
|
|
30
|
+
refresh(conf: TableConfig<T>): void;
|
|
31
|
+
registerColumn(config: ColumnConfig): Column;
|
|
32
|
+
toggleExpansion(id: string): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function getAllIds<T extends TableRow<T>>(...nodes: T[]): string[];
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=table.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/table/table.svelte.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC;AACzD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AAEzF,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC9C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,UAAU,OAAO,CAAC,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC9C,OAAO,WAAwB;IAC/B,IAAI,MAAmB;IACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAA2B;IAChD,SAAS,SAAa;IAEtB,QAAQ,CAAC,OAAO;;;;MAAkD;IAElE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAc5B,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAc5C,eAAe,CAAC,EAAE,EAAE,MAAM;CAI7B;AAuDD,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,CAMxE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
2
|
+
import { Column } from './column.svelte';
|
|
3
|
+
export class TableController {
|
|
4
|
+
columns = $state([]);
|
|
5
|
+
data = $state([]);
|
|
6
|
+
expanded = new SvelteSet();
|
|
7
|
+
scrollTop = $state(0);
|
|
8
|
+
results = $derived(treeWalker(this.data, this.expanded));
|
|
9
|
+
refresh(conf) {
|
|
10
|
+
let intitalState = {
|
|
11
|
+
data: structuredClone(conf.data),
|
|
12
|
+
expanded: this.expanded
|
|
13
|
+
};
|
|
14
|
+
for (const plugin of conf.plugins ?? []) {
|
|
15
|
+
intitalState = plugin(intitalState);
|
|
16
|
+
}
|
|
17
|
+
this.data = intitalState.data;
|
|
18
|
+
this.expanded = new SvelteSet(intitalState.expanded);
|
|
19
|
+
}
|
|
20
|
+
registerColumn(config) {
|
|
21
|
+
// only register a column once
|
|
22
|
+
let existingColumn = undefined;
|
|
23
|
+
for (const column of this.columns) {
|
|
24
|
+
if (column.id !== config.id)
|
|
25
|
+
continue;
|
|
26
|
+
existingColumn = column;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
if (existingColumn)
|
|
30
|
+
return existingColumn;
|
|
31
|
+
const col = new Column(config);
|
|
32
|
+
this.columns.push(col);
|
|
33
|
+
return col;
|
|
34
|
+
}
|
|
35
|
+
toggleExpansion(id) {
|
|
36
|
+
if (this.expanded.has(id))
|
|
37
|
+
this.expanded.delete(id);
|
|
38
|
+
else
|
|
39
|
+
this.expanded.add(id);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Walks though a tree strucure and turns it into a flat list, needed since the `VirtualList` needs a list, not a tree */
|
|
43
|
+
function treeWalker(data, expanded) {
|
|
44
|
+
const stack = [];
|
|
45
|
+
// push the root nodes of the trees onto the stack
|
|
46
|
+
for (let i = 0; i < data.length; i++) {
|
|
47
|
+
stack.push({
|
|
48
|
+
node: data[data.length - i - 1],
|
|
49
|
+
nestingLevel: 0
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const entries = []; // the final result
|
|
53
|
+
let someHaveChildren = false; // used to determine whether to show the tree utility buttons
|
|
54
|
+
let maxNestingLevel = 0;
|
|
55
|
+
while (stack.length !== 0) {
|
|
56
|
+
const stackEntry = stack.pop();
|
|
57
|
+
if (!stackEntry)
|
|
58
|
+
break;
|
|
59
|
+
const { node, nestingLevel } = stackEntry;
|
|
60
|
+
const children = node.children;
|
|
61
|
+
if (children && children.length > 0) {
|
|
62
|
+
someHaveChildren = true;
|
|
63
|
+
// only show the children of expanded elements
|
|
64
|
+
if (expanded.has(node.id)) {
|
|
65
|
+
maxNestingLevel = Math.max(maxNestingLevel, nestingLevel + 1);
|
|
66
|
+
stack.push(...children
|
|
67
|
+
.map((c) => ({
|
|
68
|
+
node: c,
|
|
69
|
+
nestingLevel: nestingLevel + 1
|
|
70
|
+
}))
|
|
71
|
+
.reverse());
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
entries.push({
|
|
75
|
+
id: node.id,
|
|
76
|
+
node,
|
|
77
|
+
nestingLevel
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
entries,
|
|
82
|
+
someHaveChildren,
|
|
83
|
+
maxNestingLevel
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function getAllIds(...nodes) {
|
|
87
|
+
const ids = nodes.map((n) => n.id);
|
|
88
|
+
for (const node of nodes) {
|
|
89
|
+
ids.push(...getAllIds(...(node.children ?? [])));
|
|
90
|
+
}
|
|
91
|
+
return ids;
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGzD,KAAK,KAAK,GAAG;IACT,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC,CAAC;CACtE,CAAC;AA+EN;;;GAGG;AACH,QAAA,MAAM,KAAK,2CAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toasts.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/toasts.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;CACrD,CAAC;AAEF,KAAK,KAAK,GAAG,aAAa,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;CAC7C,CAAC;AASF,cAAM,UAAU;IACZ,MAAM,UAAuB;IAE7B,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,GAA0B,MAAM;IAWhE,KAAK,CAAC,EAAE,EAAE,MAAM;IAOhB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAiBvC,MAAM,CAAC,EAAE,EAAE,MAAM;IAMjB,QAAQ,CAAC,EAAE,EAAE,MAAM;IAMnB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,YAAY;CAKvB;AAED,2EAA2E;AAC3E,eAAO,MAAM,MAAM,YAAmB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickOutside.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/clickOutside.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IACxB,0DAA0D;IAC1D,QAAQ,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,8CAA8C;AAC9C,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,kBAAkB;;EA2BzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focusTrap.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/focusTrap.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO;oBAsDrC,OAAO;;EAU9B"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { clickOutside } from './clickOutside';
|
|
2
2
|
export { focusTrap } from './focusTrap';
|
|
3
3
|
export { portal } from './portal';
|
|
4
|
+
export { resize } from './resize';
|
|
4
5
|
export { shortcut } from './shortcut';
|
|
5
6
|
export { onFirstVisible } from './visible';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/portal.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,GAAE,WAAW,GAAG,MAAe;wBAExC,WAAW,GAAG,MAAM;;EAiCxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/resize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,MAAM,CACvB,WAAW,EACX;IAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,CA8B/E,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const resize = (node, { resized, dragging }) => {
|
|
2
|
+
const onResize = (e) => {
|
|
3
|
+
resized(e.clientX);
|
|
4
|
+
};
|
|
5
|
+
const onResizeEnd = () => {
|
|
6
|
+
dragging(false);
|
|
7
|
+
window.removeEventListener('pointermove', onResize);
|
|
8
|
+
window.removeEventListener('pointerup', onResizeEnd);
|
|
9
|
+
window.removeEventListener('pointercancel', onResizeEnd);
|
|
10
|
+
document.getElementsByTagName('html')[0].style.userSelect = '';
|
|
11
|
+
};
|
|
12
|
+
const onResizeStart = () => {
|
|
13
|
+
dragging(true);
|
|
14
|
+
window.addEventListener('pointermove', onResize);
|
|
15
|
+
window.addEventListener('pointerup', onResizeEnd);
|
|
16
|
+
window.addEventListener('pointercancel', onResizeEnd);
|
|
17
|
+
document.getElementsByTagName('html')[0].style.userSelect = 'none';
|
|
18
|
+
};
|
|
19
|
+
node.addEventListener('pointerdown', onResizeStart);
|
|
20
|
+
return {
|
|
21
|
+
destroy() {
|
|
22
|
+
node.removeEventListener('pointerdown', onResizeStart);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/shortcut.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GACjB,MAAM,WAAW,EACjB,SAAS;IACL,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;;;aA0BJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visible.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/actions/visible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,cAAc,EAAE,MAAM,CAC/B,WAAW,EACX;IACI,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC/C,CAoBJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/functions/cookie.ts"],"names":[],"mappings":"AAAA,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,UAqB9B;AAED,UAAU,eAAe;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAWlD;AAED,eAAO,MAAM,MAAM;;;CAGlB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pseudoRandomId.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/functions/pseudoRandomId.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,SAAQ,MAAW,WAGd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryParams.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/functions/queryParams.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,EACpF,QAAQ,CAAC,KACV,MAYF,CAAC"}
|
package/package.json
CHANGED
|
@@ -59,6 +59,10 @@
|
|
|
59
59
|
"types": "./dist/components/toast/index.d.ts",
|
|
60
60
|
"svelte": "./dist/components/toast/index.js"
|
|
61
61
|
},
|
|
62
|
+
"./components/table": {
|
|
63
|
+
"types": "./dist/components/table/index.d.ts",
|
|
64
|
+
"svelte": "./dist/components/table/index.js"
|
|
65
|
+
},
|
|
62
66
|
"./utils/actions": {
|
|
63
67
|
"types": "./dist/utils/actions/index.d.ts",
|
|
64
68
|
"svelte": "./dist/utils/actions/index.js"
|
|
@@ -72,7 +76,10 @@
|
|
|
72
76
|
"dist",
|
|
73
77
|
"src/lib",
|
|
74
78
|
"!dist/**/*.test.*",
|
|
75
|
-
"!dist/**/*.spec.*"
|
|
79
|
+
"!dist/**/*.spec.*",
|
|
80
|
+
"src/lib",
|
|
81
|
+
"!src/lib/**/*.test.*",
|
|
82
|
+
"!src/lib/**/*.spec.*"
|
|
76
83
|
],
|
|
77
84
|
"keywords": [
|
|
78
85
|
"svelte"
|
|
@@ -103,5 +110,5 @@
|
|
|
103
110
|
"svelte": "./dist/index.js",
|
|
104
111
|
"type": "module",
|
|
105
112
|
"types": "./dist/index.d.ts",
|
|
106
|
-
"version": "0.0.
|
|
113
|
+
"version": "0.0.7"
|
|
107
114
|
}
|
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
this={onclick ? 'button' : 'div'}
|
|
22
22
|
class={twMerge(
|
|
23
23
|
clsx(
|
|
24
|
-
'flex h-5 w-9 items-center rounded-full border p-0.5',
|
|
25
|
-
value
|
|
24
|
+
'group flex h-5 w-9 items-center rounded-full border p-0.5 transition-colors duration-100',
|
|
25
|
+
value
|
|
26
|
+
? 'bg-primary-500 border-primary-500'
|
|
27
|
+
: 'bg-surface-500/30 border-surface-500/60 hover:border-surface-500/80',
|
|
26
28
|
clazz
|
|
27
29
|
)
|
|
28
30
|
)}
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
<div
|
|
37
39
|
class={[
|
|
38
40
|
'relative flex aspect-square h-full items-center justify-center rounded-full transition-all',
|
|
39
|
-
value ? 'bg-surface-50' : 'bg-surface-600'
|
|
41
|
+
value ? 'bg-surface-50' : 'bg-surface-600-400 group-hover:bg-surface-700-300'
|
|
40
42
|
]}
|
|
41
43
|
style={value ? `left: calc(100% - ${thumbWidth}px);` : 'left: 0;'}
|
|
42
44
|
bind:clientWidth={thumbWidth}
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
If you set the `defaultClasses`, make sure to call it before using a component that uses the heading component (e.g. your root `+layout.svelte`).
|
|
29
29
|
-->
|
|
30
30
|
|
|
31
|
-
<h2 class={twMerge(clsx('truncate text-lg font-bold select-none', defaultClasses, clazz))}>
|
|
31
|
+
<h2 class={twMerge(clsx('shrink-0 truncate text-lg font-bold select-none', defaultClasses, clazz))}>
|
|
32
32
|
{@render children()}
|
|
33
33
|
</h2>
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const TEST_ID = 'background';
|
|
16
|
-
</script>
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
interface Props {
|
|
17
|
+
export interface Props {
|
|
20
18
|
class?: ClassValue;
|
|
21
19
|
/** Gets called when the dialog is clicked */
|
|
22
20
|
onclose?: () => void;
|
|
23
21
|
children: Snippet;
|
|
24
22
|
}
|
|
23
|
+
</script>
|
|
25
24
|
|
|
25
|
+
<script lang="ts">
|
|
26
26
|
let { class: clazz, onclose, children }: Props = $props();
|
|
27
27
|
</script>
|
|
28
28
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { getTabContext } from './Tabs.svelte';
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
|
-
class?: (selected: boolean) => ClassValue;
|
|
11
|
+
class?: ClassValue | ((selected: boolean) => ClassValue);
|
|
12
12
|
id?: string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* If this is set the element will be a link.
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
this={href ? 'a' : 'button'}
|
|
59
59
|
class={twMerge(
|
|
60
60
|
clsx(
|
|
61
|
-
'btn flex h-fit w-fit items-center justify-center px-0 text-xl font-bold',
|
|
62
|
-
clazz(selected)
|
|
61
|
+
'btn flex h-fit w-fit shrink-0 items-center justify-center px-0 text-xl font-bold select-none',
|
|
62
|
+
typeof clazz === 'function' ? clazz(selected) : clazz
|
|
63
63
|
)
|
|
64
64
|
)}
|
|
65
65
|
onclick={href
|
|
@@ -42,27 +42,28 @@
|
|
|
42
42
|
onclick,
|
|
43
43
|
href,
|
|
44
44
|
timeout = 500,
|
|
45
|
-
tooltipClass
|
|
45
|
+
tooltipClass,
|
|
46
|
+
placement = 'top'
|
|
46
47
|
}: Props = $props();
|
|
47
48
|
|
|
48
49
|
let target = $state<HTMLElement>();
|
|
49
50
|
|
|
50
51
|
let open = $state(false);
|
|
51
52
|
|
|
52
|
-
let
|
|
53
|
-
function
|
|
54
|
-
clearTimeout(
|
|
53
|
+
let currentTimeout: number;
|
|
54
|
+
function onmouseenter() {
|
|
55
|
+
clearTimeout(currentTimeout);
|
|
55
56
|
if (timeout === 0) {
|
|
56
57
|
open = true;
|
|
57
58
|
} else {
|
|
58
|
-
|
|
59
|
+
currentTimeout = setTimeout(() => {
|
|
59
60
|
open = true;
|
|
60
61
|
}, timeout) as unknown as number;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
function
|
|
65
|
-
clearTimeout(
|
|
65
|
+
function onmouseleave() {
|
|
66
|
+
clearTimeout(currentTimeout);
|
|
66
67
|
open = false;
|
|
67
68
|
}
|
|
68
69
|
</script>
|
|
@@ -80,8 +81,8 @@
|
|
|
80
81
|
type={onclick ? 'button' : undefined}
|
|
81
82
|
class={clazz}
|
|
82
83
|
bind:this={target}
|
|
83
|
-
{
|
|
84
|
-
{
|
|
84
|
+
{onmouseenter}
|
|
85
|
+
{onmouseleave}
|
|
85
86
|
{style}
|
|
86
87
|
{onclick}
|
|
87
88
|
>
|
|
@@ -93,7 +94,7 @@
|
|
|
93
94
|
<Popover
|
|
94
95
|
bind:b_open={open}
|
|
95
96
|
{target}
|
|
96
|
-
placement
|
|
97
|
+
{placement}
|
|
97
98
|
class={twMerge(
|
|
98
99
|
clsx(
|
|
99
100
|
'bg-surface-50-950 max-w-96 -translate-y-0.5 rounded px-4 py-1 shadow-lg',
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { expandAllPlugin } from './plugins/expandAll.svelte';
|
|
2
|
+
export { searchPlugin } from './plugins/search.svelte';
|
|
3
|
+
export { default as Table } from './table';
|
|
4
|
+
export { default as Column, type ColumnProps } from './table/Column.svelte';
|
|
5
|
+
export { getColumnHeadContext } from './table/ColumnHead.svelte';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
2
|
+
import { getAllIds, type TablePlugin, type TableRow } from '../table/table.svelte';
|
|
3
|
+
|
|
4
|
+
interface ExpandAllConfig {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const DEFAULT_CONFIG: ExpandAllConfig = {
|
|
9
|
+
enabled: true
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function expandAllPlugin<T extends TableRow<T>>(
|
|
13
|
+
conf: Partial<ExpandAllConfig>
|
|
14
|
+
): TablePlugin<T> {
|
|
15
|
+
let initialized = false;
|
|
16
|
+
|
|
17
|
+
const config: ExpandAllConfig = {
|
|
18
|
+
...DEFAULT_CONFIG,
|
|
19
|
+
...conf
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const middleware: TablePlugin<T> = (state) => {
|
|
23
|
+
if (initialized || !config.enabled) return state;
|
|
24
|
+
initialized = true;
|
|
25
|
+
const allIds = getAllIds(...state.data);
|
|
26
|
+
const newExpanded = new SvelteSet(allIds);
|
|
27
|
+
return {
|
|
28
|
+
data: state.data,
|
|
29
|
+
expanded: newExpanded
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return middleware;
|
|
34
|
+
}
|