@swiftwc/ui 0.0.0-dev.85 → 0.0.0-dev.87

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 (84) hide show
  1. package/generated/client/index.d.ts +3 -0
  2. package/generated/client/index.js +3 -0
  3. package/generated/components/alert-dialog.d.ts +4 -0
  4. package/generated/components/alert-dialog.js +4 -0
  5. package/generated/components/bordered-button.js +1 -1
  6. package/generated/components/bordered-prominent-button.js +1 -1
  7. package/generated/components/borderless-button.js +1 -1
  8. package/generated/components/confirmation-dialog.d.ts +4 -0
  9. package/generated/components/confirmation-dialog.js +4 -0
  10. package/generated/components/date-picker.js +4 -3
  11. package/generated/components/glass-button.js +1 -1
  12. package/generated/components/glass-prominent-button.js +1 -1
  13. package/generated/components/h-stack.d.ts +6 -3
  14. package/generated/components/h-stack.js +6 -3
  15. package/generated/components/image-view.js +10 -11
  16. package/generated/components/label-view.d.ts +2 -0
  17. package/generated/components/label-view.js +15 -10
  18. package/generated/components/labeled-content.js +43 -23
  19. package/generated/components/menu-view.d.ts +2 -0
  20. package/generated/components/menu-view.js +5 -2
  21. package/generated/components/navigation-title.js +22 -16
  22. package/generated/components/picker-view.d.ts +2 -0
  23. package/generated/components/picker-view.js +15 -8
  24. package/generated/components/progress-view.d.ts +2 -0
  25. package/generated/components/progress-view.js +6 -3
  26. package/generated/components/scroll-view.d.ts +4 -0
  27. package/generated/components/scroll-view.js +30 -7
  28. package/generated/components/section-view.d.ts +4 -0
  29. package/generated/components/section-view.js +37 -17
  30. package/generated/components/table-view.d.ts +8 -0
  31. package/generated/components/table-view.js +13 -6
  32. package/generated/components/text-field.js +3 -2
  33. package/generated/components/toggle-view.js +3 -2
  34. package/generated/components/tool-bar-item.js +2 -2
  35. package/generated/components/v-stack.d.ts +6 -4
  36. package/generated/components/v-stack.js +6 -4
  37. package/generated/css/index.css +242 -11
  38. package/generated/internal/utils/ensure-placeholder.d.ts +1 -1
  39. package/generated/internal/utils/ensure-placeholder.js +8 -9
  40. package/generated/internal/utils/index.d.ts +0 -3
  41. package/generated/internal/utils/index.js +0 -3
  42. package/generated/internal/vendor/morphdom.d.ts +6 -0
  43. package/generated/internal/vendor/morphdom.js +720 -0
  44. package/generated/morphdom/html.d.ts +8 -0
  45. package/generated/morphdom/html.js +37 -0
  46. package/generated/morphdom/index.d.ts +6 -0
  47. package/generated/morphdom/index.js +6 -0
  48. package/generated/morphdom/morph.d.ts +4 -0
  49. package/generated/morphdom/morph.js +9 -0
  50. package/generated/morphdom/query-morph.d.ts +5 -0
  51. package/generated/morphdom/query-morph.js +12 -0
  52. package/package.json +5 -3
  53. package/scss/_maps.scss +256 -0
  54. package/scss/_vars.scss +2 -115
  55. package/scss/base/_root.scss +6 -5
  56. package/scss/colors/_index.scss +2 -2
  57. package/scss/components/_bordered-button.scss +2 -1
  58. package/scss/components/_bordered-prominent-button.scss +2 -1
  59. package/scss/components/_disclosure-group.scss +1 -1
  60. package/scss/components/_form-view.scss +3 -2
  61. package/scss/components/_glass-button.scss +2 -1
  62. package/scss/components/_glass-prominent-button.scss +2 -1
  63. package/scss/components/_h-stack.scss +4 -21
  64. package/scss/components/_label-view.scss +11 -10
  65. package/scss/components/_list-view.scss +3 -2
  66. package/scss/components/_picker-view.scss +5 -4
  67. package/scss/components/_scroll-view-proxy.scss +2 -2
  68. package/scss/components/_table-view.scss +3 -2
  69. package/scss/components/_toggle-view.scss +1 -1
  70. package/scss/components/_v-stack.scss +3 -4
  71. package/scss/mixins/_color.scss +2 -2
  72. package/scss/mixins/_index.scss +2 -2
  73. package/scss/placeholders/_buttons.scss +2 -1
  74. package/scss/utils/_frame.scss +1 -1
  75. package/scss/utils/_scroll-view.scss +1 -1
  76. package/scss/utils/_spacing.scss +1 -1
  77. package/scss/utils/_stacks.scss +8 -99
  78. package/web-components.html-data/en.json +460 -36
  79. package/generated/internal/utils/render-label-icon.d.ts +0 -2
  80. package/generated/internal/utils/render-label-icon.js +0 -19
  81. package/generated/internal/utils/render-label-title.d.ts +0 -2
  82. package/generated/internal/utils/render-label-title.js +0 -16
  83. package/generated/internal/utils/render-label.d.ts +0 -1
  84. package/generated/internal/utils/render-label.js +0 -19
@@ -5,6 +5,9 @@ import { type NavigationHost, queryInsertPosition, startViewTransition } from '.
5
5
  import { type WebComponentCtor } from '../namespace-browser';
6
6
  import { Snapshot } from '../snapshot';
7
7
  export declare const polyfills: Map<string, WebComponentCtor>;
8
+ /**
9
+ * Presents an alert with a message using the given data to produce the alert’s content and a string variable as a title.
10
+ */
8
11
  export declare const alert: (title?: string, message?: string, actions?: {
9
12
  label?: string;
10
13
  image?: string;
@@ -187,6 +187,9 @@ if (mediaQueryList.matches)
187
187
  // ac.abort() // dialog closes silently, a rejects with AbortError
188
188
  // // or still works standalone
189
189
  // a.dismiss() // same effect, no signal needed
190
+ /**
191
+ * Presents an alert with a message using the given data to produce the alert’s content and a string variable as a title.
192
+ */
190
193
  export const alert = (title, message, actions, options) => {
191
194
  const { promise, resolve, reject } = Promise.withResolvers();
192
195
  let dialog;
@@ -1,4 +1,8 @@
1
1
  import { DialogBase } from '../namespace-browser/base';
2
+ /**
3
+ * A representation of an alert presentation.
4
+ * Use it from the client module like `void alert('Save failed.')`.
5
+ */
2
6
  export declare class AlertDialog extends DialogBase {
3
7
  #private;
4
8
  constructor();
@@ -2,6 +2,10 @@ import { alertDialog } from '../buses';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
3
  import { devFlags, onoff, touchGlass } from '../internal/utils';
4
4
  import { DialogBase } from '../namespace-browser/base';
5
+ /**
6
+ * A representation of an alert presentation.
7
+ * Use it from the client module like `void alert('Save failed.')`.
8
+ */
5
9
  export class AlertDialog extends DialogBase {
6
10
  constructor() {
7
11
  super();
@@ -45,7 +45,7 @@ export class BorderedButton extends ButtonBase {
45
45
  case 'title-key':
46
46
  case 'role':
47
47
  Snapshot.waitReady.then(() => {
48
- ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
48
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
49
49
  });
50
50
  break;
51
51
  }
@@ -45,7 +45,7 @@ export class BorderedProminentButton extends ButtonBase {
45
45
  case 'title-key':
46
46
  case 'role':
47
47
  Snapshot.waitReady.then(() => {
48
- ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
48
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
49
49
  });
50
50
  break;
51
51
  }
@@ -45,7 +45,7 @@ export class BorderlessButton extends ButtonBase {
45
45
  case 'title-key':
46
46
  case 'role':
47
47
  Snapshot.waitReady.then(() => {
48
- ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
48
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
49
49
  });
50
50
  break;
51
51
  }
@@ -1,4 +1,8 @@
1
1
  import { DialogBase } from '../namespace-browser/base';
2
+ /**
3
+ * A representation of a confirmation presentation.
4
+ * Use it from the client module like `await confirmation(trigger, 'Permanently erase the items in the Trash?')`.
5
+ */
2
6
  export declare class ConfirmationDialog extends DialogBase {
3
7
  #private;
4
8
  static get observedAttributes(): string[];
@@ -2,6 +2,10 @@ import { confirmationDialog } from '../buses';
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
3
  import { devFlags, isInside, onoff, touchGlass } from '../internal/utils';
4
4
  import { DialogBase } from '../namespace-browser/base';
5
+ /**
6
+ * A representation of a confirmation presentation.
7
+ * Use it from the client module like `await confirmation(trigger, 'Permanently erase the items in the Trash?')`.
8
+ */
5
9
  export class ConfirmationDialog extends DialogBase {
6
10
  static get observedAttributes() {
7
11
  return ['anchor'];
@@ -3,7 +3,8 @@ import { I18n } from '../i18n';
3
3
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
4
4
  import { FormAssociatedBase, getInternals } from '../internal/class/form-associated-base';
5
5
  import { MutationObserverSet } from '../internal/class/mutation-observer-set';
6
- import { $, clamp, devFlags, kebabCase, onoff, renderLabel, set } from '../internal/utils';
6
+ import { $, clamp, devFlags, kebabCase, onoff, set } from '../internal/utils';
7
+ import { html, queryMorph } from '../morphdom';
7
8
  const datePickerStyles = ['graphical', 'field', 'automatic'];
8
9
  export class DatePicker extends FormAssociatedBase {
9
10
  static get observedAttributes() {
@@ -89,7 +90,7 @@ export class DatePicker extends FormAssociatedBase {
89
90
  input.setAttribute('placeholder', map[input.name] ?? '');
90
91
  break;
91
92
  case 'label':
92
- renderLabel(':scope>label-view[slot=label]', `<label-view slot="label" foreground="secondary"><span></span></label-view>`, this, newValue);
93
+ 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)
93
94
  // this.#sendValueToForm()
94
95
  break;
95
96
  case 'disabled':
@@ -121,7 +122,7 @@ export class DatePicker extends FormAssociatedBase {
121
122
  }
122
123
  #render() {
123
124
  if (devFlags.debug)
124
- console.debug(`${_a.name} ⚡️ render (${this.datePickerStyle})`);
125
+ console.debug(`${_a.name} ⚡️ #render (${this.datePickerStyle})`);
125
126
  // if (this.#lastRenderedStyle === this.datePickerStyle) return // skip if already applied
126
127
  // this.#lastRenderedStyle = this.datePickerStyle
127
128
  // clear shadow DOM
@@ -45,7 +45,7 @@ export class GlassButton extends ButtonBase {
45
45
  case 'title-key':
46
46
  case 'role':
47
47
  Snapshot.waitReady.then(() => {
48
- ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
48
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
49
49
  });
50
50
  break;
51
51
  }
@@ -45,7 +45,7 @@ export class GlassProminentButton extends ButtonBase {
45
45
  case 'title-key':
46
46
  case 'role':
47
47
  Snapshot.waitReady.then(() => {
48
- ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'));
48
+ ensurePlaceholder(target, target.getAttribute('role'), target.getAttribute('title-key'), Snapshot.config);
49
49
  });
50
50
  break;
51
51
  }
@@ -1,10 +1,13 @@
1
1
  /**
2
+ * @summary A view that arranges its subviews in a horizontal line.
3
+ *
4
+ * @attr {@templateSet} template - The main-axis grid template
2
5
  *
3
6
  * @attr {@spacingSet} spacing - The gap between the primary axis
4
7
  *
5
- * @attr {@alignmentSet} alignment - The cross-axis alignment
6
- * @attr {@distributionSet} distribution - The main-axis alignment
7
- * @attr {@placementSet} placement - The main-axis alignment
8
+ * @attr {@blockSet} alignment - The cross-axis alignment
9
+ * @attr {@inlineSet} distribution - The main-axis alignment
10
+ * @attr {@inlinePlacementSet} placement - The main-axis alignment
8
11
  *
9
12
  */
10
13
  export declare class HStack extends HTMLElement {
@@ -1,11 +1,14 @@
1
1
  import { devFlags } from '../internal/utils';
2
2
  /**
3
+ * @summary A view that arranges its subviews in a horizontal line.
4
+ *
5
+ * @attr {@templateSet} template - The main-axis grid template
3
6
  *
4
7
  * @attr {@spacingSet} spacing - The gap between the primary axis
5
8
  *
6
- * @attr {@alignmentSet} alignment - The cross-axis alignment
7
- * @attr {@distributionSet} distribution - The main-axis alignment
8
- * @attr {@placementSet} placement - The main-axis alignment
9
+ * @attr {@blockSet} alignment - The cross-axis alignment
10
+ * @attr {@inlineSet} distribution - The main-axis alignment
11
+ * @attr {@inlinePlacementSet} placement - The main-axis alignment
9
12
  *
10
13
  */
11
14
  export class HStack extends HTMLElement {
@@ -1,4 +1,5 @@
1
1
  import { $, devFlags } from '../internal/utils';
2
+ import { html, queryMorph } from '../morphdom';
2
3
  export class ImageView extends HTMLElement {
3
4
  static get observedAttributes() {
4
5
  return ['system-name', 'system-weight'];
@@ -40,18 +41,16 @@ export class ImageView extends HTMLElement {
40
41
  }
41
42
  }
42
43
  #render(icon, weight) {
43
- if (!icon) {
44
- this.querySelector(':scope>:not([slot])')?.remove();
45
- return;
46
- }
44
+ // if (!icon) {
45
+ // this.querySelector(':scope>:not([slot])')?.remove()
46
+ // return
47
+ // }
47
48
  const tokens = [`ph${weight ? `-${weight}` : ''}`, `ph-${icon}`];
48
- const container = this.querySelector(':scope>:not([slot])') ?? this.appendChild($(`<i style="line-height: 1"></i>`, '>1'));
49
- if ('1' !== container.style.getPropertyValue('line-height'))
50
- container.style.setProperty('line-height', '1');
51
- for (const token of container.classList)
52
- if (token.startsWith('ph') && !tokens.includes(token))
53
- container.classList.remove(token);
54
- container.classList.add(...tokens);
49
+ // const container = this.querySelector<HTMLElement>(':scope>:not([slot])') ?? this.appendChild<HTMLElement>($(`<i style="line-height: 1"></i>`, '>1'))
50
+ queryMorph(':not([slot])', html `<i style="line-height: 1" class="${tokens.join(' ')}"></i>`, this, { removeIf: !icon });
51
+ // if ('1' !== container.style.getPropertyValue('line-height')) container.style.setProperty('line-height', '1')
52
+ // for (const token of container.classList) if (token.startsWith('ph') && !tokens.includes(token)) container.classList.remove(token)
53
+ // container.classList.add(...tokens)
55
54
  }
56
55
  disconnectedCallback() {
57
56
  if (devFlags.debug)
@@ -2,6 +2,8 @@
2
2
  *
3
3
  * @attr {@fontSet} font - Sets the default font for text in this view.
4
4
  *
5
+ * @slot icon
6
+ *
5
7
  */
6
8
  export declare class LabelView extends HTMLElement {
7
9
  #private;
@@ -1,9 +1,11 @@
1
1
  import { $, devFlags } from '../internal/utils';
2
- import { html, render } from '../tpl';
2
+ import { html, queryMorph } from '../morphdom';
3
3
  /**
4
4
  *
5
5
  * @attr {@fontSet} font - Sets the default font for text in this view.
6
6
  *
7
+ * @slot icon
8
+ *
7
9
  */
8
10
  export class LabelView extends HTMLElement {
9
11
  static get observedAttributes() {
@@ -38,18 +40,21 @@ export class LabelView extends HTMLElement {
38
40
  return;
39
41
  // this.#scheduleReflect()
40
42
  switch (name) {
41
- case 'system-image':
42
- case 'title':
43
- render(html `${this.getAttribute('title') ? html `<span>${this.getAttribute('title')}</span>` : null}${this.getAttribute('system-image')
44
- ? html `<image-view slot="icon" system-name="${this.getAttribute('system-image')}"></image-view>`
45
- : null}`, this);
46
- break;
47
43
  // case 'system-image':
48
- // renderLabelIcon(this, newValue)
49
- // break
50
44
  // case 'title':
51
- // renderLabelTitle(this, newValue)
45
+ // render(
46
+ // html`${this.getAttribute('title') ? html`<span>${this.getAttribute('title')}</span>` : null}${this.getAttribute('system-image')
47
+ // ? html`<image-view slot="icon" system-name="${this.getAttribute('system-image')}"></image-view>`
48
+ // : null}`,
49
+ // this
50
+ // )
52
51
  // break
52
+ case 'system-image':
53
+ queryMorph('[slot=icon]', html `<image-view slot="icon" system-name="${newValue}"></image-view>`, this, { removeIf: !newValue }); //renderLabelIcon(this, newValue)
54
+ break;
55
+ case 'title':
56
+ queryMorph(':not([slot])', html `<span>${newValue}</span>`, this, { removeIf: !newValue }); //renderLabelTitle(this, newValue)
57
+ break;
53
58
  }
54
59
  }
55
60
  disconnectedCallback() {
@@ -1,5 +1,5 @@
1
- import { $, devFlags, renderLabel } from '../internal/utils';
2
- import { html, render } from '../tpl';
1
+ import { $, devFlags } from '../internal/utils';
2
+ import { html, queryMorph } from '../morphdom';
3
3
  export class LabeledContent extends HTMLElement {
4
4
  static get observedAttributes() {
5
5
  return ['value', 'label', 'header', 'footer', 'labeled-content-style', 'format'];
@@ -34,33 +34,53 @@ export class LabeledContent extends HTMLElement {
34
34
  return;
35
35
  switch (name) {
36
36
  case 'header':
37
- if (!newValue) {
38
- this.querySelector(':scope>[slot=header]')?.remove();
39
- break;
40
- }
41
- const header = this.querySelector(':scope>[slot=header]') ?? this.appendChild(Object.assign(document.createElement('header'), { slot: 'header' }));
42
- render(html `<label-view font="callout">
43
- <span>${newValue}</span>
44
- </label-view>`, header);
37
+ // if (!newValue) {
38
+ // this.querySelector(':scope>[slot=header]')?.remove()
39
+ // break
40
+ // }
41
+ // const header = this.querySelector(':scope>[slot=header]') ?? this.appendChild(Object.assign(document.createElement('header'), { slot: 'header' }))
42
+ queryMorph('[slot=header]', html `<header slot="header">
43
+ <label-view font="callout">
44
+ <span>${newValue}</span>
45
+ </label-view>
46
+ </header>`, this, { removeIf: !newValue });
47
+ // render(
48
+ // html`<label-view font="callout">
49
+ // <span>${newValue}</span>
50
+ // </label-view>`,
51
+ // header
52
+ // )
45
53
  break;
46
54
  case 'footer':
47
- if (!newValue) {
48
- this.querySelector(':scope>[slot=footer]')?.remove();
49
- break;
50
- }
51
- const footer = this.querySelector(':scope>[slot=footer]') ?? this.appendChild(Object.assign(document.createElement('footer'), { slot: 'footer' }));
52
- render(html `<label-view font="callout">
53
- <span>${newValue}</span>
54
- </label-view>`, footer);
55
+ // if (!newValue) {
56
+ // this.querySelector(':scope>[slot=footer]')?.remove()
57
+ // break
58
+ // }
59
+ // const footer = this.querySelector(':scope>[slot=footer]') ?? this.appendChild(Object.assign(document.createElement('footer'), { slot: 'footer' }))
60
+ queryMorph('[slot=footer]', html `<footer slot="footer">
61
+ <label-view font="callout">
62
+ <span>${newValue}</span>
63
+ </label-view>
64
+ </footer>`, this, { removeIf: !newValue });
65
+ // render(
66
+ // html`<label-view font="callout">
67
+ // <span>${newValue}</span>
68
+ // </label-view>`,
69
+ // footer
70
+ // )
55
71
  break;
56
- case 'value':
57
- renderLabel(':scope>label-view:not([slot])', `<label-view><span></span></label-view>`, this, this.#fmt(newValue, this.getAttribute('format')));
72
+ case 'value': {
73
+ const val = this.#fmt(newValue, this.getAttribute('format'));
74
+ queryMorph('label-view:not([slot])', html `<label-view>${val ? html `<span>${val}</span>` : null}</label-view>`, this); //renderLabel(':scope>label-view:not([slot])', `<label-view><span></span></label-view>`, this, this.#fmt(newValue, this.getAttribute('format')))
58
75
  break;
59
- case 'format':
60
- renderLabel(':scope>label-view:not([slot])', `<label-view><span></span></label-view>`, this, this.#fmt(this.getAttribute('value'), newValue));
76
+ }
77
+ case 'format': {
78
+ const val = this.#fmt(this.getAttribute('value'), newValue);
79
+ queryMorph('label-view:not([slot])', html `<label-view>${val ? html `<span>${val}</span>` : null}</label-view>`, this); //renderLabel(':scope>label-view:not([slot])', `<label-view><span></span></label-view>`, this, this.#fmt(this.getAttribute('value'), newValue))
61
80
  break;
81
+ }
62
82
  case 'label':
63
- renderLabel(':scope>label-view[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, newValue);
83
+ 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)
64
84
  break;
65
85
  }
66
86
  }
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * @summary A control for presenting a menu of actions.
3
+ *
4
+ * @slot label
3
5
  */
4
6
  export declare class MenuView extends HTMLElement {
5
7
  #private;
@@ -1,8 +1,11 @@
1
1
  var _a;
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
- import { $, devFlags, onoff, renderLabel, touchGlass } from '../internal/utils';
3
+ import { $, devFlags, onoff, touchGlass } from '../internal/utils';
4
+ import { html, queryMorph } from '../morphdom';
4
5
  /**
5
6
  * @summary A control for presenting a menu of actions.
7
+ *
8
+ * @slot label
6
9
  */
7
10
  export class MenuView extends HTMLElement {
8
11
  static get observedAttributes() {
@@ -58,7 +61,7 @@ export class MenuView extends HTMLElement {
58
61
  }
59
62
  break;
60
63
  case 'label':
61
- renderLabel(':scope>[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, newValue);
64
+ queryMorph('[slot=label]', html `<label-view slot="label">${newValue ? html `<span>${newValue}</span>` : null}</label-view>`, this); //renderLabel(':scope>[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, newValue)
62
65
  break;
63
66
  }
64
67
  }
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var NavigationTitle_1;
8
8
  import { microtaskOnConnected } from '../internal/decorators';
9
9
  import { devFlags } from '../internal/utils';
10
- import { html, render } from '../tpl';
10
+ import { html, queryMorph } from '../morphdom';
11
11
  let NavigationTitle = NavigationTitle_1 = class NavigationTitle extends HTMLElement {
12
12
  static get observedAttributes() {
13
13
  return ['value', 'subtitle', 'system-image', 'system-image-weight'];
@@ -29,21 +29,27 @@ let NavigationTitle = NavigationTitle_1 = class NavigationTitle extends HTMLElem
29
29
  console.debug(`${NavigationTitle_1.name} ⚡️ connect`);
30
30
  }
31
31
  #render = (title, subtitle, systemImage, systemImageWeight) => {
32
- const template = html `
33
- <v-stack alignment="fill">
34
- ${systemImage ? html `<image-view system-name="${systemImage}" system-weight="${systemImageWeight}" foreground="blue"></image-view>` : null}
35
- <v-stack spacing="0" alignment="fill">
36
- <label-view line-limit="1" truncation-mode="tail" font="headline">
37
- <span>${title ?? ''}</span>
38
- </label-view>
39
- <label-view line-limit="1" truncation-mode="tail" foreground="secondary" font="callout">
40
- <span>${subtitle ?? ''}</span>
41
- </label-view>
42
- </v-stack>
43
- </v-stack>
44
- `;
45
- const container = this.querySelector(':scope>:not([slot])') ?? this.appendChild(document.createElement('navigation-large-title'));
46
- render(template, container);
32
+ // const container = this.querySelector(':scope>:not([slot])') ?? this.appendChild(document.createElement('navigation-large-title'))
33
+ // render(template, container)
34
+ queryMorph(':not([slot])', html `
35
+ <navigation-large-title>
36
+ <v-stack alignment="fill">
37
+ ${systemImage ? html `<image-view system-name="${systemImage}" system-weight="${systemImageWeight}" foreground="blue"></image-view>` : null}
38
+ <v-stack spacing="0" alignment="fill">
39
+ ${title
40
+ ? html `<label-view line-limit="1" truncation-mode="tail" font="headline">
41
+ <span>${title}</span>
42
+ </label-view>`
43
+ : null}
44
+ ${subtitle
45
+ ? html `<label-view line-limit="1" truncation-mode="tail" foreground="secondary" font="callout">
46
+ <span>${subtitle}</span>
47
+ </label-view>`
48
+ : null}
49
+ </v-stack>
50
+ </v-stack>
51
+ </navigation-large-title>
52
+ `, this);
47
53
  // const titleTemplate = `<label-view line-limit="1" truncation-mode="tail" font="headline"><span></span></label-view>`,
48
54
  // subtitleTemplate = `<label-view line-limit="1" truncation-mode="tail" foreground="secondary" font="callout"><span></span></label-view>`,
49
55
  // vStactTemplate = `<v-stack spacing="0" alignment="fill">${titleTemplate}${subtitleTemplate}</v-stack>`
@@ -19,7 +19,9 @@ export type Dictionary = DictEntry[];
19
19
  *
20
20
  * @attr {vertical|horizontal|auto} label-value-placement
21
21
  *
22
+ * @slot label
22
23
  * @slot list
24
+ * @slot validity-options
23
25
  */
24
26
  export declare class PickerView extends FormAssociatedBase {
25
27
  #private;
@@ -5,7 +5,8 @@ import { FormAssociatedBase, getInternals } from '../internal/class/form-associa
5
5
  import { MutationObserverSet } from '../internal/class/mutation-observer-set';
6
6
  import { NavigationPath } from '../internal/class/navigation-path';
7
7
  import { queryInsertPosition, startViewTransition } from '../internal/privateNamespace';
8
- import { $, devFlags, kebabCase, onoff, renderLabel, renderLabelIcon, renderLabelTitle } from '../internal/utils';
8
+ import { $, devFlags, kebabCase, onoff } from '../internal/utils';
9
+ import { html as htmx, morph, queryMorph } from '../morphdom';
9
10
  import { html, render } from '../tpl';
10
11
  const pickerStyles = ['menu', 'inline', 'navigation-link', 'sheet', 'automatic'];
11
12
  const update = (path, node, overwrite = true) => {
@@ -124,7 +125,9 @@ const collectLeafValues = (node) => (node.children.length ? node.children.flatMa
124
125
  *
125
126
  * @attr {vertical|horizontal|auto} label-value-placement
126
127
  *
128
+ * @slot label
127
129
  * @slot list
130
+ * @slot validity-options
128
131
  */
129
132
  export class PickerView extends FormAssociatedBase {
130
133
  static get ATTR() {
@@ -433,7 +436,7 @@ export class PickerView extends FormAssociatedBase {
433
436
  const value = this.getAttribute(this.constructor.ATTR.LABEL);
434
437
  if (value) {
435
438
  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');
436
- renderLabel(':scope>label-view:nth-child(2)', `<label-view><span></span></label-view>`, hStack, value);
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)
437
440
  // if (label) renderLabelTitle(label, value) //label.setAttribute('title', value)
438
441
  section.insertAdjacentElement('beforeend', hStack);
439
442
  }
@@ -667,7 +670,7 @@ export class PickerView extends FormAssociatedBase {
667
670
  }
668
671
  #render() {
669
672
  if (devFlags.debug)
670
- console.debug(`${_a.name} ⚡️ render (${this.pickerStyle})`);
673
+ console.debug(`${_a.name} ⚡️ #render (${this.pickerStyle})`);
671
674
  // const style = this.getAttribute((this.constructor as typeof PickerView).ATTR.PICKER_STYLE)
672
675
  if (this.#lastRenderedStyle === this.pickerStyle)
673
676
  return; // skip if already applied
@@ -980,7 +983,7 @@ export class PickerView extends FormAssociatedBase {
980
983
  #reflectLabel(value) {
981
984
  if (devFlags.debug)
982
985
  console.debug(`${_a.name} #reflectLabel`);
983
- renderLabel(':scope>label-view[slot=label]', `<label-view slot="label"><span></span></label-view>`, this, value);
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)
984
987
  this.#renderSlotted([]);
985
988
  }
986
989
  #reflectSelectionOnButtons() {
@@ -1027,8 +1030,10 @@ export class PickerView extends FormAssociatedBase {
1027
1030
  break;
1028
1031
  // if (!cvl) currentValueLabel.setAttribute('foreground', 'secondary')
1029
1032
  // else currentValueLabel.removeAttribute('foreground')
1030
- renderLabelTitle(currentValueLabel, this.#currentValueLabel || this.#selection || this.getAttribute(this.constructor.ATTR.PLACEHOLDER));
1031
- renderLabelIcon(currentValueLabel, this.#currentValueIcon || this.getAttribute(this.constructor.ATTR.PLACEHOLDER_ICON));
1033
+ 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
+ morph(htmx `<label-view>${systemImage ? htmx `<image-view slot="icon" system-name="${systemImage}"></image-view>` : null}${title ? htmx `<span>${title}</span>` : null}</label-view>`, currentValueLabel);
1032
1037
  break;
1033
1038
  }
1034
1039
  case 'menu': {
@@ -1037,8 +1042,10 @@ export class PickerView extends FormAssociatedBase {
1037
1042
  break;
1038
1043
  // if (!cvl) currentValueLabel.setAttribute('foreground', 'secondary')
1039
1044
  // else currentValueLabel.removeAttribute('foreground')
1040
- renderLabelTitle(currentValueLabel, this.#currentValueLabel || this.#selection || this.getAttribute(this.constructor.ATTR.PLACEHOLDER));
1041
- renderLabelIcon(currentValueLabel, this.#currentValueIcon || this.getAttribute(this.constructor.ATTR.PLACEHOLDER_ICON));
1045
+ const title = this.#currentValueLabel || this.#selection || this.getAttribute(this.constructor.ATTR.PLACEHOLDER), systemImage = this.#currentValueIcon || this.getAttribute(this.constructor.ATTR.PLACEHOLDER_ICON);
1046
+ // 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))
1047
+ // 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))
1048
+ morph(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>`, currentValueLabel);
1042
1049
  break;
1043
1050
  }
1044
1051
  case 'inline':
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * @summary A view that shows the progress toward completion of a task.
3
+ *
4
+ * @slot current-value
3
5
  */
4
6
  export declare class ProgressView extends HTMLElement {
5
7
  #private;
@@ -1,11 +1,14 @@
1
1
  var _a;
2
2
  import { CleanupRegistry } from '../internal/class/cleanup-registry';
3
3
  import { CSSStyleObserver } from '../internal/class/css-style-observer';
4
- import { $, devFlags, renderLabel } from '../internal/utils';
4
+ import { $, devFlags } from '../internal/utils';
5
+ import { html, queryMorph } from '../morphdom';
5
6
  import { Snapshot } from '../snapshot';
6
7
  const progressViewStyles = ['circular', 'linear'];
7
8
  /**
8
9
  * @summary A view that shows the progress toward completion of a task.
10
+ *
11
+ * @slot current-value
9
12
  */
10
13
  export class ProgressView extends HTMLElement {
11
14
  static get observedAttributes() {
@@ -68,7 +71,7 @@ export class ProgressView extends HTMLElement {
68
71
  break;
69
72
  }
70
73
  case 'current-value-label': {
71
- renderLabel(':scope>[slot=current-value]', `<label-view slot="current-value" font="callout" foreground="secondary"><span></span></label-view>`, this, newValue);
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)
72
75
  break;
73
76
  }
74
77
  }
@@ -100,7 +103,7 @@ export class ProgressView extends HTMLElement {
100
103
  };
101
104
  #render() {
102
105
  if (devFlags.debug)
103
- console.debug(`${_a.name} ⚡️ render (${this.#progressViewStyle})`);
106
+ console.debug(`${_a.name} ⚡️ #render (${this.#progressViewStyle})`);
104
107
  if (this.#lastRenderedStyle === this.#progressViewStyle)
105
108
  return; // skip if already applied
106
109
  this.#lastRenderedStyle = this.#progressViewStyle;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @slot top-bar-principal
3
+ * @slot bottom-bar-principal
4
+ */
1
5
  export declare class ScrollView extends HTMLElement {
2
6
  #private;
3
7
  static get observedAttributes(): string[];