@vollowx/seele 0.13.4 → 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 (147) 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/all.js +1 -0
  5. package/src/base/autocomplete.d.ts +56 -0
  6. package/src/base/autocomplete.js +82 -87
  7. package/src/base/button.d.ts +13 -0
  8. package/src/base/button.js +26 -22
  9. package/src/base/checkbox.d.ts +18 -0
  10. package/src/base/checkbox.js +39 -34
  11. package/src/base/controllers/list-controller.d.ts +37 -0
  12. package/src/base/controllers/list-controller.js +23 -15
  13. package/src/base/controllers/popover-controller.d.ts +35 -0
  14. package/src/base/controllers/popover-controller.js +37 -29
  15. package/src/base/dialog.d.ts +20 -0
  16. package/src/base/dialog.js +11 -9
  17. package/src/base/field.d.ts +3 -0
  18. package/src/base/input.d.ts +44 -0
  19. package/src/base/input.js +57 -65
  20. package/src/base/item.d.ts +7 -0
  21. package/src/base/item.js +2 -1
  22. package/src/base/list-item.d.ts +15 -0
  23. package/src/base/list-item.js +22 -22
  24. package/src/base/list.d.ts +54 -0
  25. package/src/base/list.js +69 -55
  26. package/src/base/menu-item.d.ts +6 -0
  27. package/src/base/menu-item.js +4 -3
  28. package/src/base/menu.d.ts +76 -0
  29. package/src/base/menu.js +135 -143
  30. package/src/base/mixins/attachable.d.ts +9 -0
  31. package/src/base/mixins/attachable.js +22 -18
  32. package/src/base/mixins/focus-delegated.d.ts +5 -0
  33. package/src/base/mixins/focus-delegated.js +6 -8
  34. package/src/base/mixins/form-associated.d.ts +15 -0
  35. package/src/base/mixins/form-associated.js +11 -18
  36. package/src/base/mixins/internals-attached.d.ts +6 -0
  37. package/src/base/mixins/internals-attached.js +1 -1
  38. package/src/base/option.d.ts +9 -0
  39. package/src/base/option.js +7 -8
  40. package/src/base/radio.d.ts +13 -0
  41. package/src/base/radio.js +169 -0
  42. package/src/base/select.d.ts +116 -0
  43. package/src/base/select.js +130 -128
  44. package/src/base/slider.d.ts +75 -0
  45. package/src/base/slider.js +115 -118
  46. package/src/base/tab-panel.d.ts +9 -0
  47. package/src/base/tab-panel.js +11 -11
  48. package/src/base/tab.d.ts +18 -0
  49. package/src/base/tab.js +25 -24
  50. package/src/base/tabs.d.ts +19 -0
  51. package/src/base/tabs.js +84 -81
  52. package/src/base/toggle-button.d.ts +47 -0
  53. package/src/base/toggle-button.js +57 -53
  54. package/src/base/tooltip.d.ts +37 -0
  55. package/src/base/tooltip.js +70 -65
  56. package/src/core/decorators.d.ts +2 -0
  57. package/src/core/decorators.js +5 -4
  58. package/src/core/focus-visible.d.ts +2 -0
  59. package/src/core/focus-visible.js +4 -4
  60. package/src/core/shared.d.ts +1 -0
  61. package/src/core/unique-id.d.ts +4 -0
  62. package/src/core/unique-id.js +2 -1
  63. package/src/m3/autocomplete/autocomplete.d.ts +8 -0
  64. package/src/m3/autocomplete/autocomplete.js +10 -10
  65. package/src/m3/badge/badge.d.ts +12 -0
  66. package/src/m3/badge/badge.js +24 -37
  67. package/src/m3/button/common-button-toggle.d.ts +31 -0
  68. package/src/m3/button/common-button-toggle.js +44 -41
  69. package/src/m3/button/common-button.d.ts +29 -0
  70. package/src/m3/button/common-button.js +40 -40
  71. package/src/m3/button/icon-button-toggle.d.ts +24 -0
  72. package/src/m3/button/icon-button-toggle.js +35 -32
  73. package/src/m3/button/icon-button.d.ts +23 -0
  74. package/src/m3/button/icon-button.js +33 -31
  75. package/src/m3/button-group/connected-button-group.d.ts +19 -0
  76. package/src/m3/button-group/connected-button-group.js +30 -28
  77. package/src/m3/button-group/standard-button-group.d.ts +24 -0
  78. package/src/m3/button-group/standard-button-group.js +72 -66
  79. package/src/m3/checkbox/checkbox.d.ts +25 -0
  80. package/src/m3/checkbox/checkbox.js +24 -22
  81. package/src/m3/dialog/dialog-spring.d.ts +45 -0
  82. package/src/m3/dialog/dialog-spring.js +83 -86
  83. package/src/m3/dialog/dialog.d.ts +46 -0
  84. package/src/m3/dialog/dialog.js +90 -117
  85. package/src/m3/divider/divider.d.ts +13 -0
  86. package/src/m3/divider/divider.js +20 -33
  87. package/src/m3/fab/fab.d.ts +23 -0
  88. package/src/m3/fab/fab.js +24 -23
  89. package/src/m3/field/field.d.ts +28 -0
  90. package/src/m3/field/field.js +40 -55
  91. package/src/m3/field/filled-field.d.ts +11 -0
  92. package/src/m3/field/filled-field.js +7 -11
  93. package/src/m3/field/outlined-field.d.ts +11 -0
  94. package/src/m3/field/outlined-field.js +8 -12
  95. package/src/m3/focus-ring/focus-ring.d.ts +32 -0
  96. package/src/m3/focus-ring/focus-ring.js +38 -23
  97. package/src/m3/item/item.d.ts +31 -0
  98. package/src/m3/item/item.js +32 -17
  99. package/src/m3/list/list-item.d.ts +22 -0
  100. package/src/m3/list/list-item.js +18 -16
  101. package/src/m3/list/list.d.ts +15 -0
  102. package/src/m3/list/list.js +16 -15
  103. package/src/m3/loading-indicator/loading-indicator.d.ts +26 -0
  104. package/src/m3/loading-indicator/loading-indicator.js +113 -161
  105. package/src/m3/menu/menu-item.d.ts +15 -0
  106. package/src/m3/menu/menu-item.js +10 -4
  107. package/src/m3/menu/menu.d.ts +22 -0
  108. package/src/m3/menu/menu.js +20 -18
  109. package/src/m3/radio/radio-styles.css.js +2 -0
  110. package/src/m3/radio/radio.d.ts +17 -0
  111. package/src/m3/radio/radio.js +33 -0
  112. package/src/m3/ripple/ripple.d.ts +43 -0
  113. package/src/m3/ripple/ripple.js +82 -89
  114. package/src/m3/select/filled-select.d.ts +16 -0
  115. package/src/m3/select/filled-select.js +12 -10
  116. package/src/m3/select/option.d.ts +15 -0
  117. package/src/m3/select/option.js +10 -4
  118. package/src/m3/select/outlined-select.d.ts +16 -0
  119. package/src/m3/select/outlined-select.js +12 -10
  120. package/src/m3/select/select.d.ts +13 -0
  121. package/src/m3/select/select.js +16 -16
  122. package/src/m3/slider/slider.d.ts +20 -0
  123. package/src/m3/slider/slider.js +32 -26
  124. package/src/m3/switch/switch.d.ts +27 -0
  125. package/src/m3/switch/switch.js +62 -53
  126. package/src/m3/system/motion.d.ts +12 -0
  127. package/src/m3/system/motion.js +16 -9
  128. package/src/m3/tab/tab-panel.d.ts +9 -0
  129. package/src/m3/tab/tab-panel.js +6 -9
  130. package/src/m3/tab/tab.d.ts +19 -0
  131. package/src/m3/tab/tab.js +14 -12
  132. package/src/m3/tab/tabs.d.ts +25 -0
  133. package/src/m3/tab/tabs.js +34 -30
  134. package/src/m3/text-field/filled-text-field.d.ts +13 -0
  135. package/src/m3/text-field/filled-text-field.js +15 -20
  136. package/src/m3/text-field/outlined-text-field.d.ts +13 -0
  137. package/src/m3/text-field/outlined-text-field.js +15 -20
  138. package/src/m3/toolbar/toolbar.d.ts +26 -0
  139. package/src/m3/toolbar/toolbar.js +28 -25
  140. package/src/m3/tooltip/tooltip.d.ts +19 -0
  141. package/src/m3/tooltip/tooltip.js +15 -14
  142. package/src/win98/button/button.d.ts +13 -0
  143. package/src/win98/button/button.js +13 -11
  144. package/src/win98/button/radio.d.ts +3 -0
  145. package/src/win98/button/radio.js +9 -0
  146. package/src/win98/radio/radio.d.ts +3 -0
  147. package/src/win98/radio/radio.js +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vollowx/seele",
3
- "version": "0.13.4",
3
+ "version": "0.13.6",
4
4
  "description": "A extensible Web Components library, with Material Design 3 components pre-provided.",
5
5
  "author": "vollowx",
6
6
  "license": "Apache-2.0",
@@ -8,11 +8,18 @@
8
8
  "main": "./src/all.js",
9
9
  "module": "./src/all.js",
10
10
  "exports": {
11
- ".": "./src/all.js",
12
- "./*.js": "./src/*.js"
11
+ ".": {
12
+ "types": "./src/all.d.ts",
13
+ "default": "./src/all.js"
14
+ },
15
+ "./*.js": {
16
+ "types": "./src/*.d.ts",
17
+ "default": "./src/*.js"
18
+ }
13
19
  },
14
20
  "files": [
15
21
  "src/**/*.js",
22
+ "src/**/*.d.ts",
16
23
  "src/m3/system/*.css",
17
24
  "custom-elements.json",
18
25
  "LICENSE",
@@ -32,31 +39,32 @@
32
39
  "url": "https://github.com/vollowx/seele.git"
33
40
  },
34
41
  "scripts": {
35
- "dev": "wds",
36
- "dev:styles": "bun scripts/build-styles.ts --watch",
37
- "build": "bun run build:styles && bun run build:compile",
38
- "build:compile": "bun scripts/build.ts",
39
- "build:styles": "bun scripts/build-styles.ts --minify",
42
+ "note": "echo 'tsc must be called after build:css since it completes missing *-styles.css.js'",
43
+
44
+ "dev": "web-dev-server",
45
+ "dev:css": "bun scripts/convert-css.ts --watch",
46
+ "build": "bun run build:css && tsc && bun scripts/minify-html-literals.ts",
47
+ "build:css": "bun scripts/convert-css.ts --minify",
40
48
  "clean": "./scripts/clean.sh",
41
49
  "prepublishOnly": "bun clean && bun run build",
42
50
  "format": "prettier . --check",
43
51
  "format:write": "prettier . --check --write",
44
- "cem": "cem analyze --litelement --globs './src/m3/**/*.ts' --exclude './src/**/*.css.ts'"
52
+ "cem": "cem analyze --litelement --globs './src/m3/**/*.ts'"
45
53
  },
46
54
  "devDependencies": {
47
55
  "@custom-elements-manifest/analyzer": "^0.11.0",
48
- "@swc/core": "^1.15.46",
49
- "@types/bun": "^1.3.14",
56
+ "@types/node": "^26.1.2",
50
57
  "@web/dev-server": "^0.4.6",
51
58
  "@web/dev-server-esbuild": "^1.0.5",
52
59
  "chokidar": "^5.0.0",
53
60
  "lightningcss": "^1.33.0",
54
61
  "minify-html-literals": "^1.3.5",
55
- "prettier": "^3.9.6"
62
+ "prettier": "^3.9.6",
63
+ "typescript": "^7.0.2"
56
64
  },
57
65
  "dependencies": {
58
66
  "@floating-ui/dom": "^1.8.0",
59
- "@swc/helpers": "^0.5.23",
60
- "lit": "^3.3.3"
67
+ "lit": "^3.3.3",
68
+ "tslib": "^2.8.1"
61
69
  }
62
70
  }
package/src/all.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ import './m3/autocomplete/autocomplete.js';
2
+ import './m3/badge/badge.js';
3
+ import './m3/button/common-button.js';
4
+ import './m3/button/common-button-toggle.js';
5
+ import './m3/button/icon-button.js';
6
+ import './m3/button/icon-button-toggle.js';
7
+ import './m3/button-group/standard-button-group.js';
8
+ import './m3/button-group/connected-button-group.js';
9
+ import './m3/checkbox/checkbox.js';
10
+ import './m3/dialog/dialog.js';
11
+ import './m3/divider/divider.js';
12
+ import './m3/fab/fab.js';
13
+ import './m3/focus-ring/focus-ring.js';
14
+ import './m3/item/item.js';
15
+ import './m3/list/list.js';
16
+ import './m3/list/list-item.js';
17
+ import './m3/loading-indicator/loading-indicator.js';
18
+ import './m3/menu/menu.js';
19
+ import './m3/menu/menu-item.js';
20
+ import './m3/radio/radio.js';
21
+ import './m3/ripple/ripple.js';
22
+ import './m3/select/filled-select.js';
23
+ import './m3/select/outlined-select.js';
24
+ import './m3/select/option.js';
25
+ import './m3/slider/slider.js';
26
+ import './m3/switch/switch.js';
27
+ import './m3/tab/tabs.js';
28
+ import './m3/tab/tab.js';
29
+ import './m3/tab/tab-panel.js';
30
+ import './m3/text-field/filled-text-field.js';
31
+ import './m3/text-field/outlined-text-field.js';
32
+ import './m3/toolbar/toolbar.js';
33
+ import './m3/tooltip/tooltip.js';
34
+ import './win98/button/button.js';
package/src/all.js CHANGED
@@ -17,6 +17,7 @@ import './m3/list/list-item.js';
17
17
  import './m3/loading-indicator/loading-indicator.js';
18
18
  import './m3/menu/menu.js';
19
19
  import './m3/menu/menu-item.js';
20
+ import './m3/radio/radio.js';
20
21
  import './m3/ripple/ripple.js';
21
22
  import './m3/select/filled-select.js';
22
23
  import './m3/select/outlined-select.js';
@@ -0,0 +1,56 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import type { Placement, Strategy } from '@floating-ui/dom';
3
+ import type { Menu, MenuSelectEvent } from './menu.js';
4
+ declare const Base: Constructor<import("./mixins/focus-delegated.js").FocusDelegatedInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
5
+ type AutocompleteMode = 'none' | 'list' | 'both';
6
+ /**
7
+ * TODO: Check if manually dispatching input/change events on input is necessary
8
+ */
9
+ export declare class Autocomplete extends Base {
10
+ open: boolean;
11
+ quick: boolean;
12
+ offset: number;
13
+ align: Placement;
14
+ alignStrategy: Strategy;
15
+ keepOpenSelect: boolean;
16
+ mode: AutocompleteMode;
17
+ $menu: Menu;
18
+ inputSlotElements: HTMLElement[];
19
+ itemSlotElements: HTMLElement[];
20
+ private get $input();
21
+ render(): import("lit-html").TemplateResult<1>;
22
+ /**
23
+ * Example content:
24
+ *
25
+ * ```html
26
+ * <your-menu
27
+ * part="menu"
28
+ * id="menu"
29
+ * type="listbox"
30
+ * data-tabindex="-1"
31
+ * ?quick="${this.quick}"
32
+ * .offset=${this.offset}
33
+ * .align=${this.align}
34
+ * .alignStrategy=${this.alignStrategy}
35
+ * ?keep-open-select=${this.keepOpenSelect}
36
+ * no-focus-control
37
+ * ?open=${this.open}
38
+ * @open="${() => (this.open = true)}"
39
+ * @close="${() => (this.open = false)}"
40
+ * @select=${this.handleMenuSelect}
41
+ * >
42
+ * <slot @slotchange=${this.handleItemsSlotChange}></slot>
43
+ * </your-menu>
44
+ * ```
45
+ */
46
+ renderMenu(): import("lit-html").TemplateResult<1>;
47
+ private handleInputSlotChange;
48
+ protected handleItemsSlotChange(): void;
49
+ private handleInput;
50
+ private applyInlineAutoComplete;
51
+ private filterOptions;
52
+ private handleInputKeydown;
53
+ protected handleMenuSelect(event: MenuSelectEvent): void;
54
+ protected updated(changed: PropertyValues): void;
55
+ }
56
+ export {};
@@ -1,4 +1,4 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
1
+ import { __decorate } from "tslib";
2
2
  import { LitElement, html } from 'lit';
3
3
  import { property, query, queryAssignedElements } from 'lit/decorators.js';
4
4
  import { InternalsAttached } from './mixins/internals-attached.js';
@@ -6,54 +6,66 @@ import { FocusDelegated } from './mixins/focus-delegated.js';
6
6
  const Base = FocusDelegated(InternalsAttached(LitElement));
7
7
  /**
8
8
  * TODO: Check if manually dispatching input/change events on input is necessary
9
- */ export class Autocomplete extends Base {
9
+ */
10
+ export class Autocomplete extends Base {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.open = false;
14
+ // Passed to menu
15
+ this.quick = false;
16
+ this.offset = 0;
17
+ this.align = 'bottom-start';
18
+ this.alignStrategy = 'absolute';
19
+ this.keepOpenSelect = false;
20
+ this.mode = 'none';
21
+ }
10
22
  get $input() {
11
23
  return this.inputSlotElements[0];
12
24
  }
13
25
  render() {
14
- return html`<slot name="input" @slotchange="${this.handleInputSlotChange}"></slot>${this.renderMenu()}`;
26
+ return html `<slot name="input" @slotchange="${this.handleInputSlotChange}"></slot>${this.renderMenu()}`;
15
27
  }
16
28
  /**
17
- * Example content:
18
- *
19
- * ```html
20
- * <your-menu
21
- * part="menu"
22
- * id="menu"
23
- * type="listbox"
24
- * data-tabindex="-1"
25
- * ?quick="${this.quick}"
26
- * .offset=${this.offset}
27
- * .align=${this.align}
28
- * .alignStrategy=${this.alignStrategy}
29
- * ?keep-open-select=${this.keepOpenSelect}
30
- * no-focus-control
31
- * ?open=${this.open}
32
- * @open="${() => (this.open = true)}"
33
- * @close="${() => (this.open = false)}"
34
- * @select=${this.handleMenuSelect}
35
- * >
36
- * <slot @slotchange=${this.handleItemsSlotChange}></slot>
37
- * </your-menu>
38
- * ```
39
- */ renderMenu() {
40
- return html``;
29
+ * Example content:
30
+ *
31
+ * ```html
32
+ * <your-menu
33
+ * part="menu"
34
+ * id="menu"
35
+ * type="listbox"
36
+ * data-tabindex="-1"
37
+ * ?quick="${this.quick}"
38
+ * .offset=${this.offset}
39
+ * .align=${this.align}
40
+ * .alignStrategy=${this.alignStrategy}
41
+ * ?keep-open-select=${this.keepOpenSelect}
42
+ * no-focus-control
43
+ * ?open=${this.open}
44
+ * @open="${() => (this.open = true)}"
45
+ * @close="${() => (this.open = false)}"
46
+ * @select=${this.handleMenuSelect}
47
+ * >
48
+ * <slot @slotchange=${this.handleItemsSlotChange}></slot>
49
+ * </your-menu>
50
+ * ```
51
+ */
52
+ renderMenu() {
53
+ return html ``;
41
54
  }
42
55
  handleInputSlotChange() {
43
56
  const input = this.$input;
44
- if (!input) return;
57
+ if (!input)
58
+ return;
45
59
  const $realInput = this.$input.$inputOrTextarea;
46
60
  if ($realInput) {
47
61
  $realInput.role = 'combobox';
48
62
  $realInput.ariaExpanded = String(this.open);
49
63
  $realInput.ariaHasPopup = 'listbox';
50
64
  $realInput.ariaAutoComplete = this.mode;
51
- $realInput.ariaControlsElements = [
52
- this.$menu
53
- ];
65
+ $realInput.ariaControlsElements = [this.$menu];
54
66
  input.addEventListener('input', this.handleInput.bind(this));
55
67
  input.addEventListener('keydown', this.handleInputKeydown.bind(this));
56
- input.addEventListener('click', ()=>this.open = !this.open);
68
+ input.addEventListener('click', () => (this.open = !this.open));
57
69
  this.$menu.attach($realInput);
58
70
  }
59
71
  }
@@ -82,10 +94,11 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
82
94
  }
83
95
  }
84
96
  filterOptions(searchTerm) {
85
- if (this.mode === 'none') return null;
97
+ if (this.mode === 'none')
98
+ return null;
86
99
  const normalizedSearch = searchTerm.toLowerCase();
87
100
  let firstMatch = null;
88
- this.itemSlotElements.forEach((item)=>{
101
+ this.itemSlotElements.forEach((item) => {
89
102
  const text = (item.textContent || '').toLowerCase().trim();
90
103
  const isMatch = text.startsWith(normalizedSearch);
91
104
  item.hidden = !isMatch;
@@ -96,26 +109,32 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
96
109
  return firstMatch;
97
110
  }
98
111
  handleInputKeydown(event) {
99
- if (this.$input?.disabled) return;
100
- if ([
101
- 'Enter',
102
- 'Escape',
103
- 'ArrowUp',
104
- 'ArrowDown'
105
- ].includes(event.key)) {
112
+ if (this.$input?.disabled)
113
+ return;
114
+ if (['Enter', 'Escape', 'ArrowUp', 'ArrowDown'].includes(event.key)) {
106
115
  const eventClone = new KeyboardEvent(event.type, event);
107
- eventClone.preventDefault = ()=>event.preventDefault();
108
- eventClone.stopPropagation = ()=>event.stopPropagation();
116
+ eventClone.preventDefault = () => event.preventDefault();
117
+ eventClone.stopPropagation = () => event.stopPropagation();
109
118
  this.$menu.$menu.dispatchEvent(eventClone);
110
- if (event.key === 'Enter' && !this.keepOpenSelect) this.open = false;
119
+ if (event.key === 'Enter' && !this.keepOpenSelect)
120
+ this.open = false;
111
121
  }
112
122
  }
113
123
  handleMenuSelect(event) {
124
+ // FIXME: pressing <Enter> in a 'both' mode autocomplete triggers this
125
+ // function, which overrides the current value in the text field
126
+ // since the selected value in the menu is not the same as the
127
+ // one in autocomplete
128
+ //
129
+ // if (this.mode === 'list') {
114
130
  const selectedItem = event.detail.item;
115
- const newValue = selectedItem.getAttribute('value') || selectedItem.textContent?.trim() || '';
131
+ const newValue = selectedItem.getAttribute('value') ||
132
+ selectedItem.textContent?.trim() ||
133
+ '';
116
134
  if (this.$input) {
117
135
  this.$input.value = newValue;
118
136
  }
137
+ // }
119
138
  if (!this.keepOpenSelect) {
120
139
  this.open = false;
121
140
  }
@@ -128,58 +147,34 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
128
147
  }
129
148
  }
130
149
  }
131
- constructor(...args){
132
- super(...args), this.open = false, // Passed to menu
133
- this.quick = false, this.offset = 0, this.align = 'bottom-start', this.alignStrategy = 'absolute', this.keepOpenSelect = false, this.mode = 'none';
134
- }
135
150
  }
136
- _ts_decorate([
137
- property({
138
- type: Boolean
139
- })
151
+ __decorate([
152
+ property({ type: Boolean })
140
153
  ], Autocomplete.prototype, "open", void 0);
141
- _ts_decorate([
142
- property({
143
- type: Boolean
144
- })
154
+ __decorate([
155
+ property({ type: Boolean })
145
156
  ], Autocomplete.prototype, "quick", void 0);
146
- _ts_decorate([
147
- property({
148
- type: Number
149
- })
157
+ __decorate([
158
+ property({ type: Number })
150
159
  ], Autocomplete.prototype, "offset", void 0);
151
- _ts_decorate([
152
- property({
153
- reflect: true
154
- })
160
+ __decorate([
161
+ property({ reflect: true })
155
162
  ], Autocomplete.prototype, "align", void 0);
156
- _ts_decorate([
157
- property({
158
- type: String,
159
- reflect: true,
160
- attribute: 'align-strategy'
161
- })
163
+ __decorate([
164
+ property({ type: String, reflect: true, attribute: 'align-strategy' })
162
165
  ], Autocomplete.prototype, "alignStrategy", void 0);
163
- _ts_decorate([
164
- property({
165
- type: Boolean,
166
- attribute: 'keep-open-select'
167
- })
166
+ __decorate([
167
+ property({ type: Boolean, attribute: 'keep-open-select' })
168
168
  ], Autocomplete.prototype, "keepOpenSelect", void 0);
169
- _ts_decorate([
169
+ __decorate([
170
170
  property()
171
171
  ], Autocomplete.prototype, "mode", void 0);
172
- _ts_decorate([
172
+ __decorate([
173
173
  query('[part="menu"]')
174
174
  ], Autocomplete.prototype, "$menu", void 0);
175
- _ts_decorate([
176
- queryAssignedElements({
177
- slot: 'input',
178
- flatten: true
179
- })
175
+ __decorate([
176
+ queryAssignedElements({ slot: 'input', flatten: true })
180
177
  ], Autocomplete.prototype, "inputSlotElements", void 0);
181
- _ts_decorate([
182
- queryAssignedElements({
183
- flatten: true
184
- })
178
+ __decorate([
179
+ queryAssignedElements({ flatten: true })
185
180
  ], Autocomplete.prototype, "itemSlotElements", void 0);
@@ -0,0 +1,13 @@
1
+ import { LitElement } from 'lit';
2
+ declare const Base: Constructor<import("./mixins/form-associated.js").FormAssociatedInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
3
+ export declare class Button extends Base {
4
+ #private;
5
+ type: 'button' | 'submit' | 'reset';
6
+ static styles: any[];
7
+ constructor();
8
+ connectedCallback(): void;
9
+ disconnectedCallback(): void;
10
+ protected updated(changed: Map<string, any>): void;
11
+ protected updateState(): void;
12
+ }
13
+ export {};
@@ -1,4 +1,4 @@
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 { InternalsAttached, internals } from './mixins/internals-attached.js';
@@ -6,38 +6,43 @@ import { FormAssociated } from './mixins/form-associated.js';
6
6
  import { hiddenStyles } from './hidden-styles.css.js';
7
7
  const Base = FormAssociated(InternalsAttached(LitElement));
8
8
  export class Button extends Base {
9
- static{
10
- this.styles = [
11
- hiddenStyles
12
- ];
13
- }
14
- constructor(){
15
- super(), this.type = 'button', this.#handleKeyDown = (e)=>{
16
- if (e.key !== ' ' && e.key !== 'Enter') return;
9
+ static { this.styles = [hiddenStyles]; }
10
+ constructor() {
11
+ super();
12
+ this.type = 'button';
13
+ this.#handleKeyDown = (e) => {
14
+ if (e.key !== ' ' && e.key !== 'Enter')
15
+ return;
17
16
  e.preventDefault();
18
17
  e.stopPropagation();
19
- if (e.key === 'Enter') this.click();
20
- }, this.#handleKeyUp = (e)=>{
18
+ if (e.key === 'Enter')
19
+ this.click();
20
+ };
21
+ this.#handleKeyUp = (e) => {
21
22
  if (e.key === ' ') {
22
23
  e.preventDefault();
23
24
  e.stopPropagation();
24
25
  this.click();
25
26
  }
26
- }, this.#handleClick = ()=>{
27
- if (this.type !== 'button') this[internals].form?.[this.type]();
27
+ };
28
+ this.#handleClick = () => {
29
+ if (this.type !== 'button')
30
+ this[internals].form?.[this.type]();
28
31
  };
29
32
  this[internals].role = 'button';
30
33
  this.updateState();
34
+ // This is set to prevent a first-paint-time transition for styles like
35
+ // `border-radius` on `:host`. Also in `ToggleButton`.
36
+ // Double `requestAnimationFrame` is necessary since the callback inside is
37
+ // called before the nth frame is printed.
38
+ this.setAttribute('notransition', '');
31
39
  }
32
40
  connectedCallback() {
33
41
  super.connectedCallback();
34
42
  this.addEventListener('keydown', this.#handleKeyDown);
35
43
  this.addEventListener('keyup', this.#handleKeyUp);
36
44
  this.addEventListener('click', this.#handleClick);
37
- // This is set to prevent a first-paint-time transition for styles like
38
- // `border-radius` on `:host`. Also in `ToggleButton`.
39
- this.setAttribute('notransition', '');
40
- requestAnimationFrame(()=>this.removeAttribute('notransition'));
45
+ requestAnimationFrame(() => requestAnimationFrame(() => this.removeAttribute('notransition')));
41
46
  }
42
47
  disconnectedCallback() {
43
48
  super.disconnectedCallback();
@@ -46,7 +51,8 @@ export class Button extends Base {
46
51
  this.removeEventListener('click', this.#handleClick);
47
52
  }
48
53
  updated(changed) {
49
- if (changed.has('disabled')) this.updateState();
54
+ if (changed.has('disabled'))
55
+ this.updateState();
50
56
  }
51
57
  updateState() {
52
58
  this.tabIndex = this.disabled ? -1 : 0;
@@ -56,8 +62,6 @@ export class Button extends Base {
56
62
  #handleKeyUp;
57
63
  #handleClick;
58
64
  }
59
- _ts_decorate([
60
- property({
61
- reflect: true
62
- })
65
+ __decorate([
66
+ property({ reflect: true })
63
67
  ], Button.prototype, "type", void 0);
@@ -0,0 +1,18 @@
1
+ import { LitElement } from 'lit';
2
+ declare const Base: Constructor<import("./mixins/form-associated.js").FormAssociatedInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
3
+ export declare class Checkbox extends Base {
4
+ #private;
5
+ checked: boolean;
6
+ indeterminate: boolean;
7
+ required: boolean;
8
+ static styles: any[];
9
+ constructor();
10
+ connectedCallback(): void;
11
+ disconnectedCallback(): void;
12
+ protected updated(changed: Map<string, any>): void;
13
+ protected updateState(): void;
14
+ protected toggleChecked(): void;
15
+ formResetCallback(): void;
16
+ formStateRestoreCallback(state: string, _reason: string): void;
17
+ }
18
+ export {};
@@ -1,4 +1,4 @@
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 { FormAssociated } from './mixins/form-associated.js';
@@ -7,26 +7,28 @@ import { hiddenStyles } from './hidden-styles.css.js';
7
7
  const PROPERTY_FROM_ARIA_CHECKED = {
8
8
  true: 'checked',
9
9
  false: 'unchecked',
10
- mixed: 'indeterminate'
10
+ mixed: 'indeterminate',
11
11
  };
12
12
  const Base = FormAssociated(InternalsAttached(LitElement));
13
13
  export class Checkbox extends Base {
14
- static{
15
- this.styles = [
16
- hiddenStyles
17
- ];
18
- }
19
- constructor(){
20
- super(), this.checked = false, this.indeterminate = false, this.required = false, this.#handleClick = (e)=>{
14
+ static { this.styles = [hiddenStyles]; }
15
+ constructor() {
16
+ super();
17
+ this.checked = false;
18
+ this.indeterminate = false;
19
+ this.required = false;
20
+ this.#handleClick = (e) => {
21
21
  e.stopPropagation();
22
22
  e.preventDefault();
23
23
  this.toggleChecked();
24
- }, this.#handleKeyDown = (e)=>{
24
+ };
25
+ this.#handleKeyDown = (e) => {
25
26
  if (e.key === ' ') {
26
27
  e.preventDefault();
27
28
  e.stopPropagation();
28
29
  }
29
- }, this.#handleKeyUp = (e)=>{
30
+ };
31
+ this.#handleKeyUp = (e) => {
30
32
  if (e.key === ' ') {
31
33
  e.preventDefault();
32
34
  e.stopPropagation();
@@ -51,20 +53,29 @@ export class Checkbox extends Base {
51
53
  super.disconnectedCallback();
52
54
  }
53
55
  updated(changed) {
54
- if (changed.has('checked') || changed.has('disabled') || changed.has('indeterminate') || changed.has('required')) {
56
+ if (changed.has('checked') ||
57
+ changed.has('disabled') ||
58
+ changed.has('indeterminate') ||
59
+ changed.has('required')) {
55
60
  this.updateState();
56
61
  }
57
62
  }
58
63
  updateState() {
59
- const prevAriaChecked = this[internals].ariaChecked;
64
+ const prevAriaChecked = this[internals]
65
+ .ariaChecked;
60
66
  this[internals].states.delete('was-unchecked');
61
67
  this[internals].states.delete('was-checked');
62
68
  this[internals].states.delete('was-indeterminate');
63
69
  if (prevAriaChecked && PROPERTY_FROM_ARIA_CHECKED[prevAriaChecked]) {
64
70
  this[internals].states.add(`was-${PROPERTY_FROM_ARIA_CHECKED[prevAriaChecked]}`);
65
71
  }
66
- this[internals].ariaChecked = this.indeterminate ? 'mixed' : this.checked ? 'true' : 'false';
67
- const currentAriaChecked = this[internals].ariaChecked;
72
+ this[internals].ariaChecked = this.indeterminate
73
+ ? 'mixed'
74
+ : this.checked
75
+ ? 'true'
76
+ : 'false';
77
+ const currentAriaChecked = this[internals]
78
+ .ariaChecked;
68
79
  this[internals].states.delete('unchecked');
69
80
  this[internals].states.delete('checked');
70
81
  this[internals].states.delete('indeterminate');
@@ -73,11 +84,11 @@ export class Checkbox extends Base {
73
84
  this[internals].ariaDisabled = String(this.disabled);
74
85
  this[internals].setFormValue(this.checked ? 'on' : null);
75
86
  if (this.required && !this.checked) {
76
- this[internals].setValidity({
77
- valueMissing: true
78
- }, // TODO: I18n
87
+ this[internals].setValidity({ valueMissing: true },
88
+ // TODO: I18n
79
89
  'Please check this box if you want to proceed.');
80
- } else {
90
+ }
91
+ else {
81
92
  this[internals].setValidity({});
82
93
  }
83
94
  }
@@ -85,13 +96,14 @@ export class Checkbox extends Base {
85
96
  #handleKeyDown;
86
97
  #handleKeyUp;
87
98
  toggleChecked() {
88
- if (this.disabled) return;
99
+ if (this.disabled)
100
+ return;
89
101
  this.checked = !this.checked;
90
102
  this.indeterminate = false;
91
103
  this.dispatchEvent(new CustomEvent('change', {
92
104
  bubbles: true,
93
105
  composed: true,
94
- detail: this.checked
106
+ detail: this.checked,
95
107
  }));
96
108
  }
97
109
  formResetCallback() {
@@ -101,19 +113,12 @@ export class Checkbox extends Base {
101
113
  this.checked = state === 'on';
102
114
  }
103
115
  }
104
- _ts_decorate([
105
- property({
106
- type: Boolean
107
- })
116
+ __decorate([
117
+ property({ type: Boolean })
108
118
  ], Checkbox.prototype, "checked", void 0);
109
- _ts_decorate([
110
- property({
111
- type: Boolean
112
- })
119
+ __decorate([
120
+ property({ type: Boolean })
113
121
  ], Checkbox.prototype, "indeterminate", void 0);
114
- _ts_decorate([
115
- property({
116
- type: Boolean,
117
- reflect: true
118
- })
122
+ __decorate([
123
+ property({ type: Boolean, reflect: true })
119
124
  ], Checkbox.prototype, "required", void 0);