@prosekit/lit 0.0.0-next-20231120040948 → 0.0.0-next-20240421132240
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 +33 -433
- package/dist/prosekit-lit-autocomplete.d.ts +4 -0
- package/dist/prosekit-lit-autocomplete.js +11 -0
- package/dist/prosekit-lit-block-handle.d.ts +2 -0
- package/dist/prosekit-lit-block-handle.js +7 -0
- package/dist/prosekit-lit-inline-popover.d.ts +0 -3
- package/dist/prosekit-lit-inline-popover.js +2 -151
- package/dist/prosekit-lit-popover.d.ts +3 -5
- package/dist/prosekit-lit-popover.js +7 -7
- package/dist/prosekit-lit-resizable.d.ts +2 -0
- package/dist/prosekit-lit-resizable.js +7 -0
- package/dist/prosekit-lit-tooltip.d.ts +3 -0
- package/dist/prosekit-lit-tooltip.js +9 -0
- package/package.json +35 -73
- package/dist/chunk-55G7TJI3.js +0 -48
- package/dist/chunk-6P3YKUWI.js +0 -9
- package/dist/chunk-7WLKD2U6.js +0 -184
- package/dist/chunk-C4MW43I4.js +0 -9
- package/dist/chunk-GWGDLLFN.js +0 -61
- package/dist/chunk-O5JP3B34.js +0 -31
- package/dist/chunk-PCXKL6TA.js +0 -109
- package/dist/chunk-XBNMYITV.js +0 -191
- package/dist/prosekit-lit-autocomplete-empty.d.ts +0 -3
- package/dist/prosekit-lit-autocomplete-empty.js +0 -44
- package/dist/prosekit-lit-autocomplete-item.d.ts +0 -3
- package/dist/prosekit-lit-autocomplete-item.js +0 -10
- package/dist/prosekit-lit-autocomplete-list.d.ts +0 -3
- package/dist/prosekit-lit-autocomplete-list.js +0 -12
- package/dist/prosekit-lit-autocomplete-popover.d.ts +0 -4
- package/dist/prosekit-lit-autocomplete-popover.js +0 -252
- package/dist/prosekit-lit-combo-box-input.d.ts +0 -3
- package/dist/prosekit-lit-combo-box-input.js +0 -72
- package/dist/prosekit-lit-combo-box-item.d.ts +0 -3
- package/dist/prosekit-lit-combo-box-item.js +0 -10
- package/dist/prosekit-lit-combo-box-list.d.ts +0 -3
- package/dist/prosekit-lit-combo-box-list.js +0 -48
- package/dist/prosekit-lit-combo-box.d.ts +0 -3
- package/dist/prosekit-lit-combo-box.js +0 -110
- package/src/index.ts +0 -1
package/dist/chunk-XBNMYITV.js
DELETED
@@ -1,191 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
commandListContext
|
3
|
-
} from "./chunk-6P3YKUWI.js";
|
4
|
-
import {
|
5
|
-
ListManager
|
6
|
-
} from "./chunk-PCXKL6TA.js";
|
7
|
-
import {
|
8
|
-
LightElement,
|
9
|
-
__decorateClass
|
10
|
-
} from "./chunk-O5JP3B34.js";
|
11
|
-
|
12
|
-
// src/components/autocomplete-popover/context.ts
|
13
|
-
import { createContext } from "@lit/context";
|
14
|
-
var commandPopoverContext = createContext(
|
15
|
-
"prosekit-autocomplete-popover-context"
|
16
|
-
);
|
17
|
-
|
18
|
-
// src/components/autocomplete-list/component.ts
|
19
|
-
import { consume, provide } from "@lit/context";
|
20
|
-
import "@prosekit/core";
|
21
|
-
import "lit";
|
22
|
-
import { customElement, property, state } from "lit/decorators.js";
|
23
|
-
|
24
|
-
// src/utils/command-score.ts
|
25
|
-
import commandScoreModule from "@superhuman/command-score";
|
26
|
-
var commandScore = commandScoreModule;
|
27
|
-
|
28
|
-
// src/components/autocomplete-item/helpers.ts
|
29
|
-
function isAutocompleteItem(element) {
|
30
|
-
var _a;
|
31
|
-
return ((_a = element == null ? void 0 : element.tagName) == null ? void 0 : _a.toLowerCase()) === "prosekit-autocomplete-item";
|
32
|
-
}
|
33
|
-
function queryClosestAutocompleteItem(element) {
|
34
|
-
if (!element) {
|
35
|
-
return null;
|
36
|
-
}
|
37
|
-
if (isAutocompleteItem(element)) {
|
38
|
-
return element;
|
39
|
-
}
|
40
|
-
const item = element.closest("prosekit-autocomplete-item");
|
41
|
-
if (isAutocompleteItem(item)) {
|
42
|
-
return item;
|
43
|
-
}
|
44
|
-
return null;
|
45
|
-
}
|
46
|
-
|
47
|
-
// src/components/autocomplete-list/controller.ts
|
48
|
-
import {
|
49
|
-
defineKeymap,
|
50
|
-
withPriority,
|
51
|
-
Priority
|
52
|
-
} from "@prosekit/core";
|
53
|
-
import "lit";
|
54
|
-
var AutocompleteListController = class {
|
55
|
-
constructor(host, keymap) {
|
56
|
-
this.host = host;
|
57
|
-
this.keymap = keymap;
|
58
|
-
this.editor = null;
|
59
|
-
this.cleanup = null;
|
60
|
-
this.host.addController(this);
|
61
|
-
}
|
62
|
-
setEditor(editor) {
|
63
|
-
if (this.editor !== editor) {
|
64
|
-
this.editor = editor;
|
65
|
-
this.defineExtension();
|
66
|
-
}
|
67
|
-
}
|
68
|
-
hostDisconnected() {
|
69
|
-
var _a;
|
70
|
-
(_a = this.cleanup) == null ? void 0 : _a.call(this);
|
71
|
-
this.cleanup = null;
|
72
|
-
}
|
73
|
-
defineExtension() {
|
74
|
-
var _a;
|
75
|
-
(_a = this.cleanup) == null ? void 0 : _a.call(this);
|
76
|
-
this.cleanup = null;
|
77
|
-
if (!this.editor || !this.keymap) {
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
const extension = withPriority(defineKeymap(this.keymap), Priority.highest);
|
81
|
-
this.cleanup = this.editor.use(extension);
|
82
|
-
}
|
83
|
-
};
|
84
|
-
|
85
|
-
// src/components/autocomplete-list/component.ts
|
86
|
-
var propNames = ["editor"];
|
87
|
-
var AutocompleteList = class extends LightElement {
|
88
|
-
constructor() {
|
89
|
-
super(...arguments);
|
90
|
-
/** @hidden */
|
91
|
-
this.listManager = new ListManager({
|
92
|
-
getItems: () => this.items,
|
93
|
-
getSelectedValue: () => this.context.selectedValue,
|
94
|
-
setSelectedValue: (value) => this.updateValue(value),
|
95
|
-
getItemValue: (item) => item.content,
|
96
|
-
queryClosestItem: queryClosestAutocompleteItem,
|
97
|
-
getActive: () => this.active,
|
98
|
-
onDismiss: () => {
|
99
|
-
var _a, _b;
|
100
|
-
return (_b = (_a = this.popoverContext) == null ? void 0 : _a.handleDismiss) == null ? void 0 : _b.call(_a);
|
101
|
-
},
|
102
|
-
onSelect: (item) => {
|
103
|
-
var _a, _b, _c;
|
104
|
-
(_b = (_a = this.popoverContext) == null ? void 0 : _a.handleSubmit) == null ? void 0 : _b.call(_a);
|
105
|
-
(_c = item == null ? void 0 : item.onSelect) == null ? void 0 : _c.call(item);
|
106
|
-
}
|
107
|
-
});
|
108
|
-
/** @hidden */
|
109
|
-
this.controller = new AutocompleteListController(this, {
|
110
|
-
ArrowUp: () => this.listManager.handleArrowUp(),
|
111
|
-
ArrowDown: () => this.listManager.handleArrowDown(),
|
112
|
-
Escape: () => this.listManager.handleEscape(),
|
113
|
-
Enter: () => this.listManager.handleEnter()
|
114
|
-
});
|
115
|
-
this.popoverContext = null;
|
116
|
-
this.context = {
|
117
|
-
scores: /* @__PURE__ */ new Map(),
|
118
|
-
selectedValue: ""
|
119
|
-
};
|
120
|
-
}
|
121
|
-
get active() {
|
122
|
-
var _a, _b;
|
123
|
-
return (_b = (_a = this.popoverContext) == null ? void 0 : _a.active) != null ? _b : false;
|
124
|
-
}
|
125
|
-
connectedCallback() {
|
126
|
-
super.connectedCallback();
|
127
|
-
this.listManager.selectFirstItem();
|
128
|
-
this.addEventListener("mousemove", (event) => {
|
129
|
-
this.listManager.handleMouseMove(event);
|
130
|
-
});
|
131
|
-
this.addEventListener("mouseover", (event) => {
|
132
|
-
this.listManager.handleMouseOver(event);
|
133
|
-
});
|
134
|
-
this.addEventListener("mousedown", (event) => {
|
135
|
-
this.listManager.handleMouseDown(event);
|
136
|
-
});
|
137
|
-
this.addEventListener("click", (event) => {
|
138
|
-
this.listManager.handleClick(event);
|
139
|
-
});
|
140
|
-
}
|
141
|
-
get items() {
|
142
|
-
return Array.from(
|
143
|
-
this.querySelectorAll("prosekit-autocomplete-item")
|
144
|
-
).filter(isAutocompleteItem);
|
145
|
-
}
|
146
|
-
selectFirstItem() {
|
147
|
-
this.listManager.selectFirstItem();
|
148
|
-
}
|
149
|
-
updateValue(selectedValue) {
|
150
|
-
if (this.context.selectedValue === selectedValue) {
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
this.context = { ...this.context, selectedValue };
|
154
|
-
}
|
155
|
-
/** @hidden */
|
156
|
-
willUpdate(changedProperties) {
|
157
|
-
var _a, _b;
|
158
|
-
if (changedProperties.has("editor") && this.editor) {
|
159
|
-
this.controller.setEditor(this.editor);
|
160
|
-
}
|
161
|
-
const query = (_b = (_a = this.popoverContext) == null ? void 0 : _a.query) != null ? _b : "";
|
162
|
-
const scores = new Map(
|
163
|
-
this.items.map((item) => {
|
164
|
-
const content = item.content;
|
165
|
-
const score = commandScore(content, query);
|
166
|
-
return [content, score];
|
167
|
-
})
|
168
|
-
);
|
169
|
-
this.context = { ...this.context, scores };
|
170
|
-
}
|
171
|
-
};
|
172
|
-
__decorateClass([
|
173
|
-
property({ attribute: false })
|
174
|
-
], AutocompleteList.prototype, "editor", 2);
|
175
|
-
__decorateClass([
|
176
|
-
consume({ context: commandPopoverContext, subscribe: true }),
|
177
|
-
state()
|
178
|
-
], AutocompleteList.prototype, "popoverContext", 2);
|
179
|
-
__decorateClass([
|
180
|
-
provide({ context: commandListContext }),
|
181
|
-
state()
|
182
|
-
], AutocompleteList.prototype, "context", 2);
|
183
|
-
AutocompleteList = __decorateClass([
|
184
|
-
customElement("prosekit-autocomplete-list")
|
185
|
-
], AutocompleteList);
|
186
|
-
|
187
|
-
export {
|
188
|
-
commandPopoverContext,
|
189
|
-
propNames,
|
190
|
-
AutocompleteList
|
191
|
-
};
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
commandListContext
|
3
|
-
} from "./chunk-6P3YKUWI.js";
|
4
|
-
import {
|
5
|
-
LightElement,
|
6
|
-
__decorateClass
|
7
|
-
} from "./chunk-O5JP3B34.js";
|
8
|
-
|
9
|
-
// src/components/autocomplete-empty/index.ts
|
10
|
-
import { consume } from "@lit/context";
|
11
|
-
import "lit";
|
12
|
-
import { customElement, state } from "lit/decorators.js";
|
13
|
-
var propNames = [];
|
14
|
-
var AutocompleteEmpty = class extends LightElement {
|
15
|
-
connectedCallback() {
|
16
|
-
super.connectedCallback();
|
17
|
-
this.role = "option";
|
18
|
-
}
|
19
|
-
willUpdate(_changedProperties) {
|
20
|
-
var _a;
|
21
|
-
const scores = (_a = this.listContext) == null ? void 0 : _a.scores;
|
22
|
-
let hasMatch = false;
|
23
|
-
if (scores) {
|
24
|
-
for (const score of scores.values()) {
|
25
|
-
if (score > 0) {
|
26
|
-
hasMatch = true;
|
27
|
-
break;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
this.setHidden(hasMatch);
|
32
|
-
}
|
33
|
-
};
|
34
|
-
__decorateClass([
|
35
|
-
consume({ context: commandListContext, subscribe: true }),
|
36
|
-
state()
|
37
|
-
], AutocompleteEmpty.prototype, "listContext", 2);
|
38
|
-
AutocompleteEmpty = __decorateClass([
|
39
|
-
customElement("prosekit-autocomplete-empty")
|
40
|
-
], AutocompleteEmpty);
|
41
|
-
export {
|
42
|
-
AutocompleteEmpty,
|
43
|
-
propNames
|
44
|
-
};
|
@@ -1,252 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
commandPopoverContext
|
3
|
-
} from "./chunk-XBNMYITV.js";
|
4
|
-
import "./chunk-GWGDLLFN.js";
|
5
|
-
import "./chunk-6P3YKUWI.js";
|
6
|
-
import {
|
7
|
-
Popover
|
8
|
-
} from "./chunk-7WLKD2U6.js";
|
9
|
-
import "./chunk-PCXKL6TA.js";
|
10
|
-
import {
|
11
|
-
__decorateClass
|
12
|
-
} from "./chunk-O5JP3B34.js";
|
13
|
-
|
14
|
-
// src/components/autocomplete-popover/index.ts
|
15
|
-
import { provide } from "@lit/context";
|
16
|
-
import "@prosekit/core";
|
17
|
-
import { customElement, property, state } from "lit/decorators.js";
|
18
|
-
|
19
|
-
// src/components/autocomplete-list/helpers.ts
|
20
|
-
function isAutocompleteList(element) {
|
21
|
-
var _a;
|
22
|
-
return ((_a = element == null ? void 0 : element.tagName) == null ? void 0 : _a.toLowerCase()) === "prosekit-autocomplete-list";
|
23
|
-
}
|
24
|
-
|
25
|
-
// src/components/autocomplete-popover/controller.ts
|
26
|
-
import "@prosekit/core";
|
27
|
-
import {
|
28
|
-
AutocompleteRule,
|
29
|
-
defineAutocomplete
|
30
|
-
} from "@prosekit/extensions/autocomplete";
|
31
|
-
import "lit";
|
32
|
-
|
33
|
-
// src/components/autocomplete-popover/helpers.ts
|
34
|
-
function defaultQueryBuilder(match) {
|
35
|
-
return match[0].toLowerCase().replace(/[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/g, "").replace(/\s\s+/g, " ").trim();
|
36
|
-
}
|
37
|
-
|
38
|
-
// src/components/autocomplete-popover/controller.ts
|
39
|
-
var AutocompletePopoverController = class {
|
40
|
-
constructor(host, onChange) {
|
41
|
-
this.host = host;
|
42
|
-
this.onChange = onChange;
|
43
|
-
this.reference = null;
|
44
|
-
this.editor = null;
|
45
|
-
this.regex = null;
|
46
|
-
this.cleanup = null;
|
47
|
-
this.handleDismiss = null;
|
48
|
-
this.handleSubmit = null;
|
49
|
-
this.host.addController(this);
|
50
|
-
}
|
51
|
-
setEditor(editor) {
|
52
|
-
if (this.editor !== editor) {
|
53
|
-
this.editor = editor;
|
54
|
-
this.defineExtension();
|
55
|
-
this.host.requestUpdate();
|
56
|
-
}
|
57
|
-
}
|
58
|
-
setRegex(regex) {
|
59
|
-
if (this.regex !== regex) {
|
60
|
-
this.regex = regex;
|
61
|
-
this.defineExtension();
|
62
|
-
this.host.requestUpdate();
|
63
|
-
}
|
64
|
-
}
|
65
|
-
defineExtension() {
|
66
|
-
var _a;
|
67
|
-
const regex = this.regex;
|
68
|
-
const editor = this.editor;
|
69
|
-
if (!regex || !editor) {
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
(_a = this.cleanup) == null ? void 0 : _a.call(this);
|
73
|
-
this.cleanup = null;
|
74
|
-
const handleEnter = (options) => {
|
75
|
-
const span = editor.view.dom.querySelector(
|
76
|
-
".prosemirror-prediction-match"
|
77
|
-
);
|
78
|
-
if (span) {
|
79
|
-
this.reference = span;
|
80
|
-
}
|
81
|
-
const query = defaultQueryBuilder(options.match);
|
82
|
-
this.onChange(query != null ? query : "", !!this.reference);
|
83
|
-
this.handleDismiss = options.ignoreMatch;
|
84
|
-
this.handleSubmit = options.deleteMatch;
|
85
|
-
};
|
86
|
-
const handleLeave = () => {
|
87
|
-
this.reference = null;
|
88
|
-
this.host.requestUpdate();
|
89
|
-
this.onChange("", false);
|
90
|
-
this.handleDismiss = null;
|
91
|
-
this.handleSubmit = null;
|
92
|
-
};
|
93
|
-
const rule = new AutocompleteRule({
|
94
|
-
regex,
|
95
|
-
onEnter: handleEnter,
|
96
|
-
onLeave: handleLeave
|
97
|
-
});
|
98
|
-
const extension = defineAutocomplete(rule);
|
99
|
-
this.cleanup = editor.use(extension);
|
100
|
-
}
|
101
|
-
hostDisconnected() {
|
102
|
-
var _a;
|
103
|
-
(_a = this.cleanup) == null ? void 0 : _a.call(this);
|
104
|
-
this.cleanup = null;
|
105
|
-
}
|
106
|
-
};
|
107
|
-
|
108
|
-
// src/components/autocomplete-popover/default-popover-options.ts
|
109
|
-
import {
|
110
|
-
flip,
|
111
|
-
inline,
|
112
|
-
offset,
|
113
|
-
shift,
|
114
|
-
size
|
115
|
-
} from "@floating-ui/dom";
|
116
|
-
var defaultDetectOverflowOptions = {
|
117
|
-
// Make sure the popover is always at least 8px away from the boundary
|
118
|
-
padding: 8
|
119
|
-
};
|
120
|
-
var defaultPopoverOptions = {
|
121
|
-
// The main axis is the y axis, and we place the popover at the bottom of the
|
122
|
-
// reference element.
|
123
|
-
//
|
124
|
-
// The cross axis is the x axis, and we place the popover at the start of the
|
125
|
-
// reference element. The reference element and the popover are left-aligned.
|
126
|
-
placement: "bottom-start",
|
127
|
-
middleware: [
|
128
|
-
// Use the text caret as the reference point
|
129
|
-
inline(),
|
130
|
-
offset(() => ({
|
131
|
-
// Move down the popover by 4px
|
132
|
-
mainAxis: 4
|
133
|
-
})),
|
134
|
-
// Flip the popover to the top if it's overflowing the viewport
|
135
|
-
//
|
136
|
-
// When `flipAlignment` is true, which is the default, ensure `flip() `is
|
137
|
-
// placed before `shift()` in your middleware array.
|
138
|
-
//
|
139
|
-
// https://floating-ui.com/docs/flip#flipalignment
|
140
|
-
flip({
|
141
|
-
// Flip the popover to the top if necessary.
|
142
|
-
mainAxis: true,
|
143
|
-
// We don't want to flip the popover to the left or right, since `shift()`
|
144
|
-
// will handle this.
|
145
|
-
crossAxis: false,
|
146
|
-
...defaultDetectOverflowOptions
|
147
|
-
}),
|
148
|
-
// We need to place `shift()` after `flip()`. See https://floating-ui.com/docs/flip#flipalignment
|
149
|
-
shift({
|
150
|
-
...defaultDetectOverflowOptions
|
151
|
-
}),
|
152
|
-
size({
|
153
|
-
apply: ({ availableWidth, availableHeight, elements }) => {
|
154
|
-
elements.floating.style.setProperty(
|
155
|
-
"max-width",
|
156
|
-
`${Math.floor(availableWidth)}px`
|
157
|
-
);
|
158
|
-
elements.floating.style.setProperty(
|
159
|
-
"max-height",
|
160
|
-
`${Math.floor(availableHeight)}px`
|
161
|
-
);
|
162
|
-
},
|
163
|
-
...defaultDetectOverflowOptions
|
164
|
-
})
|
165
|
-
]
|
166
|
-
};
|
167
|
-
|
168
|
-
// src/components/autocomplete-popover/index.ts
|
169
|
-
var propNames = ["editor", "regex", "popoverOptions"];
|
170
|
-
var AutocompletePopover = class extends Popover {
|
171
|
-
constructor() {
|
172
|
-
super(...arguments);
|
173
|
-
/** @hidden */
|
174
|
-
this.controller = new AutocompletePopoverController(
|
175
|
-
this,
|
176
|
-
this.updateContext.bind(this)
|
177
|
-
);
|
178
|
-
this.popoverOptions = defaultPopoverOptions;
|
179
|
-
this.context = {
|
180
|
-
active: false,
|
181
|
-
query: "",
|
182
|
-
handleDismiss: () => {
|
183
|
-
var _a, _b;
|
184
|
-
return (_b = (_a = this.controller).handleDismiss) == null ? void 0 : _b.call(_a);
|
185
|
-
},
|
186
|
-
handleSubmit: () => {
|
187
|
-
var _a, _b;
|
188
|
-
return (_b = (_a = this.controller).handleSubmit) == null ? void 0 : _b.call(_a);
|
189
|
-
}
|
190
|
-
};
|
191
|
-
}
|
192
|
-
get list() {
|
193
|
-
const element = this.querySelector("prosekit-autocomplete-list");
|
194
|
-
return isAutocompleteList(element) ? element : null;
|
195
|
-
}
|
196
|
-
updateContext(query, active) {
|
197
|
-
if (this.context.query === query && this.context.active === active) {
|
198
|
-
return;
|
199
|
-
}
|
200
|
-
this.context = { ...this.context, query, active };
|
201
|
-
requestAnimationFrame(() => {
|
202
|
-
var _a;
|
203
|
-
(_a = this.list) == null ? void 0 : _a.selectFirstItem();
|
204
|
-
});
|
205
|
-
}
|
206
|
-
/** @hidden */
|
207
|
-
willUpdate(changedProperties) {
|
208
|
-
var _a, _b;
|
209
|
-
super.willUpdate(changedProperties);
|
210
|
-
if (this.editor) {
|
211
|
-
this.controller.setEditor(this.editor);
|
212
|
-
}
|
213
|
-
if (this.regex) {
|
214
|
-
this.controller.setRegex(this.regex);
|
215
|
-
}
|
216
|
-
this.active = !!((_a = this.controller) == null ? void 0 : _a.reference);
|
217
|
-
this.reference = (_b = this.controller.reference) != null ? _b : void 0;
|
218
|
-
this.options = this.popoverOptions;
|
219
|
-
}
|
220
|
-
/** @hidden */
|
221
|
-
hide() {
|
222
|
-
var _a;
|
223
|
-
super.hide();
|
224
|
-
if ((_a = this.controller) == null ? void 0 : _a.reference) {
|
225
|
-
this.controller.reference = null;
|
226
|
-
this.reference = void 0;
|
227
|
-
}
|
228
|
-
}
|
229
|
-
};
|
230
|
-
__decorateClass([
|
231
|
-
property({ attribute: false })
|
232
|
-
], AutocompletePopover.prototype, "editor", 2);
|
233
|
-
__decorateClass([
|
234
|
-
property({ attribute: false })
|
235
|
-
], AutocompletePopover.prototype, "regex", 2);
|
236
|
-
__decorateClass([
|
237
|
-
property({ attribute: false })
|
238
|
-
], AutocompletePopover.prototype, "popoverOptions", 2);
|
239
|
-
__decorateClass([
|
240
|
-
provide({ context: commandPopoverContext }),
|
241
|
-
state()
|
242
|
-
], AutocompletePopover.prototype, "context", 2);
|
243
|
-
__decorateClass([
|
244
|
-
property({ attribute: false })
|
245
|
-
], AutocompletePopover.prototype, "onSelect", 2);
|
246
|
-
AutocompletePopover = __decorateClass([
|
247
|
-
customElement("prosekit-autocomplete-popover")
|
248
|
-
], AutocompletePopover);
|
249
|
-
export {
|
250
|
-
AutocompletePopover,
|
251
|
-
propNames
|
252
|
-
};
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
comboBoxContext
|
3
|
-
} from "./chunk-C4MW43I4.js";
|
4
|
-
import {
|
5
|
-
LightElement,
|
6
|
-
__decorateClass
|
7
|
-
} from "./chunk-O5JP3B34.js";
|
8
|
-
|
9
|
-
// src/components/combo-box-input/index.ts
|
10
|
-
import { consume } from "@lit/context";
|
11
|
-
import { html } from "lit";
|
12
|
-
import { customElement, property, state } from "lit/decorators.js";
|
13
|
-
var propNames = ["placeholder"];
|
14
|
-
var ComboBoxInput = class extends LightElement {
|
15
|
-
constructor() {
|
16
|
-
super(...arguments);
|
17
|
-
this.placeholder = "";
|
18
|
-
this.comboBoxContext = null;
|
19
|
-
this.visible = false;
|
20
|
-
}
|
21
|
-
handleKeydown(event) {
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
23
|
-
if (event.code === "ArrowUp") {
|
24
|
-
(_b = (_a = this.comboBoxContext) == null ? void 0 : _a.listManager) == null ? void 0 : _b.handleArrowUp();
|
25
|
-
} else if (event.code === "ArrowDown") {
|
26
|
-
(_d = (_c = this.comboBoxContext) == null ? void 0 : _c.listManager) == null ? void 0 : _d.handleArrowDown();
|
27
|
-
} else if (event.code === "Escape") {
|
28
|
-
(_f = (_e = this.comboBoxContext) == null ? void 0 : _e.listManager) == null ? void 0 : _f.handleEscape();
|
29
|
-
} else if (event.code === "Enter") {
|
30
|
-
(_h = (_g = this.comboBoxContext) == null ? void 0 : _g.listManager) == null ? void 0 : _h.handleEnter();
|
31
|
-
}
|
32
|
-
}
|
33
|
-
handleInput(event) {
|
34
|
-
var _a, _b, _c;
|
35
|
-
const value = (_b = (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.value) != null ? _b : "";
|
36
|
-
(_c = this.comboBoxContext) == null ? void 0 : _c.setInputValue(value);
|
37
|
-
}
|
38
|
-
firstUpdated() {
|
39
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
40
|
-
const visible = entries.some(
|
41
|
-
(entry) => entry.contentRect.width > 0 && entry.contentRect.width > 0
|
42
|
-
);
|
43
|
-
if (this.visible !== visible && visible) {
|
44
|
-
setTimeout(() => {
|
45
|
-
var _a;
|
46
|
-
return (_a = this.querySelector("input")) == null ? void 0 : _a.focus();
|
47
|
-
}, 0);
|
48
|
-
}
|
49
|
-
this.visible = visible;
|
50
|
-
});
|
51
|
-
resizeObserver.observe(this);
|
52
|
-
}
|
53
|
-
/** @hidden */
|
54
|
-
render() {
|
55
|
-
var _a, _b;
|
56
|
-
return html`<input placeholder="${this.placeholder}" @keydown="${(event) => this.handleKeydown(event)}" @input="${(event) => this.handleInput(event)}" value="${(_b = (_a = this.comboBoxContext) == null ? void 0 : _a.inputValue) != null ? _b : ""}">`;
|
57
|
-
}
|
58
|
-
};
|
59
|
-
__decorateClass([
|
60
|
-
property({ attribute: true })
|
61
|
-
], ComboBoxInput.prototype, "placeholder", 2);
|
62
|
-
__decorateClass([
|
63
|
-
consume({ context: comboBoxContext, subscribe: true }),
|
64
|
-
state()
|
65
|
-
], ComboBoxInput.prototype, "comboBoxContext", 2);
|
66
|
-
ComboBoxInput = __decorateClass([
|
67
|
-
customElement("prosekit-combo-box-input")
|
68
|
-
], ComboBoxInput);
|
69
|
-
export {
|
70
|
-
ComboBoxInput,
|
71
|
-
propNames
|
72
|
-
};
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
comboBoxContext
|
3
|
-
} from "./chunk-C4MW43I4.js";
|
4
|
-
import {
|
5
|
-
LightElement,
|
6
|
-
__decorateClass
|
7
|
-
} from "./chunk-O5JP3B34.js";
|
8
|
-
|
9
|
-
// src/components/combo-box-list/component.ts
|
10
|
-
import { consume } from "@lit/context";
|
11
|
-
import { customElement, state } from "lit/decorators.js";
|
12
|
-
var propNames = [];
|
13
|
-
var ComboBoxList = class extends LightElement {
|
14
|
-
constructor() {
|
15
|
-
super(...arguments);
|
16
|
-
this.comboBoxContext = null;
|
17
|
-
}
|
18
|
-
connectedCallback() {
|
19
|
-
super.connectedCallback();
|
20
|
-
this.addEventListener("mousemove", (event) => {
|
21
|
-
var _a;
|
22
|
-
(_a = this.comboBoxContext) == null ? void 0 : _a.listManager.handleMouseMove(event);
|
23
|
-
});
|
24
|
-
this.addEventListener("mouseover", (event) => {
|
25
|
-
var _a;
|
26
|
-
(_a = this.comboBoxContext) == null ? void 0 : _a.listManager.handleMouseOver(event);
|
27
|
-
});
|
28
|
-
this.addEventListener("mousedown", (event) => {
|
29
|
-
var _a;
|
30
|
-
(_a = this.comboBoxContext) == null ? void 0 : _a.listManager.handleMouseDown(event);
|
31
|
-
});
|
32
|
-
this.addEventListener("click", (event) => {
|
33
|
-
var _a;
|
34
|
-
(_a = this.comboBoxContext) == null ? void 0 : _a.listManager.handleClick(event);
|
35
|
-
});
|
36
|
-
}
|
37
|
-
};
|
38
|
-
__decorateClass([
|
39
|
-
consume({ context: comboBoxContext, subscribe: true }),
|
40
|
-
state()
|
41
|
-
], ComboBoxList.prototype, "comboBoxContext", 2);
|
42
|
-
ComboBoxList = __decorateClass([
|
43
|
-
customElement("prosekit-combo-box-list")
|
44
|
-
], ComboBoxList);
|
45
|
-
export {
|
46
|
-
ComboBoxList,
|
47
|
-
propNames
|
48
|
-
};
|