contain-css-svelte 1.4.3 → 1.6.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 (57) hide show
  1. package/dist/Card.svelte +57 -3
  2. package/dist/controls/Button.svelte +32 -0
  3. package/dist/controls/ButtonLink.svelte +32 -0
  4. package/dist/controls/Checkbox.svelte +36 -0
  5. package/dist/controls/CircleButton.svelte +32 -0
  6. package/dist/controls/GroupedRadioItem.svelte +551 -0
  7. package/dist/controls/GroupedRadioItem.svelte.d.ts +36 -0
  8. package/dist/controls/GroupedToggle.svelte +147 -0
  9. package/dist/controls/GroupedToggle.svelte.d.ts +9 -0
  10. package/dist/controls/GroupedToggleItem.svelte +452 -0
  11. package/dist/controls/GroupedToggleItem.svelte.d.ts +31 -0
  12. package/dist/controls/Input.svelte +32 -0
  13. package/dist/controls/RadioButton.svelte +36 -1
  14. package/dist/controls/Select.svelte +80 -2
  15. package/dist/controls/Slider.svelte +32 -0
  16. package/dist/controls/TabItem.svelte +36 -0
  17. package/dist/controls/Toggle.svelte +32 -0
  18. package/dist/dropdowns/DropdownMenu.svelte +53 -1
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.js +4 -0
  21. package/dist/layout/Accordion.svelte +32 -0
  22. package/dist/layout/Bar.svelte +50 -0
  23. package/dist/layout/ColumnContainer.svelte +32 -0
  24. package/dist/layout/Columns.svelte +32 -0
  25. package/dist/layout/Container.svelte +48 -2
  26. package/dist/layout/DataList.svelte +33 -1
  27. package/dist/layout/DataList.svelte.d.ts +7 -0
  28. package/dist/layout/DataListItem.svelte +56 -2
  29. package/dist/layout/Fieldset.svelte +32 -0
  30. package/dist/layout/Form.svelte +32 -0
  31. package/dist/layout/FormItem.svelte +46 -0
  32. package/dist/layout/GridLayout.svelte +59 -0
  33. package/dist/layout/Hero.svelte +42 -0
  34. package/dist/layout/Inline.svelte +37 -1
  35. package/dist/layout/MenuList.svelte +32 -0
  36. package/dist/layout/Page.svelte +137 -10
  37. package/dist/layout/Page.svelte.d.ts +17 -0
  38. package/dist/layout/RowContainer.svelte +32 -0
  39. package/dist/layout/Sidebar.svelte +104 -56
  40. package/dist/layout/SidebarContainer.svelte +32 -0
  41. package/dist/layout/SplitPane.svelte +32 -0
  42. package/dist/layout/Stack.svelte +32 -0
  43. package/dist/layout/TabBar.svelte +127 -8
  44. package/dist/layout/TabBar.svelte.d.ts +16 -0
  45. package/dist/layout/Table.svelte +60 -9
  46. package/dist/layout/Tile.svelte +89 -6
  47. package/dist/misc/CodeInner.svelte +32 -0
  48. package/dist/misc/Progress.svelte +32 -0
  49. package/dist/misc/Tag.svelte +32 -0
  50. package/dist/overlays/Dialog.svelte +32 -0
  51. package/dist/overlays/Tooltip.svelte +32 -0
  52. package/dist/sass/_responsive.scss +43 -0
  53. package/dist/typography/TextLayout.svelte +47 -0
  54. package/dist/vars/defaults.css +4 -1
  55. package/dist/vars/layout.css +4 -1
  56. package/dist/vars/responsive-typography.css +4 -1
  57. package/package.json +1 -1
@@ -13,6 +13,49 @@
13
13
  $sidebar-compact-max: 512px;
14
14
  $sidebar-wide-min: 513px;
15
15
 
16
+ /* The "small" size tier: a component whose container is this wide or less
17
+ is on a phone, or in a pane about that narrow, and sizes itself for it.
18
+
19
+ The convention, shared by every component that has a size worth changing
20
+ there (Card started it; Tile, GridLayout, Bar and Container follow):
21
+
22
+ --{component}-{property}-small
23
+
24
+ applies inside a small container. What wins there, in order:
25
+ 1. the `-small` variable, if you set it;
26
+ 2. otherwise the regular variable, if you set it -- a size you chose on
27
+ purpose is not overridden behind your back;
28
+ 3. otherwise the component's own small default, which for most
29
+ properties is simply its regular default.
30
+
31
+ Container queries can't read a custom property, so the breakpoint itself
32
+ is fixed here rather than themeable. 600px matches Card and SplitPane,
33
+ which already switched there. (The Sidebar's rail-to-sheet switch,
34
+ above, is a separate, layout-chrome decision and keeps its own value.) */
35
+ $small-max: 600px;
36
+
37
+ /* Styles for the small tier: the nearest container is narrow, OR the
38
+ viewport is.
39
+
40
+ The container query is the real answer -- a Tile in a 400px pane on a
41
+ desktop is small. But a container query only matches inside an ancestor
42
+ that *is* a container, and a component dropped straight into a page (no
43
+ Page, no Container around it) has none, so on a phone it would never
44
+ find out. The viewport query covers that: a narrow viewport means every
45
+ container in it is narrow too, so the two never disagree in the
46
+ direction that matters.
47
+
48
+ An element never queries itself, so on a component that is its own
49
+ container (Tile, Bar) this asks about the space it was given. */
50
+ @mixin when-small {
51
+ @media (max-width: #{$small-max}) {
52
+ @content;
53
+ }
54
+ @container (max-width: #{$small-max}) {
55
+ @content;
56
+ }
57
+ }
58
+
16
59
 
17
60
  /* Warning: because we define a fallback
18
61
  media query, the media query can override the container
@@ -78,6 +78,38 @@ const el = $derived(elementProps(restProps, "text-layout", ["marginBlock", "marg
78
78
  we deliberately avoid everywhere else.
79
79
 
80
80
  One definition, used by both, so they cannot drift again. */
81
+ /* The "small" size tier: a component whose container is this wide or less
82
+ is on a phone, or in a pane about that narrow, and sizes itself for it.
83
+
84
+ The convention, shared by every component that has a size worth changing
85
+ there (Card started it; Tile, GridLayout, Bar and Container follow):
86
+
87
+ --{component}-{property}-small
88
+
89
+ applies inside a small container. What wins there, in order:
90
+ 1. the `-small` variable, if you set it;
91
+ 2. otherwise the regular variable, if you set it -- a size you chose on
92
+ purpose is not overridden behind your back;
93
+ 3. otherwise the component's own small default, which for most
94
+ properties is simply its regular default.
95
+
96
+ Container queries can't read a custom property, so the breakpoint itself
97
+ is fixed here rather than themeable. 600px matches Card and SplitPane,
98
+ which already switched there. (The Sidebar's rail-to-sheet switch,
99
+ above, is a separate, layout-chrome decision and keeps its own value.) */
100
+ /* Styles for the small tier: the nearest container is narrow, OR the
101
+ viewport is.
102
+
103
+ The container query is the real answer -- a Tile in a 400px pane on a
104
+ desktop is small. But a container query only matches inside an ancestor
105
+ that *is* a container, and a component dropped straight into a page (no
106
+ Page, no Container around it) has none, so on a phone it would never
107
+ find out. The viewport query covers that: a narrow viewport means every
108
+ container in it is narrow too, so the two never disagree in the
109
+ direction that matters.
110
+
111
+ An element never queries itself, so on a component that is its own
112
+ container (Tile, Bar) this asks about the space it was given. */
81
113
  /* Warning: because we define a fallback
82
114
  media query, the media query can override the container
83
115
  if we stack a bunch of these in a row and aren't thoughtful about the order.
@@ -305,6 +337,10 @@ div {
305
337
  --_prose-margin-inline: var(--body-prose-margin-inline, var(--text-prose-margin-inline, var(--prose-margin-inline, auto)));
306
338
  --_heading-margin-inline: var(--body-heading-margin-inline, var(--text-heading-margin-inline, var(--heading-margin-inline, auto)));
307
339
  width: var(--text-width, var(--body-width, 100%));
340
+ /* width is 100% by default and padding-inline is added on top -- without
341
+ border-box a TextLayout is always 2 * padding wider than its parent,
342
+ which on a phone means a sideways scroll before anything else loads. */
343
+ box-sizing: border-box;
308
344
  /* Not margin-props() (_box.scss): that defaults both axes to 0, but a
309
345
  TextLayout has always centred itself horizontally by default. Same
310
346
  var-with-fallbacks() shape as everywhere else, just inline defaults to
@@ -357,6 +393,17 @@ div :global(code) {
357
393
  text-wrap: nowrap;
358
394
  }
359
395
 
396
+ /* Inline code (a CSS variable name, a prop signature) reads best unbroken,
397
+ so it stays on one line -- until the column it sits in is too narrow for
398
+ that to be a choice. There a long token like --grid-layout-justify-content
399
+ is wider than the whole line, and refusing to break it pushes the layout
400
+ sideways; let it wrap, and mid-token if it has to. */
401
+ @container (max-width: 30rem) {
402
+ div :global(:not(pre) > code) {
403
+ text-wrap: wrap;
404
+ overflow-wrap: anywhere;
405
+ }
406
+ }
360
407
  /* Everywhere else, heading styling is consumed once, globally, by the
361
408
  :where()-scoped rule in vars/typography-context.css -- zero specificity, so
362
409
  any real selector easily overrides it. TextLayout is the one exception:
@@ -889,7 +889,10 @@ body {
889
889
  --icon-size: 32px;
890
890
  /* Cards */
891
891
  --card-width: 420px;
892
- --card-width-small: 250px;
892
+ /* In the small tier a Card fills the space it's given (Card's max-width
893
+ still keeps it inside its margins). Was 250px: a narrow card adrift in a
894
+ 390px phone, small enough to trip Card's own narrow-card styles. */
895
+ --card-width-small: 100%;
893
896
  --card-width-large: 600px;
894
897
  --card-height: 300px;
895
898
  --card-height-small: 150px;
@@ -47,7 +47,10 @@ body {
47
47
  --icon-size: 32px;
48
48
  /* Cards */
49
49
  --card-width: 420px;
50
- --card-width-small: 250px;
50
+ /* In the small tier a Card fills the space it's given (Card's max-width
51
+ still keeps it inside its margins). Was 250px: a narrow card adrift in a
52
+ 390px phone, small enough to trip Card's own narrow-card styles. */
53
+ --card-width-small: 100%;
51
54
  --card-width-large: 600px;
52
55
  --card-height: 300px;
53
56
  --card-height-small: 150px;
@@ -1,6 +1,9 @@
1
+ /* 16px is the floor, not 14: phones are where small text hurts most, and
2
+ iOS Safari zooms the page whenever an input under 16px takes focus. The
3
+ scale grows from there on bigger screens. */
1
4
  @media screen and (max-width: 800px) {
2
5
  :root {
3
- --font-size: 14px;
6
+ --font-size: 16px;
4
7
  --text-size: var(--font-size);
5
8
  --ui-size: var(--font-size);
6
9
  font-size: var(--font-size);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contain-css-svelte",
3
- "version": "1.4.3",
3
+ "version": "1.6.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "capture:review": "node scripts/capture-review.mjs",