@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.
Files changed (57) 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 +2 -2
  26. package/generated/components/picker-view.js +35 -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 +1 -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/components/_fine-tooltip.scss +2 -0
  57. package/web-components.html-data/en.json +1 -0
@@ -108,12 +108,12 @@ document.addEventListener('touchstart', () => { }, { passive: true });
108
108
  //#endregion
109
109
  // SECTION
110
110
  const handleHelp = ({ target, relatedTarget }) => {
111
- if (!(target instanceof HTMLElement && target))
111
+ if (!(target instanceof HTMLElement))
112
112
  return;
113
113
  const trigger = target.closest('[help]');
114
114
  if (!trigger)
115
115
  return;
116
- if (relatedTarget instanceof HTMLElement && relatedTarget && trigger.contains(relatedTarget))
116
+ if (relatedTarget instanceof HTMLElement && trigger.contains(relatedTarget))
117
117
  return;
118
118
  const newAnchorName = `--help-${self.crypto.randomUUID()}`;
119
119
  const tooltip = $(`<fine-tooltip></fine-tooltip>`, '>1');
@@ -125,12 +125,12 @@ const handleHelp = ({ target, relatedTarget }) => {
125
125
  // }, 2000)
126
126
  // console.log(999, trigger)
127
127
  }, handleDone = ({ target, relatedTarget }) => {
128
- if (!(target instanceof HTMLElement && target))
128
+ if (!(target instanceof HTMLElement))
129
129
  return;
130
130
  const trigger = target.closest('[help]');
131
131
  if (!trigger)
132
132
  return;
133
- if (relatedTarget instanceof HTMLElement && relatedTarget && trigger.contains(relatedTarget))
133
+ if (relatedTarget instanceof HTMLElement && trigger.contains(relatedTarget))
134
134
  return;
135
135
  const anchorName = trigger.style.anchorName;
136
136
  if (!anchorName.startsWith('--help-'))
@@ -25,7 +25,7 @@ export class AlertDialog extends DialogBase {
25
25
  { types: 'cancel', listener: this.#handleDialogCancel },
26
26
  ], el).on());
27
27
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
28
- if (!(target instanceof HTMLElement && target))
28
+ if (!(target instanceof HTMLElement))
29
29
  return true;
30
30
  if (target.matches('[is=alert-dialog]'))
31
31
  return false;
@@ -52,9 +52,9 @@ export class AlertDialog extends DialogBase {
52
52
  if (devFlags.debug)
53
53
  console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
54
54
  const { target, currentTarget: dialog } = evt;
55
- if (!(dialog instanceof HTMLDialogElement && dialog))
55
+ if (!(dialog instanceof HTMLDialogElement))
56
56
  return;
57
- if (!(target instanceof HTMLElement && target))
57
+ if (!(target instanceof HTMLElement))
58
58
  return;
59
59
  const button = target.closest('button');
60
60
  if (!button)
@@ -75,7 +75,7 @@ export class AlertDialog extends DialogBase {
75
75
  if (!evt.cancelable)
76
76
  return;
77
77
  const { target } = evt;
78
- if (!(target instanceof HTMLDialogElement && target))
78
+ if (!(target instanceof HTMLDialogElement))
79
79
  return;
80
80
  evt.preventDefault();
81
81
  target.inert = true;
@@ -92,7 +92,7 @@ export class AlertDialog extends DialogBase {
92
92
  static #handleDialogClose = ({ type, target }) => {
93
93
  if (devFlags.debug)
94
94
  console.debug(`${AlertDialog.name} ⚡️ ${type}`);
95
- if (!(target instanceof HTMLDialogElement && target))
95
+ if (!(target instanceof HTMLDialogElement))
96
96
  return;
97
97
  target.remove();
98
98
  };
@@ -38,7 +38,7 @@ export class BorderedButton extends ButtonBase {
38
38
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
39
39
  if (devFlags.debug)
40
40
  console.debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
41
- const node = target instanceof HTMLButtonElement && target;
41
+ const node = target instanceof HTMLButtonElement;
42
42
  if (!node)
43
43
  return;
44
44
  switch (attributeName) {
@@ -38,7 +38,7 @@ export class BorderedProminentButton extends ButtonBase {
38
38
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
39
39
  if (devFlags.debug)
40
40
  console.debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
41
- const node = target instanceof HTMLButtonElement && target;
41
+ const node = target instanceof HTMLButtonElement;
42
42
  if (!node)
43
43
  return;
44
44
  switch (attributeName) {
@@ -38,7 +38,7 @@ export class BorderlessButton extends ButtonBase {
38
38
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
39
39
  if (devFlags.debug)
40
40
  console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
41
- const node = target instanceof HTMLButtonElement && target;
41
+ const node = target instanceof HTMLButtonElement;
42
42
  if (!node)
43
43
  return;
44
44
  switch (attributeName) {
@@ -31,7 +31,7 @@ export class ConfirmationDialog extends DialogBase {
31
31
  { types: 'cancel', listener: this.#handleDialogCancel },
32
32
  ], el).on());
33
33
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
34
- if (!(target instanceof HTMLElement && target))
34
+ if (!(target instanceof HTMLElement))
35
35
  return true;
36
36
  if (target.matches('[is=confirmation-dialog]'))
37
37
  return false;
@@ -64,9 +64,9 @@ export class ConfirmationDialog extends DialogBase {
64
64
  if (devFlags.debug)
65
65
  console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
66
66
  const { target, currentTarget: dialog } = evt;
67
- if (!(dialog instanceof HTMLDialogElement && dialog))
67
+ if (!(dialog instanceof HTMLDialogElement))
68
68
  return;
69
- if (!(target instanceof HTMLElement && target))
69
+ if (!(target instanceof HTMLElement))
70
70
  return;
71
71
  if (target.matches('dialog') && !isInside(evt.clientX, evt.clientY, dialog.getBoundingClientRect()))
72
72
  return dialog.requestClose(); // click outside
@@ -89,7 +89,7 @@ export class ConfirmationDialog extends DialogBase {
89
89
  if (!evt.cancelable)
90
90
  return;
91
91
  const { target } = evt;
92
- if (!(target instanceof HTMLDialogElement && target))
92
+ if (!(target instanceof HTMLDialogElement))
93
93
  return;
94
94
  evt.preventDefault();
95
95
  target.inert = true;
@@ -106,7 +106,7 @@ export class ConfirmationDialog extends DialogBase {
106
106
  static #handleDialogClose = ({ type, target }) => {
107
107
  if (devFlags.debug)
108
108
  console.debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
109
- if (!(target instanceof HTMLDialogElement && target))
109
+ if (!(target instanceof HTMLDialogElement))
110
110
  return;
111
111
  target.remove();
112
112
  };
@@ -18,7 +18,7 @@ export declare class ContentUnavailableView extends HTMLElement {
18
18
  static get observedAttributes(): string[];
19
19
  static get template(): DocumentFragment;
20
20
  constructor();
21
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
21
22
  disconnectedCallback(): void;
22
23
  connectedCallback(): void;
23
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
24
24
  }
@@ -45,14 +45,6 @@ export class ContentUnavailableView extends HTMLElement {
45
45
  actions: this.#shadowRoot.querySelector('slot[name="actions"]') ?? undefined,
46
46
  };
47
47
  }
48
- disconnectedCallback() {
49
- if (devFlags.debug)
50
- console.debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
51
- }
52
- connectedCallback() {
53
- if (devFlags.debug)
54
- console.debug(`${ContentUnavailableView.name} ⚡️ connect`);
55
- }
56
48
  attributeChangedCallback(name, oldValue, newValue) {
57
49
  if (devFlags.debug)
58
50
  console.debug(`${ContentUnavailableView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -68,6 +60,14 @@ export class ContentUnavailableView extends HTMLElement {
68
60
  break;
69
61
  }
70
62
  }
63
+ disconnectedCallback() {
64
+ if (devFlags.debug)
65
+ console.debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
66
+ }
67
+ connectedCallback() {
68
+ if (devFlags.debug)
69
+ console.debug(`${ContentUnavailableView.name} ⚡️ connect`);
70
+ }
71
71
  #renderSearch = (search) => {
72
72
  const titleLabel = this.querySelector(':scope>:not([slot])') ?? this.appendChild($(`<label-view><i class="ph ph-magnifying-glass" slot="image" foreground="secondary"></i></label-view>`, '>1')), descText = this.querySelector(':scope>[slot=description]') ?? this.appendChild($(`<label-view foreground="secondary" slot="description"></label-view>`, '>1'));
73
73
  if (search) {
@@ -6,9 +6,9 @@ export declare class DatePicker extends FormAssociatedBase {
6
6
  static get observedAttributes(): string[];
7
7
  get template(): DocumentFragment;
8
8
  constructor();
9
- connectedCallback(): void;
10
- disconnectedCallback(): void;
11
9
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
10
+ disconnectedCallback(): void;
11
+ connectedCallback(): void;
12
12
  get datePickerStyle(): DatePickerStyle;
13
13
  get name(): string;
14
14
  get value(): {
@@ -65,24 +65,6 @@ export class DatePicker extends FormAssociatedBase {
65
65
  super();
66
66
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
67
67
  }
68
- connectedCallback() {
69
- super.connectedCallback();
70
- CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
71
- this.#render();
72
- CleanupRegistry.register(this, onoff('localechange', () => {
73
- this.#render();
74
- }, I18n.on).on());
75
- // finally
76
- if (!this.hasAttribute('selection'))
77
- return;
78
- const [y = '', m = '', d = ''] = (this.getAttribute('selection') ?? '').split(/\D+/);
79
- this.#selectedDate = { year: y, month: m, day: d };
80
- this.#sendValueToForm(false);
81
- }
82
- disconnectedCallback() {
83
- super.disconnectedCallback();
84
- this.#validityObservers.unobserveAll();
85
- }
86
68
  attributeChangedCallback(name, oldValue, newValue) {
87
69
  if (devFlags.debug)
88
70
  console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -123,6 +105,24 @@ export class DatePicker extends FormAssociatedBase {
123
105
  break;
124
106
  }
125
107
  }
108
+ disconnectedCallback() {
109
+ super.disconnectedCallback();
110
+ this.#validityObservers.unobserveAll();
111
+ }
112
+ connectedCallback() {
113
+ super.connectedCallback();
114
+ CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
115
+ this.#render();
116
+ CleanupRegistry.register(this, onoff('localechange', () => {
117
+ this.#render();
118
+ }, I18n.on).on());
119
+ // finally
120
+ if (!this.hasAttribute('selection'))
121
+ return;
122
+ const [y = '', m = '', d = ''] = (this.getAttribute('selection') ?? '').split(/\D+/);
123
+ this.#selectedDate = { year: y, month: m, day: d };
124
+ this.#sendValueToForm(false);
125
+ }
126
126
  get datePickerStyle() {
127
127
  return datePickerStyles.includes(this.getAttribute('date-picker-style') ?? '') ? this.getAttribute('date-picker-style') : 'automatic';
128
128
  }
@@ -174,7 +174,7 @@ export class DatePicker extends FormAssociatedBase {
174
174
  #handleValiditiesSlotchange = ({ type, target: slot }) => {
175
175
  if (devFlags.debug)
176
176
  console.debug(`${_a.name} ⚡️ ${type}`);
177
- if (!(slot instanceof HTMLSlotElement && slot))
177
+ if (!(slot instanceof HTMLSlotElement))
178
178
  return;
179
179
  const assigned = slot.assignedElements();
180
180
  this.#validityObservers.syncObservations(assigned, ['value', 'label']);
@@ -204,7 +204,7 @@ export class DatePicker extends FormAssociatedBase {
204
204
  if (devFlags.debug)
205
205
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
206
206
  const { target } = evt;
207
- if (!(target instanceof HTMLElement && target))
207
+ if (!(target instanceof HTMLElement))
208
208
  return;
209
209
  const input = target.closest('input');
210
210
  if (input)
@@ -248,7 +248,7 @@ export class DatePicker extends FormAssociatedBase {
248
248
  if (devFlags.debug)
249
249
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
250
250
  const { target: input } = evt;
251
- if (!(input instanceof HTMLInputElement && input))
251
+ if (!(input instanceof HTMLInputElement))
252
252
  return;
253
253
  evt.preventDefault();
254
254
  const data = [...`${(evt.clipboardData?.getData('text') ?? '').trim()}`].reduce((acc, ch, i) => {
@@ -271,7 +271,7 @@ export class DatePicker extends FormAssociatedBase {
271
271
  if (devFlags.debug)
272
272
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
273
273
  const { target: input } = evt;
274
- if (!(input instanceof HTMLInputElement && input))
274
+ if (!(input instanceof HTMLInputElement))
275
275
  return;
276
276
  if ('insertText' !== evt.inputType)
277
277
  return;
@@ -294,7 +294,7 @@ export class DatePicker extends FormAssociatedBase {
294
294
  #handleInputKeydown = ({ type, target, key }) => {
295
295
  if (devFlags.debug)
296
296
  console.debug(`${_a.name} ⚡️ ${type}`);
297
- if (!(target instanceof HTMLInputElement && target))
297
+ if (!(target instanceof HTMLInputElement))
298
298
  return;
299
299
  const input = target;
300
300
  if (!input)
@@ -320,7 +320,7 @@ export class DatePicker extends FormAssociatedBase {
320
320
  #handleInputBlur = ({ target, type }) => {
321
321
  if (devFlags.debug)
322
322
  console.debug(`${_a.name} ⚡️ ${type}`);
323
- if (!(target instanceof HTMLInputElement && target))
323
+ if (!(target instanceof HTMLInputElement))
324
324
  return;
325
325
  const input = target;
326
326
  if (0 === input.value.length)
@@ -41,11 +41,10 @@ export class DisclosureGroup extends DetailsBase {
41
41
  toggleTimers.delete(el);
42
42
  });
43
43
  }
44
- static #handleToggle = async (evt) => {
44
+ static #handleToggle = async ({ type, currentTarget: details }) => {
45
45
  if (devFlags.debug)
46
- console.debug(`${DisclosureGroup.name} ⚡️ ${evt?.type}`);
47
- const details = evt.currentTarget instanceof HTMLDetailsElement && evt.currentTarget;
48
- if (!details)
46
+ console.debug(`${DisclosureGroup.name} ⚡️ ${type}`);
47
+ if (!(details instanceof HTMLDetailsElement))
49
48
  return;
50
49
  const newValue = details.open ? 'opening' : 'closing';
51
50
  if (newValue !== details.dataset.state)
@@ -12,7 +12,7 @@ export class FineTooltip extends HTMLElement {
12
12
  };
13
13
  #handleTriggerAttrMutation = (mutations) => {
14
14
  for (const { target, attributeName } of mutations)
15
- if (target instanceof HTMLElement && target && attributeName)
15
+ if (target instanceof HTMLElement && attributeName)
16
16
  this.#render(target.getAttribute(attributeName));
17
17
  };
18
18
  #handleMeasure = ([{ target, borderBoxSize }]) => {
@@ -20,7 +20,7 @@ export class FineTooltip extends HTMLElement {
20
20
  console.debug(`${_a.name} ⚡️ measure`);
21
21
  if (target.hasAttribute('closing'))
22
22
  return;
23
- if (!(target instanceof HTMLElement && target))
23
+ if (!(target instanceof HTMLElement))
24
24
  return;
25
25
  const { top } = target.getBoundingClientRect();
26
26
  const vpHeight = self.visualViewport?.height ?? 0, blockSize = borderBoxSize.at(0)?.blockSize ?? 0;
@@ -38,7 +38,7 @@ export class GlassButton extends ButtonBase {
38
38
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
39
39
  if (devFlags.debug)
40
40
  console.debug(`${GlassButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
41
- const node = target instanceof HTMLButtonElement && target;
41
+ const node = target instanceof HTMLButtonElement;
42
42
  if (!node)
43
43
  return;
44
44
  switch (attributeName) {
@@ -38,7 +38,7 @@ export class GlassProminentButton extends ButtonBase {
38
38
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
39
39
  if (devFlags.debug)
40
40
  console.debug(`${GlassProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
41
- const node = target instanceof HTMLButtonElement && target;
41
+ const node = target instanceof HTMLButtonElement;
42
42
  if (!node)
43
43
  return;
44
44
  switch (attributeName) {
@@ -3,7 +3,7 @@ export declare class LabelView 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
  }
@@ -24,14 +24,6 @@ export class LabelView extends HTMLElement {
24
24
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
25
25
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
26
26
  }
27
- disconnectedCallback() {
28
- if (devFlags.debug)
29
- console.debug(`${LabelView.name} ⚡️ disconnect`);
30
- }
31
- connectedCallback() {
32
- if (devFlags.debug)
33
- console.debug(`${LabelView.name} ⚡️ connect`);
34
- }
35
27
  attributeChangedCallback(name, oldValue, newValue) {
36
28
  if (devFlags.debug)
37
29
  console.debug(`${LabelView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -56,4 +48,12 @@ export class LabelView extends HTMLElement {
56
48
  break;
57
49
  }
58
50
  }
51
+ disconnectedCallback() {
52
+ if (devFlags.debug)
53
+ console.debug(`${LabelView.name} ⚡️ disconnect`);
54
+ }
55
+ connectedCallback() {
56
+ if (devFlags.debug)
57
+ console.debug(`${LabelView.name} ⚡️ connect`);
58
+ }
59
59
  }
@@ -6,7 +6,7 @@ export declare class MenuView extends HTMLElement {
6
6
  static get observedAttributes(): string[];
7
7
  static get template(): DocumentFragment;
8
8
  constructor();
9
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
9
10
  disconnectedCallback(): void;
10
11
  connectedCallback(): void;
11
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
12
12
  }
@@ -29,45 +29,6 @@ export class MenuView extends HTMLElement {
29
29
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
30
30
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
31
31
  }
32
- disconnectedCallback() {
33
- if (devFlags.debug)
34
- console.debug(`${_a.name} ⚡️ disconnect`);
35
- // const dialog = this.#shadowRoot.querySelector('dialog'),
36
- // trigger = this.#shadowRoot.querySelector('button')
37
- // trigger?.removeEventListener('click', this.#handleTriggerClick)
38
- // dialog?.removeEventListener('click', this.#handleDialogClick)
39
- // dialog?.removeEventListener('close', this.#handleDialogClose)
40
- // dialog?.removeEventListener('cancel', this.#handleDialogCancel)
41
- const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
42
- summaryPart?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, summaryPart)
43
- dialogPart?.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, dialogPart)
44
- CleanupRegistry.unregister(this);
45
- }
46
- connectedCallback() {
47
- if (devFlags.debug)
48
- console.debug(`${_a.name} ⚡️ connect`);
49
- this.#dialog = this.#shadowRoot.querySelector('dialog') ?? undefined;
50
- const trigger = this.#shadowRoot.querySelector('button') ?? undefined;
51
- CleanupRegistry.register(this, onoff('click', this.#handleTriggerClick, trigger).on());
52
- CleanupRegistry.register(this, onoff([
53
- { types: 'click', listener: this.#handleDialogClick },
54
- { types: 'close', listener: this.#handleDialogClose },
55
- { types: 'cancel', listener: this.#handleDialogCancel },
56
- ], this.#dialog).on());
57
- CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, ({ target }) => {
58
- if (!(target instanceof HTMLElement && target))
59
- return true;
60
- if (target.matches('menu-view'))
61
- return false;
62
- if (!target.closest('menu-view[open]'))
63
- return false;
64
- return true;
65
- }), this).on());
66
- const newAnchorName = `--menu-view-${self.crypto.randomUUID()}`;
67
- const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
68
- summaryPart?.style.setProperty('anchor-name', newAnchorName, 'important'); // override unset:all // $.prop('anchor-name', newAnchorName, summaryPart, 'important') //
69
- dialogPart?.style.setProperty('position-anchor', newAnchorName); // $.prop('position-anchor', newAnchorName, dialogPart) //
70
- }
71
32
  attributeChangedCallback(name, oldValue, newValue) {
72
33
  if (devFlags.debug)
73
34
  console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -107,10 +68,49 @@ export class MenuView extends HTMLElement {
107
68
  break;
108
69
  }
109
70
  }
71
+ disconnectedCallback() {
72
+ if (devFlags.debug)
73
+ console.debug(`${_a.name} ⚡️ disconnect`);
74
+ // const dialog = this.#shadowRoot.querySelector('dialog'),
75
+ // trigger = this.#shadowRoot.querySelector('button')
76
+ // trigger?.removeEventListener('click', this.#handleTriggerClick)
77
+ // dialog?.removeEventListener('click', this.#handleDialogClick)
78
+ // dialog?.removeEventListener('close', this.#handleDialogClose)
79
+ // dialog?.removeEventListener('cancel', this.#handleDialogCancel)
80
+ const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
81
+ summaryPart?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, summaryPart)
82
+ dialogPart?.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, dialogPart)
83
+ CleanupRegistry.unregister(this);
84
+ }
85
+ connectedCallback() {
86
+ if (devFlags.debug)
87
+ console.debug(`${_a.name} ⚡️ connect`);
88
+ this.#dialog = this.#shadowRoot.querySelector('dialog') ?? undefined;
89
+ const trigger = this.#shadowRoot.querySelector('button') ?? undefined;
90
+ CleanupRegistry.register(this, onoff('click', this.#handleTriggerClick, trigger).on());
91
+ CleanupRegistry.register(this, onoff([
92
+ { types: 'click', listener: this.#handleDialogClick },
93
+ { types: 'close', listener: this.#handleDialogClose },
94
+ { types: 'cancel', listener: this.#handleDialogCancel },
95
+ ], this.#dialog).on());
96
+ CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t, ({ target }) => {
97
+ if (!(target instanceof HTMLElement))
98
+ return true;
99
+ if (target.matches('menu-view'))
100
+ return false;
101
+ if (!target.closest('menu-view[open]'))
102
+ return false;
103
+ return true;
104
+ }), this).on());
105
+ const newAnchorName = `--menu-view-${self.crypto.randomUUID()}`;
106
+ const summaryPart = this.#shadowRoot.querySelector('[part*=menu-summary]'), dialogPart = this.#shadowRoot.querySelector('[part*=menu-dialog]');
107
+ summaryPart?.style.setProperty('anchor-name', newAnchorName, 'important'); // override unset:all // $.prop('anchor-name', newAnchorName, summaryPart, 'important') //
108
+ dialogPart?.style.setProperty('position-anchor', newAnchorName); // $.prop('position-anchor', newAnchorName, dialogPart) //
109
+ }
110
110
  #handleDialogClick = ({ type, target }) => {
111
111
  if (devFlags.debug)
112
112
  console.debug(`${_a.name} ⚡️ ${type}`);
113
- if (!(target instanceof HTMLElement && target))
113
+ if (!(target instanceof HTMLElement))
114
114
  return;
115
115
  if (target.matches('dialog'))
116
116
  return this.toggleAttribute('open', false); // click outside
@@ -4,7 +4,7 @@ import { NavigationView } from '../internal/class/navigation-view';
4
4
  */
5
5
  export declare class NavigationSplitView extends NavigationView {
6
6
  constructor();
7
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
7
8
  disconnectedCallback(): void;
8
9
  connectedCallback(): void;
9
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
10
10
  }
@@ -7,6 +7,11 @@ export class NavigationSplitView extends NavigationView {
7
7
  constructor() {
8
8
  super();
9
9
  }
10
+ attributeChangedCallback(name, oldValue, newValue) {
11
+ if (devFlags.debug)
12
+ console.debug(`${NavigationSplitView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
13
+ super.attributeChangedCallback(name, oldValue, newValue);
14
+ }
10
15
  disconnectedCallback() {
11
16
  if (devFlags.debug)
12
17
  console.debug(`${NavigationSplitView.name} ⚡️ disconnect`);
@@ -17,9 +22,4 @@ export class NavigationSplitView extends NavigationView {
17
22
  console.debug(`${NavigationSplitView.name} ⚡️ connect`);
18
23
  super.connectedCallback();
19
24
  }
20
- attributeChangedCallback(name, oldValue, newValue) {
21
- if (devFlags.debug)
22
- console.debug(`${NavigationSplitView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
23
- super.attributeChangedCallback(name, oldValue, newValue);
24
- }
25
25
  }
@@ -4,7 +4,7 @@ import { NavigationView } from '../internal/class/navigation-view';
4
4
  */
5
5
  export declare class NavigationStack extends NavigationView {
6
6
  constructor();
7
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
7
8
  disconnectedCallback(): void;
8
9
  connectedCallback(): void;
9
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
10
10
  }
@@ -7,16 +7,6 @@ export class NavigationStack extends NavigationView {
7
7
  constructor() {
8
8
  super();
9
9
  }
10
- disconnectedCallback() {
11
- if (devFlags.debug)
12
- console.debug(`${NavigationStack.name} ⚡️ disconnect`);
13
- super.disconnectedCallback();
14
- }
15
- connectedCallback() {
16
- if (devFlags.debug)
17
- console.debug(`${NavigationStack.name} ⚡️ connect`);
18
- super.connectedCallback();
19
- }
20
10
  attributeChangedCallback(name, oldValue, newValue) {
21
11
  if (devFlags.debug)
22
12
  console.debug(`${NavigationStack.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
@@ -28,4 +18,14 @@ export class NavigationStack extends NavigationView {
28
18
  }
29
19
  // })
30
20
  }
21
+ disconnectedCallback() {
22
+ if (devFlags.debug)
23
+ console.debug(`${NavigationStack.name} ⚡️ disconnect`);
24
+ super.disconnectedCallback();
25
+ }
26
+ connectedCallback() {
27
+ if (devFlags.debug)
28
+ console.debug(`${NavigationStack.name} ⚡️ connect`);
29
+ super.connectedCallback();
30
+ }
31
31
  }
@@ -2,7 +2,7 @@ export declare class NavigationTitle 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
  }