@skeletonlabs/skeleton 2.0.0 → 2.1.0-dev.0b27cf4c

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.
@@ -6,5 +6,5 @@ type ClipboardArgs = string | {
6
6
  export declare function clipboard(node: HTMLElement, args: ClipboardArgs): {
7
7
  update(newArgs: ClipboardArgs): void;
8
8
  destroy(): void;
9
- };
9
+ } | undefined;
10
10
  export {};
@@ -1,4 +1,8 @@
1
1
  export function clipboard(node, args) {
2
+ if (!window.isSecureContext) {
3
+ console.error('Clipboard action failed: app not running in secure context, see: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard');
4
+ return;
5
+ }
2
6
  const fireCopyCompleteEvent = () => {
3
7
  node.dispatchEvent(new CustomEvent('copyComplete'));
4
8
  };
@@ -1,4 +1,5 @@
1
- <script>export let regionPage = "";
1
+ <script>export let scrollbarGutter = "auto";
2
+ export let regionPage = "";
2
3
  export let slotHeader = "z-10";
3
4
  export let slotSidebarLeft = "w-auto";
4
5
  export let slotSidebarRight = "w-auto";
@@ -43,7 +44,7 @@ $:
43
44
  {/if}
44
45
 
45
46
  <!-- Page -->
46
- <div id="page" class="{regionPage} {cPage}" on:scroll>
47
+ <div id="page" class="{regionPage} {cPage}" style:scrollbar-gutter={scrollbarGutter} on:scroll>
47
48
  <!-- Slot: Page Header -->
48
49
  {#if $$slots.pageHeader}
49
50
  <header id="page-header" class="flex-none {classesPageHeader}"><slot name="pageHeader">(slot:header)</slot></header>
@@ -10,6 +10,8 @@ import type { SvelteEvent } from '../../index.js';
10
10
  declare const __propDef: {
11
11
  props: {
12
12
  [x: string]: any;
13
+ /** Set `scrollbar-gutter` style.*/
14
+ scrollbarGutter?: string | undefined;
13
15
  /** Apply arbitrary classes to the entire `#page` region.*/
14
16
  regionPage?: string | undefined;
15
17
  /** Apply arbitrary classes to the `header` slot container element*/
@@ -3,7 +3,11 @@ import { prefersReducedMotionStore } from "../../index.js";
3
3
  import { dynamicTransition } from "../../internal/transitions.js";
4
4
  </script>
5
5
 
6
- <script generics="TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition">import { createEventDispatcher } from "svelte";
6
+ <script
7
+
8
+ generics="Value = unknown, Meta = unknown,
9
+ TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition"
10
+ >import { createEventDispatcher } from "svelte";
7
11
  const dispatch = createEventDispatcher();
8
12
  export let input = void 0;
9
13
  export let options = [];
@@ -54,7 +58,7 @@ $:
54
58
  $:
55
59
  optionsFiltered = input ? filterOptions() : listedOptions;
56
60
  $:
57
- sliceLimit = limit !== void 0 ? limit : optionsFiltered.length;
61
+ sliceLimit = limit ?? optionsFiltered.length;
58
62
  $:
59
63
  classesBase = `${$$props.class ?? ""}`;
60
64
  $:
@@ -3,14 +3,14 @@ import { slide } from 'svelte/transition';
3
3
  import { type Transition, type TransitionParams } from '../../index.js';
4
4
  type SlideTransition = typeof slide;
5
5
  import type { AutocompleteOption } from './types.js';
6
- declare class __sveltets_Render<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
6
+ declare class __sveltets_Render<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> {
7
7
  props(): {
8
8
  [x: string]: any;
9
- input?: unknown;
10
- options?: AutocompleteOption[] | undefined;
9
+ input?: Value | undefined;
10
+ options?: AutocompleteOption<Value, Meta>[] | undefined;
11
11
  limit?: number | undefined;
12
- allowlist?: unknown[] | undefined;
13
- denylist?: unknown[] | undefined;
12
+ allowlist?: Value[] | undefined;
13
+ denylist?: Value[] | undefined;
14
14
  emptyState?: string | undefined;
15
15
  regionNav?: string | undefined;
16
16
  regionList?: string | undefined;
@@ -26,15 +26,15 @@ declare class __sveltets_Render<TransitionIn extends Transition = SlideTransitio
26
26
  events(): {
27
27
  click: MouseEvent;
28
28
  keypress: KeyboardEvent;
29
- selection: CustomEvent<AutocompleteOption>;
29
+ selection: CustomEvent<AutocompleteOption<Value, Meta>>;
30
30
  } & {
31
31
  [evt: string]: CustomEvent<any>;
32
32
  };
33
33
  slots(): {};
34
34
  }
35
- export type AutocompleteProps<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
36
- export type AutocompleteEvents<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
37
- export type AutocompleteSlots<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
38
- export default class Autocomplete<TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> extends SvelteComponentTyped<AutocompleteProps<TransitionIn, TransitionOut>, AutocompleteEvents<TransitionIn, TransitionOut>, AutocompleteSlots<TransitionIn, TransitionOut>> {
35
+ export type AutocompleteProps<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<Value, Meta, TransitionIn, TransitionOut>['props']>;
36
+ export type AutocompleteEvents<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<Value, Meta, TransitionIn, TransitionOut>['events']>;
37
+ export type AutocompleteSlots<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> = ReturnType<__sveltets_Render<Value, Meta, TransitionIn, TransitionOut>['slots']>;
38
+ export default class Autocomplete<Value = unknown, Meta = unknown, TransitionIn extends Transition = SlideTransition, TransitionOut extends Transition = SlideTransition> extends SvelteComponentTyped<AutocompleteProps<Value, Meta, TransitionIn, TransitionOut>, AutocompleteEvents<Value, Meta, TransitionIn, TransitionOut>, AutocompleteSlots<Value, Meta, TransitionIn, TransitionOut>> {
39
39
  }
40
40
  export {};
@@ -1,10 +1,10 @@
1
- export interface AutocompleteOption {
2
- /** provide a unique display label per option. Supports HTML. */
1
+ export interface AutocompleteOption<Value = unknown, Meta = unknown> {
2
+ /** Provide a unique display label per option. Supports HTML. */
3
3
  label: string;
4
4
  /** Provide a unique option value. */
5
- value: unknown;
5
+ value: Value;
6
6
  /** Provide a comma separated list of keywords. */
7
- keywords?: any;
7
+ keywords?: string;
8
8
  /** Pass arbitrary data per option. */
9
- meta?: any;
9
+ meta?: Meta;
10
10
  }
@@ -91,7 +91,7 @@ onDestroy(() => {
91
91
  <!-- Button: Next -->
92
92
  <button type={buttonNextType} class="btn {buttonNext}" on:click={onNext} disabled={locked}>
93
93
  {#if locked}
94
- <svg class="w-3 aspect-square" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
94
+ <svg class="w-3 aspect-square fill-current" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
95
95
  <path
96
96
  d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"
97
97
  />
@@ -202,11 +202,13 @@ $:
202
202
  aria-modal="true"
203
203
  aria-label={$modalStore[0].title ?? ''}
204
204
  >
205
- <svelte:component this={currentComponent?.ref} {...currentComponent?.props} {parent}>
206
- {#if currentComponent?.slot}
205
+ {#if currentComponent?.slot}
206
+ <svelte:component this={currentComponent?.ref} {...currentComponent?.props} {parent}>
207
207
  {@html currentComponent?.slot}
208
- {/if}
209
- </svelte:component>
208
+ </svelte:component>
209
+ {:else}
210
+ <svelte:component this={currentComponent?.ref} {...currentComponent?.props} {parent} />
211
+ {/if}
210
212
  </div>
211
213
  {/if}
212
214
  </div>
@@ -0,0 +1,8 @@
1
+ <script>import { initializeModalStore, getModalStore } from "./stores.js";
2
+ import Modal from "./Modal.svelte";
3
+ export let modalSetting;
4
+ initializeModalStore();
5
+ getModalStore().trigger(modalSetting);
6
+ </script>
7
+
8
+ <Modal />
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { ModalSettings } from './types.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ modalSetting: ModalSettings;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type ModalTestProps = typeof __propDef.props;
13
+ export type ModalTestEvents = typeof __propDef.events;
14
+ export type ModalTestSlots = typeof __propDef.slots;
15
+ export default class ModalTest extends SvelteComponentTyped<ModalTestProps, ModalTestEvents, ModalTestSlots> {
16
+ }
17
+ export {};
@@ -6,16 +6,16 @@ export function tocCrawler(node, args) {
6
6
  let headings;
7
7
  let permalinks = [];
8
8
  function init() {
9
- // Reset headings
10
- headings = node.querySelectorAll(queryElements);
11
- // Reset the permalinks array:
12
- permalinks = [];
13
9
  // Set accepted list of query elements
10
+ // (IMPORTANT: must proceed resetting `headings` below)
14
11
  if (args?.queryElements)
15
12
  queryElements = args.queryElements;
16
13
  // Set the desired scroll target to monitor
17
14
  if (args?.scrollTarget)
18
15
  scrollTarget = args.scrollTarget;
16
+ // Reset local values
17
+ headings = node.querySelectorAll(queryElements);
18
+ permalinks = [];
19
19
  // Query and process the headings
20
20
  queryHeadings();
21
21
  }
@@ -0,0 +1,12 @@
1
+ <script>import { initializeToastStore, getToastStore } from "./stores.js";
2
+ import Toast from "./Toast.svelte";
3
+ export let toastSettings = [];
4
+ export let max = void 0;
5
+ initializeToastStore();
6
+ const toastStore = getToastStore();
7
+ toastSettings.forEach((element) => {
8
+ toastStore.trigger(element);
9
+ });
10
+ </script>
11
+
12
+ <Toast {max} />
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { ToastSettings } from './types.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ toastSettings?: ToastSettings[] | undefined;
6
+ max?: number | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type ToastTestProps = typeof __propDef.props;
14
+ export type ToastTestEvents = typeof __propDef.events;
15
+ export type ToastTestSlots = typeof __propDef.slots;
16
+ export default class ToastTest extends SvelteComponentTyped<ToastTestProps, ToastTestEvents, ToastTestSlots> {
17
+ }
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "2.0.0",
3
+ "version": "2.1.0-dev.0b27cf4c",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {