@albi_scando/as-design-system-lib 1.1.3 → 1.3.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 +451 -135
- 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 +3 -4
|
@@ -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, i]) => {
|
|
23
|
+
this.registerComponent(e, i);
|
|
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 g = {
|
|
55
55
|
ANY: "any",
|
|
56
56
|
NONE: "none"
|
|
57
|
-
},
|
|
57
|
+
}, f = {
|
|
58
|
+
KEY_DOWN: "keydown"
|
|
59
|
+
}, y = {
|
|
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;-webkit-user-select:none;user-select:none;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);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);background:var(--color-bg-secondary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-primary);border-radius:var(--border-radius-lg);transition:all var(--transition-base)}: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;line-height:1}:where(button,input[type=button],input[type=submit],input[type=reset])[disabled]{opacity:.3;cursor:not-allowed}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:disabled):hover),:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:disabled):active){background:var(--color-hover-bg-secondary);border-color:var(--color-hover-border-secondary)}:where(input[type=file]){inline-size:100%;max-inline-size:max-content;background-color:var(--color-bg-secondary)}", _ = new CSSStyleSheet();
|
|
65
|
+
_.replaceSync(T);
|
|
66
|
+
class s 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(_);
|
|
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
|
+
s.autofocusAttribute,
|
|
112
|
+
s.commandAttribute,
|
|
113
|
+
s.commandforAttribute,
|
|
114
|
+
s.disabledAttribute,
|
|
115
|
+
s.nameAttribute,
|
|
116
|
+
s.titleAttribute,
|
|
117
|
+
s.typeAttribute,
|
|
118
|
+
s.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(s.autofocusAttribute);
|
|
124
126
|
}
|
|
125
127
|
set autofocus(t) {
|
|
126
|
-
t ? this.setAttribute(
|
|
128
|
+
t ? this.setAttribute(s.autofocusAttribute, r) : this.removeAttribute(s.autofocusAttribute);
|
|
127
129
|
}
|
|
128
130
|
get command() {
|
|
129
|
-
return this.getAttribute(
|
|
131
|
+
return this.getAttribute(s.commandAttribute) ?? r;
|
|
130
132
|
}
|
|
131
133
|
set command(t) {
|
|
132
|
-
this.setAttribute(
|
|
134
|
+
this.setAttribute(s.commandAttribute, t);
|
|
133
135
|
}
|
|
134
136
|
get commandfor() {
|
|
135
|
-
return this.getAttribute(
|
|
137
|
+
return this.getAttribute(s.commandforAttribute) ?? r;
|
|
136
138
|
}
|
|
137
139
|
set commandfor(t) {
|
|
138
|
-
t !==
|
|
140
|
+
t !== r ? this.setAttribute(s.commandforAttribute, t) : this.removeAttribute(s.commandforAttribute);
|
|
139
141
|
}
|
|
140
142
|
get disabled() {
|
|
141
|
-
return this.hasAttribute(
|
|
143
|
+
return this.hasAttribute(s.disabledAttribute);
|
|
142
144
|
}
|
|
143
145
|
set disabled(t) {
|
|
144
|
-
t ? this.setAttribute(
|
|
146
|
+
t ? this.setAttribute(s.disabledAttribute, r) : this.removeAttribute(s.disabledAttribute);
|
|
145
147
|
}
|
|
146
148
|
get name() {
|
|
147
|
-
return this.getAttribute(
|
|
149
|
+
return this.getAttribute(s.nameAttribute) ?? r;
|
|
148
150
|
}
|
|
149
151
|
set name(t) {
|
|
150
|
-
t !==
|
|
152
|
+
t !== r ? this.setAttribute(s.nameAttribute, t) : this.removeAttribute(s.nameAttribute);
|
|
151
153
|
}
|
|
152
154
|
get headline() {
|
|
153
|
-
return this.getAttribute(
|
|
155
|
+
return this.getAttribute(s.titleAttribute) ?? r;
|
|
154
156
|
}
|
|
155
157
|
set headline(t) {
|
|
156
|
-
t !==
|
|
158
|
+
t !== r ? this.setAttribute(s.titleAttribute, t) : this.removeAttribute(s.titleAttribute);
|
|
157
159
|
}
|
|
158
160
|
get type() {
|
|
159
|
-
return this.getAttribute(
|
|
161
|
+
return this.getAttribute(s.typeAttribute) ?? "button";
|
|
160
162
|
}
|
|
161
163
|
set type(t) {
|
|
162
|
-
t !==
|
|
164
|
+
t !== r ? this.setAttribute(s.typeAttribute, t) : this.removeAttribute(s.typeAttribute);
|
|
163
165
|
}
|
|
164
166
|
get value() {
|
|
165
|
-
return this.getAttribute(
|
|
167
|
+
return this.getAttribute(s.valueAttribute) ?? "button";
|
|
166
168
|
}
|
|
167
169
|
set value(t) {
|
|
168
|
-
t !==
|
|
170
|
+
t !== r ? this.setAttribute(s.valueAttribute, t) : this.removeAttribute(s.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, i) {
|
|
198
|
+
i !== 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(y.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(y.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
|
+
s.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 = "button[part=button]{background:var(--color-warning);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{filter:brightness(1.2)}", w = new CSSStyleSheet();
|
|
288
|
+
w.replaceSync(H);
|
|
289
|
+
class tt extends s {
|
|
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(w), 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 s.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 = "button[part=button]{background:var(--color-success);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{filter:brightness(1.2)}", S = new CSSStyleSheet();
|
|
333
|
+
S.replaceSync(W);
|
|
334
|
+
class et extends s {
|
|
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(S), 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 s.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 st = "confirm-button", V = `<button part="button">
|
|
374
|
+
<span class="material-symbols-outlined">chevron_left</span>
|
|
375
|
+
</button>
|
|
376
|
+
`, P = "button[part=button]{border:none;background:transparent}button[part=button]:not(:disabled):hover{transform:scale(1.2)}", x = new CSSStyleSheet();
|
|
377
|
+
x.replaceSync(P);
|
|
378
|
+
class it extends s {
|
|
379
|
+
/**
|
|
380
|
+
* @constructor
|
|
381
|
+
* @ignore
|
|
382
|
+
*/
|
|
383
|
+
constructor() {
|
|
384
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(x), this.command = c.CLOSE;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Specifies which attributes should be observed for changes.
|
|
388
|
+
*/
|
|
389
|
+
static get observedAttributes() {
|
|
390
|
+
return s.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, i) {
|
|
403
|
+
super.attributeChangedCallback(t, e, i), 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", z = `<button part="button">
|
|
423
|
+
<span class="material-symbols-outlined">chevron_right</span>
|
|
424
|
+
</button>
|
|
425
|
+
`, K = "button[part=button]{border:none;background:transparent}button[part=button]:not(:disabled):hover{transform:scale(1.2)}", L = new CSSStyleSheet();
|
|
426
|
+
L.replaceSync(K);
|
|
427
|
+
class nt extends s {
|
|
428
|
+
/**
|
|
429
|
+
* @constructor
|
|
430
|
+
* @ignore
|
|
431
|
+
*/
|
|
432
|
+
constructor() {
|
|
433
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(L), this.command = c.CLOSE;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Specifies which attributes should be observed for changes.
|
|
437
|
+
*/
|
|
438
|
+
static get observedAttributes() {
|
|
439
|
+
return s.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, i) {
|
|
452
|
+
super.attributeChangedCallback(t, e, i), t === "disabled" && this._updateTitle();
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Renders the component's HTML structure.
|
|
456
|
+
*/
|
|
457
|
+
_render() {
|
|
458
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = z, 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 ot = "next-button", at = "base-dialog", q = `<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-1) solid var(--color-border-secondary);border-radius:var(--border-radius-xl);padding:var(--spacing-4);max-width:90vw;max-height:90vh;font-family:var(--font-family-base);line-height:var(--line-height-normal);font-size:var(--font-size-sm);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:slideIn var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog.closing{animation:slideOut var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog::backdrop{background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:fadeIn var(--transition-base) ease-out forwards}dialog.closing::backdrop{animation:fadeOut var(--transition-base) ease-out forwards}@keyframes slideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(.95) translateY(-20px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}", E = new CSSStyleSheet();
|
|
475
|
+
E.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 = g.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(E);
|
|
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) ?? g.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, i) {
|
|
538
|
+
const l = this.dialogElement;
|
|
539
|
+
l != null && i !== 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 = q, 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
|
}
|
|
@@ -497,10 +597,13 @@ class s extends HTMLElement {
|
|
|
497
597
|
* @see HTMLDialogElement.close
|
|
498
598
|
*/
|
|
499
599
|
close(t) {
|
|
500
|
-
this.dialogElement
|
|
600
|
+
const e = this.dialogElement;
|
|
601
|
+
e.classList.add("closing"), setTimeout(() => {
|
|
602
|
+
e.close(t), e.classList.remove("closing");
|
|
603
|
+
}, 300);
|
|
501
604
|
}
|
|
502
605
|
}
|
|
503
|
-
const
|
|
606
|
+
const lt = "confirmation-dialog", Y = `<dialog part="dialog">
|
|
504
607
|
<header part="header">
|
|
505
608
|
<h2></h2>
|
|
506
609
|
</header>
|
|
@@ -512,7 +615,7 @@ const F = "confirmation-dialog", M = `<dialog part="dialog">
|
|
|
512
615
|
<undo-button></undo-button>
|
|
513
616
|
</footer>
|
|
514
617
|
</dialog>
|
|
515
|
-
`,
|
|
618
|
+
`, D = "dialog header[part=header] h2{margin:0;padding:0}dialog div[part=body] p{margin:0;padding:0}dialog footer[part=footer]{display:flex;gap:var(--gap-md);justify-content:flex-end}", U = `<dialog part="dialog">
|
|
516
619
|
<header part="header">
|
|
517
620
|
<slot name="header"></slot>
|
|
518
621
|
</header>
|
|
@@ -523,22 +626,22 @@ const F = "confirmation-dialog", M = `<dialog part="dialog">
|
|
|
523
626
|
<slot name="footer"></slot>
|
|
524
627
|
</footer>
|
|
525
628
|
</dialog>
|
|
526
|
-
`,
|
|
527
|
-
|
|
528
|
-
class
|
|
629
|
+
`, F = "dialog header[part=header]{border-bottom:var(--border-width-1) solid var(--color-neutral-600);padding-bottom:var(--spacing-4)}dialog header[part=header]:empty{display:none}dialog div[part=body]{padding:var(--spacing-4) 0}dialog div[part=body]:empty{display:none}dialog footer[part=footer]{border-top:var(--border-width-1) solid var(--color-neutral-600);padding-top:var(--spacing-4)}dialog footer[part=footer]:empty{display:none}", k = new CSSStyleSheet();
|
|
630
|
+
k.replaceSync(F);
|
|
631
|
+
class A extends d {
|
|
529
632
|
/**
|
|
530
633
|
* @constructor
|
|
531
634
|
* @ignore
|
|
532
635
|
*/
|
|
533
636
|
constructor() {
|
|
534
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
637
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(k);
|
|
535
638
|
}
|
|
536
639
|
/**
|
|
537
640
|
* Specifies which attributes should be observed for changes.
|
|
538
641
|
* Uses parent's attributes since we're extending the base dialog.
|
|
539
642
|
*/
|
|
540
643
|
static get observedAttributes() {
|
|
541
|
-
return
|
|
644
|
+
return d.observedAttributes;
|
|
542
645
|
}
|
|
543
646
|
/**
|
|
544
647
|
* Renders the component's HTML structure.
|
|
@@ -547,20 +650,20 @@ class u extends s {
|
|
|
547
650
|
* @returns {void}
|
|
548
651
|
*/
|
|
549
652
|
_render() {
|
|
550
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
653
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = U, this._syncAttributes());
|
|
551
654
|
}
|
|
552
655
|
}
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
class
|
|
656
|
+
const C = new CSSStyleSheet();
|
|
657
|
+
C.replaceSync(D);
|
|
658
|
+
class a extends A {
|
|
556
659
|
/**
|
|
557
660
|
* The text content of the confirmation dialog.
|
|
558
661
|
*/
|
|
559
|
-
_text =
|
|
662
|
+
_text = r;
|
|
560
663
|
/**
|
|
561
664
|
* The title of the confirmation dialog.
|
|
562
665
|
*/
|
|
563
|
-
_headline =
|
|
666
|
+
_headline = r;
|
|
564
667
|
/**
|
|
565
668
|
* The name of the attribute that holds the dialog's text content.
|
|
566
669
|
*/
|
|
@@ -573,7 +676,7 @@ class o extends u {
|
|
|
573
676
|
* @constructor
|
|
574
677
|
*/
|
|
575
678
|
constructor() {
|
|
576
|
-
super(), this.shadowRoot?.adoptedStyleSheets.push(
|
|
679
|
+
super(), this.shadowRoot?.adoptedStyleSheets.push(C);
|
|
577
680
|
}
|
|
578
681
|
/**
|
|
579
682
|
* Specifies which attributes should be observed for changes.
|
|
@@ -581,22 +684,22 @@ class o extends u {
|
|
|
581
684
|
*/
|
|
582
685
|
static get observedAttributes() {
|
|
583
686
|
return [
|
|
584
|
-
...
|
|
585
|
-
|
|
586
|
-
|
|
687
|
+
...A.observedAttributes,
|
|
688
|
+
a.textAttribute,
|
|
689
|
+
a.headlineAttribute
|
|
587
690
|
];
|
|
588
691
|
}
|
|
589
692
|
get headline() {
|
|
590
693
|
return this._headline;
|
|
591
694
|
}
|
|
592
695
|
set headline(t) {
|
|
593
|
-
this._headline = t, this.setAttribute(
|
|
696
|
+
this._headline = t, this.setAttribute(a.headlineAttribute, t);
|
|
594
697
|
}
|
|
595
698
|
get text() {
|
|
596
699
|
return this._text;
|
|
597
700
|
}
|
|
598
701
|
set text(t) {
|
|
599
|
-
this._text = t, this.setAttribute(
|
|
702
|
+
this._text = t, this.setAttribute(a.textAttribute, t);
|
|
600
703
|
}
|
|
601
704
|
/**
|
|
602
705
|
* Lifecycle hook invoked when the component is inserted into the DOM.
|
|
@@ -604,7 +707,7 @@ class o extends u {
|
|
|
604
707
|
* @returns {void}
|
|
605
708
|
*/
|
|
606
709
|
connectedCallback() {
|
|
607
|
-
this._render(), this._addEventListeners(), this.closedBy =
|
|
710
|
+
this._render(), this._addEventListeners(), this.closedBy = g.NONE;
|
|
608
711
|
}
|
|
609
712
|
/**
|
|
610
713
|
* Renders the component's HTML structure.
|
|
@@ -613,7 +716,7 @@ class o extends u {
|
|
|
613
716
|
* @returns {void}
|
|
614
717
|
*/
|
|
615
718
|
_render() {
|
|
616
|
-
this.shadowRoot !== null && (this.shadowRoot.innerHTML =
|
|
719
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = Y, this._syncAttributes());
|
|
617
720
|
}
|
|
618
721
|
/**
|
|
619
722
|
* Syncs a single attribute from host to the DOM elements.
|
|
@@ -622,18 +725,18 @@ class o extends u {
|
|
|
622
725
|
* @returns {void}
|
|
623
726
|
*/
|
|
624
727
|
_syncAttribute(t) {
|
|
625
|
-
if (
|
|
728
|
+
if (a.observedAttributes.includes(t))
|
|
626
729
|
switch (t) {
|
|
627
|
-
case
|
|
628
|
-
this._headline = this.getAttribute(t) ??
|
|
629
|
-
const
|
|
630
|
-
|
|
730
|
+
case a.headlineAttribute: {
|
|
731
|
+
this._headline = this.getAttribute(t) ?? r;
|
|
732
|
+
const e = this.shadowRoot?.querySelector("h2");
|
|
733
|
+
e != null && (e.textContent = this._headline);
|
|
631
734
|
break;
|
|
632
735
|
}
|
|
633
|
-
case
|
|
634
|
-
this._text = this.getAttribute(t) ??
|
|
635
|
-
const
|
|
636
|
-
|
|
736
|
+
case a.textAttribute: {
|
|
737
|
+
this._text = this.getAttribute(t) ?? r;
|
|
738
|
+
const e = this.shadowRoot?.querySelector("p");
|
|
739
|
+
e != null && (e.textContent = this._text);
|
|
637
740
|
break;
|
|
638
741
|
}
|
|
639
742
|
default:
|
|
@@ -649,25 +752,238 @@ class o extends u {
|
|
|
649
752
|
* @returns {void}
|
|
650
753
|
*/
|
|
651
754
|
_syncAttributes() {
|
|
652
|
-
super._syncAttributes(),
|
|
755
|
+
super._syncAttributes(), a.observedAttributes.forEach((t) => {
|
|
653
756
|
this._syncAttribute(t);
|
|
654
757
|
});
|
|
655
758
|
}
|
|
656
759
|
}
|
|
657
|
-
const
|
|
760
|
+
const dt = "header-body-footer-dialog", j = `<div class="bar-menu-container">
|
|
761
|
+
<previous-button class="nav-prev" part="nav-prev-button"></previous-button>
|
|
762
|
+
|
|
763
|
+
<div class="buttons-wrapper" part="buttons-wrapper">
|
|
764
|
+
<slot></slot>
|
|
765
|
+
</div>
|
|
766
|
+
|
|
767
|
+
<next-button class="nav-next" part="nav-next-button"></next-button>
|
|
768
|
+
</div>
|
|
769
|
+
`, 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-primary);border-radius:var(--border-radius-full);border:var(--border-width-2) solid var(--color-bg-primary);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)}', R = new CSSStyleSheet();
|
|
770
|
+
R.replaceSync(X);
|
|
771
|
+
class v extends HTMLElement {
|
|
772
|
+
static _visibleCountAttribute = "visible-count";
|
|
773
|
+
_currentIndex = 0;
|
|
774
|
+
_visibleCount = 3;
|
|
775
|
+
_MIN_VISIBLE = 3;
|
|
776
|
+
_MAX_VISIBLE = 5;
|
|
777
|
+
_slotElement = null;
|
|
778
|
+
_navPrevButton = null;
|
|
779
|
+
_navNextButton = null;
|
|
780
|
+
_buttonsWrapper = null;
|
|
781
|
+
_slotChangeListener = null;
|
|
782
|
+
_keyDownListener = null;
|
|
783
|
+
/**
|
|
784
|
+
* @constructor
|
|
785
|
+
*/
|
|
786
|
+
constructor() {
|
|
787
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.adoptedStyleSheets.push(R);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Specifies which attributes should be observed for changes.
|
|
791
|
+
*/
|
|
792
|
+
static get observedAttributes() {
|
|
793
|
+
return [v._visibleCountAttribute];
|
|
794
|
+
}
|
|
795
|
+
get visibleButtons() {
|
|
796
|
+
const t = this.getAttribute(v._visibleCountAttribute);
|
|
797
|
+
if (t !== null && t !== r) {
|
|
798
|
+
const e = parseInt(t, 10);
|
|
799
|
+
return Math.max(this._MIN_VISIBLE, Math.min(this._MAX_VISIBLE, e));
|
|
800
|
+
}
|
|
801
|
+
return this._visibleCount;
|
|
802
|
+
}
|
|
803
|
+
set visibleButtons(t) {
|
|
804
|
+
const e = Math.max(
|
|
805
|
+
this._MIN_VISIBLE,
|
|
806
|
+
Math.min(this._MAX_VISIBLE, t)
|
|
807
|
+
);
|
|
808
|
+
this.setAttribute(v._visibleCountAttribute, String(e));
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Lifecycle hook: component inserted into DOM
|
|
812
|
+
*/
|
|
813
|
+
connectedCallback() {
|
|
814
|
+
this._render(), this._cacheElements(), this._setupSlotListener(), this._setupKeyboardListener(), this._updateButtonVisibility();
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Lifecycle hook: component removed from DOM
|
|
818
|
+
*/
|
|
819
|
+
disconnectedCallback() {
|
|
820
|
+
this._removeSlotListener(), this._removeKeyboardListener();
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Lifecycle hook: observed attribute changed
|
|
824
|
+
*/
|
|
825
|
+
attributeChangedCallback(t, e, i) {
|
|
826
|
+
t === v._visibleCountAttribute && (this._visibleCount = this.visibleButtons, this._buttonsWrapper !== null && this._buttonsWrapper.style.setProperty(
|
|
827
|
+
"--bar-menu-visible-count",
|
|
828
|
+
String(this.visibleButtons)
|
|
829
|
+
), this._updateButtonVisibility());
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Render the component's Shadow DOM structure
|
|
833
|
+
*/
|
|
834
|
+
_render() {
|
|
835
|
+
this.shadowRoot !== null && (this.shadowRoot.innerHTML = j);
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Cache Shadow DOM elements for performance
|
|
839
|
+
*/
|
|
840
|
+
_cacheElements() {
|
|
841
|
+
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(
|
|
842
|
+
"--bar-menu-visible-count",
|
|
843
|
+
String(this.visibleButtons)
|
|
844
|
+
), this._navPrevButton !== null && (this._navPrevButton.setAttribute("aria-label", "Previous"), this._navPrevButton.addEventListener(y.CLICK, () => {
|
|
845
|
+
this._scrollPrevious();
|
|
846
|
+
})), this._navNextButton !== null && (this._navNextButton.setAttribute("aria-label", "Next"), this._navNextButton.addEventListener(y.CLICK, () => {
|
|
847
|
+
this._scrollNext();
|
|
848
|
+
}));
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Setup listener for slot content changes
|
|
852
|
+
*/
|
|
853
|
+
_setupSlotListener() {
|
|
854
|
+
this._slotElement !== null && (this._slotChangeListener = () => {
|
|
855
|
+
this._currentIndex = 0, this._updateButtonVisibility();
|
|
856
|
+
}, this._slotElement.addEventListener("slotchange", this._slotChangeListener));
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Remove slot listener
|
|
860
|
+
*/
|
|
861
|
+
_removeSlotListener() {
|
|
862
|
+
this._slotElement !== null && this._slotChangeListener !== null && this._slotElement.removeEventListener(
|
|
863
|
+
"slotchange",
|
|
864
|
+
this._slotChangeListener
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Setup keyboard navigation listener
|
|
869
|
+
*/
|
|
870
|
+
_setupKeyboardListener() {
|
|
871
|
+
this._keyDownListener = (t) => {
|
|
872
|
+
t.key === "ArrowLeft" ? (t.preventDefault(), this._scrollPrevious()) : t.key === "ArrowRight" && (t.preventDefault(), this._scrollNext());
|
|
873
|
+
}, this.addEventListener(f.KEY_DOWN, this._keyDownListener);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Remove keyboard listener
|
|
877
|
+
*/
|
|
878
|
+
_removeKeyboardListener() {
|
|
879
|
+
this._keyDownListener !== null && this.removeEventListener(f.KEY_DOWN, this._keyDownListener);
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Get all slotted button elements
|
|
883
|
+
*/
|
|
884
|
+
_getSlottedButtons() {
|
|
885
|
+
return this._slotElement === null ? [] : this._slotElement.assignedElements();
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Update button visibility by showing/hiding rows with fade
|
|
889
|
+
*/
|
|
890
|
+
_updateButtonVisibility(t) {
|
|
891
|
+
const e = this._getSlottedButtons(), i = e.length, l = this.visibleButtons, h = this._currentIndex, m = Math.min(h + l, i);
|
|
892
|
+
e.forEach((n, o) => {
|
|
893
|
+
const p = o >= h && o < m, u = n;
|
|
894
|
+
p || (n.classList.remove("visible-button"), n.classList.remove("animating"), u.style.display = "none");
|
|
895
|
+
}), t !== void 0 ? (e[0]?.offsetHeight, e.forEach((n, o) => {
|
|
896
|
+
if (o >= h && o < m) {
|
|
897
|
+
const u = n;
|
|
898
|
+
u.style.display = "inline-flex", n.classList.add("animating");
|
|
899
|
+
const I = o % this.visibleButtons * 50;
|
|
900
|
+
u.style.transitionDelay = `${I}ms`;
|
|
901
|
+
}
|
|
902
|
+
}), e[0]?.offsetHeight, e.forEach((n, o) => {
|
|
903
|
+
o >= h && o < m && n.classList.add("visible-button");
|
|
904
|
+
}), setTimeout(() => {
|
|
905
|
+
e.forEach((n) => {
|
|
906
|
+
n.classList.remove("animating"), n.style.transitionDelay = r;
|
|
907
|
+
});
|
|
908
|
+
}, 400)) : e.forEach((n, o) => {
|
|
909
|
+
const p = o >= h && o < m, u = n;
|
|
910
|
+
p && (u.style.display = "inline-flex", n.classList.add("visible-button"));
|
|
911
|
+
}), this._updateNavigationButtons(i, l);
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Update navigation buttons visibility and disabled state
|
|
915
|
+
*/
|
|
916
|
+
_updateNavigationButtons(t, e) {
|
|
917
|
+
const i = t > e, l = this._currentIndex + e < t;
|
|
918
|
+
this._navPrevButton !== null && (i ? (this._navPrevButton.classList.add("visible"), this._navPrevButton.disabled = this._currentIndex === 0) : this._navPrevButton.classList.remove("visible")), this._navNextButton !== null && (i ? (this._navNextButton.classList.add("visible"), this._navNextButton.disabled = !l) : this._navNextButton.classList.remove("visible"));
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Navigate to previous page (scrolls by visibleCount buttons)
|
|
922
|
+
*/
|
|
923
|
+
_scrollPrevious() {
|
|
924
|
+
this._currentIndex > 0 && (this._currentIndex = Math.max(
|
|
925
|
+
0,
|
|
926
|
+
this._currentIndex - this.visibleButtons
|
|
927
|
+
), this._updateButtonVisibility("previous"));
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Navigate to next page (scrolls by visibleCount buttons)
|
|
931
|
+
*/
|
|
932
|
+
_scrollNext() {
|
|
933
|
+
const t = this._getSlottedButtons().length, e = this.visibleButtons, i = this._currentIndex + e;
|
|
934
|
+
i < t && (this._currentIndex = i, this._updateButtonVisibility("next"));
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Public API: scroll to specific button by index
|
|
938
|
+
*/
|
|
939
|
+
scrollToButton(t) {
|
|
940
|
+
const e = this._getSlottedButtons().length, i = this.visibleButtons;
|
|
941
|
+
t >= 0 && t < e && (this._currentIndex = Math.max(
|
|
942
|
+
0,
|
|
943
|
+
Math.min(t, e - i)
|
|
944
|
+
), this._updateButtonVisibility());
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Public API: get currently visible buttons
|
|
948
|
+
*/
|
|
949
|
+
getVisibleButtons() {
|
|
950
|
+
return this._getSlottedButtons().filter(
|
|
951
|
+
(t) => t.classList.contains("visible-button")
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Public API: get all buttons
|
|
956
|
+
*/
|
|
957
|
+
getAllButtons() {
|
|
958
|
+
return this._getSlottedButtons();
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Public API: get current scroll index
|
|
962
|
+
*/
|
|
963
|
+
getCurrentIndex() {
|
|
964
|
+
return this._currentIndex;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
const ut = "bar-menu";
|
|
658
968
|
export {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
s as
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
969
|
+
G as APPLICATION_NAME,
|
|
970
|
+
v as BarMenuComponent,
|
|
971
|
+
s as BaseButtonComponent,
|
|
972
|
+
d as BaseDialogComponent,
|
|
973
|
+
et as ConfirmButtonComponent,
|
|
974
|
+
a as ConfirmationDialogComponent,
|
|
975
|
+
A as HeaderBodyFooterDialogComponent,
|
|
976
|
+
nt as NextButtonComponent,
|
|
977
|
+
it as PreviousButtonComponent,
|
|
978
|
+
tt as UndoButtonComponent,
|
|
979
|
+
J as WebComponentsRegistry,
|
|
980
|
+
ut as barMenuWebComponentSelector,
|
|
981
|
+
Q as baseButtonWebComponentSelector,
|
|
982
|
+
at as baseDialogWebComponentSelector,
|
|
983
|
+
st as confirmButtonWebComponentSelector,
|
|
984
|
+
lt as confirmationDialogWebComponentSelector,
|
|
985
|
+
dt as headerBodyFooterDialogWebComponentSelector,
|
|
986
|
+
ot as nextButtonWebComponentSelector,
|
|
987
|
+
rt as previousButtonWebComponentSelector,
|
|
988
|
+
Z as undoButtonWebComponentSelector
|
|
673
989
|
};
|