@swiftwc/ui 0.0.0-dev.91 → 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 (73) 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} +9 -8
  13. package/generated/components/date-picker.d.ts +9 -1
  14. package/generated/components/date-picker.js +11 -4
  15. package/generated/components/form-view.d.ts +1 -1
  16. package/generated/components/form-view.js +1 -1
  17. package/generated/components/glass-button.d.ts +2 -2
  18. package/generated/components/glass-button.js +2 -2
  19. package/generated/components/glass-prominent-button.d.ts +2 -2
  20. package/generated/components/glass-prominent-button.js +2 -2
  21. package/generated/components/h-stack.d.ts +6 -6
  22. package/generated/components/h-stack.js +6 -6
  23. package/generated/components/index.d.ts +1 -1
  24. package/generated/components/index.js +1 -1
  25. package/generated/components/label-view.d.ts +6 -2
  26. package/generated/components/label-view.js +8 -4
  27. package/generated/components/labeled-content.js +3 -3
  28. package/generated/components/list-view.d.ts +1 -1
  29. package/generated/components/list-view.js +1 -13
  30. package/generated/components/menu-view.d.ts +2 -1
  31. package/generated/components/menu-view.js +3 -8
  32. package/generated/components/navigation-stack.js +0 -2
  33. package/generated/components/navigation-title.js +0 -9
  34. package/generated/components/picker-view.d.ts +8 -2
  35. package/generated/components/picker-view.js +14 -9
  36. package/generated/components/progress-view.d.ts +1 -0
  37. package/generated/components/progress-view.js +2 -1
  38. package/generated/components/scroll-view.d.ts +1 -0
  39. package/generated/components/scroll-view.js +11 -2
  40. package/generated/components/search-view.js +0 -3
  41. package/generated/components/section-view.d.ts +2 -1
  42. package/generated/components/section-view.js +4 -48
  43. package/generated/components/sheet-view.js +0 -20
  44. package/generated/components/sidebar-view.js +1 -1
  45. package/generated/components/tab-bar.js +0 -3
  46. package/generated/components/tab-view.d.ts +5 -2
  47. package/generated/components/tab-view.js +5 -72
  48. package/generated/components/table-view.d.ts +2 -1
  49. package/generated/components/table-view.js +4 -3
  50. package/generated/components/text-field.d.ts +6 -0
  51. package/generated/components/text-field.js +7 -2
  52. package/generated/components/toggle-view.d.ts +6 -0
  53. package/generated/components/toggle-view.js +7 -2
  54. package/generated/components/tool-bar.d.ts +10 -10
  55. package/generated/components/tool-bar.js +10 -10
  56. package/generated/components/v-keyboard.d.ts +1 -1
  57. package/generated/components/v-keyboard.js +1 -1
  58. package/generated/components/v-stack.d.ts +7 -7
  59. package/generated/components/v-stack.js +7 -7
  60. package/generated/css/index.css +24 -17
  61. package/generated/events/scroll-view.js +0 -4
  62. package/generated/events/text-field.js +0 -3
  63. package/generated/events/toggle-view.js +0 -3
  64. package/generated/internal/utils/ensure-placeholder.js +0 -55
  65. package/package.json +3 -2
  66. package/scss/_components.scss +1 -1
  67. package/scss/components/{_content-unavailable-view.scss → _content-unavailable.scss} +1 -1
  68. package/scss/components/_index.scss +5 -4
  69. package/scss/components/_labeled-content.scss +8 -0
  70. package/scss/components/_navigation-title.scss +1 -1
  71. package/scss/components/_toggle-view.scss +1 -1
  72. package/web-components.html-data/en.json +340 -91
  73. package/generated/components/content-unavailable-view.d.ts +0 -24
@@ -10,15 +10,17 @@ export type DictEntry = {
10
10
  };
11
11
  export type Dictionary = DictEntry[];
12
12
  /**
13
+ * @summary A control that selects one value from a set of options.
13
14
  *
14
15
  * @attr {menu|inline|navigation-link|sheet|automatic} picker-style
15
16
  *
16
- * @attr {string} help - Adds a help tooltip to the trigger of the picker, if style supports one
17
+ * @attr {string} help — Adds a help tooltip to the trigger of the picker, if style supports one
17
18
  *
18
- * @attr {DictEntry[]} dictionary - Renders all options using this array
19
+ * @attr {DictEntry[]} dictionary — Renders all options using this array
19
20
  *
20
21
  * @attr {vertical|horizontal|auto} label-value-placement
21
22
  *
23
+ * @slot — The default slot.
22
24
  * @slot label
23
25
  * @slot list
24
26
  * @slot validity-options
@@ -47,6 +49,10 @@ export declare class PickerView extends FormAssociatedBase {
47
49
  disconnectedCallback(): void;
48
50
  connectedCallback(): void;
49
51
  get pickerStyle(): PickerStyle;
52
+ /**
53
+ * Form participation property
54
+ * @type {string}
55
+ */
50
56
  get name(): string;
51
57
  setValidity: (flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement) => void;
52
58
  setCustomValidity: (message: string) => void;
@@ -116,15 +116,17 @@ const indexGroups = (nodes, parentPath = '') => {
116
116
  };
117
117
  const collectLeafValues = (node) => (node.children.length ? node.children.flatMap(collectLeafValues) : [node.value]);
118
118
  /**
119
+ * @summary A control that selects one value from a set of options.
119
120
  *
120
121
  * @attr {menu|inline|navigation-link|sheet|automatic} picker-style
121
122
  *
122
- * @attr {string} help - Adds a help tooltip to the trigger of the picker, if style supports one
123
+ * @attr {string} help — Adds a help tooltip to the trigger of the picker, if style supports one
123
124
  *
124
- * @attr {DictEntry[]} dictionary - Renders all options using this array
125
+ * @attr {DictEntry[]} dictionary — Renders all options using this array
125
126
  *
126
127
  * @attr {vertical|horizontal|auto} label-value-placement
127
128
  *
129
+ * @slot — The default slot.
128
130
  * @slot label
129
131
  * @slot list
130
132
  * @slot validity-options
@@ -436,7 +438,7 @@ export class PickerView extends FormAssociatedBase {
436
438
  const value = this.getAttribute(this.constructor.ATTR.LABEL);
437
439
  if (value) {
438
440
  const hStack = $(`<h-stack distribution="leading" template="auto spacer"><label-view data-role="check" style="visibility: hidden"><image-view slot="icon" system-name="check"></image-view></label-view><label-view><span></span></label-view></h-stack>`, '>1');
439
- queryMorph('label-view:nth-child(2)', htmx `<label-view>${value ? htmx `<span>${value}</span>` : null}</label-view>`, hStack); //renderLabel(':scope>label-view:nth-child(2)', `<label-view><span></span></label-view>`, hStack, value)
441
+ queryMorph('label-view:nth-child(2)', htmx `<label-view>${value ? htmx `<span>${value}</span>` : null}</label-view>`, hStack);
440
442
  // if (label) renderLabelTitle(label, value) //label.setAttribute('title', value)
441
443
  section.insertAdjacentElement('beforeend', hStack);
442
444
  }
@@ -983,7 +985,7 @@ export class PickerView extends FormAssociatedBase {
983
985
  #reflectLabel(value) {
984
986
  if (devFlags.debug)
985
987
  console.debug(`${_a.name} #reflectLabel`);
986
- queryMorph('[slot=label]', htmx `<label-view slot="label">${value ? htmx `<span>${value}</span>` : null}</label-view>`, this); //renderLabel(':scope>label-view[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, value)
988
+ queryMorph('[slot=label]', htmx `<label-view slot="label">${value ? htmx `<span>${value}</span>` : null}</label-view>`, this);
987
989
  this.#renderSlotted([]);
988
990
  }
989
991
  #reflectSelectionOnButtons() {
@@ -1031,8 +1033,8 @@ export class PickerView extends FormAssociatedBase {
1031
1033
  // if (!cvl) currentValueLabel.setAttribute('foreground', 'secondary')
1032
1034
  // else currentValueLabel.removeAttribute('foreground')
1033
1035
  const title = this.#currentValueLabel || this.#selection || this.getAttribute(this.constructor.ATTR.PLACEHOLDER), systemImage = this.#currentValueIcon || this.getAttribute(this.constructor.ATTR.PLACEHOLDER_ICON);
1034
- queryMorph(':not([slot])', htmx `<span>${title}</span>`, currentValueLabel, { removeIf: !title }); //renderLabelTitle(currentValueLabel, this.#currentValueLabel || this.#selection || this.getAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER))
1035
- queryMorph('[slot=icon]', htmx `<image-view slot="icon" system-name="${systemImage}"></image-view>`, currentValueLabel, { removeIf: !systemImage }); //renderLabelIcon(currentValueLabel, this.#currentValueIcon || this.getAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER_ICON))
1036
+ queryMorph(':not([slot])', htmx `<span>${title}</span>`, currentValueLabel, { removeIf: !title });
1037
+ queryMorph('[slot=icon]', htmx `<image-view slot="icon" system-name="${systemImage}"></image-view>`, currentValueLabel, { removeIf: !systemImage });
1036
1038
  // morph(
1037
1039
  // htmx`<label-view>${systemImage ? htmx`<image-view slot="icon" system-name="${systemImage}"></image-view>` : null}${title ? htmx`<span>${title}</span>` : null}</label-view>`,
1038
1040
  // currentValueLabel
@@ -1046,8 +1048,8 @@ export class PickerView extends FormAssociatedBase {
1046
1048
  // if (!cvl) currentValueLabel.setAttribute('foreground', 'secondary')
1047
1049
  // else currentValueLabel.removeAttribute('foreground')
1048
1050
  const title = this.#currentValueLabel || this.#selection || this.getAttribute(this.constructor.ATTR.PLACEHOLDER), systemImage = this.#currentValueIcon || this.getAttribute(this.constructor.ATTR.PLACEHOLDER_ICON);
1049
- queryMorph(':not([slot])', htmx `<span>${title}</span>`, currentValueLabel, { removeIf: !title }); //renderLabelTitle(currentValueLabel, this.#currentValueLabel || this.#selection || this.getAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER))
1050
- queryMorph('[slot=icon]', htmx `<image-view slot="icon" system-name="${systemImage}"></image-view>`, currentValueLabel, { removeIf: !systemImage }); //renderLabelIcon(currentValueLabel, this.#currentValueIcon || this.getAttribute((this.constructor as typeof PickerView).ATTR.PLACEHOLDER_ICON))
1051
+ queryMorph(':not([slot])', htmx `<span>${title}</span>`, currentValueLabel, { removeIf: !title });
1052
+ queryMorph('[slot=icon]', htmx `<image-view slot="icon" system-name="${systemImage}"></image-view>`, currentValueLabel, { removeIf: !systemImage });
1051
1053
  // morph(
1052
1054
  // htmx`<label-view slot="label">${systemImage ? htmx`<image-view slot="icon" system-name="${systemImage}"></image-view>` : null}${title ? htmx`<span>${title}</span>` : null}</label-view>`,
1053
1055
  // currentValueLabel
@@ -1084,7 +1086,10 @@ export class PickerView extends FormAssociatedBase {
1084
1086
  else
1085
1087
  trigger?.removeAttribute(this.constructor.ATTR.TRIGGER_HELP);
1086
1088
  }
1087
- // Optional: form participation properties
1089
+ /**
1090
+ * Form participation property
1091
+ * @type {string}
1092
+ */
1088
1093
  get name() {
1089
1094
  return this.getAttribute('name') ?? this.getAttribute('label') ?? this.querySelector(':scope>[slot=label]')?.textContent ?? '';
1090
1095
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @summary A view that shows the progress toward completion of a task.
3
3
  *
4
+ * @slot — The default slot.
4
5
  * @slot current-value
5
6
  */
6
7
  export declare class ProgressView extends HTMLElement {
@@ -8,6 +8,7 @@ const progressViewStyles = ['circular', 'linear'];
8
8
  /**
9
9
  * @summary A view that shows the progress toward completion of a task.
10
10
  *
11
+ * @slot — The default slot.
11
12
  * @slot current-value
12
13
  */
13
14
  export class ProgressView extends HTMLElement {
@@ -71,7 +72,7 @@ export class ProgressView extends HTMLElement {
71
72
  break;
72
73
  }
73
74
  case 'current-value-label': {
74
- queryMorph('[slot=current-value]', html `<label-view slot="current-value" font="callout" foreground="secondary">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this); //renderLabel(':scope>[slot=current-value]', `<label-view slot="current-value" font="callout" foreground="secondary"><span></span></label-view>`, this, newValue)
75
+ queryMorph('[slot=current-value]', html `<label-view slot="current-value" font="callout" foreground="secondary">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this);
75
76
  break;
76
77
  }
77
78
  }
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @slot — The default slot.
2
3
  * @slot top-bar-principal
3
4
  * @slot bottom-bar-principal
4
5
  */
@@ -6,12 +6,22 @@ import { $, devFlags, frame, onoff, slowHideShow } from '../internal/utils';
6
6
  import { html, queryMorph } from '../morphdom';
7
7
  const observers = new ResizeObserverSingleton();
8
8
  /**
9
+ * @slot — The default slot.
9
10
  * @slot top-bar-principal
10
11
  * @slot bottom-bar-principal
11
12
  */
12
13
  export class ScrollView extends HTMLElement {
13
14
  static get observedAttributes() {
14
- return ['navigation-title', 'navigation-inline-title', 'navigation-inline-subtitle', 'navigation-icon', 'navigation-bar-title-display-mode'];
15
+ return [
16
+ /**
17
+ * Configures the view’s title for purposes of navigation. Shorthand for `<v-stack spacing="0" alignment="fill" slot="top-bar-principal"><label-view line-limit="1" truncation-mode="tail" font="headline"><span>Navigation Title</span></label-view></v-stack>`
18
+ */
19
+ 'navigation-title',
20
+ 'navigation-inline-title',
21
+ 'navigation-inline-subtitle',
22
+ 'navigation-icon',
23
+ 'navigation-bar-title-display-mode',
24
+ ];
15
25
  }
16
26
  static #template;
17
27
  static get template() {
@@ -30,7 +40,6 @@ export class ScrollView extends HTMLElement {
30
40
  }
31
41
  #shadowRoot;
32
42
  #slots = new Map();
33
- // #navbarPrincipalSlot?: HTMLSlotElement
34
43
  #isMidScroll;
35
44
  #lastScrollTop = 0;
36
45
  // #stopRecordingScrollTop?: boolean = false
@@ -2,9 +2,6 @@ import { CleanupRegistry } from '../internal/class/cleanup-registry';
2
2
  import { devFlags, onoff, touchGlass } from '../internal/utils';
3
3
  import { InputBase } from '../namespace-browser/base';
4
4
  export class SearchView extends InputBase {
5
- // static get observedAttributes() {
6
- // return ['role', 'title-key']
7
- // }
8
5
  constructor() {
9
6
  super();
10
7
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
- * @summary A container view that you can use to add hierarchy within certain views.
2
+ * @summary A container view that groups related content together.
3
3
  *
4
+ * @slot — The default slot.
4
5
  * @slot header
5
6
  * @slot footer
6
7
  */
@@ -1,8 +1,9 @@
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
+ * @slot — The default slot.
6
7
  * @slot header
7
8
  * @slot footer
8
9
  */
@@ -25,84 +26,39 @@ export class SectionView extends HTMLElement {
25
26
  // <div class="sticky-sentinel" style="grid-area:sentinel;inline-size:100%;block-size:0.1px;pointer-events:none;"></div>
26
27
  }
27
28
  #shadowRoot;
28
- // #observer?: IntersectionObserver
29
- // #sibling?: HTMLElement
30
- // #sentinel?: HTMLElement
31
- // #sentinelIsIntersecting: boolean = false
32
- // #isIntersecting: boolean = false
33
29
  constructor() {
34
30
  super();
35
31
  this.#shadowRoot = this.attachShadow({ mode: 'closed' });
36
- // Snapshot.waitReady.then(() => {
37
32
  this.#shadowRoot.appendChild(document.importNode(this.constructor.template, true));
38
- // this.#sentinel = this.#shadowRoot.querySelector('.sticky-sentinel') ?? undefined
39
- // })
40
33
  }
41
34
  attributeChangedCallback(name, oldValue, newValue) {
42
35
  if (devFlags.debug)
43
36
  console.debug(`${SectionView.name} ⚡️ attr-change [${name}] ("${oldValue}" → "${newValue}")`);
44
- // Snapshot.waitReady.then(() => {
45
37
  switch (name) {
46
38
  case 'header':
47
- // if (!newValue) {
48
- // this.querySelector(':scope>[slot=header]')?.remove()
49
- // break
50
- // }
51
- // const header = this.querySelector(':scope>[slot=header]') ?? this.appendChild(Object.assign(document.createElement('header'), { slot: 'header' }))
52
39
  queryMorph('[slot=header]', html `<header slot="header">
53
40
  <label-view line-limit="1" truncation-mode="tail" font="callout">
54
41
  <span>${newValue}</span>
55
42
  </label-view>
56
43
  </header>`, this, { removeIf: !newValue });
57
- // render(
58
- // html`<label-view line-limit="1" truncation-mode="tail" font="callout">
59
- // <span>${newValue}</span>
60
- // </label-view>`,
61
- // header
62
- // )
63
44
  break;
64
45
  case 'footer':
65
- // if (!newValue) {
66
- // this.querySelector(':scope>[slot=footer]')?.remove()
67
- // break
68
- // }
69
- // const footer = this.querySelector(':scope>[slot=footer]') ?? this.appendChild(Object.assign(document.createElement('footer'), { slot: 'footer' }))
70
46
  queryMorph('[slot=footer]', html `<footer slot="footer">
71
47
  <label-view line-limit="1" truncation-mode="tail" font="callout">
72
48
  <span>${newValue}</span>
73
49
  </label-view>
74
50
  </footer>`, this, { removeIf: !newValue });
75
- // render(
76
- // html`<label-view line-limit="1" truncation-mode="tail" font="callout">
77
- // <span>${newValue}</span>
78
- // </label-view>`,
79
- // footer
80
- // )
81
51
  break;
82
52
  }
83
- // })
84
53
  }
85
54
  disconnectedCallback() {
86
55
  if (devFlags.debug)
87
56
  console.debug(`${SectionView.name} ⚡️ disconnect`);
88
- // if (this.#sentinel) this.#observer?.unobserve(this.#sentinel)
89
- // this.#observer?.unobserve(this)
57
+ //
90
58
  }
91
59
  connectedCallback() {
92
60
  if (devFlags.debug)
93
61
  console.debug(`${SectionView.name} ⚡️ connect`);
94
- // this.#sibling = this.closest('scroll-view') ?? undefined
95
- // Snapshot.waitReady.then(() => {
96
- // if (!(await frame(this))) return // NOTE: Required or BREAKS transitions // self.requestAnimationFrame(() => {
97
- // const blockSizeProp = getComputedStyle(this).getPropertyValue('--navigation-bar-block-size') || '0', //`${document.documentElement.computedStyleMap().get(`--navigation-bar-block-size`) ?? '0'}`, //
98
- // blockSize = parseFloat(blockSizeProp) * (blockSizeProp.endsWith('rem') ? parseFloat(getComputedStyle(document.documentElement).fontSize) : 1)
99
- // this.#observer = new IntersectionObserver(this.#handleIntersect, {
100
- // root: this.#sibling,
101
- // rootMargin: `-${blockSize}px 0px 0px 0px`,
102
- // threshold: [0, 1],
103
- // })
104
- // if (this.#sentinel) this.#observer.observe(this.#sentinel)
105
- // this.#observer.observe(this)
106
- // })
62
+ //
107
63
  }
108
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)
@@ -3,8 +3,11 @@ import { type NavigationStack } from './navigation-stack';
3
3
  declare const TAB_BAR_PLACEMENTS: readonly ["bottom-bar", "ornament", "sidebar", "top-bar"];
4
4
  export type TabBarPlacement = (typeof TAB_BAR_PLACEMENTS)[number];
5
5
  /**
6
- * @fires tabshow A Tab is shown
7
- * @fires tabhide A Tab is hidden
6
+ *
7
+ * @cssprop --adaptable-tab-bar-placement
8
+ *
9
+ * @fires tabshow — A Tab is shown
10
+ * @fires tabhide — A Tab is hidden
8
11
  * @fires tab-view:toggle
9
12
  * @fires tab-view:adaptable-tab-bar-placement-change
10
13
  */
@@ -6,8 +6,11 @@ import { $, cssTime, debounce, devFlags, frame, onoff, timeout } from '../intern
6
6
  import { Snapshot } from '../snapshot';
7
7
  const TAB_BAR_PLACEMENTS = ['bottom-bar', 'ornament', 'sidebar', 'top-bar'];
8
8
  /**
9
- * @fires tabshow A Tab is shown
10
- * @fires tabhide A Tab is hidden
9
+ *
10
+ * @cssprop --adaptable-tab-bar-placement
11
+ *
12
+ * @fires tabshow — A Tab is shown
13
+ * @fires tabhide — A Tab is hidden
11
14
  * @fires tab-view:toggle
12
15
  * @fires tab-view:adaptable-tab-bar-placement-change
13
16
  */
@@ -45,23 +48,6 @@ export class TabView extends HTMLElement {
45
48
  });
46
49
  this.#cssStyleObserver.observe(this, this.#handleStyleChange);
47
50
  Snapshot.waitReady.then(() => self.requestAnimationFrame(this.#handleStyleChange)); // Snapshot.waitReady.then(this.#handleStyleChange)
48
- // NOTE: wait for config
49
- // Snapshot.waitReady.then(() => { // FIXME: Check this removed!
50
- // for (const [or, w, handler] of [
51
- // ['portrait', `max-width:${Snapshot.config!['ipad-portrait-bp-max']}`, this.#handleMediaChange],
52
- // ['landscape', `max-width:${Snapshot.config!['ipad-landscape-bp-max']}`, this.#handleMediaChange],
53
- // ['portrait', `min-width:${Snapshot.config!['ipad-portrait-bp-min']}`, this.#handleMediaChange],
54
- // ['landscape', `min-width:${Snapshot.config!['ipad-landscape-bp-min']}`, this.#handleMediaChange],
55
- // ]) {
56
- // const mediaQueryList = self.matchMedia(`(orientation:${or}) and (${w})`)
57
- // if (mediaQueryList.matches)
58
- // this.#handleMediaChange(
59
- // new MediaQueryListEvent('media-change', {
60
- // matches: mediaQueryList.matches,
61
- // })
62
- // ) // Initial check
63
- // CleanupRegistry.register(this, onoff('change', handler as EventListener, mediaQueryList).on())
64
- // }
65
51
  CleanupRegistry.register(this, onoff([
66
52
  { types: 'tabreveal tabswap', listener: this.#debouncedHandler },
67
53
  { types: 'beforetabreveal beforetabswap', listener: this.#addAnimations },
@@ -72,7 +58,6 @@ export class TabView extends HTMLElement {
72
58
  listener: this.#handleSummaryClick,
73
59
  },
74
60
  ], this).on());
75
- // })
76
61
  }
77
62
  #handleSummaryClick = ({ target }) => {
78
63
  if (!(target instanceof HTMLElement))
@@ -113,57 +98,6 @@ export class TabView extends HTMLElement {
113
98
  }));
114
99
  }
115
100
  };
116
- // #handleMediaChange: (evt: MediaQueryListEvent) => void = (evt) => {
117
- // if (devFlags.debug) console.debug(`${TabView.name} ⚡️ ${evt?.type}`)
118
- // if (!evt.matches) return
119
- // this.#handleStyleChange()
120
- // // if (evt.matches) {
121
- // // const placement = self.getComputedStyle(this).getPropertyValue('--adaptable-tab-bar-placement'), // or do it manually without any computedstyle
122
- // // newValue = (TAB_BAR_PLACEMENTS as readonly string[]).includes(placement) ? (placement as (typeof TAB_BAR_PLACEMENTS)[number]) : 'bottom-bar'
123
- // // if (newValue !== this.#cachedAdaptableTabBarPlacement) {
124
- // // const oldValue = this.#cachedAdaptableTabBarPlacement
125
- // // this.#cachedAdaptableTabBarPlacement = newValue
126
- // // this.dispatchEvent(
127
- // // new CustomEvent<TabViewAdaptableTabBarPlacementDetail>('tab-view:adaptable-tab-bar-placement-change', {
128
- // // detail: { oldValue, newValue },
129
- // // bubbles: true,
130
- // // composed: true,
131
- // // })
132
- // // )
133
- // // }
134
- // // }
135
- // // // trigger more-stack (dis)allowed event
136
- // // if (evt.matches !== this.#moreStackAllowed) {
137
- // // this.#moreStackAllowed = evt.matches
138
- // // const eventType = evt.matches ? 'tab-view:more-tab-allowed' : 'tab-view:more-tab-disallowed'
139
- // // this.dispatchEvent(new CustomEvent<TabMoreStackAllowanceDetail>(eventType, { detail: { moreTab: this.moreTab }, bubbles: true, composed: true }))
140
- // // }
141
- // // if (evt.matches) return // no button triggers should happen, already on iphone portrait
142
- // // const innerSelection = this.moreTab?.querySelector(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')?.id
143
- // // if (innerSelection) {
144
- // // const btn = this.querySelector<HTMLButtonElement>(`[is="tab-item"][value="${CSS.escape(innerSelection)}"]`)
145
- // // // NOTE: simulate btn click BU WITHOUT tabroot functionality!
146
- // // if (btn) {
147
- // // const newTab = this.querySelector<NavigationStack | NavigationSplitView>(`#${btn.getAttribute('value')}`)
148
- // // if (newTab) {
149
- // // this.selectedTab = TabView.gatherTab(newTab)
150
- // // return
151
- // // }
152
- // // }
153
- // // }
154
- // // const outerSelection = this?.querySelector(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')?.id
155
- // // if (outerSelection && outerSelection === this.moreTab?.id) {
156
- // // const btn = this.querySelector<HTMLButtonElement>(`[is="tab-item"]:not([value="${CSS.escape(outerSelection)}"])`)
157
- // // // NOTE: simulate btn click BU WITHOUT tabroot functionality!
158
- // // if (btn) {
159
- // // const newTab = this.querySelector<NavigationStack | NavigationSplitView>(`#${btn.getAttribute('value')}`)
160
- // // if (newTab) {
161
- // // this.selectedTab = TabView.gatherTab(newTab)
162
- // // return
163
- // // }
164
- // // }
165
- // // }
166
- // }
167
101
  #handleAdaptableTabBarPlacementChange = (evt) => {
168
102
  if (devFlags.debug)
169
103
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
@@ -195,7 +129,6 @@ export class TabView extends HTMLElement {
195
129
  }
196
130
  };
197
131
  get selectedTab() {
198
- // return this.querySelector<NavigationStack | NavigationSplitView>(':scope>navigation-stack:not([hidden]),:scope>navigation-split-view:not([hidden])')
199
132
  return [...this.querySelectorAll('navigation-stack:not([hidden]),navigation-split-view:not([hidden])')];
200
133
  }
201
134
  set selectedTab(tabs) {
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @summary Display selectable, sortable data arranged in rows and columns.
3
3
  *
4
- * @attr {title:trailing:subtitle|trailing:title:subtitle|title:subtitle:trailing|*} preferred-compact-template - Sets the template areas when the table is in compact mode
4
+ * @attr {title:trailing:subtitle|trailing:title:subtitle|title:subtitle:trailing|*} preferred-compact-template — Sets the template areas when the table is in compact mode
5
5
  *
6
+ * @slot — The default slot.
6
7
  * @slot header-leading
7
8
  * @slot header-principal
8
9
  * @slot header-trailing
@@ -8,8 +8,9 @@ import { Snapshot } from '../snapshot';
8
8
  /**
9
9
  * @summary Display selectable, sortable data arranged in rows and columns.
10
10
  *
11
- * @attr {title:trailing:subtitle|trailing:title:subtitle|title:subtitle:trailing|*} preferred-compact-template - Sets the template areas when the table is in compact mode
11
+ * @attr {title:trailing:subtitle|trailing:title:subtitle|title:subtitle:trailing|*} preferred-compact-template — Sets the template areas when the table is in compact mode
12
12
  *
13
+ * @slot — The default slot.
13
14
  * @slot header-leading
14
15
  * @slot header-principal
15
16
  * @slot header-trailing
@@ -115,8 +116,8 @@ export class TableView extends HTMLElement {
115
116
  <label-view font="callout" foreground="secondary"></label-view>
116
117
  </v-stack>
117
118
  </button>`, '>1'), title = btn.querySelector('label-view:first-child') ?? undefined, subTitle = btn.querySelector('label-view:last-child') ?? undefined;
118
- 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())
119
- 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 ?? '') });
120
121
  this.#compactToolbarItem.appendChild(btn);
121
122
  }
122
123
  };
@@ -2,6 +2,8 @@ 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 area.
6
+ *
5
7
  * @slot label
6
8
  * @slot validity-options
7
9
  */
@@ -16,6 +18,10 @@ export declare class TextField extends FormAssociatedBase {
16
18
  get keyboardType(): KeyboardType;
17
19
  get text(): string;
18
20
  set text(v: string);
21
+ /**
22
+ * Form participation property
23
+ * @type {string}
24
+ */
19
25
  get name(): string;
20
26
  get value(): string;
21
27
  get valueAsNumber(): number | "";
@@ -7,6 +7,8 @@ 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 area.
11
+ *
10
12
  * @slot label
11
13
  * @slot validity-options
12
14
  */
@@ -138,7 +140,7 @@ export class TextField extends FormAssociatedBase {
138
140
  this.#sendValueToForm();
139
141
  break;
140
142
  case 'label':
141
- 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);
142
144
  // this.#sendValueToForm()
143
145
  break;
144
146
  case 'disabled':
@@ -392,7 +394,10 @@ export class TextField extends FormAssociatedBase {
392
394
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
393
395
  this.#sendValueToForm();
394
396
  };
395
- // Optional: form participation properties
397
+ /**
398
+ * Form participation property
399
+ * @type {string}
400
+ */
396
401
  get name() {
397
402
  return this.getAttribute('name') ?? this.getAttribute('label') ?? this.querySelector(':scope>[slot=label]')?.textContent ?? '';
398
403
  }
@@ -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
  */
@@ -16,6 +18,10 @@ export declare class ToggleView extends FormAssociatedBase {
16
18
  get toggleStyle(): ToggleStyle;
17
19
  get isOn(): boolean;
18
20
  set isOn(v: boolean);
21
+ /**
22
+ * Form participation property
23
+ * @type {string}
24
+ */
19
25
  get name(): string;
20
26
  get value(): string | null;
21
27
  set value(v: string | null);
@@ -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'))
@@ -160,7 +162,10 @@ export class ToggleView extends FormAssociatedBase {
160
162
  console.debug(`${_a.name} ⚡️ ${evt?.type}`);
161
163
  this.#sendValueToForm();
162
164
  };
163
- // Optional: form participation properties
165
+ /**
166
+ * Form participation property
167
+ * @type {string}
168
+ */
164
169
  get name() {
165
170
  return this.getAttribute('name') ?? this.getAttribute('label') ?? this.querySelector(':scope>[slot=label]')?.textContent ?? '';
166
171
  }
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * @summary Populates the toolbar or navigation bar with the specified items.
3
3
  *
4
- * @slot cancellation-action - The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
5
- * @slot primary-action - The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
6
- * @slot confirmation-action - The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
7
- * @slot destructive-action - The item represents a destructive action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
8
- * @slot top-bar-leading - Places the item in the leading edge of the top bar
9
- * @slot top-bar-principal - Places the item in the middle of the top bar
10
- * @slot top-bar-trailing - Places the item in the trailing edge of the top bar
11
- * @slot bottom-bar-leading - Places the item in the leading edge of the bottom bar
12
- * @slot bottom-bar-principal - Places the item in the middle of the bottom bar
13
- * @slot bottom-bar-trailing - Places the item in the trailing edge of the bottom bar
4
+ * @slot cancellation-action — The item represents a cancellation action for a modal interface. Places the item in the leading edge of the top bar and on the trailing edge of the bottom bar when fine modal
5
+ * @slot primary-action — The item represents a primary action. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
6
+ * @slot confirmation-action — The item represents a confirmation action for a modal interface. Places the item in the trailing edge of the top bar and on the trailing edge of the bottom bar when fine modal
7
+ * @slot destructive-action — The item represents a destructive action for a modal interface. Places the item in the leading edge of the top bar and on the leading edge of the bottom bar when fine modal
8
+ * @slot top-bar-leading — Places the item in the leading edge of the top bar
9
+ * @slot top-bar-principal — Places the item in the middle of the top bar
10
+ * @slot top-bar-trailing — Places the item in the trailing edge of the top bar
11
+ * @slot bottom-bar-leading — Places the item in the leading edge of the bottom bar
12
+ * @slot bottom-bar-principal — Places the item in the middle of the bottom bar
13
+ * @slot bottom-bar-trailing — Places the item in the trailing edge of the bottom bar
14
14
  */
15
15
  export declare class ToolBar extends HTMLElement {
16
16
  #private;