@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
@@ -0,0 +1,37 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import type { ListItem } from '../list-item.js';
3
+ export interface ListControllerConfig<Item extends ListItem> {
4
+ isItem: (item: HTMLElement) => item is Item;
5
+ getPossibleItems: () => HTMLElement[];
6
+ blurItem: (item: Item) => void;
7
+ focusItem: (item: Item) => void;
8
+ isActivatable?: (item: Item) => boolean;
9
+ wrapNavigation?: () => boolean;
10
+ }
11
+ export declare class ListController<Item extends ListItem> implements ReactiveController {
12
+ host: ReactiveControllerHost;
13
+ isItem: (item: HTMLElement) => item is Item;
14
+ private readonly getPossibleItems;
15
+ private readonly blurItem;
16
+ private readonly focusItem;
17
+ private readonly wrapNavigation;
18
+ constructor(host: ReactiveControllerHost, config: ListControllerConfig<Item>);
19
+ hostConnected(): void;
20
+ hostDisconnected(): void;
21
+ get items(): Item[];
22
+ get currentIndex(): number;
23
+ _focusedItem: Item | null;
24
+ private searchString;
25
+ private searchTimeout;
26
+ handleType(char: string): boolean;
27
+ private getSearchString;
28
+ clearSearch(): void;
29
+ _focusItem(item: Item): void;
30
+ _blurItem(item: Item): void;
31
+ focusFirstItem(): void;
32
+ focusLastItem(): void;
33
+ focusNextItem(): void;
34
+ focusPreviousItem(): void;
35
+ handleSlotChange(): void;
36
+ }
37
+ export declare function getIndexByLetter(options: string[], filter: string, startIndex?: number): number;
@@ -1,6 +1,6 @@
1
1
  import { filterOptions } from '../menu.js';
2
2
  export class ListController {
3
- constructor(host, config){
3
+ constructor(host, config) {
4
4
  this._focusedItem = null;
5
5
  this.searchString = '';
6
6
  this.searchTimeout = null;
@@ -12,25 +12,28 @@ export class ListController {
12
12
  this.focusItem = focusItem;
13
13
  this.wrapNavigation = wrapNavigation;
14
14
  }
15
- hostConnected() {}
16
- hostDisconnected() {}
15
+ hostConnected() { }
16
+ hostDisconnected() { }
17
17
  get items() {
18
18
  return this.getPossibleItems().filter(this.isItem);
19
19
  }
20
20
  get currentIndex() {
21
- if (!this._focusedItem) return -1;
21
+ if (!this._focusedItem)
22
+ return -1;
22
23
  return this.items.indexOf(this._focusedItem);
23
24
  }
24
25
  handleType(char) {
25
26
  const searchString = this.getSearchString(char);
26
27
  const items = this.items;
27
- const optionsText = items.map((item)=>item.innerText);
28
+ const optionsText = items.map((item) => item.innerText);
28
29
  const searchIndex = getIndexByLetter(optionsText, searchString, this.currentIndex + 1);
29
30
  if (searchIndex >= 0) {
30
31
  this._focusItem(items[searchIndex]);
31
32
  return true;
32
- } else {
33
- if (this.searchTimeout) window.clearTimeout(this.searchTimeout);
33
+ }
34
+ else {
35
+ if (this.searchTimeout)
36
+ window.clearTimeout(this.searchTimeout);
34
37
  this.searchString = '';
35
38
  return false;
36
39
  }
@@ -39,7 +42,7 @@ export class ListController {
39
42
  if (this.searchTimeout) {
40
43
  window.clearTimeout(this.searchTimeout);
41
44
  }
42
- this.searchTimeout = window.setTimeout(()=>{
45
+ this.searchTimeout = window.setTimeout(() => {
43
46
  this.searchString = '';
44
47
  }, 500);
45
48
  this.searchString += char;
@@ -53,7 +56,8 @@ export class ListController {
53
56
  }
54
57
  }
55
58
  _focusItem(item) {
56
- if (this._focusedItem !== null) this._blurItem(this._focusedItem);
59
+ if (this._focusedItem !== null)
60
+ this._blurItem(this._focusedItem);
57
61
  this.focusItem(item);
58
62
  this._focusedItem = item;
59
63
  }
@@ -70,7 +74,8 @@ export class ListController {
70
74
  focusNextItem() {
71
75
  const items = this.items;
72
76
  const count = items.length;
73
- if (count === 0) return;
77
+ if (count === 0)
78
+ return;
74
79
  let nextIndex = this.currentIndex + 1;
75
80
  if (nextIndex >= count) {
76
81
  nextIndex = this.wrapNavigation() ? 0 : count - 1;
@@ -80,7 +85,8 @@ export class ListController {
80
85
  focusPreviousItem() {
81
86
  const items = this.items;
82
87
  const count = items.length;
83
- if (count === 0) return;
88
+ if (count === 0)
89
+ return;
84
90
  let prevIndex = this.currentIndex - 1;
85
91
  if (prevIndex < 0) {
86
92
  prevIndex = this.wrapNavigation() ? count - 1 : 0;
@@ -96,16 +102,18 @@ export class ListController {
96
102
  export function getIndexByLetter(options, filter, startIndex = 0) {
97
103
  const orderedOptions = [
98
104
  ...options.slice(startIndex),
99
- ...options.slice(0, startIndex)
105
+ ...options.slice(0, startIndex),
100
106
  ];
101
107
  const firstMatch = filterOptions(orderedOptions, filter)[0];
102
- const allSameLetter = (array)=>array.every((letter)=>letter === array[0]);
108
+ const allSameLetter = (array) => array.every((letter) => letter === array[0]);
103
109
  if (firstMatch) {
104
110
  return options.indexOf(firstMatch);
105
- } else if (allSameLetter(filter.split(''))) {
111
+ }
112
+ else if (allSameLetter(filter.split(''))) {
106
113
  const matches = filterOptions(orderedOptions, filter[0]);
107
114
  return options.indexOf(matches[0]);
108
- } else {
115
+ }
116
+ else {
109
117
  return -1;
110
118
  }
111
119
  }
@@ -0,0 +1,35 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import { InternalsAttachedInterface } from '../mixins/internals-attached.js';
3
+ import { MiddlewareData, Placement, Strategy } from '@floating-ui/dom';
4
+ export declare function transformOriginFromArrow(placement: Placement, arrowData?: MiddlewareData['arrow']): string;
5
+ export interface PopoverControllerConfig {
6
+ popover: () => HTMLElement | null;
7
+ trigger: () => HTMLElement | null;
8
+ positioning: {
9
+ placement: () => Placement;
10
+ strategy: () => Strategy;
11
+ offset: () => number;
12
+ windowPadding: () => number;
13
+ };
14
+ durations: {
15
+ open: () => number;
16
+ close: () => number;
17
+ };
18
+ onClickAway?: () => void;
19
+ }
20
+ export declare class PopoverController implements ReactiveController {
21
+ #private;
22
+ host: ReactiveControllerHost & InternalsAttachedInterface;
23
+ private readonly config;
24
+ private _open;
25
+ get open(): boolean;
26
+ private cleanupAutoUpdate?;
27
+ constructor(host: ReactiveControllerHost & InternalsAttachedInterface, config: PopoverControllerConfig);
28
+ hostConnected(): void;
29
+ hostDisconnected(): void;
30
+ animateOpen(): Promise<void>;
31
+ animateClose(): Promise<void>;
32
+ private cleanup;
33
+ private _dummyArrow;
34
+ reposition(): Promise<void>;
35
+ }
@@ -1,6 +1,6 @@
1
1
  import { isServer } from 'lit';
2
- import { internals } from '../mixins/internals-attached.js';
3
- import { autoUpdate, computePosition, arrow, flip, offset, shift } from '@floating-ui/dom';
2
+ import { internals, } from '../mixins/internals-attached.js';
3
+ import { autoUpdate, computePosition, arrow, flip, offset, shift, } from '@floating-ui/dom';
4
4
  export function transformOriginFromArrow(placement, arrowData) {
5
5
  const { x: arrowX, y: arrowY } = arrowData || {};
6
6
  const [side] = placement.split('-');
@@ -9,13 +9,16 @@ export function transformOriginFromArrow(placement, arrowData) {
9
9
  if (side === 'top') {
10
10
  originX = arrowX != null ? `${arrowX}px` : 'center';
11
11
  originY = 'bottom';
12
- } else if (side === 'bottom') {
12
+ }
13
+ else if (side === 'bottom') {
13
14
  originX = arrowX != null ? `${arrowX}px` : 'center';
14
15
  originY = 'top';
15
- } else if (side === 'left') {
16
+ }
17
+ else if (side === 'left') {
16
18
  originX = 'right';
17
19
  originY = arrowY != null ? `${arrowY}px` : 'center';
18
- } else if (side === 'right') {
20
+ }
21
+ else if (side === 'right') {
19
22
  originX = 'left';
20
23
  originY = arrowY != null ? `${arrowY}px` : 'center';
21
24
  }
@@ -25,7 +28,7 @@ export class PopoverController {
25
28
  get open() {
26
29
  return this._open;
27
30
  }
28
- constructor(host, config){
31
+ constructor(host, config) {
29
32
  this._open = false;
30
33
  // Different from those in the Tooltip, these timers are used to manage the
31
34
  // animation timing.
@@ -33,12 +36,14 @@ export class PopoverController {
33
36
  this.#closeTimer = null;
34
37
  // TODO: Provide the ability to specify an arrow element.
35
38
  this._dummyArrow = isServer ? null : document.createElement('div');
36
- this.#handleClickAway = (event)=>{
39
+ this.#handleClickAway = (event) => {
37
40
  const trigger = this.config.trigger();
38
41
  const popover = this.config.popover();
39
42
  const path = event.composedPath();
40
- if (trigger && path.includes(trigger)) return;
41
- if (popover && path.includes(popover)) return;
43
+ if (trigger && path.includes(trigger))
44
+ return;
45
+ if (popover && path.includes(popover))
46
+ return;
42
47
  this.config.onClickAway?.();
43
48
  };
44
49
  (this.host = host).addController(this);
@@ -54,14 +59,17 @@ export class PopoverController {
54
59
  this.cleanupAutoUpdate?.();
55
60
  window.removeEventListener('pointerup', this.#handleClickAway);
56
61
  }
62
+ // Different from those in the Tooltip, these timers are used to manage the
63
+ // animation timing.
57
64
  #openTimer;
58
65
  #closeTimer;
59
66
  async animateOpen() {
60
- if (this._open) return;
67
+ if (this._open)
68
+ return;
61
69
  this._open = true;
62
70
  // Prevent the click that triggered the open from immediately closing it
63
71
  // TODO: Use a global event listener to manage this more effectively
64
- setTimeout(()=>{
72
+ setTimeout(() => {
65
73
  if (this._open) {
66
74
  window.addEventListener('pointerup', this.#handleClickAway);
67
75
  }
@@ -75,29 +83,31 @@ export class PopoverController {
75
83
  const popover = this.config.popover();
76
84
  if (trigger && popover) {
77
85
  this.cleanupAutoUpdate?.();
78
- this.cleanupAutoUpdate = autoUpdate(trigger, popover, ()=>this.reposition());
86
+ this.cleanupAutoUpdate = autoUpdate(trigger, popover, () => this.reposition());
79
87
  // Initial position
80
88
  await this.reposition();
81
89
  }
82
90
  if (openDuration === 0) {
83
91
  this.host[internals].states.add('opened');
84
- } else {
92
+ }
93
+ else {
85
94
  // Wait for a frame to ensure the element is rendered with base styles
86
95
  // e.g. (opacity 0) before adding the opening state e.g. (opacity 1) to
87
96
  // trigger transition.
88
- requestAnimationFrame(()=>{
97
+ requestAnimationFrame(() => {
89
98
  if (this._open) {
90
99
  this.host[internals].states.add('opening');
91
100
  }
92
101
  });
93
- this.#openTimer = setTimeout(()=>{
102
+ this.#openTimer = setTimeout(() => {
94
103
  this.host[internals].states.delete('opening');
95
104
  this.host[internals].states.add('opened');
96
105
  }, openDuration);
97
106
  }
98
107
  }
99
108
  async animateClose() {
100
- if (!this._open) return;
109
+ if (!this._open)
110
+ return;
101
111
  this._open = false;
102
112
  window.removeEventListener('pointerup', this.#handleClickAway);
103
113
  clearTimeout(this.#openTimer);
@@ -110,9 +120,10 @@ export class PopoverController {
110
120
  this.cleanup();
111
121
  this.host[internals].states.delete('closing');
112
122
  this.host[internals].states.add('closed');
113
- } else {
123
+ }
124
+ else {
114
125
  this.host[internals].states.add('closing');
115
- this.#closeTimer = setTimeout(()=>{
126
+ this.#closeTimer = setTimeout(() => {
116
127
  this.cleanup();
117
128
  this.host[internals].states.delete('closing');
118
129
  this.host[internals].states.add('closed');
@@ -126,28 +137,25 @@ export class PopoverController {
126
137
  reposition() {
127
138
  const trigger = this.config.trigger();
128
139
  const popover = this.config.popover();
129
- if (!trigger || !popover) return Promise.resolve();
140
+ if (!trigger || !popover)
141
+ return Promise.resolve();
130
142
  return computePosition(trigger, popover, {
131
143
  placement: this.config.positioning.placement(),
132
144
  strategy: this.config.positioning.strategy(),
133
145
  middleware: [
134
146
  offset(this.config.positioning.offset()),
135
- flip({
136
- padding: this.config.positioning.windowPadding()
137
- }),
147
+ flip({ padding: this.config.positioning.windowPadding() }),
138
148
  shift({
139
149
  padding: this.config.positioning.windowPadding(),
140
- crossAxis: true
150
+ crossAxis: true,
141
151
  }),
142
- arrow({
143
- element: this._dummyArrow
144
- })
145
- ]
146
- }).then(({ x, y, placement, middlewareData })=>{
152
+ arrow({ element: this._dummyArrow }),
153
+ ],
154
+ }).then(({ x, y, placement, middlewareData }) => {
147
155
  Object.assign(popover.style, {
148
156
  left: `${x}px`,
149
157
  top: `${y}px`,
150
- transformOrigin: transformOriginFromArrow(placement, middlewareData.arrow)
158
+ transformOrigin: transformOriginFromArrow(placement, middlewareData.arrow),
151
159
  });
152
160
  });
153
161
  }
@@ -0,0 +1,20 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * @csspart dialog
4
+ *
5
+ * Example `render()`:
6
+ *
7
+ * ```
8
+ * <dialog
9
+ * part="dialog"
10
+ * @cancel="${this._handleCancel}">
11
+ * <slot></slot>
12
+ * </dialog>
13
+ * ```
14
+ */
15
+ export declare class Dialog extends LitElement {
16
+ $dialog: HTMLDialogElement;
17
+ _handleCancel: (e: Event) => void;
18
+ show(): void;
19
+ close(): void;
20
+ }
@@ -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 { query } from 'lit/decorators.js';
4
4
  /**
@@ -13,20 +13,22 @@ import { query } from 'lit/decorators.js';
13
13
  * <slot></slot>
14
14
  * </dialog>
15
15
  * ```
16
- */ export class Dialog extends LitElement {
16
+ */
17
+ export class Dialog extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this._handleCancel = (e) => {
21
+ e.preventDefault();
22
+ this.close();
23
+ };
24
+ }
17
25
  show() {
18
26
  this.$dialog.showModal();
19
27
  }
20
28
  close() {
21
29
  this.$dialog.close();
22
30
  }
23
- constructor(...args){
24
- super(...args), this._handleCancel = (e)=>{
25
- e.preventDefault();
26
- this.close();
27
- };
28
- }
29
31
  }
30
- _ts_decorate([
32
+ __decorate([
31
33
  query('dialog')
32
34
  ], Dialog.prototype, "$dialog", void 0);
@@ -0,0 +1,3 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class Field extends LitElement {
3
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018-2023 Google, Inc.
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { LitElement, PropertyValues } from 'lit';
7
+ declare const Base: Constructor<import("./mixins/form-associated.js").FormAssociatedInterface> & Constructor<import("./mixins/focus-delegated.js").FocusDelegatedInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
8
+ export declare class Input extends Base {
9
+ type: string;
10
+ value: string;
11
+ placeholder: string;
12
+ required: boolean;
13
+ readOnly: boolean;
14
+ /**
15
+ * Whether the input accepts multiple values (e.g. email).
16
+ */
17
+ multiple: boolean;
18
+ min: string;
19
+ max: string;
20
+ step: string;
21
+ minLength: number;
22
+ maxLength: number;
23
+ /**
24
+ * The pattern regex.
25
+ */
26
+ pattern: string;
27
+ autocomplete: string;
28
+ focused: boolean;
29
+ $inputOrTextarea: HTMLInputElement | HTMLTextAreaElement;
30
+ render(): import("lit-html").TemplateResult<1>;
31
+ protected updated(changedProperties: PropertyValues): void;
32
+ private handleInput;
33
+ private handleChange;
34
+ private handleFocus;
35
+ private handleBlur;
36
+ private redispatchEvent;
37
+ private syncValidity;
38
+ select(): void;
39
+ stepUp(n?: number): void;
40
+ stepDown(n?: number): void;
41
+ formResetCallback(): void;
42
+ formStateRestoreCallback(state: string): void;
43
+ }
44
+ export {};
package/src/base/input.js CHANGED
@@ -1,9 +1,10 @@
1
- import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
1
  /**
3
2
  * @license
4
3
  * Copyright 2018-2023 Google, Inc.
5
4
  * SPDX-License-Identifier: Apache-2.0
6
- */ import { LitElement, html, nothing } from 'lit';
5
+ */
6
+ import { __decorate } from "tslib";
7
+ import { LitElement, html, nothing } from 'lit';
7
8
  import { property, query } from 'lit/decorators.js';
8
9
  import { live } from 'lit/directives/live.js';
9
10
  import { InternalsAttached, internals } from './mixins/internals-attached.js';
@@ -11,14 +12,37 @@ import { FocusDelegated } from './mixins/focus-delegated.js';
11
12
  import { FormAssociated } from './mixins/form-associated.js';
12
13
  const Base = FormAssociated(FocusDelegated(InternalsAttached(LitElement)));
13
14
  export class Input extends Base {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.type = 'text';
18
+ this.value = '';
19
+ this.placeholder = '';
20
+ this.required = false;
21
+ this.readOnly = false;
22
+ /**
23
+ * Whether the input accepts multiple values (e.g. email).
24
+ */
25
+ this.multiple = false;
26
+ this.min = '';
27
+ this.max = '';
28
+ this.step = '';
29
+ this.minLength = -1;
30
+ this.maxLength = -1;
31
+ /**
32
+ * The pattern regex.
33
+ */
34
+ this.pattern = '';
35
+ this.autocomplete = '';
36
+ this.focused = false;
37
+ }
14
38
  render() {
15
39
  const isTextarea = this.type === 'textarea';
16
40
  const minLength = this.minLength > -1 ? this.minLength : nothing;
17
41
  const maxLength = this.maxLength > -1 ? this.maxLength : nothing;
18
42
  if (isTextarea) {
19
- return html`<textarea part="input" .value="${live(this.value)}" placeholder="${this.placeholder || nothing}" ?required="${this.required}" ?readonly="${this.readOnly}" ?disabled="${this.disabled}" minlength="${minLength}" maxlength="${maxLength}" autocomplete="${this.autocomplete || nothing}" @input="${this.handleInput}" @change="${this.handleChange}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"></textarea>`;
43
+ return html `<textarea part="input" .value="${live(this.value)}" placeholder="${(this.placeholder || nothing)}" ?required="${this.required}" ?readonly="${this.readOnly}" ?disabled="${this.disabled}" minlength="${minLength}" maxlength="${maxLength}" autocomplete="${(this.autocomplete || nothing)}" @input="${this.handleInput}" @change="${this.handleChange}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"></textarea>`;
20
44
  }
21
- return html`<input part="input" type="${this.type}" .value="${live(this.value)}" placeholder="${this.placeholder || nothing}" ?required="${this.required}" ?readonly="${this.readOnly}" ?disabled="${this.disabled}" ?multiple="${this.multiple}" min="${this.min || nothing}" max="${this.max || nothing}" step="${this.step || nothing}" minlength="${minLength}" maxlength="${maxLength}" pattern="${this.pattern || nothing}" autocomplete="${this.autocomplete || nothing}" @input="${this.handleInput}" @change="${this.handleChange}" @focus="${this.handleFocus}" @blur="${this.handleBlur}">`;
45
+ return html `<input part="input" type="${this.type}" .value="${live(this.value)}" placeholder="${(this.placeholder || nothing)}" ?required="${this.required}" ?readonly="${this.readOnly}" ?disabled="${this.disabled}" ?multiple="${this.multiple}" min="${(this.min || nothing)}" max="${(this.max || nothing)}" step="${(this.step || nothing)}" minlength="${minLength}" maxlength="${maxLength}" pattern="${(this.pattern || nothing)}" autocomplete="${(this.autocomplete || nothing)}" @input="${this.handleInput}" @change="${this.handleChange}" @focus="${this.handleFocus}" @blur="${this.handleBlur}">`;
22
46
  }
23
47
  updated(changedProperties) {
24
48
  super.updated(changedProperties);
@@ -46,12 +70,13 @@ export class Input extends Base {
46
70
  const newEvent = new Event(event.type, {
47
71
  bubbles: event.bubbles,
48
72
  cancelable: event.cancelable,
49
- composed: true
73
+ composed: true,
50
74
  });
51
75
  this.dispatchEvent(newEvent);
52
76
  }
53
77
  syncValidity() {
54
- if (!this.$inputOrTextarea) return;
78
+ if (!this.$inputOrTextarea)
79
+ return;
55
80
  this[internals].setValidity(this.$inputOrTextarea.validity, this.$inputOrTextarea.validationMessage, this.$inputOrTextarea);
56
81
  }
57
82
  select() {
@@ -59,15 +84,11 @@ export class Input extends Base {
59
84
  }
60
85
  stepUp(n) {
61
86
  this.$inputOrTextarea?.stepUp(n);
62
- this.handleInput({
63
- target: this.$inputOrTextarea
64
- });
87
+ this.handleInput({ target: this.$inputOrTextarea });
65
88
  }
66
89
  stepDown(n) {
67
90
  this.$inputOrTextarea?.stepDown(n);
68
- this.handleInput({
69
- target: this.$inputOrTextarea
70
- });
91
+ this.handleInput({ target: this.$inputOrTextarea });
71
92
  }
72
93
  formResetCallback() {
73
94
  this.value = this.getAttribute('value') || '';
@@ -77,78 +98,49 @@ export class Input extends Base {
77
98
  this.value = state;
78
99
  this.syncValidity();
79
100
  }
80
- constructor(...args){
81
- super(...args), this.type = 'text', this.value = '', this.placeholder = '', this.required = false, this.readOnly = false, /**
82
- * Whether the input accepts multiple values (e.g. email).
83
- */ this.multiple = false, this.min = '', this.max = '', this.step = '', this.minLength = -1, this.maxLength = -1, /**
84
- * The pattern regex.
85
- */ this.pattern = '', this.autocomplete = '', this.focused = false;
86
- }
87
101
  }
88
- _ts_decorate([
89
- property({
90
- reflect: true
91
- })
102
+ __decorate([
103
+ property({ reflect: true })
92
104
  ], Input.prototype, "type", void 0);
93
- _ts_decorate([
105
+ __decorate([
94
106
  property()
95
107
  ], Input.prototype, "value", void 0);
96
- _ts_decorate([
97
- property({
98
- reflect: true
99
- })
108
+ __decorate([
109
+ property({ reflect: true })
100
110
  ], Input.prototype, "placeholder", void 0);
101
- _ts_decorate([
102
- property({
103
- type: Boolean,
104
- reflect: true
105
- })
111
+ __decorate([
112
+ property({ type: Boolean, reflect: true })
106
113
  ], Input.prototype, "required", void 0);
107
- _ts_decorate([
108
- property({
109
- type: Boolean,
110
- reflect: true
111
- })
114
+ __decorate([
115
+ property({ type: Boolean, reflect: true })
112
116
  ], Input.prototype, "readOnly", void 0);
113
- _ts_decorate([
114
- property({
115
- type: Boolean,
116
- reflect: true
117
- })
117
+ __decorate([
118
+ property({ type: Boolean, reflect: true })
118
119
  ], Input.prototype, "multiple", void 0);
119
- _ts_decorate([
120
+ __decorate([
120
121
  property()
121
122
  ], Input.prototype, "min", void 0);
122
- _ts_decorate([
123
+ __decorate([
123
124
  property()
124
125
  ], Input.prototype, "max", void 0);
125
- _ts_decorate([
126
+ __decorate([
126
127
  property()
127
128
  ], Input.prototype, "step", void 0);
128
- _ts_decorate([
129
- property({
130
- type: Number
131
- })
129
+ __decorate([
130
+ property({ type: Number })
132
131
  ], Input.prototype, "minLength", void 0);
133
- _ts_decorate([
134
- property({
135
- type: Number
136
- })
132
+ __decorate([
133
+ property({ type: Number })
137
134
  ], Input.prototype, "maxLength", void 0);
138
- _ts_decorate([
135
+ __decorate([
139
136
  property()
140
137
  ], Input.prototype, "pattern", void 0);
141
- _ts_decorate([
142
- property({
143
- reflect: true
144
- })
138
+ __decorate([
139
+ property({ reflect: true })
145
140
  ], Input.prototype, "autocomplete", void 0);
146
- _ts_decorate([
147
- property({
148
- type: Boolean,
149
- reflect: true
150
- })
141
+ __decorate([
142
+ property({ type: Boolean, reflect: true })
151
143
  ], Input.prototype, "focused", void 0);
152
- _ts_decorate([
144
+ __decorate([
153
145
  query('[part~=input]')
154
146
  ], Input.prototype, "$inputOrTextarea", void 0);
@@ -0,0 +1,7 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * This class works as a "UI item", it should be contained in menu items,
4
+ * options, etc.
5
+ */
6
+ export declare class Item extends LitElement {
7
+ }
package/src/base/item.js CHANGED
@@ -2,5 +2,6 @@ import { LitElement } from 'lit';
2
2
  /**
3
3
  * This class works as a "UI item", it should be contained in menu items,
4
4
  * options, etc.
5
- */ export class Item extends LitElement {
5
+ */
6
+ export class Item extends LitElement {
6
7
  }
@@ -0,0 +1,15 @@
1
+ import { LitElement } from 'lit';
2
+ declare const ListItem_base: Constructor<import("./mixins/form-associated.js").FormAssociatedInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
3
+ export declare class ListItem extends ListItem_base {
4
+ #private;
5
+ _role: string;
6
+ static styles: any[];
7
+ selected: boolean;
8
+ focused: boolean;
9
+ get displayText(): string;
10
+ connectedCallback(): void;
11
+ protected updated(changed: Map<string, any>): void;
12
+ focus(): void;
13
+ blur(): void;
14
+ }
15
+ export {};