@skeletonlabs/skeleton 2.0.0-rc.3 → 2.0.0

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.
@@ -110,6 +110,12 @@ $:
110
110
  classesChipList = `${cChipList}`;
111
111
  $:
112
112
  classesInputField = `${cInputField}`;
113
+ $:
114
+ chipValues = value?.map((val, i) => {
115
+ if (chipValues[i]?.val === val)
116
+ return chipValues[i];
117
+ return { id: Math.random(), val };
118
+ }) || [];
113
119
  </script>
114
120
 
115
121
  <div class="input-chip {classesBase}" class:opacity-50={$$restProps.disabled}>
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export type { AutocompleteOption } from './components/Autocomplete/types.js';
2
2
  export type { ConicStop } from './components/ConicGradient/types.js';
3
- export type { DrawerSettings } from './utilities/Drawer/types.js';
4
- export type { ModalSettings, ModalComponent } from './utilities/Modal/types.js';
5
- export type { ToastSettings } from './utilities/Toast/types.js';
3
+ export type { DrawerSettings, DrawerStore } from './utilities/Drawer/types.js';
4
+ export type { ModalSettings, ModalComponent, ModalStore } from './utilities/Modal/types.js';
5
+ export type { ToastSettings, ToastStore } from './utilities/Toast/types.js';
6
6
  export type { TableSource } from './components/Table/types.js';
7
7
  export type { PaginationSettings } from './components/Paginator/types.js';
8
8
  export type { PopupSettings } from './utilities/Popup/types.js';
@@ -3,13 +3,17 @@ import type { DrawerSettings } from './types.js';
3
3
  /**
4
4
  * Retrieves the `drawerStore`.
5
5
  *
6
+ * This can *ONLY* be called from the **top level** of components!
7
+ *
6
8
  * @example
7
- * ```ts
8
- * import { getDrawerStore } from "@skeletonlabs/skeleton";
9
+ * ```svelte
10
+ * <script>
11
+ * import { getDrawerStore } from "@skeletonlabs/skeleton";
9
12
  *
10
- * const drawerStore = getDrawerStore();
13
+ * const drawerStore = getDrawerStore();
11
14
  *
12
- * drawerStore.open();
15
+ * drawerStore.open();
16
+ * </script>
13
17
  * ```
14
18
  */
15
19
  export declare function getDrawerStore(): DrawerStore;
@@ -17,7 +21,7 @@ export declare function getDrawerStore(): DrawerStore;
17
21
  * Initializes the `drawerStore`.
18
22
  */
19
23
  export declare function initializeDrawerStore(): DrawerStore;
20
- type DrawerStore = ReturnType<typeof drawerService>;
24
+ export type DrawerStore = ReturnType<typeof drawerService>;
21
25
  declare function drawerService(): {
22
26
  subscribe: (this: void, run: import("svelte/store").Subscriber<DrawerSettings>, invalidate?: import("svelte/store").Invalidator<DrawerSettings> | undefined) => import("svelte/store").Unsubscriber;
23
27
  set: (this: void, value: DrawerSettings) => void;
@@ -5,13 +5,17 @@ const DRAWER_STORE_KEY = 'drawerStore';
5
5
  /**
6
6
  * Retrieves the `drawerStore`.
7
7
  *
8
+ * This can *ONLY* be called from the **top level** of components!
9
+ *
8
10
  * @example
9
- * ```ts
10
- * import { getDrawerStore } from "@skeletonlabs/skeleton";
11
+ * ```svelte
12
+ * <script>
13
+ * import { getDrawerStore } from "@skeletonlabs/skeleton";
11
14
  *
12
- * const drawerStore = getDrawerStore();
15
+ * const drawerStore = getDrawerStore();
13
16
  *
14
- * drawerStore.open();
17
+ * drawerStore.open();
18
+ * </script>
15
19
  * ```
16
20
  */
17
21
  export function getDrawerStore() {
@@ -1,3 +1,4 @@
1
+ export type { DrawerStore } from './stores.js';
1
2
  export interface DrawerSettings {
2
3
  open?: boolean;
3
4
  /** A unique identifier, useful for setting contents. */
@@ -3,13 +3,17 @@ import type { ModalSettings } from './types.js';
3
3
  /**
4
4
  * Retrieves the `modalStore`.
5
5
  *
6
+ * This can *ONLY* be called from the **top level** of components!
7
+ *
6
8
  * @example
7
- * ```ts
8
- * import { getmodalStore } from "@skeletonlabs/skeleton";
9
+ * ```svelte
10
+ * <script>
11
+ * import { getmodalStore } from "@skeletonlabs/skeleton";
9
12
  *
10
- * const modalStore = getModalStore();
13
+ * const modalStore = getModalStore();
11
14
  *
12
- * modalStore.trigger({ type: "alert", title: "Welcome!" });
15
+ * modalStore.trigger({ type: "alert", title: "Welcome!" });
16
+ * </script>
13
17
  * ```
14
18
  */
15
19
  export declare function getModalStore(): ModalStore;
@@ -17,7 +21,7 @@ export declare function getModalStore(): ModalStore;
17
21
  * Initializes the `modalStore`.
18
22
  */
19
23
  export declare function initializeModalStore(): ModalStore;
20
- type ModalStore = ReturnType<typeof modalService>;
24
+ export type ModalStore = ReturnType<typeof modalService>;
21
25
  declare function modalService(): {
22
26
  subscribe: (this: void, run: import("svelte/store").Subscriber<ModalSettings[]>, invalidate?: import("svelte/store").Invalidator<ModalSettings[]> | undefined) => import("svelte/store").Unsubscriber;
23
27
  set: (this: void, value: ModalSettings[]) => void;
@@ -5,13 +5,17 @@ const MODAL_STORE_KEY = 'modalStore';
5
5
  /**
6
6
  * Retrieves the `modalStore`.
7
7
  *
8
+ * This can *ONLY* be called from the **top level** of components!
9
+ *
8
10
  * @example
9
- * ```ts
10
- * import { getmodalStore } from "@skeletonlabs/skeleton";
11
+ * ```svelte
12
+ * <script>
13
+ * import { getmodalStore } from "@skeletonlabs/skeleton";
11
14
  *
12
- * const modalStore = getModalStore();
15
+ * const modalStore = getModalStore();
13
16
  *
14
- * modalStore.trigger({ type: "alert", title: "Welcome!" });
17
+ * modalStore.trigger({ type: "alert", title: "Welcome!" });
18
+ * </script>
15
19
  * ```
16
20
  */
17
21
  export function getModalStore() {
@@ -1,3 +1,4 @@
1
+ export type { ModalStore } from './stores.js';
1
2
  export interface ModalComponent {
2
3
  /** Import and provide your component reference. */
3
4
  ref: any;
@@ -6,6 +6,8 @@ interface TOCCrawlerArgs {
6
6
  scrollTarget?: string;
7
7
  /** Reload the action when this key value changes. */
8
8
  key?: unknown;
9
+ prefix?: string;
10
+ suffix?: string;
9
11
  }
10
12
  export declare function tocCrawler(node: HTMLElement, args?: TOCCrawlerArgs): {
11
13
  update(newArgs: TOCCrawlerArgs): void;
@@ -31,7 +31,9 @@ export function tocCrawler(node, args) {
31
31
  .replaceAll(/[^a-zA-Z0-9 ]/g, '')
32
32
  .replaceAll(' ', '-')
33
33
  .toLowerCase();
34
- elemHeading.id = `toc-${newHeadingId}`;
34
+ const prefix = args.prefix ? `${args.prefix}-` : '';
35
+ const suffix = args.suffix ? `-${args.suffix}` : '';
36
+ elemHeading.id = prefix + newHeadingId + suffix;
35
37
  }
36
38
  // Push heading data to the permalink array
37
39
  permalinks.push({
@@ -3,13 +3,17 @@ import type { ToastSettings, Toast } from './types.js';
3
3
  /**
4
4
  * Retrieves the `toastStore`.
5
5
  *
6
+ * This can *ONLY* be called from the **top level** of components!
7
+ *
6
8
  * @example
7
- * ```ts
8
- * import { getToastStore } from "@skeletonlabs/skeleton";
9
+ * ```svelte
10
+ * <script>
11
+ * import { getToastStore } from "@skeletonlabs/skeleton";
9
12
  *
10
- * const toastStore = getToastStore();
13
+ * const toastStore = getToastStore();
11
14
  *
12
- * toastStore.open({ message: "Welcome!" });
15
+ * toastStore.open({ message: "Welcome!" });
16
+ * </script>
13
17
  * ```
14
18
  */
15
19
  export declare function getToastStore(): ToastStore;
@@ -17,7 +21,7 @@ export declare function getToastStore(): ToastStore;
17
21
  * Initializes the `toastStore`.
18
22
  */
19
23
  export declare function initializeToastStore(): ToastStore;
20
- type ToastStore = ReturnType<typeof toastService>;
24
+ export type ToastStore = ReturnType<typeof toastService>;
21
25
  declare function toastService(): {
22
26
  subscribe: (this: void, run: import("svelte/store").Subscriber<Toast[]>, invalidate?: import("svelte/store").Invalidator<Toast[]> | undefined) => import("svelte/store").Unsubscriber;
23
27
  close: (id: string) => void;
@@ -6,13 +6,17 @@ const TOAST_STORE_KEY = 'toastStore';
6
6
  /**
7
7
  * Retrieves the `toastStore`.
8
8
  *
9
+ * This can *ONLY* be called from the **top level** of components!
10
+ *
9
11
  * @example
10
- * ```ts
11
- * import { getToastStore } from "@skeletonlabs/skeleton";
12
+ * ```svelte
13
+ * <script>
14
+ * import { getToastStore } from "@skeletonlabs/skeleton";
12
15
  *
13
- * const toastStore = getToastStore();
16
+ * const toastStore = getToastStore();
14
17
  *
15
- * toastStore.open({ message: "Welcome!" });
18
+ * toastStore.open({ message: "Welcome!" });
19
+ * </script>
16
20
  * ```
17
21
  */
18
22
  export function getToastStore() {
@@ -1,3 +1,4 @@
1
+ export type { ToastStore } from './stores.js';
1
2
  export interface ToastSettings {
2
3
  /** Provide the toast message. Supports HTML. */
3
4
  message: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {