@stackific/md3 0.1.1 → 0.1.2

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 (111) hide show
  1. package/README.md +0 -43
  2. package/package.json +1 -3
  3. package/src/main.js +0 -5
  4. package/src/runtime/elements/dialogs.js +0 -72
  5. package/src/runtime/elements/fields.js +0 -181
  6. package/src/runtime/elements/menus.js +0 -42
  7. package/src/runtime/elements/pages.js +0 -7
  8. package/src/runtime/elements/progress.js +0 -35
  9. package/src/runtime/elements/sliders.js +0 -78
  10. package/src/runtime/elements/snackbars.js +0 -27
  11. package/src/runtime/helpers/ripples.js +0 -46
  12. package/src/runtime/md3.js +0 -141
  13. package/src/runtime/palette.js +0 -64
  14. package/src/runtime/settings/theme.js +0 -194
  15. package/src/runtime/utils.js +0 -165
  16. package/src/styles/_config.scss +0 -142
  17. package/src/styles/_mixins.scss +0 -80
  18. package/src/styles/elements/_badges.scss +0 -65
  19. package/src/styles/elements/_bars.scss +0 -83
  20. package/src/styles/elements/_buttons.scss +0 -119
  21. package/src/styles/elements/_cards.scss +0 -32
  22. package/src/styles/elements/_chips.scss +0 -46
  23. package/src/styles/elements/_dialogs.scss +0 -143
  24. package/src/styles/elements/_dividers.scss +0 -46
  25. package/src/styles/elements/_expansions.scss +0 -19
  26. package/src/styles/elements/_fields.scss +0 -458
  27. package/src/styles/elements/_grids.scss +0 -35
  28. package/src/styles/elements/_icons.scss +0 -70
  29. package/src/styles/elements/_layouts.scss +0 -24
  30. package/src/styles/elements/_lists.scss +0 -76
  31. package/src/styles/elements/_main-layouts.scss +0 -45
  32. package/src/styles/elements/_media.scss +0 -104
  33. package/src/styles/elements/_menus.scss +0 -289
  34. package/src/styles/elements/_navigations.scss +0 -450
  35. package/src/styles/elements/_overlays.scss +0 -34
  36. package/src/styles/elements/_pages.scss +0 -28
  37. package/src/styles/elements/_progress.scss +0 -141
  38. package/src/styles/elements/_selections.scss +0 -248
  39. package/src/styles/elements/_shapes.scss +0 -153
  40. package/src/styles/elements/_sliders.scss +0 -336
  41. package/src/styles/elements/_snackbars.scss +0 -44
  42. package/src/styles/elements/_tables.scss +0 -67
  43. package/src/styles/elements/_tabs.scss +0 -49
  44. package/src/styles/elements/_tooltips.scss +0 -125
  45. package/src/styles/fonts/material-symbols-outlined.woff2 +0 -0
  46. package/src/styles/fonts/material-symbols-rounded.woff2 +0 -0
  47. package/src/styles/fonts/material-symbols-sharp.woff2 +0 -0
  48. package/src/styles/fonts/material-symbols-subset.woff2 +0 -0
  49. package/src/styles/helpers/_alignments.scss +0 -29
  50. package/src/styles/helpers/_blurs.scss +0 -26
  51. package/src/styles/helpers/_colors.scss +0 -39
  52. package/src/styles/helpers/_directions.scss +0 -30
  53. package/src/styles/helpers/_elevates.scss +0 -20
  54. package/src/styles/helpers/_forms.scss +0 -76
  55. package/src/styles/helpers/_margins.scss +0 -39
  56. package/src/styles/helpers/_opacities.scss +0 -18
  57. package/src/styles/helpers/_paddings.scss +0 -35
  58. package/src/styles/helpers/_positions.scss +0 -44
  59. package/src/styles/helpers/_responsive.scss +0 -24
  60. package/src/styles/helpers/_ripples.scss +0 -40
  61. package/src/styles/helpers/_scrolls.scss +0 -7
  62. package/src/styles/helpers/_shadows.scss +0 -22
  63. package/src/styles/helpers/_sizes.scss +0 -34
  64. package/src/styles/helpers/_spaces.scss +0 -22
  65. package/src/styles/helpers/_typography.scss +0 -132
  66. package/src/styles/helpers/_waves.scss +0 -52
  67. package/src/styles/helpers/_zoom.scss +0 -18
  68. package/src/styles/md3.scss +0 -61
  69. package/src/styles/settings/_fonts.scss +0 -41
  70. package/src/styles/settings/_globals.scss +0 -104
  71. package/src/styles/settings/_reset.scss +0 -82
  72. package/src/styles/settings/_theme.scss +0 -126
  73. package/src/styles/settings/_themes.scss +0 -1525
  74. package/src/styles/shapes/arch.svg +0 -1
  75. package/src/styles/shapes/arrow.svg +0 -1
  76. package/src/styles/shapes/boom.svg +0 -1
  77. package/src/styles/shapes/bun.svg +0 -1
  78. package/src/styles/shapes/burst.svg +0 -1
  79. package/src/styles/shapes/circle.svg +0 -1
  80. package/src/styles/shapes/clamshell.svg +0 -1
  81. package/src/styles/shapes/diamond.svg +0 -1
  82. package/src/styles/shapes/fan.svg +0 -1
  83. package/src/styles/shapes/flower.svg +0 -1
  84. package/src/styles/shapes/gem.svg +0 -1
  85. package/src/styles/shapes/ghost-ish.svg +0 -1
  86. package/src/styles/shapes/heart.svg +0 -1
  87. package/src/styles/shapes/leaf-clover4.svg +0 -1
  88. package/src/styles/shapes/leaf-clover8.svg +0 -1
  89. package/src/styles/shapes/loading-indicator.svg +0 -1
  90. package/src/styles/shapes/oval.svg +0 -1
  91. package/src/styles/shapes/pentagon.svg +0 -1
  92. package/src/styles/shapes/pill.svg +0 -1
  93. package/src/styles/shapes/pixel-circle.svg +0 -1
  94. package/src/styles/shapes/pixel-triangle.svg +0 -1
  95. package/src/styles/shapes/puffy-diamond.svg +0 -1
  96. package/src/styles/shapes/puffy.svg +0 -1
  97. package/src/styles/shapes/semicircle.svg +0 -1
  98. package/src/styles/shapes/sided-cookie12.svg +0 -1
  99. package/src/styles/shapes/sided-cookie4.svg +0 -1
  100. package/src/styles/shapes/sided-cookie6.svg +0 -1
  101. package/src/styles/shapes/sided-cookie7.svg +0 -1
  102. package/src/styles/shapes/sided-cookie9.svg +0 -1
  103. package/src/styles/shapes/slanted.svg +0 -1
  104. package/src/styles/shapes/soft-boom.svg +0 -1
  105. package/src/styles/shapes/soft-burst.svg +0 -1
  106. package/src/styles/shapes/square.svg +0 -1
  107. package/src/styles/shapes/sunny.svg +0 -1
  108. package/src/styles/shapes/triangle.svg +0 -1
  109. package/src/styles/shapes/very-sunny.svg +0 -1
  110. package/src/styles/shapes/wavy-circle.svg +0 -1
  111. package/src/styles/shapes/wavy.svg +0 -1
package/README.md CHANGED
@@ -196,49 +196,6 @@ ui("guid"); // → UUID-v4 string, handy for unique input ids
196
196
 
197
197
  ---
198
198
 
199
- ## Use Sass partials directly
200
-
201
- If you'd rather not ship the full `dist/md3.css`, `@use` only the partials you need:
202
-
203
- ```scss
204
- @use "@stackific/md3/src/styles/config";
205
- @use "@stackific/md3/src/styles/elements/buttons";
206
- @use "@stackific/md3/src/styles/elements/dialogs";
207
- ```
208
-
209
- Each partial depends only on `_config.scss` (plus the `sass:list` / `sass:map` modules). Element partials don't depend on each other, so you can take just buttons + dialogs + grids if that's all you need.
210
-
211
- ### Mixins you can compose
212
-
213
- ```scss
214
- @use "@stackific/md3/src/styles/config" as *;
215
-
216
- .banner-primary {
217
- @include paired-color("primary"); // bg: var(--primary); color: var(--on-primary)
218
- }
219
-
220
- .banner-error-text {
221
- @include text-color("error");
222
- }
223
-
224
- .hero {
225
- padding: 4rem 1rem;
226
- @include breakpoint-up("m") {
227
- padding: 6rem 2rem;
228
- }
229
- }
230
- ```
231
-
232
- | Mixin | Effect |
233
- |---|---|
234
- | `paired-color($role)` | `background-color: var(--$role); color: var(--on-$role)` |
235
- | `text-color($role)` | `color: var(--$role)` |
236
- | `border-color($role)` | `border-color: var(--$role)` |
237
- | `breakpoint-up($name)` | `@media (min-width: …)` from `$breakpoints` |
238
- | `breakpoint-down($name)` | `@media (max-width: …)` |
239
-
240
- ---
241
-
242
199
  ## Local development
243
200
 
244
201
  These commands are for hacking on the framework itself, not for consumers of the published package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackific/md3",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Material Design 3 framework — SCSS + plain-JS. M3 tokens, palette utilities, dialogs, menus, sliders, snackbars; optional runtime theme generation when the consumer brings material-dynamic-colors.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -29,12 +29,10 @@
29
29
  ".": "./dist/md3.js",
30
30
  "./style": "./dist/md3.css",
31
31
  "./assets/*": "./dist/assets/*",
32
- "./src/*": "./src/*",
33
32
  "./package.json": "./package.json"
34
33
  },
35
34
  "files": [
36
35
  "dist",
37
- "src",
38
36
  "NOTICE",
39
37
  "THIRD-PARTY-NOTICES"
40
38
  ],
package/src/main.js DELETED
@@ -1,5 +0,0 @@
1
- // Library entry. Pulls the SCSS bundle (Vite emits md3.css) and boots the
2
- // vanilla-JS runtime, exposing window.ui for inline data-ui handlers.
3
-
4
- import "./styles/md3.scss";
5
- import "./runtime/md3.js";
@@ -1,72 +0,0 @@
1
- import {
2
- addClass, next, prev, hasTag, insertBefore, wait, create,
3
- hasClass, removeClass, on, off, queryAllDataUi, blurActiveElement, query, onWeak,
4
- } from "../utils.js";
5
-
6
- const _dialogs = [];
7
-
8
- function onKeydownDialog(e) {
9
- if (e.key === "Escape") {
10
- const dialog = e.currentTarget;
11
- void updateDialog(dialog, dialog);
12
- }
13
- }
14
-
15
- function focusOnDialogOrElement(dialog) {
16
- const element = query("[autofocus]", dialog) ?? dialog;
17
- element.focus();
18
- }
19
-
20
- function closeDialog(dialog, overlay) {
21
- removeClass(queryAllDataUi(dialog.id), "active");
22
- removeClass(dialog, "active");
23
- removeClass(overlay, "active");
24
-
25
- dialog.close();
26
- _dialogs.pop();
27
-
28
- const previousDialog = _dialogs[_dialogs.length - 1];
29
- if (previousDialog) previousDialog.focus();
30
- }
31
-
32
- async function openDialog(dialog, overlay, isModal, from) {
33
- if (!hasTag(from, "button") && !hasClass(from, "button") && !hasClass(from, "chip")) addClass(from, "active");
34
- addClass(overlay, "active");
35
- addClass(dialog, "active");
36
-
37
- if (isModal) dialog.showModal();
38
- else dialog.show();
39
-
40
- await wait(90);
41
-
42
- if (!isModal) on(dialog, "keydown", onKeydownDialog, false);
43
- _dialogs.push(dialog);
44
- focusOnDialogOrElement(dialog);
45
- }
46
-
47
- function onClickOverlay(e) {
48
- const overlay = e.currentTarget;
49
- const dialog = next(overlay);
50
- if (hasTag(dialog, "dialog")) closeDialog(dialog, overlay);
51
- }
52
-
53
- export async function updateDialog(from, dialog) {
54
- blurActiveElement();
55
-
56
- let overlay = prev(dialog);
57
- const isActive = hasClass(dialog, "active") || dialog.open;
58
- const isModal = hasClass(dialog, "modal");
59
-
60
- if (!isModal) off(dialog, "keydown", onKeydownDialog, false);
61
-
62
- if (!hasClass(overlay, "overlay")) {
63
- overlay = create({ class: "overlay" });
64
- insertBefore(overlay, dialog);
65
- await wait(90);
66
- }
67
-
68
- if (!isModal) onWeak(overlay, "click", onClickOverlay, false);
69
-
70
- if (isActive) closeDialog(dialog, overlay);
71
- else void openDialog(dialog, overlay, isModal, from);
72
- }
@@ -1,181 +0,0 @@
1
- import {
2
- query, next, prev, hasType, parent, queryAll, onWeak,
3
- isChrome, isMac, isIOS, rootSizeInPixels,
4
- } from "../utils.js";
5
-
6
- function updatePlaceholder(element) {
7
- if (!element.placeholder) element.placeholder = " ";
8
- }
9
-
10
- function onClickLabel(e) {
11
- const label = e.currentTarget;
12
- const field = parent(label);
13
- const input = query("input:not([type=file], [type=checkbox], [type=radio]), select, textarea", field);
14
- if (input) input.focus();
15
- }
16
-
17
- function onFocusInput(e) {
18
- updateInput(e.currentTarget);
19
- }
20
-
21
- function onBlurInput(e) {
22
- updateInput(e.currentTarget);
23
- }
24
-
25
- function onChangeFile(e) {
26
- updateFile(e.currentTarget);
27
- }
28
-
29
- function onChangeColor(e) {
30
- updateColor(e.currentTarget);
31
- }
32
-
33
- function onKeydownFile(e) {
34
- updateFile(e.currentTarget, e);
35
- }
36
-
37
- function onKeydownColor(e) {
38
- updateColor(e.currentTarget, e);
39
- }
40
-
41
- function onPasswordIconClick(e) {
42
- const icon = e.currentTarget;
43
- const input = query("input", parent(icon));
44
- if (input && icon.textContent?.includes("visibility")) {
45
- if (input.type === "password") {
46
- input.type = "text";
47
- icon.textContent = "visibility_off";
48
- } else {
49
- input.type = "password";
50
- icon.textContent = "visibility";
51
- }
52
- }
53
- }
54
-
55
- function onInputTextarea(e) {
56
- updateTextarea(e.currentTarget);
57
- }
58
-
59
- function onClickLabelDelegation(e) {
60
- const from = e.target.closest(".field > label");
61
- if (!from) return;
62
-
63
- Object.defineProperty(e, "currentTarget", { value: from, configurable: true });
64
- onClickLabel(e);
65
- }
66
-
67
- function updateAllLabels() {
68
- const body = document.body;
69
- if (!body) return;
70
-
71
- onWeak(body, "click", onClickLabelDelegation);
72
- }
73
-
74
- function updateAllInputs() {
75
- const inputs = queryAll(".field > input:not([type=file], [type=color], [type=range])");
76
- for (let i = 0; i < inputs.length; i++) {
77
- onWeak(inputs[i], "focus", onFocusInput);
78
- onWeak(inputs[i], "blur", onBlurInput);
79
- updateInput(inputs[i]);
80
- }
81
- }
82
-
83
- function updateAllSelects() {
84
- const selects = queryAll(".field > select");
85
- for (let i = 0; i < selects.length; i++) {
86
- onWeak(selects[i], "focus", onFocusInput);
87
- onWeak(selects[i], "blur", onBlurInput);
88
- }
89
- }
90
-
91
- function updateAllFiles() {
92
- const files = queryAll(".field > input[type=file]");
93
- for (let i = 0; i < files.length; i++) {
94
- onWeak(files[i], "change", onChangeFile);
95
- updateFile(files[i]);
96
- }
97
- }
98
-
99
- function updateAllColors() {
100
- const colors = queryAll(".field > input[type=color]");
101
- for (let i = 0; i < colors.length; i++) {
102
- onWeak(colors[i], "change", onChangeColor);
103
- updateColor(colors[i]);
104
- }
105
- }
106
-
107
- function updateAllTextareas() {
108
- const textareas = queryAll(".field > textarea");
109
- for (let i = 0; i < textareas.length; i++) {
110
- onWeak(textareas[i], "focus", onFocusInput);
111
- onWeak(textareas[i], "blur", onBlurInput);
112
- updatePlaceholder(textareas[i]);
113
-
114
- if (isChrome && !isMac && !isIOS) continue;
115
-
116
- onWeak(textareas[i], "input", onInputTextarea);
117
- updateTextarea(textareas[i]);
118
- }
119
- }
120
-
121
- function updateAllPasswordIcons() {
122
- const icons = queryAll(".field:has(> input[type=password]) > i, a");
123
- for (let i = 0; i < icons.length; i++) onWeak(icons[i], "click", onPasswordIconClick);
124
- }
125
-
126
- function updateInput(input) {
127
- if (hasType(input, "number") && !input.value) input.value = "";
128
- updatePlaceholder(input);
129
- }
130
-
131
- function updateFile(input, e) {
132
- if (e?.key === "Enter") {
133
- const previousInput = prev(input);
134
- if (!hasType(previousInput, "file")) return;
135
- previousInput.click();
136
- return;
137
- }
138
-
139
- const nextInput = next(input);
140
- if (!hasType(nextInput, "text")) return;
141
- nextInput.value = input.files ? Array.from(input.files).map((x) => x.name).join(", ") : "";
142
- nextInput.readOnly = true;
143
- onWeak(nextInput, "keydown", onKeydownFile, false);
144
- updateInput(nextInput);
145
- }
146
-
147
- function updateColor(input, e) {
148
- if (e?.key === "Enter") {
149
- const previousInput = prev(input);
150
- if (!hasType(previousInput, "color")) return;
151
- previousInput.click();
152
- return;
153
- }
154
-
155
- const nextInput = next(input);
156
- if (!hasType(nextInput, "text")) return;
157
- nextInput.readOnly = true;
158
- nextInput.value = input.value;
159
- onWeak(nextInput, "keydown", onKeydownColor, false);
160
- updateInput(nextInput);
161
- }
162
-
163
- function updateTextarea(textarea) {
164
- updatePlaceholder(textarea);
165
-
166
- if (textarea.hasAttribute("rows")) return;
167
-
168
- const rootSize = rootSizeInPixels();
169
- textarea.style.blockSize = "auto";
170
- textarea.style.blockSize = `${textarea.scrollHeight - rootSize}px`;
171
- }
172
-
173
- export function updateAllFields() {
174
- updateAllLabels();
175
- updateAllInputs();
176
- updateAllSelects();
177
- updateAllFiles();
178
- updateAllColors();
179
- updateAllTextareas();
180
- updateAllPasswordIcons();
181
- }
@@ -1,42 +0,0 @@
1
- import {
2
- query, queryAll, addClass, on, off, hasTag, hasClass, removeClass, blurActiveElement,
3
- } from "../utils.js";
4
-
5
- let _timeoutMenu;
6
-
7
- function onClickDocument(e) {
8
- off(document.body, "click", onClickDocument);
9
- const body = e.target;
10
- const menus = queryAll("menu.active");
11
- for (let i = 0; i < menus.length; i++) updateMenu(body, menus[i], e);
12
- }
13
-
14
- function focusOnMenuOrInput(menu) {
15
- setTimeout(() => {
16
- const input = query(".field > input", menu);
17
- if (input) input.focus();
18
- else menu.focus();
19
- }, 90);
20
- }
21
-
22
- export function updateMenu(from, menu, e) {
23
- if (_timeoutMenu) clearTimeout(_timeoutMenu);
24
-
25
- _timeoutMenu = setTimeout(() => {
26
- on(document.body, "click", onClickDocument);
27
- if (!hasTag(document.activeElement, "input")) blurActiveElement();
28
-
29
- const isActive = hasClass(menu, "active");
30
- const isEvent = e?.target === from;
31
- const isChild = !!from.closest("menu");
32
-
33
- if ((!isActive && isChild) || (isActive && isEvent)) {
34
- removeClass(menu, "active");
35
- return;
36
- }
37
-
38
- removeClass(queryAll("menu.active"), "active");
39
- addClass(menu, "active");
40
- focusOnMenuOrInput(menu);
41
- }, 90);
42
- }
@@ -1,7 +0,0 @@
1
- import { addClass, parent, removeClass, queryAll } from "../utils.js";
2
-
3
- export function updatePage(page) {
4
- const container = parent(page);
5
- if (container) removeClass(queryAll(":scope > .page", container), "active");
6
- addClass(page, "active");
7
- }
@@ -1,35 +0,0 @@
1
- import { queryAll, hasTag, off, on, isMac, isIOS, isChrome, hasClass } from "../utils.js";
2
-
3
- function onInputDocument(e) {
4
- const progress = e.target;
5
-
6
- if (hasTag(progress, "progress")) {
7
- updateProgress(progress);
8
- } else {
9
- updateAllProgress();
10
- }
11
- }
12
-
13
- function updateProgress(progress) {
14
- requestAnimationFrame(() => {
15
- if (!progress.hasAttribute("value") && !progress.hasAttribute("max")) {
16
- const value = hasClass(progress, "circle") ? "50" : "100";
17
- progress.style.setProperty("--_value", value);
18
- progress.setAttribute("value", value);
19
- progress.setAttribute("max", "100");
20
- progress.classList.add("indeterminate");
21
- } else {
22
- progress.style.setProperty("--_value", String(progress.value));
23
- }
24
- });
25
- }
26
-
27
- export function updateAllProgress() {
28
- if (isChrome && !isMac && !isIOS) return;
29
-
30
- const body = document.body;
31
- const progresses = queryAll("progress");
32
- if (!progresses.length) off(body, "input", onInputDocument, false);
33
- else on(body, "input", onInputDocument, false);
34
- for (let i = 0; i < progresses.length; i++) updateProgress(progresses[i]);
35
- }
@@ -1,78 +0,0 @@
1
- import {
2
- query, queryAll, hasClass, on, off, parent, hasTag, onWeak, rootSizeInPixels,
3
- } from "../utils.js";
4
-
5
- function onInputDocument(e) {
6
- const input = e.target;
7
- if (!hasTag(input, "input") && !hasTag(input, "select")) return;
8
-
9
- if (input.type === "range") {
10
- input.focus();
11
- updateRange(input);
12
- } else {
13
- updateAllRanges();
14
- }
15
- }
16
-
17
- function onChangeInput(e) {
18
- const isCoarse = window.matchMedia("(pointer: coarse)").matches;
19
- if (!isCoarse) return;
20
-
21
- const input = e.target;
22
- input.blur();
23
- }
24
-
25
- function updateAllRanges() {
26
- const body = document.body;
27
- const ranges = queryAll(".slider > input[type=range]");
28
- if (!ranges.length) off(body, "input", onInputDocument, false);
29
- else on(body, "input", onInputDocument, false);
30
- for (let i = 0; i < ranges.length; i++) updateRange(ranges[i]);
31
- }
32
-
33
- function updateRange(input) {
34
- onWeak(input, "change", onChangeInput);
35
-
36
- const label = parent(input);
37
- const bar = query("span", label);
38
- const inputs = queryAll("input", label);
39
- if (!inputs.length || !bar) return;
40
-
41
- const rootSize = rootSizeInPixels();
42
- const thumb = hasClass(label, "max") ? 0 : (0.25 * rootSize * 100) / inputs[0].offsetWidth;
43
- const percents = [];
44
- const values = [];
45
- for (let i = 0, n = inputs.length; i < n; i++) {
46
- const min = parseFloat(inputs[i].min) || 0;
47
- const max = parseFloat(inputs[i].max) || 100;
48
- const value = parseFloat(inputs[i].value) || 0;
49
- const percent = ((value - min) * 100) / (max - min);
50
- const fix = thumb / 2 - (thumb * percent) / 100;
51
- percents.push(percent + fix);
52
- values.push(value);
53
- }
54
-
55
- let percent = percents[0];
56
- let start = 0;
57
- let end = 100 - start - percent;
58
- let value1 = values[0];
59
- let value2 = values[1] || 0;
60
- if (inputs.length > 1) {
61
- percent = Math.abs(percents[1] - percents[0]);
62
- start = percents[1] > percents[0] ? percents[0] : percents[1];
63
- end = 100 - start - percent;
64
-
65
- if (value2 > value1) {
66
- value1 = values[1] || 0;
67
- value2 = values[0];
68
- }
69
- }
70
-
71
- requestAnimationFrame(() => {
72
- label.style.cssText = `--_start: ${start}%; --_end: ${end}%; --_value1: '${value1}'; --_value2: '${value2}';`;
73
- });
74
- }
75
-
76
- export function updateAllSliders() {
77
- updateAllRanges();
78
- }
@@ -1,27 +0,0 @@
1
- import { queryAll, addClass, removeClass, blurActiveElement, onWeak } from "../utils.js";
2
-
3
- let _timeoutSnackbar;
4
-
5
- function onClickSnackbar(e) {
6
- const snackbar = e.currentTarget;
7
- removeClass(snackbar, "active");
8
-
9
- if (_timeoutSnackbar) clearTimeout(_timeoutSnackbar);
10
- }
11
-
12
- export function updateSnackbar(snackbar, milliseconds) {
13
- blurActiveElement();
14
-
15
- const activeSnackbars = queryAll(".snackbar.active");
16
- for (let i = 0; i < activeSnackbars.length; i++) removeClass(activeSnackbars[i], "active");
17
- addClass(snackbar, "active");
18
- onWeak(snackbar, "click", onClickSnackbar);
19
-
20
- if (_timeoutSnackbar) clearTimeout(_timeoutSnackbar);
21
-
22
- if (milliseconds === -1) return;
23
-
24
- _timeoutSnackbar = setTimeout(() => {
25
- removeClass(snackbar, "active");
26
- }, milliseconds ?? 6000);
27
- }
@@ -1,46 +0,0 @@
1
- import { onWeak } from "../utils.js";
2
-
3
- function updateRipple(e) {
4
- const isMouseEvent = e instanceof MouseEvent;
5
- const element = e.currentTarget;
6
- const rect = element.getBoundingClientRect();
7
- const diameter = Math.max(rect.width, rect.height);
8
- const radius = diameter / 2;
9
- const x = isMouseEvent ? e.clientX - rect.left - radius : (rect.width / 2) - radius;
10
- const y = isMouseEvent ? e.clientY - rect.top - radius : (rect.height / 2) - radius;
11
- const rippleContainer = document.createElement("div");
12
- rippleContainer.className = "ripple-js";
13
-
14
- const ripple = document.createElement("div");
15
- ripple.style.inlineSize = ripple.style.blockSize = `${diameter}px`;
16
- ripple.style.left = `${x}px`;
17
- ripple.style.top = `${y}px`;
18
- onWeak(ripple, "animationend", () => { rippleContainer.remove(); });
19
-
20
- rippleContainer.appendChild(ripple);
21
- element.appendChild(rippleContainer);
22
- }
23
-
24
- function onMousedownRippleDelegation(e) {
25
- const from = e.target.closest(".slow-ripple, .ripple, .fast-ripple");
26
- if (!from) return;
27
-
28
- Object.defineProperty(e, "currentTarget", { value: from, configurable: true });
29
- updateRipple(e);
30
- }
31
-
32
- function onKeydownRippleDelegation(e) {
33
- const from = e.target.closest(".slow-ripple, .ripple, .fast-ripple");
34
- if (!from || e.key !== " ") return;
35
-
36
- Object.defineProperty(e, "currentTarget", { value: from, configurable: true });
37
- updateRipple(e);
38
- }
39
-
40
- export function updateAllRipples() {
41
- const body = document.body;
42
- if (!body) return;
43
-
44
- onWeak(body, "mousedown", onMousedownRippleDelegation);
45
- onWeak(body, "keydown", onKeydownRippleDelegation);
46
- }