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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/generated/client/index.d.ts +2 -9
  2. package/generated/client/index.js +11 -156
  3. package/generated/components/alert-dialog.js +18 -21
  4. package/generated/components/body-view.js +3 -2
  5. package/generated/components/bordered-button.js +4 -4
  6. package/generated/components/bordered-prominent-button.js +4 -4
  7. package/generated/components/borderless-button.js +4 -4
  8. package/generated/components/confirmation-dialog.js +18 -21
  9. package/generated/components/content-unavailable-view.js +4 -4
  10. package/generated/components/date-picker.d.ts +0 -10
  11. package/generated/components/date-picker.js +43 -28
  12. package/generated/components/disclosure-group.js +5 -5
  13. package/generated/components/fine-tooltip.js +4 -4
  14. package/generated/components/form-view.js +3 -3
  15. package/generated/components/glass-button.js +4 -4
  16. package/generated/components/glass-prominent-button.js +4 -4
  17. package/generated/components/index.d.ts +1 -0
  18. package/generated/components/index.js +1 -0
  19. package/generated/components/label-view.js +4 -4
  20. package/generated/components/list-view.js +15 -17
  21. package/generated/components/menu-view.js +14 -16
  22. package/generated/components/navigation-large-title.js +5 -5
  23. package/generated/components/navigation-split-view.js +4 -3
  24. package/generated/components/navigation-stack.js +4 -3
  25. package/generated/components/navigation-title.js +4 -4
  26. package/generated/components/picker-view.d.ts +2 -2
  27. package/generated/components/picker-view.js +313 -192
  28. package/generated/components/plain-button.js +3 -3
  29. package/generated/components/progress-view.js +6 -6
  30. package/generated/components/screen-view.js +2 -1
  31. package/generated/components/scroll-view-proxy.js +3 -2
  32. package/generated/components/scroll-view.js +15 -18
  33. package/generated/components/search-view.d.ts +8 -0
  34. package/generated/components/search-view.js +27 -0
  35. package/generated/components/section-view.js +4 -4
  36. package/generated/components/sheet-view.js +6 -34
  37. package/generated/components/sidebar-toggle.js +9 -10
  38. package/generated/components/sidebar-view.js +6 -8
  39. package/generated/components/sticky-container.js +3 -3
  40. package/generated/components/tab-bar.js +8 -10
  41. package/generated/components/tab-item.js +8 -8
  42. package/generated/components/tab-view.js +10 -11
  43. package/generated/components/table-view.js +18 -36
  44. package/generated/components/text-field.js +32 -17
  45. package/generated/components/tool-bar-item-group.js +17 -19
  46. package/generated/components/tool-bar-item.js +22 -23
  47. package/generated/components/tool-bar.d.ts +2 -2
  48. package/generated/components/tool-bar.js +7 -7
  49. package/generated/components/v-keyboard.js +5 -5
  50. package/generated/components/v-stack.js +3 -2
  51. package/generated/css/index.css +286 -272
  52. package/generated/events/picker-view.d.ts +6 -0
  53. package/generated/i18n/locales/el.d.ts +1 -0
  54. package/generated/i18n/locales/el.js +1 -0
  55. package/generated/i18n/locales/en.d.ts +1 -0
  56. package/generated/i18n/locales/en.js +1 -0
  57. package/generated/internal/class/css-style-observer.js +2 -2
  58. package/generated/internal/class/form-associated-base.d.ts +0 -4
  59. package/generated/internal/class/form-associated-base.js +21 -41
  60. package/generated/internal/class/mutation-observer-set.d.ts +9 -0
  61. package/generated/internal/class/mutation-observer-set.js +42 -0
  62. package/generated/internal/class/mutation-observer-singleton.js +18 -0
  63. package/generated/internal/class/navigation-view.js +3 -3
  64. package/generated/internal/decorators/adaptive-slot.d.ts +1 -0
  65. package/generated/internal/decorators/adaptive-slot.js +47 -0
  66. package/generated/internal/decorators/custom-element.d.ts +1 -1
  67. package/generated/internal/decorators/custom-element.js +2 -1
  68. package/generated/internal/decorators/index.d.ts +4 -0
  69. package/generated/internal/decorators/index.js +4 -0
  70. package/generated/internal/privateNamespace.d.ts +10 -0
  71. package/generated/internal/privateNamespace.js +159 -1
  72. package/generated/internal/utils/debug.d.ts +1 -0
  73. package/generated/internal/utils/debug.js +3 -0
  74. package/generated/internal/utils/index.d.ts +3 -3
  75. package/generated/internal/utils/index.js +5 -3
  76. package/generated/namespace-browser/base.d.ts +9 -0
  77. package/generated/namespace-browser/base.js +23 -0
  78. package/generated/snapshot/index.d.ts +1 -1
  79. package/generated/snapshot/index.js +4 -4
  80. package/package.json +2 -1
  81. package/scss/_components.scss +2 -0
  82. package/scss/base/_root.scss +10 -8
  83. package/scss/colors/_index.scss +9 -12
  84. package/scss/components/_h-stack.scss +1 -1
  85. package/scss/components/_index.scss +2 -0
  86. package/scss/components/_menu-view.scss +11 -5
  87. package/scss/components/_picker-view.scss +11 -2
  88. package/scss/components/_scroll-view.scss +4 -0
  89. package/scss/components/_search-view.scss +18 -0
  90. package/scss/components/_sheet-view.scss +2 -1
  91. package/scss/components/_sticky-container.scss +1 -1
  92. package/scss/placeholders/_lists.scss +46 -36
  93. package/scss/utils/_index.scss +21 -7
  94. package/scss/utils/_stacks.scss +5 -43
  95. package/web-components.html-data/en.json +11 -0
@@ -1,17 +1,10 @@
1
1
  import { lifecycleObserver } from '../buses';
2
2
  import { I18n } from '../i18n';
3
3
  import { NavigationPath } from '../internal/class/navigation-path';
4
- import { type NavigationHost } from '../internal/privateNamespace';
4
+ import { type NavigationHost, queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
5
5
  import { type WebComponentCtor } from '../namespace-browser';
6
6
  import { Snapshot } from '../snapshot';
7
7
  export declare const polyfills: Map<string, WebComponentCtor>;
8
- type TransitionType = 'forwards' | 'backwards' | 'reload';
9
- type UpdateCallback = () => void | Promise<void>;
10
- type NavigateOptions = {
11
- updateCallback?: UpdateCallback;
12
- tos?: () => NavigationPath[];
13
- };
14
- export declare const startViewTransition: (target: HTMLElement, type?: TransitionType, updateCallbackOrOptions?: UpdateCallback | NavigateOptions) => Promise<void>;
15
8
  export declare const alert: (title?: string, message?: string, actions?: {
16
9
  label?: string;
17
10
  image?: string;
@@ -27,5 +20,5 @@ export declare const confirmationDialog: (trigger: HTMLElement, title: string, m
27
20
  controller?: AbortController;
28
21
  titleVisibility?: boolean;
29
22
  }) => Promise<string>;
30
- export { I18n, lifecycleObserver, NavigationPath, Snapshot };
23
+ export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
31
24
  export { type NavigationHost };
@@ -2,8 +2,10 @@ import { alertDialog, confirmationDialog as confirmationDialogBus, lifecycleObse
2
2
  import * as Components from '../components';
3
3
  import { I18n } from '../i18n';
4
4
  import { NavigationPath } from '../internal/class/navigation-path';
5
- import { $, kebabCase, onoff } from '../internal/utils';
5
+ import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
6
+ import { $, debug, kebabCase, onoff } from '../internal/utils';
6
7
  import { Snapshot } from '../snapshot';
8
+ //#region polyfills
7
9
  export const polyfills = new Map();
8
10
  for (const [k, Ctor] of Object.entries(Components)) {
9
11
  const is = kebabCase(k);
@@ -23,7 +25,7 @@ for (const [k, Ctor] of Object.entries(Components)) {
23
25
  if (!customElements.get(is))
24
26
  customElements.define(is, Ctor);
25
27
  }
26
- console.debug(polyfills);
28
+ debug(polyfills);
27
29
  if (0 < polyfills.size) {
28
30
  const polyfillTagNamesCache = new Set([...polyfills.values()].map((v) => String(v.polyfillExtends ?? '').toUpperCase()).filter(Boolean)); // ['TAG-NAME1', 'TAG-NAME2', ...]
29
31
  const handlers = new WeakMap();
@@ -53,7 +55,7 @@ if (0 < polyfills.size) {
53
55
  }, unobserve = (el) => {
54
56
  handlers.delete(el);
55
57
  }, polyfillTagNamesCacheSelector = [...polyfillTagNamesCache.values()].map((v) => `${v}`.toLowerCase()).join(','), flatten = (node) => [node, ...(node.querySelectorAll?.(polyfillTagNamesCacheSelector) ?? [])];
56
- console.debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
58
+ debug(polyfillTagNamesCache, polyfillTagNamesCacheSelector);
57
59
  for (const [is, polyfill] of polyfills)
58
60
  for (const el of document.querySelectorAll(`${polyfill.polyfillExtends}[is="${CSS.escape(is)}"]`)) {
59
61
  polyfill.polyfillConnectedCallback(el);
@@ -101,6 +103,7 @@ if (0 < polyfills.size) {
101
103
  }
102
104
  // SECTION: Safari polyfill
103
105
  document.addEventListener('touchstart', () => { }, { passive: true });
106
+ //#endregion
104
107
  // SECTION
105
108
  const handleHelp = ({ target, relatedTarget }) => {
106
109
  if (!(target instanceof HTMLElement && target))
@@ -164,157 +167,7 @@ if (mediaQueryList.matches)
164
167
  ['pointerout', handleDone],
165
168
  ])
166
169
  document.addEventListener(k, v, { passive: true });
167
- // SECTION: Transitions
168
- const cleanup = (lm, type) => {
169
- let arr = [Snapshot.config['vt-fwd-class-name'], 'fwdd', 'fwn', 'fwnn', 'bwd', 'bwdd', 'bwn', 'bwnn'];
170
- if (['backwards', 'forwards'].includes(type ?? ''))
171
- for (let i = arr.length - 1; i >= 0; i--)
172
- if (arr[i].startsWith('backwards' === type ? 'fw' : 'bw'))
173
- arr.splice(i, 1);
174
- for (const el of [...(lm?.querySelectorAll(arr.map((v) => `.${v}`).join(',')) ?? [])])
175
- el.classList.remove(...arr);
176
- };
177
- export const startViewTransition = async (target, type = 'forwards', updateCallbackOrOptions = async () => { }) => {
178
- console.debug(`startViewTransition (${type})`, target);
179
- if (!(target instanceof HTMLElement))
180
- throw new TypeError("Argument 1 ('target') to client.startViewTransition must be an instance of HTMLElement");
181
- if (!['forwards', 'backwards', 'reload'].includes(type))
182
- throw new TypeError("Argument 2 ('type') to client.startViewTransition must be of TransitionType");
183
- const options = typeof updateCallbackOrOptions === 'function'
184
- ? {
185
- updateCallback: updateCallbackOrOptions,
186
- }
187
- : (updateCallbackOrOptions ?? {}), updateCallback = options.updateCallback ?? (async () => { });
188
- await Snapshot.waitReady;
189
- const from = new NavigationPath(target); //const from = closestBody(target) //event.target as HTMLElement)
190
- if ('forwards' === type) {
191
- await updateCallback(); // updatetheDOMSomehow
192
- // Snapshot.getSnapshot(from)
193
- // const root = getRootViewController(from)
194
- // const oldPath = new NavigationPath(from)
195
- const root = [from, ...from.parents()]
196
- .map((item) => item.component)
197
- .filter(Boolean)
198
- .at(-1);
199
- // const { toolBarConfig: oldToolbars } = getComputedView(from) // const { toolBarConfig: oldToolbars, slot: oldSLot, page: oldPage } = getComputedView(from) //
200
- // console.log(88, oldPage, oldPath.page, oldSLot, oldPath.slot, oldToolbars, oldPath.toolBarConfig)
201
- // const oldToolbars = Snapshot.toolbarItems
202
- // const { toolBarConfig: oldToolbars, host: oldHost } = getComputedView(from)
203
- const tos = options.tos?.() ?? [...from.children()].map((item) => item?.hydrate()), //queryBodyAll(oldSLot), //[...oldPath.children()].map((item) => item.body).filter(Boolean),//
204
- to = tos.at(-1),
205
- // to = newPath?.body, //tos.slice(-1)?.pop?.(), //Snapshot.leaf, //
206
- // newHost = newPath?.component, //{ host: newHost } = getComputedView(to),
207
- newToolbars = tos.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item),
208
- // .map((item) => item.toolBarConfig)
209
- // .flat()
210
- // .filter(Boolean), //queryToolbarConfigAll(oldSLot),
211
- modalViews = tos.map((item) => item.component).filter((item) => !!item && item.matches('dialog')); //[...queryHostAll(oldPage)].filter?.((item) => item?.matches('dialog'))
212
- // toFrame = Snapshot.leafContainer, //queryHostAll(from).slice(-1)?.pop?.(),
213
- // toToolbars = Snapshot.leafToolbarItems
214
- // dialogFrames = [toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item): item is HTMLDialogElement => item instanceof HTMLDialogElement) //[toFrame, ...(Snapshot.leaveFrames ?? [])].filter((item) => item?.matches('dialog'))
215
- // if ('DIALOG' === newHost?.tagName) {
216
- // ;(newHost as HTMLDialogElement).showModal()
217
- // console.debug(`⚡️ view-transition-start (${type})`)
218
- // await Promise.allSettled(newHost.getAnimations().map(({ finished }) => finished))
219
- // console.debug(`⚡️ view-transition-end (${type})`)
220
- // return
221
- // }
222
- // purge
223
- cleanup(root, 'backwards');
224
- // prepare old
225
- from.body?.classList.add(Snapshot.config['vt-fwd-class-name']);
226
- from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
227
- for (const oldToolbar of from.toolBarConfig ?? [])
228
- oldToolbar.classList.add('fwn'); // prepare navbs
229
- // prepare new
230
- const toolbarExclusion = 0 < modalViews.length
231
- ? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar,body-view ~ tool-bar)')
232
- : (value, index, array) => value.parentElement?.matches('tool-bar:not(body-view ~ tool-bar)'), bodyExclusion = 0 < modalViews.length ? (item) => item.body?.matches('scroll-view:not(dialog scroll-view)') : (value, index, array) => value;
233
- for (const bti of newToolbars?.filter?.(toolbarExclusion) ?? [])
234
- bti.classList.add('fwnn'); // for (const ti of newToolbars ?? []) ti.classList.add('fwnn') //
235
- for (const bt of tos?.filter?.(bodyExclusion) ?? []) {
236
- bt.body?.classList.add('fwdd'); //to?.classList.add('fwdd')
237
- bt.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: bt.body }, bubbles: true, composed: true }));
238
- }
239
- if (0 < modalViews.length) {
240
- for await (const el of modalViews)
241
- el.showModal();
242
- console.debug(`⚡️ view-dialog-transition-start (${type})`);
243
- await Promise.allSettled(modalViews?.[0].getAnimations().map(({ finished }) => finished));
244
- console.debug(`⚡️ view-dialog-transition-end (${type})`);
245
- }
246
- else {
247
- console.debug(`⚡️ view-transition-start (${type})`);
248
- await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to?.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
249
- console.debug(`⚡️ view-transition-end (${type})`);
250
- }
251
- if (0 < (to?.component?.querySelectorAll(`.${Snapshot.config?.['vt-fwd-class-name']},.bwd`) ?? []).length)
252
- return;
253
- cleanup(root);
254
- }
255
- else {
256
- // Snapshot.getSnapshot(from)
257
- // const oldPath = new NavigationPath(from)
258
- const root = [from, ...from.parents()]
259
- .map((item) => item.component)
260
- .filter(Boolean)
261
- .at(-1); // const root = getRootViewController(from)
262
- //const { toolBarConfig: oldToolbars, host: oldHost, page: oldPage, slot: oldSlot } = getComputedView(from)
263
- const froms = [...from.children()].map((item) => item?.hydrate());
264
- const oldToolbars = froms.flatMap((item) => item.toolBarConfig ?? []).filter((item) => !!item), oldBodies = froms.map((item) => item.body).filter((item) => !!item);
265
- // console.log(99, queryToolbarConfigAll(oldSlot), oldToolbars)
266
- // if most-top effect is closing a modal, skip everything
267
- if ('DIALOG' === from.component?.tagName) {
268
- from.body?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: from.body }, bubbles: true, composed: true }));
269
- from.component.close();
270
- console.debug(`⚡️ view-dialog-transition-start (${type})`);
271
- await Promise.allSettled(from.component.getAnimations().map(({ finished }) => finished));
272
- console.debug(`⚡️ view-dialog-transition-end (${type})`);
273
- if (from.component.matches('[open]'))
274
- return;
275
- await updateCallback();
276
- return; // just close modal
277
- }
278
- const to = [...from.parents()].at(0)?.hydrate(); //closestBody(oldPath.component?.parentElement ?? undefined)
279
- // console.log(99, to)
280
- if (!to)
281
- return console.debug('Can not go backwards.'); // nothing to go back to
282
- const tv = to.body?.closest('tab-view');
283
- if (tv && to.body?.matches('tab-view>navigation-stack:has(> navigation-stack,> navigation-split-view)>:scope'))
284
- if ('bottom-bar' !== tv.tabBarPlacement)
285
- return;
286
- // const { toolBarConfig: newToolbars } = getComputedView(to.body)
287
- // purge
288
- cleanup(root, 'forwards');
289
- // prepare new
290
- for (const ti of to.toolBarConfig ?? [])
291
- ti.classList.add('bwnn');
292
- to.body?.classList.add('bwdd');
293
- to.body?.dispatchEvent(new CustomEvent('pagereveal', { detail: { page: to.body }, bubbles: true, composed: true }));
294
- // prepare old
295
- const inbetweenModals = froms.map((item) => item.component).filter((item) => !!item && item.matches('dialog[open]')), //queryHostAll(oldPage).filter?.((item) => item.matches('dialog[open]')) ?? [], // FIXME: TEst this, added oldHost too
296
- toolbarExclusion = 0 < inbetweenModals.length
297
- ? (value, index, array) => value.parentElement?.matches('tool-bar:not(dialog tool-bar)')
298
- : (value, index, array) => value, bodyExclusion = 0 < inbetweenModals.length ? (item) => item?.matches('scroll-view:not(dialog scroll-view)') : (item) => item;
299
- for (const ti of [...(from.toolBarConfig ?? []), ...(oldToolbars?.filter?.(toolbarExclusion) ?? [])])
300
- ti.classList.add('bwn');
301
- for (const nn of [from.body, ...oldBodies?.filter?.(bodyExclusion)]) {
302
- nn?.classList.add('bwd'); //from?.classList.add('bwd')
303
- nn?.dispatchEvent(new CustomEvent('pageswap', { detail: { page: nn }, bubbles: true, composed: true }));
304
- }
305
- for (const el of inbetweenModals)
306
- el.close(); // close old inbetween modals
307
- // capture trans
308
- console.debug(`⚡️ view-transition-start (${type})`);
309
- await Promise.allSettled([...(from.body?.getAnimations().map(({ finished }) => finished) ?? []), ...(to.body?.getAnimations().map(({ finished }) => finished) ?? [])]);
310
- console.debug(`⚡️ view-transition-end (${type})`);
311
- if (to.body?.closest(`.bwd,.${Snapshot.config?.['vt-fwd-class-name']}`))
312
- return;
313
- cleanup(root);
314
- // remove or hide
315
- await updateCallback();
316
- }
317
- };
170
+ //#region fns
318
171
  export const alert = async (title, message, actions, options) => {
319
172
  await navigator.locks.request('alert:', async () => {
320
173
  const dialog = $(`<dialog is="alert-dialog"></dialog>`, '>1'), vStack = dialog.querySelector(':scope>v-stack') ?? dialog.appendChild($(`<v-stack spacing="1" alignment="fill"></v-stack>`, '>1'));
@@ -410,6 +263,8 @@ export const confirmationDialog = async (trigger, title, message, actions, optio
410
263
  // // controller.signal.addEventListener('abort', onAbort, { once: true })
411
264
  // })
412
265
  };
266
+ //#endregion
413
267
  void Snapshot.waitReady; // void Snapshot.setOwnConfig()
414
- // SECTION
415
- export { I18n, lifecycleObserver, NavigationPath, Snapshot };
268
+ //#region exports
269
+ export { I18n, lifecycleObserver, NavigationPath, queryInsertPosition, Snapshot, startViewTransition };
270
+ //#endregion
@@ -1,13 +1,13 @@
1
1
  import { alertDialog } from '../buses';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { onoff, touchGlass } from '../internal/utils';
3
+ import { debug, onoff, touchGlass } from '../internal/utils';
4
4
  import { DialogBase } from '../namespace-browser/base';
5
5
  export class AlertDialog extends DialogBase {
6
6
  constructor() {
7
7
  super();
8
8
  }
9
9
  static polyfillDisconnectedCallback(el) {
10
- console.debug(`${AlertDialog.name} ⚡️ disconnect`);
10
+ debug(`${AlertDialog.name} ⚡️ disconnect`);
11
11
  CleanupRegistry.unregister(el);
12
12
  alertDialog.dispatchEvent(new CustomEvent('alert:return', {
13
13
  detail: { returnValue: el.returnValue },
@@ -16,21 +16,20 @@ export class AlertDialog extends DialogBase {
16
16
  }));
17
17
  }
18
18
  static polyfillConnectedCallback(el) {
19
- console.debug(`${AlertDialog.name} ⚡️ connect`);
19
+ debug(`${AlertDialog.name} ⚡️ connect`);
20
20
  CleanupRegistry.register(el, onoff([
21
21
  { types: 'click', listener: this.#handleDialogClick },
22
22
  { types: 'close', listener: this.#handleDialogClose },
23
23
  { types: 'cancel', listener: this.#handleDialogCancel },
24
24
  ], el).on());
25
- CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (evt) => {
26
- const target = evt.target instanceof HTMLElement && evt.target;
27
- if (!target)
25
+ CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
26
+ if (!(target instanceof HTMLElement && target))
28
27
  return true;
29
28
  if (target.matches('[is=alert-dialog]'))
30
29
  return false;
31
30
  return true;
32
31
  }), el).on());
33
- console.debug(`${AlertDialog.name} ⚡️ will-open`);
32
+ debug(`${AlertDialog.name} ⚡️ will-open`);
34
33
  el.removeAttribute('closing');
35
34
  el.scrollTop = 0;
36
35
  el.returnValue = '';
@@ -38,7 +37,7 @@ export class AlertDialog extends DialogBase {
38
37
  el.showModal();
39
38
  }
40
39
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
41
- console.debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
40
+ debug(`${AlertDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
42
41
  switch (attributeName) {
43
42
  case 'label':
44
43
  //
@@ -46,12 +45,11 @@ export class AlertDialog extends DialogBase {
46
45
  }
47
46
  }
48
47
  static #handleDialogClick = (evt) => {
49
- console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
50
- const dialog = evt.currentTarget instanceof HTMLDialogElement && evt.currentTarget;
51
- if (!dialog)
48
+ debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
49
+ const { target, currentTarget: dialog } = evt;
50
+ if (!(dialog instanceof HTMLDialogElement && dialog))
52
51
  return;
53
- const target = evt.target instanceof HTMLElement && evt.target;
54
- if (!target)
52
+ if (!(target instanceof HTMLElement && target))
55
53
  return;
56
54
  const button = target.closest('button');
57
55
  if (!button)
@@ -67,15 +65,15 @@ export class AlertDialog extends DialogBase {
67
65
  evt.stopImmediatePropagation();
68
66
  };
69
67
  static #handleDialogCancel = (evt) => {
70
- console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
68
+ debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
71
69
  if (!evt.cancelable)
72
70
  return;
73
- const target = evt.target instanceof HTMLDialogElement && evt.target;
74
- if (!target)
71
+ const { target } = evt;
72
+ if (!(target instanceof HTMLDialogElement && target))
75
73
  return;
76
74
  evt.preventDefault();
77
75
  target.inert = true;
78
- console.debug(`${AlertDialog.name} ⚡️ will-close`);
76
+ debug(`${AlertDialog.name} ⚡️ will-close`);
79
77
  target.setAttribute('closing', '');
80
78
  Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
81
79
  if (!target.hasAttribute('closing'))
@@ -84,10 +82,9 @@ export class AlertDialog extends DialogBase {
84
82
  target.removeAttribute('closing');
85
83
  });
86
84
  };
87
- static #handleDialogClose = (evt) => {
88
- console.debug(`${AlertDialog.name} ⚡️ ${evt?.type}`);
89
- const target = evt.target instanceof HTMLDialogElement && evt.target;
90
- if (!target)
85
+ static #handleDialogClose = ({ type, target }) => {
86
+ debug(`${AlertDialog.name} ⚡️ ${type}`);
87
+ if (!(target instanceof HTMLDialogElement && target))
91
88
  return;
92
89
  target.remove();
93
90
  };
@@ -1,11 +1,12 @@
1
+ import { debug } from '../internal/utils';
1
2
  export class BodyView extends HTMLElement {
2
3
  constructor() {
3
4
  super();
4
5
  }
5
6
  disconnectedCallback() {
6
- console.debug(`${BodyView.name} ⚡️ disconnect`);
7
+ debug(`${BodyView.name} ⚡️ disconnect`);
7
8
  }
8
9
  connectedCallback() {
9
- console.debug(`${BodyView.name} ⚡️ connect`);
10
+ debug(`${BodyView.name} ⚡️ connect`);
10
11
  }
11
12
  }
@@ -1,5 +1,5 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { ensurePlaceholder, onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
4
  import { Snapshot } from '../snapshot';
5
5
  /**
@@ -14,16 +14,16 @@ export class BorderedButton extends ButtonBase {
14
14
  super();
15
15
  }
16
16
  static polyfillDisconnectedCallback(el) {
17
- console.debug(`${BorderedButton.name} ⚡️ disconnect`);
17
+ debug(`${BorderedButton.name} ⚡️ disconnect`);
18
18
  CleanupRegistry.unregister(el);
19
19
  }
20
20
  static polyfillConnectedCallback(el) {
21
- console.debug(`${BorderedButton.name} ⚡️ connect`);
21
+ debug(`${BorderedButton.name} ⚡️ connect`);
22
22
  el.tabIndex = 0;
23
23
  CleanupRegistry.register(el, onoff('click', BorderedButton.#handleClick, el).on());
24
24
  }
25
25
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
26
- console.debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
26
+ debug(`${BorderedButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
27
27
  const node = target instanceof HTMLButtonElement && target;
28
28
  if (!node)
29
29
  return;
@@ -1,5 +1,5 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { ensurePlaceholder, onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
4
  import { Snapshot } from '../snapshot';
5
5
  /**
@@ -14,16 +14,16 @@ export class BorderedProminentButton extends ButtonBase {
14
14
  super();
15
15
  }
16
16
  static polyfillDisconnectedCallback(el) {
17
- console.debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
17
+ debug(`${BorderedProminentButton.name} ⚡️ disconnect`);
18
18
  CleanupRegistry.unregister(el);
19
19
  }
20
20
  static polyfillConnectedCallback(el) {
21
- console.debug(`${BorderedProminentButton.name} ⚡️ connect`);
21
+ debug(`${BorderedProminentButton.name} ⚡️ connect`);
22
22
  el.tabIndex = 0;
23
23
  CleanupRegistry.register(el, onoff('click', BorderedProminentButton.#handleClick, el).on());
24
24
  }
25
25
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
26
- console.debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
26
+ debug(`${BorderedProminentButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
27
27
  const node = target instanceof HTMLButtonElement && target;
28
28
  if (!node)
29
29
  return;
@@ -1,5 +1,5 @@
1
1
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
- import { ensurePlaceholder, onoff } from '../internal/utils';
2
+ import { debug, ensurePlaceholder, onoff } from '../internal/utils';
3
3
  import { ButtonBase } from '../namespace-browser/base';
4
4
  import { Snapshot } from '../snapshot';
5
5
  /**
@@ -14,16 +14,16 @@ export class BorderlessButton extends ButtonBase {
14
14
  super();
15
15
  }
16
16
  static polyfillDisconnectedCallback(el) {
17
- console.debug(`${BorderlessButton.name} ⚡️ disconnect`);
17
+ debug(`${BorderlessButton.name} ⚡️ disconnect`);
18
18
  CleanupRegistry.unregister(el);
19
19
  }
20
20
  static polyfillConnectedCallback(el) {
21
- console.debug(`${BorderlessButton.name} ⚡️ connect`);
21
+ debug(`${BorderlessButton.name} ⚡️ connect`);
22
22
  el.tabIndex = 0;
23
23
  CleanupRegistry.register(el, onoff('click', BorderlessButton.#handleClick, el).on());
24
24
  }
25
25
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
26
- console.debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
26
+ debug(`${BorderlessButton.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
27
27
  const node = target instanceof HTMLButtonElement && target;
28
28
  if (!node)
29
29
  return;
@@ -1,6 +1,6 @@
1
1
  import { confirmationDialog } from '../buses';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { isInside, onoff, touchGlass } from '../internal/utils';
3
+ import { debug, isInside, onoff, touchGlass } from '../internal/utils';
4
4
  import { DialogBase } from '../namespace-browser/base';
5
5
  export class ConfirmationDialog extends DialogBase {
6
6
  static get observedAttributes() {
@@ -10,7 +10,7 @@ export class ConfirmationDialog extends DialogBase {
10
10
  super();
11
11
  }
12
12
  static polyfillDisconnectedCallback(el) {
13
- console.debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
13
+ debug(`${ConfirmationDialog.name} ⚡️ disconnect`);
14
14
  const positionAnchor = el.style.getPropertyValue('position-anchor');
15
15
  document.querySelector(`[style*="${positionAnchor}"]`)?.style.removeProperty('anchor-name'); //$.prop('anchor-name', null, document.querySelector<HTMLElement>(`[style*="${positionAnchor}"]`))
16
16
  el.style.removeProperty('position-anchor'); //$.prop('position-anchor', null, el)
@@ -22,22 +22,21 @@ export class ConfirmationDialog extends DialogBase {
22
22
  }));
23
23
  }
24
24
  static polyfillConnectedCallback(el) {
25
- console.debug(`${ConfirmationDialog.name} ⚡️ connect`);
25
+ debug(`${ConfirmationDialog.name} ⚡️ connect`);
26
26
  CleanupRegistry.register(el, onoff([
27
27
  { types: 'click', listener: this.#handleDialogClick },
28
28
  { types: 'close', listener: this.#handleDialogClose },
29
29
  { types: 'cancel', listener: this.#handleDialogCancel },
30
30
  ], el).on());
31
- CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, (evt) => {
32
- const target = evt.target instanceof HTMLElement && evt.target;
33
- if (!target)
31
+ CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
32
+ if (!(target instanceof HTMLElement && target))
34
33
  return true;
35
34
  if (target.matches('[is=confirmation-dialog]'))
36
35
  return false;
37
36
  // if (!(event.target as HTMLElement).closest('menu-view[open]')) return false
38
37
  return true;
39
38
  }), el).on());
40
- console.debug(`${ConfirmationDialog.name} ⚡️ will-open`);
39
+ debug(`${ConfirmationDialog.name} ⚡️ will-open`);
41
40
  el.removeAttribute('closing');
42
41
  el.scrollTop = 0;
43
42
  el.returnValue = '';
@@ -45,7 +44,7 @@ export class ConfirmationDialog extends DialogBase {
45
44
  el.showModal();
46
45
  }
47
46
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
48
- console.debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
47
+ debug(`${ConfirmationDialog.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
49
48
  // const newValue = (target as HTMLElement).getAttribute(attributeName ?? '')
50
49
  switch (attributeName) {
51
50
  case 'label':
@@ -58,12 +57,11 @@ export class ConfirmationDialog extends DialogBase {
58
57
  }
59
58
  }
60
59
  static #handleDialogClick = (evt) => {
61
- console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
62
- const dialog = evt.currentTarget instanceof HTMLDialogElement && evt.currentTarget;
63
- if (!dialog)
60
+ debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
61
+ const { target, currentTarget: dialog } = evt;
62
+ if (!(dialog instanceof HTMLDialogElement && dialog))
64
63
  return;
65
- const target = evt.target instanceof HTMLElement && evt.target;
66
- if (!target)
64
+ if (!(target instanceof HTMLElement && target))
67
65
  return;
68
66
  if (target.matches('dialog') && !isInside(evt.clientX, evt.clientY, dialog.getBoundingClientRect()))
69
67
  return dialog.requestClose(); // click outside
@@ -81,15 +79,15 @@ export class ConfirmationDialog extends DialogBase {
81
79
  evt.stopImmediatePropagation();
82
80
  };
83
81
  static #handleDialogCancel = (evt) => {
84
- console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
82
+ debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
85
83
  if (!evt.cancelable)
86
84
  return;
87
- const target = evt.target instanceof HTMLDialogElement && evt.target;
88
- if (!target)
85
+ const { target } = evt;
86
+ if (!(target instanceof HTMLDialogElement && target))
89
87
  return;
90
88
  evt.preventDefault();
91
89
  target.inert = true;
92
- console.debug(`${ConfirmationDialog.name} ⚡️ will-close`);
90
+ debug(`${ConfirmationDialog.name} ⚡️ will-close`);
93
91
  target.setAttribute('closing', '');
94
92
  Promise.allSettled(target.getAnimations().map(({ finished }) => finished)).then(() => {
95
93
  if (!target.hasAttribute('closing'))
@@ -98,10 +96,9 @@ export class ConfirmationDialog extends DialogBase {
98
96
  target.removeAttribute('closing');
99
97
  });
100
98
  };
101
- static #handleDialogClose = (evt) => {
102
- console.debug(`${ConfirmationDialog.name} ⚡️ ${evt?.type}`);
103
- const target = evt.target instanceof HTMLDialogElement && evt.target;
104
- if (!target)
99
+ static #handleDialogClose = ({ type, target }) => {
100
+ debug(`${ConfirmationDialog.name} ⚡️ ${type}`);
101
+ if (!(target instanceof HTMLDialogElement && target))
105
102
  return;
106
103
  target.remove();
107
104
  };
@@ -1,6 +1,6 @@
1
1
  import { I18n } from '../i18n';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { $, onoff } from '../internal/utils';
3
+ import { $, debug, onoff } from '../internal/utils';
4
4
  /**
5
5
  * @summary A message with a title and extra information that you show when part of your app can’t be used.
6
6
  *
@@ -46,13 +46,13 @@ export class ContentUnavailableView extends HTMLElement {
46
46
  };
47
47
  }
48
48
  disconnectedCallback() {
49
- console.debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
49
+ debug(`${ContentUnavailableView.name} ⚡️ disconnect`);
50
50
  }
51
51
  connectedCallback() {
52
- console.debug(`${ContentUnavailableView.name} ⚡️ connect`);
52
+ debug(`${ContentUnavailableView.name} ⚡️ connect`);
53
53
  }
54
54
  attributeChangedCallback(name, oldValue, newValue) {
55
- console.debug(`${ContentUnavailableView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
55
+ debug(`${ContentUnavailableView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
56
56
  switch (name) {
57
57
  case 'search':
58
58
  if (oldValue === newValue)
@@ -10,16 +10,6 @@ export declare class DatePicker extends FormAssociatedBase {
10
10
  disconnectedCallback(): void;
11
11
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
12
12
  get datePickerStyle(): DatePickerStyle;
13
- get selection(): {
14
- year: string;
15
- month: string;
16
- day: string;
17
- };
18
- set selection(v: {
19
- year: string;
20
- month: string;
21
- day: string;
22
- });
23
13
  get name(): string;
24
14
  get value(): {
25
15
  year: string;