@skeletonlabs/skeleton 1.11.0-dev.fa91c649 → 2.0.0-rc.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.
- package/dist/components/Accordion/Accordion.svelte +15 -3
- package/dist/components/Accordion/Accordion.svelte.d.ts +17 -23
- package/dist/components/Accordion/AccordionItem.svelte +8 -3
- package/dist/components/Accordion/AccordionItem.svelte.d.ts +15 -25
- package/dist/components/AppRail/AppRailTile.svelte +1 -1
- package/dist/components/Autocomplete/Autocomplete.svelte +17 -7
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +17 -27
- package/dist/components/Avatar/Avatar.svelte +1 -1
- package/dist/components/ConicGradient/ConicGradient.svelte +1 -1
- package/dist/components/InputChip/InputChip.svelte +25 -4
- package/dist/components/InputChip/InputChip.svelte.d.ts +22 -27
- package/dist/components/Paginator/Paginator.svelte +18 -16
- package/dist/components/Paginator/Paginator.svelte.d.ts +2 -2
- package/dist/components/Paginator/types.d.ts +2 -2
- package/dist/components/Ratings/Ratings.svelte +1 -1
- package/dist/components/Stepper/Step.svelte +11 -2
- package/dist/components/Stepper/Step.svelte.d.ts +15 -12
- package/dist/components/Stepper/Stepper.svelte +21 -3
- package/dist/components/Stepper/Stepper.svelte.d.ts +17 -27
- package/dist/components/Tab/TabGroup.svelte +1 -1
- package/dist/components/Table/Table.svelte +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.js +10 -12
- package/dist/internal/transitions.d.ts +10 -0
- package/dist/internal/transitions.js +11 -0
- package/dist/transitions/crossfade.d.ts +1 -0
- package/dist/transitions/crossfade.js +21 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +1 -0
- package/dist/utilities/Drawer/Drawer.svelte +33 -12
- package/dist/utilities/Drawer/Drawer.svelte.d.ts +4 -2
- package/dist/utilities/Drawer/stores.d.ts +20 -1
- package/dist/utilities/Drawer/stores.js +27 -2
- package/dist/utilities/Drawer/types.d.ts +2 -0
- package/dist/utilities/Modal/Modal.svelte +21 -23
- package/dist/utilities/Modal/Modal.svelte.d.ts +17 -37
- package/dist/utilities/Modal/stores.d.ts +20 -1
- package/dist/utilities/Modal/stores.js +27 -1
- package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.d.ts +7 -0
- package/dist/utilities/PrefersReducedMotion/PrefersReducedMotion.js +26 -0
- package/dist/utilities/TableOfContents/TableOfContents.svelte +56 -0
- package/dist/utilities/TableOfContents/TableOfContents.svelte.d.ts +34 -0
- package/dist/utilities/TableOfContents/crawler.d.ts +14 -0
- package/dist/utilities/TableOfContents/crawler.js +76 -0
- package/dist/utilities/TableOfContents/stores.d.ts +6 -0
- package/dist/utilities/TableOfContents/stores.js +5 -0
- package/dist/utilities/TableOfContents/types.d.ts +5 -0
- package/dist/utilities/TableOfContents/types.js +2 -0
- package/dist/utilities/Toast/Toast.svelte +24 -23
- package/dist/utilities/Toast/Toast.svelte.d.ts +17 -24
- package/dist/utilities/Toast/stores.d.ts +23 -5
- package/dist/utilities/Toast/stores.js +56 -29
- package/dist/utilities/index.d.ts +18 -0
- package/dist/utilities/index.js +25 -0
- package/package.json +3 -16
- package/dist/components/TableOfContents/TableOfContents.svelte +0 -111
- package/dist/components/TableOfContents/TableOfContents.svelte.d.ts +0 -44
- package/dist/styles/all.css +0 -30
- package/dist/styles/elements/alerts.css +0 -17
- package/dist/styles/elements/badges.css +0 -31
- package/dist/styles/elements/breadcrumbs.css +0 -36
- package/dist/styles/elements/buttons.css +0 -109
- package/dist/styles/elements/cards.css +0 -32
- package/dist/styles/elements/chips.css +0 -22
- package/dist/styles/elements/codeblocks.css +0 -16
- package/dist/styles/elements/forms.css +0 -283
- package/dist/styles/elements/lists.css +0 -51
- package/dist/styles/elements/logo-clouds.css +0 -29
- package/dist/styles/elements/modals.css +0 -15
- package/dist/styles/elements/placeholders.css +0 -17
- package/dist/styles/elements/popups.css +0 -16
- package/dist/styles/elements/tables.css +0 -102
- package/dist/styles/partials/core.css +0 -66
- package/dist/styles/partials/elements.css +0 -20
- package/dist/styles/partials/tailwind.css +0 -16
- package/dist/styles/partials/typography-next.css +0 -99
- package/dist/styles/partials/typography-prose.css +0 -49
- package/dist/styles/partials/typography.css +0 -99
- package/dist/styles/partials/variants.css +0 -204
- package/dist/styles/skeleton-minimal.css +0 -30
- package/dist/styles/skeleton.css +0 -30
- package/dist/tailwind/core.cjs +0 -37
- package/dist/tailwind/core.d.cts +0 -5
- package/dist/tailwind/generated/intellisense-classes.cjs +0 -1
- package/dist/tailwind/generated/intellisense-classes.d.cts +0 -2729
- package/dist/tailwind/intellisense.cjs +0 -21
- package/dist/tailwind/intellisense.d.cts +0 -5
- package/dist/tailwind/settings.cjs +0 -20
- package/dist/tailwind/settings.d.cts +0 -6
- package/dist/tailwind/skeleton.cjs +0 -19
- package/dist/tailwind/skeleton.d.cts +0 -7
- package/dist/tailwind/theme/colors.cjs +0 -18
- package/dist/tailwind/theme/colors.d.cts +0 -2
- package/dist/tailwind/tokens/backgrounds.cjs +0 -39
- package/dist/tailwind/tokens/backgrounds.d.cts +0 -2
- package/dist/tailwind/tokens/border-radius.cjs +0 -21
- package/dist/tailwind/tokens/border-radius.d.cts +0 -33
- package/dist/tailwind/tokens/borders.cjs +0 -20
- package/dist/tailwind/tokens/borders.d.cts +0 -6
- package/dist/tailwind/tokens/fills.cjs +0 -20
- package/dist/tailwind/tokens/fills.d.cts +0 -15
- package/dist/tailwind/tokens/rings.cjs +0 -50
- package/dist/tailwind/tokens/rings.d.cts +0 -22
- package/dist/tailwind/tokens/text.cjs +0 -31
- package/dist/tailwind/tokens/text.d.cts +0 -21
- package/dist/themes/theme-crimson.css +0 -100
- package/dist/themes/theme-gold-nouveau.css +0 -143
- package/dist/themes/theme-hamlindigo.css +0 -109
- package/dist/themes/theme-modern.css +0 -134
- package/dist/themes/theme-rocket.css +0 -120
- package/dist/themes/theme-sahara.css +0 -133
- package/dist/themes/theme-seafoam.css +0 -128
- package/dist/themes/theme-seasonal.css +0 -114
- package/dist/themes/theme-skeleton.css +0 -119
- package/dist/themes/theme-test.css +0 -96
- package/dist/themes/theme-vintage.css +0 -131
- package/dist/utilities/DataTable/DataTable.d.ts +0 -19
- package/dist/utilities/DataTable/DataTable.js +0 -137
- package/dist/utilities/DataTable/types.d.ts +0 -33
- package/dist/utilities/DataTable/types.js +0 -2
- /package/dist/{utilities/DataTable → components/Table}/actions.d.ts +0 -0
- /package/dist/{utilities/DataTable → components/Table}/actions.js +0 -0
|
@@ -26,7 +26,7 @@ $:
|
|
|
26
26
|
|
|
27
27
|
<div class="ratings {classesBase}" data-testid="rating-bar">
|
|
28
28
|
<!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->
|
|
29
|
-
{#each
|
|
29
|
+
{#each { length: max } as _, i}
|
|
30
30
|
{#if interactive}
|
|
31
31
|
<button class="rating-icon {regionIcon}" type="button" on:click={() => iconClick(i)}>
|
|
32
32
|
{#if isFull(value, i)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Reference: https://dribbble.com/shots/16221169-Figma-Material-Ui-components-Steppers-and-sliders -->
|
|
2
2
|
<script>import { getContext, onDestroy } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { dynamicTransition } from "../../internal/transitions.js";
|
|
4
4
|
export let locked = false;
|
|
5
5
|
export let regionHeader = "";
|
|
6
6
|
export let regionContent = "";
|
|
@@ -19,6 +19,11 @@ export let buttonNextLabel = getContext("buttonNextLabel");
|
|
|
19
19
|
export let buttonComplete = getContext("buttonComplete");
|
|
20
20
|
export let buttonCompleteType = getContext("buttonCompleteType");
|
|
21
21
|
export let buttonCompleteLabel = getContext("buttonCompleteLabel");
|
|
22
|
+
export let transitions = getContext("transitions");
|
|
23
|
+
export let transitionIn = getContext("transitionIn");
|
|
24
|
+
export let transitionInParams = getContext("transitionInParams");
|
|
25
|
+
export let transitionOut = getContext("transitionOut");
|
|
26
|
+
export let transitionOutParams = getContext("transitionOutParams");
|
|
22
27
|
const stepIndex = $state.total;
|
|
23
28
|
$state.total++;
|
|
24
29
|
const cBase = "space-y-4";
|
|
@@ -66,7 +71,11 @@ onDestroy(() => {
|
|
|
66
71
|
</div>
|
|
67
72
|
<!-- Navigation -->
|
|
68
73
|
{#if $state.total > 1}
|
|
69
|
-
<div
|
|
74
|
+
<div
|
|
75
|
+
class="step-navigation {classesNavigation}"
|
|
76
|
+
in:dynamicTransition|local={{ transition: transitionIn, params: transitionInParams, enabled: transitions }}
|
|
77
|
+
out:dynamicTransition|local={{ transition: transitionOut, params: transitionOutParams, enabled: transitions }}
|
|
78
|
+
>
|
|
70
79
|
{#if stepIndex === 0 && $$slots.navigation}
|
|
71
80
|
<!-- Slot: Navigation -->
|
|
72
81
|
<div class="step-navigation-slot">
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { Writable } from 'svelte/store';
|
|
3
3
|
import type { StepperEventDispatcher, StepperState } from './types.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import type { Transition, TransitionParams } from '../../index.js';
|
|
5
|
+
declare class __sveltets_Render<TransitionIn extends Transition, TransitionOut extends Transition> {
|
|
6
|
+
props(): {
|
|
6
7
|
[x: string]: any;
|
|
7
8
|
locked?: boolean | undefined;
|
|
8
|
-
/** Provide arbitrary classes to the step header region.*/
|
|
9
9
|
regionHeader?: string | undefined;
|
|
10
|
-
/** Provide arbitrary classes to the step content region.*/
|
|
11
10
|
regionContent?: string | undefined;
|
|
12
|
-
/** Provide arbitrary classes to the step navigation region.*/
|
|
13
11
|
regionNavigation?: string | undefined;
|
|
14
12
|
state?: Writable<StepperState> | undefined;
|
|
15
13
|
dispatchParent?: StepperEventDispatcher | undefined;
|
|
@@ -25,19 +23,24 @@ declare const __propDef: {
|
|
|
25
23
|
buttonComplete?: string | undefined;
|
|
26
24
|
buttonCompleteType?: "button" | "reset" | "submit" | undefined;
|
|
27
25
|
buttonCompleteLabel?: string | undefined;
|
|
26
|
+
transitions?: boolean | undefined;
|
|
27
|
+
transitionIn?: TransitionIn | undefined;
|
|
28
|
+
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
29
|
+
transitionOut?: TransitionOut | undefined;
|
|
30
|
+
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
28
31
|
};
|
|
29
|
-
events: {
|
|
32
|
+
events(): {} & {
|
|
30
33
|
[evt: string]: CustomEvent<any>;
|
|
31
34
|
};
|
|
32
|
-
slots: {
|
|
35
|
+
slots(): {
|
|
33
36
|
header: {};
|
|
34
37
|
default: {};
|
|
35
38
|
navigation: {};
|
|
36
39
|
};
|
|
37
|
-
}
|
|
38
|
-
export type StepProps =
|
|
39
|
-
export type StepEvents =
|
|
40
|
-
export type StepSlots =
|
|
41
|
-
export default class Step extends SvelteComponentTyped<StepProps, StepEvents, StepSlots
|
|
40
|
+
}
|
|
41
|
+
export type StepProps<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
|
|
42
|
+
export type StepEvents<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
|
|
43
|
+
export type StepSlots<TransitionIn extends Transition, TransitionOut extends Transition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
|
|
44
|
+
export default class Step<TransitionIn extends Transition, TransitionOut extends Transition> extends SvelteComponentTyped<StepProps<TransitionIn, TransitionOut>, StepEvents<TransitionIn, TransitionOut>, StepSlots<TransitionIn, TransitionOut>> {
|
|
42
45
|
}
|
|
43
46
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script context="module">import { fade } from "svelte/transition";
|
|
2
|
+
import { prefersReducedMotionStore } from "../../index.js";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script generics="TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition">import { createEventDispatcher, setContext } from "svelte";
|
|
2
6
|
import { writable } from "svelte/store";
|
|
3
|
-
import {
|
|
7
|
+
import { dynamicTransition } from "../../internal/transitions.js";
|
|
4
8
|
const dispatch = createEventDispatcher();
|
|
5
9
|
export let gap = "gap-4";
|
|
6
10
|
export let stepTerm = "Step";
|
|
@@ -20,6 +24,11 @@ export let buttonCompleteType = "button";
|
|
|
20
24
|
export let buttonCompleteLabel = "Complete";
|
|
21
25
|
export let regionHeader = "";
|
|
22
26
|
export let regionContent = "";
|
|
27
|
+
export let transitions = !$prefersReducedMotionStore;
|
|
28
|
+
export let transitionIn = fade;
|
|
29
|
+
export let transitionInParams = { duration: 100 };
|
|
30
|
+
export let transitionOut = fade;
|
|
31
|
+
export let transitionOutParams = { duration: 100 };
|
|
23
32
|
let state = writable({ current: start, total: 0 });
|
|
24
33
|
setContext("state", state);
|
|
25
34
|
setContext("dispatchParent", dispatch);
|
|
@@ -35,6 +44,11 @@ setContext("buttonNextLabel", buttonNextLabel);
|
|
|
35
44
|
setContext("buttonComplete", buttonComplete);
|
|
36
45
|
setContext("buttonCompleteType", buttonCompleteType);
|
|
37
46
|
setContext("buttonCompleteLabel", buttonCompleteLabel);
|
|
47
|
+
setContext("transitions", transitions);
|
|
48
|
+
setContext("transitionIn", transitionIn);
|
|
49
|
+
setContext("transitionInParams", transitionInParams);
|
|
50
|
+
setContext("transitionOut", transitionOut);
|
|
51
|
+
setContext("transitionOutParams", transitionOutParams);
|
|
38
52
|
const cBase = "space-y-4";
|
|
39
53
|
const cHeader = "flex items-center border-t mt-[15px]";
|
|
40
54
|
const cHeaderStep = "-mt-[15px] transition-all duration-300";
|
|
@@ -56,7 +70,11 @@ $:
|
|
|
56
70
|
<div class="stepper {classesBase}" data-testid="stepper">
|
|
57
71
|
<!-- Header -->
|
|
58
72
|
{#if $state.total}
|
|
59
|
-
<header
|
|
73
|
+
<header
|
|
74
|
+
class="stepper-header {classesHeader}"
|
|
75
|
+
in:dynamicTransition|local={{ transition: transitionIn, params: transitionInParams, enabled: transitions }}
|
|
76
|
+
out:dynamicTransition|local={{ transition: transitionOut, params: transitionOutParams, enabled: transitions }}
|
|
77
|
+
>
|
|
60
78
|
{#each Array.from(Array($state.total).keys()) as step}
|
|
61
79
|
<div class="stepper-header-step {classesHeaderStep}" class:flex-1={isActive(step)}>
|
|
62
80
|
<span class="badge {classesBadge(step)}">{isActive(step) ? `${stepTerm} ${step + 1}` : step + 1}</span>
|
|
@@ -1,46 +1,36 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
3
|
+
import { type Transition, type TransitionParams } from '../../index.js';
|
|
4
|
+
type FadeTransition = typeof fade;
|
|
2
5
|
import type { StepperButton, StepperState } from './types.js';
|
|
3
|
-
declare
|
|
4
|
-
props: {
|
|
6
|
+
declare class __sveltets_Render<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> {
|
|
7
|
+
props(): {
|
|
5
8
|
[x: string]: any;
|
|
6
|
-
/** Provide classes to style the stepper header gap.*/
|
|
7
9
|
gap?: string | undefined;
|
|
8
|
-
/** Provide the verbiage that represents "Step".*/
|
|
9
10
|
stepTerm?: string | undefined;
|
|
10
|
-
/** Provide classes to style the stepper header badges.*/
|
|
11
11
|
badge?: string | undefined;
|
|
12
|
-
/** Provide classes to style the stepper header active step badge.*/
|
|
13
12
|
active?: string | undefined;
|
|
14
|
-
/** Provide classes to style the stepper header border.*/
|
|
15
13
|
border?: string | undefined;
|
|
16
|
-
/** Provide the initially selected step*/
|
|
17
14
|
start?: number | undefined;
|
|
18
|
-
/** Set the justification for the step navigation buttons.*/
|
|
19
15
|
justify?: string | undefined;
|
|
20
|
-
/** Provide arbitrary classes to style the back button.*/
|
|
21
16
|
buttonBack?: string | undefined;
|
|
22
|
-
/** Set the type of the back button.*/
|
|
23
17
|
buttonBackType?: StepperButton | undefined;
|
|
24
|
-
/** Provide the HTML label content for the back button.*/
|
|
25
18
|
buttonBackLabel?: string | undefined;
|
|
26
|
-
/** Provide arbitrary classes to style the next button.*/
|
|
27
19
|
buttonNext?: string | undefined;
|
|
28
|
-
/** Set the type of the next button.*/
|
|
29
20
|
buttonNextType?: StepperButton | undefined;
|
|
30
|
-
/** Provide the HTML label content for the next button.*/
|
|
31
21
|
buttonNextLabel?: string | undefined;
|
|
32
|
-
/** Provide arbitrary classes to style the complete button.*/
|
|
33
22
|
buttonComplete?: string | undefined;
|
|
34
|
-
/** Set the type of the complete button.*/
|
|
35
23
|
buttonCompleteType?: StepperButton | undefined;
|
|
36
|
-
/** Provide the HTML label content for the complete button.*/
|
|
37
24
|
buttonCompleteLabel?: string | undefined;
|
|
38
|
-
/** Provide arbitrary classes to the stepper header region.*/
|
|
39
25
|
regionHeader?: string | undefined;
|
|
40
|
-
/** Provide arbitrary classes to the stepper content region.*/
|
|
41
26
|
regionContent?: string | undefined;
|
|
27
|
+
transitions?: boolean | undefined;
|
|
28
|
+
transitionIn?: TransitionIn | undefined;
|
|
29
|
+
transitionInParams?: TransitionParams<TransitionIn> | undefined;
|
|
30
|
+
transitionOut?: TransitionOut | undefined;
|
|
31
|
+
transitionOutParams?: TransitionParams<TransitionOut> | undefined;
|
|
42
32
|
};
|
|
43
|
-
events: {
|
|
33
|
+
events(): {
|
|
44
34
|
next: CustomEvent<{
|
|
45
35
|
step: number;
|
|
46
36
|
state: StepperState;
|
|
@@ -60,13 +50,13 @@ declare const __propDef: {
|
|
|
60
50
|
} & {
|
|
61
51
|
[evt: string]: CustomEvent<any>;
|
|
62
52
|
};
|
|
63
|
-
slots: {
|
|
53
|
+
slots(): {
|
|
64
54
|
default: {};
|
|
65
55
|
};
|
|
66
|
-
}
|
|
67
|
-
export type StepperProps =
|
|
68
|
-
export type StepperEvents =
|
|
69
|
-
export type StepperSlots =
|
|
70
|
-
export default class Stepper extends SvelteComponentTyped<StepperProps, StepperEvents, StepperSlots
|
|
56
|
+
}
|
|
57
|
+
export type StepperProps<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['props']>;
|
|
58
|
+
export type StepperEvents<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['events']>;
|
|
59
|
+
export type StepperSlots<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> = ReturnType<__sveltets_Render<TransitionIn, TransitionOut>['slots']>;
|
|
60
|
+
export default class Stepper<TransitionIn extends Transition = FadeTransition, TransitionOut extends Transition = FadeTransition> extends SvelteComponentTyped<StepperProps<TransitionIn, TransitionOut>, StepperEvents<TransitionIn, TransitionOut>, StepperSlots<TransitionIn, TransitionOut>> {
|
|
71
61
|
}
|
|
72
62
|
export {};
|
|
@@ -28,7 +28,7 @@ $:
|
|
|
28
28
|
classesPanel = `${cPanel} ${regionPanel}`;
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
<!--
|
|
31
|
+
<!-- FIXME: resolve a11y warnings -->
|
|
32
32
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
33
33
|
<div class="tab-group {classesBase}" data-testid="tab-group" on:click on:keypress on:keydown on:keyup>
|
|
34
34
|
<!-- Tab List -->
|
package/dist/index.d.ts
CHANGED
|
@@ -6,24 +6,25 @@ export type { ToastSettings } 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';
|
|
9
|
+
export type { Transition, TransitionParams } from './internal/transitions.js';
|
|
9
10
|
export type { TreeViewNode } from './components/TreeView/types.js';
|
|
10
|
-
export type CssClasses
|
|
11
|
-
export type SvelteEvent<E extends Event = Event, T extends EventTarget = Element> = E & {
|
|
12
|
-
currentTarget: EventTarget & T;
|
|
13
|
-
};
|
|
11
|
+
export type { CssClasses, SvelteEvent } from './types.js';
|
|
14
12
|
export { storeHighlightJs } from './utilities/CodeBlock/stores.js';
|
|
15
13
|
export { storePopup } from './utilities/Popup/popup.js';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
14
|
+
export { tocStore } from './utilities/TableOfContents/stores.js';
|
|
15
|
+
export { getDrawerStore } from './utilities/Drawer/stores.js';
|
|
16
|
+
export { getModalStore } from './utilities/Modal/stores.js';
|
|
17
|
+
export { getToastStore } from './utilities/Toast/stores.js';
|
|
18
|
+
export { initializeStores } from './utilities/index.js';
|
|
20
19
|
export { modeOsPrefers, modeUserPrefers, modeCurrent, getModeOsPrefers, getModeUserPrefers, getModeAutoPrefers, setModeUserPrefers, setModeCurrent, setInitialClassState, autoModeWatcher } from './utilities/LightSwitch/lightswitch.js';
|
|
21
20
|
export { localStorageStore } from './utilities/LocalStorageStore/LocalStorageStore.js';
|
|
21
|
+
export { prefersReducedMotionStore } from './utilities/PrefersReducedMotion/PrefersReducedMotion.js';
|
|
22
22
|
export { tableSourceMapper, tableSourceValues, tableMapperValues } from './components/Table/utils.js';
|
|
23
23
|
export { clipboard } from './actions/Clipboard/clipboard.js';
|
|
24
24
|
export { filter } from './actions/Filters/filter.js';
|
|
25
25
|
export { focusTrap } from './actions/FocusTrap/focusTrap.js';
|
|
26
26
|
export { popup } from './utilities/Popup/popup.js';
|
|
27
|
+
export { tocCrawler } from './utilities/TableOfContents/crawler.js';
|
|
27
28
|
export { default as Accordion } from './components/Accordion/Accordion.svelte';
|
|
28
29
|
export { default as AccordionItem } from './components/Accordion/AccordionItem.svelte';
|
|
29
30
|
export { default as AppBar } from './components/AppBar/AppBar.svelte';
|
|
@@ -53,7 +54,6 @@ export { default as Table } from './components/Table/Table.svelte';
|
|
|
53
54
|
export { default as TabGroup } from './components/Tab/TabGroup.svelte';
|
|
54
55
|
export { default as Tab } from './components/Tab/Tab.svelte';
|
|
55
56
|
export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
|
|
56
|
-
export { default as TableOfContents } from './components/TableOfContents/TableOfContents.svelte';
|
|
57
57
|
export { default as TreeView } from './components/TreeView/TreeView.svelte';
|
|
58
58
|
export { default as TreeViewItem } from './components/TreeView/TreeViewItem.svelte';
|
|
59
59
|
export { default as TreeViewDataDrivenItem } from './components/TreeView/TreeViewDataDrivenItem.svelte';
|
|
@@ -62,6 +62,7 @@ export { default as Modal } from './utilities/Modal/Modal.svelte';
|
|
|
62
62
|
export { default as Drawer } from './utilities/Drawer/Drawer.svelte';
|
|
63
63
|
export { default as LightSwitch } from './utilities/LightSwitch/LightSwitch.svelte';
|
|
64
64
|
export { default as Toast } from './utilities/Toast/Toast.svelte';
|
|
65
|
+
export { default as TableOfContents } from './utilities/TableOfContents/TableOfContents.svelte';
|
|
65
66
|
export { default as Apollo } from './actions/Filters/svg-filters/Apollo.svelte';
|
|
66
67
|
export { default as BlueNight } from './actions/Filters/svg-filters/BlueNight.svelte';
|
|
67
68
|
export { default as Emerald } from './actions/Filters/svg-filters/Emerald.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
// This file defines the short path imports for the package (ex: @skeletonlabs/skeleton/*)
|
|
2
|
-
//
|
|
2
|
+
// Utilities ---
|
|
3
3
|
export { storeHighlightJs } from './utilities/CodeBlock/stores.js';
|
|
4
4
|
export { storePopup } from './utilities/Popup/popup.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
// Utilities
|
|
12
|
-
createDataTableStore, dataTableHandler,
|
|
13
|
-
// Svelte Actions
|
|
14
|
-
tableInteraction, tableA11y } from './utilities/DataTable/DataTable.js';
|
|
5
|
+
export { tocStore } from './utilities/TableOfContents/stores.js';
|
|
6
|
+
export { getDrawerStore } from './utilities/Drawer/stores.js';
|
|
7
|
+
export { getModalStore } from './utilities/Modal/stores.js';
|
|
8
|
+
export { getToastStore } from './utilities/Toast/stores.js';
|
|
9
|
+
export { initializeStores } from './utilities/index.js';
|
|
15
10
|
// Lightswitch
|
|
16
11
|
export {
|
|
17
12
|
// Stores
|
|
@@ -20,6 +15,8 @@ modeOsPrefers, modeUserPrefers, modeCurrent,
|
|
|
20
15
|
getModeOsPrefers, getModeUserPrefers, getModeAutoPrefers, setModeUserPrefers, setModeCurrent, setInitialClassState, autoModeWatcher } from './utilities/LightSwitch/lightswitch.js';
|
|
21
16
|
// Local Storage Store
|
|
22
17
|
export { localStorageStore } from './utilities/LocalStorageStore/LocalStorageStore.js';
|
|
18
|
+
// Prefers-reduced-motion
|
|
19
|
+
export { prefersReducedMotionStore } from './utilities/PrefersReducedMotion/PrefersReducedMotion.js';
|
|
23
20
|
// Component Utilities
|
|
24
21
|
export { tableSourceMapper, tableSourceValues, tableMapperValues } from './components/Table/utils.js';
|
|
25
22
|
// Svelte Actions ---
|
|
@@ -28,6 +25,7 @@ export { filter } from './actions/Filters/filter.js';
|
|
|
28
25
|
export { focusTrap } from './actions/FocusTrap/focusTrap.js';
|
|
29
26
|
// Utility Actions
|
|
30
27
|
export { popup } from './utilities/Popup/popup.js';
|
|
28
|
+
export { tocCrawler } from './utilities/TableOfContents/crawler.js';
|
|
31
29
|
// Svelte Components ---
|
|
32
30
|
export { default as Accordion } from './components/Accordion/Accordion.svelte';
|
|
33
31
|
export { default as AccordionItem } from './components/Accordion/AccordionItem.svelte';
|
|
@@ -58,7 +56,6 @@ export { default as Table } from './components/Table/Table.svelte';
|
|
|
58
56
|
export { default as TabGroup } from './components/Tab/TabGroup.svelte';
|
|
59
57
|
export { default as Tab } from './components/Tab/Tab.svelte';
|
|
60
58
|
export { default as TabAnchor } from './components/Tab/TabAnchor.svelte';
|
|
61
|
-
export { default as TableOfContents } from './components/TableOfContents/TableOfContents.svelte';
|
|
62
59
|
export { default as TreeView } from './components/TreeView/TreeView.svelte';
|
|
63
60
|
export { default as TreeViewItem } from './components/TreeView/TreeViewItem.svelte';
|
|
64
61
|
export { default as TreeViewDataDrivenItem } from './components/TreeView/TreeViewDataDrivenItem.svelte';
|
|
@@ -68,6 +65,7 @@ export { default as Modal } from './utilities/Modal/Modal.svelte';
|
|
|
68
65
|
export { default as Drawer } from './utilities/Drawer/Drawer.svelte';
|
|
69
66
|
export { default as LightSwitch } from './utilities/LightSwitch/LightSwitch.svelte';
|
|
70
67
|
export { default as Toast } from './utilities/Toast/Toast.svelte';
|
|
68
|
+
export { default as TableOfContents } from './utilities/TableOfContents/TableOfContents.svelte';
|
|
71
69
|
// Filter Components
|
|
72
70
|
export { default as Apollo } from './actions/Filters/svg-filters/Apollo.svelte';
|
|
73
71
|
export { default as BlueNight } from './actions/Filters/svg-filters/BlueNight.svelte';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TransitionConfig } from 'svelte/transition';
|
|
2
|
+
export declare function dynamicTransition<T extends Transition>(node: Element, dynParams: DynamicTransitionParams<T>): TransitionConfig;
|
|
3
|
+
type DynamicTransitionParams<T extends Transition> = {
|
|
4
|
+
transition: T;
|
|
5
|
+
params: TransitionParams<T>;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type Transition = (node: Element, params?: any) => TransitionConfig;
|
|
9
|
+
export type TransitionParams<T extends Transition> = Parameters<T>[1];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Transitions ---
|
|
2
|
+
export function dynamicTransition(node, dynParams) {
|
|
3
|
+
const { transition, params, enabled } = dynParams;
|
|
4
|
+
if (enabled)
|
|
5
|
+
return transition(node, params);
|
|
6
|
+
// it's better to just set the `duration` to 0 to prevent flickering
|
|
7
|
+
if ('duration' in params)
|
|
8
|
+
return transition(node, { duration: 0 });
|
|
9
|
+
// if the transition doesn't provide a `duration` prop, then we'll just return this as a last resort
|
|
10
|
+
return { duration: 0 };
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cubicInOut } from 'svelte/easing';
|
|
2
|
+
import { crossfade } from 'svelte/transition';
|
|
3
|
+
// TODO: convert to js transitions on revisit.
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
function swoop(duration, x, y) {
|
|
6
|
+
return crossfade({
|
|
7
|
+
duration: (d) => Math.sqrt(d * duration),
|
|
8
|
+
fallback(node) {
|
|
9
|
+
const style = getComputedStyle(node);
|
|
10
|
+
const transform = style.transform === 'none' ? '' : style.transform;
|
|
11
|
+
return {
|
|
12
|
+
duration,
|
|
13
|
+
easing: cubicInOut,
|
|
14
|
+
css: (t, u) => `
|
|
15
|
+
transform: ${transform} scale(${t}) translate(${u * x}%, ${u * y}%);
|
|
16
|
+
opacity: ${t}
|
|
17
|
+
`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This type alias is to identify CSS classes within component props,
|
|
3
|
+
* which enables Tailwind IntelliSense
|
|
4
|
+
*/
|
|
5
|
+
export type CssClasses = string;
|
|
6
|
+
export type SvelteEvent<E extends Event = Event, T extends EventTarget = Element> = E & {
|
|
7
|
+
currentTarget: EventTarget & T;
|
|
8
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { createEventDispatcher } from "svelte";
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
3
2
|
import { BROWSER } from "esm-env";
|
|
4
3
|
const dispatch = createEventDispatcher();
|
|
4
|
+
import { prefersReducedMotionStore } from "../../index.js";
|
|
5
5
|
import { focusTrap } from "../../actions/FocusTrap/focusTrap.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getDrawerStore } from "./stores.js";
|
|
7
|
+
import { fade, fly } from "svelte/transition";
|
|
8
|
+
import { dynamicTransition } from "../../internal/transitions.js";
|
|
7
9
|
export let position = "left";
|
|
8
|
-
export let duration = 150;
|
|
9
10
|
export let bgBackdrop = "bg-surface-backdrop-token";
|
|
10
11
|
export let blur = "";
|
|
11
12
|
export let padding = "";
|
|
@@ -20,20 +21,22 @@ export let regionBackdrop = "";
|
|
|
20
21
|
export let regionDrawer = "";
|
|
21
22
|
export let labelledby = "";
|
|
22
23
|
export let describedby = "";
|
|
24
|
+
export let transitions = !$prefersReducedMotionStore;
|
|
25
|
+
export let opacityTransition = true;
|
|
23
26
|
const presets = {
|
|
24
27
|
top: { alignment: "items-start", width: "w-full", height: "h-[50%]", rounded: "rounded-bl-container-token rounded-br-container-token" },
|
|
25
28
|
bottom: { alignment: "items-end", width: "w-full", height: " h-[50%]", rounded: "rounded-tl-container-token rounded-tr-container-token" },
|
|
26
29
|
left: { alignment: "justify-start", width: "w-[90%]", height: "h-full", rounded: "rounded-tr-container-token rounded-br-container-token" },
|
|
27
30
|
right: { alignment: "justify-end", width: "w-[90%]", height: "h-full", rounded: "rounded-tl-container-token rounded-bl-container-token" }
|
|
28
31
|
};
|
|
29
|
-
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0 flex";
|
|
30
|
-
const cDrawer = "overflow-y-auto transition-transform";
|
|
31
32
|
let elemBackdrop;
|
|
32
33
|
let elemDrawer;
|
|
33
34
|
let anim = { x: 0, y: 0 };
|
|
35
|
+
const drawerStore = getDrawerStore();
|
|
36
|
+
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0 flex";
|
|
37
|
+
const cDrawer = "overflow-y-auto transition-transform";
|
|
34
38
|
const propDefaults = {
|
|
35
39
|
position,
|
|
36
|
-
duration,
|
|
37
40
|
bgBackdrop,
|
|
38
41
|
blur,
|
|
39
42
|
padding,
|
|
@@ -43,6 +46,7 @@ const propDefaults = {
|
|
|
43
46
|
shadow,
|
|
44
47
|
width,
|
|
45
48
|
height,
|
|
49
|
+
opacityTransition,
|
|
46
50
|
labelledby,
|
|
47
51
|
describedby,
|
|
48
52
|
regionBackdrop,
|
|
@@ -50,7 +54,6 @@ const propDefaults = {
|
|
|
50
54
|
};
|
|
51
55
|
function applyPropSettings(settings) {
|
|
52
56
|
position = settings.position || propDefaults.position;
|
|
53
|
-
duration = settings.duration || propDefaults.duration;
|
|
54
57
|
bgBackdrop = settings.bgBackdrop || propDefaults.bgBackdrop;
|
|
55
58
|
blur = settings.blur || propDefaults.blur;
|
|
56
59
|
padding = settings.padding || propDefaults.padding;
|
|
@@ -60,6 +63,7 @@ function applyPropSettings(settings) {
|
|
|
60
63
|
shadow = settings.shadow || propDefaults.shadow;
|
|
61
64
|
width = settings.width || propDefaults.width;
|
|
62
65
|
height = settings.height || propDefaults.height;
|
|
66
|
+
opacityTransition = settings.opacityTransition || propDefaults.opacityTransition;
|
|
63
67
|
regionBackdrop = settings.regionBackdrop || propDefaults.regionBackdrop;
|
|
64
68
|
regionDrawer = settings.regionDrawer || propDefaults.regionDrawer;
|
|
65
69
|
labelledby = settings.labelledby || propDefaults.labelledby;
|
|
@@ -124,7 +128,7 @@ $:
|
|
|
124
128
|
|
|
125
129
|
{#if $drawerStore.open === true}
|
|
126
130
|
<!-- Backdrop -->
|
|
127
|
-
<!--
|
|
131
|
+
<!-- FIXME: resolve a11y warnings -->
|
|
128
132
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
129
133
|
<div
|
|
130
134
|
bind:this={elemBackdrop}
|
|
@@ -134,7 +138,16 @@ $:
|
|
|
134
138
|
on:touchstart
|
|
135
139
|
on:touchend
|
|
136
140
|
on:keypress
|
|
137
|
-
|
|
141
|
+
in:dynamicTransition|local={{
|
|
142
|
+
transition: fade,
|
|
143
|
+
params: { duration: 150 },
|
|
144
|
+
enabled: transitions && opacityTransition
|
|
145
|
+
}}
|
|
146
|
+
out:dynamicTransition|local={{
|
|
147
|
+
transition: fade,
|
|
148
|
+
params: { duration: 150 },
|
|
149
|
+
enabled: transitions && opacityTransition
|
|
150
|
+
}}
|
|
138
151
|
use:focusTrap={true}
|
|
139
152
|
>
|
|
140
153
|
<!-- Drawer -->
|
|
@@ -147,8 +160,16 @@ $:
|
|
|
147
160
|
aria-modal="true"
|
|
148
161
|
aria-labelledby={labelledby}
|
|
149
162
|
aria-describedby={describedby}
|
|
150
|
-
in:
|
|
151
|
-
|
|
163
|
+
in:dynamicTransition|local={{
|
|
164
|
+
transition: fly,
|
|
165
|
+
params: { x: anim.x, y: anim.y, duration: 150, opacity: opacityTransition ? undefined : 1 },
|
|
166
|
+
enabled: transitions
|
|
167
|
+
}}
|
|
168
|
+
out:dynamicTransition|local={{
|
|
169
|
+
transition: fly,
|
|
170
|
+
params: { x: anim.x, y: anim.y, duration: 150, opacity: opacityTransition ? undefined : 1 },
|
|
171
|
+
enabled: transitions
|
|
172
|
+
}}
|
|
152
173
|
>
|
|
153
174
|
<!-- Slot: Default -->
|
|
154
175
|
<slot />
|
|
@@ -4,8 +4,6 @@ declare const __propDef: {
|
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
/** Set the anchor position.*/
|
|
6
6
|
position?: "left" | "top" | "right" | "bottom" | undefined;
|
|
7
|
-
/** Define the Svelte transition animation duration.*/
|
|
8
|
-
duration?: number | undefined;
|
|
9
7
|
/** Backdrop - Provide classes to set the backdrop background color*/
|
|
10
8
|
bgBackdrop?: string | undefined;
|
|
11
9
|
/** Backdrop - Provide classes to set the blur style.*/
|
|
@@ -34,6 +32,10 @@ declare const __propDef: {
|
|
|
34
32
|
labelledby?: string | undefined;
|
|
35
33
|
/** Provide an ID of the element describing the drawer.*/
|
|
36
34
|
describedby?: string | undefined;
|
|
35
|
+
/** Enable/Disable transitions*/
|
|
36
|
+
transitions?: boolean | undefined;
|
|
37
|
+
/** Drawer - Enable/Disable opacity transition*/
|
|
38
|
+
opacityTransition?: boolean | undefined;
|
|
37
39
|
};
|
|
38
40
|
events: {
|
|
39
41
|
touchstart: TouchEvent;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
import type { DrawerSettings } from './types.js';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the `drawerStore`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { getDrawerStore } from "@skeletonlabs/skeleton";
|
|
9
|
+
*
|
|
10
|
+
* const drawerStore = getDrawerStore();
|
|
11
|
+
*
|
|
12
|
+
* drawerStore.open();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDrawerStore(): DrawerStore;
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the `drawerStore`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function initializeDrawerStore(): DrawerStore;
|
|
20
|
+
type DrawerStore = ReturnType<typeof drawerService>;
|
|
21
|
+
declare function drawerService(): {
|
|
4
22
|
subscribe: (this: void, run: import("svelte/store").Subscriber<DrawerSettings>, invalidate?: import("svelte/store").Invalidator<DrawerSettings> | undefined) => import("svelte/store").Unsubscriber;
|
|
5
23
|
set: (this: void, value: DrawerSettings) => void;
|
|
6
24
|
update: (this: void, updater: import("svelte/store").Updater<DrawerSettings>) => void;
|
|
@@ -9,3 +27,4 @@ export declare const drawerStore: {
|
|
|
9
27
|
/** Close the drawer. */
|
|
10
28
|
close: () => void;
|
|
11
29
|
};
|
|
30
|
+
export {};
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
// Drawer Stores
|
|
2
2
|
import { writable } from 'svelte/store';
|
|
3
|
+
import { getContext, setContext } from 'svelte';
|
|
4
|
+
const DRAWER_STORE_KEY = 'drawerStore';
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves the `drawerStore`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { getDrawerStore } from "@skeletonlabs/skeleton";
|
|
11
|
+
*
|
|
12
|
+
* const drawerStore = getDrawerStore();
|
|
13
|
+
*
|
|
14
|
+
* drawerStore.open();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function getDrawerStore() {
|
|
18
|
+
const drawerStore = getContext(DRAWER_STORE_KEY);
|
|
19
|
+
if (!drawerStore)
|
|
20
|
+
throw new Error('drawerStore is not initialized. Please ensure that `initializeStores()` is invoked in the root layout file of this app!');
|
|
21
|
+
return drawerStore;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Initializes the `drawerStore`.
|
|
25
|
+
*/
|
|
26
|
+
export function initializeDrawerStore() {
|
|
27
|
+
const drawerStore = drawerService();
|
|
28
|
+
return setContext(DRAWER_STORE_KEY, drawerStore);
|
|
29
|
+
}
|
|
3
30
|
function drawerService() {
|
|
4
31
|
const { subscribe, set, update } = writable({});
|
|
5
32
|
return {
|
|
@@ -17,5 +44,3 @@ function drawerService() {
|
|
|
17
44
|
})
|
|
18
45
|
};
|
|
19
46
|
}
|
|
20
|
-
// Exports
|
|
21
|
-
export const drawerStore = drawerService();
|
|
@@ -28,6 +28,8 @@ export interface DrawerSettings {
|
|
|
28
28
|
width?: string;
|
|
29
29
|
/** Drawer - Provide classes to override the height.*/
|
|
30
30
|
height?: string;
|
|
31
|
+
/** Drawer - Enable/Disable opacity transition */
|
|
32
|
+
opacityTransition?: boolean;
|
|
31
33
|
/** Provide arbitrary classes to the backdrop region. */
|
|
32
34
|
regionBackdrop?: string;
|
|
33
35
|
/** Provide arbitrary classes to the drawer region. */
|