@swiftwc/ui 0.0.0-dev.92 → 0.0.0-dev.93

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 (62) hide show
  1. package/generated/components/alert-dialog.d.ts +1 -2
  2. package/generated/components/alert-dialog.js +1 -2
  3. package/generated/components/body-view.d.ts +3 -0
  4. package/generated/components/body-view.js +3 -0
  5. package/generated/components/bordered-button.d.ts +2 -2
  6. package/generated/components/bordered-button.js +2 -2
  7. package/generated/components/bordered-prominent-button.d.ts +2 -2
  8. package/generated/components/bordered-prominent-button.js +2 -2
  9. package/generated/components/borderless-button.d.ts +2 -2
  10. package/generated/components/borderless-button.js +2 -2
  11. package/generated/components/content-unavailable.d.ts +25 -0
  12. package/generated/components/{content-unavailable-view.js → content-unavailable.js} +8 -8
  13. package/generated/components/date-picker.d.ts +1 -1
  14. package/generated/components/date-picker.js +2 -2
  15. package/generated/components/glass-button.d.ts +2 -2
  16. package/generated/components/glass-button.js +2 -2
  17. package/generated/components/glass-prominent-button.d.ts +2 -2
  18. package/generated/components/glass-prominent-button.js +2 -2
  19. package/generated/components/h-stack.d.ts +1 -1
  20. package/generated/components/h-stack.js +1 -1
  21. package/generated/components/index.d.ts +1 -1
  22. package/generated/components/index.js +1 -1
  23. package/generated/components/label-view.d.ts +5 -2
  24. package/generated/components/label-view.js +7 -4
  25. package/generated/components/labeled-content.js +3 -3
  26. package/generated/components/list-view.js +0 -12
  27. package/generated/components/menu-view.d.ts +1 -1
  28. package/generated/components/menu-view.js +2 -8
  29. package/generated/components/navigation-stack.js +0 -2
  30. package/generated/components/navigation-title.js +0 -9
  31. package/generated/components/picker-view.d.ts +1 -0
  32. package/generated/components/picker-view.js +7 -6
  33. package/generated/components/progress-view.js +1 -1
  34. package/generated/components/scroll-view.js +0 -1
  35. package/generated/components/search-view.js +0 -3
  36. package/generated/components/section-view.d.ts +1 -1
  37. package/generated/components/section-view.js +3 -48
  38. package/generated/components/sheet-view.js +0 -20
  39. package/generated/components/sidebar-view.js +1 -1
  40. package/generated/components/tab-bar.js +0 -3
  41. package/generated/components/tab-view.js +0 -70
  42. package/generated/components/table-view.js +2 -2
  43. package/generated/components/text-field.d.ts +1 -1
  44. package/generated/components/text-field.js +2 -2
  45. package/generated/components/toggle-view.d.ts +2 -0
  46. package/generated/components/toggle-view.js +3 -1
  47. package/generated/components/v-stack.d.ts +1 -1
  48. package/generated/components/v-stack.js +1 -1
  49. package/generated/css/index.css +24 -17
  50. package/generated/events/scroll-view.js +0 -4
  51. package/generated/events/text-field.js +0 -3
  52. package/generated/events/toggle-view.js +0 -3
  53. package/generated/internal/utils/ensure-placeholder.js +0 -55
  54. package/package.json +1 -1
  55. package/scss/_components.scss +1 -1
  56. package/scss/components/{_content-unavailable-view.scss → _content-unavailable.scss} +1 -1
  57. package/scss/components/_index.scss +5 -4
  58. package/scss/components/_labeled-content.scss +8 -0
  59. package/scss/components/_navigation-title.scss +1 -1
  60. package/scss/components/_toggle-view.scss +1 -1
  61. package/web-components.html-data/en.json +27 -21
  62. package/generated/components/content-unavailable-view.d.ts +0 -25
@@ -1,7 +1,7 @@
1
1
  import { $, devFlags } from '../internal/utils';
2
2
  import { html, queryMorph } from '../morphdom';
3
3
  /**
4
- * @summary A container view that you can use to add hierarchy within certain views.
4
+ * @summary A container view that groups related content together.
5
5
  *
6
6
  * @slot — The default slot.
7
7
  * @slot header
@@ -26,84 +26,39 @@ export class SectionView extends HTMLElement {
26
26
  // <div class="sticky-sentinel" style="grid-area:sentinel;inline-size:100%;block-size:0.1px;pointer-events:none;"></div>
27
27
  }
28
28
  #shadowRoot;
29
- // #observer?: IntersectionObserver
30
- // #sibling?: HTMLElement
31
- // #sentinel?: HTMLElement
32
- // #sentinelIsIntersecting: boolean = false
33
- // #isIntersecting: boolean = false
34
29
  constructor() {
35
30
  super();
36
31
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
37
- // Snapshot.waitReady.then(() => {
38
32
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
39
- // this.#sentinel = this.#shadowRoot.querySelector('.sticky-sentinel') ?? undefined
40
- // })
41
33
  }
42
34
  attributeChangedCallback(name, oldValue, newValue) {
43
35
  if (devFlags.debug)
44
36
  console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
45
- // Snapshot.waitReady.then(() => {
46
37
  switch (name) {
47
38
  case 'header':
48
- // if (!newValue) {
49
- // this.querySelector(':scope>[slot=header]')?.remove()
50
- // break
51
- // }
52
- // const header = this.querySelector(':scope>[slot=header]') ?? this.appendChild(Object.assign(document.createElement('header'), { slot: 'header' }))
53
39
  queryMorph('[slot=header]', html `<header slot="header">
54
40
  <label-view line-limit="1" truncation-mode="tail" font="callout">
55
41
  <span>${newValue}</span>
56
42
  </label-view>
57
43
  </header>`, this, { removeIf: !newValue });
58
- // render(
59
- // html`<label-view line-limit="1" truncation-mode="tail" font="callout">
60
- // <span>${newValue}</span>
61
- // </label-view>`,
62
- // header
63
- // )
64
44
  break;
65
45
  case 'footer':
66
- // if (!newValue) {
67
- // this.querySelector(':scope>[slot=footer]')?.remove()
68
- // break
69
- // }
70
- // const footer = this.querySelector(':scope>[slot=footer]') ?? this.appendChild(Object.assign(document.createElement('footer'), { slot: 'footer' }))
71
46
  queryMorph('[slot=footer]', html `<footer slot="footer">
72
47
  <label-view line-limit="1" truncation-mode="tail" font="callout">
73
48
  <span>${newValue}</span>
74
49
  </label-view>
75
50
  </footer>`, this, { removeIf: !newValue });
76
- // render(
77
- // html`<label-view line-limit="1" truncation-mode="tail" font="callout">
78
- // <span>${newValue}</span>
79
- // </label-view>`,
80
- // footer
81
- // )
82
51
  break;
83
52
  }
84
- // })
85
53
  }
86
54
  disconnectedCallback() {
87
55
  if (devFlags.debug)
88
56
  console.debug(`${SectionView.name} ⚡️ disconnect`);
89
- // if (this.#sentinel) this.#observer?.unobserve(this.#sentinel)
90
- // this.#observer?.unobserve(this)
57
+ //
91
58
  }
92
59
  connectedCallback() {
93
60
  if (devFlags.debug)
94
61
  console.debug(`${SectionView.name} ⚡️ connect`);
95
- // this.#sibling = this.closest('scroll-view') ?? undefined
96
- // Snapshot.waitReady.then(() => {
97
- // if (!(await frame(this))) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
98
- // const blockSizeProp = getComputedStyle(this).getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
99
- // blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 1)
100
- // this.#observer = new IntersectionObserver(this.#handleIntersect, {
101
- // root: this.#sibling,
102
- // rootMargin: `-${blockSize}px 0px 0px 0px`,
103
- // threshold: [0, 1],
104
- // })
105
- // if (this.#sentinel) this.#observer.observe(this.#sentinel)
106
- // this.#observer.observe(this)
107
- // })
62
+ //
108
63
  }
109
64
  }
@@ -22,26 +22,6 @@ export class SheetView extends DialogBase {
22
22
  static polyfillAttributeChangedCallback([{ attributeName, target, oldValue }]) {
23
23
  if (devFlags.debug)
24
24
  console.debug(`${SheetView.name} ⚡️ attr-change [${attributeName}] ("${oldValue}" → "${target.getAttribute(attributeName ?? '')}")`);
25
- // // NOTE: wait for config
26
- // Snapshot.waitReady.then(() => {
27
- // switch (attributeName) {
28
- // case 'fine-presentation-large-adaptation':
29
- // const node = target instanceof HTMLDialogElement && target
30
- // if (!node) break
31
- // CleanupRegistry.unregister(node, 'mediaquery')
32
- // if ('bottom-bar' !== target.getAttribute(attributeName ?? '')) break
33
- // const mediaQueryList = self.matchMedia(`(pointer: fine) and (min-width: ${Snapshot.config!['ipad-sheet-view-inline-size']}) and (min-height: ${Snapshot.config!['ipad-sheet-view-height']})`)
34
- // SheetView.#handleMediaChange(
35
- // node,
36
- // new MediaQueryListEvent(`media-change`, {
37
- // matches: mediaQueryList.matches,
38
- // })
39
- // ) // Initial check
40
- // const handler1 = SheetView.#handleMediaChange.bind(null, node)
41
- // CleanupRegistry.register(node, onoff('change', handler1 as unknown as EventListener, mediaQueryList).on(), 'mediaquery')
42
- // break
43
- // }
44
- // })
45
25
  }
46
26
  static #handleKeydown = (evt) => {
47
27
  if (devFlags.debug)
@@ -22,7 +22,7 @@ export class SidebarView extends DialogBase {
22
22
  }), el).on());
23
23
  el.autofocus = true;
24
24
  }
25
- /** Autoclose on click outside. */
25
+ // Autoclose on click outside.
26
26
  static #handleClick = async ({ target, type }) => {
27
27
  if (devFlags.debug)
28
28
  console.debug(`${SidebarView.name} ⚡️ ${type}`);
@@ -18,8 +18,6 @@ export class TabBar extends DialogBase {
18
18
  if (devFlags.debug)
19
19
  console.debug(`${TabBar.name} ⚡️ connect`);
20
20
  el.autofocus = true;
21
- // Snapshot.waitReadyFor(el).then((r) => {
22
- // if (!r) return
23
21
  CleanupRegistry.register(el, onoff('click', TabBar.#handleClick, el).on());
24
22
  CleanupRegistry.register(el, onoff(touchGlass(el, (t) => t, ({ target }) => {
25
23
  if (!(target instanceof HTMLElement))
@@ -30,7 +28,6 @@ export class TabBar extends DialogBase {
30
28
  return false;
31
29
  return true;
32
30
  }), el).on());
33
- // })
34
31
  }
35
32
  static #handleClick = async ({ target, type }) => {
36
33
  if (devFlags.debug)
@@ -48,23 +48,6 @@ export class TabView extends HTMLElement {
48
48
  });
49
49
  this.#cssStyleObserver.observe(this, this.#handleStyleChange);
50
50
  Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange)); // Snapshot.waitReady.then(this.#handleStyleChange)
51
- // NOTE: wait for config
52
- // Snapshot.waitReady.then(() => { // FIXME: Check this removed!
53
- // for (const [or, w, handler] of [
54
- // ['portrait', `max-width:${Snapshot.config!['ipad-portrait-bp-max']}`, this.#handleMediaChange],
55
- // ['landscape', `max-width:${Snapshot.config!['ipad-landscape-bp-max']}`, this.#handleMediaChange],
56
- // ['portrait', `min-width:${Snapshot.config!['ipad-portrait-bp-min']}`, this.#handleMediaChange],
57
- // ['landscape', `min-width:${Snapshot.config!['ipad-landscape-bp-min']}`, this.#handleMediaChange],
58
- // ]) {
59
- // const mediaQueryList = self.matchMedia(`(orientation:${or}) and (${w})`)
60
- // if (mediaQueryList.matches)
61
- // this.#handleMediaChange(
62
- // new MediaQueryListEvent('media-change', {
63
- // matches: mediaQueryList.matches,
64
- // })
65
- // ) // Initial check
66
- // CleanupRegistry.register(this, onoff('change', handler as EventListener, mediaQueryList).on())
67
- // }
68
51
  CleanupRegistry.register(this, onoff([
69
52
  { types: 'tabreveal tabswap', listener: this.#debouncedHandler },
70
53
  { types: 'beforetabreveal beforetabswap', listener: this.#addAnimations },
@@ -75,7 +58,6 @@ export class TabView extends HTMLElement {
75
58
  listener: this.#handleSummaryClick,
76
59
  },
77
60
  ], this).on());
78
- // })
79
61
  }
80
62
  #handleSummaryClick = ({ target }) => {
81
63
  if (!(target instanceof HTMLElement))
@@ -116,57 +98,6 @@ export class TabView extends HTMLElement {
116
98
  }));
117
99
  }
118
100
  };
119
- // #handleMediaChange: (evt: MediaQueryListEvent) => void = (evt) => {
120
- // if (devFlags.debug) console.debug(`${TabView.name} ⚡️ ${evt?.type}`)
121
- // if (!evt.matches) return
122
- // this.#handleStyleChange()
123
- // // if (evt.matches) {
124
- // // const placement = self.getComputedStyle(this).getPropertyValue('--adaptable-tab-bar-placement'), // or do it manually without any computedstyle
125
- // // newValue = (TAB_BAR_PLACEMENTS as readonly string[]).includes(placement) ? (placement as (typeof TAB_BAR_PLACEMENTS)[number]) : 'bottom-bar'
126
- // // if (newValue !== this.#cachedAdaptableTabBarPlacement) {
127
- // // const oldValue = this.#cachedAdaptableTabBarPlacement
128
- // // this.#cachedAdaptableTabBarPlacement = newValue
129
- // // this.dispatchEvent(
130
- // // new CustomEvent<TabViewAdaptableTabBarPlacementDetail>('tab-view:adaptable-tab-bar-placement-change', {
131
- // // detail: { oldValue, newValue },
132
- // // bubbles: true,
133
- // // composed: true,
134
- // // })
135
- // // )
136
- // // }
137
- // // }
138
- // // // trigger more-stack (dis)allowed event
139
- // // if (evt.matches !== this.#moreStackAllowed) {
140
- // // this.#moreStackAllowed = evt.matches
141
- // // const eventType = evt.matches ? 'tab-view:more-tab-allowed' : 'tab-view:more-tab-disallowed'
142
- // // this.dispatchEvent(new CustomEvent<TabMoreStackAllowanceDetail>(eventType, { detail: { moreTab: this.moreTab }, bubbles: true, composed: true }))
143
- // // }
144
- // // if (evt.matches) return // no button triggers should happen, already on iphone portrait
145
- // // const innerSelection = this.moreTab?.querySelector(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')?.id
146
- // // if (innerSelection) {
147
- // // const btn = this.querySelector<HTMLButtonElement>(`[is="tab-item"][value="${CSS.escape(innerSelection)}"]`)
148
- // // // NOTE: simulate btn click BU WITHOUT tabroot functionality!
149
- // // if (btn) {
150
- // // const newTab = this.querySelector<NavigationStack | NavigationSplitView>(`#${btn.getAttribute('value')}`)
151
- // // if (newTab) {
152
- // // this.selectedTab = TabView.gatherTab(newTab)
153
- // // return
154
- // // }
155
- // // }
156
- // // }
157
- // // const outerSelection = this?.querySelector(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')?.id
158
- // // if (outerSelection && outerSelection === this.moreTab?.id) {
159
- // // const btn = this.querySelector<HTMLButtonElement>(`[is="tab-item"]:not([value="${CSS.escape(outerSelection)}"])`)
160
- // // // NOTE: simulate btn click BU WITHOUT tabroot functionality!
161
- // // if (btn) {
162
- // // const newTab = this.querySelector<NavigationStack | NavigationSplitView>(`#${btn.getAttribute('value')}`)
163
- // // if (newTab) {
164
- // // this.selectedTab = TabView.gatherTab(newTab)
165
- // // return
166
- // // }
167
- // // }
168
- // // }
169
- // }
170
101
  #handleAdaptableTabBarPlacementChange = (evt) => {
171
102
  if (devFlags.debug)
172
103
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
@@ -198,7 +129,6 @@ export class TabView extends HTMLElement {
198
129
  }
199
130
  };
200
131
  get selectedTab() {
201
- // return this.querySelector<NavigationStack | NavigationSplitView>(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')
202
132
  return [...this.querySelectorAll('navigation-stack:not([hidden]),navigation-split-view:not([hidden])')];
203
133
  }
204
134
  set selectedTab(tabs) {
@@ -116,8 +116,8 @@ export class TableView extends HTMLElement {
116
116
  <label-view font="callout" foreground="secondary"></label-view>
117
117
  </v-stack>
118
118
  </button>`, '>1'), title = btn.querySelector('label-view:first-child') ?? undefined, subTitle = btn.querySelector('label-view:last-child') ?? undefined;
119
- queryMorph(':not([slot])', html `<span>${node.textContent.trim()}</span>`, title, { removeIf: !node.textContent.trim() }); //renderLabelTitle(title, node.textContent.trim()) //title?.setAttribute('title', node.textContent.trim())
120
- queryMorph(':not([slot])', html `<span>${node.ariaSort ?? ''}</span>`, subTitle, { removeIf: !(node.ariaSort ?? '') }); //renderLabelTitle(subTitle, node.ariaSort ?? '') //subTitle?.setAttribute('title', node.ariaSort ?? '')
119
+ queryMorph(':not([slot])', html `<span>${node.textContent.trim()}</span>`, title, { removeIf: !node.textContent.trim() });
120
+ queryMorph(':not([slot])', html `<span>${node.ariaSort ?? ''}</span>`, subTitle, { removeIf: !(node.ariaSort ?? '') });
121
121
  this.#compactToolbarItem.appendChild(btn);
122
122
  }
123
123
  };
@@ -2,7 +2,7 @@ import { FormAssociatedBase } from '../internal/class/form-associated-base';
2
2
  declare const keyboardTypes: readonly ["decimal-pad", "number-pad", "default"];
3
3
  export type KeyboardType = (typeof keyboardTypes)[number];
4
4
  /**
5
- * @summary A control that displays an editable text interface.
5
+ * @summary A control that displays an editable text area.
6
6
  *
7
7
  * @slot label
8
8
  * @slot validity-options
@@ -7,7 +7,7 @@ import { $, compareBigDecimals, devFlags, kebabCase, onoff, set } from '../inter
7
7
  import { html, queryMorph } from '../morphdom';
8
8
  const keyboardTypes = ['decimal-pad', 'number-pad', 'default'];
9
9
  /**
10
- * @summary A control that displays an editable text interface.
10
+ * @summary A control that displays an editable text area.
11
11
  *
12
12
  * @slot label
13
13
  * @slot validity-options
@@ -140,7 +140,7 @@ export class TextField extends FormAssociatedBase {
140
140
  this.#sendValueToForm();
141
141
  break;
142
142
  case 'label':
143
- queryMorph('[slot=label]', html `<label-view slot="label" foreground="secondary">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this); //renderLabel(':scope>label-view[slot=label]', `<label-view slot="label" foreground="secondary"><span></span></label-view>`, this, newValue)
143
+ queryMorph('[slot=label]', html `<label-view slot="label" foreground="secondary">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this);
144
144
  // this.#sendValueToForm()
145
145
  break;
146
146
  case 'disabled':
@@ -2,6 +2,8 @@ import { FormAssociatedBase } from '../internal/class/form-associated-base';
2
2
  declare const toggleStyles: readonly ["switch", "button"];
3
3
  export type ToggleStyle = (typeof toggleStyles)[number];
4
4
  /**
5
+ * @summary A control that switches between on and off states.
6
+ *
5
7
  * @slot label
6
8
  * @slot validity-options
7
9
  */
@@ -6,6 +6,8 @@ import { $, devFlags, kebabCase, onoff } from '../internal/utils';
6
6
  import { html, queryMorph } from '../morphdom';
7
7
  const toggleStyles = ['switch', 'button'];
8
8
  /**
9
+ * @summary A control that switches between on and off states.
10
+ *
9
11
  * @slot label
10
12
  * @slot validity-options
11
13
  */
@@ -85,7 +87,7 @@ export class ToggleView extends FormAssociatedBase {
85
87
  this.#sendValueToForm(this.#connected);
86
88
  break;
87
89
  case 'label':
88
- queryMorph('[slot=label]', html `<label-view slot="label">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this); //renderLabel(':scope>label-view[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, newValue)
90
+ queryMorph('[slot=label]', html `<label-view slot="label">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this);
89
91
  break;
90
92
  case 'disabled':
91
93
  for (const el of this.#shadowRoot.querySelectorAll('input'))
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @summary A view that arranges its subviews in a vertical line.
2
+ * @summary A view that arranges its children one on top of the other.
3
3
  *
4
4
  * @attr {leading|"leading fill"|center|trailing|fill|space-between} distribution — The distribution of cols
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { devFlags } from '../internal/utils';
2
2
  /**
3
- * @summary A view that arranges its subviews in a vertical line.
3
+ * @summary A view that arranges its children one on top of the other.
4
4
  *
5
5
  * @attr {leading|"leading fill"|center|trailing|fill|space-between} distribution — The distribution of cols
6
6
  *
@@ -1070,6 +1070,7 @@
1070
1070
  :where(navigation-stack:not([hidden]),
1071
1071
  navigation-split-view:not([hidden]),
1072
1072
  navigation-large-title:not([hidden]),
1073
+ navigation-title:not([hidden]),
1073
1074
  scroll-view:not([hidden]),
1074
1075
  body-view:not([hidden]),
1075
1076
  tab-view:not([hidden]),
@@ -1093,7 +1094,7 @@
1093
1094
  [is=glass-prominent-button]:not([hidden]),
1094
1095
  list-view:not([hidden]),
1095
1096
  table-view:not([hidden]),
1096
- content-unavailable-view:not([hidden]),
1097
+ content-unavailable:not([hidden]),
1097
1098
  progress-view:not([hidden]),
1098
1099
  tool-bar-item:not([hidden]),
1099
1100
  tool-bar-item-group:not([hidden]),
@@ -1119,9 +1120,9 @@
1119
1120
  :where(labeled-content)::part(labeled-content-label-stack),
1120
1121
  :where(labeled-content)::part(labeled-content-value-stack),
1121
1122
  :where(progress-view)::part(progress-control),
1122
- :where(content-unavailable-view)::part(content-unavailable-title-stack),
1123
- :where(content-unavailable-view)::part(content-unavailable-description-stack),
1124
- :where(content-unavailable-view)::part(content-unavailable-actions-stack),
1123
+ :where(content-unavailable)::part(content-unavailable-title-stack),
1124
+ :where(content-unavailable)::part(content-unavailable-description-stack),
1125
+ :where(content-unavailable)::part(content-unavailable-actions-stack),
1125
1126
  :where(table-view)::part(table-container),
1126
1127
  :where(table-view)::part(table-column-stack),
1127
1128
  :where(table-view)::part(table-header-stack),
@@ -1745,7 +1746,7 @@
1745
1746
  }
1746
1747
  }
1747
1748
  @layer sw-components {
1748
- :where(content-unavailable-view) {
1749
+ :where(content-unavailable) {
1749
1750
  place-content: center;
1750
1751
  place-items: center;
1751
1752
  text-align: center;
@@ -1753,24 +1754,24 @@
1753
1754
  padding-inline: 1rem;
1754
1755
  padding-block: 1rem;
1755
1756
  }
1756
- :where(content-unavailable-view)::part(content-unavailable-actions-stack), :where(content-unavailable-view)::part(content-unavailable-title-stack), :where(content-unavailable-view)::part(content-unavailable-description-stack) {
1757
+ :where(content-unavailable)::part(content-unavailable-actions-stack), :where(content-unavailable)::part(content-unavailable-title-stack), :where(content-unavailable)::part(content-unavailable-description-stack) {
1757
1758
  max-inline-size: 20rem;
1758
1759
  }
1759
- :where(content-unavailable-view)::part(content-unavailable-actions-stack) {
1760
+ :where(content-unavailable)::part(content-unavailable-actions-stack) {
1760
1761
  row-gap: 0.2rem;
1761
1762
  }
1762
- :where(content-unavailable-view)::part(content-unavailable-title-stack) {
1763
+ :where(content-unavailable)::part(content-unavailable-title-stack) {
1763
1764
  --label-flow: vertical;
1764
1765
  --label-font: title3;
1765
1766
  }
1766
- :where(content-unavailable-view > :not([slot])) {
1767
+ :where(content-unavailable > :not([slot])) {
1767
1768
  --label-image-size: 5;
1768
1769
  --label-gap: 1;
1769
1770
  }
1770
- :where(content-unavailable-view:not(:has(> [slot=description])))::part(content-unavailable-description-stack) {
1771
+ :where(content-unavailable:not(:has(> [slot=description])))::part(content-unavailable-description-stack) {
1771
1772
  display: none;
1772
1773
  }
1773
- :where(content-unavailable-view:not(:has(> [slot=actions])))::part(content-unavailable-actions-stack) {
1774
+ :where(content-unavailable:not(:has(> [slot=actions])))::part(content-unavailable-actions-stack) {
1774
1775
  display: none;
1775
1776
  }
1776
1777
  }
@@ -3395,7 +3396,7 @@
3395
3396
  --toggle--trigger-bg: lightgray;
3396
3397
  }
3397
3398
  :where(toggle-view)::part(toggle-stack) {
3398
- grid-template-columns: auto minmax(0, 1fr);
3399
+ grid-template-columns: minmax(0, 1fr) auto;
3399
3400
  grid-template-rows: minmax(0, 1fr);
3400
3401
  column-gap: var(--labeled-content-column-gap);
3401
3402
  }
@@ -3490,6 +3491,16 @@
3490
3491
  labeled-content > [slot=header],
3491
3492
  labeled-content > [slot=footer]) {
3492
3493
  color: var(--secondary);
3494
+ --label-font: callout;
3495
+ }
3496
+ @supports not (x: if(else:red)) {
3497
+ :where(labeled-content > :nth-child(n+2 of [slot=label]),
3498
+ labeled-content > [slot=header],
3499
+ labeled-content > [slot=footer]) {
3500
+ --label--titlestack-font-size: var(--label-callout-font-size);
3501
+ --label--titlestack-line-height: var(--label-callout-line-height);
3502
+ --label--titlestack-font-weight: var(--label-callout-font-weight);
3503
+ }
3493
3504
  }
3494
3505
  }
3495
3506
  @layer sw-components {}
@@ -3512,11 +3523,7 @@
3512
3523
  padding-block: 1rem;
3513
3524
  }
3514
3525
  }
3515
- @layer sw-components {
3516
- :where(navigation-title) {
3517
- display: grid;
3518
- }
3519
- }
3526
+ @layer sw-components {}
3520
3527
  @layer sw-components {
3521
3528
  :where(tab-view:not([tab-view-style=tab-bar-only]) > sidebar-toggle, navigation-split-view > sidebar-toggle) {
3522
3529
  position: fixed;
@@ -1,5 +1 @@
1
1
  export {};
2
- // export interface ScrollViewEventMap {
3
- // pagereveal: CustomEvent<PageRevealSwapDetail>
4
- // pageswap: CustomEvent<PageRevealSwapDetail>
5
- // }
@@ -1,4 +1 @@
1
1
  export {};
2
- // export interface TextFieldEventMap {
3
- // commit: CustomEvent<TextFieldCommitDetail>
4
- // }
@@ -1,4 +1 @@
1
1
  export {};
2
- // export interface ToggleViewEventMap {
3
- // 'toggle:change': CustomEvent<ToggleChangeDetail>
4
- // }
@@ -1,63 +1,10 @@
1
1
  import { I18n } from '../../i18n';
2
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
3
  export default function (target, role, titleKey, config) {
55
4
  if (!target)
56
5
  return;
57
6
  const overiderTitle = typeof titleKey === 'string' && titleKey in I18n.t('ButtonRole') ? titleKey : undefined;
58
- // renderPlaceholder(target, role, overiderTitle, config)
59
7
  let title, systemImage;
60
- // const label = el.querySelector(':scope>[slot=placeholder]') ?? el.appendChild($(`<label-view slot="placeholder"></label-view>`, '>1'))
61
8
  switch (role) {
62
9
  case 'cancel':
63
10
  title = overiderTitle && overiderTitle in I18n.t('ButtonRole') ? I18n.t('ButtonRole')[overiderTitle] : I18n.t('ButtonRole').Cancel;
@@ -90,6 +37,4 @@ export default function (target, role, titleKey, config) {
90
37
  break;
91
38
  }
92
39
  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 });
93
- // CleanupRegistry.unregister(target, 'i18n')
94
- // CleanupRegistry.register(target, onoff('localechange', () => renderPlaceholder(target, role, overiderTitle), I18n.on).on(), 'i18n')
95
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftwc/ui",
3
- "version": "0.0.0-dev.92",
3
+ "version": "0.0.0-dev.93",
4
4
  "description": "Elegant SwiftUI-inspired web components for standalone web apps and web extensions.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,7 +21,7 @@
21
21
 
22
22
  @forward 'components/sheet-view';
23
23
 
24
- @forward 'components/content-unavailable-view';
24
+ @forward 'components/content-unavailable';
25
25
 
26
26
  @forward 'components/confirmation-dialog';
27
27
  @forward 'components/alert-dialog';
@@ -3,7 +3,7 @@
3
3
  @use '../placeholders';
4
4
 
5
5
  @layer #{vars.$components-layer} {
6
- content-unavailable-view {
6
+ content-unavailable {
7
7
  :where(&) {
8
8
  place-content: center;
9
9
  place-items: center;
@@ -7,6 +7,7 @@
7
7
  navigation-stack,
8
8
  navigation-split-view,
9
9
  navigation-large-title,
10
+ navigation-title,
10
11
  scroll-view,
11
12
  body-view,
12
13
  tab-view,
@@ -30,7 +31,7 @@
30
31
  [is='glass-prominent-button'],
31
32
  list-view,
32
33
  table-view,
33
- content-unavailable-view,
34
+ content-unavailable,
34
35
  progress-view,
35
36
  tool-bar-item,
36
37
  tool-bar-item-group,
@@ -59,9 +60,9 @@
59
60
  :where(labeled-content)::part(labeled-content-label-stack),
60
61
  :where(labeled-content)::part(labeled-content-value-stack),
61
62
  :where(progress-view)::part(progress-control),
62
- :where(content-unavailable-view)::part(content-unavailable-title-stack),
63
- :where(content-unavailable-view)::part(content-unavailable-description-stack),
64
- :where(content-unavailable-view)::part(content-unavailable-actions-stack),
63
+ :where(content-unavailable)::part(content-unavailable-title-stack),
64
+ :where(content-unavailable)::part(content-unavailable-description-stack),
65
+ :where(content-unavailable)::part(content-unavailable-actions-stack),
65
66
  :where(table-view)::part(table-container),
66
67
  :where(table-view)::part(table-column-stack),
67
68
  :where(table-view)::part(table-header-stack),
@@ -1,4 +1,6 @@
1
+ @use 'sass:string';
1
2
  @use '../vars';
3
+ @use '../mixins';
2
4
 
3
5
  @layer #{vars.$components-layer} {
4
6
  labeled-content {
@@ -61,6 +63,12 @@
61
63
  > [slot='footer'] {
62
64
  :where(&) {
63
65
  color: var(--secondary);
66
+
67
+ --label-font: callout;
68
+
69
+ @supports not (x: #{string.unquote('if(else:red)')}) {
70
+ @include mixins.set-label-font(callout);
71
+ }
64
72
  }
65
73
  }
66
74
  }
@@ -4,7 +4,7 @@
4
4
  @layer #{vars.$components-layer} {
5
5
  navigation-title {
6
6
  :where(&) {
7
- display: grid; //contents;
7
+ // display: grid; //contents;
8
8
  }
9
9
  }
10
10
  }
@@ -12,7 +12,7 @@
12
12
  --toggle--trigger-bg: lightgray;
13
13
 
14
14
  &::part(toggle-stack) {
15
- grid-template-columns: auto minmax(0, 1fr);
15
+ grid-template-columns: minmax(0, 1fr) auto;
16
16
 
17
17
  grid-template-rows: minmax(0, 1fr);
18
18