docxodus 9.2.0 → 9.4.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/editor-reconcile.d.ts +5 -0
- package/dist/editor-reconcile.d.ts.map +1 -1
- package/dist/editor-reconcile.js +23 -2
- package/dist/editor-reconcile.js.map +1 -1
- package/dist/editor.bundle.js +3338 -162
- package/dist/editor.d.ts +120 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +775 -57
- package/dist/editor.js.map +1 -1
- package/dist/embed.bundle.js +3401 -178
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.iife.js +3388 -178
- package/dist/embed.js +8 -0
- package/dist/embed.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ribbon.js +4 -0
- package/dist/ribbon.js.map +1 -1
- package/dist/session.bundle.js +31 -1
- package/dist/session.d.ts +22 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +27 -1
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +18 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wasm/_framework/Docxodus.wasm +0 -0
- package/dist/wasm/_framework/Docxodus.wasm.br +0 -0
- package/dist/wasm/_framework/DocxodusWasm.wasm +0 -0
- package/dist/wasm/_framework/DocxodusWasm.wasm.br +0 -0
- package/dist/wasm/_framework/System.Private.CoreLib.wasm +0 -0
- package/dist/wasm/_framework/System.Private.CoreLib.wasm.br +0 -0
- package/dist/wasm/_framework/dotnet.boot.js +5 -5
- package/dist/wasm/_framework/dotnet.boot.js.br +0 -0
- package/dist/wasm/_framework/dotnet.native.wasm +0 -0
- package/dist/wasm/_framework/dotnet.native.wasm.br +0 -0
- package/package.json +5 -1
package/dist/embed.iife.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var Docxodus = (() => {
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
try {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw mod = 0, e;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
7
16
|
var __export = (target, all) => {
|
|
8
17
|
for (var name in all)
|
|
9
18
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +25,101 @@ var Docxodus = (() => {
|
|
|
16
25
|
}
|
|
17
26
|
return to;
|
|
18
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
19
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
37
|
|
|
38
|
+
// node_modules/bind-event-listener/dist/bind.js
|
|
39
|
+
var require_bind = __commonJS({
|
|
40
|
+
"node_modules/bind-event-listener/dist/bind.js"(exports) {
|
|
41
|
+
"use strict";
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.bind = void 0;
|
|
44
|
+
function bind3(target, _a) {
|
|
45
|
+
var type = _a.type, listener = _a.listener, options = _a.options;
|
|
46
|
+
target.addEventListener(type, listener, options);
|
|
47
|
+
return function unbind() {
|
|
48
|
+
target.removeEventListener(type, listener, options);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.bind = bind3;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// node_modules/bind-event-listener/dist/bind-all.js
|
|
56
|
+
var require_bind_all = __commonJS({
|
|
57
|
+
"node_modules/bind-event-listener/dist/bind-all.js"(exports) {
|
|
58
|
+
"use strict";
|
|
59
|
+
var __assign = exports && exports.__assign || function() {
|
|
60
|
+
__assign = Object.assign || function(t) {
|
|
61
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
62
|
+
s = arguments[i];
|
|
63
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
64
|
+
t[p] = s[p];
|
|
65
|
+
}
|
|
66
|
+
return t;
|
|
67
|
+
};
|
|
68
|
+
return __assign.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
+
exports.bindAll = void 0;
|
|
72
|
+
var bind_1 = require_bind();
|
|
73
|
+
function toOptions(value) {
|
|
74
|
+
if (typeof value === "undefined") {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
if (typeof value === "boolean") {
|
|
78
|
+
return {
|
|
79
|
+
capture: value
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
function getBinding(original, sharedOptions) {
|
|
85
|
+
if (sharedOptions == null) {
|
|
86
|
+
return original;
|
|
87
|
+
}
|
|
88
|
+
var binding = __assign(__assign({}, original), { options: __assign(__assign({}, toOptions(sharedOptions)), toOptions(original.options)) });
|
|
89
|
+
return binding;
|
|
90
|
+
}
|
|
91
|
+
function bindAll4(target, bindings, sharedOptions) {
|
|
92
|
+
var unbinds = bindings.map(function(original) {
|
|
93
|
+
var binding = getBinding(original, sharedOptions);
|
|
94
|
+
return (0, bind_1.bind)(target, binding);
|
|
95
|
+
});
|
|
96
|
+
return function unbindAll() {
|
|
97
|
+
unbinds.forEach(function(unbind) {
|
|
98
|
+
return unbind();
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
exports.bindAll = bindAll4;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// node_modules/bind-event-listener/dist/index.js
|
|
107
|
+
var require_dist = __commonJS({
|
|
108
|
+
"node_modules/bind-event-listener/dist/index.js"(exports) {
|
|
109
|
+
"use strict";
|
|
110
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
111
|
+
exports.bindAll = exports.bind = void 0;
|
|
112
|
+
var bind_1 = require_bind();
|
|
113
|
+
Object.defineProperty(exports, "bind", { enumerable: true, get: function() {
|
|
114
|
+
return bind_1.bind;
|
|
115
|
+
} });
|
|
116
|
+
var bind_all_1 = require_bind_all();
|
|
117
|
+
Object.defineProperty(exports, "bindAll", { enumerable: true, get: function() {
|
|
118
|
+
return bind_all_1.bindAll;
|
|
119
|
+
} });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
21
123
|
// src/embed.ts
|
|
22
124
|
var embed_exports = {};
|
|
23
125
|
__export(embed_exports, {
|
|
@@ -433,6 +535,12 @@ var Docxodus = (() => {
|
|
|
433
535
|
deleteBlock(anchorId) {
|
|
434
536
|
return JSON.parse(this.wasm.DeleteBlock(this.handle, anchorId));
|
|
435
537
|
}
|
|
538
|
+
/** Reorder one top-level paragraph/heading/list/table block relative to another. */
|
|
539
|
+
moveBlock(sourceAnchorId, targetAnchorId, position) {
|
|
540
|
+
return JSON.parse(
|
|
541
|
+
this.wasm.MoveBlock(this.handle, sourceAnchorId, targetAnchorId, position)
|
|
542
|
+
);
|
|
543
|
+
}
|
|
436
544
|
/**
|
|
437
545
|
* Delete every top-level block-level sibling between `fromAnchorId` (inclusive)
|
|
438
546
|
* and `toAnchorIdExclusive` (exclusive). Both anchors must share a direct
|
|
@@ -493,7 +601,9 @@ var Docxodus = (() => {
|
|
|
493
601
|
* Table row/column editing, addressed by a cell-paragraph anchor (e.g. one returned from
|
|
494
602
|
* {@link insertTable}'s `created`). Insert clones the reference row/column's widths and starts
|
|
495
603
|
* empty (`created` lists the new cell-paragraph anchors); delete of the last row/column removes
|
|
496
|
-
* the whole table.
|
|
604
|
+
* the whole table. All four are grid-aware: inserting across a merge extends it, deleting
|
|
605
|
+
* through one narrows it, and deleting a vertical merge's lead row promotes the next row to
|
|
606
|
+
* carry it — the grid is never left ragged.
|
|
497
607
|
*/
|
|
498
608
|
insertTableRow(cellAnchorId, position) {
|
|
499
609
|
return JSON.parse(this.wasm.InsertTableRow(this.handle, cellAnchorId, position));
|
|
@@ -507,6 +617,28 @@ var Docxodus = (() => {
|
|
|
507
617
|
deleteTableColumn(cellAnchorId) {
|
|
508
618
|
return JSON.parse(this.wasm.DeleteTableColumn(this.handle, cellAnchorId));
|
|
509
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
* Merge the rectangle of cells anchored at `cellAnchorId` running `rowSpan` rows down ×
|
|
622
|
+
* `colSpan` cells right (Word's *Merge Cells*): `w:gridSpan` for the horizontal extent,
|
|
623
|
+
* `w:vMerge` restart/continue for the vertical one. The rectangle must tile the same whole grid
|
|
624
|
+
* columns in every row it covers and must not clip a vertical merge entering from above or
|
|
625
|
+
* continuing below — a partial overlap fails with `invalid_table_merge` instead of tearing the
|
|
626
|
+
* grid. `content` decides what happens to the absorbed cells' content (default `"append"`).
|
|
627
|
+
*/
|
|
628
|
+
mergeCells(cellAnchorId, rowSpan, colSpan, content = "append") {
|
|
629
|
+
return JSON.parse(
|
|
630
|
+
this.wasm.MergeCells(this.handle, cellAnchorId, rowSpan, colSpan, content)
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Split the merged cell at `cellAnchorId` back into unit cells, dropping its `w:gridSpan` and
|
|
635
|
+
* `w:vMerge` markup and restoring one cell per grid column (each taking its `w:tblGrid` width).
|
|
636
|
+
* Addressing a vertical-merge continuation unmerges the whole run. A cell with no merge markup
|
|
637
|
+
* fails with `invalid_table_merge`.
|
|
638
|
+
*/
|
|
639
|
+
unmergeCells(cellAnchorId) {
|
|
640
|
+
return JSON.parse(this.wasm.UnmergeCells(this.handle, cellAnchorId));
|
|
641
|
+
}
|
|
510
642
|
/**
|
|
511
643
|
* Table styling, addressed by a cell-paragraph anchor — the post-insert counterpart of
|
|
512
644
|
* {@link insertTable}'s options (issue #315 Stage A). `setColumnWidths` retunes `w:tblGrid` +
|
|
@@ -1409,9 +1541,9 @@ var Docxodus = (() => {
|
|
|
1409
1541
|
for (const section of Array.from(sections)) {
|
|
1410
1542
|
const index = parseInt(section.dataset.sectionIndex || "0", 10);
|
|
1411
1543
|
const rawStart = section.dataset.pageNumStart;
|
|
1412
|
-
const
|
|
1544
|
+
const start2 = rawStart === void 0 ? void 0 : parseInt(rawStart, 10);
|
|
1413
1545
|
map.set(index, {
|
|
1414
|
-
start:
|
|
1546
|
+
start: start2 !== void 0 && Number.isFinite(start2) ? start2 : void 0,
|
|
1415
1547
|
format: section.dataset.pageNumFmt
|
|
1416
1548
|
});
|
|
1417
1549
|
}
|
|
@@ -1636,16 +1768,16 @@ var Docxodus = (() => {
|
|
|
1636
1768
|
return null;
|
|
1637
1769
|
}
|
|
1638
1770
|
const groups = [];
|
|
1639
|
-
let
|
|
1640
|
-
while (
|
|
1641
|
-
let end =
|
|
1771
|
+
let start2 = 0;
|
|
1772
|
+
while (start2 < rows.length) {
|
|
1773
|
+
let end = start2;
|
|
1642
1774
|
while (end < rows.length) {
|
|
1643
1775
|
const candidate = this.createSimpleTableFragment(
|
|
1644
1776
|
wrapper,
|
|
1645
1777
|
table,
|
|
1646
1778
|
body,
|
|
1647
|
-
rows.slice(
|
|
1648
|
-
|
|
1779
|
+
rows.slice(start2, end + 1),
|
|
1780
|
+
start2 === 0
|
|
1649
1781
|
);
|
|
1650
1782
|
const measured = this.measureElement(candidate, dims);
|
|
1651
1783
|
if (measured.heightPt > maximumFragmentHeight) {
|
|
@@ -1653,11 +1785,11 @@ var Docxodus = (() => {
|
|
|
1653
1785
|
}
|
|
1654
1786
|
end++;
|
|
1655
1787
|
}
|
|
1656
|
-
if (end ===
|
|
1788
|
+
if (end === start2) {
|
|
1657
1789
|
return null;
|
|
1658
1790
|
}
|
|
1659
|
-
groups.push(rows.slice(
|
|
1660
|
-
|
|
1791
|
+
groups.push(rows.slice(start2, end));
|
|
1792
|
+
start2 = end;
|
|
1661
1793
|
}
|
|
1662
1794
|
if (groups.length < 2) {
|
|
1663
1795
|
return null;
|
|
@@ -2972,9 +3104,9 @@ var Docxodus = (() => {
|
|
|
2972
3104
|
const commitStart = () => {
|
|
2973
3105
|
const raw = pageStart.value.trim();
|
|
2974
3106
|
if (raw === "") return;
|
|
2975
|
-
const
|
|
2976
|
-
if (!Number.isInteger(
|
|
2977
|
-
this.setPageNumbering({ start });
|
|
3107
|
+
const start2 = Number(raw);
|
|
3108
|
+
if (!Number.isInteger(start2) || start2 < 0) return;
|
|
3109
|
+
this.setPageNumbering({ start: start2 });
|
|
2978
3110
|
};
|
|
2979
3111
|
pageStart.addEventListener("blur", commitStart);
|
|
2980
3112
|
pageStart.addEventListener("keydown", (e) => {
|
|
@@ -3025,8 +3157,8 @@ var Docxodus = (() => {
|
|
|
3025
3157
|
if (pageFmt) pageFmt.value = this.sectionInfo?.pageNumberFormat ?? "";
|
|
3026
3158
|
const pageStart = band.querySelector("[data-hf-pagestart]");
|
|
3027
3159
|
if (pageStart && document.activeElement !== pageStart) {
|
|
3028
|
-
const
|
|
3029
|
-
pageStart.value =
|
|
3160
|
+
const start2 = this.sectionInfo?.pageNumberStart;
|
|
3161
|
+
pageStart.value = start2 === void 0 ? "" : String(start2);
|
|
3030
3162
|
}
|
|
3031
3163
|
const inherited = this.refFor(which, kind)?.inherited === true;
|
|
3032
3164
|
band.toggleAttribute("data-hf-inherited", inherited);
|
|
@@ -3074,65 +3206,2466 @@ var Docxodus = (() => {
|
|
|
3074
3206
|
el.setAttribute("data-hf-focused", "true");
|
|
3075
3207
|
});
|
|
3076
3208
|
}
|
|
3077
|
-
renderStoryBlock(anchorId) {
|
|
3078
|
-
const html = this.bridge.RenderBlockHtml(
|
|
3079
|
-
this.handle,
|
|
3080
|
-
anchorId,
|
|
3081
|
-
this.options.cssPrefix,
|
|
3082
|
-
this.options.fabricateClasses
|
|
3083
|
-
);
|
|
3084
|
-
if (html.charCodeAt(0) === 123) return null;
|
|
3085
|
-
return new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
3209
|
+
renderStoryBlock(anchorId) {
|
|
3210
|
+
const html = this.bridge.RenderBlockHtml(
|
|
3211
|
+
this.handle,
|
|
3212
|
+
anchorId,
|
|
3213
|
+
this.options.cssPrefix,
|
|
3214
|
+
this.options.fabricateClasses
|
|
3215
|
+
);
|
|
3216
|
+
if (html.charCodeAt(0) === 123) return null;
|
|
3217
|
+
return new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
3218
|
+
}
|
|
3219
|
+
placeholder(which, kind) {
|
|
3220
|
+
const el = document.createElement("div");
|
|
3221
|
+
el.className = "docx-hf-placeholder";
|
|
3222
|
+
el.setAttribute("data-hf-placeholder", "");
|
|
3223
|
+
const label = KIND_LABELS.find((k) => k.value === kind)?.label ?? kind;
|
|
3224
|
+
el.textContent = `No ${label.toLowerCase()} ${which} \u2014 pick a kind to create one.`;
|
|
3225
|
+
return el;
|
|
3226
|
+
}
|
|
3227
|
+
/**
|
|
3228
|
+
* Surface the caveat that comes with the selected kind. Turning on first/even means those pages
|
|
3229
|
+
* stop using the Default stories entirely, which bites hardest on the OTHER band: enabling an
|
|
3230
|
+
* even header with no even footer leaves even pages footer-less, and enabling a first-page
|
|
3231
|
+
* header with an empty first-page footer leaves page 1 footer-less. The note is shown whenever
|
|
3232
|
+
* first/even is selected (the behavior change is real either way); the fix button appears only
|
|
3233
|
+
* when the counterpart story is missing entirely, which is what a user almost always wants next.
|
|
3234
|
+
*/
|
|
3235
|
+
renderKindWarning(which) {
|
|
3236
|
+
const band = this.bandFor(which);
|
|
3237
|
+
const warning = band.querySelector("[data-hf-warning]");
|
|
3238
|
+
if (!warning) return;
|
|
3239
|
+
const kind = this.kinds[which];
|
|
3240
|
+
if (kind === "default") {
|
|
3241
|
+
warning.hidden = true;
|
|
3242
|
+
warning.textContent = "";
|
|
3243
|
+
return;
|
|
3244
|
+
}
|
|
3245
|
+
const other = which === "header" ? "footer" : "header";
|
|
3246
|
+
warning.hidden = false;
|
|
3247
|
+
warning.textContent = `${kind === "even" ? EVEN_WARNING : FIRST_WARNING} `;
|
|
3248
|
+
if (this.partUriFor(other, kind)) return;
|
|
3249
|
+
const fix = document.createElement("button");
|
|
3250
|
+
fix.type = "button";
|
|
3251
|
+
fix.setAttribute("data-hf-fix-counterpart", "");
|
|
3252
|
+
fix.textContent = `Also create a ${kind === "even" ? "matching even" : "first-page"} ${other}`;
|
|
3253
|
+
fix.addEventListener("click", () => {
|
|
3254
|
+
this.setKind(other, kind);
|
|
3255
|
+
this.renderKindWarning(which);
|
|
3256
|
+
});
|
|
3257
|
+
warning.appendChild(fix);
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3260
|
+
function parseResult(json) {
|
|
3261
|
+
try {
|
|
3262
|
+
return JSON.parse(json);
|
|
3263
|
+
} catch {
|
|
3264
|
+
return { success: false };
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
// node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
3269
|
+
function _arrayWithHoles(r) {
|
|
3270
|
+
if (Array.isArray(r)) return r;
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
// node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
3274
|
+
function _iterableToArrayLimit(r, l) {
|
|
3275
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
3276
|
+
if (null != t) {
|
|
3277
|
+
var e, n, i, u, a = [], f = true, o = false;
|
|
3278
|
+
try {
|
|
3279
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
3280
|
+
if (Object(t) !== t) return;
|
|
3281
|
+
f = false;
|
|
3282
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
|
|
3283
|
+
} catch (r2) {
|
|
3284
|
+
o = true, n = r2;
|
|
3285
|
+
} finally {
|
|
3286
|
+
try {
|
|
3287
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
3288
|
+
} finally {
|
|
3289
|
+
if (o) throw n;
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
return a;
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
// node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
3297
|
+
function _arrayLikeToArray(r, a) {
|
|
3298
|
+
(null == a || a > r.length) && (a = r.length);
|
|
3299
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
3300
|
+
return n;
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
// node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
3304
|
+
function _unsupportedIterableToArray(r, a) {
|
|
3305
|
+
if (r) {
|
|
3306
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
3307
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
3308
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
// node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
3313
|
+
function _nonIterableRest() {
|
|
3314
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
// node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
3318
|
+
function _slicedToArray(r, e) {
|
|
3319
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js
|
|
3323
|
+
var import_bind_event_listener4 = __toESM(require_dist());
|
|
3324
|
+
|
|
3325
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js
|
|
3326
|
+
var honeyPotDataAttribute = "data-pdnd-honey-pot";
|
|
3327
|
+
|
|
3328
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js
|
|
3329
|
+
function isHoneyPotElement(target) {
|
|
3330
|
+
return target instanceof Element && target.hasAttribute(honeyPotDataAttribute);
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js
|
|
3334
|
+
function getElementFromPointWithoutHoneypot(client) {
|
|
3335
|
+
var _document$elementsFro = document.elementsFromPoint(client.x, client.y), _document$elementsFro2 = _slicedToArray(_document$elementsFro, 2), top2 = _document$elementsFro2[0], second = _document$elementsFro2[1];
|
|
3336
|
+
if (!top2) {
|
|
3337
|
+
return null;
|
|
3338
|
+
}
|
|
3339
|
+
if (isHoneyPotElement(top2)) {
|
|
3340
|
+
return second !== null && second !== void 0 ? second : null;
|
|
3341
|
+
}
|
|
3342
|
+
return top2;
|
|
3343
|
+
}
|
|
3344
|
+
|
|
3345
|
+
// node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
3346
|
+
function _typeof(o) {
|
|
3347
|
+
"@babel/helpers - typeof";
|
|
3348
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
3349
|
+
return typeof o2;
|
|
3350
|
+
} : function(o2) {
|
|
3351
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
3352
|
+
}, _typeof(o);
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
// node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
3356
|
+
function toPrimitive(t, r) {
|
|
3357
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
3358
|
+
var e = t[Symbol.toPrimitive];
|
|
3359
|
+
if (void 0 !== e) {
|
|
3360
|
+
var i = e.call(t, r || "default");
|
|
3361
|
+
if ("object" != _typeof(i)) return i;
|
|
3362
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3363
|
+
}
|
|
3364
|
+
return ("string" === r ? String : Number)(t);
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
3368
|
+
function toPropertyKey(t) {
|
|
3369
|
+
var i = toPrimitive(t, "string");
|
|
3370
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
// node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
3374
|
+
function _defineProperty(e, r, t) {
|
|
3375
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
3376
|
+
value: t,
|
|
3377
|
+
enumerable: true,
|
|
3378
|
+
configurable: true,
|
|
3379
|
+
writable: true
|
|
3380
|
+
}) : e[r] = t, e;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js
|
|
3384
|
+
var import_bind_event_listener = __toESM(require_dist());
|
|
3385
|
+
|
|
3386
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/max-z-index.js
|
|
3387
|
+
var maxZIndex = 2147483647;
|
|
3388
|
+
|
|
3389
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/popover-reset-styles.js
|
|
3390
|
+
var popoverResetUserAgentStyles = {
|
|
3391
|
+
inset: "unset",
|
|
3392
|
+
border: "none",
|
|
3393
|
+
padding: 0,
|
|
3394
|
+
margin: 0,
|
|
3395
|
+
overflow: "visible",
|
|
3396
|
+
color: "inherit",
|
|
3397
|
+
background: "transparent",
|
|
3398
|
+
width: "auto",
|
|
3399
|
+
height: "auto"
|
|
3400
|
+
};
|
|
3401
|
+
|
|
3402
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js
|
|
3403
|
+
function once(fn) {
|
|
3404
|
+
var cache = null;
|
|
3405
|
+
return function wrapped() {
|
|
3406
|
+
if (!cache) {
|
|
3407
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3408
|
+
args[_key] = arguments[_key];
|
|
3409
|
+
}
|
|
3410
|
+
var result = fn.apply(this, args);
|
|
3411
|
+
cache = {
|
|
3412
|
+
result
|
|
3413
|
+
};
|
|
3414
|
+
}
|
|
3415
|
+
return cache.result;
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/supports-popover.js
|
|
3420
|
+
var supportsPopover = once(function supportsPopover2() {
|
|
3421
|
+
return typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype.showPopover === "function";
|
|
3422
|
+
});
|
|
3423
|
+
|
|
3424
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js
|
|
3425
|
+
function ownKeys(e, r) {
|
|
3426
|
+
var t = Object.keys(e);
|
|
3427
|
+
if (Object.getOwnPropertySymbols) {
|
|
3428
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
3429
|
+
r && (o = o.filter(function(r2) {
|
|
3430
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
3431
|
+
})), t.push.apply(t, o);
|
|
3432
|
+
}
|
|
3433
|
+
return t;
|
|
3434
|
+
}
|
|
3435
|
+
function _objectSpread(e) {
|
|
3436
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
3437
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
3438
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
3439
|
+
_defineProperty(e, r2, t[r2]);
|
|
3440
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
3441
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
3442
|
+
});
|
|
3443
|
+
}
|
|
3444
|
+
return e;
|
|
3445
|
+
}
|
|
3446
|
+
var honeyPotSize = 2;
|
|
3447
|
+
var halfHoneyPotSize = honeyPotSize / 2;
|
|
3448
|
+
function floorToClosestPixel(point) {
|
|
3449
|
+
return {
|
|
3450
|
+
x: Math.floor(point.x),
|
|
3451
|
+
y: Math.floor(point.y)
|
|
3452
|
+
};
|
|
3453
|
+
}
|
|
3454
|
+
function pullBackByHalfHoneyPotSize(point) {
|
|
3455
|
+
return {
|
|
3456
|
+
x: point.x - halfHoneyPotSize,
|
|
3457
|
+
y: point.y - halfHoneyPotSize
|
|
3458
|
+
};
|
|
3459
|
+
}
|
|
3460
|
+
function preventGoingBackwardsOffScreen(point) {
|
|
3461
|
+
return {
|
|
3462
|
+
x: Math.max(point.x, 0),
|
|
3463
|
+
y: Math.max(point.y, 0)
|
|
3464
|
+
};
|
|
3465
|
+
}
|
|
3466
|
+
function preventGoingForwardsOffScreen(point) {
|
|
3467
|
+
return {
|
|
3468
|
+
x: Math.min(point.x, window.innerWidth - honeyPotSize),
|
|
3469
|
+
y: Math.min(point.y, window.innerHeight - honeyPotSize)
|
|
3470
|
+
};
|
|
3471
|
+
}
|
|
3472
|
+
function getHoneyPotRectFor(_ref) {
|
|
3473
|
+
var client = _ref.client;
|
|
3474
|
+
var point = preventGoingForwardsOffScreen(preventGoingBackwardsOffScreen(pullBackByHalfHoneyPotSize(floorToClosestPixel(client))));
|
|
3475
|
+
return DOMRect.fromRect({
|
|
3476
|
+
x: point.x,
|
|
3477
|
+
y: point.y,
|
|
3478
|
+
width: honeyPotSize,
|
|
3479
|
+
height: honeyPotSize
|
|
3480
|
+
});
|
|
3481
|
+
}
|
|
3482
|
+
function getRectStyles(_ref2) {
|
|
3483
|
+
var clientRect = _ref2.clientRect;
|
|
3484
|
+
return {
|
|
3485
|
+
left: "".concat(clientRect.left, "px"),
|
|
3486
|
+
top: "".concat(clientRect.top, "px"),
|
|
3487
|
+
width: "".concat(clientRect.width, "px"),
|
|
3488
|
+
height: "".concat(clientRect.height, "px")
|
|
3489
|
+
};
|
|
3490
|
+
}
|
|
3491
|
+
function isWithin(_ref3) {
|
|
3492
|
+
var client = _ref3.client, clientRect = _ref3.clientRect;
|
|
3493
|
+
return (
|
|
3494
|
+
// is within horizontal bounds
|
|
3495
|
+
client.x >= clientRect.x && client.x <= clientRect.x + clientRect.width && // is within vertical bounds
|
|
3496
|
+
client.y >= clientRect.y && client.y <= clientRect.y + clientRect.height
|
|
3497
|
+
);
|
|
3498
|
+
}
|
|
3499
|
+
function mountHoneyPot(_ref4) {
|
|
3500
|
+
var initial = _ref4.initial;
|
|
3501
|
+
var element = document.createElement("div");
|
|
3502
|
+
element.setAttribute(honeyPotDataAttribute, "true");
|
|
3503
|
+
if (supportsPopover()) {
|
|
3504
|
+
element.setAttribute("popover", "manual");
|
|
3505
|
+
}
|
|
3506
|
+
var clientRect = getHoneyPotRectFor({
|
|
3507
|
+
client: initial
|
|
3508
|
+
});
|
|
3509
|
+
Object.assign(element.style, _objectSpread(_objectSpread({
|
|
3510
|
+
position: "fixed"
|
|
3511
|
+
}, supportsPopover() ? (
|
|
3512
|
+
// needs to come first as it has 'inset: unset' which
|
|
3513
|
+
// needs to be overridden by our top / left values
|
|
3514
|
+
popoverResetUserAgentStyles
|
|
3515
|
+
) : {
|
|
3516
|
+
// Fallback: using maximum possible z-index so that this element
|
|
3517
|
+
// will always be on top of other positioned content.
|
|
3518
|
+
zIndex: maxZIndex
|
|
3519
|
+
}), {}, {
|
|
3520
|
+
// Setting a background color explicitly to avoid any inherited styles.
|
|
3521
|
+
// Looks like this could be `opacity: 0`, but worried that _might_
|
|
3522
|
+
// cause the element to be ignored on some platforms.
|
|
3523
|
+
// When debugging, set backgroundColor to something like "red".
|
|
3524
|
+
backgroundColor: "transparent",
|
|
3525
|
+
// Being explicit to avoid inheriting styles
|
|
3526
|
+
padding: 0,
|
|
3527
|
+
margin: 0,
|
|
3528
|
+
boxSizing: "border-box",
|
|
3529
|
+
// We want this element to absorb pointer events,
|
|
3530
|
+
// it's kind of the whole point 😉
|
|
3531
|
+
pointerEvents: "auto"
|
|
3532
|
+
}, getRectStyles({
|
|
3533
|
+
clientRect
|
|
3534
|
+
})));
|
|
3535
|
+
document.body.appendChild(element);
|
|
3536
|
+
if (supportsPopover()) {
|
|
3537
|
+
element.showPopover();
|
|
3538
|
+
}
|
|
3539
|
+
var unbindPointerMove = (0, import_bind_event_listener.bind)(window, {
|
|
3540
|
+
type: "pointermove",
|
|
3541
|
+
listener: function listener(event) {
|
|
3542
|
+
var client = {
|
|
3543
|
+
x: event.clientX,
|
|
3544
|
+
y: event.clientY
|
|
3545
|
+
};
|
|
3546
|
+
clientRect = getHoneyPotRectFor({
|
|
3547
|
+
client
|
|
3548
|
+
});
|
|
3549
|
+
Object.assign(element.style, getRectStyles({
|
|
3550
|
+
clientRect
|
|
3551
|
+
}));
|
|
3552
|
+
},
|
|
3553
|
+
// using capture so we are less likely to be impacted by event stopping
|
|
3554
|
+
options: {
|
|
3555
|
+
capture: true
|
|
3556
|
+
}
|
|
3557
|
+
});
|
|
3558
|
+
return function finish(_ref5) {
|
|
3559
|
+
var current = _ref5.current;
|
|
3560
|
+
unbindPointerMove();
|
|
3561
|
+
if (isWithin({
|
|
3562
|
+
client: current,
|
|
3563
|
+
clientRect
|
|
3564
|
+
})) {
|
|
3565
|
+
element.remove();
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
function cleanup() {
|
|
3569
|
+
unbindPostDragEvents();
|
|
3570
|
+
element.remove();
|
|
3571
|
+
}
|
|
3572
|
+
var unbindPostDragEvents = (0, import_bind_event_listener.bindAll)(window, [
|
|
3573
|
+
{
|
|
3574
|
+
type: "pointerdown",
|
|
3575
|
+
listener: cleanup
|
|
3576
|
+
},
|
|
3577
|
+
{
|
|
3578
|
+
type: "pointermove",
|
|
3579
|
+
listener: cleanup
|
|
3580
|
+
},
|
|
3581
|
+
{
|
|
3582
|
+
type: "focusin",
|
|
3583
|
+
listener: cleanup
|
|
3584
|
+
},
|
|
3585
|
+
{
|
|
3586
|
+
type: "focusout",
|
|
3587
|
+
listener: cleanup
|
|
3588
|
+
},
|
|
3589
|
+
// a 'pointerdown' should happen before 'dragstart', but just being super safe
|
|
3590
|
+
{
|
|
3591
|
+
type: "dragstart",
|
|
3592
|
+
listener: cleanup
|
|
3593
|
+
},
|
|
3594
|
+
// if the user has dragged something out of the window
|
|
3595
|
+
// and then is dragging something back into the window
|
|
3596
|
+
// the first events we will see are "dragenter" (and then "dragover").
|
|
3597
|
+
// So if we see any of these we need to clear the post drag fix.
|
|
3598
|
+
{
|
|
3599
|
+
type: "dragenter",
|
|
3600
|
+
listener: cleanup
|
|
3601
|
+
},
|
|
3602
|
+
{
|
|
3603
|
+
type: "dragover",
|
|
3604
|
+
listener: cleanup
|
|
3605
|
+
}
|
|
3606
|
+
// Not adding a "wheel" event listener, as "wheel" by itself does not
|
|
3607
|
+
// resolve the bug.
|
|
3608
|
+
], {
|
|
3609
|
+
// Using `capture` so less likely to be impacted by other code stopping events
|
|
3610
|
+
capture: true
|
|
3611
|
+
});
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3614
|
+
function makeHoneyPotFix() {
|
|
3615
|
+
var latestPointerMove = null;
|
|
3616
|
+
function bindEvents() {
|
|
3617
|
+
latestPointerMove = null;
|
|
3618
|
+
return (0, import_bind_event_listener.bind)(window, {
|
|
3619
|
+
type: "pointermove",
|
|
3620
|
+
listener: function listener(event) {
|
|
3621
|
+
latestPointerMove = {
|
|
3622
|
+
x: event.clientX,
|
|
3623
|
+
y: event.clientY
|
|
3624
|
+
};
|
|
3625
|
+
},
|
|
3626
|
+
// listening for pointer move in capture phase
|
|
3627
|
+
// so we are less likely to be impacted by events being stopped.
|
|
3628
|
+
options: {
|
|
3629
|
+
capture: true
|
|
3630
|
+
}
|
|
3631
|
+
});
|
|
3632
|
+
}
|
|
3633
|
+
function getOnPostDispatch() {
|
|
3634
|
+
var finish = null;
|
|
3635
|
+
return function onPostEvent(_ref6) {
|
|
3636
|
+
var eventName = _ref6.eventName, payload = _ref6.payload;
|
|
3637
|
+
if (eventName === "onDragStart") {
|
|
3638
|
+
var input = payload.location.initial.input;
|
|
3639
|
+
var initial = latestPointerMove !== null && latestPointerMove !== void 0 ? latestPointerMove : {
|
|
3640
|
+
x: input.clientX,
|
|
3641
|
+
y: input.clientY
|
|
3642
|
+
};
|
|
3643
|
+
finish = mountHoneyPot({
|
|
3644
|
+
initial
|
|
3645
|
+
});
|
|
3646
|
+
}
|
|
3647
|
+
if (eventName === "onDrop") {
|
|
3648
|
+
var _finish;
|
|
3649
|
+
var _input = payload.location.current.input;
|
|
3650
|
+
(_finish = finish) === null || _finish === void 0 || _finish({
|
|
3651
|
+
current: {
|
|
3652
|
+
x: _input.clientX,
|
|
3653
|
+
y: _input.clientY
|
|
3654
|
+
}
|
|
3655
|
+
});
|
|
3656
|
+
finish = null;
|
|
3657
|
+
latestPointerMove = null;
|
|
3658
|
+
}
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
return {
|
|
3662
|
+
bindEvents,
|
|
3663
|
+
getOnPostDispatch
|
|
3664
|
+
};
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
// node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
3668
|
+
function _arrayWithoutHoles(r) {
|
|
3669
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
// node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
3673
|
+
function _iterableToArray(r) {
|
|
3674
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
// node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
3678
|
+
function _nonIterableSpread() {
|
|
3679
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
// node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
3683
|
+
function _toConsumableArray(r) {
|
|
3684
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js
|
|
3688
|
+
var import_bind_event_listener3 = __toESM(require_dist());
|
|
3689
|
+
|
|
3690
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js
|
|
3691
|
+
var isFirefox = once(function isFirefox2() {
|
|
3692
|
+
if (false) {
|
|
3693
|
+
return false;
|
|
3694
|
+
}
|
|
3695
|
+
return navigator.userAgent.includes("Firefox");
|
|
3696
|
+
});
|
|
3697
|
+
|
|
3698
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js
|
|
3699
|
+
var isSafari = once(function isSafari2() {
|
|
3700
|
+
if (false) {
|
|
3701
|
+
return false;
|
|
3702
|
+
}
|
|
3703
|
+
var _navigator = navigator, userAgent = _navigator.userAgent;
|
|
3704
|
+
return userAgent.includes("AppleWebKit") && !userAgent.includes("Chrome");
|
|
3705
|
+
});
|
|
3706
|
+
|
|
3707
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js
|
|
3708
|
+
var import_bind_event_listener2 = __toESM(require_dist());
|
|
3709
|
+
var symbols = {
|
|
3710
|
+
isLeavingWindow: /* @__PURE__ */ Symbol("leaving"),
|
|
3711
|
+
isEnteringWindow: /* @__PURE__ */ Symbol("entering")
|
|
3712
|
+
};
|
|
3713
|
+
function isLeavingWindowInSafari(_ref2) {
|
|
3714
|
+
var dragLeave = _ref2.dragLeave;
|
|
3715
|
+
if (!isSafari()) {
|
|
3716
|
+
return false;
|
|
3717
|
+
}
|
|
3718
|
+
return dragLeave.hasOwnProperty(symbols.isLeavingWindow);
|
|
3719
|
+
}
|
|
3720
|
+
(function fixSafari() {
|
|
3721
|
+
if (typeof window === "undefined") {
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
if (false) {
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
if (!isSafari()) {
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3730
|
+
function getInitialState() {
|
|
3731
|
+
return {
|
|
3732
|
+
enterCount: 0,
|
|
3733
|
+
isOverWindow: false
|
|
3734
|
+
};
|
|
3735
|
+
}
|
|
3736
|
+
var state = getInitialState();
|
|
3737
|
+
function resetState() {
|
|
3738
|
+
state = getInitialState();
|
|
3739
|
+
}
|
|
3740
|
+
(0, import_bind_event_listener2.bindAll)(
|
|
3741
|
+
window,
|
|
3742
|
+
[{
|
|
3743
|
+
type: "dragstart",
|
|
3744
|
+
listener: function listener() {
|
|
3745
|
+
state.enterCount = 0;
|
|
3746
|
+
state.isOverWindow = true;
|
|
3747
|
+
}
|
|
3748
|
+
}, {
|
|
3749
|
+
type: "drop",
|
|
3750
|
+
listener: resetState
|
|
3751
|
+
}, {
|
|
3752
|
+
type: "dragend",
|
|
3753
|
+
listener: resetState
|
|
3754
|
+
}, {
|
|
3755
|
+
type: "dragenter",
|
|
3756
|
+
listener: function listener(event) {
|
|
3757
|
+
if (!state.isOverWindow && state.enterCount === 0) {
|
|
3758
|
+
event[symbols.isEnteringWindow] = true;
|
|
3759
|
+
}
|
|
3760
|
+
state.isOverWindow = true;
|
|
3761
|
+
state.enterCount++;
|
|
3762
|
+
}
|
|
3763
|
+
}, {
|
|
3764
|
+
type: "dragleave",
|
|
3765
|
+
listener: function listener(event) {
|
|
3766
|
+
state.enterCount--;
|
|
3767
|
+
if (state.isOverWindow && state.enterCount === 0) {
|
|
3768
|
+
event[symbols.isLeavingWindow] = true;
|
|
3769
|
+
state.isOverWindow = false;
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
}],
|
|
3773
|
+
// using `capture: true` so that adding event listeners
|
|
3774
|
+
// in bubble phase will have the correct symbols
|
|
3775
|
+
{
|
|
3776
|
+
capture: true
|
|
3777
|
+
}
|
|
3778
|
+
);
|
|
3779
|
+
})();
|
|
3780
|
+
|
|
3781
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js
|
|
3782
|
+
function isNodeLike(target) {
|
|
3783
|
+
return "nodeName" in target;
|
|
3784
|
+
}
|
|
3785
|
+
function isFromAnotherWindow(eventTarget) {
|
|
3786
|
+
return isNodeLike(eventTarget) && eventTarget.ownerDocument !== document;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js
|
|
3790
|
+
function isLeavingWindow(_ref) {
|
|
3791
|
+
var dragLeave = _ref.dragLeave;
|
|
3792
|
+
var type = dragLeave.type, relatedTarget = dragLeave.relatedTarget;
|
|
3793
|
+
if (type !== "dragleave") {
|
|
3794
|
+
return false;
|
|
3795
|
+
}
|
|
3796
|
+
if (isSafari()) {
|
|
3797
|
+
return isLeavingWindowInSafari({
|
|
3798
|
+
dragLeave
|
|
3799
|
+
});
|
|
3800
|
+
}
|
|
3801
|
+
if (relatedTarget == null) {
|
|
3802
|
+
return true;
|
|
3803
|
+
}
|
|
3804
|
+
if (isFirefox()) {
|
|
3805
|
+
return isFromAnotherWindow(relatedTarget);
|
|
3806
|
+
}
|
|
3807
|
+
return relatedTarget instanceof HTMLIFrameElement;
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js
|
|
3811
|
+
function getBindingsForBrokenDrags(_ref) {
|
|
3812
|
+
var onDragEnd = _ref.onDragEnd;
|
|
3813
|
+
return [
|
|
3814
|
+
// ## Detecting drag ending for removed draggables
|
|
3815
|
+
//
|
|
3816
|
+
// If a draggable element is removed during a drag and the user drops:
|
|
3817
|
+
// 1. if over a valid drop target: we get a "drop" event to know the drag is finished
|
|
3818
|
+
// 2. if not over a valid drop target (or cancelled): we get nothing
|
|
3819
|
+
// The "dragend" event will not fire on the source draggable if it has been
|
|
3820
|
+
// removed from the DOM.
|
|
3821
|
+
// So we need to figure out if a drag operation has finished by looking at other events
|
|
3822
|
+
// We can do this by looking at other events
|
|
3823
|
+
// ### First detection: "pointermove" events
|
|
3824
|
+
// 1. "pointermove" events cannot fire during a drag and drop operation
|
|
3825
|
+
// according to the spec. So if we get a "pointermove" it means that
|
|
3826
|
+
// the drag and drop operations has finished. So if we get a "pointermove"
|
|
3827
|
+
// we know that the drag is over
|
|
3828
|
+
// 2. 🦊😤 Drag and drop operations are _supposed_ to suppress
|
|
3829
|
+
// other pointer events. However, firefox will allow a few
|
|
3830
|
+
// pointer event to get through after a drag starts.
|
|
3831
|
+
// The most I've seen is 3
|
|
3832
|
+
{
|
|
3833
|
+
type: "pointermove",
|
|
3834
|
+
listener: /* @__PURE__ */ (function() {
|
|
3835
|
+
var callCount = 0;
|
|
3836
|
+
return function listener() {
|
|
3837
|
+
if (callCount < 20) {
|
|
3838
|
+
callCount++;
|
|
3839
|
+
return;
|
|
3840
|
+
}
|
|
3841
|
+
onDragEnd();
|
|
3842
|
+
};
|
|
3843
|
+
})()
|
|
3844
|
+
},
|
|
3845
|
+
// ### Second detection: "pointerdown" events
|
|
3846
|
+
// If we receive this event then we know that a drag operation has finished
|
|
3847
|
+
// and potentially another one is about to start.
|
|
3848
|
+
// Note: `pointerdown` fires on all browsers / platforms before "dragstart"
|
|
3849
|
+
{
|
|
3850
|
+
type: "pointerdown",
|
|
3851
|
+
listener: onDragEnd
|
|
3852
|
+
}
|
|
3853
|
+
];
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js
|
|
3857
|
+
function getInput(event) {
|
|
3858
|
+
return {
|
|
3859
|
+
altKey: event.altKey,
|
|
3860
|
+
button: event.button,
|
|
3861
|
+
buttons: event.buttons,
|
|
3862
|
+
ctrlKey: event.ctrlKey,
|
|
3863
|
+
metaKey: event.metaKey,
|
|
3864
|
+
shiftKey: event.shiftKey,
|
|
3865
|
+
clientX: event.clientX,
|
|
3866
|
+
clientY: event.clientY,
|
|
3867
|
+
pageX: event.pageX,
|
|
3868
|
+
pageY: event.pageY
|
|
3869
|
+
};
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
// node_modules/raf-schd/dist/raf-schd.esm.js
|
|
3873
|
+
var rafSchd = function rafSchd2(fn) {
|
|
3874
|
+
var lastArgs = [];
|
|
3875
|
+
var frameId = null;
|
|
3876
|
+
var wrapperFn = function wrapperFn2() {
|
|
3877
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3878
|
+
args[_key] = arguments[_key];
|
|
3879
|
+
}
|
|
3880
|
+
lastArgs = args;
|
|
3881
|
+
if (frameId) {
|
|
3882
|
+
return;
|
|
3883
|
+
}
|
|
3884
|
+
frameId = requestAnimationFrame(function() {
|
|
3885
|
+
frameId = null;
|
|
3886
|
+
fn.apply(void 0, lastArgs);
|
|
3887
|
+
});
|
|
3888
|
+
};
|
|
3889
|
+
wrapperFn.cancel = function() {
|
|
3890
|
+
if (!frameId) {
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
cancelAnimationFrame(frameId);
|
|
3894
|
+
frameId = null;
|
|
3895
|
+
};
|
|
3896
|
+
return wrapperFn;
|
|
3897
|
+
};
|
|
3898
|
+
var raf_schd_esm_default = rafSchd;
|
|
3899
|
+
|
|
3900
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js
|
|
3901
|
+
var scheduleOnDrag = raf_schd_esm_default(function(fn) {
|
|
3902
|
+
return fn();
|
|
3903
|
+
});
|
|
3904
|
+
var dragStart = /* @__PURE__ */ (function() {
|
|
3905
|
+
var scheduled = null;
|
|
3906
|
+
function schedule(fn) {
|
|
3907
|
+
var frameId = requestAnimationFrame(function() {
|
|
3908
|
+
scheduled = null;
|
|
3909
|
+
fn();
|
|
3910
|
+
});
|
|
3911
|
+
scheduled = {
|
|
3912
|
+
frameId,
|
|
3913
|
+
fn
|
|
3914
|
+
};
|
|
3915
|
+
}
|
|
3916
|
+
function flush() {
|
|
3917
|
+
if (scheduled) {
|
|
3918
|
+
cancelAnimationFrame(scheduled.frameId);
|
|
3919
|
+
scheduled.fn();
|
|
3920
|
+
scheduled = null;
|
|
3921
|
+
}
|
|
3922
|
+
}
|
|
3923
|
+
return {
|
|
3924
|
+
schedule,
|
|
3925
|
+
flush
|
|
3926
|
+
};
|
|
3927
|
+
})();
|
|
3928
|
+
function makeDispatch(_ref) {
|
|
3929
|
+
var source = _ref.source, initial = _ref.initial, dispatchEvent = _ref.dispatchEvent;
|
|
3930
|
+
var previous = {
|
|
3931
|
+
dropTargets: []
|
|
3932
|
+
};
|
|
3933
|
+
function safeDispatch(args) {
|
|
3934
|
+
dispatchEvent(args);
|
|
3935
|
+
previous = {
|
|
3936
|
+
dropTargets: args.payload.location.current.dropTargets
|
|
3937
|
+
};
|
|
3938
|
+
}
|
|
3939
|
+
var dispatch = {
|
|
3940
|
+
start: function start2(_ref2) {
|
|
3941
|
+
var nativeSetDragImage = _ref2.nativeSetDragImage;
|
|
3942
|
+
var location2 = {
|
|
3943
|
+
current: initial,
|
|
3944
|
+
previous,
|
|
3945
|
+
initial
|
|
3946
|
+
};
|
|
3947
|
+
safeDispatch({
|
|
3948
|
+
eventName: "onGenerateDragPreview",
|
|
3949
|
+
payload: {
|
|
3950
|
+
source,
|
|
3951
|
+
location: location2,
|
|
3952
|
+
nativeSetDragImage
|
|
3953
|
+
}
|
|
3954
|
+
});
|
|
3955
|
+
dragStart.schedule(function() {
|
|
3956
|
+
safeDispatch({
|
|
3957
|
+
eventName: "onDragStart",
|
|
3958
|
+
payload: {
|
|
3959
|
+
source,
|
|
3960
|
+
location: location2
|
|
3961
|
+
}
|
|
3962
|
+
});
|
|
3963
|
+
});
|
|
3964
|
+
},
|
|
3965
|
+
dragUpdate: function dragUpdate(_ref3) {
|
|
3966
|
+
var current = _ref3.current;
|
|
3967
|
+
dragStart.flush();
|
|
3968
|
+
scheduleOnDrag.cancel();
|
|
3969
|
+
safeDispatch({
|
|
3970
|
+
eventName: "onDropTargetChange",
|
|
3971
|
+
payload: {
|
|
3972
|
+
source,
|
|
3973
|
+
location: {
|
|
3974
|
+
initial,
|
|
3975
|
+
previous,
|
|
3976
|
+
current
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
});
|
|
3980
|
+
},
|
|
3981
|
+
drag: function drag(_ref4) {
|
|
3982
|
+
var current = _ref4.current;
|
|
3983
|
+
scheduleOnDrag(function() {
|
|
3984
|
+
dragStart.flush();
|
|
3985
|
+
var location2 = {
|
|
3986
|
+
initial,
|
|
3987
|
+
previous,
|
|
3988
|
+
current
|
|
3989
|
+
};
|
|
3990
|
+
safeDispatch({
|
|
3991
|
+
eventName: "onDrag",
|
|
3992
|
+
payload: {
|
|
3993
|
+
source,
|
|
3994
|
+
location: location2
|
|
3995
|
+
}
|
|
3996
|
+
});
|
|
3997
|
+
});
|
|
3998
|
+
},
|
|
3999
|
+
drop: function drop(_ref5) {
|
|
4000
|
+
var current = _ref5.current, updatedSourcePayload = _ref5.updatedSourcePayload;
|
|
4001
|
+
dragStart.flush();
|
|
4002
|
+
scheduleOnDrag.cancel();
|
|
4003
|
+
safeDispatch({
|
|
4004
|
+
eventName: "onDrop",
|
|
4005
|
+
payload: {
|
|
4006
|
+
source: updatedSourcePayload !== null && updatedSourcePayload !== void 0 ? updatedSourcePayload : source,
|
|
4007
|
+
location: {
|
|
4008
|
+
current,
|
|
4009
|
+
previous,
|
|
4010
|
+
initial
|
|
4011
|
+
}
|
|
4012
|
+
}
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
};
|
|
4016
|
+
return dispatch;
|
|
4017
|
+
}
|
|
4018
|
+
|
|
4019
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js
|
|
4020
|
+
var globalState = {
|
|
4021
|
+
isActive: false
|
|
4022
|
+
};
|
|
4023
|
+
function canStart() {
|
|
4024
|
+
return !globalState.isActive;
|
|
4025
|
+
}
|
|
4026
|
+
function getNativeSetDragImage(event) {
|
|
4027
|
+
if (event.dataTransfer) {
|
|
4028
|
+
return event.dataTransfer.setDragImage.bind(event.dataTransfer);
|
|
4029
|
+
}
|
|
4030
|
+
return null;
|
|
4031
|
+
}
|
|
4032
|
+
function hasHierarchyChanged(_ref) {
|
|
4033
|
+
var current = _ref.current, next = _ref.next;
|
|
4034
|
+
if (current.length !== next.length) {
|
|
4035
|
+
return true;
|
|
4036
|
+
}
|
|
4037
|
+
for (var i = 0; i < current.length; i++) {
|
|
4038
|
+
if (current[i].element !== next[i].element) {
|
|
4039
|
+
return true;
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
return false;
|
|
4043
|
+
}
|
|
4044
|
+
function start(_ref2) {
|
|
4045
|
+
var event = _ref2.event, dragType = _ref2.dragType, getDropTargetsOver = _ref2.getDropTargetsOver, dispatchEvent = _ref2.dispatchEvent;
|
|
4046
|
+
if (!canStart()) {
|
|
4047
|
+
return;
|
|
4048
|
+
}
|
|
4049
|
+
var initial = getStartLocation({
|
|
4050
|
+
event,
|
|
4051
|
+
dragType,
|
|
4052
|
+
getDropTargetsOver
|
|
4053
|
+
});
|
|
4054
|
+
globalState.isActive = true;
|
|
4055
|
+
var state = {
|
|
4056
|
+
current: initial
|
|
4057
|
+
};
|
|
4058
|
+
setDropEffectOnEvent({
|
|
4059
|
+
event,
|
|
4060
|
+
current: initial.dropTargets
|
|
4061
|
+
});
|
|
4062
|
+
var dispatch = makeDispatch({
|
|
4063
|
+
source: dragType.payload,
|
|
4064
|
+
dispatchEvent,
|
|
4065
|
+
initial
|
|
4066
|
+
});
|
|
4067
|
+
function updateState(next) {
|
|
4068
|
+
var hasChanged = hasHierarchyChanged({
|
|
4069
|
+
current: state.current.dropTargets,
|
|
4070
|
+
next: next.dropTargets
|
|
4071
|
+
});
|
|
4072
|
+
state.current = next;
|
|
4073
|
+
if (hasChanged) {
|
|
4074
|
+
dispatch.dragUpdate({
|
|
4075
|
+
current: state.current
|
|
4076
|
+
});
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
function onUpdateEvent(event2) {
|
|
4080
|
+
var input = getInput(event2);
|
|
4081
|
+
var target = isHoneyPotElement(event2.target) ? getElementFromPointWithoutHoneypot({
|
|
4082
|
+
x: input.clientX,
|
|
4083
|
+
y: input.clientY
|
|
4084
|
+
}) : event2.target;
|
|
4085
|
+
var nextDropTargets = getDropTargetsOver({
|
|
4086
|
+
target,
|
|
4087
|
+
input,
|
|
4088
|
+
source: dragType.payload,
|
|
4089
|
+
current: state.current.dropTargets
|
|
4090
|
+
});
|
|
4091
|
+
if (nextDropTargets.length) {
|
|
4092
|
+
event2.preventDefault();
|
|
4093
|
+
setDropEffectOnEvent({
|
|
4094
|
+
event: event2,
|
|
4095
|
+
current: nextDropTargets
|
|
4096
|
+
});
|
|
4097
|
+
}
|
|
4098
|
+
updateState({
|
|
4099
|
+
dropTargets: nextDropTargets,
|
|
4100
|
+
input
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
function cancel() {
|
|
4104
|
+
if (state.current.dropTargets.length) {
|
|
4105
|
+
updateState({
|
|
4106
|
+
dropTargets: [],
|
|
4107
|
+
input: state.current.input
|
|
4108
|
+
});
|
|
4109
|
+
}
|
|
4110
|
+
dispatch.drop({
|
|
4111
|
+
current: state.current,
|
|
4112
|
+
updatedSourcePayload: null
|
|
4113
|
+
});
|
|
4114
|
+
finish();
|
|
4115
|
+
}
|
|
4116
|
+
function finish() {
|
|
4117
|
+
globalState.isActive = false;
|
|
4118
|
+
unbindEvents();
|
|
4119
|
+
}
|
|
4120
|
+
var unbindEvents = (0, import_bind_event_listener3.bindAll)(
|
|
4121
|
+
window,
|
|
4122
|
+
[{
|
|
4123
|
+
// 👋 Note: we are repurposing the `dragover` event as our `drag` event
|
|
4124
|
+
// this is because firefox does not publish pointer coordinates during
|
|
4125
|
+
// a `drag` event, but does for every other type of drag event
|
|
4126
|
+
// `dragover` fires on all elements that are being dragged over
|
|
4127
|
+
// Because we are binding to `window` - our `dragover` is effectively the same as a `drag`
|
|
4128
|
+
// 🦊😤
|
|
4129
|
+
type: "dragover",
|
|
4130
|
+
listener: function listener(event2) {
|
|
4131
|
+
onUpdateEvent(event2);
|
|
4132
|
+
dispatch.drag({
|
|
4133
|
+
current: state.current
|
|
4134
|
+
});
|
|
4135
|
+
}
|
|
4136
|
+
}, {
|
|
4137
|
+
type: "dragenter",
|
|
4138
|
+
listener: onUpdateEvent
|
|
4139
|
+
}, {
|
|
4140
|
+
type: "dragleave",
|
|
4141
|
+
listener: function listener(event2) {
|
|
4142
|
+
if (!isLeavingWindow({
|
|
4143
|
+
dragLeave: event2
|
|
4144
|
+
})) {
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4147
|
+
updateState({
|
|
4148
|
+
input: state.current.input,
|
|
4149
|
+
dropTargets: []
|
|
4150
|
+
});
|
|
4151
|
+
if (dragType.startedFrom === "external") {
|
|
4152
|
+
cancel();
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
}, {
|
|
4156
|
+
// A "drop" can only happen if the browser allowed the drop
|
|
4157
|
+
type: "drop",
|
|
4158
|
+
listener: function listener(event2) {
|
|
4159
|
+
state.current = {
|
|
4160
|
+
dropTargets: state.current.dropTargets,
|
|
4161
|
+
input: getInput(event2)
|
|
4162
|
+
};
|
|
4163
|
+
if (!state.current.dropTargets.length) {
|
|
4164
|
+
cancel();
|
|
4165
|
+
return;
|
|
4166
|
+
}
|
|
4167
|
+
event2.preventDefault();
|
|
4168
|
+
setDropEffectOnEvent({
|
|
4169
|
+
event: event2,
|
|
4170
|
+
current: state.current.dropTargets
|
|
4171
|
+
});
|
|
4172
|
+
dispatch.drop({
|
|
4173
|
+
current: state.current,
|
|
4174
|
+
// When dropping something native, we need to extract the latest
|
|
4175
|
+
// `.items` from the "drop" event as it is now accessible
|
|
4176
|
+
updatedSourcePayload: dragType.type === "external" ? dragType.getDropPayload(event2) : null
|
|
4177
|
+
});
|
|
4178
|
+
finish();
|
|
4179
|
+
}
|
|
4180
|
+
}, {
|
|
4181
|
+
// "dragend" fires when on the drag source (eg a draggable element)
|
|
4182
|
+
// when the drag is finished.
|
|
4183
|
+
// "dragend" will fire after "drop" (if there was a successful drop)
|
|
4184
|
+
// "dragend" does not fire if the draggable source has been removed during the drag
|
|
4185
|
+
// or for external drag sources (eg files)
|
|
4186
|
+
// This "dragend" listener will not fire if there was a successful drop
|
|
4187
|
+
// as we will have already removed the event listener
|
|
4188
|
+
type: "dragend",
|
|
4189
|
+
listener: function listener(event2) {
|
|
4190
|
+
state.current = {
|
|
4191
|
+
dropTargets: state.current.dropTargets,
|
|
4192
|
+
input: getInput(event2)
|
|
4193
|
+
};
|
|
4194
|
+
cancel();
|
|
4195
|
+
}
|
|
4196
|
+
}].concat(_toConsumableArray(getBindingsForBrokenDrags({
|
|
4197
|
+
onDragEnd: cancel
|
|
4198
|
+
}))),
|
|
4199
|
+
// Once we have started a managed drag operation it is important that we see / own all drag events
|
|
4200
|
+
// We got one adoption bug pop up where some code was stopping (`event.stopPropagation()`)
|
|
4201
|
+
// all "drop" events in the bubble phase on the `document.body`.
|
|
4202
|
+
// This meant that we never saw the "drop" event.
|
|
4203
|
+
{
|
|
4204
|
+
capture: true
|
|
4205
|
+
}
|
|
4206
|
+
);
|
|
4207
|
+
dispatch.start({
|
|
4208
|
+
nativeSetDragImage: getNativeSetDragImage(event)
|
|
4209
|
+
});
|
|
4210
|
+
}
|
|
4211
|
+
function setDropEffectOnEvent(_ref3) {
|
|
4212
|
+
var _current$;
|
|
4213
|
+
var event = _ref3.event, current = _ref3.current;
|
|
4214
|
+
var innerMost = (_current$ = current[0]) === null || _current$ === void 0 ? void 0 : _current$.dropEffect;
|
|
4215
|
+
if (innerMost != null && event.dataTransfer) {
|
|
4216
|
+
event.dataTransfer.dropEffect = innerMost;
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
function getStartLocation(_ref4) {
|
|
4220
|
+
var event = _ref4.event, dragType = _ref4.dragType, getDropTargetsOver = _ref4.getDropTargetsOver;
|
|
4221
|
+
var input = getInput(event);
|
|
4222
|
+
if (dragType.startedFrom === "external") {
|
|
4223
|
+
return {
|
|
4224
|
+
input,
|
|
4225
|
+
dropTargets: []
|
|
4226
|
+
};
|
|
4227
|
+
}
|
|
4228
|
+
var dropTargets = getDropTargetsOver({
|
|
4229
|
+
input,
|
|
4230
|
+
source: dragType.payload,
|
|
4231
|
+
target: event.target,
|
|
4232
|
+
current: []
|
|
4233
|
+
});
|
|
4234
|
+
return {
|
|
4235
|
+
input,
|
|
4236
|
+
dropTargets
|
|
4237
|
+
};
|
|
4238
|
+
}
|
|
4239
|
+
var lifecycle = {
|
|
4240
|
+
canStart,
|
|
4241
|
+
start
|
|
4242
|
+
};
|
|
4243
|
+
|
|
4244
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js
|
|
4245
|
+
var ledger = /* @__PURE__ */ new Map();
|
|
4246
|
+
function registerUsage(_ref) {
|
|
4247
|
+
var typeKey = _ref.typeKey, mount2 = _ref.mount;
|
|
4248
|
+
var entry = ledger.get(typeKey);
|
|
4249
|
+
if (entry) {
|
|
4250
|
+
entry.usageCount++;
|
|
4251
|
+
return entry;
|
|
4252
|
+
}
|
|
4253
|
+
var initial = {
|
|
4254
|
+
typeKey,
|
|
4255
|
+
unmount: mount2(),
|
|
4256
|
+
usageCount: 1
|
|
4257
|
+
};
|
|
4258
|
+
ledger.set(typeKey, initial);
|
|
4259
|
+
return initial;
|
|
4260
|
+
}
|
|
4261
|
+
function register(args) {
|
|
4262
|
+
var entry = registerUsage(args);
|
|
4263
|
+
return function unregister() {
|
|
4264
|
+
entry.usageCount--;
|
|
4265
|
+
if (entry.usageCount > 0) {
|
|
4266
|
+
return;
|
|
4267
|
+
}
|
|
4268
|
+
entry.unmount();
|
|
4269
|
+
ledger.delete(args.typeKey);
|
|
4270
|
+
};
|
|
4271
|
+
}
|
|
4272
|
+
|
|
4273
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js
|
|
4274
|
+
function combine() {
|
|
4275
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4276
|
+
fns[_key] = arguments[_key];
|
|
4277
|
+
}
|
|
4278
|
+
return function cleanup() {
|
|
4279
|
+
fns.forEach(function(fn) {
|
|
4280
|
+
return fn();
|
|
4281
|
+
});
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js
|
|
4286
|
+
function addAttribute(element, _ref) {
|
|
4287
|
+
var attribute = _ref.attribute, value = _ref.value;
|
|
4288
|
+
element.setAttribute(attribute, value);
|
|
4289
|
+
return function() {
|
|
4290
|
+
return element.removeAttribute(attribute);
|
|
4291
|
+
};
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4294
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js
|
|
4295
|
+
function ownKeys2(e, r) {
|
|
4296
|
+
var t = Object.keys(e);
|
|
4297
|
+
if (Object.getOwnPropertySymbols) {
|
|
4298
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4299
|
+
r && (o = o.filter(function(r2) {
|
|
4300
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4301
|
+
})), t.push.apply(t, o);
|
|
4302
|
+
}
|
|
4303
|
+
return t;
|
|
4304
|
+
}
|
|
4305
|
+
function _objectSpread2(e) {
|
|
4306
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4307
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4308
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r2) {
|
|
4309
|
+
_defineProperty(e, r2, t[r2]);
|
|
4310
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r2) {
|
|
4311
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4312
|
+
});
|
|
4313
|
+
}
|
|
4314
|
+
return e;
|
|
4315
|
+
}
|
|
4316
|
+
function _createForOfIteratorHelper(r, e) {
|
|
4317
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4318
|
+
if (!t) {
|
|
4319
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray2(r)) || e && r && "number" == typeof r.length) {
|
|
4320
|
+
t && (r = t);
|
|
4321
|
+
var _n = 0, F = function F2() {
|
|
4322
|
+
};
|
|
4323
|
+
return { s: F, n: function n() {
|
|
4324
|
+
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
4325
|
+
}, e: function e2(r2) {
|
|
4326
|
+
throw r2;
|
|
4327
|
+
}, f: F };
|
|
4328
|
+
}
|
|
4329
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4330
|
+
}
|
|
4331
|
+
var o, a = true, u = false;
|
|
4332
|
+
return { s: function s() {
|
|
4333
|
+
t = t.call(r);
|
|
4334
|
+
}, n: function n() {
|
|
4335
|
+
var r2 = t.next();
|
|
4336
|
+
return a = r2.done, r2;
|
|
4337
|
+
}, e: function e2(r2) {
|
|
4338
|
+
u = true, o = r2;
|
|
4339
|
+
}, f: function f() {
|
|
4340
|
+
try {
|
|
4341
|
+
a || null == t.return || t.return();
|
|
4342
|
+
} finally {
|
|
4343
|
+
if (u) throw o;
|
|
4344
|
+
}
|
|
4345
|
+
} };
|
|
4346
|
+
}
|
|
4347
|
+
function _unsupportedIterableToArray2(r, a) {
|
|
4348
|
+
if (r) {
|
|
4349
|
+
if ("string" == typeof r) return _arrayLikeToArray2(r, a);
|
|
4350
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
4351
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray2(r, a) : void 0;
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
function _arrayLikeToArray2(r, a) {
|
|
4355
|
+
(null == a || a > r.length) && (a = r.length);
|
|
4356
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4357
|
+
return n;
|
|
4358
|
+
}
|
|
4359
|
+
function copyReverse(array) {
|
|
4360
|
+
return array.slice(0).reverse();
|
|
4361
|
+
}
|
|
4362
|
+
function makeDropTarget(_ref) {
|
|
4363
|
+
var typeKey = _ref.typeKey, defaultDropEffect = _ref.defaultDropEffect;
|
|
4364
|
+
var registry = /* @__PURE__ */ new WeakMap();
|
|
4365
|
+
var dropTargetDataAtt = "data-drop-target-for-".concat(typeKey);
|
|
4366
|
+
var dropTargetSelector = "[".concat(dropTargetDataAtt, "]");
|
|
4367
|
+
function addToRegistry2(args) {
|
|
4368
|
+
registry.set(args.element, args);
|
|
4369
|
+
return function() {
|
|
4370
|
+
return registry.delete(args.element);
|
|
4371
|
+
};
|
|
4372
|
+
}
|
|
4373
|
+
function dropTargetForConsumers(args) {
|
|
4374
|
+
if (true) {
|
|
4375
|
+
var existing = registry.get(args.element);
|
|
4376
|
+
if (existing) {
|
|
4377
|
+
console.warn("You have already registered a [".concat(typeKey, "] dropTarget on the same element"), {
|
|
4378
|
+
existing,
|
|
4379
|
+
proposed: args
|
|
4380
|
+
});
|
|
4381
|
+
}
|
|
4382
|
+
if (args.element instanceof HTMLIFrameElement) {
|
|
4383
|
+
console.warn("\n We recommend not registering <iframe> elements as drop targets\n as it can result in some strange browser event ordering.\n ".replace(/\s{2,}/g, " ").trim());
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
var cleanup = combine(addAttribute(args.element, {
|
|
4387
|
+
attribute: dropTargetDataAtt,
|
|
4388
|
+
value: "true"
|
|
4389
|
+
}), addToRegistry2(args));
|
|
4390
|
+
return once(cleanup);
|
|
4391
|
+
}
|
|
4392
|
+
function getActualDropTargets(_ref2) {
|
|
4393
|
+
var _args$getData, _args$getData2, _args$getDropEffect, _args$getDropEffect2;
|
|
4394
|
+
var source = _ref2.source, target = _ref2.target, input = _ref2.input, _ref2$result = _ref2.result, result = _ref2$result === void 0 ? [] : _ref2$result;
|
|
4395
|
+
if (target == null) {
|
|
4396
|
+
return result;
|
|
4397
|
+
}
|
|
4398
|
+
if (!(target instanceof Element)) {
|
|
4399
|
+
if (target instanceof Node) {
|
|
4400
|
+
return getActualDropTargets({
|
|
4401
|
+
source,
|
|
4402
|
+
target: target.parentElement,
|
|
4403
|
+
input,
|
|
4404
|
+
result
|
|
4405
|
+
});
|
|
4406
|
+
}
|
|
4407
|
+
return result;
|
|
4408
|
+
}
|
|
4409
|
+
var closest = target.closest(dropTargetSelector);
|
|
4410
|
+
if (closest == null) {
|
|
4411
|
+
return result;
|
|
4412
|
+
}
|
|
4413
|
+
var args = registry.get(closest);
|
|
4414
|
+
if (args == null) {
|
|
4415
|
+
return result;
|
|
4416
|
+
}
|
|
4417
|
+
var feedback = {
|
|
4418
|
+
input,
|
|
4419
|
+
source,
|
|
4420
|
+
element: args.element
|
|
4421
|
+
};
|
|
4422
|
+
if (args.canDrop && !args.canDrop(feedback)) {
|
|
4423
|
+
return getActualDropTargets({
|
|
4424
|
+
source,
|
|
4425
|
+
target: args.element.parentElement,
|
|
4426
|
+
input,
|
|
4427
|
+
result
|
|
4428
|
+
});
|
|
4429
|
+
}
|
|
4430
|
+
var data = (_args$getData = (_args$getData2 = args.getData) === null || _args$getData2 === void 0 ? void 0 : _args$getData2.call(args, feedback)) !== null && _args$getData !== void 0 ? _args$getData : {};
|
|
4431
|
+
var dropEffect = (_args$getDropEffect = (_args$getDropEffect2 = args.getDropEffect) === null || _args$getDropEffect2 === void 0 ? void 0 : _args$getDropEffect2.call(args, feedback)) !== null && _args$getDropEffect !== void 0 ? _args$getDropEffect : defaultDropEffect;
|
|
4432
|
+
var record = {
|
|
4433
|
+
data,
|
|
4434
|
+
element: args.element,
|
|
4435
|
+
dropEffect,
|
|
4436
|
+
// we are collecting _actual_ drop targets, so these are
|
|
4437
|
+
// being applied _not_ due to stickiness
|
|
4438
|
+
isActiveDueToStickiness: false
|
|
4439
|
+
};
|
|
4440
|
+
return getActualDropTargets({
|
|
4441
|
+
source,
|
|
4442
|
+
target: args.element.parentElement,
|
|
4443
|
+
input,
|
|
4444
|
+
// Using bubble ordering. Same ordering as `event.getPath()`
|
|
4445
|
+
result: [].concat(_toConsumableArray(result), [record])
|
|
4446
|
+
});
|
|
4447
|
+
}
|
|
4448
|
+
function notifyCurrent(_ref3) {
|
|
4449
|
+
var eventName = _ref3.eventName, payload = _ref3.payload;
|
|
4450
|
+
var _iterator = _createForOfIteratorHelper(payload.location.current.dropTargets), _step;
|
|
4451
|
+
try {
|
|
4452
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
4453
|
+
var _entry$eventName;
|
|
4454
|
+
var record = _step.value;
|
|
4455
|
+
var entry = registry.get(record.element);
|
|
4456
|
+
var args = _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
4457
|
+
self: record
|
|
4458
|
+
});
|
|
4459
|
+
entry === null || entry === void 0 || (_entry$eventName = entry[eventName]) === null || _entry$eventName === void 0 || _entry$eventName.call(
|
|
4460
|
+
entry,
|
|
4461
|
+
// I cannot seem to get the types right here.
|
|
4462
|
+
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
4463
|
+
// @ts-expect-error
|
|
4464
|
+
args
|
|
4465
|
+
);
|
|
4466
|
+
}
|
|
4467
|
+
} catch (err) {
|
|
4468
|
+
_iterator.e(err);
|
|
4469
|
+
} finally {
|
|
4470
|
+
_iterator.f();
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
var actions = {
|
|
4474
|
+
onGenerateDragPreview: notifyCurrent,
|
|
4475
|
+
onDrag: notifyCurrent,
|
|
4476
|
+
onDragStart: notifyCurrent,
|
|
4477
|
+
onDrop: notifyCurrent,
|
|
4478
|
+
onDropTargetChange: function onDropTargetChange(_ref4) {
|
|
4479
|
+
var payload = _ref4.payload;
|
|
4480
|
+
var isCurrent = new Set(payload.location.current.dropTargets.map(function(record2) {
|
|
4481
|
+
return record2.element;
|
|
4482
|
+
}));
|
|
4483
|
+
var visited = /* @__PURE__ */ new Set();
|
|
4484
|
+
var _iterator2 = _createForOfIteratorHelper(payload.location.previous.dropTargets), _step2;
|
|
4485
|
+
try {
|
|
4486
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
|
|
4487
|
+
var _entry$onDropTargetCh;
|
|
4488
|
+
var record = _step2.value;
|
|
4489
|
+
visited.add(record.element);
|
|
4490
|
+
var entry = registry.get(record.element);
|
|
4491
|
+
var isOver = isCurrent.has(record.element);
|
|
4492
|
+
var args = _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
4493
|
+
self: record
|
|
4494
|
+
});
|
|
4495
|
+
entry === null || entry === void 0 || (_entry$onDropTargetCh = entry.onDropTargetChange) === null || _entry$onDropTargetCh === void 0 || _entry$onDropTargetCh.call(entry, args);
|
|
4496
|
+
if (!isOver) {
|
|
4497
|
+
var _entry$onDragLeave;
|
|
4498
|
+
entry === null || entry === void 0 || (_entry$onDragLeave = entry.onDragLeave) === null || _entry$onDragLeave === void 0 || _entry$onDragLeave.call(entry, args);
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
} catch (err) {
|
|
4502
|
+
_iterator2.e(err);
|
|
4503
|
+
} finally {
|
|
4504
|
+
_iterator2.f();
|
|
4505
|
+
}
|
|
4506
|
+
var _iterator3 = _createForOfIteratorHelper(payload.location.current.dropTargets), _step3;
|
|
4507
|
+
try {
|
|
4508
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
|
4509
|
+
var _entry$onDropTargetCh2, _entry$onDragEnter;
|
|
4510
|
+
var _record = _step3.value;
|
|
4511
|
+
if (visited.has(_record.element)) {
|
|
4512
|
+
continue;
|
|
4513
|
+
}
|
|
4514
|
+
var _args = _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
4515
|
+
self: _record
|
|
4516
|
+
});
|
|
4517
|
+
var _entry = registry.get(_record.element);
|
|
4518
|
+
_entry === null || _entry === void 0 || (_entry$onDropTargetCh2 = _entry.onDropTargetChange) === null || _entry$onDropTargetCh2 === void 0 || _entry$onDropTargetCh2.call(_entry, _args);
|
|
4519
|
+
_entry === null || _entry === void 0 || (_entry$onDragEnter = _entry.onDragEnter) === null || _entry$onDragEnter === void 0 || _entry$onDragEnter.call(_entry, _args);
|
|
4520
|
+
}
|
|
4521
|
+
} catch (err) {
|
|
4522
|
+
_iterator3.e(err);
|
|
4523
|
+
} finally {
|
|
4524
|
+
_iterator3.f();
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4527
|
+
};
|
|
4528
|
+
function dispatchEvent(args) {
|
|
4529
|
+
actions[args.eventName](args);
|
|
4530
|
+
}
|
|
4531
|
+
function getIsOver(_ref5) {
|
|
4532
|
+
var source = _ref5.source, target = _ref5.target, input = _ref5.input, current = _ref5.current;
|
|
4533
|
+
var actual = getActualDropTargets({
|
|
4534
|
+
source,
|
|
4535
|
+
target,
|
|
4536
|
+
input
|
|
4537
|
+
});
|
|
4538
|
+
if (actual.length >= current.length) {
|
|
4539
|
+
return actual;
|
|
4540
|
+
}
|
|
4541
|
+
var lastCaptureOrdered = copyReverse(current);
|
|
4542
|
+
var actualCaptureOrdered = copyReverse(actual);
|
|
4543
|
+
var resultCaptureOrdered = [];
|
|
4544
|
+
for (var index = 0; index < lastCaptureOrdered.length; index++) {
|
|
4545
|
+
var _argsForLast$getIsSti;
|
|
4546
|
+
var last = lastCaptureOrdered[index];
|
|
4547
|
+
var fresh = actualCaptureOrdered[index];
|
|
4548
|
+
if (fresh != null) {
|
|
4549
|
+
resultCaptureOrdered.push(fresh);
|
|
4550
|
+
continue;
|
|
4551
|
+
}
|
|
4552
|
+
var parent = resultCaptureOrdered[index - 1];
|
|
4553
|
+
var lastParent = lastCaptureOrdered[index - 1];
|
|
4554
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.element) !== (lastParent === null || lastParent === void 0 ? void 0 : lastParent.element)) {
|
|
4555
|
+
break;
|
|
4556
|
+
}
|
|
4557
|
+
var argsForLast = registry.get(last.element);
|
|
4558
|
+
if (!argsForLast) {
|
|
4559
|
+
break;
|
|
4560
|
+
}
|
|
4561
|
+
var feedback = {
|
|
4562
|
+
input,
|
|
4563
|
+
source,
|
|
4564
|
+
element: argsForLast.element
|
|
4565
|
+
};
|
|
4566
|
+
if (argsForLast.canDrop && !argsForLast.canDrop(feedback)) {
|
|
4567
|
+
break;
|
|
4568
|
+
}
|
|
4569
|
+
if (!((_argsForLast$getIsSti = argsForLast.getIsSticky) !== null && _argsForLast$getIsSti !== void 0 && _argsForLast$getIsSti.call(argsForLast, feedback))) {
|
|
4570
|
+
break;
|
|
4571
|
+
}
|
|
4572
|
+
resultCaptureOrdered.push(_objectSpread2(_objectSpread2({}, last), {}, {
|
|
4573
|
+
// making it clear to consumers this drop target is active due to stickiness
|
|
4574
|
+
isActiveDueToStickiness: true
|
|
4575
|
+
}));
|
|
4576
|
+
}
|
|
4577
|
+
return copyReverse(resultCaptureOrdered);
|
|
4578
|
+
}
|
|
4579
|
+
return {
|
|
4580
|
+
dropTargetForConsumers,
|
|
4581
|
+
getIsOver,
|
|
4582
|
+
dispatchEvent
|
|
4583
|
+
};
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js
|
|
4587
|
+
function _createForOfIteratorHelper2(r, e) {
|
|
4588
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4589
|
+
if (!t) {
|
|
4590
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray3(r)) || e && r && "number" == typeof r.length) {
|
|
4591
|
+
t && (r = t);
|
|
4592
|
+
var _n = 0, F = function F2() {
|
|
4593
|
+
};
|
|
4594
|
+
return { s: F, n: function n() {
|
|
4595
|
+
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
4596
|
+
}, e: function e2(r2) {
|
|
4597
|
+
throw r2;
|
|
4598
|
+
}, f: F };
|
|
4599
|
+
}
|
|
4600
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4601
|
+
}
|
|
4602
|
+
var o, a = true, u = false;
|
|
4603
|
+
return { s: function s() {
|
|
4604
|
+
t = t.call(r);
|
|
4605
|
+
}, n: function n() {
|
|
4606
|
+
var r2 = t.next();
|
|
4607
|
+
return a = r2.done, r2;
|
|
4608
|
+
}, e: function e2(r2) {
|
|
4609
|
+
u = true, o = r2;
|
|
4610
|
+
}, f: function f() {
|
|
4611
|
+
try {
|
|
4612
|
+
a || null == t.return || t.return();
|
|
4613
|
+
} finally {
|
|
4614
|
+
if (u) throw o;
|
|
4615
|
+
}
|
|
4616
|
+
} };
|
|
4617
|
+
}
|
|
4618
|
+
function _unsupportedIterableToArray3(r, a) {
|
|
4619
|
+
if (r) {
|
|
4620
|
+
if ("string" == typeof r) return _arrayLikeToArray3(r, a);
|
|
4621
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
4622
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray3(r, a) : void 0;
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
function _arrayLikeToArray3(r, a) {
|
|
4626
|
+
(null == a || a > r.length) && (a = r.length);
|
|
4627
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4628
|
+
return n;
|
|
4629
|
+
}
|
|
4630
|
+
function ownKeys3(e, r) {
|
|
4631
|
+
var t = Object.keys(e);
|
|
4632
|
+
if (Object.getOwnPropertySymbols) {
|
|
4633
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4634
|
+
r && (o = o.filter(function(r2) {
|
|
4635
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4636
|
+
})), t.push.apply(t, o);
|
|
4637
|
+
}
|
|
4638
|
+
return t;
|
|
4639
|
+
}
|
|
4640
|
+
function _objectSpread3(e) {
|
|
4641
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4642
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4643
|
+
r % 2 ? ownKeys3(Object(t), true).forEach(function(r2) {
|
|
4644
|
+
_defineProperty(e, r2, t[r2]);
|
|
4645
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r2) {
|
|
4646
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4647
|
+
});
|
|
4648
|
+
}
|
|
4649
|
+
return e;
|
|
4650
|
+
}
|
|
4651
|
+
function makeMonitor() {
|
|
4652
|
+
var registry = /* @__PURE__ */ new Set();
|
|
4653
|
+
var dragging = null;
|
|
4654
|
+
function tryAddToActive(monitor) {
|
|
4655
|
+
if (!dragging) {
|
|
4656
|
+
return;
|
|
4657
|
+
}
|
|
4658
|
+
if (!monitor.canMonitor || monitor.canMonitor(dragging.canMonitorArgs)) {
|
|
4659
|
+
dragging.active.add(monitor);
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
function monitorForConsumers(args) {
|
|
4663
|
+
var entry = _objectSpread3({}, args);
|
|
4664
|
+
registry.add(entry);
|
|
4665
|
+
tryAddToActive(entry);
|
|
4666
|
+
function cleanup() {
|
|
4667
|
+
registry.delete(entry);
|
|
4668
|
+
if (dragging) {
|
|
4669
|
+
dragging.active.delete(entry);
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4672
|
+
return once(cleanup);
|
|
4673
|
+
}
|
|
4674
|
+
function dispatchEvent(_ref) {
|
|
4675
|
+
var eventName = _ref.eventName, payload = _ref.payload;
|
|
4676
|
+
if (eventName === "onGenerateDragPreview") {
|
|
4677
|
+
dragging = {
|
|
4678
|
+
canMonitorArgs: {
|
|
4679
|
+
initial: payload.location.initial,
|
|
4680
|
+
source: payload.source
|
|
4681
|
+
},
|
|
4682
|
+
active: /* @__PURE__ */ new Set()
|
|
4683
|
+
};
|
|
4684
|
+
var _iterator = _createForOfIteratorHelper2(registry), _step;
|
|
4685
|
+
try {
|
|
4686
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
4687
|
+
var monitor = _step.value;
|
|
4688
|
+
tryAddToActive(monitor);
|
|
4689
|
+
}
|
|
4690
|
+
} catch (err) {
|
|
4691
|
+
_iterator.e(err);
|
|
4692
|
+
} finally {
|
|
4693
|
+
_iterator.f();
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
if (!dragging) {
|
|
4697
|
+
return;
|
|
4698
|
+
}
|
|
4699
|
+
var active = Array.from(dragging.active);
|
|
4700
|
+
for (var _i = 0, _active = active; _i < _active.length; _i++) {
|
|
4701
|
+
var _monitor = _active[_i];
|
|
4702
|
+
if (dragging.active.has(_monitor)) {
|
|
4703
|
+
var _monitor$eventName;
|
|
4704
|
+
(_monitor$eventName = _monitor[eventName]) === null || _monitor$eventName === void 0 || _monitor$eventName.call(_monitor, payload);
|
|
4705
|
+
}
|
|
4706
|
+
}
|
|
4707
|
+
if (eventName === "onDrop") {
|
|
4708
|
+
dragging.active.clear();
|
|
4709
|
+
dragging = null;
|
|
4710
|
+
}
|
|
4711
|
+
}
|
|
4712
|
+
return {
|
|
4713
|
+
dispatchEvent,
|
|
4714
|
+
monitorForConsumers
|
|
4715
|
+
};
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4718
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js
|
|
4719
|
+
function makeAdapter(_ref) {
|
|
4720
|
+
var typeKey = _ref.typeKey, mount2 = _ref.mount, dispatchEventToSource2 = _ref.dispatchEventToSource, onPostDispatch = _ref.onPostDispatch, defaultDropEffect = _ref.defaultDropEffect;
|
|
4721
|
+
var monitorAPI = makeMonitor();
|
|
4722
|
+
var dropTargetAPI = makeDropTarget({
|
|
4723
|
+
typeKey,
|
|
4724
|
+
defaultDropEffect
|
|
4725
|
+
});
|
|
4726
|
+
function dispatchEvent(args) {
|
|
4727
|
+
dispatchEventToSource2 === null || dispatchEventToSource2 === void 0 || dispatchEventToSource2(args);
|
|
4728
|
+
dropTargetAPI.dispatchEvent(args);
|
|
4729
|
+
monitorAPI.dispatchEvent(args);
|
|
4730
|
+
onPostDispatch === null || onPostDispatch === void 0 || onPostDispatch(args);
|
|
4731
|
+
}
|
|
4732
|
+
function start2(_ref2) {
|
|
4733
|
+
var event = _ref2.event, dragType = _ref2.dragType;
|
|
4734
|
+
lifecycle.start({
|
|
4735
|
+
event,
|
|
4736
|
+
dragType,
|
|
4737
|
+
getDropTargetsOver: dropTargetAPI.getIsOver,
|
|
4738
|
+
dispatchEvent
|
|
4739
|
+
});
|
|
4740
|
+
}
|
|
4741
|
+
function registerUsage2() {
|
|
4742
|
+
function mountAdapter() {
|
|
4743
|
+
var api2 = {
|
|
4744
|
+
canStart: lifecycle.canStart,
|
|
4745
|
+
start: start2
|
|
4746
|
+
};
|
|
4747
|
+
return mount2(api2);
|
|
4748
|
+
}
|
|
4749
|
+
return register({
|
|
4750
|
+
typeKey,
|
|
4751
|
+
mount: mountAdapter
|
|
4752
|
+
});
|
|
4753
|
+
}
|
|
4754
|
+
return {
|
|
4755
|
+
registerUsage: registerUsage2,
|
|
4756
|
+
dropTarget: dropTargetAPI.dropTargetForConsumers,
|
|
4757
|
+
monitor: monitorAPI.monitorForConsumers
|
|
4758
|
+
};
|
|
4759
|
+
}
|
|
4760
|
+
|
|
4761
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js
|
|
4762
|
+
var isAndroid = once(function isAndroid2() {
|
|
4763
|
+
return navigator.userAgent.toLocaleLowerCase().includes("android");
|
|
4764
|
+
});
|
|
4765
|
+
var androidFallbackText = "pdnd:android-fallback";
|
|
4766
|
+
|
|
4767
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js
|
|
4768
|
+
var textMediaType = "text/plain";
|
|
4769
|
+
|
|
4770
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/url-media-type.js
|
|
4771
|
+
var URLMediaType = "text/uri-list";
|
|
4772
|
+
|
|
4773
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js
|
|
4774
|
+
var elementAdapterNativeDataKey = "application/vnd.pdnd";
|
|
4775
|
+
|
|
4776
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js
|
|
4777
|
+
var draggableRegistry = /* @__PURE__ */ new WeakMap();
|
|
4778
|
+
function addToRegistry(args) {
|
|
4779
|
+
draggableRegistry.set(args.element, args);
|
|
4780
|
+
return function cleanup() {
|
|
4781
|
+
draggableRegistry.delete(args.element);
|
|
4782
|
+
};
|
|
4783
|
+
}
|
|
4784
|
+
var honeyPotFix = makeHoneyPotFix();
|
|
4785
|
+
var adapter = makeAdapter({
|
|
4786
|
+
typeKey: "element",
|
|
4787
|
+
defaultDropEffect: "move",
|
|
4788
|
+
mount: function mount(api2) {
|
|
4789
|
+
return combine(honeyPotFix.bindEvents(), (0, import_bind_event_listener4.bind)(document, {
|
|
4790
|
+
type: "dragstart",
|
|
4791
|
+
listener: function listener(event) {
|
|
4792
|
+
var _entry$dragHandle, _entry$getInitialData, _entry$getInitialData2, _entry$dragHandle2, _entry$getInitialData3, _entry$getInitialData4;
|
|
4793
|
+
if (!api2.canStart(event)) {
|
|
4794
|
+
return;
|
|
4795
|
+
}
|
|
4796
|
+
if (event.defaultPrevented) {
|
|
4797
|
+
return;
|
|
4798
|
+
}
|
|
4799
|
+
if (!event.dataTransfer) {
|
|
4800
|
+
if (true) {
|
|
4801
|
+
console.warn("\n It appears as though you have are not testing DragEvents correctly.\n\n - If you are unit testing, ensure you have polyfilled DragEvent.\n - If you are browser testing, ensure you are dispatching drag events correctly.\n\n Please see our testing guides for more information:\n https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing\n ".replace(/ {2}/g, ""));
|
|
4802
|
+
}
|
|
4803
|
+
return;
|
|
4804
|
+
}
|
|
4805
|
+
var target = event.target;
|
|
4806
|
+
if (!(target instanceof HTMLElement)) {
|
|
4807
|
+
return;
|
|
4808
|
+
}
|
|
4809
|
+
var entry = draggableRegistry.get(target);
|
|
4810
|
+
if (!entry) {
|
|
4811
|
+
return;
|
|
4812
|
+
}
|
|
4813
|
+
var input = getInput(event);
|
|
4814
|
+
var feedback = {
|
|
4815
|
+
element: entry.element,
|
|
4816
|
+
dragHandle: (_entry$dragHandle = entry.dragHandle) !== null && _entry$dragHandle !== void 0 ? _entry$dragHandle : null,
|
|
4817
|
+
input
|
|
4818
|
+
};
|
|
4819
|
+
if (entry.canDrag && !entry.canDrag(feedback)) {
|
|
4820
|
+
event.preventDefault();
|
|
4821
|
+
return;
|
|
4822
|
+
}
|
|
4823
|
+
if (entry.dragHandle) {
|
|
4824
|
+
var over = getElementFromPointWithoutHoneypot({
|
|
4825
|
+
x: input.clientX,
|
|
4826
|
+
y: input.clientY
|
|
4827
|
+
});
|
|
4828
|
+
if (!entry.dragHandle.contains(over)) {
|
|
4829
|
+
event.preventDefault();
|
|
4830
|
+
return;
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
var nativeData = (_entry$getInitialData = (_entry$getInitialData2 = entry.getInitialDataForExternal) === null || _entry$getInitialData2 === void 0 ? void 0 : _entry$getInitialData2.call(entry, feedback)) !== null && _entry$getInitialData !== void 0 ? _entry$getInitialData : null;
|
|
4834
|
+
if (nativeData) {
|
|
4835
|
+
for (var _i = 0, _Object$entries = Object.entries(nativeData); _i < _Object$entries.length; _i++) {
|
|
4836
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], data = _Object$entries$_i[1];
|
|
4837
|
+
event.dataTransfer.setData(key, data !== null && data !== void 0 ? data : "");
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
if (isAndroid() && !event.dataTransfer.types.includes(textMediaType) && !event.dataTransfer.types.includes(URLMediaType)) {
|
|
4841
|
+
event.dataTransfer.setData(textMediaType, androidFallbackText);
|
|
4842
|
+
}
|
|
4843
|
+
event.dataTransfer.setData(elementAdapterNativeDataKey, "");
|
|
4844
|
+
var payload = {
|
|
4845
|
+
element: entry.element,
|
|
4846
|
+
dragHandle: (_entry$dragHandle2 = entry.dragHandle) !== null && _entry$dragHandle2 !== void 0 ? _entry$dragHandle2 : null,
|
|
4847
|
+
data: (_entry$getInitialData3 = (_entry$getInitialData4 = entry.getInitialData) === null || _entry$getInitialData4 === void 0 ? void 0 : _entry$getInitialData4.call(entry, feedback)) !== null && _entry$getInitialData3 !== void 0 ? _entry$getInitialData3 : {}
|
|
4848
|
+
};
|
|
4849
|
+
var dragType = {
|
|
4850
|
+
type: "element",
|
|
4851
|
+
payload,
|
|
4852
|
+
startedFrom: "internal"
|
|
4853
|
+
};
|
|
4854
|
+
api2.start({
|
|
4855
|
+
event,
|
|
4856
|
+
dragType
|
|
4857
|
+
});
|
|
4858
|
+
}
|
|
4859
|
+
}));
|
|
4860
|
+
},
|
|
4861
|
+
dispatchEventToSource: function dispatchEventToSource(_ref) {
|
|
4862
|
+
var _draggableRegistry$ge, _draggableRegistry$ge2;
|
|
4863
|
+
var eventName = _ref.eventName, payload = _ref.payload;
|
|
4864
|
+
(_draggableRegistry$ge = draggableRegistry.get(payload.source.element)) === null || _draggableRegistry$ge === void 0 || (_draggableRegistry$ge2 = _draggableRegistry$ge[eventName]) === null || _draggableRegistry$ge2 === void 0 || _draggableRegistry$ge2.call(
|
|
4865
|
+
_draggableRegistry$ge,
|
|
4866
|
+
// I cannot seem to get the types right here.
|
|
4867
|
+
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
4868
|
+
// @ts-expect-error
|
|
4869
|
+
payload
|
|
4870
|
+
);
|
|
4871
|
+
},
|
|
4872
|
+
onPostDispatch: honeyPotFix.getOnPostDispatch()
|
|
4873
|
+
});
|
|
4874
|
+
var dropTargetForElements = adapter.dropTarget;
|
|
4875
|
+
var monitorForElements = adapter.monitor;
|
|
4876
|
+
function draggable(args) {
|
|
4877
|
+
if (true) {
|
|
4878
|
+
if (args.dragHandle && !args.element.contains(args.dragHandle)) {
|
|
4879
|
+
console.warn("Drag handle element must be contained in draggable element", {
|
|
4880
|
+
element: args.element,
|
|
4881
|
+
dragHandle: args.dragHandle
|
|
4882
|
+
});
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
if (true) {
|
|
4886
|
+
var existing = draggableRegistry.get(args.element);
|
|
4887
|
+
if (existing) {
|
|
4888
|
+
console.warn("You have already registered a `draggable` on the same element", {
|
|
4889
|
+
existing,
|
|
4890
|
+
proposed: args
|
|
4891
|
+
});
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
var cleanup = combine(
|
|
4895
|
+
// making the draggable register the adapter rather than drop targets
|
|
4896
|
+
// this is because you *must* have a draggable element to start a drag
|
|
4897
|
+
// but you _might_ not have any drop targets immediately
|
|
4898
|
+
// (You might create drop targets async)
|
|
4899
|
+
adapter.registerUsage(),
|
|
4900
|
+
addToRegistry(args),
|
|
4901
|
+
addAttribute(args.element, {
|
|
4902
|
+
attribute: "draggable",
|
|
4903
|
+
value: "true"
|
|
4904
|
+
})
|
|
4905
|
+
);
|
|
4906
|
+
return once(cleanup);
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/engagement-history.js
|
|
4910
|
+
var ledger2 = /* @__PURE__ */ new Map();
|
|
4911
|
+
var requested = /* @__PURE__ */ new Set();
|
|
4912
|
+
function markAndGetEngagement(element) {
|
|
4913
|
+
markEngagement(element);
|
|
4914
|
+
var entry = ledger2.get(element);
|
|
4915
|
+
if (entry) {
|
|
4916
|
+
return entry;
|
|
4917
|
+
}
|
|
4918
|
+
var fresh = {
|
|
4919
|
+
timeOfEngagementStart: Date.now()
|
|
4920
|
+
};
|
|
4921
|
+
ledger2.set(element, fresh);
|
|
4922
|
+
return fresh;
|
|
4923
|
+
}
|
|
4924
|
+
function markEngagement(element) {
|
|
4925
|
+
requested.add(element);
|
|
4926
|
+
}
|
|
4927
|
+
function clearUnusedEngagements(fn) {
|
|
4928
|
+
requested.clear();
|
|
4929
|
+
fn();
|
|
4930
|
+
ledger2.forEach(function(_, element) {
|
|
4931
|
+
if (!requested.has(element)) {
|
|
4932
|
+
ledger2.delete(element);
|
|
4933
|
+
}
|
|
4934
|
+
});
|
|
4935
|
+
requested.clear();
|
|
4936
|
+
}
|
|
4937
|
+
function clearEngagementHistory() {
|
|
4938
|
+
ledger2.clear();
|
|
4939
|
+
}
|
|
4940
|
+
|
|
4941
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/scheduler.js
|
|
4942
|
+
var schedulers = /* @__PURE__ */ new Map();
|
|
4943
|
+
function getScheduler(monitor) {
|
|
4944
|
+
var scheduler = schedulers.get(monitor);
|
|
4945
|
+
if (scheduler) {
|
|
4946
|
+
return scheduler;
|
|
4947
|
+
}
|
|
4948
|
+
var created = makeScheduler(monitor);
|
|
4949
|
+
schedulers.set(monitor, created);
|
|
4950
|
+
return created;
|
|
4951
|
+
}
|
|
4952
|
+
function makeScheduler(monitor) {
|
|
4953
|
+
var state = {
|
|
4954
|
+
type: "idle"
|
|
4955
|
+
};
|
|
4956
|
+
var callbacks = [];
|
|
4957
|
+
function loop(timeLastFrameFinished) {
|
|
4958
|
+
if (state.type !== "running") {
|
|
4959
|
+
return;
|
|
4960
|
+
}
|
|
4961
|
+
var timeSinceLastFrame = timeLastFrameFinished - state.timeLastFrameFinished;
|
|
4962
|
+
var _state = state, latestArgs = _state.latestArgs;
|
|
4963
|
+
var underUsersPointer = getElementFromPointWithoutHoneypot({
|
|
4964
|
+
x: latestArgs.location.current.input.clientX,
|
|
4965
|
+
y: latestArgs.location.current.input.clientY
|
|
4966
|
+
});
|
|
4967
|
+
clearUnusedEngagements(function() {
|
|
4968
|
+
callbacks.forEach(function(onFrame) {
|
|
4969
|
+
return onFrame({
|
|
4970
|
+
underUsersPointer,
|
|
4971
|
+
latestArgs,
|
|
4972
|
+
timeSinceLastFrame
|
|
4973
|
+
});
|
|
4974
|
+
});
|
|
4975
|
+
});
|
|
4976
|
+
state.timeLastFrameFinished = timeLastFrameFinished;
|
|
4977
|
+
state.frameId = requestAnimationFrame(loop);
|
|
4978
|
+
}
|
|
4979
|
+
function reset() {
|
|
4980
|
+
if (state.type === "idle") {
|
|
4981
|
+
return;
|
|
4982
|
+
}
|
|
4983
|
+
cancelAnimationFrame(state.frameId);
|
|
4984
|
+
clearEngagementHistory();
|
|
4985
|
+
state = {
|
|
4986
|
+
type: "idle"
|
|
4987
|
+
};
|
|
4988
|
+
}
|
|
4989
|
+
function start2(args) {
|
|
4990
|
+
if (state.type !== "idle") {
|
|
4991
|
+
return;
|
|
4992
|
+
}
|
|
4993
|
+
state = {
|
|
4994
|
+
// Waiting a frame so we can accurately determine `timeSinceLastFrame`.
|
|
4995
|
+
type: "initializing",
|
|
4996
|
+
latestArgs: args,
|
|
4997
|
+
frameId: requestAnimationFrame(function(timeLastFrameFinished) {
|
|
4998
|
+
if (state.type !== "initializing") {
|
|
4999
|
+
return;
|
|
5000
|
+
}
|
|
5001
|
+
state = {
|
|
5002
|
+
type: "running",
|
|
5003
|
+
timeLastFrameFinished,
|
|
5004
|
+
latestArgs: state.latestArgs,
|
|
5005
|
+
frameId: requestAnimationFrame(loop)
|
|
5006
|
+
};
|
|
5007
|
+
})
|
|
5008
|
+
};
|
|
5009
|
+
}
|
|
5010
|
+
function update(args) {
|
|
5011
|
+
if (state.type === "idle") {
|
|
5012
|
+
start2(args);
|
|
5013
|
+
return;
|
|
5014
|
+
}
|
|
5015
|
+
state.latestArgs = args;
|
|
5016
|
+
}
|
|
5017
|
+
monitor({
|
|
5018
|
+
onDragStart: start2,
|
|
5019
|
+
onDropTargetChange: update,
|
|
5020
|
+
onDrag: update,
|
|
5021
|
+
onDrop: reset
|
|
5022
|
+
});
|
|
5023
|
+
var api2 = {
|
|
5024
|
+
onFrame: function onFrame(fn) {
|
|
5025
|
+
callbacks.push(fn);
|
|
5026
|
+
}
|
|
5027
|
+
};
|
|
5028
|
+
return api2;
|
|
5029
|
+
}
|
|
5030
|
+
|
|
5031
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/data-attributes.js
|
|
5032
|
+
var dataAttribute = "data-auto-scrollable";
|
|
5033
|
+
var selector = "[".concat(dataAttribute, '="true"]');
|
|
5034
|
+
function addScrollableAttribute(element) {
|
|
5035
|
+
element.setAttribute(dataAttribute, "true");
|
|
5036
|
+
return function() {
|
|
5037
|
+
return element.removeAttribute(dataAttribute);
|
|
5038
|
+
};
|
|
5039
|
+
}
|
|
5040
|
+
|
|
5041
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/configuration.js
|
|
5042
|
+
function ownKeys4(e, r) {
|
|
5043
|
+
var t = Object.keys(e);
|
|
5044
|
+
if (Object.getOwnPropertySymbols) {
|
|
5045
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
5046
|
+
r && (o = o.filter(function(r2) {
|
|
5047
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
5048
|
+
})), t.push.apply(t, o);
|
|
5049
|
+
}
|
|
5050
|
+
return t;
|
|
5051
|
+
}
|
|
5052
|
+
function _objectSpread4(e) {
|
|
5053
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
5054
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
5055
|
+
r % 2 ? ownKeys4(Object(t), true).forEach(function(r2) {
|
|
5056
|
+
_defineProperty(e, r2, t[r2]);
|
|
5057
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys4(Object(t)).forEach(function(r2) {
|
|
5058
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
5059
|
+
});
|
|
5060
|
+
}
|
|
5061
|
+
return e;
|
|
5062
|
+
}
|
|
5063
|
+
var baseConfig = {
|
|
5064
|
+
startHitboxAtPercentageRemainingOfElement: {
|
|
5065
|
+
top: 0.25,
|
|
5066
|
+
right: 0.25,
|
|
5067
|
+
bottom: 0.25,
|
|
5068
|
+
left: 0.25
|
|
5069
|
+
},
|
|
5070
|
+
maxScrollAtPercentageRemainingOfHitbox: {
|
|
5071
|
+
top: 0.5,
|
|
5072
|
+
right: 0.5,
|
|
5073
|
+
bottom: 0.5,
|
|
5074
|
+
left: 0.5
|
|
5075
|
+
},
|
|
5076
|
+
timeDampeningDurationMs: 400,
|
|
5077
|
+
// Too big and it's too easy to trigger auto scrolling
|
|
5078
|
+
// Too small and it's too hard 😅
|
|
5079
|
+
maxMainAxisHitboxSize: 180
|
|
5080
|
+
};
|
|
5081
|
+
var maxPixelScrollPerSecond = {
|
|
5082
|
+
// What the value would be if we were scrolling at 15px per frame at 60fps.
|
|
5083
|
+
// This is the default as it works well for most experiences.
|
|
5084
|
+
// In certain scenarios though it can feel a bit slow.
|
|
5085
|
+
standard: 15 * 60,
|
|
5086
|
+
// What the value would be if we were scrolling at 25px per frame at 60fps.
|
|
5087
|
+
// This is not the default as it feels too fast for a lot of experiences.
|
|
5088
|
+
fast: 25 * 60
|
|
5089
|
+
};
|
|
5090
|
+
function getInternalConfig(provided) {
|
|
5091
|
+
var _provided$maxScrollSp;
|
|
5092
|
+
return _objectSpread4(_objectSpread4({}, baseConfig), {}, {
|
|
5093
|
+
// only allowing limited control over the config at this stage
|
|
5094
|
+
maxPixelScrollPerSecond: maxPixelScrollPerSecond[(_provided$maxScrollSp = provided === null || provided === void 0 ? void 0 : provided.maxScrollSpeed) !== null && _provided$maxScrollSp !== void 0 ? _provided$maxScrollSp : "standard"]
|
|
5095
|
+
});
|
|
5096
|
+
}
|
|
5097
|
+
|
|
5098
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/can-scroll-on-edge.js
|
|
5099
|
+
var canScrollOnEdge = {
|
|
5100
|
+
// Notes:
|
|
5101
|
+
//
|
|
5102
|
+
// 🌏 Chrome 115.0: uses fractional units for `scrollLeft` and `scrollTop`
|
|
5103
|
+
// (and fractional units don't reach true integer maximum when zoomed in / out)
|
|
5104
|
+
// 🍎 Safari 16.5.2: no fractional units
|
|
5105
|
+
// 🦊 Firefox 115.0: no fractional units
|
|
5106
|
+
// we have some scroll we can move backwards into
|
|
5107
|
+
top: function top(element) {
|
|
5108
|
+
return element.scrollTop > 0;
|
|
5109
|
+
},
|
|
5110
|
+
// We have some scroll we can move forward into
|
|
5111
|
+
right: function right(element) {
|
|
5112
|
+
return Math.ceil(element.scrollLeft) + element.clientWidth < element.scrollWidth;
|
|
5113
|
+
},
|
|
5114
|
+
// We have some scroll we can move forwards into
|
|
5115
|
+
bottom: function bottom(element) {
|
|
5116
|
+
return Math.ceil(element.scrollTop) + element.clientHeight < element.scrollHeight;
|
|
5117
|
+
},
|
|
5118
|
+
// we have some scroll we can move back into.
|
|
5119
|
+
left: function left(element) {
|
|
5120
|
+
return element.scrollLeft > 0;
|
|
5121
|
+
}
|
|
5122
|
+
};
|
|
5123
|
+
|
|
5124
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/edges.js
|
|
5125
|
+
var edges = ["top", "right", "bottom", "left"];
|
|
5126
|
+
var edgeAxisLookup = {
|
|
5127
|
+
top: "vertical",
|
|
5128
|
+
right: "horizontal",
|
|
5129
|
+
bottom: "vertical",
|
|
5130
|
+
left: "horizontal"
|
|
5131
|
+
};
|
|
5132
|
+
|
|
5133
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/axis.js
|
|
5134
|
+
var vertical = {
|
|
5135
|
+
start: "top",
|
|
5136
|
+
end: "bottom",
|
|
5137
|
+
point: "y",
|
|
5138
|
+
size: "height"
|
|
5139
|
+
};
|
|
5140
|
+
var horizontal = {
|
|
5141
|
+
start: "left",
|
|
5142
|
+
end: "right",
|
|
5143
|
+
point: "x",
|
|
5144
|
+
size: "width"
|
|
5145
|
+
};
|
|
5146
|
+
var axisLookup = {
|
|
5147
|
+
vertical: {
|
|
5148
|
+
mainAxis: vertical,
|
|
5149
|
+
crossAxis: horizontal
|
|
5150
|
+
},
|
|
5151
|
+
horizontal: {
|
|
5152
|
+
mainAxis: horizontal,
|
|
5153
|
+
crossAxis: vertical
|
|
5154
|
+
}
|
|
5155
|
+
};
|
|
5156
|
+
|
|
5157
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/side.js
|
|
5158
|
+
var mainAxisSideLookup = {
|
|
5159
|
+
top: "start",
|
|
5160
|
+
right: "end",
|
|
5161
|
+
bottom: "end",
|
|
5162
|
+
left: "start"
|
|
5163
|
+
};
|
|
5164
|
+
|
|
5165
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/get-over-element-hitbox.js
|
|
5166
|
+
function makeGetHitbox(_ref) {
|
|
5167
|
+
var edge = _ref.edge, axis = _ref.axis;
|
|
5168
|
+
return function hitbox(_ref2) {
|
|
5169
|
+
var clientRect = _ref2.clientRect, config = _ref2.config;
|
|
5170
|
+
var _axisLookup$axis = axisLookup[axis], mainAxis = _axisLookup$axis.mainAxis, crossAxis = _axisLookup$axis.crossAxis;
|
|
5171
|
+
var side = mainAxisSideLookup[edge];
|
|
5172
|
+
var mainAxisHitboxSize = Math.min(
|
|
5173
|
+
// scale the size of the hitbox down for smaller elements
|
|
5174
|
+
config.startHitboxAtPercentageRemainingOfElement[edge] * clientRect[mainAxis.size],
|
|
5175
|
+
// Don't let the hitbox grow too big for big elements
|
|
5176
|
+
config.maxMainAxisHitboxSize
|
|
5177
|
+
);
|
|
5178
|
+
return DOMRect.fromRect(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, mainAxis.point, side === "start" ? (
|
|
5179
|
+
// begin from the start edge and grow inwards
|
|
5180
|
+
clientRect[mainAxis.point]
|
|
5181
|
+
) : (
|
|
5182
|
+
// begin from inside the end edge and grow towards the end edge
|
|
5183
|
+
clientRect[mainAxis.point] + clientRect[mainAxis.size] - mainAxisHitboxSize
|
|
5184
|
+
)), crossAxis.point, clientRect[crossAxis.point]), mainAxis.size, mainAxisHitboxSize), crossAxis.size, clientRect[crossAxis.size]));
|
|
5185
|
+
};
|
|
5186
|
+
}
|
|
5187
|
+
var getOverElementHitbox = {
|
|
5188
|
+
top: makeGetHitbox({
|
|
5189
|
+
axis: "vertical",
|
|
5190
|
+
edge: "top"
|
|
5191
|
+
}),
|
|
5192
|
+
right: makeGetHitbox({
|
|
5193
|
+
axis: "horizontal",
|
|
5194
|
+
edge: "right"
|
|
5195
|
+
}),
|
|
5196
|
+
bottom: makeGetHitbox({
|
|
5197
|
+
axis: "vertical",
|
|
5198
|
+
edge: "bottom"
|
|
5199
|
+
}),
|
|
5200
|
+
left: makeGetHitbox({
|
|
5201
|
+
axis: "horizontal",
|
|
5202
|
+
edge: "left"
|
|
5203
|
+
})
|
|
5204
|
+
};
|
|
5205
|
+
|
|
5206
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/get-percentage-in-range.js
|
|
5207
|
+
function getPercentageInRange(_ref) {
|
|
5208
|
+
var startOfRange = _ref.startOfRange, endOfRange = _ref.endOfRange, value = _ref.value;
|
|
5209
|
+
var isValid = startOfRange < endOfRange;
|
|
5210
|
+
if (!isValid) {
|
|
5211
|
+
return 0;
|
|
5212
|
+
}
|
|
5213
|
+
if (value < startOfRange) {
|
|
5214
|
+
return 0;
|
|
5215
|
+
}
|
|
5216
|
+
if (value > endOfRange) {
|
|
5217
|
+
return 1;
|
|
5218
|
+
}
|
|
5219
|
+
var range = endOfRange - startOfRange;
|
|
5220
|
+
return (value - startOfRange) / range;
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5223
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/get-scroll-change.js
|
|
5224
|
+
function getMaxScrollChange(_ref) {
|
|
5225
|
+
var timeSinceLastFrame = _ref.timeSinceLastFrame, config = _ref.config;
|
|
5226
|
+
var targetScrollPerMs = config.maxPixelScrollPerSecond / 1e3;
|
|
5227
|
+
var proposed = Math.ceil(targetScrollPerMs * timeSinceLastFrame);
|
|
5228
|
+
var maximum = config.maxPixelScrollPerSecond / 60;
|
|
5229
|
+
return Math.min(proposed, maximum);
|
|
5230
|
+
}
|
|
5231
|
+
function getDistanceDampening(_ref2) {
|
|
5232
|
+
var client = _ref2.client, axis = _ref2.axis, edge = _ref2.edge, hitbox = _ref2.hitbox, config = _ref2.config;
|
|
5233
|
+
var mainAxis = axisLookup[axis].mainAxis;
|
|
5234
|
+
var side = mainAxisSideLookup[edge];
|
|
5235
|
+
var maxSpeedBuffer = hitbox[mainAxis.size] * config.maxScrollAtPercentageRemainingOfHitbox[edge];
|
|
5236
|
+
if (side === "end") {
|
|
5237
|
+
return getPercentageInRange({
|
|
5238
|
+
startOfRange: hitbox[mainAxis.start],
|
|
5239
|
+
endOfRange: hitbox[mainAxis.end] - maxSpeedBuffer,
|
|
5240
|
+
value: client[mainAxis.point]
|
|
5241
|
+
});
|
|
5242
|
+
}
|
|
5243
|
+
var raw = getPercentageInRange({
|
|
5244
|
+
startOfRange: hitbox[mainAxis.start] + maxSpeedBuffer,
|
|
5245
|
+
endOfRange: hitbox[mainAxis.end],
|
|
5246
|
+
value: client[mainAxis.point]
|
|
5247
|
+
});
|
|
5248
|
+
return 1 - raw;
|
|
5249
|
+
}
|
|
5250
|
+
function getScrollChange(_ref3) {
|
|
5251
|
+
var client = _ref3.client, timeSinceLastFrame = _ref3.timeSinceLastFrame, engagement = _ref3.engagement, axis = _ref3.axis, hitbox = _ref3.hitbox, edge = _ref3.edge, isDistanceDampeningEnabled = _ref3.isDistanceDampeningEnabled, config = _ref3.config;
|
|
5252
|
+
var maxScroll = getMaxScrollChange({
|
|
5253
|
+
timeSinceLastFrame,
|
|
5254
|
+
config
|
|
5255
|
+
});
|
|
5256
|
+
var percentageDistanceDampening = isDistanceDampeningEnabled ? getDistanceDampening({
|
|
5257
|
+
client,
|
|
5258
|
+
edge,
|
|
5259
|
+
hitbox,
|
|
5260
|
+
axis,
|
|
5261
|
+
config
|
|
5262
|
+
}) : 1;
|
|
5263
|
+
var percentageThroughTimeDampening = getPercentageInRange({
|
|
5264
|
+
startOfRange: engagement.timeOfEngagementStart,
|
|
5265
|
+
endOfRange: engagement.timeOfEngagementStart + config.timeDampeningDurationMs,
|
|
5266
|
+
value: Date.now()
|
|
5267
|
+
});
|
|
5268
|
+
var percentageOfMaxScroll = percentageDistanceDampening * percentageThroughTimeDampening;
|
|
5269
|
+
var scroll = Math.max(maxScroll * percentageOfMaxScroll, 1);
|
|
5270
|
+
var side = mainAxisSideLookup[edge];
|
|
5271
|
+
return side === "end" ? scroll : -1 * scroll;
|
|
5272
|
+
}
|
|
5273
|
+
|
|
5274
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/is-axis-allowed.js
|
|
5275
|
+
function isAxisAllowed(axis, allowedAxis) {
|
|
5276
|
+
return allowedAxis === "all" || axis === allowedAxis;
|
|
5277
|
+
}
|
|
5278
|
+
|
|
5279
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/is-within.js
|
|
5280
|
+
function isWithin2(_ref) {
|
|
5281
|
+
var client = _ref.client, clientRect = _ref.clientRect;
|
|
5282
|
+
return (
|
|
5283
|
+
// is within horizontal bounds
|
|
5284
|
+
client.x >= clientRect.x && client.x <= clientRect.x + clientRect.width && // is within vertical bounds
|
|
5285
|
+
client.y >= clientRect.y && client.y <= clientRect.y + clientRect.height
|
|
5286
|
+
);
|
|
5287
|
+
}
|
|
5288
|
+
|
|
5289
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/get-scroll-by.js
|
|
5290
|
+
function getRectDefault(element) {
|
|
5291
|
+
return element.getBoundingClientRect();
|
|
5292
|
+
}
|
|
5293
|
+
function getScrollBy(_ref) {
|
|
5294
|
+
var element = _ref.element, input = _ref.input, timeSinceLastFrame = _ref.timeSinceLastFrame, engagement = _ref.engagement, config = _ref.config, allowedAxis = _ref.allowedAxis, _ref$getRect = _ref.getRect, getRect = _ref$getRect === void 0 ? getRectDefault : _ref$getRect;
|
|
5295
|
+
var client = {
|
|
5296
|
+
x: input.clientX,
|
|
5297
|
+
y: input.clientY
|
|
5298
|
+
};
|
|
5299
|
+
var clientRect = getRect(element);
|
|
5300
|
+
var scrollableEdges = edges.reduce(function(map, edge) {
|
|
5301
|
+
var hitbox = getOverElementHitbox[edge]({
|
|
5302
|
+
clientRect,
|
|
5303
|
+
config
|
|
5304
|
+
});
|
|
5305
|
+
var axis = edgeAxisLookup[edge];
|
|
5306
|
+
if (!isAxisAllowed(axis, allowedAxis)) {
|
|
5307
|
+
return map;
|
|
5308
|
+
}
|
|
5309
|
+
if (!isWithin2({
|
|
5310
|
+
client,
|
|
5311
|
+
clientRect: hitbox
|
|
5312
|
+
})) {
|
|
5313
|
+
return map;
|
|
5314
|
+
}
|
|
5315
|
+
if (!canScrollOnEdge[edge](element)) {
|
|
5316
|
+
return map;
|
|
5317
|
+
}
|
|
5318
|
+
map.set(edge, {
|
|
5319
|
+
edge,
|
|
5320
|
+
hitbox
|
|
5321
|
+
});
|
|
5322
|
+
return map;
|
|
5323
|
+
}, /* @__PURE__ */ new Map());
|
|
5324
|
+
var left2 = (function() {
|
|
5325
|
+
var axis = "horizontal";
|
|
5326
|
+
var leftEdge = scrollableEdges.get("left");
|
|
5327
|
+
if (leftEdge) {
|
|
5328
|
+
return getScrollChange({
|
|
5329
|
+
client,
|
|
5330
|
+
edge: leftEdge.edge,
|
|
5331
|
+
hitbox: leftEdge.hitbox,
|
|
5332
|
+
axis,
|
|
5333
|
+
timeSinceLastFrame,
|
|
5334
|
+
engagement,
|
|
5335
|
+
isDistanceDampeningEnabled: true,
|
|
5336
|
+
config
|
|
5337
|
+
});
|
|
5338
|
+
}
|
|
5339
|
+
var rightEdge = scrollableEdges.get("right");
|
|
5340
|
+
if (rightEdge) {
|
|
5341
|
+
return getScrollChange({
|
|
5342
|
+
client,
|
|
5343
|
+
edge: rightEdge.edge,
|
|
5344
|
+
hitbox: rightEdge.hitbox,
|
|
5345
|
+
axis,
|
|
5346
|
+
timeSinceLastFrame,
|
|
5347
|
+
engagement,
|
|
5348
|
+
isDistanceDampeningEnabled: true,
|
|
5349
|
+
config
|
|
5350
|
+
});
|
|
5351
|
+
}
|
|
5352
|
+
return 0;
|
|
5353
|
+
})();
|
|
5354
|
+
var top2 = (function() {
|
|
5355
|
+
var axis = "vertical";
|
|
5356
|
+
var bottomEdge = scrollableEdges.get("bottom");
|
|
5357
|
+
if (bottomEdge) {
|
|
5358
|
+
return getScrollChange({
|
|
5359
|
+
client,
|
|
5360
|
+
edge: bottomEdge.edge,
|
|
5361
|
+
hitbox: bottomEdge.hitbox,
|
|
5362
|
+
axis,
|
|
5363
|
+
timeSinceLastFrame,
|
|
5364
|
+
engagement,
|
|
5365
|
+
isDistanceDampeningEnabled: true,
|
|
5366
|
+
config
|
|
5367
|
+
});
|
|
5368
|
+
}
|
|
5369
|
+
var topEdge = scrollableEdges.get("top");
|
|
5370
|
+
if (topEdge) {
|
|
5371
|
+
return getScrollChange({
|
|
5372
|
+
client,
|
|
5373
|
+
edge: topEdge.edge,
|
|
5374
|
+
hitbox: topEdge.hitbox,
|
|
5375
|
+
axis,
|
|
5376
|
+
timeSinceLastFrame,
|
|
5377
|
+
engagement,
|
|
5378
|
+
isDistanceDampeningEnabled: true,
|
|
5379
|
+
config
|
|
5380
|
+
});
|
|
5381
|
+
}
|
|
5382
|
+
return 0;
|
|
5383
|
+
})();
|
|
5384
|
+
return {
|
|
5385
|
+
left: left2,
|
|
5386
|
+
top: top2
|
|
5387
|
+
};
|
|
5388
|
+
}
|
|
5389
|
+
|
|
5390
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/try-scroll.js
|
|
5391
|
+
function _createForOfIteratorHelper3(r, e) {
|
|
5392
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
5393
|
+
if (!t) {
|
|
5394
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray4(r)) || e && r && "number" == typeof r.length) {
|
|
5395
|
+
t && (r = t);
|
|
5396
|
+
var _n = 0, F = function F2() {
|
|
5397
|
+
};
|
|
5398
|
+
return { s: F, n: function n() {
|
|
5399
|
+
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
5400
|
+
}, e: function e2(r2) {
|
|
5401
|
+
throw r2;
|
|
5402
|
+
}, f: F };
|
|
5403
|
+
}
|
|
5404
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5405
|
+
}
|
|
5406
|
+
var o, a = true, u = false;
|
|
5407
|
+
return { s: function s() {
|
|
5408
|
+
t = t.call(r);
|
|
5409
|
+
}, n: function n() {
|
|
5410
|
+
var r2 = t.next();
|
|
5411
|
+
return a = r2.done, r2;
|
|
5412
|
+
}, e: function e2(r2) {
|
|
5413
|
+
u = true, o = r2;
|
|
5414
|
+
}, f: function f() {
|
|
5415
|
+
try {
|
|
5416
|
+
a || null == t.return || t.return();
|
|
5417
|
+
} finally {
|
|
5418
|
+
if (u) throw o;
|
|
5419
|
+
}
|
|
5420
|
+
} };
|
|
5421
|
+
}
|
|
5422
|
+
function _unsupportedIterableToArray4(r, a) {
|
|
5423
|
+
if (r) {
|
|
5424
|
+
if ("string" == typeof r) return _arrayLikeToArray4(r, a);
|
|
5425
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
5426
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray4(r, a) : void 0;
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
function _arrayLikeToArray4(r, a) {
|
|
5430
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5431
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
5432
|
+
return n;
|
|
5433
|
+
}
|
|
5434
|
+
function isScrollingAvailable(value) {
|
|
5435
|
+
return Boolean(value.top || value.left);
|
|
5436
|
+
}
|
|
5437
|
+
function tryScrollElements(_ref) {
|
|
5438
|
+
var _container$getConfigu, _container$getAllowed, _container$getAllowed2;
|
|
5439
|
+
var target = _ref.target, input = _ref.input, source = _ref.source, findEntry = _ref.findEntry, timeSinceLastFrame = _ref.timeSinceLastFrame, _ref$available = _ref.available, available = _ref$available === void 0 ? {
|
|
5440
|
+
top: true,
|
|
5441
|
+
left: true
|
|
5442
|
+
} : _ref$available;
|
|
5443
|
+
if (!isScrollingAvailable(available)) {
|
|
5444
|
+
return available;
|
|
5445
|
+
}
|
|
5446
|
+
if (!target) {
|
|
5447
|
+
return available;
|
|
5448
|
+
}
|
|
5449
|
+
var element = target.closest(selector);
|
|
5450
|
+
if (!element) {
|
|
5451
|
+
return available;
|
|
5452
|
+
}
|
|
5453
|
+
var container = findEntry(element);
|
|
5454
|
+
if (!container) {
|
|
5455
|
+
return available;
|
|
5456
|
+
}
|
|
5457
|
+
function continueSearchUp() {
|
|
5458
|
+
var _element$parentElemen;
|
|
5459
|
+
return tryScrollElements({
|
|
5460
|
+
target: (_element$parentElemen = element === null || element === void 0 ? void 0 : element.parentElement) !== null && _element$parentElemen !== void 0 ? _element$parentElemen : null,
|
|
5461
|
+
findEntry,
|
|
5462
|
+
source,
|
|
5463
|
+
timeSinceLastFrame,
|
|
5464
|
+
input,
|
|
5465
|
+
available
|
|
5466
|
+
});
|
|
5467
|
+
}
|
|
5468
|
+
var feedback = {
|
|
5469
|
+
input,
|
|
5470
|
+
source,
|
|
5471
|
+
element
|
|
5472
|
+
};
|
|
5473
|
+
if (container.canScroll && !container.canScroll(feedback)) {
|
|
5474
|
+
return continueSearchUp();
|
|
5475
|
+
}
|
|
5476
|
+
var engagement = markAndGetEngagement(element);
|
|
5477
|
+
var config = getInternalConfig((_container$getConfigu = container.getConfiguration) === null || _container$getConfigu === void 0 ? void 0 : _container$getConfigu.call(container, feedback));
|
|
5478
|
+
var allowedAxis = (_container$getAllowed = (_container$getAllowed2 = container.getAllowedAxis) === null || _container$getAllowed2 === void 0 ? void 0 : _container$getAllowed2.call(container, feedback)) !== null && _container$getAllowed !== void 0 ? _container$getAllowed : "all";
|
|
5479
|
+
var scrollBy = getScrollBy({
|
|
5480
|
+
element,
|
|
5481
|
+
engagement,
|
|
5482
|
+
input,
|
|
5483
|
+
timeSinceLastFrame,
|
|
5484
|
+
allowedAxis,
|
|
5485
|
+
config
|
|
5486
|
+
});
|
|
5487
|
+
var scroll = {
|
|
5488
|
+
top: 0,
|
|
5489
|
+
left: 0
|
|
5490
|
+
};
|
|
5491
|
+
if (available.top && scrollBy.top !== 0) {
|
|
5492
|
+
scroll.top = scrollBy.top;
|
|
5493
|
+
available.top = false;
|
|
5494
|
+
}
|
|
5495
|
+
if (available.left && scrollBy.left !== 0) {
|
|
5496
|
+
scroll.left = scrollBy.left;
|
|
5497
|
+
available.left = false;
|
|
5498
|
+
}
|
|
5499
|
+
if (scroll.top !== 0 || scroll.left !== 0) {
|
|
5500
|
+
element.scrollBy(scroll);
|
|
5501
|
+
}
|
|
5502
|
+
return continueSearchUp();
|
|
5503
|
+
}
|
|
5504
|
+
function tryScrollWindow(_ref2) {
|
|
5505
|
+
var input = _ref2.input, timeSinceLastFrame = _ref2.timeSinceLastFrame, available = _ref2.available, source = _ref2.source, entries = _ref2.entries;
|
|
5506
|
+
var element = document.documentElement;
|
|
5507
|
+
var feedback = {
|
|
5508
|
+
input,
|
|
5509
|
+
source,
|
|
5510
|
+
element
|
|
5511
|
+
};
|
|
5512
|
+
var _iterator = _createForOfIteratorHelper3(entries), _step;
|
|
5513
|
+
try {
|
|
5514
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
5515
|
+
var _entry$getConfigurati, _entry$getAllowedAxis, _entry$getAllowedAxis2;
|
|
5516
|
+
var entry = _step.value;
|
|
5517
|
+
if (entry.canScroll && !entry.canScroll(feedback)) {
|
|
5518
|
+
continue;
|
|
5519
|
+
}
|
|
5520
|
+
var engagement = markAndGetEngagement(element);
|
|
5521
|
+
var config = getInternalConfig((_entry$getConfigurati = entry.getConfiguration) === null || _entry$getConfigurati === void 0 ? void 0 : _entry$getConfigurati.call(entry, feedback));
|
|
5522
|
+
var allowedAxis = (_entry$getAllowedAxis = (_entry$getAllowedAxis2 = entry.getAllowedAxis) === null || _entry$getAllowedAxis2 === void 0 ? void 0 : _entry$getAllowedAxis2.call(entry, feedback)) !== null && _entry$getAllowedAxis !== void 0 ? _entry$getAllowedAxis : "all";
|
|
5523
|
+
var scrollBy = getScrollBy({
|
|
5524
|
+
element,
|
|
5525
|
+
engagement,
|
|
5526
|
+
input,
|
|
5527
|
+
config,
|
|
5528
|
+
allowedAxis,
|
|
5529
|
+
getRect: function getRect(element2) {
|
|
5530
|
+
return DOMRect.fromRect({
|
|
5531
|
+
y: 0,
|
|
5532
|
+
x: 0,
|
|
5533
|
+
width: element2.clientWidth,
|
|
5534
|
+
height: element2.clientHeight
|
|
5535
|
+
});
|
|
5536
|
+
},
|
|
5537
|
+
timeSinceLastFrame
|
|
5538
|
+
});
|
|
5539
|
+
var scroll = {
|
|
5540
|
+
top: available.top ? scrollBy.top : 0,
|
|
5541
|
+
left: available.left ? scrollBy.left : 0
|
|
5542
|
+
};
|
|
5543
|
+
if (scroll.top !== 0 || scroll.left !== 0) {
|
|
5544
|
+
element.scrollBy(scroll);
|
|
5545
|
+
}
|
|
5546
|
+
break;
|
|
5547
|
+
}
|
|
5548
|
+
} catch (err) {
|
|
5549
|
+
_iterator.e(err);
|
|
5550
|
+
} finally {
|
|
5551
|
+
_iterator.f();
|
|
3086
5552
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
5553
|
+
}
|
|
5554
|
+
function tryScroll(_ref3) {
|
|
5555
|
+
var input = _ref3.input, findEntry = _ref3.findEntry, timeSinceLastFrame = _ref3.timeSinceLastFrame, source = _ref3.source, getWindowScrollEntries = _ref3.getWindowScrollEntries, underUsersPointer = _ref3.underUsersPointer;
|
|
5556
|
+
var remainder = tryScrollElements({
|
|
5557
|
+
target: underUsersPointer,
|
|
5558
|
+
timeSinceLastFrame,
|
|
5559
|
+
input,
|
|
5560
|
+
source,
|
|
5561
|
+
findEntry
|
|
5562
|
+
});
|
|
5563
|
+
if (!isScrollingAvailable(remainder)) {
|
|
5564
|
+
return;
|
|
3094
5565
|
}
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
this.setKind(other, kind);
|
|
3123
|
-
this.renderKindWarning(which);
|
|
5566
|
+
tryScrollWindow({
|
|
5567
|
+
input,
|
|
5568
|
+
source,
|
|
5569
|
+
entries: getWindowScrollEntries(),
|
|
5570
|
+
timeSinceLastFrame,
|
|
5571
|
+
available: remainder
|
|
5572
|
+
});
|
|
5573
|
+
}
|
|
5574
|
+
|
|
5575
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/make-api.js
|
|
5576
|
+
function ownKeys5(e, r) {
|
|
5577
|
+
var t = Object.keys(e);
|
|
5578
|
+
if (Object.getOwnPropertySymbols) {
|
|
5579
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
5580
|
+
r && (o = o.filter(function(r2) {
|
|
5581
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
5582
|
+
})), t.push.apply(t, o);
|
|
5583
|
+
}
|
|
5584
|
+
return t;
|
|
5585
|
+
}
|
|
5586
|
+
function _objectSpread5(e) {
|
|
5587
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
5588
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
5589
|
+
r % 2 ? ownKeys5(Object(t), true).forEach(function(r2) {
|
|
5590
|
+
_defineProperty(e, r2, t[r2]);
|
|
5591
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys5(Object(t)).forEach(function(r2) {
|
|
5592
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
3124
5593
|
});
|
|
3125
|
-
warning.appendChild(fix);
|
|
3126
5594
|
}
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
5595
|
+
return e;
|
|
5596
|
+
}
|
|
5597
|
+
function makeApi(_ref) {
|
|
5598
|
+
var monitor = _ref.monitor;
|
|
5599
|
+
var elementRegistry = /* @__PURE__ */ new Map();
|
|
5600
|
+
var windowRegistry = /* @__PURE__ */ new Set();
|
|
5601
|
+
function autoScroll(args) {
|
|
5602
|
+
if (true) {
|
|
5603
|
+
var _window$getComputedSt = window.getComputedStyle(args.element), overflowX = _window$getComputedSt.overflowX, overflowY = _window$getComputedSt.overflowY;
|
|
5604
|
+
var isScrollable = overflowX === "auto" || overflowX === "scroll" || overflowY === "auto" || overflowY === "scroll";
|
|
5605
|
+
if (!isScrollable) {
|
|
5606
|
+
console.warn("Auto scrolling has been attached to an element that appears not to be scrollable", {
|
|
5607
|
+
element: args.element,
|
|
5608
|
+
overflowX,
|
|
5609
|
+
overflowY
|
|
5610
|
+
});
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
if (true) {
|
|
5614
|
+
var existing = elementRegistry.get(args.element);
|
|
5615
|
+
if (existing) {
|
|
5616
|
+
console.warn("You have already registered autoScrolling on the same element", {
|
|
5617
|
+
existing,
|
|
5618
|
+
proposed: args
|
|
5619
|
+
});
|
|
5620
|
+
}
|
|
5621
|
+
}
|
|
5622
|
+
elementRegistry.set(args.element, args);
|
|
5623
|
+
var cleanup = combine(addScrollableAttribute(args.element), function() {
|
|
5624
|
+
return elementRegistry.delete(args.element);
|
|
5625
|
+
});
|
|
5626
|
+
return once(cleanup);
|
|
5627
|
+
}
|
|
5628
|
+
function autoScrollWindow() {
|
|
5629
|
+
var args = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5630
|
+
var unique = _objectSpread5({}, args);
|
|
5631
|
+
windowRegistry.add(unique);
|
|
5632
|
+
function cleanup() {
|
|
5633
|
+
windowRegistry.delete(unique);
|
|
5634
|
+
}
|
|
5635
|
+
return once(cleanup);
|
|
5636
|
+
}
|
|
5637
|
+
function findEntry(element) {
|
|
5638
|
+
var _elementRegistry$get;
|
|
5639
|
+
return (_elementRegistry$get = elementRegistry.get(element)) !== null && _elementRegistry$get !== void 0 ? _elementRegistry$get : null;
|
|
5640
|
+
}
|
|
5641
|
+
function getWindowScrollEntries() {
|
|
5642
|
+
return Array.from(windowRegistry);
|
|
5643
|
+
}
|
|
5644
|
+
function onFrame(_ref2) {
|
|
5645
|
+
var latestArgs = _ref2.latestArgs, underUsersPointer = _ref2.underUsersPointer, timeSinceLastFrame = _ref2.timeSinceLastFrame;
|
|
5646
|
+
tryScroll({
|
|
5647
|
+
input: latestArgs.location.current.input,
|
|
5648
|
+
source: latestArgs.source,
|
|
5649
|
+
findEntry,
|
|
5650
|
+
underUsersPointer,
|
|
5651
|
+
timeSinceLastFrame,
|
|
5652
|
+
getWindowScrollEntries
|
|
5653
|
+
});
|
|
3133
5654
|
}
|
|
5655
|
+
getScheduler(monitor).onFrame(onFrame);
|
|
5656
|
+
return {
|
|
5657
|
+
autoScroll,
|
|
5658
|
+
autoScrollWindow
|
|
5659
|
+
};
|
|
3134
5660
|
}
|
|
3135
5661
|
|
|
5662
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/entry-point/element.js
|
|
5663
|
+
var api = makeApi({
|
|
5664
|
+
monitor: monitorForElements
|
|
5665
|
+
});
|
|
5666
|
+
var autoScrollForElements = api.autoScroll;
|
|
5667
|
+
var autoScrollWindowForElements = api.autoScrollWindow;
|
|
5668
|
+
|
|
3136
5669
|
// src/editor-reconcile.ts
|
|
3137
5670
|
function tokenOf(unit) {
|
|
3138
5671
|
return unidOf(unit.id) + (unit.sig ? "|" + unit.sig : "");
|
|
@@ -3172,15 +5705,32 @@ var Docxodus = (() => {
|
|
|
3172
5705
|
const bar = token.indexOf("|");
|
|
3173
5706
|
return bar < 0 ? token : token.slice(0, bar);
|
|
3174
5707
|
};
|
|
3175
|
-
const
|
|
5708
|
+
const moved = [];
|
|
3176
5709
|
const usedRemoved = /* @__PURE__ */ new Set();
|
|
5710
|
+
const usedAdded = /* @__PURE__ */ new Set();
|
|
5711
|
+
const removedByToken = /* @__PURE__ */ new Map();
|
|
5712
|
+
for (const oi of removed) {
|
|
5713
|
+
(removedByToken.get(oldUnids[oi]) ?? removedByToken.set(oldUnids[oi], []).get(oldUnids[oi])).push(oi);
|
|
5714
|
+
}
|
|
5715
|
+
for (const nj of added) {
|
|
5716
|
+
const candidates = removedByToken.get(newUnids[nj]);
|
|
5717
|
+
const oi = candidates?.find((i2) => !usedRemoved.has(i2));
|
|
5718
|
+
if (oi !== void 0) {
|
|
5719
|
+
moved.push({ oldIndex: oi, newIndex: nj });
|
|
5720
|
+
usedRemoved.add(oi);
|
|
5721
|
+
usedAdded.add(nj);
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
const substituted = [];
|
|
3177
5725
|
const removedByUnid = /* @__PURE__ */ new Map();
|
|
3178
5726
|
for (const oi of removed) {
|
|
5727
|
+
if (usedRemoved.has(oi)) continue;
|
|
3179
5728
|
const u = bareUnid(oldUnids[oi]);
|
|
3180
5729
|
(removedByUnid.get(u) ?? removedByUnid.set(u, []).get(u)).push(oi);
|
|
3181
5730
|
}
|
|
3182
5731
|
const unmatchedAdded = [];
|
|
3183
5732
|
for (const nj of added) {
|
|
5733
|
+
if (usedAdded.has(nj)) continue;
|
|
3184
5734
|
const candidates = removedByUnid.get(bareUnid(newUnids[nj]));
|
|
3185
5735
|
const oi = candidates?.find((i2) => !usedRemoved.has(i2));
|
|
3186
5736
|
if (oi !== void 0) {
|
|
@@ -3211,7 +5761,7 @@ var Docxodus = (() => {
|
|
|
3211
5761
|
}
|
|
3212
5762
|
}
|
|
3213
5763
|
}
|
|
3214
|
-
return { keep, removed, added, substituted };
|
|
5764
|
+
return { keep, removed, added, substituted, moved };
|
|
3215
5765
|
}
|
|
3216
5766
|
function needsRemount(diff, newUnits, oldKinds, threshold = 40) {
|
|
3217
5767
|
if (diff.added.length + diff.removed.length > threshold) return true;
|
|
@@ -3228,6 +5778,46 @@ var Docxodus = (() => {
|
|
|
3228
5778
|
|
|
3229
5779
|
// src/editor.ts
|
|
3230
5780
|
var EDITABLE_TAGS = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6"]);
|
|
5781
|
+
var BLOCK_DRAG_TYPE = "docxodus-block";
|
|
5782
|
+
var blockDragStyledDocuments = /* @__PURE__ */ new WeakSet();
|
|
5783
|
+
function ensureBlockDragStyles(doc) {
|
|
5784
|
+
if (blockDragStyledDocuments.has(doc)) return;
|
|
5785
|
+
blockDragStyledDocuments.add(doc);
|
|
5786
|
+
const style = doc.createElement("style");
|
|
5787
|
+
style.dataset.docxodusBlockDrag = "true";
|
|
5788
|
+
style.textContent = `
|
|
5789
|
+
.docx-block-handle {
|
|
5790
|
+
position: fixed; z-index: 2147483000; display: none; width: 26px; height: 28px;
|
|
5791
|
+
align-items: center; justify-content: center; padding: 0; border: 1px solid #d0d5dd;
|
|
5792
|
+
border-radius: 6px; background: #fff; color: #667085; box-shadow: 0 1px 3px rgba(16,24,40,.12);
|
|
5793
|
+
cursor: grab; font: 700 17px/1 system-ui, sans-serif; user-select: none; touch-action: none;
|
|
5794
|
+
}
|
|
5795
|
+
.docx-block-handle:hover, .docx-block-handle:focus-visible { color: #344054; border-color: #98a2b3; outline: none; }
|
|
5796
|
+
.docx-block-handle[aria-pressed="true"] { color: #175cd3; border-color: #84adff; background: #eff8ff; }
|
|
5797
|
+
.docx-block-handle.docx-block-dragging { cursor: grabbing; opacity: .78; }
|
|
5798
|
+
.docx-block-drop-indicator {
|
|
5799
|
+
position: fixed; z-index: 2147482999; display: none; height: 3px; pointer-events: none;
|
|
5800
|
+
border-radius: 999px; background: #2e90fa; box-shadow: 0 0 0 1px rgba(255,255,255,.85);
|
|
5801
|
+
}
|
|
5802
|
+
.docx-block-move-menu {
|
|
5803
|
+
position: fixed; z-index: 2147483001; display: none; min-width: 150px; padding: 5px;
|
|
5804
|
+
border: 1px solid #d0d5dd; border-radius: 8px; background: #fff;
|
|
5805
|
+
box-shadow: 0 8px 24px rgba(16,24,40,.18); font: 13px/1.35 system-ui, sans-serif;
|
|
5806
|
+
}
|
|
5807
|
+
.docx-block-move-menu button { display: block; width: 100%; padding: 7px 9px; border: 0; border-radius: 5px; background: transparent; color: #344054; text-align: left; }
|
|
5808
|
+
.docx-block-move-menu button:hover, .docx-block-move-menu button:focus-visible { background: #f2f4f7; outline: none; }
|
|
5809
|
+
.docx-block-move-menu button:disabled { color: #98a2b3; background: transparent; }
|
|
5810
|
+
.docx-block-move-flash { animation: docx-block-move-flash 800ms ease-out; }
|
|
5811
|
+
@keyframes docx-block-move-flash { from { box-shadow: 0 0 0 3px rgba(46,144,250,.55); } to { box-shadow: none; } }
|
|
5812
|
+
.docx-block-live-region { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
5813
|
+
`;
|
|
5814
|
+
(doc.head ?? doc.documentElement).appendChild(style);
|
|
5815
|
+
}
|
|
5816
|
+
function trackedChangeWireName(mode) {
|
|
5817
|
+
if (mode === 1 /* RenderInline */) return "render_inline";
|
|
5818
|
+
if (mode === 2 /* StripDeletions */) return "strip_deletions";
|
|
5819
|
+
return "accept";
|
|
5820
|
+
}
|
|
3231
5821
|
function fontWeightIsBold(w) {
|
|
3232
5822
|
if (w === "bold" || w === "bolder") return true;
|
|
3233
5823
|
const n = parseInt(w, 10);
|
|
@@ -3375,9 +5965,9 @@ var Docxodus = (() => {
|
|
|
3375
5965
|
}
|
|
3376
5966
|
function trimmedSpan(block, span) {
|
|
3377
5967
|
const { leading, trimmedLen } = trimBounds(block);
|
|
3378
|
-
const
|
|
3379
|
-
const end = Math.max(
|
|
3380
|
-
return { start, length: end -
|
|
5968
|
+
const start2 = Math.max(0, Math.min(span.start - Math.min(span.start, leading), trimmedLen));
|
|
5969
|
+
const end = Math.max(start2, Math.min(span.start + span.length - leading, trimmedLen));
|
|
5970
|
+
return { start: start2, length: end - start2 };
|
|
3381
5971
|
}
|
|
3382
5972
|
function contentPositionIn(el, offset) {
|
|
3383
5973
|
let remaining = offset;
|
|
@@ -3420,9 +6010,9 @@ var Docxodus = (() => {
|
|
|
3420
6010
|
probe.collapse(true);
|
|
3421
6011
|
const focusIsBefore = probe.comparePoint(focus.node, focus.offset) < 0;
|
|
3422
6012
|
const range = document.createRange();
|
|
3423
|
-
const
|
|
6013
|
+
const start2 = focusIsBefore ? focus : anchor;
|
|
3424
6014
|
const end = focusIsBefore ? anchor : focus;
|
|
3425
|
-
range.setStart(
|
|
6015
|
+
range.setStart(start2.node, start2.offset);
|
|
3426
6016
|
range.setEnd(end.node, end.offset);
|
|
3427
6017
|
sel.removeAllRanges();
|
|
3428
6018
|
sel.addRange(range);
|
|
@@ -3470,17 +6060,17 @@ var Docxodus = (() => {
|
|
|
3470
6060
|
const range = sel.getRangeAt(0);
|
|
3471
6061
|
if (range.collapsed) return null;
|
|
3472
6062
|
if (!block.contains(range.startContainer) || !block.contains(range.endContainer)) return null;
|
|
3473
|
-
const
|
|
6063
|
+
const start2 = contentOffsetOf(block, range.startContainer, range.startOffset);
|
|
3474
6064
|
const end = contentOffsetOf(block, range.endContainer, range.endOffset);
|
|
3475
|
-
const span = trimmedSpan(block, { start: Math.min(
|
|
6065
|
+
const span = trimmedSpan(block, { start: Math.min(start2, end), length: Math.abs(end - start2) });
|
|
3476
6066
|
return span.length > 0 ? span : null;
|
|
3477
6067
|
}
|
|
3478
|
-
function selectRange(el,
|
|
6068
|
+
function selectRange(el, start2, length) {
|
|
3479
6069
|
const sel = typeof window !== "undefined" ? window.getSelection() : null;
|
|
3480
6070
|
if (!sel || !el.isConnected) return;
|
|
3481
6071
|
el.focus();
|
|
3482
6072
|
const range = document.createRange();
|
|
3483
|
-
const end =
|
|
6073
|
+
const end = start2 + length;
|
|
3484
6074
|
let pos = 0;
|
|
3485
6075
|
let startSet = false;
|
|
3486
6076
|
const walk = (node) => {
|
|
@@ -3489,8 +6079,8 @@ var Docxodus = (() => {
|
|
|
3489
6079
|
if (isInMarker(child)) continue;
|
|
3490
6080
|
const raw = child.textContent ?? "";
|
|
3491
6081
|
const len = stripBidi(raw).length;
|
|
3492
|
-
if (!startSet && pos + len >=
|
|
3493
|
-
range.setStart(child, domOffsetForContentOffset(raw,
|
|
6082
|
+
if (!startSet && pos + len >= start2) {
|
|
6083
|
+
range.setStart(child, domOffsetForContentOffset(raw, start2 - pos));
|
|
3494
6084
|
startSet = true;
|
|
3495
6085
|
}
|
|
3496
6086
|
if (startSet && pos + len >= end) {
|
|
@@ -3541,7 +6131,7 @@ var Docxodus = (() => {
|
|
|
3541
6131
|
return false;
|
|
3542
6132
|
}
|
|
3543
6133
|
}
|
|
3544
|
-
function completeArgs(bytes, cssPrefix, fabricate, paginated, scale) {
|
|
6134
|
+
function completeArgs(bytes, cssPrefix, fabricate, paginated, scale, renderTrackedChanges) {
|
|
3545
6135
|
return [
|
|
3546
6136
|
bytes,
|
|
3547
6137
|
"Document",
|
|
@@ -3565,7 +6155,7 @@ var Docxodus = (() => {
|
|
|
3565
6155
|
true,
|
|
3566
6156
|
/* renderHeadersAndFooters */
|
|
3567
6157
|
paginated,
|
|
3568
|
-
|
|
6158
|
+
renderTrackedChanges,
|
|
3569
6159
|
true,
|
|
3570
6160
|
true,
|
|
3571
6161
|
false,
|
|
@@ -3588,6 +6178,27 @@ var Docxodus = (() => {
|
|
|
3588
6178
|
* structural edit (split/merge/format) is lost. While this flag is set, commitBlock no-ops.
|
|
3589
6179
|
*/
|
|
3590
6180
|
this.replacing = false;
|
|
6181
|
+
/** Editor-owned block-move chrome. It is deliberately outside the rendered unit tree. */
|
|
6182
|
+
this.blockDragHandle = null;
|
|
6183
|
+
this.blockDropIndicator = null;
|
|
6184
|
+
this.blockMoveMenu = null;
|
|
6185
|
+
this.blockMoveLive = null;
|
|
6186
|
+
this.blockDragSource = null;
|
|
6187
|
+
this.blockDragCleanup = [];
|
|
6188
|
+
this.blockDragTargetCleanup = [];
|
|
6189
|
+
this.blockDragging = false;
|
|
6190
|
+
this.blockDragPointerDown = false;
|
|
6191
|
+
/** Anchors the current drag source may legally move next to, per the engine's own rules.
|
|
6192
|
+
* Null when the bridge predates ValidMoveTargets — then every block is offered, as before. */
|
|
6193
|
+
this.blockMoveTargets = null;
|
|
6194
|
+
/** Memoized `ValidMoveTargets` answers, keyed by source anchor and dropped whenever an edit
|
|
6195
|
+
* lands. The legal-target set is a property of the document, so hovering back and forth over
|
|
6196
|
+
* the same blocks between edits must not re-ask the engine. */
|
|
6197
|
+
this.blockMoveTargetCache = /* @__PURE__ */ new Map();
|
|
6198
|
+
/** Cancels the pending idle prefetch of the hovered block's targets — see `showBlockHandle`. */
|
|
6199
|
+
this.blockMoveTargetPrefetch = null;
|
|
6200
|
+
/** Why the last move was refused, verbatim from the engine — diagnostics, not announcement copy. */
|
|
6201
|
+
this.lastMoveError = null;
|
|
3591
6202
|
/**
|
|
3592
6203
|
* The last real (non-collapsed) text selection inside an editable block. A toolbar control that
|
|
3593
6204
|
* must take focus to be used — the font-size combobox — blurs the block and collapses the live
|
|
@@ -3744,8 +6355,8 @@ var Docxodus = (() => {
|
|
|
3744
6355
|
* body edit root by design — also register. The fence still rejects other editors on the page. */
|
|
3745
6356
|
editableBlockOf(node) {
|
|
3746
6357
|
if (!node) return null;
|
|
3747
|
-
const
|
|
3748
|
-
const block =
|
|
6358
|
+
const start2 = node.nodeType === 1 ? node : node.parentElement;
|
|
6359
|
+
const block = start2?.closest('[data-anchor][contenteditable="true"]') ?? null;
|
|
3749
6360
|
return block && this.container.contains(block) ? block : null;
|
|
3750
6361
|
}
|
|
3751
6362
|
/**
|
|
@@ -3786,18 +6397,34 @@ var Docxodus = (() => {
|
|
|
3786
6397
|
paginated: options.paginated ?? false,
|
|
3787
6398
|
scale: options.scale ?? 1,
|
|
3788
6399
|
headerFooter: options.headerFooter ?? false,
|
|
3789
|
-
|
|
6400
|
+
blockDrag: options.blockDrag ?? false,
|
|
6401
|
+
trackedChanges: options.trackedChanges ?? 0 /* Accept */,
|
|
6402
|
+
revisionAuthor: options.revisionAuthor ?? "docxodus",
|
|
6403
|
+
onEdit: options.onEdit,
|
|
6404
|
+
onMove: options.onMove
|
|
3790
6405
|
};
|
|
3791
|
-
const handle = exports.DocxSessionBridge.OpenSession(bytes,
|
|
6406
|
+
const handle = exports.DocxSessionBridge.OpenSession(bytes, JSON.stringify({
|
|
6407
|
+
emitMarkdownPatch: false,
|
|
6408
|
+
trackedChanges: trackedChangeWireName(opts.trackedChanges),
|
|
6409
|
+
revisionAuthor: opts.revisionAuthor
|
|
6410
|
+
}));
|
|
3792
6411
|
const editor = new _DocxEditor(container, exports, handle, opts);
|
|
3793
6412
|
editor.refreshAnchorMap();
|
|
3794
6413
|
if (opts.headerFooter) editor.createRegion();
|
|
3795
6414
|
const fullHtml = exports.DocumentConverter.ConvertDocxToHtmlComplete(
|
|
3796
|
-
...completeArgs(
|
|
6415
|
+
...completeArgs(
|
|
6416
|
+
bytes,
|
|
6417
|
+
opts.cssPrefix,
|
|
6418
|
+
opts.fabricateClasses,
|
|
6419
|
+
opts.paginated,
|
|
6420
|
+
opts.scale,
|
|
6421
|
+
opts.trackedChanges === 1 /* RenderInline */
|
|
6422
|
+
)
|
|
3797
6423
|
);
|
|
3798
6424
|
if (opts.paginated) editor.mountPaginated(fullHtml);
|
|
3799
6425
|
else editor.mountHtml(fullHtml);
|
|
3800
6426
|
editor.syncRegionToBody();
|
|
6427
|
+
editor.setupBlockDrag();
|
|
3801
6428
|
return editor;
|
|
3802
6429
|
}
|
|
3803
6430
|
/**
|
|
@@ -3824,6 +6451,7 @@ var Docxodus = (() => {
|
|
|
3824
6451
|
document.removeEventListener("mouseup", this.onMouseUp, true);
|
|
3825
6452
|
}
|
|
3826
6453
|
this.clearDragSelection();
|
|
6454
|
+
this.teardownBlockDrag();
|
|
3827
6455
|
this.exports.DocxSessionBridge.CloseSession(this.handle);
|
|
3828
6456
|
}
|
|
3829
6457
|
/**
|
|
@@ -3851,6 +6479,457 @@ var Docxodus = (() => {
|
|
|
3851
6479
|
get sessionHandle() {
|
|
3852
6480
|
return this.handle;
|
|
3853
6481
|
}
|
|
6482
|
+
/** Move one top-level body block relative to another and repaint from the live session. */
|
|
6483
|
+
moveBlock(sourceAnchorId, targetAnchorId, position) {
|
|
6484
|
+
this.assertOpen();
|
|
6485
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
6486
|
+
if (typeof bridge.MoveBlock !== "function") return false;
|
|
6487
|
+
const res = this.parseEdit(
|
|
6488
|
+
bridge.MoveBlock(this.handle, sourceAnchorId, targetAnchorId, position)
|
|
6489
|
+
);
|
|
6490
|
+
if (!res.success) {
|
|
6491
|
+
this.lastMoveError = res.error?.message ?? null;
|
|
6492
|
+
this.announceBlockMove("This block cannot be moved there.");
|
|
6493
|
+
return false;
|
|
6494
|
+
}
|
|
6495
|
+
if ((res.created?.length ?? 0) === 0 && (res.modified?.length ?? 0) === 0 && (res.removed?.length ?? 0) === 0) {
|
|
6496
|
+
this.announceBlockMove("The block is already in that position.");
|
|
6497
|
+
return true;
|
|
6498
|
+
}
|
|
6499
|
+
const destination = res.created?.[0] ?? res.modified?.[0];
|
|
6500
|
+
this.reconcile();
|
|
6501
|
+
const moved = destination ? this.bodyUnitNodes().find((el) => el.getAttribute("data-anchor") === destination.unid) : null;
|
|
6502
|
+
if (moved) {
|
|
6503
|
+
moved.classList.add("docx-block-move-flash");
|
|
6504
|
+
moved.addEventListener("animationend", () => moved.classList.remove("docx-block-move-flash"), {
|
|
6505
|
+
once: true
|
|
6506
|
+
});
|
|
6507
|
+
const focusTarget = EDITABLE_TAGS.has(moved.tagName) ? moved : moved.querySelector('[data-anchor][contenteditable="true"]');
|
|
6508
|
+
if (focusTarget) {
|
|
6509
|
+
this.activeBlock = focusTarget;
|
|
6510
|
+
focusTarget.focus({ preventScroll: true });
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
this.options.onMove?.({
|
|
6514
|
+
sourceAnchorId,
|
|
6515
|
+
destinationAnchorId: destination?.id ?? sourceAnchorId
|
|
6516
|
+
});
|
|
6517
|
+
this.announceBlockMove("Block moved.");
|
|
6518
|
+
return true;
|
|
6519
|
+
}
|
|
6520
|
+
/** Resolve any rendered descendant to its top-level body move unit (tables stay whole). */
|
|
6521
|
+
blockUnitOf(target) {
|
|
6522
|
+
const node = target instanceof Node ? target : null;
|
|
6523
|
+
const el = node?.nodeType === Node.ELEMENT_NODE ? node : node?.parentElement;
|
|
6524
|
+
if (!el || !this.editRoot.contains(el)) return null;
|
|
6525
|
+
let unit = null;
|
|
6526
|
+
for (let candidate = el.closest("[data-anchor]"); candidate && this.editRoot.contains(candidate); candidate = candidate.parentElement?.closest("[data-anchor]") ?? null) {
|
|
6527
|
+
unit = candidate;
|
|
6528
|
+
}
|
|
6529
|
+
if (!unit || unit.closest("section.footnotes, section.endnotes")) return null;
|
|
6530
|
+
return unit;
|
|
6531
|
+
}
|
|
6532
|
+
isMovableBlockUnit(unit) {
|
|
6533
|
+
if (!unit || !this.anchorIdOf(unit)) return false;
|
|
6534
|
+
if (unit.matches("[class$='row-del'], [class*='row-del ']") || unit.querySelector("tr[class$='row-del'], tr[class*='row-del '], del[class$='move-from'], del[class*='move-from ']")) return false;
|
|
6535
|
+
return unit.tagName === "TABLE" || EDITABLE_TAGS.has(unit.tagName);
|
|
6536
|
+
}
|
|
6537
|
+
currentBlockDragSource() {
|
|
6538
|
+
if (this.isMovableBlockUnit(this.blockDragSource) && this.blockDragSource.isConnected)
|
|
6539
|
+
return this.blockDragSource;
|
|
6540
|
+
const fromActive = this.blockUnitOf(this.activeBlock);
|
|
6541
|
+
if (this.isMovableBlockUnit(fromActive)) {
|
|
6542
|
+
this.blockDragSource = fromActive;
|
|
6543
|
+
return fromActive;
|
|
6544
|
+
}
|
|
6545
|
+
return null;
|
|
6546
|
+
}
|
|
6547
|
+
showBlockHandle(unit) {
|
|
6548
|
+
const handle = this.blockDragHandle;
|
|
6549
|
+
if (!handle || !this.isMovableBlockUnit(unit)) return;
|
|
6550
|
+
const changed = unit !== this.blockDragSource;
|
|
6551
|
+
this.blockDragSource = unit;
|
|
6552
|
+
const known = this.blockMoveTargetsFor(unit, { cachedOnly: true });
|
|
6553
|
+
if (known?.size === 0) {
|
|
6554
|
+
handle.style.display = "none";
|
|
6555
|
+
return;
|
|
6556
|
+
}
|
|
6557
|
+
if (changed && known === void 0) this.prefetchBlockMoveTargets(unit);
|
|
6558
|
+
const rect = unit.getBoundingClientRect();
|
|
6559
|
+
handle.style.display = "flex";
|
|
6560
|
+
handle.style.left = `${Math.max(4, rect.left - 32)}px`;
|
|
6561
|
+
handle.style.top = `${Math.max(4, rect.top + (unit.tagName === "TABLE" ? 6 : Math.max(0, (rect.height - 28) / 2)))}px`;
|
|
6562
|
+
const preview = (unit.textContent ?? "").trim().replace(/\s+/g, " ").slice(0, 48);
|
|
6563
|
+
handle.setAttribute("aria-label", preview ? `Move block: ${preview}` : "Move block");
|
|
6564
|
+
}
|
|
6565
|
+
hideBlockHandle() {
|
|
6566
|
+
if (this.blockDragging || this.blockMoveMenu?.style.display === "block") return;
|
|
6567
|
+
if (this.blockDragHandle) this.blockDragHandle.style.display = "none";
|
|
6568
|
+
}
|
|
6569
|
+
positionBlockHandle() {
|
|
6570
|
+
const source = this.currentBlockDragSource();
|
|
6571
|
+
if (source && this.blockDragHandle?.style.display !== "none") this.showBlockHandle(source);
|
|
6572
|
+
}
|
|
6573
|
+
showDropIndicator(target, position) {
|
|
6574
|
+
const indicator = this.blockDropIndicator;
|
|
6575
|
+
if (!indicator) return;
|
|
6576
|
+
const rect = this.unitWrapperOf(target).getBoundingClientRect();
|
|
6577
|
+
indicator.style.display = "block";
|
|
6578
|
+
indicator.style.left = `${rect.left}px`;
|
|
6579
|
+
indicator.style.top = `${position === "before" ? rect.top - 1 : rect.bottom - 1}px`;
|
|
6580
|
+
indicator.style.width = `${Math.max(24, rect.width)}px`;
|
|
6581
|
+
}
|
|
6582
|
+
hideDropIndicator() {
|
|
6583
|
+
if (this.blockDropIndicator) this.blockDropIndicator.style.display = "none";
|
|
6584
|
+
}
|
|
6585
|
+
announceBlockMove(message) {
|
|
6586
|
+
const live = this.blockMoveLive;
|
|
6587
|
+
if (!live) return;
|
|
6588
|
+
live.textContent = "";
|
|
6589
|
+
this.container.ownerDocument.defaultView?.setTimeout(() => {
|
|
6590
|
+
live.textContent = message;
|
|
6591
|
+
}, 0);
|
|
6592
|
+
}
|
|
6593
|
+
/**
|
|
6594
|
+
* Ask the engine which anchors the current source may move next to. One call per drag source,
|
|
6595
|
+
* so the UI offers only drops MoveBlock will accept — a document with section breaks is
|
|
6596
|
+
* partitioned into regions, and drawing an indicator across one only to fail the drop was the
|
|
6597
|
+
* behaviour this replaces. Null (no bridge support) keeps the previous offer-everything path.
|
|
6598
|
+
*/
|
|
6599
|
+
refreshBlockMoveTargets(source) {
|
|
6600
|
+
this.blockMoveTargets = source ? this.blockMoveTargetsFor(source) ?? null : null;
|
|
6601
|
+
}
|
|
6602
|
+
/**
|
|
6603
|
+
* This block's legal destinations, from the memo when it is there. Returns `undefined` — not
|
|
6604
|
+
* `null` — for "not asked yet", so a caller can tell an unknown answer from the engine's
|
|
6605
|
+
* "no bridge support, offer everything" one.
|
|
6606
|
+
*/
|
|
6607
|
+
blockMoveTargetsFor(source, options = {}) {
|
|
6608
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
6609
|
+
const sourceId = this.anchorIdOf(source);
|
|
6610
|
+
if (!sourceId || typeof bridge.ValidMoveTargets !== "function") return null;
|
|
6611
|
+
if (this.blockMoveTargetCache.has(sourceId)) return this.blockMoveTargetCache.get(sourceId);
|
|
6612
|
+
if (options.cachedOnly) return void 0;
|
|
6613
|
+
let targets;
|
|
6614
|
+
try {
|
|
6615
|
+
const parsed = JSON.parse(bridge.ValidMoveTargets(this.handle, sourceId));
|
|
6616
|
+
targets = new Map(parsed.map((t) => [t.anchorId, { before: t.before, after: t.after }]));
|
|
6617
|
+
} catch {
|
|
6618
|
+
targets = null;
|
|
6619
|
+
}
|
|
6620
|
+
this.blockMoveTargetCache.set(sourceId, targets);
|
|
6621
|
+
return targets;
|
|
6622
|
+
}
|
|
6623
|
+
/**
|
|
6624
|
+
* Ask for the hovered block's destinations off the interaction path, and hide the handle if
|
|
6625
|
+
* the answer comes back empty and that block is still the one under the pointer. The handle
|
|
6626
|
+
* therefore appears immediately on hover and withdraws a beat later on the rare immovable
|
|
6627
|
+
* block, instead of every hover paying for the query up front.
|
|
6628
|
+
*/
|
|
6629
|
+
prefetchBlockMoveTargets(source) {
|
|
6630
|
+
const view = this.container.ownerDocument.defaultView;
|
|
6631
|
+
if (!view) return;
|
|
6632
|
+
this.blockMoveTargetPrefetch?.();
|
|
6633
|
+
const run = () => {
|
|
6634
|
+
this.blockMoveTargetPrefetch = null;
|
|
6635
|
+
if (this.closed || !source.isConnected || this.blockDragSource !== source) return;
|
|
6636
|
+
if (this.blockMoveTargetsFor(source)?.size === 0 && this.blockDragHandle)
|
|
6637
|
+
this.blockDragHandle.style.display = "none";
|
|
6638
|
+
};
|
|
6639
|
+
const idle = view;
|
|
6640
|
+
if (idle.requestIdleCallback && idle.cancelIdleCallback) {
|
|
6641
|
+
const id = idle.requestIdleCallback(run, { timeout: 500 });
|
|
6642
|
+
this.blockMoveTargetPrefetch = () => idle.cancelIdleCallback(id);
|
|
6643
|
+
} else {
|
|
6644
|
+
const id = view.setTimeout(run, 0);
|
|
6645
|
+
this.blockMoveTargetPrefetch = () => view.clearTimeout(id);
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
/**
|
|
6649
|
+
* Whether `unit` is a legal destination for the current drag source — for a SPECIFIC side when
|
|
6650
|
+
* one is given. A cross-block range or a section break between the blocks can make one side
|
|
6651
|
+
* legal and the other not, so "this target is reachable" is not enough to pick a position.
|
|
6652
|
+
*/
|
|
6653
|
+
isValidMoveTarget(unit, position) {
|
|
6654
|
+
if (!this.blockMoveTargets) return true;
|
|
6655
|
+
const id = this.anchorIdOf(unit);
|
|
6656
|
+
const sides = id ? this.blockMoveTargets.get(id) : void 0;
|
|
6657
|
+
if (!sides) return false;
|
|
6658
|
+
return position ? sides[position] : sides.before || sides.after;
|
|
6659
|
+
}
|
|
6660
|
+
/**
|
|
6661
|
+
* The side of `unit` a drop at `clientY` should land on: the half the pointer is in, snapped to
|
|
6662
|
+
* the other side when only that one is legal. Snapping rather than refusing keeps a reachable
|
|
6663
|
+
* target usable — the illegal side is usually illegal only because a section break or a
|
|
6664
|
+
* cross-block range sits between the two blocks on that side.
|
|
6665
|
+
*/
|
|
6666
|
+
dropPositionFor(unit, clientY) {
|
|
6667
|
+
const rect = unit.getBoundingClientRect();
|
|
6668
|
+
const preferred = clientY < rect.top + rect.height / 2 ? "before" : "after";
|
|
6669
|
+
if (this.isValidMoveTarget(unit, preferred)) return preferred;
|
|
6670
|
+
const other = preferred === "before" ? "after" : "before";
|
|
6671
|
+
return this.isValidMoveTarget(unit, other) ? other : preferred;
|
|
6672
|
+
}
|
|
6673
|
+
refreshBlockDropTargets() {
|
|
6674
|
+
for (const cleanup of this.blockDragTargetCleanup.splice(0)) cleanup();
|
|
6675
|
+
if (!this.blockDragHandle || this.options.paginated) return;
|
|
6676
|
+
for (const unit of this.bodyUnitNodes().filter((el) => this.isMovableBlockUnit(el))) {
|
|
6677
|
+
this.blockDragTargetCleanup.push(dropTargetForElements({
|
|
6678
|
+
element: unit,
|
|
6679
|
+
// A target the engine would refuse is not a drop target at all, so Pragmatic never
|
|
6680
|
+
// fires onDragEnter for it and no indicator is drawn over it.
|
|
6681
|
+
canDrop: ({ source }) => source.data.type === BLOCK_DRAG_TYPE && source.data.sourceAnchorId !== this.anchorIdOf(unit) && this.isValidMoveTarget(unit),
|
|
6682
|
+
getData: ({ input }) => ({
|
|
6683
|
+
type: BLOCK_DRAG_TYPE,
|
|
6684
|
+
targetAnchorId: this.anchorIdOf(unit),
|
|
6685
|
+
position: this.dropPositionFor(unit, input.clientY),
|
|
6686
|
+
targetElement: unit
|
|
6687
|
+
}),
|
|
6688
|
+
onDragEnter: ({ self }) => {
|
|
6689
|
+
const pos = self.data.position === "after" ? "after" : "before";
|
|
6690
|
+
this.showDropIndicator(unit, pos);
|
|
6691
|
+
},
|
|
6692
|
+
onDrag: ({ self }) => {
|
|
6693
|
+
const pos = self.data.position === "after" ? "after" : "before";
|
|
6694
|
+
this.showDropIndicator(unit, pos);
|
|
6695
|
+
},
|
|
6696
|
+
onDragLeave: () => this.hideDropIndicator()
|
|
6697
|
+
}));
|
|
6698
|
+
}
|
|
6699
|
+
}
|
|
6700
|
+
closeBlockMoveMenu(restoreFocus = false) {
|
|
6701
|
+
if (!this.blockMoveMenu || !this.blockDragHandle) return;
|
|
6702
|
+
this.blockMoveMenu.style.display = "none";
|
|
6703
|
+
this.blockDragHandle.setAttribute("aria-expanded", "false");
|
|
6704
|
+
this.blockDragHandle.setAttribute("aria-pressed", "false");
|
|
6705
|
+
if (restoreFocus) this.blockDragHandle.focus({ preventScroll: true });
|
|
6706
|
+
}
|
|
6707
|
+
openBlockMoveMenu() {
|
|
6708
|
+
const menu = this.blockMoveMenu;
|
|
6709
|
+
const handle = this.blockDragHandle;
|
|
6710
|
+
const source = this.currentBlockDragSource();
|
|
6711
|
+
if (!menu || !handle || !source) return;
|
|
6712
|
+
this.refreshBlockMoveTargets(source);
|
|
6713
|
+
menu.querySelectorAll("button[data-move]").forEach((button) => {
|
|
6714
|
+
button.disabled = !this.blockMoveDestination(source, button.dataset.move ?? "");
|
|
6715
|
+
});
|
|
6716
|
+
const rect = handle.getBoundingClientRect();
|
|
6717
|
+
menu.style.display = "block";
|
|
6718
|
+
menu.style.left = `${Math.max(4, rect.right + 6)}px`;
|
|
6719
|
+
menu.style.top = `${Math.max(4, rect.top)}px`;
|
|
6720
|
+
handle.setAttribute("aria-expanded", "true");
|
|
6721
|
+
handle.setAttribute("aria-pressed", "true");
|
|
6722
|
+
menu.querySelector("button:not(:disabled)")?.focus({ preventScroll: true });
|
|
6723
|
+
}
|
|
6724
|
+
/**
|
|
6725
|
+
* Resolve a move-menu action to the block it should land against, considering only destinations
|
|
6726
|
+
* the engine accepts. "Top"/"bottom" therefore mean the ends of the source's own movable region
|
|
6727
|
+
* — on a document with section breaks that is the section, not the document, which is what makes
|
|
6728
|
+
* the commands work at all there instead of always failing.
|
|
6729
|
+
*/
|
|
6730
|
+
blockMoveDestination(source, action) {
|
|
6731
|
+
const units = this.bodyUnitNodes().filter((el) => this.isMovableBlockUnit(el));
|
|
6732
|
+
const index = units.indexOf(source);
|
|
6733
|
+
if (index < 0) return null;
|
|
6734
|
+
const position = action === "up" || action === "top" ? "before" : "after";
|
|
6735
|
+
const side = position === "before" ? units.slice(0, index) : units.slice(index + 1);
|
|
6736
|
+
const candidates = side.filter((el) => this.isValidMoveTarget(el, position));
|
|
6737
|
+
if (candidates.length === 0) return null;
|
|
6738
|
+
if (action === "up") return { target: candidates[candidates.length - 1], position };
|
|
6739
|
+
if (action === "down") return { target: candidates[0], position };
|
|
6740
|
+
if (action === "top") return { target: candidates[0], position };
|
|
6741
|
+
if (action === "bottom") return { target: candidates[candidates.length - 1], position };
|
|
6742
|
+
return null;
|
|
6743
|
+
}
|
|
6744
|
+
runBlockMoveMenuAction(action) {
|
|
6745
|
+
const source = this.currentBlockDragSource();
|
|
6746
|
+
if (!source) return;
|
|
6747
|
+
const destination = this.blockMoveDestination(source, action);
|
|
6748
|
+
this.closeBlockMoveMenu();
|
|
6749
|
+
if (!destination) return;
|
|
6750
|
+
const sourceId = this.anchorIdOf(source);
|
|
6751
|
+
const targetId = this.anchorIdOf(destination.target);
|
|
6752
|
+
if (sourceId && targetId) this.moveBlock(sourceId, targetId, destination.position);
|
|
6753
|
+
}
|
|
6754
|
+
/** The nearest ancestor that actually scrolls the document flow, for drag autoscroll. */
|
|
6755
|
+
scrollContainer() {
|
|
6756
|
+
const view = this.container.ownerDocument.defaultView;
|
|
6757
|
+
for (let el = this.editRoot; el; el = el.parentElement) {
|
|
6758
|
+
const overflowY = view?.getComputedStyle(el).overflowY ?? "visible";
|
|
6759
|
+
if ((overflowY === "auto" || overflowY === "scroll") && el.scrollHeight > el.clientHeight)
|
|
6760
|
+
return el;
|
|
6761
|
+
}
|
|
6762
|
+
return null;
|
|
6763
|
+
}
|
|
6764
|
+
/** Mount one floating handle; PDD owns pointer dragging while the menu owns keyboard moves. */
|
|
6765
|
+
setupBlockDrag() {
|
|
6766
|
+
if (!this.options.blockDrag || this.options.paginated || this.closed || this.blockDragHandle)
|
|
6767
|
+
return;
|
|
6768
|
+
const doc = this.container.ownerDocument;
|
|
6769
|
+
ensureBlockDragStyles(doc);
|
|
6770
|
+
const handle = doc.createElement("div");
|
|
6771
|
+
handle.className = "docx-block-handle";
|
|
6772
|
+
handle.textContent = "\u283F";
|
|
6773
|
+
handle.tabIndex = 0;
|
|
6774
|
+
handle.setAttribute("role", "button");
|
|
6775
|
+
handle.setAttribute("contenteditable", "false");
|
|
6776
|
+
handle.setAttribute("aria-haspopup", "menu");
|
|
6777
|
+
handle.setAttribute("aria-expanded", "false");
|
|
6778
|
+
handle.setAttribute("aria-pressed", "false");
|
|
6779
|
+
const indicator = doc.createElement("div");
|
|
6780
|
+
indicator.className = "docx-block-drop-indicator";
|
|
6781
|
+
const menu = doc.createElement("div");
|
|
6782
|
+
menu.className = "docx-block-move-menu";
|
|
6783
|
+
menu.setAttribute("role", "menu");
|
|
6784
|
+
menu.innerHTML = `
|
|
6785
|
+
<button type="button" role="menuitem" data-move="up">Move up</button>
|
|
6786
|
+
<button type="button" role="menuitem" data-move="down">Move down</button>
|
|
6787
|
+
<button type="button" role="menuitem" data-move="top">Move to top</button>
|
|
6788
|
+
<button type="button" role="menuitem" data-move="bottom">Move to bottom</button>`;
|
|
6789
|
+
const live = doc.createElement("div");
|
|
6790
|
+
live.className = "docx-block-live-region";
|
|
6791
|
+
live.setAttribute("role", "status");
|
|
6792
|
+
live.setAttribute("aria-live", "polite");
|
|
6793
|
+
this.container.append(handle, indicator, menu, live);
|
|
6794
|
+
this.blockDragHandle = handle;
|
|
6795
|
+
this.blockDropIndicator = indicator;
|
|
6796
|
+
this.blockMoveMenu = menu;
|
|
6797
|
+
this.blockMoveLive = live;
|
|
6798
|
+
const onPointerMove = (event) => {
|
|
6799
|
+
if (this.blockDragging || this.blockDragPointerDown) return;
|
|
6800
|
+
const unit = this.blockUnitOf(event.target);
|
|
6801
|
+
if (this.isMovableBlockUnit(unit)) this.showBlockHandle(unit);
|
|
6802
|
+
};
|
|
6803
|
+
const onFocusIn = (event) => {
|
|
6804
|
+
const unit = this.blockUnitOf(event.target);
|
|
6805
|
+
if (this.isMovableBlockUnit(unit)) this.showBlockHandle(unit);
|
|
6806
|
+
};
|
|
6807
|
+
const onPointerLeave = (event) => {
|
|
6808
|
+
const next = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
6809
|
+
if (next && (handle.contains(next) || menu.contains(next))) return;
|
|
6810
|
+
this.hideBlockHandle();
|
|
6811
|
+
};
|
|
6812
|
+
const onViewportChange = () => this.positionBlockHandle();
|
|
6813
|
+
this.container.addEventListener("pointermove", onPointerMove);
|
|
6814
|
+
this.container.addEventListener("focusin", onFocusIn);
|
|
6815
|
+
this.container.addEventListener("pointerleave", onPointerLeave);
|
|
6816
|
+
doc.addEventListener("scroll", onViewportChange, true);
|
|
6817
|
+
doc.defaultView?.addEventListener("resize", onViewportChange);
|
|
6818
|
+
this.blockDragCleanup.push(
|
|
6819
|
+
() => this.container.removeEventListener("pointermove", onPointerMove),
|
|
6820
|
+
() => this.container.removeEventListener("focusin", onFocusIn),
|
|
6821
|
+
() => this.container.removeEventListener("pointerleave", onPointerLeave),
|
|
6822
|
+
() => doc.removeEventListener("scroll", onViewportChange, true),
|
|
6823
|
+
() => doc.defaultView?.removeEventListener("resize", onViewportChange)
|
|
6824
|
+
);
|
|
6825
|
+
const onHandleClick = () => {
|
|
6826
|
+
if (menu.style.display === "block") this.closeBlockMoveMenu();
|
|
6827
|
+
else this.openBlockMoveMenu();
|
|
6828
|
+
};
|
|
6829
|
+
const onHandlePointerDown = () => {
|
|
6830
|
+
this.blockDragPointerDown = true;
|
|
6831
|
+
};
|
|
6832
|
+
const onPointerUp = () => {
|
|
6833
|
+
this.blockDragPointerDown = false;
|
|
6834
|
+
};
|
|
6835
|
+
const onHandleKeydown = (event) => {
|
|
6836
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
6837
|
+
event.preventDefault();
|
|
6838
|
+
onHandleClick();
|
|
6839
|
+
};
|
|
6840
|
+
const onMenuClick = (event) => {
|
|
6841
|
+
const button = event.target?.closest("button[data-move]");
|
|
6842
|
+
if (button && !button.disabled) this.runBlockMoveMenuAction(button.dataset.move ?? "");
|
|
6843
|
+
};
|
|
6844
|
+
const onMenuKeydown = (event) => {
|
|
6845
|
+
if (event.key === "Escape") {
|
|
6846
|
+
event.preventDefault();
|
|
6847
|
+
this.closeBlockMoveMenu(true);
|
|
6848
|
+
}
|
|
6849
|
+
};
|
|
6850
|
+
handle.addEventListener("click", onHandleClick);
|
|
6851
|
+
handle.addEventListener("pointerdown", onHandlePointerDown);
|
|
6852
|
+
handle.addEventListener("keydown", onHandleKeydown);
|
|
6853
|
+
menu.addEventListener("click", onMenuClick);
|
|
6854
|
+
menu.addEventListener("keydown", onMenuKeydown);
|
|
6855
|
+
doc.addEventListener("pointerup", onPointerUp, true);
|
|
6856
|
+
doc.addEventListener("pointercancel", onPointerUp, true);
|
|
6857
|
+
this.blockDragCleanup.push(
|
|
6858
|
+
() => handle.removeEventListener("click", onHandleClick),
|
|
6859
|
+
() => handle.removeEventListener("pointerdown", onHandlePointerDown),
|
|
6860
|
+
() => handle.removeEventListener("keydown", onHandleKeydown),
|
|
6861
|
+
() => menu.removeEventListener("click", onMenuClick),
|
|
6862
|
+
() => menu.removeEventListener("keydown", onMenuKeydown),
|
|
6863
|
+
() => doc.removeEventListener("pointerup", onPointerUp, true),
|
|
6864
|
+
() => doc.removeEventListener("pointercancel", onPointerUp, true)
|
|
6865
|
+
);
|
|
6866
|
+
this.blockDragCleanup.push(draggable({
|
|
6867
|
+
element: handle,
|
|
6868
|
+
canDrag: () => !!this.currentBlockDragSource(),
|
|
6869
|
+
getInitialData: () => {
|
|
6870
|
+
const source = this.currentBlockDragSource();
|
|
6871
|
+
return { type: BLOCK_DRAG_TYPE, sourceAnchorId: source ? this.anchorIdOf(source) : void 0 };
|
|
6872
|
+
},
|
|
6873
|
+
onDragStart: () => {
|
|
6874
|
+
this.blockDragging = true;
|
|
6875
|
+
handle.classList.add("docx-block-dragging");
|
|
6876
|
+
this.closeBlockMoveMenu();
|
|
6877
|
+
this.refreshBlockMoveTargets(this.currentBlockDragSource());
|
|
6878
|
+
this.refreshBlockDropTargets();
|
|
6879
|
+
},
|
|
6880
|
+
onDrop: () => {
|
|
6881
|
+
this.blockDragging = false;
|
|
6882
|
+
this.blockDragPointerDown = false;
|
|
6883
|
+
handle.classList.remove("docx-block-dragging");
|
|
6884
|
+
this.hideDropIndicator();
|
|
6885
|
+
}
|
|
6886
|
+
}));
|
|
6887
|
+
this.blockDragCleanup.push(monitorForElements({
|
|
6888
|
+
canMonitor: ({ source }) => source.data.type === BLOCK_DRAG_TYPE,
|
|
6889
|
+
onDrop: ({ source, location: location2 }) => {
|
|
6890
|
+
this.hideDropIndicator();
|
|
6891
|
+
const drop = location2.current.dropTargets[0]?.data;
|
|
6892
|
+
const sourceId = source.data.sourceAnchorId;
|
|
6893
|
+
const targetId = drop?.targetAnchorId;
|
|
6894
|
+
const position = drop?.position === "after" ? "after" : "before";
|
|
6895
|
+
if (typeof sourceId === "string" && typeof targetId === "string")
|
|
6896
|
+
this.moveBlock(sourceId, targetId, position);
|
|
6897
|
+
else
|
|
6898
|
+
this.announceBlockMove("Move cancelled \u2014 the block was not dropped on a valid position.");
|
|
6899
|
+
}
|
|
6900
|
+
}));
|
|
6901
|
+
const scroller = this.scrollContainer();
|
|
6902
|
+
if (scroller) {
|
|
6903
|
+
this.blockDragCleanup.push(autoScrollForElements({
|
|
6904
|
+
element: scroller,
|
|
6905
|
+
canScroll: ({ source }) => source.data.type === BLOCK_DRAG_TYPE,
|
|
6906
|
+
getAllowedAxis: () => "vertical"
|
|
6907
|
+
}));
|
|
6908
|
+
}
|
|
6909
|
+
this.blockDragCleanup.push(autoScrollWindowForElements({
|
|
6910
|
+
canScroll: ({ source }) => source.data.type === BLOCK_DRAG_TYPE,
|
|
6911
|
+
getAllowedAxis: () => "vertical"
|
|
6912
|
+
}));
|
|
6913
|
+
this.refreshBlockDropTargets();
|
|
6914
|
+
}
|
|
6915
|
+
teardownBlockDrag() {
|
|
6916
|
+
this.blockMoveTargetPrefetch?.();
|
|
6917
|
+
this.blockMoveTargetPrefetch = null;
|
|
6918
|
+
this.blockMoveTargetCache.clear();
|
|
6919
|
+
for (const cleanup of this.blockDragTargetCleanup.splice(0)) cleanup();
|
|
6920
|
+
for (const cleanup of this.blockDragCleanup.splice(0)) cleanup();
|
|
6921
|
+
this.blockDragHandle?.remove();
|
|
6922
|
+
this.blockDropIndicator?.remove();
|
|
6923
|
+
this.blockMoveMenu?.remove();
|
|
6924
|
+
this.blockMoveLive?.remove();
|
|
6925
|
+
this.blockDragHandle = null;
|
|
6926
|
+
this.blockDropIndicator = null;
|
|
6927
|
+
this.blockMoveMenu = null;
|
|
6928
|
+
this.blockMoveLive = null;
|
|
6929
|
+
this.blockDragSource = null;
|
|
6930
|
+
this.blockDragging = false;
|
|
6931
|
+
this.blockDragPointerDown = false;
|
|
6932
|
+
}
|
|
3854
6933
|
// ─── internals ───────────────────────────────────────────────────────
|
|
3855
6934
|
assertOpen() {
|
|
3856
6935
|
if (this.closed) throw new Error("DocxEditor is closed");
|
|
@@ -3972,6 +7051,10 @@ var Docxodus = (() => {
|
|
|
3972
7051
|
}
|
|
3973
7052
|
wireBlock(el) {
|
|
3974
7053
|
if (!EDITABLE_TAGS.has(el.tagName)) return;
|
|
7054
|
+
if (el.closest("tr[class$='row-del'], tr[class*='row-del ']") || el.querySelector(":scope > del[class$='move-from'], :scope > del[class*='move-from ']")) {
|
|
7055
|
+
el.setAttribute("contenteditable", "false");
|
|
7056
|
+
return;
|
|
7057
|
+
}
|
|
3975
7058
|
const unid = el.getAttribute("data-anchor");
|
|
3976
7059
|
if (!unid || !this.anchorIdOf(el)) return;
|
|
3977
7060
|
el.setAttribute("contenteditable", "true");
|
|
@@ -4033,12 +7116,7 @@ var Docxodus = (() => {
|
|
|
4033
7116
|
this.options.onEdit?.({ anchorId: newAnchor, unid: newUnid });
|
|
4034
7117
|
return;
|
|
4035
7118
|
}
|
|
4036
|
-
const html = this.
|
|
4037
|
-
this.handle,
|
|
4038
|
-
newAnchor,
|
|
4039
|
-
this.options.cssPrefix,
|
|
4040
|
-
this.options.fabricateClasses
|
|
4041
|
-
);
|
|
7119
|
+
const html = this.renderBlockHtml(newAnchor);
|
|
4042
7120
|
if (html.charCodeAt(0) !== 123) {
|
|
4043
7121
|
const fresh = new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
4044
7122
|
const inBand = this.isBandBlock(el);
|
|
@@ -4079,9 +7157,10 @@ var Docxodus = (() => {
|
|
|
4079
7157
|
}
|
|
4080
7158
|
}
|
|
4081
7159
|
const inTableCell = !!el.closest("table");
|
|
4082
|
-
if (ev.key === "Tab") {
|
|
7160
|
+
if (ev.key === "Tab" && !ev.ctrlKey && !ev.metaKey && !ev.altKey && !ev.isComposing) {
|
|
4083
7161
|
if (inTableCell) {
|
|
4084
7162
|
ev.preventDefault();
|
|
7163
|
+
this.navigateTableCell(el, ev.shiftKey);
|
|
4085
7164
|
return;
|
|
4086
7165
|
}
|
|
4087
7166
|
if (isListBlock(el)) {
|
|
@@ -4110,6 +7189,42 @@ var Docxodus = (() => {
|
|
|
4110
7189
|
}
|
|
4111
7190
|
}
|
|
4112
7191
|
}
|
|
7192
|
+
/** Editable cells in visual document order, excluding cells from any nested table. */
|
|
7193
|
+
tableCellsFor(el) {
|
|
7194
|
+
const cell = el.closest("td, th");
|
|
7195
|
+
const table = cell?.closest("table");
|
|
7196
|
+
if (!cell || !table) return null;
|
|
7197
|
+
const cells = Array.from(table.querySelectorAll("td, th")).filter((candidate) => candidate.closest("table") === table);
|
|
7198
|
+
const index = cells.indexOf(cell);
|
|
7199
|
+
return index >= 0 ? { cells, index } : null;
|
|
7200
|
+
}
|
|
7201
|
+
/** First addressable paragraph in a cell, fenced against nested-table descendants. */
|
|
7202
|
+
editableInCell(cell) {
|
|
7203
|
+
return Array.from(
|
|
7204
|
+
cell.querySelectorAll('[data-anchor][contenteditable="true"]')
|
|
7205
|
+
).find((block) => block.closest("td, th") === cell) ?? null;
|
|
7206
|
+
}
|
|
7207
|
+
/** Word-style cell navigation: Shift+Tab goes back, Tab goes forward, and Tab at the
|
|
7208
|
+
* final cell appends a row before entering its first cell. The first cell is a hard
|
|
7209
|
+
* boundary for Shift+Tab so focus never leaks out of the editor table. */
|
|
7210
|
+
navigateTableCell(el, backwards) {
|
|
7211
|
+
const state = this.tableCellsFor(el);
|
|
7212
|
+
if (!state) return;
|
|
7213
|
+
const adjacent = state.cells[state.index + (backwards ? -1 : 1)];
|
|
7214
|
+
if (adjacent) {
|
|
7215
|
+
const target2 = this.editableInCell(adjacent);
|
|
7216
|
+
if (target2) placeCaretAtOffset(target2, 0);
|
|
7217
|
+
return;
|
|
7218
|
+
}
|
|
7219
|
+
if (backwards) return;
|
|
7220
|
+
this.activeBlock = el;
|
|
7221
|
+
this.insertTableRow("below");
|
|
7222
|
+
const fresh = this.activeBlock ? this.tableCellsFor(this.activeBlock) : null;
|
|
7223
|
+
if (!fresh) return;
|
|
7224
|
+
const target = fresh.cells[fresh.index + 1];
|
|
7225
|
+
const block = target ? this.editableInCell(target) : null;
|
|
7226
|
+
if (block) placeCaretAtOffset(block, 0);
|
|
7227
|
+
}
|
|
4113
7228
|
/** Shift+Enter: insert an intra-paragraph line break at the caret. Delegates to the
|
|
4114
7229
|
* native `insertLineBreak` command, which inserts a <br> AND positions the caret
|
|
4115
7230
|
* after it correctly (handling the browser's bogus trailing-<br> rule) so typing
|
|
@@ -4219,21 +7334,21 @@ var Docxodus = (() => {
|
|
|
4219
7334
|
while (p < minLen && old[p] === next[p]) p++;
|
|
4220
7335
|
let s = 0;
|
|
4221
7336
|
while (s < minLen - p && old[old.length - 1 - s] === next[next.length - 1 - s]) s++;
|
|
4222
|
-
let
|
|
7337
|
+
let start2 = p;
|
|
4223
7338
|
let len = old.length - p - s;
|
|
4224
7339
|
let middle = next.slice(p, next.length - s);
|
|
4225
7340
|
if (len === 0) {
|
|
4226
|
-
if (
|
|
4227
|
-
|
|
7341
|
+
if (start2 > 0) {
|
|
7342
|
+
start2 -= 1;
|
|
4228
7343
|
len = 1;
|
|
4229
|
-
middle = old[
|
|
7344
|
+
middle = old[start2] + middle;
|
|
4230
7345
|
} else {
|
|
4231
7346
|
len = 1;
|
|
4232
7347
|
middle = middle + old[0];
|
|
4233
7348
|
}
|
|
4234
7349
|
}
|
|
4235
7350
|
return this.parseEdit(
|
|
4236
|
-
this.exports.DocxSessionBridge.ReplaceTextAtSpan(this.handle, fullId,
|
|
7351
|
+
this.exports.DocxSessionBridge.ReplaceTextAtSpan(this.handle, fullId, start2, len, middle)
|
|
4237
7352
|
);
|
|
4238
7353
|
}
|
|
4239
7354
|
/** Flush a block's current (uncommitted) text to the session; returns the live full id. */
|
|
@@ -4245,14 +7360,34 @@ var Docxodus = (() => {
|
|
|
4245
7360
|
}
|
|
4246
7361
|
/** Render a block by anchor and parse it into a detached element (null on error). */
|
|
4247
7362
|
renderInto(anchorId) {
|
|
4248
|
-
const html = this.
|
|
7363
|
+
const html = this.renderBlockHtml(anchorId);
|
|
7364
|
+
if (html.charCodeAt(0) === 123) return null;
|
|
7365
|
+
return new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
7366
|
+
}
|
|
7367
|
+
get renderTrackedChanges() {
|
|
7368
|
+
return this.options.trackedChanges === 1 /* RenderInline */;
|
|
7369
|
+
}
|
|
7370
|
+
renderBlockHtml(anchorId) {
|
|
7371
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
7372
|
+
if (typeof bridge.RenderBlockHtmlForReview === "function") {
|
|
7373
|
+
return bridge.RenderBlockHtmlForReview(
|
|
7374
|
+
this.handle,
|
|
7375
|
+
anchorId,
|
|
7376
|
+
this.options.cssPrefix,
|
|
7377
|
+
this.options.fabricateClasses,
|
|
7378
|
+
this.renderTrackedChanges
|
|
7379
|
+
);
|
|
7380
|
+
}
|
|
7381
|
+
return bridge.RenderBlockHtml(
|
|
4249
7382
|
this.handle,
|
|
4250
7383
|
anchorId,
|
|
4251
7384
|
this.options.cssPrefix,
|
|
4252
7385
|
this.options.fabricateClasses
|
|
4253
7386
|
);
|
|
4254
|
-
|
|
4255
|
-
|
|
7387
|
+
}
|
|
7388
|
+
renderPlanJson() {
|
|
7389
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
7390
|
+
return typeof bridge.ListRenderedBlocks === "function" ? bridge.ListRenderedBlocks(this.handle, this.renderTrackedChanges) : bridge.ListBlocks(this.handle);
|
|
4256
7391
|
}
|
|
4257
7392
|
/** Render two blocks in ONE batched bridge call when the bundle carries RenderBlocksHtml —
|
|
4258
7393
|
* the per-render shell/converter setup is paid once instead of twice, which matters on the
|
|
@@ -4263,14 +7398,20 @@ var Docxodus = (() => {
|
|
|
4263
7398
|
const bridge = this.exports.DocxSessionBridge;
|
|
4264
7399
|
if (typeof bridge.RenderBlocksHtml === "function") {
|
|
4265
7400
|
try {
|
|
4266
|
-
const
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
7401
|
+
const idsJson = JSON.stringify([a, b]);
|
|
7402
|
+
const json = typeof bridge.RenderBlocksHtmlForReview === "function" ? bridge.RenderBlocksHtmlForReview(
|
|
7403
|
+
this.handle,
|
|
7404
|
+
idsJson,
|
|
7405
|
+
this.options.cssPrefix,
|
|
7406
|
+
this.options.fabricateClasses,
|
|
7407
|
+
this.renderTrackedChanges
|
|
7408
|
+
) : bridge.RenderBlocksHtml(
|
|
7409
|
+
this.handle,
|
|
7410
|
+
idsJson,
|
|
7411
|
+
this.options.cssPrefix,
|
|
7412
|
+
this.options.fabricateClasses
|
|
4273
7413
|
);
|
|
7414
|
+
const map = JSON.parse(json);
|
|
4274
7415
|
if (!map.error) {
|
|
4275
7416
|
const parse = (h) => h ? new DOMParser().parseFromString(h, "text/html").body.firstElementChild : null;
|
|
4276
7417
|
const fa = parse(map[a]);
|
|
@@ -4292,11 +7433,22 @@ var Docxodus = (() => {
|
|
|
4292
7433
|
}
|
|
4293
7434
|
parseEdit(json) {
|
|
4294
7435
|
try {
|
|
4295
|
-
|
|
7436
|
+
const result = JSON.parse(json);
|
|
7437
|
+
if (result.success) this.invalidateBlockMoveTargets();
|
|
7438
|
+
return result;
|
|
4296
7439
|
} catch {
|
|
4297
7440
|
return { success: false };
|
|
4298
7441
|
}
|
|
4299
7442
|
}
|
|
7443
|
+
/**
|
|
7444
|
+
* Drop the memoized `ValidMoveTargets` answers. Which blocks a block may move next to is a
|
|
7445
|
+
* fact about the DOCUMENT, so it survives hovering but not editing — and the two places a
|
|
7446
|
+
* document changes are `parseEdit` (every mutation that returns an `EditResult`) and
|
|
7447
|
+
* undo/redo, which return a bare boolean and so cannot go through it.
|
|
7448
|
+
*/
|
|
7449
|
+
invalidateBlockMoveTargets() {
|
|
7450
|
+
this.blockMoveTargetCache.clear();
|
|
7451
|
+
}
|
|
4300
7452
|
// ─── M5: formatting commands (ribbon) ────────────────────────────────
|
|
4301
7453
|
// ─── Multi-block selection helpers (format a whole stack of paragraphs at once) ──────
|
|
4302
7454
|
/**
|
|
@@ -4313,9 +7465,9 @@ var Docxodus = (() => {
|
|
|
4313
7465
|
const first = all.find((block) => block.getAttribute("data-anchor") === bookmark.startUnid);
|
|
4314
7466
|
const last = all.find((block) => block.getAttribute("data-anchor") === bookmark.endUnid);
|
|
4315
7467
|
if (!first || !last || first === last || all.indexOf(first) > all.indexOf(last)) return false;
|
|
4316
|
-
const
|
|
7468
|
+
const start2 = contentPositionIn(first, bookmark.startOffset);
|
|
4317
7469
|
const end = contentPositionIn(last, bookmark.endOffset);
|
|
4318
|
-
return setSelectionBetween(
|
|
7470
|
+
return setSelectionBetween(start2, end);
|
|
4319
7471
|
}
|
|
4320
7472
|
/** Editable blocks the current selection covers, in document order. Uses Range.comparePoint
|
|
4321
7473
|
* (robust to a selection boundary that normalized onto a wrapper element rather than a block
|
|
@@ -4358,8 +7510,8 @@ var Docxodus = (() => {
|
|
|
4358
7510
|
if (hasStart && hasEnd) return selectionSpanIn(block);
|
|
4359
7511
|
const contentLen = blockContentText(block).length;
|
|
4360
7512
|
if (hasStart) {
|
|
4361
|
-
const
|
|
4362
|
-
return trimmedSpan(block, { start, length: Math.max(0, contentLen -
|
|
7513
|
+
const start2 = contentOffsetOf(block, range.startContainer, range.startOffset);
|
|
7514
|
+
return trimmedSpan(block, { start: start2, length: Math.max(0, contentLen - start2) });
|
|
4363
7515
|
}
|
|
4364
7516
|
if (hasEnd) {
|
|
4365
7517
|
const end = contentOffsetOf(block, range.endContainer, range.endOffset);
|
|
@@ -4850,12 +8002,16 @@ var Docxodus = (() => {
|
|
|
4850
8002
|
/** Undo the last edit (incremental repaint; falls back to a full re-render). */
|
|
4851
8003
|
undo() {
|
|
4852
8004
|
if (this.closed) return;
|
|
4853
|
-
if (this.exports.DocxSessionBridge.Undo(this.handle))
|
|
8005
|
+
if (!this.exports.DocxSessionBridge.Undo(this.handle)) return;
|
|
8006
|
+
this.invalidateBlockMoveTargets();
|
|
8007
|
+
this.reconcile();
|
|
4854
8008
|
}
|
|
4855
8009
|
/** Redo the last undone edit (incremental repaint; falls back to a full re-render). */
|
|
4856
8010
|
redo() {
|
|
4857
8011
|
if (this.closed) return;
|
|
4858
|
-
if (this.exports.DocxSessionBridge.Redo(this.handle))
|
|
8012
|
+
if (!this.exports.DocxSessionBridge.Redo(this.handle)) return;
|
|
8013
|
+
this.invalidateBlockMoveTargets();
|
|
8014
|
+
this.reconcile();
|
|
4859
8015
|
}
|
|
4860
8016
|
// ─── Header/footer region commands (no-ops unless `headerFooter` is on) ───────────────
|
|
4861
8017
|
/**
|
|
@@ -4954,6 +8110,17 @@ var Docxodus = (() => {
|
|
|
4954
8110
|
*/
|
|
4955
8111
|
renderFullHtml() {
|
|
4956
8112
|
const bridge = this.exports.DocxSessionBridge;
|
|
8113
|
+
if (typeof bridge.RenderHtmlForReview === "function") {
|
|
8114
|
+
const html = bridge.RenderHtmlForReview(
|
|
8115
|
+
this.handle,
|
|
8116
|
+
this.options.cssPrefix,
|
|
8117
|
+
this.options.fabricateClasses,
|
|
8118
|
+
this.options.paginated,
|
|
8119
|
+
this.options.scale,
|
|
8120
|
+
this.renderTrackedChanges
|
|
8121
|
+
);
|
|
8122
|
+
if (html.charCodeAt(0) !== 123) return html;
|
|
8123
|
+
}
|
|
4957
8124
|
if (typeof bridge.RenderHtml === "function") {
|
|
4958
8125
|
const html = bridge.RenderHtml(
|
|
4959
8126
|
this.handle,
|
|
@@ -4966,7 +8133,14 @@ var Docxodus = (() => {
|
|
|
4966
8133
|
}
|
|
4967
8134
|
const bytes = typeof bridge.SaveWithAnchorIds === "function" ? bridge.SaveWithAnchorIds(this.handle) : bridge.Save(this.handle);
|
|
4968
8135
|
return this.exports.DocumentConverter.ConvertDocxToHtmlComplete(
|
|
4969
|
-
...completeArgs(
|
|
8136
|
+
...completeArgs(
|
|
8137
|
+
bytes,
|
|
8138
|
+
this.options.cssPrefix,
|
|
8139
|
+
this.options.fabricateClasses,
|
|
8140
|
+
this.options.paginated,
|
|
8141
|
+
this.options.scale,
|
|
8142
|
+
this.renderTrackedChanges
|
|
8143
|
+
)
|
|
4970
8144
|
);
|
|
4971
8145
|
}
|
|
4972
8146
|
/** Editable BODY blocks in document order (band blocks are enumerated by `ownerRoot`). */
|
|
@@ -5060,29 +8234,40 @@ var Docxodus = (() => {
|
|
|
5060
8234
|
reconcileCore() {
|
|
5061
8235
|
const bridge = this.exports.DocxSessionBridge;
|
|
5062
8236
|
this.refreshAnchorMap();
|
|
5063
|
-
const plan = JSON.parse(
|
|
8237
|
+
const plan = JSON.parse(this.renderPlanJson());
|
|
5064
8238
|
if (plan.error) return this.bail(`plan error: ${plan.error}`);
|
|
5065
8239
|
const oldNodes = this.bodyUnitNodes();
|
|
5066
8240
|
const oldTokens = oldNodes.map(_DocxEditor.domTokenOf);
|
|
5067
8241
|
const oldKinds = oldNodes.map(_DocxEditor.domKindOf);
|
|
5068
8242
|
const bodyDiff = diffUnits(oldTokens, plan.body);
|
|
5069
|
-
if (needsRemount(bodyDiff, plan.body, oldKinds))
|
|
8243
|
+
if (needsRemount(bodyDiff, plan.body, oldKinds)) {
|
|
8244
|
+
return this.bail(
|
|
8245
|
+
`needsRemount (li change or churn): +${bodyDiff.added.length} -${bodyDiff.removed.length} ~${bodyDiff.substituted.length} moved=${bodyDiff.moved.length} of ${plan.body.length}`
|
|
8246
|
+
);
|
|
8247
|
+
}
|
|
5070
8248
|
const fnState = this.notesDiff("footnotes", plan.footnotes);
|
|
5071
8249
|
const enState = this.notesDiff("endnotes", plan.endnotes);
|
|
5072
8250
|
if (fnState === null || enState === null) return this.bail("notes container unstampable/missing");
|
|
5073
|
-
const
|
|
8251
|
+
const movedBodyNew = new Set(bodyDiff.moved.map((m) => m.newIndex));
|
|
8252
|
+
const addedBodyIds = bodyDiff.added.filter((j) => !movedBodyNew.has(j)).map((j) => plan.body[j].id);
|
|
5074
8253
|
const addedNoteIds = fnState.diff.added.map((j) => plan.footnotes[j].id).concat(enState.diff.added.map((j) => plan.endnotes[j].id));
|
|
5075
8254
|
const allIds = addedBodyIds.concat(addedNoteIds);
|
|
5076
8255
|
let rendered = {};
|
|
5077
8256
|
if (allIds.length > 0) {
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
8257
|
+
const idsJson = JSON.stringify(allIds);
|
|
8258
|
+
const renderedJson = typeof bridge.RenderBlocksHtmlForReview === "function" ? bridge.RenderBlocksHtmlForReview(
|
|
8259
|
+
this.handle,
|
|
8260
|
+
idsJson,
|
|
8261
|
+
this.options.cssPrefix,
|
|
8262
|
+
this.options.fabricateClasses,
|
|
8263
|
+
this.renderTrackedChanges
|
|
8264
|
+
) : bridge.RenderBlocksHtml(
|
|
8265
|
+
this.handle,
|
|
8266
|
+
idsJson,
|
|
8267
|
+
this.options.cssPrefix,
|
|
8268
|
+
this.options.fabricateClasses
|
|
5085
8269
|
);
|
|
8270
|
+
rendered = JSON.parse(renderedJson);
|
|
5086
8271
|
if (rendered.error) return this.bail(`render error: ${rendered.error}`);
|
|
5087
8272
|
for (const id of allIds) if (!rendered[id]) return this.bail(`unrenderable: ${id}`);
|
|
5088
8273
|
}
|
|
@@ -5092,7 +8277,7 @@ var Docxodus = (() => {
|
|
|
5092
8277
|
return el;
|
|
5093
8278
|
};
|
|
5094
8279
|
const freshBody = /* @__PURE__ */ new Map();
|
|
5095
|
-
for (const j of bodyDiff.added) {
|
|
8280
|
+
for (const j of bodyDiff.added.filter((j2) => !movedBodyNew.has(j2))) {
|
|
5096
8281
|
const el = parse(rendered[plan.body[j].id]);
|
|
5097
8282
|
if (!el) return this.bail(`unparseable render: ${plan.body[j].id}`);
|
|
5098
8283
|
freshBody.set(j, el);
|
|
@@ -5142,13 +8327,6 @@ var Docxodus = (() => {
|
|
|
5142
8327
|
* bail-reason string (parent ambiguity, order violation, wrapper semantics) — the
|
|
5143
8328
|
* session is already correct, so bailing just means a full repaint. */
|
|
5144
8329
|
applyBodyDiff(oldNodes, units, diff, fresh) {
|
|
5145
|
-
let lastOld = -1;
|
|
5146
|
-
for (let j = 0; j < units.length; j++) {
|
|
5147
|
-
const oi = diff.keep.get(j);
|
|
5148
|
-
if (oi === void 0) continue;
|
|
5149
|
-
if (oi < lastOld) return "kept order violation";
|
|
5150
|
-
lastOld = oi;
|
|
5151
|
-
}
|
|
5152
8330
|
const subOldByNew = new Map(diff.substituted.map((s) => [s.newIndex, s.oldIndex]));
|
|
5153
8331
|
for (const [nj, oi] of subOldByNew) {
|
|
5154
8332
|
const freshRoot = fresh.get(nj);
|
|
@@ -5164,13 +8342,18 @@ var Docxodus = (() => {
|
|
|
5164
8342
|
}
|
|
5165
8343
|
this.wireUnit(freshRoot, units[nj]);
|
|
5166
8344
|
}
|
|
5167
|
-
const
|
|
8345
|
+
const movedOldByNew = new Map(diff.moved.map((m) => [m.newIndex, m.oldIndex]));
|
|
8346
|
+
const movedNew = new Set(diff.moved.map((m) => m.newIndex));
|
|
8347
|
+
const movedOld = new Set(diff.moved.map((m) => m.oldIndex));
|
|
8348
|
+
const pureAdded = diff.added.filter((j) => !subOldByNew.has(j) && !movedNew.has(j));
|
|
5168
8349
|
const pureRemoved = diff.removed.filter(
|
|
5169
|
-
(i) => !diff.substituted.some((s) => s.oldIndex === i)
|
|
8350
|
+
(i) => !diff.substituted.some((s) => s.oldIndex === i) && !movedOld.has(i)
|
|
5170
8351
|
);
|
|
5171
8352
|
const nodeAt = (j) => {
|
|
5172
8353
|
const oi = diff.keep.get(j);
|
|
5173
8354
|
if (oi !== void 0) return oldNodes[oi];
|
|
8355
|
+
const movedOi = movedOldByNew.get(j);
|
|
8356
|
+
if (movedOi !== void 0) return oldNodes[movedOi];
|
|
5174
8357
|
if (subOldByNew.has(j)) return fresh.get(j);
|
|
5175
8358
|
const f = fresh.get(j);
|
|
5176
8359
|
return f && f.isConnected ? f : null;
|
|
@@ -5180,11 +8363,7 @@ var Docxodus = (() => {
|
|
|
5180
8363
|
let prev = null;
|
|
5181
8364
|
for (let k = j - 1; k >= 0 && !prev; k--) prev = nodeAt(k);
|
|
5182
8365
|
let next = null;
|
|
5183
|
-
for (let k = j + 1; k < units.length && !next; k++)
|
|
5184
|
-
const oi = diff.keep.get(k);
|
|
5185
|
-
if (oi !== void 0) next = oldNodes[oi];
|
|
5186
|
-
else if (subOldByNew.has(k)) next = fresh.get(k);
|
|
5187
|
-
}
|
|
8366
|
+
for (let k = j + 1; k < units.length && !next; k++) next = nodeAt(k);
|
|
5188
8367
|
const prevW = prev ? this.unitWrapperOf(prev) : null;
|
|
5189
8368
|
const nextW = next ? this.unitWrapperOf(next) : null;
|
|
5190
8369
|
if (prevW && nextW && prevW.parentElement !== nextW.parentElement)
|
|
@@ -5195,8 +8374,29 @@ var Docxodus = (() => {
|
|
|
5195
8374
|
this.wireUnit(el, units[j]);
|
|
5196
8375
|
}
|
|
5197
8376
|
for (const i of pureRemoved) {
|
|
5198
|
-
|
|
5199
|
-
|
|
8377
|
+
this.unitWrapperOf(oldNodes[i]).remove();
|
|
8378
|
+
}
|
|
8379
|
+
for (const { newIndex } of [...diff.moved].sort((a, b) => a.newIndex - b.newIndex)) {
|
|
8380
|
+
const moving = nodeAt(newIndex);
|
|
8381
|
+
if (!moving?.isConnected) return "move source is not connected";
|
|
8382
|
+
const movingW = this.unitWrapperOf(moving);
|
|
8383
|
+
let prevW = null;
|
|
8384
|
+
for (let k = newIndex - 1; k >= 0 && !prevW; k--) {
|
|
8385
|
+
const n = nodeAt(k);
|
|
8386
|
+
if (n?.isConnected) prevW = this.unitWrapperOf(n);
|
|
8387
|
+
}
|
|
8388
|
+
let nextW = null;
|
|
8389
|
+
for (let k = newIndex + 1; k < units.length && !nextW; k++) {
|
|
8390
|
+
const n = nodeAt(k);
|
|
8391
|
+
if (n?.isConnected) nextW = this.unitWrapperOf(n);
|
|
8392
|
+
}
|
|
8393
|
+
if (prevW && prevW !== movingW && prevW.parentElement === movingW.parentElement) {
|
|
8394
|
+
prevW.after(movingW);
|
|
8395
|
+
} else if (nextW && nextW !== movingW && nextW.parentElement === movingW.parentElement) {
|
|
8396
|
+
nextW.before(movingW);
|
|
8397
|
+
} else {
|
|
8398
|
+
return "move neighbors in different parents";
|
|
8399
|
+
}
|
|
5200
8400
|
}
|
|
5201
8401
|
return true;
|
|
5202
8402
|
}
|
|
@@ -5320,7 +8520,7 @@ var Docxodus = (() => {
|
|
|
5320
8520
|
const bridge = this.exports.DocxSessionBridge;
|
|
5321
8521
|
if (typeof bridge.ListBlocks !== "function") return;
|
|
5322
8522
|
try {
|
|
5323
|
-
const plan = JSON.parse(
|
|
8523
|
+
const plan = JSON.parse(this.renderPlanJson());
|
|
5324
8524
|
if (plan.error) return;
|
|
5325
8525
|
const nodes = this.bodyUnitNodes();
|
|
5326
8526
|
if (nodes.length === plan.body.length) {
|
|
@@ -5349,6 +8549,7 @@ var Docxodus = (() => {
|
|
|
5349
8549
|
* block's content-hashed unid changes across the save/reproject a remount performs.
|
|
5350
8550
|
*/
|
|
5351
8551
|
remount(focusIndex = -1, caretAtEnd = false) {
|
|
8552
|
+
this.teardownBlockDrag();
|
|
5352
8553
|
this.refreshAnchorMap();
|
|
5353
8554
|
const fullHtml = this.renderFullHtml();
|
|
5354
8555
|
this.activeBlock = null;
|
|
@@ -5363,6 +8564,7 @@ var Docxodus = (() => {
|
|
|
5363
8564
|
}
|
|
5364
8565
|
}
|
|
5365
8566
|
this.syncRegionToBody(this.activeBlock ?? void 0);
|
|
8567
|
+
this.setupBlockDrag();
|
|
5366
8568
|
}
|
|
5367
8569
|
};
|
|
5368
8570
|
|
|
@@ -6571,8 +9773,12 @@ var Docxodus = (() => {
|
|
|
6571
9773
|
editable: this.options.editable,
|
|
6572
9774
|
scale: this.options.scale,
|
|
6573
9775
|
onEdit: this.options.onEdit,
|
|
9776
|
+
onMove: this.options.onMove,
|
|
6574
9777
|
paginated,
|
|
6575
|
-
headerFooter: this.headerFooter
|
|
9778
|
+
headerFooter: this.headerFooter,
|
|
9779
|
+
blockDrag: this.options.blockDrag ?? true,
|
|
9780
|
+
trackedChanges: this.options.trackedChanges,
|
|
9781
|
+
revisionAuthor: this.options.revisionAuthor
|
|
6576
9782
|
});
|
|
6577
9783
|
this.require("save").disabled = false;
|
|
6578
9784
|
this.require("ribbon").setAttribute("aria-disabled", "false");
|
|
@@ -6660,8 +9866,8 @@ var Docxodus = (() => {
|
|
|
6660
9866
|
this.keepSelection(tab);
|
|
6661
9867
|
tab.addEventListener("click", () => this.selectTab(tab.dataset.tab ?? "home"));
|
|
6662
9868
|
}
|
|
6663
|
-
const delegate = (
|
|
6664
|
-
for (const el of Array.from(ribbon.querySelectorAll(
|
|
9869
|
+
const delegate = (selector2, label, fn) => {
|
|
9870
|
+
for (const el of Array.from(ribbon.querySelectorAll(selector2))) {
|
|
6665
9871
|
this.keepSelection(el);
|
|
6666
9872
|
el.addEventListener("click", () => this.run(label(el), () => fn(el)));
|
|
6667
9873
|
}
|
|
@@ -7377,10 +10583,10 @@ var Docxodus = (() => {
|
|
|
7377
10583
|
function docxDiffSettingsJson(settings) {
|
|
7378
10584
|
return settings ? JSON.stringify(settings) : "";
|
|
7379
10585
|
}
|
|
7380
|
-
async function docxDiffCompare(
|
|
10586
|
+
async function docxDiffCompare(left2, right2, settings) {
|
|
7381
10587
|
const exports = ensureInitialized();
|
|
7382
|
-
const leftBytes = await toBytes(
|
|
7383
|
-
const rightBytes = await toBytes(
|
|
10588
|
+
const leftBytes = await toBytes(left2);
|
|
10589
|
+
const rightBytes = await toBytes(right2);
|
|
7384
10590
|
await yieldToMain();
|
|
7385
10591
|
const result = exports.DocxDiffBridge.Compare(
|
|
7386
10592
|
leftBytes,
|
|
@@ -7392,10 +10598,10 @@ var Docxodus = (() => {
|
|
|
7392
10598
|
}
|
|
7393
10599
|
return result;
|
|
7394
10600
|
}
|
|
7395
|
-
async function docxDiffGetRevisions(
|
|
10601
|
+
async function docxDiffGetRevisions(left2, right2, settings) {
|
|
7396
10602
|
const exports = ensureInitialized();
|
|
7397
|
-
const leftBytes = await toBytes(
|
|
7398
|
-
const rightBytes = await toBytes(
|
|
10603
|
+
const leftBytes = await toBytes(left2);
|
|
10604
|
+
const rightBytes = await toBytes(right2);
|
|
7399
10605
|
await yieldToMain();
|
|
7400
10606
|
const result = exports.DocxDiffBridge.GetRevisionsJson(
|
|
7401
10607
|
leftBytes,
|
|
@@ -7423,10 +10629,10 @@ var Docxodus = (() => {
|
|
|
7423
10629
|
rightAnchor: r.rightAnchor ?? r.RightAnchor ?? void 0
|
|
7424
10630
|
}));
|
|
7425
10631
|
}
|
|
7426
|
-
async function docxDiffGetEditScript(
|
|
10632
|
+
async function docxDiffGetEditScript(left2, right2, settings) {
|
|
7427
10633
|
const exports = ensureInitialized();
|
|
7428
|
-
const leftBytes = await toBytes(
|
|
7429
|
-
const rightBytes = await toBytes(
|
|
10634
|
+
const leftBytes = await toBytes(left2);
|
|
10635
|
+
const rightBytes = await toBytes(right2);
|
|
7430
10636
|
await yieldToMain();
|
|
7431
10637
|
const result = exports.DocxDiffBridge.GetEditScriptJson(
|
|
7432
10638
|
leftBytes,
|
|
@@ -8054,8 +11260,8 @@ var Docxodus = (() => {
|
|
|
8054
11260
|
if (occurrence > offsets.length) {
|
|
8055
11261
|
return null;
|
|
8056
11262
|
}
|
|
8057
|
-
const { start, end } = offsets[occurrence - 1];
|
|
8058
|
-
return createAnnotation(id, labelId, documentText,
|
|
11263
|
+
const { start: start2, end } = offsets[occurrence - 1];
|
|
11264
|
+
return createAnnotation(id, labelId, documentText, start2, end);
|
|
8059
11265
|
}
|
|
8060
11266
|
function findTextOccurrences(documentText, searchText, maxResults = 100) {
|
|
8061
11267
|
if (!searchText) return [];
|
|
@@ -8298,7 +11504,7 @@ var Docxodus = (() => {
|
|
|
8298
11504
|
}
|
|
8299
11505
|
function splitSelectorList(selectorText) {
|
|
8300
11506
|
const selectors = [];
|
|
8301
|
-
let
|
|
11507
|
+
let start2 = 0;
|
|
8302
11508
|
let parentheses = 0;
|
|
8303
11509
|
let brackets = 0;
|
|
8304
11510
|
let quote = "";
|
|
@@ -8326,15 +11532,15 @@ var Docxodus = (() => {
|
|
|
8326
11532
|
else if (ch === "[") brackets++;
|
|
8327
11533
|
else if (ch === "]") brackets--;
|
|
8328
11534
|
else if (ch === "," && parentheses === 0 && brackets === 0) {
|
|
8329
|
-
selectors.push(selectorText.slice(
|
|
8330
|
-
|
|
11535
|
+
selectors.push(selectorText.slice(start2, i).trim());
|
|
11536
|
+
start2 = i + 1;
|
|
8331
11537
|
}
|
|
8332
11538
|
}
|
|
8333
|
-
selectors.push(selectorText.slice(
|
|
11539
|
+
selectors.push(selectorText.slice(start2).trim());
|
|
8334
11540
|
return selectors.filter(Boolean);
|
|
8335
11541
|
}
|
|
8336
|
-
function scopeSelector(
|
|
8337
|
-
let remaining =
|
|
11542
|
+
function scopeSelector(selector2, rootSelector) {
|
|
11543
|
+
let remaining = selector2.trim();
|
|
8338
11544
|
let consumedRoot = false;
|
|
8339
11545
|
let separated = false;
|
|
8340
11546
|
for (; ; ) {
|
|
@@ -8365,7 +11571,7 @@ var Docxodus = (() => {
|
|
|
8365
11571
|
}
|
|
8366
11572
|
if (rule.type === CSSRule.STYLE_RULE) {
|
|
8367
11573
|
const styleRule = rule;
|
|
8368
|
-
styleRule.selectorText = splitSelectorList(styleRule.selectorText).map((
|
|
11574
|
+
styleRule.selectorText = splitSelectorList(styleRule.selectorText).map((selector2) => scopeSelector(selector2, rootSelector)).join(", ");
|
|
8369
11575
|
continue;
|
|
8370
11576
|
}
|
|
8371
11577
|
const grouping = rule;
|
|
@@ -8405,6 +11611,10 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8405
11611
|
if (renderHtml) {
|
|
8406
11612
|
bridge.RenderHtml = (...args) => scopeDocumentStyles(renderHtml(...args), rootSelector);
|
|
8407
11613
|
}
|
|
11614
|
+
const renderHtmlForReview = bridge.RenderHtmlForReview;
|
|
11615
|
+
if (renderHtmlForReview) {
|
|
11616
|
+
bridge.RenderHtmlForReview = (...args) => scopeDocumentStyles(renderHtmlForReview(...args), rootSelector);
|
|
11617
|
+
}
|
|
8408
11618
|
return {
|
|
8409
11619
|
DocxSessionBridge: bridge,
|
|
8410
11620
|
DocumentConverter: {
|
|
@@ -8433,7 +11643,7 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8433
11643
|
const el = resolveContainer2(container);
|
|
8434
11644
|
const { wasmBasePath: wasmBasePath2, ...conversion } = options;
|
|
8435
11645
|
await ensureWasm(wasmBasePath2);
|
|
8436
|
-
const
|
|
11646
|
+
const mount2 = createScopedMount(el);
|
|
8437
11647
|
let lastHtml = "";
|
|
8438
11648
|
const render = async (src, opts) => {
|
|
8439
11649
|
const bytes = await toDocumentBytes(src);
|
|
@@ -8446,13 +11656,13 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8446
11656
|
parsed.querySelectorAll("style").forEach((sourceStyle) => {
|
|
8447
11657
|
const style = document.createElement("style");
|
|
8448
11658
|
style.textContent = sourceStyle.textContent;
|
|
8449
|
-
scopeStyleElement(style,
|
|
11659
|
+
scopeStyleElement(style, mount2.selector);
|
|
8450
11660
|
fragment.appendChild(style);
|
|
8451
11661
|
});
|
|
8452
11662
|
const body = document.createElement("template");
|
|
8453
11663
|
body.innerHTML = parsed.body.innerHTML;
|
|
8454
11664
|
fragment.appendChild(body.content);
|
|
8455
|
-
|
|
11665
|
+
mount2.root.replaceChildren(fragment);
|
|
8456
11666
|
};
|
|
8457
11667
|
await render(source, conversion);
|
|
8458
11668
|
return {
|
|
@@ -8470,13 +11680,13 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8470
11680
|
const el = resolveContainer2(container);
|
|
8471
11681
|
const { wasmBasePath: wasmBasePath2, ...editorOptions } = options;
|
|
8472
11682
|
await ensureWasm(wasmBasePath2);
|
|
8473
|
-
const
|
|
11683
|
+
const mount2 = createScopedMount(el);
|
|
8474
11684
|
const exports = createScopedEditorExports(
|
|
8475
11685
|
getWasmExports(),
|
|
8476
|
-
|
|
11686
|
+
mount2.selector
|
|
8477
11687
|
);
|
|
8478
11688
|
try {
|
|
8479
|
-
return source == null ? DocxEditor.openBlank(
|
|
11689
|
+
return source == null ? DocxEditor.openBlank(mount2.root, exports, editorOptions) : DocxEditor.open(mount2.root, await toDocumentBytes(source), exports, editorOptions);
|
|
8480
11690
|
} catch (error) {
|
|
8481
11691
|
el.replaceChildren();
|
|
8482
11692
|
throw error;
|
|
@@ -8494,10 +11704,10 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8494
11704
|
async function createRibbonEditor(container, source, options = {}) {
|
|
8495
11705
|
const el = resolveContainer2(container);
|
|
8496
11706
|
const { wasmBasePath: wasmBasePath2, ...ribbonOptions } = options;
|
|
8497
|
-
const
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
const ribbon = mountRibbon(
|
|
11707
|
+
const mount2 = createScopedMount(el);
|
|
11708
|
+
mount2.root.style.height = "100%";
|
|
11709
|
+
mount2.root.style.minHeight = "0";
|
|
11710
|
+
const ribbon = mountRibbon(mount2.root, {
|
|
8501
11711
|
documentName: ribbonOptions.documentName ?? nameFromSource(source),
|
|
8502
11712
|
...ribbonOptions,
|
|
8503
11713
|
// Exports arrive after the runtime boots; the loader covers that gap.
|
|
@@ -8509,7 +11719,7 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8509
11719
|
ribbon.setExports(
|
|
8510
11720
|
createScopedEditorExports(
|
|
8511
11721
|
getWasmExports(),
|
|
8512
|
-
`${
|
|
11722
|
+
`${mount2.selector} [data-dxr-surface]`
|
|
8513
11723
|
)
|
|
8514
11724
|
);
|
|
8515
11725
|
ribbon.loader.stage(1);
|