@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
@@ -1,39 +1,31 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var NavigationTitle_1;
8
+ import { microtaskOnConnected } from '../internal/decorators';
1
9
  import { $, devFlags } from '../internal/utils';
2
- export class NavigationTitle extends HTMLElement {
10
+ let NavigationTitle = NavigationTitle_1 = class NavigationTitle extends HTMLElement {
3
11
  static get observedAttributes() {
4
12
  return ['value', 'subtitle'];
5
13
  }
6
14
  constructor() {
7
15
  super();
8
16
  }
9
- disconnectedCallback() {
17
+ attributeChangedCallback(name, oldValue, newValue) {
10
18
  if (devFlags.debug)
11
- console.debug(`${NavigationTitle.name} ⚡️ disconnect`);
19
+ console.debug(`${NavigationTitle_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
20
+ this.#render(this.getAttribute('value'), this.getAttribute('subtitle'));
12
21
  }
13
- connectedCallback() {
22
+ disconnectedCallback() {
14
23
  if (devFlags.debug)
15
- console.debug(`${NavigationTitle.name} ⚡️ connect`);
24
+ console.debug(`${NavigationTitle_1.name} ⚡️ disconnect`);
16
25
  }
17
- attributeChangedCallback(name, oldValue, newValue) {
26
+ connectedCallback() {
18
27
  if (devFlags.debug)
19
- console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
20
- const sibling = this.closest('scroll-view') ?? undefined;
21
- switch (name) {
22
- case 'value':
23
- if (null === newValue)
24
- sibling?.removeAttribute('navigation-inline-title');
25
- else
26
- sibling?.setAttribute('navigation-inline-title', newValue);
27
- this.#render(newValue, this.getAttribute('subtitle'));
28
- break;
29
- case 'subtitle':
30
- if (null === newValue)
31
- sibling?.removeAttribute('navigation-inline-subtitle');
32
- else
33
- sibling?.setAttribute('navigation-inline-subtitle', newValue);
34
- this.#render(this.getAttribute('value'), newValue);
35
- break;
36
- }
28
+ console.debug(`${NavigationTitle_1.name} ⚡️ connect`);
37
29
  }
38
30
  #render = (title, subtitle) => {
39
31
  const titleTemplate = `<label-view line-limit="1" truncation-mode="tail" font="headline"></label-view>`, subtitleTemplate = `<label-view line-limit="1" truncation-mode="tail" foreground="secondary" font="callout"></label-view>`, vStactTemplate = `<v-stack spacing="0" alignment="fill">${titleTemplate}${subtitleTemplate}</v-stack>`;
@@ -49,4 +41,18 @@ export class NavigationTitle extends HTMLElement {
49
41
  else
50
42
  subtitleLabel?.removeAttribute('title');
51
43
  };
52
- }
44
+ };
45
+ NavigationTitle = NavigationTitle_1 = __decorate([
46
+ microtaskOnConnected((el) => {
47
+ const sibling = el.closest('scroll-view'), value = el.getAttribute('value'), subtitle = el.getAttribute('subtitle');
48
+ if (null === value)
49
+ sibling?.removeAttribute('navigation-inline-title');
50
+ else
51
+ sibling?.setAttribute('navigation-inline-title', value);
52
+ if (null === subtitle)
53
+ sibling?.removeAttribute('navigation-inline-subtitle');
54
+ else
55
+ sibling?.setAttribute('navigation-inline-subtitle', subtitle);
56
+ })
57
+ ], NavigationTitle);
58
+ export { NavigationTitle };
@@ -12,11 +12,13 @@ export declare class PickerView extends FormAssociatedBase {
12
12
  CURRENT_VALUE_LABEL: string;
13
13
  };
14
14
  static get observedAttributes(): string[];
15
+ get selection(): string;
16
+ set selection(v: string);
15
17
  get template(): DocumentFragment;
16
18
  constructor();
17
- connectedCallback(): void;
18
- disconnectedCallback(): void;
19
19
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
20
+ disconnectedCallback(): void;
21
+ connectedCallback(): void;
20
22
  get pickerStyle(): PickerStyle;
21
23
  get name(): string;
22
24
  setValidity: (flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement) => void;
@@ -90,26 +90,26 @@ export class PickerView extends FormAssociatedBase {
90
90
  </v-stack>
91
91
  </sticky-container>`);
92
92
  const searchInput = sv?.querySelector('input'); // FIXME: compoennt is=search-view??
93
- searchInput?.addEventListener('focus', (evt) => {
93
+ searchInput?.addEventListener('focus', ({ target }) => {
94
94
  if (this.#spawn)
95
95
  this.dispatchEvent(new CustomEvent('picker:searchfocus', {
96
- detail: { element: this.#spawn, search: evt.target instanceof HTMLInputElement && evt.target ? evt.target.value : '' },
96
+ detail: { element: this.#spawn, search: target instanceof HTMLInputElement ? target.value : '' },
97
97
  bubbles: true,
98
98
  composed: true,
99
99
  }));
100
100
  });
101
- searchInput?.addEventListener('blur', (evt) => {
101
+ searchInput?.addEventListener('blur', ({ target }) => {
102
102
  if (this.#spawn)
103
103
  this.dispatchEvent(new CustomEvent('picker:searchblur', {
104
- detail: { element: this.#spawn, search: evt.target instanceof HTMLInputElement && evt.target ? evt.target.value : '' },
104
+ detail: { element: this.#spawn, search: target instanceof HTMLInputElement ? target.value : '' },
105
105
  bubbles: true,
106
106
  composed: true,
107
107
  }));
108
108
  });
109
- searchInput?.addEventListener('input', (evt) => {
109
+ searchInput?.addEventListener('input', ({ target }) => {
110
110
  if (this.#spawn)
111
111
  this.dispatchEvent(new CustomEvent('picker:searchinput', {
112
- detail: { element: this.#spawn, search: evt.target instanceof HTMLInputElement && evt.target ? evt.target.value : '' },
112
+ detail: { element: this.#spawn, search: target instanceof HTMLInputElement ? target.value : '' },
113
113
  bubbles: true,
114
114
  composed: true,
115
115
  }));
@@ -120,7 +120,7 @@ export class PickerView extends FormAssociatedBase {
120
120
  evt.stopImmediatePropagation();
121
121
  evt.preventDefault();
122
122
  const { target } = evt;
123
- if (!(target instanceof HTMLElement && target))
123
+ if (!(target instanceof HTMLElement))
124
124
  return;
125
125
  const { component } = new NavigationPath(target)?.hydrate();
126
126
  await startViewTransition(target, 'backwards', async () => {
@@ -154,7 +154,7 @@ export class PickerView extends FormAssociatedBase {
154
154
  evt.stopImmediatePropagation();
155
155
  evt.preventDefault();
156
156
  const { target } = evt;
157
- if (!(target instanceof HTMLElement && target))
157
+ if (!(target instanceof HTMLElement))
158
158
  return;
159
159
  const newPage = this.#spawnPage('body-view', this.hasAttribute('searchable'), el.dataset.label, el);
160
160
  if (!newPage)
@@ -257,6 +257,17 @@ export class PickerView extends FormAssociatedBase {
257
257
  #observers = new MutationObserverSet(this.#renderSlotted);
258
258
  #customValidity = '';
259
259
  #selection = '';
260
+ get selection() {
261
+ return this.#selection;
262
+ }
263
+ set selection(v) {
264
+ if (Object.is(this.#selection, v))
265
+ return;
266
+ this.#selection = v;
267
+ this.#reflectSelectionOnButtons();
268
+ this.#reflectCurrentValueLabel();
269
+ this.#sendValueToForm();
270
+ }
260
271
  get #internals() {
261
272
  return getInternals(this);
262
273
  }
@@ -358,28 +369,6 @@ export class PickerView extends FormAssociatedBase {
358
369
  super();
359
370
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
360
371
  }
361
- connectedCallback() {
362
- if (devFlags.debug)
363
- console.debug(`${_a.name} ⚡️ connect`);
364
- CleanupRegistry.register(this, onoff('localechange', () => {
365
- this.#renderSlotted([]);
366
- }, I18n.on).on());
367
- CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
368
- if (!this.hasAttribute(this.constructor.ATTR.PICKER_STYLE))
369
- this.#render(); // will be picked up by attr-change!
370
- // finally
371
- if (!this.hasAttribute('selection'))
372
- return;
373
- this.#selection = this.getAttribute('selection') ?? '';
374
- this.#sendValueToForm(false);
375
- }
376
- disconnectedCallback() {
377
- if (devFlags.debug)
378
- console.debug(`${_a.name} ⚡️ disconnect`);
379
- CleanupRegistry.unregister(this);
380
- this.#validityObservers.unobserveAll();
381
- this.#observers.unobserveAll();
382
- }
383
372
  attributeChangedCallback(name, oldValue, newValue) {
384
373
  if (devFlags.debug)
385
374
  console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -410,6 +399,28 @@ export class PickerView extends FormAssociatedBase {
410
399
  break;
411
400
  }
412
401
  }
402
+ disconnectedCallback() {
403
+ if (devFlags.debug)
404
+ console.debug(`${_a.name} ⚡️ disconnect`);
405
+ CleanupRegistry.unregister(this);
406
+ this.#validityObservers.unobserveAll();
407
+ this.#observers.unobserveAll();
408
+ }
409
+ connectedCallback() {
410
+ if (devFlags.debug)
411
+ console.debug(`${_a.name} ⚡️ connect`);
412
+ CleanupRegistry.register(this, onoff('localechange', () => {
413
+ this.#renderSlotted([]);
414
+ }, I18n.on).on());
415
+ CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
416
+ if (!this.hasAttribute(this.constructor.ATTR.PICKER_STYLE))
417
+ this.#render(); // skip if already rendered by attr-change during upgrade!
418
+ // finally
419
+ if (!this.hasAttribute('selection'))
420
+ return;
421
+ this.#selection = this.getAttribute('selection') ?? '';
422
+ this.#sendValueToForm(false);
423
+ }
413
424
  get pickerStyle() {
414
425
  const attr = this.constructor.ATTR.PICKER_STYLE;
415
426
  return pickerStyles.includes(this.getAttribute(attr) ?? '') ? this.getAttribute(attr) : 'automatic';
@@ -459,7 +470,7 @@ export class PickerView extends FormAssociatedBase {
459
470
  #handleTriggerClick = async ({ type, target }) => {
460
471
  if (devFlags.debug)
461
472
  console.debug(`${_a.name} ⚡️ ${type}`);
462
- if (!(target instanceof HTMLElement && target))
473
+ if (!(target instanceof HTMLElement))
463
474
  return;
464
475
  this.#spawn?.remove?.();
465
476
  const level0 = this.#spawnPage('sheet' === this.pickerStyle ? 'sheet-view' : 'body-view', this.hasAttribute('searchable'), this.getAttribute('label'));
@@ -478,7 +489,7 @@ export class PickerView extends FormAssociatedBase {
478
489
  evt.stopImmediatePropagation();
479
490
  evt.preventDefault();
480
491
  const { currentTarget: btn } = evt;
481
- if (!(btn instanceof HTMLElement && btn))
492
+ if (!(btn instanceof HTMLElement))
482
493
  return;
483
494
  // const btn = target.closest('button')
484
495
  // if (!btn) return
@@ -499,7 +510,7 @@ export class PickerView extends FormAssociatedBase {
499
510
  #handleClick({ type, target }) {
500
511
  if (devFlags.debug)
501
512
  console.debug(`${_a.name} ⚡️ ${type}`);
502
- if (!(target instanceof HTMLElement && target))
513
+ if (!(target instanceof HTMLElement))
503
514
  return;
504
515
  const btn = target.closest('button');
505
516
  if (!btn)
@@ -512,7 +523,7 @@ export class PickerView extends FormAssociatedBase {
512
523
  #handleValiditiesSlotchange = ({ type, target: slot }) => {
513
524
  if (devFlags.debug)
514
525
  console.debug(`${_a.name} ⚡️ ${type}`);
515
- if (!(slot instanceof HTMLSlotElement && slot))
526
+ if (!(slot instanceof HTMLSlotElement))
516
527
  return;
517
528
  const assigned = slot.assignedElements();
518
529
  this.#validityObservers.syncObservations(assigned, ['value', 'label']);
@@ -522,7 +533,7 @@ export class PickerView extends FormAssociatedBase {
522
533
  #handleListSlotchange = ({ type, target: slot }) => {
523
534
  if (devFlags.debug)
524
535
  console.debug(`${_a.name} ⚡️ ${type}`);
525
- if (!(slot instanceof HTMLSlotElement && slot))
536
+ if (!(slot instanceof HTMLSlotElement))
526
537
  return;
527
538
  const assigned = slot.assignedElements();
528
539
  this.#observers.syncObservations(assigned);
@@ -7,7 +7,7 @@ export declare class ProgressView extends HTMLElement {
7
7
  get progressViewStyle(): "circular" | "linear";
8
8
  get template(): DocumentFragment;
9
9
  constructor();
10
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
10
11
  disconnectedCallback(): void;
11
12
  connectedCallback(): void;
12
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
13
13
  }
@@ -54,21 +54,6 @@ export class ProgressView extends HTMLElement {
54
54
  super();
55
55
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
56
56
  }
57
- disconnectedCallback() {
58
- if (devFlags.debug)
59
- console.debug(`${_a.name} ⚡️ disconnect`);
60
- CleanupRegistry.unregister(this);
61
- }
62
- connectedCallback() {
63
- if (devFlags.debug)
64
- console.debug(`${_a.name} ⚡️ connect`);
65
- this.inert = true;
66
- this.#cssStyleObserver = new CSSStyleObserver({
67
- properties: ['--progress-view-style-index'],
68
- });
69
- this.#cssStyleObserver.observe(this, this.#handleStyleChange);
70
- Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
71
- }
72
57
  attributeChangedCallback(name, oldValue, newValue) {
73
58
  if (devFlags.debug)
74
59
  console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -94,6 +79,21 @@ export class ProgressView extends HTMLElement {
94
79
  }
95
80
  }
96
81
  }
82
+ disconnectedCallback() {
83
+ if (devFlags.debug)
84
+ console.debug(`${_a.name} ⚡️ disconnect`);
85
+ CleanupRegistry.unregister(this);
86
+ }
87
+ connectedCallback() {
88
+ if (devFlags.debug)
89
+ console.debug(`${_a.name} ⚡️ connect`);
90
+ this.inert = true;
91
+ this.#cssStyleObserver = new CSSStyleObserver({
92
+ properties: ['--progress-view-style-index'],
93
+ });
94
+ this.#cssStyleObserver.observe(this, this.#handleStyleChange);
95
+ Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
96
+ }
97
97
  #handleStyleChange = () => {
98
98
  if (devFlags.debug)
99
99
  console.debug(`${_a.name} ⚡️ style`);
@@ -3,8 +3,8 @@ export declare class ScrollView extends HTMLElement {
3
3
  static get observedAttributes(): string[];
4
4
  static get template(): DocumentFragment;
5
5
  constructor();
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
  centerScrollToElement(child: Element): void;
10
10
  }
@@ -40,6 +40,26 @@ export class ScrollView extends HTMLElement {
40
40
  this.#slots = new Map();
41
41
  });
42
42
  }
43
+ attributeChangedCallback(name, oldValue, newValue) {
44
+ if (devFlags.debug)
45
+ console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
46
+ switch (name) {
47
+ case 'navigation-inline-title':
48
+ this.#renderNavTitle(newValue, this.getAttribute('navigation-inline-subtitle'));
49
+ break;
50
+ case 'navigation-inline-subtitle':
51
+ this.#renderNavTitle(this.getAttribute('navigation-inline-title'), newValue);
52
+ break;
53
+ case 'navigation-title':
54
+ //
55
+ break;
56
+ case 'navigation-bar-title-display-mode':
57
+ if (oldValue === newValue)
58
+ break;
59
+ this.#syncSibling(`${oldValue}${newValue}`);
60
+ break;
61
+ }
62
+ }
43
63
  disconnectedCallback() {
44
64
  if (devFlags.debug)
45
65
  console.debug(`${_a.name} ⚡️ disconnect`);
@@ -72,38 +92,23 @@ export class ScrollView extends HTMLElement {
72
92
  // })
73
93
  // })
74
94
  }
75
- attributeChangedCallback(name, oldValue, newValue) {
76
- if (devFlags.debug)
77
- console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
78
- switch (name) {
79
- case 'navigation-inline-title':
80
- this.#renderNavTitle(newValue, this.getAttribute('navigation-inline-subtitle'));
81
- break;
82
- case 'navigation-inline-subtitle':
83
- this.#renderNavTitle(this.getAttribute('navigation-inline-title'), newValue);
84
- break;
85
- case 'navigation-title':
86
- //
87
- break;
88
- case 'navigation-bar-title-display-mode':
89
- if (oldValue === newValue)
90
- break;
91
- if (this.closest('[hidden]'))
92
- break; // iREPAINT ALERT! if (0 === this.offsetHeight + this.offsetWidth) break
93
- if (!this.#isMidScroll)
94
- break;
95
- const title = this.#slots?.get('top-bar-principal')?.assignedElements({ flatten: true })?.at(0);
96
- slowHideShow('largeinline' === `${oldValue}${newValue}` ? 'show' : 'hide', title);
97
- break;
98
- }
99
- }
95
+ #syncSibling = (comp) => {
96
+ if (!this.isConnected)
97
+ return;
98
+ if (this.closest('[hidden]'))
99
+ return; // iREPAINT ALERT! if (0 === this.offsetHeight + this.offsetWidth) break
100
+ if (!this.#isMidScroll)
101
+ return;
102
+ const title = this.#slots?.get('top-bar-principal')?.assignedElements({ flatten: true })?.at(0);
103
+ slowHideShow('largeinline' === `${comp}` ? 'show' : 'hide', title);
104
+ };
100
105
  #handleScroll = ({ target, type }) => {
101
106
  if (devFlags.debug)
102
107
  console.debug(`${_a.name} ⚡️ ${type}`);
103
108
  if (!this.#isMidScroll)
104
109
  this.#isMidScroll = true;
105
110
  // if (this.#stopRecordingScrollTop) return
106
- if (!(target instanceof HTMLElement && target))
111
+ if (!(target instanceof HTMLElement))
107
112
  return;
108
113
  this.#lastScrollTop = target.scrollTop;
109
114
  };
@@ -131,42 +136,38 @@ export class ScrollView extends HTMLElement {
131
136
  // this.#stopRecordingScrollTop = false
132
137
  this.#beforeTabSwapLastScrolltop = undefined;
133
138
  };
134
- #handleTabReveal = ({ type, target }) => {
135
- if (devFlags.debug)
136
- console.debug(`${_a.name} ⚡️ ${type}`);
137
- if (!(target instanceof HTMLElement && target))
138
- return;
139
- if (!target.contains(this))
140
- return;
141
- if (this.closest('[hidden]'))
142
- return;
143
- // console.log(888, this.#beforeTabSwapLastScrolltop, this.#lastScrollTop)
144
- // this.style.setProperty('clip-path', 'inset(50%)')
145
- // this.style.setProperty('opacity', '0.001')
146
- // this.style.opacity = '0.001'
147
- // console.log(99, this.style.opacity)
148
- // self.requestAnimationFrame(() => {
149
- // if (undefined === this.#beforeTabSwapLastScrolltop) return
150
- // if (this.#beforeTabSwapLastScrolltop === this.#lastScrollTop) return
151
- // this.#stopRecordingScrollTop = true
152
- // // console.log(999, this.#beforeTabSwapLastScrolltop)
153
- // // console.log(999, this, this.#beforeTabSwapLastScrolltop, this.#lastScrollTop)
154
- // this.scrollTop = this.#beforeTabSwapLastScrolltop
155
- // // this.scrollTo({
156
- // // top: this.#beforeTabSwapLastScrolltop,
157
- // // behavior: 'instant',
158
- // // }) //
159
- // this.#stopRecordingScrollTop = false
160
- // this.#beforeTabSwapLastScrolltop = undefined
161
- // // self.requestAnimationFrame(() => {
162
- // // // this.style.removeProperty('opacity')
163
- // // })
164
- // })
165
- };
139
+ // #handleTabReveal = ({ type, target }: CustomEvent<TabDetail>) => {
140
+ // if (devFlags.debug) console.debug(`${ScrollView.name} ⚡️ ${type}`)
141
+ // if (!(target instanceof HTMLElement)) return
142
+ // if (!target.contains(this)) return
143
+ // if (this.closest('[hidden]')) return
144
+ // // console.log(888, this.#beforeTabSwapLastScrolltop, this.#lastScrollTop)
145
+ // // this.style.setProperty('clip-path', 'inset(50%)')
146
+ // // this.style.setProperty('opacity', '0.001')
147
+ // // this.style.opacity = '0.001'
148
+ // // console.log(99, this.style.opacity)
149
+ // // self.requestAnimationFrame(() => {
150
+ // // if (undefined === this.#beforeTabSwapLastScrolltop) return
151
+ // // if (this.#beforeTabSwapLastScrolltop === this.#lastScrollTop) return
152
+ // // this.#stopRecordingScrollTop = true
153
+ // // // console.log(999, this.#beforeTabSwapLastScrolltop)
154
+ // // // console.log(999, this, this.#beforeTabSwapLastScrolltop, this.#lastScrollTop)
155
+ // // this.scrollTop = this.#beforeTabSwapLastScrolltop
156
+ // // // this.scrollTo({
157
+ // // // top: this.#beforeTabSwapLastScrolltop,
158
+ // // // behavior: 'instant',
159
+ // // // }) //
160
+ // // this.#stopRecordingScrollTop = false
161
+ // // this.#beforeTabSwapLastScrolltop = undefined
162
+ // // // self.requestAnimationFrame(() => {
163
+ // // // // this.style.removeProperty('opacity')
164
+ // // // })
165
+ // // })
166
+ // }
166
167
  #handleTabBeforeswap = ({ type, target }) => {
167
168
  if (devFlags.debug)
168
169
  console.debug(`${_a.name} ⚡️ ${type}`);
169
- if (!(target instanceof HTMLElement && target))
170
+ if (!(target instanceof HTMLElement))
170
171
  return;
171
172
  if (!target.contains(this))
172
173
  return;
@@ -22,7 +22,7 @@ export class SearchView extends InputBase {
22
22
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
23
23
  if (devFlags.debug)
24
24
  console.debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
25
- const node = target instanceof HTMLInputElement && target;
25
+ const node = target instanceof HTMLInputElement;
26
26
  if (!node)
27
27
  return;
28
28
  //
@@ -3,7 +3,7 @@ export declare class SectionView extends HTMLElement {
3
3
  static get observedAttributes(): string[];
4
4
  static get template(): DocumentFragment;
5
5
  constructor();
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
  }
@@ -31,29 +31,6 @@ export class SectionView extends HTMLElement {
31
31
  // this.#sentinel = this.#shadowRoot.querySelector('.sticky-sentinel') ?? undefined
32
32
  // })
33
33
  }
34
- disconnectedCallback() {
35
- if (devFlags.debug)
36
- console.debug(`${SectionView.name} ⚡️ disconnect`);
37
- // if (this.#sentinel) this.#observer?.unobserve(this.#sentinel)
38
- // this.#observer?.unobserve(this)
39
- }
40
- connectedCallback() {
41
- if (devFlags.debug)
42
- console.debug(`${SectionView.name} ⚡️ connect`);
43
- // this.#sibling = this.closest('scroll-view') ?? undefined
44
- // Snapshot.waitReady.then(() => {
45
- // if (!(await frame(this))) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
46
- // const blockSizeProp = getComputedStyle(this).getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
47
- // blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 1)
48
- // this.#observer = new IntersectionObserver(this.#handleIntersect, {
49
- // root: this.#sibling,
50
- // rootMargin: `-${blockSize}px 0px 0px 0px`,
51
- // threshold: [0, 1],
52
- // })
53
- // if (this.#sentinel) this.#observer.observe(this.#sentinel)
54
- // this.#observer.observe(this)
55
- // })
56
- }
57
34
  attributeChangedCallback(name, oldValue, newValue) {
58
35
  if (devFlags.debug)
59
36
  console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -80,4 +57,27 @@ export class SectionView extends HTMLElement {
80
57
  }
81
58
  // })
82
59
  }
60
+ disconnectedCallback() {
61
+ if (devFlags.debug)
62
+ console.debug(`${SectionView.name} ⚡️ disconnect`);
63
+ // if (this.#sentinel) this.#observer?.unobserve(this.#sentinel)
64
+ // this.#observer?.unobserve(this)
65
+ }
66
+ connectedCallback() {
67
+ if (devFlags.debug)
68
+ console.debug(`${SectionView.name} ⚡️ connect`);
69
+ // this.#sibling = this.closest('scroll-view') ?? undefined
70
+ // Snapshot.waitReady.then(() => {
71
+ // if (!(await frame(this))) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
72
+ // const blockSizeProp = getComputedStyle(this).getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
73
+ // blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 1)
74
+ // this.#observer = new IntersectionObserver(this.#handleIntersect, {
75
+ // root: this.#sibling,
76
+ // rootMargin: `-${blockSize}px 0px 0px 0px`,
77
+ // threshold: [0, 1],
78
+ // })
79
+ // if (this.#sentinel) this.#observer.observe(this.#sentinel)
80
+ // this.#observer.observe(this)
81
+ // })
82
+ }
83
83
  }
@@ -33,7 +33,7 @@ export class SidebarToggle extends HTMLElement {
33
33
  if (devFlags.debug)
34
34
  console.debug(`${_a.name} ⚡️ measure`);
35
35
  const { target } = entry ?? {};
36
- if (!(target instanceof HTMLElement && target))
36
+ if (!(target instanceof HTMLElement))
37
37
  return;
38
38
  // set/remove css var/prop to parent based on shown/hidden
39
39
  const tv = target.parentElement;
@@ -71,7 +71,7 @@ export class SidebarToggle extends HTMLElement {
71
71
  #handleClick({ target, type }) {
72
72
  if (devFlags.debug)
73
73
  console.debug(`${_a.name} ⚡️ ${type}`);
74
- if (!(target instanceof HTMLElement && target))
74
+ if (!(target instanceof HTMLElement))
75
75
  return;
76
76
  if (!target?.closest('button'))
77
77
  return;
@@ -12,7 +12,7 @@ export class SidebarView extends DialogBase {
12
12
  static polyfillConnectedCallback(el) {
13
13
  CleanupRegistry.register(el, onoff('click', SidebarView.#handleClick, el).on());
14
14
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
15
- if (!(target instanceof HTMLElement && target))
15
+ if (!(target instanceof HTMLElement))
16
16
  return true;
17
17
  if (target.matches('[is=sidebar-view]'))
18
18
  return false;
@@ -26,7 +26,7 @@ export class SidebarView extends DialogBase {
26
26
  static #handleClick = async ({ target, type }) => {
27
27
  if (devFlags.debug)
28
28
  console.debug(`${SidebarView.name} ⚡️ ${type}`);
29
- if (!(target instanceof HTMLElement && target))
29
+ if (!(target instanceof HTMLElement))
30
30
  return;
31
31
  if (target instanceof HTMLDialogElement && 'sidebar-view' === target.getAttribute('is'))
32
32
  target.close?.();
@@ -16,7 +16,7 @@ export class StickyContainer extends HTMLElement {
16
16
  CleanupRegistry.unregister(this);
17
17
  }
18
18
  #handleTransitionrun = ({ target, propertyName, pseudoElement }) => {
19
- if (!(target instanceof HTMLElement && target))
19
+ if (!(target instanceof HTMLElement))
20
20
  return;
21
21
  if ('--stuck' !== propertyName || '::before' !== pseudoElement || !target.matches('sticky-container'))
22
22
  return;
@@ -22,7 +22,7 @@ export class TabBar extends DialogBase {
22
22
  // if (!r) return
23
23
  CleanupRegistry.register(el, onoff('click', TabBar.#handleClick, el).on());
24
24
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
25
- if (!(target instanceof HTMLElement && target))
25
+ if (!(target instanceof HTMLElement))
26
26
  return true;
27
27
  if (target.matches('[is=tab-bar]'))
28
28
  return false;
@@ -35,7 +35,7 @@ export class TabBar extends DialogBase {
35
35
  static #handleClick = async ({ target, type }) => {
36
36
  if (devFlags.debug)
37
37
  console.debug(`${TabBar.name} ⚡️ ${type}`);
38
- if (!(target instanceof HTMLElement && target))
38
+ if (!(target instanceof HTMLElement))
39
39
  return;
40
40
  if (target instanceof HTMLDialogElement && 'tab-bar' === target.getAttribute('is'))
41
41
  target.close?.();
@@ -65,11 +65,10 @@ export class TabItem extends ButtonBase {
65
65
  });
66
66
  }, 100);
67
67
  };
68
- static #handleClick = async (evt) => {
68
+ static #handleClick = async ({ type, currentTarget: btn }) => {
69
69
  if (devFlags.debug)
70
- console.debug(`${TabItem.name} ⚡️ ${evt?.type}`);
71
- const btn = evt.currentTarget instanceof HTMLElement && evt.currentTarget;
72
- if (!btn)
70
+ console.debug(`${TabItem.name} ⚡️ ${type}`);
71
+ if (!(btn instanceof HTMLElement))
73
72
  return;
74
73
  // const tag = btn.getAttribute('value')
75
74
  // if (!tag) return // sidebartoggle > tab-item //throw new DOMException(`Attribute "tag" is set but invalid`, 'InvalidStateError')
@@ -75,7 +75,7 @@ export class TabView extends HTMLElement {
75
75
  // })
76
76
  }
77
77
  #handleSummaryClick = ({ target }) => {
78
- if (!(target instanceof HTMLElement && target))
78
+ if (!(target instanceof HTMLElement))
79
79
  return;
80
80
  const summary = target.closest('summary');
81
81
  if (!summary)