kr-elements 0.0.1-alpha.1

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.
@@ -0,0 +1,313 @@
1
+ import { ComboboxMarkup } from './Combobox.markup.js';
2
+ import { HTMLComboboxOptionElement } from './HTML.combobox.option.element.js';
3
+ import { toBoolean } from './Boolean.attribute.value.normalizer.js';
4
+ export class HTMLComboboxElement extends HTMLElement {
5
+ static stringAttributes = new Set(['value', 'placeholder', 'query']);
6
+ static booleanAttributes = new Set(['required', 'disabled', 'clearable', 'multiple', 'filterable', 'searchable']);
7
+ static observerOptions = { childList: true, attributes: false, subtree: false };
8
+ static styleSheet = [new CSSStyleSheet];
9
+ static formAssociated = true;
10
+ internals;
11
+ shadowRoot;
12
+ #observer;
13
+ #markup;
14
+ #values = new Set;
15
+ constructor() {
16
+ super();
17
+ this.internals = this.attachInternals();
18
+ this.internals.role = "combobox";
19
+ this.shadowRoot = this.attachShadow({ mode: 'closed', delegatesFocus: true });
20
+ this.#markup = new ComboboxMarkup(this.shadowRoot, this.internals);
21
+ this.shadowRoot.innerHTML = ComboboxMarkup.template;
22
+ this.shadowRoot.adoptedStyleSheets = HTMLComboboxElement.styleSheet;
23
+ this.#observer = new MutationObserver(this.#onOptionsChanges);
24
+ }
25
+ connectedCallback() {
26
+ this.#markup.connect();
27
+ this.#initialAttributesSynchronization();
28
+ this.#onOptionsChanges([{ addedNodes: Array.from(this.children) }]);
29
+ this.#observer.observe(this, HTMLComboboxElement.observerOptions);
30
+ this.#markup.clearAllButton.addEventListener('click', this.#onClickClearAllButton);
31
+ this.#markup.searchInput.addEventListener('input', this.#onInput);
32
+ }
33
+ disconnectedCallback() {
34
+ this.#observer.disconnect();
35
+ this.#markup.disconnect();
36
+ }
37
+ formResetCallback() {
38
+ this.#values = new Set;
39
+ this.selectedOptions.forEach(option => option.removeAttribute('selected'));
40
+ this.#markup.tagsContainer.replaceChildren();
41
+ this.#setValidityAndFormValue();
42
+ this.dispatchEvent(new Event('change'));
43
+ }
44
+ formDisabledCallback(isDisabled) {
45
+ this.disabled = isDisabled;
46
+ }
47
+ get valueAsArray() {
48
+ return Array.from(this.#values);
49
+ }
50
+ get selectedOptions() {
51
+ return this.#markup.selectedOptions;
52
+ }
53
+ get validity() {
54
+ return this.internals.validity;
55
+ }
56
+ get willValidate() {
57
+ return this.internals.willValidate;
58
+ }
59
+ get value() {
60
+ return this.valueAsArray.join(',');
61
+ }
62
+ set value(value) {
63
+ if (this.value === value || typeof value !== 'string')
64
+ return;
65
+ const prevValue = new Set(this.#values);
66
+ this.#values = new Set;
67
+ const values = value.split(',').filter(Boolean);
68
+ Promise.resolve(values)
69
+ .then(values => {
70
+ if (values.length) {
71
+ if (!this.multiple) {
72
+ if (this.#values.size === 0) {
73
+ values.length = 1;
74
+ }
75
+ else {
76
+ values.length = 0;
77
+ }
78
+ }
79
+ for (const key of values) {
80
+ const option = this.#markup.getOptionByValue(key);
81
+ if (option)
82
+ this.#selectOption(option);
83
+ }
84
+ }
85
+ for (const key of prevValue) {
86
+ if (this.#values.has(key))
87
+ continue;
88
+ const option = this.#markup.getOptionByValue(key);
89
+ const tag = this.#markup.getTagByValue(key);
90
+ tag?.remove();
91
+ option?.toggleAttribute('selected', false);
92
+ }
93
+ });
94
+ }
95
+ get query() {
96
+ return this.#markup.searchInput.value;
97
+ }
98
+ set query(value) {
99
+ if (value === this.query)
100
+ return;
101
+ this.#markup.searchInput.value = value;
102
+ super.setAttribute('query', value);
103
+ }
104
+ get clearable() {
105
+ return this.hasAttribute('clearable');
106
+ }
107
+ set clearable(value) {
108
+ super.toggleAttribute('clearable', value);
109
+ }
110
+ get multiple() {
111
+ return this.hasAttribute('multiple');
112
+ }
113
+ set multiple(value) {
114
+ super.toggleAttribute('multiple', value);
115
+ }
116
+ get filterable() {
117
+ return this.hasAttribute('filterable');
118
+ }
119
+ set filterable(value) {
120
+ super.toggleAttribute('filterable', value);
121
+ }
122
+ get searchable() {
123
+ return this.hasAttribute('searchable');
124
+ }
125
+ set searchable(value) {
126
+ super.toggleAttribute('searchable', value);
127
+ }
128
+ get disabled() {
129
+ return this.hasAttribute('disabled');
130
+ }
131
+ set disabled(value) {
132
+ this.internals.ariaDisabled = String(value);
133
+ super.toggleAttribute('disabled', value);
134
+ }
135
+ get required() {
136
+ return this.hasAttribute('required');
137
+ }
138
+ set required(value) {
139
+ this.internals.ariaRequired = String(value);
140
+ super.toggleAttribute('required', value);
141
+ }
142
+ get placeholder() {
143
+ return this.#markup.searchInput.placeholder;
144
+ }
145
+ set placeholder(value) {
146
+ this.#markup.placeholder.innerText = value;
147
+ this.#markup.searchInput.placeholder = value;
148
+ super.setAttribute('placeholder', value);
149
+ }
150
+ setAttribute(name, value) {
151
+ if (HTMLComboboxElement.booleanAttributes.has(name)) {
152
+ Reflect.set(this, name, toBoolean(value));
153
+ return;
154
+ }
155
+ if (HTMLComboboxElement.stringAttributes.has(name)) {
156
+ Reflect.set(this, name, value);
157
+ return;
158
+ }
159
+ super.setAttribute(name, value);
160
+ }
161
+ removeAttribute(name) {
162
+ if (HTMLComboboxElement.booleanAttributes.has(name)) {
163
+ Reflect.set(this, name, false);
164
+ return;
165
+ }
166
+ if (HTMLComboboxElement.stringAttributes.has(name)) {
167
+ return;
168
+ }
169
+ super.removeAttribute(name);
170
+ }
171
+ reportValidity() {
172
+ this.internals.reportValidity();
173
+ }
174
+ checkValidity() {
175
+ this.internals.checkValidity();
176
+ }
177
+ setCustomValidity(message) {
178
+ if (message === '') {
179
+ this.internals.setValidity({});
180
+ }
181
+ else {
182
+ this.internals.setValidity({ customError: true }, message);
183
+ }
184
+ }
185
+ #onInput = (event) => {
186
+ if (this.filterable) {
187
+ if (event.target && event.target instanceof HTMLInputElement) {
188
+ this.#markup.sort(event.target.value);
189
+ }
190
+ }
191
+ };
192
+ #onOptionsChanges = (records) => {
193
+ records.forEach(record => {
194
+ record.addedNodes.forEach(node => {
195
+ if (node instanceof HTMLComboboxOptionElement) {
196
+ node.addEventListener('click', this.#onSelectOption);
197
+ if (node.selected) {
198
+ if (this.multiple) {
199
+ this.#selectOption(node);
200
+ }
201
+ else if (this.#values.size === 0) {
202
+ this.#selectOption(node);
203
+ }
204
+ }
205
+ }
206
+ if (node instanceof HTMLComboboxOptionElement || node instanceof HTMLOptGroupElement) {
207
+ this.#markup.optionsContainer.append(node);
208
+ }
209
+ });
210
+ });
211
+ this.#setValidityAndFormValue();
212
+ };
213
+ #selectOption(option) {
214
+ if (this.#values.has(option.value))
215
+ return;
216
+ const value = option.value;
217
+ this.#values.add(value);
218
+ option.toggleAttribute('selected', true);
219
+ const control = this.#markup.createAndAppendTag(option);
220
+ control.addEventListener('click', this.#onClickTagClearButton);
221
+ }
222
+ #onSelectOption = (event) => {
223
+ let option;
224
+ if (event.target instanceof HTMLComboboxOptionElement) {
225
+ option = event.target;
226
+ }
227
+ else {
228
+ option = event.composedPath()
229
+ .find(el => el instanceof HTMLComboboxOptionElement);
230
+ }
231
+ if (option) {
232
+ if (this.#values.has(option.value))
233
+ return;
234
+ if (!this.multiple) {
235
+ this.#values.forEach(value => {
236
+ this.#markup.getTagByValue(value)?.remove();
237
+ this.#markup.getOptionByValue(value)?.toggleAttribute('selected', false);
238
+ });
239
+ this.#values.clear();
240
+ this.#markup.tagsContainer.replaceChildren();
241
+ }
242
+ this.#selectOption(option);
243
+ this.#setValidityAndFormValue();
244
+ this.dispatchEvent(new Event('change'));
245
+ }
246
+ };
247
+ #onClickTagClearButton = (event) => {
248
+ if (event.target && event.target instanceof HTMLButtonElement) {
249
+ const value = event.target.value;
250
+ const option = this.#markup.getOptionByValue(value);
251
+ const tag = this.#markup.getTagByValue(value);
252
+ option.removeAttribute('selected');
253
+ this.#values.delete(event.target.value);
254
+ tag.remove();
255
+ this.#setValidityAndFormValue();
256
+ this.dispatchEvent(new Event('change'));
257
+ }
258
+ };
259
+ #onClickClearAllButton = () => {
260
+ this.formResetCallback();
261
+ };
262
+ #setValidityAndFormValue() {
263
+ this.internals.setFormValue(this.value);
264
+ if (this.required && this.value === '') {
265
+ this.internals.setValidity({ valueMissing: true });
266
+ }
267
+ else {
268
+ this.internals.setValidity({});
269
+ }
270
+ }
271
+ #initialAttributesSynchronization() {
272
+ for (const key of HTMLComboboxElement.booleanAttributes) {
273
+ const value = toBoolean(this.getAttribute(key));
274
+ Reflect.set(this, key, value);
275
+ }
276
+ for (const key of HTMLComboboxElement.stringAttributes) {
277
+ if (this.hasAttribute(key)) {
278
+ Reflect.set(this, key, this.getAttribute(key));
279
+ }
280
+ }
281
+ }
282
+ static staticLoadCssByUrls(urls) {
283
+ }
284
+ static loadCssFromDocumentStyleSheets() {
285
+ if (document.readyState === 'complete') {
286
+ HTMLComboboxElement.#loadDocumentStyleSheets();
287
+ }
288
+ if (document.readyState === 'loading') {
289
+ document.addEventListener('DOMContentLoaded', HTMLComboboxElement.#loadDocumentStyleSheets);
290
+ }
291
+ if (document.readyState === 'interactive') {
292
+ queueMicrotask(HTMLComboboxElement.#loadDocumentStyleSheets);
293
+ }
294
+ }
295
+ static #loadDocumentStyleSheets() {
296
+ const [innerSheet] = HTMLComboboxElement.styleSheet;
297
+ for (const outerSheet of document.styleSheets) {
298
+ for (const rule of outerSheet.cssRules) {
299
+ innerSheet.insertRule(rule.cssText, innerSheet.cssRules.length);
300
+ }
301
+ }
302
+ }
303
+ }
304
+ document.addEventListener('keypress', (event) => {
305
+ if (document.activeElement instanceof HTMLComboboxElement) {
306
+ if (document.activeElement.shadowRoot.activeElement instanceof HTMLComboboxOptionElement) {
307
+ document.activeElement.shadowRoot.activeElement.click();
308
+ }
309
+ }
310
+ });
311
+ if (!window.customElements.get('combo-box')) {
312
+ window.customElements.define('combo-box', HTMLComboboxElement);
313
+ }
@@ -0,0 +1,91 @@
1
+ import { toBoolean } from './Boolean.attribute.value.normalizer.js';
2
+ export class HTMLComboboxOptionElement extends HTMLElement {
3
+ static booleanAttributes = new Set(['selected']);
4
+ static stringAttributes = new Set(['value', 'label']);
5
+ connectedCallback() {
6
+ this.#initialAttributesSynchronization();
7
+ super.setAttribute('part', 'box-option');
8
+ super.setAttribute('tabindex', "0");
9
+ super.setAttribute('role', "option");
10
+ if (this.children.length === 0) {
11
+ this.textContent = this.label;
12
+ }
13
+ }
14
+ get value() {
15
+ return this.getAttribute('value');
16
+ }
17
+ set value(value) {
18
+ value = this.#getOrExtractValue(value, 'value');
19
+ super.setAttribute('value', value);
20
+ }
21
+ get label() {
22
+ return this.getAttribute('value');
23
+ }
24
+ set label(value) {
25
+ value = this.#getOrExtractValue(value, 'label');
26
+ super.setAttribute('label', value);
27
+ }
28
+ get selected() {
29
+ return this.hasAttribute('selected');
30
+ }
31
+ set selected(value) {
32
+ super.toggleAttribute('selected', toBoolean(value));
33
+ }
34
+ #initialAttributesSynchronization() {
35
+ for (const key of HTMLComboboxOptionElement.booleanAttributes) {
36
+ const value = toBoolean(this.getAttribute(key));
37
+ Reflect.set(this, key, value);
38
+ }
39
+ for (const key of HTMLComboboxOptionElement.stringAttributes) {
40
+ Reflect.set(this, key, this.getAttribute(key));
41
+ }
42
+ }
43
+ get #optionHasOnlyTextNode() {
44
+ return this.children.length === 0 && this.textContent.length > 0;
45
+ }
46
+ #getOrExtractValue(value, name) {
47
+ if (typeof value === 'string')
48
+ return value;
49
+ if (value == null) {
50
+ const opposite = name === 'label' ? 'value' : 'label';
51
+ const oppositeValue = this.getAttribute(opposite);
52
+ if (oppositeValue) {
53
+ value = oppositeValue;
54
+ }
55
+ else {
56
+ if (this.#optionHasOnlyTextNode) {
57
+ value = this.textContent;
58
+ }
59
+ else {
60
+ throw new TypeError('No value, or label or textContent found');
61
+ }
62
+ }
63
+ return value;
64
+ }
65
+ throw new TypeError('Invalid value');
66
+ }
67
+ setAttribute(name, value) {
68
+ if (HTMLComboboxOptionElement.booleanAttributes.has(name)) {
69
+ Reflect.set(this, name, toBoolean(value));
70
+ return;
71
+ }
72
+ if (HTMLComboboxOptionElement.stringAttributes.has(name)) {
73
+ Reflect.set(this, name, value);
74
+ return;
75
+ }
76
+ super.setAttribute(name, value);
77
+ }
78
+ removeAttribute(name) {
79
+ if (HTMLComboboxOptionElement.stringAttributes.has(name)) {
80
+ Reflect.set(this, name, false);
81
+ return;
82
+ }
83
+ if (HTMLComboboxOptionElement.stringAttributes.has(name)) {
84
+ return;
85
+ }
86
+ super.removeAttribute(name);
87
+ }
88
+ }
89
+ if (!window.customElements.get('box-option')) {
90
+ window.customElements.define('box-option', HTMLComboboxOptionElement);
91
+ }
@@ -0,0 +1,18 @@
1
+ export class HTMLComboboxTagElement extends HTMLElement {
2
+ connectedCallback() {
3
+ this.part.add('box-tag');
4
+ if (this.parentElement) {
5
+ if (this.parentElement.hasAttribute('multiple')) {
6
+ if (!this.querySelector('[part="tag-clear-button"]')) {
7
+ throw new Error(`A <button> with part="tag-clear-button" is required for <combo-box> with multiple attribute`);
8
+ }
9
+ }
10
+ if (!this.querySelector('[part="tag-label"]')) {
11
+ throw new Error(`Invalid <box-tag-template>, an element with part="tag-label" is required as a descendant`);
12
+ }
13
+ }
14
+ }
15
+ }
16
+ if (!window.customElements.get('box-tag')) {
17
+ window.customElements.define('box-tag', HTMLComboboxTagElement);
18
+ }
@@ -0,0 +1 @@
1
+ export * from './HTML.combobox.element.js';
@@ -0,0 +1,2 @@
1
+ export declare function toBoolean(value: any): boolean;
2
+ //# sourceMappingURL=Boolean.attribute.value.normalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Boolean.attribute.value.normalizer.d.ts","sourceRoot":"","sources":["../../src/combobox/Boolean.attribute.value.normalizer.ts"],"names":[],"mappings":"AACA,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,WAInC"}
@@ -0,0 +1,26 @@
1
+ import { HTMLComboboxTagElement } from './HTML.combobox.tag.element.js';
2
+ import { HTMLComboboxOptionElement } from './HTML.combobox.option.element.js';
3
+ export declare class ComboboxMarkup {
4
+ #private;
5
+ tagsContainer: HTMLDivElement | null;
6
+ optionsContainer: HTMLDivElement | null;
7
+ clearAllButton: HTMLButtonElement | null;
8
+ dropdown: HTMLDivElement | null;
9
+ placeholder: HTMLDivElement | null;
10
+ searchInput: HTMLInputElement | null;
11
+ constructor(shadowRoot: ShadowRoot, internals: ElementInternals);
12
+ connect(): void;
13
+ sort(query: string): void;
14
+ disconnect(): void;
15
+ onPageScroll: () => void;
16
+ setDropdownPosition(rect: DOMRect): void;
17
+ showDropdown: () => void;
18
+ hideDropdown: (event: Event) => void;
19
+ createAndAppendTag(option: HTMLComboboxOptionElement): HTMLButtonElement;
20
+ getTagByValue(value: string): HTMLComboboxTagElement;
21
+ getOptionByValue(value: string): HTMLComboboxOptionElement;
22
+ get tagTemplate(): HTMLComboboxTagElement;
23
+ get selectedOptions(): NodeListOf<HTMLComboboxOptionElement>;
24
+ static get template(): string;
25
+ }
26
+ //# sourceMappingURL=Combobox.markup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.markup.d.ts","sourceRoot":"","sources":["../../src/combobox/Combobox.markup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,qBAAa,cAAc;;IAGzB,aAAa,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC5C,gBAAgB,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC/C,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAChD,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAQ;IACvC,WAAW,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC1C,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAQ;gBAEhC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB;IAU/D,OAAO;IASP,IAAI,CAAC,KAAK,EAAE,MAAM;IAiBlB,UAAU;IAQV,YAAY,aAIX;IAED,mBAAmB,CAAC,IAAI,EAAE,OAAO;IAmBjC,YAAY,aAUX;IAED,YAAY,UAAW,KAAK,UAU3B;IAED,kBAAkB,CAAC,MAAM,EAAE,yBAAyB;IAqBpD,aAAa,CAAC,KAAK,EAAE,MAAM;IAI3B,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAI9B,IAAI,WAAW,2BAQd;IAGD,IAAI,eAAe,0CAGlB;IAED,MAAM,KAAK,QAAQ,WAgLlB;CACF"}
@@ -0,0 +1,50 @@
1
+ import { HTMLComboboxOptionElement } from './HTML.combobox.option.element.js';
2
+ export declare class HTMLComboboxElement extends HTMLElement {
3
+ #private;
4
+ static stringAttributes: Set<string>;
5
+ static booleanAttributes: Set<string>;
6
+ static observerOptions: {
7
+ childList: boolean;
8
+ attributes: boolean;
9
+ subtree: boolean;
10
+ };
11
+ static styleSheet: CSSStyleSheet[];
12
+ static formAssociated: boolean;
13
+ internals: ElementInternals;
14
+ shadowRoot: ShadowRoot;
15
+ constructor();
16
+ connectedCallback(): void;
17
+ disconnectedCallback(): void;
18
+ formResetCallback(): void;
19
+ formDisabledCallback(isDisabled: boolean): void;
20
+ get valueAsArray(): string[];
21
+ get selectedOptions(): NodeListOf<HTMLComboboxOptionElement>;
22
+ get validity(): ValidityState;
23
+ get willValidate(): boolean;
24
+ get value(): string;
25
+ set value(value: string);
26
+ get query(): string;
27
+ set query(value: string);
28
+ get clearable(): boolean;
29
+ set clearable(value: boolean);
30
+ get multiple(): boolean;
31
+ set multiple(value: boolean);
32
+ get filterable(): boolean;
33
+ set filterable(value: boolean);
34
+ get searchable(): boolean;
35
+ set searchable(value: boolean);
36
+ get disabled(): boolean;
37
+ set disabled(value: boolean);
38
+ get required(): boolean;
39
+ set required(value: boolean);
40
+ get placeholder(): string;
41
+ set placeholder(value: string);
42
+ setAttribute(name: string, value: any): void;
43
+ removeAttribute(name: string): void;
44
+ reportValidity(): void;
45
+ checkValidity(): void;
46
+ setCustomValidity(message: string): void;
47
+ static staticLoadCssByUrls(urls: string[]): void;
48
+ static loadCssFromDocumentStyleSheets(): void;
49
+ }
50
+ //# sourceMappingURL=HTML.combobox.element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTML.combobox.element.d.ts","sourceRoot":"","sources":["../../src/combobox/HTML.combobox.element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAG9E,qBAAa,mBAAoB,SAAQ,WAAW;;IAClD,MAAM,CAAC,gBAAgB,cAAgD;IACvE,MAAM,CAAC,iBAAiB,cAA4F;IACpH,MAAM,CAAC,eAAe;;;;MAA0D;IAChF,MAAM,CAAC,UAAU,kBAAuB;IACxC,MAAM,CAAC,cAAc,UAAQ;IAE7B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,UAAU,EAAE,UAAU,CAAC;;IAkBvB,iBAAiB;IASjB,oBAAoB;IAKpB,iBAAiB;IAQjB,oBAAoB,CAAC,UAAU,EAAE,OAAO;IAMxC,IAAI,YAAY,aAEf;IACD,IAAI,eAAe,0CAElB;IACD,IAAI,QAAQ,kBAEX;IACD,IAAI,YAAY,YAEf;IAGD,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAgCtB;IAED,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAItB;IAED,IAAI,SAAS,YAEZ;IACD,IAAI,SAAS,CAAC,KAAK,SAAA,EAElB;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAED,IAAI,UAAU,YAEb;IACD,IAAI,UAAU,CAAC,KAAK,SAAA,EAEnB;IAED,IAAI,UAAU,YAEb;IACD,IAAI,UAAU,CAAC,KAAK,SAAA,EAEnB;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAGjB;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAGjB;IAED,IAAI,WAAW,WAEd;IACD,IAAI,WAAW,CAAC,KAAK,QAAA,EAIpB;IAID,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAYrC,eAAe,CAAC,IAAI,EAAE,MAAM;IAW5B,cAAc;IAId,aAAa;IAIb,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAgHjC,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE;IAIzC,MAAM,CAAC,8BAA8B;CAoBtC"}
@@ -0,0 +1,15 @@
1
+ export declare class HTMLComboboxOptionElement extends HTMLElement {
2
+ #private;
3
+ static booleanAttributes: Set<string>;
4
+ static stringAttributes: Set<string>;
5
+ connectedCallback(): void;
6
+ get value(): string;
7
+ set value(value: string);
8
+ get label(): string;
9
+ set label(value: string);
10
+ get selected(): boolean;
11
+ set selected(value: boolean);
12
+ setAttribute(name: string, value: string): void;
13
+ removeAttribute(name: string): void;
14
+ }
15
+ //# sourceMappingURL=HTML.combobox.option.element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTML.combobox.option.element.d.ts","sourceRoot":"","sources":["../../src/combobox/HTML.combobox.option.element.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,WAAW;;IACxD,MAAM,CAAC,iBAAiB,cAAyB;IACjD,MAAM,CAAC,gBAAgB,cAA+B;IAEtD,iBAAiB;IAUjB,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAoCD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAYxC,eAAe,CAAC,IAAI,EAAE,MAAM;CAU7B"}
@@ -0,0 +1,4 @@
1
+ export declare class HTMLComboboxTagElement extends HTMLElement {
2
+ connectedCallback(): void;
3
+ }
4
+ //# sourceMappingURL=HTML.combobox.tag.element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HTML.combobox.tag.element.d.ts","sourceRoot":"","sources":["../../src/combobox/HTML.combobox.tag.element.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,iBAAiB;CAalB"}
@@ -0,0 +1,2 @@
1
+ export * from './HTML.combobox.element.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/combobox/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "kr-elements",
3
+ "version": "0.0.1-alpha.1",
4
+ "description": "Custom elements",
5
+ "type": "module",
6
+ "scripts": {
7
+ "prepare": "husky",
8
+ "clean": "rm -rf dist",
9
+ "build:combobox": "tsc -b configs/tsconfig.cjs.json configs/tsconfig.esm.json configs/tsconfig.types.json",
10
+ "generate": "node --import tsx ./scripts/genPackageFiles.ts",
11
+ "build": "npm-run-all clean build:combobox generate",
12
+ "check-types": "tsc --noEmit"
13
+ },
14
+ "keywords": [
15
+ "web-components",
16
+ "custom elements"
17
+ ],
18
+ "author": "Roman Konstantin",
19
+ "license": "MIT",
20
+ "devDependencies": {
21
+ "@espcom/eslint-config": "latest",
22
+ "@types/node": "22.8.6",
23
+ "c8": "10.1.2",
24
+ "esbuild": "0.25.5",
25
+ "husky": "9.1.5",
26
+ "lint-staged": "15.2.9",
27
+ "npm-run-all": "^4.1.5",
28
+ "tsx": "^4.19.2",
29
+ "typescript": "latest",
30
+ "xml-splitter": "1.2.1"
31
+ },
32
+ "sideEffect": false,
33
+ "exports": {
34
+ "./combobox": {
35
+ "types": "./dist/types/combobox/index.d.ts",
36
+ "require": "./dist/cjs/combobox/index.js",
37
+ "import": "./dist/esm/combobox/index.js"
38
+ }
39
+ },
40
+ "main": "dist/cjs/combobox/index.js",
41
+ "module": "dist/esm/combobox/index.js",
42
+ "types": "dist/types/combobox/index.d.ts",
43
+ "combobox": "dist/cjs/combobox/index.js"
44
+ }