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
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">import { splitProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { checked = $bindable(false), name = "", onLabel, offLabel, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* Variables and the caller's `style` go on the wrapper label, which is what
|
|
5
|
+
`.toggle`'s CSS targets; the attributes go on the input, which is what
|
|
6
|
+
`aria-*`, `required` and `data-*` are about. */
|
|
7
|
+
/* The shorthands toggle's own CSS backs, one group per mixin it
|
|
8
|
+
includes. The Props type is derived from this same array, so what the
|
|
9
|
+
component accepts and what it emits cannot drift apart. */
|
|
10
|
+
const TOGGLE_VARS = [
|
|
11
|
+
...COLOR_VARS,
|
|
12
|
+
...TYPOGRAPHY_VARS,
|
|
13
|
+
];
|
|
14
|
+
const el = $derived(splitProps(restProps, "toggle", [
|
|
15
|
+
...TOGGLE_VARS,
|
|
16
|
+
"padding",
|
|
17
|
+
"width",
|
|
18
|
+
"height",
|
|
19
|
+
]));
|
|
4
20
|
const hasOffLabel = $derived(Boolean(offLabel));
|
|
5
21
|
const hasOnLabel = $derived(Boolean(onLabel || children));
|
|
6
22
|
const effectiveOnLabel = $derived(onLabel || children);
|
|
7
23
|
</script>
|
|
8
24
|
|
|
9
|
-
<label class="toggle" {style}>
|
|
25
|
+
<label class={["toggle", className]} style={el.style}>
|
|
10
26
|
{#if hasOffLabel}
|
|
11
27
|
<span class="toggle-label toggle-label-off">{@render offLabel?.()}</span>
|
|
12
28
|
{/if}
|
|
@@ -16,7 +32,7 @@ const effectiveOnLabel = $derived(onLabel || children);
|
|
|
16
32
|
name={name || undefined}
|
|
17
33
|
type="checkbox"
|
|
18
34
|
bind:checked
|
|
19
|
-
{...
|
|
35
|
+
{...el.attrs}
|
|
20
36
|
/>
|
|
21
37
|
<span class="toggle-track" aria-hidden="true">
|
|
22
38
|
<span class="toggle-thumb"></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 Toggle: import("svelte").Component<ContainProps<HTMLInputAttributes, {
|
|
5
6
|
checked?: boolean;
|
|
6
7
|
name?: string;
|
|
7
8
|
onLabel?: Snippet;
|
|
8
9
|
offLabel?: Snippet;
|
|
9
10
|
children?: Snippet;
|
|
10
|
-
}
|
|
11
|
-
declare const Toggle: import("svelte").Component<Props, {}, "checked">;
|
|
11
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>, "type">, {}, "checked">;
|
|
12
12
|
type Toggle = ReturnType<typeof Toggle>;
|
|
13
13
|
export default Toggle;
|
|
@@ -4,18 +4,25 @@ export {};
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">import { cssProperties } from "../cssprops";
|
|
6
6
|
import MenuList from "../layout/MenuList.svelte";
|
|
7
|
-
import {
|
|
7
|
+
import { elementProps } from "../util";
|
|
8
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
8
9
|
import { onMount } from "svelte";
|
|
9
|
-
let { label, children, triggerAuditAction = null, matchMode = "prefix", typeaheadMode = "focus", ...props } = $props();
|
|
10
|
+
let { label, children, triggerAuditAction = null, matchMode = "prefix", typeaheadMode = "focus", class: className, ...props } = $props();
|
|
10
11
|
idPostfix++;
|
|
11
12
|
let id = "contain-dropdown-menu-" + idPostfix;
|
|
12
13
|
let buttonElement = $state();
|
|
13
14
|
let dropdownContentElement = $state();
|
|
14
15
|
let isOpen = $state(false);
|
|
15
16
|
// Style injection
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/* The shorthands menu's own CSS backs, one group per mixin it
|
|
18
|
+
includes. The Props type is derived from this same array, so what the
|
|
19
|
+
component accepts and what it emits cannot drift apart. */
|
|
20
|
+
const DROPDOWN_MENU_VARS = [
|
|
21
|
+
...COLOR_VARS,
|
|
22
|
+
...TYPOGRAPHY_VARS,
|
|
23
|
+
];
|
|
24
|
+
const el = $derived(elementProps(props, "menu", [
|
|
25
|
+
...DROPDOWN_MENU_VARS,
|
|
19
26
|
"padding",
|
|
20
27
|
"width",
|
|
21
28
|
"height",
|
|
@@ -232,7 +239,12 @@ let popoverDiv = $state();
|
|
|
232
239
|
|
|
233
240
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
234
241
|
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
235
|
-
<nav
|
|
242
|
+
<nav
|
|
243
|
+
class={["dropdown-menu", className]}
|
|
244
|
+
class:open={isOpen}
|
|
245
|
+
onkeydown={handleKeystroke}
|
|
246
|
+
{...el}
|
|
247
|
+
>
|
|
236
248
|
<button
|
|
237
249
|
bind:this={buttonElement}
|
|
238
250
|
onclick={triggerMenu}
|
|
@@ -14,16 +14,16 @@ export type MatchMode = "prefix" | "word" | "substring";
|
|
|
14
14
|
* focus follows the first remaining match
|
|
15
15
|
*/
|
|
16
16
|
export type TypeaheadMode = "focus" | "filter";
|
|
17
|
+
import { type StyleProps } from "../styleProps";
|
|
17
18
|
import type { Snippet } from "svelte";
|
|
18
|
-
import type { DropdownMenuStyleProps } from "../types";
|
|
19
|
+
import type { ContainProps, DropdownMenuStyleProps } from "../types";
|
|
19
20
|
import type { HTMLAttributes } from "svelte/elements";
|
|
20
|
-
|
|
21
|
+
declare const DropdownMenu: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
21
22
|
label?: Snippet;
|
|
22
23
|
children?: Snippet;
|
|
23
24
|
triggerAuditAction?: string | null;
|
|
24
25
|
matchMode?: MatchMode;
|
|
25
26
|
typeaheadMode?: TypeaheadMode;
|
|
26
|
-
}
|
|
27
|
-
declare const DropdownMenu: import("svelte").Component<Props, {}, "">;
|
|
27
|
+
}, DropdownMenuStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
28
28
|
type DropdownMenu = ReturnType<typeof DropdownMenu>;
|
|
29
29
|
export default DropdownMenu;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
<script lang="ts">import { onMount } from "svelte";
|
|
2
|
-
|
|
2
|
+
import { elementProps } from "../util";
|
|
3
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
4
|
+
let { highlanderMode = true, children, class: className, ...restProps } = $props();
|
|
5
|
+
/* The shorthands this component's own CSS backs, one group per mixin
|
|
6
|
+
it includes. The Props type is derived from this same array, so what
|
|
7
|
+
the component accepts and what it emits cannot drift apart. */
|
|
8
|
+
const ACCORDION_VARS = [
|
|
9
|
+
...COLOR_VARS,
|
|
10
|
+
...TYPOGRAPHY_VARS,
|
|
11
|
+
];
|
|
12
|
+
const el = $derived(elementProps(restProps, "accordion", ACCORDION_VARS));
|
|
3
13
|
let wrapper = $state();
|
|
4
14
|
function onAccordionClicked(e) {
|
|
5
15
|
if (!highlanderMode) {
|
|
@@ -34,7 +44,12 @@ function onAccordionClicked(e) {
|
|
|
34
44
|
|
|
35
45
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
36
46
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
37
|
-
<div
|
|
47
|
+
<div
|
|
48
|
+
class={["accordion-wrapper", className]}
|
|
49
|
+
onclick={onAccordionClicked}
|
|
50
|
+
bind:this={wrapper}
|
|
51
|
+
{...el}
|
|
52
|
+
>
|
|
38
53
|
{@render children?.()}
|
|
39
54
|
</div>
|
|
40
55
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
4
|
+
declare const Accordion: import("svelte").Component<ContainProps<HTMLAttributes<HTMLDivElement>, {
|
|
2
5
|
highlanderMode?: boolean;
|
|
3
6
|
children?: import("svelte").Snippet;
|
|
4
|
-
}
|
|
5
|
-
declare const Accordion: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
}, StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
6
8
|
type Accordion = ReturnType<typeof Accordion>;
|
|
7
9
|
export default Accordion;
|
package/dist/layout/Bar.svelte
CHANGED
|
@@ -3,24 +3,27 @@ let warnedDeprecatedMargin = false;
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">import { BROWSER, DEV } from "esm-env";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { elementProps } from "../util";
|
|
7
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
8
|
+
const { children, primary, secondary, marginTop, marginBottom, class: className, ...restProps } = $props();
|
|
8
9
|
$effect(() => {
|
|
9
10
|
if (BROWSER && DEV && (marginTop != null || marginBottom != null) && !warnedDeprecatedMargin) {
|
|
10
11
|
warnedDeprecatedMargin = true;
|
|
11
12
|
console.warn('[ContainCSS] Bar\'s marginTop/marginBottom props are deprecated. Use marginBlock instead -- e.g. marginBlock="0 1em" is the same as marginTop="0" marginBottom="1em" (the old default).');
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
|
-
/*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/* marginTop/marginBottom become their own CSS vars here (not composed into
|
|
16
|
+
one string in JS) so the CSS fallback chain below can pick them up
|
|
17
|
+
however they arrive -- as these props, OR as someone setting
|
|
18
|
+
--bar-margin-top/--bar-margin-bottom directly as raw CSS custom
|
|
19
|
+
properties, which JS never sees at all. Composing in JS would only ever
|
|
20
|
+
have covered the prop path. */
|
|
21
|
+
/* The shorthands this component's own CSS backs, one group per mixin
|
|
22
|
+
it includes. The Props type is derived from this same array, so what
|
|
23
|
+
the component accepts and what it emits cannot drift apart. */
|
|
24
|
+
const BAR_VARS = [...COLOR_VARS, ...TYPOGRAPHY_VARS];
|
|
21
25
|
const cssKeys = [
|
|
22
|
-
|
|
23
|
-
"fg",
|
|
26
|
+
...BAR_VARS,
|
|
24
27
|
"padding",
|
|
25
28
|
"width",
|
|
26
29
|
"height",
|
|
@@ -28,16 +31,20 @@ const cssKeys = [
|
|
|
28
31
|
"align",
|
|
29
32
|
"marginBlock",
|
|
30
33
|
"marginInline",
|
|
34
|
+
"marginTop",
|
|
35
|
+
"marginBottom",
|
|
31
36
|
];
|
|
32
|
-
const
|
|
33
|
-
const extraStyle = $derived(primary
|
|
37
|
+
const variantStyle = $derived(primary
|
|
34
38
|
? "--bar-bg: var(--primary-bg); --bar-fg: var(--primary-fg);"
|
|
35
39
|
: secondary
|
|
36
40
|
? "--bar-bg: var(--secondary-bg); --bar-fg: var(--secondary-fg);"
|
|
37
41
|
: "");
|
|
42
|
+
/* marginTop/marginBottom are deprecated props destructured above, so they
|
|
43
|
+
have to be handed back explicitly -- rest props no longer carry them. */
|
|
44
|
+
const el = $derived(elementProps({ ...restProps, marginTop, marginBottom }, "bar", cssKeys, variantStyle));
|
|
38
45
|
</script>
|
|
39
46
|
|
|
40
|
-
<div class="bar"
|
|
47
|
+
<div class={["bar", className]} {...el}>
|
|
41
48
|
{@render children?.()}
|
|
42
49
|
</div>
|
|
43
50
|
|
|
@@ -65,7 +72,12 @@ const extraStyle = $derived(primary
|
|
|
65
72
|
padding: var(--bar-padding, var(--padding, 8px));
|
|
66
73
|
border-bottom: var(--bar-border-bottom, var(--bar-border-width, var(--border-width, 1px)) var(--bar-border-style, var(--border-style, 1px)) var(--bar-border-color, var(--border-color, 1px)));
|
|
67
74
|
border-top: var(--bar-border-top, var(--bar-border-width, var(--border-width, 1px)) var(--bar-border-style, var(--border-style, 1px)) var(--bar-border-color, var(--border-color, 1px)));
|
|
68
|
-
|
|
75
|
+
/* --bar-margin-block wins outright if set (by the marginBlock prop, or by
|
|
76
|
+
anyone setting that CSS var directly). Otherwise composed from
|
|
77
|
+
--bar-margin-top/--bar-margin-bottom -- the deprecated props, or,
|
|
78
|
+
again, someone's raw CSS var -- each independently defaulting to the
|
|
79
|
+
old built-in look (flush on top, 1em clear below). */
|
|
80
|
+
margin-block: var(--bar-margin-block, var(--bar-margin-top, 0) var(--bar-margin-bottom, 1em));
|
|
69
81
|
margin-inline: var(--bar-margin-inline, 0);
|
|
70
82
|
min-height: var(--bar-min-height, var(--bar-height, 3em));
|
|
71
83
|
height: var(--bar-height, auto);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { BarStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BarStyleProps, ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Bar: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
primary?: boolean;
|
|
7
8
|
secondary?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const Bar: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
}, BarStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
10
10
|
type Bar = ReturnType<typeof Bar>;
|
|
11
11
|
export default Bar;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { MarginStyleProps } from "../types";
|
|
4
|
-
type Props = {
|
|
3
|
+
import type { ContainProps, MarginStyleProps } from "../types";
|
|
4
|
+
type Props = ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
5
|
size?: "small" | "medium" | "large";
|
|
6
6
|
customWidth?: string | null;
|
|
7
7
|
children?: Snippet;
|
|
8
|
-
}
|
|
8
|
+
}, MarginStyleProps>;
|
|
9
9
|
declare const Column: import("svelte").Component<Props, {}, "">;
|
|
10
10
|
type Column = ReturnType<typeof Column>;
|
|
11
11
|
export default Column;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { MARGIN_VARS, } from "../styleProps";
|
|
3
|
+
let { size = "medium", customWidth = null, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands column-container'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 COLUMN_CONTAINER_VARS = [
|
|
8
|
+
...MARGIN_VARS,
|
|
9
|
+
];
|
|
10
|
+
const el = $derived(elementProps(restProps, "column-container", COLUMN_CONTAINER_VARS));
|
|
7
11
|
</script>
|
|
8
12
|
|
|
9
13
|
<section
|
|
10
|
-
class="column-container"
|
|
14
|
+
class={["column-container", className]}
|
|
11
15
|
class:small={size === "small"}
|
|
12
16
|
class:medium={size === "medium"}
|
|
13
17
|
class:large={size === "large"}
|
|
14
18
|
style:--custom-width={customWidth}
|
|
15
|
-
{
|
|
16
|
-
{...restProps}
|
|
19
|
+
{...el}
|
|
17
20
|
>
|
|
18
21
|
{@render children?.()}
|
|
19
22
|
</section>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { MarginStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { ContainProps, MarginStyleProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const ColumnContainer: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
6
|
size?: "small" | "medium" | "large";
|
|
6
7
|
customWidth?: string | null;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
-
declare const ColumnContainer: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
}, MarginStyleProps & StyleProps<readonly ["marginBlock", "marginInline"]>>, {}, "">;
|
|
10
10
|
type ColumnContainer = ReturnType<typeof ColumnContainer>;
|
|
11
11
|
export default ColumnContainer;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let { children } = $props();
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
let { children, class: className, ...restProps } = $props();
|
|
3
|
+
const el = $derived(elementProps(restProps, "columns", ["gap"]));
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
|
-
<div class="columns">
|
|
6
|
+
<div class={["columns", className]} {...el}>
|
|
6
7
|
{@render children?.()}
|
|
7
8
|
</div>
|
|
8
9
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
import type { ContainProps } from "../types";
|
|
3
|
+
type Props = ContainProps<HTMLAttributes<HTMLDivElement>, {
|
|
4
|
+
children?: import("svelte").Snippet;
|
|
5
|
+
}, {
|
|
6
|
+
gap?: string | null;
|
|
7
|
+
}>;
|
|
4
8
|
declare const Columns: import("svelte").Component<Props, {}, "">;
|
|
5
9
|
type Columns = ReturnType<typeof Columns>;
|
|
6
10
|
export default Columns;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_CONTAINER_VARS, } from "../styleProps";
|
|
3
|
+
const { children, border = false, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands container'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 CONTAINER_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_CONTAINER_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "container", [
|
|
14
|
+
...CONTAINER_VARS,
|
|
6
15
|
"marginBlock",
|
|
7
16
|
"marginInline",
|
|
8
17
|
"maxWidth",
|
|
9
|
-
"padding",
|
|
10
18
|
"height",
|
|
11
19
|
"paddingTop",
|
|
12
20
|
"borderTop",
|
|
13
21
|
]));
|
|
14
22
|
</script>
|
|
15
23
|
|
|
16
|
-
<section class:border {
|
|
24
|
+
<section class={className} class:border {...el}>
|
|
17
25
|
{@render children?.()}
|
|
18
26
|
</section>
|
|
19
27
|
|
|
@@ -34,7 +42,6 @@ const style = $derived(injectVars(props, "container", [
|
|
|
34
42
|
/* Convenience groupings */
|
|
35
43
|
section {
|
|
36
44
|
box-sizing: border-box;
|
|
37
|
-
padding: var(--container-padding, var(--surface-padding, var(--padding, 8px)));
|
|
38
45
|
--link-bg: var(--container-link-bg, var(--surface-link-bg, var(--block-link-bg, inherit)));
|
|
39
46
|
--link-fg: var(--container-link-fg, var(--surface-link-fg, var(--block-link-fg, inherit)));
|
|
40
47
|
--_bg-mix-color: var(--container-bg-mix-color, var(--surface-bg-mix-color, var(--block-bg-mix-color, var(--bg-mix-color, transparent))));
|
|
@@ -131,6 +138,14 @@ section {
|
|
|
131
138
|
border-bottom: var(--container-border-bottom, var(--surface-border-bottom, var(--block-border-bottom, var(--border-bottom, var(--container-border, var(--surface-border, var(--block-border, var(--border, none))))))));
|
|
132
139
|
border-left: var(--container-border-left, var(--surface-border-left, var(--block-border-left, var(--border-left, var(--container-border, var(--surface-border, var(--block-border, var(--border, none))))))));
|
|
133
140
|
border-radius: var(--container-border-radius, var(--surface-border-radius, var(--block-border-radius, var(--border-radius, none))));
|
|
141
|
+
/* box-props (above) already sets a padding, but its shared fallback (4px)
|
|
142
|
+
is generic to every component that uses the mixin, not Container's own
|
|
143
|
+
long-standing 8px default. This declaration coming AFTER box-props is
|
|
144
|
+
what makes it win -- before this fix, Container had no override here
|
|
145
|
+
at all and was silently rendering at box-props' 4px. Same
|
|
146
|
+
var-with-fallbacks() chain as box-props' own (container/surface/block),
|
|
147
|
+
just a bigger final fallback. */
|
|
148
|
+
padding: var(--container-padding, var(--surface-padding, var(--block-padding, var(--padding, 8px))));
|
|
134
149
|
max-width: var(--container-line-width, var(--surface-line-width, var(--block-line-width, var(--line-width, unset))));
|
|
135
150
|
font-family: var(--container-body-font-family, var(--surface-body-font-family, var(--block-body-font-family, var(--body-font-family, var(--font-family)))));
|
|
136
151
|
font-family: var(--container-font-family, var(--surface-font-family, var(--block-font-family, var(--font-family, unset))));
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { type StyleProps } from "../styleProps";
|
|
1
2
|
import type { Snippet } from "svelte";
|
|
2
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
type
|
|
4
|
+
import type { ContainProps } from "../types";
|
|
5
|
+
declare const Container: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
6
|
+
border?: boolean;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}, {
|
|
4
9
|
bg?: string | null;
|
|
5
10
|
fg?: string | null;
|
|
6
11
|
marginBlock?: string | null;
|
|
@@ -8,11 +13,8 @@ type Props = {
|
|
|
8
13
|
maxWidth?: string | null;
|
|
9
14
|
padding?: string | null;
|
|
10
15
|
height?: string | null;
|
|
11
|
-
border?: boolean;
|
|
12
16
|
paddingTop?: string | null;
|
|
13
17
|
borderTop?: string | null;
|
|
14
|
-
|
|
15
|
-
} & HTMLAttributes<HTMLElement>;
|
|
16
|
-
declare const Container: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
} & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant", "lineWidth"]>>, {}, "">;
|
|
17
19
|
type Container = ReturnType<typeof Container>;
|
|
18
20
|
export default Container;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { children, stackable = false, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands data-list'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 DATA_LIST_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...PADDING_VARS,
|
|
10
|
+
...RADIUS_VARS,
|
|
11
|
+
...TYPOGRAPHY_VARS,
|
|
12
|
+
];
|
|
13
|
+
const el = $derived(elementProps(restProps, "data-list", [
|
|
14
|
+
...DATA_LIST_VARS,
|
|
7
15
|
"width",
|
|
8
16
|
"marginInline",
|
|
9
17
|
"marginLeft",
|
|
@@ -32,7 +40,7 @@ const style = $derived(injectVars(restProps, "data-list", [
|
|
|
32
40
|
]));
|
|
33
41
|
</script>
|
|
34
42
|
|
|
35
|
-
<ul class="data-list" class:stackable {
|
|
43
|
+
<ul class={["data-list", className]} class:stackable {...el}>
|
|
36
44
|
{@render children?.()}
|
|
37
45
|
</ul>
|
|
38
46
|
|
|
@@ -1,9 +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 DataList: import("svelte").Component<ContainProps<HTMLAttributes<HTMLUListElement>, {
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
stackable?: boolean;
|
|
8
|
+
}, BaseStyleProps & {
|
|
7
9
|
marginInline?: string | null;
|
|
8
10
|
marginLeft?: string | null;
|
|
9
11
|
marginRight?: string | null;
|
|
@@ -27,7 +29,6 @@ type Props = {
|
|
|
27
29
|
selectedOutline?: string | null;
|
|
28
30
|
selectedBorder?: string | null;
|
|
29
31
|
selectionColor?: string | null;
|
|
30
|
-
} &
|
|
31
|
-
declare const DataList: import("svelte").Component<Props, {}, "">;
|
|
32
|
+
} & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
32
33
|
type DataList = ReturnType<typeof DataList>;
|
|
33
34
|
export default DataList;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<script lang="ts">import Checkbox from "../controls/Checkbox.svelte";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { elementProps } from "../util";
|
|
3
|
+
import { COLOR_VARS, TYPOGRAPHY_CONTAINER_VARS, } from "../styleProps";
|
|
4
|
+
let { start, end, children, interactive = false, selectable = false, checked = $bindable(false), tabindex = undefined, onclick = null, onkeydown = null, class: className, ...restProps } = $props();
|
|
5
|
+
/* The shorthands data-list-item's own CSS backs, one group per mixin it
|
|
6
|
+
includes. The Props type is derived from this same array, so what the
|
|
7
|
+
component accepts and what it emits cannot drift apart. */
|
|
8
|
+
const DATA_LIST_ITEM_VARS = [
|
|
9
|
+
...COLOR_VARS,
|
|
10
|
+
...TYPOGRAPHY_CONTAINER_VARS,
|
|
11
|
+
];
|
|
12
|
+
const el = $derived(elementProps(restProps, "data-list-item", [
|
|
13
|
+
...DATA_LIST_ITEM_VARS,
|
|
7
14
|
"padding",
|
|
8
15
|
"width",
|
|
9
16
|
"height",
|
|
@@ -76,19 +83,18 @@ function handleKeydown(event) {
|
|
|
76
83
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
77
84
|
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
78
85
|
<li
|
|
79
|
-
class="data-list-item"
|
|
86
|
+
class={["data-list-item", className]}
|
|
80
87
|
class:hasStart
|
|
81
88
|
class:hasEnd
|
|
82
89
|
class:isInteractive
|
|
83
90
|
class:selectable
|
|
84
91
|
class:checked={selectable && checked}
|
|
85
|
-
{style}
|
|
86
92
|
tabindex={rowTabIndex}
|
|
87
93
|
role={rowRole}
|
|
88
94
|
aria-checked={selectable ? checked : undefined}
|
|
89
95
|
onclick={handleClick}
|
|
90
96
|
onkeydown={handleKeydown}
|
|
91
|
-
{...
|
|
97
|
+
{...el}
|
|
92
98
|
>
|
|
93
99
|
{#if hasStart}
|
|
94
100
|
<div class="start">
|
|
@@ -1,7 +1,8 @@
|
|
|
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 DataListItem: import("svelte").Component<ContainProps<HTMLAttributes<HTMLLIElement>, {
|
|
5
6
|
start?: Snippet;
|
|
6
7
|
end?: Snippet;
|
|
7
8
|
children?: Snippet;
|
|
@@ -34,7 +35,6 @@ type Props = {
|
|
|
34
35
|
selectedOutline?: string | null;
|
|
35
36
|
selectedBorder?: string | null;
|
|
36
37
|
selectionColor?: string | null;
|
|
37
|
-
}
|
|
38
|
-
declare const DataListItem: import("svelte").Component<Props, {}, "checked">;
|
|
38
|
+
}, BaseStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant", "lineWidth"]>>, {}, "checked">;
|
|
39
39
|
type DataListItem = ReturnType<typeof DataListItem>;
|
|
40
40
|
export default DataListItem;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, } from "../styleProps";
|
|
2
3
|
import FormProvider from "./FormProvider.svelte";
|
|
3
4
|
let { legend, children,
|
|
4
5
|
// FormProvider props
|
|
5
6
|
layout, collapseSide, fullWidth, globalInputStyles, multiline,
|
|
6
7
|
// Container-like props
|
|
7
|
-
bg, fg, padding, border, borderRadius, margin, maxWidth, minWidth, width, ...restProps } = $props();
|
|
8
|
-
|
|
8
|
+
bg, fg, padding, border, borderRadius, margin, maxWidth, minWidth, width, class: className, ...restProps } = $props();
|
|
9
|
+
/* The style props are destructured above, so they have to be handed back
|
|
10
|
+
explicitly -- rest props no longer carry them. */
|
|
11
|
+
/* The shorthands fieldset's own CSS backs, one group per mixin it
|
|
12
|
+
includes. The Props type is derived from this same array, so what the
|
|
13
|
+
component accepts and what it emits cannot drift apart. */
|
|
14
|
+
const FIELDSET_VARS = [
|
|
15
|
+
...COLOR_VARS,
|
|
16
|
+
...PADDING_VARS,
|
|
17
|
+
...RADIUS_VARS,
|
|
18
|
+
];
|
|
19
|
+
const el = $derived(elementProps({
|
|
9
20
|
bg,
|
|
10
21
|
fg,
|
|
11
22
|
padding,
|
|
@@ -17,11 +28,8 @@ const style = $derived(injectVars({
|
|
|
17
28
|
width,
|
|
18
29
|
...restProps,
|
|
19
30
|
}, "fieldset", [
|
|
20
|
-
|
|
21
|
-
"fg",
|
|
22
|
-
"padding",
|
|
31
|
+
...FIELDSET_VARS,
|
|
23
32
|
"border",
|
|
24
|
-
"borderRadius",
|
|
25
33
|
"margin",
|
|
26
34
|
"maxWidth",
|
|
27
35
|
"minWidth",
|
|
@@ -36,7 +44,7 @@ const style = $derived(injectVars({
|
|
|
36
44
|
{globalInputStyles}
|
|
37
45
|
{multiline}
|
|
38
46
|
>
|
|
39
|
-
<fieldset {
|
|
47
|
+
<fieldset class={className} {...el}>
|
|
40
48
|
{#if legend}
|
|
41
49
|
<legend>
|
|
42
50
|
{@render legend()}
|