@swiftwc/ui 0.0.0-dev.103 → 0.0.0-dev.106

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 (95) hide show
  1. package/generated/client/index.js +7 -8
  2. package/generated/components/alert-dialog.js +9 -17
  3. package/generated/components/body-view.js +3 -5
  4. package/generated/components/bordered-button.js +4 -7
  5. package/generated/components/bordered-prominent-button.js +4 -7
  6. package/generated/components/borderless-button.js +4 -7
  7. package/generated/components/color-scheme.js +4 -7
  8. package/generated/components/confirmation-dialog.js +9 -17
  9. package/generated/components/content-unavailable.js +4 -7
  10. package/generated/components/date-picker.js +13 -25
  11. package/generated/components/detail-placeholder.js +4 -8
  12. package/generated/components/disclosure-group.js +5 -9
  13. package/generated/components/fine-tooltip.js +4 -7
  14. package/generated/components/form-view.js +3 -5
  15. package/generated/components/glass-button.js +4 -7
  16. package/generated/components/glass-prominent-button.js +4 -7
  17. package/generated/components/h-divider.d.ts +11 -0
  18. package/generated/components/h-divider.js +15 -0
  19. package/generated/components/h-stack.js +3 -5
  20. package/generated/components/image-view.js +4 -7
  21. package/generated/components/index.d.ts +2 -0
  22. package/generated/components/index.js +2 -0
  23. package/generated/components/label-view.js +4 -7
  24. package/generated/components/labeled-content.js +4 -7
  25. package/generated/components/list-view.js +3 -5
  26. package/generated/components/menu-view.js +10 -19
  27. package/generated/components/navigation-large-title.js +5 -9
  28. package/generated/components/navigation-split-view.js +4 -7
  29. package/generated/components/navigation-stack.js +4 -7
  30. package/generated/components/navigation-title.js +4 -7
  31. package/generated/components/picker-view.js +32 -61
  32. package/generated/components/plain-button.js +3 -5
  33. package/generated/components/progress-view.js +6 -11
  34. package/generated/components/screen-view.js +2 -3
  35. package/generated/components/scroll-view-proxy.js +3 -5
  36. package/generated/components/scroll-view.js +9 -16
  37. package/generated/components/search-view.js +4 -7
  38. package/generated/components/section-view.js +4 -7
  39. package/generated/components/sheet-view.js +6 -11
  40. package/generated/components/sidebar-toggle.js +5 -9
  41. package/generated/components/sidebar-view.js +2 -3
  42. package/generated/components/sticky-container.js +3 -5
  43. package/generated/components/tab-bar.js +4 -7
  44. package/generated/components/tab-item.js +8 -15
  45. package/generated/components/tab-view.js +8 -14
  46. package/generated/components/table-view.js +6 -11
  47. package/generated/components/text-field.js +10 -19
  48. package/generated/components/text-view.js +4 -7
  49. package/generated/components/toggle-view.js +13 -25
  50. package/generated/components/tool-bar-item-group.js +3 -5
  51. package/generated/components/tool-bar-item.js +4 -7
  52. package/generated/components/tool-bar.js +4 -7
  53. package/generated/components/v-divider.d.ts +11 -0
  54. package/generated/components/v-divider.js +15 -0
  55. package/generated/components/v-keyboard.js +8 -12
  56. package/generated/components/v-stack.js +3 -5
  57. package/generated/css/index.css +13 -5
  58. package/generated/internal/class/css-style-observer.js +2 -3
  59. package/generated/internal/class/form-associated-base.js +5 -7
  60. package/generated/internal/class/navigation-view.js +3 -5
  61. package/generated/internal/decorators/adaptive-slot.js +4 -7
  62. package/generated/internal/decorators/microtask-on-connected.d.ts +2 -2
  63. package/generated/internal/decorators/microtask-on-connected.js +2 -2
  64. package/generated/internal/flags.json +3 -0
  65. package/generated/internal/privateNamespace.js +12 -21
  66. package/generated/internal/utils/$.d.ts +9 -0
  67. package/generated/internal/utils/$.js +11 -0
  68. package/generated/internal/utils/debug.d.ts +1 -0
  69. package/generated/internal/utils/debug.js +4 -0
  70. package/generated/internal/utils/index.d.ts +36 -2
  71. package/generated/internal/utils/index.js +36 -5
  72. package/generated/internal/utils/is-inside.js +1 -1
  73. package/generated/snapshot/index.js +3 -5
  74. package/package.json +11 -7
  75. package/scss/components/_index.scss +3 -1
  76. package/scss/components/_picker-view.scss +1 -1
  77. package/web-components.html-data/en.json +8 -0
  78. package/generated/internal/utils/cash/index.d.ts +0 -24
  79. package/generated/internal/utils/cash/index.js +0 -27
  80. package/generated/internal/utils/dev-flags.d.ts +0 -3
  81. package/generated/internal/utils/dev-flags.js +0 -5
  82. /package/generated/internal/utils/{cash/ancestors.d.ts → ancestors.d.ts} +0 -0
  83. /package/generated/internal/utils/{cash/ancestors.js → ancestors.js} +0 -0
  84. /package/generated/internal/utils/{cash/next-all.d.ts → next-all.d.ts} +0 -0
  85. /package/generated/internal/utils/{cash/next-all.js → next-all.js} +0 -0
  86. /package/generated/internal/utils/{cash/next.d.ts → next.d.ts} +0 -0
  87. /package/generated/internal/utils/{cash/next.js → next.js} +0 -0
  88. /package/generated/internal/utils/{cash/prev-all.d.ts → prev-all.d.ts} +0 -0
  89. /package/generated/internal/utils/{cash/prev-all.js → prev-all.js} +0 -0
  90. /package/generated/internal/utils/{cash/prev.d.ts → prev.d.ts} +0 -0
  91. /package/generated/internal/utils/{cash/prev.js → prev.js} +0 -0
  92. /package/generated/internal/utils/{cash/prop.d.ts → prop.d.ts} +0 -0
  93. /package/generated/internal/utils/{cash/prop.js → prop.js} +0 -0
  94. /package/generated/internal/utils/{cash/siblings.d.ts → siblings.d.ts} +0 -0
  95. /package/generated/internal/utils/{cash/siblings.js → siblings.js} +0 -0
@@ -5,13 +5,12 @@ import { FormAssociatedBase, getInternals } from '../internal/class/form-associa
5
5
  import { MutationObserverSet } from '../internal/class/mutation-observer-set';
6
6
  import { NavigationPath } from '../internal/class/navigation-path';
7
7
  import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
8
- import { $, devFlags, kebabCase, onoff } from '../internal/utils';
8
+ import { $, ancestors, debug, kebabCase, onoff } from '../internal/utils';
9
9
  import { queryMorph } from '../morphdom';
10
10
  import { html, render } from '../tpl';
11
11
  const pickerStyles = ['menu', 'inline', 'navigation-link', 'sheet', 'automatic'];
12
12
  const update = (path, node, overwrite = true) => {
13
- if (devFlags.debug)
14
- console.debug(`PickerView: update`);
13
+ debug(`PickerView: update`);
15
14
  if (!(path instanceof NavigationPath))
16
15
  throw new Error('invalid view');
17
16
  const { component, page } = path;
@@ -23,8 +22,7 @@ const update = (path, node, overwrite = true) => {
23
22
  page.insertAdjacentElement(position, node);
24
23
  };
25
24
  const reflectSpawnedPage = (current, source) => {
26
- if (devFlags.debug)
27
- console.debug(`PickerView: reflectSpawnedPage`);
25
+ debug(`PickerView: reflectSpawnedPage`);
28
26
  const { page: oldSv, toolBarConfig: oldToolbar } = new NavigationPath(current).hydrate(), { page: newSv, toolBarConfig: newToolbar } = new NavigationPath(source).hydrate();
29
27
  const oldList = oldSv?.querySelector('list-view'), newList = newSv?.querySelector('list-view'), oldBackBtn = oldToolbar?.at(0)?.querySelector('button'), newBackBtn = newToolbar?.at(0)?.querySelector('button');
30
28
  // pre replace list (always exists)
@@ -62,12 +60,10 @@ const reflectSpawnedPage = (current, source) => {
62
60
  oldSearch?.remove();
63
61
  };
64
62
  const extractTag = (node) => {
65
- if (devFlags.debug)
66
- console.debug(`PickerView: extractTag`);
63
+ debug(`PickerView: extractTag`);
67
64
  return node instanceof HTMLOptionElement ? (((node.getAttribute('value') ?? node.textContent?.trim()) || node.getAttribute('label')) ?? '') : (node.value ?? '');
68
65
  }, extractLabel = (node) => {
69
- if (devFlags.debug)
70
- console.debug(`PickerView: extractLabelFromGroup`);
66
+ debug(`PickerView: extractLabelFromGroup`);
71
67
  if (node instanceof Element)
72
68
  if (node instanceof HTMLOptionElement)
73
69
  return (node.getAttribute('label') ?? node.getAttribute('value') ?? node.textContent?.trim()) || null;
@@ -77,16 +73,14 @@ const extractTag = (node) => {
77
73
  return node.title ?? node.value ?? null;
78
74
  // return node instanceof Element ? node.getAttribute('DATALIST' === node.tagName ? 'data-label' : 'label') : (node.title ?? node.value ?? null)
79
75
  }, extractIcon = (node) => {
80
- if (devFlags.debug)
81
- console.debug(`PickerView: extractIcon`);
76
+ debug(`PickerView: extractIcon`);
82
77
  // return node instanceof Element ? node.getAttribute('data-system-image') : (node.systemImage ?? null)
83
78
  if (node instanceof Element)
84
79
  return node.getAttribute('data-system-image');
85
80
  else
86
81
  return node.systemImage ?? null;
87
82
  }, extractSubtitle = (node) => {
88
- if (devFlags.debug)
89
- console.debug(`PickerView: extractSubtitle`);
83
+ debug(`PickerView: extractSubtitle`);
90
84
  if (node instanceof Element)
91
85
  return node.getAttribute('data-subtitle');
92
86
  else
@@ -171,8 +165,7 @@ export class PickerView extends FormAssociatedBase {
171
165
  };
172
166
  }
173
167
  #spawnPage = (elements, tag, parentGroupId, searchable = false, title) => {
174
- if (devFlags.debug)
175
- console.debug(`${_a.name} #spawnPage`);
168
+ debug(`${_a.name} #spawnPage`);
176
169
  const body = tag === 'sheet-view'
177
170
  ? $(html `<dialog is="sheet-view">
178
171
  <scroll-view>
@@ -313,7 +306,7 @@ export class PickerView extends FormAssociatedBase {
313
306
  return;
314
307
  const groupMap = indexGroups(freshRoot);
315
308
  for (const el of this.#spawn.querySelectorAll('body-view')) {
316
- const depth = $.ancestors('body-view,[is=sheet-view]', el).indexOf(this.#spawn);
309
+ const depth = ancestors('body-view,[is=sheet-view]', el).indexOf(this.#spawn);
317
310
  if (0 >= depth)
318
311
  continue;
319
312
  const groupId = el.dataset.groupId;
@@ -330,8 +323,7 @@ export class PickerView extends FormAssociatedBase {
330
323
  }
331
324
  };
332
325
  #renderButtons(input) {
333
- if (devFlags.debug)
334
- console.debug(`${_a.name} #renderButtons`);
326
+ debug(`${_a.name} #renderButtons`);
335
327
  switch (input.mode) {
336
328
  case 'dictionary': {
337
329
  const flattenDictionary = (tree) => {
@@ -483,18 +475,15 @@ export class PickerView extends FormAssociatedBase {
483
475
  this.#reflectSelectionOnCurrentValueLabel();
484
476
  }
485
477
  #renderDictionary = (dictionary) => {
486
- if (devFlags.debug)
487
- console.debug(`${_a.name} ⚡️ mutation`);
478
+ debug(`${_a.name} ⚡️ mutation`);
488
479
  this.#renderButtons({ mode: 'dictionary', source: dictionary });
489
480
  };
490
481
  #renderSlotted = (entries) => {
491
- if (devFlags.debug)
492
- console.debug(`${_a.name} ⚡️ mutation`);
482
+ debug(`${_a.name} ⚡️ mutation`);
493
483
  this.#renderButtons({ mode: 'list', source: this.#slots?.get('list')?.assignedElements({ flatten: true }) ?? [] });
494
484
  };
495
485
  #renderValidityMsgs = (entries) => {
496
- if (devFlags.debug)
497
- console.debug(`${_a.name} ⚡️ mutation`);
486
+ debug(`${_a.name} ⚡️ mutation`);
498
487
  this.setValidity(this.validity, this.validationMessage);
499
488
  };
500
489
  #lastRenderedStyle; //string | null
@@ -626,8 +615,7 @@ export class PickerView extends FormAssociatedBase {
626
615
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
627
616
  }
628
617
  attributeChangedCallback(name, oldValue, newValue) {
629
- if (devFlags.debug)
630
- console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
618
+ debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
631
619
  switch (name) {
632
620
  case this.constructor.ATTR.PLACEHOLDER:
633
621
  case this.constructor.ATTR.PLACEHOLDER_ICON:
@@ -674,15 +662,13 @@ export class PickerView extends FormAssociatedBase {
674
662
  }
675
663
  }
676
664
  disconnectedCallback() {
677
- if (devFlags.debug)
678
- console.debug(`${_a.name} ⚡️ disconnect`);
665
+ debug(`${_a.name} ⚡️ disconnect`);
679
666
  CleanupRegistry.unregister(this);
680
667
  this.#validityObservers.unobserveAll();
681
668
  this.#observers.unobserveAll();
682
669
  }
683
670
  connectedCallback() {
684
- if (devFlags.debug)
685
- console.debug(`${_a.name} ⚡️ connect`);
671
+ debug(`${_a.name} ⚡️ connect`);
686
672
  CleanupRegistry.register(this, onoff('localechange', () => {
687
673
  this.#renderSlotted([]);
688
674
  }, I18n.on).on());
@@ -700,8 +686,7 @@ export class PickerView extends FormAssociatedBase {
700
686
  return pickerStyles.includes(this.getAttribute(attr) ?? '') ? this.getAttribute(attr) : 'automatic';
701
687
  }
702
688
  #render() {
703
- if (devFlags.debug)
704
- console.debug(`${_a.name} ⚡️ #render (${this.pickerStyle})`);
689
+ debug(`${_a.name} ⚡️ #render (${this.pickerStyle})`);
705
690
  // const style = this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)
706
691
  if (this.#lastRenderedStyle === this.pickerStyle)
707
692
  return; // skip if already applied
@@ -742,8 +727,7 @@ export class PickerView extends FormAssociatedBase {
742
727
  this.dispatchEvent(new CustomEvent('selection', { detail: { selection: this.#selection }, bubbles: true, composed: true }));
743
728
  };
744
729
  #handleTriggerClick = async ({ type, target }) => {
745
- if (devFlags.debug)
746
- console.debug(`${_a.name} ⚡️ ${type}`);
730
+ debug(`${_a.name} ⚡️ ${type}`);
747
731
  if (!(target instanceof HTMLElement))
748
732
  return;
749
733
  this.#spawn?.remove?.();
@@ -758,8 +742,7 @@ export class PickerView extends FormAssociatedBase {
758
742
  });
759
743
  };
760
744
  #handlePageBtnClick = async (evt) => {
761
- if (devFlags.debug)
762
- console.debug(`${_a.name} ⚡️ ${evt?.type}`);
745
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
763
746
  evt.stopImmediatePropagation();
764
747
  evt.preventDefault();
765
748
  const { currentTarget: btn } = evt;
@@ -782,8 +765,7 @@ export class PickerView extends FormAssociatedBase {
782
765
  });
783
766
  };
784
767
  #handleClick({ type, target }) {
785
- if (devFlags.debug)
786
- console.debug(`${_a.name} ⚡️ ${type}`);
768
+ debug(`${_a.name} ⚡️ ${type}`);
787
769
  if (!(target instanceof HTMLElement))
788
770
  return;
789
771
  const btn = target.closest('button');
@@ -795,8 +777,7 @@ export class PickerView extends FormAssociatedBase {
795
777
  this.#sendValueToForm();
796
778
  }
797
779
  #handleValiditiesSlotchange = ({ type, target: slot }) => {
798
- if (devFlags.debug)
799
- console.debug(`${_a.name} ⚡️ ${type}`);
780
+ debug(`${_a.name} ⚡️ ${type}`);
800
781
  if (!(slot instanceof HTMLSlotElement))
801
782
  return;
802
783
  const assigned = slot.assignedElements();
@@ -805,8 +786,7 @@ export class PickerView extends FormAssociatedBase {
805
786
  this.#renderValidityMsgs([]);
806
787
  };
807
788
  #handleListSlotchange = ({ type, target: slot }) => {
808
- if (devFlags.debug)
809
- console.debug(`${_a.name} ⚡️ ${type}`);
789
+ debug(`${_a.name} ⚡️ ${type}`);
810
790
  if (!(slot instanceof HTMLSlotElement))
811
791
  return;
812
792
  const assigned = slot.assignedElements();
@@ -815,8 +795,7 @@ export class PickerView extends FormAssociatedBase {
815
795
  this.#renderSlotted([]);
816
796
  };
817
797
  static #wrapOptionSpawnTag(node) {
818
- if (devFlags.debug)
819
- console.debug(`${_a.name} #wrapOptionSpawnTag`);
798
+ debug(`${_a.name} #wrapOptionSpawnTag`);
820
799
  const title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
821
800
  const mount = document.createElement('div');
822
801
  render(html `<button type="button" tabindex="0" navigation-link>
@@ -854,8 +833,7 @@ export class PickerView extends FormAssociatedBase {
854
833
  return mount.firstElementChild; //btn
855
834
  }
856
835
  static #wrapOptionTag(node) {
857
- if (devFlags.debug)
858
- console.debug(`${_a.name} #wrapOptionTag`);
836
+ debug(`${_a.name} #wrapOptionTag`);
859
837
  const tag = extractTag(node), title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
860
838
  const mount = document.createElement('div');
861
839
  render(html `<button type="button" tabindex="0" value="${tag}">
@@ -887,8 +865,7 @@ export class PickerView extends FormAssociatedBase {
887
865
  return mount.firstElementChild; //btn
888
866
  }
889
867
  static #wrapOptgroupTag(node) {
890
- if (devFlags.debug)
891
- console.debug(`${_a.name} #wrapOptgroupTag`);
868
+ debug(`${_a.name} #wrapOptgroupTag`);
892
869
  const title = extractLabel(node), subtitle = extractSubtitle(node), icon = extractIcon(node);
893
870
  const mount = document.createElement('div');
894
871
  render(html `<details is="disclosure-group" disclosure-style="marker-trailing">
@@ -921,8 +898,7 @@ export class PickerView extends FormAssociatedBase {
921
898
  // static #reflectButtons(nodes: Element[], container: Element): void
922
899
  // static #reflectButtons(nodes: Dictionary, container: Element): void
923
900
  static #reflectButtons(nodes, container) {
924
- if (devFlags.debug)
925
- console.debug(`${_a.name} #reflectButtons`);
901
+ debug(`${_a.name} #reflectButtons`);
926
902
  for (const node of nodes)
927
903
  if (node instanceof Element)
928
904
  switch (node.tagName) {
@@ -1004,7 +980,7 @@ export class PickerView extends FormAssociatedBase {
1004
980
  }
1005
981
  }
1006
982
  // #reflectPlaceholder(value: string | null) {
1007
- // if (devFlags.debug) console.debug(`#reflectPlaceholder`)
983
+ // debug(`#reflectPlaceholder`)
1008
984
  // const input = this.#shadowRoot.querySelector('input')
1009
985
  // if (input) {
1010
986
  // if (value) input.setAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER, value)
@@ -1012,14 +988,12 @@ export class PickerView extends FormAssociatedBase {
1012
988
  // }
1013
989
  // }
1014
990
  #reflectLabel(value) {
1015
- if (devFlags.debug)
1016
- console.debug(`${_a.name} #reflectLabel`);
991
+ debug(`${_a.name} #reflectLabel`);
1017
992
  queryMorph('[slot=label]', html `<label-view slot="label">${value ? html `<span>${value}</span>` : null}</label-view>`, this);
1018
993
  this.#renderSlotted([]);
1019
994
  }
1020
995
  #reflectSelectionOnButtons() {
1021
- if (devFlags.debug)
1022
- console.debug(`${_a.name} #reflectSelectionOnButtons`);
996
+ debug(`${_a.name} #reflectSelectionOnButtons`);
1023
997
  self.requestAnimationFrame(() => {
1024
998
  this.ariaCurrent = this.#selection;
1025
999
  const groupMap = indexGroups(this.#lastIndexedRoot);
@@ -1050,8 +1024,7 @@ export class PickerView extends FormAssociatedBase {
1050
1024
  * Overwrite cvlabel with the label prop of the current(find[value === #selection]) option/dictentry
1051
1025
  */
1052
1026
  #reflectSelectionOnCurrentValueLabel() {
1053
- if (devFlags.debug)
1054
- console.debug(`${_a.name} #reflectSelectionOnCurrentValueLabel`);
1027
+ debug(`${_a.name} #reflectSelectionOnCurrentValueLabel`);
1055
1028
  self.requestAnimationFrame(() => {
1056
1029
  switch (this.pickerStyle) {
1057
1030
  case 'sheet':
@@ -1094,8 +1067,7 @@ export class PickerView extends FormAssociatedBase {
1094
1067
  });
1095
1068
  }
1096
1069
  #reflectTriggerHelp() {
1097
- if (devFlags.debug)
1098
- console.debug(`${_a.name} #reflectTriggerHelp`);
1070
+ debug(`${_a.name} #reflectTriggerHelp`);
1099
1071
  let trigger;
1100
1072
  switch (this.pickerStyle) {
1101
1073
  case 'sheet':
@@ -1150,8 +1122,7 @@ export class PickerView extends FormAssociatedBase {
1150
1122
  message = kebabCase(key);
1151
1123
  break;
1152
1124
  }
1153
- if (devFlags.debug)
1154
- console.debug(`${_a.name} ⚡️ validity-change`);
1125
+ debug(`${_a.name} ⚡️ validity-change`);
1155
1126
  return this.#internals.setValidity(flags, this.#customValidity || message, anchor);
1156
1127
  };
1157
1128
  setCustomValidity = (message) => {
@@ -1,18 +1,16 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { devFlags, onoff } from '../internal/utils';
2
+ import { debug, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
4
  export class PlainButton extends ButtonBase {
5
5
  constructor() {
6
6
  super();
7
7
  }
8
8
  static polyfillDisconnectedCallback(el) {
9
- if (devFlags.debug)
10
- console.debug(`${PlainButton.name} ⚡️ disconnect`);
9
+ debug(`${PlainButton.name} ⚡️ disconnect`);
11
10
  CleanupRegistry.unregister(el);
12
11
  }
13
12
  static polyfillConnectedCallback(el) {
14
- if (devFlags.debug)
15
- console.debug(`${PlainButton.name} ⚡️ connect`);
13
+ debug(`${PlainButton.name} ⚡️ connect`);
16
14
  el.tabIndex = 0;
17
15
  CleanupRegistry.register(el, onoff('click', PlainButton.#handleClick, el).on());
18
16
  }
@@ -1,7 +1,7 @@
1
1
  var _a;
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
3
  import { CSSStyleObserver } from '../internal/class/css-style-observer';
4
- import { $, devFlags } from '../internal/utils';
4
+ import { $, debug } from '../internal/utils';
5
5
  import { queryMorph } from '../morphdom';
6
6
  import { Snapshot } from '../snapshot';
7
7
  import { html } from '../tpl';
@@ -60,8 +60,7 @@ export class ProgressView extends HTMLElement {
60
60
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
61
61
  }
62
62
  attributeChangedCallback(name, oldValue, newValue) {
63
- if (devFlags.debug)
64
- console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
63
+ debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
65
64
  switch (name) {
66
65
  case 'label': {
67
66
  const label = this.querySelector(':scope>label-view:not([slot])') ?? this.appendChild($(html `<label-view foreground="secondary"></label-view>`, '>1'));
@@ -79,13 +78,11 @@ export class ProgressView extends HTMLElement {
79
78
  }
80
79
  }
81
80
  disconnectedCallback() {
82
- if (devFlags.debug)
83
- console.debug(`${_a.name} ⚡️ disconnect`);
81
+ debug(`${_a.name} ⚡️ disconnect`);
84
82
  CleanupRegistry.unregister(this);
85
83
  }
86
84
  connectedCallback() {
87
- if (devFlags.debug)
88
- console.debug(`${_a.name} ⚡️ connect`);
85
+ debug(`${_a.name} ⚡️ connect`);
89
86
  this.inert = true;
90
87
  this.#cssStyleObserver = new CSSStyleObserver({
91
88
  properties: ['--progress-view-style-index'],
@@ -94,8 +91,7 @@ export class ProgressView extends HTMLElement {
94
91
  Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange));
95
92
  }
96
93
  #handleStyleChange = () => {
97
- if (devFlags.debug)
98
- console.debug(`${_a.name} ⚡️ style`);
94
+ debug(`${_a.name} ⚡️ style`);
99
95
  const raw = self.getComputedStyle(this).getPropertyValue('--progress-view-style-index').trim();
100
96
  const newValue = progressViewStyles[Number(raw)] ?? progressViewStyles[0];
101
97
  if (newValue === this.#progressViewStyle)
@@ -104,8 +100,7 @@ export class ProgressView extends HTMLElement {
104
100
  this.#render();
105
101
  };
106
102
  #render() {
107
- if (devFlags.debug)
108
- console.debug(`${_a.name} ⚡️ #render (${this.#progressViewStyle})`);
103
+ debug(`${_a.name} ⚡️ #render (${this.#progressViewStyle})`);
109
104
  if (this.#lastRenderedStyle === this.#progressViewStyle)
110
105
  return; // skip if already applied
111
106
  this.#lastRenderedStyle = this.#progressViewStyle;
@@ -1,11 +1,10 @@
1
- import { devFlags } from '../internal/utils';
1
+ import { debug } from '../internal/utils';
2
2
  import { DialogBase } from '../namespace-browser/base';
3
3
  export class ScreenView extends DialogBase {
4
4
  constructor() {
5
5
  super();
6
6
  }
7
7
  disconnectedCallback() {
8
- if (devFlags.debug)
9
- console.debug(`${ScreenView.name} ⚡️ disconnect`);
8
+ debug(`${ScreenView.name} ⚡️ disconnect`);
10
9
  }
11
10
  }
@@ -1,4 +1,4 @@
1
- import { devFlags } from '../internal/utils';
1
+ import { debug } from '../internal/utils';
2
2
  /**
3
3
  * @summary A wrapper for {hv}-stacks
4
4
  */
@@ -7,11 +7,9 @@ export class ScrollViewProxy extends HTMLElement {
7
7
  super();
8
8
  }
9
9
  disconnectedCallback() {
10
- if (devFlags.debug)
11
- console.debug(`${ScrollViewProxy.name} ⚡️ disconnect`);
10
+ debug(`${ScrollViewProxy.name} ⚡️ disconnect`);
12
11
  }
13
12
  connectedCallback() {
14
- if (devFlags.debug)
15
- console.debug(`${ScrollViewProxy.name} ⚡️ connect`);
13
+ debug(`${ScrollViewProxy.name} ⚡️ connect`);
16
14
  }
17
15
  }
@@ -2,7 +2,7 @@ var _a;
2
2
  import { lifecycleObserver } from '../buses';
3
3
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
4
4
  import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
5
- import { $, devFlags, frame, onoff, slowHideShow } from '../internal/utils';
5
+ import { $, debug, frame, onoff, slowHideShow } from '../internal/utils';
6
6
  import { queryMorph } from '../morphdom';
7
7
  import { html } from '../tpl';
8
8
  const observers = new ResizeObserverSingleton();
@@ -57,8 +57,7 @@ export class ScrollView extends HTMLElement {
57
57
  });
58
58
  }
59
59
  attributeChangedCallback(name, oldValue, newValue) {
60
- if (devFlags.debug)
61
- console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
60
+ debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
62
61
  switch (name) {
63
62
  case 'navigation-inline-title':
64
63
  this.#renderNavTitle(newValue, this.getAttribute('navigation-inline-subtitle'));
@@ -80,15 +79,13 @@ export class ScrollView extends HTMLElement {
80
79
  }
81
80
  }
82
81
  disconnectedCallback() {
83
- if (devFlags.debug)
84
- console.debug(`${_a.name} ⚡️ disconnect`);
82
+ debug(`${_a.name} ⚡️ disconnect`);
85
83
  CleanupRegistry.unregister(this);
86
84
  observers.unobserve(this);
87
85
  frame().then(() => lifecycleObserver.dispatchEvent(new CustomEvent('pagehide', { detail: { page: this }, bubbles: true, composed: true })));
88
86
  }
89
87
  connectedCallback() {
90
- if (devFlags.debug)
91
- console.debug(`${_a.name} ⚡️ connect`);
88
+ debug(`${_a.name} ⚡️ connect`);
92
89
  CleanupRegistry.register(this, onoff([
93
90
  // { types: 'tabreveal', listener: this.#handleTabReveal as EventListener },
94
91
  { types: 'beforetabswap', listener: this.#handleTabBeforeswap },
@@ -122,8 +119,7 @@ export class ScrollView extends HTMLElement {
122
119
  slowHideShow('largeinline' === `${comp}` ? 'show' : 'hide', title);
123
120
  };
124
121
  #handleScroll = ({ target, type }) => {
125
- if (devFlags.debug)
126
- console.debug(`${_a.name} ⚡️ ${type}`);
122
+ debug(`${_a.name} ⚡️ ${type}`);
127
123
  if (!this.#isMidScroll)
128
124
  this.#isMidScroll = true;
129
125
  // if (this.#stopRecordingScrollTop) return
@@ -132,14 +128,12 @@ export class ScrollView extends HTMLElement {
132
128
  this.#lastScrollTop = target.scrollTop;
133
129
  };
134
130
  #handleScrollend = (evt) => {
135
- if (devFlags.debug)
136
- console.debug(`${_a.name} ⚡️ ${evt?.type}`);
131
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
137
132
  if (this.#isMidScroll)
138
133
  this.#isMidScroll = false;
139
134
  };
140
135
  #handleMeasure = (entry) => {
141
- if (devFlags.debug)
142
- console.debug(`${_a.name} ⚡️ measure`);
136
+ debug(`${_a.name} ⚡️ measure`);
143
137
  if (0 === entry.contentRect.width + entry.contentRect.height)
144
138
  return;
145
139
  if (undefined === this.#beforeTabSwapLastScrolltop)
@@ -156,7 +150,7 @@ export class ScrollView extends HTMLElement {
156
150
  this.#beforeTabSwapLastScrolltop = undefined;
157
151
  };
158
152
  // #handleTabReveal = ({ type, target }: CustomEvent<TabDetail>) => {
159
- // if (devFlags.debug) console.debug(`${ScrollView.name} ⚡️ ${type}`)
153
+ // debug(`${ScrollView.name} ⚡️ ${type}`)
160
154
  // if (!(target instanceof HTMLElement)) return
161
155
  // if (!target.contains(this)) return
162
156
  // if (this.closest('[hidden]')) return
@@ -184,8 +178,7 @@ export class ScrollView extends HTMLElement {
184
178
  // // })
185
179
  // }
186
180
  #handleTabBeforeswap = ({ type, target }) => {
187
- if (devFlags.debug)
188
- console.debug(`${_a.name} ⚡️ ${type}`);
181
+ debug(`${_a.name} ⚡️ ${type}`);
189
182
  if (!(target instanceof HTMLElement))
190
183
  return;
191
184
  if (!target.contains(this))
@@ -1,24 +1,21 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { devFlags, onoff, touchGlass } from '../internal/utils';
2
+ import { debug, onoff, touchGlass } from '../internal/utils';
3
3
  import { InputBase } from '../namespace-browser/base';
4
4
  export class SearchView extends InputBase {
5
5
  constructor() {
6
6
  super();
7
7
  }
8
8
  static polyfillDisconnectedCallback(el) {
9
- if (devFlags.debug)
10
- console.debug(`${SearchView.name} ⚡️ disconnect`);
9
+ debug(`${SearchView.name} ⚡️ disconnect`);
11
10
  CleanupRegistry.unregister(el);
12
11
  }
13
12
  static polyfillConnectedCallback(el) {
14
- if (devFlags.debug)
15
- console.debug(`${SearchView.name} ⚡️ connect`);
13
+ debug(`${SearchView.name} ⚡️ connect`);
16
14
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
17
15
  el.type = 'search';
18
16
  }
19
17
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
20
- if (devFlags.debug)
21
- console.debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
18
+ debug(`${SearchView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
22
19
  const node = target instanceof HTMLInputElement;
23
20
  if (!node)
24
21
  return;
@@ -1,4 +1,4 @@
1
- import { $, devFlags } from '../internal/utils';
1
+ import { $, debug } from '../internal/utils';
2
2
  import { queryMorph } from '../morphdom';
3
3
  import { html } from '../tpl';
4
4
  /**
@@ -32,8 +32,7 @@ export class SectionView extends HTMLElement {
32
32
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
33
33
  }
34
34
  attributeChangedCallback(name, oldValue, newValue) {
35
- if (devFlags.debug)
36
- console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
35
+ debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
37
36
  switch (name) {
38
37
  case 'header':
39
38
  queryMorph('[slot=header]', html `<header slot="header">
@@ -52,13 +51,11 @@ export class SectionView extends HTMLElement {
52
51
  }
53
52
  }
54
53
  disconnectedCallback() {
55
- if (devFlags.debug)
56
- console.debug(`${SectionView.name} ⚡️ disconnect`);
54
+ debug(`${SectionView.name} ⚡️ disconnect`);
57
55
  //
58
56
  }
59
57
  connectedCallback() {
60
- if (devFlags.debug)
61
- console.debug(`${SectionView.name} ⚡️ connect`);
58
+ debug(`${SectionView.name} ⚡️ connect`);
62
59
  //
63
60
  }
64
61
  }
@@ -1,5 +1,5 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { devFlags, onoff } from '../internal/utils';
2
+ import { debug, onoff } from '../internal/utils';
3
3
  import { DialogBase } from '../namespace-browser/base';
4
4
  /**
5
5
  * @summary A dialog that slides up over the current screen.
@@ -9,13 +9,11 @@ export class SheetView extends DialogBase {
9
9
  super();
10
10
  }
11
11
  static polyfillDisconnectedCallback(el) {
12
- if (devFlags.debug)
13
- console.debug(`${SheetView.name} ⚡️ disconnect`);
12
+ debug(`${SheetView.name} ⚡️ disconnect`);
14
13
  CleanupRegistry.unregister(el);
15
14
  }
16
15
  static polyfillConnectedCallback(el) {
17
- if (devFlags.debug)
18
- console.debug(`${SheetView.name} ⚡️ connect`);
16
+ debug(`${SheetView.name} ⚡️ connect`);
19
17
  CleanupRegistry.register(el, onoff([
20
18
  { types: 'cancel', listener: this.#handleCancel },
21
19
  { types: 'keydown', listener: SheetView.#handleKeydown },
@@ -23,12 +21,10 @@ export class SheetView extends DialogBase {
23
21
  el.autofocus = true;
24
22
  }
25
23
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
26
- if (devFlags.debug)
27
- console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
24
+ debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
28
25
  }
29
26
  static #handleKeydown = (evt) => {
30
- if (devFlags.debug)
31
- console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
27
+ debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.key})`);
32
28
  if ('Escape' !== evt.key)
33
29
  return;
34
30
  evt.preventDefault();
@@ -36,8 +32,7 @@ export class SheetView extends DialogBase {
36
32
  evt.stopPropagation();
37
33
  };
38
34
  static #handleCancel = (evt) => {
39
- if (devFlags.debug)
40
- console.debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
35
+ debug(`${SheetView.name} ⚡️ ${evt?.type} (${evt.cancelable})`);
41
36
  if (!evt.cancelable)
42
37
  return;
43
38
  evt.preventDefault();
@@ -1,7 +1,7 @@
1
1
  var _a;
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
3
  import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
4
- import { debounce, devFlags, onoff } from '../internal/utils';
4
+ import { debounce, debug, onoff } from '../internal/utils';
5
5
  const observers = new ResizeObserverSingleton();
6
6
  /**
7
7
  * @summary A control that shows or hides the sidebar view.
@@ -11,14 +11,12 @@ export class SidebarToggle extends HTMLElement {
11
11
  super();
12
12
  }
13
13
  disconnectedCallback() {
14
- if (devFlags.debug)
15
- console.debug(`${_a.name} ⚡️ disconnect`);
14
+ debug(`${_a.name} ⚡️ disconnect`);
16
15
  observers.unobserve(this);
17
16
  CleanupRegistry.unregister(this);
18
17
  }
19
18
  connectedCallback() {
20
- if (devFlags.debug)
21
- console.debug(`${_a.name} ⚡️ connect`);
19
+ debug(`${_a.name} ⚡️ connect`);
22
20
  CleanupRegistry.register(this, onoff('click', this.#handleClick, this).on());
23
21
  const entry = {
24
22
  target: this,
@@ -33,8 +31,7 @@ export class SidebarToggle extends HTMLElement {
33
31
  }
34
32
  // This triggers on show/hide of any of sidebar-toggle elements
35
33
  static #handleMeasure(entry) {
36
- if (devFlags.debug)
37
- console.debug(`${_a.name} ⚡️ measure`);
34
+ debug(`${_a.name} ⚡️ measure`);
38
35
  const { target } = entry ?? {};
39
36
  if (!(target instanceof HTMLElement))
40
37
  return;
@@ -72,8 +69,7 @@ export class SidebarToggle extends HTMLElement {
72
69
  });
73
70
  }
74
71
  #handleClick({ target, type }) {
75
- if (devFlags.debug)
76
- console.debug(`${_a.name} ⚡️ ${type}`);
72
+ debug(`${_a.name} ⚡️ ${type}`);
77
73
  if (!(target instanceof HTMLElement))
78
74
  return;
79
75
  if (!target?.closest('button'))
@@ -1,5 +1,5 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { devFlags, onoff, touchGlass } from '../internal/utils';
2
+ import { debug, onoff, touchGlass } from '../internal/utils';
3
3
  import { DialogBase } from '../namespace-browser/base';
4
4
  /**
5
5
  * @summary A container view that arranges navigation destinations in a single column.
@@ -27,8 +27,7 @@ export class SidebarView extends DialogBase {
27
27
  }
28
28
  // Autoclose on click outside.
29
29
  static #handleClick = async ({ target, type }) => {
30
- if (devFlags.debug)
31
- console.debug(`${SidebarView.name} ⚡️ ${type}`);
30
+ debug(`${SidebarView.name} ⚡️ ${type}`);
32
31
  if (!(target instanceof HTMLElement))
33
32
  return;
34
33
  if (target instanceof HTMLDialogElement && 'sidebar-view' === target.getAttribute('is'))