@prosekit/lit 0.0.9 → 0.0.11
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 +469 -0
- package/dist/{chunk-J73E7P6J.js → chunk-3UDA5JEW.js} +2 -9
- package/dist/{chunk-37EPOFI5.js → chunk-AWQAU2JR.js} +5 -3
- package/dist/chunk-BMDOOASL.js +57 -0
- package/dist/chunk-DYEHERSG.js +9 -0
- package/dist/chunk-G5KPDHDH.js +120 -0
- package/dist/chunk-HMV7TD6T.js +9 -0
- package/dist/{chunk-HPMQEYGA.js → chunk-KGZID7N7.js} +61 -92
- package/dist/chunk-PCXKL6TA.js +109 -0
- package/dist/chunk-TRZW33VF.js +35 -0
- package/dist/prosekit-lit-components-autocomplete-empty.d.ts +3 -17
- package/dist/prosekit-lit-components-autocomplete-empty.js +5 -3
- package/dist/prosekit-lit-components-autocomplete-item.d.ts +3 -32
- package/dist/prosekit-lit-components-autocomplete-item.js +3 -2
- package/dist/prosekit-lit-components-autocomplete-list.d.ts +3 -43
- package/dist/prosekit-lit-components-autocomplete-list.js +5 -3
- package/dist/prosekit-lit-components-autocomplete-popover.d.ts +4 -47
- package/dist/prosekit-lit-components-autocomplete-popover.js +23 -139
- package/dist/prosekit-lit-components-code-block-popover.d.ts +3 -0
- package/dist/prosekit-lit-components-code-block-popover.js +141 -0
- package/dist/prosekit-lit-components-combo-box-input.d.ts +3 -0
- package/dist/prosekit-lit-components-combo-box-input.js +74 -0
- package/dist/prosekit-lit-components-combo-box-item.d.ts +3 -0
- package/dist/prosekit-lit-components-combo-box-item.js +11 -0
- package/dist/prosekit-lit-components-combo-box-list.d.ts +3 -0
- package/dist/prosekit-lit-components-combo-box-list.js +50 -0
- package/dist/prosekit-lit-components-combo-box.d.ts +3 -0
- package/dist/prosekit-lit-components-combo-box.js +111 -0
- package/dist/prosekit-lit.d.ts +1 -2
- package/package.json +47 -7
- package/dist/context-19474449.d.ts +0 -7
- package/dist/context-436a56d3.d.ts +0 -8
@@ -0,0 +1,469 @@
|
|
1
|
+
import { AutoUpdateOptions } from '@floating-ui/dom';
|
2
|
+
import { CommandArgs } from '@prosekit/core';
|
3
|
+
import { ComputePositionConfig } from '@floating-ui/dom';
|
4
|
+
import { CSSResult } from 'lit';
|
5
|
+
import { CSSResultGroup } from 'lit';
|
6
|
+
import { Editor } from '@prosekit/core';
|
7
|
+
import { Extension } from '@prosekit/core';
|
8
|
+
import { ExtensionTyping } from '@prosekit/core';
|
9
|
+
import { Keymap } from '@prosekit/core';
|
10
|
+
import { LitElement } from 'lit';
|
11
|
+
import { Options } from 'tsup';
|
12
|
+
import { PropertyValues } from 'lit';
|
13
|
+
import type { ProseMirrorNode } from '@prosekit/pm/model';
|
14
|
+
import { ReactiveController } from 'lit';
|
15
|
+
import { ReactiveControllerHost } from 'lit';
|
16
|
+
import { TemplateResult } from 'lit-html';
|
17
|
+
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
18
|
+
import { VirtualElement } from '@floating-ui/dom';
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Returns a ProseKit extension that call `onSelect` when the text selection is
|
22
|
+
* insert into a code block, and `onDismiss` when it is not.
|
23
|
+
*/
|
24
|
+
export declare function addCodeBlockSelect(options: {
|
25
|
+
onSelect: (info: {
|
26
|
+
pos: number;
|
27
|
+
node: ProseMirrorNode;
|
28
|
+
dom: HTMLElement;
|
29
|
+
}) => void;
|
30
|
+
onDismiss: () => void;
|
31
|
+
}): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
32
|
+
|
33
|
+
export declare class AutocompleteEmpty extends LitElement implements AutocompleteEmptyProps {
|
34
|
+
/** @hidden */
|
35
|
+
static styles: CSSResultGroup;
|
36
|
+
listContext?: AutocompleteListContext;
|
37
|
+
protected willUpdate(_changedProperties: PropertyValues<this>): void;
|
38
|
+
/** @hidden */
|
39
|
+
render(): TemplateResult<1> | null;
|
40
|
+
}
|
41
|
+
|
42
|
+
export declare interface AutocompleteEmptyProps {
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Command menu item. Becomes active on pointer enter or through keyboard
|
47
|
+
* navigation. Preferably pass a `value`, otherwise the value will be inferred
|
48
|
+
* from the rendered item's `textContent`.
|
49
|
+
*/
|
50
|
+
declare class AutocompleteItem extends LitElement implements Partial<AutocompleteItemProps> {
|
51
|
+
/** @hidden */
|
52
|
+
static styles: CSSResultGroup;
|
53
|
+
value: string;
|
54
|
+
selected: boolean;
|
55
|
+
/** @hidden */
|
56
|
+
onSelect?: VoidFunction;
|
57
|
+
/** @hidden */
|
58
|
+
defaultSlot?: HTMLSlotElement;
|
59
|
+
listContext?: AutocompleteListContext;
|
60
|
+
get content(): string;
|
61
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
62
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
63
|
+
/** @hidden */
|
64
|
+
render(): TemplateResult<1> | null;
|
65
|
+
}
|
66
|
+
export { AutocompleteItem }
|
67
|
+
export { AutocompleteItem as AutocompleteItem_alias_1 }
|
68
|
+
|
69
|
+
declare interface AutocompleteItemProps {
|
70
|
+
value?: string;
|
71
|
+
onSelect: VoidFunction;
|
72
|
+
}
|
73
|
+
export { AutocompleteItemProps }
|
74
|
+
export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
|
75
|
+
|
76
|
+
declare class AutocompleteList extends LitElement implements Partial<AutocompleteListProps> {
|
77
|
+
/** @hidden */
|
78
|
+
static styles: CSSResultGroup;
|
79
|
+
/** @hidden */
|
80
|
+
private listManager;
|
81
|
+
/** @hidden */
|
82
|
+
private controller;
|
83
|
+
private get active();
|
84
|
+
editor?: Editor;
|
85
|
+
popoverContext: AutocompletePopoverContext | null;
|
86
|
+
context: AutocompleteListContext;
|
87
|
+
protected firstUpdated(): void;
|
88
|
+
private get items();
|
89
|
+
selectFirstItem(): void;
|
90
|
+
private updateValue;
|
91
|
+
private registerValue;
|
92
|
+
/** @hidden */
|
93
|
+
defaultSlot?: HTMLSlotElement;
|
94
|
+
/** @hidden */
|
95
|
+
willUpdate(changedProperties: PropertyValues<this>): void;
|
96
|
+
/** @hidden */
|
97
|
+
render(): TemplateResult<1>;
|
98
|
+
}
|
99
|
+
export { AutocompleteList }
|
100
|
+
export { AutocompleteList as AutocompleteList_alias_1 }
|
101
|
+
|
102
|
+
export declare type AutocompleteListContext = {
|
103
|
+
scores: Map<string, number>;
|
104
|
+
selectedValue: string;
|
105
|
+
registerValue: (value: string) => VoidFunction;
|
106
|
+
};
|
107
|
+
|
108
|
+
export declare class AutocompleteListController implements ReactiveController {
|
109
|
+
private host;
|
110
|
+
private keymap;
|
111
|
+
private editor;
|
112
|
+
private cleanup;
|
113
|
+
constructor(host: ReactiveControllerHost, keymap: Keymap);
|
114
|
+
setEditor(editor: Editor): void;
|
115
|
+
hostDisconnected(): void;
|
116
|
+
private addExtension;
|
117
|
+
}
|
118
|
+
|
119
|
+
declare interface AutocompleteListProps {
|
120
|
+
editor: Editor;
|
121
|
+
}
|
122
|
+
export { AutocompleteListProps }
|
123
|
+
export { AutocompleteListProps as AutocompleteListProps_alias_1 }
|
124
|
+
|
125
|
+
export declare class AutocompletePopover extends LitElement implements Partial<AutocompletePopoverProps> {
|
126
|
+
/** @hidden */
|
127
|
+
static styles: CSSResultGroup;
|
128
|
+
/** @hidden */
|
129
|
+
private controller;
|
130
|
+
editor?: Editor;
|
131
|
+
regex?: RegExp;
|
132
|
+
popoverOptions: PopoverOptions;
|
133
|
+
context: AutocompletePopoverContext;
|
134
|
+
/** @hidden */
|
135
|
+
onSelect?: VoidFunction;
|
136
|
+
private get list();
|
137
|
+
private updateContext;
|
138
|
+
/** @hidden */
|
139
|
+
defaultSlot?: HTMLSlotElement;
|
140
|
+
/** @hidden */
|
141
|
+
protected get active(): boolean;
|
142
|
+
/** @hidden */
|
143
|
+
willUpdate(): void;
|
144
|
+
/** @hidden */
|
145
|
+
render(): TemplateResult<1>;
|
146
|
+
}
|
147
|
+
|
148
|
+
export declare type AutocompletePopoverContext = {
|
149
|
+
active: boolean;
|
150
|
+
query: string;
|
151
|
+
handleDismiss: VoidFunction;
|
152
|
+
handleSubmit: VoidFunction;
|
153
|
+
};
|
154
|
+
|
155
|
+
export declare class AutocompletePopoverController implements ReactiveController {
|
156
|
+
private host;
|
157
|
+
private onChange;
|
158
|
+
reference: Element | null;
|
159
|
+
private editor;
|
160
|
+
private regex;
|
161
|
+
private cleanup;
|
162
|
+
handleDismiss: VoidFunction | null;
|
163
|
+
handleSubmit: VoidFunction | null;
|
164
|
+
constructor(host: ReactiveControllerHost, onChange: (query: string, active: boolean) => void);
|
165
|
+
setEditor(editor: Editor): void;
|
166
|
+
setRegex(regex: RegExp): void;
|
167
|
+
private addExtension;
|
168
|
+
hostDisconnected(): void;
|
169
|
+
}
|
170
|
+
|
171
|
+
export declare interface AutocompletePopoverProps {
|
172
|
+
editor: Editor;
|
173
|
+
regex: RegExp;
|
174
|
+
popoverOptions?: PopoverOptions;
|
175
|
+
}
|
176
|
+
|
177
|
+
export { AutoUpdateOptions }
|
178
|
+
|
179
|
+
export declare const blockComponentStyles: CSSResult;
|
180
|
+
|
181
|
+
declare class BlockElement extends LitElement {
|
182
|
+
setHidden(hidden: boolean): void;
|
183
|
+
}
|
184
|
+
|
185
|
+
export declare class CodeBlockPopover extends Popover implements Partial<CodeBlockPopoverProps> {
|
186
|
+
editor?: Editor;
|
187
|
+
/** @hidden */
|
188
|
+
private controller;
|
189
|
+
protected updated(): void;
|
190
|
+
}
|
191
|
+
|
192
|
+
export declare class CodeBlockPopoverController implements ReactiveController {
|
193
|
+
private host;
|
194
|
+
reference: Element | null;
|
195
|
+
private editor;
|
196
|
+
private cleanup;
|
197
|
+
constructor(host: ReactiveControllerHost);
|
198
|
+
setEditor(editor: Editor): void;
|
199
|
+
private addExtension;
|
200
|
+
hostDisconnected(): void;
|
201
|
+
}
|
202
|
+
|
203
|
+
export declare interface CodeBlockPopoverProps {
|
204
|
+
editor: Editor;
|
205
|
+
}
|
206
|
+
|
207
|
+
export declare class ComboBox extends Popover {
|
208
|
+
onDismiss?: VoidFunction;
|
209
|
+
private listManager;
|
210
|
+
context: ComboBoxContext;
|
211
|
+
get items(): ComboBoxItem[];
|
212
|
+
}
|
213
|
+
|
214
|
+
export declare type ComboBoxContext = {
|
215
|
+
inputValue: string;
|
216
|
+
setInputValue: (val: string) => void;
|
217
|
+
selectedValue: string;
|
218
|
+
setSelectedValue: (val: string) => void;
|
219
|
+
listManager: ListManager<ComboBoxItem>;
|
220
|
+
};
|
221
|
+
|
222
|
+
export declare const comboBoxContext: {
|
223
|
+
__context__: ComboBoxContext;
|
224
|
+
};
|
225
|
+
|
226
|
+
export declare class ComboBoxInput extends LightBlockElement {
|
227
|
+
placeholder: string;
|
228
|
+
comboBoxContext: ComboBoxContext | null;
|
229
|
+
private visible;
|
230
|
+
private handleKeydown;
|
231
|
+
private handleInput;
|
232
|
+
protected firstUpdated(): void;
|
233
|
+
/** @hidden */
|
234
|
+
render(): TemplateResult<1>;
|
235
|
+
}
|
236
|
+
|
237
|
+
export declare type ComboBoxInputProps = {
|
238
|
+
placeholder?: string;
|
239
|
+
};
|
240
|
+
|
241
|
+
declare class ComboBoxItem extends LightBlockElement {
|
242
|
+
/** @hidden */
|
243
|
+
static styles: CSSResultGroup;
|
244
|
+
editor?: Editor;
|
245
|
+
/** @hidden */
|
246
|
+
defaultSlot?: HTMLSlotElement;
|
247
|
+
selected: boolean;
|
248
|
+
comboBoxContext?: ComboBoxContext;
|
249
|
+
/** @hidden */
|
250
|
+
onSelect?: VoidFunction;
|
251
|
+
protected updated(): void;
|
252
|
+
}
|
253
|
+
export { ComboBoxItem }
|
254
|
+
export { ComboBoxItem as ComboBoxItem_alias_1 }
|
255
|
+
|
256
|
+
declare type ComboBoxItemProps = Record<string, never>;
|
257
|
+
export { ComboBoxItemProps }
|
258
|
+
export { ComboBoxItemProps as ComboBoxItemProps_alias_1 }
|
259
|
+
|
260
|
+
declare class ComboBoxList extends LightBlockElement {
|
261
|
+
comboBoxContext: ComboBoxContext | null;
|
262
|
+
connectedCallback(): void;
|
263
|
+
}
|
264
|
+
export { ComboBoxList }
|
265
|
+
export { ComboBoxList as ComboBoxList_alias_1 }
|
266
|
+
|
267
|
+
declare type ComboBoxListProps = Record<string, never>;
|
268
|
+
export { ComboBoxListProps }
|
269
|
+
export { ComboBoxListProps as ComboBoxListProps_alias_1 }
|
270
|
+
|
271
|
+
export declare type ComboBoxProps = {
|
272
|
+
onDismiss?: VoidFunction;
|
273
|
+
};
|
274
|
+
|
275
|
+
export declare const commandListContext: {
|
276
|
+
__context__: AutocompleteListContext;
|
277
|
+
};
|
278
|
+
|
279
|
+
export declare const commandPopoverContext: {
|
280
|
+
__context__: AutocompletePopoverContext;
|
281
|
+
};
|
282
|
+
|
283
|
+
declare type CommandScore = (item: string, query: string) => number;
|
284
|
+
|
285
|
+
export declare const commandScore: CommandScore;
|
286
|
+
|
287
|
+
export declare const componentStyles: CSSResult;
|
288
|
+
|
289
|
+
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
290
|
+
|
291
|
+
export declare const default_alias_1: UserProjectConfigExport;
|
292
|
+
|
293
|
+
/**
|
294
|
+
* Default popover options.
|
295
|
+
*/
|
296
|
+
export declare const defaultPopoverOptions: PopoverOptions;
|
297
|
+
|
298
|
+
export declare const defaultPopoverOptions_alias_1: PopoverOptions;
|
299
|
+
|
300
|
+
export declare function defaultQueryBuilder(match: RegExpExecArray): string;
|
301
|
+
|
302
|
+
export declare function isAutocompleteItem(element?: Element | null): element is AutocompleteItem;
|
303
|
+
|
304
|
+
export declare function isAutocompleteList(element?: Element | null): element is AutocompleteList;
|
305
|
+
|
306
|
+
export declare function isComboBoxItem(element?: Element | null): element is ComboBoxItem;
|
307
|
+
|
308
|
+
export declare function isComboBoxList(element?: Element | null): element is ComboBoxList;
|
309
|
+
|
310
|
+
export declare class LightBlockElement extends BlockElement {
|
311
|
+
createRenderRoot(): this;
|
312
|
+
}
|
313
|
+
|
314
|
+
export declare class ListManager<Item extends {
|
315
|
+
hidden: boolean;
|
316
|
+
} & HTMLElement> {
|
317
|
+
private lastMouseMoveTime;
|
318
|
+
private getItems;
|
319
|
+
private getSelectedValue;
|
320
|
+
private setSelectedValue;
|
321
|
+
private getItemValue;
|
322
|
+
private queryClosestItem;
|
323
|
+
private getActive;
|
324
|
+
private onDismiss;
|
325
|
+
private onSelect;
|
326
|
+
constructor(options: {
|
327
|
+
getItems: () => Item[];
|
328
|
+
getSelectedValue: () => string;
|
329
|
+
setSelectedValue: (value: string) => void;
|
330
|
+
getItemValue: (item: Item) => string;
|
331
|
+
queryClosestItem: (element: HTMLElement) => Item | null;
|
332
|
+
getActive: () => boolean;
|
333
|
+
onDismiss: () => void;
|
334
|
+
onSelect: (item?: Item | null) => void;
|
335
|
+
});
|
336
|
+
get items(): Item[];
|
337
|
+
get availableItems(): Item[];
|
338
|
+
get firstItem(): Item | null;
|
339
|
+
get selectedItem(): Item | null;
|
340
|
+
private updateSelectedByChange;
|
341
|
+
private handleSelect;
|
342
|
+
selectFirstItem(): void;
|
343
|
+
handleMouseMove(_event: MouseEvent): void;
|
344
|
+
handleMouseOver(event: MouseEvent): void;
|
345
|
+
handleMouseDown(event: MouseEvent): void;
|
346
|
+
handleClick(event: MouseEvent): void;
|
347
|
+
handleArrowUp(): boolean;
|
348
|
+
handleArrowDown(): boolean;
|
349
|
+
handleEscape(): boolean;
|
350
|
+
handleEnter(): boolean;
|
351
|
+
}
|
352
|
+
|
353
|
+
/**
|
354
|
+
* A custom element that displays a popover anchored to a reference element.
|
355
|
+
*/
|
356
|
+
export declare class Popover extends LightBlockElement implements Partial<PopoverProps> {
|
357
|
+
/** @hidden */
|
358
|
+
constructor();
|
359
|
+
/** @hidden */
|
360
|
+
static styles: CSSResultGroup;
|
361
|
+
/**
|
362
|
+
* Controls the visibility of the popover element. When set to `true`, the popover is displayed and positioned
|
363
|
+
* relative to its reference element. When set to `false`, the popover is hidden and its positioning logic is
|
364
|
+
* deactivated.
|
365
|
+
*/
|
366
|
+
active: boolean;
|
367
|
+
/**
|
368
|
+
* The element that the popover is anchored to. This can be either a DOM element or an object that implements the
|
369
|
+
* virtual element interface from Floating UI.
|
370
|
+
*/
|
371
|
+
reference?: Element | VirtualElement;
|
372
|
+
/**
|
373
|
+
* The options that are passed to the `computePosition` function from Floating UI. These options are used to
|
374
|
+
* configure the positioning of the popover element relative to its reference element. For more information on the
|
375
|
+
* available options, please refer to the Floating UI documentation.
|
376
|
+
*/
|
377
|
+
options?: PopoverOptions;
|
378
|
+
/**
|
379
|
+
* Controls whether the popover position is automatically updated when the reference element changes position. When
|
380
|
+
* set to `true`, the popover position is updated automatically. When set to `false`, the popover position is only
|
381
|
+
* updated when the given properties are changed.
|
382
|
+
*
|
383
|
+
* @default false
|
384
|
+
*/
|
385
|
+
autoUpdate: boolean;
|
386
|
+
/**
|
387
|
+
* The options that are passed to the `autoUpdate` function from Floating UI. These options are used to configure the
|
388
|
+
* automatic update behavior of the popover position. For more information on the available options, please refer to
|
389
|
+
* the Floating UI documentation. This property is only used when the `autoUpdate` property is set to `true`.
|
390
|
+
*/
|
391
|
+
autoUpdateOptions?: AutoUpdateOptions;
|
392
|
+
/** @hidden */
|
393
|
+
private cleanupAutoUpdate?;
|
394
|
+
/** @hidden */
|
395
|
+
disconnectedCallback(): void;
|
396
|
+
/** @hidden */
|
397
|
+
protected updated(): void;
|
398
|
+
/** @hidden */
|
399
|
+
private start;
|
400
|
+
/** @hidden */
|
401
|
+
private compute;
|
402
|
+
/** @hidden */
|
403
|
+
private cleanup;
|
404
|
+
}
|
405
|
+
|
406
|
+
/**
|
407
|
+
* The `PopoverOptions` interface defines the options that can be passed to the
|
408
|
+
* `computePosition` function from Floating UI. These options are used to
|
409
|
+
* configure the positioning of the popover element relative to its reference
|
410
|
+
* element. For more information on the available options, please refer to the
|
411
|
+
* Floating UI documentation.
|
412
|
+
*
|
413
|
+
* https://floating-ui.com/docs/computeposition#options
|
414
|
+
*/
|
415
|
+
declare type PopoverOptions = ComputePositionConfig;
|
416
|
+
export { PopoverOptions }
|
417
|
+
export { PopoverOptions as PopoverOptions_alias_1 }
|
418
|
+
export { PopoverOptions as PopoverOptions_alias_2 }
|
419
|
+
|
420
|
+
export declare interface PopoverProps {
|
421
|
+
active: boolean;
|
422
|
+
reference?: Element | VirtualElement;
|
423
|
+
options?: PopoverOptions;
|
424
|
+
autoUpdate?: boolean;
|
425
|
+
autoUpdateOptions?: AutoUpdateOptions;
|
426
|
+
}
|
427
|
+
|
428
|
+
export declare const propNames: readonly [];
|
429
|
+
|
430
|
+
declare const propNames_2: readonly ["value", "onSelect"];
|
431
|
+
export { propNames_2 as propNames_alias_1 }
|
432
|
+
export { propNames_2 as propNames_alias_2 }
|
433
|
+
|
434
|
+
declare const propNames_3: readonly ["editor"];
|
435
|
+
export { propNames_3 as propNames_alias_3 }
|
436
|
+
export { propNames_3 as propNames_alias_4 }
|
437
|
+
|
438
|
+
declare const propNames_4: never[];
|
439
|
+
export { propNames_4 as propNames_alias_10 }
|
440
|
+
export { propNames_4 as propNames_alias_9 }
|
441
|
+
|
442
|
+
declare const propNames_5: never[];
|
443
|
+
export { propNames_5 as propNames_alias_11 }
|
444
|
+
export { propNames_5 as propNames_alias_12 }
|
445
|
+
|
446
|
+
export declare const propNames_alias_13: string[];
|
447
|
+
|
448
|
+
export declare const propNames_alias_5: readonly ["editor", "regex", "popoverOptions"];
|
449
|
+
|
450
|
+
export declare const propNames_alias_6: readonly ["editor"];
|
451
|
+
|
452
|
+
export declare const propNames_alias_7: readonly ["onDismiss"];
|
453
|
+
|
454
|
+
export declare const propNames_alias_8: readonly ["placeholder"];
|
455
|
+
|
456
|
+
export declare function queryClosestAutocompleteItem(element?: Element | null): AutocompleteItem | null;
|
457
|
+
|
458
|
+
export declare function queryClosestComboBoxItem(element?: Element | null): ComboBoxItem | null;
|
459
|
+
|
460
|
+
/** Rounds a value to the nearest device pixel ratio. */
|
461
|
+
export declare function roundByDPR(value: number): number;
|
462
|
+
|
463
|
+
export declare class ShadowBlockElement extends BlockElement {
|
464
|
+
/** @hidden */
|
465
|
+
static styles: CSSResultGroup;
|
466
|
+
setHidden(hidden: boolean): void;
|
467
|
+
}
|
468
|
+
|
469
|
+
export { }
|
@@ -18,16 +18,9 @@ import { css } from "lit";
|
|
18
18
|
var componentStyles = css`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}`;
|
19
19
|
|
20
20
|
// src/styles/block-component.styles.ts
|
21
|
-
var blockComponentStyles = css2`${componentStyles}:host{display:block}:host([hidden]){display:none}`;
|
22
|
-
|
23
|
-
// src/components/autocomplete-list/context.ts
|
24
|
-
import { createContext } from "@lit-labs/context";
|
25
|
-
var commandListContext = createContext(
|
26
|
-
"prosekit-autocomplete-list-context"
|
27
|
-
);
|
21
|
+
var blockComponentStyles = css2`${componentStyles}:host{display:block;border-style:solid;border-width:0}:host([hidden]){display:none}`;
|
28
22
|
|
29
23
|
export {
|
30
24
|
__decorateClass,
|
31
|
-
blockComponentStyles
|
32
|
-
commandListContext
|
25
|
+
blockComponentStyles
|
33
26
|
};
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import {
|
2
|
-
__decorateClass,
|
3
|
-
blockComponentStyles,
|
4
2
|
commandListContext
|
5
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-DYEHERSG.js";
|
4
|
+
import {
|
5
|
+
__decorateClass,
|
6
|
+
blockComponentStyles
|
7
|
+
} from "./chunk-3UDA5JEW.js";
|
6
8
|
|
7
9
|
// src/components/autocomplete-item/component.ts
|
8
10
|
import { consume } from "@lit-labs/context";
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import {
|
2
|
+
comboBoxContext
|
3
|
+
} from "./chunk-HMV7TD6T.js";
|
4
|
+
import {
|
5
|
+
LightBlockElement
|
6
|
+
} from "./chunk-TRZW33VF.js";
|
7
|
+
import {
|
8
|
+
__decorateClass,
|
9
|
+
blockComponentStyles
|
10
|
+
} from "./chunk-3UDA5JEW.js";
|
11
|
+
|
12
|
+
// src/components/combo-box-item/component.ts
|
13
|
+
import { consume } from "@lit-labs/context";
|
14
|
+
import "lit";
|
15
|
+
import { customElement, property, query, state } from "lit/decorators.js";
|
16
|
+
var propNames = [];
|
17
|
+
var ComboBoxItem = class extends LightBlockElement {
|
18
|
+
constructor() {
|
19
|
+
super(...arguments);
|
20
|
+
this.selected = false;
|
21
|
+
}
|
22
|
+
updated() {
|
23
|
+
var _a, _b, _c, _d;
|
24
|
+
const content = ((_a = this.textContent) != null ? _a : "").trim();
|
25
|
+
const query2 = ((_c = (_b = this.comboBoxContext) == null ? void 0 : _b.inputValue) != null ? _c : "").trim();
|
26
|
+
const match = content.toLowerCase().includes(query2.toLowerCase());
|
27
|
+
this.selected = match && content === ((_d = this.comboBoxContext) == null ? void 0 : _d.selectedValue);
|
28
|
+
this.ariaSelected = String(this.selected);
|
29
|
+
this.setHidden(!match);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
/** @hidden */
|
33
|
+
ComboBoxItem.styles = blockComponentStyles;
|
34
|
+
__decorateClass([
|
35
|
+
property({ attribute: false })
|
36
|
+
], ComboBoxItem.prototype, "editor", 2);
|
37
|
+
__decorateClass([
|
38
|
+
query("slot")
|
39
|
+
], ComboBoxItem.prototype, "defaultSlot", 2);
|
40
|
+
__decorateClass([
|
41
|
+
property({ type: Boolean, reflect: true, attribute: "data-selected" })
|
42
|
+
], ComboBoxItem.prototype, "selected", 2);
|
43
|
+
__decorateClass([
|
44
|
+
consume({ context: comboBoxContext, subscribe: true }),
|
45
|
+
state({})
|
46
|
+
], ComboBoxItem.prototype, "comboBoxContext", 2);
|
47
|
+
__decorateClass([
|
48
|
+
property({ attribute: false })
|
49
|
+
], ComboBoxItem.prototype, "onSelect", 2);
|
50
|
+
ComboBoxItem = __decorateClass([
|
51
|
+
customElement("prosekit-combo-box-item")
|
52
|
+
], ComboBoxItem);
|
53
|
+
|
54
|
+
export {
|
55
|
+
propNames,
|
56
|
+
ComboBoxItem
|
57
|
+
};
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import {
|
2
|
+
LightBlockElement
|
3
|
+
} from "./chunk-TRZW33VF.js";
|
4
|
+
import {
|
5
|
+
__decorateClass,
|
6
|
+
blockComponentStyles
|
7
|
+
} from "./chunk-3UDA5JEW.js";
|
8
|
+
|
9
|
+
// src/components/popover/options.ts
|
10
|
+
import "@floating-ui/dom";
|
11
|
+
|
12
|
+
// src/components/popover/index.ts
|
13
|
+
import {
|
14
|
+
autoUpdate,
|
15
|
+
computePosition
|
16
|
+
} from "@floating-ui/dom";
|
17
|
+
import "lit";
|
18
|
+
import { customElement, property } from "lit/decorators.js";
|
19
|
+
|
20
|
+
// src/utils/round-by-dpr.ts
|
21
|
+
function roundByDPR(value) {
|
22
|
+
const dpr = window.devicePixelRatio || 1;
|
23
|
+
return Math.round(value * dpr) / dpr;
|
24
|
+
}
|
25
|
+
|
26
|
+
// src/components/popover/default-popover-options.ts
|
27
|
+
import { offset, shift } from "@floating-ui/dom";
|
28
|
+
var defaultPopoverOptions = {
|
29
|
+
placement: "bottom",
|
30
|
+
middleware: [offset(4), shift({ padding: 8 })]
|
31
|
+
};
|
32
|
+
|
33
|
+
// src/components/popover/index.ts
|
34
|
+
var Popover = class extends LightBlockElement {
|
35
|
+
/** @hidden */
|
36
|
+
constructor() {
|
37
|
+
super();
|
38
|
+
this.active = false;
|
39
|
+
this.autoUpdate = false;
|
40
|
+
}
|
41
|
+
/** @hidden */
|
42
|
+
disconnectedCallback() {
|
43
|
+
this.cleanup();
|
44
|
+
}
|
45
|
+
/** @hidden */
|
46
|
+
updated() {
|
47
|
+
this.start();
|
48
|
+
this.setHidden(!this.active);
|
49
|
+
}
|
50
|
+
/** @hidden */
|
51
|
+
start() {
|
52
|
+
this.cleanup();
|
53
|
+
const reference = this.reference;
|
54
|
+
if (!reference)
|
55
|
+
return;
|
56
|
+
if (!this.active)
|
57
|
+
return;
|
58
|
+
if (this.autoUpdate) {
|
59
|
+
this.cleanupAutoUpdate = autoUpdate(
|
60
|
+
reference,
|
61
|
+
this,
|
62
|
+
() => void this.compute(),
|
63
|
+
this.autoUpdateOptions
|
64
|
+
);
|
65
|
+
} else {
|
66
|
+
void this.compute();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
/** @hidden */
|
70
|
+
async compute() {
|
71
|
+
var _a, _b, _c;
|
72
|
+
const reference = this.reference;
|
73
|
+
if (!reference)
|
74
|
+
return;
|
75
|
+
if (!this.active)
|
76
|
+
return;
|
77
|
+
this.setHidden(false);
|
78
|
+
this.style.position = (_b = (_a = this.options) == null ? void 0 : _a.strategy) != null ? _b : "absolute";
|
79
|
+
const options = (_c = this.options) != null ? _c : defaultPopoverOptions;
|
80
|
+
const computed = await computePosition(reference, this, options);
|
81
|
+
const { x, y, strategy } = computed != null ? computed : { x: 0, y: 0, strategy: "absolute" };
|
82
|
+
this.style.top = "0";
|
83
|
+
this.style.left = "0";
|
84
|
+
this.style.position = strategy;
|
85
|
+
this.style.transform = `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`;
|
86
|
+
}
|
87
|
+
/** @hidden */
|
88
|
+
cleanup() {
|
89
|
+
var _a;
|
90
|
+
(_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
|
91
|
+
this.cleanupAutoUpdate = void 0;
|
92
|
+
}
|
93
|
+
};
|
94
|
+
/** @hidden */
|
95
|
+
Popover.styles = blockComponentStyles;
|
96
|
+
__decorateClass([
|
97
|
+
property({ type: Boolean, reflect: true })
|
98
|
+
], Popover.prototype, "active", 2);
|
99
|
+
__decorateClass([
|
100
|
+
property({ attribute: false })
|
101
|
+
], Popover.prototype, "reference", 2);
|
102
|
+
__decorateClass([
|
103
|
+
property({ attribute: false })
|
104
|
+
], Popover.prototype, "options", 2);
|
105
|
+
__decorateClass([
|
106
|
+
property({
|
107
|
+
type: Boolean,
|
108
|
+
reflect: true
|
109
|
+
})
|
110
|
+
], Popover.prototype, "autoUpdate", 2);
|
111
|
+
__decorateClass([
|
112
|
+
property({ type: Object })
|
113
|
+
], Popover.prototype, "autoUpdateOptions", 2);
|
114
|
+
Popover = __decorateClass([
|
115
|
+
customElement("prosekit-popover")
|
116
|
+
], Popover);
|
117
|
+
|
118
|
+
export {
|
119
|
+
Popover
|
120
|
+
};
|