@swiftwc/ui 0.0.0-dev.36 → 0.0.0-dev.37
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 +2 -9
- package/generated/client/index.js +5 -156
- package/generated/components/alert-dialog.js +18 -21
- package/generated/components/body-view.js +3 -2
- package/generated/components/bordered-button.js +4 -4
- package/generated/components/bordered-prominent-button.js +4 -4
- package/generated/components/borderless-button.js +4 -4
- package/generated/components/confirmation-dialog.js +18 -21
- package/generated/components/content-unavailable-view.js +4 -4
- package/generated/components/date-picker.d.ts +0 -10
- package/generated/components/date-picker.js +43 -28
- package/generated/components/disclosure-group.js +5 -5
- package/generated/components/fine-tooltip.js +4 -4
- package/generated/components/form-view.js +3 -3
- package/generated/components/glass-button.js +4 -4
- package/generated/components/glass-prominent-button.js +4 -4
- package/generated/components/index.d.ts +1 -0
- package/generated/components/index.js +1 -0
- package/generated/components/label-view.js +4 -4
- package/generated/components/list-view.js +3 -3
- package/generated/components/menu-view.js +14 -16
- package/generated/components/navigation-large-title.js +5 -5
- package/generated/components/navigation-split-view.js +4 -3
- package/generated/components/navigation-stack.js +4 -3
- package/generated/components/navigation-title.js +4 -4
- package/generated/components/picker-view.d.ts +2 -2
- package/generated/components/picker-view.js +313 -192
- package/generated/components/plain-button.js +3 -3
- package/generated/components/progress-view.js +6 -6
- package/generated/components/screen-view.js +2 -1
- package/generated/components/scroll-view-proxy.js +3 -2
- package/generated/components/scroll-view.js +15 -18
- package/generated/components/search-view.d.ts +8 -0
- package/generated/components/search-view.js +27 -0
- package/generated/components/section-view.js +4 -4
- package/generated/components/sheet-view.js +6 -34
- package/generated/components/sidebar-toggle.js +9 -10
- package/generated/components/sidebar-view.js +6 -8
- package/generated/components/sticky-container.js +3 -3
- package/generated/components/tab-bar.js +8 -10
- package/generated/components/tab-item.js +8 -8
- package/generated/components/tab-view.js +10 -11
- package/generated/components/table-view.js +18 -36
- package/generated/components/text-field.js +32 -17
- package/generated/components/tool-bar-item-group.js +17 -19
- package/generated/components/tool-bar-item.js +22 -23
- package/generated/components/tool-bar.d.ts +2 -2
- package/generated/components/tool-bar.js +7 -7
- package/generated/components/v-keyboard.js +5 -5
- package/generated/components/v-stack.js +3 -2
- package/generated/css/index.css +283 -272
- package/generated/events/picker-view.d.ts +6 -0
- package/generated/i18n/locales/el.d.ts +1 -0
- package/generated/i18n/locales/el.js +1 -0
- package/generated/i18n/locales/en.d.ts +1 -0
- package/generated/i18n/locales/en.js +1 -0
- package/generated/internal/class/css-style-observer.js +2 -2
- package/generated/internal/class/form-associated-base.d.ts +0 -4
- package/generated/internal/class/form-associated-base.js +21 -41
- package/generated/internal/class/mutation-observer-set.d.ts +9 -0
- package/generated/internal/class/mutation-observer-set.js +42 -0
- package/generated/internal/class/mutation-observer-singleton.js +18 -0
- package/generated/internal/class/navigation-view.js +3 -3
- package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
- package/generated/internal/decorators/adaptive-slot.js +47 -0
- package/generated/internal/decorators/custom-element.d.ts +1 -1
- package/generated/internal/decorators/custom-element.js +2 -1
- package/generated/internal/decorators/index.d.ts +4 -0
- package/generated/internal/decorators/index.js +4 -0
- package/generated/internal/privateNamespace.d.ts +10 -0
- package/generated/internal/privateNamespace.js +159 -1
- package/generated/internal/utils/debug.d.ts +1 -0
- package/generated/internal/utils/debug.js +3 -0
- package/generated/internal/utils/index.d.ts +3 -3
- package/generated/internal/utils/index.js +5 -3
- package/generated/namespace-browser/base.d.ts +9 -0
- package/generated/namespace-browser/base.js +23 -0
- package/generated/snapshot/index.d.ts +1 -1
- package/generated/snapshot/index.js +4 -4
- package/package.json +2 -1
- package/scss/_components.scss +2 -0
- package/scss/base/_root.scss +10 -8
- package/scss/colors/_index.scss +9 -12
- package/scss/components/_index.scss +2 -0
- package/scss/components/_menu-view.scss +11 -5
- package/scss/components/_picker-view.scss +11 -2
- package/scss/components/_scroll-view.scss +4 -0
- package/scss/components/_search-view.scss +18 -0
- package/scss/components/_sheet-view.scss +2 -1
- package/scss/components/_sticky-container.scss +1 -1
- package/scss/placeholders/_lists.scss +35 -35
- package/scss/utils/_index.scss +21 -7
- package/scss/utils/_stacks.scss +5 -43
- package/web-components.html-data/en.json +11 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
export class PlainButton extends ButtonBase {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
}
|
|
8
8
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
9
|
+
debug(`${PlainButton.name} ⚡️ disconnect`);
|
|
10
10
|
CleanupRegistry.unregister(el);
|
|
11
11
|
}
|
|
12
12
|
static polyfillConnectedCallback(el) {
|
|
13
|
-
|
|
13
|
+
debug(`${PlainButton.name} ⚡️ connect`);
|
|
14
14
|
el.tabIndex = 0;
|
|
15
15
|
CleanupRegistry.register(el, onoff('click', PlainButton.#handleClick, el).on());
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
3
|
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
4
|
-
import {
|
|
4
|
+
import { $, debug } from '../internal/utils';
|
|
5
5
|
import { Snapshot } from '../snapshot';
|
|
6
6
|
const progressViewStyles = ['circular', 'linear'];
|
|
7
7
|
/**
|
|
@@ -55,11 +55,11 @@ export class ProgressView extends HTMLElement {
|
|
|
55
55
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
56
56
|
}
|
|
57
57
|
disconnectedCallback() {
|
|
58
|
-
|
|
58
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
59
59
|
CleanupRegistry.unregister(this);
|
|
60
60
|
}
|
|
61
61
|
connectedCallback() {
|
|
62
|
-
|
|
62
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
63
63
|
this.#cssStyleObserver = new CSSStyleObserver({
|
|
64
64
|
properties: ['--progress-view-style-index'],
|
|
65
65
|
});
|
|
@@ -67,7 +67,7 @@ export class ProgressView extends HTMLElement {
|
|
|
67
67
|
Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
|
|
68
68
|
}
|
|
69
69
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
70
|
-
|
|
70
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
71
71
|
switch (name) {
|
|
72
72
|
case 'label': {
|
|
73
73
|
const label = this.querySelector(':scope>label-view:not([slot])') ?? this.appendChild($(`<label-view foreground="secondary"></label-view>`, '>1'));
|
|
@@ -91,7 +91,7 @@ export class ProgressView extends HTMLElement {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
#handleStyleChange = () => {
|
|
94
|
-
|
|
94
|
+
debug(`${_a.name} ⚡️ style`);
|
|
95
95
|
const raw = self.getComputedStyle(this).getPropertyValue('--progress-view-style-index').trim();
|
|
96
96
|
const newValue = progressViewStyles[Number(raw)] ?? progressViewStyles[0];
|
|
97
97
|
if (newValue === this.#progressViewStyle)
|
|
@@ -100,7 +100,7 @@ export class ProgressView extends HTMLElement {
|
|
|
100
100
|
this.#render();
|
|
101
101
|
};
|
|
102
102
|
#render() {
|
|
103
|
-
|
|
103
|
+
debug(`${_a.name} ⚡️ render (${this.#progressViewStyle})`);
|
|
104
104
|
if (!this.isConnected)
|
|
105
105
|
return;
|
|
106
106
|
if (this.#lastRenderedStyle === this.#progressViewStyle)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
1
2
|
import { DialogBase } from '../namespace-browser/base';
|
|
2
3
|
export class ScreenView extends DialogBase {
|
|
3
4
|
constructor() {
|
|
4
5
|
super();
|
|
5
6
|
}
|
|
6
7
|
disconnectedCallback() {
|
|
7
|
-
|
|
8
|
+
debug(`${ScreenView.name} ⚡️ disconnect`);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
1
2
|
/**
|
|
2
3
|
* @summary A wrapper to {hv}-stacks
|
|
3
4
|
*/
|
|
@@ -6,9 +7,9 @@ export class ScrollViewProxy extends HTMLElement {
|
|
|
6
7
|
super();
|
|
7
8
|
}
|
|
8
9
|
disconnectedCallback() {
|
|
9
|
-
|
|
10
|
+
debug(`${ScrollViewProxy.name} ⚡️ disconnect`);
|
|
10
11
|
}
|
|
11
12
|
connectedCallback() {
|
|
12
|
-
|
|
13
|
+
debug(`${ScrollViewProxy.name} ⚡️ connect`);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -2,7 +2,7 @@ var _a;
|
|
|
2
2
|
import { lifecycleObserver } from '../buses';
|
|
3
3
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
4
|
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
5
|
-
import { $, frame, onoff, slowHideShow } from '../internal/utils';
|
|
5
|
+
import { $, debug, frame, onoff, slowHideShow } from '../internal/utils';
|
|
6
6
|
const observers = new ResizeObserverSingleton();
|
|
7
7
|
export class ScrollView extends HTMLElement {
|
|
8
8
|
static get observedAttributes() {
|
|
@@ -41,13 +41,13 @@ export class ScrollView extends HTMLElement {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
disconnectedCallback() {
|
|
44
|
-
|
|
44
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
45
45
|
CleanupRegistry.unregister(this);
|
|
46
46
|
observers.unobserve(this);
|
|
47
47
|
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pagehide', { detail: { page: this }, bubbles: true, composed: true })));
|
|
48
48
|
}
|
|
49
49
|
connectedCallback() {
|
|
50
|
-
|
|
50
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
51
51
|
CleanupRegistry.register(this, onoff([
|
|
52
52
|
// { types: 'tabreveal', listener: this.#handleTabReveal as EventListener },
|
|
53
53
|
{ types: 'beforetabswap', listener: this.#handleTabBeforeswap },
|
|
@@ -71,7 +71,7 @@ export class ScrollView extends HTMLElement {
|
|
|
71
71
|
// })
|
|
72
72
|
}
|
|
73
73
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
74
|
-
|
|
74
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
75
75
|
switch (name) {
|
|
76
76
|
case 'navigation-inline-title':
|
|
77
77
|
this.#renderNavTitle(newValue, this.getAttribute('navigation-inline-subtitle'));
|
|
@@ -94,23 +94,22 @@ export class ScrollView extends HTMLElement {
|
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
#handleScroll = (
|
|
98
|
-
|
|
97
|
+
#handleScroll = ({ target, type }) => {
|
|
98
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
99
99
|
if (!this.#isMidScroll)
|
|
100
100
|
this.#isMidScroll = true;
|
|
101
101
|
// if (this.#stopRecordingScrollTop) return
|
|
102
|
-
|
|
103
|
-
if (!target)
|
|
102
|
+
if (!(target instanceof HTMLElement && target))
|
|
104
103
|
return;
|
|
105
104
|
this.#lastScrollTop = target.scrollTop;
|
|
106
105
|
};
|
|
107
106
|
#handleScrollend = (evt) => {
|
|
108
|
-
|
|
107
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
109
108
|
if (this.#isMidScroll)
|
|
110
109
|
this.#isMidScroll = false;
|
|
111
110
|
};
|
|
112
111
|
#handleMeasure = (entry) => {
|
|
113
|
-
|
|
112
|
+
debug(`${_a.name} ⚡️ measure`);
|
|
114
113
|
if (0 === entry.contentRect.width + entry.contentRect.height)
|
|
115
114
|
return;
|
|
116
115
|
if (undefined === this.#beforeTabSwapLastScrolltop)
|
|
@@ -126,10 +125,9 @@ export class ScrollView extends HTMLElement {
|
|
|
126
125
|
// this.#stopRecordingScrollTop = false
|
|
127
126
|
this.#beforeTabSwapLastScrolltop = undefined;
|
|
128
127
|
};
|
|
129
|
-
#handleTabReveal = (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!target)
|
|
128
|
+
#handleTabReveal = ({ type, target }) => {
|
|
129
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
130
|
+
if (!(target instanceof HTMLElement && target))
|
|
133
131
|
return;
|
|
134
132
|
if (!target.contains(this))
|
|
135
133
|
return;
|
|
@@ -158,10 +156,9 @@ export class ScrollView extends HTMLElement {
|
|
|
158
156
|
// // })
|
|
159
157
|
// })
|
|
160
158
|
};
|
|
161
|
-
#handleTabBeforeswap = (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (!target)
|
|
159
|
+
#handleTabBeforeswap = ({ type, target }) => {
|
|
160
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
161
|
+
if (!(target instanceof HTMLElement && target))
|
|
165
162
|
return;
|
|
166
163
|
if (!target.contains(this))
|
|
167
164
|
return;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputBase } from '../namespace-browser/base';
|
|
2
|
+
export declare class SearchView extends InputBase {
|
|
3
|
+
static get observedAttributes(): string[];
|
|
4
|
+
constructor();
|
|
5
|
+
static polyfillDisconnectedCallback(el: InputBase): void;
|
|
6
|
+
static polyfillConnectedCallback(el: InputBase): void;
|
|
7
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
+
import { debug, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { InputBase } from '../namespace-browser/base';
|
|
4
|
+
export class SearchView extends InputBase {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ['role', 'title-key'];
|
|
7
|
+
}
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
static polyfillDisconnectedCallback(el) {
|
|
12
|
+
debug(`${SearchView.name} ⚡️ disconnect`);
|
|
13
|
+
CleanupRegistry.unregister(el);
|
|
14
|
+
}
|
|
15
|
+
static polyfillConnectedCallback(el) {
|
|
16
|
+
debug(`${SearchView.name} ⚡️ connect`);
|
|
17
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
18
|
+
el.type = 'search';
|
|
19
|
+
}
|
|
20
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
21
|
+
debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
22
|
+
const node = target instanceof HTMLInputElement && target;
|
|
23
|
+
if (!node)
|
|
24
|
+
return;
|
|
25
|
+
//
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $, debug } from '../internal/utils';
|
|
2
2
|
export class SectionView extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
4
|
return ['header', 'footer'];
|
|
@@ -32,12 +32,12 @@ export class SectionView extends HTMLElement {
|
|
|
32
32
|
// })
|
|
33
33
|
}
|
|
34
34
|
disconnectedCallback() {
|
|
35
|
-
|
|
35
|
+
debug(`${SectionView.name} ⚡️ disconnect`);
|
|
36
36
|
// if (this.#sentinel) this.#observer?.unobserve(this.#sentinel)
|
|
37
37
|
// this.#observer?.unobserve(this)
|
|
38
38
|
}
|
|
39
39
|
connectedCallback() {
|
|
40
|
-
|
|
40
|
+
debug(`${SectionView.name} ⚡️ connect`);
|
|
41
41
|
// this.#sibling = this.closest('scroll-view') ?? undefined
|
|
42
42
|
// Snapshot.waitReady.then(() => {
|
|
43
43
|
// if (!(await frame(this))) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
|
|
@@ -54,7 +54,7 @@ export class SectionView extends HTMLElement {
|
|
|
54
54
|
// })
|
|
55
55
|
}
|
|
56
56
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
57
|
-
|
|
57
|
+
debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
58
58
|
// Snapshot.waitReady.then(() => {
|
|
59
59
|
switch (name) {
|
|
60
60
|
case 'header':
|
|
@@ -1,37 +1,24 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, onoff } from '../internal/utils';
|
|
3
3
|
import { DialogBase } from '../namespace-browser/base';
|
|
4
|
-
import { Snapshot } from '../snapshot';
|
|
5
4
|
export class SheetView extends DialogBase {
|
|
6
|
-
// static get observedAttributes() {
|
|
7
|
-
// return ['fine-presentation-large-adaptation']
|
|
8
|
-
// }
|
|
9
5
|
constructor() {
|
|
10
6
|
super();
|
|
11
7
|
}
|
|
12
8
|
static polyfillDisconnectedCallback(el) {
|
|
13
|
-
|
|
9
|
+
debug(`${SheetView.name} ⚡️ disconnect`);
|
|
14
10
|
CleanupRegistry.unregister(el);
|
|
15
11
|
}
|
|
16
12
|
static polyfillConnectedCallback(el) {
|
|
17
|
-
|
|
13
|
+
debug(`${SheetView.name} ⚡️ connect`);
|
|
18
14
|
CleanupRegistry.register(el, onoff([
|
|
19
15
|
{ types: 'cancel', listener: this.#handleCancel },
|
|
20
16
|
{ types: 'keydown', listener: SheetView.#handleKeydown },
|
|
21
17
|
], el).on());
|
|
22
18
|
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
|
-
});
|
|
32
19
|
}
|
|
33
20
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
34
|
-
|
|
21
|
+
debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
35
22
|
// // NOTE: wait for config
|
|
36
23
|
// Snapshot.waitReady.then(() => {
|
|
37
24
|
// switch (attributeName) {
|
|
@@ -54,7 +41,7 @@ export class SheetView extends DialogBase {
|
|
|
54
41
|
// })
|
|
55
42
|
}
|
|
56
43
|
static #handleKeydown = (evt) => {
|
|
57
|
-
|
|
44
|
+
debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
|
|
58
45
|
if ('Escape' !== evt.key)
|
|
59
46
|
return;
|
|
60
47
|
evt.preventDefault();
|
|
@@ -62,24 +49,9 @@ export class SheetView extends DialogBase {
|
|
|
62
49
|
evt.stopPropagation();
|
|
63
50
|
};
|
|
64
51
|
static #handleCancel = (evt) => {
|
|
65
|
-
|
|
52
|
+
debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
|
|
66
53
|
if (!evt.cancelable)
|
|
67
54
|
return;
|
|
68
55
|
evt.preventDefault();
|
|
69
56
|
};
|
|
70
|
-
static #handleMediaChange = (el, evt) => {
|
|
71
|
-
console.debug(`${SheetView.name} ⚡️ ${evt?.type}`);
|
|
72
|
-
if (evt.matches)
|
|
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;
|
|
78
|
-
}
|
|
79
|
-
else
|
|
80
|
-
for (const item of el.querySelectorAll(':scope>tool-bar>[data-previous-slot]')) {
|
|
81
|
-
item.slot = item.dataset.previousSlot ?? '';
|
|
82
|
-
delete item.dataset.previousSlot;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
57
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
3
|
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
4
|
-
import { debounce, onoff } from '../internal/utils';
|
|
4
|
+
import { debounce, debug, onoff } from '../internal/utils';
|
|
5
5
|
const observers = new ResizeObserverSingleton();
|
|
6
6
|
export class SidebarToggle extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
9
|
}
|
|
10
10
|
connectedCallback() {
|
|
11
|
-
|
|
11
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
12
12
|
CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
|
|
13
13
|
const entry = {
|
|
14
14
|
target: this,
|
|
@@ -18,7 +18,7 @@ export class SidebarToggle extends HTMLElement {
|
|
|
18
18
|
_a.#handleMeasure([entry]);
|
|
19
19
|
}
|
|
20
20
|
disconnectedCallback() {
|
|
21
|
-
|
|
21
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
22
22
|
observers.unobserve(this);
|
|
23
23
|
CleanupRegistry.unregister(this);
|
|
24
24
|
}
|
|
@@ -28,9 +28,9 @@ export class SidebarToggle extends HTMLElement {
|
|
|
28
28
|
}
|
|
29
29
|
// This triggers on show/hide of any of sidebar-toggle elements
|
|
30
30
|
static #handleMeasure(entry) {
|
|
31
|
-
|
|
32
|
-
const target = entry
|
|
33
|
-
if (!target)
|
|
31
|
+
debug(`${_a.name} ⚡️ measure`);
|
|
32
|
+
const { target } = entry ?? {};
|
|
33
|
+
if (!(target instanceof HTMLElement && target))
|
|
34
34
|
return;
|
|
35
35
|
// set/remove css var/prop to parent based on shown/hidden
|
|
36
36
|
const tv = target.parentElement;
|
|
@@ -65,10 +65,9 @@ export class SidebarToggle extends HTMLElement {
|
|
|
65
65
|
sideBar?.close?.();
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
#handleClick(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!target)
|
|
68
|
+
#handleClick({ target, type }) {
|
|
69
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
70
|
+
if (!(target instanceof HTMLElement && target))
|
|
72
71
|
return;
|
|
73
72
|
if (!target?.closest('button'))
|
|
74
73
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { debug, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { DialogBase } from '../namespace-browser/base';
|
|
4
4
|
export class SidebarView extends DialogBase {
|
|
5
5
|
constructor() {
|
|
@@ -11,9 +11,8 @@ export class SidebarView extends DialogBase {
|
|
|
11
11
|
}
|
|
12
12
|
static polyfillConnectedCallback(el) {
|
|
13
13
|
CleanupRegistry.register(el, onoff('click', SidebarView.#handleClick, el).on());
|
|
14
|
-
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (
|
|
15
|
-
|
|
16
|
-
if (!target)
|
|
14
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
15
|
+
if (!(target instanceof HTMLElement && target))
|
|
17
16
|
return true;
|
|
18
17
|
if (target.matches('[is=sidebar-view]'))
|
|
19
18
|
return false;
|
|
@@ -24,10 +23,9 @@ export class SidebarView extends DialogBase {
|
|
|
24
23
|
el.autofocus = true;
|
|
25
24
|
}
|
|
26
25
|
/** Autoclose on click outside. */
|
|
27
|
-
static #handleClick = async (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!target)
|
|
26
|
+
static #handleClick = async ({ target, type }) => {
|
|
27
|
+
debug(`${SidebarView.name} ⚡️ ${type}`);
|
|
28
|
+
if (!(target instanceof HTMLElement && target))
|
|
31
29
|
return;
|
|
32
30
|
if (target instanceof HTMLDialogElement && 'sidebar-view' === target.getAttribute('is'))
|
|
33
31
|
target.close?.();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, onoff } from '../internal/utils';
|
|
3
3
|
export class StickyContainer extends HTMLElement {
|
|
4
4
|
constructor() {
|
|
5
5
|
super();
|
|
6
6
|
}
|
|
7
7
|
connectedCallback() {
|
|
8
|
-
|
|
8
|
+
debug(`${StickyContainer.name} ⚡️ connect`);
|
|
9
9
|
// CleanupRegistry.register(this, onoff('transitionend transitionstart transitioncancel', this.#handleTransitionrun as unknown as EventListener, this).on())
|
|
10
10
|
CleanupRegistry.register(this, onoff('transitionrun', this.#handleTransitionrun, this).on());
|
|
11
11
|
}
|
|
12
12
|
disconnectedCallback() {
|
|
13
|
-
|
|
13
|
+
debug(`${StickyContainer.name} ⚡️ disconnect`);
|
|
14
14
|
CleanupRegistry.unregister(this);
|
|
15
15
|
}
|
|
16
16
|
#handleTransitionrun = ({ target, propertyName, pseudoElement }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { debug, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { DialogBase } from '../namespace-browser/base';
|
|
4
4
|
/**
|
|
5
5
|
* @summary A screen that lets users switch between different views using buttons, tabs, or other controls.
|
|
@@ -9,19 +9,18 @@ export class TabBar extends DialogBase {
|
|
|
9
9
|
super();
|
|
10
10
|
}
|
|
11
11
|
static polyfillDisconnectedCallback(el) {
|
|
12
|
-
|
|
12
|
+
debug(`${TabBar.name} ⚡️ disconnect`);
|
|
13
13
|
el.removeEventListener('click', TabBar.#handleClick);
|
|
14
14
|
CleanupRegistry.unregister(el);
|
|
15
15
|
}
|
|
16
16
|
static polyfillConnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
debug(`${TabBar.name} ⚡️ connect`);
|
|
18
18
|
el.autofocus = true;
|
|
19
19
|
// Snapshot.waitReadyFor(el).then((r) => {
|
|
20
20
|
// if (!r) return
|
|
21
21
|
CleanupRegistry.register(el, onoff('click', TabBar.#handleClick, el).on());
|
|
22
|
-
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (
|
|
23
|
-
|
|
24
|
-
if (!target)
|
|
22
|
+
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
|
|
23
|
+
if (!(target instanceof HTMLElement && target))
|
|
25
24
|
return true;
|
|
26
25
|
if (target.matches('[is=tab-bar]'))
|
|
27
26
|
return false;
|
|
@@ -31,10 +30,9 @@ export class TabBar extends DialogBase {
|
|
|
31
30
|
}), el).on());
|
|
32
31
|
// })
|
|
33
32
|
}
|
|
34
|
-
static #handleClick = async (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!target)
|
|
33
|
+
static #handleClick = async ({ target, type }) => {
|
|
34
|
+
debug(`${TabBar.name} ⚡️ ${type}`);
|
|
35
|
+
if (!(target instanceof HTMLElement && target))
|
|
38
36
|
return;
|
|
39
37
|
if (target instanceof HTMLDialogElement && 'tab-bar' === target.getAttribute('is'))
|
|
40
38
|
target.close?.();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff } from '../internal/utils';
|
|
2
|
+
import { debug, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { TabView } from './tab-view';
|
|
5
5
|
export class TabItem extends ButtonBase {
|
|
@@ -7,11 +7,11 @@ export class TabItem extends ButtonBase {
|
|
|
7
7
|
super();
|
|
8
8
|
}
|
|
9
9
|
static polyfillDisconnectedCallback(btn) {
|
|
10
|
-
|
|
10
|
+
debug(`${TabItem.name} ⚡️ disconnect`);
|
|
11
11
|
CleanupRegistry.unregister(btn);
|
|
12
12
|
}
|
|
13
13
|
static polyfillConnectedCallback(btn) {
|
|
14
|
-
|
|
14
|
+
debug(`${TabItem.name} ⚡️ connect`);
|
|
15
15
|
Object.assign(btn, {
|
|
16
16
|
tabIndex: 0,
|
|
17
17
|
ariaSelected: 'false',
|
|
@@ -31,7 +31,7 @@ export class TabItem extends ButtonBase {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
static #handleTabMoreStackAllowance = async (btn, evt) => {
|
|
34
|
-
|
|
34
|
+
debug(`${TabItem.name} ⚡️ ${evt?.type}`);
|
|
35
35
|
const tv = btn.closest('tab-view');
|
|
36
36
|
if (!tv)
|
|
37
37
|
return;
|
|
@@ -40,7 +40,7 @@ export class TabItem extends ButtonBase {
|
|
|
40
40
|
btn.hidden = 'bottom-bar' !== tv.tabBarPlacement;
|
|
41
41
|
};
|
|
42
42
|
static #handleTabRevealOrSwap = async (btn, evt) => {
|
|
43
|
-
|
|
43
|
+
debug(`${TabItem.name} ⚡️ ${evt?.type}`);
|
|
44
44
|
const tv = btn?.closest('tab-view');
|
|
45
45
|
if (!tv)
|
|
46
46
|
return;
|
|
@@ -62,7 +62,7 @@ export class TabItem extends ButtonBase {
|
|
|
62
62
|
}, 100);
|
|
63
63
|
};
|
|
64
64
|
static #handleClick = async (evt) => {
|
|
65
|
-
|
|
65
|
+
debug(`${TabItem.name} ⚡️ ${evt?.type}`);
|
|
66
66
|
const btn = evt.currentTarget instanceof HTMLElement && evt.currentTarget;
|
|
67
67
|
if (!btn)
|
|
68
68
|
return;
|
|
@@ -109,14 +109,14 @@ export class TabItem extends ButtonBase {
|
|
|
109
109
|
for (const tab of tabs.reverse())
|
|
110
110
|
if (tv.selectedTab.includes(tab)) {
|
|
111
111
|
const eventType = 'tabroot';
|
|
112
|
-
|
|
112
|
+
debug(`${TabItem.name} 💡 ${eventType}`);
|
|
113
113
|
tab?.dispatchEvent(new CustomEvent(eventType, { bubbles: true, composed: true }));
|
|
114
114
|
return; // skip rest no selection!
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
else if ('->' === dir) {
|
|
118
118
|
const eventType = 'tabroot';
|
|
119
|
-
|
|
119
|
+
debug(`${TabItem.name} 💡 ${eventType}`);
|
|
120
120
|
tabs.at(0)?.dispatchEvent(new CustomEvent(eventType, { bubbles: true, composed: true }));
|
|
121
121
|
}
|
|
122
122
|
// SECTION: finally, submit new tabs
|
|
@@ -2,7 +2,7 @@ var _a;
|
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
3
|
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
4
4
|
import { NavigationPath } from '../internal/class/navigation-path';
|
|
5
|
-
import { $, cssTime, debounce, frame, onoff, timeout } from '../internal/utils';
|
|
5
|
+
import { $, cssTime, debounce, debug, frame, onoff, timeout } from '../internal/utils';
|
|
6
6
|
import { Snapshot } from '../snapshot';
|
|
7
7
|
const TAB_BAR_PLACEMENTS = ['bottom-bar', 'ornament', 'sidebar', 'top-bar'];
|
|
8
8
|
/**
|
|
@@ -25,7 +25,7 @@ export class TabView extends HTMLElement {
|
|
|
25
25
|
this.#debouncedHandler = debounce(this.#handleSelectionChange, 1);
|
|
26
26
|
}
|
|
27
27
|
disconnectedCallback() {
|
|
28
|
-
|
|
28
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
29
29
|
this.#afterTabRevealDelay.cancel();
|
|
30
30
|
this.#cssStyleObserver?.disconnect();
|
|
31
31
|
CleanupRegistry.unregister(this);
|
|
@@ -37,7 +37,7 @@ export class TabView extends HTMLElement {
|
|
|
37
37
|
return this.querySelector(':scope>navigation-stack:has(> navigation-stack,> navigation-split-view)');
|
|
38
38
|
}
|
|
39
39
|
connectedCallback() {
|
|
40
|
-
|
|
40
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
41
41
|
this.#cssStyleObserver = new CSSStyleObserver({
|
|
42
42
|
properties: ['--adaptable-tab-bar-placement-index'],
|
|
43
43
|
});
|
|
@@ -72,9 +72,8 @@ export class TabView extends HTMLElement {
|
|
|
72
72
|
], this).on());
|
|
73
73
|
// })
|
|
74
74
|
}
|
|
75
|
-
#handleSummaryClick = (
|
|
76
|
-
|
|
77
|
-
if (!target)
|
|
75
|
+
#handleSummaryClick = ({ target }) => {
|
|
76
|
+
if (!(target instanceof HTMLElement && target))
|
|
78
77
|
return;
|
|
79
78
|
const summary = target.closest('summary');
|
|
80
79
|
if (!summary)
|
|
@@ -92,11 +91,11 @@ export class TabView extends HTMLElement {
|
|
|
92
91
|
this.#addAnimations(new CustomEvent('beforetabreveal', { detail: { tag: '', ms: cssTime(`${this.computedStyleMap().get(`--tabbar-after-tabreveal-duration`)}`) }, bubbles: true, composed: true }));
|
|
93
92
|
};
|
|
94
93
|
#handleTabViewPagereveal = (evt) => {
|
|
95
|
-
|
|
94
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
96
95
|
void this.#syncBodyFace();
|
|
97
96
|
};
|
|
98
97
|
#handleStyleChange = () => {
|
|
99
|
-
|
|
98
|
+
debug(`${_a.name} ⚡️ style`);
|
|
100
99
|
const style = self.getComputedStyle(this);
|
|
101
100
|
const placement = style.getPropertyValue('--adaptable-tab-bar-placement'), // or do it manually without any computedstyle
|
|
102
101
|
newValue = TAB_BAR_PLACEMENTS.includes(placement) ? placement : 'bottom-bar';
|
|
@@ -111,7 +110,7 @@ export class TabView extends HTMLElement {
|
|
|
111
110
|
}
|
|
112
111
|
};
|
|
113
112
|
// #handleMediaChange: (evt: MediaQueryListEvent) => void = (evt) => {
|
|
114
|
-
//
|
|
113
|
+
// debug(`${TabView.name} ⚡️ ${evt?.type}`)
|
|
115
114
|
// if (!evt.matches) return
|
|
116
115
|
// this.#handleStyleChange()
|
|
117
116
|
// // if (evt.matches) {
|
|
@@ -162,7 +161,7 @@ export class TabView extends HTMLElement {
|
|
|
162
161
|
// // }
|
|
163
162
|
// }
|
|
164
163
|
#handleAdaptableTabBarPlacementChange = (evt) => {
|
|
165
|
-
|
|
164
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
166
165
|
if ('bottom-bar' !== evt.detail.oldValue)
|
|
167
166
|
return; // button triggers should happen, ONLY when going FROM bottom-bar TO anything else
|
|
168
167
|
const innerSelection = this.moreTab?.querySelector(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')?.id;
|
|
@@ -231,7 +230,7 @@ export class TabView extends HTMLElement {
|
|
|
231
230
|
#triggerToggleEvent = (evt) => {
|
|
232
231
|
const eventType = 'tab-view:toggle';
|
|
233
232
|
void this.#syncBodyFace();
|
|
234
|
-
|
|
233
|
+
debug(`${_a.name} 💡 ${eventType}`);
|
|
235
234
|
this.dispatchEvent(new CustomEvent(eventType, { detail: { selection: this.selectedTab }, bubbles: true, composed: true }));
|
|
236
235
|
};
|
|
237
236
|
#syncBodyFace = async () => {
|