@studious-creative/yumekit 0.1.9 → 0.1.11
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.
- package/dist/components/y-appbar.js +2 -19
- package/dist/components/y-avatar.js +7 -3
- package/dist/components/y-card.js +1 -22
- package/dist/components/y-dialog.js +16 -0
- package/dist/components/y-icon.js +1 -18
- package/dist/components/y-progress.d.ts +0 -1
- package/dist/components/y-progress.js +4 -15
- package/dist/components/y-theme.js +6 -1
- package/dist/components/y-toast.d.ts +0 -1
- package/dist/components/y-toast.js +4 -96
- package/dist/components/y-tooltip.d.ts +0 -1
- package/dist/components/y-tooltip.js +4 -96
- package/dist/icons/all.js +70 -20
- package/dist/index.js +153 -156
- package/dist/modules/helpers.d.ts +9 -0
- package/dist/modules/helpers.js +26 -0
- package/dist/yumekit.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getIcon } from '../icons/registry.js';
|
|
2
|
+
|
|
1
3
|
class YumeButton extends HTMLElement {
|
|
2
4
|
static get observedAttributes() {
|
|
3
5
|
return [
|
|
@@ -554,25 +556,6 @@ if (!customElements.get("y-button")) {
|
|
|
554
556
|
customElements.define("y-button", YumeButton);
|
|
555
557
|
}
|
|
556
558
|
|
|
557
|
-
/**
|
|
558
|
-
* Icon registry — a runtime map of icon names to SVG markup strings.
|
|
559
|
-
*
|
|
560
|
-
* Register only the icons you need for tree-shaking:
|
|
561
|
-
*
|
|
562
|
-
* import { registerIcon } from "@studious-creative/yumekit";
|
|
563
|
-
* registerIcon("home", homeSvgString);
|
|
564
|
-
*
|
|
565
|
-
* Or register all bundled icons at once (separate import):
|
|
566
|
-
*
|
|
567
|
-
* import "@studious-creative/yumekit/icons/all.js";
|
|
568
|
-
*/
|
|
569
|
-
|
|
570
|
-
const icons = new Map();
|
|
571
|
-
|
|
572
|
-
function getIcon(name) {
|
|
573
|
-
return icons.get(name) || "";
|
|
574
|
-
}
|
|
575
|
-
|
|
576
559
|
// Allowlist-based SVG sanitizer — only known-safe elements and attributes are kept.
|
|
577
560
|
const ALLOWED_ELEMENTS = new Set([
|
|
578
561
|
"svg",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { getColorVarPair } from '../modules/helpers.js';
|
|
2
|
+
|
|
1
3
|
class YumeAvatar extends HTMLElement {
|
|
2
4
|
static get observedAttributes() {
|
|
3
|
-
return ["src", "alt", "size", "shape"];
|
|
5
|
+
return ["src", "alt", "size", "shape", "color"];
|
|
4
6
|
}
|
|
5
7
|
|
|
6
8
|
constructor() {
|
|
@@ -19,7 +21,9 @@ class YumeAvatar extends HTMLElement {
|
|
|
19
21
|
const src = this.getAttribute("src");
|
|
20
22
|
const altRaw = this.getAttribute("alt") || "AN";
|
|
21
23
|
const shape = this.getAttribute("shape") || "circle";
|
|
24
|
+
const color = this.getAttribute("color") || "primary";
|
|
22
25
|
const borderRadius = `var(--component-avatar-border-radius-${shape}, 9999px)`;
|
|
26
|
+
const [bgColor, textColor] = getColorVarPair(color);
|
|
23
27
|
|
|
24
28
|
let dimensions;
|
|
25
29
|
const size = this.getAttribute("size") || "medium";
|
|
@@ -68,8 +72,8 @@ class YumeAvatar extends HTMLElement {
|
|
|
68
72
|
width: 100%;
|
|
69
73
|
height: 100%;
|
|
70
74
|
border-radius: ${borderRadius};
|
|
71
|
-
background-color:
|
|
72
|
-
color:
|
|
75
|
+
background-color: ${bgColor};
|
|
76
|
+
color: ${textColor};
|
|
73
77
|
display: flex;
|
|
74
78
|
align-items: center;
|
|
75
79
|
justify-content: center;
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function hideEmptySlotContainers(shadowRoot, slotsConfig = {}) {
|
|
3
|
-
Object.entries(slotsConfig).forEach(([slotName, containerSelector]) => {
|
|
4
|
-
const slot = shadowRoot.querySelector(
|
|
5
|
-
`slot${slotName ? `[name="${slotName}"]` : ":not([name])"}`,
|
|
6
|
-
);
|
|
7
|
-
const container = shadowRoot.querySelector(containerSelector);
|
|
8
|
-
|
|
9
|
-
if (slot && container) {
|
|
10
|
-
const assigned = slot
|
|
11
|
-
.assignedNodes({ flatten: true })
|
|
12
|
-
.filter((n) => {
|
|
13
|
-
return !(
|
|
14
|
-
n.nodeType === Node.TEXT_NODE &&
|
|
15
|
-
n.textContent.trim() === ""
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
container.style.display = assigned.length > 0 ? "" : "none";
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
1
|
+
import { hideEmptySlotContainers } from '../modules/helpers.js';
|
|
23
2
|
|
|
24
3
|
class YumeCard extends HTMLElement {
|
|
25
4
|
static get observedAttributes() {
|
|
@@ -208,6 +208,22 @@ class YumeDialog extends HTMLElement {
|
|
|
208
208
|
dialog.appendChild(body);
|
|
209
209
|
dialog.appendChild(footer);
|
|
210
210
|
this.shadowRoot.appendChild(dialog);
|
|
211
|
+
|
|
212
|
+
// Hide slot containers that have no slotted content
|
|
213
|
+
const hideIfEmpty = (wrapper) => {
|
|
214
|
+
const slot = wrapper.querySelector("slot");
|
|
215
|
+
if (!slot) return;
|
|
216
|
+
const update = () => {
|
|
217
|
+
const hasContent =
|
|
218
|
+
slot.assignedNodes({ flatten: true }).length > 0;
|
|
219
|
+
wrapper.style.display = hasContent ? "" : "none";
|
|
220
|
+
};
|
|
221
|
+
slot.addEventListener("slotchange", update);
|
|
222
|
+
update();
|
|
223
|
+
};
|
|
224
|
+
if (!this.closable) hideIfEmpty(header);
|
|
225
|
+
hideIfEmpty(body);
|
|
226
|
+
hideIfEmpty(footer);
|
|
211
227
|
}
|
|
212
228
|
}
|
|
213
229
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Icon registry — a runtime map of icon names to SVG markup strings.
|
|
3
|
-
*
|
|
4
|
-
* Register only the icons you need for tree-shaking:
|
|
5
|
-
*
|
|
6
|
-
* import { registerIcon } from "@studious-creative/yumekit";
|
|
7
|
-
* registerIcon("home", homeSvgString);
|
|
8
|
-
*
|
|
9
|
-
* Or register all bundled icons at once (separate import):
|
|
10
|
-
*
|
|
11
|
-
* import "@studious-creative/yumekit/icons/all.js";
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const icons = new Map();
|
|
15
|
-
|
|
16
|
-
function getIcon(name) {
|
|
17
|
-
return icons.get(name) || "";
|
|
18
|
-
}
|
|
1
|
+
import { getIcon } from '../icons/registry.js';
|
|
19
2
|
|
|
20
3
|
// Allowlist-based SVG sanitizer — only known-safe elements and attributes are kept.
|
|
21
4
|
const ALLOWED_ELEMENTS = new Set([
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getColorVarPair } from '../modules/helpers.js';
|
|
2
|
+
|
|
1
3
|
class YumeProgress extends HTMLElement {
|
|
2
4
|
static get observedAttributes() {
|
|
3
5
|
return [
|
|
@@ -154,19 +156,6 @@ class YumeProgress extends HTMLElement {
|
|
|
154
156
|
return Math.max(0, Math.min(100, pct));
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
getBarColor(color) {
|
|
158
|
-
const colorMap = {
|
|
159
|
-
primary: "var(--primary-content--)",
|
|
160
|
-
secondary: "var(--secondary-content--)",
|
|
161
|
-
base: "var(--base-content--)",
|
|
162
|
-
success: "var(--success-content--)",
|
|
163
|
-
warning: "var(--warning-content--)",
|
|
164
|
-
error: "var(--error-content--)",
|
|
165
|
-
help: "var(--help-content--)",
|
|
166
|
-
};
|
|
167
|
-
return colorMap[color] || color;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
159
|
getSizeVar(size) {
|
|
171
160
|
const map = {
|
|
172
161
|
small: "var(--component-progress-size-small)",
|
|
@@ -194,7 +183,7 @@ class YumeProgress extends HTMLElement {
|
|
|
194
183
|
render() {
|
|
195
184
|
const isIndeterminate = this.indeterminate;
|
|
196
185
|
const pct = this.percentage;
|
|
197
|
-
const barColor =
|
|
186
|
+
const [barColor, barTextColor] = getColorVarPair(this.color, null);
|
|
198
187
|
const sizeVar = this.getSizeVar(this.size);
|
|
199
188
|
const isDisabled = this.disabled;
|
|
200
189
|
const showLabel = this.labelDisplay && !isIndeterminate;
|
|
@@ -272,7 +261,7 @@ class YumeProgress extends HTMLElement {
|
|
|
272
261
|
}
|
|
273
262
|
|
|
274
263
|
.value-label--bar {
|
|
275
|
-
color:
|
|
264
|
+
color: ${barTextColor};
|
|
276
265
|
width: calc(100% / (${pct || 1} / 100));
|
|
277
266
|
}
|
|
278
267
|
|
|
@@ -56,7 +56,12 @@ class YumeTheme extends HTMLElement {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
this.shadowRoot.innerHTML = `
|
|
59
|
-
<style
|
|
59
|
+
<style>
|
|
60
|
+
${variablesCSS}
|
|
61
|
+
:host {
|
|
62
|
+
font-family: var(--font-family-body, sans-serif);
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
60
65
|
${themeCSS ? `<style>${themeCSS}</style>` : ""}
|
|
61
66
|
<slot></slot>
|
|
62
67
|
`;
|
|
@@ -1,80 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a CSS custom-property value to a concrete color string.
|
|
5
|
-
* Reads from the given element's computed style.
|
|
6
|
-
* @param {string} varExpr — e.g. "var(--primary-content--)"
|
|
7
|
-
* @param {HTMLElement} el — element to resolve against
|
|
8
|
-
* @returns {string} — resolved color or fallback
|
|
9
|
-
*/
|
|
10
|
-
function resolveCSSColor(varExpr, el) {
|
|
11
|
-
const match = varExpr.match(/var\(\s*(--[^,)]+)/);
|
|
12
|
-
if (!match) return varExpr;
|
|
13
|
-
const val = getComputedStyle(el).getPropertyValue(match[1]).trim();
|
|
14
|
-
return val || varExpr;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Parse a CSS color string (#hex, rgb(), etc.) to {r, g, b}.
|
|
19
|
-
* Returns null if it can't parse.
|
|
20
|
-
*/
|
|
21
|
-
function parseColor(colorStr) {
|
|
22
|
-
// #RGB, #RRGGBB, #RRGGBBAA
|
|
23
|
-
const hexMatch = colorStr.match(
|
|
24
|
-
/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,
|
|
25
|
-
);
|
|
26
|
-
if (hexMatch) {
|
|
27
|
-
let hex = hexMatch[1];
|
|
28
|
-
if (hex.length <= 4) {
|
|
29
|
-
hex = hex
|
|
30
|
-
.split("")
|
|
31
|
-
.map((c) => c + c)
|
|
32
|
-
.join("");
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
r: parseInt(hex.slice(0, 2), 16),
|
|
36
|
-
g: parseInt(hex.slice(2, 4), 16),
|
|
37
|
-
b: parseInt(hex.slice(4, 6), 16),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
// rgb(r, g, b) or rgba(r, g, b, a)
|
|
41
|
-
const rgbMatch = colorStr.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
42
|
-
if (rgbMatch) {
|
|
43
|
-
return {
|
|
44
|
-
r: parseInt(rgbMatch[1], 10),
|
|
45
|
-
g: parseInt(rgbMatch[2], 10),
|
|
46
|
-
b: parseInt(rgbMatch[3], 10),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Compute relative luminance of an {r,g,b} color (0-255 range).
|
|
54
|
-
* Returns a value between 0 (black) and 1 (white).
|
|
55
|
-
*/
|
|
56
|
-
function luminance({ r, g, b }) {
|
|
57
|
-
const [rs, gs, bs] = [r, g, b].map((c) => {
|
|
58
|
-
c /= 255;
|
|
59
|
-
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
60
|
-
});
|
|
61
|
-
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Given a background color string, return a CSS value for best contrast text.
|
|
66
|
-
* Uses WCAG relative luminance to pick dark or light, referencing theme tokens
|
|
67
|
-
* (--neutral-black / --neutral-white) with hardcoded fallbacks.
|
|
68
|
-
* @param {string} bgColor — any CSS color string (#hex, rgb(), etc.)
|
|
69
|
-
* @returns {string} CSS var() expression for contrasting text color
|
|
70
|
-
*/
|
|
71
|
-
function contrastTextColor(bgColor) {
|
|
72
|
-
const parsed = parseColor(bgColor);
|
|
73
|
-
if (!parsed) return "var(--neutral-white, #ffffff)";
|
|
74
|
-
return luminance(parsed) > 0.179
|
|
75
|
-
? "var(--neutral-black, #000000)"
|
|
76
|
-
: "var(--neutral-white, #ffffff)";
|
|
77
|
-
}
|
|
1
|
+
import { getColorVarPair } from '../modules/helpers.js';
|
|
78
2
|
|
|
79
3
|
class YumeToast extends HTMLElement {
|
|
80
4
|
static get observedAttributes() {
|
|
@@ -150,11 +74,9 @@ class YumeToast extends HTMLElement {
|
|
|
150
74
|
toast.setAttribute("aria-live", "assertive");
|
|
151
75
|
toast.setAttribute("part", "toast");
|
|
152
76
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
toast.style.backgroundColor = bgVar;
|
|
157
|
-
toast.style.color = textColor;
|
|
77
|
+
const [bg, fg] = getColorVarPair(color);
|
|
78
|
+
toast.style.backgroundColor = bg;
|
|
79
|
+
toast.style.color = fg;
|
|
158
80
|
|
|
159
81
|
if (icon) {
|
|
160
82
|
const iconEl = document.createElement("y-icon");
|
|
@@ -253,20 +175,6 @@ class YumeToast extends HTMLElement {
|
|
|
253
175
|
return map[pos] || map["bottom-right"];
|
|
254
176
|
}
|
|
255
177
|
|
|
256
|
-
// "base" inverts the page: light content on dark, dark on light.
|
|
257
|
-
_getColorBg(color) {
|
|
258
|
-
const map = {
|
|
259
|
-
base: "var(--base-content--, #fff)",
|
|
260
|
-
primary: "var(--primary-content--, #0070f3)",
|
|
261
|
-
secondary: "var(--secondary-content--, #6c757d)",
|
|
262
|
-
success: "var(--success-content--, #28a745)",
|
|
263
|
-
warning: "var(--warning-content--, #ffc107)",
|
|
264
|
-
error: "var(--error-content--, #dc3545)",
|
|
265
|
-
help: "var(--help-content--, #6f42c1)",
|
|
266
|
-
};
|
|
267
|
-
return map[color] || map.base;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
178
|
render() {
|
|
271
179
|
this.shadowRoot.innerHTML = `
|
|
272
180
|
<style>
|
|
@@ -1,80 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a CSS custom-property value to a concrete color string.
|
|
5
|
-
* Reads from the given element's computed style.
|
|
6
|
-
* @param {string} varExpr — e.g. "var(--primary-content--)"
|
|
7
|
-
* @param {HTMLElement} el — element to resolve against
|
|
8
|
-
* @returns {string} — resolved color or fallback
|
|
9
|
-
*/
|
|
10
|
-
function resolveCSSColor(varExpr, el) {
|
|
11
|
-
const match = varExpr.match(/var\(\s*(--[^,)]+)/);
|
|
12
|
-
if (!match) return varExpr;
|
|
13
|
-
const val = getComputedStyle(el).getPropertyValue(match[1]).trim();
|
|
14
|
-
return val || varExpr;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Parse a CSS color string (#hex, rgb(), etc.) to {r, g, b}.
|
|
19
|
-
* Returns null if it can't parse.
|
|
20
|
-
*/
|
|
21
|
-
function parseColor(colorStr) {
|
|
22
|
-
// #RGB, #RRGGBB, #RRGGBBAA
|
|
23
|
-
const hexMatch = colorStr.match(
|
|
24
|
-
/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,
|
|
25
|
-
);
|
|
26
|
-
if (hexMatch) {
|
|
27
|
-
let hex = hexMatch[1];
|
|
28
|
-
if (hex.length <= 4) {
|
|
29
|
-
hex = hex
|
|
30
|
-
.split("")
|
|
31
|
-
.map((c) => c + c)
|
|
32
|
-
.join("");
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
r: parseInt(hex.slice(0, 2), 16),
|
|
36
|
-
g: parseInt(hex.slice(2, 4), 16),
|
|
37
|
-
b: parseInt(hex.slice(4, 6), 16),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
// rgb(r, g, b) or rgba(r, g, b, a)
|
|
41
|
-
const rgbMatch = colorStr.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
42
|
-
if (rgbMatch) {
|
|
43
|
-
return {
|
|
44
|
-
r: parseInt(rgbMatch[1], 10),
|
|
45
|
-
g: parseInt(rgbMatch[2], 10),
|
|
46
|
-
b: parseInt(rgbMatch[3], 10),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Compute relative luminance of an {r,g,b} color (0-255 range).
|
|
54
|
-
* Returns a value between 0 (black) and 1 (white).
|
|
55
|
-
*/
|
|
56
|
-
function luminance({ r, g, b }) {
|
|
57
|
-
const [rs, gs, bs] = [r, g, b].map((c) => {
|
|
58
|
-
c /= 255;
|
|
59
|
-
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
60
|
-
});
|
|
61
|
-
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Given a background color string, return a CSS value for best contrast text.
|
|
66
|
-
* Uses WCAG relative luminance to pick dark or light, referencing theme tokens
|
|
67
|
-
* (--neutral-black / --neutral-white) with hardcoded fallbacks.
|
|
68
|
-
* @param {string} bgColor — any CSS color string (#hex, rgb(), etc.)
|
|
69
|
-
* @returns {string} CSS var() expression for contrasting text color
|
|
70
|
-
*/
|
|
71
|
-
function contrastTextColor(bgColor) {
|
|
72
|
-
const parsed = parseColor(bgColor);
|
|
73
|
-
if (!parsed) return "var(--neutral-white, #ffffff)";
|
|
74
|
-
return luminance(parsed) > 0.179
|
|
75
|
-
? "var(--neutral-black, #000000)"
|
|
76
|
-
: "var(--neutral-white, #ffffff)";
|
|
77
|
-
}
|
|
1
|
+
import { getColorVarPair } from '../modules/helpers.js';
|
|
78
2
|
|
|
79
3
|
class YumeTooltip extends HTMLElement {
|
|
80
4
|
static get observedAttributes() {
|
|
@@ -152,9 +76,8 @@ class YumeTooltip extends HTMLElement {
|
|
|
152
76
|
this._visible = true;
|
|
153
77
|
const tip = this.shadowRoot.querySelector(".tooltip");
|
|
154
78
|
if (tip) {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
tip.style.color = contrastTextColor(resolvedBg);
|
|
79
|
+
const [, fg] = getColorVarPair(this.color);
|
|
80
|
+
tip.style.color = fg;
|
|
158
81
|
tip.classList.add("visible");
|
|
159
82
|
}
|
|
160
83
|
}, this.delay);
|
|
@@ -185,24 +108,9 @@ class YumeTooltip extends HTMLElement {
|
|
|
185
108
|
}
|
|
186
109
|
}
|
|
187
110
|
|
|
188
|
-
_getBg() {
|
|
189
|
-
const map = {
|
|
190
|
-
base: "var(--base-content--, #555)",
|
|
191
|
-
primary: "var(--primary-content--, #0070f3)",
|
|
192
|
-
secondary: "var(--secondary-content--, #6c757d)",
|
|
193
|
-
success: "var(--success-content--, #28a745)",
|
|
194
|
-
warning: "var(--warning-content--, #ffc107)",
|
|
195
|
-
error: "var(--error-content--, #dc3545)",
|
|
196
|
-
help: "var(--help-content--, #6f42c1)",
|
|
197
|
-
};
|
|
198
|
-
return map[this.color] || map.base;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
111
|
render() {
|
|
202
112
|
const pos = this.position;
|
|
203
|
-
const bg = this.
|
|
204
|
-
const resolvedBg = resolveCSSColor(bg, this);
|
|
205
|
-
const fg = contrastTextColor(resolvedBg);
|
|
113
|
+
const [bg, fg] = getColorVarPair(this.color);
|
|
206
114
|
|
|
207
115
|
this.shadowRoot.innerHTML = `
|
|
208
116
|
<style>
|
package/dist/icons/all.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Icon registry — a runtime map of icon names to SVG markup strings.
|
|
3
|
-
*
|
|
4
|
-
* Register only the icons you need for tree-shaking:
|
|
5
|
-
*
|
|
6
|
-
* import { registerIcon } from "@studious-creative/yumekit";
|
|
7
|
-
* registerIcon("home", homeSvgString);
|
|
8
|
-
*
|
|
9
|
-
* Or register all bundled icons at once (separate import):
|
|
10
|
-
*
|
|
11
|
-
* import "@studious-creative/yumekit/icons/all.js";
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const icons = new Map();
|
|
15
|
-
|
|
16
|
-
function registerIcons(entries) {
|
|
17
|
-
for (const [name, svg] of Object.entries(entries)) {
|
|
18
|
-
icons.set(name, svg);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import { registerIcons } from './registry.js';
|
|
21
2
|
|
|
22
3
|
var ai = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M12 8V4H8\"/>\n <rect width=\"16\" height=\"12\" x=\"4\" y=\"8\" rx=\"2\"/>\n <path d=\"M2 14h2M20 14h2M15 13v2M9 13v2\"/>\n</svg>\n";
|
|
23
4
|
|
|
@@ -49,6 +30,52 @@ var collapseLeft = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 2
|
|
|
49
30
|
|
|
50
31
|
var comments = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>\n</svg>\n";
|
|
51
32
|
|
|
33
|
+
var compAppbar = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"5\" rx=\"1.5\"/>\n <line x1=\"4\" y1=\"13\" x2=\"20\" y2=\"13\"/>\n <line x1=\"4\" y1=\"17\" x2=\"15\" y2=\"17\"/>\n <line x1=\"4\" y1=\"21\" x2=\"10\" y2=\"21\"/>\n</svg>\n";
|
|
34
|
+
|
|
35
|
+
var compAvatar = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <circle cx=\"12\" cy=\"10\" r=\"3\"/>\n <path d=\"M6 20.5c0-3 2.7-5.5 6-5.5s6 2.5 6 5.5\"/>\n</svg>\n";
|
|
36
|
+
|
|
37
|
+
var compBadge = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"6\" width=\"16\" height=\"16\" rx=\"2\"/>\n <circle cx=\"20\" cy=\"5\" r=\"3.5\"/>\n</svg>\n";
|
|
38
|
+
|
|
39
|
+
var compButton = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"7\" width=\"20\" height=\"10\" rx=\"3\"/>\n <line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"/>\n</svg>\n";
|
|
40
|
+
|
|
41
|
+
var compCard = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"2\" width=\"18\" height=\"20\" rx=\"2\"/>\n <line x1=\"3\" y1=\"8\" x2=\"21\" y2=\"8\"/>\n <line x1=\"7\" y1=\"12\" x2=\"17\" y2=\"12\"/>\n <line x1=\"7\" y1=\"16\" x2=\"13\" y2=\"16\"/>\n</svg>\n";
|
|
42
|
+
|
|
43
|
+
var compCheckbox = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"3\"/>\n <polyline points=\"7 12.5 10.5 16 17 8\"/>\n</svg>\n";
|
|
44
|
+
|
|
45
|
+
var compDialog = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/>\n <line x1=\"7\" y1=\"9\" x2=\"17\" y2=\"9\"/>\n <line x1=\"7\" y1=\"13\" x2=\"13\" y2=\"13\"/>\n</svg>\n";
|
|
46
|
+
|
|
47
|
+
var compDrawer = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"18\" rx=\"2\"/>\n <line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\"/>\n <line x1=\"4\" y1=\"8\" x2=\"7\" y2=\"8\"/>\n <line x1=\"4\" y1=\"12\" x2=\"7\" y2=\"12\"/>\n</svg>\n";
|
|
48
|
+
|
|
49
|
+
var compIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M12 2c0 5.52-4.48 10-10 10 5.52 0 10 4.48 10 10 0-5.52 4.48-10 10-10-5.52 0-10-4.48-10-10z\"/>\n</svg>\n";
|
|
50
|
+
|
|
51
|
+
var compInput = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"/>\n <line x1=\"6\" y1=\"10\" x2=\"6\" y2=\"14\"/>\n</svg>\n";
|
|
52
|
+
|
|
53
|
+
var compMenu = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"2\" width=\"18\" height=\"20\" rx=\"2\"/>\n <line x1=\"7\" y1=\"7\" x2=\"17\" y2=\"7\"/>\n <line x1=\"7\" y1=\"12\" x2=\"17\" y2=\"12\"/>\n <line x1=\"7\" y1=\"17\" x2=\"17\" y2=\"17\"/>\n</svg>\n";
|
|
54
|
+
|
|
55
|
+
var compPanelbar = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"2\" width=\"20\" height=\"20\" rx=\"2\"/>\n <line x1=\"2\" y1=\"9\" x2=\"22\" y2=\"9\"/>\n <line x1=\"2\" y1=\"16\" x2=\"22\" y2=\"16\"/>\n</svg>\n";
|
|
56
|
+
|
|
57
|
+
var compProgress = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"8\" width=\"20\" height=\"8\" rx=\"4\"/>\n <line x1=\"6\" y1=\"12\" x2=\"13\" y2=\"12\" stroke-width=\"3\" stroke-linecap=\"round\"/>\n</svg>\n";
|
|
58
|
+
|
|
59
|
+
var compRadio = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"currentColor\" stroke=\"none\"/>\n</svg>\n";
|
|
60
|
+
|
|
61
|
+
var compSelect = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"7\" width=\"20\" height=\"10\" rx=\"2\"/>\n <line x1=\"6\" y1=\"12\" x2=\"13\" y2=\"12\"/>\n <polyline points=\"16 10 18 13 20 10\"/>\n</svg>\n";
|
|
62
|
+
|
|
63
|
+
var compSlider = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/>\n <circle cx=\"15\" cy=\"12\" r=\"4\"/>\n</svg>\n";
|
|
64
|
+
|
|
65
|
+
var compSwitch = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"6\"/>\n <circle cx=\"16\" cy=\"12\" r=\"4\"/>\n</svg>\n";
|
|
66
|
+
|
|
67
|
+
var compTable = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"18\" rx=\"2\"/>\n <line x1=\"2\" y1=\"9\" x2=\"22\" y2=\"9\"/>\n <line x1=\"2\" y1=\"15\" x2=\"22\" y2=\"15\"/>\n <line x1=\"10\" y1=\"3\" x2=\"10\" y2=\"21\"/>\n</svg>\n";
|
|
68
|
+
|
|
69
|
+
var compTabs = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"9\" width=\"20\" height=\"12\" rx=\"2\"/>\n <path d=\"M5 9V6a1.5 1.5 0 0 1 1.5-1.5h5A1.5 1.5 0 0 1 13 6v3\"/>\n <line x1=\"16\" y1=\"6\" x2=\"20\" y2=\"6\"/>\n</svg>\n";
|
|
70
|
+
|
|
71
|
+
var compTag = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"2\" y=\"7\" width=\"20\" height=\"10\" rx=\"5\"/>\n <line x1=\"15\" y1=\"10\" x2=\"17\" y2=\"14\"/>\n <line x1=\"17\" y1=\"10\" x2=\"15\" y2=\"14\"/>\n</svg>\n";
|
|
72
|
+
|
|
73
|
+
var compTheme = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <path d=\"M12 2a10 10 0 0 1 0 20z\" fill=\"currentColor\"/>\n</svg>\n";
|
|
74
|
+
|
|
75
|
+
var compToast = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"7\" width=\"18\" height=\"10\" rx=\"2\"/>\n <circle cx=\"8\" cy=\"12\" r=\"2\"/>\n <line x1=\"12\" y1=\"12\" x2=\"18\" y2=\"12\"/>\n</svg>\n";
|
|
76
|
+
|
|
77
|
+
var compTooltip = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5l-2 4-2-4H5a2 2 0 0 1-2-2z\"/>\n</svg>\n";
|
|
78
|
+
|
|
52
79
|
var compass = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <polygon points=\"16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76\"/>\n</svg>\n";
|
|
53
80
|
|
|
54
81
|
var diagram = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"3\" width=\"6\" height=\"6\" rx=\"1\"/>\n <rect x=\"15\" y=\"3\" width=\"6\" height=\"6\" rx=\"1\"/>\n <rect x=\"9\" y=\"15\" width=\"6\" height=\"6\" rx=\"1\"/>\n <line x1=\"6\" y1=\"9\" x2=\"6\" y2=\"15\"/>\n <line x1=\"6\" y1=\"15\" x2=\"9\" y2=\"15\"/>\n <line x1=\"18\" y1=\"9\" x2=\"18\" y2=\"15\"/>\n <line x1=\"18\" y1=\"15\" x2=\"15\" y2=\"15\"/>\n</svg>\n";
|
|
@@ -128,6 +155,29 @@ registerIcons({
|
|
|
128
155
|
close,
|
|
129
156
|
"collapse-left": collapseLeft,
|
|
130
157
|
comments,
|
|
158
|
+
"comp-appbar": compAppbar,
|
|
159
|
+
"comp-avatar": compAvatar,
|
|
160
|
+
"comp-badge": compBadge,
|
|
161
|
+
"comp-button": compButton,
|
|
162
|
+
"comp-card": compCard,
|
|
163
|
+
"comp-checkbox": compCheckbox,
|
|
164
|
+
"comp-dialog": compDialog,
|
|
165
|
+
"comp-drawer": compDrawer,
|
|
166
|
+
"comp-icon": compIcon,
|
|
167
|
+
"comp-input": compInput,
|
|
168
|
+
"comp-menu": compMenu,
|
|
169
|
+
"comp-panelbar": compPanelbar,
|
|
170
|
+
"comp-progress": compProgress,
|
|
171
|
+
"comp-radio": compRadio,
|
|
172
|
+
"comp-select": compSelect,
|
|
173
|
+
"comp-slider": compSlider,
|
|
174
|
+
"comp-switch": compSwitch,
|
|
175
|
+
"comp-table": compTable,
|
|
176
|
+
"comp-tabs": compTabs,
|
|
177
|
+
"comp-tag": compTag,
|
|
178
|
+
"comp-theme": compTheme,
|
|
179
|
+
"comp-toast": compToast,
|
|
180
|
+
"comp-tooltip": compTooltip,
|
|
131
181
|
compass,
|
|
132
182
|
diagram,
|
|
133
183
|
discord,
|