@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
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
} from "
|
5
|
-
import "./chunk-O5JP3B34.js";
|
1
|
+
// src/components/popover/index.ts
|
2
|
+
import { PopoverContentElement } from "@prosekit/web/popover";
|
3
|
+
import { PopoverRootElement } from "@prosekit/web/popover";
|
4
|
+
import { PopoverTriggerElement } from "@prosekit/web/popover";
|
6
5
|
export {
|
7
|
-
|
8
|
-
|
6
|
+
PopoverContentElement as PopoverContent,
|
7
|
+
PopoverRootElement as PopoverRoot,
|
8
|
+
PopoverTriggerElement as PopoverTrigger
|
9
9
|
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// src/components/resizable/index.ts
|
2
|
+
import { ResizableHandleElement } from "@prosekit/web/resizable";
|
3
|
+
import { ResizableRootElement } from "@prosekit/web/resizable";
|
4
|
+
export {
|
5
|
+
ResizableHandleElement as ResizableHandle,
|
6
|
+
ResizableRootElement as ResizableRoot
|
7
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// src/components/tooltip/index.ts
|
2
|
+
import { TooltipContentElement } from "@prosekit/web/tooltip";
|
3
|
+
import { TooltipRootElement } from "@prosekit/web/tooltip";
|
4
|
+
import { TooltipTriggerElement } from "@prosekit/web/tooltip";
|
5
|
+
export {
|
6
|
+
TooltipContentElement as TooltipContent,
|
7
|
+
TooltipRootElement as TooltipRoot,
|
8
|
+
TooltipTriggerElement as TooltipTrigger
|
9
|
+
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/lit",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next-
|
4
|
+
"version": "0.0.0-next-20240421132240",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -30,45 +30,15 @@
|
|
30
30
|
"import": "./dist/prosekit-lit.js",
|
31
31
|
"default": "./dist/prosekit-lit.js"
|
32
32
|
},
|
33
|
-
"./autocomplete
|
34
|
-
"types": "./dist/prosekit-lit-autocomplete
|
35
|
-
"import": "./dist/prosekit-lit-autocomplete
|
36
|
-
"default": "./dist/prosekit-lit-autocomplete
|
33
|
+
"./autocomplete": {
|
34
|
+
"types": "./dist/prosekit-lit-autocomplete.d.ts",
|
35
|
+
"import": "./dist/prosekit-lit-autocomplete.js",
|
36
|
+
"default": "./dist/prosekit-lit-autocomplete.js"
|
37
37
|
},
|
38
|
-
"./
|
39
|
-
"types": "./dist/prosekit-lit-
|
40
|
-
"import": "./dist/prosekit-lit-
|
41
|
-
"default": "./dist/prosekit-lit-
|
42
|
-
},
|
43
|
-
"./autocomplete-list": {
|
44
|
-
"types": "./dist/prosekit-lit-autocomplete-list.d.ts",
|
45
|
-
"import": "./dist/prosekit-lit-autocomplete-list.js",
|
46
|
-
"default": "./dist/prosekit-lit-autocomplete-list.js"
|
47
|
-
},
|
48
|
-
"./autocomplete-popover": {
|
49
|
-
"types": "./dist/prosekit-lit-autocomplete-popover.d.ts",
|
50
|
-
"import": "./dist/prosekit-lit-autocomplete-popover.js",
|
51
|
-
"default": "./dist/prosekit-lit-autocomplete-popover.js"
|
52
|
-
},
|
53
|
-
"./combo-box": {
|
54
|
-
"types": "./dist/prosekit-lit-combo-box.d.ts",
|
55
|
-
"import": "./dist/prosekit-lit-combo-box.js",
|
56
|
-
"default": "./dist/prosekit-lit-combo-box.js"
|
57
|
-
},
|
58
|
-
"./combo-box-input": {
|
59
|
-
"types": "./dist/prosekit-lit-combo-box-input.d.ts",
|
60
|
-
"import": "./dist/prosekit-lit-combo-box-input.js",
|
61
|
-
"default": "./dist/prosekit-lit-combo-box-input.js"
|
62
|
-
},
|
63
|
-
"./combo-box-item": {
|
64
|
-
"types": "./dist/prosekit-lit-combo-box-item.d.ts",
|
65
|
-
"import": "./dist/prosekit-lit-combo-box-item.js",
|
66
|
-
"default": "./dist/prosekit-lit-combo-box-item.js"
|
67
|
-
},
|
68
|
-
"./combo-box-list": {
|
69
|
-
"types": "./dist/prosekit-lit-combo-box-list.d.ts",
|
70
|
-
"import": "./dist/prosekit-lit-combo-box-list.js",
|
71
|
-
"default": "./dist/prosekit-lit-combo-box-list.js"
|
38
|
+
"./block-handle": {
|
39
|
+
"types": "./dist/prosekit-lit-block-handle.d.ts",
|
40
|
+
"import": "./dist/prosekit-lit-block-handle.js",
|
41
|
+
"default": "./dist/prosekit-lit-block-handle.js"
|
72
42
|
},
|
73
43
|
"./inline-popover": {
|
74
44
|
"types": "./dist/prosekit-lit-inline-popover.d.ts",
|
@@ -79,27 +49,31 @@
|
|
79
49
|
"types": "./dist/prosekit-lit-popover.d.ts",
|
80
50
|
"import": "./dist/prosekit-lit-popover.js",
|
81
51
|
"default": "./dist/prosekit-lit-popover.js"
|
52
|
+
},
|
53
|
+
"./resizable": {
|
54
|
+
"types": "./dist/prosekit-lit-resizable.d.ts",
|
55
|
+
"import": "./dist/prosekit-lit-resizable.js",
|
56
|
+
"default": "./dist/prosekit-lit-resizable.js"
|
57
|
+
},
|
58
|
+
"./tooltip": {
|
59
|
+
"types": "./dist/prosekit-lit-tooltip.d.ts",
|
60
|
+
"import": "./dist/prosekit-lit-tooltip.js",
|
61
|
+
"default": "./dist/prosekit-lit-tooltip.js"
|
82
62
|
}
|
83
63
|
},
|
84
64
|
"files": [
|
85
65
|
"dist"
|
86
66
|
],
|
87
67
|
"dependencies": {
|
88
|
-
"@
|
89
|
-
"@
|
90
|
-
"
|
91
|
-
"@prosekit/extensions": "0.0.0-next-20231120040948",
|
92
|
-
"@prosekit/pm": "0.0.0-next-20231120040948",
|
93
|
-
"@superhuman/command-score": "^0.5.0",
|
94
|
-
"lit": "^3.1.0"
|
68
|
+
"@lit/context": "^1.1.1",
|
69
|
+
"@prosekit/web": "0.0.0-next-20240421132240",
|
70
|
+
"lit": "^3.1.3"
|
95
71
|
},
|
96
72
|
"devDependencies": {
|
97
73
|
"@prosekit/dev": "*",
|
98
|
-
"
|
99
|
-
"
|
100
|
-
"
|
101
|
-
"vitest": "^0.34.6",
|
102
|
-
"vue": "^3.3.8"
|
74
|
+
"tsup": "^8.0.2",
|
75
|
+
"typescript": "^5.4.5",
|
76
|
+
"vitest": "^1.5.0"
|
103
77
|
},
|
104
78
|
"scripts": {
|
105
79
|
"build:tsup": "tsup",
|
@@ -111,35 +85,23 @@
|
|
111
85
|
".": [
|
112
86
|
"./dist/prosekit-lit.d.ts"
|
113
87
|
],
|
114
|
-
"autocomplete
|
115
|
-
"./dist/prosekit-lit-autocomplete
|
88
|
+
"autocomplete": [
|
89
|
+
"./dist/prosekit-lit-autocomplete.d.ts"
|
116
90
|
],
|
117
|
-
"
|
118
|
-
"./dist/prosekit-lit-
|
119
|
-
],
|
120
|
-
"autocomplete-list": [
|
121
|
-
"./dist/prosekit-lit-autocomplete-list.d.ts"
|
122
|
-
],
|
123
|
-
"autocomplete-popover": [
|
124
|
-
"./dist/prosekit-lit-autocomplete-popover.d.ts"
|
125
|
-
],
|
126
|
-
"combo-box": [
|
127
|
-
"./dist/prosekit-lit-combo-box.d.ts"
|
128
|
-
],
|
129
|
-
"combo-box-input": [
|
130
|
-
"./dist/prosekit-lit-combo-box-input.d.ts"
|
131
|
-
],
|
132
|
-
"combo-box-item": [
|
133
|
-
"./dist/prosekit-lit-combo-box-item.d.ts"
|
134
|
-
],
|
135
|
-
"combo-box-list": [
|
136
|
-
"./dist/prosekit-lit-combo-box-list.d.ts"
|
91
|
+
"block-handle": [
|
92
|
+
"./dist/prosekit-lit-block-handle.d.ts"
|
137
93
|
],
|
138
94
|
"inline-popover": [
|
139
95
|
"./dist/prosekit-lit-inline-popover.d.ts"
|
140
96
|
],
|
141
97
|
"popover": [
|
142
98
|
"./dist/prosekit-lit-popover.d.ts"
|
99
|
+
],
|
100
|
+
"resizable": [
|
101
|
+
"./dist/prosekit-lit-resizable.d.ts"
|
102
|
+
],
|
103
|
+
"tooltip": [
|
104
|
+
"./dist/prosekit-lit-tooltip.d.ts"
|
143
105
|
]
|
144
106
|
}
|
145
107
|
}
|
package/dist/chunk-55G7TJI3.js
DELETED
@@ -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-item/component.ts
|
10
|
-
import { consume } from "@lit/context";
|
11
|
-
import { customElement, property, state } from "lit/decorators.js";
|
12
|
-
var propNames = [];
|
13
|
-
var ComboBoxItem = class extends LightElement {
|
14
|
-
constructor() {
|
15
|
-
super(...arguments);
|
16
|
-
this.selected = false;
|
17
|
-
}
|
18
|
-
updated() {
|
19
|
-
var _a, _b, _c, _d;
|
20
|
-
const content = ((_a = this.textContent) != null ? _a : "").trim();
|
21
|
-
const query = ((_c = (_b = this.comboBoxContext) == null ? void 0 : _b.inputValue) != null ? _c : "").trim();
|
22
|
-
const match = content.toLowerCase().includes(query.toLowerCase());
|
23
|
-
this.selected = match && content === ((_d = this.comboBoxContext) == null ? void 0 : _d.selectedValue);
|
24
|
-
this.ariaSelected = String(this.selected);
|
25
|
-
this.setHidden(!match);
|
26
|
-
}
|
27
|
-
};
|
28
|
-
__decorateClass([
|
29
|
-
property({ attribute: false })
|
30
|
-
], ComboBoxItem.prototype, "editor", 2);
|
31
|
-
__decorateClass([
|
32
|
-
property({ type: Boolean, reflect: true, attribute: "data-selected" })
|
33
|
-
], ComboBoxItem.prototype, "selected", 2);
|
34
|
-
__decorateClass([
|
35
|
-
consume({ context: comboBoxContext, subscribe: true }),
|
36
|
-
state({})
|
37
|
-
], ComboBoxItem.prototype, "comboBoxContext", 2);
|
38
|
-
__decorateClass([
|
39
|
-
property({ attribute: false })
|
40
|
-
], ComboBoxItem.prototype, "onSelect", 2);
|
41
|
-
ComboBoxItem = __decorateClass([
|
42
|
-
customElement("prosekit-combo-box-item")
|
43
|
-
], ComboBoxItem);
|
44
|
-
|
45
|
-
export {
|
46
|
-
propNames,
|
47
|
-
ComboBoxItem
|
48
|
-
};
|
package/dist/chunk-6P3YKUWI.js
DELETED
package/dist/chunk-7WLKD2U6.js
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
LightElement,
|
3
|
-
__decorateClass
|
4
|
-
} from "./chunk-O5JP3B34.js";
|
5
|
-
|
6
|
-
// src/components/popover/index.ts
|
7
|
-
import {
|
8
|
-
autoUpdate,
|
9
|
-
computePosition
|
10
|
-
} from "@floating-ui/dom";
|
11
|
-
import { customElement, property } from "lit/decorators.js";
|
12
|
-
|
13
|
-
// src/utils/round-by-dpr.ts
|
14
|
-
function roundByDPR(value) {
|
15
|
-
const dpr = window.devicePixelRatio || 1;
|
16
|
-
return Math.round(value * dpr) / dpr;
|
17
|
-
}
|
18
|
-
|
19
|
-
// src/components/popover/default-popover-options.ts
|
20
|
-
import { offset, shift, size } from "@floating-ui/dom";
|
21
|
-
|
22
|
-
// src/components/popover/options.ts
|
23
|
-
import "@floating-ui/dom";
|
24
|
-
|
25
|
-
// src/components/popover/default-popover-options.ts
|
26
|
-
var defaultPopoverOptions = {
|
27
|
-
placement: "bottom",
|
28
|
-
middleware: [
|
29
|
-
offset({ mainAxis: 8, crossAxis: 8 }),
|
30
|
-
shift({ padding: 8 }),
|
31
|
-
size({
|
32
|
-
apply: ({ availableWidth, availableHeight, elements }) => {
|
33
|
-
elements.floating.style.setProperty(
|
34
|
-
"max-width",
|
35
|
-
`${Math.floor(availableWidth)}px`
|
36
|
-
);
|
37
|
-
elements.floating.style.setProperty(
|
38
|
-
"max-height",
|
39
|
-
`${Math.floor(availableHeight)}px`
|
40
|
-
);
|
41
|
-
},
|
42
|
-
padding: 8
|
43
|
-
})
|
44
|
-
]
|
45
|
-
};
|
46
|
-
|
47
|
-
// src/components/popover/index.ts
|
48
|
-
var propNames = [
|
49
|
-
"active",
|
50
|
-
"reference",
|
51
|
-
"options",
|
52
|
-
"autoUpdate",
|
53
|
-
"autoUpdateOptions"
|
54
|
-
];
|
55
|
-
var Popover = class extends LightElement {
|
56
|
-
/** @hidden */
|
57
|
-
constructor() {
|
58
|
-
super();
|
59
|
-
this.active = false;
|
60
|
-
this.autoUpdate = false;
|
61
|
-
this.dismiss = "on";
|
62
|
-
this.handleDocumentMouseDown = (event) => {
|
63
|
-
const path = event.composedPath();
|
64
|
-
if (!path.includes(this)) {
|
65
|
-
this.hide();
|
66
|
-
}
|
67
|
-
};
|
68
|
-
this.handleDocumentKeyDown = (event) => {
|
69
|
-
if (event.key === "Escape" && this.active) {
|
70
|
-
event.stopPropagation();
|
71
|
-
this.hide();
|
72
|
-
return;
|
73
|
-
}
|
74
|
-
};
|
75
|
-
}
|
76
|
-
/** @hidden */
|
77
|
-
connectedCallback() {
|
78
|
-
super.connectedCallback();
|
79
|
-
const clickEnabled = this.dismiss === "on" || this.dismiss === "click";
|
80
|
-
const escapeEnabled = this.dismiss === "on" || this.dismiss === "escape";
|
81
|
-
const handleMouseDown = clickEnabled ? this.handleDocumentMouseDown.bind(this) : null;
|
82
|
-
const handleKeyDown = escapeEnabled ? this.handleDocumentKeyDown.bind(this) : null;
|
83
|
-
handleMouseDown && document.addEventListener("mousedown", handleMouseDown);
|
84
|
-
handleKeyDown && document.addEventListener("keydown", handleKeyDown);
|
85
|
-
this.disposeEventListeners = () => {
|
86
|
-
handleMouseDown && document.removeEventListener("mousedown", handleMouseDown);
|
87
|
-
handleKeyDown && document.removeEventListener("keydown", handleKeyDown);
|
88
|
-
};
|
89
|
-
}
|
90
|
-
/** @hidden */
|
91
|
-
disconnectedCallback() {
|
92
|
-
var _a, _b;
|
93
|
-
super.disconnectedCallback();
|
94
|
-
(_a = this.disposeAutoUpdate) == null ? void 0 : _a.call(this);
|
95
|
-
this.disposeAutoUpdate = void 0;
|
96
|
-
(_b = this.disposeEventListeners) == null ? void 0 : _b.call(this);
|
97
|
-
this.disposeEventListeners = void 0;
|
98
|
-
}
|
99
|
-
/** @hidden */
|
100
|
-
updated(changedProperties) {
|
101
|
-
super.updated(changedProperties);
|
102
|
-
this.start();
|
103
|
-
this.setHidden(!this.active);
|
104
|
-
}
|
105
|
-
/** @hidden */
|
106
|
-
start() {
|
107
|
-
var _a;
|
108
|
-
(_a = this.disposeAutoUpdate) == null ? void 0 : _a.call(this);
|
109
|
-
this.disposeAutoUpdate = void 0;
|
110
|
-
const reference = this.reference;
|
111
|
-
if (!reference)
|
112
|
-
return;
|
113
|
-
if (!this.active)
|
114
|
-
return;
|
115
|
-
if (this.autoUpdate) {
|
116
|
-
this.disposeAutoUpdate = autoUpdate(
|
117
|
-
reference,
|
118
|
-
this,
|
119
|
-
() => void this.compute(),
|
120
|
-
this.autoUpdateOptions
|
121
|
-
);
|
122
|
-
} else {
|
123
|
-
void this.compute();
|
124
|
-
}
|
125
|
-
}
|
126
|
-
/** @hidden */
|
127
|
-
async compute() {
|
128
|
-
var _a, _b, _c;
|
129
|
-
const reference = this.reference;
|
130
|
-
if (!reference)
|
131
|
-
return;
|
132
|
-
if (!this.active)
|
133
|
-
return;
|
134
|
-
this.setHidden(false);
|
135
|
-
this.style.setProperty("top", "0");
|
136
|
-
this.style.setProperty("left", "0");
|
137
|
-
this.style.setProperty("position", (_b = (_a = this.options) == null ? void 0 : _a.strategy) != null ? _b : "absolute");
|
138
|
-
const options = (_c = this.options) != null ? _c : defaultPopoverOptions;
|
139
|
-
const computed = await computePosition(reference, this, options);
|
140
|
-
const { x, y, strategy } = computed != null ? computed : { x: 0, y: 0, strategy: "absolute" };
|
141
|
-
this.style.setProperty("opacity", "1");
|
142
|
-
this.style.setProperty("position", strategy);
|
143
|
-
this.style.setProperty(
|
144
|
-
"transform",
|
145
|
-
`translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`
|
146
|
-
);
|
147
|
-
}
|
148
|
-
/** @hidden */
|
149
|
-
hide() {
|
150
|
-
this.active = false;
|
151
|
-
}
|
152
|
-
};
|
153
|
-
__decorateClass([
|
154
|
-
property({ type: Boolean, reflect: true })
|
155
|
-
], Popover.prototype, "active", 2);
|
156
|
-
__decorateClass([
|
157
|
-
property({ attribute: false })
|
158
|
-
], Popover.prototype, "reference", 2);
|
159
|
-
__decorateClass([
|
160
|
-
property({ attribute: false })
|
161
|
-
], Popover.prototype, "options", 2);
|
162
|
-
__decorateClass([
|
163
|
-
property({
|
164
|
-
type: Boolean,
|
165
|
-
reflect: true
|
166
|
-
})
|
167
|
-
], Popover.prototype, "autoUpdate", 2);
|
168
|
-
__decorateClass([
|
169
|
-
property({ type: Object })
|
170
|
-
], Popover.prototype, "autoUpdateOptions", 2);
|
171
|
-
__decorateClass([
|
172
|
-
property({
|
173
|
-
type: String,
|
174
|
-
reflect: true
|
175
|
-
})
|
176
|
-
], Popover.prototype, "dismiss", 2);
|
177
|
-
Popover = __decorateClass([
|
178
|
-
customElement("prosekit-popover")
|
179
|
-
], Popover);
|
180
|
-
|
181
|
-
export {
|
182
|
-
propNames,
|
183
|
-
Popover
|
184
|
-
};
|
package/dist/chunk-C4MW43I4.js
DELETED
package/dist/chunk-GWGDLLFN.js
DELETED
@@ -1,61 +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-item/component.ts
|
10
|
-
import { consume } from "@lit/context";
|
11
|
-
import "lit";
|
12
|
-
import { customElement, property, state } from "lit/decorators.js";
|
13
|
-
var propNames = ["value", "onSelect"];
|
14
|
-
var AutocompleteItem = class extends LightElement {
|
15
|
-
constructor() {
|
16
|
-
super(...arguments);
|
17
|
-
this.value = "";
|
18
|
-
this.selected = false;
|
19
|
-
}
|
20
|
-
get content() {
|
21
|
-
const text = this.value || this.textContent || "";
|
22
|
-
return text.trim().toLowerCase();
|
23
|
-
}
|
24
|
-
connectedCallback() {
|
25
|
-
super.connectedCallback();
|
26
|
-
this.role = "option";
|
27
|
-
}
|
28
|
-
willUpdate() {
|
29
|
-
var _a, _b;
|
30
|
-
const content = this.content;
|
31
|
-
this.selected = content === ((_a = this.listContext) == null ? void 0 : _a.selectedValue);
|
32
|
-
const score = ((_b = this.listContext) == null ? void 0 : _b.scores.get(content)) || 0;
|
33
|
-
this.setHidden(score <= 0);
|
34
|
-
}
|
35
|
-
updated(changedProperties) {
|
36
|
-
if (this.selected && changedProperties.has("selected") && !changedProperties.get("selected")) {
|
37
|
-
this.scrollIntoView({ block: "nearest" });
|
38
|
-
}
|
39
|
-
}
|
40
|
-
};
|
41
|
-
__decorateClass([
|
42
|
-
property({ type: String, reflect: true, attribute: "data-value" })
|
43
|
-
], AutocompleteItem.prototype, "value", 2);
|
44
|
-
__decorateClass([
|
45
|
-
property({ type: Boolean, reflect: true, attribute: "data-selected" })
|
46
|
-
], AutocompleteItem.prototype, "selected", 2);
|
47
|
-
__decorateClass([
|
48
|
-
property({ attribute: false })
|
49
|
-
], AutocompleteItem.prototype, "onSelect", 2);
|
50
|
-
__decorateClass([
|
51
|
-
consume({ context: commandListContext, subscribe: true }),
|
52
|
-
state({})
|
53
|
-
], AutocompleteItem.prototype, "listContext", 2);
|
54
|
-
AutocompleteItem = __decorateClass([
|
55
|
-
customElement("prosekit-autocomplete-item")
|
56
|
-
], AutocompleteItem);
|
57
|
-
|
58
|
-
export {
|
59
|
-
propNames,
|
60
|
-
AutocompleteItem
|
61
|
-
};
|
package/dist/chunk-O5JP3B34.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
6
|
-
if (decorator = decorators[i])
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
8
|
-
if (kind && result)
|
9
|
-
__defProp(target, key, result);
|
10
|
-
return result;
|
11
|
-
};
|
12
|
-
|
13
|
-
// src/components/block-element/index.ts
|
14
|
-
import { LitElement } from "lit";
|
15
|
-
var LightElement = class extends LitElement {
|
16
|
-
createRenderRoot() {
|
17
|
-
return this;
|
18
|
-
}
|
19
|
-
setHidden(hidden) {
|
20
|
-
if (this.hidden !== hidden) {
|
21
|
-
this.hidden = hidden;
|
22
|
-
const display = this.style.display;
|
23
|
-
this.style.display = hidden ? "none" : display === "none" ? "" : display;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
};
|
27
|
-
|
28
|
-
export {
|
29
|
-
__decorateClass,
|
30
|
-
LightElement
|
31
|
-
};
|
package/dist/chunk-PCXKL6TA.js
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
// src/manager/list-manager.ts
|
2
|
-
var ListManager = class {
|
3
|
-
constructor(options) {
|
4
|
-
this.lastMouseMoveTime = 0;
|
5
|
-
this.getItems = options.getItems;
|
6
|
-
this.getSelectedValue = options.getSelectedValue;
|
7
|
-
this.setSelectedValue = options.setSelectedValue;
|
8
|
-
this.getItemValue = options.getItemValue;
|
9
|
-
this.queryClosestItem = options.queryClosestItem;
|
10
|
-
this.getActive = options.getActive;
|
11
|
-
this.onDismiss = options.onDismiss;
|
12
|
-
this.onSelect = options.onSelect;
|
13
|
-
}
|
14
|
-
get items() {
|
15
|
-
return this.getItems();
|
16
|
-
}
|
17
|
-
get availableItems() {
|
18
|
-
var _a, _b;
|
19
|
-
return (_b = (_a = this.items) == null ? void 0 : _a.filter((item) => !item.hidden)) != null ? _b : [];
|
20
|
-
}
|
21
|
-
get firstItem() {
|
22
|
-
var _a;
|
23
|
-
return (_a = this.availableItems[0]) != null ? _a : null;
|
24
|
-
}
|
25
|
-
get selectedItem() {
|
26
|
-
var _a;
|
27
|
-
return (_a = this.availableItems.find(
|
28
|
-
(item) => this.getItemValue(item) === this.getSelectedValue()
|
29
|
-
)) != null ? _a : null;
|
30
|
-
}
|
31
|
-
updateSelectedByChange(change) {
|
32
|
-
const items = this.availableItems;
|
33
|
-
if (items.length === 0) {
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
const selectedItem = this.selectedItem;
|
37
|
-
const selectedIndex = selectedItem ? items.indexOf(selectedItem) : -1;
|
38
|
-
let nextIndex = selectedIndex + change;
|
39
|
-
if (nextIndex < 0) {
|
40
|
-
nextIndex = 0;
|
41
|
-
} else if (nextIndex >= items.length) {
|
42
|
-
nextIndex = items.length - 1;
|
43
|
-
}
|
44
|
-
if (selectedIndex !== nextIndex) {
|
45
|
-
this.setSelectedValue(this.getItemValue(items[nextIndex]));
|
46
|
-
}
|
47
|
-
}
|
48
|
-
handleSelect(item) {
|
49
|
-
this.setSelectedValue(this.getItemValue(item));
|
50
|
-
}
|
51
|
-
selectFirstItem() {
|
52
|
-
const item = this.firstItem;
|
53
|
-
const value = item ? this.getItemValue(item) : "";
|
54
|
-
this.setSelectedValue(value);
|
55
|
-
}
|
56
|
-
handleMouseMove(_event) {
|
57
|
-
this.lastMouseMoveTime = Date.now();
|
58
|
-
}
|
59
|
-
handleMouseOver(event) {
|
60
|
-
if (this.lastMouseMoveTime + 500 < Date.now()) {
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
const target = event.target;
|
64
|
-
const item = target && this.queryClosestItem(target);
|
65
|
-
if (item) {
|
66
|
-
this.setSelectedValue(this.getItemValue(item));
|
67
|
-
}
|
68
|
-
}
|
69
|
-
handleMouseDown(event) {
|
70
|
-
event.preventDefault();
|
71
|
-
}
|
72
|
-
handleClick(event) {
|
73
|
-
event.preventDefault();
|
74
|
-
const target = event.target;
|
75
|
-
const item = target && this.queryClosestItem(target);
|
76
|
-
if (item) {
|
77
|
-
this.handleSelect(item);
|
78
|
-
this.onSelect(item);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
handleArrowUp() {
|
82
|
-
if (!this.getActive())
|
83
|
-
return false;
|
84
|
-
this.updateSelectedByChange(-1);
|
85
|
-
return true;
|
86
|
-
}
|
87
|
-
handleArrowDown() {
|
88
|
-
if (!this.getActive())
|
89
|
-
return false;
|
90
|
-
this.updateSelectedByChange(1);
|
91
|
-
return true;
|
92
|
-
}
|
93
|
-
handleEscape() {
|
94
|
-
if (!this.getActive())
|
95
|
-
return false;
|
96
|
-
this.onDismiss();
|
97
|
-
return true;
|
98
|
-
}
|
99
|
-
handleEnter() {
|
100
|
-
if (!this.getActive())
|
101
|
-
return false;
|
102
|
-
this.onSelect(this.selectedItem);
|
103
|
-
return true;
|
104
|
-
}
|
105
|
-
};
|
106
|
-
|
107
|
-
export {
|
108
|
-
ListManager
|
109
|
-
};
|