@albi_scando/as-design-system-lib 1.1.3 → 1.2.0
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/as-design-system-lib.es.js +452 -134
- package/dist/as-design-system-lib.umd.js +23 -8
- package/dist/types/main.d.ts +3 -0
- package/dist/types/web-components/buttons/next-button/component.d.ts +35 -0
- package/dist/types/web-components/buttons/next-button/main.d.ts +2 -0
- package/dist/types/web-components/buttons/next-button/selector.d.ts +4 -0
- package/dist/types/web-components/buttons/previous-button/component.d.ts +35 -0
- package/dist/types/web-components/buttons/previous-button/main.d.ts +2 -0
- package/dist/types/web-components/buttons/previous-button/selector.d.ts +4 -0
- package/dist/types/web-components/menus/bar-menu/component.d.ts +114 -0
- package/dist/types/web-components/menus/bar-menu/main.d.ts +2 -0
- package/dist/types/web-components/menus/bar-menu/selector.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const G = "as-design-system-lib";
|
|
2
|
+
class J {
|
|
3
3
|
/**
|
|
4
4
|
* Creates an instance of WebComponentsRegistry.
|
|
5
5
|
* Registers all custom elements provided in the map of components.
|
|
@@ -19,8 +19,8 @@ class C {
|
|
|
19
19
|
* @returns {void}
|
|
20
20
|
*/
|
|
21
21
|
registerAllComponents(t) {
|
|
22
|
-
Array.from(t.entries()).forEach(([
|
|
23
|
-
this.registerComponent(
|
|
22
|
+
Array.from(t.entries()).forEach(([e, s]) => {
|
|
23
|
+
this.registerComponent(e, s);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -32,14 +32,14 @@ class C {
|
|
|
32
32
|
* @param {CustomElementConstructor} component - The constructor of the custom component to be registered.
|
|
33
33
|
* @returns {void}
|
|
34
34
|
*/
|
|
35
|
-
registerComponent(t,
|
|
36
|
-
customElements.get(t) === void 0 ? (customElements.define(t,
|
|
35
|
+
registerComponent(t, e) {
|
|
36
|
+
customElements.get(t) === void 0 ? (customElements.define(t, e), console.log(`Registered Web Component: ${t}`)) : console.warn(`Web Component "${t}" is already registered.`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const Q = "base-button", r = "", c = {
|
|
40
40
|
SHOW_MODAL: "show-modal",
|
|
41
41
|
CLOSE: "close"
|
|
42
|
-
},
|
|
42
|
+
}, M = {
|
|
43
43
|
CUSTOM_CROSSHAIR: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
44
44
|
<!-- White border (underneath) -->
|
|
45
45
|
<line x1="16" y1="2" x2="16" y2="30" stroke="white" stroke-width="5"/>
|
|
@@ -50,18 +50,20 @@ const O = "base-button", i = "", n = {
|
|
|
50
50
|
<line x1="2" y1="16" x2="30" y2="16" stroke="black" stroke-width="2"/>
|
|
51
51
|
</svg>`
|
|
52
52
|
};
|
|
53
|
-
`${btoa(
|
|
54
|
-
const
|
|
53
|
+
`${btoa(M.CUSTOM_CROSSHAIR)}`;
|
|
54
|
+
const y = {
|
|
55
55
|
ANY: "any",
|
|
56
56
|
NONE: "none"
|
|
57
|
-
},
|
|
57
|
+
}, f = {
|
|
58
|
+
KEY_DOWN: "keydown"
|
|
59
|
+
}, g = {
|
|
58
60
|
CLICK: "click"
|
|
59
|
-
},
|
|
61
|
+
}, N = `<button part="button">
|
|
60
62
|
<slot></slot>
|
|
61
63
|
</button>
|
|
62
|
-
`,
|
|
63
|
-
|
|
64
|
-
class
|
|
64
|
+
`, T = ":where(button,input[type=button],input[type=submit],input[type=reset]),:where(input[type=file])::file-selector-button{cursor:pointer;touch-action:manipulation;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);font-family:var(--font-family-base);letter-spacing:var(--letter-spacing-normal);line-height:var(--line-height-normal);background:var(--color-primary);color:var(--color-text-primary);border:var(--border-width-0) solid transparent;border-radius:var(--border-radius-lg);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);display:inline-flex;justify-content:center;align-items:center;text-align:center;gap:var(--gap-sm);box-shadow:var(--shadow-md);transition:all var(--transition-base);-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}:where(button,input[type=button],input[type=submit],input[type=reset])>:where(svg,[data-icon]){block-size:var(--font-size-md);inline-size:var(--font-size-md);stroke:var(--icon-color, currentColor);flex-shrink:0;fill:none;stroke-linecap:round;stroke-linejoin:round;transition:transform var(--transition-fast)}:where(button,input[type=button],input[type=submit],input[type=reset])>.material-symbols-outlined{font-size:var(--font-size-xl);font-family:Material Symbols Outlined;font-weight:400;font-style:normal;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;fill:currentColor;stroke:none}:where(button,input):where(:not(:active)):focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:active):hover){background:var(--color-primary-light);box-shadow:var(--shadow-lg);transform:translateY(-1px)}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:active){background:var(--color-primary-dark);box-shadow:var(--shadow-md);transform:translateY(0)}:where(button,input[type=button],input[type=submit],input[type=reset])[disabled]{opacity:.6;box-shadow:var(--shadow-none);opacity:.3;cursor:not-allowed;box-shadow:var(--_shadow-1)}:where([type=reset]):focus-visible{outline-color:currentColor}:where(input[type=file]){inline-size:100%;max-inline-size:max-content;background-color:var(--color-bg-secondary)}:where(input[type=button]),:where(input[type=file])::file-selector-button{appearance:none}:where(input[type=file])::file-selector-button{margin-inline-end:var(--button-padding-inline-md)}", A = new CSSStyleSheet();
|
|
65
|
+
A.replaceSync(T);
|
|
66
|
+
class i extends HTMLElement {
|
|
65
67
|
/**
|
|
66
68
|
* @see HTMLButtonElement.autofocus
|
|
67
69
|
*/
|
|
@@ -99,73 +101,73 @@ class e extends HTMLElement {
|
|
|
99
101
|
* @ignore
|
|
100
102
|
*/
|
|
101
103
|
constructor() {
|
|
102
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(
|
|
104
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(A);
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* Specifies which attributes should be observed for changes.
|
|
106
108
|
*/
|
|
107
109
|
static get observedAttributes() {
|
|
108
110
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
i.autofocusAttribute,
|
|
112
|
+
i.commandAttribute,
|
|
113
|
+
i.commandforAttribute,
|
|
114
|
+
i.disabledAttribute,
|
|
115
|
+
i.nameAttribute,
|
|
116
|
+
i.titleAttribute,
|
|
117
|
+
i.typeAttribute,
|
|
118
|
+
i.valueAttribute
|
|
117
119
|
];
|
|
118
120
|
}
|
|
119
121
|
get buttonElement() {
|
|
120
122
|
return this.shadowRoot?.querySelector("button");
|
|
121
123
|
}
|
|
122
124
|
get autofocus() {
|
|
123
|
-
return this.hasAttribute(
|
|
125
|
+
return this.hasAttribute(i.autofocusAttribute);
|
|
124
126
|
}
|
|
125
127
|
set autofocus(t) {
|
|
126
|
-
t ? this.setAttribute(
|
|
128
|
+
t ? this.setAttribute(i.autofocusAttribute, r) : this.removeAttribute(i.autofocusAttribute);
|
|
127
129
|
}
|
|
128
130
|
get command() {
|
|
129
|
-
return this.getAttribute(
|
|
131
|
+
return this.getAttribute(i.commandAttribute) ?? r;
|
|
130
132
|
}
|
|
131
133
|
set command(t) {
|
|
132
|
-
this.setAttribute(
|
|
134
|
+
this.setAttribute(i.commandAttribute, t);
|
|
133
135
|
}
|
|
134
136
|
get commandfor() {
|
|
135
|
-
return this.getAttribute(
|
|
137
|
+
return this.getAttribute(i.commandforAttribute) ?? r;
|
|
136
138
|
}
|
|
137
139
|
set commandfor(t) {
|
|
138
|
-
t !==
|
|
140
|
+
t !== r ? this.setAttribute(i.commandforAttribute, t) : this.removeAttribute(i.commandforAttribute);
|
|
139
141
|
}
|
|
140
142
|
get disabled() {
|
|
141
|
-
return this.hasAttribute(
|
|
143
|
+
return this.hasAttribute(i.disabledAttribute);
|
|
142
144
|
}
|
|
143
145
|
set disabled(t) {
|
|
144
|
-
t ? this.setAttribute(
|
|
146
|
+
t ? this.setAttribute(i.disabledAttribute, r) : this.removeAttribute(i.disabledAttribute);
|
|
145
147
|
}
|
|
146
148
|
get name() {
|
|
147
|
-
return this.getAttribute(
|
|
149
|
+
return this.getAttribute(i.nameAttribute) ?? r;
|
|
148
150
|
}
|
|
149
151
|
set name(t) {
|
|
150
|
-
t !==
|
|
152
|
+
t !== r ? this.setAttribute(i.nameAttribute, t) : this.removeAttribute(i.nameAttribute);
|
|
151
153
|
}
|
|
152
154
|
get headline() {
|
|
153
|
-
return this.getAttribute(
|
|
155
|
+
return this.getAttribute(i.titleAttribute) ?? r;
|
|
154
156
|
}
|
|
155
157
|
set headline(t) {
|
|
156
|
-
t !==
|
|
158
|
+
t !== r ? this.setAttribute(i.titleAttribute, t) : this.removeAttribute(i.titleAttribute);
|
|
157
159
|
}
|
|
158
160
|
get type() {
|
|
159
|
-
return this.getAttribute(
|
|
161
|
+
return this.getAttribute(i.typeAttribute) ?? "button";
|
|
160
162
|
}
|
|
161
163
|
set type(t) {
|
|
162
|
-
t !==
|
|
164
|
+
t !== r ? this.setAttribute(i.typeAttribute, t) : this.removeAttribute(i.typeAttribute);
|
|
163
165
|
}
|
|
164
166
|
get value() {
|
|
165
|
-
return this.getAttribute(
|
|
167
|
+
return this.getAttribute(i.valueAttribute) ?? "button";
|
|
166
168
|
}
|
|
167
169
|
set value(t) {
|
|
168
|
-
t !==
|
|
170
|
+
t !== r ? this.setAttribute(i.valueAttribute, t) : this.removeAttribute(i.valueAttribute);
|
|
169
171
|
}
|
|
170
172
|
/**
|
|
171
173
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -192,15 +194,15 @@ class e extends HTMLElement {
|
|
|
192
194
|
* @param newValue - The new value (or null if removed)
|
|
193
195
|
* @returns {void}
|
|
194
196
|
*/
|
|
195
|
-
attributeChangedCallback(t,
|
|
196
|
-
|
|
197
|
+
attributeChangedCallback(t, e, s) {
|
|
198
|
+
s !== e && this._syncAttribute(t);
|
|
197
199
|
}
|
|
198
200
|
/**
|
|
199
201
|
* Renders the component's HTML structure.
|
|
200
202
|
* Syncs host attributes to the internal button element.
|
|
201
203
|
*/
|
|
202
204
|
_render() {
|
|
203
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
205
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = N, this._syncAttributes());
|
|
204
206
|
}
|
|
205
207
|
/**
|
|
206
208
|
* Adds event listeners to the component.
|
|
@@ -208,7 +210,7 @@ class e extends HTMLElement {
|
|
|
208
210
|
* @returns {void}
|
|
209
211
|
*/
|
|
210
212
|
_addEventListeners() {
|
|
211
|
-
this.addEventListener(
|
|
213
|
+
this.addEventListener(g.CLICK, this._handleClick);
|
|
212
214
|
}
|
|
213
215
|
/**
|
|
214
216
|
* Removes event listeners from the component.
|
|
@@ -216,7 +218,7 @@ class e extends HTMLElement {
|
|
|
216
218
|
* @returns {void}
|
|
217
219
|
*/
|
|
218
220
|
_removeEventListeners() {
|
|
219
|
-
this.removeEventListener(
|
|
221
|
+
this.removeEventListener(g.CLICK, this._handleClick);
|
|
220
222
|
}
|
|
221
223
|
/**
|
|
222
224
|
* Handles the internal button click event and executes the configured command.
|
|
@@ -241,18 +243,18 @@ class e extends HTMLElement {
|
|
|
241
243
|
* @returns {void}
|
|
242
244
|
*/
|
|
243
245
|
_handleClick = () => {
|
|
244
|
-
if (this.command ===
|
|
246
|
+
if (this.command === r || this.commandfor === r)
|
|
245
247
|
return;
|
|
246
248
|
const t = document.getElementById(this.commandfor);
|
|
247
249
|
if (t === null)
|
|
248
250
|
return;
|
|
249
|
-
const
|
|
251
|
+
const e = t;
|
|
250
252
|
switch (this.command) {
|
|
251
|
-
case
|
|
252
|
-
|
|
253
|
+
case c.SHOW_MODAL:
|
|
254
|
+
e.showModal?.();
|
|
253
255
|
break;
|
|
254
|
-
case
|
|
255
|
-
|
|
256
|
+
case c.CLOSE:
|
|
257
|
+
e.close?.();
|
|
256
258
|
break;
|
|
257
259
|
}
|
|
258
260
|
};
|
|
@@ -263,8 +265,8 @@ class e extends HTMLElement {
|
|
|
263
265
|
* @returns {void}
|
|
264
266
|
*/
|
|
265
267
|
_syncAttribute(t) {
|
|
266
|
-
const
|
|
267
|
-
this.hasAttribute(t) ?
|
|
268
|
+
const e = this.buttonElement;
|
|
269
|
+
this.hasAttribute(t) ? e.setAttribute(t, this.getAttribute(t) ?? r) : e.removeAttribute(t);
|
|
268
270
|
}
|
|
269
271
|
/**
|
|
270
272
|
* Syncs all observed attributes from host to button element.
|
|
@@ -273,30 +275,30 @@ class e extends HTMLElement {
|
|
|
273
275
|
* @returns {void}
|
|
274
276
|
*/
|
|
275
277
|
_syncAttributes() {
|
|
276
|
-
|
|
278
|
+
i.observedAttributes.forEach((t) => {
|
|
277
279
|
this._syncAttribute(t);
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
|
-
const
|
|
283
|
+
const Z = "undo-button", $ = `<button title="Undo" part="button">
|
|
282
284
|
<span class="material-symbols-outlined">undo</span>
|
|
283
285
|
<span>Undo</span>
|
|
284
286
|
</button>
|
|
285
|
-
`,
|
|
286
|
-
|
|
287
|
-
class
|
|
287
|
+
`, H = ":host{display:inline-block}button[part=button]{background:var(--color-warning);color:#fff;font-weight:var(--font-weight-medium);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);border-radius:var(--border-radius-lg);border:none;box-shadow:var(--shadow-md);transition:all var(--transition-base);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--gap-sm)}button[part=button]:hover{background:linear-gradient(135deg,var(--color-warning),var(--color-warning));opacity:.9;box-shadow:var(--shadow-lg);transform:translateY(-2px)}button[part=button]:active{transform:translateY(0);box-shadow:var(--shadow-sm)}button[part=button]:focus-visible{outline:2px solid var(--color-warning);outline-offset:2px}button[part=button]:disabled{opacity:.5;cursor:not-allowed;transform:none}", x = new CSSStyleSheet();
|
|
288
|
+
x.replaceSync(H);
|
|
289
|
+
class tt extends i {
|
|
288
290
|
/**
|
|
289
291
|
* @constructor
|
|
290
292
|
* @ignore
|
|
291
293
|
*/
|
|
292
294
|
constructor() {
|
|
293
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
295
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(x), this.command = c.CLOSE, this.title = "Undo";
|
|
294
296
|
}
|
|
295
297
|
/**
|
|
296
298
|
* Specifies which attributes should be observed for changes.
|
|
297
299
|
*/
|
|
298
300
|
static get observedAttributes() {
|
|
299
|
-
return
|
|
301
|
+
return i.observedAttributes;
|
|
300
302
|
}
|
|
301
303
|
/**
|
|
302
304
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -308,7 +310,7 @@ class I extends e {
|
|
|
308
310
|
* Renders the component's HTML structure.
|
|
309
311
|
*/
|
|
310
312
|
_render() {
|
|
311
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
313
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = $, this._syncAttributes());
|
|
312
314
|
}
|
|
313
315
|
/**
|
|
314
316
|
* It finds the closest parent dialog and
|
|
@@ -319,29 +321,29 @@ class I extends e {
|
|
|
319
321
|
_setCommandForAttribute() {
|
|
320
322
|
let t = this.getRootNode();
|
|
321
323
|
"host" in t && t.host !== null && t.host !== void 0 && (t = t.host);
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
+
const e = t instanceof Element ? t.closest("base-dialog") ?? t.closest("confirmation-dialog") : null;
|
|
325
|
+
e !== null && (this.commandfor = e.id);
|
|
324
326
|
}
|
|
325
327
|
}
|
|
326
|
-
const
|
|
328
|
+
const O = `<button title="Confirm" part="button">
|
|
327
329
|
<span class="material-symbols-outlined">check</span>
|
|
328
330
|
<span>Confirm</span>
|
|
329
331
|
</button>
|
|
330
|
-
`,
|
|
331
|
-
|
|
332
|
-
class
|
|
332
|
+
`, W = ":host{display:inline-block}button[part=button]{background:var(--color-success);color:#fff;font-weight:var(--font-weight-medium);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);border-radius:var(--border-radius-lg);border:none;box-shadow:var(--shadow-md);transition:all var(--transition-base);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--gap-sm)}button[part=button]:hover{background:linear-gradient(135deg,var(--color-success),var(--color-success));opacity:.9;box-shadow:var(--shadow-lg);transform:translateY(-2px)}button[part=button]:active{transform:translateY(0);box-shadow:var(--shadow-sm)}button[part=button]:focus-visible{outline:2px solid var(--color-success);outline-offset:2px}button[part=button]:disabled{opacity:.5;cursor:not-allowed;transform:none}", _ = new CSSStyleSheet();
|
|
333
|
+
_.replaceSync(W);
|
|
334
|
+
class et extends i {
|
|
333
335
|
/**
|
|
334
336
|
* @constructor
|
|
335
337
|
* @ignore
|
|
336
338
|
*/
|
|
337
339
|
constructor() {
|
|
338
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
340
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(_), this.command = c.CLOSE, this.title = "Confirm";
|
|
339
341
|
}
|
|
340
342
|
/**
|
|
341
343
|
* Specifies which attributes should be observed for changes.
|
|
342
344
|
*/
|
|
343
345
|
static get observedAttributes() {
|
|
344
|
-
return
|
|
346
|
+
return i.observedAttributes;
|
|
345
347
|
}
|
|
346
348
|
/**
|
|
347
349
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -353,7 +355,7 @@ class Y extends e {
|
|
|
353
355
|
* Renders the component's HTML structure.
|
|
354
356
|
*/
|
|
355
357
|
_render() {
|
|
356
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
358
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = O, this._syncAttributes());
|
|
357
359
|
}
|
|
358
360
|
/**
|
|
359
361
|
* It finds the closest parent dialog and
|
|
@@ -364,16 +366,114 @@ class Y extends e {
|
|
|
364
366
|
_setCommandForAttribute() {
|
|
365
367
|
let t = this.getRootNode();
|
|
366
368
|
"host" in t && t.host !== null && t.host !== void 0 && (t = t.host);
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
+
const e = t instanceof Element ? t.closest("base-dialog") ?? t.closest("confirmation-dialog") : null;
|
|
370
|
+
e !== null && (this.commandfor = e.id);
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
|
-
const
|
|
373
|
+
const it = "confirm-button", V = `<button part="button">
|
|
374
|
+
<span class="material-symbols-outlined">chevron_left</span>
|
|
375
|
+
</button>
|
|
376
|
+
`, z = "", S = new CSSStyleSheet();
|
|
377
|
+
S.replaceSync(z);
|
|
378
|
+
class st extends i {
|
|
379
|
+
/**
|
|
380
|
+
* @constructor
|
|
381
|
+
* @ignore
|
|
382
|
+
*/
|
|
383
|
+
constructor() {
|
|
384
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(S), this.command = c.CLOSE;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Specifies which attributes should be observed for changes.
|
|
388
|
+
*/
|
|
389
|
+
static get observedAttributes() {
|
|
390
|
+
return i.observedAttributes;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
394
|
+
*/
|
|
395
|
+
connectedCallback() {
|
|
396
|
+
this._render(), this._addEventListeners(), this._updateTitle();
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Lifecycle hook invoked whenever an observed attribute changes.
|
|
400
|
+
* Updates the title visibility based on disabled state.
|
|
401
|
+
*/
|
|
402
|
+
attributeChangedCallback(t, e, s) {
|
|
403
|
+
super.attributeChangedCallback(t, e, s), t === "disabled" && this._updateTitle();
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Renders the component's HTML structure.
|
|
407
|
+
*/
|
|
408
|
+
_render() {
|
|
409
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = V, this._syncAttributes());
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Updates the title attribute based on disabled state.
|
|
413
|
+
* Shows title only when button is enabled.
|
|
414
|
+
*/
|
|
415
|
+
_updateTitle() {
|
|
416
|
+
const t = this.shadowRoot?.querySelector(
|
|
417
|
+
"button"
|
|
418
|
+
);
|
|
419
|
+
this.disabled ? t.removeAttribute("title") : t.setAttribute("title", "Previous");
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const rt = "previous-button", P = `<button part="button">
|
|
423
|
+
<span class="material-symbols-outlined">chevron_right</span>
|
|
424
|
+
</button>
|
|
425
|
+
`, Y = "", k = new CSSStyleSheet();
|
|
426
|
+
k.replaceSync(Y);
|
|
427
|
+
class ot extends i {
|
|
428
|
+
/**
|
|
429
|
+
* @constructor
|
|
430
|
+
* @ignore
|
|
431
|
+
*/
|
|
432
|
+
constructor() {
|
|
433
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(k), this.command = c.CLOSE;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Specifies which attributes should be observed for changes.
|
|
437
|
+
*/
|
|
438
|
+
static get observedAttributes() {
|
|
439
|
+
return i.observedAttributes;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
443
|
+
*/
|
|
444
|
+
connectedCallback() {
|
|
445
|
+
this._render(), this._addEventListeners(), this._updateTitle();
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Lifecycle hook invoked whenever an observed attribute changes.
|
|
449
|
+
* Updates the title visibility based on disabled state.
|
|
450
|
+
*/
|
|
451
|
+
attributeChangedCallback(t, e, s) {
|
|
452
|
+
super.attributeChangedCallback(t, e, s), t === "disabled" && this._updateTitle();
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Renders the component's HTML structure.
|
|
456
|
+
*/
|
|
457
|
+
_render() {
|
|
458
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = P, this._syncAttributes());
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Updates the title attribute based on disabled state.
|
|
462
|
+
* Shows title only when button is enabled.
|
|
463
|
+
*/
|
|
464
|
+
_updateTitle() {
|
|
465
|
+
const t = this.shadowRoot?.querySelector(
|
|
466
|
+
"button"
|
|
467
|
+
);
|
|
468
|
+
this.disabled ? t.removeAttribute("title") : t.setAttribute("title", "Next");
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
const nt = "next-button", at = "base-dialog", K = `<dialog part="dialog">
|
|
372
472
|
<slot></slot>
|
|
373
473
|
</dialog>
|
|
374
|
-
`,
|
|
375
|
-
|
|
376
|
-
class
|
|
474
|
+
`, B = "dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-0) solid transparent;border-radius:var(--border-radius-2xl);padding:var(--spacing-8);max-width:90vw;max-height:90vh;font-size:var(--font-size-md);font-family:var(--font-family-base);line-height:var(--line-height-normal);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:dialogSlideIn var(--transition-base) ease-out}dialog::backdrop{background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:backdropFadeIn var(--transition-base) ease-out}@keyframes dialogSlideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes backdropFadeIn{0%{opacity:0}to{opacity:1}}", L = new CSSStyleSheet();
|
|
475
|
+
L.replaceSync(B);
|
|
476
|
+
class d extends HTMLElement {
|
|
377
477
|
/**
|
|
378
478
|
* @see HTMLDialogElement.closedBy
|
|
379
479
|
*/
|
|
@@ -382,31 +482,31 @@ class s extends HTMLElement {
|
|
|
382
482
|
* Defines how the dialog can be closed.
|
|
383
483
|
* @see DialogClosedBy
|
|
384
484
|
*/
|
|
385
|
-
_closedBy =
|
|
485
|
+
_closedBy = y.ANY;
|
|
386
486
|
/**
|
|
387
487
|
* @constructor
|
|
388
488
|
* @ignore
|
|
389
489
|
*/
|
|
390
490
|
constructor() {
|
|
391
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(
|
|
491
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(L);
|
|
392
492
|
}
|
|
393
493
|
/**
|
|
394
494
|
* Specifies which attributes should be observed for changes.
|
|
395
495
|
*/
|
|
396
496
|
static get observedAttributes() {
|
|
397
|
-
return [
|
|
497
|
+
return [d.closedByAttribute];
|
|
398
498
|
}
|
|
399
499
|
get dialogElement() {
|
|
400
500
|
return this.shadowRoot?.querySelector("dialog");
|
|
401
501
|
}
|
|
402
502
|
get command() {
|
|
403
|
-
return this.getAttribute(
|
|
503
|
+
return this.getAttribute(d.closedByAttribute) ?? y.ANY;
|
|
404
504
|
}
|
|
405
505
|
get closedBy() {
|
|
406
506
|
return this._closedBy;
|
|
407
507
|
}
|
|
408
508
|
set closedBy(t) {
|
|
409
|
-
this._closedBy = t, this.setAttribute(
|
|
509
|
+
this._closedBy = t, this.setAttribute(d.closedByAttribute, t);
|
|
410
510
|
}
|
|
411
511
|
/**
|
|
412
512
|
* Lifecycle
|
|
@@ -434,9 +534,9 @@ class s extends HTMLElement {
|
|
|
434
534
|
* @param newValue - The new value (or null if removed)
|
|
435
535
|
* @returns {void}
|
|
436
536
|
*/
|
|
437
|
-
attributeChangedCallback(t,
|
|
438
|
-
const
|
|
439
|
-
|
|
537
|
+
attributeChangedCallback(t, e, s) {
|
|
538
|
+
const l = this.dialogElement;
|
|
539
|
+
l != null && s !== e && this._syncAttribute(t);
|
|
440
540
|
}
|
|
441
541
|
/**
|
|
442
542
|
* Adds event listeners to the component.
|
|
@@ -458,7 +558,7 @@ class s extends HTMLElement {
|
|
|
458
558
|
* @returns {void}
|
|
459
559
|
*/
|
|
460
560
|
_render() {
|
|
461
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
561
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = K, this._syncAttributes());
|
|
462
562
|
}
|
|
463
563
|
/**
|
|
464
564
|
* Syncs a single attribute from host to dialog element.
|
|
@@ -467,8 +567,8 @@ class s extends HTMLElement {
|
|
|
467
567
|
* @returns {void}
|
|
468
568
|
*/
|
|
469
569
|
_syncAttribute(t) {
|
|
470
|
-
const
|
|
471
|
-
|
|
570
|
+
const e = this.dialogElement;
|
|
571
|
+
e != null && (this.hasAttribute(t) === !0 ? e.setAttribute(t, this.getAttribute(t) ?? r) : e.removeAttribute(t));
|
|
472
572
|
}
|
|
473
573
|
/**
|
|
474
574
|
* Syncs all observed attributes from host to dialog element.
|
|
@@ -477,7 +577,7 @@ class s extends HTMLElement {
|
|
|
477
577
|
* @returns {void}
|
|
478
578
|
*/
|
|
479
579
|
_syncAttributes() {
|
|
480
|
-
|
|
580
|
+
d.observedAttributes.forEach((t) => {
|
|
481
581
|
this._syncAttribute(t);
|
|
482
582
|
});
|
|
483
583
|
}
|
|
@@ -500,7 +600,7 @@ class s extends HTMLElement {
|
|
|
500
600
|
this.dialogElement.close(t);
|
|
501
601
|
}
|
|
502
602
|
}
|
|
503
|
-
const
|
|
603
|
+
const lt = "confirmation-dialog", F = `<dialog part="dialog">
|
|
504
604
|
<header part="header">
|
|
505
605
|
<h2></h2>
|
|
506
606
|
</header>
|
|
@@ -512,7 +612,7 @@ const F = "confirmation-dialog", M = `<dialog part="dialog">
|
|
|
512
612
|
<undo-button></undo-button>
|
|
513
613
|
</footer>
|
|
514
614
|
</dialog>
|
|
515
|
-
`,
|
|
615
|
+
`, q = "section.header{display:flex;flex-direction:column;gap:var(--gap-md);padding-bottom:var(--spacing-4);border-bottom:var(--border-width-1) solid var(--color-border-tertiary)}section.footer{display:flex;gap:var(--gap-md);justify-content:flex-end;padding-top:var(--spacing-6);border-top:var(--border-width-1) solid var(--color-border-tertiary)}h2{margin:0;font-size:var(--font-size-2xl);font-weight:var(--font-weight-bold);color:var(--color-text-primary);letter-spacing:var(--letter-spacing-normal);line-height:var(--line-height-tight)}p{margin:0;font-size:var(--font-size-md);color:var(--color-text-secondary);line-height:var(--line-height-relaxed);letter-spacing:var(--letter-spacing-normal)}", D = `<dialog part="dialog">
|
|
516
616
|
<header part="header">
|
|
517
617
|
<slot name="header"></slot>
|
|
518
618
|
</header>
|
|
@@ -523,22 +623,22 @@ const F = "confirmation-dialog", M = `<dialog part="dialog">
|
|
|
523
623
|
<slot name="footer"></slot>
|
|
524
624
|
</footer>
|
|
525
625
|
</dialog>
|
|
526
|
-
`,
|
|
527
|
-
|
|
528
|
-
class
|
|
626
|
+
`, U = "dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-0) solid transparent;border-radius:var(--border-radius-2xl);padding:0;max-width:90vw;max-height:90vh;font-size:var(--font-size-md);font-family:var(--font-family-base);line-height:var(--line-height-normal);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:dialogSlideIn var(--transition-base) ease-out}dialog[part=dialog] header[part=header],dialog[part=dialog] div[part=body],dialog[part=dialog] footer[part=footer]{padding:var(--spacing-8)}dialog[part=dialog] header[part=header]{border-bottom:var(--border-width-1) solid var(--color-border-tertiary);padding-bottom:var(--spacing-6)}dialog[part=dialog] footer[part=footer]{border-top:var(--border-width-1) solid var(--color-border-tertiary);padding-top:var(--spacing-6);display:flex;gap:var(--gap-lg);justify-content:flex-end}dialog::backdrop{background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:backdropFadeIn var(--transition-base) ease-out}@keyframes dialogSlideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes backdropFadeIn{0%{opacity:0}to{opacity:1}}", E = new CSSStyleSheet();
|
|
627
|
+
E.replaceSync(U);
|
|
628
|
+
class w extends d {
|
|
529
629
|
/**
|
|
530
630
|
* @constructor
|
|
531
631
|
* @ignore
|
|
532
632
|
*/
|
|
533
633
|
constructor() {
|
|
534
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
634
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(E);
|
|
535
635
|
}
|
|
536
636
|
/**
|
|
537
637
|
* Specifies which attributes should be observed for changes.
|
|
538
638
|
* Uses parent's attributes since we're extending the base dialog.
|
|
539
639
|
*/
|
|
540
640
|
static get observedAttributes() {
|
|
541
|
-
return
|
|
641
|
+
return d.observedAttributes;
|
|
542
642
|
}
|
|
543
643
|
/**
|
|
544
644
|
* Renders the component's HTML structure.
|
|
@@ -547,20 +647,20 @@ class u extends s {
|
|
|
547
647
|
* @returns {void}
|
|
548
648
|
*/
|
|
549
649
|
_render() {
|
|
550
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
650
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = D, this._syncAttributes());
|
|
551
651
|
}
|
|
552
652
|
}
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
class
|
|
653
|
+
const C = new CSSStyleSheet();
|
|
654
|
+
C.replaceSync(q);
|
|
655
|
+
class a extends w {
|
|
556
656
|
/**
|
|
557
657
|
* The text content of the confirmation dialog.
|
|
558
658
|
*/
|
|
559
|
-
_text =
|
|
659
|
+
_text = r;
|
|
560
660
|
/**
|
|
561
661
|
* The title of the confirmation dialog.
|
|
562
662
|
*/
|
|
563
|
-
_headline =
|
|
663
|
+
_headline = r;
|
|
564
664
|
/**
|
|
565
665
|
* The name of the attribute that holds the dialog's text content.
|
|
566
666
|
*/
|
|
@@ -573,7 +673,7 @@ class o extends u {
|
|
|
573
673
|
* @constructor
|
|
574
674
|
*/
|
|
575
675
|
constructor() {
|
|
576
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
676
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(C);
|
|
577
677
|
}
|
|
578
678
|
/**
|
|
579
679
|
* Specifies which attributes should be observed for changes.
|
|
@@ -581,22 +681,22 @@ class o extends u {
|
|
|
581
681
|
*/
|
|
582
682
|
static get observedAttributes() {
|
|
583
683
|
return [
|
|
584
|
-
...
|
|
585
|
-
|
|
586
|
-
|
|
684
|
+
...w.observedAttributes,
|
|
685
|
+
a.textAttribute,
|
|
686
|
+
a.headlineAttribute
|
|
587
687
|
];
|
|
588
688
|
}
|
|
589
689
|
get headline() {
|
|
590
690
|
return this._headline;
|
|
591
691
|
}
|
|
592
692
|
set headline(t) {
|
|
593
|
-
this._headline = t, this.setAttribute(
|
|
693
|
+
this._headline = t, this.setAttribute(a.headlineAttribute, t);
|
|
594
694
|
}
|
|
595
695
|
get text() {
|
|
596
696
|
return this._text;
|
|
597
697
|
}
|
|
598
698
|
set text(t) {
|
|
599
|
-
this._text = t, this.setAttribute(
|
|
699
|
+
this._text = t, this.setAttribute(a.textAttribute, t);
|
|
600
700
|
}
|
|
601
701
|
/**
|
|
602
702
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -604,7 +704,7 @@ class o extends u {
|
|
|
604
704
|
* @returns {void}
|
|
605
705
|
*/
|
|
606
706
|
connectedCallback() {
|
|
607
|
-
this._render(), this._addEventListeners(), this.closedBy =
|
|
707
|
+
this._render(), this._addEventListeners(), this.closedBy = y.NONE;
|
|
608
708
|
}
|
|
609
709
|
/**
|
|
610
710
|
* Renders the component's HTML structure.
|
|
@@ -613,7 +713,7 @@ class o extends u {
|
|
|
613
713
|
* @returns {void}
|
|
614
714
|
*/
|
|
615
715
|
_render() {
|
|
616
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
716
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = F, this._syncAttributes());
|
|
617
717
|
}
|
|
618
718
|
/**
|
|
619
719
|
* Syncs a single attribute from host to the DOM elements.
|
|
@@ -622,18 +722,18 @@ class o extends u {
|
|
|
622
722
|
* @returns {void}
|
|
623
723
|
*/
|
|
624
724
|
_syncAttribute(t) {
|
|
625
|
-
if (
|
|
725
|
+
if (a.observedAttributes.includes(t))
|
|
626
726
|
switch (t) {
|
|
627
|
-
case
|
|
628
|
-
this._headline = this.getAttribute(t) ??
|
|
629
|
-
const
|
|
630
|
-
|
|
727
|
+
case a.headlineAttribute: {
|
|
728
|
+
this._headline = this.getAttribute(t) ?? r;
|
|
729
|
+
const e = this.shadowRoot?.querySelector("h2");
|
|
730
|
+
e != null && (e.textContent = this._headline);
|
|
631
731
|
break;
|
|
632
732
|
}
|
|
633
|
-
case
|
|
634
|
-
this._text = this.getAttribute(t) ??
|
|
635
|
-
const
|
|
636
|
-
|
|
733
|
+
case a.textAttribute: {
|
|
734
|
+
this._text = this.getAttribute(t) ?? r;
|
|
735
|
+
const e = this.shadowRoot?.querySelector("p");
|
|
736
|
+
e != null && (e.textContent = this._text);
|
|
637
737
|
break;
|
|
638
738
|
}
|
|
639
739
|
default:
|
|
@@ -649,25 +749,243 @@ class o extends u {
|
|
|
649
749
|
* @returns {void}
|
|
650
750
|
*/
|
|
651
751
|
_syncAttributes() {
|
|
652
|
-
super._syncAttributes(),
|
|
752
|
+
super._syncAttributes(), a.observedAttributes.forEach((t) => {
|
|
653
753
|
this._syncAttribute(t);
|
|
654
754
|
});
|
|
655
755
|
}
|
|
656
756
|
}
|
|
657
|
-
const
|
|
757
|
+
const dt = "header-body-footer-dialog", j = `<div class="bar-menu-container">
|
|
758
|
+
<previous-button class="nav-prev" part="nav-prev-button"></previous-button>
|
|
759
|
+
|
|
760
|
+
<div class="buttons-wrapper" part="buttons-wrapper">
|
|
761
|
+
<slot></slot>
|
|
762
|
+
</div>
|
|
763
|
+
|
|
764
|
+
<next-button class="nav-next" part="nav-next-button"></next-button>
|
|
765
|
+
</div>
|
|
766
|
+
`, X = '@charset "UTF-8";:host{display:block;width:100%}@media(max-width:600px){:host{--game-menu-width: 90%}}@media(min-width:601px)and (max-width:1200px){:host{--game-menu-width: calc(90% - (40%*(100vw - 601px)/599px)) }}@media(min-width:1201px){:host{--game-menu-width: 50%}}.bar-menu-container{display:flex;align-items:center;justify-content:space-between;width:var(--game-menu-width, 90%);max-width:900px;height:100%;gap:var(--gap-sm);padding:var(--spacing-1);background:var(--color-bg-secondary);border-radius:var(--border-radius-full);border:var(--border-width-2) solid rgb(189,0,132);box-shadow:var(--shadow-sm);margin:0 auto}.bar-menu-container previous-button,.bar-menu-container next-button{flex-shrink:0;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s ease-in-out,visibility .2s ease-in-out}.bar-menu-container previous-button.visible,.bar-menu-container next-button.visible{opacity:1;visibility:visible;pointer-events:auto}.bar-menu-container previous-button::part(button),.bar-menu-container next-button::part(button){background-color:transparent;box-shadow:none}.bar-menu-container .buttons-wrapper{display:grid;grid-template-columns:repeat(var(--game-menu-visible-count, 3),1fr);grid-auto-rows:max-content;align-items:center;justify-items:center;gap:var(--gap-sm);overflow:hidden;position:relative;width:auto}::slotted(*){display:none;flex-shrink:0;will-change:opacity,transform;contain:layout style paint;opacity:0;transform:scale(.8)}::slotted(.animating){transition:opacity .4s cubic-bezier(.34,1.56,.64,1),transform .4s cubic-bezier(.34,1.56,.64,1)}::slotted(.visible-button){display:inline-flex!important;pointer-events:auto;opacity:1;transform:scale(1)}', I = new CSSStyleSheet();
|
|
767
|
+
I.replaceSync(X);
|
|
768
|
+
class v extends HTMLElement {
|
|
769
|
+
static _visibleCountAttribute = "visible-count";
|
|
770
|
+
_currentIndex = 0;
|
|
771
|
+
_visibleCount = 3;
|
|
772
|
+
_MIN_VISIBLE = 3;
|
|
773
|
+
_MAX_VISIBLE = 5;
|
|
774
|
+
_slotElement = null;
|
|
775
|
+
_navPrevButton = null;
|
|
776
|
+
_navNextButton = null;
|
|
777
|
+
_buttonsWrapper = null;
|
|
778
|
+
_slotChangeListener = null;
|
|
779
|
+
_keyDownListener = null;
|
|
780
|
+
/**
|
|
781
|
+
* @constructor
|
|
782
|
+
*/
|
|
783
|
+
constructor() {
|
|
784
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(I);
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Specifies which attributes should be observed for changes.
|
|
788
|
+
*/
|
|
789
|
+
static get observedAttributes() {
|
|
790
|
+
return [v._visibleCountAttribute];
|
|
791
|
+
}
|
|
792
|
+
get visibleButtons() {
|
|
793
|
+
const t = this.getAttribute(v._visibleCountAttribute);
|
|
794
|
+
if (t !== null && t !== r) {
|
|
795
|
+
const e = parseInt(t, 10);
|
|
796
|
+
return Math.max(this._MIN_VISIBLE, Math.min(this._MAX_VISIBLE, e));
|
|
797
|
+
}
|
|
798
|
+
return this._visibleCount;
|
|
799
|
+
}
|
|
800
|
+
set visibleButtons(t) {
|
|
801
|
+
const e = Math.max(
|
|
802
|
+
this._MIN_VISIBLE,
|
|
803
|
+
Math.min(this._MAX_VISIBLE, t)
|
|
804
|
+
);
|
|
805
|
+
this.setAttribute(v._visibleCountAttribute, String(e));
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Lifecycle hook: component inserted into DOM
|
|
809
|
+
*/
|
|
810
|
+
connectedCallback() {
|
|
811
|
+
this._render(), this._cacheElements(), this._setupSlotListener(), this._setupKeyboardListener(), this._updateButtonVisibility();
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Lifecycle hook: component removed from DOM
|
|
815
|
+
*/
|
|
816
|
+
disconnectedCallback() {
|
|
817
|
+
this._removeSlotListener(), this._removeKeyboardListener();
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Lifecycle hook: observed attribute changed
|
|
821
|
+
*/
|
|
822
|
+
attributeChangedCallback(t, e, s) {
|
|
823
|
+
t === v._visibleCountAttribute && (this._visibleCount = this.visibleButtons, this._buttonsWrapper !== null && this._buttonsWrapper.style.setProperty(
|
|
824
|
+
"--bar-menu-visible-count",
|
|
825
|
+
String(this.visibleButtons)
|
|
826
|
+
), this._updateButtonVisibility());
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Render the component's Shadow DOM structure
|
|
830
|
+
*/
|
|
831
|
+
_render() {
|
|
832
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = j);
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Cache Shadow DOM elements for performance
|
|
836
|
+
*/
|
|
837
|
+
_cacheElements() {
|
|
838
|
+
this._slotElement = this.shadowRoot?.querySelector("slot") ?? null, this._navPrevButton = this.shadowRoot?.querySelector(".nav-prev") ?? null, this._navNextButton = this.shadowRoot?.querySelector(".nav-next") ?? null, this._buttonsWrapper = this.shadowRoot?.querySelector(".buttons-wrapper") ?? null, this._buttonsWrapper !== null && this._buttonsWrapper.style.setProperty(
|
|
839
|
+
"--bar-menu-visible-count",
|
|
840
|
+
String(this.visibleButtons)
|
|
841
|
+
), this._navPrevButton !== null && (this._navPrevButton.setAttribute("aria-label", "Previous"), this._navPrevButton.addEventListener(g.CLICK, () => {
|
|
842
|
+
this._scrollPrevious();
|
|
843
|
+
})), this._navNextButton !== null && (this._navNextButton.setAttribute("aria-label", "Next"), this._navNextButton.addEventListener(g.CLICK, () => {
|
|
844
|
+
this._scrollNext();
|
|
845
|
+
}));
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Setup listener for slot content changes
|
|
849
|
+
*/
|
|
850
|
+
_setupSlotListener() {
|
|
851
|
+
this._slotElement !== null && (this._slotChangeListener = () => {
|
|
852
|
+
this._currentIndex = 0, this._updateButtonVisibility();
|
|
853
|
+
}, this._slotElement.addEventListener("slotchange", this._slotChangeListener));
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Remove slot listener
|
|
857
|
+
*/
|
|
858
|
+
_removeSlotListener() {
|
|
859
|
+
this._slotElement !== null && this._slotChangeListener !== null && this._slotElement.removeEventListener(
|
|
860
|
+
"slotchange",
|
|
861
|
+
this._slotChangeListener
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Setup keyboard navigation listener
|
|
866
|
+
*/
|
|
867
|
+
_setupKeyboardListener() {
|
|
868
|
+
this._keyDownListener = (t) => {
|
|
869
|
+
t.key === "ArrowLeft" ? (t.preventDefault(), this._scrollPrevious()) : t.key === "ArrowRight" && (t.preventDefault(), this._scrollNext());
|
|
870
|
+
}, this.addEventListener(f.KEY_DOWN, this._keyDownListener);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Remove keyboard listener
|
|
874
|
+
*/
|
|
875
|
+
_removeKeyboardListener() {
|
|
876
|
+
this._keyDownListener !== null && this.removeEventListener(f.KEY_DOWN, this._keyDownListener);
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Get all slotted button elements
|
|
880
|
+
*/
|
|
881
|
+
_getSlottedButtons() {
|
|
882
|
+
if (this._slotElement === null)
|
|
883
|
+
return [];
|
|
884
|
+
const t = this._slotElement.assignedElements();
|
|
885
|
+
return Array.from(t).filter(
|
|
886
|
+
(e) => e instanceof HTMLElement && (e.tagName === "BUTTON" || e.getAttribute("role") === "button")
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Update button visibility by showing/hiding rows with fade
|
|
891
|
+
*/
|
|
892
|
+
_updateButtonVisibility(t) {
|
|
893
|
+
const e = this._getSlottedButtons(), s = e.length, l = this.visibleButtons, h = this._currentIndex, m = Math.min(h + l, s);
|
|
894
|
+
e.forEach((o, n) => {
|
|
895
|
+
const p = n >= h && n < m, u = o;
|
|
896
|
+
p || (o.classList.remove("visible-button"), o.classList.remove("animating"), u.style.display = "none");
|
|
897
|
+
}), t !== void 0 ? (e[0]?.offsetHeight, e.forEach((o, n) => {
|
|
898
|
+
if (n >= h && n < m) {
|
|
899
|
+
const u = o;
|
|
900
|
+
u.style.display = "inline-flex", o.classList.add("animating");
|
|
901
|
+
const R = n % this.visibleButtons * 50;
|
|
902
|
+
u.style.transitionDelay = `${R}ms`;
|
|
903
|
+
}
|
|
904
|
+
}), e[0]?.offsetHeight, e.forEach((o, n) => {
|
|
905
|
+
n >= h && n < m && o.classList.add("visible-button");
|
|
906
|
+
}), setTimeout(() => {
|
|
907
|
+
e.forEach((o) => {
|
|
908
|
+
o.classList.remove("animating"), o.style.transitionDelay = r;
|
|
909
|
+
});
|
|
910
|
+
}, 400)) : e.forEach((o, n) => {
|
|
911
|
+
const p = n >= h && n < m, u = o;
|
|
912
|
+
p && (u.style.display = "inline-flex", o.classList.add("visible-button"));
|
|
913
|
+
}), this._updateNavigationButtons(s, l);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Update navigation buttons visibility and disabled state
|
|
917
|
+
*/
|
|
918
|
+
_updateNavigationButtons(t, e) {
|
|
919
|
+
const s = t > e, l = this._currentIndex + e < t;
|
|
920
|
+
this._navPrevButton !== null && (s ? (this._navPrevButton.classList.add("visible"), this._navPrevButton.disabled = this._currentIndex === 0) : this._navPrevButton.classList.remove("visible")), this._navNextButton !== null && (s ? (this._navNextButton.classList.add("visible"), this._navNextButton.disabled = !l) : this._navNextButton.classList.remove("visible"));
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Navigate to previous page (scrolls by visibleCount buttons)
|
|
924
|
+
*/
|
|
925
|
+
_scrollPrevious() {
|
|
926
|
+
this._currentIndex > 0 && (this._currentIndex = Math.max(
|
|
927
|
+
0,
|
|
928
|
+
this._currentIndex - this.visibleButtons
|
|
929
|
+
), this._updateButtonVisibility("previous"));
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Navigate to next page (scrolls by visibleCount buttons)
|
|
933
|
+
*/
|
|
934
|
+
_scrollNext() {
|
|
935
|
+
const t = this._getSlottedButtons().length, e = this.visibleButtons, s = this._currentIndex + e;
|
|
936
|
+
s < t && (this._currentIndex = s, this._updateButtonVisibility("next"));
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Public API: scroll to specific button by index
|
|
940
|
+
*/
|
|
941
|
+
scrollToButton(t) {
|
|
942
|
+
const e = this._getSlottedButtons().length, s = this.visibleButtons;
|
|
943
|
+
t >= 0 && t < e && (this._currentIndex = Math.max(
|
|
944
|
+
0,
|
|
945
|
+
Math.min(t, e - s)
|
|
946
|
+
), this._updateButtonVisibility());
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Public API: get currently visible buttons
|
|
950
|
+
*/
|
|
951
|
+
getVisibleButtons() {
|
|
952
|
+
return this._getSlottedButtons().filter(
|
|
953
|
+
(t) => t.classList.contains("visible-button")
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Public API: get all buttons
|
|
958
|
+
*/
|
|
959
|
+
getAllButtons() {
|
|
960
|
+
return this._getSlottedButtons();
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Public API: get current scroll index
|
|
964
|
+
*/
|
|
965
|
+
getCurrentIndex() {
|
|
966
|
+
return this._currentIndex;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
const ut = "bar-menu";
|
|
658
970
|
export {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
971
|
+
G as APPLICATION_NAME,
|
|
972
|
+
v as BarMenuComponent,
|
|
973
|
+
i as BaseButtonComponent,
|
|
974
|
+
d as BaseDialogComponent,
|
|
975
|
+
et as ConfirmButtonComponent,
|
|
976
|
+
a as ConfirmationDialogComponent,
|
|
977
|
+
w as HeaderBodyFooterDialogComponent,
|
|
978
|
+
ot as NextButtonComponent,
|
|
979
|
+
st as PreviousButtonComponent,
|
|
980
|
+
tt as UndoButtonComponent,
|
|
981
|
+
J as WebComponentsRegistry,
|
|
982
|
+
ut as barMenuWebComponentSelector,
|
|
983
|
+
Q as baseButtonWebComponentSelector,
|
|
984
|
+
at as baseDialogWebComponentSelector,
|
|
985
|
+
it as confirmButtonWebComponentSelector,
|
|
986
|
+
lt as confirmationDialogWebComponentSelector,
|
|
987
|
+
dt as headerBodyFooterDialogWebComponentSelector,
|
|
988
|
+
nt as nextButtonWebComponentSelector,
|
|
989
|
+
rt as previousButtonWebComponentSelector,
|
|
990
|
+
Z as undoButtonWebComponentSelector
|
|
673
991
|
};
|