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,5 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
type
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Fieldset: import("svelte").Component<ContainProps<HTMLAttributes<HTMLFieldSetElement>, {
|
|
3
6
|
legend?: Snippet;
|
|
4
7
|
children?: Snippet;
|
|
5
8
|
layout?: "side" | "above" | "below";
|
|
@@ -7,6 +10,7 @@ type $$ComponentProps = {
|
|
|
7
10
|
fullWidth?: boolean;
|
|
8
11
|
globalInputStyles?: boolean;
|
|
9
12
|
multiline?: boolean;
|
|
13
|
+
}, {
|
|
10
14
|
bg?: string;
|
|
11
15
|
fg?: string;
|
|
12
16
|
padding?: string;
|
|
@@ -16,7 +20,6 @@ type $$ComponentProps = {
|
|
|
16
20
|
maxWidth?: string;
|
|
17
21
|
minWidth?: string;
|
|
18
22
|
width?: string;
|
|
19
|
-
} &
|
|
20
|
-
declare const Fieldset: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
23
|
+
} & StyleProps<readonly ["bg", "fg", "padding", "borderRadius"]>>, {}, "">;
|
|
21
24
|
type Fieldset = ReturnType<typeof Fieldset>;
|
|
22
25
|
export default Fieldset;
|
package/dist/layout/Form.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, PADDING_VARS, RADIUS_VARS, TYPOGRAPHY_CONTAINER_VARS, } from "../styleProps";
|
|
2
3
|
import FormProvider from "./FormProvider.svelte";
|
|
3
4
|
let { children,
|
|
4
5
|
// FormProvider props
|
|
@@ -6,8 +7,19 @@ layout, collapseSide, fullWidth, globalInputStyles, multiline,
|
|
|
6
7
|
// Container-like props
|
|
7
8
|
bg, fg, padding, border, borderRadius, margin, maxWidth, minWidth, width,
|
|
8
9
|
// Form-specific props
|
|
9
|
-
action, method, onsubmit, ...restProps } = $props();
|
|
10
|
-
|
|
10
|
+
action, method, onsubmit, class: className, ...restProps } = $props();
|
|
11
|
+
/* The style props are destructured above, so they have to be handed back
|
|
12
|
+
explicitly -- rest props no longer carry them. */
|
|
13
|
+
/* The shorthands form's own CSS backs, one group per mixin it
|
|
14
|
+
includes. The Props type is derived from this same array, so what the
|
|
15
|
+
component accepts and what it emits cannot drift apart. */
|
|
16
|
+
const FORM_VARS = [
|
|
17
|
+
...COLOR_VARS,
|
|
18
|
+
...PADDING_VARS,
|
|
19
|
+
...RADIUS_VARS,
|
|
20
|
+
...TYPOGRAPHY_CONTAINER_VARS,
|
|
21
|
+
];
|
|
22
|
+
const el = $derived(elementProps({
|
|
11
23
|
bg,
|
|
12
24
|
fg,
|
|
13
25
|
padding,
|
|
@@ -19,11 +31,8 @@ const style = $derived(injectVars({
|
|
|
19
31
|
width,
|
|
20
32
|
...restProps,
|
|
21
33
|
}, "form", [
|
|
22
|
-
|
|
23
|
-
"fg",
|
|
24
|
-
"padding",
|
|
34
|
+
...FORM_VARS,
|
|
25
35
|
"border",
|
|
26
|
-
"borderRadius",
|
|
27
36
|
"margin",
|
|
28
37
|
"maxWidth",
|
|
29
38
|
"minWidth",
|
|
@@ -38,7 +47,7 @@ const style = $derived(injectVars({
|
|
|
38
47
|
{globalInputStyles}
|
|
39
48
|
{multiline}
|
|
40
49
|
>
|
|
41
|
-
<form {
|
|
50
|
+
<form class={className} {action} {method} {onsubmit} {...el}>
|
|
42
51
|
{@render children?.()}
|
|
43
52
|
</form>
|
|
44
53
|
</FormProvider>
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
type
|
|
3
|
+
import type { ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Form: import("svelte").Component<ContainProps<HTMLAttributes<HTMLFormElement>, {
|
|
4
6
|
children?: Snippet;
|
|
5
7
|
layout?: "side" | "above" | "below";
|
|
6
8
|
collapseSide?: boolean;
|
|
7
9
|
fullWidth?: boolean;
|
|
8
10
|
globalInputStyles?: boolean;
|
|
9
11
|
multiline?: boolean;
|
|
12
|
+
action?: string;
|
|
13
|
+
method?: "get" | "post" | "dialog";
|
|
14
|
+
onsubmit?: (event: SubmitEvent) => void;
|
|
15
|
+
}, {
|
|
10
16
|
bg?: string;
|
|
11
17
|
fg?: string;
|
|
12
18
|
padding?: string;
|
|
@@ -16,10 +22,6 @@ type $$ComponentProps = {
|
|
|
16
22
|
maxWidth?: string;
|
|
17
23
|
minWidth?: string;
|
|
18
24
|
width?: string;
|
|
19
|
-
|
|
20
|
-
method?: "get" | "post" | "dialog";
|
|
21
|
-
onsubmit?: (event: SubmitEvent) => void;
|
|
22
|
-
} & HTMLAttributes<HTMLFormElement>;
|
|
23
|
-
declare const Form: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
25
|
+
} & StyleProps<readonly ["bg", "fg", "padding", "borderRadius", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant", "lineWidth"]>>, {}, "">;
|
|
24
26
|
type Form = ReturnType<typeof Form>;
|
|
25
27
|
export default Form;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { TYPOGRAPHY_VARS, } from "../styleProps";
|
|
2
3
|
import { getContext } from "svelte";
|
|
3
4
|
const contextDefaults = getContext("formItemDefaults");
|
|
4
|
-
let { fullWidth, globalInputStyles, label, after, children, multiline, layout, collapseSide, above = false, below = false, ...restProps } = $props();
|
|
5
|
+
let { fullWidth, globalInputStyles, label, after, children, multiline, layout, collapseSide, above = false, below = false, 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 FORM_ITEM_VARS = [
|
|
10
|
+
...TYPOGRAPHY_VARS,
|
|
11
|
+
];
|
|
12
|
+
const el = $derived(elementProps(restProps, "form-item", FORM_ITEM_VARS));
|
|
5
13
|
// Use $derived to reactively compute values from context
|
|
6
14
|
const effectiveFullWidth = $derived(fullWidth ?? contextDefaults?.fullWidth ?? false);
|
|
7
15
|
const effectiveGlobalInputStyles = $derived(globalInputStyles ?? contextDefaults?.globalInputStyles ?? true);
|
|
8
16
|
const effectiveMultiline = $derived(multiline ?? contextDefaults?.multiline ?? false);
|
|
9
17
|
const effectiveCollapseSide = $derived(collapseSide ?? contextDefaults?.collapseSide ?? true);
|
|
10
18
|
const effectiveLayoutFromContext = $derived(layout ?? contextDefaults?.layout ?? "side");
|
|
11
|
-
const cssKeys = ["fullWidth", "globalInputStyles", "multiline"];
|
|
12
|
-
const style = $derived(injectVars(restProps, "form-item", cssKeys));
|
|
13
19
|
const effectiveLayout = $derived(above ? "above" : below ? "below" : effectiveLayoutFromContext);
|
|
14
20
|
</script>
|
|
15
21
|
|
|
16
22
|
<div
|
|
17
|
-
{
|
|
18
|
-
class="form-item"
|
|
23
|
+
class={["form-item", className]}
|
|
19
24
|
class:fullWidth={effectiveFullWidth}
|
|
20
25
|
class:globalInputStyles={effectiveGlobalInputStyles}
|
|
21
26
|
class:multiline={effectiveMultiline}
|
|
@@ -23,7 +28,7 @@ const effectiveLayout = $derived(above ? "above" : below ? "below" : effectiveLa
|
|
|
23
28
|
class:layout-side={effectiveLayout === "side"}
|
|
24
29
|
class:layout-above={effectiveLayout === "above"}
|
|
25
30
|
class:layout-below={effectiveLayout === "below"}
|
|
26
|
-
{...
|
|
31
|
+
{...el}
|
|
27
32
|
>
|
|
28
33
|
<label>
|
|
29
34
|
<span class="label">
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
type
|
|
3
|
+
import type { ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const FormItem: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
4
6
|
fullWidth?: boolean;
|
|
5
7
|
globalInputStyles?: boolean;
|
|
6
8
|
label?: Snippet;
|
|
@@ -11,7 +13,6 @@ type $$ComponentProps = {
|
|
|
11
13
|
collapseSide?: boolean;
|
|
12
14
|
above?: boolean;
|
|
13
15
|
below?: boolean;
|
|
14
|
-
}
|
|
15
|
-
declare const FormItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
|
+
}, StyleProps<readonly ["fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
16
17
|
type FormItem = ReturnType<typeof FormItem>;
|
|
17
18
|
export default FormItem;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import { setContext, getContext } from "svelte";
|
|
2
|
+
/* No attribute pass-through, deliberately: FormProvider renders no element
|
|
3
|
+
of its own -- it only sets context around {@render children}. There is
|
|
4
|
+
nothing for `class`, `style` or `data-*` to land on. */
|
|
2
5
|
let { layout, collapseSide, fullWidth, globalInputStyles, multiline, children, } = $props();
|
|
3
6
|
// Get parent context if it exists
|
|
4
7
|
const parentContext = getContext("formItemDefaults");
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { MARGIN_VARS, PADDING_VARS, RADIUS_VARS, } from "../styleProps";
|
|
3
|
+
let { children, card = false, tile = false, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands grid-layout'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 GRID_LAYOUT_VARS = [
|
|
8
|
+
...PADDING_VARS,
|
|
9
|
+
...RADIUS_VARS,
|
|
10
|
+
...MARGIN_VARS,
|
|
11
|
+
];
|
|
12
|
+
const el = $derived(elementProps(restProps, "grid-layout", GRID_LAYOUT_VARS));
|
|
7
13
|
</script>
|
|
8
14
|
|
|
9
15
|
<div
|
|
10
|
-
class="grid-layout"
|
|
16
|
+
class={["grid-layout", className]}
|
|
11
17
|
class:card-grid={card}
|
|
12
18
|
class:tile-grid={tile}
|
|
13
|
-
{
|
|
14
|
-
{...restProps}
|
|
19
|
+
{...el}
|
|
15
20
|
>
|
|
16
21
|
{@render children?.()}
|
|
17
22
|
</div>
|
|
@@ -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 GridLayout: import("svelte").Component<ContainProps<HTMLAttributes<HTMLDivElement>, {
|
|
5
6
|
card?: boolean;
|
|
6
7
|
tile?: boolean;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
-
declare const GridLayout: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
}, MarginStyleProps & StyleProps<readonly ["padding", "borderRadius", "marginBlock", "marginInline"]>>, {}, "">;
|
|
10
10
|
type GridLayout = ReturnType<typeof GridLayout>;
|
|
11
11
|
export default GridLayout;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
let { justify = null, center = false, children, ...restProps } = $props();
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
let { justify = null, center = false, children, class: className, ...restProps } = $props();
|
|
3
3
|
const resolvedJustify = $derived(justify ?? (center ? "center" : null));
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return rest;
|
|
8
|
-
});
|
|
9
|
-
const style = $derived(injectVars({ justify: resolvedJustify, ...elementProps }, "grid-row", ["justify"]) +
|
|
10
|
-
(inlineStyle ?? ""));
|
|
4
|
+
const el = $derived(elementProps({ justify: resolvedJustify, ...restProps }, "grid-row", [
|
|
5
|
+
"justify",
|
|
6
|
+
]));
|
|
11
7
|
</script>
|
|
12
8
|
|
|
13
|
-
<div class="grid-full-row grid-row"
|
|
9
|
+
<div class={["grid-full-row", "grid-row", className]} {...el}>
|
|
14
10
|
{@render children?.()}
|
|
15
11
|
</div>
|
|
16
12
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { ContainProps } from "../types";
|
|
3
4
|
/**
|
|
4
5
|
* A full-width band inside a GridLayout: a section heading, an explanation, a
|
|
5
6
|
* note saying why the grid is empty. Anything that belongs *in* the run of
|
|
@@ -12,13 +13,13 @@ import type { HTMLAttributes } from "svelte/elements";
|
|
|
12
13
|
* that typographic containers impose is lifted for its contents too. Put the
|
|
13
14
|
* class on your own heading instead and the heading keeps that measure.
|
|
14
15
|
*/
|
|
15
|
-
type Props = {
|
|
16
|
+
type Props = ContainProps<HTMLAttributes<HTMLDivElement>, {
|
|
16
17
|
/** How the row sits in the span it covers: start, center, end, stretch. */
|
|
17
18
|
justify?: string | null;
|
|
18
19
|
/** Shorthand for `justify="center"`, as `Stack` takes `center`. */
|
|
19
20
|
center?: boolean;
|
|
20
21
|
children?: Snippet;
|
|
21
|
-
}
|
|
22
|
+
}>;
|
|
22
23
|
declare const GridRow: import("svelte").Component<Props, {}, "">;
|
|
23
24
|
type GridRow = ReturnType<typeof GridRow>;
|
|
24
25
|
export default GridRow;
|
package/dist/layout/Hero.svelte
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_CONTAINER_VARS, } from "../styleProps";
|
|
3
|
+
const { children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands hero'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 HERO_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_CONTAINER_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(elementProps(restProps, "hero", [
|
|
12
|
+
...HERO_VARS,
|
|
6
13
|
"padding",
|
|
7
14
|
"width",
|
|
8
15
|
"height",
|
|
@@ -12,10 +19,9 @@ const style = $derived(injectVars(restProps, "hero", [
|
|
|
12
19
|
</script>
|
|
13
20
|
|
|
14
21
|
<div
|
|
15
|
-
class="hero"
|
|
16
|
-
{style}
|
|
22
|
+
class={["hero", className]}
|
|
17
23
|
style:--text-align="var(--hero-text-align,center)"
|
|
18
|
-
{...
|
|
24
|
+
{...el}
|
|
19
25
|
>
|
|
20
26
|
{@render children?.()}
|
|
21
27
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type
|
|
4
|
-
type
|
|
3
|
+
import { type StyleProps } from "../styleProps";
|
|
4
|
+
import type { ContainProps, HeroStyleProps } from "../types";
|
|
5
|
+
declare const Hero: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
6
|
children?: Snippet;
|
|
6
|
-
}
|
|
7
|
-
declare const Hero: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
}, HeroStyleProps & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant", "lineWidth"]>>, {}, "">;
|
|
8
8
|
type Hero = ReturnType<typeof Hero>;
|
|
9
9
|
export default Hero;
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { MARGIN_VARS, PADDING_VARS, RADIUS_VARS, } from "../styleProps";
|
|
3
|
+
let { fill = false, stretch = false, split = false, justify = null, align = null, gap = null, wrap = null, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands inline'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 INLINE_VARS = [
|
|
8
|
+
...PADDING_VARS,
|
|
9
|
+
...RADIUS_VARS,
|
|
10
|
+
...MARGIN_VARS,
|
|
11
|
+
];
|
|
12
|
+
const el = $derived(elementProps({ justify, align, gap, wrap, ...restProps }, "inline", [
|
|
13
|
+
...INLINE_VARS,
|
|
9
14
|
"bg",
|
|
10
15
|
"fg",
|
|
11
|
-
"padding",
|
|
12
16
|
"width",
|
|
13
17
|
"height",
|
|
14
18
|
"gap",
|
|
15
19
|
"justify",
|
|
16
20
|
"align",
|
|
17
21
|
"wrap",
|
|
18
|
-
|
|
19
|
-
"marginInline",
|
|
20
|
-
]) + (inlineStyle ?? ""));
|
|
22
|
+
]));
|
|
21
23
|
</script>
|
|
22
24
|
|
|
23
25
|
<div
|
|
24
|
-
class="inline"
|
|
26
|
+
class={["inline", className]}
|
|
25
27
|
class:fill
|
|
26
28
|
class:stretch
|
|
27
29
|
class:split
|
|
28
|
-
{
|
|
29
|
-
{...elementProps}
|
|
30
|
+
{...el}
|
|
30
31
|
>
|
|
31
32
|
{@render children?.()}
|
|
32
33
|
</div>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { BaseStyleProps, MarginStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { BaseStyleProps, ContainProps, MarginStyleProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Inline: import("svelte").Component<ContainProps<HTMLAttributes<HTMLDivElement>, {
|
|
5
6
|
fill?: boolean;
|
|
6
7
|
stretch?: boolean;
|
|
7
8
|
split?: boolean;
|
|
@@ -10,7 +11,6 @@ type Props = {
|
|
|
10
11
|
gap?: string | null;
|
|
11
12
|
wrap?: string | null;
|
|
12
13
|
children?: Snippet;
|
|
13
|
-
}
|
|
14
|
-
declare const Inline: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
}, BaseStyleProps & MarginStyleProps & StyleProps<readonly ["padding", "borderRadius", "marginBlock", "marginInline"]>>, {}, "">;
|
|
15
15
|
type Inline = ReturnType<typeof Inline>;
|
|
16
16
|
export default Inline;
|
|
@@ -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 } from "../styleProps";
|
|
3
|
+
let { children, striped = false, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands menu'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
|
+
/* COLOR only. `.menu`'s padding-props include is commented out and the
|
|
8
|
+
rule hardcodes `padding: 0`, so a --menu-padding would go nowhere -- the
|
|
9
|
+
shorthand is offered where the mixin is live, not where it is written. */
|
|
10
|
+
const MENU_LIST_VARS = [...COLOR_VARS];
|
|
11
|
+
const el = $derived(elementProps(restProps, "menu", [
|
|
12
|
+
...MENU_LIST_VARS,
|
|
6
13
|
"itemPadding",
|
|
7
14
|
"itemWidth",
|
|
8
15
|
"itemHeight",
|
|
@@ -15,7 +22,7 @@ const style = $derived(injectVars(restProps, "menu", [
|
|
|
15
22
|
]));
|
|
16
23
|
</script>
|
|
17
24
|
|
|
18
|
-
<ul
|
|
25
|
+
<ul class={["menu", className]} class:striped {...el}>
|
|
19
26
|
{@render children?.()}
|
|
20
27
|
</ul>
|
|
21
28
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
-
import type { MenuStyleProps } from "../types";
|
|
4
|
-
type
|
|
3
|
+
import type { ContainProps, MenuStyleProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const MenuList: import("svelte").Component<ContainProps<HTMLAttributes<HTMLUListElement>, {
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
striped?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare const MenuList: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
}, MenuStyleProps & StyleProps<readonly ["bg", "fg"]>>, {}, "">;
|
|
9
9
|
type MenuList = ReturnType<typeof MenuList>;
|
|
10
10
|
export default MenuList;
|
package/dist/layout/Page.svelte
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
2
3
|
import { onDestroy, onMount } from "svelte";
|
|
3
|
-
const { right = false, sticky = false, hideSidebar = false, hideHeader = false, hideFooter = false, onStickyChange = () => { }, header, footer, sidebar, children, ...restProps } = $props();
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const { right = false, sticky = false, hideSidebar = false, hideHeader = false, hideFooter = false, onStickyChange = () => { }, header, footer, sidebar, children, class: className, ...restProps } = $props();
|
|
5
|
+
/* The shorthands page'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 PAGE_VARS = [
|
|
9
|
+
...COLOR_VARS,
|
|
10
|
+
...TYPOGRAPHY_VARS,
|
|
11
|
+
];
|
|
12
|
+
const el = $derived(elementProps(restProps, "page", [
|
|
13
|
+
...PAGE_VARS,
|
|
7
14
|
"contentPadding",
|
|
8
15
|
"width",
|
|
9
16
|
"height",
|
|
@@ -56,7 +63,7 @@ onMount(() => {
|
|
|
56
63
|
</script>
|
|
57
64
|
|
|
58
65
|
<section
|
|
59
|
-
class="page"
|
|
66
|
+
class={["page", className]}
|
|
60
67
|
class:freeze
|
|
61
68
|
class:right
|
|
62
69
|
class:sticky
|
|
@@ -64,8 +71,7 @@ onMount(() => {
|
|
|
64
71
|
class:hasSidebar
|
|
65
72
|
class:hasFooter
|
|
66
73
|
bind:this={pageElement}
|
|
67
|
-
{
|
|
68
|
-
{...restProps}
|
|
74
|
+
{...el}
|
|
69
75
|
>
|
|
70
76
|
<header>
|
|
71
77
|
{#if hasHeader}{@render header?.()}{/if}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
|
-
type
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { ContainProps } from "../types";
|
|
4
|
+
import { type StyleProps } from "../styleProps";
|
|
5
|
+
declare const Page: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
3
6
|
right?: boolean;
|
|
4
7
|
sticky?: boolean;
|
|
5
8
|
hideSidebar?: boolean;
|
|
@@ -10,7 +13,12 @@ type $$ComponentProps = {
|
|
|
10
13
|
footer?: Snippet;
|
|
11
14
|
sidebar?: Snippet;
|
|
12
15
|
children?: Snippet;
|
|
13
|
-
}
|
|
14
|
-
|
|
16
|
+
}, {
|
|
17
|
+
bg?: string | null;
|
|
18
|
+
fg?: string | null;
|
|
19
|
+
contentPadding?: string | null;
|
|
20
|
+
width?: string | null;
|
|
21
|
+
height?: string | null;
|
|
22
|
+
} & StyleProps<readonly ["bg", "fg", "fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "fontVariant"]>>, {}, "">;
|
|
15
23
|
type Page = ReturnType<typeof Page>;
|
|
16
24
|
export default Page;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
<script lang="ts">const breakpoints = ["xs", "small", "medium", "large", "xl"];
|
|
2
|
+
/* No attribute pass-through, deliberately: this renders one sibling span
|
|
3
|
+
per breakpoint rather than a single root, so there is no one element an
|
|
4
|
+
`id` or `data-testid` could go on without being wrong at every other
|
|
5
|
+
breakpoint. Wrap it if you need a handle. */
|
|
2
6
|
const { greaterThan = null, smallerThan = null, xs, small, medium, large, xl, else: elseSnippet, greaterThanContent: greaterThanSnippet, smallerThanContent: smallerThanSnippet, } = $props();
|
|
3
7
|
function computeSmallerThan(value) {
|
|
4
8
|
if (!value)
|
|
@@ -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
|
customHeight?: string | null;
|
|
7
7
|
children?: Snippet;
|
|
8
|
-
}
|
|
8
|
+
}, MarginStyleProps>;
|
|
9
9
|
declare const Row: import("svelte").Component<Props, {}, "">;
|
|
10
10
|
type Row = ReturnType<typeof Row>;
|
|
11
11
|
export default Row;
|
|
@@ -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", customHeight = null, children, class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands row-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 ROW_CONTAINER_VARS = [
|
|
8
|
+
...MARGIN_VARS,
|
|
9
|
+
];
|
|
10
|
+
const el = $derived(elementProps(restProps, "row-container", ROW_CONTAINER_VARS));
|
|
7
11
|
</script>
|
|
8
12
|
|
|
9
13
|
<section
|
|
10
|
-
class="row-container"
|
|
14
|
+
class={["row-container", className]}
|
|
11
15
|
class:small={size === "small"}
|
|
12
16
|
class:medium={size === "medium"}
|
|
13
17
|
class:large={size === "large"}
|
|
14
18
|
style:--custom-height={customHeight}
|
|
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 RowContainer: import("svelte").Component<ContainProps<HTMLAttributes<HTMLElement>, {
|
|
5
6
|
size?: "small" | "medium" | "large";
|
|
6
7
|
customHeight?: string | null;
|
|
7
8
|
children?: Snippet;
|
|
8
|
-
}
|
|
9
|
-
declare const RowContainer: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
}, MarginStyleProps & StyleProps<readonly ["marginBlock", "marginInline"]>>, {}, "">;
|
|
10
10
|
type RowContainer = ReturnType<typeof RowContainer>;
|
|
11
11
|
export default RowContainer;
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">import { elementProps } from "../util";
|
|
2
|
+
import { COLOR_VARS, TYPOGRAPHY_VARS, } from "../styleProps";
|
|
3
|
+
let { left, right, children, expandLabel = "Expand sidebar", collapseLabel = "Collapse sidebar", class: className, ...restProps } = $props();
|
|
4
|
+
/* The shorthands sidebar'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 SIDEBAR_VARS = [
|
|
8
|
+
...COLOR_VARS,
|
|
9
|
+
...TYPOGRAPHY_VARS,
|
|
10
|
+
];
|
|
11
|
+
const el = $derived(elementProps(restProps, "sidebar", [
|
|
12
|
+
...SIDEBAR_VARS,
|
|
13
|
+
"width",
|
|
14
|
+
]));
|
|
4
15
|
let expandedHamburger = $state(false);
|
|
5
16
|
let expandedBar = $state(true);
|
|
6
17
|
</script>
|
|
7
18
|
|
|
8
19
|
<aside
|
|
9
|
-
class="sidebar"
|
|
20
|
+
class={["sidebar", className]}
|
|
10
21
|
class:right
|
|
11
22
|
class:left
|
|
12
23
|
class:expandedHamburger
|
|
13
24
|
class:expandedBar
|
|
14
|
-
{
|
|
25
|
+
{...el}
|
|
15
26
|
>
|
|
16
27
|
<button
|
|
17
28
|
class:expander={!expandedHamburger}
|
|
18
29
|
class:close={expandedHamburger}
|
|
19
|
-
aria-label={expandedHamburger ?
|
|
30
|
+
aria-label={expandedHamburger ? collapseLabel : expandLabel}
|
|
20
31
|
data-audit-action="toggle-sidebar-sheet"
|
|
21
32
|
onclick={() => (expandedHamburger = !expandedHamburger)}
|
|
22
33
|
></button>
|