@waggylabs/yumekit 0.2.4 → 0.2.6
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/README.md +0 -4
- package/dist/components/y-appbar.js +36 -29
- package/dist/components/y-button.js +1 -0
- package/dist/components/y-menu.d.ts +1 -27
- package/dist/components/y-menu.js +23 -4
- package/dist/components/y-panel.js +39 -21
- package/dist/components/y-slider.js +1 -1
- package/dist/components/y-tabs.js +0 -1
- package/dist/components/y-theme.d.ts +7 -0
- package/dist/components/y-theme.js +57 -28
- package/dist/icons/all.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +175 -122
- package/dist/styles/blue-dark.css +0 -2
- package/dist/styles/blue-light.css +0 -2
- package/dist/styles/orange-dark.css +0 -2
- package/dist/styles/orange-light.css +0 -2
- package/dist/styles/variables.css +0 -2
- package/dist/yumekit.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,10 +42,6 @@ npm install @waggylabs/yumekit
|
|
|
42
42
|
The IIFE bundle includes all components and icons. Drop it into any HTML page:
|
|
43
43
|
|
|
44
44
|
```html
|
|
45
|
-
<link
|
|
46
|
-
rel="stylesheet"
|
|
47
|
-
href="https://cdn.jsdelivr.net/npm/@waggylabs/yumekit/dist/styles/blue-light.css"
|
|
48
|
-
/>
|
|
49
45
|
<script src="https://cdn.jsdelivr.net/npm/@waggylabs/yumekit/dist/yumekit.min.js"></script>
|
|
50
46
|
|
|
51
47
|
<y-button color="primary">Click me</y-button>
|
|
@@ -221,6 +221,7 @@ class YumeButton extends HTMLElement {
|
|
|
221
221
|
.button {
|
|
222
222
|
box-sizing: border-box;
|
|
223
223
|
display: inline-flex;
|
|
224
|
+
width: 100%;
|
|
224
225
|
min-height: var(--button-min-height, var(--sizing-medium, 40px));
|
|
225
226
|
min-width: var(--button-min-width, var(--sizing-medium, 40px));
|
|
226
227
|
padding: var(--button-padding, var(--component-button-padding-medium));
|
|
@@ -836,6 +837,31 @@ if (!customElements.get("y-icon")) {
|
|
|
836
837
|
customElements.define("y-icon", YumeIcon);
|
|
837
838
|
}
|
|
838
839
|
|
|
840
|
+
/* ================================================================== */
|
|
841
|
+
/* Centralized SVG icon strings for the YumeKit component library. */
|
|
842
|
+
/* */
|
|
843
|
+
/* Each static icon also lives in its own .svg file in this directory */
|
|
844
|
+
/* so it can be used standalone (e.g. <img src="…">, CSS background, */
|
|
845
|
+
/* design tools, etc.). The strings below mirror those files — keep */
|
|
846
|
+
/* them in sync when editing an icon. */
|
|
847
|
+
/* ================================================================== */
|
|
848
|
+
|
|
849
|
+
/* ── Chevrons ─────────────────────────────────────────────────────── */
|
|
850
|
+
|
|
851
|
+
const chevronRight = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>`;
|
|
852
|
+
|
|
853
|
+
const chevronDown = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>`;
|
|
854
|
+
|
|
855
|
+
/* ── Double chevrons (collapse / expand) ──────────────────────────── */
|
|
856
|
+
|
|
857
|
+
const collapseLeft = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="11 17 6 12 11 7"/><polyline points="18 17 13 12 18 7"/></svg>`;
|
|
858
|
+
|
|
859
|
+
const expandRight = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="13 17 18 12 13 7"/><polyline points="6 17 11 12 6 7"/></svg>`;
|
|
860
|
+
|
|
861
|
+
/* ── Menu (hamburger) ────────────────────────────────────────────── */
|
|
862
|
+
|
|
863
|
+
const menu = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>`;
|
|
864
|
+
|
|
839
865
|
class YumeMenu extends HTMLElement {
|
|
840
866
|
static get observedAttributes() {
|
|
841
867
|
return ["items", "anchor", "visible", "direction", "size"];
|
|
@@ -972,10 +998,16 @@ class YumeMenu extends HTMLElement {
|
|
|
972
998
|
});
|
|
973
999
|
}
|
|
974
1000
|
|
|
1001
|
+
if (!item.children?.length) {
|
|
1002
|
+
li.addEventListener("click", () => {
|
|
1003
|
+
this.visible = false;
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
|
|
975
1007
|
if (item.children?.length) {
|
|
976
1008
|
const indicator = document.createElement("span");
|
|
977
1009
|
indicator.className = "submenu-indicator";
|
|
978
|
-
indicator.
|
|
1010
|
+
indicator.innerHTML = chevronRight;
|
|
979
1011
|
li.appendChild(indicator);
|
|
980
1012
|
|
|
981
1013
|
const submenu = this._createMenuList(item.children);
|
|
@@ -1129,8 +1161,6 @@ class YumeMenu extends HTMLElement {
|
|
|
1129
1161
|
border-radius: var(--component-menu-border-radius, 4px);
|
|
1130
1162
|
box-shadow: var(--component-menu-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
|
|
1131
1163
|
min-width: 150px;
|
|
1132
|
-
max-height: 300px;
|
|
1133
|
-
overflow-y: auto;
|
|
1134
1164
|
}
|
|
1135
1165
|
|
|
1136
1166
|
li.menuitem {
|
|
@@ -1142,6 +1172,7 @@ class YumeMenu extends HTMLElement {
|
|
|
1142
1172
|
white-space: nowrap;
|
|
1143
1173
|
color: var(--component-menu-color, #f7f7fa);
|
|
1144
1174
|
font-size: var(--font-size-button, 1em);
|
|
1175
|
+
position: relative;
|
|
1145
1176
|
}
|
|
1146
1177
|
|
|
1147
1178
|
li.menuitem:hover {
|
|
@@ -1161,7 +1192,8 @@ class YumeMenu extends HTMLElement {
|
|
|
1161
1192
|
}
|
|
1162
1193
|
|
|
1163
1194
|
.submenu-indicator {
|
|
1164
|
-
|
|
1195
|
+
display: inline-flex;
|
|
1196
|
+
align-items: center;
|
|
1165
1197
|
margin-left: 0.5rem;
|
|
1166
1198
|
opacity: 0.6;
|
|
1167
1199
|
}
|
|
@@ -1186,31 +1218,6 @@ if (!customElements.get("y-menu")) {
|
|
|
1186
1218
|
customElements.define("y-menu", YumeMenu);
|
|
1187
1219
|
}
|
|
1188
1220
|
|
|
1189
|
-
/* ================================================================== */
|
|
1190
|
-
/* Centralized SVG icon strings for the YumeKit component library. */
|
|
1191
|
-
/* */
|
|
1192
|
-
/* Each static icon also lives in its own .svg file in this directory */
|
|
1193
|
-
/* so it can be used standalone (e.g. <img src="…">, CSS background, */
|
|
1194
|
-
/* design tools, etc.). The strings below mirror those files — keep */
|
|
1195
|
-
/* them in sync when editing an icon. */
|
|
1196
|
-
/* ================================================================== */
|
|
1197
|
-
|
|
1198
|
-
/* ── Chevrons ─────────────────────────────────────────────────────── */
|
|
1199
|
-
|
|
1200
|
-
const chevronRight = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>`;
|
|
1201
|
-
|
|
1202
|
-
const chevronDown = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>`;
|
|
1203
|
-
|
|
1204
|
-
/* ── Double chevrons (collapse / expand) ──────────────────────────── */
|
|
1205
|
-
|
|
1206
|
-
const collapseLeft = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="11 17 6 12 11 7"/><polyline points="18 17 13 12 18 7"/></svg>`;
|
|
1207
|
-
|
|
1208
|
-
const expandRight = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="13 17 18 12 13 7"/><polyline points="6 17 11 12 6 7"/></svg>`;
|
|
1209
|
-
|
|
1210
|
-
/* ── Menu (hamburger) ────────────────────────────────────────────── */
|
|
1211
|
-
|
|
1212
|
-
const menu = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>`;
|
|
1213
|
-
|
|
1214
1221
|
class YumeAppbar extends HTMLElement {
|
|
1215
1222
|
static get observedAttributes() {
|
|
1216
1223
|
return [
|
|
@@ -219,6 +219,7 @@ class YumeButton extends HTMLElement {
|
|
|
219
219
|
.button {
|
|
220
220
|
box-sizing: border-box;
|
|
221
221
|
display: inline-flex;
|
|
222
|
+
width: 100%;
|
|
222
223
|
min-height: var(--button-min-height, var(--sizing-medium, 40px));
|
|
223
224
|
min-width: var(--button-min-width, var(--sizing-medium, 40px));
|
|
224
225
|
padding: var(--button-padding, var(--component-button-padding-medium));
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
static get observedAttributes(): string[];
|
|
3
|
-
static _closeAll(except: any): void;
|
|
4
|
-
_onAnchorClick(e: any): void;
|
|
5
|
-
_onDocumentClick(e: any): void;
|
|
6
|
-
_onScrollOrResize(): void;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
set items(val: any);
|
|
9
|
-
get items(): any;
|
|
10
|
-
disconnectedCallback(): void;
|
|
11
|
-
attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
|
|
12
|
-
set anchor(val: string);
|
|
13
|
-
get anchor(): string;
|
|
14
|
-
set visible(val: boolean);
|
|
15
|
-
get visible(): boolean;
|
|
16
|
-
set direction(val: string);
|
|
17
|
-
get direction(): string;
|
|
18
|
-
set size(val: string);
|
|
19
|
-
get size(): string;
|
|
20
|
-
_createMenuList(items: any): HTMLUListElement;
|
|
21
|
-
_findTemplate(name: any): Element;
|
|
22
|
-
_setupAnchor(): void;
|
|
23
|
-
_anchorEl: any;
|
|
24
|
-
_teardownAnchor(): void;
|
|
25
|
-
_updatePosition(): void;
|
|
26
|
-
render(): void;
|
|
27
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/* ================================================================== */
|
|
2
|
+
/* Centralized SVG icon strings for the YumeKit component library. */
|
|
3
|
+
/* */
|
|
4
|
+
/* Each static icon also lives in its own .svg file in this directory */
|
|
5
|
+
/* so it can be used standalone (e.g. <img src="…">, CSS background, */
|
|
6
|
+
/* design tools, etc.). The strings below mirror those files — keep */
|
|
7
|
+
/* them in sync when editing an icon. */
|
|
8
|
+
/* ================================================================== */
|
|
9
|
+
|
|
10
|
+
/* ── Chevrons ─────────────────────────────────────────────────────── */
|
|
11
|
+
|
|
12
|
+
const chevronRight = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>`;
|
|
13
|
+
|
|
1
14
|
class YumeMenu extends HTMLElement {
|
|
2
15
|
static get observedAttributes() {
|
|
3
16
|
return ["items", "anchor", "visible", "direction", "size"];
|
|
@@ -134,10 +147,16 @@ class YumeMenu extends HTMLElement {
|
|
|
134
147
|
});
|
|
135
148
|
}
|
|
136
149
|
|
|
150
|
+
if (!item.children?.length) {
|
|
151
|
+
li.addEventListener("click", () => {
|
|
152
|
+
this.visible = false;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
137
156
|
if (item.children?.length) {
|
|
138
157
|
const indicator = document.createElement("span");
|
|
139
158
|
indicator.className = "submenu-indicator";
|
|
140
|
-
indicator.
|
|
159
|
+
indicator.innerHTML = chevronRight;
|
|
141
160
|
li.appendChild(indicator);
|
|
142
161
|
|
|
143
162
|
const submenu = this._createMenuList(item.children);
|
|
@@ -291,8 +310,6 @@ class YumeMenu extends HTMLElement {
|
|
|
291
310
|
border-radius: var(--component-menu-border-radius, 4px);
|
|
292
311
|
box-shadow: var(--component-menu-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
|
|
293
312
|
min-width: 150px;
|
|
294
|
-
max-height: 300px;
|
|
295
|
-
overflow-y: auto;
|
|
296
313
|
}
|
|
297
314
|
|
|
298
315
|
li.menuitem {
|
|
@@ -304,6 +321,7 @@ class YumeMenu extends HTMLElement {
|
|
|
304
321
|
white-space: nowrap;
|
|
305
322
|
color: var(--component-menu-color, #f7f7fa);
|
|
306
323
|
font-size: var(--font-size-button, 1em);
|
|
324
|
+
position: relative;
|
|
307
325
|
}
|
|
308
326
|
|
|
309
327
|
li.menuitem:hover {
|
|
@@ -323,7 +341,8 @@ class YumeMenu extends HTMLElement {
|
|
|
323
341
|
}
|
|
324
342
|
|
|
325
343
|
.submenu-indicator {
|
|
326
|
-
|
|
344
|
+
display: inline-flex;
|
|
345
|
+
align-items: center;
|
|
327
346
|
margin-left: 0.5rem;
|
|
328
347
|
opacity: 0.6;
|
|
329
348
|
}
|
|
@@ -191,17 +191,13 @@ class YumePanel extends HTMLElement {
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
composed: true,
|
|
202
|
-
}),
|
|
203
|
-
);
|
|
204
|
-
}
|
|
194
|
+
this.dispatchEvent(
|
|
195
|
+
new CustomEvent("select", {
|
|
196
|
+
detail: { selected: true },
|
|
197
|
+
bubbles: true,
|
|
198
|
+
composed: true,
|
|
199
|
+
}),
|
|
200
|
+
);
|
|
205
201
|
});
|
|
206
202
|
|
|
207
203
|
header.addEventListener("keydown", (e) => {
|
|
@@ -211,6 +207,21 @@ class YumePanel extends HTMLElement {
|
|
|
211
207
|
}
|
|
212
208
|
});
|
|
213
209
|
|
|
210
|
+
const arrow = this.shadowRoot.querySelector(".arrow");
|
|
211
|
+
if (arrow) {
|
|
212
|
+
arrow.addEventListener("click", (e) => {
|
|
213
|
+
e.stopPropagation();
|
|
214
|
+
this.toggle();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
arrow.addEventListener("keydown", (e) => {
|
|
218
|
+
if (e.key === " " || e.key === "Enter") {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
this.toggle();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
214
225
|
const childrenSlot = this.shadowRoot.querySelector(
|
|
215
226
|
'slot[name="children"]',
|
|
216
227
|
);
|
|
@@ -254,13 +265,13 @@ class YumePanel extends HTMLElement {
|
|
|
254
265
|
|
|
255
266
|
updateExpandedState() {
|
|
256
267
|
const hasChildren = this.hasChildren();
|
|
257
|
-
const
|
|
268
|
+
const arrow = this.shadowRoot.querySelector(".arrow");
|
|
258
269
|
const isExpanded = this.expanded && hasChildren;
|
|
259
270
|
|
|
260
271
|
this._expanded = isExpanded;
|
|
261
272
|
|
|
262
|
-
if (
|
|
263
|
-
|
|
273
|
+
if (arrow) {
|
|
274
|
+
arrow.setAttribute("aria-expanded", String(isExpanded));
|
|
264
275
|
}
|
|
265
276
|
}
|
|
266
277
|
|
|
@@ -315,10 +326,6 @@ class YumePanel extends HTMLElement {
|
|
|
315
326
|
background: var(--component-panel-hover-background);
|
|
316
327
|
}
|
|
317
328
|
|
|
318
|
-
:host([data-has-children="false"]) .header {
|
|
319
|
-
cursor: default;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
329
|
.header ::slotted([slot="icon"]) {
|
|
323
330
|
margin-right: 6px;
|
|
324
331
|
}
|
|
@@ -335,6 +342,17 @@ class YumePanel extends HTMLElement {
|
|
|
335
342
|
align-items: center;
|
|
336
343
|
justify-content: center;
|
|
337
344
|
transition: transform 0.2s ease;
|
|
345
|
+
background: none;
|
|
346
|
+
border: none;
|
|
347
|
+
padding: 0;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
color: inherit;
|
|
350
|
+
flex-shrink: 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.arrow:focus-visible {
|
|
354
|
+
outline: 2px solid var(--component-panel-accent, currentColor);
|
|
355
|
+
border-radius: 2px;
|
|
338
356
|
}
|
|
339
357
|
|
|
340
358
|
.arrow svg {
|
|
@@ -369,12 +387,12 @@ class YumePanel extends HTMLElement {
|
|
|
369
387
|
|
|
370
388
|
this.shadowRoot.adoptedStyleSheets = [sheet];
|
|
371
389
|
this.shadowRoot.innerHTML = `
|
|
372
|
-
<div class="header" part="header" role="button" tabindex="0"
|
|
390
|
+
<div class="header" part="header" role="button" tabindex="0">
|
|
373
391
|
<slot name="icon"></slot>
|
|
374
392
|
<slot name="label"><slot></slot></slot>
|
|
375
|
-
<
|
|
393
|
+
<button class="arrow" id="arrow" part="arrow" tabindex="0" aria-expanded="false" aria-label="Toggle children">
|
|
376
394
|
${chevronDown}
|
|
377
|
-
</
|
|
395
|
+
</button>
|
|
378
396
|
</div>
|
|
379
397
|
<div class="children" id="childrenContainer" part="children">
|
|
380
398
|
<slot name="children"></slot>
|
|
@@ -300,11 +300,11 @@ class YumeSlider extends HTMLElement {
|
|
|
300
300
|
<style>
|
|
301
301
|
:host {
|
|
302
302
|
display: inline-block;
|
|
303
|
-
width: var(--component-slider-width, 129px);
|
|
304
303
|
font-family: var(--font-family-body);
|
|
305
304
|
color: var(--base-content--);
|
|
306
305
|
opacity: ${isDisabled ? "0.5" : "1"};
|
|
307
306
|
pointer-events: ${isDisabled ? "none" : "auto"};
|
|
307
|
+
min-width: 100px;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.slider-wrapper {
|
|
@@ -129,7 +129,6 @@ class YumeTabs extends HTMLElement {
|
|
|
129
129
|
return `
|
|
130
130
|
:host {
|
|
131
131
|
display: flex;
|
|
132
|
-
font-family: var(--component-tabs-font-family, var(--font-family-body));
|
|
133
132
|
}
|
|
134
133
|
:host([position="top"]) { flex-direction: column; }
|
|
135
134
|
:host([position="bottom"]) { flex-direction: column-reverse; }
|
|
@@ -2,7 +2,14 @@ export class YumeTheme extends HTMLElement {
|
|
|
2
2
|
static get observedAttributes(): string[];
|
|
3
3
|
connectedCallback(): void;
|
|
4
4
|
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
5
|
+
set crossOrigin(val: boolean);
|
|
6
|
+
/** Whether cross-origin theme-path URLs are allowed. */
|
|
7
|
+
get crossOrigin(): boolean;
|
|
5
8
|
_applyTheme(): Promise<void>;
|
|
9
|
+
/** Resolves theme CSS from either a remote path or the built-in theme map. */
|
|
10
|
+
_resolveThemeCSS(): Promise<any>;
|
|
11
|
+
/** Rebuilds the shadow DOM with base variables, optional theme styles, and a slot. */
|
|
12
|
+
_buildShadowDOM(themeCSS: any): void;
|
|
6
13
|
/**
|
|
7
14
|
* Parses CSS custom properties from the given text and sets them on the host element.
|
|
8
15
|
* @param {string} cssText - Raw CSS containing custom property declarations.
|