@vizel/core 0.0.1-alpha.5 → 1.0.0
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/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/index.d.ts +230 -15
- package/dist/index.js +78 -75
- package/dist/index10.js +1 -1
- package/dist/index11.js +4 -4
- package/dist/index14.js +1 -1
- package/dist/index15.js +134 -127
- package/dist/index17.js +2 -2
- package/dist/index18.js +1 -1
- package/dist/index19.js +86 -86
- package/dist/index20.js +2 -2
- package/dist/index21.js +2 -2
- package/dist/index22.js +16 -13
- package/dist/index24.js +164 -11
- package/dist/index25.js +12 -53
- package/dist/index26.js +49 -136
- package/dist/index27.js +132 -59
- package/dist/index28.js +66 -32
- package/dist/index29.js +35 -21
- package/dist/index3.js +91 -90
- package/dist/index30.js +23 -9
- package/dist/index31.js +9 -147
- package/dist/index32.js +138 -256
- package/dist/index33.js +258 -85
- package/dist/index34.js +84 -55
- package/dist/index35.js +64 -4
- package/dist/index36.js +4 -123
- package/dist/index37.js +111 -315
- package/dist/index38.js +321 -481
- package/dist/index39.js +12 -47
- package/dist/index4.js +1 -1
- package/dist/index40.js +463 -655
- package/dist/index41.js +48 -4
- package/dist/index42.js +694 -4
- package/dist/index43.js +4 -238
- package/dist/index44.js +4 -82
- package/dist/index45.js +237 -16
- package/dist/index46.js +81 -57
- package/dist/index47.js +17 -15
- package/dist/index48.js +57 -285
- package/dist/index49.js +15 -202
- package/dist/index5.js +78 -68
- package/dist/index50.js +281 -1497
- package/dist/index51.js +202 -5
- package/dist/index52.js +1408 -1467
- package/dist/index53.js +5 -723
- package/dist/index54.js +1109 -81
- package/dist/index55.js +703 -226
- package/dist/index56.js +84 -3
- package/dist/index57.js +219 -1205
- package/dist/index58.js +3 -734
- package/dist/index59.js +1232 -21
- package/dist/index6.js +1 -1
- package/dist/index60.js +734 -10
- package/dist/index61.js +21 -7
- package/dist/index62.js +10 -8
- package/dist/index63.js +6 -13
- package/dist/index64.js +7 -18
- package/dist/index65.js +12 -23
- package/dist/index66.js +17 -53
- package/dist/index67.js +23 -1059
- package/dist/index68.js +54 -90
- package/dist/index69.js +1061 -98
- package/dist/index7.js +108 -96
- package/dist/index70.js +98 -4
- package/dist/index71.js +93 -0
- package/dist/index72.js +6 -0
- package/dist/index8.js +1 -1
- package/dist/index9.js +75 -65
- package/dist/mathematics.css +1 -0
- package/dist/mathematics.css.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +90 -52
package/dist/index56.js
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Plugin as w } from "./index40.js";
|
|
2
|
+
import { dropPoint as v } from "./index60.js";
|
|
3
|
+
function y(m = {}) {
|
|
4
|
+
return new w({
|
|
5
|
+
view(e) {
|
|
6
|
+
return new C(e, m);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
class C {
|
|
11
|
+
constructor(e, t) {
|
|
12
|
+
var i;
|
|
13
|
+
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (i = t.width) !== null && i !== void 0 ? i : 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((s) => {
|
|
14
|
+
let d = (r) => {
|
|
15
|
+
this[s](r);
|
|
16
|
+
};
|
|
17
|
+
return e.dom.addEventListener(s, d), { name: s, handler: d };
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
destroy() {
|
|
21
|
+
this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
|
|
22
|
+
}
|
|
23
|
+
update(e, t) {
|
|
24
|
+
this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
|
|
25
|
+
}
|
|
26
|
+
setCursor(e) {
|
|
27
|
+
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
28
|
+
}
|
|
29
|
+
updateOverlay() {
|
|
30
|
+
let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, i, s = this.editorView.dom, d = s.getBoundingClientRect(), r = d.width / s.offsetWidth, h = d.height / s.offsetHeight;
|
|
31
|
+
if (t) {
|
|
32
|
+
let o = e.nodeBefore, n = e.nodeAfter;
|
|
33
|
+
if (o || n) {
|
|
34
|
+
let a = this.editorView.nodeDOM(this.cursorPos - (o ? o.nodeSize : 0));
|
|
35
|
+
if (a) {
|
|
36
|
+
let c = a.getBoundingClientRect(), u = o ? c.bottom : c.top;
|
|
37
|
+
o && n && (u = (u + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
38
|
+
let g = this.width / 2 * h;
|
|
39
|
+
i = { left: c.left, right: c.right, top: u - g, bottom: u + g };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!i) {
|
|
44
|
+
let o = this.editorView.coordsAtPos(this.cursorPos), n = this.width / 2 * r;
|
|
45
|
+
i = { left: o.left - n, right: o.left + n, top: o.top, bottom: o.bottom };
|
|
46
|
+
}
|
|
47
|
+
let l = this.editorView.dom.offsetParent;
|
|
48
|
+
this.element || (this.element = l.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
|
|
49
|
+
let f, p;
|
|
50
|
+
if (!l || l == document.body && getComputedStyle(l).position == "static")
|
|
51
|
+
f = -pageXOffset, p = -pageYOffset;
|
|
52
|
+
else {
|
|
53
|
+
let o = l.getBoundingClientRect(), n = o.width / l.offsetWidth, a = o.height / l.offsetHeight;
|
|
54
|
+
f = o.left - l.scrollLeft * n, p = o.top - l.scrollTop * a;
|
|
55
|
+
}
|
|
56
|
+
this.element.style.left = (i.left - f) / r + "px", this.element.style.top = (i.top - p) / h + "px", this.element.style.width = (i.right - i.left) / r + "px", this.element.style.height = (i.bottom - i.top) / h + "px";
|
|
57
|
+
}
|
|
58
|
+
scheduleRemoval(e) {
|
|
59
|
+
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
60
|
+
}
|
|
61
|
+
dragover(e) {
|
|
62
|
+
if (!this.editorView.editable)
|
|
63
|
+
return;
|
|
64
|
+
let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), i = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), s = i && i.type.spec.disableDropCursor, d = typeof s == "function" ? s(this.editorView, t, e) : s;
|
|
65
|
+
if (t && !d) {
|
|
66
|
+
let r = t.pos;
|
|
67
|
+
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
68
|
+
let h = v(this.editorView.state.doc, r, this.editorView.dragging.slice);
|
|
69
|
+
h != null && (r = h);
|
|
70
|
+
}
|
|
71
|
+
this.setCursor(r), this.scheduleRemoval(5e3);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
dragend() {
|
|
75
|
+
this.scheduleRemoval(20);
|
|
76
|
+
}
|
|
77
|
+
drop() {
|
|
78
|
+
this.scheduleRemoval(20);
|
|
79
|
+
}
|
|
80
|
+
dragleave(e) {
|
|
81
|
+
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
2
84
|
export {
|
|
3
|
-
|
|
4
|
-
i as default
|
|
85
|
+
y as dropCursor
|
|
5
86
|
};
|