@swiftwc/ui 0.0.0-dev.45 → 0.0.0-dev.47
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 +4 -4
- package/generated/components/alert-dialog.js +5 -5
- package/generated/components/bordered-button.js +1 -1
- package/generated/components/bordered-prominent-button.js +1 -1
- package/generated/components/borderless-button.js +1 -1
- package/generated/components/confirmation-dialog.js +5 -5
- package/generated/components/content-unavailable-view.d.ts +1 -1
- package/generated/components/content-unavailable-view.js +8 -8
- package/generated/components/date-picker.d.ts +2 -2
- package/generated/components/date-picker.js +24 -24
- package/generated/components/disclosure-group.js +3 -4
- package/generated/components/fine-tooltip.js +2 -2
- package/generated/components/glass-button.js +1 -1
- package/generated/components/glass-prominent-button.js +1 -1
- package/generated/components/label-view.d.ts +1 -1
- package/generated/components/label-view.js +8 -8
- package/generated/components/menu-view.d.ts +1 -1
- package/generated/components/menu-view.js +40 -40
- package/generated/components/navigation-split-view.d.ts +1 -1
- package/generated/components/navigation-split-view.js +5 -5
- package/generated/components/navigation-stack.d.ts +1 -1
- package/generated/components/navigation-stack.js +10 -10
- package/generated/components/navigation-title.d.ts +1 -1
- package/generated/components/navigation-title.js +31 -25
- package/generated/components/picker-view.d.ts +2 -2
- package/generated/components/picker-view.js +35 -35
- package/generated/components/progress-view.d.ts +1 -1
- package/generated/components/progress-view.js +15 -15
- package/generated/components/scroll-view.d.ts +1 -1
- package/generated/components/scroll-view.js +60 -59
- package/generated/components/search-view.js +1 -1
- package/generated/components/section-view.d.ts +1 -1
- package/generated/components/section-view.js +23 -23
- package/generated/components/sidebar-toggle.js +2 -2
- package/generated/components/sidebar-view.js +2 -2
- package/generated/components/sticky-container.js +1 -1
- package/generated/components/tab-bar.js +2 -2
- package/generated/components/tab-item.js +3 -4
- package/generated/components/tab-view.js +1 -1
- package/generated/components/table-view.js +2 -2
- package/generated/components/text-field.d.ts +2 -2
- package/generated/components/text-field.js +16 -16
- package/generated/components/tool-bar-item.d.ts +1 -1
- package/generated/components/tool-bar-item.js +18 -18
- package/generated/css/index.css +1 -0
- package/generated/internal/class/navigation-view.d.ts +1 -1
- package/generated/internal/class/navigation-view.js +32 -39
- package/generated/internal/decorators/index.d.ts +2 -0
- package/generated/internal/decorators/index.js +2 -0
- package/generated/internal/decorators/microtask-on-connected.d.ts +39 -0
- package/generated/internal/decorators/microtask-on-connected.js +67 -0
- package/generated/internal/utils/list-active.js +5 -5
- package/generated/namespace-browser/base.d.ts +5 -5
- package/generated/namespace-browser/base.js +32 -32
- package/package.json +1 -1
- package/scss/components/_fine-tooltip.scss +2 -0
- package/web-components.html-data/en.json +1 -0
|
@@ -10,9 +10,9 @@ export declare class TextField extends FormAssociatedBase {
|
|
|
10
10
|
static get observedAttributes(): string[];
|
|
11
11
|
static get template(): DocumentFragment;
|
|
12
12
|
constructor();
|
|
13
|
-
connectedCallback(): void;
|
|
14
|
-
disconnectedCallback(): void;
|
|
15
13
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
connectedCallback(): void;
|
|
16
16
|
get keyboardType(): KeyboardType;
|
|
17
17
|
get text(): string;
|
|
18
18
|
set text(v: string);
|
|
@@ -64,18 +64,6 @@ export class TextField extends FormAssociatedBase {
|
|
|
64
64
|
this.text = this.text;
|
|
65
65
|
}, I18n.on).on());
|
|
66
66
|
}
|
|
67
|
-
connectedCallback() {
|
|
68
|
-
super.connectedCallback();
|
|
69
|
-
// finally
|
|
70
|
-
if (!this.hasAttribute('text'))
|
|
71
|
-
return;
|
|
72
|
-
this.text = this.getAttribute('text') ?? ''; // this.#input.value = this.getAttribute('text') ?? ''
|
|
73
|
-
this.#sendValueToForm(false);
|
|
74
|
-
}
|
|
75
|
-
disconnectedCallback() {
|
|
76
|
-
super.disconnectedCallback();
|
|
77
|
-
this.#validityObservers.unobserveAll();
|
|
78
|
-
}
|
|
79
67
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
80
68
|
if (devFlags.debug)
|
|
81
69
|
console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
@@ -181,6 +169,18 @@ export class TextField extends FormAssociatedBase {
|
|
|
181
169
|
break;
|
|
182
170
|
}
|
|
183
171
|
}
|
|
172
|
+
disconnectedCallback() {
|
|
173
|
+
super.disconnectedCallback();
|
|
174
|
+
this.#validityObservers.unobserveAll();
|
|
175
|
+
}
|
|
176
|
+
connectedCallback() {
|
|
177
|
+
super.connectedCallback();
|
|
178
|
+
// finally
|
|
179
|
+
if (!this.hasAttribute('text'))
|
|
180
|
+
return;
|
|
181
|
+
this.text = this.getAttribute('text') ?? ''; // this.#input.value = this.getAttribute('text') ?? ''
|
|
182
|
+
this.#sendValueToForm(false);
|
|
183
|
+
}
|
|
184
184
|
get keyboardType() {
|
|
185
185
|
return keyboardTypes.includes(this.getAttribute('keyboard-type') ?? '') ? this.getAttribute('keyboard-type') : 'default';
|
|
186
186
|
}
|
|
@@ -202,7 +202,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
202
202
|
#handleValiditiesSlotchange = ({ type, target: slot }) => {
|
|
203
203
|
if (devFlags.debug)
|
|
204
204
|
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
205
|
-
if (!(slot instanceof HTMLSlotElement
|
|
205
|
+
if (!(slot instanceof HTMLSlotElement))
|
|
206
206
|
return;
|
|
207
207
|
const assigned = slot.assignedElements();
|
|
208
208
|
this.#validityObservers.syncObservations(assigned, ['value', 'label']);
|
|
@@ -245,7 +245,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
245
245
|
if (devFlags.debug)
|
|
246
246
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
247
247
|
const { target: input } = evt;
|
|
248
|
-
if (!(input instanceof HTMLInputElement
|
|
248
|
+
if (!(input instanceof HTMLInputElement))
|
|
249
249
|
return;
|
|
250
250
|
evt.preventDefault();
|
|
251
251
|
const data = this.#identity(evt.clipboardData?.getData('text') ?? ''); // number is now sanitized but contains edge cases like '+' and also global one separator that could be wither dot or decimal.
|
|
@@ -349,7 +349,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
349
349
|
if (devFlags.debug)
|
|
350
350
|
console.debug(`${_a.name} ⚡️ ${evt?.type}`);
|
|
351
351
|
const { target: input } = evt;
|
|
352
|
-
if (!(input instanceof HTMLInputElement
|
|
352
|
+
if (!(input instanceof HTMLInputElement))
|
|
353
353
|
return;
|
|
354
354
|
if ('insertText' !== evt.inputType)
|
|
355
355
|
return;
|
|
@@ -384,7 +384,7 @@ export class TextField extends FormAssociatedBase {
|
|
|
384
384
|
#handleInputBlur = ({ type, target: input }) => {
|
|
385
385
|
if (devFlags.debug)
|
|
386
386
|
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
387
|
-
if (!(input instanceof HTMLInputElement
|
|
387
|
+
if (!(input instanceof HTMLInputElement))
|
|
388
388
|
return;
|
|
389
389
|
if (0 === input.value.length)
|
|
390
390
|
return;
|
|
@@ -2,7 +2,7 @@ export declare class ToolBarItem extends HTMLElement {
|
|
|
2
2
|
#private;
|
|
3
3
|
static get observedAttributes(): string[];
|
|
4
4
|
constructor();
|
|
5
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
5
6
|
disconnectedCallback(): void;
|
|
6
7
|
connectedCallback(): void;
|
|
7
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
8
8
|
}
|
|
@@ -17,23 +17,6 @@ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
super();
|
|
19
19
|
}
|
|
20
|
-
disconnectedCallback() {
|
|
21
|
-
if (devFlags.debug)
|
|
22
|
-
console.debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
|
|
23
|
-
this.#mutationObserver?.disconnect();
|
|
24
|
-
CleanupRegistry.unregister(this);
|
|
25
|
-
}
|
|
26
|
-
connectedCallback() {
|
|
27
|
-
if (devFlags.debug)
|
|
28
|
-
console.debug(`${ToolBarItem_1.name} ⚡️ connect`);
|
|
29
|
-
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, ({ target }) => {
|
|
30
|
-
if (!(target instanceof HTMLElement && target))
|
|
31
|
-
return true;
|
|
32
|
-
if (target.closest('menu-view[open]'))
|
|
33
|
-
return false;
|
|
34
|
-
return true;
|
|
35
|
-
}), this).on());
|
|
36
|
-
}
|
|
37
20
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
38
21
|
if (devFlags.debug)
|
|
39
22
|
console.debug(`${ToolBarItem_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
|
|
@@ -48,7 +31,7 @@ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
|
|
|
48
31
|
ensurePlaceholder(this.querySelector(':scope>button'), role, tKey);
|
|
49
32
|
this.#mutationObserver = new MutationObserver((mutations) => {
|
|
50
33
|
for (const { target } of mutations)
|
|
51
|
-
if (target instanceof HTMLElement
|
|
34
|
+
if (target instanceof HTMLElement)
|
|
52
35
|
ensurePlaceholder(this.querySelector(':scope>button'), role, tKey);
|
|
53
36
|
});
|
|
54
37
|
this.#mutationObserver.observe(this, {
|
|
@@ -59,6 +42,23 @@ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
|
|
|
59
42
|
}
|
|
60
43
|
}
|
|
61
44
|
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
if (devFlags.debug)
|
|
47
|
+
console.debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
|
|
48
|
+
this.#mutationObserver?.disconnect();
|
|
49
|
+
CleanupRegistry.unregister(this);
|
|
50
|
+
}
|
|
51
|
+
connectedCallback() {
|
|
52
|
+
if (devFlags.debug)
|
|
53
|
+
console.debug(`${ToolBarItem_1.name} ⚡️ connect`);
|
|
54
|
+
CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, ({ target }) => {
|
|
55
|
+
if (!(target instanceof HTMLElement))
|
|
56
|
+
return true;
|
|
57
|
+
if (target.closest('menu-view[open]'))
|
|
58
|
+
return false;
|
|
59
|
+
return true;
|
|
60
|
+
}), this).on());
|
|
61
|
+
}
|
|
62
62
|
};
|
|
63
63
|
ToolBarItem = ToolBarItem_1 = __decorate([
|
|
64
64
|
adaptiveSlot((el) => !el.closest('tool-bar-item-group'))
|
package/generated/css/index.css
CHANGED
|
@@ -1583,6 +1583,7 @@
|
|
|
1583
1583
|
--tooltip--dialog-translate: translateY(-10%);
|
|
1584
1584
|
--tooltip--dialog-scale: scale(0.9);
|
|
1585
1585
|
--tooltip--dialog-opacity: 0;
|
|
1586
|
+
--label--host-white-space: pre-line;
|
|
1586
1587
|
}
|
|
1587
1588
|
:where(fine-tooltip[open]) {
|
|
1588
1589
|
--tooltip--dialog-margin-block: max(env(safe-area-inset-top), var(--menu-spacing)) max(env(safe-area-inset-bottom), var(--menu-spacing));
|
|
@@ -2,7 +2,7 @@ export declare class NavigationView extends HTMLElement {
|
|
|
2
2
|
#private;
|
|
3
3
|
static get observedAttributes(): string[];
|
|
4
4
|
constructor();
|
|
5
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
5
6
|
disconnectedCallback(): void;
|
|
6
7
|
connectedCallback(): void;
|
|
7
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
8
8
|
}
|
|
@@ -11,30 +11,6 @@ export class NavigationView extends HTMLElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
13
|
}
|
|
14
|
-
disconnectedCallback() {
|
|
15
|
-
CleanupRegistry.unregister(this);
|
|
16
|
-
this.#recentBefore = undefined;
|
|
17
|
-
// this.removeEventListener('tabreveal', this.#handleTabReveal)
|
|
18
|
-
if (this.closest('tab-view'))
|
|
19
|
-
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabhide', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
20
|
-
}
|
|
21
|
-
connectedCallback() {
|
|
22
|
-
if (this.closest('tab-view')) {
|
|
23
|
-
// frame(this).then((r) => {
|
|
24
|
-
// if (!r) return
|
|
25
|
-
// this.dispatchEvent(new CustomEvent<TabDetail>('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true }))
|
|
26
|
-
// })
|
|
27
|
-
CleanupRegistry.register(this, onoff('beforetabreveal beforetabswap', this.#handleBeforeTabRevealOrSwap, this).on());
|
|
28
|
-
}
|
|
29
|
-
// Snapshot.waitReady.then(async () => {
|
|
30
|
-
if (this.hasAttribute('hidden'))
|
|
31
|
-
return; // will be picked up by attr-change!
|
|
32
|
-
if (this.closest('tab-view'))
|
|
33
|
-
frame(this).then(() => {
|
|
34
|
-
// if (!r) return
|
|
35
|
-
lifecycleObserver.dispatchEvent(new CustomEvent('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true }));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
14
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
39
15
|
switch (name) {
|
|
40
16
|
case 'hidden':
|
|
@@ -42,15 +18,14 @@ export class NavigationView extends HTMLElement {
|
|
|
42
18
|
break;
|
|
43
19
|
if (!this.closest('tab-view'))
|
|
44
20
|
break; // tabview stuff
|
|
21
|
+
// trigger show/hide/reveal/swap on NEXT tick
|
|
22
|
+
// show/hide run on initial render too (show on NEXT tick, is also taken care of on connected on initial render)
|
|
45
23
|
let eventType = this.hasAttribute(name) ? 'tabhide' : 'tabshow', target = lifecycleObserver;
|
|
46
24
|
// isRecent by 100ms window
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
else if (this.#recentBefore.type === 'beforetabswap') {
|
|
53
|
-
eventType = 'tabswap';
|
|
25
|
+
// && performance.now() - this.#recentBefore.time <= 100) {
|
|
26
|
+
if (this.#recentBefore) {
|
|
27
|
+
if (['beforetabreveal', 'beforetabswap'].includes(this.#recentBefore.type)) {
|
|
28
|
+
eventType = this.#recentBefore.type === 'beforetabreveal' ? 'tabreveal' : 'tabswap';
|
|
54
29
|
target = this;
|
|
55
30
|
}
|
|
56
31
|
// consume it (important so it doesn’t leak to next change)
|
|
@@ -58,22 +33,40 @@ export class NavigationView extends HTMLElement {
|
|
|
58
33
|
}
|
|
59
34
|
if (devFlags.debug)
|
|
60
35
|
console.debug(`${_a.name} 💡 ${eventType}`);
|
|
61
|
-
frame(this).then(() => {
|
|
62
|
-
// if (!r) return
|
|
63
|
-
target.dispatchEvent(new CustomEvent(eventType, { detail: { tag: this.id }, bubbles: true, composed: true }));
|
|
64
|
-
});
|
|
36
|
+
frame(this).then(() => target.dispatchEvent(new CustomEvent(eventType, { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
65
37
|
break;
|
|
66
38
|
}
|
|
67
39
|
}
|
|
68
|
-
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
CleanupRegistry.unregister(this);
|
|
42
|
+
this.#recentBefore = undefined;
|
|
43
|
+
// trigger hide on NEXT tick
|
|
44
|
+
if (!this.closest('tab-view'))
|
|
45
|
+
return;
|
|
46
|
+
frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabhide', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
47
|
+
}
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
if (!this.closest('tab-view'))
|
|
50
|
+
return;
|
|
51
|
+
// wire befores
|
|
52
|
+
CleanupRegistry.register(this, onoff('beforetabreveal beforetabswap', this.#handleBeforeTabRevealOrSwap, this).on());
|
|
53
|
+
// trigger show on NEXT tick
|
|
54
|
+
if (this.hasAttribute('hidden'))
|
|
55
|
+
return; // skip if already rendered by attr-change during upgrade!
|
|
56
|
+
frame(this).then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true })));
|
|
57
|
+
}
|
|
58
|
+
#handleBeforeTabRevealOrSwap = ({ type, detail }) => {
|
|
69
59
|
if (devFlags.debug)
|
|
70
|
-
console.debug(`${_a.name} ⚡️ ${
|
|
71
|
-
if (this.id !==
|
|
60
|
+
console.debug(`${_a.name} ⚡️ ${type}`);
|
|
61
|
+
if (this.id !== detail?.tag)
|
|
72
62
|
return;
|
|
73
63
|
this.#recentBefore = {
|
|
74
|
-
type
|
|
64
|
+
type, // beforetabreveal / beforetabswap
|
|
75
65
|
time: performance.now(),
|
|
76
66
|
};
|
|
67
|
+
self.queueMicrotask(() => {
|
|
68
|
+
this.#recentBefore = undefined;
|
|
69
|
+
}); // auto-expire after current task
|
|
77
70
|
};
|
|
78
71
|
}
|
|
79
72
|
_a = NavigationView;
|
|
@@ -2,3 +2,5 @@ export { default as adaptiveSlot } from './adaptive-slot';
|
|
|
2
2
|
export * from './adaptive-slot';
|
|
3
3
|
export { default as customElement } from './custom-element';
|
|
4
4
|
export * from './custom-element';
|
|
5
|
+
export { default as microtaskOnConnected } from './microtask-on-connected';
|
|
6
|
+
export * from './microtask-on-connected';
|
|
@@ -2,3 +2,5 @@ export { default as adaptiveSlot } from './adaptive-slot';
|
|
|
2
2
|
export * from './adaptive-slot';
|
|
3
3
|
export { default as customElement } from './custom-element';
|
|
4
4
|
export * from './custom-element';
|
|
5
|
+
export { default as microtaskOnConnected } from './microtask-on-connected';
|
|
6
|
+
export * from './microtask-on-connected';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replacement for this
|
|
3
|
+
class() {
|
|
4
|
+
#pendingSync = false
|
|
5
|
+
#scheduleSync() {
|
|
6
|
+
if (this.#pendingSync) return
|
|
7
|
+
this.#pendingSync = true
|
|
8
|
+
self.queueMicrotask(() => {
|
|
9
|
+
this.#pendingSync = false
|
|
10
|
+
this.#syncSibling()
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
#syncSibling = () => {
|
|
14
|
+
const sibling = this.closest<ScrollView>('scroll-view'),
|
|
15
|
+
value = this.getAttribute('value'),
|
|
16
|
+
subtitle = this.getAttribute('subtitle')
|
|
17
|
+
|
|
18
|
+
if (null === value) sibling?.removeAttribute('navigation-inline-title')
|
|
19
|
+
else sibling?.setAttribute('navigation-inline-title', value)
|
|
20
|
+
|
|
21
|
+
if (null === subtitle) sibling?.removeAttribute('navigation-inline-subtitle')
|
|
22
|
+
else sibling?.setAttribute('navigation-inline-subtitle', subtitle)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ connect`)
|
|
27
|
+
|
|
28
|
+
this.#scheduleSync()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
|
32
|
+
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
|
|
33
|
+
|
|
34
|
+
this.#scheduleSync()
|
|
35
|
+
|
|
36
|
+
this.#render(this.getAttribute('value'), this.getAttribute('subtitle'))
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
export default function <T extends HTMLElement>(fn: (el: T) => void): <C extends CustomElementConstructor>(Base: C, _context?: ClassDecoratorContext<C>) => void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replacement for this
|
|
3
|
+
class() {
|
|
4
|
+
#pendingSync = false
|
|
5
|
+
#scheduleSync() {
|
|
6
|
+
if (this.#pendingSync) return
|
|
7
|
+
this.#pendingSync = true
|
|
8
|
+
self.queueMicrotask(() => {
|
|
9
|
+
this.#pendingSync = false
|
|
10
|
+
this.#syncSibling()
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
#syncSibling = () => {
|
|
14
|
+
const sibling = this.closest<ScrollView>('scroll-view'),
|
|
15
|
+
value = this.getAttribute('value'),
|
|
16
|
+
subtitle = this.getAttribute('subtitle')
|
|
17
|
+
|
|
18
|
+
if (null === value) sibling?.removeAttribute('navigation-inline-title')
|
|
19
|
+
else sibling?.setAttribute('navigation-inline-title', value)
|
|
20
|
+
|
|
21
|
+
if (null === subtitle) sibling?.removeAttribute('navigation-inline-subtitle')
|
|
22
|
+
else sibling?.setAttribute('navigation-inline-subtitle', subtitle)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ connect`)
|
|
27
|
+
|
|
28
|
+
this.#scheduleSync()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
|
32
|
+
if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
|
|
33
|
+
|
|
34
|
+
this.#scheduleSync()
|
|
35
|
+
|
|
36
|
+
this.#render(this.getAttribute('value'), this.getAttribute('subtitle'))
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
// const _sync = Symbol('sync')
|
|
40
|
+
// @microtaskOnConnected((el) => (el as NavigationTitle)[_sync]())
|
|
41
|
+
// attributeChangedCallback fires
|
|
42
|
+
// → originalAttrChanged (your #render) runs synchronously ✅
|
|
43
|
+
// → schedule() queues microtask
|
|
44
|
+
// → microtask flush: syncToScrollView runs with already-updated attrs ✅
|
|
45
|
+
export default function (fn) {
|
|
46
|
+
return function (Base, _context) {
|
|
47
|
+
const originalConnected = Base.prototype.connectedCallback, originalAttrChanged = Base.prototype.attributeChangedCallback;
|
|
48
|
+
Base.prototype.connectedCallback = function () {
|
|
49
|
+
originalConnected?.call(this);
|
|
50
|
+
schedule(this, fn);
|
|
51
|
+
};
|
|
52
|
+
Base.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
|
|
53
|
+
originalAttrChanged?.call(this, name, oldValue, newValue);
|
|
54
|
+
schedule(this, fn);
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const pendingMap = new WeakMap();
|
|
59
|
+
function schedule(el, fn) {
|
|
60
|
+
if (pendingMap.get(el))
|
|
61
|
+
return;
|
|
62
|
+
pendingMap.set(el, true);
|
|
63
|
+
self.queueMicrotask(() => {
|
|
64
|
+
pendingMap.delete(el);
|
|
65
|
+
fn(el);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const touchList = new WeakMap();
|
|
2
2
|
function onDown({ target }) {
|
|
3
|
-
if (!(target instanceof HTMLElement
|
|
3
|
+
if (!(target instanceof HTMLElement))
|
|
4
4
|
return;
|
|
5
5
|
const el = target.closest('button,summary');
|
|
6
6
|
if (!el)
|
|
@@ -14,7 +14,7 @@ function onDown({ target }) {
|
|
|
14
14
|
el.closest('scroll-view')?.addEventListener('scroll', onScroll, { once: true, passive: true });
|
|
15
15
|
}
|
|
16
16
|
function onOver({ target, buttons }) {
|
|
17
|
-
if (!(target instanceof HTMLElement
|
|
17
|
+
if (!(target instanceof HTMLElement))
|
|
18
18
|
return;
|
|
19
19
|
const el = target.closest('button,summary');
|
|
20
20
|
if (!el)
|
|
@@ -26,7 +26,7 @@ function onOver({ target, buttons }) {
|
|
|
26
26
|
el.addEventListener('pointerleave', onLeave, { once: true, passive: true });
|
|
27
27
|
}
|
|
28
28
|
function onLeave({ target }) {
|
|
29
|
-
if (!(target instanceof HTMLElement
|
|
29
|
+
if (!(target instanceof HTMLElement))
|
|
30
30
|
return;
|
|
31
31
|
const el = target.closest('button,summary');
|
|
32
32
|
if (!el)
|
|
@@ -42,7 +42,7 @@ function onLeave({ target }) {
|
|
|
42
42
|
// })
|
|
43
43
|
}
|
|
44
44
|
function onCancel({ target }) {
|
|
45
|
-
if (!(target instanceof HTMLElement
|
|
45
|
+
if (!(target instanceof HTMLElement))
|
|
46
46
|
return;
|
|
47
47
|
const el = target.closest('button,summary');
|
|
48
48
|
if (!el)
|
|
@@ -58,7 +58,7 @@ function onCancel({ target }) {
|
|
|
58
58
|
// })
|
|
59
59
|
}
|
|
60
60
|
function onScroll({ target }) {
|
|
61
|
-
if (!(target instanceof HTMLElement
|
|
61
|
+
if (!(target instanceof HTMLElement))
|
|
62
62
|
return;
|
|
63
63
|
for (const el of target.querySelectorAll('button,summary') ?? []) {
|
|
64
64
|
el.classList.remove('active');
|
|
@@ -3,43 +3,43 @@ export declare abstract class DialogBase extends HTMLDialogElement {
|
|
|
3
3
|
static polyfillConnectedCallback(el: HTMLDialogElement): void;
|
|
4
4
|
static polyfillDisconnectedCallback(el: HTMLDialogElement): void;
|
|
5
5
|
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
6
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
6
7
|
disconnectedCallback(): void;
|
|
7
8
|
connectedCallback(): void;
|
|
8
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
9
9
|
}
|
|
10
10
|
export declare abstract class InputBase extends HTMLInputElement {
|
|
11
11
|
static polyfillExtends: "input";
|
|
12
12
|
static polyfillConnectedCallback(el: HTMLInputElement): void;
|
|
13
13
|
static polyfillDisconnectedCallback(el: HTMLInputElement): void;
|
|
14
14
|
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
15
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
15
16
|
disconnectedCallback(): void;
|
|
16
17
|
connectedCallback(): void;
|
|
17
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
18
18
|
}
|
|
19
19
|
export declare abstract class ButtonBase extends HTMLButtonElement {
|
|
20
20
|
static polyfillExtends: "button";
|
|
21
21
|
static polyfillConnectedCallback(el: HTMLButtonElement): void;
|
|
22
22
|
static polyfillDisconnectedCallback(el: HTMLButtonElement): void;
|
|
23
23
|
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
24
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
24
25
|
disconnectedCallback(): void;
|
|
25
26
|
connectedCallback(): void;
|
|
26
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
27
27
|
}
|
|
28
28
|
export declare abstract class DetailsBase extends HTMLDetailsElement {
|
|
29
29
|
static polyfillExtends: "details";
|
|
30
30
|
static polyfillConnectedCallback(el: HTMLDetailsElement): void;
|
|
31
31
|
static polyfillDisconnectedCallback(el: HTMLDetailsElement): void;
|
|
32
32
|
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
33
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
33
34
|
disconnectedCallback(): void;
|
|
34
35
|
connectedCallback(): void;
|
|
35
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
36
36
|
}
|
|
37
37
|
export declare abstract class FormBase extends HTMLFormElement {
|
|
38
38
|
static polyfillExtends: "form";
|
|
39
39
|
static polyfillConnectedCallback(el: HTMLFormElement): void;
|
|
40
40
|
static polyfillDisconnectedCallback(el: HTMLFormElement): void;
|
|
41
41
|
static polyfillAttributeChangedCallback(entries: Pick<MutationRecord, 'attributeName' | 'oldValue' | 'target'>[]): void;
|
|
42
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
42
43
|
disconnectedCallback(): void;
|
|
43
44
|
connectedCallback(): void;
|
|
44
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
45
45
|
}
|
|
@@ -3,14 +3,6 @@ export class DialogBase extends HTMLDialogElement {
|
|
|
3
3
|
static polyfillConnectedCallback(el) { }
|
|
4
4
|
static polyfillDisconnectedCallback(el) { }
|
|
5
5
|
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
6
|
-
disconnectedCallback() {
|
|
7
|
-
const ctor = this.constructor;
|
|
8
|
-
ctor.polyfillDisconnectedCallback(this);
|
|
9
|
-
}
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
const ctor = this.constructor;
|
|
12
|
-
ctor.polyfillConnectedCallback(this);
|
|
13
|
-
}
|
|
14
6
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
15
7
|
const ctor = this.constructor;
|
|
16
8
|
const entry = {
|
|
@@ -20,12 +12,6 @@ export class DialogBase extends HTMLDialogElement {
|
|
|
20
12
|
};
|
|
21
13
|
ctor.polyfillAttributeChangedCallback([entry]);
|
|
22
14
|
}
|
|
23
|
-
}
|
|
24
|
-
export class InputBase extends HTMLInputElement {
|
|
25
|
-
static polyfillExtends = 'input';
|
|
26
|
-
static polyfillConnectedCallback(el) { }
|
|
27
|
-
static polyfillDisconnectedCallback(el) { }
|
|
28
|
-
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
29
15
|
disconnectedCallback() {
|
|
30
16
|
const ctor = this.constructor;
|
|
31
17
|
ctor.polyfillDisconnectedCallback(this);
|
|
@@ -34,6 +20,12 @@ export class InputBase extends HTMLInputElement {
|
|
|
34
20
|
const ctor = this.constructor;
|
|
35
21
|
ctor.polyfillConnectedCallback(this);
|
|
36
22
|
}
|
|
23
|
+
}
|
|
24
|
+
export class InputBase extends HTMLInputElement {
|
|
25
|
+
static polyfillExtends = 'input';
|
|
26
|
+
static polyfillConnectedCallback(el) { }
|
|
27
|
+
static polyfillDisconnectedCallback(el) { }
|
|
28
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
37
29
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
38
30
|
const ctor = this.constructor;
|
|
39
31
|
const entry = {
|
|
@@ -43,12 +35,6 @@ export class InputBase extends HTMLInputElement {
|
|
|
43
35
|
};
|
|
44
36
|
ctor.polyfillAttributeChangedCallback([entry]);
|
|
45
37
|
}
|
|
46
|
-
}
|
|
47
|
-
export class ButtonBase extends HTMLButtonElement {
|
|
48
|
-
static polyfillExtends = 'button';
|
|
49
|
-
static polyfillConnectedCallback(el) { }
|
|
50
|
-
static polyfillDisconnectedCallback(el) { }
|
|
51
|
-
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
52
38
|
disconnectedCallback() {
|
|
53
39
|
const ctor = this.constructor;
|
|
54
40
|
ctor.polyfillDisconnectedCallback(this);
|
|
@@ -57,6 +43,12 @@ export class ButtonBase extends HTMLButtonElement {
|
|
|
57
43
|
const ctor = this.constructor;
|
|
58
44
|
ctor.polyfillConnectedCallback(this);
|
|
59
45
|
}
|
|
46
|
+
}
|
|
47
|
+
export class ButtonBase extends HTMLButtonElement {
|
|
48
|
+
static polyfillExtends = 'button';
|
|
49
|
+
static polyfillConnectedCallback(el) { }
|
|
50
|
+
static polyfillDisconnectedCallback(el) { }
|
|
51
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
60
52
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
61
53
|
const ctor = this.constructor;
|
|
62
54
|
const entry = {
|
|
@@ -66,12 +58,6 @@ export class ButtonBase extends HTMLButtonElement {
|
|
|
66
58
|
};
|
|
67
59
|
ctor.polyfillAttributeChangedCallback([entry]);
|
|
68
60
|
}
|
|
69
|
-
}
|
|
70
|
-
export class DetailsBase extends HTMLDetailsElement {
|
|
71
|
-
static polyfillExtends = 'details';
|
|
72
|
-
static polyfillConnectedCallback(el) { }
|
|
73
|
-
static polyfillDisconnectedCallback(el) { }
|
|
74
|
-
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
75
61
|
disconnectedCallback() {
|
|
76
62
|
const ctor = this.constructor;
|
|
77
63
|
ctor.polyfillDisconnectedCallback(this);
|
|
@@ -80,6 +66,12 @@ export class DetailsBase extends HTMLDetailsElement {
|
|
|
80
66
|
const ctor = this.constructor;
|
|
81
67
|
ctor.polyfillConnectedCallback(this);
|
|
82
68
|
}
|
|
69
|
+
}
|
|
70
|
+
export class DetailsBase extends HTMLDetailsElement {
|
|
71
|
+
static polyfillExtends = 'details';
|
|
72
|
+
static polyfillConnectedCallback(el) { }
|
|
73
|
+
static polyfillDisconnectedCallback(el) { }
|
|
74
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
83
75
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
84
76
|
const ctor = this.constructor;
|
|
85
77
|
const entry = {
|
|
@@ -89,12 +81,6 @@ export class DetailsBase extends HTMLDetailsElement {
|
|
|
89
81
|
};
|
|
90
82
|
ctor.polyfillAttributeChangedCallback([entry]);
|
|
91
83
|
}
|
|
92
|
-
}
|
|
93
|
-
export class FormBase extends HTMLFormElement {
|
|
94
|
-
static polyfillExtends = 'form';
|
|
95
|
-
static polyfillConnectedCallback(el) { }
|
|
96
|
-
static polyfillDisconnectedCallback(el) { }
|
|
97
|
-
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
98
84
|
disconnectedCallback() {
|
|
99
85
|
const ctor = this.constructor;
|
|
100
86
|
ctor.polyfillDisconnectedCallback(this);
|
|
@@ -103,6 +89,12 @@ export class FormBase extends HTMLFormElement {
|
|
|
103
89
|
const ctor = this.constructor;
|
|
104
90
|
ctor.polyfillConnectedCallback(this);
|
|
105
91
|
}
|
|
92
|
+
}
|
|
93
|
+
export class FormBase extends HTMLFormElement {
|
|
94
|
+
static polyfillExtends = 'form';
|
|
95
|
+
static polyfillConnectedCallback(el) { }
|
|
96
|
+
static polyfillDisconnectedCallback(el) { }
|
|
97
|
+
static polyfillAttributeChangedCallback(entries) { } //MutationRecord[]) {}
|
|
106
98
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
107
99
|
const ctor = this.constructor;
|
|
108
100
|
const entry = {
|
|
@@ -112,4 +104,12 @@ export class FormBase extends HTMLFormElement {
|
|
|
112
104
|
};
|
|
113
105
|
ctor.polyfillAttributeChangedCallback([entry]);
|
|
114
106
|
}
|
|
107
|
+
disconnectedCallback() {
|
|
108
|
+
const ctor = this.constructor;
|
|
109
|
+
ctor.polyfillDisconnectedCallback(this);
|
|
110
|
+
}
|
|
111
|
+
connectedCallback() {
|
|
112
|
+
const ctor = this.constructor;
|
|
113
|
+
ctor.polyfillConnectedCallback(this);
|
|
114
|
+
}
|
|
115
115
|
}
|
package/package.json
CHANGED