@swiftwc/ui 0.0.0-dev.20 → 0.0.0-dev.21
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/buses/alert-dialog.d.ts +2 -0
- package/generated/buses/alert-dialog.js +1 -0
- package/generated/buses/confirmation-dialog.d.ts +2 -0
- package/generated/buses/confirmation-dialog.js +1 -0
- package/generated/buses/index.d.ts +6 -0
- package/generated/buses/index.js +6 -0
- package/generated/buses/lifecycle-observer.d.ts +2 -0
- package/generated/buses/lifecycle-observer.js +1 -0
- package/generated/client/index.d.ts +17 -4
- package/generated/client/index.js +83 -32
- package/generated/components/alert-dialog.d.ts +8 -0
- package/generated/components/alert-dialog.js +94 -0
- package/generated/components/bordered-button.d.ts +2 -0
- package/generated/components/bordered-button.js +15 -1
- package/generated/components/bordered-prominent-button.d.ts +2 -0
- package/generated/components/bordered-prominent-button.js +15 -1
- package/generated/components/borderless-button.d.ts +1 -1
- package/generated/components/borderless-button.js +6 -7
- package/generated/components/confirmation-dialog.d.ts +1 -1
- package/generated/components/confirmation-dialog.js +26 -20
- package/generated/components/content-unavailable-view.js +2 -2
- package/generated/components/date-picker.js +14 -6
- package/generated/components/disclosure-group.js +4 -1
- package/generated/components/glass-button.d.ts +2 -0
- package/generated/components/glass-button.js +15 -1
- package/generated/components/glass-prominent-button.d.ts +2 -0
- package/generated/components/glass-prominent-button.js +15 -1
- package/generated/components/index.d.ts +1 -0
- package/generated/components/index.js +1 -0
- package/generated/components/label-view.js +3 -3
- package/generated/components/menu-view.js +12 -7
- package/generated/components/navigation-title.js +4 -4
- package/generated/components/picker-view.js +16 -10
- package/generated/components/scroll-view.js +19 -10
- package/generated/components/section-view.js +3 -3
- package/generated/components/sheet-view.d.ts +1 -1
- package/generated/components/sheet-view.js +21 -17
- package/generated/components/sidebar-toggle.js +5 -3
- package/generated/components/sidebar-view.js +10 -4
- package/generated/components/sticky-container.js +3 -1
- package/generated/components/tab-bar.js +10 -4
- package/generated/components/tab-item.js +3 -1
- package/generated/components/tab-view.js +4 -1
- package/generated/components/table-view.js +11 -5
- package/generated/components/text-field.js +28 -28
- package/generated/components/tool-bar-item-group.d.ts +2 -0
- package/generated/components/tool-bar-item-group.js +28 -0
- package/generated/components/tool-bar-item.d.ts +2 -0
- package/generated/components/tool-bar-item.js +32 -2
- package/generated/components/tool-bar.js +1 -1
- package/generated/components/v-stack.d.ts +5 -0
- package/generated/components/v-stack.js +5 -0
- package/generated/css/index.css +128 -37
- package/generated/events/alert-dialog.d.ts +8 -0
- package/generated/events/alert-dialog.js +1 -0
- package/generated/events/confirmation-dialog.d.ts +2 -2
- package/generated/events/index.d.ts +1 -0
- package/generated/events/index.js +1 -0
- package/generated/i18n/locales/el.d.ts +9 -0
- package/generated/i18n/locales/el.js +9 -0
- package/generated/i18n/locales/en.d.ts +9 -0
- package/generated/i18n/locales/en.js +9 -0
- package/generated/internal/class/form-associated-base.js +4 -1
- package/generated/internal/class/navigation-view.js +4 -4
- package/generated/internal/utils/button-role.d.ts +1 -0
- package/generated/internal/utils/button-role.js +19 -0
- package/generated/internal/utils/cash/index.d.ts +4 -3
- package/generated/internal/utils/cash/index.js +6 -4
- package/generated/internal/utils/index.d.ts +3 -0
- package/generated/internal/utils/index.js +3 -0
- package/generated/internal/utils/is-inside.d.ts +1 -0
- package/generated/internal/utils/is-inside.js +4 -0
- package/generated/internal/utils/list-active.js +15 -5
- package/generated/internal/utils/toolbar-repositioner.d.ts +1 -0
- package/generated/internal/utils/toolbar-repositioner.js +12 -0
- package/generated/snapshot/index.d.ts +2 -0
- package/generated/snapshot/index.js +21 -0
- package/package.json +7 -4
- package/scss/_components.scss +2 -0
- package/scss/_functions.scss +10 -0
- package/scss/_transitions.scss +1 -0
- package/scss/colors/_index.scss +2 -2
- package/scss/components/_alert-dialog.scss +106 -0
- package/scss/components/_confirmation-dialog.scss +39 -39
- package/scss/components/_h-stack.scss +3 -13
- package/scss/components/_index.scss +1 -0
- package/scss/components/_sheet-view.scss +11 -1
- package/scss/components/_v-stack.scss +3 -13
- package/scss/final/_touch-glass.scss +7 -0
- package/scss/mixins/_index.scss +17 -0
- package/scss/placeholders/_buttons.scss +42 -0
- package/scss/transitions/_alert-dialog.scss +19 -0
- package/scss/utils/_frame.scss +7 -0
- package/web-components.html-data/en.json +84 -7
- package/generated/confirmation-dialog/index.d.ts +0 -1
- package/generated/confirmation-dialog/index.js +0 -1
- package/generated/lifecycle-observer/index.d.ts +0 -1
- package/generated/lifecycle-observer/index.js +0 -1
- package/scss/components/_components.scss +0 -76
|
@@ -35,7 +35,10 @@ export class DisclosureGroup extends DetailsBase {
|
|
|
35
35
|
}
|
|
36
36
|
static #handleToggle = async (evt) => {
|
|
37
37
|
console.debug(`${DisclosureGroup.name} ⚡️ ${evt?.type}`);
|
|
38
|
-
const details = evt.currentTarget
|
|
38
|
+
const details = evt.currentTarget instanceof HTMLDetailsElement && evt.currentTarget;
|
|
39
|
+
if (!details)
|
|
40
|
+
return;
|
|
41
|
+
const newValue = details.open ? 'opening' : 'closing';
|
|
39
42
|
if (newValue !== details.dataset.state)
|
|
40
43
|
details.dataset.state = newValue;
|
|
41
44
|
if (!toggleTimers.has(details))
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ButtonBase } from '../namespace-browser/base';
|
|
2
2
|
export declare class GlassButton extends ButtonBase {
|
|
3
|
+
static get observedAttributes(): string[];
|
|
3
4
|
constructor();
|
|
4
5
|
static polyfillDisconnectedCallback(el: ButtonBase): void;
|
|
5
6
|
static polyfillConnectedCallback(el: ButtonBase): void;
|
|
7
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
6
8
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { buttonRole, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
export class GlassButton extends ButtonBase {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ['role'];
|
|
7
|
+
}
|
|
5
8
|
constructor() {
|
|
6
9
|
super();
|
|
7
10
|
}
|
|
@@ -14,4 +17,15 @@ export class GlassButton extends ButtonBase {
|
|
|
14
17
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
15
18
|
el.tabIndex = 0;
|
|
16
19
|
}
|
|
20
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
21
|
+
console.debug(`${GlassButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
22
|
+
const node = target instanceof HTMLButtonElement && target;
|
|
23
|
+
if (!node)
|
|
24
|
+
return;
|
|
25
|
+
switch (attributeName) {
|
|
26
|
+
case 'role':
|
|
27
|
+
buttonRole(target, attributeName);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
17
31
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ButtonBase } from '../namespace-browser/base';
|
|
2
2
|
export declare class GlassProminentButton extends ButtonBase {
|
|
3
|
+
static get observedAttributes(): string[];
|
|
3
4
|
constructor();
|
|
4
5
|
static polyfillDisconnectedCallback(el: ButtonBase): void;
|
|
5
6
|
static polyfillConnectedCallback(el: ButtonBase): void;
|
|
7
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
6
8
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { onoff, touchGlass } from '../internal/utils';
|
|
2
|
+
import { buttonRole, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
export class GlassProminentButton extends ButtonBase {
|
|
5
|
+
static get observedAttributes() {
|
|
6
|
+
return ['role'];
|
|
7
|
+
}
|
|
5
8
|
constructor() {
|
|
6
9
|
super();
|
|
7
10
|
}
|
|
@@ -14,4 +17,15 @@ export class GlassProminentButton extends ButtonBase {
|
|
|
14
17
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
15
18
|
el.tabIndex = 0;
|
|
16
19
|
}
|
|
20
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
21
|
+
console.debug(`${GlassProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
22
|
+
const node = target instanceof HTMLButtonElement && target;
|
|
23
|
+
if (!node)
|
|
24
|
+
return;
|
|
25
|
+
switch (attributeName) {
|
|
26
|
+
case 'role':
|
|
27
|
+
buttonRole(target, attributeName);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
17
31
|
}
|
|
@@ -11,7 +11,7 @@ export class LabelView extends HTMLElement {
|
|
|
11
11
|
</div>
|
|
12
12
|
<div part="root label-title-stack">
|
|
13
13
|
<slot></slot>
|
|
14
|
-
</div
|
|
14
|
+
</div>`));
|
|
15
15
|
}
|
|
16
16
|
#shadowRoot;
|
|
17
17
|
// #imgSlot?: HTMLSlotElement
|
|
@@ -43,7 +43,7 @@ export class LabelView extends HTMLElement {
|
|
|
43
43
|
case 'system-image':
|
|
44
44
|
let image = this.querySelector(':scope>[slot=image]');
|
|
45
45
|
if (newValue) {
|
|
46
|
-
image ??= this.appendChild($(`<i slot="image"></i
|
|
46
|
+
image ??= this.appendChild($(`<i slot="image"></i>`, '>1'));
|
|
47
47
|
image.setAttribute('class', `ph ph-${newValue}`);
|
|
48
48
|
}
|
|
49
49
|
else
|
|
@@ -62,7 +62,7 @@ export class LabelView extends HTMLElement {
|
|
|
62
62
|
case 'title':
|
|
63
63
|
let title = this.querySelector(':scope>:not([slot])');
|
|
64
64
|
if (newValue) {
|
|
65
|
-
title ??= this.appendChild($(`<span></span
|
|
65
|
+
title ??= this.appendChild($(`<span></span>`, '>1'));
|
|
66
66
|
title.textContent = newValue;
|
|
67
67
|
}
|
|
68
68
|
else
|
|
@@ -17,7 +17,7 @@ export class MenuView extends HTMLElement {
|
|
|
17
17
|
<slot></slot>
|
|
18
18
|
</div>
|
|
19
19
|
</form>
|
|
20
|
-
</dialog
|
|
20
|
+
</dialog>`));
|
|
21
21
|
}
|
|
22
22
|
#shadowRoot;
|
|
23
23
|
#dialog;
|
|
@@ -50,9 +50,12 @@ export class MenuView extends HTMLElement {
|
|
|
50
50
|
{ types: 'cancel', listener: this.#handleDialogCancel },
|
|
51
51
|
], this.#dialog).on());
|
|
52
52
|
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, (evt) => {
|
|
53
|
-
|
|
53
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
54
|
+
if (!target)
|
|
55
|
+
return true;
|
|
56
|
+
if (target.matches('menu-view'))
|
|
54
57
|
return false;
|
|
55
|
-
if (!
|
|
58
|
+
if (!target.closest('menu-view[open]'))
|
|
56
59
|
return false;
|
|
57
60
|
return true;
|
|
58
61
|
}), this).on());
|
|
@@ -89,7 +92,7 @@ export class MenuView extends HTMLElement {
|
|
|
89
92
|
case 'label':
|
|
90
93
|
let label = this.querySelector(':scope>[slot=label]');
|
|
91
94
|
if (newValue) {
|
|
92
|
-
label ??= this.appendChild($(`<label-view slot="label"></label-view
|
|
95
|
+
label ??= this.appendChild($(`<label-view slot="label"></label-view>`, '>1'));
|
|
93
96
|
label.setAttribute('title', newValue);
|
|
94
97
|
}
|
|
95
98
|
else
|
|
@@ -99,15 +102,17 @@ export class MenuView extends HTMLElement {
|
|
|
99
102
|
}
|
|
100
103
|
#handleDialogClick = (evt) => {
|
|
101
104
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
102
|
-
|
|
105
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
106
|
+
if (!target)
|
|
107
|
+
return;
|
|
108
|
+
if (target.matches('dialog'))
|
|
103
109
|
return this.toggleAttribute('open', false); // click outside
|
|
104
|
-
const target = evt.target;
|
|
105
110
|
target.scrollIntoView({
|
|
106
111
|
behavior: self.matchMedia('(prefers-reduced-motion: no-preference)').matches ? 'smooth' : 'instant',
|
|
107
112
|
block: 'nearest',
|
|
108
113
|
inline: 'nearest',
|
|
109
114
|
});
|
|
110
|
-
if (!
|
|
115
|
+
if (!target.closest('button'))
|
|
111
116
|
return;
|
|
112
117
|
// TODO: Handle btns this.toggleAttribute('open', false)
|
|
113
118
|
this.toggleAttribute('open', false);
|
|
@@ -34,18 +34,18 @@ export class NavigationTitle extends HTMLElement {
|
|
|
34
34
|
}
|
|
35
35
|
#render = (title, subtitle) => {
|
|
36
36
|
const el = this.querySelector(':scope>:not([slot])') ??
|
|
37
|
-
this.appendChild($(`<navigation-large-title><v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack></navigation-large-title
|
|
38
|
-
el.appendChild($(`<v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack
|
|
37
|
+
this.appendChild($(`<navigation-large-title><v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack></navigation-large-title>`, '>1')), vStack = el.querySelector(':scope>v-stack') ??
|
|
38
|
+
el.appendChild($(`<v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack>`, '>1'));
|
|
39
39
|
let titleLabel = vStack.querySelector(':scope>label-view:nth-child(1)');
|
|
40
40
|
if (title) {
|
|
41
|
-
titleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view
|
|
41
|
+
titleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view>`, '>1'));
|
|
42
42
|
titleLabel.setAttribute('title', title);
|
|
43
43
|
}
|
|
44
44
|
else
|
|
45
45
|
titleLabel?.remove();
|
|
46
46
|
let subtitleLabel = vStack.querySelector(':scope>label-view:nth-child(2)');
|
|
47
47
|
if (subtitle) {
|
|
48
|
-
subtitleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="callout"></label-view
|
|
48
|
+
subtitleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="callout"></label-view>`, '>1'));
|
|
49
49
|
subtitleLabel.setAttribute('title', subtitle);
|
|
50
50
|
}
|
|
51
51
|
else
|
|
@@ -54,7 +54,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
54
54
|
<slot name="tag" hidden></slot>
|
|
55
55
|
<slot name="validity-options" hidden></slot>
|
|
56
56
|
</label>
|
|
57
|
-
|
|
57
|
+
`));
|
|
58
58
|
// break
|
|
59
59
|
// case 'compact':
|
|
60
60
|
// PickerView.#templates.set(
|
|
@@ -114,7 +114,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
114
114
|
<slot name="options" hidden></slot>
|
|
115
115
|
<slot name="tag" hidden></slot>
|
|
116
116
|
<slot name="validity-options" hidden></slot>
|
|
117
|
-
</label
|
|
117
|
+
</label>`));
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
return _a.#templates.get(this.pickerStyle);
|
|
@@ -235,7 +235,10 @@ export class PickerView extends FormAssociatedBase {
|
|
|
235
235
|
};
|
|
236
236
|
#handleClick(evt) {
|
|
237
237
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
238
|
-
const target = evt.target
|
|
238
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
239
|
+
if (!target)
|
|
240
|
+
return;
|
|
241
|
+
const btn = target?.closest('button');
|
|
239
242
|
if (!btn)
|
|
240
243
|
return;
|
|
241
244
|
if (btn.hasAttribute('tag')) {
|
|
@@ -248,7 +251,10 @@ export class PickerView extends FormAssociatedBase {
|
|
|
248
251
|
}
|
|
249
252
|
#handleSlotchange = (evt) => {
|
|
250
253
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
251
|
-
const slot = evt.target
|
|
254
|
+
const slot = evt.target instanceof HTMLSlotElement && evt.target;
|
|
255
|
+
if (!slot)
|
|
256
|
+
return;
|
|
257
|
+
const assigned = slot.assignedElements({ flatten: true });
|
|
252
258
|
observers.syncObservations(this.#trackedElements, assigned, this.#handleTagMutation);
|
|
253
259
|
// for (const el of this.#trackedElements)
|
|
254
260
|
// if (!assigned.includes(el)) {
|
|
@@ -270,7 +276,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
270
276
|
this.#handleTagMutation();
|
|
271
277
|
};
|
|
272
278
|
static wrapTag(node, slotName) {
|
|
273
|
-
const btn = $(`<button type="button" tabindex="0"></button
|
|
279
|
+
const btn = $(`<button type="button" tabindex="0"></button>`, '>1'); //document.createElement('button')
|
|
274
280
|
// btn.type = 'button'
|
|
275
281
|
// btn.tabIndex = 0
|
|
276
282
|
switch (slotName) {
|
|
@@ -283,7 +289,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
283
289
|
default:
|
|
284
290
|
if (node.hasAttribute('value'))
|
|
285
291
|
btn.setAttribute('tag', node.getAttribute('value') ?? '');
|
|
286
|
-
const label = $(`<label-view></label-view
|
|
292
|
+
const label = $(`<label-view></label-view>`, '>1'); //document.createElement('label-view')
|
|
287
293
|
if (node.hasAttribute('label'))
|
|
288
294
|
label.setAttribute('title', node.getAttribute('label') ?? '');
|
|
289
295
|
btn.appendChild(label);
|
|
@@ -297,7 +303,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
297
303
|
// switch (this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)) {
|
|
298
304
|
switch (this.pickerStyle) {
|
|
299
305
|
case 'menu':
|
|
300
|
-
const menu = this.querySelector(':scope>menu-view:not([slot])') ?? this.appendChild($(`<menu-view tabindex="0"></menu-view
|
|
306
|
+
const menu = this.querySelector(':scope>menu-view:not([slot])') ?? this.appendChild($(`<menu-view tabindex="0"></menu-view>`, '>1'));
|
|
301
307
|
menu.innerHTML = `<label-view slot="label" system-image="dots-three" title="rtyty"></label-view>`;
|
|
302
308
|
for (const el of sourceSlot?.assignedElements({ flatten: true }) ?? [])
|
|
303
309
|
menu.insertAdjacentElement('beforeend', _a.wrapTag(el, sourceSlot?.name));
|
|
@@ -308,11 +314,11 @@ export class PickerView extends FormAssociatedBase {
|
|
|
308
314
|
break;
|
|
309
315
|
case 'inline':
|
|
310
316
|
default:
|
|
311
|
-
const inlineList = this.querySelector(':scope>list-view:not([slot])') ?? this.appendChild($(`<list-view><section-view></section-view></list-view
|
|
317
|
+
const inlineList = this.querySelector(':scope>list-view:not([slot])') ?? this.appendChild($(`<list-view><section-view></section-view></list-view>`, '>1')), section = inlineList.querySelector(':scope>section-view') ?? inlineList.appendChild($(`<section-view></section-view>`, '>1'));
|
|
312
318
|
const label = this.getAttribute(this.constructor.ATTR.LABEL);
|
|
313
319
|
// if (label) section.setAttribute('header', label)
|
|
314
320
|
if (label) {
|
|
315
|
-
const el = $(`<label-view></label-view
|
|
321
|
+
const el = $(`<label-view></label-view>`, '>1');
|
|
316
322
|
el.setAttribute('title', label);
|
|
317
323
|
section.insertAdjacentElement('beforeend', el);
|
|
318
324
|
}
|
|
@@ -360,7 +366,7 @@ export class PickerView extends FormAssociatedBase {
|
|
|
360
366
|
// default:
|
|
361
367
|
let label = this.querySelector(':scope>[slot=label]');
|
|
362
368
|
if (value) {
|
|
363
|
-
label ??= this.appendChild($(`<span slot="label"></span
|
|
369
|
+
label ??= this.appendChild($(`<span slot="label"></span>`, '>1'));
|
|
364
370
|
label.textContent = value;
|
|
365
371
|
}
|
|
366
372
|
else
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { lifecycleObserver } from '../buses';
|
|
2
3
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
4
|
import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
|
|
4
5
|
import { $, frame, onoff, slowHideShow } from '../internal/utils';
|
|
5
|
-
import { LifecycleObserver } from '../lifecycle-observer';
|
|
6
6
|
const observers = new ResizeObserverSingleton();
|
|
7
7
|
export class ScrollView extends HTMLElement {
|
|
8
8
|
static get observedAttributes() {
|
|
@@ -21,7 +21,7 @@ export class ScrollView extends HTMLElement {
|
|
|
21
21
|
<div part="root scroll-view-toolbar-stack">
|
|
22
22
|
<slot name="bottom-bar-principal"></slot>
|
|
23
23
|
</div>
|
|
24
|
-
</div
|
|
24
|
+
</div>`));
|
|
25
25
|
}
|
|
26
26
|
#shadowRoot;
|
|
27
27
|
#navbarPrincipalSlot;
|
|
@@ -39,7 +39,7 @@ export class ScrollView extends HTMLElement {
|
|
|
39
39
|
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
40
40
|
CleanupRegistry.unregister(this);
|
|
41
41
|
observers.unobserve(this);
|
|
42
|
-
frame().then(() =>
|
|
42
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pagehide', { detail: { page: this }, bubbles: true, composed: true })));
|
|
43
43
|
}
|
|
44
44
|
connectedCallback() {
|
|
45
45
|
console.debug(`${_a.name} ⚡️ connect`);
|
|
@@ -51,7 +51,7 @@ export class ScrollView extends HTMLElement {
|
|
|
51
51
|
{ types: 'scroll', listener: this.#handleScroll, addOptions: { passive: true } },
|
|
52
52
|
{ types: 'scrollend', listener: this.#handleScrollend, addOptions: { passive: true } },
|
|
53
53
|
], this).on());
|
|
54
|
-
frame().then(() =>
|
|
54
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pageshow', { detail: { page: this }, bubbles: true, composed: true })));
|
|
55
55
|
observers.observe(this, this.#handleMeasure.bind(this));
|
|
56
56
|
// frame(this).then((r) => {
|
|
57
57
|
// if (!r) return
|
|
@@ -94,7 +94,10 @@ export class ScrollView extends HTMLElement {
|
|
|
94
94
|
if (!this.#isMidScroll)
|
|
95
95
|
this.#isMidScroll = true;
|
|
96
96
|
// if (this.#stopRecordingScrollTop) return
|
|
97
|
-
|
|
97
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
98
|
+
if (!target)
|
|
99
|
+
return;
|
|
100
|
+
this.#lastScrollTop = target.scrollTop;
|
|
98
101
|
};
|
|
99
102
|
#handleScrollend = (evt) => {
|
|
100
103
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
@@ -120,7 +123,10 @@ export class ScrollView extends HTMLElement {
|
|
|
120
123
|
};
|
|
121
124
|
#handleTabReveal = (evt) => {
|
|
122
125
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
123
|
-
|
|
126
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
127
|
+
if (!target)
|
|
128
|
+
return;
|
|
129
|
+
if (!target.contains(this))
|
|
124
130
|
return;
|
|
125
131
|
if (this.closest('[hidden]'))
|
|
126
132
|
return;
|
|
@@ -149,7 +155,10 @@ export class ScrollView extends HTMLElement {
|
|
|
149
155
|
};
|
|
150
156
|
#handleTabBeforeswap = (evt) => {
|
|
151
157
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
152
|
-
|
|
158
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
159
|
+
if (!target)
|
|
160
|
+
return;
|
|
161
|
+
if (!target.contains(this))
|
|
153
162
|
return;
|
|
154
163
|
if (this.closest('[hidden]'))
|
|
155
164
|
return;
|
|
@@ -167,17 +176,17 @@ export class ScrollView extends HTMLElement {
|
|
|
167
176
|
}
|
|
168
177
|
#renderNavTitle = (title, subtitle) => {
|
|
169
178
|
const vStack = this.querySelector(':scope>[slot=top-bar-principal]') ??
|
|
170
|
-
this.appendChild($(`<v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack
|
|
179
|
+
this.appendChild($(`<v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"></label-view><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></v-stack>`, '>1'));
|
|
171
180
|
let titleLabel = vStack.querySelector(':scope>label-view:nth-child(1)');
|
|
172
181
|
if (title) {
|
|
173
|
-
titleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view
|
|
182
|
+
titleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view>`, '>1'));
|
|
174
183
|
titleLabel.setAttribute('title', title);
|
|
175
184
|
}
|
|
176
185
|
else
|
|
177
186
|
titleLabel?.remove();
|
|
178
187
|
let subtitleLabel = vStack.querySelector(':scope>label-view:nth-child(2)');
|
|
179
188
|
if (subtitle) {
|
|
180
|
-
subtitleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="callout"></label-view
|
|
189
|
+
subtitleLabel ??= vStack.appendChild($(`<label-view line-limit="1" truncation-mode="tail" font="callout"></label-view>`, '>1'));
|
|
181
190
|
subtitleLabel.setAttribute('title', subtitle);
|
|
182
191
|
}
|
|
183
192
|
else
|
|
@@ -14,7 +14,7 @@ export class SectionView extends HTMLElement {
|
|
|
14
14
|
</div>
|
|
15
15
|
<div part="root section-footer-stack">
|
|
16
16
|
<slot name="footer"></slot>
|
|
17
|
-
</div
|
|
17
|
+
</div>`));
|
|
18
18
|
// <div class="sticky-sentinel" style="grid-area:sentinel;inline-size:100%;block-size:0.1px;pointer-events:none;"></div>
|
|
19
19
|
}
|
|
20
20
|
#shadowRoot;
|
|
@@ -60,7 +60,7 @@ export class SectionView extends HTMLElement {
|
|
|
60
60
|
case 'header':
|
|
61
61
|
let header = this.querySelector(':scope>[slot=header]');
|
|
62
62
|
if (newValue) {
|
|
63
|
-
header ??= this.appendChild($(`<header slot="header"><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></header
|
|
63
|
+
header ??= this.appendChild($(`<header slot="header"><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></header>`, '>1'));
|
|
64
64
|
header.querySelector('label-view')?.setAttribute('title', newValue);
|
|
65
65
|
}
|
|
66
66
|
else
|
|
@@ -69,7 +69,7 @@ export class SectionView extends HTMLElement {
|
|
|
69
69
|
case 'footer':
|
|
70
70
|
let footer = this.querySelector(':scope>[slot=footer]');
|
|
71
71
|
if (newValue) {
|
|
72
|
-
footer ??= this.appendChild($(`<footer slot="footer"><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></footer
|
|
72
|
+
footer ??= this.appendChild($(`<footer slot="footer"><label-view line-limit="1" truncation-mode="tail" font="callout"></label-view></footer>`, '>1'));
|
|
73
73
|
footer.querySelector('label-view')?.setAttribute('title', newValue);
|
|
74
74
|
}
|
|
75
75
|
else
|
|
@@ -5,5 +5,5 @@ export declare class SheetView extends DialogBase {
|
|
|
5
5
|
constructor();
|
|
6
6
|
static polyfillDisconnectedCallback(el: SheetView): void;
|
|
7
7
|
static polyfillConnectedCallback(el: SheetView): void;
|
|
8
|
-
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]):
|
|
8
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
9
9
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
export class SheetView extends DialogBase {
|
|
6
5
|
static get observedAttributes() {
|
|
7
6
|
return ['fine-presentation-large-adaptation'];
|
|
@@ -21,23 +20,28 @@ export class SheetView extends DialogBase {
|
|
|
21
20
|
], el).on());
|
|
22
21
|
el.autofocus = true;
|
|
23
22
|
}
|
|
24
|
-
static
|
|
23
|
+
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
25
24
|
console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
// NOTE: wait for config
|
|
26
|
+
// Snapshot.waitReady.then(() => {
|
|
27
|
+
// switch (attributeName) {
|
|
28
|
+
// case 'fine-presentation-large-adaptation':
|
|
29
|
+
// const node = target instanceof HTMLDialogElement && target
|
|
30
|
+
// if (!node) break
|
|
31
|
+
// CleanupRegistry.unregister(node, 'mediaquery')
|
|
32
|
+
// if ('bottom-bar' !== target.getAttribute(attributeName ?? '')) break
|
|
33
|
+
// const mediaQueryList = self.matchMedia(`(pointer: fine) and (min-width: ${Snapshot.config!['ipad-sheet-view-inline-size']}) and (min-height: ${Snapshot.config!['ipad-sheet-view-height']})`)
|
|
34
|
+
// SheetView.#handleMediaChange(
|
|
35
|
+
// node,
|
|
36
|
+
// new MediaQueryListEvent(`media-change`, {
|
|
37
|
+
// matches: mediaQueryList.matches,
|
|
38
|
+
// })
|
|
39
|
+
// ) // Initial check
|
|
40
|
+
// const handler1 = SheetView.#handleMediaChange.bind(null, node)
|
|
41
|
+
// CleanupRegistry.register(node, onoff('change', handler1 as unknown as EventListener, mediaQueryList).on(), 'mediaquery')
|
|
42
|
+
// break
|
|
43
|
+
// }
|
|
44
|
+
// })
|
|
41
45
|
}
|
|
42
46
|
static #handleKeydown = (evt) => {
|
|
43
47
|
console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
|
|
@@ -29,8 +29,8 @@ export class SidebarToggle extends HTMLElement {
|
|
|
29
29
|
// This triggers on show/hide of any of sidebar-toggle elements
|
|
30
30
|
static #handleMeasure(entry) {
|
|
31
31
|
console.debug(`${_a.name} ⚡️ measure`);
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
32
|
+
const target = entry?.target instanceof HTMLElement && entry.target;
|
|
33
|
+
if (!target)
|
|
34
34
|
return;
|
|
35
35
|
// set/remove css var/prop to parent based on shown/hidden
|
|
36
36
|
const tv = target.parentElement;
|
|
@@ -67,7 +67,9 @@ export class SidebarToggle extends HTMLElement {
|
|
|
67
67
|
}
|
|
68
68
|
#handleClick(evt) {
|
|
69
69
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
70
|
-
const
|
|
70
|
+
const target = evt?.target instanceof HTMLElement && evt.target;
|
|
71
|
+
if (!target)
|
|
72
|
+
return;
|
|
71
73
|
if (!target?.closest('button'))
|
|
72
74
|
return;
|
|
73
75
|
const { sideBar } = _a.query(target);
|
|
@@ -12,9 +12,12 @@ export class SidebarView extends DialogBase {
|
|
|
12
12
|
static polyfillConnectedCallback(el) {
|
|
13
13
|
CleanupRegistry.register(el, onoff('click', SidebarView.#handleClick, el).on());
|
|
14
14
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (evt) => {
|
|
15
|
-
|
|
15
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
16
|
+
if (!target)
|
|
17
|
+
return true;
|
|
18
|
+
if (target.matches('[is=sidebar-view]'))
|
|
16
19
|
return false;
|
|
17
|
-
if (
|
|
20
|
+
if (target.closest('tool-bar-item'))
|
|
18
21
|
return false;
|
|
19
22
|
return true;
|
|
20
23
|
}), el).on());
|
|
@@ -23,7 +26,10 @@ export class SidebarView extends DialogBase {
|
|
|
23
26
|
/** Autoclose on click outside. */
|
|
24
27
|
static #handleClick = async (evt) => {
|
|
25
28
|
console.debug(`${SidebarView.name} ⚡️ ${evt?.type}`);
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
30
|
+
if (!target)
|
|
31
|
+
return;
|
|
32
|
+
if (target instanceof HTMLDialogElement && 'sidebar-view' === target.getAttribute('is'))
|
|
33
|
+
target.close?.();
|
|
28
34
|
};
|
|
29
35
|
}
|
|
@@ -14,7 +14,9 @@ export class StickyContainer extends HTMLElement {
|
|
|
14
14
|
CleanupRegistry.unregister(this);
|
|
15
15
|
}
|
|
16
16
|
#handleTransitionrun = ({ target, propertyName, pseudoElement }) => {
|
|
17
|
-
if (
|
|
17
|
+
if (!(target instanceof HTMLElement && target))
|
|
18
|
+
return;
|
|
19
|
+
if ('--stuck' !== propertyName || '::before' !== pseudoElement || !target.matches('sticky-container'))
|
|
18
20
|
return;
|
|
19
21
|
const stuck = self.getComputedStyle(this, 'before').getPropertyValue('--stuck');
|
|
20
22
|
this.toggleAttribute('stuck', '1' === stuck);
|
|
@@ -20,9 +20,12 @@ export class TabBar extends DialogBase {
|
|
|
20
20
|
// if (!r) return
|
|
21
21
|
CleanupRegistry.register(el, onoff('click', TabBar.#handleClick, el).on());
|
|
22
22
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (evt) => {
|
|
23
|
-
|
|
23
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
24
|
+
if (!target)
|
|
25
|
+
return true;
|
|
26
|
+
if (target.matches('[is=tab-bar]'))
|
|
24
27
|
return false;
|
|
25
|
-
if (
|
|
28
|
+
if (target.closest('tool-bar-item'))
|
|
26
29
|
return false;
|
|
27
30
|
return true;
|
|
28
31
|
}), el).on());
|
|
@@ -30,7 +33,10 @@ export class TabBar extends DialogBase {
|
|
|
30
33
|
}
|
|
31
34
|
static #handleClick = async (evt) => {
|
|
32
35
|
console.debug(`${TabBar.name} ⚡️ ${evt?.type}`);
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
37
|
+
if (!target)
|
|
38
|
+
return;
|
|
39
|
+
if (target instanceof HTMLDialogElement && 'tab-bar' === target.getAttribute('is'))
|
|
40
|
+
target.close?.();
|
|
35
41
|
};
|
|
36
42
|
}
|
|
@@ -63,7 +63,9 @@ export class TabItem extends ButtonBase {
|
|
|
63
63
|
};
|
|
64
64
|
static #handleClick = async (evt) => {
|
|
65
65
|
console.debug(`${TabItem.name} ⚡️ ${evt?.type}`);
|
|
66
|
-
const btn = evt.currentTarget;
|
|
66
|
+
const btn = evt.currentTarget instanceof HTMLElement && evt.currentTarget;
|
|
67
|
+
if (!btn)
|
|
68
|
+
return;
|
|
67
69
|
// const tag = btn.getAttribute('value')
|
|
68
70
|
// if (!tag) return // sidebartoggle > tab-item //throw new DOMException(`Attribute "tag" is set but invalid`, 'InvalidStateError')
|
|
69
71
|
const tv = btn.closest('tab-view');
|
|
@@ -73,7 +73,10 @@ export class TabView extends HTMLElement {
|
|
|
73
73
|
// })
|
|
74
74
|
}
|
|
75
75
|
#handleSummaryClick = (evt) => {
|
|
76
|
-
const
|
|
76
|
+
const target = evt.target instanceof HTMLElement && evt.target;
|
|
77
|
+
if (!target)
|
|
78
|
+
return;
|
|
79
|
+
const summary = target.closest('summary');
|
|
77
80
|
if (!summary)
|
|
78
81
|
return;
|
|
79
82
|
if (0 === $.siblings('[aria-selected=true]', summary).length)
|