@codemirror/view 6.21.3 → 6.21.4
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/CHANGELOG.md +8 -0
- package/dist/index.cjs +37 -11
- package/dist/index.js +37 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 6.21.4 (2023-10-24)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Support the `offset`, `getCoords`, `overlap`, and `resize` properties on hover tooltips, as long as they aren't given conflicting values when there are multiple active hover tooltips.
|
|
6
|
+
|
|
7
|
+
Fix a bug that caused tooltips in the default configuration to be positioned incorrectly on Chrome when the editor was transformed.
|
|
8
|
+
|
|
1
9
|
## 6.21.3 (2023-10-06)
|
|
2
10
|
|
|
3
11
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -6371,7 +6371,6 @@ class DOMObserver {
|
|
|
6371
6371
|
this.scrollTargets = [];
|
|
6372
6372
|
this.intersection = null;
|
|
6373
6373
|
this.resizeScroll = null;
|
|
6374
|
-
this.resizeContent = null;
|
|
6375
6374
|
this.intersecting = false;
|
|
6376
6375
|
this.gapIntersection = null;
|
|
6377
6376
|
this.gaps = [];
|
|
@@ -6415,8 +6414,6 @@ class DOMObserver {
|
|
|
6415
6414
|
this.onResize();
|
|
6416
6415
|
});
|
|
6417
6416
|
this.resizeScroll.observe(view.scrollDOM);
|
|
6418
|
-
this.resizeContent = new ResizeObserver(() => this.view.requestMeasure());
|
|
6419
|
-
this.resizeContent.observe(view.contentDOM);
|
|
6420
6417
|
}
|
|
6421
6418
|
this.addWindowListeners(this.win = view.win);
|
|
6422
6419
|
this.start();
|
|
@@ -6745,12 +6742,11 @@ class DOMObserver {
|
|
|
6745
6742
|
win.document.removeEventListener("selectionchange", this.onSelectionChange);
|
|
6746
6743
|
}
|
|
6747
6744
|
destroy() {
|
|
6748
|
-
var _a, _b, _c
|
|
6745
|
+
var _a, _b, _c;
|
|
6749
6746
|
this.stop();
|
|
6750
6747
|
(_a = this.intersection) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
6751
6748
|
(_b = this.gapIntersection) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
6752
6749
|
(_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
6753
|
-
(_d = this.resizeContent) === null || _d === void 0 ? void 0 : _d.disconnect();
|
|
6754
6750
|
for (let dom of this.scrollTargets)
|
|
6755
6751
|
dom.removeEventListener("scroll", this.onScroll);
|
|
6756
6752
|
this.removeWindowListeners(this.win);
|
|
@@ -9198,6 +9194,7 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
|
|
|
9198
9194
|
}
|
|
9199
9195
|
tooltipView.dom.style.position = this.position;
|
|
9200
9196
|
tooltipView.dom.style.top = Outside;
|
|
9197
|
+
tooltipView.dom.style.left = "0px";
|
|
9201
9198
|
this.container.appendChild(tooltipView.dom);
|
|
9202
9199
|
if (tooltipView.mount)
|
|
9203
9200
|
tooltipView.mount(this.view);
|
|
@@ -9219,12 +9216,24 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
|
|
|
9219
9216
|
let editor = this.view.dom.getBoundingClientRect();
|
|
9220
9217
|
let scaleX = 1, scaleY = 1, makeAbsolute = false;
|
|
9221
9218
|
if (this.position == "fixed" && this.manager.tooltipViews.length) {
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9219
|
+
let { dom } = this.manager.tooltipViews[0];
|
|
9220
|
+
if (browser.gecko) {
|
|
9221
|
+
// Firefox sets the element's `offsetParent` to the
|
|
9222
|
+
// transformed element when a transform interferes with fixed
|
|
9223
|
+
// positioning.
|
|
9224
|
+
makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;
|
|
9225
|
+
}
|
|
9226
|
+
else {
|
|
9227
|
+
// On other browsers, we have to awkwardly try and use other
|
|
9228
|
+
// information to detect a transform.
|
|
9229
|
+
if (this.view.scaleX != 1 || this.view.scaleY != 1) {
|
|
9230
|
+
makeAbsolute = true;
|
|
9231
|
+
}
|
|
9232
|
+
else if (dom.style.top == Outside && dom.style.left == "0px") {
|
|
9233
|
+
let rect = dom.getBoundingClientRect();
|
|
9234
|
+
makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
|
|
9235
|
+
}
|
|
9236
|
+
}
|
|
9228
9237
|
}
|
|
9229
9238
|
if (makeAbsolute || this.position == "absolute") {
|
|
9230
9239
|
if (this.parent) {
|
|
@@ -9450,6 +9459,23 @@ class HoverTooltipHost {
|
|
|
9450
9459
|
for (let t of this.manager.tooltipViews)
|
|
9451
9460
|
(_a = t.destroy) === null || _a === void 0 ? void 0 : _a.call(t);
|
|
9452
9461
|
}
|
|
9462
|
+
passProp(name) {
|
|
9463
|
+
let value = undefined;
|
|
9464
|
+
for (let view of this.manager.tooltipViews) {
|
|
9465
|
+
let given = view[name];
|
|
9466
|
+
if (given !== undefined) {
|
|
9467
|
+
if (value === undefined)
|
|
9468
|
+
value = given;
|
|
9469
|
+
else if (value !== given)
|
|
9470
|
+
return undefined;
|
|
9471
|
+
}
|
|
9472
|
+
}
|
|
9473
|
+
return value;
|
|
9474
|
+
}
|
|
9475
|
+
get offset() { return this.passProp("offset"); }
|
|
9476
|
+
get getCoords() { return this.passProp("getCoords"); }
|
|
9477
|
+
get overlap() { return this.passProp("overlap"); }
|
|
9478
|
+
get resize() { return this.passProp("resize"); }
|
|
9453
9479
|
}
|
|
9454
9480
|
const showHoverTooltipHost = showTooltip.compute([showHoverTooltip], state => {
|
|
9455
9481
|
let tooltips = state.facet(showHoverTooltip).filter(t => t);
|
package/dist/index.js
CHANGED
|
@@ -6366,7 +6366,6 @@ class DOMObserver {
|
|
|
6366
6366
|
this.scrollTargets = [];
|
|
6367
6367
|
this.intersection = null;
|
|
6368
6368
|
this.resizeScroll = null;
|
|
6369
|
-
this.resizeContent = null;
|
|
6370
6369
|
this.intersecting = false;
|
|
6371
6370
|
this.gapIntersection = null;
|
|
6372
6371
|
this.gaps = [];
|
|
@@ -6410,8 +6409,6 @@ class DOMObserver {
|
|
|
6410
6409
|
this.onResize();
|
|
6411
6410
|
});
|
|
6412
6411
|
this.resizeScroll.observe(view.scrollDOM);
|
|
6413
|
-
this.resizeContent = new ResizeObserver(() => this.view.requestMeasure());
|
|
6414
|
-
this.resizeContent.observe(view.contentDOM);
|
|
6415
6412
|
}
|
|
6416
6413
|
this.addWindowListeners(this.win = view.win);
|
|
6417
6414
|
this.start();
|
|
@@ -6740,12 +6737,11 @@ class DOMObserver {
|
|
|
6740
6737
|
win.document.removeEventListener("selectionchange", this.onSelectionChange);
|
|
6741
6738
|
}
|
|
6742
6739
|
destroy() {
|
|
6743
|
-
var _a, _b, _c
|
|
6740
|
+
var _a, _b, _c;
|
|
6744
6741
|
this.stop();
|
|
6745
6742
|
(_a = this.intersection) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
6746
6743
|
(_b = this.gapIntersection) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
6747
6744
|
(_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
6748
|
-
(_d = this.resizeContent) === null || _d === void 0 ? void 0 : _d.disconnect();
|
|
6749
6745
|
for (let dom of this.scrollTargets)
|
|
6750
6746
|
dom.removeEventListener("scroll", this.onScroll);
|
|
6751
6747
|
this.removeWindowListeners(this.win);
|
|
@@ -9193,6 +9189,7 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
9193
9189
|
}
|
|
9194
9190
|
tooltipView.dom.style.position = this.position;
|
|
9195
9191
|
tooltipView.dom.style.top = Outside;
|
|
9192
|
+
tooltipView.dom.style.left = "0px";
|
|
9196
9193
|
this.container.appendChild(tooltipView.dom);
|
|
9197
9194
|
if (tooltipView.mount)
|
|
9198
9195
|
tooltipView.mount(this.view);
|
|
@@ -9214,12 +9211,24 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
9214
9211
|
let editor = this.view.dom.getBoundingClientRect();
|
|
9215
9212
|
let scaleX = 1, scaleY = 1, makeAbsolute = false;
|
|
9216
9213
|
if (this.position == "fixed" && this.manager.tooltipViews.length) {
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9214
|
+
let { dom } = this.manager.tooltipViews[0];
|
|
9215
|
+
if (browser.gecko) {
|
|
9216
|
+
// Firefox sets the element's `offsetParent` to the
|
|
9217
|
+
// transformed element when a transform interferes with fixed
|
|
9218
|
+
// positioning.
|
|
9219
|
+
makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;
|
|
9220
|
+
}
|
|
9221
|
+
else {
|
|
9222
|
+
// On other browsers, we have to awkwardly try and use other
|
|
9223
|
+
// information to detect a transform.
|
|
9224
|
+
if (this.view.scaleX != 1 || this.view.scaleY != 1) {
|
|
9225
|
+
makeAbsolute = true;
|
|
9226
|
+
}
|
|
9227
|
+
else if (dom.style.top == Outside && dom.style.left == "0px") {
|
|
9228
|
+
let rect = dom.getBoundingClientRect();
|
|
9229
|
+
makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
|
|
9230
|
+
}
|
|
9231
|
+
}
|
|
9223
9232
|
}
|
|
9224
9233
|
if (makeAbsolute || this.position == "absolute") {
|
|
9225
9234
|
if (this.parent) {
|
|
@@ -9445,6 +9454,23 @@ class HoverTooltipHost {
|
|
|
9445
9454
|
for (let t of this.manager.tooltipViews)
|
|
9446
9455
|
(_a = t.destroy) === null || _a === void 0 ? void 0 : _a.call(t);
|
|
9447
9456
|
}
|
|
9457
|
+
passProp(name) {
|
|
9458
|
+
let value = undefined;
|
|
9459
|
+
for (let view of this.manager.tooltipViews) {
|
|
9460
|
+
let given = view[name];
|
|
9461
|
+
if (given !== undefined) {
|
|
9462
|
+
if (value === undefined)
|
|
9463
|
+
value = given;
|
|
9464
|
+
else if (value !== given)
|
|
9465
|
+
return undefined;
|
|
9466
|
+
}
|
|
9467
|
+
}
|
|
9468
|
+
return value;
|
|
9469
|
+
}
|
|
9470
|
+
get offset() { return this.passProp("offset"); }
|
|
9471
|
+
get getCoords() { return this.passProp("getCoords"); }
|
|
9472
|
+
get overlap() { return this.passProp("overlap"); }
|
|
9473
|
+
get resize() { return this.passProp("resize"); }
|
|
9448
9474
|
}
|
|
9449
9475
|
const showHoverTooltipHost = /*@__PURE__*/showTooltip.compute([showHoverTooltip], state => {
|
|
9450
9476
|
let tooltips = state.facet(showHoverTooltip).filter(t => t);
|