@loidolt/theme-svelte 0.4.0 → 0.5.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/AlertDialog.svelte +4 -4
- package/dist/components/AppShell.svelte +9 -2
- package/dist/components/AppShell.svelte.d.ts +3 -1
- package/dist/components/Dialog.svelte +3 -3
- package/dist/components/Drawer.svelte +3 -3
- package/dist/components/ToastViewport.svelte +1 -0
- package/dist/toaster.svelte.d.ts +7 -2
- package/dist/toaster.svelte.js +7 -2
- package/package.json +3 -3
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
class={cx('ldt-dialog', size && `ldt-dialog--${size}`, className)}
|
|
98
98
|
{...rest}
|
|
99
99
|
>
|
|
100
|
-
<
|
|
100
|
+
<div class="ldt-dialog__header">
|
|
101
101
|
<div>
|
|
102
102
|
<AlertDialogPrimitive.Title level={headingLevel} class="ldt-dialog__title"
|
|
103
103
|
>{title}</AlertDialogPrimitive.Title
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
>{description}</AlertDialogPrimitive.Description
|
|
106
106
|
>{/if}
|
|
107
107
|
</div>
|
|
108
|
-
</
|
|
108
|
+
</div>
|
|
109
109
|
{#if children}<div class="ldt-dialog__body">{@render children()}</div>{/if}
|
|
110
|
-
<
|
|
110
|
+
<div class="ldt-dialog__footer">
|
|
111
111
|
<AlertDialogPrimitive.Cancel
|
|
112
112
|
class="ldt-button ldt-button--quiet"
|
|
113
113
|
onclick={() => onCancel?.()}>{cancelLabel}</AlertDialogPrimitive.Cancel
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
open = false;
|
|
125
125
|
}}>{confirmLabel}</AlertDialogPrimitive.Action
|
|
126
126
|
>
|
|
127
|
-
</
|
|
127
|
+
</div>
|
|
128
128
|
</AlertDialogPrimitive.Content>
|
|
129
129
|
</AlertDialogPrimitive.Portal>
|
|
130
130
|
</AlertDialogPrimitive.Root>
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
/** Complete banner/header content, such as `Topbar`; rendered without another landmark wrapper. */
|
|
8
8
|
header?: Snippet;
|
|
9
9
|
children: Snippet;
|
|
10
|
+
/** Render the content row without a second `main` landmark inside an embedded preview. */
|
|
11
|
+
embedded?: boolean;
|
|
10
12
|
footer?: Snippet;
|
|
11
|
-
/** `id` of the `<main>`
|
|
13
|
+
/** `id` of the content row (`<main>` unless embedded), for skip links or demo targeting. */
|
|
12
14
|
mainId?: string;
|
|
13
15
|
class?: string;
|
|
14
16
|
ref?: HTMLDivElement | null;
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
let {
|
|
18
20
|
header,
|
|
19
21
|
children,
|
|
22
|
+
embedded = false,
|
|
20
23
|
footer,
|
|
21
24
|
mainId = 'main',
|
|
22
25
|
class: className,
|
|
@@ -27,6 +30,10 @@
|
|
|
27
30
|
|
|
28
31
|
<div bind:this={ref} class={cx('ldt-app-shell', className)} {...rest}>
|
|
29
32
|
{#if header}{@render header()}{/if}
|
|
30
|
-
|
|
33
|
+
{#if embedded}
|
|
34
|
+
<div id={mainId} class="ldt-app-shell__main">{@render children()}</div>
|
|
35
|
+
{:else}
|
|
36
|
+
<main id={mainId}>{@render children()}</main>
|
|
37
|
+
{/if}
|
|
31
38
|
{#if footer}<footer>{@render footer()}</footer>{/if}
|
|
32
39
|
</div>
|
|
@@ -4,8 +4,10 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
/** Complete banner/header content, such as `Topbar`; rendered without another landmark wrapper. */
|
|
5
5
|
header?: Snippet;
|
|
6
6
|
children: Snippet;
|
|
7
|
+
/** Render the content row without a second `main` landmark inside an embedded preview. */
|
|
8
|
+
embedded?: boolean;
|
|
7
9
|
footer?: Snippet;
|
|
8
|
-
/** `id` of the `<main>`
|
|
10
|
+
/** `id` of the content row (`<main>` unless embedded), for skip links or demo targeting. */
|
|
9
11
|
mainId?: string;
|
|
10
12
|
class?: string;
|
|
11
13
|
ref?: HTMLDivElement | null;
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
class={cx('ldt-dialog', size && `ldt-dialog--${size}`, className)}
|
|
87
87
|
{...rest}
|
|
88
88
|
>
|
|
89
|
-
<
|
|
89
|
+
<div class="ldt-dialog__header">
|
|
90
90
|
<div>
|
|
91
91
|
<DialogPrimitive.Title level={headingLevel} class="ldt-dialog__title"
|
|
92
92
|
>{title}</DialogPrimitive.Title
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
class="ldt-button ldt-icon-button ldt-button--ghost"
|
|
99
99
|
aria-label={closeLabel}>×</DialogPrimitive.Close
|
|
100
100
|
>{/if}
|
|
101
|
-
</
|
|
101
|
+
</div>
|
|
102
102
|
<div class="ldt-dialog__body">{@render children()}</div>
|
|
103
|
-
{#if footer}<
|
|
103
|
+
{#if footer}<div class="ldt-dialog__footer">{@render footer()}</div>{/if}
|
|
104
104
|
</DialogPrimitive.Content>
|
|
105
105
|
</DialogPrimitive.Portal>
|
|
106
106
|
</DialogPrimitive.Root>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
class={cx('ldt-drawer', `ldt-drawer--${side}`, className)}
|
|
86
86
|
{...rest}
|
|
87
87
|
>
|
|
88
|
-
<
|
|
88
|
+
<div class="ldt-drawer__header">
|
|
89
89
|
<div>
|
|
90
90
|
<DialogPrimitive.Title level={headingLevel} class="ldt-drawer__title"
|
|
91
91
|
>{title}</DialogPrimitive.Title
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
class="ldt-button ldt-icon-button ldt-button--ghost"
|
|
98
98
|
aria-label={closeLabel}>×</DialogPrimitive.Close
|
|
99
99
|
>{/if}
|
|
100
|
-
</
|
|
100
|
+
</div>
|
|
101
101
|
<div class="ldt-drawer__body ldt-scrollbar">{@render children()}</div>
|
|
102
|
-
{#if footer}<
|
|
102
|
+
{#if footer}<div class="ldt-drawer__footer">{@render footer()}</div>{/if}
|
|
103
103
|
</DialogPrimitive.Content>
|
|
104
104
|
</DialogPrimitive.Portal>
|
|
105
105
|
</DialogPrimitive.Root>
|
package/dist/toaster.svelte.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface ToastRecord extends ToastOptions {
|
|
|
10
10
|
id: string;
|
|
11
11
|
}
|
|
12
12
|
export interface ToasterOptions {
|
|
13
|
-
/** Default `duration` for toasts that do not set one. */
|
|
13
|
+
/** Default `duration` for toasts that do not set one. Defaults to persistent (`0`). */
|
|
14
14
|
duration?: number;
|
|
15
15
|
/** Oldest toasts past this count are dropped. */
|
|
16
16
|
max?: number;
|
|
@@ -35,7 +35,12 @@ export interface Toaster {
|
|
|
35
35
|
*
|
|
36
36
|
* ```svelte
|
|
37
37
|
* const toaster = createToaster();
|
|
38
|
-
* <ToastViewport
|
|
38
|
+
* <ToastViewport
|
|
39
|
+
* onpointerenter={toaster.pause}
|
|
40
|
+
* onpointerleave={toaster.resume}
|
|
41
|
+
* onfocusin={toaster.pause}
|
|
42
|
+
* onfocusout={toaster.resume}
|
|
43
|
+
* >
|
|
39
44
|
* {#each toaster.toasts as toast (toast.id)}
|
|
40
45
|
* <Toast {...toast} onDismiss={() => toaster.dismiss(toast.id)} />
|
|
41
46
|
* {/each}
|
package/dist/toaster.svelte.js
CHANGED
|
@@ -5,7 +5,12 @@ import { onDestroy } from 'svelte';
|
|
|
5
5
|
*
|
|
6
6
|
* ```svelte
|
|
7
7
|
* const toaster = createToaster();
|
|
8
|
-
* <ToastViewport
|
|
8
|
+
* <ToastViewport
|
|
9
|
+
* onpointerenter={toaster.pause}
|
|
10
|
+
* onpointerleave={toaster.resume}
|
|
11
|
+
* onfocusin={toaster.pause}
|
|
12
|
+
* onfocusout={toaster.resume}
|
|
13
|
+
* >
|
|
9
14
|
* {#each toaster.toasts as toast (toast.id)}
|
|
10
15
|
* <Toast {...toast} onDismiss={() => toaster.dismiss(toast.id)} />
|
|
11
16
|
* {/each}
|
|
@@ -13,7 +18,7 @@ import { onDestroy } from 'svelte';
|
|
|
13
18
|
* ```
|
|
14
19
|
*/
|
|
15
20
|
export function createToaster(options = {}) {
|
|
16
|
-
const { duration: defaultDuration =
|
|
21
|
+
const { duration: defaultDuration = 0, max = 5 } = options;
|
|
17
22
|
if (!Number.isInteger(max) || max < 1) {
|
|
18
23
|
throw new RangeError('createToaster: `max` must be a positive integer');
|
|
19
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loidolt/theme-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Accessible Svelte 5 components for Loidolt applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"clean": "rimraf dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@loidolt/theme-styles": "^0.
|
|
35
|
-
"@loidolt/theme-tokens": "^0.
|
|
34
|
+
"@loidolt/theme-styles": "^0.5.0",
|
|
35
|
+
"@loidolt/theme-tokens": "^0.5.0",
|
|
36
36
|
"bits-ui": "^2.19.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|