@swiftwc/ui 0.0.0-dev.86 → 0.0.0-dev.88

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 (41) hide show
  1. package/generated/components/bordered-button.js +1 -1
  2. package/generated/components/bordered-prominent-button.js +1 -1
  3. package/generated/components/borderless-button.js +1 -1
  4. package/generated/components/date-picker.js +4 -3
  5. package/generated/components/glass-button.js +1 -1
  6. package/generated/components/glass-prominent-button.js +1 -1
  7. package/generated/components/image-view.js +10 -11
  8. package/generated/components/label-view.js +13 -10
  9. package/generated/components/labeled-content.js +43 -23
  10. package/generated/components/menu-view.js +3 -2
  11. package/generated/components/navigation-title.js +22 -16
  12. package/generated/components/picker-view.js +13 -8
  13. package/generated/components/progress-view.js +4 -3
  14. package/generated/components/scroll-view.js +26 -7
  15. package/generated/components/section-view.js +33 -17
  16. package/generated/components/table-view.js +5 -6
  17. package/generated/components/text-field.js +3 -2
  18. package/generated/components/toggle-view.js +3 -2
  19. package/generated/components/tool-bar-item.js +2 -2
  20. package/generated/internal/utils/ensure-placeholder.d.ts +1 -1
  21. package/generated/internal/utils/ensure-placeholder.js +74 -34
  22. package/generated/internal/utils/index.d.ts +0 -3
  23. package/generated/internal/utils/index.js +0 -3
  24. package/generated/internal/vendor/morphdom.d.ts +6 -0
  25. package/generated/internal/vendor/morphdom.js +720 -0
  26. package/generated/morphdom/html.d.ts +8 -0
  27. package/generated/morphdom/html.js +37 -0
  28. package/generated/morphdom/index.d.ts +6 -0
  29. package/generated/morphdom/index.js +6 -0
  30. package/generated/morphdom/morph.d.ts +4 -0
  31. package/generated/morphdom/morph.js +9 -0
  32. package/generated/morphdom/query-morph.d.ts +5 -0
  33. package/generated/morphdom/query-morph.js +12 -0
  34. package/package.json +4 -3
  35. package/web-components.html-data/en.json +3 -0
  36. package/generated/internal/utils/render-label-icon.d.ts +0 -2
  37. package/generated/internal/utils/render-label-icon.js +0 -19
  38. package/generated/internal/utils/render-label-title.d.ts +0 -2
  39. package/generated/internal/utils/render-label-title.js +0 -16
  40. package/generated/internal/utils/render-label.d.ts +0 -1
  41. package/generated/internal/utils/render-label.js +0 -19
@@ -28,11 +28,11 @@ let ToolBarItem = ToolBarItem_1 = class ToolBarItem extends HTMLElement {
28
28
  const role = this.getAttribute('data-previous-slot') ?? this.getAttribute('slot') ?? '', tKey = this.getAttribute('title-key');
29
29
  if (['confirmation-action', 'cancellation-action'].includes(role))
30
30
  Snapshot.waitReady.then(() => {
31
- ensurePlaceholder(this.querySelector(':scope>button'), role, tKey);
31
+ ensurePlaceholder(this.querySelector(':scope>button'), role, tKey, Snapshot.config);
32
32
  this.#mutationObserver = new MutationObserver((mutations) => {
33
33
  for (const { target } of mutations)
34
34
  if (target instanceof HTMLElement)
35
- ensurePlaceholder(this.querySelector(':scope>button'), role, tKey);
35
+ ensurePlaceholder(this.querySelector(':scope>button'), role, tKey, Snapshot.config);
36
36
  });
37
37
  this.#mutationObserver.observe(this, {
38
38
  childList: true,
@@ -1 +1 @@
1
- export default function (target: HTMLElement | null, role: string | null, titleKey?: string | null): void;
1
+ export default function (target: HTMLElement | null, role: string | null, titleKey?: string | null, config?: Record<string, string>): void;
@@ -1,55 +1,95 @@
1
1
  import { I18n } from '../../i18n';
2
- import { Snapshot } from '../../snapshot';
3
- import { default as $ } from './cash';
4
- function renderPlaceholder(el, role, titleKey) {
5
- // if (!el.isConnected) return
6
- // self.requestAnimationFrame(() => {
7
- // if (!el.isConnected) return
8
- const label = el.querySelector(':scope>[slot=placeholder]') ?? el.appendChild($(`<label-view slot="placeholder"></label-view>`, '>1'));
2
+ import { html, queryMorph } from '../../morphdom';
3
+ // type ButtonRole = keyof ReturnType<typeof I18n.t<'ButtonRole'>>
4
+ // function renderPlaceholder(el: HTMLElement, role: string | null, titleKey?: ButtonRole, config?: Record<string, string>) {
5
+ // // if (!el.isConnected) return
6
+ // // self.requestAnimationFrame(() => {
7
+ // // if (!el.isConnected) return
8
+ // let title: string | undefined, systemImage: string | undefined
9
+ // // const label = el.querySelector(':scope>[slot=placeholder]') ?? el.appendChild($(`<label-view slot="placeholder"></label-view>`, '>1'))
10
+ // switch (role) {
11
+ // case 'cancel':
12
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel //label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel)
13
+ // systemImage = config?.['cancel-button-icon'] ?? '' //label.setAttribute('system-image', config?.['cancel-button-icon'] ?? '')
14
+ // break
15
+ // case 'close':
16
+ // if (el.closest('[is=alert-dialog]')) {
17
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').OK //.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').OK)
18
+ // } else {
19
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Close //label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Close)
20
+ // systemImage = config?.['close-button-icon'] ?? '' //label.setAttribute('system-image', config?.['close-button-icon'] ?? '')
21
+ // }
22
+ // break
23
+ // case 'confirm':
24
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm //label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm)
25
+ // systemImage = config?.['confirm-button-icon'] ?? '' //label.setAttribute('system-image', config?.['confirm-button-icon'] ?? '')
26
+ // break
27
+ // case 'confirmation-action':
28
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm //label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm)
29
+ // systemImage = config?.['confirm-button-icon'] ?? '' //label.setAttribute('system-image', config?.['confirm-button-icon'] ?? '')
30
+ // break
31
+ // case 'cancellation-action':
32
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel //label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel)
33
+ // systemImage = config?.['cancel-button-icon'] ?? '' //label.setAttribute('system-image', config?.['cancel-button-icon'] ?? '')
34
+ // break
35
+ // case 'destructive':
36
+ // title = titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Destructive // label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Destructive)
37
+ // systemImage = config?.['delete-button-icon'] ?? '' // label.setAttribute('system-image', config?.['delete-button-icon'] ?? '')
38
+ // break
39
+ // // default:
40
+ // // label?.remove()
41
+ // // break
42
+ // }
43
+ // queryMorph(
44
+ // '[slot=placeholder]',
45
+ // html`<label-view slot="placeholder">${systemImage ? html`<image-view slot="icon" system-name="${systemImage}"></image-view>` : null}${title ? html`<span>${title}</span>` : null}</label-view>`,
46
+ // el,
47
+ // { removeIf: !title }
48
+ // )
49
+ // // if (role) {
50
+ // // label.setAttribute('title', I18n.t('ButtonRole').Default.Destructive)
51
+ // // } else label?.remove()
52
+ // // })
53
+ // }
54
+ export default function (target, role, titleKey, config) {
55
+ if (!target)
56
+ return;
57
+ const overiderTitle = typeof titleKey === 'string' && titleKey in I18n.t('ButtonRole') ? titleKey : undefined;
58
+ // renderPlaceholder(target, role, overiderTitle, config)
59
+ let title, systemImage;
60
+ // const label = el.querySelector(':scope>[slot=placeholder]') ?? el.appendChild($(`<label-view slot="placeholder"></label-view>`, '>1'))
9
61
  switch (role) {
10
62
  case 'cancel':
11
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel);
12
- label.setAttribute('system-image', Snapshot.config['cancel-button-icon']);
63
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Cancel;
64
+ systemImage = config?.['cancel-button-icon'] ?? '';
13
65
  break;
14
66
  case 'close':
15
- if (label.closest('[is=alert-dialog]')) {
16
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').OK);
67
+ if (target.closest('[is=alert-dialog]')) {
68
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').OK;
17
69
  }
18
70
  else {
19
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Close);
20
- label.setAttribute('system-image', Snapshot.config['close-button-icon']);
71
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Close;
72
+ systemImage = config?.['close-button-icon'] ?? '';
21
73
  }
22
74
  break;
23
75
  case 'confirm':
24
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm);
25
- label.setAttribute('system-image', Snapshot.config['confirm-button-icon']);
76
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Confirm;
77
+ systemImage = config?.['confirm-button-icon'] ?? '';
26
78
  break;
27
79
  case 'confirmation-action':
28
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Confirm);
29
- label.setAttribute('system-image', Snapshot.config['confirm-button-icon']);
80
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Confirm;
81
+ systemImage = config?.['confirm-button-icon'] ?? '';
30
82
  break;
31
83
  case 'cancellation-action':
32
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Cancel);
33
- label.setAttribute('system-image', Snapshot.config['cancel-button-icon']);
84
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Cancel;
85
+ systemImage = config?.['cancel-button-icon'] ?? '';
34
86
  break;
35
87
  case 'destructive':
36
- label.setAttribute('title', titleKey && titleKey in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[titleKey] : I18n.t('ButtonRole').Destructive);
37
- label.setAttribute('system-image', Snapshot.config['delete-button-icon']);
38
- break;
39
- default:
40
- label?.remove();
88
+ title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Destructive;
89
+ systemImage = config?.['delete-button-icon'] ?? '';
41
90
  break;
42
91
  }
43
- // if (role) {
44
- // label.setAttribute('title', I18n.t('ButtonRole').Default.Destructive)
45
- // } else label?.remove()
46
- // })
47
- }
48
- export default function (target, role, titleKey) {
49
- if (!target)
50
- return;
51
- const overiderTitle = typeof titleKey === 'string' && titleKey in I18n.t('ButtonRole') ? titleKey : undefined;
52
- renderPlaceholder(target, role, overiderTitle);
92
+ queryMorph('[slot=placeholder]', html `<label-view slot="placeholder">${systemImage ? html `<image-view slot="icon" system-name="${systemImage}"></image-view>` : null}${title ? html `<span>${title}</span>` : null}</label-view>`, target, { removeIf: !title });
53
93
  // CleanupRegistry.unregister(target, 'i18n')
54
94
  // CleanupRegistry.register(target, onoff('localechange', () => renderPlaceholder(target, role, overiderTitle), I18n.on).on(), 'i18n')
55
95
  }
@@ -13,9 +13,6 @@ export { default as kebabCase } from './kebab-case';
13
13
  export { default as listActive } from './list-active';
14
14
  export { default as microtask } from './microtask';
15
15
  export { default as onoff } from './onoff';
16
- export { default as renderLabel } from './render-label';
17
- export { default as renderLabelIcon } from './render-label-icon';
18
- export { default as renderLabelTitle } from './render-label-title';
19
16
  export { default as set } from './set';
20
17
  export { default as sleep } from './sleep';
21
18
  export { default as slowHideShow } from './slow-hide-show';
@@ -15,9 +15,6 @@ export { default as kebabCase } from './kebab-case';
15
15
  export { default as listActive } from './list-active';
16
16
  export { default as microtask } from './microtask';
17
17
  export { default as onoff } from './onoff';
18
- export { default as renderLabel } from './render-label';
19
- export { default as renderLabelIcon } from './render-label-icon';
20
- export { default as renderLabelTitle } from './render-label-title';
21
18
  export { default as set } from './set';
22
19
  export { default as sleep } from './sleep';
23
20
  export { default as slowHideShow } from './slow-hide-show';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * VENDORIZED FROM https://github.com/patrick-steele-idem/morphdom/blob/master/dist/morphdom-esm.js
3
+ * at 2026-06-21
4
+ */
5
+ declare var morphdom: (fromNode: any, toNode: any, options: any) => any;
6
+ export default morphdom;