docxodus 9.2.0 → 9.3.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 +3274 -164
- package/dist/editor.d.ts +94 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +689 -50
- package/dist/editor.js.map +1 -1
- package/dist/embed.bundle.js +3322 -189
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.iife.js +3293 -173
- package/dist/embed.js +8 -0
- package/dist/embed.js.map +1 -1
- package/dist/ribbon.js +4 -0
- package/dist/ribbon.js.map +1 -1
- package/dist/session.bundle.js +6 -0
- package/dist/session.d.ts +2 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +4 -0
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +10 -0
- 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/dotnet.boot.js +3 -3
- package/dist/wasm/_framework/dotnet.boot.js.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
|
|
@@ -1409,9 +1517,9 @@ var Docxodus = (() => {
|
|
|
1409
1517
|
for (const section of Array.from(sections)) {
|
|
1410
1518
|
const index = parseInt(section.dataset.sectionIndex || "0", 10);
|
|
1411
1519
|
const rawStart = section.dataset.pageNumStart;
|
|
1412
|
-
const
|
|
1520
|
+
const start2 = rawStart === void 0 ? void 0 : parseInt(rawStart, 10);
|
|
1413
1521
|
map.set(index, {
|
|
1414
|
-
start:
|
|
1522
|
+
start: start2 !== void 0 && Number.isFinite(start2) ? start2 : void 0,
|
|
1415
1523
|
format: section.dataset.pageNumFmt
|
|
1416
1524
|
});
|
|
1417
1525
|
}
|
|
@@ -1636,16 +1744,16 @@ var Docxodus = (() => {
|
|
|
1636
1744
|
return null;
|
|
1637
1745
|
}
|
|
1638
1746
|
const groups = [];
|
|
1639
|
-
let
|
|
1640
|
-
while (
|
|
1641
|
-
let end =
|
|
1747
|
+
let start2 = 0;
|
|
1748
|
+
while (start2 < rows.length) {
|
|
1749
|
+
let end = start2;
|
|
1642
1750
|
while (end < rows.length) {
|
|
1643
1751
|
const candidate = this.createSimpleTableFragment(
|
|
1644
1752
|
wrapper,
|
|
1645
1753
|
table,
|
|
1646
1754
|
body,
|
|
1647
|
-
rows.slice(
|
|
1648
|
-
|
|
1755
|
+
rows.slice(start2, end + 1),
|
|
1756
|
+
start2 === 0
|
|
1649
1757
|
);
|
|
1650
1758
|
const measured = this.measureElement(candidate, dims);
|
|
1651
1759
|
if (measured.heightPt > maximumFragmentHeight) {
|
|
@@ -1653,11 +1761,11 @@ var Docxodus = (() => {
|
|
|
1653
1761
|
}
|
|
1654
1762
|
end++;
|
|
1655
1763
|
}
|
|
1656
|
-
if (end ===
|
|
1764
|
+
if (end === start2) {
|
|
1657
1765
|
return null;
|
|
1658
1766
|
}
|
|
1659
|
-
groups.push(rows.slice(
|
|
1660
|
-
|
|
1767
|
+
groups.push(rows.slice(start2, end));
|
|
1768
|
+
start2 = end;
|
|
1661
1769
|
}
|
|
1662
1770
|
if (groups.length < 2) {
|
|
1663
1771
|
return null;
|
|
@@ -2972,9 +3080,9 @@ var Docxodus = (() => {
|
|
|
2972
3080
|
const commitStart = () => {
|
|
2973
3081
|
const raw = pageStart.value.trim();
|
|
2974
3082
|
if (raw === "") return;
|
|
2975
|
-
const
|
|
2976
|
-
if (!Number.isInteger(
|
|
2977
|
-
this.setPageNumbering({ start });
|
|
3083
|
+
const start2 = Number(raw);
|
|
3084
|
+
if (!Number.isInteger(start2) || start2 < 0) return;
|
|
3085
|
+
this.setPageNumbering({ start: start2 });
|
|
2978
3086
|
};
|
|
2979
3087
|
pageStart.addEventListener("blur", commitStart);
|
|
2980
3088
|
pageStart.addEventListener("keydown", (e) => {
|
|
@@ -3025,8 +3133,8 @@ var Docxodus = (() => {
|
|
|
3025
3133
|
if (pageFmt) pageFmt.value = this.sectionInfo?.pageNumberFormat ?? "";
|
|
3026
3134
|
const pageStart = band.querySelector("[data-hf-pagestart]");
|
|
3027
3135
|
if (pageStart && document.activeElement !== pageStart) {
|
|
3028
|
-
const
|
|
3029
|
-
pageStart.value =
|
|
3136
|
+
const start2 = this.sectionInfo?.pageNumberStart;
|
|
3137
|
+
pageStart.value = start2 === void 0 ? "" : String(start2);
|
|
3030
3138
|
}
|
|
3031
3139
|
const inherited = this.refFor(which, kind)?.inherited === true;
|
|
3032
3140
|
band.toggleAttribute("data-hf-inherited", inherited);
|
|
@@ -3074,65 +3182,2466 @@ var Docxodus = (() => {
|
|
|
3074
3182
|
el.setAttribute("data-hf-focused", "true");
|
|
3075
3183
|
});
|
|
3076
3184
|
}
|
|
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;
|
|
3185
|
+
renderStoryBlock(anchorId) {
|
|
3186
|
+
const html = this.bridge.RenderBlockHtml(
|
|
3187
|
+
this.handle,
|
|
3188
|
+
anchorId,
|
|
3189
|
+
this.options.cssPrefix,
|
|
3190
|
+
this.options.fabricateClasses
|
|
3191
|
+
);
|
|
3192
|
+
if (html.charCodeAt(0) === 123) return null;
|
|
3193
|
+
return new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
3194
|
+
}
|
|
3195
|
+
placeholder(which, kind) {
|
|
3196
|
+
const el = document.createElement("div");
|
|
3197
|
+
el.className = "docx-hf-placeholder";
|
|
3198
|
+
el.setAttribute("data-hf-placeholder", "");
|
|
3199
|
+
const label = KIND_LABELS.find((k) => k.value === kind)?.label ?? kind;
|
|
3200
|
+
el.textContent = `No ${label.toLowerCase()} ${which} \u2014 pick a kind to create one.`;
|
|
3201
|
+
return el;
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Surface the caveat that comes with the selected kind. Turning on first/even means those pages
|
|
3205
|
+
* stop using the Default stories entirely, which bites hardest on the OTHER band: enabling an
|
|
3206
|
+
* even header with no even footer leaves even pages footer-less, and enabling a first-page
|
|
3207
|
+
* header with an empty first-page footer leaves page 1 footer-less. The note is shown whenever
|
|
3208
|
+
* first/even is selected (the behavior change is real either way); the fix button appears only
|
|
3209
|
+
* when the counterpart story is missing entirely, which is what a user almost always wants next.
|
|
3210
|
+
*/
|
|
3211
|
+
renderKindWarning(which) {
|
|
3212
|
+
const band = this.bandFor(which);
|
|
3213
|
+
const warning = band.querySelector("[data-hf-warning]");
|
|
3214
|
+
if (!warning) return;
|
|
3215
|
+
const kind = this.kinds[which];
|
|
3216
|
+
if (kind === "default") {
|
|
3217
|
+
warning.hidden = true;
|
|
3218
|
+
warning.textContent = "";
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
const other = which === "header" ? "footer" : "header";
|
|
3222
|
+
warning.hidden = false;
|
|
3223
|
+
warning.textContent = `${kind === "even" ? EVEN_WARNING : FIRST_WARNING} `;
|
|
3224
|
+
if (this.partUriFor(other, kind)) return;
|
|
3225
|
+
const fix = document.createElement("button");
|
|
3226
|
+
fix.type = "button";
|
|
3227
|
+
fix.setAttribute("data-hf-fix-counterpart", "");
|
|
3228
|
+
fix.textContent = `Also create a ${kind === "even" ? "matching even" : "first-page"} ${other}`;
|
|
3229
|
+
fix.addEventListener("click", () => {
|
|
3230
|
+
this.setKind(other, kind);
|
|
3231
|
+
this.renderKindWarning(which);
|
|
3232
|
+
});
|
|
3233
|
+
warning.appendChild(fix);
|
|
3234
|
+
}
|
|
3235
|
+
};
|
|
3236
|
+
function parseResult(json) {
|
|
3237
|
+
try {
|
|
3238
|
+
return JSON.parse(json);
|
|
3239
|
+
} catch {
|
|
3240
|
+
return { success: false };
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
// node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
3245
|
+
function _arrayWithHoles(r) {
|
|
3246
|
+
if (Array.isArray(r)) return r;
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
// node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
3250
|
+
function _iterableToArrayLimit(r, l) {
|
|
3251
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
3252
|
+
if (null != t) {
|
|
3253
|
+
var e, n, i, u, a = [], f = true, o = false;
|
|
3254
|
+
try {
|
|
3255
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
3256
|
+
if (Object(t) !== t) return;
|
|
3257
|
+
f = false;
|
|
3258
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
|
|
3259
|
+
} catch (r2) {
|
|
3260
|
+
o = true, n = r2;
|
|
3261
|
+
} finally {
|
|
3262
|
+
try {
|
|
3263
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
3264
|
+
} finally {
|
|
3265
|
+
if (o) throw n;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
return a;
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
// node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
3273
|
+
function _arrayLikeToArray(r, a) {
|
|
3274
|
+
(null == a || a > r.length) && (a = r.length);
|
|
3275
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
3276
|
+
return n;
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
// node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
3280
|
+
function _unsupportedIterableToArray(r, a) {
|
|
3281
|
+
if (r) {
|
|
3282
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
3283
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
3284
|
+
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;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
// node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
3289
|
+
function _nonIterableRest() {
|
|
3290
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
// node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
3294
|
+
function _slicedToArray(r, e) {
|
|
3295
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
3296
|
+
}
|
|
3297
|
+
|
|
3298
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js
|
|
3299
|
+
var import_bind_event_listener4 = __toESM(require_dist());
|
|
3300
|
+
|
|
3301
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js
|
|
3302
|
+
var honeyPotDataAttribute = "data-pdnd-honey-pot";
|
|
3303
|
+
|
|
3304
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js
|
|
3305
|
+
function isHoneyPotElement(target) {
|
|
3306
|
+
return target instanceof Element && target.hasAttribute(honeyPotDataAttribute);
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js
|
|
3310
|
+
function getElementFromPointWithoutHoneypot(client) {
|
|
3311
|
+
var _document$elementsFro = document.elementsFromPoint(client.x, client.y), _document$elementsFro2 = _slicedToArray(_document$elementsFro, 2), top2 = _document$elementsFro2[0], second = _document$elementsFro2[1];
|
|
3312
|
+
if (!top2) {
|
|
3313
|
+
return null;
|
|
3314
|
+
}
|
|
3315
|
+
if (isHoneyPotElement(top2)) {
|
|
3316
|
+
return second !== null && second !== void 0 ? second : null;
|
|
3317
|
+
}
|
|
3318
|
+
return top2;
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
// node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
3322
|
+
function _typeof(o) {
|
|
3323
|
+
"@babel/helpers - typeof";
|
|
3324
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
3325
|
+
return typeof o2;
|
|
3326
|
+
} : function(o2) {
|
|
3327
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
3328
|
+
}, _typeof(o);
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
// node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
3332
|
+
function toPrimitive(t, r) {
|
|
3333
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
3334
|
+
var e = t[Symbol.toPrimitive];
|
|
3335
|
+
if (void 0 !== e) {
|
|
3336
|
+
var i = e.call(t, r || "default");
|
|
3337
|
+
if ("object" != _typeof(i)) return i;
|
|
3338
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
3339
|
+
}
|
|
3340
|
+
return ("string" === r ? String : Number)(t);
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
3344
|
+
function toPropertyKey(t) {
|
|
3345
|
+
var i = toPrimitive(t, "string");
|
|
3346
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
// node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
3350
|
+
function _defineProperty(e, r, t) {
|
|
3351
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
3352
|
+
value: t,
|
|
3353
|
+
enumerable: true,
|
|
3354
|
+
configurable: true,
|
|
3355
|
+
writable: true
|
|
3356
|
+
}) : e[r] = t, e;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js
|
|
3360
|
+
var import_bind_event_listener = __toESM(require_dist());
|
|
3361
|
+
|
|
3362
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/max-z-index.js
|
|
3363
|
+
var maxZIndex = 2147483647;
|
|
3364
|
+
|
|
3365
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/popover-reset-styles.js
|
|
3366
|
+
var popoverResetUserAgentStyles = {
|
|
3367
|
+
inset: "unset",
|
|
3368
|
+
border: "none",
|
|
3369
|
+
padding: 0,
|
|
3370
|
+
margin: 0,
|
|
3371
|
+
overflow: "visible",
|
|
3372
|
+
color: "inherit",
|
|
3373
|
+
background: "transparent",
|
|
3374
|
+
width: "auto",
|
|
3375
|
+
height: "auto"
|
|
3376
|
+
};
|
|
3377
|
+
|
|
3378
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js
|
|
3379
|
+
function once(fn) {
|
|
3380
|
+
var cache = null;
|
|
3381
|
+
return function wrapped() {
|
|
3382
|
+
if (!cache) {
|
|
3383
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3384
|
+
args[_key] = arguments[_key];
|
|
3385
|
+
}
|
|
3386
|
+
var result = fn.apply(this, args);
|
|
3387
|
+
cache = {
|
|
3388
|
+
result
|
|
3389
|
+
};
|
|
3390
|
+
}
|
|
3391
|
+
return cache.result;
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3395
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/supports-popover.js
|
|
3396
|
+
var supportsPopover = once(function supportsPopover2() {
|
|
3397
|
+
return typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype.showPopover === "function";
|
|
3398
|
+
});
|
|
3399
|
+
|
|
3400
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js
|
|
3401
|
+
function ownKeys(e, r) {
|
|
3402
|
+
var t = Object.keys(e);
|
|
3403
|
+
if (Object.getOwnPropertySymbols) {
|
|
3404
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
3405
|
+
r && (o = o.filter(function(r2) {
|
|
3406
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
3407
|
+
})), t.push.apply(t, o);
|
|
3408
|
+
}
|
|
3409
|
+
return t;
|
|
3410
|
+
}
|
|
3411
|
+
function _objectSpread(e) {
|
|
3412
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
3413
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
3414
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
3415
|
+
_defineProperty(e, r2, t[r2]);
|
|
3416
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
3417
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
3418
|
+
});
|
|
3419
|
+
}
|
|
3420
|
+
return e;
|
|
3421
|
+
}
|
|
3422
|
+
var honeyPotSize = 2;
|
|
3423
|
+
var halfHoneyPotSize = honeyPotSize / 2;
|
|
3424
|
+
function floorToClosestPixel(point) {
|
|
3425
|
+
return {
|
|
3426
|
+
x: Math.floor(point.x),
|
|
3427
|
+
y: Math.floor(point.y)
|
|
3428
|
+
};
|
|
3429
|
+
}
|
|
3430
|
+
function pullBackByHalfHoneyPotSize(point) {
|
|
3431
|
+
return {
|
|
3432
|
+
x: point.x - halfHoneyPotSize,
|
|
3433
|
+
y: point.y - halfHoneyPotSize
|
|
3434
|
+
};
|
|
3435
|
+
}
|
|
3436
|
+
function preventGoingBackwardsOffScreen(point) {
|
|
3437
|
+
return {
|
|
3438
|
+
x: Math.max(point.x, 0),
|
|
3439
|
+
y: Math.max(point.y, 0)
|
|
3440
|
+
};
|
|
3441
|
+
}
|
|
3442
|
+
function preventGoingForwardsOffScreen(point) {
|
|
3443
|
+
return {
|
|
3444
|
+
x: Math.min(point.x, window.innerWidth - honeyPotSize),
|
|
3445
|
+
y: Math.min(point.y, window.innerHeight - honeyPotSize)
|
|
3446
|
+
};
|
|
3447
|
+
}
|
|
3448
|
+
function getHoneyPotRectFor(_ref) {
|
|
3449
|
+
var client = _ref.client;
|
|
3450
|
+
var point = preventGoingForwardsOffScreen(preventGoingBackwardsOffScreen(pullBackByHalfHoneyPotSize(floorToClosestPixel(client))));
|
|
3451
|
+
return DOMRect.fromRect({
|
|
3452
|
+
x: point.x,
|
|
3453
|
+
y: point.y,
|
|
3454
|
+
width: honeyPotSize,
|
|
3455
|
+
height: honeyPotSize
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
function getRectStyles(_ref2) {
|
|
3459
|
+
var clientRect = _ref2.clientRect;
|
|
3460
|
+
return {
|
|
3461
|
+
left: "".concat(clientRect.left, "px"),
|
|
3462
|
+
top: "".concat(clientRect.top, "px"),
|
|
3463
|
+
width: "".concat(clientRect.width, "px"),
|
|
3464
|
+
height: "".concat(clientRect.height, "px")
|
|
3465
|
+
};
|
|
3466
|
+
}
|
|
3467
|
+
function isWithin(_ref3) {
|
|
3468
|
+
var client = _ref3.client, clientRect = _ref3.clientRect;
|
|
3469
|
+
return (
|
|
3470
|
+
// is within horizontal bounds
|
|
3471
|
+
client.x >= clientRect.x && client.x <= clientRect.x + clientRect.width && // is within vertical bounds
|
|
3472
|
+
client.y >= clientRect.y && client.y <= clientRect.y + clientRect.height
|
|
3473
|
+
);
|
|
3474
|
+
}
|
|
3475
|
+
function mountHoneyPot(_ref4) {
|
|
3476
|
+
var initial = _ref4.initial;
|
|
3477
|
+
var element = document.createElement("div");
|
|
3478
|
+
element.setAttribute(honeyPotDataAttribute, "true");
|
|
3479
|
+
if (supportsPopover()) {
|
|
3480
|
+
element.setAttribute("popover", "manual");
|
|
3481
|
+
}
|
|
3482
|
+
var clientRect = getHoneyPotRectFor({
|
|
3483
|
+
client: initial
|
|
3484
|
+
});
|
|
3485
|
+
Object.assign(element.style, _objectSpread(_objectSpread({
|
|
3486
|
+
position: "fixed"
|
|
3487
|
+
}, supportsPopover() ? (
|
|
3488
|
+
// needs to come first as it has 'inset: unset' which
|
|
3489
|
+
// needs to be overridden by our top / left values
|
|
3490
|
+
popoverResetUserAgentStyles
|
|
3491
|
+
) : {
|
|
3492
|
+
// Fallback: using maximum possible z-index so that this element
|
|
3493
|
+
// will always be on top of other positioned content.
|
|
3494
|
+
zIndex: maxZIndex
|
|
3495
|
+
}), {}, {
|
|
3496
|
+
// Setting a background color explicitly to avoid any inherited styles.
|
|
3497
|
+
// Looks like this could be `opacity: 0`, but worried that _might_
|
|
3498
|
+
// cause the element to be ignored on some platforms.
|
|
3499
|
+
// When debugging, set backgroundColor to something like "red".
|
|
3500
|
+
backgroundColor: "transparent",
|
|
3501
|
+
// Being explicit to avoid inheriting styles
|
|
3502
|
+
padding: 0,
|
|
3503
|
+
margin: 0,
|
|
3504
|
+
boxSizing: "border-box",
|
|
3505
|
+
// We want this element to absorb pointer events,
|
|
3506
|
+
// it's kind of the whole point 😉
|
|
3507
|
+
pointerEvents: "auto"
|
|
3508
|
+
}, getRectStyles({
|
|
3509
|
+
clientRect
|
|
3510
|
+
})));
|
|
3511
|
+
document.body.appendChild(element);
|
|
3512
|
+
if (supportsPopover()) {
|
|
3513
|
+
element.showPopover();
|
|
3514
|
+
}
|
|
3515
|
+
var unbindPointerMove = (0, import_bind_event_listener.bind)(window, {
|
|
3516
|
+
type: "pointermove",
|
|
3517
|
+
listener: function listener(event) {
|
|
3518
|
+
var client = {
|
|
3519
|
+
x: event.clientX,
|
|
3520
|
+
y: event.clientY
|
|
3521
|
+
};
|
|
3522
|
+
clientRect = getHoneyPotRectFor({
|
|
3523
|
+
client
|
|
3524
|
+
});
|
|
3525
|
+
Object.assign(element.style, getRectStyles({
|
|
3526
|
+
clientRect
|
|
3527
|
+
}));
|
|
3528
|
+
},
|
|
3529
|
+
// using capture so we are less likely to be impacted by event stopping
|
|
3530
|
+
options: {
|
|
3531
|
+
capture: true
|
|
3532
|
+
}
|
|
3533
|
+
});
|
|
3534
|
+
return function finish(_ref5) {
|
|
3535
|
+
var current = _ref5.current;
|
|
3536
|
+
unbindPointerMove();
|
|
3537
|
+
if (isWithin({
|
|
3538
|
+
client: current,
|
|
3539
|
+
clientRect
|
|
3540
|
+
})) {
|
|
3541
|
+
element.remove();
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
function cleanup() {
|
|
3545
|
+
unbindPostDragEvents();
|
|
3546
|
+
element.remove();
|
|
3547
|
+
}
|
|
3548
|
+
var unbindPostDragEvents = (0, import_bind_event_listener.bindAll)(window, [
|
|
3549
|
+
{
|
|
3550
|
+
type: "pointerdown",
|
|
3551
|
+
listener: cleanup
|
|
3552
|
+
},
|
|
3553
|
+
{
|
|
3554
|
+
type: "pointermove",
|
|
3555
|
+
listener: cleanup
|
|
3556
|
+
},
|
|
3557
|
+
{
|
|
3558
|
+
type: "focusin",
|
|
3559
|
+
listener: cleanup
|
|
3560
|
+
},
|
|
3561
|
+
{
|
|
3562
|
+
type: "focusout",
|
|
3563
|
+
listener: cleanup
|
|
3564
|
+
},
|
|
3565
|
+
// a 'pointerdown' should happen before 'dragstart', but just being super safe
|
|
3566
|
+
{
|
|
3567
|
+
type: "dragstart",
|
|
3568
|
+
listener: cleanup
|
|
3569
|
+
},
|
|
3570
|
+
// if the user has dragged something out of the window
|
|
3571
|
+
// and then is dragging something back into the window
|
|
3572
|
+
// the first events we will see are "dragenter" (and then "dragover").
|
|
3573
|
+
// So if we see any of these we need to clear the post drag fix.
|
|
3574
|
+
{
|
|
3575
|
+
type: "dragenter",
|
|
3576
|
+
listener: cleanup
|
|
3577
|
+
},
|
|
3578
|
+
{
|
|
3579
|
+
type: "dragover",
|
|
3580
|
+
listener: cleanup
|
|
3581
|
+
}
|
|
3582
|
+
// Not adding a "wheel" event listener, as "wheel" by itself does not
|
|
3583
|
+
// resolve the bug.
|
|
3584
|
+
], {
|
|
3585
|
+
// Using `capture` so less likely to be impacted by other code stopping events
|
|
3586
|
+
capture: true
|
|
3587
|
+
});
|
|
3588
|
+
};
|
|
3589
|
+
}
|
|
3590
|
+
function makeHoneyPotFix() {
|
|
3591
|
+
var latestPointerMove = null;
|
|
3592
|
+
function bindEvents() {
|
|
3593
|
+
latestPointerMove = null;
|
|
3594
|
+
return (0, import_bind_event_listener.bind)(window, {
|
|
3595
|
+
type: "pointermove",
|
|
3596
|
+
listener: function listener(event) {
|
|
3597
|
+
latestPointerMove = {
|
|
3598
|
+
x: event.clientX,
|
|
3599
|
+
y: event.clientY
|
|
3600
|
+
};
|
|
3601
|
+
},
|
|
3602
|
+
// listening for pointer move in capture phase
|
|
3603
|
+
// so we are less likely to be impacted by events being stopped.
|
|
3604
|
+
options: {
|
|
3605
|
+
capture: true
|
|
3606
|
+
}
|
|
3607
|
+
});
|
|
3608
|
+
}
|
|
3609
|
+
function getOnPostDispatch() {
|
|
3610
|
+
var finish = null;
|
|
3611
|
+
return function onPostEvent(_ref6) {
|
|
3612
|
+
var eventName = _ref6.eventName, payload = _ref6.payload;
|
|
3613
|
+
if (eventName === "onDragStart") {
|
|
3614
|
+
var input = payload.location.initial.input;
|
|
3615
|
+
var initial = latestPointerMove !== null && latestPointerMove !== void 0 ? latestPointerMove : {
|
|
3616
|
+
x: input.clientX,
|
|
3617
|
+
y: input.clientY
|
|
3618
|
+
};
|
|
3619
|
+
finish = mountHoneyPot({
|
|
3620
|
+
initial
|
|
3621
|
+
});
|
|
3622
|
+
}
|
|
3623
|
+
if (eventName === "onDrop") {
|
|
3624
|
+
var _finish;
|
|
3625
|
+
var _input = payload.location.current.input;
|
|
3626
|
+
(_finish = finish) === null || _finish === void 0 || _finish({
|
|
3627
|
+
current: {
|
|
3628
|
+
x: _input.clientX,
|
|
3629
|
+
y: _input.clientY
|
|
3630
|
+
}
|
|
3631
|
+
});
|
|
3632
|
+
finish = null;
|
|
3633
|
+
latestPointerMove = null;
|
|
3634
|
+
}
|
|
3635
|
+
};
|
|
3636
|
+
}
|
|
3637
|
+
return {
|
|
3638
|
+
bindEvents,
|
|
3639
|
+
getOnPostDispatch
|
|
3640
|
+
};
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
// node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
3644
|
+
function _arrayWithoutHoles(r) {
|
|
3645
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
// node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
3649
|
+
function _iterableToArray(r) {
|
|
3650
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
// node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
3654
|
+
function _nonIterableSpread() {
|
|
3655
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3656
|
+
}
|
|
3657
|
+
|
|
3658
|
+
// node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
3659
|
+
function _toConsumableArray(r) {
|
|
3660
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3663
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js
|
|
3664
|
+
var import_bind_event_listener3 = __toESM(require_dist());
|
|
3665
|
+
|
|
3666
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js
|
|
3667
|
+
var isFirefox = once(function isFirefox2() {
|
|
3668
|
+
if (false) {
|
|
3669
|
+
return false;
|
|
3670
|
+
}
|
|
3671
|
+
return navigator.userAgent.includes("Firefox");
|
|
3672
|
+
});
|
|
3673
|
+
|
|
3674
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js
|
|
3675
|
+
var isSafari = once(function isSafari2() {
|
|
3676
|
+
if (false) {
|
|
3677
|
+
return false;
|
|
3678
|
+
}
|
|
3679
|
+
var _navigator = navigator, userAgent = _navigator.userAgent;
|
|
3680
|
+
return userAgent.includes("AppleWebKit") && !userAgent.includes("Chrome");
|
|
3681
|
+
});
|
|
3682
|
+
|
|
3683
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js
|
|
3684
|
+
var import_bind_event_listener2 = __toESM(require_dist());
|
|
3685
|
+
var symbols = {
|
|
3686
|
+
isLeavingWindow: /* @__PURE__ */ Symbol("leaving"),
|
|
3687
|
+
isEnteringWindow: /* @__PURE__ */ Symbol("entering")
|
|
3688
|
+
};
|
|
3689
|
+
function isLeavingWindowInSafari(_ref2) {
|
|
3690
|
+
var dragLeave = _ref2.dragLeave;
|
|
3691
|
+
if (!isSafari()) {
|
|
3692
|
+
return false;
|
|
3693
|
+
}
|
|
3694
|
+
return dragLeave.hasOwnProperty(symbols.isLeavingWindow);
|
|
3695
|
+
}
|
|
3696
|
+
(function fixSafari() {
|
|
3697
|
+
if (typeof window === "undefined") {
|
|
3698
|
+
return;
|
|
3699
|
+
}
|
|
3700
|
+
if (false) {
|
|
3701
|
+
return;
|
|
3702
|
+
}
|
|
3703
|
+
if (!isSafari()) {
|
|
3704
|
+
return;
|
|
3705
|
+
}
|
|
3706
|
+
function getInitialState() {
|
|
3707
|
+
return {
|
|
3708
|
+
enterCount: 0,
|
|
3709
|
+
isOverWindow: false
|
|
3710
|
+
};
|
|
3711
|
+
}
|
|
3712
|
+
var state = getInitialState();
|
|
3713
|
+
function resetState() {
|
|
3714
|
+
state = getInitialState();
|
|
3715
|
+
}
|
|
3716
|
+
(0, import_bind_event_listener2.bindAll)(
|
|
3717
|
+
window,
|
|
3718
|
+
[{
|
|
3719
|
+
type: "dragstart",
|
|
3720
|
+
listener: function listener() {
|
|
3721
|
+
state.enterCount = 0;
|
|
3722
|
+
state.isOverWindow = true;
|
|
3723
|
+
}
|
|
3724
|
+
}, {
|
|
3725
|
+
type: "drop",
|
|
3726
|
+
listener: resetState
|
|
3727
|
+
}, {
|
|
3728
|
+
type: "dragend",
|
|
3729
|
+
listener: resetState
|
|
3730
|
+
}, {
|
|
3731
|
+
type: "dragenter",
|
|
3732
|
+
listener: function listener(event) {
|
|
3733
|
+
if (!state.isOverWindow && state.enterCount === 0) {
|
|
3734
|
+
event[symbols.isEnteringWindow] = true;
|
|
3735
|
+
}
|
|
3736
|
+
state.isOverWindow = true;
|
|
3737
|
+
state.enterCount++;
|
|
3738
|
+
}
|
|
3739
|
+
}, {
|
|
3740
|
+
type: "dragleave",
|
|
3741
|
+
listener: function listener(event) {
|
|
3742
|
+
state.enterCount--;
|
|
3743
|
+
if (state.isOverWindow && state.enterCount === 0) {
|
|
3744
|
+
event[symbols.isLeavingWindow] = true;
|
|
3745
|
+
state.isOverWindow = false;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
}],
|
|
3749
|
+
// using `capture: true` so that adding event listeners
|
|
3750
|
+
// in bubble phase will have the correct symbols
|
|
3751
|
+
{
|
|
3752
|
+
capture: true
|
|
3753
|
+
}
|
|
3754
|
+
);
|
|
3755
|
+
})();
|
|
3756
|
+
|
|
3757
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js
|
|
3758
|
+
function isNodeLike(target) {
|
|
3759
|
+
return "nodeName" in target;
|
|
3760
|
+
}
|
|
3761
|
+
function isFromAnotherWindow(eventTarget) {
|
|
3762
|
+
return isNodeLike(eventTarget) && eventTarget.ownerDocument !== document;
|
|
3763
|
+
}
|
|
3764
|
+
|
|
3765
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js
|
|
3766
|
+
function isLeavingWindow(_ref) {
|
|
3767
|
+
var dragLeave = _ref.dragLeave;
|
|
3768
|
+
var type = dragLeave.type, relatedTarget = dragLeave.relatedTarget;
|
|
3769
|
+
if (type !== "dragleave") {
|
|
3770
|
+
return false;
|
|
3771
|
+
}
|
|
3772
|
+
if (isSafari()) {
|
|
3773
|
+
return isLeavingWindowInSafari({
|
|
3774
|
+
dragLeave
|
|
3775
|
+
});
|
|
3776
|
+
}
|
|
3777
|
+
if (relatedTarget == null) {
|
|
3778
|
+
return true;
|
|
3779
|
+
}
|
|
3780
|
+
if (isFirefox()) {
|
|
3781
|
+
return isFromAnotherWindow(relatedTarget);
|
|
3782
|
+
}
|
|
3783
|
+
return relatedTarget instanceof HTMLIFrameElement;
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js
|
|
3787
|
+
function getBindingsForBrokenDrags(_ref) {
|
|
3788
|
+
var onDragEnd = _ref.onDragEnd;
|
|
3789
|
+
return [
|
|
3790
|
+
// ## Detecting drag ending for removed draggables
|
|
3791
|
+
//
|
|
3792
|
+
// If a draggable element is removed during a drag and the user drops:
|
|
3793
|
+
// 1. if over a valid drop target: we get a "drop" event to know the drag is finished
|
|
3794
|
+
// 2. if not over a valid drop target (or cancelled): we get nothing
|
|
3795
|
+
// The "dragend" event will not fire on the source draggable if it has been
|
|
3796
|
+
// removed from the DOM.
|
|
3797
|
+
// So we need to figure out if a drag operation has finished by looking at other events
|
|
3798
|
+
// We can do this by looking at other events
|
|
3799
|
+
// ### First detection: "pointermove" events
|
|
3800
|
+
// 1. "pointermove" events cannot fire during a drag and drop operation
|
|
3801
|
+
// according to the spec. So if we get a "pointermove" it means that
|
|
3802
|
+
// the drag and drop operations has finished. So if we get a "pointermove"
|
|
3803
|
+
// we know that the drag is over
|
|
3804
|
+
// 2. 🦊😤 Drag and drop operations are _supposed_ to suppress
|
|
3805
|
+
// other pointer events. However, firefox will allow a few
|
|
3806
|
+
// pointer event to get through after a drag starts.
|
|
3807
|
+
// The most I've seen is 3
|
|
3808
|
+
{
|
|
3809
|
+
type: "pointermove",
|
|
3810
|
+
listener: /* @__PURE__ */ (function() {
|
|
3811
|
+
var callCount = 0;
|
|
3812
|
+
return function listener() {
|
|
3813
|
+
if (callCount < 20) {
|
|
3814
|
+
callCount++;
|
|
3815
|
+
return;
|
|
3816
|
+
}
|
|
3817
|
+
onDragEnd();
|
|
3818
|
+
};
|
|
3819
|
+
})()
|
|
3820
|
+
},
|
|
3821
|
+
// ### Second detection: "pointerdown" events
|
|
3822
|
+
// If we receive this event then we know that a drag operation has finished
|
|
3823
|
+
// and potentially another one is about to start.
|
|
3824
|
+
// Note: `pointerdown` fires on all browsers / platforms before "dragstart"
|
|
3825
|
+
{
|
|
3826
|
+
type: "pointerdown",
|
|
3827
|
+
listener: onDragEnd
|
|
3828
|
+
}
|
|
3829
|
+
];
|
|
3830
|
+
}
|
|
3831
|
+
|
|
3832
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js
|
|
3833
|
+
function getInput(event) {
|
|
3834
|
+
return {
|
|
3835
|
+
altKey: event.altKey,
|
|
3836
|
+
button: event.button,
|
|
3837
|
+
buttons: event.buttons,
|
|
3838
|
+
ctrlKey: event.ctrlKey,
|
|
3839
|
+
metaKey: event.metaKey,
|
|
3840
|
+
shiftKey: event.shiftKey,
|
|
3841
|
+
clientX: event.clientX,
|
|
3842
|
+
clientY: event.clientY,
|
|
3843
|
+
pageX: event.pageX,
|
|
3844
|
+
pageY: event.pageY
|
|
3845
|
+
};
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
// node_modules/raf-schd/dist/raf-schd.esm.js
|
|
3849
|
+
var rafSchd = function rafSchd2(fn) {
|
|
3850
|
+
var lastArgs = [];
|
|
3851
|
+
var frameId = null;
|
|
3852
|
+
var wrapperFn = function wrapperFn2() {
|
|
3853
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3854
|
+
args[_key] = arguments[_key];
|
|
3855
|
+
}
|
|
3856
|
+
lastArgs = args;
|
|
3857
|
+
if (frameId) {
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
frameId = requestAnimationFrame(function() {
|
|
3861
|
+
frameId = null;
|
|
3862
|
+
fn.apply(void 0, lastArgs);
|
|
3863
|
+
});
|
|
3864
|
+
};
|
|
3865
|
+
wrapperFn.cancel = function() {
|
|
3866
|
+
if (!frameId) {
|
|
3867
|
+
return;
|
|
3868
|
+
}
|
|
3869
|
+
cancelAnimationFrame(frameId);
|
|
3870
|
+
frameId = null;
|
|
3871
|
+
};
|
|
3872
|
+
return wrapperFn;
|
|
3873
|
+
};
|
|
3874
|
+
var raf_schd_esm_default = rafSchd;
|
|
3875
|
+
|
|
3876
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js
|
|
3877
|
+
var scheduleOnDrag = raf_schd_esm_default(function(fn) {
|
|
3878
|
+
return fn();
|
|
3879
|
+
});
|
|
3880
|
+
var dragStart = /* @__PURE__ */ (function() {
|
|
3881
|
+
var scheduled = null;
|
|
3882
|
+
function schedule(fn) {
|
|
3883
|
+
var frameId = requestAnimationFrame(function() {
|
|
3884
|
+
scheduled = null;
|
|
3885
|
+
fn();
|
|
3886
|
+
});
|
|
3887
|
+
scheduled = {
|
|
3888
|
+
frameId,
|
|
3889
|
+
fn
|
|
3890
|
+
};
|
|
3891
|
+
}
|
|
3892
|
+
function flush() {
|
|
3893
|
+
if (scheduled) {
|
|
3894
|
+
cancelAnimationFrame(scheduled.frameId);
|
|
3895
|
+
scheduled.fn();
|
|
3896
|
+
scheduled = null;
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
return {
|
|
3900
|
+
schedule,
|
|
3901
|
+
flush
|
|
3902
|
+
};
|
|
3903
|
+
})();
|
|
3904
|
+
function makeDispatch(_ref) {
|
|
3905
|
+
var source = _ref.source, initial = _ref.initial, dispatchEvent = _ref.dispatchEvent;
|
|
3906
|
+
var previous = {
|
|
3907
|
+
dropTargets: []
|
|
3908
|
+
};
|
|
3909
|
+
function safeDispatch(args) {
|
|
3910
|
+
dispatchEvent(args);
|
|
3911
|
+
previous = {
|
|
3912
|
+
dropTargets: args.payload.location.current.dropTargets
|
|
3913
|
+
};
|
|
3914
|
+
}
|
|
3915
|
+
var dispatch = {
|
|
3916
|
+
start: function start2(_ref2) {
|
|
3917
|
+
var nativeSetDragImage = _ref2.nativeSetDragImage;
|
|
3918
|
+
var location2 = {
|
|
3919
|
+
current: initial,
|
|
3920
|
+
previous,
|
|
3921
|
+
initial
|
|
3922
|
+
};
|
|
3923
|
+
safeDispatch({
|
|
3924
|
+
eventName: "onGenerateDragPreview",
|
|
3925
|
+
payload: {
|
|
3926
|
+
source,
|
|
3927
|
+
location: location2,
|
|
3928
|
+
nativeSetDragImage
|
|
3929
|
+
}
|
|
3930
|
+
});
|
|
3931
|
+
dragStart.schedule(function() {
|
|
3932
|
+
safeDispatch({
|
|
3933
|
+
eventName: "onDragStart",
|
|
3934
|
+
payload: {
|
|
3935
|
+
source,
|
|
3936
|
+
location: location2
|
|
3937
|
+
}
|
|
3938
|
+
});
|
|
3939
|
+
});
|
|
3940
|
+
},
|
|
3941
|
+
dragUpdate: function dragUpdate(_ref3) {
|
|
3942
|
+
var current = _ref3.current;
|
|
3943
|
+
dragStart.flush();
|
|
3944
|
+
scheduleOnDrag.cancel();
|
|
3945
|
+
safeDispatch({
|
|
3946
|
+
eventName: "onDropTargetChange",
|
|
3947
|
+
payload: {
|
|
3948
|
+
source,
|
|
3949
|
+
location: {
|
|
3950
|
+
initial,
|
|
3951
|
+
previous,
|
|
3952
|
+
current
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
});
|
|
3956
|
+
},
|
|
3957
|
+
drag: function drag(_ref4) {
|
|
3958
|
+
var current = _ref4.current;
|
|
3959
|
+
scheduleOnDrag(function() {
|
|
3960
|
+
dragStart.flush();
|
|
3961
|
+
var location2 = {
|
|
3962
|
+
initial,
|
|
3963
|
+
previous,
|
|
3964
|
+
current
|
|
3965
|
+
};
|
|
3966
|
+
safeDispatch({
|
|
3967
|
+
eventName: "onDrag",
|
|
3968
|
+
payload: {
|
|
3969
|
+
source,
|
|
3970
|
+
location: location2
|
|
3971
|
+
}
|
|
3972
|
+
});
|
|
3973
|
+
});
|
|
3974
|
+
},
|
|
3975
|
+
drop: function drop(_ref5) {
|
|
3976
|
+
var current = _ref5.current, updatedSourcePayload = _ref5.updatedSourcePayload;
|
|
3977
|
+
dragStart.flush();
|
|
3978
|
+
scheduleOnDrag.cancel();
|
|
3979
|
+
safeDispatch({
|
|
3980
|
+
eventName: "onDrop",
|
|
3981
|
+
payload: {
|
|
3982
|
+
source: updatedSourcePayload !== null && updatedSourcePayload !== void 0 ? updatedSourcePayload : source,
|
|
3983
|
+
location: {
|
|
3984
|
+
current,
|
|
3985
|
+
previous,
|
|
3986
|
+
initial
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
});
|
|
3990
|
+
}
|
|
3991
|
+
};
|
|
3992
|
+
return dispatch;
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3995
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js
|
|
3996
|
+
var globalState = {
|
|
3997
|
+
isActive: false
|
|
3998
|
+
};
|
|
3999
|
+
function canStart() {
|
|
4000
|
+
return !globalState.isActive;
|
|
4001
|
+
}
|
|
4002
|
+
function getNativeSetDragImage(event) {
|
|
4003
|
+
if (event.dataTransfer) {
|
|
4004
|
+
return event.dataTransfer.setDragImage.bind(event.dataTransfer);
|
|
4005
|
+
}
|
|
4006
|
+
return null;
|
|
4007
|
+
}
|
|
4008
|
+
function hasHierarchyChanged(_ref) {
|
|
4009
|
+
var current = _ref.current, next = _ref.next;
|
|
4010
|
+
if (current.length !== next.length) {
|
|
4011
|
+
return true;
|
|
4012
|
+
}
|
|
4013
|
+
for (var i = 0; i < current.length; i++) {
|
|
4014
|
+
if (current[i].element !== next[i].element) {
|
|
4015
|
+
return true;
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
return false;
|
|
4019
|
+
}
|
|
4020
|
+
function start(_ref2) {
|
|
4021
|
+
var event = _ref2.event, dragType = _ref2.dragType, getDropTargetsOver = _ref2.getDropTargetsOver, dispatchEvent = _ref2.dispatchEvent;
|
|
4022
|
+
if (!canStart()) {
|
|
4023
|
+
return;
|
|
4024
|
+
}
|
|
4025
|
+
var initial = getStartLocation({
|
|
4026
|
+
event,
|
|
4027
|
+
dragType,
|
|
4028
|
+
getDropTargetsOver
|
|
4029
|
+
});
|
|
4030
|
+
globalState.isActive = true;
|
|
4031
|
+
var state = {
|
|
4032
|
+
current: initial
|
|
4033
|
+
};
|
|
4034
|
+
setDropEffectOnEvent({
|
|
4035
|
+
event,
|
|
4036
|
+
current: initial.dropTargets
|
|
4037
|
+
});
|
|
4038
|
+
var dispatch = makeDispatch({
|
|
4039
|
+
source: dragType.payload,
|
|
4040
|
+
dispatchEvent,
|
|
4041
|
+
initial
|
|
4042
|
+
});
|
|
4043
|
+
function updateState(next) {
|
|
4044
|
+
var hasChanged = hasHierarchyChanged({
|
|
4045
|
+
current: state.current.dropTargets,
|
|
4046
|
+
next: next.dropTargets
|
|
4047
|
+
});
|
|
4048
|
+
state.current = next;
|
|
4049
|
+
if (hasChanged) {
|
|
4050
|
+
dispatch.dragUpdate({
|
|
4051
|
+
current: state.current
|
|
4052
|
+
});
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
function onUpdateEvent(event2) {
|
|
4056
|
+
var input = getInput(event2);
|
|
4057
|
+
var target = isHoneyPotElement(event2.target) ? getElementFromPointWithoutHoneypot({
|
|
4058
|
+
x: input.clientX,
|
|
4059
|
+
y: input.clientY
|
|
4060
|
+
}) : event2.target;
|
|
4061
|
+
var nextDropTargets = getDropTargetsOver({
|
|
4062
|
+
target,
|
|
4063
|
+
input,
|
|
4064
|
+
source: dragType.payload,
|
|
4065
|
+
current: state.current.dropTargets
|
|
4066
|
+
});
|
|
4067
|
+
if (nextDropTargets.length) {
|
|
4068
|
+
event2.preventDefault();
|
|
4069
|
+
setDropEffectOnEvent({
|
|
4070
|
+
event: event2,
|
|
4071
|
+
current: nextDropTargets
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
updateState({
|
|
4075
|
+
dropTargets: nextDropTargets,
|
|
4076
|
+
input
|
|
4077
|
+
});
|
|
4078
|
+
}
|
|
4079
|
+
function cancel() {
|
|
4080
|
+
if (state.current.dropTargets.length) {
|
|
4081
|
+
updateState({
|
|
4082
|
+
dropTargets: [],
|
|
4083
|
+
input: state.current.input
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4086
|
+
dispatch.drop({
|
|
4087
|
+
current: state.current,
|
|
4088
|
+
updatedSourcePayload: null
|
|
4089
|
+
});
|
|
4090
|
+
finish();
|
|
4091
|
+
}
|
|
4092
|
+
function finish() {
|
|
4093
|
+
globalState.isActive = false;
|
|
4094
|
+
unbindEvents();
|
|
4095
|
+
}
|
|
4096
|
+
var unbindEvents = (0, import_bind_event_listener3.bindAll)(
|
|
4097
|
+
window,
|
|
4098
|
+
[{
|
|
4099
|
+
// 👋 Note: we are repurposing the `dragover` event as our `drag` event
|
|
4100
|
+
// this is because firefox does not publish pointer coordinates during
|
|
4101
|
+
// a `drag` event, but does for every other type of drag event
|
|
4102
|
+
// `dragover` fires on all elements that are being dragged over
|
|
4103
|
+
// Because we are binding to `window` - our `dragover` is effectively the same as a `drag`
|
|
4104
|
+
// 🦊😤
|
|
4105
|
+
type: "dragover",
|
|
4106
|
+
listener: function listener(event2) {
|
|
4107
|
+
onUpdateEvent(event2);
|
|
4108
|
+
dispatch.drag({
|
|
4109
|
+
current: state.current
|
|
4110
|
+
});
|
|
4111
|
+
}
|
|
4112
|
+
}, {
|
|
4113
|
+
type: "dragenter",
|
|
4114
|
+
listener: onUpdateEvent
|
|
4115
|
+
}, {
|
|
4116
|
+
type: "dragleave",
|
|
4117
|
+
listener: function listener(event2) {
|
|
4118
|
+
if (!isLeavingWindow({
|
|
4119
|
+
dragLeave: event2
|
|
4120
|
+
})) {
|
|
4121
|
+
return;
|
|
4122
|
+
}
|
|
4123
|
+
updateState({
|
|
4124
|
+
input: state.current.input,
|
|
4125
|
+
dropTargets: []
|
|
4126
|
+
});
|
|
4127
|
+
if (dragType.startedFrom === "external") {
|
|
4128
|
+
cancel();
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4131
|
+
}, {
|
|
4132
|
+
// A "drop" can only happen if the browser allowed the drop
|
|
4133
|
+
type: "drop",
|
|
4134
|
+
listener: function listener(event2) {
|
|
4135
|
+
state.current = {
|
|
4136
|
+
dropTargets: state.current.dropTargets,
|
|
4137
|
+
input: getInput(event2)
|
|
4138
|
+
};
|
|
4139
|
+
if (!state.current.dropTargets.length) {
|
|
4140
|
+
cancel();
|
|
4141
|
+
return;
|
|
4142
|
+
}
|
|
4143
|
+
event2.preventDefault();
|
|
4144
|
+
setDropEffectOnEvent({
|
|
4145
|
+
event: event2,
|
|
4146
|
+
current: state.current.dropTargets
|
|
4147
|
+
});
|
|
4148
|
+
dispatch.drop({
|
|
4149
|
+
current: state.current,
|
|
4150
|
+
// When dropping something native, we need to extract the latest
|
|
4151
|
+
// `.items` from the "drop" event as it is now accessible
|
|
4152
|
+
updatedSourcePayload: dragType.type === "external" ? dragType.getDropPayload(event2) : null
|
|
4153
|
+
});
|
|
4154
|
+
finish();
|
|
4155
|
+
}
|
|
4156
|
+
}, {
|
|
4157
|
+
// "dragend" fires when on the drag source (eg a draggable element)
|
|
4158
|
+
// when the drag is finished.
|
|
4159
|
+
// "dragend" will fire after "drop" (if there was a successful drop)
|
|
4160
|
+
// "dragend" does not fire if the draggable source has been removed during the drag
|
|
4161
|
+
// or for external drag sources (eg files)
|
|
4162
|
+
// This "dragend" listener will not fire if there was a successful drop
|
|
4163
|
+
// as we will have already removed the event listener
|
|
4164
|
+
type: "dragend",
|
|
4165
|
+
listener: function listener(event2) {
|
|
4166
|
+
state.current = {
|
|
4167
|
+
dropTargets: state.current.dropTargets,
|
|
4168
|
+
input: getInput(event2)
|
|
4169
|
+
};
|
|
4170
|
+
cancel();
|
|
4171
|
+
}
|
|
4172
|
+
}].concat(_toConsumableArray(getBindingsForBrokenDrags({
|
|
4173
|
+
onDragEnd: cancel
|
|
4174
|
+
}))),
|
|
4175
|
+
// Once we have started a managed drag operation it is important that we see / own all drag events
|
|
4176
|
+
// We got one adoption bug pop up where some code was stopping (`event.stopPropagation()`)
|
|
4177
|
+
// all "drop" events in the bubble phase on the `document.body`.
|
|
4178
|
+
// This meant that we never saw the "drop" event.
|
|
4179
|
+
{
|
|
4180
|
+
capture: true
|
|
4181
|
+
}
|
|
4182
|
+
);
|
|
4183
|
+
dispatch.start({
|
|
4184
|
+
nativeSetDragImage: getNativeSetDragImage(event)
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
function setDropEffectOnEvent(_ref3) {
|
|
4188
|
+
var _current$;
|
|
4189
|
+
var event = _ref3.event, current = _ref3.current;
|
|
4190
|
+
var innerMost = (_current$ = current[0]) === null || _current$ === void 0 ? void 0 : _current$.dropEffect;
|
|
4191
|
+
if (innerMost != null && event.dataTransfer) {
|
|
4192
|
+
event.dataTransfer.dropEffect = innerMost;
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
function getStartLocation(_ref4) {
|
|
4196
|
+
var event = _ref4.event, dragType = _ref4.dragType, getDropTargetsOver = _ref4.getDropTargetsOver;
|
|
4197
|
+
var input = getInput(event);
|
|
4198
|
+
if (dragType.startedFrom === "external") {
|
|
4199
|
+
return {
|
|
4200
|
+
input,
|
|
4201
|
+
dropTargets: []
|
|
4202
|
+
};
|
|
4203
|
+
}
|
|
4204
|
+
var dropTargets = getDropTargetsOver({
|
|
4205
|
+
input,
|
|
4206
|
+
source: dragType.payload,
|
|
4207
|
+
target: event.target,
|
|
4208
|
+
current: []
|
|
4209
|
+
});
|
|
4210
|
+
return {
|
|
4211
|
+
input,
|
|
4212
|
+
dropTargets
|
|
4213
|
+
};
|
|
4214
|
+
}
|
|
4215
|
+
var lifecycle = {
|
|
4216
|
+
canStart,
|
|
4217
|
+
start
|
|
4218
|
+
};
|
|
4219
|
+
|
|
4220
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js
|
|
4221
|
+
var ledger = /* @__PURE__ */ new Map();
|
|
4222
|
+
function registerUsage(_ref) {
|
|
4223
|
+
var typeKey = _ref.typeKey, mount2 = _ref.mount;
|
|
4224
|
+
var entry = ledger.get(typeKey);
|
|
4225
|
+
if (entry) {
|
|
4226
|
+
entry.usageCount++;
|
|
4227
|
+
return entry;
|
|
4228
|
+
}
|
|
4229
|
+
var initial = {
|
|
4230
|
+
typeKey,
|
|
4231
|
+
unmount: mount2(),
|
|
4232
|
+
usageCount: 1
|
|
4233
|
+
};
|
|
4234
|
+
ledger.set(typeKey, initial);
|
|
4235
|
+
return initial;
|
|
4236
|
+
}
|
|
4237
|
+
function register(args) {
|
|
4238
|
+
var entry = registerUsage(args);
|
|
4239
|
+
return function unregister() {
|
|
4240
|
+
entry.usageCount--;
|
|
4241
|
+
if (entry.usageCount > 0) {
|
|
4242
|
+
return;
|
|
4243
|
+
}
|
|
4244
|
+
entry.unmount();
|
|
4245
|
+
ledger.delete(args.typeKey);
|
|
4246
|
+
};
|
|
4247
|
+
}
|
|
4248
|
+
|
|
4249
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js
|
|
4250
|
+
function combine() {
|
|
4251
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4252
|
+
fns[_key] = arguments[_key];
|
|
4253
|
+
}
|
|
4254
|
+
return function cleanup() {
|
|
4255
|
+
fns.forEach(function(fn) {
|
|
4256
|
+
return fn();
|
|
4257
|
+
});
|
|
4258
|
+
};
|
|
4259
|
+
}
|
|
4260
|
+
|
|
4261
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js
|
|
4262
|
+
function addAttribute(element, _ref) {
|
|
4263
|
+
var attribute = _ref.attribute, value = _ref.value;
|
|
4264
|
+
element.setAttribute(attribute, value);
|
|
4265
|
+
return function() {
|
|
4266
|
+
return element.removeAttribute(attribute);
|
|
4267
|
+
};
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js
|
|
4271
|
+
function ownKeys2(e, r) {
|
|
4272
|
+
var t = Object.keys(e);
|
|
4273
|
+
if (Object.getOwnPropertySymbols) {
|
|
4274
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4275
|
+
r && (o = o.filter(function(r2) {
|
|
4276
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4277
|
+
})), t.push.apply(t, o);
|
|
4278
|
+
}
|
|
4279
|
+
return t;
|
|
4280
|
+
}
|
|
4281
|
+
function _objectSpread2(e) {
|
|
4282
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4283
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4284
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r2) {
|
|
4285
|
+
_defineProperty(e, r2, t[r2]);
|
|
4286
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r2) {
|
|
4287
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
return e;
|
|
4291
|
+
}
|
|
4292
|
+
function _createForOfIteratorHelper(r, e) {
|
|
4293
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4294
|
+
if (!t) {
|
|
4295
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray2(r)) || e && r && "number" == typeof r.length) {
|
|
4296
|
+
t && (r = t);
|
|
4297
|
+
var _n = 0, F = function F2() {
|
|
4298
|
+
};
|
|
4299
|
+
return { s: F, n: function n() {
|
|
4300
|
+
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
4301
|
+
}, e: function e2(r2) {
|
|
4302
|
+
throw r2;
|
|
4303
|
+
}, f: F };
|
|
4304
|
+
}
|
|
4305
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4306
|
+
}
|
|
4307
|
+
var o, a = true, u = false;
|
|
4308
|
+
return { s: function s() {
|
|
4309
|
+
t = t.call(r);
|
|
4310
|
+
}, n: function n() {
|
|
4311
|
+
var r2 = t.next();
|
|
4312
|
+
return a = r2.done, r2;
|
|
4313
|
+
}, e: function e2(r2) {
|
|
4314
|
+
u = true, o = r2;
|
|
4315
|
+
}, f: function f() {
|
|
4316
|
+
try {
|
|
4317
|
+
a || null == t.return || t.return();
|
|
4318
|
+
} finally {
|
|
4319
|
+
if (u) throw o;
|
|
4320
|
+
}
|
|
4321
|
+
} };
|
|
4322
|
+
}
|
|
4323
|
+
function _unsupportedIterableToArray2(r, a) {
|
|
4324
|
+
if (r) {
|
|
4325
|
+
if ("string" == typeof r) return _arrayLikeToArray2(r, a);
|
|
4326
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
4327
|
+
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;
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
function _arrayLikeToArray2(r, a) {
|
|
4331
|
+
(null == a || a > r.length) && (a = r.length);
|
|
4332
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4333
|
+
return n;
|
|
4334
|
+
}
|
|
4335
|
+
function copyReverse(array) {
|
|
4336
|
+
return array.slice(0).reverse();
|
|
4337
|
+
}
|
|
4338
|
+
function makeDropTarget(_ref) {
|
|
4339
|
+
var typeKey = _ref.typeKey, defaultDropEffect = _ref.defaultDropEffect;
|
|
4340
|
+
var registry = /* @__PURE__ */ new WeakMap();
|
|
4341
|
+
var dropTargetDataAtt = "data-drop-target-for-".concat(typeKey);
|
|
4342
|
+
var dropTargetSelector = "[".concat(dropTargetDataAtt, "]");
|
|
4343
|
+
function addToRegistry2(args) {
|
|
4344
|
+
registry.set(args.element, args);
|
|
4345
|
+
return function() {
|
|
4346
|
+
return registry.delete(args.element);
|
|
4347
|
+
};
|
|
4348
|
+
}
|
|
4349
|
+
function dropTargetForConsumers(args) {
|
|
4350
|
+
if (true) {
|
|
4351
|
+
var existing = registry.get(args.element);
|
|
4352
|
+
if (existing) {
|
|
4353
|
+
console.warn("You have already registered a [".concat(typeKey, "] dropTarget on the same element"), {
|
|
4354
|
+
existing,
|
|
4355
|
+
proposed: args
|
|
4356
|
+
});
|
|
4357
|
+
}
|
|
4358
|
+
if (args.element instanceof HTMLIFrameElement) {
|
|
4359
|
+
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());
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
var cleanup = combine(addAttribute(args.element, {
|
|
4363
|
+
attribute: dropTargetDataAtt,
|
|
4364
|
+
value: "true"
|
|
4365
|
+
}), addToRegistry2(args));
|
|
4366
|
+
return once(cleanup);
|
|
4367
|
+
}
|
|
4368
|
+
function getActualDropTargets(_ref2) {
|
|
4369
|
+
var _args$getData, _args$getData2, _args$getDropEffect, _args$getDropEffect2;
|
|
4370
|
+
var source = _ref2.source, target = _ref2.target, input = _ref2.input, _ref2$result = _ref2.result, result = _ref2$result === void 0 ? [] : _ref2$result;
|
|
4371
|
+
if (target == null) {
|
|
4372
|
+
return result;
|
|
4373
|
+
}
|
|
4374
|
+
if (!(target instanceof Element)) {
|
|
4375
|
+
if (target instanceof Node) {
|
|
4376
|
+
return getActualDropTargets({
|
|
4377
|
+
source,
|
|
4378
|
+
target: target.parentElement,
|
|
4379
|
+
input,
|
|
4380
|
+
result
|
|
4381
|
+
});
|
|
4382
|
+
}
|
|
4383
|
+
return result;
|
|
4384
|
+
}
|
|
4385
|
+
var closest = target.closest(dropTargetSelector);
|
|
4386
|
+
if (closest == null) {
|
|
4387
|
+
return result;
|
|
4388
|
+
}
|
|
4389
|
+
var args = registry.get(closest);
|
|
4390
|
+
if (args == null) {
|
|
4391
|
+
return result;
|
|
4392
|
+
}
|
|
4393
|
+
var feedback = {
|
|
4394
|
+
input,
|
|
4395
|
+
source,
|
|
4396
|
+
element: args.element
|
|
4397
|
+
};
|
|
4398
|
+
if (args.canDrop && !args.canDrop(feedback)) {
|
|
4399
|
+
return getActualDropTargets({
|
|
4400
|
+
source,
|
|
4401
|
+
target: args.element.parentElement,
|
|
4402
|
+
input,
|
|
4403
|
+
result
|
|
4404
|
+
});
|
|
4405
|
+
}
|
|
4406
|
+
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 : {};
|
|
4407
|
+
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;
|
|
4408
|
+
var record = {
|
|
4409
|
+
data,
|
|
4410
|
+
element: args.element,
|
|
4411
|
+
dropEffect,
|
|
4412
|
+
// we are collecting _actual_ drop targets, so these are
|
|
4413
|
+
// being applied _not_ due to stickiness
|
|
4414
|
+
isActiveDueToStickiness: false
|
|
4415
|
+
};
|
|
4416
|
+
return getActualDropTargets({
|
|
4417
|
+
source,
|
|
4418
|
+
target: args.element.parentElement,
|
|
4419
|
+
input,
|
|
4420
|
+
// Using bubble ordering. Same ordering as `event.getPath()`
|
|
4421
|
+
result: [].concat(_toConsumableArray(result), [record])
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
function notifyCurrent(_ref3) {
|
|
4425
|
+
var eventName = _ref3.eventName, payload = _ref3.payload;
|
|
4426
|
+
var _iterator = _createForOfIteratorHelper(payload.location.current.dropTargets), _step;
|
|
4427
|
+
try {
|
|
4428
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
4429
|
+
var _entry$eventName;
|
|
4430
|
+
var record = _step.value;
|
|
4431
|
+
var entry = registry.get(record.element);
|
|
4432
|
+
var args = _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
4433
|
+
self: record
|
|
4434
|
+
});
|
|
4435
|
+
entry === null || entry === void 0 || (_entry$eventName = entry[eventName]) === null || _entry$eventName === void 0 || _entry$eventName.call(
|
|
4436
|
+
entry,
|
|
4437
|
+
// I cannot seem to get the types right here.
|
|
4438
|
+
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
4439
|
+
// @ts-expect-error
|
|
4440
|
+
args
|
|
4441
|
+
);
|
|
4442
|
+
}
|
|
4443
|
+
} catch (err) {
|
|
4444
|
+
_iterator.e(err);
|
|
4445
|
+
} finally {
|
|
4446
|
+
_iterator.f();
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
var actions = {
|
|
4450
|
+
onGenerateDragPreview: notifyCurrent,
|
|
4451
|
+
onDrag: notifyCurrent,
|
|
4452
|
+
onDragStart: notifyCurrent,
|
|
4453
|
+
onDrop: notifyCurrent,
|
|
4454
|
+
onDropTargetChange: function onDropTargetChange(_ref4) {
|
|
4455
|
+
var payload = _ref4.payload;
|
|
4456
|
+
var isCurrent = new Set(payload.location.current.dropTargets.map(function(record2) {
|
|
4457
|
+
return record2.element;
|
|
4458
|
+
}));
|
|
4459
|
+
var visited = /* @__PURE__ */ new Set();
|
|
4460
|
+
var _iterator2 = _createForOfIteratorHelper(payload.location.previous.dropTargets), _step2;
|
|
4461
|
+
try {
|
|
4462
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
|
|
4463
|
+
var _entry$onDropTargetCh;
|
|
4464
|
+
var record = _step2.value;
|
|
4465
|
+
visited.add(record.element);
|
|
4466
|
+
var entry = registry.get(record.element);
|
|
4467
|
+
var isOver = isCurrent.has(record.element);
|
|
4468
|
+
var args = _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
4469
|
+
self: record
|
|
4470
|
+
});
|
|
4471
|
+
entry === null || entry === void 0 || (_entry$onDropTargetCh = entry.onDropTargetChange) === null || _entry$onDropTargetCh === void 0 || _entry$onDropTargetCh.call(entry, args);
|
|
4472
|
+
if (!isOver) {
|
|
4473
|
+
var _entry$onDragLeave;
|
|
4474
|
+
entry === null || entry === void 0 || (_entry$onDragLeave = entry.onDragLeave) === null || _entry$onDragLeave === void 0 || _entry$onDragLeave.call(entry, args);
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
} catch (err) {
|
|
4478
|
+
_iterator2.e(err);
|
|
4479
|
+
} finally {
|
|
4480
|
+
_iterator2.f();
|
|
4481
|
+
}
|
|
4482
|
+
var _iterator3 = _createForOfIteratorHelper(payload.location.current.dropTargets), _step3;
|
|
4483
|
+
try {
|
|
4484
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
|
4485
|
+
var _entry$onDropTargetCh2, _entry$onDragEnter;
|
|
4486
|
+
var _record = _step3.value;
|
|
4487
|
+
if (visited.has(_record.element)) {
|
|
4488
|
+
continue;
|
|
4489
|
+
}
|
|
4490
|
+
var _args = _objectSpread2(_objectSpread2({}, payload), {}, {
|
|
4491
|
+
self: _record
|
|
4492
|
+
});
|
|
4493
|
+
var _entry = registry.get(_record.element);
|
|
4494
|
+
_entry === null || _entry === void 0 || (_entry$onDropTargetCh2 = _entry.onDropTargetChange) === null || _entry$onDropTargetCh2 === void 0 || _entry$onDropTargetCh2.call(_entry, _args);
|
|
4495
|
+
_entry === null || _entry === void 0 || (_entry$onDragEnter = _entry.onDragEnter) === null || _entry$onDragEnter === void 0 || _entry$onDragEnter.call(_entry, _args);
|
|
4496
|
+
}
|
|
4497
|
+
} catch (err) {
|
|
4498
|
+
_iterator3.e(err);
|
|
4499
|
+
} finally {
|
|
4500
|
+
_iterator3.f();
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
};
|
|
4504
|
+
function dispatchEvent(args) {
|
|
4505
|
+
actions[args.eventName](args);
|
|
4506
|
+
}
|
|
4507
|
+
function getIsOver(_ref5) {
|
|
4508
|
+
var source = _ref5.source, target = _ref5.target, input = _ref5.input, current = _ref5.current;
|
|
4509
|
+
var actual = getActualDropTargets({
|
|
4510
|
+
source,
|
|
4511
|
+
target,
|
|
4512
|
+
input
|
|
4513
|
+
});
|
|
4514
|
+
if (actual.length >= current.length) {
|
|
4515
|
+
return actual;
|
|
4516
|
+
}
|
|
4517
|
+
var lastCaptureOrdered = copyReverse(current);
|
|
4518
|
+
var actualCaptureOrdered = copyReverse(actual);
|
|
4519
|
+
var resultCaptureOrdered = [];
|
|
4520
|
+
for (var index = 0; index < lastCaptureOrdered.length; index++) {
|
|
4521
|
+
var _argsForLast$getIsSti;
|
|
4522
|
+
var last = lastCaptureOrdered[index];
|
|
4523
|
+
var fresh = actualCaptureOrdered[index];
|
|
4524
|
+
if (fresh != null) {
|
|
4525
|
+
resultCaptureOrdered.push(fresh);
|
|
4526
|
+
continue;
|
|
4527
|
+
}
|
|
4528
|
+
var parent = resultCaptureOrdered[index - 1];
|
|
4529
|
+
var lastParent = lastCaptureOrdered[index - 1];
|
|
4530
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.element) !== (lastParent === null || lastParent === void 0 ? void 0 : lastParent.element)) {
|
|
4531
|
+
break;
|
|
4532
|
+
}
|
|
4533
|
+
var argsForLast = registry.get(last.element);
|
|
4534
|
+
if (!argsForLast) {
|
|
4535
|
+
break;
|
|
4536
|
+
}
|
|
4537
|
+
var feedback = {
|
|
4538
|
+
input,
|
|
4539
|
+
source,
|
|
4540
|
+
element: argsForLast.element
|
|
4541
|
+
};
|
|
4542
|
+
if (argsForLast.canDrop && !argsForLast.canDrop(feedback)) {
|
|
4543
|
+
break;
|
|
4544
|
+
}
|
|
4545
|
+
if (!((_argsForLast$getIsSti = argsForLast.getIsSticky) !== null && _argsForLast$getIsSti !== void 0 && _argsForLast$getIsSti.call(argsForLast, feedback))) {
|
|
4546
|
+
break;
|
|
4547
|
+
}
|
|
4548
|
+
resultCaptureOrdered.push(_objectSpread2(_objectSpread2({}, last), {}, {
|
|
4549
|
+
// making it clear to consumers this drop target is active due to stickiness
|
|
4550
|
+
isActiveDueToStickiness: true
|
|
4551
|
+
}));
|
|
4552
|
+
}
|
|
4553
|
+
return copyReverse(resultCaptureOrdered);
|
|
4554
|
+
}
|
|
4555
|
+
return {
|
|
4556
|
+
dropTargetForConsumers,
|
|
4557
|
+
getIsOver,
|
|
4558
|
+
dispatchEvent
|
|
4559
|
+
};
|
|
4560
|
+
}
|
|
4561
|
+
|
|
4562
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js
|
|
4563
|
+
function _createForOfIteratorHelper2(r, e) {
|
|
4564
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4565
|
+
if (!t) {
|
|
4566
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray3(r)) || e && r && "number" == typeof r.length) {
|
|
4567
|
+
t && (r = t);
|
|
4568
|
+
var _n = 0, F = function F2() {
|
|
4569
|
+
};
|
|
4570
|
+
return { s: F, n: function n() {
|
|
4571
|
+
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
4572
|
+
}, e: function e2(r2) {
|
|
4573
|
+
throw r2;
|
|
4574
|
+
}, f: F };
|
|
4575
|
+
}
|
|
4576
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4577
|
+
}
|
|
4578
|
+
var o, a = true, u = false;
|
|
4579
|
+
return { s: function s() {
|
|
4580
|
+
t = t.call(r);
|
|
4581
|
+
}, n: function n() {
|
|
4582
|
+
var r2 = t.next();
|
|
4583
|
+
return a = r2.done, r2;
|
|
4584
|
+
}, e: function e2(r2) {
|
|
4585
|
+
u = true, o = r2;
|
|
4586
|
+
}, f: function f() {
|
|
4587
|
+
try {
|
|
4588
|
+
a || null == t.return || t.return();
|
|
4589
|
+
} finally {
|
|
4590
|
+
if (u) throw o;
|
|
4591
|
+
}
|
|
4592
|
+
} };
|
|
4593
|
+
}
|
|
4594
|
+
function _unsupportedIterableToArray3(r, a) {
|
|
4595
|
+
if (r) {
|
|
4596
|
+
if ("string" == typeof r) return _arrayLikeToArray3(r, a);
|
|
4597
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
4598
|
+
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;
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
function _arrayLikeToArray3(r, a) {
|
|
4602
|
+
(null == a || a > r.length) && (a = r.length);
|
|
4603
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4604
|
+
return n;
|
|
4605
|
+
}
|
|
4606
|
+
function ownKeys3(e, r) {
|
|
4607
|
+
var t = Object.keys(e);
|
|
4608
|
+
if (Object.getOwnPropertySymbols) {
|
|
4609
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4610
|
+
r && (o = o.filter(function(r2) {
|
|
4611
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4612
|
+
})), t.push.apply(t, o);
|
|
4613
|
+
}
|
|
4614
|
+
return t;
|
|
4615
|
+
}
|
|
4616
|
+
function _objectSpread3(e) {
|
|
4617
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4618
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4619
|
+
r % 2 ? ownKeys3(Object(t), true).forEach(function(r2) {
|
|
4620
|
+
_defineProperty(e, r2, t[r2]);
|
|
4621
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r2) {
|
|
4622
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4623
|
+
});
|
|
4624
|
+
}
|
|
4625
|
+
return e;
|
|
4626
|
+
}
|
|
4627
|
+
function makeMonitor() {
|
|
4628
|
+
var registry = /* @__PURE__ */ new Set();
|
|
4629
|
+
var dragging = null;
|
|
4630
|
+
function tryAddToActive(monitor) {
|
|
4631
|
+
if (!dragging) {
|
|
4632
|
+
return;
|
|
4633
|
+
}
|
|
4634
|
+
if (!monitor.canMonitor || monitor.canMonitor(dragging.canMonitorArgs)) {
|
|
4635
|
+
dragging.active.add(monitor);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
function monitorForConsumers(args) {
|
|
4639
|
+
var entry = _objectSpread3({}, args);
|
|
4640
|
+
registry.add(entry);
|
|
4641
|
+
tryAddToActive(entry);
|
|
4642
|
+
function cleanup() {
|
|
4643
|
+
registry.delete(entry);
|
|
4644
|
+
if (dragging) {
|
|
4645
|
+
dragging.active.delete(entry);
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
return once(cleanup);
|
|
4649
|
+
}
|
|
4650
|
+
function dispatchEvent(_ref) {
|
|
4651
|
+
var eventName = _ref.eventName, payload = _ref.payload;
|
|
4652
|
+
if (eventName === "onGenerateDragPreview") {
|
|
4653
|
+
dragging = {
|
|
4654
|
+
canMonitorArgs: {
|
|
4655
|
+
initial: payload.location.initial,
|
|
4656
|
+
source: payload.source
|
|
4657
|
+
},
|
|
4658
|
+
active: /* @__PURE__ */ new Set()
|
|
4659
|
+
};
|
|
4660
|
+
var _iterator = _createForOfIteratorHelper2(registry), _step;
|
|
4661
|
+
try {
|
|
4662
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
4663
|
+
var monitor = _step.value;
|
|
4664
|
+
tryAddToActive(monitor);
|
|
4665
|
+
}
|
|
4666
|
+
} catch (err) {
|
|
4667
|
+
_iterator.e(err);
|
|
4668
|
+
} finally {
|
|
4669
|
+
_iterator.f();
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4672
|
+
if (!dragging) {
|
|
4673
|
+
return;
|
|
4674
|
+
}
|
|
4675
|
+
var active = Array.from(dragging.active);
|
|
4676
|
+
for (var _i = 0, _active = active; _i < _active.length; _i++) {
|
|
4677
|
+
var _monitor = _active[_i];
|
|
4678
|
+
if (dragging.active.has(_monitor)) {
|
|
4679
|
+
var _monitor$eventName;
|
|
4680
|
+
(_monitor$eventName = _monitor[eventName]) === null || _monitor$eventName === void 0 || _monitor$eventName.call(_monitor, payload);
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
if (eventName === "onDrop") {
|
|
4684
|
+
dragging.active.clear();
|
|
4685
|
+
dragging = null;
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
return {
|
|
4689
|
+
dispatchEvent,
|
|
4690
|
+
monitorForConsumers
|
|
4691
|
+
};
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js
|
|
4695
|
+
function makeAdapter(_ref) {
|
|
4696
|
+
var typeKey = _ref.typeKey, mount2 = _ref.mount, dispatchEventToSource2 = _ref.dispatchEventToSource, onPostDispatch = _ref.onPostDispatch, defaultDropEffect = _ref.defaultDropEffect;
|
|
4697
|
+
var monitorAPI = makeMonitor();
|
|
4698
|
+
var dropTargetAPI = makeDropTarget({
|
|
4699
|
+
typeKey,
|
|
4700
|
+
defaultDropEffect
|
|
4701
|
+
});
|
|
4702
|
+
function dispatchEvent(args) {
|
|
4703
|
+
dispatchEventToSource2 === null || dispatchEventToSource2 === void 0 || dispatchEventToSource2(args);
|
|
4704
|
+
dropTargetAPI.dispatchEvent(args);
|
|
4705
|
+
monitorAPI.dispatchEvent(args);
|
|
4706
|
+
onPostDispatch === null || onPostDispatch === void 0 || onPostDispatch(args);
|
|
4707
|
+
}
|
|
4708
|
+
function start2(_ref2) {
|
|
4709
|
+
var event = _ref2.event, dragType = _ref2.dragType;
|
|
4710
|
+
lifecycle.start({
|
|
4711
|
+
event,
|
|
4712
|
+
dragType,
|
|
4713
|
+
getDropTargetsOver: dropTargetAPI.getIsOver,
|
|
4714
|
+
dispatchEvent
|
|
4715
|
+
});
|
|
4716
|
+
}
|
|
4717
|
+
function registerUsage2() {
|
|
4718
|
+
function mountAdapter() {
|
|
4719
|
+
var api2 = {
|
|
4720
|
+
canStart: lifecycle.canStart,
|
|
4721
|
+
start: start2
|
|
4722
|
+
};
|
|
4723
|
+
return mount2(api2);
|
|
4724
|
+
}
|
|
4725
|
+
return register({
|
|
4726
|
+
typeKey,
|
|
4727
|
+
mount: mountAdapter
|
|
4728
|
+
});
|
|
4729
|
+
}
|
|
4730
|
+
return {
|
|
4731
|
+
registerUsage: registerUsage2,
|
|
4732
|
+
dropTarget: dropTargetAPI.dropTargetForConsumers,
|
|
4733
|
+
monitor: monitorAPI.monitorForConsumers
|
|
4734
|
+
};
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js
|
|
4738
|
+
var isAndroid = once(function isAndroid2() {
|
|
4739
|
+
return navigator.userAgent.toLocaleLowerCase().includes("android");
|
|
4740
|
+
});
|
|
4741
|
+
var androidFallbackText = "pdnd:android-fallback";
|
|
4742
|
+
|
|
4743
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js
|
|
4744
|
+
var textMediaType = "text/plain";
|
|
4745
|
+
|
|
4746
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/url-media-type.js
|
|
4747
|
+
var URLMediaType = "text/uri-list";
|
|
4748
|
+
|
|
4749
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js
|
|
4750
|
+
var elementAdapterNativeDataKey = "application/vnd.pdnd";
|
|
4751
|
+
|
|
4752
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js
|
|
4753
|
+
var draggableRegistry = /* @__PURE__ */ new WeakMap();
|
|
4754
|
+
function addToRegistry(args) {
|
|
4755
|
+
draggableRegistry.set(args.element, args);
|
|
4756
|
+
return function cleanup() {
|
|
4757
|
+
draggableRegistry.delete(args.element);
|
|
4758
|
+
};
|
|
4759
|
+
}
|
|
4760
|
+
var honeyPotFix = makeHoneyPotFix();
|
|
4761
|
+
var adapter = makeAdapter({
|
|
4762
|
+
typeKey: "element",
|
|
4763
|
+
defaultDropEffect: "move",
|
|
4764
|
+
mount: function mount(api2) {
|
|
4765
|
+
return combine(honeyPotFix.bindEvents(), (0, import_bind_event_listener4.bind)(document, {
|
|
4766
|
+
type: "dragstart",
|
|
4767
|
+
listener: function listener(event) {
|
|
4768
|
+
var _entry$dragHandle, _entry$getInitialData, _entry$getInitialData2, _entry$dragHandle2, _entry$getInitialData3, _entry$getInitialData4;
|
|
4769
|
+
if (!api2.canStart(event)) {
|
|
4770
|
+
return;
|
|
4771
|
+
}
|
|
4772
|
+
if (event.defaultPrevented) {
|
|
4773
|
+
return;
|
|
4774
|
+
}
|
|
4775
|
+
if (!event.dataTransfer) {
|
|
4776
|
+
if (true) {
|
|
4777
|
+
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, ""));
|
|
4778
|
+
}
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
4781
|
+
var target = event.target;
|
|
4782
|
+
if (!(target instanceof HTMLElement)) {
|
|
4783
|
+
return;
|
|
4784
|
+
}
|
|
4785
|
+
var entry = draggableRegistry.get(target);
|
|
4786
|
+
if (!entry) {
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
var input = getInput(event);
|
|
4790
|
+
var feedback = {
|
|
4791
|
+
element: entry.element,
|
|
4792
|
+
dragHandle: (_entry$dragHandle = entry.dragHandle) !== null && _entry$dragHandle !== void 0 ? _entry$dragHandle : null,
|
|
4793
|
+
input
|
|
4794
|
+
};
|
|
4795
|
+
if (entry.canDrag && !entry.canDrag(feedback)) {
|
|
4796
|
+
event.preventDefault();
|
|
4797
|
+
return;
|
|
4798
|
+
}
|
|
4799
|
+
if (entry.dragHandle) {
|
|
4800
|
+
var over = getElementFromPointWithoutHoneypot({
|
|
4801
|
+
x: input.clientX,
|
|
4802
|
+
y: input.clientY
|
|
4803
|
+
});
|
|
4804
|
+
if (!entry.dragHandle.contains(over)) {
|
|
4805
|
+
event.preventDefault();
|
|
4806
|
+
return;
|
|
4807
|
+
}
|
|
4808
|
+
}
|
|
4809
|
+
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;
|
|
4810
|
+
if (nativeData) {
|
|
4811
|
+
for (var _i = 0, _Object$entries = Object.entries(nativeData); _i < _Object$entries.length; _i++) {
|
|
4812
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], data = _Object$entries$_i[1];
|
|
4813
|
+
event.dataTransfer.setData(key, data !== null && data !== void 0 ? data : "");
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
if (isAndroid() && !event.dataTransfer.types.includes(textMediaType) && !event.dataTransfer.types.includes(URLMediaType)) {
|
|
4817
|
+
event.dataTransfer.setData(textMediaType, androidFallbackText);
|
|
4818
|
+
}
|
|
4819
|
+
event.dataTransfer.setData(elementAdapterNativeDataKey, "");
|
|
4820
|
+
var payload = {
|
|
4821
|
+
element: entry.element,
|
|
4822
|
+
dragHandle: (_entry$dragHandle2 = entry.dragHandle) !== null && _entry$dragHandle2 !== void 0 ? _entry$dragHandle2 : null,
|
|
4823
|
+
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 : {}
|
|
4824
|
+
};
|
|
4825
|
+
var dragType = {
|
|
4826
|
+
type: "element",
|
|
4827
|
+
payload,
|
|
4828
|
+
startedFrom: "internal"
|
|
4829
|
+
};
|
|
4830
|
+
api2.start({
|
|
4831
|
+
event,
|
|
4832
|
+
dragType
|
|
4833
|
+
});
|
|
4834
|
+
}
|
|
4835
|
+
}));
|
|
4836
|
+
},
|
|
4837
|
+
dispatchEventToSource: function dispatchEventToSource(_ref) {
|
|
4838
|
+
var _draggableRegistry$ge, _draggableRegistry$ge2;
|
|
4839
|
+
var eventName = _ref.eventName, payload = _ref.payload;
|
|
4840
|
+
(_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(
|
|
4841
|
+
_draggableRegistry$ge,
|
|
4842
|
+
// I cannot seem to get the types right here.
|
|
4843
|
+
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
4844
|
+
// @ts-expect-error
|
|
4845
|
+
payload
|
|
4846
|
+
);
|
|
4847
|
+
},
|
|
4848
|
+
onPostDispatch: honeyPotFix.getOnPostDispatch()
|
|
4849
|
+
});
|
|
4850
|
+
var dropTargetForElements = adapter.dropTarget;
|
|
4851
|
+
var monitorForElements = adapter.monitor;
|
|
4852
|
+
function draggable(args) {
|
|
4853
|
+
if (true) {
|
|
4854
|
+
if (args.dragHandle && !args.element.contains(args.dragHandle)) {
|
|
4855
|
+
console.warn("Drag handle element must be contained in draggable element", {
|
|
4856
|
+
element: args.element,
|
|
4857
|
+
dragHandle: args.dragHandle
|
|
4858
|
+
});
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
if (true) {
|
|
4862
|
+
var existing = draggableRegistry.get(args.element);
|
|
4863
|
+
if (existing) {
|
|
4864
|
+
console.warn("You have already registered a `draggable` on the same element", {
|
|
4865
|
+
existing,
|
|
4866
|
+
proposed: args
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
var cleanup = combine(
|
|
4871
|
+
// making the draggable register the adapter rather than drop targets
|
|
4872
|
+
// this is because you *must* have a draggable element to start a drag
|
|
4873
|
+
// but you _might_ not have any drop targets immediately
|
|
4874
|
+
// (You might create drop targets async)
|
|
4875
|
+
adapter.registerUsage(),
|
|
4876
|
+
addToRegistry(args),
|
|
4877
|
+
addAttribute(args.element, {
|
|
4878
|
+
attribute: "draggable",
|
|
4879
|
+
value: "true"
|
|
4880
|
+
})
|
|
4881
|
+
);
|
|
4882
|
+
return once(cleanup);
|
|
4883
|
+
}
|
|
4884
|
+
|
|
4885
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/engagement-history.js
|
|
4886
|
+
var ledger2 = /* @__PURE__ */ new Map();
|
|
4887
|
+
var requested = /* @__PURE__ */ new Set();
|
|
4888
|
+
function markAndGetEngagement(element) {
|
|
4889
|
+
markEngagement(element);
|
|
4890
|
+
var entry = ledger2.get(element);
|
|
4891
|
+
if (entry) {
|
|
4892
|
+
return entry;
|
|
4893
|
+
}
|
|
4894
|
+
var fresh = {
|
|
4895
|
+
timeOfEngagementStart: Date.now()
|
|
4896
|
+
};
|
|
4897
|
+
ledger2.set(element, fresh);
|
|
4898
|
+
return fresh;
|
|
4899
|
+
}
|
|
4900
|
+
function markEngagement(element) {
|
|
4901
|
+
requested.add(element);
|
|
4902
|
+
}
|
|
4903
|
+
function clearUnusedEngagements(fn) {
|
|
4904
|
+
requested.clear();
|
|
4905
|
+
fn();
|
|
4906
|
+
ledger2.forEach(function(_, element) {
|
|
4907
|
+
if (!requested.has(element)) {
|
|
4908
|
+
ledger2.delete(element);
|
|
4909
|
+
}
|
|
4910
|
+
});
|
|
4911
|
+
requested.clear();
|
|
4912
|
+
}
|
|
4913
|
+
function clearEngagementHistory() {
|
|
4914
|
+
ledger2.clear();
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4917
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/scheduler.js
|
|
4918
|
+
var schedulers = /* @__PURE__ */ new Map();
|
|
4919
|
+
function getScheduler(monitor) {
|
|
4920
|
+
var scheduler = schedulers.get(monitor);
|
|
4921
|
+
if (scheduler) {
|
|
4922
|
+
return scheduler;
|
|
4923
|
+
}
|
|
4924
|
+
var created = makeScheduler(monitor);
|
|
4925
|
+
schedulers.set(monitor, created);
|
|
4926
|
+
return created;
|
|
4927
|
+
}
|
|
4928
|
+
function makeScheduler(monitor) {
|
|
4929
|
+
var state = {
|
|
4930
|
+
type: "idle"
|
|
4931
|
+
};
|
|
4932
|
+
var callbacks = [];
|
|
4933
|
+
function loop(timeLastFrameFinished) {
|
|
4934
|
+
if (state.type !== "running") {
|
|
4935
|
+
return;
|
|
4936
|
+
}
|
|
4937
|
+
var timeSinceLastFrame = timeLastFrameFinished - state.timeLastFrameFinished;
|
|
4938
|
+
var _state = state, latestArgs = _state.latestArgs;
|
|
4939
|
+
var underUsersPointer = getElementFromPointWithoutHoneypot({
|
|
4940
|
+
x: latestArgs.location.current.input.clientX,
|
|
4941
|
+
y: latestArgs.location.current.input.clientY
|
|
4942
|
+
});
|
|
4943
|
+
clearUnusedEngagements(function() {
|
|
4944
|
+
callbacks.forEach(function(onFrame) {
|
|
4945
|
+
return onFrame({
|
|
4946
|
+
underUsersPointer,
|
|
4947
|
+
latestArgs,
|
|
4948
|
+
timeSinceLastFrame
|
|
4949
|
+
});
|
|
4950
|
+
});
|
|
4951
|
+
});
|
|
4952
|
+
state.timeLastFrameFinished = timeLastFrameFinished;
|
|
4953
|
+
state.frameId = requestAnimationFrame(loop);
|
|
4954
|
+
}
|
|
4955
|
+
function reset() {
|
|
4956
|
+
if (state.type === "idle") {
|
|
4957
|
+
return;
|
|
4958
|
+
}
|
|
4959
|
+
cancelAnimationFrame(state.frameId);
|
|
4960
|
+
clearEngagementHistory();
|
|
4961
|
+
state = {
|
|
4962
|
+
type: "idle"
|
|
4963
|
+
};
|
|
4964
|
+
}
|
|
4965
|
+
function start2(args) {
|
|
4966
|
+
if (state.type !== "idle") {
|
|
4967
|
+
return;
|
|
4968
|
+
}
|
|
4969
|
+
state = {
|
|
4970
|
+
// Waiting a frame so we can accurately determine `timeSinceLastFrame`.
|
|
4971
|
+
type: "initializing",
|
|
4972
|
+
latestArgs: args,
|
|
4973
|
+
frameId: requestAnimationFrame(function(timeLastFrameFinished) {
|
|
4974
|
+
if (state.type !== "initializing") {
|
|
4975
|
+
return;
|
|
4976
|
+
}
|
|
4977
|
+
state = {
|
|
4978
|
+
type: "running",
|
|
4979
|
+
timeLastFrameFinished,
|
|
4980
|
+
latestArgs: state.latestArgs,
|
|
4981
|
+
frameId: requestAnimationFrame(loop)
|
|
4982
|
+
};
|
|
4983
|
+
})
|
|
4984
|
+
};
|
|
4985
|
+
}
|
|
4986
|
+
function update(args) {
|
|
4987
|
+
if (state.type === "idle") {
|
|
4988
|
+
start2(args);
|
|
4989
|
+
return;
|
|
4990
|
+
}
|
|
4991
|
+
state.latestArgs = args;
|
|
4992
|
+
}
|
|
4993
|
+
monitor({
|
|
4994
|
+
onDragStart: start2,
|
|
4995
|
+
onDropTargetChange: update,
|
|
4996
|
+
onDrag: update,
|
|
4997
|
+
onDrop: reset
|
|
4998
|
+
});
|
|
4999
|
+
var api2 = {
|
|
5000
|
+
onFrame: function onFrame(fn) {
|
|
5001
|
+
callbacks.push(fn);
|
|
5002
|
+
}
|
|
5003
|
+
};
|
|
5004
|
+
return api2;
|
|
5005
|
+
}
|
|
5006
|
+
|
|
5007
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/data-attributes.js
|
|
5008
|
+
var dataAttribute = "data-auto-scrollable";
|
|
5009
|
+
var selector = "[".concat(dataAttribute, '="true"]');
|
|
5010
|
+
function addScrollableAttribute(element) {
|
|
5011
|
+
element.setAttribute(dataAttribute, "true");
|
|
5012
|
+
return function() {
|
|
5013
|
+
return element.removeAttribute(dataAttribute);
|
|
5014
|
+
};
|
|
5015
|
+
}
|
|
5016
|
+
|
|
5017
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/configuration.js
|
|
5018
|
+
function ownKeys4(e, r) {
|
|
5019
|
+
var t = Object.keys(e);
|
|
5020
|
+
if (Object.getOwnPropertySymbols) {
|
|
5021
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
5022
|
+
r && (o = o.filter(function(r2) {
|
|
5023
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
5024
|
+
})), t.push.apply(t, o);
|
|
5025
|
+
}
|
|
5026
|
+
return t;
|
|
5027
|
+
}
|
|
5028
|
+
function _objectSpread4(e) {
|
|
5029
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
5030
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
5031
|
+
r % 2 ? ownKeys4(Object(t), true).forEach(function(r2) {
|
|
5032
|
+
_defineProperty(e, r2, t[r2]);
|
|
5033
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys4(Object(t)).forEach(function(r2) {
|
|
5034
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
5035
|
+
});
|
|
5036
|
+
}
|
|
5037
|
+
return e;
|
|
5038
|
+
}
|
|
5039
|
+
var baseConfig = {
|
|
5040
|
+
startHitboxAtPercentageRemainingOfElement: {
|
|
5041
|
+
top: 0.25,
|
|
5042
|
+
right: 0.25,
|
|
5043
|
+
bottom: 0.25,
|
|
5044
|
+
left: 0.25
|
|
5045
|
+
},
|
|
5046
|
+
maxScrollAtPercentageRemainingOfHitbox: {
|
|
5047
|
+
top: 0.5,
|
|
5048
|
+
right: 0.5,
|
|
5049
|
+
bottom: 0.5,
|
|
5050
|
+
left: 0.5
|
|
5051
|
+
},
|
|
5052
|
+
timeDampeningDurationMs: 400,
|
|
5053
|
+
// Too big and it's too easy to trigger auto scrolling
|
|
5054
|
+
// Too small and it's too hard 😅
|
|
5055
|
+
maxMainAxisHitboxSize: 180
|
|
5056
|
+
};
|
|
5057
|
+
var maxPixelScrollPerSecond = {
|
|
5058
|
+
// What the value would be if we were scrolling at 15px per frame at 60fps.
|
|
5059
|
+
// This is the default as it works well for most experiences.
|
|
5060
|
+
// In certain scenarios though it can feel a bit slow.
|
|
5061
|
+
standard: 15 * 60,
|
|
5062
|
+
// What the value would be if we were scrolling at 25px per frame at 60fps.
|
|
5063
|
+
// This is not the default as it feels too fast for a lot of experiences.
|
|
5064
|
+
fast: 25 * 60
|
|
5065
|
+
};
|
|
5066
|
+
function getInternalConfig(provided) {
|
|
5067
|
+
var _provided$maxScrollSp;
|
|
5068
|
+
return _objectSpread4(_objectSpread4({}, baseConfig), {}, {
|
|
5069
|
+
// only allowing limited control over the config at this stage
|
|
5070
|
+
maxPixelScrollPerSecond: maxPixelScrollPerSecond[(_provided$maxScrollSp = provided === null || provided === void 0 ? void 0 : provided.maxScrollSpeed) !== null && _provided$maxScrollSp !== void 0 ? _provided$maxScrollSp : "standard"]
|
|
5071
|
+
});
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/can-scroll-on-edge.js
|
|
5075
|
+
var canScrollOnEdge = {
|
|
5076
|
+
// Notes:
|
|
5077
|
+
//
|
|
5078
|
+
// 🌏 Chrome 115.0: uses fractional units for `scrollLeft` and `scrollTop`
|
|
5079
|
+
// (and fractional units don't reach true integer maximum when zoomed in / out)
|
|
5080
|
+
// 🍎 Safari 16.5.2: no fractional units
|
|
5081
|
+
// 🦊 Firefox 115.0: no fractional units
|
|
5082
|
+
// we have some scroll we can move backwards into
|
|
5083
|
+
top: function top(element) {
|
|
5084
|
+
return element.scrollTop > 0;
|
|
5085
|
+
},
|
|
5086
|
+
// We have some scroll we can move forward into
|
|
5087
|
+
right: function right(element) {
|
|
5088
|
+
return Math.ceil(element.scrollLeft) + element.clientWidth < element.scrollWidth;
|
|
5089
|
+
},
|
|
5090
|
+
// We have some scroll we can move forwards into
|
|
5091
|
+
bottom: function bottom(element) {
|
|
5092
|
+
return Math.ceil(element.scrollTop) + element.clientHeight < element.scrollHeight;
|
|
5093
|
+
},
|
|
5094
|
+
// we have some scroll we can move back into.
|
|
5095
|
+
left: function left(element) {
|
|
5096
|
+
return element.scrollLeft > 0;
|
|
5097
|
+
}
|
|
5098
|
+
};
|
|
5099
|
+
|
|
5100
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/edges.js
|
|
5101
|
+
var edges = ["top", "right", "bottom", "left"];
|
|
5102
|
+
var edgeAxisLookup = {
|
|
5103
|
+
top: "vertical",
|
|
5104
|
+
right: "horizontal",
|
|
5105
|
+
bottom: "vertical",
|
|
5106
|
+
left: "horizontal"
|
|
5107
|
+
};
|
|
5108
|
+
|
|
5109
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/axis.js
|
|
5110
|
+
var vertical = {
|
|
5111
|
+
start: "top",
|
|
5112
|
+
end: "bottom",
|
|
5113
|
+
point: "y",
|
|
5114
|
+
size: "height"
|
|
5115
|
+
};
|
|
5116
|
+
var horizontal = {
|
|
5117
|
+
start: "left",
|
|
5118
|
+
end: "right",
|
|
5119
|
+
point: "x",
|
|
5120
|
+
size: "width"
|
|
5121
|
+
};
|
|
5122
|
+
var axisLookup = {
|
|
5123
|
+
vertical: {
|
|
5124
|
+
mainAxis: vertical,
|
|
5125
|
+
crossAxis: horizontal
|
|
5126
|
+
},
|
|
5127
|
+
horizontal: {
|
|
5128
|
+
mainAxis: horizontal,
|
|
5129
|
+
crossAxis: vertical
|
|
5130
|
+
}
|
|
5131
|
+
};
|
|
5132
|
+
|
|
5133
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/side.js
|
|
5134
|
+
var mainAxisSideLookup = {
|
|
5135
|
+
top: "start",
|
|
5136
|
+
right: "end",
|
|
5137
|
+
bottom: "end",
|
|
5138
|
+
left: "start"
|
|
5139
|
+
};
|
|
5140
|
+
|
|
5141
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/get-over-element-hitbox.js
|
|
5142
|
+
function makeGetHitbox(_ref) {
|
|
5143
|
+
var edge = _ref.edge, axis = _ref.axis;
|
|
5144
|
+
return function hitbox(_ref2) {
|
|
5145
|
+
var clientRect = _ref2.clientRect, config = _ref2.config;
|
|
5146
|
+
var _axisLookup$axis = axisLookup[axis], mainAxis = _axisLookup$axis.mainAxis, crossAxis = _axisLookup$axis.crossAxis;
|
|
5147
|
+
var side = mainAxisSideLookup[edge];
|
|
5148
|
+
var mainAxisHitboxSize = Math.min(
|
|
5149
|
+
// scale the size of the hitbox down for smaller elements
|
|
5150
|
+
config.startHitboxAtPercentageRemainingOfElement[edge] * clientRect[mainAxis.size],
|
|
5151
|
+
// Don't let the hitbox grow too big for big elements
|
|
5152
|
+
config.maxMainAxisHitboxSize
|
|
5153
|
+
);
|
|
5154
|
+
return DOMRect.fromRect(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, mainAxis.point, side === "start" ? (
|
|
5155
|
+
// begin from the start edge and grow inwards
|
|
5156
|
+
clientRect[mainAxis.point]
|
|
5157
|
+
) : (
|
|
5158
|
+
// begin from inside the end edge and grow towards the end edge
|
|
5159
|
+
clientRect[mainAxis.point] + clientRect[mainAxis.size] - mainAxisHitboxSize
|
|
5160
|
+
)), crossAxis.point, clientRect[crossAxis.point]), mainAxis.size, mainAxisHitboxSize), crossAxis.size, clientRect[crossAxis.size]));
|
|
5161
|
+
};
|
|
5162
|
+
}
|
|
5163
|
+
var getOverElementHitbox = {
|
|
5164
|
+
top: makeGetHitbox({
|
|
5165
|
+
axis: "vertical",
|
|
5166
|
+
edge: "top"
|
|
5167
|
+
}),
|
|
5168
|
+
right: makeGetHitbox({
|
|
5169
|
+
axis: "horizontal",
|
|
5170
|
+
edge: "right"
|
|
5171
|
+
}),
|
|
5172
|
+
bottom: makeGetHitbox({
|
|
5173
|
+
axis: "vertical",
|
|
5174
|
+
edge: "bottom"
|
|
5175
|
+
}),
|
|
5176
|
+
left: makeGetHitbox({
|
|
5177
|
+
axis: "horizontal",
|
|
5178
|
+
edge: "left"
|
|
5179
|
+
})
|
|
5180
|
+
};
|
|
5181
|
+
|
|
5182
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/get-percentage-in-range.js
|
|
5183
|
+
function getPercentageInRange(_ref) {
|
|
5184
|
+
var startOfRange = _ref.startOfRange, endOfRange = _ref.endOfRange, value = _ref.value;
|
|
5185
|
+
var isValid = startOfRange < endOfRange;
|
|
5186
|
+
if (!isValid) {
|
|
5187
|
+
return 0;
|
|
5188
|
+
}
|
|
5189
|
+
if (value < startOfRange) {
|
|
5190
|
+
return 0;
|
|
5191
|
+
}
|
|
5192
|
+
if (value > endOfRange) {
|
|
5193
|
+
return 1;
|
|
5194
|
+
}
|
|
5195
|
+
var range = endOfRange - startOfRange;
|
|
5196
|
+
return (value - startOfRange) / range;
|
|
5197
|
+
}
|
|
5198
|
+
|
|
5199
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/get-scroll-change.js
|
|
5200
|
+
function getMaxScrollChange(_ref) {
|
|
5201
|
+
var timeSinceLastFrame = _ref.timeSinceLastFrame, config = _ref.config;
|
|
5202
|
+
var targetScrollPerMs = config.maxPixelScrollPerSecond / 1e3;
|
|
5203
|
+
var proposed = Math.ceil(targetScrollPerMs * timeSinceLastFrame);
|
|
5204
|
+
var maximum = config.maxPixelScrollPerSecond / 60;
|
|
5205
|
+
return Math.min(proposed, maximum);
|
|
5206
|
+
}
|
|
5207
|
+
function getDistanceDampening(_ref2) {
|
|
5208
|
+
var client = _ref2.client, axis = _ref2.axis, edge = _ref2.edge, hitbox = _ref2.hitbox, config = _ref2.config;
|
|
5209
|
+
var mainAxis = axisLookup[axis].mainAxis;
|
|
5210
|
+
var side = mainAxisSideLookup[edge];
|
|
5211
|
+
var maxSpeedBuffer = hitbox[mainAxis.size] * config.maxScrollAtPercentageRemainingOfHitbox[edge];
|
|
5212
|
+
if (side === "end") {
|
|
5213
|
+
return getPercentageInRange({
|
|
5214
|
+
startOfRange: hitbox[mainAxis.start],
|
|
5215
|
+
endOfRange: hitbox[mainAxis.end] - maxSpeedBuffer,
|
|
5216
|
+
value: client[mainAxis.point]
|
|
5217
|
+
});
|
|
5218
|
+
}
|
|
5219
|
+
var raw = getPercentageInRange({
|
|
5220
|
+
startOfRange: hitbox[mainAxis.start] + maxSpeedBuffer,
|
|
5221
|
+
endOfRange: hitbox[mainAxis.end],
|
|
5222
|
+
value: client[mainAxis.point]
|
|
5223
|
+
});
|
|
5224
|
+
return 1 - raw;
|
|
5225
|
+
}
|
|
5226
|
+
function getScrollChange(_ref3) {
|
|
5227
|
+
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;
|
|
5228
|
+
var maxScroll = getMaxScrollChange({
|
|
5229
|
+
timeSinceLastFrame,
|
|
5230
|
+
config
|
|
5231
|
+
});
|
|
5232
|
+
var percentageDistanceDampening = isDistanceDampeningEnabled ? getDistanceDampening({
|
|
5233
|
+
client,
|
|
5234
|
+
edge,
|
|
5235
|
+
hitbox,
|
|
5236
|
+
axis,
|
|
5237
|
+
config
|
|
5238
|
+
}) : 1;
|
|
5239
|
+
var percentageThroughTimeDampening = getPercentageInRange({
|
|
5240
|
+
startOfRange: engagement.timeOfEngagementStart,
|
|
5241
|
+
endOfRange: engagement.timeOfEngagementStart + config.timeDampeningDurationMs,
|
|
5242
|
+
value: Date.now()
|
|
5243
|
+
});
|
|
5244
|
+
var percentageOfMaxScroll = percentageDistanceDampening * percentageThroughTimeDampening;
|
|
5245
|
+
var scroll = Math.max(maxScroll * percentageOfMaxScroll, 1);
|
|
5246
|
+
var side = mainAxisSideLookup[edge];
|
|
5247
|
+
return side === "end" ? scroll : -1 * scroll;
|
|
5248
|
+
}
|
|
5249
|
+
|
|
5250
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/is-axis-allowed.js
|
|
5251
|
+
function isAxisAllowed(axis, allowedAxis) {
|
|
5252
|
+
return allowedAxis === "all" || axis === allowedAxis;
|
|
5253
|
+
}
|
|
5254
|
+
|
|
5255
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/shared/is-within.js
|
|
5256
|
+
function isWithin2(_ref) {
|
|
5257
|
+
var client = _ref.client, clientRect = _ref.clientRect;
|
|
5258
|
+
return (
|
|
5259
|
+
// is within horizontal bounds
|
|
5260
|
+
client.x >= clientRect.x && client.x <= clientRect.x + clientRect.width && // is within vertical bounds
|
|
5261
|
+
client.y >= clientRect.y && client.y <= clientRect.y + clientRect.height
|
|
5262
|
+
);
|
|
5263
|
+
}
|
|
5264
|
+
|
|
5265
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/get-scroll-by.js
|
|
5266
|
+
function getRectDefault(element) {
|
|
5267
|
+
return element.getBoundingClientRect();
|
|
5268
|
+
}
|
|
5269
|
+
function getScrollBy(_ref) {
|
|
5270
|
+
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;
|
|
5271
|
+
var client = {
|
|
5272
|
+
x: input.clientX,
|
|
5273
|
+
y: input.clientY
|
|
5274
|
+
};
|
|
5275
|
+
var clientRect = getRect(element);
|
|
5276
|
+
var scrollableEdges = edges.reduce(function(map, edge) {
|
|
5277
|
+
var hitbox = getOverElementHitbox[edge]({
|
|
5278
|
+
clientRect,
|
|
5279
|
+
config
|
|
5280
|
+
});
|
|
5281
|
+
var axis = edgeAxisLookup[edge];
|
|
5282
|
+
if (!isAxisAllowed(axis, allowedAxis)) {
|
|
5283
|
+
return map;
|
|
5284
|
+
}
|
|
5285
|
+
if (!isWithin2({
|
|
5286
|
+
client,
|
|
5287
|
+
clientRect: hitbox
|
|
5288
|
+
})) {
|
|
5289
|
+
return map;
|
|
5290
|
+
}
|
|
5291
|
+
if (!canScrollOnEdge[edge](element)) {
|
|
5292
|
+
return map;
|
|
5293
|
+
}
|
|
5294
|
+
map.set(edge, {
|
|
5295
|
+
edge,
|
|
5296
|
+
hitbox
|
|
5297
|
+
});
|
|
5298
|
+
return map;
|
|
5299
|
+
}, /* @__PURE__ */ new Map());
|
|
5300
|
+
var left2 = (function() {
|
|
5301
|
+
var axis = "horizontal";
|
|
5302
|
+
var leftEdge = scrollableEdges.get("left");
|
|
5303
|
+
if (leftEdge) {
|
|
5304
|
+
return getScrollChange({
|
|
5305
|
+
client,
|
|
5306
|
+
edge: leftEdge.edge,
|
|
5307
|
+
hitbox: leftEdge.hitbox,
|
|
5308
|
+
axis,
|
|
5309
|
+
timeSinceLastFrame,
|
|
5310
|
+
engagement,
|
|
5311
|
+
isDistanceDampeningEnabled: true,
|
|
5312
|
+
config
|
|
5313
|
+
});
|
|
5314
|
+
}
|
|
5315
|
+
var rightEdge = scrollableEdges.get("right");
|
|
5316
|
+
if (rightEdge) {
|
|
5317
|
+
return getScrollChange({
|
|
5318
|
+
client,
|
|
5319
|
+
edge: rightEdge.edge,
|
|
5320
|
+
hitbox: rightEdge.hitbox,
|
|
5321
|
+
axis,
|
|
5322
|
+
timeSinceLastFrame,
|
|
5323
|
+
engagement,
|
|
5324
|
+
isDistanceDampeningEnabled: true,
|
|
5325
|
+
config
|
|
5326
|
+
});
|
|
5327
|
+
}
|
|
5328
|
+
return 0;
|
|
5329
|
+
})();
|
|
5330
|
+
var top2 = (function() {
|
|
5331
|
+
var axis = "vertical";
|
|
5332
|
+
var bottomEdge = scrollableEdges.get("bottom");
|
|
5333
|
+
if (bottomEdge) {
|
|
5334
|
+
return getScrollChange({
|
|
5335
|
+
client,
|
|
5336
|
+
edge: bottomEdge.edge,
|
|
5337
|
+
hitbox: bottomEdge.hitbox,
|
|
5338
|
+
axis,
|
|
5339
|
+
timeSinceLastFrame,
|
|
5340
|
+
engagement,
|
|
5341
|
+
isDistanceDampeningEnabled: true,
|
|
5342
|
+
config
|
|
5343
|
+
});
|
|
5344
|
+
}
|
|
5345
|
+
var topEdge = scrollableEdges.get("top");
|
|
5346
|
+
if (topEdge) {
|
|
5347
|
+
return getScrollChange({
|
|
5348
|
+
client,
|
|
5349
|
+
edge: topEdge.edge,
|
|
5350
|
+
hitbox: topEdge.hitbox,
|
|
5351
|
+
axis,
|
|
5352
|
+
timeSinceLastFrame,
|
|
5353
|
+
engagement,
|
|
5354
|
+
isDistanceDampeningEnabled: true,
|
|
5355
|
+
config
|
|
5356
|
+
});
|
|
5357
|
+
}
|
|
5358
|
+
return 0;
|
|
5359
|
+
})();
|
|
5360
|
+
return {
|
|
5361
|
+
left: left2,
|
|
5362
|
+
top: top2
|
|
5363
|
+
};
|
|
5364
|
+
}
|
|
5365
|
+
|
|
5366
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/try-scroll.js
|
|
5367
|
+
function _createForOfIteratorHelper3(r, e) {
|
|
5368
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
5369
|
+
if (!t) {
|
|
5370
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray4(r)) || e && r && "number" == typeof r.length) {
|
|
5371
|
+
t && (r = t);
|
|
5372
|
+
var _n = 0, F = function F2() {
|
|
5373
|
+
};
|
|
5374
|
+
return { s: F, n: function n() {
|
|
5375
|
+
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
5376
|
+
}, e: function e2(r2) {
|
|
5377
|
+
throw r2;
|
|
5378
|
+
}, f: F };
|
|
5379
|
+
}
|
|
5380
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5381
|
+
}
|
|
5382
|
+
var o, a = true, u = false;
|
|
5383
|
+
return { s: function s() {
|
|
5384
|
+
t = t.call(r);
|
|
5385
|
+
}, n: function n() {
|
|
5386
|
+
var r2 = t.next();
|
|
5387
|
+
return a = r2.done, r2;
|
|
5388
|
+
}, e: function e2(r2) {
|
|
5389
|
+
u = true, o = r2;
|
|
5390
|
+
}, f: function f() {
|
|
5391
|
+
try {
|
|
5392
|
+
a || null == t.return || t.return();
|
|
5393
|
+
} finally {
|
|
5394
|
+
if (u) throw o;
|
|
5395
|
+
}
|
|
5396
|
+
} };
|
|
5397
|
+
}
|
|
5398
|
+
function _unsupportedIterableToArray4(r, a) {
|
|
5399
|
+
if (r) {
|
|
5400
|
+
if ("string" == typeof r) return _arrayLikeToArray4(r, a);
|
|
5401
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
5402
|
+
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;
|
|
5403
|
+
}
|
|
5404
|
+
}
|
|
5405
|
+
function _arrayLikeToArray4(r, a) {
|
|
5406
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5407
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
5408
|
+
return n;
|
|
5409
|
+
}
|
|
5410
|
+
function isScrollingAvailable(value) {
|
|
5411
|
+
return Boolean(value.top || value.left);
|
|
5412
|
+
}
|
|
5413
|
+
function tryScrollElements(_ref) {
|
|
5414
|
+
var _container$getConfigu, _container$getAllowed, _container$getAllowed2;
|
|
5415
|
+
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 ? {
|
|
5416
|
+
top: true,
|
|
5417
|
+
left: true
|
|
5418
|
+
} : _ref$available;
|
|
5419
|
+
if (!isScrollingAvailable(available)) {
|
|
5420
|
+
return available;
|
|
5421
|
+
}
|
|
5422
|
+
if (!target) {
|
|
5423
|
+
return available;
|
|
5424
|
+
}
|
|
5425
|
+
var element = target.closest(selector);
|
|
5426
|
+
if (!element) {
|
|
5427
|
+
return available;
|
|
5428
|
+
}
|
|
5429
|
+
var container = findEntry(element);
|
|
5430
|
+
if (!container) {
|
|
5431
|
+
return available;
|
|
5432
|
+
}
|
|
5433
|
+
function continueSearchUp() {
|
|
5434
|
+
var _element$parentElemen;
|
|
5435
|
+
return tryScrollElements({
|
|
5436
|
+
target: (_element$parentElemen = element === null || element === void 0 ? void 0 : element.parentElement) !== null && _element$parentElemen !== void 0 ? _element$parentElemen : null,
|
|
5437
|
+
findEntry,
|
|
5438
|
+
source,
|
|
5439
|
+
timeSinceLastFrame,
|
|
5440
|
+
input,
|
|
5441
|
+
available
|
|
5442
|
+
});
|
|
5443
|
+
}
|
|
5444
|
+
var feedback = {
|
|
5445
|
+
input,
|
|
5446
|
+
source,
|
|
5447
|
+
element
|
|
5448
|
+
};
|
|
5449
|
+
if (container.canScroll && !container.canScroll(feedback)) {
|
|
5450
|
+
return continueSearchUp();
|
|
5451
|
+
}
|
|
5452
|
+
var engagement = markAndGetEngagement(element);
|
|
5453
|
+
var config = getInternalConfig((_container$getConfigu = container.getConfiguration) === null || _container$getConfigu === void 0 ? void 0 : _container$getConfigu.call(container, feedback));
|
|
5454
|
+
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";
|
|
5455
|
+
var scrollBy = getScrollBy({
|
|
5456
|
+
element,
|
|
5457
|
+
engagement,
|
|
5458
|
+
input,
|
|
5459
|
+
timeSinceLastFrame,
|
|
5460
|
+
allowedAxis,
|
|
5461
|
+
config
|
|
5462
|
+
});
|
|
5463
|
+
var scroll = {
|
|
5464
|
+
top: 0,
|
|
5465
|
+
left: 0
|
|
5466
|
+
};
|
|
5467
|
+
if (available.top && scrollBy.top !== 0) {
|
|
5468
|
+
scroll.top = scrollBy.top;
|
|
5469
|
+
available.top = false;
|
|
5470
|
+
}
|
|
5471
|
+
if (available.left && scrollBy.left !== 0) {
|
|
5472
|
+
scroll.left = scrollBy.left;
|
|
5473
|
+
available.left = false;
|
|
5474
|
+
}
|
|
5475
|
+
if (scroll.top !== 0 || scroll.left !== 0) {
|
|
5476
|
+
element.scrollBy(scroll);
|
|
5477
|
+
}
|
|
5478
|
+
return continueSearchUp();
|
|
5479
|
+
}
|
|
5480
|
+
function tryScrollWindow(_ref2) {
|
|
5481
|
+
var input = _ref2.input, timeSinceLastFrame = _ref2.timeSinceLastFrame, available = _ref2.available, source = _ref2.source, entries = _ref2.entries;
|
|
5482
|
+
var element = document.documentElement;
|
|
5483
|
+
var feedback = {
|
|
5484
|
+
input,
|
|
5485
|
+
source,
|
|
5486
|
+
element
|
|
5487
|
+
};
|
|
5488
|
+
var _iterator = _createForOfIteratorHelper3(entries), _step;
|
|
5489
|
+
try {
|
|
5490
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
5491
|
+
var _entry$getConfigurati, _entry$getAllowedAxis, _entry$getAllowedAxis2;
|
|
5492
|
+
var entry = _step.value;
|
|
5493
|
+
if (entry.canScroll && !entry.canScroll(feedback)) {
|
|
5494
|
+
continue;
|
|
5495
|
+
}
|
|
5496
|
+
var engagement = markAndGetEngagement(element);
|
|
5497
|
+
var config = getInternalConfig((_entry$getConfigurati = entry.getConfiguration) === null || _entry$getConfigurati === void 0 ? void 0 : _entry$getConfigurati.call(entry, feedback));
|
|
5498
|
+
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";
|
|
5499
|
+
var scrollBy = getScrollBy({
|
|
5500
|
+
element,
|
|
5501
|
+
engagement,
|
|
5502
|
+
input,
|
|
5503
|
+
config,
|
|
5504
|
+
allowedAxis,
|
|
5505
|
+
getRect: function getRect(element2) {
|
|
5506
|
+
return DOMRect.fromRect({
|
|
5507
|
+
y: 0,
|
|
5508
|
+
x: 0,
|
|
5509
|
+
width: element2.clientWidth,
|
|
5510
|
+
height: element2.clientHeight
|
|
5511
|
+
});
|
|
5512
|
+
},
|
|
5513
|
+
timeSinceLastFrame
|
|
5514
|
+
});
|
|
5515
|
+
var scroll = {
|
|
5516
|
+
top: available.top ? scrollBy.top : 0,
|
|
5517
|
+
left: available.left ? scrollBy.left : 0
|
|
5518
|
+
};
|
|
5519
|
+
if (scroll.top !== 0 || scroll.left !== 0) {
|
|
5520
|
+
element.scrollBy(scroll);
|
|
5521
|
+
}
|
|
5522
|
+
break;
|
|
5523
|
+
}
|
|
5524
|
+
} catch (err) {
|
|
5525
|
+
_iterator.e(err);
|
|
5526
|
+
} finally {
|
|
5527
|
+
_iterator.f();
|
|
3086
5528
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
5529
|
+
}
|
|
5530
|
+
function tryScroll(_ref3) {
|
|
5531
|
+
var input = _ref3.input, findEntry = _ref3.findEntry, timeSinceLastFrame = _ref3.timeSinceLastFrame, source = _ref3.source, getWindowScrollEntries = _ref3.getWindowScrollEntries, underUsersPointer = _ref3.underUsersPointer;
|
|
5532
|
+
var remainder = tryScrollElements({
|
|
5533
|
+
target: underUsersPointer,
|
|
5534
|
+
timeSinceLastFrame,
|
|
5535
|
+
input,
|
|
5536
|
+
source,
|
|
5537
|
+
findEntry
|
|
5538
|
+
});
|
|
5539
|
+
if (!isScrollingAvailable(remainder)) {
|
|
5540
|
+
return;
|
|
3094
5541
|
}
|
|
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);
|
|
5542
|
+
tryScrollWindow({
|
|
5543
|
+
input,
|
|
5544
|
+
source,
|
|
5545
|
+
entries: getWindowScrollEntries(),
|
|
5546
|
+
timeSinceLastFrame,
|
|
5547
|
+
available: remainder
|
|
5548
|
+
});
|
|
5549
|
+
}
|
|
5550
|
+
|
|
5551
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/over-element/make-api.js
|
|
5552
|
+
function ownKeys5(e, r) {
|
|
5553
|
+
var t = Object.keys(e);
|
|
5554
|
+
if (Object.getOwnPropertySymbols) {
|
|
5555
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
5556
|
+
r && (o = o.filter(function(r2) {
|
|
5557
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
5558
|
+
})), t.push.apply(t, o);
|
|
5559
|
+
}
|
|
5560
|
+
return t;
|
|
5561
|
+
}
|
|
5562
|
+
function _objectSpread5(e) {
|
|
5563
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
5564
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
5565
|
+
r % 2 ? ownKeys5(Object(t), true).forEach(function(r2) {
|
|
5566
|
+
_defineProperty(e, r2, t[r2]);
|
|
5567
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys5(Object(t)).forEach(function(r2) {
|
|
5568
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
3124
5569
|
});
|
|
3125
|
-
warning.appendChild(fix);
|
|
3126
5570
|
}
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
5571
|
+
return e;
|
|
5572
|
+
}
|
|
5573
|
+
function makeApi(_ref) {
|
|
5574
|
+
var monitor = _ref.monitor;
|
|
5575
|
+
var elementRegistry = /* @__PURE__ */ new Map();
|
|
5576
|
+
var windowRegistry = /* @__PURE__ */ new Set();
|
|
5577
|
+
function autoScroll(args) {
|
|
5578
|
+
if (true) {
|
|
5579
|
+
var _window$getComputedSt = window.getComputedStyle(args.element), overflowX = _window$getComputedSt.overflowX, overflowY = _window$getComputedSt.overflowY;
|
|
5580
|
+
var isScrollable = overflowX === "auto" || overflowX === "scroll" || overflowY === "auto" || overflowY === "scroll";
|
|
5581
|
+
if (!isScrollable) {
|
|
5582
|
+
console.warn("Auto scrolling has been attached to an element that appears not to be scrollable", {
|
|
5583
|
+
element: args.element,
|
|
5584
|
+
overflowX,
|
|
5585
|
+
overflowY
|
|
5586
|
+
});
|
|
5587
|
+
}
|
|
5588
|
+
}
|
|
5589
|
+
if (true) {
|
|
5590
|
+
var existing = elementRegistry.get(args.element);
|
|
5591
|
+
if (existing) {
|
|
5592
|
+
console.warn("You have already registered autoScrolling on the same element", {
|
|
5593
|
+
existing,
|
|
5594
|
+
proposed: args
|
|
5595
|
+
});
|
|
5596
|
+
}
|
|
5597
|
+
}
|
|
5598
|
+
elementRegistry.set(args.element, args);
|
|
5599
|
+
var cleanup = combine(addScrollableAttribute(args.element), function() {
|
|
5600
|
+
return elementRegistry.delete(args.element);
|
|
5601
|
+
});
|
|
5602
|
+
return once(cleanup);
|
|
5603
|
+
}
|
|
5604
|
+
function autoScrollWindow() {
|
|
5605
|
+
var args = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5606
|
+
var unique = _objectSpread5({}, args);
|
|
5607
|
+
windowRegistry.add(unique);
|
|
5608
|
+
function cleanup() {
|
|
5609
|
+
windowRegistry.delete(unique);
|
|
5610
|
+
}
|
|
5611
|
+
return once(cleanup);
|
|
5612
|
+
}
|
|
5613
|
+
function findEntry(element) {
|
|
5614
|
+
var _elementRegistry$get;
|
|
5615
|
+
return (_elementRegistry$get = elementRegistry.get(element)) !== null && _elementRegistry$get !== void 0 ? _elementRegistry$get : null;
|
|
5616
|
+
}
|
|
5617
|
+
function getWindowScrollEntries() {
|
|
5618
|
+
return Array.from(windowRegistry);
|
|
5619
|
+
}
|
|
5620
|
+
function onFrame(_ref2) {
|
|
5621
|
+
var latestArgs = _ref2.latestArgs, underUsersPointer = _ref2.underUsersPointer, timeSinceLastFrame = _ref2.timeSinceLastFrame;
|
|
5622
|
+
tryScroll({
|
|
5623
|
+
input: latestArgs.location.current.input,
|
|
5624
|
+
source: latestArgs.source,
|
|
5625
|
+
findEntry,
|
|
5626
|
+
underUsersPointer,
|
|
5627
|
+
timeSinceLastFrame,
|
|
5628
|
+
getWindowScrollEntries
|
|
5629
|
+
});
|
|
3133
5630
|
}
|
|
5631
|
+
getScheduler(monitor).onFrame(onFrame);
|
|
5632
|
+
return {
|
|
5633
|
+
autoScroll,
|
|
5634
|
+
autoScrollWindow
|
|
5635
|
+
};
|
|
3134
5636
|
}
|
|
3135
5637
|
|
|
5638
|
+
// node_modules/@atlaskit/pragmatic-drag-and-drop-auto-scroll/dist/esm/entry-point/element.js
|
|
5639
|
+
var api = makeApi({
|
|
5640
|
+
monitor: monitorForElements
|
|
5641
|
+
});
|
|
5642
|
+
var autoScrollForElements = api.autoScroll;
|
|
5643
|
+
var autoScrollWindowForElements = api.autoScrollWindow;
|
|
5644
|
+
|
|
3136
5645
|
// src/editor-reconcile.ts
|
|
3137
5646
|
function tokenOf(unit) {
|
|
3138
5647
|
return unidOf(unit.id) + (unit.sig ? "|" + unit.sig : "");
|
|
@@ -3172,15 +5681,32 @@ var Docxodus = (() => {
|
|
|
3172
5681
|
const bar = token.indexOf("|");
|
|
3173
5682
|
return bar < 0 ? token : token.slice(0, bar);
|
|
3174
5683
|
};
|
|
3175
|
-
const
|
|
5684
|
+
const moved = [];
|
|
3176
5685
|
const usedRemoved = /* @__PURE__ */ new Set();
|
|
5686
|
+
const usedAdded = /* @__PURE__ */ new Set();
|
|
5687
|
+
const removedByToken = /* @__PURE__ */ new Map();
|
|
5688
|
+
for (const oi of removed) {
|
|
5689
|
+
(removedByToken.get(oldUnids[oi]) ?? removedByToken.set(oldUnids[oi], []).get(oldUnids[oi])).push(oi);
|
|
5690
|
+
}
|
|
5691
|
+
for (const nj of added) {
|
|
5692
|
+
const candidates = removedByToken.get(newUnids[nj]);
|
|
5693
|
+
const oi = candidates?.find((i2) => !usedRemoved.has(i2));
|
|
5694
|
+
if (oi !== void 0) {
|
|
5695
|
+
moved.push({ oldIndex: oi, newIndex: nj });
|
|
5696
|
+
usedRemoved.add(oi);
|
|
5697
|
+
usedAdded.add(nj);
|
|
5698
|
+
}
|
|
5699
|
+
}
|
|
5700
|
+
const substituted = [];
|
|
3177
5701
|
const removedByUnid = /* @__PURE__ */ new Map();
|
|
3178
5702
|
for (const oi of removed) {
|
|
5703
|
+
if (usedRemoved.has(oi)) continue;
|
|
3179
5704
|
const u = bareUnid(oldUnids[oi]);
|
|
3180
5705
|
(removedByUnid.get(u) ?? removedByUnid.set(u, []).get(u)).push(oi);
|
|
3181
5706
|
}
|
|
3182
5707
|
const unmatchedAdded = [];
|
|
3183
5708
|
for (const nj of added) {
|
|
5709
|
+
if (usedAdded.has(nj)) continue;
|
|
3184
5710
|
const candidates = removedByUnid.get(bareUnid(newUnids[nj]));
|
|
3185
5711
|
const oi = candidates?.find((i2) => !usedRemoved.has(i2));
|
|
3186
5712
|
if (oi !== void 0) {
|
|
@@ -3211,7 +5737,7 @@ var Docxodus = (() => {
|
|
|
3211
5737
|
}
|
|
3212
5738
|
}
|
|
3213
5739
|
}
|
|
3214
|
-
return { keep, removed, added, substituted };
|
|
5740
|
+
return { keep, removed, added, substituted, moved };
|
|
3215
5741
|
}
|
|
3216
5742
|
function needsRemount(diff, newUnits, oldKinds, threshold = 40) {
|
|
3217
5743
|
if (diff.added.length + diff.removed.length > threshold) return true;
|
|
@@ -3228,6 +5754,46 @@ var Docxodus = (() => {
|
|
|
3228
5754
|
|
|
3229
5755
|
// src/editor.ts
|
|
3230
5756
|
var EDITABLE_TAGS = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6"]);
|
|
5757
|
+
var BLOCK_DRAG_TYPE = "docxodus-block";
|
|
5758
|
+
var blockDragStyledDocuments = /* @__PURE__ */ new WeakSet();
|
|
5759
|
+
function ensureBlockDragStyles(doc) {
|
|
5760
|
+
if (blockDragStyledDocuments.has(doc)) return;
|
|
5761
|
+
blockDragStyledDocuments.add(doc);
|
|
5762
|
+
const style = doc.createElement("style");
|
|
5763
|
+
style.dataset.docxodusBlockDrag = "true";
|
|
5764
|
+
style.textContent = `
|
|
5765
|
+
.docx-block-handle {
|
|
5766
|
+
position: fixed; z-index: 2147483000; display: none; width: 26px; height: 28px;
|
|
5767
|
+
align-items: center; justify-content: center; padding: 0; border: 1px solid #d0d5dd;
|
|
5768
|
+
border-radius: 6px; background: #fff; color: #667085; box-shadow: 0 1px 3px rgba(16,24,40,.12);
|
|
5769
|
+
cursor: grab; font: 700 17px/1 system-ui, sans-serif; user-select: none; touch-action: none;
|
|
5770
|
+
}
|
|
5771
|
+
.docx-block-handle:hover, .docx-block-handle:focus-visible { color: #344054; border-color: #98a2b3; outline: none; }
|
|
5772
|
+
.docx-block-handle[aria-pressed="true"] { color: #175cd3; border-color: #84adff; background: #eff8ff; }
|
|
5773
|
+
.docx-block-handle.docx-block-dragging { cursor: grabbing; opacity: .78; }
|
|
5774
|
+
.docx-block-drop-indicator {
|
|
5775
|
+
position: fixed; z-index: 2147482999; display: none; height: 3px; pointer-events: none;
|
|
5776
|
+
border-radius: 999px; background: #2e90fa; box-shadow: 0 0 0 1px rgba(255,255,255,.85);
|
|
5777
|
+
}
|
|
5778
|
+
.docx-block-move-menu {
|
|
5779
|
+
position: fixed; z-index: 2147483001; display: none; min-width: 150px; padding: 5px;
|
|
5780
|
+
border: 1px solid #d0d5dd; border-radius: 8px; background: #fff;
|
|
5781
|
+
box-shadow: 0 8px 24px rgba(16,24,40,.18); font: 13px/1.35 system-ui, sans-serif;
|
|
5782
|
+
}
|
|
5783
|
+
.docx-block-move-menu button { display: block; width: 100%; padding: 7px 9px; border: 0; border-radius: 5px; background: transparent; color: #344054; text-align: left; }
|
|
5784
|
+
.docx-block-move-menu button:hover, .docx-block-move-menu button:focus-visible { background: #f2f4f7; outline: none; }
|
|
5785
|
+
.docx-block-move-menu button:disabled { color: #98a2b3; background: transparent; }
|
|
5786
|
+
.docx-block-move-flash { animation: docx-block-move-flash 800ms ease-out; }
|
|
5787
|
+
@keyframes docx-block-move-flash { from { box-shadow: 0 0 0 3px rgba(46,144,250,.55); } to { box-shadow: none; } }
|
|
5788
|
+
.docx-block-live-region { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
5789
|
+
`;
|
|
5790
|
+
(doc.head ?? doc.documentElement).appendChild(style);
|
|
5791
|
+
}
|
|
5792
|
+
function trackedChangeWireName(mode) {
|
|
5793
|
+
if (mode === 1 /* RenderInline */) return "render_inline";
|
|
5794
|
+
if (mode === 2 /* StripDeletions */) return "strip_deletions";
|
|
5795
|
+
return "accept";
|
|
5796
|
+
}
|
|
3231
5797
|
function fontWeightIsBold(w) {
|
|
3232
5798
|
if (w === "bold" || w === "bolder") return true;
|
|
3233
5799
|
const n = parseInt(w, 10);
|
|
@@ -3375,9 +5941,9 @@ var Docxodus = (() => {
|
|
|
3375
5941
|
}
|
|
3376
5942
|
function trimmedSpan(block, span) {
|
|
3377
5943
|
const { leading, trimmedLen } = trimBounds(block);
|
|
3378
|
-
const
|
|
3379
|
-
const end = Math.max(
|
|
3380
|
-
return { start, length: end -
|
|
5944
|
+
const start2 = Math.max(0, Math.min(span.start - Math.min(span.start, leading), trimmedLen));
|
|
5945
|
+
const end = Math.max(start2, Math.min(span.start + span.length - leading, trimmedLen));
|
|
5946
|
+
return { start: start2, length: end - start2 };
|
|
3381
5947
|
}
|
|
3382
5948
|
function contentPositionIn(el, offset) {
|
|
3383
5949
|
let remaining = offset;
|
|
@@ -3420,9 +5986,9 @@ var Docxodus = (() => {
|
|
|
3420
5986
|
probe.collapse(true);
|
|
3421
5987
|
const focusIsBefore = probe.comparePoint(focus.node, focus.offset) < 0;
|
|
3422
5988
|
const range = document.createRange();
|
|
3423
|
-
const
|
|
5989
|
+
const start2 = focusIsBefore ? focus : anchor;
|
|
3424
5990
|
const end = focusIsBefore ? anchor : focus;
|
|
3425
|
-
range.setStart(
|
|
5991
|
+
range.setStart(start2.node, start2.offset);
|
|
3426
5992
|
range.setEnd(end.node, end.offset);
|
|
3427
5993
|
sel.removeAllRanges();
|
|
3428
5994
|
sel.addRange(range);
|
|
@@ -3470,17 +6036,17 @@ var Docxodus = (() => {
|
|
|
3470
6036
|
const range = sel.getRangeAt(0);
|
|
3471
6037
|
if (range.collapsed) return null;
|
|
3472
6038
|
if (!block.contains(range.startContainer) || !block.contains(range.endContainer)) return null;
|
|
3473
|
-
const
|
|
6039
|
+
const start2 = contentOffsetOf(block, range.startContainer, range.startOffset);
|
|
3474
6040
|
const end = contentOffsetOf(block, range.endContainer, range.endOffset);
|
|
3475
|
-
const span = trimmedSpan(block, { start: Math.min(
|
|
6041
|
+
const span = trimmedSpan(block, { start: Math.min(start2, end), length: Math.abs(end - start2) });
|
|
3476
6042
|
return span.length > 0 ? span : null;
|
|
3477
6043
|
}
|
|
3478
|
-
function selectRange(el,
|
|
6044
|
+
function selectRange(el, start2, length) {
|
|
3479
6045
|
const sel = typeof window !== "undefined" ? window.getSelection() : null;
|
|
3480
6046
|
if (!sel || !el.isConnected) return;
|
|
3481
6047
|
el.focus();
|
|
3482
6048
|
const range = document.createRange();
|
|
3483
|
-
const end =
|
|
6049
|
+
const end = start2 + length;
|
|
3484
6050
|
let pos = 0;
|
|
3485
6051
|
let startSet = false;
|
|
3486
6052
|
const walk = (node) => {
|
|
@@ -3489,8 +6055,8 @@ var Docxodus = (() => {
|
|
|
3489
6055
|
if (isInMarker(child)) continue;
|
|
3490
6056
|
const raw = child.textContent ?? "";
|
|
3491
6057
|
const len = stripBidi(raw).length;
|
|
3492
|
-
if (!startSet && pos + len >=
|
|
3493
|
-
range.setStart(child, domOffsetForContentOffset(raw,
|
|
6058
|
+
if (!startSet && pos + len >= start2) {
|
|
6059
|
+
range.setStart(child, domOffsetForContentOffset(raw, start2 - pos));
|
|
3494
6060
|
startSet = true;
|
|
3495
6061
|
}
|
|
3496
6062
|
if (startSet && pos + len >= end) {
|
|
@@ -3541,7 +6107,7 @@ var Docxodus = (() => {
|
|
|
3541
6107
|
return false;
|
|
3542
6108
|
}
|
|
3543
6109
|
}
|
|
3544
|
-
function completeArgs(bytes, cssPrefix, fabricate, paginated, scale) {
|
|
6110
|
+
function completeArgs(bytes, cssPrefix, fabricate, paginated, scale, renderTrackedChanges) {
|
|
3545
6111
|
return [
|
|
3546
6112
|
bytes,
|
|
3547
6113
|
"Document",
|
|
@@ -3565,7 +6131,7 @@ var Docxodus = (() => {
|
|
|
3565
6131
|
true,
|
|
3566
6132
|
/* renderHeadersAndFooters */
|
|
3567
6133
|
paginated,
|
|
3568
|
-
|
|
6134
|
+
renderTrackedChanges,
|
|
3569
6135
|
true,
|
|
3570
6136
|
true,
|
|
3571
6137
|
false,
|
|
@@ -3588,6 +6154,21 @@ var Docxodus = (() => {
|
|
|
3588
6154
|
* structural edit (split/merge/format) is lost. While this flag is set, commitBlock no-ops.
|
|
3589
6155
|
*/
|
|
3590
6156
|
this.replacing = false;
|
|
6157
|
+
/** Editor-owned block-move chrome. It is deliberately outside the rendered unit tree. */
|
|
6158
|
+
this.blockDragHandle = null;
|
|
6159
|
+
this.blockDropIndicator = null;
|
|
6160
|
+
this.blockMoveMenu = null;
|
|
6161
|
+
this.blockMoveLive = null;
|
|
6162
|
+
this.blockDragSource = null;
|
|
6163
|
+
this.blockDragCleanup = [];
|
|
6164
|
+
this.blockDragTargetCleanup = [];
|
|
6165
|
+
this.blockDragging = false;
|
|
6166
|
+
this.blockDragPointerDown = false;
|
|
6167
|
+
/** Anchors the current drag source may legally move next to, per the engine's own rules.
|
|
6168
|
+
* Null when the bridge predates ValidMoveTargets — then every block is offered, as before. */
|
|
6169
|
+
this.blockMoveTargets = null;
|
|
6170
|
+
/** Why the last move was refused, verbatim from the engine — diagnostics, not announcement copy. */
|
|
6171
|
+
this.lastMoveError = null;
|
|
3591
6172
|
/**
|
|
3592
6173
|
* The last real (non-collapsed) text selection inside an editable block. A toolbar control that
|
|
3593
6174
|
* must take focus to be used — the font-size combobox — blurs the block and collapses the live
|
|
@@ -3744,8 +6325,8 @@ var Docxodus = (() => {
|
|
|
3744
6325
|
* body edit root by design — also register. The fence still rejects other editors on the page. */
|
|
3745
6326
|
editableBlockOf(node) {
|
|
3746
6327
|
if (!node) return null;
|
|
3747
|
-
const
|
|
3748
|
-
const block =
|
|
6328
|
+
const start2 = node.nodeType === 1 ? node : node.parentElement;
|
|
6329
|
+
const block = start2?.closest('[data-anchor][contenteditable="true"]') ?? null;
|
|
3749
6330
|
return block && this.container.contains(block) ? block : null;
|
|
3750
6331
|
}
|
|
3751
6332
|
/**
|
|
@@ -3786,18 +6367,34 @@ var Docxodus = (() => {
|
|
|
3786
6367
|
paginated: options.paginated ?? false,
|
|
3787
6368
|
scale: options.scale ?? 1,
|
|
3788
6369
|
headerFooter: options.headerFooter ?? false,
|
|
3789
|
-
|
|
6370
|
+
blockDrag: options.blockDrag ?? false,
|
|
6371
|
+
trackedChanges: options.trackedChanges ?? 0 /* Accept */,
|
|
6372
|
+
revisionAuthor: options.revisionAuthor ?? "docxodus",
|
|
6373
|
+
onEdit: options.onEdit,
|
|
6374
|
+
onMove: options.onMove
|
|
3790
6375
|
};
|
|
3791
|
-
const handle = exports.DocxSessionBridge.OpenSession(bytes,
|
|
6376
|
+
const handle = exports.DocxSessionBridge.OpenSession(bytes, JSON.stringify({
|
|
6377
|
+
emitMarkdownPatch: false,
|
|
6378
|
+
trackedChanges: trackedChangeWireName(opts.trackedChanges),
|
|
6379
|
+
revisionAuthor: opts.revisionAuthor
|
|
6380
|
+
}));
|
|
3792
6381
|
const editor = new _DocxEditor(container, exports, handle, opts);
|
|
3793
6382
|
editor.refreshAnchorMap();
|
|
3794
6383
|
if (opts.headerFooter) editor.createRegion();
|
|
3795
6384
|
const fullHtml = exports.DocumentConverter.ConvertDocxToHtmlComplete(
|
|
3796
|
-
...completeArgs(
|
|
6385
|
+
...completeArgs(
|
|
6386
|
+
bytes,
|
|
6387
|
+
opts.cssPrefix,
|
|
6388
|
+
opts.fabricateClasses,
|
|
6389
|
+
opts.paginated,
|
|
6390
|
+
opts.scale,
|
|
6391
|
+
opts.trackedChanges === 1 /* RenderInline */
|
|
6392
|
+
)
|
|
3797
6393
|
);
|
|
3798
6394
|
if (opts.paginated) editor.mountPaginated(fullHtml);
|
|
3799
6395
|
else editor.mountHtml(fullHtml);
|
|
3800
6396
|
editor.syncRegionToBody();
|
|
6397
|
+
editor.setupBlockDrag();
|
|
3801
6398
|
return editor;
|
|
3802
6399
|
}
|
|
3803
6400
|
/**
|
|
@@ -3824,6 +6421,7 @@ var Docxodus = (() => {
|
|
|
3824
6421
|
document.removeEventListener("mouseup", this.onMouseUp, true);
|
|
3825
6422
|
}
|
|
3826
6423
|
this.clearDragSelection();
|
|
6424
|
+
this.teardownBlockDrag();
|
|
3827
6425
|
this.exports.DocxSessionBridge.CloseSession(this.handle);
|
|
3828
6426
|
}
|
|
3829
6427
|
/**
|
|
@@ -3851,6 +6449,416 @@ var Docxodus = (() => {
|
|
|
3851
6449
|
get sessionHandle() {
|
|
3852
6450
|
return this.handle;
|
|
3853
6451
|
}
|
|
6452
|
+
/** Move one top-level body block relative to another and repaint from the live session. */
|
|
6453
|
+
moveBlock(sourceAnchorId, targetAnchorId, position) {
|
|
6454
|
+
this.assertOpen();
|
|
6455
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
6456
|
+
if (typeof bridge.MoveBlock !== "function") return false;
|
|
6457
|
+
const res = this.parseEdit(
|
|
6458
|
+
bridge.MoveBlock(this.handle, sourceAnchorId, targetAnchorId, position)
|
|
6459
|
+
);
|
|
6460
|
+
if (!res.success) {
|
|
6461
|
+
this.lastMoveError = res.error?.message ?? null;
|
|
6462
|
+
this.announceBlockMove("This block cannot be moved there.");
|
|
6463
|
+
return false;
|
|
6464
|
+
}
|
|
6465
|
+
if ((res.created?.length ?? 0) === 0 && (res.modified?.length ?? 0) === 0 && (res.removed?.length ?? 0) === 0) {
|
|
6466
|
+
this.announceBlockMove("The block is already in that position.");
|
|
6467
|
+
return true;
|
|
6468
|
+
}
|
|
6469
|
+
const destination = res.created?.[0] ?? res.modified?.[0];
|
|
6470
|
+
if (this.renderTrackedChanges) this.remount();
|
|
6471
|
+
else this.reconcile();
|
|
6472
|
+
const moved = destination ? this.bodyUnitNodes().find((el) => el.getAttribute("data-anchor") === destination.unid) : null;
|
|
6473
|
+
if (moved) {
|
|
6474
|
+
moved.classList.add("docx-block-move-flash");
|
|
6475
|
+
moved.addEventListener("animationend", () => moved.classList.remove("docx-block-move-flash"), {
|
|
6476
|
+
once: true
|
|
6477
|
+
});
|
|
6478
|
+
const focusTarget = EDITABLE_TAGS.has(moved.tagName) ? moved : moved.querySelector('[data-anchor][contenteditable="true"]');
|
|
6479
|
+
if (focusTarget) {
|
|
6480
|
+
this.activeBlock = focusTarget;
|
|
6481
|
+
focusTarget.focus({ preventScroll: true });
|
|
6482
|
+
}
|
|
6483
|
+
}
|
|
6484
|
+
this.options.onMove?.({
|
|
6485
|
+
sourceAnchorId,
|
|
6486
|
+
destinationAnchorId: destination?.id ?? sourceAnchorId
|
|
6487
|
+
});
|
|
6488
|
+
this.announceBlockMove("Block moved.");
|
|
6489
|
+
return true;
|
|
6490
|
+
}
|
|
6491
|
+
/** Resolve any rendered descendant to its top-level body move unit (tables stay whole). */
|
|
6492
|
+
blockUnitOf(target) {
|
|
6493
|
+
const node = target instanceof Node ? target : null;
|
|
6494
|
+
const el = node?.nodeType === Node.ELEMENT_NODE ? node : node?.parentElement;
|
|
6495
|
+
if (!el || !this.editRoot.contains(el)) return null;
|
|
6496
|
+
return this.bodyUnitNodes().find((unit) => unit === el || unit.contains(el)) ?? null;
|
|
6497
|
+
}
|
|
6498
|
+
isMovableBlockUnit(unit) {
|
|
6499
|
+
if (!unit || !this.anchorIdOf(unit)) return false;
|
|
6500
|
+
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;
|
|
6501
|
+
return unit.tagName === "TABLE" || EDITABLE_TAGS.has(unit.tagName);
|
|
6502
|
+
}
|
|
6503
|
+
currentBlockDragSource() {
|
|
6504
|
+
if (this.isMovableBlockUnit(this.blockDragSource) && this.blockDragSource.isConnected)
|
|
6505
|
+
return this.blockDragSource;
|
|
6506
|
+
const fromActive = this.blockUnitOf(this.activeBlock);
|
|
6507
|
+
if (this.isMovableBlockUnit(fromActive)) {
|
|
6508
|
+
this.blockDragSource = fromActive;
|
|
6509
|
+
return fromActive;
|
|
6510
|
+
}
|
|
6511
|
+
return null;
|
|
6512
|
+
}
|
|
6513
|
+
showBlockHandle(unit) {
|
|
6514
|
+
const handle = this.blockDragHandle;
|
|
6515
|
+
if (!handle || !this.isMovableBlockUnit(unit)) return;
|
|
6516
|
+
const changed = unit !== this.blockDragSource;
|
|
6517
|
+
this.blockDragSource = unit;
|
|
6518
|
+
if (changed) this.refreshBlockMoveTargets(unit);
|
|
6519
|
+
if (this.blockMoveTargets?.size === 0) {
|
|
6520
|
+
handle.style.display = "none";
|
|
6521
|
+
return;
|
|
6522
|
+
}
|
|
6523
|
+
const rect = unit.getBoundingClientRect();
|
|
6524
|
+
handle.style.display = "flex";
|
|
6525
|
+
handle.style.left = `${Math.max(4, rect.left - 32)}px`;
|
|
6526
|
+
handle.style.top = `${Math.max(4, rect.top + (unit.tagName === "TABLE" ? 6 : Math.max(0, (rect.height - 28) / 2)))}px`;
|
|
6527
|
+
const preview = (unit.textContent ?? "").trim().replace(/\s+/g, " ").slice(0, 48);
|
|
6528
|
+
handle.setAttribute("aria-label", preview ? `Move block: ${preview}` : "Move block");
|
|
6529
|
+
if (changed) this.refreshBlockDropTargets();
|
|
6530
|
+
}
|
|
6531
|
+
hideBlockHandle() {
|
|
6532
|
+
if (this.blockDragging || this.blockMoveMenu?.style.display === "block") return;
|
|
6533
|
+
if (this.blockDragHandle) this.blockDragHandle.style.display = "none";
|
|
6534
|
+
}
|
|
6535
|
+
positionBlockHandle() {
|
|
6536
|
+
const source = this.currentBlockDragSource();
|
|
6537
|
+
if (source && this.blockDragHandle?.style.display !== "none") this.showBlockHandle(source);
|
|
6538
|
+
}
|
|
6539
|
+
showDropIndicator(target, position) {
|
|
6540
|
+
const indicator = this.blockDropIndicator;
|
|
6541
|
+
if (!indicator) return;
|
|
6542
|
+
const rect = this.unitWrapperOf(target).getBoundingClientRect();
|
|
6543
|
+
indicator.style.display = "block";
|
|
6544
|
+
indicator.style.left = `${rect.left}px`;
|
|
6545
|
+
indicator.style.top = `${position === "before" ? rect.top - 1 : rect.bottom - 1}px`;
|
|
6546
|
+
indicator.style.width = `${Math.max(24, rect.width)}px`;
|
|
6547
|
+
}
|
|
6548
|
+
hideDropIndicator() {
|
|
6549
|
+
if (this.blockDropIndicator) this.blockDropIndicator.style.display = "none";
|
|
6550
|
+
}
|
|
6551
|
+
announceBlockMove(message) {
|
|
6552
|
+
const live = this.blockMoveLive;
|
|
6553
|
+
if (!live) return;
|
|
6554
|
+
live.textContent = "";
|
|
6555
|
+
this.container.ownerDocument.defaultView?.setTimeout(() => {
|
|
6556
|
+
live.textContent = message;
|
|
6557
|
+
}, 0);
|
|
6558
|
+
}
|
|
6559
|
+
/**
|
|
6560
|
+
* Ask the engine which anchors the current source may move next to. One call per drag source,
|
|
6561
|
+
* so the UI offers only drops MoveBlock will accept — a document with section breaks is
|
|
6562
|
+
* partitioned into regions, and drawing an indicator across one only to fail the drop was the
|
|
6563
|
+
* behaviour this replaces. Null (no bridge support) keeps the previous offer-everything path.
|
|
6564
|
+
*/
|
|
6565
|
+
refreshBlockMoveTargets(source) {
|
|
6566
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
6567
|
+
const sourceId = source ? this.anchorIdOf(source) : null;
|
|
6568
|
+
if (!sourceId || typeof bridge.ValidMoveTargets !== "function") {
|
|
6569
|
+
this.blockMoveTargets = null;
|
|
6570
|
+
return;
|
|
6571
|
+
}
|
|
6572
|
+
try {
|
|
6573
|
+
const targets = JSON.parse(bridge.ValidMoveTargets(this.handle, sourceId));
|
|
6574
|
+
this.blockMoveTargets = new Map(
|
|
6575
|
+
targets.map((t) => [t.anchorId, { before: t.before, after: t.after }])
|
|
6576
|
+
);
|
|
6577
|
+
} catch {
|
|
6578
|
+
this.blockMoveTargets = null;
|
|
6579
|
+
}
|
|
6580
|
+
}
|
|
6581
|
+
/**
|
|
6582
|
+
* Whether `unit` is a legal destination for the current drag source — for a SPECIFIC side when
|
|
6583
|
+
* one is given. A cross-block range or a section break between the blocks can make one side
|
|
6584
|
+
* legal and the other not, so "this target is reachable" is not enough to pick a position.
|
|
6585
|
+
*/
|
|
6586
|
+
isValidMoveTarget(unit, position) {
|
|
6587
|
+
if (!this.blockMoveTargets) return true;
|
|
6588
|
+
const id = this.anchorIdOf(unit);
|
|
6589
|
+
const sides = id ? this.blockMoveTargets.get(id) : void 0;
|
|
6590
|
+
if (!sides) return false;
|
|
6591
|
+
return position ? sides[position] : sides.before || sides.after;
|
|
6592
|
+
}
|
|
6593
|
+
/**
|
|
6594
|
+
* The side of `unit` a drop at `clientY` should land on: the half the pointer is in, snapped to
|
|
6595
|
+
* the other side when only that one is legal. Snapping rather than refusing keeps a reachable
|
|
6596
|
+
* target usable — the illegal side is usually illegal only because a section break or a
|
|
6597
|
+
* cross-block range sits between the two blocks on that side.
|
|
6598
|
+
*/
|
|
6599
|
+
dropPositionFor(unit, clientY) {
|
|
6600
|
+
const rect = unit.getBoundingClientRect();
|
|
6601
|
+
const preferred = clientY < rect.top + rect.height / 2 ? "before" : "after";
|
|
6602
|
+
if (this.isValidMoveTarget(unit, preferred)) return preferred;
|
|
6603
|
+
const other = preferred === "before" ? "after" : "before";
|
|
6604
|
+
return this.isValidMoveTarget(unit, other) ? other : preferred;
|
|
6605
|
+
}
|
|
6606
|
+
refreshBlockDropTargets() {
|
|
6607
|
+
for (const cleanup of this.blockDragTargetCleanup.splice(0)) cleanup();
|
|
6608
|
+
if (!this.blockDragHandle || this.options.paginated) return;
|
|
6609
|
+
for (const unit of this.bodyUnitNodes().filter((el) => this.isMovableBlockUnit(el))) {
|
|
6610
|
+
this.blockDragTargetCleanup.push(dropTargetForElements({
|
|
6611
|
+
element: unit,
|
|
6612
|
+
// A target the engine would refuse is not a drop target at all, so Pragmatic never
|
|
6613
|
+
// fires onDragEnter for it and no indicator is drawn over it.
|
|
6614
|
+
canDrop: ({ source }) => source.data.type === BLOCK_DRAG_TYPE && source.data.sourceAnchorId !== this.anchorIdOf(unit) && this.isValidMoveTarget(unit),
|
|
6615
|
+
getData: ({ input }) => ({
|
|
6616
|
+
type: BLOCK_DRAG_TYPE,
|
|
6617
|
+
targetAnchorId: this.anchorIdOf(unit),
|
|
6618
|
+
position: this.dropPositionFor(unit, input.clientY),
|
|
6619
|
+
targetElement: unit
|
|
6620
|
+
}),
|
|
6621
|
+
onDragEnter: ({ self }) => {
|
|
6622
|
+
const pos = self.data.position === "after" ? "after" : "before";
|
|
6623
|
+
this.showDropIndicator(unit, pos);
|
|
6624
|
+
},
|
|
6625
|
+
onDrag: ({ self }) => {
|
|
6626
|
+
const pos = self.data.position === "after" ? "after" : "before";
|
|
6627
|
+
this.showDropIndicator(unit, pos);
|
|
6628
|
+
},
|
|
6629
|
+
onDragLeave: () => this.hideDropIndicator()
|
|
6630
|
+
}));
|
|
6631
|
+
}
|
|
6632
|
+
}
|
|
6633
|
+
closeBlockMoveMenu(restoreFocus = false) {
|
|
6634
|
+
if (!this.blockMoveMenu || !this.blockDragHandle) return;
|
|
6635
|
+
this.blockMoveMenu.style.display = "none";
|
|
6636
|
+
this.blockDragHandle.setAttribute("aria-expanded", "false");
|
|
6637
|
+
this.blockDragHandle.setAttribute("aria-pressed", "false");
|
|
6638
|
+
if (restoreFocus) this.blockDragHandle.focus({ preventScroll: true });
|
|
6639
|
+
}
|
|
6640
|
+
openBlockMoveMenu() {
|
|
6641
|
+
const menu = this.blockMoveMenu;
|
|
6642
|
+
const handle = this.blockDragHandle;
|
|
6643
|
+
const source = this.currentBlockDragSource();
|
|
6644
|
+
if (!menu || !handle || !source) return;
|
|
6645
|
+
this.refreshBlockMoveTargets(source);
|
|
6646
|
+
menu.querySelectorAll("button[data-move]").forEach((button) => {
|
|
6647
|
+
button.disabled = !this.blockMoveDestination(source, button.dataset.move ?? "");
|
|
6648
|
+
});
|
|
6649
|
+
const rect = handle.getBoundingClientRect();
|
|
6650
|
+
menu.style.display = "block";
|
|
6651
|
+
menu.style.left = `${Math.max(4, rect.right + 6)}px`;
|
|
6652
|
+
menu.style.top = `${Math.max(4, rect.top)}px`;
|
|
6653
|
+
handle.setAttribute("aria-expanded", "true");
|
|
6654
|
+
handle.setAttribute("aria-pressed", "true");
|
|
6655
|
+
menu.querySelector("button:not(:disabled)")?.focus({ preventScroll: true });
|
|
6656
|
+
}
|
|
6657
|
+
/**
|
|
6658
|
+
* Resolve a move-menu action to the block it should land against, considering only destinations
|
|
6659
|
+
* the engine accepts. "Top"/"bottom" therefore mean the ends of the source's own movable region
|
|
6660
|
+
* — on a document with section breaks that is the section, not the document, which is what makes
|
|
6661
|
+
* the commands work at all there instead of always failing.
|
|
6662
|
+
*/
|
|
6663
|
+
blockMoveDestination(source, action) {
|
|
6664
|
+
const units = this.bodyUnitNodes().filter((el) => this.isMovableBlockUnit(el));
|
|
6665
|
+
const index = units.indexOf(source);
|
|
6666
|
+
if (index < 0) return null;
|
|
6667
|
+
const position = action === "up" || action === "top" ? "before" : "after";
|
|
6668
|
+
const candidates = units.filter((el) => el !== source && this.isValidMoveTarget(el, position)).filter((el) => position === "before" ? units.indexOf(el) < index : units.indexOf(el) > index);
|
|
6669
|
+
if (candidates.length === 0) return null;
|
|
6670
|
+
if (action === "up") return { target: candidates[candidates.length - 1], position };
|
|
6671
|
+
if (action === "down") return { target: candidates[0], position };
|
|
6672
|
+
if (action === "top") return { target: candidates[0], position };
|
|
6673
|
+
if (action === "bottom") return { target: candidates[candidates.length - 1], position };
|
|
6674
|
+
return null;
|
|
6675
|
+
}
|
|
6676
|
+
runBlockMoveMenuAction(action) {
|
|
6677
|
+
const source = this.currentBlockDragSource();
|
|
6678
|
+
if (!source) return;
|
|
6679
|
+
const destination = this.blockMoveDestination(source, action);
|
|
6680
|
+
this.closeBlockMoveMenu();
|
|
6681
|
+
if (!destination) return;
|
|
6682
|
+
const sourceId = this.anchorIdOf(source);
|
|
6683
|
+
const targetId = this.anchorIdOf(destination.target);
|
|
6684
|
+
if (sourceId && targetId) this.moveBlock(sourceId, targetId, destination.position);
|
|
6685
|
+
}
|
|
6686
|
+
/** The nearest ancestor that actually scrolls the document flow, for drag autoscroll. */
|
|
6687
|
+
scrollContainer() {
|
|
6688
|
+
const view = this.container.ownerDocument.defaultView;
|
|
6689
|
+
for (let el = this.editRoot; el; el = el.parentElement) {
|
|
6690
|
+
const overflowY = view?.getComputedStyle(el).overflowY ?? "visible";
|
|
6691
|
+
if ((overflowY === "auto" || overflowY === "scroll") && el.scrollHeight > el.clientHeight)
|
|
6692
|
+
return el;
|
|
6693
|
+
}
|
|
6694
|
+
return null;
|
|
6695
|
+
}
|
|
6696
|
+
/** Mount one floating handle; PDD owns pointer dragging while the menu owns keyboard moves. */
|
|
6697
|
+
setupBlockDrag() {
|
|
6698
|
+
if (!this.options.blockDrag || this.options.paginated || this.closed || this.blockDragHandle)
|
|
6699
|
+
return;
|
|
6700
|
+
const doc = this.container.ownerDocument;
|
|
6701
|
+
ensureBlockDragStyles(doc);
|
|
6702
|
+
const handle = doc.createElement("div");
|
|
6703
|
+
handle.className = "docx-block-handle";
|
|
6704
|
+
handle.textContent = "\u283F";
|
|
6705
|
+
handle.tabIndex = 0;
|
|
6706
|
+
handle.setAttribute("role", "button");
|
|
6707
|
+
handle.setAttribute("contenteditable", "false");
|
|
6708
|
+
handle.setAttribute("aria-haspopup", "menu");
|
|
6709
|
+
handle.setAttribute("aria-expanded", "false");
|
|
6710
|
+
handle.setAttribute("aria-pressed", "false");
|
|
6711
|
+
const indicator = doc.createElement("div");
|
|
6712
|
+
indicator.className = "docx-block-drop-indicator";
|
|
6713
|
+
const menu = doc.createElement("div");
|
|
6714
|
+
menu.className = "docx-block-move-menu";
|
|
6715
|
+
menu.setAttribute("role", "menu");
|
|
6716
|
+
menu.innerHTML = `
|
|
6717
|
+
<button type="button" role="menuitem" data-move="up">Move up</button>
|
|
6718
|
+
<button type="button" role="menuitem" data-move="down">Move down</button>
|
|
6719
|
+
<button type="button" role="menuitem" data-move="top">Move to top</button>
|
|
6720
|
+
<button type="button" role="menuitem" data-move="bottom">Move to bottom</button>`;
|
|
6721
|
+
const live = doc.createElement("div");
|
|
6722
|
+
live.className = "docx-block-live-region";
|
|
6723
|
+
live.setAttribute("role", "status");
|
|
6724
|
+
live.setAttribute("aria-live", "polite");
|
|
6725
|
+
this.container.append(handle, indicator, menu, live);
|
|
6726
|
+
this.blockDragHandle = handle;
|
|
6727
|
+
this.blockDropIndicator = indicator;
|
|
6728
|
+
this.blockMoveMenu = menu;
|
|
6729
|
+
this.blockMoveLive = live;
|
|
6730
|
+
const onPointerMove = (event) => {
|
|
6731
|
+
if (this.blockDragging || this.blockDragPointerDown) return;
|
|
6732
|
+
const unit = this.blockUnitOf(event.target);
|
|
6733
|
+
if (this.isMovableBlockUnit(unit)) this.showBlockHandle(unit);
|
|
6734
|
+
};
|
|
6735
|
+
const onFocusIn = (event) => {
|
|
6736
|
+
const unit = this.blockUnitOf(event.target);
|
|
6737
|
+
if (this.isMovableBlockUnit(unit)) this.showBlockHandle(unit);
|
|
6738
|
+
};
|
|
6739
|
+
const onPointerLeave = (event) => {
|
|
6740
|
+
const next = event.relatedTarget instanceof Node ? event.relatedTarget : null;
|
|
6741
|
+
if (next && (handle.contains(next) || menu.contains(next))) return;
|
|
6742
|
+
this.hideBlockHandle();
|
|
6743
|
+
};
|
|
6744
|
+
const onViewportChange = () => this.positionBlockHandle();
|
|
6745
|
+
this.container.addEventListener("pointermove", onPointerMove);
|
|
6746
|
+
this.container.addEventListener("focusin", onFocusIn);
|
|
6747
|
+
this.container.addEventListener("pointerleave", onPointerLeave);
|
|
6748
|
+
doc.addEventListener("scroll", onViewportChange, true);
|
|
6749
|
+
doc.defaultView?.addEventListener("resize", onViewportChange);
|
|
6750
|
+
this.blockDragCleanup.push(
|
|
6751
|
+
() => this.container.removeEventListener("pointermove", onPointerMove),
|
|
6752
|
+
() => this.container.removeEventListener("focusin", onFocusIn),
|
|
6753
|
+
() => this.container.removeEventListener("pointerleave", onPointerLeave),
|
|
6754
|
+
() => doc.removeEventListener("scroll", onViewportChange, true),
|
|
6755
|
+
() => doc.defaultView?.removeEventListener("resize", onViewportChange)
|
|
6756
|
+
);
|
|
6757
|
+
const onHandleClick = () => {
|
|
6758
|
+
if (menu.style.display === "block") this.closeBlockMoveMenu();
|
|
6759
|
+
else this.openBlockMoveMenu();
|
|
6760
|
+
};
|
|
6761
|
+
const onHandlePointerDown = () => {
|
|
6762
|
+
this.blockDragPointerDown = true;
|
|
6763
|
+
};
|
|
6764
|
+
const onPointerUp = () => {
|
|
6765
|
+
this.blockDragPointerDown = false;
|
|
6766
|
+
};
|
|
6767
|
+
const onHandleKeydown = (event) => {
|
|
6768
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
6769
|
+
event.preventDefault();
|
|
6770
|
+
onHandleClick();
|
|
6771
|
+
};
|
|
6772
|
+
const onMenuClick = (event) => {
|
|
6773
|
+
const button = event.target?.closest("button[data-move]");
|
|
6774
|
+
if (button && !button.disabled) this.runBlockMoveMenuAction(button.dataset.move ?? "");
|
|
6775
|
+
};
|
|
6776
|
+
const onMenuKeydown = (event) => {
|
|
6777
|
+
if (event.key === "Escape") {
|
|
6778
|
+
event.preventDefault();
|
|
6779
|
+
this.closeBlockMoveMenu(true);
|
|
6780
|
+
}
|
|
6781
|
+
};
|
|
6782
|
+
handle.addEventListener("click", onHandleClick);
|
|
6783
|
+
handle.addEventListener("pointerdown", onHandlePointerDown);
|
|
6784
|
+
handle.addEventListener("keydown", onHandleKeydown);
|
|
6785
|
+
menu.addEventListener("click", onMenuClick);
|
|
6786
|
+
menu.addEventListener("keydown", onMenuKeydown);
|
|
6787
|
+
doc.addEventListener("pointerup", onPointerUp, true);
|
|
6788
|
+
doc.addEventListener("pointercancel", onPointerUp, true);
|
|
6789
|
+
this.blockDragCleanup.push(
|
|
6790
|
+
() => handle.removeEventListener("click", onHandleClick),
|
|
6791
|
+
() => handle.removeEventListener("pointerdown", onHandlePointerDown),
|
|
6792
|
+
() => handle.removeEventListener("keydown", onHandleKeydown),
|
|
6793
|
+
() => menu.removeEventListener("click", onMenuClick),
|
|
6794
|
+
() => menu.removeEventListener("keydown", onMenuKeydown),
|
|
6795
|
+
() => doc.removeEventListener("pointerup", onPointerUp, true),
|
|
6796
|
+
() => doc.removeEventListener("pointercancel", onPointerUp, true)
|
|
6797
|
+
);
|
|
6798
|
+
this.blockDragCleanup.push(draggable({
|
|
6799
|
+
element: handle,
|
|
6800
|
+
canDrag: () => !!this.currentBlockDragSource(),
|
|
6801
|
+
getInitialData: () => {
|
|
6802
|
+
const source = this.currentBlockDragSource();
|
|
6803
|
+
return { type: BLOCK_DRAG_TYPE, sourceAnchorId: source ? this.anchorIdOf(source) : void 0 };
|
|
6804
|
+
},
|
|
6805
|
+
onDragStart: () => {
|
|
6806
|
+
this.blockDragging = true;
|
|
6807
|
+
handle.classList.add("docx-block-dragging");
|
|
6808
|
+
this.closeBlockMoveMenu();
|
|
6809
|
+
this.refreshBlockMoveTargets(this.currentBlockDragSource());
|
|
6810
|
+
this.refreshBlockDropTargets();
|
|
6811
|
+
},
|
|
6812
|
+
onDrop: () => {
|
|
6813
|
+
this.blockDragging = false;
|
|
6814
|
+
this.blockDragPointerDown = false;
|
|
6815
|
+
handle.classList.remove("docx-block-dragging");
|
|
6816
|
+
this.hideDropIndicator();
|
|
6817
|
+
}
|
|
6818
|
+
}));
|
|
6819
|
+
this.blockDragCleanup.push(monitorForElements({
|
|
6820
|
+
canMonitor: ({ source }) => source.data.type === BLOCK_DRAG_TYPE,
|
|
6821
|
+
onDrop: ({ source, location: location2 }) => {
|
|
6822
|
+
this.hideDropIndicator();
|
|
6823
|
+
const drop = location2.current.dropTargets[0]?.data;
|
|
6824
|
+
const sourceId = source.data.sourceAnchorId;
|
|
6825
|
+
const targetId = drop?.targetAnchorId;
|
|
6826
|
+
const position = drop?.position === "after" ? "after" : "before";
|
|
6827
|
+
if (typeof sourceId === "string" && typeof targetId === "string")
|
|
6828
|
+
this.moveBlock(sourceId, targetId, position);
|
|
6829
|
+
else
|
|
6830
|
+
this.announceBlockMove("Move cancelled \u2014 the block was not dropped on a valid position.");
|
|
6831
|
+
}
|
|
6832
|
+
}));
|
|
6833
|
+
const scroller = this.scrollContainer();
|
|
6834
|
+
if (scroller) {
|
|
6835
|
+
this.blockDragCleanup.push(autoScrollForElements({
|
|
6836
|
+
element: scroller,
|
|
6837
|
+
canScroll: ({ source }) => source.data.type === BLOCK_DRAG_TYPE,
|
|
6838
|
+
getAllowedAxis: () => "vertical"
|
|
6839
|
+
}));
|
|
6840
|
+
}
|
|
6841
|
+
this.blockDragCleanup.push(autoScrollWindowForElements({
|
|
6842
|
+
canScroll: ({ source }) => source.data.type === BLOCK_DRAG_TYPE,
|
|
6843
|
+
getAllowedAxis: () => "vertical"
|
|
6844
|
+
}));
|
|
6845
|
+
this.refreshBlockDropTargets();
|
|
6846
|
+
}
|
|
6847
|
+
teardownBlockDrag() {
|
|
6848
|
+
for (const cleanup of this.blockDragTargetCleanup.splice(0)) cleanup();
|
|
6849
|
+
for (const cleanup of this.blockDragCleanup.splice(0)) cleanup();
|
|
6850
|
+
this.blockDragHandle?.remove();
|
|
6851
|
+
this.blockDropIndicator?.remove();
|
|
6852
|
+
this.blockMoveMenu?.remove();
|
|
6853
|
+
this.blockMoveLive?.remove();
|
|
6854
|
+
this.blockDragHandle = null;
|
|
6855
|
+
this.blockDropIndicator = null;
|
|
6856
|
+
this.blockMoveMenu = null;
|
|
6857
|
+
this.blockMoveLive = null;
|
|
6858
|
+
this.blockDragSource = null;
|
|
6859
|
+
this.blockDragging = false;
|
|
6860
|
+
this.blockDragPointerDown = false;
|
|
6861
|
+
}
|
|
3854
6862
|
// ─── internals ───────────────────────────────────────────────────────
|
|
3855
6863
|
assertOpen() {
|
|
3856
6864
|
if (this.closed) throw new Error("DocxEditor is closed");
|
|
@@ -3972,6 +6980,10 @@ var Docxodus = (() => {
|
|
|
3972
6980
|
}
|
|
3973
6981
|
wireBlock(el) {
|
|
3974
6982
|
if (!EDITABLE_TAGS.has(el.tagName)) return;
|
|
6983
|
+
if (el.closest("tr[class$='row-del'], tr[class*='row-del ']") || el.querySelector(":scope > del[class$='move-from'], :scope > del[class*='move-from ']")) {
|
|
6984
|
+
el.setAttribute("contenteditable", "false");
|
|
6985
|
+
return;
|
|
6986
|
+
}
|
|
3975
6987
|
const unid = el.getAttribute("data-anchor");
|
|
3976
6988
|
if (!unid || !this.anchorIdOf(el)) return;
|
|
3977
6989
|
el.setAttribute("contenteditable", "true");
|
|
@@ -4033,12 +7045,7 @@ var Docxodus = (() => {
|
|
|
4033
7045
|
this.options.onEdit?.({ anchorId: newAnchor, unid: newUnid });
|
|
4034
7046
|
return;
|
|
4035
7047
|
}
|
|
4036
|
-
const html = this.
|
|
4037
|
-
this.handle,
|
|
4038
|
-
newAnchor,
|
|
4039
|
-
this.options.cssPrefix,
|
|
4040
|
-
this.options.fabricateClasses
|
|
4041
|
-
);
|
|
7048
|
+
const html = this.renderBlockHtml(newAnchor);
|
|
4042
7049
|
if (html.charCodeAt(0) !== 123) {
|
|
4043
7050
|
const fresh = new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
4044
7051
|
const inBand = this.isBandBlock(el);
|
|
@@ -4079,9 +7086,10 @@ var Docxodus = (() => {
|
|
|
4079
7086
|
}
|
|
4080
7087
|
}
|
|
4081
7088
|
const inTableCell = !!el.closest("table");
|
|
4082
|
-
if (ev.key === "Tab") {
|
|
7089
|
+
if (ev.key === "Tab" && !ev.ctrlKey && !ev.metaKey && !ev.altKey && !ev.isComposing) {
|
|
4083
7090
|
if (inTableCell) {
|
|
4084
7091
|
ev.preventDefault();
|
|
7092
|
+
this.navigateTableCell(el, ev.shiftKey);
|
|
4085
7093
|
return;
|
|
4086
7094
|
}
|
|
4087
7095
|
if (isListBlock(el)) {
|
|
@@ -4110,6 +7118,42 @@ var Docxodus = (() => {
|
|
|
4110
7118
|
}
|
|
4111
7119
|
}
|
|
4112
7120
|
}
|
|
7121
|
+
/** Editable cells in visual document order, excluding cells from any nested table. */
|
|
7122
|
+
tableCellsFor(el) {
|
|
7123
|
+
const cell = el.closest("td, th");
|
|
7124
|
+
const table = cell?.closest("table");
|
|
7125
|
+
if (!cell || !table) return null;
|
|
7126
|
+
const cells = Array.from(table.querySelectorAll("td, th")).filter((candidate) => candidate.closest("table") === table);
|
|
7127
|
+
const index = cells.indexOf(cell);
|
|
7128
|
+
return index >= 0 ? { cells, index } : null;
|
|
7129
|
+
}
|
|
7130
|
+
/** First addressable paragraph in a cell, fenced against nested-table descendants. */
|
|
7131
|
+
editableInCell(cell) {
|
|
7132
|
+
return Array.from(
|
|
7133
|
+
cell.querySelectorAll('[data-anchor][contenteditable="true"]')
|
|
7134
|
+
).find((block) => block.closest("td, th") === cell) ?? null;
|
|
7135
|
+
}
|
|
7136
|
+
/** Word-style cell navigation: Shift+Tab goes back, Tab goes forward, and Tab at the
|
|
7137
|
+
* final cell appends a row before entering its first cell. The first cell is a hard
|
|
7138
|
+
* boundary for Shift+Tab so focus never leaks out of the editor table. */
|
|
7139
|
+
navigateTableCell(el, backwards) {
|
|
7140
|
+
const state = this.tableCellsFor(el);
|
|
7141
|
+
if (!state) return;
|
|
7142
|
+
const adjacent = state.cells[state.index + (backwards ? -1 : 1)];
|
|
7143
|
+
if (adjacent) {
|
|
7144
|
+
const target2 = this.editableInCell(adjacent);
|
|
7145
|
+
if (target2) placeCaretAtOffset(target2, 0);
|
|
7146
|
+
return;
|
|
7147
|
+
}
|
|
7148
|
+
if (backwards) return;
|
|
7149
|
+
this.activeBlock = el;
|
|
7150
|
+
this.insertTableRow("below");
|
|
7151
|
+
const fresh = this.activeBlock ? this.tableCellsFor(this.activeBlock) : null;
|
|
7152
|
+
if (!fresh) return;
|
|
7153
|
+
const target = fresh.cells[fresh.index + 1];
|
|
7154
|
+
const block = target ? this.editableInCell(target) : null;
|
|
7155
|
+
if (block) placeCaretAtOffset(block, 0);
|
|
7156
|
+
}
|
|
4113
7157
|
/** Shift+Enter: insert an intra-paragraph line break at the caret. Delegates to the
|
|
4114
7158
|
* native `insertLineBreak` command, which inserts a <br> AND positions the caret
|
|
4115
7159
|
* after it correctly (handling the browser's bogus trailing-<br> rule) so typing
|
|
@@ -4219,21 +7263,21 @@ var Docxodus = (() => {
|
|
|
4219
7263
|
while (p < minLen && old[p] === next[p]) p++;
|
|
4220
7264
|
let s = 0;
|
|
4221
7265
|
while (s < minLen - p && old[old.length - 1 - s] === next[next.length - 1 - s]) s++;
|
|
4222
|
-
let
|
|
7266
|
+
let start2 = p;
|
|
4223
7267
|
let len = old.length - p - s;
|
|
4224
7268
|
let middle = next.slice(p, next.length - s);
|
|
4225
7269
|
if (len === 0) {
|
|
4226
|
-
if (
|
|
4227
|
-
|
|
7270
|
+
if (start2 > 0) {
|
|
7271
|
+
start2 -= 1;
|
|
4228
7272
|
len = 1;
|
|
4229
|
-
middle = old[
|
|
7273
|
+
middle = old[start2] + middle;
|
|
4230
7274
|
} else {
|
|
4231
7275
|
len = 1;
|
|
4232
7276
|
middle = middle + old[0];
|
|
4233
7277
|
}
|
|
4234
7278
|
}
|
|
4235
7279
|
return this.parseEdit(
|
|
4236
|
-
this.exports.DocxSessionBridge.ReplaceTextAtSpan(this.handle, fullId,
|
|
7280
|
+
this.exports.DocxSessionBridge.ReplaceTextAtSpan(this.handle, fullId, start2, len, middle)
|
|
4237
7281
|
);
|
|
4238
7282
|
}
|
|
4239
7283
|
/** Flush a block's current (uncommitted) text to the session; returns the live full id. */
|
|
@@ -4245,14 +7289,34 @@ var Docxodus = (() => {
|
|
|
4245
7289
|
}
|
|
4246
7290
|
/** Render a block by anchor and parse it into a detached element (null on error). */
|
|
4247
7291
|
renderInto(anchorId) {
|
|
4248
|
-
const html = this.
|
|
7292
|
+
const html = this.renderBlockHtml(anchorId);
|
|
7293
|
+
if (html.charCodeAt(0) === 123) return null;
|
|
7294
|
+
return new DOMParser().parseFromString(html, "text/html").body.firstElementChild;
|
|
7295
|
+
}
|
|
7296
|
+
get renderTrackedChanges() {
|
|
7297
|
+
return this.options.trackedChanges === 1 /* RenderInline */;
|
|
7298
|
+
}
|
|
7299
|
+
renderBlockHtml(anchorId) {
|
|
7300
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
7301
|
+
if (typeof bridge.RenderBlockHtmlForReview === "function") {
|
|
7302
|
+
return bridge.RenderBlockHtmlForReview(
|
|
7303
|
+
this.handle,
|
|
7304
|
+
anchorId,
|
|
7305
|
+
this.options.cssPrefix,
|
|
7306
|
+
this.options.fabricateClasses,
|
|
7307
|
+
this.renderTrackedChanges
|
|
7308
|
+
);
|
|
7309
|
+
}
|
|
7310
|
+
return bridge.RenderBlockHtml(
|
|
4249
7311
|
this.handle,
|
|
4250
7312
|
anchorId,
|
|
4251
7313
|
this.options.cssPrefix,
|
|
4252
7314
|
this.options.fabricateClasses
|
|
4253
7315
|
);
|
|
4254
|
-
|
|
4255
|
-
|
|
7316
|
+
}
|
|
7317
|
+
renderPlanJson() {
|
|
7318
|
+
const bridge = this.exports.DocxSessionBridge;
|
|
7319
|
+
return typeof bridge.ListRenderedBlocks === "function" ? bridge.ListRenderedBlocks(this.handle, this.renderTrackedChanges) : bridge.ListBlocks(this.handle);
|
|
4256
7320
|
}
|
|
4257
7321
|
/** Render two blocks in ONE batched bridge call when the bundle carries RenderBlocksHtml —
|
|
4258
7322
|
* the per-render shell/converter setup is paid once instead of twice, which matters on the
|
|
@@ -4263,14 +7327,20 @@ var Docxodus = (() => {
|
|
|
4263
7327
|
const bridge = this.exports.DocxSessionBridge;
|
|
4264
7328
|
if (typeof bridge.RenderBlocksHtml === "function") {
|
|
4265
7329
|
try {
|
|
4266
|
-
const
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
7330
|
+
const idsJson = JSON.stringify([a, b]);
|
|
7331
|
+
const json = typeof bridge.RenderBlocksHtmlForReview === "function" ? bridge.RenderBlocksHtmlForReview(
|
|
7332
|
+
this.handle,
|
|
7333
|
+
idsJson,
|
|
7334
|
+
this.options.cssPrefix,
|
|
7335
|
+
this.options.fabricateClasses,
|
|
7336
|
+
this.renderTrackedChanges
|
|
7337
|
+
) : bridge.RenderBlocksHtml(
|
|
7338
|
+
this.handle,
|
|
7339
|
+
idsJson,
|
|
7340
|
+
this.options.cssPrefix,
|
|
7341
|
+
this.options.fabricateClasses
|
|
4273
7342
|
);
|
|
7343
|
+
const map = JSON.parse(json);
|
|
4274
7344
|
if (!map.error) {
|
|
4275
7345
|
const parse = (h) => h ? new DOMParser().parseFromString(h, "text/html").body.firstElementChild : null;
|
|
4276
7346
|
const fa = parse(map[a]);
|
|
@@ -4313,9 +7383,9 @@ var Docxodus = (() => {
|
|
|
4313
7383
|
const first = all.find((block) => block.getAttribute("data-anchor") === bookmark.startUnid);
|
|
4314
7384
|
const last = all.find((block) => block.getAttribute("data-anchor") === bookmark.endUnid);
|
|
4315
7385
|
if (!first || !last || first === last || all.indexOf(first) > all.indexOf(last)) return false;
|
|
4316
|
-
const
|
|
7386
|
+
const start2 = contentPositionIn(first, bookmark.startOffset);
|
|
4317
7387
|
const end = contentPositionIn(last, bookmark.endOffset);
|
|
4318
|
-
return setSelectionBetween(
|
|
7388
|
+
return setSelectionBetween(start2, end);
|
|
4319
7389
|
}
|
|
4320
7390
|
/** Editable blocks the current selection covers, in document order. Uses Range.comparePoint
|
|
4321
7391
|
* (robust to a selection boundary that normalized onto a wrapper element rather than a block
|
|
@@ -4358,8 +7428,8 @@ var Docxodus = (() => {
|
|
|
4358
7428
|
if (hasStart && hasEnd) return selectionSpanIn(block);
|
|
4359
7429
|
const contentLen = blockContentText(block).length;
|
|
4360
7430
|
if (hasStart) {
|
|
4361
|
-
const
|
|
4362
|
-
return trimmedSpan(block, { start, length: Math.max(0, contentLen -
|
|
7431
|
+
const start2 = contentOffsetOf(block, range.startContainer, range.startOffset);
|
|
7432
|
+
return trimmedSpan(block, { start: start2, length: Math.max(0, contentLen - start2) });
|
|
4363
7433
|
}
|
|
4364
7434
|
if (hasEnd) {
|
|
4365
7435
|
const end = contentOffsetOf(block, range.endContainer, range.endOffset);
|
|
@@ -4954,6 +8024,17 @@ var Docxodus = (() => {
|
|
|
4954
8024
|
*/
|
|
4955
8025
|
renderFullHtml() {
|
|
4956
8026
|
const bridge = this.exports.DocxSessionBridge;
|
|
8027
|
+
if (typeof bridge.RenderHtmlForReview === "function") {
|
|
8028
|
+
const html = bridge.RenderHtmlForReview(
|
|
8029
|
+
this.handle,
|
|
8030
|
+
this.options.cssPrefix,
|
|
8031
|
+
this.options.fabricateClasses,
|
|
8032
|
+
this.options.paginated,
|
|
8033
|
+
this.options.scale,
|
|
8034
|
+
this.renderTrackedChanges
|
|
8035
|
+
);
|
|
8036
|
+
if (html.charCodeAt(0) !== 123) return html;
|
|
8037
|
+
}
|
|
4957
8038
|
if (typeof bridge.RenderHtml === "function") {
|
|
4958
8039
|
const html = bridge.RenderHtml(
|
|
4959
8040
|
this.handle,
|
|
@@ -4966,7 +8047,14 @@ var Docxodus = (() => {
|
|
|
4966
8047
|
}
|
|
4967
8048
|
const bytes = typeof bridge.SaveWithAnchorIds === "function" ? bridge.SaveWithAnchorIds(this.handle) : bridge.Save(this.handle);
|
|
4968
8049
|
return this.exports.DocumentConverter.ConvertDocxToHtmlComplete(
|
|
4969
|
-
...completeArgs(
|
|
8050
|
+
...completeArgs(
|
|
8051
|
+
bytes,
|
|
8052
|
+
this.options.cssPrefix,
|
|
8053
|
+
this.options.fabricateClasses,
|
|
8054
|
+
this.options.paginated,
|
|
8055
|
+
this.options.scale,
|
|
8056
|
+
this.renderTrackedChanges
|
|
8057
|
+
)
|
|
4970
8058
|
);
|
|
4971
8059
|
}
|
|
4972
8060
|
/** Editable BODY blocks in document order (band blocks are enumerated by `ownerRoot`). */
|
|
@@ -5060,7 +8148,7 @@ var Docxodus = (() => {
|
|
|
5060
8148
|
reconcileCore() {
|
|
5061
8149
|
const bridge = this.exports.DocxSessionBridge;
|
|
5062
8150
|
this.refreshAnchorMap();
|
|
5063
|
-
const plan = JSON.parse(
|
|
8151
|
+
const plan = JSON.parse(this.renderPlanJson());
|
|
5064
8152
|
if (plan.error) return this.bail(`plan error: ${plan.error}`);
|
|
5065
8153
|
const oldNodes = this.bodyUnitNodes();
|
|
5066
8154
|
const oldTokens = oldNodes.map(_DocxEditor.domTokenOf);
|
|
@@ -5070,19 +8158,26 @@ var Docxodus = (() => {
|
|
|
5070
8158
|
const fnState = this.notesDiff("footnotes", plan.footnotes);
|
|
5071
8159
|
const enState = this.notesDiff("endnotes", plan.endnotes);
|
|
5072
8160
|
if (fnState === null || enState === null) return this.bail("notes container unstampable/missing");
|
|
5073
|
-
const
|
|
8161
|
+
const movedBodyNew = new Set(bodyDiff.moved.map((m) => m.newIndex));
|
|
8162
|
+
const addedBodyIds = bodyDiff.added.filter((j) => !movedBodyNew.has(j)).map((j) => plan.body[j].id);
|
|
5074
8163
|
const addedNoteIds = fnState.diff.added.map((j) => plan.footnotes[j].id).concat(enState.diff.added.map((j) => plan.endnotes[j].id));
|
|
5075
8164
|
const allIds = addedBodyIds.concat(addedNoteIds);
|
|
5076
8165
|
let rendered = {};
|
|
5077
8166
|
if (allIds.length > 0) {
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
8167
|
+
const idsJson = JSON.stringify(allIds);
|
|
8168
|
+
const renderedJson = typeof bridge.RenderBlocksHtmlForReview === "function" ? bridge.RenderBlocksHtmlForReview(
|
|
8169
|
+
this.handle,
|
|
8170
|
+
idsJson,
|
|
8171
|
+
this.options.cssPrefix,
|
|
8172
|
+
this.options.fabricateClasses,
|
|
8173
|
+
this.renderTrackedChanges
|
|
8174
|
+
) : bridge.RenderBlocksHtml(
|
|
8175
|
+
this.handle,
|
|
8176
|
+
idsJson,
|
|
8177
|
+
this.options.cssPrefix,
|
|
8178
|
+
this.options.fabricateClasses
|
|
5085
8179
|
);
|
|
8180
|
+
rendered = JSON.parse(renderedJson);
|
|
5086
8181
|
if (rendered.error) return this.bail(`render error: ${rendered.error}`);
|
|
5087
8182
|
for (const id of allIds) if (!rendered[id]) return this.bail(`unrenderable: ${id}`);
|
|
5088
8183
|
}
|
|
@@ -5092,7 +8187,7 @@ var Docxodus = (() => {
|
|
|
5092
8187
|
return el;
|
|
5093
8188
|
};
|
|
5094
8189
|
const freshBody = /* @__PURE__ */ new Map();
|
|
5095
|
-
for (const j of bodyDiff.added) {
|
|
8190
|
+
for (const j of bodyDiff.added.filter((j2) => !movedBodyNew.has(j2))) {
|
|
5096
8191
|
const el = parse(rendered[plan.body[j].id]);
|
|
5097
8192
|
if (!el) return this.bail(`unparseable render: ${plan.body[j].id}`);
|
|
5098
8193
|
freshBody.set(j, el);
|
|
@@ -5142,13 +8237,6 @@ var Docxodus = (() => {
|
|
|
5142
8237
|
* bail-reason string (parent ambiguity, order violation, wrapper semantics) — the
|
|
5143
8238
|
* session is already correct, so bailing just means a full repaint. */
|
|
5144
8239
|
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
8240
|
const subOldByNew = new Map(diff.substituted.map((s) => [s.newIndex, s.oldIndex]));
|
|
5153
8241
|
for (const [nj, oi] of subOldByNew) {
|
|
5154
8242
|
const freshRoot = fresh.get(nj);
|
|
@@ -5164,13 +8252,18 @@ var Docxodus = (() => {
|
|
|
5164
8252
|
}
|
|
5165
8253
|
this.wireUnit(freshRoot, units[nj]);
|
|
5166
8254
|
}
|
|
5167
|
-
const
|
|
8255
|
+
const movedOldByNew = new Map(diff.moved.map((m) => [m.newIndex, m.oldIndex]));
|
|
8256
|
+
const movedNew = new Set(diff.moved.map((m) => m.newIndex));
|
|
8257
|
+
const movedOld = new Set(diff.moved.map((m) => m.oldIndex));
|
|
8258
|
+
const pureAdded = diff.added.filter((j) => !subOldByNew.has(j) && !movedNew.has(j));
|
|
5168
8259
|
const pureRemoved = diff.removed.filter(
|
|
5169
|
-
(i) => !diff.substituted.some((s) => s.oldIndex === i)
|
|
8260
|
+
(i) => !diff.substituted.some((s) => s.oldIndex === i) && !movedOld.has(i)
|
|
5170
8261
|
);
|
|
5171
8262
|
const nodeAt = (j) => {
|
|
5172
8263
|
const oi = diff.keep.get(j);
|
|
5173
8264
|
if (oi !== void 0) return oldNodes[oi];
|
|
8265
|
+
const movedOi = movedOldByNew.get(j);
|
|
8266
|
+
if (movedOi !== void 0) return oldNodes[movedOi];
|
|
5174
8267
|
if (subOldByNew.has(j)) return fresh.get(j);
|
|
5175
8268
|
const f = fresh.get(j);
|
|
5176
8269
|
return f && f.isConnected ? f : null;
|
|
@@ -5180,11 +8273,7 @@ var Docxodus = (() => {
|
|
|
5180
8273
|
let prev = null;
|
|
5181
8274
|
for (let k = j - 1; k >= 0 && !prev; k--) prev = nodeAt(k);
|
|
5182
8275
|
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
|
-
}
|
|
8276
|
+
for (let k = j + 1; k < units.length && !next; k++) next = nodeAt(k);
|
|
5188
8277
|
const prevW = prev ? this.unitWrapperOf(prev) : null;
|
|
5189
8278
|
const nextW = next ? this.unitWrapperOf(next) : null;
|
|
5190
8279
|
if (prevW && nextW && prevW.parentElement !== nextW.parentElement)
|
|
@@ -5195,8 +8284,29 @@ var Docxodus = (() => {
|
|
|
5195
8284
|
this.wireUnit(el, units[j]);
|
|
5196
8285
|
}
|
|
5197
8286
|
for (const i of pureRemoved) {
|
|
5198
|
-
|
|
5199
|
-
|
|
8287
|
+
this.unitWrapperOf(oldNodes[i]).remove();
|
|
8288
|
+
}
|
|
8289
|
+
for (const { newIndex } of [...diff.moved].sort((a, b) => a.newIndex - b.newIndex)) {
|
|
8290
|
+
const moving = nodeAt(newIndex);
|
|
8291
|
+
if (!moving?.isConnected) return "move source is not connected";
|
|
8292
|
+
const movingW = this.unitWrapperOf(moving);
|
|
8293
|
+
let prevW = null;
|
|
8294
|
+
for (let k = newIndex - 1; k >= 0 && !prevW; k--) {
|
|
8295
|
+
const n = nodeAt(k);
|
|
8296
|
+
if (n?.isConnected) prevW = this.unitWrapperOf(n);
|
|
8297
|
+
}
|
|
8298
|
+
let nextW = null;
|
|
8299
|
+
for (let k = newIndex + 1; k < units.length && !nextW; k++) {
|
|
8300
|
+
const n = nodeAt(k);
|
|
8301
|
+
if (n?.isConnected) nextW = this.unitWrapperOf(n);
|
|
8302
|
+
}
|
|
8303
|
+
if (prevW && prevW !== movingW && prevW.parentElement === movingW.parentElement) {
|
|
8304
|
+
prevW.after(movingW);
|
|
8305
|
+
} else if (nextW && nextW !== movingW && nextW.parentElement === movingW.parentElement) {
|
|
8306
|
+
nextW.before(movingW);
|
|
8307
|
+
} else {
|
|
8308
|
+
return "move neighbors in different parents";
|
|
8309
|
+
}
|
|
5200
8310
|
}
|
|
5201
8311
|
return true;
|
|
5202
8312
|
}
|
|
@@ -5320,7 +8430,7 @@ var Docxodus = (() => {
|
|
|
5320
8430
|
const bridge = this.exports.DocxSessionBridge;
|
|
5321
8431
|
if (typeof bridge.ListBlocks !== "function") return;
|
|
5322
8432
|
try {
|
|
5323
|
-
const plan = JSON.parse(
|
|
8433
|
+
const plan = JSON.parse(this.renderPlanJson());
|
|
5324
8434
|
if (plan.error) return;
|
|
5325
8435
|
const nodes = this.bodyUnitNodes();
|
|
5326
8436
|
if (nodes.length === plan.body.length) {
|
|
@@ -5349,6 +8459,7 @@ var Docxodus = (() => {
|
|
|
5349
8459
|
* block's content-hashed unid changes across the save/reproject a remount performs.
|
|
5350
8460
|
*/
|
|
5351
8461
|
remount(focusIndex = -1, caretAtEnd = false) {
|
|
8462
|
+
this.teardownBlockDrag();
|
|
5352
8463
|
this.refreshAnchorMap();
|
|
5353
8464
|
const fullHtml = this.renderFullHtml();
|
|
5354
8465
|
this.activeBlock = null;
|
|
@@ -5363,6 +8474,7 @@ var Docxodus = (() => {
|
|
|
5363
8474
|
}
|
|
5364
8475
|
}
|
|
5365
8476
|
this.syncRegionToBody(this.activeBlock ?? void 0);
|
|
8477
|
+
this.setupBlockDrag();
|
|
5366
8478
|
}
|
|
5367
8479
|
};
|
|
5368
8480
|
|
|
@@ -6571,8 +9683,12 @@ var Docxodus = (() => {
|
|
|
6571
9683
|
editable: this.options.editable,
|
|
6572
9684
|
scale: this.options.scale,
|
|
6573
9685
|
onEdit: this.options.onEdit,
|
|
9686
|
+
onMove: this.options.onMove,
|
|
6574
9687
|
paginated,
|
|
6575
|
-
headerFooter: this.headerFooter
|
|
9688
|
+
headerFooter: this.headerFooter,
|
|
9689
|
+
blockDrag: this.options.blockDrag ?? true,
|
|
9690
|
+
trackedChanges: this.options.trackedChanges,
|
|
9691
|
+
revisionAuthor: this.options.revisionAuthor
|
|
6576
9692
|
});
|
|
6577
9693
|
this.require("save").disabled = false;
|
|
6578
9694
|
this.require("ribbon").setAttribute("aria-disabled", "false");
|
|
@@ -6660,8 +9776,8 @@ var Docxodus = (() => {
|
|
|
6660
9776
|
this.keepSelection(tab);
|
|
6661
9777
|
tab.addEventListener("click", () => this.selectTab(tab.dataset.tab ?? "home"));
|
|
6662
9778
|
}
|
|
6663
|
-
const delegate = (
|
|
6664
|
-
for (const el of Array.from(ribbon.querySelectorAll(
|
|
9779
|
+
const delegate = (selector2, label, fn) => {
|
|
9780
|
+
for (const el of Array.from(ribbon.querySelectorAll(selector2))) {
|
|
6665
9781
|
this.keepSelection(el);
|
|
6666
9782
|
el.addEventListener("click", () => this.run(label(el), () => fn(el)));
|
|
6667
9783
|
}
|
|
@@ -7377,10 +10493,10 @@ var Docxodus = (() => {
|
|
|
7377
10493
|
function docxDiffSettingsJson(settings) {
|
|
7378
10494
|
return settings ? JSON.stringify(settings) : "";
|
|
7379
10495
|
}
|
|
7380
|
-
async function docxDiffCompare(
|
|
10496
|
+
async function docxDiffCompare(left2, right2, settings) {
|
|
7381
10497
|
const exports = ensureInitialized();
|
|
7382
|
-
const leftBytes = await toBytes(
|
|
7383
|
-
const rightBytes = await toBytes(
|
|
10498
|
+
const leftBytes = await toBytes(left2);
|
|
10499
|
+
const rightBytes = await toBytes(right2);
|
|
7384
10500
|
await yieldToMain();
|
|
7385
10501
|
const result = exports.DocxDiffBridge.Compare(
|
|
7386
10502
|
leftBytes,
|
|
@@ -7392,10 +10508,10 @@ var Docxodus = (() => {
|
|
|
7392
10508
|
}
|
|
7393
10509
|
return result;
|
|
7394
10510
|
}
|
|
7395
|
-
async function docxDiffGetRevisions(
|
|
10511
|
+
async function docxDiffGetRevisions(left2, right2, settings) {
|
|
7396
10512
|
const exports = ensureInitialized();
|
|
7397
|
-
const leftBytes = await toBytes(
|
|
7398
|
-
const rightBytes = await toBytes(
|
|
10513
|
+
const leftBytes = await toBytes(left2);
|
|
10514
|
+
const rightBytes = await toBytes(right2);
|
|
7399
10515
|
await yieldToMain();
|
|
7400
10516
|
const result = exports.DocxDiffBridge.GetRevisionsJson(
|
|
7401
10517
|
leftBytes,
|
|
@@ -7423,10 +10539,10 @@ var Docxodus = (() => {
|
|
|
7423
10539
|
rightAnchor: r.rightAnchor ?? r.RightAnchor ?? void 0
|
|
7424
10540
|
}));
|
|
7425
10541
|
}
|
|
7426
|
-
async function docxDiffGetEditScript(
|
|
10542
|
+
async function docxDiffGetEditScript(left2, right2, settings) {
|
|
7427
10543
|
const exports = ensureInitialized();
|
|
7428
|
-
const leftBytes = await toBytes(
|
|
7429
|
-
const rightBytes = await toBytes(
|
|
10544
|
+
const leftBytes = await toBytes(left2);
|
|
10545
|
+
const rightBytes = await toBytes(right2);
|
|
7430
10546
|
await yieldToMain();
|
|
7431
10547
|
const result = exports.DocxDiffBridge.GetEditScriptJson(
|
|
7432
10548
|
leftBytes,
|
|
@@ -8054,8 +11170,8 @@ var Docxodus = (() => {
|
|
|
8054
11170
|
if (occurrence > offsets.length) {
|
|
8055
11171
|
return null;
|
|
8056
11172
|
}
|
|
8057
|
-
const { start, end } = offsets[occurrence - 1];
|
|
8058
|
-
return createAnnotation(id, labelId, documentText,
|
|
11173
|
+
const { start: start2, end } = offsets[occurrence - 1];
|
|
11174
|
+
return createAnnotation(id, labelId, documentText, start2, end);
|
|
8059
11175
|
}
|
|
8060
11176
|
function findTextOccurrences(documentText, searchText, maxResults = 100) {
|
|
8061
11177
|
if (!searchText) return [];
|
|
@@ -8298,7 +11414,7 @@ var Docxodus = (() => {
|
|
|
8298
11414
|
}
|
|
8299
11415
|
function splitSelectorList(selectorText) {
|
|
8300
11416
|
const selectors = [];
|
|
8301
|
-
let
|
|
11417
|
+
let start2 = 0;
|
|
8302
11418
|
let parentheses = 0;
|
|
8303
11419
|
let brackets = 0;
|
|
8304
11420
|
let quote = "";
|
|
@@ -8326,15 +11442,15 @@ var Docxodus = (() => {
|
|
|
8326
11442
|
else if (ch === "[") brackets++;
|
|
8327
11443
|
else if (ch === "]") brackets--;
|
|
8328
11444
|
else if (ch === "," && parentheses === 0 && brackets === 0) {
|
|
8329
|
-
selectors.push(selectorText.slice(
|
|
8330
|
-
|
|
11445
|
+
selectors.push(selectorText.slice(start2, i).trim());
|
|
11446
|
+
start2 = i + 1;
|
|
8331
11447
|
}
|
|
8332
11448
|
}
|
|
8333
|
-
selectors.push(selectorText.slice(
|
|
11449
|
+
selectors.push(selectorText.slice(start2).trim());
|
|
8334
11450
|
return selectors.filter(Boolean);
|
|
8335
11451
|
}
|
|
8336
|
-
function scopeSelector(
|
|
8337
|
-
let remaining =
|
|
11452
|
+
function scopeSelector(selector2, rootSelector) {
|
|
11453
|
+
let remaining = selector2.trim();
|
|
8338
11454
|
let consumedRoot = false;
|
|
8339
11455
|
let separated = false;
|
|
8340
11456
|
for (; ; ) {
|
|
@@ -8365,7 +11481,7 @@ var Docxodus = (() => {
|
|
|
8365
11481
|
}
|
|
8366
11482
|
if (rule.type === CSSRule.STYLE_RULE) {
|
|
8367
11483
|
const styleRule = rule;
|
|
8368
|
-
styleRule.selectorText = splitSelectorList(styleRule.selectorText).map((
|
|
11484
|
+
styleRule.selectorText = splitSelectorList(styleRule.selectorText).map((selector2) => scopeSelector(selector2, rootSelector)).join(", ");
|
|
8369
11485
|
continue;
|
|
8370
11486
|
}
|
|
8371
11487
|
const grouping = rule;
|
|
@@ -8405,6 +11521,10 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8405
11521
|
if (renderHtml) {
|
|
8406
11522
|
bridge.RenderHtml = (...args) => scopeDocumentStyles(renderHtml(...args), rootSelector);
|
|
8407
11523
|
}
|
|
11524
|
+
const renderHtmlForReview = bridge.RenderHtmlForReview;
|
|
11525
|
+
if (renderHtmlForReview) {
|
|
11526
|
+
bridge.RenderHtmlForReview = (...args) => scopeDocumentStyles(renderHtmlForReview(...args), rootSelector);
|
|
11527
|
+
}
|
|
8408
11528
|
return {
|
|
8409
11529
|
DocxSessionBridge: bridge,
|
|
8410
11530
|
DocumentConverter: {
|
|
@@ -8433,7 +11553,7 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8433
11553
|
const el = resolveContainer2(container);
|
|
8434
11554
|
const { wasmBasePath: wasmBasePath2, ...conversion } = options;
|
|
8435
11555
|
await ensureWasm(wasmBasePath2);
|
|
8436
|
-
const
|
|
11556
|
+
const mount2 = createScopedMount(el);
|
|
8437
11557
|
let lastHtml = "";
|
|
8438
11558
|
const render = async (src, opts) => {
|
|
8439
11559
|
const bytes = await toDocumentBytes(src);
|
|
@@ -8446,13 +11566,13 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8446
11566
|
parsed.querySelectorAll("style").forEach((sourceStyle) => {
|
|
8447
11567
|
const style = document.createElement("style");
|
|
8448
11568
|
style.textContent = sourceStyle.textContent;
|
|
8449
|
-
scopeStyleElement(style,
|
|
11569
|
+
scopeStyleElement(style, mount2.selector);
|
|
8450
11570
|
fragment.appendChild(style);
|
|
8451
11571
|
});
|
|
8452
11572
|
const body = document.createElement("template");
|
|
8453
11573
|
body.innerHTML = parsed.body.innerHTML;
|
|
8454
11574
|
fragment.appendChild(body.content);
|
|
8455
|
-
|
|
11575
|
+
mount2.root.replaceChildren(fragment);
|
|
8456
11576
|
};
|
|
8457
11577
|
await render(source, conversion);
|
|
8458
11578
|
return {
|
|
@@ -8470,13 +11590,13 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8470
11590
|
const el = resolveContainer2(container);
|
|
8471
11591
|
const { wasmBasePath: wasmBasePath2, ...editorOptions } = options;
|
|
8472
11592
|
await ensureWasm(wasmBasePath2);
|
|
8473
|
-
const
|
|
11593
|
+
const mount2 = createScopedMount(el);
|
|
8474
11594
|
const exports = createScopedEditorExports(
|
|
8475
11595
|
getWasmExports(),
|
|
8476
|
-
|
|
11596
|
+
mount2.selector
|
|
8477
11597
|
);
|
|
8478
11598
|
try {
|
|
8479
|
-
return source == null ? DocxEditor.openBlank(
|
|
11599
|
+
return source == null ? DocxEditor.openBlank(mount2.root, exports, editorOptions) : DocxEditor.open(mount2.root, await toDocumentBytes(source), exports, editorOptions);
|
|
8480
11600
|
} catch (error) {
|
|
8481
11601
|
el.replaceChildren();
|
|
8482
11602
|
throw error;
|
|
@@ -8494,10 +11614,10 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8494
11614
|
async function createRibbonEditor(container, source, options = {}) {
|
|
8495
11615
|
const el = resolveContainer2(container);
|
|
8496
11616
|
const { wasmBasePath: wasmBasePath2, ...ribbonOptions } = options;
|
|
8497
|
-
const
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
const ribbon = mountRibbon(
|
|
11617
|
+
const mount2 = createScopedMount(el);
|
|
11618
|
+
mount2.root.style.height = "100%";
|
|
11619
|
+
mount2.root.style.minHeight = "0";
|
|
11620
|
+
const ribbon = mountRibbon(mount2.root, {
|
|
8501
11621
|
documentName: ribbonOptions.documentName ?? nameFromSource(source),
|
|
8502
11622
|
...ribbonOptions,
|
|
8503
11623
|
// Exports arrive after the runtime boots; the loader covers that gap.
|
|
@@ -8509,7 +11629,7 @@ ${parsed.documentElement.outerHTML}`;
|
|
|
8509
11629
|
ribbon.setExports(
|
|
8510
11630
|
createScopedEditorExports(
|
|
8511
11631
|
getWasmExports(),
|
|
8512
|
-
`${
|
|
11632
|
+
`${mount2.selector} [data-dxr-surface]`
|
|
8513
11633
|
)
|
|
8514
11634
|
);
|
|
8515
11635
|
ribbon.loader.stage(1);
|