@shapediver/viewer.shared.node-tree
Advanced tools
Comparing version 2.12.8 to 3.0.0
import { ITreeNodeData } from '../interfaces/ITreeNodeData'; | ||
export declare abstract class AbstractTreeNodeData<T extends ITreeNodeData<any>> implements ITreeNodeData<T> { | ||
export declare abstract class AbstractTreeNodeData implements ITreeNodeData { | ||
#private; | ||
@@ -10,13 +10,21 @@ /** | ||
constructor(id?: string, version?: string); | ||
get convertedObject(): { | ||
[key: string]: unknown; | ||
}; | ||
set convertedObject(value: { | ||
[key: string]: unknown; | ||
}); | ||
get id(): string; | ||
get updateCallbackConvertedObject(): ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null; | ||
set updateCallbackConvertedObject(value: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null); | ||
get version(): string; | ||
/** | ||
* Clones the tree node data. | ||
*/ | ||
clone(): ITreeNodeData; | ||
/** | ||
* Update the version | ||
*/ | ||
updateVersion(): void; | ||
/** | ||
* Clones the tree node data. | ||
*/ | ||
clone(): T; | ||
} | ||
//# sourceMappingURL=AbstractTreeNodeData.d.ts.map |
@@ -13,3 +13,3 @@ "use strict"; | ||
}; | ||
var _AbstractTreeNodeData_version, _AbstractTreeNodeData_id, _AbstractTreeNodeData_uuidGenerator, _AbstractTreeNodeData_eventEngine; | ||
var _AbstractTreeNodeData_id, _AbstractTreeNodeData_uuidGenerator, _AbstractTreeNodeData_convertedObject, _AbstractTreeNodeData_updateCallbackConvertedObject, _AbstractTreeNodeData_version; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -19,3 +19,3 @@ exports.AbstractTreeNodeData = void 0; | ||
class AbstractTreeNodeData { | ||
// #endregion Properties (3) | ||
// #endregion Properties (5) | ||
// #region Constructors (1) | ||
@@ -28,7 +28,8 @@ /** | ||
constructor(id, version) { | ||
// #region Properties (3) | ||
_AbstractTreeNodeData_version.set(this, void 0); | ||
// #region Properties (5) | ||
_AbstractTreeNodeData_id.set(this, void 0); | ||
_AbstractTreeNodeData_uuidGenerator.set(this, viewer_shared_services_1.UuidGenerator.instance); | ||
_AbstractTreeNodeData_eventEngine.set(this, viewer_shared_services_1.EventEngine.instance); | ||
_AbstractTreeNodeData_convertedObject.set(this, {}); | ||
_AbstractTreeNodeData_updateCallbackConvertedObject.set(this, null); | ||
_AbstractTreeNodeData_version.set(this, void 0); | ||
__classPrivateFieldSet(this, _AbstractTreeNodeData_id, id || __classPrivateFieldGet(this, _AbstractTreeNodeData_uuidGenerator, "f").create(), "f"); | ||
@@ -38,12 +39,31 @@ __classPrivateFieldSet(this, _AbstractTreeNodeData_version, version || __classPrivateFieldGet(this, _AbstractTreeNodeData_uuidGenerator, "f").create(), "f"); | ||
// #endregion Constructors (1) | ||
// #region Public Accessors (2) | ||
// #region Public Getters And Setters (6) | ||
get convertedObject() { | ||
return __classPrivateFieldGet(this, _AbstractTreeNodeData_convertedObject, "f"); | ||
} | ||
set convertedObject(value) { | ||
__classPrivateFieldSet(this, _AbstractTreeNodeData_convertedObject, value, "f"); | ||
} | ||
get id() { | ||
return __classPrivateFieldGet(this, _AbstractTreeNodeData_id, "f"); | ||
} | ||
get updateCallbackConvertedObject() { | ||
return __classPrivateFieldGet(this, _AbstractTreeNodeData_updateCallbackConvertedObject, "f"); | ||
} | ||
set updateCallbackConvertedObject(value) { | ||
__classPrivateFieldSet(this, _AbstractTreeNodeData_updateCallbackConvertedObject, value, "f"); | ||
} | ||
get version() { | ||
return __classPrivateFieldGet(this, _AbstractTreeNodeData_version, "f"); | ||
} | ||
// #endregion Public Accessors (2) | ||
// #region Public Methods (1) | ||
// #endregion Public Getters And Setters (6) | ||
// #region Public Methods (2) | ||
/** | ||
* Clones the tree node data. | ||
*/ | ||
clone() { | ||
const clone = new this.constructor(); | ||
return clone; | ||
} | ||
/** | ||
* Update the version | ||
@@ -54,15 +74,5 @@ */ | ||
} | ||
// #endregion Public Methods (1) | ||
// #region Public Abstract Methods (1) | ||
/** | ||
* Clones the tree node data. | ||
*/ | ||
clone() { | ||
const clone = new this.constructor; | ||
return clone; | ||
} | ||
; | ||
} | ||
exports.AbstractTreeNodeData = AbstractTreeNodeData; | ||
_AbstractTreeNodeData_version = new WeakMap(), _AbstractTreeNodeData_id = new WeakMap(), _AbstractTreeNodeData_uuidGenerator = new WeakMap(), _AbstractTreeNodeData_eventEngine = new WeakMap(); | ||
_AbstractTreeNodeData_id = new WeakMap(), _AbstractTreeNodeData_uuidGenerator = new WeakMap(), _AbstractTreeNodeData_convertedObject = new WeakMap(), _AbstractTreeNodeData_updateCallbackConvertedObject = new WeakMap(), _AbstractTreeNodeData_version = new WeakMap(); | ||
//# sourceMappingURL=AbstractTreeNodeData.js.map |
@@ -1,11 +0,10 @@ | ||
import { ITransformation } from './interfaces/ITreeNode'; | ||
import { TreeNodeThreeJs } from './implementation/three/TreeNodeThreejs'; | ||
import { ITreeNodeThreeJs } from './interfaces/three/ITreeNodeThreeJs'; | ||
import { Tree } from './implementation/three/Tree'; | ||
import { ITreeThreeJs } from './interfaces/three/ITreeThreeJs'; | ||
import { ITreeNodeDataThreeJs } from './interfaces/three/ITreeNodeDataThreeJs'; | ||
import { AbstractTreeNodeDataThreeJs } from './implementation/three/AbstractTreeNodeDataThreeJs'; | ||
export { ITreeThreeJs as ITree, Tree }; | ||
export { ITreeNodeThreeJs as ITreeNode, TreeNodeThreeJs as TreeNode, ITransformation }; | ||
export { ITreeNodeDataThreeJs as ITreeNodeData, AbstractTreeNodeDataThreeJs as AbstractTreeNodeData }; | ||
import { AbstractTreeNodeData } from './implementation/AbstractTreeNodeData'; | ||
import { ITransformation, ITreeNode } from './interfaces/ITreeNode'; | ||
import { ITree } from './interfaces/ITree'; | ||
import { ITreeNodeData } from './interfaces/ITreeNodeData'; | ||
import { Tree } from './implementation/Tree'; | ||
import { TreeNode } from './implementation/TreeNode'; | ||
export { ITree, Tree }; | ||
export { ITreeNode, TreeNode, ITransformation }; | ||
export { ITreeNodeData, AbstractTreeNodeData }; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AbstractTreeNodeData = exports.TreeNode = exports.Tree = void 0; | ||
const TreeNodeThreejs_1 = require("./implementation/three/TreeNodeThreejs"); | ||
Object.defineProperty(exports, "TreeNode", { enumerable: true, get: function () { return TreeNodeThreejs_1.TreeNodeThreeJs; } }); | ||
const Tree_1 = require("./implementation/three/Tree"); | ||
const AbstractTreeNodeData_1 = require("./implementation/AbstractTreeNodeData"); | ||
Object.defineProperty(exports, "AbstractTreeNodeData", { enumerable: true, get: function () { return AbstractTreeNodeData_1.AbstractTreeNodeData; } }); | ||
const Tree_1 = require("./implementation/Tree"); | ||
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return Tree_1.Tree; } }); | ||
const AbstractTreeNodeDataThreeJs_1 = require("./implementation/three/AbstractTreeNodeDataThreeJs"); | ||
Object.defineProperty(exports, "AbstractTreeNodeData", { enumerable: true, get: function () { return AbstractTreeNodeDataThreeJs_1.AbstractTreeNodeDataThreeJs; } }); | ||
const TreeNode_1 = require("./implementation/TreeNode"); | ||
Object.defineProperty(exports, "TreeNode", { enumerable: true, get: function () { return TreeNode_1.TreeNode; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,7 @@ | ||
import { ITreeNode } from "./ITreeNode"; | ||
import { ITreeNodeData } from "./ITreeNodeData"; | ||
export interface ITree<T extends ITreeNode<any, ITreeNodeData<any>>> { | ||
import { ITreeNode } from './ITreeNode'; | ||
export interface ITree { | ||
/** | ||
* The root of the tree. | ||
*/ | ||
readonly root: T; | ||
readonly root: ITreeNode; | ||
/** | ||
@@ -15,3 +14,3 @@ * Add the node as a child of the corresponding parent node. | ||
*/ | ||
addNode(node: T, parent?: T, root?: T): boolean; | ||
addNode(node: ITreeNode, parent?: ITreeNode, root?: ITreeNode): boolean; | ||
/** | ||
@@ -24,3 +23,3 @@ * Add the node at the corresponding path. (paths are dot separated ids) | ||
*/ | ||
addNodeAtPath(node: T, path?: string, root?: T): boolean; | ||
addNodeAtPath(node: ITreeNode, path?: string, root?: ITreeNode): boolean; | ||
/** | ||
@@ -33,3 +32,3 @@ * Get the node at the provided path. | ||
*/ | ||
getNodeAtPath(path?: string, root?: T): T | null; | ||
getNodeAtPath(path?: string, root?: ITreeNode): ITreeNode | null; | ||
/** | ||
@@ -41,3 +40,3 @@ * Remove a node from the tree. | ||
*/ | ||
removeNode(node: T, root?: T): boolean; | ||
removeNode(node: ITreeNode, root?: ITreeNode): boolean; | ||
/** | ||
@@ -49,4 +48,4 @@ * Remove a node via the path of it. | ||
*/ | ||
removeNodeAtPath(path: string, root?: T): boolean; | ||
removeNodeAtPath(path: string, root?: ITreeNode): boolean; | ||
} | ||
//# sourceMappingURL=ITree.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { mat4 } from 'gl-matrix'; | ||
import { IBox } from '@shapediver/viewer.shared.math'; | ||
import { ITreeNodeData } from './ITreeNodeData'; | ||
import { mat4 } from 'gl-matrix'; | ||
export interface ITransformation { | ||
@@ -8,3 +8,3 @@ id: string; | ||
} | ||
export interface ITreeNode<T extends ITreeNode<any, ITreeNodeData<any>>, U extends ITreeNodeData<any>> { | ||
export interface ITreeNode { | ||
/** | ||
@@ -25,3 +25,3 @@ * The bounding box of this tree node. | ||
*/ | ||
readonly children: T[]; | ||
readonly children: ITreeNode[]; | ||
/** | ||
@@ -33,3 +33,3 @@ * The data of this tree node. | ||
*/ | ||
readonly data: U[]; | ||
readonly data: ITreeNodeData[]; | ||
/** | ||
@@ -56,3 +56,3 @@ * The ID of the tree node. | ||
*/ | ||
readonly parent?: T; | ||
readonly parent?: ITreeNode; | ||
/** | ||
@@ -76,4 +76,10 @@ * The version of the tree node. | ||
*/ | ||
bones: T[]; | ||
bones: ITreeNode[]; | ||
/** | ||
* The converted object of the tree node. | ||
*/ | ||
convertedObject: { | ||
[key: string]: unknown; | ||
}; | ||
/** | ||
* The viewports to exclude this tree node from. | ||
@@ -95,2 +101,6 @@ */ | ||
/** | ||
* The update callback for the converted object of the tree node. | ||
*/ | ||
updateCallbackConvertedObject: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null; | ||
/** | ||
* Option to make this tree node visible. (default: true) | ||
@@ -104,3 +114,3 @@ */ | ||
*/ | ||
addChild(child: T): boolean; | ||
addChild(child: ITreeNode): boolean; | ||
/** | ||
@@ -111,3 +121,3 @@ * Add a data item to node. | ||
*/ | ||
addData(data: U): boolean; | ||
addData(data: ITreeNodeData): boolean; | ||
/** | ||
@@ -124,3 +134,3 @@ * Add a transformation to this node. | ||
*/ | ||
clone(): T; | ||
clone(): ITreeNode; | ||
/** | ||
@@ -130,21 +140,21 @@ * Clones this node and all its children. | ||
*/ | ||
cloneInstance(): T; | ||
cloneInstance(): ITreeNode; | ||
/** | ||
* Returns the child with the specified id | ||
*/ | ||
getChild(id: string): T | undefined; | ||
getChild(id: string): ITreeNode | undefined; | ||
/** | ||
* Returns the data item with the specified id | ||
*/ | ||
getData(id: string): U | undefined; | ||
getData(id: string): ITreeNodeData | undefined; | ||
/** | ||
* Test this node and all it's descendents for nodes with the specified name and return them in an array. | ||
* Test this node and all it's descendants for nodes with the specified name and return them in an array. | ||
* @param name | ||
*/ | ||
getNodesByName(name: string): T[]; | ||
getNodesByName(name: string): ITreeNode[]; | ||
/** | ||
* Test this nodes name and all it's descendents name for nodes for the specified regex and return them in an array. | ||
* Test this nodes name and all it's descendants name for nodes for the specified regex and return them in an array. | ||
* @param regex | ||
*/ | ||
getNodesByNameWithRegex(regex: RegExp): T[]; | ||
getNodesByNameWithRegex(regex: RegExp): ITreeNode[]; | ||
/** | ||
@@ -163,3 +173,3 @@ * Return the path to this node. | ||
*/ | ||
hasChild(child: T): boolean; | ||
hasChild(child: ITreeNode): boolean; | ||
/** | ||
@@ -170,3 +180,3 @@ * Check for existence of a data item of this node. | ||
*/ | ||
hasData(data: U): boolean; | ||
hasData(data: ITreeNodeData): boolean; | ||
/** | ||
@@ -183,3 +193,3 @@ * Check for existence of a transformation of this node. | ||
*/ | ||
removeChild(child: T): boolean; | ||
removeChild(child: ITreeNode): boolean; | ||
/** | ||
@@ -190,3 +200,3 @@ * Remove a data item from this node. | ||
*/ | ||
removeData(data: U): boolean; | ||
removeData(data: ITreeNodeData): boolean; | ||
/** | ||
@@ -203,3 +213,3 @@ * Remove a transformation from this node. | ||
*/ | ||
traverse(callback: (node: T) => void): void; | ||
traverse(callback: (node: ITreeNode) => void): void; | ||
/** | ||
@@ -210,8 +220,11 @@ * Traverse this node and all it's children and executes the callback for all data items of them | ||
*/ | ||
traverseData(callback: (data: U) => void): void; | ||
traverseData(callback: (data: ITreeNodeData) => void): void; | ||
/** | ||
* Update the version. | ||
* | ||
* @param parents if true, the version of all parents will be updated as well (default: true) | ||
* @param children if true, the version of all children will be updated as well (default: true) | ||
*/ | ||
updateVersion(): void; | ||
updateVersion(parents?: boolean, children?: boolean): void; | ||
} | ||
//# sourceMappingURL=ITreeNode.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// #endregion Interfaces (2) | ||
//# sourceMappingURL=ITreeNode.js.map |
@@ -1,21 +0,31 @@ | ||
export interface ITreeNodeData<T extends ITreeNodeData<any>> { | ||
export interface ITreeNodeData { | ||
/** | ||
* The ID of the tree node data. | ||
* The converted object of the tree node. | ||
*/ | ||
convertedObject: { | ||
[key: string]: unknown; | ||
}; | ||
/** | ||
* The ID of the tree node data. | ||
*/ | ||
id: string; | ||
/** | ||
* The version of the tree node data. | ||
* If the version changes, the node data will be marked for an update. | ||
* A version change can be triggered via {@link updateVersion}. | ||
* The update callback for the converted object of the tree node. | ||
*/ | ||
updateCallbackConvertedObject: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null; | ||
/** | ||
* The version of the tree node data. | ||
* If the version changes, the node data will be marked for an update. | ||
* A version change can be triggered via {@link updateVersion}. | ||
*/ | ||
version: string; | ||
/** | ||
* Clones this node tree data. | ||
*/ | ||
clone(): T; | ||
* Clones this node tree data. | ||
*/ | ||
clone(): ITreeNodeData; | ||
/** | ||
* Update the version. | ||
*/ | ||
* Update the version. | ||
*/ | ||
updateVersion(): void; | ||
} | ||
//# sourceMappingURL=ITreeNodeData.d.ts.map |
{ | ||
"name": "@shapediver/viewer.shared.node-tree", | ||
"version": "2.12.8", | ||
"version": "3.0.0", | ||
"description": "", | ||
@@ -42,9 +42,7 @@ "keywords": [], | ||
"dependencies": { | ||
"@shapediver/viewer.shared.math": "2.12.8", | ||
"@shapediver/viewer.shared.services": "2.12.8", | ||
"@types/three": "0.152.0", | ||
"gl-matrix": "3.3.0", | ||
"three": "0.152.2" | ||
"@shapediver/viewer.shared.math": "3.0.0", | ||
"@shapediver/viewer.shared.services": "3.0.0", | ||
"gl-matrix": "3.3.0" | ||
}, | ||
"gitHead": "615c459595cdea9ceeca8a307d469c617ce36684" | ||
"gitHead": "b6b0010bf5d5652aa338df8016405d97f33fcabb" | ||
} |
@@ -1,16 +0,16 @@ | ||
import { UuidGenerator, EventEngine, EVENTTYPE } from '@shapediver/viewer.shared.services' | ||
import { ITreeNodeData } from '../interfaces/ITreeNodeData'; | ||
import { UuidGenerator } from '@shapediver/viewer.shared.services'; | ||
import { ITreeNodeData } from '../interfaces/ITreeNodeData' | ||
export abstract class AbstractTreeNodeData implements ITreeNodeData { | ||
// #region Properties (5) | ||
export abstract class AbstractTreeNodeData<T extends ITreeNodeData<any>> implements ITreeNodeData<T> { | ||
// #region Properties (3) | ||
readonly #id: string; | ||
readonly #uuidGenerator: UuidGenerator = UuidGenerator.instance; | ||
#convertedObject: { [key: string]: unknown } = {}; | ||
#updateCallbackConvertedObject: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null = null; | ||
#version: string; | ||
readonly #id: string; | ||
readonly #uuidGenerator: UuidGenerator = UuidGenerator.instance; | ||
readonly #eventEngine: EventEngine = EventEngine.instance; | ||
// #endregion Properties (5) | ||
// #endregion Properties (3) | ||
// #region Constructors (1) | ||
@@ -30,4 +30,12 @@ | ||
// #region Public Accessors (2) | ||
// #region Public Getters And Setters (6) | ||
public get convertedObject(): { [key: string]: unknown } { | ||
return this.#convertedObject; | ||
} | ||
public set convertedObject(value: { [key: string]: unknown }) { | ||
this.#convertedObject = value; | ||
} | ||
public get id(): string { | ||
@@ -37,11 +45,27 @@ return this.#id; | ||
public get updateCallbackConvertedObject(): ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null { | ||
return this.#updateCallbackConvertedObject; | ||
} | ||
public set updateCallbackConvertedObject(value: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null) { | ||
this.#updateCallbackConvertedObject = value; | ||
} | ||
public get version(): string { | ||
return this.#version; | ||
} | ||
// #endregion Public Accessors (2) | ||
// #region Public Methods (1) | ||
// #endregion Public Getters And Setters (6) | ||
// #region Public Methods (2) | ||
/** | ||
* Clones the tree node data. | ||
*/ | ||
public clone(): ITreeNodeData { | ||
const clone = new (this.constructor as new () => ITreeNodeData)(); | ||
return clone; | ||
} | ||
/** | ||
* Update the version | ||
@@ -53,15 +77,3 @@ */ | ||
// #endregion Public Methods (1) | ||
// #region Public Abstract Methods (1) | ||
/** | ||
* Clones the tree node data. | ||
*/ | ||
public clone(): T { | ||
const clone = new (<any>this.constructor); | ||
return clone; | ||
}; | ||
// #endregion Public Abstract Methods (1) | ||
// #endregion Public Methods (2) | ||
} |
@@ -1,19 +0,18 @@ | ||
import { ITransformation } from './interfaces/ITreeNode' | ||
import { TreeNodeThreeJs } from './implementation/three/TreeNodeThreejs' | ||
import { ITreeNodeThreeJs } from './interfaces/three/ITreeNodeThreeJs' | ||
import { Tree } from './implementation/three/Tree' | ||
import { ITreeThreeJs } from './interfaces/three/ITreeThreeJs' | ||
import { ITreeNodeDataThreeJs } from './interfaces/three/ITreeNodeDataThreeJs' | ||
import { AbstractTreeNodeDataThreeJs } from './implementation/three/AbstractTreeNodeDataThreeJs' | ||
import { AbstractTreeNodeData } from './implementation/AbstractTreeNodeData'; | ||
import { ITransformation, ITreeNode } from './interfaces/ITreeNode'; | ||
import { ITree } from './interfaces/ITree'; | ||
import { ITreeNodeData } from './interfaces/ITreeNodeData'; | ||
import { Tree } from './implementation/Tree'; | ||
import { TreeNode } from './implementation/TreeNode'; | ||
export { | ||
ITreeThreeJs as ITree, Tree | ||
} | ||
ITree, Tree | ||
}; | ||
export { | ||
ITreeNodeThreeJs as ITreeNode, TreeNodeThreeJs as TreeNode, ITransformation | ||
} | ||
ITreeNode, TreeNode, ITransformation | ||
}; | ||
export { | ||
ITreeNodeDataThreeJs as ITreeNodeData, AbstractTreeNodeDataThreeJs as AbstractTreeNodeData | ||
} | ||
ITreeNodeData, AbstractTreeNodeData | ||
}; |
@@ -1,5 +0,4 @@ | ||
import { ITreeNode } from "./ITreeNode"; | ||
import { ITreeNodeData } from "./ITreeNodeData"; | ||
import { ITreeNode } from './ITreeNode'; | ||
export interface ITree<T extends ITreeNode<any, ITreeNodeData<any>>> { | ||
export interface ITree { | ||
// #region Properties (1) | ||
@@ -10,3 +9,3 @@ | ||
*/ | ||
readonly root: T; | ||
readonly root: ITreeNode; | ||
@@ -24,4 +23,3 @@ // #endregion Properties (1) | ||
*/ | ||
addNode(node: T, parent?: T, root?: T): boolean; | ||
addNode(node: ITreeNode, parent?: ITreeNode, root?: ITreeNode): boolean; | ||
/** | ||
@@ -34,4 +32,3 @@ * Add the node at the corresponding path. (paths are dot separated ids) | ||
*/ | ||
addNodeAtPath(node: T, path?: string, root?: T): boolean; | ||
addNodeAtPath(node: ITreeNode, path?: string, root?: ITreeNode): boolean; | ||
/** | ||
@@ -44,4 +41,3 @@ * Get the node at the provided path. | ||
*/ | ||
getNodeAtPath(path?: string, root?: T): T | null; | ||
getNodeAtPath(path?: string, root?: ITreeNode): ITreeNode | null; | ||
/** | ||
@@ -53,4 +49,3 @@ * Remove a node from the tree. | ||
*/ | ||
removeNode(node: T, root?: T): boolean; | ||
removeNode(node: ITreeNode, root?: ITreeNode): boolean; | ||
/** | ||
@@ -62,5 +57,5 @@ * Remove a node via the path of it. | ||
*/ | ||
removeNodeAtPath(path: string, root?: T): boolean; | ||
removeNodeAtPath(path: string, root?: ITreeNode): boolean; | ||
// #endregion Public Methods (5) | ||
} |
@@ -1,5 +0,7 @@ | ||
import { mat4 } from 'gl-matrix' | ||
import { IBox } from '@shapediver/viewer.shared.math' | ||
import { ITreeNodeData } from './ITreeNodeData' | ||
import { IBox } from '@shapediver/viewer.shared.math'; | ||
import { ITreeNodeData } from './ITreeNodeData'; | ||
import { mat4 } from 'gl-matrix'; | ||
// #region Interfaces (2) | ||
export interface ITransformation { | ||
@@ -14,4 +16,4 @@ // #region Properties (2) | ||
export interface ITreeNode<T extends ITreeNode<any, ITreeNodeData<any>>, U extends ITreeNodeData<any>> { | ||
// #region Properties (18) | ||
export interface ITreeNode { | ||
// #region Properties (20) | ||
@@ -31,3 +33,3 @@ /** | ||
*/ | ||
readonly children: T[]; | ||
readonly children: ITreeNode[]; | ||
/** | ||
@@ -39,3 +41,3 @@ * The data of this tree node. | ||
*/ | ||
readonly data: U[]; | ||
readonly data: ITreeNodeData[]; | ||
/** | ||
@@ -62,3 +64,3 @@ * The ID of the tree node. | ||
*/ | ||
readonly parent?: T; | ||
readonly parent?: ITreeNode; | ||
/** | ||
@@ -83,4 +85,8 @@ * The version of the tree node. | ||
*/ | ||
bones: T[]; | ||
bones: ITreeNode[]; | ||
/** | ||
* The converted object of the tree node. | ||
*/ | ||
convertedObject: { [key: string]: unknown }; | ||
/** | ||
* The viewports to exclude this tree node from. | ||
@@ -102,2 +108,6 @@ */ | ||
/** | ||
* The update callback for the converted object of the tree node. | ||
*/ | ||
updateCallbackConvertedObject: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null; | ||
/** | ||
* Option to make this tree node visible. (default: true) | ||
@@ -107,3 +117,3 @@ */ | ||
// #endregion Properties (18) | ||
// #endregion Properties (20) | ||
@@ -117,3 +127,3 @@ // #region Public Methods (20) | ||
*/ | ||
addChild(child: T): boolean; | ||
addChild(child: ITreeNode): boolean; | ||
/** | ||
@@ -124,3 +134,3 @@ * Add a data item to node. | ||
*/ | ||
addData(data: U): boolean; | ||
addData(data: ITreeNodeData): boolean; | ||
/** | ||
@@ -137,3 +147,3 @@ * Add a transformation to this node. | ||
*/ | ||
clone(): T; | ||
clone(): ITreeNode; | ||
/** | ||
@@ -143,21 +153,21 @@ * Clones this node and all its children. | ||
*/ | ||
cloneInstance(): T; | ||
cloneInstance(): ITreeNode; | ||
/** | ||
* Returns the child with the specified id | ||
*/ | ||
getChild(id: string): T | undefined; | ||
getChild(id: string): ITreeNode | undefined; | ||
/** | ||
* Returns the data item with the specified id | ||
*/ | ||
getData(id: string): U | undefined; | ||
getData(id: string): ITreeNodeData | undefined; | ||
/** | ||
* Test this node and all it's descendents for nodes with the specified name and return them in an array. | ||
* Test this node and all it's descendants for nodes with the specified name and return them in an array. | ||
* @param name | ||
*/ | ||
getNodesByName(name: string): T[] | ||
getNodesByName(name: string): ITreeNode[] | ||
/** | ||
* Test this nodes name and all it's descendents name for nodes for the specified regex and return them in an array. | ||
* Test this nodes name and all it's descendants name for nodes for the specified regex and return them in an array. | ||
* @param regex | ||
*/ | ||
getNodesByNameWithRegex(regex: RegExp): T[] | ||
getNodesByNameWithRegex(regex: RegExp): ITreeNode[] | ||
/** | ||
@@ -176,3 +186,3 @@ * Return the path to this node. | ||
*/ | ||
hasChild(child: T): boolean; | ||
hasChild(child: ITreeNode): boolean; | ||
/** | ||
@@ -183,3 +193,3 @@ * Check for existence of a data item of this node. | ||
*/ | ||
hasData(data: U): boolean; | ||
hasData(data: ITreeNodeData): boolean; | ||
/** | ||
@@ -196,3 +206,3 @@ * Check for existence of a transformation of this node. | ||
*/ | ||
removeChild(child: T): boolean; | ||
removeChild(child: ITreeNode): boolean; | ||
/** | ||
@@ -203,3 +213,3 @@ * Remove a data item from this node. | ||
*/ | ||
removeData(data: U): boolean; | ||
removeData(data: ITreeNodeData): boolean; | ||
/** | ||
@@ -216,3 +226,3 @@ * Remove a transformation from this node. | ||
*/ | ||
traverse(callback: (node: T) => void): void; | ||
traverse(callback: (node: ITreeNode) => void): void; | ||
/** | ||
@@ -223,9 +233,14 @@ * Traverse this node and all it's children and executes the callback for all data items of them | ||
*/ | ||
traverseData(callback: (data: U) => void): void; | ||
traverseData(callback: (data: ITreeNodeData) => void): void; | ||
/** | ||
* Update the version. | ||
* | ||
* @param parents if true, the version of all parents will be updated as well (default: true) | ||
* @param children if true, the version of all children will be updated as well (default: true) | ||
*/ | ||
updateVersion(): void; | ||
updateVersion(parents?: boolean, children?: boolean): void; | ||
// #endregion Public Methods (20) | ||
} | ||
} | ||
// #endregion Interfaces (2) |
@@ -1,16 +0,24 @@ | ||
export interface ITreeNodeData<T extends ITreeNodeData<any>> { | ||
// #region Properties (2) | ||
export interface ITreeNodeData { | ||
// #region Properties (4) | ||
/** | ||
* The ID of the tree node data. | ||
* The converted object of the tree node. | ||
*/ | ||
convertedObject: { [key: string]: unknown }; | ||
/** | ||
* The ID of the tree node data. | ||
*/ | ||
id: string; | ||
/** | ||
* The version of the tree node data. | ||
* If the version changes, the node data will be marked for an update. | ||
* A version change can be triggered via {@link updateVersion}. | ||
* The update callback for the converted object of the tree node. | ||
*/ | ||
updateCallbackConvertedObject: ((newObj: unknown, oldObj: unknown, viewport: string) => void) | null; | ||
/** | ||
* The version of the tree node data. | ||
* If the version changes, the node data will be marked for an update. | ||
* A version change can be triggered via {@link updateVersion}. | ||
*/ | ||
version: string; | ||
// #endregion Properties (2) | ||
// #endregion Properties (4) | ||
@@ -20,8 +28,8 @@ // #region Public Methods (2) | ||
/** | ||
* Clones this node tree data. | ||
*/ | ||
clone(): T; | ||
* Clones this node tree data. | ||
*/ | ||
clone(): ITreeNodeData; | ||
/** | ||
* Update the version. | ||
*/ | ||
* Update the version. | ||
*/ | ||
updateVersion(): void; | ||
@@ -28,0 +36,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
98578
366
39
1775
1
6
+ Added@shapediver/viewer.settings@1.0.1(transitive)
+ Added@shapediver/viewer.shared.build-data@3.0.0(transitive)
+ Added@shapediver/viewer.shared.math@3.0.0(transitive)
+ Added@shapediver/viewer.shared.services@3.0.0(transitive)
+ Addedzod@3.23.8(transitive)
- Removed@types/three@0.152.0
- Removedthree@0.152.2
- Removed@hapi/hoek@9.3.0(transitive)
- Removed@hapi/topo@5.1.0(transitive)
- Removed@shapediver/viewer.settings@0.5.7(transitive)
- Removed@shapediver/viewer.shared.build-data@2.12.8(transitive)
- Removed@shapediver/viewer.shared.math@2.12.8(transitive)
- Removed@shapediver/viewer.shared.services@2.12.8(transitive)
- Removed@sideway/address@4.1.5(transitive)
- Removed@sideway/formula@3.0.1(transitive)
- Removed@sideway/pinpoint@2.0.0(transitive)
- Removed@tweenjs/tween.js@18.6.4(transitive)
- Removed@types/stats.js@0.17.3(transitive)
- Removed@types/three@0.152.0(transitive)
- Removed@types/webxr@0.5.20(transitive)
- Removedfflate@0.6.10(transitive)
- Removedjoi@17.13.3(transitive)
- Removedlil-gui@0.17.0(transitive)
- Removedthree@0.152.2(transitive)