@swiftwc/ui 0.0.0-dev.21 → 0.0.0-dev.23
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/client/index.d.ts +1 -1
- package/generated/client/index.js +97 -32
- 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/fine-tooltip.d.ts +7 -0
- package/generated/components/fine-tooltip.js +93 -0
- 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/index.d.ts +1 -0
- package/generated/components/index.js +1 -0
- 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.js +22 -19
- package/generated/components/tool-bar.d.ts +12 -0
- package/generated/components/tool-bar.js +19 -6
- package/generated/css/index.css +485 -198
- 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.d.ts +1 -1
- package/generated/internal/utils/button-role.js +33 -8
- package/generated/internal/utils/index.d.ts +0 -1
- package/generated/internal/utils/index.js +0 -1
- package/package.json +1 -1
- package/scss/_components.scss +2 -0
- package/scss/_mixins.scss +4 -0
- package/scss/_transitions.scss +2 -0
- package/scss/_vars.scss +5 -0
- package/scss/base/_reboot.scss +15 -0
- package/scss/base/_root.scss +63 -67
- package/scss/colors/_index.scss +82 -33
- package/scss/components/_alert-dialog.scss +4 -5
- 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/_confirmation-dialog.scss +1 -1
- package/scss/components/_content-unavailable-view.scss +1 -1
- package/scss/components/_disclosure-group.scss +80 -33
- package/scss/components/_fine-tooltip.scss +82 -0
- package/scss/components/_glass-button.scss +14 -0
- package/scss/components/_glass-prominent-button.scss +14 -0
- package/scss/components/_index.scss +21 -20
- package/scss/components/_label-view.scss +42 -16
- package/scss/components/_label-view.scss.txt +536 -0
- package/scss/components/_menu-view.scss +17 -0
- package/scss/components/_navigation-split-view.scss +3 -3
- package/scss/components/_sheet-view.scss +12 -12
- package/scss/components/_tab-bar.scss +5 -0
- package/scss/components/_tool-bar-item.scss +71 -53
- package/scss/components/_tool-bar.scss +25 -0
- package/scss/mixins/_button.scss +42 -0
- package/scss/mixins/_color.scss +16 -0
- package/scss/mixins/_index.scss +1 -1
- package/scss/placeholders/_buttons.scss +40 -48
- package/scss/transitions/_fine-tooltip.scss +21 -0
- package/scss/transitions/_tab-bar.scss +6 -5
- package/web-components.html-data/en.json +18 -16
- package/generated/internal/utils/toolbar-repositioner.d.ts +0 -1
- package/generated/internal/utils/toolbar-repositioner.js +0 -12
|
@@ -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
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
2
|
+
import { buttonRole, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { Snapshot } from '../snapshot';
|
|
4
4
|
export class ToolBarItem extends HTMLElement {
|
|
5
5
|
static get observedAttributes() {
|
|
6
|
-
return ['
|
|
6
|
+
return ['slot', 'data-previous-slot'];
|
|
7
7
|
}
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
@@ -18,17 +18,19 @@ export class ToolBarItem extends HTMLElement {
|
|
|
18
18
|
return false;
|
|
19
19
|
return true;
|
|
20
20
|
}), this).on());
|
|
21
|
-
if (this.closest('tool-bar-item-group'))
|
|
22
|
-
|
|
23
|
-
if (!
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
21
|
+
// if (this.closest('tool-bar-item-group')) return
|
|
22
|
+
// if (!this.closest('[is=sheet-view]')) return
|
|
23
|
+
// if (!self.matchMedia('(pointer: fine)').matches) return
|
|
24
|
+
// const handler1 = toolbarRepositioner.bind(null, this)
|
|
25
|
+
// CleanupRegistry.register(this, onoff('fine_dialog_sheet:change', handler1 as unknown as EventListener, Snapshot.on).on())
|
|
26
|
+
// Snapshot.waitReady.then(() => {
|
|
27
|
+
// toolbarRepositioner(
|
|
28
|
+
// this,
|
|
29
|
+
// new MediaQueryListEvent(`media-change`, {
|
|
30
|
+
// matches: Snapshot.breakpoints?.get('fine_dialog_sheet'),
|
|
31
|
+
// })
|
|
32
|
+
// ) // Initial check
|
|
33
|
+
// })
|
|
32
34
|
}
|
|
33
35
|
disconnectedCallback() {
|
|
34
36
|
console.debug(`${ToolBarItem.name} ⚡️ disconnect`);
|
|
@@ -37,12 +39,13 @@ export class ToolBarItem extends HTMLElement {
|
|
|
37
39
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
38
40
|
console.debug(`${ToolBarItem.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
39
41
|
switch (name) {
|
|
40
|
-
case '
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
case 'slot':
|
|
43
|
+
case 'data-previous-slot':
|
|
44
|
+
const target = this.querySelector(':scope>button');
|
|
45
|
+
if (target && ['confirmation-action'].includes(newValue ?? ''))
|
|
46
|
+
Snapshot.waitReady.then(() => {
|
|
47
|
+
buttonRole(target, newValue);
|
|
48
|
+
});
|
|
46
49
|
break;
|
|
47
50
|
}
|
|
48
51
|
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
|
|
3
|
+
* @slot primary-action - The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
4
|
+
* @slot confirmation-action - The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
5
|
+
* @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
6
|
+
* @slot top-bar-leading - Places the item in the leading edge of the top bar
|
|
7
|
+
* @slot top-bar-principal - Places the item in the middle of the top bar
|
|
8
|
+
* @slot top-bar-trailing - Places the item in the trailing edge of the top bar
|
|
9
|
+
* @slot bottom-bar-leading - Places the item in the leading edge of the bottom bar
|
|
10
|
+
* @slot bottom-bar-principal - Places the item in the middle of the bottom bar
|
|
11
|
+
* @slot bottom-bar-trailing - Places the item in the trailing edge of the bottom bar
|
|
12
|
+
*/
|
|
1
13
|
export declare class ToolBar extends HTMLElement {
|
|
2
14
|
#private;
|
|
3
15
|
static get template(): DocumentFragment;
|
|
@@ -2,6 +2,18 @@ var _a;
|
|
|
2
2
|
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
3
3
|
import { $ } from '../internal/utils';
|
|
4
4
|
const observers = new ResizeObserverSingleton();
|
|
5
|
+
/**
|
|
6
|
+
* @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
|
|
7
|
+
* @slot primary-action - The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
8
|
+
* @slot confirmation-action - The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
9
|
+
* @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
|
|
10
|
+
* @slot top-bar-leading - Places the item in the leading edge of the top bar
|
|
11
|
+
* @slot top-bar-principal - Places the item in the middle of the top bar
|
|
12
|
+
* @slot top-bar-trailing - Places the item in the trailing edge of the top bar
|
|
13
|
+
* @slot bottom-bar-leading - Places the item in the leading edge of the bottom bar
|
|
14
|
+
* @slot bottom-bar-principal - Places the item in the middle of the bottom bar
|
|
15
|
+
* @slot bottom-bar-trailing - Places the item in the trailing edge of the bottom bar
|
|
16
|
+
*/
|
|
5
17
|
export class ToolBar extends HTMLElement {
|
|
6
18
|
static #template;
|
|
7
19
|
static get template() {
|
|
@@ -9,6 +21,7 @@ export class ToolBar extends HTMLElement {
|
|
|
9
21
|
return (this.#template ??= $(String.raw `
|
|
10
22
|
<div part="root top-bar">
|
|
11
23
|
<div part="root toolbar-leading-stack">
|
|
24
|
+
<slot name="cancellation-action"></slot>
|
|
12
25
|
<slot name="top-bar-leading"></slot>
|
|
13
26
|
</div>
|
|
14
27
|
<div part="root toolbar-principal-stack">
|
|
@@ -16,6 +29,9 @@ export class ToolBar extends HTMLElement {
|
|
|
16
29
|
</div>
|
|
17
30
|
<div part="root toolbar-trailing-stack">
|
|
18
31
|
<slot name="top-bar-trailing"></slot>
|
|
32
|
+
<slot name="primary-action"></slot>
|
|
33
|
+
<slot name="confirmation-action"></slot>
|
|
34
|
+
<slot name="destructive-action"></slot>
|
|
19
35
|
</div>
|
|
20
36
|
</div>
|
|
21
37
|
<div part="root bottom-bar">
|
|
@@ -32,15 +48,12 @@ export class ToolBar extends HTMLElement {
|
|
|
32
48
|
}
|
|
33
49
|
#shadowRoot;
|
|
34
50
|
get #scrollView() {
|
|
35
|
-
return this.parentElement?.querySelector(':scope
|
|
51
|
+
return this.parentElement?.querySelector(':scope>scroll-view') ?? undefined; //this.previousElementSibling ?? undefined
|
|
36
52
|
}
|
|
37
53
|
constructor() {
|
|
38
54
|
super();
|
|
39
55
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
40
|
-
// NOTE: wait for config
|
|
41
|
-
// Snapshot.waitReady.then(() => {
|
|
42
56
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
43
|
-
// })
|
|
44
57
|
}
|
|
45
58
|
connectedCallback() {
|
|
46
59
|
console.debug(`${_a.name} ⚡️ connect`);
|
|
@@ -63,7 +76,7 @@ export class ToolBar extends HTMLElement {
|
|
|
63
76
|
'top-bar': 'navbar',
|
|
64
77
|
'bottom-bar': 'toolbar', //'bottombar',
|
|
65
78
|
};
|
|
66
|
-
const { contentRect, target } = entry;
|
|
79
|
+
const { contentRect: { width }, target, } = entry;
|
|
67
80
|
const parentPart = target.parentElement?.part.contains('top-bar') ? 'top-bar' : target.parentElement?.part.contains('bottom-bar') ? 'bottom-bar' : null;
|
|
68
81
|
if (!parentPart)
|
|
69
82
|
return;
|
|
@@ -71,7 +84,7 @@ export class ToolBar extends HTMLElement {
|
|
|
71
84
|
if (!side)
|
|
72
85
|
return;
|
|
73
86
|
const prop = `--${parentMap[parentPart]}-padding-${side}`;
|
|
74
|
-
|
|
87
|
+
this.#scrollView?.style?.setProperty(prop, `${Math.round(width)}px`); // $.prop(prop, `${Math.round(width)}px`, this.#scrollView) //
|
|
75
88
|
}
|
|
76
89
|
}
|
|
77
90
|
_a = ToolBar;
|