@swiftwc/ui 0.0.0-dev.37 → 0.0.0-dev.39

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 (60) hide show
  1. package/generated/client/index.js +5 -3
  2. package/generated/components/alert-dialog.js +17 -9
  3. package/generated/components/body-view.js +5 -3
  4. package/generated/components/bordered-button.js +7 -4
  5. package/generated/components/bordered-prominent-button.js +7 -4
  6. package/generated/components/borderless-button.js +7 -4
  7. package/generated/components/confirmation-dialog.js +17 -9
  8. package/generated/components/content-unavailable-view.js +7 -4
  9. package/generated/components/date-picker.js +34 -23
  10. package/generated/components/disclosure-group.js +9 -5
  11. package/generated/components/fine-tooltip.js +7 -4
  12. package/generated/components/form-view.js +5 -3
  13. package/generated/components/glass-button.js +7 -4
  14. package/generated/components/glass-prominent-button.js +7 -4
  15. package/generated/components/label-view.js +7 -4
  16. package/generated/components/list-view.js +5 -3
  17. package/generated/components/menu-view.js +19 -10
  18. package/generated/components/navigation-large-title.js +9 -5
  19. package/generated/components/navigation-split-view.js +7 -4
  20. package/generated/components/navigation-stack.js +7 -4
  21. package/generated/components/navigation-title.js +7 -4
  22. package/generated/components/picker-view.d.ts +1 -0
  23. package/generated/components/picker-view.js +185 -83
  24. package/generated/components/plain-button.js +5 -3
  25. package/generated/components/progress-view.js +11 -8
  26. package/generated/components/screen-view.js +3 -2
  27. package/generated/components/scroll-view-proxy.js +5 -3
  28. package/generated/components/scroll-view.js +17 -9
  29. package/generated/components/search-view.js +7 -4
  30. package/generated/components/section-view.js +7 -5
  31. package/generated/components/sheet-view.js +11 -6
  32. package/generated/components/sidebar-toggle.js +9 -5
  33. package/generated/components/sidebar-view.js +3 -2
  34. package/generated/components/sticky-container.js +5 -3
  35. package/generated/components/tab-bar.js +7 -4
  36. package/generated/components/tab-item.js +15 -8
  37. package/generated/components/tab-view.js +14 -8
  38. package/generated/components/table-view.js +13 -8
  39. package/generated/components/text-field.js +27 -17
  40. package/generated/components/tool-bar-item-group.js +5 -3
  41. package/generated/components/tool-bar-item.js +7 -4
  42. package/generated/components/tool-bar.js +7 -4
  43. package/generated/components/v-keyboard.js +9 -5
  44. package/generated/components/v-stack.js +5 -3
  45. package/generated/css/index.css +6 -2
  46. package/generated/events/picker-view.d.ts +1 -0
  47. package/generated/internal/class/css-style-observer.js +3 -2
  48. package/generated/internal/class/form-associated-base.js +7 -5
  49. package/generated/internal/class/navigation-view.js +5 -3
  50. package/generated/internal/decorators/adaptive-slot.js +7 -4
  51. package/generated/internal/privateNamespace.js +22 -13
  52. package/generated/internal/utils/dev-flags.d.ts +3 -0
  53. package/generated/internal/utils/dev-flags.js +5 -0
  54. package/generated/internal/utils/index.d.ts +1 -1
  55. package/generated/internal/utils/index.js +1 -1
  56. package/generated/snapshot/index.js +5 -3
  57. package/package.json +1 -1
  58. package/scss/base/_layout.scss +6 -7
  59. package/generated/internal/utils/debug.d.ts +0 -1
  60. package/generated/internal/utils/debug.js +0 -3
@@ -3,7 +3,7 @@ import { I18n } from '../i18n';
3
3
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
4
4
  import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
5
5
  import { MutationObserverSet } from '../internal/class/mutation-observer-set';
6
- import { $, compareBigDecimals, debug, kebabCase, onoff, set } from '../internal/utils';
6
+ import { $, compareBigDecimals, devFlags, kebabCase, onoff, set } from '../internal/utils';
7
7
  const keyboardTypes = ['decimal-pad', 'number-pad', 'default'];
8
8
  /**
9
9
  * @slot label
@@ -27,7 +27,8 @@ export class TextField extends FormAssociatedBase {
27
27
  </label>`));
28
28
  }
29
29
  #renderValidityMsgs = (entries) => {
30
- debug(`${_a.name} ⚡️ mutation`);
30
+ if (devFlags.debug)
31
+ console.debug(`${_a.name} ⚡️ mutation`);
31
32
  this.setValidity(this.validity, this.validationMessage);
32
33
  };
33
34
  #shadowRoot;
@@ -76,7 +77,8 @@ export class TextField extends FormAssociatedBase {
76
77
  this.#validityObservers.unobserveAll();
77
78
  }
78
79
  attributeChangedCallback(name, oldValue, newValue) {
79
- debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
80
+ if (devFlags.debug)
81
+ console.debug(`${_a.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
80
82
  switch (name) {
81
83
  case 'keyboard-type':
82
84
  switch (newValue) {
@@ -124,7 +126,7 @@ export class TextField extends FormAssociatedBase {
124
126
  break;
125
127
  case 'text':
126
128
  // if (this.#input) this.#input.value = newValue ?? ''
127
- this.text = newValue ?? '';
129
+ // nothing happens //this.text = newValue ?? ''
128
130
  break;
129
131
  case 'required':
130
132
  this.#input?.setAttribute(name, newValue ?? ''); // else this.#input?.removeAttribute(name)
@@ -147,14 +149,15 @@ export class TextField extends FormAssociatedBase {
147
149
  this.#sendValueToForm();
148
150
  break;
149
151
  case 'label':
150
- let label = this.querySelector(':scope>[slot=label]');
152
+ let label = this.querySelector(':scope>label-view[slot=label]');
151
153
  if (newValue) {
152
- label ??= this.appendChild($(`<span slot="label" foreground="secondary"></span>`, '>1'));
153
- label.textContent = newValue;
154
+ label ??= this.appendChild($(`<label-view slot="label"></label-view>`, '>1'));
155
+ label.setAttribute('foreground', 'secondary');
156
+ label.setAttribute('title', newValue);
154
157
  }
155
158
  else
156
159
  label?.remove();
157
- this.#sendValueToForm();
160
+ // this.#sendValueToForm()
158
161
  break;
159
162
  case 'disabled':
160
163
  for (const el of this.#shadowRoot.querySelectorAll('input'))
@@ -197,16 +200,18 @@ export class TextField extends FormAssociatedBase {
197
200
  }
198
201
  }
199
202
  #handleValiditiesSlotchange = ({ type, target: slot }) => {
200
- debug(`${_a.name} ⚡️ ${type}`);
203
+ if (devFlags.debug)
204
+ console.debug(`${_a.name} ⚡️ ${type}`);
201
205
  if (!(slot instanceof HTMLSlotElement && slot))
202
206
  return;
203
207
  const assigned = slot.assignedElements();
204
208
  this.#validityObservers.syncObservations(assigned, ['value', 'label']);
205
- if (0 < assigned.length)
206
- this.#renderValidityMsgs([]);
209
+ // if (0 < assigned.length)
210
+ this.#renderValidityMsgs([]);
207
211
  };
208
212
  #handleFocusin = (evt) => {
209
- debug(`${_a.name} ⚡️ ${evt?.type}`);
213
+ if (devFlags.debug)
214
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
210
215
  if (evt.target === this)
211
216
  this.#input?.focus();
212
217
  };
@@ -237,7 +242,8 @@ export class TextField extends FormAssociatedBase {
237
242
  this.dispatchEvent(new CustomEvent('commit', { detail: { text: this.text }, bubbles: true, composed: true }));
238
243
  };
239
244
  #handleInputPaste = (evt) => {
240
- debug(`${_a.name} ⚡️ ${evt?.type}`);
245
+ if (devFlags.debug)
246
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
241
247
  const { target: input } = evt;
242
248
  if (!(input instanceof HTMLInputElement && input))
243
249
  return;
@@ -340,7 +346,8 @@ export class TextField extends FormAssociatedBase {
340
346
  }
341
347
  };
342
348
  #handleInputBeforeinput = (evt) => {
343
- debug(`${_a.name} ⚡️ ${evt?.type}`);
349
+ if (devFlags.debug)
350
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
344
351
  const { target: input } = evt;
345
352
  if (!(input instanceof HTMLInputElement && input))
346
353
  return;
@@ -375,7 +382,8 @@ export class TextField extends FormAssociatedBase {
375
382
  }
376
383
  };
377
384
  #handleInputBlur = ({ type, target: input }) => {
378
- debug(`${_a.name} ⚡️ ${type}`);
385
+ if (devFlags.debug)
386
+ console.debug(`${_a.name} ⚡️ ${type}`);
379
387
  if (!(input instanceof HTMLInputElement && input))
380
388
  return;
381
389
  if (0 === input.value.length)
@@ -386,7 +394,8 @@ export class TextField extends FormAssociatedBase {
386
394
  this.#sendValueToForm();
387
395
  };
388
396
  #handleInputInput = (evt) => {
389
- debug(`${_a.name} ⚡️ ${evt?.type}`);
397
+ if (devFlags.debug)
398
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
390
399
  this.#sendValueToForm();
391
400
  };
392
401
  // Optional: form participation properties
@@ -468,7 +477,8 @@ export class TextField extends FormAssociatedBase {
468
477
  message = kebabCase(key);
469
478
  break;
470
479
  }
471
- debug(`${_a.name} ⚡️ validity-change`);
480
+ if (devFlags.debug)
481
+ console.debug(`${_a.name} ⚡️ validity-change`);
472
482
  return this.#internals.setValidity(flags, this.#customValidity || message, anchor ?? this.#input);
473
483
  };
474
484
  setCustomValidity = (message) => {
@@ -7,16 +7,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var ToolBarItemGroup_1;
8
8
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
9
9
  import { adaptiveSlot } from '../internal/decorators';
10
- import { debug } from '../internal/utils';
10
+ import { devFlags } from '../internal/utils';
11
11
  let ToolBarItemGroup = ToolBarItemGroup_1 = class ToolBarItemGroup extends HTMLElement {
12
12
  constructor() {
13
13
  super();
14
14
  }
15
15
  connectedCallback() {
16
- debug(`${ToolBarItemGroup_1.name} ⚡️ connect`);
16
+ if (devFlags.debug)
17
+ console.debug(`${ToolBarItemGroup_1.name} ⚡️ connect`);
17
18
  }
18
19
  disconnectedCallback() {
19
- debug(`${ToolBarItemGroup_1.name} ⚡️ disconnect`);
20
+ if (devFlags.debug)
21
+ console.debug(`${ToolBarItemGroup_1.name} ⚡️ disconnect`);
20
22
  CleanupRegistry.unregister(this);
21
23
  }
22
24
  };
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var ToolBarItem_1;
8
8
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
9
9
  import { adaptiveSlot } from '../internal/decorators';
10
- import { debug, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
10
+ import { devFlags, ensurePlaceholder, onoff, touchGlass } from '../internal/utils';
11
11
  import { Snapshot } from '../snapshot';
12
12
  let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
13
13
  static get observedAttributes() {
@@ -18,12 +18,14 @@ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
18
18
  super();
19
19
  }
20
20
  disconnectedCallback() {
21
- debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
21
+ if (devFlags.debug)
22
+ console.debug(`${ToolBarItem_1.name} ⚡️ disconnect`);
22
23
  this.#mutationObserver?.disconnect();
23
24
  CleanupRegistry.unregister(this);
24
25
  }
25
26
  connectedCallback() {
26
- debug(`${ToolBarItem_1.name} ⚡️ connect`);
27
+ if (devFlags.debug)
28
+ console.debug(`${ToolBarItem_1.name} ⚡️ connect`);
27
29
  CleanupRegistry.register(this, onoff(touchGlass(this, (t) => t.closest('tool-bar-item-group') ?? t, ({ target }) => {
28
30
  if (!(target instanceof HTMLElement && target))
29
31
  return true;
@@ -33,7 +35,8 @@ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
33
35
  }), this).on());
34
36
  }
35
37
  attributeChangedCallback(name, oldValue, newValue) {
36
- debug(`${ToolBarItem_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
38
+ if (devFlags.debug)
39
+ console.debug(`${ToolBarItem_1.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
37
40
  switch (name) {
38
41
  case 'slot':
39
42
  case 'data-previous-slot':
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  import { ResizeObserverSingleton } from '../internal/class/resize-observer-singleton';
3
- import { $, debug } from '../internal/utils';
3
+ import { $, devFlags } from '../internal/utils';
4
4
  const observers = new ResizeObserverSingleton();
5
5
  /**
6
6
  * @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
@@ -56,7 +56,8 @@ export class ToolBar extends HTMLElement {
56
56
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
57
57
  }
58
58
  connectedCallback() {
59
- debug(`${_a.name} ⚡️ connect`);
59
+ if (devFlags.debug)
60
+ console.debug(`${_a.name} ⚡️ connect`);
60
61
  // NOTE: wait for config
61
62
  // Snapshot.waitReady.then(() => {
62
63
  for (const el of this.#shadowRoot.querySelectorAll(`[part*="toolbar-leading-stack"],[part*="toolbar-trailing-stack"]`))
@@ -64,11 +65,13 @@ export class ToolBar extends HTMLElement {
64
65
  // })
65
66
  }
66
67
  disconnectedCallback() {
67
- debug(`${_a.name} ⚡️ disconnect`);
68
+ if (devFlags.debug)
69
+ console.debug(`${_a.name} ⚡️ disconnect`);
68
70
  observers.unobserve(this);
69
71
  }
70
72
  #measureStacks(entry) {
71
- debug(`${_a.name} ⚡️ measure`);
73
+ if (devFlags.debug)
74
+ console.debug(`${_a.name} ⚡️ measure`);
72
75
  if (this.closest('[hidden]'))
73
76
  return;
74
77
  const leading = 'toolbar-leading-stack', trailing = 'toolbar-trailing-stack';
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { $, debug, frame, onoff, sleep } from '../internal/utils';
3
+ import { $, devFlags, frame, onoff, sleep } from '../internal/utils';
4
4
  import { Snapshot } from '../snapshot';
5
5
  /**
6
6
  * BUG: Safari on IOS reports inaccurate innerHeight (which is what we really want) on orientationchange.
@@ -22,11 +22,13 @@ export class VKeyboard extends HTMLElement {
22
22
  super();
23
23
  }
24
24
  disconnectedCallback() {
25
- debug(`${_a.name} ⚡️ disconnect`);
25
+ if (devFlags.debug)
26
+ console.debug(`${_a.name} ⚡️ disconnect`);
26
27
  CleanupRegistry.unregister(this);
27
28
  }
28
29
  connectedCallback() {
29
- debug(`${_a.name} ⚡️ connect`);
30
+ if (devFlags.debug)
31
+ console.debug(`${_a.name} ⚡️ connect`);
30
32
  this.inert = true;
31
33
  CleanupRegistry.register(this, onoff([
32
34
  { types: 'scroll', listener: this.#handleWindowScroll },
@@ -58,13 +60,15 @@ export class VKeyboard extends HTMLElement {
58
60
  self.scrollTo(0, 0);
59
61
  };
60
62
  #handleWindowOrientationchange = async () => {
61
- debug(`${_a.name} ⚡️ orientationchange`);
63
+ if (devFlags.debug)
64
+ console.debug(`${_a.name} ⚡️ orientationchange`);
62
65
  if (!(await frame(this)))
63
66
  return; //self.requestAnimationFrame(this.#ifKeyboardScrollIntoActiveElement)
64
67
  this.#ifKeyboardScrollIntoActiveElement();
65
68
  };
66
69
  #handleBodyFocusin = async () => {
67
- debug(`${_a.name} ⚡️ focusin`);
70
+ if (devFlags.debug)
71
+ console.debug(`${_a.name} ⚡️ focusin`);
68
72
  await sleep(100); // self.setTimeout(this.#ifKeyboardScrollIntoActiveElement, 100)
69
73
  if (!this.isConnected)
70
74
  return;
@@ -1,4 +1,4 @@
1
- import { debug } from '../internal/utils';
1
+ import { devFlags } from '../internal/utils';
2
2
  /**
3
3
  * @attr {leading|"leading fill"|center|trailing|fill|space-between} distribution - The distribution of cols
4
4
  *
@@ -9,9 +9,11 @@ export class VStack extends HTMLElement {
9
9
  super();
10
10
  }
11
11
  connectedCallback() {
12
- debug(`${VStack.name} ⚡️ connect`);
12
+ if (devFlags.debug)
13
+ console.debug(`${VStack.name} ⚡️ connect`);
13
14
  }
14
15
  disconnectedCallback() {
15
- debug(`${VStack.name} ⚡️ disconnect`);
16
+ if (devFlags.debug)
17
+ console.debug(`${VStack.name} ⚡️ disconnect`);
16
18
  }
17
19
  }
@@ -985,7 +985,8 @@
985
985
  grid-column: 1/-1;
986
986
  grid-row: 1/-1;
987
987
  }
988
- :where(navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > scroll-view, navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > [is=sidebar-view] > scroll-view,
988
+ :where(navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > scroll-view,
989
+ navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > [is=sidebar-view] > scroll-view,
989
990
  navigation-stack:has(> body-view) > scroll-view,
990
991
  navigation-stack:has(> body-view) > [is=sidebar-view] > scroll-view,
991
992
  navigation-split-view:has(> body-view) > scroll-view,
@@ -996,7 +997,10 @@
996
997
  body-view:has(> body-view) > [is=sidebar-view] > scroll-view) {
997
998
  --scroll-view-translate: translateX(var(--view-transition-leading-x));
998
999
  }
999
- :where(navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > tool-bar > tool-bar-item, navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > tool-bar > tool-bar-item-group, navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > [is=sidebar-view] > tool-bar > tool-bar-item, navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > [is=sidebar-view] > tool-bar > tool-bar-item-group,
1000
+ :where(navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > tool-bar > tool-bar-item,
1001
+ navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > tool-bar > tool-bar-item-group,
1002
+ navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > [is=sidebar-view] > tool-bar > tool-bar-item,
1003
+ navigation-stack:has(> navigation-stack:not([hidden]), > navigation-split-view:not([hidden])) > [is=sidebar-view] > tool-bar > tool-bar-item-group,
1000
1004
  navigation-stack:has(> body-view) > tool-bar > tool-bar-item,
1001
1005
  navigation-stack:has(> body-view) > tool-bar > tool-bar-item-group,
1002
1006
  navigation-stack:has(> body-view) > [is=sidebar-view] > tool-bar > tool-bar-item,
@@ -3,6 +3,7 @@ export type PickerSelectionDetail = {
3
3
  };
4
4
  export type PickerSearchableDetail = {
5
5
  element: HTMLElement;
6
+ search: string;
6
7
  };
7
8
  declare global {
8
9
  interface HTMLElementEventMap {
@@ -1,5 +1,5 @@
1
1
  var _a;
2
- import { debug, onoff } from '../../internal/utils';
2
+ import { devFlags, onoff } from '../../internal/utils';
3
3
  export class CSSStyleObserver {
4
4
  #cleanups;
5
5
  #options;
@@ -16,7 +16,8 @@ export class CSSStyleObserver {
16
16
  this.#cleanups?.();
17
17
  }
18
18
  #handleTransitionrun = (callback, evt) => {
19
- debug(`${_a.name} ⚡️ ${evt?.type} (${evt.propertyName})`);
19
+ if (devFlags.debug)
20
+ console.debug(`${_a.name} ⚡️ ${evt?.type} (${evt.propertyName})`);
20
21
  if (!this.#options?.properties.some((prop) => evt.propertyName.startsWith(prop)))
21
22
  return;
22
23
  callback?.(evt);
@@ -1,4 +1,4 @@
1
- import { debug } from '../utils';
1
+ import { devFlags } from '../utils';
2
2
  import { CleanupRegistry } from './cleanup-registry';
3
3
  const internals = new WeakMap();
4
4
  // const trackedElements = new WeakMap<FormAssociatedBase, Set<Element>>()
@@ -11,14 +11,14 @@ export function getInternals(instance) {
11
11
  }
12
12
  // export function makeSlotchangeHandler(t: FormAssociatedBase) {
13
13
  // const handleSlotchange = ({ type, target: slot }: Event) => {
14
- // debug(`${makeSlotchangeHandler.name} ⚡️ ${type}`)
14
+ // if (devFlags.debug) console.debug(`${makeSlotchangeHandler.name} ⚡️ ${type}`)
15
15
  // if (!(slot instanceof HTMLSlotElement && slot)) return
16
16
  // const assigned = slot.assignedElements({ flatten: true })
17
17
  // observers.syncObservations(trackedElements.get(t) ?? new Set(), assigned, handleTagMutation, ['value', 'label'])
18
18
  // if (0 < assigned.length) handleTagMutation()
19
19
  // },
20
20
  // handleTagMutation = (entry?: MutationRecord) => {
21
- // debug(`${handleTagMutation.name} ⚡️ mutation`)
21
+ // if (devFlags.debug) console.debug(`${handleTagMutation.name} ⚡️ mutation`)
22
22
  // t.setValidity(t.validity, t.validationMessage)
23
23
  // }
24
24
  // return [{ types: 'slotchange', listener: handleSlotchange }]
@@ -33,12 +33,14 @@ export class FormAssociatedBase extends HTMLElement {
33
33
  // trackedElements.set(this, new Set<Element>())
34
34
  }
35
35
  disconnectedCallback() {
36
- debug(`${FormAssociatedBase.name} ⚡️ disconnect`);
36
+ if (devFlags.debug)
37
+ console.debug(`${FormAssociatedBase.name} ⚡️ disconnect`);
37
38
  CleanupRegistry.unregister(this);
38
39
  // observers.clearObservationsSet(trackedElements.get(this) ?? new Set())
39
40
  }
40
41
  connectedCallback() {
41
- debug(`${FormAssociatedBase.name} ⚡️ connect`);
42
+ if (devFlags.debug)
43
+ console.debug(`${FormAssociatedBase.name} ⚡️ connect`);
42
44
  }
43
45
  get type() {
44
46
  return this.localName;
@@ -1,7 +1,7 @@
1
1
  var _a;
2
2
  import { lifecycleObserver } from '../../buses';
3
3
  import { CleanupRegistry } from '../../internal/class/cleanup-registry';
4
- import { debug, frame, onoff } from '../utils';
4
+ import { devFlags, frame, onoff } from '../utils';
5
5
  export class NavigationView extends HTMLElement {
6
6
  static get observedAttributes() {
7
7
  return ['hidden'];
@@ -56,7 +56,8 @@ export class NavigationView extends HTMLElement {
56
56
  // consume it (important so it doesn’t leak to next change)
57
57
  this.#recentBefore = undefined;
58
58
  }
59
- debug(`${_a.name} 💡 ${eventType}`);
59
+ if (devFlags.debug)
60
+ console.debug(`${_a.name} 💡 ${eventType}`);
60
61
  frame(this).then(() => {
61
62
  // if (!r) return
62
63
  target.dispatchEvent(new CustomEvent(eventType, { detail: { tag: this.id }, bubbles: true, composed: true }));
@@ -65,7 +66,8 @@ export class NavigationView extends HTMLElement {
65
66
  }
66
67
  }
67
68
  #handleBeforeTabRevealOrSwap = (evt) => {
68
- debug(`${_a.name} ⚡️ ${evt?.type}`);
69
+ if (devFlags.debug)
70
+ console.debug(`${_a.name} ⚡️ ${evt?.type}`);
69
71
  if (this.id !== evt.detail?.tag)
70
72
  return;
71
73
  this.#recentBefore = {
@@ -1,9 +1,10 @@
1
1
  import { Snapshot } from '../../snapshot';
2
2
  import { CleanupRegistry } from '../class/cleanup-registry';
3
- import { debug, onoff } from '../utils';
3
+ import { devFlags, onoff } from '../utils';
4
4
  export default function (filter) {
5
5
  const handleMediaChange = (el, { type, matches }) => {
6
- debug(`${el.localName} ⚡️ ${type}`);
6
+ if (devFlags.debug)
7
+ console.debug(`${el.localName} ⚡️ ${type}`);
7
8
  if (matches) {
8
9
  if (!el.matches(`[slot="cancellation-action"],[slot="primary-action"],[slot="confirmation-action"],[slot="destructive-action"]`))
9
10
  return;
@@ -22,7 +23,8 @@ export default function (filter) {
22
23
  return function (Base, _context) {
23
24
  const originalConnected = Base.prototype.connectedCallback, originalDisconnected = Base.prototype.disconnectedCallback;
24
25
  Base.prototype.connectedCallback = function () {
25
- console.debug(`decorator:[${this.localName}] ⚡️ connect`);
26
+ if (devFlags.debug)
27
+ console.debug(`decorator:[${this.localName}] ⚡️ connect`);
26
28
  originalConnected?.call(this);
27
29
  if (filter && !filter(this))
28
30
  return;
@@ -39,7 +41,8 @@ export default function (filter) {
39
41
  });
40
42
  };
41
43
  Base.prototype.disconnectedCallback = function () {
42
- console.debug(`decorator:[${this.localName}] ⚡️ disconnect`);
44
+ if (devFlags.debug)
45
+ console.debug(`decorator:[${this.localName}] ⚡️ disconnect`);
43
46
  originalDisconnected?.call(this);
44
47
  CleanupRegistry.unregister(this, 'adaptive-slot');
45
48
  };
@@ -1,5 +1,5 @@
1
1
  import { NavigationPath } from '../internal/class/navigation-path';
2
- import { debug } from '../internal/utils';
2
+ import { devFlags } from '../internal/utils';
3
3
  import { Snapshot } from '../snapshot';
4
4
  export function queryInsertPosition(frame) {
5
5
  if ('NAVIGATION-SPLIT-VIEW' === frame?.tagName)
@@ -18,7 +18,8 @@ const cleanup = (lm, type) => {
18
18
  el.classList.remove(...arr);
19
19
  };
20
20
  export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
21
- debug(`startViewTransition (${type})`, target);
21
+ if (devFlags.debug)
22
+ console.debug(`startViewTransition (${type})`, target);
22
23
  if (!(target instanceof HTMLElement))
23
24
  throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
24
25
  if (!['forwards', 'backwards', 'reload'].includes(type))
@@ -57,9 +58,9 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
57
58
  // dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
58
59
  // if ('DIALOG' === newHost?.tagName) {
59
60
  // ;(newHost as HTMLDialogElement).showModal()
60
- // debug(`⚡️ view-transition-start (${type})`)
61
+ // if (devFlags.debug) console.debug(`⚡️ view-transition-start (${type})`)
61
62
  // await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
62
- // debug(`⚡️ view-transition-end (${type})`)
63
+ // if (devFlags.debug) console.debug(`⚡️ view-transition-end (${type})`)
63
64
  // return
64
65
  // }
65
66
  // purge
@@ -82,14 +83,18 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
82
83
  if (0 < modalViews.length) {
83
84
  for await (const el of modalViews)
84
85
  el.showModal();
85
- debug(`⚡️ view-dialog-transition-start (${type})`);
86
+ if (devFlags.debug)
87
+ console.debug(`⚡️ view-dialog-transition-start (${type})`);
86
88
  await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
87
- debug(`⚡️ view-dialog-transition-end (${type})`);
89
+ if (devFlags.debug)
90
+ console.debug(`⚡️ view-dialog-transition-end (${type})`);
88
91
  }
89
92
  else {
90
- debug(`⚡️ view-transition-start (${type})`);
93
+ if (devFlags.debug)
94
+ console.debug(`⚡️ view-transition-start (${type})`);
91
95
  await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to?.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
92
- debug(`⚡️ view-transition-end (${type})`);
96
+ if (devFlags.debug)
97
+ console.debug(`⚡️ view-transition-end (${type})`);
93
98
  }
94
99
  if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
95
100
  return;
@@ -110,9 +115,11 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
110
115
  if ('DIALOG' === from.component?.tagName) {
111
116
  from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
112
117
  from.component.close();
113
- debug(`⚡️ view-dialog-transition-start (${type})`);
118
+ if (devFlags.debug)
119
+ console.debug(`⚡️ view-dialog-transition-start (${type})`);
114
120
  await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
115
- debug(`⚡️ view-dialog-transition-end (${type})`);
121
+ if (devFlags.debug)
122
+ console.debug(`⚡️ view-dialog-transition-end (${type})`);
116
123
  if (from.component.matches('[open]'))
117
124
  return;
118
125
  await updateCallback();
@@ -120,7 +127,7 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
120
127
  }
121
128
  const to = [...from.parents()].at(0)?.hydrate(); //closestBody(oldPath.component?.parentElement ?? undefined)
122
129
  if (!to)
123
- return debug('Can not go backwards.'); // nothing to go back to
130
+ return console.debug('Can not go backwards.'); // nothing to go back to
124
131
  const tv = to.body?.closest('tab-view');
125
132
  if (tv && to.body?.matches('tab-view>navigation-stack:has(> navigation-stack,> navigation-split-view)>:scope'))
126
133
  if ('bottom-bar' !== tv.tabBarPlacement)
@@ -147,9 +154,11 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
147
154
  for (const el of inbetweenModals)
148
155
  el.close(); // close old inbetween modals
149
156
  // capture trans
150
- debug(`⚡️ view-transition-start (${type})`);
157
+ if (devFlags.debug)
158
+ console.debug(`⚡️ view-transition-start (${type})`);
151
159
  await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
152
- debug(`⚡️ view-transition-end (${type})`);
160
+ if (devFlags.debug)
161
+ console.debug(`⚡️ view-transition-end (${type})`);
153
162
  if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
154
163
  return;
155
164
  cleanup(root);
@@ -0,0 +1,3 @@
1
+ export default class {
2
+ static get debug(): boolean;
3
+ }
@@ -0,0 +1,5 @@
1
+ export default class {
2
+ static get debug() {
3
+ return false;
4
+ }
5
+ }
@@ -4,7 +4,7 @@ export { default as clamp } from './clamp';
4
4
  export { default as compareBigDecimals } from './compare-big-decimals';
5
5
  export { default as cssTime } from './css-time';
6
6
  export { default as debounce } from './debounce';
7
- export { default as debug } from './debug';
7
+ export { default as devFlags } from './dev-flags';
8
8
  export { default as ensurePlaceholder } from './ensure-placeholder';
9
9
  export { default as frame } from './frame';
10
10
  export { default as isInside } from './is-inside';
@@ -6,7 +6,7 @@ export { default as clamp } from './clamp';
6
6
  export { default as compareBigDecimals } from './compare-big-decimals';
7
7
  export { default as cssTime } from './css-time';
8
8
  export { default as debounce } from './debounce';
9
- export { default as debug } from './debug';
9
+ export { default as devFlags } from './dev-flags';
10
10
  export { default as ensurePlaceholder } from './ensure-placeholder';
11
11
  export { default as frame } from './frame';
12
12
  export { default as isInside } from './is-inside';
@@ -1,4 +1,4 @@
1
- import { debug, onoff } from '../internal/utils';
1
+ import { devFlags, onoff } from '../internal/utils';
2
2
  export class Snapshot {
3
3
  static #readyCalled = false;
4
4
  static #config;
@@ -45,10 +45,12 @@ export class Snapshot {
45
45
  const mediaQueryList = self.matchMedia(`(pointer: fine) and (min-width: ${this.#config['ipad-sheet-view-inline-size']}) and (min-height: ${this.#config['ipad-sheet-view-height']})`);
46
46
  this.#breakpoints = new Map([['fine_dialog_sheet', mediaQueryList.matches]]);
47
47
  this.#listeners.add(onoff('change', (evt) => this.#handleMediaChange(evt, 'fine_dialog_sheet:change'), mediaQueryList).on());
48
- debug(this.#config);
48
+ if (devFlags.debug)
49
+ console.debug(this.#config);
49
50
  }
50
51
  static #handleMediaChange = ({ type, matches, media }, kind) => {
51
- debug(`${Snapshot.name} ⚡️ ${type}`);
52
+ if (devFlags.debug)
53
+ console.debug(`${Snapshot.name} ⚡️ ${type}`);
52
54
  this.#breakpoints?.set('fine_dialog_sheet', matches);
53
55
  this.on.dispatchEvent(new MediaQueryListEvent(kind, {
54
56
  matches,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.37",
3
+ "version": "0.0.0-dev.39",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -18,7 +18,6 @@
18
18
  }
19
19
 
20
20
  :where(& > *:not([slot])) {
21
- // & > *:not([slot]) {
22
21
  @include mixins.span-all;
23
22
  }
24
23
  }
@@ -29,8 +28,8 @@
29
28
  dialog:has(> body-view),
30
29
  // body-view:has(> dialog),
31
30
  body-view:has(> body-view) {
32
- & > scroll-view,
33
- & > [is='sidebar-view'] > scroll-view {
31
+ > scroll-view,
32
+ > [is='sidebar-view'] > scroll-view {
34
33
  :where(&) {
35
34
  --scroll-view-translate: translateX(var(--view-transition-leading-x));
36
35
  }
@@ -44,10 +43,10 @@
44
43
  // & > [is='sidebar-view'] > bottom-bar > tool-bar-item,
45
44
  // & > [is='sidebar-view'] > top-bar > tool-bar-item-group,
46
45
  // & > [is='sidebar-view'] > bottom-bar > tool-bar-item-group {
47
- & > tool-bar > tool-bar-item,
48
- & > tool-bar > tool-bar-item-group,
49
- & > [is='sidebar-view'] > tool-bar > tool-bar-item,
50
- & > [is='sidebar-view'] > tool-bar > tool-bar-item-group {
46
+ > tool-bar > tool-bar-item,
47
+ > tool-bar > tool-bar-item-group,
48
+ > [is='sidebar-view'] > tool-bar > tool-bar-item,
49
+ > [is='sidebar-view'] > tool-bar > tool-bar-item-group {
51
50
  :where(&) {
52
51
  @include mixins.vt-toolbar-cell-offscreen-keyframe;
53
52
  }
@@ -1 +0,0 @@
1
- export default function debug(...data: any[]): void;
@@ -1,3 +0,0 @@
1
- export default function debug(...data) {
2
- return console.debug(...data); //console.debug('%c swift-wc', 'color:hsl(200,70%,45%);font-weight:600', ...data)
3
- }