@ims360/svelte-ivory 0.0.42 → 0.0.45
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/dist/components/ai/Chat.svelte +12 -12
- package/dist/components/ai/Chat.svelte.d.ts +3 -1
- package/dist/components/ai/Chat.svelte.d.ts.map +1 -1
- package/dist/components/ai/UserMessage.svelte +1 -1
- package/dist/components/basic/checkbox/Checkbox.svelte +0 -1
- package/dist/components/basic/checkbox/Checkbox.svelte.d.ts.map +1 -1
- package/dist/components/layout/drawer/Drawer.svelte +13 -9
- package/dist/components/layout/drawer/Drawer.svelte.d.ts +4 -4
- package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/layout/modal/Modal.svelte +12 -9
- package/dist/components/layout/modal/Modal.svelte.d.ts +6 -5
- package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -1
- package/dist/components/layout/popover/Popover.svelte +1 -0
- package/dist/components/layout/popover/Popover.svelte.d.ts.map +1 -1
- package/dist/components/layout/tooltip/Tooltip.svelte +5 -5
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts +5 -3
- package/dist/components/layout/tooltip/Tooltip.svelte.d.ts.map +1 -1
- package/dist/components/table/Column.svelte +2 -2
- package/dist/components/table/ColumnHead.svelte +4 -4
- package/dist/components/table/ColumnHead.svelte.d.ts +3 -3
- package/dist/components/table/ColumnHead.svelte.d.ts.map +1 -1
- package/dist/components/table/Row.svelte +0 -1
- package/dist/components/table/Row.svelte.d.ts.map +1 -1
- package/dist/components/table/Table.svelte +56 -24
- package/dist/components/table/Table.svelte.d.ts +12 -9
- package/dist/components/table/Table.svelte.d.ts.map +1 -1
- package/dist/components/table/VirtualList.svelte +3 -3
- package/dist/components/table/columnController.svelte.d.ts +1 -1
- package/dist/components/table/columnController.svelte.d.ts.map +1 -1
- package/dist/components/table/columnController.svelte.js +1 -1
- package/dist/components/table/controller.d.ts +23 -0
- package/dist/components/table/controller.d.ts.map +1 -0
- package/dist/components/table/controller.js +52 -0
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.js +2 -2
- package/dist/components/table/plugins/search.svelte.d.ts +3 -2
- package/dist/components/table/plugins/search.svelte.d.ts.map +1 -1
- package/dist/components/table/plugins/search.svelte.js +3 -4
- package/dist/components/toast/Toast.svelte +0 -2
- package/dist/components/toast/Toast.svelte.d.ts.map +1 -1
- package/dist/utils/functions/cookie.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/ai/Chat.svelte +12 -12
- package/src/lib/components/ai/UserMessage.svelte +1 -1
- package/src/lib/components/basic/checkbox/Checkbox.svelte +0 -1
- package/src/lib/components/layout/drawer/Drawer.svelte +13 -9
- package/src/lib/components/layout/modal/Modal.svelte +12 -9
- package/src/lib/components/layout/popover/Popover.svelte +1 -0
- package/src/lib/components/layout/tabs/index.ts +0 -1
- package/src/lib/components/layout/tooltip/Tooltip.svelte +5 -5
- package/src/lib/components/table/Column.svelte +2 -2
- package/src/lib/components/table/ColumnHead.svelte +4 -4
- package/src/lib/components/table/Row.svelte +0 -1
- package/src/lib/components/table/Table.svelte +56 -24
- package/src/lib/components/table/VirtualList.svelte +3 -3
- package/src/lib/components/table/columnController.svelte.ts +1 -1
- package/src/lib/components/table/controller.ts +75 -0
- package/src/lib/components/table/index.ts +2 -9
- package/src/lib/components/table/plugins/search.svelte.ts +3 -12
- package/src/lib/components/toast/Toast.svelte +0 -2
- package/src/lib/utils/functions/cookie.ts +1 -1
- package/dist/components/layout/modal/ModalTest.svelte +0 -9
- package/dist/components/layout/modal/ModalTest.svelte.d.ts +0 -8
- package/dist/components/layout/modal/ModalTest.svelte.d.ts.map +0 -1
- package/dist/components/table/controller.svelte.d.ts +0 -37
- package/dist/components/table/controller.svelte.d.ts.map +0 -1
- package/dist/components/table/controller.svelte.js +0 -160
- package/dist/components/table/plugins/expandAll.svelte.d.ts +0 -7
- package/dist/components/table/plugins/expandAll.svelte.d.ts.map +0 -1
- package/dist/components/table/plugins/expandAll.svelte.js +0 -24
- package/dist/utils/functions/transitionProps.d.ts +0 -1
- package/dist/utils/functions/transitionProps.d.ts.map +0 -1
- package/dist/utils/functions/transitionProps.js +0 -1
- package/src/lib/components/layout/modal/ModalTest.svelte +0 -9
- package/src/lib/components/table/controller.svelte.ts +0 -203
- package/src/lib/components/table/plugins/expandAll.svelte.ts +0 -34
- package/src/lib/utils/functions/transitionProps.ts +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import type { ClassValue } from 'svelte/elements';
|
|
3
|
-
import {
|
|
3
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
4
|
+
import { type TablePlugin, type TableRow } from '.';
|
|
5
|
+
import { ColumnController, type ColumnConfig } from './columnController.svelte';
|
|
4
6
|
export interface TableProps<T extends TableRow<T>> {
|
|
5
7
|
class?: ClassValue;
|
|
6
8
|
data: T[];
|
|
@@ -20,7 +22,11 @@ export interface TableProps<T extends TableRow<T>> {
|
|
|
20
22
|
rowClass?: ClassValue;
|
|
21
23
|
headerClass?: ClassValue;
|
|
22
24
|
plugins?: TablePlugin<T>[];
|
|
23
|
-
|
|
25
|
+
/**
|
|
26
|
+
* **Bindable**
|
|
27
|
+
*/
|
|
28
|
+
b_columns?: ColumnController[];
|
|
29
|
+
expanded?: SvelteSet<string>;
|
|
24
30
|
/**
|
|
25
31
|
* **Bindable**
|
|
26
32
|
*/
|
|
@@ -29,19 +35,16 @@ export interface TableProps<T extends TableRow<T>> {
|
|
|
29
35
|
nestingInset?: number;
|
|
30
36
|
}
|
|
31
37
|
export type TableContext<T extends TableRow<T>> = {
|
|
32
|
-
|
|
38
|
+
registerColumn: (config: ColumnConfig) => ColumnController;
|
|
39
|
+
toggleExpansion: (id: string) => void;
|
|
33
40
|
nestingInset: number;
|
|
34
41
|
};
|
|
35
42
|
export declare function getTableContext<T extends TableRow<T>>(): TableContext<T>;
|
|
36
|
-
interface Props<TI extends {
|
|
37
|
-
id: string;
|
|
38
|
-
}> extends TableProps<TI> {
|
|
39
|
-
}
|
|
40
43
|
declare class __sveltets_Render<T extends TableRow<T>> {
|
|
41
|
-
props():
|
|
44
|
+
props(): TableProps<T>;
|
|
42
45
|
events(): {};
|
|
43
46
|
slots(): {};
|
|
44
|
-
bindings(): "";
|
|
47
|
+
bindings(): "b_scrollTop" | "b_columns";
|
|
45
48
|
exports(): {};
|
|
46
49
|
}
|
|
47
50
|
interface $$IsomorphicComponent {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Table.svelte.ts"],"names":[],"mappings":"AAMI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Table.svelte.ts"],"names":[],"mappings":"AAMI,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAA6B,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,GAAG,CAAC;AAI/E,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGhF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM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Height,
|
|
24
24
|
overscan = 2
|
|
25
25
|
}: Props<T> = $props();
|
|
26
26
|
|
|
27
|
-
let scroll_top = $state(b_scrollTop);
|
|
27
|
+
let scroll_top = $state(b_scrollTop ?? 0);
|
|
28
28
|
let scroll_left = $state(0);
|
|
29
29
|
let header_width = $state(0);
|
|
30
30
|
let viewport = $state<HTMLElement>();
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
onMount(() => {
|
|
56
|
-
if (!viewport) return;
|
|
56
|
+
if (!viewport || typeof b_scrollTop === 'undefined') return;
|
|
57
57
|
viewport.scrollTop = b_scrollTop;
|
|
58
58
|
});
|
|
59
59
|
</script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnController.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/columnController.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAKtC,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"columnController.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/columnController.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAKtC,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,gBAAgB;IACzB,EAAE,SAAc;IAChB,MAAM,uBAAgC;IAGtC,KAAK,qBAAoB;IACzB,OAAO,CAAC,YAAY,CAAyB;IAC7C,QAAQ,UAAiB;IACzB,SAAS,UAAiB;IAC1B,QAAQ,UAAiB;gBAEb,IAAI,EAAE,YAAY;IAS9B,YAAY,CAAC,IAAI,EAAE,YAAY;IAiB/B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM;CAQ3B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type TableRow<T> = {
|
|
2
|
+
id: string;
|
|
3
|
+
children?: T[];
|
|
4
|
+
};
|
|
5
|
+
export type TablePlugin<T extends TableRow<T>> = (state: TableState<T>) => TableState<T>;
|
|
6
|
+
export interface TableState<T extends TableRow<T>> {
|
|
7
|
+
data: T[];
|
|
8
|
+
expanded: Set<string>;
|
|
9
|
+
}
|
|
10
|
+
interface TreeRow<T> {
|
|
11
|
+
node: T;
|
|
12
|
+
nestingLevel: number;
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
/** Walks though a tree strucure and turns it into a flat list, needed since the `VirtualList` needs a list, not a tree */
|
|
16
|
+
export declare function treeWalker<T extends TableRow<T>>(config: TableState<T>): {
|
|
17
|
+
entries: TreeRow<T>[];
|
|
18
|
+
someHaveChildren: boolean;
|
|
19
|
+
maxNestingLevel: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function getAllIds<T extends TableRow<T>>(...nodes: T[]): string[];
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/controller.ts"],"names":[],"mappings":"AAAA,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,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,0HAA0H;AAC1H,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;;;;EAmDtE;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,CAMxE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Walks though a tree strucure and turns it into a flat list, needed since the `VirtualList` needs a list, not a tree */
|
|
2
|
+
export function treeWalker(config) {
|
|
3
|
+
const { data, expanded } = config;
|
|
4
|
+
const stack = [];
|
|
5
|
+
// push the root nodes of the trees onto the stack
|
|
6
|
+
for (let i = 0; i < data.length; i++) {
|
|
7
|
+
stack.push({
|
|
8
|
+
node: data[data.length - i - 1],
|
|
9
|
+
nestingLevel: 0
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const entries = []; // the final result
|
|
13
|
+
let someHaveChildren = false; // used to determine whether to show the tree utility buttons
|
|
14
|
+
let maxNestingLevel = 0;
|
|
15
|
+
while (stack.length !== 0) {
|
|
16
|
+
const stackEntry = stack.pop();
|
|
17
|
+
if (!stackEntry)
|
|
18
|
+
break;
|
|
19
|
+
const { node, nestingLevel } = stackEntry;
|
|
20
|
+
const children = node.children;
|
|
21
|
+
if (children && children.length > 0) {
|
|
22
|
+
someHaveChildren = true;
|
|
23
|
+
// only show the children of expanded elements
|
|
24
|
+
if (expanded.has(node.id)) {
|
|
25
|
+
maxNestingLevel = Math.max(maxNestingLevel, nestingLevel + 1);
|
|
26
|
+
stack.push(...children
|
|
27
|
+
.map((c) => ({
|
|
28
|
+
node: c,
|
|
29
|
+
nestingLevel: nestingLevel + 1
|
|
30
|
+
}))
|
|
31
|
+
.reverse());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
entries.push({
|
|
35
|
+
id: node.id,
|
|
36
|
+
node,
|
|
37
|
+
nestingLevel
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
entries,
|
|
42
|
+
someHaveChildren,
|
|
43
|
+
maxNestingLevel
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function getAllIds(...nodes) {
|
|
47
|
+
const ids = nodes.map((n) => n.id);
|
|
48
|
+
for (const node of nodes) {
|
|
49
|
+
ids.push(...getAllIds(...(node.children ?? [])));
|
|
50
|
+
}
|
|
51
|
+
return ids;
|
|
52
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as Column, type ColumnProps } from './Column.svelte';
|
|
2
|
+
export { ColumnController, type ColumnConfig } from './columnController.svelte';
|
|
2
3
|
export { getColumnHeadContext } from './ColumnHead.svelte';
|
|
3
|
-
export {
|
|
4
|
-
export { expandAllPlugin } from './plugins/expandAll.svelte';
|
|
4
|
+
export { getAllIds, type TablePlugin, type TableRow, type TableState } from './controller';
|
|
5
5
|
export { searchPlugin } from './plugins/search.svelte';
|
|
6
6
|
export { getTableContext, default as Table, type TableContext, type TableProps } from './Table.svelte';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACH,eAAe,EACf,OAAO,IAAI,KAAK,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Column } from './Column.svelte';
|
|
2
|
+
export { ColumnController } from './columnController.svelte';
|
|
2
3
|
export { getColumnHeadContext } from './ColumnHead.svelte';
|
|
3
|
-
export {
|
|
4
|
-
export { expandAllPlugin } from './plugins/expandAll.svelte';
|
|
4
|
+
export { getAllIds } from './controller';
|
|
5
5
|
export { searchPlugin } from './plugins/search.svelte';
|
|
6
6
|
export { getTableContext, default as Table } from './Table.svelte';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
1
2
|
import type { TablePlugin, TableRow } from '../';
|
|
2
3
|
interface SearchConfig<T extends TableRow<T>> {
|
|
3
4
|
search: string;
|
|
@@ -6,8 +7,8 @@ interface SearchConfig<T extends TableRow<T>> {
|
|
|
6
7
|
export declare function searchPlugin<T extends TableRow<T>>(conf: SearchConfig<T>): TablePlugin<T>;
|
|
7
8
|
/** collapses everything that doesnt match the searchString, expands direct search hit */
|
|
8
9
|
export declare const search: <T extends TableRow<T>>(nodes: T[], searchString: string, stringsMatch: (a: T, b: string) => boolean) => {
|
|
9
|
-
hidden:
|
|
10
|
-
expanded:
|
|
10
|
+
hidden: SvelteSet<string>;
|
|
11
|
+
expanded: SvelteSet<string>;
|
|
11
12
|
};
|
|
12
13
|
export {};
|
|
13
14
|
//# sourceMappingURL=search.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/plugins/search.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/table/plugins/search.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEjD,UAAU,YAAY,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;CAChC;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAyBzF;AAED,yFAAyF;AACzF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EACxC,OAAO,CAAC,EAAE,EACV,cAAc,MAAM,EACpB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO;;;CA0B7C,CAAC"}
|
|
@@ -19,7 +19,6 @@ export function searchPlugin(conf) {
|
|
|
19
19
|
// figure out which nodes to expand and hide
|
|
20
20
|
const { expanded, hidden } = search(state.data, conf.search, conf.matches);
|
|
21
21
|
prevSearch = conf.search;
|
|
22
|
-
console.log(hidden);
|
|
23
22
|
return {
|
|
24
23
|
data: state.data.filter((d) => !hidden.has(d.id)),
|
|
25
24
|
expanded: new SvelteSet(expanded)
|
|
@@ -30,14 +29,14 @@ export function searchPlugin(conf) {
|
|
|
30
29
|
/** collapses everything that doesnt match the searchString, expands direct search hit */
|
|
31
30
|
export const search = (nodes, searchString, stringsMatch) => {
|
|
32
31
|
const search = searchString.trim().toLowerCase();
|
|
33
|
-
const hidden = new
|
|
34
|
-
const expanded = new
|
|
32
|
+
const hidden = new SvelteSet();
|
|
33
|
+
const expanded = new SvelteSet();
|
|
35
34
|
function nodeMatches(node, childOfMatch = false) {
|
|
36
35
|
const matches = stringsMatch(node, search);
|
|
37
36
|
let intermediate = false;
|
|
38
37
|
for (const child of node.children || []) {
|
|
39
38
|
const childMatches = nodeMatches(child, matches || childOfMatch);
|
|
40
|
-
if (childMatches
|
|
39
|
+
if (childMatches)
|
|
41
40
|
intermediate = true;
|
|
42
41
|
}
|
|
43
42
|
if (intermediate) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.svelte.ts"],"names":[],"mappings":"AAGI,MAAM,WAAW,KAAK;IAClB,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;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAKL,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;
|
|
1
|
+
{"version":3,"file":"Toast.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/toast/Toast.svelte.ts"],"names":[],"mappings":"AAGI,MAAM,WAAW,KAAK;IAClB,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;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAKL,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;AAmF7D;;;GAGG;AACH,QAAA,MAAM,KAAK,2CAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
let {
|
|
43
43
|
class: clazz,
|
|
44
|
-
b_chat
|
|
44
|
+
b_chat = $bindable(),
|
|
45
45
|
userMessage = defaultUserMessage,
|
|
46
46
|
systemMessage = defaultSystemMessage,
|
|
47
47
|
placeholder,
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
return remainHeight;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async function scrollToBottom() {
|
|
63
|
+
export async function scrollToBottom() {
|
|
64
64
|
if (!chatContainer) return;
|
|
65
65
|
await tick();
|
|
66
66
|
await tick();
|
|
@@ -74,20 +74,20 @@
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
async function submit(message: AiChatMessage) {
|
|
77
|
-
if (
|
|
77
|
+
if (b_chat.loading) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
b_chat.messages.push({
|
|
82
82
|
...message,
|
|
83
83
|
from: 'user',
|
|
84
84
|
time: new Date()
|
|
85
85
|
});
|
|
86
86
|
// prevent the user from sending another message while we are loading the ai response
|
|
87
|
-
|
|
87
|
+
b_chat.loading = true;
|
|
88
88
|
|
|
89
89
|
// add an empty system message to the chat, this will indicate a loading state
|
|
90
|
-
|
|
90
|
+
b_chat.messages.push({
|
|
91
91
|
from: 'system',
|
|
92
92
|
message: '',
|
|
93
93
|
time: new Date()
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
|
|
98
98
|
await externalSubmit(message);
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
b_chat.loading = false;
|
|
101
101
|
}
|
|
102
102
|
</script>
|
|
103
103
|
|
|
@@ -106,11 +106,11 @@
|
|
|
106
106
|
class="flex grow flex-col gap-4 overflow-auto pr-2 [scrollbar-gutter:stable]"
|
|
107
107
|
bind:this={chatContainer}
|
|
108
108
|
>
|
|
109
|
-
{#if
|
|
109
|
+
{#if b_chat.messages.length === 0 && placeholder}
|
|
110
110
|
{@render placeholder()}
|
|
111
111
|
{/if}
|
|
112
|
-
{#each
|
|
113
|
-
{@const message =
|
|
112
|
+
{#each b_chat.messages as _, i (i)}
|
|
113
|
+
{@const message = b_chat.messages[i]}
|
|
114
114
|
{#if message.from === 'user'}
|
|
115
115
|
{@render userMessage({
|
|
116
116
|
message,
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
{@render systemMessage({
|
|
121
121
|
message,
|
|
122
122
|
i,
|
|
123
|
-
minHeight: i ===
|
|
123
|
+
minHeight: i === b_chat.messages.length - 1 ? lastMessageMinHeight : 0
|
|
124
124
|
})}
|
|
125
125
|
{/if}
|
|
126
126
|
{/each}
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
message: AiChatMessage;
|
|
137
137
|
minHeight?: number;
|
|
138
138
|
})}
|
|
139
|
-
<AiMessage bind:b_message={
|
|
139
|
+
<AiMessage bind:b_message={b_chat.messages[i]} {minHeight} />
|
|
140
140
|
{/snippet}
|
|
141
141
|
|
|
142
142
|
{#snippet defaultUserMessage({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { TransitionProps } from '$lib/types';
|
|
3
3
|
import { X } from '@lucide/svelte';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
export type DrawerPlacement = 'left' | 'right';
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type DrawerProps = TransitionProps & {
|
|
15
15
|
class?: string;
|
|
16
16
|
b_open: boolean;
|
|
17
|
-
title?: string;
|
|
17
|
+
title?: string | Snippet;
|
|
18
18
|
children: Snippet;
|
|
19
19
|
placement?: DrawerPlacement;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
@@ -42,8 +42,6 @@
|
|
|
42
42
|
{#if b_open}
|
|
43
43
|
<Portal>
|
|
44
44
|
<HiddenBackground {onclose}>
|
|
45
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
46
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
47
45
|
<div
|
|
48
46
|
class={twMerge(
|
|
49
47
|
clsx([
|
|
@@ -54,13 +52,19 @@
|
|
|
54
52
|
])
|
|
55
53
|
)}
|
|
56
54
|
onclick={(e) => e.stopPropagation()}
|
|
57
|
-
in:inTransition
|
|
58
|
-
out:outTransition
|
|
55
|
+
in:inTransition|global
|
|
56
|
+
out:outTransition|global
|
|
59
57
|
{...rest}
|
|
60
58
|
>
|
|
61
59
|
<div class="flex flex-row items-center justify-between gap-8">
|
|
62
60
|
{#if title}
|
|
63
|
-
<Heading>
|
|
61
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
62
|
+
{#if typeof title === 'function'}
|
|
63
|
+
{@render title()}
|
|
64
|
+
{:else}
|
|
65
|
+
{title}
|
|
66
|
+
{/if}
|
|
67
|
+
</Heading>
|
|
64
68
|
{/if}
|
|
65
69
|
<button class="group ml-auto flex justify-end" type="button" onclick={onclose}>
|
|
66
70
|
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { TransitionProps } from '$lib/types';
|
|
3
3
|
import { X } from '@lucide/svelte';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { type Snippet } from 'svelte';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { Heading, HiddenBackground, Portal } from '..';
|
|
10
10
|
|
|
11
11
|
/** Props for the modal, expose if you overwrite the defaults in a custom component */
|
|
12
|
-
export
|
|
12
|
+
export type ModalProps = TransitionProps & {
|
|
13
13
|
/** Class of the modal itself, does not apply to the inner div */
|
|
14
14
|
class?: ClassValue;
|
|
15
15
|
/** Class of the div wrapping the children */
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
preventClosing?: boolean;
|
|
23
23
|
/** Variant of the modal, applies styling to the header */
|
|
24
24
|
variant?: ModalVariant;
|
|
25
|
-
title?: string;
|
|
26
|
-
|
|
25
|
+
title?: string | Snippet;
|
|
26
|
+
onclick?: MouseEventHandler<HTMLDivElement>;
|
|
27
|
+
};
|
|
27
28
|
|
|
28
29
|
export type ModalVariant = 'success' | 'warning' | 'error' | 'info';
|
|
29
30
|
</script>
|
|
@@ -73,14 +74,10 @@
|
|
|
73
74
|
class="flex h-full w-full flex-col items-center justify-start p-8 lg:p-12 xl:p-16"
|
|
74
75
|
>
|
|
75
76
|
{#if modal}
|
|
76
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
77
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
78
77
|
<div {...rest} {onclick}>
|
|
79
78
|
{@render modal()}
|
|
80
79
|
</div>
|
|
81
80
|
{:else}
|
|
82
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
83
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
84
81
|
<div
|
|
85
82
|
class={twMerge(
|
|
86
83
|
clsx([
|
|
@@ -104,7 +101,13 @@
|
|
|
104
101
|
]}
|
|
105
102
|
>
|
|
106
103
|
{#if title}
|
|
107
|
-
<Heading>
|
|
104
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
105
|
+
{#if typeof title === 'function'}
|
|
106
|
+
{@render title()}
|
|
107
|
+
{:else}
|
|
108
|
+
{title}
|
|
109
|
+
{/if}
|
|
110
|
+
</Heading>
|
|
108
111
|
{/if}
|
|
109
112
|
<button
|
|
110
113
|
class="group ml-auto flex justify-end"
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { IvoryComponent } from '$lib/types';
|
|
3
2
|
import clsx from 'clsx';
|
|
4
3
|
import type { Snippet } from 'svelte';
|
|
5
|
-
import type { ClassValue } from 'svelte/elements';
|
|
4
|
+
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
6
5
|
import { twMerge } from 'tailwind-merge';
|
|
7
6
|
import Popover, { type PopoverPlacement } from '../popover/Popover.svelte';
|
|
8
7
|
import Portal from '../portal/Portal.svelte';
|
|
9
8
|
|
|
10
|
-
export interface TooltipProps
|
|
9
|
+
export interface TooltipProps {
|
|
10
|
+
onclick?: MouseEventHandler<HTMLElement>;
|
|
11
|
+
class?: ClassValue;
|
|
12
|
+
style?: string;
|
|
11
13
|
children?: Snippet;
|
|
12
14
|
/** The content of the tooltip */
|
|
13
15
|
tooltip: string | Snippet;
|
|
@@ -67,8 +69,6 @@
|
|
|
67
69
|
@component
|
|
68
70
|
Shows additional information when hovering over an element.
|
|
69
71
|
-->
|
|
70
|
-
<!-- Ignoring this error is fine since it's a false positive -->
|
|
71
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
72
72
|
<svelte:element
|
|
73
73
|
this={href ? 'a' : rest.onclick ? 'button' : 'div'}
|
|
74
74
|
type={rest.onclick ? 'button' : undefined}
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
}: ColumnProps = $props();
|
|
37
37
|
|
|
38
38
|
// Register the new column if this is the first table row that was rendered
|
|
39
|
-
const {
|
|
40
|
-
const column =
|
|
39
|
+
const { registerColumn, nestingInset } = getTableContext();
|
|
40
|
+
const column = registerColumn({ resizable, ...props });
|
|
41
41
|
const allowClicking = $derived(!!onclick);
|
|
42
42
|
|
|
43
43
|
// passes updated props to the column
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import { getContext, setContext, type Snippet } from 'svelte';
|
|
3
3
|
import { resize } from '../../utils/actions';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ColumnController } from './columnController.svelte';
|
|
5
5
|
|
|
6
6
|
const CONTEXT = {};
|
|
7
|
-
function setColumnHeadContext(column:
|
|
7
|
+
function setColumnHeadContext(column: ColumnController) {
|
|
8
8
|
setContext(CONTEXT, column);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function getColumnHeadContext():
|
|
11
|
+
export function getColumnHeadContext(): ColumnController {
|
|
12
12
|
return getContext(CONTEXT);
|
|
13
13
|
}
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<script lang="ts">
|
|
17
17
|
type Props = {
|
|
18
|
-
column:
|
|
18
|
+
column: ColumnController;
|
|
19
19
|
children: Snippet;
|
|
20
20
|
};
|
|
21
21
|
|