lutra 0.0.18 → 0.0.20
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/data/Stat.svelte.d.ts +12 -6
- package/dist/display/Avatar.svelte.d.ts +5 -0
- package/dist/display/Badge.svelte.d.ts +10 -6
- package/dist/display/Callout.svelte +8 -4
- package/dist/display/Callout.svelte.d.ts +11 -9
- package/dist/display/Close.svelte +58 -0
- package/dist/display/Close.svelte.d.ts +21 -0
- package/dist/display/Code.svelte.d.ts +10 -8
- package/dist/display/ContextTip.svelte +1 -2
- package/dist/display/ContextTip.svelte.d.ts +5 -0
- package/dist/display/Details.svelte.d.ts +11 -5
- package/dist/display/Hero.svelte.d.ts +9 -4
- package/dist/display/Icon.svelte +4 -6
- package/dist/display/Icon.svelte.d.ts +6 -0
- package/dist/display/IconButton.svelte +2 -3
- package/dist/display/IconButton.svelte.d.ts +8 -4
- package/dist/display/Image.svelte +63 -13
- package/dist/display/Image.svelte.d.ts +15 -2
- package/dist/display/Indicator.svelte.d.ts +5 -3
- package/dist/display/Inset.svelte.d.ts +5 -0
- package/dist/display/Notification.svelte +104 -0
- package/dist/display/Notification.svelte.d.ts +42 -0
- package/dist/display/Popup.svelte.d.ts +10 -4
- package/dist/display/Table.svelte +3 -0
- package/dist/display/Table.svelte.d.ts +11 -0
- package/dist/display/Tag.svelte.d.ts +11 -7
- package/dist/display/Tooltip.svelte +1 -1
- package/dist/display/Tooltip.svelte.d.ts +9 -3
- package/dist/display/notifications.svelte.d.ts +21 -0
- package/dist/display/notifications.svelte.js +31 -0
- package/dist/form/Button.svelte.d.ts +12 -0
- package/dist/form/FieldActions.svelte +1 -1
- package/dist/form/FieldActions.svelte.d.ts +6 -0
- package/dist/form/FieldContainer.svelte +5 -0
- package/dist/form/FieldContainer.svelte.d.ts +6 -0
- package/dist/form/FieldContent.svelte +3 -0
- package/dist/form/FieldContent.svelte.d.ts +23 -0
- package/dist/form/FieldError.svelte.d.ts +4 -0
- package/dist/form/FieldSection.svelte +13 -1
- package/dist/form/FieldSection.svelte.d.ts +11 -0
- package/dist/form/Fieldset.svelte.d.ts +15 -7
- package/dist/form/Form.svelte +15 -12
- package/dist/form/Form.svelte.d.ts +10 -0
- package/dist/form/Input.svelte +4 -2
- package/dist/form/Input.svelte.d.ts +66 -55
- package/dist/form/InputLength.svelte.d.ts +4 -2
- package/dist/form/Label.svelte.d.ts +9 -3
- package/dist/form/Select.svelte +0 -1
- package/dist/form/Select.svelte.d.ts +44 -27
- package/dist/form/form.js +1 -1
- package/dist/grid/Column.svelte.d.ts +5 -0
- package/dist/grid/Grid.svelte.d.ts +6 -0
- package/dist/grid/Row.svelte.d.ts +6 -1
- package/dist/layout/Layout.svelte +2 -0
- package/dist/layout/Layout.svelte.d.ts +6 -2
- package/dist/layout/LayoutFooter.svelte.d.ts +3 -1
- package/dist/layout/LayoutGrid.svelte.d.ts +13 -5
- package/dist/layout/LayoutHeader.svelte.d.ts +13 -12
- package/dist/layout/LayoutSideMenu.svelte +54 -0
- package/dist/layout/LayoutSideMenu.svelte.d.ts +25 -0
- package/dist/layout/Overlay.svelte +20 -0
- package/dist/layout/Overlay.svelte.d.ts +35 -0
- package/dist/layout/OverlayContainer.svelte +28 -0
- package/dist/layout/OverlayContainer.svelte.d.ts +16 -0
- package/dist/layout/OverlayLayer.svelte +145 -0
- package/dist/layout/OverlayLayer.svelte.d.ts +22 -0
- package/dist/layout/PageContent.svelte +9 -1
- package/dist/layout/PageContent.svelte.d.ts +8 -3
- package/dist/layout/Theme.svelte +8 -0
- package/dist/layout/Theme.svelte.d.ts +6 -0
- package/dist/layout/UIContent.svelte.d.ts +5 -0
- package/dist/layout/overlays.svelte.d.ts +34 -0
- package/dist/layout/overlays.svelte.js +44 -0
- package/dist/nav/Breadcrumb.svelte.d.ts +9 -5
- package/dist/nav/Menu.svelte +43 -62
- package/dist/nav/Menu.svelte.d.ts +11 -4
- package/dist/nav/MenuItem.svelte +25 -7
- package/dist/nav/MenuItem.svelte.d.ts +9 -0
- package/dist/nav/NavMenu.svelte.d.ts +3 -1
- package/dist/nav/TabbedContent.svelte.d.ts +5 -3
- package/dist/nav/Tabs.svelte.d.ts +6 -4
- package/dist/style.css +74 -36
- package/dist/typo/Clamp.svelte.d.ts +8 -3
- package/dist/typo/H.svelte.d.ts +10 -5
- package/dist/typo/H1.svelte.d.ts +9 -4
- package/dist/typo/H2.svelte.d.ts +9 -4
- package/dist/typo/H3.svelte.d.ts +9 -4
- package/dist/typo/H4.svelte.d.ts +9 -4
- package/dist/typo/H5.svelte.d.ts +9 -4
- package/dist/typo/H6.svelte.d.ts +9 -4
- package/dist/typo/P.svelte.d.ts +9 -4
- package/dist/utils/StringOrComponentOrSnippet.svelte +3 -2
- package/dist/utils/StringOrComponentOrSnippet.svelte.d.ts +7 -0
- package/dist/utils/attr.d.ts +2 -2
- package/dist/utils/attr.js +2 -2
- package/dist/utils/dom.d.ts +15 -0
- package/dist/utils/dom.js +74 -0
- package/dist/utils/keyboard.svelte.d.ts +19 -0
- package/dist/utils/keyboard.svelte.js +22 -3
- package/dist/utils/transitions.d.ts +1 -0
- package/dist/utils/transitions.js +9 -2
- package/package.json +11 -9
@@ -0,0 +1,104 @@
|
|
1
|
+
<script lang="ts">import Overlay from "../layout/Overlay.svelte";
|
2
|
+
import PageContent from "../layout/PageContent.svelte";
|
3
|
+
import { removeOverlay } from "../layout/overlays.svelte.js";
|
4
|
+
import Close from "./Close.svelte";
|
5
|
+
import { createId } from "../utils/id.js";
|
6
|
+
import Icon from "./Icon.svelte";
|
7
|
+
let {
|
8
|
+
id = createId(),
|
9
|
+
children,
|
10
|
+
title,
|
11
|
+
content,
|
12
|
+
icon,
|
13
|
+
actions
|
14
|
+
} = $props();
|
15
|
+
function onclick(e) {
|
16
|
+
e.preventDefault();
|
17
|
+
removeOverlay(id);
|
18
|
+
}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
{#snippet notification()}
|
22
|
+
<div class="Notification">
|
23
|
+
{#if !actions}
|
24
|
+
<Close position="top right" {onclick} />
|
25
|
+
{/if}
|
26
|
+
{#if icon}
|
27
|
+
<div class="Icon">
|
28
|
+
<Icon {icon} --vertical-align="text-top" --icon-width="2rem" --icon-height="2rem" />
|
29
|
+
</div>
|
30
|
+
{/if}
|
31
|
+
<div class="Content">
|
32
|
+
<PageContent --margin-scale="0.35">
|
33
|
+
{#if children}
|
34
|
+
{@render children()}
|
35
|
+
{:else}
|
36
|
+
{#if title}
|
37
|
+
<h5>{title}</h5>
|
38
|
+
{/if}
|
39
|
+
<p>{content}</p>
|
40
|
+
{/if}
|
41
|
+
</PageContent>
|
42
|
+
</div>
|
43
|
+
{#if actions}
|
44
|
+
<div class="Actions">
|
45
|
+
{@render actions()}
|
46
|
+
</div>
|
47
|
+
{/if}
|
48
|
+
</div>
|
49
|
+
{/snippet}
|
50
|
+
|
51
|
+
{#if children}
|
52
|
+
<Overlay z={100} layer="notifications" position="bottom right" {id}>
|
53
|
+
{@render notification()}
|
54
|
+
</Overlay>
|
55
|
+
{:else}
|
56
|
+
{@render notification()}
|
57
|
+
{/if}
|
58
|
+
|
59
|
+
<style>
|
60
|
+
.Notification {
|
61
|
+
display: block;
|
62
|
+
pointer-events: none;
|
63
|
+
background: var(--bg-app);
|
64
|
+
border-radius: var(--border-radius);
|
65
|
+
border: var(--border);
|
66
|
+
padding: 0.75rem 1rem;
|
67
|
+
width: 30rem;
|
68
|
+
font-size: 0.85em;
|
69
|
+
display: grid;
|
70
|
+
grid-template-areas: "content";
|
71
|
+
grid-template-columns: 1fr;
|
72
|
+
gap: 1rem;
|
73
|
+
box-shadow: 0 0.5rem 1rem var(--shadow);
|
74
|
+
}
|
75
|
+
.Notification:has(.Icon):has(.Actions) {
|
76
|
+
grid-template-areas: "icon content actions";
|
77
|
+
grid-template-columns: auto 1fr auto;
|
78
|
+
}
|
79
|
+
.Notification:not(:has(.Icon)):has(.Actions) {
|
80
|
+
grid-template-areas: "content actions";
|
81
|
+
grid-template-columns: 1fr auto;
|
82
|
+
}
|
83
|
+
.Notification:has(.Icon):not(:has(.Actions)) {
|
84
|
+
grid-template-areas: "icon content";
|
85
|
+
grid-template-columns: auto 1fr;
|
86
|
+
}
|
87
|
+
.Icon {
|
88
|
+
grid-area: icon;
|
89
|
+
display: flex;
|
90
|
+
gap: 0.5rem;
|
91
|
+
align-items: center;
|
92
|
+
pointer-events: auto;
|
93
|
+
}
|
94
|
+
.Content {
|
95
|
+
grid-area: content;
|
96
|
+
}
|
97
|
+
.Actions {
|
98
|
+
grid-area: actions;
|
99
|
+
display: flex;
|
100
|
+
gap: 0.5rem;
|
101
|
+
align-items: center;
|
102
|
+
pointer-events: auto;
|
103
|
+
}
|
104
|
+
</style>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
2
|
+
import type { ComponentType } from "svelte";
|
3
|
+
declare const __propDef: {
|
4
|
+
props: {
|
5
|
+
id?: string | undefined;
|
6
|
+
children?: ((this: void) => typeof import("svelte").SnippetReturn & {
|
7
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
8
|
+
}) | undefined;
|
9
|
+
title?: string | undefined;
|
10
|
+
content?: string | undefined;
|
11
|
+
icon?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
12
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
13
|
+
}) | ComponentType | undefined;
|
14
|
+
actions?: ((this: void) => typeof import("svelte").SnippetReturn & {
|
15
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
16
|
+
}) | undefined;
|
17
|
+
};
|
18
|
+
events: {
|
19
|
+
[evt: string]: CustomEvent<any>;
|
20
|
+
};
|
21
|
+
slots: {};
|
22
|
+
};
|
23
|
+
export type NotificationProps = typeof __propDef.props;
|
24
|
+
export type NotificationEvents = typeof __propDef.events;
|
25
|
+
export type NotificationSlots = typeof __propDef.slots;
|
26
|
+
export default class Notification extends SvelteComponent<NotificationProps, NotificationEvents, NotificationSlots> {
|
27
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
28
|
+
id?: string | undefined;
|
29
|
+
children?: ((this: void) => typeof import("svelte").SnippetReturn & {
|
30
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
31
|
+
}) | undefined;
|
32
|
+
title?: string | undefined;
|
33
|
+
content?: string | undefined;
|
34
|
+
icon?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
35
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
36
|
+
}) | ComponentType | undefined;
|
37
|
+
actions?: ((this: void) => typeof import("svelte").SnippetReturn & {
|
38
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
39
|
+
}) | undefined;
|
40
|
+
}>);
|
41
|
+
}
|
42
|
+
export {};
|
@@ -2,13 +2,9 @@ import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Snippet } from "svelte";
|
3
3
|
declare const __propDef: {
|
4
4
|
props: {
|
5
|
-
/** The content of the popup */
|
6
5
|
content: Snippet<[close: () => void]>;
|
7
|
-
/** Snippet containing the trigger element */
|
8
6
|
trigger: Snippet<[attrs: (node: Element) => void]>;
|
9
|
-
/** Triggers the popup on hover (and keyboard focus) instead of click */
|
10
7
|
hover?: boolean | undefined;
|
11
|
-
/** The shape of the popup */
|
12
8
|
shape?: "rounded" | "sharp" | undefined;
|
13
9
|
};
|
14
10
|
events: {
|
@@ -20,5 +16,15 @@ export type PopupProps = typeof __propDef.props;
|
|
20
16
|
export type PopupEvents = typeof __propDef.events;
|
21
17
|
export type PopupSlots = typeof __propDef.slots;
|
22
18
|
export default class Popup extends SvelteComponent<PopupProps, PopupEvents, PopupSlots> {
|
19
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
20
|
+
content: (this: void, close: () => void) => typeof import("svelte").SnippetReturn & {
|
21
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
22
|
+
};
|
23
|
+
trigger: (this: void, attrs: (node: Element) => void) => typeof import("svelte").SnippetReturn & {
|
24
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
25
|
+
};
|
26
|
+
hover?: boolean | undefined;
|
27
|
+
shape?: "rounded" | "sharp" | undefined;
|
28
|
+
}>);
|
23
29
|
}
|
24
30
|
export {};
|
@@ -19,5 +19,16 @@ export type TableProps = typeof __propDef.props;
|
|
19
19
|
export type TableEvents = typeof __propDef.events;
|
20
20
|
export type TableSlots = typeof __propDef.slots;
|
21
21
|
export default class Table extends SvelteComponent<TableProps, TableEvents, TableSlots> {
|
22
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
23
|
+
colored?: boolean | undefined;
|
24
|
+
contained?: boolean | undefined;
|
25
|
+
rounded?: boolean | undefined;
|
26
|
+
hang?: boolean | undefined;
|
27
|
+
hoverable?: boolean | undefined;
|
28
|
+
fullWidth?: boolean | undefined;
|
29
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
30
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
31
|
+
};
|
32
|
+
}>);
|
22
33
|
}
|
23
34
|
export {};
|
@@ -3,19 +3,12 @@ import type { Snippet } from "svelte";
|
|
3
3
|
import type { StatusColorOrString } from '../utils/color.js';
|
4
4
|
declare const __propDef: {
|
5
5
|
props: {
|
6
|
-
/** Use a mono-spaced font for the tag. */
|
7
6
|
code?: boolean | undefined;
|
8
|
-
/** The color of the tag. */
|
9
7
|
color?: StatusColorOrString | undefined;
|
10
|
-
/** The shape of the tag. */
|
11
8
|
shape?: "rounded" | "pill" | "rectangle" | undefined;
|
12
|
-
/** A function to run when the tag is clicked. */
|
13
9
|
onclick?: ((event: MouseEvent) => void) | undefined;
|
14
|
-
/** A URL to link to. */
|
15
10
|
href?: string | undefined;
|
16
|
-
/** The target of the link. */
|
17
11
|
target?: string | undefined;
|
18
|
-
/** The content of the tag. */
|
19
12
|
children: Snippet;
|
20
13
|
};
|
21
14
|
events: {
|
@@ -27,5 +20,16 @@ export type TagProps = typeof __propDef.props;
|
|
27
20
|
export type TagEvents = typeof __propDef.events;
|
28
21
|
export type TagSlots = typeof __propDef.slots;
|
29
22
|
export default class Tag extends SvelteComponent<TagProps, TagEvents, TagSlots> {
|
23
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
24
|
+
code?: boolean | undefined;
|
25
|
+
color?: StatusColorOrString | undefined;
|
26
|
+
shape?: "rounded" | "pill" | "rectangle" | undefined;
|
27
|
+
onclick?: ((event: MouseEvent) => void) | undefined;
|
28
|
+
href?: string | undefined;
|
29
|
+
target?: string | undefined;
|
30
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
31
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
32
|
+
};
|
33
|
+
}>);
|
30
34
|
}
|
31
35
|
export {};
|
@@ -51,7 +51,7 @@ const id = `tt-${Math.random().toString(36).substring(2, 15) + Math.random().toS
|
|
51
51
|
}
|
52
52
|
.TooltipContent {
|
53
53
|
background-color: var(--bg-app);
|
54
|
-
padding: 0.
|
54
|
+
padding: 0.25rem 0.35rem;
|
55
55
|
border-radius: calc(var(--border-radius));
|
56
56
|
border-top: var(--border-subtle);
|
57
57
|
border-left: var(--border-subtle);
|
@@ -2,11 +2,8 @@ import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Snippet } from "svelte";
|
3
3
|
declare const __propDef: {
|
4
4
|
props: {
|
5
|
-
/** Content to trigger the tooltip */
|
6
5
|
children: Snippet;
|
7
|
-
/** The content of the tooltip */
|
8
6
|
tip: string | Snippet;
|
9
|
-
/** Open the tooltip on render (cannot be closed) */
|
10
7
|
open?: boolean | undefined;
|
11
8
|
};
|
12
9
|
events: {
|
@@ -18,5 +15,14 @@ export type TooltipProps = typeof __propDef.props;
|
|
18
15
|
export type TooltipEvents = typeof __propDef.events;
|
19
16
|
export type TooltipSlots = typeof __propDef.slots;
|
20
17
|
export default class Tooltip extends SvelteComponent<TooltipProps, TooltipEvents, TooltipSlots> {
|
18
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
19
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
20
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
21
|
+
};
|
22
|
+
tip: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
23
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
24
|
+
});
|
25
|
+
open?: boolean | undefined;
|
26
|
+
}>);
|
21
27
|
}
|
22
28
|
export {};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { type OverlayPosition } from "../layout/overlays.svelte.js";
|
2
|
+
import type { ComponentType, Snippet } from "svelte";
|
3
|
+
/**
|
4
|
+
* Add a notification to the screen.
|
5
|
+
* @param {object} opts - The options for the notification.
|
6
|
+
* @param {string} opts.content - The content of the notification.
|
7
|
+
* @param {OverlayPosition} opts.position - The position of the notification.
|
8
|
+
* @param {Snippet | ComponentType} opts.icon - The icon of the notification.
|
9
|
+
* @param {string} opts.title - The title of the notification.
|
10
|
+
* @param {string} opts.stack - Group notifications together by named stacks.
|
11
|
+
* @param {number} opts.autoClose - The time in milliseconds before the notification closes.
|
12
|
+
* @returns {void}
|
13
|
+
*/
|
14
|
+
export declare function addNotification(opts: {
|
15
|
+
content: string;
|
16
|
+
position?: OverlayPosition;
|
17
|
+
icon?: Snippet | ComponentType;
|
18
|
+
title?: string;
|
19
|
+
stack?: string;
|
20
|
+
autoClose?: number;
|
21
|
+
}): void;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { createId } from "../utils/id.js";
|
2
|
+
import { addOverlay, removeOverlay } from "../layout/overlays.svelte.js";
|
3
|
+
import NotificationSvelte from "./Notification.svelte";
|
4
|
+
/**
|
5
|
+
* Add a notification to the screen.
|
6
|
+
* @param {object} opts - The options for the notification.
|
7
|
+
* @param {string} opts.content - The content of the notification.
|
8
|
+
* @param {OverlayPosition} opts.position - The position of the notification.
|
9
|
+
* @param {Snippet | ComponentType} opts.icon - The icon of the notification.
|
10
|
+
* @param {string} opts.title - The title of the notification.
|
11
|
+
* @param {string} opts.stack - Group notifications together by named stacks.
|
12
|
+
* @param {number} opts.autoClose - The time in milliseconds before the notification closes.
|
13
|
+
* @returns {void}
|
14
|
+
*/
|
15
|
+
export function addNotification(opts) {
|
16
|
+
const id = createId();
|
17
|
+
addOverlay({
|
18
|
+
id,
|
19
|
+
z: 100,
|
20
|
+
content: NotificationSvelte,
|
21
|
+
props: { id, ...opts },
|
22
|
+
stack: opts.stack,
|
23
|
+
position: opts.position || "top right",
|
24
|
+
layer: "notifications",
|
25
|
+
});
|
26
|
+
if (opts.autoClose) {
|
27
|
+
setTimeout(() => {
|
28
|
+
removeOverlay(id);
|
29
|
+
}, opts.autoClose);
|
30
|
+
}
|
31
|
+
}
|
@@ -20,5 +20,17 @@ export type ButtonProps = typeof __propDef.props;
|
|
20
20
|
export type ButtonEvents = typeof __propDef.events;
|
21
21
|
export type ButtonSlots = typeof __propDef.slots;
|
22
22
|
export default class Button extends SvelteComponent<ButtonProps, ButtonEvents, ButtonSlots> {
|
23
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
24
|
+
href?: string | undefined;
|
25
|
+
type?: "button" | "submit" | "reset" | undefined;
|
26
|
+
disabled?: boolean | undefined;
|
27
|
+
icon?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
28
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
29
|
+
}) | ComponentType | undefined;
|
30
|
+
onclick?: ((event: MouseEvent) => void) | undefined;
|
31
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
32
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
33
|
+
};
|
34
|
+
}>);
|
23
35
|
}
|
24
36
|
export {};
|
@@ -14,5 +14,11 @@ export type FieldActionsProps = typeof __propDef.props;
|
|
14
14
|
export type FieldActionsEvents = typeof __propDef.events;
|
15
15
|
export type FieldActionsSlots = typeof __propDef.slots;
|
16
16
|
export default class FieldActions extends SvelteComponent<FieldActionsProps, FieldActionsEvents, FieldActionsSlots> {
|
17
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
18
|
+
align?: "middle" | "justified" | "start" | "end" | undefined;
|
19
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
20
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
21
|
+
};
|
22
|
+
}>);
|
17
23
|
}
|
18
24
|
export {};
|
@@ -14,5 +14,11 @@ export type FieldContainerProps = typeof __propDef.props;
|
|
14
14
|
export type FieldContainerEvents = typeof __propDef.events;
|
15
15
|
export type FieldContainerSlots = typeof __propDef.slots;
|
16
16
|
export default class FieldContainer extends SvelteComponent<FieldContainerProps, FieldContainerEvents, FieldContainerSlots> {
|
17
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
18
|
+
contained?: boolean | undefined;
|
19
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
20
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
21
|
+
};
|
22
|
+
}>);
|
17
23
|
}
|
18
24
|
export {};
|
@@ -32,5 +32,28 @@ export type FieldContentProps = typeof __propDef.props;
|
|
32
32
|
export type FieldContentEvents = typeof __propDef.events;
|
33
33
|
export type FieldContentSlots = typeof __propDef.slots;
|
34
34
|
export default class FieldContent extends SvelteComponent<FieldContentProps, FieldContentEvents, FieldContentSlots> {
|
35
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
36
|
+
id: string;
|
37
|
+
contained?: boolean | undefined;
|
38
|
+
prefix?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
39
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
40
|
+
}) | undefined;
|
41
|
+
suffix?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
42
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
43
|
+
}) | undefined;
|
44
|
+
type?: string | undefined;
|
45
|
+
label?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
46
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
47
|
+
}) | undefined;
|
48
|
+
labelTip?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
49
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
50
|
+
}) | undefined;
|
51
|
+
direction?: "row" | "column" | undefined;
|
52
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
53
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
54
|
+
};
|
55
|
+
field?: FormField | undefined;
|
56
|
+
issue?: FormIssue | undefined;
|
57
|
+
}>);
|
35
58
|
}
|
36
59
|
export {};
|
@@ -13,5 +13,9 @@ export type FieldErrorProps = typeof __propDef.props;
|
|
13
13
|
export type FieldErrorEvents = typeof __propDef.events;
|
14
14
|
export type FieldErrorSlots = typeof __propDef.slots;
|
15
15
|
export default class FieldError extends SvelteComponent<FieldErrorProps, FieldErrorEvents, FieldErrorSlots> {
|
16
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
17
|
+
code: string;
|
18
|
+
message?: string | undefined;
|
19
|
+
}>);
|
16
20
|
}
|
17
21
|
export {};
|
@@ -57,7 +57,7 @@ let {
|
|
57
57
|
.FieldSection.noTitle .FieldSectionFields {
|
58
58
|
grid-column: 1 / -1;
|
59
59
|
}
|
60
|
-
@
|
60
|
+
@media(max-width: 1280px) {
|
61
61
|
.FieldSection {
|
62
62
|
padding: 2em;
|
63
63
|
gap: 1.5em;
|
@@ -66,6 +66,18 @@ let {
|
|
66
66
|
gap: 0.5em;
|
67
67
|
padding-block-end: 1.5em;
|
68
68
|
}
|
69
|
+
}
|
70
|
+
@media(max-width: 640px) {
|
71
|
+
.FieldSection {
|
72
|
+
padding: 1em;
|
73
|
+
gap: 1.5em;
|
74
|
+
}
|
75
|
+
.FieldSectionTitle {
|
76
|
+
gap: 0.5em;
|
77
|
+
padding-block-end: 1.5em;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
@container (max-width: 800px) {
|
69
81
|
.FieldSectionTitle,
|
70
82
|
.FieldSectionFields {
|
71
83
|
grid-column: 1 / -1;
|
@@ -19,5 +19,16 @@ export type FieldSectionProps = typeof __propDef.props;
|
|
19
19
|
export type FieldSectionEvents = typeof __propDef.events;
|
20
20
|
export type FieldSectionSlots = typeof __propDef.slots;
|
21
21
|
export default class FieldSection extends SvelteComponent<FieldSectionProps, FieldSectionEvents, FieldSectionSlots> {
|
22
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
23
|
+
title?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
24
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
25
|
+
}) | undefined;
|
26
|
+
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
27
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
28
|
+
}) | undefined;
|
29
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
30
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
31
|
+
};
|
32
|
+
}>);
|
22
33
|
}
|
23
34
|
export {};
|
@@ -2,23 +2,16 @@ import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { Snippet } from "svelte";
|
3
3
|
declare const __propDef: {
|
4
4
|
props: {
|
5
|
-
/** Whether the fieldset should be full width. */
|
6
5
|
fullWidth?: boolean | undefined;
|
7
|
-
/** The description of the fieldset. */
|
8
6
|
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
9
7
|
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
10
8
|
}) | undefined;
|
11
|
-
/** Whether the fieldset should be contained. */
|
12
9
|
contained?: boolean | undefined;
|
13
|
-
/** Whether the fieldset should be rounded. */
|
14
10
|
rounded?: boolean | undefined;
|
15
|
-
/** The legend of the fieldset. */
|
16
11
|
legend?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
17
12
|
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
18
13
|
}) | undefined;
|
19
|
-
/** The number of columns to display the fieldset in. You can pass a single number or an array of numbers. The array will be used to set the number of columns at different breakpoints (lg, md, sm). */
|
20
14
|
columns?: number | [number] | [number, number] | [number, number, number] | undefined;
|
21
|
-
/** Content to be rendered inside the fieldset. */
|
22
15
|
children: Snippet;
|
23
16
|
};
|
24
17
|
events: {
|
@@ -30,5 +23,20 @@ export type FieldsetProps = typeof __propDef.props;
|
|
30
23
|
export type FieldsetEvents = typeof __propDef.events;
|
31
24
|
export type FieldsetSlots = typeof __propDef.slots;
|
32
25
|
export default class Fieldset extends SvelteComponent<FieldsetProps, FieldsetEvents, FieldsetSlots> {
|
26
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
27
|
+
fullWidth?: boolean | undefined;
|
28
|
+
description?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
29
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
30
|
+
}) | undefined;
|
31
|
+
contained?: boolean | undefined;
|
32
|
+
rounded?: boolean | undefined;
|
33
|
+
legend?: string | ((this: void) => typeof import("svelte").SnippetReturn & {
|
34
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
35
|
+
}) | undefined;
|
36
|
+
columns?: number | [number] | [number, number] | [number, number, number] | undefined;
|
37
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
38
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
39
|
+
};
|
40
|
+
}>);
|
33
41
|
}
|
34
42
|
export {};
|
package/dist/form/Form.svelte
CHANGED
@@ -6,39 +6,41 @@ import { get } from "svelte/store";
|
|
6
6
|
import { dezerialize } from "@auth70/zodex-esm";
|
7
7
|
import { array } from "zod";
|
8
8
|
import { arrayPathToStringPath, getIndividualValidators, parseFormIssues } from "./form.js";
|
9
|
+
import { useForm } from "./client.svelte.js";
|
9
10
|
let {
|
10
|
-
form,
|
11
|
+
form: _form,
|
11
12
|
action,
|
12
13
|
enctype = "multipart/form-data",
|
13
14
|
method = "POST",
|
14
15
|
fullWidth = false,
|
15
16
|
children
|
16
17
|
} = $props();
|
17
|
-
|
18
|
-
setContext("form
|
19
|
-
|
18
|
+
let form = $state(_form ? useForm(_form) : null);
|
19
|
+
setContext("form", form?.form);
|
20
|
+
setContext("form.validators", getIndividualValidators(form?.form));
|
21
|
+
const schema = form?.form.schema ? dezerialize(form?.form.schema) : null;
|
20
22
|
const bodyguard = new Bodyguard();
|
21
23
|
let formEl;
|
22
24
|
function setFormIssuesAndFields(issues, fields) {
|
23
25
|
if (form) {
|
24
|
-
form.issues = issues;
|
25
|
-
form.fields = fields;
|
26
|
+
form.form.issues = issues;
|
27
|
+
form.form.fields = fields;
|
26
28
|
}
|
27
29
|
}
|
28
30
|
async function validate() {
|
29
31
|
if (form && schema) {
|
30
|
-
form.tainted = true;
|
32
|
+
form.form.tainted = true;
|
31
33
|
const req = new Request("localhost", {
|
32
34
|
method: "POST",
|
33
35
|
body: new FormData(formEl)
|
34
36
|
});
|
35
37
|
const result = await bodyguard.softForm(req, schema.parse);
|
36
38
|
if (result.success === true) {
|
37
|
-
form.valid = true;
|
38
|
-
form.issues = [];
|
39
|
+
form.form.valid = true;
|
40
|
+
form.form.issues = [];
|
39
41
|
} else {
|
40
|
-
form.valid = false;
|
41
|
-
form.issues = parseFormIssues(result.error.issues);
|
42
|
+
form.form.valid = false;
|
43
|
+
form.form.issues = parseFormIssues(result.error.issues);
|
42
44
|
}
|
43
45
|
}
|
44
46
|
}
|
@@ -68,8 +70,9 @@ onMount(() => {
|
|
68
70
|
const resultForm = result.type !== "redirect" && result.type !== "error" ? result?.data?.form : null;
|
69
71
|
if(result.type === "success") {
|
70
72
|
if(resultForm && form) {
|
71
|
-
form.valid = Object.assign({ valid: false }, resultForm).valid ?? false;
|
73
|
+
form.form.valid = Object.assign({ valid: false }, resultForm).valid ?? false;
|
72
74
|
}
|
75
|
+
update();
|
73
76
|
} else if(result.type === "failure") {
|
74
77
|
if(resultForm && form) {
|
75
78
|
setFormIssuesAndFields(
|
@@ -19,5 +19,15 @@ export type FormProps = typeof __propDef.props;
|
|
19
19
|
export type FormEvents = typeof __propDef.events;
|
20
20
|
export type FormSlots = typeof __propDef.slots;
|
21
21
|
export default class Form extends SvelteComponent<FormProps, FormEvents, FormSlots> {
|
22
|
+
constructor(options?: import("svelte").ComponentConstructorOptions<{
|
23
|
+
form?: Form<any> | undefined;
|
24
|
+
action?: string | undefined;
|
25
|
+
enctype?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | undefined;
|
26
|
+
method?: "GET" | "POST" | undefined;
|
27
|
+
fullWidth?: boolean | undefined;
|
28
|
+
children: (this: void) => typeof import("svelte").SnippetReturn & {
|
29
|
+
_: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\"";
|
30
|
+
};
|
31
|
+
}>);
|
22
32
|
}
|
23
33
|
export {};
|
package/dist/form/Input.svelte
CHANGED
@@ -62,7 +62,8 @@ let {
|
|
62
62
|
type,
|
63
63
|
value = $bindable(),
|
64
64
|
viewable,
|
65
|
-
webkitdirectory
|
65
|
+
webkitdirectory,
|
66
|
+
...rest
|
66
67
|
} = $props();
|
67
68
|
let el = $state();
|
68
69
|
let copyTitle = $state("Copy");
|
@@ -110,6 +111,7 @@ function copy(e) {
|
|
110
111
|
copyTitle = "Copy";
|
111
112
|
copyTooltipOpen = false;
|
112
113
|
}, 1500);
|
114
|
+
el.focus();
|
113
115
|
}
|
114
116
|
</script>
|
115
117
|
|
@@ -117,7 +119,6 @@ function copy(e) {
|
|
117
119
|
<input
|
118
120
|
bind:this={el}
|
119
121
|
{alt}
|
120
|
-
{...attrs}
|
121
122
|
autocapitalize={typeof autocapitalize === 'string' ? autocapitalize : (typeof autocapitalize === 'boolean' ? (autocapitalize ? 'on' : 'off') : undefined)}
|
122
123
|
{autocomplete}
|
123
124
|
autocorrect={typeof autocorrect === 'boolean' ? (autocorrect ? 'on' : 'off') : undefined}
|
@@ -157,6 +158,7 @@ function copy(e) {
|
|
157
158
|
{type}
|
158
159
|
value={value || getFromObjWithStringPath(Object.assign(originalData ?? {}, data ?? {}), name) || form?.fields?.[name]?.defaultValue || ''}
|
159
160
|
{webkitdirectory}
|
161
|
+
{...rest}
|
160
162
|
/>
|
161
163
|
{/snippet}
|
162
164
|
|