@skeletonlabs/skeleton 1.7.1 → 1.8.0-dev.2c3d2fbb

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 (51) hide show
  1. package/dist/actions/Clipboard/additional-svelte-typings.d.ts +2 -2
  2. package/dist/actions/Clipboard/clipboard.d.ts +8 -2
  3. package/dist/actions/Clipboard/clipboard.js +8 -5
  4. package/dist/actions/Filters/filter.d.ts +5 -2
  5. package/dist/components/Accordion/AccordionItem.svelte +1 -1
  6. package/dist/components/Accordion/AccordionItem.svelte.d.ts +7 -0
  7. package/dist/components/AppRail/AppRailTile.svelte +2 -0
  8. package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +1 -1
  9. package/dist/components/Avatar/Avatar.svelte +2 -0
  10. package/dist/components/Avatar/Avatar.svelte.d.ts +2 -2
  11. package/dist/components/ConicGradient/ConicGradient.svelte +2 -0
  12. package/dist/components/InputChip/InputChip.svelte +5 -5
  13. package/dist/components/InputChip/InputChip.svelte.d.ts +15 -0
  14. package/dist/components/Paginator/Paginator.svelte +8 -0
  15. package/dist/components/Paginator/Paginator.svelte.d.ts +10 -2
  16. package/dist/components/Radio/RadioGroup.svelte +3 -1
  17. package/dist/components/Ratings/Ratings.svelte +42 -0
  18. package/dist/components/Ratings/Ratings.svelte.d.ts +41 -0
  19. package/dist/components/SlideToggle/SlideToggle.svelte +3 -2
  20. package/dist/components/SlideToggle/SlideToggle.svelte.d.ts +1 -1
  21. package/dist/components/Stepper/Step.svelte.d.ts +2 -2
  22. package/dist/components/Stepper/Stepper.svelte +2 -2
  23. package/dist/components/Stepper/Stepper.svelte.d.ts +19 -2
  24. package/dist/components/Stepper/types.d.ts +20 -4
  25. package/dist/components/Tab/Tab.svelte +2 -1
  26. package/dist/components/Tab/Tab.svelte.d.ts +2 -0
  27. package/dist/components/Tab/TabAnchor.svelte +44 -0
  28. package/dist/components/Tab/TabAnchor.svelte.d.ts +44 -0
  29. package/dist/components/Tab/TabGroup.svelte +2 -0
  30. package/dist/components/Table/Table.svelte.d.ts +1 -1
  31. package/dist/components/TableOfContents/TableOfContents.svelte +2 -0
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.js +2 -0
  34. package/dist/styles/partials/typography-prose.css +3 -3
  35. package/dist/tailwind/generated/intellisense-classes.cjs +1 -1
  36. package/dist/tailwind/generated/intellisense-classes.d.cts +2038 -237
  37. package/dist/utilities/CodeBlock/CodeBlock.svelte +1 -1
  38. package/dist/utilities/CodeBlock/CodeBlock.svelte.d.ts +2 -2
  39. package/dist/utilities/DataTable/DataTable.d.ts +2 -1
  40. package/dist/utilities/Drawer/Drawer.svelte +6 -2
  41. package/dist/utilities/Drawer/Drawer.svelte.d.ts +2 -2
  42. package/dist/utilities/Drawer/stores.d.ts +2 -1
  43. package/dist/utilities/LightSwitch/lightswitch.d.ts +1 -0
  44. package/dist/utilities/Modal/Modal.svelte +5 -3
  45. package/dist/utilities/Modal/Modal.svelte.d.ts +1 -1
  46. package/dist/utilities/Modal/stores.d.ts +2 -1
  47. package/dist/utilities/Toast/Toast.svelte +30 -11
  48. package/dist/utilities/Toast/stores.d.ts +8 -3
  49. package/dist/utilities/Toast/stores.js +32 -14
  50. package/dist/utilities/Toast/types.d.ts +4 -0
  51. package/package.json +26 -26
@@ -32,7 +32,7 @@ function onCopyClick() {
32
32
  setTimeout(() => {
33
33
  copyState = false;
34
34
  }, 2e3);
35
- dispatch("copy", {});
35
+ dispatch("copy");
36
36
  }
37
37
  $:
38
38
  if ($storeHighlightJs !== void 0) {
@@ -28,8 +28,8 @@ declare const __propDef: {
28
28
  buttonCopied?: string | undefined;
29
29
  };
30
30
  events: {
31
- /** {{}} copy - Fires when the Copy button is pressed.*/
32
- copy: CustomEvent<any>;
31
+ /** {} copy - Fires when the Copy button is pressed.*/
32
+ copy: CustomEvent<never>;
33
33
  } & {
34
34
  [evt: string]: CustomEvent<any>;
35
35
  };
@@ -1,9 +1,10 @@
1
+ /// <reference types="svelte" />
1
2
  import type { DataTableModel, DataTableOptions } from './types.js';
2
3
  export * from './types.js';
3
4
  export * from './actions.js';
4
5
  /** Creates the writeable store for the data table */
5
6
  export declare function createDataTableStore<T extends Record<PropertyKey, any>>(source: T[], options?: DataTableOptions<T>): {
6
- subscribe: (this: void, run: import("svelte/store").Subscriber<DataTableModel<T>>, invalidate?: ((value?: DataTableModel<T> | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
7
+ subscribe: (this: void, run: import("svelte/store").Subscriber<DataTableModel<T>>, invalidate?: import("svelte/store").Invalidator<DataTableModel<T>> | undefined) => import("svelte/store").Unsubscriber;
7
8
  set: (this: void, value: DataTableModel<T>) => void;
8
9
  /** Sets a new data source while maintaining the state of the original source */
9
10
  updateSource: (data: T[]) => void;
@@ -7,7 +7,7 @@ import { drawerStore } from "./stores.js";
7
7
  export let position = "left";
8
8
  export let duration = 150;
9
9
  export let bgBackdrop = "bg-surface-backdrop-token";
10
- export let blur = "backdrop-blur-xs";
10
+ export let blur = "";
11
11
  export let padding = "";
12
12
  export let bgDrawer = "bg-surface-100-800-token";
13
13
  export let border = "";
@@ -124,6 +124,8 @@ $:
124
124
 
125
125
  {#if $drawerStore.open === true}
126
126
  <!-- Backdrop -->
127
+ <!-- TODO: Remove for V2 -->
128
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
127
129
  <div
128
130
  bind:this={elemBackdrop}
129
131
  class="drawer-backdrop {classesBackdrop}"
@@ -136,6 +138,7 @@ $:
136
138
  use:focusTrap={true}
137
139
  >
138
140
  <!-- Drawer -->
141
+ <!-- separate In/Out so anim values update -->
139
142
  <div
140
143
  bind:this={elemDrawer}
141
144
  class="drawer {classesDrawer}"
@@ -144,7 +147,8 @@ $:
144
147
  aria-modal="true"
145
148
  aria-labelledby={labelledby}
146
149
  aria-describedby={describedby}
147
- transition:fly|local={{ x: anim.x, y: anim.y, duration }}
150
+ in:fly|local={{ x: anim.x, y: anim.y, duration }}
151
+ out:fly|local={{ x: anim.x, y: anim.y, duration }}
148
152
  >
149
153
  <!-- Slot: Default -->
150
154
  <slot />
@@ -40,9 +40,9 @@ declare const __propDef: {
40
40
  touchend: TouchEvent;
41
41
  keypress: KeyboardEvent;
42
42
  /** {{ event }} backdrop - Fires on backdrop interaction.*/
43
- backdrop: CustomEvent<any>;
43
+ backdrop: CustomEvent<MouseEvent>;
44
44
  /** {{ event }} drawer - Fires on drawer interaction.*/
45
- drawer: CustomEvent<any>;
45
+ drawer: CustomEvent<MouseEvent>;
46
46
  } & {
47
47
  [evt: string]: CustomEvent<any>;
48
48
  };
@@ -1,6 +1,7 @@
1
+ /// <reference types="svelte" />
1
2
  import type { DrawerSettings } from './types.js';
2
3
  export declare const drawerStore: {
3
- subscribe: (this: void, run: import("svelte/store").Subscriber<DrawerSettings>, invalidate?: ((value?: DrawerSettings | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
4
+ subscribe: (this: void, run: import("svelte/store").Subscriber<DrawerSettings>, invalidate?: import("svelte/store").Invalidator<DrawerSettings> | undefined) => import("svelte/store").Unsubscriber;
4
5
  set: (this: void, value: DrawerSettings) => void;
5
6
  update: (this: void, updater: import("svelte/store").Updater<DrawerSettings>) => void;
6
7
  /** Open the drawer. */
@@ -1,3 +1,4 @@
1
+ /// <reference types="svelte" />
1
2
  /** Store: OS Preference Mode */
2
3
  export declare const modeOsPrefers: import("svelte/store").Writable<boolean>;
3
4
  /** Store: User Preference Mode */
@@ -135,6 +135,8 @@ $:
135
135
  {#if $modalStore.length > 0}
136
136
  {#key $modalStore}
137
137
  <!-- Backdrop -->
138
+ <!-- TODO: Remove for V2 -->
139
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
138
140
  <div
139
141
  class="modal-backdrop {classesBackdrop}"
140
142
  data-testid="modal-backdrop"
@@ -142,11 +144,11 @@ $:
142
144
  on:mouseup={onBackdropInteractionEnd}
143
145
  on:touchstart
144
146
  on:touchend
145
- transition:fade={{ duration }}
147
+ transition:fade|global={{ duration }}
146
148
  use:focusTrap={true}
147
149
  >
148
150
  <!-- Transition Layer -->
149
- <div class="modal-transition {classesTransitionLayer}" transition:fly={{ duration, opacity: flyOpacity, x: flyX, y: flyY }}>
151
+ <div class="modal-transition {classesTransitionLayer}" transition:fly|global={{ duration, opacity: flyOpacity, x: flyX, y: flyY }}>
150
152
  {#if $modalStore[0].type !== 'component'}
151
153
  <!-- Modal: Presets -->
152
154
  <div
@@ -155,7 +157,7 @@ $:
155
157
  role="dialog"
156
158
  aria-modal="true"
157
159
  aria-label={$modalStore[0].title ?? ''}
158
- transition:fly={{ duration, opacity: 0, y: 100 }}
160
+ transition:fly|global={{ duration, opacity: 0, y: 100 }}
159
161
  >
160
162
  <!-- Header -->
161
163
  {#if $modalStore[0]?.title}
@@ -54,7 +54,7 @@ declare const __propDef: {
54
54
  touchstart: TouchEvent;
55
55
  touchend: TouchEvent;
56
56
  /** {{ event }} backdrop - Fires on backdrop interaction.*/
57
- backdrop: CustomEvent<any>;
57
+ backdrop: CustomEvent<MouseEvent>;
58
58
  } & {
59
59
  [evt: string]: CustomEvent<any>;
60
60
  };
@@ -1,6 +1,7 @@
1
+ /// <reference types="svelte" />
1
2
  import type { ModalSettings } from './types.js';
2
3
  export declare const modalStore: {
3
- subscribe: (this: void, run: import("svelte/store").Subscriber<ModalSettings[]>, invalidate?: ((value?: ModalSettings[] | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
4
+ subscribe: (this: void, run: import("svelte/store").Subscriber<ModalSettings[]>, invalidate?: import("svelte/store").Invalidator<ModalSettings[]> | undefined) => import("svelte/store").Unsubscriber;
4
5
  set: (this: void, value: ModalSettings[]) => void;
5
6
  update: (this: void, updater: import("svelte/store").Updater<ModalSettings[]>) => void;
6
7
  /** Append to end of queue. */
@@ -69,6 +69,18 @@ function onAction(index) {
69
69
  $toastStore[index]?.action?.response();
70
70
  toastStore.close($toastStore[index].id);
71
71
  }
72
+ function onMouseEnter(index) {
73
+ if ($toastStore[index]?.hoverable) {
74
+ toastStore.freeze(index);
75
+ classesSnackbar += " scale-[105%]";
76
+ }
77
+ }
78
+ function onMouseLeave(index) {
79
+ if ($toastStore[index]?.hoverable) {
80
+ toastStore.unfreeze(index);
81
+ classesSnackbar = classesSnackbar.replace(" scale-[105%]", "");
82
+ }
83
+ }
72
84
  $:
73
85
  classesWrapper = `${cWrapper} ${cPosition} ${zIndex} ${$$props.class || ""}`;
74
86
  $:
@@ -100,19 +112,26 @@ const [send, receive] = crossfade({
100
112
  <!-- List -->
101
113
  <div class="snackbar {classesSnackbar}">
102
114
  {#each filteredToasts as t, i (t)}
103
- <div animate:flip={{ duration }} in:receive={{ key: t.id }} out:send={{ key: t.id }}>
115
+ <div
116
+ animate:flip={{ duration }}
117
+ in:receive|global={{ key: t.id }}
118
+ out:send|global={{ key: t.id }}
119
+ on:mouseenter={() => onMouseEnter(i)}
120
+ on:mouseleave={() => onMouseLeave(i)}
121
+ role={t.hideDismiss ? 'alert' : 'alertdialog'}
122
+ aria-live="polite"
123
+ >
104
124
  <!-- Toast -->
105
- <div
106
- class="toast {classesToast} {t.background ?? background} {t.classes ?? ''}"
107
- role="alert"
108
- aria-live="polite"
109
- data-testid="toast"
110
- >
125
+ <div class="toast {classesToast} {t.background ?? background} {t.classes ?? ''}" data-testid="toast">
111
126
  <div class="text-base">{@html t.message}</div>
112
- <div class="toast-actions {cToastActions}">
113
- {#if t.action}<button class={buttonAction} on:click={() => onAction(i)}>{@html t.action.label}</button>{/if}
114
- <button class={buttonDismiss} on:click={() => toastStore.close(t.id)}>{buttonDismissLabel}</button>
115
- </div>
127
+ {#if t.action || !t.hideDismiss}
128
+ <div class="toast-actions {cToastActions}">
129
+ {#if t.action}<button class={buttonAction} on:click={() => onAction(i)}>{@html t.action.label}</button>{/if}
130
+ {#if !t.hideDismiss}<button class={buttonDismiss} aria-label="Dismiss toast" on:click={() => toastStore.close(t.id)}
131
+ >{buttonDismissLabel}</button
132
+ >{/if}
133
+ </div>
134
+ {/if}
116
135
  </div>
117
136
  </div>
118
137
  {/each}
@@ -1,10 +1,15 @@
1
+ /// <reference types="svelte" />
1
2
  import type { ToastSettings, Toast } from './types.js';
2
3
  export declare const toastStore: {
3
- subscribe: (this: void, run: import("svelte/store").Subscriber<Toast[]>, invalidate?: ((value?: Toast[] | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
4
+ subscribe: (this: void, run: import("svelte/store").Subscriber<Toast[]>, invalidate?: import("svelte/store").Invalidator<Toast[]> | undefined) => import("svelte/store").Unsubscriber;
4
5
  /** Add a new toast to the queue. */
5
- trigger: (toast: ToastSettings) => void;
6
- /** Remove first toast in queue */
6
+ trigger: (toast: ToastSettings) => string;
7
+ /** Remove toast in queue*/
7
8
  close: (id: string) => void;
9
+ /** remain visible on hover */
10
+ freeze: (index: number) => void;
11
+ /** cancel remain visible on leave */
12
+ unfreeze: (index: number) => void;
8
13
  /** Remove all toasts from queue */
9
14
  clear: () => void;
10
15
  };
@@ -19,21 +19,27 @@ function toastService() {
19
19
  return {
20
20
  subscribe,
21
21
  /** Add a new toast to the queue. */
22
- trigger: (toast) => update((tStore) => {
22
+ trigger: (toast) => {
23
23
  const id = randomUUID();
24
- // Trigger Callback
25
- if (toast && toast.callback)
26
- toast.callback({ id, status: 'queued' });
27
- // Merge with defaults
28
- const tMerged = { ...toastDefaults, ...toast, id };
29
- // Handle auto-hide, if needed
30
- tMerged.timeoutId = handleAutoHide(tMerged);
31
- // Push into store
32
- tStore.push(tMerged);
33
- // Return
34
- return tStore;
35
- }),
36
- /** Remove first toast in queue */
24
+ update((tStore) => {
25
+ // Trigger Callback
26
+ if (toast && toast.callback)
27
+ toast.callback({ id, status: 'queued' });
28
+ // activate autohide when dismiss button is hidden.
29
+ if (toast.hideDismiss)
30
+ toast.autohide = true;
31
+ // Merge with defaults
32
+ const tMerged = { ...toastDefaults, ...toast, id };
33
+ // Handle auto-hide, if needed
34
+ tMerged.timeoutId = handleAutoHide(tMerged);
35
+ // Push into store
36
+ tStore.push(tMerged);
37
+ // Return
38
+ return tStore;
39
+ });
40
+ return id;
41
+ },
42
+ /** Remove toast in queue*/
37
43
  close: (id) => update((tStore) => {
38
44
  if (tStore.length > 0) {
39
45
  const index = tStore.findIndex((t) => t.id === id);
@@ -51,6 +57,18 @@ function toastService() {
51
57
  }
52
58
  return tStore;
53
59
  }),
60
+ /** remain visible on hover */
61
+ freeze: (index) => update((tStore) => {
62
+ if (tStore.length > 0)
63
+ clearTimeout(tStore[index].timeoutId);
64
+ return tStore;
65
+ }),
66
+ /** cancel remain visible on leave */
67
+ unfreeze: (index) => update((tStore) => {
68
+ if (tStore.length > 0)
69
+ tStore[index].timeoutId = handleAutoHide(tStore[index]);
70
+ return tStore;
71
+ }),
54
72
  /** Remove all toasts from queue */
55
73
  clear: () => set([])
56
74
  };
@@ -14,6 +14,10 @@ export interface ToastSettings {
14
14
  /** The function triggered when the button is pressed. */
15
15
  response: () => void;
16
16
  };
17
+ /** Hide dismiss button */
18
+ hideDismiss?: boolean;
19
+ /** Remain visible on Hover */
20
+ hoverable?: boolean;
17
21
  /** Provide arbitrary CSS classes to style the toast. */
18
22
  classes?: string;
19
23
  /** Callback function that fires on trigger and close. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "1.7.1",
3
+ "version": "1.8.0-dev.2c3d2fbb",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {
@@ -27,39 +27,39 @@
27
27
  "license": "MIT",
28
28
  "homepage": "https://skeleton.dev/",
29
29
  "devDependencies": {
30
- "@floating-ui/dom": "1.2.5",
31
- "@sveltejs/adapter-auto": "2.0.0",
32
- "@sveltejs/kit": "1.15.0",
33
- "@sveltejs/package": "2.0.2",
34
- "@tailwindcss/forms": "0.5.3",
35
- "@tailwindcss/typography": "0.5.9",
36
- "@testing-library/dom": "9.2.0",
37
- "@testing-library/svelte": "3.2.2",
38
- "@typescript-eslint/eslint-plugin": "5.57.0",
39
- "@typescript-eslint/parser": "5.57.0",
40
- "@vitest/coverage-c8": "0.31.0",
30
+ "@sveltejs/adapter-auto": "2.1.0",
31
+ "@sveltejs/kit": "1.20.5",
32
+ "@sveltejs/package": "^2.1.0",
33
+ "@testing-library/dom": "9.3.0",
34
+ "@testing-library/svelte": "4.0.1",
35
+ "@typescript-eslint/eslint-plugin": "5.59.9",
36
+ "@typescript-eslint/parser": "5.59.9",
37
+ "@vitest/coverage-c8": "0.32.0",
41
38
  "autoprefixer": "10.4.14",
42
- "eslint": "8.37.0",
39
+ "eslint": "8.42.0",
43
40
  "eslint-config-prettier": "8.8.0",
44
- "eslint-plugin-svelte": "^2.29.0",
41
+ "eslint-plugin-svelte": "^2.31.0",
45
42
  "jsdom": "21.1.1",
46
- "postcss": "8.4.21",
43
+ "postcss": "8.4.24",
47
44
  "postcss-import": "15.1.0",
48
45
  "postcss-js": "4.0.1",
49
46
  "postcss-load-config": "4.0.1",
50
- "prettier": "2.8.7",
51
- "prettier-plugin-svelte": "2.10.0",
52
- "svelte-check": "3.1.4",
53
- "tailwindcss": "3.3.1",
54
- "tslib": "2.5.0",
55
- "typescript": "4.9.5",
56
- "vite": "4.2.1",
57
- "vitest": "0.31.0"
47
+ "prettier": "2.8.8",
48
+ "prettier-plugin-svelte": "2.10.1",
49
+ "svelte": "4.0.0",
50
+ "svelte-check": "^3.4.4",
51
+ "tailwindcss": "3.3.2",
52
+ "tslib": "2.5.3",
53
+ "typescript": "5.0.3",
54
+ "vite": "4.3.9",
55
+ "vitest": "0.32.0"
58
56
  },
59
57
  "type": "module",
60
58
  "dependencies": {
61
- "esm-env": "1.0.0",
62
- "svelte": "3.58.0"
59
+ "esm-env": "1.0.0"
60
+ },
61
+ "peerDependencies": {
62
+ "svelte": "^3.56.0 || ^4.0.0"
63
63
  },
64
64
  "types": "./dist/index.d.ts",
65
65
  "exports": {
@@ -97,7 +97,7 @@
97
97
  "format": "prettier --ignore-path .prettierignore --write --plugin-search-dir=. .",
98
98
  "test": "vitest",
99
99
  "coverage": "vitest run --coverage",
100
- "sync": "svelte-kit sync",
100
+ "sync": "svelte-kit sync && pnpm build:jss",
101
101
  "build:jss": "node ./scripts/generate-jss.js --package"
102
102
  },
103
103
  "typesVersions": {