vim-web 0.4.0 → 0.4.1-dev.1
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/types/core-viewers/webgl/viewer/camera/camera.d.ts +3 -4
- package/dist/types/core-viewers/webgl/viewer/camera/cameraInterface.d.ts +9 -0
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovement.d.ts +5 -2
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovementLerp.d.ts +2 -2
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovementSnap.d.ts +0 -1
- package/dist/types/core-viewers/webgl/viewer/camera/cameraOrthographic.d.ts +1 -2
- package/dist/types/core-viewers/webgl/viewer/camera/cameraPerspective.d.ts +1 -2
- package/dist/vim-web.iife.js +126 -108
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +126 -108
- package/dist/vim-web.js.map +1 -1
- package/package.json +2 -2
package/dist/vim-web.js
CHANGED
|
@@ -46838,7 +46838,7 @@ let Vim$1 = class Vim {
|
|
|
46838
46838
|
return this._onDispose;
|
|
46839
46839
|
}
|
|
46840
46840
|
getBoundingBox() {
|
|
46841
|
-
const box = this.
|
|
46841
|
+
const box = this.scene.getBoundingBox();
|
|
46842
46842
|
return Promise.resolve(box);
|
|
46843
46843
|
}
|
|
46844
46844
|
/**
|
|
@@ -50031,6 +50031,24 @@ const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
50031
50031
|
createTransparent,
|
|
50032
50032
|
createWireframe
|
|
50033
50033
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
50034
|
+
class CameraSaveState {
|
|
50035
|
+
constructor(camera2) {
|
|
50036
|
+
__publicField(this, "_camera");
|
|
50037
|
+
__publicField(this, "_position", new Vector3());
|
|
50038
|
+
__publicField(this, "_target", new Vector3());
|
|
50039
|
+
this._camera = camera2;
|
|
50040
|
+
}
|
|
50041
|
+
save() {
|
|
50042
|
+
this._position.copy(this._camera.position);
|
|
50043
|
+
this._target.copy(this._camera.target);
|
|
50044
|
+
}
|
|
50045
|
+
get position() {
|
|
50046
|
+
return this._position;
|
|
50047
|
+
}
|
|
50048
|
+
get target() {
|
|
50049
|
+
return this._target;
|
|
50050
|
+
}
|
|
50051
|
+
}
|
|
50034
50052
|
const _Marker = class _Marker {
|
|
50035
50053
|
/**
|
|
50036
50054
|
* Constructs a new Marker object.
|
|
@@ -50214,9 +50232,13 @@ __publicField(_Marker, "_tmpMatrix", new Matrix4());
|
|
|
50214
50232
|
__publicField(_Marker, "_unitVector", new Vector3(1, 1, 1));
|
|
50215
50233
|
let Marker = _Marker;
|
|
50216
50234
|
class CameraMovement {
|
|
50217
|
-
constructor(camera2) {
|
|
50235
|
+
constructor(camera2, savedState, getBoundingBox) {
|
|
50218
50236
|
__publicField(this, "_camera");
|
|
50237
|
+
__publicField(this, "_savedState");
|
|
50238
|
+
__publicField(this, "_getBoundingBox");
|
|
50219
50239
|
this._camera = camera2;
|
|
50240
|
+
this._savedState = savedState;
|
|
50241
|
+
this._getBoundingBox = getBoundingBox;
|
|
50220
50242
|
}
|
|
50221
50243
|
/**
|
|
50222
50244
|
* Moves the camera in a specified 2D direction within a plane defined by the given axes.
|
|
@@ -50264,6 +50286,12 @@ class CameraMovement {
|
|
|
50264
50286
|
angle.multiplyScalar(180 / Math.PI);
|
|
50265
50287
|
this.orbit(angle);
|
|
50266
50288
|
}
|
|
50289
|
+
/**
|
|
50290
|
+
* Resets the camera to its last saved position and orientation.
|
|
50291
|
+
*/
|
|
50292
|
+
reset() {
|
|
50293
|
+
this.set(this._camera.position, this._camera.target);
|
|
50294
|
+
}
|
|
50267
50295
|
/**
|
|
50268
50296
|
* Sets the camera's orientation and position to focus on the specified target.
|
|
50269
50297
|
* @param {IObject | Vim | THREE.Sphere | THREE.Box3 | 'all' | undefined} target - The target object, or 'all' to frame all objects.
|
|
@@ -50278,7 +50306,7 @@ class CameraMovement {
|
|
|
50278
50306
|
}
|
|
50279
50307
|
if (target === "all") {
|
|
50280
50308
|
console.log("frame all");
|
|
50281
|
-
target = this.
|
|
50309
|
+
target = this._getBoundingBox();
|
|
50282
50310
|
}
|
|
50283
50311
|
if (target instanceof Box3) {
|
|
50284
50312
|
target = target.getBoundingSphere(new Sphere());
|
|
@@ -50310,8 +50338,8 @@ class CameraMovement {
|
|
|
50310
50338
|
}
|
|
50311
50339
|
}
|
|
50312
50340
|
class CameraLerp extends CameraMovement {
|
|
50313
|
-
constructor(camera2, movement) {
|
|
50314
|
-
super(camera2);
|
|
50341
|
+
constructor(camera2, movement, savedState, getBoundingBox) {
|
|
50342
|
+
super(camera2, savedState, getBoundingBox);
|
|
50315
50343
|
__publicField(this, "_movement");
|
|
50316
50344
|
__publicField(this, "_clock", new Clock());
|
|
50317
50345
|
// position
|
|
@@ -50352,11 +50380,11 @@ class CameraLerp extends CameraMovement {
|
|
|
50352
50380
|
const start = this._camera.position.clone();
|
|
50353
50381
|
const end = this._camera.position.clone().add(v);
|
|
50354
50382
|
const pos = new Vector3();
|
|
50383
|
+
const offset = this._camera.forward.multiplyScalar(this._camera.orbitDistance);
|
|
50355
50384
|
this.onProgress = (progress) => {
|
|
50356
|
-
console.log("progress", progress);
|
|
50357
50385
|
pos.copy(start);
|
|
50358
50386
|
pos.lerp(end, progress);
|
|
50359
|
-
this._movement.
|
|
50387
|
+
this._movement.set(pos, pos.clone().add(offset));
|
|
50360
50388
|
};
|
|
50361
50389
|
}
|
|
50362
50390
|
rotate(angle) {
|
|
@@ -50412,9 +50440,6 @@ class CameraLerp extends CameraMovement {
|
|
|
50412
50440
|
this._movement.applyRotation(r);
|
|
50413
50441
|
};
|
|
50414
50442
|
}
|
|
50415
|
-
reset() {
|
|
50416
|
-
this.set(this._camera._savedPosition, this._camera._savedTarget);
|
|
50417
|
-
}
|
|
50418
50443
|
set(position, target) {
|
|
50419
50444
|
const endTarget = target ?? this._camera.target;
|
|
50420
50445
|
const startPos = this._camera.position.clone();
|
|
@@ -50436,9 +50461,6 @@ class CameraMovementSnap extends CameraMovement {
|
|
|
50436
50461
|
const dist2 = this._camera.orbitDistance * amount;
|
|
50437
50462
|
this.setDistance(dist2);
|
|
50438
50463
|
}
|
|
50439
|
-
reset() {
|
|
50440
|
-
this.set(this._camera._savedPosition, this._camera._savedTarget);
|
|
50441
|
-
}
|
|
50442
50464
|
setDistance(dist2) {
|
|
50443
50465
|
const pos = this._camera.target.clone().sub(this._camera.forward.multiplyScalar(dist2));
|
|
50444
50466
|
this.set(pos, this._camera.target);
|
|
@@ -51138,10 +51160,14 @@ function threeNDCFromVector2(position) {
|
|
|
51138
51160
|
);
|
|
51139
51161
|
}
|
|
51140
51162
|
class OrthographicCamera2 {
|
|
51141
|
-
constructor(camera2) {
|
|
51163
|
+
constructor(camera2, settings2) {
|
|
51142
51164
|
__publicField(this, "camera");
|
|
51143
51165
|
this.camera = camera2;
|
|
51144
51166
|
this.camera.layers.enable(Layers2.NoRaycast);
|
|
51167
|
+
this.camera.zoom = settings2.camera.zoom;
|
|
51168
|
+
this.camera.near = -settings2.camera.far;
|
|
51169
|
+
this.camera.far = settings2.camera.far;
|
|
51170
|
+
this.camera.updateProjectionMatrix();
|
|
51145
51171
|
}
|
|
51146
51172
|
frustrumSizeAt(point) {
|
|
51147
51173
|
return new Vector2(
|
|
@@ -51149,12 +51175,6 @@ class OrthographicCamera2 {
|
|
|
51149
51175
|
this.camera.top - this.camera.bottom
|
|
51150
51176
|
);
|
|
51151
51177
|
}
|
|
51152
|
-
applySettings(settings2) {
|
|
51153
|
-
this.camera.zoom = settings2.camera.zoom;
|
|
51154
|
-
this.camera.near = -settings2.camera.far;
|
|
51155
|
-
this.camera.far = settings2.camera.far;
|
|
51156
|
-
this.camera.updateProjectionMatrix();
|
|
51157
|
-
}
|
|
51158
51178
|
updateProjection(size, aspect2) {
|
|
51159
51179
|
const max2 = Math.max(size.x, size.y);
|
|
51160
51180
|
this.camera.left = -max2 * aspect2;
|
|
@@ -51165,12 +51185,10 @@ class OrthographicCamera2 {
|
|
|
51165
51185
|
}
|
|
51166
51186
|
}
|
|
51167
51187
|
class PerspectiveCamera2 {
|
|
51168
|
-
constructor(camera2) {
|
|
51188
|
+
constructor(camera2, settings2) {
|
|
51169
51189
|
__publicField(this, "camera");
|
|
51170
51190
|
this.camera = camera2;
|
|
51171
51191
|
this.camera.layers.enable(Layers2.NoRaycast);
|
|
51172
|
-
}
|
|
51173
|
-
applySettings(settings2) {
|
|
51174
51192
|
this.camera.fov = settings2.camera.fov;
|
|
51175
51193
|
this.camera.zoom = settings2.camera.zoom;
|
|
51176
51194
|
this.camera.near = settings2.camera.near;
|
|
@@ -51210,8 +51228,7 @@ let Camera$1 = class Camera2 {
|
|
|
51210
51228
|
__publicField(this, "_tmp1", new Vector3());
|
|
51211
51229
|
__publicField(this, "_tmp2", new Vector3());
|
|
51212
51230
|
// saves
|
|
51213
|
-
__publicField(this, "
|
|
51214
|
-
__publicField(this, "_savedTarget", new Vector3(0, 0, 0));
|
|
51231
|
+
__publicField(this, "_savedState", new CameraSaveState(this));
|
|
51215
51232
|
__publicField(this, "_onValueChanged", new distExports$1.SignalDispatcher());
|
|
51216
51233
|
__publicField(this, "_hasMoved");
|
|
51217
51234
|
__publicField(this, "_onMoved", new distExports$1.SignalDispatcher());
|
|
@@ -51229,18 +51246,24 @@ let Camera$1 = class Camera2 {
|
|
|
51229
51246
|
__publicField(this, "_defaultForward", new Vector3(1, -1, 1).normalize());
|
|
51230
51247
|
// Settings
|
|
51231
51248
|
__publicField(this, "_velocityBlendFactor", 1e-4);
|
|
51232
|
-
this.camPerspective = new PerspectiveCamera2(new PerspectiveCamera$1());
|
|
51249
|
+
this.camPerspective = new PerspectiveCamera2(new PerspectiveCamera$1(), settings2);
|
|
51233
51250
|
this.camPerspective.camera.up = new Vector3(0, 0, 1);
|
|
51234
51251
|
this.camPerspective.camera.lookAt(new Vector3(0, 1, 0));
|
|
51235
51252
|
this.camOrthographic = new OrthographicCamera2(
|
|
51236
|
-
new OrthographicCamera$1()
|
|
51253
|
+
new OrthographicCamera$1(),
|
|
51254
|
+
settings2
|
|
51237
51255
|
);
|
|
51238
|
-
this.
|
|
51239
|
-
this.
|
|
51256
|
+
this._savedState = new CameraSaveState(this);
|
|
51257
|
+
this._movement = new CameraMovementSnap(this, this._savedState, () => this._scene.getBoundingBox());
|
|
51258
|
+
this._lerp = new CameraLerp(this, this._movement, this._savedState, () => this._scene.getBoundingBox());
|
|
51240
51259
|
this._scene = scene;
|
|
51241
51260
|
this._viewport = viewport;
|
|
51242
51261
|
this._viewport.onResize.sub(() => this.updateProjection());
|
|
51243
|
-
this.
|
|
51262
|
+
this.defaultForward = settings2.camera.forward;
|
|
51263
|
+
this._orthographic = settings2.camera.orthographic;
|
|
51264
|
+
this.allowedMovement = settings2.camera.allowedMovement;
|
|
51265
|
+
this.allowedRotation = settings2.camera.allowedRotation;
|
|
51266
|
+
this._onValueChanged.dispatch();
|
|
51244
51267
|
this.snap(true).setDistance(-1e3);
|
|
51245
51268
|
this.snap(true).orbitTowards(this._defaultForward);
|
|
51246
51269
|
this.updateProjection();
|
|
@@ -51391,13 +51414,6 @@ let Camera$1 = class Camera2 {
|
|
|
51391
51414
|
return this._target;
|
|
51392
51415
|
}
|
|
51393
51416
|
applySettings(settings2) {
|
|
51394
|
-
this.defaultForward = settings2.camera.forward;
|
|
51395
|
-
this._orthographic = settings2.camera.orthographic;
|
|
51396
|
-
this.allowedMovement = settings2.camera.allowedMovement;
|
|
51397
|
-
this.allowedRotation = settings2.camera.allowedRotation;
|
|
51398
|
-
this.camPerspective.applySettings(settings2);
|
|
51399
|
-
this.camOrthographic.applySettings(settings2);
|
|
51400
|
-
this._onValueChanged.dispatch();
|
|
51401
51417
|
}
|
|
51402
51418
|
/**
|
|
51403
51419
|
* The distance from the camera to the target.
|
|
@@ -51410,8 +51426,7 @@ let Camera$1 = class Camera2 {
|
|
|
51410
51426
|
*/
|
|
51411
51427
|
save() {
|
|
51412
51428
|
this._lerp.cancel();
|
|
51413
|
-
this.
|
|
51414
|
-
this._savedTarget.copy(this._target);
|
|
51429
|
+
this._savedState.save();
|
|
51415
51430
|
}
|
|
51416
51431
|
/**
|
|
51417
51432
|
* Represents whether the camera projection is orthographic.
|
|
@@ -52554,15 +52569,18 @@ class CaptureHandler {
|
|
|
52554
52569
|
this._id = -1;
|
|
52555
52570
|
}
|
|
52556
52571
|
onPointerDown(event) {
|
|
52557
|
-
|
|
52558
|
-
this._canvas.releasePointerCapture(this._id);
|
|
52559
|
-
}
|
|
52572
|
+
this.release();
|
|
52560
52573
|
this._canvas.setPointerCapture(event.pointerId);
|
|
52561
52574
|
this._id = event.pointerId;
|
|
52562
52575
|
}
|
|
52563
52576
|
onPointerUp(event) {
|
|
52564
|
-
this.
|
|
52565
|
-
|
|
52577
|
+
this.release();
|
|
52578
|
+
}
|
|
52579
|
+
release() {
|
|
52580
|
+
if (this._id >= 0) {
|
|
52581
|
+
this._canvas.releasePointerCapture(this._id);
|
|
52582
|
+
this._id = -1;
|
|
52583
|
+
}
|
|
52566
52584
|
}
|
|
52567
52585
|
}
|
|
52568
52586
|
class DoubleClickHandler {
|
|
@@ -68547,8 +68565,8 @@ var InteractionMode;
|
|
|
68547
68565
|
InteractionMode2["ClickItemToExpand"] = "click-item-to-expand";
|
|
68548
68566
|
InteractionMode2["ClickArrowToExpand"] = "click-arrow-to-expand";
|
|
68549
68567
|
})(InteractionMode || (InteractionMode = {}));
|
|
68550
|
-
var __assign$
|
|
68551
|
-
__assign$
|
|
68568
|
+
var __assign$c = function() {
|
|
68569
|
+
__assign$c = Object.assign || function(t) {
|
|
68552
68570
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
68553
68571
|
s = arguments[i];
|
|
68554
68572
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -68556,13 +68574,13 @@ var __assign$d = function() {
|
|
|
68556
68574
|
}
|
|
68557
68575
|
return t;
|
|
68558
68576
|
};
|
|
68559
|
-
return __assign$
|
|
68577
|
+
return __assign$c.apply(this, arguments);
|
|
68560
68578
|
};
|
|
68561
68579
|
var mergeInteractionManagers = function(main, fallback) {
|
|
68562
68580
|
return {
|
|
68563
68581
|
mode: main.mode,
|
|
68564
68582
|
createInteractiveElementProps: function(item, treeId, actions, renderFlags) {
|
|
68565
|
-
return __assign$
|
|
68583
|
+
return __assign$c(__assign$c({}, fallback.createInteractiveElementProps(item, treeId, actions, renderFlags)), main.createInteractiveElementProps(item, treeId, actions, renderFlags));
|
|
68566
68584
|
}
|
|
68567
68585
|
};
|
|
68568
68586
|
};
|
|
@@ -68580,10 +68598,11 @@ var DoubleClickItemToExpandInteractionManager = (
|
|
|
68580
68598
|
var _this = this;
|
|
68581
68599
|
return {
|
|
68582
68600
|
onClick: function(e) {
|
|
68601
|
+
var isSpacebarEvent = e.detail === 0;
|
|
68583
68602
|
actions.focusItem();
|
|
68584
|
-
if (e.shiftKey) {
|
|
68603
|
+
if (e.shiftKey && !isSpacebarEvent) {
|
|
68585
68604
|
actions.selectUpTo(!isControlKey$1(e));
|
|
68586
|
-
} else if (isControlKey$1(e)) {
|
|
68605
|
+
} else if (isControlKey$1(e) && !isSpacebarEvent) {
|
|
68587
68606
|
if (renderFlags.isSelected) {
|
|
68588
68607
|
actions.unselectItem();
|
|
68589
68608
|
} else {
|
|
@@ -68631,10 +68650,11 @@ var ClickItemToExpandInteractionManager = (
|
|
|
68631
68650
|
var _this = this;
|
|
68632
68651
|
return {
|
|
68633
68652
|
onClick: function(e) {
|
|
68653
|
+
var isSpacebarEvent = e.detail === 0;
|
|
68634
68654
|
actions.focusItem();
|
|
68635
|
-
if (e.shiftKey) {
|
|
68655
|
+
if (e.shiftKey && !isSpacebarEvent) {
|
|
68636
68656
|
actions.selectUpTo(!isControlKey$1(e));
|
|
68637
|
-
} else if (isControlKey$1(e)) {
|
|
68657
|
+
} else if (isControlKey$1(e) && !isSpacebarEvent) {
|
|
68638
68658
|
if (renderFlags.isSelected) {
|
|
68639
68659
|
actions.unselectItem();
|
|
68640
68660
|
} else {
|
|
@@ -68678,10 +68698,11 @@ var ClickArrowToExpandInteractionManager = (
|
|
|
68678
68698
|
var _this = this;
|
|
68679
68699
|
return {
|
|
68680
68700
|
onClick: function(e) {
|
|
68701
|
+
var isSpacebarEvent = e.detail === 0;
|
|
68681
68702
|
actions.focusItem();
|
|
68682
|
-
if (e.shiftKey) {
|
|
68703
|
+
if (e.shiftKey && !isSpacebarEvent) {
|
|
68683
68704
|
actions.selectUpTo(!isControlKey$1(e));
|
|
68684
|
-
} else if (isControlKey$1(e)) {
|
|
68705
|
+
} else if (isControlKey$1(e) && !isSpacebarEvent) {
|
|
68685
68706
|
if (renderFlags.isSelected) {
|
|
68686
68707
|
actions.unselectItem();
|
|
68687
68708
|
} else {
|
|
@@ -68799,7 +68820,7 @@ var useGetViableDragPositions = function() {
|
|
|
68799
68820
|
return isDescendant(treeId, parentLinearIndex, potentialParents);
|
|
68800
68821
|
}, [getParentOfLinearItem]);
|
|
68801
68822
|
return useCallback(function(treeId, draggingItems) {
|
|
68802
|
-
var _a3, _b2;
|
|
68823
|
+
var _a3, _b2, _c, _d;
|
|
68803
68824
|
var linearItems = environment.linearItems[treeId];
|
|
68804
68825
|
var targets = [];
|
|
68805
68826
|
var skipUntilDepthIsLowerThan = -1;
|
|
@@ -68809,7 +68830,7 @@ var useGetViableDragPositions = function() {
|
|
|
68809
68830
|
// eslint-disable-next-line no-plusplus
|
|
68810
68831
|
linearIndex++
|
|
68811
68832
|
) {
|
|
68812
|
-
var
|
|
68833
|
+
var _e = linearItems[linearIndex], item = _e.item, depth = _e.depth;
|
|
68813
68834
|
if (skipUntilDepthIsLowerThan !== -1 && depth > skipUntilDepthIsLowerThan) {
|
|
68814
68835
|
continue;
|
|
68815
68836
|
} else {
|
|
@@ -68847,14 +68868,17 @@ var useGetViableDragPositions = function() {
|
|
|
68847
68868
|
depth,
|
|
68848
68869
|
treeId
|
|
68849
68870
|
};
|
|
68850
|
-
var
|
|
68851
|
-
|
|
68871
|
+
var depthOfItemAbove = (_b2 = (_a3 = linearItems[linearIndex - 1]) === null || _a3 === void 0 ? void 0 : _a3.depth) !== null && _b2 !== void 0 ? _b2 : -1;
|
|
68872
|
+
var depthOfItemBelow = (_d = (_c = linearItems[linearIndex + 1]) === null || _c === void 0 ? void 0 : _c.depth) !== null && _d !== void 0 ? _d : -1;
|
|
68873
|
+
var isWithinFolder = depth === depthOfItemAbove;
|
|
68874
|
+
var isBelowOpenFolder = depth === depthOfItemBelow - 1;
|
|
68875
|
+
if (!isWithinFolder && canDropAt(topPosition, draggingItems)) {
|
|
68852
68876
|
targets.push(topPosition);
|
|
68853
68877
|
}
|
|
68854
68878
|
if (canDropAt(itemPosition, draggingItems)) {
|
|
68855
68879
|
targets.push(itemPosition);
|
|
68856
68880
|
}
|
|
68857
|
-
if (canDropAt(bottomPosition, draggingItems)) {
|
|
68881
|
+
if (!isBelowOpenFolder && canDropAt(bottomPosition, draggingItems)) {
|
|
68858
68882
|
targets.push(bottomPosition);
|
|
68859
68883
|
}
|
|
68860
68884
|
}
|
|
@@ -68893,8 +68917,8 @@ var useSideEffect = function(effect, deps, changeOn) {
|
|
|
68893
68917
|
}
|
|
68894
68918
|
}, __spreadArray$4(__spreadArray$4([], deps, true), changeOn, true));
|
|
68895
68919
|
};
|
|
68896
|
-
var __assign$
|
|
68897
|
-
__assign$
|
|
68920
|
+
var __assign$b = function() {
|
|
68921
|
+
__assign$b = Object.assign || function(t) {
|
|
68898
68922
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
68899
68923
|
s = arguments[i];
|
|
68900
68924
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -68902,7 +68926,7 @@ var __assign$c = function() {
|
|
|
68902
68926
|
}
|
|
68903
68927
|
return t;
|
|
68904
68928
|
};
|
|
68905
|
-
return __assign$
|
|
68929
|
+
return __assign$b.apply(this, arguments);
|
|
68906
68930
|
};
|
|
68907
68931
|
var buildMapForTrees = function(treeIds, build) {
|
|
68908
68932
|
return treeIds.map(function(id2) {
|
|
@@ -68910,7 +68934,7 @@ var buildMapForTrees = function(treeIds, build) {
|
|
|
68910
68934
|
}).reduce(function(a, _a3) {
|
|
68911
68935
|
var _b2;
|
|
68912
68936
|
var id2 = _a3[0], obj = _a3[1];
|
|
68913
|
-
return __assign$
|
|
68937
|
+
return __assign$b(__assign$b({}, a), (_b2 = {}, _b2[id2] = obj, _b2));
|
|
68914
68938
|
}, {});
|
|
68915
68939
|
};
|
|
68916
68940
|
var getDocument = function() {
|
|
@@ -69417,7 +69441,7 @@ var DragAndDropProvider = function(_a3) {
|
|
|
69417
69441
|
var programmaticDragDown = useCallback(function() {
|
|
69418
69442
|
if (environment.activeTreeId) {
|
|
69419
69443
|
setProgrammaticDragIndex(function(oldIndex) {
|
|
69420
|
-
return Math.min(viableDragPositions[environment.activeTreeId].length, oldIndex + 1);
|
|
69444
|
+
return Math.min(viableDragPositions[environment.activeTreeId].length - 1, oldIndex + 1);
|
|
69421
69445
|
});
|
|
69422
69446
|
}
|
|
69423
69447
|
}, [environment.activeTreeId, viableDragPositions]);
|
|
@@ -69462,8 +69486,8 @@ var DragAndDropProvider = function(_a3) {
|
|
|
69462
69486
|
}, [onDropHandler, resetState]);
|
|
69463
69487
|
return React.createElement(DragAndDropContext.Provider, { value: dnd }, children);
|
|
69464
69488
|
};
|
|
69465
|
-
var __assign$
|
|
69466
|
-
__assign$
|
|
69489
|
+
var __assign$a = function() {
|
|
69490
|
+
__assign$a = Object.assign || function(t) {
|
|
69467
69491
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
69468
69492
|
s = arguments[i];
|
|
69469
69493
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -69471,13 +69495,13 @@ var __assign$b = function() {
|
|
|
69471
69495
|
}
|
|
69472
69496
|
return t;
|
|
69473
69497
|
};
|
|
69474
|
-
return __assign$
|
|
69498
|
+
return __assign$a.apply(this, arguments);
|
|
69475
69499
|
};
|
|
69476
69500
|
var useCreatedEnvironmentRef = function(ref, actions) {
|
|
69477
69501
|
var environment = useTreeEnvironment();
|
|
69478
69502
|
var dnd = useDragAndDrop();
|
|
69479
69503
|
useImperativeHandle(ref, function() {
|
|
69480
|
-
return __assign$
|
|
69504
|
+
return __assign$a(__assign$a(__assign$a({}, actions), environment), { treeEnvironmentContext: environment, dragAndDropContext: dnd });
|
|
69481
69505
|
});
|
|
69482
69506
|
};
|
|
69483
69507
|
var waitFor = function(check2, intervalMs, timeoutMs) {
|
|
@@ -69833,8 +69857,8 @@ var scrollIntoView = function(element) {
|
|
|
69833
69857
|
}
|
|
69834
69858
|
}
|
|
69835
69859
|
};
|
|
69836
|
-
var __assign$
|
|
69837
|
-
__assign$
|
|
69860
|
+
var __assign$9 = function() {
|
|
69861
|
+
__assign$9 = Object.assign || function(t) {
|
|
69838
69862
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
69839
69863
|
s = arguments[i];
|
|
69840
69864
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -69842,7 +69866,7 @@ var __assign$a = function() {
|
|
|
69842
69866
|
}
|
|
69843
69867
|
return t;
|
|
69844
69868
|
};
|
|
69845
|
-
return __assign$
|
|
69869
|
+
return __assign$9.apply(this, arguments);
|
|
69846
69870
|
};
|
|
69847
69871
|
var cx$1 = function() {
|
|
69848
69872
|
var classNames = [];
|
|
@@ -69873,7 +69897,7 @@ var createDefaultRenderers = function(renderDepthOffset, rtl) {
|
|
|
69873
69897
|
var item = _a3.item, context = _a3.context;
|
|
69874
69898
|
return (
|
|
69875
69899
|
// Icons from https://blueprintjs.com/docs/#icons
|
|
69876
|
-
React__default.createElement("div", __assign$
|
|
69900
|
+
React__default.createElement("div", __assign$9({ className: cx$1(item.isFolder && "rct-tree-item-arrow-isFolder", context.isExpanded && "rct-tree-item-arrow-expanded", "rct-tree-item-arrow") }, context.arrowProps), item.isFolder && (context.isExpanded ? React__default.createElement(
|
|
69877
69901
|
"svg",
|
|
69878
69902
|
{ version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", x: "0px", y: "0px", viewBox: "0 0 16 16", enableBackground: "new 0 0 16 16", xmlSpace: "preserve" },
|
|
69879
69903
|
React__default.createElement(
|
|
@@ -69906,12 +69930,12 @@ var createDefaultRenderers = function(renderDepthOffset, rtl) {
|
|
|
69906
69930
|
var type = context.isRenaming ? void 0 : "button";
|
|
69907
69931
|
return React__default.createElement(
|
|
69908
69932
|
"li",
|
|
69909
|
-
__assign$
|
|
69933
|
+
__assign$9({}, context.itemContainerWithChildrenProps, { className: cx$1("rct-tree-item-li", item.isFolder && "rct-tree-item-li-isFolder", context.isSelected && "rct-tree-item-li-selected", context.isExpanded && "rct-tree-item-li-expanded", context.isFocused && "rct-tree-item-li-focused", context.isDraggingOver && "rct-tree-item-li-dragging-over", context.isSearchMatching && "rct-tree-item-li-search-match") }),
|
|
69910
69934
|
React__default.createElement(
|
|
69911
69935
|
"div",
|
|
69912
|
-
__assign$
|
|
69936
|
+
__assign$9({}, context.itemContainerWithoutChildrenProps, { style: { "--depthOffset": "".concat((depth + 1) * renderDepthOffset, "px") }, className: cx$1("rct-tree-item-title-container", item.isFolder && "rct-tree-item-title-container-isFolder", context.isSelected && "rct-tree-item-title-container-selected", context.isExpanded && "rct-tree-item-title-container-expanded", context.isFocused && "rct-tree-item-title-container-focused", context.isDraggingOver && "rct-tree-item-title-container-dragging-over", context.isSearchMatching && "rct-tree-item-title-container-search-match") }),
|
|
69913
69937
|
arrow,
|
|
69914
|
-
React__default.createElement(InteractiveComponent, __assign$
|
|
69938
|
+
React__default.createElement(InteractiveComponent, __assign$9({ type }, context.interactiveElementProps, { className: cx$1("rct-tree-item-button", item.isFolder && "rct-tree-item-button-isFolder", context.isSelected && "rct-tree-item-button-selected", context.isExpanded && "rct-tree-item-button-expanded", context.isFocused && "rct-tree-item-button-focused", context.isDraggingOver && "rct-tree-item-button-dragging-over", context.isSearchMatching && "rct-tree-item-button-search-match") }), title2)
|
|
69915
69939
|
),
|
|
69916
69940
|
children
|
|
69917
69941
|
);
|
|
@@ -69920,9 +69944,9 @@ var createDefaultRenderers = function(renderDepthOffset, rtl) {
|
|
|
69920
69944
|
var inputProps = _a3.inputProps, inputRef = _a3.inputRef, submitButtonProps = _a3.submitButtonProps, submitButtonRef = _a3.submitButtonRef, formProps = _a3.formProps;
|
|
69921
69945
|
return React__default.createElement(
|
|
69922
69946
|
"form",
|
|
69923
|
-
__assign$
|
|
69924
|
-
React__default.createElement("input", __assign$
|
|
69925
|
-
React__default.createElement("input", __assign$
|
|
69947
|
+
__assign$9({}, formProps, { className: "rct-tree-item-renaming-form" }),
|
|
69948
|
+
React__default.createElement("input", __assign$9({}, inputProps, { ref: inputRef, className: "rct-tree-item-renaming-input" })),
|
|
69949
|
+
React__default.createElement("input", __assign$9({}, submitButtonProps, { ref: submitButtonRef, type: "submit", className: "rct-tree-item-renaming-submit-button", value: "🗸" }))
|
|
69926
69950
|
);
|
|
69927
69951
|
},
|
|
69928
69952
|
renderTreeContainer: function(_a3) {
|
|
@@ -69930,16 +69954,16 @@ var createDefaultRenderers = function(renderDepthOffset, rtl) {
|
|
|
69930
69954
|
return React__default.createElement(
|
|
69931
69955
|
"div",
|
|
69932
69956
|
{ className: cx$1("rct-tree-root", info.isFocused && "rct-tree-root-focus", info.isRenaming && "rct-tree-root-renaming", info.areItemsSelected && "rct-tree-root-itemsselected", rtl) },
|
|
69933
|
-
React__default.createElement("div", __assign$
|
|
69957
|
+
React__default.createElement("div", __assign$9({}, containerProps, { style: __assign$9({ minHeight: "30px" }, containerProps.style) }), children)
|
|
69934
69958
|
);
|
|
69935
69959
|
},
|
|
69936
69960
|
renderItemsContainer: function(_a3) {
|
|
69937
69961
|
var children = _a3.children, containerProps = _a3.containerProps;
|
|
69938
|
-
return React__default.createElement("ul", __assign$
|
|
69962
|
+
return React__default.createElement("ul", __assign$9({}, containerProps, { className: "rct-tree-items-container" }), children);
|
|
69939
69963
|
},
|
|
69940
69964
|
renderDragBetweenLine: function(_a3) {
|
|
69941
69965
|
var draggingPosition = _a3.draggingPosition, lineProps = _a3.lineProps;
|
|
69942
|
-
return React__default.createElement("div", __assign$
|
|
69966
|
+
return React__default.createElement("div", __assign$9({}, lineProps, { style: { left: "".concat(draggingPosition.depth * renderDepthOffset, "px") }, className: cx$1("rct-tree-drag-between-line", draggingPosition.targetType === "between-items" && draggingPosition.linePosition === "top" && "rct-tree-drag-between-line-top", draggingPosition.targetType === "between-items" && draggingPosition.linePosition === "bottom" && "rct-tree-drag-between-line-bottom") }));
|
|
69943
69967
|
},
|
|
69944
69968
|
renderSearchInput: function(_a3) {
|
|
69945
69969
|
var inputProps = _a3.inputProps;
|
|
@@ -69947,7 +69971,7 @@ var createDefaultRenderers = function(renderDepthOffset, rtl) {
|
|
|
69947
69971
|
"div",
|
|
69948
69972
|
{ className: cx$1("rct-tree-search-input-container") },
|
|
69949
69973
|
React__default.createElement("span", { className: "rct-tree-input-icon" }),
|
|
69950
|
-
React__default.createElement("input", __assign$
|
|
69974
|
+
React__default.createElement("input", __assign$9({}, inputProps, { className: cx$1("rct-tree-search-input") }))
|
|
69951
69975
|
);
|
|
69952
69976
|
},
|
|
69953
69977
|
renderLiveDescriptorContainer: function(_a3) {
|
|
@@ -70018,8 +70042,8 @@ var getItemsLinearly = function(rootItem, viewState, items, depth) {
|
|
|
70018
70042
|
}
|
|
70019
70043
|
return itemIds;
|
|
70020
70044
|
};
|
|
70021
|
-
var __assign$
|
|
70022
|
-
__assign$
|
|
70045
|
+
var __assign$8 = function() {
|
|
70046
|
+
__assign$8 = Object.assign || function(t) {
|
|
70023
70047
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
70024
70048
|
s = arguments[i];
|
|
70025
70049
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -70027,7 +70051,7 @@ var __assign$9 = function() {
|
|
|
70027
70051
|
}
|
|
70028
70052
|
return t;
|
|
70029
70053
|
};
|
|
70030
|
-
return __assign$
|
|
70054
|
+
return __assign$8.apply(this, arguments);
|
|
70031
70055
|
};
|
|
70032
70056
|
var __rest = function(s, e) {
|
|
70033
70057
|
var t = {};
|
|
@@ -70077,7 +70101,7 @@ var useControlledTreeEnvironmentProps = function(_a3) {
|
|
|
70077
70101
|
var registerTree = useCallback(function(tree) {
|
|
70078
70102
|
setTrees(function(trees3) {
|
|
70079
70103
|
var _a4;
|
|
70080
|
-
return __assign$
|
|
70104
|
+
return __assign$8(__assign$8({}, trees3), (_a4 = {}, _a4[tree.treeId] = tree, _a4));
|
|
70081
70105
|
});
|
|
70082
70106
|
onRegisterTree === null || onRegisterTree === void 0 ? void 0 : onRegisterTree(tree);
|
|
70083
70107
|
}, [onRegisterTree]);
|
|
@@ -70134,33 +70158,26 @@ var useControlledTreeEnvironmentProps = function(_a3) {
|
|
|
70134
70158
|
}
|
|
70135
70159
|
}, [autoFocus, focusTree]);
|
|
70136
70160
|
var renderers = useRenderers(props);
|
|
70137
|
-
return __assign$
|
|
70138
|
-
};
|
|
70139
|
-
var __assign$8 = function() {
|
|
70140
|
-
__assign$8 = Object.assign || function(t) {
|
|
70141
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
70142
|
-
s = arguments[i];
|
|
70143
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
70144
|
-
t[p] = s[p];
|
|
70145
|
-
}
|
|
70146
|
-
return t;
|
|
70147
|
-
};
|
|
70148
|
-
return __assign$8.apply(this, arguments);
|
|
70161
|
+
return __assign$8(__assign$8(__assign$8({}, renderers), props), { onFocusItem: onFocusItemHandler, registerTree, unregisterTree, onExpandItem, onCollapseItem, onDrop, setActiveTree, treeIds, trees: trees2, activeTreeId, linearItems });
|
|
70149
70162
|
};
|
|
70150
70163
|
var TreeEnvironmentContext = React.createContext(null);
|
|
70151
70164
|
var useTreeEnvironment = function() {
|
|
70152
70165
|
return useContext(TreeEnvironmentContext);
|
|
70153
70166
|
};
|
|
70154
70167
|
var ControlledTreeEnvironment = React.forwardRef(function(props, ref) {
|
|
70155
|
-
var _a3, _b2, _c;
|
|
70156
70168
|
var environmentContextProps = useControlledTreeEnvironmentProps(props);
|
|
70157
|
-
var viewState = props.viewState;
|
|
70158
|
-
|
|
70159
|
-
var
|
|
70160
|
-
|
|
70161
|
-
|
|
70169
|
+
var viewState = props.viewState, onFocusItem = props.onFocusItem;
|
|
70170
|
+
useEffect(function() {
|
|
70171
|
+
var _a3, _b2, _c;
|
|
70172
|
+
for (var _i = 0, _d = Object.keys(environmentContextProps.trees); _i < _d.length; _i++) {
|
|
70173
|
+
var treeId = _d[_i];
|
|
70174
|
+
var firstItemIndex = (_b2 = (_a3 = props.items[environmentContextProps.trees[treeId].rootItem]) === null || _a3 === void 0 ? void 0 : _a3.children) === null || _b2 === void 0 ? void 0 : _b2[0];
|
|
70175
|
+
var firstItem = firstItemIndex && props.items[firstItemIndex];
|
|
70176
|
+
if (!((_c = viewState[treeId]) === null || _c === void 0 ? void 0 : _c.focusedItem) && environmentContextProps.trees[treeId] && firstItem) {
|
|
70177
|
+
onFocusItem === null || onFocusItem === void 0 ? void 0 : onFocusItem(firstItem, treeId, false);
|
|
70178
|
+
}
|
|
70162
70179
|
}
|
|
70163
|
-
}
|
|
70180
|
+
}, [environmentContextProps.trees, onFocusItem, props.items, viewState]);
|
|
70164
70181
|
return React.createElement(
|
|
70165
70182
|
TreeEnvironmentContext.Provider,
|
|
70166
70183
|
{ value: environmentContextProps },
|
|
@@ -70255,11 +70272,11 @@ var defaultKeyboardBindings = {
|
|
|
70255
70272
|
primaryAction: ["enter"],
|
|
70256
70273
|
renameItem: ["f2"],
|
|
70257
70274
|
abortRenameItem: ["escape"],
|
|
70258
|
-
toggleSelectItem: ["control+
|
|
70275
|
+
toggleSelectItem: ["control+ "],
|
|
70259
70276
|
abortSearch: ["escape", "enter"],
|
|
70260
70277
|
startSearch: [],
|
|
70261
70278
|
selectAll: ["control+a"],
|
|
70262
|
-
startProgrammaticDnd: ["control+d"],
|
|
70279
|
+
startProgrammaticDnd: ["control+shift+d"],
|
|
70263
70280
|
completeProgrammaticDnd: ["enter"],
|
|
70264
70281
|
abortProgrammaticDnd: ["escape"]
|
|
70265
70282
|
};
|
|
@@ -70319,7 +70336,7 @@ var useHotkey = function(combinationName, onHit, active, activatableWhileFocusin
|
|
|
70319
70336
|
return a || b;
|
|
70320
70337
|
}, false);
|
|
70321
70338
|
if (partialMatch) {
|
|
70322
|
-
if (pressedKeys.current.length > 1 || !/^[a-zA-Z]$/.test(e.key)) {
|
|
70339
|
+
if (pressedKeys.current.length > 1 || !/^[a-zA-Z\s]$/.test(e.key)) {
|
|
70323
70340
|
e.preventDefault();
|
|
70324
70341
|
}
|
|
70325
70342
|
}
|
|
@@ -70553,6 +70570,7 @@ var useTreeKeyboardBindings = function() {
|
|
|
70553
70570
|
useHotkey("toggleSelectItem", function(e) {
|
|
70554
70571
|
var _a4, _b3, _c;
|
|
70555
70572
|
e.preventDefault();
|
|
70573
|
+
e.stopPropagation();
|
|
70556
70574
|
if (viewState.focusedItem !== void 0) {
|
|
70557
70575
|
if (viewState.selectedItems && viewState.selectedItems.includes(viewState.focusedItem)) {
|
|
70558
70576
|
(_a4 = environment.onSelectItems) === null || _a4 === void 0 ? void 0 : _a4.call(environment, viewState.selectedItems.filter(function(item) {
|