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.iife.js
CHANGED
|
@@ -46854,7 +46854,7 @@ void main() {
|
|
|
46854
46854
|
return this._onDispose;
|
|
46855
46855
|
}
|
|
46856
46856
|
getBoundingBox() {
|
|
46857
|
-
const box = this.
|
|
46857
|
+
const box = this.scene.getBoundingBox();
|
|
46858
46858
|
return Promise.resolve(box);
|
|
46859
46859
|
}
|
|
46860
46860
|
/**
|
|
@@ -50047,6 +50047,24 @@ void main() {
|
|
|
50047
50047
|
createTransparent,
|
|
50048
50048
|
createWireframe
|
|
50049
50049
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
50050
|
+
class CameraSaveState {
|
|
50051
|
+
constructor(camera2) {
|
|
50052
|
+
__publicField(this, "_camera");
|
|
50053
|
+
__publicField(this, "_position", new Vector3());
|
|
50054
|
+
__publicField(this, "_target", new Vector3());
|
|
50055
|
+
this._camera = camera2;
|
|
50056
|
+
}
|
|
50057
|
+
save() {
|
|
50058
|
+
this._position.copy(this._camera.position);
|
|
50059
|
+
this._target.copy(this._camera.target);
|
|
50060
|
+
}
|
|
50061
|
+
get position() {
|
|
50062
|
+
return this._position;
|
|
50063
|
+
}
|
|
50064
|
+
get target() {
|
|
50065
|
+
return this._target;
|
|
50066
|
+
}
|
|
50067
|
+
}
|
|
50050
50068
|
const _Marker = class _Marker {
|
|
50051
50069
|
/**
|
|
50052
50070
|
* Constructs a new Marker object.
|
|
@@ -50230,9 +50248,13 @@ void main() {
|
|
|
50230
50248
|
__publicField(_Marker, "_unitVector", new Vector3(1, 1, 1));
|
|
50231
50249
|
let Marker = _Marker;
|
|
50232
50250
|
class CameraMovement {
|
|
50233
|
-
constructor(camera2) {
|
|
50251
|
+
constructor(camera2, savedState, getBoundingBox) {
|
|
50234
50252
|
__publicField(this, "_camera");
|
|
50253
|
+
__publicField(this, "_savedState");
|
|
50254
|
+
__publicField(this, "_getBoundingBox");
|
|
50235
50255
|
this._camera = camera2;
|
|
50256
|
+
this._savedState = savedState;
|
|
50257
|
+
this._getBoundingBox = getBoundingBox;
|
|
50236
50258
|
}
|
|
50237
50259
|
/**
|
|
50238
50260
|
* Moves the camera in a specified 2D direction within a plane defined by the given axes.
|
|
@@ -50280,6 +50302,12 @@ void main() {
|
|
|
50280
50302
|
angle.multiplyScalar(180 / Math.PI);
|
|
50281
50303
|
this.orbit(angle);
|
|
50282
50304
|
}
|
|
50305
|
+
/**
|
|
50306
|
+
* Resets the camera to its last saved position and orientation.
|
|
50307
|
+
*/
|
|
50308
|
+
reset() {
|
|
50309
|
+
this.set(this._camera.position, this._camera.target);
|
|
50310
|
+
}
|
|
50283
50311
|
/**
|
|
50284
50312
|
* Sets the camera's orientation and position to focus on the specified target.
|
|
50285
50313
|
* @param {IObject | Vim | THREE.Sphere | THREE.Box3 | 'all' | undefined} target - The target object, or 'all' to frame all objects.
|
|
@@ -50294,7 +50322,7 @@ void main() {
|
|
|
50294
50322
|
}
|
|
50295
50323
|
if (target === "all") {
|
|
50296
50324
|
console.log("frame all");
|
|
50297
|
-
target = this.
|
|
50325
|
+
target = this._getBoundingBox();
|
|
50298
50326
|
}
|
|
50299
50327
|
if (target instanceof Box3) {
|
|
50300
50328
|
target = target.getBoundingSphere(new Sphere());
|
|
@@ -50326,8 +50354,8 @@ void main() {
|
|
|
50326
50354
|
}
|
|
50327
50355
|
}
|
|
50328
50356
|
class CameraLerp extends CameraMovement {
|
|
50329
|
-
constructor(camera2, movement) {
|
|
50330
|
-
super(camera2);
|
|
50357
|
+
constructor(camera2, movement, savedState, getBoundingBox) {
|
|
50358
|
+
super(camera2, savedState, getBoundingBox);
|
|
50331
50359
|
__publicField(this, "_movement");
|
|
50332
50360
|
__publicField(this, "_clock", new Clock());
|
|
50333
50361
|
// position
|
|
@@ -50368,11 +50396,11 @@ void main() {
|
|
|
50368
50396
|
const start = this._camera.position.clone();
|
|
50369
50397
|
const end = this._camera.position.clone().add(v);
|
|
50370
50398
|
const pos = new Vector3();
|
|
50399
|
+
const offset = this._camera.forward.multiplyScalar(this._camera.orbitDistance);
|
|
50371
50400
|
this.onProgress = (progress) => {
|
|
50372
|
-
console.log("progress", progress);
|
|
50373
50401
|
pos.copy(start);
|
|
50374
50402
|
pos.lerp(end, progress);
|
|
50375
|
-
this._movement.
|
|
50403
|
+
this._movement.set(pos, pos.clone().add(offset));
|
|
50376
50404
|
};
|
|
50377
50405
|
}
|
|
50378
50406
|
rotate(angle) {
|
|
@@ -50428,9 +50456,6 @@ void main() {
|
|
|
50428
50456
|
this._movement.applyRotation(r);
|
|
50429
50457
|
};
|
|
50430
50458
|
}
|
|
50431
|
-
reset() {
|
|
50432
|
-
this.set(this._camera._savedPosition, this._camera._savedTarget);
|
|
50433
|
-
}
|
|
50434
50459
|
set(position, target) {
|
|
50435
50460
|
const endTarget = target ?? this._camera.target;
|
|
50436
50461
|
const startPos = this._camera.position.clone();
|
|
@@ -50452,9 +50477,6 @@ void main() {
|
|
|
50452
50477
|
const dist2 = this._camera.orbitDistance * amount;
|
|
50453
50478
|
this.setDistance(dist2);
|
|
50454
50479
|
}
|
|
50455
|
-
reset() {
|
|
50456
|
-
this.set(this._camera._savedPosition, this._camera._savedTarget);
|
|
50457
|
-
}
|
|
50458
50480
|
setDistance(dist2) {
|
|
50459
50481
|
const pos = this._camera.target.clone().sub(this._camera.forward.multiplyScalar(dist2));
|
|
50460
50482
|
this.set(pos, this._camera.target);
|
|
@@ -51154,10 +51176,14 @@ void main() {
|
|
|
51154
51176
|
);
|
|
51155
51177
|
}
|
|
51156
51178
|
class OrthographicCamera {
|
|
51157
|
-
constructor(camera2) {
|
|
51179
|
+
constructor(camera2, settings2) {
|
|
51158
51180
|
__publicField(this, "camera");
|
|
51159
51181
|
this.camera = camera2;
|
|
51160
51182
|
this.camera.layers.enable(Layers.NoRaycast);
|
|
51183
|
+
this.camera.zoom = settings2.camera.zoom;
|
|
51184
|
+
this.camera.near = -settings2.camera.far;
|
|
51185
|
+
this.camera.far = settings2.camera.far;
|
|
51186
|
+
this.camera.updateProjectionMatrix();
|
|
51161
51187
|
}
|
|
51162
51188
|
frustrumSizeAt(point) {
|
|
51163
51189
|
return new Vector2(
|
|
@@ -51165,12 +51191,6 @@ void main() {
|
|
|
51165
51191
|
this.camera.top - this.camera.bottom
|
|
51166
51192
|
);
|
|
51167
51193
|
}
|
|
51168
|
-
applySettings(settings2) {
|
|
51169
|
-
this.camera.zoom = settings2.camera.zoom;
|
|
51170
|
-
this.camera.near = -settings2.camera.far;
|
|
51171
|
-
this.camera.far = settings2.camera.far;
|
|
51172
|
-
this.camera.updateProjectionMatrix();
|
|
51173
|
-
}
|
|
51174
51194
|
updateProjection(size, aspect2) {
|
|
51175
51195
|
const max2 = Math.max(size.x, size.y);
|
|
51176
51196
|
this.camera.left = -max2 * aspect2;
|
|
@@ -51181,12 +51201,10 @@ void main() {
|
|
|
51181
51201
|
}
|
|
51182
51202
|
}
|
|
51183
51203
|
class PerspectiveCamera {
|
|
51184
|
-
constructor(camera2) {
|
|
51204
|
+
constructor(camera2, settings2) {
|
|
51185
51205
|
__publicField(this, "camera");
|
|
51186
51206
|
this.camera = camera2;
|
|
51187
51207
|
this.camera.layers.enable(Layers.NoRaycast);
|
|
51188
|
-
}
|
|
51189
|
-
applySettings(settings2) {
|
|
51190
51208
|
this.camera.fov = settings2.camera.fov;
|
|
51191
51209
|
this.camera.zoom = settings2.camera.zoom;
|
|
51192
51210
|
this.camera.near = settings2.camera.near;
|
|
@@ -51226,8 +51244,7 @@ void main() {
|
|
|
51226
51244
|
__publicField(this, "_tmp1", new Vector3());
|
|
51227
51245
|
__publicField(this, "_tmp2", new Vector3());
|
|
51228
51246
|
// saves
|
|
51229
|
-
__publicField(this, "
|
|
51230
|
-
__publicField(this, "_savedTarget", new Vector3(0, 0, 0));
|
|
51247
|
+
__publicField(this, "_savedState", new CameraSaveState(this));
|
|
51231
51248
|
__publicField(this, "_onValueChanged", new distExports$1.SignalDispatcher());
|
|
51232
51249
|
__publicField(this, "_hasMoved");
|
|
51233
51250
|
__publicField(this, "_onMoved", new distExports$1.SignalDispatcher());
|
|
@@ -51245,18 +51262,24 @@ void main() {
|
|
|
51245
51262
|
__publicField(this, "_defaultForward", new Vector3(1, -1, 1).normalize());
|
|
51246
51263
|
// Settings
|
|
51247
51264
|
__publicField(this, "_velocityBlendFactor", 1e-4);
|
|
51248
|
-
this.camPerspective = new PerspectiveCamera(new PerspectiveCamera$1());
|
|
51265
|
+
this.camPerspective = new PerspectiveCamera(new PerspectiveCamera$1(), settings2);
|
|
51249
51266
|
this.camPerspective.camera.up = new Vector3(0, 0, 1);
|
|
51250
51267
|
this.camPerspective.camera.lookAt(new Vector3(0, 1, 0));
|
|
51251
51268
|
this.camOrthographic = new OrthographicCamera(
|
|
51252
|
-
new OrthographicCamera$1()
|
|
51269
|
+
new OrthographicCamera$1(),
|
|
51270
|
+
settings2
|
|
51253
51271
|
);
|
|
51254
|
-
this.
|
|
51255
|
-
this.
|
|
51272
|
+
this._savedState = new CameraSaveState(this);
|
|
51273
|
+
this._movement = new CameraMovementSnap(this, this._savedState, () => this._scene.getBoundingBox());
|
|
51274
|
+
this._lerp = new CameraLerp(this, this._movement, this._savedState, () => this._scene.getBoundingBox());
|
|
51256
51275
|
this._scene = scene;
|
|
51257
51276
|
this._viewport = viewport;
|
|
51258
51277
|
this._viewport.onResize.sub(() => this.updateProjection());
|
|
51259
|
-
this.
|
|
51278
|
+
this.defaultForward = settings2.camera.forward;
|
|
51279
|
+
this._orthographic = settings2.camera.orthographic;
|
|
51280
|
+
this.allowedMovement = settings2.camera.allowedMovement;
|
|
51281
|
+
this.allowedRotation = settings2.camera.allowedRotation;
|
|
51282
|
+
this._onValueChanged.dispatch();
|
|
51260
51283
|
this.snap(true).setDistance(-1e3);
|
|
51261
51284
|
this.snap(true).orbitTowards(this._defaultForward);
|
|
51262
51285
|
this.updateProjection();
|
|
@@ -51407,13 +51430,6 @@ void main() {
|
|
|
51407
51430
|
return this._target;
|
|
51408
51431
|
}
|
|
51409
51432
|
applySettings(settings2) {
|
|
51410
|
-
this.defaultForward = settings2.camera.forward;
|
|
51411
|
-
this._orthographic = settings2.camera.orthographic;
|
|
51412
|
-
this.allowedMovement = settings2.camera.allowedMovement;
|
|
51413
|
-
this.allowedRotation = settings2.camera.allowedRotation;
|
|
51414
|
-
this.camPerspective.applySettings(settings2);
|
|
51415
|
-
this.camOrthographic.applySettings(settings2);
|
|
51416
|
-
this._onValueChanged.dispatch();
|
|
51417
51433
|
}
|
|
51418
51434
|
/**
|
|
51419
51435
|
* The distance from the camera to the target.
|
|
@@ -51426,8 +51442,7 @@ void main() {
|
|
|
51426
51442
|
*/
|
|
51427
51443
|
save() {
|
|
51428
51444
|
this._lerp.cancel();
|
|
51429
|
-
this.
|
|
51430
|
-
this._savedTarget.copy(this._target);
|
|
51445
|
+
this._savedState.save();
|
|
51431
51446
|
}
|
|
51432
51447
|
/**
|
|
51433
51448
|
* Represents whether the camera projection is orthographic.
|
|
@@ -52570,15 +52585,18 @@ void main() {
|
|
|
52570
52585
|
this._id = -1;
|
|
52571
52586
|
}
|
|
52572
52587
|
onPointerDown(event) {
|
|
52573
|
-
|
|
52574
|
-
this._canvas.releasePointerCapture(this._id);
|
|
52575
|
-
}
|
|
52588
|
+
this.release();
|
|
52576
52589
|
this._canvas.setPointerCapture(event.pointerId);
|
|
52577
52590
|
this._id = event.pointerId;
|
|
52578
52591
|
}
|
|
52579
52592
|
onPointerUp(event) {
|
|
52580
|
-
this.
|
|
52581
|
-
|
|
52593
|
+
this.release();
|
|
52594
|
+
}
|
|
52595
|
+
release() {
|
|
52596
|
+
if (this._id >= 0) {
|
|
52597
|
+
this._canvas.releasePointerCapture(this._id);
|
|
52598
|
+
this._id = -1;
|
|
52599
|
+
}
|
|
52582
52600
|
}
|
|
52583
52601
|
}
|
|
52584
52602
|
class DoubleClickHandler {
|
|
@@ -68563,8 +68581,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68563
68581
|
InteractionMode2["ClickItemToExpand"] = "click-item-to-expand";
|
|
68564
68582
|
InteractionMode2["ClickArrowToExpand"] = "click-arrow-to-expand";
|
|
68565
68583
|
})(InteractionMode || (InteractionMode = {}));
|
|
68566
|
-
var __assign$
|
|
68567
|
-
__assign$
|
|
68584
|
+
var __assign$c = function() {
|
|
68585
|
+
__assign$c = Object.assign || function(t) {
|
|
68568
68586
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
68569
68587
|
s = arguments[i2];
|
|
68570
68588
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -68572,13 +68590,13 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68572
68590
|
}
|
|
68573
68591
|
return t;
|
|
68574
68592
|
};
|
|
68575
|
-
return __assign$
|
|
68593
|
+
return __assign$c.apply(this, arguments);
|
|
68576
68594
|
};
|
|
68577
68595
|
var mergeInteractionManagers = function(main, fallback) {
|
|
68578
68596
|
return {
|
|
68579
68597
|
mode: main.mode,
|
|
68580
68598
|
createInteractiveElementProps: function(item, treeId, actions, renderFlags) {
|
|
68581
|
-
return __assign$
|
|
68599
|
+
return __assign$c(__assign$c({}, fallback.createInteractiveElementProps(item, treeId, actions, renderFlags)), main.createInteractiveElementProps(item, treeId, actions, renderFlags));
|
|
68582
68600
|
}
|
|
68583
68601
|
};
|
|
68584
68602
|
};
|
|
@@ -68596,10 +68614,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68596
68614
|
var _this = this;
|
|
68597
68615
|
return {
|
|
68598
68616
|
onClick: function(e) {
|
|
68617
|
+
var isSpacebarEvent = e.detail === 0;
|
|
68599
68618
|
actions.focusItem();
|
|
68600
|
-
if (e.shiftKey) {
|
|
68619
|
+
if (e.shiftKey && !isSpacebarEvent) {
|
|
68601
68620
|
actions.selectUpTo(!isControlKey$1(e));
|
|
68602
|
-
} else if (isControlKey$1(e)) {
|
|
68621
|
+
} else if (isControlKey$1(e) && !isSpacebarEvent) {
|
|
68603
68622
|
if (renderFlags.isSelected) {
|
|
68604
68623
|
actions.unselectItem();
|
|
68605
68624
|
} else {
|
|
@@ -68647,10 +68666,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68647
68666
|
var _this = this;
|
|
68648
68667
|
return {
|
|
68649
68668
|
onClick: function(e) {
|
|
68669
|
+
var isSpacebarEvent = e.detail === 0;
|
|
68650
68670
|
actions.focusItem();
|
|
68651
|
-
if (e.shiftKey) {
|
|
68671
|
+
if (e.shiftKey && !isSpacebarEvent) {
|
|
68652
68672
|
actions.selectUpTo(!isControlKey$1(e));
|
|
68653
|
-
} else if (isControlKey$1(e)) {
|
|
68673
|
+
} else if (isControlKey$1(e) && !isSpacebarEvent) {
|
|
68654
68674
|
if (renderFlags.isSelected) {
|
|
68655
68675
|
actions.unselectItem();
|
|
68656
68676
|
} else {
|
|
@@ -68694,10 +68714,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68694
68714
|
var _this = this;
|
|
68695
68715
|
return {
|
|
68696
68716
|
onClick: function(e) {
|
|
68717
|
+
var isSpacebarEvent = e.detail === 0;
|
|
68697
68718
|
actions.focusItem();
|
|
68698
|
-
if (e.shiftKey) {
|
|
68719
|
+
if (e.shiftKey && !isSpacebarEvent) {
|
|
68699
68720
|
actions.selectUpTo(!isControlKey$1(e));
|
|
68700
|
-
} else if (isControlKey$1(e)) {
|
|
68721
|
+
} else if (isControlKey$1(e) && !isSpacebarEvent) {
|
|
68701
68722
|
if (renderFlags.isSelected) {
|
|
68702
68723
|
actions.unselectItem();
|
|
68703
68724
|
} else {
|
|
@@ -68815,7 +68836,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68815
68836
|
return isDescendant(treeId, parentLinearIndex, potentialParents);
|
|
68816
68837
|
}, [getParentOfLinearItem]);
|
|
68817
68838
|
return React2.useCallback(function(treeId, draggingItems) {
|
|
68818
|
-
var _a3, _b2;
|
|
68839
|
+
var _a3, _b2, _c, _d;
|
|
68819
68840
|
var linearItems = environment.linearItems[treeId];
|
|
68820
68841
|
var targets = [];
|
|
68821
68842
|
var skipUntilDepthIsLowerThan = -1;
|
|
@@ -68825,7 +68846,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68825
68846
|
// eslint-disable-next-line no-plusplus
|
|
68826
68847
|
linearIndex++
|
|
68827
68848
|
) {
|
|
68828
|
-
var
|
|
68849
|
+
var _e = linearItems[linearIndex], item = _e.item, depth = _e.depth;
|
|
68829
68850
|
if (skipUntilDepthIsLowerThan !== -1 && depth > skipUntilDepthIsLowerThan) {
|
|
68830
68851
|
continue;
|
|
68831
68852
|
} else {
|
|
@@ -68863,14 +68884,17 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68863
68884
|
depth,
|
|
68864
68885
|
treeId
|
|
68865
68886
|
};
|
|
68866
|
-
var
|
|
68867
|
-
|
|
68887
|
+
var depthOfItemAbove = (_b2 = (_a3 = linearItems[linearIndex - 1]) === null || _a3 === void 0 ? void 0 : _a3.depth) !== null && _b2 !== void 0 ? _b2 : -1;
|
|
68888
|
+
var depthOfItemBelow = (_d = (_c = linearItems[linearIndex + 1]) === null || _c === void 0 ? void 0 : _c.depth) !== null && _d !== void 0 ? _d : -1;
|
|
68889
|
+
var isWithinFolder = depth === depthOfItemAbove;
|
|
68890
|
+
var isBelowOpenFolder = depth === depthOfItemBelow - 1;
|
|
68891
|
+
if (!isWithinFolder && canDropAt(topPosition, draggingItems)) {
|
|
68868
68892
|
targets.push(topPosition);
|
|
68869
68893
|
}
|
|
68870
68894
|
if (canDropAt(itemPosition, draggingItems)) {
|
|
68871
68895
|
targets.push(itemPosition);
|
|
68872
68896
|
}
|
|
68873
|
-
if (canDropAt(bottomPosition, draggingItems)) {
|
|
68897
|
+
if (!isBelowOpenFolder && canDropAt(bottomPosition, draggingItems)) {
|
|
68874
68898
|
targets.push(bottomPosition);
|
|
68875
68899
|
}
|
|
68876
68900
|
}
|
|
@@ -68909,8 +68933,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68909
68933
|
}
|
|
68910
68934
|
}, __spreadArray$4(__spreadArray$4([], deps, true), changeOn, true));
|
|
68911
68935
|
};
|
|
68912
|
-
var __assign$
|
|
68913
|
-
__assign$
|
|
68936
|
+
var __assign$b = function() {
|
|
68937
|
+
__assign$b = Object.assign || function(t) {
|
|
68914
68938
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
68915
68939
|
s = arguments[i2];
|
|
68916
68940
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -68918,7 +68942,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68918
68942
|
}
|
|
68919
68943
|
return t;
|
|
68920
68944
|
};
|
|
68921
|
-
return __assign$
|
|
68945
|
+
return __assign$b.apply(this, arguments);
|
|
68922
68946
|
};
|
|
68923
68947
|
var buildMapForTrees = function(treeIds, build) {
|
|
68924
68948
|
return treeIds.map(function(id2) {
|
|
@@ -68926,7 +68950,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
68926
68950
|
}).reduce(function(a, _a3) {
|
|
68927
68951
|
var _b2;
|
|
68928
68952
|
var id2 = _a3[0], obj = _a3[1];
|
|
68929
|
-
return __assign$
|
|
68953
|
+
return __assign$b(__assign$b({}, a), (_b2 = {}, _b2[id2] = obj, _b2));
|
|
68930
68954
|
}, {});
|
|
68931
68955
|
};
|
|
68932
68956
|
var getDocument = function() {
|
|
@@ -69433,7 +69457,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69433
69457
|
var programmaticDragDown = React2.useCallback(function() {
|
|
69434
69458
|
if (environment.activeTreeId) {
|
|
69435
69459
|
setProgrammaticDragIndex(function(oldIndex) {
|
|
69436
|
-
return Math.min(viableDragPositions[environment.activeTreeId].length, oldIndex + 1);
|
|
69460
|
+
return Math.min(viableDragPositions[environment.activeTreeId].length - 1, oldIndex + 1);
|
|
69437
69461
|
});
|
|
69438
69462
|
}
|
|
69439
69463
|
}, [environment.activeTreeId, viableDragPositions]);
|
|
@@ -69478,8 +69502,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69478
69502
|
}, [onDropHandler, resetState]);
|
|
69479
69503
|
return React__namespace.createElement(DragAndDropContext.Provider, { value: dnd }, children);
|
|
69480
69504
|
};
|
|
69481
|
-
var __assign$
|
|
69482
|
-
__assign$
|
|
69505
|
+
var __assign$a = function() {
|
|
69506
|
+
__assign$a = Object.assign || function(t) {
|
|
69483
69507
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
69484
69508
|
s = arguments[i2];
|
|
69485
69509
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -69487,13 +69511,13 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69487
69511
|
}
|
|
69488
69512
|
return t;
|
|
69489
69513
|
};
|
|
69490
|
-
return __assign$
|
|
69514
|
+
return __assign$a.apply(this, arguments);
|
|
69491
69515
|
};
|
|
69492
69516
|
var useCreatedEnvironmentRef = function(ref, actions) {
|
|
69493
69517
|
var environment = useTreeEnvironment();
|
|
69494
69518
|
var dnd = useDragAndDrop();
|
|
69495
69519
|
React2.useImperativeHandle(ref, function() {
|
|
69496
|
-
return __assign$
|
|
69520
|
+
return __assign$a(__assign$a(__assign$a({}, actions), environment), { treeEnvironmentContext: environment, dragAndDropContext: dnd });
|
|
69497
69521
|
});
|
|
69498
69522
|
};
|
|
69499
69523
|
var waitFor = function(check2, intervalMs, timeoutMs) {
|
|
@@ -69849,8 +69873,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69849
69873
|
}
|
|
69850
69874
|
}
|
|
69851
69875
|
};
|
|
69852
|
-
var __assign$
|
|
69853
|
-
__assign$
|
|
69876
|
+
var __assign$9 = function() {
|
|
69877
|
+
__assign$9 = Object.assign || function(t) {
|
|
69854
69878
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
69855
69879
|
s = arguments[i2];
|
|
69856
69880
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -69858,7 +69882,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69858
69882
|
}
|
|
69859
69883
|
return t;
|
|
69860
69884
|
};
|
|
69861
|
-
return __assign$
|
|
69885
|
+
return __assign$9.apply(this, arguments);
|
|
69862
69886
|
};
|
|
69863
69887
|
var cx$1 = function() {
|
|
69864
69888
|
var classNames = [];
|
|
@@ -69889,7 +69913,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69889
69913
|
var item = _a3.item, context = _a3.context;
|
|
69890
69914
|
return (
|
|
69891
69915
|
// Icons from https://blueprintjs.com/docs/#icons
|
|
69892
|
-
React2.createElement("div", __assign$
|
|
69916
|
+
React2.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 ? React2.createElement(
|
|
69893
69917
|
"svg",
|
|
69894
69918
|
{ 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" },
|
|
69895
69919
|
React2.createElement(
|
|
@@ -69922,12 +69946,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69922
69946
|
var type = context.isRenaming ? void 0 : "button";
|
|
69923
69947
|
return React2.createElement(
|
|
69924
69948
|
"li",
|
|
69925
|
-
__assign$
|
|
69949
|
+
__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") }),
|
|
69926
69950
|
React2.createElement(
|
|
69927
69951
|
"div",
|
|
69928
|
-
__assign$
|
|
69952
|
+
__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") }),
|
|
69929
69953
|
arrow,
|
|
69930
|
-
React2.createElement(InteractiveComponent, __assign$
|
|
69954
|
+
React2.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)
|
|
69931
69955
|
),
|
|
69932
69956
|
children
|
|
69933
69957
|
);
|
|
@@ -69936,9 +69960,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69936
69960
|
var inputProps = _a3.inputProps, inputRef = _a3.inputRef, submitButtonProps = _a3.submitButtonProps, submitButtonRef = _a3.submitButtonRef, formProps = _a3.formProps;
|
|
69937
69961
|
return React2.createElement(
|
|
69938
69962
|
"form",
|
|
69939
|
-
__assign$
|
|
69940
|
-
React2.createElement("input", __assign$
|
|
69941
|
-
React2.createElement("input", __assign$
|
|
69963
|
+
__assign$9({}, formProps, { className: "rct-tree-item-renaming-form" }),
|
|
69964
|
+
React2.createElement("input", __assign$9({}, inputProps, { ref: inputRef, className: "rct-tree-item-renaming-input" })),
|
|
69965
|
+
React2.createElement("input", __assign$9({}, submitButtonProps, { ref: submitButtonRef, type: "submit", className: "rct-tree-item-renaming-submit-button", value: "🗸" }))
|
|
69942
69966
|
);
|
|
69943
69967
|
},
|
|
69944
69968
|
renderTreeContainer: function(_a3) {
|
|
@@ -69946,16 +69970,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69946
69970
|
return React2.createElement(
|
|
69947
69971
|
"div",
|
|
69948
69972
|
{ 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) },
|
|
69949
|
-
React2.createElement("div", __assign$
|
|
69973
|
+
React2.createElement("div", __assign$9({}, containerProps, { style: __assign$9({ minHeight: "30px" }, containerProps.style) }), children)
|
|
69950
69974
|
);
|
|
69951
69975
|
},
|
|
69952
69976
|
renderItemsContainer: function(_a3) {
|
|
69953
69977
|
var children = _a3.children, containerProps = _a3.containerProps;
|
|
69954
|
-
return React2.createElement("ul", __assign$
|
|
69978
|
+
return React2.createElement("ul", __assign$9({}, containerProps, { className: "rct-tree-items-container" }), children);
|
|
69955
69979
|
},
|
|
69956
69980
|
renderDragBetweenLine: function(_a3) {
|
|
69957
69981
|
var draggingPosition = _a3.draggingPosition, lineProps = _a3.lineProps;
|
|
69958
|
-
return React2.createElement("div", __assign$
|
|
69982
|
+
return React2.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") }));
|
|
69959
69983
|
},
|
|
69960
69984
|
renderSearchInput: function(_a3) {
|
|
69961
69985
|
var inputProps = _a3.inputProps;
|
|
@@ -69963,7 +69987,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
69963
69987
|
"div",
|
|
69964
69988
|
{ className: cx$1("rct-tree-search-input-container") },
|
|
69965
69989
|
React2.createElement("span", { className: "rct-tree-input-icon" }),
|
|
69966
|
-
React2.createElement("input", __assign$
|
|
69990
|
+
React2.createElement("input", __assign$9({}, inputProps, { className: cx$1("rct-tree-search-input") }))
|
|
69967
69991
|
);
|
|
69968
69992
|
},
|
|
69969
69993
|
renderLiveDescriptorContainer: function(_a3) {
|
|
@@ -70034,8 +70058,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70034
70058
|
}
|
|
70035
70059
|
return itemIds;
|
|
70036
70060
|
};
|
|
70037
|
-
var __assign$
|
|
70038
|
-
__assign$
|
|
70061
|
+
var __assign$8 = function() {
|
|
70062
|
+
__assign$8 = Object.assign || function(t) {
|
|
70039
70063
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
70040
70064
|
s = arguments[i2];
|
|
70041
70065
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -70043,7 +70067,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70043
70067
|
}
|
|
70044
70068
|
return t;
|
|
70045
70069
|
};
|
|
70046
|
-
return __assign$
|
|
70070
|
+
return __assign$8.apply(this, arguments);
|
|
70047
70071
|
};
|
|
70048
70072
|
var __rest = function(s, e) {
|
|
70049
70073
|
var t = {};
|
|
@@ -70093,7 +70117,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70093
70117
|
var registerTree = React2.useCallback(function(tree) {
|
|
70094
70118
|
setTrees(function(trees3) {
|
|
70095
70119
|
var _a4;
|
|
70096
|
-
return __assign$
|
|
70120
|
+
return __assign$8(__assign$8({}, trees3), (_a4 = {}, _a4[tree.treeId] = tree, _a4));
|
|
70097
70121
|
});
|
|
70098
70122
|
onRegisterTree === null || onRegisterTree === void 0 ? void 0 : onRegisterTree(tree);
|
|
70099
70123
|
}, [onRegisterTree]);
|
|
@@ -70150,33 +70174,26 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70150
70174
|
}
|
|
70151
70175
|
}, [autoFocus, focusTree]);
|
|
70152
70176
|
var renderers = useRenderers(props);
|
|
70153
|
-
return __assign$
|
|
70154
|
-
};
|
|
70155
|
-
var __assign$8 = function() {
|
|
70156
|
-
__assign$8 = Object.assign || function(t) {
|
|
70157
|
-
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
70158
|
-
s = arguments[i2];
|
|
70159
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
70160
|
-
t[p] = s[p];
|
|
70161
|
-
}
|
|
70162
|
-
return t;
|
|
70163
|
-
};
|
|
70164
|
-
return __assign$8.apply(this, arguments);
|
|
70177
|
+
return __assign$8(__assign$8(__assign$8({}, renderers), props), { onFocusItem: onFocusItemHandler, registerTree, unregisterTree, onExpandItem, onCollapseItem, onDrop, setActiveTree, treeIds, trees: trees2, activeTreeId, linearItems });
|
|
70165
70178
|
};
|
|
70166
70179
|
var TreeEnvironmentContext = React__namespace.createContext(null);
|
|
70167
70180
|
var useTreeEnvironment = function() {
|
|
70168
70181
|
return React2.useContext(TreeEnvironmentContext);
|
|
70169
70182
|
};
|
|
70170
70183
|
var ControlledTreeEnvironment = React__namespace.forwardRef(function(props, ref) {
|
|
70171
|
-
var _a3, _b2, _c;
|
|
70172
70184
|
var environmentContextProps = useControlledTreeEnvironmentProps(props);
|
|
70173
|
-
var viewState = props.viewState;
|
|
70174
|
-
|
|
70175
|
-
var
|
|
70176
|
-
|
|
70177
|
-
|
|
70185
|
+
var viewState = props.viewState, onFocusItem = props.onFocusItem;
|
|
70186
|
+
React2.useEffect(function() {
|
|
70187
|
+
var _a3, _b2, _c;
|
|
70188
|
+
for (var _i = 0, _d = Object.keys(environmentContextProps.trees); _i < _d.length; _i++) {
|
|
70189
|
+
var treeId = _d[_i];
|
|
70190
|
+
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];
|
|
70191
|
+
var firstItem = firstItemIndex && props.items[firstItemIndex];
|
|
70192
|
+
if (!((_c = viewState[treeId]) === null || _c === void 0 ? void 0 : _c.focusedItem) && environmentContextProps.trees[treeId] && firstItem) {
|
|
70193
|
+
onFocusItem === null || onFocusItem === void 0 ? void 0 : onFocusItem(firstItem, treeId, false);
|
|
70194
|
+
}
|
|
70178
70195
|
}
|
|
70179
|
-
}
|
|
70196
|
+
}, [environmentContextProps.trees, onFocusItem, props.items, viewState]);
|
|
70180
70197
|
return React__namespace.createElement(
|
|
70181
70198
|
TreeEnvironmentContext.Provider,
|
|
70182
70199
|
{ value: environmentContextProps },
|
|
@@ -70271,11 +70288,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70271
70288
|
primaryAction: ["enter"],
|
|
70272
70289
|
renameItem: ["f2"],
|
|
70273
70290
|
abortRenameItem: ["escape"],
|
|
70274
|
-
toggleSelectItem: ["control+
|
|
70291
|
+
toggleSelectItem: ["control+ "],
|
|
70275
70292
|
abortSearch: ["escape", "enter"],
|
|
70276
70293
|
startSearch: [],
|
|
70277
70294
|
selectAll: ["control+a"],
|
|
70278
|
-
startProgrammaticDnd: ["control+d"],
|
|
70295
|
+
startProgrammaticDnd: ["control+shift+d"],
|
|
70279
70296
|
completeProgrammaticDnd: ["enter"],
|
|
70280
70297
|
abortProgrammaticDnd: ["escape"]
|
|
70281
70298
|
};
|
|
@@ -70335,7 +70352,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70335
70352
|
return a || b;
|
|
70336
70353
|
}, false);
|
|
70337
70354
|
if (partialMatch) {
|
|
70338
|
-
if (pressedKeys.current.length > 1 || !/^[a-zA-Z]$/.test(e.key)) {
|
|
70355
|
+
if (pressedKeys.current.length > 1 || !/^[a-zA-Z\s]$/.test(e.key)) {
|
|
70339
70356
|
e.preventDefault();
|
|
70340
70357
|
}
|
|
70341
70358
|
}
|
|
@@ -70569,6 +70586,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
70569
70586
|
useHotkey("toggleSelectItem", function(e) {
|
|
70570
70587
|
var _a4, _b3, _c;
|
|
70571
70588
|
e.preventDefault();
|
|
70589
|
+
e.stopPropagation();
|
|
70572
70590
|
if (viewState.focusedItem !== void 0) {
|
|
70573
70591
|
if (viewState.selectedItems && viewState.selectedItems.includes(viewState.focusedItem)) {
|
|
70574
70592
|
(_a4 = environment.onSelectItems) === null || _a4 === void 0 ? void 0 : _a4.call(environment, viewState.selectedItems.filter(function(item) {
|