@studious-creative/yumekit 0.1.4 → 0.1.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/dist/components/y-appbar.js +57 -45
- package/dist/components/y-avatar.js +2 -2
- package/dist/components/y-badge.d.ts +1 -1
- package/dist/components/y-badge.js +11 -11
- package/dist/components/y-button.js +37 -30
- package/dist/components/y-dialog.js +5 -2
- package/dist/components/y-drawer.js +13 -8
- package/dist/components/y-menu.js +6 -4
- package/dist/components/y-radio.js +2 -2
- package/dist/components/y-switch.js +2 -2
- package/dist/components/y-table.js +14 -10
- package/dist/components/y-tabs.js +4 -1
- package/dist/components/y-tag.js +12 -5
- package/dist/components/y-theme.d.ts +2 -0
- package/dist/components/y-theme.js +19 -6
- package/dist/components/y-toast.js +3 -0
- package/dist/components/y-tooltip.js +1 -1
- package/dist/index.js +149 -96
- package/dist/modules/load-defaults.d.ts +1 -0
- package/dist/modules/load-defaults.js +45 -0
- package/dist/styles/blue-dark.css +16 -1
- package/dist/styles/blue-light.css +15 -0
- package/dist/styles/orange-dark.css +17 -2
- package/dist/styles/orange-light.css +15 -0
- package/dist/styles/style.css +1 -13
- package/dist/styles/variables.css +140 -0
- package/dist/yumekit.min.js +1 -1
- package/package.json +1 -1
|
@@ -279,8 +279,8 @@ class YumeDrawer extends HTMLElement {
|
|
|
279
279
|
|
|
280
280
|
.drawer-panel {
|
|
281
281
|
position: absolute;
|
|
282
|
-
background: var(--component-drawer-background, #
|
|
283
|
-
color: var(--component-drawer-color, #
|
|
282
|
+
background: var(--component-drawer-background, #0c0c0d);
|
|
283
|
+
color: var(--component-drawer-color, #f7f7fa);
|
|
284
284
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
|
|
285
285
|
overflow: hidden;
|
|
286
286
|
outline: none;
|
|
@@ -301,12 +301,12 @@ class YumeDrawer extends HTMLElement {
|
|
|
301
301
|
.drawer-panel[data-position="left"] {
|
|
302
302
|
left: 0;
|
|
303
303
|
transform: translateX(-100%);
|
|
304
|
-
border-right: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #
|
|
304
|
+
border-right: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #37383a);
|
|
305
305
|
}
|
|
306
306
|
.drawer-panel[data-position="right"] {
|
|
307
307
|
right: 0;
|
|
308
308
|
transform: translateX(100%);
|
|
309
|
-
border-left: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #
|
|
309
|
+
border-left: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #37383a);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
.drawer-panel[data-position="top"],
|
|
@@ -318,12 +318,12 @@ class YumeDrawer extends HTMLElement {
|
|
|
318
318
|
.drawer-panel[data-position="top"] {
|
|
319
319
|
top: 0;
|
|
320
320
|
transform: translateY(-100%);
|
|
321
|
-
border-bottom: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #
|
|
321
|
+
border-bottom: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #37383a);
|
|
322
322
|
}
|
|
323
323
|
.drawer-panel[data-position="bottom"] {
|
|
324
324
|
bottom: 0;
|
|
325
325
|
transform: translateY(100%);
|
|
326
|
-
border-top: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #
|
|
326
|
+
border-top: var(--component-drawer-border-width, 2px) solid var(--component-drawer-border-color, #37383a);
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
.drawer-panel.open { transform: translate(0, 0); }
|
|
@@ -360,7 +360,7 @@ class YumeDrawer extends HTMLElement {
|
|
|
360
360
|
flex-shrink: 0;
|
|
361
361
|
align-items: center;
|
|
362
362
|
justify-content: center;
|
|
363
|
-
color: var(--component-drawer-color, #
|
|
363
|
+
color: var(--component-drawer-color, #f7f7fa);
|
|
364
364
|
opacity: 0.6;
|
|
365
365
|
touch-action: none; /* needed for pointer events */
|
|
366
366
|
user-select: none;
|
|
@@ -369,7 +369,7 @@ class YumeDrawer extends HTMLElement {
|
|
|
369
369
|
.resize-handle:hover,
|
|
370
370
|
.resize-handle:active {
|
|
371
371
|
opacity: 1;
|
|
372
|
-
background: var(--component-drawer-hover-background,
|
|
372
|
+
background: var(--component-drawer-hover-background, #292a2b);
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
.drawer-panel[data-position="left"] > .resize-handle,
|
|
@@ -402,6 +402,7 @@ class YumeDrawer extends HTMLElement {
|
|
|
402
402
|
|
|
403
403
|
const overlay = document.createElement("div");
|
|
404
404
|
overlay.className = "overlay";
|
|
405
|
+
overlay.setAttribute("part", "overlay");
|
|
405
406
|
overlay.addEventListener("click", () => this._onOverlayClick());
|
|
406
407
|
this.shadowRoot.appendChild(overlay);
|
|
407
408
|
|
|
@@ -410,6 +411,7 @@ class YumeDrawer extends HTMLElement {
|
|
|
410
411
|
panel.setAttribute("role", "dialog");
|
|
411
412
|
panel.setAttribute("aria-modal", "true");
|
|
412
413
|
panel.setAttribute("tabindex", "-1");
|
|
414
|
+
panel.setAttribute("part", "panel");
|
|
413
415
|
panel.setAttribute("data-position", this.position);
|
|
414
416
|
|
|
415
417
|
const handle = document.createElement("div");
|
|
@@ -424,14 +426,17 @@ class YumeDrawer extends HTMLElement {
|
|
|
424
426
|
|
|
425
427
|
const header = document.createElement("div");
|
|
426
428
|
header.className = "drawer-header";
|
|
429
|
+
header.setAttribute("part", "header");
|
|
427
430
|
header.innerHTML = `<slot name="header"></slot>`;
|
|
428
431
|
|
|
429
432
|
const body = document.createElement("div");
|
|
430
433
|
body.className = "drawer-body";
|
|
434
|
+
body.setAttribute("part", "body");
|
|
431
435
|
body.innerHTML = `<slot name="body"></slot>`;
|
|
432
436
|
|
|
433
437
|
const footer = document.createElement("div");
|
|
434
438
|
footer.className = "drawer-footer";
|
|
439
|
+
footer.setAttribute("part", "footer");
|
|
435
440
|
footer.innerHTML = `<slot name="footer"></slot>`;
|
|
436
441
|
|
|
437
442
|
content.appendChild(header);
|
|
@@ -95,6 +95,7 @@ class YumeMenu extends HTMLElement {
|
|
|
95
95
|
const li = document.createElement("li");
|
|
96
96
|
li.className = "menuitem";
|
|
97
97
|
li.setAttribute("role", "menuitem");
|
|
98
|
+
li.setAttribute("part", "menuitem");
|
|
98
99
|
li.tabIndex = 0;
|
|
99
100
|
|
|
100
101
|
const contentWrapper = document.createElement("span");
|
|
@@ -239,8 +240,8 @@ class YumeMenu extends HTMLElement {
|
|
|
239
240
|
list-style: none;
|
|
240
241
|
margin: 0;
|
|
241
242
|
padding: 0;
|
|
242
|
-
background: var(--component-menu-background, #
|
|
243
|
-
border: var(--component-menu-border-width, 1px) solid var(--component-menu-border-color, #
|
|
243
|
+
background: var(--component-menu-background, #0c0c0d);
|
|
244
|
+
border: var(--component-menu-border-width, 1px) solid var(--component-menu-border-color, #37383a);
|
|
244
245
|
border-radius: var(--component-menu-border-radius, 4px);
|
|
245
246
|
box-shadow: var(--component-menu-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
|
|
246
247
|
min-width: 150px;
|
|
@@ -255,12 +256,12 @@ class YumeMenu extends HTMLElement {
|
|
|
255
256
|
align-items: center;
|
|
256
257
|
justify-content: space-between;
|
|
257
258
|
white-space: nowrap;
|
|
258
|
-
color: var(--component-menu-color, #
|
|
259
|
+
color: var(--component-menu-color, #f7f7fa);
|
|
259
260
|
font-size: var(--font-size-button, 1em);
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
li.menuitem:hover {
|
|
263
|
-
background: var(--component-menu-hover-background, #
|
|
264
|
+
background: var(--component-menu-hover-background, #292a2b);
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
ul.submenu {
|
|
@@ -290,6 +291,7 @@ class YumeMenu extends HTMLElement {
|
|
|
290
291
|
const rootUl = this._createMenuList(this.items);
|
|
291
292
|
rootUl.classList.add("menu");
|
|
292
293
|
rootUl.setAttribute("role", "menu");
|
|
294
|
+
rootUl.setAttribute("part", "menu");
|
|
293
295
|
this.shadowRoot.appendChild(rootUl);
|
|
294
296
|
}
|
|
295
297
|
}
|
|
@@ -152,11 +152,11 @@ class YumeRadio extends HTMLElement {
|
|
|
152
152
|
|
|
153
153
|
this.shadowRoot.innerHTML = `
|
|
154
154
|
<style>${style}</style>
|
|
155
|
-
<fieldset role="radiogroup">
|
|
155
|
+
<fieldset role="radiogroup" part="radio">
|
|
156
156
|
${options
|
|
157
157
|
.map(
|
|
158
158
|
(opt, idx) => `
|
|
159
|
-
<label>
|
|
159
|
+
<label part="label">
|
|
160
160
|
<input
|
|
161
161
|
type="radio"
|
|
162
162
|
name="${name}"
|
|
@@ -75,6 +75,7 @@ class YumeSwitch extends HTMLElement {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
labelTag(pos) {
|
|
78
|
+
if (this.getAttribute("label-display") === "false") return "";
|
|
78
79
|
const labelPos = this.getAttribute("label-position");
|
|
79
80
|
const shouldRender =
|
|
80
81
|
(pos === "top" && (labelPos === "top" || labelPos === "left")) ||
|
|
@@ -169,13 +170,12 @@ class YumeSwitch extends HTMLElement {
|
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
updateLabelDisplay() {
|
|
172
|
-
const showLabels = this.getAttribute("label-display") !== "false";
|
|
173
173
|
const showToggleLabels =
|
|
174
174
|
this.hasAttribute("toggle-label") &&
|
|
175
175
|
this.getAttribute("toggle-label") !== "false";
|
|
176
176
|
this.style.setProperty(
|
|
177
177
|
"--show-labels",
|
|
178
|
-
|
|
178
|
+
showToggleLabels ? "flex" : "none",
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -150,12 +150,12 @@ class YumeTable extends HTMLElement {
|
|
|
150
150
|
|
|
151
151
|
const topColor =
|
|
152
152
|
dir === "asc"
|
|
153
|
-
? "var(--component-table-color, #
|
|
154
|
-
: "var(--component-table-color-light, #
|
|
153
|
+
? "var(--component-table-color, #f7f7fa)"
|
|
154
|
+
: "var(--component-table-color-light, #acaeb2)";
|
|
155
155
|
const bottomColor =
|
|
156
156
|
dir === "desc"
|
|
157
|
-
? "var(--component-table-color, #
|
|
158
|
-
: "var(--component-table-color-light, #
|
|
157
|
+
? "var(--component-table-color, #f7f7fa)"
|
|
158
|
+
: "var(--component-table-color-light, #acaeb2)";
|
|
159
159
|
|
|
160
160
|
return sortArrows(topColor, bottomColor);
|
|
161
161
|
}
|
|
@@ -175,7 +175,7 @@ class YumeTable extends HTMLElement {
|
|
|
175
175
|
:host {
|
|
176
176
|
display: block;
|
|
177
177
|
font-family: var(--font-family-body, sans-serif);
|
|
178
|
-
color: var(--component-table-color, #
|
|
178
|
+
color: var(--component-table-color, #f7f7fa);
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
.table-wrapper {
|
|
@@ -196,7 +196,7 @@ class YumeTable extends HTMLElement {
|
|
|
196
196
|
font-size: var(--font-size-paragraph, 1em);
|
|
197
197
|
white-space: nowrap;
|
|
198
198
|
background: transparent;
|
|
199
|
-
border-bottom: var(--component-table-border-width-header, 2px) solid var(--component-table-border-color, #
|
|
199
|
+
border-bottom: var(--component-table-border-width-header, 2px) solid var(--component-table-border-color, #37383a);
|
|
200
200
|
user-select: none;
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -205,7 +205,7 @@ class YumeTable extends HTMLElement {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
thead th.sortable:hover {
|
|
208
|
-
background: var(--component-table-hover-background, #
|
|
208
|
+
background: var(--component-table-hover-background, #292a2b);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
.th-content {
|
|
@@ -222,7 +222,7 @@ class YumeTable extends HTMLElement {
|
|
|
222
222
|
tbody td {
|
|
223
223
|
padding: ${paddingVar};
|
|
224
224
|
font-size: var(--font-size-paragraph, 1em);
|
|
225
|
-
border-bottom: var(--component-table-border-width, 2px) solid var(--component-table-border-color, #
|
|
225
|
+
border-bottom: var(--component-table-border-width, 2px) solid var(--component-table-border-color, #37383a);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
tbody tr:last-child td {
|
|
@@ -236,13 +236,13 @@ class YumeTable extends HTMLElement {
|
|
|
236
236
|
${
|
|
237
237
|
striped
|
|
238
238
|
? `tbody tr:nth-child(even) {
|
|
239
|
-
background: var(--component-table-hover-background, #
|
|
239
|
+
background: var(--component-table-hover-background, #292a2b);
|
|
240
240
|
}`
|
|
241
241
|
: ""
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
tbody tr:hover {
|
|
245
|
-
background: var(--component-table-active-background, #
|
|
245
|
+
background: var(--component-table-active-background, #46474a);
|
|
246
246
|
}
|
|
247
247
|
`;
|
|
248
248
|
this.shadowRoot.appendChild(style);
|
|
@@ -252,8 +252,10 @@ class YumeTable extends HTMLElement {
|
|
|
252
252
|
|
|
253
253
|
const table = document.createElement("table");
|
|
254
254
|
table.setAttribute("role", "grid");
|
|
255
|
+
table.setAttribute("part", "table");
|
|
255
256
|
|
|
256
257
|
const thead = document.createElement("thead");
|
|
258
|
+
thead.setAttribute("part", "header");
|
|
257
259
|
const headerRow = document.createElement("tr");
|
|
258
260
|
|
|
259
261
|
columns.forEach((col) => {
|
|
@@ -299,8 +301,10 @@ class YumeTable extends HTMLElement {
|
|
|
299
301
|
|
|
300
302
|
rows.forEach((row) => {
|
|
301
303
|
const tr = document.createElement("tr");
|
|
304
|
+
tr.setAttribute("part", "row");
|
|
302
305
|
columns.forEach((col, colIdx) => {
|
|
303
306
|
const td = document.createElement("td");
|
|
307
|
+
td.setAttribute("part", "cell");
|
|
304
308
|
if (col.rowHeader || colIdx === 0) {
|
|
305
309
|
td.classList.add("row-header");
|
|
306
310
|
}
|
|
@@ -190,7 +190,7 @@ class YumeTabs extends HTMLElement {
|
|
|
190
190
|
z-index: 0;
|
|
191
191
|
border: var(--component-tab-border-width) solid var(--component-tabs-border-color);
|
|
192
192
|
border-radius: var(--component-tab-border-radius-outer);
|
|
193
|
-
padding: var(--
|
|
193
|
+
padding: var(--component-tab-content-padding);
|
|
194
194
|
background: var(--component-tabs-background);
|
|
195
195
|
}
|
|
196
196
|
:host([position="top"]) .tabpanel { border-top-left-radius: 0; }
|
|
@@ -210,6 +210,7 @@ class YumeTabs extends HTMLElement {
|
|
|
210
210
|
const btn = document.createElement("button");
|
|
211
211
|
btn.id = `tab-${tab.id}`;
|
|
212
212
|
btn.setAttribute("role", "tab");
|
|
213
|
+
btn.setAttribute("part", "tab");
|
|
213
214
|
btn.setAttribute("aria-selected", isActive);
|
|
214
215
|
btn.setAttribute("aria-controls", `panel-${tab.id}`);
|
|
215
216
|
btn.setAttribute("aria-disabled", isDisabled);
|
|
@@ -244,6 +245,7 @@ class YumeTabs extends HTMLElement {
|
|
|
244
245
|
panel.className = "tabpanel";
|
|
245
246
|
panel.id = `panel-${this._activeTab}`;
|
|
246
247
|
panel.setAttribute("role", "tabpanel");
|
|
248
|
+
panel.setAttribute("part", "content");
|
|
247
249
|
panel.setAttribute("aria-labelledby", `tab-${this._activeTab}`);
|
|
248
250
|
|
|
249
251
|
const contentSlot = document.createElement("slot");
|
|
@@ -267,6 +269,7 @@ class YumeTabs extends HTMLElement {
|
|
|
267
269
|
const tablist = document.createElement("div");
|
|
268
270
|
tablist.className = "tablist";
|
|
269
271
|
tablist.setAttribute("role", "tablist");
|
|
272
|
+
tablist.setAttribute("part", "tablist");
|
|
270
273
|
tabs.forEach((tab) => tablist.appendChild(this._createTabButton(tab)));
|
|
271
274
|
this.shadowRoot.appendChild(tablist);
|
|
272
275
|
|
package/dist/components/y-tag.js
CHANGED
|
@@ -43,12 +43,12 @@ class YumeTag extends HTMLElement {
|
|
|
43
43
|
this.shadowRoot.innerHTML = "";
|
|
44
44
|
this.shadowRoot.appendChild(style);
|
|
45
45
|
this.shadowRoot.innerHTML += `
|
|
46
|
-
<span class="tag">
|
|
46
|
+
<span class="tag" part="tag">
|
|
47
47
|
<slot></slot>
|
|
48
48
|
${
|
|
49
49
|
removable
|
|
50
50
|
? `
|
|
51
|
-
<button class="remove" aria-label="Remove tag">
|
|
51
|
+
<button class="remove" part="remove" aria-label="Remove tag">
|
|
52
52
|
${close}
|
|
53
53
|
</button>
|
|
54
54
|
`
|
|
@@ -78,40 +78,47 @@ class YumeTag extends HTMLElement {
|
|
|
78
78
|
"--primary-content--",
|
|
79
79
|
"--primary-content-hover",
|
|
80
80
|
"--primary-background-component",
|
|
81
|
+
"--primary-content-inverse",
|
|
81
82
|
],
|
|
82
83
|
secondary: [
|
|
83
84
|
"--secondary-content--",
|
|
84
85
|
"--secondary-content-hover",
|
|
85
86
|
"--secondary-background-component",
|
|
87
|
+
"--secondary-content-inverse",
|
|
86
88
|
],
|
|
87
89
|
base: [
|
|
88
90
|
"--base-content--",
|
|
89
91
|
"--base-content-lighter",
|
|
90
92
|
"--base-background-component",
|
|
93
|
+
"--base-content-inverse",
|
|
91
94
|
],
|
|
92
95
|
success: [
|
|
93
96
|
"--success-content--",
|
|
94
97
|
"--success-content-hover",
|
|
95
98
|
"--success-background-component",
|
|
99
|
+
"--success-content-inverse",
|
|
96
100
|
],
|
|
97
101
|
error: [
|
|
98
102
|
"--error-content--",
|
|
99
103
|
"--error-content-hover",
|
|
100
104
|
"--error-background-component",
|
|
105
|
+
"--error-content-inverse",
|
|
101
106
|
],
|
|
102
107
|
warning: [
|
|
103
108
|
"--warning-content--",
|
|
104
109
|
"--warning-content-hover",
|
|
105
110
|
"--warning-background-component",
|
|
111
|
+
"--warning-content-inverse",
|
|
106
112
|
],
|
|
107
113
|
help: [
|
|
108
114
|
"--help-content--",
|
|
109
115
|
"--help-content-hover",
|
|
110
116
|
"--help-background-component",
|
|
117
|
+
"--help-content-inverse",
|
|
111
118
|
],
|
|
112
119
|
};
|
|
113
120
|
|
|
114
|
-
const [content, hover, background] = vars[color] || vars.base;
|
|
121
|
+
const [content, hover, background, inverse] = vars[color] || vars.base;
|
|
115
122
|
|
|
116
123
|
const borderRadius =
|
|
117
124
|
shape === "round"
|
|
@@ -148,10 +155,10 @@ class YumeTag extends HTMLElement {
|
|
|
148
155
|
filled: `
|
|
149
156
|
.tag {
|
|
150
157
|
background: var(${content});
|
|
151
|
-
color: var(${
|
|
158
|
+
color: var(${inverse});
|
|
152
159
|
}
|
|
153
160
|
.remove {
|
|
154
|
-
color: var(${
|
|
161
|
+
color: var(${inverse});
|
|
155
162
|
}
|
|
156
163
|
`,
|
|
157
164
|
outlined: `
|