@prosekit/lit 0.0.1 → 0.0.3
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/package.json +25 -6
- package/dist/chunk-43BFWKM2.js +0 -26
- package/dist/chunk-7C2I5DWH.js +0 -122
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosekit/lit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "ocavue",
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@floating-ui/dom": "^1.4.4",
|
|
59
59
|
"@lit/reactive-element": "^1.6.2",
|
|
60
|
-
"@prosekit/core": "^0.0.
|
|
61
|
-
"@prosekit/extensions": "^0.0.
|
|
62
|
-
"@prosekit/pm": "^0.0.
|
|
60
|
+
"@prosekit/core": "^0.0.3",
|
|
61
|
+
"@prosekit/extensions": "^0.0.3",
|
|
62
|
+
"@prosekit/pm": "^0.0.3",
|
|
63
63
|
"lit": "^2.7.6",
|
|
64
64
|
"lit-element": "^3.3.2",
|
|
65
65
|
"lit-html": "^2.7.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@prosekit/dev": "
|
|
68
|
+
"@prosekit/dev": "*",
|
|
69
69
|
"minify-literals": "^1.0.6",
|
|
70
70
|
"tsup": "^7.1.0",
|
|
71
71
|
"typescript": "^5.1.6",
|
|
@@ -76,5 +76,24 @@
|
|
|
76
76
|
"build:tsup": "tsup",
|
|
77
77
|
"build:tsc": "tsc -b tsconfig.json"
|
|
78
78
|
},
|
|
79
|
-
"types": "./dist/prosekit-lit.d.ts"
|
|
79
|
+
"types": "./dist/prosekit-lit.d.ts",
|
|
80
|
+
"typesVersions": {
|
|
81
|
+
"*": {
|
|
82
|
+
".": [
|
|
83
|
+
"./dist/prosekit-lit.d.ts"
|
|
84
|
+
],
|
|
85
|
+
"elements/menu": [
|
|
86
|
+
"./dist/prosekit-lit-elements-menu.d.ts"
|
|
87
|
+
],
|
|
88
|
+
"elements/menu-item": [
|
|
89
|
+
"./dist/prosekit-lit-elements-menu-item.d.ts"
|
|
90
|
+
],
|
|
91
|
+
"elements/popover": [
|
|
92
|
+
"./dist/prosekit-lit-elements-popover.d.ts"
|
|
93
|
+
],
|
|
94
|
+
"elements/popover-suggestion": [
|
|
95
|
+
"./dist/prosekit-lit-elements-popover-suggestion.d.ts"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
80
99
|
}
|
package/dist/chunk-43BFWKM2.js
DELETED
|
@@ -1,26 +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/styles/block-component.styles.ts
|
|
14
|
-
import { css as css2 } from "lit";
|
|
15
|
-
|
|
16
|
-
// src/styles/component.styles.ts
|
|
17
|
-
import { css } from "lit";
|
|
18
|
-
var componentStyles = css`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}`;
|
|
19
|
-
|
|
20
|
-
// src/styles/block-component.styles.ts
|
|
21
|
-
var blockComponentStyles = css2`${componentStyles}:host{display:block}`;
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
__decorateClass,
|
|
25
|
-
blockComponentStyles
|
|
26
|
-
};
|
package/dist/chunk-7C2I5DWH.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__decorateClass,
|
|
3
|
-
blockComponentStyles
|
|
4
|
-
} from "./chunk-43BFWKM2.js";
|
|
5
|
-
|
|
6
|
-
// src/elements/popover/popover.ts
|
|
7
|
-
import {
|
|
8
|
-
autoUpdate,
|
|
9
|
-
computePosition
|
|
10
|
-
} from "@floating-ui/dom";
|
|
11
|
-
import { LitElement, html } from "lit";
|
|
12
|
-
import { customElement, property, query, state } from "lit/decorators.js";
|
|
13
|
-
import { styleMap } from "lit/directives/style-map.js";
|
|
14
|
-
|
|
15
|
-
// src/utils/round-by-dpr.ts
|
|
16
|
-
function roundByDPR(value) {
|
|
17
|
-
const dpr = window.devicePixelRatio || 1;
|
|
18
|
-
return Math.round(value * dpr) / dpr;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/elements/popover/popover.ts
|
|
22
|
-
var Popover = class extends LitElement {
|
|
23
|
-
/** @hidden */
|
|
24
|
-
constructor() {
|
|
25
|
-
super();
|
|
26
|
-
this.active = false;
|
|
27
|
-
this.autoUpdate = false;
|
|
28
|
-
}
|
|
29
|
-
/** @hidden */
|
|
30
|
-
disconnectedCallback() {
|
|
31
|
-
this.cleanup();
|
|
32
|
-
}
|
|
33
|
-
/** @hidden */
|
|
34
|
-
updated(changed) {
|
|
35
|
-
if (!changed.has("computed")) {
|
|
36
|
-
this.start();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/** @hidden */
|
|
40
|
-
start() {
|
|
41
|
-
this.cleanup();
|
|
42
|
-
const reference = this.reference;
|
|
43
|
-
const floating = this.floating;
|
|
44
|
-
if (!reference)
|
|
45
|
-
return;
|
|
46
|
-
if (this.autoUpdate) {
|
|
47
|
-
this.cleanupAutoUpdate = autoUpdate(
|
|
48
|
-
reference,
|
|
49
|
-
floating,
|
|
50
|
-
() => void this.compute(),
|
|
51
|
-
this.autoUpdateOptions
|
|
52
|
-
);
|
|
53
|
-
} else {
|
|
54
|
-
void this.compute();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/** @hidden */
|
|
58
|
-
async compute() {
|
|
59
|
-
const reference = this.reference;
|
|
60
|
-
const floating = this.floating;
|
|
61
|
-
if (!reference)
|
|
62
|
-
return;
|
|
63
|
-
const options = this.options;
|
|
64
|
-
this.computed = await computePosition(reference, floating, options);
|
|
65
|
-
}
|
|
66
|
-
/** @hidden */
|
|
67
|
-
cleanup() {
|
|
68
|
-
var _a;
|
|
69
|
-
(_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
|
|
70
|
-
this.cleanupAutoUpdate = void 0;
|
|
71
|
-
}
|
|
72
|
-
/** @hidden */
|
|
73
|
-
render() {
|
|
74
|
-
var _a;
|
|
75
|
-
const { x, y, strategy } = (_a = this.computed) != null ? _a : {
|
|
76
|
-
x: 0,
|
|
77
|
-
y: 0,
|
|
78
|
-
strategy: "absolute"
|
|
79
|
-
};
|
|
80
|
-
const style = {
|
|
81
|
-
top: "0",
|
|
82
|
-
left: "0",
|
|
83
|
-
position: strategy,
|
|
84
|
-
transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
|
|
85
|
-
display: this.active ? void 0 : "none"
|
|
86
|
-
};
|
|
87
|
-
return html`<div class="floating" style="${styleMap(style)}"><slot></slot></div>`;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
/** @hidden */
|
|
91
|
-
Popover.styles = blockComponentStyles;
|
|
92
|
-
__decorateClass([
|
|
93
|
-
property({ type: Boolean, reflect: true })
|
|
94
|
-
], Popover.prototype, "active", 2);
|
|
95
|
-
__decorateClass([
|
|
96
|
-
query(".floating")
|
|
97
|
-
], Popover.prototype, "floating", 2);
|
|
98
|
-
__decorateClass([
|
|
99
|
-
property()
|
|
100
|
-
], Popover.prototype, "reference", 2);
|
|
101
|
-
__decorateClass([
|
|
102
|
-
property()
|
|
103
|
-
], Popover.prototype, "options", 2);
|
|
104
|
-
__decorateClass([
|
|
105
|
-
property({
|
|
106
|
-
type: Boolean,
|
|
107
|
-
reflect: true
|
|
108
|
-
})
|
|
109
|
-
], Popover.prototype, "autoUpdate", 2);
|
|
110
|
-
__decorateClass([
|
|
111
|
-
property({ type: Object })
|
|
112
|
-
], Popover.prototype, "autoUpdateOptions", 2);
|
|
113
|
-
__decorateClass([
|
|
114
|
-
state()
|
|
115
|
-
], Popover.prototype, "computed", 2);
|
|
116
|
-
Popover = __decorateClass([
|
|
117
|
-
customElement("prosekit-popover")
|
|
118
|
-
], Popover);
|
|
119
|
-
|
|
120
|
-
export {
|
|
121
|
-
Popover
|
|
122
|
-
};
|