@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
@@ -0,0 +1,15 @@
1
+ import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
+ export class VDivider extends HTMLElement {
3
+ constructor() {
4
+ super();
5
+ }
6
+ connectedCallback() {
7
+ DEBUG && console.debug(`${VDivider.name} ⚡️ connect`);
8
+ }
9
+ disconnectedCallback() {
10
+ DEBUG && console.debug(`${VDivider.name} ⚡️ disconnect`);
11
+ }
12
+ attributeChangedCallback(name, oldValue, newValue) {
13
+ DEBUG && console.debug(`${VDivider.name} ⚡️ attr-change [${name}]`);
14
+ }
15
+ }
@@ -1,6 +1,7 @@
1
1
  var _a;
2
+ import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
3
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { $, devFlags, frame, onoff, sleep } from '../internal/utils';
4
+ import { frame, onoff, prop, sleep } from '../internal/utils';
4
5
  import { Snapshot } from '../snapshot';
5
6
  /**
6
7
  * BUG: Safari on IOS reports inaccurate innerHeight (which is what we really want) on orientationchange.
@@ -22,13 +23,11 @@ export class VKeyboard extends HTMLElement {
22
23
  super();
23
24
  }
24
25
  disconnectedCallback() {
25
- if (devFlags.debug)
26
- console.debug(`${_a.name} ⚡️ disconnect`);
26
+ DEBUG && console.debug(`${_a.name} ⚡️ disconnect`);
27
27
  CleanupRegistry.unregister(this);
28
28
  }
29
29
  connectedCallback() {
30
- if (devFlags.debug)
31
- console.debug(`${_a.name} ⚡️ connect`);
30
+ DEBUG && console.debug(`${_a.name} ⚡️ connect`);
32
31
  this.inert = true;
33
32
  CleanupRegistry.register(this, onoff([
34
33
  { types: 'scroll', listener: this.#handleWindowScroll },
@@ -54,21 +53,19 @@ export class VKeyboard extends HTMLElement {
54
53
  #handleVisualViewportResize = () => {
55
54
  const dvh = self.visualViewport?.height ?? 0, fullLvh = this.offsetHeight;
56
55
  const diff = Math.abs(self.outerHeight - (this.#shouldKeyboardBeOpenCallback() ? dvh : fullLvh));
57
- $.prop('--100lvh', 30 < diff ? `${dvh}px` : `${fullLvh}px`, document.documentElement); //document.documentElement.style.setProperty('--100lvh', 30 < diff ? `${dvh}px` : `${fullLvh}px`)
58
- $.prop('--keyboard-inset-top', 30 < diff ? `${dvh}px` : `${fullLvh}px`, document.documentElement); //document.documentElement.style.setProperty('--keyboard-inset-top', 30 < diff ? `${dvh}px` : `${fullLvh}px`)
59
- $.prop('--keyboard-inset-height', 30 < diff ? `${diff}px` : `0px`, document.documentElement); //document.documentElement.style.setProperty('--keyboard-inset-height', 30 < diff ? `${diff}px` : `0px`)
56
+ prop('--100lvh', 30 < diff ? `${dvh}px` : `${fullLvh}px`, document.documentElement); //document.documentElement.style.setProperty('--100lvh', 30 < diff ? `${dvh}px` : `${fullLvh}px`)
57
+ prop('--keyboard-inset-top', 30 < diff ? `${dvh}px` : `${fullLvh}px`, document.documentElement); //document.documentElement.style.setProperty('--keyboard-inset-top', 30 < diff ? `${dvh}px` : `${fullLvh}px`)
58
+ prop('--keyboard-inset-height', 30 < diff ? `${diff}px` : `0px`, document.documentElement); //document.documentElement.style.setProperty('--keyboard-inset-height', 30 < diff ? `${diff}px` : `0px`)
60
59
  self.scrollTo(0, 0);
61
60
  };
62
61
  #handleWindowOrientationchange = async () => {
63
- if (devFlags.debug)
64
- console.debug(`${_a.name} ⚡️ orientationchange`);
62
+ DEBUG && console.debug(`${_a.name} ⚡️ orientationchange`);
65
63
  if (!(await frame(this)))
66
64
  return; //self.requestAnimationFrame(this.#ifKeyboardScrollIntoActiveElement)
67
65
  this.#ifKeyboardScrollIntoActiveElement();
68
66
  };
69
67
  #handleBodyFocusin = async () => {
70
- if (devFlags.debug)
71
- console.debug(`${_a.name} ⚡️ focusin`);
68
+ DEBUG && console.debug(`${_a.name} ⚡️ focusin`);
72
69
  await sleep(100); // self.setTimeout(this.#ifKeyboardScrollIntoActiveElement, 100)
73
70
  if (!this.isConnected)
74
71
  return;
@@ -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 view that arranges its children one on top of the other.
4
4
  *
@@ -19,11 +19,9 @@ export class VStack extends HTMLElement {
19
19
  super();
20
20
  }
21
21
  connectedCallback() {
22
- if (devFlags.debug)
23
- console.debug(`${VStack.name} ⚡️ connect`);
22
+ DEBUG && console.debug(`${VStack.name} ⚡️ connect`);
24
23
  }
25
24
  disconnectedCallback() {
26
- if (devFlags.debug)
27
- console.debug(`${VStack.name} ⚡️ disconnect`);
25
+ DEBUG && console.debug(`${VStack.name} ⚡️ disconnect`);
28
26
  }
29
27
  }
@@ -1132,7 +1132,9 @@
1132
1132
  text-field:not([hidden]),
1133
1133
  detail-placeholder:not([hidden]),
1134
1134
  sticky-container:not([hidden]),
1135
- picker-view:not([hidden])) {
1135
+ picker-view:not([hidden]),
1136
+ h-divider:not([hidden]),
1137
+ v-divider:not([hidden])) {
1136
1138
  display: grid;
1137
1139
  }
1138
1140
  :where(tab-view:has(navigation-stack:not(:defined),
@@ -1163,7 +1165,9 @@
1163
1165
  text-field:not(:defined),
1164
1166
  detail-placeholder:not(:defined),
1165
1167
  sticky-container:not(:defined),
1166
- picker-view:not(:defined)), navigation-split-view:has(navigation-stack:not(:defined),
1168
+ picker-view:not(:defined),
1169
+ h-divider:not(:defined),
1170
+ v-divider:not(:defined)), navigation-split-view:has(navigation-stack:not(:defined),
1167
1171
  navigation-split-view:not(:defined),
1168
1172
  navigation-large-title:not(:defined),
1169
1173
  navigation-title:not(:defined),
@@ -1191,7 +1195,9 @@
1191
1195
  text-field:not(:defined),
1192
1196
  detail-placeholder:not(:defined),
1193
1197
  sticky-container:not(:defined),
1194
- picker-view:not(:defined)), navigation-stack:has(navigation-stack:not(:defined),
1198
+ picker-view:not(:defined),
1199
+ h-divider:not(:defined),
1200
+ v-divider:not(:defined)), navigation-stack:has(navigation-stack:not(:defined),
1195
1201
  navigation-split-view:not(:defined),
1196
1202
  navigation-large-title:not(:defined),
1197
1203
  navigation-title:not(:defined),
@@ -1219,7 +1225,9 @@
1219
1225
  text-field:not(:defined),
1220
1226
  detail-placeholder:not(:defined),
1221
1227
  sticky-container:not(:defined),
1222
- picker-view:not(:defined))) {
1228
+ picker-view:not(:defined),
1229
+ h-divider:not(:defined),
1230
+ v-divider:not(:defined))) {
1223
1231
  visibility: hidden;
1224
1232
  }
1225
1233
  :where([is=search-view]:not([hidden]),
@@ -5303,7 +5311,7 @@
5303
5311
  --picker--stack-grid-border: if(
5304
5312
  style(--picker-style: sheet): var(--itemborder,) ; style(--picker-style: navigation-link): var(--itemborder,) ; style(--picker-style: menu): var(--itemborder,) ;
5305
5313
  );
5306
- --picker--input-stack-text-align: if(style(--picker-style: sheet): end ; style(--picker-style: navigation-link): end ; style(--picker-style: menu): end ;);
5314
+ --picker--input-stack-text-align: if(style(--picker-style: sheet): end ; style(--picker-style: navigation-link): end ; style(--picker-style: menu): start ;);
5307
5315
  }
5308
5316
  }
5309
5317
  @supports not (x: if(else:red)) {
@@ -1,5 +1,6 @@
1
1
  var _a;
2
- import { devFlags, onoff } from '../../internal/utils';
2
+ import { DEBUG } from '../../internal/flags.json' with { type: 'json' };
3
+ import { onoff } from '../../internal/utils';
3
4
  export class CSSStyleObserver {
4
5
  #cleanups;
5
6
  #options;
@@ -16,8 +17,7 @@ export class CSSStyleObserver {
16
17
  this.#cleanups?.();
17
18
  }
18
19
  #handleTransitionrun = (callback, evt) => {
19
- if (devFlags.debug)
20
- console.debug(`${_a.name} ⚡️ ${evt?.type} (${evt.propertyName})`);
20
+ DEBUG && console.debug(`${_a.name} ⚡️ ${evt?.type} (${evt.propertyName})`);
21
21
  if (!this.#options?.properties.some((prop) => evt.propertyName.startsWith(prop)))
22
22
  return;
23
23
  callback?.(evt);
@@ -1,4 +1,4 @@
1
- import { devFlags } from '../utils';
1
+ import { DEBUG } from '../../internal/flags.json' with { type: 'json' };
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
- // if (devFlags.debug) console.debug(`${makeSlotchangeHandler.name} ⚡️ ${type}`)
14
+ // 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
- // if (devFlags.debug) console.debug(`${handleTagMutation.name} ⚡️ mutation`)
21
+ // DEBUG && console.debug(`${handleTagMutation.name} ⚡️ mutation`)
22
22
  // t.setValidity(t.validity, t.validationMessage)
23
23
  // }
24
24
  // return [{ types: 'slotchange', listener: handleSlotchange }]
@@ -33,14 +33,12 @@ export class FormAssociatedBase extends HTMLElement {
33
33
  // trackedElements.set(this, new Set<Element>())
34
34
  }
35
35
  disconnectedCallback() {
36
- if (devFlags.debug)
37
- console.debug(`${FormAssociatedBase.name} ⚡️ disconnect`);
36
+ DEBUG && console.debug(`${FormAssociatedBase.name} ⚡️ disconnect`);
38
37
  CleanupRegistry.unregister(this);
39
38
  // observers.clearObservationsSet(trackedElements.get(this) ?? new Set())
40
39
  }
41
40
  connectedCallback() {
42
- if (devFlags.debug)
43
- console.debug(`${FormAssociatedBase.name} ⚡️ connect`);
41
+ DEBUG && console.debug(`${FormAssociatedBase.name} ⚡️ connect`);
44
42
  }
45
43
  get type() {
46
44
  return this.localName;
@@ -1,7 +1,8 @@
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
- import { devFlags, frame, onoff } from '../utils';
5
+ import { frame, onoff } from '../utils';
5
6
  export class NavigationView extends HTMLElement {
6
7
  static get observedAttributes() {
7
8
  return ['hidden'];
@@ -31,8 +32,7 @@ export class NavigationView extends HTMLElement {
31
32
  // consume it (important so it doesn’t leak to next change)
32
33
  this.#recentBefore = undefined;
33
34
  }
34
- if (devFlags.debug)
35
- console.debug(`${_a.name} 💡 ${eventType}`);
35
+ DEBUG && console.debug(`${_a.name} 💡 ${eventType}`);
36
36
  frame(this).then(() => target.dispatchEvent(new CustomEvent(eventType, { detail: { tag: this.id }, bubbles: true, composed: true })));
37
37
  break;
38
38
  }
@@ -56,8 +56,7 @@ export class NavigationView extends HTMLElement {
56
56
  frame(this).then(() => lifecycleObserver.dispatchEvent(new CustomEvent('tabshow', { detail: { tag: this.id }, bubbles: true, composed: true })));
57
57
  }
58
58
  #handleBeforeTabRevealOrSwap = ({ type, detail }) => {
59
- if (devFlags.debug)
60
- console.debug(`${_a.name} ⚡️ ${type}`);
59
+ DEBUG && console.debug(`${_a.name} ⚡️ ${type}`);
61
60
  if (this.id !== detail?.tag)
62
61
  return;
63
62
  this.#recentBefore = {
@@ -1,10 +1,10 @@
1
+ import { DEBUG } from '../../internal/flags.json' with { type: 'json' };
1
2
  import { Snapshot } from '../../snapshot';
2
3
  import { CleanupRegistry } from '../class/cleanup-registry';
3
- import { devFlags, onoff } from '../utils';
4
+ import { onoff } from '../utils';
4
5
  export default function (filter) {
5
6
  const handleMediaChange = (el, { type, matches }) => {
6
- if (devFlags.debug)
7
- console.debug(`${el.localName} ⚡️ ${type}`);
7
+ DEBUG && console.debug(`${el.localName} ⚡️ ${type}`);
8
8
  if (matches) {
9
9
  if (!el.matches(`[slot="cancellation-action"],[slot="primary-action"],[slot="confirmation-action"],[slot="destructive-action"]`))
10
10
  return;
@@ -23,8 +23,7 @@ export default function (filter) {
23
23
  return function (Base, _context) {
24
24
  const originalConnected = Base.prototype.connectedCallback, originalDisconnected = Base.prototype.disconnectedCallback;
25
25
  Base.prototype.connectedCallback = function () {
26
- if (devFlags.debug)
27
- console.debug(`decorator:[${this.localName}] ⚡️ connect`);
26
+ DEBUG && console.debug(`decorator:[${this.localName}] ⚡️ connect`);
28
27
  originalConnected?.call(this);
29
28
  if (filter && !filter(this))
30
29
  return;
@@ -41,8 +40,7 @@ export default function (filter) {
41
40
  });
42
41
  };
43
42
  Base.prototype.disconnectedCallback = function () {
44
- if (devFlags.debug)
45
- console.debug(`decorator:[${this.localName}] ⚡️ disconnect`);
43
+ DEBUG && console.debug(`decorator:[${this.localName}] ⚡️ disconnect`);
46
44
  originalDisconnected?.call(this);
47
45
  CleanupRegistry.unregister(this, 'adaptive-slot');
48
46
  };
@@ -23,13 +23,13 @@ class() {
23
23
  }
24
24
  }
25
25
  connectedCallback() {
26
- if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ connect`)
26
+ DEBUG && console.debug(`${NavigationTitle.name} ⚡️ connect`)
27
27
 
28
28
  this.#scheduleSync()
29
29
  }
30
30
 
31
31
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
32
- if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
32
+ DEBUG && console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
33
33
 
34
34
  this.#scheduleSync()
35
35
 
@@ -23,13 +23,13 @@ class() {
23
23
  }
24
24
  }
25
25
  connectedCallback() {
26
- if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ connect`)
26
+ DEBUG && console.debug(`${NavigationTitle.name} ⚡️ connect`)
27
27
 
28
28
  this.#scheduleSync()
29
29
  }
30
30
 
31
31
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
32
- if (devFlags.debug) console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
32
+ DEBUG && console.debug(`${NavigationTitle.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`)
33
33
 
34
34
  this.#scheduleSync()
35
35
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "DEBUG": false
3
+ }
@@ -1,5 +1,5 @@
1
+ import { DEBUG } from '../internal/flags.json' with { type: 'json' };
1
2
  import { NavigationPath } from '../internal/class/navigation-path';
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,8 +18,7 @@ const cleanup = (lm, type) => {
18
18
  el.classList.remove(...arr);
19
19
  };
20
20
  export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
21
- if (devFlags.debug)
22
- console.debug(`startViewTransition (${type})`, target);
21
+ DEBUG && console.debug(`startViewTransition (${type})`, target);
23
22
  if (!(target instanceof HTMLElement))
24
23
  throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
25
24
  if (!['forwards', 'backwards', 'reload'].includes(type))
@@ -58,9 +57,9 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
58
57
  // dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
59
58
  // if ('DIALOG' === newHost?.tagName) {
60
59
  // ;(newHost as HTMLDialogElement).showModal()
61
- // if (devFlags.debug) console.debug(`⚡️ view-transition-start (${type})`)
60
+ // DEBUG && console.debug(`⚡️ view-transition-start (${type})`)
62
61
  // await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
63
- // if (devFlags.debug) console.debug(`⚡️ view-transition-end (${type})`)
62
+ // DEBUG && console.debug(`⚡️ view-transition-end (${type})`)
64
63
  // return
65
64
  // }
66
65
  // purge
@@ -83,18 +82,14 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
83
82
  if (0 < modalViews.length) {
84
83
  for await (const el of modalViews)
85
84
  el.showModal();
86
- if (devFlags.debug)
87
- console.debug(`⚡️ view-dialog-transition-start (${type})`);
85
+ DEBUG && console.debug(`⚡️ view-dialog-transition-start (${type})`);
88
86
  await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
89
- if (devFlags.debug)
90
- console.debug(`⚡️ view-dialog-transition-end (${type})`);
87
+ DEBUG && console.debug(`⚡️ view-dialog-transition-end (${type})`);
91
88
  }
92
89
  else {
93
- if (devFlags.debug)
94
- console.debug(`⚡️ view-transition-start (${type})`);
90
+ DEBUG && console.debug(`⚡️ view-transition-start (${type})`);
95
91
  await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to?.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
96
- if (devFlags.debug)
97
- console.debug(`⚡️ view-transition-end (${type})`);
92
+ DEBUG && console.debug(`⚡️ view-transition-end (${type})`);
98
93
  }
99
94
  if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
100
95
  return;
@@ -115,11 +110,9 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
115
110
  if ('DIALOG' === from.component?.tagName) {
116
111
  from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
117
112
  from.component.close();
118
- if (devFlags.debug)
119
- console.debug(`⚡️ view-dialog-transition-start (${type})`);
113
+ DEBUG && console.debug(`⚡️ view-dialog-transition-start (${type})`);
120
114
  await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
121
- if (devFlags.debug)
122
- console.debug(`⚡️ view-dialog-transition-end (${type})`);
115
+ DEBUG && console.debug(`⚡️ view-dialog-transition-end (${type})`);
123
116
  if (from.component.matches('[open]'))
124
117
  return;
125
118
  await updateCallback();
@@ -154,11 +147,9 @@ export const startViewTransition = async (target, type = 'forwards', updateCallb
154
147
  for (const el of inbetweenModals)
155
148
  el.close(); // close old inbetween modals
156
149
  // capture trans
157
- if (devFlags.debug)
158
- console.debug(`⚡️ view-transition-start (${type})`);
150
+ DEBUG && console.debug(`⚡️ view-transition-start (${type})`);
159
151
  await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
160
- if (devFlags.debug)
161
- console.debug(`⚡️ view-transition-end (${type})`);
152
+ DEBUG && console.debug(`⚡️ view-transition-end (${type})`);
162
153
  if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
163
154
  return;
164
155
  cleanup(root);
@@ -0,0 +1,9 @@
1
+ import { type TemplateResult } from '../../tpl';
2
+ declare const DEFAULT: ">1";
3
+ interface MintFn {
4
+ (markup: TemplateResult): DocumentFragment;
5
+ <T extends Element = Element>(markup: TemplateResult, selector: typeof DEFAULT): T;
6
+ <T extends Element = Element>(markup: TemplateResult, selector: string): T;
7
+ }
8
+ declare const mint: MintFn;
9
+ export default mint;
@@ -0,0 +1,11 @@
1
+ import { renderToString } from '../../morphdom';
2
+ const DEFAULT = '>1';
3
+ const mint = ((markup, selector) => {
4
+ const template = Object.assign(document.createElement('template'), { innerHTML: renderToString(markup).toString() });
5
+ if (!selector)
6
+ return template.content;
7
+ if (selector === DEFAULT)
8
+ return template.content.firstElementChild;
9
+ return template.content.querySelector('>1' === selector ? ':first-child' : selector);
10
+ });
11
+ export default mint;
@@ -1,20 +1,54 @@
1
+ export { default as $ } from './$';
2
+ export * from './$';
1
3
  export { default as add } from './add';
2
- export { default as $ } from './cash';
4
+ export * from './add';
5
+ export { default as ancestors } from './ancestors';
6
+ export * from './ancestors';
3
7
  export { default as clamp } from './clamp';
8
+ export * from './clamp';
4
9
  export { default as compareBigDecimals } from './compare-big-decimals';
10
+ export * from './compare-big-decimals';
5
11
  export { default as cssTime } from './css-time';
12
+ export * from './css-time';
6
13
  export { default as debounce } from './debounce';
14
+ export * from './debounce';
7
15
  export { default as defineTranslations } from './define-translations';
16
+ export * from './define-translations';
8
17
  export { default as devFlags } from './dev-flags';
18
+ export * from './dev-flags';
9
19
  export { default as ensurePlaceholder } from './ensure-placeholder';
20
+ export * from './ensure-placeholder';
10
21
  export { default as frame } from './frame';
22
+ export * from './frame';
11
23
  export { default as isInside } from './is-inside';
24
+ export * from './is-inside';
12
25
  export { default as kebabCase } from './kebab-case';
26
+ export * from './kebab-case';
13
27
  export { default as listActive } from './list-active';
28
+ export * from './list-active';
14
29
  export { default as microtask } from './microtask';
30
+ export * from './microtask';
31
+ export { default as nextAll } from './next-all';
32
+ export * from './next-all';
33
+ export { default as next } from './next';
34
+ export * from './next';
15
35
  export { default as onoff } from './onoff';
36
+ export * from './onoff';
37
+ export { default as prevAll } from './prev-all';
38
+ export * from './prev-all';
39
+ export { default as prev } from './prev';
40
+ export * from './prev';
41
+ export { default as prop } from './prop';
42
+ export * from './prop';
16
43
  export { default as set } from './set';
44
+ export * from './set';
45
+ export { default as siblings } from './siblings';
46
+ export * from './siblings';
17
47
  export { default as sleep } from './sleep';
48
+ export * from './sleep';
18
49
  export { default as slowHideShow } from './slow-hide-show';
50
+ export * from './slow-hide-show';
19
51
  export { default as timeout } from './timeout';
52
+ export * from './timeout';
20
53
  export { default as touchGlass } from './touch-glass';
54
+ export * from './touch-glass';
@@ -1,23 +1,54 @@
1
- // import * as _intl from './intl'
2
- // import cash from './cash'
1
+ export { default as $ } from './$';
2
+ export * from './$';
3
3
  export { default as add } from './add';
4
- export { default as $ } from './cash';
4
+ export * from './add';
5
+ export { default as ancestors } from './ancestors';
6
+ export * from './ancestors';
5
7
  export { default as clamp } from './clamp';
8
+ export * from './clamp';
6
9
  export { default as compareBigDecimals } from './compare-big-decimals';
10
+ export * from './compare-big-decimals';
7
11
  export { default as cssTime } from './css-time';
12
+ export * from './css-time';
8
13
  export { default as debounce } from './debounce';
14
+ export * from './debounce';
9
15
  export { default as defineTranslations } from './define-translations';
16
+ export * from './define-translations';
10
17
  export { default as devFlags } from './dev-flags';
18
+ export * from './dev-flags';
11
19
  export { default as ensurePlaceholder } from './ensure-placeholder';
20
+ export * from './ensure-placeholder';
12
21
  export { default as frame } from './frame';
22
+ export * from './frame';
13
23
  export { default as isInside } from './is-inside';
24
+ export * from './is-inside';
14
25
  export { default as kebabCase } from './kebab-case';
26
+ export * from './kebab-case';
15
27
  export { default as listActive } from './list-active';
28
+ export * from './list-active';
16
29
  export { default as microtask } from './microtask';
30
+ export * from './microtask';
31
+ export { default as nextAll } from './next-all';
32
+ export * from './next-all';
33
+ export { default as next } from './next';
34
+ export * from './next';
17
35
  export { default as onoff } from './onoff';
36
+ export * from './onoff';
37
+ export { default as prevAll } from './prev-all';
38
+ export * from './prev-all';
39
+ export { default as prev } from './prev';
40
+ export * from './prev';
41
+ export { default as prop } from './prop';
42
+ export * from './prop';
18
43
  export { default as set } from './set';
44
+ export * from './set';
45
+ export { default as siblings } from './siblings';
46
+ export * from './siblings';
19
47
  export { default as sleep } from './sleep';
48
+ export * from './sleep';
20
49
  export { default as slowHideShow } from './slow-hide-show';
50
+ export * from './slow-hide-show';
21
51
  export { default as timeout } from './timeout';
52
+ export * from './timeout';
22
53
  export { default as touchGlass } from './touch-glass';
23
- // export const $: typeof cash = cash
54
+ export * from './touch-glass';
@@ -1,4 +1,5 @@
1
- import { devFlags, onoff } from '../internal/utils';
1
+ import { DEBUG } from '../internal/flags.json' with { type: 'json' };
2
+ import { onoff } from '../internal/utils';
2
3
  export class Snapshot {
3
4
  static #readyCalled = false;
4
5
  static #config;
@@ -45,12 +46,10 @@ export class Snapshot {
45
46
  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
47
  this.#breakpoints = new Map([['fine_dialog_sheet', mediaQueryList.matches]]);
47
48
  this.#listeners.add(onoff('change', (evt) => this.#handleMediaChange(evt, 'fine_dialog_sheet:change'), mediaQueryList).on());
48
- if (devFlags.debug)
49
- console.debug(this.#config);
49
+ DEBUG && console.debug(this.#config);
50
50
  }
51
51
  static #handleMediaChange = ({ type, matches, media }, kind) => {
52
- if (devFlags.debug)
53
- console.debug(`${Snapshot.name} ⚡️ ${type}`);
52
+ DEBUG && console.debug(`${Snapshot.name} ⚡️ ${type}`);
54
53
  this.#breakpoints?.set('fine_dialog_sheet', matches);
55
54
  this.on.dispatchEvent(new MediaQueryListEvent(kind, {
56
55
  matches,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.103",
3
+ "version": "0.0.0-dev.105",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -66,20 +66,23 @@
66
66
  "build:ts": "tsc",
67
67
  "build:scss": "sass --style=expanded --no-source-map scss/index.scss generated/css/index.css",
68
68
  "build:manifest": "tsx scripts/make-manifest.ts && prettier ./web-components.html-data/en.json && prettier ./web-components.css-data/en.json --write",
69
- "build:barrels": "npm run build:barrels:components && npm run build:barrels:events && npm run build:barrels:buses && npm run build:barrels:tpl && npm run build:barrels:morphdom && npm run build:barrels:i18n",
69
+ "build:barrels": "npm run build:barrels:components && npm run build:barrels:events && npm run build:barrels:buses && npm run build:barrels:i18n && npm run build:barrels:tpl && npm run build:barrels:morphdom && npm run build:barrels:decorators && npm run build:barrels:utils",
70
70
  "build:barrels:components": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --directory ./js/components --exclude \".\\.test\\.ts\"",
71
71
  "build:barrels:events": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --directory ./js/events --exclude \".\\.test\\.ts\"",
72
- "build:barrels:buses": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/buses",
73
- "build:barrels:i18n": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --fullPathname --directory ./js/i18n/locales",
72
+ "build:barrels:buses": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/buses --exclude \".\\.test\\.ts\"",
73
+ "build:barrels:i18n": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --fullPathname --directory ./js/i18n/locales --exclude \".\\.test\\.ts\"",
74
74
  "build:barrels:tpl": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/tpl --exclude \".\\.test\\.ts\"",
75
75
  "build:barrels:morphdom": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/morphdom --exclude \".\\.test\\.ts\"",
76
- "build:barrels:decorators": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/internal/decorators",
76
+ "build:barrels:decorators": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/internal/decorators --exclude \".\\.test\\.ts\"",
77
+ "build:barrels:utils": "barrelsby --noHeader --delete --singleQuotes --noSemicolon --exportDefault --directory ./js/internal/utils --exclude \".\\.test\\.ts\"",
77
78
  "format:check": "prettier . --check",
78
79
  "format:write": "prettier . --write",
79
80
  "lint:scripts": "tsc -p tsconfig.scripts.json --noEmit",
80
81
  "test": "vitest --dom",
81
- "prepackage": "rm -rf generated",
82
- "package": "npm run build:ts && npm run build:scss",
82
+ "prepackage": "rm -rf generated && npm run debug:off",
83
+ "package": "npm run build:ts && npm run build:scss ; npm run debug:reset",
84
+ "debug:off": "node -e \"const fs=require('node:fs');const f='./js/internal/flags.json';const j=JSON.parse(fs.readFileSync(f));j.DEBUG=false;fs.writeFileSync(f,JSON.stringify(j,null,2)+'\\n')\"",
85
+ "debug:reset": "git checkout -- ./js/internal/flags.json",
83
86
  "version:pkg": "npm version $npm_config_bump --no-git-tag-version --preid=dev"
84
87
  },
85
88
  "devDependencies": {
@@ -32,7 +32,9 @@
32
32
  text-field,
33
33
  detail-placeholder,
34
34
  sticky-container,
35
- picker-view {
35
+ picker-view,
36
+ h-divider,
37
+ v-divider {
36
38
  :where(&:not([hidden])) {
37
39
  display: grid;
38
40
  }
@@ -248,7 +248,7 @@ $picker-ifs: (
248
248
  style(--picker-style: sheet): var(--itemborder,) ; style(--picker-style: navigation-link): var(--itemborder,) ; style(--picker-style: menu): var(--itemborder,) ;
249
249
  );
250
250
  // --picker--input-stack-child-place-self: if(style(--picker-style: sheet): end ; style(--picker-style: navigation-link): end ; style(--picker-style: menu): end ;);
251
- --picker--input-stack-text-align: if(style(--picker-style: sheet): end ; style(--picker-style: navigation-link): end ; style(--picker-style: menu): end ;);
251
+ --picker--input-stack-text-align: if(style(--picker-style: sheet): end ; style(--picker-style: navigation-link): end ; style(--picker-style: menu): start ;);
252
252
 
253
253
  // SECTION experimental only in chrome
254
254
  // --picker--input-stack-flex-shrink: if(