@swiftwc/ui 0.0.0-dev.46 → 0.0.0-dev.48

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.
Files changed (56) hide show
  1. package/generated/client/index.js +4 -4
  2. package/generated/components/alert-dialog.js +5 -5
  3. package/generated/components/bordered-button.js +1 -1
  4. package/generated/components/bordered-prominent-button.js +1 -1
  5. package/generated/components/borderless-button.js +1 -1
  6. package/generated/components/confirmation-dialog.js +5 -5
  7. package/generated/components/content-unavailable-view.d.ts +1 -1
  8. package/generated/components/content-unavailable-view.js +8 -8
  9. package/generated/components/date-picker.d.ts +2 -2
  10. package/generated/components/date-picker.js +24 -24
  11. package/generated/components/disclosure-group.js +3 -4
  12. package/generated/components/fine-tooltip.js +2 -2
  13. package/generated/components/glass-button.js +1 -1
  14. package/generated/components/glass-prominent-button.js +1 -1
  15. package/generated/components/label-view.d.ts +1 -1
  16. package/generated/components/label-view.js +8 -8
  17. package/generated/components/menu-view.d.ts +1 -1
  18. package/generated/components/menu-view.js +40 -40
  19. package/generated/components/navigation-split-view.d.ts +1 -1
  20. package/generated/components/navigation-split-view.js +5 -5
  21. package/generated/components/navigation-stack.d.ts +1 -1
  22. package/generated/components/navigation-stack.js +10 -10
  23. package/generated/components/navigation-title.d.ts +1 -1
  24. package/generated/components/navigation-title.js +31 -25
  25. package/generated/components/picker-view.d.ts +4 -2
  26. package/generated/components/picker-view.js +46 -35
  27. package/generated/components/progress-view.d.ts +1 -1
  28. package/generated/components/progress-view.js +15 -15
  29. package/generated/components/scroll-view.d.ts +1 -1
  30. package/generated/components/scroll-view.js +60 -59
  31. package/generated/components/search-view.js +1 -1
  32. package/generated/components/section-view.d.ts +1 -1
  33. package/generated/components/section-view.js +23 -23
  34. package/generated/components/sidebar-toggle.js +2 -2
  35. package/generated/components/sidebar-view.js +2 -2
  36. package/generated/components/sticky-container.js +1 -1
  37. package/generated/components/tab-bar.js +2 -2
  38. package/generated/components/tab-item.js +3 -4
  39. package/generated/components/tab-view.js +1 -1
  40. package/generated/components/table-view.js +2 -2
  41. package/generated/components/text-field.d.ts +2 -2
  42. package/generated/components/text-field.js +16 -16
  43. package/generated/components/tool-bar-item.d.ts +1 -1
  44. package/generated/components/tool-bar-item.js +18 -18
  45. package/generated/css/index.css +54 -0
  46. package/generated/internal/class/navigation-view.d.ts +1 -1
  47. package/generated/internal/class/navigation-view.js +32 -39
  48. package/generated/internal/decorators/index.d.ts +2 -0
  49. package/generated/internal/decorators/index.js +2 -0
  50. package/generated/internal/decorators/microtask-on-connected.d.ts +39 -0
  51. package/generated/internal/decorators/microtask-on-connected.js +67 -0
  52. package/generated/internal/utils/list-active.js +5 -5
  53. package/generated/namespace-browser/base.d.ts +5 -5
  54. package/generated/namespace-browser/base.js +32 -32
  55. package/package.json +1 -1
  56. package/scss/utils/_index.scss +29 -10
@@ -109,7 +109,7 @@ export class TableView extends HTMLElement {
109
109
  #handleColumnSlotchange = ({ type, target: slot }) => {
110
110
  if (devFlags.debug)
111
111
  console.debug(`${_a.name} ⚡️ ${type}`);
112
- if (!(slot instanceof HTMLSlotElement && slot))
112
+ if (!(slot instanceof HTMLSlotElement))
113
113
  return;
114
114
  const assigned = slot.assignedElements();
115
115
  this.#observers.syncObservations(assigned);
@@ -164,7 +164,7 @@ export class TableView extends HTMLElement {
164
164
  }
165
165
  };
166
166
  #handleMenuClick = ({ target }) => {
167
- if (!(target instanceof HTMLElement && target))
167
+ if (!(target instanceof HTMLElement))
168
168
  return;
169
169
  const btn = target.closest('button');
170
170
  if (!btn)
@@ -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 && slot))
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 && input))
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 && input))
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 && input))
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 && target)
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'))
@@ -5253,9 +5253,63 @@
5253
5253
  :where([foreground=blue]) {
5254
5254
  color: var(--blue);
5255
5255
  }
5256
+ :where([foreground=red]) {
5257
+ color: var(--red);
5258
+ }
5259
+ :where([foreground=green]) {
5260
+ color: var(--green);
5261
+ }
5262
+ :where([foreground=orange]) {
5263
+ color: var(--orange);
5264
+ }
5256
5265
  :where([foreground="blue.secondary"]) {
5257
5266
  color: var(--blue2);
5258
5267
  }
5268
+ :where([foreground="red.secondary"]) {
5269
+ color: var(--red2);
5270
+ }
5271
+ :where([foreground="green.secondary"]) {
5272
+ color: var(--green2);
5273
+ }
5274
+ :where([foreground="orange.secondary"]) {
5275
+ color: var(--orange2);
5276
+ }
5277
+ :where([foreground="blue.tertiary"]) {
5278
+ color: var(--blue3);
5279
+ }
5280
+ :where([foreground="red.tertiary"]) {
5281
+ color: var(--red3);
5282
+ }
5283
+ :where([foreground="green.tertiary"]) {
5284
+ color: var(--green3);
5285
+ }
5286
+ :where([foreground="orange.tertiary"]) {
5287
+ color: var(--orange3);
5288
+ }
5289
+ :where([foreground="blue.quaternary"]) {
5290
+ color: var(--blue4);
5291
+ }
5292
+ :where([foreground="red.quaternary"]) {
5293
+ color: var(--red4);
5294
+ }
5295
+ :where([foreground="green.quaternary"]) {
5296
+ color: var(--green4);
5297
+ }
5298
+ :where([foreground="orange.quaternary"]) {
5299
+ color: var(--orange4);
5300
+ }
5301
+ :where([foreground="blue.quinary"]) {
5302
+ color: var(--blue5);
5303
+ }
5304
+ :where([foreground="red.quinary"]) {
5305
+ color: var(--red5);
5306
+ }
5307
+ :where([foreground="green.quinary"]) {
5308
+ color: var(--green5);
5309
+ }
5310
+ :where([foreground="orange.quinary"]) {
5311
+ color: var(--orange5);
5312
+ }
5259
5313
  :where([tint=gray],
5260
5314
  [list-item-tint=gray]) {
5261
5315
  --accentColorEffective: var(--gray);
@@ -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
- if (this.#recentBefore && performance.now() - this.#recentBefore.time <= 100) {
48
- if (this.#recentBefore.type === 'beforetabreveal') {
49
- eventType = 'tabreveal';
50
- target = this;
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
- #handleBeforeTabRevealOrSwap = (evt) => {
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} ⚡️ ${evt?.type}`);
71
- if (this.id !== evt.detail?.tag)
60
+ console.debug(`${_a.name} ⚡️ ${type}`);
61
+ if (this.id !== detail?.tag)
72
62
  return;
73
63
  this.#recentBefore = {
74
- type: evt.type, // beforetabreveal / beforetabswap
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 && target))
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 && target))
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 && target))
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 && target))
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 && target))
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
  }