@shapediver/viewer.shared.node-tree 1.5.3
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/LICENSE +73 -0
- package/README.md +3 -0
- package/dist/AbstractTreeNodeData.d.ts +10 -0
- package/dist/AbstractTreeNodeData.d.ts.map +1 -0
- package/dist/AbstractTreeNodeData.js +39 -0
- package/dist/AbstractTreeNodeData.js.map +1 -0
- package/dist/Tree.d.ts +12 -0
- package/dist/Tree.d.ts.map +1 -0
- package/dist/Tree.js +111 -0
- package/dist/Tree.js.map +1 -0
- package/dist/TreeNode.d.ts +40 -0
- package/dist/TreeNode.d.ts.map +1 -0
- package/dist/TreeNode.js +200 -0
- package/dist/TreeNode.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/ITreeNodeData.d.ts +7 -0
- package/dist/interfaces/ITreeNodeData.d.ts.map +1 -0
- package/dist/interfaces/ITreeNodeData.js +3 -0
- package/dist/interfaces/ITreeNodeData.js.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Required Notice: Copyright 2021 ShapeDiver GmbH (https://www.shapediver.com)
|
|
2
|
+
|
|
3
|
+
https://polyformproject.org/licenses/noncommercial/1.0.0
|
|
4
|
+
|
|
5
|
+
Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
8
|
+
|
|
9
|
+
Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor’s copyright in it for any permitted purpose. However, you may only distribute the software according to Distribution License and make changes or new works based on the software according to Changes and New Works License.
|
|
12
|
+
|
|
13
|
+
Distribution License
|
|
14
|
+
|
|
15
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by Changes and New Works License.
|
|
16
|
+
|
|
17
|
+
Notices
|
|
18
|
+
|
|
19
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with Required Notice: that the licensor provided with the software. For example:
|
|
20
|
+
|
|
21
|
+
Required Notice: Copyright 2021 ShapeDiver GmbH (https://www.shapediver.com)
|
|
22
|
+
|
|
23
|
+
Changes and New Works License
|
|
24
|
+
|
|
25
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
26
|
+
|
|
27
|
+
Patent License
|
|
28
|
+
|
|
29
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
30
|
+
|
|
31
|
+
Noncommercial Purposes
|
|
32
|
+
|
|
33
|
+
Any noncommercial purpose is a permitted purpose.
|
|
34
|
+
|
|
35
|
+
Personal Uses
|
|
36
|
+
|
|
37
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
38
|
+
|
|
39
|
+
Noncommercial Organizations
|
|
40
|
+
|
|
41
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
42
|
+
|
|
43
|
+
Fair Use
|
|
44
|
+
|
|
45
|
+
You may have “fair use” rights for the software under the law. These terms do not limit them.
|
|
46
|
+
|
|
47
|
+
No Other Rights
|
|
48
|
+
|
|
49
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
50
|
+
|
|
51
|
+
Patent Defense
|
|
52
|
+
|
|
53
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
54
|
+
|
|
55
|
+
Violations
|
|
56
|
+
|
|
57
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
58
|
+
|
|
59
|
+
No Liability
|
|
60
|
+
|
|
61
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
62
|
+
|
|
63
|
+
Definitions
|
|
64
|
+
|
|
65
|
+
The licensor is the individual or entity offering these terms, and the software is the software the licensor makes available under these terms.
|
|
66
|
+
|
|
67
|
+
You refers to the individual or entity agreeing to these terms.
|
|
68
|
+
|
|
69
|
+
Your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. Control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
70
|
+
|
|
71
|
+
Your licenses are all the licenses granted to you for the software under these terms.
|
|
72
|
+
|
|
73
|
+
Use means anything you do with the software requiring one of your licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ITreeNodeData } from './interfaces/ITreeNodeData';
|
|
2
|
+
export declare abstract class AbstractTreeNodeData implements ITreeNodeData {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(id?: string);
|
|
5
|
+
get id(): string;
|
|
6
|
+
get version(): string;
|
|
7
|
+
updateVersion(): void;
|
|
8
|
+
abstract clone(): ITreeNodeData;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AbstractTreeNodeData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractTreeNodeData.d.ts","sourceRoot":"","sources":["../src/AbstractTreeNodeData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,8BAAsB,oBAAqB,YAAW,aAAa;;gBAkBrD,EAAE,CAAC,EAAE,MAAM;IASvB,IAAW,EAAE,IAAI,MAAM,CAEtB;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IASM,aAAa,IAAI,IAAI;aAWZ,KAAK,IAAI,aAAa;CAGvC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
+
};
|
|
13
|
+
var _AbstractTreeNodeData_version, _AbstractTreeNodeData_id, _AbstractTreeNodeData_uuidGenerator, _AbstractTreeNodeData_eventEngine;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AbstractTreeNodeData = void 0;
|
|
16
|
+
const tsyringe_1 = require("tsyringe");
|
|
17
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
18
|
+
class AbstractTreeNodeData {
|
|
19
|
+
constructor(id) {
|
|
20
|
+
_AbstractTreeNodeData_version.set(this, void 0);
|
|
21
|
+
_AbstractTreeNodeData_id.set(this, void 0);
|
|
22
|
+
_AbstractTreeNodeData_uuidGenerator.set(this, tsyringe_1.container.resolve(viewer_shared_services_1.UuidGenerator));
|
|
23
|
+
_AbstractTreeNodeData_eventEngine.set(this, tsyringe_1.container.resolve(viewer_shared_services_1.EventEngine));
|
|
24
|
+
__classPrivateFieldSet(this, _AbstractTreeNodeData_id, id || __classPrivateFieldGet(this, _AbstractTreeNodeData_uuidGenerator, "f").create(), "f");
|
|
25
|
+
__classPrivateFieldSet(this, _AbstractTreeNodeData_version, __classPrivateFieldGet(this, _AbstractTreeNodeData_uuidGenerator, "f").create(), "f");
|
|
26
|
+
}
|
|
27
|
+
get id() {
|
|
28
|
+
return __classPrivateFieldGet(this, _AbstractTreeNodeData_id, "f");
|
|
29
|
+
}
|
|
30
|
+
get version() {
|
|
31
|
+
return __classPrivateFieldGet(this, _AbstractTreeNodeData_version, "f");
|
|
32
|
+
}
|
|
33
|
+
updateVersion() {
|
|
34
|
+
__classPrivateFieldSet(this, _AbstractTreeNodeData_version, __classPrivateFieldGet(this, _AbstractTreeNodeData_uuidGenerator, "f").create(), "f");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.AbstractTreeNodeData = AbstractTreeNodeData;
|
|
38
|
+
_AbstractTreeNodeData_version = new WeakMap(), _AbstractTreeNodeData_id = new WeakMap(), _AbstractTreeNodeData_uuidGenerator = new WeakMap(), _AbstractTreeNodeData_eventEngine = new WeakMap();
|
|
39
|
+
//# sourceMappingURL=AbstractTreeNodeData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractTreeNodeData.js","sourceRoot":"","sources":["../src/AbstractTreeNodeData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,+EAA0F;AAI1F,MAAsB,oBAAoB;IAkBxC,YAAY,EAAW;QAfvB,gDAAiB;QAEjB,2CAAqB;QACrB,8CAAwD,oBAAS,CAAC,OAAO,CAAC,sCAAa,CAAC,EAAC;QACzF,4CAAkD,oBAAS,CAAC,OAAO,CAAC,oCAAW,CAAC,EAAC;QAY/E,uBAAA,IAAI,4BAAO,EAAE,IAAI,uBAAA,IAAI,2CAAe,CAAC,MAAM,EAAE,MAAA,CAAC;QAC9C,uBAAA,IAAI,iCAAY,uBAAA,IAAI,2CAAe,CAAC,MAAM,EAAE,MAAA,CAAC;IAC/C,CAAC;IAMD,IAAW,EAAE;QACX,OAAO,uBAAA,IAAI,gCAAI,CAAC;IAClB,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,uBAAA,IAAI,qCAAS,CAAC;IACvB,CAAC;IASM,aAAa;QAClB,uBAAA,IAAI,iCAAY,uBAAA,IAAI,2CAAe,CAAC,MAAM,EAAE,MAAA,CAAC;IAC/C,CAAC;CAYF;AAxDD,oDAwDC"}
|
package/dist/Tree.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TreeNode } from './TreeNode';
|
|
2
|
+
export declare class Tree {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
get root(): TreeNode;
|
|
6
|
+
addNode(node: TreeNode, parent?: TreeNode, root?: TreeNode): boolean;
|
|
7
|
+
addNodeAtPath(node: TreeNode, path?: string, root?: TreeNode): boolean;
|
|
8
|
+
removeNode(node: TreeNode, root?: TreeNode): boolean;
|
|
9
|
+
removeNodeAtPath(path: string, root?: TreeNode): boolean;
|
|
10
|
+
getNodeAtPath(path?: string, root?: TreeNode): TreeNode | null;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../src/Tree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBACa,IAAI;;;IAmBf,IAAW,IAAI,IAAI,QAAQ,CAE1B;IAaM,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAE,QAAqB,EAAE,IAAI,GAAE,QAAqB,GAAG,OAAO;IAsB5F,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,MAA4B,EAAE,IAAI,GAAE,QAAqB,GAAG,OAAO;IA0BvG,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,QAAqB,GAAG,OAAO;IAsBhE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,QAAqB,GAAG,OAAO;IA4BpE,aAAa,CAAC,IAAI,GAAE,MAA4B,EAAE,IAAI,GAAE,QAAqB,GAAG,QAAQ,GAAG,IAAI;CAkBvG"}
|
package/dist/Tree.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _Tree_root;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Tree = void 0;
|
|
19
|
+
const tsyringe_1 = require("tsyringe");
|
|
20
|
+
const TreeNode_1 = require("./TreeNode");
|
|
21
|
+
let Tree = class Tree {
|
|
22
|
+
constructor() {
|
|
23
|
+
_Tree_root.set(this, new TreeNode_1.TreeNode('root'));
|
|
24
|
+
}
|
|
25
|
+
get root() {
|
|
26
|
+
return __classPrivateFieldGet(this, _Tree_root, "f");
|
|
27
|
+
}
|
|
28
|
+
addNode(node, parent = __classPrivateFieldGet(this, _Tree_root, "f"), root = __classPrivateFieldGet(this, _Tree_root, "f")) {
|
|
29
|
+
if (root === parent) {
|
|
30
|
+
root.addChild(node);
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
for (let i = 0; i < root.children.length; i++) {
|
|
34
|
+
const child = root.children[i];
|
|
35
|
+
if (child && this.addNode(node, parent, child)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
addNodeAtPath(node, path = this.root.getPath(), root = __classPrivateFieldGet(this, _Tree_root, "f")) {
|
|
42
|
+
if (root.name === path) {
|
|
43
|
+
root.addChild(node);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
const pathStart = path.substr(0, path.indexOf('.'));
|
|
47
|
+
if (root.name === pathStart) {
|
|
48
|
+
const shortenedPath = path.substr(pathStart.length + 1, path.length);
|
|
49
|
+
for (let i = 0; i < root.children.length; i++) {
|
|
50
|
+
const child = root.children[i];
|
|
51
|
+
if (child && this.addNodeAtPath(node, shortenedPath, child)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
removeNode(node, root = __classPrivateFieldGet(this, _Tree_root, "f")) {
|
|
59
|
+
if (root.hasChild(node)) {
|
|
60
|
+
root.removeChild(node);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
for (let i = 0; i < root.children.length; i++) {
|
|
64
|
+
const child = root.children[i];
|
|
65
|
+
if (child && this.removeNode(node, child)) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
removeNodeAtPath(path, root = __classPrivateFieldGet(this, _Tree_root, "f")) {
|
|
72
|
+
var _a;
|
|
73
|
+
if (root.name === path) {
|
|
74
|
+
(_a = root.parent) === null || _a === void 0 ? void 0 : _a.removeChild(root);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
const pathStart = path.substr(0, path.indexOf('.'));
|
|
78
|
+
if (root.name === pathStart) {
|
|
79
|
+
const shortenedPath = path.substr(pathStart.length + 1, path.length);
|
|
80
|
+
for (let i = 0; i < root.children.length; i++) {
|
|
81
|
+
const child = root.children[i];
|
|
82
|
+
if (child && this.removeNodeAtPath(shortenedPath, child)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
getNodeAtPath(path = this.root.getPath(), root = __classPrivateFieldGet(this, _Tree_root, "f")) {
|
|
90
|
+
if (root.name === path)
|
|
91
|
+
return root;
|
|
92
|
+
const pathStart = path.substr(0, path.indexOf('.'));
|
|
93
|
+
if (root.name === pathStart) {
|
|
94
|
+
const shortenedPath = path.substr(pathStart.length + 1, path.length);
|
|
95
|
+
for (let i = 0; i < root.children.length; i++) {
|
|
96
|
+
const child = root.children[i];
|
|
97
|
+
const res = this.getNodeAtPath(shortenedPath, child);
|
|
98
|
+
if (res)
|
|
99
|
+
return res;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
_Tree_root = new WeakMap();
|
|
106
|
+
Tree = __decorate([
|
|
107
|
+
tsyringe_1.singleton(),
|
|
108
|
+
__metadata("design:paramtypes", [])
|
|
109
|
+
], Tree);
|
|
110
|
+
exports.Tree = Tree;
|
|
111
|
+
//# sourceMappingURL=Tree.js.map
|
package/dist/Tree.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../src/Tree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uCAAoC;AAEpC,yCAAqC;AAGrC,IAAa,IAAI,GAAjB,MAAa,IAAI;IAaf;QAVA,qBAAiB,IAAI,mBAAQ,CAAC,MAAM,CAAC,EAAC;IAUtB,CAAC;IAMjB,IAAW,IAAI;QACb,OAAO,uBAAA,IAAI,kBAAM,CAAC;IACpB,CAAC;IAaM,OAAO,CAAC,IAAc,EAAE,SAAmB,uBAAA,IAAI,kBAAM,EAAE,OAAiB,uBAAA,IAAI,kBAAM;QACvF,IAAI,IAAI,KAAK,MAAM,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;SACb;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;gBAC9C,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IASM,aAAa,CAAC,IAAc,EAAE,OAAe,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAiB,uBAAA,IAAI,kBAAM;QAClG,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACpB,OA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AAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;gBACrD,IAAG,GAAG;oBAAE,OAAO,GAAG,CAAC;aACpB;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CAGF,CAAA;;AAtJY,IAAI;IADhB,oBAAS,EAAE;;GACC,IAAI,CAsJhB;AAtJY,oBAAI"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { mat4 } from 'gl-matrix';
|
|
2
|
+
import { Box } from '@shapediver/viewer.shared.math';
|
|
3
|
+
import { ITreeNodeData } from './interfaces/ITreeNodeData';
|
|
4
|
+
export interface ITransformation {
|
|
5
|
+
id: string;
|
|
6
|
+
matrix: mat4;
|
|
7
|
+
}
|
|
8
|
+
export declare class TreeNode {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(name?: string, parent?: TreeNode | null, data?: ITreeNodeData[], transformations?: ITransformation[]);
|
|
11
|
+
get boundingBox(): Box;
|
|
12
|
+
set boundingBox(value: Box);
|
|
13
|
+
get children(): TreeNode[];
|
|
14
|
+
get data(): ITreeNodeData[];
|
|
15
|
+
get excludeViewers(): string[];
|
|
16
|
+
set excludeViewers(value: string[]);
|
|
17
|
+
get id(): string;
|
|
18
|
+
set id(value: string);
|
|
19
|
+
get name(): string;
|
|
20
|
+
get nodeMatrix(): mat4;
|
|
21
|
+
get nodeMatrixSDTF(): mat4;
|
|
22
|
+
get parent(): TreeNode | null;
|
|
23
|
+
set parent(value: TreeNode | null);
|
|
24
|
+
get transformations(): ITransformation[];
|
|
25
|
+
set transformations(value: ITransformation[]);
|
|
26
|
+
get version(): string;
|
|
27
|
+
get visible(): boolean;
|
|
28
|
+
set visible(value: boolean);
|
|
29
|
+
get worldMatrix(): mat4;
|
|
30
|
+
addChild(child: TreeNode): boolean;
|
|
31
|
+
clone(): TreeNode;
|
|
32
|
+
cloneInstance(): TreeNode;
|
|
33
|
+
getChild(id: string): TreeNode | null;
|
|
34
|
+
getPath(): string;
|
|
35
|
+
hasChild(child: TreeNode): boolean;
|
|
36
|
+
removeChild(child: TreeNode): boolean;
|
|
37
|
+
updateVersion(): void;
|
|
38
|
+
updateVersionAtomic(): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=TreeNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeNode.d.ts","sourceRoot":"","sources":["../src/TreeNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,WAAW,eAAe;IAG9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,IAAI,CAAA;CAGb;AAED,qBAAa,QAAQ;;gBA8BjB,IAAI,GAAE,MAAe,EACrB,MAAM,GAAE,QAAQ,GAAG,IAAW,EAC9B,IAAI,GAAE,aAAa,EAAO,EAC1B,eAAe,GAAE,eAAe,EAAO;IAgBzC,IAAW,WAAW,IAAI,GAAG,CAE5B;IAED,IAAW,WAAW,CAAC,KAAK,EAAE,GAAG,EAEhC;IAED,IAAW,QAAQ,IAAI,QAAQ,EAAE,CAEhC;IAED,IAAW,IAAI,IAAI,aAAa,EAAE,CAEjC;IAED,IAAW,cAAc,IAAI,MAAM,EAAE,CAEpC;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAExC;IAED,IAAW,EAAE,IAAI,MAAM,CAEtB;IAED,IAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAE1B;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,UAAU,IAAI,IAAI,CAK5B;IAED,IAAW,cAAc,IAAI,IAAI,CAKhC;IAED,IAAW,MAAM,IAAI,QAAQ,GAAG,IAAI,CAEnC;IAED,IAAW,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAUvC;IAED,IAAW,eAAe,IAAI,eAAe,EAAE,CAE9C;IAED,IAAW,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,EAElD;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,EAEhC;IAED,IAAW,WAAW,IAAI,IAAI,CAa7B;IAWM,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAalC,KAAK,IAAI,QAAQ;IAmBjB,aAAa,IAAI,QAAQ;IAoBzB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAUrC,OAAO,IAAI,MAAM;IAejB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IASlC,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAWrC,aAAa,IAAI,IAAI;IAmBrB,mBAAmB,IAAI,IAAI;CAKnC"}
|
package/dist/TreeNode.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _TreeNode_children, _TreeNode_data, _TreeNode_eventEngine, _TreeNode_name, _TreeNode_uuidGenerator, _TreeNode_boundingBox, _TreeNode_id, _TreeNode_parent, _TreeNode_transformations, _TreeNode_excludeViewers, _TreeNode_version, _TreeNode_visible;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TreeNode = void 0;
|
|
16
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
17
|
+
const tsyringe_1 = require("tsyringe");
|
|
18
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
19
|
+
const viewer_shared_math_1 = require("@shapediver/viewer.shared.math");
|
|
20
|
+
class TreeNode {
|
|
21
|
+
constructor(name = 'node', parent = null, data = [], transformations = []) {
|
|
22
|
+
var _a;
|
|
23
|
+
_TreeNode_children.set(this, []);
|
|
24
|
+
_TreeNode_data.set(this, []);
|
|
25
|
+
_TreeNode_eventEngine.set(this, tsyringe_1.container.resolve(viewer_shared_services_1.EventEngine));
|
|
26
|
+
_TreeNode_name.set(this, '');
|
|
27
|
+
_TreeNode_uuidGenerator.set(this, tsyringe_1.container.resolve(viewer_shared_services_1.UuidGenerator));
|
|
28
|
+
_TreeNode_boundingBox.set(this, new viewer_shared_math_1.Box());
|
|
29
|
+
_TreeNode_id.set(this, void 0);
|
|
30
|
+
_TreeNode_parent.set(this, null);
|
|
31
|
+
_TreeNode_transformations.set(this, []);
|
|
32
|
+
_TreeNode_excludeViewers.set(this, []);
|
|
33
|
+
_TreeNode_version.set(this, void 0);
|
|
34
|
+
_TreeNode_visible.set(this, true);
|
|
35
|
+
__classPrivateFieldSet(this, _TreeNode_name, name.replace(/\./g, "_"), "f");
|
|
36
|
+
__classPrivateFieldSet(this, _TreeNode_parent, parent, "f");
|
|
37
|
+
__classPrivateFieldSet(this, _TreeNode_data, data, "f");
|
|
38
|
+
__classPrivateFieldSet(this, _TreeNode_transformations, transformations, "f");
|
|
39
|
+
__classPrivateFieldSet(this, _TreeNode_id, __classPrivateFieldGet(this, _TreeNode_uuidGenerator, "f").create(), "f");
|
|
40
|
+
__classPrivateFieldSet(this, _TreeNode_version, __classPrivateFieldGet(this, _TreeNode_uuidGenerator, "f").create(), "f");
|
|
41
|
+
(_a = __classPrivateFieldGet(this, _TreeNode_parent, "f")) === null || _a === void 0 ? void 0 : _a.addChild(this);
|
|
42
|
+
}
|
|
43
|
+
get boundingBox() {
|
|
44
|
+
return __classPrivateFieldGet(this, _TreeNode_boundingBox, "f");
|
|
45
|
+
}
|
|
46
|
+
set boundingBox(value) {
|
|
47
|
+
__classPrivateFieldSet(this, _TreeNode_boundingBox, value, "f");
|
|
48
|
+
}
|
|
49
|
+
get children() {
|
|
50
|
+
return __classPrivateFieldGet(this, _TreeNode_children, "f");
|
|
51
|
+
}
|
|
52
|
+
get data() {
|
|
53
|
+
return __classPrivateFieldGet(this, _TreeNode_data, "f");
|
|
54
|
+
}
|
|
55
|
+
get excludeViewers() {
|
|
56
|
+
return __classPrivateFieldGet(this, _TreeNode_excludeViewers, "f");
|
|
57
|
+
}
|
|
58
|
+
set excludeViewers(value) {
|
|
59
|
+
__classPrivateFieldSet(this, _TreeNode_excludeViewers, value, "f");
|
|
60
|
+
}
|
|
61
|
+
get id() {
|
|
62
|
+
return __classPrivateFieldGet(this, _TreeNode_id, "f");
|
|
63
|
+
}
|
|
64
|
+
set id(value) {
|
|
65
|
+
__classPrivateFieldSet(this, _TreeNode_id, value, "f");
|
|
66
|
+
}
|
|
67
|
+
get name() {
|
|
68
|
+
return __classPrivateFieldGet(this, _TreeNode_name, "f");
|
|
69
|
+
}
|
|
70
|
+
get nodeMatrix() {
|
|
71
|
+
const matrix = gl_matrix_1.mat4.create();
|
|
72
|
+
for (let transform of __classPrivateFieldGet(this, _TreeNode_transformations, "f"))
|
|
73
|
+
if (transform.id !== 'sdtf')
|
|
74
|
+
gl_matrix_1.mat4.multiply(matrix, matrix, transform.matrix);
|
|
75
|
+
return matrix;
|
|
76
|
+
}
|
|
77
|
+
get nodeMatrixSDTF() {
|
|
78
|
+
const matrix = gl_matrix_1.mat4.create();
|
|
79
|
+
for (let transform of __classPrivateFieldGet(this, _TreeNode_transformations, "f"))
|
|
80
|
+
gl_matrix_1.mat4.multiply(matrix, matrix, transform.matrix);
|
|
81
|
+
return matrix;
|
|
82
|
+
}
|
|
83
|
+
get parent() {
|
|
84
|
+
return __classPrivateFieldGet(this, _TreeNode_parent, "f");
|
|
85
|
+
}
|
|
86
|
+
set parent(value) {
|
|
87
|
+
if (value === null && __classPrivateFieldGet(this, _TreeNode_parent, "f") !== null)
|
|
88
|
+
__classPrivateFieldGet(this, _TreeNode_parent, "f").removeChild(this);
|
|
89
|
+
if (value !== null)
|
|
90
|
+
value.addChild(this);
|
|
91
|
+
__classPrivateFieldSet(this, _TreeNode_parent, value, "f");
|
|
92
|
+
}
|
|
93
|
+
get transformations() {
|
|
94
|
+
return __classPrivateFieldGet(this, _TreeNode_transformations, "f");
|
|
95
|
+
}
|
|
96
|
+
set transformations(value) {
|
|
97
|
+
__classPrivateFieldSet(this, _TreeNode_transformations, value, "f");
|
|
98
|
+
}
|
|
99
|
+
get version() {
|
|
100
|
+
return __classPrivateFieldGet(this, _TreeNode_version, "f");
|
|
101
|
+
}
|
|
102
|
+
get visible() {
|
|
103
|
+
return __classPrivateFieldGet(this, _TreeNode_visible, "f");
|
|
104
|
+
}
|
|
105
|
+
set visible(value) {
|
|
106
|
+
__classPrivateFieldSet(this, _TreeNode_visible, value, "f");
|
|
107
|
+
}
|
|
108
|
+
get worldMatrix() {
|
|
109
|
+
const matrix = gl_matrix_1.mat4.create();
|
|
110
|
+
for (let transform of __classPrivateFieldGet(this, _TreeNode_transformations, "f"))
|
|
111
|
+
gl_matrix_1.mat4.multiply(matrix, matrix, transform.matrix);
|
|
112
|
+
let node = this;
|
|
113
|
+
while (node.parent) {
|
|
114
|
+
gl_matrix_1.mat4.multiply(matrix, matrix, node.parent.nodeMatrix);
|
|
115
|
+
node = node.parent;
|
|
116
|
+
}
|
|
117
|
+
return matrix;
|
|
118
|
+
}
|
|
119
|
+
addChild(child) {
|
|
120
|
+
if (this.hasChild(child))
|
|
121
|
+
return false;
|
|
122
|
+
__classPrivateFieldGet(this, _TreeNode_children, "f").push(child);
|
|
123
|
+
if (child.parent !== null)
|
|
124
|
+
child.parent.removeChild(child);
|
|
125
|
+
child.parent = this;
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
clone() {
|
|
129
|
+
const clone = new TreeNode(this.name);
|
|
130
|
+
clone.visible = this.visible;
|
|
131
|
+
for (let child of __classPrivateFieldGet(this, _TreeNode_children, "f"))
|
|
132
|
+
clone.addChild(child.clone());
|
|
133
|
+
for (let data of __classPrivateFieldGet(this, _TreeNode_data, "f"))
|
|
134
|
+
clone.data.push(data.clone());
|
|
135
|
+
for (let transform of __classPrivateFieldGet(this, _TreeNode_transformations, "f"))
|
|
136
|
+
clone.transformations.push({
|
|
137
|
+
id: transform.id,
|
|
138
|
+
matrix: gl_matrix_1.mat4.clone(transform.matrix)
|
|
139
|
+
});
|
|
140
|
+
return clone;
|
|
141
|
+
}
|
|
142
|
+
cloneInstance() {
|
|
143
|
+
const clone = new TreeNode(this.name);
|
|
144
|
+
clone.visible = this.visible;
|
|
145
|
+
for (let child of __classPrivateFieldGet(this, _TreeNode_children, "f"))
|
|
146
|
+
clone.addChild(child.cloneInstance());
|
|
147
|
+
for (let data of __classPrivateFieldGet(this, _TreeNode_data, "f"))
|
|
148
|
+
clone.data.push(data);
|
|
149
|
+
for (let transform of __classPrivateFieldGet(this, _TreeNode_transformations, "f"))
|
|
150
|
+
clone.transformations.push({
|
|
151
|
+
id: transform.id,
|
|
152
|
+
matrix: gl_matrix_1.mat4.clone(transform.matrix)
|
|
153
|
+
});
|
|
154
|
+
return clone;
|
|
155
|
+
}
|
|
156
|
+
getChild(id) {
|
|
157
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _TreeNode_children, "f").length; i++)
|
|
158
|
+
if (__classPrivateFieldGet(this, _TreeNode_children, "f")[i].id === id)
|
|
159
|
+
return __classPrivateFieldGet(this, _TreeNode_children, "f")[i];
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
getPath() {
|
|
163
|
+
let path = this.name;
|
|
164
|
+
let node = this.parent;
|
|
165
|
+
while (node) {
|
|
166
|
+
path = node.name + '.' + path;
|
|
167
|
+
node = node.parent;
|
|
168
|
+
}
|
|
169
|
+
return path;
|
|
170
|
+
}
|
|
171
|
+
hasChild(child) {
|
|
172
|
+
return __classPrivateFieldGet(this, _TreeNode_children, "f").includes(child);
|
|
173
|
+
}
|
|
174
|
+
removeChild(child) {
|
|
175
|
+
const index = __classPrivateFieldGet(this, _TreeNode_children, "f").indexOf(child);
|
|
176
|
+
if (index === -1)
|
|
177
|
+
return false;
|
|
178
|
+
__classPrivateFieldGet(this, _TreeNode_children, "f").splice(index, 1);
|
|
179
|
+
child.parent = null;
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
updateVersion() {
|
|
183
|
+
let node = this;
|
|
184
|
+
while (node.parent !== null) {
|
|
185
|
+
node = node.parent;
|
|
186
|
+
node.updateVersionAtomic();
|
|
187
|
+
}
|
|
188
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _TreeNode_data, "f").length; i++)
|
|
189
|
+
__classPrivateFieldGet(this, _TreeNode_data, "f")[i].updateVersion();
|
|
190
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _TreeNode_children, "f").length; i++)
|
|
191
|
+
__classPrivateFieldGet(this, _TreeNode_children, "f")[i].updateVersion();
|
|
192
|
+
__classPrivateFieldSet(this, _TreeNode_version, __classPrivateFieldGet(this, _TreeNode_uuidGenerator, "f").create(), "f");
|
|
193
|
+
}
|
|
194
|
+
updateVersionAtomic() {
|
|
195
|
+
__classPrivateFieldSet(this, _TreeNode_version, __classPrivateFieldGet(this, _TreeNode_uuidGenerator, "f").create(), "f");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.TreeNode = TreeNode;
|
|
199
|
+
_TreeNode_children = new WeakMap(), _TreeNode_data = new WeakMap(), _TreeNode_eventEngine = new WeakMap(), _TreeNode_name = new WeakMap(), _TreeNode_uuidGenerator = new WeakMap(), _TreeNode_boundingBox = new WeakMap(), _TreeNode_id = new WeakMap(), _TreeNode_parent = new WeakMap(), _TreeNode_transformations = new WeakMap(), _TreeNode_excludeViewers = new WeakMap(), _TreeNode_version = new WeakMap(), _TreeNode_visible = new WeakMap();
|
|
200
|
+
//# sourceMappingURL=TreeNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeNode.js","sourceRoot":"","sources":["../src/TreeNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAAgC;AAChC,uCAAoC;AACpC,+EAA0F;AAC1F,uEAAoD;AAapD,MAAa,QAAQ;IA6BnB,YACE,OAAe,MAAM,EACrB,SAA0B,IAAI,EAC9B,OAAwB,EAAE,EAC1B,kBAAqC,EAAE;;QA9BzC,6BAAiC,EAAE,EAAC;QACpC,yBAAkC,EAAE,EAAC;QACrC,gCAAkD,oBAAS,CAAC,OAAO,CAAC,oCAAW,CAAC,EAAC;QACjF,yBAAyB,EAAE,EAAC;QAC5B,kCAAwD,oBAAS,CAAC,OAAO,CAAC,sCAAa,CAAC,EAAC;QAEzF,gCAAoB,IAAI,wBAAG,EAAE,EAAC;QAC9B,+BAAY;QACZ,2BAA2B,IAAI,EAAC;QAChC,oCAAsC,EAAE,EAAC;QACzC,mCAA4B,EAAE,EAAC;QAC/B,oCAAiB;QACjB,4BAAoB,IAAI,EAAC;QAoBvB,uBAAA,IAAI,kB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+BAAe,CAAC,MAAM,EAAE,MAAA,CAAC;IAC/C,CAAC;CAGF;AAxRD,4BAwRC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tree } from './Tree';
|
|
2
|
+
import { ITransformation, TreeNode } from './TreeNode';
|
|
3
|
+
import { ITreeNodeData } from './interfaces/ITreeNodeData';
|
|
4
|
+
import { AbstractTreeNodeData } from './AbstractTreeNodeData';
|
|
5
|
+
export { Tree };
|
|
6
|
+
export { TreeNode, ITransformation };
|
|
7
|
+
export { ITreeNodeData, AbstractTreeNodeData };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,EACH,IAAI,EACP,CAAA;AAED,OAAO,EACH,QAAQ,EAAE,eAAe,EAC5B,CAAA;AAED,OAAO,EACH,aAAa,EACb,oBAAoB,EACvB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractTreeNodeData = exports.TreeNode = exports.Tree = void 0;
|
|
4
|
+
const Tree_1 = require("./Tree");
|
|
5
|
+
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return Tree_1.Tree; } });
|
|
6
|
+
const TreeNode_1 = require("./TreeNode");
|
|
7
|
+
Object.defineProperty(exports, "TreeNode", { enumerable: true, get: function () { return TreeNode_1.TreeNode; } });
|
|
8
|
+
const AbstractTreeNodeData_1 = require("./AbstractTreeNodeData");
|
|
9
|
+
Object.defineProperty(exports, "AbstractTreeNodeData", { enumerable: true, get: function () { return AbstractTreeNodeData_1.AbstractTreeNodeData; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAMzB,qFANK,WAAI,OAML;AALR,yCAAsD;AASlD,yFATsB,mBAAQ,OAStB;AAPZ,iEAA6D;AAYzD,qGAZK,2CAAoB,OAYL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITreeNodeData.d.ts","sourceRoot":"","sources":["../../src/interfaces/ITreeNodeData.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,IAAI,IAAI,CAAC;IACtB,KAAK,IAAI,aAAa,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITreeNodeData.js","sourceRoot":"","sources":["../../src/interfaces/ITreeNodeData.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shapediver/viewer.shared.node-tree",
|
|
3
|
+
"version": "1.5.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
7
|
+
"license": "polyform-noncommercial-1.0.0",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"directories": {
|
|
10
|
+
"test": "__tests__"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/shapediver/Viewer.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "bash ../../scripts/test.sh",
|
|
24
|
+
"check": "tsc --noEmit",
|
|
25
|
+
"build": "bash ../../scripts/build.sh",
|
|
26
|
+
"build-watch": "bash ../../scripts/build-watch.sh",
|
|
27
|
+
"build-dep": "bash ../../scripts/build-dep.sh"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/shapediver/Viewer/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/shapediver/Viewer#readme",
|
|
33
|
+
"typings": "dist/index.d.ts",
|
|
34
|
+
"jest": {
|
|
35
|
+
"preset": "ts-jest",
|
|
36
|
+
"testEnvironment": "node"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@shapediver/viewer.shared.math": "^1.5.3",
|
|
40
|
+
"@shapediver/viewer.shared.services": "^1.5.3",
|
|
41
|
+
"gl-matrix": "3.3.0",
|
|
42
|
+
"tsyringe": "^4.5.0"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "c2e70623306be3b46c58621b6d35497c409a8020"
|
|
45
|
+
}
|