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

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