contain-css-svelte 0.0.13 → 0.0.14

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 (44) 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/layout/Bar.svelte +2 -2
  12. package/dist/layout/Column.svelte +3 -3
  13. package/dist/layout/Columns.svelte +2 -2
  14. package/dist/layout/Container.svelte +46 -26
  15. package/dist/layout/FormItem.svelte +2 -2
  16. package/dist/layout/GridLayout.svelte +2 -2
  17. package/dist/layout/Hero.svelte +46 -26
  18. package/dist/layout/MenuList.svelte +8 -2
  19. package/dist/layout/Page.svelte +2 -2
  20. package/dist/layout/Row.svelte +2 -2
  21. package/dist/layout/Sidebar.svelte +6 -1
  22. package/dist/layout/SplitPane.svelte +2 -2
  23. package/dist/layout/TabBar.svelte +2 -2
  24. package/dist/layout/Tile.svelte +59 -33
  25. package/dist/misc/CodeInner.svelte +2 -109
  26. package/dist/misc/Progress.svelte +288 -0
  27. package/dist/misc/Progress.svelte.d.ts +28 -0
  28. package/dist/overlays/Dialog.svelte +2 -2
  29. package/dist/overlays/Tooltip.svelte +54 -34
  30. package/dist/sass/_affordances.scss +51 -0
  31. package/dist/sass/_box.scss +112 -0
  32. package/dist/sass/_color.scss +8 -0
  33. package/dist/sass/_functions.scss +113 -0
  34. package/dist/sass/_mixins.scss +6 -418
  35. package/dist/sass/_responsive.scss +75 -0
  36. package/dist/sass/_typography.scss +116 -0
  37. package/dist/typography/TextLayout.svelte +46 -26
  38. package/dist/vars/affordances.css +6 -1
  39. package/dist/vars/colors.css +1 -0
  40. package/dist/vars/defaults.css +7 -1
  41. package/dist/vars/themes/typography-airy.css +1 -1
  42. package/dist/vars/themes/typography-browser.css +1 -1
  43. package/dist/vars/themes/typography-carbon.css +1 -1
  44. package/package.json +3 -3
@@ -0,0 +1,51 @@
1
+
2
+ @use 'functions' as fn;
3
+
4
+ @mixin clickable($prefixes...) {
5
+ cursor: fn.var-with-fallbacks(--cursor,append($prefixes, pointer)...);
6
+ transition: filter,transform fn.var-with-fallbacks(--transition,append($prefixes,300ms)...);
7
+ &:hover {
8
+ filter: fn.var-with-fallbacks(--hover-filter, append($prefixes, brightness(1.4))...);
9
+ transform: fn.var-with-fallbacks(--hover-transform, append($prefixes, none)...);
10
+
11
+ }
12
+ &:active {
13
+ filter: fn.var-with-fallbacks(--active-filter, append($prefixes, brightness(0.9))...);
14
+ transform: fn.var-with-fallbacks(--active-transform, append($prefixes, none)...);
15
+ }
16
+ &:disabled {
17
+ cursor: fn.var-with-fallbacks(--disabled-cursor, append($prefixes, not-allowed)...);
18
+ transform: fn.var-with-fallbacks(--disabled-transform, append($prefixes, none)...);
19
+ filter: fn.var-with-fallbacks(--disabled-filter, append($prefixes, grayscale(0.5))...);
20
+ }
21
+ }
22
+
23
+ @mixin custom-scrollbar($prefixes...) {
24
+ overflow-y: auto;
25
+
26
+ // Customizing the scrollbar
27
+ &::-webkit-scrollbar {
28
+ width: fn.var-with-fallbacks(--scrollbar-width, append($prefixes, var(--space-md))...);
29
+ height: fn.var-with-fallbacks(--scrollbar-height, append($prefixes, var(--gap))...);
30
+ }
31
+
32
+ &::-webkit-scrollbar-track {
33
+ background: fn.var-with-fallbacks(--scrollbar-track-bg, append($prefixes, var(--bg))...);
34
+ }
35
+
36
+ &::-webkit-scrollbar-thumb {
37
+ background: fn.var-with-fallbacks(--scrollbar-thumb-bg, append($prefixes, var(--stripe-bg))...);
38
+
39
+ border-radius: fn.var-with-fallbacks(--scrollbar-thumb-radius, append($prefixes, var(--border-radius))...);
40
+
41
+ &:hover {
42
+ background: fn.var-with-fallbacks(--scrollbar-thumb-hover-bg, append($prefixes, var(--secondary-bg))...);
43
+
44
+ }
45
+ }
46
+
47
+ // For Firefox
48
+ scrollbar-width: fn.var-with-fallbacks(--scrollbar-width, append($prefixes, thin)...);
49
+ scrollbar-color: fn.var-with-fallbacks(--scrollbar-thumb-bg, append($prefixes, #888)...) fn.var-with-fallbacks(--scrollbar-track-bg, append($prefixes, var(--border-color))...);
50
+ }
51
+
@@ -0,0 +1,112 @@
1
+
2
+ @use 'functions' as fn;
3
+
4
+ @mixin padding-props ($prefixes...) {
5
+ padding: fn.var-with-fallbacks(--padding, append($prefixes, 4px)...);
6
+ }
7
+
8
+ @mixin border-props-border ($prefixes...) {
9
+ border: fn.var-with-fallbacks(
10
+ --border,
11
+ append(
12
+ $prefixes,
13
+ var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg))
14
+ )...);
15
+ $directions: (
16
+ top,
17
+ right,
18
+ bottom,
19
+ left
20
+ );
21
+ $rectProps : (border);
22
+
23
+ // Loop through each direction
24
+ @each $dir in $directions {
25
+ // Apply prop for each direction
26
+ @each $p in $rectProps {
27
+ /* #{$p}-#{$dir}: fn.var-with-fallbacks(--#{$p}-#{$dir},
28
+ append($prefixes,
29
+ fn.var-with-fallbacks(--border,$prefixes...)
30
+ )...) */
31
+ }
32
+ }
33
+ }
34
+ @mixin border-props-none ($prefixes...) {
35
+ border: fn.var-with-fallbacks(--border, append($prefixes,inherit)...);
36
+ $directions: (
37
+ top,
38
+ right,
39
+ bottom,
40
+ left
41
+ );
42
+ $rectProps : (border);
43
+
44
+ // Loop through each direction
45
+ @each $dir in $directions {
46
+
47
+ // Apply prop for each direction
48
+ @each $p in $rectProps {
49
+ #{$p}-#{$dir}: fn.var-with-fallbacks(--#{$p}-#{$dir},
50
+ append($prefixes,
51
+ fn.var-with-fallbacks(--border,append($prefixes,none)...)
52
+ )...);
53
+ }
54
+ }
55
+ }
56
+
57
+ @mixin box-props-square-border($prefixes...) {
58
+ box-sizing: border-box;
59
+
60
+ @include border-props-border($prefixes...);
61
+ @include padding-props($prefixes...);
62
+ border-radius: fn.var-with-fallbacks(--square-radius, append($prefixes, 0)...);
63
+ }
64
+
65
+ @mixin box-props-square($prefixes...) {
66
+ box-sizing: border-box;
67
+ @include border-props-none($prefixes...);
68
+ @include padding-props($prefixes...);
69
+ border-radius: fn.var-with-fallbacks(--square-radius, append($prefixes, 0)...);
70
+ }
71
+
72
+ @mixin box-props($prefixes...) {
73
+ // Using the fn.var-with-fallbacks function for each property
74
+ box-sizing: border-box;
75
+ @include padding-props($prefixes...);
76
+ @include border-props-none($prefixes...);
77
+ border-radius: fn.var-with-fallbacks(--border-radius, append($prefixes,none)...);
78
+ }
79
+
80
+ @mixin box-props-border($prefixes...) {
81
+ box-sizing: border-box;
82
+ @include border-props-border($prefixes..., var(--border-width, 1px) var(--border-style, solid) var(--border-color, var(--fg)));
83
+ @include padding-props($prefixes...);
84
+ border-radius: fn.var-with-fallbacks(--radius, append($prefixes, 0)...);
85
+ }
86
+
87
+ @mixin box-props-bottom ($prefixes...) {
88
+ // Using the fn.var-with-fallbacks function for each property
89
+ box-sizing: border-box;
90
+ @include padding-props($prefixes...);
91
+ @include border-props-none($prefixes...);
92
+ border-bottom-right-radius: fn.var-with-fallbacks(--border-radius, $prefixes...);
93
+ border-bottom-left-radius: fn.var-with-fallbacks(--border-radius, $prefixes...);
94
+ }
95
+ @mixin box-props-top ($prefixes...) {
96
+ // Using the fn.var-with-fallbacks function for each property
97
+ box-sizing: border-box;
98
+ @include padding-props($prefixes...);
99
+ @include border-props-none($prefixes...);
100
+ border-top-right-radius: fn.var-with-fallbacks(--border-radius, $prefixes...);
101
+ border-top-left-radius: fn.var-with-fallbacks(--border-radius, $prefixes...);
102
+ }
103
+
104
+ @mixin box-shadow($prefixes...) {
105
+ //works:
106
+ $shadow-distance: fn.var-with-fallbacks(--shadow-distance, append($prefixes, var(--space-md))...);
107
+ $shadow-blur: fn.var-with-fallbacks(--shadow-blur, append($prefixes, var(--space))...);
108
+ $shadow-color: fn.var-with-fallbacks(--shadow-color, append($prefixes, rgba(127, 127, 127, 0.4))...);
109
+
110
+ box-shadow: $shadow-distance $shadow-distance $shadow-blur $shadow-color;
111
+ }
112
+
@@ -0,0 +1,8 @@
1
+ @use 'functions' as fn;
2
+
3
+ @mixin color-props ($prefixes...) {
4
+ background: fn.var-no-fallbacks(--bg, $prefixes...);
5
+ color: fn.var-no-fallbacks(--fg, $prefixes...);
6
+ --link-bg: #{fn.vars(link-bg, $prefixes...)};
7
+ --link-fg: #{fn.vars(link-fg, $prefixes...)};
8
+ }
@@ -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
+ }