contain-css-svelte 0.0.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.
Files changed (74) hide show
  1. package/README.md +58 -0
  2. package/dist/Card.svelte +172 -0
  3. package/dist/Card.svelte.d.ts +27 -0
  4. package/dist/controls/Button.svelte +74 -0
  5. package/dist/controls/Button.svelte.d.ts +28 -0
  6. package/dist/controls/Checkbox.svelte +111 -0
  7. package/dist/controls/Checkbox.svelte.d.ts +18 -0
  8. package/dist/controls/Input.svelte +33 -0
  9. package/dist/controls/Input.svelte.d.ts +22 -0
  10. package/dist/controls/MiniButton.svelte +78 -0
  11. package/dist/controls/MiniButton.svelte.d.ts +31 -0
  12. package/dist/controls/RadioButton.svelte +109 -0
  13. package/dist/controls/RadioButton.svelte.d.ts +25 -0
  14. package/dist/controls/Select.svelte +135 -0
  15. package/dist/controls/Select.svelte.d.ts +20 -0
  16. package/dist/controls/Slider.svelte +45 -0
  17. package/dist/controls/Slider.svelte.d.ts +29 -0
  18. package/dist/controls/TabItem.svelte +56 -0
  19. package/dist/controls/TabItem.svelte.d.ts +29 -0
  20. package/dist/cssprops.d.ts +1 -0
  21. package/dist/cssprops.js +189 -0
  22. package/dist/dropdowns/DropdownMenu.svelte +234 -0
  23. package/dist/dropdowns/DropdownMenu.svelte.d.ts +19 -0
  24. package/dist/index.d.ts +23 -0
  25. package/dist/index.js +24 -0
  26. package/dist/layout/Bar.svelte +57 -0
  27. package/dist/layout/Bar.svelte.d.ts +27 -0
  28. package/dist/layout/Column.svelte +40 -0
  29. package/dist/layout/Column.svelte.d.ts +19 -0
  30. package/dist/layout/Columns.svelte +21 -0
  31. package/dist/layout/Columns.svelte.d.ts +27 -0
  32. package/dist/layout/Container.svelte +105 -0
  33. package/dist/layout/Container.svelte.d.ts +27 -0
  34. package/dist/layout/FormItem.svelte +97 -0
  35. package/dist/layout/FormItem.svelte.d.ts +35 -0
  36. package/dist/layout/GridLayout.svelte +22 -0
  37. package/dist/layout/GridLayout.svelte.d.ts +16 -0
  38. package/dist/layout/Hero.svelte +86 -0
  39. package/dist/layout/Hero.svelte.d.ts +23 -0
  40. package/dist/layout/MenuList.svelte +108 -0
  41. package/dist/layout/MenuList.svelte.d.ts +29 -0
  42. package/dist/layout/Page.svelte +189 -0
  43. package/dist/layout/Page.svelte.d.ts +31 -0
  44. package/dist/layout/ResponsiveText.svelte +99 -0
  45. package/dist/layout/ResponsiveText.svelte.d.ts +26 -0
  46. package/dist/layout/Row.svelte +39 -0
  47. package/dist/layout/Row.svelte.d.ts +19 -0
  48. package/dist/layout/Sidebar.svelte +264 -0
  49. package/dist/layout/Sidebar.svelte.d.ts +23 -0
  50. package/dist/layout/SplitPane.svelte +160 -0
  51. package/dist/layout/SplitPane.svelte.d.ts +21 -0
  52. package/dist/layout/TabBar.svelte +49 -0
  53. package/dist/layout/TabBar.svelte.d.ts +28 -0
  54. package/dist/layout/Tile.svelte +172 -0
  55. package/dist/layout/Tile.svelte.d.ts +27 -0
  56. package/dist/misc/Code.svelte +27 -0
  57. package/dist/misc/Code.svelte.d.ts +18 -0
  58. package/dist/sass/_containers.scss +117 -0
  59. package/dist/sass/_mixins.scss +309 -0
  60. package/dist/typography/TextLayout.svelte +46 -0
  61. package/dist/typography/TextLayout.svelte.d.ts +27 -0
  62. package/dist/util.d.ts +3 -0
  63. package/dist/util.js +13 -0
  64. package/dist/vars/affordances.css +26 -0
  65. package/dist/vars/colors.css +345 -0
  66. package/dist/vars/defaults.css +14 -0
  67. package/dist/vars/layout.css +39 -0
  68. package/dist/vars/themes/lightordark.css +39 -0
  69. package/dist/vars/themes/purple.css +18 -0
  70. package/dist/vars/themes/typography-airy.css +13 -0
  71. package/dist/vars/themes/typography-browser.css +20 -0
  72. package/dist/vars/themes/typography-carbon.css +20 -0
  73. package/dist/vars/typography.css +16 -0
  74. package/package.json +52 -0
@@ -0,0 +1,28 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ sticky?: boolean | undefined;
5
+ active?: string | {
6
+ label: string;
7
+ value: string;
8
+ } | null | undefined;
9
+ items?: (string | {
10
+ label: string;
11
+ value: string;
12
+ })[] | undefined;
13
+ };
14
+ events: {
15
+ change: CustomEvent<any>;
16
+ } & {
17
+ [evt: string]: CustomEvent<any>;
18
+ };
19
+ slots: {
20
+ default: {};
21
+ };
22
+ };
23
+ export type TabBarProps = typeof __propDef.props;
24
+ export type TabBarEvents = typeof __propDef.events;
25
+ export type TabBarSlots = typeof __propDef.slots;
26
+ export default class TabBar extends SvelteComponent<TabBarProps, TabBarEvents, TabBarSlots> {
27
+ }
28
+ export {};
@@ -0,0 +1,172 @@
1
+ <script>import Checkbox from "../controls/Checkbox.svelte";
2
+ export let interactive = false;
3
+ export let selectable = false;
4
+ export let checked = false;
5
+ $:
6
+ console.log("Checked=>", checked);
7
+ </script>
8
+
9
+ {#if selectable}
10
+ <label class="tile">
11
+ <div class="checkbox">
12
+ <input type="checkbox" bind:checked on:input on:change on:click />
13
+ </div>
14
+ <slot />
15
+ </label>
16
+ {:else if interactive}
17
+ <button class="tile" on:click on:blur on:focus on:dblclick>
18
+ <slot />
19
+ </button>
20
+ {:else}
21
+ <div class="tile">
22
+ <slot />
23
+ </div>
24
+ {/if}
25
+
26
+ <style>@charset "UTF-8";
27
+ /* Convenience groupings */
28
+ /* Warning: because we define a fallback
29
+ media query, the media query can override the container
30
+ if we stack a bunch of these in a row and aren't thoughtful about the order.
31
+ Put min-width queries *after* max-width queries so that smaller
32
+ container queries don't get their styles overridden by large media queries.
33
+ */
34
+ .tile,
35
+ .tile label,
36
+ .tile button {
37
+ border: var(--tile-border, var(--border-width) var(--border-style) var(--border-color));
38
+ box-sizing: border-box;
39
+ border: var(--tile-border, var(--border, var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg))));
40
+ border-top: var(--tile-border-top, var(--border-top, var(--border, tile)));
41
+ border-right: var(--tile-border-right, var(--border-right, var(--border, tile)));
42
+ border-bottom: var(--tile-border-bottom, var(--border-bottom, var(--border, tile)));
43
+ border-left: var(--tile-border-left, var(--border-left, var(--border, tile)));
44
+ padding: var(--tile-padding, var(--padding, 4px));
45
+ border-radius: var(--tile-square-radius, var(--square-radius, 0));
46
+ background: var(--tile-bg, var(--bg, white));
47
+ color: var(--tile-fg, var(--fg, black));
48
+ font-family: var(--tile-font-family, var(--font-family, sans-serif));
49
+ text-transform: var(--tile-text-transform, var(--text-transform, none));
50
+ text-decoration: var(--tile-text-decoration, var(--text-decoration, none));
51
+ font-size: var(--tile-font-size, var(--font-size, 16px));
52
+ font-weight: var(--tile-font-weight, var(--font-weight, 400));
53
+ line-height: var(--tile-line-height, var(--line-height, 1.5));
54
+ letter-spacing: var(--tile-letter-spacing, var(--letter-spacing, 0.05em));
55
+ width: var(--tile-width, calc(var(--space-lg) * 24));
56
+ display: inline-flex;
57
+ flex-direction: column;
58
+ justify-content: var(--tile-justify, var(--justify, flex-start));
59
+ align-items: var(--tile-align, var(--align, center));
60
+ }
61
+ .tile :global(p), .tile :global(blockquote), .tile :global(dl), .tile :global(ul), .tile :global(ol),
62
+ .tile label :global(p),
63
+ .tile label :global(blockquote),
64
+ .tile label :global(dl),
65
+ .tile label :global(ul),
66
+ .tile label :global(ol),
67
+ .tile button :global(p),
68
+ .tile button :global(blockquote),
69
+ .tile button :global(dl),
70
+ .tile button :global(ul),
71
+ .tile button :global(ol) {
72
+ max-width: var(--tile-line-width, var(--line-width, 40em));
73
+ font-family: var(--tile-body-font-family, var(--body-font-family, var(--font-family)));
74
+ line-height: var(--tile-line-height, var(--line-height, 1.5));
75
+ margin-left: auto;
76
+ margin-right: auto;
77
+ font-weight: var(--tile-body-font-weight, var(--body-font-weight, var(--normal)));
78
+ }
79
+ .tile :global(h1),
80
+ .tile :global(h2),
81
+ .tile :global(h3),
82
+ .tile :global(h4),
83
+ .tile :global(h5),
84
+ .tile :global(h6),
85
+ .tile label :global(h1),
86
+ .tile label :global(h2),
87
+ .tile label :global(h3),
88
+ .tile label :global(h4),
89
+ .tile label :global(h5),
90
+ .tile label :global(h6),
91
+ .tile button :global(h1),
92
+ .tile button :global(h2),
93
+ .tile button :global(h3),
94
+ .tile button :global(h4),
95
+ .tile button :global(h5),
96
+ .tile button :global(h6) {
97
+ max-width: var(--tile-line-width, var(--line-width, 40em));
98
+ font-family: var(--tile-heading-font-family, var(--heading-font-family, var(--font-family)));
99
+ line-height: var(--tile-heading-line-height, var(--heading-line-height, var(--line-height)));
100
+ margin-left: auto;
101
+ margin-right: auto;
102
+ color: var(--heading-color, tile, var(--fg));
103
+ font-weight: var(--heading-font-weight, tile, var(--bold));
104
+ }
105
+ button.tile,
106
+ label.tile {
107
+ cursor: pointer;
108
+ transition: filter, transform var(--button-transition, var(--control-transition, var(--transition, 300ms)));
109
+ }
110
+ button.tile:hover,
111
+ label.tile:hover {
112
+ filter: var(--tile-hover-filter, var(--hover-filter, brightness(1.1)));
113
+ transform: var(--tile-hover-transform, var(--hover-transform, none));
114
+ }
115
+ button.tile:active,
116
+ label.tile:active {
117
+ filter: var(--tile-hover-filter, var(--hover-filter, brightness(0.9)));
118
+ transform: var(--tile-hover-transform, var(--hover-transform, translate(var(--space), var(--space))));
119
+ }
120
+ label.tile {
121
+ background: var(--tile-selected-bg, var(--bg, white));
122
+ color: var(--tile-selected-fg, var(--fg, black));
123
+ font-family: var(--tile-selected-font-family, var(--font-family, sans-serif));
124
+ text-transform: var(--tile-selected-text-transform, var(--text-transform, none));
125
+ text-decoration: var(--tile-selected-text-decoration, var(--text-decoration, none));
126
+ font-size: var(--tile-selected-font-size, var(--font-size, 16px));
127
+ font-weight: var(--tile-selected-font-weight, var(--font-weight, 400));
128
+ line-height: var(--tile-selected-line-height, var(--line-height, 1.5));
129
+ letter-spacing: var(--tile-selected-letter-spacing, var(--letter-spacing, 0.05em));
130
+ }
131
+ /* Sizing code */
132
+ .tile {
133
+ width: var(--tile-width, 200px);
134
+ height: calc(var(--tile-width, 200px) * 1.333);
135
+ }
136
+ /* Checkbox code */
137
+ .tile {
138
+ position: relative;
139
+ }
140
+ .checkbox {
141
+ position: absolute;
142
+ right: var(--tile-padding, var(--container-padding, var(--padding, 4px)));
143
+ top: var(--tile-padding, var(--container-padding, var(--padding, 4px)));
144
+ display: inline-flex;
145
+ align-items: center;
146
+ width: var(--tile-checkbox-size, var(--checkbox-size, var(--toggle-size, var(--font-size, var(--size, 1em)))));
147
+ height: var(--tile-checkbox-size, var(--checkbox-size, var(--toggle-size, var(--font-size, var(--size, 1em)))));
148
+ background: var(--tile-checkbox-bg, var(--checkbox-bg, var(--toggle-bg, var(--secondary-bg, var(--bg, white)))));
149
+ color: var(--tile-checkbox-fg, var(--checkbox-fg, var(--toggle-fg, var(--secondary-fg, var(--fg, black)))));
150
+ }
151
+ .checkbox input {
152
+ display: none;
153
+ }
154
+ .checkbox:has(input:checked) {
155
+ background: var(--tile-checkbox-checked-bg, var(--checkbox-checked-bg, var(--toggle-on-bg, var(--primary-bg, var(--checkbox-bg, var(--bg, white))))));
156
+ color: var(--tile-checkbox-checked-fg, var(--checkbox-checked-fg, var(--toggle-on-fg, var(--primary-fg, var(--checkbox-fg, var(--fg, black))))));
157
+ }
158
+ .checkbox:has(input:checked)::after {
159
+ content: var(--tile-checkbox-check, var(--checkbox-check, "✓"));
160
+ font-size: var(--checkbox-size, var(--toggle-size, var(--font-size, var(--size, 1em))));
161
+ color: var(--checkbox-checked-fg, var(--toggle-on-fg, var(--fg, checkbox)));
162
+ animation: checkbox-check var(--checkbox-transition) ease-in-out;
163
+ }
164
+ @keyframes checkbox-check {
165
+ 0% {
166
+ width: 0;
167
+ overflow: hidden;
168
+ }
169
+ 100% {
170
+ width: var(--checkbox-size, var(--toggle-size, var(--font-size, var(--size, 1em))));
171
+ }
172
+ }</style>
@@ -0,0 +1,27 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ interactive?: boolean | undefined;
5
+ selectable?: boolean | undefined;
6
+ checked?: boolean | undefined;
7
+ };
8
+ events: {
9
+ input: Event;
10
+ change: Event;
11
+ click: MouseEvent;
12
+ blur: FocusEvent;
13
+ focus: FocusEvent;
14
+ dblclick: MouseEvent;
15
+ } & {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots: {
19
+ default: {};
20
+ };
21
+ };
22
+ export type TileProps = typeof __propDef.props;
23
+ export type TileEvents = typeof __propDef.events;
24
+ export type TileSlots = typeof __propDef.slots;
25
+ export default class Tile extends SvelteComponent<TileProps, TileEvents, TileSlots> {
26
+ }
27
+ export {};
@@ -0,0 +1,27 @@
1
+ <script>export let code;
2
+ import Prism from "svelte-prism";
3
+ import "prismjs/themes/prism.css";
4
+ export let inline = false;
5
+ </script>
6
+
7
+ <div class="code" class:inline>
8
+ <Prism language="html" source={code} />
9
+ </div>
10
+
11
+ <style>
12
+ div {
13
+ width: var(--code-width, 100%);
14
+ height: var(--code-height, auto);
15
+ }
16
+ div > pre {
17
+ width: var(--code-width, 100%);
18
+ overflow-x: auto;
19
+ }
20
+ .code :global(code[class*="language-"]),
21
+ .code :global(pre[class*="language-"]) {
22
+ font-family: var(--code-font-family);
23
+ font-size: var(--code-font-size);
24
+ line-height: var(--code-line-height);
25
+ tab-size: var(--code-tab-size);
26
+ }
27
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import "prismjs/themes/prism.css";
3
+ declare const __propDef: {
4
+ props: {
5
+ code: string;
6
+ inline?: boolean | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type CodeProps = typeof __propDef.props;
14
+ export type CodeEvents = typeof __propDef.events;
15
+ export type CodeSlots = typeof __propDef.slots;
16
+ export default class Code extends SvelteComponent<CodeProps, CodeEvents, CodeSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,117 @@
1
+ $xxsmall : 120px;
2
+ $xsmall : 240px;
3
+ $small : 320px;
4
+ $medium : 640px;
5
+ $large: 1024px;
6
+ $xlarge: 1200px;
7
+
8
+ @mixin width_container($min-width: null, $max-width: null) {
9
+ @if $min-width !=null and $max-width !=null {
10
+ @container (min-width: #{$min-width}) and (max-width: #{$max-width}) {
11
+ @content;
12
+ }
13
+ }
14
+
15
+ @else if $min-width !=null {
16
+ @container (min-width: #{$min-width}) {
17
+ @content;
18
+ }
19
+ }
20
+
21
+ @else if $max-width !=null {
22
+ @container (max-width: #{$max-width}) {
23
+ @content;
24
+ }
25
+ }
26
+ }
27
+
28
+
29
+ @mixin height_container($min-height: null, $max-height: null) {
30
+ @if $min-height !=null and $max-height !=null {
31
+ @container (min-height: #{$min-height}) and (max-height: #{$max-height}) {
32
+ @content;
33
+ }
34
+ }
35
+
36
+ @else if $min-height !=null {
37
+ @container (min-height: #{$min-height}) {
38
+ @content;
39
+ }
40
+ }
41
+
42
+ @else if $max-height !=null {
43
+ @container (max-height: #{$max-height}) {
44
+ @content;
45
+ }
46
+ }
47
+ }
48
+
49
+ @mixin box_container($min-width: null, $max-width: null, $min-height: null, $max-height: null) {
50
+ @if $min-width !=null and $max-width !=null and $min-height !=null and $max-height !=null {
51
+ @container (min-width: #{$min-width}) and (max-width: #{$max-width}) and (min-height: #{$min-height}) and (max-height: #{$max-height}) {
52
+ @content;
53
+ }
54
+ }
55
+
56
+ @else if $min-width !=null and $min-height !=null {
57
+ @container (min-width: #{$min-width}) and (min-height: #{$min-height}) {
58
+ @content;
59
+ }
60
+ }
61
+
62
+ @else if $max-width !=null and $max-height !=null {
63
+ @container (max-width: #{$max-width}) and (max-height: #{$max-height}) {
64
+ @content;
65
+ }
66
+ }
67
+
68
+ @else if $min-width !=null and $max-height !=null {
69
+ @container (min-width: #{$min-width}) and (max-height: #{$max-height}) {
70
+ @content;
71
+ }
72
+ }
73
+
74
+ @else if $max-width !=null and $min-height !=null {
75
+ @container (max-width: #{$max-width}) and (min-height: #{$min-height}) {
76
+ @content;
77
+ }
78
+ }
79
+
80
+ @else if $min-width !=null {
81
+ @container (min-width: #{$min-width}) {
82
+ @content;
83
+ }
84
+ }
85
+
86
+ @else if $max-width !=null {
87
+ @container (max-width: #{$max-width}) {
88
+ @content;
89
+ }
90
+ }
91
+
92
+ @else if $min-height !=null {
93
+ @container (min-height: #{$min-height}) {
94
+ @content;
95
+ }
96
+ }
97
+
98
+ @else if $max-height !=null {
99
+ @container (max-height: #{$max-height}) {
100
+ @content;
101
+ }
102
+ }
103
+ }
104
+
105
+ @mixin aspect_container($min-width: null, $max-width: null, $aspect-ratio: 16/9) {
106
+ $min-height: null;
107
+ $max-height: null;
108
+ @if $min-width != null {
109
+ $min-height: $min-width * $aspect-ratio;
110
+ }
111
+ /* @if $max-width != null {
112
+ $max-height: $max-width * $aspect-ratio;
113
+ } */
114
+ @include box_container($min-width, $max-width, $min-height, $max-height) {
115
+ @content;
116
+ };
117
+ }
@@ -0,0 +1,309 @@
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
+ @mixin color-props ($prefixes...) {
33
+ background: var-with-fallbacks(--bg, append($prefixes,white)...);
34
+ color: var-with-fallbacks(--fg, append($prefixes,black)...);
35
+ //text-shadow: var-with-fallbacks(--text-shadow,append($prefixes,#0000));
36
+ }
37
+
38
+ @mixin typography-props ($prefixes...) {
39
+ font-family: var-with-fallbacks(--font-family, append($prefixes, sans-serif)...);
40
+ text-transform: var-with-fallbacks(--text-transform, append($prefixes, none)...);
41
+ text-decoration: var-with-fallbacks(--text-decoration, append($prefixes, none)...);
42
+ font-size: var-with-fallbacks(--font-size, append($prefixes, 16px)...);
43
+ font-weight: var-with-fallbacks(--font-weight, append($prefixes, 400)...);
44
+ line-height: var-with-fallbacks(--line-height, append($prefixes, 1.5)...);
45
+ letter-spacing: var-with-fallbacks(--letter-spacing, append($prefixes, 0.05em)...);
46
+
47
+ }
48
+
49
+ @mixin typography-container-props ($prefixes...) {
50
+ @include typography-props($prefixes...);
51
+ & :global(p),:global(blockquote),:global(dl),:global(ul),:global(ol) {
52
+ max-width: var-with-fallbacks(--line-width, append($prefixes, 40em)...);
53
+ font-family: var-with-fallbacks(--body-font-family, append($prefixes, var(--font-family))...);
54
+ line-height: var-with-fallbacks(--line-height, append($prefixes, 1.5)...);
55
+ margin-left: auto;
56
+ margin-right: auto;
57
+ font-weight: var-with-fallbacks(--body-font-weight, append($prefixes, var(--normal))...);
58
+ }
59
+ & :global(h1),
60
+ :global(h2),
61
+ :global(h3),
62
+ :global(h4),
63
+ :global(h5),
64
+ :global(h6) {
65
+ max-width: var-with-fallbacks(--line-width, append($prefixes, 40em)...);
66
+ font-family: var-with-fallbacks(--heading-font-family, append($prefixes, var(--font-family))...);
67
+ line-height: var-with-fallbacks(--heading-line-height, append($prefixes, var(--line-height))...);
68
+ margin-left: auto;
69
+ margin-right: auto;
70
+ color: var(--heading-color,append($prefixes,var(--fg))...);
71
+ font-weight: var(--heading-font-weight,append($prefixes,var(--bold)));
72
+ }
73
+ }
74
+
75
+ @mixin padding-props ($prefixes...) {
76
+ padding: var-with-fallbacks(--padding, append($prefixes, 4px)...);
77
+ }
78
+
79
+ @mixin border-props-border ($prefixes...) {
80
+ border: var-with-fallbacks(
81
+ --border,
82
+ append(
83
+ $prefixes,
84
+ var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg))
85
+ )...);
86
+ $directions: (
87
+ top,
88
+ right,
89
+ bottom,
90
+ left
91
+ );
92
+ $rectProps : (border);
93
+
94
+ // Loop through each direction
95
+ @each $dir in $directions {
96
+ // Apply prop for each direction
97
+ @each $p in $rectProps {
98
+ #{$p}-#{$dir}: var-with-fallbacks(--#{$p}-#{$dir},
99
+ append($prefixes,
100
+ var-with-fallbacks(--border,$prefixes...)
101
+ )...)
102
+ }
103
+ }
104
+ }
105
+ @mixin border-props-none ($prefixes...) {
106
+ border: var-with-fallbacks(--border, append($prefixes,none)...);
107
+ $directions: (
108
+ top,
109
+ right,
110
+ bottom,
111
+ left
112
+ );
113
+ $rectProps : (border);
114
+
115
+ // Loop through each direction
116
+ @each $dir in $directions {
117
+
118
+ // Apply prop for each direction
119
+ @each $p in $rectProps {
120
+ #{$p}-#{$dir}: var-with-fallbacks(--#{$p}-#{$dir},
121
+ append($prefixes,
122
+ var-with-fallbacks(--border,append($prefixes,none)...)
123
+ )...);
124
+ }
125
+ }
126
+ }
127
+
128
+ @mixin box-props-square-border($prefixes...) {
129
+ box-sizing: border-box;
130
+
131
+ @include border-props-border($prefixes...);
132
+ @include padding-props($prefixes...);
133
+ border-radius: var-with-fallbacks(--square-radius, append($prefixes, 0)...);
134
+ }
135
+
136
+ @mixin box-props-square($prefixes...) {
137
+ box-sizing: border-box;
138
+ @include border-props-none($prefixes...);
139
+ @include padding-props($prefixes...);
140
+ border-radius: var-with-fallbacks(--square-radius, append($prefixes, 0)...);
141
+ }
142
+
143
+ @mixin box-props($prefixes...) {
144
+ // Using the var-with-fallbacks function for each property
145
+ box-sizing: border-box;
146
+ @include padding-props($prefixes...);
147
+ @include border-props-none($prefixes...);
148
+ border-radius: var-with-fallbacks(--border-radius, append($prefixes,none)...);
149
+ }
150
+
151
+ @mixin box-props-border($prefixes...) {
152
+ box-sizing: border-box;
153
+ @include border-props-border($prefixes..., var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg)));
154
+ @include padding-props($prefixes...);
155
+ border-radius: var-with-fallbacks(--radius, append($prefixes, 0)...);
156
+ }
157
+
158
+ @mixin box-props-bottom ($prefixes...) {
159
+ // Using the var-with-fallbacks function for each property
160
+ box-sizing: border-box;
161
+ @include padding-props($prefixes...);
162
+ @include border-props-none($prefixes...);
163
+ border-bottom-right-radius: var-with-fallbacks(--border-radius, $prefixes...);
164
+ border-bottom-left-radius: var-with-fallbacks(--border-radius, $prefixes...);
165
+ }
166
+ @mixin box-props-top ($prefixes...) {
167
+ // Using the var-with-fallbacks function for each property
168
+ box-sizing: border-box;
169
+ @include padding-props($prefixes...);
170
+ @include border-props-none($prefixes...);
171
+ border-top-right-radius: var-with-fallbacks(--border-radius, $prefixes...);
172
+ border-top-left-radius: var-with-fallbacks(--border-radius, $prefixes...);
173
+ }
174
+
175
+ @mixin box-shadow($prefixes...) {
176
+ //works:
177
+ $shadow-distance: var-with-fallbacks(--shadow-distance, append($prefixes, var(--space-md))...);
178
+ $shadow-blur: var-with-fallbacks(--shadow-blur, append($prefixes, var(--space))...);
179
+ $shadow-color: var-with-fallbacks(--shadow-color, append($prefixes, rgba(127, 127, 127, 0.4))...);
180
+
181
+ box-shadow: $shadow-distance $shadow-distance $shadow-blur $shadow-color;
182
+ }
183
+
184
+ @mixin clickable($prefixes...) {
185
+ cursor: pointer;
186
+ transition: filter,transform var-with-fallbacks(--transition,button,control,300ms);
187
+ &:hover {
188
+ filter: var-with-fallbacks(--hover-filter, append($prefixes, brightness(1.1))...);
189
+ transform: var-with-fallbacks(--hover-transform, append($prefixes, none)...);
190
+ }
191
+ &:active {
192
+ filter: var-with-fallbacks(--hover-filter, append($prefixes, brightness(0.9))...);
193
+ transform: var-with-fallbacks(--hover-transform, append($prefixes, translate(var(--space),var(--space)))...);
194
+ }
195
+ }
196
+
197
+ @mixin custom-scrollbar($prefixes...) {
198
+ overflow-y: auto;
199
+
200
+ // Customizing the scrollbar
201
+ &::-webkit-scrollbar {
202
+ width: var-with-fallbacks(--scrollbar-width, append($prefixes, var(--space-md))...);
203
+ height: var-with-fallbacks(--scrollbar-height, append($prefixes, var(--gap))...);
204
+ }
205
+
206
+ &::-webkit-scrollbar-track {
207
+ background: var-with-fallbacks(--scrollbar-track-bg, append($prefixes, var(--bg))...);
208
+ }
209
+
210
+ &::-webkit-scrollbar-thumb {
211
+ background: var-with-fallbacks(--scrollbar-thumb-bg, append($prefixes, var(--stripe-bg))...);
212
+
213
+ border-radius: var-with-fallbacks(--scrollbar-thumb-radius, append($prefixes, var(--border-radius))...);
214
+
215
+ &:hover {
216
+ background: var-with-fallbacks(--scrollbar-thumb-hover-bg, append($prefixes, var(--secondary-bg))...);
217
+
218
+ }
219
+ }
220
+
221
+ // For Firefox
222
+ scrollbar-width: var-with-fallbacks(--scrollbar-width, append($prefixes, thin)...);
223
+ scrollbar-color: var-with-fallbacks(--scrollbar-thumb-bg, append($prefixes, #888)...) var-with-fallbacks(--scrollbar-track-bg, append($prefixes, var(--border-color))...);
224
+ }
225
+
226
+ /* Convenience groupings */
227
+
228
+ @mixin global-buttons {
229
+ & :global(a),
230
+ & :global(button),
231
+ & :global(input[type="submit"]),
232
+ & :global(.button) {
233
+ @content
234
+ }
235
+ }
236
+ /* Warning: because we define a fallback
237
+ media query, the media query can override the container
238
+ if we stack a bunch of these in a row and aren't thoughtful about the order.
239
+ Put min-width queries *after* max-width queries so that smaller
240
+ container queries don't get their styles overridden by large media queries.
241
+ */
242
+ @mixin responsive-content($max-width: null, $min-width: null, $max-height: null, $min-height: null) {
243
+
244
+ // Max-width and Max-height
245
+ @if $max-width and $max-height {
246
+ @media (max-width: #{$max-width}) and (max-height: #{$max-height}) {
247
+ @content;
248
+ }
249
+
250
+ @container (max-width: #{$max-width}) and (max-height: #{$max-height}) {
251
+ @content;
252
+ }
253
+ }
254
+
255
+ // Max-width only
256
+ @else if $max-width {
257
+ @media (max-width: #{$max-width}) {
258
+ @content;
259
+ }
260
+
261
+ @container (max-width: #{$max-width}) {
262
+ @content;
263
+ }
264
+ }
265
+
266
+ // Max-height only
267
+ @else if $max-height {
268
+ @media (max-height: #{$max-height}) {
269
+ @content;
270
+ }
271
+
272
+ @container (max-height: #{$max-height}) {
273
+ @content;
274
+ }
275
+ }
276
+
277
+ // Min-width and Min-height
278
+ @if $min-width and $min-height {
279
+ @media (min-width: #{$min-width}) and (min-height: #{$min-height}) {
280
+ @content;
281
+ }
282
+
283
+ @container (min-width: #{$min-width}) and (min-height: #{$min-height}) {
284
+ @content;
285
+ }
286
+ }
287
+
288
+ // Min-width only
289
+ @else if $min-width {
290
+ @media (min-width: #{$min-width}) {
291
+ @content;
292
+ }
293
+
294
+ @container (min-width: #{$min-width}) {
295
+ @content;
296
+ }
297
+ }
298
+
299
+ // Min-height only
300
+ @else if $min-height {
301
+ @media (min-height: #{$min-height}) {
302
+ @content;
303
+ }
304
+
305
+ @container (min-height: #{$min-height}) {
306
+ @content;
307
+ }
308
+ }
309
+ }