@swiftwc/ui 0.0.0-dev.105 → 0.0.0-dev.106
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.js +6 -7
- package/generated/components/alert-dialog.js +9 -10
- package/generated/components/body-view.js +3 -3
- package/generated/components/bordered-button.js +4 -5
- package/generated/components/bordered-prominent-button.js +4 -5
- package/generated/components/borderless-button.js +4 -5
- package/generated/components/color-scheme.js +4 -4
- package/generated/components/confirmation-dialog.js +9 -10
- package/generated/components/content-unavailable.js +4 -5
- package/generated/components/date-picker.js +13 -14
- package/generated/components/detail-placeholder.js +4 -4
- package/generated/components/disclosure-group.js +5 -6
- package/generated/components/fine-tooltip.js +4 -5
- package/generated/components/form-view.js +3 -4
- package/generated/components/glass-button.js +4 -5
- package/generated/components/glass-prominent-button.js +4 -5
- package/generated/components/h-divider.js +4 -4
- package/generated/components/h-stack.js +3 -3
- package/generated/components/image-view.js +4 -5
- package/generated/components/label-view.js +4 -5
- package/generated/components/labeled-content.js +4 -5
- package/generated/components/list-view.js +3 -4
- package/generated/components/menu-view.js +10 -11
- package/generated/components/navigation-large-title.js +5 -6
- package/generated/components/navigation-split-view.js +4 -4
- package/generated/components/navigation-stack.js +4 -4
- package/generated/components/navigation-title.js +4 -4
- package/generated/components/picker-view.js +31 -32
- package/generated/components/plain-button.js +3 -4
- package/generated/components/progress-view.js +6 -7
- package/generated/components/screen-view.js +2 -2
- package/generated/components/scroll-view-proxy.js +3 -3
- package/generated/components/scroll-view.js +9 -10
- package/generated/components/search-view.js +4 -5
- package/generated/components/section-view.js +4 -5
- package/generated/components/sheet-view.js +6 -7
- package/generated/components/sidebar-toggle.js +5 -6
- package/generated/components/sidebar-view.js +2 -3
- package/generated/components/sticky-container.js +3 -4
- package/generated/components/tab-bar.js +4 -5
- package/generated/components/tab-item.js +8 -9
- package/generated/components/tab-view.js +7 -8
- package/generated/components/table-view.js +6 -7
- package/generated/components/text-field.js +10 -11
- package/generated/components/text-view.js +4 -4
- package/generated/components/toggle-view.js +13 -14
- package/generated/components/tool-bar-item-group.js +3 -3
- package/generated/components/tool-bar-item.js +4 -5
- package/generated/components/tool-bar.js +4 -5
- package/generated/components/v-divider.js +4 -4
- package/generated/components/v-keyboard.js +5 -6
- package/generated/components/v-stack.js +3 -3
- package/generated/internal/class/css-style-observer.js +2 -3
- package/generated/internal/class/form-associated-base.js +5 -5
- package/generated/internal/class/navigation-view.js +3 -4
- package/generated/internal/decorators/adaptive-slot.js +4 -5
- package/generated/internal/privateNamespace.js +12 -12
- package/generated/internal/utils/debug.d.ts +1 -0
- package/generated/internal/utils/debug.js +4 -0
- package/generated/internal/utils/index.d.ts +2 -2
- package/generated/internal/utils/index.js +2 -2
- package/generated/internal/utils/is-inside.js +1 -1
- package/generated/snapshot/index.js +3 -4
- package/package.json +2 -1
- package/generated/internal/utils/dev-flags.d.ts +0 -3
- package/generated/internal/utils/dev-flags.js +0 -5
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
4
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
5
4
|
import { Snapshot } from '../snapshot';
|
|
6
5
|
/**
|
|
@@ -26,16 +25,16 @@ export class GlassProminentButton extends ButtonBase {
|
|
|
26
25
|
super();
|
|
27
26
|
}
|
|
28
27
|
static polyfillDisconnectedCallback(el) {
|
|
29
|
-
|
|
28
|
+
debug(`${GlassProminentButton.name} ⚡️ disconnect`);
|
|
30
29
|
CleanupRegistry.unregister(el);
|
|
31
30
|
}
|
|
32
31
|
static polyfillConnectedCallback(el) {
|
|
33
|
-
|
|
32
|
+
debug(`${GlassProminentButton.name} ⚡️ connect`);
|
|
34
33
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
35
34
|
el.tabIndex = 0;
|
|
36
35
|
}
|
|
37
36
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
38
|
-
|
|
37
|
+
debug(`${GlassProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
39
38
|
const node = target instanceof HTMLButtonElement;
|
|
40
39
|
if (!node)
|
|
41
40
|
return;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
2
2
|
export class HDivider extends HTMLElement {
|
|
3
3
|
constructor() {
|
|
4
4
|
super();
|
|
5
5
|
}
|
|
6
6
|
connectedCallback() {
|
|
7
|
-
|
|
7
|
+
debug(`${HDivider.name} ⚡️ connect`);
|
|
8
8
|
}
|
|
9
9
|
disconnectedCallback() {
|
|
10
|
-
|
|
10
|
+
debug(`${HDivider.name} ⚡️ disconnect`);
|
|
11
11
|
}
|
|
12
12
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
13
|
-
|
|
13
|
+
debug(`${HDivider.name} ⚡️ attr-change [${name}]`);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { debug } from '../internal/utils';
|
|
2
2
|
/**
|
|
3
3
|
* @summary A view that arranges its children side by side.
|
|
4
4
|
*
|
|
@@ -16,9 +16,9 @@ export class HStack extends HTMLElement {
|
|
|
16
16
|
super();
|
|
17
17
|
}
|
|
18
18
|
connectedCallback() {
|
|
19
|
-
|
|
19
|
+
debug(`${HStack.name} ⚡️ connect`);
|
|
20
20
|
}
|
|
21
21
|
disconnectedCallback() {
|
|
22
|
-
|
|
22
|
+
debug(`${HStack.name} ⚡️ disconnect`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ } from '../internal/utils';
|
|
1
|
+
import { $, debug } from '../internal/utils';
|
|
3
2
|
import { queryMorph } from '../morphdom';
|
|
4
3
|
import { html } from '../tpl';
|
|
5
4
|
/**
|
|
@@ -21,7 +20,7 @@ export class ImageView extends HTMLElement {
|
|
|
21
20
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
22
21
|
}
|
|
23
22
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
24
|
-
|
|
23
|
+
debug(`${ImageView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
25
24
|
if (oldValue === newValue)
|
|
26
25
|
return;
|
|
27
26
|
switch (name) {
|
|
@@ -58,9 +57,9 @@ export class ImageView extends HTMLElement {
|
|
|
58
57
|
// container.classList.add(...tokens)
|
|
59
58
|
}
|
|
60
59
|
disconnectedCallback() {
|
|
61
|
-
|
|
60
|
+
debug(`${ImageView.name} ⚡️ disconnect`);
|
|
62
61
|
}
|
|
63
62
|
connectedCallback() {
|
|
64
|
-
|
|
63
|
+
debug(`${ImageView.name} ⚡️ connect`);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ } from '../internal/utils';
|
|
1
|
+
import { $, debug } from '../internal/utils';
|
|
3
2
|
import { queryMorph } from '../morphdom';
|
|
4
3
|
import { html } from '../tpl';
|
|
5
4
|
/**
|
|
@@ -54,7 +53,7 @@ export class LabelView extends HTMLElement {
|
|
|
54
53
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
55
54
|
}
|
|
56
55
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
57
|
-
|
|
56
|
+
debug(`${LabelView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
58
57
|
if (oldValue === newValue)
|
|
59
58
|
return;
|
|
60
59
|
// this.#scheduleReflect()
|
|
@@ -77,9 +76,9 @@ export class LabelView extends HTMLElement {
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
disconnectedCallback() {
|
|
80
|
-
|
|
79
|
+
debug(`${LabelView.name} ⚡️ disconnect`);
|
|
81
80
|
}
|
|
82
81
|
connectedCallback() {
|
|
83
|
-
|
|
82
|
+
debug(`${LabelView.name} ⚡️ connect`);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ } from '../internal/utils';
|
|
1
|
+
import { $, debug } from '../internal/utils';
|
|
3
2
|
import { queryMorph } from '../morphdom';
|
|
4
3
|
import { html } from '../tpl';
|
|
5
4
|
/**
|
|
@@ -66,7 +65,7 @@ export class LabeledContent extends HTMLElement {
|
|
|
66
65
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
67
66
|
}
|
|
68
67
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
69
|
-
|
|
68
|
+
debug(`${LabeledContent.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
70
69
|
if (oldValue === newValue)
|
|
71
70
|
return;
|
|
72
71
|
switch (name) {
|
|
@@ -100,10 +99,10 @@ export class LabeledContent extends HTMLElement {
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
disconnectedCallback() {
|
|
103
|
-
|
|
102
|
+
debug(`${LabeledContent.name} ⚡️ disconnect`);
|
|
104
103
|
}
|
|
105
104
|
connectedCallback() {
|
|
106
|
-
|
|
105
|
+
debug(`${LabeledContent.name} ⚡️ connect`);
|
|
107
106
|
}
|
|
108
107
|
// <type>:<locale>;<option>=<value>;<option>=<value>
|
|
109
108
|
#fmt = (value, format) => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { listActive, onoff } from '../internal/utils';
|
|
2
|
+
import { debug, listActive, onoff } from '../internal/utils';
|
|
4
3
|
/**
|
|
5
4
|
* @summary A container view that arranges rows of data in a single column, optionally letting the user select one or more of them.
|
|
6
5
|
*
|
|
@@ -14,11 +13,11 @@ export class ListView extends HTMLElement {
|
|
|
14
13
|
super();
|
|
15
14
|
}
|
|
16
15
|
disconnectedCallback() {
|
|
17
|
-
|
|
16
|
+
debug(`${ListView.name} ⚡️ disconnect`);
|
|
18
17
|
CleanupRegistry.unregister(this);
|
|
19
18
|
}
|
|
20
19
|
connectedCallback() {
|
|
21
|
-
|
|
20
|
+
debug(`${ListView.name} ⚡️ connect`);
|
|
22
21
|
CleanupRegistry.register(this, onoff(listActive(this), this).on());
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
3
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
|
-
import { $, onoff, touchGlass } from '../internal/utils';
|
|
3
|
+
import { $, debug, onoff, touchGlass } from '../internal/utils';
|
|
5
4
|
import { queryMorph } from '../morphdom';
|
|
6
5
|
import { html } from '../tpl';
|
|
7
6
|
/**
|
|
@@ -35,14 +34,14 @@ export class MenuView extends HTMLElement {
|
|
|
35
34
|
this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
|
|
36
35
|
}
|
|
37
36
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
38
|
-
|
|
37
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
39
38
|
switch (name) {
|
|
40
39
|
case 'open':
|
|
41
40
|
if (!this.#dialog)
|
|
42
41
|
break;
|
|
43
42
|
this.#dialog.inert = null === newValue;
|
|
44
43
|
if (null === newValue && this.#dialog.open) {
|
|
45
|
-
|
|
44
|
+
debug(`${_a.name} ⚡️ will-close`);
|
|
46
45
|
this.setAttribute('closing', '');
|
|
47
46
|
Promise.allSettled(this.#dialog.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
48
47
|
if (!this.hasAttribute('closing'))
|
|
@@ -52,7 +51,7 @@ export class MenuView extends HTMLElement {
|
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
53
|
if ('' === newValue && !this.#dialog.open) {
|
|
55
|
-
|
|
54
|
+
debug(`${_a.name} ⚡️ will-open`);
|
|
56
55
|
this.removeAttribute('closing');
|
|
57
56
|
const form = this.#shadowRoot.querySelector('form');
|
|
58
57
|
form.scrollTop = 0;
|
|
@@ -65,14 +64,14 @@ export class MenuView extends HTMLElement {
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
disconnectedCallback() {
|
|
68
|
-
|
|
67
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
69
68
|
const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
|
|
70
69
|
summaryPart?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, summaryPart)
|
|
71
70
|
dialogPart?.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, dialogPart)
|
|
72
71
|
CleanupRegistry.unregister(this);
|
|
73
72
|
}
|
|
74
73
|
connectedCallback() {
|
|
75
|
-
|
|
74
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
76
75
|
this.#dialog = this.#shadowRoot.querySelector('dialog') ?? undefined;
|
|
77
76
|
const trigger = this.#shadowRoot.querySelector('button') ?? undefined;
|
|
78
77
|
CleanupRegistry.register(this, onoff('click', this.#handleTriggerClick, trigger).on());
|
|
@@ -96,7 +95,7 @@ export class MenuView extends HTMLElement {
|
|
|
96
95
|
dialogPart?.style.setProperty('position-anchor', newAnchorName); // $.prop('position-anchor', newAnchorName, dialogPart) //
|
|
97
96
|
}
|
|
98
97
|
#handleDialogClick = ({ type, target }) => {
|
|
99
|
-
|
|
98
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
100
99
|
if (!(target instanceof HTMLElement))
|
|
101
100
|
return;
|
|
102
101
|
if (target.matches('dialog'))
|
|
@@ -113,19 +112,19 @@ export class MenuView extends HTMLElement {
|
|
|
113
112
|
// event.stopPropagation() //NOTE: add this only if not nested, disposes all nicely if ommited
|
|
114
113
|
};
|
|
115
114
|
#handleTriggerClick = (evt) => {
|
|
116
|
-
|
|
115
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
117
116
|
this.toggleAttribute('open', true);
|
|
118
117
|
};
|
|
119
118
|
// intercept to modify open attr
|
|
120
119
|
#handleDialogCancel = (evt) => {
|
|
121
|
-
|
|
120
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
122
121
|
if (!evt.cancelable)
|
|
123
122
|
return;
|
|
124
123
|
evt.preventDefault();
|
|
125
124
|
this.toggleAttribute('open', false);
|
|
126
125
|
};
|
|
127
126
|
#handleDialogClose = (evt) => {
|
|
128
|
-
|
|
127
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
129
128
|
this.toggleAttribute('open', this.#shadowRoot.querySelector('dialog')?.open ?? false);
|
|
130
129
|
};
|
|
131
130
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
3
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
3
|
import { CSSStyleObserver } from '../internal/class/css-style-observer';
|
|
5
|
-
import { add, frame, onoff, slowHideShow, timeout } from '../internal/utils';
|
|
4
|
+
import { add, debug, frame, onoff, slowHideShow, timeout } from '../internal/utils';
|
|
6
5
|
import { Snapshot } from '../snapshot';
|
|
7
6
|
const observing = new WeakSet();
|
|
8
7
|
function observeResizeEnd(el, callback, stableFrames = 4) {
|
|
@@ -84,13 +83,13 @@ export class NavigationLargeTitle extends HTMLElement {
|
|
|
84
83
|
super();
|
|
85
84
|
}
|
|
86
85
|
disconnectedCallback() {
|
|
87
|
-
|
|
86
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
88
87
|
this.#clearScrollState();
|
|
89
88
|
this.#styleObserver?.disconnect();
|
|
90
89
|
CleanupRegistry.unregister(this);
|
|
91
90
|
}
|
|
92
91
|
connectedCallback() {
|
|
93
|
-
|
|
92
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
94
93
|
const root = this.closest('scroll-view') ?? undefined;
|
|
95
94
|
if (!root)
|
|
96
95
|
return;
|
|
@@ -113,7 +112,7 @@ export class NavigationLargeTitle extends HTMLElement {
|
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
114
|
#handleStyleChange = () => {
|
|
116
|
-
|
|
115
|
+
debug(`${_a.name} ⚡️ style`);
|
|
117
116
|
const root = this.closest('scroll-view') ?? undefined;
|
|
118
117
|
if (!root)
|
|
119
118
|
return;
|
|
@@ -158,7 +157,7 @@ export class NavigationLargeTitle extends HTMLElement {
|
|
|
158
157
|
// this.#applySlowness(root, isIntersecting)
|
|
159
158
|
// }
|
|
160
159
|
#handleIntersect = (entries, { root }) => {
|
|
161
|
-
|
|
160
|
+
debug(`${_a.name} ⚡️ intersect (${entries?.at(0)?.isIntersecting})`);
|
|
162
161
|
if (!(root instanceof HTMLElement))
|
|
163
162
|
return;
|
|
164
163
|
for (const { isIntersecting } of entries)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
1
|
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
import { debug } from '../internal/utils';
|
|
3
3
|
/**
|
|
4
4
|
* @summary A container view with two or three side-by-side screens, where what the user chooses in the left screen changes what appears in the next screen.
|
|
5
5
|
*/
|
|
@@ -8,15 +8,15 @@ export class NavigationSplitView extends NavigationView {
|
|
|
8
8
|
super();
|
|
9
9
|
}
|
|
10
10
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
11
|
-
|
|
11
|
+
debug(`${NavigationSplitView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
12
12
|
super.attributeChangedCallback(name, oldValue, newValue);
|
|
13
13
|
}
|
|
14
14
|
disconnectedCallback() {
|
|
15
|
-
|
|
15
|
+
debug(`${NavigationSplitView.name} ⚡️ disconnect`);
|
|
16
16
|
super.disconnectedCallback();
|
|
17
17
|
}
|
|
18
18
|
connectedCallback() {
|
|
19
|
-
|
|
19
|
+
debug(`${NavigationSplitView.name} ⚡️ connect`);
|
|
20
20
|
super.connectedCallback();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
2
1
|
import { NavigationView } from '../internal/class/navigation-view';
|
|
2
|
+
import { debug } from '../internal/utils';
|
|
3
3
|
/**
|
|
4
4
|
* @summary A container view that shows a main screen and lets the user open other screens on top of it.
|
|
5
5
|
*/
|
|
@@ -8,7 +8,7 @@ export class NavigationStack extends NavigationView {
|
|
|
8
8
|
super();
|
|
9
9
|
}
|
|
10
10
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
11
|
-
|
|
11
|
+
debug(`${NavigationStack.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
12
12
|
super.attributeChangedCallback(name, oldValue, newValue);
|
|
13
13
|
switch (name) {
|
|
14
14
|
case 'hidden':
|
|
@@ -16,11 +16,11 @@ export class NavigationStack extends NavigationView {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
disconnectedCallback() {
|
|
19
|
-
|
|
19
|
+
debug(`${NavigationStack.name} ⚡️ disconnect`);
|
|
20
20
|
super.disconnectedCallback();
|
|
21
21
|
}
|
|
22
22
|
connectedCallback() {
|
|
23
|
-
|
|
23
|
+
debug(`${NavigationStack.name} ⚡️ connect`);
|
|
24
24
|
super.connectedCallback();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -5,8 +5,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var NavigationTitle_1;
|
|
8
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
9
8
|
import { microtaskOnConnected } from '../internal/decorators';
|
|
9
|
+
import { debug } from '../internal/utils';
|
|
10
10
|
import { queryMorph } from '../morphdom';
|
|
11
11
|
import { html } from '../tpl';
|
|
12
12
|
/**
|
|
@@ -22,14 +22,14 @@ let NavigationTitle = NavigationTitle_1 = class NavigationTitle extends HTMLElem
|
|
|
22
22
|
super();
|
|
23
23
|
}
|
|
24
24
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
25
|
-
|
|
25
|
+
debug(`${NavigationTitle_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
26
26
|
this.#render(this.getAttribute('value'), this.getAttribute('subtitle'), this.getAttribute('system-image'), this.getAttribute('system-image-weight'));
|
|
27
27
|
}
|
|
28
28
|
disconnectedCallback() {
|
|
29
|
-
|
|
29
|
+
debug(`${NavigationTitle_1.name} ⚡️ disconnect`);
|
|
30
30
|
}
|
|
31
31
|
connectedCallback() {
|
|
32
|
-
|
|
32
|
+
debug(`${NavigationTitle_1.name} ⚡️ connect`);
|
|
33
33
|
}
|
|
34
34
|
#render = (title, subtitle, systemImage, systemImageWeight) => {
|
|
35
35
|
queryMorph(':not([slot])', html `
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { DEBUG } from '../internal/flags.json' with { type: 'json' };
|
|
3
2
|
import { I18n } from '../i18n';
|
|
4
3
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
5
4
|
import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
|
|
6
5
|
import { MutationObserverSet } from '../internal/class/mutation-observer-set';
|
|
7
6
|
import { NavigationPath } from '../internal/class/navigation-path';
|
|
8
7
|
import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
9
|
-
import { $, ancestors, kebabCase, onoff } from '../internal/utils';
|
|
8
|
+
import { $, ancestors, debug, kebabCase, onoff } from '../internal/utils';
|
|
10
9
|
import { queryMorph } from '../morphdom';
|
|
11
10
|
import { html, render } from '../tpl';
|
|
12
11
|
const pickerStyles = ['menu', 'inline', 'navigation-link', 'sheet', 'automatic'];
|
|
13
12
|
const update = (path, node, overwrite = true) => {
|
|
14
|
-
|
|
13
|
+
debug(`PickerView: update`);
|
|
15
14
|
if (!(path instanceof NavigationPath))
|
|
16
15
|
throw new Error('invalid view');
|
|
17
16
|
const { component, page } = path;
|
|
@@ -23,7 +22,7 @@ const update = (path, node, overwrite = true) => {
|
|
|
23
22
|
page.insertAdjacentElement(position, node);
|
|
24
23
|
};
|
|
25
24
|
const reflectSpawnedPage = (current, source) => {
|
|
26
|
-
|
|
25
|
+
debug(`PickerView: reflectSpawnedPage`);
|
|
27
26
|
const { page: oldSv, toolBarConfig: oldToolbar } = new NavigationPath(current).hydrate(), { page: newSv, toolBarConfig: newToolbar } = new NavigationPath(source).hydrate();
|
|
28
27
|
const oldList = oldSv?.querySelector('list-view'), newList = newSv?.querySelector('list-view'), oldBackBtn = oldToolbar?.at(0)?.querySelector('button'), newBackBtn = newToolbar?.at(0)?.querySelector('button');
|
|
29
28
|
// pre replace list (always exists)
|
|
@@ -61,10 +60,10 @@ const reflectSpawnedPage = (current, source) => {
|
|
|
61
60
|
oldSearch?.remove();
|
|
62
61
|
};
|
|
63
62
|
const extractTag = (node) => {
|
|
64
|
-
|
|
63
|
+
debug(`PickerView: extractTag`);
|
|
65
64
|
return node instanceof HTMLOptionElement ? (((node.getAttribute('value') ?? node.textContent?.trim()) || node.getAttribute('label')) ?? '') : (node.value ?? '');
|
|
66
65
|
}, extractLabel = (node) => {
|
|
67
|
-
|
|
66
|
+
debug(`PickerView: extractLabelFromGroup`);
|
|
68
67
|
if (node instanceof Element)
|
|
69
68
|
if (node instanceof HTMLOptionElement)
|
|
70
69
|
return (node.getAttribute('label') ?? node.getAttribute('value') ?? node.textContent?.trim()) || null;
|
|
@@ -74,14 +73,14 @@ const extractTag = (node) => {
|
|
|
74
73
|
return node.title ?? node.value ?? null;
|
|
75
74
|
// return node instanceof Element ? node.getAttribute('DATALIST' === node.tagName ? 'data-label' : 'label') : (node.title ?? node.value ?? null)
|
|
76
75
|
}, extractIcon = (node) => {
|
|
77
|
-
|
|
76
|
+
debug(`PickerView: extractIcon`);
|
|
78
77
|
// return node instanceof Element ? node.getAttribute('data-system-image') : (node.systemImage ?? null)
|
|
79
78
|
if (node instanceof Element)
|
|
80
79
|
return node.getAttribute('data-system-image');
|
|
81
80
|
else
|
|
82
81
|
return node.systemImage ?? null;
|
|
83
82
|
}, extractSubtitle = (node) => {
|
|
84
|
-
|
|
83
|
+
debug(`PickerView: extractSubtitle`);
|
|
85
84
|
if (node instanceof Element)
|
|
86
85
|
return node.getAttribute('data-subtitle');
|
|
87
86
|
else
|
|
@@ -166,7 +165,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
166
165
|
};
|
|
167
166
|
}
|
|
168
167
|
#spawnPage = (elements, tag, parentGroupId, searchable = false, title) => {
|
|
169
|
-
|
|
168
|
+
debug(`${_a.name} #spawnPage`);
|
|
170
169
|
const body = tag === 'sheet-view'
|
|
171
170
|
? $(html `<dialog is="sheet-view">
|
|
172
171
|
<scroll-view>
|
|
@@ -324,7 +323,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
324
323
|
}
|
|
325
324
|
};
|
|
326
325
|
#renderButtons(input) {
|
|
327
|
-
|
|
326
|
+
debug(`${_a.name} #renderButtons`);
|
|
328
327
|
switch (input.mode) {
|
|
329
328
|
case 'dictionary': {
|
|
330
329
|
const flattenDictionary = (tree) => {
|
|
@@ -476,15 +475,15 @@ export class PickerView extends FormAssociatedBase {
|
|
|
476
475
|
this.#reflectSelectionOnCurrentValueLabel();
|
|
477
476
|
}
|
|
478
477
|
#renderDictionary = (dictionary) => {
|
|
479
|
-
|
|
478
|
+
debug(`${_a.name} ⚡️ mutation`);
|
|
480
479
|
this.#renderButtons({ mode: 'dictionary', source: dictionary });
|
|
481
480
|
};
|
|
482
481
|
#renderSlotted = (entries) => {
|
|
483
|
-
|
|
482
|
+
debug(`${_a.name} ⚡️ mutation`);
|
|
484
483
|
this.#renderButtons({ mode: 'list', source: this.#slots?.get('list')?.assignedElements({ flatten: true }) ?? [] });
|
|
485
484
|
};
|
|
486
485
|
#renderValidityMsgs = (entries) => {
|
|
487
|
-
|
|
486
|
+
debug(`${_a.name} ⚡️ mutation`);
|
|
488
487
|
this.setValidity(this.validity, this.validationMessage);
|
|
489
488
|
};
|
|
490
489
|
#lastRenderedStyle; //string | null
|
|
@@ -616,7 +615,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
616
615
|
this.#shadowRoot = this.attachShadow({ mode: 'closed' });
|
|
617
616
|
}
|
|
618
617
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
619
|
-
|
|
618
|
+
debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
620
619
|
switch (name) {
|
|
621
620
|
case this.constructor.ATTR.PLACEHOLDER:
|
|
622
621
|
case this.constructor.ATTR.PLACEHOLDER_ICON:
|
|
@@ -663,13 +662,13 @@ export class PickerView extends FormAssociatedBase {
|
|
|
663
662
|
}
|
|
664
663
|
}
|
|
665
664
|
disconnectedCallback() {
|
|
666
|
-
|
|
665
|
+
debug(`${_a.name} ⚡️ disconnect`);
|
|
667
666
|
CleanupRegistry.unregister(this);
|
|
668
667
|
this.#validityObservers.unobserveAll();
|
|
669
668
|
this.#observers.unobserveAll();
|
|
670
669
|
}
|
|
671
670
|
connectedCallback() {
|
|
672
|
-
|
|
671
|
+
debug(`${_a.name} ⚡️ connect`);
|
|
673
672
|
CleanupRegistry.register(this, onoff('localechange', () => {
|
|
674
673
|
this.#renderSlotted([]);
|
|
675
674
|
}, I18n.on).on());
|
|
@@ -687,7 +686,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
687
686
|
return pickerStyles.includes(this.getAttribute(attr) ?? '') ? this.getAttribute(attr) : 'automatic';
|
|
688
687
|
}
|
|
689
688
|
#render() {
|
|
690
|
-
|
|
689
|
+
debug(`${_a.name} ⚡️ #render (${this.pickerStyle})`);
|
|
691
690
|
// const style = this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)
|
|
692
691
|
if (this.#lastRenderedStyle === this.pickerStyle)
|
|
693
692
|
return; // skip if already applied
|
|
@@ -728,7 +727,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
728
727
|
this.dispatchEvent(new CustomEvent('selection', { detail: { selection: this.#selection }, bubbles: true, composed: true }));
|
|
729
728
|
};
|
|
730
729
|
#handleTriggerClick = async ({ type, target }) => {
|
|
731
|
-
|
|
730
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
732
731
|
if (!(target instanceof HTMLElement))
|
|
733
732
|
return;
|
|
734
733
|
this.#spawn?.remove?.();
|
|
@@ -743,7 +742,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
743
742
|
});
|
|
744
743
|
};
|
|
745
744
|
#handlePageBtnClick = async (evt) => {
|
|
746
|
-
|
|
745
|
+
debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
747
746
|
evt.stopImmediatePropagation();
|
|
748
747
|
evt.preventDefault();
|
|
749
748
|
const { currentTarget: btn } = evt;
|
|
@@ -766,7 +765,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
766
765
|
});
|
|
767
766
|
};
|
|
768
767
|
#handleClick({ type, target }) {
|
|
769
|
-
|
|
768
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
770
769
|
if (!(target instanceof HTMLElement))
|
|
771
770
|
return;
|
|
772
771
|
const btn = target.closest('button');
|
|
@@ -778,7 +777,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
778
777
|
this.#sendValueToForm();
|
|
779
778
|
}
|
|
780
779
|
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
781
|
-
|
|
780
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
782
781
|
if (!(slot instanceof HTMLSlotElement))
|
|
783
782
|
return;
|
|
784
783
|
const assigned = slot.assignedElements();
|
|
@@ -787,7 +786,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
787
786
|
this.#renderValidityMsgs([]);
|
|
788
787
|
};
|
|
789
788
|
#handleListSlotchange = ({ type, target: slot }) => {
|
|
790
|
-
|
|
789
|
+
debug(`${_a.name} ⚡️ ${type}`);
|
|
791
790
|
if (!(slot instanceof HTMLSlotElement))
|
|
792
791
|
return;
|
|
793
792
|
const assigned = slot.assignedElements();
|
|
@@ -796,7 +795,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
796
795
|
this.#renderSlotted([]);
|
|
797
796
|
};
|
|
798
797
|
static #wrapOptionSpawnTag(node) {
|
|
799
|
-
|
|
798
|
+
debug(`${_a.name} #wrapOptionSpawnTag`);
|
|
800
799
|
const title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
|
|
801
800
|
const mount = document.createElement('div');
|
|
802
801
|
render(html `<button type="button" tabindex="0" navigation-link>
|
|
@@ -834,7 +833,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
834
833
|
return mount.firstElementChild; //btn
|
|
835
834
|
}
|
|
836
835
|
static #wrapOptionTag(node) {
|
|
837
|
-
|
|
836
|
+
debug(`${_a.name} #wrapOptionTag`);
|
|
838
837
|
const tag = extractTag(node), title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
|
|
839
838
|
const mount = document.createElement('div');
|
|
840
839
|
render(html `<button type="button" tabindex="0" value="${tag}">
|
|
@@ -866,7 +865,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
866
865
|
return mount.firstElementChild; //btn
|
|
867
866
|
}
|
|
868
867
|
static #wrapOptgroupTag(node) {
|
|
869
|
-
|
|
868
|
+
debug(`${_a.name} #wrapOptgroupTag`);
|
|
870
869
|
const title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
|
|
871
870
|
const mount = document.createElement('div');
|
|
872
871
|
render(html `<details is="disclosure-group" disclosure-style="marker-trailing">
|
|
@@ -899,7 +898,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
899
898
|
// static #reflectButtons(nodes: Element[], container: Element): void
|
|
900
899
|
// static #reflectButtons(nodes: Dictionary, container: Element): void
|
|
901
900
|
static #reflectButtons(nodes, container) {
|
|
902
|
-
|
|
901
|
+
debug(`${_a.name} #reflectButtons`);
|
|
903
902
|
for (const node of nodes)
|
|
904
903
|
if (node instanceof Element)
|
|
905
904
|
switch (node.tagName) {
|
|
@@ -981,7 +980,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
981
980
|
}
|
|
982
981
|
}
|
|
983
982
|
// #reflectPlaceholder(value: string | null) {
|
|
984
|
-
//
|
|
983
|
+
// debug(`#reflectPlaceholder`)
|
|
985
984
|
// const input = this.#shadowRoot.querySelector('input')
|
|
986
985
|
// if (input) {
|
|
987
986
|
// if (value) input.setAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER, value)
|
|
@@ -989,12 +988,12 @@ export class PickerView extends FormAssociatedBase {
|
|
|
989
988
|
// }
|
|
990
989
|
// }
|
|
991
990
|
#reflectLabel(value) {
|
|
992
|
-
|
|
991
|
+
debug(`${_a.name} #reflectLabel`);
|
|
993
992
|
queryMorph('[slot=label]', html `<label-view slot="label">${value ? html `<span>${value}</span>` : null}</label-view>`, this);
|
|
994
993
|
this.#renderSlotted([]);
|
|
995
994
|
}
|
|
996
995
|
#reflectSelectionOnButtons() {
|
|
997
|
-
|
|
996
|
+
debug(`${_a.name} #reflectSelectionOnButtons`);
|
|
998
997
|
self.requestAnimationFrame(() => {
|
|
999
998
|
this.ariaCurrent = this.#selection;
|
|
1000
999
|
const groupMap = indexGroups(this.#lastIndexedRoot);
|
|
@@ -1025,7 +1024,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1025
1024
|
* Overwrite cvlabel with the label prop of the current(find[value === #selection]) option/dictentry
|
|
1026
1025
|
*/
|
|
1027
1026
|
#reflectSelectionOnCurrentValueLabel() {
|
|
1028
|
-
|
|
1027
|
+
debug(`${_a.name} #reflectSelectionOnCurrentValueLabel`);
|
|
1029
1028
|
self.requestAnimationFrame(() => {
|
|
1030
1029
|
switch (this.pickerStyle) {
|
|
1031
1030
|
case 'sheet':
|
|
@@ -1068,7 +1067,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1068
1067
|
});
|
|
1069
1068
|
}
|
|
1070
1069
|
#reflectTriggerHelp() {
|
|
1071
|
-
|
|
1070
|
+
debug(`${_a.name} #reflectTriggerHelp`);
|
|
1072
1071
|
let trigger;
|
|
1073
1072
|
switch (this.pickerStyle) {
|
|
1074
1073
|
case 'sheet':
|
|
@@ -1123,7 +1122,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
1123
1122
|
message = kebabCase(key);
|
|
1124
1123
|
break;
|
|
1125
1124
|
}
|
|
1126
|
-
|
|
1125
|
+
debug(`${_a.name} ⚡️ validity-change`);
|
|
1127
1126
|
return this.#internals.setValidity(flags, this.#customValidity || message, anchor);
|
|
1128
1127
|
};
|
|
1129
1128
|
setCustomValidity = (message) => {
|