@swiftwc/ui 0.0.0-dev.37 → 0.0.0-dev.39
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 +5 -3
- package/generated/components/alert-dialog.js +17 -9
- package/generated/components/body-view.js +5 -3
- package/generated/components/bordered-button.js +7 -4
- package/generated/components/bordered-prominent-button.js +7 -4
- package/generated/components/borderless-button.js +7 -4
- package/generated/components/confirmation-dialog.js +17 -9
- package/generated/components/content-unavailable-view.js +7 -4
- package/generated/components/date-picker.js +34 -23
- package/generated/components/disclosure-group.js +9 -5
- package/generated/components/fine-tooltip.js +7 -4
- package/generated/components/form-view.js +5 -3
- package/generated/components/glass-button.js +7 -4
- package/generated/components/glass-prominent-button.js +7 -4
- package/generated/components/label-view.js +7 -4
- package/generated/components/list-view.js +5 -3
- package/generated/components/menu-view.js +19 -10
- package/generated/components/navigation-large-title.js +9 -5
- package/generated/components/navigation-split-view.js +7 -4
- package/generated/components/navigation-stack.js +7 -4
- package/generated/components/navigation-title.js +7 -4
- package/generated/components/picker-view.d.ts +1 -0
- package/generated/components/picker-view.js +185 -83
- package/generated/components/plain-button.js +5 -3
- package/generated/components/progress-view.js +11 -8
- package/generated/components/screen-view.js +3 -2
- package/generated/components/scroll-view-proxy.js +5 -3
- package/generated/components/scroll-view.js +17 -9
- package/generated/components/search-view.js +7 -4
- package/generated/components/section-view.js +7 -5
- package/generated/components/sheet-view.js +11 -6
- package/generated/components/sidebar-toggle.js +9 -5
- package/generated/components/sidebar-view.js +3 -2
- package/generated/components/sticky-container.js +5 -3
- package/generated/components/tab-bar.js +7 -4
- package/generated/components/tab-item.js +15 -8
- package/generated/components/tab-view.js +14 -8
- package/generated/components/table-view.js +13 -8
- package/generated/components/text-field.js +27 -17
- package/generated/components/tool-bar-item-group.js +5 -3
- package/generated/components/tool-bar-item.js +7 -4
- package/generated/components/tool-bar.js +7 -4
- package/generated/components/v-keyboard.js +9 -5
- package/generated/components/v-stack.js +5 -3
- package/generated/css/index.css +6 -2
- package/generated/events/picker-view.d.ts +1 -0
- package/generated/internal/class/css-style-observer.js +3 -2
- package/generated/internal/class/form-associated-base.js +7 -5
- package/generated/internal/class/navigation-view.js +5 -3
- package/generated/internal/decorators/adaptive-slot.js +7 -4
- package/generated/internal/privateNamespace.js +22 -13
- package/generated/internal/utils/dev-flags.d.ts +3 -0
- package/generated/internal/utils/dev-flags.js +5 -0
- package/generated/internal/utils/index.d.ts +1 -1
- package/generated/internal/utils/index.js +1 -1
- package/generated/snapshot/index.js +5 -3
- package/package.json +1 -1
- package/scss/base/_layout.scss +6 -7
- package/generated/internal/utils/debug.d.ts +0 -1
- package/generated/internal/utils/debug.js +0 -3
|
@@ -3,7 +3,7 @@ import * as Components from '../components';
|
|
|
3
3
|
import { I18n } from '../i18n';
|
|
4
4
|
import { NavigationPath } from '../internal/class/navigation-path';
|
|
5
5
|
import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
|
|
6
|
-
import { $,
|
|
6
|
+
import { $, devFlags, kebabCase, onoff } from '../internal/utils';
|
|
7
7
|
import { Snapshot } from '../snapshot';
|
|
8
8
|
//#region polyfills
|
|
9
9
|
export const polyfills = new Map();
|
|
@@ -25,7 +25,8 @@ for (const [k, Ctor] of Object.entries(Components)) {
|
|
|
25
25
|
if (!customElements.get(is))
|
|
26
26
|
customElements.define(is, Ctor);
|
|
27
27
|
}
|
|
28
|
-
debug
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(polyfills);
|
|
29
30
|
if (0 < polyfills.size) {
|
|
30
31
|
const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
|
|
31
32
|
const handlers = new WeakMap();
|
|
@@ -55,7 +56,8 @@ if (0 < polyfills.size) {
|
|
|
55
56
|
}, unobserve = (el) => {
|
|
56
57
|
handlers.delete(el);
|
|
57
58
|
}, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
|
|
58
|
-
debug
|
|
59
|
+
if (devFlags.debug)
|
|
60
|
+
console.debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
|
|
59
61
|
for (const [is, polyfill] of polyfills)
|
|
60
62
|
for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
|
|
61
63
|
polyfill.polyfillConnectedCallback(el);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { alertDialog } from '../buses';
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import {
|
|
3
|
+
import { devFlags, onoff, touchGlass } from '../internal/utils';
|
|
4
4
|
import { DialogBase } from '../namespace-browser/base';
|
|
5
5
|
export class AlertDialog extends DialogBase {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
}
|
|
9
9
|
static polyfillDisconnectedCallback(el) {
|
|
10
|
-
|
|
10
|
+
if (devFlags.debug)
|
|
11
|
+
console.debug(`${AlertDialog.name} ⚡️ disconnect`);
|
|
11
12
|
CleanupRegistry.unregister(el);
|
|
12
13
|
alertDialog.dispatchEvent(new CustomEvent('alert:return', {
|
|
13
14
|
detail: { returnValue: el.returnValue },
|
|
@@ -16,7 +17,8 @@ export class AlertDialog extends DialogBase {
|
|
|
16
17
|
}));
|
|
17
18
|
}
|
|
18
19
|
static polyfillConnectedCallback(el) {
|
|
19
|
-
|
|
20
|
+
if (devFlags.debug)
|
|
21
|
+
console.debug(`${AlertDialog.name} ⚡️ connect`);
|
|
20
22
|
CleanupRegistry.register(el, onoff([
|
|
21
23
|
{ types: 'click', listener: this.#handleDialogClick },
|
|
22
24
|
{ types: 'close', listener: this.#handleDialogClose },
|
|
@@ -29,7 +31,8 @@ export class AlertDialog extends DialogBase {
|
|
|
29
31
|
return false;
|
|
30
32
|
return true;
|
|
31
33
|
}), el).on());
|
|
32
|
-
|
|
34
|
+
if (devFlags.debug)
|
|
35
|
+
console.debug(`${AlertDialog.name} ⚡️ will-open`);
|
|
33
36
|
el.removeAttribute('closing');
|
|
34
37
|
el.scrollTop = 0;
|
|
35
38
|
el.returnValue = '';
|
|
@@ -37,7 +40,8 @@ export class AlertDialog extends DialogBase {
|
|
|
37
40
|
el.showModal();
|
|
38
41
|
}
|
|
39
42
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
40
|
-
|
|
43
|
+
if (devFlags.debug)
|
|
44
|
+
console.debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
41
45
|
switch (attributeName) {
|
|
42
46
|
case 'label':
|
|
43
47
|
//
|
|
@@ -45,7 +49,8 @@ export class AlertDialog extends DialogBase {
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
static #handleDialogClick = (evt) => {
|
|
48
|
-
|
|
52
|
+
if (devFlags.debug)
|
|
53
|
+
console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
49
54
|
const { target, currentTarget: dialog } = evt;
|
|
50
55
|
if (!(dialog instanceof HTMLDialogElement && dialog))
|
|
51
56
|
return;
|
|
@@ -65,7 +70,8 @@ export class AlertDialog extends DialogBase {
|
|
|
65
70
|
evt.stopImmediatePropagation();
|
|
66
71
|
};
|
|
67
72
|
static #handleDialogCancel = (evt) => {
|
|
68
|
-
|
|
73
|
+
if (devFlags.debug)
|
|
74
|
+
console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
|
|
69
75
|
if (!evt.cancelable)
|
|
70
76
|
return;
|
|
71
77
|
const { target } = evt;
|
|
@@ -73,7 +79,8 @@ export class AlertDialog extends DialogBase {
|
|
|
73
79
|
return;
|
|
74
80
|
evt.preventDefault();
|
|
75
81
|
target.inert = true;
|
|
76
|
-
|
|
82
|
+
if (devFlags.debug)
|
|
83
|
+
console.debug(`${AlertDialog.name} ⚡️ will-close`);
|
|
77
84
|
target.setAttribute('closing', '');
|
|
78
85
|
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
79
86
|
if (!target.hasAttribute('closing'))
|
|
@@ -83,7 +90,8 @@ export class AlertDialog extends DialogBase {
|
|
|
83
90
|
});
|
|
84
91
|
};
|
|
85
92
|
static #handleDialogClose = ({ type, target }) => {
|
|
86
|
-
|
|
93
|
+
if (devFlags.debug)
|
|
94
|
+
console.debug(`${AlertDialog.name} ⚡️ ${type}`);
|
|
87
95
|
if (!(target instanceof HTMLDialogElement && target))
|
|
88
96
|
return;
|
|
89
97
|
target.remove();
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { devFlags } from '../internal/utils';
|
|
2
2
|
export class BodyView extends HTMLElement {
|
|
3
3
|
constructor() {
|
|
4
4
|
super();
|
|
5
5
|
}
|
|
6
6
|
disconnectedCallback() {
|
|
7
|
-
|
|
7
|
+
if (devFlags.debug)
|
|
8
|
+
console.debug(`${BodyView.name} ⚡️ disconnect`);
|
|
8
9
|
}
|
|
9
10
|
connectedCallback() {
|
|
10
|
-
|
|
11
|
+
if (devFlags.debug)
|
|
12
|
+
console.debug(`${BodyView.name} ⚡️ connect`);
|
|
11
13
|
}
|
|
12
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
@@ -14,16 +14,19 @@ export class BorderedButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${BorderedButton.name} ⚡️ disconnect`);
|
|
18
19
|
CleanupRegistry.unregister(el);
|
|
19
20
|
}
|
|
20
21
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${BorderedButton.name} ⚡️ connect`);
|
|
22
24
|
el.tabIndex = 0;
|
|
23
25
|
CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
|
|
24
26
|
}
|
|
25
27
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
30
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
31
|
if (!node)
|
|
29
32
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
@@ -14,16 +14,19 @@ export class BorderedProminentButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
|
|
18
19
|
CleanupRegistry.unregister(el);
|
|
19
20
|
}
|
|
20
21
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
|
|
22
24
|
el.tabIndex = 0;
|
|
23
25
|
CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
|
|
24
26
|
}
|
|
25
27
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
30
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
31
|
if (!node)
|
|
29
32
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
@@ -14,16 +14,19 @@ export class BorderlessButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
|
|
18
19
|
CleanupRegistry.unregister(el);
|
|
19
20
|
}
|
|
20
21
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${BorderlessButton.name} ⚡️ connect`);
|
|
22
24
|
el.tabIndex = 0;
|
|
23
25
|
CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
|
|
24
26
|
}
|
|
25
27
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
30
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
31
|
if (!node)
|
|
29
32
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { confirmationDialog } from '../buses';
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import {
|
|
3
|
+
import { devFlags, isInside, onoff, touchGlass } from '../internal/utils';
|
|
4
4
|
import { DialogBase } from '../namespace-browser/base';
|
|
5
5
|
export class ConfirmationDialog extends DialogBase {
|
|
6
6
|
static get observedAttributes() {
|
|
@@ -10,7 +10,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
10
10
|
super();
|
|
11
11
|
}
|
|
12
12
|
static polyfillDisconnectedCallback(el) {
|
|
13
|
-
|
|
13
|
+
if (devFlags.debug)
|
|
14
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
|
|
14
15
|
const positionAnchor = el.style.getPropertyValue('position-anchor');
|
|
15
16
|
document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
|
|
16
17
|
el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
|
|
@@ -22,7 +23,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
22
23
|
}));
|
|
23
24
|
}
|
|
24
25
|
static polyfillConnectedCallback(el) {
|
|
25
|
-
|
|
26
|
+
if (devFlags.debug)
|
|
27
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ connect`);
|
|
26
28
|
CleanupRegistry.register(el, onoff([
|
|
27
29
|
{ types: 'click', listener: this.#handleDialogClick },
|
|
28
30
|
{ types: 'close', listener: this.#handleDialogClose },
|
|
@@ -36,7 +38,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
36
38
|
// if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
|
|
37
39
|
return true;
|
|
38
40
|
}), el).on());
|
|
39
|
-
|
|
41
|
+
if (devFlags.debug)
|
|
42
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ will-open`);
|
|
40
43
|
el.removeAttribute('closing');
|
|
41
44
|
el.scrollTop = 0;
|
|
42
45
|
el.returnValue = '';
|
|
@@ -44,7 +47,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
44
47
|
el.showModal();
|
|
45
48
|
}
|
|
46
49
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
47
|
-
|
|
50
|
+
if (devFlags.debug)
|
|
51
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
48
52
|
// const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
|
|
49
53
|
switch (attributeName) {
|
|
50
54
|
case 'label':
|
|
@@ -57,7 +61,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
static #handleDialogClick = (evt) => {
|
|
60
|
-
|
|
64
|
+
if (devFlags.debug)
|
|
65
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
61
66
|
const { target, currentTarget: dialog } = evt;
|
|
62
67
|
if (!(dialog instanceof HTMLDialogElement && dialog))
|
|
63
68
|
return;
|
|
@@ -79,7 +84,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
79
84
|
evt.stopImmediatePropagation();
|
|
80
85
|
};
|
|
81
86
|
static #handleDialogCancel = (evt) => {
|
|
82
|
-
|
|
87
|
+
if (devFlags.debug)
|
|
88
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
|
|
83
89
|
if (!evt.cancelable)
|
|
84
90
|
return;
|
|
85
91
|
const { target } = evt;
|
|
@@ -87,7 +93,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
87
93
|
return;
|
|
88
94
|
evt.preventDefault();
|
|
89
95
|
target.inert = true;
|
|
90
|
-
|
|
96
|
+
if (devFlags.debug)
|
|
97
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ will-close`);
|
|
91
98
|
target.setAttribute('closing', '');
|
|
92
99
|
Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
|
|
93
100
|
if (!target.hasAttribute('closing'))
|
|
@@ -97,7 +104,8 @@ export class ConfirmationDialog extends DialogBase {
|
|
|
97
104
|
});
|
|
98
105
|
};
|
|
99
106
|
static #handleDialogClose = ({ type, target }) => {
|
|
100
|
-
|
|
107
|
+
if (devFlags.debug)
|
|
108
|
+
console.debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
|
|
101
109
|
if (!(target instanceof HTMLDialogElement && target))
|
|
102
110
|
return;
|
|
103
111
|
target.remove();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { I18n } from '../i18n';
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { $,
|
|
3
|
+
import { $, devFlags, onoff } from '../internal/utils';
|
|
4
4
|
/**
|
|
5
5
|
* @summary A message with a title and extra information that you show when part of your app can’t be used.
|
|
6
6
|
*
|
|
@@ -46,13 +46,16 @@ export class ContentUnavailableView extends HTMLElement {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
disconnectedCallback() {
|
|
49
|
-
|
|
49
|
+
if (devFlags.debug)
|
|
50
|
+
console.debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
|
|
50
51
|
}
|
|
51
52
|
connectedCallback() {
|
|
52
|
-
|
|
53
|
+
if (devFlags.debug)
|
|
54
|
+
console.debug(`${ContentUnavailableView.name} ⚡️ connect`);
|
|
53
55
|
}
|
|
54
56
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
55
|
-
|
|
57
|
+
if (devFlags.debug)
|
|
58
|
+
console.debug(`${ContentUnavailableView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
56
59
|
switch (name) {
|
|
57
60
|
case 'search':
|
|
58
61
|
if (oldValue === newValue)
|
|
@@ -3,7 +3,7 @@ import { I18n } from '../i18n';
|
|
|
3
3
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
4
4
|
import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
|
|
5
5
|
import { MutationObserverSet } from '../internal/class/mutation-observer-set';
|
|
6
|
-
import { $, clamp,
|
|
6
|
+
import { $, clamp, devFlags, kebabCase, onoff, set } from '../internal/utils';
|
|
7
7
|
const datePickerStyles = ['graphical', 'field', 'automatic'];
|
|
8
8
|
export class DatePicker extends FormAssociatedBase {
|
|
9
9
|
static get observedAttributes() {
|
|
@@ -26,7 +26,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
26
26
|
static #templates = new Map();
|
|
27
27
|
// #lastRenderedStyle?: DatePickerStyle //string | null
|
|
28
28
|
#renderValidityMsgs = (entries) => {
|
|
29
|
-
|
|
29
|
+
if (devFlags.debug)
|
|
30
|
+
console.debug(`${_a.name} ⚡️ mutation`);
|
|
30
31
|
this.setValidity(this.validity, this.validationMessage);
|
|
31
32
|
};
|
|
32
33
|
#shadowRoot;
|
|
@@ -83,11 +84,12 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
83
84
|
this.#validityObservers.unobserveAll();
|
|
84
85
|
}
|
|
85
86
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
86
|
-
|
|
87
|
+
if (devFlags.debug)
|
|
88
|
+
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
87
89
|
switch (name) {
|
|
88
90
|
case 'selection':
|
|
89
|
-
const [y = '', m = '', d = ''] = (newValue ?? '').split(/\D+/)
|
|
90
|
-
this.#selectedDate = { year: y, month: m, day: d }
|
|
91
|
+
// nothing happens// const [y = '', m = '', d = ''] = (newValue ?? '').split(/\D+/)
|
|
92
|
+
// this.#selectedDate = { year: y, month: m, day: d }
|
|
91
93
|
break;
|
|
92
94
|
case 'required':
|
|
93
95
|
for (const input of this.#inputs)
|
|
@@ -105,14 +107,15 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
105
107
|
input.setAttribute('placeholder', map[input.name] ?? '');
|
|
106
108
|
break;
|
|
107
109
|
case 'label':
|
|
108
|
-
let label = this.querySelector(':scope>[slot=label]');
|
|
110
|
+
let label = this.querySelector(':scope>label-view[slot=label]');
|
|
109
111
|
if (newValue) {
|
|
110
|
-
label ??= this.appendChild($(`<
|
|
111
|
-
label.
|
|
112
|
+
label ??= this.appendChild($(`<label-view slot="label"></label-view>`, '>1'));
|
|
113
|
+
label.setAttribute('foreground', 'secondary');
|
|
114
|
+
label.setAttribute('title', newValue);
|
|
112
115
|
}
|
|
113
116
|
else
|
|
114
117
|
label?.remove();
|
|
115
|
-
this.#sendValueToForm()
|
|
118
|
+
// this.#sendValueToForm()
|
|
116
119
|
break;
|
|
117
120
|
case 'disabled':
|
|
118
121
|
for (const input of this.#inputs)
|
|
@@ -124,9 +127,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
124
127
|
return datePickerStyles.includes(this.getAttribute('date-picker-style') ?? '') ? this.getAttribute('date-picker-style') : 'automatic';
|
|
125
128
|
}
|
|
126
129
|
#render() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return;
|
|
130
|
+
if (devFlags.debug)
|
|
131
|
+
console.debug(`${_a.name} ⚡️ render (${this.datePickerStyle})`);
|
|
130
132
|
// if (this.#lastRenderedStyle === this.datePickerStyle) return // skip if already applied
|
|
131
133
|
// this.#lastRenderedStyle = this.datePickerStyle
|
|
132
134
|
// clear shadow DOM
|
|
@@ -170,13 +172,14 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
173
|
-
|
|
175
|
+
if (devFlags.debug)
|
|
176
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
174
177
|
if (!(slot instanceof HTMLSlotElement && slot))
|
|
175
178
|
return;
|
|
176
179
|
const assigned = slot.assignedElements();
|
|
177
180
|
this.#validityObservers.syncObservations(assigned, ['value', 'label']);
|
|
178
|
-
if (0 < assigned.length)
|
|
179
|
-
|
|
181
|
+
// if (0 < assigned.length)
|
|
182
|
+
this.#renderValidityMsgs([]);
|
|
180
183
|
};
|
|
181
184
|
get #selectedDate() {
|
|
182
185
|
const map = Object.fromEntries(this.#inputs.map(({ name, value }) => [name, value]));
|
|
@@ -198,7 +201,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
198
201
|
}
|
|
199
202
|
}
|
|
200
203
|
#handleClick = (evt) => {
|
|
201
|
-
|
|
204
|
+
if (devFlags.debug)
|
|
205
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
202
206
|
const { target } = evt;
|
|
203
207
|
if (!(target instanceof HTMLElement && target))
|
|
204
208
|
return;
|
|
@@ -241,7 +245,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
241
245
|
this.dispatchEvent(new CustomEvent('selection', { detail: { selection }, bubbles: true, composed: true }));
|
|
242
246
|
};
|
|
243
247
|
#handleInputPaste = (evt) => {
|
|
244
|
-
|
|
248
|
+
if (devFlags.debug)
|
|
249
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
245
250
|
const { target: input } = evt;
|
|
246
251
|
if (!(input instanceof HTMLInputElement && input))
|
|
247
252
|
return;
|
|
@@ -263,7 +268,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
263
268
|
this.#sendValueToForm();
|
|
264
269
|
};
|
|
265
270
|
#handleInputBeforeinput = (evt) => {
|
|
266
|
-
|
|
271
|
+
if (devFlags.debug)
|
|
272
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
267
273
|
const { target: input } = evt;
|
|
268
274
|
if (!(input instanceof HTMLInputElement && input))
|
|
269
275
|
return;
|
|
@@ -286,7 +292,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
286
292
|
}
|
|
287
293
|
};
|
|
288
294
|
#handleInputKeydown = ({ type, target, key }) => {
|
|
289
|
-
|
|
295
|
+
if (devFlags.debug)
|
|
296
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
290
297
|
if (!(target instanceof HTMLInputElement && target))
|
|
291
298
|
return;
|
|
292
299
|
const input = target;
|
|
@@ -305,12 +312,14 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
305
312
|
this.#inputs[index]?.focus();
|
|
306
313
|
};
|
|
307
314
|
#handleInputFocus = (evt) => {
|
|
308
|
-
|
|
315
|
+
if (devFlags.debug)
|
|
316
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
309
317
|
for (const input of this.#inputs)
|
|
310
318
|
input.classList.toggle('focus', input === evt.target);
|
|
311
319
|
};
|
|
312
320
|
#handleInputBlur = ({ target, type }) => {
|
|
313
|
-
|
|
321
|
+
if (devFlags.debug)
|
|
322
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
314
323
|
if (!(target instanceof HTMLInputElement && target))
|
|
315
324
|
return;
|
|
316
325
|
const input = target;
|
|
@@ -323,7 +332,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
323
332
|
this.#sendValueToForm();
|
|
324
333
|
};
|
|
325
334
|
#handleInputInput = (evt) => {
|
|
326
|
-
|
|
335
|
+
if (devFlags.debug)
|
|
336
|
+
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
327
337
|
this.#sendValueToForm();
|
|
328
338
|
};
|
|
329
339
|
// Optional: form participation properties
|
|
@@ -428,7 +438,8 @@ export class DatePicker extends FormAssociatedBase {
|
|
|
428
438
|
message = kebabCase(key);
|
|
429
439
|
break;
|
|
430
440
|
}
|
|
431
|
-
|
|
441
|
+
if (devFlags.debug)
|
|
442
|
+
console.debug(`${_a.name} ⚡️ validity-change`);
|
|
432
443
|
return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#inputs.at(0));
|
|
433
444
|
};
|
|
434
445
|
setCustomValidity = (message) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import { cssTime,
|
|
2
|
+
import { cssTime, devFlags, onoff, timeout } from '../internal/utils';
|
|
3
3
|
import { DetailsBase } from '../namespace-browser/base';
|
|
4
4
|
const toggleTimers = new WeakMap();
|
|
5
5
|
export class DisclosureGroup extends DetailsBase {
|
|
@@ -15,15 +15,18 @@ export class DisclosureGroup extends DetailsBase {
|
|
|
15
15
|
super();
|
|
16
16
|
}
|
|
17
17
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
18
|
-
|
|
18
|
+
if (devFlags.debug)
|
|
19
|
+
console.debug(`${DisclosureGroup.name} ⚡️ attr-change [${name}]`);
|
|
19
20
|
// if (CSS.supports('interpolate-size', 'allow-keywords')) return
|
|
20
21
|
}
|
|
21
22
|
static polyfillDisconnectedCallback(el) {
|
|
22
|
-
|
|
23
|
+
if (devFlags.debug)
|
|
24
|
+
console.debug(`${DisclosureGroup.name} ⚡️ disconnect`);
|
|
23
25
|
CleanupRegistry.unregister(el);
|
|
24
26
|
}
|
|
25
27
|
static polyfillConnectedCallback(el) {
|
|
26
|
-
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${DisclosureGroup.name} ⚡️ connect`);
|
|
27
30
|
const newValue = el.open ? 'open' : 'closed';
|
|
28
31
|
if (newValue !== el.dataset.state)
|
|
29
32
|
el.dataset.state = newValue;
|
|
@@ -34,7 +37,8 @@ export class DisclosureGroup extends DetailsBase {
|
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
static #handleToggle = async (evt) => {
|
|
37
|
-
|
|
40
|
+
if (devFlags.debug)
|
|
41
|
+
console.debug(`${DisclosureGroup.name} ⚡️ ${evt?.type}`);
|
|
38
42
|
const details = evt.currentTarget instanceof HTMLDetailsElement && evt.currentTarget;
|
|
39
43
|
if (!details)
|
|
40
44
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
3
|
-
import { $,
|
|
3
|
+
import { $, devFlags, onoff } from '../internal/utils';
|
|
4
4
|
export class FineTooltip extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
@@ -16,7 +16,8 @@ export class FineTooltip extends HTMLElement {
|
|
|
16
16
|
this.#render(target.getAttribute(attributeName));
|
|
17
17
|
};
|
|
18
18
|
#handleMeasure = ([{ target, borderBoxSize }]) => {
|
|
19
|
-
|
|
19
|
+
if (devFlags.debug)
|
|
20
|
+
console.debug(`${_a.name} ⚡️ measure`);
|
|
20
21
|
if (target.hasAttribute('closing'))
|
|
21
22
|
return;
|
|
22
23
|
if (!(target instanceof HTMLElement && target))
|
|
@@ -46,7 +47,8 @@ export class FineTooltip extends HTMLElement {
|
|
|
46
47
|
label.removeAttribute('title');
|
|
47
48
|
};
|
|
48
49
|
connectedCallback() {
|
|
49
|
-
|
|
50
|
+
if (devFlags.debug)
|
|
51
|
+
console.debug(`${_a.name} ⚡️ connect`);
|
|
50
52
|
this.removeAttribute('closing');
|
|
51
53
|
this.popover = 'manual';
|
|
52
54
|
this.inert = true;
|
|
@@ -55,7 +57,8 @@ export class FineTooltip extends HTMLElement {
|
|
|
55
57
|
this.showPopover();
|
|
56
58
|
}
|
|
57
59
|
disconnectedCallback() {
|
|
58
|
-
|
|
60
|
+
if (devFlags.debug)
|
|
61
|
+
console.debug(`${_a.name} ⚡️ disconnect`);
|
|
59
62
|
this.#resizeObserver.unobserve(this);
|
|
60
63
|
this.#mutationObserver?.disconnect();
|
|
61
64
|
this.#mutationObserver2?.disconnect();
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
2
|
+
import { devFlags, listActive, onoff } from '../internal/utils';
|
|
3
3
|
import { FormBase } from '../namespace-browser/base';
|
|
4
4
|
export class FormView extends FormBase {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
}
|
|
8
8
|
static polyfillDisconnectedCallback(el) {
|
|
9
|
-
|
|
9
|
+
if (devFlags.debug)
|
|
10
|
+
console.debug(`${FormView.name} ⚡️ disconnect`);
|
|
10
11
|
// finally
|
|
11
12
|
CleanupRegistry.unregister(el);
|
|
12
13
|
}
|
|
13
14
|
static polyfillConnectedCallback(el) {
|
|
14
|
-
|
|
15
|
+
if (devFlags.debug)
|
|
16
|
+
console.debug(`${FormView.name} ⚡️ connect`);
|
|
15
17
|
if (el.closest('[is=sidebar-view],[is=tab-bar]')) {
|
|
16
18
|
el.method = 'dialog';
|
|
17
19
|
el.noValidate = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CleanupRegistry } from '../internal/class/cleanup-registry';
|
|
2
|
-
import {
|
|
2
|
+
import { devFlags, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
|
|
3
3
|
import { ButtonBase } from '../namespace-browser/base';
|
|
4
4
|
import { Snapshot } from '../snapshot';
|
|
5
5
|
/**
|
|
@@ -14,16 +14,19 @@ export class GlassButton extends ButtonBase {
|
|
|
14
14
|
super();
|
|
15
15
|
}
|
|
16
16
|
static polyfillDisconnectedCallback(el) {
|
|
17
|
-
|
|
17
|
+
if (devFlags.debug)
|
|
18
|
+
console.debug(`${GlassButton.name} ⚡️ disconnect`);
|
|
18
19
|
CleanupRegistry.unregister(el);
|
|
19
20
|
}
|
|
20
21
|
static polyfillConnectedCallback(el) {
|
|
21
|
-
|
|
22
|
+
if (devFlags.debug)
|
|
23
|
+
console.debug(`${GlassButton.name} ⚡️ connect`);
|
|
22
24
|
CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
|
|
23
25
|
el.tabIndex = 0;
|
|
24
26
|
}
|
|
25
27
|
static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
|
|
26
|
-
|
|
28
|
+
if (devFlags.debug)
|
|
29
|
+
console.debug(`${GlassButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
|
|
27
30
|
const node = target instanceof HTMLButtonElement && target;
|
|
28
31
|
if (!node)
|
|
29
32
|
return;
|