@prosekit/lit 0.1.3 → 0.1.5
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.
- package/dist/_tsup-dts-rollup.d.ts +307 -60
- package/dist/{chunk-6P3YKUWI.js → chunk-5CI65R73.js} +2 -2
- package/dist/chunk-7RGGPFFK.js +51 -0
- package/dist/{chunk-IDDQA3VV.js → chunk-GZRUCYLP.js} +10 -4
- package/dist/{chunk-7WLKD2U6.js → chunk-I2VPMW75.js} +81 -41
- package/dist/chunk-MLUELLVA.js +60 -0
- package/dist/chunk-S32IZIQF.js +33 -0
- package/dist/{chunk-66YTZIW6.js → chunk-WWRKI6AU.js} +46 -40
- package/dist/prosekit-lit-autocomplete-empty.js +14 -14
- package/dist/prosekit-lit-autocomplete-item.js +3 -3
- package/dist/prosekit-lit-autocomplete-list.js +5 -5
- package/dist/prosekit-lit-autocomplete-popover.js +53 -50
- package/dist/prosekit-lit-combo-box-input.js +39 -26
- package/dist/prosekit-lit-combo-box-item.js +2 -2
- package/dist/prosekit-lit-combo-box-list.js +12 -16
- package/dist/prosekit-lit-combo-box.js +60 -44
- package/dist/prosekit-lit-inline-popover.js +23 -18
- package/dist/prosekit-lit-popover.js +2 -2
- package/package.json +8 -8
- package/dist/chunk-55G7TJI3.js +0 -48
- package/dist/chunk-M6MY5WGM.js +0 -62
- package/dist/chunk-O5JP3B34.js +0 -31
@@ -10,11 +10,10 @@ import { PropertyValues } from 'lit';
|
|
10
10
|
import { ReactiveController } from 'lit';
|
11
11
|
import { ReactiveControllerHost } from 'lit';
|
12
12
|
import { TemplateResult } from 'lit';
|
13
|
-
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
14
13
|
import { VirtualElement } from '@floating-ui/dom';
|
15
14
|
|
16
15
|
export declare class AutocompleteEmpty extends LightElement implements AutocompleteEmptyProps {
|
17
|
-
listContext
|
16
|
+
private listContext;
|
18
17
|
connectedCallback(): void;
|
19
18
|
protected willUpdate(_changedProperties: PropertyValues<this>): void;
|
20
19
|
}
|
@@ -28,11 +27,28 @@ export declare interface AutocompleteEmptyProps {
|
|
28
27
|
* from the rendered item's `textContent`.
|
29
28
|
*/
|
30
29
|
declare class AutocompleteItem extends LightElement implements Partial<AutocompleteItemProps> {
|
30
|
+
private listContext;
|
31
|
+
/**
|
32
|
+
* @hidden
|
33
|
+
*/
|
34
|
+
static properties: {
|
35
|
+
value: {
|
36
|
+
type: StringConstructor;
|
37
|
+
reflect: true;
|
38
|
+
attribute: string;
|
39
|
+
};
|
40
|
+
selected: {
|
41
|
+
type: BooleanConstructor;
|
42
|
+
reflect: true;
|
43
|
+
attribute: string;
|
44
|
+
};
|
45
|
+
onSelect: {
|
46
|
+
attribute: false;
|
47
|
+
};
|
48
|
+
};
|
31
49
|
value: string;
|
32
50
|
selected: boolean;
|
33
|
-
/** @hidden */
|
34
51
|
onSelect?: VoidFunction;
|
35
|
-
listContext?: AutocompleteListContext;
|
36
52
|
get content(): string;
|
37
53
|
connectedCallback(): void;
|
38
54
|
protected willUpdate(): void;
|
@@ -49,19 +65,33 @@ export { AutocompleteItemProps }
|
|
49
65
|
export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
|
50
66
|
|
51
67
|
declare class AutocompleteList extends LightElement implements Partial<AutocompleteListProps> {
|
52
|
-
/**
|
68
|
+
/**
|
69
|
+
* @hidden
|
70
|
+
*/
|
53
71
|
private listManager;
|
54
|
-
/**
|
72
|
+
/**
|
73
|
+
* @hidden
|
74
|
+
*/
|
55
75
|
private controller;
|
76
|
+
private popoverContext;
|
56
77
|
private get active();
|
78
|
+
/**
|
79
|
+
* @hidden
|
80
|
+
*/
|
81
|
+
static properties: {
|
82
|
+
editor: {
|
83
|
+
attribute: false;
|
84
|
+
};
|
85
|
+
};
|
57
86
|
editor?: Editor;
|
58
|
-
|
59
|
-
context: AutocompleteListContext;
|
87
|
+
private context;
|
60
88
|
connectedCallback(): void;
|
61
89
|
private get items();
|
62
90
|
selectFirstItem(): void;
|
63
91
|
private updateValue;
|
64
|
-
/**
|
92
|
+
/**
|
93
|
+
* @hidden
|
94
|
+
*/
|
65
95
|
willUpdate(changedProperties: PropertyValues<this>): void;
|
66
96
|
}
|
67
97
|
export { AutocompleteList }
|
@@ -73,6 +103,10 @@ export declare interface AutocompleteListContext {
|
|
73
103
|
selectedReason: 'mouse' | 'keyboard';
|
74
104
|
}
|
75
105
|
|
106
|
+
export declare const autocompleteListContext: {
|
107
|
+
__context__: AutocompleteListContext;
|
108
|
+
};
|
109
|
+
|
76
110
|
export declare class AutocompleteListController implements ReactiveController {
|
77
111
|
private host;
|
78
112
|
private keymap;
|
@@ -91,19 +125,62 @@ export { AutocompleteListProps }
|
|
91
125
|
export { AutocompleteListProps as AutocompleteListProps_alias_1 }
|
92
126
|
|
93
127
|
export declare class AutocompletePopover extends Popover implements Partial<AutocompletePopoverProps> {
|
94
|
-
/**
|
128
|
+
/**
|
129
|
+
* @hidden
|
130
|
+
*/
|
95
131
|
private controller;
|
132
|
+
/**
|
133
|
+
* @hidden
|
134
|
+
*/
|
135
|
+
static properties: {
|
136
|
+
editor: {
|
137
|
+
attribute: false;
|
138
|
+
};
|
139
|
+
regex: {
|
140
|
+
attribute: false;
|
141
|
+
};
|
142
|
+
popoverOptions: {
|
143
|
+
attribute: false;
|
144
|
+
};
|
145
|
+
onSelect: {
|
146
|
+
attribute: false;
|
147
|
+
};
|
148
|
+
active: {
|
149
|
+
type: BooleanConstructor;
|
150
|
+
reflect: true;
|
151
|
+
};
|
152
|
+
reference: {
|
153
|
+
attribute: false;
|
154
|
+
};
|
155
|
+
options: {
|
156
|
+
attribute: false;
|
157
|
+
};
|
158
|
+
autoUpdate: {
|
159
|
+
type: BooleanConstructor;
|
160
|
+
reflect: true;
|
161
|
+
};
|
162
|
+
autoUpdateOptions: {
|
163
|
+
type: ObjectConstructor;
|
164
|
+
};
|
165
|
+
dismiss: {
|
166
|
+
type: StringConstructor;
|
167
|
+
reflect: true;
|
168
|
+
};
|
169
|
+
};
|
96
170
|
editor?: Editor;
|
97
171
|
regex?: RegExp;
|
98
172
|
popoverOptions: PopoverOptions;
|
99
|
-
context: AutocompletePopoverContext;
|
100
|
-
/** @hidden */
|
101
173
|
onSelect?: VoidFunction;
|
174
|
+
private context;
|
102
175
|
private get list();
|
103
176
|
private updateContext;
|
104
|
-
/**
|
177
|
+
/**
|
178
|
+
* @hidden
|
179
|
+
*/
|
105
180
|
willUpdate(changedProperties: PropertyValues<this>): void;
|
106
|
-
/**
|
181
|
+
/**
|
182
|
+
* @hidden
|
183
|
+
*/
|
107
184
|
hide(): void;
|
108
185
|
}
|
109
186
|
|
@@ -114,6 +191,10 @@ export declare interface AutocompletePopoverContext {
|
|
114
191
|
handleSubmit: VoidFunction;
|
115
192
|
}
|
116
193
|
|
194
|
+
export declare const autocompletePopoverContext: {
|
195
|
+
__context__: AutocompletePopoverContext;
|
196
|
+
};
|
197
|
+
|
117
198
|
export declare class AutocompletePopoverController implements ReactiveController {
|
118
199
|
private host;
|
119
200
|
private onChange;
|
@@ -140,10 +221,53 @@ export { AutoUpdateOptions }
|
|
140
221
|
|
141
222
|
export declare const blockComponentStyles: CSSResult;
|
142
223
|
|
224
|
+
/**
|
225
|
+
* If the browser supports the Popover API, we use the body as the boundary
|
226
|
+
* since we don't need to worry about the popover overflowing the parent
|
227
|
+
* element.
|
228
|
+
*/
|
229
|
+
export declare const boundary: HTMLElement | undefined;
|
230
|
+
|
143
231
|
export declare class ComboBox extends Popover {
|
232
|
+
/**
|
233
|
+
* @hidden
|
234
|
+
*/
|
235
|
+
static properties: {
|
236
|
+
onDismiss: {
|
237
|
+
attribute: false;
|
238
|
+
};
|
239
|
+
active: {
|
240
|
+
type: BooleanConstructor;
|
241
|
+
reflect: true;
|
242
|
+
};
|
243
|
+
reference: {
|
244
|
+
attribute: false;
|
245
|
+
};
|
246
|
+
options: {
|
247
|
+
attribute: false;
|
248
|
+
};
|
249
|
+
autoUpdate: {
|
250
|
+
type: BooleanConstructor;
|
251
|
+
reflect: true;
|
252
|
+
};
|
253
|
+
autoUpdateOptions: {
|
254
|
+
type: ObjectConstructor;
|
255
|
+
};
|
256
|
+
dismiss: {
|
257
|
+
type: StringConstructor;
|
258
|
+
reflect: true;
|
259
|
+
};
|
260
|
+
};
|
144
261
|
onDismiss?: VoidFunction;
|
145
262
|
private listManager;
|
146
|
-
|
263
|
+
/**
|
264
|
+
* @hidden
|
265
|
+
*/
|
266
|
+
hide(): void;
|
267
|
+
private context;
|
268
|
+
private getContext;
|
269
|
+
private setInputValue;
|
270
|
+
private setSelectedValue;
|
147
271
|
get items(): ComboBoxItem[];
|
148
272
|
}
|
149
273
|
|
@@ -151,7 +275,7 @@ export declare interface ComboBoxContext {
|
|
151
275
|
inputValue: string;
|
152
276
|
setInputValue: (val: string) => void;
|
153
277
|
selectedValue: string;
|
154
|
-
|
278
|
+
selectedReason: 'mouse' | 'keyboard';
|
155
279
|
listManager: ListManager<ComboBoxItem>;
|
156
280
|
}
|
157
281
|
|
@@ -160,13 +284,26 @@ export declare const comboBoxContext: {
|
|
160
284
|
};
|
161
285
|
|
162
286
|
export declare class ComboBoxInput extends LightElement {
|
287
|
+
/**
|
288
|
+
* @hidden
|
289
|
+
*/
|
290
|
+
static properties: {
|
291
|
+
placeholder: {
|
292
|
+
attribute: true;
|
293
|
+
};
|
294
|
+
};
|
163
295
|
placeholder: string;
|
164
|
-
comboBoxContext
|
296
|
+
private comboBoxContext;
|
165
297
|
private visible;
|
166
298
|
private handleKeydown;
|
167
299
|
private handleInput;
|
300
|
+
/**
|
301
|
+
* @hidden
|
302
|
+
*/
|
168
303
|
protected firstUpdated(): void;
|
169
|
-
/**
|
304
|
+
/**
|
305
|
+
* @hidden
|
306
|
+
*/
|
170
307
|
render(): TemplateResult<1>;
|
171
308
|
}
|
172
309
|
|
@@ -175,12 +312,30 @@ export declare interface ComboBoxInputProps {
|
|
175
312
|
}
|
176
313
|
|
177
314
|
declare class ComboBoxItem extends LightElement {
|
315
|
+
/**
|
316
|
+
* @hidden
|
317
|
+
*/
|
318
|
+
static properties: {
|
319
|
+
editor: {
|
320
|
+
attribute: false;
|
321
|
+
};
|
322
|
+
selected: {
|
323
|
+
type: BooleanConstructor;
|
324
|
+
reflect: true;
|
325
|
+
attribute: string;
|
326
|
+
};
|
327
|
+
onSelect: {
|
328
|
+
attribute: false;
|
329
|
+
};
|
330
|
+
};
|
178
331
|
editor?: Editor;
|
179
332
|
selected: boolean;
|
180
|
-
comboBoxContext?: ComboBoxContext;
|
181
|
-
/** @hidden */
|
182
333
|
onSelect?: VoidFunction;
|
183
|
-
|
334
|
+
private comboBoxContext;
|
335
|
+
/**
|
336
|
+
* @hidden
|
337
|
+
*/
|
338
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
184
339
|
}
|
185
340
|
export { ComboBoxItem }
|
186
341
|
export { ComboBoxItem as ComboBoxItem_alias_1 }
|
@@ -192,7 +347,7 @@ export { ComboBoxItemProps }
|
|
192
347
|
export { ComboBoxItemProps as ComboBoxItemProps_alias_1 }
|
193
348
|
|
194
349
|
declare class ComboBoxList extends LightElement {
|
195
|
-
comboBoxContext
|
350
|
+
private comboBoxContext;
|
196
351
|
connectedCallback(): void;
|
197
352
|
}
|
198
353
|
export { ComboBoxList }
|
@@ -208,14 +363,6 @@ export declare interface ComboBoxProps extends PopoverProps {
|
|
208
363
|
onDismiss?: VoidFunction;
|
209
364
|
}
|
210
365
|
|
211
|
-
export declare const commandListContext: {
|
212
|
-
__context__: AutocompleteListContext;
|
213
|
-
};
|
214
|
-
|
215
|
-
export declare const commandPopoverContext: {
|
216
|
-
__context__: AutocompletePopoverContext;
|
217
|
-
};
|
218
|
-
|
219
366
|
declare type CommandScore = (item: string, query: string) => number;
|
220
367
|
|
221
368
|
export declare const commandScore: CommandScore;
|
@@ -224,7 +371,11 @@ export declare const componentStyles: CSSResult;
|
|
224
371
|
|
225
372
|
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
226
373
|
|
227
|
-
export declare const default_alias_1:
|
374
|
+
export declare const default_alias_1: {
|
375
|
+
test: {
|
376
|
+
environment: "jsdom";
|
377
|
+
};
|
378
|
+
};
|
228
379
|
|
229
380
|
/**
|
230
381
|
* Default popover options.
|
@@ -240,17 +391,57 @@ export declare const defaultPopoverOptions_alias_2: PopoverOptions;
|
|
240
391
|
|
241
392
|
export declare function defaultQueryBuilder(match: RegExpExecArray): string;
|
242
393
|
|
394
|
+
export declare function defineCustomElement(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void;
|
395
|
+
|
243
396
|
export declare function getVirtualSelectionElement(view: EditorView): Range | undefined;
|
244
397
|
|
245
398
|
export declare class InlinePopover extends Popover implements Partial<InlinePopoverProps> {
|
246
|
-
/**
|
247
|
-
|
399
|
+
/**
|
400
|
+
* @hidden
|
401
|
+
*/
|
402
|
+
static properties: {
|
403
|
+
editor: {
|
404
|
+
attribute: false;
|
405
|
+
};
|
406
|
+
popoverOptions: {
|
407
|
+
attribute: false;
|
408
|
+
};
|
409
|
+
active: {
|
410
|
+
type: BooleanConstructor;
|
411
|
+
reflect: true;
|
412
|
+
};
|
413
|
+
reference: {
|
414
|
+
attribute: false;
|
415
|
+
};
|
416
|
+
options: {
|
417
|
+
attribute: false;
|
418
|
+
};
|
419
|
+
autoUpdate: {
|
420
|
+
type: BooleanConstructor;
|
421
|
+
reflect: true;
|
422
|
+
};
|
423
|
+
autoUpdateOptions: {
|
424
|
+
type: ObjectConstructor;
|
425
|
+
};
|
426
|
+
dismiss: {
|
427
|
+
type: StringConstructor;
|
428
|
+
reflect: true;
|
429
|
+
};
|
430
|
+
};
|
248
431
|
editor?: Editor;
|
249
432
|
popoverOptions: PopoverOptions;
|
250
|
-
|
251
|
-
/**
|
433
|
+
dismiss: "escape";
|
434
|
+
/**
|
435
|
+
* @hidden
|
436
|
+
*/
|
437
|
+
private controller;
|
438
|
+
/**
|
439
|
+
* @hidden
|
440
|
+
*/
|
252
441
|
willUpdate(): void;
|
253
|
-
/**
|
442
|
+
/**
|
443
|
+
* @hidden
|
444
|
+
*/
|
254
445
|
hide(): void;
|
255
446
|
}
|
256
447
|
|
@@ -283,6 +474,10 @@ export declare function isComboBoxItem(element?: Element | null): element is Com
|
|
283
474
|
export declare function isComboBoxList(element?: Element | null): element is ComboBoxList;
|
284
475
|
|
285
476
|
export declare class LightElement extends LitElement {
|
477
|
+
/**
|
478
|
+
* @hidden
|
479
|
+
*/
|
480
|
+
constructor();
|
286
481
|
createRenderRoot(): this;
|
287
482
|
setHidden(hidden: boolean): void;
|
288
483
|
}
|
@@ -310,6 +505,7 @@ export declare class ListManager<Item extends {
|
|
310
505
|
onSelect: (item?: Item | null) => void;
|
311
506
|
});
|
312
507
|
get items(): Item[];
|
508
|
+
get active(): boolean;
|
313
509
|
get availableItems(): Item[];
|
314
510
|
get firstItem(): Item | null;
|
315
511
|
get selectedItem(): Item | null;
|
@@ -330,37 +526,67 @@ export declare class ListManager<Item extends {
|
|
330
526
|
* A custom element that displays a popover anchored to a reference element.
|
331
527
|
*/
|
332
528
|
export declare class Popover extends LightElement implements Partial<PopoverProps> {
|
333
|
-
/** @hidden */
|
334
|
-
constructor();
|
335
529
|
/**
|
336
|
-
*
|
337
|
-
|
530
|
+
* @hidden
|
531
|
+
*/
|
532
|
+
static properties: {
|
533
|
+
active: {
|
534
|
+
type: BooleanConstructor;
|
535
|
+
reflect: true;
|
536
|
+
};
|
537
|
+
reference: {
|
538
|
+
attribute: false;
|
539
|
+
};
|
540
|
+
options: {
|
541
|
+
attribute: false;
|
542
|
+
};
|
543
|
+
autoUpdate: {
|
544
|
+
type: BooleanConstructor;
|
545
|
+
reflect: true;
|
546
|
+
};
|
547
|
+
autoUpdateOptions: {
|
548
|
+
type: ObjectConstructor;
|
549
|
+
};
|
550
|
+
dismiss: {
|
551
|
+
type: StringConstructor;
|
552
|
+
reflect: true;
|
553
|
+
};
|
554
|
+
};
|
555
|
+
/**
|
556
|
+
* Controls the visibility of the popover element. When set to `true`, the
|
557
|
+
* popover is displayed and positioned relative to its reference element. When
|
558
|
+
* set to `false`, the popover is hidden and its positioning logic is
|
338
559
|
* deactivated.
|
339
560
|
*/
|
340
561
|
active: boolean;
|
341
562
|
/**
|
342
|
-
* The element that the popover is anchored to. This can be either a DOM
|
343
|
-
* virtual element interface from
|
563
|
+
* The element that the popover is anchored to. This can be either a DOM
|
564
|
+
* element or an object that implements the virtual element interface from
|
565
|
+
* Floating UI.
|
344
566
|
*/
|
345
567
|
reference?: Element | VirtualElement;
|
346
568
|
/**
|
347
|
-
* The options that are passed to the `computePosition` function from Floating
|
348
|
-
*
|
569
|
+
* The options that are passed to the `computePosition` function from Floating
|
570
|
+
* UI. These options are used to configure the positioning of the popover
|
571
|
+
* element relative to its reference element. For more information on the
|
349
572
|
* available options, please refer to the Floating UI documentation.
|
350
573
|
*/
|
351
574
|
options?: PopoverOptions;
|
352
575
|
/**
|
353
|
-
* Controls whether the popover position is automatically updated when the
|
354
|
-
*
|
355
|
-
* updated
|
576
|
+
* Controls whether the popover position is automatically updated when the
|
577
|
+
* reference element changes position. When set to `true`, the popover
|
578
|
+
* position is updated automatically. When set to `false`, the popover
|
579
|
+
* position is only updated when the given properties are changed.
|
356
580
|
*
|
357
581
|
* @default false
|
358
582
|
*/
|
359
583
|
autoUpdate: boolean;
|
360
584
|
/**
|
361
|
-
* The options that are passed to the `autoUpdate` function from Floating UI.
|
362
|
-
*
|
363
|
-
*
|
585
|
+
* The options that are passed to the `autoUpdate` function from Floating UI.
|
586
|
+
* These options are used to configure the automatic update behavior of the
|
587
|
+
* popover position. For more information on the available options, please
|
588
|
+
* refer to the Floating UI documentation. This property is only used when the
|
589
|
+
* `autoUpdate` property is set to `true`.
|
364
590
|
*/
|
365
591
|
autoUpdateOptions?: AutoUpdateOptions;
|
366
592
|
/**
|
@@ -375,27 +601,48 @@ export declare class Popover extends LightElement implements Partial<PopoverProp
|
|
375
601
|
*
|
376
602
|
* @default "on"
|
377
603
|
*/
|
378
|
-
dismiss:
|
379
|
-
/**
|
604
|
+
dismiss: 'off' | 'on' | 'click' | 'escape';
|
605
|
+
/**
|
606
|
+
* @hidden
|
607
|
+
*/
|
380
608
|
private disposeAutoUpdate?;
|
381
|
-
/**
|
609
|
+
/**
|
610
|
+
* @hidden
|
611
|
+
*/
|
382
612
|
private disposeEventListeners?;
|
383
|
-
/**
|
613
|
+
/**
|
614
|
+
* @hidden
|
615
|
+
*/
|
384
616
|
connectedCallback(): void;
|
385
|
-
/**
|
617
|
+
/**
|
618
|
+
* @hidden
|
619
|
+
*/
|
386
620
|
disconnectedCallback(): void;
|
387
|
-
/**
|
621
|
+
/**
|
622
|
+
* @hidden
|
623
|
+
*/
|
388
624
|
protected updated(changedProperties: PropertyValues<this>): void;
|
389
|
-
/**
|
625
|
+
/**
|
626
|
+
* @hidden
|
627
|
+
*/
|
390
628
|
private start;
|
391
|
-
/**
|
629
|
+
/**
|
630
|
+
* @hidden
|
631
|
+
*/
|
392
632
|
private compute;
|
393
|
-
/**
|
633
|
+
/**
|
634
|
+
* @hidden
|
635
|
+
*/
|
394
636
|
hide(): void;
|
395
637
|
private handleDocumentMouseDown;
|
396
638
|
private handleDocumentKeyDown;
|
397
639
|
}
|
398
640
|
|
641
|
+
/**
|
642
|
+
* Whether the browser supports the [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API).
|
643
|
+
*/
|
644
|
+
export declare const popoverAvailable: boolean;
|
645
|
+
|
399
646
|
/**
|
400
647
|
* The `PopoverOptions` interface defines the options that can be passed to the
|
401
648
|
* `computePosition` function from Floating UI. These options are used to
|
@@ -429,7 +676,7 @@ declare const propNames_3: readonly ["editor"];
|
|
429
676
|
export { propNames_3 as propNames_alias_3 }
|
430
677
|
export { propNames_3 as propNames_alias_4 }
|
431
678
|
|
432
|
-
declare const propNames_4:
|
679
|
+
declare const propNames_4: readonly ["onSelect"];
|
433
680
|
export { propNames_4 as propNames_alias_8 }
|
434
681
|
export { propNames_4 as propNames_alias_9 }
|
435
682
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
// src/components/autocomplete-list/context.ts
|
2
2
|
import { createContext } from "@lit/context";
|
3
|
-
var
|
3
|
+
var autocompleteListContext = createContext(
|
4
4
|
"prosekit-autocomplete-list-context"
|
5
5
|
);
|
6
6
|
|
7
7
|
export {
|
8
|
-
|
8
|
+
autocompleteListContext
|
9
9
|
};
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import {
|
2
|
+
comboBoxContext
|
3
|
+
} from "./chunk-C4MW43I4.js";
|
4
|
+
import {
|
5
|
+
LightElement,
|
6
|
+
defineCustomElement
|
7
|
+
} from "./chunk-S32IZIQF.js";
|
8
|
+
|
9
|
+
// src/components/combo-box-item/component.ts
|
10
|
+
import { ContextConsumer } from "@lit/context";
|
11
|
+
var propNames = ["onSelect"];
|
12
|
+
var ComboBoxItem = class extends LightElement {
|
13
|
+
constructor() {
|
14
|
+
super(...arguments);
|
15
|
+
this.selected = false;
|
16
|
+
this.comboBoxContext = new ContextConsumer(this, {
|
17
|
+
context: comboBoxContext,
|
18
|
+
subscribe: true
|
19
|
+
});
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* @hidden
|
23
|
+
*/
|
24
|
+
updated(changedProperties) {
|
25
|
+
var _a, _b, _c, _d, _e;
|
26
|
+
super.updated(changedProperties);
|
27
|
+
const content = ((_a = this.textContent) != null ? _a : "").trim();
|
28
|
+
const query = ((_c = (_b = this.comboBoxContext.value) == null ? void 0 : _b.inputValue) != null ? _c : "").trim();
|
29
|
+
const match = content.toLowerCase().includes(query.toLowerCase());
|
30
|
+
this.selected = match && content === ((_d = this.comboBoxContext.value) == null ? void 0 : _d.selectedValue);
|
31
|
+
this.ariaSelected = String(this.selected);
|
32
|
+
this.setHidden(!match);
|
33
|
+
if (this.selected && changedProperties.has("selected") && !changedProperties.get("selected") && ((_e = this.comboBoxContext.value) == null ? void 0 : _e.selectedReason) === "keyboard") {
|
34
|
+
this.scrollIntoView({ block: "nearest" });
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
38
|
+
/**
|
39
|
+
* @hidden
|
40
|
+
*/
|
41
|
+
ComboBoxItem.properties = {
|
42
|
+
editor: { attribute: false },
|
43
|
+
selected: { type: Boolean, reflect: true, attribute: "data-selected" },
|
44
|
+
onSelect: { attribute: false }
|
45
|
+
};
|
46
|
+
defineCustomElement("prosekit-combo-box-item", ComboBoxItem);
|
47
|
+
|
48
|
+
export {
|
49
|
+
propNames,
|
50
|
+
ComboBoxItem
|
51
|
+
};
|
@@ -14,6 +14,9 @@ var ListManager = class {
|
|
14
14
|
get items() {
|
15
15
|
return this.getItems();
|
16
16
|
}
|
17
|
+
get active() {
|
18
|
+
return this.getActive();
|
19
|
+
}
|
17
20
|
get availableItems() {
|
18
21
|
var _a, _b;
|
19
22
|
return (_b = (_a = this.items) == null ? void 0 : _a.filter((item) => !item.hidden)) != null ? _b : [];
|
@@ -49,9 +52,12 @@ var ListManager = class {
|
|
49
52
|
this.setSelectedValue(this.getItemValue(item), reason);
|
50
53
|
}
|
51
54
|
selectFirstItem() {
|
55
|
+
if (!this.active)
|
56
|
+
return;
|
52
57
|
const item = this.firstItem;
|
53
58
|
const value = item ? this.getItemValue(item) : "";
|
54
59
|
this.setSelectedValue(value, "keyboard");
|
60
|
+
item == null ? void 0 : item.scrollIntoView({ block: "nearest" });
|
55
61
|
}
|
56
62
|
handleMouseMove(_event) {
|
57
63
|
this.lastMouseMoveTime = Date.now();
|
@@ -79,25 +85,25 @@ var ListManager = class {
|
|
79
85
|
}
|
80
86
|
}
|
81
87
|
handleArrowUp() {
|
82
|
-
if (!this.
|
88
|
+
if (!this.active)
|
83
89
|
return false;
|
84
90
|
this.updateSelectedByChange(-1);
|
85
91
|
return true;
|
86
92
|
}
|
87
93
|
handleArrowDown() {
|
88
|
-
if (!this.
|
94
|
+
if (!this.active)
|
89
95
|
return false;
|
90
96
|
this.updateSelectedByChange(1);
|
91
97
|
return true;
|
92
98
|
}
|
93
99
|
handleEscape() {
|
94
|
-
if (!this.
|
100
|
+
if (!this.active)
|
95
101
|
return false;
|
96
102
|
this.onDismiss();
|
97
103
|
return true;
|
98
104
|
}
|
99
105
|
handleEnter() {
|
100
|
-
if (!this.
|
106
|
+
if (!this.active)
|
101
107
|
return false;
|
102
108
|
this.onSelect(this.selectedItem);
|
103
109
|
return true;
|