@vollowx/seele 0.13.5 → 0.13.7

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 (145) 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 +57 -0
  5. package/src/base/autocomplete.js +80 -98
  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 +78 -0
  28. package/src/base/menu.js +137 -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/ensure-ready.d.ts +1 -0
  58. package/src/core/ensure-ready.js +15 -0
  59. package/src/core/focus-visible.d.ts +2 -0
  60. package/src/core/focus-visible.js +4 -4
  61. package/src/core/shared.d.ts +1 -0
  62. package/src/core/unique-id.d.ts +4 -0
  63. package/src/core/unique-id.js +2 -1
  64. package/src/m3/autocomplete/autocomplete.d.ts +9 -0
  65. package/src/m3/autocomplete/autocomplete.js +11 -10
  66. package/src/m3/badge/badge.d.ts +13 -0
  67. package/src/m3/badge/badge.js +28 -37
  68. package/src/m3/button/common-button-toggle.d.ts +31 -0
  69. package/src/m3/button/common-button-toggle.js +44 -41
  70. package/src/m3/button/common-button.d.ts +29 -0
  71. package/src/m3/button/common-button.js +40 -40
  72. package/src/m3/button/icon-button-toggle.d.ts +24 -0
  73. package/src/m3/button/icon-button-toggle.js +35 -32
  74. package/src/m3/button/icon-button.d.ts +23 -0
  75. package/src/m3/button/icon-button.js +33 -31
  76. package/src/m3/button-group/connected-button-group.d.ts +19 -0
  77. package/src/m3/button-group/connected-button-group.js +26 -24
  78. package/src/m3/button-group/standard-button-group.d.ts +24 -0
  79. package/src/m3/button-group/standard-button-group.js +71 -65
  80. package/src/m3/checkbox/checkbox.d.ts +25 -0
  81. package/src/m3/checkbox/checkbox.js +23 -22
  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 +24 -0
  99. package/src/m3/list/list-item.js +20 -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 +14 -0
  120. package/src/m3/select/select.js +17 -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/m3/dialog/dialog-spring.js +0 -179
  144. package/src/win98/button/radio.js +0 -8
  145. package/src/win98/radio/radio.js +0 -8
@@ -1,9 +1,9 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { LitElement } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
4
  import { customElement } from '../../core/decorators.js';
5
5
  import { Attachable } from '../../base/mixins/attachable.js';
6
- import { InternalsAttached, internals } from '../../base/mixins/internals-attached.js';
6
+ import { InternalsAttached, internals, } from '../../base/mixins/internals-attached.js';
7
7
  import { rippleStyles } from './ripple-styles.css.js';
8
8
  const PRESS_GROW_MS = 450;
9
9
  const MINIMUM_PRESS_MS = 225;
@@ -12,42 +12,65 @@ const OPACITY_OUT_MS = 375;
12
12
  function distance({ x: ax, y: ay }, { x: bx, y: by }) {
13
13
  return Math.sqrt((ax - bx) ** 2 + (ay - by) ** 2);
14
14
  }
15
- export class M3Ripple extends Attachable(InternalsAttached(LitElement)) {
16
- static{
17
- this.styles = [
18
- rippleStyles
19
- ];
20
- }
21
- constructor(){
22
- super(), this.clickBehavior = 'always', this.enterBehavior = 'always', this.spaceBehavior = 'once', this.$ripples = [], this.#spaceKeyDown = false, this.#pointerDown = false, this.#lastTime = 0, this.handleKeyDown = (e)=>{
23
- if (e.key === 'Enter' && this.enterBehavior === 'always' || e.key === ' ' && this.spaceBehavior === 'always') {
15
+ /**
16
+ * @tag md-ripple
17
+ *
18
+ * @cssprop --md-ripple-color
19
+ */
20
+ let M3Ripple = class M3Ripple extends Attachable(InternalsAttached(LitElement)) {
21
+ static { this.styles = [rippleStyles]; }
22
+ constructor() {
23
+ super();
24
+ this.clickBehavior = 'always';
25
+ this.enterBehavior = 'always';
26
+ this.spaceBehavior = 'once';
27
+ this.$ripples = [];
28
+ this.#spaceKeyDown = false;
29
+ this.#pointerDown = false;
30
+ this.#lastTime = 0;
31
+ this.handleKeyDown = (e) => {
32
+ if ((e.key === 'Enter' && this.enterBehavior === 'always') ||
33
+ (e.key === ' ' && this.spaceBehavior === 'always')) {
24
34
  this.addRipple();
25
35
  this.removeRippleAll();
26
- } else if (e.key === ' ' && this.spaceBehavior === 'once') {
27
- if (!this.#spaceKeyDown) this.addRipple();
36
+ }
37
+ else if (e.key === ' ' && this.spaceBehavior === 'once') {
38
+ if (!this.#spaceKeyDown)
39
+ this.addRipple();
28
40
  this.#spaceKeyDown = true;
29
41
  }
30
- }, this.handleKeyUp = (e)=>{
42
+ };
43
+ this.handleKeyUp = (e) => {
31
44
  if (e.key === ' ' && this.spaceBehavior === 'once') {
32
45
  this.#spaceKeyDown = false;
33
46
  this.removeRippleAll();
34
47
  }
35
- }, this.handlePointerEnter = (e)=>{
36
- if (e.pointerType === 'touch') return;
48
+ };
49
+ this.handlePointerEnter = (e) => {
50
+ if (e.pointerType === 'touch')
51
+ return;
37
52
  this[internals].states.add('hover');
38
- if (this.#pointerDown && this.clickBehavior === 'always') this.addRipple(e);
39
- }, this.handlePointerLeave = ()=>{
53
+ if (this.#pointerDown && this.clickBehavior === 'always')
54
+ this.addRipple(e);
55
+ };
56
+ this.handlePointerLeave = () => {
40
57
  this[internals].states.delete('hover');
41
- if (this.#pointerDown && this.clickBehavior === 'always') this.removeRippleAll();
42
- }, this.handlePointerDown = (e)=>{
43
- if (e.pointerType === 'mouse') this.#pointerDown = true;
58
+ if (this.#pointerDown && this.clickBehavior === 'always')
59
+ this.removeRippleAll();
60
+ };
61
+ this.handlePointerDown = (e) => {
62
+ if (e.pointerType === 'mouse')
63
+ this.#pointerDown = true;
44
64
  document.addEventListener('pointerup', this.handlePointerUp);
45
65
  document.addEventListener('touchcancel', this.handlePointerUp);
46
66
  document.addEventListener('touchend', this.handlePointerUp);
47
67
  document.addEventListener('touchmove', this.handlePointerUp);
48
- if (e.button === 2) return;
49
- if (this.clickBehavior === 'always') this.addRipple(e);
50
- }, this.handlePointerUp = ()=>{
68
+ if (e.button === 2)
69
+ return;
70
+ if (this.clickBehavior === 'always')
71
+ this.addRipple(e);
72
+ };
73
+ this.handlePointerUp = () => {
51
74
  this.#pointerDown = false;
52
75
  document.removeEventListener('pointerup', this.handlePointerUp);
53
76
  document.removeEventListener('touchcancel', this.handlePointerUp);
@@ -66,22 +89,24 @@ export class M3Ripple extends Attachable(InternalsAttached(LitElement)) {
66
89
  keyup: this.handleKeyUp,
67
90
  pointerenter: this.handlePointerEnter,
68
91
  pointerleave: this.handlePointerLeave,
69
- pointerdown: this.handlePointerDown
92
+ pointerdown: this.handlePointerDown,
70
93
  };
71
- Object.keys(eventHandlers).forEach((eventName)=>{
94
+ Object.keys(eventHandlers).forEach((eventName) => {
72
95
  // @ts-ignore
73
- prev?.labels?.forEach((label)=>label.removeEventListener(eventName, eventHandlers[eventName]));
96
+ prev?.labels?.forEach((label) => label.removeEventListener(eventName, eventHandlers[eventName]));
74
97
  prev?.removeEventListener(eventName, eventHandlers[eventName]);
75
98
  // Check if control is nested in label, if so, only bind to label
76
99
  let isNestedInLabel = false;
77
100
  // @ts-ignore
78
- next?.labels?.forEach((label)=>{
79
- if (label.contains(next)) isNestedInLabel = true;
101
+ next?.labels?.forEach((label) => {
102
+ if (label.contains(next))
103
+ isNestedInLabel = true;
80
104
  });
81
105
  if (isNestedInLabel) {
82
106
  // @ts-ignore
83
- next.labels?.forEach((label)=>label.addEventListener(eventName, eventHandlers[eventName]));
84
- } else {
107
+ next.labels?.forEach((label) => label.addEventListener(eventName, eventHandlers[eventName]));
108
+ }
109
+ else {
85
110
  next?.addEventListener(eventName, eventHandlers[eventName]);
86
111
  }
87
112
  });
@@ -90,7 +115,7 @@ export class M3Ripple extends Attachable(InternalsAttached(LitElement)) {
90
115
  const containerRect = this.getBoundingClientRect();
91
116
  const containerMiddle = {
92
117
  x: containerRect.width / 2,
93
- y: containerRect.height / 2
118
+ y: containerRect.height / 2,
94
119
  };
95
120
  const centered = !e;
96
121
  const endCenter = containerMiddle;
@@ -100,29 +125,13 @@ export class M3Ripple extends Attachable(InternalsAttached(LitElement)) {
100
125
  startCenter.y = e.clientY - containerRect.top;
101
126
  }
102
127
  const corners = [
103
- {
104
- x: 0,
105
- y: 0
106
- },
107
- {
108
- x: containerRect.width,
109
- y: 0
110
- },
111
- {
112
- x: 0,
113
- y: containerRect.height
114
- },
115
- {
116
- x: containerRect.width,
117
- y: containerRect.height
118
- }
128
+ { x: 0, y: 0 },
129
+ { x: containerRect.width, y: 0 },
130
+ { x: 0, y: containerRect.height },
131
+ { x: containerRect.width, y: containerRect.height },
119
132
  ];
120
- const radius = Math.max(...corners.map((corner)=>distance(endCenter, corner)));
121
- return {
122
- startCenter,
123
- endCenter,
124
- radius
125
- };
133
+ const radius = Math.max(...corners.map((corner) => distance(endCenter, corner)));
134
+ return { startCenter, endCenter, radius };
126
135
  }
127
136
  addRipple(e = null) {
128
137
  const { startCenter, endCenter, radius } = this.calculateRipple(e);
@@ -134,68 +143,52 @@ export class M3Ripple extends Attachable(InternalsAttached(LitElement)) {
134
143
  this.renderRoot.append(ripple);
135
144
  this.$ripples.push(ripple);
136
145
  ripple.animate({
137
- opacity: [
138
- 0,
139
- 0.1
140
- ]
146
+ opacity: [0, 0.1],
141
147
  }, {
142
148
  duration: OPACITY_IN_MS,
143
149
  easing: 'linear',
144
- fill: 'forwards'
150
+ fill: 'forwards',
145
151
  });
146
152
  ripple.animate({
147
- height: [
148
- diameter,
149
- diameter
150
- ],
151
- width: [
152
- diameter,
153
- diameter
154
- ],
155
- translate: [
156
- translateStart,
157
- translateEnd
158
- ],
159
- scale: [
160
- 0.2,
161
- 1.35
162
- ]
153
+ height: [diameter, diameter],
154
+ width: [diameter, diameter],
155
+ translate: [translateStart, translateEnd],
156
+ scale: [0.2, 1.35],
163
157
  }, {
164
158
  duration: PRESS_GROW_MS,
165
159
  // TODO: Control by global variables
166
160
  easing: 'cubic-bezier(0.2, 0, 0, 1)',
167
- fill: 'forwards'
161
+ fill: 'forwards',
168
162
  });
169
163
  this.#lastTime = Date.now();
170
164
  }
171
165
  removeRipple(ripple) {
172
- setTimeout(()=>{
166
+ setTimeout(() => {
173
167
  const animation = ripple.animate({
174
- opacity: [
175
- getComputedStyle(ripple).opacity,
176
- '0'
177
- ]
168
+ opacity: [getComputedStyle(ripple).opacity, '0'],
178
169
  }, {
179
170
  duration: OPACITY_OUT_MS,
180
171
  fill: 'forwards',
181
- easing: 'linear'
172
+ easing: 'linear',
182
173
  });
183
- animation.onfinish = animation.oncancel = ()=>ripple.remove();
174
+ animation.onfinish = animation.oncancel = () => ripple.remove();
184
175
  }, Math.max(MINIMUM_PRESS_MS - (Date.now() - this.#lastTime), 0));
185
176
  }
186
177
  removeRippleAll() {
187
- for (const ripple of this.$ripples.splice(0))this.removeRipple(ripple);
178
+ for (const ripple of this.$ripples.splice(0))
179
+ this.removeRipple(ripple);
188
180
  }
189
- }
190
- _ts_decorate([
181
+ };
182
+ __decorate([
191
183
  property()
192
184
  ], M3Ripple.prototype, "clickBehavior", void 0);
193
- _ts_decorate([
185
+ __decorate([
194
186
  property()
195
187
  ], M3Ripple.prototype, "enterBehavior", void 0);
196
- _ts_decorate([
188
+ __decorate([
197
189
  property()
198
190
  ], M3Ripple.prototype, "spaceBehavior", void 0);
199
- M3Ripple = _ts_decorate([
191
+ M3Ripple = __decorate([
200
192
  customElement('md-ripple', false)
201
193
  ], M3Ripple);
194
+ export { M3Ripple };
@@ -0,0 +1,16 @@
1
+ import { M3Select } from './select.js';
2
+ import '../field/filled-field.js';
3
+ /**
4
+ * @tag md-filled-select
5
+ *
6
+ * @slot - options
7
+ */
8
+ export declare class MdFilledSelect extends M3Select {
9
+ static styles: any[];
10
+ protected renderField(): import("lit-html").TemplateResult<1>;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ 'md-filled-select': MdFilledSelect;
15
+ }
16
+ }
@@ -1,19 +1,21 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { M3Select } from './select.js';
5
5
  import '../field/filled-field.js';
6
6
  import { selectStyles } from './select-styles.css.js';
7
- export class MdFilledSelect extends M3Select {
8
- static{
9
- this.styles = [
10
- selectStyles
11
- ];
12
- }
7
+ /**
8
+ * @tag md-filled-select
9
+ *
10
+ * @slot - options
11
+ */
12
+ let MdFilledSelect = class MdFilledSelect extends M3Select {
13
+ static { this.styles = [selectStyles]; }
13
14
  renderField() {
14
- return html`<md-filled-field id="field" part="field" .label="${this.label}" .populated="${!!this.value}" .disabled="${this.disabled}" .required="${this.required}" .error="${this.error}" .focused="${this.open || this.focused}" supportingtext="${this.supportingText}" @click="${this.toggle}" @keydown="${this._handleFieldKeydown}" @focus="${()=>this.focused = true}" @blur="${()=>this.focused = false}" tabindex="${this.disabled ? '-1' : '0'}" role="combobox" aria-haspopup="listbox" aria-expanded="${this.open}" aria-controls="menu" aria-disabled="${this.disabled}" aria-required="${this.required}">${this.renderFieldContent()}</md-filled-field>`;
15
+ return html `<md-filled-field id="field" part="field" .label="${this.label}" .populated="${!!this.value}" .disabled="${this.disabled}" .required="${this.required}" .error="${this.error}" .focused="${this.open || this.focused}" supportingtext="${this.supportingText}" @click="${this.toggle}" @keydown="${this._handleFieldKeydown}" @focus="${() => (this.focused = true)}" @blur="${() => (this.focused = false)}" tabindex="${this.disabled ? '-1' : '0'}" role="combobox" aria-haspopup="listbox" aria-expanded="${this.open}" aria-controls="menu" aria-disabled="${this.disabled}" aria-required="${this.required}">${this.renderFieldContent()}</md-filled-field>`;
15
16
  }
16
- }
17
- MdFilledSelect = _ts_decorate([
17
+ };
18
+ MdFilledSelect = __decorate([
18
19
  customElement('md-filled-select')
19
20
  ], MdFilledSelect);
21
+ export { MdFilledSelect };
@@ -0,0 +1,15 @@
1
+ import { M3ListItem } from '../list/list-item.js';
2
+ declare const M3Option_base: Constructor<import("../../base/option.js").OptionInterface> & typeof M3ListItem;
3
+ /**
4
+ * @tag md-option
5
+ *
6
+ * @slot - contents in md-menu-item
7
+ */
8
+ export declare class M3Option extends M3Option_base {
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'md-option': M3Option;
13
+ }
14
+ }
15
+ export {};
@@ -1,9 +1,15 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { customElement } from 'lit/decorators.js';
3
3
  import { OptionMixin } from '../../base/option.js';
4
4
  import { M3ListItem } from '../list/list-item.js';
5
- export class M3Option extends OptionMixin(M3ListItem) {
6
- }
7
- M3Option = _ts_decorate([
5
+ /**
6
+ * @tag md-option
7
+ *
8
+ * @slot - contents in md-menu-item
9
+ */
10
+ let M3Option = class M3Option extends OptionMixin(M3ListItem) {
11
+ };
12
+ M3Option = __decorate([
8
13
  customElement('md-option')
9
14
  ], M3Option);
15
+ export { M3Option };
@@ -0,0 +1,16 @@
1
+ import { M3Select } from './select.js';
2
+ import '../field/outlined-field.js';
3
+ /**
4
+ * @tag md-outlined-select
5
+ *
6
+ * @slot - options
7
+ */
8
+ export declare class MdOutlinedSelect extends M3Select {
9
+ static styles: any[];
10
+ protected renderField(): import("lit-html").TemplateResult<1>;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ 'md-outlined-select': MdOutlinedSelect;
15
+ }
16
+ }
@@ -1,19 +1,21 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { html } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { M3Select } from './select.js';
5
5
  import '../field/outlined-field.js';
6
6
  import { selectStyles } from './select-styles.css.js';
7
- export class MdOutlinedSelect extends M3Select {
8
- static{
9
- this.styles = [
10
- selectStyles
11
- ];
12
- }
7
+ /**
8
+ * @tag md-outlined-select
9
+ *
10
+ * @slot - options
11
+ */
12
+ let MdOutlinedSelect = class MdOutlinedSelect extends M3Select {
13
+ static { this.styles = [selectStyles]; }
13
14
  renderField() {
14
- return html`<md-outlined-field id="field" part="field" .label="${this.label}" .populated="${!!this.value}" .disabled="${this.disabled}" .required="${this.required}" .error="${this.error}" .focused="${this.open || this.focused}" supportingtext="${this.supportingText}" @click="${this.toggle}" @keydown="${this._handleFieldKeydown}" @focus="${()=>this.focused = true}" @blur="${()=>this.focused = false}" tabindex="${this.disabled ? '-1' : '0'}" role="combobox" aria-haspopup="listbox" aria-expanded="${this.open}" aria-controls="menu" aria-disabled="${this.disabled}" aria-required="${this.required}">${this.renderFieldContent()}</md-outlined-field>`;
15
+ return html `<md-outlined-field id="field" part="field" .label="${this.label}" .populated="${!!this.value}" .disabled="${this.disabled}" .required="${this.required}" .error="${this.error}" .focused="${this.open || this.focused}" supportingtext="${this.supportingText}" @click="${this.toggle}" @keydown="${this._handleFieldKeydown}" @focus="${() => (this.focused = true)}" @blur="${() => (this.focused = false)}" tabindex="${this.disabled ? '-1' : '0'}" role="combobox" aria-haspopup="listbox" aria-expanded="${this.open}" aria-controls="menu" aria-disabled="${this.disabled}" aria-required="${this.required}">${this.renderFieldContent()}</md-outlined-field>`;
15
16
  }
16
- }
17
- MdOutlinedSelect = _ts_decorate([
17
+ };
18
+ MdOutlinedSelect = __decorate([
18
19
  customElement('md-outlined-select')
19
20
  ], MdOutlinedSelect);
21
+ export { MdOutlinedSelect };
@@ -0,0 +1,14 @@
1
+ import '../menu/menu.js';
2
+ import { Select } from '../../base/select.js';
3
+ import { M3Field } from '../field/field.js';
4
+ /**
5
+ * @fires {Event} change - Fired when the selected value has changed.
6
+ * @fires {Event} input - Fired when the selected value has changed.
7
+ */
8
+ export declare abstract class M3Select extends Select {
9
+ label: string;
10
+ supportingText: string;
11
+ protected focused: boolean;
12
+ protected field: M3Field;
13
+ protected renderMenu(): import("lit-html").TemplateResult<1>;
14
+ }
@@ -1,31 +1,32 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { html } from 'lit';
3
3
  import { property, query, state } from 'lit/decorators.js';
4
+ import '../menu/menu.js';
4
5
  import { Select } from '../../base/select.js';
5
6
  /**
6
7
  * @fires {Event} change - Fired when the selected value has changed.
7
8
  * @fires {Event} input - Fired when the selected value has changed.
8
- */ export class M3Select extends Select {
9
- renderMenu() {
10
- return html`<md-menu part="menu" id="menu" for="field" type="listbox" data-tabindex="-1" ?quick="${this.quick}" offset="${this.offset}" align="${this.align}" align-strategy="${this.alignStrategy}" keep-open-blur no-focus-control ?open="${this.open}" @open="${()=>this.open = true}" @close="${()=>this.open = false}" @item-focus="${this._handleMenuItemFocus}" @select="${this._handleMenuSelect}"><slot part="items" @slotchange="${this._handleSlotChange}"></slot></md-menu>`;
9
+ */
10
+ export class M3Select extends Select {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.label = '';
14
+ this.supportingText = '';
15
+ this.focused = false;
11
16
  }
12
- constructor(...args){
13
- super(...args), this.label = '', this.supportingText = '', this.focused = false;
17
+ renderMenu() {
18
+ return html `<md-menu part="menu" id="menu" for="field" type="listbox" data-tabindex="-1" ?quick="${this.quick}" offset="${this.offset}" align="${this.align}" align-strategy="${this.alignStrategy}" keep-open-blur no-focus-control ?open="${this.open}" @open="${() => (this.open = true)}" @close="${() => (this.open = false)}" @item-focus="${this._handleMenuItemFocus}" @select="${this._handleMenuSelect}"><slot part="items" @slotchange="${this._handleSlotChange}"></slot></md-menu>`;
14
19
  }
15
20
  }
16
- _ts_decorate([
17
- property({
18
- type: String
19
- })
21
+ __decorate([
22
+ property({ type: String })
20
23
  ], M3Select.prototype, "label", void 0);
21
- _ts_decorate([
22
- property({
23
- type: String
24
- })
24
+ __decorate([
25
+ property({ type: String })
25
26
  ], M3Select.prototype, "supportingText", void 0);
26
- _ts_decorate([
27
+ __decorate([
27
28
  state()
28
29
  ], M3Select.prototype, "focused", void 0);
29
- _ts_decorate([
30
+ __decorate([
30
31
  query('md-filled-field, md-outlined-field')
31
32
  ], M3Select.prototype, "field", void 0);
@@ -0,0 +1,20 @@
1
+ import { Slider } from '../../base/slider.js';
2
+ import '../focus-ring/focus-ring.js';
3
+ /**
4
+ * TODO: Add size variants
5
+ * TODO: Add orientation: vertical
6
+ *
7
+ * @tag md-slider
8
+ */
9
+ export declare class M3Slider extends Slider {
10
+ static styles: any[];
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ private renderTrack;
13
+ private renderLabel;
14
+ private renderHandle;
15
+ }
16
+ declare global {
17
+ interface HTMLElementTagNameMap {
18
+ 'md-slider': M3Slider;
19
+ }
20
+ }
@@ -1,4 +1,4 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { html, nothing } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { classMap } from 'lit/directives/class-map.js';
@@ -7,70 +7,76 @@ import { when } from 'lit/directives/when.js';
7
7
  import { Slider } from '../../base/slider.js';
8
8
  import '../focus-ring/focus-ring.js';
9
9
  import { sliderStyles } from './slider-styles.css.js';
10
- export class M3Slider extends Slider {
11
- static{
12
- this.styles = [
13
- sliderStyles
14
- ];
15
- }
10
+ /**
11
+ * TODO: Add size variants
12
+ * TODO: Add orientation: vertical
13
+ *
14
+ * @tag md-slider
15
+ */
16
+ let M3Slider = class M3Slider extends Slider {
17
+ static { this.styles = [sliderStyles]; }
16
18
  render() {
17
19
  const step = this.step === 0 ? 1 : this.step;
18
20
  const range = Math.max(this.max - this.min, step);
19
- const startFraction = this.range ? ((this.renderValueStart ?? this.min) - this.min) / range : 0;
21
+ const startFraction = this.range
22
+ ? ((this.renderValueStart ?? this.min) - this.min) / range
23
+ : 0;
20
24
  const endFraction = ((this.renderValueEnd ?? this.min) - this.min) / range;
21
25
  const containerStyles = {
22
26
  '--_start': String(startFraction),
23
27
  '--_end': String(endFraction),
24
- '--_ticks': String(range / step)
25
- };
26
- const containerClasses = {
27
- ranged: this.range
28
+ '--_ticks': String(range / step),
28
29
  };
30
+ const containerClasses = { ranged: this.range };
29
31
  const labelStart = this.valueLabelStart || String(this.renderValueStart);
30
- const labelEnd = (this.range ? this.valueLabelEnd : this.valueLabel) || String(this.renderValueEnd);
32
+ const labelEnd = (this.range ? this.valueLabelEnd : this.valueLabel) ||
33
+ String(this.renderValueEnd);
31
34
  const inputStartProps = {
32
35
  start: true,
33
36
  value: this.renderValueStart,
34
37
  ariaLabel: this.renderAriaLabelStart,
35
38
  ariaValueText: this.renderAriaValueTextStart,
36
39
  ariaMin: this.min,
37
- ariaMax: this.valueEnd ?? this.max
40
+ ariaMax: this.valueEnd ?? this.max,
38
41
  };
39
42
  const inputEndProps = {
40
43
  start: false,
41
44
  value: this.renderValueEnd,
42
45
  ariaLabel: this.renderAriaLabelEnd,
43
46
  ariaValueText: this.renderAriaValueTextEnd,
44
- ariaMin: this.range ? this.valueStart ?? this.min : this.min,
45
- ariaMax: this.max
47
+ ariaMin: this.range ? (this.valueStart ?? this.min) : this.min,
48
+ ariaMax: this.max,
46
49
  };
47
50
  const handleStartProps = {
48
51
  start: true,
49
- label: labelStart
52
+ label: labelStart,
50
53
  };
51
54
  const handleEndProps = {
52
55
  start: false,
53
- label: labelEnd
56
+ label: labelEnd,
54
57
  };
55
- return html`<div class="container ${classMap(containerClasses)}" style="${styleMap(containerStyles)}">${when(this.range, ()=>this.renderInput(inputStartProps))} ${this.renderInput(inputEndProps)} ${this.renderTrack()}<div class="handles-padded"><div class="handles">${when(this.range, ()=>this.renderHandle(handleStartProps))} ${this.renderHandle(handleEndProps)}</div></div></div>`;
58
+ return html `<div class="container ${classMap(containerClasses)}" style="${styleMap(containerStyles)}">${when(this.range, () => this.renderInput(inputStartProps))} ${this.renderInput(inputEndProps)} ${this.renderTrack()}<div class="handles-padded"><div class="handles">${when(this.range, () => this.renderHandle(handleStartProps))} ${this.renderHandle(handleEndProps)}</div></div></div>`;
56
59
  }
57
60
  renderTrack() {
58
- return html`<div class="track"><div class="inactive-before"></div><div class="active"></div><div class="inactive-after"></div></div>${this.ticks ? html`<div class="tickmarks"><div class="inactive-before"></div><div class="active"></div><div class="inactive-after"></div></div>` : nothing}`;
61
+ return html `<div class="track"><div class="inactive-before"></div><div class="active"></div><div class="inactive-after"></div></div>${this.ticks
62
+ ? html `<div class="tickmarks"><div class="inactive-before"></div><div class="active"></div><div class="inactive-after"></div></div>`
63
+ : nothing}`;
59
64
  }
60
65
  renderLabel(value) {
61
- return html`<div class="label" aria-hidden="true"><span part="label">${value}</span></div>`;
66
+ return html `<div class="label" aria-hidden="true"><span part="label">${value}</span></div>`;
62
67
  }
63
68
  renderHandle({ start, label }) {
64
69
  const onTop = !this.disabled && start === this.startOnTop;
65
70
  const isOverlapping = !this.disabled && this.handlesOverlapping;
66
71
  const name = start ? 'start' : 'end';
67
- return html`<div class="handle ${classMap({
72
+ return html `<div class="handle ${classMap({
68
73
  [name]: true,
69
74
  onTop,
70
- isOverlapping
71
- })}"><md-focus-ring part="focus-ring" for="${name}"></md-focus-ring><div class="nub"></div>${when(this.labeled, ()=>this.renderLabel(label))}</div>`;
75
+ isOverlapping,
76
+ })}"><md-focus-ring part="focus-ring" for="${name}"></md-focus-ring><div class="nub"></div>${when(this.labeled, () => this.renderLabel(label))}</div>`;
72
77
  }
73
- }
74
- M3Slider = _ts_decorate([
78
+ };
79
+ M3Slider = __decorate([
75
80
  customElement('md-slider')
76
81
  ], M3Slider);
82
+ export { M3Slider };
@@ -0,0 +1,27 @@
1
+ import { ToggleButton } from '../../base/toggle-button.js';
2
+ import '../focus-ring/focus-ring.js';
3
+ import { M3Ripple } from '../ripple/ripple.js';
4
+ /**
5
+ * @tag md-switch
6
+ *
7
+ * @csspart thumb
8
+ * @csspart label
9
+ */
10
+ export declare class M3Switch extends ToggleButton {
11
+ #private;
12
+ $ripple: M3Ripple;
13
+ $thumb: HTMLSpanElement;
14
+ static styles: any[];
15
+ render(): import("lit-html").TemplateResult<1>;
16
+ renderOnIcon(): import("lit-html").TemplateResult<1>;
17
+ renderOffIcon(): import("lit-html").TemplateResult<1>;
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ icons: boolean;
21
+ checkedIconOnly: boolean;
22
+ }
23
+ declare global {
24
+ interface HTMLElementTagNameMap {
25
+ 'md-switch': M3Switch;
26
+ }
27
+ }