contain-css-svelte 0.0.13 → 0.0.15

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 +46 -26
  2. package/dist/controls/Button.svelte +7 -2
  3. package/dist/controls/Checkbox.svelte +6 -1
  4. package/dist/controls/Input.svelte +2 -2
  5. package/dist/controls/MiniButton.svelte +11 -2
  6. package/dist/controls/RadioButton.svelte +11 -5
  7. package/dist/controls/Select.svelte +46 -30
  8. package/dist/controls/TabItem.svelte +2 -2
  9. package/dist/cssprops.js +0 -1
  10. package/dist/dropdowns/DropdownMenu.svelte +20 -17
  11. package/dist/index.d.ts +7 -1
  12. package/dist/index.js +7 -1
  13. package/dist/layout/Accordion.svelte +199 -0
  14. package/dist/layout/Accordion.svelte.d.ts +20 -0
  15. package/dist/layout/Bar.svelte +2 -2
  16. package/dist/layout/Column.svelte +3 -3
  17. package/dist/layout/Columns.svelte +2 -2
  18. package/dist/layout/Container.svelte +46 -26
  19. package/dist/layout/FormItem.svelte +2 -2
  20. package/dist/layout/GridLayout.svelte +2 -2
  21. package/dist/layout/Hero.svelte +46 -26
  22. package/dist/layout/MenuList.svelte +8 -2
  23. package/dist/layout/Page.svelte +2 -2
  24. package/dist/layout/Row.svelte +2 -2
  25. package/dist/layout/Sidebar.svelte +6 -1
  26. package/dist/layout/SplitPane.svelte +2 -2
  27. package/dist/layout/TabBar.svelte +2 -2
  28. package/dist/layout/Table.svelte +217 -0
  29. package/dist/layout/Table.svelte.d.ts +29 -0
  30. package/dist/layout/Tile.svelte +59 -33
  31. package/dist/misc/CodeInner.svelte +2 -109
  32. package/dist/misc/Progress.svelte +288 -0
  33. package/dist/misc/Progress.svelte.d.ts +28 -0
  34. package/dist/overlays/Dialog.svelte +2 -2
  35. package/dist/overlays/Tooltip.svelte +54 -34
  36. package/dist/sass/_affordances.scss +51 -0
  37. package/dist/sass/_box.scss +112 -0
  38. package/dist/sass/_color.scss +8 -0
  39. package/dist/sass/_functions.scss +113 -0
  40. package/dist/sass/_mixins.scss +6 -418
  41. package/dist/sass/_responsive.scss +75 -0
  42. package/dist/sass/_typography.scss +129 -0
  43. package/dist/typography/TextLayout.svelte +46 -26
  44. package/dist/vars/affordances.css +6 -1
  45. package/dist/vars/colors.css +1 -0
  46. package/dist/vars/defaults.css +7 -1
  47. package/dist/vars/themes/typography-airy.css +1 -1
  48. package/dist/vars/themes/typography-browser.css +1 -1
  49. package/dist/vars/themes/typography-carbon.css +1 -1
  50. package/package.json +3 -3
@@ -0,0 +1,113 @@
1
+
2
+ @function var-with-fallbacks($base-var, $args...) {
3
+ // Remove the initial -- from the base variable for concatenation purposes
4
+ $base-var-name: str-slice($base-var, 3);
5
+ $fallback : nth($args,length($args));
6
+
7
+ // Initialize the result with the final fallback value
8
+ $result: var($base-var,$fallback);
9
+
10
+ // Check if only one argument (apart from $base-var) is provided
11
+ @if length($args)==1 {
12
+ // Only one argument means it's the fallback value
13
+ @return var(#{$base-var}, #{$fallback});
14
+ }
15
+
16
+ // Iterate through the prefixes in reverse order
17
+ @for $i from length($args)-1 through 1 {
18
+ $prefix: nth($args,$i);
19
+ // Construct the variable name by concatenating the prefix and base variable name
20
+ // e.g., --card-bg if $prefix is 'card' and $base-var-name is 'bg'
21
+ $prefixed-var: unquote('--#{$prefix}-#{$base-var-name}');
22
+ // Nest the current prefixed variable as a fallback to the current result
23
+ $result: var(#{$prefixed-var}, #{$result});
24
+ }
25
+
26
+ // Return the final CSS var() function with all fallbacks
27
+ // e.g., var(--card-bg, var(--container-bg, var(--bg, white)))
28
+ @return #{$result};
29
+ }
30
+
31
+ @function var-no-fallbacks($base-var, $args...) {
32
+ // Remove the initial -- from the base variable for concatenation purposes
33
+ $base-var-name: str-slice($base-var, 3);
34
+
35
+ // Initialize the result with the final fallback value
36
+ $result: var($base-var, unset);
37
+
38
+ // Iterate through the prefixes in reverse order
39
+ @for $i from length($args) through 1 {
40
+ $prefix: nth($args, $i);
41
+ // Construct the variable name by concatenating the prefix and base variable name
42
+ // e.g., --card-bg if $prefix is 'card' and $base-var-name is 'bg'
43
+ $prefixed-var: unquote('--#{$prefix}-#{$base-var-name}');
44
+ // Nest the current prefixed variable as a fallback to the current result
45
+ $result: var(#{$prefixed-var}, #{$result});
46
+ }
47
+
48
+ // Return the final CSS var() function with all fallbacks
49
+ // e.g., var(--card-bg, var(--container-bg, var(--bg))
50
+ @return #{$result};
51
+ }
52
+
53
+ @function generate-var-name($prefix, $suffix) {
54
+ @return unquote('--#{$prefix}-#{$suffix}');
55
+ }
56
+
57
+ @function map-prefixes($base, $prefixes) {
58
+ $result: (
59
+ );
60
+
61
+ @each $prefix in $prefixes {
62
+ $result: append($result, unquote('#{$prefix}-#{$base}'), comma);
63
+ }
64
+
65
+ @return $result;
66
+ }
67
+
68
+ @function map-prefixes-include-base ($base, $prefixes) {
69
+ $result: (
70
+ $base
71
+ );
72
+
73
+ @each $prefix in $prefixes {
74
+ $result: append($result, unquote('#{$prefix}-#{$base}'), comma);
75
+ }
76
+
77
+ @return $result;
78
+ }
79
+
80
+
81
+ @function vars ($suffix, $args...) {
82
+ // Initialize the result with the first prefixed variable
83
+ $prefix: nth($args, length($args));
84
+ $result: var(generate-var-name($prefix, $suffix), inherit);
85
+
86
+ // Iterate through the rest of the prefixes
87
+ @for $i from length($args) through 1 {
88
+ $prefix: nth($args, $i);
89
+ $prefixed-var: generate-var-name($prefix,$suffix);
90
+ // Nest the current prefixed variable as a fallback to the current result
91
+ $result: var(#{$prefixed-var}, #{$result});
92
+ }
93
+
94
+ // Return the final CSS var() function with all fallbacks
95
+ @return #{$result};
96
+ }
97
+
98
+ @function vars-suffix-fallback ($suffix, $args...) {
99
+ // Initialize the result with the first prefixed variable
100
+ $prefix: nth($args, length($args));
101
+ $result: var(--#{$suffix}, inherit);
102
+
103
+ // Iterate through the rest of the prefixes
104
+ @for $i from length($args) through 1 {
105
+ $prefix: nth($args, $i);
106
+ $prefixed-var: generate-var-name($prefix, $suffix);
107
+ // Nest the current prefixed variable as a fallback to the current result
108
+ $result: var(#{$prefixed-var}, #{$result});
109
+ }
110
+
111
+ // Return the final CSS var() function with all fallbacks
112
+ @return #{$result};
113
+ }
@@ -1,348 +1,10 @@
1
1
  @import 'containers';
2
-
3
- @function var-with-fallbacks($base-var, $args...) {
4
- // Remove the initial -- from the base variable for concatenation purposes
5
- $base-var-name: str-slice($base-var, 3);
6
- $fallback : nth($args,length($args));
7
-
8
- // Initialize the result with the final fallback value
9
- $result: var($base-var,$fallback);
10
-
11
- // Check if only one argument (apart from $base-var) is provided
12
- @if length($args)==1 {
13
- // Only one argument means it's the fallback value
14
- @return var(#{$base-var}, #{$fallback});
15
- }
16
-
17
- // Iterate through the prefixes in reverse order
18
- @for $i from length($args)-1 through 1 {
19
- $prefix: nth($args,$i);
20
- // Construct the variable name by concatenating the prefix and base variable name
21
- // e.g., --card-bg if $prefix is 'card' and $base-var-name is 'bg'
22
- $prefixed-var: unquote('--#{$prefix}-#{$base-var-name}');
23
- // Nest the current prefixed variable as a fallback to the current result
24
- $result: var(#{$prefixed-var}, #{$result});
25
- }
26
-
27
- // Return the final CSS var() function with all fallbacks
28
- // e.g., var(--card-bg, var(--container-bg, var(--bg, white)))
29
- @return #{$result};
30
- }
31
-
32
- @function var-no-fallbacks($base-var, $args...) {
33
- // Remove the initial -- from the base variable for concatenation purposes
34
- $base-var-name: str-slice($base-var, 3);
35
-
36
- // Initialize the result with the final fallback value
37
- $result: var($base-var, unset);
38
-
39
- // Iterate through the prefixes in reverse order
40
- @for $i from length($args) through 1 {
41
- $prefix: nth($args, $i);
42
- // Construct the variable name by concatenating the prefix and base variable name
43
- // e.g., --card-bg if $prefix is 'card' and $base-var-name is 'bg'
44
- $prefixed-var: unquote('--#{$prefix}-#{$base-var-name}');
45
- // Nest the current prefixed variable as a fallback to the current result
46
- $result: var(#{$prefixed-var}, #{$result});
47
- }
48
-
49
- // Return the final CSS var() function with all fallbacks
50
- // e.g., var(--card-bg, var(--container-bg, var(--bg))
51
- @return #{$result};
52
- }
53
-
54
-
55
- @function generate-var-name($prefix, $suffix) {
56
- @return unquote('--#{$prefix}-#{$suffix}');
57
- }
58
-
59
- @function map-prefixes($base, $prefixes) {
60
- $result: (
61
- );
62
-
63
- @each $prefix in $prefixes {
64
- $result: append($result, unquote('#{$prefix}-#{$base}'), comma);
65
- }
66
-
67
- @return $result;
68
- }
69
-
70
- @function vars ($suffix, $args...) {
71
- // Initialize the result with the first prefixed variable
72
- $prefix: nth($args, length($args));
73
- $result: var(generate-var-name($prefix, $suffix), inherit);
74
-
75
- // Iterate through the rest of the prefixes
76
- @for $i from length($args) through 1 {
77
- $prefix: nth($args, $i);
78
- $prefixed-var: generate-var-name($prefix,$suffix);
79
- // Nest the current prefixed variable as a fallback to the current result
80
- $result: var(#{$prefixed-var}, #{$result});
81
- }
82
-
83
- // Return the final CSS var() function with all fallbacks
84
- @return #{$result};
85
- }
86
-
87
- @mixin color-props ($prefixes...) {
88
- background: var-no-fallbacks(--bg, $prefixes...);
89
- color: var-no-fallbacks(--fg, $prefixes...);
90
- --link-bg: #{vars(link-bg, $prefixes...)};
91
- --link-fg: #{vars(link-fg, $prefixes...)};
92
- }
93
-
94
- @mixin typography-props-bare($prefixes...) {
95
- font-family: vars(font-family, $prefixes...);
96
- text-transform: vars(text-transform, $prefixes...);
97
- text-decoration: vars(text-decoration, $prefixes...);
98
- font-size: vars(font-size, $prefixes...);
99
- font-weight: vars(font-weight, $prefixes...);
100
- line-height: vars(line-height, $prefixes...);
101
- letter-spacing: vars(letter-spacing, $prefixes...);
102
- text-indent: vars(indent, $prefixes...);
103
- font-variant: vars(font-variant, $prefixes...);
104
- text-align: vars(text-align, $prefixes...);
105
- }
106
-
107
- @mixin typography-props ($prefixes...) {
108
- font-family: var-no-fallbacks(--font-family, $prefixes...);
109
- text-transform: var-no-fallbacks(--text-transform, $prefixes...);
110
- text-decoration: var-no-fallbacks(--text-decoration, $prefixes...);
111
- font-size: var-no-fallbacks(--font-size, $prefixes...);
112
- font-weight: var-no-fallbacks(--font-weight, $prefixes...);
113
- line-height: var-no-fallbacks(--line-height, $prefixes...);
114
- letter-spacing: var-no-fallbacks(--letter-spacing, $prefixes...);
115
- margin-top: var-no-fallbacks(--margin, $prefixes...);
116
- margin-top: var-no-fallbacks(--margin-top, $prefixes...);
117
- margin-bottom: var-no-fallbacks(--margin, $prefixes...);
118
- margin-bottom: var-no-fallbacks(--margin-bottom, $prefixes...);
119
- text-indent: var-no-fallbacks(--indent, $prefixes...);
120
- font-variant: var-no-fallbacks(--font-variant, $prefixes...);
121
- text-align: var-no-fallbacks(--text-align, $prefixes...);
122
- }
123
-
124
- @mixin typography-container-props ($prefixes...) {
125
-
126
- max-width: var-with-fallbacks(--line-width, append($prefixes, unset)...);
127
- margin-left: auto;
128
- margin-right: auto;
129
- font-family: var-with-fallbacks(--body-font-family, append($prefixes, var(--font-family))...);
130
-
131
- @include typography-props($prefixes...);
132
- & :global(p),:global(blockquote),:global(dl),:global(ul),:global(ol), {
133
- max-width: var-with-fallbacks(--line-width, append($prefixes, 40em)...);
134
- font-family: var-with-fallbacks(--body-font-family, append($prefixes, var(--font-family))...);
135
- line-height: var-with-fallbacks(--line-height, append($prefixes, 1.5)...);
136
- margin-left: auto;
137
- margin-right: auto;
138
- font-weight: var-no-fallbacks(--body-font-weight, $prefixes...);
139
- }
140
- & :global(h1),
141
- :global(h2),
142
- :global(h3),
143
- :global(h4),
144
- :global(h5),
145
- :global(h6) {
146
-
147
- @include color-props(heading);
148
- max-width: var-with-fallbacks(--line-width, append($prefixes, unset)...);
149
- margin-left: auto;
150
- margin-right: auto;
151
- margin-bottom: var-with-fallbacks(--heading-margin-bottom, append($prefixes, 0)...);
152
- margin-top: var-with-fallbacks(--heading-margin-top, append($prefixes, 1.5em)...);
153
- }
154
- & :global(p) {
155
- @include typography-props-bare(
156
- append(map-prefixes(
157
- paragraph,
158
- $prefixes
159
- ),paragraph)...);
160
- }
161
- & :global(p:first-of-type),
162
- :global(h1 + p),
163
- :global(h2 + p),
164
- :global(h3 + p),
165
- :global(h4 + p),
166
- :global(h5 + p),
167
- :global(h6 + p) {
168
- @include typography-props-bare(
169
- append(map-prefixes(
170
- first-paragraph,
171
- $prefixes
172
- ),first-paragraph)...);
173
- }
174
- & :global(p:first-of-type::first-line) {
175
- @include typography-props-bare(
176
- append(map-prefixes(
177
- first-line,
178
- $prefixes
179
- ),first-line)...);
180
-
181
- }
182
-
183
- & :global(p:first-of-type::first-letter) {
184
- @include typography-props-bare(
185
- map-prefixes(
186
- first-letter,
187
- $prefixes
188
- )...);
189
- @include color-props(first-letter,
190
- first-line,
191
- );
192
- }
193
- }
194
-
195
- @mixin padding-props ($prefixes...) {
196
- padding: var-with-fallbacks(--padding, append($prefixes, 4px)...);
197
- }
198
-
199
- @mixin border-props-border ($prefixes...) {
200
- border: var-with-fallbacks(
201
- --border,
202
- append(
203
- $prefixes,
204
- var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg))
205
- )...);
206
- $directions: (
207
- top,
208
- right,
209
- bottom,
210
- left
211
- );
212
- $rectProps : (border);
213
-
214
- // Loop through each direction
215
- @each $dir in $directions {
216
- // Apply prop for each direction
217
- @each $p in $rectProps {
218
- /* #{$p}-#{$dir}: var-with-fallbacks(--#{$p}-#{$dir},
219
- append($prefixes,
220
- var-with-fallbacks(--border,$prefixes...)
221
- )...) */
222
- }
223
- }
224
- }
225
- @mixin border-props-none ($prefixes...) {
226
- border: var-with-fallbacks(--border, append($prefixes,inherit)...);
227
- $directions: (
228
- top,
229
- right,
230
- bottom,
231
- left
232
- );
233
- $rectProps : (border);
234
-
235
- // Loop through each direction
236
- @each $dir in $directions {
237
-
238
- // Apply prop for each direction
239
- @each $p in $rectProps {
240
- #{$p}-#{$dir}: var-with-fallbacks(--#{$p}-#{$dir},
241
- append($prefixes,
242
- var-with-fallbacks(--border,append($prefixes,none)...)
243
- )...);
244
- }
245
- }
246
- }
247
-
248
- @mixin box-props-square-border($prefixes...) {
249
- box-sizing: border-box;
250
-
251
- @include border-props-border($prefixes...);
252
- @include padding-props($prefixes...);
253
- border-radius: var-with-fallbacks(--square-radius, append($prefixes, 0)...);
254
- }
255
-
256
- @mixin box-props-square($prefixes...) {
257
- box-sizing: border-box;
258
- @include border-props-none($prefixes...);
259
- @include padding-props($prefixes...);
260
- border-radius: var-with-fallbacks(--square-radius, append($prefixes, 0)...);
261
- }
262
-
263
- @mixin box-props($prefixes...) {
264
- // Using the var-with-fallbacks function for each property
265
- box-sizing: border-box;
266
- @include padding-props($prefixes...);
267
- @include border-props-none($prefixes...);
268
- border-radius: var-with-fallbacks(--border-radius, append($prefixes,none)...);
269
- }
270
-
271
- @mixin box-props-border($prefixes...) {
272
- box-sizing: border-box;
273
- @include border-props-border($prefixes..., var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg)));
274
- @include padding-props($prefixes...);
275
- border-radius: var-with-fallbacks(--radius, append($prefixes, 0)...);
276
- }
277
-
278
- @mixin box-props-bottom ($prefixes...) {
279
- // Using the var-with-fallbacks function for each property
280
- box-sizing: border-box;
281
- @include padding-props($prefixes...);
282
- @include border-props-none($prefixes...);
283
- border-bottom-right-radius: var-with-fallbacks(--border-radius, $prefixes...);
284
- border-bottom-left-radius: var-with-fallbacks(--border-radius, $prefixes...);
285
- }
286
- @mixin box-props-top ($prefixes...) {
287
- // Using the var-with-fallbacks function for each property
288
- box-sizing: border-box;
289
- @include padding-props($prefixes...);
290
- @include border-props-none($prefixes...);
291
- border-top-right-radius: var-with-fallbacks(--border-radius, $prefixes...);
292
- border-top-left-radius: var-with-fallbacks(--border-radius, $prefixes...);
293
- }
294
-
295
- @mixin box-shadow($prefixes...) {
296
- //works:
297
- $shadow-distance: var-with-fallbacks(--shadow-distance, append($prefixes, var(--space-md))...);
298
- $shadow-blur: var-with-fallbacks(--shadow-blur, append($prefixes, var(--space))...);
299
- $shadow-color: var-with-fallbacks(--shadow-color, append($prefixes, rgba(127, 127, 127, 0.4))...);
300
-
301
- box-shadow: $shadow-distance $shadow-distance $shadow-blur $shadow-color;
302
- }
303
-
304
- @mixin clickable($prefixes...) {
305
- cursor: var-with-fallbacks(--cursor,append($prefixes, pointer)...);
306
- transition: filter,transform var-with-fallbacks(--transition,append($prefixes,300ms)...);
307
- &:hover {
308
- filter: var-with-fallbacks(--hover-filter, append($prefixes, brightness(1.4))...);
309
- transform: var-with-fallbacks(--hover-transform, append($prefixes, none)...);
310
-
311
- }
312
- &:active {
313
- filter: var-with-fallbacks(--active-filter, append($prefixes, brightness(0.9))...);
314
- transform: var-with-fallbacks(--active-transform, append($prefixes, none)...);
315
- }
316
- }
317
-
318
- @mixin custom-scrollbar($prefixes...) {
319
- overflow-y: auto;
320
-
321
- // Customizing the scrollbar
322
- &::-webkit-scrollbar {
323
- width: var-with-fallbacks(--scrollbar-width, append($prefixes, var(--space-md))...);
324
- height: var-with-fallbacks(--scrollbar-height, append($prefixes, var(--gap))...);
325
- }
326
-
327
- &::-webkit-scrollbar-track {
328
- background: var-with-fallbacks(--scrollbar-track-bg, append($prefixes, var(--bg))...);
329
- }
330
-
331
- &::-webkit-scrollbar-thumb {
332
- background: var-with-fallbacks(--scrollbar-thumb-bg, append($prefixes, var(--stripe-bg))...);
333
-
334
- border-radius: var-with-fallbacks(--scrollbar-thumb-radius, append($prefixes, var(--border-radius))...);
335
-
336
- &:hover {
337
- background: var-with-fallbacks(--scrollbar-thumb-hover-bg, append($prefixes, var(--secondary-bg))...);
338
-
339
- }
340
- }
341
-
342
- // For Firefox
343
- scrollbar-width: var-with-fallbacks(--scrollbar-width, append($prefixes, thin)...);
344
- scrollbar-color: var-with-fallbacks(--scrollbar-thumb-bg, append($prefixes, #888)...) var-with-fallbacks(--scrollbar-track-bg, append($prefixes, var(--border-color))...);
345
- }
2
+ @import 'functions';
3
+ @import 'color';
4
+ @import 'typography';
5
+ @import 'box';
6
+ @import 'affordances';
7
+ @import 'responsive';
346
8
 
347
9
  /* Convenience groupings */
348
10
 
@@ -354,77 +16,3 @@ $rectProps : (border);
354
16
  @content
355
17
  }
356
18
  }
357
- /* Warning: because we define a fallback
358
- media query, the media query can override the container
359
- if we stack a bunch of these in a row and aren't thoughtful about the order.
360
- Put min-width queries *after* max-width queries so that smaller
361
- container queries don't get their styles overridden by large media queries.
362
- */
363
- @mixin responsive-content($max-width: null, $min-width: null, $max-height: null, $min-height: null) {
364
-
365
- // Max-width and Max-height
366
- @if $max-width and $max-height {
367
- @media (max-width: #{$max-width}) and (max-height: #{$max-height}) {
368
- @content;
369
- }
370
-
371
- @container (max-width: #{$max-width}) and (max-height: #{$max-height}) {
372
- @content;
373
- }
374
- }
375
-
376
- // Max-width only
377
- @else if $max-width {
378
- @media (max-width: #{$max-width}) {
379
- @content;
380
- }
381
-
382
- @container (max-width: #{$max-width}) {
383
- @content;
384
- }
385
- }
386
-
387
- // Max-height only
388
- @else if $max-height {
389
- @media (max-height: #{$max-height}) {
390
- @content;
391
- }
392
-
393
- @container (max-height: #{$max-height}) {
394
- @content;
395
- }
396
- }
397
-
398
- // Min-width and Min-height
399
- @if $min-width and $min-height {
400
- @media (min-width: #{$min-width}) and (min-height: #{$min-height}) {
401
- @content;
402
- }
403
-
404
- @container (min-width: #{$min-width}) and (min-height: #{$min-height}) {
405
- @content;
406
- }
407
- }
408
-
409
- // Min-width only
410
- @else if $min-width {
411
- @media (min-width: #{$min-width}) {
412
- @content;
413
- }
414
-
415
- @container (min-width: #{$min-width}) {
416
- @content;
417
- }
418
- }
419
-
420
- // Min-height only
421
- @else if $min-height {
422
- @media (min-height: #{$min-height}) {
423
- @content;
424
- }
425
-
426
- @container (min-height: #{$min-height}) {
427
- @content;
428
- }
429
- }
430
- }
@@ -0,0 +1,75 @@
1
+
2
+ /* Warning: because we define a fallback
3
+ media query, the media query can override the container
4
+ if we stack a bunch of these in a row and aren't thoughtful about the order.
5
+ Put min-width queries *after* max-width queries so that smaller
6
+ container queries don't get their styles overridden by large media queries.
7
+ */
8
+ @mixin responsive-content($max-width: null, $min-width: null, $max-height: null, $min-height: null) {
9
+
10
+ // Max-width and Max-height
11
+ @if $max-width and $max-height {
12
+ @media (max-width: #{$max-width}) and (max-height: #{$max-height}) {
13
+ @content;
14
+ }
15
+
16
+ @container (max-width: #{$max-width}) and (max-height: #{$max-height}) {
17
+ @content;
18
+ }
19
+ }
20
+
21
+ // Max-width only
22
+ @else if $max-width {
23
+ @media (max-width: #{$max-width}) {
24
+ @content;
25
+ }
26
+
27
+ @container (max-width: #{$max-width}) {
28
+ @content;
29
+ }
30
+ }
31
+
32
+ // Max-height only
33
+ @else if $max-height {
34
+ @media (max-height: #{$max-height}) {
35
+ @content;
36
+ }
37
+
38
+ @container (max-height: #{$max-height}) {
39
+ @content;
40
+ }
41
+ }
42
+
43
+ // Min-width and Min-height
44
+ @if $min-width and $min-height {
45
+ @media (min-width: #{$min-width}) and (min-height: #{$min-height}) {
46
+ @content;
47
+ }
48
+
49
+ @container (min-width: #{$min-width}) and (min-height: #{$min-height}) {
50
+ @content;
51
+ }
52
+ }
53
+
54
+ // Min-width only
55
+ @else if $min-width {
56
+ @media (min-width: #{$min-width}) {
57
+ @content;
58
+ }
59
+
60
+ @container (min-width: #{$min-width}) {
61
+ @content;
62
+ }
63
+ }
64
+
65
+ // Min-height only
66
+ @else if $min-height {
67
+ @media (min-height: #{$min-height}) {
68
+ @content;
69
+ }
70
+
71
+ @container (min-height: #{$min-height}) {
72
+ @content;
73
+ }
74
+ }
75
+ }