contain-css-svelte 1.1.19 → 1.2.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/Card.svelte +22 -8
- package/dist/Card.svelte.d.ts +4 -5
- package/dist/controls/Button.svelte +19 -5
- package/dist/controls/Button.svelte.d.ts +4 -4
- package/dist/controls/ButtonLink.svelte +17 -14
- package/dist/controls/ButtonLink.svelte.d.ts +4 -4
- package/dist/controls/Checkbox.svelte +15 -8
- package/dist/controls/Checkbox.svelte.d.ts +4 -4
- package/dist/controls/CircleButton.svelte +14 -7
- package/dist/controls/CircleButton.svelte.d.ts +4 -4
- package/dist/controls/Input.svelte +14 -3
- package/dist/controls/Input.svelte.d.ts +4 -3
- package/dist/controls/Option.svelte +4 -3
- package/dist/controls/Option.svelte.d.ts +3 -2
- package/dist/controls/RadioButton.svelte +14 -7
- package/dist/controls/RadioButton.svelte.d.ts +4 -4
- package/dist/controls/Select.svelte +15 -3
- package/dist/controls/Select.svelte.d.ts +4 -3
- package/dist/controls/Slider.svelte +5 -11
- package/dist/controls/Slider.svelte.d.ts +3 -3
- package/dist/controls/TabItem.svelte +24 -5
- package/dist/controls/TabItem.svelte.d.ts +4 -4
- package/dist/controls/Toggle.svelte +21 -5
- package/dist/controls/Toggle.svelte.d.ts +4 -4
- package/dist/dropdowns/DropdownMenu.svelte +18 -6
- package/dist/dropdowns/DropdownMenu.svelte.d.ts +4 -4
- package/dist/layout/Accordion.svelte +17 -2
- package/dist/layout/Accordion.svelte.d.ts +5 -3
- package/dist/layout/Bar.svelte +27 -15
- package/dist/layout/Bar.svelte.d.ts +4 -4
- package/dist/layout/Column.svelte.d.ts +3 -3
- package/dist/layout/ColumnContainer.svelte +12 -9
- package/dist/layout/ColumnContainer.svelte.d.ts +4 -4
- package/dist/layout/Columns.svelte +4 -3
- package/dist/layout/Columns.svelte.d.ts +7 -3
- package/dist/layout/Container.svelte +23 -8
- package/dist/layout/Container.svelte.d.ts +7 -5
- package/dist/layout/DataList.svelte +15 -7
- package/dist/layout/DataList.svelte.d.ts +5 -4
- package/dist/layout/DataListItem.svelte +14 -8
- package/dist/layout/DataListItem.svelte.d.ts +4 -4
- package/dist/layout/Fieldset.svelte +16 -8
- package/dist/layout/Fieldset.svelte.d.ts +6 -3
- package/dist/layout/Form.svelte +17 -8
- package/dist/layout/Form.svelte.d.ts +8 -6
- package/dist/layout/FormItem.svelte +12 -7
- package/dist/layout/FormItem.svelte.d.ts +4 -3
- package/dist/layout/FormProvider.svelte +3 -0
- package/dist/layout/GridLayout.svelte +14 -9
- package/dist/layout/GridLayout.svelte.d.ts +4 -4
- package/dist/layout/GridRow.svelte +6 -10
- package/dist/layout/GridRow.svelte.d.ts +3 -2
- package/dist/layout/Hero.svelte +14 -8
- package/dist/layout/Hero.svelte.d.ts +4 -4
- package/dist/layout/Inline.svelte +16 -15
- package/dist/layout/Inline.svelte.d.ts +4 -4
- package/dist/layout/MenuList.svelte +13 -6
- package/dist/layout/MenuList.svelte.d.ts +4 -4
- package/dist/layout/Page.svelte +14 -8
- package/dist/layout/Page.svelte.d.ts +11 -3
- package/dist/layout/ResponsiveText.svelte +4 -0
- package/dist/layout/Row.svelte.d.ts +3 -3
- package/dist/layout/RowContainer.svelte +12 -9
- package/dist/layout/RowContainer.svelte.d.ts +4 -4
- package/dist/layout/Sidebar.svelte +17 -6
- package/dist/layout/Sidebar.svelte.d.ts +12 -4
- package/dist/layout/SplitPane.svelte +8 -14
- package/dist/layout/SplitPane.svelte.d.ts +16 -2
- package/dist/layout/Stack.svelte +16 -15
- package/dist/layout/Stack.svelte.d.ts +4 -4
- package/dist/layout/TabBar.svelte +12 -2
- package/dist/layout/TabBar.svelte.d.ts +17 -10
- package/dist/layout/Table.svelte +5 -1
- package/dist/layout/Tile.svelte +40 -27
- package/dist/layout/Tile.svelte.d.ts +32 -10
- package/dist/misc/Code.svelte +2 -0
- package/dist/misc/Progress.svelte +25 -8
- package/dist/misc/Progress.svelte.d.ts +15 -8
- package/dist/misc/Tag.svelte +97 -44
- package/dist/misc/Tag.svelte.d.ts +17 -5
- package/dist/overlays/Dialog.svelte +18 -5
- package/dist/overlays/Dialog.svelte.d.ts +5 -3
- package/dist/overlays/Tooltip.svelte +21 -3
- package/dist/overlays/Tooltip.svelte.d.ts +5 -3
- package/dist/styleProps.d.ts +67 -0
- package/dist/styleProps.js +76 -0
- package/dist/types.d.ts +40 -1
- package/dist/types.js +1 -1
- package/dist/typography/Text.svelte +4 -11
- package/dist/typography/TextLayout.svelte +4 -7
- package/dist/typography/TextLayout.svelte.d.ts +4 -3
- package/dist/util.d.ts +60 -3
- package/dist/util.js +101 -11
- package/package.json +1 -1
package/dist/Card.svelte
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "./util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_CONTAINER_VARS, } from "./styleProps";
|
|
3
|
+
let { header, footer, children, height, fixedHeight, center, class: className, ...restProps } = $props();
|
|
4
|
+
/* `height` is destructured (the $effect below reads it), so it has to be
|
|
5
|
+
handed back explicitly -- rest props no longer carry it. */
|
|
6
|
+
/* The shorthands card's own CSS backs, one group per mixin it
|
|
7
|
+
includes. The Props type is derived from this same array, so what the
|
|
8
|
+
component accepts and what it emits cannot drift apart. */
|
|
9
|
+
const CARD_VARS = [
|
|
10
|
+
...COLOR_VARS,
|
|
11
|
+
...TYPOGRAPHY_CONTAINER_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps({ height, ...restProps }, "card", [
|
|
14
|
+
...CARD_VARS,
|
|
6
15
|
"padding",
|
|
7
16
|
"width",
|
|
8
17
|
"height",
|
|
@@ -19,7 +28,7 @@ let hasHeader = $derived(Boolean(header));
|
|
|
19
28
|
let hasFooter = $derived(Boolean(footer));
|
|
20
29
|
</script>
|
|
21
30
|
|
|
22
|
-
<div class="card" class:center class:fixedHeight
|
|
31
|
+
<div class={["card", className]} class:center class:fixedHeight {...el}>
|
|
23
32
|
<header class:hide={!hasHeader}>
|
|
24
33
|
{#if header}{@render header()}{/if}
|
|
25
34
|
</header>
|
|
@@ -61,8 +70,13 @@ let hasFooter = $derived(Boolean(footer));
|
|
|
61
70
|
visually changes for existing callers -- but now a caller who wants
|
|
62
71
|
a header Card flush against the content below it, say, can set just
|
|
63
72
|
one axis instead of fighting a 4-value margin shorthand. */
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
/* The innermost fallback is the pre-marginBlock/marginInline escape
|
|
74
|
+
hatch (a single --card-margin applied to both axes) rather than a bare
|
|
75
|
+
16px, so anyone already setting --card-margin directly keeps working
|
|
76
|
+
unchanged -- margin-block/margin-inline just give a newer, more
|
|
77
|
+
specific override on top of it. */
|
|
78
|
+
margin-block: var(--card-margin-block, var(--margin-block, var(--card-margin, 16px)));
|
|
79
|
+
margin-inline: var(--card-margin-inline, var(--margin-inline, var(--card-margin, 16px)));
|
|
66
80
|
border-radius: var(--card-border-radius, var(--surface-border-radius, var(--border-radius, 0)));
|
|
67
81
|
border: var(--card-border, var(--surface-border, var(--border, var(--border-width) var(--border-style) var(--border-color))));
|
|
68
82
|
--link-bg: var(--card-link-bg, var(--surface-link-bg, inherit));
|
package/dist/Card.svelte.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { CardStyleProps } from "./types";
|
|
4
|
-
type
|
|
3
|
+
import type { CardStyleProps, ContainProps } from "./types";
|
|
4
|
+
import { type StyleProps } from "./styleProps";
|
|
5
|
+
declare const Card: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
6
|
header?: Snippet;
|
|
6
7
|
footer?: Snippet;
|
|
7
8
|
children?: Snippet;
|
|
8
9
|
center?: boolean;
|
|
9
|
-
height?: string;
|
|
10
10
|
fixedHeight?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare const Card: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
}, CardStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant", "lineWidth"]>>, {}, "">;
|
|
13
12
|
type Card = ReturnType<typeof Card>;
|
|
14
13
|
export default Card;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { primary = false, secondary = false, warning = false, danger = false, success = false, info = false, icon, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const BUTTON_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "button", [
|
|
14
|
+
...BUTTON_VARS,
|
|
15
|
+
"width",
|
|
16
|
+
"height",
|
|
17
|
+
]));
|
|
4
18
|
</script>
|
|
5
19
|
|
|
6
20
|
<button
|
|
7
|
-
{
|
|
21
|
+
class={className}
|
|
8
22
|
class:primary
|
|
9
23
|
class:secondary
|
|
10
24
|
class:warning
|
|
@@ -12,7 +26,7 @@ const style = $derived(injectVars(restProps, "button", ["bg", "fg", "padding", "
|
|
|
12
26
|
class:success
|
|
13
27
|
class:info
|
|
14
28
|
class:has-icon={icon}
|
|
15
|
-
{...
|
|
29
|
+
{...el}
|
|
16
30
|
>
|
|
17
31
|
<span class="content">{@render children?.()}</span>
|
|
18
32
|
{#if icon}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Button: import("svelte").Component<ContainProps<HTMLButtonAttributes, {
|
|
5
6
|
primary?: boolean;
|
|
6
7
|
secondary?: boolean;
|
|
7
8
|
warning?: boolean;
|
|
@@ -10,7 +11,6 @@ type Props = {
|
|
|
10
11
|
info?: boolean;
|
|
11
12
|
icon?: Snippet;
|
|
12
13
|
children?: Snippet;
|
|
13
|
-
}
|
|
14
|
-
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
15
15
|
type Button = ReturnType<typeof Button>;
|
|
16
16
|
export default Button;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { primary = false, secondary = false, warning = false, danger = false, success = false, info = false, href = "#", id = null, icon, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const BUTTON_LINK_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "button", [
|
|
14
|
+
...BUTTON_LINK_VARS,
|
|
12
15
|
"width",
|
|
13
16
|
"height",
|
|
14
|
-
])
|
|
17
|
+
]));
|
|
15
18
|
const iconSlotted = $derived(Boolean(icon));
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<a
|
|
19
22
|
role="button"
|
|
20
|
-
{style}
|
|
21
23
|
{href}
|
|
22
24
|
id={id ?? undefined}
|
|
25
|
+
class={className}
|
|
23
26
|
class:primary
|
|
24
27
|
class:secondary
|
|
25
28
|
class:warning
|
|
@@ -27,7 +30,7 @@ const iconSlotted = $derived(Boolean(icon));
|
|
|
27
30
|
class:success
|
|
28
31
|
class:info
|
|
29
32
|
class:has-icon={iconSlotted}
|
|
30
|
-
{...
|
|
33
|
+
{...el}
|
|
31
34
|
>
|
|
32
35
|
<span class="content">{@render children?.()}</span>
|
|
33
36
|
<span class:hidden={!iconSlotted} class="icon">
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const ButtonLink: import("svelte").Component<ContainProps<HTMLAnchorAttributes, {
|
|
5
6
|
primary?: boolean;
|
|
6
7
|
secondary?: boolean;
|
|
7
8
|
warning?: boolean;
|
|
@@ -12,7 +13,6 @@ type Props = {
|
|
|
12
13
|
id?: string | null;
|
|
13
14
|
icon?: Snippet;
|
|
14
15
|
children?: Snippet;
|
|
15
|
-
}
|
|
16
|
-
declare const ButtonLink: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
17
17
|
type ButtonLink = ReturnType<typeof ButtonLink>;
|
|
18
18
|
export default ButtonLink;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { splitProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { checked = $bindable(undefined), name = "", value = undefined, group = $bindable(undefined), children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands checkbox's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const CHECKBOX_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(splitProps(restProps, "checkbox", [
|
|
12
|
+
...CHECKBOX_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -29,7 +36,7 @@ function handleGroupChange(event) {
|
|
|
29
36
|
let ref = $state(null);
|
|
30
37
|
</script>
|
|
31
38
|
|
|
32
|
-
<div class="label-sizing-box" {style}>
|
|
39
|
+
<div class={["label-sizing-box", className]} style={el.style}>
|
|
33
40
|
<label class="checkbox-item">
|
|
34
41
|
{#if useGroup}
|
|
35
42
|
<input
|
|
@@ -38,14 +45,14 @@ let ref = $state(null);
|
|
|
38
45
|
{value}
|
|
39
46
|
checked={isChecked}
|
|
40
47
|
onchange={handleGroupChange}
|
|
41
|
-
{...
|
|
48
|
+
{...el.attrs}
|
|
42
49
|
/>
|
|
43
50
|
{:else}
|
|
44
51
|
<input
|
|
45
52
|
name={name || (ref && ref.textContent) || undefined}
|
|
46
53
|
type="checkbox"
|
|
47
54
|
bind:checked
|
|
48
|
-
{...
|
|
55
|
+
{...el.attrs}
|
|
49
56
|
/>
|
|
50
57
|
{/if}
|
|
51
58
|
<span bind:this={ref}>{@render children?.()}</span>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Checkbox: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
5
6
|
checked?: boolean | undefined;
|
|
6
7
|
name?: string;
|
|
7
8
|
value?: any;
|
|
8
9
|
group?: any[];
|
|
9
10
|
children?: Snippet;
|
|
10
|
-
}
|
|
11
|
-
declare const Checkbox: import("svelte").Component<Props, {}, "group" | "checked">;
|
|
11
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>, "type" | "value">, {}, "checked" | "group">;
|
|
12
12
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
13
13
|
export default Checkbox;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { primary = false, warning = false, danger = false, success = false, info = false, type = "button", children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands mini-button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const CIRCLE_BUTTON_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(elementProps(restProps, "mini-button", [
|
|
12
|
+
...CIRCLE_BUTTON_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -10,14 +17,14 @@ const style = $derived(injectVars(restProps, "mini-button", [
|
|
|
10
17
|
</script>
|
|
11
18
|
|
|
12
19
|
<button
|
|
13
|
-
{style}
|
|
14
20
|
{type}
|
|
21
|
+
class={className}
|
|
15
22
|
class:primary
|
|
16
23
|
class:warning
|
|
17
24
|
class:danger
|
|
18
25
|
class:success
|
|
19
26
|
class:info
|
|
20
|
-
{...
|
|
27
|
+
{...el}
|
|
21
28
|
>
|
|
22
29
|
{@render children?.()}
|
|
23
30
|
</button>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
2
|
-
import type { BaseStyleProps } from "../types";
|
|
3
|
-
type
|
|
2
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
4
|
+
declare const CircleButton: import("svelte").Component<ContainProps<HTMLButtonAttributes, {
|
|
4
5
|
primary?: boolean;
|
|
5
6
|
warning?: boolean;
|
|
6
7
|
danger?: boolean;
|
|
@@ -8,7 +9,6 @@ type Props = {
|
|
|
8
9
|
info?: boolean;
|
|
9
10
|
type?: "button" | "submit" | "reset";
|
|
10
11
|
children?: import("svelte").Snippet;
|
|
11
|
-
}
|
|
12
|
-
declare const CircleButton: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
13
13
|
type CircleButton = ReturnType<typeof CircleButton>;
|
|
14
14
|
export default CircleButton;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { value = $bindable(""), placeholder = "", class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands this component's own CSS backs, one group per mixin
|
|
5
|
+
it includes. The Props type is derived from this same array, so what
|
|
6
|
+
the component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const INPUT_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "input", INPUT_VARS));
|
|
3
14
|
</script>
|
|
4
15
|
|
|
5
|
-
<input bind:value {placeholder} {...
|
|
16
|
+
<input bind:value {placeholder} class={className} {...el} />
|
|
6
17
|
|
|
7
18
|
<style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
|
|
8
19
|
one value (both sides equal) or two (start end), so there is no separate
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
-
type
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
4
|
+
declare const Input: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
3
5
|
value?: string | number;
|
|
4
6
|
placeholder?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const Input: import("svelte").Component<Props, {}, "value">;
|
|
7
|
+
}, StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "value">;
|
|
7
8
|
type Input = ReturnType<typeof Input>;
|
|
8
9
|
export default Input;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
let { children, value, class: className, ...restProps } = $props();
|
|
3
|
+
const el = $derived(elementProps(restProps, "option"));
|
|
2
4
|
let template = $state();
|
|
3
5
|
// Extracted from the rendered children, in the DOM.
|
|
4
6
|
let textContent = $state("");
|
|
@@ -31,10 +33,9 @@ $effect(() => {
|
|
|
31
33
|
});
|
|
32
34
|
return () => observer.disconnect();
|
|
33
35
|
});
|
|
34
|
-
export {};
|
|
35
36
|
</script>
|
|
36
37
|
|
|
37
|
-
<option data-html={htmlContent} {value} {...
|
|
38
|
+
<option data-html={htmlContent} {value} class={className} {...el}>
|
|
38
39
|
{@html textContent}
|
|
39
40
|
</option>
|
|
40
41
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { HTMLOptionAttributes } from "svelte/elements";
|
|
2
|
-
type
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
type Props = ContainProps<HTMLOptionAttributes, {
|
|
3
4
|
children?: import("svelte").Snippet;
|
|
4
5
|
value?: any;
|
|
5
|
-
}
|
|
6
|
+
}, {}, "value">;
|
|
6
7
|
declare const Option: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type Option = ReturnType<typeof Option>;
|
|
8
9
|
export default Option;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { splitProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { group = $bindable(undefined), value = undefined, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands radio-button's own CSS backs, one group per mixin it
|
|
5
|
+
includes. The Props type is derived from this same array, so what the
|
|
6
|
+
component accepts and what it emits cannot drift apart. */
|
|
7
|
+
const RADIO_BUTTON_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(splitProps(restProps, "radio-button", [
|
|
12
|
+
...RADIO_BUTTON_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -15,14 +22,14 @@ function handleChange() {
|
|
|
15
22
|
}
|
|
16
23
|
</script>
|
|
17
24
|
|
|
18
|
-
<div class="label-sizing-box" {style}>
|
|
25
|
+
<div class={["label-sizing-box", className]} style={el.style}>
|
|
19
26
|
<label class="radio-item">
|
|
20
27
|
<input
|
|
21
28
|
{value}
|
|
22
29
|
type="radio"
|
|
23
30
|
checked={isChecked}
|
|
24
31
|
onchange={handleChange}
|
|
25
|
-
{...
|
|
32
|
+
{...el.attrs}
|
|
26
33
|
/>
|
|
27
34
|
<span>{@render children?.()}</span>
|
|
28
35
|
</label>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const RadioButton: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
5
6
|
group?: any;
|
|
6
7
|
value?: any;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
-
declare const RadioButton: import("svelte").Component<Props, {}, "group">;
|
|
9
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>, "type" | "value">, {}, "group">;
|
|
10
10
|
type RadioButton = ReturnType<typeof RadioButton>;
|
|
11
11
|
export default RadioButton;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
<script lang="ts">import
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
import DropdownMenu from "../dropdowns/DropdownMenu.svelte";
|
|
2
4
|
import { onMount, tick } from "svelte";
|
|
3
|
-
let { value = $bindable(), children, "data-audit-action": dropdownAuditAction = null, matchMode = "prefix", typeaheadMode = "focus", ...restProps } = $props();
|
|
5
|
+
let { value = $bindable(), children, "data-audit-action": dropdownAuditAction = null, matchMode = "prefix", typeaheadMode = "focus", class: className, ...restProps } = $props();
|
|
6
|
+
/* The shorthands this component's own CSS backs, one group per mixin
|
|
7
|
+
it includes. The Props type is derived from this same array, so what
|
|
8
|
+
the component accepts and what it emits cannot drift apart. */
|
|
9
|
+
const SELECT_VARS = [
|
|
10
|
+
...COLOR_VARS,
|
|
11
|
+
...PADDING_VARS,
|
|
12
|
+
...RADIUS_VARS,
|
|
13
|
+
...TYPOGRAPHY_VARS,
|
|
14
|
+
];
|
|
15
|
+
const el = $derived(elementProps(restProps, "select", SELECT_VARS));
|
|
4
16
|
let selectElement = $state();
|
|
5
17
|
let observer;
|
|
6
18
|
let resizeObserver;
|
|
@@ -91,7 +103,7 @@ $effect(() => {
|
|
|
91
103
|
});
|
|
92
104
|
</script>
|
|
93
105
|
|
|
94
|
-
<select bind:value bind:this={selectElement} {...
|
|
106
|
+
<select bind:value bind:this={selectElement} class={className} {...el}>
|
|
95
107
|
{@render children?.()}
|
|
96
108
|
</select>
|
|
97
109
|
<div class="dropdown-wrapper" style:--target-width={targetWidth}>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { HTMLSelectAttributes } from "svelte/elements";
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
2
4
|
import type { MatchMode, TypeaheadMode } from "../dropdowns/DropdownMenu.svelte";
|
|
3
|
-
|
|
5
|
+
declare const Select: import("svelte").Component<ContainProps<HTMLSelectAttributes, {
|
|
4
6
|
value?: any;
|
|
5
7
|
children?: import("svelte").Snippet;
|
|
6
8
|
"data-audit-action"?: string | null;
|
|
@@ -8,7 +10,6 @@ type Props = {
|
|
|
8
10
|
matchMode?: MatchMode;
|
|
9
11
|
/** See {@link TypeaheadMode} on DropdownMenu -- focus a match or filter the list. */
|
|
10
12
|
typeaheadMode?: TypeaheadMode;
|
|
11
|
-
}
|
|
12
|
-
declare const Select: import("svelte").Component<Props, {}, "value">;
|
|
13
|
+
}, StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "value">;
|
|
13
14
|
type Select = ReturnType<typeof Select>;
|
|
14
15
|
export default Select;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
let { value = $bindable(0), min = 0, max = 100, step = 1, ...restProps } = $props();
|
|
3
|
-
const inlineStyle = $derived(restProps.style);
|
|
4
|
-
const elementProps = $derived.by(() => {
|
|
5
|
-
const { style: _, ...rest } = restProps;
|
|
6
|
-
return rest;
|
|
7
|
-
});
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
let { value = $bindable(0), min = 0, max = 100, step = 1, class: className, ...restProps } = $props();
|
|
8
3
|
const normalizedMin = $derived(Number.isFinite(min) ? min : 0);
|
|
9
4
|
const normalizedMax = $derived(Number.isFinite(max) && max > normalizedMin ? max : normalizedMin + 1);
|
|
10
5
|
const clampedValue = $derived(Math.min(Math.max(Number(value) || 0, normalizedMin), normalizedMax));
|
|
11
6
|
const fillPercent = $derived(((clampedValue - normalizedMin) / (normalizedMax - normalizedMin)) * 100);
|
|
12
|
-
const
|
|
7
|
+
const el = $derived(elementProps(restProps, "slider", ["bg", "fg", "padding", "width", "height"], `--slider-percent: ${fillPercent}%;`));
|
|
13
8
|
</script>
|
|
14
9
|
|
|
15
10
|
<input
|
|
16
|
-
class="slider"
|
|
11
|
+
class={["slider", className]}
|
|
17
12
|
type="range"
|
|
18
13
|
bind:value
|
|
19
14
|
{min}
|
|
20
15
|
{max}
|
|
21
16
|
{step}
|
|
22
|
-
{
|
|
23
|
-
{...elementProps}
|
|
17
|
+
{...el}
|
|
24
18
|
/>
|
|
25
19
|
|
|
26
20
|
<style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from "svelte/elements";
|
|
2
|
-
import type { BaseStyleProps } from "../types";
|
|
3
|
-
type Props = {
|
|
2
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
3
|
+
type Props = ContainProps<HTMLInputAttributes, {
|
|
4
4
|
value?: number;
|
|
5
5
|
min?: number;
|
|
6
6
|
max?: number;
|
|
7
7
|
step?: number | "any";
|
|
8
|
-
}
|
|
8
|
+
}, BaseStyleProps, "type" | "value" | "min" | "max" | "step">;
|
|
9
9
|
declare const Slider: import("svelte").Component<Props, {}, "value">;
|
|
10
10
|
type Slider = ReturnType<typeof Slider>;
|
|
11
11
|
export default Slider;
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
2
3
|
import Button from "./Button.svelte";
|
|
3
|
-
const { active = false, icon, children, ...restProps } = $props();
|
|
4
|
-
|
|
4
|
+
const { active = false, icon, children, class: className, ...restProps } = $props();
|
|
5
|
+
/* Everything goes to the Button, not to the wrapper. The wrapper is
|
|
6
|
+
`display: contents`, so it generates no box -- a caller's `style` put
|
|
7
|
+
there would be silently inert. The variables work on the Button too:
|
|
8
|
+
`.tab > button`'s rules read --tab-bg and friends, and a custom property
|
|
9
|
+
resolves on the element it is declared on. */
|
|
10
|
+
/* The shorthands tab's own CSS backs, one group per mixin it
|
|
11
|
+
includes. The Props type is derived from this same array, so what the
|
|
12
|
+
component accepts and what it emits cannot drift apart. */
|
|
13
|
+
const TAB_ITEM_VARS = [
|
|
14
|
+
...COLOR_VARS,
|
|
15
|
+
...PADDING_VARS,
|
|
16
|
+
...RADIUS_VARS,
|
|
17
|
+
...TYPOGRAPHY_VARS,
|
|
18
|
+
];
|
|
19
|
+
const el = $derived(elementProps(restProps, "tab", [
|
|
20
|
+
...TAB_ITEM_VARS,
|
|
21
|
+
"width",
|
|
22
|
+
"height",
|
|
23
|
+
]));
|
|
5
24
|
</script>
|
|
6
25
|
|
|
7
|
-
<div class="tab" class:active
|
|
8
|
-
<Button primary={active} {icon} {...
|
|
26
|
+
<div class="tab" class:active>
|
|
27
|
+
<Button primary={active} {icon} class={className} {...el}>
|
|
9
28
|
{@render children?.()}
|
|
10
29
|
</Button>
|
|
11
30
|
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const TabItem: import("svelte").Component<ContainProps<HTMLAttributes<HTMLButtonElement>, {
|
|
5
6
|
active?: boolean;
|
|
6
7
|
icon?: Snippet;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
-
declare const TabItem: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
10
10
|
type TabItem = ReturnType<typeof TabItem>;
|
|
11
11
|
export default TabItem;
|