@vollowx/seele 0.13.5 → 0.13.6

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 (146) hide show
  1. package/custom-elements.json +1256 -115
  2. package/package.json +22 -14
  3. package/src/all.d.ts +34 -0
  4. package/src/base/autocomplete.d.ts +56 -0
  5. package/src/base/autocomplete.js +75 -87
  6. package/src/base/button.d.ts +13 -0
  7. package/src/base/button.js +21 -19
  8. package/src/base/checkbox.d.ts +18 -0
  9. package/src/base/checkbox.js +39 -34
  10. package/src/base/controllers/list-controller.d.ts +37 -0
  11. package/src/base/controllers/list-controller.js +23 -15
  12. package/src/base/controllers/popover-controller.d.ts +35 -0
  13. package/src/base/controllers/popover-controller.js +37 -29
  14. package/src/base/dialog.d.ts +20 -0
  15. package/src/base/dialog.js +11 -9
  16. package/src/base/field.d.ts +3 -0
  17. package/src/base/input.d.ts +44 -0
  18. package/src/base/input.js +57 -65
  19. package/src/base/item.d.ts +7 -0
  20. package/src/base/item.js +2 -1
  21. package/src/base/list-item.d.ts +15 -0
  22. package/src/base/list-item.js +22 -22
  23. package/src/base/list.d.ts +54 -0
  24. package/src/base/list.js +69 -55
  25. package/src/base/menu-item.d.ts +6 -0
  26. package/src/base/menu-item.js +4 -3
  27. package/src/base/menu.d.ts +76 -0
  28. package/src/base/menu.js +135 -143
  29. package/src/base/mixins/attachable.d.ts +9 -0
  30. package/src/base/mixins/attachable.js +22 -18
  31. package/src/base/mixins/focus-delegated.d.ts +5 -0
  32. package/src/base/mixins/focus-delegated.js +6 -8
  33. package/src/base/mixins/form-associated.d.ts +15 -0
  34. package/src/base/mixins/form-associated.js +11 -18
  35. package/src/base/mixins/internals-attached.d.ts +6 -0
  36. package/src/base/mixins/internals-attached.js +1 -1
  37. package/src/base/option.d.ts +9 -0
  38. package/src/base/option.js +7 -8
  39. package/src/base/radio.d.ts +13 -0
  40. package/src/base/radio.js +49 -42
  41. package/src/base/select.d.ts +116 -0
  42. package/src/base/select.js +130 -128
  43. package/src/base/slider.d.ts +75 -0
  44. package/src/base/slider.js +115 -118
  45. package/src/base/tab-panel.d.ts +9 -0
  46. package/src/base/tab-panel.js +11 -11
  47. package/src/base/tab.d.ts +18 -0
  48. package/src/base/tab.js +25 -24
  49. package/src/base/tabs.d.ts +19 -0
  50. package/src/base/tabs.js +84 -81
  51. package/src/base/toggle-button.d.ts +47 -0
  52. package/src/base/toggle-button.js +56 -52
  53. package/src/base/tooltip.d.ts +37 -0
  54. package/src/base/tooltip.js +70 -65
  55. package/src/core/decorators.d.ts +2 -0
  56. package/src/core/decorators.js +4 -3
  57. package/src/core/focus-visible.d.ts +2 -0
  58. package/src/core/focus-visible.js +4 -4
  59. package/src/core/shared.d.ts +1 -0
  60. package/src/core/unique-id.d.ts +4 -0
  61. package/src/core/unique-id.js +2 -1
  62. package/src/m3/autocomplete/autocomplete.d.ts +8 -0
  63. package/src/m3/autocomplete/autocomplete.js +10 -10
  64. package/src/m3/badge/badge.d.ts +12 -0
  65. package/src/m3/badge/badge.js +24 -37
  66. package/src/m3/button/common-button-toggle.d.ts +31 -0
  67. package/src/m3/button/common-button-toggle.js +44 -41
  68. package/src/m3/button/common-button.d.ts +29 -0
  69. package/src/m3/button/common-button.js +40 -40
  70. package/src/m3/button/icon-button-toggle.d.ts +24 -0
  71. package/src/m3/button/icon-button-toggle.js +35 -32
  72. package/src/m3/button/icon-button.d.ts +23 -0
  73. package/src/m3/button/icon-button.js +33 -31
  74. package/src/m3/button-group/connected-button-group.d.ts +19 -0
  75. package/src/m3/button-group/connected-button-group.js +26 -24
  76. package/src/m3/button-group/standard-button-group.d.ts +24 -0
  77. package/src/m3/button-group/standard-button-group.js +71 -65
  78. package/src/m3/checkbox/checkbox.d.ts +25 -0
  79. package/src/m3/checkbox/checkbox.js +23 -22
  80. package/src/m3/dialog/dialog-spring.d.ts +45 -0
  81. package/src/m3/dialog/dialog-spring.js +83 -86
  82. package/src/m3/dialog/dialog.d.ts +46 -0
  83. package/src/m3/dialog/dialog.js +90 -117
  84. package/src/m3/divider/divider.d.ts +13 -0
  85. package/src/m3/divider/divider.js +20 -33
  86. package/src/m3/fab/fab.d.ts +23 -0
  87. package/src/m3/fab/fab.js +24 -23
  88. package/src/m3/field/field.d.ts +28 -0
  89. package/src/m3/field/field.js +40 -55
  90. package/src/m3/field/filled-field.d.ts +11 -0
  91. package/src/m3/field/filled-field.js +7 -11
  92. package/src/m3/field/outlined-field.d.ts +11 -0
  93. package/src/m3/field/outlined-field.js +8 -12
  94. package/src/m3/focus-ring/focus-ring.d.ts +32 -0
  95. package/src/m3/focus-ring/focus-ring.js +38 -23
  96. package/src/m3/item/item.d.ts +31 -0
  97. package/src/m3/item/item.js +32 -17
  98. package/src/m3/list/list-item.d.ts +22 -0
  99. package/src/m3/list/list-item.js +18 -16
  100. package/src/m3/list/list.d.ts +15 -0
  101. package/src/m3/list/list.js +16 -15
  102. package/src/m3/loading-indicator/loading-indicator.d.ts +26 -0
  103. package/src/m3/loading-indicator/loading-indicator.js +113 -161
  104. package/src/m3/menu/menu-item.d.ts +15 -0
  105. package/src/m3/menu/menu-item.js +10 -4
  106. package/src/m3/menu/menu.d.ts +22 -0
  107. package/src/m3/menu/menu.js +20 -18
  108. package/src/m3/radio/radio-styles.css.js +1 -1
  109. package/src/m3/radio/radio.d.ts +17 -0
  110. package/src/m3/radio/radio.js +22 -11
  111. package/src/m3/ripple/ripple.d.ts +43 -0
  112. package/src/m3/ripple/ripple.js +82 -89
  113. package/src/m3/select/filled-select.d.ts +16 -0
  114. package/src/m3/select/filled-select.js +12 -10
  115. package/src/m3/select/option.d.ts +15 -0
  116. package/src/m3/select/option.js +10 -4
  117. package/src/m3/select/outlined-select.d.ts +16 -0
  118. package/src/m3/select/outlined-select.js +12 -10
  119. package/src/m3/select/select.d.ts +13 -0
  120. package/src/m3/select/select.js +16 -16
  121. package/src/m3/slider/slider.d.ts +20 -0
  122. package/src/m3/slider/slider.js +32 -26
  123. package/src/m3/switch/switch.d.ts +27 -0
  124. package/src/m3/switch/switch.js +62 -53
  125. package/src/m3/system/motion.d.ts +12 -0
  126. package/src/m3/system/motion.js +16 -9
  127. package/src/m3/tab/tab-panel.d.ts +9 -0
  128. package/src/m3/tab/tab-panel.js +6 -9
  129. package/src/m3/tab/tab.d.ts +19 -0
  130. package/src/m3/tab/tab.js +14 -12
  131. package/src/m3/tab/tabs.d.ts +25 -0
  132. package/src/m3/tab/tabs.js +34 -30
  133. package/src/m3/text-field/filled-text-field.d.ts +13 -0
  134. package/src/m3/text-field/filled-text-field.js +15 -20
  135. package/src/m3/text-field/outlined-text-field.d.ts +13 -0
  136. package/src/m3/text-field/outlined-text-field.js +15 -20
  137. package/src/m3/toolbar/toolbar.d.ts +26 -0
  138. package/src/m3/toolbar/toolbar.js +28 -25
  139. package/src/m3/tooltip/tooltip.d.ts +19 -0
  140. package/src/m3/tooltip/tooltip.js +15 -14
  141. package/src/win98/button/button.d.ts +13 -0
  142. package/src/win98/button/button.js +13 -11
  143. package/src/win98/button/radio.d.ts +3 -0
  144. package/src/win98/button/radio.js +5 -4
  145. package/src/win98/radio/radio.d.ts +3 -0
  146. package/src/win98/radio/radio.js +5 -4
@@ -1,21 +1,64 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { html } from 'lit';
3
3
  import { query, state, customElement } from 'lit/decorators.js';
4
4
  import { Dialog } from '../../base/dialog.js';
5
5
  import { getSpring } from '../system/motion.js';
6
6
  import { dialogStyles } from './dialog-styles.css.js';
7
- export class M3Dialog extends Dialog {
8
- static{
9
- this.styles = [
10
- dialogStyles
11
- ];
7
+ /**
8
+ * TODO: test if form actions `cancel` and other things related work - no,
9
+ * event listener needed
10
+ *
11
+ * To get an approximation of the "not Expressive" version like:
12
+ * https://m3.material.io/styles/motion/easing-and-duration/applying-easing-and-duration#e5b958f0-435d-4e84-aed4-8d1ea395fa5c
13
+ *
14
+ * ```css
15
+ * --md-sys-motion-spatial-default: cubic-bezier(0, 0, 0, 1);
16
+ * --md-sys-motion-spatial-default-duration: 500ms;
17
+ * --md-sys-motion-spatial-fast: cubic-bezier(0.3, 0, 1, 1);
18
+ * --md-sys-motion-spatial-fast-duration: 300ms;
19
+ *
20
+ * --md-sys-motion-effects-fast: linear;
21
+ * --md-sys-motion-effects-fast-duration: 200ms;
22
+ * --md-sys-motion-effects-default: linear;
23
+ * --md-sys-motion-effects-default-duration: 300ms;
24
+ * ```
25
+ *
26
+ * @tag md-dialog
27
+ *
28
+ * @csspart container
29
+ * @csspart headline
30
+ * @csspart content
31
+ * @csspart actions
32
+ *
33
+ * @slot icon
34
+ * @slot headline
35
+ * @slot - content
36
+ * @slot actions
37
+ */
38
+ let M3Dialog = class M3Dialog extends Dialog {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.hasIcon = false;
42
+ this.#activeAnimations = [];
43
+ this.#handleClick = (e) => {
44
+ const target = e.target;
45
+ if (!this.$container.contains(target) && !this.contains(target))
46
+ this.close();
47
+ };
48
+ this.#handleIconSlotChange = (e) => {
49
+ const slot = e.target;
50
+ this.hasIcon = slot.assignedElements({ flatten: true }).length > 0;
51
+ };
52
+ this.#opening = false;
53
+ this.#closing = false;
12
54
  }
55
+ static { this.styles = [dialogStyles]; }
13
56
  render() {
14
- return html`<dialog part="dialog" @click="${this.#handleClick}" @cancel="${this._handleCancel}"><div part="container"><div part="body"><div part="headline" class="${this.hasIcon ? 'has-icon' : ''}"><slot name="icon" @slotchange="${this.#handleIconSlotChange}"></slot><slot name="headline"></slot></div><div part="content"><slot></slot></div><div class="actions-placeholder"></div></div><div part="actions"><slot name="actions"></slot></div></div></dialog><div part="scrim"></div>`;
57
+ return html `<dialog part="dialog" @click="${this.#handleClick}" @cancel="${this._handleCancel}"><div part="container"><div part="body"><div part="headline" class="${this.hasIcon ? 'has-icon' : ''}"><slot name="icon" @slotchange="${this.#handleIconSlotChange}"></slot><slot name="headline"></slot></div><div part="content"><slot></slot></div><div class="actions-placeholder"></div></div><div part="actions"><slot name="actions"></slot></div></div></dialog><div part="scrim"></div>`;
15
58
  }
16
59
  #activeAnimations;
17
60
  #clearAnimations() {
18
- this.#activeAnimations.forEach((anim)=>anim.cancel());
61
+ this.#activeAnimations.forEach((anim) => anim.cancel());
19
62
  this.#activeAnimations = [];
20
63
  this.#opening = this.#closing = false;
21
64
  }
@@ -26,12 +69,13 @@ export class M3Dialog extends Dialog {
26
69
  spatialDefault: getSpring(this, 'spatial', 'default'),
27
70
  spatialFast: getSpring(this, 'spatial', 'fast'),
28
71
  effectsDefault: getSpring(this, 'effects', 'default'),
29
- effectsFast: getSpring(this, 'effects', 'fast')
72
+ effectsFast: getSpring(this, 'effects', 'fast'),
30
73
  };
31
74
  }
32
75
  #opening;
33
76
  show() {
34
- if (this.#opening) return;
77
+ if (this.#opening)
78
+ return;
35
79
  this.#clearAnimations();
36
80
  this.#opening = true;
37
81
  // Reset margins to allow browser centering
@@ -51,129 +95,82 @@ export class M3Dialog extends Dialog {
51
95
  const container = this.$container.animate([
52
96
  {
53
97
  height: `${startHeight}px`,
54
- transform: `translateY(-40px)`
98
+ transform: `translateY(-40px)`,
55
99
  },
56
100
  {
57
101
  height: `${endHeight}px`,
58
- transform: 'translateY(0px)'
59
- }
60
- ], this.#springs.spatialDefault);
61
- const scrim = this.$scrim.animate([
62
- {
63
- opacity: 0
102
+ transform: 'translateY(0px)',
64
103
  },
65
- {
66
- opacity: 0.32
67
- }
68
- ], {
104
+ ], this.#springs.spatialDefault);
105
+ const scrim = this.$scrim.animate([{ opacity: 0 }, { opacity: 0.32 }], {
69
106
  ...this.#springs.effectsDefault,
70
- fill: 'forwards'
107
+ fill: 'forwards',
71
108
  });
72
- const body = this.$body.animate([
73
- {
74
- opacity: 0.2
75
- },
76
- {
77
- opacity: 1
78
- }
79
- ], {
109
+ const body = this.$body.animate([{ opacity: 0.2 }, { opacity: 1 }], {
80
110
  ...this.#springs.effectsDefault,
81
- fill: 'forwards'
111
+ fill: 'forwards',
82
112
  });
83
- const actions = this.$actions.animate([
84
- {
85
- opacity: 0.5
86
- },
87
- {
88
- opacity: 1
89
- }
90
- ], {
113
+ const actions = this.$actions.animate([{ opacity: 0.5 }, { opacity: 1 }], {
91
114
  ...this.#springs.effectsDefault,
92
- fill: 'forwards'
115
+ fill: 'forwards',
93
116
  });
94
117
  this.#activeAnimations.push(container, scrim, body, actions);
95
- container.onfinish = ()=>{
118
+ container.onfinish = () => {
96
119
  this.$container.style.minHeight = '';
97
120
  this.#clearAnimations();
98
121
  };
99
122
  }
100
123
  #closing;
101
124
  close() {
102
- if (this.#closing) return;
125
+ if (this.#closing)
126
+ return;
103
127
  this.#clearAnimations();
104
128
  this.#closing = true;
105
129
  const startHeight = this.$container.offsetHeight;
106
130
  const endHeight = startHeight * 0.35;
107
131
  this.$container.style.minHeight = '0px';
108
132
  const containerSpatial = this.$container.animate([
109
- {
110
- height: `${startHeight}px`,
111
- transform: 'translateY(0px)'
112
- },
133
+ { height: `${startHeight}px`, transform: 'translateY(0px)' },
113
134
  {
114
135
  height: `${endHeight}px`,
115
- transform: `translateY(-40px)`
116
- }
117
- ], this.#springs.spatialFast);
118
- const containerEffects = this.$container.animate([
119
- {
120
- opacity: 1
136
+ transform: `translateY(-40px)`,
121
137
  },
122
- {
123
- opacity: 0
124
- }
125
- ], {
138
+ ], this.#springs.spatialFast);
139
+ const containerEffects = this.$container.animate([{ opacity: 1 }, { opacity: 0 }], {
126
140
  ...this.#springs.effectsFast,
127
- fill: 'forwards'
141
+ fill: 'forwards',
128
142
  });
129
- const scrim = this.$scrim.animate([
130
- {
131
- opacity: 0.32
132
- },
133
- {
134
- opacity: 0
135
- }
136
- ], {
143
+ const scrim = this.$scrim.animate([{ opacity: 0.32 }, { opacity: 0 }], {
137
144
  ...this.#springs.effectsFast,
138
- fill: 'forwards'
145
+ fill: 'forwards',
139
146
  });
140
147
  this.#activeAnimations.push(containerSpatial, containerEffects, scrim);
141
- containerEffects.onfinish = ()=>{
148
+ containerEffects.onfinish = () => {
142
149
  this.$container.style.minHeight = '';
143
150
  super.close();
144
151
  this.#clearAnimations();
145
152
  };
146
153
  }
147
- constructor(...args){
148
- super(...args), this.hasIcon = false, this.#activeAnimations = [], this.#handleClick = (e)=>{
149
- const target = e.target;
150
- if (!this.$container.contains(target) && !this.contains(target)) this.close();
151
- }, this.#handleIconSlotChange = (e)=>{
152
- const slot = e.target;
153
- this.hasIcon = slot.assignedElements({
154
- flatten: true
155
- }).length > 0;
156
- }, this.#opening = false, this.#closing = false;
157
- }
158
- }
159
- _ts_decorate([
154
+ };
155
+ __decorate([
160
156
  state()
161
157
  ], M3Dialog.prototype, "hasIcon", void 0);
162
- _ts_decorate([
158
+ __decorate([
163
159
  query('[part=container]')
164
160
  ], M3Dialog.prototype, "$container", void 0);
165
- _ts_decorate([
161
+ __decorate([
166
162
  query('[part=body]')
167
163
  ], M3Dialog.prototype, "$body", void 0);
168
- _ts_decorate([
164
+ __decorate([
169
165
  query('[part=actions]')
170
166
  ], M3Dialog.prototype, "$actions", void 0);
171
- _ts_decorate([
167
+ __decorate([
172
168
  query('.actions-placeholder')
173
169
  ], M3Dialog.prototype, "$actionsPlaceholder", void 0);
174
- _ts_decorate([
170
+ __decorate([
175
171
  query('[part=scrim]')
176
172
  ], M3Dialog.prototype, "$scrim", void 0);
177
- M3Dialog = _ts_decorate([
173
+ M3Dialog = __decorate([
178
174
  customElement('md-dialog')
179
175
  ], M3Dialog);
176
+ export { M3Dialog };
@@ -0,0 +1,46 @@
1
+ import { Dialog } from '../../base/dialog.js';
2
+ /**
3
+ * TODO: test if form actions `cancel` and other things related work - no,
4
+ * event listener needed
5
+ *
6
+ * @tag md-dialog
7
+ *
8
+ * @csspart container
9
+ * @csspart headline
10
+ * @csspart content
11
+ * @csspart actions
12
+ *
13
+ * @slot icon
14
+ * @slot headline
15
+ * @slot - content
16
+ * @slot actions
17
+ */
18
+ export declare class M3Dialog extends Dialog {
19
+ #private;
20
+ _config: {
21
+ openEase: string;
22
+ closeEase: string;
23
+ vertSlide: number;
24
+ openDur: number;
25
+ closeDur: number;
26
+ bodyFadeInDur: number;
27
+ bodyFadeOutDur: number;
28
+ };
29
+ private hasIcon;
30
+ $container: HTMLDivElement;
31
+ $body: HTMLDivElement;
32
+ $icon: HTMLSlotElement;
33
+ $actions: HTMLDivElement;
34
+ $actionsPlaceholder: HTMLDivElement;
35
+ $scrim: HTMLDivElement;
36
+ static styles: any[];
37
+ render(): import("lit-html").TemplateResult<1>;
38
+ connectedCallback(): void;
39
+ show(): void;
40
+ close(): void;
41
+ }
42
+ declare global {
43
+ interface HTMLElementTagNameMap {
44
+ 'md-dialog': M3Dialog;
45
+ }
46
+ }
@@ -1,20 +1,63 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { html } from 'lit';
3
3
  import { query, state, customElement } from 'lit/decorators.js';
4
4
  import { Dialog } from '../../base/dialog.js';
5
5
  import { dialogStyles } from './dialog-styles.css.js';
6
- export class M3Dialog extends Dialog {
7
- static{
8
- this.styles = [
9
- dialogStyles
10
- ];
6
+ /**
7
+ * TODO: test if form actions `cancel` and other things related work - no,
8
+ * event listener needed
9
+ *
10
+ * @tag md-dialog
11
+ *
12
+ * @csspart container
13
+ * @csspart headline
14
+ * @csspart content
15
+ * @csspart actions
16
+ *
17
+ * @slot icon
18
+ * @slot headline
19
+ * @slot - content
20
+ * @slot actions
21
+ */
22
+ let M3Dialog = class M3Dialog extends Dialog {
23
+ constructor() {
24
+ super(...arguments);
25
+ // Was based on https://m3.material.io/styles/motion/easing-and-duration/applying-easing-and-duration#e5b958f0-435d-4e84-aed4-8d1ea395fa5c
26
+ // TODO: use curves and durations from motion physics
27
+ this._config = {
28
+ openEase: 'cubic-bezier(0, 0, 0, 1)',
29
+ closeEase: 'cubic-bezier(0.3, 0, 1, 1)',
30
+ vertSlide: 40,
31
+ openDur: 500,
32
+ closeDur: 200,
33
+ bodyFadeInDur: 200,
34
+ bodyFadeOutDur: 100,
35
+ };
36
+ this.hasIcon = false;
37
+ this.#activeAnimations = [];
38
+ this.#handleClick = (e) => {
39
+ const target = e.target;
40
+ if (!this.$container.contains(target) && !this.contains(target))
41
+ this.close();
42
+ };
43
+ this.#handleIconSlotChange = () => {
44
+ this.hasIcon = this.$icon.assignedElements({ flatten: true }).length > 0;
45
+ };
46
+ this.#opening = false;
47
+ this.#closing = false;
11
48
  }
49
+ static { this.styles = [dialogStyles]; }
12
50
  render() {
13
- return html`<dialog part="dialog" @click="${this.#handleClick}" @cancel="${this._handleCancel}"><div part="container"><div part="body"><div part="headline" class="${this.hasIcon ? 'has-icon' : ''}"><slot name="icon" @slotchange="${this.#handleIconSlotChange}"></slot><slot name="headline"></slot></div><div part="content"><slot></slot></div><div class="actions-placeholder"></div></div><div part="actions"><slot name="actions"></slot></div></div></dialog><div part="scrim"></div>`;
51
+ return html `<dialog part="dialog" @click="${this.#handleClick}" @cancel="${this._handleCancel}"><div part="container"><div part="body"><div part="headline" class="${this.hasIcon ? 'has-icon' : ''}"><slot name="icon" @slotchange="${this.#handleIconSlotChange}"></slot><slot name="headline"></slot></div><div part="content"><slot></slot></div><div class="actions-placeholder"></div></div><div part="actions"><slot name="actions"></slot></div></div></dialog><div part="scrim"></div>`;
52
+ }
53
+ connectedCallback() {
54
+ super.connectedCallback();
55
+ queueMicrotask(this.#handleIconSlotChange);
56
+ // Which is not called on a SSR'd element
14
57
  }
15
58
  #activeAnimations;
16
59
  #clearAnimations() {
17
- this.#activeAnimations.forEach((anim)=>anim.cancel());
60
+ this.#activeAnimations.forEach((anim) => anim.cancel());
18
61
  this.#activeAnimations = [];
19
62
  this.#opening = this.#closing = false;
20
63
  }
@@ -22,7 +65,8 @@ export class M3Dialog extends Dialog {
22
65
  #handleIconSlotChange;
23
66
  #opening;
24
67
  show() {
25
- if (this.#opening) return;
68
+ if (this.#opening)
69
+ return;
26
70
  this.#clearAnimations();
27
71
  this.#opening = true;
28
72
  // Reset margins to allow browser centering
@@ -42,175 +86,104 @@ export class M3Dialog extends Dialog {
42
86
  const container = this.$container.animate([
43
87
  {
44
88
  height: `${startHeight}px`,
45
- transform: `translateY(-${this._config.vertSlide}px)`
89
+ transform: `translateY(-${this._config.vertSlide}px)`,
46
90
  },
47
91
  {
48
92
  height: `${endHeight}px`,
49
- transform: 'translateY(0px)'
50
- }
51
- ], {
52
- duration: this._config.openDur,
53
- easing: this._config.openEase
54
- });
55
- const scrim = this.$scrim.animate([
56
- {
57
- opacity: 0
93
+ transform: 'translateY(0px)',
58
94
  },
59
- {
60
- opacity: 0.32
61
- }
62
- ], {
95
+ ], { duration: this._config.openDur, easing: this._config.openEase });
96
+ const scrim = this.$scrim.animate([{ opacity: 0 }, { opacity: 0.32 }], {
63
97
  duration: this._config.openDur,
64
98
  easing: this._config.openEase,
65
- fill: 'forwards'
99
+ fill: 'forwards',
66
100
  });
67
- const body = this.$body.animate([
68
- {
69
- opacity: 0.2
70
- },
71
- {
72
- opacity: 1
73
- }
74
- ], {
101
+ const body = this.$body.animate([{ opacity: 0.2 }, { opacity: 1 }], {
75
102
  duration: this._config.bodyFadeInDur,
76
103
  easing: 'linear',
77
- fill: 'forwards'
104
+ fill: 'forwards',
78
105
  });
79
- const actions = this.$actions.animate([
80
- {
81
- opacity: 0.5
82
- },
83
- {
84
- opacity: 1
85
- }
86
- ], {
106
+ const actions = this.$actions.animate([{ opacity: 0.5 }, { opacity: 1 }], {
87
107
  duration: this._config.bodyFadeInDur,
88
108
  easing: 'linear',
89
- fill: 'forwards'
109
+ fill: 'forwards',
90
110
  });
91
111
  this.#activeAnimations.push(container, scrim, body, actions);
92
- container.onfinish = ()=>{
112
+ container.onfinish = () => {
93
113
  this.$container.style.minHeight = '';
94
114
  this.#clearAnimations();
95
115
  };
96
116
  }
97
117
  #closing;
98
118
  close() {
99
- if (this.#closing) return;
119
+ if (this.#closing)
120
+ return;
100
121
  this.#clearAnimations();
101
122
  this.#closing = true;
102
123
  const startHeight = this.$container.offsetHeight;
103
124
  const endHeight = startHeight * 0.35;
104
125
  this.$container.style.minHeight = '0px';
105
126
  const containerSpatial = this.$container.animate([
106
- {
107
- height: `${startHeight}px`,
108
- transform: 'translateY(0px)'
109
- },
127
+ { height: `${startHeight}px`, transform: 'translateY(0px)' },
110
128
  {
111
129
  height: `${endHeight}px`,
112
- transform: `translateY(-${this._config.vertSlide}px)`
113
- }
130
+ transform: `translateY(-${this._config.vertSlide}px)`,
131
+ },
114
132
  ], {
115
133
  duration: this._config.closeDur,
116
- easing: this._config.closeEase
134
+ easing: this._config.closeEase,
117
135
  });
118
- const containerEffects = this.$container.animate([
119
- {
120
- opacity: 1
121
- },
122
- {
123
- opacity: 0
124
- }
125
- ], {
136
+ const containerEffects = this.$container.animate([{ opacity: 1 }, { opacity: 0 }], {
126
137
  duration: this._config.closeDur - this._config.bodyFadeOutDur,
127
138
  delay: this._config.bodyFadeOutDur,
128
139
  easing: 'linear',
129
- fill: 'forwards'
140
+ fill: 'forwards',
130
141
  });
131
- const scrim = this.$scrim.animate([
132
- {
133
- opacity: 0.32
134
- },
135
- {
136
- opacity: 0
137
- }
138
- ], {
142
+ const scrim = this.$scrim.animate([{ opacity: 0.32 }, { opacity: 0 }], {
139
143
  duration: this._config.closeDur,
140
144
  easing: this._config.closeEase,
141
- fill: 'forwards'
145
+ fill: 'forwards',
142
146
  });
143
- const body = this.$body.animate([
144
- {
145
- opacity: 1
146
- },
147
- {
148
- opacity: 0
149
- }
150
- ], {
147
+ const body = this.$body.animate([{ opacity: 1 }, { opacity: 0 }], {
151
148
  duration: this._config.bodyFadeOutDur,
152
149
  easing: 'linear',
153
- fill: 'forwards'
150
+ fill: 'forwards',
154
151
  });
155
- const actions = this.$actions.animate([
156
- {
157
- opacity: 1
158
- },
159
- {
160
- opacity: 0
161
- }
162
- ], {
152
+ const actions = this.$actions.animate([{ opacity: 1 }, { opacity: 0 }], {
163
153
  duration: this._config.bodyFadeOutDur,
164
154
  easing: 'linear',
165
- fill: 'forwards'
155
+ fill: 'forwards',
166
156
  });
167
157
  this.#activeAnimations.push(containerSpatial, containerEffects, scrim, body, actions);
168
- containerSpatial.onfinish = ()=>{
158
+ containerSpatial.onfinish = () => {
169
159
  this.$container.style.minHeight = '';
170
160
  super.close();
171
161
  this.#clearAnimations();
172
162
  };
173
163
  }
174
- constructor(...args){
175
- super(...args), // Was based on https://m3.material.io/styles/motion/easing-and-duration/applying-easing-and-duration#e5b958f0-435d-4e84-aed4-8d1ea395fa5c
176
- // TODO: use curves and durations from motion physics
177
- this._config = {
178
- openEase: 'cubic-bezier(0, 0, 0, 1)',
179
- closeEase: 'cubic-bezier(0.3, 0, 1, 1)',
180
- vertSlide: 40,
181
- openDur: 500,
182
- closeDur: 200,
183
- bodyFadeInDur: 200,
184
- bodyFadeOutDur: 100
185
- }, this.hasIcon = false, this.#activeAnimations = [], this.#handleClick = (e)=>{
186
- const target = e.target;
187
- if (!this.$container.contains(target) && !this.contains(target)) this.close();
188
- }, this.#handleIconSlotChange = (e)=>{
189
- const slot = e.target;
190
- this.hasIcon = slot.assignedElements({
191
- flatten: true
192
- }).length > 0;
193
- }, this.#opening = false, this.#closing = false;
194
- }
195
- }
196
- _ts_decorate([
164
+ };
165
+ __decorate([
197
166
  state()
198
167
  ], M3Dialog.prototype, "hasIcon", void 0);
199
- _ts_decorate([
168
+ __decorate([
200
169
  query('[part=container]')
201
170
  ], M3Dialog.prototype, "$container", void 0);
202
- _ts_decorate([
171
+ __decorate([
203
172
  query('[part=body]')
204
173
  ], M3Dialog.prototype, "$body", void 0);
205
- _ts_decorate([
174
+ __decorate([
175
+ query('[name=icon]')
176
+ ], M3Dialog.prototype, "$icon", void 0);
177
+ __decorate([
206
178
  query('[part=actions]')
207
179
  ], M3Dialog.prototype, "$actions", void 0);
208
- _ts_decorate([
180
+ __decorate([
209
181
  query('.actions-placeholder')
210
182
  ], M3Dialog.prototype, "$actionsPlaceholder", void 0);
211
- _ts_decorate([
183
+ __decorate([
212
184
  query('[part=scrim]')
213
185
  ], M3Dialog.prototype, "$scrim", void 0);
214
- M3Dialog = _ts_decorate([
186
+ M3Dialog = __decorate([
215
187
  customElement('md-dialog')
216
188
  ], M3Dialog);
189
+ export { M3Dialog };
@@ -0,0 +1,13 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class M3Divider extends LitElement {
3
+ vertical: boolean;
4
+ inset: boolean;
5
+ insetStart: boolean;
6
+ insetEnd: boolean;
7
+ static styles: any[];
8
+ }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ 'md-divider': M3Divider;
12
+ }
13
+ }
@@ -1,43 +1,30 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { LitElement } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
4
  import { dividerStyles } from './divider-styles.css.js';
5
- export class M3Divider extends LitElement {
6
- static{
7
- this.styles = [
8
- dividerStyles
9
- ];
5
+ let M3Divider = class M3Divider extends LitElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.vertical = false;
9
+ this.inset = false;
10
+ this.insetStart = false;
11
+ this.insetEnd = false;
10
12
  }
11
- constructor(...args){
12
- super(...args), this.vertical = false, this.inset = false, this.insetStart = false, this.insetEnd = false;
13
- }
14
- }
15
- _ts_decorate([
16
- property({
17
- type: Boolean,
18
- reflect: false
19
- })
13
+ static { this.styles = [dividerStyles]; }
14
+ };
15
+ __decorate([
16
+ property({ type: Boolean, reflect: false })
20
17
  ], M3Divider.prototype, "vertical", void 0);
21
- _ts_decorate([
22
- property({
23
- type: Boolean,
24
- reflect: false
25
- })
18
+ __decorate([
19
+ property({ type: Boolean, reflect: false })
26
20
  ], M3Divider.prototype, "inset", void 0);
27
- _ts_decorate([
28
- property({
29
- type: Boolean,
30
- reflect: false,
31
- attribute: 'inset-start'
32
- })
21
+ __decorate([
22
+ property({ type: Boolean, reflect: false, attribute: 'inset-start' })
33
23
  ], M3Divider.prototype, "insetStart", void 0);
34
- _ts_decorate([
35
- property({
36
- type: Boolean,
37
- reflect: false,
38
- attribute: 'inset-end'
39
- })
24
+ __decorate([
25
+ property({ type: Boolean, reflect: false, attribute: 'inset-end' })
40
26
  ], M3Divider.prototype, "insetEnd", void 0);
41
- M3Divider = _ts_decorate([
27
+ M3Divider = __decorate([
42
28
  customElement('md-divider')
43
29
  ], M3Divider);
30
+ export { M3Divider };