@swiftwc/ui 0.0.0-dev.21 → 0.0.0-dev.22
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/generated/components/bordered-button.d.ts +4 -0
- package/generated/components/bordered-button.js +8 -1
- package/generated/components/bordered-prominent-button.d.ts +4 -0
- package/generated/components/bordered-prominent-button.js +8 -1
- package/generated/components/borderless-button.d.ts +4 -0
- package/generated/components/borderless-button.js +8 -1
- package/generated/components/date-picker.js +10 -4
- package/generated/components/glass-button.d.ts +4 -0
- package/generated/components/glass-button.js +8 -1
- package/generated/components/glass-prominent-button.d.ts +4 -0
- package/generated/components/glass-prominent-button.js +8 -1
- package/generated/components/label-view.js +1 -33
- package/generated/components/picker-view.js +19 -15
- package/generated/components/scroll-view.js +8 -3
- package/generated/components/sheet-view.d.ts +0 -1
- package/generated/components/sheet-view.js +19 -7
- package/generated/components/sidebar-toggle.js +1 -1
- package/generated/components/tab-view.js +7 -7
- package/generated/components/table-view.js +11 -5
- package/generated/components/text-field.js +9 -4
- package/generated/components/tool-bar-item-group.d.ts +0 -2
- package/generated/components/tool-bar-item-group.js +15 -26
- package/generated/components/tool-bar-item.d.ts +0 -2
- package/generated/components/tool-bar-item.js +17 -28
- package/generated/components/tool-bar.d.ts +12 -0
- package/generated/components/tool-bar.js +19 -6
- package/generated/css/index.css +270 -70
- package/generated/events/tab-view.d.ts +6 -2
- package/generated/internal/class/css-style-observer.js +1 -1
- package/generated/internal/utils/button-role.js +25 -5
- package/generated/internal/utils/index.d.ts +0 -1
- package/generated/internal/utils/index.js +0 -1
- package/package.json +1 -1
- package/scss/_vars.scss +5 -0
- package/scss/base/_reboot.scss +10 -0
- package/scss/colors/_index.scss +37 -19
- package/scss/components/_bordered-button.scss +14 -0
- package/scss/components/_bordered-prominent-button.scss +13 -0
- package/scss/components/_borderless-button.scss +4 -0
- package/scss/components/_content-unavailable-view.scss +1 -1
- package/scss/components/_disclosure-group.scss +80 -33
- package/scss/components/_glass-button.scss +14 -0
- package/scss/components/_glass-prominent-button.scss +14 -0
- package/scss/components/_label-view.scss +42 -16
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_sheet-view.scss +12 -12
- package/scss/components/_tab-bar.scss +5 -0
- package/scss/components/_tool-bar-item.scss +19 -0
- package/scss/components/_tool-bar.scss +25 -0
- package/scss/placeholders/_buttons.scss +72 -37
- package/scss/transitions/_tab-bar.scss +6 -5
- package/web-components.html-data/en.json +12 -21
- package/generated/internal/utils/toolbar-repositioner.d.ts +0 -1
- package/generated/internal/utils/toolbar-repositioner.js +0 -12
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
2
|
import { buttonRole, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
4
9
|
export class BorderedButton extends ButtonBase {
|
|
5
10
|
static get observedAttributes() {
|
|
6
11
|
return ['role'];
|
|
@@ -24,7 +29,9 @@ export class BorderedButton extends ButtonBase {
|
|
|
24
29
|
return;
|
|
25
30
|
switch (attributeName) {
|
|
26
31
|
case 'role':
|
|
27
|
-
|
|
32
|
+
Snapshot.waitReady.then(() => {
|
|
33
|
+
buttonRole(target, attributeName);
|
|
34
|
+
});
|
|
28
35
|
break;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
2
|
import { buttonRole, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
4
9
|
export class BorderedProminentButton extends ButtonBase {
|
|
5
10
|
static get observedAttributes() {
|
|
6
11
|
return ['role'];
|
|
@@ -24,7 +29,9 @@ export class BorderedProminentButton extends ButtonBase {
|
|
|
24
29
|
return;
|
|
25
30
|
switch (attributeName) {
|
|
26
31
|
case 'role':
|
|
27
|
-
|
|
32
|
+
Snapshot.waitReady.then(() => {
|
|
33
|
+
buttonRole(target, attributeName);
|
|
34
|
+
});
|
|
28
35
|
break;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
2
|
import { buttonRole, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
4
9
|
export class BorderlessButton extends ButtonBase {
|
|
5
10
|
static get observedAttributes() {
|
|
6
11
|
return ['role'];
|
|
@@ -24,7 +29,9 @@ export class BorderlessButton extends ButtonBase {
|
|
|
24
29
|
return;
|
|
25
30
|
switch (attributeName) {
|
|
26
31
|
case 'role':
|
|
27
|
-
|
|
32
|
+
Snapshot.waitReady.then(() => {
|
|
33
|
+
buttonRole(target, attributeName);
|
|
34
|
+
});
|
|
28
35
|
break;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -26,7 +26,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
26
26
|
// #lastRenderedStyle?: DatePickerStyle //string | null
|
|
27
27
|
#shadowRoot;
|
|
28
28
|
#customValidity = '';
|
|
29
|
-
#
|
|
29
|
+
#slots = new Map();
|
|
30
|
+
// #validitiesSlot?: HTMLSlotElement
|
|
30
31
|
#inputs = [];
|
|
31
32
|
get #internals() {
|
|
32
33
|
return getInternals(this);
|
|
@@ -123,9 +124,14 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
123
124
|
// this.#lastRenderedStyle = this.datePickerStyle
|
|
124
125
|
// clear shadow DOM
|
|
125
126
|
this.#shadowRoot.replaceChildren(document.importNode(this.template, true));
|
|
126
|
-
this
|
|
127
|
+
CleanupRegistry.unregister(this, 'slots');
|
|
128
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
129
|
+
this.#slots?.set(slot.name, slot);
|
|
130
|
+
CleanupRegistry.register(this, () => {
|
|
131
|
+
this.#slots = new Map();
|
|
132
|
+
}, 'slots');
|
|
127
133
|
CleanupRegistry.unregister(this, 'validities');
|
|
128
|
-
CleanupRegistry.register(this, onoff(makeSlotchangeHandler(this), this.#
|
|
134
|
+
CleanupRegistry.register(this, onoff(makeSlotchangeHandler(this), this.#slots?.get('validity-options')).on(), 'validities');
|
|
129
135
|
switch (this.datePickerStyle) {
|
|
130
136
|
default:
|
|
131
137
|
const [yyyy = '', mm = '', dd = ''] = new Date().toISOString().split('T').shift()?.split('-') ?? [], map = { year: yyyy, month: mm, day: dd };
|
|
@@ -385,7 +391,7 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
385
391
|
const key = k; // ✅ type-safe cast
|
|
386
392
|
if (true !== flags[key])
|
|
387
393
|
continue;
|
|
388
|
-
for (const el of this.#
|
|
394
|
+
for (const el of this.#slots?.get('validity-options')?.assignedElements({ flatten: true }) ?? []) {
|
|
389
395
|
if (!el.matches('option'))
|
|
390
396
|
continue;
|
|
391
397
|
const option = el;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
2
|
import { buttonRole, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
4
9
|
export class GlassButton extends ButtonBase {
|
|
5
10
|
static get observedAttributes() {
|
|
6
11
|
return ['role'];
|
|
@@ -24,7 +29,9 @@ export class GlassButton extends ButtonBase {
|
|
|
24
29
|
return;
|
|
25
30
|
switch (attributeName) {
|
|
26
31
|
case 'role':
|
|
27
|
-
|
|
32
|
+
Snapshot.waitReady.then(() => {
|
|
33
|
+
buttonRole(target, attributeName);
|
|
34
|
+
});
|
|
28
35
|
break;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
2
|
import { buttonRole, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
5
|
+
/**
|
|
6
|
+
* @slot overlay
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
4
9
|
export class GlassProminentButton extends ButtonBase {
|
|
5
10
|
static get observedAttributes() {
|
|
6
11
|
return ['role'];
|
|
@@ -24,7 +29,9 @@ export class GlassProminentButton extends ButtonBase {
|
|
|
24
29
|
return;
|
|
25
30
|
switch (attributeName) {
|
|
26
31
|
case 'role':
|
|
27
|
-
|
|
32
|
+
Snapshot.waitReady.then(() => {
|
|
33
|
+
buttonRole(target, attributeName);
|
|
34
|
+
});
|
|
28
35
|
break;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -14,50 +14,28 @@ export class LabelView extends HTMLElement {
|
|
|
14
14
|
</div>`));
|
|
15
15
|
}
|
|
16
16
|
#shadowRoot;
|
|
17
|
-
// #imgSlot?: HTMLSlotElement
|
|
18
|
-
// #slot?: HTMLSlotElement
|
|
19
17
|
constructor() {
|
|
20
18
|
super();
|
|
21
19
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
22
|
-
// Snapshot.waitReady.then(() => {
|
|
23
20
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
24
|
-
// // this.#imgSlot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot[name=image]') ?? undefined
|
|
25
|
-
// // this.#slot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot:not([name])') ?? undefined
|
|
26
|
-
//
|
|
27
|
-
// // this.#slot?.addEventListener('slotchange', this.#handleSlotchange)
|
|
28
|
-
// // // this.#imgSlot?.addEventListener('slotchange', this.#handleSlotchange)
|
|
29
|
-
// // // this.#handleSlotchange(new CustomEvent('slotchange'))
|
|
30
|
-
// })
|
|
31
21
|
}
|
|
32
22
|
disconnectedCallback() {
|
|
33
23
|
console.debug(`${LabelView.name} ⚡️ disconnect`);
|
|
34
|
-
// this.#slot?.removeEventListener('slotchange', this.#handleSlotchange)
|
|
35
24
|
}
|
|
36
25
|
connectedCallback() {
|
|
37
26
|
console.debug(`${LabelView.name} ⚡️ connect`);
|
|
38
27
|
}
|
|
39
28
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
40
29
|
console.debug(`${LabelView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
41
|
-
// Snapshot.waitReady.then(() => {
|
|
42
30
|
switch (name) {
|
|
43
31
|
case 'system-image':
|
|
44
32
|
let image = this.querySelector(':scope>[slot=image]');
|
|
45
33
|
if (newValue) {
|
|
46
|
-
image ??= this.appendChild($(`<i slot="image"></i>`, '>1'));
|
|
34
|
+
image ??= this.appendChild($(`<i slot="image" style="line-height: 1.05"></i>`, '>1'));
|
|
47
35
|
image.setAttribute('class', `ph ph-${newValue}`);
|
|
48
36
|
}
|
|
49
37
|
else
|
|
50
38
|
image?.remove();
|
|
51
|
-
// // const imgSlot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot[name=image]')
|
|
52
|
-
// // if (!imgSlot) break
|
|
53
|
-
// const assigned = this.#imgSlot!.assignedElements({ flatten: true }) as HTMLElement[]
|
|
54
|
-
// let el = assigned[0] as HTMLElement | undefined
|
|
55
|
-
// if (!el) {
|
|
56
|
-
// el = document.createElement('i')
|
|
57
|
-
// el.slot = 'image'
|
|
58
|
-
// this.append(el)
|
|
59
|
-
// }
|
|
60
|
-
// el.setAttribute('class', `ph ph-${newValue}`)
|
|
61
39
|
break;
|
|
62
40
|
case 'title':
|
|
63
41
|
let title = this.querySelector(':scope>:not([slot])');
|
|
@@ -67,17 +45,7 @@ export class LabelView extends HTMLElement {
|
|
|
67
45
|
}
|
|
68
46
|
else
|
|
69
47
|
title?.remove();
|
|
70
|
-
// // const titleSlot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot:not([name])')
|
|
71
|
-
// // if (!titleSlot) break
|
|
72
|
-
// const title = this.#slot!.assignedElements({ flatten: true }) as HTMLElement[]
|
|
73
|
-
// let el2 = title[0] as HTMLElement | undefined
|
|
74
|
-
// if (!el2) {
|
|
75
|
-
// el2 = document.createElement('span')
|
|
76
|
-
// this.append(el2)
|
|
77
|
-
// }
|
|
78
|
-
// el2.textContent = newValue //el2.replaceChildren(escapeHTMLPolicy.createHTML(newValue))
|
|
79
48
|
break;
|
|
80
49
|
}
|
|
81
|
-
// })
|
|
82
50
|
}
|
|
83
51
|
}
|
|
@@ -21,9 +21,10 @@ export class PickerView extends FormAssociatedBase {
|
|
|
21
21
|
#lastRenderedStyle; //string | null
|
|
22
22
|
#shadowRoot;
|
|
23
23
|
#customValidity = '';
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
24
|
+
#slots = new Map();
|
|
25
|
+
// #validitiesSlot?: HTMLSlotElement
|
|
26
|
+
// #datalistSlot?: HTMLSlotElement
|
|
27
|
+
// #tagSlot?: HTMLSlotElement
|
|
27
28
|
#trackedElements = new Set();
|
|
28
29
|
#selection = '';
|
|
29
30
|
get #internals() {
|
|
@@ -176,21 +177,24 @@ export class PickerView extends FormAssociatedBase {
|
|
|
176
177
|
this.#lastRenderedStyle = this.pickerStyle;
|
|
177
178
|
// clear shadow DOM
|
|
178
179
|
this.#shadowRoot.replaceChildren(document.importNode(this.template, true));
|
|
179
|
-
this
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
CleanupRegistry.unregister(this, 'slots');
|
|
181
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
182
|
+
this.#slots?.set(slot.name, slot);
|
|
183
|
+
CleanupRegistry.register(this, () => {
|
|
184
|
+
this.#slots = new Map();
|
|
185
|
+
}, 'slots');
|
|
182
186
|
CleanupRegistry.unregister(this, 'validities');
|
|
183
|
-
CleanupRegistry.register(this, onoff(makeSlotchangeHandler(this), this.#
|
|
187
|
+
CleanupRegistry.register(this, onoff(makeSlotchangeHandler(this), this.#slots?.get('validity-options')).on(), 'validities');
|
|
184
188
|
CleanupRegistry.unregister(this, 'datalist'); //off1()
|
|
185
|
-
CleanupRegistry.register(this, onoff('slotchange', this.#handleSlotchange, this.#
|
|
189
|
+
CleanupRegistry.register(this, onoff('slotchange', this.#handleSlotchange, this.#slots?.get('options')).on(), 'datalist');
|
|
186
190
|
CleanupRegistry.unregister(this, 'tags'); //off2()
|
|
187
|
-
CleanupRegistry.register(this, onoff('slotchange', this.#handleSlotchange, this.#
|
|
188
|
-
// if (0 < (this.#
|
|
189
|
-
// if (0 < (this.#
|
|
191
|
+
CleanupRegistry.register(this, onoff('slotchange', this.#handleSlotchange, this.#slots?.get('tag')).on(), 'tags');
|
|
192
|
+
// if (0 < (this.#slots?.get('options')?.assignedElements({ flatten: true }) ?? []).length) this.#handleTagMutation()
|
|
193
|
+
// if (0 < (this.#slots?.get('tag')?.assignedElements({ flatten: true }) ?? []).length) this.#handleTagMutation()
|
|
190
194
|
//this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)) {
|
|
191
195
|
switch (this.pickerStyle
|
|
192
196
|
// case 'menu':
|
|
193
|
-
// // if (0 < (this.#
|
|
197
|
+
// // if (0 < (this.#slots?.get('options')?.assignedElements({ flatten: true }) ?? []).length) this.#handleMenuDatalistMutation()
|
|
194
198
|
// break
|
|
195
199
|
// case 'gg':
|
|
196
200
|
// // reattach input listener
|
|
@@ -209,7 +213,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
209
213
|
// break
|
|
210
214
|
// case 'inline':
|
|
211
215
|
// default:
|
|
212
|
-
// // if (0 < (this.#
|
|
216
|
+
// // if (0 < (this.#slots?.get('options')?.assignedElements({ flatten: true }) ?? []).length) this.#handleInlineDatalistMutation()
|
|
213
217
|
// break
|
|
214
218
|
) {
|
|
215
219
|
}
|
|
@@ -299,7 +303,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
299
303
|
}
|
|
300
304
|
#handleTagMutation = (entry) => {
|
|
301
305
|
console.debug(`${_a.name} ⚡️ mutation`);
|
|
302
|
-
const sourceSlot = 0 < (this.#
|
|
306
|
+
const sourceSlot = 0 < (this.#slots?.get('options')?.assignedElements({ flatten: true }) ?? []).length ? this.#slots?.get('options') : this.#slots?.get('tag');
|
|
303
307
|
// switch (this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)) {
|
|
304
308
|
switch (this.pickerStyle) {
|
|
305
309
|
case 'menu':
|
|
@@ -402,7 +406,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
402
406
|
const key = k; // ✅ type-safe cast
|
|
403
407
|
if (true !== flags[key])
|
|
404
408
|
continue;
|
|
405
|
-
for (const el of this.#
|
|
409
|
+
for (const el of this.#slots?.get('validity-options')?.assignedElements({ flatten: true }) ?? []) {
|
|
406
410
|
if (!el.matches('option'))
|
|
407
411
|
continue;
|
|
408
412
|
const option = el;
|
|
@@ -24,7 +24,8 @@ export class ScrollView extends HTMLElement {
|
|
|
24
24
|
</div>`));
|
|
25
25
|
}
|
|
26
26
|
#shadowRoot;
|
|
27
|
-
#
|
|
27
|
+
#slots = new Map();
|
|
28
|
+
// #navbarPrincipalSlot?: HTMLSlotElement
|
|
28
29
|
#isMidScroll;
|
|
29
30
|
#lastScrollTop = 0;
|
|
30
31
|
// #stopRecordingScrollTop?: boolean = false
|
|
@@ -33,7 +34,11 @@ export class ScrollView extends HTMLElement {
|
|
|
33
34
|
super();
|
|
34
35
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
35
36
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
36
|
-
|
|
37
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
38
|
+
this.#slots?.set(slot.name, slot);
|
|
39
|
+
CleanupRegistry.register(this, () => {
|
|
40
|
+
this.#slots = new Map();
|
|
41
|
+
});
|
|
37
42
|
}
|
|
38
43
|
disconnectedCallback() {
|
|
39
44
|
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
@@ -84,7 +89,7 @@ export class ScrollView extends HTMLElement {
|
|
|
84
89
|
break; // iREPAINT ALERT! if (0 === this.offsetHeight + this.offsetWidth) break
|
|
85
90
|
if (!this.#isMidScroll)
|
|
86
91
|
break;
|
|
87
|
-
const title = this.#
|
|
92
|
+
const title = this.#slots?.get('top-bar-principal')?.assignedElements({ flatten: true })?.at(0);
|
|
88
93
|
slowHideShow('largeinline' === `${oldValue}${newValue}` ? 'show' : 'hide', title);
|
|
89
94
|
break;
|
|
90
95
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DialogBase } from '../namespace-browser/base';
|
|
2
2
|
export declare class SheetView extends DialogBase {
|
|
3
3
|
#private;
|
|
4
|
-
static get observedAttributes(): string[];
|
|
5
4
|
constructor();
|
|
6
5
|
static polyfillDisconnectedCallback(el: SheetView): void;
|
|
7
6
|
static polyfillConnectedCallback(el: SheetView): void;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
2
|
import { onoff } from '../internal/utils';
|
|
3
3
|
import { DialogBase } from '../namespace-browser/base';
|
|
4
|
+
import { Snapshot } from '../snapshot';
|
|
4
5
|
export class SheetView extends DialogBase {
|
|
5
|
-
static get observedAttributes() {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
// static get observedAttributes() {
|
|
7
|
+
// return ['fine-presentation-large-adaptation']
|
|
8
|
+
// }
|
|
8
9
|
constructor() {
|
|
9
10
|
super();
|
|
10
11
|
}
|
|
@@ -19,10 +20,19 @@ export class SheetView extends DialogBase {
|
|
|
19
20
|
{ types: 'keydown', listener: SheetView.#handleKeydown },
|
|
20
21
|
], el).on());
|
|
21
22
|
el.autofocus = true;
|
|
23
|
+
if (!self.matchMedia('(pointer: fine)').matches)
|
|
24
|
+
return;
|
|
25
|
+
const handler1 = this.#handleMediaChange.bind(null, el);
|
|
26
|
+
CleanupRegistry.register(el, onoff('fine_dialog_sheet:change', handler1, Snapshot.on).on());
|
|
27
|
+
Snapshot.waitReady.then(() => {
|
|
28
|
+
this.#handleMediaChange(el, new MediaQueryListEvent(`media-change`, {
|
|
29
|
+
matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
30
|
+
})); // Initial check
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
24
34
|
console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
25
|
-
// NOTE: wait for config
|
|
35
|
+
// // NOTE: wait for config
|
|
26
36
|
// Snapshot.waitReady.then(() => {
|
|
27
37
|
// switch (attributeName) {
|
|
28
38
|
// case 'fine-presentation-large-adaptation':
|
|
@@ -60,9 +70,11 @@ export class SheetView extends DialogBase {
|
|
|
60
70
|
static #handleMediaChange = (el, evt) => {
|
|
61
71
|
console.debug(`${SheetView.name} ⚡️ ${evt?.type}`);
|
|
62
72
|
if (evt.matches)
|
|
63
|
-
for (const item of el.querySelectorAll(':scope>tool-bar>[slot^="top-bar-"]')) {
|
|
64
|
-
|
|
65
|
-
item.slot
|
|
73
|
+
for (const item of el.querySelectorAll(':scope>tool-bar>[slot^="top-bar-"],:scope>tool-bar>[slot="cancellation-action"],:scope>tool-bar>[slot="primary-action"],:scope>tool-bar>[slot="confirmation-action"],:scope>tool-bar>[slot="destructive-action"]')) {
|
|
74
|
+
const newSlot = item.slot.endsWith('leading') ? 'bottom-bar-leading' : 'bottom-bar-trailing';
|
|
75
|
+
if (item.slot !== newSlot)
|
|
76
|
+
item.dataset.previousSlot = item.slot;
|
|
77
|
+
item.slot = newSlot;
|
|
66
78
|
}
|
|
67
79
|
else
|
|
68
80
|
for (const item of el.querySelectorAll(':scope>tool-bar>[data-previous-slot]')) {
|
|
@@ -23,7 +23,7 @@ export class SidebarToggle extends HTMLElement {
|
|
|
23
23
|
CleanupRegistry.unregister(this);
|
|
24
24
|
}
|
|
25
25
|
static query(target) {
|
|
26
|
-
const container = target?.closest('navigation-split-view,tab-view'), sideBar = container?.querySelector(':scope
|
|
26
|
+
const container = target?.closest('navigation-split-view,tab-view'), sideBar = container?.querySelector(':scope>[is=sidebar-view]');
|
|
27
27
|
return { container, sideBar };
|
|
28
28
|
}
|
|
29
29
|
// This triggers on show/hide of any of sidebar-toggle elements
|
|
@@ -89,7 +89,7 @@ export class TabView extends HTMLElement {
|
|
|
89
89
|
const style = self.getComputedStyle(form);
|
|
90
90
|
if ('sidebar' !== style.getPropertyValue('--list-style'))
|
|
91
91
|
return;
|
|
92
|
-
this.#addAnimations();
|
|
92
|
+
this.#addAnimations(new CustomEvent('beforetabreveal', { detail: { tag: '', ms: cssTime(`${this.computedStyleMap().get(`--tabbar-after-tabreveal-duration`)}`) }, bubbles: true, composed: true }));
|
|
93
93
|
};
|
|
94
94
|
#handleTabViewPagereveal = (evt) => {
|
|
95
95
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
@@ -202,28 +202,28 @@ export class TabView extends HTMLElement {
|
|
|
202
202
|
throw new Error('selectedTab[] must be in order of parent>child. You provided an element that contains the previous sibling.');
|
|
203
203
|
//
|
|
204
204
|
const selectors = [':not(:is(:scope>{{tag}}))', ':is(:scope>{{tag}})']; // first nested ones, then root ones
|
|
205
|
+
const ms = cssTime(`${this.computedStyleMap().get(`--tabbar-after-tabreveal-duration`)}`);
|
|
205
206
|
for (const selector of selectors)
|
|
206
207
|
for (const ns of this.querySelectorAll(`navigation-stack:not([hidden])${selector.replace('{{tag}}', 'navigation-stack')},navigation-split-view:not([hidden])${selector.replace('{{tag}}', 'navigation-split-view')}`)) {
|
|
207
208
|
if (!tabs.some((tab) => !ns.contains(tab)))
|
|
208
209
|
continue; // shouldRun
|
|
209
|
-
ns.dispatchEvent(new CustomEvent('beforetabswap', { detail: { tag: ns.id }, bubbles: true, composed: true }));
|
|
210
|
+
ns.dispatchEvent(new CustomEvent('beforetabswap', { detail: { tag: ns.id, ms }, bubbles: true, composed: true }));
|
|
210
211
|
ns.hidden = true; // triggers
|
|
211
212
|
}
|
|
212
213
|
for (const selector of selectors.reverse())
|
|
213
214
|
for (const ns of this.querySelectorAll(`navigation-stack[hidden]${selector.replace('{{tag}}', 'navigation-stack')},navigation-split-view[hidden]${selector.replace('{{tag}}', 'navigation-split-view')}`)) {
|
|
214
215
|
if (!tabs.some((tab) => ns.contains(tab)))
|
|
215
216
|
continue; // shouldRun
|
|
216
|
-
ns.dispatchEvent(new CustomEvent('beforetabreveal', { detail: { tag: ns.id }, bubbles: true, composed: true }));
|
|
217
|
+
ns.dispatchEvent(new CustomEvent('beforetabreveal', { detail: { tag: ns.id, ms }, bubbles: true, composed: true }));
|
|
217
218
|
ns.hidden = false; // triggers
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
|
-
#addAnimations = () => {
|
|
221
|
+
#addAnimations = (evt) => {
|
|
221
222
|
this.setAttribute('js-aftertabreveal', '');
|
|
223
|
+
// const ms = cssTime(`${this.computedStyleMap().get(`--tabbar-after-tabreveal-duration`)}`)
|
|
222
224
|
this.#afterTabRevealDelay.next(() => {
|
|
223
225
|
this.removeAttribute('js-aftertabreveal');
|
|
224
|
-
},
|
|
225
|
-
// this.removeAttribute('js-aftertabreveal')
|
|
226
|
-
// this.#afterTabRevealDelay = undefined
|
|
226
|
+
}, evt.detail.ms);
|
|
227
227
|
};
|
|
228
228
|
#handleSelectionChange = (evt) => {
|
|
229
229
|
this.#triggerToggleEvent(evt);
|
|
@@ -42,15 +42,21 @@ export class TableView extends HTMLElement {
|
|
|
42
42
|
</div>`));
|
|
43
43
|
}
|
|
44
44
|
#shadowRoot;
|
|
45
|
-
#
|
|
45
|
+
#slots = new Map();
|
|
46
|
+
// #colSlot?: HTMLSlotElement
|
|
46
47
|
// #slot?: HTMLSlotElement
|
|
47
48
|
constructor() {
|
|
48
49
|
super();
|
|
49
50
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
50
51
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
51
|
-
|
|
52
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
53
|
+
this.#slots?.set(slot.name, slot);
|
|
54
|
+
CleanupRegistry.register(this, () => {
|
|
55
|
+
this.#slots = new Map();
|
|
56
|
+
});
|
|
57
|
+
// this.#colSlot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot[name=column]') ?? undefined
|
|
52
58
|
// this.#slot = this.#shadowRoot.querySelector<HTMLSlotElement>('slot:not([name])') ?? undefined
|
|
53
|
-
this.#
|
|
59
|
+
this.#slots?.get('column')?.addEventListener('slotchange', this.#handleSlotchange);
|
|
54
60
|
// this.append(
|
|
55
61
|
// document.createRange().createContextualFragment(`<menu-view slot="header-trailing">
|
|
56
62
|
// <label-view slot="label" title="Delete"></label-view>
|
|
@@ -113,7 +119,7 @@ export class TableView extends HTMLElement {
|
|
|
113
119
|
};
|
|
114
120
|
#handleTagMutation = (entry) => {
|
|
115
121
|
console.debug(`${_a.name} ⚡️ mutation`);
|
|
116
|
-
// const sourceSlot = 0 < (this.#
|
|
122
|
+
// const sourceSlot = 0 < (this.#slots?.get('column')?.assignedElements({ flatten: true }) ?? []).length ? this.#slots?.get('column') : this.#slots?.get('column')
|
|
117
123
|
// const menu = this.querySelector(':scope>menu-view:not([slot])') ?? this.appendChild($(`<menu-view></menu-view>`))
|
|
118
124
|
// menu.innerHTML = `<label-view slot="label" system-image="dots-three" title="rtyty"></label-view>`
|
|
119
125
|
// for (const el of sourceSlot?.assignedElements({ flatten: true }) ?? []) menu.insertAdjacentElement('beforeend', TableView.wrapTag(el, sourceSlot?.name))
|
|
@@ -124,7 +130,7 @@ export class TableView extends HTMLElement {
|
|
|
124
130
|
CleanupRegistry.register(this, onoff('click', this.#handleMenuClick, this.#compactToolbarItem).on(), 'compact_toolbar');
|
|
125
131
|
}
|
|
126
132
|
this.#compactToolbarItem.innerHTML = `<label-view slot="label" system-image="dots-three"></label-view>`;
|
|
127
|
-
for (const node of this.#
|
|
133
|
+
for (const node of this.#slots?.get('column')?.assignedElements({ flatten: true }) ?? []) {
|
|
128
134
|
if (!node.matches('[is=table-column]'))
|
|
129
135
|
continue;
|
|
130
136
|
const btn = $(`<button type="button" tabindex="0">
|
|
@@ -28,7 +28,8 @@ export class TextField extends FormAssociatedBase {
|
|
|
28
28
|
#shadowRoot;
|
|
29
29
|
// #internals: ElementInternals
|
|
30
30
|
#customValidity = '';
|
|
31
|
-
#validitiesSlot
|
|
31
|
+
// #validitiesSlot?: HTMLSlotElement
|
|
32
|
+
#slots = new Map();
|
|
32
33
|
#input;
|
|
33
34
|
get #internals() {
|
|
34
35
|
return getInternals(this);
|
|
@@ -37,9 +38,13 @@ export class TextField extends FormAssociatedBase {
|
|
|
37
38
|
super();
|
|
38
39
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
39
40
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
40
|
-
|
|
41
|
+
for (const slot of this.#shadowRoot.querySelectorAll('slot'))
|
|
42
|
+
this.#slots?.set(slot.name, slot);
|
|
43
|
+
CleanupRegistry.register(this, () => {
|
|
44
|
+
this.#slots = new Map();
|
|
45
|
+
});
|
|
41
46
|
CleanupRegistry.unregister(this, 'validities');
|
|
42
|
-
CleanupRegistry.register(this, onoff(makeSlotchangeHandler(this), this.#
|
|
47
|
+
CleanupRegistry.register(this, onoff(makeSlotchangeHandler(this), this.#slots?.get('validity-options')).on(), 'validities');
|
|
43
48
|
this.#input = this.#shadowRoot.querySelector('input') ?? undefined;
|
|
44
49
|
CleanupRegistry.register(this, onoff([{ types: 'focusin', listener: this.#handleFocusin }], this).on());
|
|
45
50
|
CleanupRegistry.register(this, onoff([
|
|
@@ -426,7 +431,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
426
431
|
const key = k; // ✅ type-safe cast
|
|
427
432
|
if (true !== flags[key])
|
|
428
433
|
continue;
|
|
429
|
-
for (const el of this.#
|
|
434
|
+
for (const el of this.#slots?.get('validity-options')?.assignedElements({ flatten: true }) ?? []) {
|
|
430
435
|
if (!el.matches('option'))
|
|
431
436
|
continue;
|
|
432
437
|
const option = el;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export declare class ToolBarItemGroup extends HTMLElement {
|
|
2
|
-
static get observedAttributes(): string[];
|
|
3
2
|
constructor();
|
|
4
3
|
connectedCallback(): void;
|
|
5
4
|
disconnectedCallback(): void;
|
|
6
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
7
5
|
}
|
|
@@ -1,39 +1,28 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff, toolbarRepositioner } from '../internal/utils';
|
|
3
|
-
import { Snapshot } from '../snapshot';
|
|
4
2
|
export class ToolBarItemGroup extends HTMLElement {
|
|
5
|
-
static get observedAttributes() {
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
// static get observedAttributes() {
|
|
4
|
+
// return ['preferred-fine-modal-placement']
|
|
5
|
+
// }
|
|
8
6
|
constructor() {
|
|
9
7
|
super();
|
|
10
8
|
}
|
|
11
9
|
connectedCallback() {
|
|
12
10
|
console.debug(`${ToolBarItemGroup.name} ⚡️ connect`);
|
|
13
|
-
if (!this.closest('[is=sheet-view]'))
|
|
14
|
-
|
|
15
|
-
const handler1 = toolbarRepositioner.bind(null, this)
|
|
16
|
-
CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1, Snapshot.on).on())
|
|
17
|
-
Snapshot.waitReady.then(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
// if (!this.closest('[is=sheet-view]')) return
|
|
12
|
+
// if (!self.matchMedia('(pointer: fine)').matches) return
|
|
13
|
+
// const handler1 = toolbarRepositioner.bind(null, this)
|
|
14
|
+
// CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1 as unknown as EventListener, Snapshot.on).on())
|
|
15
|
+
// Snapshot.waitReady.then(() => {
|
|
16
|
+
// toolbarRepositioner(
|
|
17
|
+
// this,
|
|
18
|
+
// new MediaQueryListEvent(`media-change`, {
|
|
19
|
+
// matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
20
|
+
// })
|
|
21
|
+
// ) // Initial check
|
|
22
|
+
// })
|
|
22
23
|
}
|
|
23
24
|
disconnectedCallback() {
|
|
24
25
|
console.debug(`${ToolBarItemGroup.name} ⚡️ disconnect`);
|
|
25
26
|
CleanupRegistry.unregister(this);
|
|
26
27
|
}
|
|
27
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
28
|
-
console.debug(`${ToolBarItemGroup.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
29
|
-
switch (name) {
|
|
30
|
-
case 'preferred-fine-modal-placement':
|
|
31
|
-
Snapshot.waitReady.then(() => {
|
|
32
|
-
toolbarRepositioner(this, new MediaQueryListEvent(`media-change`, {
|
|
33
|
-
matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
34
|
-
})); // Initial check
|
|
35
|
-
});
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
28
|
}
|