contain-css-svelte 1.1.20 → 1.2.1
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 +15 -6
- 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 +67 -48
- 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/cssprops.js +1 -0
- 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 +13 -7
- 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 +18 -9
- 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 +41 -30
- 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 +19 -6
- 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/dist/vars/soft-corners.css +1 -1
- package/dist/vars/themes/bootstrap.css +5 -5
- package/dist/vars/themes/material.css +5 -5
- package/dist/vars/themes/retro.css +5 -5
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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;
|
package/dist/cssprops.js
CHANGED
|
@@ -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,8 +3,9 @@ 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;
|
|
@@ -17,9 +18,12 @@ $effect(() => {
|
|
|
17
18
|
--bar-margin-top/--bar-margin-bottom directly as raw CSS custom
|
|
18
19
|
properties, which JS never sees at all. Composing in JS would only ever
|
|
19
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];
|
|
20
25
|
const cssKeys = [
|
|
21
|
-
|
|
22
|
-
"fg",
|
|
26
|
+
...BAR_VARS,
|
|
23
27
|
"padding",
|
|
24
28
|
"width",
|
|
25
29
|
"height",
|
|
@@ -30,15 +34,17 @@ const cssKeys = [
|
|
|
30
34
|
"marginTop",
|
|
31
35
|
"marginBottom",
|
|
32
36
|
];
|
|
33
|
-
const
|
|
34
|
-
const extraStyle = $derived(primary
|
|
37
|
+
const variantStyle = $derived(primary
|
|
35
38
|
? "--bar-bg: var(--primary-bg); --bar-fg: var(--primary-fg);"
|
|
36
39
|
: secondary
|
|
37
40
|
? "--bar-bg: var(--secondary-bg); --bar-fg: var(--secondary-fg);"
|
|
38
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));
|
|
39
45
|
</script>
|
|
40
46
|
|
|
41
|
-
<div class="bar"
|
|
47
|
+
<div class={["bar", className]} {...el}>
|
|
42
48
|
{@render children?.()}
|
|
43
49
|
</div>
|
|
44
50
|
|
|
@@ -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;
|