@waggylabs/yumekit 0.5.2 → 0.5.3
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/ai/llm.txt +13 -11
- package/dist/ai/skill/examples/nav-layout.html +5 -5
- package/dist/ai/skill/examples/themed-app.html +6 -6
- package/dist/ai/skill/patterns.md +7 -7
- package/dist/ai/skill/reference.md +20 -18
- package/dist/components/y-appbar.js +45 -16
- package/dist/components/y-banner.js +44 -15
- package/dist/components/y-button/y-button.d.ts +11 -4
- package/dist/components/y-button.d.ts +11 -4
- package/dist/components/y-button.js +43 -14
- package/dist/components/y-checkbox.js +7 -1
- package/dist/components/y-color.js +12 -2
- package/dist/components/y-colorpicker.js +12 -2
- package/dist/components/y-data-grid.js +83 -35
- package/dist/components/y-date.js +72 -30
- package/dist/components/y-datepicker.js +72 -30
- package/dist/components/y-dialog.js +1 -1
- package/dist/components/y-help.js +46 -17
- package/dist/components/y-input.js +11 -1
- package/dist/components/y-paginator.js +46 -17
- package/dist/components/y-select.js +1 -1
- package/dist/components/y-sidebar.js +45 -16
- package/dist/components/y-tag/y-tag.d.ts +9 -2
- package/dist/components/y-tag.d.ts +9 -2
- package/dist/components/y-tag.js +36 -8
- package/dist/components/y-textarea.js +11 -1
- package/dist/index.js +139 -53
- package/dist/react.d.ts +4 -0
- package/dist/yumekit.min.js +1 -1
- package/llm.txt +13 -11
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ class YumeButton extends HTMLElement {
|
|
|
7
7
|
"right-icon",
|
|
8
8
|
"color",
|
|
9
9
|
"size",
|
|
10
|
+
"variant",
|
|
10
11
|
"style-type",
|
|
11
12
|
"type",
|
|
12
13
|
"padding-mode",
|
|
@@ -59,9 +60,13 @@ class YumeButton extends HTMLElement {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
if (name === "style-type" && newValue !== null) {
|
|
64
|
+
this._warnStyleTypeDeprecated();
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
this._init();
|
|
63
68
|
|
|
64
|
-
if (["color", "size", "style-type", "disabled"].includes(name)) {
|
|
69
|
+
if (["color", "size", "variant", "style-type", "disabled"].includes(name)) {
|
|
65
70
|
this._updateStyles();
|
|
66
71
|
}
|
|
67
72
|
}
|
|
@@ -143,9 +148,12 @@ class YumeButton extends HTMLElement {
|
|
|
143
148
|
this.setAttribute("size", val);
|
|
144
149
|
}
|
|
145
150
|
|
|
146
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
153
|
+
* backward compatibility and removed in a future major version.
|
|
154
|
+
*/
|
|
147
155
|
get styleType() {
|
|
148
|
-
return this.
|
|
156
|
+
return this.variant;
|
|
149
157
|
}
|
|
150
158
|
set styleType(val) {
|
|
151
159
|
this.setAttribute("style-type", val);
|
|
@@ -188,6 +196,18 @@ class YumeButton extends HTMLElement {
|
|
|
188
196
|
this.setAttribute("value", newVal);
|
|
189
197
|
}
|
|
190
198
|
|
|
199
|
+
/** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
|
|
200
|
+
get variant() {
|
|
201
|
+
return (
|
|
202
|
+
this.getAttribute("variant") ||
|
|
203
|
+
this.getAttribute("style-type") ||
|
|
204
|
+
"outlined"
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
set variant(val) {
|
|
208
|
+
this.setAttribute("variant", val);
|
|
209
|
+
}
|
|
210
|
+
|
|
191
211
|
// -------------------------------------------------------------------------
|
|
192
212
|
// Public
|
|
193
213
|
// -------------------------------------------------------------------------
|
|
@@ -242,7 +262,7 @@ class YumeButton extends HTMLElement {
|
|
|
242
262
|
});
|
|
243
263
|
}
|
|
244
264
|
|
|
245
|
-
_applyCustomColorStyles(color,
|
|
265
|
+
_applyCustomColorStyles(color, variant, size) {
|
|
246
266
|
const text = contrastTextColor(color);
|
|
247
267
|
const hover = `color-mix(in srgb, ${color} 85%, black)`;
|
|
248
268
|
const active = `color-mix(in srgb, ${color} 70%, black)`;
|
|
@@ -298,7 +318,7 @@ class YumeButton extends HTMLElement {
|
|
|
298
318
|
},
|
|
299
319
|
};
|
|
300
320
|
|
|
301
|
-
Object.entries(styles[
|
|
321
|
+
Object.entries(styles[variant] || styles.outlined).forEach(
|
|
302
322
|
([key, val]) => this.button.style.setProperty(key, val),
|
|
303
323
|
);
|
|
304
324
|
|
|
@@ -344,11 +364,11 @@ class YumeButton extends HTMLElement {
|
|
|
344
364
|
);
|
|
345
365
|
}
|
|
346
366
|
|
|
347
|
-
_applyInteractionStyles(vars,
|
|
348
|
-
if (
|
|
367
|
+
_applyInteractionStyles(vars, variant) {
|
|
368
|
+
if (variant === "filled") {
|
|
349
369
|
this._applyFilledInteractionStyles(vars);
|
|
350
370
|
} else {
|
|
351
|
-
this._applyUnfilledInteractionStyles(vars,
|
|
371
|
+
this._applyUnfilledInteractionStyles(vars, variant);
|
|
352
372
|
}
|
|
353
373
|
}
|
|
354
374
|
|
|
@@ -473,7 +493,7 @@ class YumeButton extends HTMLElement {
|
|
|
473
493
|
this.shadowRoot.appendChild(style);
|
|
474
494
|
}
|
|
475
495
|
|
|
476
|
-
_applyUnfilledInteractionStyles(vars,
|
|
496
|
+
_applyUnfilledInteractionStyles(vars, variant) {
|
|
477
497
|
const borderColor = this._outlineBorderColor(
|
|
478
498
|
`var(${vars[7]}, var(${vars[0]}, #f7f7fa))`,
|
|
479
499
|
);
|
|
@@ -503,7 +523,7 @@ class YumeButton extends HTMLElement {
|
|
|
503
523
|
`var(${vars[6]}, #0c0c0d)`,
|
|
504
524
|
);
|
|
505
525
|
|
|
506
|
-
if (
|
|
526
|
+
if (variant === "outlined") {
|
|
507
527
|
// Outlined buttons keep their border color across all states
|
|
508
528
|
this.button.style.setProperty("--hover-border-color", borderColor);
|
|
509
529
|
this.button.style.setProperty("--focus-border-color", borderColor);
|
|
@@ -791,11 +811,11 @@ class YumeButton extends HTMLElement {
|
|
|
791
811
|
}
|
|
792
812
|
|
|
793
813
|
_updateStyles() {
|
|
794
|
-
const { color, size,
|
|
814
|
+
const { color, size, variant } = this;
|
|
795
815
|
const colorVars = this._getColorVarsMap();
|
|
796
816
|
|
|
797
817
|
if (!colorVars[color] && isSafeCssColor(color)) {
|
|
798
|
-
this._applyCustomColorStyles(color,
|
|
818
|
+
this._applyCustomColorStyles(color, variant, size);
|
|
799
819
|
return;
|
|
800
820
|
}
|
|
801
821
|
|
|
@@ -824,14 +844,23 @@ class YumeButton extends HTMLElement {
|
|
|
824
844
|
},
|
|
825
845
|
};
|
|
826
846
|
|
|
827
|
-
const currentStyle = styleVars[
|
|
847
|
+
const currentStyle = styleVars[variant] || styleVars.outlined;
|
|
828
848
|
Object.entries(currentStyle).forEach(([key, value]) => {
|
|
829
849
|
this.button.style.setProperty(key, value);
|
|
830
850
|
});
|
|
831
851
|
|
|
832
|
-
this._applyInteractionStyles(vars,
|
|
852
|
+
this._applyInteractionStyles(vars, variant);
|
|
833
853
|
this._applySizeStyles(size);
|
|
834
854
|
}
|
|
855
|
+
|
|
856
|
+
_warnStyleTypeDeprecated() {
|
|
857
|
+
if (YumeButton._styleTypeDeprecationWarned) return;
|
|
858
|
+
|
|
859
|
+
YumeButton._styleTypeDeprecationWarned = true;
|
|
860
|
+
console.warn(
|
|
861
|
+
'y-button: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
|
|
862
|
+
);
|
|
863
|
+
}
|
|
835
864
|
}
|
|
836
865
|
|
|
837
866
|
if (!customElements.get("y-button")) {
|
|
@@ -2021,7 +2050,7 @@ class YumeSidebar extends HTMLElement {
|
|
|
2021
2050
|
{
|
|
2022
2051
|
class: "collapse-btn",
|
|
2023
2052
|
color: "base",
|
|
2024
|
-
"
|
|
2053
|
+
"variant": "flat",
|
|
2025
2054
|
size: cfg.buttonSize,
|
|
2026
2055
|
"aria-label": isCollapsed
|
|
2027
2056
|
? "Expand sidebar"
|
|
@@ -2069,7 +2098,7 @@ class YumeSidebar extends HTMLElement {
|
|
|
2069
2098
|
const btn = createElement("y-button", {
|
|
2070
2099
|
id: btnId,
|
|
2071
2100
|
color: isActive ? "primary" : "base",
|
|
2072
|
-
"
|
|
2101
|
+
"variant": "flat",
|
|
2073
2102
|
size: cfg.buttonSize,
|
|
2074
2103
|
"aria-current": isActive ? "page" : false,
|
|
2075
2104
|
});
|
|
@@ -15,10 +15,17 @@ export class YumeTag extends HTMLElement {
|
|
|
15
15
|
/** Size: "small" | "medium" | "large" (default "medium"). */
|
|
16
16
|
get size(): string;
|
|
17
17
|
set styleType(val: string);
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
20
|
+
* backward compatibility and removed in a future major version.
|
|
21
|
+
*/
|
|
19
22
|
get styleType(): string;
|
|
23
|
+
set variant(val: string);
|
|
24
|
+
/** Visual style: "filled" (default) | "outlined" | "flat". */
|
|
25
|
+
get variant(): string;
|
|
20
26
|
render(): void;
|
|
21
27
|
_bindRemoveListener(): void;
|
|
22
|
-
_getCustomColorVariant(color: any,
|
|
28
|
+
_getCustomColorVariant(color: any, variant: any): any;
|
|
23
29
|
_getStyle(): string;
|
|
30
|
+
_warnStyleTypeDeprecated(): void;
|
|
24
31
|
}
|
|
@@ -15,10 +15,17 @@ export class YumeTag extends HTMLElement {
|
|
|
15
15
|
/** Size: "small" | "medium" | "large" (default "medium"). */
|
|
16
16
|
get size(): string;
|
|
17
17
|
set styleType(val: string);
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
20
|
+
* backward compatibility and removed in a future major version.
|
|
21
|
+
*/
|
|
19
22
|
get styleType(): string;
|
|
23
|
+
set variant(val: string);
|
|
24
|
+
/** Visual style: "filled" (default) | "outlined" | "flat". */
|
|
25
|
+
get variant(): string;
|
|
20
26
|
render(): void;
|
|
21
27
|
_bindRemoveListener(): void;
|
|
22
|
-
_getCustomColorVariant(color: any,
|
|
28
|
+
_getCustomColorVariant(color: any, variant: any): any;
|
|
23
29
|
_getStyle(): string;
|
|
30
|
+
_warnStyleTypeDeprecated(): void;
|
|
24
31
|
}
|
package/dist/components/y-tag.js
CHANGED
|
@@ -4,7 +4,7 @@ var xSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill
|
|
|
4
4
|
|
|
5
5
|
class YumeTag extends HTMLElement {
|
|
6
6
|
static get observedAttributes() {
|
|
7
|
-
return ["removable", "color", "style-type", "shape", "size"];
|
|
7
|
+
return ["removable", "color", "variant", "style-type", "shape", "size"];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// -------------------------------------------------------------------------
|
|
@@ -22,6 +22,10 @@ class YumeTag extends HTMLElement {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
25
|
+
if (name === "style-type" && newValue !== null) {
|
|
26
|
+
this._warnStyleTypeDeprecated();
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
if (oldValue !== newValue) this.render();
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -62,14 +66,29 @@ class YumeTag extends HTMLElement {
|
|
|
62
66
|
this.setAttribute("size", val);
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
71
|
+
* backward compatibility and removed in a future major version.
|
|
72
|
+
*/
|
|
66
73
|
get styleType() {
|
|
67
|
-
return this.
|
|
74
|
+
return this.variant;
|
|
68
75
|
}
|
|
69
76
|
set styleType(val) {
|
|
70
77
|
this.setAttribute("style-type", val);
|
|
71
78
|
}
|
|
72
79
|
|
|
80
|
+
/** Visual style: "filled" (default) | "outlined" | "flat". */
|
|
81
|
+
get variant() {
|
|
82
|
+
return (
|
|
83
|
+
this.getAttribute("variant") ||
|
|
84
|
+
this.getAttribute("style-type") ||
|
|
85
|
+
"filled"
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
set variant(val) {
|
|
89
|
+
this.setAttribute("variant", val);
|
|
90
|
+
}
|
|
91
|
+
|
|
73
92
|
// -------------------------------------------------------------------------
|
|
74
93
|
// Public
|
|
75
94
|
// -------------------------------------------------------------------------
|
|
@@ -104,7 +123,7 @@ class YumeTag extends HTMLElement {
|
|
|
104
123
|
});
|
|
105
124
|
}
|
|
106
125
|
|
|
107
|
-
_getCustomColorVariant(color,
|
|
126
|
+
_getCustomColorVariant(color, variant) {
|
|
108
127
|
const textColor = contrastTextColor(color);
|
|
109
128
|
const variants = {
|
|
110
129
|
filled: `
|
|
@@ -120,11 +139,11 @@ class YumeTag extends HTMLElement {
|
|
|
120
139
|
.remove { color: ${color}; }
|
|
121
140
|
`,
|
|
122
141
|
};
|
|
123
|
-
return variants[
|
|
142
|
+
return variants[variant] || variants.filled;
|
|
124
143
|
}
|
|
125
144
|
|
|
126
145
|
_getStyle() {
|
|
127
|
-
const { color,
|
|
146
|
+
const { color, variant, shape, size } = this;
|
|
128
147
|
|
|
129
148
|
const vars = {
|
|
130
149
|
primary: [
|
|
@@ -226,7 +245,7 @@ class YumeTag extends HTMLElement {
|
|
|
226
245
|
`;
|
|
227
246
|
|
|
228
247
|
if (isCustomColor)
|
|
229
|
-
return baseStyle + this._getCustomColorVariant(color,
|
|
248
|
+
return baseStyle + this._getCustomColorVariant(color, variant);
|
|
230
249
|
|
|
231
250
|
const [content, inverse, flatBackground] = varEntry || vars.base;
|
|
232
251
|
|
|
@@ -245,7 +264,16 @@ class YumeTag extends HTMLElement {
|
|
|
245
264
|
`,
|
|
246
265
|
};
|
|
247
266
|
|
|
248
|
-
return baseStyle + (styleVariants[
|
|
267
|
+
return baseStyle + (styleVariants[variant] || styleVariants.filled);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
_warnStyleTypeDeprecated() {
|
|
271
|
+
if (YumeTag._styleTypeDeprecationWarned) return;
|
|
272
|
+
|
|
273
|
+
YumeTag._styleTypeDeprecationWarned = true;
|
|
274
|
+
console.warn(
|
|
275
|
+
'y-tag: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
|
|
276
|
+
);
|
|
249
277
|
}
|
|
250
278
|
}
|
|
251
279
|
|
|
@@ -125,7 +125,10 @@ class YumeTextarea extends HTMLElement {
|
|
|
125
125
|
: "default";
|
|
126
126
|
}
|
|
127
127
|
set variant(val) {
|
|
128
|
-
this.setAttribute(
|
|
128
|
+
this.setAttribute(
|
|
129
|
+
"variant",
|
|
130
|
+
val === "underline" ? "underline" : "default",
|
|
131
|
+
);
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
/** @type {string} The current textarea value. */
|
|
@@ -182,6 +185,13 @@ class YumeTextarea extends HTMLElement {
|
|
|
182
185
|
// -------------------------------------------------------------------------
|
|
183
186
|
|
|
184
187
|
_bindTextareaListeners() {
|
|
188
|
+
this.inputContainer.addEventListener("mousedown", (e) => {
|
|
189
|
+
if (e.target !== this.textarea) {
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
this.textarea.focus();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
185
195
|
this.textarea.addEventListener("input", (e) => {
|
|
186
196
|
this.setAttribute("value", e.target.value);
|
|
187
197
|
this._internals.setFormValue(
|