@stackific/md3 0.1.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 (116) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +17 -0
  3. package/README.md +316 -0
  4. package/THIRD-PARTY-NOTICES +40 -0
  5. package/dist/fonts/material-symbols-outlined.woff2 +0 -0
  6. package/dist/fonts/material-symbols-rounded.woff2 +0 -0
  7. package/dist/fonts/material-symbols-sharp.woff2 +0 -0
  8. package/dist/fonts/material-symbols-subset.woff2 +0 -0
  9. package/dist/md3.css +1 -0
  10. package/dist/md3.js +621 -0
  11. package/dist/shapes/arch.svg +1 -0
  12. package/dist/shapes/arrow.svg +1 -0
  13. package/dist/shapes/boom.svg +1 -0
  14. package/dist/shapes/bun.svg +1 -0
  15. package/dist/shapes/burst.svg +1 -0
  16. package/dist/shapes/circle.svg +1 -0
  17. package/dist/shapes/clamshell.svg +1 -0
  18. package/dist/shapes/diamond.svg +1 -0
  19. package/dist/shapes/fan.svg +1 -0
  20. package/dist/shapes/flower.svg +1 -0
  21. package/dist/shapes/gem.svg +1 -0
  22. package/dist/shapes/ghost-ish.svg +1 -0
  23. package/dist/shapes/heart.svg +1 -0
  24. package/dist/shapes/leaf-clover4.svg +1 -0
  25. package/dist/shapes/leaf-clover8.svg +1 -0
  26. package/dist/shapes/loading-indicator.svg +1 -0
  27. package/dist/shapes/oval.svg +1 -0
  28. package/dist/shapes/pentagon.svg +1 -0
  29. package/dist/shapes/pill.svg +1 -0
  30. package/dist/shapes/pixel-circle.svg +1 -0
  31. package/dist/shapes/pixel-triangle.svg +1 -0
  32. package/dist/shapes/puffy-diamond.svg +1 -0
  33. package/dist/shapes/puffy.svg +1 -0
  34. package/dist/shapes/semicircle.svg +1 -0
  35. package/dist/shapes/sided-cookie12.svg +1 -0
  36. package/dist/shapes/sided-cookie4.svg +1 -0
  37. package/dist/shapes/sided-cookie6.svg +1 -0
  38. package/dist/shapes/sided-cookie7.svg +1 -0
  39. package/dist/shapes/sided-cookie9.svg +1 -0
  40. package/dist/shapes/slanted.svg +1 -0
  41. package/dist/shapes/soft-boom.svg +1 -0
  42. package/dist/shapes/soft-burst.svg +1 -0
  43. package/dist/shapes/square.svg +1 -0
  44. package/dist/shapes/sunny.svg +1 -0
  45. package/dist/shapes/triangle.svg +1 -0
  46. package/dist/shapes/very-sunny.svg +1 -0
  47. package/dist/shapes/wavy-circle.svg +1 -0
  48. package/dist/shapes/wavy.svg +1 -0
  49. package/package.json +63 -0
  50. package/src/main.js +5 -0
  51. package/src/runtime/elements/dialogs.js +72 -0
  52. package/src/runtime/elements/fields.js +181 -0
  53. package/src/runtime/elements/menus.js +42 -0
  54. package/src/runtime/elements/pages.js +7 -0
  55. package/src/runtime/elements/progress.js +35 -0
  56. package/src/runtime/elements/sliders.js +78 -0
  57. package/src/runtime/elements/snackbars.js +27 -0
  58. package/src/runtime/helpers/ripples.js +46 -0
  59. package/src/runtime/md3.js +141 -0
  60. package/src/runtime/palette.js +64 -0
  61. package/src/runtime/settings/theme.js +194 -0
  62. package/src/runtime/utils.js +165 -0
  63. package/src/styles/_config.scss +142 -0
  64. package/src/styles/_mixins.scss +80 -0
  65. package/src/styles/elements/_badges.scss +65 -0
  66. package/src/styles/elements/_bars.scss +83 -0
  67. package/src/styles/elements/_buttons.scss +119 -0
  68. package/src/styles/elements/_cards.scss +32 -0
  69. package/src/styles/elements/_chips.scss +46 -0
  70. package/src/styles/elements/_dialogs.scss +143 -0
  71. package/src/styles/elements/_dividers.scss +46 -0
  72. package/src/styles/elements/_expansions.scss +19 -0
  73. package/src/styles/elements/_fields.scss +458 -0
  74. package/src/styles/elements/_grids.scss +35 -0
  75. package/src/styles/elements/_icons.scss +70 -0
  76. package/src/styles/elements/_layouts.scss +24 -0
  77. package/src/styles/elements/_lists.scss +76 -0
  78. package/src/styles/elements/_main-layouts.scss +45 -0
  79. package/src/styles/elements/_media.scss +104 -0
  80. package/src/styles/elements/_menus.scss +289 -0
  81. package/src/styles/elements/_navigations.scss +450 -0
  82. package/src/styles/elements/_overlays.scss +34 -0
  83. package/src/styles/elements/_pages.scss +28 -0
  84. package/src/styles/elements/_progress.scss +141 -0
  85. package/src/styles/elements/_selections.scss +248 -0
  86. package/src/styles/elements/_shapes.scss +151 -0
  87. package/src/styles/elements/_sliders.scss +336 -0
  88. package/src/styles/elements/_snackbars.scss +44 -0
  89. package/src/styles/elements/_tables.scss +67 -0
  90. package/src/styles/elements/_tabs.scss +49 -0
  91. package/src/styles/elements/_tooltips.scss +125 -0
  92. package/src/styles/helpers/_alignments.scss +29 -0
  93. package/src/styles/helpers/_blurs.scss +26 -0
  94. package/src/styles/helpers/_colors.scss +39 -0
  95. package/src/styles/helpers/_directions.scss +30 -0
  96. package/src/styles/helpers/_elevates.scss +20 -0
  97. package/src/styles/helpers/_forms.scss +76 -0
  98. package/src/styles/helpers/_margins.scss +39 -0
  99. package/src/styles/helpers/_opacities.scss +18 -0
  100. package/src/styles/helpers/_paddings.scss +35 -0
  101. package/src/styles/helpers/_positions.scss +44 -0
  102. package/src/styles/helpers/_responsive.scss +24 -0
  103. package/src/styles/helpers/_ripples.scss +40 -0
  104. package/src/styles/helpers/_scrolls.scss +7 -0
  105. package/src/styles/helpers/_shadows.scss +22 -0
  106. package/src/styles/helpers/_sizes.scss +34 -0
  107. package/src/styles/helpers/_spaces.scss +22 -0
  108. package/src/styles/helpers/_typography.scss +132 -0
  109. package/src/styles/helpers/_waves.scss +52 -0
  110. package/src/styles/helpers/_zoom.scss +18 -0
  111. package/src/styles/md3.scss +61 -0
  112. package/src/styles/settings/_fonts.scss +42 -0
  113. package/src/styles/settings/_globals.scss +104 -0
  114. package/src/styles/settings/_reset.scss +82 -0
  115. package/src/styles/settings/_theme.scss +126 -0
  116. package/src/styles/settings/_themes.scss +1525 -0
@@ -0,0 +1,248 @@
1
+ // .checkbox / .radio / .switch — all three share size-scaling and focus/hover ripples.
2
+
3
+ .checkbox,
4
+ .radio,
5
+ .switch {
6
+ --_size: 1.5rem;
7
+ inline-size: auto;
8
+ block-size: auto;
9
+ line-height: normal;
10
+ white-space: nowrap;
11
+ cursor: pointer;
12
+ display: inline-flex;
13
+ align-items: center;
14
+ }
15
+
16
+ .switch {
17
+ direction: ltr;
18
+ }
19
+
20
+ $-selection-sizes: (
21
+ "small": 1rem,
22
+ "large": 2rem,
23
+ "extra": 2.5rem,
24
+ );
25
+
26
+ @each $name, $value in $-selection-sizes {
27
+ :is(.checkbox, .radio, .switch).#{$name} {
28
+ --_size: #{$value};
29
+ }
30
+ }
31
+
32
+ :is(.checkbox, .radio) > input {
33
+ inline-size: var(--_size);
34
+ block-size: var(--_size);
35
+ opacity: 0;
36
+ }
37
+
38
+ .switch > input {
39
+ inline-size: 3.25rem;
40
+ block-size: 2rem;
41
+ opacity: 0;
42
+ }
43
+
44
+ :is(.checkbox, .radio, .switch) > span {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ color: var(--on-surface);
48
+ font-size: 0.875rem;
49
+ }
50
+
51
+ :is(.checkbox, .radio) > span:not(:empty) {
52
+ padding-inline-start: 0.25rem;
53
+ }
54
+
55
+ :is(.checkbox, .radio, .switch) > span::before,
56
+ :is(.checkbox, .radio, .switch) > span > i,
57
+ :is(.checkbox, .radio) > span::after {
58
+ --_size: inherit;
59
+ content: "";
60
+ inline-size: var(--_size);
61
+ block-size: var(--_size);
62
+ box-sizing: border-box;
63
+ margin: 0 auto;
64
+ outline: none;
65
+ color: var(--primary);
66
+ position: absolute;
67
+ inset: auto auto auto calc(var(--_size, 0) * -1);
68
+ border-radius: 50%;
69
+ user-select: none;
70
+ z-index: 1;
71
+ }
72
+
73
+ [dir="rtl"] :is(.checkbox, .radio) > span::before,
74
+ [dir="rtl"] :is(.checkbox, .radio) > span > i,
75
+ [dir="rtl"] :is(.checkbox, .radio) > span::after {
76
+ --_size: inherit;
77
+ inset: auto calc(var(--_size, 0) * -1) auto auto;
78
+ }
79
+
80
+ .switch > span::before,
81
+ .switch.icon > span > i {
82
+ position: absolute;
83
+ inset: 50% auto auto 0;
84
+ display: inline-flex;
85
+ align-items: center;
86
+ justify-content: center;
87
+ border-radius: 50%;
88
+ transition: all var(--speed2);
89
+ font-size: calc(var(--_size, 0) - 0.5rem);
90
+ user-select: none;
91
+ min-inline-size: var(--_size);
92
+ min-block-size: var(--_size);
93
+ content: "";
94
+ color: var(--surface-variant);
95
+ background-color: var(--outline);
96
+ }
97
+
98
+ .switch > span::before,
99
+ .switch.icon > span > i {
100
+ transform: translate(-3rem, -50%) scale(0.6);
101
+ }
102
+
103
+ .switch.icon > span > i {
104
+ transform: translate(-3rem, -50%) scale(1);
105
+ }
106
+
107
+ // icon glyphs per control
108
+ .checkbox > span::before { content: "check_box_outline_blank"; }
109
+ .checkbox > input:checked + span::before {
110
+ content: "check_box";
111
+ font-variation-settings: "FILL" 1;
112
+ }
113
+ .checkbox > input:indeterminate + span::before { content: "indeterminate_check_box"; }
114
+
115
+ .radio > span::before { content: "radio_button_unchecked"; }
116
+ .radio > input:checked + span::before { content: "radio_button_checked"; }
117
+
118
+ :is(.radio, .checkbox, .switch).icon > span::before {
119
+ content: "" !important;
120
+ font-variation-settings: unset !important;
121
+ }
122
+
123
+ :is(.checkbox, .radio) > span::after {
124
+ transition: all var(--speed1);
125
+ background-color: currentColor;
126
+ box-shadow: 0 0 0 0 currentColor;
127
+ opacity: 0;
128
+ }
129
+
130
+ :is(.checkbox, .radio):is(:hover) > input:not(:disabled) + span::after,
131
+ :is(.checkbox, .radio) > input:not(:disabled):is(:focus) + span::after {
132
+ box-shadow: 0 0 0 0.5rem currentColor;
133
+ opacity: 0.1;
134
+ }
135
+
136
+ .switch > input:not(:disabled):is(:focus, :hover) + span::before,
137
+ .switch.icon > input:not(:disabled):is(:focus, :hover) + span > i {
138
+ box-shadow: 0 0 0 0.5rem var(--active);
139
+ }
140
+
141
+ :is(.checkbox, .radio) > input:checked + span::before,
142
+ :is(.checkbox, .radio).icon > input:checked + span > i {
143
+ color: var(--primary);
144
+ }
145
+
146
+ .icon > input:checked + span > i:first-child,
147
+ .icon > span > i:last-child {
148
+ opacity: 0;
149
+ }
150
+
151
+ .icon > input:checked + span > i:last-child,
152
+ .icon > span > i:first-child {
153
+ opacity: 1;
154
+ }
155
+
156
+ .switch > input:checked + span::after {
157
+ border: none;
158
+ background-color: var(--primary);
159
+ }
160
+
161
+ .switch > input:checked + span::before,
162
+ .switch.icon > input:checked + span > i {
163
+ content: "check";
164
+ color: var(--primary);
165
+ background-color: var(--on-primary);
166
+ transform: translate(-1.75rem, -50%) scale(1);
167
+ }
168
+
169
+ [dir="rtl"] .switch > input:checked + span::before,
170
+ [dir="rtl"] .switch.icon > input:checked + span > i {
171
+ transform: translate(-1.75rem, -50%) scale(-1);
172
+ }
173
+
174
+ .switch > input:active:not(:disabled) + span::before,
175
+ .switch.icon > input:active:not(:disabled) + span > i {
176
+ transform: translate(-3rem, -50%) scale(1.2);
177
+ }
178
+
179
+ [dir="rtl"] .switch > input:active:not(:disabled) + span::before,
180
+ [dir="rtl"] .switch.icon > input:active:not(:disabled) + span > i {
181
+ transform: translate(-3rem, -50%) scale(-1.2);
182
+ }
183
+
184
+ .switch > input:active:checked:not(:disabled) + span::before,
185
+ .switch.icon > input:active:checked:not(:disabled) + span > i {
186
+ transform: translate(-1.75rem, -50%) scale(1.2);
187
+ }
188
+
189
+ [dir="rtl"] .switch > input:active:checked:not(:disabled) + span::before,
190
+ [dir="rtl"] .switch.icon > input:active:checked:not(:disabled) + span > i {
191
+ transform: translate(-1.75rem, -50%) scale(-1.2);
192
+ }
193
+
194
+ :is(.checkbox, .radio, .switch) > input:disabled + span {
195
+ opacity: 0.5;
196
+ cursor: not-allowed;
197
+ }
198
+
199
+ .switch > span::after {
200
+ content: "";
201
+ position: absolute;
202
+ inset: 50% auto auto 0;
203
+ background-color: var(--active);
204
+ border: 0.125rem solid var(--outline);
205
+ box-sizing: border-box;
206
+ inline-size: 3.25rem;
207
+ block-size: 2rem;
208
+ border-radius: 2rem;
209
+ transform: translate(-3.25rem, -50%);
210
+ }
211
+
212
+ .field > :is(nav, .row) {
213
+ flex-grow: 1;
214
+ padding: 0 1rem;
215
+ }
216
+
217
+ .field.round > :is(nav, .row) {
218
+ flex-grow: 1;
219
+ padding: 0 1.5rem;
220
+ }
221
+
222
+ [dir="rtl"] .switch {
223
+ transform: scale(-1);
224
+ }
225
+
226
+ [dir="rtl"] .switch > span::before,
227
+ [dir="rtl"] .switch.icon > span > i {
228
+ transform: translate(-3rem, -50%) scale(-0.6);
229
+ }
230
+
231
+ [dir="rtl"] .switch.icon > span > i {
232
+ transform: translate(-3rem, -50%) scale(-1);
233
+ }
234
+
235
+ [dir="rtl"] .switch > input:checked + span::before,
236
+ [dir="rtl"] .switch.icon > input:checked + span > i {
237
+ transform: translate(-1.75rem, -50%) scale(-1);
238
+ }
239
+
240
+ .switch > :focus-visible + span::after {
241
+ outline: 0.125rem solid var(--primary);
242
+ outline-offset: 0.25rem;
243
+ }
244
+
245
+ :is(.checkbox, .radio) > :focus-visible + span::before {
246
+ outline: 0.125rem solid var(--primary);
247
+ outline-offset: 0.375rem;
248
+ }
@@ -0,0 +1,151 @@
1
+ // .shape — SVG-masked decorative shape. Each variant points at a public/shapes/*.svg.
2
+ // One @each over $-shapes replaces ~40 hand-written mask-image rules in upstream.
3
+
4
+ @use "sass:list";
5
+
6
+ .shape {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ color: var(--on-primary);
11
+ background-color: var(--primary);
12
+ mask-repeat: no-repeat;
13
+ mask-position: center;
14
+ mask-size: contain;
15
+ border-radius: 0;
16
+ block-size: 3.5rem;
17
+ inline-size: 3.5rem;
18
+ margin: 0 !important;
19
+ padding: 0 !important;
20
+ border: 0 !important;
21
+ }
22
+
23
+ .transparent > .shape > i {
24
+ filter: invert(1);
25
+ }
26
+
27
+ $-shape-mask-sizes: (
28
+ "tiny-space": 90%,
29
+ "space": 80%,
30
+ "small-space": 80%,
31
+ "medium-space": 70%,
32
+ "large-space": 60%,
33
+ "extra-space": 50%,
34
+ );
35
+
36
+ @each $name, $value in $-shape-mask-sizes {
37
+ .shape.#{$name} { mask-size: $value; }
38
+ }
39
+
40
+ $-shape-sizes: (
41
+ "tiny": 2.5rem,
42
+ "medium": 4.5rem,
43
+ "large": 5.5rem,
44
+ "extra": 6.5rem,
45
+ );
46
+
47
+ @each $name, $value in $-shape-sizes {
48
+ .shape.#{$name} {
49
+ block-size: $value;
50
+ inline-size: $value;
51
+ }
52
+ }
53
+
54
+ .shape.max,
55
+ .shape > .responsive,
56
+ .shape > .responsive > .responsive {
57
+ position: absolute;
58
+ inset: 0;
59
+ block-size: 100%;
60
+ inline-size: 100%;
61
+ margin: 0 !important;
62
+ padding: 0 !important;
63
+ border: 0 !important;
64
+ }
65
+
66
+ .shape > .responsive {
67
+ background: inherit;
68
+ color: inherit;
69
+ }
70
+
71
+ $-shape-rotations: (
72
+ "": 12s,
73
+ "fast": 6s,
74
+ "slow": 24s,
75
+ );
76
+
77
+ @each $name, $duration in $-shape-rotations {
78
+ @if $name == "" {
79
+ .shape.rotate {
80
+ animation: linear to-rotate infinite #{$duration};
81
+
82
+ > * {
83
+ animation: linear to-rotate infinite #{$duration} reverse;
84
+ }
85
+ }
86
+ } @else {
87
+ .shape.#{$name}-rotate {
88
+ animation: linear to-rotate infinite #{$duration};
89
+
90
+ > * {
91
+ animation: linear to-rotate infinite #{$duration} reverse;
92
+ }
93
+ }
94
+ }
95
+ }
96
+
97
+ :is(button, .button, .chip):has(> .shape) > .responsive {
98
+ border: none;
99
+ }
100
+
101
+ // All shape mask images. Note: `leaft-clover8` is a verbatim typo from upstream
102
+ // (the file is `leaf-clover8.svg`) — preserved for 1:1 class-name parity.
103
+ // Each entry is (class-name, file-stem). They diverge only for "leaft-clover8"
104
+ // → leaf-clover8.svg (verbatim typo from upstream).
105
+ $-shapes: (
106
+ ("arch", "arch"),
107
+ ("arrow", "arrow"),
108
+ ("boom", "boom"),
109
+ ("bun", "bun"),
110
+ ("burst", "burst"),
111
+ ("circle", "circle"),
112
+ ("clamshell", "clamshell"),
113
+ ("diamond", "diamond"),
114
+ ("fan", "fan"),
115
+ ("flower", "flower"),
116
+ ("gem", "gem"),
117
+ ("ghost-ish", "ghost-ish"),
118
+ ("heart", "heart"),
119
+ ("leaf-clover4", "leaf-clover4"),
120
+ ("leaft-clover8", "leaf-clover8"),
121
+ ("loading-indicator", "loading-indicator"),
122
+ ("oval", "oval"),
123
+ ("pentagon", "pentagon"),
124
+ ("pill", "pill"),
125
+ ("pixel-circle", "pixel-circle"),
126
+ ("pixel-triangle", "pixel-triangle"),
127
+ ("puffy", "puffy"),
128
+ ("puffy-diamond", "puffy-diamond"),
129
+ ("semicircle", "semicircle"),
130
+ ("sided-cookie4", "sided-cookie4"),
131
+ ("sided-cookie6", "sided-cookie6"),
132
+ ("sided-cookie7", "sided-cookie7"),
133
+ ("sided-cookie9", "sided-cookie9"),
134
+ ("sided-cookie12", "sided-cookie12"),
135
+ ("slanted", "slanted"),
136
+ ("soft-boom", "soft-boom"),
137
+ ("soft-burst", "soft-burst"),
138
+ ("square", "square"),
139
+ ("sunny", "sunny"),
140
+ ("triangle", "triangle"),
141
+ ("very-sunny", "very-sunny"),
142
+ );
143
+
144
+ @each $entry in $-shapes {
145
+ $class: list.nth($entry, 1);
146
+ $file: list.nth($entry, 2);
147
+
148
+ .shape.#{$class} {
149
+ mask-image: url("/shapes/#{$file}.svg");
150
+ }
151
+ }