@ims360/svelte-ivory 0.0.60 → 0.1.1

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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/dist/components/layout/Heading.svelte +24 -0
  3. package/dist/components/layout/Heading.svelte.d.ts +9 -0
  4. package/dist/components/layout/Heading.svelte.d.ts.map +1 -0
  5. package/dist/components/layout/dialog/Dialog.svelte +79 -0
  6. package/dist/components/layout/dialog/Dialog.svelte.d.ts +9 -0
  7. package/dist/components/layout/dialog/Dialog.svelte.d.ts.map +1 -0
  8. package/dist/components/layout/dialog/index.d.ts +2 -0
  9. package/dist/components/layout/dialog/index.d.ts.map +1 -0
  10. package/dist/components/layout/dialog/index.js +1 -0
  11. package/dist/components/layout/drawer/Drawer.svelte +2 -3
  12. package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
  13. package/dist/components/layout/index.d.ts +3 -3
  14. package/dist/components/layout/index.d.ts.map +1 -1
  15. package/dist/components/layout/index.js +3 -3
  16. package/dist/components/layout/tabs/Tab.svelte +3 -9
  17. package/dist/components/layout/tabs/Tab.svelte.d.ts +0 -1
  18. package/dist/components/layout/tabs/Tab.svelte.d.ts.map +1 -1
  19. package/dist/components/layout/tabs/index.d.ts +3 -14
  20. package/dist/components/layout/tabs/index.d.ts.map +1 -1
  21. package/dist/components/layout/tabs/index.js +3 -12
  22. package/dist/components/table/Column.svelte +3 -8
  23. package/dist/components/table/Column.svelte.d.ts +0 -1
  24. package/dist/components/table/Column.svelte.d.ts.map +1 -1
  25. package/dist/components/table/ColumnHead.svelte +1 -1
  26. package/dist/components/table/Table.svelte +3 -3
  27. package/dist/components/table/columnController.svelte.js +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/theme.svelte.d.ts +24 -0
  32. package/dist/theme.svelte.d.ts.map +1 -0
  33. package/dist/theme.svelte.js +15 -0
  34. package/package.json +1 -1
  35. package/src/lib/components/layout/Heading.svelte +24 -0
  36. package/src/lib/components/layout/dialog/Dialog.svelte +79 -0
  37. package/src/lib/components/layout/dialog/index.ts +1 -0
  38. package/src/lib/components/layout/drawer/Drawer.svelte +2 -3
  39. package/src/lib/components/layout/index.ts +8 -3
  40. package/src/lib/components/layout/tabs/Tab.svelte +3 -9
  41. package/src/lib/components/layout/tabs/index.ts +3 -14
  42. package/src/lib/components/table/Column.svelte +3 -8
  43. package/src/lib/components/table/ColumnHead.svelte +1 -1
  44. package/src/lib/components/table/Table.svelte +3 -3
  45. package/src/lib/components/table/columnController.svelte.ts +1 -1
  46. package/src/lib/index.ts +1 -0
  47. package/src/lib/theme.svelte.ts +38 -0
  48. package/dist/components/layout/heading/Heading.svelte +0 -35
  49. package/dist/components/layout/heading/Heading.svelte.d.ts +0 -16
  50. package/dist/components/layout/heading/Heading.svelte.d.ts.map +0 -1
  51. package/dist/components/layout/heading/index.d.ts +0 -6
  52. package/dist/components/layout/heading/index.d.ts.map +0 -1
  53. package/dist/components/layout/heading/index.js +0 -5
  54. package/dist/components/layout/hiddenBackground/index.d.ts +0 -7
  55. package/dist/components/layout/hiddenBackground/index.d.ts.map +0 -1
  56. package/dist/components/layout/hiddenBackground/index.js +0 -6
  57. package/src/lib/components/layout/heading/Heading.svelte +0 -35
  58. package/src/lib/components/layout/heading/index.ts +0 -7
  59. package/src/lib/components/layout/hiddenBackground/index.ts +0 -8
package/README.md CHANGED
@@ -9,7 +9,7 @@ Eventually we will add more documentation and examples to make it easier for dev
9
9
  Include this line in your `app.css` file, so the TW classes used in the lib are included:
10
10
 
11
11
  ```css
12
- @source "../node_modules/@ims360/svelte-ivory";
12
+ @source '../node_modules/@ims360/svelte-ivory';
13
13
  ```
14
14
 
15
15
  _You may need to adjust the path if your `app.css` is not located in `/src`_
@@ -0,0 +1,24 @@
1
+ <script lang="ts" module>
2
+ import { theme } from '../../theme.svelte';
3
+ import type { IvoryComponent } from '../../types';
4
+ import clsx from 'clsx';
5
+ import type { ClassValue } from 'svelte/elements';
6
+ import { twMerge } from 'tailwind-merge';
7
+
8
+ export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
9
+ class?: ClassValue;
10
+ }
11
+ </script>
12
+
13
+ <script lang="ts">
14
+ let { children, class: clazz, ...rest }: HeadingProps = $props();
15
+ </script>
16
+
17
+ <h2
18
+ class={twMerge(
19
+ clsx('shrink-0 truncate text-lg font-bold select-none', theme.current.heading?.class, clazz)
20
+ )}
21
+ {...rest}
22
+ >
23
+ {@render children?.()}
24
+ </h2>
@@ -0,0 +1,9 @@
1
+ import type { IvoryComponent } from '../../types';
2
+ import type { ClassValue } from 'svelte/elements';
3
+ export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
4
+ class?: ClassValue;
5
+ }
6
+ declare const Heading: import("svelte").Component<HeadingProps, {}, "">;
7
+ type Heading = ReturnType<typeof Heading>;
8
+ export default Heading;
9
+ //# sourceMappingURL=Heading.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Heading.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/Heading.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,kBAAkB,CAAC;IACpE,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB;AAgBL,QAAA,MAAM,OAAO,kDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
@@ -0,0 +1,79 @@
1
+ <script lang="ts" module>
2
+ import { theme } from '../../../theme.svelte';
3
+ import type { IvoryComponent, TransitionProps } from '../../../types';
4
+ import clsx from 'clsx';
5
+ import { onMount, tick } from 'svelte';
6
+ import type { MouseEventHandler } from 'svelte/elements';
7
+ import { fade } from 'svelte/transition';
8
+ import { twMerge } from 'tailwind-merge';
9
+
10
+ export interface DialogProps extends IvoryComponent<HTMLElement>, TransitionProps {
11
+ /** Gets called when the dialog requests to close (Escape, backdrop click) */
12
+ onclose?: () => void;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ let {
18
+ class: clazz,
19
+ onclose: close, // This is the prop from the parent
20
+ children,
21
+ inTransition = (e) => fade(e, { duration: 200 }),
22
+ outTransition = (e) => fade(e, { duration: 200 }),
23
+ ...rest
24
+ }: DialogProps = $props();
25
+
26
+ let dialog = $state<HTMLDialogElement>();
27
+
28
+ /**
29
+ * This function "requests" a close.
30
+ * It tries to stop the native close and lets the parent decide.
31
+ */
32
+ async function requestClose(event: Event) {
33
+ event.preventDefault(); // Stop the native close
34
+ event.stopPropagation();
35
+ close?.(); // Ask the parent to close
36
+ await tick();
37
+ await tick();
38
+
39
+ console.log(dialog);
40
+
41
+ dialog?.showModal();
42
+ }
43
+
44
+ onMount(() => {
45
+ if (dialog && !dialog.open) {
46
+ dialog.showModal();
47
+ }
48
+ return () => {
49
+ if (dialog && dialog.open) {
50
+ dialog.close();
51
+ }
52
+ };
53
+ });
54
+
55
+ const handleBackdropClick: MouseEventHandler<HTMLElement> = (event) => {
56
+ if (event.target === dialog) {
57
+ requestClose(event);
58
+ }
59
+ };
60
+ </script>
61
+
62
+ <dialog
63
+ bind:this={dialog}
64
+ onclick={handleBackdropClick}
65
+ oncancel={requestClose}
66
+ onclose={close}
67
+ class={twMerge(
68
+ clsx(
69
+ 'h-full max-h-none w-screen max-w-full bg-transparent backdrop:bg-black/20',
70
+ theme.current.hiddenBackground?.class,
71
+ clazz
72
+ )
73
+ )}
74
+ in:inTransition
75
+ out:outTransition
76
+ {...rest}
77
+ >
78
+ {@render children?.()}
79
+ </dialog>
@@ -0,0 +1,9 @@
1
+ import type { IvoryComponent, TransitionProps } from '../../../types';
2
+ export interface DialogProps extends IvoryComponent<HTMLElement>, TransitionProps {
3
+ /** Gets called when the dialog requests to close (Escape, backdrop click) */
4
+ onclose?: () => void;
5
+ }
6
+ declare const Dialog: import("svelte").Component<DialogProps, {}, "">;
7
+ type Dialog = ReturnType<typeof Dialog>;
8
+ export default Dialog;
9
+ //# sourceMappingURL=Dialog.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/dialog/Dialog.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlE,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,WAAW,CAAC,EAAE,eAAe;IAC7E,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AA8DL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as Dialog, type DialogProps } from './Dialog.svelte';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ export { default as Dialog } from './Dialog.svelte';
@@ -5,9 +5,8 @@
5
5
  import type { Snippet } from 'svelte';
6
6
  import { fly } from 'svelte/transition';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { Portal } from '..';
9
- import Heading from '../heading';
10
- import HiddenBackground from '../hiddenBackground';
8
+ import { HiddenBackground, Portal } from '..';
9
+ import Heading from '../Heading.svelte';
11
10
 
12
11
  export type DrawerPlacement = 'left' | 'right';
13
12
 
@@ -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,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,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAuEN,QAAA,MAAM,MAAM;;;;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
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;AAMtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAuEN,QAAA,MAAM,MAAM;;;;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -1,9 +1,9 @@
1
1
  export { default as Drawer } from './drawer/Drawer.svelte';
2
- export { default as Heading } from './heading';
3
- export { default as HiddenBackground, type HiddenBackgroundProps } from './hiddenBackground';
2
+ export { default as Heading } from './Heading.svelte';
3
+ export { default as HiddenBackground, type HiddenBackgroundProps } from './hiddenBackground/HiddenBackground.svelte';
4
4
  export { default as Modal, type ModalProps, type ModalVariant } from './modal/Modal.svelte';
5
5
  export { default as Popover, type PopoverPlacement, type PopoverProps } from './popover/Popover.svelte';
6
6
  export { default as Portal } from './portal';
7
- export { getTabContext, default as Tabs, type TabPanelProps, type TabProps, type TabsProps } from './tabs';
7
+ export { getTabContext, Tab, TabPanel, Tabs, type TabPanelProps, type TabProps, type TabsProps } from './tabs';
8
8
  export { default as Tooltip, type TooltipProps } from './tooltip/Tooltip.svelte';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EACH,OAAO,IAAI,OAAO,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACH,aAAa,EACb,OAAO,IAAI,IAAI,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,SAAS,EACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACH,OAAO,IAAI,gBAAgB,EAC3B,KAAK,qBAAqB,EAC7B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EACH,OAAO,IAAI,OAAO,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACH,aAAa,EACb,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,SAAS,EACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  export { default as Drawer } from './drawer/Drawer.svelte';
2
- export { default as Heading } from './heading';
3
- export { default as HiddenBackground } from './hiddenBackground';
2
+ export { default as Heading } from './Heading.svelte';
3
+ export { default as HiddenBackground } from './hiddenBackground/HiddenBackground.svelte';
4
4
  export { default as Modal } from './modal/Modal.svelte';
5
5
  export { default as Popover } from './popover/Popover.svelte';
6
6
  export { default as Portal } from './portal';
7
- export { getTabContext, default as Tabs } from './tabs';
7
+ export { getTabContext, Tab, TabPanel, Tabs } from './tabs';
8
8
  export { default as Tooltip } from './tooltip/Tooltip.svelte';
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" module>
2
2
  import { page } from '$app/state';
3
+ import { theme } from '../../../theme.svelte';
3
4
  import type { IvoryComponent } from '../../../types';
4
5
  import { pseudoRandomId } from '../../../utils/functions/index';
5
6
  import clsx from 'clsx';
@@ -8,14 +9,6 @@
8
9
  import { twMerge } from 'tailwind-merge';
9
10
  import { getTabContext } from './Tabs.svelte';
10
11
 
11
- let defaultClass = $state(
12
- (selected: boolean): ClassValue => [selected ? 'text-primary-500' : '']
13
- );
14
-
15
- export function setDefaultClass(clazz: (selected: boolean) => ClassValue) {
16
- defaultClass = clazz;
17
- }
18
-
19
12
  export interface TabProps extends Omit<IvoryComponent<HTMLElement>, 'children'> {
20
13
  class?: ClassValue | ((selected: boolean) => ClassValue);
21
14
  id?: string | undefined;
@@ -32,7 +25,7 @@
32
25
  </script>
33
26
 
34
27
  <script lang="ts">
35
- let { class: clazz = defaultClass, id, href, children, active }: TabProps = $props();
28
+ let { class: clazz, id, href, children, active }: TabProps = $props();
36
29
 
37
30
  const tab = pseudoRandomId('tab-');
38
31
  const tabs = getTabContext();
@@ -62,6 +55,7 @@
62
55
  class={twMerge(
63
56
  clsx(
64
57
  'btn flex h-fit w-fit shrink-0 items-center justify-center px-0 text-xl font-bold select-none',
58
+ theme.current.tabs?.tab?.class?.(selected),
65
59
  typeof clazz === 'function' ? clazz(selected) : clazz
66
60
  )
67
61
  )}
@@ -1,7 +1,6 @@
1
1
  import type { IvoryComponent } from '../../../types';
2
2
  import { type Snippet } from 'svelte';
3
3
  import type { ClassValue } from 'svelte/elements';
4
- export declare function setDefaultClass(clazz: (selected: boolean) => ClassValue): void;
5
4
  export interface TabProps extends Omit<IvoryComponent<HTMLElement>, 'children'> {
6
5
  class?: ClassValue | ((selected: boolean) => ClassValue);
7
6
  id?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/Tab.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD,wBAAgB,eAAe,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,UAAU,QAEvE;AAED,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAC3E,KAAK,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC;IACzD,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AA+CL,QAAA,MAAM,GAAG,8CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"Tab.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/Tab.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,QAAS,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAC3E,KAAK,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC;IACzD,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IAC3C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAgDL,QAAA,MAAM,GAAG,8CAAwC,CAAC;AAClD,KAAK,GAAG,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAClC,eAAe,GAAG,CAAC"}
@@ -1,15 +1,4 @@
1
- import { setDefaultClass } from './Tab.svelte';
2
- declare const Tabs: import("svelte").Component<import("./Tabs.svelte").TabsProps, {
3
- forward: () => void;
4
- back: () => void;
5
- currentTab: () => number;
6
- }, ""> & {
7
- Tab: import("svelte").Component<import("./Tab.svelte").TabProps, {}, "">;
8
- Panel: import("svelte").Component<import("./TabPanel.svelte").TabPanelProps, {}, "">;
9
- setDefaultTabClass: typeof setDefaultClass;
10
- };
11
- export default Tabs;
12
- export { type TabProps } from './Tab.svelte';
13
- export { type TabPanelProps } from './TabPanel.svelte';
14
- export { getTabContext, type TabContext, type TabsProps } from './Tabs.svelte';
1
+ export { default as Tab, type TabProps } from './Tab.svelte';
2
+ export { default as TabPanel, type TabPanelProps } from './TabPanel.svelte';
3
+ export { getTabContext, default as Tabs, type TabContext, type TabsProps } from './Tabs.svelte';
15
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,QAAA,MAAM,IAAI;;;;;;;;CAIR,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,OAAO,IAAI,IAAI,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -1,12 +1,3 @@
1
- import Tab, { setDefaultClass } from './Tab.svelte';
2
- import TabPanel from './TabPanel.svelte';
3
- import { default as TabsComponent } from './Tabs.svelte';
4
- const Tabs = Object.assign(TabsComponent, {
5
- Tab: Tab,
6
- Panel: TabPanel,
7
- setDefaultTabClass: setDefaultClass
8
- });
9
- export default Tabs;
10
- export {} from './Tab.svelte';
11
- export {} from './TabPanel.svelte';
12
- export { getTabContext } from './Tabs.svelte';
1
+ export { default as Tab } from './Tab.svelte';
2
+ export { default as TabPanel } from './TabPanel.svelte';
3
+ export { getTabContext, default as Tabs } from './Tabs.svelte';
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" module>
2
+ import { theme } from '../../theme.svelte';
2
3
  import clsx from 'clsx';
3
4
  import { type Snippet } from 'svelte';
4
5
  import type { ClassValue } from 'svelte/elements';
@@ -7,12 +8,6 @@
7
8
  import { getRowContext } from './Row.svelte';
8
9
  import { getTableContext } from './Table.svelte';
9
10
 
10
- let defaultClasses = $state<ClassValue>();
11
-
12
- export function setClasses(c: ClassValue) {
13
- defaultClasses = c;
14
- }
15
-
16
11
  export interface ColumnProps extends ColumnConfig {
17
12
  class?: ClassValue;
18
13
  /** If the type is incorrect pass the "row" property with the right type */
@@ -75,8 +70,8 @@
75
70
  class={twMerge(
76
71
  clsx([
77
72
  'box-border flex h-full shrink-0 flex-row items-center justify-start gap-1 truncate',
78
- column.width !== 0 && 'border-r-[calc(var(--spacing)_*_2)] border-transparent',
79
- defaultClasses,
73
+ column.width !== 0 && 'border-r-[calc(var(--spacing)*2)] border-transparent',
74
+ theme.current.table?.column?.class,
80
75
  clazz
81
76
  ])
82
77
  )}
@@ -1,7 +1,6 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import type { ClassValue } from 'svelte/elements';
3
3
  import type { ColumnConfig } from './columnController.svelte';
4
- export declare function setClasses(c: ClassValue): void;
5
4
  export interface ColumnProps extends ColumnConfig {
6
5
  class?: ClassValue;
7
6
  /** If the type is incorrect pass the "row" property with the right type */
@@ -1 +1 @@
1
- {"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Column.svelte.ts"],"names":[],"mappings":"AAII,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,QAEvC;AAED,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2DL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Column.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/Column.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2DL,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -48,7 +48,7 @@
48
48
  <div
49
49
  class={['group flex shrink-0 flex-row justify-start']}
50
50
  bind:this={target}
51
- style="width: {column.width}px;"
51
+ style="width: {column?.width ?? 0}px;"
52
52
  >
53
53
  {@render children?.()}
54
54
  {#if column.resizable}
@@ -191,11 +191,11 @@
191
191
 
192
192
  <VirtualList
193
193
  bind:this={list}
194
+ bind:b_scrollTop
194
195
  data={results.entries}
195
196
  class={twMerge(clsx(['flex flex-col overflow-hidden border-transparent', clazz]))}
196
- bind:b_scrollTop
197
- {rowHeight}
198
197
  rowClass={['pl-2 pr-4', rowClass]}
198
+ {rowHeight}
199
199
  >
200
200
  {#snippet header()}
201
201
  <div
@@ -206,7 +206,7 @@
206
206
  )
207
207
  )}
208
208
  >
209
- {#if treeIndicatorColumn}
209
+ {#if treeIndicatorColumn instanceof ColumnController}
210
210
  <ColumnHead column={treeIndicatorColumn}></ColumnHead>
211
211
  {/if}
212
212
  {#each externalColumns || columns as column (column.id)}
@@ -24,7 +24,7 @@ export class ColumnController {
24
24
  this.minimalWidth = (conf.width ?? DEFAULT_WIDTH) * MINIMAL_WIDTH_MULTIPLIER;
25
25
  }
26
26
  if (this.width === undefined) {
27
- const newWidth = conf.width ?? DEFAULT_WIDTH;
27
+ const newWidth = typeof conf.width === 'undefined' ? DEFAULT_WIDTH : conf.width;
28
28
  this.width = newWidth;
29
29
  }
30
30
  if (!this.header)
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export { theme, type Theme } from './theme.svelte';
1
2
  export { type IvoryComponent } from './types';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  // Reexport your entry components here
2
+ export { theme } from './theme.svelte';
2
3
  export {} from './types';
@@ -0,0 +1,24 @@
1
+ import type { ClassValue } from 'svelte/elements';
2
+ export interface Theme {
3
+ heading?: {
4
+ class?: ClassValue;
5
+ };
6
+ hiddenBackground?: {
7
+ class?: ClassValue;
8
+ };
9
+ tabs?: {
10
+ tab?: {
11
+ class?: (active: boolean) => ClassValue;
12
+ };
13
+ };
14
+ table?: {
15
+ column?: {
16
+ class?: ClassValue;
17
+ };
18
+ };
19
+ }
20
+ export declare const theme: {
21
+ setTheme(newTheme: Theme): void;
22
+ current: Theme;
23
+ };
24
+ //# sourceMappingURL=theme.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.svelte.d.ts","sourceRoot":"","sources":["../src/lib/theme.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,KAAK;IAClB,OAAO,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,UAAU,CAAC;KACtB,CAAC;IACF,gBAAgB,CAAC,EAAE;QACf,KAAK,CAAC,EAAE,UAAU,CAAC;KACtB,CAAC;IACF,IAAI,CAAC,EAAE;QACH,GAAG,CAAC,EAAE;YACF,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,UAAU,CAAC;SAC3C,CAAC;KACL,CAAC;IACF,KAAK,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE;YACL,KAAK,CAAC,EAAE,UAAU,CAAC;SACtB,CAAC;KACL,CAAC;CACL;AAkBD,eAAO,MAAM,KAAK;uBAZS,KAAK;aAGF,KAAK;CASD,CAAC"}
@@ -0,0 +1,15 @@
1
+ function createTheme() {
2
+ let theme = $state({});
3
+ return {
4
+ setTheme(newTheme) {
5
+ theme = newTheme;
6
+ },
7
+ set current(newTheme) {
8
+ theme = newTheme;
9
+ },
10
+ get current() {
11
+ return theme;
12
+ }
13
+ };
14
+ }
15
+ export const theme = createTheme();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ims360/svelte-ivory",
3
- "version": "0.0.60",
3
+ "version": "0.1.1",
4
4
  "keywords": [
5
5
  "svelte"
6
6
  ],
@@ -0,0 +1,24 @@
1
+ <script lang="ts" module>
2
+ import { theme } from '$lib/theme.svelte';
3
+ import type { IvoryComponent } from '$lib/types';
4
+ import clsx from 'clsx';
5
+ import type { ClassValue } from 'svelte/elements';
6
+ import { twMerge } from 'tailwind-merge';
7
+
8
+ export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
9
+ class?: ClassValue;
10
+ }
11
+ </script>
12
+
13
+ <script lang="ts">
14
+ let { children, class: clazz, ...rest }: HeadingProps = $props();
15
+ </script>
16
+
17
+ <h2
18
+ class={twMerge(
19
+ clsx('shrink-0 truncate text-lg font-bold select-none', theme.current.heading?.class, clazz)
20
+ )}
21
+ {...rest}
22
+ >
23
+ {@render children?.()}
24
+ </h2>
@@ -0,0 +1,79 @@
1
+ <script lang="ts" module>
2
+ import { theme } from '$lib/theme.svelte';
3
+ import type { IvoryComponent, TransitionProps } from '$lib/types';
4
+ import clsx from 'clsx';
5
+ import { onMount, tick } from 'svelte';
6
+ import type { MouseEventHandler } from 'svelte/elements';
7
+ import { fade } from 'svelte/transition';
8
+ import { twMerge } from 'tailwind-merge';
9
+
10
+ export interface DialogProps extends IvoryComponent<HTMLElement>, TransitionProps {
11
+ /** Gets called when the dialog requests to close (Escape, backdrop click) */
12
+ onclose?: () => void;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ let {
18
+ class: clazz,
19
+ onclose: close, // This is the prop from the parent
20
+ children,
21
+ inTransition = (e) => fade(e, { duration: 200 }),
22
+ outTransition = (e) => fade(e, { duration: 200 }),
23
+ ...rest
24
+ }: DialogProps = $props();
25
+
26
+ let dialog = $state<HTMLDialogElement>();
27
+
28
+ /**
29
+ * This function "requests" a close.
30
+ * It tries to stop the native close and lets the parent decide.
31
+ */
32
+ async function requestClose(event: Event) {
33
+ event.preventDefault(); // Stop the native close
34
+ event.stopPropagation();
35
+ close?.(); // Ask the parent to close
36
+ await tick();
37
+ await tick();
38
+
39
+ console.log(dialog);
40
+
41
+ dialog?.showModal();
42
+ }
43
+
44
+ onMount(() => {
45
+ if (dialog && !dialog.open) {
46
+ dialog.showModal();
47
+ }
48
+ return () => {
49
+ if (dialog && dialog.open) {
50
+ dialog.close();
51
+ }
52
+ };
53
+ });
54
+
55
+ const handleBackdropClick: MouseEventHandler<HTMLElement> = (event) => {
56
+ if (event.target === dialog) {
57
+ requestClose(event);
58
+ }
59
+ };
60
+ </script>
61
+
62
+ <dialog
63
+ bind:this={dialog}
64
+ onclick={handleBackdropClick}
65
+ oncancel={requestClose}
66
+ onclose={close}
67
+ class={twMerge(
68
+ clsx(
69
+ 'h-full max-h-none w-screen max-w-full bg-transparent backdrop:bg-black/20',
70
+ theme.current.hiddenBackground?.class,
71
+ clazz
72
+ )
73
+ )}
74
+ in:inTransition
75
+ out:outTransition
76
+ {...rest}
77
+ >
78
+ {@render children?.()}
79
+ </dialog>
@@ -0,0 +1 @@
1
+ export { default as Dialog, type DialogProps } from './Dialog.svelte';
@@ -5,9 +5,8 @@
5
5
  import type { Snippet } from 'svelte';
6
6
  import { fly } from 'svelte/transition';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { Portal } from '..';
9
- import Heading from '../heading';
10
- import HiddenBackground from '../hiddenBackground';
8
+ import { HiddenBackground, Portal } from '..';
9
+ import Heading from '../Heading.svelte';
11
10
 
12
11
  export type DrawerPlacement = 'left' | 'right';
13
12
 
@@ -1,6 +1,9 @@
1
1
  export { default as Drawer } from './drawer/Drawer.svelte';
2
- export { default as Heading } from './heading';
3
- export { default as HiddenBackground, type HiddenBackgroundProps } from './hiddenBackground';
2
+ export { default as Heading } from './Heading.svelte';
3
+ export {
4
+ default as HiddenBackground,
5
+ type HiddenBackgroundProps
6
+ } from './hiddenBackground/HiddenBackground.svelte';
4
7
  export { default as Modal, type ModalProps, type ModalVariant } from './modal/Modal.svelte';
5
8
  export {
6
9
  default as Popover,
@@ -10,7 +13,9 @@ export {
10
13
  export { default as Portal } from './portal';
11
14
  export {
12
15
  getTabContext,
13
- default as Tabs,
16
+ Tab,
17
+ TabPanel,
18
+ Tabs,
14
19
  type TabPanelProps,
15
20
  type TabProps,
16
21
  type TabsProps
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" module>
2
2
  import { page } from '$app/state';
3
+ import { theme } from '$lib/theme.svelte';
3
4
  import type { IvoryComponent } from '$lib/types';
4
5
  import { pseudoRandomId } from '$lib/utils/functions/index';
5
6
  import clsx from 'clsx';
@@ -8,14 +9,6 @@
8
9
  import { twMerge } from 'tailwind-merge';
9
10
  import { getTabContext } from './Tabs.svelte';
10
11
 
11
- let defaultClass = $state(
12
- (selected: boolean): ClassValue => [selected ? 'text-primary-500' : '']
13
- );
14
-
15
- export function setDefaultClass(clazz: (selected: boolean) => ClassValue) {
16
- defaultClass = clazz;
17
- }
18
-
19
12
  export interface TabProps extends Omit<IvoryComponent<HTMLElement>, 'children'> {
20
13
  class?: ClassValue | ((selected: boolean) => ClassValue);
21
14
  id?: string | undefined;
@@ -32,7 +25,7 @@
32
25
  </script>
33
26
 
34
27
  <script lang="ts">
35
- let { class: clazz = defaultClass, id, href, children, active }: TabProps = $props();
28
+ let { class: clazz, id, href, children, active }: TabProps = $props();
36
29
 
37
30
  const tab = pseudoRandomId('tab-');
38
31
  const tabs = getTabContext();
@@ -62,6 +55,7 @@
62
55
  class={twMerge(
63
56
  clsx(
64
57
  'btn flex h-fit w-fit shrink-0 items-center justify-center px-0 text-xl font-bold select-none',
58
+ theme.current.tabs?.tab?.class?.(selected),
65
59
  typeof clazz === 'function' ? clazz(selected) : clazz
66
60
  )
67
61
  )}
@@ -1,14 +1,3 @@
1
- import Tab, { setDefaultClass } from './Tab.svelte';
2
- import TabPanel from './TabPanel.svelte';
3
- import { default as TabsComponent } from './Tabs.svelte';
4
-
5
- const Tabs = Object.assign(TabsComponent, {
6
- Tab: Tab,
7
- Panel: TabPanel,
8
- setDefaultTabClass: setDefaultClass
9
- });
10
-
11
- export default Tabs;
12
- export { type TabProps } from './Tab.svelte';
13
- export { type TabPanelProps } from './TabPanel.svelte';
14
- export { getTabContext, type TabContext, type TabsProps } from './Tabs.svelte';
1
+ export { default as Tab, type TabProps } from './Tab.svelte';
2
+ export { default as TabPanel, type TabPanelProps } from './TabPanel.svelte';
3
+ export { getTabContext, default as Tabs, type TabContext, type TabsProps } from './Tabs.svelte';
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" module>
2
+ import { theme } from '$lib/theme.svelte';
2
3
  import clsx from 'clsx';
3
4
  import { type Snippet } from 'svelte';
4
5
  import type { ClassValue } from 'svelte/elements';
@@ -7,12 +8,6 @@
7
8
  import { getRowContext } from './Row.svelte';
8
9
  import { getTableContext } from './Table.svelte';
9
10
 
10
- let defaultClasses = $state<ClassValue>();
11
-
12
- export function setClasses(c: ClassValue) {
13
- defaultClasses = c;
14
- }
15
-
16
11
  export interface ColumnProps extends ColumnConfig {
17
12
  class?: ClassValue;
18
13
  /** If the type is incorrect pass the "row" property with the right type */
@@ -75,8 +70,8 @@
75
70
  class={twMerge(
76
71
  clsx([
77
72
  'box-border flex h-full shrink-0 flex-row items-center justify-start gap-1 truncate',
78
- column.width !== 0 && 'border-r-[calc(var(--spacing)_*_2)] border-transparent',
79
- defaultClasses,
73
+ column.width !== 0 && 'border-r-[calc(var(--spacing)*2)] border-transparent',
74
+ theme.current.table?.column?.class,
80
75
  clazz
81
76
  ])
82
77
  )}
@@ -48,7 +48,7 @@
48
48
  <div
49
49
  class={['group flex shrink-0 flex-row justify-start']}
50
50
  bind:this={target}
51
- style="width: {column.width}px;"
51
+ style="width: {column?.width ?? 0}px;"
52
52
  >
53
53
  {@render children?.()}
54
54
  {#if column.resizable}
@@ -191,11 +191,11 @@
191
191
 
192
192
  <VirtualList
193
193
  bind:this={list}
194
+ bind:b_scrollTop
194
195
  data={results.entries}
195
196
  class={twMerge(clsx(['flex flex-col overflow-hidden border-transparent', clazz]))}
196
- bind:b_scrollTop
197
- {rowHeight}
198
197
  rowClass={['pl-2 pr-4', rowClass]}
198
+ {rowHeight}
199
199
  >
200
200
  {#snippet header()}
201
201
  <div
@@ -206,7 +206,7 @@
206
206
  )
207
207
  )}
208
208
  >
209
- {#if treeIndicatorColumn}
209
+ {#if treeIndicatorColumn instanceof ColumnController}
210
210
  <ColumnHead column={treeIndicatorColumn}></ColumnHead>
211
211
  {/if}
212
212
  {#each externalColumns || columns as column (column.id)}
@@ -38,7 +38,7 @@ export class ColumnController {
38
38
  this.minimalWidth = (conf.width ?? DEFAULT_WIDTH) * MINIMAL_WIDTH_MULTIPLIER;
39
39
  }
40
40
  if (this.width === undefined) {
41
- const newWidth = conf.width ?? DEFAULT_WIDTH;
41
+ const newWidth = typeof conf.width === 'undefined' ? DEFAULT_WIDTH : conf.width;
42
42
  this.width = newWidth;
43
43
  }
44
44
  if (!this.header) this.header = conf.header;
package/src/lib/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  // Reexport your entry components here
2
+ export { theme, type Theme } from './theme.svelte';
2
3
  export { type IvoryComponent } from './types';
@@ -0,0 +1,38 @@
1
+ import type { ClassValue } from 'svelte/elements';
2
+
3
+ export interface Theme {
4
+ heading?: {
5
+ class?: ClassValue;
6
+ };
7
+ hiddenBackground?: {
8
+ class?: ClassValue;
9
+ };
10
+ tabs?: {
11
+ tab?: {
12
+ class?: (active: boolean) => ClassValue;
13
+ };
14
+ };
15
+ table?: {
16
+ column?: {
17
+ class?: ClassValue;
18
+ };
19
+ };
20
+ }
21
+
22
+ function createTheme() {
23
+ let theme = $state<Theme>({});
24
+
25
+ return {
26
+ setTheme(newTheme: Theme) {
27
+ theme = newTheme;
28
+ },
29
+ set current(newTheme: Theme) {
30
+ theme = newTheme;
31
+ },
32
+ get current() {
33
+ return theme;
34
+ }
35
+ };
36
+ }
37
+
38
+ export const theme = createTheme();
@@ -1,35 +0,0 @@
1
- <script lang="ts" module>
2
- import type { IvoryComponent } from '../../../types';
3
- import clsx from 'clsx';
4
- import type { ClassValue } from 'svelte/elements';
5
- import { twMerge } from 'tailwind-merge';
6
-
7
- export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
8
- class?: ClassValue;
9
- }
10
-
11
- export function setClasses(c: ClassValue) {
12
- defaultClasses = c;
13
- }
14
-
15
- let defaultClasses = $state<ClassValue>('');
16
- </script>
17
-
18
- <script lang="ts">
19
- let { children, class: clazz, ...rest }: HeadingProps = $props();
20
- </script>
21
-
22
- <!--
23
- @component
24
- A component for unified headings.
25
- Classes that are set using the `setDefaultClasses` function will be applied to all headings,
26
- including the ones used in other components of this lib, e.g. the `Modal`.
27
- 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`).
28
- -->
29
-
30
- <h2
31
- class={twMerge(clsx('shrink-0 truncate text-lg font-bold select-none', defaultClasses, clazz))}
32
- {...rest}
33
- >
34
- {@render children?.()}
35
- </h2>
@@ -1,16 +0,0 @@
1
- import type { IvoryComponent } from '../../../types';
2
- import type { ClassValue } from 'svelte/elements';
3
- export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
4
- class?: ClassValue;
5
- }
6
- export declare function setClasses(c: ClassValue): void;
7
- /**
8
- * A component for unified headings.
9
- * Classes that are set using the `setDefaultClasses` function will be applied to all headings,
10
- * including the ones used in other components of this lib, e.g. the `Modal`.
11
- * 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`).
12
- */
13
- declare const Heading: import("svelte").Component<HeadingProps, {}, "">;
14
- type Heading = ReturnType<typeof Heading>;
15
- export default Heading;
16
- //# sourceMappingURL=Heading.svelte.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Heading.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/heading/Heading.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,kBAAkB,CAAC;IACpE,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,QAEvC;AAkBL;;;;;GAKG;AACH,QAAA,MAAM,OAAO,kDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
@@ -1,6 +0,0 @@
1
- import { setClasses } from './Heading.svelte';
2
- declare const Heading: import("svelte").Component<import("./Heading.svelte").HeadingProps, {}, ""> & {
3
- setClasses: typeof setClasses;
4
- };
5
- export default Heading;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/heading/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3E,QAAA,MAAM,OAAO;;CAEX,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -1,5 +0,0 @@
1
- import { default as HeadingComponent, setClasses } from './Heading.svelte';
2
- const Heading = Object.assign(HeadingComponent, {
3
- setClasses
4
- });
5
- export default Heading;
@@ -1,7 +0,0 @@
1
- import { setClasses } from './HiddenBackground.svelte';
2
- declare const HiddenBackground: import("svelte").Component<import("./HiddenBackground.svelte").HiddenBackgroundProps, {}, ""> & {
3
- setClasses: typeof setClasses;
4
- };
5
- export default HiddenBackground;
6
- export { type HiddenBackgroundProps } from './HiddenBackground.svelte';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5E,QAAA,MAAM,gBAAgB;;CAEpB,CAAC;AAEH,eAAe,gBAAgB,CAAC;AAChC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,6 +0,0 @@
1
- import { default as HiddenBg, setClasses } from './HiddenBackground.svelte';
2
- const HiddenBackground = Object.assign(HiddenBg, {
3
- setClasses
4
- });
5
- export default HiddenBackground;
6
- export {} from './HiddenBackground.svelte';
@@ -1,35 +0,0 @@
1
- <script lang="ts" module>
2
- import type { IvoryComponent } from '$lib/types';
3
- import clsx from 'clsx';
4
- import type { ClassValue } from 'svelte/elements';
5
- import { twMerge } from 'tailwind-merge';
6
-
7
- export interface HeadingProps extends IvoryComponent<HTMLHeadingElement> {
8
- class?: ClassValue;
9
- }
10
-
11
- export function setClasses(c: ClassValue) {
12
- defaultClasses = c;
13
- }
14
-
15
- let defaultClasses = $state<ClassValue>('');
16
- </script>
17
-
18
- <script lang="ts">
19
- let { children, class: clazz, ...rest }: HeadingProps = $props();
20
- </script>
21
-
22
- <!--
23
- @component
24
- A component for unified headings.
25
- Classes that are set using the `setDefaultClasses` function will be applied to all headings,
26
- including the ones used in other components of this lib, e.g. the `Modal`.
27
- 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`).
28
- -->
29
-
30
- <h2
31
- class={twMerge(clsx('shrink-0 truncate text-lg font-bold select-none', defaultClasses, clazz))}
32
- {...rest}
33
- >
34
- {@render children?.()}
35
- </h2>
@@ -1,7 +0,0 @@
1
- import { default as HeadingComponent, setClasses } from './Heading.svelte';
2
-
3
- const Heading = Object.assign(HeadingComponent, {
4
- setClasses
5
- });
6
-
7
- export default Heading;
@@ -1,8 +0,0 @@
1
- import { default as HiddenBg, setClasses } from './HiddenBackground.svelte';
2
-
3
- const HiddenBackground = Object.assign(HiddenBg, {
4
- setClasses
5
- });
6
-
7
- export default HiddenBackground;
8
- export { type HiddenBackgroundProps } from './HiddenBackground.svelte';