@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,42 @@
1
+ // Material Symbols font faces. Each declaration tries the local copy first
2
+ // (resolves against Vite's publicDir for the consuming project), then falls
3
+ // back to a public CDN so the same SCSS works whether it runs inside this
4
+ // repo's demo or inside any consumer's project.
5
+
6
+ $-cdn: "https://cdn.jsdelivr.net/npm/beercss@4.0.21/dist/cdn";
7
+
8
+ @font-face {
9
+ font-family: "Material Symbols Outlined";
10
+ font-style: normal;
11
+ font-weight: 400;
12
+ font-display: swap;
13
+ src: url("/fonts/material-symbols-outlined.woff2") format("woff2"),
14
+ url("#{$-cdn}/material-symbols-outlined.woff2") format("woff2");
15
+ }
16
+
17
+ @font-face {
18
+ font-family: "Material Symbols Rounded";
19
+ font-style: normal;
20
+ font-weight: 400;
21
+ font-display: swap;
22
+ src: url("/fonts/material-symbols-rounded.woff2") format("woff2"),
23
+ url("#{$-cdn}/material-symbols-rounded.woff2") format("woff2");
24
+ }
25
+
26
+ @font-face {
27
+ font-family: "Material Symbols Sharp";
28
+ font-style: normal;
29
+ font-weight: 400;
30
+ font-display: swap;
31
+ src: url("/fonts/material-symbols-sharp.woff2") format("woff2"),
32
+ url("#{$-cdn}/material-symbols-sharp.woff2") format("woff2");
33
+ }
34
+
35
+ @font-face {
36
+ font-family: "Material Symbols Subset";
37
+ font-style: normal;
38
+ font-weight: 400;
39
+ font-display: swap;
40
+ src: url("/fonts/material-symbols-subset.woff2") format("woff2"),
41
+ url("#{$-cdn}/material-symbols-subset.woff2") format("woff2");
42
+ }
@@ -0,0 +1,104 @@
1
+ // Root custom-properties, base typography, scrollbar, keyframes.
2
+
3
+ :root {
4
+ --size: 1rem;
5
+ --font: Inter, Roboto, "Helvetica Neue", "Arial Nova", "Nimbus Sans", "Noto Sans", Arial, sans-serif;
6
+ --font-icon: "Material Symbols Outlined";
7
+ --speed1: 0.1s;
8
+ --speed2: 0.2s;
9
+ --speed3: 0.3s;
10
+ --speed4: 0.4s;
11
+ --active: rgb(128 128 128 / 0.192);
12
+ --overlay: rgb(0 0 0 / 0.5);
13
+ --elevate1: 0 0.125rem 0.125rem 0 rgb(0 0 0 / 0.32);
14
+ --elevate2: 0 0.25rem 0.5rem 0 rgb(0 0 0 / 0.4);
15
+ --elevate3: 0 0.375rem 0.75rem 0 rgb(0 0 0 / 0.48);
16
+ --top: env(safe-area-inset-top);
17
+ --bottom: env(safe-area-inset-bottom);
18
+ --left: env(safe-area-inset-left);
19
+ --right: env(safe-area-inset-right);
20
+ --image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4AWJiYGAQBgAAAP//ZyYa+wAAAAZJREFUAwAAIgAWeX9MsQAAAABJRU5ErkJggg==);
21
+ }
22
+
23
+ :root[data-mode="dark"] {
24
+ --image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4AWL6//+/FAAAAP//qSv5QwAAAAZJREFUAwAJIAMaJWjIvQAAAABJRU5ErkJggg==);
25
+ }
26
+
27
+ @media (prefers-color-scheme: dark) {
28
+ :root[data-mode="auto"] {
29
+ --image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4AWL6//+/FAAAAP//qSv5QwAAAAZJREFUAwAJIAMaJWjIvQAAAABJRU5ErkJggg==);
30
+ }
31
+ }
32
+
33
+ html {
34
+ font-size: var(--size);
35
+ }
36
+
37
+ body {
38
+ color: var(--on-surface);
39
+ background-color: var(--surface);
40
+ overflow-x: hidden;
41
+ font-family: var(--font);
42
+ font-size: 0.875rem;
43
+ line-height: 1.5rem;
44
+ letter-spacing: 0.0313rem;
45
+ }
46
+
47
+ @media (pointer: fine) {
48
+ body ::-webkit-scrollbar,
49
+ body ::-webkit-scrollbar-thumb,
50
+ body ::-webkit-scrollbar-button {
51
+ background: none;
52
+ inline-size: 0.4rem;
53
+ block-size: 0.4rem;
54
+ }
55
+
56
+ body :is(:focus, :hover)::-webkit-scrollbar-thumb,
57
+ body :has(:focus, :hover)::-webkit-scrollbar-thumb {
58
+ background: var(--outline);
59
+ border-radius: 1rem;
60
+ }
61
+ }
62
+
63
+ @media (pointer: coarse) {
64
+ body:has(dialog[open], dialog.active),
65
+ body:has(input[type="range"]:focus) {
66
+ overflow: hidden;
67
+ }
68
+ }
69
+
70
+ @keyframes to-page {
71
+ from {
72
+ opacity: 0;
73
+ transform: var(--_transform);
74
+ }
75
+
76
+ to {
77
+ opacity: 1;
78
+ transform: translate(0, 0);
79
+ }
80
+ }
81
+
82
+ @keyframes to-linear-progress {
83
+ 0% { margin: 0 0 0 -100%; }
84
+ 50% { margin: 0 0 0 0; }
85
+ 100% { margin: 0 0 0 100%; }
86
+ }
87
+
88
+ @keyframes to-indeterminate-progress {
89
+ 0% { padding: 0 100% 0 0; }
90
+ 50% { padding: 0 0 0 0; }
91
+ 100% { padding: 0 0 0 100%; }
92
+ }
93
+
94
+ @keyframes to-rotate {
95
+ from { transform: rotate(0deg); }
96
+ to { transform: rotate(360deg); }
97
+ }
98
+
99
+ @keyframes to-ripple {
100
+ to {
101
+ transform: scale(4);
102
+ opacity: 0;
103
+ }
104
+ }
@@ -0,0 +1,82 @@
1
+ // Tag-level resets and shared focus / cursor behavior.
2
+
3
+ * {
4
+ -webkit-tap-highlight-color: transparent;
5
+ position: relative;
6
+ vertical-align: middle;
7
+ color: inherit;
8
+ margin: 0;
9
+ padding: 0;
10
+ border-radius: inherit;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ *::after,
15
+ *::before {
16
+ all: unset;
17
+ }
18
+
19
+ label {
20
+ font-size: 0.75rem;
21
+ vertical-align: baseline;
22
+ }
23
+
24
+ a,
25
+ b,
26
+ i,
27
+ span,
28
+ strong,
29
+ em,
30
+ code {
31
+ vertical-align: baseline;
32
+ }
33
+
34
+ a,
35
+ button,
36
+ .button {
37
+ cursor: pointer;
38
+ text-decoration: none;
39
+ display: inline-flex;
40
+ align-items: center;
41
+ border: none;
42
+ font-family: inherit;
43
+ outline: inherit;
44
+ justify-content: center;
45
+ }
46
+
47
+ :is(nav, .tabs, .field) > a,
48
+ button,
49
+ .button,
50
+ .chip,
51
+ i,
52
+ label {
53
+ user-select: none;
54
+ }
55
+
56
+ :not(.grid, nav, .row) > :not(progress.max) + :is(
57
+ address, article, blockquote, code, .field, fieldset, form, .grid,
58
+ h1, h2, h3, h4, h5, h6, nav, ol, p, pre, .row, section, aside, table, .tabs, ul
59
+ ):not([class*="margin"], .right, .left, .top, .bottom) {
60
+ margin-block-start: 1rem;
61
+ }
62
+
63
+ :has(> [class*="margin"]) {
64
+ padding: 0.1px;
65
+ }
66
+
67
+ :is(a, button, .button, .chip, summary):focus-visible {
68
+ outline: 0.125rem solid var(--primary);
69
+ outline-offset: 0.25rem;
70
+ }
71
+
72
+ :is(nav, .row, li).group > :focus-visible {
73
+ z-index: 1;
74
+ }
75
+
76
+ :is(button, .button, .chip) > :is(span, i, img, svg) {
77
+ pointer-events: none;
78
+ }
79
+
80
+ :is(div:not([class]), div[class="active"]):has(> :not(.responsive) ~ :is(menu, .tooltip, input)) {
81
+ display: inline-flex;
82
+ }
@@ -0,0 +1,126 @@
1
+ // Semantic colour utilities driven by M3 roles. Looped so the
2
+ // six paired roles, four container variants, and seven surface tonal
3
+ // stops share one definition each.
4
+
5
+ @use "sass:list";
6
+ @use "../config" as *;
7
+
8
+ .transparent {
9
+ background-color: transparent !important;
10
+ box-shadow: none !important;
11
+ color: inherit !important;
12
+ }
13
+
14
+ // .primary, .secondary, .tertiary, .error, .background → bg + on-bg text
15
+ @each $role in $theme-roles-paired {
16
+ .#{$role} { @include paired-color($role); }
17
+ }
18
+
19
+ // -text and -border emitted only for primary/secondary/tertiary/error
20
+ // (upstream omits .background-text / .background-border).
21
+ @each $role in $theme-roles-with-edges {
22
+ .#{$role}-text { @include text-color($role); }
23
+ .#{$role}-border { @include border-color($role); }
24
+ }
25
+
26
+ // .primary-container, .secondary-container, .tertiary-container, .error-container
27
+ @each $role in $theme-roles-container {
28
+ .#{$role}-container {
29
+ background-color: var(--#{$role}-container) !important;
30
+ color: var(--on-#{$role}-container) !important;
31
+ }
32
+ }
33
+
34
+ // Surface umbrella — every tonal stop falls back to surface/on-surface text.
35
+ $-surface-umbrella: ".surface";
36
+ @each $stop in $surface-stops {
37
+ $-surface-umbrella: "#{$-surface-umbrella}, .#{$stop}" !global;
38
+ }
39
+
40
+ #{$-surface-umbrella} {
41
+ background-color: var(--surface) !important;
42
+ color: var(--on-surface) !important;
43
+ }
44
+
45
+ .surface-variant {
46
+ background-color: var(--surface-variant) !important;
47
+ color: var(--on-surface-variant) !important;
48
+ }
49
+
50
+ .inverse-surface {
51
+ background-color: var(--inverse-surface);
52
+ color: var(--inverse-on-surface);
53
+ }
54
+
55
+ .inverse-primary {
56
+ background-color: var(--inverse-primary);
57
+ color: var(--primary);
58
+ }
59
+
60
+ .inverse-primary-text {
61
+ color: var(--inverse-primary) !important;
62
+ }
63
+
64
+ .inverse-primary-border {
65
+ border-color: var(--inverse-primary) !important;
66
+ }
67
+
68
+ // Tonal stops re-bind background (text stays on-surface from the umbrella above).
69
+ @each $stop in $surface-stops {
70
+ .#{$stop} {
71
+ background-color: var(--#{$stop}) !important;
72
+ }
73
+ }
74
+
75
+ .black {
76
+ background-color: #000 !important;
77
+ }
78
+
79
+ .black-border {
80
+ border-color: #000 !important;
81
+ }
82
+
83
+ .black-text {
84
+ color: #000 !important;
85
+ }
86
+
87
+ .white {
88
+ background-color: #fff !important;
89
+ }
90
+
91
+ .white-border {
92
+ border-color: #fff !important;
93
+ }
94
+
95
+ .white-text {
96
+ color: #fff !important;
97
+ }
98
+
99
+ .transparent-border {
100
+ border-color: transparent !important;
101
+ }
102
+
103
+ .transparent-text {
104
+ color: transparent !important;
105
+ }
106
+
107
+ .fill:not(i) {
108
+ background-color: var(--surface-variant) !important;
109
+ color: var(--on-surface-variant) !important;
110
+ }
111
+
112
+ // nav/menu active-state recoloring per container/base role.
113
+ // Upstream emits these only for primary/secondary/tertiary (no error).
114
+ @each $role in $theme-roles-nav-active {
115
+ nav.#{$role}-container > button,
116
+ :is(nav, menu).#{$role} > :is(button, a, li).active {
117
+ background-color: var(--#{$role}-container) !important;
118
+ color: var(--on-#{$role}-container) !important;
119
+ }
120
+
121
+ nav.#{$role} > button,
122
+ :is(nav, menu).#{$role}-container > :is(button, a, li).active {
123
+ background-color: var(--#{$role}) !important;
124
+ color: var(--on-#{$role}) !important;
125
+ }
126
+ }