@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vollowx/seele",
3
- "version": "0.13.5",
3
+ "version": "0.13.7",
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,57 @@
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
+ * TODO: handle slotchange
9
+ */
10
+ export declare class Autocomplete extends Base {
11
+ open: boolean;
12
+ quick: boolean;
13
+ offset: number;
14
+ align: Placement;
15
+ alignStrategy: Strategy;
16
+ keepOpenSelect: boolean;
17
+ mode: AutocompleteMode;
18
+ $menu: Menu;
19
+ inputSlotElements: HTMLElement[];
20
+ itemSlotElements: HTMLElement[];
21
+ private get $input();
22
+ render(): import("lit-html").TemplateResult<1>;
23
+ /**
24
+ * Example content:
25
+ *
26
+ * ```html
27
+ * <your-menu
28
+ * part="menu"
29
+ * id="menu"
30
+ * type="listbox"
31
+ * data-tabindex="-1"
32
+ * ?quick="${this.quick}"
33
+ * .offset=${this.offset}
34
+ * .align=${this.align}
35
+ * .alignStrategy=${this.alignStrategy}
36
+ * ?keep-open-select=${this.keepOpenSelect}
37
+ * no-focus-control
38
+ * ?open=${this.open}
39
+ * @open="${() => (this.open = true)}"
40
+ * @close="${() => (this.open = false)}"
41
+ * @select=${this.handleMenuSelect}
42
+ * >
43
+ * <slot @slotchange=${this.handleItemsSlotChange}></slot>
44
+ * </your-menu>
45
+ * ```
46
+ */
47
+ renderMenu(): import("lit-html").TemplateResult<1>;
48
+ private handleInputSlotChange;
49
+ protected handleItemsSlotChange(): void;
50
+ private handleInput;
51
+ private applyInlineAutoComplete;
52
+ private filterOptions;
53
+ private handleInputKeydown;
54
+ protected handleMenuSelect(event: MenuSelectEvent): void;
55
+ protected updated(changed: PropertyValues): void;
56
+ }
57
+ export {};
@@ -1,61 +1,74 @@
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
+ import { ensureReady } from '../core/ensure-ready.js';
4
5
  import { InternalsAttached } from './mixins/internals-attached.js';
5
6
  import { FocusDelegated } from './mixins/focus-delegated.js';
6
7
  const Base = FocusDelegated(InternalsAttached(LitElement));
7
8
  /**
8
9
  * TODO: Check if manually dispatching input/change events on input is necessary
9
- */ export class Autocomplete extends Base {
10
+ * TODO: handle slotchange
11
+ */
12
+ export class Autocomplete extends Base {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.open = false;
16
+ // Passed to menu
17
+ this.quick = false;
18
+ this.offset = 0;
19
+ this.align = 'bottom-start';
20
+ this.alignStrategy = 'absolute';
21
+ this.keepOpenSelect = false;
22
+ this.mode = 'none';
23
+ }
10
24
  get $input() {
11
25
  return this.inputSlotElements[0];
12
26
  }
13
27
  render() {
14
- return html`<slot name="input" @slotchange="${this.handleInputSlotChange}"></slot>${this.renderMenu()}`;
28
+ return html `<slot name="input" @slotchange="${this.handleInputSlotChange}"></slot>${this.renderMenu()}`;
15
29
  }
16
30
  /**
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``;
31
+ * Example content:
32
+ *
33
+ * ```html
34
+ * <your-menu
35
+ * part="menu"
36
+ * id="menu"
37
+ * type="listbox"
38
+ * data-tabindex="-1"
39
+ * ?quick="${this.quick}"
40
+ * .offset=${this.offset}
41
+ * .align=${this.align}
42
+ * .alignStrategy=${this.alignStrategy}
43
+ * ?keep-open-select=${this.keepOpenSelect}
44
+ * no-focus-control
45
+ * ?open=${this.open}
46
+ * @open="${() => (this.open = true)}"
47
+ * @close="${() => (this.open = false)}"
48
+ * @select=${this.handleMenuSelect}
49
+ * >
50
+ * <slot @slotchange=${this.handleItemsSlotChange}></slot>
51
+ * </your-menu>
52
+ * ```
53
+ */
54
+ renderMenu() {
55
+ return html ``;
41
56
  }
57
+ // TODO: handle multiple calls on this function, currently double-call
58
+ // disallowed
42
59
  handleInputSlotChange() {
43
- const input = this.$input;
44
- if (!input) return;
45
- const $realInput = this.$input.$inputOrTextarea;
46
- if ($realInput) {
60
+ ensureReady(this.$input).then((input) => {
61
+ const $realInput = input.$inputOrTextarea;
47
62
  $realInput.role = 'combobox';
48
63
  $realInput.ariaExpanded = String(this.open);
49
64
  $realInput.ariaHasPopup = 'listbox';
50
65
  $realInput.ariaAutoComplete = this.mode;
51
- $realInput.ariaControlsElements = [
52
- this.$menu
53
- ];
66
+ $realInput.ariaControlsElements = [this.$menu];
54
67
  input.addEventListener('input', this.handleInput.bind(this));
55
68
  input.addEventListener('keydown', this.handleInputKeydown.bind(this));
56
- input.addEventListener('click', ()=>this.open = !this.open);
69
+ input.addEventListener('click', () => (this.open = !this.open));
57
70
  this.$menu.attach($realInput);
58
- }
71
+ });
59
72
  }
60
73
  handleItemsSlotChange() {
61
74
  // Initial filter based on current input value (if any)
@@ -82,10 +95,11 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
82
95
  }
83
96
  }
84
97
  filterOptions(searchTerm) {
85
- if (this.mode === 'none') return null;
98
+ if (this.mode === 'none')
99
+ return null;
86
100
  const normalizedSearch = searchTerm.toLowerCase();
87
101
  let firstMatch = null;
88
- this.itemSlotElements.forEach((item)=>{
102
+ this.itemSlotElements.forEach((item) => {
89
103
  const text = (item.textContent || '').toLowerCase().trim();
90
104
  const isMatch = text.startsWith(normalizedSearch);
91
105
  item.hidden = !isMatch;
@@ -96,33 +110,25 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
96
110
  return firstMatch;
97
111
  }
98
112
  handleInputKeydown(event) {
99
- if (this.$input?.disabled) return;
100
- if ([
101
- 'Enter',
102
- 'Escape',
103
- 'ArrowUp',
104
- 'ArrowDown'
105
- ].includes(event.key)) {
113
+ if (this.$input?.disabled)
114
+ return;
115
+ if (['Enter', 'Escape', 'ArrowUp', 'ArrowDown'].includes(event.key)) {
106
116
  const eventClone = new KeyboardEvent(event.type, event);
107
- eventClone.preventDefault = ()=>event.preventDefault();
108
- eventClone.stopPropagation = ()=>event.stopPropagation();
117
+ eventClone.preventDefault = () => event.preventDefault();
118
+ eventClone.stopPropagation = () => event.stopPropagation();
109
119
  this.$menu.$menu.dispatchEvent(eventClone);
110
- if (event.key === 'Enter' && !this.keepOpenSelect) this.open = false;
120
+ if (event.key === 'Enter' && !this.keepOpenSelect)
121
+ this.open = false;
111
122
  }
112
123
  }
113
124
  handleMenuSelect(event) {
114
- // FIXME: pressing <Enter> in a 'both' mode autocomplete triggers this
115
- // function, which overrides the current value in the text field
116
- // since the selected value in the menu is not the same as the
117
- // one in autocomplete
118
- //
119
- // if (this.mode === 'list') {
120
125
  const selectedItem = event.detail.item;
121
- const newValue = selectedItem.getAttribute('value') || selectedItem.textContent?.trim() || '';
126
+ const newValue = selectedItem.getAttribute('value') ||
127
+ selectedItem.textContent?.trim() ||
128
+ '';
122
129
  if (this.$input) {
123
130
  this.$input.value = newValue;
124
131
  }
125
- // }
126
132
  if (!this.keepOpenSelect) {
127
133
  this.open = false;
128
134
  }
@@ -135,58 +141,34 @@ const Base = FocusDelegated(InternalsAttached(LitElement));
135
141
  }
136
142
  }
137
143
  }
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
144
  }
143
- _ts_decorate([
144
- property({
145
- type: Boolean
146
- })
145
+ __decorate([
146
+ property({ type: Boolean })
147
147
  ], Autocomplete.prototype, "open", void 0);
148
- _ts_decorate([
149
- property({
150
- type: Boolean
151
- })
148
+ __decorate([
149
+ property({ type: Boolean })
152
150
  ], Autocomplete.prototype, "quick", void 0);
153
- _ts_decorate([
154
- property({
155
- type: Number
156
- })
151
+ __decorate([
152
+ property({ type: Number })
157
153
  ], Autocomplete.prototype, "offset", void 0);
158
- _ts_decorate([
159
- property({
160
- reflect: true
161
- })
154
+ __decorate([
155
+ property({ reflect: true })
162
156
  ], Autocomplete.prototype, "align", void 0);
163
- _ts_decorate([
164
- property({
165
- type: String,
166
- reflect: true,
167
- attribute: 'align-strategy'
168
- })
157
+ __decorate([
158
+ property({ type: String, reflect: true, attribute: 'align-strategy' })
169
159
  ], Autocomplete.prototype, "alignStrategy", void 0);
170
- _ts_decorate([
171
- property({
172
- type: Boolean,
173
- attribute: 'keep-open-select'
174
- })
160
+ __decorate([
161
+ property({ type: Boolean, attribute: 'keep-open-select' })
175
162
  ], Autocomplete.prototype, "keepOpenSelect", void 0);
176
- _ts_decorate([
163
+ __decorate([
177
164
  property()
178
165
  ], Autocomplete.prototype, "mode", void 0);
179
- _ts_decorate([
166
+ __decorate([
180
167
  query('[part="menu"]')
181
168
  ], Autocomplete.prototype, "$menu", void 0);
182
- _ts_decorate([
183
- queryAssignedElements({
184
- slot: 'input',
185
- flatten: true
186
- })
169
+ __decorate([
170
+ queryAssignedElements({ slot: 'input', flatten: true })
187
171
  ], Autocomplete.prototype, "inputSlotElements", void 0);
188
- _ts_decorate([
189
- queryAssignedElements({
190
- flatten: true
191
- })
172
+ __decorate([
173
+ queryAssignedElements({ flatten: true })
192
174
  ], 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);