@ims360/svelte-ivory 0.0.42 → 0.0.44
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 +1 -1
- package/dist/components/ai/Chat.svelte.d.ts +3 -1
- package/dist/components/ai/Chat.svelte.d.ts.map +1 -1
- package/dist/components/layout/drawer/Drawer.svelte +13 -7
- 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 -5
- 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/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 -3
- package/package.json +1 -1
- package/src/lib/components/ai/Chat.svelte +1 -1
- package/src/lib/components/layout/drawer/Drawer.svelte +13 -7
- package/src/lib/components/layout/modal/Modal.svelte +12 -5
- package/src/lib/components/table/plugins/search.svelte.ts +3 -3
|
@@ -35,7 +35,9 @@ interface Props {
|
|
|
35
35
|
* Comes with default styles for the chat messages, but can be customized with the `userMessage` and `systemMessage` props.
|
|
36
36
|
* The input component has to be provided as a child component, and the `submit` function has to be provided as a callback.
|
|
37
37
|
*/
|
|
38
|
-
declare const Chat: import("svelte").Component<Props, {
|
|
38
|
+
declare const Chat: import("svelte").Component<Props, {
|
|
39
|
+
scrollToBottom: () => Promise<void>;
|
|
40
|
+
}, "b_chat">;
|
|
39
41
|
type Chat = ReturnType<typeof Chat>;
|
|
40
42
|
export default Chat;
|
|
41
43
|
//# sourceMappingURL=Chat.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/ai/Chat.svelte.ts"],"names":[],"mappings":"AAII,OAAO,EAA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,IAAI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { TransitionProps } from '../../../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">
|
|
@@ -54,13 +54,19 @@
|
|
|
54
54
|
])
|
|
55
55
|
)}
|
|
56
56
|
onclick={(e) => e.stopPropagation()}
|
|
57
|
-
in:inTransition
|
|
58
|
-
out:outTransition
|
|
57
|
+
in:inTransition|global
|
|
58
|
+
out:outTransition|global
|
|
59
59
|
{...rest}
|
|
60
60
|
>
|
|
61
61
|
<div class="flex flex-row items-center justify-between gap-8">
|
|
62
62
|
{#if title}
|
|
63
|
-
<Heading>
|
|
63
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
64
|
+
{#if typeof title === 'function'}
|
|
65
|
+
{@render title()}
|
|
66
|
+
{:else}
|
|
67
|
+
{title}
|
|
68
|
+
{/if}
|
|
69
|
+
</Heading>
|
|
64
70
|
{/if}
|
|
65
71
|
<button class="group ml-auto flex justify-end" type="button" onclick={onclose}>
|
|
66
72
|
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TransitionProps } from '../../../types';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export type DrawerPlacement = 'left' | 'right';
|
|
4
|
-
export
|
|
4
|
+
export type DrawerProps = TransitionProps & {
|
|
5
5
|
class?: string;
|
|
6
6
|
b_open: boolean;
|
|
7
|
-
title?: string;
|
|
7
|
+
title?: string | Snippet;
|
|
8
8
|
children: Snippet;
|
|
9
9
|
placement?: DrawerPlacement;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
declare const Drawer: import("svelte").Component<DrawerProps, {}, "b_open">;
|
|
12
12
|
type Drawer = ReturnType<typeof Drawer>;
|
|
13
13
|
export default Drawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAOtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AA0DN,QAAA,MAAM,MAAM,uDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { TransitionProps } from '../../../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>
|
|
@@ -104,7 +105,13 @@
|
|
|
104
105
|
]}
|
|
105
106
|
>
|
|
106
107
|
{#if title}
|
|
107
|
-
<Heading>
|
|
108
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
109
|
+
{#if typeof title === 'function'}
|
|
110
|
+
{@render title()}
|
|
111
|
+
{:else}
|
|
112
|
+
{title}
|
|
113
|
+
{/if}
|
|
114
|
+
</Heading>
|
|
108
115
|
{/if}
|
|
109
116
|
<button
|
|
110
117
|
class="group ml-auto flex justify-end"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TransitionProps } from '../../../types';
|
|
2
2
|
import { type Snippet } from 'svelte';
|
|
3
|
-
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
4
4
|
/** Props for the modal, expose if you overwrite the defaults in a custom component */
|
|
5
|
-
export
|
|
5
|
+
export type ModalProps = TransitionProps & {
|
|
6
6
|
/** Class of the modal itself, does not apply to the inner div */
|
|
7
7
|
class?: ClassValue;
|
|
8
8
|
/** Class of the div wrapping the children */
|
|
@@ -15,8 +15,9 @@ export interface ModalProps extends IvoryComponent<HTMLDivElement>, TransitionPr
|
|
|
15
15
|
preventClosing?: boolean;
|
|
16
16
|
/** Variant of the modal, applies styling to the header */
|
|
17
17
|
variant?: ModalVariant;
|
|
18
|
-
title?: string;
|
|
19
|
-
|
|
18
|
+
title?: string | Snippet;
|
|
19
|
+
onclick?: MouseEventHandler<HTMLDivElement>;
|
|
20
|
+
};
|
|
20
21
|
export type ModalVariant = 'success' | 'warning' | 'error' | 'info';
|
|
21
22
|
interface Props extends ModalProps {
|
|
22
23
|
/** If you don't want the title and close button to be included you can overwrite the default modal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKrE,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACvC,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,UAAU,KAAM,SAAQ,UAAU;IAC9B,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AA0FL,oFAAoF;AACpF,QAAA,MAAM,KAAK,iDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -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,CA8BzF;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;;;CA8B7C,CAAC"}
|
|
@@ -30,14 +30,14 @@ export function searchPlugin(conf) {
|
|
|
30
30
|
/** collapses everything that doesnt match the searchString, expands direct search hit */
|
|
31
31
|
export const search = (nodes, searchString, stringsMatch) => {
|
|
32
32
|
const search = searchString.trim().toLowerCase();
|
|
33
|
-
const hidden = new
|
|
34
|
-
const expanded = new
|
|
33
|
+
const hidden = new SvelteSet();
|
|
34
|
+
const expanded = new SvelteSet();
|
|
35
35
|
function nodeMatches(node, childOfMatch = false) {
|
|
36
36
|
const matches = stringsMatch(node, search);
|
|
37
37
|
let intermediate = false;
|
|
38
38
|
for (const child of node.children || []) {
|
|
39
39
|
const childMatches = nodeMatches(child, matches || childOfMatch);
|
|
40
|
-
if (childMatches
|
|
40
|
+
if (childMatches)
|
|
41
41
|
intermediate = true;
|
|
42
42
|
}
|
|
43
43
|
if (intermediate) {
|
package/package.json
CHANGED
|
@@ -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">
|
|
@@ -54,13 +54,19 @@
|
|
|
54
54
|
])
|
|
55
55
|
)}
|
|
56
56
|
onclick={(e) => e.stopPropagation()}
|
|
57
|
-
in:inTransition
|
|
58
|
-
out:outTransition
|
|
57
|
+
in:inTransition|global
|
|
58
|
+
out:outTransition|global
|
|
59
59
|
{...rest}
|
|
60
60
|
>
|
|
61
61
|
<div class="flex flex-row items-center justify-between gap-8">
|
|
62
62
|
{#if title}
|
|
63
|
-
<Heading>
|
|
63
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
64
|
+
{#if typeof title === 'function'}
|
|
65
|
+
{@render title()}
|
|
66
|
+
{:else}
|
|
67
|
+
{title}
|
|
68
|
+
{/if}
|
|
69
|
+
</Heading>
|
|
64
70
|
{/if}
|
|
65
71
|
<button class="group ml-auto flex justify-end" type="button" onclick={onclose}>
|
|
66
72
|
<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>
|
|
@@ -104,7 +105,13 @@
|
|
|
104
105
|
]}
|
|
105
106
|
>
|
|
106
107
|
{#if title}
|
|
107
|
-
<Heading>
|
|
108
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
109
|
+
{#if typeof title === 'function'}
|
|
110
|
+
{@render title()}
|
|
111
|
+
{:else}
|
|
112
|
+
{title}
|
|
113
|
+
{/if}
|
|
114
|
+
</Heading>
|
|
108
115
|
{/if}
|
|
109
116
|
<button
|
|
110
117
|
class="group ml-auto flex justify-end"
|
|
@@ -45,8 +45,8 @@ export const search = <T extends TableRow<T>>(
|
|
|
45
45
|
stringsMatch: (a: T, b: string) => boolean
|
|
46
46
|
) => {
|
|
47
47
|
const search = searchString.trim().toLowerCase();
|
|
48
|
-
const hidden = new
|
|
49
|
-
const expanded = new
|
|
48
|
+
const hidden = new SvelteSet<string>();
|
|
49
|
+
const expanded = new SvelteSet<string>();
|
|
50
50
|
|
|
51
51
|
function nodeMatches(node: T, childOfMatch = false): boolean {
|
|
52
52
|
const matches = stringsMatch(node, search);
|
|
@@ -54,7 +54,7 @@ export const search = <T extends TableRow<T>>(
|
|
|
54
54
|
let intermediate = false;
|
|
55
55
|
for (const child of node.children || []) {
|
|
56
56
|
const childMatches = nodeMatches(child, matches || childOfMatch);
|
|
57
|
-
if (childMatches
|
|
57
|
+
if (childMatches) intermediate = true;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
if (intermediate) {
|