contain-css-svelte 1.2.3 → 1.4.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 (50) hide show
  1. package/dist/Card.svelte +216 -288
  2. package/dist/controls/Button.svelte +39 -1
  3. package/dist/controls/ButtonLink.svelte +39 -1
  4. package/dist/controls/Checkbox.svelte +38 -0
  5. package/dist/controls/CircleButton.svelte +39 -1
  6. package/dist/controls/Input.svelte +39 -1
  7. package/dist/controls/RadioButton.svelte +38 -0
  8. package/dist/controls/Select.svelte +38 -0
  9. package/dist/controls/Slider.svelte +39 -1
  10. package/dist/controls/TabItem.svelte +39 -1
  11. package/dist/controls/Toggle.svelte +39 -1
  12. package/dist/dropdowns/DropdownMenu.svelte +39 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +2 -1
  15. package/dist/layout/Accordion.svelte +39 -1
  16. package/dist/layout/Bar.svelte +49 -1
  17. package/dist/layout/ColumnContainer.svelte +39 -1
  18. package/dist/layout/Columns.svelte +39 -1
  19. package/dist/layout/Container.svelte +217 -292
  20. package/dist/layout/DataList.svelte +39 -1
  21. package/dist/layout/DataListItem.svelte +217 -292
  22. package/dist/layout/Fieldset.svelte +39 -1
  23. package/dist/layout/Form.svelte +217 -292
  24. package/dist/layout/FormItem.svelte +39 -1
  25. package/dist/layout/GridLayout.svelte +38 -0
  26. package/dist/layout/Hero.svelte +217 -292
  27. package/dist/layout/Inline.svelte +45 -1
  28. package/dist/layout/MenuList.svelte +39 -1
  29. package/dist/layout/Page.svelte +44 -2
  30. package/dist/layout/RowContainer.svelte +39 -1
  31. package/dist/layout/Sidebar.svelte +757 -65
  32. package/dist/layout/Sidebar.svelte.d.ts +58 -1
  33. package/dist/layout/SidebarContainer.svelte +198 -0
  34. package/dist/layout/SidebarContainer.svelte.d.ts +20 -0
  35. package/dist/layout/SplitPane.svelte +39 -1
  36. package/dist/layout/Stack.svelte +45 -1
  37. package/dist/layout/TabBar.svelte +39 -1
  38. package/dist/layout/Table.svelte +469 -443
  39. package/dist/layout/Tile.svelte +216 -291
  40. package/dist/misc/CodeInner.svelte +39 -1
  41. package/dist/misc/Progress.svelte +217 -292
  42. package/dist/misc/Tag.svelte +39 -1
  43. package/dist/overlays/Dialog.svelte +217 -292
  44. package/dist/overlays/Tooltip.svelte +267 -349
  45. package/dist/sass/_responsive.scss +15 -0
  46. package/dist/sass/_typography.scss +203 -191
  47. package/dist/typography/TextLayout.svelte +494 -292
  48. package/dist/vars/defaults.css +258 -0
  49. package/dist/vars/typography-context.css +271 -0
  50. package/package.json +1 -1
@@ -53,7 +53,33 @@ function onAccordionClicked(e) {
53
53
  {@render children?.()}
54
54
  </div>
55
55
 
56
- <style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
56
+ <style>/* Per-level heading (h1-h6) box/typography properties, resolved to PRIVATE,
57
+ inheriting custom properties (--_h1-color, --_h2-font-size, etc) rather than
58
+ assigned directly to a matched h1-h6 selector. Nothing in this file matches
59
+ an actual heading element anymore -- see typography-context.css (vars/), which
60
+ is the single, global, :where()-scoped rule that actually reads these vars
61
+ and applies them to real elements. That split is what lets a component
62
+ nested arbitrarily deep (through <article>, <Tile>, whatever) still get the
63
+ nearest ancestor's heading styling: these are ordinary inherited custom
64
+ properties, so DOM proximity decides which component's values apply, not
65
+ selector specificity or stylesheet order. See AGENTS-INTERNAL.md. */
66
+ /* All six heading levels' context vars in one call -- what every
67
+ "typography container" component (Container, Card, Tile, TextLayout, ...)
68
+ includes on itself once, alongside the shared --_heading-* vars below. */
69
+ /* Shared prose-measure group: p, blockquote, dl, ul, ol. li/dt/dd don't get
70
+ their own vars -- they're never wider than their ul/ol/dl parent's own
71
+ max-width box, so they're already bounded for free by ordinary block
72
+ layout, not by anything selector-based reaching them individually. */
73
+ /* p specifically also gets the fuller typography-props-bare treatment
74
+ (paragraph-prefixed), which -- same as in the original selector-based
75
+ version -- is declared/consumed AFTER the shared prose vars above, so it
76
+ wins for whichever properties both groups set. */
77
+ /* The first paragraph in a typography context (p:first-of-type, or a p right
78
+ after a heading) gets its own, slightly different treatment -- larger lede
79
+ text, no top margin. Structural matching (:first-of-type, `h1 + p`) still
80
+ has to happen where the real element is, in the global consumer rule; only
81
+ the VALUES move to context vars here. */
82
+ /* Logical, not top/bottom/left/right: margin-block/margin-inline already take
57
83
  one value (both sides equal) or two (start end), so there is no separate
58
84
  "which side" prop to remember and no 4-value shorthand order to get wrong.
59
85
  Defaults to 0 on purpose -- unlike padding-props above, a margin that
@@ -61,6 +87,18 @@ function onAccordionClicked(e) {
61
87
  day this mixin got added to a new component. Callers opt in with an actual
62
88
  value. (Container does not use this mixin: it wants --gap/auto as its
63
89
  defaults, which do not fit the "0 unless asked" contract here.) */
90
+ /* The width at or below which a Sidebar swaps its grab-bar rail for the sheet
91
+ affordance -- a floating button that opens a panel over the content.
92
+
93
+ Page has to agree with Sidebar about this, because Page is what floats the
94
+ aside out of flow and reserves the strip of padding the sheet button sits
95
+ in. They used to disagree: Sidebar switched at 512px and Page at 600px,
96
+ which left a band between 513 and 600 where Page had already lifted the
97
+ aside out of the layout while the Sidebar inside it was still showing a
98
+ rail -- a grab bar floating on top of the content, which is the affordance
99
+ we deliberately avoid everywhere else.
100
+
101
+ One definition, used by both, so they cannot drift again. */
64
102
  /* Warning: because we define a fallback
65
103
  media query, the media query can override the container
66
104
  if we stack a bunch of these in a row and aren't thoughtful about the order.
@@ -48,7 +48,33 @@ const el = $derived(elementProps({ ...restProps, marginTop, marginBottom }, "bar
48
48
  {@render children?.()}
49
49
  </div>
50
50
 
51
- <style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
51
+ <style>/* Per-level heading (h1-h6) box/typography properties, resolved to PRIVATE,
52
+ inheriting custom properties (--_h1-color, --_h2-font-size, etc) rather than
53
+ assigned directly to a matched h1-h6 selector. Nothing in this file matches
54
+ an actual heading element anymore -- see typography-context.css (vars/), which
55
+ is the single, global, :where()-scoped rule that actually reads these vars
56
+ and applies them to real elements. That split is what lets a component
57
+ nested arbitrarily deep (through <article>, <Tile>, whatever) still get the
58
+ nearest ancestor's heading styling: these are ordinary inherited custom
59
+ properties, so DOM proximity decides which component's values apply, not
60
+ selector specificity or stylesheet order. See AGENTS-INTERNAL.md. */
61
+ /* All six heading levels' context vars in one call -- what every
62
+ "typography container" component (Container, Card, Tile, TextLayout, ...)
63
+ includes on itself once, alongside the shared --_heading-* vars below. */
64
+ /* Shared prose-measure group: p, blockquote, dl, ul, ol. li/dt/dd don't get
65
+ their own vars -- they're never wider than their ul/ol/dl parent's own
66
+ max-width box, so they're already bounded for free by ordinary block
67
+ layout, not by anything selector-based reaching them individually. */
68
+ /* p specifically also gets the fuller typography-props-bare treatment
69
+ (paragraph-prefixed), which -- same as in the original selector-based
70
+ version -- is declared/consumed AFTER the shared prose vars above, so it
71
+ wins for whichever properties both groups set. */
72
+ /* The first paragraph in a typography context (p:first-of-type, or a p right
73
+ after a heading) gets its own, slightly different treatment -- larger lede
74
+ text, no top margin. Structural matching (:first-of-type, `h1 + p`) still
75
+ has to happen where the real element is, in the global consumer rule; only
76
+ the VALUES move to context vars here. */
77
+ /* Logical, not top/bottom/left/right: margin-block/margin-inline already take
52
78
  one value (both sides equal) or two (start end), so there is no separate
53
79
  "which side" prop to remember and no 4-value shorthand order to get wrong.
54
80
  Defaults to 0 on purpose -- unlike padding-props above, a margin that
@@ -56,6 +82,18 @@ const el = $derived(elementProps({ ...restProps, marginTop, marginBottom }, "bar
56
82
  day this mixin got added to a new component. Callers opt in with an actual
57
83
  value. (Container does not use this mixin: it wants --gap/auto as its
58
84
  defaults, which do not fit the "0 unless asked" contract here.) */
85
+ /* The width at or below which a Sidebar swaps its grab-bar rail for the sheet
86
+ affordance -- a floating button that opens a panel over the content.
87
+
88
+ Page has to agree with Sidebar about this, because Page is what floats the
89
+ aside out of flow and reserves the strip of padding the sheet button sits
90
+ in. They used to disagree: Sidebar switched at 512px and Page at 600px,
91
+ which left a band between 513 and 600 where Page had already lifted the
92
+ aside out of the layout while the Sidebar inside it was still showing a
93
+ rail -- a grab bar floating on top of the content, which is the affordance
94
+ we deliberately avoid everywhere else.
95
+
96
+ One definition, used by both, so they cannot drift again. */
59
97
  /* Warning: because we define a fallback
60
98
  media query, the media query can override the container
61
99
  if we stack a bunch of these in a row and aren't thoughtful about the order.
@@ -181,6 +219,16 @@ const el = $derived(elementProps({ ...restProps, marginTop, marginBottom }, "bar
181
219
  overflow: var(--bar-overflow, visible);
182
220
  /* Reset form label width in horizontal context */
183
221
  --form-label-width: auto;
222
+ /* A Bar lays its content out in a flex row, so a heading dropped inside
223
+ it must not inherit an ancestor Container's (or any other typography
224
+ container's) prose-measure margins -- auto inline margins in a flex
225
+ row eat the row's free space and drag the heading toward the middle,
226
+ fighting `justify-content: space-between`. This is a plain custom
227
+ property override, not a selector reset: it wins for anything inside
228
+ `.bar` purely by being the nearest ancestor to declare it, regardless
229
+ of stylesheet order, so it doesn't need `!important` or a doubled
230
+ class the way an outside consumer's workaround for this used to. */
231
+ --_heading-margin-inline: var-with-fallbacks(--heading-margin-inline, bar, 0);
184
232
  }
185
233
 
186
234
  .bar :global(h1),
@@ -21,7 +21,33 @@ const el = $derived(elementProps(restProps, "column-container", COLUMN_CONTAINER
21
21
  {@render children?.()}
22
22
  </section>
23
23
 
24
- <style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
24
+ <style>/* Per-level heading (h1-h6) box/typography properties, resolved to PRIVATE,
25
+ inheriting custom properties (--_h1-color, --_h2-font-size, etc) rather than
26
+ assigned directly to a matched h1-h6 selector. Nothing in this file matches
27
+ an actual heading element anymore -- see typography-context.css (vars/), which
28
+ is the single, global, :where()-scoped rule that actually reads these vars
29
+ and applies them to real elements. That split is what lets a component
30
+ nested arbitrarily deep (through <article>, <Tile>, whatever) still get the
31
+ nearest ancestor's heading styling: these are ordinary inherited custom
32
+ properties, so DOM proximity decides which component's values apply, not
33
+ selector specificity or stylesheet order. See AGENTS-INTERNAL.md. */
34
+ /* All six heading levels' context vars in one call -- what every
35
+ "typography container" component (Container, Card, Tile, TextLayout, ...)
36
+ includes on itself once, alongside the shared --_heading-* vars below. */
37
+ /* Shared prose-measure group: p, blockquote, dl, ul, ol. li/dt/dd don't get
38
+ their own vars -- they're never wider than their ul/ol/dl parent's own
39
+ max-width box, so they're already bounded for free by ordinary block
40
+ layout, not by anything selector-based reaching them individually. */
41
+ /* p specifically also gets the fuller typography-props-bare treatment
42
+ (paragraph-prefixed), which -- same as in the original selector-based
43
+ version -- is declared/consumed AFTER the shared prose vars above, so it
44
+ wins for whichever properties both groups set. */
45
+ /* The first paragraph in a typography context (p:first-of-type, or a p right
46
+ after a heading) gets its own, slightly different treatment -- larger lede
47
+ text, no top margin. Structural matching (:first-of-type, `h1 + p`) still
48
+ has to happen where the real element is, in the global consumer rule; only
49
+ the VALUES move to context vars here. */
50
+ /* Logical, not top/bottom/left/right: margin-block/margin-inline already take
25
51
  one value (both sides equal) or two (start end), so there is no separate
26
52
  "which side" prop to remember and no 4-value shorthand order to get wrong.
27
53
  Defaults to 0 on purpose -- unlike padding-props above, a margin that
@@ -29,6 +55,18 @@ const el = $derived(elementProps(restProps, "column-container", COLUMN_CONTAINER
29
55
  day this mixin got added to a new component. Callers opt in with an actual
30
56
  value. (Container does not use this mixin: it wants --gap/auto as its
31
57
  defaults, which do not fit the "0 unless asked" contract here.) */
58
+ /* The width at or below which a Sidebar swaps its grab-bar rail for the sheet
59
+ affordance -- a floating button that opens a panel over the content.
60
+
61
+ Page has to agree with Sidebar about this, because Page is what floats the
62
+ aside out of flow and reserves the strip of padding the sheet button sits
63
+ in. They used to disagree: Sidebar switched at 512px and Page at 600px,
64
+ which left a band between 513 and 600 where Page had already lifted the
65
+ aside out of the layout while the Sidebar inside it was still showing a
66
+ rail -- a grab bar floating on top of the content, which is the affordance
67
+ we deliberately avoid everywhere else.
68
+
69
+ One definition, used by both, so they cannot drift again. */
32
70
  /* Warning: because we define a fallback
33
71
  media query, the media query can override the container
34
72
  if we stack a bunch of these in a row and aren't thoughtful about the order.
@@ -7,7 +7,33 @@ const el = $derived(elementProps(restProps, "columns", ["gap"]));
7
7
  {@render children?.()}
8
8
  </div>
9
9
 
10
- <style>/* Logical, not top/bottom/left/right: margin-block/margin-inline already take
10
+ <style>/* Per-level heading (h1-h6) box/typography properties, resolved to PRIVATE,
11
+ inheriting custom properties (--_h1-color, --_h2-font-size, etc) rather than
12
+ assigned directly to a matched h1-h6 selector. Nothing in this file matches
13
+ an actual heading element anymore -- see typography-context.css (vars/), which
14
+ is the single, global, :where()-scoped rule that actually reads these vars
15
+ and applies them to real elements. That split is what lets a component
16
+ nested arbitrarily deep (through <article>, <Tile>, whatever) still get the
17
+ nearest ancestor's heading styling: these are ordinary inherited custom
18
+ properties, so DOM proximity decides which component's values apply, not
19
+ selector specificity or stylesheet order. See AGENTS-INTERNAL.md. */
20
+ /* All six heading levels' context vars in one call -- what every
21
+ "typography container" component (Container, Card, Tile, TextLayout, ...)
22
+ includes on itself once, alongside the shared --_heading-* vars below. */
23
+ /* Shared prose-measure group: p, blockquote, dl, ul, ol. li/dt/dd don't get
24
+ their own vars -- they're never wider than their ul/ol/dl parent's own
25
+ max-width box, so they're already bounded for free by ordinary block
26
+ layout, not by anything selector-based reaching them individually. */
27
+ /* p specifically also gets the fuller typography-props-bare treatment
28
+ (paragraph-prefixed), which -- same as in the original selector-based
29
+ version -- is declared/consumed AFTER the shared prose vars above, so it
30
+ wins for whichever properties both groups set. */
31
+ /* The first paragraph in a typography context (p:first-of-type, or a p right
32
+ after a heading) gets its own, slightly different treatment -- larger lede
33
+ text, no top margin. Structural matching (:first-of-type, `h1 + p`) still
34
+ has to happen where the real element is, in the global consumer rule; only
35
+ the VALUES move to context vars here. */
36
+ /* Logical, not top/bottom/left/right: margin-block/margin-inline already take
11
37
  one value (both sides equal) or two (start end), so there is no separate
12
38
  "which side" prop to remember and no 4-value shorthand order to get wrong.
13
39
  Defaults to 0 on purpose -- unlike padding-props above, a margin that
@@ -15,6 +41,18 @@ const el = $derived(elementProps(restProps, "columns", ["gap"]));
15
41
  day this mixin got added to a new component. Callers opt in with an actual
16
42
  value. (Container does not use this mixin: it wants --gap/auto as its
17
43
  defaults, which do not fit the "0 unless asked" contract here.) */
44
+ /* The width at or below which a Sidebar swaps its grab-bar rail for the sheet
45
+ affordance -- a floating button that opens a panel over the content.
46
+
47
+ Page has to agree with Sidebar about this, because Page is what floats the
48
+ aside out of flow and reserves the strip of padding the sheet button sits
49
+ in. They used to disagree: Sidebar switched at 512px and Page at 600px,
50
+ which left a band between 513 and 600 where Page had already lifted the
51
+ aside out of the layout while the Sidebar inside it was still showing a
52
+ rail -- a grab bar floating on top of the content, which is the affordance
53
+ we deliberately avoid everywhere else.
54
+
55
+ One definition, used by both, so they cannot drift again. */
18
56
  /* Warning: because we define a fallback
19
57
  media query, the media query can override the container
20
58
  if we stack a bunch of these in a row and aren't thoughtful about the order.