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

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 (79) hide show
  1. package/generated/client/index.js +6 -7
  2. package/generated/components/alert-dialog.js +9 -10
  3. package/generated/components/body-view.js +3 -3
  4. package/generated/components/bordered-button.js +4 -5
  5. package/generated/components/bordered-prominent-button.js +4 -5
  6. package/generated/components/borderless-button.js +4 -5
  7. package/generated/components/color-scheme.js +4 -4
  8. package/generated/components/confirmation-dialog.js +9 -10
  9. package/generated/components/content-unavailable.js +4 -5
  10. package/generated/components/date-picker.js +13 -14
  11. package/generated/components/detail-placeholder.js +4 -4
  12. package/generated/components/disclosure-group.js +5 -6
  13. package/generated/components/fine-tooltip.js +4 -5
  14. package/generated/components/form-view.js +3 -4
  15. package/generated/components/glass-button.js +4 -5
  16. package/generated/components/glass-prominent-button.js +4 -5
  17. package/generated/components/h-divider.js +4 -4
  18. package/generated/components/h-stack.js +3 -3
  19. package/generated/components/image-view.js +4 -5
  20. package/generated/components/label-view.js +4 -5
  21. package/generated/components/labeled-content.js +4 -5
  22. package/generated/components/list-view.d.ts +1 -0
  23. package/generated/components/list-view.js +4 -4
  24. package/generated/components/menu-view.js +10 -11
  25. package/generated/components/navigation-large-title.d.ts +0 -1
  26. package/generated/components/navigation-large-title.js +5 -7
  27. package/generated/components/navigation-split-view.js +4 -4
  28. package/generated/components/navigation-stack.js +4 -4
  29. package/generated/components/navigation-title.js +4 -4
  30. package/generated/components/picker-view.js +31 -32
  31. package/generated/components/plain-button.js +3 -4
  32. package/generated/components/progress-view.js +6 -7
  33. package/generated/components/screen-view.js +2 -2
  34. package/generated/components/scroll-view-proxy.js +3 -3
  35. package/generated/components/scroll-view.js +9 -10
  36. package/generated/components/search-view.js +4 -5
  37. package/generated/components/section-view.js +4 -5
  38. package/generated/components/sheet-view.js +6 -7
  39. package/generated/components/sidebar-toggle.js +5 -6
  40. package/generated/components/sidebar-view.js +2 -3
  41. package/generated/components/sticky-container.js +3 -4
  42. package/generated/components/tab-bar.js +4 -5
  43. package/generated/components/tab-item.js +8 -9
  44. package/generated/components/tab-view.js +7 -8
  45. package/generated/components/table-view.js +6 -7
  46. package/generated/components/text-field.js +10 -11
  47. package/generated/components/text-view.js +4 -4
  48. package/generated/components/toggle-view.js +21 -15
  49. package/generated/components/tool-bar-item-group.js +3 -3
  50. package/generated/components/tool-bar-item.js +4 -5
  51. package/generated/components/tool-bar.js +4 -5
  52. package/generated/components/v-divider.js +4 -4
  53. package/generated/components/v-keyboard.js +5 -6
  54. package/generated/components/v-stack.js +3 -3
  55. package/generated/css/index.css +76 -11
  56. package/generated/internal/class/css-style-observer.js +2 -3
  57. package/generated/internal/class/form-associated-base.js +5 -5
  58. package/generated/internal/class/navigation-view.js +3 -4
  59. package/generated/internal/decorators/adaptive-slot.js +4 -5
  60. package/generated/internal/privateNamespace.d.ts +1 -1
  61. package/generated/internal/privateNamespace.js +12 -12
  62. package/generated/internal/utils/debug.d.ts +1 -0
  63. package/generated/internal/utils/debug.js +4 -0
  64. package/generated/internal/utils/index.d.ts +2 -2
  65. package/generated/internal/utils/index.js +2 -2
  66. package/generated/internal/utils/is-inside.js +1 -1
  67. package/generated/snapshot/index.js +3 -4
  68. package/package.json +2 -1
  69. package/scss/_utils.scss +2 -0
  70. package/scss/base/_root.scss +6 -3
  71. package/scss/colors/_index.scss +11 -0
  72. package/scss/components/_navigation-large-title.scss +14 -8
  73. package/scss/components/_scroll-view.scss +12 -0
  74. package/scss/components/_toggle-view.scss +10 -0
  75. package/scss/utils/_background.scss +52 -0
  76. package/scss/utils/_index.scss +20 -17
  77. package/web-components.html-data/en.json +11 -11
  78. package/generated/internal/utils/dev-flags.d.ts +0 -3
  79. package/generated/internal/utils/dev-flags.js +0 -5
@@ -4,10 +4,10 @@ import { I18n } from '../i18n';
4
4
  import { NavigationPath } from '../internal/class/navigation-path';
5
5
  import flags from '../internal/flags.json' with { type: 'json' };
6
6
  import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
7
- import { $, kebabCase, onoff } from '../internal/utils';
7
+ import { $, debug, kebabCase, onoff } from '../internal/utils';
8
8
  import { Snapshot } from '../snapshot';
9
9
  import { html, render } from '../tpl';
10
- flags.DEBUG && console.debug(flags);
10
+ debug(flags);
11
11
  //#region polyfills
12
12
  export const polyfills = new Map();
13
13
  for (const [k, Ctor] of Object.entries(Components)) {
@@ -16,11 +16,10 @@ for (const [k, Ctor] of Object.entries(Components)) {
16
16
  if (customElements.get(is))
17
17
  continue;
18
18
  customElements.define(is, Ctor, { extends: Ctor.polyfillExtends });
19
+ // NOTE: Test via the imperative creation path
19
20
  if (!(document.createElement(Ctor.polyfillExtends, { is }) instanceof Ctor))
20
21
  polyfills.set(is, Ctor);
21
- // const testEl = document.createElement('template')
22
- // testEl.innerHTML = `<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`
23
- // const testNode = testEl.content.firstElementChild,
22
+ // NOTE: Defensive, test again via the HTML-parsing path
24
23
  if (!($(html `<${Ctor.polyfillExtends} is="${is}"></${Ctor.polyfillExtends}>`, '>1') instanceof Ctor))
25
24
  polyfills.set(is, Ctor);
26
25
  continue;
@@ -28,7 +27,7 @@ for (const [k, Ctor] of Object.entries(Components)) {
28
27
  if (!customElements.get(is))
29
28
  customElements.define(is, Ctor);
30
29
  }
31
- flags.DEBUG && console.debug(polyfills);
30
+ debug(polyfills);
32
31
  if (0 < polyfills.size) {
33
32
  const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
34
33
  const handlers = new WeakMap();
@@ -58,7 +57,7 @@ if (0 < polyfills.size) {
58
57
  }, unobserve = (el) => {
59
58
  handlers.delete(el);
60
59
  }, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
61
- flags.DEBUG && console.debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
60
+ debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
62
61
  for (const [is, polyfill] of polyfills)
63
62
  for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
64
63
  polyfill.polyfillConnectedCallback(el);
@@ -1,7 +1,6 @@
1
1
  import { alertDialog } from '../buses';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
4
- import { onoff, touchGlass } from '../internal/utils';
3
+ import { debug, onoff, touchGlass } from '../internal/utils';
5
4
  import { DialogBase } from '../namespace-browser/base';
6
5
  /**
7
6
  * @summary A dialog that shows a message. Use it from the client module like `void alert('Save failed.')`.
@@ -11,7 +10,7 @@ export class AlertDialog extends DialogBase {
11
10
  super();
12
11
  }
13
12
  static polyfillDisconnectedCallback(el) {
14
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ disconnect`);
13
+ debug(`${AlertDialog.name} ⚡️ disconnect`);
15
14
  CleanupRegistry.unregister(el);
16
15
  alertDialog.dispatchEvent(new CustomEvent('alert:return', {
17
16
  detail: { returnValue: el.returnValue },
@@ -20,7 +19,7 @@ export class AlertDialog extends DialogBase {
20
19
  }));
21
20
  }
22
21
  static polyfillConnectedCallback(el) {
23
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ connect`);
22
+ debug(`${AlertDialog.name} ⚡️ connect`);
24
23
  CleanupRegistry.register(el, onoff([
25
24
  { types: 'click', listener: this.#handleDialogClick },
26
25
  { types: 'close', listener: this.#handleDialogClose },
@@ -33,7 +32,7 @@ export class AlertDialog extends DialogBase {
33
32
  return false;
34
33
  return true;
35
34
  }), el).on());
36
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ will-open`);
35
+ debug(`${AlertDialog.name} ⚡️ will-open`);
37
36
  el.removeAttribute('closing');
38
37
  el.scrollTop = 0;
39
38
  el.returnValue = '';
@@ -41,7 +40,7 @@ export class AlertDialog extends DialogBase {
41
40
  el.showModal();
42
41
  }
43
42
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
44
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
43
+ debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
45
44
  switch (attributeName) {
46
45
  case 'label':
47
46
  //
@@ -49,7 +48,7 @@ export class AlertDialog extends DialogBase {
49
48
  }
50
49
  }
51
50
  static #handleDialogClick = (evt) => {
52
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
51
+ debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
53
52
  const { target, currentTarget: dialog } = evt;
54
53
  if (!(dialog instanceof HTMLDialogElement))
55
54
  return;
@@ -69,7 +68,7 @@ export class AlertDialog extends DialogBase {
69
68
  evt.stopImmediatePropagation();
70
69
  };
71
70
  static #handleDialogCancel = (evt) => {
72
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
71
+ debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
73
72
  if (!evt.cancelable)
74
73
  return;
75
74
  const { target } = evt;
@@ -77,7 +76,7 @@ export class AlertDialog extends DialogBase {
77
76
  return;
78
77
  evt.preventDefault();
79
78
  target.inert = true;
80
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ will-close`);
79
+ debug(`${AlertDialog.name} ⚡️ will-close`);
81
80
  target.setAttribute('closing', '');
82
81
  Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
83
82
  if (!target.hasAttribute('closing'))
@@ -87,7 +86,7 @@ export class AlertDialog extends DialogBase {
87
86
  });
88
87
  };
89
88
  static #handleDialogClose = ({ type, target }) => {
90
- DEBUG && console.debug(`${AlertDialog.name} ⚡️ ${type}`);
89
+ debug(`${AlertDialog.name} ⚡️ ${type}`);
91
90
  if (!(target instanceof HTMLDialogElement))
92
91
  return;
93
92
  target.remove();
@@ -1,4 +1,4 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
1
+ import { debug } from '../internal/utils';
2
2
  /**
3
3
  * @summary A container view that wraps a scroll view, marking it as a screen your app can navigate to.
4
4
  */
@@ -7,9 +7,9 @@ export class BodyView extends HTMLElement {
7
7
  super();
8
8
  }
9
9
  disconnectedCallback() {
10
- DEBUG && console.debug(`${BodyView.name} ⚡️ disconnect`);
10
+ debug(`${BodyView.name} ⚡️ disconnect`);
11
11
  }
12
12
  connectedCallback() {
13
- DEBUG && console.debug(`${BodyView.name} ⚡️ connect`);
13
+ debug(`${BodyView.name} ⚡️ connect`);
14
14
  }
15
15
  }
@@ -1,6 +1,5 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
3
- import { ensurePlaceholder, onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
4
3
  import { ButtonBase } from '../namespace-browser/base';
5
4
  import { Snapshot } from '../snapshot';
6
5
  /**
@@ -26,16 +25,16 @@ export class BorderedButton extends ButtonBase {
26
25
  super();
27
26
  }
28
27
  static polyfillDisconnectedCallback(el) {
29
- DEBUG && console.debug(`${BorderedButton.name} ⚡️ disconnect`);
28
+ debug(`${BorderedButton.name} ⚡️ disconnect`);
30
29
  CleanupRegistry.unregister(el);
31
30
  }
32
31
  static polyfillConnectedCallback(el) {
33
- DEBUG && console.debug(`${BorderedButton.name} ⚡️ connect`);
32
+ debug(`${BorderedButton.name} ⚡️ connect`);
34
33
  el.tabIndex = 0;
35
34
  CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
36
35
  }
37
36
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
38
- DEBUG && console.debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
37
+ debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
39
38
  const node = target instanceof HTMLButtonElement;
40
39
  if (!node)
41
40
  return;
@@ -1,6 +1,5 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { ensurePlaceholder, onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
4
3
  import { ButtonBase } from '../namespace-browser/base';
5
4
  import { Snapshot } from '../snapshot';
6
5
  /**
@@ -26,16 +25,16 @@ export class BorderedProminentButton extends ButtonBase {
26
25
  super();
27
26
  }
28
27
  static polyfillDisconnectedCallback(el) {
29
- DEBUG && console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
28
+ debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
30
29
  CleanupRegistry.unregister(el);
31
30
  }
32
31
  static polyfillConnectedCallback(el) {
33
- DEBUG && console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
32
+ debug(`${BorderedProminentButton.name} ⚡️ connect`);
34
33
  el.tabIndex = 0;
35
34
  CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
36
35
  }
37
36
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
38
- DEBUG && console.debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
37
+ debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
39
38
  const node = target instanceof HTMLButtonElement;
40
39
  if (!node)
41
40
  return;
@@ -1,6 +1,5 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { ensurePlaceholder, onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
4
3
  import { ButtonBase } from '../namespace-browser/base';
5
4
  import { Snapshot } from '../snapshot';
6
5
  /**
@@ -26,16 +25,16 @@ export class BorderlessButton extends ButtonBase {
26
25
  super();
27
26
  }
28
27
  static polyfillDisconnectedCallback(el) {
29
- DEBUG && console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
28
+ debug(`${BorderlessButton.name} ⚡️ disconnect`);
30
29
  CleanupRegistry.unregister(el);
31
30
  }
32
31
  static polyfillConnectedCallback(el) {
33
- DEBUG && console.debug(`${BorderlessButton.name} ⚡️ connect`);
32
+ debug(`${BorderlessButton.name} ⚡️ connect`);
34
33
  el.tabIndex = 0;
35
34
  CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
36
35
  }
37
36
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
38
- DEBUG && console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
37
+ debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
39
38
  const node = target instanceof HTMLButtonElement;
40
39
  if (!node)
41
40
  return;
@@ -1,4 +1,4 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
1
+ import { debug } from '../internal/utils';
2
2
  export class ColorScheme extends HTMLElement {
3
3
  static get observedAttributes() {
4
4
  return ['dark'];
@@ -7,15 +7,15 @@ export class ColorScheme extends HTMLElement {
7
7
  super();
8
8
  }
9
9
  connectedCallback() {
10
- DEBUG && console.debug(`${ColorScheme.name} ⚡️ connect`);
10
+ debug(`${ColorScheme.name} ⚡️ connect`);
11
11
  this.hidden = true;
12
12
  this.inert = true;
13
13
  }
14
14
  disconnectedCallback() {
15
- DEBUG && console.debug(`${ColorScheme.name} ⚡️ disconnect`);
15
+ debug(`${ColorScheme.name} ⚡️ disconnect`);
16
16
  }
17
17
  attributeChangedCallback(name, oldValue, newValue) {
18
- DEBUG && console.debug(`${ColorScheme.name} ⚡️ attr-change [${name}]`);
18
+ debug(`${ColorScheme.name} ⚡️ attr-change [${name}]`);
19
19
  // self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(100% 0 0deg)' })
20
20
  if (newValue)
21
21
  self.CSS.registerProperty({ name: '--canvas', syntax: '<color>', inherits: false, initialValue: 'oklch(0% 0 0deg)' });
@@ -1,7 +1,6 @@
1
1
  import { confirmationDialog } from '../buses';
2
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
3
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
4
- import { isInside, onoff, touchGlass } from '../internal/utils';
3
+ import { debug, isInside, onoff, touchGlass } from '../internal/utils';
5
4
  import { DialogBase } from '../namespace-browser/base';
6
5
  /**
7
6
  * @summary A dialog that asks the user to confirm an action. Use it from the client module like `await confirmationDialog(trigger, 'Permanently erase the items in the Trash?')`.
@@ -14,7 +13,7 @@ export class ConfirmationDialog extends DialogBase {
14
13
  super();
15
14
  }
16
15
  static polyfillDisconnectedCallback(el) {
17
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
16
+ debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
18
17
  const positionAnchor = el.style.getPropertyValue('position-anchor');
19
18
  document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
20
19
  el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
@@ -26,7 +25,7 @@ export class ConfirmationDialog extends DialogBase {
26
25
  }));
27
26
  }
28
27
  static polyfillConnectedCallback(el) {
29
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ connect`);
28
+ debug(`${ConfirmationDialog.name} ⚡️ connect`);
30
29
  CleanupRegistry.register(el, onoff([
31
30
  { types: 'click', listener: this.#handleDialogClick },
32
31
  { types: 'close', listener: this.#handleDialogClose },
@@ -40,7 +39,7 @@ export class ConfirmationDialog extends DialogBase {
40
39
  // if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
41
40
  return true;
42
41
  }), el).on());
43
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ will-open`);
42
+ debug(`${ConfirmationDialog.name} ⚡️ will-open`);
44
43
  el.removeAttribute('closing');
45
44
  el.scrollTop = 0;
46
45
  el.returnValue = '';
@@ -48,7 +47,7 @@ export class ConfirmationDialog extends DialogBase {
48
47
  el.showModal();
49
48
  }
50
49
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
51
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
50
+ debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
52
51
  // const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
53
52
  switch (attributeName) {
54
53
  case 'label':
@@ -61,7 +60,7 @@ export class ConfirmationDialog extends DialogBase {
61
60
  }
62
61
  }
63
62
  static #handleDialogClick = (evt) => {
64
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
63
+ debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
65
64
  const { target, currentTarget: dialog } = evt;
66
65
  if (!(dialog instanceof HTMLDialogElement))
67
66
  return;
@@ -83,7 +82,7 @@ export class ConfirmationDialog extends DialogBase {
83
82
  evt.stopImmediatePropagation();
84
83
  };
85
84
  static #handleDialogCancel = (evt) => {
86
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
85
+ debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
87
86
  if (!evt.cancelable)
88
87
  return;
89
88
  const { target } = evt;
@@ -91,7 +90,7 @@ export class ConfirmationDialog extends DialogBase {
91
90
  return;
92
91
  evt.preventDefault();
93
92
  target.inert = true;
94
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ will-close`);
93
+ debug(`${ConfirmationDialog.name} ⚡️ will-close`);
95
94
  target.setAttribute('closing', '');
96
95
  Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
97
96
  if (!target.hasAttribute('closing'))
@@ -101,7 +100,7 @@ export class ConfirmationDialog extends DialogBase {
101
100
  });
102
101
  };
103
102
  static #handleDialogClose = ({ type, target }) => {
104
- DEBUG && console.debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
103
+ debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
105
104
  if (!(target instanceof HTMLDialogElement))
106
105
  return;
107
106
  target.remove();
@@ -1,7 +1,6 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
1
  import { I18n } from '../i18n';
3
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
4
- import { $, onoff } from '../internal/utils';
3
+ import { $, debug, onoff } from '../internal/utils';
5
4
  import { html } from '../tpl';
6
5
  /**
7
6
  * @summary A message with a title and extra information that you show when part of your app can’t be used.
@@ -48,7 +47,7 @@ export class ContentUnavailable extends HTMLElement {
48
47
  };
49
48
  }
50
49
  attributeChangedCallback(name, oldValue, newValue) {
51
- DEBUG && console.debug(`${ContentUnavailable.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
50
+ debug(`${ContentUnavailable.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
52
51
  switch (name) {
53
52
  case 'search':
54
53
  if (oldValue === newValue)
@@ -62,10 +61,10 @@ export class ContentUnavailable extends HTMLElement {
62
61
  }
63
62
  }
64
63
  disconnectedCallback() {
65
- DEBUG && console.debug(`${ContentUnavailable.name} ⚡️ disconnect`);
64
+ debug(`${ContentUnavailable.name} ⚡️ disconnect`);
66
65
  }
67
66
  connectedCallback() {
68
- DEBUG && console.debug(`${ContentUnavailable.name} ⚡️ connect`);
67
+ debug(`${ContentUnavailable.name} ⚡️ connect`);
69
68
  }
70
69
  #renderSearch = (search) => {
71
70
  const titleLabel = this.querySelector(':scope>:not([slot])') ?? this.appendChild($(html `<label-view><i class="ph ph-magnifying-glass" slot="icon" foreground="secondary"></i></label-view>`, '>1')), descText = this.querySelector(':scope>[slot=description]') ?? this.appendChild($(html `<label-view foreground="secondary" slot="description"></label-view>`, '>1'));
@@ -1,10 +1,9 @@
1
1
  var _a;
2
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
3
2
  import { I18n } from '../i18n';
4
3
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
5
4
  import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
6
5
  import { MutationObserverSet } from '../internal/class/mutation-observer-set';
7
- import { $, clamp, kebabCase, onoff, set } from '../internal/utils';
6
+ import { $, clamp, debug, kebabCase, onoff, set } from '../internal/utils';
8
7
  import { queryMorph } from '../morphdom';
9
8
  import { html } from '../tpl';
10
9
  const datePickerStyles = ['graphical', 'field', 'automatic'];
@@ -38,7 +37,7 @@ export class DatePicker extends FormAssociatedBase {
38
37
  static #templates = new Map();
39
38
  // #lastRenderedStyle?: DatePickerStyle //string | null
40
39
  #renderValidityMsgs = (entries) => {
41
- DEBUG && console.debug(`${_a.name} ⚡️ mutation`);
40
+ debug(`${_a.name} ⚡️ mutation`);
42
41
  this.setValidity(this.validity, this.validationMessage);
43
42
  };
44
43
  #shadowRoot;
@@ -76,7 +75,7 @@ export class DatePicker extends FormAssociatedBase {
76
75
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
77
76
  }
78
77
  attributeChangedCallback(name, oldValue, newValue) {
79
- DEBUG && console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
78
+ debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
80
79
  switch (name) {
81
80
  case 'selection':
82
81
  // nothing happens// const [y = '', m = '', d = ''] = (newValue ?? '').split(/\D+/)
@@ -129,7 +128,7 @@ export class DatePicker extends FormAssociatedBase {
129
128
  return datePickerStyles.includes(this.getAttribute('date-picker-style') ?? '') ? this.getAttribute('date-picker-style') : 'automatic';
130
129
  }
131
130
  #render() {
132
- DEBUG && console.debug(`${_a.name} ⚡️ #render (${this.datePickerStyle})`);
131
+ debug(`${_a.name} ⚡️ #render (${this.datePickerStyle})`);
133
132
  // if (this.#lastRenderedStyle === this.datePickerStyle) return // skip if already applied
134
133
  // this.#lastRenderedStyle = this.datePickerStyle
135
134
  // clear shadow DOM
@@ -173,7 +172,7 @@ export class DatePicker extends FormAssociatedBase {
173
172
  }
174
173
  }
175
174
  #handleValiditiesSlotchange = ({ type, target: slot }) => {
176
- DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
175
+ debug(`${_a.name} ⚡️ ${type}`);
177
176
  if (!(slot instanceof HTMLSlotElement))
178
177
  return;
179
178
  const assigned = slot.assignedElements();
@@ -201,7 +200,7 @@ export class DatePicker extends FormAssociatedBase {
201
200
  }
202
201
  }
203
202
  #handleClick = (evt) => {
204
- DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
203
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
205
204
  const { target } = evt;
206
205
  if (!(target instanceof HTMLElement))
207
206
  return;
@@ -244,7 +243,7 @@ export class DatePicker extends FormAssociatedBase {
244
243
  this.dispatchEvent(new CustomEvent('selection', { detail: { selection }, bubbles: true, composed: true }));
245
244
  };
246
245
  #handleInputPaste = (evt) => {
247
- DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
246
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
248
247
  const { target: input } = evt;
249
248
  if (!(input instanceof HTMLInputElement))
250
249
  return;
@@ -266,7 +265,7 @@ export class DatePicker extends FormAssociatedBase {
266
265
  this.#sendValueToForm();
267
266
  };
268
267
  #handleInputBeforeinput = (evt) => {
269
- DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
268
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
270
269
  const { target: input } = evt;
271
270
  if (!(input instanceof HTMLInputElement))
272
271
  return;
@@ -289,7 +288,7 @@ export class DatePicker extends FormAssociatedBase {
289
288
  }
290
289
  };
291
290
  #handleInputKeydown = ({ type, target, key }) => {
292
- DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
291
+ debug(`${_a.name} ⚡️ ${type}`);
293
292
  if (!(target instanceof HTMLInputElement))
294
293
  return;
295
294
  const input = target;
@@ -308,12 +307,12 @@ export class DatePicker extends FormAssociatedBase {
308
307
  this.#inputs[index]?.focus();
309
308
  };
310
309
  #handleInputFocus = (evt) => {
311
- DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
310
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
312
311
  for (const input of this.#inputs)
313
312
  input.classList.toggle('focus', input === evt.target);
314
313
  };
315
314
  #handleInputBlur = ({ target, type }) => {
316
- DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
315
+ debug(`${_a.name} ⚡️ ${type}`);
317
316
  if (!(target instanceof HTMLInputElement))
318
317
  return;
319
318
  const input = target;
@@ -326,7 +325,7 @@ export class DatePicker extends FormAssociatedBase {
326
325
  this.#sendValueToForm();
327
326
  };
328
327
  #handleInputInput = (evt) => {
329
- DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type}`);
328
+ debug(`${_a.name} ⚡️ ${evt?.type}`);
330
329
  this.#sendValueToForm();
331
330
  };
332
331
  /**
@@ -437,7 +436,7 @@ export class DatePicker extends FormAssociatedBase {
437
436
  message = kebabCase(key);
438
437
  break;
439
438
  }
440
- DEBUG && console.debug(`${_a.name} ⚡️ validity-change`);
439
+ debug(`${_a.name} ⚡️ validity-change`);
441
440
  return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#inputs.at(0));
442
441
  };
443
442
  setCustomValidity = (message) => {
@@ -1,15 +1,15 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
1
+ import { debug } from '../internal/utils';
2
2
  export class DetailPlaceholder extends HTMLElement {
3
3
  constructor() {
4
4
  super();
5
5
  }
6
6
  connectedCallback() {
7
- DEBUG && console.debug(`${DetailPlaceholder.name} ⚡️ connect`);
7
+ debug(`${DetailPlaceholder.name} ⚡️ connect`);
8
8
  }
9
9
  disconnectedCallback() {
10
- DEBUG && console.debug(`${DetailPlaceholder.name} ⚡️ disconnect`);
10
+ debug(`${DetailPlaceholder.name} ⚡️ disconnect`);
11
11
  }
12
12
  attributeChangedCallback(name, oldValue, newValue) {
13
- DEBUG && console.debug(`${DetailPlaceholder.name} ⚡️ attr-change [${name}]`);
13
+ debug(`${DetailPlaceholder.name} ⚡️ attr-change [${name}]`);
14
14
  }
15
15
  }
@@ -1,6 +1,5 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { cssTime, onoff, timeout } from '../internal/utils';
2
+ import { cssTime, debug, onoff, timeout } from '../internal/utils';
4
3
  import { DetailsBase } from '../namespace-browser/base';
5
4
  const toggleTimers = new WeakMap();
6
5
  /**
@@ -25,15 +24,15 @@ export class DisclosureGroup extends DetailsBase {
25
24
  super();
26
25
  }
27
26
  attributeChangedCallback(name, oldValue, newValue) {
28
- DEBUG && console.debug(`${DisclosureGroup.name} ⚡️ attr-change [${name}]`);
27
+ debug(`${DisclosureGroup.name} ⚡️ attr-change [${name}]`);
29
28
  // if (CSS.supports('interpolate-size', 'allow-keywords')) return
30
29
  }
31
30
  static polyfillDisconnectedCallback(el) {
32
- DEBUG && console.debug(`${DisclosureGroup.name} ⚡️ disconnect`);
31
+ debug(`${DisclosureGroup.name} ⚡️ disconnect`);
33
32
  CleanupRegistry.unregister(el);
34
33
  }
35
34
  static polyfillConnectedCallback(el) {
36
- DEBUG && console.debug(`${DisclosureGroup.name} ⚡️ connect`);
35
+ debug(`${DisclosureGroup.name} ⚡️ connect`);
37
36
  const newValue = el.open ? 'open' : 'closed';
38
37
  if (newValue !== el.dataset.state)
39
38
  el.dataset.state = newValue;
@@ -44,7 +43,7 @@ export class DisclosureGroup extends DetailsBase {
44
43
  });
45
44
  }
46
45
  static #handleToggle = async ({ type, currentTarget: details }) => {
47
- DEBUG && console.debug(`${DisclosureGroup.name} ⚡️ ${type}`);
46
+ debug(`${DisclosureGroup.name} ⚡️ ${type}`);
48
47
  if (!(details instanceof HTMLDetailsElement))
49
48
  return;
50
49
  const newValue = details.open ? 'opening' : 'closing';
@@ -1,7 +1,6 @@
1
1
  var _a;
2
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
3
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
4
- import { $, onoff } from '../internal/utils';
3
+ import { $, debug, onoff } from '../internal/utils';
5
4
  import { html } from '../tpl';
6
5
  /**
7
6
  * @summary A tooltip that shows an unobtrusive helpful message on pointer:fine screens. Use it by adding a `help` attribute to any element.
@@ -21,7 +20,7 @@ export class FineTooltip extends HTMLElement {
21
20
  this.#render(target.getAttribute(attributeName));
22
21
  };
23
22
  #handleMeasure = ([{ target, borderBoxSize }]) => {
24
- DEBUG && console.debug(`${_a.name} ⚡️ measure`);
23
+ debug(`${_a.name} ⚡️ measure`);
25
24
  if (target.hasAttribute('closing'))
26
25
  return;
27
26
  if (!(target instanceof HTMLElement))
@@ -51,7 +50,7 @@ export class FineTooltip extends HTMLElement {
51
50
  label.removeAttribute('title');
52
51
  };
53
52
  connectedCallback() {
54
- DEBUG && console.debug(`${_a.name} ⚡️ connect`);
53
+ debug(`${_a.name} ⚡️ connect`);
55
54
  this.removeAttribute('closing');
56
55
  this.popover = 'manual';
57
56
  this.inert = true;
@@ -60,7 +59,7 @@ export class FineTooltip extends HTMLElement {
60
59
  this.showPopover();
61
60
  }
62
61
  disconnectedCallback() {
63
- DEBUG && console.debug(`${_a.name} ⚡️ disconnect`);
62
+ debug(`${_a.name} ⚡️ disconnect`);
64
63
  this.#resizeObserver.unobserve(this);
65
64
  this.#mutationObserver?.disconnect();
66
65
  this.#mutationObserver2?.disconnect();
@@ -1,6 +1,5 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { listActive, onoff } from '../internal/utils';
2
+ import { debug, listActive, onoff } from '../internal/utils';
4
3
  import { FormBase } from '../namespace-browser/base';
5
4
  /**
6
5
  * @summary A container view that groups controls together for entering data, like a settings screen.
@@ -12,12 +11,12 @@ export class FormView extends FormBase {
12
11
  super();
13
12
  }
14
13
  static polyfillDisconnectedCallback(el) {
15
- DEBUG && console.debug(`${FormView.name} ⚡️ disconnect`);
14
+ debug(`${FormView.name} ⚡️ disconnect`);
16
15
  // finally
17
16
  CleanupRegistry.unregister(el);
18
17
  }
19
18
  static polyfillConnectedCallback(el) {
20
- DEBUG && console.debug(`${FormView.name} ⚡️ connect`);
19
+ debug(`${FormView.name} ⚡️ connect`);
21
20
  if (el.closest('[is=sidebar-view],[is=tab-bar]')) {
22
21
  el.method = 'dialog';
23
22
  el.noValidate = true;
@@ -1,6 +1,5 @@
1
- import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
4
3
  import { ButtonBase } from '../namespace-browser/base';
5
4
  import { Snapshot } from '../snapshot';
6
5
  /**
@@ -26,16 +25,16 @@ export class GlassButton extends ButtonBase {
26
25
  super();
27
26
  }
28
27
  static polyfillDisconnectedCallback(el) {
29
- DEBUG && console.debug(`${GlassButton.name} ⚡️ disconnect`);
28
+ debug(`${GlassButton.name} ⚡️ disconnect`);
30
29
  CleanupRegistry.unregister(el);
31
30
  }
32
31
  static polyfillConnectedCallback(el) {
33
- DEBUG && console.debug(`${GlassButton.name} ⚡️ connect`);
32
+ debug(`${GlassButton.name} ⚡️ connect`);
34
33
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, () => true), el).on());
35
34
  el.tabIndex = 0;
36
35
  }
37
36
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
38
- DEBUG && console.debug(`${GlassButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
37
+ debug(`${GlassButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
39
38
  const node = target instanceof HTMLButtonElement;
40
39
  if (!node)
41
40
  return;