@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vollowx/seele",
3
- "version": "0.13.5",
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';
@@ -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,18 +109,15 @@ 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) {
@@ -118,7 +128,9 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
118
128
  //
119
129
  // if (this.mode === 'list') {
120
130
  const selectedItem = event.detail.item;
121
- const newValue = selectedItem.getAttribute('value') || selectedItem.textContent?.trim() || '';
131
+ const newValue = selectedItem.getAttribute('value') ||
132
+ selectedItem.textContent?.trim() ||
133
+ '';
122
134
  if (this.$input) {
123
135
  this.$input.value = newValue;
124
136
  }
@@ -135,58 +147,34 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
135
147
  }
136
148
  }
137
149
  }
138
- constructor(...args){
139
- super(...args), this.open = false, // Passed to menu
140
- this.quick = false, this.offset = 0, this.align = 'bottom-start', this.alignStrategy = 'absolute', this.keepOpenSelect = false, this.mode = 'none';
141
- }
142
150
  }
143
- _ts_decorate([
144
- property({
145
- type: Boolean
146
- })
151
+ __decorate([
152
+ property({ type: Boolean })
147
153
  ], Autocomplete.prototype, "open", void 0);
148
- _ts_decorate([
149
- property({
150
- type: Boolean
151
- })
154
+ __decorate([
155
+ property({ type: Boolean })
152
156
  ], Autocomplete.prototype, "quick", void 0);
153
- _ts_decorate([
154
- property({
155
- type: Number
156
- })
157
+ __decorate([
158
+ property({ type: Number })
157
159
  ], Autocomplete.prototype, "offset", void 0);
158
- _ts_decorate([
159
- property({
160
- reflect: true
161
- })
160
+ __decorate([
161
+ property({ reflect: true })
162
162
  ], Autocomplete.prototype, "align", void 0);
163
- _ts_decorate([
164
- property({
165
- type: String,
166
- reflect: true,
167
- attribute: 'align-strategy'
168
- })
163
+ __decorate([
164
+ property({ type: String, reflect: true, attribute: 'align-strategy' })
169
165
  ], Autocomplete.prototype, "alignStrategy", void 0);
170
- _ts_decorate([
171
- property({
172
- type: Boolean,
173
- attribute: 'keep-open-select'
174
- })
166
+ __decorate([
167
+ property({ type: Boolean, attribute: 'keep-open-select' })
175
168
  ], Autocomplete.prototype, "keepOpenSelect", void 0);
176
- _ts_decorate([
169
+ __decorate([
177
170
  property()
178
171
  ], Autocomplete.prototype, "mode", void 0);
179
- _ts_decorate([
172
+ __decorate([
180
173
  query('[part="menu"]')
181
174
  ], Autocomplete.prototype, "$menu", void 0);
182
- _ts_decorate([
183
- queryAssignedElements({
184
- slot: 'input',
185
- flatten: true
186
- })
175
+ __decorate([
176
+ queryAssignedElements({ slot: 'input', flatten: true })
187
177
  ], Autocomplete.prototype, "inputSlotElements", void 0);
188
- _ts_decorate([
189
- queryAssignedElements({
190
- flatten: true
191
- })
178
+ __decorate([
179
+ queryAssignedElements({ flatten: true })
192
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,25 +6,28 @@ 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();
@@ -39,7 +42,7 @@ export class Button extends Base {
39
42
  this.addEventListener('keydown', this.#handleKeyDown);
40
43
  this.addEventListener('keyup', this.#handleKeyUp);
41
44
  this.addEventListener('click', this.#handleClick);
42
- requestAnimationFrame(()=>requestAnimationFrame(()=>this.removeAttribute('notransition')));
45
+ requestAnimationFrame(() => requestAnimationFrame(() => this.removeAttribute('notransition')));
43
46
  }
44
47
  disconnectedCallback() {
45
48
  super.disconnectedCallback();
@@ -48,7 +51,8 @@ export class Button extends Base {
48
51
  this.removeEventListener('click', this.#handleClick);
49
52
  }
50
53
  updated(changed) {
51
- if (changed.has('disabled')) this.updateState();
54
+ if (changed.has('disabled'))
55
+ this.updateState();
52
56
  }
53
57
  updateState() {
54
58
  this.tabIndex = this.disabled ? -1 : 0;
@@ -58,8 +62,6 @@ export class Button extends Base {
58
62
  #handleKeyUp;
59
63
  #handleClick;
60
64
  }
61
- _ts_decorate([
62
- property({
63
- reflect: true
64
- })
65
+ __decorate([
66
+ property({ reflect: true })
65
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);