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.
Files changed (94) hide show
  1. package/dist/Card.svelte +22 -8
  2. package/dist/Card.svelte.d.ts +4 -5
  3. package/dist/controls/Button.svelte +19 -5
  4. package/dist/controls/Button.svelte.d.ts +4 -4
  5. package/dist/controls/ButtonLink.svelte +17 -14
  6. package/dist/controls/ButtonLink.svelte.d.ts +4 -4
  7. package/dist/controls/Checkbox.svelte +15 -8
  8. package/dist/controls/Checkbox.svelte.d.ts +4 -4
  9. package/dist/controls/CircleButton.svelte +14 -7
  10. package/dist/controls/CircleButton.svelte.d.ts +4 -4
  11. package/dist/controls/Input.svelte +14 -3
  12. package/dist/controls/Input.svelte.d.ts +4 -3
  13. package/dist/controls/Option.svelte +4 -3
  14. package/dist/controls/Option.svelte.d.ts +3 -2
  15. package/dist/controls/RadioButton.svelte +14 -7
  16. package/dist/controls/RadioButton.svelte.d.ts +4 -4
  17. package/dist/controls/Select.svelte +15 -3
  18. package/dist/controls/Select.svelte.d.ts +4 -3
  19. package/dist/controls/Slider.svelte +5 -11
  20. package/dist/controls/Slider.svelte.d.ts +3 -3
  21. package/dist/controls/TabItem.svelte +24 -5
  22. package/dist/controls/TabItem.svelte.d.ts +4 -4
  23. package/dist/controls/Toggle.svelte +21 -5
  24. package/dist/controls/Toggle.svelte.d.ts +4 -4
  25. package/dist/dropdowns/DropdownMenu.svelte +18 -6
  26. package/dist/dropdowns/DropdownMenu.svelte.d.ts +4 -4
  27. package/dist/layout/Accordion.svelte +17 -2
  28. package/dist/layout/Accordion.svelte.d.ts +5 -3
  29. package/dist/layout/Bar.svelte +27 -15
  30. package/dist/layout/Bar.svelte.d.ts +4 -4
  31. package/dist/layout/Column.svelte.d.ts +3 -3
  32. package/dist/layout/ColumnContainer.svelte +12 -9
  33. package/dist/layout/ColumnContainer.svelte.d.ts +4 -4
  34. package/dist/layout/Columns.svelte +4 -3
  35. package/dist/layout/Columns.svelte.d.ts +7 -3
  36. package/dist/layout/Container.svelte +23 -8
  37. package/dist/layout/Container.svelte.d.ts +7 -5
  38. package/dist/layout/DataList.svelte +15 -7
  39. package/dist/layout/DataList.svelte.d.ts +5 -4
  40. package/dist/layout/DataListItem.svelte +14 -8
  41. package/dist/layout/DataListItem.svelte.d.ts +4 -4
  42. package/dist/layout/Fieldset.svelte +16 -8
  43. package/dist/layout/Fieldset.svelte.d.ts +6 -3
  44. package/dist/layout/Form.svelte +17 -8
  45. package/dist/layout/Form.svelte.d.ts +8 -6
  46. package/dist/layout/FormItem.svelte +12 -7
  47. package/dist/layout/FormItem.svelte.d.ts +4 -3
  48. package/dist/layout/FormProvider.svelte +3 -0
  49. package/dist/layout/GridLayout.svelte +14 -9
  50. package/dist/layout/GridLayout.svelte.d.ts +4 -4
  51. package/dist/layout/GridRow.svelte +6 -10
  52. package/dist/layout/GridRow.svelte.d.ts +3 -2
  53. package/dist/layout/Hero.svelte +14 -8
  54. package/dist/layout/Hero.svelte.d.ts +4 -4
  55. package/dist/layout/Inline.svelte +16 -15
  56. package/dist/layout/Inline.svelte.d.ts +4 -4
  57. package/dist/layout/MenuList.svelte +13 -6
  58. package/dist/layout/MenuList.svelte.d.ts +4 -4
  59. package/dist/layout/Page.svelte +14 -8
  60. package/dist/layout/Page.svelte.d.ts +11 -3
  61. package/dist/layout/ResponsiveText.svelte +4 -0
  62. package/dist/layout/Row.svelte.d.ts +3 -3
  63. package/dist/layout/RowContainer.svelte +12 -9
  64. package/dist/layout/RowContainer.svelte.d.ts +4 -4
  65. package/dist/layout/Sidebar.svelte +17 -6
  66. package/dist/layout/Sidebar.svelte.d.ts +12 -4
  67. package/dist/layout/SplitPane.svelte +8 -14
  68. package/dist/layout/SplitPane.svelte.d.ts +16 -2
  69. package/dist/layout/Stack.svelte +16 -15
  70. package/dist/layout/Stack.svelte.d.ts +4 -4
  71. package/dist/layout/TabBar.svelte +12 -2
  72. package/dist/layout/TabBar.svelte.d.ts +17 -10
  73. package/dist/layout/Table.svelte +5 -1
  74. package/dist/layout/Tile.svelte +40 -27
  75. package/dist/layout/Tile.svelte.d.ts +32 -10
  76. package/dist/misc/Code.svelte +2 -0
  77. package/dist/misc/Progress.svelte +25 -8
  78. package/dist/misc/Progress.svelte.d.ts +15 -8
  79. package/dist/misc/Tag.svelte +97 -44
  80. package/dist/misc/Tag.svelte.d.ts +17 -5
  81. package/dist/overlays/Dialog.svelte +18 -5
  82. package/dist/overlays/Dialog.svelte.d.ts +5 -3
  83. package/dist/overlays/Tooltip.svelte +21 -3
  84. package/dist/overlays/Tooltip.svelte.d.ts +5 -3
  85. package/dist/styleProps.d.ts +67 -0
  86. package/dist/styleProps.js +76 -0
  87. package/dist/types.d.ts +40 -1
  88. package/dist/types.js +1 -1
  89. package/dist/typography/Text.svelte +4 -11
  90. package/dist/typography/TextLayout.svelte +4 -7
  91. package/dist/typography/TextLayout.svelte.d.ts +4 -3
  92. package/dist/util.d.ts +60 -3
  93. package/dist/util.js +101 -11
  94. package/package.json +1 -1
@@ -1,12 +1,28 @@
1
- <script lang="ts">import { injectVars } from "../util";
2
- let { checked = $bindable(false), name = "", onLabel, offLabel, children, ...restProps } = $props();
3
- const style = $derived(injectVars(restProps, "toggle", ["bg", "fg", "padding", "width", "height"]));
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
- {...restProps}
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 Props = {
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
- } & BaseStyleProps & Omit<HTMLInputAttributes, "type">;
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 { injectVars } from "../util";
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
- const style = $derived(injectVars(props, "menu", [
17
- "bg",
18
- "fg",
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 class="dropdown-menu" class:open={isOpen} onkeydown={handleKeystroke}>
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
- type Props = {
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
- } & DropdownMenuStyleProps & HTMLAttributes<HTMLDivElement>;
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
- let { highlanderMode = true, children } = $props();
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 class="accordion-wrapper" onclick={onAccordionClicked} bind:this={wrapper}>
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
- interface Props {
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;
@@ -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 { injectVars } from "../util";
7
- const { children, primary, secondary, marginTop, marginBottom, marginBlock, ...restProps } = $props();
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
- /* marginBlock wins if given explicitly; otherwise compose the deprecated
15
- pair into the same shape, preserving each side's old default (no space
16
- above, 1em below) for whichever half was not passed. */
17
- const resolvedMarginBlock = $derived(marginBlock ??
18
- (marginTop != null || marginBottom != null
19
- ? `${marginTop ?? "0"} ${marginBottom ?? "1em"}`
20
- : null));
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
- "bg",
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 style = $derived(injectVars({ ...restProps, marginBlock: resolvedMarginBlock }, "bar", cssKeys));
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" style="{style}{extraStyle}">
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
- margin-block: var(--bar-margin-block, 0 1em);
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 Props = {
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
- } & BarStyleProps & HTMLAttributes<HTMLElement>;
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
- } & MarginStyleProps & HTMLAttributes<HTMLElement>;
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 { injectVars } from "../util";
2
- let { size = "medium", customWidth = null, children, marginBlock = null, marginInline = null, style: inlineStyle, ...restProps } = $props();
3
- const style = $derived(injectVars({ marginBlock, marginInline }, "column-container", [
4
- "marginBlock",
5
- "marginInline",
6
- ]) + (inlineStyle ?? ""));
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
- {style}
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 Props = {
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
- } & MarginStyleProps & HTMLAttributes<HTMLElement>;
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">"use strict";
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
- interface Props {
2
- children?: import('svelte').Snippet;
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 { injectVars } from "../util";
2
- const { children, border = false, ...props } = $props();
3
- const style = $derived(injectVars(props, "container", [
4
- "bg",
5
- "fg",
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 {style}>
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 Props = {
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
- children?: Snippet;
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 { injectVars } from "../util";
2
- let { children, stackable = false, ...restProps } = $props();
3
- const style = $derived(injectVars(restProps, "data-list", [
4
- "bg",
5
- "fg",
6
- "padding",
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 {style} {...restProps}>
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 Props = {
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
- } & BaseStyleProps & HTMLAttributes<HTMLUListElement>;
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 { injectVars } from "../util";
3
- let { start, end, children, interactive = false, selectable = false, checked = $bindable(false), tabindex = undefined, onclick = null, onkeydown = null, ...restProps } = $props();
4
- const style = $derived(injectVars(restProps, "data-list-item", [
5
- "bg",
6
- "fg",
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
- {...restProps}
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 Props = {
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
- } & BaseStyleProps & HTMLAttributes<HTMLLIElement>;
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 { injectVars } from "../util";
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
- const style = $derived(injectVars({
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
- "bg",
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 {style} {...restProps}>
47
+ <fieldset class={className} {...el}>
40
48
  {#if legend}
41
49
  <legend>
42
50
  {@render legend()}